Skip to content

Commit 99edf98

Browse files
committed
fix: fixes a bug in LN calculation
1 parent 57aac95 commit 99edf98

4 files changed

Lines changed: 48 additions & 50 deletions

File tree

src/lib/arch/zx48k/runtime/logn.asm

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@ LN: ; Computes Ln(x) using ROM FP-CALC
66
call __FPSTACK_PUSH
77

88
rst 28h ; ROM CALC
9-
defb 20h ; 25h
9+
defb 25h
1010
defb 38h ; END CALC
1111

1212
jp __FPSTACK_POP
1313

1414
pop namespace
15-

src/lib/arch/zxnext/runtime/logn.asm

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@ LN: ; Computes Ln(x) using ROM FP-CALC
66
call __FPSTACK_PUSH
77

88
rst 28h ; ROM CALC
9-
defb 20h ; 25h
9+
defb 25h
1010
defb 38h ; END CALC
1111

1212
jp __FPSTACK_POP
1313

1414
pop namespace
15-

tests/functional/arch/zx48k/19.asm

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ _x:
9191
ei
9292
ret
9393
;; --- end of user code ---
94-
#line 1 "/zxbasic/src/arch/zx48k/library-asm/acos.asm"
95-
#line 1 "/zxbasic/src/arch/zx48k/library-asm/stackf.asm"
94+
#line 1 "/zxbasic/src/lib/arch/zx48k/runtime/acos.asm"
95+
#line 1 "/zxbasic/src/lib/arch/zx48k/runtime/stackf.asm"
9696
; -------------------------------------------------------------
9797
; Functions to manage FP-Stack of the ZX Spectrum ROM CALC
9898
; -------------------------------------------------------------
@@ -131,7 +131,7 @@ __FPSTACK_I16: ; Pushes 16 bits integer in HL into the FP ROM STACK
131131
ld b, a
132132
jp __FPSTACK_PUSH
133133
pop namespace
134-
#line 2 "/zxbasic/src/arch/zx48k/library-asm/acos.asm"
134+
#line 2 "/zxbasic/src/lib/arch/zx48k/runtime/acos.asm"
135135
push namespace core
136136
ACOS: ; Computes ACOS using ROM FP-CALC
137137
call __FPSTACK_PUSH
@@ -140,8 +140,8 @@ ACOS: ; Computes ACOS using ROM FP-CALC
140140
defb 38h ; END CALC
141141
jp __FPSTACK_POP
142142
pop namespace
143-
#line 71 "19.bas"
144-
#line 1 "/zxbasic/src/arch/zx48k/library-asm/asin.asm"
143+
#line 71 "arch/zx48k/19.bas"
144+
#line 1 "/zxbasic/src/lib/arch/zx48k/runtime/asin.asm"
145145
push namespace core
146146
ASIN: ; Computes ASIN using ROM FP-CALC
147147
call __FPSTACK_PUSH
@@ -150,8 +150,8 @@ ASIN: ; Computes ASIN using ROM FP-CALC
150150
defb 38h ; END CALC
151151
jp __FPSTACK_POP
152152
pop namespace
153-
#line 72 "19.bas"
154-
#line 1 "/zxbasic/src/arch/zx48k/library-asm/atan.asm"
153+
#line 72 "arch/zx48k/19.bas"
154+
#line 1 "/zxbasic/src/lib/arch/zx48k/runtime/atan.asm"
155155
push namespace core
156156
ATAN: ; Computes ATAN using ROM FP-CALC
157157
call __FPSTACK_PUSH
@@ -160,8 +160,8 @@ ATAN: ; Computes ATAN using ROM FP-CALC
160160
defb 38h ; END CALC
161161
jp __FPSTACK_POP
162162
pop namespace
163-
#line 73 "19.bas"
164-
#line 1 "/zxbasic/src/arch/zx48k/library-asm/cos.asm"
163+
#line 73 "arch/zx48k/19.bas"
164+
#line 1 "/zxbasic/src/lib/arch/zx48k/runtime/cos.asm"
165165
push namespace core
166166
COS: ; Computes COS using ROM FP-CALC
167167
call __FPSTACK_PUSH
@@ -170,8 +170,8 @@ COS: ; Computes COS using ROM FP-CALC
170170
defb 38h ; END CALC
171171
jp __FPSTACK_POP
172172
pop namespace
173-
#line 74 "19.bas"
174-
#line 1 "/zxbasic/src/arch/zx48k/library-asm/exp.asm"
173+
#line 74 "arch/zx48k/19.bas"
174+
#line 1 "/zxbasic/src/lib/arch/zx48k/runtime/exp.asm"
175175
push namespace core
176176
EXP: ; Computes e^n using ROM FP-CALC
177177
call __FPSTACK_PUSH
@@ -180,18 +180,18 @@ EXP: ; Computes e^n using ROM FP-CALC
180180
defb 38h ; END CALC
181181
jp __FPSTACK_POP
182182
pop namespace
183-
#line 75 "19.bas"
184-
#line 1 "/zxbasic/src/arch/zx48k/library-asm/logn.asm"
183+
#line 75 "arch/zx48k/19.bas"
184+
#line 1 "/zxbasic/src/lib/arch/zx48k/runtime/logn.asm"
185185
push namespace core
186186
LN: ; Computes Ln(x) using ROM FP-CALC
187187
call __FPSTACK_PUSH
188188
rst 28h ; ROM CALC
189-
defb 20h ; 25h
189+
defb 25h
190190
defb 38h ; END CALC
191191
jp __FPSTACK_POP
192192
pop namespace
193-
#line 76 "19.bas"
194-
#line 1 "/zxbasic/src/arch/zx48k/library-asm/sin.asm"
193+
#line 76 "arch/zx48k/19.bas"
194+
#line 1 "/zxbasic/src/lib/arch/zx48k/runtime/sin.asm"
195195
push namespace core
196196
SIN: ; Computes SIN using ROM FP-CALC
197197
call __FPSTACK_PUSH
@@ -200,8 +200,8 @@ SIN: ; Computes SIN using ROM FP-CALC
200200
defb 38h ; END CALC
201201
jp __FPSTACK_POP
202202
pop namespace
203-
#line 77 "19.bas"
204-
#line 1 "/zxbasic/src/arch/zx48k/library-asm/sqrt.asm"
203+
#line 77 "arch/zx48k/19.bas"
204+
#line 1 "/zxbasic/src/lib/arch/zx48k/runtime/sqrt.asm"
205205
push namespace core
206206
SQRT: ; Computes SQRT(x) using ROM FP-CALC
207207
call __FPSTACK_PUSH
@@ -210,8 +210,8 @@ SQRT: ; Computes SQRT(x) using ROM FP-CALC
210210
defb 38h ; END CALC
211211
jp __FPSTACK_POP
212212
pop namespace
213-
#line 78 "19.bas"
214-
#line 1 "/zxbasic/src/arch/zx48k/library-asm/storef.asm"
213+
#line 78 "arch/zx48k/19.bas"
214+
#line 1 "/zxbasic/src/lib/arch/zx48k/runtime/storef.asm"
215215
push namespace core
216216
__PISTOREF: ; Indect Stores a float (A, E, D, C, B) at location stored in memory, pointed by (IX + HL)
217217
push de
@@ -239,8 +239,8 @@ __STOREF: ; Stores the given FP number in A EDCB at address HL
239239
ld (hl), b
240240
ret
241241
pop namespace
242-
#line 79 "19.bas"
243-
#line 1 "/zxbasic/src/arch/zx48k/library-asm/tan.asm"
242+
#line 79 "arch/zx48k/19.bas"
243+
#line 1 "/zxbasic/src/lib/arch/zx48k/runtime/tan.asm"
244244
push namespace core
245245
TAN: ; Computes TAN using ROM FP-CALC
246246
call __FPSTACK_PUSH
@@ -249,5 +249,5 @@ TAN: ; Computes TAN using ROM FP-CALC
249249
defb 38h ; END CALC
250250
jp __FPSTACK_POP
251251
pop namespace
252-
#line 80 "19.bas"
252+
#line 80 "arch/zx48k/19.bas"
253253
END

