124 Chapter 3: Application Development Process
TI-83 Plus Developer Guide Third Release May 28, 2002
Defining a String
Many system routines operate on null-terminated strings, which are a series of
characters followed by the byte 00h. The assembler supports null-terminated string
creation through use of the directive .asciz. This permits you to type the string in
readable text instead of defining each byte separately. Each character of the string is
translated to its ASCII code and stored at the current location and a null character is
then appended. In our example, we define a label that points to the first character of the
string so that we can point to the string in our system calls.
Erasing the Screen
To erase the screen, the example does the system call.
B_CALL ClrLCDFull ; Clear the screen
Printing Text to the Screen
To print text to the screen, the example uses the system call.
B_CALL PutS ; Print the hello string from RAM
This routine prints a null-terminated string in large text to the screen. It expects you to
have already set up the screen row and column where it should start printing the string.
The screen rows range from 0 (Top) to 7 (Bottom), and the columns range from 0 (Left)
to 15 (Right). You set these values in the system variable curRow and curCol prior to the
call. The PutS routine expects Z80 register HL to contain the address of the first
character of the string. It requires that this string be in RAM.
Copying the String
To copy a string from Flash ROM, where it is defined in your program, into RAM, where
the system routine PutS can use it, you can use the system routine StrCopy. This
routine expects the address of the source string to be in HL and the address of the first
RAM destination character to be in DE. It expects a null-terminated string. The example
copies the string Hello into the OP1 area in RAM (see next paragraph).
System RAM Registers
The calculator system code performs many operations on floating-point values. It uses a
floating-point format that requires up to 11 bytes in certain situations. Since floating-
point operations are so common, it defines six 11-byte areas that it uses frequently for
storing such numbers. It gives these RAM areas the name OP1, OP2, OP3, OP4, OP5,
and OP6. In our example, the system routines StrCopy and PutS do not use or modify
these areas, so we use six of the eleven OP1 RAM bytes to temporarily store our string
in RAM. In this case, we are just using OP1, since changing those locations is harmless;
the fact that OP1 may be used at some later time to pass floating-point data does not
matter.