For those of you who have had experience with TI-83 Asm programming, you will note that the below program looks familiar. That's because it is the exact same program from tutorial 7 in James Matthew's Asmguru! This proves that TI-83 Asm programs will run on a TI-83 Plus with just a few minor changes. Therefore I assume no responsibility for writing this program, just porting it. This program takes user input from the TI's key pad to move a dot about the screen. Sort of like a small sprite! This program uses Getkey(Tutorial 8) call. Only this time we've narrowed the area in which getkey scans the keyboard to the Arrow keys and the clear key.
#define B_CALL(xxxx) rst 28h \ .dw xxxx #define B_JUMP(xxxx) call 50h \ .dw xxxx _RunIndicOff = 4570h _IPoint = 47E3h _getkey = 4972h _clrlcdfull = 4540h _homeup = 4558h #DEFINE kLeft 02h #DEFINE kRight 01h #DEFINE kUp 03h #DEFINE kDown 04h ;All these guys are hex code #DEFINE kEnter 05h ;for keys on the Ti-keyboard. #DEFINE kClear 09h .org 9D95h B_CALL(_clrLCDFull) ;Clear the screen. ld b,47 ld c,47 ld d,1 ;Set D to 1. B_CALL(_IPoint) B_CALL(_runIndicOff) ;Turn off run indicator. GetKey: B_CALL(_getKey) ;Asked for a key. cp kLeft ;Compare key with code for left. jp z,Left ;If equals 0, go to left. cp kRight jp z,Right cp kUp jp z,Up cp kDown jp z,Down cp kClear jp z,Quit jp GetKey Left: ld d,0 ;Set D to 0. B_CALL(_IPoint) dec b ;Decrement B jp Draw Right: ld d,0 B_CALL(_IPoint) inc b jp Draw Up: ld d,0 B_CALL(_IPoint) inc c jp Draw Down: ld d,0 B_CALL(_IPoint) dec c jp Draw Draw: ld d,1 B_CALL(_IPoint) jp GetKey ;Repeat Quit: ret ;Return to OS. .end END
Note: You may want to set your calc's graph to ZInteger because ZStandard may interfere with the axis.
What's the difference between Call and jp/jr? Call is a z80 instruction that jumps to a sub-routine, a label with specified calls and instructions. What about jp/jr? Well I'm going to let James Matthews explain that.
What is the difference between jr and jp? There is one massive difference. JR is a relative jump - meaning, when TASM compiles it, the instruction for the Z80 simply tells it how many bytes forward or backward to jump. Thus, jr has a limited range. jp on the other hand is an absolute jump - tells the Z80 the address to jump to. The advantage of JR over JP is the file size is smaller and faster once compiled. (Thank you to Mindless Productions for this information.) Harper told me that jr is a small jump (up to 128 bytes), and jp is a large jump (up to 32K- the whole RAM, basically!).
Not yet comftorable with Registers? Take a look at Andy S.' 83 Asm tutorials in Tutorial 4! Or look in tutorial 17 in this help file.Now let's get moving!
Tutorial 15