1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-11-23 22:38:06 +11:00

zasm: can now assemble zasm/instr.asm!

This commit is contained in:
Virgil Dupras 2019-05-19 10:40:45 -04:00
parent ea8477bb91
commit 6cbce0533a
2 changed files with 14 additions and 18 deletions

View File

@ -234,7 +234,7 @@ findInGroup:
push bc push bc
push hl push hl
cp 0 ; is our arg empty? If yes, we have nothing to do or a ; is our arg empty? If yes, we have nothing to do
jr z, .notfound jr z, .notfound
push af push af
@ -257,7 +257,7 @@ findInGroup:
rla rla
call addDE ; At this point, DE points to our group call addDE ; At this point, DE points to our group
pop af pop af
ex hl, de ; And now, HL points to the group ex de, hl ; And now, HL points to the group
pop de pop de
ld bc, 4 ld bc, 4
@ -308,11 +308,11 @@ findInGroup:
; in (HL+1). This will save us significant processing later in getUpcode. ; in (HL+1). This will save us significant processing later in getUpcode.
; Set Z according to whether we match or not. ; Set Z according to whether we match or not.
matchArg: matchArg:
cp a, (hl) cp (hl)
ret z ret z
; not an exact match. Before we continue: is A zero? Because if it is, ; not an exact match. Before we continue: is A zero? Because if it is,
; we have to stop right here: no match possible. ; we have to stop right here: no match possible.
cp 0 or a
jr nz, .checkIfNumber ; not a zero, we can continue jr nz, .checkIfNumber ; not a zero, we can continue
; zero, stop here ; zero, stop here
call unsetZ call unsetZ
@ -328,7 +328,7 @@ matchArg:
; point in the processing, we don't care about whether N or M is upper, ; point in the processing, we don't care about whether N or M is upper,
; we do truncation tests later. So, let's just perform the same == test ; we do truncation tests later. So, let's just perform the same == test
; but in a case-insensitive way instead ; but in a case-insensitive way instead
cp a, (hl) cp (hl)
ret ; whether we match or not, the result of Z is ret ; whether we match or not, the result of Z is
; the good one. ; the good one.
.notNumber: .notNumber:
@ -356,8 +356,7 @@ matchArg:
matchPrimaryRow: matchPrimaryRow:
push hl push hl
push ix push ix
ld ixh, d push de \ pop ix
ld ixl, e
cp (ix) cp (ix)
jr nz, .end jr nz, .end
; name matches, let's see the rest ; name matches, let's see the rest
@ -567,8 +566,7 @@ getUpcode:
push hl push hl
push bc push bc
; First, let's go in IX mode. It's easier to deal with offsets here. ; First, let's go in IX mode. It's easier to deal with offsets here.
ld ixh, d push de \ pop ix
ld ixl, e
; Are we a "special instruction"? ; Are we a "special instruction"?
bit 5, (ix+3) bit 5, (ix+3)
@ -629,7 +627,7 @@ getUpcode:
; displace it left by the number of steps specified in the table. ; displace it left by the number of steps specified in the table.
push af push af
ld a, (ix+3) ; displacement bit ld a, (ix+3) ; displacement bit
and a, 0xf ; we only use the lower nibble. and 0xf ; we only use the lower nibble.
ld b, a ld b, a
pop af pop af
call rlaX call rlaX
@ -758,11 +756,10 @@ processArg:
; We don't use the space allocated to store those numbers in any other ; We don't use the space allocated to store those numbers in any other
; occasion, we store IX there unconditonally, LSB first. ; occasion, we store IX there unconditonally, LSB first.
inc de inc de
ld a, ixl push hl
ld (de), a push ix \ pop hl
inc de call writeHLinDE
ld a, ixh pop hl
ld (de), a
cp a ; ensure Z is set cp a ; ensure Z is set
ret ret
.error: .error:

View File

@ -24,6 +24,7 @@
#include "zasm/tok.asm" #include "zasm/tok.asm"
.equ DIREC_RAMSTART TOK_RAMEND .equ DIREC_RAMSTART TOK_RAMEND
#include "zasm/directive.asm" #include "zasm/directive.asm"
#include "zasm/instr.asm"
zasmIsFirstPass: zasmIsFirstPass:
nop nop
@ -31,8 +32,6 @@ zasmIsFirstPass:
zasmIsLocalPass: zasmIsLocalPass:
nop nop
getInstID:
nop
parseExpr: parseExpr:
nop nop