Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Func_f430a:: ; f430a (3d:430a)
- ld a, d
- cp 4
- jr z, .d_is_4_or_6
- cp 6
- jr z, .d_is_4_or_6
- push de
- callab Func_fce18
- pop de
- ret nc
- jr .proceed
- .d_is_4_or_6
- ; We call a different function if d in [4, 6].
- push de
- callab Func_fcdb8
- pop de
- ret nc
- .proceed
- push de
- ; Divide [wd470] by 100. Hold the integer part in e.
- ld e, $0
- ld a, [wd470]
- cp 100
- jr c, .wd470_div_100
- inc e
- cp 200
- jr c, .wd470_div_100
- inc e
- .wd470_div_100
- ; Get the (d, e) entry from Pointer_f4385.
- ld c, d
- dec c
- ld b, $0
- ld hl, Pointer_f4385
- add hl, bc
- add hl, bc
- add hl, bc
- ld d, $0
- add hl, de
- ld a, [hl]
- ; If [hl] is positive, take min(0xff, [hl] + [wd470]).
- ; If [hl] is negative, take max(0x00, [hl] + [wd470]).
- ; Inexplicably, we're using 100 as the threshold for comparison.
- cp 100
- ld a, [wd470]
- jr nc, .greater_equal_100
- add [hl]
- jr nc, .okay
- ld a, -1
- jr .okay
- .greater_equal_100
- add [hl]
- jr c, .okay
- xor a
- .okay
- ld [wd470], a
- ; Restore d and get the d'th entry in Pointer_f43a6.
- pop de
- dec d
- ld hl, Pointer_f43a6
- ld e, d
- ld d, $0
- add hl, de
- ld a, [hl]
- ld b, a
- ; If that entry is equal to $80, do not modify [wd471].
- cp $80
- jr z, .done
- ; If that entry is less than $80, [wd471] is the lesser of that entry and [wd471].
- ; If [wd49c] is not set, [wd471] is the greater of that entry and [wd471].
- ld a, [wd471]
- jr c, .return_if_less_than_b
- cp b
- jr nc, .done
- ld a, [wd49c]
- and a
- jr nz, .done
- jr .copy_b_into_wd471
- .return_if_less_than_b
- cp b
- jr c, .done
- .copy_b_into_wd471
- ld a, b
- ld [wd471], a
- .done
- ret
- Pointer_f4385:: ; f4385 (3d:4385)
- db 5, 3, 2 ; $05, $03, $02
- db 5, 3, 2 ; $05, $03, $02
- db 1, 1, 0 ; $01, $01, $00
- db 3, 2, 1 ; $03, $02, $01
- db 1, 1, 0 ; $01, $01, $00
- db 2, 1, 1 ; $02, $01, $01
- db -3, -3, -5 ; $fd, $fd, $fb
- db -1, -1, -1 ; $ff, $ff, $ff
- db -5, -5, -10 ; $fb, $fb, $f6
- db -5, -5, -10 ; $fb, $fb, $f6
- db -10, -10, -20 ; $f6, $f6, $ec
- Pointer_f43a6:: ; f43a6 (3d:43a6)
- db $8a
- db $83
- db $80
- db $80
- db $94
- db $80
- db $62
- db $6c
- db $62
- db $6c
- db $00
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement