Created
October 19, 2015 16:27
-
-
Save RoryDuncan/d380a4d57b1cda9a8758 to your computer and use it in GitHub Desktop.
showBinary HLA procedure
This file contains 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
// procedure forward declarations | |
procedure showBinary(value: byte); @forward; | |
// procedure definitions | |
procedure showBinary(value: byte); | |
begin showBinary; | |
push(eax); | |
push(ecx); | |
mov(value, al); | |
stdout.put("%"); | |
for (mov(0, cl); cl < 8; inc(cl)) do | |
shl(1, al); | |
if (@c) then | |
stdout.put("1"); | |
else | |
stdout.put("0"); | |
endif; | |
if (cl == 3) then | |
stdout.put("_"); | |
endif; | |
endfor; | |
pop(ecx); | |
pop(eax); | |
end showBinary; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment