-
Notifications
You must be signed in to change notification settings - Fork 0
/
pr.asm
36 lines (31 loc) · 1.02 KB
/
pr.asm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
;%include "stud_io.inc"
;global _start
;section .text
;_start: mov eax, 0
;again: PRINT "Hello"
; PUTCHAR 10
; inc eax
; cmp eax, 5
; jl again
; FINISH
;Program : exit
;Executes the exit system call
;No input
;Output: only the exit status ($? in the shell)
; data or instructions following it are to be
; placed in the .text segment or section
segment .text
; assembler directive or a pseudo opcode (pseudo-op)
; This pseudo-op informs the assembler that the label _start
; is to be made known to the linker program when the program is linked.
global start
; label. Since no code has been generated up to this point,
; the label refers to location 0 of the program's text segment.
start:
; symbolic opcodes
mov eax,1 ;1 is the exit sys call number
mov ebx,5 ;the status value to return
; generates a software interrupt numbered Ox80
; which is the way Linux handles 32 bit system calls.
; (This code works on both 32 bit and 64 bit Linux systems.)
int 0x80 ;execute a system call