diff options
author | xCrystal <rgr.crystal@gmail.com> | 2018-03-02 21:25:54 +0100 |
---|---|---|
committer | xCrystal <rgr.crystal@gmail.com> | 2018-03-02 21:25:54 +0100 |
commit | a1ac5507569e781d7f01c9a8abf3b5f16c8efdfd (patch) | |
tree | 20b1d2fb0e97c85e44d42a53aace2a856effe442 /src/engine/home.asm | |
parent | f184ad7947eaec60f5c25388ee98689fb52a93de (diff) |
Disassemble more duel menu functions and some oam functions
Diffstat (limited to 'src/engine/home.asm')
-rw-r--r-- | src/engine/home.asm | 80 |
1 files changed, 75 insertions, 5 deletions
diff --git a/src/engine/home.asm b/src/engine/home.asm index ed5eaf6..0e6a6ac 100644 --- a/src/engine/home.asm +++ b/src/engine/home.asm @@ -1563,12 +1563,82 @@ Func_08ef: ; 08ef (0:08ef) jr .asm_93c ; 0x950 - INCROM $0950, $099c +; set attributes for [hl] sprites starting from wOAM + [wOAMOffset] / 4 +; return carry if reached end of wOAM before finishing +SetManyObjectsAttributes: ; 950 (0:950) + push hl + ld a, [wOAMOffset] + ld c, a + ld b, HIGH(wOAM) + cp 40 * 4 + jr nc, .beyond_oam + pop hl + ld a, [hli] ; [hl] = how many obj? +.copy_obj_loop + push af + ld a, [hli] + add e + ld [bc], a ; Y Position <- [hl + 1 + 4*i] + e + inc bc + ld a, [hli] + add d + ld [bc], a ; X Position <- [hl + 2 + 4*i] + d + inc bc + ld a, [hli] + ld [bc], a ; Tile/Pattern Number <- [hl + 3 + 4*i] + inc bc + ld a, [hli] + ld [bc], a ; Attributes/Flags <- [hl + 4 + 4*i] + inc bc + ld a, c + cp 40 * 4 + jr nc, .beyond_oam + pop af + dec a + jr nz, .copy_obj_loop + or a +.done + ld hl, wOAMOffset + ld [hl], c + ret +.beyond_oam + pop hl + scf + jr .done +; 0x97f + +; for the sprite at wOAM + [wOAMOffset] / 4, set its attributes from registers e, d, c, b +; return carry if [wOAMOffset] > 40 * 4 (beyond the end of wOAM) +SetOneObjectAttributes: ; 97f (0:97f) + push hl + ld a, [wOAMOffset] + ld l, a + ld h, HIGH(wOAM) + cp 40 * 4 + jr nc, .beyond_oam + ld [hl], e ; Y Position + inc hl + ld [hl], d ; X Position + inc hl + ld [hl], c ; Tile/Pattern Number + inc hl + ld [hl], b ; Attributes/Flags + inc hl + ld a, l + ld [wOAMOffset], a + pop hl + or a + ret +.beyond_oam + pop hl + scf + ret +; 0x99c ; set the Y Position and X Position of all sprites in wOAM to $00 -InitSpritePositions: ; 099c (0:099c) +ZeroObjectPositions: ; 099c (0:099c) xor a - ld [wcab5], a + ld [wOAMOffset], a ld hl, wOAM ld c, 40 xor a @@ -3589,7 +3659,7 @@ ResetStatusConditions: ; 1461 (0:1461) ld h, a xor a ld l, DUELVARS_ARENA_CARD_STATUS - ld [hl], a + ld [hl], a ; NO_STATUS ld l, DUELVARS_ARENA_CARD_SUBSTATUS1 ld [hl], a ld l, DUELVARS_ARENA_CARD_SUBSTATUS2 @@ -9644,7 +9714,7 @@ Func_3b31: ; 3b31 (0:3b31) ld [wDoFrameFunction], a ld [wcad4], a .asm_3b45 - call InitSpritePositions + call ZeroObjectPositions ld a, $1 ld [wVBlankOAMCopyToggle], a pop af |