use cheap local labels (requires ACME 0.96.3 or later)

This commit is contained in:
4am 2018-04-19 10:05:48 -04:00
parent 5b27b2aad9
commit 9c15769c3a
16 changed files with 279 additions and 287 deletions

View File

@ -34,6 +34,8 @@ NODEV = $BF10 ; means 'no device connected'
RAM32 = $BF26 ; S3,D2 /RAM device RAM32 = $BF26 ; S3,D2 /RAM device
DEVCNT = $BF31 ; ProDOS device count DEVCNT = $BF31 ; ProDOS device count
DEVLST = $BF32 ; ProDOS device list DEVLST = $BF32 ; ProDOS device list
SPEAKER = $C030 ; used by SoftBell
WAIT = $FCA8
MAGICRTS = $FF58 ; used to set overflow bit MAGICRTS = $FF58 ; used to set overflow bit
; zero page ; zero page

View File

@ -50,14 +50,14 @@ LoadSavedGameInfo
+LDADDR zinfo_base +LDADDR zinfo_base
+STAY ZPTR +STAY ZPTR
ldx #0 ldx #0
.zParseLoop @zParseLoop
+LDAY ZPTR +LDAY ZPTR
pha pha
phy phy
phx phx
jsr ResetPath jsr ResetPath
lda (ZPTR) lda (ZPTR)
beq .saveAndMoveToNextSlot; no saved game in this slot beq @saveAndMoveToNextSlot; no saved game in this slot
inc gSavedGamesSlotsInUse ; update number of slots in use (separate from length of store) inc gSavedGamesSlotsInUse ; update number of slots in use (separate from length of store)
+LDAY ZPTR +LDAY ZPTR
jsr AddToPathWithHighBit ; add location information jsr AddToPathWithHighBit ; add location information
@ -71,7 +71,7 @@ LoadSavedGameInfo
+LDADDR kLeftParen +LDADDR kLeftParen
jsr AddToPathWithHighBit ; add ' (' jsr AddToPathWithHighBit ; add ' ('
lda (ZPTR) lda (ZPTR)
bne .justTime bne @justTime
lda ZPTR lda ZPTR
clc clc
adc #(score_offset-time_offset) adc #(score_offset-time_offset)
@ -91,7 +91,7 @@ LoadSavedGameInfo
inc ZPTR+1 inc ZPTR+1
+ ; A/Y -> ZINFO moves field (length-prefixed string, guaranteed non-empty) + ; A/Y -> ZINFO moves field (length-prefixed string, guaranteed non-empty)
; execution falls through here ; execution falls through here
.justTime @justTime
+LDAY ZPTR +LDAY ZPTR
jsr AddToPathWithHighBit ; add final piece of information (moves or time, depending on how we got here) jsr AddToPathWithHighBit ; add final piece of information (moves or time, depending on how we got here)
+LDADDR kRightParen +LDADDR kRightParen
@ -99,7 +99,7 @@ LoadSavedGameInfo
+LDADDR kNullByte +LDADDR kNullByte
jsr AddToPath ; add 0x00 jsr AddToPath ; add 0x00
; execution falls through here ; execution falls through here
.saveAndMoveToNextSlot @saveAndMoveToNextSlot
plx plx
phx phx
txa txa
@ -130,7 +130,7 @@ LoadSavedGameInfo
inx inx
cpx #zinfo_maxslots cpx #zinfo_maxslots
bcs + bcs +
jmp .zParseLoop jmp @zParseLoop
+ rts + rts
kZINFOFilename kZINFOFilename

View File

