mirror of
https://gitlab.cs.washington.edu/fidelp/frustration.git
synced 2024-12-26 21:58:20 +01:00
Extra polish
This commit is contained in:
parent
77e6bc9877
commit
af8618675b
1 changed files with 12 additions and 11 deletions
23
README.md
23
README.md
|
@ -773,7 +773,6 @@ Some machines use memory mapped IO where certain memory addresses are
|
||||||
routed to hardware devices instead of main memory. This machine already
|
routed to hardware devices instead of main memory. This machine already
|
||||||
has the full 64K of memory connected so no address space is readily
|
has the full 64K of memory connected so no address space is readily
|
||||||
available for hardware devices.
|
available for hardware devices.
|
||||||
|
|
||||||
Instead we define a separate input-output space of 65536 possible
|
Instead we define a separate input-output space of 65536 possible
|
||||||
locations. Each of these possible locations is called an IO
|
locations. Each of these possible locations is called an IO
|
||||||
"[port](https://en.wikipedia.org/wiki/IO_port)".
|
"[port](https://en.wikipedia.org/wiki/IO_port)".
|
||||||
|
@ -788,7 +787,7 @@ transmitter that sends data to a computer terminal, or just an
|
||||||
output pin controller that is wired to a light bulb.
|
output pin controller that is wired to a light bulb.
|
||||||
|
|
||||||
This is a fake software CPU so I am going to hook it up to
|
This is a fake software CPU so I am going to hook it up to
|
||||||
stdin and stdout.
|
[stdin and stdout](https://en.wikipedia.org/wiki/Standard_streams).
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
use std::io;
|
use std::io;
|
||||||
|
@ -821,7 +820,6 @@ a software emulation.
|
||||||
/* Dump CPU status.
|
/* Dump CPU status.
|
||||||
* Like the front panel with the blinking lights that Chuck
|
* Like the front panel with the blinking lights that Chuck
|
||||||
* talked about. */
|
* talked about. */
|
||||||
|
|
||||||
println!("{:?} {:?}", x.ip, x.dstack);
|
println!("{:?} {:?}", x.ip, x.dstack);
|
||||||
let _ = io::stdout().flush();
|
let _ = io::stdout().flush();
|
||||||
}
|
}
|
||||||
|
@ -830,6 +828,8 @@ a software emulation.
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
That's all the CPU instructions we'll need.
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
];
|
];
|
||||||
```
|
```
|
||||||
|
@ -861,7 +861,7 @@ Forth family. If you want to learn how to implement a full featured Forth,
|
||||||
please read
|
please read
|
||||||
[Jonesforth](http://git.annexia.org/?p=jonesforth.git;a=blob;f=jonesforth.S),
|
[Jonesforth](http://git.annexia.org/?p=jonesforth.git;a=blob;f=jonesforth.S),
|
||||||
and Brad Rodriguez' series of articles
|
and Brad Rodriguez' series of articles
|
||||||
["Moving Forth"](http://www.bradrodriguez.com/papers/index.html).
|
"[Moving Forth](http://www.bradrodriguez.com/papers/index.html)".
|
||||||
The small Forth I write below will probably help you understand
|
The small Forth I write below will probably help you understand
|
||||||
those Forths a little better.
|
those Forths a little better.
|
||||||
|
|
||||||
|
@ -1068,7 +1068,7 @@ fn build_dictionary(c: &mut Core) {
|
||||||
let mut d = Dict {
|
let mut d = Dict {
|
||||||
dp: 0, /* Nothing in the dictionary yet */
|
dp: 0, /* Nothing in the dictionary yet */
|
||||||
|
|
||||||
here: 2, /* Reserve address 0 as an "entry point", i.e. where the
|
here: 2, /* Reserve address 0 as the "reset vector", i.e. where the
|
||||||
CPU will jump to start running Forth. We don't have a
|
CPU will jump to start running Forth. We don't have a
|
||||||
Forth interpreter yet so we'll leave address 0 alone for
|
Forth interpreter yet so we'll leave address 0 alone for
|
||||||
now and start the dictionary at address 2 instead. */
|
now and start the dictionary at address 2 instead. */
|
||||||
|
@ -2633,11 +2633,11 @@ Start out in interpreting mode.
|
||||||
d.c.store(state_ptr, 0xffff);
|
d.c.store(state_ptr, 0xffff);
|
||||||
```
|
```
|
||||||
|
|
||||||
```rust
|
Put a call to the outer interpreter at the CPU's
|
||||||
d.c.store(0, quit);
|
[reset vector](https://en.wikipedia.org/wiki/Reset_vector).
|
||||||
```
|
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
|
d.c.store(0, quit);
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -2649,7 +2649,7 @@ fn main() {
|
||||||
/* Put the dictionary into memory */
|
/* Put the dictionary into memory */
|
||||||
build_dictionary(&mut c);
|
build_dictionary(&mut c);
|
||||||
|
|
||||||
/* Run Forth */
|
/* Start running the CPU from the reset vector */
|
||||||
c.ip = 0;
|
c.ip = 0;
|
||||||
loop {
|
loop {
|
||||||
c.step();
|
c.step();
|
||||||
|
@ -2704,6 +2704,7 @@ There is a shell script supplied that will do all of the above for you.
|
||||||
bash build.sh
|
bash build.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
Please read frustration.4th if you want to learn more about how to
|
Please read
|
||||||
use Forth.
|
[frustration.4th](./frustration.4th)
|
||||||
|
if you want to learn more about how to use Forth.
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue