----------------------------------------------------------------------------- ----------------------------------------------------------------------------- TI-ROM.TXT A Programmer's Guide to TI-85 ROM Calls Version 0.8 Copyright (c) 1995 Dan Eble ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- This is a list of routines in the TI-85 ROM 3.0A code. You may distribute this document, in unmodified form, to anyone you choose. Direct corrections and inquiries to: Dan.Eble@CommLink.org If you find that one of the untested functions in this document actually works (they should), or find that another doesn't, please contact me. Be sure to include your ROM version, the address you're calling, and what it's supposed to do. For other ROM versions: 4.0: add 3 bytes to all calls between 33E8 and 3FF3 (result: 33EB to 3FF6) 6.0: add 3 bytes 8.0: add 7 bytes (result: 33EF to 3FFA) ---- Format ---- Explanation of the format of this document ----------------- The instruction to call the routine is in a header bar like the one above. Under each header bar, the expected input, result, and description of the routine is given. Between 33E8 and 3FF3 is a table of 6-byte structures for calling functions memory pages other than 0. All you have to do is call the proper address in this range, and it will automatically switch pages, call the procedure, and return you to the proper page. In this document, wherever there is a call address in this table, the actual address of the function will be given in parenthesis as a 5-digit hexadecimal number. The first digit represents the page number the routine is on, and the last four are the address. Some of these calls do not return to the original address. When this is the case, the address in parenthesis will be preceeded by "JP". (nnnn) denotes a memory address, nnnn, in page 0 of the ROM. (xnnnn) denotes a memory address, nnnn, in page x of the ROM. -> denotes a pointer rather than a normal value. set n,rr in an input field, indicates that bit n of register (or memory location) rr is to be set before the call. in a result field, indicates that bit n of rr is set as a result of the call. res n,rr in an input field, indicates that bit n of register (or memory location) rr is to be clear before the call. in a result field, indicates that bit n of rr is clear as a result of the call. All numbers are in hexadecimal except where noted with (d). ---- RST 08 (CALL 208E) ---- Move 11(d) bytes from 8082 to 808D ------------- Probably used by system for copying name to secondary buffer. Note: This function has not been tested. ---- CALL 000B ---- BIT 0,(IY+7) -------------------------------------------- ---- RST 10 (CALL 2715) ---- Search for variable by name -------------------- Input: (8082) = Variable type to find (8083) = Length of variable name (1-8) (8084) = Actual name of variable (8 bytes long, padded with anything) Result: Success: CF clear A = (8082) = Type of the variable found C = 0 DE = Address of variable HL = Address of VAT entry for variable Failure: CF set ---- CALL 0013 ---- BIT 1,(IY+8) -------------------------------------------- ---- CALL 001B ---- SET 0,(IY+3) -------------------------------------------- ---- RST 20 (CALL 2151) ---- Move 10(d) bytes from (HL) to (8082) ----------- Used to move string name into search buffer. ---- CALL 0023 ---- A = (8A56) OR (8A56) ------------------------------------ ---- CALL 002B ---- (8A56) = A = 0 ------------------------------------------ ---- CALL 0033 ---- LD HL,(HL) ---------------------------------------------- Input: HL -> data word Result: HL = data word A = L ---- RST 38 ---- General Interrupt Handler ---------------------------------- Handles interrupts created by system peripherals. ---- CALL 0075 ---- BIT 4,(IY+9) -------------------------------------------- ---- CALL 007A ---- Check if graph mode is Func ----------------------------- Input: Nothing Result: ZF clear: Func mode ZF set: not Func mode ---- CALL 007F ---- Check if graph mode is Pol ------------------------------ Input: Nothing Result: ZF clear: Pol mode ZF set: not Pol mode ---- CALL 0084 ---- Check if graph mode is Param ---------------------------- Input: Nothing Result: ZF clear: Param mode ZF set: not Param mode ---- CALL 0089 ---- Check if graph mode is DifEq ---------------------------- Input: Nothing Result: ZF clear: DifEq mode ZF set: not DifEq mode ---- CALL 008E ---- CP HL,DE ------------------------------------------------ Input: Nothing Result: Flags are modified ---- CALL 0094 ---- Display ":" --------------------------------------------- Input: (800C) = row (800D) = column set 3,(IY+05): display white on black res 3,(IY+05): display black on white set 1,(IY+0D): alter text memory res 1,(IY+0D): don't alter text memory Result: A = ":" ":" is printed on screen. ---- CALL 009A ---- Unpack one digit of HL to A ?? -------------------------- This is called from (16BC0) and used to convert HL to a decimal string. ---- CALL 01A2 ---- Read information from keypad port ----------------------- Input: A = key group mask Result: A = B = key press data ---- CALL 01B1 ---- Store keystroke in buffer ------------------------------- Input: A = scancode (see CALL 01BE for scancode list) Result: (8000) = scancode (8006) = scancode if scancode is not 0 set 3,(IY+00) ---- CALL 01BE ---- Read current keystroke from buffer ---------------------- Input: Nothing Result: A = scancode of key that is currently pressed HL = 8000 res 3,(IY+00) Note: The scancode of the last key pressed is stored at (8006), regardless of whether it has been released or not. Scancode Table: 00 no key 16 TAN 28 x-VAR 01 down 17 CUSTOM 29 ON (The ON handler gets to this first) 02 left 19 . 2A STO 03 right 1A 2 2B , 04 up 1B 5 2C xý 09 Enter 1C 8 2D LN 0A + 1D ( 2E LOG 0B - 1E COS 2F GRAPH 0C * 1F PRGM 30 ALPHA 0D / 20 DEL 31 F5 0E ^ 21 0 32 F4 0F CLEAR 22 1 33 F3 11 (-) 23 4 34 F2 12 3 24 7 35 F1 13 6 25 EE 36 2nd 14 9 26 SIN 37 EXIT 15 ) 27 STAT 38 MORE ---- CALL 0CAD ---- Checksum memory between 8BF7 and FA6F ------------------- Input: Nothing Result: HL = checksum IX = FA70 BC = 0 DE = -HL Note: This function has not been tested. ---- CALL 0CD4 ---- Copy length-indexed string to 8083 ---------------------- Input: IX -> string Result: string is copied B = 0 IX = end of original string + 1 HL = end of string at 8083 + 1 Note: This function has not been tested. ---- CALL 2205 ---- Zero B bytes at (HL) ------------------------------------ Input: B = number of bytes to zero HL -> memory to zero Result: 0 is stored into every byte ---- CALL 220B ---- A = C / 16 (A = C >> 4) --------------------------------- Input: Nothing Result: A = high nibble of C ("RRA" four times and "AND 15") Note: CALL 220C can be used to do A = A / 16 (A = A >> 4). ---- CALL 2213 ---- A = 16 * C (A = C << 4) --------------------------------- Input: Nothing Result: A = 16 * C ("ADD A,A" 4 times) Note: CALL 2214 can be used to do A = 16 * A (A = A << 4). ---- CALL 2FB8 ---- Copy 10(d) bytes from 8082 to [(8BE1)-10(d)] ------------ Input: Nothing Result: Bytes are copied HL = 808C DE equals what it should Note: This function has not been tested. ---- CALL 300C ---- Negate BC ----------------------------------------------- Input: BC Result: HL = BC = -BC A = 0 ---- CALL 3014 ---- ?????????? ---------------------------------------------- Input: Nothing Result: HL = (8BE1) - 10(d) -> REAL number (Don't know the significance) DE = FFF6 = -10(d) ---- CALL 301C ---- Self test ----------------------------------------------- Input: ? I haven't investigated this function enough. Result: ? ----------------------------------------------------------------------------- ---- CALL 307C ---- Measure ASCIIZ string length ---------------------------- Input: HL -> string Result: BC = string length Note: This function has not been tested. ---- CALL 308F ---- Copy ASCIIZ string -------------------------------------- Input: HL -> source string DE -> destination string Result: HL and DE -> to the null bytes at the ends of their strings A = 0 Note: This function has not been tested. ---- CALL 3097 ---- Concatenate ASCIIZ strings ------------------------------ Input: HL -> source string DE -> destination string Result: Increments DE until (DE) = 0, then CALLs 308F to copy the string. Note: This function has not been tested. ---- CALL 309E ---- Compare length-indexed string --------------------------- Input: HL -> first string DE -> second string Result: Equal: ZF set Different: ZF clear CF clear: first string is greater CF set: second string is greater ---- CALL 30C4 ---- Test bit in bitstream ----------------------------------- Input: A = Bits 7-3: byte offset from HL (00-1F) Bits 2-0: bit to test (0-7) HL -> first byte in bitstream Result: A = 2^(bit tested) HL -> byte tested DE = bit tested Note: This function has not been tested. ---- CALL 3B9E (16BF7) ---- Print length-indexed string --------------------- Input: HL -> length-indexed string (800C) = row (800D) = column set 3,(IY+05): display white on black res 3,(IY+05): display black on white set 1,(IY+0D): alter text memory res 1,(IY+0D): don't alter text memory Result: The string is printed on the screen. ---- CALL 3BDA (16FF1) ---- Print menu character ---------------------------- Input: A = character to print (8333) = x coordinate (8334) = y coordinate res 1,(IY+05): print only 6 rows of the character set 1,(IY+05): print entire 7 rows of the character res 3,(IY+05): print character over current screen set 3,(IY+05): XOR character with current screen Result: The character is printed on the screen and the x coordinate is updated. DE is destroyed. ---- CALL 3BE0 (170A7) ---- Print ASCIIZ menu string ------------------------ Input: HL -> null-terminated string (8333) = x coordinate (8334) = y coordinate res 1,(IY+05): print only 6 rows of the character set 1,(IY+05): print entire 7 rows of the character res 3,(IY+05): print character over current screen set 3,(IY+05): XOR character with current screen Result: The string is printed on the screen and the x coordinate is updated. ---- CALL 3BE6 (JP 1710F) ---- Save text mode parameters in secondary area -- Input: Nothing Result: (8187) = (800C) ; cursor row (8188) = (800D) ; cursor column (8189) = (8B2F) ; screen scroll start (818A) = (8358) (818B) = (834B) AND 10h Note: This function has not been tested. ---- CALL 3BFE (171A1) ---- Move top right corner of LCD to bitmap at (8078) Input: set 1,(IY+12h): don't move bytes res 1,(IY+12h): move bytes Result: 8 bytes are moved from the top right corner of the LCD to (8078). set 1,(IY+12h) ---- CALL 3C04 (171C8) ---- Move bitmap at (8078) to top right corner of LCD Input: set 1,(IY+12h): move bytes res 1,(IY+12h): don't move bytes Result: 8 bytes are moved from (8078) to the top right corner of the LCD. res 1,(IY+12h) ---- CALL 3C22 (170BA) ---- Print length-indexed menu string ---------------- Input: HL -> string B = string length (8333) = x coordinate (8334) = y coordinate res 1,(IY+05): print only 6 rows of the character set 1,(IY+05): print entire 7 rows of the character res 3,(IY+05): print character over current screen set 3,(IY+05): XOR character with current screen Result: The string is printed on the screen and the x coordinate is updated. ---- CALL 3CA0 (16FDB) ---- Point HL to absolute address of text cursor ----- Input: Nothing Result: HL = absolute address of text cursor (in primary text memory [80DF]) ---- CALL 3C88 (46825) ---- Copy graph memory (8641) to LCD memory (FC00) --- Input: (8B30) = 7 : copy 7 lines > 7 : copy 8 lines < 7 : copy 6 lines Result: A = (8B30) BC = 0 HL and DE are modified set 2, (IY+2) ---- CALL 3D8A (170FA) ---- Store text parameters and screen in buffer2 ----- Input: Nothing Result: 168 bytes are moved from 80DF to 8A6B. ; text buffer (8187) = (800C) ; cursor row (8188) = (800D) ; cursor column (8189) = (8B2F) ; screen scroll start (818A) = (8358) (818B) = (834B) AND 16 Note: This function has not been tested. ---- CALL 3D90 (16E10) ---- Scroll screen up -------------------------------- Input: (8B2F) = first row to scroll (0-7) (8B30) = last row to scroll (1-8) set 1,(IY+0D): scroll the text memory res 1,(IY+0D): don't scroll the text memory Result: Text is scrolled and a blank line is inserted at the end. ---- CALL 3DA8 (65376) ---- Display heading --------------------------------- Input: HL -> ASCIIZ string Result: String is printed at (0,0) (via 3E68) and the rest of the top row of the screen is cleared. DE = 0 Note: this function has not been tested. ---- CALL 3DAE (146B8) ---- Display menu indexed by A ----------------------- Input: A = menu to display Result: The menu is printed on the bottom line of the screen. Menu Numbers ÄÄÄÄÄÄÄÄÄÄÄÄ 00 CHAR 01 CHAR MISC 02 CHAR GREEK 03 CHAR INTL 04 MATH 05 MATH NUM 06 MATH PROB 07 MATH ANGLE 08 MATH HYP 09 MATH MISC 0A PRGM EDIT MATH 0B CALC 0C BASE 0D BASE B-F 0E BASE TYPE 0F BASE CONV 10 BASE BOOL 11 BASE BIT 12 LIST 13 LIST OPS 14 PRGM EDIT LIST 15 TEST 16 CPLX 17 STRNG 18 CONS 19 CONS BLTIN 1A CONS USER 1B PRGM EDIT CONS 1C VECTR 1D VECTR NAMES 1E VECTR MATH 1F VECTR OPS 20 PRGM EDIT VECTR 21 MATRX 22 MATRX EDIT 23 MATRX NAMES 24 MATRX MATH 25 MATRX OPS 26 MATRX CPLX and VECTR CPLX 27 PRGM EDIT MATRX 28 PRGM 29 PRGM NAMES 2A PRGM EDIT (name selection) 2B PRGM EDIT (editor) 2C PRGM EDIT I/O 2D PRGM EDIT CTL 2E PRGM EDIT GRAPH 2F PRGM EDIT GRAPH VARS 30 PRGM EDIT GRAPH RANGE 31 PRGM EDIT GRAPH ZOOM 32 PRGM EDIT GRAPH MATH 33 PRGM EDIT GRAPH DRAW 34 STAT 35 STAT (without VARS) 36 LIST NAMES and STAT EDIT (name selection) 37 STAT CALC 38 STAT EDIT (editor) 39 STAT VARS 3A STAT DRAW 3B PRGM EDIT STAT 3C PRGM EDIT STAT CALC 3D PRGM EDIT STAT DRAW 3E VARS 3F PAGEUP/PAGEDN (found in many places) 40 MEM DELET 41 GRAPH (func) 42 GRAPH ZOOM (all modes) 43 GRAPH MATH (func) 44 GRAPH DRAW (func) 45 GRAPH (pol) 46 GRAPH MATH (pol) 47 GRAPH DRAW (pol) 48 GRAPH (param) 49 GRAPH MATH (param) 4A GRAPH (difeq) 4B GRAPH DRAW (param, difeq) 4C GRAPH AXES (difeq) 4D nothing 4E POLY 4F POLY SOLVE 50 GOTO/QUIT (error) 51 QUIT (error) 52 SIMULT 53 SIMULT SOLVE 54 y(x)= 55 r(é)= 56 E(t)= 57 Q'(t)= 58 VECTR EDIT and LIST EDIT 59 ? SOLVE 5A LIST NAMES 5B CONS EDIT 5C LINK 5D LINK SEND (choose type) 5E LINK SEND ... (choose items) 5F LINK SEND BACKUP 60 LINK RECV backup 61 LINK RECV duplicate 62 ? EXIT 63 ? SKIP/EXIT 64 SOLVER (equation names) 65 SOLVER 66 SOLVER GRAPH 67 SOLVER ZOOM 68 ? (grpah|edit|zoom|trace| ) 69 GRAPH STPIC or RCPIC (PIC names) 6A GRAPH STGDB or RCGDB (GDB names) 6B MEM 6C MEM RESET (choose type) 6D MEM RESET ... (yes|no) 6E CONV 6F CONV LNGTH 70 CONV AREA 71 CONV VOL 72 CONV TIME 73 CONV TEMP 74 CONV MASS 75 CONV FORCE 76 CONV PRESS 77 CONV ENRGY 78 CONV POWER 79 CONV SPEED 7A CATALOG 7B CUSTOM 7C TOLER ---- CALL 3DB4 (16F3D) ---- Clear screen window ----------------------------- Input: (8B2F) = top row of window (8B30) = bottom row of window set 1,(IY+0D): alter text memory res 1,(IY+0D): don't alter text memory Result: The screen window is cleared, the cursor is set to the top left corner of the window, and the top 7 bits of (IY+12h) are cleared. Note: this function has not been tested. ---- CALL 3DEA (16F8E) ---- Clear to end of line ---------------------------- Input: (800C), (800D) = cursor coordinates Result: Spaces are printed from the cursor to the end of the line. The cursor position does not change. Note: this function has not been tested. ---- CALL 3DF6 (16A57) ---- Print character without translation ------------- Input: A = character to print (800C) = row (800D) = column set 3,(IY+05): display white on black res 3,(IY+05): display black on white set 1,(IY+0D): alter text memory res 1,(IY+0D): don't alter text memory Result: The character is printed on the screen. Control characters are not translated. ---- CALL 3DFC (16F03) ---- Clear LCD --------------------------------------- Input: Nothing Result: The LCD is cleared (FC00-FFFF is zeroed). Nothing happens to the text memory at 80DF. Nothing happens to the graphics memory at 8641. HL = 8358 DE = BC = 0000 ---- CALL 3E02 (16BBA) ---- Print HL as decimal number ---------------------- Input: HL = number to print (800C) = row (800D) = column set 3,(IY+05): display white on black res 3,(IY+05): display black on white set 1,(IY+0D): alter text memory res 1,(IY+0D): don't alter text memory Result: The five-digit number (right justified, blank padded) is displayed on the screen. ---- CALL 3E0E (37D69) ---- *** FAIL ---------------------------------------- Input: HL = string to print in front of "FAIL" Result: The string at HL is printed on the screen followed by "FAIL" The memory is cleared and the defaults are set. Note: This function has not been tested. ---- CALL 3E5C (16F27) ---- Clear text screen ------------------------------- Input: set 1,(IY+0D): fill text memory (80DF) with spaces res 1,(IY+0D): clear the LCD without altering the text memory Result: The screen is cleared. ---- CALL 3E68 (16BDE) ---- Print ASCIIZ string ----------------------------- Input: HL -> null-terminated string (800C) = row (800D) = column set 3,(IY+05): display white on black res 3,(IY+05): display black on white set 1,(IY+0D): alter text memory res 1,(IY+0D): don't alter text memory Result: The string is printed on the screen. ---- CALL 3E6E (16FD0) ---- Set cursor row to top of scrolling window ------- Input: Nothing Result: (800C) = (8B2F) ; screen scroll start (800D) = 00 Note: This function has not been tested. ---- CALL 3E86 (37B2A) ---- Set random number seed to factory default ------- Input: Nothing Result: Same as storing 0 into the "rand" variable. ---- CALL 3EA4 (170E2) ---- Turn off "busy" indicator ----------------------- Input: Nothing Result: The "busy" indicator is turned off. res 0,(IY+12h) ---- CALL 3EBC (170CA) ---- Turn on "busy" indicator ------------------------ Input: Nothing Result: The "busy" indicator is turned on. set 0,(IY+12h) ---- CALL 3FEE (16B30) ---- Print character with translation ---------------- Input: A = character to print (800C) = row (800D) = column set 3,(IY+05): display white on black res 3,(IY+05): display black on white set 1,(IY+0D): alter text memory res 1,(IY+0D): don't alter text memory Result: The character is printed on the screen. Control characters are translated.