Refactor screen init to allow for all modes

This commit is contained in:
Lucas Scharenbroich 2021-03-21 23:23:52 -05:00
parent 50a3f27a9a
commit cfa1bd6f61

View File

@ -1,16 +1,6 @@
; Test program for graphics stufff...
;
; Allow dynamic resizing to benchmark against different games
;
; 1. Full Screen : 320 x 200 (32,000 bytes (100.0%))
; 2. Sword of Sodan : 272 x 192 (26,112 bytes ( 81.6%))
; 3. ~NES : 256 x 200 (25,600 bytes ( 80.0%))
; 4. Task Force : 256 x 176 (22,528 bytes ( 70.4%))
; 5. Defender of the World : 280 x 160 (22,400 bytes ( 70.0%))
; 6. Rastan : 256 x 160 (20,480 bytes ( 64.0%))
; 7. Game Boy Advanced : 240 x 160 (19,200 bytes ( 60.0%))
; 8. Ancient Land of Y's : 288 x 128 (18,432 bytes ( 57.6%))
; 9. Game Boy Color : 160 x 144 (11,520 bytes ( 36.0%))
rel
@ -79,10 +69,8 @@ SHR_SCB equ $E19D00
jsr BlitInit ; Initialize the memory
jsr GrafInit ; Initialize the graphics screen
lda #16*256+28 ; Place the playfield at (16, 28) with
ldx #128 ; a width of 128 bytes (256 pixels) and
ldy #144 ; 144 scan lines
jsr SetScreenRect
; ldx #6 ; Gameboy Advance size
; jsr SetScreenMode
lda #0 ; Set the virtual Y-position
jsr SetYPos
@ -117,6 +105,53 @@ EvtLoop
jsr DoHUP
:5 bra EvtLoop
; Allow the user to dynamically select one of the pre-configured screen sizes
;
; 1. Full Screen : 40 x 25 320 x 200 (32,000 bytes (100.0%))
; 2. Sword of Sodan : 34 x 24 272 x 192 (26,112 bytes ( 81.6%))
; 3. ~NES : 32 x 25 256 x 200 (25,600 bytes ( 80.0%))
; 4. Task Force : 32 x 22 256 x 176 (22,528 bytes ( 70.4%))
; 5. Defender of the World : 35 x 20 280 x 160 (22,400 bytes ( 70.0%))
; 6. Rastan : 32 x 20 256 x 160 (20,480 bytes ( 64.0%))
; 7. Game Boy Advanced : 30 x 20 240 x 160 (19,200 bytes ( 60.0%))
; 8. Ancient Land of Y's : 36 x 16 288 x 128 (18,432 bytes ( 57.6%))
; 9. Game Boy Color : 20 x 18 160 x 144 (11,520 bytes ( 36.0%))
;
; X=mode number
]ScreenModeWidth dw 320,272,256,256,280,256,240,288,160
]ScreenModeHeight dw 200,192,200,176,160,160,160,128,144
SetScreenMode cpx #8
bcc :rangeOk
ldx #8
:rangeOk txa
asl
tax
lda #320 ; Calculate the screen offset
sec
sbc: ]ScreenModeWidth,x
lsr
lsr
xba
pha
lda #200
sec
sbc: ]ScreenModeHeight,x
lsr
ora 1,s
sta 1,s
ldy: ]ScreenModeHeight,x
lda: ]ScreenModeWidth,x
lsr
tax
pla
jsr SetScreenRect
rts
SecondsStr str 'SECONDS'
TicksStr str 'TICKS'
@ -612,6 +647,12 @@ qtRec adrl $0000