mirror of
https://github.com/dschmenk/PLASMA.git
synced 2024-12-25 21:29:34 +00:00
Clean up address initializers
This commit is contained in:
parent
d46387390b
commit
e0ef6a6754
@ -2104,12 +2104,16 @@ def emit_data(vartype, consttype, constval, constsize)
|
|||||||
constsize = constsize - 1
|
constsize = constsize - 1
|
||||||
loop
|
loop
|
||||||
else
|
else
|
||||||
if vartype == WORD_TYPE
|
if vartype & BYTE_TYPE
|
||||||
size = 2
|
|
||||||
emit_word(constval)
|
|
||||||
else
|
|
||||||
size = 1
|
size = 1
|
||||||
emit_byte(constval)
|
emit_byte(constval)
|
||||||
|
else
|
||||||
|
size = 2
|
||||||
|
if consttype & ADDR_TYPE
|
||||||
|
emit_addr(constval)
|
||||||
|
else
|
||||||
|
emit_word(constval)
|
||||||
|
fin
|
||||||
fin
|
fin
|
||||||
fin
|
fin
|
||||||
return size
|
return size
|
||||||
@ -2893,7 +2897,7 @@ def parse_constval(valptr, sizeptr)
|
|||||||
if mod; return parse_err(@bad_op); fin
|
if mod; return parse_err(@bad_op); fin
|
||||||
break
|
break
|
||||||
is CHR_TKN
|
is CHR_TKN
|
||||||
^valptr = constval
|
*valptr = constval
|
||||||
^sizeptr = 1
|
^sizeptr = 1
|
||||||
type = BYTE_TYPE
|
type = BYTE_TYPE
|
||||||
break
|
break
|
||||||
@ -2907,46 +2911,23 @@ def parse_constval(valptr, sizeptr)
|
|||||||
idptr = id_lookup(tknptr, tknlen)
|
idptr = id_lookup(tknptr, tknlen)
|
||||||
if !idptr; return parse_err(@bad_cnst); fin
|
if !idptr; return parse_err(@bad_cnst); fin
|
||||||
type = idptr->idtype
|
type = idptr->idtype
|
||||||
if type & VAR_TYPE
|
if type & ADDR_TYPE
|
||||||
if !(mod & 8); return parse_err(@bad_cnst); fin
|
if !(mod & 8); return parse_err(@bad_cnst); fin
|
||||||
if idptr=>idval & IS_CTAG
|
|
||||||
ctag = idptr=>idval & MASK_CTAG
|
|
||||||
if ctag_tbl:[ctag] & IS_RESOLVED
|
|
||||||
*valptr = (ctag_tbl:[ctag] & MASK_CTAG) + codebuff
|
|
||||||
else
|
|
||||||
return parse_err(@bad_cnst)
|
|
||||||
fin
|
fin
|
||||||
else
|
|
||||||
*valptr = idptr=>idval + codebuff
|
|
||||||
fin
|
|
||||||
else
|
|
||||||
*valptr = idptr=>idval
|
*valptr = idptr=>idval
|
||||||
fin
|
|
||||||
break
|
break
|
||||||
otherwise
|
otherwise
|
||||||
return parse_err(@bad_cnst)
|
return parse_err(@bad_cnst)
|
||||||
wend
|
wend
|
||||||
if mod & 1
|
if mod & 1
|
||||||
if type == BYTE_TYPE
|
|
||||||
^valptr = -^valptr
|
|
||||||
else
|
|
||||||
*valptr = -*valptr
|
*valptr = -*valptr
|
||||||
fin
|
fin
|
||||||
fin
|
|
||||||
if mod & 2
|
if mod & 2
|
||||||
if type == BYTE_TYPE
|
|
||||||
^valptr = ~^valptr
|
|
||||||
else
|
|
||||||
*valptr = ~*valptr
|
*valptr = ~*valptr
|
||||||
fin
|
fin
|
||||||
fin
|
|
||||||
if mod & 4
|
if mod & 4
|
||||||
if type == BYTE_TYPE
|
|
||||||
^valptr = !^valptr
|
|
||||||
else
|
|
||||||
*valptr = !*valptr
|
*valptr = !*valptr
|
||||||
fin
|
fin
|
||||||
fin
|
|
||||||
return type
|
return type
|
||||||
end
|
end
|
||||||
def ispostop
|
def ispostop
|
||||||
|
Loading…
Reference in New Issue
Block a user