diff --git a/src/include/globals.asm b/src/include/globals.asm index a2d61d0..56276a3 100644 --- a/src/include/globals.asm +++ b/src/include/globals.asm @@ -17,8 +17,9 @@ INCLUDE "structs.asm" ; We don't wait for 2 because it's super short and impractical to do much of anything in. MACRO wait_vram ld hl, rSTAT -: bit 1, [hl] - jr nz, :- +.wvr\@ + bit 1, [hl] + jr nz, .wvr\@ ENDM @@ -26,17 +27,21 @@ ENDM ; We do this by checking for scanline 144. MACRO wait_vblank ld b, 144 -: ldh a, [rLY] +.wvb\@ + ldh a, [rLY] cp a, b - jr nz, :- + jr nz, .wvb\@ ENDM ; Waits for PPU mode to be at the end of mode 1. ; We do this by checking for scanline 0. MACRO wait_vblank_end -: ldh a, [rLY] - jr nz, :- + ld b, 0 +.wvbe\@ + ldh a, [rLY] + cp a, b + jr nz, .wvbe\@ ENDM diff --git a/src/main.asm b/src/main.asm index 8ed2598..0b3740d 100644 --- a/src/main.asm +++ b/src/main.asm @@ -64,7 +64,9 @@ EventLoop:: call HandleTimers ; Call the current state's event handler. + ld b, 0 ldh a, [hGameState] + cp a, b jp nz, GamePlayEventLoopHandler EventLoopPostHandler:: diff --git a/src/rng.asm b/src/rng.asm index b59db9f..adf1b6b 100644 --- a/src/rng.asm +++ b/src/rng.asm @@ -12,7 +12,7 @@ wNextPiece:: ds 1 section "RNG Functions", ROM0 -StartNewGame:: +RNGInit:: ; Do some bit fuckery on the seed using the gameboy's free-running timers. ld hl, wRNGSeed ldh a, [rDIV] diff --git a/src/sprites.asm b/src/sprites.asm index 4f2c9b9..cef34e8 100644 --- a/src/sprites.asm +++ b/src/sprites.asm @@ -49,7 +49,9 @@ OAMDMA:: jr nz, :- ; Jump to the current state's vblank handler. + ld b, 0 ldh a, [hGameState] + cp a, b jp nz, BlitField jp EventLoop ENDL diff --git a/tools/Emulicious.ini b/tools/Emulicious.ini index 57b6acc..2af30c6 100644 --- a/tools/Emulicious.ini +++ b/tools/Emulicious.ini @@ -1,7 +1,7 @@ #Emulicious settings file -#Tue Oct 17 13:52:17 CEST 2023 -WindowEventViewerWindowHeight=861 -WindowEventViewerWindowDivider=309 +#Wed Oct 18 04:45:41 CEST 2023 +WindowEventViewerWindowHeight=1416 +WindowEventViewerWindowDivider=876 WindowMemoryTracerWindowY=631 WindowMemoryTracerWindowX=383 Update=2 @@ -16,7 +16,7 @@ GBGamepadThreshold=50 GameBoyErrorBreakpointEnabled20=false StretchToWindow=false WindowTileViewerOpen=false -DebuggerWestPanelSelectedTab=0 +DebuggerWestPanelSelectedTab=1 WindowMemoryTracerWindowWidth=243 WindowPaletteViewerOpen=false Key37=-1 @@ -126,9 +126,9 @@ Key1=75 Key0=74 Gamepad1Key19=-1 Gamepad1Key18=-1 -WindowEventViewerWindowY=293 +WindowEventViewerWindowY=24 Gamepad1Key17=-1 -WindowEventViewerWindowX=1480 +WindowEventViewerWindowX=0 Gamepad1Key16=-1 Gamepad1Key15=-1 Gamepad1Key14=-1 @@ -199,8 +199,8 @@ GameBoyErrorBreakpointMessage32= InterruptBreakpointCondition= Recent0=C\:\\workspace\\dmgtris\\bin\\out.gb GameBoyErrorBreakpointMessage20= -WindowEmuliciousY=513 -WindowEmuliciousX=97 +WindowEmuliciousY=322 +WindowEmuliciousX=900 GameBoyErrorBreakpointEnabled9=false GameBoyErrorBreakpointEnabled8=false GameBoyErrorBreakpointEnabled7=false @@ -264,14 +264,14 @@ Gamepad0Key3=-1 Gamepad0Key2=-1 Gamepad0Key1=-1 Gamepad0Key0=-1 -WindowDebuggerY=369 -WindowDebuggerX=830 +WindowDebuggerY=388 +WindowDebuggerX=417 InterruptBreakpointSuspend=true SMSGamepadAKeyboard=false GameBoyErrorBreakpointSuspend32=true SMSGamepadB=-1 SMSGamepadA=-1 -WindowEventViewerWindowWidth=930 +WindowEventViewerWindowWidth=2576 BankSwapAtPCBreakpointCondition= GameBoyErrorBreakpointSuspend20=true SouthPanelHeight=635