Prev: 53310 Up: Map Next: 53428
53323: Copy Buffer To Screen
Used by the routine at CopyBufferAndClear.
Copies PlayfieldBuffer to the screen, from the bottom row up. Each row copies 22 bytes. In the town the copy sits beside the panel.
copy-buffer
Keep the stack pointer, and point it at the playfield on the screen.
CopyBufferToScreen 53323 LD (41501),SP Set SavedStackPointer.
53327 LD HL,20443 Point HL at 20443 (in the screen buffer).
Move it to the right in the town.
53330 CALL AddTownOffsetToHL Call AddTownOffsetToHL.
53333 LD SP,HL Point the stack pointer at it.
53334 LD B,112 Set a count of 112 rows.
53336 LD HL,55042 Point HL at PlayfieldBuffer_FirstRowEnd.
Copy a row from the buffer to the screen.
CopyBufferToScreen_Row 53339 LD D,(HL) Copy eleven words of the row, working backwards.
53340 DEC HL
53341 LD E,(HL)
53342 DEC HL
53343 PUSH DE
53344 LD D,(HL)
53345 DEC HL
53346 LD E,(HL)
53347 DEC HL
53348 PUSH DE
53349 LD D,(HL)
53350 DEC HL
53351 LD E,(HL)
53352 DEC HL
53353 PUSH DE
53354 LD D,(HL)
53355 DEC HL
53356 LD E,(HL)
53357 DEC HL
53358 PUSH DE
53359 LD D,(HL)
53360 DEC HL
53361 LD E,(HL)
53362 DEC HL
53363 PUSH DE
53364 LD D,(HL)
53365 DEC HL
53366 LD E,(HL)
53367 DEC HL
53368 PUSH DE
53369 LD D,(HL)
53370 DEC HL
53371 LD E,(HL)
53372 DEC HL
53373 PUSH DE
53374 LD D,(HL)
53375 DEC HL
53376 LD E,(HL)
53377 DEC HL
53378 PUSH DE
53379 LD D,(HL)
53380 DEC HL
53381 LD E,(HL)
53382 DEC HL
53383 PUSH DE
53384 LD D,(HL)
53385 DEC HL
53386 LD E,(HL)
53387 DEC HL
53388 PUSH DE
53389 LD D,(HL)
53390 DEC HL
53391 LD E,(HL)
53392 PUSH DE
53393 EX DE,HL Keep the address in the buffer in DE.
Move up one pixel line on the screen.
53394 LD HL,65302 Find the screen address one pixel line up.
53397 ADD HL,SP
53398 LD A,H Test whether it has crossed into the previous character row.
53399 CPL
53400 AND %00000111 Keep the bits for the pixel line.
53402 JP NZ,CopyBufferToScreen_Next Jump to CopyBufferToScreen_Next if it has not.
Move to the previous character row.
53405 LD A,L Subtract 32 from the low byte.
53406 SUB 32
53408 LD L,A
53409 JP C,CopyBufferToScreen_Next Jump to CopyBufferToScreen_Next if that is in the previous third.
53412 LD A,H Add 8 to the high byte.
53413 ADD A,8
53415 LD H,A
Point at the next row.
CopyBufferToScreen_Next 53416 LD SP,HL Point the stack pointer at the new screen address.
53417 LD HL,45 Find the end of the next row in the buffer.
53420 ADD HL,DE
53421 DJNZ CopyBufferToScreen_Row Jump to CopyBufferToScreen_Row.
Restore the stack pointer.
53423 LD SP,(41501) Fetch SavedStackPointer.
53427 RET Return.
View the equivalent code in;
Prev: 53310 Up: Map Next: 53428