Ok, so moving on, now its onto the second routine, the one that actually builds the Chess Pieces.
As mentioned earlier, E holds the current piece. To decide whether we needed to come to this routine a zero check was done. As it didn't hold 00 then here we are!
So next, we need to take the result of the additional test on BIT 0 to see if we're going to make a White or Black piece.
Code: Select all
chess_2019:
sbc a,a ;set B/W component according to BIT 0 of E
ld c,a ;set B/W component in C, Black=FF, White=00
As you might be able to see in pictures posted earlier on in this thread, the pieces start a few lines higher than the square bottom. So here we give it 4 lines of buffering to raise the start of the piece up a bit.
Code: Select all
blanking:
ld b,04h
ld a,d ;test current line no.
;D just holds a number used for line check and masking + counter correction.
cp b ;if 00-03 then RET, as we've not reached printing
ret c ;of the base yet.
If the D line counter holds 00-03 then we just return to the main routine.