Hullo All , hope you are having a nice day!!
I want to make an ASM compiler for a microprocessor. I want to start with
one for the 6809.
I think (and hope) it won't be too hard, but the fact is that I have one
problem:
Suppose I want to make a compiler for the 80x86, and I have to compile code
such as:
mov ax, 5633h
jmp yeah
mov bx, 7896h
yeah:
mov cx, 4543h
Well, I don't know how to code the "jmp" instruction, as I don't have the
address that equals "yeah" label.
I think I should compile the code in several steps, but I don't know the
best way to do it, and besides I have some ideas, I would like to know how
compilers solve this problem...
For example, I'd first "scan" the whole code only to get the lenght each
instruction will take, and then I would code the instructions according to
their op-codes, as I'd have the addresses that equal each of the labels...
I'd like to hear your better ideas to do it, would also be pleased if you'd
have any internet addresses about how to make compilers (.PDF, .TXT, .DOC,
.HTM, .WHATEVER).
Thank you in advance! :)
-=> Yours sincerely, Fernando Ariel Gont <=-
e-mail: FGont@siscor.bibnal.edu.ar
e-mail "Good Stuff!" _*Magazine*_ : gstuff@siscor.bibnal.edu.ar
FidoNet: 4:900/470.10
Sk-Network (Argentina): Murdock's Point (200:201/300.27)
--- Terminate 5.00 UnReg(145)
---------------
* Origin: Frances farmer will have her revenge in my point!! (4:900/470.10)
|