Re: 8051 assembler in Common Lisp
- From: Frode Vatvedt Fjeld <frodef@xxxxxxxxx>
- Date: Thu, 28 Jul 2005 22:01:36 +0200
Greg Menke <gregm-xyzpdq@xxxxxxxxxxxx> writes:
> [..] I have two questions;
>
> - use of eval. [..]
My approach is to use a simple functional style, something like
(defun assemble (program &key (text-base #x000) ..)
...)
where program is a list of instructions and labels etc., and use it
often something like
(assemble `((:mov :a :b)
(:call ,some-addres)
...))
and of course any other conceivable means of constructing
lists/programs. I ended up recognizing instruction-names,
register-names etc. by string=, and use keywords in programs by
convention. Furthermore, I found it useful to have the assemble
function understand a special :funcall "macro" whose arguments can be
assembly-labels, and which is called/expanded when each argument is
assigned a value.
> - use of symbols as labels.
I use symbols only for their identity, and store the values separately
(hash-table or assoc or somesuch). Actually I find it useful to have
the assemble function return the symbol-table as an assoc as its
secondary value.
> (deftext tst-code ()
> (nop)
> (nop)
> supercat
> (addc a 1)
> (anl acc 15)
> ;;(ajmp 'supercat2)
> (acall 'supercat)
> (acall 'tst-data)
> (acall '(+ tst-code 2)))
>
In the few cases I've got top-level things like this (mostly my code
gets generated in small pieces here and there in a largish lisp
program.. well, a compiler) I do like this:
(defun make-testproj (&key (increment 1))
`((:nop)
(:nop)
supercat
(:addc :a ,increment)
...))
and do (assemble (make-testproj)).
--
Frode Vatvedt Fjeld
.
- References:
- 8051 assembler in Common Lisp
- From: Greg Menke
- 8051 assembler in Common Lisp
- Prev by Date: Re: Amazed by macros working on first attempt
- Next by Date: Re: professional package use?
- Previous by thread: Re: 8051 assembler in Common Lisp
- Next by thread: Allegroserve/Webactions POST filesize limit?
- Index(es):
Relevant Pages
|