Advertisement
blujay__

My first hand-written ASM (NASM) code

Sep 10th, 2017
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. section .data
  2.   prompt db 'How old are you? '
  3.   lenPrompt equ $-prompt
  4.   display db 'You are this old: '
  5.   lenDisplay equ $-display
  6.  
  7. section .bss
  8.   age resb 3
  9.  
  10. section .text
  11.   global _start
  12.  
  13. _start:
  14.   mov eax, 4
  15.   mov ebx, 1
  16.   mov ecx, prompt
  17.   mov edx, lenPrompt
  18.   int 0x80
  19.  
  20.   mov eax, 3
  21.   mov ebx, 2
  22.   mov ecx, age
  23.   mov edx, 3
  24.   int 0x80
  25.  
  26.   mov eax, 4
  27.   mov ebx, 1
  28.   mov ecx, display
  29.   mov edx, lenDisplay
  30.   int 0x80
  31.  
  32.   mov eax, 4
  33.   mov ebx, 1
  34.   mov ecx, age
  35.   mov edx, 3
  36.   int 0x80
  37.  
  38.   mov eax, 1
  39.   mov ebx, 0
  40.   int 0x80
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement