[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: More thoughts about Lode Runner & other multiload games...



On Saturday, September 29, 2012 3:45:38 PM UTC-5, Steve Nickolas wrote:
> http://1.buric.co/lrrbcd.zip
> 
> 
> 
> Given a sector containing a level from Lode Runner, these tools will 
> 
> convert between the 256-byte (only 224 used) raw sector form and a 
> 
> 196-byte format made through what I call "reverse binary-coded decimal 
> 
> packing".
> 
> 
> 
> Basically, each nibble contains a value from 0-9 (where they could take a 
> 
> value up to 15).  This means each byte has only 100 options, instead of 
> 
> 256.  A range of 100 will fit in 7 bits (which have a range of 128). 
> 
> Therefore by taking the converted values, and packing 8 bytes in 7 by 
> 
> discarding the top bits, the file is reduced from 224 used bytes to 196.
> 
> 
> 
> lrrbcd.c is a tool to encode levels using this scheme.
> 
> lrunrbcd.c is a tool to decode levels using this scheme.
> 
> 
> 
> I haven't translated the UNRBCD algo to 6502 yet.  Also, it breaks in 
> 
> Watcom C, so you'll probably need to use GNU C (e.g., MinGW).
> 
> 
> 
> -uso.

The code in Lrrbcd.c has the following instruction that seems out of place:

   tbuf[k]=((k&0xF0)>>4)*10+(k&0x0F);

Tommy