Hello Fernando,
FA> Suppose I want to make a compiler for the 80x86, and I have to
FA> compile code such as:
FA>
FA> mov ax, 5633h
FA> jmp yeah
FA> mov bx, 7896h
FA>
FA> yeah:
FA> mov cx, 4543h
FA>
FA> Well, I don't know how to code the "jmp" instruction, as I don't have
FA> the address that equals "yeah" label.
Just teasing you a bit with my following comment. Have you noticed that there
are several opcodes for a jmp? If a jmp is closer than 7fh bytes you can use
two
bytes for the opcode with the offset. If the jmp is closer than 7fffh bytes
you'll need three bytes (opcode and two bytes for offset). And then there is
jmp-opcode followed by two bytes, defining the direct address.
Writing .COM-files is easy when you use a direct address for every jmp.
In that case you just compile(assemble) the mnemonic to opcodes, collecting
the
addresses op the labels.
Otherwise you'll have to do several assemble-routines, to check the
offset-differences.
Greeting, Jos Croeze
--- Dutchie V3.04
---------------
* Origin: HCC Groningen-1 (lijn 2) (2:500/19)
|