Prev: 03582 Up: Map Next: 03720
03652: 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
CL_LINE 03652 PUSH BC The line number is saved for the duration of the subroutine.
03653 CALL CL_ADDR The starting address for the line is formed in HL.
03656 LD C,8 Again there are eight pixel lines to be considered.
Now enter a loop to clear all the pixel lines.
CL_LINE_1 03658 PUSH BC Save the line number and the pixel line counter.
03659 PUSH HL Save the address.
03660 LD A,B Save the line number in A.
CL_LINE_2 03661 AND 7 Find how many characters are involved in 'B mod 8' lines. Pass the result to the C register. (C will hold 0, i.e. 256, for a 'third'.)
03663 RRCA
03664 RRCA
03665 RRCA
03666 LD C,A
03667 LD A,B Fetch the line number.
03668 LD B,0 Make the BC register pair hold one less than the number of characters.
03670 DEC C
03671 LD D,H Make DE point to the first character.
03672 LD E,L
03673 LD (HL),0 Clear the pixel-byte of the first character.
03675 INC DE Make DE point to the second character and then clear the pixel-bytes of all the other characters.
03676 LDIR
03678 LD DE,1793 For each 'third' of the display HL has to be increased by 1793.
03681 ADD HL,DE
03682 DEC A Now decrease the line number.
03683 AND 248 Discard any extra lines and pass the 'third' count to B.
03685 LD B,A
03686 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.
03688 POP HL Update the address for each pixel line.
03689 INC H
03690 POP BC Fetch the counters.
03691 DEC C Decrease the pixel line counter and jump back unless finished.
03692 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.
03694 CALL CL_ATTR The address of the first attribute byte and the number of bytes are found.
03697 LD H,D HL will point to the first attribute byte and DE the second.
03698 LD L,E
03699 INC DE
03700 LD A,(23693) Fetch the value in ATTR-P.
03703 BIT 0,(IY+2) Jump forward if handling the main part of the screen (bit 0 of TV-FLAG reset).
03707 JR Z,CL_LINE_3
03709 LD A,(23624) Otherwise use BORDCR instead.
CL_LINE_3 03712 LD (HL),A Set the attribute byte.
03713 DEC BC One byte has been done.
03714 LDIR Now copy the value to all the attribute bytes.
03716 POP BC Restore the line number.
03717 LD C,33 Set the column number to the lefthand column and return.
03719 RET
Prev: 03582 Up: Map Next: 03720