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 3.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  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
  179. JSR DBLBUF