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.

192 lines
2.9KB

  1. .PAGE 'SSUTIL'
  2. ;*********************************
  3. ;* B0TOB0: TRANSFER BYTES FROM *
  4. ;* ONE BUF TO OTHER. *
  5. ;* REG: IN: .A= # BYTES *
  6. ;* .Y= SOURCE BUF # *
  7. ;* .X= DESTIN BUF # *
  8. ;*********************************
  9. ;
  10. B0TOB0
  11. PHA
  12. LDA #0
  13. STA TEMP
  14. STA TEMP+2
  15. LDA BUFIND,Y
  16. STA TEMP+1
  17. LDA BUFIND,X
  18. STA TEMP+3
  19. PLA
  20. TAY
  21. DEY
  22. B02
  23. LDA (TEMP)Y
  24. STA (TEMP+2)Y
  25. DEY
  26. BPL B02
  27. RTS
  28. ;
  29. ;*********************************
  30. ;* CLRBUF: CLEAR BUFFER GIVEN *
  31. ;* REG: IN: .A= BUFFER # *
  32. ;* OUT: .Y,.A =0 *
  33. ;*********************************
  34. ;
  35. CLRBUF
  36. TAY
  37. LDA BUFIND,Y
  38. STA TEMP+1
  39. LDA #0
  40. STA TEMP
  41. TAY
  42. CB10
  43. STA (TEMP),Y
  44. INY
  45. BNE CB10
  46. RTS
  47. ;
  48. ;
  49. ;*********************************
  50. ;* SSSET: SET SS PNTR TO 0 *
  51. ;* REG: OUT: .A= SS NUMBER *
  52. ;*********************************
  53. ;
  54. SSSET
  55. LDA #0
  56. JSR SSDIR
  57. LDY #2
  58. LDA (DIRBUF)Y
  59. RTS
  60. ;
  61. ;*********************************
  62. ;* SSDIR: SET DIRBUF WITH CURRENT*
  63. ;* SS POINTER. *
  64. ;* REGS: IN: .A= LOW BYTE *
  65. ;*********************************
  66. ;
  67. SSDIR
  68. STA DIRBUF
  69. LDX LINDX
  70. LDA SS,X
  71. TAX
  72. LDA BUFIND,X
  73. STA DIRBUF+1
  74. RTS
  75. ;
  76. ;*********************************
  77. ;* SETSSP: SET DIRBUF & BUFTAB *
  78. ;* WITH CURRENT SS PTR. *
  79. ;* REGS: IN: .A= LOW BYTE *
  80. ;*********************************
  81. ;
  82. SETSSP
  83. PHA
  84. JSR SSDIR
  85. PHA
  86. TXA
  87. ASL A
  88. TAX
  89. PLA
  90. STA BUFTAB+1,X
  91. PLA
  92. STA BUFTAB,X
  93. RTS
  94. ;
  95. ;*********************************
  96. ;* SSPOS: POSITION SS & BUFTAB *
  97. ;* TO SSNUM SSIND. *
  98. ;* FLAG: .V=0: OK *
  99. ;* .V=1: OUT OF RANGE *
  100. ;*********************************
  101. ;
  102. SSPOS
  103. JSR SSTEST
  104. BMI SSP10 ;OUT OF RANGE
  105. BVC SSP20 ;ER0:OK, IN RANGE
  106. ;
  107. LDX LINDX ;ER1: POSSIBLY IN RANGE
  108. LDA SS,X
  109. JSR IBRD ;READ SS IN
  110. JSR SSTEST ;TEST AGAIN
  111. BPL SSP20
  112. SSP10
  113. JSR SSEND ;NOT IN RANGE,SET END
  114. BIT ER1
  115. RTS
  116. SSP20
  117. LDA SSIND ;OK, SET PTR W/ INDEX
  118. JSR SETSSP
  119. BIT ER0
  120. RTS
  121. ;
  122. ;*********************************
  123. ;* IBRD: INDIRECT BLOCK READ & *
  124. ;* IBWT: WRITE. *
  125. ;* REGS: IN: .A= BUF # FOR R/W *
  126. ;* .X= LINDX *
  127. ;* (DIRBUF)Y POINTS TO *
  128. ;* T&S TO BE R/W. *
  129. ;*********************************
  130. ;
  131. IBRD
  132. STA JOBNUM
  133. LDA #READ
  134. BNE IBOP
  135. IBWT
  136. STA JOBNUM
  137. LDA #WRITE
  138. IBOP
  139. PHA
  140. LDA FILTYP,X
  141. AND #1
  142. STA DRVNUM
  143. PLA
  144. ORA DRVNUM
  145. STA CMD
  146. ;
  147. LDA (DIRBUF)Y
  148. STA TRACK
  149. INY
  150. LDA (DIRBUF)Y
  151. STA SECTOR
  152. LDA JOBNUM
  153. JSR SETH
  154. LDX JOBNUM
  155. JMP DOIT2
  156. ;
  157. ;
  158. ;*
  159. ;*****************************
  160. ;*
  161. ;* GSSPNT
  162. ;*
  163. ;*****************************
  164. ;*
  165. GSSPNT LDX LINDX
  166. LDA SS,X
  167. JMP GP1
  168. ;
  169. SCAL1
  170. LDA #NSSP
  171. JSR ADDT12 ;ADD (#SS NEEDED)*120
  172. SSCALC
  173. DEX
  174. BPL SCAL1
  175. ;
  176. LDA T3 ;ADD (# SS INDICES NEEDED)
  177. LSR A
  178. JSR ADDT12
  179. LDA T4 ;ADD (# SS BLOCKS NEEDED)
  180. ; JMP ADDT12
  181. ;
  182. ADDT12
  183. CLC ;ADD .A TO T1,T2
  184. ADC T1
  185. STA T1
  186. BCC ADDRTS
  187. INC T2
  188. ADDRTS
  189. RTS
  190. ;
  191. .END