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.

addrel.src 4.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. .page 'addrel'
  2. ;*********************************
  3. ;* addrel: add blocks to relative*
  4. ;* file. *
  5. ;* vars: *
  6. ;* regs: *
  7. ;* *
  8. ;*********************************
  9. ;
  10. addrel
  11. jsr setdrn
  12. jsr ssend ; set up end of file
  13. jsr posbuf
  14. jsr dbset
  15. lda ssind
  16. sta r1 ; save ss index
  17. lda ssnum
  18. sta r0 ; save ss number
  19. lda #0
  20. sta r2 ; clear flag for one block
  21. ;
  22. lda #0 ; clear for calculation...
  23. sta recptr ; ...to 1st byte in record
  24. jsr fndrel ; calc ss ptrs
  25. addr1 ; entry for rel record fix
  26. jsr numfre ; calc available...
  27. ;
  28. ldy lindx ; record span?
  29. ldx rs,y
  30. dex
  31. txa
  32. clc
  33. adc relptr
  34. bcc ar10 ; no span
  35. ;
  36. inc ssind ; inc ss ptrs & check
  37. inc ssind ; inc ss ptrs & check
  38. bne ar10
  39. inc ssnum
  40. lda #ssioff
  41. sta ssind
  42. ar10
  43. lda r1
  44. clc
  45. adc #2
  46. jsr setssp
  47. ;
  48. lda ssnum
  49. cmp #nssl
  50. bcc ar25 ; valid range
  51. ;
  52. ar20
  53. lda #bigfil
  54. jsr cmderr ; too many ss's
  55. ar25
  56. lda ssind ; calc # blocks needed...
  57. sec ; ...& check against avail.
  58. sbc r1
  59. bcs ar30
  60. sbc #ssioff-1
  61. clc
  62. ar30
  63. sta t3 ; # ss indices
  64. lda ssnum
  65. sbc r0
  66. sta t4 ; # ss needed
  67. ;
  68. ldx #0 ; clear accum.
  69. stx t1
  70. stx t2
  71. tax ; .x=# ss
  72. jsr sscalc ; calc # of blocks needed
  73. ;
  74. lda t2
  75. bne ar35
  76. ldx t1
  77. dex
  78. bne ar35
  79. ;
  80. inc r2
  81. ar35
  82. cmp nbtemp+1
  83. bcc ar40 ; ok!!
  84. bne ar20
  85. lda nbtemp
  86. cmp t1
  87. bcc ar20 ; not enuf blocks
  88. ar40
  89. lda #1
  90. jsr drdbyt ; look at sector link
  91. clc
  92. adc #1 ; +1 is nr
  93. ldx lindx
  94. sta nr,x
  95. jsr nxtts ; get next block...
  96. jsr setlnk ; ...& set link.
  97. lda r2
  98. bne ar50 ; add one block
  99. ;
  100. jsr wrtout ; write current last rec
  101. ar45
  102. jsr dblbuf ; switch bufs
  103. jsr sethdr ; set hdr from t & s
  104. jsr nxtts ; get another
  105. jsr setlnk ; set up link
  106. jsr nulbuf ; clean it out
  107. jmp ar55
  108. ar50
  109. jsr dblbuf ; switch bufs
  110. jsr sethdr ; set hdr from t & s
  111. jsr nulbuf ; clean buffer
  112. jsr nullnk ; last block =0,lstchr
  113. ar55
  114. jsr wrtout ; write buffer
  115. jsr getlnk ; get t&s from link
  116. lda track
  117. pha ; save 'em
  118. lda sector
  119. pha
  120. jsr gethdr ; now get hdr t&s
  121. lda sector
  122. pha ; save 'em
  123. lda track
  124. pha
  125. jsr gsspnt ; check ss ptr
  126. tax
  127. bne ar60
  128. ;
  129. jsr newss ; need another ss
  130. lda #ssioff
  131. jsr setssp ; .a=bt val
  132. inc r0 ; advance ss count
  133. ar60
  134. pla
  135. jsr putss ; record t&s...
  136. pla
  137. jsr putss ; ...in ss.
  138. pla ; get t&s from link
  139. sta sector
  140. pla
  141. sta track
  142. beq ar65 ; t=0: that's all!!
  143. ;
  144. lda r0
  145. cmp ssnum
  146. bne ar45 ; not even done yet
  147. ;
  148. jsr gsspnt
  149. cmp ssind
  150. bcc ar45 ; almost done
  151. beq ar50 ; one more block left
  152. ar65
  153. jsr gsspnt
  154. pha
  155. lda #0
  156. jsr ssdir
  157. lda #0
  158. tay
  159. sta (dirbuf),y
  160. iny
  161. pla
  162. sec
  163. sbc #1
  164. sta (dirbuf),y
  165. jsr wrtss ; write ss
  166. jsr watjob
  167. jsr mapout
  168. jsr fndrel
  169. jsr dblbuf ; get back to leading buffer
  170. jsr sspos
  171. bvs ar70
  172. jmp positn
  173. ar70
  174. lda #lrf
  175. jsr setflg
  176. lda #norec
  177. jsr cmderr
  178. ; .end