BASIC: DO … LOOP, EXIT, ELSE, block IF and SELECT CASE
DO WHILE/UNTIL … LOOP WHILE/UNTIL, EXIT DO and EXIT FOR; IF … THEN … ELSE on one line; block IF … ELSEIF … ELSE … END IF; SELECT CASE with values, ranges and IS comparisons, numeric or string. RENUM also fixes line numbers after ELSE. basic/test-blocks.py checks them; the manual and README cover them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
fd876fd44d
commit
79aef8ed38
7 files changed
+2216
-1756
No files matched your search
@@ -14,7 +14,8 @@ RISC-V processor written from scratch in Verilog:
|
||||
- **USB keyboard** on the board's USB host port, with a keys-held port for
|
||||
games.
|
||||
- **Files** saved in the board's configuration flash.
|
||||
- **Software**: Dartmouth-style BASIC with graphics, sound and files, a
|
||||
- **Software**: Dartmouth-style BASIC with graphics, sound and files, and
|
||||
`DO … LOOP`, block `IF … ELSE … END IF` and `SELECT CASE`; a
|
||||
machine-code monitor with a RISC-V disassembler and assembler, and five
|
||||
original games.
|
||||
|
||||
@@ -152,7 +153,9 @@ uses 49.5 of the XC7A35T's 50.
|
||||
All in C (plus a little assembly), compiled with GCC:
|
||||
|
||||
- `basic/` — BASIC, with single-precision arithmetic on the FPU (`rv32imf`,
|
||||
`ilp32f`), correctly rounded. `lib/` has the few C library functions it
|
||||
`ilp32f`), correctly rounded, and the structured statements of later
|
||||
Dartmouth BASIC and True BASIC (`DO … LOOP`, `EXIT`, block `IF`, `SELECT
|
||||
CASE`). `lib/` has the few C library functions it
|
||||
needs (small string functions, `setjmp`, and `sinf` … `sqrtf`), since
|
||||
newlib's bring in its stdio and malloc.
|
||||
- `monitor/` — the machine-code monitor: memory, registers (integer and
|
||||
@@ -193,7 +196,7 @@ the configuration flash.
|
||||
| `scripts/cputest.sh` | the official [riscv-tests](https://github.com/riscv-software-src/riscv-tests) (`rv32ui`, `rv32um`, `rv32uf`, `rv32mi`, fetched into `third_party/`) and `tests/` (interrupts, the NMI and single step) on `rv32_cpu.v` in xsim, with random wait states on the data bus. Two riscv-tests don't apply: `ma_data` expects misaligned loads and stores to work (here they trap, as the spec allows) and `pmpaddr` needs PMP. |
|
||||
| `scripts/sim.sh` | the whole design in xsim: the terminal, BASIC, both graphics modes, sprites, scrolling, flash files, the monitor (step, breakpoint, Pause, memory files, the assembler, Intel HEX), 3 Mbaud. `scripts/sim.sh quick` skips the terminal and the monitor; `wide` checks the 132 × 64 start-up. |
|
||||
| `monitor/test-disasm.py`, `test-asm.py` | the disassembler against GNU objdump on thousands of random instructions, and the assembler against GNU as |
|
||||
| `basic/test-*.py`, `games/*/test-*.py` | BASIC's line editor, RENUM, string arrays and graphics modes, and each game, on `tools/rv32emu.py` (a Python RV32IMF emulator of the machine; `tools/boardemu.py` models the game hardware). They need `pyte` and Pillow. |
|
||||
| `basic/test-*.py`, `games/*/test-*.py` | BASIC's line editor, RENUM, string arrays, block structures and graphics modes, and each game, on `tools/rv32emu.py` (a Python RV32IMF emulator of the machine; `tools/boardemu.py` models the game hardware). They need `pyte` and Pillow. |
|
||||
| `bench/` | the processor alone with 64 KB of RAM, for timing |
|
||||
|
||||
## Toolchain
|
||||
|
||||
Reference in new issue
Block a user