Browse Source

+ added test for the 'SEG @CODE' and 'SEG @DATA' i8086 inline assembler directives

git-svn-id: trunk@32284 -
nickysn 9 years ago
parent
commit
1e7a0838d7
2 changed files with 66 additions and 0 deletions
  1. 1 0
      .gitattributes
  2. 65 0
      tests/test/cpu16/i8086/tasmseg1.pp

+ 1 - 0
.gitattributes

@@ -11461,6 +11461,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/tvarol91.pp svneol=native#text/plain
 tests/test/cg/variants/tvarol94.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/cg/variants/tvarol96.pp svneol=native#text/plain
+tests/test/cpu16/i8086/tasmseg1.pp svneol=native#text/pascal
 tests/test/cpu16/i8086/tfarcal1.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
 tests/test/cpu16/i8086/tfarcal2.pp svneol=native#text/pascal
 tests/test/cpu16/i8086/tfarcal3.pp svneol=native#text/plain
 tests/test/cpu16/i8086/tfarcal3.pp svneol=native#text/plain

+ 65 - 0
tests/test/cpu16/i8086/tasmseg1.pp

@@ -0,0 +1,65 @@
+{ %cpu=i8086 }
+
+{ i8086 test for the SEG @CODE and SEG @DATA inline assembler directives }
+
+{ this test is Turbo Pascal 7 compatible }
+
+program tasmseg1;
+var
+  Error: Boolean;
+begin
+  Error := False;
+  asm
+    jmp @@Skip
+@@dw_seg_code:
+    dw SEG @CODE
+@@dw_seg_data:
+    dw SEG @DATA
+    dw 55aah
+    dd SEG @CODE
+    dd SEG @DATA
+    dw 0aa55h
+@@Skip:
+    mov bx, SEG @CODE
+    mov cx, cs
+    cmp bx, cx
+    jne @@Err
+    mov bx, word ptr @@dw_seg_code
+    cmp bx, cx
+    jne @@Err
+    mov bx, word ptr [@@dw_seg_code + 6]
+    cmp bx, cx
+    jne @@Err
+    mov dx, SEG @DATA
+    mov ax, ds
+    cmp ax, dx
+    jne @@Err
+    mov dx, word ptr @@dw_seg_data
+    cmp ax, dx
+    jne @@Err
+    mov dx, word ptr [@@dw_seg_code + 2]
+    cmp ax, dx
+    jne @@Err
+    mov dx, word ptr [@@dw_seg_code + 10]
+    cmp ax, dx
+    jne @@Err
+    mov ax, word ptr [@@dw_seg_code + 8]
+    or ax, word ptr [@@dw_seg_code + 12]
+    jnz @@Err
+    cmp word ptr [@@dw_seg_data + 2], 55aah
+    jne @@Err
+    cmp word ptr [@@dw_seg_data + 12], 0aa55h
+    jne @@Err
+    jmp @@Done
+@@Err:
+    mov Error, 1
+@@Done:
+  end;
+  if Error then
+  begin
+    Writeln('Error!');
+    Halt(1);
+  end
+  else
+    Writeln('Ok!');
+end.