Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/arch/z80/backend/runtime/labels.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Runtime Labels
from typing import Final

from . import core, datarestore, io, math, misc, random
from .namespace import NAMESPACE

Expand All @@ -16,7 +18,9 @@ class Labels(
NAMESPACE = NAMESPACE


RUNTIME_LABELS: set[str] = {getattr(Labels, x) for x in dir(Labels) if not x.startswith("__") and x != "NAMESPACE"}
RUNTIME_LABELS: Final[set[str]] = {
getattr(Labels, x) for x in dir(Labels) if not x.startswith("__") and x != "NAMESPACE"
}


def _dict_join(*args: dict[str, str]) -> dict[str, str]:
Expand All @@ -32,7 +36,7 @@ def _dict_join(*args: dict[str, str]) -> dict[str, str]:
return result


LABEL_REQUIRED_MODULES = _dict_join(
LABEL_REQUIRED_MODULES: Final[dict[str, str]] = _dict_join(
core.REQUIRED_MODULES,
datarestore.REQUIRED_MODULES,
math.REQUIRED_MODULES,
Expand Down
18 changes: 9 additions & 9 deletions src/arch/z80/backend/runtime/math.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ class MathLabels:


REQUIRED_MODULES = {
MathLabels.ACS: "acos.asm",
MathLabels.ASN: "asin.asm",
MathLabels.ATN: "atan.asm",
MathLabels.COS: "cos.asm",
MathLabels.SIN: "sin.asm",
MathLabels.TAN: "tan.asm",
MathLabels.EXP: "exp.asm",
MathLabels.LN: "logn.asm",
MathLabels.SQR: "sqrt.asm",
MathLabels.ACS: "math/acos.asm",
MathLabels.ASN: "math/asin.asm",
MathLabels.ATN: "math/atan.asm",
MathLabels.COS: "math/cos.asm",
MathLabels.SIN: "math/sin.asm",
MathLabels.TAN: "math/tan.asm",
MathLabels.EXP: "math/exp.asm",
MathLabels.LN: "math/logn.asm",
MathLabels.SQR: "math/sqrt.asm",
MathLabels.SGNI8: "sgni8.asm",
MathLabels.SGNU8: "sgnu8.asm",
MathLabels.SGNI16: "sgni16.asm",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,3 @@ ACOS: ; Computes ACOS using ROM FP-CALC
jp __FPSTACK_POP

pop namespace

Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,3 @@ ASIN: ; Computes ASIN using ROM FP-CALC
jp __FPSTACK_POP

pop namespace

Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,3 @@ ATAN: ; Computes ATAN using ROM FP-CALC
jp __FPSTACK_POP

pop namespace

Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,3 @@ COS: ; Computes COS using ROM FP-CALC
jp __FPSTACK_POP

pop namespace

Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,3 @@ EXP: ; Computes e^n using ROM FP-CALC
jp __FPSTACK_POP

pop namespace

Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,3 @@ SIN: ; Computes SIN using ROM FP-CALC
jp __FPSTACK_POP

pop namespace

Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,3 @@ SQRT: ; Computes SQRT(x) using ROM FP-CALC
jp __FPSTACK_POP

pop namespace

Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,3 @@ TAN: ; Computes TAN using ROM FP-CALC
jp __FPSTACK_POP

pop namespace

Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,3 @@ ACOS: ; Computes ACOS using ROM FP-CALC
jp __FPSTACK_POP

pop namespace

Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,3 @@ ASIN: ; Computes ASIN using ROM FP-CALC
jp __FPSTACK_POP

pop namespace

Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,3 @@ ATAN: ; Computes ATAN using ROM FP-CALC
jp __FPSTACK_POP

pop namespace

Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,3 @@ COS: ; Computes COS using ROM FP-CALC
jp __FPSTACK_POP

pop namespace

Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,3 @@ EXP: ; Computes e^n using ROM FP-CALC
jp __FPSTACK_POP

pop namespace

Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,3 @@ SIN: ; Computes SIN using ROM FP-CALC
jp __FPSTACK_POP

pop namespace

Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,3 @@ SQRT: ; Computes SQRT(x) using ROM FP-CALC
jp __FPSTACK_POP

pop namespace

Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,3 @@ TAN: ; Computes TAN using ROM FP-CALC
jp __FPSTACK_POP

pop namespace

38 changes: 19 additions & 19 deletions tests/functional/arch/zx48k/19.asm
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ _x:
ei
ret
;; --- end of user code ---
#line 1 "/zxbasic/src/lib/arch/zx48k/runtime/acos.asm"
#line 1 "/zxbasic/src/lib/arch/zx48k/runtime/math/acos.asm"
#line 1 "/zxbasic/src/lib/arch/zx48k/runtime/stackf.asm"
; -------------------------------------------------------------
; Functions to manage FP-Stack of the ZX Spectrum ROM CALC
Expand Down Expand Up @@ -131,7 +131,7 @@ __FPSTACK_I16: ; Pushes 16 bits integer in HL into the FP ROM STACK
ld b, a
jp __FPSTACK_PUSH
pop namespace
#line 2 "/zxbasic/src/lib/arch/zx48k/runtime/acos.asm"
#line 2 "/zxbasic/src/lib/arch/zx48k/runtime/math/acos.asm"
push namespace core
ACOS: ; Computes ACOS using ROM FP-CALC
call __FPSTACK_PUSH
Expand All @@ -141,7 +141,7 @@ ACOS: ; Computes ACOS using ROM FP-CALC
jp __FPSTACK_POP
pop namespace
#line 71 "arch/zx48k/19.bas"
#line 1 "/zxbasic/src/lib/arch/zx48k/runtime/asin.asm"
#line 1 "/zxbasic/src/lib/arch/zx48k/runtime/math/asin.asm"
push namespace core
ASIN: ; Computes ASIN using ROM FP-CALC
call __FPSTACK_PUSH
Expand All @@ -151,7 +151,7 @@ ASIN: ; Computes ASIN using ROM FP-CALC
jp __FPSTACK_POP
pop namespace
#line 72 "arch/zx48k/19.bas"
#line 1 "/zxbasic/src/lib/arch/zx48k/runtime/atan.asm"
#line 1 "/zxbasic/src/lib/arch/zx48k/runtime/math/atan.asm"
push namespace core
ATAN: ; Computes ATAN using ROM FP-CALC
call __FPSTACK_PUSH
Expand All @@ -161,7 +161,7 @@ ATAN: ; Computes ATAN using ROM FP-CALC
jp __FPSTACK_POP
pop namespace
#line 73 "arch/zx48k/19.bas"
#line 1 "/zxbasic/src/lib/arch/zx48k/runtime/cos.asm"
#line 1 "/zxbasic/src/lib/arch/zx48k/runtime/math/cos.asm"
push namespace core
COS: ; Computes COS using ROM FP-CALC
call __FPSTACK_PUSH
Expand All @@ -171,7 +171,7 @@ COS: ; Computes COS using ROM FP-CALC
jp __FPSTACK_POP
pop namespace
#line 74 "arch/zx48k/19.bas"
#line 1 "/zxbasic/src/lib/arch/zx48k/runtime/exp.asm"
#line 1 "/zxbasic/src/lib/arch/zx48k/runtime/math/exp.asm"
push namespace core
EXP: ; Computes e^n using ROM FP-CALC
call __FPSTACK_PUSH
Expand All @@ -181,7 +181,7 @@ EXP: ; Computes e^n using ROM FP-CALC
jp __FPSTACK_POP
pop namespace
#line 75 "arch/zx48k/19.bas"
#line 1 "/zxbasic/src/lib/arch/zx48k/runtime/logn.asm"
#line 1 "/zxbasic/src/lib/arch/zx48k/runtime/math/logn.asm"
push namespace core
LN: ; Computes Ln(x) using ROM FP-CALC
call __FPSTACK_PUSH
Expand All @@ -191,7 +191,7 @@ LN: ; Computes Ln(x) using ROM FP-CALC
jp __FPSTACK_POP
pop namespace
#line 76 "arch/zx48k/19.bas"
#line 1 "/zxbasic/src/lib/arch/zx48k/runtime/sin.asm"
#line 1 "/zxbasic/src/lib/arch/zx48k/runtime/math/sin.asm"
push namespace core
SIN: ; Computes SIN using ROM FP-CALC
call __FPSTACK_PUSH
Expand All @@ -201,7 +201,7 @@ SIN: ; Computes SIN using ROM FP-CALC
jp __FPSTACK_POP
pop namespace
#line 77 "arch/zx48k/19.bas"
#line 1 "/zxbasic/src/lib/arch/zx48k/runtime/sqrt.asm"
#line 1 "/zxbasic/src/lib/arch/zx48k/runtime/math/sqrt.asm"
push namespace core
SQRT: ; Computes SQRT(x) using ROM FP-CALC
call __FPSTACK_PUSH
Expand All @@ -211,6 +211,16 @@ SQRT: ; Computes SQRT(x) using ROM FP-CALC
jp __FPSTACK_POP
pop namespace
#line 78 "arch/zx48k/19.bas"
#line 1 "/zxbasic/src/lib/arch/zx48k/runtime/math/tan.asm"
push namespace core
TAN: ; Computes TAN using ROM FP-CALC
call __FPSTACK_PUSH
rst 28h ; ROM CALC
defb 21h ; TAN
defb 38h ; END CALC
jp __FPSTACK_POP
pop namespace
#line 79 "arch/zx48k/19.bas"
#line 1 "/zxbasic/src/lib/arch/zx48k/runtime/storef.asm"
push namespace core
__PISTOREF: ; Indect Stores a float (A, E, D, C, B) at location stored in memory, pointed by (IX + HL)
Expand Down Expand Up @@ -239,15 +249,5 @@ __STOREF: ; Stores the given FP number in A EDCB at address HL
ld (hl), b
ret
pop namespace
#line 79 "arch/zx48k/19.bas"
#line 1 "/zxbasic/src/lib/arch/zx48k/runtime/tan.asm"
push namespace core
TAN: ; Computes TAN using ROM FP-CALC
call __FPSTACK_PUSH
rst 28h ; ROM CALC
defb 21h ; TAN
defb 38h ; END CALC
jp __FPSTACK_POP
pop namespace
#line 80 "arch/zx48k/19.bas"
END
Loading