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
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
20 ;; main(int argc,char **argv)
26 ;; ebp+8 = argc, ebp+12 = argv
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"
38 call _strcmp
; compare strings
39 add esp,8 ; caller clears stack
42 ret ; return return value of _strcmp
45 mov eax,2 ; return 2 on error