Created
July 7, 2015 20:19
-
-
Save zhrkvl/acafe888c81a9e9b1052 to your computer and use it in GitHub Desktop.
Compare a and b
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| BITS 64 | |
| section .data | |
| a dd -3 | |
| b dd -3 | |
| msg1 db 'A is bigger', 0xa | |
| msg1l equ $-msg1 | |
| msg2 db 'B is bigger', 0xa | |
| msg2l equ $-msg2 | |
| msg3 db 'A == B', 0xa | |
| msg3l equ $-msg3 | |
| section .text | |
| global _start | |
| _start: | |
| mov eax, [a] | |
| mov ebx, [b] | |
| cmp eax, ebx | |
| jg bigger | |
| cmp eax, ebx | |
| jl less | |
| mov eax, 4 ; equal | |
| mov ebx, 1 | |
| mov ecx, msg3 | |
| mov edx, msg3l | |
| int 0x80 | |
| jmp endif | |
| bigger: | |
| mov eax, 4 | |
| mov ebx, 1 | |
| mov ecx, msg1 | |
| mov edx, msg1l | |
| int 0x80 | |
| jmp endif | |
| less: | |
| mov eax, 4 | |
| mov ebx, 1 | |
| mov ecx, msg2 | |
| mov edx, msg2l | |
| int 0x80 | |
| jmp endif | |
| endif: | |
| mov eax, 1 | |
| int 0x80 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment