diff --git a/apps/zasm/main.asm b/apps/zasm/main.asm index 231cabf..9f4c09b 100644 --- a/apps/zasm/main.asm +++ b/apps/zasm/main.asm @@ -9,9 +9,9 @@ main: ld bc, 0 ; C is our written bytes counter .loop: call parseLine - or a ; is zero? stop - jr z, .stop - add a, c + jr nz, .stop + ld a, c + add a, ixl ld c, a call gotoNextLine jr nz, .stop ; error? stop @@ -25,8 +25,9 @@ main: #include "directive.asm" ; Parse line in (HL), write the resulting opcode(s) in (DE) and returns the -; number of written bytes in A. Advances HL where tokenization stopped and DE +; number of written bytes in IXL. Advances HL where tokenization stopped and DE ; to where we should write the next upcode. +; Sets Z if parse was successful, unset if there was an error or EOF. parseLine: push bc @@ -51,9 +52,14 @@ parseLine: call copy pop hl call JUMP_ADDDE + jr .success +.success: + ld ixl, a + xor a ; ensure Z jr .end .error: - xor a + xor ixl + call JUMP_UNSETZ .end: pop bc ret