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.

opchnl 2.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. .PAGE 'OPEN CHANNEL'
  2. ; OPCHNL
  3. ;
  4. ; OPEN A READ CHANL WITH 2 BUFFERS
  5. ; WILL INSERT SA IN LINTAB
  6. ; AND INITS ALL POINTERS.
  7. ; RELATIVE SS AND PTRS ARE SET.
  8. ;
  9. OPNRCH LDA #1 ;GET ONE DATA BUFFER
  10. JSR GETRCH
  11. JSR INITP ;CLEAR POINTERS
  12. LDA TYPE
  13. PHA
  14. ASL A
  15. ORA DRVNUM
  16. STA FILTYP,X ;SET FILE TYPE
  17. JSR STRRD ;READ 1ST ONE OR TWO BLOCKS
  18. LDX LINDX
  19. LDA TRACK
  20. BNE OR10
  21. ;
  22. LDA SECTOR
  23. STA LSTCHR,X ;SET LAST CHAR PTR
  24. OR10
  25. PLA
  26. CMP #RELTYP
  27. BNE OR30 ;MUST BE SEQUENTIAL STUFF
  28. ;
  29. LDY SA
  30. LDA LINTAB,Y ;SET CHANNEL AS R/W
  31. ORA #$40
  32. STA LINTAB,Y
  33. ;
  34. ;
  35. LDA REC
  36. STA RS,X ;SET RECORD SIZE
  37. ;
  38. JSR GETBUF ;GET SS BUFFER
  39. BPL OR20
  40. JMP GBERR ;NO BUFFER
  41. OR20
  42. LDX LINDX
  43. STA SS,X
  44. LDY TRKSS ;SET SS TRACK
  45. STY TRACK
  46. LDY SECSS ;SET SS SECTOR
  47. STY SECTOR
  48. JSR SETH ;SET SS HEADER
  49. JSR RDSS ;READ IT IN
  50. JSR WATJOB
  51. OROW
  52. ;
  53. LDX LINDX
  54. LDA #2
  55. STA NR,X ;SET FOR NXTREC
  56. ;
  57. LDA #0
  58. JSR SETPNT ;SET FIRST DATA BYTE
  59. ;
  60. JSR RD40 ;SET UP 1ST RECORD
  61. JMP GETHDR ;RESTORE T&S
  62. ;
  63. OR30
  64. JSR RDBYT ;SEQUENTIAL SET UP
  65. LDX LINDX
  66. STA CHNDAT,X
  67. LDA #RDYTLK
  68. STA CHNRDY,X
  69. RTS
  70. ;
  71. ; INITIALIZE VARIABLES FOR OPEN CHANL
  72. ; LSTJOB,SETS ACTIVE BUFFER#,LSTCHR,
  73. ; BUFFER POINTERS IN BUFTAB=2
  74. ;
  75. INITP LDX LINDX
  76. LDA BUF0,X
  77. ASL A
  78. TAY
  79. LDA #2
  80. STA BUFTAB,Y
  81. LDA BUF1,X
  82. ORA #$80
  83. STA BUF1,X
  84. ASL A
  85. TAY
  86. LDA #2
  87. STA BUFTAB,Y
  88. LDA #0
  89. STA NBKL,X
  90. STA NBKH,X
  91. LDA #0
  92. STA LSTCHR,X
  93. RTS
  94. ;
  95. ;
  96. ; OPEN A WRITE CHANL WITH 2 BUFFERS
  97. OPNWCH JSR INTTS ;GET FIRST TRACK,SECTOR
  98. LDA #1
  99. JSR GETWCH ;GET 1 BUFFERS FOR WRITING
  100. JSR SETHDR ;SET UP BUFFER HEADERS
  101. JSR INITP ;ZROPNT
  102. LDX LINDX
  103. LDA TYPE
  104. PHA
  105. ASL A
  106. ORA DRVNUM
  107. STA FILTYP,X ;SET FILTYP=SEQ
  108. PLA
  109. CMP #RELTYP
  110. BEQ OW10
  111. LDA #RDYLST ; ACTIVE LISTENER
  112. STA CHNRDY,X
  113. RTS
  114. ;
  115. OW10
  116. LDY SA
  117. LDA LINTAB,Y
  118. AND #$3F
  119. ORA #$40
  120. STA LINTAB,Y ;SET CHANNEL AS R/W
  121. ;
  122. LDA REC
  123. STA RS,X ;SET RECORD SIZE
  124. ;
  125. JSR GETBUF ;GET SS BUFFER
  126. BPL OW20
  127. JMP GBERR ;NO BUFFER
  128. OW20
  129. LDX LINDX
  130. STA SS,X
  131. JSR CLRBUF
  132. ;
  133. JSR NXTTS
  134. LDA TRACK
  135. STA TRKSS ;SAVE SS T&S
  136. LDA SECTOR
  137. STA SECSS
  138. ;
  139. LDX LINDX
  140. LDA SS,X
  141. JSR SETH ;SET SS HEADER
  142. LDA #0
  143. JSR SETSSP
  144. LDA #0 ;SET NULL LINK
  145. JSR PUTSS
  146. LDA #SSIOFF+1 ;SET LAST CHAR
  147. JSR PUTSS
  148. LDA #0 ;SET THIS SS #
  149. JSR PUTSS
  150. LDA REC ;RECORD SIZE
  151. JSR PUTSS
  152. LDA TRACK
  153. JSR PUTSS
  154. LDA SECTOR
  155. JSR PUTSS
  156. LDA #SSIOFF
  157. JSR SETSSP
  158. JSR GETHDR ;GET FIRST T&S
  159. LDA TRACK
  160. JSR PUTSS
  161. LDA SECTOR
  162. JSR PUTSS
  163. ;
  164. JSR WRTSS ;WRITE IT OUT
  165. JSR WATJOB
  166. LDA #2
  167. JSR SETPNT
  168. ;
  169. LDX LINDX ;SET NR FOR NULL BUFFER
  170. SEC
  171. LDA #0
  172. SBC RS,X
  173. STA NR,X
  174. ;
  175. JSR NULBUF ;NULL RECORDS
  176. JSR NULLNK
  177. JSR WRTOUT
  178. JSR WATJOB
  179. JSR MAPOUT
  180. JMP OROW
  181. ;
  182. ;*
  183. ;*
  184. ;***********************
  185. ;*
  186. ;* PUTSS
  187. ;*
  188. ;* PUT BYTE INTO SIDE SECTOR
  189. ;*
  190. ;***********************
  191. ;*
  192. ;*
  193. PUTSS PHA
  194. LDX LINDX
  195. LDA SS,X
  196. JMP PUTB1
  197. ;
  198. .END