d6ed722e1a
FossilOrigin-Name: 6bde19a1eda8b7dd3911fe5e1ec15a89654ed0c1761fea2ba6004cdfe26a9961
47 lines
460 B
ArmAsm
47 lines
460 B
ArmAsm
bits 32
|
|
section .text
|
|
global putchar
|
|
global getchar
|
|
global _start
|
|
extern main
|
|
|
|
align 4
|
|
_start:
|
|
call main
|
|
jmp $
|
|
|
|
align 4
|
|
putchar:
|
|
mov eax, [esp+4]
|
|
mov [buf], eax
|
|
push dword 1
|
|
push dword buf
|
|
push dword 1
|
|
mov eax, 4
|
|
call kernel
|
|
add esp, 12
|
|
ret
|
|
|
|
align 4
|
|
getchar:
|
|
push dword 1
|
|
push dword buf
|
|
push dword 0
|
|
mov eax, 3
|
|
call kernel
|
|
add esp, 12
|
|
mov eax, 0
|
|
mov eax, [buf]
|
|
ret
|
|
|
|
align 4
|
|
kernel:
|
|
int 80h
|
|
ret
|
|
|
|
section .data
|
|
buf:
|
|
dd 0
|
|
dd 0
|
|
dd 0
|
|
dd 0
|