Add a 640x480 two-colour graphics mode; start in white

The graphics memory doubles as 640x480 at a bit a pixel (port 38), four
pixels to an entry, plotted by read-modify-write, in two colours from
port 39 (0 transparent). BASIC gets SCREEN 0 / SCREEN 1 [,set[,clear]];
a plain fill (as every game does) returns to 320x240 and BASIC follows.
The text now starts in white (SW5:4 = 00; 10 is green). The README is
rewritten to stand on its own.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
brad ArantandClaude Opus 5.5 committed 2026-12-01 06:06:30 -08:00
1 parent 71fd403294
commit bda9bb67b6
13 files changed
+2985 -2680

No files matched your search

+41 -10
View File
@@ -367,8 +367,8 @@ machine-code monitor (section 10). See section 9 for memory and ports.
### Graphics and text placement
`CLS`, `COLOR`, `PLOT`, `LINE`, `RECT`, `FILL`, `CIRCLE`, `LOCATE` and `INK`
are described in sections 7 and 8.
`CLS`, `SCREEN`, `COLOR`, `PLOT`, `LINE`, `RECT`, `FILL`, `CIRCLE`, `LOCATE`
and `INK` are described in sections 7 and 8.
## 6. Functions
@@ -409,7 +409,7 @@ A whole number from 1 to 6: `1 + INT(RND * 6)`.
| `TIM` | Seconds since the computer was reset, to the millisecond |
| `DATE$` | The date and time as `"2026-11-28 09:30:15"`, or `""` if not set (section 11) |
| `EOF(N)` | -1 (true) when file *N* has been read to the end, else 0 (section 11) |
| `POINT(X, Y)` | Colour of the graphics pixel at *X, Y* (0 off screen) |
| `POINT(X, Y)` | Colour of the graphics pixel at *X, Y* (0 off screen; 0 or 1 in `SCREEN 1`) |
| `PEEK(A)` | Byte at memory address *A* |
| `INP(P)` | Byte from I/O port *P* |
@@ -422,11 +422,12 @@ A whole number from 1 to 6: `1 + INT(RND * 6)`.
## 7. Graphics
The screen has a graphics layer **320 pixels wide and 240 high in 16 colours**.
It is mixed with the 80×30 text:
The screen has a graphics layer **320 pixels wide and 240 high in 16 colours**,
or, after `SCREEN 1`, **640 by 480 in two** (see below). It is mixed with the
text:
- **Coordinates:** *X* runs from 0 at the left to 319, and *Y* from 0 at the
top to 239. Each graphics pixel is a 2×2 block on the monitor.
top to 239. Each graphics pixel is a 4×4 block on the monitor.
- **Mixing with text:** text characters are drawn on top of the graphics. The
graphics show through wherever the text screen is blank.
- **Colour 0** is "no graphics": it shows the text background, normally black.
@@ -478,6 +479,34 @@ by `COLOR` is used, initially 15 (white).
70 RECT 20, 120, 300, 230, 7
```
### 640 × 480 in two colours
The same graphics memory holds 640 × 480 pixels at one bit each, twice the
detail across and down in two colours:
| Statement | |
|---|---|
| `SCREEN 1 [, S [, C]]` | 640 × 480: *X* 0–639, *Y* 0–479, each pixel a 2×2 block on the monitor. Set pixels show in colour *S* (15, white, if left out), clear ones in *C* (0, transparent, if left out) |
| `SCREEN 0` | Back to 320 × 240 in 16 colours (the mode at power-up) |
Both clear the graphics. In `SCREEN 1` every drawing statement sets pixels
in any colour but 0 and clears them in colour 0, so `COLOR`, `PLOT`, `LINE`,
`RECT`, `FILL` and `CIRCLE` work unchanged; `POINT` gives 1 or 0. `CLS` clears
the graphics and stays in the mode. With a clear colour other than 0 the whole
picture area is that colour, under the text.
```
10 SCREEN 1, 10
20 FOR A = 0 TO 6.28 STEP .02
30 LINE 320, 240, 320 + 300*COS(A), 240 + 230*SIN(3*A)
40 NEXT A
```
The mode doesn't scroll (the scroll registers and the border are ignored).
Sprites still work, on the 320 × 240 grid, and a sprite counts as touching
the graphics where a set pixel is within the 4 × 1 group of pixels under it. A
game started with `CALL` goes back to 320 × 240; BASIC notices.
### Animation
Erase something by drawing it again in colour 0, then draw it in its new
@@ -662,10 +691,12 @@ compare value, 10h and 14h the monitor's breakpoint addresses.
| 16–19 | the millisecond counter, low byte first (reading 16 freezes the other three) | — |
| 32 | — | right two digits of the 7-segment display (hex) |
| 33 | — | left two digits of the 7-segment display |
| 48, 49, 50 | — | graphics X (low byte, high bit), Y |
| 51 | colour at X, Y | plot a pixel at X, Y and move right |
| 52 | bit 0: screen fill in progress | fill the whole graphics layer with a colour; also hides the sprites and resets the scroll, unless 128 is added |
| 48, 49, 50 | — | graphics X low byte; X bits 8–9 (1, 2) and Y bit 8 (4); Y low byte |
| 51 | colour at X, Y (0 or 1 in 640 × 480) | plot a pixel at X, Y and move right (in 640 × 480 any colour but 0 sets it) |
| 52 | bit 0: screen fill in progress | fill the whole graphics layer with a colour; also hides the sprites, resets the scroll and goes back to 320 × 240, unless 128 is added |
| 53, 54, 55 | — | graphics scroll and border (section 7) |
| 56 | bit 0: 640 × 480 mode | 1: 640 × 480 in two colours, 0: 320 × 240 in 16 |
| 57 | — | 640 × 480 colours: set pixels' colour + 16 × clear pixels' colour |
| 64 | bit 0: flash byte in progress; bit 1: last flash command refused | 1 selects the flash and starts a command, 0 ends it |
| 65 | the byte the flash sent back during the last `OUT 65` | a byte to the flash |
| 96 | why the monitor was entered (used by the monitor) | single step (used by the monitor) |
@@ -1407,7 +1438,7 @@ while keeping the cave connected, mirrored and free of dead ends
| Arrays | A–Z, 1 or 2 subscripts, up to 6000 elements each |
| User functions | FNA–FNZ, one argument each |
| FOR nesting / GOSUB nesting | 16 / 32 |
| Graphics | 320 × 240, 16 colours |
| Graphics | 320 × 240 in 16 colours, or 640 × 480 in 2 |
| Sprites | 32 on screen, 64 shapes, 16 × 16 pixels each |
| Text | 80 × 32, or 132 × 64 |
| Files in flash | 64, 1,784 KB in all, 32 KB each |