![]() |
Routines |
| Prev: 43844 | Up: Map | Next: 43990 |
|
||||||||||||
|
This routine copies the number of bytes given by B, from *HL to *DE, and keeps on looping until a termination character is returned.
|
||||||||||||
| CopyRoomData | 43970 | PUSH BC | Stash the length counter on the stack. | |||||||||
| 43971 | LD A,(HL) | Fetch a byte from the source room data pointer and store it in A. | ||||||||||
|
Have we finished with everything?
|
||||||||||||
| 43972 | CP 255 | If the terminator character (255) has been reached jump to CopyRoomData_Next. | ||||||||||
| 43974 | JR Z,CopyRoomData_Next | |||||||||||
|
Handle copying the data from the source room data to the target room buffer.
|
||||||||||||
| CopyRoomData_Loop | 43976 | LD (DE),A | Write the room data byte to the room buffer target destination. | |||||||||
| 43977 | INC HL | Increment the source room data pointer by one. | ||||||||||
| 43978 | INC DE | Increment the room buffer target destination by one. | ||||||||||
| 43979 | LD A,(HL) | Fetch a byte from the source room data pointer and store it in A. | ||||||||||
| 43980 | DJNZ CopyRoomData_Loop | Decrease the length counter by one and loop back to CopyRoomData_Loop until the length counter is zero. | ||||||||||
|
Refresh the same counter as on entry to the routine and start the process again.
|
||||||||||||
| 43982 | POP BC | Restore the original length counter from the stack. | ||||||||||
| 43983 | JR CopyRoomData | Jump to CopyRoomData. | ||||||||||
|
This cycle is now over, so store the terminator in the room buffer, increment both pointers ready for the next call to this routine and finally, tidy up the stack.
|
||||||||||||
| CopyRoomData_Next | 43985 | LD (DE),A | Write the termination character to the room buffer target destination. | |||||||||
| 43986 | INC DE | Increment the room buffer target destination by one. | ||||||||||
| 43987 | INC HL | Increment the source room data pointer by one. | ||||||||||
| 43988 | POP BC | Housekeeping; discard the length counter from the stack. | ||||||||||
| 43989 | RET | Return. | ||||||||||
| Prev: 43844 | Up: Map | Next: 43990 |