(self, t)
Sprite tile writer
Sprite tile writer
Sprite tile writer
def write_tile_to_rom(self, t):
        """Sprite tile writer"""
        surf_buf = t.get_buffer().raw
        for tile8x8_off in (8, 136, 0, 128):
            surf_off = tile8x8_off

            for y in range(8):
                row_bitplane1 = 0
                row_bitplane2 = 0
                row_bitplane3 = 0
                row_bitplane4 = 0

                for x in range(8):
                    col = surf_buf[surf_off]
                    row_bitplane1 += ((col >> 0) & 1) << x
                    row_bitplane2 += ((col >> 1) & 1) << x
                    row_bitplane3 += ((col >> 2) & 1) << x
                    row_bitplane4 += ((col >> 3) & 1) << x
                    surf_off += 1

                self.fd1.write(struct.pack('2B', row_bitplane1, row_bitplane2))
                self.fd2.write(struct.pack('2B', row_bitplane3, row_bitplane4))
                surf_off += 8
def write_tile_to_rom ( self , t ) : surf_buf = t . get_buffer ( ) . raw for tile8x8_off in ( 8 , 136 , 0 , 128 ) : surf_off = tile8x8_off for y in range ( 8 ) : row_bitplane1 = 0 row_bitplane2 = 0 row_bitplane3 = 0 row_bitplane4 = 0 for x in range ( 8 ) : col = surf_buf [ surf_off ] row_bitplane1 += ( ( col >> 0 ) & 1 ) << x row_bitplane2 += ( ( col >> 1 ) & 1 ) << x row_bitplane3 += ( ( col >> 2 ) & 1 ) << x row_bitplane4 += ( ( col >> 3 ) & 1 ) << x surf_off += 1 self . fd1 . write ( struct . pack ( '2B' , row_bitplane1 , row_bitplane2 ) ) self . fd2 . write ( struct . pack ( '2B' , row_bitplane3 , row_bitplane4 ) ) surf_off += 8