diff --git a/README.md b/README.md index 5499ea1..0f9de05 100644 --- a/README.md +++ b/README.md @@ -44,12 +44,12 @@ You could use any HTTP server that sets these headers. | Name | Address | Size / B | Access | |--------|---------|----------|--------------| -| TXBUF | 0 | 32 | write | -| RXBUF | 32 | 32 | read | -| TXHEAD | 64 | 1 | atomic read | -| TXTAIL | 65 | 1 | atomic write | -| RXHEAD | 66 | 1 | atomic write | -| RXTAIL | 67 | 1 | atomic read | +| TXBUF | 00h | 32 | write | +| RXBUF | 20h | 32 | read | +| TXHEAD | 40h | 4 | atomic read | +| TXTAIL | 44h | 4 | atomic write | +| RXHEAD | 48h | 4 | atomic write | +| RXTAIL | 4Ch | 4 | atomic read | For both sending (`TX`) and receiving (`RX`), there are three registers: `xBUF`, `xHEAD` and `xTAIL`: @@ -67,7 +67,7 @@ unoccupied byte between the tail and the head. | Name | Address | Size / B | Access | |----------|---------|----------|--------------| -| SYSREADY | 68 | 1 | atomic write | +| SYSREADY | 50h | 1 | atomic write | The `SYSREADY` register is used to indicate when the system has booted up and is ready for user input. diff --git a/emu.js b/emu.js index bfbaf8f..0558a0d 100644 --- a/emu.js +++ b/emu.js @@ -1,14 +1,14 @@ -const TXBUF = 0; -const RXBUF = 32; -const TXHEAD = 64; -const TXTAIL = 65; -const RXHEAD = 66; -const RXTAIL = 67; -const SYSREADY = 68; +const TXBUF = 0x00; +const RXBUF = 0x20; +const TXHEAD = 0x40; +const TXTAIL = 0x44; +const RXHEAD = 0x48; +const RXTAIL = 0x4c; +const SYSREADY = 0x50; const TXBUF_SIZE = 32; const RXBUF_SIZE = 32; -const PERIPHS_SIZE = 69; // Nice +const PERIPHS_SIZE = 81; const POLL_INTERVAL_MS = 20; diff --git a/prelude.f b/prelude.f index 8c2471c..098e418 100644 --- a/prelude.f +++ b/prelude.f @@ -63,18 +63,6 @@ 46 EMIT -\ Peripheral register addresses - -: TXBUF 0 ; -: RXBUF 32 ; -: TXHEAD 64 ; -: TXTAIL 65 ; -: RXHEAD 66 ; -: RXTAIL 67 ; -: SYSREADY 68 ; - -46 EMIT - \ Printing utilities : CR 10 EMIT ; @@ -214,6 +202,22 @@ CHAR . EMIT CHAR . EMIT +\ Peripheral register addresses + +HEX + +00 CONSTANT TXBUF +20 CONSTANT RXBUF +40 CONSTANT TXHEAD +44 CONSTANT TXTAIL +48 CONSTANT RXHEAD +4C CONSTANT RXTAIL +50 CONSTANT SYSREADY + +DECIMAL + +46 EMIT + \ A better word-not-found handler : ANY-RX? RXHEAD AC@ RXTAIL AC@ <> ; diff --git a/wipforth.wat b/wipforth.wat index 20ad8e0..fb9e8f9 100644 --- a/wipforth.wat +++ b/wipforth.wat @@ -8,9 +8,9 @@ (global $TXBUF i32 (i32.const 0x0000)) (global $RXBUF i32 (i32.const 0x0020)) (global $TXHEAD i32 (i32.const 0x0040)) - (global $TXTAIL i32 (i32.const 0x0041)) - (global $RXHEAD i32 (i32.const 0x0042)) - (global $RXTAIL i32 (i32.const 0x0043)) + (global $TXTAIL i32 (i32.const 0x0044)) + (global $RXHEAD i32 (i32.const 0x0048)) + (global $RXTAIL i32 (i32.const 0x004c)) ;; Forth registers (global $rsp (mut i32) (i32.const 0))