annotate 3rdparty/packages/basic09/basic09.real.div.68.asm @ 3054:22ddd48b4ec2

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