Prev: 35627 Up: Map Next: 35674
35649: Clear display file
When this routine is entered via 35649 and 35656, B is set to zero. Upon reaching the DJNZ instruction (end of inner loop) at 35664, B is already zero, so the loop will execute 256 times, clearing one twelfth of the display file (two bytes cleared per PUSH, 256 PUSHes per loop).
However when entering via 35663 (jump at 28727), HL is set 23264 (second last character in second last row of attribute file) and BC is set to 4098 (B = 16, C = 2). This means that the first iteration of the inner loop will only clear 32 bytes (i.e. 23rd character row) in the attribute file. The outer loop will, however, execute twice. Upon second iteration of outer loop, B is zero (as it was at the end of the first outer loop's inner loop), so the inner loop will this time execute 256 times, clearing the 22nd to the 7th (inclusive) character rows.
Used by the routine at 26884.
35649 LD HL,0 Load zero (all bits reset) into HL
35652 LD BC,12 Load B with 0 (repeat inner loop 256 times) and C with 12 (repeat outer loop 12 times)
35655 DI Disable interrupts
This entry point is used by the routine at 35627.
35656 LD (35670),SP Store stack pointer at 35670
35660 LD SP,22528 Point stack pointer at start of attribute section of video memory
This entry point is used by the routine at 28716.
35663 PUSH HL Decrease current stack pointer position by two and load two zeroes into it
35664 DJNZ 35663 Loop back for next iteration
35666 DEC C Decrease C...
35667 JR NZ,35663 ...and repeat if C is still greater than zero, to clear the remaining eleven twelfths of the display file
The operand of the instruction at 35669 represents the original value in SP stored previously. This is modified by the instructions at 28717 and 35656.
35669 LD SP,0 Restore stack pointer to original value
35672 EI Enable interrupts
35673 RET Return
Prev: 35627 Up: Map Next: 35674