Remove the sound chip; Ctrl-Alt-Del opens the monitor
The sound chip (rtl/sound.v, ports 90h-9Dh, the PmodAMP2 on JA) is removed: its ports now read FFh like any unused port, the JA pins are free, and the manual, README, example and tests no longer mention it. No game used it. Ctrl-Alt-Del raises the monitor's NMI (STOPPED BY CTRL-ALT-DEL) instead of resetting; pressed in the monitor, again within 2 s, or while an NMI is still pending it restarts the computer. The monitor gains RESET (port 62), and BASIC returns to the main screen at start-up. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
addf0157fc
commit
305c608bb5
19 files changed
+1707
-2021
No files matched your search
+15
-45
@@ -23,8 +23,11 @@ READY
|
||||
|
||||
The computer keeps running while SW15 is down. It just waits until it can print
|
||||
again, so you can flip back and forth without losing your program. **BTND**
|
||||
(or **Ctrl-Alt-Del** on the keyboard) restarts the computer; that wipes the program
|
||||
but not the files in flash. **BTNC** restarts the whole board.
|
||||
restarts the computer; that wipes the program but not the files in flash.
|
||||
**BTNC** restarts the whole board. **Ctrl-Alt-Del** on the keyboard stops the
|
||||
program in the machine-code monitor, wherever it is (section 10); pressed again
|
||||
within 2 seconds, or while the monitor is showing, it restarts the computer as
|
||||
BTND does.
|
||||
|
||||
### Talking to BASIC
|
||||
|
||||
@@ -868,7 +871,6 @@ compare value, 10h and 14h the monitor's breakpoint addresses.
|
||||
| 112–120, 128–135 | sprites (section 7) | sprites (section 7) |
|
||||
| 136 | keys held down, for games (below) | — |
|
||||
| 137 | 1 if the key picked with `OUT 137` is held down, else 0 | pick a key by its scan code |
|
||||
| 144–157 | voice volumes now (152–154) | sound (below) |
|
||||
|
||||
```
|
||||
10 FOR I = 0 TO 255
|
||||
@@ -917,45 +919,6 @@ game should throw those away now and then with `IF INP(0) AND 1 THEN K =
|
||||
INP(1)` in a loop. Held keys only work with the board's own keyboard, not with
|
||||
characters sent from the PC.
|
||||
|
||||
### Sound
|
||||
|
||||
The board has no speaker of its own. Plug a Digilent **PmodAMP2** into the
|
||||
top row of Pmod header **JA** (pin 1 at the end marked 1) and headphones or a
|
||||
powered speaker into its jack. The FPGA has a little sound chip in the style
|
||||
of the 8-bit computers: three voices that play square-wave tones, a noise
|
||||
source they can use instead or as well, sixteen volumes and an envelope for
|
||||
each voice, so a note or a bang fades away by itself.
|
||||
|
||||
| Port | `OUT` |
|
||||
|---|---|
|
||||
| 144, 145 | voice 0 pitch: low byte, then high byte (0–15) |
|
||||
| 146, 147 | voice 1 pitch |
|
||||
| 148, 149 | voice 2 pitch |
|
||||
| 150 | noise pitch, 0–31 (higher is lower and rougher) |
|
||||
| 151 | mixer: add 1, 2, 4 for the tone of voice 0, 1, 2 and 8, 16, 32 for noise on voice 0, 1, 2 |
|
||||
| 152, 153, 154 | voice 0, 1, 2 volume, 0 (off) to 15, which starts its envelope; `INP` gives the volume it has got to |
|
||||
| 155, 156, 157 | voice 0, 1, 2 envelope: attack × 16 + decay, each 0–15 |
|
||||
|
||||
- **Pitch** = 125000 ÷ frequency: 284 is the A above middle C (440 Hz),
|
||||
477 middle C. Each voice goes from about 30 Hz up beyond hearing.
|
||||
- **Envelope:** with an attack, the volume climbs from 0 to the volume set,
|
||||
one step every attack × 4 ms; then, with a decay, it falls back to 0 one step
|
||||
every decay × 4 ms. 0 means no climb, or hold the volume until it is
|
||||
changed. An envelope of 3 plays a short note; 8 with noise is an explosion.
|
||||
- **Waiting for a sound to end:** `IF INP(152) > 0 THEN …` loops until voice
|
||||
0 has faded out.
|
||||
- A voice that has neither its tone nor noise on in the mixer gives a steady
|
||||
level, so changing its volume clicks; that is how the old chips played
|
||||
samples.
|
||||
- `CLS` silences everything (as does restarting the computer).
|
||||
|
||||
```
|
||||
10 OUT 151, 1: OUT 155, 3 : REM TONE ON VOICE 0, A SHORT NOTE
|
||||
20 OUT 144, 28: OUT 145, 1: OUT 152, 15 : REM PITCH 284 = 440 HZ
|
||||
```
|
||||
|
||||
`basic/examples/sound.bas` plays a scale, a laser, an explosion and a chord.
|
||||
|
||||
### Speed
|
||||
|
||||
The processor is a 32-bit RISC-V (RV32IMF: the base instructions, multiply
|
||||
@@ -988,8 +951,14 @@ any code, including BASIC itself.
|
||||
|
||||
### Getting in and out
|
||||
|
||||
- Press **Pause/Break** on the keyboard at any time, even when a program has
|
||||
hung, or type `MONITOR` in BASIC.
|
||||
- Press **Pause/Break** or **Ctrl-Alt-Del** on the keyboard at any time, even
|
||||
when a program has hung with its interrupts off, or type `MONITOR` in BASIC.
|
||||
The monitor shows every register as the program left it, and `X` carries
|
||||
on.
|
||||
- **Restarting:** Ctrl-Alt-Del while the monitor is showing, or twice within
|
||||
2 seconds, restarts the computer, as BTND does: the way out of a machine too
|
||||
wedged even for the monitor. So does the monitor's `RESET` command. Holding
|
||||
the keys down counts as one press.
|
||||
- A breakpoint or a single step also comes back to the monitor.
|
||||
- So does a program that goes wrong: an illegal instruction, a misaligned load,
|
||||
store or jump, an `EBREAK` or `ECALL`, or an interrupt with no handler. The
|
||||
@@ -1104,6 +1073,7 @@ or without `0x`.
|
||||
| `A addr` | Assemble lines as you type them, from *addr*; an empty line ends |
|
||||
| Up / Down | Scroll the disassembly by one instruction |
|
||||
| Page Up / Page Down | Scroll the memory window |
|
||||
| `RESET` | Restart the computer, as BTND does (the program in memory is lost; files in flash are not) |
|
||||
| `?` | A short reminder of the commands |
|
||||
| `:` *record* | An Intel HEX record, written into memory (`tools/send-hex.py` sends whole files this way; see section 12) |
|
||||
|
||||
@@ -1471,7 +1441,7 @@ numbers, only faster:
|
||||
Arithmetic, numeric variables and arrays, and every control statement (`GOTO`,
|
||||
`GOSUB`, `ON`, `FOR`, `IF`, `DO`, `SELECT CASE`, `EXIT`, `END`) become machine
|
||||
code, using the FPU directly, and the graphics statements work out their
|
||||
numbers there too. Everything else (`PRINT`, `INPUT`, strings, files, sound,
|
||||
numbers there too. Everything else (`PRINT`, `INPUT`, strings, files,
|
||||
`DATA` and `READ`, `DEF FN`, and functions such as `LEN` and `MOD`) is handed
|
||||
to BASIC in the ROM as it stands, so it behaves exactly as it does
|
||||
interpreted, at about the same speed. A program that spends its time
|
||||
|
||||
Binary file not shown.
Reference in new issue
Block a user