Change GTESetScreenMode to use bytes for the width

This commit is contained in:
Lucas Scharenbroich 2022-07-26 00:21:22 -05:00
parent 68b8ca5856
commit 5a0e0e447e
4 changed files with 10 additions and 11 deletions

View File

@ -75,8 +75,8 @@ SpriteCount equ 50
; Initialize the graphics screen playfield ; Initialize the graphics screen playfield
pea #320 pea #160 ; width in bytes
pea #200 pea #200 ; height in lines
_GTESetScreenMode _GTESetScreenMode
; Load a tileset ; Load a tileset

View File

@ -20,6 +20,7 @@ SHR_SCREEN equ $E12000
SHR_SCB equ $E19D00 SHR_SCB equ $E19D00
SHR_PALETTES equ $E19E00 SHR_PALETTES equ $E19E00
SHR_LINE_WIDTH equ 160 SHR_LINE_WIDTH equ 160
SHR_SCREEN_HEIGHT equ 200
; Direct page locations used by the engine ; Direct page locations used by the engine
ScreenHeight equ 0 ; Height of the playfield in scan lines ScreenHeight equ 0 ; Height of the playfield in scan lines

View File

@ -40,7 +40,7 @@ InitGraphics
; 9. Agony (Amiga) : 36 x 24 288 x 192 (27,648 bytes ( 86.4%)) ; 9. Agony (Amiga) : 36 x 24 288 x 192 (27,648 bytes ( 86.4%))
; 10. Atari Lynx : 20 x 13 160 x 102 (8,160 bytes ( 25.5%)) ; 10. Atari Lynx : 20 x 13 160 x 102 (8,160 bytes ( 25.5%))
; ;
; X = mode number OR width in pixels (must be multiple of 2) ; X = mode number OR width in bytes
; Y = height in pixels (if X > 8) ; Y = height in pixels (if X > 8)
_SetScreenMode _SetScreenMode
cpx #11 cpx #11
@ -54,25 +54,23 @@ _SetScreenMode
lda ScreenModeWidth,x lda ScreenModeWidth,x
tax tax
:direct cpy #201 :direct cpy #SHR_SCREEN_HEIGHT+1
bcs :exit bcs :exit
cpx #321 cpx #SHR_LINE_WIDTH+1
bcs :exit bcs :exit
txa phx ; Save X (width) and Y (height)
lsr
pha ; Save X (width / 2) and Y (height)
phy phy
lda #160 ; Center the screen lda #SHR_LINE_WIDTH ; Center the screen
sec sec
sbc 3,s sbc 3,s
lsr lsr
xba xba
pha ; Save half the origin coordinate pha ; Save half the origin coordinate
lda #200 lda #SHR_SCREEN_HEIGHT
sec sec
sbc 3,s ; This is now Y because of the PHA above sbc 3,s ; This is now Y because of the PHA above
lsr lsr

View File

@ -412,7 +412,7 @@ DefaultPalette ENT
; 9. Agony (Amiga) : 36 x 24 288 x 192 (27,648 bytes ( 86.4%)) ; 9. Agony (Amiga) : 36 x 24 288 x 192 (27,648 bytes ( 86.4%))
; 10. Atari Lynx : 20 x 13 160 x 102 (8,160 bytes ( 25.5%)) ; 10. Atari Lynx : 20 x 13 160 x 102 (8,160 bytes ( 25.5%))
ScreenModeWidth ENT ScreenModeWidth ENT
dw 320,272,256,256,280,256,240,288,160,288,160,320 dw 160,136,128,128,140,128,120,144,80,144,80,160
ScreenModeHeight ENT ScreenModeHeight ENT
dw 200,192,200,176,160,160,160,128,144,192,102,1 dw 200,192,200,176,160,160,160,128,144,192,102,1