Prev: 0DFE Up: Map Next: 0E88
0E44: THE 'CLEAR LINES' SUBROUTINE
Used by the routines at CLS, CL_ALL and AUTO_LIST.
The routine at CL_SC_ALL continues here.
This subroutine will clear the bottom B lines of the display.
Input
B Number of lines to clear
Output
CL_LINE 0E44 PUSH BC The line number is saved for the duration of the subroutine.
0E45 CALL CL_ADDR The starting address for the line is formed in HL.
0E48 LD C,$08 Again there are eight pixel lines to be considered.
Now enter a loop to clear all the pixel lines.
CL_LINE_1 0E4A PUSH BC Save the line number and the pixel line counter.
0E4B PUSH HL Save the address.
0E4C LD A,B Save the line number in A.
CL_LINE_2 0E4D AND $07 Find how many characters are involved in 'B mod 8' lines. Pass the result to the C register. (C will hold +00, i.e. 256, for a 'third'.)
0E4F RRCA
0E50 RRCA
0E51 RRCA
0E52 LD C,A
0E53 LD A,B Fetch the line number.
0E54 LD B,$00 Make the BC register pair hold one less than the number of characters.
0E56 DEC C
0E57 LD D,H Make DE point to the first character.
0E58 LD E,L
0E59 LD (HL),$00 Clear the pixel-byte of the first character.
0E5B INC DE Make DE point to the second character and then clear the pixel-bytes of all the other characters.
0E5C LDIR
0E5E LD DE,$0701 For each 'third' of the display HL has to be increased by +0701.
0E61 ADD HL,DE
0E62 DEC A Now decrease the line number.
0E63 AND $F8 Discard any extra lines and pass the 'third' count to B.
0E65 LD B,A
0E66 JR NZ,CL_LINE_2 Jump back if there are still 'thirds' to be dealt with.
Now find if the loop has been used eight times.
0E68 POP HL Update the address for each pixel line.
0E69 INC H
0E6A POP BC Fetch the counters.
0E6B DEC C Decrease the pixel line counter and jump back unless finished.
0E6C JR NZ,CL_LINE_1
Next the attribute bytes are set as required. The value in ATTR-P will be used when handling the main part of the display and the value in BORDCR when handling the lower part.
0E6E CALL CL_ATTR The address of the first attribute byte and the number of bytes are found.
0E71 LD H,D HL will point to the first attribute byte and DE the second.
0E72 LD L,E
0E73 INC DE
0E74 LD A,($5C8D) Fetch the value in ATTR-P.
0E77 BIT 0,(IY+$02) Jump forward if handling the main part of the screen (bit 0 of TV-FLAG reset).
0E7B JR Z,CL_LINE_3
0E7D LD A,($5C48) Otherwise use BORDCR instead.
CL_LINE_3 0E80 LD (HL),A Set the attribute byte.
0E81 DEC BC One byte has been done.
0E82 LDIR Now copy the value to all the attribute bytes.
0E84 POP BC Restore the line number.
0E85 LD C,$21 Set the column number to the lefthand column and return.
0E87 RET
Prev: 0DFE Up: Map Next: 0E88