gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

C/C++ > registers

#4600 - Mega386 - Fri Apr 04, 2003 7:48 am

im a real newbie so if someone could just humor me and help me out with this problem. im trying to figure out why bit 12 in REG_DISPCNT which is the enable objects register = 0x1000 when 12 = 1100 in binary. please help!

#4601 - delbogun - Fri Apr 04, 2003 8:09 am

actually, 0x1000 is the hexadecimal value. in decimal, that value is 4096 and in binary that value is 1000000000000.

#4602 - Mega386 - Fri Apr 04, 2003 8:13 am

ok so the 0x1000 is the hex value, can you tell me how this equals to the 12th bit in REG_DISPCNT?

#4603 - delbogun - Fri Apr 04, 2003 8:18 am

each number on the binary value is one bit. if you calculate from right to left (starting with 0), you'll see that when you have counted to 12, the number 1 is there ;)

0001000000000000
FEDCBA9876543210

C = 12

#4604 - Mega386 - Fri Apr 04, 2003 8:20 am

i get it now, thanks alot.