Files
gw-basic-2026/tests/programs/view_window.bas
Eremey Valetov 0bacfcef6c 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).
2026-03-10 22:20:58 -04:00

22 lines
612 B
QBasic

10 REM VIEW / WINDOW / PALETTE test
20 SCREEN 2
30 REM Test WINDOW coordinate mapping
40 WINDOW (0,0)-(100,100)
50 REM PMAP: logical to physical
60 PRINT "PMAP(0,0)="; PMAP(0,0)
70 PRINT "PMAP(0,1)="; PMAP(0,1)
80 PRINT "PMAP(100,0)="; PMAP(100,0)
90 PRINT "PMAP(100,1)="; PMAP(100,1)
100 REM PMAP: physical to logical
110 PRINT "PMAP(0,2)="; PMAP(0,2)
120 PRINT "PMAP(199,3)="; PMAP(199,3)
130 WINDOW
140 REM Test VIEW
150 VIEW (10,10)-(100,50)
160 REM After VIEW, drawing clips to viewport
170 VIEW
180 REM Test PALETTE (just reset, no visual check)
190 PALETTE
200 SCREEN 0
210 PRINT "VIEW/WINDOW/PALETTE OK"