Commit Graph
3 Commits
Author SHA1 Message Date
brad ArantandClaude Opus 5.5 767377f38d BASIC: file dates and data files
DATE "YYYY-MM-DD[ HH:MM[:SS]]" sets a clock kept from the millisecond
counter, DATE prints it and DATE$ returns it. Directory entries now
record each file's creation date (format BFS2; a BFS1 directory is
widened when read), and DIR shows it. send-bas.py and get-bas.py set
the date from the PC when they connect (--no-date to skip).

Data files: OPEN "NAME" FOR INPUT|OUTPUT|APPEND AS #n (n = 1-3),
PRINT #n, INPUT #n, LINE INPUT [#n,], EOF(n), CLOSE [#n]. SAVE and LOAD
now use the same channel code. A written file replaces the old one only
at CLOSE; APPEND shares the old file's full blocks and copies the last
part block. New errors FILE ALREADY OPEN, FILE NOT OPEN, INPUT PAST END;
PROGRAM TOO BIG TO SAVE becomes FILE TOO BIG.

The program area shrinks from 23000 to 22100 bytes to keep the stack
at about 3 KB beside the file buffers. Code now ends at 7EBFh.

The simulation sets the date, checks it in DIR and round-trips a data
file, waiting for expected rows instead of fixed delays. Tested on the
board: dates, write/append/read, EOF, the BFS1 conversion.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-28 08:50:15 -08:00
brad ArantandClaude Opus 5.5 29a15bf7c7 Flash file system for BASIC, with bitstream write protection
BASIC gets SAVE, LOAD, RUN "NAME", DIR and DEL, storing program listings
in the configuration flash from 240000h (448 x 4 KB blocks, 64 files,
32 KB each). The directory is kept in two alternating blocks with a
sequence number and checksum, new data is written before the directory
switches to it, and every page is verified after programming.

rtl/flash_spi.v drives the flash through STARTUPE2 on ports 40h/41h. It
only passes read, status, WREN/WRDI, RDID, page program and 4 KB erase,
and abandons any program or erase below 240000h before the address
reaches the chip. Tested on the board: an erase at 0 and a write at
200000h were refused and left the flash unchanged.

With SW14 up, the Z-80's output is also copied to the PC's serial port,
and tools/get-bas.py uses that to LIST a program into a file or run
commands and print the replies.

Also fixes port 10h returning the previous millisecond latch (the first
read after reset was undefined). Simulation adds a model flash and a
save/load/run/protection test. Manual and README updated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-28 08:33:52 -08:00
brad ArantandClaude Opus 5.5 dc7c7c22c5 BASIC graphics: 320x240 16-colour layer, manual and demo
- z80_system: dual-clock graphics RAM behind ports 30h-34h (X/Y, plot
  with auto-increment, read-back, hardware fill); text_display overlays it
  under the text, colour 0 transparent.
- BASIC: CLS COLOR PLOT LINE RECT FILL CIRCLE POINT, LOCATE and INK;
  faster keyword tokenizing.
- docs/basic-manual.md (+ PDF via docs/build-manual.sh).
- basic/examples/graphics-demo.bas and tools/send-bas.py to load programs
  over the serial port.
- Simulation checks drawing and saves a frame; the emulator models the
  graphics and timer ports and can stop when BASIC waits for input.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 21:09:43 -08:00