You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

245 lines
3.3KB

  1. .PAGE 'TST4'
  2. ;
  3. ; GET NEXT CHAR FROM A CHANL
  4. ;
  5. GBYTE ;GET THROUGH INTERNAL CHANNEL
  6. JSR FNDRCH
  7. JSR SETLDS
  8. JSR GET
  9. LDX LINDX
  10. LDA CHNDAT,X
  11. RTS
  12. ;
  13. ;
  14. GET LDX LINDX
  15. JSR TYPFIL ;GET FILE TYPE
  16. BNE GET00
  17. ;
  18. JMP RDREL
  19. GET00
  20. LDA SA
  21. CMP #$F
  22. BEQ GETERC
  23. ;
  24. LDA CHNRDY,X ;WAS LAST CHAR JUST SENT
  25. AND #EOISND ; JUST SENT EOI
  26. BNE GET1 ;NOPE NOT THIS TIME
  27. ;
  28. JSR TYPFIL
  29. CMP #DIRTYP
  30. BNE GET0 ;NOT DIRECT TYPE
  31. ;
  32. LDA #RNDRDY ; DIRECT FILE REMAINS ACTIVE
  33. STA CHNRDY,X ;TALKER LISTENER NOEOI
  34. JMP RNDGET ; PREPARE THE NEXT CHAR
  35. ;
  36. GET0 LDA #NOTRDY ;LST CHAR SENT,NOT READY
  37. STA CHNRDY,X
  38. RTS
  39. ;
  40. ;
  41. GET1 LDA SA ;TEST IF A LOAD
  42. BEQ GET6 ;ITS A LOAD SA OF 0
  43. ;
  44. GET2 JSR TYPFIL ; TST FOR RND FILE
  45. CMP #4
  46. BCC SEQGET ;SEQ FILE CHAR GET
  47. ;
  48. RNDGET JSR GETPRE ;DIRECT FILE GET
  49. LDA BUFTAB,X
  50. CMP LSTCHR,Y ;UP TO LST CHAR YET
  51. BNE RNGET1 ;NOT YET
  52. ;
  53. LDA #0 ;READ THE WHOLE THING
  54. STA BUFTAB,X ;WRAP PNTR TO 0
  55. RNGET1
  56. INC BUFTAB,X ;GET THE NEXT CHAR
  57. RNGET2
  58. LDA (BUFTAB,X)
  59. RNGET4
  60. STA CHNDAT,Y ;SAVE CHAR IN
  61. LDA BUFTAB,X
  62. CMP LSTCHR,Y
  63. BNE RNGET3
  64. ;
  65. LDA #RNDEOI
  66. STA CHNRDY,Y ;THIS IS LAST CHAR
  67. RNGET3 RTS ;SEND EOI WITH IT
  68. ;
  69. ;
  70. SEQGET JSR RDBYT ;READ THE NEXT BYTE
  71. GET3 LDX LINDX
  72. STA CHNDAT,X ;STORE IN CHNDAT
  73. RTS
  74. ;
  75. ;
  76. GET6 LDA DIRLST ;TEST IF DIR LSTING
  77. BEQ SEQGET ;NO, ITS NOT
  78. JSR GETDIR ;YES IT IS,GET DIR CHAR
  79. JMP GET3
  80. ;
  81. GETERC
  82. JSR GETPNT
  83. CMP #<ERRBUF-1
  84. BNE GE10
  85. LDA DIRBUF+1
  86. CMP #>ERRBUF
  87. BNE GE10
  88. ;
  89. LDA #CR
  90. STA DATA
  91. JSR ERROFF
  92. LDA #0
  93. JSR ERRTS0
  94. DEC CB+2
  95. LDA #EOIOUT
  96. BNE GE30 ;(JUMP)
  97. ;
  98. GE10
  99. JSR GETBYT
  100. STA DATA
  101. BNE GE20
  102. GE15
  103. LDA #<ERRBUF-1
  104. JSR SETPNT
  105. LDA #>ERRBUF
  106. STA BUFTAB+1,X
  107. GE20
  108. LDA #RDYTLK
  109. GE30
  110. STA CHNRDY+ERRCHN
  111. LDA DATA
  112. STA CHNDAT+ERRCHN
  113. RTS
  114. ;
  115. ;
  116. ; READ NEXT BUFFER OF A FILE
  117. ; FOLLOW LINKS IN FIRST TWO BYTES
  118. ; END OF FILE IF 1ST BYTE=0
  119. ; 2ND CHAR LENGTH
  120. ;
  121. NXTBUF JSR GETACT
  122. ASL A
  123. TAX
  124. LDA #0
  125. STA BUFTAB,X
  126. LDA (BUFTAB,X)
  127. BEQ NXTB1
  128. DEC BUFTAB,X
  129. JMP RDBYT
  130. NXTB1 RTS
  131. ;
  132. ; DIRECT BLOCK READ
  133. ;
  134. ;
  135. DRTRD LDA #READ
  136. BNE DRT
  137. ; DIRECT BLOCK WRITE
  138. ;
  139. ; DIRECT BLOCK WRITE
  140. DRTWRT LDA #WRITE
  141. DRT ORA DRVNUM
  142. STA CMD
  143. LDA JOBNUM
  144. JSR SETH
  145. LDX JOBNUM
  146. JMP DOIT2
  147. ; OPEN INTERNAL READ CHANL (SA=16)
  148. ;
  149. OPNIRD
  150. LDA #1
  151. OPNTYP
  152. STA TYPE
  153. LDA #IRSA
  154. STA SA
  155. JSR OPNRCH
  156. LDA #2
  157. JMP SETPNT
  158. ; OPEN INTERNAL WRITE CHANL (SA=16)
  159. ;
  160. ;
  161. OPNIWR LDA #IWSA
  162. STA SA
  163. JMP OPNWCH
  164. ;
  165. ; ALLOCATE NEXT DIRECTORY BLOCK ON 18
  166. ; AND MARK AS USED IN BAM
  167. ;
  168. NXDRBK JSR CURBLK
  169. LDA #1
  170. STA TEMP
  171. LDA SECINC
  172. PHA
  173. LDA #3 ; INCR SECTOR BY 3 IN DIRECTORY
  174. STA SECINC
  175. JSR NXTDS
  176. PLA
  177. STA SECINC
  178. LDA #0
  179. JSR SETPNT
  180. LDA TRACK
  181. JSR PUTBYT
  182. LDA SECTOR
  183. JSR PUTBYT
  184. JSR WRTBUF
  185. JSR WATJOB
  186. LDA #0
  187. JSR SETPNT
  188. NXDB1 JSR PUTBYT
  189. BNE NXDB1
  190. JSR PUTBYT
  191. LDA #$FF
  192. JMP PUTBYT
  193. ;
  194. ;
  195. ; .A=NEW PNTR VALUE
  196. ;
  197. SETPNT STA TEMP
  198. JSR GETACT
  199. ASL A
  200. TAX
  201. LDA BUFTAB+1,X
  202. STA DIRBUF+1
  203. LDA TEMP
  204. STA BUFTAB,X
  205. STA DIRBUF
  206. RTS
  207. ;
  208. ;
  209. ;
  210. ; FREE THE INTERNAL CHANL (SA=16)
  211. ;
  212. FREICH LDA #IRSA
  213. STA SA
  214. JSR FRECHN
  215. LDA #IWSA
  216. STA SA
  217. JMP FRECHN
  218. ;
  219. ; READ THE ACTIVE BUFFER POINTER
  220. ;
  221. GETPNT JSR GETACT
  222. SETDIR
  223. GP1 ASL A
  224. TAX
  225. LDA BUFTAB+1,X
  226. STA DIRBUF+1
  227. LDA BUFTAB,X
  228. STA DIRBUF
  229. RTS
  230. ;
  231. ; DIRECT READ BYTE, .A=BYTE# TO READ
  232. ;
  233. DRDBYT STA TEMP+2
  234. JSR GETACT
  235. TAX
  236. LDA BUFIND,X
  237. STA TEMP+3
  238. LDY #0
  239. LDA (TEMP+2),Y
  240. RTS
  241. ; INDEX TABLE CONTAINING HIGH
  242. ; BYTE ADDRESS OF BUFFERS
  243. ;
  244. .END