Add toggle.

This commit is contained in:
Randy Thiemann 2023-10-21 14:33:18 +02:00
parent 33e1bf3520
commit fa73dc3a2b
6 changed files with 90 additions and 14 deletions

View File

@ -40,14 +40,20 @@ CHARMAP "Y", 100
CHARMAP "Z", 101 CHARMAP "Z", 101
CHARMAP "!", 102 CHARMAP "!", 102
CHARMAP "?", 103 CHARMAP "?", 103
CHARMAP "[", 129
CHARMAP "]", 130
CHARMAP "/", 128
CHARMAP "-", 127
CHARMAP "|", 126
CHARMAP "#", 125
SECTION "Static Data", ROM0 SECTION "Static Data", ROM0
sLeady:: db " READY? " sLeady:: db " READY? "
sGo:: db " GO " sGo:: db " GO "
sGameOver:: db "GAME OVER!" sGameOver:: db "GAME OVER!"
sGameOver2:: db " RETRY A " sGameOver2:: db " RETRY[A] "
sGameOver3:: db " QUIT B " sGameOver3:: db " QUIT [B] "
sPieceXOffsets:: ; How to draw each piece. X-offsets of the sprites. sPieceXOffsets:: ; How to draw each piece. X-offsets of the sprites.
db 0, 8, 16, 24 ; I db 0, 8, 16, 24 ; I
db 0, 8, 8, 16 ; Z db 0, 8, 8, 16 ; Z

View File

@ -91,12 +91,16 @@ DEF PALETTE_LIGHTER_0 EQU %11100100
DEF PALETTE_LIGHTER_1 EQU %10010000 DEF PALETTE_LIGHTER_1 EQU %10010000
DEF PALETTE_LIGHTER_2 EQU %01000000 DEF PALETTE_LIGHTER_2 EQU %01000000
DEF PALETTE_LIGHTER_3 EQU %00000000 DEF PALETTE_LIGHTER_3 EQU %00000000
DEF TITLE_A EQU $99ED
DEF TITLE_B EQU $99EF
DEF FIELD_TOP_LEFT EQU $9800+1 DEF FIELD_TOP_LEFT EQU $9800+1
DEF TILE_FIELD_EMPTY EQU 4 DEF TILE_FIELD_EMPTY EQU 4
DEF TILE_PIECE_0 EQU 10 DEF TILE_PIECE_0 EQU 10
DEF TILE_0 EQU 66 DEF TILE_0 EQU 66
DEF TILE_CLEARING EQU 124 DEF TILE_CLEARING EQU 124
DEF TILE_GHOST EQU 125 DEF TILE_GHOST EQU 125
DEF TILE_A EQU 76
DEF TILE_B EQU 77
DEF NEXT_BASE_X EQU 120 DEF NEXT_BASE_X EQU 120
DEF NEXT_BASE_Y EQU 40 DEF NEXT_BASE_Y EQU 40
DEF HOLD_BASE_X EQU 120 DEF HOLD_BASE_X EQU 120

View File

@ -53,7 +53,7 @@ OAMDMA::
ldh a, [hGameState] ldh a, [hGameState]
cp a, b cp a, b
jp nz, BlitField jp nz, BlitField
jp EventLoop jp TitleVBlankHandler
ENDL ENDL
OAMDMAEnd:: OAMDMAEnd::

View File

@ -191,7 +191,7 @@ fetchPieceMode:
.cp1 .cp1
cp a, 0 cp a, 0
jr z, .checkIRSB jr z, .checkIRSB
ld a, 1 ld a, 3
ldh [hCurrentPieceRotationState], a ldh [hCurrentPieceRotationState], a
ld a, SFX_IRS ld a, SFX_IRS
call SFXEnqueue call SFXEnqueue
@ -202,13 +202,13 @@ fetchPieceMode:
jr z, .ldb2 jr z, .ldb2
.lda2 .lda2
ld a, [hAState] ld a, [hAState]
jr .cp1 jr .cp2
.ldb2 .ldb2
ld a, [hBState] ld a, [hBState]
.cp2 .cp2
cp a, 0 cp a, 0
jr z, .checkJingle jr z, .checkJingle
ld a, 3 ld a, 1
ldh [hCurrentPieceRotationState], a ldh [hCurrentPieceRotationState], a
ld a, SFX_IRS ld a, SFX_IRS
call SFXEnqueue call SFXEnqueue
@ -359,19 +359,35 @@ DoHold:
; Check if IRS is requested. ; Check if IRS is requested.
; Apply the rotation if so. ; Apply the rotation if so.
.checkIRSHA .checkIRSHA
ld a, [hSwapAB]
cp a, 0
jr z, .lda3
.ldb3
ld a, [hBState]
jr .cp3
.lda3
ld a, [hAState] ld a, [hAState]
.cp3
cp a, 0 cp a, 0
jr z, .checkIRSHB jr z, .checkIRSHB
ld a, 1 ld a, 3
ldh [hCurrentPieceRotationState], a ldh [hCurrentPieceRotationState], a
ld a, SFX_IRS ld a, SFX_IRS
call SFXEnqueue call SFXEnqueue
.checkIRSHB .checkIRSHB
ld a, [hSwapAB]
cp a, 0
jr z, .ldb4
.lda4
ld a, [hAState]
jr .cp4
.ldb4
ld a, [hBState] ld a, [hBState]
.cp4
cp a, 0 cp a, 0
jr z, .noRotation jr z, .noRotation
ld a, 3 ld a, 1
ldh [hCurrentPieceRotationState], a ldh [hCurrentPieceRotationState], a
ld a, SFX_IRS ld a, SFX_IRS
call SFXEnqueue call SFXEnqueue

