Tutorial #6
2-18-99
Jump and Compare Commands
You know in BASIC if you want to go to a certain variable you use GOTO right? Well in ASM its a little different, you use "jp" which stands for "jump" and "jr" for little jumps..About 128 bytes, "jp" can jump about 32K, which for the TI-83, is all of its memory...The big difference is that when TASM compiles jp its somewhat bigger than when it compiles jr...So its best to use each when necessary. Now, in BASIC if you want to compare something you would do this
Input "Number",A
Input "Number",B
If A
Then
Goto A
If something of that nature, in ASM its much different you could do someting like this:
...Starting Code we use in every ASM Prog...
call _clrLCDFull ;Clears the screen
ld a,10 ;Loads 10 into a
cp 10 ;Compares a to see if it was 10
jr z,text ;If a was 0 jump to text
ret ;Return to what it was doing
text:
ld hl,0000h ;Row 0 Colum 0
ld (PENCOL),hl ;hl into (PENCOL)
ld hl,text1 ;text1 into hl
call _puts ;Puts text1 on home screen
ret ;Returns to what it was doing
text1:
.db "It WoRkEd!",0
.end ;Ends program
END ;Needed for TASM
If you looked at my comments you should understand everything, "cp" stands for compare, you will use that a lot in games. Any Questions? AM I TOTALLY WRONG!?!? E-mail me!
(KSA)Tekken (uncool3@juno.com)