Skip to content

Commit b1d829d

Browse files
committed
Update tests
1 parent 2d70afa commit b1d829d

3 files changed

Lines changed: 58 additions & 58 deletions

File tree

tests/functional/mcleod.asm

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,9 @@ __END_PROGRAM:
4747
ret
4848
__CALL_BACK__:
4949
DEFW 0
50-
#line 1 "ftou32reg.asm"
51-
#line 1 "neg32.asm"
50+
;; --- end of user code ---
51+
#line 1 "/zxbasic/src/arch/zx48k/library-asm/ftou32reg.asm"
52+
#line 1 "/zxbasic/src/arch/zx48k/library-asm/neg32.asm"
5253
__ABS32:
5354
bit 7, d
5455
ret z
@@ -71,7 +72,7 @@ __NEG32: ; Negates DEHL (Two's complement)
7172
ret nz
7273
inc de
7374
ret
74-
#line 2 "ftou32reg.asm"
75+
#line 2 "/zxbasic/src/arch/zx48k/library-asm/ftou32reg.asm"
7576
__FTOU32REG: ; Converts a Float to (un)signed 32 bit integer (NOTE: It's ALWAYS 32 bit signed)
7677
; Input FP number in A EDCB (A exponent, EDCB mantissa)
7778
; Output: DEHL 32 bit number (signed)
@@ -144,9 +145,9 @@ __FTOU8: ; Converts float in C ED LH to Unsigned byte in A
144145
call __FTOU32REG
145146
ld a, l
146147
ret
147-
#line 29 "mcleod.bas"
148-
#line 1 "mulf.asm"
149-
#line 1 "stackf.asm"
148+
#line 30 "mcleod.bas"
149+
#line 1 "/zxbasic/src/arch/zx48k/library-asm/mulf.asm"
150+
#line 1 "/zxbasic/src/arch/zx48k/library-asm/stackf.asm"
150151
; -------------------------------------------------------------
151152
; Functions to manage FP-Stack of the ZX Spectrum ROM CALC
152153
; -------------------------------------------------------------
@@ -183,7 +184,7 @@ __FPSTACK_I16: ; Pushes 16 bits integer in HL into the FP ROM STACK
183184
xor a
184185
ld b, a
185186
jp __FPSTACK_PUSH
186-
#line 2 "mulf.asm"
187+
#line 2 "/zxbasic/src/arch/zx48k/library-asm/mulf.asm"
187188
; -------------------------------------------------------------
188189
; Floating point library using the FP ROM Calculator (ZX 48K)
189190
; All of them uses A EDCB registers as 1st paramter.
@@ -199,8 +200,8 @@ __MULF: ; Multiplication
199200
defb 04h ;
200201
defb 38h; ; END CALC
201202
jp __FPSTACK_POP
202-
#line 30 "mcleod.bas"
203-
#line 1 "random.asm"
203+
#line 31 "mcleod.bas"
204+
#line 1 "/zxbasic/src/arch/zx48k/library-asm/random.asm"
204205
; RANDOM functions
205206
RANDOMIZE:
206207
; Randomize with 32 bit seed in DE HL
@@ -225,8 +226,8 @@ TAKE_FRAMES:
225226
ret
226227
FRAMES EQU 23672
227228
ENDP
228-
RANDOM_SEED_HIGH EQU RAND+6 ; RANDOM seed, 16 higher bits
229-
RANDOM_SEED_LOW EQU 23670 ; RANDOM seed, 16 lower bits
229+
RANDOM_SEED_HIGH EQU RAND+6 ; RANDOM seed, 16 higher bits
230+
RANDOM_SEED_LOW EQU 23670 ; RANDOM seed, 16 lower bits
230231
RAND:
231232
PROC
232233
LOCAL RAND_LOOP
@@ -248,18 +249,17 @@ RAND_LOOP:
248249
rra ; t = t ^ (t >> 1) ^ w
249250
xor d
250251
xor e
251-
ld h,l ; y = z
252-
ld l,a ; w = t
253-
ld (RANDOM_SEED_HIGH),hl
252+
ld d,l ; y = z
253+
ld e,a ; w = t
254+
ld (RANDOM_SEED_HIGH),de
254255
push af
255256
djnz RAND_LOOP
256-
pop af
257-
pop af
258-
ld d, a
257+
pop de
259258
pop af
260259
ld e, a
260+
pop hl
261261
pop af
262-
ld h, a
262+
ld l, a
263263
ret
264264
ENDP
265265
RND:
@@ -278,7 +278,7 @@ RND:
278278
ret z ; Returns 0 if BC=DE=0
279279
; We already have a random 32 bit mantissa in ED CB
280280
; From 0001h to FFFFh
281-
ld l, 81h ; Exponent
281+
ld l, 81h ; Exponent
282282
; At this point we have [0 .. 1) FP number;
283283
; Now we must shift mantissa left until highest bit goes into carry
284284
ld a, e ; Use A register for rotating E faster (using RLA instead of RL E)
@@ -299,5 +299,5 @@ RND_LOOP:
299299
ld a, l ; exponent in A
300300
ret
301301
ENDP
302-
#line 31 "mcleod.bas"
302+
#line 32 "mcleod.bas"
303303
END

tests/functional/opt4_keepix.asm

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,9 @@ _test__leave:
7070
ld sp, ix
7171
pop ix
7272
ret
73-
#line 1 "addf.asm"
74-
#line 1 "stackf.asm"
73+
;; --- end of user code ---
74+
#line 1 "/zxbasic/src/arch/zx48k/library-asm/addf.asm"
75+
#line 1 "/zxbasic/src/arch/zx48k/library-asm/stackf.asm"
7576
; -------------------------------------------------------------
7677
; Functions to manage FP-Stack of the ZX Spectrum ROM CALC
7778
; -------------------------------------------------------------
@@ -108,7 +109,7 @@ __FPSTACK_I16: ; Pushes 16 bits integer in HL into the FP ROM STACK
108109
xor a
109110
ld b, a
110111
jp __FPSTACK_PUSH
111-
#line 2 "addf.asm"
112+
#line 2 "/zxbasic/src/arch/zx48k/library-asm/addf.asm"
112113
; -------------------------------------------------------------
113114
; Floating point library using the FP ROM Calculator (ZX 48K)
114115
; All of them uses A EDCB registers as 1st paramter.
@@ -124,8 +125,8 @@ __ADDF: ; Addition
124125
defb 0fh ; ADD
125126
defb 38h; ; END CALC
126127
jp __FPSTACK_POP
127-
#line 54 "opt4_keepix.bas"
128-
#line 1 "mulf.asm"
128+
#line 55 "opt4_keepix.bas"
129+
#line 1 "/zxbasic/src/arch/zx48k/library-asm/mulf.asm"
129130
; -------------------------------------------------------------
130131
; Floating point library using the FP ROM Calculator (ZX 48K)
131132
; All of them uses A EDCB registers as 1st paramter.
@@ -141,13 +142,13 @@ __MULF: ; Multiplication
141142
defb 04h ;
142143
defb 38h; ; END CALC
143144
jp __FPSTACK_POP
144-
#line 55 "opt4_keepix.bas"
145-
#line 1 "ploadf.asm"
145+
#line 56 "opt4_keepix.bas"
146+
#line 1 "/zxbasic/src/arch/zx48k/library-asm/ploadf.asm"
146147
; Parameter / Local var load
147148
; A => Offset
148149
; IX = Stack Frame
149150
; RESULT: HL => IX + DE
150-
#line 1 "iloadf.asm"
151+
#line 1 "/zxbasic/src/arch/zx48k/library-asm/iloadf.asm"
151152
; __FASTCALL__ routine which
152153
; loads a 40 bits floating point into A ED CB
153154
; stored at position pointed by POINTER HL
@@ -172,19 +173,19 @@ __LOADF: ; Loads a 40 bits FP number from address pointed by HL
172173
inc hl
173174
ld b, (hl)
174175
ret
175-
#line 7 "ploadf.asm"
176+
#line 7 "/zxbasic/src/arch/zx48k/library-asm/ploadf.asm"
176177
__PLOADF:
177178
push ix
178179
pop hl
179180
add hl, de
180181
jp __LOADF
181-
#line 56 "opt4_keepix.bas"
182-
#line 1 "pstoref.asm"
182+
#line 57 "opt4_keepix.bas"
183+
#line 1 "/zxbasic/src/arch/zx48k/library-asm/pstoref.asm"
183184
; Stores FP number in A ED CB at location HL+IX
184185
; HL = Offset
185186
; IX = Stack Frame
186187
; A ED CB = FP Number
187-
#line 1 "storef.asm"
188+
#line 1 "/zxbasic/src/arch/zx48k/library-asm/storef.asm"
188189
__PISTOREF: ; Indect Stores a float (A, E, D, C, B) at location stored in memory, pointed by (IX + HL)
189190
push de
190191
ex de, hl ; DE <- HL
@@ -210,7 +211,7 @@ __STOREF: ; Stores the given FP number in A EDCB at address HL
210211
inc hl
211212
ld (hl), b
212213
ret
213-
#line 7 "pstoref.asm"
214+
#line 7 "/zxbasic/src/arch/zx48k/library-asm/pstoref.asm"
214215
; Stored a float number in A ED CB into the address pointed by IX + HL
215216
__PSTOREF:
216217
push de
@@ -220,8 +221,8 @@ __PSTOREF:
220221
add hl, de ; HL <- IX + DE
221222
pop de
222223
jp __STOREF
223-
#line 57 "opt4_keepix.bas"
224-
#line 1 "random.asm"
224+
#line 58 "opt4_keepix.bas"
225+
#line 1 "/zxbasic/src/arch/zx48k/library-asm/random.asm"
225226
; RANDOM functions
226227
RANDOMIZE:
227228
; Randomize with 32 bit seed in DE HL
@@ -246,8 +247,8 @@ TAKE_FRAMES:
246247
ret
247248
FRAMES EQU 23672
248249
ENDP
249-
RANDOM_SEED_HIGH EQU RAND+6 ; RANDOM seed, 16 higher bits
250-
RANDOM_SEED_LOW EQU 23670 ; RANDOM seed, 16 lower bits
250+
RANDOM_SEED_HIGH EQU RAND+6 ; RANDOM seed, 16 higher bits
251+
RANDOM_SEED_LOW EQU 23670 ; RANDOM seed, 16 lower bits
251252
RAND:
252253
PROC
253254
LOCAL RAND_LOOP
@@ -269,18 +270,17 @@ RAND_LOOP:
269270
rra ; t = t ^ (t >> 1) ^ w
270271
xor d
271272
xor e
272-
ld h,l ; y = z
273-
ld l,a ; w = t
274-
ld (RANDOM_SEED_HIGH),hl
273+
ld d,l ; y = z
274+
ld e,a ; w = t
275+
ld (RANDOM_SEED_HIGH),de
275276
push af
276277
djnz RAND_LOOP
277-
pop af
278-
pop af
279-
ld d, a
278+
pop de
280279
pop af
281280
ld e, a
281+
pop hl
282282
pop af
283-
ld h, a
283+
ld l, a
284284
ret
285285
ENDP
286286
RND:
@@ -299,7 +299,7 @@ RND:
299299
ret z ; Returns 0 if BC=DE=0
300300
; We already have a random 32 bit mantissa in ED CB
301301
; From 0001h to FFFFh
302-
ld l, 81h ; Exponent
302+
ld l, 81h ; Exponent
303303
; At this point we have [0 .. 1) FP number;
304304
; Now we must shift mantissa left until highest bit goes into carry
305305
ld a, e ; Use A register for rotating E faster (using RLA instead of RL E)
@@ -320,5 +320,5 @@ RND_LOOP:
320320
ld a, l ; exponent in A
321321
ret
322322
ENDP
323-
#line 58 "opt4_keepix.bas"
323+
#line 59 "opt4_keepix.bas"
324324
END

tests/functional/randomize.asm

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ __END_PROGRAM:
4040
ret
4141
__CALL_BACK__:
4242
DEFW 0
43-
#line 1 "random.asm"
43+
;; --- end of user code ---
44+
#line 1 "/zxbasic/src/arch/zx48k/library-asm/random.asm"
4445
; RANDOM functions
4546
RANDOMIZE:
4647
; Randomize with 32 bit seed in DE HL
@@ -65,8 +66,8 @@ TAKE_FRAMES:
6566
ret
6667
FRAMES EQU 23672
6768
ENDP
68-
RANDOM_SEED_HIGH EQU RAND+6 ; RANDOM seed, 16 higher bits
69-
RANDOM_SEED_LOW EQU 23670 ; RANDOM seed, 16 lower bits
69+
RANDOM_SEED_HIGH EQU RAND+6 ; RANDOM seed, 16 higher bits
70+
RANDOM_SEED_LOW EQU 23670 ; RANDOM seed, 16 lower bits
7071
RAND:
7172
PROC
7273
LOCAL RAND_LOOP
@@ -88,18 +89,17 @@ RAND_LOOP:
8889
rra ; t = t ^ (t >> 1) ^ w
8990
xor d
9091
xor e
91-
ld h,l ; y = z
92-
ld l,a ; w = t
93-
ld (RANDOM_SEED_HIGH),hl
92+
ld d,l ; y = z
93+
ld e,a ; w = t
94+
ld (RANDOM_SEED_HIGH),de
9495
push af
9596
djnz RAND_LOOP
96-
pop af
97-
pop af
98-
ld d, a
97+
pop de
9998
pop af
10099
ld e, a
100+
pop hl
101101
pop af
102-
ld h, a
102+
ld l, a
103103
ret
104104
ENDP
105105
RND:
@@ -118,7 +118,7 @@ RND:
118118
ret z ; Returns 0 if BC=DE=0
119119
; We already have a random 32 bit mantissa in ED CB
120120
; From 0001h to FFFFh
121-
ld l, 81h ; Exponent
121+
ld l, 81h ; Exponent
122122
; At this point we have [0 .. 1) FP number;
123123
; Now we must shift mantissa left until highest bit goes into carry
124124
ld a, e ; Use A register for rotating E faster (using RLA instead of RL E)
@@ -139,5 +139,5 @@ RND_LOOP:
139139
ld a, l ; exponent in A
140140
ret
141141
ENDP
142-
#line 24 "randomize.bas"
142+
#line 25 "randomize.bas"
143143
END

0 commit comments

Comments
 (0)