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.

tapecontrol 4.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. .PAG 'TAPE CONTROL'
  2. JTP20 JSR ZZZ
  3. INC BUFPT
  4. LDY BUFPT
  5. CPY #BUFSZ
  6. RTS
  7. .SKI 5
  8. ;STAYS IN ROUTINE D2T1LL PLAY SWITCH
  9. ;
  10. CSTE1 JSR CS10
  11. BEQ CS25
  12. LDY #MS7-MS1 ;"PRESS PLAY..."
  13. CS30 JSR MSG
  14. CS40 JSR TSTOP ;WATCH FOR STOP KEY
  15. JSR CS10 ;WATCH CASSETTE SWITCHES
  16. BNE CS40
  17. LDY #MS18-MS1 ;"OK"
  18. JMP MSG
  19. .SKI 5
  20. ;SUBR RETURNS <> FOR CASSETTE SWITCH
  21. ;
  22. CS10 LDA #$10 ;CHECK PORT
  23. BIT R6510 ;CLOSED?...
  24. BNE CS25 ;NO. . .
  25. BIT R6510 ;CHECK AGAIN TO DEBOUNCE
  26. CS25 CLC ;GOOD RETURN
  27. RTS
  28. .SKI 5
  29. ;CHECKS FOR PLAY & RECORD
  30. ;
  31. CSTE2 JSR CS10
  32. BEQ CS25
  33. LDY #MS8-MS1 ;"RECORD"
  34. BNE CS30
  35. .SKI 5
  36. ;READ HEADER BLOCK ENTRY
  37. ;
  38. RBLK LDA #0
  39. STA STATUS
  40. STA VERCK
  41. JSR LDAD1
  42. .SKI 3
  43. ;READ LOAD BLOCK ENTRY
  44. ;
  45. TRD JSR CSTE1 ;SAY 'PRESS PLAY'
  46. BCS TWRT3 ;STOP KEY PRESSED
  47. SEI
  48. LDA #0 ;CLEAR FLAGS...
  49. STA RDFLG
  50. STA SNSW1
  51. STA CMP0
  52. STA PTR1
  53. STA PTR2
  54. STA DPSW
  55. LDA #$90 ;ENABLE FOR CA1 IRQ...READ LINE
  56. LDX #14 ;POINT IRQ VECTOR TO READ
  57. BNE TAPE ;JMP
  58. .SKI 5
  59. ;WRITE HEADER BLOCK ENTRY
  60. ;
  61. WBLK JSR LDAD1
  62. ;
  63. ;WRITE LOAD BLOCK ENTRY
  64. ;
  65. TWRT LDA #20 ;BETWEEN BLOCK SHORTS
  66. STA SHCNH
  67. TWRT2 JSR CSTE2 ;SAY 'PRESS PLAY & RECORD'
  68. TWRT3 BCS STOP3 ;STOP KEY PRESSED
  69. SEI
  70. LDA #$82 ;ENABLE T2 IRQS...WRITE TIME
  71. LDX #8 ;VECTOR IRQ TO WRTZ
  72. .SKI 5
  73. ;START TAPE OPERATION ENTRY POINT
  74. ;
  75. TAPE LDY #$7F ;KILL UNWANTED IRQ'S
  76. STY D1ICR
  77. STA D1ICR ;TURN ON WANTED
  78. LDA D1CRA ;CALC TIMER ENABLES
  79. ORA #$19
  80. STA D1CRB ;TURN ON T2 IRQ'S FOR CASS WRITE(ONE SHOT)
  81. AND #$91 ;SAVE TOD 50/60 INDICATION
  82. STA CASTON ;PLACE IN AUTO MODE FOR T1
  83. ; WAIT FOR RS-232 TO FINISH
  84. JSR RSP232
  85. ; DISABLE SCREEN DISPLAY
  86. LDA VICREG+17
  87. AND #$FF-$10 ;DISABLE SCREEN
  88. STA VICREG+17
  89. ; MOVE IRQ TO IRQTEMP FOR CASS OPS
  90. LDA CINV
  91. STA IRQTMP
  92. LDA CINV+1
  93. STA IRQTMP+1
  94. JSR BSIV ;GO CHANGE IRQ VECTOR
  95. LDA #2 ;FSBLK STARTS AT 2
  96. STA FSBLK
  97. JSR NEWCH ;PREP LOCAL COUNTERS AND FLAGS
  98. LDA R6510 ;TURN MOTOR ON
  99. AND #%011111 ;LOW TURNS ON
  100. STA R6510
  101. STA CAS1 ;FLAG INTERNAL CONTROL OF CASS MOTOR
  102. LDX #$FF ;DELAY BETWEEN BLOCKS
  103. TP32 LDY #$FF
  104. TP35 DEY
  105. BNE TP35
  106. DEX
  107. BNE TP32
  108. CLI
  109. TP40 LDA IRQTMP+1 ;CHECK FOR INTERRUPT VECTOR...
  110. CMP CINV+1 ;...POINTING AT KEY ROUTINE
  111. CLC
  112. BEQ STOP3 ;...YES RETURN
  113. JSR TSTOP ;...NO CHECK FOR STOP KEY
  114. ;
  115. ; 60 HZ KEYSCAN IGNORED
  116. ;
  117. JSR UD60 ; STOP KEY CHECK
  118. JMP TP40 ;STAY IN LOOP UNTILL TAPES ARE DONE
  119. .SKI 5
  120. TSTOP JSR STOP ;STOP KEY DOWN?
  121. CLC ;ASSUME NO STOP
  122. BNE STOP4 ;WE WERE RIGHT
  123. ;
  124. ;STOP KEY DOWN...
  125. ;
  126. JSR TNIF ;TURN OFF CASSETTES
  127. SEC ;FAILURE FLAG
  128. PLA ;BACK ONE SQUARE...
  129. PLA
  130. ;
  131. ; LDA #0 ;STOP KEY FLAG
  132. ;
  133. STOP3 LDA #0 ;DEALLOCATE IRQTMP
  134. STA IRQTMP+1 ;IF C-SET THEN STOP KEY
  135. STOP4 RTS
  136. .SKI 5
  137. ;
  138. ; STT1 - SET UP TIMEOUT WATCH FOR NEXT DIPOLE
  139. ;
  140. STT1 STX TEMP ;.X HAS CONSTANT FOR TIMEOUT
  141. LDA CMP0 ;CMP0*5
  142. ASL A
  143. ASL A
  144. CLC
  145. ADC CMP0
  146. CLC
  147. ADC TEMP ;ADJUST LONG BYTE COUNT
  148. STA TEMP
  149. LDA #0
  150. BIT CMP0 ;CHECK CMP0 ...
  151. BMI STT2 ;...MINUS, NO ADJUST
  152. ROL A ;...PLUS SO ADJUST POS
  153. STT2 ASL TEMP ;MULTIPLY CORRECTED VALUE BY 4
  154. ROL A
  155. ASL TEMP
  156. ROL A
  157. TAX
  158. STT3 LDA D1T2L ;WATCH OUT FOR D1T2H ROLLOVER...
  159. CMP #22 ;...TIME FOR ROUTINE...!!!...
  160. BCC STT3 ;...TOO CLOSE SO WAIT UNTILL PAST
  161. ADC TEMP ;CALCULATE AND...
  162. STA D1T1L ;...STORE ADUSTED TIME COUNT
  163. TXA
  164. ADC D1T2H ;ADJUST FOR HIGH TIME COUNT
  165. STA D1T1H
  166. LDA CASTON ;ENABLE TIMERS
  167. STA D1CRA
  168. STA STUPID ;NON-ZERO MEANS AN T1 IRQ HAS NOT OCCURED YET
  169. LDA D1ICR ;CLEAR OLD T1 INTERRUPT
  170. AND #$10 ;CHECK FOR OLD-FLAG IRQ
  171. BEQ STT4 ;NO...NORMAL EXIT
  172. LDA #>STT4 ;PUSH SIMULATED RETURN ADDRESS ON STACK
  173. PHA
  174. LDA #<STT4
  175. PHA
  176. JMP SIMIRQ
  177. STT4 CLI ;ALLOW FOR RE-ENTRY CODE
  178. RTS
  179. .END
  180. ; RSR 8/25/80 MODIFY I/O FOR MOD2 HARDWARE
  181. ; RSR 12/11/81 MODIFY I/O FOR VIC-40
  182. ; RSR 2/9/82 ADD SCREEN DISABLE FOR TAPE
  183. ; RSR 3/28/82 ADD T2IRQ TO START CASSETTE WRITE
  184. ; RSR 3/28/82 ADD CASSETTE READ TIMER1 FLAG
  185. ; RSR 5/11/82 CHANGE SO WE DON'T MISS ANY IRQ'S
  186. ; RSR 5/14/82 SIMULATE AN IRQ