Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SYSEXIT = 1
- SYSREAD = 3
- SYSWRITE = 4
- STDIN = 0
- STDOUT = 1
- SYSCALL = 0x80
- EXIT_SUCCESS = 0
- BUFFOR_SIZE = 1
- CESAR_SHIFT = 25
- A_ASCII = 0x41
- Z_ASCII = 0x5A
- AZ_DIFF = 0x1A
- .align 32
- .data
- currentByte: .byte 0x00
- .text
- .global _start
- _start:
- # start pętli głownej - wczytanie 1 bajtu do currentByte
- mainLoop:
- mov $SYSREAD, %eax
- mov $STDIN, %ebx
- mov $currentByte, %ecx
- mov $BUFFOR_SIZE, %edx
- int $SYSCALL
- # jesli w akumulatorze jest 0 - koniec, skok do końca pętli
- cmp $0, %eax
- je end
- cmpb $A_ASCII, currentByte
- jl writeByte
- cmpb $Z_ASCII, currentByte
- jg writeByte
- #przetwarzanie A-Z
- addb $CESAR_SHIFT, currentByte
- cmpb $Z_ASCII, currentByte
- jle writeByte
- subb $AZ_DIFF, currentByte
- #koniec przetwarzania A-Z
- writeByte:
- mov $SYSWRITE, %eax
- mov $STDOUT, %ebx
- mov $currentByte, %ecx
- mov $BUFFOR_SIZE, %edx
- int $SYSCALL
- # skok do początku pętli głównej
- jmp mainLoop
- end:
- mov $SYSEXIT, %eax
- mov $EXIT_SUCCESS, %ebx
- int $SYSCALL
Add Comment
Please, Sign In to add comment