![]() |
Routines |
| Prev: E10E | Up: Map | Next: E205 |
|
Used by the routine at LoadMapObjects.
Puts the objects of one column of the map in free slots of the map objects. An object is skipped if the current player has destroyed it (bit 7 of its byte in the table at MapTable is set, or bit 6 for player two), if it is not on one of the two rows that are on the screen or if there is already a slot for it. It is put in the first free slot of the first three slots, or in the fourth if none of them is free. Its column, row, position and kind are set from the tables. The slot holds the index of the object in offsets 18 and 19 so that the object can be marked as destroyed later.
|
||||||||||||||
| AddMapObjects | E114 | AND A | Return if A is zero. | |||||||||||
| E115 | RET Z | |||||||||||||
| AddMapObjects_Next2 | E116 | PUSH BC | Stash BC on the stack. | |||||||||||
| E117 | BIT 7,(HL) | Jump to AddMapObjects_Skip if bit 7 of the byte at the address in HL is set. | ||||||||||||
| E119 | JP NZ,AddMapObjects_Skip | |||||||||||||
| E11C | LD A,(IX+$01) | Read offset 01 of IX. | ||||||||||||
| E11F | AND %00011111 | Keep the bits of A that are set in 1F. | ||||||||||||
| E121 | LD E,A | E=A. | ||||||||||||
| E122 | LD A,($CE58) | The map row. | ||||||||||||
| E125 | CP E | Jump to AddMapObjects_Search if A is E. | ||||||||||||
| E126 | JR Z,AddMapObjects_Search | |||||||||||||
| E128 | INC A | Advance A. | ||||||||||||
| E129 | CP E | Jump to AddMapObjects_Skip if A is not E. | ||||||||||||
| E12A | JP NZ,AddMapObjects_Skip | |||||||||||||
| AddMapObjects_Search | E12D | LD IY,$A80B | The map object slots. | |||||||||||
| E131 | LD B,$04 | B=04. | ||||||||||||
| AddMapObjects_Search2 | E133 | LD A,(IY+$00) | Read offset 00 of IY. | |||||||||||
| E136 | INC A | Advance A. | ||||||||||||
| E137 | JR Z,AddMapObjects_Next | Jump to AddMapObjects_Next if the zero flag is set. | ||||||||||||
| E139 | LD A,(IY+$01) | Read offset 01 of IY. | ||||||||||||
| E13C | CP C | Jump to AddMapObjects_Next if A is not C. | ||||||||||||
| E13D | JR NZ,AddMapObjects_Next | |||||||||||||
| E13F | LD A,(IY+$04) | Read offset 04 of IY. | ||||||||||||
| E142 | CP E | Jump to AddMapObjects_Skip if A is E. | ||||||||||||
| E143 | JP Z,AddMapObjects_Skip | |||||||||||||
| AddMapObjects_Next | E146 | LD A,E | A=E. | |||||||||||
| E147 | LD DE,$001A | DE=1A. | ||||||||||||
| E14A | ADD IY,DE | IY gains DE. | ||||||||||||
| E14C | LD E,A | E=A. | ||||||||||||
| E14D | DJNZ AddMapObjects_Search2 | Decrease B and jump to AddMapObjects_Search2 until none remain. | ||||||||||||
| AddMapObjects_Free | E14F | LD IY,$A80B | The map object slots. | |||||||||||
| E153 | LD B,$03 | B=03. | ||||||||||||
| AddMapObjects_SearchSecond | E155 | LD A,(IY+$00) | Read offset 00 of IY. | |||||||||||
| E158 | INC A | Advance A. | ||||||||||||
| E159 | JR Z,AddMapObjects_Fill | Jump to AddMapObjects_Fill if the zero flag is set. | ||||||||||||
| E15B | LD A,E | A=E. | ||||||||||||
| E15C | LD DE,$001A | DE=1A. | ||||||||||||
| E15F | ADD IY,DE | IY gains DE. | ||||||||||||
| E161 | LD E,A | E=A. | ||||||||||||
| E162 | DJNZ AddMapObjects_SearchSecond | Decrease B and jump to AddMapObjects_SearchSecond until none remain. | ||||||||||||
| AddMapObjects_Fill | E164 | PUSH IX | Stash IX on the stack. | |||||||||||
| E166 | PUSH IY | Stash IY on the stack. | ||||||||||||
| E168 | POP IX | Bring IX back off the stack. | ||||||||||||
| E16A | POP IY | Bring IY back off the stack. | ||||||||||||
| E16C | CALL FreeObjectSlot | Call FreeObjectSlot. | ||||||||||||
| E16F | PUSH IX | Stash IX on the stack. | ||||||||||||
| E171 | PUSH IY | Stash IY on the stack. | ||||||||||||
| E173 | POP IX | Bring IX back off the stack. | ||||||||||||
| E175 | POP IY | Bring IY back off the stack. | ||||||||||||
| E177 | LD (IY+$04),E | Write E to offset 04 of IY. | ||||||||||||
| E17A | LD (IY+$00),$0D | Store 0D at offset 00 of IY. | ||||||||||||
| E17E | LD A,(HL) | Read HL. | ||||||||||||
| E17F | AND %00111111 | Keep the bits of A that are set in 3F. | ||||||||||||
| E181 | LD (IY+$13),A | Write A to offset 13 of IY. | ||||||||||||
| E184 | PUSH HL | Stash HL on the stack. | ||||||||||||
| E185 | LD HL,$E205 | The object attributes. | ||||||||||||
| E188 | CALL AddAToHL | Call AddAToHL. | ||||||||||||
| E18B | LD A,(HL) | Read HL. | ||||||||||||
| E18C | LD (IY+$0D),A | Write A to offset 0D of IY. | ||||||||||||
| E18F | LD HL,$E0FD | The object kinds. | ||||||||||||
| E192 | LD A,(IY+$13) | Read offset 13 of IY. | ||||||||||||
| E195 | CALL AddAToHL | Call AddAToHL. | ||||||||||||
| E198 | LD A,(HL) | Read HL. | ||||||||||||
| E199 | AND %11100000 | Keep the bits of A that are set in E0. | ||||||||||||
| E19B | SRL A | Shift A right. | ||||||||||||
| E19D | SRL A | Shift A right. | ||||||||||||
| E19F | SRL A | Shift A right. | ||||||||||||
| E1A1 | SRL A | Shift A right. | ||||||||||||
| E1A3 | LD (IY+$18),A | Write A to offset 18 of IY. | ||||||||||||
| E1A6 | BIT 4,(HL) | Jump to AddMapObjects_Position if bit 4 of the byte at the address in HL is clear. | ||||||||||||
| E1A8 | JR Z,AddMapObjects_Position | |||||||||||||
| E1AA | LD A,(HL) | Read HL. | ||||||||||||
| E1AB | AND %00001111 | Keep the bits of A that are set in 0F. | ||||||||||||
| E1AD | LD HL,$E10E | The special object states. | ||||||||||||
| E1B0 | CALL AddAToHL | Call AddAToHL. | ||||||||||||
| E1B3 | LD A,(HL) | Read HL. | ||||||||||||
| E1B4 | LD (IY+$13),A | Write A to offset 13 of IY. | ||||||||||||
| E1B7 | INC HL | Advance HL. | ||||||||||||
| E1B8 | LD A,(HL) | Read HL. | ||||||||||||
| E1B9 | LD (IY+$14),A | Write A to offset 14 of IY. | ||||||||||||
| E1BC | LD (IY+$15),$80 | Store 80 at offset 15 of IY. | ||||||||||||
| E1C0 | LD (IY+$00),$1B | Store 1B at offset 00 of IY. | ||||||||||||
| AddMapObjects_Position | E1C4 | POP HL | Bring HL back off the stack. | |||||||||||
| E1C5 | LD DE,($CE3A) | Fetch the word at ScratchValues into DE. | ||||||||||||
| E1C9 | LD A,D | A=D. | ||||||||||||
| E1CA | OR (IY+$18) | Set the bits of A that are set in the byte at offset 18 of IY. | ||||||||||||
| E1CD | LD (IY+$18),A | Write A to offset 18 of IY. | ||||||||||||
| E1D0 | LD (IY+$19),E | Write E to offset 19 of IY. | ||||||||||||
| E1D3 | LD (IY+$01),C | Write C to offset 01 of IY. | ||||||||||||
| E1D6 | LD A,(IX+$00) | Read offset 00 of IX. | ||||||||||||
| E1D9 | AND %11111100 | Keep the bits of A that are set in FC. | ||||||||||||
| E1DB | DEC A | Step A back. | ||||||||||||
| E1DC | LD (IY+$05),A | Write A to offset 05 of IY. | ||||||||||||
| E1DF | LD A,(IX+$00) | Read offset 00 of IX. | ||||||||||||
| E1E2 | AND %00000011 | Keep the bits of A that are set in 03. | ||||||||||||
| E1E4 | ADD A,A | Double A. | ||||||||||||
| E1E5 | ADD A,A | Double A. | ||||||||||||
| E1E6 | ADD A,A | Double A. | ||||||||||||
| E1E7 | LD E,A | E=A. | ||||||||||||
| E1E8 | LD A,(IX+$01) | Read offset 01 of IX. | ||||||||||||
| E1EB | AND %11100000 | Keep the bits of A that are set in E0. | ||||||||||||
| E1ED | OR E | Set the bits of A that are set in E. | ||||||||||||
| E1EE | LD (IY+$02),A | Write A to offset 02 of IY. | ||||||||||||
| AddMapObjects_Skip | E1F1 | INC IX | Advance IX. | |||||||||||
| E1F3 | INC IX | Advance IX. | ||||||||||||
| E1F5 | INC HL | Advance HL. | ||||||||||||
| E1F6 | LD DE,($CE3A) | Fetch the word at ScratchValues into DE. | ||||||||||||
| E1FA | INC DE | Advance DE. | ||||||||||||
| E1FB | LD ($CE3A),DE | The next object in the column. | ||||||||||||
| E1FF | POP BC | Bring BC back off the stack. | ||||||||||||
| E200 | DEC B | Step B back. | ||||||||||||
| E201 | JP NZ,AddMapObjects_Next2 | Jump to AddMapObjects_Next2 if the zero flag is clear. | ||||||||||||
| E204 | RET | Return. | ||||||||||||
| Prev: E10E | Up: Map | Next: E205 |