Advice on general approaches or feasibility and discussions about game design
Post a reply

Re: Super Maruino Land

Thu Jul 09, 2015 4:18 pm

It's easy. Imagine 0b1111 1010 is your number. For selecting parts of the byte, you just have to use the "shift" operator. This operation moves the bits in the number left or right. So if I shift 4 bit to the right, the number will looks like this : 0b 0000 1111. In C, you use << for shifting bits to the left, and >> for shifting bits to the right. You have to do x >> y, wher x is your number and y the number of bits you what to shift.

So if you what to select the first part of the number, you do number >> 4.

The the second part (1010 in our case) you have to use a bit mask to 'mask' the first part. For that, you use the & (bit and) like this :
number & 0b0000 1111.

For more info check this : https://en.wikipedia.org/wiki/Bitwise_operation#AND and https://en.wikipedia.org/wiki/Bitwise_operation#Arithmetic_shift

TL;DR :
Code:
left_half = number >> 4;
//if it doesn't works, try left_half = (number >> 4) & 0b 0000 1111;
right_half = number & 0b0000 1111;

Re: Super Maruino Land

Thu Jul 09, 2015 5:01 pm

awesome101 wrote:Hey guys I'm working on another console called pigrrl:
Image


Very, very nice! :-)

Who would have thought that it would be possible to build own consoles, manufacture plastic cases, easily program games when we where kids...

Re: Super Maruino Land

Thu Jul 09, 2015 8:03 pm

wel its basicly a raspery pi running a emulator
but its prety nice

Re: Super Maruino Land

Thu Jul 09, 2015 10:02 pm

Yeah it's pretty easy to make too. :D
Post a reply