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:
Eremey Valetov
2026-03-10 22:20:58 -04:00
parent 4551c88a50
commit 0bacfcef6c
15 changed files with 478 additions and 47 deletions
+15
View File
@@ -50,6 +50,21 @@ void gfx_sprite_put(int x, int y, const int16_t *buf, int bufsize, int action);
/* Calculate required array element count for a sprite rectangle. */
int gfx_sprite_size(int x1, int y1, int x2, int y2);
/* VIEW / WINDOW / PALETTE */
void gfx_view(bool screen_flag, int x1, int y1, int x2, int y2,
int fill, bool has_fill, int border, bool has_border);
void gfx_view_reset(void);
void gfx_window(bool screen_flag, double x1, double y1, double x2, double y2);
void gfx_window_reset(void);
void gfx_palette_set(int attr, int color);
void gfx_palette_reset(void);
/* Coordinate mapping (logical ↔ physical) */
int gfx_map_x(double x);
int gfx_map_y(double y);
double gfx_pmap(double coord, int func);
bool gfx_has_window(void);
/* CGA framebuffer PEEK/POKE (segment 0xB800 in graphics mode) */
uint8_t gfx_cga_peek(uint16_t offset);
void gfx_cga_poke(uint16_t offset, uint8_t val);