zasm: print progress indicator while assembling
This commit is contained in:
parent
66fbd20e21
commit
7cdc288ef2
@ -80,6 +80,7 @@ handleDB:
|
||||
jr z, .stopStrLit ; be our closing quote. Stop.
|
||||
; Normal character, output
|
||||
call ioPutC
|
||||
jr nz, .ioError
|
||||
jr .stringLiteral
|
||||
|
||||
handleDW:
|
||||
@ -93,13 +94,18 @@ handleDW:
|
||||
push ix \ pop hl
|
||||
ld a, l
|
||||
call ioPutC
|
||||
jr nz, .ioError
|
||||
ld a, h
|
||||
call ioPutC
|
||||
jr nz, .ioError
|
||||
call readComma
|
||||
jr z, .loop
|
||||
cp a ; ensure Z
|
||||
pop hl
|
||||
ret
|
||||
.ioError:
|
||||
ld a, SHELL_ERR_IO_ERROR
|
||||
jr .error
|
||||
.badfmt:
|
||||
ld a, ERR_BAD_FMT
|
||||
jr .error
|
||||
@ -181,10 +187,14 @@ handleFIL:
|
||||
ld b, c
|
||||
.loop:
|
||||
call ioPutC
|
||||
jr nz, .ioError
|
||||
djnz .loop
|
||||
cp a ; ensure Z
|
||||
pop bc
|
||||
ret
|
||||
.ioError:
|
||||
ld a, SHELL_ERR_IO_ERROR
|
||||
jr .error
|
||||
.badfmt:
|
||||
ld a, ERR_BAD_FMT
|
||||
jr .error
|
||||
|
@ -18,7 +18,6 @@
|
||||
; during the first pass so forward references are not allowed.
|
||||
;
|
||||
; *** Requirements ***
|
||||
; blockdev
|
||||
; strncmp
|
||||
; addDE
|
||||
; addHL
|
||||
@ -41,6 +40,7 @@
|
||||
; _blkPutC
|
||||
; _blkSeek
|
||||
; _blkTell
|
||||
; printstr
|
||||
; FS_HANDLE_SIZE
|
||||
; BLOCKDEV_SIZE
|
||||
|
||||
|
@ -223,6 +223,7 @@ ioInInclude:
|
||||
; Open include file name specified in (HL).
|
||||
; Sets Z on success, unset on error.
|
||||
ioOpenInclude:
|
||||
call ioPrintLN
|
||||
call fsFindFN
|
||||
ret nz
|
||||
ld ix, IO_INCLUDE_HDL
|
||||
@ -257,3 +258,13 @@ _ioIncGetC:
|
||||
_ioIncBlk:
|
||||
.dw _ioIncGetC, unsetZ
|
||||
|
||||
; call printstr followed by newline
|
||||
ioPrintLN:
|
||||
push hl
|
||||
call printstr
|
||||
ld hl, .sCRLF
|
||||
call printstr
|
||||
pop hl
|
||||
ret
|
||||
.sCRLF:
|
||||
.db 0x0a, 0x0d, 0
|
||||
|
@ -53,11 +53,15 @@ zasmMain:
|
||||
call symInit
|
||||
|
||||
; First pass
|
||||
ld hl, .sFirstPass
|
||||
call ioPrintLN
|
||||
ld a, 1
|
||||
ld (ZASM_FIRST_PASS), a
|
||||
call zasmParseFile
|
||||
jr nz, .end
|
||||
; Second pass
|
||||
ld hl, .sSecondPass
|
||||
call ioPrintLN
|
||||
xor a
|
||||
ld (ZASM_FIRST_PASS), a
|
||||
call zasmParseFile
|
||||
@ -66,6 +70,10 @@ zasmMain:
|
||||
|
||||
.argspecs:
|
||||
.db 0b001, 0b001, 0
|
||||
.sFirstPass:
|
||||
.db "First pass", 0
|
||||
.sSecondPass:
|
||||
.db "Second pass", 0
|
||||
|
||||
; Sets Z according to whether we're in first pass.
|
||||
zasmIsFirstPass:
|
||||
|
@ -31,6 +31,7 @@ jp _blkGetC
|
||||
jp _blkPutC
|
||||
jp _blkSeek
|
||||
jp _blkTell
|
||||
jp printstr
|
||||
|
||||
#include "core.asm"
|
||||
#include "err.h"
|
||||
@ -43,7 +44,10 @@ jp _blkTell
|
||||
.dw unsetZ, emulPutC
|
||||
.dw fsdevGetC, fsdevPutC
|
||||
|
||||
.equ FS_RAMSTART BLOCKDEV_RAMEND
|
||||
.equ STDIO_RAMSTART BLOCKDEV_RAMEND
|
||||
#include "stdio.asm"
|
||||
|
||||
.equ FS_RAMSTART STDIO_RAMEND
|
||||
.equ FS_HANDLE_COUNT 0
|
||||
#include "fs.asm"
|
||||
|
||||
@ -51,6 +55,9 @@ init:
|
||||
di
|
||||
ld hl, 0xffff
|
||||
ld sp, hl
|
||||
ld hl, unsetZ
|
||||
ld de, stderrPutC
|
||||
call stdioInit
|
||||
ld a, 2 ; select fsdev
|
||||
ld de, BLOCKDEV_SEL
|
||||
call blkSel
|
||||
@ -85,6 +92,11 @@ emulPutC:
|
||||
cp a ; ensure Z
|
||||
ret
|
||||
|
||||
stderrPutC:
|
||||
out (STDERR_PORT), a
|
||||
cp a ; ensure Z
|
||||
ret
|
||||
|
||||
fsdevGetC:
|
||||
ld a, e
|
||||
out (FS_SEEK_PORT), a
|
||||
|
@ -26,3 +26,4 @@
|
||||
.equ _blkPutC 0x3c
|
||||
.equ _blkSeek 0x3f
|
||||
.equ _blkTell 0x42
|
||||
.equ printstr 0x45
|
||||
|
@ -40,6 +40,9 @@
|
||||
// When defined, we dump memory instead of dumping expected stdout
|
||||
//#define MEMDUMP
|
||||
//#define DEBUG
|
||||
// By default, we don't spit what zasm prints. Too noisy. Define VERBOSE if
|
||||
// you want to spit this content to stderr.
|
||||
//#define VERBOSE
|
||||
|
||||
static Z80Context cpu;
|
||||
static uint8_t mem[0x10000];
|
||||
@ -132,7 +135,9 @@ static void io_write(int unused, uint16_t addr, uint8_t val)
|
||||
#endif
|
||||
}
|
||||
} else if (addr == STDERR_PORT) {
|
||||
#ifdef VERBOSE
|
||||
fputc(val, stderr);
|
||||
#endif
|
||||
} else {
|
||||
fprintf(stderr, "Out of bounds I/O write: %d / %d (0x%x)\n", addr, val, val);
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
.equ USER_CODE 0x4800
|
||||
.equ USER_RAMSTART 0x5800
|
||||
.equ FS_HANDLE_SIZE 8
|
||||
.equ FS_HANDLE_SIZE 6
|
||||
.equ BLOCKDEV_SIZE 8
|
||||
|
||||
; *** JUMP TABLE ***
|
||||
@ -26,6 +26,7 @@
|
||||
.equ _blkPutC 0x3c
|
||||
.equ _blkSeek 0x3f
|
||||
.equ _blkTell 0x42
|
||||
.equ printstr 0x45
|
||||
|
||||
#include "err.h"
|
||||
#include "zasm/const.asm"
|
||||
|
Loading…
Reference in New Issue
Block a user