mirror of
https://github.com/nathanriggs/AppleIIAsm-Collection.git
synced 2025-01-07 15:29:29 +00:00
FINISHED 0.3.0 updates
- added rudimentary error detection to some fileio routines - separated fileio lib into individual routine files - changed txtmode to amode - added automatic applesoft mode to binsave,binload - a couple minor bugfixes / tweaks
This commit is contained in:
parent
e0c1f8e82d
commit
3af3d14153
BIN
bin/d10_minidisk_A.dsk
Normal file
BIN
bin/d10_minidisk_A.dsk
Normal file
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
30
disks/disk6_fileio/MINIFY
Normal file
30
disks/disk6_fileio/MINIFY
Normal file
@ -0,0 +1,30 @@
|
||||
5 HOME
|
||||
8 ONERR GOTO 1000
|
||||
10 PRINT "ASSEMBLY CODE MINIFIER"
|
||||
20 PRINT "-=-=-=-=-=-=-=-=-=-=-="
|
||||
30 PRINT
|
||||
35 DIM FC$(1000):C = 0
|
||||
40 INPUT "ENTER THE SOURCE FILE NAME: ";FF$
|
||||
50 INPUT "ENTER THE DESTINATION FILE NAME: ";DD$
|
||||
55 PRINT "WORKING.."
|
||||
60 PRINT CHR$ (4);"OPEN ";FF$
|
||||
70 PRINT CHR$ (4);"READ ";FF$
|
||||
80 GET AA$
|
||||
85 REM ? CHR$ (34);".";
|
||||
90 IF AA$ = CHR$ (13) THEN GOTO 200
|
||||
95 S$ = S$ + AA$
|
||||
110 GOTO 80
|
||||
200 IF LEFT$ (S$,1) = "*" OR LEFT$ (S$,1) = ";" THEN S$ = ""
|
||||
500 FC$(C) = S$
|
||||
510 S$ = ""
|
||||
520 C = C + 1
|
||||
990 GOTO 80
|
||||
1000 PRINT : PRINT CHR$ (4);"CLOSE ";FF$
|
||||
1010 PRINT CHR$ (4);"OPEN ";DD$
|
||||
1020 PRINT CHR$ (4);"WRITE ";DD$
|
||||
1030 FOR Z = 0 TO C
|
||||
1040 IF FC$(Z) < > "" THEN PRINT FC$(Z)
|
||||
1050 NEXT Z
|
||||
1060 PRINT CHR$ (4);"CLOSE ";DD$
|
||||
1070 PRINT "DONE!": PRINT : PRINT : PRINT
|
||||
1080 PRINT CHR$ (7): PRINT CHR$ (7): PRINT CHR$ (7)
|
@ -1,46 +0,0 @@
|
||||
*
|
||||
BINLOAD
|
||||
*
|
||||
PLA
|
||||
STA RETADR
|
||||
PLA
|
||||
STA RETADR+1
|
||||
PLA
|
||||
STA ADDR2
|
||||
PLA
|
||||
STA ADDR2+1
|
||||
LDA #$8D
|
||||
JSR FCOUT
|
||||
LDA #$84
|
||||
JSR FCOUT
|
||||
LDA #$C2
|
||||
JSR FCOUT
|
||||
LDA #$CC
|
||||
JSR FCOUT
|
||||
LDA #$CF
|
||||
JSR FCOUT
|
||||
LDA #$C1
|
||||
JSR FCOUT
|
||||
LDA #$C4
|
||||
JSR FCOUT
|
||||
LDA #$A0
|
||||
JSR FCOUT
|
||||
LDY #0
|
||||
LDA (ADDR2),Y
|
||||
STA :SLEN
|
||||
LDY #1
|
||||
:LP
|
||||
LDA (ADDR2),Y
|
||||
JSR FCOUT
|
||||
INY
|
||||
CPY :SLEN
|
||||
BCC :LP
|
||||
BEQ :LP
|
||||
LDA #$8D
|
||||
JSR FCOUT
|
||||
LDA RETADR+1
|
||||
PHA
|
||||
LDA RETADR
|
||||
PHA
|
||||
RTS
|
||||
:SLEN DS 1
|
@ -1,4 +1,3 @@
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* BINLOAD :: BINARY LOAD *
|
||||
*- -*
|
||||
@ -57,6 +56,50 @@ BINLOAD
|
||||
STA ADDR2 ; CMD STRING ADDR
|
||||
PLA
|
||||
STA ADDR2+1
|
||||
*
|
||||
** FIRST, TELL DOS TO GO INTO APPLESOFT MODE
|
||||
*
|
||||
LDA #1
|
||||
STA $AAB6 ; DOS LANG FLAG
|
||||
STA $75+1 ; NOT IN DIRECT MODE
|
||||
STA $33 ; NOT IN DIRECT MODE
|
||||
*
|
||||
********************************
|
||||
*
|
||||
* ERROR CONTROL
|
||||
*
|
||||
********************************
|
||||
*
|
||||
LDA ERRCTRL
|
||||
CMP #1
|
||||
BEQ :CHKERR0
|
||||
JMP :ERREND
|
||||
:CHKERR0
|
||||
*
|
||||
** NOW TURN ON ONERR
|
||||
*
|
||||
LDA #$FF ; TURN ON LOCAL ERR HANDLING
|
||||
STA $D8
|
||||
*
|
||||
** NOW SET ONERR ADDR TO :CHKERR ROUTINE
|
||||
*
|
||||
LDA #<:CHKERR
|
||||
STA $9D5A ; DOS ERROR HANDLING ADDR
|
||||
LDA #>:CHKERR
|
||||
STA $9D5B
|
||||
JMP :ERREND
|
||||
:CHKERR
|
||||
LDY #0
|
||||
STY $D8 ; RESUME NORMAL ERR CTRL
|
||||
_ERR :E_SID;:E_MSG;:E_DUMP;ADDR2;#2
|
||||
BRK
|
||||
*
|
||||
********************************
|
||||
*
|
||||
:ERREND
|
||||
*
|
||||
********************************
|
||||
*
|
||||
*
|
||||
LDA #$8D
|
||||
JSR FCOUT
|
||||
@ -107,3 +150,7 @@ BINLOAD
|
||||
*
|
||||
:SLEN DS 1
|
||||
*
|
||||
:E_SID ASC "BINLOAD (BLOAD MACRO)",00
|
||||
:E_DUMP ASC "DUMPING STRING ADDRESS...",00
|
||||
:E_MSG ASC "INPUT/OUTPUT ERROR!!!",00
|
||||
*
|
69
disks/disk6_fileio/T.BINLOAD.SUB.MIN
Normal file
69
disks/disk6_fileio/T.BINLOAD.SUB.MIN
Normal file
@ -0,0 +1,69 @@
|
||||
BINLOAD
|
||||
PLA
|
||||
STA RETADR
|
||||
PLA
|
||||
STA RETADR+1
|
||||
PLA
|
||||
STA ADDR2 ; CMD STRING ADDR
|
||||
PLA
|
||||
STA ADDR2+1
|
||||
LDA #1
|
||||
STA $AAB6 ; DOS LANG FLAG
|
||||
STA $75+1 ; NOT IN DIRECT MODE
|
||||
STA $33 ; NOT IN DIRECT MODE
|
||||
LDA ERRCTRL
|
||||
CMP #1
|
||||
BEQ :CHKERR0
|
||||
JMP :ERREND
|
||||
:CHKERR0
|
||||
LDA #$FF ; TURN ON LOCAL ERR HANDLING
|
||||
STA $D8
|
||||
LDA #<:CHKERR
|
||||
STA $9D5A ; DOS ERROR HANDLING ADDR
|
||||
LDA #>:CHKERR
|
||||
STA $9D5B
|
||||
JMP :ERREND
|
||||
:CHKERR
|
||||
LDY #0
|
||||
STY $D8 ; RESUME NORMAL ERR CTRL
|
||||
_ERR :E_SID;:E_MSG;:E_DUMP;ADDR2;#2
|
||||
BRK
|
||||
:ERREND
|
||||
LDA #$8D
|
||||
JSR FCOUT
|
||||
LDA #$84 ; CTRL-D
|
||||
JSR FCOUT
|
||||
LDA #$C2 ; B
|
||||
JSR FCOUT
|
||||
LDA #$CC ; L
|
||||
JSR FCOUT
|
||||
LDA #$CF ; O
|
||||
JSR FCOUT
|
||||
LDA #$C1 ; A
|
||||
JSR FCOUT
|
||||
LDA #$C4 ; D
|
||||
JSR FCOUT
|
||||
LDA #$A0 ; [SPACE]
|
||||
JSR FCOUT
|
||||
LDY #0
|
||||
LDA (ADDR2),Y
|
||||
STA :SLEN
|
||||
LDY #1
|
||||
:LP
|
||||
LDA (ADDR2),Y
|
||||
JSR FCOUT
|
||||
INY
|
||||
CPY :SLEN
|
||||
BCC :LP
|
||||
BEQ :LP
|
||||
LDA #$8D
|
||||
JSR FCOUT
|
||||
LDA RETADR+1
|
||||
PHA
|
||||
LDA RETADR
|
||||
PHA
|
||||
RTS
|
||||
:SLEN DS 1
|
||||
:E_SID ASC "BINLOAD (BLOAD MACRO)",00
|
||||
:E_DUMP ASC "DUMPING STRING ADDRESS...",00
|
||||
:E_MSG ASC "INPUT/OUTPUT ERROR!!!",00
|
@ -1,46 +0,0 @@
|
||||
*
|
||||
BINSAVE
|
||||
*
|
||||
PLA
|
||||
STA RETADR
|
||||
PLA
|
||||
STA RETADR+1
|
||||
PLA
|
||||
STA ADDR2
|
||||
PLA
|
||||
STA ADDR2+1
|
||||
LDA #$8D
|
||||
JSR FCOUT
|
||||
LDA #$84
|
||||
JSR FCOUT
|
||||
LDA #$C2
|
||||
JSR FCOUT
|
||||
LDA #$D3
|
||||
JSR FCOUT
|
||||
LDA #$C1
|
||||
JSR FCOUT
|
||||
LDA #$D6
|
||||
JSR FCOUT
|
||||
LDA #$C5
|
||||
JSR FCOUT
|
||||
LDA #$A0
|
||||
JSR FCOUT
|
||||
LDY #0
|
||||
LDA (ADDR2),Y
|
||||
STA :SLEN
|
||||
LDY #1
|
||||
:LP
|
||||
LDA (ADDR2),Y
|
||||
JSR FCOUT
|
||||
INY
|
||||
CPY :SLEN
|
||||
BCC :LP
|
||||
BEQ :LP
|
||||
LDA #$8D
|
||||
JSR FCOUT
|
||||
LDA RETADR+1
|
||||
PHA
|
||||
LDA RETADR
|
||||
PHA
|
||||
RTS
|
||||
:SLEN DS 1
|
@ -1,4 +1,3 @@
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* BINSAVE :: BINARY SAVE *
|
||||
*- -*
|
||||
@ -58,6 +57,50 @@ BINSAVE
|
||||
STA ADDR2 ; CMD STRING ADDR
|
||||
PLA
|
||||
STA ADDR2+1
|
||||
*
|
||||
*
|
||||
** FIRST, TELL DOS TO GO INTO APPLESOFT MODE
|
||||
*
|
||||
LDA #1
|
||||
STA $AAB6 ; DOS LANG FLAG
|
||||
STA $75+1 ; NOT IN DIRECT MODE
|
||||
STA $33 ; NOT IN DIRECT MODE
|
||||
*
|
||||
********************************
|
||||
*
|
||||
* ERROR CONTROL
|
||||
*
|
||||
********************************
|
||||
*
|
||||
LDA ERRCTRL
|
||||
CMP #1
|
||||
BEQ :CHKERR0
|
||||
JMP :ERREND
|
||||
:CHKERR0
|
||||
*
|
||||
** NOW TURN ON ONERR
|
||||
*
|
||||
LDA #$FF ; TURN ON LOCAL ERR HANDLING
|
||||
STA $D8
|
||||
*
|
||||
** NOW SET ONERR ADDR TO :CHKERR ROUTINE
|
||||
*
|
||||
LDA #<:CHKERR
|
||||
STA $9D5A ; DOS ERROR HANDLING ADDR
|
||||
LDA #>:CHKERR
|
||||
STA $9D5B
|
||||
JMP :ERREND
|
||||
:CHKERR
|
||||
LDY #0
|
||||
STY $D8 ; RESUME NORMAL ERROR CTRL
|
||||
_ERR :E_SID;:E_MSG;:E_DUMP;ADDR2;#2
|
||||
BRK
|
||||
*
|
||||
********************************
|
||||
*
|
||||
:ERREND
|
||||
*
|
||||
********************************
|
||||
*
|
||||
LDA #$8D
|
||||
JSR FCOUT
|
||||
@ -90,7 +133,7 @@ BINSAVE
|
||||
BCC :LP
|
||||
BEQ :LP
|
||||
*
|
||||
** NOW PRESS RETURN AND PRAY
|
||||
** NOW PRESS RETURN
|
||||
*
|
||||
LDA #$8D
|
||||
JSR FCOUT
|
||||
@ -108,3 +151,7 @@ BINSAVE
|
||||
*
|
||||
:SLEN DS 1
|
||||
*
|
||||
:E_SID ASC "BINSAVE (BSAV MACRO)",00
|
||||
:E_DUMP ASC "DUMPING STRING ADDRESS...",00
|
||||
:E_MSG ASC "INPUT/OUTPUT ERROR!!!",00
|
||||
*
|
69
disks/disk6_fileio/T.BINSAVE.SUB.MIN
Normal file
69
disks/disk6_fileio/T.BINSAVE.SUB.MIN
Normal file
@ -0,0 +1,69 @@
|
||||
BINSAVE
|
||||
PLA
|
||||
STA RETADR
|
||||
PLA
|
||||
STA RETADR+1
|
||||
PLA
|
||||
STA ADDR2 ; CMD STRING ADDR
|
||||
PLA
|
||||
STA ADDR2+1
|
||||
LDA #1
|
||||
STA $AAB6 ; DOS LANG FLAG
|
||||
STA $75+1 ; NOT IN DIRECT MODE
|
||||
STA $33 ; NOT IN DIRECT MODE
|
||||
LDA ERRCTRL
|
||||
CMP #1
|
||||
BEQ :CHKERR0
|
||||
JMP :ERREND
|
||||
:CHKERR0
|
||||
LDA #$FF ; TURN ON LOCAL ERR HANDLING
|
||||
STA $D8
|
||||
LDA #<:CHKERR
|
||||
STA $9D5A ; DOS ERROR HANDLING ADDR
|
||||
LDA #>:CHKERR
|
||||
STA $9D5B
|
||||
JMP :ERREND
|
||||
:CHKERR
|
||||
LDY #0
|
||||
STY $D8 ; RESUME NORMAL ERROR CTRL
|
||||
_ERR :E_SID;:E_MSG;:E_DUMP;ADDR2;#2
|
||||
BRK
|
||||
:ERREND
|
||||
LDA #$8D
|
||||
JSR FCOUT
|
||||
LDA #$84 ; CTRL-D
|
||||
JSR FCOUT
|
||||
LDA #$C2 ; B
|
||||
JSR FCOUT
|
||||
LDA #$D3 ; S
|
||||
JSR FCOUT
|
||||
LDA #$C1 ; A
|
||||
JSR FCOUT
|
||||
LDA #$D6 ; V
|
||||
JSR FCOUT
|
||||
LDA #$C5 ; E
|
||||
JSR FCOUT
|
||||
LDA #$A0 ; [SPACE]
|
||||
JSR FCOUT
|
||||
LDY #0
|
||||
LDA (ADDR2),Y
|
||||
STA :SLEN
|
||||
LDY #1
|
||||
:LP
|
||||
LDA (ADDR2),Y
|
||||
JSR FCOUT
|
||||
INY
|
||||
CPY :SLEN
|
||||
BCC :LP
|
||||
BEQ :LP
|
||||
LDA #$8D
|
||||
JSR FCOUT
|
||||
LDA RETADR+1
|
||||
PHA
|
||||
LDA RETADR
|
||||
PHA
|
||||
RTS
|
||||
:SLEN DS 1
|
||||
:E_SID ASC "BINSAVE (BSAV MACRO)",00
|
||||
:E_DUMP ASC "DUMPING STRING ADDRESS...",00
|
||||
:E_MSG ASC "INPUT/OUTPUT ERROR!!!",00
|
@ -1,46 +0,0 @@
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* DECLARATIONS.PUT *
|
||||
*- -*
|
||||
* USED IN CONJUNCTION WITH *
|
||||
* OTHER PUT FILES. DEFINES *
|
||||
* BASIC DECLARATIONS USED *
|
||||
* ACROSS DIFFERENT ROUTINES *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
** ADDRESS STORAGE LOCATIONS FOR
|
||||
** INDIRECT ADDRESSING.
|
||||
*
|
||||
ADDR1 EQU $06
|
||||
ADDR2 EQU $08
|
||||
ADDR3 EQU $EB
|
||||
ADDR4 EQU $ED
|
||||
*
|
||||
** SCRATCHPAD ZERO PAGE LOCATIONS AND
|
||||
** DEDICATED ZERO PAGE ADDRESS TO HOLD
|
||||
** A RETURN ADDRESS PASSED VIA THE STACK
|
||||
*
|
||||
SCRATCH EQU $19
|
||||
SCRATCH2 EQU $1E
|
||||
RETADR EQU $FE
|
||||
*
|
||||
** ZERO PAGE ADDRESSES DEDICATED TO PASSING
|
||||
** BACK RESULTS WHEN THERE ARE MORE THAN
|
||||
** THREE BYTES BEING PASSED (AXY) AND THE
|
||||
** USE OF THE STACK IS IMPRACTICAL OR TOO SLOW
|
||||
*
|
||||
RESULT EQU $FA
|
||||
RESULT2 EQU $FC
|
||||
*
|
||||
** VARIOUS HOOKS USED BY ALL ROUTINES
|
||||
*
|
||||
REENTRY EQU $3D0
|
||||
*
|
||||
** ERROR HANDLING MEMORY LOCATIONS
|
||||
*
|
||||
** THIS DESIGNATES A 16-BYTE BLOCK OF MEMORY
|
||||
** THAT HOLDS DATA RELATED TO IDENTIFYING
|
||||
** RUNTIME VALUES FOR DEBUGGING.
|
||||
*
|
||||
ERRLOC EQU $0C00
|
||||
*
|
@ -1,4 +1,3 @@
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* DISKOP : DISK OPERATION RWTS *
|
||||
*- -*
|
@ -1,6 +1,4 @@
|
||||
*
|
||||
DISKOP
|
||||
*
|
||||
:CLEAR
|
||||
LDA #00
|
||||
STA IOB_EVOL
|
@ -1,4 +1,3 @@
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* DOSCMD : EXECUTE DOS COMMAND *
|
||||
*- -*
|
||||
@ -53,6 +52,13 @@ DOSCMD
|
||||
LDA #$84 ; CTRL-D
|
||||
JSR FCOUT
|
||||
*
|
||||
** FIRST, ENTER APPLESOFT MODE
|
||||
*
|
||||
LDA #1
|
||||
STA $AAB6 ; DOS LANG FLAG
|
||||
STA $75+1 ; NOT DIRECT MODE
|
||||
STA $33 ; NOT DIRECT MODE
|
||||
*
|
||||
** NOW SEND STRING TO COUT
|
||||
*
|
||||
LDY #$01 ; POINT TO NEXT INSTR
|
@ -5,9 +5,13 @@ DOSCMD
|
||||
STA RETADR+1
|
||||
LDA #$8D
|
||||
JSR FCOUT
|
||||
LDA #$84
|
||||
LDA #$84 ; CTRL-D
|
||||
JSR FCOUT
|
||||
LDY #$01
|
||||
LDA #1
|
||||
STA $AAB6 ; DOS LANG FLAG
|
||||
STA $75+1 ; NOT DIRECT MODE
|
||||
STA $33 ; NOT DIRECT MODE
|
||||
LDY #$01 ; POINT TO NEXT INSTR
|
||||
:LP
|
||||
LDA (RETADR),Y
|
||||
BEQ :DONE
|
||||
@ -15,7 +19,7 @@ DOSCMD
|
||||
INY
|
||||
BNE :LP
|
||||
:DONE
|
||||
CLC
|
||||
CLC ; RESTORE INSTR POINTER
|
||||
TYA
|
||||
ADC RETADR
|
||||
STA RETADR
|
@ -1,110 +0,0 @@
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* BLOAD :: BINARY LOAD *
|
||||
*- -*
|
||||
* SIMPLY BLOADS INTO MEMORY AS *
|
||||
* SPECIFIED BY THE STRING *
|
||||
* PASSED AS A PARAMETER. *
|
||||
*- -*
|
||||
* CLOBBERS: *
|
||||
* *
|
||||
* FLAGS: ????---- REG: AXYM *
|
||||
*- -*
|
||||
* CYCLES: ??? *
|
||||
* SIZE: *
|
||||
*- -*
|
||||
* USAGE: *
|
||||
* *
|
||||
* LDA #>SADDR ; STRING ADDR *
|
||||
* PHA *
|
||||
* LDA #<SADDR *
|
||||
* PHA *
|
||||
* JSR BLOAD *
|
||||
*- -*
|
||||
* ENTRY *
|
||||
* *
|
||||
* TOP OF STACK *
|
||||
* *
|
||||
* LOW BYTE OF RETURN ADDRESS *
|
||||
* HI BYTE OF RETURN ADDRESS *
|
||||
* LO BYTE OF STRING ADDRESS *
|
||||
* HI BYTE OF STRING ADDRESS *
|
||||
*- -*
|
||||
* EXIT *
|
||||
* *
|
||||
* TOP OF STACK *
|
||||
* *
|
||||
* LOW BYTE OF RETURN ADDRESS *
|
||||
* HI BYTE OF RETURN ADDRESS *
|
||||
* *
|
||||
* Y = UNCHANGED *
|
||||
* X = UNCHANGED *
|
||||
* A = CLOBBERED; TRSAH *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
*
|
||||
BLOAD
|
||||
*
|
||||
** GET RETURN ADDRESS
|
||||
*
|
||||
PLA
|
||||
STA RETADR
|
||||
PLA
|
||||
STA RETADR+1
|
||||
*
|
||||
** GET PARAMETERS
|
||||
*
|
||||
PLA
|
||||
STA ADDR2 ; CMD STRING ADDR
|
||||
PLA
|
||||
STA ADDR2+1
|
||||
*
|
||||
LDA #$8D
|
||||
JSR FCOUT
|
||||
LDA #$84 ; CTRL-D
|
||||
JSR FCOUT
|
||||
LDA #$C2 ; B
|
||||
JSR FCOUT
|
||||
LDA #$CC ; L
|
||||
JSR FCOUT
|
||||
LDA #$CF ; O
|
||||
JSR FCOUT
|
||||
LDA #$C1 ; A
|
||||
JSR FCOUT
|
||||
LDA #$C4 ; D
|
||||
JSR FCOUT
|
||||
LDA #$A0 ; [SPACE]
|
||||
JSR FCOUT
|
||||
*
|
||||
** NOW SEND STRING TO COUT
|
||||
*
|
||||
LDY #0
|
||||
LDA (ADDR2),Y
|
||||
STA :SLEN
|
||||
LDY #1
|
||||
:LP
|
||||
LDA (ADDR2),Y
|
||||
JSR FCOUT
|
||||
INY
|
||||
CPY :SLEN
|
||||
BCC :LP
|
||||
BEQ :LP
|
||||
*
|
||||
** NOW PRESS RETURN AND PRAY
|
||||
*
|
||||
LDA #$8D
|
||||
JSR FCOUT
|
||||
*
|
||||
** RESTORE RETURN ADDRESS
|
||||
*
|
||||
LDA RETADR+1
|
||||
PHA
|
||||
LDA RETADR
|
||||
PHA
|
||||
*
|
||||
RTS
|
||||
*
|
||||
** DATA
|
||||
*
|
||||
:SLEN DS 1
|
||||
*
|
@ -1,111 +0,0 @@
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* BSAVE :: BINARY SAVE *
|
||||
*- -*
|
||||
* SIMPLY DOES A BINARY SAVE *
|
||||
* WITH THE COMMAND LINE PARAMS *
|
||||
* SPECIFIED IN THE STRING AT *
|
||||
* THE GIVEN ADDRESS. *
|
||||
*- -*
|
||||
* CLOBBERS: *
|
||||
* *
|
||||
* FLAGS: ????---- REG: AXYM *
|
||||
*- -*
|
||||
* CYCLES: ??? *
|
||||
* SIZE: *
|
||||
*- -*
|
||||
* USAGE: *
|
||||
* *
|
||||
* LDA #>SADDR ; STRING ADDR *
|
||||
* PHA *
|
||||
* LDA #<SADDR *
|
||||
* PHA *
|
||||
* JSR BSAVE *
|
||||
*- -*
|
||||
* ENTRY *
|
||||
* *
|
||||
* TOP OF STACK *
|
||||
* *
|
||||
* LOW BYTE OF RETURN ADDRESS *
|
||||
* HI BYTE OF RETURN ADDRESS *
|
||||
* LO BYTE OF STRING ADDRESS *
|
||||
* HI BYTE OF STRING ADDRESS *
|
||||
*- -*
|
||||
* EXIT *
|
||||
* *
|
||||
* TOP OF STACK *
|
||||
* *
|
||||
* LOW BYTE OF RETURN ADDRESS *
|
||||
* HI BYTE OF RETURN ADDRESS *
|
||||
* *
|
||||
* Y = UNCHANGED *
|
||||
* X = UNCHANGED *
|
||||
* A = CLOBBERED; TRASH *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
*
|
||||
BSAVE
|
||||
*
|
||||
** GET RETURN ADDRESS
|
||||
*
|
||||
PLA
|
||||
STA RETADR
|
||||
PLA
|
||||
STA RETADR+1
|
||||
*
|
||||
** GET PARAMETERS
|
||||
*
|
||||
PLA
|
||||
STA ADDR2 ; CMD STRING ADDR
|
||||
PLA
|
||||
STA ADDR2+1
|
||||
*
|
||||
LDA #$8D
|
||||
JSR FCOUT
|
||||
LDA #$84 ; CTRL-D
|
||||
JSR FCOUT
|
||||
LDA #$C2 ; B
|
||||
JSR FCOUT
|
||||
LDA #$D3 ; S
|
||||
JSR FCOUT
|
||||
LDA #$C1 ; A
|
||||
JSR FCOUT
|
||||
LDA #$D6 ; V
|
||||
JSR FCOUT
|
||||
LDA #$C5 ; E
|
||||
JSR FCOUT
|
||||
LDA #$A0 ; [SPACE]
|
||||
JSR FCOUT
|
||||
*
|
||||
** NOW SEND STRING TO COUT
|
||||
*
|
||||
LDY #0
|
||||
LDA (ADDR2),Y
|
||||
STA :SLEN
|
||||
LDY #1
|
||||
:LP
|
||||
LDA (ADDR2),Y
|
||||
JSR FCOUT
|
||||
INY
|
||||
CPY :SLEN
|
||||
BCC :LP
|
||||
BEQ :LP
|
||||
*
|
||||
** NOW PRESS RETURN AND PRAY
|
||||
*
|
||||
LDA #$8D
|
||||
JSR FCOUT
|
||||
*
|
||||
** RESTORE RETURN ADDRESS
|
||||
*
|
||||
LDA RETADR+1
|
||||
PHA
|
||||
LDA RETADR
|
||||
PHA
|
||||
*
|
||||
RTS
|
||||
*
|
||||
** DATA
|
||||
*
|
||||
:SLEN DS 1
|
||||
*
|
@ -1,78 +0,0 @@
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* CMD :: EXECUTE DOS COMMAND *
|
||||
*- -*
|
||||
* EXECUTES A DOS COMMAND THAT *
|
||||
* IS PASSED VIA AN ASC THAT *
|
||||
* FOLLOWS THE JSR TO THE *
|
||||
* ROUTINE. *
|
||||
*- -*
|
||||
* CLOBBERS: *
|
||||
* *
|
||||
* FLAGS: ????---- REG: AXYM *
|
||||
*- -*
|
||||
* CYCLES: ??? *
|
||||
* SIZE: *
|
||||
*- -*
|
||||
* USAGE: *
|
||||
* *
|
||||
* JSR CMD *
|
||||
* ASC "CATALOG" *
|
||||
* HEX 8D00 *
|
||||
*- -*
|
||||
* ENTRY *
|
||||
* *
|
||||
* TOP OF STACK *
|
||||
* *
|
||||
* LOW BYTE OF RETURN ADDRESS *
|
||||
* HI BYTE OF RETURN ADDRESS *
|
||||
*- -*
|
||||
* EXIT *
|
||||
* *
|
||||
* TOP OF STACK *
|
||||
* *
|
||||
* LOW BYTE OF RETURN ADDRESS *
|
||||
* HI BYTE OF RETURN ADDRESS *
|
||||
* *
|
||||
* Y = CLOBBERED *
|
||||
* X = UNCHANGED *
|
||||
* A = UNCHANGED *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
*
|
||||
CMD
|
||||
*
|
||||
** GET RETURN ADDRESS
|
||||
*
|
||||
PLA
|
||||
STA RETADR
|
||||
PLA
|
||||
STA RETADR+1
|
||||
*
|
||||
LDA #$8D
|
||||
JSR FCOUT
|
||||
LDA #$84 ; CTRL-D
|
||||
JSR FCOUT
|
||||
*
|
||||
** NOW SEND STRING TO COUT
|
||||
*
|
||||
LDY #$01 ; POINT TO NEXT INSTR
|
||||
:LP
|
||||
LDA (RETADR),Y
|
||||
BEQ :DONE
|
||||
JSR FCOUT
|
||||
INY
|
||||
BNE :LP
|
||||
:DONE
|
||||
CLC ; RESTORE INSTR POINTER
|
||||
TYA
|
||||
ADC RETADR
|
||||
STA RETADR
|
||||
LDA RETADR+1
|
||||
ADC #$00
|
||||
PHA
|
||||
LDA RETADR
|
||||
PHA
|
||||
*
|
||||
RTS
|
||||
*
|
@ -3,9 +3,9 @@
|
||||
* *
|
||||
* -< FILEIO DEMO >- *
|
||||
* *
|
||||
* VERSION 00.02.00 *
|
||||
* VERSION 00.03.00 *
|
||||
* *
|
||||
* 22-DEC-2018 *
|
||||
* 21-JAN-2019 *
|
||||
* *
|
||||
********************************
|
||||
* *
|
||||
@ -18,8 +18,8 @@
|
||||
*
|
||||
CYC AVE
|
||||
EXP ONLY
|
||||
TR ON
|
||||
DSK FILEIO.DEMO
|
||||
*
|
||||
OBJ $BFE0
|
||||
ORG $6000
|
||||
*
|
||||
@ -27,10 +27,10 @@
|
||||
* TOP INCLUDES (HOOKS,MACROS) *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
USE REQUIRED.MAC
|
||||
PUT REQUIRED.HOOKS
|
||||
*
|
||||
USE FILEIO.MAC
|
||||
PUT REQUIRED.VARS
|
||||
USE REQUIRED.MAC.MIN
|
||||
PUT REQUIRED.HOOKS.MIN
|
||||
USE FILEIO.MAC.MIN
|
||||
PUT FILEIO.HOOKS
|
||||
*
|
||||
*``````````````````````````````*
|
||||
@ -79,6 +79,7 @@ LP
|
||||
_WAIT
|
||||
_DUMP $800;#$100
|
||||
_WAIT
|
||||
_PRNT " ",8D8D
|
||||
_PRNT "BSAVE 'TEST,A$800,L$100'...."
|
||||
BSAVE "TEST,A$800,L$100"
|
||||
_PRNT "DONE!",8D8D
|
||||
@ -112,6 +113,16 @@ LP2
|
||||
_WAIT
|
||||
CMD "CATALOG"
|
||||
_WAIT
|
||||
*
|
||||
** IF WE ARE TO READ OR WRITE FILES, WE HAVE TO FOOL
|
||||
** THE COMPUTER TO THINK IT'S IN APPLESOFT MODE. THIS
|
||||
** IS ACCOMPLISHED WITH THE AMODE MACRO. WITH BINSAVE
|
||||
** AND BINLOAD, THIS IS ALREADY DONE, SO TECHNICALLY
|
||||
** WE DON'T HAVE TO DO IT HERE. HOWEVER, THE CMD
|
||||
** ROUTINE DOESN'T SET IT UP AUTOMATICALLY, SO BE SURE
|
||||
** TO INCLUDE THIS BEFORE OPENING TEXT FILES.
|
||||
*
|
||||
AMODE
|
||||
*
|
||||
_PRNT " ",8D8D8D
|
||||
_PRNT "TYPICALLY, THE CMD MACRO IS ALSO",8D
|
||||
@ -138,7 +149,6 @@ LP2
|
||||
_PRNT "THE ASCII IS.",8D8D
|
||||
_PRNT "FPRN 'ALL IS WELL THAT ENDS WELL.'",8D
|
||||
_PRNT "FPRN RETORT",8D8D
|
||||
TMODE
|
||||
CMD "OPEN T.TEXTFILE"
|
||||
CMD "WRITE T.TEXTFILE"
|
||||
FPRN "ALL IS WELL THAT ENDS WELL."
|
||||
@ -245,12 +255,23 @@ LP2
|
||||
*
|
||||
JMP REENTRY
|
||||
*
|
||||
RETORT STR "IF YOU ARE RICH, ANYHOW..."
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* BOTTOM INCLUDES *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
PUT FILEIO.LIB
|
||||
PUT REQUIRED.LIB
|
||||
PUT REQUIRED.LIB.MIN
|
||||
*
|
||||
RETORT STR "IF YOU ARE RICH, ANYHOW..."
|
||||
** INDIVIDUAL SUBROUTINES
|
||||
*
|
||||
** FILEIO SUBROUTINES
|
||||
*
|
||||
PUT BINLOAD.SUB.MIN
|
||||
PUT BINSAVE.SUB.MIN
|
||||
PUT DISKOP.SUB.MIN
|
||||
PUT DOSCMD.SUB.MIN
|
||||
PUT FINPUT.SUB.MIN
|
||||
PUT FPRINT.SUB.MIN
|
||||
PUT FPSTR.SUB.MIN
|
||||
*
|
||||
|
@ -1,100 +0,0 @@
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* FINPUT: READ LINE FROM TFILE *
|
||||
*- -*
|
||||
* INPUTS A LINE FROM A TEXT *
|
||||
* FILE AND STORES IT AS A *
|
||||
* STRING AT THE SPECIFIED *
|
||||
* MEMORY LOCATION. *
|
||||
*- -*
|
||||
* CLOBBERS: *
|
||||
* *
|
||||
* FLAGS: ????---- REG: AXYM *
|
||||
*- -*
|
||||
* CYCLES: ??? *
|
||||
* SIZE: *
|
||||
*- -*
|
||||
* USAGE: *
|
||||
* *
|
||||
* JSR CMD *
|
||||
* ASC "OPEN TEXT1" *
|
||||
* HEX 8D00 *
|
||||
* JSR CMD *
|
||||
* ASC "READ TEXT1" *
|
||||
* HEX 8D00 *
|
||||
* LDA #>STRLOC ; STRING LOC *
|
||||
* PHA *
|
||||
* LDA #<STRLOC *
|
||||
* PHA *
|
||||
* JSR FINPUT *
|
||||
* JSR CMD *
|
||||
* ASC "CLOSE TEXT1" *
|
||||
* HEX 8D00 *
|
||||
*- -*
|
||||
* ENTRY *
|
||||
* *
|
||||
* TOP OF STACK *
|
||||
* *
|
||||
* LOW BYTE OF RETURN ADDRESS *
|
||||
* HI BYTE OF RETURN ADDRESS *
|
||||
*- -*
|
||||
* EXIT *
|
||||
* *
|
||||
* TOP OF STACK *
|
||||
* *
|
||||
* LOW BYTE OF RETURN ADDRESS *
|
||||
* HI BYTE OF RETURN ADDRESS *
|
||||
* *
|
||||
* Y = CLOBBERED *
|
||||
* X = CLOBBERED *
|
||||
* A = CLOBBERED *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
FINPUT
|
||||
*
|
||||
** SAVE RETURN ADDRESS
|
||||
*
|
||||
PLA
|
||||
STA RETADR
|
||||
PLA
|
||||
STA RETADR+1
|
||||
*
|
||||
** GET PARAMETERS
|
||||
*
|
||||
PLA
|
||||
STA ADDR1
|
||||
PLA
|
||||
STA ADDR1+1
|
||||
*
|
||||
LDX #0
|
||||
JSR FGETLN
|
||||
STX :SLEN
|
||||
CPX #0
|
||||
BEQ :EXIT
|
||||
*
|
||||
:INP_CLR
|
||||
LDY #0
|
||||
LDA :SLEN
|
||||
STA (ADDR1),Y ; PUT LENGTH AT START
|
||||
:LP
|
||||
LDA $0200,Y ; KEYBOARD BUFFER
|
||||
INY
|
||||
STA (ADDR1),Y
|
||||
CPY :SLEN
|
||||
BNE :LP
|
||||
*
|
||||
:EXIT
|
||||
*
|
||||
** RESTORE RETURN ADDRESS
|
||||
*
|
||||
LDA RETADR+1
|
||||
PHA
|
||||
LDA RETADR
|
||||
PHA
|
||||
*
|
||||
RTS
|
||||
*
|
||||
** DATA
|
||||
*
|
||||
:SLEN DS 1
|
||||
*
|
@ -1,82 +0,0 @@
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* FPRINT : JUST PRINTS TO COUT *
|
||||
*- -*
|
||||
* PRINTS A STRING TO A TEXT *
|
||||
* FILE THAT IS SPECIFIED IN AN *
|
||||
* ASC THAT FOLLOWS THE JSR TO *
|
||||
* THE SUBROUTINE. *
|
||||
*- -*
|
||||
* CLOBBERS: *
|
||||
* *
|
||||
* FLAGS: ????---- REG: AXYM *
|
||||
*- -*
|
||||
* CYCLES: ??? *
|
||||
* SIZE: *
|
||||
*- -*
|
||||
* USAGE: *
|
||||
* *
|
||||
* JSR CMD *
|
||||
* ASC "OPEN TEXT1" *
|
||||
* HEX 8D00 *
|
||||
* JSR CMD *
|
||||
* ASC "WRITE TEXT1" *
|
||||
* HEX 8D00 *
|
||||
* JSR FPRINT *
|
||||
* ASC "THIS IS A TEST." *
|
||||
* HEX 8D00 *
|
||||
* JSR CMD *
|
||||
* ASC "CLOSE TEXT1" *
|
||||
* HEX 8D00 *
|
||||
*- -*
|
||||
* ENTRY *
|
||||
* *
|
||||
* TOP OF STACK *
|
||||
* *
|
||||
* LOW BYTE OF RETURN ADDRESS *
|
||||
* HI BYTE OF RETURN ADDRESS *
|
||||
*- -*
|
||||
* EXIT *
|
||||
* *
|
||||
* TOP OF STACK *
|
||||
* *
|
||||
* LOW BYTE OF RETURN ADDRESS *
|
||||
* HI BYTE OF RETURN ADDRESS *
|
||||
* *
|
||||
* Y = CLOBBERED *
|
||||
* X = UNCHANGED *
|
||||
* A = CLOBBERED *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
*
|
||||
FPRINT
|
||||
*
|
||||
** GET RETURN ADDRESS
|
||||
*
|
||||
PLA
|
||||
STA RETADR
|
||||
PLA
|
||||
STA RETADR+1
|
||||
*
|
||||
** NOW SEND STRING TO COUT
|
||||
*
|
||||
LDY #$01 ; POINT TO NEXT INSTR
|
||||
:LP
|
||||
LDA (RETADR),Y
|
||||
BEQ :DONE
|
||||
JSR FCOUT
|
||||
INY
|
||||
BNE :LP
|
||||
:DONE
|
||||
CLC ; RESTORE INSTR POINTER
|
||||
TYA
|
||||
ADC RETADR
|
||||
STA RETADR
|
||||
LDA RETADR+1
|
||||
ADC #$00
|
||||
PHA
|
||||
LDA RETADR
|
||||
PHA
|
||||
*
|
||||
RTS
|
||||
*
|
@ -1,78 +0,0 @@
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* FPSTR : PRINT STRING TO FILE *
|
||||
*- -*
|
||||
* PRINTS THE SPECIFIED STRING *
|
||||
* AT GIVEN LOCATION TO THE *
|
||||
* FILE OPEN AND SET TO BE *
|
||||
* WRITTEN. *
|
||||
*- -*
|
||||
* CLOBBERS: *
|
||||
* *
|
||||
* FLAGS: ????---- REG: AXYM *
|
||||
*- -*
|
||||
* CYCLES: ??? *
|
||||
* SIZE: *
|
||||
*- -*
|
||||
* USAGE: *
|
||||
* *
|
||||
*- -*
|
||||
* ENTRY *
|
||||
* *
|
||||
* TOP OF STACK *
|
||||
* *
|
||||
* LOW BYTE OF RETURN ADDRESS *
|
||||
* HI BYTE OF RETURN ADDRESS *
|
||||
*- -*
|
||||
* EXIT *
|
||||
* *
|
||||
* TOP OF STACK *
|
||||
* *
|
||||
* LOW BYTE OF RETURN ADDRESS *
|
||||
* HI BYTE OF RETURN ADDRESS *
|
||||
* *
|
||||
* Y = CLOBBERED *
|
||||
* X = CLOBBERED *
|
||||
* A = CLOBBERED *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
FPSTR
|
||||
*
|
||||
** SAVE RETURN ADDRESS
|
||||
*
|
||||
PLA
|
||||
STA RETADR
|
||||
PLA
|
||||
STA RETADR+1
|
||||
*
|
||||
** GET PARAMETERS
|
||||
*
|
||||
PLA
|
||||
STA ADDR1
|
||||
PLA
|
||||
STA ADDR1+1
|
||||
*
|
||||
LDY #0
|
||||
LDA (ADDR1),Y
|
||||
STA :SLEN
|
||||
:LP
|
||||
INY
|
||||
LDA (ADDR1),Y
|
||||
JSR FCOUT
|
||||
CPY :SLEN
|
||||
BNE :LP
|
||||
:EXIT
|
||||
*
|
||||
** RESTORE RETURN ADDRESS
|
||||
*
|
||||
LDA RETADR+1
|
||||
PHA
|
||||
LDA RETADR
|
||||
PHA
|
||||
*
|
||||
RTS
|
||||
*
|
||||
** DATA
|
||||
*
|
||||
:SLEN DS 1
|
||||
*
|
@ -52,3 +52,5 @@ CURLIN EQU $75
|
||||
PROMPT EQU $33
|
||||
FGET EQU $FD0C ; MONITOR GETKEY ROUTINE
|
||||
FGETLN EQU $FD6F ; MON GETLN ROUTINE
|
||||
*
|
||||
DOSERR EQU $DE ; DOS ERROR LOC
|
||||
|
@ -1,673 +0,0 @@
|
||||
*
|
||||
*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*
|
||||
* *
|
||||
* FILE INPUT/OUTPUT LIBRARY *
|
||||
* *
|
||||
* AUTHOR: NATHAN RIGGS *
|
||||
* CONTACT: NATHAN.RIGGS@ *
|
||||
* OUTLOOK.COM *
|
||||
* *
|
||||
* VERSION: 0.2.0 *
|
||||
* DATE: 22-DEC-2018 *
|
||||
* ASSEMBLER: MERLIN 8 PRO *
|
||||
* OS: DOS 3.3 *
|
||||
* LICENSE: APACHE 2.0 *
|
||||
* *
|
||||
*------------------------------*
|
||||
* *
|
||||
* LIST OF ROUTINES *
|
||||
* *
|
||||
* BINSAVE : SAVE BINARY FILE *
|
||||
* BINLOAD : LOAD BINARY FILE *
|
||||
* TXTMODE : TEXT FILE OPS MODE *
|
||||
* DOSCMD : EXEC DOS COMMAND *
|
||||
* FPRINT : PRINT TO FILE *
|
||||
* FPSTR : FILE PRINT STRING *
|
||||
* FINPUT : GET LINE FROM TEXTF *
|
||||
* *
|
||||
*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* BINSAVE :: BINARY SAVE *
|
||||
*- -*
|
||||
* SIMPLY DOES A BINARY SAVE *
|
||||
* WITH THE COMMAND LINE PARAMS *
|
||||
* SPECIFIED IN THE STRING AT *
|
||||
* THE GIVEN ADDRESS. *
|
||||
*- -*
|
||||
* CLOBBERS: *
|
||||
* *
|
||||
* FLAGS: ????---- REG: AXYM *
|
||||
*- -*
|
||||
* CYCLES: ??? *
|
||||
* SIZE: *
|
||||
*- -*
|
||||
* USAGE: *
|
||||
* *
|
||||
* LDA #>SADDR ; STRING ADDR *
|
||||
* PHA *
|
||||
* LDA #<SADDR *
|
||||
* PHA *
|
||||
* JSR BINSAVE *
|
||||
*- -*
|
||||
* ENTRY *
|
||||
* *
|
||||
* TOP OF STACK *
|
||||
* *
|
||||
* LOW BYTE OF RETURN ADDRESS *
|
||||
* HI BYTE OF RETURN ADDRESS *
|
||||
* LO BYTE OF STRING ADDRESS *
|
||||
* HI BYTE OF STRING ADDRESS *
|
||||
*- -*
|
||||
* EXIT *
|
||||
* *
|
||||
* TOP OF STACK *
|
||||
* *
|
||||
* LOW BYTE OF RETURN ADDRESS *
|
||||
* HI BYTE OF RETURN ADDRESS *
|
||||
* *
|
||||
* .Y = UNCHANGED *
|
||||
* .X = UNCHANGED *
|
||||
* .A = CLOBBERED; TRASH *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
BINSAVE
|
||||
*
|
||||
** GET RETURN ADDRESS
|
||||
*
|
||||
PLA
|
||||
STA RETADR
|
||||
PLA
|
||||
STA RETADR+1
|
||||
*
|
||||
** GET PARAMETERS
|
||||
*
|
||||
PLA
|
||||
STA ADDR2 ; CMD STRING ADDR
|
||||
PLA
|
||||
STA ADDR2+1
|
||||
*
|
||||
LDA #$8D
|
||||
JSR FCOUT
|
||||
LDA #$84 ; CTRL-D
|
||||
JSR FCOUT
|
||||
LDA #$C2 ; B
|
||||
JSR FCOUT
|
||||
LDA #$D3 ; S
|
||||
JSR FCOUT
|
||||
LDA #$C1 ; A
|
||||
JSR FCOUT
|
||||
LDA #$D6 ; V
|
||||
JSR FCOUT
|
||||
LDA #$C5 ; E
|
||||
JSR FCOUT
|
||||
LDA #$A0 ; [SPACE]
|
||||
JSR FCOUT
|
||||
*
|
||||
** NOW SEND STRING TO COUT
|
||||
*
|
||||
LDY #0
|
||||
LDA (ADDR2),Y
|
||||
STA :SLEN
|
||||
LDY #1
|
||||
:LP
|
||||
LDA (ADDR2),Y
|
||||
JSR FCOUT
|
||||
INY
|
||||
CPY :SLEN
|
||||
BCC :LP
|
||||
BEQ :LP
|
||||
*
|
||||
** NOW PRESS RETURN AND PRAY
|
||||
*
|
||||
LDA #$8D
|
||||
JSR FCOUT
|
||||
*
|
||||
** RESTORE RETURN ADDRESS
|
||||
*
|
||||
LDA RETADR+1
|
||||
PHA
|
||||
LDA RETADR
|
||||
PHA
|
||||
*
|
||||
RTS
|
||||
*
|
||||
** DATA
|
||||
*
|
||||
:SLEN DS 1
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* BINLOAD :: BINARY LOAD *
|
||||
*- -*
|
||||
* SIMPLY BLOADS INTO MEMORY AS *
|
||||
* SPECIFIED BY THE STRING *
|
||||
* PASSED AS A PARAMETER. *
|
||||
*- -*
|
||||
* CLOBBERS: *
|
||||
* *
|
||||
* FLAGS: ????---- REG: AXYM *
|
||||
*- -*
|
||||
* CYCLES: ??? *
|
||||
* SIZE: *
|
||||
*- -*
|
||||
* USAGE: *
|
||||
* *
|
||||
* LDA #>SADDR ; STRING ADDR *
|
||||
* PHA *
|
||||
* LDA #<SADDR *
|
||||
* PHA *
|
||||
* JSR BINLOAD *
|
||||
*- -*
|
||||
* ENTRY *
|
||||
* *
|
||||
* TOP OF STACK *
|
||||
* *
|
||||
* LOW BYTE OF RETURN ADDRESS *
|
||||
* HI BYTE OF RETURN ADDRESS *
|
||||
* LO BYTE OF STRING ADDRESS *
|
||||
* HI BYTE OF STRING ADDRESS *
|
||||
*- -*
|
||||
* EXIT *
|
||||
* *
|
||||
* TOP OF STACK *
|
||||
* *
|
||||
* LOW BYTE OF RETURN ADDRESS *
|
||||
* HI BYTE OF RETURN ADDRESS *
|
||||
* *
|
||||
* .Y = UNCHANGED *
|
||||
* .X = UNCHANGED *
|
||||
* .A = CLOBBERED; TRASH *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
BINLOAD
|
||||
*
|
||||
** GET RETURN ADDRESS
|
||||
*
|
||||
PLA
|
||||
STA RETADR
|
||||
PLA
|
||||
STA RETADR+1
|
||||
*
|
||||
** GET PARAMETERS
|
||||
*
|
||||
PLA
|
||||
STA ADDR2 ; CMD STRING ADDR
|
||||
PLA
|
||||
STA ADDR2+1
|
||||
*
|
||||
LDA #$8D
|
||||
JSR FCOUT
|
||||
LDA #$84 ; CTRL-D
|
||||
JSR FCOUT
|
||||
LDA #$C2 ; B
|
||||
JSR FCOUT
|
||||
LDA #$CC ; L
|
||||
JSR FCOUT
|
||||
LDA #$CF ; O
|
||||
JSR FCOUT
|
||||
LDA #$C1 ; A
|
||||
JSR FCOUT
|
||||
LDA #$C4 ; D
|
||||
JSR FCOUT
|
||||
LDA #$A0 ; [SPACE]
|
||||
JSR FCOUT
|
||||
*
|
||||
** NOW SEND STRING TO COUT
|
||||
*
|
||||
LDY #0
|
||||
LDA (ADDR2),Y
|
||||
STA :SLEN
|
||||
LDY #1
|
||||
:LP
|
||||
LDA (ADDR2),Y
|
||||
JSR FCOUT
|
||||
INY
|
||||
CPY :SLEN
|
||||
BCC :LP
|
||||
BEQ :LP
|
||||
*
|
||||
** NOW PRESS RETURN AND PRAY
|
||||
*
|
||||
LDA #$8D
|
||||
JSR FCOUT
|
||||
*
|
||||
** RESTORE RETURN ADDRESS
|
||||
*
|
||||
LDA RETADR+1
|
||||
PHA
|
||||
LDA RETADR
|
||||
PHA
|
||||
*
|
||||
RTS
|
||||
*
|
||||
** DATA
|
||||
*
|
||||
:SLEN DS 1
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* TXTMODE :: TEXT FILE MODE *
|
||||
*- -*
|
||||
* THIS ROUTINE FOOLS DOS INTO *
|
||||
* THINKING IT IS IN NON- *
|
||||
* IMMEDIATE MODE. THIS IS *
|
||||
* TO ALLOW FOR READING AND *
|
||||
* WRITING OF TEXT FILES. *
|
||||
*- -*
|
||||
* CLOBBERS: *
|
||||
* *
|
||||
* FLAGS: ????---- REG: AXYM *
|
||||
*- -*
|
||||
* CYCLES: ??? *
|
||||
* SIZE: *
|
||||
*- -*
|
||||
* ENTRY *
|
||||
* *
|
||||
* TOP OF STACK *
|
||||
* *
|
||||
* LOW BYTE OF RETURN ADDRESS *
|
||||
* HI BYTE OF RETURN ADDRESS *
|
||||
*- -*
|
||||
* EXIT *
|
||||
* *
|
||||
* TOP OF STACK *
|
||||
* *
|
||||
* LOW BYTE OF RETURN ADDRESS *
|
||||
* HI BYTE OF RETURN ADDRESS *
|
||||
* *
|
||||
* .Y = UNCHANGED *
|
||||
* .X = UNCHANGED *
|
||||
* .A = CLOBBERED; TRASH *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
TXTMODE
|
||||
*
|
||||
LDA #$40
|
||||
STA LANG ; LANG = FP
|
||||
STA CURLIN+1 ; RUNNING PROG
|
||||
LDA #$06
|
||||
STA PROMPT ; NOT DIRECT MODE
|
||||
RTS
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* DOSCMD : EXECUTE DOS COMMAND *
|
||||
*- -*
|
||||
* EXECUTES A DOS COMMAND THAT *
|
||||
* IS PASSED VIA AN ASC THAT *
|
||||
* FOLLOWS THE JSR TO THE *
|
||||
* ROUTINE. *
|
||||
*- -*
|
||||
* CLOBBERS: *
|
||||
* *
|
||||
* FLAGS: ????---- REG: AXYM *
|
||||
*- -*
|
||||
* CYCLES: ??? *
|
||||
* SIZE: *
|
||||
*- -*
|
||||
* USAGE: *
|
||||
* *
|
||||
* JSR DOSCMD *
|
||||
* ASC "CATALOG" *
|
||||
* HEX 8D00 *
|
||||
*- -*
|
||||
* ENTRY *
|
||||
* *
|
||||
* TOP OF STACK *
|
||||
* *
|
||||
* LOW BYTE OF RETURN ADDRESS *
|
||||
* HI BYTE OF RETURN ADDRESS *
|
||||
*- -*
|
||||
* EXIT *
|
||||
* *
|
||||
* TOP OF STACK *
|
||||
* *
|
||||
* LOW BYTE OF RETURN ADDRESS *
|
||||
* HI BYTE OF RETURN ADDRESS *
|
||||
* *
|
||||
* .Y = CLOBBERED *
|
||||
* .X = UNCHANGED *
|
||||
* .A = UNCHANGED *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
DOSCMD
|
||||
*
|
||||
** GET RETURN ADDRESS
|
||||
*
|
||||
PLA
|
||||
STA RETADR
|
||||
PLA
|
||||
STA RETADR+1
|
||||
*
|
||||
LDA #$8D
|
||||
JSR FCOUT
|
||||
LDA #$84 ; CTRL-D
|
||||
JSR FCOUT
|
||||
*
|
||||
** NOW SEND STRING TO COUT
|
||||
*
|
||||
LDY #$01 ; POINT TO NEXT INSTR
|
||||
:LP
|
||||
LDA (RETADR),Y
|
||||
BEQ :DONE
|
||||
JSR FCOUT
|
||||
INY
|
||||
BNE :LP
|
||||
:DONE
|
||||
CLC ; RESTORE INSTR POINTER
|
||||
TYA
|
||||
ADC RETADR
|
||||
STA RETADR
|
||||
LDA RETADR+1
|
||||
ADC #$00
|
||||
PHA
|
||||
LDA RETADR
|
||||
PHA
|
||||
*
|
||||
RTS
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* FPRINT : JUST PRINTS TO COUT *
|
||||
*- -*
|
||||
* PRINTS A STRING TO A TEXT *
|
||||
* FILE THAT IS SPECIFIED IN AN *
|
||||
* ASC THAT FOLLOWS THE JSR TO *
|
||||
* THE SUBROUTINE. *
|
||||
*- -*
|
||||
* CLOBBERS: *
|
||||
* *
|
||||
* FLAGS: ????---- REG: AXYM *
|
||||
*- -*
|
||||
* CYCLES: ??? *
|
||||
* SIZE: *
|
||||
*- -*
|
||||
* USAGE: *
|
||||
* *
|
||||
* JSR CMD *
|
||||
* ASC "OPEN TEXT1" *
|
||||
* HEX 8D00 *
|
||||
* JSR CMD *
|
||||
* ASC "WRITE TEXT1" *
|
||||
* HEX 8D00 *
|
||||
* JSR FPRINT *
|
||||
* ASC "THIS IS A TEST." *
|
||||
* HEX 8D00 *
|
||||
* JSR CMD *
|
||||
* ASC "CLOSE TEXT1" *
|
||||
* HEX 8D00 *
|
||||
*- -*
|
||||
* ENTRY *
|
||||
* *
|
||||
* TOP OF STACK *
|
||||
* *
|
||||
* LOW BYTE OF RETURN ADDRESS *
|
||||
* HI BYTE OF RETURN ADDRESS *
|
||||
*- -*
|
||||
* EXIT *
|
||||
* *
|
||||
* TOP OF STACK *
|
||||
* *
|
||||
* LOW BYTE OF RETURN ADDRESS *
|
||||
* HI BYTE OF RETURN ADDRESS *
|
||||
* *
|
||||
* .Y = CLOBBERED *
|
||||
* .X = UNCHANGED *
|
||||
* .A = CLOBBERED *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
FPRINT
|
||||
*
|
||||
** GET RETURN ADDRESS
|
||||
*
|
||||
PLA
|
||||
STA RETADR
|
||||
PLA
|
||||
STA RETADR+1
|
||||
*
|
||||
** NOW SEND STRING TO COUT
|
||||
*
|
||||
LDY #$01 ; POINT TO NEXT INSTR
|
||||
:LP
|
||||
LDA (RETADR),Y
|
||||
BEQ :DONE
|
||||
JSR FCOUT
|
||||
INY
|
||||
BNE :LP
|
||||
:DONE
|
||||
CLC ; RESTORE INSTR POINTER
|
||||
TYA
|
||||
ADC RETADR
|
||||
STA RETADR
|
||||
LDA RETADR+1
|
||||
ADC #$00
|
||||
PHA
|
||||
LDA RETADR
|
||||
PHA
|
||||
*
|
||||
RTS
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* FINPUT: READ LINE FROM TFILE *
|
||||
*- -*
|
||||
* INPUTS A LINE FROM A TEXT *
|
||||
* FILE AND STORES IT AS A *
|
||||
* STRING AT THE SPECIFIED *
|
||||
* MEMORY LOCATION. *
|
||||
*- -*
|
||||
* CLOBBERS: *
|
||||
* *
|
||||
* FLAGS: ????---- REG: AXYM *
|
||||
*- -*
|
||||
* CYCLES: ??? *
|
||||
* SIZE: *
|
||||
*- -*
|
||||
* USAGE: *
|
||||
* *
|
||||
* JSR CMD *
|
||||
* ASC "OPEN TEXT1" *
|
||||
* HEX 8D00 *
|
||||
* JSR CMD *
|
||||
* ASC "READ TEXT1" *
|
||||
* HEX 8D00 *
|
||||
* LDA #>STRLOC ; STRING LOC *
|
||||
* PHA *
|
||||
* LDA #<STRLOC *
|
||||
* PHA *
|
||||
* JSR FINPUT *
|
||||
* JSR CMD *
|
||||
* ASC "CLOSE TEXT1" *
|
||||
* HEX 8D00 *
|
||||
*- -*
|
||||
* ENTRY *
|
||||
* *
|
||||
* TOP OF STACK *
|
||||
* *
|
||||
* LOW BYTE OF RETURN ADDRESS *
|
||||
* HI BYTE OF RETURN ADDRESS *
|
||||
*- -*
|
||||
* EXIT *
|
||||
* *
|
||||
* TOP OF STACK *
|
||||
* *
|
||||
* LOW BYTE OF RETURN ADDRESS *
|
||||
* HI BYTE OF RETURN ADDRESS *
|
||||
* *
|
||||
* .Y = CLOBBERED *
|
||||
* .X = CLOBBERED *
|
||||
* .A = CLOBBERED *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
FINPUT
|
||||
*
|
||||
** SAVE RETURN ADDRESS
|
||||
*
|
||||
PLA
|
||||
STA RETADR
|
||||
PLA
|
||||
STA RETADR+1
|
||||
*
|
||||
** GET PARAMETERS
|
||||
*
|
||||
PLA
|
||||
STA ADDR1
|
||||
PLA
|
||||
STA ADDR1+1
|
||||
*
|
||||
LDX #0
|
||||
JSR FGETLN
|
||||
STX :SLEN
|
||||
CPX #0
|
||||
BEQ :EXIT
|
||||
*
|
||||
:INP_CLR
|
||||
LDY #0
|
||||
LDA :SLEN
|
||||
STA (ADDR1),Y ; PUT LENGTH AT START
|
||||
:LP
|
||||
LDA $0200,Y ; KEYBOARD BUFFER
|
||||
INY
|
||||
STA (ADDR1),Y
|
||||
CPY :SLEN
|
||||
BNE :LP
|
||||
*
|
||||
:EXIT
|
||||
*
|
||||
** RESTORE RETURN ADDRESS
|
||||
*
|
||||
LDA RETADR+1
|
||||
PHA
|
||||
LDA RETADR
|
||||
PHA
|
||||
*
|
||||
RTS
|
||||
*
|
||||
** DATA
|
||||
*
|
||||
:SLEN DS 1
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* FPSTR : PRINT STRING TO FILE *
|
||||
*- -*
|
||||
* PRINTS THE SPECIFIED STRING *
|
||||
* AT GIVEN LOCATION TO THE *
|
||||
* FILE OPEN AND SET TO BE *
|
||||
* WRITTEN. *
|
||||
*- -*
|
||||
* CLOBBERS: *
|
||||
* *
|
||||
* FLAGS: ????---- REG: AXYM *
|
||||
*- -*
|
||||
* CYCLES: ??? *
|
||||
* SIZE: *
|
||||
*- -*
|
||||
* USAGE: *
|
||||
* *
|
||||
*- -*
|
||||
* ENTRY *
|
||||
* *
|
||||
* TOP OF STACK *
|
||||
* *
|
||||
* LOW BYTE OF RETURN ADDRESS *
|
||||
* HI BYTE OF RETURN ADDRESS *
|
||||
*- -*
|
||||
* EXIT *
|
||||
* *
|
||||
* TOP OF STACK *
|
||||
* *
|
||||
* LOW BYTE OF RETURN ADDRESS *
|
||||
* HI BYTE OF RETURN ADDRESS *
|
||||
* *
|
||||
* .Y = CLOBBERED *
|
||||
* .X = CLOBBERED *
|
||||
* .A = CLOBBERED *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
FPSTR
|
||||
*
|
||||
** SAVE RETURN ADDRESS
|
||||
*
|
||||
PLA
|
||||
STA RETADR
|
||||
PLA
|
||||
STA RETADR+1
|
||||
*
|
||||
** GET PARAMETERS
|
||||
*
|
||||
PLA
|
||||
STA ADDR1
|
||||
PLA
|
||||
STA ADDR1+1
|
||||
*
|
||||
LDY #0
|
||||
LDA (ADDR1),Y
|
||||
STA :SLEN
|
||||
:LP
|
||||
INY
|
||||
LDA (ADDR1),Y
|
||||
JSR FCOUT
|
||||
CPY :SLEN
|
||||
BNE :LP
|
||||
:EXIT
|
||||
*
|
||||
** RESTORE RETURN ADDRESS
|
||||
*
|
||||
LDA RETADR+1
|
||||
PHA
|
||||
LDA RETADR
|
||||
PHA
|
||||
*
|
||||
RTS
|
||||
*
|
||||
** DATA
|
||||
*
|
||||
:SLEN DS 1
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* DISKOP : DISK OPERATION RWTS *
|
||||
*- -*
|
||||
* GENERAL PURPOSE ROUTINE FOR *
|
||||
* READING AND WRITING TO A *
|
||||
* DISK VIA TRACKS AND SECTORS. *
|
||||
*- -*
|
||||
* CLOBBERS: *
|
||||
* *
|
||||
* FLAGS: ????---- REG: AXYM *
|
||||
*- -*
|
||||
* CYCLES: ??? *
|
||||
* SIZE: *
|
||||
*- -*
|
||||
* USAGE: *
|
||||
* *
|
||||
*- -*
|
||||
* ENTRY *
|
||||
* *
|
||||
* TOP OF STACK *
|
||||
* *
|
||||
* LOW BYTE OF RETURN ADDRESS *
|
||||
* HI BYTE OF RETURN ADDRESS *
|
||||
*- -*
|
||||
* EXIT *
|
||||
* *
|
||||
* TOP OF STACK *
|
||||
* *
|
||||
* LOW BYTE OF RETURN ADDRESS *
|
||||
* HI BYTE OF RETURN ADDRESS *
|
||||
* *
|
||||
* .Y = CLOBBERED *
|
||||
* .X = CLOBBERED *
|
||||
* .A = CLOBBERED *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
DISKOP
|
||||
*
|
||||
:CLEAR
|
||||
LDA #00
|
||||
STA IOB_EVOL
|
||||
*
|
||||
LDA #>IOB
|
||||
LDY #<IOB
|
||||
JSR RWTS
|
||||
BCC :EXIT
|
||||
:ERR LDA IOB_ERR
|
||||
LDX #00
|
||||
STX $48
|
||||
:EXIT RTS
|
||||
*
|
@ -7,8 +7,8 @@
|
||||
* CONTACT: NATHAN.RIGGS@ *
|
||||
* OUTLOOK.COM *
|
||||
* *
|
||||
* VERSION: 0.2.0 *
|
||||
* DATE: 22-DEC-2018 *
|
||||
* VERSION: 0.3.0 *
|
||||
* DATE: 23-JAN-2019 *
|
||||
* ASSEMBLER: MERLIN 8 PRO *
|
||||
* OS: DOS 3.3 *
|
||||
* LICENSE: APACHE 2.0 *
|
||||
@ -25,7 +25,7 @@
|
||||
* *
|
||||
* BSAVE : BINARY SAVE *
|
||||
* BLOAD : BINARY LOAD *
|
||||
* TMODE : TEXT FILE OP MODE *
|
||||
* AMODE : TURN ON APPLESOFT *
|
||||
* CMD : EXECUTE DOS COMMAND *
|
||||
* FPRN : PRINT TO FILE *
|
||||
* FINP : INPUT LINE FROM FILE *
|
||||
@ -79,7 +79,7 @@ BSAVE MAC
|
||||
<<<
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* TMODE : INIT TXTFILE OP MODE *
|
||||
* AMODE : INIT TXTFILE OP MODE *
|
||||
*- -*
|
||||
* FOOLS DOS INTO THINKING THAT *
|
||||
* WE ARE IN INDIRECT MODE TO *
|
||||
@ -87,11 +87,14 @@ BSAVE MAC
|
||||
* WRITE OPERATIONS. *
|
||||
*- -*
|
||||
* SAMPLE USAGE: *
|
||||
* TMODE *
|
||||
* AMODE *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
TMODE MAC
|
||||
JSR TXTMODE
|
||||
AMODE MAC
|
||||
LDA #1
|
||||
STA $AAB6 ; DOS LANG FLAG
|
||||
STA $75+1 ; NOT IN DIRECT MODE
|
||||
STA $33 ; NOT IN DIRECT MODE
|
||||
<<<
|
||||
*
|
||||
*``````````````````````````````*
|
||||
|
78
disks/disk6_fileio/T.FILEIO.MAC.MIN
Normal file
78
disks/disk6_fileio/T.FILEIO.MAC.MIN
Normal file
@ -0,0 +1,78 @@
|
||||
BLOAD MAC
|
||||
_ISSTR ]1
|
||||
JSR BINLOAD
|
||||
<<<
|
||||
BSAVE MAC
|
||||
_ISSTR ]1
|
||||
JSR BINSAVE
|
||||
<<<
|
||||
AMODE MAC
|
||||
LDA #1
|
||||
STA $AAB6 ; DOS LANG FLAG
|
||||
STA $75+1 ; NOT IN DIRECT MODE
|
||||
STA $33 ; NOT IN DIRECT MODE
|
||||
<<<
|
||||
CMD MAC
|
||||
JSR DOSCMD
|
||||
ASC ]1
|
||||
HEX 8D00
|
||||
<<<
|
||||
FPRN MAC
|
||||
IF ",]1
|
||||
JSR FPRINT
|
||||
ASC ]1
|
||||
HEX 8D00
|
||||
ELSE ; IF PARAM IS ADDR
|
||||
LDA #>]1
|
||||
PHA
|
||||
LDA #<]1
|
||||
PHA
|
||||
JSR FPSTR ; PRINT STRING
|
||||
FIN
|
||||
<<<
|
||||
FINP MAC
|
||||
LDA #>]1
|
||||
PHA
|
||||
LDA #<]1
|
||||
PHA
|
||||
JSR FINPUT
|
||||
<<<
|
||||
SLOT MAC
|
||||
LDA ]1
|
||||
STA SCRATCH
|
||||
ASL SCRATCH
|
||||
ASL SCRATCH
|
||||
ASL SCRATCH
|
||||
ASL SCRATCH ; MUL BY 16
|
||||
LDA SCRATCH
|
||||
STA IOB_SLOT
|
||||
<<<
|
||||
DRIVE MAC
|
||||
LDA ]1
|
||||
STA IOB_DRIV
|
||||
<<<
|
||||
TRACK MAC
|
||||
LDA ]1
|
||||
STA IOB_TRAK
|
||||
<<<
|
||||
SECT MAC
|
||||
LDA ]1
|
||||
STA IOB_SECT
|
||||
<<<
|
||||
SETDR MAC
|
||||
LDA $01
|
||||
STA IOB_COMM
|
||||
<<<
|
||||
SETDW MAC
|
||||
LDA $02
|
||||
STA IOB_COMM
|
||||
<<<
|
||||
DBUFF MAC
|
||||
LDA #<]1
|
||||
STA IOB_BUFL
|
||||
LDA #>]1
|
||||
STA IOB_BUFH
|
||||
<<<
|
||||
DRWTS MAC
|
||||
JSR DISKOP
|
||||
<<<
|
@ -1,226 +0,0 @@
|
||||
*
|
||||
BINSAVE
|
||||
*
|
||||
PLA
|
||||
STA RETADR
|
||||
PLA
|
||||
STA RETADR+1
|
||||
PLA
|
||||
STA ADDR2
|
||||
PLA
|
||||
STA ADDR2+1
|
||||
LDA #$8D
|
||||
JSR FCOUT
|
||||
LDA #$84
|
||||
JSR FCOUT
|
||||
LDA #$C2
|
||||
JSR FCOUT
|
||||
LDA #$D3
|
||||
JSR FCOUT
|
||||
LDA #$C1
|
||||
JSR FCOUT
|
||||
LDA #$D6
|
||||
JSR FCOUT
|
||||
LDA #$C5
|
||||
JSR FCOUT
|
||||
LDA #$A0
|
||||
JSR FCOUT
|
||||
LDY #0
|
||||
LDA (ADDR2),Y
|
||||
STA :SLEN
|
||||
LDY #1
|
||||
:LP
|
||||
LDA (ADDR2),Y
|
||||
JSR FCOUT
|
||||
INY
|
||||
CPY :SLEN
|
||||
BCC :LP
|
||||
BEQ :LP
|
||||
LDA #$8D
|
||||
JSR FCOUT
|
||||
LDA RETADR+1
|
||||
PHA
|
||||
LDA RETADR
|
||||
PHA
|
||||
RTS
|
||||
:SLEN DS 1
|
||||
*
|
||||
BINLOAD
|
||||
*
|
||||
PLA
|
||||
STA RETADR
|
||||
PLA
|
||||
STA RETADR+1
|
||||
PLA
|
||||
STA ADDR2
|
||||
PLA
|
||||
STA ADDR2+1
|
||||
LDA #$8D
|
||||
JSR FCOUT
|
||||
LDA #$84
|
||||
JSR FCOUT
|
||||
LDA #$C2
|
||||
JSR FCOUT
|
||||
LDA #$CC
|
||||
JSR FCOUT
|
||||
LDA #$CF
|
||||
JSR FCOUT
|
||||
LDA #$C1
|
||||
JSR FCOUT
|
||||
LDA #$C4
|
||||
JSR FCOUT
|
||||
LDA #$A0
|
||||
JSR FCOUT
|
||||
LDY #0
|
||||
LDA (ADDR2),Y
|
||||
STA :SLEN
|
||||
LDY #1
|
||||
:LP
|
||||
LDA (ADDR2),Y
|
||||
JSR FCOUT
|
||||
INY
|
||||
CPY :SLEN
|
||||
BCC :LP
|
||||
BEQ :LP
|
||||
LDA #$8D
|
||||
JSR FCOUT
|
||||
LDA RETADR+1
|
||||
PHA
|
||||
LDA RETADR
|
||||
PHA
|
||||
RTS
|
||||
:SLEN DS 1
|
||||
*
|
||||
TXTMODE
|
||||
*
|
||||
LDA #$40
|
||||
STA LANG
|
||||
STA CURLIN+1
|
||||
LDA #$06
|
||||
STA PROMPT
|
||||
RTS
|
||||
DOSCMD
|
||||
PLA
|
||||
STA RETADR
|
||||
PLA
|
||||
STA RETADR+1
|
||||
LDA #$8D
|
||||
JSR FCOUT
|
||||
LDA #$84
|
||||
JSR FCOUT
|
||||
LDY #$01
|
||||
:LP
|
||||
LDA (RETADR),Y
|
||||
BEQ :DONE
|
||||
JSR FCOUT
|
||||
INY
|
||||
BNE :LP
|
||||
:DONE
|
||||
CLC
|
||||
TYA
|
||||
ADC RETADR
|
||||
STA RETADR
|
||||
LDA RETADR+1
|
||||
ADC #$00
|
||||
PHA
|
||||
LDA RETADR
|
||||
PHA
|
||||
RTS
|
||||
*
|
||||
FPRINT
|
||||
PLA
|
||||
STA RETADR
|
||||
PLA
|
||||
STA RETADR+1
|
||||
LDY #$01
|
||||
:LP
|
||||
LDA (RETADR),Y
|
||||
BEQ :DONE
|
||||
JSR FCOUT
|
||||
INY
|
||||
BNE :LP
|
||||
:DONE
|
||||
CLC
|
||||
TYA
|
||||
ADC RETADR
|
||||
STA RETADR
|
||||
LDA RETADR+1
|
||||
ADC #$00
|
||||
PHA
|
||||
LDA RETADR
|
||||
PHA
|
||||
RTS
|
||||
*
|
||||
FINPUT
|
||||
*
|
||||
PLA
|
||||
STA RETADR
|
||||
PLA
|
||||
STA RETADR+1
|
||||
PLA
|
||||
STA ADDR1
|
||||
PLA
|
||||
STA ADDR1+1
|
||||
LDX #0
|
||||
JSR FGETLN
|
||||
STX :SLEN
|
||||
CPX #0
|
||||
BEQ :EXIT
|
||||
:INP_CLR
|
||||
LDY #0
|
||||
LDA :SLEN
|
||||
STA (ADDR1),Y
|
||||
:LP
|
||||
LDA $0200,Y
|
||||
INY
|
||||
STA (ADDR1),Y
|
||||
CPY :SLEN
|
||||
BNE :LP
|
||||
:EXIT
|
||||
LDA RETADR+1
|
||||
PHA
|
||||
LDA RETADR
|
||||
PHA
|
||||
RTS
|
||||
:SLEN DS 1
|
||||
*
|
||||
FPSTR
|
||||
*
|
||||
PLA
|
||||
STA RETADR
|
||||
PLA
|
||||
STA RETADR+1
|
||||
PLA
|
||||
STA ADDR1
|
||||
PLA
|
||||
STA ADDR1+1
|
||||
LDY #0
|
||||
LDA (ADDR1),Y
|
||||
STA :SLEN
|
||||
:LP
|
||||
INY
|
||||
LDA (ADDR1),Y
|
||||
JSR FCOUT
|
||||
CPY :SLEN
|
||||
BNE :LP
|
||||
:EXIT
|
||||
LDA RETADR+1
|
||||
PHA
|
||||
LDA RETADR
|
||||
PHA
|
||||
RTS
|
||||
:SLEN DS 1
|
||||
*
|
||||
DISKOP
|
||||
*
|
||||
:CLEAR
|
||||
LDA #00
|
||||
STA IOB_EVOL
|
||||
LDA #>IOB
|
||||
LDY #<IOB
|
||||
JSR RWTS
|
||||
BCC :EXIT
|
||||
:ERR LDA IOB_ERR
|
||||
LDX #00
|
||||
STX $48
|
||||
:EXIT RTS
|
@ -1,48 +0,0 @@
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* TMODE :: TEXT FILE OPS MODE *
|
||||
*- -*
|
||||
* THIS ROUTINE FOOLS DOS INTO *
|
||||
* THINKING IT IS IN NON- *
|
||||
* IMMEDIATE MODE. THIS IS *
|
||||
* TO ALLOW FOR READING AND *
|
||||
* WRITING OF TEXT FILES. *
|
||||
*- -*
|
||||
* CLOBBERS: *
|
||||
* *
|
||||
* FLAGS: ????---- REG: AXYM *
|
||||
*- -*
|
||||
* CYCLES: ??? *
|
||||
* SIZE: *
|
||||
*- -*
|
||||
* USAGE: *
|
||||
* *
|
||||
*- -*
|
||||
* ENTRY *
|
||||
* *
|
||||
* TOP OF STACK *
|
||||
* *
|
||||
* LOW BYTE OF RETURN ADDRESS *
|
||||
* HI BYTE OF RETURN ADDRESS *
|
||||
*- -*
|
||||
* EXIT *
|
||||
* *
|
||||
* TOP OF STACK *
|
||||
* *
|
||||
* LOW BYTE OF RETURN ADDRESS *
|
||||
* HI BYTE OF RETURN ADDRESS *
|
||||
* *
|
||||
* Y = UNCHANGED *
|
||||
* X = UNCHANGED *
|
||||
* A = CLOBBERED; TRASH *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
TMODE
|
||||
*
|
||||
LDA #$40
|
||||
STA LANG ; LANG = FP
|
||||
STA CURLIN+1 ; RUNNING PROG
|
||||
LDA #$06
|
||||
STA PROMPT ; NOT DIRECT MODE
|
||||
RTS
|
||||
*
|
@ -1,4 +1,3 @@
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* FINPUT: READ LINE FROM TFILE *
|
||||
*- -*
|
@ -1,6 +1,4 @@
|
||||
*
|
||||
FINPUT
|
||||
*
|
||||
PLA
|
||||
STA RETADR
|
||||
PLA
|
||||
@ -17,9 +15,9 @@ FINPUT
|
||||
:INP_CLR
|
||||
LDY #0
|
||||
LDA :SLEN
|
||||
STA (ADDR1),Y
|
||||
STA (ADDR1),Y ; PUT LENGTH AT START
|
||||
:LP
|
||||
LDA $0200,Y
|
||||
LDA $0200,Y ; KEYBOARD BUFFER
|
||||
INY
|
||||
STA (ADDR1),Y
|
||||
CPY :SLEN
|
@ -1,4 +1,3 @@
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* FPRINT : JUST PRINTS TO COUT *
|
||||
*- -*
|
@ -1,11 +1,9 @@
|
||||
*
|
||||
FPRINT
|
||||
*
|
||||
PLA
|
||||
STA RETADR
|
||||
PLA
|
||||
STA RETADR+1
|
||||
LDY #$01
|
||||
LDY #$01 ; POINT TO NEXT INSTR
|
||||
:LP
|
||||
LDA (RETADR),Y
|
||||
BEQ :DONE
|
||||
@ -13,7 +11,7 @@ FPRINT
|
||||
INY
|
||||
BNE :LP
|
||||
:DONE
|
||||
CLC
|
||||
CLC ; RESTORE INSTR POINTER
|
||||
TYA
|
||||
ADC RETADR
|
||||
STA RETADR
|
@ -1,4 +1,3 @@
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* FPSTR : PRINT STRING TO FILE *
|
||||
*- -*
|
@ -1,6 +1,4 @@
|
||||
*
|
||||
FPSTR
|
||||
*
|
||||
PLA
|
||||
STA RETADR
|
||||
PLA
|
@ -1,46 +0,0 @@
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* DECLARATIONS.PUT *
|
||||
*- -*
|
||||
* USED IN CONJUNCTION WITH *
|
||||
* OTHER PUT FILES. DEFINES *
|
||||
* BASIC DECLARATIONS USED *
|
||||
* ACROSS DIFFERENT ROUTINES *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
** ADDRESS STORAGE LOCATIONS FOR
|
||||
** INDIRECT ADDRESSING.
|
||||
*
|
||||
ADDR1 EQU $06
|
||||
ADDR2 EQU $08
|
||||
ADDR3 EQU $EB
|
||||
ADDR4 EQU $ED
|
||||
*
|
||||
** SCRATCHPAD ZERO PAGE LOCATIONS AND
|
||||
** DEDICATED ZERO PAGE ADDRESS TO HOLD
|
||||
** A RETURN ADDRESS PASSED VIA THE STACK
|
||||
*
|
||||
SCRATCH EQU $19
|
||||
SCRATCH2 EQU $1E
|
||||
RETADR EQU $FE
|
||||
*
|
||||
** ZERO PAGE ADDRESSES DEDICATED TO PASSING
|
||||
** BACK RESULTS WHEN THERE ARE MORE THAN
|
||||
** THREE BYTES BEING PASSED (AXY) AND THE
|
||||
** USE OF THE STACK IS IMPRACTICAL OR TOO SLOW
|
||||
*
|
||||
RESULT EQU $FA
|
||||
RESULT2 EQU $FC
|
||||
*
|
||||
** VARIOUS HOOKS USED BY ALL ROUTINES
|
||||
*
|
||||
REENTRY EQU $3D0
|
||||
*
|
||||
** ERROR HANDLING MEMORY LOCATIONS
|
||||
*
|
||||
** THIS DESIGNATES A 16-BYTE BLOCK OF MEMORY
|
||||
** THAT HOLDS DATA RELATED TO IDENTIFYING
|
||||
** RUNTIME VALUES FOR DEBUGGING.
|
||||
*
|
||||
ERRLOC EQU $0C00
|
||||
*
|
10
disks/disk6_fileio/T.REQUIRED.HOOKS.MIN
Normal file
10
disks/disk6_fileio/T.REQUIRED.HOOKS.MIN
Normal file
@ -0,0 +1,10 @@
|
||||
ADDR1 EQU $06
|
||||
ADDR2 EQU $08
|
||||
ADDR3 EQU $EB
|
||||
ADDR4 EQU $ED
|
||||
SCRATCH EQU $19
|
||||
SCRATCH2 EQU $1E
|
||||
RETADR EQU $FE
|
||||
RESULT EQU $FA
|
||||
RESULT2 EQU $FC
|
||||
REENTRY EQU $3D0
|
@ -1,235 +0,0 @@
|
||||
*
|
||||
JMP ENDVARS
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* REQUIRED.LIB *
|
||||
*- -*
|
||||
* GLOBAL ROUTINES AND *
|
||||
* VARIABLES EITHER USED BY THE *
|
||||
* LIBRARY OR PROVIDED FOR DEMO *
|
||||
* USE OR DEBUGGING PURPOSES. *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
********************************
|
||||
* *
|
||||
* GLOBAL ROUTINES *
|
||||
* *
|
||||
********************************
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* __GETRET: GET RETURN *
|
||||
*- -*
|
||||
* COPIES THE DATA IN [RETURN] *
|
||||
* TO THE SPECIFIED LOCATION. *
|
||||
* LENGTH IS DETERMINED BY *
|
||||
* VALUE OF RETLEN. *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
__GETRET
|
||||
*
|
||||
LDY #255
|
||||
PLA
|
||||
STA ADDR1
|
||||
PLA
|
||||
STA ADDR1+1
|
||||
*
|
||||
:LP
|
||||
INY
|
||||
LDA RETURN,Y
|
||||
STA (ADDR1),Y
|
||||
CPY RETLEN
|
||||
BNE :LP
|
||||
LDA ADDR1+1
|
||||
PHA
|
||||
LDA ADDR1
|
||||
PHA
|
||||
RTS
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* __SETPARM: SET PARAMETER *
|
||||
*- -*
|
||||
* COPIES DATA FROM SPECIFIED *
|
||||
* ADDRESS TO THE [PARAM] *
|
||||
* LOCATION FOR PASSING TO *
|
||||
* A ROUTINE. *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
__SETPARM
|
||||
*
|
||||
LDY #255
|
||||
PLA
|
||||
STA ADDR1
|
||||
PLA
|
||||
STA ADDR1+1
|
||||
*
|
||||
:LP
|
||||
INY
|
||||
LDA (ADDR1),Y
|
||||
STA PARAM,Y
|
||||
CPY PARLEN
|
||||
BNE :LP
|
||||
LDA ADDR1+1
|
||||
PHA
|
||||
LDA ADDR1
|
||||
PHA
|
||||
RTS
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* __DUMP: DUMP DATA *
|
||||
*- -*
|
||||
* OUTPUTS DATA LOCATED AT THE *
|
||||
* SPECIFIED ADDRESS IN HEX *
|
||||
* FORMAT FOR SPECIFIED NUMBER *
|
||||
* OF BYTES. *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
__DUMP
|
||||
*
|
||||
PLA
|
||||
STA :RET
|
||||
PLA
|
||||
STA :RET+1
|
||||
PLA
|
||||
STA :LENGTH
|
||||
PLA
|
||||
STA ADDR3
|
||||
PLA
|
||||
STA ADDR3+1
|
||||
*
|
||||
LDA #$8D
|
||||
JSR $FDF0
|
||||
LDA ADDR3+1
|
||||
AND #$F0
|
||||
LSR
|
||||
LSR
|
||||
LSR
|
||||
LSR
|
||||
TAX
|
||||
LDA :HEXTAB,X
|
||||
JSR $FDF0
|
||||
LDA ADDR3+1
|
||||
AND #$0F
|
||||
TAX
|
||||
LDA :HEXTAB,X
|
||||
JSR $FDF0
|
||||
LDA ADDR3
|
||||
AND #$F0
|
||||
LSR
|
||||
LSR
|
||||
LSR
|
||||
LSR
|
||||
TAX
|
||||
LDA :HEXTAB,X
|
||||
JSR $FDF0
|
||||
LDA ADDR3
|
||||
AND #$0F
|
||||
TAX
|
||||
LDA :HEXTAB,X
|
||||
JSR $FDF0
|
||||
LDA #186 ; :
|
||||
JSR $FDF0
|
||||
LDA #160 ; SPC
|
||||
JSR $FDF0
|
||||
*
|
||||
LDY #0
|
||||
:LP
|
||||
LDA (ADDR3),Y
|
||||
AND #$F0 ; MASK RIGHT
|
||||
LSR
|
||||
LSR
|
||||
LSR
|
||||
LSR
|
||||
STA :LEFT
|
||||
LDA (ADDR3),Y
|
||||
AND #$0F ; MASK LEFT
|
||||
STA :RIGHT
|
||||
LDX :LEFT
|
||||
LDA :HEXTAB,X
|
||||
JSR $FDF0
|
||||
LDX :RIGHT
|
||||
LDA :HEXTAB,X
|
||||
JSR $FDF0
|
||||
LDA #160
|
||||
JSR $FDF0
|
||||
INY
|
||||
CPY :LENGTH
|
||||
BNE :LP
|
||||
*
|
||||
*LDA #$8D
|
||||
*JSR $FDF0
|
||||
LDA :RET+1
|
||||
PHA
|
||||
LDA :RET
|
||||
PHA
|
||||
*
|
||||
RTS
|
||||
*
|
||||
:RET DS 2
|
||||
:RIGHT DS 1
|
||||
:LEFT DS 1
|
||||
:LENGTH DS 1
|
||||
:HEXTAB ASC "0123456789ABCDEF"
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* __P: PRINT FOLLOWING ASC *
|
||||
*- -*
|
||||
* THIS IS THE XPRINT ROUTINE *
|
||||
* FROM STDIO.LIB, BUT STRIPPED *
|
||||
* OF COMMENTS. FOR DEBUG. *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
__P
|
||||
PLA
|
||||
STA ADDR1
|
||||
PLA
|
||||
STA ADDR1+1
|
||||
LDY #1
|
||||
:LP LDA (ADDR1),Y
|
||||
BEQ :DONE
|
||||
JSR $FDF0
|
||||
INY
|
||||
BNE :LP
|
||||
:DONE CLC
|
||||
TYA
|
||||
ADC ADDR1
|
||||
STA ADDR1
|
||||
LDA ADDR1+1
|
||||
ADC #0
|
||||
PHA
|
||||
LDA ADDR1
|
||||
PHA
|
||||
RTS
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* __W: WAIT FOR KEYPRESS *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
__W
|
||||
JSR $FD0C
|
||||
RTS
|
||||
*
|
||||
********************************
|
||||
* *
|
||||
* GLOBAL VARIABLES *
|
||||
* *
|
||||
********************************
|
||||
*
|
||||
** 256 BYTES DEDICATED TO RETURN
|
||||
** VALUES OF VARIABLE LENGTH; CAN BE
|
||||
** MODIFIED TO SUIT SMALLER OR LARGER
|
||||
** NEEDS.
|
||||
*
|
||||
*
|
||||
RETLEN DS 1 ; RETURN VALUE BYTE LENGTH
|
||||
RETURN DS 256
|
||||
*
|
||||
** 256 BYTE VALUE DEDICATED TO LARGE
|
||||
** OR VARIABLE LENGTH PARAMETERS. THIS
|
||||
** CAN ALSO BE CHANGED TO FIT SMALLER OR
|
||||
** LARGER BOUNDS.
|
||||
*
|
||||
PARLEN DS 1
|
||||
PARAM DS 256
|
||||
*
|
||||
ENDVARS
|
||||
*
|
358
disks/disk6_fileio/T.REQUIRED.LIB.MIN
Normal file
358
disks/disk6_fileio/T.REQUIRED.LIB.MIN
Normal file
@ -0,0 +1,358 @@
|
||||
__GETRET
|
||||
LDY #255
|
||||
PLA
|
||||
STA ADDR1
|
||||
PLA
|
||||
STA ADDR1+1
|
||||
:LP
|
||||
INY
|
||||
LDA RETURN,Y
|
||||
STA (ADDR1),Y
|
||||
CPY RETLEN
|
||||
BNE :LP
|
||||
LDA ADDR1+1
|
||||
PHA
|
||||
LDA ADDR1
|
||||
PHA
|
||||
RTS
|
||||
__SETPARM
|
||||
LDY #255
|
||||
PLA
|
||||
STA ADDR1
|
||||
PLA
|
||||
STA ADDR1+1
|
||||
:LP
|
||||
INY
|
||||
LDA (ADDR1),Y
|
||||
STA PARAM,Y
|
||||
CPY PARLEN
|
||||
BNE :LP
|
||||
LDA ADDR1+1
|
||||
PHA
|
||||
LDA ADDR1
|
||||
PHA
|
||||
RTS
|
||||
__DUMP
|
||||
PLA
|
||||
STA :RET
|
||||
PLA
|
||||
STA :RET+1
|
||||
PLA
|
||||
STA :LENGTH
|
||||
PLA
|
||||
STA ADDR3
|
||||
PLA
|
||||
STA ADDR3+1
|
||||
LDA #$8D
|
||||
JSR $FDF0
|
||||
LDA ADDR3+1
|
||||
AND #$F0
|
||||
LSR
|
||||
LSR
|
||||
LSR
|
||||
LSR
|
||||
TAX
|
||||
LDA HEXTAB,X
|
||||
JSR $FDF0
|
||||
LDA ADDR3+1
|
||||
AND #$0F
|
||||
TAX
|
||||
LDA HEXTAB,X
|
||||
JSR $FDF0
|
||||
LDA ADDR3
|
||||
AND #$F0
|
||||
LSR
|
||||
LSR
|
||||
LSR
|
||||
LSR
|
||||
TAX
|
||||
LDA HEXTAB,X
|
||||
JSR $FDF0
|
||||
LDA ADDR3
|
||||
AND #$0F
|
||||
TAX
|
||||
LDA HEXTAB,X
|
||||
JSR $FDF0
|
||||
LDA #186 ; :
|
||||
JSR $FDF0
|
||||
LDA #160 ; SPC
|
||||
JSR $FDF0
|
||||
LDY #0
|
||||
:LP
|
||||
LDA (ADDR3),Y
|
||||
AND #$F0 ; MASK RIGHT
|
||||
LSR
|
||||
LSR
|
||||
LSR
|
||||
LSR
|
||||
STA :LEFT
|
||||
LDA (ADDR3),Y
|
||||
AND #$0F ; MASK LEFT
|
||||
STA :RIGHT
|
||||
LDX :LEFT
|
||||
LDA HEXTAB,X
|
||||
JSR $FDF0
|
||||
LDX :RIGHT
|
||||
LDA HEXTAB,X
|
||||
JSR $FDF0
|
||||
LDA #160
|
||||
JSR $FDF0
|
||||
INY
|
||||
CPY :LENGTH
|
||||
BNE :LP
|
||||
LDA :RET+1
|
||||
PHA
|
||||
LDA :RET
|
||||
PHA
|
||||
RTS
|
||||
:RET DS 2
|
||||
:RIGHT DS 1
|
||||
:LEFT DS 1
|
||||
:LENGTH DS 1
|
||||
__P
|
||||
PLA
|
||||
STA ADDR1
|
||||
PLA
|
||||
STA ADDR1+1
|
||||
LDY #1
|
||||
:LP LDA (ADDR1),Y
|
||||
BEQ :DONE
|
||||
JSR $FDF0
|
||||
INY
|
||||
BNE :LP
|
||||
:DONE CLC
|
||||
TYA
|
||||
ADC ADDR1
|
||||
STA ADDR1
|
||||
LDA ADDR1+1
|
||||
ADC #0
|
||||
PHA
|
||||
LDA ADDR1
|
||||
PHA
|
||||
RTS
|
||||
__W
|
||||
JSR $FD0C
|
||||
RTS
|
||||
__RSAV
|
||||
STA ERRA
|
||||
STX ERRX
|
||||
STY ERRY
|
||||
:C BCC :C0
|
||||
BCS :C1
|
||||
:Z BEQ :Z1
|
||||
BNE :Z0
|
||||
:N BMI :N1
|
||||
BPL :N0
|
||||
:O BVC :O0
|
||||
BVS :O1
|
||||
JMP :EXIT
|
||||
:C0 LDA #0
|
||||
STA ERRCARRY
|
||||
JMP :Z
|
||||
:C1 LDA #1
|
||||
STA ERRCARRY
|
||||
JMP :Z
|
||||
:Z1 LDA #1
|
||||
STA ERRZERO
|
||||
JMP :N
|
||||
:Z0 LDA #0
|
||||
STA ERRZERO
|
||||
JMP :N
|
||||
:N1 LDA #1
|
||||
STA ERRNEG
|
||||
JMP :O
|
||||
:N0 LDA #0
|
||||
STA ERRNEG
|
||||
JMP :O
|
||||
:O0 LDA #0
|
||||
STA ERROVF
|
||||
JMP :EXIT
|
||||
:O1 LDA #1
|
||||
STA ERROVF
|
||||
:EXIT
|
||||
RTS
|
||||
__RDMP
|
||||
_PRNT " ",8D8D
|
||||
_PRNT "REGISTRY DUMP",8D
|
||||
_PRNT "=============",8D
|
||||
_PRNT "A: "
|
||||
LDA ERRA
|
||||
AND #$F0 ; MASK RIGHT
|
||||
LSR
|
||||
LSR
|
||||
LSR
|
||||
LSR
|
||||
STA :LEFT
|
||||
LDA ERRA
|
||||
AND #$0F ; MASK LEFT
|
||||
STA :RIGHT
|
||||
LDX :LEFT
|
||||
LDA HEXTAB,X
|
||||
JSR $FDF0
|
||||
LDX :RIGHT
|
||||
LDA HEXTAB,X
|
||||
JSR $FDF0
|
||||
_PRNT " ",8D
|
||||
_PRNT "X: "
|
||||
LDA ERRX
|
||||
AND #$F0 ; MASK RIGHT
|
||||
LSR
|
||||
LSR
|
||||
LSR
|
||||
LSR
|
||||
STA :LEFT
|
||||
LDA ERRX
|
||||
AND #$0F ; MASK LEFT
|
||||
STA :RIGHT
|
||||
LDX :LEFT
|
||||
LDA HEXTAB,X
|
||||
JSR $FDF0
|
||||
LDX :RIGHT
|
||||
LDA HEXTAB,X
|
||||
JSR $FDF0
|
||||
_PRNT " ",8D
|
||||
_PRNT "Y: "
|
||||
LDA ERRY
|
||||
AND #$F0 ; MASK RIGHT
|
||||
LSR
|
||||
LSR
|
||||
LSR
|
||||
LSR
|
||||
STA :LEFT
|
||||
LDA ERRY
|
||||
AND #$0F ; MASK LEFT
|
||||
STA :RIGHT
|
||||
LDX :LEFT
|
||||
LDA HEXTAB,X
|
||||
JSR $FDF0
|
||||
LDX :RIGHT
|
||||
LDA HEXTAB,X
|
||||
JSR $FDF0
|
||||
_PRNT " ",8D8D
|
||||
_PRNT "STATUS FLAGS",8D
|
||||
_PRNT "============",8D8D
|
||||
LDA #0
|
||||
CMP ERRCARRY
|
||||
BEQ :CARCLR
|
||||
_PRNT "CARRY: SET",8D
|
||||
JMP :TESTN
|
||||
:CARCLR _PRNT "CARRY: CLEAR",8D
|
||||
:TESTN LDA #0
|
||||
CMP ERRNEG
|
||||
BEQ :NEGCLR
|
||||
_PRNT "NEGATIVE: SET",8D
|
||||
JMP :TESTZ
|
||||
:NEGCLR _PRNT "NEGATIVE: CLEAR",8D
|
||||
:TESTZ LDA #0
|
||||
CMP ERRZERO
|
||||
BEQ :ZCLR
|
||||
_PRNT "ZERO: SET",8D
|
||||
JMP :TESTO
|
||||
:ZCLR _PRNT "ZERO: CLEAR",8D
|
||||
:TESTO
|
||||
LDA #0
|
||||
CMP ERROVF
|
||||
BEQ :OCLR
|
||||
_PRNT "OVERFLOW: SET",8D
|
||||
JMP :FIN
|
||||
:OCLR _PRNT "OVERFLOW: CLEAR",8D8D8D
|
||||
:FIN
|
||||
RTS
|
||||
:LEFT DS 1
|
||||
:RIGHT DS 1
|
||||
HEXTAB ASC "0123456789ABCDEF"
|
||||
__ERR
|
||||
JSR __RSAV
|
||||
PLA
|
||||
STA RETADR
|
||||
PLA
|
||||
STA RETADR+1
|
||||
PLA
|
||||
STA :DUMPLEN ; LENGTH OF DUMP
|
||||
PLA
|
||||
STA :DUMP ; DUMP ADDRESS LO
|
||||
PLA
|
||||
STA :DUMP+1 ; DUMP HI
|
||||
PLA
|
||||
STA :DMPMSG
|
||||
PLA
|
||||
STA :DMPMSG+1
|
||||
PLA
|
||||
STA :MESG ; ERROR MESSAGE ADDR LO
|
||||
PLA
|
||||
STA :MESG+1 ; HI
|
||||
PLA
|
||||
STA :SRID ; SUBROUTINE ID ADDR LO
|
||||
PLA
|
||||
STA :SRID+1 ; SUB ID HI
|
||||
_PRNT " ",87878787878D8D
|
||||
_PRNT "ERROR!",8D8D
|
||||
_PRNT "SUBROUTINE: "
|
||||
LDY #0
|
||||
LDA :SRID
|
||||
STA ADDR1
|
||||
LDA :SRID+1
|
||||
STA ADDR1+1
|
||||
:LP1
|
||||
LDA (ADDR1),Y
|
||||
BEQ :LPX1
|
||||
JSR $FDF0
|
||||
INY
|
||||
BNE :LP1
|
||||
:LPX1
|
||||
_PRNT " ",8D
|
||||
_PRNT "MESSAGE: "
|
||||
LDY #0
|
||||
LDA :MESG
|
||||
STA ADDR1
|
||||
LDA :MESG+1
|
||||
STA ADDR1+1
|
||||
:LP2
|
||||
LDA (ADDR1),Y
|
||||
BEQ :LPX2
|
||||
JSR $FDF0
|
||||
INY
|
||||
BNE :LP2
|
||||
:LPX2
|
||||
_PRNT " ",8D8D
|
||||
_WAIT
|
||||
LDY #0
|
||||
LDA :DMPMSG
|
||||
STA ADDR1
|
||||
LDA :DMPMSG+1
|
||||
STA ADDR1+1
|
||||
:LP3
|
||||
LDA (ADDR1),Y
|
||||
BEQ :LPX3
|
||||
JSR $FDF0
|
||||
INY
|
||||
BNE :LP3
|
||||
:LPX3
|
||||
_PRNT " ",8D
|
||||
LDA :DUMP+1
|
||||
PHA
|
||||
LDA :DUMP
|
||||
PHA
|
||||
LDA :DUMPLEN
|
||||
PHA
|
||||
JSR __DUMP
|
||||
_WAIT
|
||||
LDA RETADR+1
|
||||
PHA
|
||||
LDA RETADR
|
||||
PHA
|
||||
_PRNT " ",8D8D
|
||||
_WAIT
|
||||
_RDUMP
|
||||
_WAIT
|
||||
LDA ERRSTOP
|
||||
CMP #1
|
||||
BEQ :KILL
|
||||
RTS
|
||||
:KILL
|
||||
JMP $3D0
|
||||
:DUMPLEN DS 1
|
||||
:DUMP DS 2
|
||||
:DMPMSG DS 2
|
||||
:MESG DS 2
|
||||
:SRID DS 2
|
@ -1,134 +0,0 @@
|
||||
********************************
|
||||
* *
|
||||
********************************
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* REQUIRED.MAC *
|
||||
*- -*
|
||||
* MACROS USED FOR CORE UTILS *
|
||||
* AND LIBRARY ROUTINES. NOTE *
|
||||
* THAT THE LIBRARIES DO NOT *
|
||||
* USE THESE MACROS, BUT MAY *
|
||||
* USE THE ROUTINES. THESE ARE *
|
||||
* MERELY PROVIDED FOR THE SAKE *
|
||||
* OF CONVENIENCE. *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* _ISLIT: DETERMINES WHETHER A *
|
||||
* PARAM IS LITERAL OR *
|
||||
* NOT, AND CHANGES *
|
||||
* APPROPRIATELY. FOR *
|
||||
* MACRO USE ONLY. *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
_ISLIT MAC
|
||||
IF #=]1 ; IF ]1 IS A LITERAL
|
||||
LDA ]1/$100 ; GET HI
|
||||
PHA
|
||||
LDA ]1 ; GET LO
|
||||
PHA
|
||||
ELSE ; ]1 IS ADDRESS
|
||||
LDA ]1+1 ; SO GET HIGH VAL FROM ADDR
|
||||
PHA
|
||||
LDA ]1 ; THEN LO VAL
|
||||
PHA
|
||||
FIN
|
||||
<<<
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* _ISSTR: DETERMINES WHETHER A *
|
||||
* PARAM IS A STRING OR *
|
||||
* NOT, AND CHANGES *
|
||||
* APPROPRIATELY. FOR *
|
||||
* MACRO USE ONLY. *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
_ISSTR MAC
|
||||
IF "=]1 ; IF ]1 IS A STRING
|
||||
*
|
||||
** STORE STRING AT TEMP ADDRESS, THEN
|
||||
** PUSH TEMP ADDRESS
|
||||
*
|
||||
JMP STRCONT
|
||||
]STRTMP STR ]1
|
||||
STRCONT
|
||||
LDY #0
|
||||
LDA ]STRTMP
|
||||
STA PARLEN
|
||||
STA PARAM
|
||||
]STRLP1
|
||||
INY
|
||||
LDA ]STRTMP,Y
|
||||
STA PARAM,Y
|
||||
CPY PARLEN
|
||||
BNE ]STRLP1
|
||||
*
|
||||
LDA #>PARAM ; GET HI
|
||||
PHA
|
||||
LDA #<PARAM ; GET LO
|
||||
PHA
|
||||
ELSE ; ]1 IS ADDRESS
|
||||
LDA #>]1 ; SO GET HIBYTE OF ADDR
|
||||
PHA
|
||||
LDA #<]1 ; THEN LOBYTE
|
||||
PHA
|
||||
FIN
|
||||
<<<
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* _GRET: GET RETURN VALUE *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
_GRET MAC
|
||||
LDA #>]1
|
||||
PHA
|
||||
LDA #<]1
|
||||
PHA
|
||||
JSR __GETRET
|
||||
<<<
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* _SPAR: SET PARAMETER *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
_SPAR MAC
|
||||
LDA #>]1
|
||||
PHA
|
||||
LDA #<]1
|
||||
PHA
|
||||
JSR __SETPARM
|
||||
<<<
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* _DUMP: DUMP DATA *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
_DUMP MAC
|
||||
LDA #>]1
|
||||
PHA
|
||||
LDA #<]1
|
||||
PHA
|
||||
LDA ]2
|
||||
PHA
|
||||
JSR __DUMP
|
||||
<<<
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* _PRNT: PRINT STRING *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
_PRNT MAC
|
||||
JSR __P
|
||||
ASC ]1
|
||||
HEX 00
|
||||
<<<
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* _WAIT: WAIT FOR KEYPRESS *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
_WAIT MAC
|
||||
JSR __W
|
||||
<<<
|
||||
*
|
94
disks/disk6_fileio/T.REQUIRED.MAC.MIN
Normal file
94
disks/disk6_fileio/T.REQUIRED.MAC.MIN
Normal file
@ -0,0 +1,94 @@
|
||||
_ISLIT MAC
|
||||
IF #=]1 ; IF ]1 IS A LITERAL
|
||||
LDA ]1/$100 ; GET HI
|
||||
PHA
|
||||
LDA ]1 ; GET LO
|
||||
PHA
|
||||
ELSE ; ]1 IS ADDRESS
|
||||
LDA ]1+1 ; SO GET HIGH VAL FROM ADDR
|
||||
PHA
|
||||
LDA ]1 ; THEN LO VAL
|
||||
PHA
|
||||
FIN
|
||||
<<<
|
||||
_ISSTR MAC
|
||||
IF "=]1 ; IF ]1 IS A STRING
|
||||
JMP STRCONT
|
||||
]STRTMP STR ]1
|
||||
STRCONT
|
||||
LDY #0
|
||||
LDA ]STRTMP
|
||||
STA PARLEN
|
||||
STA PARAM
|
||||
]STRLP1
|
||||
INY
|
||||
LDA ]STRTMP,Y
|
||||
STA PARAM,Y
|
||||
CPY PARLEN
|
||||
BNE ]STRLP1
|
||||
LDA #>PARAM ; GET HI
|
||||
PHA
|
||||
LDA #<PARAM ; GET LO
|
||||
PHA
|
||||
ELSE ; ]1 IS ADDRESS
|
||||
LDA #>]1 ; SO GET HIBYTE OF ADDR
|
||||
PHA
|
||||
LDA #<]1 ; THEN LOBYTE
|
||||
PHA
|
||||
FIN
|
||||
<<<
|
||||
_GRET MAC
|
||||
LDA #>]1
|
||||
PHA
|
||||
LDA #<]1
|
||||
PHA
|
||||
JSR __GETRET
|
||||
<<<
|
||||
_SPAR MAC
|
||||
LDA #>]1
|
||||
PHA
|
||||
LDA #<]1
|
||||
PHA
|
||||
JSR __SETPARM
|
||||
<<<
|
||||
_DUMP MAC
|
||||
LDA #>]1
|
||||
PHA
|
||||
LDA #<]1
|
||||
PHA
|
||||
LDA ]2
|
||||
PHA
|
||||
JSR __DUMP
|
||||
<<<
|
||||
_PRNT MAC
|
||||
JSR __P
|
||||
ASC ]1
|
||||
HEX 00
|
||||
<<<
|
||||
_WAIT MAC
|
||||
JSR __W
|
||||
<<<
|
||||
_RDUMP MAC
|
||||
JSR __RDMP
|
||||
<<<
|
||||
_ERR MAC
|
||||
LDA #>]1
|
||||
PHA
|
||||
LDA #<]1
|
||||
PHA
|
||||
LDA #>]2
|
||||
PHA
|
||||
LDA #<]2
|
||||
PHA
|
||||
LDA #>]3
|
||||
PHA
|
||||
LDA #<]3
|
||||
PHA
|
||||
LDA #>]4
|
||||
PHA
|
||||
LDA #<]4
|
||||
PHA
|
||||
LDA ]5
|
||||
PHA
|
||||
JSR __ERR
|
||||
<<<
|
72
disks/disk6_fileio/T.REQUIRED.VARS
Normal file
72
disks/disk6_fileio/T.REQUIRED.VARS
Normal file
@ -0,0 +1,72 @@
|
||||
*
|
||||
********************************
|
||||
* *
|
||||
* VARIABLES AND SETTINGS *
|
||||
* *
|
||||
********************************
|
||||
*
|
||||
* VARIABLE DECLARATIONS ********
|
||||
*
|
||||
** JUMP TABLE SETUP. THIS IS FOR LOADING
|
||||
** SUBROUTINES INTO MEMORY FOR ACCESS BY
|
||||
** EXTERNAL EXECUTIONS. NOTE THAT THIS
|
||||
** SHOULD ALWAYS BE THE VERY FIRST BIT OF
|
||||
** CODE IN THE PROGRAM SO THAT ITS
|
||||
** LOCATION IN MEMORY IS EASILY KNOWN.
|
||||
*
|
||||
JUMPTBL JMP MAIN_START ; ** ALWAYS ** START WITH
|
||||
; JUMP TO MAIN_START
|
||||
DS 60 ; 20 MORE ENTRIES
|
||||
*
|
||||
** 256 BYTES DEDICATED TO RETURN
|
||||
** VALUES OF VARIABLE LENGTH; CAN BE
|
||||
** MODIFIED TO SUIT SMALLER OR LARGER
|
||||
** NEEDS.
|
||||
*
|
||||
RETLEN DS 1 ; RETURN VALUE BYTE LENGTH
|
||||
RETURN DS 256
|
||||
*
|
||||
** 256 BYTE VALUE DEDICATED TO LARGE
|
||||
** OR VARIABLE LENGTH PARAMETERS. THIS
|
||||
** CAN ALSO BE CHANGED TO FIT SMALLER OR
|
||||
** LARGER BOUNDS.
|
||||
*
|
||||
PARLEN DS 1
|
||||
PARAM DS 256
|
||||
*
|
||||
** ERROR HANDLING
|
||||
*
|
||||
ERRSTOP DS 1
|
||||
ERRCTRL DS 1
|
||||
ERRA DS 1
|
||||
ERRX DS 1
|
||||
ERRY DS 1
|
||||
ERRCARRY DS 1
|
||||
ERRNEG DS 1
|
||||
ERRZERO DS 1
|
||||
ERROVF DS 1
|
||||
*
|
||||
* SETTINGS *********************
|
||||
*
|
||||
MAIN_START
|
||||
*
|
||||
** ERROR HANDLING
|
||||
*
|
||||
** SET ERRSTOP TO 1 IF YOU WANT THE PROGRAM TO
|
||||
** HALT WHEN AN ERROR IS CAUGHT
|
||||
*
|
||||
LDA #1
|
||||
STA ERRSTOP
|
||||
*
|
||||
** SET ERRCTRL TO 1 IF YOU WANT ERROR CATCHING ON
|
||||
** IN THE FIRST PLACE. HAVING THIS TURNED OFF WILL
|
||||
** SAVE A FEW CYCLES, BUT POSSIBLY AT THE EXPENSE
|
||||
** OF YOUR FRUSTRATION. CAN BE TURNED ON LATER THOUGH.
|
||||
*
|
||||
LDA #1
|
||||
STA ERRCTRL
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
@ -1,45 +0,0 @@
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* TXTMODE :: TEXT FILE MODE *
|
||||
*- -*
|
||||
* THIS ROUTINE FOOLS DOS INTO *
|
||||
* THINKING IT IS IN NON- *
|
||||
* IMMEDIATE MODE. THIS IS *
|
||||
* TO ALLOW FOR READING AND *
|
||||
* WRITING OF TEXT FILES. *
|
||||
*- -*
|
||||
* CLOBBERS: *
|
||||
* *
|
||||
* FLAGS: ????---- REG: AXYM *
|
||||
*- -*
|
||||
* CYCLES: ??? *
|
||||
* SIZE: *
|
||||
*- -*
|
||||
* ENTRY *
|
||||
* *
|
||||
* TOP OF STACK *
|
||||
* *
|
||||
* LOW BYTE OF RETURN ADDRESS *
|
||||
* HI BYTE OF RETURN ADDRESS *
|
||||
*- -*
|
||||
* EXIT *
|
||||
* *
|
||||
* TOP OF STACK *
|
||||
* *
|
||||
* LOW BYTE OF RETURN ADDRESS *
|
||||
* HI BYTE OF RETURN ADDRESS *
|
||||
* *
|
||||
* .Y = UNCHANGED *
|
||||
* .X = UNCHANGED *
|
||||
* .A = CLOBBERED; TRASH *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
TXTMODE
|
||||
*
|
||||
LDA #$40
|
||||
STA LANG ; LANG = FP
|
||||
STA CURLIN+1 ; RUNNING PROG
|
||||
LDA #$06
|
||||
STA PROMPT ; NOT DIRECT MODE
|
||||
RTS
|
||||
*
|
@ -1,9 +0,0 @@
|
||||
*
|
||||
TXTMODE
|
||||
*
|
||||
LDA #$40
|
||||
STA LANG
|
||||
STA CURLIN+1
|
||||
LDA #$06
|
||||
STA PROMPT
|
||||
RTS
|
Loading…
Reference in New Issue
Block a user