477
|
1 L4234 comb Default to divide by 0 error
|
|
2 ldb #$2D
|
|
3 tst 2,y Is number to divide by 0?
|
|
4 beq L4233 Yes, return with error
|
|
5 pshs x Preserve X
|
|
6 tst 8,y Is dividend=0?
|
|
7 lbeq L40DD Yes, answer=0, return from there
|
|
8 lda 7,y Get exponent of # to dividend
|
|
9 suba 1,y Subtract exponent of divisor
|
|
10 lbvs L40EF
|
|
11 sta 7,y
|
|
12 lda #$21 ??? (count for exponent shifts?)
|
|
13 ldb 5,y Get sign byte of dividend
|
|
14 eorb $B,y Calculate which sign result will be
|
|
15 andb #$01 Just keep sign bit
|
|
16 std ,y Save ??? & resulting sign
|
|
17 lsr 2,y Divide whole divisor mantissa by 2
|
|
18 ror 3,y
|
|
19 ror 4,y
|
|
20 ror 5,y
|
|
21 ldd 8,y Get dividend into D:X
|
|
22 ldx $A,y Divide whole dividend by 2
|
|
23 lsra
|
|
24 rorb
|
|
25 exg d,x
|
|
26 rora
|
|
27 rorb
|
|
28 clr $B,y Clear last byte of dividend mantissa
|
|
29 bra L426F
|
|
30
|
|
31 L426D exg d,x
|
|
32 L426F subd 4,y
|
|
33 exg d,x
|
|
34 bcc L4278
|
|
35 subd #$0001
|
|
36 L4278 subd 2,y
|
|
37 beq L42AB
|
|
38 bmi L42A7
|
|
39 L427E orcc #$01
|
|
40 L4280 dec ,y
|
|
41 beq L42F8
|
|
42 rol $B,y
|
|
43 rol $A,y
|
|
44 rol 9,y
|
|
45 rol 8,y
|
|
46 exg d,x
|
|
47 lslb
|
|
48 rola
|
|
49 exg d,x
|
|
50 rolb
|
|
51 rola
|
|
52 bcc L426D
|
|
53 exg d,x
|
|
54 addd 4,y
|
|
55 exg d,x
|
|
56 bcc L42A1
|
|
57 addd #$0001
|
|
58 L42A1 addd 2,y
|
|
59 beq L42AB
|
|
60 bpl L427E
|
|
61 L42A7 andcc #$FE
|
|
62 bra L4280
|
|
63
|
|
64 L42AB leax ,x
|
|
65 bne L427E
|
|
66 ldb ,y
|
|
67 decb
|
|
68 subb #$10
|
|
69 blt L42CD
|
|
70 subb #$08
|
|
71 blt L42C2
|
|
72 stb ,y
|
|
73 lda $0B,y
|
|
74 ldb #$80
|
|
75 bra L42EB
|
|
76
|
|
77 L42C2 addb #$08
|
|
78 stb ,y
|
|
79 ldd #$8000
|
|
80 ldx $0A,y
|
|
81 bra L42ED
|
|
82
|
|
83 L42CD addb #$08
|
|
84 blt L42DB
|
|
85 stb ,y
|
|
86 ldx $09,y
|
|
87 lda $0B,y
|
|
88 ldb #$80
|
|
89 bra L42ED
|
|
90
|
|
91 L42DB addb #$07
|
|
92 stb ,y
|
|
93 ldx $08,y
|
|
94 ldd $0A,y
|
|
95 orcc #$01
|
|
96 L42E5 rolb
|
|
97 rola
|
|
98 exg d,x
|
|
99 rolb
|
|
100 rola
|
|
101 L42EB exg d,x
|
|
102 L42ED andcc #$FE
|
|
103 dec ,y
|
|
104 bpl L42E5
|
|
105 exg d,x
|
|
106 tsta
|
|
107 bra L42FC
|
|
108
|
|
109 L42F8 ldx $0A,y
|
|
110 ldd 8,y
|
|
111 L42FC bmi L430C
|
|
112 exg d,x
|
|
113 rolb
|
|
114 rola
|
|
115 exg d,x
|
|
116 rolb
|
|
117 rola
|
|
118 dec $07,y
|
|
119 lbvs L40DD
|
|
120 L430C exg d,x
|
|
121 addd #$0001
|
|
122 exg d,x
|
|
123 bcc L4321
|
|
124 addd #$0001
|
|
125 bcc L4321
|
|
126 rora
|
|
127 inc 7,y
|
|
128 lbvs L40EF
|
|
129 L4321 std 8,y
|
|
130 tfr x,d
|
|
131 andb #$FE Mask out sign bit
|
|
132 orb 1,y
|
|
133 std $A,y
|
|
134 inc 7,y
|
|
135 lbvs L40EF
|
|
136 L4331 leay 6,y Eat temp var
|
|
137 clrb No error
|
|
138 puls pc,x Restore X & return
|