mirror of
https://github.com/gungwald/prodos-more.git
synced 2024-12-11 09:49:29 +00:00
Merge branch 'master' of https://github.com/gungwald/prodos-more
This commit is contained in:
commit
03e150d7ec
2
Makefile
2
Makefile
@ -37,7 +37,7 @@ DSK=$(PGM).dsk
|
|||||||
|
|
||||||
$(DSK): $(PGM)
|
$(DSK): $(PGM)
|
||||||
$(COPY) $(BASE_DSK) $(DSK)
|
$(COPY) $(BASE_DSK) $(DSK)
|
||||||
$(AC) -p $(DSK) $(PGM) BIN 0x08000 < $(PGM)
|
$(AC) -p $(DSK) $(PGM) BIN 0x8000 < $(PGM)
|
||||||
|
|
||||||
$(PGM): $(SRC) Makefile
|
$(PGM): $(SRC) Makefile
|
||||||
merlin32 --verbose $(SRC)
|
merlin32 --verbose $(SRC)
|
||||||
|
53
more.s
53
more.s
@ -24,11 +24,14 @@ MLI equ $bf00
|
|||||||
|
|
||||||
* ProDOS system call command codes
|
* ProDOS system call command codes
|
||||||
OPEN equ $c8
|
OPEN equ $c8
|
||||||
|
READ equ $ca
|
||||||
CLOSE equ $cc
|
CLOSE equ $cc
|
||||||
|
|
||||||
* Constants
|
* Constants
|
||||||
|
EOF equ $4c ; End of file
|
||||||
ADDR equ $06
|
ADDR equ $06
|
||||||
MAX_EC equ $5a ; The largest error code
|
MAX_EC equ $5a ; The largest error code
|
||||||
|
CR equ $0d ; Carriage return
|
||||||
|
|
||||||
|
|
||||||
WRITE_CHAR mac
|
WRITE_CHAR mac
|
||||||
@ -86,6 +89,10 @@ COPY_BYTE mac
|
|||||||
sta ]2
|
sta ]2
|
||||||
eom
|
eom
|
||||||
|
|
||||||
|
* Starting at $9000 because:
|
||||||
|
* $800 overwrites Applesoft
|
||||||
|
* $803 is where Applesoft programs start
|
||||||
|
* $2000 is where the current .SYSTEM program is loaded
|
||||||
|
|
||||||
mainProgram
|
mainProgram
|
||||||
org $8000
|
org $8000
|
||||||
@ -95,11 +102,34 @@ mainProgram
|
|||||||
lda #>fileName
|
lda #>fileName
|
||||||
sta oPathPtr+1
|
sta oPathPtr+1
|
||||||
|
|
||||||
jsr MLI
|
openFile jsr MLI
|
||||||
db OPEN
|
db OPEN
|
||||||
da openParams
|
da openParams
|
||||||
bne openErrorHandler
|
bne openErrorHandler
|
||||||
pmc COPY_BYTE,fileNum;closeNum
|
|
||||||
|
readFile pmc COPY_BYTE,fileNum;readNum
|
||||||
|
readNext jsr MLI
|
||||||
|
db READ
|
||||||
|
da readParams
|
||||||
|
cmp #EOF
|
||||||
|
beq closeFile
|
||||||
|
cmp #0
|
||||||
|
bne readErrorHandler
|
||||||
|
|
||||||
|
writeScreen
|
||||||
|
ldy #0
|
||||||
|
sty lineCount
|
||||||
|
sty charCount
|
||||||
|
nextChar lda readIoBuf,y
|
||||||
|
jsr COUT
|
||||||
|
cmp $0d
|
||||||
|
bne continue
|
||||||
|
inc lineCount
|
||||||
|
continue inc charCount
|
||||||
|
iny
|
||||||
|
jmp nextChar
|
||||||
|
|
||||||
|
closeFile pmc COPY_BYTE,fileNum;closeNum
|
||||||
jsr MLI
|
jsr MLI
|
||||||
db CLOSE
|
db CLOSE
|
||||||
dw closeParams
|
dw closeParams
|
||||||
@ -109,6 +139,10 @@ openErrorHandler
|
|||||||
sta errorCode
|
sta errorCode
|
||||||
pmc WRITE_ASC,openFailureText
|
pmc WRITE_ASC,openFailureText
|
||||||
jmp errorHandler
|
jmp errorHandler
|
||||||
|
readErrorHandler
|
||||||
|
sta errorCode
|
||||||
|
pmc WRITE_ASC,readFailureText
|
||||||
|
jmp errorHandler
|
||||||
closeErrorHandler
|
closeErrorHandler
|
||||||
sta errorCode
|
sta errorCode
|
||||||
pmc WRITE_ASC,closeFailureText
|
pmc WRITE_ASC,closeFailureText
|
||||||
@ -152,17 +186,26 @@ endMain
|
|||||||
|
|
||||||
openParams db 3 ; Parameter count
|
openParams db 3 ; Parameter count
|
||||||
oPathPtr ds 2 ; Input param - file to open
|
oPathPtr ds 2 ; Input param - file to open
|
||||||
oBufPtr da inBuf ; Input param - I/O buffer
|
oBufPtr da openIoBuf ; Input param - I/O buffer
|
||||||
fileNum ds 1 ; Output param - file ref num
|
fileNum ds 1 ; Output param - file ref num
|
||||||
|
|
||||||
|
readParams db 4
|
||||||
|
readNum ds 1
|
||||||
|
da readIoBuf
|
||||||
|
reqCount dw 512
|
||||||
|
transCount ds 2
|
||||||
|
|
||||||
closeParams db 1 ; Parameter count
|
closeParams db 1 ; Parameter count
|
||||||
closeNum db 0 ; Input param - ref num to close
|
closeNum db 0 ; Input param - ref num to close
|
||||||
|
|
||||||
fileName db 4
|
fileName db 4
|
||||||
asc "BLAH"
|
asc "BLAH"
|
||||||
|
|
||||||
|
charCount ds 2
|
||||||
|
|
||||||
errorCode db 0
|
errorCode db 0
|
||||||
openFailureText asc "FAILED TO OPEN FILE ",00
|
openFailureText asc "FAILED TO OPEN FILE ",00
|
||||||
|
readFailureText asc "FAILED TO READ FILE ",00
|
||||||
closeFailureText asc "FAILED TO CLOSE FILE ",00
|
closeFailureText asc "FAILED TO CLOSE FILE ",00
|
||||||
errorCodeText asc "(ERROR CODE ",00
|
errorCodeText asc "(ERROR CODE ",00
|
||||||
|
|
||||||
@ -265,6 +308,7 @@ ec3d da $0000
|
|||||||
ec3e da $0000
|
ec3e da $0000
|
||||||
ec3f da $0000
|
ec3f da $0000
|
||||||
ec40 da em40
|
ec40 da em40
|
||||||
|
ec41 da $0000
|
||||||
ec42 da em42
|
ec42 da em42
|
||||||
ec43 da $0000
|
ec43 da $0000
|
||||||
ec44 da em44
|
ec44 da em44
|
||||||
@ -297,5 +341,6 @@ filler ds \,$00
|
|||||||
*
|
*
|
||||||
* Must start on page boundary
|
* Must start on page boundary
|
||||||
*
|
*
|
||||||
inBuf ds 1024
|
openIoBuf ds 1024
|
||||||
|
readIoBuf ds 512
|
||||||
|
|
||||||
|
BIN
prodos-2.0.3-boot.dsk
Normal file
BIN
prodos-2.0.3-boot.dsk
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user