shave some bytes

This commit is contained in:
4am 2021-06-19 00:59:28 -04:00
parent d435feef86
commit 9ecb49331b
2 changed files with 46 additions and 34 deletions

View File

@ -42,11 +42,12 @@ ERR_EXIST = $47
; ;
; in: ProDOS is in memory ; in: ProDOS is in memory
; caller has filled @mliparam with address of ; caller has filled @mliparam with address of
; pathname, address of data buffer, and maximum ; pathname, address of data buffer, and maximum
; data length ; data length
; out: if C set, open failed and A contains error code ; out: if C set, open failed and A contains error code
; if C clear, open succeeded and A contains ; if C clear, open succeeded and A contains
; file reference number ; file reference number
; preserves X
; ProDOS is in memory ; ProDOS is in memory
;------------------------------- ;-------------------------------
OpenFile OpenFile
@ -62,12 +63,15 @@ OpenFile
;------------------------------- ;-------------------------------
; read an open file via ProDOS MLI ; read an open file via ProDOS MLI
; ;
; in: A = file reference number ; in: ProDOS is in memory
; caller has filled @mliparam with address of ; A = file reference number
; caller has filled @mliparam with address of
; data buffer and maximum data length ; data buffer and maximum data length
; out: if C set, read failed and A contains error code ; out: if C set, read failed and A contains error code
; if C clear, read succeeded and A contains the same ; if C clear, read succeeded and A contains the same
; file reference number that was passed in ; file reference number that was passed in
; preserves X
; ProDOS is in memory
;------------------------------- ;-------------------------------
ReadFile ReadFile
sta mliparam+1 ; store file reference number sta mliparam+1 ; store file reference number
@ -82,12 +86,13 @@ JsrMLIAndReturnPlus1
;------------------------------- ;-------------------------------
; change file position in an open file via ProDOS MLI ; change file position in an open file via ProDOS MLI
; ;
; in: A = file reference number ; in: A = file reference number
; caller has filled @mliparam+2/+3/+4 with ; caller has filled @mliparam+2/+3/+4 with
; new file position ; new file position
; out: if C set, set_mark call failed and A contains error code ; out: if C set, set_mark call failed and A contains error code
; if C clear, set_mark call succeeded and A contains ; if C clear, set_mark call succeeded and A contains
; the same file reference number that was passed in ; the same file reference number that was passed in
; preserves X
;------------------------------- ;-------------------------------
SetMark SetMark
sta mliparam+1 ; store file reference number sta mliparam+1 ; store file reference number
@ -98,12 +103,13 @@ SetMark
;------------------------------- ;-------------------------------
; write to an open file via ProDOS MLI ; write to an open file via ProDOS MLI
; ;
; in: A = file reference number ; in: A = file reference number
; caller has filled @mliparam with address of ; caller has filled @mliparam with address of
; data buffer and data length ; data buffer and data length
; out: if C set, write failed and A contains error code ; out: if C set, write failed and A contains error code
; if C clear, write succeeded and A contains the same ; if C clear, write succeeded and A contains the same
; file reference number that was passed in ; file reference number that was passed in
; preserves X
;------------------------------- ;-------------------------------
WriteFile WriteFile
sta mliparam+1 ; store file reference number sta mliparam+1 ; store file reference number
@ -114,12 +120,13 @@ WriteFile
;------------------------------- ;-------------------------------
; set file size in an open file via ProDOS MLI ; set file size in an open file via ProDOS MLI
; ;
; in: A = file reference number ; in: A = file reference number
; caller has filled @mliparam+2/+3/+4 with ; caller has filled @mliparam+2/+3/+4 with
; new file size ; new file size
; out: if C set, set_eof call failed and A contains error code ; out: if C set, set_eof call failed and A contains error code
; if C clear, set_eof call succeeded and A contains ; if C clear, set_eof call succeeded and A contains
; the same file reference number that was passed in ; the same file reference number that was passed in
; preserves X
;------------------------------- ;-------------------------------
SetEOF SetEOF
sta mliparam+1 ; store file reference number sta mliparam+1 ; store file reference number
@ -129,11 +136,13 @@ SetEOF
;------------------------------- ;-------------------------------
; get volume name of disk in specific slot+drive ; get volume name of disk in specific slot+drive
; in: A = unit number (DSSS0000) ;
; out: if no disk in drive or any MLI error, C set and A contains error code ; in: A = unit number (DSSS0000)
; if disk found, C clear and @VolumeName contains volume name ; out: if no disk in drive or any MLI error, C set and A contains error code
; (up to 15 character name, no leading slash) ; if disk found, C clear and @VolumeName contains volume name
; note: lower 4 bits of @OnlineReturn contain length of @VolumeName ; (up to 15 character name, no leading slash)
; note: lower 4 bits of @OnlineReturn contain length of @VolumeName
; preserves X
;------------------------------- ;-------------------------------
GetVolumeName GetVolumeName
sta mliparam+1 sta mliparam+1
@ -145,11 +154,11 @@ GetVolumeName
;------------------------------- ;-------------------------------
; check if volume is online ; check if volume is online
; using ProDOS MLI ;
; in: caller has filled @mliparam ; in: caller has filled @mliparam with unit number
; with unit number ; out: if error, C set and A contains error code
; out: if error, C set and A contains error code ; if success, C clear
; if success, C clear ; preserves X
;------------------------------- ;-------------------------------
Online Online
lda #CMD_ONLINE lda #CMD_ONLINE
@ -158,12 +167,13 @@ Online
;------------------------------- ;-------------------------------
; query volume information ; query volume information
; using ProDOS MLI ;
; in: @OnlineReturn+@VolumeName contain the length+name of the volume to query ; in: @OnlineReturn+@VolumeName contain the length+name of the volume to query
; (this will be true if you just called GetVolumeName) ; (this will be true if you just called GetVolumeName)
; out: if error, C set and A contains error code ; out: if error, C set and A contains error code
; if success, C clear and MLI buffer is filled ; if success, C clear and MLI buffer is filled
; (access, file type, block count, dates and times) ; (access, file type, block count, dates and times)
; clobbers X/Y
;------------------------------- ;-------------------------------
GetVolumeInfo GetVolumeInfo
lda OnlineReturn lda OnlineReturn
@ -214,6 +224,7 @@ mlicmd !byte 00 ; command number
; A = file reference number ; A = file reference number
; out: if error, C set and A contains error code ; out: if error, C set and A contains error code
; if success, C clear ; if success, C clear
; preserves X
; ProDOS is in memory ; ProDOS is in memory
;------------------------------- ;-------------------------------
CloseFile CloseFile
@ -230,6 +241,7 @@ CloseFile
; caller has filled @mliparam+1 with address of pathname ; caller has filled @mliparam+1 with address of pathname
; out: if error, C set and A contains error code ; out: if error, C set and A contains error code
; if success, C clear ; if success, C clear
; preserves X
; ProDOS is in memory ; ProDOS is in memory
;------------------------------- ;-------------------------------
DeleteFile DeleteFile
@ -246,6 +258,7 @@ DeleteFile
; in: caller has filled @mliparam+1 with address of pathname ; in: caller has filled @mliparam+1 with address of pathname
; out: if error, C set and A contains error code ; out: if error, C set and A contains error code
; if success, C clear and A clobbered ; if success, C clear and A clobbered
; preserves X
;------------------------------- ;-------------------------------
CreateDir CreateDir
lda #$0D lda #$0D

View File

@ -124,15 +124,14 @@ WriteTrackSecondPass
Create140KFile Create140KFile
jsr CreateBinFile jsr CreateBinFile
bcs @exit bcs @exit
lda #$00 ldx #$00
sta mliparam+3 ; io_buffer at address $0800 stx mliparam+3 ; io_buffer at address $0800
lda #$08 lda #$08
sta mliparam+4 sta mliparam+4
jsr OpenFile jsr OpenFile
bcs @deleteAndReturn bcs @deleteAndReturn
ldx #$00 stx mliparam+2 ; X=0 here
stx mliparam+2
ldx #$30 ldx #$30
stx mliparam+3 stx mliparam+3
ldx #$02 ldx #$02