@ -130,7 +130,7 @@ okvs_append
+STAY SRC ; SRC -> new key to copy +STAY SRC ; SRC -> new key to copy
lda (SRC) lda (SRC)
inc inc
sta .append_keylen sta @keylen
tay tay
- dey ; copy new key - dey ; copy new key
lda (SRC),y lda (SRC),y
@ -140,7 +140,7 @@ okvs_append
lda PTR ; update PTR to byte after copied key lda PTR ; update PTR to byte after copied key
clc clc
.append_keylen=*+1 @keylen=*+1
adc #$FD ; SMC adc #$FD ; SMC
sta PTR sta PTR
bcc + bcc +
@ -153,7 +153,7 @@ okvs_append
bne + bne +
lda (SRC) ; no max, use actual length instead lda (SRC) ; no max, use actual length instead
inc inc
+ sta .append_valuelen + sta @valuelen
tay tay
- dey - dey
lda (SRC),y lda (SRC),y
@ -163,7 +163,7 @@ okvs_append
lda PTR lda PTR
clc clc
.append_valuelen=*+1 @valuelen=*+1
adc #$FD ; SMC adc #$FD ; SMC
sta SRC sta SRC
bcc + bcc +
@ -198,18 +198,18 @@ okvs_get
+PARAMS_ON_STACK 4 +PARAMS_ON_STACK 4
jsr SetPTRFromStackParams jsr SetPTRFromStackParams
lda (PTR) lda (PTR)
beq .get_fail ; no keys, fail immediately beq @fail ; no keys, fail immediately
tax ; X = number of keys tax ; X = number of keys
inx inx
stx .get_maxkeys stx @maxkeys
ldx #0 ldx #0
jsr incptr ; PTR -> first record jsr incptr ; PTR -> first record
+LDPARAM 3 +LDPARAM 3
+STAY SRC ; SRC -> key we want to find +STAY SRC ; SRC -> key we want to find
lda (SRC) lda (SRC)
inc inc
sta .get_matchlen sta @matchlen
.get_match_record_loop @matchRecordLoop
lda PTR+1 lda PTR+1
sta DEST+1 sta DEST+1
lda PTR lda PTR
@ -219,17 +219,17 @@ okvs_get
bcc + bcc +
inc DEST+1 ; DEST -> key of this record inc DEST+1 ; DEST -> key of this record
+ ldy #0 + ldy #0
.get_match_key_loop @matchKeyLoop
lda (SRC),y lda (SRC),y
cmp (DEST),y cmp (DEST),y
bne .get_next bne @next
iny iny
.get_matchlen=*+1 @matchlen=*+1
cpy #$FD ; SMC cpy #$FD ; SMC
bne .get_match_key_loop bne @matchKeyLoop
+LDAY PTR +LDAY PTR
clc clc
adc .get_matchlen adc @matchlen
bcc + bcc +
iny iny
+ clc + clc
@ -239,14 +239,12 @@ okvs_get
iny iny
clc clc
+ rts + rts
.get_next @next jsr derefptr ; PTR -> next record
jsr derefptr ; PTR -> next record
inx inx
.get_maxkeys=*+1 @maxkeys=*+1
cpx #$FD ; SMC cpx #$FD ; SMC
bne .get_match_record_loop bne @matchRecordLoop
.get_fail @fail sec
sec
rts rts
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
@ -268,11 +266,11 @@ okvs_nth
ldy #3 ldy #3
lda (PARAM),y lda (PARAM),y
tax ; X = numeric index of key to get tax ; X = numeric index of key to get
beq + beq @found
- jsr derefptr - jsr derefptr
dex dex
bne - bne -
+ jsr incptr @found jsr incptr
jsr incptr jsr incptr
+LDAY PTR +LDAY PTR
rts rts
@ -302,14 +300,14 @@ okvs_update
sta SAVE sta SAVE
dey dey
- lda (PARAM),y - lda (PARAM),y
sta .getparams,y sta @getparams,y
dey dey
bne - bne -
jsr okvs_get jsr okvs_get
.getparams=*-1 @getparams=*-1
!word $FDFD ; SMC !word $FDFD ; SMC
!word $FDFD ; SMC !word $FDFD ; SMC
bcs .exit bcs @exit
+STAY DEST +STAY DEST
lda (SAVE) lda (SAVE)
tay tay
@ -319,7 +317,7 @@ okvs_update
cpy #$FF cpy #$FF
bne - bne -
clc clc
.exit rts @exit rts
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; okvs_iter ; okvs_iter
@ -338,14 +336,13 @@ okvs_iter
+PARAMS_ON_STACK 4 +PARAMS_ON_STACK 4
jsr SetPTRFromStackParams jsr SetPTRFromStackParams
lda (PTR) lda (PTR)
beq .iterDone ; no keys, exit immediately beq @exit ; no keys, exit immediately
sta .iterMax sta @max
+LDPARAM 3 +LDPARAM 3
+STAY .iterCallback +STAY @callback
jsr incptr ; PTR -> first record jsr incptr ; PTR -> first record
ldx #0 ldx #0
.iterLoop @loop +LDAY PTR
+LDAY PTR
pha ; save PTR on stack (in case callback clobbers it) pha ; save PTR on stack (in case callback clobbers it)
phy phy
clc clc
@ -353,7 +350,7 @@ okvs_iter
bcc + bcc +
iny ; A/Y -> key iny ; A/Y -> key
+ phx + phx
.iterCallback=*+1 @callback=*+1
jsr $FDFD ; SMC jsr $FDFD ; SMC
plx plx
ply ply
@ -361,11 +358,10 @@ okvs_iter
+STAY PTR ; restore PTR from stack +STAY PTR ; restore PTR from stack
jsr derefptr ; PTR -> next record jsr derefptr ; PTR -> next record
inx inx
.iterMax=*+1 @max=*+1
cpx #$FD ; SMC cpx #$FD ; SMC
bne .iterLoop bne @loop
.iterDone @exit rts
rts
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; okvs_iter_values ; okvs_iter_values
@ -384,28 +380,27 @@ okvs_iter_values
+PARAMS_ON_STACK 4 +PARAMS_ON_STACK 4
jsr SetPTRFromStackParams jsr SetPTRFromStackParams
lda (PTR) lda (PTR)
beq .iterValuesDone ; no keys, exit immediately beq @exit ; no keys, exit immediately
sta .iterValuesMax sta @max
+LDPARAM 3 +LDPARAM 3
+STAY .iterValuesCallback +STAY @callback
jsr incptr ; PTR -> first record jsr incptr ; PTR -> first record
ldx #0 ldx #0
.iterValuesLoop @loop ldy #2
ldy #2
lda (PTR),y ; A = length of key lda (PTR),y ; A = length of key
clc clc
adc #3 ; skip over pointer to next record (2 bytes) + key length (1 byte) adc #3 ; skip over pointer to next record (2 bytes) + key length (1 byte)
sta .iterValuesSkipLen sta @skiplen
+LDAY PTR +LDAY PTR
pha ; save PTR on stack (in case callback clobbers it) pha ; save PTR on stack (in case callback clobbers it)
phy phy
clc clc
.iterValuesSkipLen=*+1 ; skip over key @skiplen=*+1 ; skip over key
adc #$FD ; SMC adc #$FD ; SMC
bcc + bcc +
iny ; A/Y -> value iny ; A/Y -> value
+ phx + phx
.iterValuesCallback=*+1 @callback=*+1
jsr $FDFD ; SMC jsr $FDFD ; SMC
plx plx
ply ply
@ -413,11 +408,10 @@ okvs_iter_values
+STAY PTR ; restore PTR from stack +STAY PTR ; restore PTR from stack
jsr derefptr ; PTR -> next record jsr derefptr ; PTR -> next record
inx inx
.iterValuesMax=*+1 @max=*+1
cpx #$FD ; SMC cpx #$FD ; SMC
bne .iterValuesLoop bne @loop
.iterValuesDone @exit rts
rts
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; okvs_as_boolean ; okvs_as_boolean

View File

