ATmega16

Status
Not open for further replies.

tuck

New Member
Sorry to intrupt.
Can anyone help me to solve this question?
I was trying to write a macro in ATmega16 assembly language,
that will make 76543210 to become 01237654.
but i don't know how to write it, can anyone pls help me solve it?
thank you.
(the number above is the number of bits of the register)
 
Last edited:
I didn't check it but quick and dirty

MACRO MAPBITS
clr @2
sbrc @1,7
sbr @2,0
sbrc @1,6
sbr @2,1
sbrc @1,5
sbr @2,2
sbrc @1,4
sbr @2,3
sbrc @1,3
sbr @2,7
sbrc @1,2
sbr @2,6
sbrc @1,1
sbr @2,5
sbrc @1,0
sbr @2,4
.ENDMACRO

Should work, mapbits @1 @2
The mapped contents of @1 will be in @2 at the end. Both registers need to be between 16 and 31
 
Last edited:
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…