mirror of
https://github.com/nathanriggs/AppleIIAsm-Collection.git
synced 2024-12-11 09:49:17 +00:00
03636aa196
- various bugfixes - integrated required library - created minified sources - made macros slightly more flexible
335 lines
8.6 KiB
Plaintext
335 lines
8.6 KiB
Plaintext
*
|
|
*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*
|
|
* *
|
|
* FILEIO.MAC *
|
|
* *
|
|
* 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 *
|
|
* *
|
|
*------------------------------*
|
|
* *
|
|
* THIS IS A MACRO LIBRARY FOR *
|
|
* FILE INPUT AND OUTPUT, AS *
|
|
* WELL AS DISK OPERATIONS. *
|
|
* *
|
|
*------------------------------*
|
|
* *
|
|
* LIST OF MACROS *
|
|
* *
|
|
* BSAVE : BINARY SAVE *
|
|
* BLOAD : BINARY LOAD *
|
|
* TMODE : TEXT FILE OP MODE *
|
|
* CMD : EXECUTE DOS COMMAND *
|
|
* FPRN : PRINT TO FILE *
|
|
* FINP : INPUT LINE FROM FILE *
|
|
* SLOT : SET RWTS SLOT *
|
|
* DRIVE : SET RWTS DRIVE *
|
|
* TRACK : SET RWTS TRACK *
|
|
* SECT : SET RWTS SECTOR *
|
|
* SETDR : SET RWTS READ *
|
|
* SETDW : SET RWTS WRITE *
|
|
* DBUFF : SET BUFFER ADDRESS *
|
|
* DRWTS : CALL THE RWTS ROUTE *
|
|
* *
|
|
*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*
|
|
*
|
|
*``````````````````````````````*
|
|
* BLOAD : LOAD A BINARY FILE *
|
|
*- -*
|
|
* LOAD INTO THE GIVEN ADDRESS *
|
|
* THE SPECIFIED BINARY FILE. *
|
|
*- -*
|
|
* PARAMETERS: *
|
|
* *
|
|
* ]1 = ADDRESS OF CMD STR *
|
|
*- -*
|
|
* SAMPLE USAGE: *
|
|
* BLOAD "TEST,A$300" *
|
|
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
|
*
|
|
BLOAD MAC
|
|
_ISSTR ]1
|
|
JSR BINLOAD
|
|
<<<
|
|
*
|
|
*``````````````````````````````*
|
|
* BSAVE : SAVE TO BINARY FILE *
|
|
*- -*
|
|
* SAVE THE GIVEN ADDRESS RANGE *
|
|
* TO THE SPECIFIED FILE NAME. *
|
|
*- -*
|
|
* PARAMETERS: *
|
|
* *
|
|
* ]1 = ADDRESS OF CDM STR *
|
|
*- -*
|
|
* SAMPLE USAGE: *
|
|
* BSAVE "TEST,A$300,L$100" *
|
|
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
|
*
|
|
BSAVE MAC
|
|
_ISSTR ]1
|
|
JSR BINSAVE
|
|
<<<
|
|
*
|
|
*``````````````````````````````*
|
|
* TMODE : INIT TXTFILE OP MODE *
|
|
*- -*
|
|
* FOOLS DOS INTO THINKING THAT *
|
|
* WE ARE IN INDIRECT MODE TO *
|
|
* ALLOW FOR TEXT FILE READ AND *
|
|
* WRITE OPERATIONS. *
|
|
*- -*
|
|
* SAMPLE USAGE: *
|
|
* TMODE *
|
|
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
|
*
|
|
TMODE MAC
|
|
JSR TXTMODE
|
|
<<<
|
|
*
|
|
*``````````````````````````````*
|
|
* CMD : EXECUTE DOS COMMAND *
|
|
*- -*
|
|
* SIMPLY EXECUTES THE DOS CMD *
|
|
* AS IT IS PROVIDED IN THE *
|
|
* STRING PASSED AS PARAMETER 1 *
|
|
*- -*
|
|
* PARAMETERS: *
|
|
* *
|
|
* ]1 = COMMAND STRING *
|
|
*- -*
|
|
* SAMPLE USAGE: *
|
|
* CMD "CATALOG" *
|
|
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
|
*
|
|
CMD MAC
|
|
JSR DOSCMD
|
|
ASC ]1
|
|
HEX 8D00
|
|
<<<
|
|
*
|
|
*``````````````````````````````*
|
|
* FPRN : PRINT LINE TO FILE *
|
|
*- -*
|
|
* PRINTS THE GIVEN STRING TO *
|
|
* THE FILE THAT IS OPEN FOR *
|
|
* WRITING. IF MEMORY ADDRESS *
|
|
* IS PASSED, THEN PRINT THE *
|
|
* STRING THAT IS AT THAT *
|
|
* LOCATION. *
|
|
*- -*
|
|
* PARAMETERS: *
|
|
* *
|
|
* ]1 = EITHER A STRING OR *
|
|
* MEMLOC OF STRING *
|
|
*- -*
|
|
* SAMPLE USAGE: *
|
|
* FPRN "TESTING" *
|
|
* FPRN $300 *
|
|
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
|
*
|
|
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 : GET LINE FROM TXTFILE *
|
|
*- -*
|
|
* GETS A LINE OF TEXT FROM THE *
|
|
* FILE OPEN FOR READING AND *
|
|
* STORES IT AD THE ADDRRESS *
|
|
* SPECIFIED IN THE PARAMETERS. *
|
|
*- -*
|
|
* PARAMETERS: *
|
|
* *
|
|
* ]1 = ADDRESS OF CDM STR *
|
|
*- -*
|
|
* SAMPLE USAGE: *
|
|
* FINP $300 *
|
|
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
|
*
|
|
FINP MAC
|
|
LDA #>]1
|
|
PHA
|
|
LDA #<]1
|
|
PHA
|
|
JSR FINPUT
|
|
<<<
|
|
*
|
|
*``````````````````````````````*
|
|
* SLOT : CHANGE RWTS IOB SLOT *
|
|
*- -*
|
|
* CHANGES THE SLOT VALUE IN *
|
|
* THE IOB TABLE FOR THE RWTS *
|
|
* ROUTINE. JUST USES DOS IOB. *
|
|
*- -*
|
|
* PARAMETERS: *
|
|
* *
|
|
* ]1 = SLOT NUMBER *
|
|
*- -*
|
|
* SAMPLE USAGE: *
|
|
* SLOT #6 *
|
|
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
|
*
|
|
SLOT MAC
|
|
*
|
|
LDA ]1
|
|
STA SCRATCH
|
|
ASL SCRATCH
|
|
ASL SCRATCH
|
|
ASL SCRATCH
|
|
ASL SCRATCH ; MUL BY 16
|
|
LDA SCRATCH
|
|
STA IOB_SLOT
|
|
<<<
|
|
*
|
|
*``````````````````````````````*
|
|
* DRIVE : CHANGE RWTSIOB DRIVE *
|
|
*- -*
|
|
* CHANGES THE DRIVE VALUE IN *
|
|
* THE IOB TABLE FOR THE RWTS *
|
|
* ROUTINE. JUST USES DOS IOB. *
|
|
*- -*
|
|
* PARAMETERS: *
|
|
* *
|
|
* ]1 = DRIVE NUMBER *
|
|
*- -*
|
|
* SAMPLE USAGE: *
|
|
* DRIVE #1 *
|
|
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
|
*
|
|
DRIVE MAC
|
|
*
|
|
LDA ]1
|
|
STA IOB_DRIV
|
|
<<<
|
|
*
|
|
*``````````````````````````````*
|
|
* TRACK : CHANGE RWTSIOB TRACK *
|
|
*- -*
|
|
* CHANGES THE TRACK VALUE IN *
|
|
* THE IOB TABLE FOR THE RWTS *
|
|
* ROUTINE. JUST USES DOS IOB. *
|
|
*- -*
|
|
* PARAMETERS: *
|
|
* *
|
|
* ]1 = TRACK NUMBER *
|
|
*- -*
|
|
* SAMPLE USAGE: *
|
|
* TRACK #5 *
|
|
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
|
*
|
|
TRACK MAC
|
|
*
|
|
LDA ]1
|
|
STA IOB_TRAK
|
|
<<<
|
|
*
|
|
*``````````````````````````````*
|
|
* SECT : CHANGE RWTS SECTOR *
|
|
*- -*
|
|
* CHANGES THE SECTOR VALUE IN *
|
|
* THE IOB TABLE FOR THE RWTS *
|
|
* ROUTINE. JUST USES DOS IOB. *
|
|
*- -*
|
|
* PARAMETERS: *
|
|
* *
|
|
* ]1 = SECTOR NUMBER *
|
|
*- -*
|
|
* SAMPLE USAGE: *
|
|
* SECT #3 *
|
|
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
|
*
|
|
SECT MAC
|
|
*
|
|
LDA ]1
|
|
STA IOB_SECT
|
|
<<<
|
|
*
|
|
*``````````````````````````````*
|
|
* SETDR : SET RWTS TO READMODE *
|
|
*- -*
|
|
* CHANGES THE RWTS COMMAND TO *
|
|
* READ ($01). *
|
|
*- -*
|
|
* SAMPLE USAGE: *
|
|
* SETDR *
|
|
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
|
*
|
|
SETDR MAC
|
|
*
|
|
LDA $01
|
|
STA IOB_COMM
|
|
<<<
|
|
*
|
|
*``````````````````````````````*
|
|
* SETDW : SET RWTS TO WRITE *
|
|
*- -*
|
|
* CHANGES THE RWTS COMMAND TO *
|
|
* WRITE ($02). *
|
|
*- -*
|
|
* SAMPLE USAGE: *
|
|
* SETDW *
|
|
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
|
*
|
|
SETDW MAC
|
|
*
|
|
LDA $02
|
|
STA IOB_COMM
|
|
<<<
|
|
*
|
|
*``````````````````````````````*
|
|
* DBUFF : CHANGE RWTS BUFFADDR *
|
|
*- -*
|
|
* CHANGES THE BUFFER ADDRESS *
|
|
* FOR THE RWTS SUBROUTINE *
|
|
*- -*
|
|
* PARAMETERS: *
|
|
* *
|
|
* ]1 = BUFFER ADDRESS *
|
|
*- -*
|
|
* SAMPLE USAGE: *
|
|
* DBUFF $300 *
|
|
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
|
*
|
|
DBUFF MAC
|
|
*
|
|
LDA #<]1
|
|
STA IOB_BUFL
|
|
LDA #>]1
|
|
STA IOB_BUFH
|
|
<<<
|
|
*
|
|
*``````````````````````````````*
|
|
* DRWTS : EXECUTE RWTS ROUTINE *
|
|
*- -*
|
|
* RUNS THE RWTS ROUTINE AFTER *
|
|
* THE APPROPRIATE VARIABLES IN *
|
|
* THE IOB TABLE ARE SET. *
|
|
*- -*
|
|
* SAMPLE USAGE: *
|
|
* RWTS *
|
|
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
|
*
|
|
DRWTS MAC
|
|
*
|
|
JSR DISKOP
|
|
<<<
|