* fix for inline asm of instructions with 32-bit constant operands on i8086

git-svn-id: trunk@37519 -
This commit is contained in:
nickysn 2017-10-25 18:03:22 +00:00
parent 2af5c9d508
commit 325e66287c
4 changed files with 47 additions and 3 deletions

1
.gitattributes vendored
View File

@ -12105,6 +12105,7 @@ tests/test/cg/variants/tvarol9.pp svneol=native#text/plain
tests/test/cg/variants/tvarol91.pp svneol=native#text/plain
tests/test/cg/variants/tvarol94.pp svneol=native#text/plain
tests/test/cg/variants/tvarol96.pp svneol=native#text/plain
tests/test/cpu16/i8086/tasm16_32_1.pp svneol=native#text/pascal
tests/test/cpu16/i8086/tasmseg1.pp svneol=native#text/pascal
tests/test/cpu16/i8086/tfarcal1.pp svneol=native#text/pascal
tests/test/cpu16/i8086/tfarcal2.pp svneol=native#text/pascal

View File

@ -50,11 +50,13 @@ type
TOprRec = record
case typ:TOprType of
OPR_NONE : ();
{$ifdef AVR}
{$if defined(AVR)}
OPR_CONSTANT : (val:word);
{$else AVR}
{$elseif defined(i8086)}
OPR_CONSTANT : (val:longint);
{$else}
OPR_CONSTANT : (val:aint);
{$endif AVR}
{$endif}
OPR_SYMBOL : (symbol:tasmsymbol;symofs:aint;symseg:boolean;sym_farproc_entry:boolean);
OPR_REFERENCE : (varsize:asizeint; constoffset: asizeint;ref_farproc_entry:boolean;ref:treference);
OPR_LOCAL : (localvarsize, localconstoffset: asizeint;localsym:tabstractnormalvarsym;localsymofs:aint;localindexreg:tregister;localscale:byte;localgetoffset,localforceref:boolean);

View File

@ -2862,7 +2862,11 @@ implementation
}
var
{$ifdef i8086}
currval : longint;
{$else i8086}
currval : aint;
{$endif i8086}
currsym : tobjsymbol;
currrelreloc,
currabsreloc,
@ -2932,7 +2936,11 @@ implementation
end;
top_const :
begin
{$ifdef i8086}
currval:=longint(oper[opidx]^.val);
{$else i8086}
currval:=aint(oper[opidx]^.val);
{$endif i8086}
currsym:=nil;
currabsreloc:=RELOC_ABSOLUTE;
currabsreloc32:=RELOC_ABSOLUTE32;

View File

@ -0,0 +1,33 @@
{ %cpu=i8086 }
{ i8086 test for correct assembly of 32-bit instructions on the i8086 target }
{ this one tests an instruction with a 32-bit const operand }
program tasm16_32_1;
{$asmmode intel}
{$asmcpu 80386}
var
lo_word, hi_word: Word;
begin
asm
db 66h, 31h, 0c0h { xor eax, eax }
{ the actual instruction being tested: }
mov eax, 12345678h
db 66h, 50h { push eax }
pop word ptr [lo_word]
pop word ptr [hi_word]
end;
if (lo_word=$5678) and (hi_word=$1234) then
Writeln('Ok!')
else
begin
Writeln('Error!');
Halt(1);
end;
end.