Commits

Jose Rodriguez committed 9b1c449

Test updated.
Many tests updated to reflect FP stack scheme.

  • Participants
  • Parent commits 0d0998e

Comments (0)

Files changed (10)

tests/codecrash2.asm

 		ld c, (hl)
 		inc hl
 		ld b, (hl)
-		inc hl
 	
 		ld a, b
 		or c
 		jr z, __ASC_END		; No length? return
 	
+		inc hl
 		ld a, (hl)
+	    dec hl
 		
 __ASC_END:
 		dec hl
-		dec hl
 		ex af, af'
 		or a
 		call nz, __MEM_FREE	; Free memory if needed

tests/coercion1.asm

 	call __FTOU32REG
 	ld a, l
 	call BORDER
-	ld hl, (_a + 3)
-	push hl
-	ld hl, (_a + 1)
-	push hl
-	ld a, (_a)
-	push af
+	ld hl, _a + 4
+	call __FP_PUSH_REV
 	ld a, 083h
 	ld de, 00020h
 	ld bc, 00000h
 __FPSTACK_PUSH2: ; Pushes Current A ED CB registers and top of the stack on (SP + 4)
 	                 ; Second argument to push into the stack calculator is popped out of the stack
 	                 ; Since the caller routine also receives the parameters into the top of the stack
-	                 ; For bytes must be removed from SP before pop them out
+	                 ; four bytes must be removed from SP before pop them out
 	
 	    call __FPSTACK_PUSH ; Pushes A ED CB into the FP-STACK
 	    exx
 	
 		jp __FPSTACK_POP
 	
-#line 63 "coercion1.bas"
+#line 59 "coercion1.bas"
 #line 1 "mulf.asm"
 	
 	
 	
 		jp __FPSTACK_POP
 	
-#line 64 "coercion1.bas"
+#line 60 "coercion1.bas"
 #line 1 "mul8.asm"
 __MUL8:		; Performs 8bit x 8bit multiplication
 		PROC
 		ret		; result = HL
 		ENDP
 	
-#line 65 "coercion1.bas"
+#line 61 "coercion1.bas"
 #line 1 "divf.asm"
 	
 #line 1 "error.asm"
 	
 		ENDP
 	
-#line 66 "coercion1.bas"
+#line 62 "coercion1.bas"
 #line 1 "border.asm"
 	; __FASTCALL__ Routine to change de border
 	; Parameter (color) specified in A register
 	
 	; Nothing to do! (Directly from the ZX Spectrum ROM)
 	
-#line 67 "coercion1.bas"
+#line 63 "coercion1.bas"
 #line 1 "ftou32reg.asm"
 #line 1 "neg32.asm"
 __ABS32:
 		ld a, l
 		ret
 	
-#line 68 "coercion1.bas"
+#line 64 "coercion1.bas"
+#line 1 "pushf.asm"
+	
+	; Routine to push Float pointed by HL 
+	; Into the stack. Notice that the hl points to the last
+	; 2 bytes of the FP number
+	
+__FP_PUSH_REV:
+	    pop bc
+	    ld d, (hl)
+	    dec hl
+	    ld e, (hl)
+	    dec hl
+	    push de
+	    ld d, (hl)
+	    dec hl
+	    ld e, (hl)
+	    dec hl
+	    push de
+	    ld a, (hl)
+	    push af
+	    push bc
+	    ret
+	
+	
+#line 65 "coercion1.bas"
 	
 ZXBASIC_USER_DATA:
 _a:
 	add hl, sp
 	ld (__CALL_BACK__), hl
 	ei
-	ld hl, (_b + 3)
-	push hl
-	ld hl, (_b + 1)
-	push hl
-	ld a, (_b)
-	push af
+	ld hl, _b + 4
+	call __FP_PUSH_REV
 	ld a, 082h
 	ld de, 00000h
 	ld bc, 00000h
 __FPSTACK_PUSH2: ; Pushes Current A ED CB registers and top of the stack on (SP + 4)
 	                 ; Second argument to push into the stack calculator is popped out of the stack
 	                 ; Since the caller routine also receives the parameters into the top of the stack
-	                 ; For bytes must be removed from SP before pop them out
+	                 ; four bytes must be removed from SP before pop them out
 	
 	    call __FPSTACK_PUSH ; Pushes A ED CB into the FP-STACK
 	    exx
 	
 		ENDP
 	
-#line 30 "divf00.bas"
+#line 26 "divf00.bas"
+#line 1 "pushf.asm"
+	
+	; Routine to push Float pointed by HL 
+	; Into the stack. Notice that the hl points to the last
+	; 2 bytes of the FP number
+	
+__FP_PUSH_REV:
+	    pop bc
+	    ld d, (hl)
+	    dec hl
+	    ld e, (hl)
+	    dec hl
+	    push de
+	    ld d, (hl)
+	    dec hl
+	    ld e, (hl)
+	    dec hl
+	    push de
+	    ld a, (hl)
+	    push af
+	    push bc
+	    ret
+	
+	
+#line 27 "divf00.bas"
 #line 1 "storef.asm"
 __PISTOREF:	; Indect Stores a float (A, E, D, C, B) at location stored in memory, pointed by (IX + HL)
 			push de
 			ld (hl), b
 			ret
 			
-#line 31 "divf00.bas"
+#line 28 "divf00.bas"
 	
 ZXBASIC_USER_DATA:
 _a:
 __FPSTACK_PUSH2: ; Pushes Current A ED CB registers and top of the stack on (SP + 4)
 	                 ; Second argument to push into the stack calculator is popped out of the stack
 	                 ; Since the caller routine also receives the parameters into the top of the stack
-	                 ; For bytes must be removed from SP before pop them out
+	                 ; four bytes must be removed from SP before pop them out
 	
 	    call __FPSTACK_PUSH ; Pushes A ED CB into the FP-STACK
 	    exx

tests/fporder.asm

 	add hl, sp
 	ld (__CALL_BACK__), hl
 	ei
-	ld hl, (_n + 3)
-	push hl
-	ld hl, (_n + 1)
-	push hl
-	ld a, (_n)
-	push af
+	ld hl, _n + 4
+	call __FP_PUSH_REV
 	ld a, 082h
 	ld de, 00F49h
 	ld bc, 0A2DAh
 __FPSTACK_PUSH2: ; Pushes Current A ED CB registers and top of the stack on (SP + 4)
 	                 ; Second argument to push into the stack calculator is popped out of the stack
 	                 ; Since the caller routine also receives the parameters into the top of the stack
-	                 ; For bytes must be removed from SP before pop them out
+	                 ; four bytes must be removed from SP before pop them out
 	
 	    call __FPSTACK_PUSH ; Pushes A ED CB into the FP-STACK
 	    exx
 	
 		jp __FPSTACK_POP
 	
-#line 38 "fporder.bas"
+#line 34 "fporder.bas"
 #line 1 "mulf.asm"
 	
 	
 	
 		jp __FPSTACK_POP
 	
-#line 39 "fporder.bas"
+#line 35 "fporder.bas"
+#line 1 "pushf.asm"
+	
+	; Routine to push Float pointed by HL 
+	; Into the stack. Notice that the hl points to the last
+	; 2 bytes of the FP number
+	
+__FP_PUSH_REV:
+	    pop bc
+	    ld d, (hl)
+	    dec hl
+	    ld e, (hl)
+	    dec hl
+	    push de
+	    ld d, (hl)
+	    dec hl
+	    ld e, (hl)
+	    dec hl
+	    push de
+	    ld a, (hl)
+	    push af
+	    push bc
+	    ret
+	
+	
+#line 36 "fporder.bas"
 #line 1 "storef.asm"
 __PISTOREF:	; Indect Stores a float (A, E, D, C, B) at location stored in memory, pointed by (IX + HL)
 			push de
 			ld (hl), b
 			ret
 			
