TIP: Click on subject to list as thread! ANSI
echo: 80xxx
to: FERNANDO ARIEL GONT
from: BRIAN MCCLOUD
date: 1998-03-18 04:49:00
subject: Problem to make a compile

FAG>Hullo All , hope you are having a nice day!!
FAG>I want to make an ASM compiler for a microprocessor. I want to start with
FAG>one for the 6809.
Technically, that's a cross-assembler, not a compiler.
FAG>I think (and hope) it won't be too hard, but the fact is that I have one
FAG>problem:
FAG>Suppose I want to make a compiler for the 80x86, and I have to compile 
code
FAG>such as:
FAG>        mov ax, 5633h
FAG>        jmp yeah
FAG>        mov bx, 7896h
FAG>yeah:
FAG>        mov cx, 4543h
FAG>Well, I don't know how to code the "jmp" instruction, as I don't have the
FAG>address that equals "yeah" label.
FAG>For example, I'd first "scan" the whole code only to get the lenght each
FAG>instruction will take, and then I would code the instructions according 
o
FAG>their op-codes, as I'd have the addresses that equal each of the 
bels...
FAG>I'd like to hear your better ideas to do it, would also be pleased if 
you'd
FAG>have any internet addresses about how to make compilers (.PDF, .TXT, 
DOC,
FAG>.HTM, .WHATEVER).
I don't currently have any such addresses, but I can look...  My suggestion
would be to keep a table of labels, which would include the name of the 
abel,
the actual address, and a list of places where it is referenced. Assemble the
code portions, leaving the address part of any jump/call instructions 0 until
the label has an actual address, then go back as a second pass and fill those
in from the table.
((Cloud))
MauveCloud@juno.com
MauveCloud@yahoo.com
 * OLX 2.2 * I'm in shape ... round's a shape isn't it?
--- PCBoard (R) v15.3/M 10
---------------
* Origin: Next time, Dial The Wrong Number! (209) 943-1880 (1:208/205)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.