/[projet1]/users/mmu_man/demos/viendez/div8.s
Defence Force logotype

Contents of /users/mmu_man/demos/viendez/div8.s

Parent Directory Parent Directory | Revision Log Revision Log


Revision 862 - (show annotations)
Fri Sep 21 10:08:26 2012 UTC (7 years, 8 months ago) by mmu_man
File size: 964 byte(s)
Add sources for my 'viendez' microAlchimie2 invitro released at VIP2012.

1 ; _foofoo .byt 0 ;
2 _div8uLTQ .byt 0
3 _div8uLB .byt 0
4 _div8u
5 ldy #0
6 lda (sp),y
7 sta _div8uLTQ
8 ldy #2
9 lda (sp),y
10 sta _div8uLB
11 ;jmp _div8uout
12 ; http://6502org.wikidot.com/software-math-intdiv
13
14 LDA #0
15 LDX #8
16 ASL _div8uLTQ
17 _div8uL1
18 ROL
19 CMP _div8uLB
20 BCC _div8uL2
21 SBC _div8uLB
22 _div8uL2
23 ROL _div8uLTQ
24 DEX
25 BNE _div8uL1
26 _div8uout
27
28 ldx _div8uLTQ
29 lda #0
30 rts
31
32
33 ; _foofoo .byt 0 ;
34 _div8sLTQ .byt 0
35 _div8sLB .byt 0
36 _div8sSIGN .byt 0
37 _div8s
38 ldx #0
39 ldy #0
40 lda (sp),y
41 sta _div8sLTQ
42 cmp #0
43 bpl _div8spos1
44 lda #0
45 clc
46 sbc _div8sLTQ
47 sta _div8sLTQ
48 inx
49 _div8spos1
50 stx _div8sSIGN
51 ldy #2
52 lda (sp),y
53 sta _div8sLB
54 ;jmp _div8sout
55 ; http://6502org.wikidot.com/software-math-intdiv
56
57 LDA #0
58 LDX #8
59 ASL _div8sLTQ
60 _div8sL1
61 ROL
62 CMP _div8sLB
63 BCC _div8sL2
64 SBC _div8sLB
65 _div8sL2
66 ROL _div8sLTQ
67 DEX
68 BNE _div8sL1
69 _div8sout
70 ldx _div8sLTQ
71 lda _div8sSIGN
72 cmp #0
73
74 beq _div8spos3
75 lda #0
76 clc
77 sbc _div8sLTQ
78 tax
79 lda #$ff
80 rts
81 _div8spos3
82 lda #0
83 rts
84

  ViewVC Help
Powered by ViewVC 1.1.26