Prev: CB3E Up: Map Next: CB71
CB5B: Print Character With Attribute
Prints a character on the screen and sets its attribute.
Input
A The character
A' Attribute
HL Screen address
Print the pixels, then the attribute.
PrintCharacterWithAttribute CB5B CALL PrintScreen Call PrintScreen.
CB5E PUSH DE Stash DE and HL on the stack.
CB5F PUSH HL
CB60 LD A,H Copy the high byte of the screen address.
CB61 RRCA Move it into the attribute file range.
CB62 RRCA
CB63 RRCA
CB64 AND %00000011 Keep bits 0 and 1.
CB66 LD H,A Set the high byte.
CB67 LD DE,$5800 Set DE to 5800.
CB6A ADD HL,DE Add it to get the attribute address.
CB6B EX AF,AF' Switch to AF'.
CB6C LD (HL),A Set the attribute of the character.
CB6D EX AF,AF' Switch back.
CB6E POP HL Restore HL and DE from the stack.
CB6F POP DE
CB70 RET Return.
View the equivalent code in;
Prev: CB3E Up: Map Next: CB71