Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. .PAG 'TAPE WRITE'
  2. ; CASSETTE INFO - FSBLK IS BLOCK COUNTER FOR RECORD
  3. ; FSBLK = 2 -FIRST HEADER
  4. ; = 1 -FIRST DATA
  5. ; = 0 -SECOND DATA
  6. ;
  7. ; WRITE - TOGGLE WRITE BIT ACCORDING TO LSB IN OCHAR
  8. ;
  9. WRITE LDA OCHAR ;SHIFT BIT TO WRITE INTO CARRY
  10. LSR A
  11. LDA #96 ;...C CLR WRITE SHORT
  12. BCC WRT1
  13. WRTW LDA #176 ;...C SET WRITE LONG
  14. WRT1 LDX #0 ;SET AND STORE TIME
  15. WRTX STA D1T2L
  16. STX D1T2H
  17. LDA D1ICR ;CLEAR IRQ
  18. LDA #$19 ;ENABLE TIMER (ONE-SHOT)
  19. STA D1CRB
  20. LDA R6510 ;TOGGLE WRITE BIT
  21. EOR #$08
  22. STA R6510
  23. AND #$08 ;LEAVE ONLY WRITE BIT
  24. RTS
  25. ;
  26. WRTL3 SEC ;FLAG PRP FOR END OF BLOCK
  27. ROR PRP
  28. BMI WRT3 ; JMP
  29. ;
  30. ; WRTN - CALLED AT THE END OF EACH BYTE
  31. ; TO WRITE A LONG RER REZ
  32. ; HHHHHHLLLLLLHHHLLL...
  33. ;
  34. WRTN LDA RER ;CHECK FOR ONE LONG
  35. BNE WRTN1
  36. LDA #16 ;WRITE A LONG BIT
  37. LDX #1
  38. JSR WRTX
  39. BNE WRT3
  40. INC RER
  41. LDA PRP ;IF END OF BLOCK(BIT SET BY WRTL3)...
  42. BPL WRT3 ;...NO END CONTINUE
  43. JMP WRNC ;...END ...FINISH OFF
  44. ;
  45. WRTN1 LDA REZ ;CHECK FOR A ONE BIT
  46. BNE WRTN2
  47. JSR WRTW
  48. BNE WRT3
  49. INC REZ
  50. BNE WRT3
  51. ;
  52. WRTN2 JSR WRITE
  53. BNE WRT3 ;ON BIT LOW EXIT
  54. LDA FIRT ;CHECK FOR FIRST OF DIPOLE
  55. EOR #1
  56. STA FIRT
  57. BEQ WRT2 ;DIPOLE DONE
  58. LDA OCHAR ;FLIPS BIT FOR COMPLEMENTARY RIGHT
  59. EOR #1
  60. STA OCHAR
  61. AND #1 ;TOGGLE PARITY
  62. EOR PRTY
  63. STA PRTY
  64. WRT3 JMP PREND ;RESTORE REGS AND RTI EXIT
  65. ;
  66. WRT2 LSR OCHAR ;MOVE TO NEXT BIT
  67. DEC PCNTR ;DEC COUNTER FOR # OF BITS
  68. LDA PCNTR ;CHECK FOR 8 BITS SENT...
  69. BEQ WRT4 ;...IF YES MOVE IN PARITY
  70. BPL WRT3 ;...ELSE SEND REST
  71. ;
  72. WRTS JSR NEWCH ;CLEAN UP COUNTERS
  73. CLI ;ALLOW FOR INTERRUPTS TO NEST
  74. LDA CNTDN ;ARE WE WRITING HEADER COUNTERS?...
  75. BEQ WRT6 ;...NO
  76. ; WRITE HEADER COUNTERS (9876543210 TO HELP WITH READ)
  77. LDX #0 ;CLEAR BCC
  78. STX DATA
  79. WRTS1 DEC CNTDN
  80. LDX FSBLK ;CHECK FOR FIRST BLOCK HEADER
  81. CPX #2
  82. BNE WRT61 ;...NO
  83. ORA #$80 ;...YES MARK FIRST BLOCK HEADER
  84. WRT61 STA OCHAR ;WRITE CHARACTERS IN HEADER
  85. BNE WRT3
  86. ;
  87. WRT6 JSR CMPSTE ;COMPARE START:END
  88. BCC WRT7 ;NOT DONE
  89. BNE WRTL3 ;GO MARK END
  90. INC SAH
  91. LDA DATA ;WRITE OUT BCC
  92. STA OCHAR
  93. BCS WRT3 ;JMP
  94. ;
  95. WRT7 LDY #0 ;GET NEXT CHARACTER
  96. LDA (SAL)Y
  97. STA OCHAR ;STORE IN OUTPUT CHARACTER
  98. EOR DATA ;UPDATE BCC
  99. STA DATA
  100. JSR INCSAL ;INCREMENT FETCH ADDRESS
  101. BNE WRT3 ;BRANCH ALWAYS
  102. ;
  103. WRT4 LDA PRTY ;MOVE PARITY INTO OCHAR...
  104. EOR #1
  105. STA OCHAR ;...TO BE WRITTEN AS NEXT BIT
  106. WRTBK JMP PREND ;RESTORE REGS AND RTI EXIT
  107. ;
  108. WRNC DEC FSBLK ;CHECK FOR END
  109. BNE WREND ;...BLOCK ONLY
  110. JSR TNOF ;...WRITE, SO TURN OFF MOTOR
  111. WREND LDA #80 ;PUT 80 CASSETTE SYNCS AT END
  112. STA SHCNL
  113. LDX #8
  114. SEI
  115. JSR BSIV ;SET VECTOR TO WRITE ZEROS
  116. BNE WRTBK ;JMP
  117. ;
  118. WRTZ LDA #120 ;WRITE LEADING ZEROS FOR SYNC
  119. JSR WRT1
  120. BNE WRTBK
  121. DEC SHCNL ;CHECK IF DONE WITH LOW SYNC...
  122. BNE WRTBK ;...NO
  123. JSR NEWCH ;...YES CLEAR UP COUNTERS
  124. DEC SHCNH ;CHECK IF DONE WITH SYNC...
  125. BPL WRTBK ;...NO
  126. LDX #10 ;...YES SO SET VECTOR FOR DATA
  127. JSR BSIV
  128. CLI
  129. INC SHCNH ;ZERO SHCNH
  130. LDA FSBLK ;IF DONE THEN...
  131. BEQ STKY ;...GOTO SYSTEM RESTORE
  132. JSR RD300
  133. LDX #9 ;SET UP FOR HEADER COUNT
  134. STX CNTDN
  135. STX PRP ;CLEAR ENDOF BLOCK FLAG
  136. BNE WRTS ;JMP
  137. ;
  138. TNIF PHP ;CLEAN UP INTERRUPTS AND RESTORE PIA'S
  139. SEI
  140. LDA VICREG+17 ;UNLOCK VIC
  141. ORA #$10 ;ENABLE DISPLAY
  142. STA VICREG+17
  143. JSR TNOF ;TURN OFF MOTOR
  144. LDA #$7F ;CLEAR INTERRUPTS
  145. STA D1ICR
  146. JSR IOKEYS ;RESTORE KEYBOARD IRQ FROM TIMMER1
  147. LDA IRQTMP+1 ;RESTORE KEYBOARD INTERRUPT VECTOR
  148. BEQ TNIQ ;NO IRQ (IRQ VECTOR CANNOT BE Z-PAGE)
  149. STA CINV+1
  150. LDA IRQTMP
  151. STA CINV
  152. TNIQ PLP
  153. RTS
  154. ;
  155. STKY JSR TNIF ;GO RESTORE SYSTEM INTERRUPTS
  156. BEQ WRTBK ;CAME FOR CASSETTE IRQ SO RTI
  157. ;
  158. ; BSIV - SUBROUTINE TO CHANGE IRQ VECTORS
  159. ; ENTRYS - .X = 8 WRITE ZEROS TO TAPE
  160. ; .X = 10 WRITE DATA TO TAPE
  161. ; .X = 12 RESTORE TO KEYSCAN
  162. ; .X = 14 READ DATA FROM TAPE
  163. ;
  164. BSIV LDA BSIT-8,X ;MOVE IRQ VECTORS, TABLE TO INDIRECT
  165. STA CINV
  166. LDA BSIT+1-8,X
  167. STA CINV+1
  168. RTS
  169. ;
  170. TNOF LDA R6510 ;TURN OFF CASSETTE MOTOR
  171. ORA #$20 ;
  172. STA R6510
  173. RTS
  174. .SKI 3
  175. ;COMPARE START AND END LOAD/SAVE
  176. ;ADDRESSES. SUBROUTINE CALLED BY
  177. ;TAPE READ, SAVE, TAPE WRITE
  178. ;
  179. CMPSTE SEC
  180. LDA SAL
  181. SBC EAL
  182. LDA SAH
  183. SBC EAH
  184. RTS
  185. .SKI 3
  186. ;INCREMENT ADDRESS POINTER SAL
  187. ;
  188. INCSAL INC SAL
  189. BNE INCR
  190. INC SAH
  191. INCR RTS
  192. .END
  193. ; RSR 7/28/80 ADD COMMENTS
  194. ; RSR 8/4/80 CHANGED I/O FOR VIXEN
  195. ; RSR 8/21/80 CHANGED I/O FOR VIXEN MOD
  196. ; RSR 8/25/80 CHANGED I/O FOR VIXEN MOD2
  197. ; RSR 12/11/81 MODIFY I/O FOR VIC-40
  198. ; RSR 2/9/82 ADD VIC TURN ON, REPLACE SAH WITH PRP