Prev: 33205 Up: Map Next: 33291
33246: Drawing: Screen Address From The Row
Used by the routines at Drawing_MaskOneScreenByte and Drawing_AddressThePixel.
Builds a Spectrum screen address from the pen in D and E.
Drawing_ScreenAddressFromTheRow 33246 LD A,127 The top screen row is 127.
33248 SUB E The pixel row is 127 minus the low coordinate.
33249 LD L,A Keep 127.
33250 AND %00000111 Keep the low three bits of the row and select the screen base.
33252 OR 64 Merge in 64.
33254 LD H,A Store the screen address high byte so far.
33255 LD A,L Take the pixel row back into A.
33256 AND %11000000 Take the top two bits of the row.
33258 RRCA Move the screen-third bits down one place.
33259 RRCA Move the screen-third bits down another place.
33260 RRCA Move the screen-third bits down to bits 3-4.
33261 OR H Fold them into the screen address.
33262 LD H,A Store the screen address high byte.
33263 LD A,L Take the pixel row back into A.
33264 AND %00111000 Take the middle three bits of the row.
33266 RLCA Move the middle row bits up one place.
33267 RLCA Move them up to bits 5-7.
33268 LD L,A Those bits start the screen address low byte.
33269 LD A,D Take the high coordinate.
33270 RRCA
33271 RRCA
33272 RRCA
33273 AND 31
33275 OR L Fold the character column into the screen address.
33276 LD L,A Store the screen address low byte.
33277 LD A,D Take the high coordinate again.
33278 AND %00000111 The low three bits choose the pixel inside the byte.
33280 PUSH BC Save BC and keep A in B.
33281 LD B,A
33282 INC B Make the rotate count one more than the bit number.
33283 LD A,1 Start the pixel mask at 1.
Drawing_ScreenAddressFromTheRow_ShiftPixelMask 33285 RRC A Rotate the pixel mask one place right.
33287 DJNZ Drawing_ScreenAddressFromTheRow_ShiftPixelMask Decrease counter by one and loop back to Drawing_ScreenAddressFromTheRow_ShiftPixelMask until counter is zero.
33289 POP BC Restore BC from the stack.
33290 RET Return.
Prev: 33205 Up: Map Next: 33291