mirror of
https://github.com/hsoft/collapseos.git
synced 2024-11-23 19:58:06 +11:00
zasm: consolidate
* Build emulated zasm statically * Improve comments in zasm.asm * Fix build * Use unsetZ from core
This commit is contained in:
parent
055e0d7a31
commit
175e1328e7
@ -1,11 +1,12 @@
|
||||
zasm: zasm.c libz80/libz80.so kernel.h zasm.h
|
||||
cc $< -l z80 -L./libz80 -Wl,-rpath ./libz80 -o $@
|
||||
zasm: zasm.c libz80/libz80.o kernel.h zasm.h
|
||||
cc $< libz80/libz80.o -o $@
|
||||
|
||||
libz80/libz80.so: libz80/Makefile
|
||||
make -C libz80
|
||||
libz80/libz80.o: libz80/z80.c
|
||||
make -C libz80/codegen opcodes
|
||||
gcc -Wall -ansi -g -c -o libz80/libz80.o libz80/z80.c
|
||||
|
||||
kernel.h: glue.asm
|
||||
scas -o - -I ../../../parts $< | ./bin2c.sh KERNEL | tee $@ > /dev/null
|
||||
scas -o - -I ../../../parts/z80 $< | ./bin2c.sh KERNEL | tee $@ > /dev/null
|
||||
|
||||
zasm.h: ../zasm.asm ../tok.asm
|
||||
scas -o - -I.. $< | ./bin2c.sh ZASM | tee $@ > /dev/null
|
||||
|
@ -8,6 +8,7 @@ jr init ; 2 bytes
|
||||
jp strncmp
|
||||
jp addDE
|
||||
jp upcase
|
||||
jp unsetZ
|
||||
|
||||
init:
|
||||
di
|
||||
|
@ -6,3 +6,4 @@ USER_CODE .equ RAMSTART
|
||||
JUMP_STRNCMP .equ 0x02
|
||||
JUMP_ADDDE .equ 0x05
|
||||
JUMP_UPCASE .equ 0x08
|
||||
JUMP_UNSETZ .equ 0x0b
|
||||
|
@ -20,15 +20,6 @@ ret
|
||||
|
||||
#include "tok.asm"
|
||||
|
||||
; TODO: call from core
|
||||
unsetZ:
|
||||
push bc
|
||||
ld b, a
|
||||
inc b
|
||||
cp b
|
||||
pop bc
|
||||
ret
|
||||
|
||||
; run RLA the number of times specified in B
|
||||
rlaX:
|
||||
; first, see if B == 0 to see if we need to bail out
|
||||
@ -93,7 +84,7 @@ enterParens:
|
||||
ret ; we're good!
|
||||
.doNotEnter:
|
||||
pop hl
|
||||
call unsetZ
|
||||
call JUMP_UNSETZ
|
||||
ret
|
||||
|
||||
; Checks whether A is 'N' or 'M'
|
||||
@ -167,7 +158,7 @@ parseNumber:
|
||||
jr .loop
|
||||
|
||||
.error:
|
||||
call unsetZ
|
||||
call JUMP_UNSETZ
|
||||
.end:
|
||||
pop bc
|
||||
pop de
|
||||
@ -312,7 +303,7 @@ isGroupId:
|
||||
cp a
|
||||
ret
|
||||
.notgroup:
|
||||
call unsetZ
|
||||
call JUMP_UNSETZ
|
||||
ret
|
||||
|
||||
; Find argspec A in group id H.
|
||||
@ -382,7 +373,7 @@ findInGroup:
|
||||
jr .end
|
||||
.notfound:
|
||||
pop bc ; from the push bc in .find
|
||||
call unsetZ
|
||||
call JUMP_UNSETZ
|
||||
.end:
|
||||
pop hl
|
||||
pop bc
|
||||
@ -403,7 +394,7 @@ matchArg:
|
||||
cp 0
|
||||
jr nz, .checkIfNumber ; not a zero, we can continue
|
||||
; zero, stop here
|
||||
call unsetZ
|
||||
call JUMP_UNSETZ
|
||||
ret
|
||||
.checkIfNumber:
|
||||
; not an exact match, let's check for numerical constants.
|
||||
@ -502,7 +493,7 @@ handleBIT:
|
||||
ret
|
||||
.error:
|
||||
xor c
|
||||
call unsetZ
|
||||
call JUMP_UNSETZ
|
||||
ret
|
||||
|
||||
handleBITHL:
|
||||
@ -792,7 +783,7 @@ processArg:
|
||||
cp a ; ensure Z is set
|
||||
ret
|
||||
.error:
|
||||
call unsetZ
|
||||
call JUMP_UNSETZ
|
||||
ret
|
||||
|
||||
; Parse line at (HL) and write resulting opcode(s) in curUpcode. Returns the
|
||||
@ -910,8 +901,8 @@ argGrpCC:
|
||||
argGrpABCDEHL:
|
||||
.db "BCDEHL_A" ; 0xb
|
||||
|
||||
; This is a list of primary instructions (single upcode) that lead to a
|
||||
; constant (no group code to insert). Format:
|
||||
; This is a list of all supported instructions. Each row represent a combination
|
||||
; of instr/argspecs (which means more than one row per instr). Format:
|
||||
;
|
||||
; 4 bytes for the name (fill with zero)
|
||||
; 1 byte for arg constant
|
||||
@ -919,9 +910,12 @@ argGrpABCDEHL:
|
||||
; 1 byte displacement for group arguments + flags
|
||||
; 2 bytes for upcode (2nd byte is zero if instr is one byte)
|
||||
;
|
||||
; An "arg constant" is a char corresponding to either a row in argspecTbl or
|
||||
; a group index in argGrpTbl (values < 0x10 are considered group indexes).
|
||||
;
|
||||
; The displacement bit is split in 2 nibbles: lower nibble is the displacement
|
||||
; value, upper nibble is for flags:
|
||||
|
||||
;
|
||||
; Bit 7: indicates that the numerical argument is of the 'e' type and has to be
|
||||
; decreased by 2 (djnz, jr).
|
||||
; Bit 6: it indicates that the group argument's value is to be placed on the
|
||||
|
Loading…
Reference in New Issue
Block a user