-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEchoInput.asm
More file actions
30 lines (23 loc) · 799 Bytes
/
Copy pathEchoInput.asm
File metadata and controls
30 lines (23 loc) · 799 Bytes
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
; ********************************************************************************
; This program takes in input and outputs it
; ********************************************************************************
%include "lib/io.asm"
%define BUF_SIZE 32
section .bss
buffer resb BUF_SIZE
section .data
sCaret db "> "
lCaret equ $-sCaret
section .text:
global _start
_start:
CallPrintStr sCaret, lCaret ; print prompt
CallInputStr buffer, BUF_SIZE ; input string
mov edx, eax ; capture length of input
lea ecx, [buffer] ; load buf address
call PrintStr ; print buffer
Newline ; print newline
exit:
mov eax, 1
xor ebx, ebx
int 0x80