Z80 Help
A note: This is not intended to teach you assembly. It is intended as a reference for newer programmers who understand some of the language. Note that items enclosed in brackets [] are names not actual code. Not all bcalls are listed and the calls listed are valid for both ion and tse. I do not know if any of these will work in naitive hex.
Command | Function | Inputs/Syntax |
bcall(_cursoroff) | Used to turn off the cursor as in TI-OS. | bcall(_cursoron) ;No inputs |
bcall(_cursoron) | Used to turn on the cursor as in TI-OS. It will blink on a getkey statement. | bcall(_cursoron) ;No inputs |
bcall(_DispHL) | Used for displaying numbers to the screen | bcall(_DispHL) ;After loading a memory location into hl eg: ld hl,(numdisp) |
bcall(_puts) | Puts the text loaded into hl on the screen. | bcall(_puts) ;After loading the cursor position into currow and curcol and loading a text label into hl |
bcall(_getKey) | Used to get user input. The program is paused until a key or series of keys is pressed. If the user presses 2nd+on it will crash the calculator. | bcall(_getKey) ;No inputs, output is register a with a getkey code. |
bcall(_vputs) | This call is used the same as bcall(_puts) except this draws text to the graphics screen. | bcall(_puts) ;After loading currow and currow, also load text into hl. |
call | call is used to jump to a label. However once the ret statement is encountered it returns to the step after the call. If a ret is encountered with out a call in Ion it will return to ion. In tse, however it freezes. | call label;goes to label, returns when ret is encountered. |
call ionFastCopy | This copies the graph buffer to the screen. | call ionFastCopy ;No inputs |
call ionPutSprite | this places a sprite on the graph buffer. Inputs are b, a, l and ix. b is the height of the sprite in pixils, a is the x coordinate of the sprite, l is the y coordinate and ix is the label containing the sprite data. | call ionPutSprite;draws a sprite on the screen. |
call ionRandom | This returns a as a random number equal or greator than 0 and less than b. | ld b,6 call ionRandom;now a can be: 0,1,2,3,4,5 |
![]() |
This returns to Tse. The next time the program is run it will start just after the call statement. | call _tseForceYield ;No inputs |
cp | This is used for comparing a and 1 other value. | cp 5 ;Compares a to 5. to get results see z and nz |
.db | Used to denote strings, lists and sprite data | String: .db "string's char max=20",0 ;You need to terminate strings with ,0 List: .db 45, 86, 87, 90, 12 |
.equ | .equ is used for program writeback. | labelOrVar: labelToUse .equ labelOrVar+1 ;Creates a 16 bit # called labelToUse |
jp | jp is used to jump to a location. It takes more memory than jr but it's distance limit is almost the entire RAM. | jp label;jumps to label: |
jr | jr is used to jump to a label. It has a maxium range of 128 bytes. The advantage of jr over jp is jr takes up less memory. If you try to jr where a jp is needed, you will get the error "Range of relitave branch exceeded" | jr labelToJump ;Jumps to labelToJump: |
ld | Used to load the contents of 1 register, RAM area, number or data location into one of the same. Note that at least 1 must be a register. | ld a,b;Loads b's value into a | nz | nz is used to go to something of the cp was false. | jr nz,label jp nz,label call nz,label ret nz |
z | z is used to go to something if the cp was true. | jr z,label jp z,label call z,label ret z |