File tree Expand file tree Collapse file tree 5 files changed +390
-307
lines changed Expand file tree Collapse file tree 5 files changed +390
-307
lines changed Original file line number Diff line number Diff line change 1
1
assume adl=1
2
2
3
3
section .text
4
-
5
4
public _atoll
6
-
7
5
_atoll:
8
- push ix
9
- ld ix, -3
10
- add ix, sp
11
- ld hl, (ix + 9)
12
- ; inlined isspace
13
- .whitespace_loop:
14
- ld a, (hl)
15
- inc hl
16
- cp a, 32
17
- jr z, .whitespace_loop
18
- sub a, 9
19
- add a, -5
20
- jr nc, .whitespace_loop
21
-
22
- ; A = (HL - 1) - 9 + -5
23
- ; A = (HL - 1) - 14
24
- xor a, '-' - 14
25
- push af
26
- jr z, .minus_sign
27
- xor a, ('+' - 14) xor ('-' - 14)
28
- jr z, .plus_sign
29
- dec hl
30
- .plus_sign:
31
- .minus_sign:
32
- ; carry is cleared
33
- push hl
34
- pop iy
35
- sbc hl, hl
36
- ex de, hl
37
- sbc hl, hl
38
- ld b, l
39
- ld c, l
6
+ pop bc
7
+ ex (sp),hl
8
+ push bc
9
+ ld bc,10
10
+ push bc
11
+ ld c,b
12
+ push bc
40
13
push hl
41
- push hl
42
- push hl
43
- ; IY = start of the digits
44
- ; BC:UDE:UHL = 0
45
- ; (ix - 9) = [0, 10]
46
- jr .start
47
- .loop:
48
- ; loop : 27F + 1R + 8W + 1
49
- ; lladd : ?
50
- ; llmulu: ?
51
- ; total : a lot per digit
52
- ld (ix - 9), 10
53
- call __llmulu ; BC:UDE:UHL *= 10
54
- ld (ix - 9), a
55
- call __lladd
56
- inc iy ; next digit
57
- .start:
58
- ld a, (iy)
59
- sub a, 48
60
- cp a, 10
61
- jr c, .loop
62
- .finish:
63
- ld sp, ix
14
+ call _strtoll
15
+ pop af
16
+ pop af
64
17
pop af
65
- ; carry is cleared
66
- pop ix
67
- ret nz ; A != '-' positive
68
- ; A == '-' negative
69
- jp __llneg
18
+ ret
70
19
71
- extern __llneg
72
- extern __lladd
73
- extern __llmulu
20
+ extern _strtoll
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments