tipy-asm 1.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. ti84/__init__.py +5 -0
  2. ti84/__init__.pyi +14 -0
  3. ti84/color.pyi +37 -0
  4. ti84/file.pyi +11 -0
  5. ti84/font.pyi +13 -0
  6. ti84/graph.pyi +4 -0
  7. ti84/graphics.pyi +60 -0
  8. ti84/keyboard.pyi +73 -0
  9. ti84/math.pyi +11 -0
  10. ti84/py.typed +1 -0
  11. ti84/random.pyi +5 -0
  12. ti84/sprite.pyi +10 -0
  13. ti84/storage.pyi +11 -0
  14. ti84asm/__init__.py +1 -0
  15. ti84asm/__main__.py +3 -0
  16. ti84asm/cedev_config.py +58 -0
  17. ti84asm/cgen.py +1029 -0
  18. ti84asm/cli.py +451 -0
  19. ti84asm/compiler.py +1105 -0
  20. ti84asm/convbin.py +208 -0
  21. ti84asm/convfont.py +1073 -0
  22. ti84asm/convimg.py +156 -0
  23. ti84asm/errors.py +2 -0
  24. ti84asm/fasmg.py +143 -0
  25. ti84asm/flash_ce.py +740 -0
  26. ti84asm/flashapp.py +100 -0
  27. ti84asm/image.py +58 -0
  28. ti84asm/project.py +433 -0
  29. ti84asm/project_convert/__init__.py +19 -0
  30. ti84asm/project_convert/c_like.py +803 -0
  31. ti84asm/project_convert/cedev_convert.py +24 -0
  32. ti84asm/project_convert/ice_convert.py +27 -0
  33. ti84asm/project_convert/project_converter.py +251 -0
  34. ti84asm/runtime.py +1043 -0
  35. ti84asm/toolchain/bin/fasmg +0 -0
  36. ti84asm/toolchain/bin/fasmg.exe +0 -0
  37. ti84asm/toolchain/bin/fasmg.x64 +0 -0
  38. ti84asm/toolchain/fasmg-license.txt +24 -0
  39. ti84asm/toolchain/include/commands.alm +99 -0
  40. ti84asm/toolchain/include/ez80.alm +1505 -0
  41. ti84asm/toolchain/include/ez80.inc +2 -0
  42. ti84asm/toolchain/include/ti84pceg.inc +6997 -0
  43. ti84asm/toolchain/include/tiformat.inc +105 -0
  44. ti84libs/__init__.py +107 -0
  45. ti84libs/api.py +199 -0
  46. ti84libs/color.py +309 -0
  47. ti84libs/graph.py +10 -0
  48. ti84libs/graphics.py +840 -0
  49. ti84libs/keyboard.py +62 -0
  50. ti84libs/math.py +45 -0
  51. ti84libs/random.py +16 -0
  52. ti84libs/sprite.py +32 -0
  53. ti84libs/storage.py +56 -0
  54. tipy_asm-1.0.0.dist-info/METADATA +185 -0
  55. tipy_asm-1.0.0.dist-info/RECORD +59 -0
  56. tipy_asm-1.0.0.dist-info/WHEEL +5 -0
  57. tipy_asm-1.0.0.dist-info/entry_points.txt +6 -0
  58. tipy_asm-1.0.0.dist-info/licenses/LICENSE +21 -0
  59. tipy_asm-1.0.0.dist-info/top_level.txt +3 -0
