is there a stand alone assembler? (or any advice on how to write one)
b.p.m.
Posts: 59
hi everyone,
i remember reading on the forum that somebody was working on
a propeller based assembler. it's my dream to write assembly
programs right on my demo board without having to run to the PC
every five seconds when coding. does anyone have any information
on this? i'm trying to teach myself prop assembler so that i might
be able to write my own assembler with an editor and sd based OS.
so far i've finished deSilva's fantastic machine code tutorial. i learned alot
from it.
speaking of which, deSilva, if you're out there or anyone else who
might know, when is your much anticipated assembly book coming
out! i'm ready to place my order.
thanks,
blake
p.s. i think it was a Steven who said he started work on a prop based
assembler.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"Can't sleep, clown will eat me."
Bart Simpson
Post Edited (b.p.m.) : 1/25/2009 5:13:31 AM GMT
i remember reading on the forum that somebody was working on
a propeller based assembler. it's my dream to write assembly
programs right on my demo board without having to run to the PC
every five seconds when coding. does anyone have any information
on this? i'm trying to teach myself prop assembler so that i might
be able to write my own assembler with an editor and sd based OS.
so far i've finished deSilva's fantastic machine code tutorial. i learned alot
from it.
speaking of which, deSilva, if you're out there or anyone else who
might know, when is your much anticipated assembly book coming
out! i'm ready to place my order.
thanks,
blake
p.s. i think it was a Steven who said he started work on a prop based
assembler.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"Can't sleep, clown will eat me."
Bart Simpson
Post Edited (b.p.m.) : 1/25/2009 5:13:31 AM GMT
Comments
quick question: does anybody have advice or ideas that would help me
write my own assembler in spin?
thanks again
blake
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"Can't sleep, clown will eat me."
Bart Simpson
Post Edited (b.p.m.) : 1/25/2009 5:00:44 AM GMT
The class org.pacito.propeller.Compiler is the one that implements the compiling.
Writing an assembler is far easier than it seems if you think of it this way (There are other approaches).
Two pass assembling.
1st Pass: symbol capture and sizing (easy because all instructions are 32 bits). Unknown opcodes, bad syntax, duplicated symbols can be catched here.
2nd Pass: Assembly compilation. Symbol table is ready so any not found symbol is an error. Here you catch invalid format for instructions, operands out of range.
In the second pass you output the compiled code directly.
The most critical part is to take a line and to extract every possible bit out of it: label condition opcode arg1, arg2 (if any) effects (if any). Once you wrote such a line parsing algorithm, the rest is a piece of cake. Start there.
If you need any more help just chime!
Problem comes if you want to make it assemble source code that is compatible with the Propeller tool.
Dealing with all the complexity (and quirks) of expressions used in constant definitions etc gets quite laborious.
Best not to think about that for a Prop hosted assembler.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
For me, the past is not over yet.
I'm running on a protoboard with vga and keyboard.
I would suggest writing a PC-based assembler and then porting that to Spin. Decide what the specification is for your assembler and write code to be reasonably easy to port, so don't rely on malloc if using C or strings if using Basic, stick with byte, word and long arrays, no structures no user defined types etc.
I'm not sure how useful an on-chip Native Assembler would be to a wider community but a well featured LMM Assembler is something which I think would have an appeal.
first thanks for the quick replies to my query. i agree with ale that a two pass
approach is the most straight forward (that's what i was thinking). i think my
first version will be very no-frills; literals will be values only (no expressions)
and all labels will global (i'll figure out how to handle local labels later),etc.
propMaker, thanks for the great material; i'll be all over it for awhile.
ale, i'll take a look at pPropellerSim but to be honest i have trouble wrapping
my mind around Java
i'll no doubt be back with all sorts of questions in the weeks ahead.
thanks,
blake
p.s. i wrote my first assembly on a General Electric 115 back in '74. it worked
with punch cards and had a iron core memory for the boot program.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"Can't sleep, clown will eat me."
Bart Simpson
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Links to other interesting threads:
· Prop Tools under Development or Completed (Index)
· Emulators (Micros eg Altair, and Terminals eg VT100) - index
· Search the Propeller forums (via Google)
My cruising website is: ·www.bluemagic.biz