Z-80 computer with Dartmouth-style BASIC as the terminal's console
SW15 switches the terminal from the PC's serial line to a Z-80 running at 90 MHz from its own clock, with 64 KB of block RAM preloaded with BASIC. - rtl/z80_cpu.v: Z-80 built for speed (one clock per memory access, next byte read during decode), full documented instruction set plus the common undocumented forms; no interrupts. - rtl/z80_system.v: RAM, console/timer/7-segment ports, toggle handshakes to the terminal clock. - basic/: BASIC interpreter in C for SDCC, start-up code, prebuilt image. - tools/z80emu.py, tools/cputest.py, scripts/cpusim.sh: reference emulator and random tests comparing the CPU after every instruction. - SW14 feeds the PC's UART into the Z-80 for pasting programs; BTND resets the Z-80 only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
1e4e2101b8
commit
59d5e617f2
20 files changed
+68756
-48
No files matched your search
Binary file not shown.
+1265
File diff suppressed because it is too large.
Load diff
+65536
File diff suppressed because it is too large.
Load diff
Executable
+9
@@ -0,0 +1,9 @@
|
||||
#!/bin/bash
|
||||
# Compile BASIC for the Z-80 and write basic.mem (64 KB RAM image) and basic.bin.
|
||||
set -e
|
||||
cd "$(dirname "$0")"
|
||||
mkdir -p out
|
||||
sdasz80 -plosgff out/crt0.rel crt0.s
|
||||
sdcc -mz80 --opt-code-speed --max-allocs-per-node 20000 --std-sdcc11 -c -o out/basic.rel basic.c
|
||||
sdcc -mz80 --no-std-crt0 --code-loc 0x0080 --data-loc 0x8000 -o out/basic.ihx out/crt0.rel out/basic.rel
|
||||
python3 ../tools/ihx2mem.py out/basic.ihx basic.bin basic.mem
|
||||
@@ -0,0 +1,50 @@
|
||||
;; Start-up code for BASIC on the Basys 3 Z-80: stack at the top of RAM,
|
||||
;; copy initialised data, clear BSS, run main.
|
||||
.module crt0
|
||||
.globl _main
|
||||
.globl l__INITIALIZER, s__INITIALIZER, s__INITIALIZED
|
||||
.globl l__DATA, s__DATA
|
||||
|
||||
.area _HEADER (ABS)
|
||||
.org 0x0000
|
||||
di
|
||||
ld sp, #0x0000
|
||||
call gsinit
|
||||
call _main
|
||||
halt
|
||||
|
||||
.area _HOME
|
||||
.area _CODE
|
||||
.area _INITIALIZER
|
||||
.area _GSINIT
|
||||
.area _GSFINAL
|
||||
.area _DATA
|
||||
.area _INITIALIZED
|
||||
.area _BSEG
|
||||
.area _BSS
|
||||
.area _HEAP
|
||||
|
||||
.area _GSINIT
|
||||
gsinit:
|
||||
ld bc, #l__DATA ; clear uninitialised data
|
||||
ld a, b
|
||||
or a, c
|
||||
jr z, 1$
|
||||
ld hl, #s__DATA
|
||||
ld (hl), #0
|
||||
dec bc
|
||||
ld a, b
|
||||
or a, c
|
||||
jr z, 1$
|
||||
ld de, #s__DATA + 1
|
||||
ldir
|
||||
1$: ld bc, #l__INITIALIZER ; copy initialised data
|
||||
ld a, b
|
||||
or a, c
|
||||
jr z, 2$
|
||||
ld de, #s__INITIALIZED
|
||||
ld hl, #s__INITIALIZER
|
||||
ldir
|
||||
2$:
|
||||
.area _GSFINAL
|
||||
ret
|
||||
Reference in new issue
Block a user