Allow dynamic user selection of playfield size

This commit is contained in:
Lucas Scharenbroich 2021-03-21 23:44:33 -05:00
parent cfa1bd6f61
commit 04f202c9f8
2 changed files with 57 additions and 3 deletions

View File

@ -69,8 +69,8 @@ SHR_SCB equ $E19D00
jsr BlitInit ; Initialize the memory
jsr GrafInit ; Initialize the graphics screen
; ldx #6 ; Gameboy Advance size
; jsr SetScreenMode
ldx #6 ; Gameboy Advance size
jsr SetScreenMode
lda #0 ; Set the virtual Y-position
jsr SetYPos
@ -81,6 +81,7 @@ SHR_SCB equ $E19D00
sta BankLoad ; Store "Bank Pointer"
EvtLoop
jsr WaitForKey
cmp #'q'
bne :1
brl Exit
@ -103,7 +104,17 @@ EvtLoop
:4 cmp #'h' ; Show the 'h'eads up display
bne :5
jsr DoHUP
:5 bra EvtLoop
:5 cmp #'1'
bcc :6
cmp #'9'+1
bcs :6
sec
sbc #'1'
tax
jsr SetScreenMode
:6 bra EvtLoop
; Allow the user to dynamically select one of the pre-configured screen sizes
;
@ -150,6 +161,7 @@ SetScreenMode cpx #8
tax
pla
jsr SetScreenRect
jsr FillScreen
rts
SecondsStr str 'SECONDS'
@ -657,6 +669,8 @@ qtRec adrl $0000

View File

@ -103,6 +103,37 @@ SetScreenRect sty ScreenHeight ; Save the screen height a
rts
; Clear the SHR screen and then infill the defined field
FillScreen lda #0
jsr ClearToColor
ldy ScreenY0
]yloop
tya
asl a
tax
lda ScreenAddr,x
clc
adc ScreenX0
tax
phy
lda ScreenWidth
lsr
tay
lda #$FFFF
]xloop stal $E10000,x
inx
inx
dey
bne ]xloop
ply
iny
cpy ScreenY1
bcc ]yloop
rts
; Set the starting line of the virtual buffer that will be displayed on the first physical line
; of the playfield.
;
@ -1011,6 +1042,15 @@ top