Skip to content

Commit e1ebc87

Browse files
[binutils] idk just start doing things
1 parent 6ee6d1a commit e1ebc87

File tree

385 files changed

+5505
-4796
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

385 files changed

+5505
-4796
lines changed

makefile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ install: all $(addprefix install-,$(SRCS)) $(addprefix install-,$(LIBS))
5555
$(Q)$(call MKDIR,$(INSTALL_EXAMPLES))
5656
$(Q)$(call COPYDIR,$(call NATIVEPATH,examples/*),$(INSTALL_EXAMPLES))
5757
$(Q)$(call COPY,$(call NATIVEPATH,src/makefile.mk),$(INSTALL_META))
58-
$(Q)$(call COPY,$(call NATIVEPATH,src/linker_script),$(INSTALL_META))
58+
$(Q)$(call COPY,$(call NATIVEPATH,src/linker_script.ld),$(INSTALL_META))
5959
$(Q)$(call COPY,$(call NATIVEPATH,tools/fasmg/fasmg-ez80/commands.alm),$(INSTALL_META))
6060
$(Q)$(call COPY,$(call NATIVEPATH,tools/fasmg/fasmg-ez80/ez80.alm),$(INSTALL_META))
6161
$(Q)$(call COPY,$(call NATIVEPATH,tools/fasmg/fasmg-ez80/ld.alm),$(INSTALL_META))
@@ -80,7 +80,6 @@ libs-zip:
8080
$(Q)$(foreach library,$(LIBS),$(call COPY,$(call NATIVEPATH,$(call SRCDIR,$(library))/$(library).8xv),clibs) &&) $(call NATIVEEXE,7z) a clibs_separately_in_zip.zip clibs
8181

8282
clean: $(addprefix clean-,$(TOOLS)) $(addprefix clean-,$(SRCS)) $(addprefix clean-,$(LIBS))
83-
$(Q)$(call REMOVE,src/linker_script)
8483
$(Q)$(call REMOVE,clibs.8xg)
8584
$(Q)$(call RMDIR,docs/build)
8685
$(Q)$(call RMDIR,docs/doxygen)

src/ce/atomic_load_32.src

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,32 @@
11
; ---
22
; uint32_t atomic_load_32(volatile uint32_t *p)
33
; ---
4-
assume adl=1
4+
.assume adl=1
5+
6+
.section .text
7+
.global _atomic_load_32
8+
.type _atomic_load_32, @function
59

6-
section .text
7-
public _atomic_load_32
810
_atomic_load_32:
911
pop hl
10-
ex (sp),iy
12+
ex (sp), iy
1113
push hl
12-
ld c,0
13-
retry:
14+
ld c, 0
15+
.L.retry:
1416
; Wait for a different (increasing) amount of time before each retry to prevent
1517
; getting caught in an endless loop of the value changing between reads with a
1618
; fixed period equal to the amount of time it takes for each retry
1719
inc c
1820
ld b,c
19-
wait:
20-
djnz wait
21+
.L.wait:
22+
djnz .L.wait
2123
; Read the value twice.
22-
lea hl,iy+3
24+
lea hl, iy+3
2325
; Time between first and last byte read:
24-
ld de,(iy) ; 2R
25-
ld a,(hl) ; + 1F+1R
26-
cp a,(hl) ; + 1F+1R
27-
ld hl,(iy) ; + 3F+3R
26+
ld de, (iy) ; 2R
27+
ld a, (hl) ; + 1F+1R
28+
cp a, (hl) ; + 1F+1R
29+
ld hl, (iy) ; + 3F+3R
2830
; = 5F+7R
2931
; = 48cc (assuming F = R = 3)
3032
; = 1us (assuming 48MHz clock speed)
@@ -52,10 +54,10 @@ wait:
5254
;
5355
; (Furthermore, if a change occurs in the middle of both 32-bit reads and the
5456
; bytes already read change in both, then both values read become invalid.)
55-
jr nz,retry
56-
sbc hl,de
57-
jr nz,retry
57+
jr nz, .L.retry
58+
sbc hl, de
59+
jr nz, .L.retry
5860
; Values don't differ, good to go.
59-
add hl,de
60-
ld e,a ; euhl = value read
61+
add hl, de
62+
ld e, a ; euhl = value read
6163
ret

src/ce/atomic_load_decreasing_32.src

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,35 @@
11
; ---
22
; uint32_t atomic_load_decreasing_32(volatile uint32_t *p)
33
; ---
4-
assume adl=1
4+
.assume adl=1
5+
6+
.section .text
7+
.global _atomic_load_decreasing_32
8+
.type _atomic_load_decreasing_32, @function
59

6-
section .text
7-
public _atomic_load_decreasing_32
810
_atomic_load_decreasing_32:
911
pop hl
10-
ex (sp),iy
12+
ex (sp), iy
1113
push hl
1214
; Temporarily disable interrupts.
13-
ld a,i
15+
ld a, i
1416
di
1517
; Read the value twice.
1618
; first value read = cude, second value read = auhl
1719
; Time between first and last byte read:
18-
ld de,(iy) ; 2R
19-
ld c,(iy+3) ; + 3F+1R
20-
ld hl,(iy) ; + 3F+3R
21-
ld a,(iy+3) ; + 3F+1R
20+
ld de, (iy) ; 2R
21+
ld c, (iy+3) ; + 3F+1R
22+
ld hl, (iy) ; + 3F+3R
23+
ld a, (iy+3) ; + 3F+1R
2224
; = 9F+7R
2325
; = 56cc (assuming F = R = 3)
2426
; ~ 1.17us (assuming 48MHz clock speed)
2527
; + approximate worst-case LCD + USB DMA
2628
; ~ 5us
2729
; Re-enable interrupts if they were previously enabled.
28-
jp po,no_ei
30+
jp po, .L.no_ei
2931
ei
30-
no_ei:
32+
.L.no_ei:
3133
; Compare and return the greater of the two values read.
3234
;
3335
; If the values differ, then the underlying value changed between reading the
@@ -69,21 +71,21 @@ no_ei:
6971
;
7072
; Combining all of these cases and assumptions, the greater of the two values
7173
; read will always be valid.
72-
or a,a
73-
sbc hl,de
74-
sbc a,c ; auhl = second value read
74+
or a, a
75+
sbc hl, de
76+
sbc a, c ; auhl = second value read
7577
; - first value read
76-
jr c,swap
78+
jr c, .L.swap
7779
; second value read >= first value read
7880
; ==> second value read is valid
79-
add hl,de
80-
adc a,c
81-
ld e,a ; euhl = second value read
81+
add hl, de
82+
adc a, c
83+
ld e, a ; euhl = second value read
8284
ret
8385

84-
swap:
86+
.L.swap:
8587
; second value read < first value read
8688
; ==> first value read is valid
87-
ex de,hl
88-
ld e,c ; euhl = first value read
89+
ex de, hl
90+
ld e, c ; euhl = first value read
8991
ret

src/ce/atomic_load_increasing_32.src

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,44 @@
11
; ---
22
; uint32_t atomic_load_increasing_32(volatile uint32_t *p)
33
; ---
4-
assume adl=1
4+
.assume adl=1
5+
6+
.section .text
7+
.global _atomic_load_increasing_32
8+
.type _atomic_load_increasing_32, @function
59

6-
section .text
7-
public _atomic_load_increasing_32
810
_atomic_load_increasing_32:
911
; CC: 202 + 9 * read_1_invalid + 3 * ie
1012
; Timing assumes fetching from RAM (4cc) and reading from non-RAM (3cc).
1113

1214
; Read the argument.
1315
pop hl
14-
ex (sp),iy ; iy = p
16+
ex (sp), iy ; iy = p
1517
push hl
1618
; ^ 48 cc
1719
; Temporarily disable interrupts.
18-
ld a,i
20+
ld a, i
1921
di
2022
; ^ 12 cc
2123
; Read from the pointer twice: first into cude, second into auhl.
2224
; Time between first and last byte read:
23-
ld de,(iy) ; 2R
25+
ld de, (iy) ; 2R
2426
; ^ 21 cc
2527
; 48 + 12 + 21 - 6 = 75 cc until first value captured if valid
26-
ld c,(iy+3) ; + 3F + 1R
27-
ld hl,(iy) ; + 3F + 3R
28+
ld c, (iy+3) ; + 3F + 1R
29+
ld hl, (iy) ; + 3F + 3R
2830
; ^ 36 cc
2931
; 48 + 12 + 21 + 36 - 5 = 112 cc until second value captured if valid
30-
ld a,(iy+3) ; + 3F + 1R
32+
ld a, (iy+3) ; + 3F + 1R
3133
; == 9F + 7R
3234
; == 57 cc
3335
; + 9 * 19 cc = 171 cc (worst-case DMA)
3436
; = 228 cc
3537
; ^ 15 cc
3638
; Re-enable interrupts if they were previously enabled.
37-
jp po,no_ei
39+
jp po, .L.no_ei
3840
ei
39-
no_ei:
41+
.L.no_ei:
4042
; ^ 17 + 3 * ie cc
4143
; Compare and return the lesser of the two values read.
4244
;
@@ -81,24 +83,24 @@ no_ei:
8183
;
8284
; Combining all of these cases and assumptions, the lesser of the two values
8385
; read will always be valid.
84-
or a,a
85-
sbc hl,de
86-
sbc a,c ; auhl = second value read
86+
or a, a
87+
sbc hl, de
88+
sbc a, c ; auhl = second value read
8789
; - first value read
8890
; ^ 16 cc
89-
jr c,no_swap
91+
jr c, .L.no_swap
9092
; second value read >= first value read
9193
; ==> first value read is valid
92-
ex de,hl
93-
ld e,c ; euhl = first value read
94+
ex de, hl
95+
ld e, c ; euhl = first value read
9496
ret
9597
; ^ 37 cc
9698

97-
no_swap:
99+
.L.no_swap:
98100
; second value read < first value read
99101
; ==> second value read is valid
100-
add hl,de
101-
adc a,c
102-
ld e,a ; euhl = second value read
102+
add hl, de
103+
adc a, c
104+
ld e, a ; euhl = second value read
103105
ret
104-
; ^ 46 cc (including conditional jr into)
106+
; ^ 46 cc (including conditional jr into)

src/ce/boot_sprintf.src

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
assume adl=1
1+
.assume adl=1
22

3-
section .text
3+
.section .text
44

55
; to reduce binary size (or performance in the case of sprintf), ti's routines
66
; can be linked instead of the toolchain's routines
77

8-
public _boot_sprintf
9-
_boot_sprintf := 0000BCh
8+
.global _boot_sprintf
9+
.type _boot_sprintf, @function
10+
.set _boot_sprintf, 0x0000BC

src/ce/debug.src

Lines changed: 41 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,58 @@
1-
assume adl=1
1+
.assume adl=1
2+
3+
.section .text
4+
.global _dbg_Debugger
5+
.type _dbg_Debugger, @function
26

3-
section .text
4-
public _dbg_Debugger
57
_dbg_Debugger:
68
scf
79
sbc hl,hl
810
ld (hl),2
911
ret
1012

11-
section .text
12-
public _dbg_WatchpointSet
13+
.section .text
14+
.global _dbg_WatchpointSet
15+
.type _dbg_WatchpointSet, @function
16+
1317
_dbg_WatchpointSet:
1418
; currently have to do stupid stuff until CEmu is updated to be less dumb
15-
ld iy,0
16-
add iy,sp
19+
ld iy, 0
20+
add iy, sp
1721
scf
18-
sbc hl,hl
19-
ld de,(iy + 3) ; addr
20-
ld bc,(iy + 6) ; size (must be 1 right now)
21-
ld a,(iy + 9) ; mask
22-
ld (hl),8
23-
ld (hl),4
24-
or a,a ; 0 = remove
22+
sbc hl, hl
23+
ld de, (iy + 3) ; addr
24+
ld bc, (iy + 6) ; size (must be 1 right now)
25+
ld a, (iy + 9) ; mask
26+
ld (hl), 8
27+
ld (hl), 4
28+
or a, a ; 0 = remove
2529
ret z
26-
bit 0,a ; read
27-
jr z,.noread
28-
bit 1,a ; write
29-
jr z,.noreadwrite
30-
ld (hl),7
31-
jr .checkexecute
32-
.noreadwrite:
33-
ld (hl),5
34-
jr .checkexecute
35-
.noread:
36-
bit 1,a ; write
37-
jr z,.checkexecute
38-
ld (hl),6
39-
.checkexecute:
40-
bit 2,a ; execute
30+
bit 0, a ; read
31+
jr z, .L.noread
32+
bit 1, a ; write
33+
jr z, .L.noreadwrite
34+
ld (hl), 7
35+
jr .L.checkexecute
36+
.L.noreadwrite:
37+
ld (hl), 5
38+
jr .L.checkexecute
39+
.L.noread:
40+
bit 1, a ; write
41+
jr z, .L.checkexecute
42+
ld (hl), 6
43+
.L.checkexecute:
44+
bit 2, a ; execute
4145
ret z
42-
ld (hl),3
46+
ld (hl), 3
4347
ret
4448

45-
section .text
46-
public _dbg_WatchpointRemoveAll
49+
.section .text
50+
.global _dbg_WatchpointRemoveAll
51+
.type _dbg_WatchpointRemoveAll, @function
52+
4753
_dbg_WatchpointRemoveAll:
4854
scf
49-
sbc hl,hl
50-
ld (hl),9
51-
ld (hl),10
55+
sbc hl, hl
56+
ld (hl), 9
57+
ld (hl), 10
5258
ret

0 commit comments

Comments
 (0)