comment flag predef

this is like FlagAction but with index c instead of de
This commit is contained in:
yenatch
2013-09-09 12:47:02 -04:00
parent 771ebcbf23
commit 2b4a5bdd8d

View File

@@ -11988,7 +11988,7 @@ PredefPointers: ; 856b
dwb Function6508, BANK(Function6508) dwb Function6508, BANK(Function6508)
dwb Function747a, BANK(Function747a) dwb Function747a, BANK(Function747a)
dwb Functionc658, BANK(Functionc658) dwb Functionc658, BANK(Functionc658)
dwb Function4d7c1, BANK(Function4d7c1) dwb FlagPredef, BANK(FlagPredef)
dwb Functionc699, BANK(Functionc699) dwb Functionc699, BANK(Functionc699)
dwb FillPP, BANK(FillPP) dwb FillPP, BANK(FillPP)
dwb Functiond88c, BANK(Functiond88c) dwb Functiond88c, BANK(Functiond88c)
@@ -52635,57 +52635,73 @@ INCBIN "baserom.gbc", $4d580, $4d596 - $4d580
Tilesets: Tilesets:
INCLUDE "tilesets/tileset_headers.asm" INCLUDE "tilesets/tileset_headers.asm"
Function4d7c1: ; 4d7c1
FlagPredef: ; 4d7c1
; Perform action b on flag c in flag array hl.
; If checking a flag, check flag array d:hl unless d is 0.
; For longer flag arrays, see FlagAction.
push hl push hl
push bc push bc
; Divide by 8 to get the byte we want.
push bc push bc
srl c srl c
srl c srl c
srl c srl c
ld b, $0 ld b, 0
add hl, bc add hl, bc
pop bc pop bc
; Which bit we want from the byte
ld a, c ld a, c
and $7 and 7
ld c, a ld c, a
ld a, $1
jr z, .asm_4d7da ; Shift left until we can mask the bit
.asm_4d7d6 ld a, 1
jr z, .shifted
.shift
add a add a
dec c dec c
jr nz, .asm_4d7d6 jr nz, .shift
.shifted
.asm_4d7da
ld c, a ld c, a
; What are we doing to this flag?
dec b dec b
jr z, .asm_4d7e7 jr z, .set ; 1
dec b dec b
jr z, .asm_4d7ec jr z, .check ; 2
.reset
ld a, c ld a, c
cpl cpl
and [hl] and [hl]
ld [hl], a ld [hl], a
jr .asm_4d7f9 jr .done
.asm_4d7e7 .set
ld a, [hl] ld a, [hl]
or c or c
ld [hl], a ld [hl], a
jr .asm_4d7f9 jr .done
.asm_4d7ec .check
ld a, d ld a, d
cp $0 cp 0
jr nz, .asm_4d7f5 jr nz, .farcheck
ld a, [hl] ld a, [hl]
and c and c
jr .asm_4d7f9 jr .done
.asm_4d7f5 .farcheck
call GetFarByte call GetFarByte
and c and c
.asm_4d7f9 .done
pop bc pop bc
pop hl pop hl
ld c, a ld c, a