home *** CD-ROM | disk | FTP | other *** search
/ The Unsorted BBS Collection / thegreatunsorted.tar / thegreatunsorted / misc / ti-rom.txt < prev    next >
Text File  |  1994-11-15  |  13KB  |  368 lines

  1. -----------------------------------------------------------------------------
  2. -----------------------------------------------------------------------------
  3.   TI-ROM.TXT      A Programmer's Guide to TI-85 ROM Calls      Version 0.5
  4.                         Copyright (c) 1994 Dan Eble
  5. -----------------------------------------------------------------------------
  6. -----------------------------------------------------------------------------
  7.  
  8. This is a list of routines in the TI-85 ROM 3.0A code.
  9. You may distribute this document, in unmodified form, to anyone you choose.
  10. Direct corrections and inquiries to: Dan.Eble@CommLink.org
  11.  
  12.   If you find that one of the untested functions in this document actually
  13. works (they should), or find that another doesn't, please contact me.  Be 
  14. sure to include your ROM version, the address you're calling, and what it's 
  15. supposed to do.
  16.  
  17. For other ROM versions:
  18. 4.0: add 3 bytes to all calls between 33E8 and 33F3 (result: 33EB to 33F6)
  19. 6.0: add 3 bytes 
  20. 8.0: add 7 bytes (result: 33EF to 33FA)
  21.  
  22. ---- Format ---- Explanation of the format of this document -----------------
  23.   The instruction to call the routine is in a header bar like the one above.
  24. Under each header bar, the expected input, result, and description of the
  25. routine is given.
  26.  
  27.   Between 33E8 and 3FF3 is a table of 6-byte structures for calling functions
  28. memory pages other than 0.  All you have to do is call the proper address
  29. in this range, and it will automatically switch pages, call the procedure, 
  30. and return you to the proper page. In this document, wherever there is a call
  31. address in this table, the actual address of the function will be given in
  32. parenthesis as a 5-digit hexadecimal number.  The first digit represents the
  33. page number the routine is on, and the last four are the address.
  34.   Some of these calls do not return to the original address.  When this is 
  35. the case, the address in parenthesis will be preceeded by "JP".
  36.  
  37. (nnnn)    denotes a memory address, nnnn, in page 0 of the ROM.
  38. (xnnnn)   denotes a memory address, nnnn, in page x of the ROM.
  39. ->        denotes a pointer rather than a normal value.
  40. set n,rr  in an input field, indicates that bit n of register (or memory
  41.           location) rr is to be set before the call.
  42.           in a result field, indicates that bit n of rr is set as a result
  43.           of the call.
  44. res n,rr  in an input field, indicates that bit n of register (or memory
  45.           location) rr is to be clear before the call.
  46.           in a result field, indicates that bit n of rr is clear as a result
  47.           of the call.
  48. All numbers are in hexadecimal except where noted with (d).
  49.  
  50. ---- RST 08 (CALL 208E) ---- Move 11(d) bytes from 8082 to 808D -------------
  51. Probably used by system for copying name to secondary buffer.
  52.  
  53. Note: This function has not been tested.
  54.  
  55. ---- RST 10 (CALL 2715) ---- Search for variable by name --------------------
  56. Input:  (8083) = Length of variable name (1-8)
  57.         (8084) = Actual name of variable (8 bytes long, padded with anything)
  58.  
  59. Result: Success: CF clear
  60.                  A = (8082) = Type of the variable found
  61.                  C = 0
  62.                  DE = Address of variable
  63.                  HL = Address of VAT entry for variable
  64.  
  65.         Failure: CF set
  66.  
  67. ---- RST 20 (CALL 2151) ---- Move 10(d) bytes from (HL) to (8082) -----------
  68. Used to move string name into search buffer.
  69.  
  70. ---- CALL 0033 ---- LD HL,(HL) ----------------------------------------------
  71. Input:  HL -> data word
  72.  
  73. Result: HL = data word
  74.         A = L
  75.  
  76. ---- RST 38 ---- General Interrupt Handler ----------------------------------
  77. Handles interrupts created by system peripherals.
  78.  
  79. ---- CALL 008E ---- CP HL,DE ------------------------------------------------
  80. Input:  Nothing
  81.  
  82. Result: Flags are modified
  83.  
  84. ---- CALL 01A2 ---- Read information from keypad port -----------------------
  85. Input:  A = key group mask
  86.  
  87. Result: A = B = key press data
  88.  
  89. ---- CALL 01B1 ---- Store keystroke in buffer -------------------------------
  90. Input:  A = scancode (see CALL 01BE for scancode list)
  91.  
  92. Result: (8000) = scancode
  93.         (8006) = scancode if scancode is not 0
  94.         set 3,(IY+00)
  95.  
  96. ---- CALL 01BE ---- Read current keystroke from buffer ----------------------
  97. Input:  Nothing
  98.  
  99. Result: A = scancode of key that is currently pressed
  100.         HL = 8000
  101.         res 3,(IY+00)
  102.  
  103. Note: The scancode of the last key pressed is stored at (8006), regardless
  104.       of whether it has been released or not.
  105.  
  106. Scancode Table:
  107. 00 no key       16 TAN          28 x-VAR
  108. 01 down         17 CUSTOM       29 ON (The ON handler gets to this first)
  109. 02 left         19 .            2A STO
  110. 03 right        1A 2            2B ,
  111. 04 up           1B 5            2C x²
  112. 09 Enter        1C 8            2D LN
  113. 0A +            1D (            2E LOG
  114. 0B -            1E COS          2F GRAPH
  115. 0C *            1F PRGM         30 ALPHA
  116. 0D /            20 DEL          31 F5
  117. 0E ^            21 0            32 F4
  118. 0F CLEAR        22 1            33 F3
  119. 11 (-)          23 4            34 F2
  120. 12 3            24 7            35 F1
  121. 13 6            25 EE           36 2nd
  122. 14 9            26 SIN          37 EXIT
  123. 15 )            27 STAT         38 MORE
  124.  
  125. ---- CALL 0CAD ---- Checksum memory between 8BF7 and FA6F -------------------
  126. Input:  Nothing
  127.  
  128. Result: HL = checksum
  129.         IX = FA70
  130.         BC = 0
  131.         DE = -HL
  132.  
  133. Note: This function has not been tested.
  134.  
  135. ---- CALL 0CD4 ---- Copy length-indexed string to 8083 ----------------------
  136. Input:  IX -> string
  137.  
  138. Result: string is copied
  139.         B = 0
  140.         IX = end of original string + 1
  141.         HL = end of string at 8083 + 1
  142.  
  143. Note: This function has not been tested.
  144.  
  145. ---- CALL 2FB8 ---- Copy 10(d) bytes from 8082 to [(8BE1)-10(d)] ------------
  146. Input: Nothing
  147.  
  148. Result: Bytes are copied
  149.         HL = 808C
  150.         DE equals what it should
  151.  
  152. Note: This function has not been tested.
  153.  
  154. ---- CALL 300C ---- Negate BC -----------------------------------------------
  155. Input: BC
  156.  
  157. Result: HL = BC = -BC
  158.         A = 0
  159.  
  160. ---- CALL 3014 ---- ?????????? ----------------------------------------------
  161. Input:  Nothing
  162.  
  163. Result: HL = (8BE1) - 10(d) -> REAL number (Don't know the significance)
  164.         DE = FFF6 = -10(d)
  165.  
  166. ---- CALL 301C ---- Self test -----------------------------------------------
  167. Input:  ?    I haven't investigated this function enough.
  168. Result: ?
  169. -----------------------------------------------------------------------------
  170.  
  171. ---- CALL 307C ---- Measure ASCIIZ string length ----------------------------
  172. Input:  HL -> string
  173.  
  174. Result: BC = string length
  175.  
  176. Note: This function has not been tested.
  177.  
  178. ---- CALL 308F ---- Copy ASCIIZ string --------------------------------------
  179. Input:  HL -> source string
  180.         DE -> destination string
  181.  
  182. Result: HL and DE -> to the null bytes at the ends of their strings
  183.         A = 0
  184.  
  185. Note: This function has not been tested.
  186.  
  187. ---- CALL 3097 ---- Concatenate ASCIIZ strings ------------------------------
  188. Input: HL -> source string
  189.        DE -> destination string
  190.  
  191. Result: Increments DE until (DE) = 0, then CALLs 308F to copy the string.
  192.  
  193. Note: This function has not been tested.
  194.  
  195. ---- CALL 309E ---- Compare length-indexed string ---------------------------
  196. Input:  HL -> first string
  197.         DE -> second string 
  198.  
  199. Result: Equal: ZF set
  200.  
  201.         Different: ZF clear
  202.                    CF clear: first string is greater
  203.                    CF set:   second string is greater 
  204.  
  205. ---- CALL 30C4 ---- Test bit in bitstream -----------------------------------
  206. Input:  A = Bits 7-3: byte offset from HL (00-1F)
  207.             Bits 2-0: bit to test (0-7)
  208.         HL -> first byte in bitstream
  209.  
  210. Result: A = 2^(bit tested)
  211.         HL -> byte tested
  212.         DE = bit tested
  213.  
  214. Note: This function has not been tested.
  215.  
  216. ---- CALL 3BDA (16FF1) ---- Print menu character ----------------------------
  217. Input:  A = character to print
  218.         (8333) = x coordinate
  219.         (8334) = y coordinate
  220.         res 1,(IY+05): print only 6 rows of the character
  221.         set 1,(IY+05): print entire 7 rows of the character
  222.         res 3,(IY+05): print character over current screen
  223.         set 3,(IY+05): XOR character with current screen
  224.  
  225. Result: The character is printed on the screen and the x coordinate is
  226.         updated.
  227.         DE is destroyed.
  228.  
  229. ---- CALL 3BE0 (170A7) ---- Print ASCIIZ menu string ------------------------
  230. Input:  HL -> null-terminated string
  231.         (8333) = x coordinate
  232.         (8334) = y coordinate
  233.         res 1,(IY+05): print only 6 rows of the character
  234.         set 1,(IY+05): print entire 7 rows of the character
  235.         res 3,(IY+05): print character over current screen
  236.         set 3,(IY+05): XOR character with current screen
  237.  
  238. Result: The string is printed on the screen and the x coordinate is updated.
  239.  
  240. ---- CALL 3BE6 (JP 1710F) ---- Save text mode parameters in secondary area --
  241. Input:  Nothing
  242.  
  243. Result: (8187) = (800C)            ; cursor row
  244.         (8188) = (800D)         ; cursor column
  245.         (8189) = (8B2F)
  246.         (818A) = (8358)
  247.         (818B) = (834B) AND 10h
  248.  
  249. Note: This function has not been tested.
  250.  
  251. ---- CALL 3BFE (171A1) ---- Move top right corner of LCD to bitmap at (8078)
  252. Input:  set 1,(IY+12h): don't move bytes
  253.         res 1,(IY+12h): move bytes
  254.  
  255. Result: 8 bytes are moved from the top right corner of the LCD to (8078).
  256.         set 1,(IY+12h)
  257.  
  258. ---- CALL 3C04 (171C8) ---- Move bitmap at (8078) to top right corner of LCD
  259. Input:  set 1,(IY+12h): move bytes
  260.         res 1,(IY+12h): don't move bytes
  261.  
  262. Result: 8 bytes are moved from (8078) to the top right corner of the LCD.
  263.         res 1,(IY+12h)
  264.  
  265. ---- CALL 3C22 (170BA) ---- Print length-indexed menu string ----------------
  266. Input:  HL -> string
  267.         B = string length
  268.         (8333) = x coordinate
  269.         (8334) = y coordinate
  270.         res 1,(IY+05): print only 6 rows of the character
  271.         set 1,(IY+05): print entire 7 rows of the character
  272.         res 3,(IY+05): print character over current screen
  273.         set 3,(IY+05): XOR character with current screen
  274.  
  275. Result: The string is printed on the screen and the x coordinate is updated.
  276.  
  277. ---- CALL 3CA0 (16FDB) ---- Point HL to absolute address of text cursor -----
  278. Input:  Nothing
  279.  
  280. Result: HL = absolute address of text cursor (in primary text memory [80DF])
  281.  
  282. ---- CALL (3D8A) ---- Store text mode parameters and screen in secondary area
  283. Input:  Nothing
  284.  
  285. Result: 168 bytes are moved from 80DF to 806B.  ; text buffer
  286.         (8187) = (800C)            ; cursor row
  287.         (8188) = (800D)         ; cursor column
  288.         (8189) = (8B2F)
  289.         (818A) = (8358)
  290.         (818B) = (834B) AND 16
  291.  
  292. Note: This function has not been tested.
  293.  
  294. ---- CALL (3D90) ---- Scroll screen up --------------------------------------
  295. Input:  (8B2F) = row to start (0-7)
  296.         (8B30) = number of rows to scroll (1-8)
  297.         set 1,(IY+0D): scroll the text memory
  298.         res 1,(IY+0D): don't scroll the text memory
  299.  
  300. Result: Text is scrolled and a blank line is inserted at the end.
  301.  
  302. Note: This function has not been tested.
  303.  
  304. ---- CALL 3DF6 (16A57) ---- Print character ---------------------------------
  305. Input:  A = character to print
  306.         (800C) = row
  307.         (800D) = column
  308.         set 3,(IY+05): display white on black
  309.         res 3,(IY+05): display black on white
  310.         set 1,(IY+0D): alter text memory
  311.         res 1,(IY+0D): don't alter text memory
  312.  
  313. Result: The character is printed on the screen. 
  314.  
  315. ---- CALL 3DFC (16F03) ---- Clear LCD ---------------------------------------
  316. Input:  Nothing
  317.  
  318. Result: The LCD is cleared (FC00-FFFF is zeroed).
  319.         Nothing happens to the text memory at 80DF.
  320.         Nothing happens to the graphics memory at 8641.
  321.         HL = 8358
  322.         DE = BC = 0000
  323.  
  324. ---- CALL 3E0E (37D69) ---- *** FAIL ----------------------------------------
  325. Input:  HL = string to print in front of "FAIL"
  326.  
  327. Result: The string at HL is printed on the screen followed by "FAIL"
  328.         The memory is cleared and the defaults are set.
  329.  
  330. Note: This function has not been tested.
  331.  
  332. ---- CALL 3E5C (16F27) ---- Clear text screen -------------------------------
  333. Input:  set 1,(IY+0D): fill text memory (80DF) with spaces
  334.         res 1,(IY+0D): clear the LCD without altering the text memory
  335.  
  336. Result: The screen is cleared.
  337.  
  338. ---- CALL 3E68 (16BDE) ---- Print ASCIIZ string -----------------------------
  339. Input:  HL -> null-terminated string
  340.         (800C) = row
  341.         (800D) = column
  342.         set 3,(IY+05): display white on black
  343.         res 3,(IY+05): display black on white
  344.         set 1,(IY+0D): alter text memory
  345.         res 1,(IY+0D): don't alter text memory
  346.  
  347. Result: The string is printed on the screen.
  348.  
  349. ---- CALL 3E6E (16FD0) ---- Set cursor row to position stored in (8B2F) -----
  350. Input:  Nothing
  351.  
  352. Result: (800C) = (8B2F)
  353.         (800D) = 00
  354.  
  355. Note: This function has not been tested.
  356.  
  357. ---- CALL 3EA4 (170E2) ---- Turn off "busy" indicator -----------------------
  358. Input:  Nothing
  359.  
  360. Result: The "busy" indicator is turned off.
  361.         res 0,(IY+12h)
  362.  
  363. ---- CALL 3EBC (170CA) ---- Turn on "busy" indicator ------------------------
  364. Input:  Nothing
  365.  
  366. Result: The "busy" indicator is turned on.
  367.         set 0,(IY+12h)
  368.