1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
;--------------------------------------------------------------------------
; _divulong.s
;
; Copyright (C) 2014, Ben Shi
;
; This library is free software; you can redistribute it and/or modify it
; under the terms of the GNU General Public License as published by the
; Free Software Foundation; either version 2, or (at your option) any
; later version.
;
; This library is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with this library; see the file COPYING. If not, write to the
; Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
; MA 02110-1301, USA.
;
; As a special exception, if you link this library with other files,
; some of which are compiled with SDCC, to produce an executable,
; this library does not by itself cause the resulting executable to
; be covered by the GNU General Public License. This exception does
; not however invalidate any other reasons why the executable file
; might be covered by the GNU General Public License.
;--------------------------------------------------------------------------
.globl __divulong
.area CODE
__divulong:
sub sp, #6
; device/lib/_divulong.c: 333: unsigned long reste = 0L;
clrw x
ldw (0x05, sp), x
ldw (0x03, sp), x
; device/lib/_divulong.c: 334: unsigned char count = 32;
ld a, #0x20
ld (0x02, sp), a
; device/lib/_divulong.c: 337: do
__divulong_00105:
; device/lib/_divulong.c: 340: c = MSB_SET(x);
ld a, (0x09, sp)
sll a
clr a
rlc a
ld (0x01, sp), a
; device/lib/_divulong.c: 341: x <<= 1;
ldw y, (0x0b, sp)
ldw x, (0x09, sp)
sllw y
rlcw x
ldw (0x0b, sp), y
ldw (0x09, sp), x
; device/lib/_divulong.c: 342: reste <<= 1;
ldw y, (0x05, sp)
ldw x, (0x03, sp)
sllw y
rlcw x
ldw (0x05, sp), y
ldw (0x03, sp), x
; device/lib/_divulong.c: 343: if (c)
tnz (0x01, sp)
jreq __divulong_00102
; device/lib/_divulong.c: 344: reste |= 1L;
ld a, (0x06, sp)
or a, #0x01
ld (0x06, sp), a
__divulong_00102:
; device/lib/_divulong.c: 346: if (reste >= y)
ldw x, (0x05, sp)
subw x, (0x0f, sp)
ld a, (0x04, sp)
sbc a, (0x0e, sp)
ld yl, a
ld a, (0x03, sp)
sbc a, (0x0d, sp)
jrc __divulong_00106
; device/lib/_divulong.c: 348: reste -= y;
ldw (0x05, sp), x
ld yh, a
ldw (0x03, sp), y
; device/lib/_divulong.c: 350: x |= 1L;
ld a, (0x0c, sp)
or a, #0x01
ld (0x0c, sp), a
__divulong_00106:
; device/lib/_divulong.c: 353: while (--count);
dec (0x02, sp)
jrne __divulong_00105
; device/lib/_divulong.c: 354: return x;
ldw x, (0x0b, sp)
ldw y, (0x09, sp)
addw sp, #6
ret
|