| Top Level Form |
Defines the symbol symbol as a label to the current position.
| Top Level Form |
| Top Level Form |
Allocates data space of size integer words.
| Top Level Form |
Defines the symbol symbol as a constant with value value.
| Top Level Form |
| Top Level Form |
| Top Level Form |
| Top Level Form |
| Top Level Form |
The following assembled output goes to the segment named by
name. Predefined segments are :text
, :data
, and :bss
. For
convienience the short hands (text)
, (data)
, and (bss)
are
provided.
| Top Level Form |
Defines a macro named name. Like in Common Lisp lambda-list is a macro lambda list. The body is evaluated as Common Lisp. Macros are applied both in top level forms and in expressions.
To return more than one insturction consider using tagbody
.
Example
(defmacro lodi (addr) "A <- [[addr]] -- indirect load" `(tagbody (lod ',addr) (ior '(lod 0)) ;build instruction (sto (+ @ 1)) ;put it ahead (lod 0))) ;to be filled.
| Expression |
Evaluates to the address of a memory word, where the value of expression is stored. The assembler takes some effort to avoid duplicate storage for the same constant to be allocated.
Constants are allocated to the end of the text segment.
| Expression |
The current program address.
| Expression |
Evaluates to the address of the segment named by name
(usually
:text
, :bss
, or :data
) plus the offset offset
.
All the following arithmetric expressions behave like their Common Lisp counterpart. The result is coerced to an integer an then the lower 32-bits are used.
| Expression |
| Expression |
| Expression |
| Expression |
| Expression |
| Expression |
| Expression |
| Expression |
| Expression |
| Expression |
| Expression |
| Expression |
| Expression |
| Expression |
| Expression |
Instructions are recognized as expressions, which might be handy in constructing instructions. Example:
;; A <- [A] (ior '(lod 0)) (sto (+ @ 1)) (lod 0)
The simulator has its virtual TTY at address #xF00000
. A write to
that address would output a character and a read would read one. The
tty is assumed to use UTF-8 encoding.
Let us write a chargen program:
(defconstant +tty+ #xF00000) ;Our virtual TTY (:text) chargen (lod '#\space) (sto curchar) loop (lod curchar) ;get char (sto +tty+) ;write it to TTY (add '1) ;increment (sto curchar) ;save ;; Test for end (sub '127) (jnz loop) (jmp chargen) ;And do everything again ;; space for CURCHAR (:bss) curchar (ds 1) ;Space for one word