Skip to content

Instantly share code, notes, and snippets.

@ooade
Created February 3, 2018 10:36
Show Gist options
  • Save ooade/0cfa588535b15be1a6bf11f41d4baf03 to your computer and use it in GitHub Desktop.
Save ooade/0cfa588535b15be1a6bf11f41d4baf03 to your computer and use it in GitHub Desktop.
Program to wish unknown users happy birthday
; Program to wish an unknown user a happy birthday
section .text
global _start
_start:
; write
mov eax, 4
mov ebx, 1 ;std_out
mov ecx, msg
mov edx, msg_len
int 0x80
; get input from keyboard
mov eax, 3
mov ebx, 0 ;std_in
mov ecx, user
mov edx, 5
int 0x80
; output
mov eax, 4
mov ebx, 1
mov ecx, res
mov edx, res_len
int 0x80
; output
mov eax, 4
mov ebx, 1
mov ecx, [user]
mov edx, 5
int 0x80
exit:
mov eax, 1
int 0x80
section .bss
user resw 5
section .data
msg db "Enter celebrant's name: "
msg_len equ $ - msg
res db "Happy birthday, "
res_len equ $ - msg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment