TI's ROM Calls

z80 » Intermediate

I thought about giving detailed descriptions about the uses of different calls frequently used from TI, but then I remembered that I'm lazy. If you want to learn, experiment like I did. Maybe I'll teach you some later. Here are a couple that you'll use a lot. Most of these calls are already defined in ti86asm.inc. If you don't use that file and you want to put them in your program you have to define them somewhere in your program. Say you wanted to use _clrLCD in your program, you would have to have the following somewhere in your program with no leading spaces.

	_clrLCD = $4a7e

Remember how these calls are used in conjunction with the flags:

	call arg1
	call _clrLCD		;clear the screen
	call _homeup		;put cursor at top left
	call z,_homeup
	call nz,_homeup
	call c,_homeup
	call nc,_homeup

Alias Address What It Does
_clrLCD $4a7e Clears the screen.
_clrScrn $4a82 Clears the screen and sets the _textShadow area all to ' ' (LSpace).
_Exec_Assembly $5730 Execute the assembly program whose name is in OP1 in Variable Name Format.
_FlushAllMenus $49dc Clear all current menus. This allows text to be written on the last two rows if menus were running.
_getkey $55aa Returns the value of the last key pressed into a. You need a chart to see which key is what.
_homeup $4a95 Puts the big cursor's position at the top left of the screen.
_move10b $427b Moves 10 bytes from hl to de.
_NewLine $4a5f Execute a carrage return in cursor font.
_PDspGrph $4d6f Displays the graph screen with the current settings. If you jump to this (so you exit right from your program) it will have the graph menu at the bottom just as if you had hit [GRAPH] at the homescreen.
_putc $4a2b Puts a's ASCII value onto the screen at the current cursor position and advances the cursor position. More on this in the Text Display Routines section.
_putmap $4a27 Puts a's ASCII value onto the screen at the current cursor position but does not advance the cursor position. More on this in the Text Display Routines section.
_putps $4a3b Puts the length-indexed string pointed to by hl at the current cursor position. More on this in the Text Display Routines section.
_puts $4a37 Puts the zero-terminated string pointed to by hl at the current cursor position. More on this in the Text Display Routines section.
_vputmap $4aa1 Puts a's ASCII value onto the screen at the current cursor position in menu text and advances the cursor position. More on this in the Text Display Routines section.
_vputs $4aa5 Puts the zero-terminated string pointed to by hl at the current cursor position in menu text. More on this in the Text Display Routines section.
_runIndicOff $4ab1 Turn off that annoying busy indicator.
_runIndicOn $4aad Turn on that annoying busy indicator.
_StoAns $4c9f Store OP1 into the Answer (Ans) variable. If OP1 is a complex number, OP2 will be used as the imaginary part.

Here's a sample program using a few of the above ROM calls.

#include "ti86asm.inc"

.org _asm_exec_ram

	call _clrLCD		;clear the screen
	ld hl,(256*23)+7	;load values for the
				; coordinates into hl
				;column 7
				;row 23
	ld (_penCol),hl		;set coordinates in memory
	ld hl,strWaiting	;load pointer to
				; string into hl
	call _vputs		;print string on screen
	call _getkey		;wait for any key to be
				; pressed before continuing
	call _clrLCD		;clear the screen again
	ret			;exit

strWaiting:	.db "Waiting...",0

.end


More from z80 » Intermediate
All the Flags // Debugging // Down-Left Bug // _GetKey Codes // Logical Operators // Memory, ROM, RAM, and Safe Areas // Miscellaneous Instructions // PC and SP // Random Numbers // TI's ROM Calls // Restart Commands // Simulated 16-bit Addition // The Stack // Tables and Arrays // Text Display // Variables