Prev: 6A23 Up: Map Next: 6B4F
6B31: Fill Screen With UDG
Used by the routine at 72C9.
Loop Index Screen Output
01 fill-1
02 fill-2
03 fill-3
Input
DE Pointer to UDG graphic data
FillScreenWithUDG 6B31 LD HL,$4000 Point HL to the start of the screen buffer (4000).
6B34 LD B,L B=L.
Draw one character block.
FillScreenWithUDG_Loop 6B35 PUSH BC Stash the position counter, screen address and graphic pointer on the stack.
6B36 PUSH HL
6B37 PUSH DE
6B38 LD B,$08 Set a line counter in B (08 lines in a UDG).
FillScreenWithUDG_LineLoop 6B3A LD A,(DE) Copy the UDG data to the screen buffer.
6B3B LD (HL),A
6B3C INC H Move down one pixel line in the screen buffer.
6B3D INC DE Move to the next UDG graphic data byte.
6B3E DJNZ FillScreenWithUDG_LineLoop Decrease the line counter by one and loop back to FillScreenWithUDG_LineLoop until all 08 lines of the UDG character have been drawn.
Move to the next character position in the row.
6B40 POP DE Restore the graphic pointer and original screen address from the stack.
6B41 POP HL
6B42 INC HL Move right one character block.
6B43 POP BC Restore the position counter from the stack.
6B44 DJNZ FillScreenWithUDG_Loop Decrease the position counter by one and loop back to FillScreenWithUDG_Loop until the current screen third is filled with the sprite.
Move to the next screen third.
6B46 LD A,H Add 07 to H to move down to the next screen third.
6B47 ADD A,$07
6B49 LD H,A
6B4A CP $58 Jump back to FillScreenWithUDG_Loop until HL reaches the attribute buffer at 5800.
6B4C JR NZ,FillScreenWithUDG_Loop
6B4E RET Return.
Prev: 6A23 Up: Map Next: 6B4F