minor fixes to main menu mostly

This commit is contained in:
Shoofle 2025-10-04 14:45:17 -04:00
parent d6c623734f
commit 337919ac07
3 changed files with 34 additions and 51 deletions

View File

@ -14,7 +14,6 @@ vBuildingByte: dw
vPrinterIsReady: db vPrinterIsReady: db
vPrinterRow: db vPrinterRow: db
print vPrinterRow
vPrinterStart: db vPrinterStart: db
POPS POPS

View File

@ -27,18 +27,19 @@ ScreenMainMenu:
dw MainMenuTeardown dw MainMenuTeardown
MainMenuSetup: MainMenuSetup:
call Async_Kill
ld a, BANK("Main Menu Data")
ld [rROMB0], a
ld hl, ZEROES ld hl, ZEROES
ld de, MY_OAM ld de, MY_OAM
ld bc, $100 ld bc, $100
call CopyRange call CopyRange
ld a, BANK("Main Menu Data")
ld [rROMB0], a
ld hl, MainMenuSetup.asyncTask
call Async_Spawn_HL
ld a, 0 ld a, 0
ld [vFrameCount1], a ; first starts at 0 ld [vFrameCount1], a ; first card starts at 0
ld [vTime], a ld [vTime], a
ld [vTime+1], a ld [vTime+1], a
ld [vMenuIndex], a ld [vMenuIndex], a
@ -46,7 +47,6 @@ MainMenuSetup:
ld [vSelectedSpreadCard], a ld [vSelectedSpreadCard], a
; second starts at 1/3 length which is approximately L/2 - L/4 - L/8 + L/16 ? ; second starts at 1/3 length which is approximately L/2 - L/4 - L/8 + L/16 ?
ld hl, Coords ld hl, Coords
ld a, [hl] ld a, [hl]
@ -89,27 +89,21 @@ MainMenuSetup:
; that should be just about 2/3 of L ! ; that should be just about 2/3 of L !
ld [vFrameCount3], a ld [vFrameCount3], a
;ld hl, Coords
;ld a, [hl]
;srl a
;ldh [vFrameCount4], a
ld a, 0 ld a, 0
ld [vFrameCountSquares], a ld [vFrameCountSquares], a
ld hl, MainMenuSetup.asyncTask
call Async_Spawn_HL
ld a, %11100100 ld a, %11100100
ldh [rBGP], a ldh [rBGP], a
ldh [rOBP0], a ldh [rOBP0], a
ldh a, [rLCDC] ld a, LCDCF_BLK21 | LCDCF_ON | LCDCF_BGON | LCDCF_OBJON | LCDCF_OBJ16
or a, LCDCF_OBJ16 ;LCDCF_BLK21 | LCDCF_ON | LCDCF_BGON | LCDCF_OBJON | LCDCF_OBJ16
ldh [rLCDC], a ldh [rLCDC], a
ret ret
.asyncTask: .asyncTask:
ld hl, MainUITilemap ld hl, MainUITilemap
ld de, _SCRN0 ld de, _SCRN0
ld b, 18 ld b, 18
@ -187,12 +181,6 @@ MainMenuSetup:
MainMenuUpdate: MainMenuUpdate:
; if pressing a key and unblocked:
; signal an animation to start
; turn on block
; if in animation state:
; increment timer
; if timer is max, turn off animation state and unblock?
ld a, BANK("Main Menu Data") ld a, BANK("Main Menu Data")
ld [rROMB0], a ld [rROMB0], a
@ -287,7 +275,7 @@ MainMenuUpdate:
call ArrayClampLooping call ArrayClampLooping
ld [vFrameCountSquares], a ld [vFrameCountSquares], a
sla a ; mulltiiply by 2 sla a ; mulltiiply squares frame count by 2
ld b, 0 ld b, 0
ld c, a ld c, a
ld hl, SquaresTiles + 1 ld hl, SquaresTiles + 1

View File

@ -90,9 +90,16 @@ SECTION "Header", ROM0[$100]
SECTION "Main Program", ROM0[$150] SECTION "Main Program", ROM0[$150]
EntryPoint: EntryPoint:
cp a, BOOTUP_A_CGB cp a, BOOTUP_A_CGB
call nz, SetupForDMG jp z, .SetupForCGB
call z, SetupForCGB .SetupForDMG:
; Shut down audio circuitry ld a, $0
ld [rDeviceType], a
jp .doneWithSetup
.SetupForCGB:
ld a, $1
ld [rDeviceType], a
.doneWithSetup:
; Shut things down
ld a, 0 ld a, 0
ldh [rNR52], a ; shut down audio ldh [rNR52], a ; shut down audio
ldh [rDIV], a ; reset timer just in case?? ldh [rDIV], a ; reset timer just in case??
@ -159,7 +166,6 @@ EntryPoint:
dec a ; decrement our length counter dec a ; decrement our length counter
jr nz, .writeFlip jr nz, .writeFlip
ld a, %1010_1010 ld a, %1010_1010
ld [rLFSR], a ld [rLFSR], a
@ -296,18 +302,19 @@ Loop:
xor a, a ; zero a out in one cycle xor a, a ; zero a out in one cycle
; store dpad and btn state in the rMYBTN register ; store dpad and btn state in the rMYBTN register
ld hl, rP1 ld a, P1F_GET_DPAD
ld [hl], P1F_GET_DPAD ldh [rP1], a
ld a, [hl] ldh a, [rP1]
ld a, [hl] ldh a, [rP1]
ld a, [hl] ldh a, [rP1]
cpl cpl
and a, %00001111 and a, %00001111
ld b, a ld b, a
ld [hl], P1F_GET_BTN ld a, P1F_GET_BTN
ld a, [hl] ldh [rP1], a
ld a, [hl] ldh a, [rP1]
ld a, [hl] ldh a, [rP1]
ldh a, [rP1]
cpl cpl
and a, %00001111 and a, %00001111
swap a swap a
@ -321,7 +328,6 @@ Loop:
ld [rMYBTN], a ; save that as btn state ld [rMYBTN], a ; save that as btn state
call SoundUpdate call SoundUpdate
println "scene update is ", SCENE_UPDATE - 1
call SCENE_UPDATE - 1 ; hope this takes not too many scanlines! call SCENE_UPDATE - 1 ; hope this takes not too many scanlines!
di di
@ -330,27 +336,16 @@ println "scene update is ", SCENE_UPDATE - 1
ei ei
halt halt
println "scene draw is ", SCENE_DRAW - 1
call SCENE_DRAW - 1 ; hope this takes fewer than 9 scanlines! call SCENE_DRAW - 1 ; hope this takes fewer than 9 scanlines!
; either way it's going to eat into the update timing ; either way it's going to eat into the update timing
; at this point we want to make sure that scanline 153 has passed ; at this point we want to make sure that scanline 153 has passed
; we should check if we're past there and skip this await if necessary ; we should check if we're past there and skip this await if necessary
ld b, 2 ld b, 3
call AwaitLine call AwaitLine
jp Loop jp Loop
SetupForDMG:
ld a, $0
ld hl, rDeviceType
ld [hl], a
ret
SetupForCGB:
ld a, $1
ld hl, rDeviceType
ld [hl], a
ret
@ -375,6 +370,7 @@ ChangeScene: ; hl should be a pointer to, in sequence, setup update draw teardow
ld a, [hl+] ld a, [hl+]
ld [SCENE_TEARDOWN+1], a ld [SCENE_TEARDOWN+1], a
call Async_Kill
call SCENE_SETUP - 1 call SCENE_SETUP - 1
ei ei