Implement VIEW/WINDOW/PALETTE, PMAP, fix MBF float format, update to v0.13.0
Graphics viewport and coordinate mapping: - VIEW [[SCREEN] (x1,y1)-(x2,y2) [,[fill][,border]]] with clipping - WINDOW [[SCREEN] (x1,y1)-(x2,y2)] with Cartesian/screen modes - PALETTE [attribute, color] with CGA 16-color remapping - PMAP(coord, func) for logical/physical coordinate conversion - All graphics statements (PSET, LINE, CIRCLE, PAINT, GET/PUT) respect viewport clipping and WINDOW coordinate mapping MBF (Microsoft Binary Format) float support: - CVS/CVD now interpret bytes as MBF format (compatible with real GW-BASIC) - MKS$/MKD$ now produce MBF-encoded bytes - Fixed shift errors in MBF↔IEEE conversion routines (single: 1→0, double: 4→3) - Random-access file I/O now byte-compatible with original GWBASIC.EXE 66 tests (2 new), 61 compat matches (up from 58).
This commit is contained in:
+3
-2
@@ -16,10 +16,11 @@
|
||||
| 0.10.0 | | Binary tokenized SAVE/LOAD, INKEY$ extended key sequences, golden-file regression tests, classic BASIC programs |
|
||||
| 0.11.0 | | DEF SEG / PEEK / POKE virtual memory, GET/PUT graphics sprites, PRINT USING fixes |
|
||||
| 0.12.0 | | BSAVE/BLOAD, TUI ANSI 16-color rendering, CGA graphics framebuffer PEEK/POKE, keyboard shift flags |
|
||||
| 0.13.0 | | VIEW/WINDOW/PALETTE graphics, PMAP function, MBF float format for CVS/CVD/MKS$/MKD$ |
|
||||
|
||||
## Tests
|
||||
|
||||
64 test programs in `tests/programs/`, plus 4 classic interactive programs in
|
||||
66 test programs in `tests/programs/`, plus 4 classic interactive programs in
|
||||
`tests/classic/` (Hamurabi, Lunar Lander, Gunner, Diamond from David Ahl's
|
||||
*BASIC Computer Games*).
|
||||
|
||||
@@ -29,7 +30,7 @@ Run the full automated suite:
|
||||
bash tests/run_tests.sh
|
||||
```
|
||||
|
||||
Each test has a 5-second timeout. 60 tests have `.expected` golden files
|
||||
Each test has a 5-second timeout. 62 tests have `.expected` golden files
|
||||
for output regression detection. Three timing-dependent tests (datetime,
|
||||
on_timer, timer_stop) and one visual test (color_test) run without golden
|
||||
comparison.
|
||||
|
||||
@@ -57,7 +57,7 @@ type suffixes (`%`, `!`, `#`)
|
||||
| File management | `KILL`, `NAME`, `FILES`, `MKDIR`, `RMDIR`, `CHDIR`, `SHELL` |
|
||||
| Date/time | `DATE$`, `TIME$`, `TIMER` |
|
||||
| Screen | `LOCATE`, `COLOR`, `WIDTH`, `SCREEN`, `KEY ON`/`OFF`/`LIST`, `KEY n,"string"` |
|
||||
| Graphics | `PSET`, `PRESET`, `LINE`, `CIRCLE`, `DRAW`, `PAINT`, `GET`, `PUT` |
|
||||
| Graphics | `PSET`, `PRESET`, `LINE`, `CIRCLE`, `DRAW`, `PAINT`, `GET`, `PUT`, `VIEW`, `WINDOW`, `PALETTE`, `PMAP` |
|
||||
| Sound | `SOUND`, `BEEP`, `PLAY` (MML parser, PulseAudio backend) |
|
||||
| Memory | `DEF SEG`, `PEEK`, `POKE`, `BSAVE`, `BLOAD` |
|
||||
| Misc | `KEY`, `TRON`/`TROFF`, `OPTION BASE`, `MID$` assignment |
|
||||
@@ -158,6 +158,20 @@ Sprite data is stored in CGA-compatible packed format: word 0 is the width
|
||||
in bits, word 1 is the height, and remaining words contain packed pixel data
|
||||
matching the original GW-BASIC representation.
|
||||
|
||||
### VIEW / WINDOW / PALETTE
|
||||
|
||||
- `VIEW [[SCREEN] (x1,y1)-(x2,y2) [,[fill][,border]]]` — define a graphics
|
||||
viewport. Without `SCREEN`, drawing coordinates are relative to the
|
||||
viewport origin. With `SCREEN`, coordinates remain absolute. Without
|
||||
arguments, resets to full screen.
|
||||
- `WINDOW [[SCREEN] (x1,y1)-(x2,y2)]` — map logical coordinates onto the
|
||||
viewport. Without `SCREEN`, Y increases upward (Cartesian); with `SCREEN`,
|
||||
Y increases downward. Without arguments, resets to physical coordinates.
|
||||
- `PALETTE [attribute, color]` — remap a color attribute to a different
|
||||
physical color (0–15). Without arguments, resets to the default CGA palette.
|
||||
- `PMAP(coordinate, function)` — convert between logical and physical
|
||||
coordinates. Function 0/1 = logical→physical X/Y; 2/3 = physical→logical X/Y.
|
||||
|
||||
### Example
|
||||
|
||||
```
|
||||
|
||||
@@ -15,8 +15,6 @@
|
||||
bus so retro programs that talk to the speaker, joystick port, or parallel
|
||||
interface can do *something* useful instead of silently no-oping. Think of it
|
||||
as a tiny museum exhibit for vintage BASIC hardware hacking.
|
||||
- **VIEW / WINDOW / PALETTE** — graphics viewport, coordinate mapping, and
|
||||
palette remapping
|
||||
- **MBF format support for binary LOAD** — convert Microsoft Binary Format
|
||||
float constants when loading files saved by the original GWBASIC.EXE
|
||||
|
||||
@@ -36,8 +34,6 @@
|
||||
|
||||
## Known Limitations
|
||||
|
||||
- Binary files use IEEE 754 floats, not MBF — files saved here are not
|
||||
byte-compatible with original GWBASIC.EXE binary format
|
||||
- String garbage collection not implemented (uses `malloc`/`free` instead)
|
||||
- Maximum 256 variables, 64 arrays, 16 FOR nesting, 24 GOSUB nesting,
|
||||
16 WHILE nesting
|
||||
|
||||
Reference in New Issue
Block a user