2018-12-29 18:38:18 +00:00
|
|
|
;license:MIT
|
2023-01-06 19:36:12 +00:00
|
|
|
;(c) 2018-2023 by 4am
|
2019-06-24 02:32:18 +00:00
|
|
|
;
|
|
|
|
; first-run initialization code
|
|
|
|
;
|
|
|
|
; This file is included directly and is run from $2000/main as soon as the
|
|
|
|
; .SYSTEM file is loaded
|
2018-12-29 18:38:18 +00:00
|
|
|
;
|
|
|
|
|
2024-05-28 22:57:51 +00:00
|
|
|
!src "src/4cade.init.machine.a" ; exits with ROM read, no write
|
2023-11-18 02:18:51 +00:00
|
|
|
!src "src/4cade.init.screen.a"
|
2023-11-13 20:49:31 +00:00
|
|
|
|
2021-05-13 04:18:47 +00:00
|
|
|
; print text title in same place as graphical title will appear
|
2023-11-13 20:49:31 +00:00
|
|
|
jsr PrintBranding
|
2021-05-13 04:18:47 +00:00
|
|
|
|
|
|
|
; proboothd duplicates the above code and jumps here,
|
|
|
|
; so if you make any changes before this comment, you
|
|
|
|
; MUST adjust the final JMP in src/proboothd/proboothd.a
|
2023-11-18 02:18:51 +00:00
|
|
|
!if (* != ProBootEntry) {
|
|
|
|
!serious "ProBootEntry is wrong, should be ", *
|
|
|
|
}
|
2021-05-13 04:18:47 +00:00
|
|
|
|
2019-09-29 15:08:57 +00:00
|
|
|
jsr Has64K ; check for 64K (required)
|
2024-05-28 22:57:51 +00:00
|
|
|
; exits with ROM read, no write
|
|
|
|
bcc @enough_mem
|
2019-08-27 17:55:54 +00:00
|
|
|
|
|
|
|
ldy #@no64Klen
|
|
|
|
- lda @s_no64K,y
|
|
|
|
sta $6B6,y
|
|
|
|
dey
|
|
|
|
bpl -
|
|
|
|
@hang bmi @hang
|
2019-09-06 00:15:02 +00:00
|
|
|
@s_no64K !scrxor $80,"REQUIRES 64K"
|
|
|
|
@no64Klen=(*-@s_no64K)-1
|
2019-08-27 17:55:54 +00:00
|
|
|
|
2024-05-28 22:57:51 +00:00
|
|
|
@enough_mem
|
2019-10-05 01:34:49 +00:00
|
|
|
lda #0
|
|
|
|
sta zpMachineStatus
|
2019-11-21 04:05:35 +00:00
|
|
|
sta SETC3ROM
|
|
|
|
jsr HasVidHDCard ; check for VidHD card (allows super hi-res artwork even on non-IIgs machines)
|
2024-05-28 22:57:51 +00:00
|
|
|
; does not rely on ROM
|
2019-11-21 04:05:35 +00:00
|
|
|
sta CLRC3ROM
|
|
|
|
ror zpMachineStatus
|
2024-05-28 22:57:51 +00:00
|
|
|
lda ROM_MACHINEID ; requires ROM read
|
2019-09-23 03:31:41 +00:00
|
|
|
cmp #$06
|
2019-11-21 04:05:35 +00:00
|
|
|
bne @NotGS
|
2019-09-22 18:04:48 +00:00
|
|
|
sec
|
|
|
|
jsr $FE1F ; check for IIgs (allows super hi-res artwork)
|
2024-05-28 22:57:51 +00:00
|
|
|
; requires ROM read
|
2019-11-21 04:05:35 +00:00
|
|
|
bcs @NotGS
|
2020-03-05 17:45:35 +00:00
|
|
|
sec
|
2020-03-05 17:38:53 +00:00
|
|
|
+HIDE_NEXT_BYTE
|
|
|
|
@NotGS clc
|
|
|
|
ror zpMachineStatus
|
|
|
|
jsr Has128K ; check for 128K (allows DHGR slideshows and 128K games)
|
2024-05-28 22:57:51 +00:00
|
|
|
; exits with ROM read, no write
|
2019-06-27 13:51:17 +00:00
|
|
|
ror zpMachineStatus
|
2019-01-13 23:55:40 +00:00
|
|
|
jsr HasJoystick ; check for joystick (absence is OK but we filter out some games that require a joystick)
|
2024-05-28 22:57:51 +00:00
|
|
|
; requires ROM read
|
2020-03-05 17:38:53 +00:00
|
|
|
ror zpMachineStatus
|
|
|
|
; now bit 4 = 1 if VidHD
|
|
|
|
; bit 5 = 1 if IIgs
|
2019-01-13 23:55:40 +00:00
|
|
|
; bit 6 = 1 if 128K
|
2018-11-07 23:56:39 +00:00
|
|
|
; bit 7 = 1 if joystick
|
2020-03-05 17:38:53 +00:00
|
|
|
; and all other bits are 0 (we'll set bit 3 after copying it to LC RAM)
|
2019-08-27 17:55:54 +00:00
|
|
|
|
2022-11-29 15:54:52 +00:00
|
|
|
; IIgs fix for Alternate Display Mode (clear shadow page 2)
|
|
|
|
lda zpMachineStatus
|
|
|
|
and #IS_IIGS
|
|
|
|
beq +
|
|
|
|
ldx #0
|
2022-11-29 23:11:48 +00:00
|
|
|
txa
|
2022-11-29 15:54:52 +00:00
|
|
|
!cpu 65816
|
2022-11-29 23:11:48 +00:00
|
|
|
- sta $E00800,x ; when Alternate Display Mode is turned off, the "2"s
|
|
|
|
sta $E00900,x ; displayed on the screen live at $E00800
|
|
|
|
sta $E00A00,x ; (page "2"/$0800 of IIgs bank $E0)
|
|
|
|
sta $E00B00,x ; They are initialized by the IIgs boot ROM
|
2022-11-29 15:54:52 +00:00
|
|
|
inx
|
|
|
|
bne -
|
|
|
|
!cpu 6502
|
2022-12-11 16:53:04 +00:00
|
|
|
|
|
|
|
; Since we know we are on IIgs, let's also force Mono Mode off
|
|
|
|
lda NEWVIDEO
|
|
|
|
and #$DF
|
|
|
|
sta NEWVIDEO ; Bit 5=1 for B/W double hi-res
|
|
|
|
lda #$00
|
|
|
|
sta MONOCOLOR ; bit 7=1 disables color
|
2022-11-29 15:54:52 +00:00
|
|
|
+
|
|
|
|
|
2023-11-18 02:18:51 +00:00
|
|
|
; accommodate uppercase-only machines (64K ][ and ][+ are supported)
|
2024-05-28 22:57:51 +00:00
|
|
|
lda ROM_MACHINEID ; requires ROM read
|
2023-11-18 02:18:51 +00:00
|
|
|
cmp #$A0
|
|
|
|
beq + ; Spectrum ED
|
|
|
|
cmp #$06
|
|
|
|
beq +
|
|
|
|
lda #$DF
|
|
|
|
+HIDE_NEXT_2_BYTES
|
|
|
|
+ lda #$FF
|
|
|
|
sta zpCharMask
|
|
|
|
|
2020-03-05 17:38:53 +00:00
|
|
|
; increase text window width so we can print to the edge of the screen without scrolling
|
|
|
|
inc $21
|
|
|
|
; print version or build number in lower right corner
|
2022-05-19 20:55:03 +00:00
|
|
|
ldx #28
|
2020-03-05 17:38:53 +00:00
|
|
|
ldy #23
|
2024-05-28 22:57:51 +00:00
|
|
|
jsr SetCursorPosition ; requires ROM read
|
2020-03-05 17:38:53 +00:00
|
|
|
+LDADDR LoadingVersion
|
2024-05-28 22:57:51 +00:00
|
|
|
jsr LoadingPrint ; requires ROM read
|
2019-10-14 01:38:54 +00:00
|
|
|
!ifndef RELEASE {
|
2020-03-05 17:38:53 +00:00
|
|
|
lda LoadingBuild
|
|
|
|
ldx LoadingBuild+1
|
2019-10-14 01:38:54 +00:00
|
|
|
ldy #0
|
2024-05-28 22:57:51 +00:00
|
|
|
jsr PrintAsDecimal ; requires ROM read
|
2019-10-14 01:38:54 +00:00
|
|
|
}
|
|
|
|
|
2020-03-05 17:38:53 +00:00
|
|
|
; set up text window so it only covers lower left corner
|
2022-05-19 20:55:03 +00:00
|
|
|
lda #28
|
2020-03-05 17:38:53 +00:00
|
|
|
sta $21
|
|
|
|
lda #19
|
|
|
|
sta $22
|
|
|
|
|
|
|
|
; print machine configuration in lower left corner
|
|
|
|
ldx #0
|
|
|
|
ldy #23
|
2024-05-28 22:57:51 +00:00
|
|
|
jsr SetCursorPosition ; requires ROM read
|
2020-03-05 17:38:53 +00:00
|
|
|
|
|
|
|
; if zpMachineStatus AND IS_IIGS then print 'IIgs'
|
|
|
|
; else if zpMachineStatus AND HAS_128K then print '128K'
|
|
|
|
; else print '64K'
|
|
|
|
lda zpMachineStatus
|
|
|
|
and #IS_IIGS
|
|
|
|
beq +
|
|
|
|
+LDADDR LoadingIIgs
|
|
|
|
bne @printMem
|
|
|
|
+ lda zpMachineStatus
|
|
|
|
and #HAS_128K
|
|
|
|
beq +
|
|
|
|
+LDADDR Loading128K
|
|
|
|
bne @printMem
|
2019-08-27 17:55:54 +00:00
|
|
|
+
|
2020-03-05 17:38:53 +00:00
|
|
|
+LDADDR Loading64K
|
|
|
|
@printMem
|
2024-05-28 22:57:51 +00:00
|
|
|
jsr LoadingPrint ; requires ROM read
|
2020-03-05 17:38:53 +00:00
|
|
|
|
|
|
|
; if zpMachineStatus AND HAS_JOYSTICK then CR & print 'joystick'
|
|
|
|
lda zpMachineStatus
|
|
|
|
and #HAS_JOYSTICK
|
|
|
|
beq +
|
|
|
|
+LDADDR LoadingJoystick
|
2024-05-28 22:57:51 +00:00
|
|
|
jsr LoadingPrint ; requires ROM read
|
2020-03-05 17:38:53 +00:00
|
|
|
+
|
|
|
|
; if zpMachineStatus AND HAS_VIDHD then CR & print 'VidHD'
|
|
|
|
lda zpMachineStatus
|
|
|
|
and #HAS_VIDHD
|
|
|
|
beq +
|
|
|
|
+LDADDR LoadingVidHD
|
2024-05-28 22:57:51 +00:00
|
|
|
jsr LoadingPrint ; requires ROM read
|
2019-08-27 17:55:54 +00:00
|
|
|
+
|
|
|
|
|
|
|
|
@Relocate
|
2020-08-12 15:35:21 +00:00
|
|
|
; if zpMachineStatus AND IS_IIGS then check for CFFA
|
|
|
|
; before performing any further disk access
|
|
|
|
lda zpMachineStatus
|
|
|
|
and #IS_IIGS
|
|
|
|
beq +
|
|
|
|
jsr HackThaCFFA
|
|
|
|
+
|
2024-05-28 22:57:51 +00:00
|
|
|
; initialize and relocate ProRWTS2 to $D400 in LC RAM bank 2
|
2019-06-20 01:36:49 +00:00
|
|
|
+READ_ROM_WRITE_RAM2
|
2024-05-28 22:57:51 +00:00
|
|
|
jsr init ; requires RAM2 write
|
|
|
|
|
|
|
|
; overwrite ProDOS IRQ handler
|
|
|
|
sei
|
2024-01-18 06:43:57 +00:00
|
|
|
lda #<NOIRQ
|
|
|
|
sta $3FE
|
2024-05-28 22:57:51 +00:00
|
|
|
lda #>NOIRQ
|
2024-01-18 06:43:57 +00:00
|
|
|
sta $3FF
|
|
|
|
cli
|
2019-06-20 01:50:48 +00:00
|
|
|
|
2024-05-28 22:57:51 +00:00
|
|
|
; relocate pseudo-ProDOS to LC RAM bank 2
|
|
|
|
ldx #$00
|
2020-01-28 19:19:10 +00:00
|
|
|
ldy #>(255 + EvenLasterMover - LastMover)
|
2024-05-28 22:57:51 +00:00
|
|
|
@LM lda COPYSRC, x
|
|
|
|
sta COPYDST, x ; requires RAM2 write
|
2020-01-28 19:19:10 +00:00
|
|
|
inx
|
|
|
|
bne @LM
|
|
|
|
inc @LM+2
|
|
|
|
inc @LM+5
|
|
|
|
dey
|
|
|
|
bne @LM
|
|
|
|
|
2024-05-28 22:57:51 +00:00
|
|
|
jsr BuildAcceleratorFunction ; requires ROM read
|
|
|
|
+ST16 @accelSrc
|
|
|
|
dex
|
|
|
|
-
|
|
|
|
@accelSrc=*+1
|
|
|
|
lda $FDFD,x ; copy (de)acceleration functions to LC RAM bank 2
|
|
|
|
sta DisableAccelerator,x ; requires RAM2 write
|
|
|
|
dex
|
|
|
|
bpl -
|
|
|
|
; X=FF
|
|
|
|
|
|
|
|
; relocate program code to LC RAM bank 1
|
|
|
|
; since we end at $0000 now, we adjust low offset to avoid destroying zpage
|
|
|
|
+READ_ROM_WRITE_RAM1
|
|
|
|
inx
|
|
|
|
;X=0
|
|
|
|
@FM lda FirstMover - (RELBASE & $FF), x
|
|
|
|
sta RELBASE & $FF00, x ; requires RAM1 write
|
|
|
|
inx
|
|
|
|
bne @FM
|
|
|
|
inc @FM+2
|
|
|
|
inc @FM+5
|
|
|
|
bne @FM
|
|
|
|
;X=0
|
|
|
|
|
|
|
|
; relocate font data to LC RAM bank 1
|
2019-09-30 18:18:57 +00:00
|
|
|
ldy #4
|
2024-05-28 22:57:51 +00:00
|
|
|
@ELM lda FONTSRC, x
|
|
|
|
sta FONTDST, x ; requires RAM1 write
|
2019-09-30 18:18:57 +00:00
|
|
|
inx
|
|
|
|
bne @ELM
|
|
|
|
inc @ELM+2
|
|
|
|
inc @ELM+5
|
|
|
|
dey
|
|
|
|
bne @ELM
|
|
|
|
|
2020-07-27 03:35:42 +00:00
|
|
|
+DISABLE_ACCEL ; cycle counting in Mockingboard detection requires 1MHz
|
2024-05-28 22:57:51 +00:00
|
|
|
; /!\ macro exits with ROM read, no write
|
2020-03-05 17:38:53 +00:00
|
|
|
+LDADDR FoundMockingboardCallback
|
2024-05-28 22:57:51 +00:00
|
|
|
jsr GetMockingboardStuff ; requires ROM read
|
|
|
|
; /!\ exits with ROM read, no write
|
|
|
|
+READ_ROM_WRITE_RAM1
|
|
|
|
stx MockingboardStuff ; save mockingboard slot and type
|
2024-06-12 20:25:08 +00:00
|
|
|
txa ; requires RAM1 write
|
|
|
|
php
|
2024-05-28 22:57:51 +00:00
|
|
|
jsr BuildVBLFunction ; requires ROM read, RAM1 write
|
2024-06-12 20:25:08 +00:00
|
|
|
plp
|
2024-05-28 22:57:51 +00:00
|
|
|
beq @done_with_mb
|
2023-01-06 19:36:12 +00:00
|
|
|
and #HAS_STEREO
|
|
|
|
beq @mb_mono
|
|
|
|
+LDADDR LoadingMockingboardStereo
|
|
|
|
bne @mb_print
|
|
|
|
@mb_mono
|
|
|
|
+LDADDR LoadingMockingboardStereo
|
|
|
|
@mb_print
|
2024-05-28 22:57:51 +00:00
|
|
|
jsr LoadingPrint ; requires ROM read
|
2023-01-06 19:36:12 +00:00
|
|
|
|
2020-03-05 17:38:53 +00:00
|
|
|
; if Mockingboard AND HAS_SPEECH then print CR & '...and it talks!'
|
|
|
|
txa
|
|
|
|
and #HAS_SPEECH
|
2024-05-28 22:57:51 +00:00
|
|
|
beq @done_with_mb
|
2020-03-05 17:38:53 +00:00
|
|
|
+LDADDR LoadingMockingboardSpeech
|
2024-05-28 22:57:51 +00:00
|
|
|
jsr LoadingPrint ; requires ROM read
|
2020-03-05 17:38:53 +00:00
|
|
|
|
2024-05-28 22:57:51 +00:00
|
|
|
@done_with_mb
|
|
|
|
+READ_RAM2_NO_WRITE
|
|
|
|
jsr EnableAccelerator ; requires RAM2 read
|
2018-11-07 23:56:39 +00:00
|
|
|
jmp OneTimeSetup
|
|
|
|
|
|
|
|
; ProRWTS2 has its own function to relocate itself
|
|
|
|
!source "src/prorwts2.a"
|
|
|
|
ProRWTSBuffer
|
2018-11-10 13:36:36 +00:00
|
|
|
; these routines will only be called once, from main memory, before relocating to language card
|
2019-01-13 23:55:40 +00:00
|
|
|
!source "src/hw.vidhd.a"
|
2018-11-07 23:56:39 +00:00
|
|
|
!source "src/hw.memcheck.a"
|
|
|
|
!source "src/hw.joystick.a"
|
2020-01-29 23:52:33 +00:00
|
|
|
!source "src/hw.mockingboard.a"
|
|
|
|
|
2020-03-05 17:38:53 +00:00
|
|
|
SetCursorPosition
|
|
|
|
stx HTAB
|
|
|
|
sty VTAB
|
|
|
|
jmp $FC22
|
|
|
|
|
|
|
|
LoadingPrint
|
2020-03-24 20:30:14 +00:00
|
|
|
+ST16 PTR
|
2020-03-05 17:38:53 +00:00
|
|
|
ldy #0
|
|
|
|
lda (PTR),y
|
|
|
|
sta @max
|
|
|
|
sty i
|
|
|
|
- inc i
|
|
|
|
ldy i
|
|
|
|
lda (PTR),y
|
|
|
|
ora #$80
|
|
|
|
+FORCE_UPPERCASE_IF_REQUIRED
|
|
|
|
jsr ROM_COUT
|
|
|
|
ldy i
|
|
|
|
@max=*+1
|
|
|
|
cpy #$FD ; SMC
|
|
|
|
bne -
|
|
|
|
rts
|
|
|
|
|
|
|
|
FoundMockingboardCallback
|
|
|
|
; in: zp$81 contains slot number in form $Cx
|
|
|
|
+LDADDR LoadingMockingboard
|
|
|
|
jsr LoadingPrint
|
|
|
|
lda $81
|
|
|
|
and #$0F
|
|
|
|
ora #$B0
|
|
|
|
jmp ROM_COUT
|
|
|
|
|
2024-01-18 06:43:57 +00:00
|
|
|
NOIRQ rti
|
|
|
|
|
2023-11-13 20:49:31 +00:00
|
|
|
!src "src/4cade.branding.a"
|
2023-11-18 02:18:51 +00:00
|
|
|
!src "src/4cade.version.a"
|
2023-11-13 20:49:31 +00:00
|
|
|
|
2020-03-05 17:38:53 +00:00
|
|
|
Loading64K
|
2024-05-25 21:49:51 +00:00
|
|
|
+PSTRING "64K"
|
2020-03-05 17:38:53 +00:00
|
|
|
Loading128K
|
2024-05-25 21:49:51 +00:00
|
|
|
+PSTRING "128K"
|
2020-03-05 17:38:53 +00:00
|
|
|
LoadingIIgs
|
2024-05-25 21:49:51 +00:00
|
|
|
+PSTRING "IIgs"
|
2020-03-05 17:38:53 +00:00
|
|
|
LoadingJoystick
|
2024-05-25 21:49:51 +00:00
|
|
|
+PSTRING "\rjoystick"
|
2020-03-05 17:38:53 +00:00
|
|
|
LoadingVidHD
|
2024-05-25 21:49:51 +00:00
|
|
|
+PSTRING "\rVidHD"
|
2020-03-05 17:38:53 +00:00
|
|
|
LoadingMockingboard
|
2024-05-25 21:49:51 +00:00
|
|
|
+PSTRING "\rMockingboard in slot "
|
2023-01-06 19:36:12 +00:00
|
|
|
LoadingMockingboardStereo
|
2024-05-25 21:49:51 +00:00
|
|
|
+PSTRING "\rStereo"
|
2023-01-06 19:36:12 +00:00
|
|
|
LoadingMockingboardMono
|
2024-05-25 21:49:51 +00:00
|
|
|
+PSTRING "\rMono"
|
2020-03-05 17:38:53 +00:00
|
|
|
LoadingMockingboardSpeech
|
2024-05-25 21:49:51 +00:00
|
|
|
+PSTRING "...and it talks!"
|
2019-08-27 17:55:54 +00:00
|
|
|
|
2019-10-14 02:29:25 +00:00
|
|
|
!ifndef RELEASE {
|
2019-10-14 01:38:54 +00:00
|
|
|
PrintAsDecimal
|
|
|
|
jsr $FF4A
|
2020-02-07 13:32:05 +00:00
|
|
|
|
2020-03-05 17:38:53 +00:00
|
|
|
lda $FDE2
|
2020-02-07 13:32:05 +00:00
|
|
|
cmp #$EA
|
2020-03-05 17:38:53 +00:00
|
|
|
bne +
|
|
|
|
dec @addr+1 ; fix for Laser
|
|
|
|
+
|
2019-10-14 01:38:54 +00:00
|
|
|
-- lda #$00
|
|
|
|
clv
|
|
|
|
ldx #$18
|
|
|
|
- cmp #$05
|
|
|
|
bcc +
|
|
|
|
sbc #$85
|
|
|
|
sec
|
|
|
|
+ rol $45
|
|
|
|
rol $46
|
|
|
|
rol $47
|
|
|
|
rol
|
|
|
|
dex
|
|
|
|
bne -
|
|
|
|
pha
|
|
|
|
lda #$FD
|
|
|
|
pha
|
2020-02-07 13:32:05 +00:00
|
|
|
@addr lda #$E1
|
2019-10-14 01:38:54 +00:00
|
|
|
pha
|
|
|
|
bvs --
|
|
|
|
rts
|
2019-10-14 02:29:25 +00:00
|
|
|
}
|
2019-10-14 01:38:54 +00:00
|
|
|
|
2019-10-09 17:15:33 +00:00
|
|
|
!source "src/hw.accel.a"
|
2020-03-17 22:30:20 +00:00
|
|
|
!source "src/hw.vbl.init.a"
|
2021-10-13 01:54:33 +00:00
|
|
|
!source "src/parse.common.a"
|
2019-06-24 02:32:18 +00:00
|
|
|
|
2018-11-07 23:56:39 +00:00
|
|
|
OneTimeSetup
|
2024-05-28 22:57:51 +00:00
|
|
|
+READ_ROM_WRITE_RAM1
|
2019-06-27 13:51:17 +00:00
|
|
|
lda zpMachineStatus
|
2024-05-28 22:57:51 +00:00
|
|
|
sta MachineStatus ; save machine status
|
|
|
|
; requires RAM1 write
|
2020-07-30 04:37:32 +00:00
|
|
|
and #IS_IIGS
|
|
|
|
beq @NotGSOS
|
|
|
|
!cpu 65816
|
|
|
|
lda $E100BD ; Make sure GS/OS was the boot OS
|
|
|
|
!cpu 6502
|
|
|
|
beq @NotGSOS
|
2020-08-13 23:12:57 +00:00
|
|
|
jsr PrepareGSOS
|
2020-07-30 04:37:32 +00:00
|
|
|
@NotGSOS
|
|
|
|
|
2024-05-28 22:57:51 +00:00
|
|
|
; initialize ProDOS shim
|
|
|
|
+READ_RAM2_WRITE_RAM2
|
2019-10-01 20:08:50 +00:00
|
|
|
ldy #$0b
|
2024-05-28 22:57:51 +00:00
|
|
|
- lda $BF13, y
|
|
|
|
sta promote + $13, y ; requires RAM2 write
|
2019-10-01 20:08:50 +00:00
|
|
|
dey
|
2024-05-28 22:57:51 +00:00
|
|
|
bpl -
|
|
|
|
; save unit in LC bank 2 while overriding !pseudopc
|
2019-10-01 20:08:50 +00:00
|
|
|
lda $BF30
|
2024-05-28 22:57:51 +00:00
|
|
|
sta promote + ProDOS_unit - $bf00 ; requires RAM2 write
|
2019-09-09 21:28:13 +00:00
|
|
|
|
2024-05-28 22:57:51 +00:00
|
|
|
; save current directory as 'root'
|
|
|
|
lda hddopendir+1 ; requires RAM2 read
|
|
|
|
ldy hddopendir+3 ; requires RAM2 read
|
|
|
|
sta gRootDirectory+1 ; requires RAM2 write
|
|
|
|
sty gRootDirectory+3 ; requires RAM2 write
|
2018-11-07 23:56:39 +00:00
|
|
|
|
2024-05-28 22:57:51 +00:00
|
|
|
; load raw preferences file into $8000
|
|
|
|
+READ_RAM1_WRITE_RAM1
|
|
|
|
jsr LoadFile ; requires RAM1 read
|
|
|
|
; exits with RAM1 read/write
|
2019-09-10 02:38:17 +00:00
|
|
|
!word kRootDirectory
|
|
|
|
!word kGlobalPrefsFilename
|
2019-09-10 02:58:16 +00:00
|
|
|
- !word $8000
|
2024-05-28 22:57:51 +00:00
|
|
|
|
|
|
|
; parse raw preferences file into OKVS data structure
|
|
|
|
jsr ParseKeyValueList ; requires RAM1 write because that's where gGlobalPrefsStore is
|
2018-11-10 15:08:14 +00:00
|
|
|
!word gGlobalPrefsStore
|
2019-09-10 02:58:16 +00:00
|
|
|
!word -
|
2018-11-10 15:08:14 +00:00
|
|
|
!byte 16
|
2018-12-29 18:38:18 +00:00
|
|
|
|
2024-05-28 22:57:51 +00:00
|
|
|
; see if cheats are enabled by default
|
|
|
|
jsr pref_get ; requires RAM1 read
|
2021-10-12 23:37:45 +00:00
|
|
|
; sets PTR -> cheat pref value as length-prefixed string '1' or '0'
|
2019-09-16 17:36:48 +00:00
|
|
|
!word kCheat
|
|
|
|
!word 0
|
|
|
|
ldy #1
|
|
|
|
lda (PTR),y ; A = #$B1 or #$B0
|
|
|
|
and #1 ; A = #$01 or #$00
|
2019-10-05 01:34:49 +00:00
|
|
|
asl
|
|
|
|
asl
|
2020-03-05 17:38:53 +00:00
|
|
|
asl ; A = #$08 or #$00
|
2024-05-28 22:57:51 +00:00
|
|
|
ora MachineStatus ; requires RAM1 read
|
2020-03-05 17:38:53 +00:00
|
|
|
sta MachineStatus ; set bit 3 of MachineStatus
|
2024-05-28 22:57:51 +00:00
|
|
|
; requires RAM1 write
|
2019-09-15 21:55:16 +00:00
|
|
|
|
2021-11-13 21:18:58 +00:00
|
|
|
rol
|
|
|
|
rol
|
|
|
|
rol
|
|
|
|
rol
|
|
|
|
and #%00000110
|
|
|
|
tax ; X in (0,2,4,6)
|
|
|
|
ldy kGameCounts, x
|
|
|
|
sty GameCount ; store total game count based on based on (has-joystick) X (has-128K)
|
2024-05-28 22:57:51 +00:00
|
|
|
; requires RAM1 write
|
2021-11-13 21:18:58 +00:00
|
|
|
sty SAVE
|
|
|
|
ldy kGameCounts+1, x
|
2024-05-28 22:57:51 +00:00
|
|
|
sty GameCount+1 ; requires RAM1 write
|
2021-11-13 21:18:58 +00:00
|
|
|
sty SAVE+1
|
|
|
|
lsr
|
|
|
|
tax ; X in (0,1,2,3)
|
|
|
|
lda kSearchIndexLo, x
|
|
|
|
sta @searchIndexSrc+1 ; set up search index record based on (has-joystick) X (has-128K)
|
|
|
|
lda kSearchIndexHi, x
|
|
|
|
sta @searchIndexSrc+2
|
|
|
|
lda kSearchCacheLo, x
|
|
|
|
sta @searchCacheSrc+1 ; set up search cache record based on (has-joystick) X (has-128K)
|
|
|
|
lda kSearchCacheHi, x
|
|
|
|
sta @searchCacheSrc+2
|
|
|
|
ldy #5
|
|
|
|
@searchIndexSrc
|
|
|
|
lda $FDFD, y ; SMC
|
2024-05-28 22:57:51 +00:00
|
|
|
sta kSearchIndexRecord, y ; requires RAM1 write
|
2021-11-13 21:18:58 +00:00
|
|
|
@searchCacheSrc
|
|
|
|
lda $FDFD, y
|
2024-05-28 22:57:51 +00:00
|
|
|
sta kSearchCacheRecord, y ; requires RAM1 write
|
2021-11-13 21:18:58 +00:00
|
|
|
dey
|
|
|
|
bpl @searchIndexSrc
|
|
|
|
|
|
|
|
; convert GameCount (word) to VisibleGameCount (3-digit decimal number as ASCII string)
|
|
|
|
iny ; Y = 0
|
2019-06-23 18:24:09 +00:00
|
|
|
@outer
|
|
|
|
lda #0
|
|
|
|
pha
|
|
|
|
@inner
|
|
|
|
lda SAVE
|
2020-03-24 20:30:14 +00:00
|
|
|
sec
|
2019-06-30 19:10:09 +00:00
|
|
|
sbc @kPowersOfTen,y
|
2019-06-23 18:24:09 +00:00
|
|
|
sta SAVE
|
|
|
|
lda SAVE+1
|
|
|
|
sbc #0
|
2020-03-24 20:30:14 +00:00
|
|
|
bcc @digitDone
|
2019-06-23 18:24:09 +00:00
|
|
|
sta SAVE+1
|
|
|
|
pla
|
|
|
|
adc #0
|
|
|
|
pha
|
|
|
|
jmp @inner
|
|
|
|
@digitDone
|
2020-03-24 20:30:14 +00:00
|
|
|
lda SAVE
|
|
|
|
adc @kPowersOfTen,y
|
|
|
|
sta SAVE
|
2019-06-23 18:24:09 +00:00
|
|
|
pla
|
|
|
|
ora #$30
|
2024-05-28 22:57:51 +00:00
|
|
|
sta VisibleGameCount,y ; requires RAM1 write
|
2019-06-23 18:24:09 +00:00
|
|
|
iny
|
|
|
|
cpy #$03
|
|
|
|
bcc @outer
|
|
|
|
|
2019-06-27 14:55:07 +00:00
|
|
|
bit CLEARKBD
|
2024-05-28 22:57:51 +00:00
|
|
|
jmp Reenter ; requires RAM1 or RAM2 read
|
2018-11-17 14:43:20 +00:00
|
|
|
|
2019-06-30 19:10:09 +00:00
|
|
|
@kPowersOfTen
|
2019-06-23 18:24:09 +00:00
|
|
|
!byte 100
|
|
|
|
!byte 10
|
|
|
|
!byte 1
|
2021-11-13 21:18:58 +00:00
|
|
|
|
|
|
|
kSearchIndexLo
|
|
|
|
!byte <kSearchIndexRecord00
|
|
|
|
!byte <kSearchIndexRecord01
|
|
|
|
!byte <kSearchIndexRecord10
|
|
|
|
!byte <kSearchIndexRecord11
|
|
|
|
kSearchIndexHi
|
|
|
|
!byte >kSearchIndexRecord00
|
|
|
|
!byte >kSearchIndexRecord01
|
|
|
|
!byte >kSearchIndexRecord10
|
|
|
|
!byte >kSearchIndexRecord11
|
|
|
|
kSearchCacheLo
|
|
|
|
!byte <kSearchCacheRecord00
|
|
|
|
!byte <kSearchCacheRecord01
|
|
|
|
!byte <kSearchCacheRecord10
|
|
|
|
!byte <kSearchCacheRecord11
|
|
|
|
kSearchCacheHi
|
|
|
|
!byte >kSearchCacheRecord00
|
|
|
|
!byte >kSearchCacheRecord01
|
|
|
|
!byte >kSearchCacheRecord10
|
|
|
|
!byte >kSearchCacheRecord11
|
|
|
|
kSearchIndexRecord00
|
|
|
|
!source "src/index/search00.idx.a"
|
|
|
|
kSearchIndexRecord01
|
|
|
|
!source "src/index/search01.idx.a"
|
|
|
|
kSearchIndexRecord10
|
|
|
|
!source "src/index/search10.idx.a"
|
|
|
|
kSearchIndexRecord11
|
|
|
|
!source "src/index/search11.idx.a"
|
|
|
|
kSearchCacheRecord00
|
|
|
|
!source "src/index/cache00.idx.a"
|
|
|
|
kSearchCacheRecord01
|
|
|
|
!source "src/index/cache01.idx.a"
|
|
|
|
kSearchCacheRecord10
|
|
|
|
!source "src/index/cache10.idx.a"
|
|
|
|
kSearchCacheRecord11
|
|
|
|
!source "src/index/cache11.idx.a"
|
|
|
|
kGameCounts
|
|
|
|
!source "src/index/count00.a"
|
|
|
|
!source "src/index/count01.a"
|
|
|
|
!source "src/index/count10.a"
|
|
|
|
!source "src/index/count11.a"
|