In this tutorial, we will be learning how to clear the screen, the Asm way of course.
The code in the following program will clear the screen on the calculator. This is your first program, so I will lead you step by step. Open the "MyPrgms" folder and create a new text file. Name it "Clrscreen.z80". Note that the file extension is .z80. Open it and copy the following program into it. I recommend that instead of copying and pasting it, you should print it out and copy it by hand, you'll get used to the program format and will thus learn to program faster.
#define B_CALL(xxxx) rst 28h \ .dw xxxx ;This defines the two macros, bcall and bjump #define B_JUMP(xxxx) call 50h \ .dw xxxx ;Don't worry about bjump too much because you won't you use it very often _clrlcdfull =4540h ;The calls we will be using are defined here _homeup =4558h .org 9D95h ;This tells the calculator that the program will start at the mem adress 9D95h B_CALL(_homeup) ;Bringing up the home screen B_CALL(_clrlcdfull) ;Clearing the screen ret ;Returning to TI-OS .end ;End of program END
_clrlcdf - This command will clear the entire lcd display. When using this call alone in a program, it will clear the entire screen. But don't forget to include a ret call at the end or else the calculator won't return back to the OS forcing it to crash and reset. The same goes with all ROM calls.
_homeup - This call brings up the home screen.
ret - A standard z80 Asm instruction that takes you back to the TI-OS
.end and END - z80 instructions that tell the calculator that that is the end of the program.
To assemble this program, go on to tutorial 5
Other commands such as _ClrLcd (_ClrLcd = 4543h) will clear the display while _Clrlcdf will clear the display ignoring any split screen modes. _ClrScrn (_ClrScrn = 4549h) will clear the screen and any text shading along with it. _ClrScrnFull (_ClrScrnFull = 4546h) will clear the screen and text shading ignoring split screen modes. _ClrTxtShd ( _ClrTxtShd = 454Ch)will clear the text shade buffer. To use any of these calls in the program above, define the call and call it to the program using the B_CALL() macro.
For example, to use the _ClrScrnFull ROM call, this is what the program would look like:
#define bcall(xxxx) rst 28h \ .dw xxxx #define bjump(xxxx) call 50h \ .dw xxxx _clrscrnfull =4546h ;Don't forget to define it _homeup =4558h .org 9D95h bcall(_homeup) bcall(_clrscrnfull) ;Instead of _clrlcdf, you use _clrscrnfull ret .end END
If you have any questions, e-mail me. I'll do my best.Tutorial 5