userlib.h 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. userlib::idle_loop equ userlib@0000
  2. ;------------------------------------------------------------
  3. ; Waits for a key input and returns the keycode value in d0
  4. ; Supports APD and shuts down if user presses <DIAMOND>+<ON>
  5. ;------------------------------------------------------------
  6. userlib::random equ userlib@0001
  7. ;----------------------------------------------------------------------------
  8. ; random(void)
  9. ;
  10. ; Function: Return a pseudorandom number
  11. ;
  12. ; input: D0.W = upper limit
  13. ; output: D0.W = random number in [0..limit-1]
  14. ;----------------------------------------------------------------------------
  15. userlib::rand_seed equ userlib@0002
  16. ;----------------------------------------------------------------------------
  17. ; WORD rand_seed
  18. ;
  19. ; Random seed used by random(). You may store values to it to initialize
  20. ; the random number seed.
  21. ;----------------------------------------------------------------------------
  22. userlib::exec equ userlib@0003
  23. ;----------------------------------------------------------------------------
  24. ;executes a program
  25. ;the parameter for this function is pushed on the stack
  26. ;input: the handle of the program to execute
  27. ;output: d0.w = result
  28. ;
  29. ;Here are d0 values as result:
  30. ;0 -> everything is alright
  31. ;1 -> Not enough memory
  32. ;2 -> Lib not found
  33. ;3 -> Wrong lib version
  34. ;4 -> File format is not valid
  35. ;5 -> File is in use
  36. ;other -> file was not a Doors OS file but was run.
  37. ;----------------------------------------------------------------------------
  38. userlib::FindSymEntry equ userlib@0004
  39. userlib::DrawCharXY equ userlib@0005
  40. userlib::InputStr equ userlib@0006
  41. ;---------------------------------------------------------------------
  42. ; InputStr(x,y,maxchar)
  43. ;
  44. ; Inputs a string at x,y
  45. ;
  46. ;Input:d1.w = x
  47. ; d2.w = y
  48. ; d3.w = maxchar
  49. ;
  50. ;Output: d0.w = string lenght
  51. ; a0.l = adress of the string
  52. ;---------------------------------------------------------------------
  53. userlib::getpassword equ userlib@0007
  54. ;---------------------------------------------------------------------
  55. ;getpassword(void)
  56. ;
  57. ; Asks for the Doors password and return in d1 the result
  58. ;
  59. ;Input: nothing
  60. ;
  61. ;Output: d1.w = 0 -> Good password
  62. ; Otherwise the password was bad.
  63. ;
  64. ; NO OTHER REGISTERS DETROYED
  65. ;---------------------------------------------------------------------
  66. userlib::changepass equ userlib@0008
  67. ;---------------------------------------------------------------------
  68. ;changepass(void)
  69. ;
  70. ; Asks for the old Doors password and if it is good, asks for a new Doors password
  71. ;
  72. ;Input and Output: nothing
  73. ;
  74. ; NO REGISTERS DESTROYED
  75. ;---------------------------------------------------------------------
  76. userlib::lockcalc equ userlib@0009
  77. ;---------------------------------------------------------------------
  78. ;lockcalc(void)
  79. ;
  80. ; Turn off the calculator. When turned on, the Doors password is asked.
  81. ; If the password is bad, the calc is turned off again.
  82. ;
  83. ;Input: nothing
  84. ;
  85. ;Output: d4=0 -> screen wasn't restored
  86. ;
  87. ; NO OTHER REGISTERS DESTROYED
  88. ;
  89. ;NOTE:this function requires 3840 bytes free (2000 on a 89) to save the screen
  90. ;and later restore it. If there isn't place enough, the screen wont'be restored.
  91. ;---------------------------------------------------------------------
  92. userlib::idle_hot equ userlib@000A
  93. ;---------------------------------------------------------------------
  94. ;idle_hot(void)
  95. ;
  96. ; Same as idle_loop but:
  97. ; -pressing the F7 (Home on the 89) key will protect your calc by turning off
  98. ; and asking for a password
  99. ; -pressing the F8 (Mode on the 89) key will turn off your calc
  100. ;
  101. ;Input: nothing
  102. ;
  103. ;Output: d0.w = getkey code of key pressed
  104. ; NO OTHER REGISTERS DETROYED
  105. ;---------------------------------------------------------------------
  106. userlib::getfreeRAM equ userlib@000B
  107. ;---------------------------------------------------------------------
  108. ; getfreeRAM(void)
  109. ;
  110. ; returns the free memory, in bytes
  111. ;
  112. ;Input: nothing
  113. ;
  114. ;Output: d0.l = number of bytes free in memory
  115. ;
  116. ; NO OTHER REGISTERS DESTROYED
  117. ;---------------------------------------------------------------------
  118. userlib::smallmenu equ userlib@000C
  119. ;-------------------------------------------------------
  120. ; smallmenu(x,y,nbitem,txtlist)
  121. ;
  122. ; Draws a small menu. Automatically adjusts width and height of the menu, taking into account the current font, the width and the height of the text
  123. ; This function restores the part of the screen it takes,
  124. ; so you don't have to redraw it.
  125. ;
  126. ;Input:
  127. ; d0.w = x
  128. ; d1.w = y
  129. ; d2.b = nbitem
  130. ; a0.l = string list; adding an extra null byte between 2 strings will force
  131. ; smallmenu to draw an horizontal line.
  132. ;
  133. ;Output:
  134. ; d0.w = Selected Item
  135. ; d1.w = Last key pressed
  136. ; d2.w = 0 -> ENTER pressed
  137. ; Otherwise, another key has been pressed
  138. ;If there is not enough memory to save the screen, the menu won't be displayed
  139. ;
  140. ;-------------------------------------------------------
  141. userlib::getfreearchive equ userlib@000D
  142. ;---------------------------------------------------------------------
  143. ; getfreearchive(void)
  144. ;
  145. ; returns the free memory in archive, in bytes
  146. ;
  147. ;Input: nothing
  148. ;
  149. ;Output: d0.l = number of bytes free in archive memory
  150. ;
  151. ; NO OTHER REGISTERS DESTROYED
  152. ;---------------------------------------------------------------------
  153. userlib::set_APD equ userlib@000E
  154. ;---------------------------------------------------------------------
  155. ; set_APD(short new_APD)
  156. ;
  157. ; Sets the Auto Power Down timer to shut down the calc after <new_APD> seconds
  158. ;
  159. ;Input: d0.w = new_APD
  160. ;
  161. ;Output: nothing
  162. ;
  163. ; NO REGISTERS DESTROYED
  164. ;---------------------------------------------------------------------
  165. userlib::get_APD equ userlib@000F
  166. ;---------------------------------------------------------------------
  167. ; short get_APD(void)
  168. ;
  169. ; Gets the APD value (in seconds)
  170. ;
  171. ;Input: nothing
  172. ;
  173. ;Outut: d0.w = APD value
  174. ;
  175. ; NO REGISTERS DESTROYED
  176. ;---------------------------------------------------------------------
  177. userlib::runprog equ userlib@0010
  178. ;---------------------------------------------------------------------
  179. ; short runprog(char* commandline)
  180. ;
  181. ;Input: the parameter is pushed on the stack, it is a pointer to
  182. ; an ASCII string containing the commandline to run
  183. ; example: "main\doors()"
  184. ;Output: d0.w : error code. Zero means no error.
  185. ;
  186. ;---------------------------------------------------------------------