Prev: 081B Up: Map Next: 08B0
084D: set_attrs: Set screen attributes corresponding to screen address in character screen address variable to value in temp_attr.
Used by the routines at conceal_code, code_set_at and translate_colour.
set_attrs 084D LD A,(column_offset) return if column_offset is 3.
0850 CP $03
0852 RET Z
0853 LD A,(reveal_flag) If reveal_flag is not set, and conceal_flag is set then clear low 3 bits of temp_attr.
0856 AND A
0857 JR NZ,set_attrs_0
0859 LD A,(conceal_flag)
085C AND A
085D JR Z,set_attrs_0
085F LD A,(temp_attr)
0862 AND $F8
0864 LD (temp_attr),A
set_attrs_0 0867 LD HL,(char_addr) Load char_addr into HL.
086A LD A,(row_number) If row_number is less than 8, jump to set_attrs_3 to set A to 24.
086D CP $08
086F JR C,set_attrs_3
0871 CP $10 Else if row_number is less than 16, jump to set_attrs_4 to set A to 17.
0873 JR C,set_attrs_4
0875 LD A,$0A Else set A to 10.
set_attrs_1 0877 ADD A,H Add A * 256 to address in HL to get corresponding attribute byte.
0878 LD H,A
0879 LD A,(temp_attr) Copy temp_attr to address.
087C LD (HL),A
087D LD (current_attr_address),HL Store address in current_attr_address.
0880 LD A,(row_number) Return if row_number is greater than or equal to 23.
0883 CP $17
0885 RET NC
0886 LD A,(row_has_double_flag) Return if row_has_double_flag is clear.
0889 AND A
088A RET Z
088B LD BC,$0020 Else add 32 to address in HL to get to next row of attribute data.
088E ADD HL,BC
088F LD A,(double_height_flag) If double_height_flag is set copy temp_attr to address in HL and return.
0892 AND A
0893 JR Z,set_attrs_2
0895 LD A,(temp_attr)
0898 LD (HL),A
0899 RET
set_attrs_2 089A LD A,(temp_attr) Else load temp_attr into A.
089D AND $F8 Copy bits 3-5 down into to low 3 bits (set ink colour to paper colour).
089F LD B,A
08A0 AND $3F
08A2 RRCA
08A3 RRCA
08A4 RRCA
08A5 OR B
08A6 LD (HL),A Store result at address in HL and return.
08A7 RET
set_attrs_3 08A8 LD A,$18 Set A to 24 and jump back to set_attrs_1.
08AA JR set_attrs_1
set_attrs_4 08AC LD A,$11 Set A to 17 and jump back to set_attrs_1.
08AE JR set_attrs_1
Prev: 081B Up: Map Next: 08B0