diff --git a/parts/platforms/README.md b/parts/platforms/README.md deleted file mode 100644 index 08d9751..0000000 --- a/parts/platforms/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# platforms - -This is a collection of include files that set platform-specific constants -that different parts use. When assembling your own OS, pick the platform include -that is closest to yours and adapt it to your machine. diff --git a/parts/platforms/rc2014.inc b/parts/platforms/rc2014.inc deleted file mode 100644 index 69b7efa..0000000 --- a/parts/platforms/rc2014.inc +++ /dev/null @@ -1,7 +0,0 @@ -; classic RC2014 setup (8K ROM + 32K RAM) and a stock Serial I/O module - -; The RAM module is selected on A15, so it has the range 0x8000-0xffff -RAMSTART .equ 0x8000 -RAMEND .equ 0xffff -ACIA_CTL .equ 0x80 ; Control and status. RS off. -ACIA_IO .equ 0x81 ; Transmit. RS on. diff --git a/recipes/rc2014.md b/recipes/rc2014/README.md similarity index 87% rename from recipes/rc2014.md rename to recipes/rc2014/README.md index ed55cfa..aa618ba 100644 --- a/recipes/rc2014.md +++ b/recipes/rc2014/README.md @@ -37,40 +37,9 @@ device I use in this recipe. * [GNU screen][screen] * A FTDI-to-TTL cable to connect to the Serial I/O module of the RC2014 -### Write main.asm +### Write glue.asm -This is what your glue code would look like: - -``` -#include "platforms/rc2014.inc" - - jr init - -.fill 0x38-$ - jp aciaInt - -init: - di - - ; setup stack - ld hl, RAMEND - ld sp, hl - - im 1 - - call aciaInit - call shellInit - ei - call shellLoop - -#include "core.asm" -ACIA_RAMSTART .equ RAMSTART -#include "acia.asm" -SHELL_RAMSTART .equ ACIA_RAMEND -.define SHELL_GETC call aciaGetC -.define SHELL_PUTC call aciaPutC -#include "shell.asm" -``` +[This is what your glue code would look like.](glue.asm) The `platform.inc` include is there to load all platform-specific constants (such as `RAMSTART` and `RAMEND`). @@ -99,7 +68,7 @@ is decoupled from the ACIA and can get its IO from anything. See We only have the shell to build, so it's rather straightforward: - scas -I /path/to/parts -o rom.bin main.asm + scas -I /path/to/parts -o rom.bin glue.asm ### Write to the ROM diff --git a/recipes/rc2014/glue.asm b/recipes/rc2014/glue.asm new file mode 100644 index 0000000..a9b4a67 --- /dev/null +++ b/recipes/rc2014/glue.asm @@ -0,0 +1,33 @@ +; classic RC2014 setup (8K ROM + 32K RAM) and a stock Serial I/O module +; The RAM module is selected on A15, so it has the range 0x8000-0xffff +RAMSTART .equ 0x8000 +RAMEND .equ 0xffff +ACIA_CTL .equ 0x80 ; Control and status. RS off. +ACIA_IO .equ 0x81 ; Transmit. RS on. + +jr init + +; interrupt hook +.fill 0x38-$ +jp aciaInt + +init: + di + ; setup stack + ld hl, RAMEND + ld sp, hl + im 1 + call aciaInit + call shellInit + ei + jp shellLoop + +#include "core.asm" +ACIA_RAMSTART .equ RAMSTART +#include "acia.asm" +SHELL_RAMSTART .equ ACIA_RAMEND +.define SHELL_GETC call aciaGetC +.define SHELL_PUTC call aciaPutC +.define SHELL_IO_GETC call aciaGetC +SHELL_EXTRA_CMD_COUNT .equ 0 +#include "shell.asm"