![]() |
Routines |
| Prev: 38747 | Up: Map | Next: 39015 |
|
Used by the routine at XORSpriteLoop.
Draws one row of the new sprite, using XOR, and moves up to the next row. It is a copy of DrawOldEntityRow that uses the jump at DrawNewEntityRow_Jump, which is changed by PrepDraw2.
|
||||||||||||||||||||||
| DrawNewEntityRow | 38881 | LD A,C | Copy the row count to A. | |||||||||||||||||||
| 38882 | EX AF,AF' | Store the row count in AF'. | ||||||||||||||||||||
| 38883 | LD A,(DE) | Fetch the first byte of the row. | ||||||||||||||||||||
| 38884 | LD C,A | Copy it to C to use as the index into the shift table. | ||||||||||||||||||||
| 38885 | PUSH HL | Stash the screen address on the stack. | ||||||||||||||||||||
| DrawNewEntityRow_Jump | 38886 | JR DrawNewEntityRow_Jump | Jump into the unrolled code. The operand of this instruction is changed by PrepDraw2. | |||||||||||||||||||
| DrawNewEntityRow_Byte_1 | 38888 | LD A,(DE) | Byte 1 of the row: look up the shifted byte for the left cell and XOR it onto the screen. | |||||||||||||||||||
| 38889 | LD C,A | |||||||||||||||||||||
| 38890 | LD A,(BC) | |||||||||||||||||||||
| 38891 | XOR (HL) | |||||||||||||||||||||
| 38892 | LD (HL),A | |||||||||||||||||||||
| 38893 | INC L | |||||||||||||||||||||
| DrawNewEntityRow_Byte_1_Right | 38894 | INC B | Look up the shifted byte for the cell to the right and XOR it onto the screen, then move on to the next byte of pixel data. | |||||||||||||||||||
| 38895 | LD A,(BC) | |||||||||||||||||||||
| 38896 | XOR (HL) | |||||||||||||||||||||
| 38897 | LD (HL),A | |||||||||||||||||||||
| 38898 | DEC B | |||||||||||||||||||||
| 38899 | INC DE | |||||||||||||||||||||
| DrawNewEntityRow_Byte_2 | 38900 | LD A,(DE) | Byte 2 of the row: look up the shifted byte for the left cell and XOR it onto the screen. | |||||||||||||||||||
| 38901 | LD C,A | |||||||||||||||||||||
| 38902 | LD A,(BC) | |||||||||||||||||||||
| 38903 | XOR (HL) | |||||||||||||||||||||
| 38904 | LD (HL),A | |||||||||||||||||||||
| 38905 | INC L | |||||||||||||||||||||
| DrawNewEntityRow_Byte_2_Right | 38906 | INC B | Look up the shifted byte for the cell to the right and XOR it onto the screen, then move on to the next byte of pixel data. | |||||||||||||||||||
| 38907 | LD A,(BC) | |||||||||||||||||||||
| 38908 | XOR (HL) | |||||||||||||||||||||
| 38909 | LD (HL),A | |||||||||||||||||||||
| 38910 | DEC B | |||||||||||||||||||||
| 38911 | INC DE | |||||||||||||||||||||
| DrawNewEntityRow_Byte_3 | 38912 | LD A,(DE) | Byte 3 of the row: look up the shifted byte for the left cell and XOR it onto the screen. | |||||||||||||||||||
| 38913 | LD C,A | |||||||||||||||||||||
| 38914 | LD A,(BC) | |||||||||||||||||||||
| 38915 | XOR (HL) | |||||||||||||||||||||
| 38916 | LD (HL),A | |||||||||||||||||||||
| 38917 | INC L | |||||||||||||||||||||
| DrawNewEntityRow_Byte_3_Right | 38918 | INC B | Look up the shifted byte for the cell to the right and XOR it onto the screen, then move on to the next byte of pixel data. | |||||||||||||||||||
| 38919 | LD A,(BC) | |||||||||||||||||||||
| 38920 | XOR (HL) | |||||||||||||||||||||
| 38921 | LD (HL),A | |||||||||||||||||||||
| 38922 | DEC B | |||||||||||||||||||||
| 38923 | INC DE | |||||||||||||||||||||
| DrawNewEntityRow_Byte_4 | 38924 | LD A,(DE) | Byte 4 of the row: look up the shifted byte for the left cell and XOR it onto the screen. | |||||||||||||||||||
| 38925 | LD C,A | |||||||||||||||||||||
| 38926 | LD A,(BC) | |||||||||||||||||||||
| 38927 | XOR (HL) | |||||||||||||||||||||
| 38928 | LD (HL),A | |||||||||||||||||||||
| 38929 | INC L | |||||||||||||||||||||
| DrawNewEntityRow_Byte_4_Right | 38930 | INC B | Look up the shifted byte for the cell to the right and XOR it onto the screen, then move on to the next byte of pixel data. | |||||||||||||||||||
| 38931 | LD A,(BC) | |||||||||||||||||||||
| 38932 | XOR (HL) | |||||||||||||||||||||
| 38933 | LD (HL),A | |||||||||||||||||||||
| 38934 | DEC B | |||||||||||||||||||||
| 38935 | INC DE | |||||||||||||||||||||
| DrawNewEntityRow_Byte_5 | 38936 | LD A,(DE) | Byte 5 of the row: look up the shifted byte for the left cell and XOR it onto the screen. | |||||||||||||||||||
| 38937 | LD C,A | |||||||||||||||||||||
| 38938 | LD A,(BC) | |||||||||||||||||||||
| 38939 | XOR (HL) | |||||||||||||||||||||
| 38940 | LD (HL),A | |||||||||||||||||||||
| 38941 | INC L | |||||||||||||||||||||
| DrawNewEntityRow_Byte_5_Right | 38942 | INC B | Look up the shifted byte for the cell to the right and XOR it onto the screen, then move on to the next byte of pixel data. | |||||||||||||||||||
| 38943 | LD A,(BC) | |||||||||||||||||||||
| 38944 | XOR (HL) | |||||||||||||||||||||
| 38945 | LD (HL),A | |||||||||||||||||||||
| 38946 | DEC B | |||||||||||||||||||||
| 38947 | INC DE | |||||||||||||||||||||
| DrawNewEntityRow_Byte_6 | 38948 | LD A,(DE) | Byte 6 of the row: look up the shifted byte for the left cell and XOR it onto the screen. | |||||||||||||||||||
| 38949 | LD C,A | |||||||||||||||||||||
| 38950 | LD A,(BC) | |||||||||||||||||||||
| 38951 | XOR (HL) | |||||||||||||||||||||
| 38952 | LD (HL),A | |||||||||||||||||||||
| 38953 | INC L | |||||||||||||||||||||
| DrawNewEntityRow_Byte_6_Right | 38954 | INC B | Look up the shifted byte for the cell to the right and XOR it onto the screen, then move on to the next byte of pixel data. | |||||||||||||||||||
| 38955 | LD A,(BC) | |||||||||||||||||||||
| 38956 | XOR (HL) | |||||||||||||||||||||
| 38957 | LD (HL),A | |||||||||||||||||||||
| 38958 | DEC B | |||||||||||||||||||||
| 38959 | INC DE | |||||||||||||||||||||
| DrawNewEntityRow_Byte_7 | 38960 | LD A,(DE) | Byte 7 of the row: look up the shifted byte for the left cell and XOR it onto the screen. | |||||||||||||||||||
| 38961 | LD C,A | |||||||||||||||||||||
| 38962 | LD A,(BC) | |||||||||||||||||||||
| 38963 | XOR (HL) | |||||||||||||||||||||
| 38964 | LD (HL),A | |||||||||||||||||||||
| 38965 | INC L | |||||||||||||||||||||
| DrawNewEntityRow_Byte_7_Right | 38966 | INC B | Look up the shifted byte for the cell to the right and XOR it onto the screen, then move on to the next byte of pixel data. | |||||||||||||||||||
| 38967 | LD A,(BC) | |||||||||||||||||||||
| 38968 | XOR (HL) | |||||||||||||||||||||
| 38969 | LD (HL),A | |||||||||||||||||||||
| 38970 | DEC B | |||||||||||||||||||||
| 38971 | INC DE | |||||||||||||||||||||
| DrawNewEntityRow_Byte_8 | 38972 | LD A,(DE) | Byte 8 of the row: look up the shifted byte for the left cell and XOR it onto the screen. | |||||||||||||||||||
| 38973 | LD C,A | |||||||||||||||||||||
| 38974 | LD A,(BC) | |||||||||||||||||||||
| 38975 | XOR (HL) | |||||||||||||||||||||
| 38976 | LD (HL),A | |||||||||||||||||||||
| 38977 | INC L | |||||||||||||||||||||
| DrawNewEntityRow_Byte_8_Right | 38978 | INC B | Look up the shifted byte for the cell to the right and XOR it onto the screen, then move on to the next byte of pixel data. | |||||||||||||||||||
| 38979 | LD A,(BC) | |||||||||||||||||||||
| 38980 | XOR (HL) | |||||||||||||||||||||
| 38981 | LD (HL),A | |||||||||||||||||||||
| 38982 | DEC B | |||||||||||||||||||||
| 38983 | INC DE | |||||||||||||||||||||
| DrawNewEntityRow_Byte_9 | 38984 | LD A,(DE) | Byte 9 of the row: look up the shifted byte for the left cell and XOR it onto the screen. | |||||||||||||||||||
| 38985 | LD C,A | |||||||||||||||||||||
| 38986 | LD A,(BC) | |||||||||||||||||||||
| 38987 | XOR (HL) | |||||||||||||||||||||
| 38988 | LD (HL),A | |||||||||||||||||||||
| 38989 | INC L | |||||||||||||||||||||
| DrawNewEntityRow_Byte_9_Right | 38990 | INC B | Look up the shifted byte for the cell to the right and XOR it onto the screen, then move on to the next byte of pixel data. | |||||||||||||||||||
| 38991 | LD A,(BC) | |||||||||||||||||||||
| 38992 | XOR (HL) | |||||||||||||||||||||
| 38993 | LD (HL),A | |||||||||||||||||||||
| 38994 | DEC B | |||||||||||||||||||||
| 38995 | INC DE | |||||||||||||||||||||
| DrawNewEntityRow_Byte_9_Next | 38996 | EX AF,AF' | Fetch the row count from AF'. | |||||||||||||||||||
| 38997 | LD C,A | Copy the row count to C. | ||||||||||||||||||||
| 38998 | POP HL | Restore the screen address from the stack. | ||||||||||||||||||||
| 38999 | DEC H | Move up one pixel line. | ||||||||||||||||||||
| 39000 | LD A,H | Fetch the inverse of the high byte of the address in A. | ||||||||||||||||||||
| 39001 | CPL | |||||||||||||||||||||
| 39002 | AND %00000111 | Keep only the pixel line bits (bits 0-2). | ||||||||||||||||||||
| 39004 | RET NZ | Return if the move up stayed inside the same character cell. | ||||||||||||||||||||
| 39005 | LD A,L | Subtract 32 from the low byte to move up to the previous character row. | ||||||||||||||||||||
| 39006 | SUB 32 | |||||||||||||||||||||
| 39008 | LD L,A | |||||||||||||||||||||
| 39009 | RET C | Return if the move up stayed inside the same third of the screen. | ||||||||||||||||||||
| 39010 | LD A,H | Add 8 to the high byte to move up to the previous third of the screen. | ||||||||||||||||||||
| 39011 | ADD A,8 | |||||||||||||||||||||
| 39013 | LD H,A | |||||||||||||||||||||
| 39014 | RET | Return. | ||||||||||||||||||||
|
View the equivalent code in;
|
||||||||||||||||||||||
| Prev: 38747 | Up: Map | Next: 39015 |