Thursday 8 April 2021

Has got to be seen to be believed!

Years ago I wrote some C/Allegro code to rip the Galaxian graphics for my FPGA implementation. It displayed the graphics so I knew the format was correct, and output some VHDL source code for the palette logic and graphics ROM contents (pre-rotated for a horizontal display).

Today I took that code (Scramble graphics are exactly the same format), updated it for the new Allegro library, and modified it to produce C source code for palette and graphics data arrays in their simplest format (1 byte per pixel). This simplifies further conversion on any platform; for example the PC Scramble protoype will create Allegro tiles and sprites (bitmaps) on-the-fly from these arrays at start-up.

FWIW, the output looks like this...

// tile data
uint8_t tile[256][64] =
{
  // $00
  {
    0x00, 0x00, 0x00, 0x03, 0x03, 0x03, 0x00, 0x00,     //    ###  
    0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x03, 0x00,     //   #  ## 
    0x00, 0x03, 0x03, 0x00, 0x00, 0x00, 0x03, 0x03,     //  ##   ##
    0x00, 0x03, 0x03, 0x00, 0x00, 0x00, 0x03, 0x03,     //  ##   ##
    0x00, 0x03, 0x03, 0x00, 0x00, 0x00, 0x03, 0x03,     //  ##   ##
    0x00, 0x00, 0x03, 0x03, 0x00, 0x00, 0x03, 0x00,     //   ##  # 
    0x00, 0x00, 0x00, 0x03, 0x03, 0x03, 0x00, 0x00,     //    ###  
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,     //         
  },
  // $01
  {
    0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x00, 0x00,     //     ##  
    0x00, 0x00, 0x00, 0x03, 0x03, 0x03, 0x00, 0x00,     //    ###  
    0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x00, 0x00,     //     ##  
    0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x00, 0x00,     //     ##  
    0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x00, 0x00,     //     ##  
    0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x00, 0x00,     //     ##  
    0x00, 0x00, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,     //   ######
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,     //         
  },

In the mean-time, I've got the Scramble program displaying the tiles and sprites using pixel-drawing primitives from the data arrays (palette #6).

Next task is to create the tiles and sprites ready for use by Allegro. Once that's done, I can get on with the task of the transcoding, and be able to quickly and easily see the results on the display.


No comments:

Post a Comment