您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  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