zasm: can now assemble zasm/util.asm!

This commit is contained in:
Virgil Dupras 2019-05-17 20:47:43 -04:00
parent 28d5ebdc8a
commit 157ac03e25
6 changed files with 19 additions and 8 deletions

View File

@ -1087,8 +1087,8 @@ instrTBl:
.db I_SBC, 'A', 'l', 0, 0x9e , 0 ; SBC A, (HL) .db I_SBC, 'A', 'l', 0, 0x9e , 0 ; SBC A, (HL)
.db I_SBC, 'A', 0xb, 0, 0b10011000 , 0 ; SBC A, r .db I_SBC, 'A', 0xb, 0, 0b10011000 , 0 ; SBC A, r
.db I_SCF, 0, 0, 0, 0x37 , 0 ; SCF .db I_SCF, 0, 0, 0, 0x37 , 0 ; SCF
.db I_SUB, 'A', 'l', 0, 0x96 , 0 ; SUB A, (HL) .db I_SUB, 'l', 0, 0, 0x96 , 0 ; SUB (HL)
.db I_SUB, 'A', 0xb, 0, 0b10010000 , 0 ; SUB A, r .db I_SUB, 0xb, 0, 0, 0b10010000 , 0 ; SUB r
.db I_SUB, 'n', 0, 0, 0xd6 , 0 ; SUB n .db I_SUB, 'n', 0, 0, 0xd6 , 0 ; SUB n
.db I_XOR, 'l', 0, 0, 0xae , 0 ; XOR (HL) .db I_XOR, 'l', 0, 0, 0xae , 0 ; XOR (HL)
.db I_XOR, 0xb, 0, 0, 0b10101000 , 0 ; XOR r .db I_XOR, 0xb, 0, 0, 0b10101000 , 0 ; XOR r

View File

@ -29,7 +29,7 @@ subDEFromHL:
sub e sub e
ld l, a ld l, a
ld a, h ld a, h
sbc d sbc a, d
ld h, a ld h, a
pop af pop af
ret ret

View File

@ -128,7 +128,7 @@ findchar:
.match: .match:
; We ran 0xff-B loops. That's the result that goes in A. ; We ran 0xff-B loops. That's the result that goes in A.
ld a, 0xff ld a, 0xff
sub a, b sub b
cp a ; ensure Z cp a ; ensure Z
.end: .end:
pop bc pop bc

View File

@ -14,8 +14,10 @@ $(KERNEL_HEADERS):
zasm/user.h: zasm/user.asm zasm/user.h: zasm/user.asm
scas -o - -I ../../apps $< | ./bin2c.sh USERSPACE | tee $@ > /dev/null scas -o - -I ../../apps $< | ./bin2c.sh USERSPACE | tee $@ > /dev/null
zasm/includes.cfs: ../../parts/z80 $(CFSPACK) zasm/includes.cfs: $(CFSPACK)
cp -rf $< zasm/includes rm -rf zasm/includes
cp -r ../../parts/z80 zasm/includes
cp -r ../../apps/zasm zasm/includes/zasm
find zasm/includes -name *.md -delete find zasm/includes -name *.md -delete
find zasm/includes -type f -exec sed -i -e 's/;.*//g' {} \; find zasm/includes -type f -exec sed -i -e 's/;.*//g' {} \;
$(CFSPACK) zasm/includes > $@ $(CFSPACK) zasm/includes > $@

View File

@ -5,11 +5,12 @@ set -e
TMPFILE=$(mktemp) TMPFILE=$(mktemp)
SCAS=scas SCAS=scas
PARTS=../../../parts/z80 PARTS=../../../parts/z80
APPS=../../../apps
ZASM=../../emul/zasm/zasm ZASM=../../emul/zasm/zasm
ASMFILE=../../../apps/zasm/instr.asm ASMFILE=${APPS}/zasm/instr.asm
cmpas() { cmpas() {
EXPECTED=$($SCAS -I ${PARTS} -o - "$1" | xxd) EXPECTED=$($SCAS -I ${PARTS} -I ${APPS} -o - "$1" | xxd)
ACTUAL=$(cat $1 | $ZASM | xxd) ACTUAL=$(cat $1 | $ZASM | xxd)
if [ "$ACTUAL" == "$EXPECTED" ]; then if [ "$ACTUAL" == "$EXPECTED" ]; then
echo ok echo ok

View File

@ -0,0 +1,8 @@
.equ RAMSTART 0x4000
.equ ZASM_FIRST_PASS RAMSTART
.equ ZASM_LOCAL_PASS ZASM_FIRST_PASS+1
.equ ZASM_CTX_PC ZASM_LOCAL_PASS+1
.equ ZASM_RAMEND ZASM_CTX_PC+2
#include "core.asm"
#include "zasm/util.asm"