forked from pret/pokecrystal
-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
Link Movement BranchIssues with Link MovementIssues with Link MovementenhancementNew feature or requestNew feature or request
Description
LinkMovementCheckRoomInBuffer::
; Input: hl: ring buffer to store in.
; Output: de: Pointer to Head, Sets Z flag if no room.
; clobbers hl, a
dec hl
ld a, [hld]
ld e, a
ld a, [hld]
ld d, a
ld a, [hld]
ld h, [hl]
ld l, a
ld a, l
sub e
ld l, a
ld a, h
sbc d
ld h, a
ld a, l
cp 1 ; Sets Z flag if no room.
ret
LinkMovementStoreByte::
; Input: a: Byte to store, hl: ring buffer to store in.
; Output: Z flag if no room.
; clobbers hl, de, b
ld b, a
push hl
call LinkMovementCheckRoomInBuffer
pop hl
ret z
inc de
push hl
ld a, 16
add l
ld l, a
adc h
sub l
cp d
jr nz, .continue
ld a, l
cp e
jr nz, .continue
ld hl, -16
add de, hl
.continue
pop hl
dec hl
ld a, e
ld [hld], a
ld a, d
ld [hl], a
ld a, b
ld [de], a
ret
LinkMovementCheckBufferEmpty::
; Input: hl: ring buffer to store in.
; Output: hl: Pointer to Head, Sets Z flag if no room.
; clobbers hl, a
dec hl
ld a, [hld]
ld e, a
ld a, [hld]
ld d, a
ld a, [hld]
ld h, [hl]
ld l, a
ld a, e
sub l
ld e, a
ld a, d
sbc h
ld d, a
ld a, e
cp 1 ; Sets Z flag if no room.
ret
LinkMovementGetByte::
; Input: hl: ring buffer to get byte from
; Output: a: byte from buffer, Z flag if buffer is empty
; clobbers hl, de, b
push hl
call LinkMovementCheckBufferEmpty
pop de
ret z
dec
; WIP
retReactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Link Movement BranchIssues with Link MovementIssues with Link MovementenhancementNew feature or requestNew feature or request