mirror of
https://github.com/PDP-10/its.git
synced 2026-02-22 15:27:38 +00:00
43 lines
2.5 KiB
Plaintext
Executable File
43 lines
2.5 KiB
Plaintext
Executable File
This is my attempt at one-pass assembly.
|
|
|
|
First get a token. If it has a PREFIX-OP (opcode or pseudo-op) property
|
|
then hand control to the function in that property. Do not try to
|
|
collect arguments for it, since it might want string arguments (e.g.
|
|
".TITLE APPLE-LOGO"). If it wants tokens, it will call gettok itself.
|
|
|
|
If the first token on the line is has no PREFIX-OP property then it
|
|
still might be an infix-style assignment statement (i.e. "=", or ":").
|
|
So we save the old token, get another token, and check to see if
|
|
that token has a INFIX-OP property. If so, then it is called and given
|
|
as an argument the first token on the line. This type of PSEUDO-OP would
|
|
also call gettok or whatever it feels like calling and finally return.
|
|
All of the functions described above should return whatever they want
|
|
put in the list as code. Of course, they may have appropriate side
|
|
efects.
|
|
|
|
If any token is undefined, whatever worries about it should look on the
|
|
FORWARD-REF property of the token (This is a job for ASSEM-SYMEVAL for
|
|
symbols and ASSEMBLE-CODE for operators.) and put a FORWARD-REF property
|
|
on them. The forward ref property (which should be a list of the new
|
|
and all the old FORWARD-REF properties still unresolved) should contain
|
|
a pointer to the place where the code for this instruction will be
|
|
pushed onto the list of all code (The first element of the
|
|
whole-code-list when the reference was made.) as the cdr of the
|
|
succesive cadr's of the FORWARD-REF property and the name of the
|
|
undefined reference as the car of the cadr's. Totally unclear?
|
|
|
|
;;;;; Stuff below has note been correced. Error checking, etc. (LDA
|
|
FOO), then FOO=> $2345. Either an error or (LDA 69.). Either way, it
|
|
requires some checking. Maybe we shouldn't partially assemble the
|
|
instruction when there is an undefined reference in it, and let the
|
|
undef-ref handler do it. It wouldn't be difficult at all; just let IT
|
|
call the various propertys of the symbol.) The undef-ref handler just
|
|
rplacd's the undefined reference (although it might be an expression. We
|
|
should do an NSUBLIS (Which is like SUBLIS except it bashes its argument
|
|
and isn't written. We'd have to write it. Big deal.). This
|
|
automatically changes the reference. It should also remove the pointer
|
|
from the FORWARD-REF property of the token and place the new value on
|
|
the LABEL-VALUE property. When theassembleris through, we do a MAPTAOMS
|
|
looking for FORWARD-REF (perhaps we should call it UNDEF-REF) and
|
|
LABEL-VALUE properties and print out our symbol table from there.
|