Line | |
---|
1 | .sect .text; .sect .rom; .sect .data; .sect .bss
|
---|
2 | .sect .text
|
---|
3 | .define printc,printd,prints
|
---|
4 |
|
---|
5 | ! argument in eax
|
---|
6 | ! uses ebx
|
---|
7 | prints:
|
---|
8 | xchg eax,ebx
|
---|
9 | 1:
|
---|
10 | movb al,(ebx)
|
---|
11 | inc ebx
|
---|
12 | testb al,al
|
---|
13 | jz 2f
|
---|
14 | call printc
|
---|
15 | jmp 1b
|
---|
16 | 2:
|
---|
17 | ret
|
---|
18 |
|
---|
19 | ! argument in eax
|
---|
20 | ! uses ecx and edx
|
---|
21 | printd:
|
---|
22 | xor edx,edx
|
---|
23 | mov ecx,10
|
---|
24 | div ecx
|
---|
25 | test eax,eax
|
---|
26 | jz 1f
|
---|
27 | push edx
|
---|
28 | call printd
|
---|
29 | pop edx
|
---|
30 | 1:
|
---|
31 | xchg eax,edx
|
---|
32 | addb al,'0'
|
---|
33 |
|
---|
34 | ! argument in eax
|
---|
35 | printc:
|
---|
36 | push eax
|
---|
37 | mov ebx,esp
|
---|
38 | mov eax,1
|
---|
39 | push eax
|
---|
40 | push ebx
|
---|
41 | push eax
|
---|
42 | call __write
|
---|
43 | pop ebx
|
---|
44 | pop ebx
|
---|
45 | pop ebx
|
---|
46 | pop ebx
|
---|
47 | ret
|
---|
Note:
See
TracBrowser
for help on using the repository browser.