Prev: 080F Up: Map Next: 084D
081B: screen_address: Calculate the address in screen RAM of the second byte of character row in A.
Used by the routine at decode_row.
screen_address 081B LD A,(row_number) Load row_number into A.
081E CP $08 If less than 8 (upper screen third) jump to screen_address_1.
0820 JR C,screen_address_1
0822 CP $10 Else if less than 16 (middle screen third) jump to screen_address_3.
0824 JR C,screen_address_3
0826 SUB $10 Else subtract 16.
0828 LD DE,$5001 Set DE to $5001 (second byte of lower screen third).
screen_address_0 082B LD H,$00 Multiply value in A by 8 and store in HL.
082D ADD A,A
082E ADD A,A
082F ADD A,A
0830 LD L,A
0831 ADD HL,HL Multiply HL by 4.
0832 ADD HL,HL
0833 ADD HL,DE HL equals DE + (A*32).
0834 LD (char_addr),HL Store in char_addr and return.
0837 RET
screen_address_1 0838 LD DE,$4001 Set DE to $4001 (second byte of upper screen third).
083B AND A If row_number in A is not zero jump back to screen_address_0.
083C JP Z,screen_address_2
083F JR screen_address_0
screen_address_2 0841 LD (char_addr),DE Else set char_addr to $4001 and return.
0845 RET
screen_address_3 0846 SUB $08 Subtract 8 from value in A and set DE to $4801 (second byte of middle screen third).
0848 LD DE,$4801
084B JR screen_address_0 Jump back to screen_address_0.
Prev: 080F Up: Map Next: 084D