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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. .PAGE 'ADDREL'
  2. ADDREL
  3. JSR ADRELS
  4. JSR FNDREL ; CALC SS PTRS
  5. ADDR1
  6. JSR NUMFRE ; CALC AVAILABLE...
  7. LDY LINDX ; RECORD SPAN?
  8. LDX RS,Y
  9. DEX
  10. TXA
  11. CLC
  12. ADC RELPTR
  13. BCC AR10 ; NO SPAN
  14. INC SSIND ; INC SS PTRS & CHECK
  15. INC SSIND
  16. BNE AR10
  17. INC SSNUM
  18. LDA #SSIOFF
  19. STA SSIND
  20. AR10
  21. LDA R1
  22. CLC
  23. ADC #2
  24. JSR SETSSP
  25. LDA SSNUM
  26. CMP #NSSL
  27. BCC AR25 ; VALID RANGE
  28. LDA #0
  29. STA SSNUM
  30. INC GRPNUM
  31. BNE AR25 ; JUMP
  32. AR20
  33. LDA #BIGFIL
  34. JSR CMDERR ; TOO MANY SS'S
  35. AR25
  36. LDA SSIND ; CALC # BLOCKS NEEDED...
  37. SEC ; ...& CHECK AGAINST AVAIL.
  38. SBC R1
  39. BCS AR30
  40. SBC #SSIOFF-1
  41. CLC
  42. AR30
  43. STA T3
  44. LDA SSNUM
  45. SBC R0
  46. BCS ADDBI1
  47. INC R3
  48. ADC #6
  49. ADDBI1
  50. STA T4
  51. LDA GRPNUM
  52. SEC
  53. SBC R3
  54. STA R3
  55. JSR SSSCAL
  56. LDA RESULT+1
  57. BNE AR35
  58. LDX RESULT
  59. BNE ADDBI2
  60. RTS
  61. ADDBI2
  62. DEX
  63. BNE AR35
  64. AR34
  65. INC R2
  66. AR35
  67. CMP NBTEMP+1
  68. BCC AR40 ; OK!!
  69. BNE AR20
  70. LDA NBTEMP
  71. CMP T1
  72. BCC AR20 ; NOT ENOUGH BLOCKS
  73. AR40
  74. LDA #1
  75. JSR DRDBYT ; LOOK AT SECTOR LINK
  76. CLC
  77. ADC #1 ; +1 IS NR
  78. LDX LINDX
  79. STA NR,X
  80. JSR NXTTS ; GET NEXT BLOCK...
  81. JSR SETLNK ; ...& SET LINK.
  82. LDA R2
  83. BNE AR50 ; ADD ONE BLOCK
  84. JSR WRTOUT ; WRITE CURRENT LAST REC
  85. AR45
  86. JSR DBLBUF ; SWITCH BUFS
  87. JSR SETHDR ; SET HDR FROM T & S
  88. JSR NXTTS ; GET ANOTHER
  89. JSR SETLNK ; SET UP LINK
  90. JSR NULBUF ; CLEAN IT OUT
  91. JMP AR55
  92. AR50
  93. JSR DBLBUF ; SWITCH BUFS
  94. JSR SETHDR ; SET HDR FROM T & S
  95. JSR NULBUF ; CLEAN BUFFER
  96. JSR NULLNK ; LAST BLOCK = 0, LSTCHR
  97. AR55
  98. JSR WRTOUT ; WRITE BUFFER
  99. JSR GETLNK ; GET T&S FROM LINK
  100. LDA TRACK
  101. PHA ; SAVE 'EM
  102. LDA SECTOR
  103. PHA
  104. JSR GETHDR ; NOW GET HDR T&S
  105. LDA SECTOR
  106. PHA ; SAVE 'EM
  107. LDA TRACK
  108. PHA
  109. JSR GSSPNT ; CHECK SS PTR
  110. TAX
  111. BNE AR60
  112. JSR NEWSS ; NEED ANOTHER SS
  113. LDA #SSIOFF
  114. JSR SETSSP ; .A = BT VAL
  115. INC R0 ; ADVANCE SS COUNT
  116. AR60
  117. PLA
  118. JSR PUTSS ; RECORD T&S...
  119. PLA
  120. JSR PUTSS ; ...IN SS.
  121. PLA ; GET T&S FROM LINK
  122. STA SECTOR
  123. PLA
  124. STA TRACK
  125. BEQ AR65 ; T = 0, THAT'S ALL!!
  126. LDA R5
  127. CMP GRPNUM
  128. BCC AR45
  129. AR61
  130. LDA R0
  131. CMP SSNUM
  132. BNE AR45 ; NOT DONE YET
  133. JSR GSSPNT
  134. CMP SSIND
  135. BCC AR45 ; ALMOST DONE
  136. BCS AR50 ; ONE MORE BLOCK LEFT
  137. AR65
  138. JSR GSSPNT
  139. PHA
  140. LDA #0
  141. JSR SSDIR
  142. LDA #0
  143. TAY
  144. STA (DIRBUF),Y
  145. INY
  146. PLA
  147. SEC
  148. SBC #1
  149. STA (DIRBUF),Y
  150. JSR WRTSS ; WRITE SS
  151. JSR WATJOB
  152. JSR MAPOUT
  153. JSR FNDREL
  154. JSR DBLBUF ; GET BACK TO LEADING BUFFER
  155. JSR SSPOS
  156. BVS AR70
  157. JMP POSITN
  158. AR70
  159. LDA #LRF
  160. JSR SETFLG
  161. LDA #NOREC
  162. JSR CMDERR
  163. ADRELS
  164. JSR SETDRN
  165. JSR SSEND ; SET UP END OF FILE
  166. JSR POSBUF
  167. LDA GRPNUM
  168. STA R5
  169. STA R3
  170. ADREL1
  171. LDA SSIND
  172. STA R1 ; SAVE SS INDEX
  173. LDA SSNUM
  174. STA R0 ; SAVE SS NUMBER
  175. LDA #0
  176. STA R2 ; CLEAR FLAG FOR ONE BLOCK
  177. STA RECPTR ; TO 1ST BYTE IN RECORD
  178. RTS
  179. .END