PikalaxALT icon

Using GBZ80 to do mod 24 using Chinese Remainder Theorem

PikalaxALT | PRO | 10/01/15 06:09:41 PM UTC | 0 ⭐ | 4788 👁️ | Never ⏰ | []
Z80 Assembler |

0 B

|

None

|

0 👍

/

0 👎

a_mod_3:
.loop
    sub 3
    jr c, .loop
    add 3
    ret
 
dehl_mod_3:
    push bc
    ld b, 0
    ld a, d
    call a_mod_3
    ld b, a
    ld a, e
    call a_mod_3
    add b
    ld b, a
    ld a, h
    call a_mod_3
    add b
    ld b, a
    ld a, l
    call a_mod_3
    add b
    pop bc
    cp 3
    ret c
    call a_mod_3
    ret
 
dehl_mod_24:
    push bc
    ld a, l
    and 7
    ld b, a
    srl
    srl
    srl
    add b
    ld b, a
    call dehl_mod_3
    srl
    srl
    srl
    cpl
    add b
    pop bc
    ret

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