Преглед на файлове

zasm: make getSymVal not responsible for calling symFind

With local labels, these two will have to be decoupled.
pull/10/head
Virgil Dupras преди 5 години
родител
ревизия
746c86cbf8
променени са 2 файла, в които са добавени 16 реда и са изтрити 10 реда
  1. +8
    -4
      apps/zasm/parse.asm
  2. +8
    -6
      apps/zasm/symbol.asm

+ 8
- 4
apps/zasm/parse.asm Целия файл

@@ -120,14 +120,18 @@ parseNumber:
parseNumberOrSymbol:
call parseNumber
ret z
call zasmIsFirstPass
ret z ; first pass? we don't care about the value,
; return success.
; Not a number. Try symbol
call symFind
ret nz ; not found
; Found! index in A, let's fetch value
push de
call symGetVal
jr nz, .notfound ; Z already unset
; Found! value in DE. We need it in IX
; value in DE. We need it in IX
ld ixh, d
ld ixl, e
; Z already set
.notfound:
pop de
cp a ; ensure Z
ret

+ 8
- 6
apps/zasm/symbol.asm Целия файл

@@ -1,4 +1,11 @@
; Manages both constants and labels within a same namespace and registry.
;
; About local labels: They are treated as regular labels except they start with
; a dot (example: ".foo"). Because labels are registered in order and because
; constants are registered in the second pass, they end up at the end of the
; symbol list and don't mix with labels. Therefore, we easily iterate through
; local labels of a context by starting from that context's index and iterating
; as long as symbol name start with a '.'

; *** Constants ***
; Duplicate symbol in registry
@@ -166,14 +173,9 @@ symFind:
pop hl
ret

; Return value associated with symbol string in (HL) into DE.
; Return value associated with symbol index A into DE
; Sets Z on success, unset on error.
symGetVal:
call zasmIsFirstPass
ret z ; first pass? we don't care about the value,
; return success.
call symFind
ret nz ; not found
; our index is in A. Let's fetch the proper value
push hl
ld hl, SYM_VALUES


Loading…
Отказ
Запис