Routines |
Prev: A84C | Up: Map | Next: A8B5 |
This routine "swaps" the data between DE and HL.
These are all the player states.
|
||||
ChangePlayer | A880 | LD HL,$5EA0 | HL=ActivePlayer_Level. | |
A883 | LD DE,$5EA4 | DE=InactivePlayer_Level. | ||
A886 | LD B,$04 | B=04 (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 | A888 | LD A,(DE) | A=fetch byte from DE. | |
A889 | LD C,(HL) | C=fetch byte from HL. | ||
A88A | LD (HL),A | Write the byte from DE to HL, and the byte from HL to DE. | ||
A88B | LD A,C | |||
A88C | LD (DE),A | |||
A88D | INC HL | Increment HL by one. | ||
A88E | INC DE | Increment DE by one. | ||
A88F | DJNZ ChangePlayer_States | Decrease counter by one and loop back to ChangePlayer_States until counter is zero. | ||
This is the current terrain buffer data.
|
||||
A891 | LD HL,$7000 | HL=TerrainData_Active. | ||
A894 | LD DE,$7400 | DE=TerrainData_Inactive. | ||
A897 | LD BC,$0400 | BC=0400 (counter). | ||
A89A | CALL ChangePlayer_Loop | Call ChangePlayer_Loop. | ||
And this is the active sprites.
|
||||
A89D | LD HL,$6090 | HL=6090. | ||
A8A0 | LD DE,$6240 | DE=6240. | ||
A8A3 | LD BC,$0120 | BC=0120 (counter). | ||
This is identical to the copier routine above, except it uses BC for the counter and not only B.
|
||||
ChangePlayer_Loop | A8A6 | PUSH BC | Stash BC on the stack. | |
A8A7 | LD A,(DE) | A=fetch byte from DE. | ||
A8A8 | LD C,(HL) | C=fetch byte from HL. | ||
A8A9 | LD (HL),A | Write the byte from DE to HL, and the byte from HL to DE. | ||
A8AA | LD A,C | |||
A8AB | LD (DE),A | |||
A8AC | INC HL | Increment HL by one. | ||
A8AD | INC DE | Increment DE by one. | ||
A8AE | POP BC | Restore BC from the stack. | ||
A8AF | DEC BC | Decrease BC by one. | ||
A8B0 | LD A,B | Jump back to ChangePlayer_Loop until BC is zero. | ||
A8B1 | OR C | |||
A8B2 | JR NZ,ChangePlayer_Loop | |||
A8B4 | RET | Return. | ||
View the equivalent code in;
|
Prev: A84C | Up: Map | Next: A8B5 |