[Coco] CCASM procedures

Roger Taylor rtaylor at bayou.com
Sat Dec 11 04:29:27 EST 2004


I hope this scheme is okay for accessing symbols outside of a namespace or
procedure. By prefixing any identifier with ':', it prevents the
expression evaluator from preprending whatever namespace or procedure name
is in effect.

I defined "outside" in the main code, then accessed it from within the
procedure (which otherwise follows namespace rules).

I want to get to a stopping point because there's so many ideas that can be
put to use to make the assembler behave sort of like a compiler when it
comes to lex levels, scoping, etc. If I can just simulate that to some
small degree, I'll be happy and can start writing some libraries.


org 3584

res rmb 2
outside rmb 2

* pass-by-reference example

shl proc bits:byte,value:word,result:word
count var 1
begin shl procedure entry
ldb bits,u
stb count,u
ldd value,u access pass-by-value parameter
a@ lslb
rola
dec count,u
bne a@
std [result,u] change pass-by-ref parameter
lda :outside access a symbol outside of the procedure
* lda outside <--- generates UNDEFINED SYMBOL error
endproc

start call shl,2,4,res
ldd res
std 1024
rts

end start



--
Roger Taylor




More information about the Coco mailing list