The Basys 3 Z-80 computer with the Z-80 replaced by an RV32IM processor written from scratch (rtl/rv32_cpu.v): multi-cycle, 90 MHz, CSRs and traps, interrupts, two hardware triggers and a resumable NMI for the monitor. Passes riscv-tests rv32ui/um/mi. rv32_system.v keeps all the Z-80 machine's peripherals, with I/O port N at FFFFFF00h + N, 80 KB of RAM with BASIC preloaded, and a 32 KB monitor ROM. BASIC, the five games and the monitor (with an RV32 disassembler, assembler, breakpoints and single step) are ported to RISC-V GCC. Python emulator and tests in tools/; full-system simulation in sim/. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
27 lines
937 B
QBasic
27 lines
937 B
QBasic
10 REM SOUND DEMO - NEEDS A PMODAMP2 ON THE TOP ROW OF PMOD JA
|
|
20 REM PITCH = 125000 / FREQUENCY. PORTS: 144-149 PITCHES, 150 NOISE,
|
|
30 REM 151 MIXER, 152-154 VOLUMES, 155-157 ENVELOPES (ATTACK*16+DECAY)
|
|
40 PRINT "A SCALE"
|
|
50 OUT 151, 1: OUT 155, 3
|
|
60 FOR I = 1 TO 8
|
|
70 READ P: GOSUB 500
|
|
80 OUT 152, 15
|
|
90 IF INP(152) > 0 THEN 90
|
|
100 NEXT I
|
|
110 PRINT "A LASER"
|
|
120 OUT 151, 4: OUT 149, 0: OUT 157, 0: OUT 154, 13
|
|
130 FOR P = 30 TO 250 STEP 6: OUT 148, P: NEXT P
|
|
140 OUT 154, 0
|
|
150 PRINT "AN EXPLOSION"
|
|
160 OUT 151, 16: OUT 150, 24: OUT 156, 8: OUT 153, 15
|
|
170 IF INP(153) > 0 THEN 170
|
|
180 PRINT "A CHORD"
|
|
190 OUT 151, 7
|
|
200 OUT 144, 221: OUT 145, 1: OUT 146, 123: OUT 147, 1: OUT 148, 63: OUT 149, 1
|
|
210 OUT 155, 69: OUT 156, 69: OUT 157, 69
|
|
220 OUT 152, 12: OUT 153, 12: OUT 154, 12
|
|
230 IF INP(152) > 0 THEN 230
|
|
240 END
|
|
500 OUT 144, P - INT(P / 256) * 256: OUT 145, INT(P / 256): RETURN
|
|
900 DATA 477, 425, 379, 358, 319, 284, 253, 239
|