Prev: AA5B Up: Map Next: AAE2
AAC4: Draw Picture
Draws a picture on the screen. A picture starts with its width in bytes and its height in pixel lines, and is followed by the bytes of each line with the bottom line first.
draw-picture
Input
DE The address of the picture
HL The pixel position of the bottom left (H is y, L is x)
DrawPicture AAC4 PUSH HL Save the position.
AAC5 CALL GetScreenAddress Convert the position into a screen address.
AAC8 LD A,(DE) Fetch the width of the picture.
AAC9 LD ($AAD2),A Store it in the operand of the instruction at AAD1.
AACC INC DE Move onto the height.
AACD LD A,(DE) Fetch it.
AACE INC DE Move onto the first byte of the picture.
AACF LD C,A Keep the height in C.
DrawPicture_Line AAD0 PUSH HL Save the screen address of the start of the line.
AAD1 LD B,$00 Set the width in bytes (this is patched at AAD2).
DrawPicture_Byte AAD3 LD A,(DE) Fetch a byte of the picture.
AAD4 LD (HL),A Write it to the screen.
AAD5 INC DE Move onto the next byte of the picture.
AAD6 INC L Move onto the next byte of the screen.
AAD7 DJNZ DrawPicture_Byte Jump back until the line has been drawn.
AAD9 POP HL Restore the screen address of the start of the line.
AADA CALL MoveUpALine Move up a pixel line.
AADD DEC C Decrease the height by one.
AADE JR NZ,DrawPicture_Line Jump back until all of the lines have been drawn.
AAE0 POP HL Restore the position.
AAE1 RET Return.
Prev: AA5B Up: Map Next: AAE2