0 Members and 1 Guest are viewing this topic.
How do i put my desired color in the low nybble? $0F is white so what do i add/subtract from $0F to get my selection highlighted in white @ screen memory??
okay...Im trying to simplify my routine. currently i ldx #$40 ldy #$01 jsr setadrwhich sets-up the current pointer on the VDCs display. and i simply jsr $CDCA and my .A byte is stored top corresponding screen memory. Heres the question, i want bytes to be stored in "reverse/white" meaning LDA #$0F, AND #64, how do i setup screen "color" pointers??? i would post the source but its aweful...
And your AND - ORA examples worked, but what would i AND and ORA to get reverse white? i know it has something to do with bit #7 but im unsure as how to manipulate this..
Quote from: stiggity on July 27, 2010, 10:51 PMAnd your AND - ORA examples worked, but what would i AND and ORA to get reverse white? i know it has something to do with bit #7 but im unsure as how to manipulate this..You seem to be kind of overthinking the whole affair. The attribute map is really quite simple: each byte controls one position, the low nybble of that byte controls the color, and the high nybble controls the attributes. If you want to turn a character's reverse mode on, you can use ORA #$40 to make sure that bit 6 (reverse) is set.
Do you understand the correspondence between binary and hexadecimal values, and how Boolean arithmetic works? (i.e. why ORA #$40 turns bit 6 on?) If not, you should take some time out and brush up on that until you really understand it, because it's a major part of programming in assembler.
One other thing: the read-AND-ORA-write approach is good if you're trying to preserve the bits you aren't changing, i.e. if you want to change a character's color without affecting its flags. If, on the other hand, you don't care about those and just want to set it to a value regardless, it'll be much faster to simply load an immediate value (LDA #$4F for reverse white) and store it without bothering with the read-AND-ORA bit.
The extra processing time required to do AND followed by ORA using immediate mode addressing is only two clock cycles, a microsecond in FAST mode. The bulk of the execution time will be consumed in addressing the VDC. Let's not encourage any more dubious programming habits by even suggesting blind writes into hardware.