Skip to content

Commit 0b8dc9f

Browse files
committed
test: update tests for arith operators
1 parent 7adbea1 commit 0b8dc9f

6 files changed

Lines changed: 61 additions & 4 deletions

File tree

tests/functional/arch/zx48k/divu8.asm

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,23 @@ _b:
5151
ld hl, (_a - 1)
5252
call .core.__DIVU8_FAST
5353
ld (_b), a
54+
ld hl, (_a - 1)
55+
ld a, (_a)
56+
sub h
57+
sub 1
58+
sbc a, a
59+
neg
60+
push af
61+
ld hl, (_a - 1)
62+
ld a, (_a)
63+
sub h
64+
sub 1
65+
sbc a, a
66+
neg
67+
ld h, a
68+
pop af
69+
call .core.__DIVU8_FAST
70+
ld (_b), a
5471
ld hl, 0
5572
ld b, h
5673
ld c, l
@@ -66,7 +83,7 @@ _b:
6683
ei
6784
ret
6885
;; --- end of user code ---
69-
#line 1 "/zxbasic/src/arch/zx48k/library-asm/div8.asm"
86+
#line 1 "/zxbasic/src/lib/arch/zx48k/runtime/arith/div8.asm"
7087
; --------------------------------
7188
push namespace core
7289
__DIVU8: ; 8 bit unsigned integer division
@@ -131,5 +148,5 @@ __MODI8_FAST: ; __FASTCALL__ entry
131148
ld a, l ; remainder
132149
ret ; a = Modulus
133150
pop namespace
134-
#line 44 "divu8.bas"
151+
#line 61 "arch/zx48k/divu8.bas"
135152
END

tests/functional/arch/zx48k/divu8.bas

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@ b = 1 / a
1111
b = 2 / a
1212
b = 4 / a
1313
b = a / a
14+
b = (a = a) / (a = a)
15+

tests/functional/arch/zx48k/mul8.asm

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,23 @@ _b:
5252
ld a, (_a)
5353
call .core.__MUL8_FAST
5454
ld (_b), a
55+
ld hl, (_a - 1)
56+
ld a, (_a)
57+
sub h
58+
sub 1
59+
sbc a, a
60+
neg
61+
push af
62+
ld hl, (_a - 1)
63+
ld a, (_a)
64+
sub h
65+
sub 1
66+
sbc a, a
67+
neg
68+
ld h, a
69+
pop af
70+
call .core.__MUL8_FAST
71+
ld (_b), a
5572
ld hl, 0
5673
ld b, h
5774
ld c, l
@@ -67,7 +84,7 @@ _b:
6784
ei
6885
ret
6986
;; --- end of user code ---
70-
#line 1 "/zxbasic/src/arch/zx48k/library-asm/mul8.asm"
87+
#line 1 "/zxbasic/src/lib/arch/zx48k/runtime/arith/mul8.asm"
7188
push namespace core
7289
__MUL8: ; Performs 8bit x 8bit multiplication
7390
PROC
@@ -113,5 +130,5 @@ __MUL8B:
113130
ret ; result = HL
114131
ENDP
115132
pop namespace
116-
#line 45 "mul8.bas"
133+
#line 62 "arch/zx48k/mul8.bas"
117134
END

tests/functional/arch/zx48k/mul8.bas

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,5 @@ b = 1 * a
1212
b = 2 * a
1313
b = 4 * a
1414
b = a * a
15+
b = (a = a) * (a = a)
16+

tests/functional/arch/zx48k/sub8.asm

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,23 @@ _b:
4040
ld hl, (_a - 1)
4141
sub h
4242
ld (_b), a
43+
ld hl, (_a - 1)
44+
ld a, (_a)
45+
sub h
46+
sub 1
47+
sbc a, a
48+
neg
49+
push af
50+
ld hl, (_a - 1)
51+
ld a, (_a)
52+
sub h
53+
sub 1
54+
sbc a, a
55+
neg
56+
ld h, a
57+
pop af
58+
sub h
59+
ld (_b), a
4360
ld hl, 0
4461
ld b, h
4562
ld c, l

tests/functional/arch/zx48k/sub8.bas

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,5 @@ b = a - 1
88
b = 0 - a
99
b = 1 - a
1010
b = a - a
11+
b = (a = a) - (a = a)
12+

0 commit comments

Comments
 (0)