Routines 
Prev: 2294  Up: Map  Next: 22CB 


PIXEL_ADD  22AA  LD A,$AF  Test that the y coordinate (in B) is not greater than 175.  
22AC  SUB B  
22AD  JP C,REPORT_B_3  
22B0  LD B,A  B now contains 175 minus y.  
22B1  AND A  A holds b7b6b5b4b3b2b1b0, the bits of B.  
22B2  RRA  And now 0b7b6b5b4b3b2b1.  
22B3  SCF  Now 10b7b6b5b4b3b2.  
22B4  RRA  
22B5  AND A  Now 010b7b6b5b4b3.  
22B6  RRA  
22B7  XOR B  Finally 010b7b6b2b1b0, so that H becomes 64+8*INT(B/64)+(B mod 8), the high byte of the pixel address.  
22B8  AND %11111000  
22BA  XOR B  
22BB  LD H,A  
22BC  LD A,C  C contains x.  
22BD  RLCA  A starts as c7c6c5c4c3c2c1c0 and becomes c4c3c2c1c0c7c6c5.  
22BE  RLCA  
22BF  RLCA  
22C0  XOR B  Now c4c3b5b4b3c7c6c5.  
22C1  AND %11000111  
22C3  XOR B  
22C4  RLCA  Finally b5b4b3c7c6c5c4c3, so that L becomes 32*INT((B mod 64)/8)+INT(x/8), the low byte.  
22C5  RLCA  
22C6  LD L,A  
22C7  LD A,C  A holds x mod 8, so the pixel is bit (7A) within the byte.  
22C8  AND $07  
22CA  RET 
Prev: 2294  Up: Map  Next: 22CB 