diff --git a/src/arch/zx48k/library-asm/random.asm b/src/arch/zx48k/library-asm/random.asm index 03d01e1de..27094e761 100644 --- a/src/arch/zx48k/library-asm/random.asm +++ b/src/arch/zx48k/library-asm/random.asm @@ -29,8 +29,8 @@ TAKE_FRAMES: FRAMES EQU 23672 ENDP -RANDOM_SEED_HIGH EQU RAND+6 ; RANDOM seed, 16 higher bits -RANDOM_SEED_LOW EQU 23670 ; RANDOM seed, 16 lower bits +RANDOM_SEED_HIGH EQU RAND+6 ; RANDOM seed, 16 higher bits +RANDOM_SEED_LOW EQU 23670 ; RANDOM seed, 16 lower bits RAND: @@ -54,18 +54,17 @@ RAND_LOOP: rra ; t = t ^ (t >> 1) ^ w xor d xor e - ld h,l ; y = z - ld l,a ; w = t - ld (RANDOM_SEED_HIGH),hl + ld d,l ; y = z + ld e,a ; w = t + ld (RANDOM_SEED_HIGH),de push af djnz RAND_LOOP - pop af - pop af - ld d, a + pop de pop af ld e, a + pop hl pop af - ld h, a + ld l, a ret ENDP @@ -89,7 +88,7 @@ RND: ; We already have a random 32 bit mantissa in ED CB ; From 0001h to FFFFh - ld l, 81h ; Exponent + ld l, 81h ; Exponent ; At this point we have [0 .. 1) FP number; ; Now we must shift mantissa left until highest bit goes into carry diff --git a/tests/functional/mcleod.asm b/tests/functional/mcleod.asm index 254c9e08c..00e136752 100644 --- a/tests/functional/mcleod.asm +++ b/tests/functional/mcleod.asm @@ -47,8 +47,9 @@ __END_PROGRAM: ret __CALL_BACK__: DEFW 0 -#line 1 "ftou32reg.asm" -#line 1 "neg32.asm" + ;; --- end of user code --- +#line 1 "/zxbasic/src/arch/zx48k/library-asm/ftou32reg.asm" +#line 1 "/zxbasic/src/arch/zx48k/library-asm/neg32.asm" __ABS32: bit 7, d ret z @@ -71,7 +72,7 @@ __NEG32: ; Negates DEHL (Two's complement) ret nz inc de ret -#line 2 "ftou32reg.asm" +#line 2 "/zxbasic/src/arch/zx48k/library-asm/ftou32reg.asm" __FTOU32REG: ; Converts a Float to (un)signed 32 bit integer (NOTE: It's ALWAYS 32 bit signed) ; Input FP number in A EDCB (A exponent, EDCB mantissa) ; Output: DEHL 32 bit number (signed) @@ -144,9 +145,9 @@ __FTOU8: ; Converts float in C ED LH to Unsigned byte in A call __FTOU32REG ld a, l ret -#line 29 "mcleod.bas" -#line 1 "mulf.asm" -#line 1 "stackf.asm" +#line 30 "mcleod.bas" +#line 1 "/zxbasic/src/arch/zx48k/library-asm/mulf.asm" +#line 1 "/zxbasic/src/arch/zx48k/library-asm/stackf.asm" ; ------------------------------------------------------------- ; Functions to manage FP-Stack of the ZX Spectrum ROM CALC ; ------------------------------------------------------------- @@ -183,7 +184,7 @@ __FPSTACK_I16: ; Pushes 16 bits integer in HL into the FP ROM STACK xor a ld b, a jp __FPSTACK_PUSH -#line 2 "mulf.asm" +#line 2 "/zxbasic/src/arch/zx48k/library-asm/mulf.asm" ; ------------------------------------------------------------- ; Floating point library using the FP ROM Calculator (ZX 48K) ; All of them uses A EDCB registers as 1st paramter. @@ -199,8 +200,8 @@ __MULF: ; Multiplication defb 04h ; defb 38h; ; END CALC jp __FPSTACK_POP -#line 30 "mcleod.bas" -#line 1 "random.asm" +#line 31 "mcleod.bas" +#line 1 "/zxbasic/src/arch/zx48k/library-asm/random.asm" ; RANDOM functions RANDOMIZE: ; Randomize with 32 bit seed in DE HL @@ -225,8 +226,8 @@ TAKE_FRAMES: ret FRAMES EQU 23672 ENDP - RANDOM_SEED_HIGH EQU RAND+6 ; RANDOM seed, 16 higher bits - RANDOM_SEED_LOW EQU 23670 ; RANDOM seed, 16 lower bits + RANDOM_SEED_HIGH EQU RAND+6 ; RANDOM seed, 16 higher bits + RANDOM_SEED_LOW EQU 23670 ; RANDOM seed, 16 lower bits RAND: PROC LOCAL RAND_LOOP @@ -248,18 +249,17 @@ RAND_LOOP: rra ; t = t ^ (t >> 1) ^ w xor d xor e - ld h,l ; y = z - ld l,a ; w = t - ld (RANDOM_SEED_HIGH),hl + ld d,l ; y = z + ld e,a ; w = t + ld (RANDOM_SEED_HIGH),de push af djnz RAND_LOOP - pop af - pop af - ld d, a + pop de pop af ld e, a + pop hl pop af - ld h, a + ld l, a ret ENDP RND: @@ -278,7 +278,7 @@ RND: ret z ; Returns 0 if BC=DE=0 ; We already have a random 32 bit mantissa in ED CB ; From 0001h to FFFFh - ld l, 81h ; Exponent + ld l, 81h ; Exponent ; At this point we have [0 .. 1) FP number; ; Now we must shift mantissa left until highest bit goes into carry ld a, e ; Use A register for rotating E faster (using RLA instead of RL E) @@ -299,5 +299,5 @@ RND_LOOP: ld a, l ; exponent in A ret ENDP -#line 31 "mcleod.bas" +#line 32 "mcleod.bas" END diff --git a/tests/functional/opt4_keepix.asm b/tests/functional/opt4_keepix.asm index 386093806..58abba1a5 100644 --- a/tests/functional/opt4_keepix.asm +++ b/tests/functional/opt4_keepix.asm @@ -70,8 +70,9 @@ _test__leave: ld sp, ix pop ix ret -#line 1 "addf.asm" -#line 1 "stackf.asm" + ;; --- end of user code --- +#line 1 "/zxbasic/src/arch/zx48k/library-asm/addf.asm" +#line 1 "/zxbasic/src/arch/zx48k/library-asm/stackf.asm" ; ------------------------------------------------------------- ; Functions to manage FP-Stack of the ZX Spectrum ROM CALC ; ------------------------------------------------------------- @@ -108,7 +109,7 @@ __FPSTACK_I16: ; Pushes 16 bits integer in HL into the FP ROM STACK xor a ld b, a jp __FPSTACK_PUSH -#line 2 "addf.asm" +#line 2 "/zxbasic/src/arch/zx48k/library-asm/addf.asm" ; ------------------------------------------------------------- ; Floating point library using the FP ROM Calculator (ZX 48K) ; All of them uses A EDCB registers as 1st paramter. @@ -124,8 +125,8 @@ __ADDF: ; Addition defb 0fh ; ADD defb 38h; ; END CALC jp __FPSTACK_POP -#line 54 "opt4_keepix.bas" -#line 1 "mulf.asm" +#line 55 "opt4_keepix.bas" +#line 1 "/zxbasic/src/arch/zx48k/library-asm/mulf.asm" ; ------------------------------------------------------------- ; Floating point library using the FP ROM Calculator (ZX 48K) ; All of them uses A EDCB registers as 1st paramter. @@ -141,13 +142,13 @@ __MULF: ; Multiplication defb 04h ; defb 38h; ; END CALC jp __FPSTACK_POP -#line 55 "opt4_keepix.bas" -#line 1 "ploadf.asm" +#line 56 "opt4_keepix.bas" +#line 1 "/zxbasic/src/arch/zx48k/library-asm/ploadf.asm" ; Parameter / Local var load ; A => Offset ; IX = Stack Frame ; RESULT: HL => IX + DE -#line 1 "iloadf.asm" +#line 1 "/zxbasic/src/arch/zx48k/library-asm/iloadf.asm" ; __FASTCALL__ routine which ; loads a 40 bits floating point into A ED CB ; stored at position pointed by POINTER HL @@ -172,19 +173,19 @@ __LOADF: ; Loads a 40 bits FP number from address pointed by HL inc hl ld b, (hl) ret -#line 7 "ploadf.asm" +#line 7 "/zxbasic/src/arch/zx48k/library-asm/ploadf.asm" __PLOADF: push ix pop hl add hl, de jp __LOADF -#line 56 "opt4_keepix.bas" -#line 1 "pstoref.asm" +#line 57 "opt4_keepix.bas" +#line 1 "/zxbasic/src/arch/zx48k/library-asm/pstoref.asm" ; Stores FP number in A ED CB at location HL+IX ; HL = Offset ; IX = Stack Frame ; A ED CB = FP Number -#line 1 "storef.asm" +#line 1 "/zxbasic/src/arch/zx48k/library-asm/storef.asm" __PISTOREF: ; Indect Stores a float (A, E, D, C, B) at location stored in memory, pointed by (IX + HL) push de ex de, hl ; DE <- HL @@ -210,7 +211,7 @@ __STOREF: ; Stores the given FP number in A EDCB at address HL inc hl ld (hl), b ret -#line 7 "pstoref.asm" +#line 7 "/zxbasic/src/arch/zx48k/library-asm/pstoref.asm" ; Stored a float number in A ED CB into the address pointed by IX + HL __PSTOREF: push de @@ -220,8 +221,8 @@ __PSTOREF: add hl, de ; HL <- IX + DE pop de jp __STOREF -#line 57 "opt4_keepix.bas" -#line 1 "random.asm" +#line 58 "opt4_keepix.bas" +#line 1 "/zxbasic/src/arch/zx48k/library-asm/random.asm" ; RANDOM functions RANDOMIZE: ; Randomize with 32 bit seed in DE HL @@ -246,8 +247,8 @@ TAKE_FRAMES: ret FRAMES EQU 23672 ENDP - RANDOM_SEED_HIGH EQU RAND+6 ; RANDOM seed, 16 higher bits - RANDOM_SEED_LOW EQU 23670 ; RANDOM seed, 16 lower bits + RANDOM_SEED_HIGH EQU RAND+6 ; RANDOM seed, 16 higher bits + RANDOM_SEED_LOW EQU 23670 ; RANDOM seed, 16 lower bits RAND: PROC LOCAL RAND_LOOP @@ -269,18 +270,17 @@ RAND_LOOP: rra ; t = t ^ (t >> 1) ^ w xor d xor e - ld h,l ; y = z - ld l,a ; w = t - ld (RANDOM_SEED_HIGH),hl + ld d,l ; y = z + ld e,a ; w = t + ld (RANDOM_SEED_HIGH),de push af djnz RAND_LOOP - pop af - pop af - ld d, a + pop de pop af ld e, a + pop hl pop af - ld h, a + ld l, a ret ENDP RND: @@ -299,7 +299,7 @@ RND: ret z ; Returns 0 if BC=DE=0 ; We already have a random 32 bit mantissa in ED CB ; From 0001h to FFFFh - ld l, 81h ; Exponent + ld l, 81h ; Exponent ; At this point we have [0 .. 1) FP number; ; Now we must shift mantissa left until highest bit goes into carry ld a, e ; Use A register for rotating E faster (using RLA instead of RL E) @@ -320,5 +320,5 @@ RND_LOOP: ld a, l ; exponent in A ret ENDP -#line 58 "opt4_keepix.bas" +#line 59 "opt4_keepix.bas" END diff --git a/tests/functional/randomize.asm b/tests/functional/randomize.asm index a8c337bac..427bb98e2 100644 --- a/tests/functional/randomize.asm +++ b/tests/functional/randomize.asm @@ -40,7 +40,8 @@ __END_PROGRAM: ret __CALL_BACK__: DEFW 0 -#line 1 "random.asm" + ;; --- end of user code --- +#line 1 "/zxbasic/src/arch/zx48k/library-asm/random.asm" ; RANDOM functions RANDOMIZE: ; Randomize with 32 bit seed in DE HL @@ -65,8 +66,8 @@ TAKE_FRAMES: ret FRAMES EQU 23672 ENDP - RANDOM_SEED_HIGH EQU RAND+6 ; RANDOM seed, 16 higher bits - RANDOM_SEED_LOW EQU 23670 ; RANDOM seed, 16 lower bits + RANDOM_SEED_HIGH EQU RAND+6 ; RANDOM seed, 16 higher bits + RANDOM_SEED_LOW EQU 23670 ; RANDOM seed, 16 lower bits RAND: PROC LOCAL RAND_LOOP @@ -88,18 +89,17 @@ RAND_LOOP: rra ; t = t ^ (t >> 1) ^ w xor d xor e - ld h,l ; y = z - ld l,a ; w = t - ld (RANDOM_SEED_HIGH),hl + ld d,l ; y = z + ld e,a ; w = t + ld (RANDOM_SEED_HIGH),de push af djnz RAND_LOOP - pop af - pop af - ld d, a + pop de pop af ld e, a + pop hl pop af - ld h, a + ld l, a ret ENDP RND: @@ -118,7 +118,7 @@ RND: ret z ; Returns 0 if BC=DE=0 ; We already have a random 32 bit mantissa in ED CB ; From 0001h to FFFFh - ld l, 81h ; Exponent + ld l, 81h ; Exponent ; At this point we have [0 .. 1) FP number; ; Now we must shift mantissa left until highest bit goes into carry ld a, e ; Use A register for rotating E faster (using RLA instead of RL E) @@ -139,5 +139,5 @@ RND_LOOP: ld a, l ; exponent in A ret ENDP -#line 24 "randomize.bas" +#line 25 "randomize.bas" END