Prev: 52030 Up: Map Next: 52081
52059: 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 52059 CALL PrintScreen Call PrintScreen.
52062 PUSH DE Stash DE and HL on the stack.
52063 PUSH HL
52064 LD A,H Copy the high byte of the screen address.
52065 RRCA Move it into the attribute file range.
52066 RRCA
52067 RRCA
52068 AND %00000011 Keep bits 0 and 1.
52070 LD H,A Set the high byte.
52071 LD DE,22528 Set DE to 22528.
52074 ADD HL,DE Add it to get the attribute address.
52075 EX AF,AF' Switch to AF'.
52076 LD (HL),A Set the attribute of the character.
52077 EX AF,AF' Switch back.
52078 POP HL Restore HL and DE from the stack.
52079 POP DE
52080 RET Return.
View the equivalent code in;
Prev: 52030 Up: Map Next: 52081