@ -5,7 +5,9 @@
; ;
; Public functions: ; Public functions:
; - ParseKeyValueText ; - ParseKeyValueText
; - IncAndGetChar
; ;
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; ParseKeyValueText ; ParseKeyValueText
; parse buffer with KEY=VALUE lines of text into an okvs ; parse buffer with KEY=VALUE lines of text into an okvs
@ -26,15 +28,15 @@ ParseKeyValueText
+PARAMS_ON_STACK 5 +PARAMS_ON_STACK 5
+LDPARAM 1 +LDPARAM 1
+STAY .store1 +STAY @store1
+STAY .store2 +STAY @store2
+LDPARAM 3 +LDPARAM 3
+STAY $FE +STAY $FE
ldy #5 ldy #5
lda (PARAM),y lda (PARAM),y
sta .useMaxLength+1 sta @maxLength
lda ($FE) lda ($FE)
pha pha
@ -49,65 +51,73 @@ ParseKeyValueText
dey dey
+ sty $FF + sty $FF
jsr okvs_init ; reset key/value store jsr okvs_init ; reset key/value store
.store1 !word $FDFD ; SMC @store1 !word $FDFD ; SMC
ldy #$00 ; index into ($FE) pointing to current character ldy #$00 ; index into ($FE) pointing to current character
.newKey @newkey ldx #$00 ; X = index into current key
ldx #$00 ; X = index into current key @gatherKey
.gatherKey
jsr IncAndGetChar jsr IncAndGetChar
and #$7F ; keys get their high bit stripped and #$7F ; keys get their high bit stripped
cmp #$23 ; '#' is starts a comment (until CR) cmp #$23 ; '#' is starts a comment (until CR)
beq .skipComment beq @skipComment
cmp #$3D ; '=' ends the key cmp #$3D ; '=' ends the key
beq .endKey beq @endKey
cmp #$0D ; found CR before '=', ignore key and start over (also handles blank lines) cmp #$0D ; found CR before '=', ignore key and start over (also handles blank lines)
beq .newKey beq @newkey
cmp #$5B ; '[' ends the parsing cmp #$5B ; '[' ends the parsing
beq .parseKeyValueDone beq .parseKeyValueDone
sta gKey,x sta gKey,x
inx inx
bpl .gatherKey bpl @gatherKey
.endKey @endKey stx gKeyLen
stx gKeyLen
ldx #$00 ; now X = index into the current value ldx #$00 ; now X = index into the current value
.gatherValue @gatherValue
jsr IncAndGetChar ; note: values do NOT get their high bit stripped jsr IncAndGetChar ; note: values do NOT get their high bit stripped
cmp #$0D ; CR ends the value cmp #$0D ; CR ends the value
beq .endValue beq @endValue
cmp #$00 ; null also ends the value cmp #$00 ; null also ends the value
beq .endValue beq @endValue
sta gVal,x sta gVal,x
inx inx
bpl .gatherValue bpl @gatherValue
.endValue @endValue
stx gValLen stx gValLen
cpx #1 cpx #1
bne .useMaxLength bne @useMaxLength
lda gVal lda gVal
and #1 and #1
sta gVal ; single-character values get converted to #$00 or #$01 in prefs store sta gVal ; single-character values get converted to #$00 or #$01 in prefs store
lda #0 lda #0
+HIDE_NEXT_2_BYTES +HIDE_NEXT_2_BYTES
.useMaxLength @useMaxLength
@maxLength=*+1
lda #$FD ; SMC lda #$FD ; SMC
sta .appendMaxLength ; all other values get upgraded to max_length so we can update them in place sta @appendMaxLength ; all other values get upgraded to max_length so we can update them in place
phy ; okvs functions clobber everything but we need Y phy ; okvs functions clobber everything but we need Y
jsr okvs_append jsr okvs_append
.store2 !word $FDFD ; SMC @store2 !word $FDFD ; SMC
!word gKeyLen !word gKeyLen
!word gValLen !word gValLen
.appendMaxLength @appendMaxLength
!byte $FD ; SMC !byte $FD ; SMC
ply ply
bra .newKey bra @newkey
.skipComment ; skip to CR @skipComment ; skip to CR
jsr IncAndGetChar jsr IncAndGetChar
cmp #$0D ; CR cmp #$0D ; CR
bne .skipComment bne @skipComment
bra .newKey bra @newkey
;------------------------------------------------------------------------------
; IncAndGetChar
;
; in: Y = index into ($FE)
; ($FE) -> buffer
; out: A contains next byte from buffer
; Y incremented
; $FF possibly incremented
;------------------------------------------------------------------------------
IncAndGetChar IncAndGetChar
iny iny
bne + bne +

View File

@ -81,32 +81,32 @@ LoadGameInfo
ldy #$00 ; index into ($FE) pointing to current character ldy #$00 ; index into ($FE) pointing to current character
ldx #$08 ; index into sectionPointers array, stores pointer to start of each section ldx #$08 ; index into sectionPointers array, stores pointer to start of each section
.convertSectionLoop @convertSectionLoop
jsr IncAndGetChar jsr IncAndGetChar
.convertSectionNoInc @convertSectionNoInc
cmp #$5B ; '[' is the start of a new section cmp #$5B ; '[' is the start of a new section
beq .skipSectionName beq @skipSectionName
cmp #$0D ; CR -> 0x00 (WeeGUI wants null-terminated strings) cmp #$0D ; CR -> 0x00 (WeeGUI wants null-terminated strings)
beq .null beq @null
cmp #$5E ; '^' -> closed-apple mousetext cmp #$5E ; '^' -> closed-apple mousetext
beq .ca beq @ca
cmp #$26 ; '&' -> open-apple mousetext cmp #$26 ; '&' -> open-apple mousetext
beq .oa beq @oa
ora #$80 ; all other characters -> set high bit ora #$80 ; all other characters -> set high bit
+HIDE_NEXT_2_BYTES +HIDE_NEXT_2_BYTES
.null lda #$00 @null lda #$00
+HIDE_NEXT_2_BYTES +HIDE_NEXT_2_BYTES
.ca lda #$40 @ca lda #$40
+HIDE_NEXT_2_BYTES +HIDE_NEXT_2_BYTES
.oa lda #$41 @oa lda #$41
sta ($FE),y sta ($FE),y
bra .convertSectionLoop bra @convertSectionLoop
; We found the start of a new section, so skip to the first character on the next line ; We found the start of a new section, so skip to the first character on the next line
.skipSectionName @skipSectionName
jsr IncAndGetChar jsr IncAndGetChar
cmp #$0D ; CR cmp #$0D ; CR
bne .skipSectionName bne @skipSectionName
jsr IncAndGetChar jsr IncAndGetChar
; We are at the start of a section, so save this address in the sectionPointers array ; We are at the start of a section, so save this address in the sectionPointers array
@ -122,7 +122,7 @@ LoadGameInfo
pla pla
dex dex
dex dex
bpl .convertSectionNoInc bpl @convertSectionNoInc
; We are done converting the game info file. ; We are done converting the game info file.
; Now handle the individual sections that require further parsing. ; Now handle the individual sections that require further parsing.
@ -187,13 +187,13 @@ CheckForSavedGames
jsr AddToPath jsr AddToPath
jsr GetFileInfo jsr GetFileInfo
!word gPathname !word gPathname
bcs .no ; no file -> no saved games bcs @no ; no file -> no saved games
lda blocks+1 lda blocks+1
bne .yes ; file exists and is quite large -> assume saved games bne @yes ; file exists and is quite large -> assume saved games
lda blocks lda blocks
cmp #$06 ; file exists but is small -> no saved games (.Z4/.Z5 files have a 5 block 'empty' .sav file) cmp #$06 ; file exists but is small -> no saved games (.Z4/.Z5 files have a 5 block 'empty' .sav file)
bcc .no bcc @no
.yes lda auxtype ; if low byte of auxtype is $3x, x is the last save slot @yes lda auxtype ; if low byte of auxtype is $3x, x is the last save slot
and #$F0 and #$F0
cmp #$30 cmp #$30
bne + bne +
@ -204,6 +204,6 @@ CheckForSavedGames
sta gLastSavedGameSlot sta gLastSavedGameSlot
lda #1 lda #1
+HIDE_NEXT_2_BYTES +HIDE_NEXT_2_BYTES
.no lda #0 @no lda #0
sta gHasSavedGames sta gHasSavedGames
rts rts

View File

@ -57,12 +57,12 @@ kLastPlayed
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
SaveGlobalPreferences SaveGlobalPreferences
lda gGlobalPrefsDirty lda gGlobalPrefsDirty
beq + beq @exit
+LDADDR kGlobalPrefsBuffer +LDADDR kGlobalPrefsBuffer
+STAY $FE +STAY $FE
+LDADDR .fluff1 +LDADDR kFluff1
jsr addString jsr addString
jsr addBooleanFromStore jsr addBooleanFromStore
@ -77,39 +77,39 @@ SaveGlobalPreferences
jsr addBooleanFromStore jsr addBooleanFromStore
!word kAutoScript !word kAutoScript
+LDADDR .fluff2 +LDADDR kFluff2
jsr addString jsr addString
jsr addStringFromStore jsr addStringFromStore
!word kLastPlayed !word kLastPlayed
+LDADDR .fluff3 +LDADDR kFluff3
jsr addString jsr addString
jsr okvs_iter jsr okvs_iter
!word gGamesListStore !word gGamesListStore
!word addGameToPrefs !word addGameToPrefs
+LDADDR .eof +LDADDR kEOF
jsr addString jsr addString
lda $FE lda $FE
sta .filelen sta @filelen
lda $FF lda $FF
sec sec
sbc #>kGlobalPrefsBuffer sbc #>kGlobalPrefsBuffer
sta .filelen+1 sta @filelen+1
jsr SaveFile jsr SaveFile
!word kGlobalPrefsFilename !word kGlobalPrefsFilename
!byte 4 ; filetype=TXT !byte 4 ; filetype=TXT
!word 0 ; auxtype=0000 !word 0 ; auxtype=0000
!word kGlobalPrefsBuffer !word kGlobalPrefsBuffer
.filelen !word $FDFD ; SMC @filelen !word $FDFD ; SMC
!word kProDOSFileBuffer !word kProDOSFileBuffer
stz gGlobalPrefsDirty stz gGlobalPrefsDirty
+ rts @exit rts
addGameToPrefs addGameToPrefs
+STAY + +STAY +
@ -122,17 +122,17 @@ addBooleanFromStore
+HIDE_NEXT_2_BYTES +HIDE_NEXT_2_BYTES
addStringFromStore addStringFromStore
lda #$80 ; BRA opcode lda #$80 ; BRA opcode
sta .skipOverBooleanLogic sta @skipOverBooleanLogic
+PARAMS_ON_STACK 2 +PARAMS_ON_STACK 2
+LDPARAM 1 +LDPARAM 1
+STAY .key +STAY @key
jsr addString jsr addString
+LDADDR .equals +LDADDR kEquals
jsr addString jsr addString
jsr okvs_get jsr okvs_get
!word gGlobalPrefsStore !word gGlobalPrefsStore
.key !word $FDFD ; SMC @key !word $FDFD ; SMC
.skipOverBooleanLogic @skipOverBooleanLogic
bra + ; SMC (opcode may become BIT) bra + ; SMC (opcode may become BIT)
+STAY PTR +STAY PTR
ldy #1 ldy #1
@ -141,14 +141,14 @@ addStringFromStore
sta (PTR),y sta (PTR),y
+LDAY PTR +LDAY PTR
+ jsr addString + jsr addString
+LDADDR .lf +LDADDR kLF
jmp addString jmp addString
addString addString
+STAY $00 +STAY $00
lda ($00) lda ($00)
inc inc
sta .stringlen sta @len
ldy #1 ldy #1
- lda ($00),y - lda ($00),y
sta ($FE) sta ($FE)
@ -156,26 +156,26 @@ addString
inc $FE inc $FE
bne + bne +
inc $FF inc $FF
.stringlen=*+1 @len=*+1
+ cpy #$FD ; SMC + cpy #$FD ; SMC
bne - bne -
rts rts
.equals !byte 1 kEquals !byte 1
!raw "=" !raw "="
.lf !byte 1 kLF !byte 1
!byte $0D !byte $0D
.fluff1 !byte 101 kFluff1 !byte 101
!raw "# Pitch Dark preferences file",$0D !raw "# Pitch Dark preferences file",$0D
!raw "# Do not edit by hand.",$0D !raw "# Do not edit by hand.",$0D
!raw "# Or do. I'm a comment, not a cop.",$0D,$0D !raw "# Or do. I'm a comment, not a cop.",$0D,$0D
!raw "# value=0|1",$0D !raw "# value=0|1",$0D
.fluff2 !byte 24 kFluff2 !byte 24
!byte $0D !byte $0D
!raw "# value=game directory",$0D !raw "# value=game directory",$0D
.fluff3 !byte 58 kFluff3 !byte 58
!byte $0D !byte $0D
!raw "# key=game directory, value=filename of selected version",$0D !raw "# key=game directory, value=filename of selected version",$0D
.eof !byte 7 kEOF !byte 7
!byte $0D !byte $0D
!raw "[eof]",$0D !raw "[eof]",$0D

View File

@ -17,19 +17,20 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
lda RAM32 lda RAM32
cmp NODEV cmp NODEV
bne + bne @maybeRAMdisk
lda RAM32+1 lda RAM32+1
cmp NODEV+1 cmp NODEV+1
beq .noRAMdisk beq @noRAMdisk
+ ldy DEVCNT @maybeRAMdisk
ldy DEVCNT
- lda DEVLST, y - lda DEVLST, y
and #$F3 and #$F3
cmp #$B3 cmp #$B3
beq .foundRAMdisk beq @foundRAMdisk
dey dey
bpl - bpl -
bmi .noRAMdisk bmi @noRAMdisk
.foundRAMdisk @foundRAMdisk
- lda DEVLST+1, y ; move other devices up in list - lda DEVLST+1, y ; move other devices up in list
sta DEVLST, y sta DEVLST, y
beq + ; device list is zero-terminated beq + ; device list is zero-terminated
@ -40,7 +41,7 @@
lda NODEV+1 lda NODEV+1
sta RAM32+1 sta RAM32+1
dec DEVCNT ; reduce ProDOS device count dec DEVCNT ; reduce ProDOS device count
.noRAMdisk @noRAMdisk
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; clear options script and make checksum invalid ; clear options script and make checksum invalid

View File

@ -64,7 +64,7 @@ LoadFile
+STAY mliparam+3 ; ProDOS file buffer +STAY mliparam+3 ; ProDOS file buffer
jsr _openfile jsr _openfile
bcs + ; C set on error bcs @exit ; C set on error
pha ; push file reference number pha ; push file reference number
+LDPARAM 3 +LDPARAM 3
@ -81,7 +81,7 @@ LoadFile
plp ; restore flags from readfile plp ; restore flags from readfile
; (so caller gets codes from read attempt, ; (so caller gets codes from read attempt,
; not close) ; not close)
+ rts @exit rts
;------------------------------- ;-------------------------------
; LoadDHRFile ; LoadDHRFile
@ -111,8 +111,8 @@ LoadDHRFile
bne - bne -
jsr _openfile jsr _openfile
bcs .dhrexit ; C set on error bcs @exit ; C set on error
sta .saverefnum ; store file refnum sta @saverefnum ; store file refnum
ldy #$20 ldy #$20
stz mliparam+2 ; read into $2000 in main mem stz mliparam+2 ; read into $2000 in main mem
@ -121,34 +121,34 @@ LoadDHRFile
sty mliparam+5 sty mliparam+5
jsr _readfile jsr _readfile
bcs .close bcs @close
sta $C000 sta $C000
ldx #$20 ; copy $2000 bytes to auxmem ldx #$20 ; copy $2000 bytes to auxmem
stx .copya+2 stx @copya+2
stx .copyb+2 stx @copyb+2
ldy #$00 ldy #0
.writeToAuxLoop @writeToAuxLoop
sta $C005 sta $C005
.copya lda $FF00, y @copya lda $FF00, y
.copyb sta $FF00, y @copyb sta $FF00, y
iny iny
bne .copya bne @copya
sta $C004 sta $C004
inc .copya+2 inc @copya+2
inc .copyb+2 inc @copyb+2
dex dex
bne .writeToAuxLoop bne @writeToAuxLoop
lda .saverefnum lda @saverefnum
jsr _readfile ; read another $2000 bytes into $2000 (stays in main mem) jsr _readfile ; read another $2000 bytes into $2000 (stays in main mem)
.close php ; save flags from readfile @close php ; save flags from readfile
.saverefnum=*+1 @saverefnum=*+1
lda #$d1 ; file refnum (set above) lda #$FD ; file refnum (SMC)
jsr _closefile jsr _closefile
plp ; restore flags from readfile plp ; restore flags from readfile
.dhrexit rts @exit rts
;------------------------------- ;-------------------------------
; SaveFile ; SaveFile
@ -192,12 +192,12 @@ SaveFile
lda #CMD_CREATE ; MLI create command lda #CMD_CREATE ; MLI create command
ldy #PC_CREATE ; number of parameters for 'create' command ldy #PC_CREATE ; number of parameters for 'create' command
jsr mli jsr mli
bcs + bcs @exit
+LDPARAM 10 +LDPARAM 10
+STAY mliparam+3 ; PrODOS file buffer +STAY mliparam+3 ; PrODOS file buffer
jsr _openfile jsr _openfile
bcs + bcs @exit
sta mliparam+1 ; store file reference number sta mliparam+1 ; store file reference number
+LDPARAM 6 +LDPARAM 6
@ -212,7 +212,7 @@ SaveFile
plp ; restore flags from write plp ; restore flags from write
; (so caller gets codes from write attempt, ; (so caller gets codes from write attempt,
; not close) ; not close)
+ rts @exit rts
;------------------------------- ;-------------------------------
; SetPrefix ; SetPrefix
@ -270,11 +270,11 @@ _openfile
lda #CMD_OPEN ; MLI command lda #CMD_OPEN ; MLI command
ldy #PC_OPEN ; number of parameters for 'open' command ldy #PC_OPEN ; number of parameters for 'open' command
jsr mli jsr mli
bcs + bcs @exit
lda refnum ; caller should save file reference number lda refnum ; caller should save file reference number
; as this memory location may be ; as this memory location may be
; overwritten by later MLI calls ; overwritten by later MLI calls
+ rts @exit rts
;------------------------------- ;-------------------------------
; read an open file via ProDOS MLI ; read an open file via ProDOS MLI
@ -291,9 +291,9 @@ _readfile
lda #CMD_READ ; MLI read command lda #CMD_READ ; MLI read command
ldy #PC_READ ; number of parameters for 'read' command ldy #PC_READ ; number of parameters for 'read' command
jsr mli jsr mli
bcs + bcs @exit
lda mliparam+1 ; if no error, return file reference number lda mliparam+1 ; if no error, return file reference number
+ rts @exit rts
;------------------------------- ;-------------------------------
; close an open file ; close an open file
@ -328,7 +328,7 @@ mli sta mlicmd ; store command code
jsr PRODOSMLI ; call ProDOS jsr PRODOSMLI ; call ProDOS
mlicmd !byte 00 ; command number mlicmd !byte 00 ; command number
!word mliparam ; address of parameter table !word mliparam ; address of parameter table
mliexit rts rts
mliparam !byte $FE,$FE,$FE,$FE mliparam !byte $FE,$FE,$FE,$FE
filetype !byte $FE ; file type (set by MLI get_file_info) 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)

View File

@ -41,20 +41,20 @@ AddToPathWithHighBit
+HIDE_NEXT_2_BYTES +HIDE_NEXT_2_BYTES
AddToPath AddToPath
ldx #0 ldx #0
stx .mask stx @mask
+STAY $00 +STAY $00
ldx gPathname ; current pathname length ldx gPathname ; current pathname length
lda ($00) ; length of this segment lda ($00) ; length of this segment
inc inc
sta .len sta @len
ldy #$01 ldy #$01
- lda ($00),y - lda ($00),y
.mask=*+1 @mask=*+1
ora #$FD ; SMC ora #$FD ; SMC
sta gPathname+1,x sta gPathname+1,x
inx inx
iny iny
.len=*+1 @len=*+1
cpy #$FD ; SMC cpy #$FD ; SMC
bcc - bcc -
stx gPathname stx gPathname

View File

@ -39,17 +39,16 @@ kStringCancel
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
HardResetWeeGUI HardResetWeeGUI
lda #15 ; highest possible WeeGUI view ID lda #15 ; highest possible WeeGUI view ID
sta kHardResetDummyView sta @kHardResetDummyView
+LDAY kHardResetDummyView +LDAY @kHardResetDummyView
+STAY PARAM0 +STAY PARAM0
.hardResetLoop - ldx #WGCreateView
ldx #WGCreateView
jsr WeeGUI ; create dummy views to reset state on all views jsr WeeGUI ; create dummy views to reset state on all views
dec kHardResetDummyView dec @kHardResetDummyView
bpl .hardResetLoop bpl -
ldx #WGResetAll ; reset WeeGUI (destroys everything we just created) ldx #WGResetAll ; reset WeeGUI (destroys everything we just created)
jmp WeeGUI jmp WeeGUI
kHardResetDummyView @kHardResetDummyView
!byte 0,0,0,0,0,0,0,0 !byte 0,0,0,0,0,0,0,0
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
@ -99,12 +98,12 @@ CreateCheckbox
+HIDE_NEXT_2_BYTES +HIDE_NEXT_2_BYTES
CreateButton CreateButton
ldx #WGCreateButton ldx #WGCreateButton
stx .createViewType stx @type
+PARAMS_ON_STACK 2 +PARAMS_ON_STACK 2
+LDPARAM 1 +LDPARAM 1
+STAY PARAM0 +STAY PARAM0
.createViewType=*+1 @type=*+1
ldx #$FD ; SMC ldx #$FD ; SMC
jsr WeeGUI jsr WeeGUI
ldx #WGViewSetRawTitle ldx #WGViewSetRawTitle
@ -224,7 +223,7 @@ SimulateClick
; all other registers and flags clobbered ; all other registers and flags clobbered
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
GetCheckedRadioButton GetCheckedRadioButton
sty .radioMax sty @max
- pha - pha
ldx #WGSelectView ldx #WGSelectView
jsr WeeGUI jsr WeeGUI
@ -232,15 +231,14 @@ GetCheckedRadioButton
jsr WeeGUI jsr WeeGUI
lda PARAM0 lda PARAM0
and #1 and #1
bne .radioFound bne @found
pla pla
inc inc
.radioMax=*+1 @max=*+1
cmp #$FD ; SMC cmp #$FD ; SMC
bcc - bcc -
+HIDE_NEXT_2_BYTES +HIDE_NEXT_2_BYTES
.radioFound @found pla
pla
clc clc
rts rts

View File

@ -87,14 +87,14 @@ RepaintMainIfDirty
!word kViewNext !word kViewNext
lda gHasSavedGames ; create 'play game' or 'resume game' button lda gHasSavedGames ; create 'play game' or 'resume game' button
beq .wantPlayButton beq @wantPlayButton
jsr CreateButton jsr CreateButton
!word kViewResume !word kViewResume
bra .donePlayOrResume bra @donePlayOrResume
.wantPlayButton @wantPlayButton
jsr CreateButton jsr CreateButton
!word kViewPlay !word kViewPlay
.donePlayOrResume @donePlayOrResume
jsr CreateOrDestroyButton ; create or destroy 'artwork' button jsr CreateOrDestroyButton ; create or destroy 'artwork' button
!byte ID_BOXART !byte ID_BOXART
@ -112,7 +112,7 @@ RepaintMainIfDirty
!word kHasVersions !word kHasVersions
pla ; clear screen before repainting? pla ; clear screen before repainting?
beq .nohome ; no -> repaint over existing screen, YOLO beq @nohome ; no -> repaint over existing screen, YOLO
ldx #WGClearScreen ; clear screen ldx #WGClearScreen ; clear screen
jsr WeeGUI jsr WeeGUI
@ -132,7 +132,7 @@ RepaintMainIfDirty
bne - bne -
ldx #WGSyncGlobalCursor ldx #WGSyncGlobalCursor
jsr WeeGUI jsr WeeGUI
.nohome @nohome
ldx #WGSelectView ; delete info box but leave its contents on screen ldx #WGSelectView ; delete info box but leave its contents on screen
lda #ID_INFO ; (harmless if it doesn't exist yet) lda #ID_INFO ; (harmless if it doesn't exist yet)
jsr WeeGUI jsr WeeGUI
@ -191,31 +191,29 @@ CreateOrDestroyButton
pha ; A = WeeGUI view ID pha ; A = WeeGUI view ID
+LDPARAM 2 +LDPARAM 2
+STAY .viewConfigurationRecord +STAY @vcr
+LDPARAM 4 +LDPARAM 4
+STAY .optionsStoreKey +STAY @key
jsr okvs_get jsr okvs_get
!word gOptionsStore !word gOptionsStore
.optionsStoreKey @key !word $FDFD ; SMC
!word $FDFD ; SMC
plx ; X = WeeGUI view ID plx ; X = WeeGUI view ID
jsr okvs_as_boolean jsr okvs_as_boolean
beq .destroy beq @destroy
lda gViewInUse,x ; create button if it doesn't exist lda gViewInUse,x ; create button if it doesn't exist
bne .createDestroyDone ; oh it does exist, so we're done bne @exit ; oh it does exist, so we're done
lda #1 lda #1
sta gViewInUse,x sta gViewInUse,x
jsr CreateButton jsr CreateButton
.viewConfigurationRecord @vcr !word $FDFD ; SMC
!word $FDFD ; SMC @exit rts
.createDestroyDone
rts
.destroy lda gViewInUse,x ; destroy button if it exists @destroy
beq .createDestroyDone ; oh it doesn't exist, so we're done lda gViewInUse,x ; destroy button if it exists
beq @exit ; oh it doesn't exist, so we're done
lda #0 lda #0
sta gViewInUse,x sta gViewInUse,x
txa ; A = WeeGUI view ID txa ; A = WeeGUI view ID
@ -236,9 +234,9 @@ PaintDescriptionView
jsr MultiPrint jsr MultiPrint
lda SAVE lda SAVE
cmp #10 ; minimum content height cmp #10
bcs + bcs +
lda #10 lda #10 ; minimum content height
+ ldx #WGSetContentHeight ; set content height so we stop scrolling on the last line of text + ldx #WGSetContentHeight ; set content height so we stop scrolling on the last line of text
jmp WeeGUI jmp WeeGUI
@ -273,10 +271,9 @@ PaintInfoView
+HIDE_NEXT_2_BYTES +HIDE_NEXT_2_BYTES
MultiPrint MultiPrint
stz SAVE ; VTAB, but 0-indexed stz SAVE ; VTAB, but 0-indexed
stx .printLineLength+1 stx @linelen
+STAY SRC +STAY SRC
.printLoop @loop stz PARAM0
stz PARAM0
lda SAVE lda SAVE
sta PARAM1 sta PARAM1
ldx #WGSetCursor ldx #WGSetCursor
@ -288,14 +285,14 @@ MultiPrint
jsr WeeGUI jsr WeeGUI
lda SRC lda SRC
clc clc
.printLineLength @linelen=*+1
adc #$FD ; SMC adc #$FD ; SMC
sta SRC sta SRC
bcc + bcc +
inc SRC+1 inc SRC+1
+ inc SAVE + inc SAVE
lda (SRC) lda (SRC)
bne .printLoop bne @loop
rts rts
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------

View File

@ -56,28 +56,24 @@ _endMainKeys
HandleKey HandleKey
ldx #_endMainKeys-kMainKeys ldx #_endMainKeys-kMainKeys
- cmp kMainKeys,x - cmp kMainKeys,x
beq .foundKey beq @found
dex dex
dex dex
bpl - bpl -
.notFound @error jmp SoftBell ; unknown key, beep softly
jmp SoftBell ; unknown key, beep softly @found lda kMainKeys+1,x ; get ID associated with this key
.foundKey bpl @activateView ; ID < #$80 is a WeeGUI view, so activate it
lda kMainKeys+1,x ; get ID associated with this key
bpl .activateView ; ID < #$80 is a WeeGUI view, so activate it
cmp #ID_X ; X, Y, and Z keys are part of cmp #ID_X ; X, Y, and Z keys are part of
beq .x ; an undocumented feature beq @x ; an undocumented feature
cmp #ID_Y cmp #ID_Y
beq .y beq @y
cmp #ID_Z cmp #ID_Z
beq .z beq @z
cmp #ID_SCROLLDOWN ; arrow keys scroll the description box cmp #ID_SCROLLDOWN ; arrow keys scroll the description box
beq .handleScrollDown beq @down
.handleScrollUp
lda #$01 lda #$01
+HIDE_NEXT_2_BYTES +HIDE_NEXT_2_BYTES
.handleScrollDown @down lda #$FF
lda #$FF
pha pha
ldx #WGSelectView ldx #WGSelectView
lda #ID_DESCRIPTION lda #ID_DESCRIPTION
@ -85,47 +81,45 @@ HandleKey
ldx #WGScrollYBy ldx #WGScrollYBy
pla pla
jsr WeeGUI jsr WeeGUI
bra .focusAndDoAction bra @click
.activateView @activateView
tax tax
ldy gViewInUse,x ldy gViewInUse,x
beq .notFound beq @error
ldx #WGSelectView ldx #WGSelectView
jsr WeeGUI jsr WeeGUI
.focusAndDoAction @click jmp SimulateClick
jmp SimulateClick
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; XYZZY handler ; XYZZY handler
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
.y lda .xyzzyCounter @y lda @xyzzyCounter
cmp #1 cmp #1
beq .y1 beq @y1
cmp #4 cmp #4
bne .xyzzyReset bne @xyzzyReset
beq .xyzzyGo beq @xyzzyGo
.z lda .xyzzyCounter @z lda @xyzzyCounter
cmp #2 cmp #2
beq .z1 beq @z1
cmp #3 cmp #3
beq .z2 beq @z2
bra .xyzzyReset bra @xyzzyReset
.x lda #1 @x lda #1
+HIDE_NEXT_2_BYTES +HIDE_NEXT_2_BYTES
.y1 lda #2 @y1 lda #2
+HIDE_NEXT_2_BYTES +HIDE_NEXT_2_BYTES
.z1 lda #3 @z1 lda #3
+HIDE_NEXT_2_BYTES +HIDE_NEXT_2_BYTES
.z2 lda #4 @z2 lda #4
+HIDE_NEXT_2_BYTES +HIDE_NEXT_2_BYTES
.xyzzyReset @xyzzyReset
lda #0 lda #0
sta .xyzzyCounter sta @xyzzyCounter
.xyzzyError bra @error
jmp SoftBell @xyzzyCounter
.xyzzyCounter
!byte 0 !byte 0
.xyzzyGo @xyzzyGo
jsr SaveGlobalPreferences jsr SaveGlobalPreferences
jsr ResetPath jsr ResetPath
+LDADDR kArtworkRootDirectory +LDADDR kArtworkRootDirectory
@ -133,7 +127,7 @@ HandleKey
jsr SetPrefix ; must set ProDOS prefix to directory where DHGR files actually are jsr SetPrefix ; must set ProDOS prefix to directory where DHGR files actually are
!word gPathname ; (DHRSLIDE does not look in subdirectories) !word gPathname ; (DHRSLIDE does not look in subdirectories)
bcs .xyzzyError bcs @error
jsr ResetPath jsr ResetPath
+LDADDR kDHRSLIDEFilename +LDADDR kDHRSLIDEFilename
@ -172,20 +166,21 @@ callback_previous
!word gGamesListStore !word gGamesListStore
tax tax
dex dex
+ bra .loadNewGameInfoAndRepaint + bra loadNewGameInfoAndRepaint
callback_next callback_next
jsr GetCurrentGameIndex jsr GetCurrentGameIndex
inx inx
stx .n stx @n
jsr okvs_len jsr okvs_len
!word gGamesListStore !word gGamesListStore
ldx .n ldx @n
.n=*+1 @n=*+1
cmp #$FD ; SMC cmp #$FD ; SMC
bne .loadNewGameInfoAndRepaint bne loadNewGameInfoAndRepaint
ldx #0 ldx #0
.loadNewGameInfoAndRepaint
loadNewGameInfoAndRepaint
stx + stx +
jsr okvs_nth jsr okvs_nth
!word gGamesListStore !word gGamesListStore

View File

@ -118,12 +118,12 @@ OptionsDialog
HandleOptionsKey HandleOptionsKey
ldx #_endOptionsKeys-kOptionsKeys ldx #_endOptionsKeys-kOptionsKeys
- cmp kOptionsKeys,x - cmp kOptionsKeys,x
beq + beq @found
dex dex
dex dex
bpl - bpl -
jmp SoftBell jmp SoftBell
+ lda kOptionsKeys+1,x @found lda kOptionsKeys+1,x
ldx #WGSelectView ldx #WGSelectView
jsr WeeGUI jsr WeeGUI
jmp SimulateClick jmp SimulateClick
@ -153,33 +153,33 @@ SetCheckboxByPref
ldy #1 ldy #1
lda (PARAM),y lda (PARAM),y
sta .checkboxViewID sta @view
+LDPARAM 2 +LDPARAM 2
+STAY + +STAY @key
jsr okvs_get jsr okvs_get
!word gGlobalPrefsStore !word gGlobalPrefsStore
+ !word $FDFD ; SMC @key !word $FDFD ; SMC
bcs + bcs @exit
jsr okvs_as_boolean jsr okvs_as_boolean
beq + beq @exit
ldx #WGSelectView ldx #WGSelectView
.checkboxViewID=*+1 @view=*+1
lda #$FD ; SMC lda #$FD ; SMC
jsr WeeGUI jsr WeeGUI
ldx #WGSetState ldx #WGSetState
lda #1 lda #1
sta PARAM0 sta PARAM0
jsr WeeGUI jsr WeeGUI
+ rts @exit rts
SetPrefByCheckbox SetPrefByCheckbox
+PARAMS_ON_STACK 3 +PARAMS_ON_STACK 3
+LDPARAM 2 +LDPARAM 2
+STAY + +STAY @key
ldy #1 ldy #1
lda (PARAM),y lda (PARAM),y
ldx #WGSelectView ldx #WGSelectView
@ -189,15 +189,15 @@ SetPrefByCheckbox
lda PARAM0 lda PARAM0
and #1 and #1
sta +++ sta @valueb
jsr okvs_update jsr okvs_update
!word gGlobalPrefsStore !word gGlobalPrefsStore
+ !word $FDFD ; SMC @key !word $FDFD ; SMC
!word ++ !word @value
rts rts
++ !byte 1 @value !byte 1
+++ !byte $FD ; SMC @valueb !byte $FD ; SMC
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; WeeGUI view configuration records ; WeeGUI view configuration records

View File

@ -157,12 +157,12 @@ ResumeDialog
HandleResumeKey HandleResumeKey
ldx #_endResumeKeys-kResumeKeys ldx #_endResumeKeys-kResumeKeys
- cmp kResumeKeys,x - cmp kResumeKeys,x
beq + beq @found
dex dex
dex dex
bpl - bpl -
jmp SoftBell jmp SoftBell
+ @found
; TODO need to handle up and down arrow keys like versions dialog ; TODO need to handle up and down arrow keys like versions dialog
lda kResumeKeys+1,x lda kResumeKeys+1,x
ldx #WGSelectView ldx #WGSelectView
@ -183,7 +183,7 @@ CreateResumeRadioCallback
+STAY PTR +STAY PTR
lda (PTR) lda (PTR)
sta gResumeViewInUse+1,x ; mark whether this view is in use (hotkeys activate based on this array) sta gResumeViewInUse+1,x ; mark whether this view is in use (hotkeys activate based on this array)
beq ++ ; length=0 means this slot is unused, so we're done beq @exit ; length=0 means this slot is unused, so we're done
lda PTR lda PTR
inc ; skip over length byte inc ; skip over length byte
@ -199,7 +199,7 @@ CreateResumeRadioCallback
!word kViewResumeRadio !word kViewResumeRadio
inc iResumeVTAB inc iResumeVTAB
inc iResumeVTAB inc iResumeVTAB
++ rts @exit rts
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; PrintResumeLabelCallback ; PrintResumeLabelCallback
@ -214,7 +214,7 @@ CreateResumeRadioCallback
PrintResumeLabelCallback PrintResumeLabelCallback
+STAY PTR +STAY PTR
lda (PTR) lda (PTR)
beq ++ ; length=0 means this slot is unused, so we're done beq .printResumeExit ; length=0 means this slot is unused, so we're done
lda PTR lda PTR
inc ; skip over length byte inc ; skip over length byte
@ -230,7 +230,8 @@ iResumeVTAB
!word $FDFD ; SMC !word $FDFD ; SMC
inc iResumeVTAB inc iResumeVTAB
inc iResumeVTAB inc iResumeVTAB
++ rts .printResumeExit
rts
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; ResumeOKCallback ; ResumeOKCallback

View File

@ -7,9 +7,6 @@
; - SoftBell ; - SoftBell
; ;
WAIT = $FCA8
SPEAKER = $C030
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; SoftBell ; SoftBell
; ;

View File

@ -178,22 +178,20 @@ HandleVersionsKey
; out: all registers and flags clobbered ; out: all registers and flags clobbered
ldx #_endVersionsKeys-kVersionsKeys ldx #_endVersionsKeys-kVersionsKeys
- cmp kVersionsKeys,x - cmp kVersionsKeys,x
beq .foundVersionKey beq @found
dex dex
dex dex
bpl - bpl -
.versionKeyError @error jmp SoftBell
jmp SoftBell @found lda kVersionsKeys+1,x ; get action ID associated with this key
.foundVersionKey bmi @updown
lda kVersionsKeys+1,x ; get action ID associated with this key
bmi +
tax ; action ID < #$80 is a WeeGUI view, so activate it tax ; action ID < #$80 is a WeeGUI view, so activate it
ldy gVersionsViewInUse,x ldy gVersionsViewInUse,x
beq .versionKeyError beq @error
ldx #WGSelectView ldx #WGSelectView
jsr WeeGUI jsr WeeGUI
jmp SimulateClick jmp SimulateClick
+ pha ; action ID >= #$80 is a screen-specific action, so stash it for now @updown pha ; action ID >= #$80 is a screen-specific action, so stash it for now
jsr GetCheckedVersion ; figure out which radio button is checked jsr GetCheckedVersion ; figure out which radio button is checked
ldx #WGSelectView ; uncheck it and repaint it ldx #WGSelectView ; uncheck it and repaint it
jsr WeeGUI jsr WeeGUI
@ -204,18 +202,17 @@ HandleVersionsKey
jsr WeeGUI jsr WeeGUI
plx ; X = action ID (pushed earlier from A) plx ; X = action ID (pushed earlier from A)
cpx #ID_VERSIONS_PREVIOUS cpx #ID_VERSIONS_PREVIOUS
beq .previousVersion beq @up
cmp iNumVersions ; find 'next' view ID (wrapping around to 1) cmp iNumVersions ; find 'next' view ID (wrapping around to 1)
bcs + bcs +
inc inc
+HIDE_NEXT_2_BYTES +HIDE_NEXT_2_BYTES
+ lda #1 + lda #1
bra .checkNewVersion bra @checkNewVersion
.previousVersion @up dec
dec bne @checkNewVersion
bne .checkNewVersion
lda iNumVersions lda iNumVersions
.checkNewVersion @checkNewVersion
ldx #WGSelectView ; check new radio button and repaint it ldx #WGSelectView ; check new radio button and repaint it
jsr WeeGUI jsr WeeGUI
ldx #WGViewFocus ldx #WGViewFocus
@ -254,19 +251,19 @@ GetCheckedVersion
VersionsOKCallback VersionsOKCallback
jsr GetCheckedVersion jsr GetCheckedVersion
dec dec
sta + sta @n
jsr okvs_nth jsr okvs_nth
!word gVersionsStore !word gVersionsStore
+ !byte $FD ; SMC @n !byte $FD ; SMC
+STAY ++ +STAY @value
jsr okvs_get jsr okvs_get
!word gGlobalPrefsStore !word gGlobalPrefsStore
!word kLastPlayed !word kLastPlayed
+STAY + +STAY @key
jsr okvs_update jsr okvs_update
!word gGlobalPrefsStore !word gGlobalPrefsStore
+ !word $FDFD ; SMC @key !word $FDFD ; SMC
++ !word $FDFD ; SMC @value !word $FDFD ; SMC
lda #1 lda #1
sta gGlobalPrefsDirty ; must set, otherwise SaveGlobalPreferences does nothing sta gGlobalPrefsDirty ; must set, otherwise SaveGlobalPreferences does nothing