home *** CD-ROM | disk | FTP | other *** search
/ ftp.barnyard.co.uk / 2015.02.ftp.barnyard.co.uk.tar / ftp.barnyard.co.uk / cpm / walnut-creek-CDROM / CPM / BDSC / BDSC-1 / BDS46.LIB < prev    next >
Text File  |  2000-06-30  |  5KB  |  181 lines

  1.  
  2. ;
  3. ; BDS.LIB        for BDS C v1.46            March  15, 1982
  4. ;
  5. ; Addresses within C.CCC and the ram area to be used by machine
  6. ; language CRL functions. 
  7. ;
  8. ; If you alter C.CCC by reassembling CCC.ASM, be sure to go through
  9. ; this file and make sure all the addresses are equated to the 
  10. ; appropriate values resulting from the reassembly. Then the library
  11. ; functions will be ready to reassemble.
  12. ;
  13.  
  14.     page 76
  15.  
  16. CPM:    EQU 1        ;true if running under CP/M; else 0
  17.  
  18. ;
  19. ; System addresses:
  20. ;
  21.  
  22.     if not cpm
  23. CCCORG:    EQU WHATEVER    ;IF NOT RUNNING UNDER CP/M, SET THIS TO LOAD ADDR,
  24. RAM:    EQU WHATEVER2    ;SET THIS TO RAM AREA,
  25. BASE:    EQU WHATEVER3    ;AND THIS TO THE BASE OF SYSTEM MEMORY (`BASE' IS 
  26.             ;THE RE-BOOT LOCATION UNDER CP/M; FOR NON-CP/M OPER-
  27.             ;ATION, IT SHOULD BE SET TO A SAFE PLACE TO JUMP TO ON
  28.             ;ERROR OR USER-ABORT.
  29.     endif
  30.  
  31.  
  32.     if cpm
  33. base:    equ 0000h    ;either 0 or 4200h for CP/M systems
  34. fcb:    equ base+5ch    ;default file control block
  35. tbuff:    equ base+80h    ;sector buffer
  36. bdos:    equ base+5    ;bdos entry point
  37. tpa:    equ base+100h    ;transient program area
  38. nfcbs:    equ 8        ;max number of open files allowed at one time
  39. errorv:    equ 255        ;error value returned by BDOS calls
  40. cccorg:    equ tpa        ;where run-time package resides *TESTING*
  41.  
  42.             ;**************************************************
  43. ram:    equ cccorg+471h    ;THIS WILL PROBABLY CHANGE IF YOU CUSTOMIZE CCC.ASM
  44.             ;**************************************************
  45.     endif
  46.  
  47.  
  48. cr:    equ 0dh        ;ASCII codes:    carriage return
  49. lf:    equ 0ah        ;        linefeed
  50. newlin:    equ lf        ;        newline
  51. tab:    equ 9        ;        tab
  52. bs:    equ 08h        ;        backspace
  53. cntrlc:    equ 3        ;        control-C
  54.  
  55. ;
  56. ; Subroutines in C.CCC (the addresses should be that of the 
  57. ; appropriate jump vector entry points):
  58. ;
  59.  
  60. error:    equ cccorg+1dh    ;return -1 in HL:
  61. exit:    equ error+3    ;close all open files and reboot
  62.  
  63.     if cpm
  64. close:    equ error+6
  65. setfcb:    equ error+9    ;set up fcb at HL from text at DE
  66. fgfd:    equ error+12    ;set C according to whether file fd is open
  67. fgfcb:    equ error+15    ;figure address of internal fcb for file fd
  68.     endif
  69.  
  70.  
  71. eqwel:    equ cccorg+0e5h
  72.  
  73. smod:    equ cccorg+10fh
  74. usmod:    equ cccorg+129h
  75. smul:    equ cccorg+13fh
  76. usmul:    equ cccorg+16bh
  77. usdiv:    equ cccorg+189h
  78. sdiv:    equ cccorg+1cbh
  79.  
  80. cmh:    equ cccorg+1fah    ;2's complement HL
  81. cmd:    equ cccorg+202h    ;2's complement DE
  82. ma1toh:    equ cccorg+20ah    ;get 1st stack element into HL and A
  83. ma2toh:    equ cccorg+213h    ;    2nd
  84. ma3toh:    equ ma2toh+6    ;    3rd
  85. ma4toh:    equ ma2toh+12    ;    4th
  86. ma5toh:    equ ma2toh+18    ;    5th
  87. ma6toh:    equ ma2toh+24    ;    6th
  88. ma7toh:    equ ma2toh+30    ;    7th
  89.  
  90. arghak:    equ ma2toh+36    ;copy first 6 or so stack elements to argc area
  91. setdma:    equ cccorg+460h    ;set CP/M internal DMA pointer to BASE+80h (tbuff)
  92.  
  93. ;
  94. ; The following addresses will depend on the value of RAM if you
  95. ; customize CCC.ASM....be sure they correspond to the assembly
  96. ; results of CCC.ASM in such cases. If you remove some of the data
  97. ; areas from CCC.ASM (in case they aren't needed), be sure to remove
  98. ; from here also.
  99. ;
  100.  
  101.     org ram
  102.  
  103. room:    ds 30        ;misc. scratch area (for use by BDS...you can have
  104.             ;the last ten bytes or so, though, if you really
  105.             ;need them)
  106.  
  107. pbase:    ds 2        ;DMA video plotting base
  108. ysize:    ds 2        ;screen width (# of columns)
  109. xsize:    ds 2        ;screen length (# of lines)
  110. psize:    ds 2        ;screen size (ysize * xsize)
  111.  
  112. rseed:    ds 8        ;random number seed scratch area
  113.  
  114. args:    ds 14        ;where arghak puts arg values off the stack
  115.  
  116. iohack:    ds 6        ;room for input and output ops for "inp" and "outp"
  117.  
  118. allocp: ds 2        ;storage allocation pointer
  119. alocmx:    ds 2        ;highest addr useable by storage allocator
  120.  
  121. ;
  122. ; This is the end of the user-customizable area. The remaining
  123. ; equated values are not to be altered.
  124. ;
  125.  
  126. ;
  127. ; Special locations in C.CCC containing interesting pointers:
  128. ;
  129.  
  130. extrns:    equ cccorg+15h    ;base of external data area (set by CLINK)
  131. cccsiz:    equ cccorg+17h    ;size of C.CCC for use by CLINK only
  132. codend:    equ cccorg+19h    ;address of byte following last byte of program code
  133.             ; (set by CLINK)
  134. freram:    equ cccorg+1bh    ;first free address after external area
  135.             ; (set by CLINK)
  136.  
  137.  
  138. arg1:    equ args    ;these are just convenient names for 
  139. arg2:    equ args+2    ;the words in the "args" area
  140. arg3:    equ args+4
  141. arg4:    equ args+6
  142. arg5:    equ args+8
  143. arg6:    equ args+10
  144. arg7:    equ args+12
  145.  
  146. tmp:    equ room    ;some scratch data areas used by library
  147. tmp1:    equ room+1    ;functions.
  148. tmp2:    equ room+2
  149. tmp2a:    equ room+4
  150. ungetl:    equ room+6
  151. lastc:    equ room+7
  152.  
  153.  
  154. ;
  155. ; BDOS call codes:
  156. ;
  157.  
  158.     if cpm
  159. conin:    equ 1        ;get a character from console
  160. conout:    equ 2        ;write a character to console
  161. lstout:    equ 5        ;write a character to list device
  162. dconio:    equ 6        ;direct console I/O (only for CP/M 2.0)
  163. pstrng:    equ 9        ;print string (terminated by '$')
  164. getlin:    equ 10        ;get buffered line from console
  165. cstat:    equ 11        ;get console status
  166. select:    equ 14        ;select disk
  167. openc:    equ 15        ;open a file
  168. closec:    equ 16        ;close a file
  169. delc:    equ 19        ;delete a file
  170. reads:    equ 20        ;read a sector (sequential)
  171. writs:    equ 21        ;write a sector (sequential)
  172. creatc:    equ 22        ;make a file
  173. renc:    equ 23        ;rename file
  174. sdma:    equ 26        ;set dma
  175. readr:    equ 33        ;read random sector
  176. writr:    equ 34        ;write random sector
  177. cfsizc:    equ 35        ;compute file size
  178. srrecc:    equ 36        ;set random record
  179.     endif
  180.  
  181.