Prev: 93F2 Up: Map Next: 9423
940A: Clear the screen by setting all pixel bytes to $00 and all attributes to the value set in D.
Clears screen memory.
Input
D Attribute value to fill the attribute area.
clear_screen 940A LD HL,$4000 Point HL to start of screen memory (screen_pixels).
940D LD C,$18 Set outer loop counter to $18 (24 blocks for pixel area).
clear_scr_block 940F LD B,$00 Set inner loop counter to 256 (full block).
clear_scr_byte 9411 LD (HL),$00 Write $00 to pixel byte, advance HL, loop until block cleared.
9413 INC HL
9414 DJNZ clear_scr_byte
9416 DEC C Decrement block counter, continue until all pixel blocks done.
9417 JR NZ,clear_scr_block
9419 LD C,$03 Set outer loop counter to $03 (3 blocks for attribute area).
clear_scr_attr 941B LD (HL),D Write attribute value D to byte, advance HL, loop until block cleared.
941C INC HL
941D DJNZ clear_scr_attr
941F DEC C Decrement block counter, continue until all attribute blocks done.
9420 JR NZ,clear_scr_attr
9422 RET
Prev: 93F2 Up: Map Next: 9423