2019-05-19 12:57:59 -04:00
|
|
|
; zasm
|
|
|
|
;
|
|
|
|
; Reads input from specified blkdev ID, assemble the binary in two passes and
|
|
|
|
; spit the result in another specified blkdev ID.
|
|
|
|
;
|
|
|
|
; We don't buffer the whole source in memory, so we need our input blkdev to
|
|
|
|
; support Seek so we can read the file a second time. So, for input, we need
|
|
|
|
; GetC and Seek.
|
|
|
|
;
|
|
|
|
; For output, we only need PutC. Output doesn't start until the second pass.
|
|
|
|
;
|
|
|
|
; The goal of the second pass is to assign values to all symbols so that we
|
|
|
|
; can have forward references (instructions referencing a label that happens
|
|
|
|
; later).
|
|
|
|
;
|
|
|
|
; Labels and constants are both treated the same way, that is, they can be
|
|
|
|
; forward-referenced in instructions. ".equ" directives, however, are evaluated
|
|
|
|
; during the first pass so forward references are not allowed.
|
|
|
|
;
|
|
|
|
; *** Requirements ***
|
|
|
|
; strncmp
|
|
|
|
; addDE
|
|
|
|
; addHL
|
|
|
|
; upcase
|
|
|
|
; unsetZ
|
|
|
|
; intoDE
|
|
|
|
; intoHL
|
|
|
|
; writeHLinDE
|
|
|
|
; findchar
|
|
|
|
; parseHex
|
|
|
|
; parseHexPair
|
|
|
|
; blkSel
|
2019-06-04 20:45:01 -04:00
|
|
|
; blkSet
|
2019-05-19 12:57:59 -04:00
|
|
|
; fsFindFN
|
|
|
|
; fsOpen
|
|
|
|
; fsGetC
|
2019-05-31 11:12:29 -04:00
|
|
|
; cpHLDE
|
2019-06-02 14:05:20 -04:00
|
|
|
; parseArgs
|
2019-06-04 11:53:02 -04:00
|
|
|
; _blkGetC
|
|
|
|
; _blkPutC
|
|
|
|
; _blkSeek
|
|
|
|
; _blkTell
|
2019-06-19 11:42:39 -04:00
|
|
|
; printstr
|
2019-05-19 12:57:59 -04:00
|
|
|
; FS_HANDLE_SIZE
|
2019-06-04 11:53:02 -04:00
|
|
|
; BLOCKDEV_SIZE
|
2019-05-19 12:57:59 -04:00
|
|
|
|
|
|
|
; *** Variables ***
|
|
|
|
|
|
|
|
#include "user.h"
|
2019-06-02 14:05:20 -04:00
|
|
|
#include "err.h"
|
2019-05-19 12:57:59 -04:00
|
|
|
.org USER_CODE
|
|
|
|
|
|
|
|
jp zasmMain
|
|
|
|
|
2019-05-27 11:22:38 -04:00
|
|
|
#include "zasm/const.asm"
|
2019-05-19 12:57:59 -04:00
|
|
|
#include "zasm/util.asm"
|
|
|
|
.equ IO_RAMSTART USER_RAMSTART
|
|
|
|
#include "zasm/io.asm"
|
|
|
|
.equ TOK_RAMSTART IO_RAMEND
|
|
|
|
#include "zasm/tok.asm"
|
2019-07-13 11:53:30 -04:00
|
|
|
#include "lib/parse.asm"
|
2019-05-19 12:57:59 -04:00
|
|
|
#include "zasm/parse.asm"
|
|
|
|
#include "zasm/expr.asm"
|
|
|
|
#include "zasm/instr.asm"
|
|
|
|
.equ DIREC_RAMSTART TOK_RAMEND
|
|
|
|
#include "zasm/directive.asm"
|
|
|
|
.equ SYM_RAMSTART DIREC_RAMEND
|
|
|
|
#include "zasm/symbol.asm"
|
|
|
|
.equ ZASM_RAMSTART SYM_RAMEND
|
|
|
|
#include "zasm/main.asm"
|
|
|
|
|