Use ~X instead of $ff ^ X

This commit is contained in:
Rangi 2021-11-23 20:37:18 -05:00
parent ab0f9c287a
commit e706b878d9
16 changed files with 23 additions and 23 deletions

View File

@ -533,7 +533,7 @@ PlayDanger:
ret z ret z
; Don't do anything if SFX is being played ; Don't do anything if SFX is being played
and $ff ^ (1 << DANGER_ON_F) and ~(1 << DANGER_ON_F)
ld d, a ld d, a
call _CheckSFX call _CheckSFX
jr c, .increment jr c, .increment

View File

@ -340,7 +340,7 @@ CantMove:
ld a, BATTLE_VARS_SUBSTATUS3 ld a, BATTLE_VARS_SUBSTATUS3
call GetBattleVarAddr call GetBattleVarAddr
ld a, [hl] ld a, [hl]
and $ff ^ (1 << SUBSTATUS_BIDE | 1 << SUBSTATUS_RAMPAGE | 1 << SUBSTATUS_CHARGED) and ~(1 << SUBSTATUS_BIDE | 1 << SUBSTATUS_RAMPAGE | 1 << SUBSTATUS_CHARGED)
ld [hl], a ld [hl], a
call ResetFuryCutterCount call ResetFuryCutterCount

View File

@ -245,7 +245,7 @@ BattleAnim_ClearOAM:
ld c, NUM_SPRITE_OAM_STRUCTS ld c, NUM_SPRITE_OAM_STRUCTS
.loop .loop
ld a, [hl] ld a, [hl]
and $ff ^ (PALETTE_MASK | VRAM_BANK_1) ; zeros out the palette bits and ~(PALETTE_MASK | VRAM_BANK_1) ; zeros out the palette bits
assert PAL_BATTLE_OB_ENEMY == 0 assert PAL_BATTLE_OB_ENEMY == 0
ld [hli], a ld [hli], a
rept SPRITEOAMSTRUCT_LENGTH - 1 rept SPRITEOAMSTRUCT_LENGTH - 1

View File

@ -37,7 +37,7 @@ GetBattleAnimFrame:
push af push af
ld a, [hl] ld a, [hl]
push hl push hl
and $ff ^ (Y_FLIP << 1 | X_FLIP << 1) and ~(Y_FLIP << 1 | X_FLIP << 1)
ld hl, BATTLEANIMSTRUCT_DURATION ld hl, BATTLEANIMSTRUCT_DURATION
add hl, bc add hl, bc
ld [hl], a ld [hl], a

View File

@ -35,7 +35,7 @@ CatchTutorial::
ldh [hJoyPressed], a ldh [hJoyPressed], a
ld a, [wOptions] ld a, [wOptions]
push af push af
and $ff ^ TEXT_DELAY_MASK and ~TEXT_DELAY_MASK
add TEXT_DELAY_MED add TEXT_DELAY_MED
ld [wOptions], a ld [wOptions], a
ld hl, .AutoInput ld hl, .AutoInput

View File

@ -351,7 +351,7 @@ GetSpriteOAMAttr:
and PRIORITY | Y_FLIP | X_FLIP and PRIORITY | Y_FLIP | X_FLIP
ld b, a ld b, a
ld a, [hl] ld a, [hl]
and $ff ^ (PRIORITY | Y_FLIP | X_FLIP) and ~(PRIORITY | Y_FLIP | X_FLIP)
or b or b
ret ret
@ -436,7 +436,7 @@ GetSpriteAnimFrame:
push af push af
ld a, [hl] ld a, [hl]
push hl push hl
and $ff ^ (Y_FLIP << 1 | X_FLIP << 1) and ~(Y_FLIP << 1 | X_FLIP << 1)
ld hl, SPRITEANIMSTRUCT_DURATIONOFFSET ld hl, SPRITEANIMSTRUCT_DURATIONOFFSET
add hl, bc add hl, bc
add [hl] add [hl]

View File

@ -2189,7 +2189,7 @@ PokeFluteEffect:
xor a xor a
ld [wPokeFluteCuredSleep], a ld [wPokeFluteCuredSleep], a
ld b, $ff ^ SLP ld b, ~SLP
ld hl, wPartyMon1Status ld hl, wPartyMon1Status
call .CureSleep call .CureSleep

View File

@ -14,7 +14,7 @@ MG_TIMED_OUT EQU 1 << MG_TIMED_OUT_F
MG_CANCELED EQU 1 << MG_CANCELED_F MG_CANCELED EQU 1 << MG_CANCELED_F
MG_WRONG_PREFIX EQU 1 << MG_WRONG_PREFIX_F MG_WRONG_PREFIX EQU 1 << MG_WRONG_PREFIX_F
MG_NOT_OKAY EQU MG_WRONG_CHECKSUM | MG_TIMED_OUT | MG_CANCELED | MG_WRONG_PREFIX MG_NOT_OKAY EQU MG_WRONG_CHECKSUM | MG_TIMED_OUT | MG_CANCELED | MG_WRONG_PREFIX
MG_OKAY EQU $ff ^ MG_NOT_OKAY MG_OKAY EQU ~MG_NOT_OKAY
MG_START_END EQU %11111111 MG_START_END EQU %11111111
REGION_PREFIX EQU $96 REGION_PREFIX EQU $96

View File

