Prev: C348 Up: Map Next: C352
C350: Draw Picture
Used by the BASIC program. Draws picture number *DrawPicture_Number from the picture list that starts at Graphics_DepartmentOfNationalPolice. The picture goes to the screen, or to a buffer when BASIC has POKEd the high bytes used by the instructions at DrawPicture_PixelsHighByte (pixels) and DrawPicture_AttributesHighByte (attributes).
Each picture record is laid out as follows:
Offset Bytes Contents
00 02 The length of the record, less one
02 01 The screen third to start at
03 01 The number of thirds to draw
04 01 Flags; see DrawPicture_Flags
05 Varies Pixel data, then attribute data
Both lots of data are run-length encoded. A non-zero byte is written as it is. A zero byte is followed by a count and a value, and the value is written that many times (a count of zero writes it 256 times).
When bit 0 of the flags is clear, the pixel data is in column order: each column is written from the top of the picture to the bottom, one byte for each pixel line, and then the next column to the right follows. When bit 0 is set, the pixel data is in row order: each pixel line is written from left to right, from the top of the picture to the bottom. The attribute data is always in the same order as the attribute file.
The routine works out its own address as it runs, so the same code works in both parts of the game.
DrawPicture C350 JR DrawPicture_Unpack Jump over the parameters to DrawPicture_Unpack.
View the equivalent code in;
Prev: C348 Up: Map Next: C352