mirror of
https://github.com/a2-4am/pitch-dark.git
synced 2024-06-15 16:29:38 +00:00
.
This commit is contained in:
parent
5fc1c1c76d
commit
73dff5ae40
34
src/path.a
34
src/path.a
|
@ -71,3 +71,37 @@ SetStartupPath
|
||||||
bpl -
|
bpl -
|
||||||
rts
|
rts
|
||||||
}
|
}
|
||||||
|
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
; CreateNullTerminatedString
|
||||||
|
; Copy a length-prefixed string to kNullTerminatedBuffer and null-terminate it.
|
||||||
|
; Destination string is left-padded with a single space because reasons.
|
||||||
|
; Maximum length is 127 bytes.
|
||||||
|
;
|
||||||
|
; in: A/Y contains address of length-prefixed string to copy
|
||||||
|
; X contains length of null-terminated string -- if > length of source,
|
||||||
|
; remaining buffer will be padded with spaces (#$A0)
|
||||||
|
; out: all registers and flags clobbered
|
||||||
|
; $00/$01 clobbered
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
!zone {
|
||||||
|
CreateNullTerminatedString
|
||||||
|
+STAY $00
|
||||||
|
|
||||||
|
phx
|
||||||
|
lda #$A0
|
||||||
|
- dex
|
||||||
|
sta kNullTerminatedBuffer,x
|
||||||
|
bpl -
|
||||||
|
plx
|
||||||
|
lda #$00
|
||||||
|
sta kNullTerminatedBuffer,x
|
||||||
|
|
||||||
|
lda ($00)
|
||||||
|
tay
|
||||||
|
- lda ($00),y
|
||||||
|
sta kNullTerminatedBuffer,y
|
||||||
|
dey
|
||||||
|
bne -
|
||||||
|
rts
|
||||||
|
}
|
||||||
|
|
46
src/prodos.a
46
src/prodos.a
|
@ -15,6 +15,7 @@
|
||||||
CMD_QUIT = $65 ; quit to ProDOS
|
CMD_QUIT = $65 ; quit to ProDOS
|
||||||
CMD_CREATE = $C0 ; create new file
|
CMD_CREATE = $C0 ; create new file
|
||||||
CMD_DESTROY = $C1 ; delete a file
|
CMD_DESTROY = $C1 ; delete a file
|
||||||
|
CMD_GETFILEINFO = $C4 ; get file (or volume) info
|
||||||
CMD_SETPREFIX= $C6 ; change default pathname prefix
|
CMD_SETPREFIX= $C6 ; change default pathname prefix
|
||||||
CMD_OPEN = $C8 ; open a file
|
CMD_OPEN = $C8 ; open a file
|
||||||
CMD_READ = $CA ; read an open file
|
CMD_READ = $CA ; read an open file
|
||||||
|
@ -25,6 +26,7 @@ CMD_CLOSE = $CC ; close an open file
|
||||||
PC_QUIT = $04
|
PC_QUIT = $04
|
||||||
PC_CREATE = $07
|
PC_CREATE = $07
|
||||||
PC_DESTROY = $01
|
PC_DESTROY = $01
|
||||||
|
PC_GETFILEINFO = $0A
|
||||||
PC_SETPREFIX = $01
|
PC_SETPREFIX = $01
|
||||||
PC_OPEN = $03
|
PC_OPEN = $03
|
||||||
PC_READ = $04
|
PC_READ = $04
|
||||||
|
@ -265,6 +267,34 @@ SetPrefix
|
||||||
jmp _setprefix
|
jmp _setprefix
|
||||||
}
|
}
|
||||||
|
|
||||||
|
;-------------------------------
|
||||||
|
; GetFileInfo
|
||||||
|
; just what it says on the tin
|
||||||
|
;
|
||||||
|
; in: stack contains 2 bytes of parameters:
|
||||||
|
; +1 address of pathname
|
||||||
|
; out: if C set, MLI call failed and A contains error code
|
||||||
|
; from open or read
|
||||||
|
; if C clear, MLI call succeeded and mliparam contains
|
||||||
|
; all the info
|
||||||
|
; all other flags clobbered
|
||||||
|
; all registers clobbered
|
||||||
|
; stack set to next instruction after parameters
|
||||||
|
;-------------------------------
|
||||||
|
!zone {
|
||||||
|
GetFileInfo
|
||||||
|
+PARAMS_ON_STACK 2
|
||||||
|
|
||||||
|
ldy #$01
|
||||||
|
lda (PARAM),y ; lo byte of pathname
|
||||||
|
sta mliparam+1
|
||||||
|
iny
|
||||||
|
lda (PARAM),y ; hi byte of pathname
|
||||||
|
sta mliparam+2
|
||||||
|
|
||||||
|
jmp _getfileinfo
|
||||||
|
}
|
||||||
|
|
||||||
;-------------------------------
|
;-------------------------------
|
||||||
; open file via ProDOS MLI
|
; open file via ProDOS MLI
|
||||||
;
|
;
|
||||||
|
@ -391,6 +421,20 @@ _setprefix
|
||||||
jsr mli
|
jsr mli
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
;-------------------------------
|
||||||
|
; get file info via ProDOS MLI
|
||||||
|
;
|
||||||
|
; in: caller has filled @mliparam with address of
|
||||||
|
; pathname
|
||||||
|
; out: if C set, open failed and A contains error code
|
||||||
|
; if C clear, open succeeded and A contains
|
||||||
|
; file reference number
|
||||||
|
;-------------------------------
|
||||||
|
_getfileinfo
|
||||||
|
lda #CMD_GETFILEINFO ; MLI command
|
||||||
|
ldy #CMD_GETFILEINFO ; number of parameters for 'getfileinfo' command
|
||||||
|
jmp mli
|
||||||
|
|
||||||
;-------------------------------
|
;-------------------------------
|
||||||
QuitToProDOS
|
QuitToProDOS
|
||||||
lda #CMD_QUIT
|
lda #CMD_QUIT
|
||||||
|
@ -420,7 +464,7 @@ filetype !byte $FE ; file type (set by MLI get_file_info)
|
||||||
auxtype ; auxiliary file type (2 bytes, set by MLI get_file_info)
|
auxtype ; auxiliary file type (2 bytes, set by MLI get_file_info)
|
||||||
refnum !byte $FE ; file refnum (set by MLI open)
|
refnum !byte $FE ; file refnum (set by MLI open)
|
||||||
mlilen !byte $FE,$FE ; file length (set by MLI read)
|
mlilen !byte $FE,$FE ; file length (set by MLI read)
|
||||||
blocks !byte $FE,$FE ; blocks used (set by getvolumeinfo)
|
blocks !byte $FE,$FE ; blocks used (set by getvolumeinfo/getfileinfo)
|
||||||
; member is also used by createfile
|
; member is also used by createfile
|
||||||
!byte $FE,$FE,$FE,$FE,$FE,$FE,$FE,$FE
|
!byte $FE,$FE,$FE,$FE,$FE,$FE,$FE,$FE
|
||||||
; used by get_file_info
|
; used by get_file_info
|
||||||
|
|
|
@ -144,44 +144,34 @@ paintInfoView
|
||||||
jsr WeeGUI
|
jsr WeeGUI
|
||||||
+LDAY addrInfo
|
+LDAY addrInfo
|
||||||
ldx #kInfoPaintWidth
|
ldx #kInfoPaintWidth
|
||||||
phx
|
|
||||||
jsr multiPrint
|
jsr multiPrint
|
||||||
plx
|
|
||||||
lda #$A0
|
|
||||||
- sta kNullTerminatedBuffer,x
|
|
||||||
dex
|
|
||||||
bpl -
|
|
||||||
lda #$00
|
|
||||||
sta kNullTerminatedBuffer+kInfoPaintWidth
|
|
||||||
|
|
||||||
jsr okvs_get ; get shortname of current game
|
jsr okvs_get ; get shortname of current game
|
||||||
!word gGlobalPrefsStore
|
!word gGlobalPrefsStore
|
||||||
!word kLastPlayed
|
!word kLastPlayed
|
||||||
+STAY +
|
+STAY + ; A/Y contains address
|
||||||
|
|
||||||
jsr okvs_get ; get selected version of this game
|
jsr okvs_get ; get selected version of this game
|
||||||
!word gGlobalPrefsStore
|
!word gGlobalPrefsStore
|
||||||
+ !word $FDFD ; SMC
|
+ !word $FDFD ; SMC
|
||||||
+STAY +
|
+STAY + ; A/Y contains address
|
||||||
|
|
||||||
jsr okvs_get ; get long description of this version
|
jsr okvs_get ; get long description of this version
|
||||||
!word gVersionsStore
|
!word gVersionsStore
|
||||||
+ !word $FDFD ; SMC
|
+ !word $FDFD ; SMC
|
||||||
+STAY SRC
|
; A/Y contains address
|
||||||
lda (SRC)
|
ldx #kInfoPaintWidth
|
||||||
tay
|
jsr CreateNullTerminatedString
|
||||||
- lda (SRC),y
|
|
||||||
sta $3F00,y
|
+LDADDR kNullTerminatedBuffer
|
||||||
dey
|
bra multiPrintWhereYouAre
|
||||||
bne -
|
|
||||||
stz $00
|
|
||||||
lda #$3F
|
|
||||||
sta $01
|
|
||||||
jmp .printLoop
|
|
||||||
|
|
||||||
multiPrint
|
multiPrint
|
||||||
+STAY $00
|
|
||||||
stx .printLineLength+1
|
stx .printLineLength+1
|
||||||
stz .htab+1
|
stz .htab+1
|
||||||
stz .vtab+1
|
stz .vtab+1
|
||||||
|
multiPrintWhereYouAre
|
||||||
|
+STAY $00
|
||||||
.printLoop
|
.printLoop
|
||||||
lda ($00)
|
lda ($00)
|
||||||
beq .printDone
|
beq .printDone
|
||||||
|
|
Loading…
Reference in New Issue
Block a user