Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- EXIT_NR = 1
- READ_NR = 3
- WRITE_NR = 4
- STDOUT = 1
- STDIN = 0
- EXIT_CODE_SUCCESS = 0
- input_len=4096
- output_len=1
- .global _start
- .data
- space: .byte ' ;
- .bss
- .comm input, 512
- .comm output_high, 1
- .comm output_low, 1
- .text
- _start:
- mov $READ_NR, %eax
- mov $STDIN, %ebx
- mov $input, %ecx
- mov $input_len, %edx
- int $0x80
- mov %eax,%edi
- mov $0,%esi
- loop:
- mov input(%esi),%ah
- mov input(%esi),%al
- shrb $4,%ah
- cmpb $0x0A, %ah
- jge ah_wieksze_od_10
- addb $0x30,%ah
- jmp po_ah
- ah_wieksze_od_10:
- addb $0x37,%ah
- po_ah:
- andb $0x0F,%al
- cmpb $0x0A, %al
- jge al_wieksze_od_10
- addb $0x30,%al
- jmp po_al
- al_wieksze_od_10:
- addb $0x37,%al
- po_al:
- movb %ah, output_high
- movb %al, output_low
- mov $WRITE_NR, %eax
- mov $STDOUT, %ebx
- mov $output_high, %ecx
- mov $output_len, %edx
- int $0x80
- mov $WRITE_NR, %eax
- mov $STDOUT, %ebx
- mov $output_low, %ecx
- mov $output_len, %edx
- int $0x80
- mov $WRITE_NR, %eax
- mov $STDOUT, %ebx
- mov $space, %ecx
- mov $output_len, %edx
- int $0x80
- inc %esi
- cmp %esi,%edi
- jne loop
- mov $EXIT_NR , %eax
- mov $EXIT_CODE_SUCCESS, %ebx
- int $0x80
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement