Skip to content

Commit 7de27b6

Browse files
ZERICO2005adriweb
authored andcommitted
cleaned up code for ineg/inot and added timings
1 parent afded7e commit 7de27b6

File tree

4 files changed

+12
-14
lines changed

4 files changed

+12
-14
lines changed

src/crt/ineg.src

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,19 @@ __ineg := 000160h
1010
else
1111

1212
__ineg:
13-
if 0
14-
push de
15-
end if
13+
; UHL = -UHL
14+
; CC: 10*r(PC)+3*r(SPL)+1
15+
; CC: 9 bytes | 10F + 3R + 1
1616
add hl, de ; uhl=UHL+UDE
1717
ex de, hl ; ude=UHL+UDE, uhl=UDE
1818
or a, a
1919
sbc hl, de ; uhl=UDE-(UHL+UDE)
2020
; =UDE-UHL-UDE
2121
; =-UHL
22-
if 0
23-
pop de
24-
else
2522
ex de, hl ; ude=-UHL, uhl=UHL+UDE
2623
add hl, de ; uhl=UHL+UDE+-UHL
2724
; =UDE
2825
ex de, hl ; ude=UDE, uhl=-UHL
29-
end if
3026
ret
3127

3228
end if

src/crt/ineg_fast.src

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
section .text
44
public __ineg_fast
55
__ineg_fast:
6+
; UHL = -UHL
7+
; CC: 7*r(PC)+3*r(SPL)+1
8+
; CC: 6 bytes | 7F + 3R + 1
69
add hl, de ; uhl=UHL+UDE
710
ex de, hl ; ude=UHL+UDE, uhl=UDE
811
or a, a

src/crt/inot.src

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,23 @@ __inot := 000164h
1010
else
1111

1212
__inot:
13-
if 0
14-
push de
15-
end if
13+
; UHL = ~UHL
14+
; CC: 11*r(PC)+3*r(SPL)+1
15+
; CC: 10 bytes | 11F + 3R + 1
1616
add hl, de ; uhl=UHL+UDE
1717
ex de, hl ; ude=UHL+UDE, uhl=UDE
1818
scf
1919
sbc hl, de ; uhl=UDE-(UHL+UDE)-1
2020
; =UDE-UHL-UDE-1
2121
; =-UHL-1
2222
; =~UHL
23-
if 0
24-
pop de
25-
else
2623
ex de, hl ; ude=~UHL, uhl=UHL+UDE
2724
add hl, de ; uhl=UHL+UDE+~UHL
2825
; =UHL+UDE+(-UHL-1)
2926
; =UHL+UDE-UHL-1
3027
; =UDE-1
3128
inc hl ; uhl=UDE
3229
ex de, hl ; ude=UDE, uhl=~UHL
33-
end if
3430
ret
3531

3632
end if

src/crt/inot_fast.src

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
section .text
44
public __inot_fast
55
__inot_fast:
6+
; UHL = ~UHL
7+
; CC: 7*r(PC)+3*r(SPL)+1
8+
; CC: 6 bytes | 7F + 3R + 1
69
add hl, de ; uhl=UHL+UDE
710
ex de, hl ; ude=UHL+UDE, uhl=UDE
811
scf

0 commit comments

Comments
 (0)