zasm: add support for .fill directive

This commit is contained in:
Virgil Dupras 2019-05-20 08:20:00 -04:00
parent ae315499cb
commit 848a7500bc
4 changed files with 20 additions and 3 deletions

View File

@ -4,7 +4,8 @@
.equ D_DW 0x01 .equ D_DW 0x01
.equ D_EQU 0x02 .equ D_EQU 0x02
.equ D_ORG 0x03 .equ D_ORG 0x03
.equ D_INC 0x04 .equ D_FIL 0x04
.equ D_INC 0x05
.equ D_BAD 0xff .equ D_BAD 0xff
; *** Variables *** ; *** Variables ***
@ -18,6 +19,7 @@ directiveNames:
.db ".DW", 0 .db ".DW", 0
.db ".EQU" .db ".EQU"
.db ".ORG" .db ".ORG"
.db ".FIL"
.db "#inc" .db "#inc"
; This is a list of handlers corresponding to indexes in directiveNames ; This is a list of handlers corresponding to indexes in directiveNames
@ -26,6 +28,7 @@ directiveHandlers:
.dw handleDW .dw handleDW
.dw handleEQU .dw handleEQU
.dw handleORG .dw handleORG
.dw handleFIL
.dw handleINC .dw handleINC
handleDB: handleDB:
@ -103,6 +106,19 @@ handleORG:
push ix \ pop hl push ix \ pop hl
jp zasmSetOrg jp zasmSetOrg
handleFIL:
call readWord
call parseExpr
ret nz
push bc
push ix \ pop bc
xor a
ld b, c
.loop:
call ioPutC
djnz .loop
pop bc
handleINC: handleINC:
call readWord call readWord
jr nz, .end jr nz, .end

View File

@ -33,11 +33,11 @@ shell/shell: shell/shell.c libz80/libz80.o shell/kernel.h $(CFSPACK)
$(ZASMBIN): zasm/zasm.c libz80/libz80.o zasm/kernel.h zasm/user.h zasm/includes.h $(ZASMBIN): zasm/zasm.c libz80/libz80.o zasm/kernel.h zasm/user.h zasm/includes.h
runbin/runbin: runbin/runbin.c libz80/libz80.o runbin/runbin: runbin/runbin.c libz80/libz80.o
$(TARGETS): $(TARGETS):
cc $< libz80/libz80.o -o $@ $(CC) $< libz80/libz80.o -o $@
libz80/libz80.o: libz80/z80.c libz80/libz80.o: libz80/z80.c
make -C libz80/codegen opcodes make -C libz80/codegen opcodes
gcc -Wall -ansi -g -c -o libz80/libz80.o libz80/z80.c $(CC) -Wall -ansi -g -c -o libz80/libz80.o libz80/z80.c
$(CFSPACK): $(CFSPACK):
make -C ../cfspack make -C ../cfspack

Binary file not shown.

View File

@ -27,3 +27,4 @@ label2: .dw 0x42
rlc c rlc c
cp '-' cp '-'
sbc hl, de sbc hl, de
.fill 0x10