View File

@ -46,6 +46,7 @@ SwitchToTitle::
TitleEventLoopHandler:: TitleEventLoopHandler::
; Start game?
ldh a, [hStartState] ldh a, [hStartState]
ld b, a ld b, a
ldh a, [hAState] ldh a, [hAState]
@ -54,9 +55,58 @@ TitleEventLoopHandler::
or a, b or a, b
or a, c or a, c
cp a, 1 cp a, 1
jp nz, EventLoopPostHandler jr nz, :+
call SwitchToGameplay call SwitchToGameplay
jp EventLoopPostHandler jp EventLoopPostHandler
; Toggle A/B?
: ldh a, [hLeftState]
ld b, a
ldh a, [hRightState]
or a, b
cp a, 1
jr nz, :+
ldh a, [hSwapAB]
cpl
ldh [hSwapAB], a
jp EventLoopPostHandler
; Start level up?
: ldh a, [hUpState]
cp a, 1
jr nz, :+
; TODO
jp EventLoopPostHandler
; Start level down?
: ldh a, [hDownState]
cp a, 1
jr nz, :+
; TODO
: jp EventLoopPostHandler
TitleVBlankHandler::
ldh a, [hSwapAB]
cp a, 0
jr nz, :+
ld hl, TITLE_A
ld a, TILE_A
ld [hl+], a
inc hl
inc a
ld [hl], a
wait_vblank_end
jp EventLoop
: ld hl, TITLE_A
ld a, TILE_B
ld [hl+], a
inc hl
dec a
ld [hl], a
wait_vblank_end
jp EventLoop
ENDC ENDC

View File

@ -1,5 +1,5 @@
#Emulicious settings file #Emulicious settings file
#Sat Oct 21 14:06:55 CEST 2023 #Sat Oct 21 14:31:03 CEST 2023
WindowProfilerWindowOpen=false WindowProfilerWindowOpen=false
WindowEventViewerWindowHeight=1416 WindowEventViewerWindowHeight=1416
WindowEventViewerWindowDivider=876 WindowEventViewerWindowDivider=876
@ -7,7 +7,7 @@ WindowMemoryTracerWindowY=631
WindowMemoryTracerWindowX=383 WindowMemoryTracerWindowX=383
Update=2 Update=2
AudioSync=false AudioSync=false
DebuggerMemoryTabVisibleRect=0,0,687,128 DebuggerMemoryTabVisibleRect=0,0,0,0
WindowProfilerWindowWidth=1073 WindowProfilerWindowWidth=1073
UninitializedMemoryBreakpointSuspend=true UninitializedMemoryBreakpointSuspend=true
GameBoyErrorBreakpointEnabled32=false GameBoyErrorBreakpointEnabled32=false
@ -92,7 +92,7 @@ GameBoyErrorBreakpointSuspend2=true
GameBoyErrorBreakpointSuspend1=true GameBoyErrorBreakpointSuspend1=true
GameBoyErrorBreakpointSuspend0=true GameBoyErrorBreakpointSuspend0=true
DebuggerConsoleLogBreakpoints=true DebuggerConsoleLogBreakpoints=true
WindowDebuggerOpen=true WindowDebuggerOpen=false
Gamepad1Key37=-1 Gamepad1Key37=-1
Gamepad1Key36=-1 Gamepad1Key36=-1
Gamepad1Key35=-1 Gamepad1Key35=-1
@ -271,8 +271,8 @@ Gamepad0Key3=-1
Gamepad0Key2=-1 Gamepad0Key2=-1
Gamepad0Key1=-1 Gamepad0Key1=-1
Gamepad0Key0=-1 Gamepad0Key0=-1
WindowDebuggerY=-8 WindowDebuggerY=544
WindowDebuggerX=-8 WindowDebuggerX=210
InterruptBreakpointSuspend=true InterruptBreakpointSuspend=true
SMSGamepadAKeyboard=false SMSGamepadAKeyboard=false
GameBoyErrorBreakpointSuspend32=true GameBoyErrorBreakpointSuspend32=true