Prev: E3FA Up: Map Next: E420
E40F: Flip 16 masked pixels
This horizontally flips the 16 pixels in D,E and counterpart masks in D',E'.
Used by the routines at pms16_right and pms16_left.
Input
D Left eight pixels.
E Right eight pixels.
D Left eight mask pixels.
E Right eight mask pixels.
Output
D Flipped left eight pixels.
E Flipped right eight pixels.
D Flipped left eight mask pixels.
E Flipped right eight mask pixels.
Horizontally flip the bitmap bytes by looking up each byte in the flipped / bit-reversed table at $7F00 and swapping the left and right pixels over.
flip_16_masked_pixels E40F LD H,$7F Point HL into the table of 256 flipped bytes at $7Fxx
E411 LD L,D Point HL at the flipped byte for D (left pixels)
E412 LD D,E Shuffle
E413 LD E,(HL) Load the flipped byte into E
E414 LD L,D Point HL at the flipped byte for D (right pixels)
E415 LD D,(HL) Load the flipped byte into D
Likewise horizontally flip the mask bytes.
E416 EXX Swap bank to mask bytes
E417 LD H,$7F Point HL into the table of 256 flipped bytes at $7Fxx
E419 LD L,D Point HL at the flipped byte for D (left mask)
E41A LD D,E Shuffle
E41B LD E,(HL) Load the flipped byte into E
E41C LD L,D Point HL at the flipped byte for D (right mask)
E41D LD D,(HL) Load the flipped byte into D
E41E EXX Restore original bank
E41F RET Return
Prev: E3FA Up: Map Next: E420