Commit 9aa69be6 authored by Frode Vatvedt Fjeld's avatar Frode Vatvedt Fjeld

*** empty log message ***

parent 36b8ce59
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
## Author: Frode Vatvedt Fjeld <frodef@acm.org> ## Author: Frode Vatvedt Fjeld <frodef@acm.org>
## Created at: Sat Jan 29 16:48:42 2005 ## Created at: Sat Jan 29 16:48:42 2005
## ##
## $Id: README,v 1.1 2005/01/29 16:33:31 ffjeld Exp $ ## $Id: README,v 1.2 2005/01/30 11:35:16 ffjeld Exp $
## ##
###################################################################### ######################################################################
...@@ -67,6 +67,8 @@ prefixes (such as REP, LOCK, etc.). ...@@ -67,6 +67,8 @@ prefixes (such as REP, LOCK, etc.).
This is a more-or-less exact description of the syntax: This is a more-or-less exact description of the syntax:
---------------------------------------------------------
program ::= (<sexpr>*) program ::= (<sexpr>*)
sexpr ::= ( <expr> ) | <label> | (% <inline-data> %) | (:include . <program>) sexpr ::= ( <expr> ) | <label> | (% <inline-data> %) | (:include . <program>)
...@@ -96,5 +98,40 @@ This is a more-or-less exact description of the syntax: ...@@ -96,5 +98,40 @@ This is a more-or-less exact description of the syntax:
prefix ::= <segment-override> | (:size <size>) prefix ::= <segment-override> | (:size <size>)
---------------------------------------------------------
The function proglist-encode takes a proglist and produces The function proglist-encode takes a proglist and produces
machine-code in the form of e.g. a vector of 8-bit bytes. machine-code in the form of e.g. a vector of 8-bit bytes. A typical
usage would be this:
(proglist-encode :octet-vector :16-bit #x7c00
(read-proglist (mkasm16-bios-print)))
The first agument, :octet-vector, requests that the result be in the
form of a vector of octets. The second argument says to prodce machine
code for the 16-bit mode of x86. Next is the address to assume the
code is located in memory (if the program is position-independent,
just pass zero). Finally, there is the proglist to be encoded to
machine code. Additionally, the keyword argument :symtab-lookup can
provide a function that proglist-encode will use to map (otherwise
undefined) labels to integers. The primary return value is the byte
vector, while the secondary return value is an (assoc) symbol-table:
IA-X86(7): (proglist-encode :octet-vector :16-bit #x7c00
(read-proglist (mkasm16-bios-print)))
=> #(#xf #xb6 #xc #x46 #xb4 #xe #xbb #x7 #x0 #xac ...)
=> ((PRINT-LOOP . #x7c09))
Another operator that can be useful for interactive and experimental
use, is the macro "asm" which encodes a single instruction. This can
be used e.g. to verify syntax or the encoded size of an instruction:
IA-X86(8): (asm :movl :eax (:ebx 1))
=> #c(#x894301 #x3)
The return value is a complex, whose real component is the binary
encoding of the instruction, and the imaginary component is the number
of bytes.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment