Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- section .bss
- readBuf resb 1000
- readBuf2 resb 1000
- bufSize equ 1000
- section .data
- prompt db "Hello, please type something in",0x0A
- promptLen equ $ - prompt
- section .text
- global _start
- _start:
- mov edx, 33 ;
- mov ecx, prompt ;
- mov ebx, 1 ;
- mov eax, 0x04 ; sys_write (why am I using hex for this? I dunno, looks cool...
- int 0x80
- mov edx, bufSize ; max number of bytes to read
- mov ecx, readBuf ; address of buffer to store bytes from input
- mov ebx, 0 ; stdin file descriptor
- mov eax, 0x03 ; sys_call read
- int 0x80 ; generate interrupt to trigger kernal system call
- ; maybe we should check for failure here (return value negative??)
- ;now let's just echo the text back out...
- mov edx, eax ;
- mov ecx, readBuf ;
- mov ebx, 1 ;
- mov eax, 0x04 ; sys_write (why am I using hex for this? I dunno, looks cool...
- int 0x80
- ; now let's see if we can reverse the text...
- ; exit cleanly
- _exit:
- mov ebx,0 ;first syscall argument: exit code
- mov eax,1 ;system call number (sys_exit)
- int 0x80 ;call kernel
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement