Re: 8051 assembler in Common Lisp



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
.



Relevant Pages

  • Re: macro assembler for z80
    ... I copied your source code file, then tried to assemble it. ... When creating labels for a piece of code, it is better to start all ... So, if you want to program in assembly language, it is simple: ... those 17 instructions, see what they do to the registers at each step, ...
    (comp.os.cpm)
  • Re: Word Data Merge Query to Address Book Doesnt Display all Categories
    ... I did follow the instruction but after step 4, Create Labels, I got different screens than the instructions. ... In the Mail Merge Manager palette, click Create New, and then click Labels. ... In the filter recipients section, ...
    (microsoft.public.mac.office.word)
  • Re: question prompted by "Re: Tcl 8.5 sometimes produces numbers with long fractional parts"
    ... generate the *textual* labels for your plots. ... generate the format string itself, based on the data range (hint: ... Some microprocessors addressed this issue by having instructions which ... Does TCL support a similar solution? ...
    (comp.lang.tcl)
  • Re: Address Labels
    ... use the instructions from Word Help, as I ... different labels to address post cards. ... and the Merge Manager somewhat ambiguous...and tried to use it, ...
    (microsoft.public.mac.office.entourage)
  • Re: Address Labels
    ... use the instructions from Word Help, as I ... different labels to address post cards. ... and the Merge Manager somewhat ambiguous...and tried to use it, ...
    (microsoft.public.mac.office.entourage)