From 80a075e1374fbc5fc8cb7cefb7d5a4abfe3a91e0 Mon Sep 17 00:00:00 2001 From: Randy Thiemann Date: Wed, 18 Oct 2023 05:26:06 +0200 Subject: [PATCH] vblank performance --- designnotes.md | 19 ------------------- src/field.asm | 36 +++++++++++++++++++++--------------- tools/Emulicious.ini | 18 +++++++++--------- 3 files changed, 30 insertions(+), 43 deletions(-) delete mode 100644 designnotes.md diff --git a/designnotes.md b/designnotes.md deleted file mode 100644 index 7f2c1a1..0000000 --- a/designnotes.md +++ /dev/null @@ -1,19 +0,0 @@ -# Tile layout -Note: All tiles are 8x7 so that the entire tetrion fits on the screen. -Tile 0, 1 are all black and all white for lockflash and such. -Tiles 2, 3, 4, 5, 6 are the edges of the tetrion. -Tile 7 is the background of the tetrion. -Tile 8 is a horizontal line for the level state -Tile 9 is a pointer -Tiles 10, 11, 12, 13, 14, 15, 16 are IZSJLOT in their falling state. -Tiles 17, 18, 19, 20, 21, 22, 23 are IZSJLOT in their locked state. -Tiles 24, 25, 26, 27, 28, 29, 30 are IZSJLOT in their locking state 1. -Tiles 31, 32, 33, 34, 35, 36, 37 are IZSJLOT in their locking state 2. -Tiles 38, 39, 40, 41, 42, 43, 44 are IZSJLOT in their locking state 3. -Tiles 45, 46, 47, 48, 49, 50, 51 are IZSJLOT in their locking state 4. -Tiles 52, 53, 54, 55, 56, 57, 58 are IZSJLOT in their locking state 5. -Tiles 59, 60, 61, 62, 63, 64, 65 are IZSJLOT in their locking state 6. -Tiles 66-73 are for section drawing -Tiles 74-109 are the font, dark. -Tiles 110-119 are the numbers, light. -Tiles 120-127 ----------------------------------------------- diff --git a/src/field.asm b/src/field.asm index 20945b4..c41f2d4 100644 --- a/src/field.asm +++ b/src/field.asm @@ -32,7 +32,7 @@ BlitField:: ; Where to put it ld hl, FIELD_TOP_LEFT ; How much to increment hl after each row - ld bc, 32 + ld bc, 32-10 ; The first 14 rows can be blitted without checking for vram access. REPT 14 @@ -44,23 +44,29 @@ BlitField:: add hl, bc ENDR +: ldh a, [rLY] + cp a, 0 + jr nz, :- + ; The last 6 rows need some care. REPT 6 - REPT 2 -: ldh a, [rSTAT] - and STATF_LCD - cp STATF_HBL - jr z, :- -: ldh a, [rSTAT] - and STATF_LCD - cp STATF_HBL - jr nz, :- - REPT 5 - ld a, [de] - ld [hl+], a - inc de - ENDR + ; Wait until start of drawing, then insert 35 nops. +: ldh a, [rSTAT] + and a, 3 + cp a, 3 + jr nz, :- + REPT 35 + nop ENDR + + ; Blit a line. + REPT 10 + ld a, [de] + ld [hl+], a + inc de + ENDR + + ; Increment HL so that the next line can be blitted. add hl, bc ENDR diff --git a/tools/Emulicious.ini b/tools/Emulicious.ini index 2af30c6..3681f19 100644 --- a/tools/Emulicious.ini +++ b/tools/Emulicious.ini @@ -1,5 +1,5 @@ #Emulicious settings file -#Wed Oct 18 04:45:41 CEST 2023 +#Wed Oct 18 05:24:23 CEST 2023 WindowEventViewerWindowHeight=1416 WindowEventViewerWindowDivider=876 WindowMemoryTracerWindowY=631 @@ -16,7 +16,7 @@ GBGamepadThreshold=50 GameBoyErrorBreakpointEnabled20=false StretchToWindow=false WindowTileViewerOpen=false -DebuggerWestPanelSelectedTab=1 +DebuggerWestPanelSelectedTab=0 WindowMemoryTracerWindowWidth=243 WindowPaletteViewerOpen=false Key37=-1 @@ -98,7 +98,7 @@ Gamepad1Key31=-1 Gamepad1Key30=-1 BankSwapAtPCBreakpointEnabled=false DebuggerMemorySelectedTab=HRAM -WindowVideoViewerOpen=false +WindowVideoViewerOpen=true WindowMemoryEditorTabVisibleRect=0,0,583,128 Gamepad1Key29=-1 Gamepad1Key28=-1 @@ -160,8 +160,8 @@ Gamepad0Key31=-1 Gamepad0Key30=-1 SMSGamepadAThreshold=50 WindowPaletteViewerHeight=313 -WindowVideoViewerY=275 -WindowVideoViewerX=946 +WindowVideoViewerY=674 +WindowVideoViewerX=2606 UninitializedMemoryBreakpointEnabled=false Gamepad0Key29=-1 Gamepad0Key28=-1 @@ -199,8 +199,8 @@ GameBoyErrorBreakpointMessage32= InterruptBreakpointCondition= Recent0=C\:\\workspace\\dmgtris\\bin\\out.gb GameBoyErrorBreakpointMessage20= -WindowEmuliciousY=322 -WindowEmuliciousX=900 +WindowEmuliciousY=443 +WindowEmuliciousX=1109 GameBoyErrorBreakpointEnabled9=false GameBoyErrorBreakpointEnabled8=false GameBoyErrorBreakpointEnabled7=false @@ -264,8 +264,8 @@ Gamepad0Key3=-1 Gamepad0Key2=-1 Gamepad0Key1=-1 Gamepad0Key0=-1 -WindowDebuggerY=388 -WindowDebuggerX=417 +WindowDebuggerY=350 +WindowDebuggerX=935 InterruptBreakpointSuspend=true SMSGamepadAKeyboard=false GameBoyErrorBreakpointSuspend32=true