nsis: Remove desktop bat link as well
[nasm/avx512.git] / rdoff / test / rdtmain.asm
blob626a2e2957bed4d4001237f1e259de7b8be5f61d
1 ;; rdtmain - main part of test program for RDX execution.
2 ;; returns true (0) if its parameter equals the phrase "hello"
3 ;; "hello" is stored in the library part, to complicate the
4 ;; linkage.
6 ;; assemble and link with the following commands:
7 ;; nasm -f rdf rdtmain.asm
8 ;; nasm -f rdf rdtlib.asm
9 ;; ldrdf rdtmain.rdf rdtlib.rdf -o rdxtest.rdx
11 ;; run with 'rdx rdxtest.rdx [parameters]' on a Linux (or possibly
12 ;; other 32 bit OS) systems (x86 architectures only!)
13 ;; try using '&& echo Yes' afterwards to find out when it returns 0.
15 [EXTERN _strcmp] ; strcmp is an imported function
16 [EXTERN _message] ; imported data
17 [SECTION .text]
18 [BITS 32]
20 ;; main(int argc,char **argv)
21 [GLOBAL _main]
22 _main:
23 push ebp
24 mov ebp,esp
26 ;; ebp+8 = argc, ebp+12 = argv
28 cmp dword [ebp+8],2
29 jb error ; cause error if < 1 parameters
31 mov eax, [ebp+12] ; eax = argv
33 mov ebx, [eax+4] ; ebx = argv[1]
34 mov ecx, _message ; ecx = "hello"
36 push ecx
37 push ebx
38 call _strcmp ; compare strings
39 add esp,8 ; caller clears stack
41 pop ebp
42 ret ; return return value of _strcmp
44 error:
45 mov eax,2 ; return 2 on error
46 pop ebp
47 ret