Files
gw-basic-2026/tests/programs/mbf_format.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

23 lines
672 B
QBasic

10 REM MBF format conversion test
20 REM Test MKS$/CVS roundtrip
30 PRINT CVS(MKS$(0))
40 PRINT CVS(MKS$(1))
50 PRINT CVS(MKS$(-1))
60 PRINT CVS(MKS$(3.14))
70 PRINT CVS(MKS$(100.5))
80 REM Test MKD$/CVD roundtrip
90 PRINT CVD(MKD$(0#))
100 PRINT CVD(MKD$(1#))
110 PRINT CVD(MKD$(-1#))
120 PRINT CVD(MKD$(3.14#))
130 REM Test MKI$/CVI roundtrip
140 PRINT CVI(MKI$(0))
150 PRINT CVI(MKI$(32767))
160 PRINT CVI(MKI$(-32768))
170 PRINT CVI(MKI$(-1))
180 REM Test MBF byte encoding
190 REM MKS$(1) in MBF should be: 00 00 00 81 (exponent=129, mantissa=0.5)
200 A$ = MKS$(1)
210 PRINT ASC(MID$(A$,1,1)); ASC(MID$(A$,2,1)); ASC(MID$(A$,3,1)); ASC(MID$(A$,4,1))
220 PRINT "DONE"