MPX: Add test cases for MPX
[nasm/avx512.git] / test / bintest.asm
blob57a3b2df9f6a95334ca065135a14a24932efde91
1 ;Testname=unoptimized; Arguments=-O0 -fbin -obintest.bin; Files=stdout stderr bintest.bin
2 ;Testname=optimized; Arguments=-Ox -fbin -obintest.bin; Files=stdout stderr bintest.bin
4 ; test source file for assembling to binary files
5 ; build with:
6 ; nasm -f bin -o bintest.com bintest.asm
8 ; When run (as a DOS .COM file), this program should print
9 ; hello, world
10 ; on two successive lines, then exit cleanly.
12 ; This file should test the following:
13 ; [1] Define a text-section symbol
14 ; [2] Define a data-section symbol
15 ; [3] Define a BSS-section symbol
16 ; [4] Define a NASM local label
17 ; [5] Reference a NASM local label
18 ; [6] Reference a text-section symbol in the text section
19 ; [7] Reference a data-section symbol in the text section
20 ; [8] Reference a BSS-section symbol in the text section
21 ; [9] Reference a text-section symbol in the data section
22 ; [10] Reference a data-section symbol in the data section
23 ; [11] Reference a BSS-section symbol in the data section
25 BITS 16
26 ORG 0x100
28 SECTION .text
30 jmp start ; [6]
32 endX mov ax,0x4c00 ; [1]
33 int 0x21
35 start mov byte [bss_sym],',' ; [1] [8]
36 mov bx,[bssptr] ; [7]
37 mov al,[bx]
38 mov bx,[dataptr] ; [7]
39 mov [bx],al
40 mov cx,2
41 .loop mov dx,datasym ; [1] [4] [7]
42 mov ah,9
43 push cx
44 int 0x21
45 pop cx
46 loop .loop ; [5] [6]
47 mov bx,[textptr] ; [7]
48 jmp bx
50 SECTION .data
52 datasym db 'hello world', 13, 10, '$' ; [2]
53 bssptr dw bss_sym ; [2] [11]
54 dataptr dw datasym+5 ; [2] [10]
55 textptr dw endX ; [2] [9]
57 SECTION .bss
59 bss_sym resb 1 ; [3]