Commit af861867 authored by Peter Fidelman's avatar Peter Fidelman
Browse files

Extra polish

parent 77e6bc98
......@@ -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
has the full 64K of memory connected so no address space is readily
available for hardware devices.
Instead we define a separate input-output space of 65536 possible
locations. Each of these possible locations is called an IO
"[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.
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
use std::io;
......@@ -821,7 +820,6 @@ a software emulation.
/* Dump CPU status.
* Like the front panel with the blinking lights that Chuck
* talked about. */
println!("{:?} {:?}", x.ip, x.dstack);
let _ = io::stdout().flush();
}
......@@ -830,6 +828,8 @@ a software emulation.
}
```
That's all the CPU instructions we'll need.
```rust
];
```
......@@ -861,7 +861,7 @@ Forth family. If you want to learn how to implement a full featured Forth,
please read
[Jonesforth](http://git.annexia.org/?p=jonesforth.git;a=blob;f=jonesforth.S),
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
those Forths a little better.
......@@ -1068,7 +1068,7 @@ fn build_dictionary(c: &mut Core) {
let mut d = Dict {
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
Forth interpreter yet so we'll leave address 0 alone for
now and start the dictionary at address 2 instead. */
......@@ -2633,11 +2633,11 @@ Start out in interpreting mode.
d.c.store(state_ptr, 0xffff);
```
```rust
d.c.store(0, quit);
```
Put a call to the outer interpreter at the CPU's
[reset vector](https://en.wikipedia.org/wiki/Reset_vector).
```rust
d.c.store(0, quit);
}
```
......@@ -2649,7 +2649,7 @@ fn main() {
/* Put the dictionary into memory */
build_dictionary(&mut c);
/* Run Forth */
/* Start running the CPU from the reset vector */
c.ip = 0;
loop {
c.step();
......@@ -2704,6 +2704,7 @@ There is a shell script supplied that will do all of the above for you.
bash build.sh
```
Please read frustration.4th if you want to learn more about how to
use Forth.
Please read
[frustration.4th](./frustration.4th)
if you want to learn more about how to use Forth.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment