rdoff: use nasm-provided safe memory allocation and I/O
[nasm.git] / rdoff / test / rdtlib.asm
blob6c2b8ec9a204cd63e3227eec1022ad9370bfe4a5
1 ;; library functions for rdtmain - test of rdx linking and execution
3 ;; library function = _strcmp, defined as in C
5 [SECTION .text]
6 [BITS 32]
8 [GLOBAL _strcmp]
9 _strcmp:
10 push ebp
11 mov ebp,esp
13 ;; ebp+8 = first paramater, ebp+12 = second
15 mov esi,[ebp+8]
16 mov edi,[ebp+12]
18 .loop:
19 mov cl,byte [esi]
20 mov dl,byte [edi]
21 cmp cl,dl
22 jb .below
23 ja .above
24 or cl,cl
25 jz .match
26 inc esi
27 inc edi
28 jmp .loop
30 .below:
31 mov eax,-1
32 pop ebp
33 ret
35 .above:
36 mov eax,1
37 pop ebp
38 ret
40 .match:
41 xor eax,eax
42 pop ebp
43 ret
45 [SECTION .data]
46 [GLOBAL _message]
48 _message: db 'hello',0