Identify more bit flags (#1153)

This commit is contained in:
Sylvie
2024-11-29 19:29:30 -05:00
committed by GitHub
parent 8894e29da2
commit 644bd42fb0
78 changed files with 539 additions and 472 deletions

View File

@@ -229,16 +229,16 @@ WaitSFX::
.wait
ld hl, wChannel5Flags1
bit 0, [hl]
bit SOUND_CHANNEL_ON, [hl]
jr nz, .wait
ld hl, wChannel6Flags1
bit 0, [hl]
bit SOUND_CHANNEL_ON, [hl]
jr nz, .wait
ld hl, wChannel7Flags1
bit 0, [hl]
bit SOUND_CHANNEL_ON, [hl]
jr nz, .wait
ld hl, wChannel8Flags1
bit 0, [hl]
bit SOUND_CHANNEL_ON, [hl]
jr nz, .wait
pop hl
@@ -250,16 +250,16 @@ IsSFXPlaying::
push hl
ld hl, wChannel5Flags1
bit 0, [hl]
bit SOUND_CHANNEL_ON, [hl]
jr nz, .playing
ld hl, wChannel6Flags1
bit 0, [hl]
bit SOUND_CHANNEL_ON, [hl]
jr nz, .playing
ld hl, wChannel7Flags1
bit 0, [hl]
bit SOUND_CHANNEL_ON, [hl]
jr nz, .playing
ld hl, wChannel8Flags1
bit 0, [hl]
bit SOUND_CHANNEL_ON, [hl]
jr nz, .playing
pop hl
@@ -504,16 +504,16 @@ PlaceBCDNumberSprite:: ; unreferenced
CheckSFX::
; Return carry if any SFX channels are active.
ld a, [wChannel5Flags1]
bit 0, a
bit SOUND_CHANNEL_ON, a
jr nz, .playing
ld a, [wChannel6Flags1]
bit 0, a
bit SOUND_CHANNEL_ON, a
jr nz, .playing
ld a, [wChannel7Flags1]
bit 0, a
bit SOUND_CHANNEL_ON, a
jr nz, .playing
ld a, [wChannel8Flags1]
bit 0, a
bit SOUND_CHANNEL_ON, a
jr nz, .playing
and a
ret

View File

@@ -7,21 +7,21 @@
DoubleSpeed::
ld hl, rKEY1
bit 7, [hl]
bit KEY1_DBLSPEED, [hl]
jr z, SwitchSpeed
ret
NormalSpeed::
ld hl, rKEY1
bit 7, [hl]
bit KEY1_DBLSPEED, [hl]
ret z
SwitchSpeed::
set 0, [hl]
set KEY1_PREPARE, [hl]
xor a
ldh [rIF], a
ldh [rIE], a
ld a, $30
ld a, (1 << rJOYP_BUTTONS) | (1 << rJOYP_DPAD)
ldh [rJOYP], a
stop ; rgbasm adds a nop after this instruction by default
ret

View File

@@ -38,7 +38,7 @@ GameTimer::
; Is the timer already capped?
ld hl, wGameTimeCap
bit 0, [hl]
bit GAME_TIME_CAPPED, [hl]
ret nz
; +1 frame
@@ -103,7 +103,7 @@ GameTimer::
jr c, .ok
ld hl, wGameTimeCap
set 0, [hl]
set GAME_TIME_CAPPED, [hl]
ld a, 59 ; 999:59:59.00
ld [wGameTimeMinutes], a

View File

@@ -38,7 +38,7 @@ UpdateJoypad::
; We can only get four inputs at a time.
; We take d-pad first for no particular reason.
ld a, R_DPAD
ld a, 1 << rJOYP_DPAD
ldh [rJOYP], a
; Read twice to give the request time to take.
ldh a, [rJOYP]
@@ -55,7 +55,7 @@ UpdateJoypad::
; Buttons make 8 total inputs (A, B, Select, Start).
; We can fit this into one byte.
ld a, R_BUTTONS
ld a, 1 << rJOYP_BUTTONS
ldh [rJOYP], a
; Wait for input to stabilize.
rept 6
@@ -68,7 +68,7 @@ endr
ld b, a
; Reset the joypad register since we're done with it.
ld a, $30
ld a, (1 << rJOYP_BUTTONS) | (1 << rJOYP_DPAD)
ldh [rJOYP], a
; To get the delta we xor the last frame's input with the new one.
@@ -427,7 +427,7 @@ PromptButton::
.blink_cursor
ldh a, [hVBlankCounter]
and %00010000 ; bit 4, a
and 1 << 4 ; blink every 2**4 = 16 frames
jr z, .cursor_off
ld a, "▼"
jr .load_cursor_state

View File

@@ -1003,7 +1003,7 @@ ExecuteCallbackScript::
ld hl, wScriptFlags
ld a, [hl]
push af
set 1, [hl]
set UNUSED_SCRIPT_FLAG_1, [hl]
farcall EnableScriptMode
farcall ScriptEvents
pop af

View File

@@ -193,7 +193,7 @@ PlaceVerticalMenuItems::
jr nz, .loop
ld a, [wMenuDataFlags]
bit 4, a
bit STATICMENU_PLACE_TITLE_F, a
ret z
call MenuBoxCoord2Tile
@@ -218,20 +218,20 @@ GetMenuTextStartCoord::
ld a, [wMenuBorderLeftCoord]
ld c, a
inc c
; bit 6: if not set, leave extra room on top
; if not set, leave extra room on top
ld a, [wMenuDataFlags]
bit 6, a
jr nz, .bit_6_set
bit STATICMENU_NO_TOP_SPACING_F, a
jr nz, .no_top_spacing
inc b
.bit_6_set
; bit 7: if set, leave extra room on the left
.no_top_spacing
; if set, leave extra room on the left
ld a, [wMenuDataFlags]
bit 7, a
jr z, .bit_7_clear
bit STATICMENU_CURSOR_F, a
jr z, .no_cursor
inc c
.bit_7_clear
.no_cursor
ret
ClearMenuBoxInterior::
@@ -374,12 +374,12 @@ VerticalMenu::
call ApplyTilemap
call CopyMenuData
ld a, [wMenuDataFlags]
bit 7, a
bit STATICMENU_CURSOR_F, a
jr z, .cancel
call InitVerticalMenuCursor
call StaticMenuJoypad
call MenuClickSound
bit 1, a
bit B_BUTTON_F, a
jr z, .okay
.cancel
scf
@@ -525,7 +525,7 @@ SetUpMenu::
call MenuWriteText
call InitMenuCursorAndButtonPermissions
ld hl, w2DMenuFlags1
set 7, [hl]
set _2DMENU_DISABLE_JOYPAD_FILTER_F, [hl]
ret
DrawVariableLengthMenuBox::
@@ -621,13 +621,13 @@ InitMenuCursorAndButtonPermissions::
call InitVerticalMenuCursor
ld hl, wMenuJoypadFilter
ld a, [wMenuDataFlags]
bit 3, a
jr z, .disallow_select
bit STATICMENU_ENABLE_START_F, a
jr z, .disallow_start
set START_F, [hl]
.disallow_select
.disallow_start
ld a, [wMenuDataFlags]
bit 2, a
bit STATICMENU_ENABLE_LEFT_RIGHT_F, a
jr z, .disallow_left_right
set D_LEFT_F, [hl]
set D_RIGHT_F, [hl]
@@ -795,7 +795,7 @@ MenuClickSound::
and A_BUTTON | B_BUTTON
jr z, .nosound
ld hl, wMenuFlags
bit 3, [hl]
bit MENU_NO_CLICK_SFX_F, [hl]
jr nz, .nosound
call PlayClickSFX
.nosound

View File

@@ -5,7 +5,7 @@ PrinterReceive::
AskSerial::
; send out a handshake while serial int is off
ld a, [wPrinterConnectionOpen]
bit 0, a
bit PRINTER_CONNECTION_OPEN, a
ret z
; if we're still interpreting data, don't try to receive

View File

@@ -11,7 +11,7 @@ Serial::
jr nz, .mobile
ld a, [wPrinterConnectionOpen]
bit 0, a
bit PRINTER_CONNECTION_OPEN, a
jr nz, .printer
ldh a, [hSerialConnectionStatus]
@@ -62,7 +62,7 @@ Serial::
ldh [rDIV], a
.delay_loop
ldh a, [rDIV]
bit 7, a
bit 7, a ; wait until rDIV has incremented from 3 to $80 or more
jr nz, .delay_loop
ld a, (0 << rSC_ON) | (0 << rSC_CLOCK)

View File

@@ -72,10 +72,10 @@ FixDays::
; check if day count > 255 (bit 8 set)
ldh a, [hRTCDayHi] ; DH
bit 0, a
bit RTC_DH_HI, a
jr z, .daylo
; reset dh (bit 8)
res 0, a
res RTC_DH_HI, a
ldh [hRTCDayHi], a
; mod 140
@@ -93,7 +93,7 @@ FixDays::
ldh [hRTCDayLo], a
; flag for sRTCStatusFlags
ld a, %01000000
ld a, RTC_DAYS_EXCEED_255
jr .set
.daylo
@@ -112,7 +112,7 @@ FixDays::
ldh [hRTCDayLo], a
; flag for sRTCStatusFlags
ld a, %00100000
ld a, RTC_DAYS_EXCEED_139
.set
; update clock with modded day value
@@ -227,7 +227,7 @@ SetClock::
; this block is totally pointless
ld [hl], RTC_DH
ld a, [de]
bit 6, a ; halt
bit RTC_DH_HALT, a
ld [de], a
; seconds
@@ -249,7 +249,7 @@ SetClock::
; day hi
ld [hl], RTC_DH
ldh a, [hRTCDayHi]
res 6, a ; make sure timer is active
res RTC_DH_HALT, a ; make sure timer is active
ld [de], a
; cleanup