@ -472,7 +472,7 @@ SaveOptions:
ld bc, wOptionsEnd - wOptions ld bc, wOptionsEnd - wOptions
call CopyBytes call CopyBytes
ld a, [wOptions] ld a, [wOptions]
and $ff ^ (1 << NO_TEXT_SCROLL) and ~(1 << NO_TEXT_SCROLL)
ld [sOptions], a ld [sOptions], a
jp CloseSRAM jp CloseSRAM

View File

@ -532,7 +532,7 @@ TrainerCard_Page2_3_OAMUpdate:
inc de inc de
ld a, [wTrainerCardBadgeTileID] ld a, [wTrainerCardBadgeTileID]
and $ff ^ (1 << 7) and ~(1 << 7)
add [hl] add [hl]
ld [de], a ; tile id ld [de], a ; tile id
inc hl inc hl

View File

@ -2530,7 +2530,7 @@ _SetPlayerPalette:
ld hl, OBJECT_PALETTE ld hl, OBJECT_PALETTE
add hl, bc add hl, bc
ld a, [hl] ld a, [hl]
and $ff ^ PALETTE_MASK and ~PALETTE_MASK
or d or d
ld [hl], a ld [hl], a
ret ret
@ -2895,7 +2895,7 @@ InitSprites:
ld hl, OBJECT_SPRITE_TILE ld hl, OBJECT_SPRITE_TILE
add hl, bc add hl, bc
ld a, [hl] ld a, [hl]
and $ff ^ (1 << 7) and ~(1 << 7)
ldh [hCurSpriteTile], a ldh [hCurSpriteTile], a
xor a xor a
bit 7, [hl] bit 7, [hl]

View File

@ -759,7 +759,7 @@ Script_musicfadeout:
call GetScriptByte call GetScriptByte
ld [wMusicFadeID + 1], a ld [wMusicFadeID + 1], a
call GetScriptByte call GetScriptByte
and $ff ^ (1 << MUSIC_FADE_IN_F) and ~(1 << MUSIC_FADE_IN_F)
ld [wMusicFade], a ld [wMusicFade], a
ret ret
@ -1159,7 +1159,7 @@ Script_startbattle:
call BufferScreen call BufferScreen
predef StartBattle predef StartBattle
ld a, [wBattleResult] ld a, [wBattleResult]
and $ff ^ BATTLERESULT_BITMASK and ~BATTLERESULT_BITMASK
ld [wScriptVar], a ld [wScriptVar], a
ret ret
@ -1175,7 +1175,7 @@ Script_reloadmapafterbattle:
ld d, [hl] ld d, [hl]
ld [hl], 0 ld [hl], 0
ld a, [wBattleResult] ld a, [wBattleResult]
and $ff ^ BATTLERESULT_BITMASK and ~BATTLERESULT_BITMASK
cp LOSE cp LOSE
jr nz, .notblackedout jr nz, .notblackedout
ld b, BANK(Script_BattleWhiteout) ld b, BANK(Script_BattleWhiteout)

View File

@ -137,5 +137,5 @@ _GetVarAction::
.BattleResult: .BattleResult:
ld a, [wBattleResult] ld a, [wBattleResult]
and $ff ^ BATTLERESULT_BITMASK and ~BATTLERESULT_BITMASK
jp .loadstringbuffer2 jp .loadstringbuffer2

View File

@ -65,12 +65,12 @@ StatsScreenMain:
; ??? ; ???
ld [wStatsScreenFlags], a ld [wStatsScreenFlags], a
ld a, [wStatsScreenFlags] ld a, [wStatsScreenFlags]
and $ff ^ STAT_PAGE_MASK and ~STAT_PAGE_MASK
or PINK_PAGE ; first_page or PINK_PAGE ; first_page
ld [wStatsScreenFlags], a ld [wStatsScreenFlags], a
.loop .loop
ld a, [wJumptableIndex] ld a, [wJumptableIndex]
and $ff ^ (1 << 7) and ~(1 << 7)
ld hl, StatsScreenPointerTable ld hl, StatsScreenPointerTable
rst JumpTable rst JumpTable
call StatsScreen_WaitAnim call StatsScreen_WaitAnim
@ -85,7 +85,7 @@ StatsScreenMobile:
; ??? ; ???
ld [wStatsScreenFlags], a ld [wStatsScreenFlags], a
ld a, [wStatsScreenFlags] ld a, [wStatsScreenFlags]
and $ff ^ STAT_PAGE_MASK and ~STAT_PAGE_MASK
or PINK_PAGE ; first_page or PINK_PAGE ; first_page
ld [wStatsScreenFlags], a ld [wStatsScreenFlags], a
.loop .loop
@ -394,7 +394,7 @@ StatsScreen_JoypadAction:
.set_page .set_page
ld a, [wStatsScreenFlags] ld a, [wStatsScreenFlags]
and $ff ^ STAT_PAGE_MASK and ~STAT_PAGE_MASK
or c or c
ld [wStatsScreenFlags], a ld [wStatsScreenFlags], a
ld h, 4 ld h, 4

View File

@ -56,7 +56,7 @@ DisableLCD::
jr nz, .wait jr nz, .wait
ldh a, [rLCDC] ldh a, [rLCDC]
and $ff ^ (1 << rLCDC_ENABLE) and ~(1 << rLCDC_ENABLE)
ldh [rLCDC], a ldh [rLCDC], a
xor a xor a

View File

@ -1607,7 +1607,7 @@ endr
Unknown_17da94: Unknown_17da94:
for x, 8 for x, 8
db $ff ^ (1 << x) db ~(1 << x)
endr endr
Function17da9c: Function17da9c: