Browse Source

+ added test for i8086 inline asm access to procedure data

git-svn-id: trunk@32186 -
nickysn 9 years ago
parent
commit
1eaa77d2f9
2 changed files with 42 additions and 0 deletions
  1. 1 0
      .gitattributes
  2. 41 0
      tests/test/cpu16/i8086/tprcdat1.pp

+ 1 - 0
.gitattributes

@@ -11480,6 +11480,7 @@ tests/test/cpu16/i8086/tmml.pp svneol=native#text/pascal
 tests/test/cpu16/i8086/tmmm.pp svneol=native#text/pascal
 tests/test/cpu16/i8086/tmms.pp svneol=native#text/pascal
 tests/test/cpu16/i8086/tmmt.pp svneol=native#text/pascal
+tests/test/cpu16/i8086/tprcdat1.pp svneol=native#text/plain
 tests/test/cpu16/i8086/tptrcon.pp svneol=native#text/pascal
 tests/test/cpu16/i8086/tptrsize.pp svneol=native#text/pascal
 tests/test/cpu16/i8086/tretf1.pp svneol=native#text/plain

+ 41 - 0
tests/test/cpu16/i8086/tprcdat1.pp

@@ -0,0 +1,41 @@
+{ %cpu=i8086 }
+
+{ test for local procedure data access from within inline asm }
+
+{ this test is Turbo Pascal 7 compatible }
+
+program tprcdat1;
+
+procedure TestProc; far; assembler;
+asm
+  dw $1234
+  dw $4321
+end;
+
+var
+  a,a_,a__,
+  a2,a2_,a2__: Word;
+begin
+  asm
+    mov ax, word [TestProc]
+    mov a, ax
+    mov ax, word ptr [TestProc]
+    mov a_, ax
+    mov ax, word ptr TestProc
+    mov a__, ax
+    mov ax, word ptr [TestProc + 2]
+    mov a2, ax
+    mov ax, word ptr TestProc + 2
+    mov a2_, ax
+    mov ax, word ptr [2 + TestProc]
+    mov a2__, ax
+  end;
+  if (a=$1234) and (a_=$1234) and (a__=$1234) and
+     (a2=$4321) and (a2_=$4321) and (a2__=$4321) then
+    Writeln('Ok!')
+  else
+  begin
+    Writeln('Error');
+    Halt(1);
+  end;
+end.