mirror of
https://github.com/PDP-10/its.git
synced 2026-01-27 04:32:08 +00:00
Maclisp cross assembler for 6502.
Courtesy of Leigh Klotz.
This commit is contained in:
43
doc/klotz/assem.files
Executable file
43
doc/klotz/assem.files
Executable file
@@ -0,0 +1,43 @@
|
||||
Here is a list of all the files which make up the MacLisp Cross Assembler along
|
||||
with a brief description of each.
|
||||
|
||||
KLOTZ; PASS1 >
|
||||
The main body of the assembler. Conses up a big list of
|
||||
the code, one line at a time. If there is no undefined reference on a a
|
||||
line, it is completely assembled at read-time. Otherwise, a notation is made of
|
||||
undefined references. Later, when these references are resolved the code
|
||||
with the undefined reference is completed.
|
||||
|
||||
KLOTZ; TOKENZ >
|
||||
The Tokenizer. The routines for reading in tokens and strings.
|
||||
|
||||
KLOTZ; ARMACS >
|
||||
Code for defining assembler read macros.
|
||||
Definitions of assembler read macros.
|
||||
|
||||
KLOTZ; DEFDEF >
|
||||
The code for DEFINS (define instruction), DEFAMODE (define addessing
|
||||
mode), and DEF-PSEUDO-OP.
|
||||
|
||||
APLOGO;EVAL >
|
||||
The routines for evaluating symbols and arithmatic expressions.
|
||||
|
||||
APLOGO;MATCH >
|
||||
Winning simple pattern matcher for parsing losing assembler expressions.
|
||||
Used by DEFINS and PASS1 for determining addressing mode.
|
||||
|
||||
KLOTZ; 6502 >
|
||||
These are the definitions for the 6502 addressing modes and instructions.
|
||||
|
||||
KLOTZ;DECPOP >
|
||||
These are the assembler DEC compatability pseudo-op directives.
|
||||
|
||||
KLOTZ;PASS1 IDEAS
|
||||
Old documentation for how pass1 ought to work. Somewhat obsolete, but nonetheless
|
||||
informative.
|
||||
|
||||
KLOTZ;POPDEC DOC
|
||||
Documentation for the assembler DEC compatability pseudo-op directives.
|
||||
|
||||
KLOTZ;ASSEM FILES
|
||||
?
|
||||
42
doc/klotz/assem.ideas
Executable file
42
doc/klotz/assem.ideas
Executable file
@@ -0,0 +1,42 @@
|
||||
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.
|
||||
123
doc/klotz/dec.pseudo
Executable file
123
doc/klotz/dec.pseudo
Executable file
@@ -0,0 +1,123 @@
|
||||
MacLisp Cross Assembler Documentation. KLOTZ.
|
||||
DEC compatability pseudo-op stuff.
|
||||
|
||||
; Begins comment field
|
||||
|
||||
' Indicates single ASCII character as a term in expressions.
|
||||
|
||||
^O Indicates octal number
|
||||
|
||||
^B Indicates binary number
|
||||
|
||||
= Symbol assignment
|
||||
|
||||
. Current location counter
|
||||
|
||||
$ Indicates hexadecimal number
|
||||
|
||||
|
||||
Default radix is decimal.
|
||||
|
||||
|
||||
.ADDR Generates a 16-bit address with the bytes in the proper order,
|
||||
i.e., <low> <high>.[TO DO]
|
||||
|
||||
.ASCII ASCII string delimited by paired markers.
|
||||
|
||||
.ASCIZ ASCIZ string delimited by paired markers and supplied with
|
||||
terminal null byte.
|
||||
|
||||
.BLKBA Allocate space for a number of bytes as specified by the operand.
|
||||
|
||||
.BLKW Allocate space for a number of words as specified by the operand.
|
||||
|
||||
.BYTE Each expression supplied will be stored in a single byte.[In
|
||||
progress. Eval-Expression does what with commas, and best way to cons it
|
||||
up.]
|
||||
|
||||
.END End of program.
|
||||
|
||||
.ISET Specifies the instruction set to be used, "6502" or "TI990".
|
||||
|
||||
.PAGE Force a page break. Does nothing useful now.
|
||||
|
||||
.PRINT Print the text which follows on the terminal.
|
||||
|
||||
.RADIX Change the radix to the value specified to this directive.
|
||||
|
||||
.SBTTL Specify subtitle text. Prints out TOC on screen if
|
||||
SILENT-RUNNING isn't specified (via the /N switch.)
|
||||
|
||||
.TITLE Specify title text.
|
||||
|
||||
.WORD Allocate space for each value specified. [Same as .BYTE for 8 bit machines.]
|
||||
|
||||
|
||||
|
||||
-------------------------
|
||||
Things for the Future:
|
||||
|
||||
.REPT (.REPT <n>) Repeat the body of this directive the indicated
|
||||
number of times.
|
||||
|
||||
.NTYPE sym,arg The symbol is equated to the addressing mode of the argument.
|
||||
.NCHR sym,<str> The symbol is equated to the number of characters in <str>
|
||||
.NARG sym The symbol is equated to the number of arguments to the macro
|
||||
.MEXIT Leave macro expansion
|
||||
Begin a macro definition
|
||||
|
||||
.MCALL Call macros from the system library.
|
||||
.IRPC sym,<str>Indefinite repeat of body based upon number of characters in
|
||||
<str>.
|
||||
|
||||
.MACRO name <arglist>Immediate if; if condition is met, stmnt is emitted.
|
||||
|
||||
.IRP sym,<arglist> Indefinite repeat of body based upon number of parameters in
|
||||
<arglist>..IIF condition, arg, stmnt
|
||||
.IF Enter a conditional.
|
||||
.IFDF .IFDF <symbol> true if symbol is defined. See also .IFNDF.
|
||||
.IFEQ .IFEQ <expression> true if expression evaluates to zero.
|
||||
.IFF Begins body of conditional if enclosing condition was false.
|
||||
.IFG .IFG <expression> true if expression greater than zero.
|
||||
.IFGE .IFG <expression> true if expression greater than or equal to
|
||||
zero.
|
||||
.IFGT Same as .IFG
|
||||
.IFL .IFL <expression> true if expression is negative.
|
||||
.IFLE .IFLE <expression> true if expression is negative or zero.
|
||||
.IFLT Same as .IFL.
|
||||
.IFNDF .IFNDF <symbol> true if symbol is undefined.
|
||||
.IFNE .IFNE <expression> true if expression is non-zero.
|
||||
.IFNZ Same as .IFNE
|
||||
.IFT Begins body of conditional if enclosing condition was true.
|
||||
.IFZ Same as .IFE
|
||||
.IIF condition, arg, stmnt
|
||||
Immediate if; if condition is met, stmnt is emitted.
|
||||
|
||||
.IRP sym,<arglist> Indefinite repeat of body based upon number of parameters in
|
||||
<arglist>.
|
||||
[Nui mahope.]
|
||||
.IRPC sym,<str>Indefinite repeat of body based upon number of characters in
|
||||
<str>.
|
||||
|
||||
.MACRO name <arglist>
|
||||
Begin a macro definition
|
||||
.MEXIT Leave macro expansion
|
||||
.NARG sym The symbol is equated to the number of arguments to the macro
|
||||
.NCHR sym,<str> The symbol is equated to the number of characters in <str>
|
||||
.NTYPE sym,arg The symbol is equated to the addressing mode of the argument.
|
||||
|
||||
--------------------
|
||||
Assembler syntax quick summary
|
||||
|
||||
<...> Encloses any expression (the assembler's equivalent of
|
||||
parentheses). Expressions are evaluated left-to-right without
|
||||
operator heirarchy.
|
||||
|
||||
+ Addition or unary plus
|
||||
|
||||
- Subtraction or unary minus
|
||||
|
||||
* Multiplication
|
||||
|
||||
/ Division
|
||||
|
||||
Reference in New Issue
Block a user