Files
gw-basic-2026/tests/programs/caesar_cipher.bas
Eremey Valetov 1f4c460f4f Phase 5: CI, terminal I/O, Sixel graphics, classic programs
Add GitHub Actions CI with automated build and test. Implement real
terminal I/O with raw mode (enable_raw/disable_raw, proper INKEY$
polling via VMIN=0/VTIME=0, INPUT$ function). Add Sixel graphics
engine with virtual framebuffer (SCREEN 1: 320x200, SCREEN 2:
640x200), Bresenham line drawing, midpoint circle, flood fill PAINT,
DRAW mini-language parser, and Sixel encoder with RLE. Replace all
graphics stubs with real implementations (PSET, LINE, CIRCLE, DRAW,
PAINT, COLOR, SCREEN, POINT). Fix AND/OR/XOR operator precedence
to be lower than relational operators. Add 13 classic test programs
(39 total). Bump version to 0.5.0.
2026-02-10 16:46:34 -05:00

20 lines
521 B
QBasic

10 REM Caesar cipher - encode and decode
20 MG$ = "HELLO WORLD"
30 SH% = 13
40 GOSUB 200
50 PRINT "Encoded: "; R$
60 EN$ = R$
70 MG$ = EN$ : SH% = -13
80 GOSUB 200
90 PRINT "Decoded: "; R$
100 IF R$ = "HELLO WORLD" THEN PRINT "Caesar cipher OK" ELSE PRINT "FAIL"
110 END
200 REM Encode MG$ by SH% into R$
210 R$ = ""
220 FOR I = 1 TO LEN(MG$)
230 C% = ASC(MID$(MG$, I, 1))
240 IF C% >= 65 AND C% <= 90 THEN C% = (C% - 65 + SH% + 26) - INT((C% - 65 + SH% + 26) / 26) * 26 + 65
250 R$ = R$ + CHR$(C%)
260 NEXT I
270 RETURN