mirror of
https://github.com/danbulant/Cosmos
synced 2026-06-06 08:12:14 +00:00
Fixed problem of nasm defaulting all conditional branches to short which often generates an error. Now all jumps are near.
This commit is contained in:
parent
1e9de4bb90
commit
65381e63a5
1 changed files with 13 additions and 7 deletions
|
|
@ -8,13 +8,19 @@ namespace Indy.IL2CPU.Assembler.X86 {
|
||||||
public readonly string Address;
|
public readonly string Address;
|
||||||
|
|
||||||
protected JumpBase(string aAddress) {
|
protected JumpBase(string aAddress) {
|
||||||
Address = aAddress;
|
if (aAddress.StartsWith(".")) {
|
||||||
if (Address.StartsWith(".")) {
|
aAddress = Label.LastFullLabel + "__DOT__" + aAddress.Substring(1);
|
||||||
//string xPrefix = (from item in Assembler.CurrentInstance.Instructions
|
}
|
||||||
// where !Label.GetLabel(item).StartsWith(".")
|
// If it has a :, then its a far call so dont add near
|
||||||
// select Label.GetLabel(item)).Last();
|
if (aAddress.Contains(':')) {
|
||||||
string xPrefix = Label.LastFullLabel;
|
Address = aAddress;
|
||||||
Address = xPrefix + "__DOT__" + Address.Substring(1);
|
} else {
|
||||||
|
// Nasm by default issues conditional branches as short
|
||||||
|
// and we often exceed the distance
|
||||||
|
// For now we go for simplicity. Later when we optimize and have
|
||||||
|
// our own assembler, we should consider using short jumps
|
||||||
|
// if they are faster
|
||||||
|
Address = "near " + aAddress;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue