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.

tst4.src 5.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  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