mirror of
https://github.com/hsoft/collapseos.git
synced 2024-11-23 22:18:07 +11:00
zasm: remove SYM_CTX_PTR
This commit is contained in:
parent
f4f91ebd79
commit
b95f4c8c24
@ -36,9 +36,7 @@
|
|||||||
.equ SYM_LOC_VALUES SYM_NAMES+SYM_BUFSIZE
|
.equ SYM_LOC_VALUES SYM_NAMES+SYM_BUFSIZE
|
||||||
.equ SYM_LOC_NAMES SYM_LOC_VALUES+SYM_LOC_MAXCOUNT*2
|
.equ SYM_LOC_NAMES SYM_LOC_VALUES+SYM_LOC_MAXCOUNT*2
|
||||||
|
|
||||||
; Pointer, in the value list, to the result of the last _symFind
|
.equ SYM_RAMEND SYM_LOC_NAMES+SYM_LOC_BUFSIZE
|
||||||
.equ SYM_CTX_PTR SYM_LOC_NAMES+SYM_LOC_BUFSIZE
|
|
||||||
.equ SYM_RAMEND SYM_CTX_PTR+2
|
|
||||||
|
|
||||||
; *** Registries ***
|
; *** Registries ***
|
||||||
; A symbol registry is a 6 bytes record with points to names and values of
|
; A symbol registry is a 6 bytes record with points to names and values of
|
||||||
@ -149,12 +147,12 @@ symRegisterLocal:
|
|||||||
; If successful, Z is set and A is the symbol index. Otherwise, Z is unset and
|
; If successful, Z is set and A is the symbol index. Otherwise, Z is unset and
|
||||||
; A is an error code (ERR_*).
|
; A is an error code (ERR_*).
|
||||||
symRegister:
|
symRegister:
|
||||||
call _symFind
|
|
||||||
jr z, .alreadyThere
|
|
||||||
|
|
||||||
push hl ; --> lvl 1. it's the symbol to add
|
push hl ; --> lvl 1. it's the symbol to add
|
||||||
push de ; --> lvl 2. it's our value.
|
push de ; --> lvl 2. it's our value.
|
||||||
|
|
||||||
|
call _symFind
|
||||||
|
jr z, .alreadyThere
|
||||||
|
|
||||||
|
|
||||||
; First, let's get our strlen
|
; First, let's get our strlen
|
||||||
call strlen
|
call strlen
|
||||||
@ -227,25 +225,24 @@ symRegister:
|
|||||||
|
|
||||||
call zasmIsFirstPass
|
call zasmIsFirstPass
|
||||||
jr z, .duplicateError
|
jr z, .duplicateError
|
||||||
; Second pass. Don't error out, just update value
|
; Second pass. Don't error out, just update value, which DE points to.
|
||||||
push hl ; --> lvl 1
|
pop hl ; <-- lvl 2, the value to register
|
||||||
ld hl, (SYM_CTX_PTR)
|
|
||||||
ex de, hl
|
|
||||||
call writeHLinDE
|
call writeHLinDE
|
||||||
pop hl ; <-- lvl 1
|
pop hl ; <-- lvl 1
|
||||||
cp a ; ensure Z
|
cp a ; ensure Z
|
||||||
ret
|
ret
|
||||||
.duplicateError:
|
.duplicateError:
|
||||||
|
pop de ; <-- lvl 2
|
||||||
|
pop hl ; <-- lvl 1
|
||||||
ld a, ERR_DUPSYM
|
ld a, ERR_DUPSYM
|
||||||
jp unsetZ ; return
|
jp unsetZ ; return
|
||||||
|
|
||||||
; Assuming that IX points to a register context, find name HL in its names and
|
; Assuming that IX points to a registry, find name HL in its names and make DE
|
||||||
; make the context pointer point to the corresponding entry in its values.
|
; point to the corresponding entry in its values.
|
||||||
; If we find something, Z is set, otherwise unset.
|
; If we find something, Z is set, otherwise unset.
|
||||||
_symFind:
|
_symFind:
|
||||||
push iy
|
push iy
|
||||||
push hl
|
push hl
|
||||||
push de
|
|
||||||
|
|
||||||
ex de, hl ; 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.
|
||||||
@ -269,11 +266,10 @@ _symFind:
|
|||||||
call unsetZ
|
call unsetZ
|
||||||
jr .end
|
jr .end
|
||||||
.match:
|
.match:
|
||||||
push iy \ pop hl
|
push iy \ pop de
|
||||||
ld (SYM_CTX_PTR), hl
|
; DE has our result
|
||||||
cp a ; ensure Z
|
cp a ; ensure Z
|
||||||
.end:
|
.end:
|
||||||
pop de
|
|
||||||
pop hl
|
pop hl
|
||||||
pop iy
|
pop iy
|
||||||
ret
|
ret
|
||||||
@ -293,8 +289,7 @@ symFindVal:
|
|||||||
call _symFind
|
call _symFind
|
||||||
jr nz, .end
|
jr nz, .end
|
||||||
; Found! let's fetch value
|
; Found! let's fetch value
|
||||||
; Return value that (SYM_CTX_PTR) is pointing at in DE.
|
; DE is pointing to our result
|
||||||
ld de, (SYM_CTX_PTR)
|
|
||||||
call intoDE
|
call intoDE
|
||||||
.end:
|
.end:
|
||||||
pop ix
|
pop ix
|
||||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user