Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- _get_degree:
- ; input: hl = ptr to binary polynomial (little endian-encoded)
- ; degree in a
- ; destroys: bc, flags
- ld bc, 29
- add hl, bc
- ld b, 30
- ld d, 240
- .byte_loop:
- ld a, (hl)
- or a ; if byte is 0
- jr nz, .found_byte
- ld a, d
- sub a, 8
- ld d, a
- djnz .byte_loop
- .found_byte:
- ; process bits
- ld b, 8
- .bit_loop:
- rla
- jr c, .found_bit
- dec d
- djnz .bit_loop
- .found_bit:
- dec d
- ld a, d
- ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement