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.

record 2.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. .PAGE 'RECORD'
  2. ;*********************************
  3. ;* RECORD: POSITION RELATIVE *
  4. ;* POINTERS TO GIVEN *
  5. ;* RECORD NUMBER OR TO *
  6. ;* LAST RECORD IF OUT OF *
  7. ;* RANGE. *
  8. ;*********************************
  9. ;
  10. RECORD
  11. JSR CMDSET ;INIT TABLES, PTRS
  12. LDA CMDBUF+1
  13. STA SA
  14. JSR FNDRCH
  15. BCC R20 ;GOT CHANNEL'S LINDEX
  16. ;
  17. LDA #NOCHNL ;NO VALID CHANNEL
  18. JSR CMDERR
  19. R20
  20. LDA #LRF+OVRFLO
  21. JSR CLRFLG
  22. JSR TYPFIL ;GET FILE TYPE
  23. BEQ R30 ;IT IS RELATIVE FILE
  24. ;
  25. LDA #MISTYP ;WRONG TYPE
  26. JSR CMDERR
  27. R30
  28. LDA FILTYP,X
  29. AND #1
  30. STA DRVNUM
  31. LDA CMDBUF+2
  32. STA RECL,X ;GET RECORD #
  33. LDA CMDBUF+3
  34. STA RECH,X
  35. LDX LINDX ;CLEAR CHNRDY TO RNDRDY
  36. LDA #RNDRDY
  37. STA CHNRDY,X
  38. ;
  39. LDA CMDBUF+4 ;GET OFFSET
  40. BEQ R40
  41. SEC
  42. SBC #1
  43. BEQ R40
  44. CMP RS,X
  45. BCC R35
  46. ;
  47. LDA #RECOVF
  48. STA ERWORD
  49. LDA #0
  50. R35
  51. R40
  52. STA RECPTR ;SET OFFSET
  53. JSR FNDREL ;CALC SS STUFF
  54. JSR SSPOS ;SET SS PTRS
  55. BVC R50
  56. ;
  57. LDA #LRF ;BEYOND THE END
  58. JSR SETFLG ;SET LAST REC FLAG
  59. JMP RD05
  60. R50
  61. JSR POSITN ;POSITION TO RECORD
  62. LDA #LRF
  63. JSR TSTFLG
  64. BEQ R60
  65. JMP RD05
  66. R60
  67. JMP ENDCMD ;THAT'S ALL
  68. ;
  69. ;*********************************
  70. ;* POSITN: POSITION RELATIVE *
  71. ;* DATA BLOCK INTO ACTIVE*
  72. ;* BUFFER & NEXT BLOCK *
  73. ;* INTO INACTIVE BUFFER. *
  74. ;*********************************
  75. ;
  76. POSITN
  77. ; JSR RESTOR ;RESTORE BUFFER AREAS
  78. JSR POSBUF ;POSITION BUFFERS
  79. LDA RELPTR
  80. JSR SETPNT ;SET PTR FROM FNDREL
  81. ;
  82. LDX LINDX
  83. LDA RS,X
  84. SEC ;CALC THE OFFSET
  85. SBC RECPTR
  86. BCS P2
  87. JMP BREAK ;SHOULD NOT BE NEEDED
  88. P2
  89. CLC
  90. ADC RELPTR
  91. BCC P30
  92. ADC #1
  93. SEC
  94. P30
  95. JSR NXOUT ;SET NR
  96. JMP RD15
  97. LDA #RECOVF
  98. JSR CMDERR
  99. ;* POSBUF: POSITION PROPER DATA *
  100. ;* BLOCKS INTO BUFFERS *
  101. ;*********************************
  102. ;
  103. POSBUF
  104. LDA DIRBUF
  105. STA R3
  106. LDA DIRBUF+1
  107. STA R4
  108. JSR BHERE ;IS BUFFER IN?
  109. BNE P10 ;YES!
  110. RTS
  111. P10
  112. JSR SCRUB ;CLEAN BUFFER
  113. JSR GETLNK
  114. LDA TRACK
  115. BEQ P80
  116. JSR BHERE2
  117. BNE P75
  118. JSR DBLBUF
  119. JMP FREIAC
  120. P75
  121. JSR FREIAC
  122. ;
  123. P80
  124. LDY #0 ;GET PROPER BLOCK
  125. LDA (R3)Y
  126. STA TRACK
  127. INY
  128. LDA (R3)Y
  129. STA SECTOR
  130. JMP STRDBL ;GET NEXT BLOCK, TOO.
  131. ;RTS
  132. ;
  133. BHERE
  134. JSR GETHDR ;GET THE HEADER
  135. BHERE2
  136. LDY #0
  137. LDA (R3)Y
  138. CMP TRACK
  139. BEQ BH10 ;TEST SECTOR, TOO.
  140. RTS
  141. BH10
  142. INY
  143. LDA (R3)Y
  144. CMP SECTOR ;SET .Z
  145. RTS
  146. ;
  147. .END