-#line 40 "fporder.bas"
+#line 37 "fporder.bas"
 #line 1 "subf.asm"
 	
 	
 	
 		jp __FPSTACK_POP
 	
-#line 41 "fporder.bas"
+#line 38 "fporder.bas"
 	
 ZXBASIC_USER_DATA:
 _n:
 	add hl, sp
 	ld (__CALL_BACK__), hl
 	ei
-	ld hl, (_b + 3)
-	push hl
-	ld hl, (_b + 1)
-	push hl
-	ld a, (_b)
-	push af
+	ld hl, _b + 4
+	call __FP_PUSH_REV
 	ld a, 082h
 	ld de, 00000h
 	ld bc, 00000h
 __FPSTACK_PUSH2: ; Pushes Current A ED CB registers and top of the stack on (SP + 4)
 	                 ; Second argument to push into the stack calculator is popped out of the stack
 	                 ; Since the caller routine also receives the parameters into the top of the stack
-	                 ; For bytes must be removed from SP before pop them out
+	                 ; four bytes must be removed from SP before pop them out
 	
 	    call __FPSTACK_PUSH ; Pushes A ED CB into the FP-STACK
 	    exx
 	
 		jp __FPSTACK_POP
 	
-#line 30 "mulf00.bas"
+#line 26 "mulf00.bas"
+#line 1 "pushf.asm"
+	
+	; Routine to push Float pointed by HL 
+	; Into the stack. Notice that the hl points to the last
+	; 2 bytes of the FP number
+	
+__FP_PUSH_REV:
+	    pop bc
+	    ld d, (hl)
+	    dec hl
+	    ld e, (hl)
+	    dec hl
+	    push de
+	    ld d, (hl)
+	    dec hl
+	    ld e, (hl)
+	    dec hl
+	    push de
+	    ld a, (hl)
+	    push af
+	    push bc
+	    ret
+	
+	
+#line 27 "mulf00.bas"
 #line 1 "storef.asm"
 __PISTOREF:	; Indect Stores a float (A, E, D, C, B) at location stored in memory, pointed by (IX + HL)
 			push de
 			ld (hl), b
 			ret
 			
-#line 31 "mulf00.bas"
+#line 28 "mulf00.bas"
 	
 ZXBASIC_USER_DATA:
 _a:
 __FPSTACK_PUSH2: ; Pushes Current A ED CB registers and top of the stack on (SP + 4)
 	                 ; Second argument to push into the stack calculator is popped out of the stack
 	                 ; Since the caller routine also receives the parameters into the top of the stack
-	                 ; For bytes must be removed from SP before pop them out
+	                 ; four bytes must be removed from SP before pop them out
 	
 	    call __FPSTACK_PUSH ; Pushes A ED CB into the FP-STACK
 	    exx
 	add hl, sp
 	ld (__CALL_BACK__), hl
 	ei
-	ld hl, (_b + 3)
-	push hl
-	ld hl, (_b + 1)
-	push hl
-	ld a, (_b)
-	push af
+	ld hl, _b + 4
+	call __FP_PUSH_REV
 	ld a, 082h
 	ld de, 00000h
 	ld bc, 00000h
 	ret
 __CALL_BACK__:
 	DEFW 0
+#line 1 "pushf.asm"
+	
+	; Routine to push Float pointed by HL 
+	; Into the stack. Notice that the hl points to the last
+	; 2 bytes of the FP number
+	
+__FP_PUSH_REV:
+	    pop bc
+	    ld d, (hl)
+	    dec hl
+	    ld e, (hl)
+	    dec hl
+	    push de
+	    ld d, (hl)
+	    dec hl
+	    ld e, (hl)
+	    dec hl
+	    push de
+	    ld a, (hl)
+	    push af
+	    push bc
+	    ret
+	
+	
+#line 26 "subf00.bas"
 #line 1 "storef.asm"
 __PISTOREF:	; Indect Stores a float (A, E, D, C, B) at location stored in memory, pointed by (IX + HL)
 			push de
 			ld (hl), b
 			ret
 			
