-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbasic.s
More file actions
executable file
·37 lines (32 loc) · 815 Bytes
/
Copy pathbasic.s
File metadata and controls
executable file
·37 lines (32 loc) · 815 Bytes
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
37
SYSCALL32 = 0x80 # sysfun: nr funkcji w %eax, parametry: %ebx, %ecx, %edx
EXIT = 1 #nr funkcji restartu (=1) – zwrot sterowania do s.o.
STDIN = 0 # nr wejścia standardowego (klawiatura) do %ebx
READ = 3 # nr funkcji odczytu wejścia (=3)
STDOUT = 1 # nr wyjścia standardowego (ekran tekstowy) do %ebx
WRITE = 4 # nr funkcji wyjścia (=4)
BUF_SIZE = 254 # rozmiar bufora (w bajtach/znakach ASCII) – max 254
.data
msg: .ascii "Hello!\n"
msg_len = . - msg
TEXT_SIZE: .long 0
BUF: .space BUF_SIZE
.text
.globl _start
_start:
nop
#CZYTAJ Z KLAWIATURY
movl $BUF_SIZE, %edx
movl $BUF, %ecx
movl $STDIN, %ebx
movl $READ, %eax
int $SYSCALL32
movl %eax, TEXT_SIZE
write:
movl $WRITE, %eax
movl $STDOUT, %ebx
movl $BUF, %ecx
movl TEXT_SIZE, %edx
int $SYSCALL32
out:
movl $EXIT , %EAX
int $SYSCALL32