How to use the assembler
command line
asm inputfile
will generate two files : file.lst listing, file.s
S-format object
The assembler is a two passes assembler. The input
file is in the following format :
.org
n
label: value
...
label: opcode operand
...
.end
operand = #sym sym (sym)
sym = numeric symbol label
numeric begins with 0..9 hex end with H
symbol found in the symbol table
.org n set address to n
.end the last line of program
The addressing modes are specified:
# immediate
(sym) indirect
without any prefix the symbolic operand is considered to be direct
address.
Input scanning is case insensitive. Internally all symbols are
converted into uppercase and stored in the symbol table.
Example a meaningless program, just to show the syntax:
.org
0
jmp begin
half: 100
temp: 10 11
base: 2
ea:
0
.org 100H
begin:
lds #300
lds temp
lda #30
lda temp
lda (ea)
psh
sta half
jmp begin
jpz next
jsr next
and #20
and temp
pop
add #40
add data
rts
rol
ror
next:
jsr 1001
.end
The output S-format file that is ready to be used to write into a
EEPROM is :
S113000004012C0C0065141E1C0065203C00644C8B
S1130010000048EC5C002A68E77C002A84148C0009
S113002066A0C428CC002DD0E0F07C03E8010203D4
S9030000FC
The main objective of this implementation of the assembler is to make
it as simple as possible. The source code of the assembler is
only 200 lines long. It is a two passes assembler. The
first pass collects all the symbol and counts the address.
The second pass does the actual generation of machine code.
As this is the first release, it is not yet robust. Please
report any bug found to
prabhas at chula dot ac dot th
17 December 2005
Prabhas Chongstitvatana