![]() |
Routines |
Prev: 43084 | Up: Map | Next: 43189 |
This routine "swaps" the data between DE and HL.
These are all the player states.
|
||||
ChangePlayer | 43136 | LD HL,24224 | HL=ActivePlayer_Level. | |
43139 | LD DE,24228 | DE=InactivePlayer_Level. | ||
43142 | LD B,4 | B=4 (counter). | ||
This looks complicated but it's just grabbing the data from DE, grabbing the data from HL, and writing the others data to each one.
|
||||
ChangePlayer_States | 43144 | LD A,(DE) | A=fetch byte from DE. | |
43145 | LD C,(HL) | C=fetch byte from HL. | ||
43146 | LD (HL),A | Write the byte from DE to HL, and the byte from HL to DE. | ||
43147 | LD A,C | |||
43148 | LD (DE),A | |||
43149 | INC HL | Increment HL by one. | ||
43150 | INC DE | Increment DE by one. | ||
43151 | DJNZ ChangePlayer_States | Decrease counter by one and loop back to ChangePlayer_States until counter is zero. | ||
This is the current terrain buffer data.
|
||||
43153 | LD HL,28672 | HL=TerrainData_Active. | ||
43156 | LD DE,29696 | DE=TerrainData_Inactive. | ||
43159 | LD BC,1024 | BC=1024 (counter). | ||
43162 | CALL ChangePlayer_Loop | Call ChangePlayer_Loop. | ||
And this is the active sprites.
|
||||
43165 | LD HL,24720 | HL=24720. | ||
43168 | LD DE,25152 | DE=25152. | ||
43171 | LD BC,288 | BC=288 (counter). | ||
This is identical to the copier routine above, except it uses BC for the counter and not only B.
|
||||
ChangePlayer_Loop | 43174 | PUSH BC | Stash BC on the stack. | |
43175 | LD A,(DE) | A=fetch byte from DE. | ||
43176 | LD C,(HL) | C=fetch byte from HL. | ||
43177 | LD (HL),A | Write the byte from DE to HL, and the byte from HL to DE. | ||
43178 | LD A,C | |||
43179 | LD (DE),A | |||
43180 | INC HL | Increment HL by one. | ||
43181 | INC DE | Increment DE by one. | ||
43182 | POP BC | Restore BC from the stack. | ||
43183 | DEC BC | Decrease BC by one. | ||
43184 | LD A,B | Jump back to ChangePlayer_Loop until BC is zero. | ||
43185 | OR C | |||
43186 | JR NZ,ChangePlayer_Loop | |||
43188 | RET | Return. | ||
View the equivalent code in;
|
Prev: 43084 | Up: Map | Next: 43189 |