Prev: 49992 Up: Map Next: 50002
50000: 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
0 2 The length of the record, less one
2 1 The screen third to start at
3 1 The number of thirds to draw
4 1 Flags; see DrawPicture_Flags
5 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 50000 JR DrawPicture_Unpack Jump over the parameters to DrawPicture_Unpack.
View the equivalent code in;
Prev: 49992 Up: Map Next: 50002