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.

120 lines
1.9KB

  1. .PAG 'SAVE FUNCTION'
  2. ;***********************************
  3. ;* SAVE *
  4. ;* *
  5. ;* SAVES TO CASSETTE 1 OR 2, OR *
  6. ;* IEEE DEVICES 4>=N>=31 AS SELECT-*
  7. ;* ED BY VARIABLE FA. *
  8. ;* *
  9. ;*START OF SAVE IS INDIRECT AT .A *
  10. ;*END OF SAVE IS .X,.Y *
  11. ;***********************************
  12. .SKI 3
  13. SAVESP STX EAL
  14. STY EAH
  15. TAX ;SET UP START
  16. LDA $00,X
  17. STA STAL
  18. LDA $01,X
  19. STA STAH
  20. ;
  21. SAVE JMP (ISAVE)
  22. NSAVE LDA FA ***MONITOR ENTRY
  23. BNE SV20
  24. ;
  25. SV10 JMP ERROR9 ;BAD DEVICE #
  26. ;
  27. SV20 CMP #3
  28. BEQ SV10
  29. BCC SV100
  30. LDA #$61
  31. STA SA
  32. LDY FNLEN
  33. BNE SV25
  34. ;
  35. JMP ERROR8 ;MISSING FILE NAME
  36. ;
  37. SV25 JSR OPENI
  38. JSR SAVING
  39. LDA FA
  40. JSR LISTN
  41. LDA SA
  42. JSR SECND
  43. LDY #0
  44. JSR RD300
  45. LDA SAL
  46. JSR CIOUT
  47. LDA SAH
  48. JSR CIOUT
  49. SV30 JSR CMPSTE ;COMPARE START TO END
  50. BCS SV50 ;HAVE REACHED END
  51. LDA (SAL)Y
  52. JSR CIOUT
  53. JSR STOP
  54. BNE SV40
  55. ;
  56. BREAK JSR CLSEI
  57. LDA #0
  58. SEC
  59. RTS
  60. ;
  61. SV40 JSR INCSAL ;INCREMENT CURRENT ADDR.
  62. BNE SV30
  63. SV50 JSR UNLSN
  64. .SKI 5
  65. CLSEI BIT SA
  66. BMI CLSEI2
  67. LDA FA
  68. JSR LISTN
  69. LDA SA
  70. AND #$EF
  71. ORA #$E0
  72. JSR SECND
  73. ;
  74. CUNLSN JSR UNLSN ;ENTRY FOR OPENI
  75. ;
  76. CLSEI2 CLC
  77. RTS
  78. .SKI 5
  79. SV100 LSR A
  80. BCS SV102 ;IF C-SET THEN IT'S CASSETTE
  81. ;
  82. JMP ERROR9 ;BAD DEVICE #
  83. ;
  84. SV102 JSR ZZZ ;GET ADDR OF TAPE
  85. BCC SV10 ;BUFFER IS DEALLOCATED
  86. JSR CSTE2
  87. BCS SV115 ;STOP KEY PRESSED
  88. JSR SAVING ;TELL USER 'SAVING'
  89. SV105 LDX #PLF ;DECIDE TYPE TO SAVE
  90. LDA SA ;1-PLF 0-BLF
  91. AND #01
  92. BNE SV106
  93. LDX #BLF
  94. SV106 TXA
  95. JSR TAPEH
  96. BCS SV115 ;STOP KEY PRESSED
  97. JSR TWRT
  98. BCS SV115 ;STOP KEY PRESSED
  99. LDA SA
  100. AND #2 ;WRITE END OF TAPE?
  101. BEQ SV110 ;NO...
  102. ;
  103. LDA #EOT
  104. JSR TAPEH
  105. .BYT $24 ;SKIP 1 BYTE
  106. ;
  107. SV110 CLC
  108. SV115 RTS
  109. .SKI 3
  110. ;SUBROUTINE TO OUTPUT:
  111. ;'SAVING <FILE NAME>'
  112. ;
  113. SAVING LDA MSGFLG
  114. BPL SV115 ;NO PRINT
  115. ;
  116. LDY #MS11-MS1 ;'SAVING'
  117. JSR MSG
  118. JMP OUTFN ;<FILE NAME>
  119. .END