ti84/__init__.py ADDED
@@ -0,0 +1,5 @@
1
+ """Editor-facing API declarations for TIpy calculator programs.
2
+
3
+ Calculator source is compiled with ``ti84py``; this package is provided for
4
+ editor completion and type checking, not for execution on a desktop Python.
5
+ """
ti84/__init__.pyi ADDED
@@ -0,0 +1,14 @@
1
+ """Built-in TIpy calculator libraries (editor declarations)."""
2
+
3
+ from . import color as color
4
+ from . import file as file
5
+ from . import font as font
6
+ from . import graph as graph
7
+ from . import graphics as graphics
8
+ from . import keyboard as keyboard
9
+ from . import math as math
10
+ from . import random as random
11
+ from . import sprite as sprite
12
+ from . import storage as storage
13
+
14
+ __all__ = ["color", "file", "font", "graph", "graphics", "keyboard", "math", "random", "sprite", "storage"]
ti84/color.pyi ADDED
@@ -0,0 +1,37 @@
1
+ """Color library type stubs for TIpy calculator programs.
2
+
3
+ These stubs describe the color library API for editor completion and type
4
+ checking. They do not provide desktop Python runtime implementations.
5
+ """
6
+
7
+ # RGB565 color constants
8
+ BLACK: int
9
+ WHITE: int
10
+ RED: int
11
+ GREEN: int
12
+ BLUE: int
13
+ YELLOW: int
14
+ CYAN: int
15
+ MAGENTA: int
16
+ ORANGE: int
17
+ PURPLE: int
18
+ GRAY: int
19
+ LIGHT_GRAY: int
20
+ DARK_GRAY: int
21
+ PALE_YELLOW: int
22
+ PALE_PINK: int
23
+ PALE_MINT: int
24
+ PEACH: int
25
+ MINT: int
26
+
27
+ # Monochrome constants
28
+ MONO_BLACK: int
29
+ MONO_WHITE: int
30
+
31
+ def from_rgb(r: int, g: int, b: int) -> int: ...
32
+ def to_grayscale(rgb565: int) -> int: ...
33
+ def to_mono(rgb565: int) -> int: ...
34
+ def from_mono(mono: int) -> int: ...
35
+ def is_valid(value: int) -> bool: ...
36
+ def invert(rgb565: int) -> int: ...
37
+ def blend(color1: int, color2: int, factor: float = 0.5) -> int: ...
ti84/file.pyi ADDED
@@ -0,0 +1,11 @@
1
+ """Persistent byte files backed by calculator AppVars (CE Flash Apps)."""
2
+
3
+ def exists(name: str) -> bool: ...
4
+ def size(name: str) -> int: ...
5
+ def create(name: str, size: int) -> None: ...
6
+ def delete(name: str) -> None: ...
7
+ def clear(name: str) -> None: ...
8
+ def read_byte(name: str, offset: int) -> int: ...
9
+ def write_byte(name: str, offset: int, value: int) -> None: ...
10
+ def read_u16(name: str, offset: int) -> int: ...
11
+ def write_u16(name: str, offset: int, value: int) -> None: ...
ti84/font.pyi ADDED
@@ -0,0 +1,13 @@
1
+ """Color constants only. FontLibC fonts are not implemented; use graphics.text()."""
2
+
3
+ BLACK: int
4
+ WHITE: int
5
+ RED: int
6
+ GREEN: int
7
+ BLUE: int
8
+ YELLOW: int
9
+ CYAN: int
10
+ MAGENTA: int
11
+ ORANGE: int
12
+ PURPLE: int
13
+ GRAY: int
ti84/graph.pyi ADDED
@@ -0,0 +1,4 @@
1
+ """Graphics drawing lifecycle functions."""
2
+
3
+ def begin() -> None: ...
4
+ def end() -> None: ...
ti84/graphics.pyi ADDED
@@ -0,0 +1,60 @@
1
+ """Screen drawing. This stub is the union of APIs from both backends.
2
+
3
+ Backend-only functions are annotated below. Pixel coordinates use (0, 0) at
4
+ the top left by default.
5
+ """
6
+
7
+ from typing import Literal
8
+
9
+ BLACK: int
10
+ WHITE: int
11
+ RED: int
12
+ GREEN: int
13
+ BLUE: int
14
+ YELLOW: int
15
+ CYAN: int
16
+ MAGENTA: int
17
+ ORANGE: int
18
+ PINK: int
19
+ PURPLE: int
20
+ MINT: int
21
+ PEACH: int
22
+ PALE_YELLOW: int
23
+ PALE_PINK: int
24
+ PALE_MINT: int
25
+ GRAY: int
26
+
27
+ # Run `tipy-asm api graphics` to see which targets support each call.
28
+ def begin() -> None: ...
29
+ def end() -> None: ...
30
+ def clear() -> None: ...
31
+ # Flash App backend only; on assembly targets, pass a color to each drawing call.
32
+ def set_color(color: int) -> int: ...
33
+ def fill_screen(color: int = ...) -> None: ...
34
+ def pixel(x: int, y: int, color: int = ...) -> None: ...
35
+ # Assembly targets only; Flash App sprite support is not implemented.
36
+ def sprite(pixels: tuple[tuple[int | None, ...], ...], x: int, y: int) -> None: ...
37
+ # CE assembly and Flash App only.
38
+ def get_pixel(x: int, y: int) -> int: ...
39
+ def line(x1: int, y1: int, x2: int, y2: int, color: int = ...) -> None: ...
40
+ def rect(x: int, y: int, width: int, height: int, color: int = ...) -> None: ...
41
+ def rectangle(x: int, y: int, width: int, height: int, color: int = ...) -> None: ...
42
+ def fill_rect(x: int, y: int, width: int, height: int, color: int = ...) -> None: ...
43
+ def fill_rectangle(x: int, y: int, width: int, height: int, color: int = ...) -> None: ...
44
+ def triangle(x1: int, y1: int, x2: int, y2: int, x3: int, y3: int, color: int = ...) -> None: ...
45
+ def circle(x: int, y: int, radius: int, color: int = ...) -> None: ...
46
+ def fill_circle(x: int, y: int, radius: int, color: int = ...) -> None: ...
47
+ def horiz_line(x: int, y: int, length: int, color: int = ...) -> None: ...
48
+ def vert_line(x: int, y: int, length: int, color: int = ...) -> None: ...
49
+ def text(string: str, x: int, y: int, color: int = ..., *, origin: Literal["center", "top_left"] = ...) -> None: ...
50
+ # CE assembly and Flash App only.
51
+ def text_int(value: int, x: int, y: int, color: int = ...) -> None: ...
52
+ # Assembly targets only; a simple delay loop.
53
+ def delay(count: int) -> None: ...
54
+ def wait_key() -> None: ...
55
+ # Flash App backend only.
56
+ def save_cursor(x: int, y: int) -> None: ...
57
+ def restore_cursor() -> None: ...
58
+ # Available on both backends; values depend on the selected target.
59
+ width: int
60
+ height: int
ti84/keyboard.pyi ADDED
@@ -0,0 +1,73 @@
1
+ """Calculator keypad input and key scan-code constants."""
2
+
3
+ DOWN: int
4
+ LEFT: int
5
+ RIGHT: int
6
+ UP: int
7
+ ENTER: int
8
+ ADD: int
9
+ SUB: int
10
+ MUL: int
11
+ DIV: int
12
+ POWER: int
13
+ CLEAR: int
14
+ CHS: int
15
+ DECPNT: int
16
+ VARS: int
17
+ RPAREN: int
18
+ TAN: int
19
+ GRAPHVAR: int
20
+ STORE: int
21
+ LN: int
22
+ LOG: int
23
+ SQUARE: int
24
+ RECIP: int
25
+ MATH: int
26
+ ALPHA: int
27
+ COS: int
28
+ PRGM: int
29
+ STAT: int
30
+ LPAREN: int
31
+ SIN: int
32
+ APPS: int
33
+ COMMA: int
34
+ KEY_0: int
35
+ KEY_1: int
36
+ KEY_2: int
37
+ KEY_3: int
38
+ KEY_4: int
39
+ KEY_5: int
40
+ KEY_6: int
41
+ KEY_7: int
42
+ KEY_8: int
43
+ KEY_9: int
44
+ GRAPH: int
45
+ TRACE: int
46
+ ZOOM: int
47
+ WINDOW: int
48
+ YEQU: int
49
+ SECOND: int
50
+ MODE: int
51
+ DEL: int
52
+ KEY_DOWN: int
53
+ KEY_LEFT: int
54
+ KEY_RIGHT: int
55
+ KEY_UP: int
56
+ KEY_ENTER: int
57
+ KEY_ADD: int
58
+ KEY_SUB: int
59
+ KEY_MUL: int
60
+ KEY_DIV: int
61
+ KEY_POWER: int
62
+ KEY_CLEAR: int
63
+ KEY_GRAPH: int
64
+ KEY_TRACE: int
65
+ KEY_ZOOM: int
66
+ KEY_WINDOW: int
67
+ KEY_YEQU: int
68
+ KEY_SECOND: int
69
+ KEY_MODE: int
70
+ KEY_DEL: int
71
+ def read() -> int: ...
72
+ def get() -> int: ...
73
+ def is_down(key: int) -> bool: ...
ti84/math.pyi ADDED
@@ -0,0 +1,11 @@
1
+ """Integer math helpers. Available functions depend on the selected backend."""
2
+
3
+ def abs(value: int) -> int: ...
4
+ def min(a: int, b: int) -> int: ...
5
+ def max(a: int, b: int) -> int: ...
6
+ def clamp(value: int, low: int, high: int) -> int: ...
7
+ def sqrt(value: int) -> int: ...
8
+ def pow(base: int, exponent: int) -> int: ...
9
+ def sign(value: int) -> int: ...
10
+ def sin(degrees: int) -> int: ...
11
+ def cos(degrees: int) -> int: ...
ti84/py.typed ADDED
@@ -0,0 +1 @@
1
+
ti84/random.pyi ADDED
@@ -0,0 +1,5 @@
1
+ """Deterministic pseudo-random helpers."""
2
+
3
+ def seed(value: int) -> None: ...
4
+ def randrange(limit: int) -> int: ...
5
+ def randint(low: int, high: int) -> int: ...
ti84/sprite.pyi ADDED
@@ -0,0 +1,10 @@
1
+ """Sprites stored in AppVars, built by a project's [[tool.tipy.assets]]. CE assembly only.
2
+
3
+ A sprite value is the address of its data, or 0 if the AppVar was not found.
4
+ Use graphics.sprite() for literal sprites on the classic target.
5
+ """
6
+
7
+ def load(name: str) -> int: ...
8
+ def draw(sprite: int, x: int, y: int) -> None: ...
9
+ def width(sprite: int) -> int: ...
10
+ def height(sprite: int) -> int: ...
ti84/storage.pyi ADDED
@@ -0,0 +1,11 @@
1
+ """Byte storage backed by named calculator AppVars.
2
+
3
+ exists(), size(), and delete() are assembly-only; ti84.file has them on both backends.
4
+ """
5
+
6
+ def create(name: str, size: int) -> None: ...
7
+ def exists(name: str) -> bool: ...
8
+ def size(name: str) -> int: ...
9
+ def delete(name: str) -> None: ...
10
+ def read_byte(name: str, offset: int) -> int: ...
11
+ def write_byte(name: str, offset: int, value: int) -> None: ...
ti84asm/__init__.py ADDED
@@ -0,0 +1 @@
1
+ """Compiler core package for TIpy-asm."""
ti84asm/__main__.py ADDED
@@ -0,0 +1,3 @@
1
+ from .cli import main
2
+
3
+ raise SystemExit(main())
@@ -0,0 +1,58 @@
1
+ """Wrapper for CEdev's cedev-config tool.
2
+
3
+ This provides a pure-Python interface to query CEdev configuration,
4
+ falling back to calling the actual cedev-config binary when needed.
5
+ """
6
+
7
+ from __future__ import annotations
8
+
9
+ import subprocess
10
+ import sys
11
+ from pathlib import Path
12
+
13
+ from .errors import CompileError
14
+
15
+
16
+ def _call_cedev_config(*args: str) -> str:
17
+ """Call the cedev-config binary and return its stdout."""
18
+ try:
19
+ cedev_config = "cedev-config"
20
+ if sys.platform == "win32":
21
+ # Try to find it in common locations on Windows
22
+ for path in ["C:\\CEDev\\bin\\cedev-config.exe", "C:\\CEDev\\cedev-config.exe"]:
23
+ if Path(path).is_file():
24
+ cedev_config = path
25
+ break
26
+ result = subprocess.run([cedev_config, *args], capture_output=True, text=True, check=True)
27
+ return result.stdout.strip()
28
+ except (subprocess.CalledProcessError, FileNotFoundError) as exc:
29
+ raise CompileError(f"cedev-config not found or failed: {exc}") from exc
30
+
31
+
32
+ def get_version() -> str:
33
+ """Get the CE C/C++ Toolchain version."""
34
+ return _call_cedev_config("--version")
35
+
36
+
37
+ def get_prefix() -> str:
38
+ """Get the installation prefix."""
39
+ return _call_cedev_config("--prefix")
40
+
41
+
42
+ def get_makefile() -> str:
43
+ """Get the path to the core toolchain makefile."""
44
+ return _call_cedev_config("--makefile")
45
+
46
+
47
+ def run(args: list[str]) -> str:
48
+ """Run cedev-config with the given arguments and return stdout."""
49
+ if not args:
50
+ raise CompileError("cedev-config requires at least one option")
51
+ return _call_cedev_config(*args)
52
+
53
+
54
+ def add_arguments(parser):
55
+ """Add cedev-config command arguments."""
56
+ parser.add_argument("option", nargs="?",
57
+ choices=["--version", "--prefix", "--makefile", "--help"],
58
+ help="configuration option to query")