Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - Jerros

Pages: [1] 2
1
ASM / Controll routine question
« on: August 03, 2011, 06:35:51 am »
Been struggling with this for a while now; the principle I'm looking for is simple and straightforward: react to the last button pressed, regardless of whatever else might be pressed or released.
So if you press '1', it perorms 'Label1' once, even if you have 2-9 held down at the same time already, or release random other buttons that were being held down before. Push the button, perform thát routine once. Nóthing more, nothing less.  ;)
I'm sure there must be a simple way to do this, but... I'm newby.  :-[
If anyone has any tips on how to do this, it'd be greatly appreciated!

Thanks alot in advance.

2
ASM / Short scrip, yet it fails?
« on: July 12, 2011, 03:44:53 am »
The thing is, there are 16 sprites defined as followed:
Code: [Select]
SpriteNumber .equ AppBackUpScreen
yspr1 .equ SpriteNumber+2
xspr1 .equ yspr1+1
yspr2 .equ xspr1+1
xspr2 .equ yspr2+1
yspr3 .equ xspr2+1
xspr3 .equ yspr3+1
yspr4 .equ xspr3+1
xspr4 .equ yspr4+1
yspr5 .equ xspr4+1
xspr5 .equ yspr5+1
;etc.

Now, there is the following piece of code, with input C = Xcoordinate of a sprite.
The idea is that it's loading C (thus an x-coordinate) to Sprite1, then Sprite2, then 3 etc. and after Sprite16 has been assigned, it starts over with Spr1 again. There's something glitchy, since it sometimes suddenly removes sprites from the screen (thus assigns x,y values to a sprite on the screen already). I can'tr figure out what's wrong though. Could it perhaps be because of direct input with the buttonpresses that it sometimes fails to finish this loop or something?

Script:

Code: [Select]
NextSprite:
LD hl, SpriteNumber
LD A, (SpriteNumber)
LD B, A
NextSpriteLoop:
INC HL                                ; 2x INC HL will go to the next sprite, since each HL holds X
INC HL                                ; and Y respectively of the current spritenumber
djnz NextSpriteLoop                    ; Keeps track of the current sprite
LD A, -9                             ; Set the Y position of the current sprite
LD (hl), A                            ; And save it to Sprite*number*
INC HL
LD (hl), C                            ; Save an X-coordinate to Sprite*number*
LD A, (SpriteNumber)
CP 16                                 ; After giving an X and Y to Sprite16, start with Sprite 1 again
JR Z, ResetSpriteNumber
INC A
LD (SpriteNumber), A
ret
ResetSpriteNumber:
LD A, 1
LD (SpriteNumber), A
ret

So... is there something wrong? Or are the errors caused by other factors?
Thanks!

3
ASM / List of Bytes/Time each command takes?
« on: July 02, 2011, 08:45:47 am »
Is there any list stating all .z80 ASM commands with the number of T-cycles and Bytes they take? Or actually just the latter, since there are sites giving the number of T-cycles already, but no luck on finding the bytes per command yet... This would really help making speed/lenth decisions.
Thank you!

4
ASM / Macro fails, but script works?
« on: June 28, 2011, 11:18:23 am »
This... is odd, I'm using AppDev (DWedit ?) for creating apps, but it's crashing when changing a certain macro.
This still works fine:
Code: [Select]
#define N1_R1 CALL Something1
#defcont \ CALL New1
#define N2_R1 CALL Something1
#defcont \ CALL New2
#define N3_R1 CALL Something1
#defcont \ CALL New3
#define N4_R1 CALL Something1
#defcont \ CALL New4
But as soon as I add one more:
Code: [Select]
(...)
#define N4_R1 CALL Something1
#defcont \ CALL New4
#define N5_R1 CALL Something1
#defcont \ CALL New5
It crashes. It's not the "New5" thingy, since it does the same for 6 and up, and when removing one earlier macro it does work fine with "5" and up. Now, this could indicate that the maximum number of macro's has been reached, however this is not the case. It can hold up to 1000 macros, and it's still far from. Plus, when adding many other macros it still works like a charm.
And what's even weirder, when using the macro to run a CALL containing both lines, line this:
Code: [Select]
#define N6_R1 CALL DoBoth
(...)
DoBoth:
     CALL     Something1
     CALL     New6
ret
it works fine again. Can go all the way from 1-w/e with that. (Though I guess it's faster and shorter to use the two CALLs in a row, rather than making a small routing doing both CALLs, right?). It's not the scripts which are being called either - with any other macro substituting for those it works fine. Am I missing something?

Thanks in advance!

5
ASM / Controlls script question
« on: June 11, 2011, 06:01:16 am »
Currently I'm using the pretty much standart standart way of reacting to input:
Code: [Select]
   b_call _GetCSC
    CP     skDel
    JP     Z, Quit
    CP     skYequ
    JP     Z, presYequ
    CP     skWindow
    JP     Z, presWindow
    CP     skZoom
    JP     Z, presZoom
    CP     skTrace
    JP     Z, presTrace
    CP     skGraph
    JP     Z, presGraph
in a,($04)
bit 3,a
jp z,Quit
However, some things have come to attention when using this, for example that if you press two or more buttons, it won't react (obviously), but when releasing all but one of them, it'll register the remaining key as one press.

The mechanics I'm looking for (but have no idea on how to achieve) is this:
 - register the lást key pressed as a single keypress (for example, let's say we press and hold the '1' button, and then the '2' (so both are being held down now), it performs a 'JumpTo1' script and then a 'JumpTo2' script when 2 is being pressed).
 - the same goes for the other way around, when first pressing and holding '2' and then '1', it performs a 'JPto2' and on the second keypress a 'JPto1'. So a normal 'react-to-2-buttons' script won't work, since the order doesn't matter for that.
 - normally, when holding down 2 buttons and then releasing one, the button still being held down after the other one's released gets counted. However, in this situation you can bash any buttons you want (while still holding down the remaining one) and nothing will count, not on the press or on the release of any buttons. What I'm looking for is a way to still react to those button presses.

This is getting kind of wordy, so let's use an example that'll (hopefully) make clear what I mean:

-We press and hold down '1', now we press and hold '2' (with '1' still down) then release '2' again. The wanted reaction is 'JPto1', then on the second press a 'JPto2', then on the release of '2' another 'JPto1'.

-We hold '1' down and press '2', and now release '1'. The reaction would be 'JPto1' on the first press, 'JPto2' on the second, but NO reaction on the release of '1'. (so it doesn't perform a 'JPto2' twice when pressing '2' and releasing '1').


This may be hard to do using GetCSC, but the problem of trying something involving:
Code: [Select]
   LD     A, %10111111
    OUT    (1), A
    IN     A, (1)
    CP     %11101111
    Call     Z, yequsprshow
is that the script gets excecuted continously. I already have a solution for that (thanks to Axe) but I'd still not know how to use that for the behaviour described above.


Sorry for this lòng explanation.
If anyone has any tips or tricks on how to do such mechanics, it'd be greatly appreciated! Note that I'm not asking for a complete script for this of course (though feel free  ;)); some waypoints and tips are very welcome!
Thank you in advance.

6
TI Z80 / CalcHero: Guitar Hero for the Ti!
« on: June 10, 2011, 11:15:43 am »
I've been working on this for about a year now, and learned ASM for the very first time while doing so, and now it's finally comming to a stage where I can present it. So without further ado, I hereby present you:

CalcHero





Features

- 10 Tiers with 4-6 songs each.
 - High difficulty and a great challenge.
 - High scores, and challenge scores to beat.
 - Achievement system for even more challenges.
 - Long gameplay and high replay value.



Tracklist:

 - Tier 1:
1 The Blue Danube
2 Scotland the Brave
3 Pokémon Title Song (seison 1)
4 Super Mario Theme
5 Midnas Desperate Hour

 - Tier2:
1 Song of Storms
2 Slow Ride
3 Bulls on Parade
4 Hit Me With Your Best Shot
5 Mississippi Queen
6 The Entertainer

 - Tier3:
1 Luigis Mansion Theme
2 Final Bowser Theme

 - Tier 4
1 U.N. Owen was her?

 - Tier 6
1 Cult of Personality

 - Tier 8
1 Through The Fire and the Flames


Download with sound: http://www.4shared.com/video/qX4WgQFy/CalcHero_TTFAF__with_sound_.html

The songlist is far from finished, and the achievement system isn't implemented entirely yet. This is all still W.I.P. I'll release a try-out for bugs and feedback if there's animo, but for now it seems like it'll still be a looong time before this is finished.

Known issues:
- The last digit of the score might display an incorrect '0' sometimes. This doesn't affect the actual score though, and is purely cosmetical.

With special thanks to:
DJ_Omnimaga, Thepenguin77 and Quigibo for helping and giving routines MANY times during the process, ghehe.   ;D


EDIT:

Bad news; I just can't find the time to work on this anymore, I'm very sorry.  :-[
On the bright side, attached are all the .z80 files that make up for this game, plus the app itself. It's glitchy, and far from done (also, don't touch the achievement menu lol, it's only a rought sketch of the convept, and glitchy as hell). Feel free to either continue this, or rip it apart and create something else. Hopefully all the coding doesn't go to waste this way! Oh, and I know it's probably the worst scripting ever, but I kind of learned it only with the kind help of people on this forum, so... yeah.

Oh, the 5 attached .z80 files are the 5 pages of the APP; depending on your assembler you might need to add them to one file, or idk. I used "AppDev" for assebling it into an App.

Also, you can't fail the game yet (dieing is horrable when wanting to test things out  ;) ) but everything else kind of works...

So... yeah, sorry guys. :'C

7
I've recently started to use TiLP as a connection programm, and it's screenshot feature works properly, except while running an application, which just results in the programm crashing. There's been similar problems when using other screen-capture methods. Everything works fine, untill I make a screenie of an App.
What's the most commonly used and easiest way to capture the screen during games, for example? I'd like to do so (and create moving .gifs) for the showcase section of the site, regarding the project I've been working on for quite a while now.
Thank you in advance!

8
Out of the blue I'm suddenly getting "unable to connect; please check your connection" errors when putting new files to the calculator.
It can still connect with TI-Connect, and it;s still possible to delete files from the calc using TI-Connect, so it's still making good connection. Only when trying to put something ón the calc (fróm the calc is'nt a problem) it states that it can't make a connection. I've just changed to new batteries, so it's not due to low battery state (plus, that gives a different error message anyway). Any thoughts?
Thank you!

9
I want to type stuff in paint using the smallest possible font, to transfer text documents with pictures ect. to the calc (TI-84+). The only problem is that the smallest readable font in MS paint itself is about size ~7, which is really too big. Wondered how to type in the normal small-calc font so it'd be easier to create texts and pictures to transfer to the TI-84+.

Thanks in advance!

10
Might need to explain what I mean here;
what's a conveniet way to create big 'pictures' for a programm?
This is what we want in the case of a full 96x64 pic:
Code: [Select]
.db 11111111b, 11111111b, 11111111b, 11111111b, 11111111b, 11111111b, 11111111b, 11001111b, 11111111b, 11111111b, 10011111b, 11111111b
.db 11111111b, 11111111b, 11111111b, 11111111b, 11111111b, 11111111b, 11111111b, 10001111b, 11111111b, 11111111b, 10011111b, 11111111b
.db 11111111b, 11111111b, 11111111b, 11111111b, 11111111b, 11111111b, 11111111b, 10001111b, 11111111b, 11111110b, 00000111b, 11111111b
.db 11111111b, 11111110b, 11111111b, 11111111b, 11111111b, 11111111b, 11111110b, 00001111b, 11111111b, 00000000b, 00000000b, 00011111b
.db 11111111b, 11111100b, 11111111b, 11111111b, 11111111b, 11111111b, 11111100b, 00001111b, 11111111b, 00000000b, 00000000b, 00111111b
.db 11111000b, 00000000b, 00000000b, 01111111b, 11111110b, 00000111b, 11111000b, 00001111b, 11111111b, 00000000b, 11100000b, 01111111b
.db 11111000b, 00000000b, 00000000b, 11111111b, 11111110b, 00000011b, 11110000b, 00001111b, 11111111b, 00000000b, 11100000b, 01111111b
.db 11111000b, 00000000b, 00000001b, 11111111b, 11110000b, 00000001b, 11100000b, 00001111b, 11111111b, 00000001b, 11110000b, 11111111b
.db 11111000b, 00000111b, 00000011b, 11111111b, 10000000b, 00000001b, 11111000b, 00001111b, 11111111b, 00000001b, 11111111b, 11111111b
.db 11111000b, 00000111b, 00000011b, 11111110b, 00000000b, 00000001b, 11111000b, 00001111b, 11111111b, 00000001b, 11111111b, 11111111b
.db 11111000b, 00001111b, 11001111b, 11110000b, 00001110b, 00000011b, 11111000b, 00001111b, 11111110b, 00000001b, 11111111b, 11111111b
.db 11111000b, 00001111b, 11111111b, 11000000b, 00001110b, 00000001b, 11111000b, 00011111b, 11111110b, 00000001b, 11111111b, 11111111b
.db 11111000b, 00001111b, 11111111b, 10000000b, 00111110b, 00000011b, 11111000b, 00001111b, 11111110b, 00000001b, 11111111b, 11111111b
.db 11111000b, 00001111b, 11111111b, 11110000b, 00111110b, 00000011b, 11111000b, 00001111b, 11111100b, 00000001b, 11111111b, 11111111b
.db 11111000b, 00001111b, 11111111b, 11110000b, 00111110b, 00000011b, 11111000b, 00001111b, 11111100b, 00000001b, 11111111b, 11111111b
.db 11110000b, 00001111b, 11111111b, 11110000b, 00001110b, 00000011b, 11111000b, 00001111b, 11111110b, 00000001b, 11111111b, 11111111b
.db 11110000b, 00001111b, 11111111b, 11110000b, 00000000b, 00000011b, 11111000b, 00001111b, 11111111b, 00000001b, 11111111b, 11111111b
.db 11111000b, 00001111b, 11111111b, 11110000b, 00110000b, 00000011b, 11111000b, 00001111b, 11111111b, 00000001b, 11111111b, 11111111b
.db 11111000b, 00001111b, 11111111b, 11110000b, 00111110b, 00000011b, 11111000b, 00001111b, 11000111b, 00000001b, 11111111b, 11111111b
.db 11111000b, 00001111b, 11111111b, 11110000b, 00111110b, 00000011b, 11111000b, 00001111b, 10000111b, 00000001b, 11111111b, 11111111b
.db 11111000b, 00001111b, 11111111b, 11110000b, 00111110b, 00000011b, 11111000b, 00001111b, 11000011b, 00000001b, 11100001b, 11111111b
.db 10011000b, 00001111b, 11111111b, 11110000b, 00111110b, 00000011b, 11111000b, 00001111b, 10000111b, 00000000b, 11100000b, 11111111b
.db 10101000b, 00001111b, 10001111b, 11000000b, 00001110b, 00000001b, 11111000b, 00000011b, 00000011b, 00000000b, 11000000b, 01111111b
.db 10011000b, 00001111b, 00000111b, 11111010b, 00001110b, 00000011b, 11111000b, 00000000b, 00000011b, 00000000b, 00000000b, 01111111b
.db 10101000b, 00000111b, 00000011b, 11111111b, 11111110b, 00000001b, 11110000b, 00000000b, 00000011b, 00000000b, 00000000b, 01111111b
.db 10011000b, 00000110b, 00000011b, 11111111b, 11111110b, 01101111b, 11100000b, 11111100b, 00110011b, 00000000b, 00100000b, 01111111b
.db 11111000b, 00000000b, 00000011b, 10111111b, 11111111b, 11111111b, 11001111b, 11111111b, 11111111b, 00000111b, 11110000b, 11111111b
.db 10101000b, 00000000b, 00000011b, 11000000b, 11111111b, 11111111b, 11111111b, 11111111b, 11111111b, 00000111b, 11111111b, 11111111b
.db 11011000b, 00000011b, 00000011b, 11000000b, 00111111b, 11111111b, 11111111b, 11111111b, 11111111b, 10000111b, 11111111b, 11111111b
.db 11011000b, 01111111b, 10000011b, 11000000b, 00111111b, 11111111b, 11111111b, 11111111b, 11111001b, 11000111b, 11111111b, 11111111b
.db 11111011b, 11111111b, 10001111b, 11000000b, 01111110b, 01111100b, 00000000b, 00111111b, 11100000b, 11100011b, 11111111b, 11111111b
.db 11111111b, 11111111b, 00001111b, 11000000b, 01111110b, 00111110b, 00000000b, 00011111b, 10000000b, 00111000b, 11111111b, 11111111b
.db 11111111b, 11111110b, 00011111b, 11000000b, 11000000b, 00000011b, 00000111b, 00001110b, 00000000b, 00001110b, 01111111b, 11111111b
.db 10011111b, 11111100b, 00111111b, 11000000b, 11000000b, 00000011b, 00000111b, 00001110b, 00000000b, 00000011b, 01111111b, 11111111b
.db 11011111b, 11111100b, 01111111b, 11000000b, 11000001b, 00000011b, 00000111b, 10001110b, 00000111b, 00000011b, 10111111b, 11111111b
.db 11011111b, 11110001b, 11100011b, 11000000b, 11000001b, 11100011b, 00000111b, 10001110b, 00000111b, 00000011b, 11111111b, 11111111b
.db 10011111b, 11100001b, 11100011b, 11000000b, 11000001b, 11000011b, 00000111b, 10001110b, 00000111b, 00000011b, 11111111b, 11111111b
.db 11111111b, 10011111b, 10000011b, 11000000b, 11000001b, 11000011b, 00000110b, 00000110b, 00000111b, 00000011b, 11111111b, 11111111b
.db 10011111b, 11111111b, 00000011b, 11000000b, 11000001b, 11000011b, 00000100b, 00001110b, 00000111b, 00000011b, 11011111b, 11111101b
.db 10111111b, 11111110b, 00000011b, 11000000b, 11000001b, 11000011b, 00000000b, 00011110b, 00000111b, 00000011b, 10001111b, 11111000b
.db 10011111b, 11111100b, 00000011b, 11000000b, 11000001b, 10000011b, 00000000b, 01111000b, 00000111b, 00000011b, 10001111b, 11111000b
.db 10111111b, 11111000b, 00000011b, 10000000b, 11000000b, 00000011b, 00000000b, 01111000b, 00000111b, 00000011b, 10001101b, 11011000b
.db 10011111b, 11111110b, 00000000b, 00000000b, 11000000b, 00011111b, 10000000b, 00111110b, 00000111b, 00000001b, 10001000b, 10001000b
.db 11111111b, 11111110b, 00000000b, 00000000b, 11000000b, 00111111b, 00000000b, 00111110b, 00000111b, 00000000b, 10001000b, 10001000b
.db 10011111b, 11111110b, 00000000b, 00000000b, 11000000b, 11111111b, 00000100b, 00111110b, 00000111b, 00000011b, 10001000b, 10001000b
.db 10101111b, 11111110b, 00000111b, 11000000b, 11000001b, 11111011b, 00000100b, 00011110b, 00000111b, 00000011b, 10001011b, 11001000b
.db 10011111b, 11111110b, 00000011b, 11000000b, 01000001b, 11100011b, 00000110b, 00011110b, 00000111b, 00000111b, 10001110b, 01001000b
.db 10101111b, 11111110b, 00000011b, 11000000b, 11000001b, 00000011b, 10000111b, 00001110b, 00000111b, 00000111b, 10001100b, 01001000b
.db 11111111b, 11111110b, 00000011b, 11000000b, 11000000b, 00000011b, 00000111b, 00001110b, 00000111b, 00000011b, 10011000b, 01001000b
.db 10011111b, 11111110b, 00000011b, 11000000b, 11111000b, 00011111b, 00000111b, 10001110b, 00000111b, 00000011b, 10110000b, 11001000b
.db 10101111b, 11111110b, 00000011b, 11000000b, 11111110b, 00011111b, 00000111b, 10001110b, 00000111b, 00000111b, 11100001b, 10001000b
.db 10011111b, 11111110b, 00000011b, 11000000b, 11111110b, 00111100b, 00000001b, 10001110b, 00000111b, 00000011b, 11000011b, 10001000b
.db 10101111b, 11111110b, 00000011b, 11000000b, 11111111b, 01111111b, 11111111b, 11000111b, 11000000b, 00000011b, 10000110b, 10001000b
.db 11111111b, 11111110b, 00000011b, 11000000b, 11111111b, 11111111b, 11111111b, 11000011b, 11100000b, 00000111b, 10001100b, 10001000b
.db 10001111b, 11111110b, 00000011b, 10000000b, 01111111b, 11111111b, 11111111b, 11110001b, 11110000b, 01111111b, 10011000b, 10001000b
.db 10101111b, 11111110b, 00000011b, 00000000b, 00111111b, 11111111b, 11111111b, 11111000b, 11111000b, 11111111b, 10011101b, 11011000b
.db 10001111b, 11111110b, 00000011b, 11111111b, 11111111b, 11111111b, 11111111b, 11111110b, 00111001b, 11111111b, 10011111b, 11110000b
.db 11111111b, 11111110b, 00000011b, 11111111b, 11111111b, 11111111b, 11111111b, 11111111b, 11111111b, 11111111b, 10001110b, 00000000b
.db 10001111b, 11111100b, 00000001b, 11111111b, 11111111b, 11111111b, 11111111b, 11111111b, 11111111b, 11111111b, 10000011b, 00000000b
.db 10111111b, 11111000b, 00111111b, 11111111b, 11111111b, 11111111b, 11111111b, 11111111b, 11111111b, 11111111b, 10000001b, 00000000b
.db 10001111b, 11110011b, 11111111b, 11111111b, 11111111b, 11111111b, 11111111b, 11111111b, 11111111b, 11111111b, 10000001b, 00000001b
.db 11101111b, 11111111b, 11111111b, 11111111b, 11111111b, 11111111b, 11111111b, 11111111b, 11111111b, 11111111b, 11000011b, 00000011b
.db 10001111b, 11111111b, 11111111b, 11111111b, 11111111b, 11111111b, 11111111b, 11111111b, 11111111b, 11111111b, 11100110b, 00000111b
.db 11111111b, 11111111b, 11111111b, 11111111b, 11111111b, 11111111b, 11111111b, 11111111b, 11111111b, 11111111b, 11111111b, 11111111b
But after designing a screen of some sort, is there an easy way to quickly turn a .bmp file or something into something suitable for programming use, like the above example? I'm getting tired of manually typing this shit, it's a monk's job!

Thanks in advance!

11
ASM / App-Page switching - How fast is that?
« on: October 22, 2010, 07:58:03 am »
Short question:
Is it for a routine that needs to run VERY fast better to keep all info on one page, or is switching between App pages not that slow to do?

12
ASM / Direct Input + GetCSC = Fail?
« on: October 17, 2010, 07:57:05 am »
If I use Direct input OR GetCSC to react to keypresses, it works fine.
If I use them both however, GetCSC results in a crash:

This works:
Code: [Select]
    b_call _GetCSC
    CP     skDel
    JP     Z, Label
This works too:
Code: [Select]
    LD     A, %10111111
    OUT    (1), A
ld b,%11101101
    IN     A, (1)
    CP     %11101111
    JP     Z, presyequ
    CP     %11110111
    JP     Z, preswindow
    CP     %11111011
    JP     Z, preszoom
    CP     %11111101
    JP     Z, prestrace
    CP     %11111110
    JP     Z, presgraph
But here comes the fun thing, pressing DEL will result in Ram-Reset:
Code: [Select]
    b_call _GetCSC
    CP     skDel
    JP     Z, Label
    LD     A, %10111111
    OUT    (1), A
ld b,%11101101
    IN     A, (1)
    CP     %11101111
    JP     Z, presyequ
    CP     %11110111
    JP     Z, preswindow
    CP     %11111011
    JP     Z, preszoom
    CP     %11111101
    JP     Z, prestrace
    CP     %11111110
    JP     Z, presgraph
Now, an obvious solution would be:
Code: [Select]
    LD     A, %10111111
    OUT    (1), A
ld b,%11101101
    IN     A, (1)
    CP     %11101111
    JP     Z, presyequ
    CP     %11110111
    JP     Z, preswindow
    CP     %11111011
    JP     Z, preszoom
    CP     %11111101
    JP     Z, prestrace
    CP     %11111110
    JP     Z, presgraph
CP %11111111
JP Z, Label
BUT when I do that, it will go to "Label" each pass, no matter what buttons you press.
Am I missing something obvious here? How to make both DEL and the other buttons work?

13
ASM / Executing "ret" twice?
« on: October 10, 2010, 07:55:06 am »
I've stumbled across another problem - how would I do a "double" ret command?
Let me explain:
Code: [Select]
Label1:
   call   label2
   ret                ; Let's call this one "ret%" This will go to where I want!

Label2
   ret                ; I want this "ret" to go to the same 'place' as "ret%".
Or, to make things more general:
Code: [Select]
Label1:
Call Label2
(......)        ;[1]

Label2:
Call Label3
ret             ;[2] Will take it back to [1].

Label3:
Call Label4
ret             ;[3] Will take it back to [2].


Label4:
Call Label5
ret             ;[4] Will take it back to [3].


Label5:
ret             ;[5] Will take it back to [4].
In the latter example, I want the ret from [5] not to go back to [4], but, lets say, to [1].
Is it possible to set things up in such way that a "ret" command will do that?
I don't know the specifics, but the addres from which you use "Call" from gets stored in a  stack, right?
So would it be possible to "Pop" that stack, so that a "ret" will take it back more than one 'step'?
From what I've  read, "POP   PC" would do that. :P Though I've  tried that and then my assembles gives an error, so I guess things aren't that simple.
Thank you!

14
ASM / Disabeling the "ON" button during an App?
« on: October 08, 2010, 01:08:54 pm »
I'm making a game in which timing is cricial.
You need to press a certain button when a sprite is in a specific area.
However, I have found that spamming the "ON" button significantly slows the programm down, and thus makes things much easier.
I don't exactly know why spamming the "ON" button results in a slowdown (has to do something with interupts?), but I want it to go away.  >:(
How'd I do this? And how would that affect the programm, since from what I've read the "ON" button is pretty special, and I have no idea how this will affect things.
Thanks in advance!

15
ASM / Why doesn't "this" work?
« on: September 12, 2010, 11:38:55 am »
Okay, the idea was to store a 1 or 2-byte number in an AppVar, then compare it to a new 2-byte number and store the biggest number (the idea of a Hi-Score:))
Secondly, I wanted to show that number.
Now, what I'm doing works only "half", in that it does show the correct number, but it's always an increment of 256 off.
This suggests that when using "b_call _DispHL" the "H" is off.
I have no idea why it randomly fills in H (it's not randomly though, but to keep things simple I won't explain/elaborate too much)
Basically, without posting the whole script, this is what I'm doing to show the stored number:
Code: [Select]
CALL Appvarstartcall ; These 3 lines just set HL to the Hi-Score, so that it's now at the adress of the 2-byte score.
LD B, 23 ; "B" is just how many times I want to inc hl to get to the right adress. For exemple's sake I use 23 here.
CALL lookup ; INC HL a couple of times to get to the right adress...
ld D, (hl) ; Load the most significant bute in D
inc hl ; inc HL to get to the adress of the least significant byte
ld E, (hl) ; And load the least significant byte in E.
ex DE, HL ; Put DE in HL so the next line works :P
b_call _DispHL ; It should show the stored hiscore now, exept that it doesn't. "D" seems to be a bit off.
             .........rest of stuff.......

Appvarstartcall:
ld hl, "NameOfTheAppVar"
rst 20h
bcall(_chkFindSym)
inc de
inc de
ex de, hl
ret
lookup:
inc hl
djnz lookup
ret
The problem is either at how I show the number, or at how I store it.
If I'm not doing horrable things above at displaying the number, it must be the way I store it.
Above is how I display the number, the way I store it is:
Code: [Select]
Score .equ AppBackUpScreen

CALL Appvarstartcall
LD B, 23
CALL lookup
ld D, (hl)
inc hl
ld E, (hl)
LD HL, (score) ; Score is the current score, to be compared to the previously stored hi-score.
or a
sbc hl, de
add hl, de
CALL p, NewHiScore ; if "Score" > Hiscore, store it.
........rest of script........

NewHiScore: ;  Basically store "Score" at the given adress.
CALL Appvarstartcall
LD B, 23
CALL lookup
LD DE, (score) ; score is the "new" number to store. It can hold any value between 0-9999
LD (HL), D
inc hl
LD (HL), E
ret
So one of the two (or both) is/are wrong.
Either I don't store "Score" correctly, or the way the number gets displayed is wrong.
Anyone that can shine his light and brighten my day here?

Thanks in advance!

Pages: [1] 2