(from Gemini)
The NES has exactly 2KB of internal work RAM. In traditional assembly or C environments, developers heavily rely on memory overlays—sharing the same RAM addresses for different variables depending on the game state (e.g., the Title Screen variables occupy the same memory as the Level 1 Enemy Data).
What's missing: NEScript provides struct and fixed-size arrays, but there is no native construct for a union or automatic memory overlaying.
The fix: Since the compiler already has state machine constructs (state Title { ... }), the compiler could do static lifecycle analysis to automatically overlay local variables that belong to mutually exclusive states, drastically reducing the global RAM footprint.
(from Gemini)
The NES has exactly 2KB of internal work RAM. In traditional assembly or C environments, developers heavily rely on memory overlays—sharing the same RAM addresses for different variables depending on the game state (e.g., the Title Screen variables occupy the same memory as the Level 1 Enemy Data).
What's missing: NEScript provides struct and fixed-size arrays, but there is no native construct for a union or automatic memory overlaying.
The fix: Since the compiler already has state machine constructs (state Title { ... }), the compiler could do static lifecycle analysis to automatically overlay local variables that belong to mutually exclusive states, drastically reducing the global RAM footprint.