zasm: can now assemble zasm/symbol.asm!

This commit is contained in:
Virgil Dupras 2019-05-18 18:56:27 -04:00
parent b7f5307de1
commit 29f0bcbe23
2 changed files with 7 additions and 5 deletions

View File

@ -33,11 +33,11 @@
; A list of symbol names separated by null characters. When we encounter a ; A list of symbol names separated by null characters. When we encounter a
; symbol name and want to get its value, we search the name here, retrieve the ; symbol name and want to get its value, we search the name here, retrieve the
; index of the name, then go get the value at that index in SYM_VALUES. ; index of the name, then go get the value at that index in SYM_VALUES.
.equ SYM_NAMES SYM_VALUES+(SYM_MAXCOUNT*2) .equ SYM_NAMES SYM_VALUES+SYM_MAXCOUNT*2
; Registry for local labels. Wiped out after each context change. ; Registry for local labels. Wiped out after each context change.
.equ SYM_LOC_VALUES SYM_NAMES+SYM_BUFSIZE .equ SYM_LOC_VALUES SYM_NAMES+SYM_BUFSIZE
.equ SYM_LOC_NAMES SYM_LOC_VALUES+(SYM_MAXCOUNT*2) .equ SYM_LOC_NAMES SYM_LOC_VALUES+SYM_MAXCOUNT*2
; Pointer to the currently selected registry ; Pointer to the currently selected registry
.equ SYM_CTX_NAMES SYM_LOC_NAMES+SYM_LOC_BUFSIZE .equ SYM_CTX_NAMES SYM_LOC_NAMES+SYM_LOC_BUFSIZE
@ -151,7 +151,7 @@ symRegister:
call strlen call strlen
ld c, a ; save that strlen for later ld c, a ; save that strlen for later
ex hl, de ; symbol to add is now in DE ex de, hl ; symbol to add is now in DE
call symNamesEnd call symNamesEnd
jr nz, .error jr nz, .error
; A is our index. Save it ; A is our index. Save it
@ -168,7 +168,7 @@ symRegister:
jr nc, .error ; HL >= DE jr nc, .error ; HL >= DE
; HL point to where we want to add the string ; HL point to where we want to add the string
ex hl, de ; symbol to add in HL, dest in DE ex de, hl ; symbol to add in HL, dest in DE
; Copy HL into DE until we reach null char ; Copy HL into DE until we reach null char
; C already have our strlen (minus null char). Let's prepare BC for ; C already have our strlen (minus null char). Let's prepare BC for
; a LDIR. ; a LDIR.
@ -217,7 +217,7 @@ symFind:
push bc push bc
push de push de
ex hl, de ; it's easier if HL is haystack and DE is ex de, hl ; it's easier if HL is haystack and DE is
; needle. ; needle.
ld b, 0 ld b, 0
ld hl, (SYM_CTX_NAMES) ld hl, (SYM_CTX_NAMES)

View File

@ -17,6 +17,8 @@
#include "zasm/util.asm" #include "zasm/util.asm"
.equ IO_RAMSTART ZASM_RAMEND .equ IO_RAMSTART ZASM_RAMEND
#include "zasm/io.asm" #include "zasm/io.asm"
.equ SYM_RAMSTART IO_RAMEND
#include "zasm/symbol.asm"
zasmIsFirstPass: zasmIsFirstPass:
nop nop