R2023.05.1 - aktualizacja wykładu

This commit is contained in:
2023-05-24 20:05:11 +02:00
parent f2242fdb42
commit 9a28acb0c9
5 changed files with 154 additions and 8 deletions
+47
View File
@@ -0,0 +1,47 @@
# Jan Potocki 2020
# Przyklad wywolania:
# echo 08 | xxd -p -r | ./fibb_asm | hexdump
# Definicje numerow funkcji systemowych i ich parametrow
SYSEXIT64 = 60
SYSREAD = 0
SYSWRITE = 1
STDIN = 0
STDOUT = 1
# Stale okreslajace rozmiar przetwarzanych danych
word_length = 8
.global main
# Segment niezainicjalizowanych danych
.bss
result: .space word_length
# Segment zainicjalizowanych danych
.data
term: .zero word_length
# Segment kodu
.text
main:
mov $SYSREAD, %rax
mov $STDIN, %rdi
mov $term, %rsi
mov $word_length, %rdx
syscall
movq term, %rdi
call fibb
movq %rax, result
mov $SYSWRITE, %rax
mov $STDOUT, %rdi
mov $result, %rsi
mov $word_length, %rdx
syscall
mov $SYSEXIT64, %rax
mov $0, %rdi
syscall