Skip to content

Instantly share code, notes, and snippets.

@RoryDuncan
Created October 19, 2015 16:27
Show Gist options
  • Save RoryDuncan/d380a4d57b1cda9a8758 to your computer and use it in GitHub Desktop.
Save RoryDuncan/d380a4d57b1cda9a8758 to your computer and use it in GitHub Desktop.
showBinary HLA procedure
// 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