-#line 30 "subf00.bas"
+#line 27 "subf00.bas"
 #line 1 "subf.asm"
 #line 1 "stackf.asm"
 	; -------------------------------------------------------------
 __FPSTACK_PUSH2: ; Pushes Current A ED CB registers and top of the stack on (SP + 4)
 	                 ; Second argument to push into the stack calculator is popped out of the stack
 	                 ; Since the caller routine also receives the parameters into the top of the stack
-	                 ; For bytes must be removed from SP before pop them out
+	                 ; four bytes must be removed from SP before pop them out
 	
 	    call __FPSTACK_PUSH ; Pushes A ED CB into the FP-STACK
 	    exx
 	
 		jp __FPSTACK_POP
 	
-#line 31 "subf00.bas"
+#line 28 "subf00.bas"
 	
 ZXBASIC_USER_DATA:
 _a:
 __FPSTACK_PUSH2: ; Pushes Current A ED CB registers and top of the stack on (SP + 4)
 	                 ; Second argument to push into the stack calculator is popped out of the stack
 	                 ; Since the caller routine also receives the parameters into the top of the stack
-	                 ; For bytes must be removed from SP before pop them out
+	                 ; four bytes must be removed from SP before pop them out
 	
 	    call __FPSTACK_PUSH ; Pushes A ED CB into the FP-STACK
 	    exx
 	ei
 __LABEL__10:
 __LABEL0:
-	ld hl, (_a + 3)
-	push hl
-	ld hl, (_a + 1)
-	push hl
-	ld a, (_a)
-	push af
+	ld hl, _a + 4
+	call __FP_PUSH_REV
 	ld a, 000h
 	ld de, 00000h
 	ld bc, 00000h
 __LABEL1:
 __LABEL__30:
 __LABEL2:
-	ld hl, (_a + 3)
-	push hl
-	ld hl, (_a + 1)
-	push hl
-	ld a, (_a)
-	push af
+	ld hl, _a + 4
+	call __FP_PUSH_REV
 	ld a, 000h
 	ld de, 00000h
 	ld bc, 00000h
 	ret
 __CALL_BACK__:
 	DEFW 0
+#line 1 "pushf.asm"
+	
+	; Routine to push Float pointed by HL 
+	; Into the stack. Notice that the hl points to the last
+	; 2 bytes of the FP number
+	
+__FP_PUSH_REV:
+	    pop bc
+	    ld d, (hl)
+	    dec hl
+	    ld e, (hl)
+	    dec hl
+	    push de
+	    ld d, (hl)
+	    dec hl
+	    ld e, (hl)
+	    dec hl
+	    push de
+	    ld a, (hl)
+	    push af
+	    push bc
+	    ret
+	
+	
+#line 46 "while.bas"
 #line 1 "ltf.asm"
 #line 1 "u32tofreg.asm"
 #line 1 "neg32.asm"
 __FPSTACK_PUSH2: ; Pushes Current A ED CB registers and top of the stack on (SP + 4)
 	                 ; Second argument to push into the stack calculator is popped out of the stack
 	                 ; Since the caller routine also receives the parameters into the top of the stack
-	                 ; For bytes must be removed from SP before pop them out
+	                 ; four bytes must be removed from SP before pop them out
 	
 	    call __FPSTACK_PUSH ; Pushes A ED CB into the FP-STACK
 	    exx
 		call __FPSTACK_POP 
 		jp __FTOU8 ; Convert to 8 bits
 	
-#line 54 "while.bas"
+#line 47 "while.bas"
 	
 ZXBASIC_USER_DATA:
 _a: