Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- _lshiftc:
- ; de = dest
- ; hl = src
- ; a = shift count
- push af
- and a, 7
- jr z, .skip_bitshift
- inc a
- ld c, a
- .loop_nbits:
- ld b, 30
- push hl,de
- or a
- .lshift_bits:
- ld a, (hl)
- rla
- ld (de), a
- inc hl
- inc de
- djnz .lshift_bits
- pop de,hl
- dec c
- jr nz, .loop_nbits
- .skip_bitshift:
- pop af
- or a
- rra
- rra
- rra
- or a
- ret z
- ld bc, 0 ; make sure bcu is zeroed
- ld c, 30 ; c is total length of region to copy bytes to
- ld b, a ; b is number of bytes to set to 0
- xor a ; zero a
- .zero_nbytes:
- ld (de), a
- inc de ; increase de
- dec c ; decrease c
- djnz .zero_nbytes ; should stop when b = 0 and c = remaining bytes to copy
- ldir ; hl = LSB of src, de = next byte of dest
- ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement