2) TV Generation

There are two arrays in the program. The screen[1600] array hold the pixels status of the TV screen and the Board[10][15] array hold the status of cells on the minesweeper's board.

We used the TV generation codes [3] that were used in the lab. A function were written to display a cell in the board based on the supplied location and the image to be displayed there. The board is 10 by 15 with each cell occupied a 8x8 pixels region. We called an 8 x 8 image that we draw in each cell as an "icon". The TV resolution implemented in the video codes is 100 pixels high by 128 pixels wide. 

Every different icons will have a 1 bit border at the right and bottom. This will allow us to put the icons on the screen without worrying about drawing the grid of the board. Only one line on the left and one on the top is needed to make the whole board complete.

A 10 x 15 cells board. The bottom space is used for displaying timer, number of mines remaining and other information.

The TV resolution implemented in the video codes is 100 pixels high and 128 pixels wide. The screen array in the video code is 1600 bytes long. with each bit representing a pixel on the TV screen. The diagram below shows the mapping of the actual screen pixels to the screen array.

The Board[10][15] array hold the status of each cell in the minesweeper's in the 10x15 board. 
A function called video_icon(char row, char col, char c) is written to put an 8 x 8 icon into the screen array corresponds to the location of the board. For example, video_icon(0,0, 10) will draw a mine at the [0][0] of the board on the screen.