Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- _ll_swap_bytes:
- ; de = u8[8]
- ; reverses the bytes of a u8[8]
- pop bc, de
- push de, bc
- ld hl, 7
- ld c, l
- add hl, bc
- add hl, de
- ld b, 4
- .loop:
- ld a, (de)
- ldi
- dec hl
- ld (hl), a
- dec hl
- djnz .loop
- ret
- _bytelen_to_bitlen:
- ; hl = size
- ; iy = dst
- ; converts a size_t to a u8[8]
- ; outputs in big endian
- pop bc, hl, iy
- push iy, hl, bc
- xor a, a
- add hl, hl
- rla
- add hl, hl
- rla
- add hl, hl
- rla
- ld (iy + 6), h
- ld (iy + 7), l
- ld h, a
- ld l, 0
- ld (iy + 3), hl
- sbc hl, hl
- ld (iy + 0), hl
- ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement