1 ; Chapter 3 "exit"
     
2 ;
     
3 ; Uses Linux syscall "exit" with return value in ebx.
     
4 ; Example run:
     
5 ;
     
6 ;   $ ./go.sh ch03.1_exit  # script in this repo
     
7 ;   Exited with code: 0
     
8 ;
     
9 ; Or with 42 in  ebx:
    
10 ;
    
11 ;   $ ./go.sh ch03.1_exit
    
12 ;   Exited with code: 42
    
13 
    14 section .data
    
15 
    16 section .text
    
17 
    18 global _start
    
19 _start:
    
20     mov eax, 1 ; linux syscall 'exit'
    
21     mov ebx, 0 ; return value for exit
    
22     int 0x80   ; interrupt to call linux kernel