mirror of
https://github.com/a2-4am/4cade.git
synced 2025-02-17 07:31:19 +00:00
clean up bootloader and consolidate duplicate code
This commit is contained in:
parent
2f206dfc91
commit
60b1f68c9d
@ -3,32 +3,18 @@
|
||||
;
|
||||
|
||||
PrintBranding
|
||||
ldy #9
|
||||
- lda TOTAL-1,y
|
||||
ora #$80
|
||||
sta $04B7-1,y
|
||||
dey
|
||||
bne -
|
||||
; in: text screen is showing
|
||||
; out: Y = 0 (important! some callers rely on this!)
|
||||
ldy #11
|
||||
- lda REPLAY-1,y
|
||||
ora #$80
|
||||
sta $0536-1,y
|
||||
- lda TOTAL-1, y
|
||||
sta $04B5-1, y
|
||||
lda REPLAY-1, y
|
||||
sta $0535-1, y
|
||||
dey
|
||||
bne -
|
||||
rts
|
||||
|
||||
TOTAL
|
||||
!text "T O T A L"
|
||||
!scrxor $80," T O T A L "
|
||||
REPLAY
|
||||
!text "R E P L A Y"
|
||||
!ifndef RELEASE {
|
||||
LoadingVersion
|
||||
!byte 8
|
||||
!text " build "
|
||||
LoadingBuild
|
||||
!word BUILDNUMBER
|
||||
} else {
|
||||
LoadingVersion
|
||||
!byte 12
|
||||
!text " v5.0.1"
|
||||
}
|
||||
!scrxor $80,"R E P L A Y"
|
||||
|
@ -7,28 +7,8 @@
|
||||
; .SYSTEM file is loaded
|
||||
;
|
||||
|
||||
+READ_ROM_NO_WRITE
|
||||
sta PRIMARYCHARSET
|
||||
sta CLR80VID
|
||||
sta STOREOFF
|
||||
sta READMAINMEM
|
||||
sta WRITEMAINMEM
|
||||
jsr ROM_TEXT
|
||||
jsr ROM_HOME
|
||||
jsr ROM_NORMAL
|
||||
jsr ROM_IN0
|
||||
jsr ROM_PR0
|
||||
|
||||
; accommodate uppercase-only machines (64K ][ and ][+ are supported)
|
||||
lda ROM_MACHINEID
|
||||
cmp #$A0
|
||||
beq + ; Spectrum ED
|
||||
cmp #$06
|
||||
beq +
|
||||
lda #$DF
|
||||
+HIDE_NEXT_2_BYTES
|
||||
+ lda #$FF
|
||||
sta zpCharMask
|
||||
!src "src/4cade.init.machine.a"
|
||||
!src "src/4cade.init.screen.a"
|
||||
|
||||
; print text title in same place as graphical title will appear
|
||||
jsr PrintBranding
|
||||
@ -36,6 +16,9 @@
|
||||
; 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
|
||||
!if (* != ProBootEntry) {
|
||||
!serious "ProBootEntry is wrong, should be ", *
|
||||
}
|
||||
|
||||
jsr Has64K ; check for 64K (required)
|
||||
bcc +
|
||||
@ -99,6 +82,17 @@
|
||||
sta MONOCOLOR ; bit 7=1 disables color
|
||||
+
|
||||
|
||||
; accommodate uppercase-only machines (64K ][ and ][+ are supported)
|
||||
lda ROM_MACHINEID
|
||||
cmp #$A0
|
||||
beq + ; Spectrum ED
|
||||
cmp #$06
|
||||
beq +
|
||||
lda #$DF
|
||||
+HIDE_NEXT_2_BYTES
|
||||
+ lda #$FF
|
||||
sta zpCharMask
|
||||
|
||||
; 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
|
||||
@ -288,6 +282,7 @@ FoundMockingboardCallback
|
||||
jmp ROM_COUT
|
||||
|
||||
!src "src/4cade.branding.a"
|
||||
!src "src/4cade.version.a"
|
||||
|
||||
Loading64K
|
||||
!byte 3
|
||||
|
15
src/4cade.init.machine.a
Normal file
15
src/4cade.init.machine.a
Normal file
@ -0,0 +1,15 @@
|
||||
;license:MIT
|
||||
;(c) 2023 by 4am
|
||||
;
|
||||
; initialize machine from a cold boot
|
||||
; assumes absolutely nothing about machine state
|
||||
;
|
||||
; note: this file is included by both the launcher and proboothd
|
||||
|
||||
cld
|
||||
+READ_ROM_NO_WRITE
|
||||
sta PRIMARYCHARSET
|
||||
sta CLR80VID
|
||||
sta STOREOFF
|
||||
sta READMAINMEM
|
||||
sta WRITEMAINMEM
|
14
src/4cade.init.screen.a
Normal file
14
src/4cade.init.screen.a
Normal file
@ -0,0 +1,14 @@
|
||||
;license:MIT
|
||||
;(c) 2023 by 4am
|
||||
;
|
||||
; initialize and clear screen
|
||||
; assumes zero page is completely trashed other than |zpCharMask|
|
||||
; assumes ROM is banked in on entry
|
||||
;
|
||||
; note: this file is included by both the launcher and proboothd
|
||||
|
||||
jsr ROM_TEXT
|
||||
jsr ROM_HOME
|
||||
jsr ROM_NORMAL
|
||||
jsr ROM_IN0
|
||||
jsr ROM_PR0
|
15
src/4cade.version.a
Normal file
15
src/4cade.version.a
Normal file
@ -0,0 +1,15 @@
|
||||
;license:MIT
|
||||
;(c) 2023 by 4am
|
||||
;
|
||||
|
||||
!ifndef RELEASE {
|
||||
LoadingVersion
|
||||
!byte 8
|
||||
!text " build "
|
||||
LoadingBuild
|
||||
!word BUILDNUMBER
|
||||
} else {
|
||||
LoadingVersion
|
||||
!byte 12
|
||||
!text " v5.0.1"
|
||||
}
|
@ -161,6 +161,7 @@ gKey = $1F01
|
||||
UILine1 = $1FB0
|
||||
UILine2 = $1FD8
|
||||
UI_ToPlay = $1FF7
|
||||
ProBootEntry = $2025
|
||||
|
||||
gValLen = $1F80
|
||||
gVal = $1F81
|
||||
|
@ -5,6 +5,8 @@
|
||||
!to "build/proboothd",plain
|
||||
*=$800
|
||||
|
||||
!src "src/macros.a"
|
||||
|
||||
;zpage usage, arbitrary selection except for the "ProDOS constant" ones
|
||||
command = $42 ;ProDOS constant
|
||||
unit = $43 ;ProDOS constant
|
||||
@ -25,34 +27,21 @@
|
||||
txa
|
||||
pha
|
||||
|
||||
; put machine in a known state, clear screen
|
||||
!src "src/4cade.init.machine.a"
|
||||
|
||||
cld
|
||||
bit $c082
|
||||
sta $c00e
|
||||
sta $c00c
|
||||
sta $c000
|
||||
sta $c002
|
||||
sta $c004
|
||||
lda $c000
|
||||
cmp #$d3 ; Press "S" on bootup
|
||||
lda KBD
|
||||
cmp #$D3 ; 'S'
|
||||
beq @s
|
||||
cmp #$F3 ; 's'
|
||||
bne +
|
||||
@s
|
||||
jsr seasons
|
||||
+ jsr $fb2f
|
||||
jsr $fc58
|
||||
jsr $fe84
|
||||
jsr $fe89
|
||||
jsr $fe93
|
||||
+
|
||||
!src "src/4cade.init.screen.a"
|
||||
|
||||
; print title
|
||||
; print text title in same place as graphical title will appear
|
||||
jsr PrintBranding
|
||||
|
||||
ldy #11
|
||||
- lda TOTAL-1, y
|
||||
sta $04B6-1, y
|
||||
lda REPLAY-1, y
|
||||
sta $0536-1, y
|
||||
dey
|
||||
bne -
|
||||
pla
|
||||
sta unit
|
||||
tax
|
||||
@ -151,7 +140,7 @@ blockind ldy $ff
|
||||
txa
|
||||
bne readfile
|
||||
|
||||
readdone jmp $2036
|
||||
readdone jmp ProBootEntry
|
||||
|
||||
seekread stx bloklo
|
||||
sty blokhi
|
||||
@ -369,10 +358,12 @@ filename
|
||||
filename_b
|
||||
!text "LAUNCHER.SYSTEM" ;your start-up file, file is max 40kb
|
||||
filename_e
|
||||
TOTAL
|
||||
!byte $A0,$D4,$A0,$CF,$A0,$D4,$A0,$C1,$A0,$CC,$A0
|
||||
REPLAY
|
||||
!byte $D2,$A0,$C5,$A0,$D0,$A0,$CC,$A0,$C1,$A0,$D9
|
||||
|
||||
!src "src/4cade.branding.a"
|
||||
|
||||
!if (* > $9f7) {
|
||||
!serious "Bootloader is too large"
|
||||
}
|
||||
|
||||
*=$9f8
|
||||
!byte $D3,$C1,$CE,$A0,$C9,$CE,$C3,$AE
|
||||
|
Loading…
x
Reference in New Issue
Block a user