Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .globl _start
- .data
- varb: .byte 190
- varw: .word 51966
- varl: .long 3735927486
- varq: .quad 18369548392556473261
- outstr: .ascii "value = 0x0000000000000000\n"
- .equ strlen, . - outstr
- .text
- _start:
- xor %eax,%eax #rax=0
- mov varw,%ax #liczba do wyswietlenia, plinowac typu danych!
- #przekazac informacje jaki typ danych konwerujemy (np. liczba bajtow...)
- mov $outstr+24,%rdi #adres pod ktory zapisac wynik
- call convert_num
- mov $1,%eax
- mov $1,%edi
- mov $outstr,%rsi
- mov $strlen,%edx
- syscall
- mov $60,%eax
- xor %edi,%edi
- syscall
- conver_num:
- mov %ax,%bx
- and $0x0F,%ax
- call convert_nibble
- shl $8,%eax #tu cos sie jebie
- mov %bx,%ax
- shr $4,%ax
- call convert_nibble
- mov %eax,(%edi) #albo tutaj sie cos jebie
- ret
- #uzupelnic w oparciu o lab. 3.
- ret
- convert_nibble:
- cmp $10,%ax
- jc below10
- add $55,%ax
- ret
- below10:
- add $48,%ax
- ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement