Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
section .data
name db "What is your Name"
nameLen equ $-name
section .bss
answer resw 1
section .text
global _start
_start
mov rax,4 ;; Move the system call 4 to the register rax
; to say ouput
mov rbx,1 ;; put the value 1 in the register rbx -
; standard output to the screen
mov rcx, name ; Put the offset of hello in rcx register
;; so we can access the string 'name'
mov rdx, nameLen ;Move length of name in register
int 80h ; Call the operating system with an interrupt.
mov rax,3 ; system call input
mov rbx, 0 ; stand input
mov ecx, answer ; store inputted value in num1 - note ascii
; value and should be between 1-9
mov edx, 10 ; size of input value in bytes
int 80h
; The operating system checks the registers and
; performs the operation to write to screen
mov rax,1 ; Put 1 in rax which equates to the system call
; for exit (sys_exit)
mov rbx,0 ; Put 0 in rbx which is the exit value 0 (no
; error)
int 80h; Call the operating system with an interrupt.
; The operating system checks the registers and
; performs the exit operation