Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mov r0, #027h ;divident high
- mov r1, #015h; divident low
- mov r2, #007h;divider high
- mov r3, #0d0h; divider low
- mov r5, #00h
- mov r4, #00h
- ;3 0000 -2000
- ; r0 r1
- ;: r2 r3
- ;________
- ; = r4 r5
- sub_again:
- cjne r0, #0,start_sub
- cjne r1, #0, start_sub
- ljmp end
- start_sub:
- clr c
- mov a, r1
- subb a, r3
- mov r1, a
- jc ovf1
- cont1:
- mov a,r0
- subb a, r2
- mov r0,a
- jnc inc_result
- ljmp end;
- ovf1:
- clr c ; better safe than sorry
- dec r0
- ljmp cont1
- inc_result:
- inc r5;
- cjne r5,#0h, sub_again
- inc_result2dig:
- inc r4
- ljmp sub_again
- end :ljmp end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement