![]() |
Routines |
| Prev: E244 | Up: Map | Next: E2BD |
|
Draws a flat piece of terrain, three bytes wide, going up the screen two pixel rows at a time. The words of the picture are popped from the stack (which DrawTerrain has pointed at the picture) and stored in a zigzag, so that a word is two screen bytes next to each other. The entry point at DrawFlatRows moves one column to the right and carries on at DrawFlatRows_Start. The three JR instructions at DrawFlatRows_Next, DrawFlatRows_PatchSecond and DrawFlatRows_PatchThird have their displacements set by DrawTerrain to choose how much of the three bytes is drawn. When one is changed to 33 or to EE the row is drawn from DrawFlatRows_NextColumn or DrawFlatRows, and when DrawFlatRows_PatchSecond or DrawFlatRows_PatchThird is changed to 24 or 26 the word is skipped (DrawFlatRows_SkipWord and DrawFlatRows_SkipOne).
|
||||||||||||
| DrawFlatRows | E249 | INC L | Advance L. | |||||||||
| E24A | JP DrawFlatRows_Start | Jump to DrawFlatRows_Start. | ||||||||||
| DrawFlatRows_Normal | E24D | LD B,A | B=A. | |||||||||
| E24E | LD A,($CE49) | The segment screen address. | ||||||||||
| E251 | ADD A,$03 | Add 03 to A. | ||||||||||
| E253 | LD ($CE49),A | Update the segment screen address. | ||||||||||
| E256 | INC L | Advance L. | ||||||||||
| E257 | INC L | Advance L. | ||||||||||
| E258 | INC L | Advance L. | ||||||||||
| DrawFlatRows_Next | E259 | JR DrawFlatRows_Next | Skip ahead by the displacement that DrawTerrain sets. | |||||||||
| DrawFlatRows_Word1 | E25B | POP DE | Bring DE back off the stack. | |||||||||
| E25C | LD (HL),E | Write E where HL points. | ||||||||||
| DrawFlatRows_PatchSecond | E25D | JR DrawFlatRows_PatchSecond | Skip ahead by the displacement that DrawTerrain sets. | |||||||||
| DrawFlatRows_Word2 | E25F | INC L | Advance L. | |||||||||
| E260 | LD (HL),D | Write D where HL points. | ||||||||||
| DrawFlatRows_PatchThird | E261 | JR DrawFlatRows_PatchThird | Skip ahead by the displacement that DrawTerrain sets. | |||||||||
| DrawFlatRows_Word3 | E263 | INC L | Advance L. | |||||||||
| E264 | POP DE | Bring DE back off the stack. | ||||||||||
| E265 | LD (HL),E | Write E where HL points. | ||||||||||
| E266 | DEC H | Step H back. | ||||||||||
| E267 | LD (HL),D | Write D where HL points. | ||||||||||
| E268 | DEC L | Step L back. | ||||||||||
| DrawFlatRows_Word4 | E269 | POP DE | Bring DE back off the stack. | |||||||||
| E26A | LD (HL),E | Write E where HL points. | ||||||||||
| E26B | DEC L | Step L back. | ||||||||||
| DrawFlatRows_Store | E26C | LD (HL),D | Write D where HL points. | |||||||||
| DrawFlatRows_Up | E26D | DEC H | Step H back. | |||||||||
| E26E | LD A,H | A=H. | ||||||||||
| E26F | INC A | Advance A. | ||||||||||
| E270 | AND %00000111 | Keep the bits of A that are set in 07. | ||||||||||
| E272 | JR NZ,DrawFlatRows_Loop | Jump to DrawFlatRows_Loop if the zero flag is clear. | ||||||||||
| E274 | LD A,L | A=L. | ||||||||||
| E275 | SUB $20 | Subtract 20 from A. | ||||||||||
| E277 | LD L,A | L=A. | ||||||||||
| E278 | JR C,DrawFlatRows_Loop | Jump to DrawFlatRows_Loop if the carry flag is set. | ||||||||||
| E27A | LD A,H | A=H. | ||||||||||
| E27B | ADD A,$08 | Add 08 to A. | ||||||||||
| E27D | LD H,A | H=A. | ||||||||||
| DrawFlatRows_Loop | E27E | DJNZ DrawFlatRows_Next | Decrease B and jump to DrawFlatRows_Next until none remain. | |||||||||
| E280 | JP FinishStep_Exchange | Jump to FinishStep_Exchange. | ||||||||||
| DrawFlatRows_SkipWord | E283 | DEC H | Step H back. | |||||||||
| E284 | POP DE | Bring DE back off the stack. | ||||||||||
| E285 | POP DE | Bring DE back off the stack. | ||||||||||
| E286 | JP DrawFlatRows_Store | Jump to DrawFlatRows_Store. | ||||||||||
| DrawFlatRows_SkipOne | E289 | DEC H | Step H back. | |||||||||
| E28A | POP DE | Bring DE back off the stack. | ||||||||||
| E28B | JP DrawFlatRows_Word4 | Jump to DrawFlatRows_Word4. | ||||||||||
| DrawFlatRows_NextColumn | E28E | INC A | Advance A. | |||||||||
| E28F | AND %00011111 | Keep the bits of A that are set in 1F. | ||||||||||
| E291 | JR NZ,DrawFlatRows_Column | Jump to DrawFlatRows_Column if the zero flag is clear. | ||||||||||
| E293 | LD A,L | A=L. | ||||||||||
| E294 | SUB $20 | Subtract 20 from A. | ||||||||||
| E296 | LD ($CE49),A | Update the segment screen address. | ||||||||||
| DrawFlatRows_Column | E299 | LD A,L | A=L. | |||||||||
| E29A | AND %11100000 | Keep the bits of A that are set in E0. | ||||||||||
| E29C | INC A | Advance A. | ||||||||||
| E29D | LD L,A | L=A. | ||||||||||
| DrawFlatRows_Start | E29E | LD A,$4C | A=4C. | |||||||||
| E2A0 | LD ($E25A),A | Skip the rest of the flat row. | ||||||||||
| E2A3 | INC SP | Advance SP. | ||||||||||
| DrawFlatRows_PatchFourth | E2A4 | JR DrawFlatRows_PatchFourth | Skip ahead by the displacement that DrawTerrain sets. | |||||||||
| DrawFlatRows_Pop | E2A6 | INC SP | Advance SP. | |||||||||
| E2A7 | POP DE | Bring DE back off the stack. | ||||||||||
| E2A8 | LD (HL),E | Write E where HL points. | ||||||||||
| DrawFlatRows_PatchFifth | E2A9 | JR DrawFlatRows_PatchFifth | Skip ahead by the displacement that DrawTerrain sets. | |||||||||
| DrawFlatRows_Right | E2AB | INC L | Advance L. | |||||||||
| E2AC | LD (HL),D | Write D where HL points. | ||||||||||
| E2AD | POP DE | Bring DE back off the stack. | ||||||||||
| E2AE | DEC H | Step H back. | ||||||||||
| E2AF | LD (HL),E | Write E where HL points. | ||||||||||
| E2B0 | DEC L | Step L back. | ||||||||||
| E2B1 | LD (HL),D | Write D where HL points. | ||||||||||
| E2B2 | POP DE | Bring DE back off the stack. | ||||||||||
| E2B3 | JP DrawFlatRows_Up | Jump to DrawFlatRows_Up. | ||||||||||
| DrawFlatRows_Left | E2B6 | DEC H | Step H back. | |||||||||
| E2B7 | LD (HL),D | Write D where HL points. | ||||||||||
| E2B8 | POP DE | Bring DE back off the stack. | ||||||||||
| E2B9 | POP DE | Bring DE back off the stack. | ||||||||||
| E2BA | JP DrawFlatRows_Up | Jump to DrawFlatRows_Up. | ||||||||||
| Prev: E244 | Up: Map | Next: E2BD |