Updated disk image. Builds on Merlin-16 again.

This commit is contained in:
Bobbi Webber-Manners 2021-10-18 18:46:52 -04:00
parent 9f82312da2
commit 8d020183f5
21 changed files with 253 additions and 217 deletions

Binary file not shown.

View File

@ -227,6 +227,8 @@ MAINZP MAC

View File

@ -493,6 +493,8 @@ OSBM2 ASC ').'

View File

@ -465,6 +465,8 @@ BYTE76 LDX #$00 ; Update LEDs and return X=SHIFT

View File

@ -325,3 +325,5 @@ RELCOORD CLC

View File

@ -713,19 +713,19 @@ FREERET
LDA AUXBLK+3 ; MSB of total blks
SBC AUXBLK+1 ; MSB of blocks used
TAY
LDA #$00 ; *TO DO* b16-b23 of free
LDA #$00 ; *TO DO* b16-b23 of free
* NEW
JSR :FREEDEC ; Print 'AAYYXX blocks aaayyyxxx bytes '
JSR :FREEDEC ; Print 'AAYYXX blocks aaayyyxxx bytes '
LDX #<:FREE
LDY #>:FREE
JSR OUTSTR ; Print 'free'<nl>
LDX AUXBLK+0 ; Blocks used
JSR OUTSTR ; Print 'free'<nl>
LDX AUXBLK+0 ; Blocks used
LDY AUXBLK+1
LDA #$00 ; *TO DO* b16-b23 of used
JSR :FREEDEC ; Print 'AAYYXX blocks aaayyyxxx bytes '
LDA #$00 ; *TO DO* b16-b23 of used
JSR :FREEDEC ; Print 'AAYYXX blocks aaayyyxxx bytes '
LDX #<:USED
LDY #>:USED
JMP OUTSTR ; Print 'used'<nl>
JMP OUTSTR ; Print 'used'<nl>
* OLD
* JSR PRDECXY ; Print in decimal
@ -748,20 +748,20 @@ FREERET
STA FSNUM+3
* What's the maximum number of blocks?
* JSR PRHEX ; Blocks b16-b23 in hex
JSR PR2HEX ; Blocks b0-b15 in hex
JSR PR2HEX ; Blocks b0-b15 in hex
LDX #<:BLOCKS
LDY #>:BLOCKS
JSR OUTSTR ; ' blocks '
STZ FSNUM+0 ; FSNUM=blocks*512
JSR OUTSTR ; ' blocks '
STZ FSNUM+0 ; FSNUM=blocks*512
ASL FSNUM+1
ROL FSNUM+2
ROL FSNUM+3
LDX #FSNUM ; X=>number to print
LDY #8 ; Y=pad up to 8 digits
JSR PRINTDEC ; Print it in decimal
LDX #FSNUM ; X=>number to print
LDY #8 ; Y=pad up to 8 digits
JSR PRINTDEC ; Print it in decimal
LDX #<:BYTES
LDY #>:BYTES
JMP OUTSTR ; ' bytes '
JMP OUTSTR ; ' bytes '
:BLOCKS ASC ' blocks '
DB 0
:BYTES ASC ' bytes '
@ -898,13 +898,13 @@ ERRMSG
MKERROR1
CMP #$40
BCS MKERROR2
ORA #$30 ; <$40 -> $30-$3F
ORA #$30 ; <$40 -> $30-$3F
MKERROR2
SEC
SBC #$37
CMP #$28
BCC MKERROR3
LDA #$00 ; I/O error
LDA #$00 ; I/O error
MKERROR3
ASL A
TAX
@ -945,13 +945,14 @@ MKERROR4 DW ERROR27
* $4B - Unsupported storage_type. Disk not recognised
* $4C - End of file has been encountered. End of file
* $4D - Position out of range. Past end of file
* $4E - Access error. (see also $4F) RD/WR: Insufficient access, also Dir not empty
* $4E - Access error. (see also $4F) RD/WR: Insuff access ..
* .. also, dir not empty
* $4F -(Access error. split from $4E) REN/DEL/SAV: Locked
* $50 - File already open. Can't - file open
* $51 - Directory count error. Broken directory
* $52 - Not a ProDOS disk. Disk not recognised
* $53 - Invalid parameter. Invalid parameter
* $54 - (GSOS Out of memory) (Dir not empty when deleting) Dir not empty
* $54 - (GSOS Out of memory) (Dir not empty when deleting)
* $55 - Volume Control Block table full.
* $56 - Bad buffer address.
* $57 - Duplicate volume.
@ -960,7 +961,7 @@ MKERROR4 DW ERROR27
* $5A - Bit map disk address is impossible. Sector not found
* $5B -(GSOS Bad ChangePath pathname)
* $5C -(GSOS Not executable file)
* $5D -(GSOS OS/FS not found) (EOF during load or save) Data lost
* $5D -(GSOS OS/FS not found) (EOF during load or save) Data lost
* $5E -(Couldn't open to save) Can't save
* $5F -(GSOS Too many applications)
* $60+ - (GSOS)
@ -968,67 +969,68 @@ MKERROR4 DW ERROR27
* AcornOS ProDOS
ERROR40 DW $CC00
ASC 'Bad filename' ; $40 - Invalid pathname syntax
ASC 'Bad filename' ; $40 - Invalid pathname syntax
ERROR41 DW $C400
ASC 'Is a directory' ; $41 - Duplicate filename (split from $47)
ASC 'Is a directory' ; $41 - Duplicate filename (split from $47)
ERROR42 DW $C000
ASC 'Too many open' ; $42 - File Control Block table full
ASC 'Too many open' ; $42 - File Control Block table full
ERROR43 DW $DE00
ASC 'Channel not open' ; $43 - Invalid reference number
ERROR44 ; $44 - Path not found
ASC 'Channel not open' ; $43 - Invalid reference number
ERROR44 ; $44 - Path not found
ERROR46 DW $D600
ASC 'File not found' ; $46 - File not found
ASC 'File not found' ; $46 - File not found
ERROR45 DW $D600
ASC 'Disk not found' ; $45 - Volume directory not found
ASC 'Disk not found' ; $45 - Volume directory not found
ERROR47 DW $C400
ASC 'File exists' ; $47 - Duplicate filename (see also $41)
ASC 'File exists' ; $47 - Duplicate filename (see also $41)
ERROR48 DW $C600
ASC 'Disk full' ; $48 - Overrun error
ASC 'Disk full' ; $48 - Overrun error
ERROR49 DW $B300
ASC 'Directory full' ; $49 - Volume directory full
ERROR4A ; $4A - Incompatible file format
ERROR4B ; $4B - Unsupported storage_type
ASC 'Directory full' ; $49 - Volume directory full
ERROR4A ; $4A - Incompatible file format
ERROR4B ; $4B - Unsupported storage_type
ERROR52 DW $C800
ASC 'Disk not recognised' ; $52 - Not a ProDOS disk
ASC 'Disk not recognised' ; $52 - Not a ProDOS disk
ERROR4C DW $DF00
ASC 'End of file' ; $4C - End of file has been encountered
ASC 'End of file' ; $4C - End of file has been encountered
ERROR4D DW $C100
ASC 'Not open for update' ; $4D - Position out of range
ASC 'Not open for update' ; $4D - Position out of range
ERROR4E DW $BD00
ASC 'Insufficient access' ; $4E - Access error (see also $4F)
ASC 'Insufficient access' ; $4E - Access error (see also $4F)
ERROR4F DW $C300
ASC 'Entry locked' ; $4F - Access error (split from $4E)
ASC 'Entry locked' ; $4F - Access error (split from $4E)
ERROR50 DW $C200
ASC 'Can'
DB $27
ASC 't - file open' ; $50 - File is open
ASC 't - file open' ; $50 - File is open
ERROR51 DW $A800
ASC 'Broken directory' ; $51 - Directory count error
ASC 'Broken directory' ; $51 - Directory count error
ERROR53 DW $DC00
ASC 'Invalid parameter' ; $53 - Invalid parameter
ASC 'Invalid parameter' ; $53 - Invalid parameter
ERROR54 DW $D400
ASC 'Directory not empty' ; $54 - Directory not empty
ASC 'Directory not empty' ; $54 - Directory not empty
ERROR55 DW $FF00
ASC 'ProDOS: VCB full' ; $55 - Volume Control Block table full
ASC 'ProDOS: VCB full' ; $55 - Volume Control Block table full
ERROR56 DW $FF00
ASC 'ProDOS: Bad addr' ; $56 - Bad buffer address
ASC 'ProDOS: Bad addr' ; $56 - Bad buffer address
ERROR57 DW $FF00
ASC 'ProDOS: Dup volm' ; $57 - Duplicate volume
ERROR5B ; spare
ASC 'ProDOS: Dup volm' ; $57 - Duplicate volume
ERROR5B ; spare
ERROR27 DW $FF00
ASC 'I/O error' ; $27 - I/O error
ASC 'I/O error' ; $27 - I/O error
ERROR28 DW $D200
ASC 'Disk not present' ; $28 - No device detected/connected
ASC 'Disk not present' ; $28 - No device detected/connected
ERROR5A DW $FF00
ASC 'Sector not found' ; $5A - Bit map disk address is impossible
ASC 'Sector not found' ; $5A - Bit map disk address is impossible
ERROR2B DW $C900
ASC 'Disk write protected' ; $2B - Disk write protected
ASC 'Disk write protected' ; $2B - Disk write protected
ERROR5D DW $CA00
ASC 'Data lost' ; $5D - EOF during LOAD or SAVE
ASC 'Data lost' ; $5D - EOF during LOAD or SAVE
ERROR5E DW $C000
ASC 'Can'
DB $27
ASC 't save' ; $5E - Couldn't open for save
ASC 't save' ; $5E - Couldn't open for save
ERROR2E DW $C800
ASC 'Disk changed' ; $2E - Disk switched
ASC 'Disk changed' ; $2E - Disk switched
DB $00

View File

@ -179,3 +179,5 @@ HELLO ASC 'Applecorn MOS 2021-10-18'

View File

@ -557,6 +557,8 @@ AUXBLK ASC '**ENDOFCODE**'

View File

@ -90,6 +90,8 @@ OSFILECB EQU $2EE ; OSFILE control block

View File

@ -518,6 +518,8 @@ ECHOLP1 JSR GSREAD

View File

@ -1002,3 +1002,5 @@ VDU01 RTS

View File

@ -83,6 +83,8 @@ GEOFCMD EQU $D1

View File

@ -225,3 +225,5 @@ MHGRTAB DW $2000,$2080,$2100,$2180,$2200,$2280,$2300,$2380

View File

@ -129,6 +129,8 @@ RESET TSX

View File

@ -171,3 +171,5 @@ LOADCODE PHP ; Save carry flag

View File

@ -127,4 +127,6 @@ QUITPL HEX 04 ; Number of parameters

View File

@ -164,6 +164,8 @@ ROM8 STR "USERROM2.ROM"

View File

@ -7,193 +7,195 @@
* A1L/A1H: Start address
* A2L/A2H: End address
* A4L/A4H: Destination start address
MEMCPY LDA (A1L)
STA (A4L)
LDA A1H
CMP A2H
BNE :S1
LDA A1L
CMP A2L
BNE :S1
BRA :DONE
:S1 INC A1L
BNE :S2
INC A1H
:S2 INC A4L
BNE :S3
INC A4H
:S3 BRA MEMCPY
:DONE RTS
MEMCPY LDA (A1L)
STA (A4L)
LDA A1H
CMP A2H
BNE :S1
LDA A1L
CMP A2L
BNE :S1
BRA :DONE
:S1 INC A1L
BNE :S2
INC A1H
:S2 INC A4L
BNE :S3
INC A4H
:S3 BRA MEMCPY
:DONE RTS
* Copy 512 bytes from BLKBUF to AUXBLK in aux LC
COPYAUXBLK >>> ALTZP ; Alt ZP & Alt LC on
LDY #$00
:L1 LDA BLKBUF,Y
STA $C005 ; Write aux mem
STA AUXBLK,Y
STA $C004 ; Write main mem
CPY #$FF
BEQ :S1
INY
BRA :L1
:S1 LDY #$00
:L2 LDA BLKBUF+$100,Y
STA $C005 ; Write aux mem
STA AUXBLK+$100,Y
STA $C004 ; Write main mem
CPY #$FF
BEQ :S2
INY
BRA :L2
:S2 >>> MAINZP ; Alt ZP off, ROM back in
RTS
COPYAUXBLK >>> ALTZP ; Alt ZP & Alt LC on
LDY #$00
:L1 LDA BLKBUF,Y
STA $C005 ; Write aux mem
STA AUXBLK,Y
STA $C004 ; Write main mem
CPY #$FF
BEQ :S1
INY
BRA :L1
:S1 LDY #$00
:L2 LDA BLKBUF+$100,Y
STA $C005 ; Write aux mem
STA AUXBLK+$100,Y
STA $C004 ; Write main mem
CPY #$FF
BEQ :S2
INY
BRA :L2
:S2 >>> MAINZP ; Alt ZP off, ROM back in
RTS
* Search FILEREFS for value in A
* On return, buffer number is in X (or $FF if no bufs)
FINDBUF LDX #$00
:L1 CMP FILEREFS,X
BEQ :END
INX
CPX #$04
BNE :L1
LDX #$FF ; $FF for not found
:END RTS
FINDBUF LDX #$00
:L1 CMP FILEREFS,X
BEQ :END
INX
CPX #$04
BNE :L1
LDX #$FF ; $FF for not found
:END RTS
* Obtain I/O buffer address
* On entry: buffer number in X
* On exit: buffer address in AY
* Carry set if no bufs, clear otherwise
BUFADDR CPX #$00
BNE :S1
LDA #<IOBUF1
LDY #>IOBUF1
BRA :EXIT
:S1 CPX #$01
BNE :S2
LDA #<IOBUF2
LDY #>IOBUF2
BRA :EXIT
:S2 CPX #$02
BNE :S3
LDA #<IOBUF3
LDY #>IOBUF3
BRA :EXIT
:S3 CPX #$03
BNE :NOBUFS
LDA #<IOBUF4
LDY #>IOBUF4
:EXIT CLC
RTS
:NOBUFS SEC
RTS
BUFADDR CPX #$00
BNE :S1
LDA #<IOBUF1
LDY #>IOBUF1
BRA :EXIT
:S1 CPX #$01
BNE :S2
LDA #<IOBUF2
LDY #>IOBUF2
BRA :EXIT
:S2 CPX #$02
BNE :S3
LDA #<IOBUF3
LDY #>IOBUF3
BRA :EXIT
:S3 CPX #$03
BNE :NOBUFS
LDA #<IOBUF4
LDY #>IOBUF4
:EXIT CLC
RTS
:NOBUFS SEC
RTS
* Check if file exists
* Return A=0 if doesn't exist, A=1 file, A=2 dir
EXISTS LDA #<MOSFILE
STA GINFOPL+1
LDA #>MOSFILE
STA GINFOPL+2
JSR GETINFO ; GET_FILE_INFO
BCS :NOEXIST
LDA GINFOPL+7 ; Storage type
CMP #$0D
BCS :DIR ; >= $0D
LDA #$01 ; File
RTS
:DIR LDA #$02
RTS
:NOEXIST LDA #$00
RTS
EXISTS LDA #<MOSFILE
STA GINFOPL+1
LDA #>MOSFILE
STA GINFOPL+2
JSR GETINFO ; GET_FILE_INFO
BCS :NOEXIST
LDA GINFOPL+7 ; Storage type
CMP #$0D
BCS :DIR ; >= $0D
LDA #$01 ; File
RTS
:DIR LDA #$02
RTS
:NOEXIST LDA #$00
RTS
* Copy FILEBLK to AUXBLK in aux memory
* Preserves A
COPYFB PHA
LDX #$00
:L1 LDA FILEBLK,X
TAY
>>> ALTZP ; Alt ZP and LC
TYA
STA AUXBLK,X
>>> MAINZP ; Back to normal
INX
CPX #18 ; 18 bytes in FILEBLK
BNE :L1
PLA
RTS
COPYFB PHA
LDX #$00
:L1 LDA FILEBLK,X
TAY
>>> ALTZP ; Alt ZP and LC
TYA
STA AUXBLK,X
>>> MAINZP ; Back to normal
INX
CPX #18 ; 18 bytes in FILEBLK
BNE :L1
PLA
RTS
* Get file info
GETINFO JSR MLI
DB GINFOCMD
DW GINFOPL
RTS
GETINFO JSR MLI
DB GINFOCMD
DW GINFOPL
RTS
* Set file info
SETINFO LDA #$07 ; SET_FILE_INFO 7 parms
STA GINFOPL
JSR MLI
DB SINFOCMD
DW GINFOPL ; Re-use PL from GFI
LDA #$0A ; GET_FILE_INFO 10 parms
STA GINFOPL
RTS
SETINFO LDA #$07 ; SET_FILE_INFO 7 parms
STA GINFOPL
JSR MLI
DB SINFOCMD
DW GINFOPL ; Re-use PL from GFI
LDA #$0A ; GET_FILE_INFO 10 parms
STA GINFOPL
RTS
* Create disk file
* Uses filename in MOSFILE
CRTFILE JSR MLI ; GET_TIME
DB GTIMECMD
LDA #<MOSFILE
STA CREATEPL+1
LDA #>MOSFILE
STA CREATEPL+2
LDA #$C3 ; Open permissions
STA CREATEPL+3
LDA $BF90 ; Current date
STA CREATEPL+8
LDA $BF91
STA CREATEPL+9
LDA $BF92 ; Current time
STA CREATEPL+10
LDA $BF93
STA CREATEPL+11
JSR MLI
DB CREATCMD
DW CREATEPL
RTS
CRTFILE JSR MLI ; GET_TIME
DB GTIMECMD
LDA #<MOSFILE
STA CREATEPL+1
LDA #>MOSFILE
STA CREATEPL+2
LDA #$C3 ; Open permissions
STA CREATEPL+3
LDA $BF90 ; Current date
STA CREATEPL+8
LDA $BF91
STA CREATEPL+9
LDA $BF92 ; Current time
STA CREATEPL+10
LDA $BF93
STA CREATEPL+11
JSR MLI
DB CREATCMD
DW CREATEPL
RTS
* Open disk file
OPENMOSFILE LDA #<MOSFILE ; Open filename in MOSFILE
STA OPENPL+1
LDA #>MOSFILE
STA OPENPL+2
OPENFILE JSR MLI
DB OPENCMD
DW OPENPL
RTS
OPENMOSFILE LDA #<MOSFILE ; Open filename in MOSFILE
STA OPENPL+1
LDA #>MOSFILE
STA OPENPL+2
OPENFILE JSR MLI
DB OPENCMD
DW OPENPL
RTS
* Close disk file
CLSFILE JSR MLI
DB CLSCMD
DW CLSPL
RTS
CLSFILE JSR MLI
DB CLSCMD
DW CLSPL
RTS
* Read 512 bytes into BLKBUF
RDFILE JSR MLI
DB READCMD
DW READPL
RTS
RDFILE JSR MLI
DB READCMD
DW READPL
RTS
* Write data in BLKBUF to disk
WRTFILE JSR MLI
DB WRITECMD
DW WRITEPL
RTS
WRTFILE JSR MLI
DB WRITECMD
DW WRITEPL
RTS
* Put ProDOS prefix in PREFIX
GETPREF JSR MLI
DB GPFXCMD
DW GPFXPL
RTS
GETPREF JSR MLI
DB GPFXCMD
DW GPFXPL
RTS
* Map of file reference numbers to IOBUF1..4
FILEREFS DB $00,$00,$00,$00
FILEREFS DB $00,$00,$00,$00

View File

@ -311,6 +311,8 @@ PREFIX DS 65 ; Buffer for ProDOS prefix

View File

@ -612,7 +612,6 @@ READDATA STA READPL+1
:EXITOK LDA #$00 ; $00=Success
:EXITERR RTS
* ProDOS file handling for MOS OSFILE SAVE call
* Invoked by AppleMOS OSFILE
* Return A=01 if successful (ie: 'file')
@ -621,10 +620,10 @@ SAVEFILE >>> ENTMAIN
SEC ; Compute file length
LDA FBEND+0
SBC FBSTRT+0
STA :LENREM+0
STA LENREM+0
LDA FBEND+1
SBC FBSTRT+1
STA :LENREM+1
STA LENREM+1
LDA FBEND+2
SBC FBSTRT+2
BNE :TOOBIG ; >64K
@ -683,29 +682,29 @@ SAVEFILE >>> ENTMAIN
* A=channel, FBSTRT+0/1=address to save from
* :LENREM+0/1=length to write
* LENREM+0/1=length to write
WRITEDATA STA WRITEPL+1
:L1 LDA #$00 ; 512 bytes request count
STA WRITEPL+4
LDA #$02
STA WRITEPL+5
LDA :LENREM+1
LDA LENREM+1
CMP #$02
BCS :L15 ; More than 511 bytes remaining
STA WRITEPL+5
LDA :LENREM+0
LDA LENREM+0
STA WRITEPL+4
ORA WRITEPL+5
BEQ :SAVEOK ; Zero bytes remaining
:L15 SEC
LDA :LENREM+0 ; LENREM=LENREM-count
LDA LENREM+0 ; LENREM=LENREM-count
SBC WRITEPL+4
STA :LENREM+0
LDA :LENREM+1
STA LENREM+0
LDA LENREM+1
SBC WRITEPL+5
STA :LENREM+1
STA LENREM+1
CLC
LDA FBSTRT+0
@ -739,8 +738,7 @@ WRITEDATA STA WRITEPL+1
JMP :L1 ; Loop back for next block
:SAVEOK ; Enter here with A=$00
:WRITEERR RTS
:LENREM DW $0000 ; Remaining length
LENREM DW $0000 ; Remaining length
CREATEFILE LDA #$01 ; Storage type - file
STA CREATEPL+7

View File

@ -405,6 +405,8 @@ MATCHBUF DS 65 ; For storing match results (Pascal str)