All buttons should use that kind of code.

This commit is contained in:
Randy Thiemann 2023-10-13 11:30:55 +02:00
parent c2239e3290
commit 7efef9a042
2 changed files with 282 additions and 256 deletions

View File

@ -43,7 +43,10 @@ GetInput::
bit 0, b ; A bit 0, b ; A
jr nz, .clearA jr nz, .clearA
.setA .setA
ld a, 1 ldh a, [hAState]
cp $FF
jr z, .readB
inc a
ldh [hAState], a ldh [hAState], a
jr .readB jr .readB
.clearA .clearA
@ -54,7 +57,10 @@ GetInput::
bit 1, b ; B bit 1, b ; B
jr nz, .clearB jr nz, .clearB
.setB .setB
ld a, 1 ldh a, [hBState]
cp $FF
jr z, .readSelect
inc a
ldh [hBState], a ldh [hBState], a
jr .readSelect jr .readSelect
.clearB .clearB
@ -65,7 +71,10 @@ GetInput::
bit 2, b ; Select bit 2, b ; Select
jr nz, .clearSelect jr nz, .clearSelect
.setSelect .setSelect
ld a, 1 ldh a, [hSelectState]
cp $FF
jr z, .readStart
inc a
ldh [hSelectState], a ldh [hSelectState], a
jr .readStart jr .readStart
.clearSelect .clearSelect
@ -76,7 +85,10 @@ GetInput::
bit 3, b ; Start bit 3, b ; Start
jr nz, .clearStart jr nz, .clearStart
.setStart .setStart
ld a, 1 ldh a, [hStartState]
cp $FF
jr z, .dpad
inc a
ldh [hStartState], a ldh [hStartState], a
jr .dpad jr .dpad
.clearStart .clearStart
@ -98,7 +110,10 @@ GetInput::
bit 2, b ; Up bit 2, b ; Up
jr nz, .clearUp jr nz, .clearUp
.setUp .setUp
ld a, 1 ldh a, [hUpState]
cp $FF
jr z, .readDown
inc a
ldh [hUpState], a ldh [hUpState], a
jr .readDown jr .readDown
.clearUp .clearUp
@ -109,7 +124,10 @@ GetInput::
bit 3, b ; Down bit 3, b ; Down
jr nz, .clearDown jr nz, .clearDown
.setDown .setDown
ld a, 1 ldh a, [hDownState]
cp $FF
jr z, .readLeft
inc a
ldh [hDownState], a ldh [hDownState], a
jr .readLeft jr .readLeft
.clearDown .clearDown

View File

@ -1,255 +1,121 @@
#Emulicious settings file #Emulicious settings file
#Fri Oct 13 11:18:40 CEST 2023 #Fri Oct 13 11:30:41 CEST 2023
SouthPanelHeight=635
GameBoyErrorBreakpointMessage6=
GameBoyErrorBreakpointMessage5=
InterruptBreakpointEnabled=false
GameBoyErrorBreakpointMessage4=
GameBoyErrorBreakpointEnabled19=false
GameBoyErrorBreakpointMessage3=
DebuggerHideCpuUsageGraph=false
RomDir=C\:\\workspace\\dmgtris\\bin
GameBoyErrorBreakpointEnabled18=false
GameBoyErrorBreakpointMessage2=
GameBoyErrorBreakpointEnabled17=false
GameBoyErrorBreakpointMessage1=
GameBoyErrorBreakpointEnabled16=false
Key19=72
GameBoyErrorBreakpointMessage0=
Key18=71
Key17=76
WindowMemoryTracerWindowY=631
WindowPaletteViewerY=619
Key16=74
WindowMemoryTracerWindowX=383
WindowPaletteViewerX=262
GameBoyErrorBreakpointEnabled9=false
DebuggerEventFiltersGameBoy=
Key15=75
GameBoyErrorBreakpointEnabled8=false
Key14=73
GameBoyErrorBreakpointEnabled7=false
GameBoyErrorBreakpointEnabled10=true
Gamepad0Key9=-1
Key13=83
GameBoyErrorBreakpointEnabled6=false
WindowEventViewerWindowHeight=861 WindowEventViewerWindowHeight=861
Gamepad0Key8=-1 WindowEventViewerWindowDivider=309
Key12=65 WindowMemoryTracerWindowY=631
GameBoyErrorBreakpointEnabled5=false WindowMemoryTracerWindowX=383
Gamepad0Key7=-1 Update=2
Key11=39
GameBoyErrorBreakpointEnabled4=false
Gamepad0Key6=-1
Key10=37
GameBoyErrorBreakpointEnabled3=false
Gamepad0Key5=-1
GameBoyErrorBreakpointEnabled2=false
Gamepad0Key4=-1
WindowVideoViewerOpen=false
GameBoyErrorBreakpointEnabled1=false
Gamepad0Key3=-1
GameBoyErrorBreakpointEnabled0=false
Gamepad0Key2=-1
Gamepad0Key1=-1
AudioSync=false AudioSync=false
Gamepad0Key0=-1 DebuggerMemoryTabVisibleRect=0,0,0,0
UninitializedMemoryBreakpointSuspend=true
GameBoyErrorBreakpointEnabled32=false
SMSGamepadBThreshold=50
RegistersGameBoy=AF,BC,DE,HL,SP,PC,LCDC,STAT,LY,DIV,IE,IF
SMSbuttonsThreshold=50
GBGamepadThreshold=50
GameBoyErrorBreakpointEnabled20=false
StretchToWindow=false
WindowTileViewerOpen=false
DebuggerWestPanelSelectedTab=0
WindowMemoryTracerWindowWidth=243
WindowPaletteViewerOpen=false
Key37=-1
Key36=-1
GameBoyErrorBreakpointEnabled19=false
Key35=-1
GameBoyErrorBreakpointEnabled18=false
Key34=-1
GameBoyErrorBreakpointEnabled17=false
Key33=-1
GameBoyErrorBreakpointEnabled16=false
Key32=-1
WindowDebuggerHeight=987
Key31=-1
Key30=-1
WindowMemoryTracerWindowHeight=289
WindowTilemapViewerOpen=false WindowTilemapViewerOpen=false
GameBoyErrorBreakpointEnabled10=true
WindowTileViewerY=549
WindowTileViewerX=271
GBGamepad=-1
Key29=-1
Key28=10
Key27=-1
WindowTilemapViewerHeight=744
Key26=-1
Key25=-1
Key24=-1
Key23=10
Key22=-1
Key21=-1
Key20=-1
MemoryTracer=true
Key19=72
Key18=71
DebuggerMemorySelectedAddress=4
SMSGamepadBKeyboard=false
Key17=76
Key16=74
Key15=75
Key14=73
Key13=83
DataExecutionBreakpointEnabled=false
Key12=65
Key11=39
Key10=37
WindowTileViewerHeight=453
EventViewerEventFiltersGameBoy=
WindowMemoryTracerWindowOpen=false
SMSInputDeviceB=1 SMSInputDeviceB=1
SMSInputDeviceA=1 SMSInputDeviceA=1
DataExecutionBreakpointEnabled=false InterruptBreakpointEnabled=false
GameBoyErrorBreakpointCondition32= OutlineWidth=425
WindowEventViewerWindowY=489 DebuggerEventFiltersGameBoy=
WindowEventViewerWindowX=1472
WindowSpriteViewerHeight=527
WindowSpriteViewerWidth=370
DebuggerWestPanelSelectedTab=0
WindowMemoryTracerWindowHeight=289
Gamepad0Key37=-1
Gamepad0Key36=-1
SMSbuttonsGamepad=-1
Gamepad0Key35=-1
GameBoyErrorBreakpointCondition20=
Gamepad0Key34=-1
Gamepad0Key33=-1
Gamepad0Key32=-1
Gamepad0Key31=-1
Gamepad0Key30=-1
DebuggerSouthPanelSelectedTab=0
StackWidth=1311
SMSGamepadAKeyboard=false
GameBoyErrorBreakpointCondition19=
GameBoyErrorBreakpointCondition18=
GameBoyErrorBreakpointCondition17=
GameBoyErrorBreakpointCondition16=
Gamepad0Key29=-1
Gamepad0Key28=-1
Gamepad0Key27=-1
Gamepad0Key26=-1
Gamepad0Key25=-1
GameBoyErrorBreakpointCondition10=
GBGamepadThreshold=50
InterruptBreakpointSuspend=true
Gamepad0Key24=-1
Gamepad0Key23=-1
Gamepad0Key22=-1
Gamepad0Key21=-1
Gamepad0Key20=-1
UninitializedMemoryBreakpointEnabled=false
RegistersGameBoy=AF,BC,DE,HL,SP,PC,LCDC,STAT,LY,DIV,IE,IF
WindowMemoryTracerWindowOpen=false
Gamepad0Key19=-1
WindowDebuggerHeight=987
Gamepad0Key18=-1
Gamepad0Key17=-1
WindowSpriteViewerY=512
Gamepad0Key16=-1
WindowSpriteViewerX=320
Gamepad0Key15=-1
Gamepad0Key14=-1
Gamepad0Key13=-1
Gamepad0Key12=-1
Gamepad0Key11=-1
KeyboardRequireWindowFocus=true
Gamepad0Key10=-1
DataExecutionBreakpointSuspend=true
SMSbuttonsKeyboard=false
GBGamepad=-1
WindowEventViewerWindowOpen=true
WindowPaletteViewerHeight=313
WindowMemoryTracerWindowWidth=243
WindowVideoViewerWidth=980
StretchToWindow=false
Gamepad1Key37=-1
Gamepad1Key36=-1
DebuggerHideToolbar=false
Gamepad1Key35=-1
Gamepad1Key34=-1
Gamepad1Key33=-1
Gamepad1Key32=-1
Gamepad1Key31=-1
Gamepad1Key30=-1
InterruptBreakpointCondition=
WindowPaletteViewerOpen=false
SMSGamepadAThreshold=50
Gamepad1Key29=-1
Gamepad1Key28=-1
WindowDebuggerOpen=false
Gamepad1Key27=-1
Gamepad1Key26=-1
SMSGamepadB=-1
Gamepad1Key25=-1
SMSGamepadA=-1
Gamepad1Key24=-1
EventViewerEventFiltersGameBoy=
Gamepad1Key23=-1
Gamepad1Key22=-1
Gamepad1Key21=-1
Gamepad1Key20=-1
StackSplitLocation=320
FontSize=13
CodeFontSize=13
WindowEmuliciousHeight=781
CombineVideoViewers=true
WindowTilemapViewerY=544
WindowTilemapViewerX=1013
UninitializedMemoryBreakpointSuspend=true
GBGamepadKeyboard=false
MemoryTracer=true
SMSGamepadBKeyboard=false
DebuggerConsoleLogBreakpoints=true
SMSGamepadBThreshold=50
Gamepad1Key19=-1
BankSwapAtPCBreakpointEnabled=false
Gamepad1Key18=-1
Gamepad1Key17=-1
Gamepad1Key16=-1
WindowPaletteViewerWidth=485
GameBoyErrorBreakpointSuspend32=true
Recent0=C\:\\workspace\\dmgtris\\bin\\out.gb
Gamepad1Key15=-1
Gamepad1Key14=-1
Gamepad1Key13=-1
Gamepad1Key12=-1
GameBoyErrorBreakpointSuspend9=true GameBoyErrorBreakpointSuspend9=true
Gamepad1Key11=-1 WindowMemoryEditorOpen=true
GameBoyErrorBreakpointSuspend8=true GameBoyErrorBreakpointSuspend8=true
Gamepad1Key10=-1
GameBoyErrorBreakpointSuspend7=true GameBoyErrorBreakpointSuspend7=true
WindowPaletteViewerY=619
GameBoyErrorBreakpointSuspend6=true GameBoyErrorBreakpointSuspend6=true
SMSbuttonsGamepad=-1
WindowPaletteViewerX=262
GameBoyErrorBreakpointSuspend5=true GameBoyErrorBreakpointSuspend5=true
GameBoyErrorBreakpointSuspend4=true GameBoyErrorBreakpointSuspend4=true
GameBoyErrorBreakpointSuspend3=true GameBoyErrorBreakpointSuspend3=true
GameBoyErrorBreakpointSuspend2=true GameBoyErrorBreakpointSuspend2=true
GameBoyErrorBreakpointSuspend1=true GameBoyErrorBreakpointSuspend1=true
GameBoyErrorBreakpointSuspend0=true GameBoyErrorBreakpointSuspend0=true
Scale=5.0 DebuggerConsoleLogBreakpoints=true
DebuggerMemorySelectedAddress=4 WindowDebuggerOpen=false
WindowEmuliciousWidth=816 Gamepad1Key37=-1
GameBoyErrorBreakpointSuspend20=true Gamepad1Key36=-1
DataExecutionBreakpointCondition= Gamepad1Key35=-1
WindowTilemapViewerWidth=404 Gamepad1Key34=-1
BankSwapAtPCBreakpointCondition= Gamepad1Key33=-1
GameBoyErrorBreakpointMessage32= Gamepad1Key32=-1
SMSbuttonsThreshold=50 CombineVideoViewers=true
WindowTileViewerY=549 Gamepad1Key31=-1
WindowTileViewerX=271 Gamepad1Key30=-1
Gamepad1Key9=-1 BankSwapAtPCBreakpointEnabled=false
UninitializedMemoryBreakpointCondition= DebuggerMemorySelectedTab=HRAM
Gamepad1Key8=-1 WindowVideoViewerOpen=false
GameBoyErrorBreakpointSuspend19=true WindowMemoryEditorTabVisibleRect=0,0,583,128
Gamepad1Key7=-1 Gamepad1Key29=-1
GameBoyErrorBreakpointSuspend18=true Gamepad1Key28=-1
Gamepad1Key6=-1 Gamepad1Key27=-1
GameBoyErrorBreakpointSuspend17=true Gamepad1Key26=-1
Gamepad1Key5=-1 Gamepad1Key25=-1
GameBoyErrorBreakpointSuspend16=true Gamepad1Key24=-1
Gamepad1Key4=-1 WindowTilemapViewerY=544
Gamepad1Key3=-1 Gamepad1Key23=-1
WindowVideoViewerY=275 WindowTilemapViewerX=1013
Gamepad1Key2=-1 Gamepad1Key22=-1
WindowVideoViewerX=946 Gamepad1Key21=-1
Gamepad1Key1=-1 Gamepad1Key20=-1
Gamepad1Key0=-1 WindowPaletteViewerWidth=485
GameBoyErrorBreakpointSuspend10=true
WindowEventViewerWindowDivider=309
WindowTilemapViewerHeight=744
GameBoyErrorBreakpointMessage20=
WindowTileViewerWidth=467
MemoryTracerDisplayFileOffsetsForROM=true
WindowDebuggerY=170
WindowDebuggerX=1172
Key37=-1
Key36=-1
WindowTileViewerOpen=false
GameBoyErrorBreakpointEnabled32=false
GameBoyErrorBreakpointCondition9=
Key35=-1
GameBoyErrorBreakpointCondition8=
Key34=-1
GameBoyErrorBreakpointCondition7=
GameBoyErrorBreakpointMessage19=
Key33=-1
DebuggerMemoryTabVisibleRect=0,0,0,0
GameBoyErrorBreakpointMessage18=
GameBoyErrorBreakpointCondition6=
Key32=-1
WindowEventViewerWindowWidth=930
OutlineWidth=425
GameBoyErrorBreakpointMessage17=
GameBoyErrorBreakpointCondition5=
Key31=-1
GameBoyErrorBreakpointMessage16=
GameBoyErrorBreakpointCondition4=
Key30=-1
GameBoyErrorBreakpointCondition3=
GameBoyErrorBreakpointCondition2=
Key9=40 Key9=40
GameBoyErrorBreakpointCondition1=
Key8=38 Key8=38
GameBoyErrorBreakpointCondition0=
Key7=83 Key7=83
GameBoyErrorBreakpointMessage10=
Key6=87 Key6=87
Key5=65 Key5=65
Key4=68 Key4=68
@ -257,26 +123,168 @@ Key3=10
Key2=192 Key2=192
Key1=75 Key1=75
Key0=74 Key0=74
WindowVideoViewerHeight=1027 Gamepad1Key19=-1
Update=2 Gamepad1Key18=-1
Key29=-1 WindowEventViewerWindowY=489
Key28=10 Gamepad1Key17=-1
Key27=-1 WindowEventViewerWindowX=1472
Key26=-1 Gamepad1Key16=-1
WindowSpriteViewerOpen=false Gamepad1Key15=-1
Key25=-1 Gamepad1Key14=-1
WindowTileViewerHeight=453 Gamepad1Key13=-1
Key24=-1 Gamepad1Key12=-1
GameBoyErrorBreakpointEnabled20=false Gamepad1Key11=-1
Key23=10 Gamepad1Key10=-1
Key22=-1 WindowMemoryEditorSelectedAddress=-1
Key21=-1 WindowMemoryEditorWidth=665
GameBoyErrorBreakpointCondition9=
GameBoyErrorBreakpointCondition8=
GameBoyErrorBreakpointCondition7=
GameBoyErrorBreakpointCondition6=
GameBoyErrorBreakpointCondition5=
GameBoyErrorBreakpointCondition4=
GameBoyErrorBreakpointCondition3=
GameBoyErrorBreakpointCondition2=
DebuggerHideCpuUsageGraph=false
GameBoyErrorBreakpointCondition1=
GameBoyErrorBreakpointCondition0=
Gamepad0Key37=-1
Gamepad0Key36=-1
Gamepad0Key35=-1
Gamepad0Key34=-1
Gamepad0Key33=-1
Gamepad0Key32=-1
WindowMemoryEditorSelectedTab=HRAM
Gamepad0Key31=-1
Gamepad0Key30=-1
SMSGamepadAThreshold=50
WindowPaletteViewerHeight=313
WindowVideoViewerY=275
WindowVideoViewerX=946
UninitializedMemoryBreakpointEnabled=false
Gamepad0Key29=-1
Gamepad0Key28=-1
Gamepad0Key27=-1
Gamepad0Key26=-1
Gamepad0Key25=-1
Gamepad0Key24=-1
Gamepad0Key23=-1
Gamepad0Key22=-1
DebuggerHideToolbar=false
Gamepad0Key21=-1
WindowDebuggerWidth=1481
Gamepad0Key20=-1
DebuggerSouthPanelSelectedTab=0
WindowEmuliciousWidth=816
WindowVideoViewerWidth=980
WindowMemoryEditorY=612
WindowMemoryEditorX=1589
Gamepad0Key19=-1
Gamepad0Key18=-1
Gamepad0Key17=-1
Gamepad0Key16=-1
Gamepad0Key15=-1
Gamepad0Key14=-1
Gamepad0Key13=-1
FontSize=13
Gamepad0Key12=-1
Gamepad0Key11=-1
Gamepad0Key10=-1
StackWidth=1311
BankSwapAtPCBreakpointSuspend=true BankSwapAtPCBreakpointSuspend=true
Key20=-1 WindowEmuliciousHeight=781
WindowSpriteViewerHeight=527
GameBoyErrorBreakpointMessage32=
InterruptBreakpointCondition=
Recent0=C\:\\workspace\\dmgtris\\bin\\out.gb
GameBoyErrorBreakpointMessage20=
WindowEmuliciousY=489 WindowEmuliciousY=489
WindowEmuliciousX=666 WindowEmuliciousX=666
DebuggerMemorySelectedTab=HRAM GameBoyErrorBreakpointEnabled9=false
WindowDebuggerWidth=1481 GameBoyErrorBreakpointEnabled8=false
GameBoyErrorBreakpointEnabled7=false
GameBoyErrorBreakpointEnabled6=false
GameBoyErrorBreakpointEnabled5=false
GameBoyErrorBreakpointEnabled4=false
GameBoyErrorBreakpointMessage9= GameBoyErrorBreakpointMessage9=
GameBoyErrorBreakpointEnabled3=false
GameBoyErrorBreakpointMessage8= GameBoyErrorBreakpointMessage8=
GameBoyErrorBreakpointEnabled2=false
GameBoyErrorBreakpointMessage7= GameBoyErrorBreakpointMessage7=
GameBoyErrorBreakpointEnabled1=false
GameBoyErrorBreakpointMessage19=
GameBoyErrorBreakpointEnabled0=false
GameBoyErrorBreakpointMessage6=
GameBoyErrorBreakpointMessage18=
GameBoyErrorBreakpointMessage5=
GameBoyErrorBreakpointMessage17=
GameBoyErrorBreakpointMessage4=
GameBoyErrorBreakpointMessage16=
GameBoyErrorBreakpointMessage3=
GameBoyErrorBreakpointMessage2=
GameBoyErrorBreakpointMessage1=
MemoryTracerDisplayFileOffsetsForROM=true
GameBoyErrorBreakpointMessage0=
GameBoyErrorBreakpointCondition32=
GameBoyErrorBreakpointMessage10=
DataExecutionBreakpointCondition=
Gamepad1Key9=-1
Gamepad1Key8=-1
Gamepad1Key7=-1
Gamepad1Key6=-1
Gamepad1Key5=-1
Gamepad1Key4=-1
Gamepad1Key3=-1
Gamepad1Key2=-1
WindowTileViewerWidth=467
Gamepad1Key1=-1
Gamepad1Key0=-1
RomDir=C\:\\workspace\\dmgtris\\bin
GameBoyErrorBreakpointCondition20=
WindowVideoViewerHeight=1027
WindowEventViewerWindowOpen=true
WindowSpriteViewerY=512
WindowSpriteViewerX=320
CodeFontSize=13
DataExecutionBreakpointSuspend=true
WindowSpriteViewerWidth=370
GameBoyErrorBreakpointCondition19=
GameBoyErrorBreakpointCondition18=
GameBoyErrorBreakpointCondition17=
GameBoyErrorBreakpointCondition16=
Gamepad0Key9=-1
Gamepad0Key8=-1
Gamepad0Key7=-1
Gamepad0Key6=-1
Gamepad0Key5=-1
GameBoyErrorBreakpointCondition10=
Gamepad0Key4=-1
Gamepad0Key3=-1
Gamepad0Key2=-1
Gamepad0Key1=-1
Gamepad0Key0=-1
WindowDebuggerY=170
WindowDebuggerX=1172
InterruptBreakpointSuspend=true
SMSGamepadAKeyboard=false
GameBoyErrorBreakpointSuspend32=true
SMSGamepadB=-1
SMSGamepadA=-1
WindowEventViewerWindowWidth=930
BankSwapAtPCBreakpointCondition=
GameBoyErrorBreakpointSuspend20=true
SouthPanelHeight=635
SMSbuttonsKeyboard=false
StackSplitLocation=320
WindowMemoryEditorHeight=534
WindowTilemapViewerWidth=404
GBGamepadKeyboard=false
UninitializedMemoryBreakpointCondition=
GameBoyErrorBreakpointSuspend19=true
GameBoyErrorBreakpointSuspend18=true
GameBoyErrorBreakpointSuspend17=true
GameBoyErrorBreakpointSuspend16=true
GameBoyErrorBreakpointSuspend10=true
WindowSpriteViewerOpen=false
Scale=5.0
KeyboardRequireWindowFocus=true