Skip to content

Commit

Permalink
More doc, removed non-ROM build.
Browse files Browse the repository at this point in the history
  • Loading branch information
bayerf42 committed Jan 14, 2023
1 parent 7ab4a7a commit 8ea3119
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 211 deletions.
29 changes: 0 additions & 29 deletions clox.prj

This file was deleted.

134 changes: 0 additions & 134 deletions cstart_lox.asm

This file was deleted.

28 changes: 12 additions & 16 deletions doc/lox68k.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ just compile it as described below. But if you want to execute it on the Kit its
you need the [Monitor ROM](https://github.com/bayerf42/Monitor)
and the [Motorola FFP library](https://github.com/bayerf42/MotoFFP).

If you don't want to build the ROM yourself, the final ROM image `mon_ffp_lox.bin` is included
in the release. Just burn it into an EPROM or flash chip.

## Differences to the [original Lox language](https://craftinginterpreters.com/the-lox-language.html)

Expand Down Expand Up @@ -86,6 +88,9 @@ including plenty of RAM and a FPU where the principal `Value` type is
For the 68008 port the `Value` type has been shrunk to 32 bit, where numbers
are 31 bit signed integers, using 1 bit to discriminate from pointers or special values.

All memory sizes have been shrunk to 16 bit to save memory, so the maximum heap size is 64k, which
is adequate for the Sirichote Kit.

**New:** Floating point numbers have been re-introduced as heap-based objects. They can be freely
mixed with integers in calculations. Also a standard set of transcendental functions has been
added.
Expand All @@ -104,13 +109,14 @@ and doesn't support modern *C99*.
* strings, non-modifiable and interned for quick comparisons
* lists, modifiable resizable arrays of arbitrary values
* closures, proper lexically-scoped functions
* natives, library functions written in C or assembly
* classes containing methods and supporting single inheritance
* object instances using a hashtable for fields, but also indexable by any value
* bound methods, combining an instance with a method
* iterators for traversing hashtables


## The 4 varieties of Lox buildable
## The 3 varieties of Lox buildable

All varieties are compiled from the same source files as described in the following sections.

Expand Down Expand Up @@ -154,8 +160,8 @@ Be sure to compile it for 32 bit architecture, Lox68k assumes 32 bit `int`, `lon


### Lox compiled for the 68008 kit in ROM
It is burnt into ROM (together with the Monitor code)
and can [utilize the entire RAM for data](memorymap.md#ROM) and the kit's hardware like LCD, keyboard,
It is burnt into ROM (together with the Monitor code and the FFP library)
and can [utilize the entire RAM for data](memorymap.md) and the kit's hardware like LCD, keyboard,
sound, and terminal communication via the serial port.

To build this version, load project `clox_rom.prj` in *IDE68K* and build it.
Expand All @@ -164,7 +170,7 @@ by executing
```sh
python makerom.py
```
creating `rom_image/mon-lox.bin`, which you burn into EPROM/Flash and plug into the Kit.
creating `../roms/mon_ffp_lox.bin`, which you burn into EPROM/Flash and plug into the Kit.

To start it, start a terminal emulation, either from *IDE68K*, or preferrably by typing
```sh
Expand All @@ -177,18 +183,8 @@ To interrupt long-running computations, press the **IRQ** key bringing you back
prompt. Be sure to put the interrupt source switch to *IRQ*, not to *10ms TICK*.

You can also run this version in the *IDE68K* emulator, but you have to set its start address
`$44000` manually into the PC register.

### Lox compiled for the 68008 kit in RAM
It is uploaded into RAM (which takes quite some time)
and has some [tighter memory limits](memorymap.md#RAM) to fit everything into the
available 128k RAM, but you don't have to burn a ROM image after every modification
while testing.

To build this version, load project `clox.prj` and build it. A hex file `clox.hex` is generated,
which can be uploaded to the Kit, or executed with the *IDE68K* emulator.

The start address is `$00400` as usual, you interact with it the same way as the ROM version.
`$44000` manually into the PC register. Since the FFP library is not contained in the hex file,
you cannot use floating point numbers in the emulator.


## The terminal emulator
Expand Down
34 changes: 2 additions & 32 deletions doc/memorymap.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Memory maps for Lox68k
# Memory map for Lox68k

All memory sizes have been rounded and leave some space at the upper limit. However,
the lower limit is fixed, with the exception of the processor stack, which grows from
Expand All @@ -7,19 +7,13 @@ higher to lower addresses.
All addresses are specified with 5 hex digits, covering the 1 MB address range of the
68008 chip.

## <span id="ROM">Lox68k in ROM (recommended)</span>

This variant allows the maximum amount of RAM to be used by Lox by placing all Lox code
and constants into ROM. Build this version via the project file `clox_rom.prj`, run
`python makerom.py` and burn the image into ROM/Flash and plug it into the Kit.


| Low address | High address | Size | Type | Usage |
|---------------|----------------|------:|------|--------------------------------------|
| `$00000` | `$001ff` | ½ k | RAM | Exception vectors |
| `$00200` | `$003ff` | ½ k | RAM | Monitor variables |
| `$00400` | `$01fff` | 7 k | RAM | free |
| `$02000` | `$1bfff` | 104 k | RAM | Lox variables |
| `$02000` | `$1bfff` | 104 k | RAM | Lox variables including 64 kB heap |
| `$1c000` | `$1ffff` | 16 k | RAM | processor stack |
| `$20000` | `$3ffff` | 128 k | - | unassigned |
| `$40000` | `$43fff` | 16 k | ROM | Monitor code and constants |
Expand All @@ -29,27 +23,3 @@ and constants into ROM. Build this version via the project file `clox_rom.prj`,
| `$60000` | `$fffff` | 640 k | - | I/O or unassigned |


## <span id="RAM">Lox68k in RAM (for experimentation)</span>

This variant puts the entire Lox system into RAM, so you can modify the Lox implementation
without having to burn it into ROM. However, several memory sizes had to be reduced to fit
everything into the available 128 k of RAM. Due to a bug in the IDE68K C compiler, the
standard code layout had to be changed and Lox code starts at `$10000`.

Build this version via the project file `clox.prj` and upload the resulting hex file
`clox.hex` to the Kit (taking some time).

| Low address | High address | Size | Type | Usage |
|---------------|----------------|------:|------|--------------------------------------|
| `$00000` | `$001ff` | ½ k | RAM | Exception vectors |
| `$00200` | `$003ff` | ½ k | RAM | Monitor variables |
| `$00400` | `$0ffff` | 63 k | RAM | Lox constants and variables |
| `$10000` | `$1afff` | 44 k | RAM | Lox code |
| `$1b000` | `$1bfff` | 4 k | RAM | free |
| `$1c000` | `$1ffff` | 16 k | RAM | processor stack |
| `$20000` | `$3ffff` | 128 k | - | unassigned |
| `$40000` | `$43fff` | 16 k | ROM | Monitor code and constants |
| `$44000` | `$5efff` | 108 k | ROM | free |
| `$5f000` | `$5ffff` | 4 k | ROM | Motorola FFP library |
| `$60000` | `$fffff` | 640 k | - | I/O or unassigned |

0 comments on commit 8ea3119

Please sign in to comment.