@@ -14,11 +14,11 @@ | |||
; | |||
; *** Includes *** | |||
#include "user.h" | |||
#include "err.h" | |||
.inc "user.h" | |||
.inc "err.h" | |||
.org USER_CODE | |||
.equ AT28W_RAMSTART USER_RAMSTART | |||
jp at28wMain | |||
#include "at28w/main.asm" | |||
.inc "at28w/main.asm" |
@@ -1,4 +1,4 @@ | |||
#include "user.h" | |||
.inc "user.h" | |||
; *** Overridable consts *** | |||
; Maximum number of lines allowed in the buffer. | |||
@@ -8,18 +8,18 @@ | |||
; ****** | |||
#include "err.h" | |||
.inc "err.h" | |||
.org USER_CODE | |||
jp edMain | |||
#include "lib/util.asm" | |||
#include "lib/parse.asm" | |||
.inc "lib/util.asm" | |||
.inc "lib/parse.asm" | |||
.equ IO_RAMSTART USER_RAMSTART | |||
#include "ed/io.asm" | |||
.inc "ed/io.asm" | |||
.equ BUF_RAMSTART IO_RAMEND | |||
#include "ed/buf.asm" | |||
.inc "ed/buf.asm" | |||
.equ CMD_RAMSTART BUF_RAMEND | |||
#include "ed/cmd.asm" | |||
.inc "ed/cmd.asm" | |||
.equ ED_RAMSTART CMD_RAMEND | |||
#include "ed/main.asm" | |||
.inc "ed/main.asm" |
@@ -12,9 +12,9 @@ | |||
; | |||
; *** Includes *** | |||
#include "user.h" | |||
.inc "user.h" | |||
.org USER_CODE | |||
jp memtMain | |||
#include "memt/main.asm" | |||
.inc "memt/main.asm" |
@@ -18,10 +18,10 @@ | |||
; | |||
; *** Includes *** | |||
#include "user.h" | |||
.inc "user.h" | |||
.org USER_CODE | |||
.equ SDCT_RAMSTART USER_RAMSTART | |||
jp sdctMain | |||
#include "sdct/main.asm" | |||
.inc "sdct/main.asm" |
@@ -99,7 +99,7 @@ is very useful for variable definitions and for jump tables. | |||
## Includes | |||
The `#inc` directive is special. It takes a string literal as an argument and | |||
The `.inc` directive is special. It takes a string literal as an argument and | |||
opens, in the currently active filesystem, the file with the specified name. | |||
It then proceeds to parse that file as if its content had been copy/pasted in | |||
@@ -108,7 +108,7 @@ elsewhere. Constants too. An exception is local labels: a local namespace always | |||
ends at the end of an included file. | |||
There an important limitation with includes: only one level of includes is | |||
allowed. An included file cannot have an `#inc` directive. | |||
allowed. An included file cannot have an `.inc` directive. | |||
## Directives | |||
@@ -143,7 +143,7 @@ allowed. An included file cannot have an `#inc` directive. | |||
RAM constants, etc. The value is only outputted during the second | |||
pass. | |||
**#inc**: Takes a string literal as an argument. Open the file name specified | |||
**.inc**: Takes a string literal as an argument. Open the file name specified | |||
in the argument in the currently active filesystem, parse that file | |||
and output its binary content as is the code has been in the includer | |||
file. | |||
@@ -25,7 +25,7 @@ directiveNames: | |||
.db ".ORG" | |||
.db ".FIL" | |||
.db ".OUT" | |||
.db "#inc" | |||
.db ".INC" | |||
.db ".BIN" | |||
; This is a list of handlers corresponding to indexes in directiveNames | |||
@@ -44,7 +44,7 @@ | |||
; FS_HANDLE_SIZE | |||
; BLOCKDEV_SIZE | |||
#include "user.h" | |||
.inc "user.h" | |||
; *** Overridable consts *** | |||
; Maximum number of symbols we can have in the global and consts registry | |||
@@ -63,26 +63,26 @@ | |||
; ****** | |||
#include "err.h" | |||
.inc "err.h" | |||
.org USER_CODE | |||
jp zasmMain | |||
#include "zasm/const.asm" | |||
#include "lib/util.asm" | |||
#include "zasm/util.asm" | |||
.inc "zasm/const.asm" | |||
.inc "lib/util.asm" | |||
.inc "zasm/util.asm" | |||
.equ IO_RAMSTART USER_RAMSTART | |||
#include "zasm/io.asm" | |||
.inc "zasm/io.asm" | |||
.equ TOK_RAMSTART IO_RAMEND | |||
#include "zasm/tok.asm" | |||
#include "lib/parse.asm" | |||
.inc "zasm/tok.asm" | |||
.inc "lib/parse.asm" | |||
.equ INS_RAMSTART TOK_RAMEND | |||
#include "zasm/instr.asm" | |||
.inc "zasm/instr.asm" | |||
.equ DIREC_RAMSTART INS_RAMEND | |||
#include "zasm/directive.asm" | |||
#include "zasm/parse.asm" | |||
#include "zasm/expr.asm" | |||
.inc "zasm/directive.asm" | |||
.inc "zasm/parse.asm" | |||
.inc "zasm/expr.asm" | |||
.equ SYM_RAMSTART DIREC_RAMEND | |||
#include "zasm/symbol.asm" | |||
.inc "zasm/symbol.asm" | |||
.equ ZASM_RAMSTART SYM_RAMEND | |||
#include "zasm/main.asm" | |||
.inc "zasm/main.asm" |
@@ -217,7 +217,7 @@ shellPrintErr: | |||
; Extra commands: Other parts might define new commands. You can add these | |||
; commands to your shell. First, set SHELL_EXTRA_CMD_COUNT to | |||
; the number of extra commands to add, then add a ".dw" | |||
; directive *just* after your '#include "shell.asm"'. Voila! | |||
; directive *just* after your '.inc "shell.asm"'. Voila! | |||
; | |||
; Set memory pointer to the specified address (word). | |||
@@ -11,35 +11,35 @@ jp init | |||
.fill 0x38-$ | |||
jp aciaInt | |||
#include "err.h" | |||
#include "core.asm" | |||
#include "parse.asm" | |||
.inc "err.h" | |||
.inc "core.asm" | |||
.inc "parse.asm" | |||
.equ ACIA_RAMSTART RAMSTART | |||
#include "acia.asm" | |||
.inc "acia.asm" | |||
.equ MMAP_START 0xd000 | |||
#include "mmap.asm" | |||
.inc "mmap.asm" | |||
.equ BLOCKDEV_RAMSTART ACIA_RAMEND | |||
.equ BLOCKDEV_COUNT 1 | |||
#include "blockdev.asm" | |||
.inc "blockdev.asm" | |||
; List of devices | |||
.dw mmapGetC, mmapPutC | |||
.equ STDIO_RAMSTART BLOCKDEV_RAMEND | |||
#include "stdio.asm" | |||
.inc "stdio.asm" | |||
.equ AT28W_RAMSTART STDIO_RAMEND | |||
#include "at28w/main.asm" | |||
.inc "at28w/main.asm" | |||
.equ SHELL_RAMSTART AT28W_RAMEND | |||
.equ SHELL_EXTRA_CMD_COUNT 5 | |||
#include "shell.asm" | |||
.inc "shell.asm" | |||
; Extra cmds | |||
.dw a28wCmd | |||
.dw blkBselCmd, blkSeekCmd, blkLoadCmd, blkSaveCmd | |||
#include "blockdev_cmds.asm" | |||
.inc "blockdev_cmds.asm" | |||
init: | |||
di | |||
@@ -11,18 +11,18 @@ jp init | |||
.fill 0x38-$ | |||
jp aciaInt | |||
#include "err.h" | |||
#include "core.asm" | |||
#include "parse.asm" | |||
.inc "err.h" | |||
.inc "core.asm" | |||
.inc "parse.asm" | |||
.equ ACIA_RAMSTART RAMSTART | |||
#include "acia.asm" | |||
.inc "acia.asm" | |||
.equ STDIO_RAMSTART ACIA_RAMEND | |||
#include "stdio.asm" | |||
.inc "stdio.asm" | |||
.equ SHELL_RAMSTART STDIO_RAMEND | |||
.equ SHELL_EXTRA_CMD_COUNT 0 | |||
#include "shell.asm" | |||
.inc "shell.asm" | |||
init: | |||
di | |||
@@ -6,21 +6,21 @@ | |||
jp init | |||
#include "err.h" | |||
#include "core.asm" | |||
#include "parse.asm" | |||
.inc "err.h" | |||
.inc "core.asm" | |||
.inc "parse.asm" | |||
.equ ACIA_RAMSTART RAMSTART | |||
#include "acia.asm" | |||
.inc "acia.asm" | |||
.equ KBD_RAMSTART ACIA_RAMEND | |||
#include "kbd.asm" | |||
.inc "kbd.asm" | |||
.equ STDIO_RAMSTART KBD_RAMEND | |||
#include "stdio.asm" | |||
.inc "stdio.asm" | |||
.equ SHELL_RAMSTART STDIO_RAMEND | |||
.equ SHELL_EXTRA_CMD_COUNT 0 | |||
#include "shell.asm" | |||
.inc "shell.asm" | |||
init: | |||
di | |||
@@ -20,44 +20,44 @@ jp sdcSendRecv | |||
.fill 0x38-$ | |||
jp aciaInt | |||
#include "err.h" | |||
#include "core.asm" | |||
#include "parse.asm" | |||
.inc "err.h" | |||
.inc "core.asm" | |||
.inc "parse.asm" | |||
.equ ACIA_RAMSTART RAMSTART | |||
#include "acia.asm" | |||
.inc "acia.asm" | |||
.equ BLOCKDEV_RAMSTART ACIA_RAMEND | |||
.equ BLOCKDEV_COUNT 2 | |||
#include "blockdev.asm" | |||
.inc "blockdev.asm" | |||
; List of devices | |||
.dw sdcGetC, sdcPutC | |||
.dw blk2GetC, blk2PutC | |||
.equ STDIO_RAMSTART BLOCKDEV_RAMEND | |||
#include "stdio.asm" | |||
.inc "stdio.asm" | |||
.equ FS_RAMSTART STDIO_RAMEND | |||
.equ FS_HANDLE_COUNT 1 | |||
#include "fs.asm" | |||
.inc "fs.asm" | |||
.equ SHELL_RAMSTART FS_RAMEND | |||
.equ SHELL_EXTRA_CMD_COUNT 11 | |||
#include "shell.asm" | |||
.inc "shell.asm" | |||
.dw sdcInitializeCmd, sdcFlushCmd | |||
.dw blkBselCmd, blkSeekCmd, blkLoadCmd, blkSaveCmd | |||
.dw fsOnCmd, flsCmd, fnewCmd, fdelCmd, fopnCmd | |||
#include "blockdev_cmds.asm" | |||
#include "fs_cmds.asm" | |||
.inc "blockdev_cmds.asm" | |||
.inc "fs_cmds.asm" | |||
.equ PGM_RAMSTART SHELL_RAMEND | |||
#include "pgm.asm" | |||
.inc "pgm.asm" | |||
.equ SDC_RAMSTART PGM_RAMEND | |||
.equ SDC_PORT_CSHIGH 6 | |||
.equ SDC_PORT_CSLOW 5 | |||
.equ SDC_PORT_SPI 4 | |||
#include "sdc.asm" | |||
.inc "sdc.asm" | |||
init: | |||
di | |||
@@ -1,4 +1,4 @@ | |||
#include "user.h" | |||
.inc "user.h" | |||
.org USER_CODE | |||
ld hl, sAwesome | |||
@@ -46,14 +46,14 @@ jp aciaInt | |||
jp sdcPutC | |||
jp blkGetC | |||
#include "err.h" | |||
#include "core.asm" | |||
#include "parse.asm" | |||
.inc "err.h" | |||
.inc "core.asm" | |||
.inc "parse.asm" | |||
.equ ACIA_RAMSTART RAMSTART | |||
#include "acia.asm" | |||
.inc "acia.asm" | |||
.equ BLOCKDEV_RAMSTART ACIA_RAMEND | |||
.equ BLOCKDEV_COUNT 4 | |||
#include "blockdev.asm" | |||
.inc "blockdev.asm" | |||
; List of devices | |||
.dw sdcGetC, sdcPutC | |||
.dw blk1GetC, blk1PutC | |||
@@ -62,33 +62,33 @@ jp aciaInt | |||
.equ MMAP_START 0xe000 | |||
#include "mmap.asm" | |||
.inc "mmap.asm" | |||
.equ STDIO_RAMSTART BLOCKDEV_RAMEND | |||
#include "stdio.asm" | |||
.inc "stdio.asm" | |||
.equ FS_RAMSTART STDIO_RAMEND | |||
.equ FS_HANDLE_COUNT 2 | |||
#include "fs.asm" | |||
.inc "fs.asm" | |||
.equ SHELL_RAMSTART FS_RAMEND | |||
.equ SHELL_EXTRA_CMD_COUNT 11 | |||
#include "shell.asm" | |||
.inc "shell.asm" | |||
.dw sdcInitializeCmd, sdcFlushCmd | |||
.dw blkBselCmd, blkSeekCmd, blkLoadCmd, blkSaveCmd | |||
.dw fsOnCmd, flsCmd, fnewCmd, fdelCmd, fopnCmd | |||
#include "fs_cmds.asm" | |||
#include "blockdev_cmds.asm" | |||
.inc "fs_cmds.asm" | |||
.inc "blockdev_cmds.asm" | |||
.equ PGM_RAMSTART SHELL_RAMEND | |||
#include "pgm.asm" | |||
.inc "pgm.asm" | |||
.equ SDC_RAMSTART PGM_RAMEND | |||
.equ SDC_PORT_CSHIGH 6 | |||
.equ SDC_PORT_CSLOW 5 | |||
.equ SDC_PORT_SPI 4 | |||
#include "sdc.asm" | |||
.inc "sdc.asm" | |||
.out SDC_RAMEND | |||
@@ -8,22 +8,22 @@ | |||
.fill 0x66-$ | |||
retn | |||
#include "err.h" | |||
#include "core.asm" | |||
#include "parse.asm" | |||
.inc "err.h" | |||
.inc "core.asm" | |||
.inc "parse.asm" | |||
.equ PAD_RAMSTART RAMSTART | |||
#include "sms/pad.asm" | |||
.inc "sms/pad.asm" | |||
.equ VDP_RAMSTART PAD_RAMEND | |||
#include "sms/vdp.asm" | |||
.inc "sms/vdp.asm" | |||
.equ STDIO_RAMSTART VDP_RAMEND | |||
#include "stdio.asm" | |||
.inc "stdio.asm" | |||
.equ SHELL_RAMSTART STDIO_RAMEND | |||
.equ SHELL_EXTRA_CMD_COUNT 0 | |||
#include "shell.asm" | |||
.inc "shell.asm" | |||
init: | |||
di | |||
@@ -8,24 +8,24 @@ | |||
.fill 0x66-$ | |||
retn | |||
#include "err.h" | |||
#include "core.asm" | |||
#include "parse.asm" | |||
.inc "err.h" | |||
.inc "core.asm" | |||
.inc "parse.asm" | |||
#include "sms/kbd.asm" | |||
.inc "sms/kbd.asm" | |||
.equ KBD_RAMSTART RAMSTART | |||
.equ KBD_FETCHKC smskbdFetchKCB | |||
#include "kbd.asm" | |||
.inc "kbd.asm" | |||
.equ VDP_RAMSTART KBD_RAMEND | |||
#include "sms/vdp.asm" | |||
.inc "sms/vdp.asm" | |||
.equ STDIO_RAMSTART VDP_RAMEND | |||
#include "stdio.asm" | |||
.inc "stdio.asm" | |||
.equ SHELL_RAMSTART STDIO_RAMEND | |||
.equ SHELL_EXTRA_CMD_COUNT 0 | |||
#include "shell.asm" | |||
.inc "shell.asm" | |||
init: | |||
di | |||
@@ -39,29 +39,29 @@ | |||
.fill 0x66-$ | |||
retn | |||
#include "err.h" | |||
#include "core.asm" | |||
#include "parse.asm" | |||
.inc "err.h" | |||
.inc "core.asm" | |||
.inc "parse.asm" | |||
#include "sms/kbd.asm" | |||
.inc "sms/kbd.asm" | |||
.equ KBD_RAMSTART RAMSTART | |||
.equ KBD_FETCHKC smskbdFetchKCB | |||
#include "kbd.asm" | |||
.inc "kbd.asm" | |||
.equ VDP_RAMSTART KBD_RAMEND | |||
#include "sms/vdp.asm" | |||
.inc "sms/vdp.asm" | |||
.equ STDIO_RAMSTART VDP_RAMEND | |||
#include "stdio.asm" | |||
.inc "stdio.asm" | |||
.equ MMAP_START 0xd700 | |||
; 0x180 is to leave some space for the stack | |||
.equ MMAP_LEN RAMEND-MMAP_START-0x180 | |||
#include "mmap.asm" | |||
.inc "mmap.asm" | |||
.equ BLOCKDEV_RAMSTART STDIO_RAMEND | |||
.equ BLOCKDEV_COUNT 3 | |||
#include "blockdev.asm" | |||
.inc "blockdev.asm" | |||
; List of devices | |||
.dw mmapGetC, mmapPutC | |||
.dw f0GetC, f0PutC | |||
@@ -70,20 +70,20 @@ | |||
.equ FS_RAMSTART BLOCKDEV_RAMEND | |||
.equ FS_HANDLE_COUNT 2 | |||
#include "fs.asm" | |||
.inc "fs.asm" | |||
.equ SHELL_RAMSTART FS_RAMEND | |||
.equ SHELL_EXTRA_CMD_COUNT 10 | |||
#include "shell.asm" | |||
.inc "shell.asm" | |||
.dw edCmd, zasmCmd, fnewCmd, fdelCmd, fopnCmd, flsCmd, blkBselCmd | |||
.dw blkSeekCmd, blkLoadCmd, blkSaveCmd | |||
#include "blockdev_cmds.asm" | |||
#include "fs_cmds.asm" | |||
.inc "blockdev_cmds.asm" | |||
.inc "fs_cmds.asm" | |||
.equ PGM_RAMSTART SHELL_RAMEND | |||
.equ PGM_CODEADDR USER_RAMSTART | |||
#include "pgm.asm" | |||
.inc "pgm.asm" | |||
.out PGM_RAMEND | |||
@@ -1,4 +1,4 @@ | |||
#include "user.h" | |||
.inc "user.h" | |||
.org USER_CODE | |||
ld hl, sAwesome | |||
@@ -40,13 +40,13 @@ | |||
jp stdioPutC | |||
jp stdioReadLine | |||
#include "core.asm" | |||
#include "err.h" | |||
#include "parse.asm" | |||
.inc "core.asm" | |||
.inc "err.h" | |||
.inc "parse.asm" | |||
.equ BLOCKDEV_RAMSTART RAMSTART | |||
.equ BLOCKDEV_COUNT 4 | |||
#include "blockdev.asm" | |||
.inc "blockdev.asm" | |||
; List of devices | |||
.dw fsdevGetC, fsdevPutC | |||
.dw stdoutGetC, stdoutPutC | |||
@@ -55,27 +55,27 @@ | |||
.equ MMAP_START 0xe000 | |||
#include "mmap.asm" | |||
.inc "mmap.asm" | |||
.equ STDIO_RAMSTART BLOCKDEV_RAMEND | |||
#include "stdio.asm" | |||
.inc "stdio.asm" | |||
.equ FS_RAMSTART STDIO_RAMEND | |||
.equ FS_HANDLE_COUNT 2 | |||
#include "fs.asm" | |||
.inc "fs.asm" | |||
.equ SHELL_RAMSTART FS_RAMEND | |||
.equ SHELL_EXTRA_CMD_COUNT 9 | |||
#include "shell.asm" | |||
.inc "shell.asm" | |||
.dw blkBselCmd, blkSeekCmd, blkLoadCmd, blkSaveCmd | |||
.dw fsOnCmd, flsCmd, fnewCmd, fdelCmd, fopnCmd | |||
#include "blockdev_cmds.asm" | |||
#include "fs_cmds.asm" | |||
.inc "blockdev_cmds.asm" | |||
.inc "fs_cmds.asm" | |||
.equ PGM_RAMSTART SHELL_RAMEND | |||
.equ PGM_CODEADDR USERCODE | |||
#include "pgm.asm" | |||
.inc "pgm.asm" | |||
;.out PGM_RAMEND | |||
@@ -33,23 +33,23 @@ jp _blkSeek | |||
jp _blkTell | |||
jp printstr | |||
#include "core.asm" | |||
#include "err.h" | |||
#include "parse.asm" | |||
.inc "core.asm" | |||
.inc "err.h" | |||
.inc "parse.asm" | |||
.equ BLOCKDEV_RAMSTART RAMSTART | |||
.equ BLOCKDEV_COUNT 3 | |||
#include "blockdev.asm" | |||
.inc "blockdev.asm" | |||
; List of devices | |||
.dw emulGetC, unsetZ | |||
.dw unsetZ, emulPutC | |||
.dw fsdevGetC, fsdevPutC | |||
.equ STDIO_RAMSTART BLOCKDEV_RAMEND | |||
#include "stdio.asm" | |||
.inc "stdio.asm" | |||
.equ FS_RAMSTART STDIO_RAMEND | |||
.equ FS_HANDLE_COUNT 0 | |||
#include "fs.asm" | |||
.inc "fs.asm" | |||
init: | |||
di | |||
@@ -1,6 +1,6 @@ | |||
jp test | |||
#include "core.asm" | |||
.inc "core.asm" | |||
testNum: .db 1 | |||
@@ -9,16 +9,16 @@ | |||
jp test | |||
#include "core.asm" | |||
#include "parse.asm" | |||
#include "lib/util.asm" | |||
#include "zasm/util.asm" | |||
#include "zasm/const.asm" | |||
#include "lib/parse.asm" | |||
#include "zasm/parse.asm" | |||
.inc "core.asm" | |||
.inc "parse.asm" | |||
.inc "lib/util.asm" | |||
.inc "zasm/util.asm" | |||
.inc "zasm/const.asm" | |||
.inc "lib/parse.asm" | |||
.inc "zasm/parse.asm" | |||
.equ SYM_RAMSTART DIREC_LASTVAL+2 | |||
#include "zasm/symbol.asm" | |||
#include "zasm/expr.asm" | |||
.inc "zasm/symbol.asm" | |||
.inc "zasm/expr.asm" | |||
; Pretend that we aren't in first pass | |||
zasmIsFirstPass: | |||
@@ -1,7 +1,7 @@ | |||
jp test | |||
#include "core.asm" | |||
#include "parse.asm" | |||
.inc "core.asm" | |||
.inc "parse.asm" | |||
zasmGetPC: | |||
ret | |||
@@ -4,12 +4,12 @@ | |||
jp test | |||
#include "core.asm" | |||
#include "parse.asm" | |||
#include "lib/util.asm" | |||
#include "zasm/util.asm" | |||
#include "lib/parse.asm" | |||
#include "zasm/parse.asm" | |||
.inc "core.asm" | |||
.inc "parse.asm" | |||
.inc "lib/util.asm" | |||
.inc "zasm/util.asm" | |||
.inc "lib/parse.asm" | |||
.inc "zasm/parse.asm" | |||
; mocks. aren't used in tests | |||
zasmGetPC: | |||
@@ -6,12 +6,12 @@ | |||
jp test | |||
#include "core.asm" | |||
#include "lib/util.asm" | |||
#include "zasm/util.asm" | |||
#include "zasm/const.asm" | |||
.inc "core.asm" | |||
.inc "lib/util.asm" | |||
.inc "zasm/util.asm" | |||
.inc "zasm/const.asm" | |||
.equ SYM_RAMSTART RAMSTART | |||
#include "zasm/symbol.asm" | |||
.inc "zasm/symbol.asm" | |||
testNum: .db 1 | |||
@@ -1,8 +1,8 @@ | |||
jp test | |||
#include "core.asm" | |||
#include "parse.asm" | |||
#include "zasm/util.asm" | |||
.inc "core.asm" | |||
.inc "parse.asm" | |||
.inc "zasm/util.asm" | |||
testNum: .db 1 | |||
sFoo: .db "foo", 0 | |||
@@ -50,10 +50,10 @@ chkerr ".equ" 19 | |||
chkerr ".equ foo" 19 | |||
chkerr ".org" 19 | |||
chkerr ".fill" 19 | |||
chkerr "#inc" 19 | |||
chkerr "#inc foo" 19 | |||
chkerr ".inc" 19 | |||
chkerr ".inc foo" 19 | |||
chkerr "ld a, 0x100" 20 | |||
chkerr ".db 0x100" 20 | |||
chkerr "#inc \"doesnotexist\"" 21 | |||
chkerr ".inc \"doesnotexist\"" 21 | |||
chkerr "foo:\\foo:" 22 | |||
chkoom |