tests/functional/arch/zx48k/70.asm

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ _a:
5757
ei
5858
ret
5959
;; --- end of user code ---
60-
#line 1 "/zxbasic/src/arch/zx48k/library-asm/cos.asm"
61-
#line 1 "/zxbasic/src/arch/zx48k/library-asm/stackf.asm"
60+
#line 1 "/zxbasic/src/lib/arch/zx48k/runtime/cos.asm"
61+
#line 1 "/zxbasic/src/lib/arch/zx48k/runtime/stackf.asm"
6262
; -------------------------------------------------------------
6363
; Functions to manage FP-Stack of the ZX Spectrum ROM CALC
6464
; -------------------------------------------------------------
@@ -97,7 +97,7 @@ __FPSTACK_I16: ; Pushes 16 bits integer in HL into the FP ROM STACK
9797
ld b, a
9898
jp __FPSTACK_PUSH
9999
pop namespace
100-
#line 2 "/zxbasic/src/arch/zx48k/library-asm/cos.asm"
100+
#line 2 "/zxbasic/src/lib/arch/zx48k/runtime/cos.asm"
101101
push namespace core
102102
COS: ; Computes COS using ROM FP-CALC
103103
call __FPSTACK_PUSH
@@ -106,8 +106,8 @@ COS: ; Computes COS using ROM FP-CALC
106106
defb 38h ; END CALC
107107
jp __FPSTACK_POP
108108
pop namespace
109-
#line 35 "70.bas"
110-
#line 1 "/zxbasic/src/arch/zx48k/library-asm/exp.asm"
109+
#line 35 "arch/zx48k/70.bas"
110+
#line 1 "/zxbasic/src/lib/arch/zx48k/runtime/exp.asm"
111111
push namespace core
112112
EXP: ; Computes e^n using ROM FP-CALC
113113
call __FPSTACK_PUSH
@@ -116,9 +116,9 @@ EXP: ; Computes e^n using ROM FP-CALC
116116
defb 38h ; END CALC
117117
jp __FPSTACK_POP
118118
pop namespace
119-
#line 36 "70.bas"
120-
#line 1 "/zxbasic/src/arch/zx48k/library-asm/ftou32reg.asm"
121-
#line 1 "/zxbasic/src/arch/zx48k/library-asm/neg32.asm"
119+
#line 36 "arch/zx48k/70.bas"
120+
#line 1 "/zxbasic/src/lib/arch/zx48k/runtime/ftou32reg.asm"
121+
#line 1 "/zxbasic/src/lib/arch/zx48k/runtime/neg32.asm"
122122
push namespace core
123123
__ABS32:
124124
bit 7, d
@@ -143,7 +143,7 @@ __NEG32: ; Negates DEHL (Two's complement)
143143
inc de
144144
ret
145145
pop namespace
146-
#line 2 "/zxbasic/src/arch/zx48k/library-asm/ftou32reg.asm"
146+
#line 2 "/zxbasic/src/lib/arch/zx48k/runtime/ftou32reg.asm"
147147
push namespace core
148148
__FTOU32REG: ; Converts a Float to (un)signed 32 bit integer (NOTE: It's ALWAYS 32 bit signed)
149149
; Input FP number in A EDCB (A exponent, EDCB mantissa)
@@ -215,18 +215,18 @@ __FTOU8: ; Converts float in C ED LH to Unsigned byte in A
215215
ld a, l
216216
ret
217217
pop namespace
218-
#line 37 "70.bas"
219-
#line 1 "/zxbasic/src/arch/zx48k/library-asm/logn.asm"
218+
#line 37 "arch/zx48k/70.bas"
219+
#line 1 "/zxbasic/src/lib/arch/zx48k/runtime/logn.asm"
220220
push namespace core
221221
LN: ; Computes Ln(x) using ROM FP-CALC
222222
call __FPSTACK_PUSH
223223
rst 28h ; ROM CALC
224-
defb 20h ; 25h
224+
defb 25h
225225
defb 38h ; END CALC
226226
jp __FPSTACK_POP
227227
pop namespace
228-
#line 38 "70.bas"
229-
#line 1 "/zxbasic/src/arch/zx48k/library-asm/sin.asm"
228+
#line 38 "arch/zx48k/70.bas"
229+
#line 1 "/zxbasic/src/lib/arch/zx48k/runtime/sin.asm"
230230
push namespace core
231231
SIN: ; Computes SIN using ROM FP-CALC
232232
call __FPSTACK_PUSH
@@ -235,8 +235,8 @@ SIN: ; Computes SIN using ROM FP-CALC
235235
defb 38h ; END CALC
236236
jp __FPSTACK_POP
237237
pop namespace
238-
#line 39 "70.bas"
239-
#line 1 "/zxbasic/src/arch/zx48k/library-asm/sqrt.asm"
238+
#line 39 "arch/zx48k/70.bas"
239+
#line 1 "/zxbasic/src/lib/arch/zx48k/runtime/sqrt.asm"
240240
push namespace core
241241
SQRT: ; Computes SQRT(x) using ROM FP-CALC
242242
call __FPSTACK_PUSH
@@ -245,8 +245,8 @@ SQRT: ; Computes SQRT(x) using ROM FP-CALC
245245
defb 38h ; END CALC
246246
jp __FPSTACK_POP
247247
pop namespace
248-
#line 40 "70.bas"
249-
#line 1 "/zxbasic/src/arch/zx48k/library-asm/storef.asm"
248+
#line 40 "arch/zx48k/70.bas"
249+
#line 1 "/zxbasic/src/lib/arch/zx48k/runtime/storef.asm"
250250
push namespace core
251251
__PISTOREF: ; Indect Stores a float (A, E, D, C, B) at location stored in memory, pointed by (IX + HL)
252252
push de
@@ -274,8 +274,8 @@ __STOREF: ; Stores the given FP number in A EDCB at address HL
274274
ld (hl), b
275275
ret
276276
pop namespace
277-
#line 41 "70.bas"
278-
#line 1 "/zxbasic/src/arch/zx48k/library-asm/tan.asm"
277+
#line 41 "arch/zx48k/70.bas"
278+
#line 1 "/zxbasic/src/lib/arch/zx48k/runtime/tan.asm"
279279
push namespace core
280280
TAN: ; Computes TAN using ROM FP-CALC
281281
call __FPSTACK_PUSH
@@ -284,8 +284,8 @@ TAN: ; Computes TAN using ROM FP-CALC
284284
defb 38h ; END CALC
285285
jp __FPSTACK_POP
286286
pop namespace
287-
#line 42 "70.bas"
288-
#line 1 "/zxbasic/src/arch/zx48k/library-asm/u32tofreg.asm"
287+
#line 42 "arch/zx48k/70.bas"
288+
#line 1 "/zxbasic/src/lib/arch/zx48k/runtime/u32tofreg.asm"
289289
push namespace core
290290
__I8TOFREG:
291291
ld l, a
@@ -355,5 +355,5 @@ __U32TOFREG_END:
355355
ret
356356
ENDP
357357
pop namespace
358-
#line 43 "70.bas"
358+
#line 43 "arch/zx48k/70.bas"
359359
END

0 commit comments

Comments
 (0)