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>
18 lines
669 B
Bash
Executable File
18 lines
669 B
Bash
Executable File
#!/bin/bash
|
|
# Run the testbench in Vivado's simulator; output lands in sim/work.
|
|
set -e
|
|
cd "$(dirname "$0")/.."
|
|
ROOT=$(pwd)
|
|
source scripts/vivado_env.sh
|
|
mkdir -p sim/work
|
|
cd sim/work
|
|
xvlog -d SIMULATION -d FONT_FILE="\"$ROOT/font/font.mem\"" -d MEM_FILE="\"$ROOT/basic/basic.mem\"" "$ROOT"/rtl/*.v "$ROOT"/sim/spiflash_model.v "$ROOT"/sim/tb_terminal.v
|
|
xelab -debug off tb_terminal -s tb_terminal
|
|
xsim tb_terminal -R
|
|
if command -v python3 >/dev/null; then
|
|
for f in frame_*.ppm; do
|
|
python3 -c "import sys; from PIL import Image; Image.open(sys.argv[1]).save(sys.argv[2])" \
|
|
"$f" "${f%.ppm}.png" && echo "wrote sim/work/${f%.ppm}.png"
|
|
done
|
|
fi
|