blob: 9cc1e9cf808807b528194bd0b6757915eaa09137 (
plain) (
blame)
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
|
%ifndef _BUILTIN_ECHO_ASM
%define _BUILTIN_ECHO_ASM
builtin_echo:
push bp
mov bp, sp
mov cx, word [bp + 4] ; argc
mov bx, word [bp + 6] ; argv
cmp cx, 0 ; if no arguments, return
jbe .return
.output: ; print argv
push word [bx]
push .msg_fmt
call printf
add sp, 2 * 2
add bx, 2
dec cx
jne .output
.return:
mov sp, bp
pop bp
ret
.msg_fmt db '%s ', 0
%endif
|