home *** CD-ROM | disk | FTP | other *** search
/ BCI NET / BCI NET Dec 94.iso / archives / programming / blitzbasic / riblitzlibs.lha / riblitzlibs / func / Func_Library.doc < prev    next >
Encoding:
Text File  |  1994-06-14  |  8.4 KB  |  274 lines

  1. Func Library v1.0
  2. =================
  3.  
  4. By Steven Matty
  5. ©1994 Reflective Images
  6.  
  7.   This library was written primarily to emulate the functions that were
  8. present in AM*S but not in Blitz Basic 2. It began life as a load of Blitz
  9. Statements but was then converted to high speed 680x0. The library will
  10. continually be expanded upon and free updates will be sent on request.
  11. If you decide to use any of the function please give me a little cred, not
  12. a lot, just something. Anyway, enough of this baloney....on with the
  13. command list. 
  14.  
  15.         success=Reserve(banknumber,length)
  16.         Erase(banknumber)
  17.         EraseAll
  18.         address.l=Start(banknumber)
  19.         length.l=Length(banknumber)
  20.         success=BLoad(filename$,banknumber/address[,length,offset])
  21.         success=BSave(filename$,banknumber/address,length)
  22.         success=PLoad(filename$,banknumber/address)
  23.         bytes.l=FileSize(filename$)
  24.         banknumber=NextBank
  25.         bytes.l=MemFree
  26.         value.l=Max(value1.l,value2.l)
  27.         value.l=Min(value1.l,value2.l)
  28.         value.l=XOR(value1.l,value2.l)
  29.         id.w=Lisa
  30.         Reboot
  31.         code.b=KeyCode
  32.         CopyByte sourceaddress.l,destaddress.l,numbytes.l
  33.         CopyWord sourceaddress.l,destaddress.l,numwords.l
  34.         CopyLong sourceaddress.l,destaddress.l,numlongs.l
  35.         FillMem sourceaddress.l,numberbytes.l[,bytevalue.l]
  36.         CacheOff
  37.         number.l=Timer
  38.         ResetTimer
  39.         success=Rename(source$,dest$)
  40.         success=MakeDir(dirname$)
  41.         tagnumber.l=GTTagValue[(tagnumber)]
  42.  
  43. ********************************* NOTE **************************************
  44. * VALID BANKS RANGE FROM 0-49 INCLUSIVE. DO NOT USE A VALUE GREATER THAN 49 *
  45. * OR IT WILL BE INTERPRETED AS AN ADDRESS RATHER THAN A BANKNUMBER          *
  46. *****************************************************************************
  47.  
  48. Function: Reserve
  49. --------------------------------------------------------------------------------
  50. Mode   : Amiga/Blitz
  51. Syntax : success=Reserve(banknumber,length)
  52.  
  53.   This will attempt to reserve <length> bytes of memory. If succesfull,
  54. it will return the address of the bank. If unsuccessfull, 0 is returned.
  55. Banks are limited by the Compiler Options Menu.
  56.  
  57.  
  58. Statement: Erase
  59. --------------------------------------------------------------------------------
  60. Mode   : Amiga/Blitz
  61. Syntax : Erase(banknumber)
  62.  
  63.   The Erase command will erase the specified memory bank.
  64.  
  65.  
  66. Statement: EraseAll
  67. --------------------------------------------------------------------------------
  68. Mode   : Amiga/Blitz
  69. Syntax : EraseAll
  70.  
  71.   This command will erase ALL allocated memory banks.
  72.  
  73.  
  74. Function: BLoad
  75. --------------------------------------------------------------------------------
  76. Mode   : Amiga
  77. Syntax : success=BLoad(filename$,bank/address[,length,offset,memtype])
  78.  
  79.   If bank is specified, then the file is loaded into that bank. If address
  80. is specified then it is loaded to the address. Valid banks are 0-49. 
  81. If the bank does not exist, Blitz will reserve a bank for you.
  82. If the bank does exist, Blitz will erase the bank from memory, and
  83. allocate a new one.
  84. The return result is -1 for success, or 0 for failure  (not enough RAM, 
  85. file not exist). If offset is specified, then <length> bytes will be read
  86. from the specified offset position in the file.
  87. If memtype is specified, then the file is loaded into a memory block
  88. of that particular memtype (%10=Chip, %1=Public)
  89.  
  90.  
  91. Function: PLoad
  92. -------------------------------------------------------------------------------
  93. Mode   : Amiga
  94. Syntax : success=PLoad(filename$,bank/address)
  95.  
  96.   This will attempt to load the executable file to the specified address.
  97.   -1 is success, 0 is failure.
  98.  
  99.  
  100. Function: BSave
  101. --------------------------------------------------------------------------------
  102. Mode   : Amiga
  103. Syntax : success=BSave(filename$,bank/address,length)
  104.  
  105.   This will save <length> bytes at bank/address to the file. Return result
  106. is -1 for success, 0 for failure. If length > bank length then the length
  107. of the bank is saved instead. If 0 is specified, the entire bank is saved.
  108.  
  109.  
  110. Function: Start
  111. -------------------------------------------------------------------------------
  112. Mode   : Amiga/Blitz
  113. Syntax : start_address.l=Start(banknumber.b)
  114.  
  115.   This will return the start address of the specified bank. (0=no bank)
  116.  
  117.  
  118. Function: Length
  119. -------------------------------------------------------------------------------
  120. Mode   : Amiga/Blitz
  121. Syntax : length_of_bank.l=Length(banknumber.b)
  122.  
  123.   This will return the length of the specified bank in bytes. (0=No bank)
  124.  
  125.  
  126. Function: MemFree
  127. --------------------------------------------------------------------------------
  128. Mode   : Amiga/Blitz
  129. Syntax : bytes.l=MemFree
  130.  
  131.   This will return the total amount of Public Free RAM available to the
  132. system.
  133.  
  134.  
  135. Function: NextBank
  136. --------------------------------------------------------------------------------
  137. Mode   : Amiga/Blitz
  138. Syntax : bank.b=NextBank
  139.  
  140.   This will return the number of the first available bank (-1 if none free).
  141.  
  142.  
  143. Statement: FillMem
  144. -------------------------------------------------------------------------------
  145. Mode   : Amiga/Blitz
  146. Syntax : FillMem(address.l,length.l,value.b)
  147.  
  148.    This will fill 'length' bytes starting from the specified address with 
  149.    'value'.
  150.  
  151.  
  152. Statement: CopyByte
  153. --------------------------------------------------------------------------------
  154. Mode   : Amiga/Blitz
  155. Syntax : CopyByte(source.l,dest.l,num.l)
  156.  
  157.   This will copy <num> bytes from <source> to <dest> 
  158.  
  159. Statement: CopyWord
  160. --------------------------------------------------------------------------------
  161. Mode   : Amiga/Blitz
  162. Syntax : CopyByte(source.l,dest.l,num.l)
  163.  
  164.   This will copy <num> words from <source> to <dest> 
  165.  
  166. Statement: CopyLong
  167. --------------------------------------------------------------------------------
  168. Mode   : Amiga/Blitz
  169. Syntax : CopyByte(source.l,dest.l,num.l)
  170.  
  171.   This will copy <num> longwords from <source> to <dest> 
  172.  
  173.  
  174. Function: MakeDir
  175. --------------------------------------------------------------------------------
  176. Mode   : Amiga
  177. Syntax : success=MakeDir(name$)
  178.  
  179.    This function attempts to create a directory called <name$>
  180.    If it is unsuccessfull, 0 is returned else -1 is returned.
  181.  
  182. Function: Rename
  183. --------------------------------------------------------------------------------
  184. Mode   : Amiga
  185. Syntax : success=Rename(source$,dest$)
  186.  
  187.    This attempts to rename the file <source$> to <dest$>
  188.    NOTE: It is not possible to rename across devices.
  189.    -1 is returned if successfull, else 0.
  190.  
  191.  
  192. Function: Timer
  193. --------------------------------------------------------------------------------
  194. Mode   : Amiga/Blitz
  195. Syntax : t.l=Timer
  196.  
  197.    This will return the number of 50ths of a second since startup or the
  198.    last call to ResetTimer.
  199.  
  200. Statement: ResetTimer
  201. --------------------------------------------------------------------------------
  202. Mode   : Amiga/Blitz
  203. Syntax : ResetTimer
  204.  
  205.    This will recent the CIA timer to 0.
  206.  
  207.  
  208. Function: Lisa
  209. --------------------------------------------------------------------------------
  210. Mode   : Amiga/Blitz
  211. Syntax : chipver=Lisa
  212.  
  213.    This will return the current Lisa chip version :
  214.  
  215.     $00 for OCS Denise
  216.     $F7 for ECS Denise
  217.     $F8 for AGA Lisa
  218.  
  219. Statement: Reboot
  220. --------------------------------------------------------------------------------
  221. Mode   : Amiga/Blitz
  222. Syntax : Reboot
  223.  
  224.    This will perform a cold reboot
  225.  
  226.  
  227. Function: FileSize
  228. --------------------------------------------------------------------------------
  229. Mode   : Amiga
  230. Syntax : size.l=FileSize(filename$)
  231.  
  232.   This return the length (in bytes) of the file.
  233.  
  234. Statement: CacheOff
  235. --------------------------------------------------------------------------------
  236. Mode   : Amiga/Blitz
  237. Syntax : Cache Off
  238.  
  239.   This will turn off the instruction cache of the CPU.
  240.  
  241. Function: XOR
  242. --------------------------------------------------------------------------------
  243. Mode   : Amiga/Blitz
  244. Syntax : x.l=XOR(x.l,y.l)
  245.  
  246.   This will perform an Exclusive-Or operation between X and Y and put the
  247. result back into X 
  248. e.g
  249.  
  250.     x=XOR(%101,%100)
  251.  
  252. Will place %001 into X (%101 XOR %100 = %001)
  253.  
  254.  
  255. Function: Max/Min
  256. -------------------------------------------------------------------------------
  257. Mode   : Amiga/Blitz
  258. Syntax : value=Max(first_var,second_var)
  259.          value=Min(first_var,second_var)
  260.  
  261.   This will compare both values and return either the Higher of the values
  262.   (Max) or the Lower (Min). This currently supports INTEGERs only.
  263.  
  264.  
  265. Function: KeyCode
  266. -------------------------------------------------------------------------------
  267. Mode   : Amiga/Blitz
  268. Syntax : keycode=KeyCode
  269.  
  270.     This will return the status of the keyboard in the form of a keycode.
  271.     You will need to experiment to find out the desired keycode for
  272.     a particular key.
  273.     This merely peeks address $bfec01 and returns the value found.
  274.