File: rdtlib.asm

package info (click to toggle)
yasm 1.3.0-8
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 13,880 kB
  • sloc: asm: 74,423; ansic: 53,055; python: 9,927; sh: 5,276; xml: 1,617; makefile: 214; pascal: 95; sed: 16
file content (48 lines) | stat: -rw-r--r-- 572 bytes parent folder | download | duplicates (28)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
	;; library functions for rdtmain - test of rdx linking and execution

	;; library function = _strcmp, defined as in C

[SECTION .text]
[BITS 32]

[GLOBAL _strcmp]
_strcmp:
	push ebp
	mov ebp,esp

	;; ebp+8 = first paramater, ebp+12 = second

	mov esi,[ebp+8]
	mov edi,[ebp+12]

.loop:
	mov cl,byte [esi]
	mov dl,byte [edi]
	cmp cl,dl
	jb .below
	ja .above
	or cl,cl
	jz .match
	inc esi
	inc edi
	jmp .loop

.below:	
	mov eax,-1
	pop ebp
	ret
	
.above:
	mov eax,1
	pop ebp
	ret

.match:
	xor eax,eax
	pop ebp
	ret

[SECTION .data]
[GLOBAL _message]

_message:	db 'hello',0