Skip to content

Instantly share code, notes, and snippets.

@ZachOrr
Created October 5, 2012 03:49
Show Gist options
  • Select an option

  • Save ZachOrr/3837963 to your computer and use it in GitHub Desktop.

Select an option

Save ZachOrr/3837963 to your computer and use it in GitHub Desktop.
! Label the global
.global NthByte
! Symbol C file contains (label)
NthByte:
save %sp, -128, %sp
clr %l0 ! initialize accumulator
set %l0, 0xFF
loop:
cmp %i1, %g0 ! done counting ?
be,a away ! if done with loop
and %l0, %i0, %i0 !
and %i0, 0x100, %l0 !
ba loop
dec %i1
away:
ret
restore
@johnmaguire
Copy link
Copy Markdown

Fuck yeah Assembly!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment