Prev: D408 Up: Map Next: D4E8
D409: Write Scene To Shadow Buffer
Used by the routines at RunHandlers, SelectionScreen and Handler_TickerNews.
WriteSceneToShadowBuffer D409 LD BC,$0000 BC=0000.
Self-modifying code. These lines populate the value for a LoaD command below. The values relate to areas of the shadow screen buffer:
D40C LD A,$6B Write 6B to:
D40E LD ($D475),A
D411 LD ($D4B6),A
D414 CALL WriteSceneToShadowBuffer_Loop_1 Call WriteSceneToShadowBuffer_Loop_1.
D417 LD A,$73 Write 73 to:
D419 LD ($D475),A
D41C LD ($D4B6),A
D41F CALL WriteSceneToShadowBuffer_Loop_1 Call WriteSceneToShadowBuffer_Loop_1.
D422 LD A,$7B Write 7B to:
D424 LD ($D475),A
D427 LD ($D4B6),A
WriteSceneToShadowBuffer_Loop_1 D42A LD A,$89 A=89.
D42C EX AF,AF' Exchange the AF register with the shadow AF register.
D42D LD A,B A=B.
D42E ADD A,$68 A+=68.
D430 LD H,A H=A.
D431 LD L,C L=C.
D432 LD D,$00 D=00.
D434 LD A,(HL) Jump to WriteSceneToShadowBuffer_Loop_3 if *HL is zero.
D435 AND A
D436 JP Z,WriteSceneToShadowBuffer_Loop_3
D439 LD (HL),D Write D to *HL.
D43A LD A,$60 Write 60 to *D220.
D43C LD ($D220),A
D43F DEC H Decrease H by three.
D440 DEC H
D441 DEC H
D442 LD A,(HL) Jump to WriteSceneToShadowBuffer_Loop_2 if *HL is not zero.
D443 AND A
D444 JP NZ,WriteSceneToShadowBuffer_Loop_2
D447 LD A,$20 Write 20 to *D220.
D449 LD ($D220),A
D44C DEC H Decrease H by three.
D44D DEC H
D44E DEC H
D44F LD A,(HL) Jump to WriteSceneToShadowBuffer_Loop_2 if *HL is not zero.
D450 AND A
D451 JP NZ,WriteSceneToShadowBuffer_Loop_2
D454 XOR A Write 00 to *D220.
D455 LD ($D220),A
D458 DEC H Decrease H by three.
D459 DEC H
D45A DEC H
D45B LD A,$86 A=86.
D45D EX AF,AF' Exchange the AF register with the shadow AF register.
D45E LD A,(HL) A=*HL.
WriteSceneToShadowBuffer_Loop_2 D45F AND %01111111 Keep only bits 0-6.
D461 LD E,A E=A.
D462 LD A,(HL) A=*HL.
D463 LD ($D222),A Write A to *D222.
D466 LD H,D H=D.
D467 LD L,E L=E.
D468 ADD HL,HL HL*=08+DE.
D469 ADD HL,HL
D46A ADD HL,HL
D46B ADD HL,DE
D46C CP $80 Jump to WriteSceneToShadowBuffer_0 if A is higher than 80.
D46E JP NC,WriteSceneToShadowBuffer_0
D471 CALL $D4E8 Call D4E8.
The value here is self-modified at:
Location Byte Set
D40C 6B
D417 73
D422 7B
D474 LD D,$00 D=00 (as above).
D476 LD A,(HL) A=*HL.
D477 LD (DE),A Write A to *DE.
D478 INC HL Increment HL by one.
D479 INC D Increment D by one.
D47A LD A,(HL) A=*HL.
D47B LD (DE),A Write A to *DE.
D47C INC HL Increment HL by one.
D47D INC D Increment D by one.
D47E LD A,(HL) A=*HL.
D47F LD (DE),A Write A to *DE.
D480 INC HL Increment HL by one.
D481 INC D Increment D by one.
D482 LD A,(HL) A=*HL.
D483 LD (DE),A Write A to *DE.
D484 INC HL Increment HL by one.
D485 INC D Increment D by one.
D486 LD A,(HL) A=*HL.
D487 LD (DE),A Write A to *DE.
D488 INC HL Increment HL by one.
D489 INC D Increment D by one.
D48A LD A,(HL) A=*HL.
D48B LD (DE),A Write A to *DE.
D48C INC HL Increment HL by one.
D48D INC D Increment D by one.
D48E LD A,(HL) A=*HL.
D48F LD (DE),A Write A to *DE.
D490 INC HL Increment HL by one.
D491 INC D Increment D by one.
D492 LD A,(HL) A=*HL.
D493 LD (DE),A Write A to *DE.
WriteSceneToShadowBuffer_Loop_3 D494 INC C Increment C by one.
D495 JP NZ,WriteSceneToShadowBuffer_Loop_1 Jump to WriteSceneToShadowBuffer_Loop_1 if {} is not zero.
D498 INC B Increment B by one.
D499 RET Return.
WriteSceneToShadowBuffer_0 D49A CALL $D4E8 Call D4E8.
D49D PUSH BC Stash BC on the stack.
D49E LD A,C A=C.
D49F EXX Switch to the shadow registers.
D4A0 LD C,A C=A.
D4A1 EX AF,AF' Exchange the AF register with the shadow AF register.
D4A2 XOR C Reset the bits from C.
D4A3 AND %00000011 Keep only bits 0-1.
D4A5 LD C,A C=A.
D4A6 ADD A,A A*=08+C.
D4A7 ADD A,A
D4A8 ADD A,A
D4A9 ADD A,C
D4AA LD B,$00 B=00.
D4AC LD C,A C=A.
D4AD LD HL,$8B40 HL=8B40.
D4B0 ADD HL,BC HL+=BC.
D4B1 INC L Increment L by one.
D4B2 PUSH HL Stash HL on the stack.
D4B3 EXX Switch back to the normal registers.
D4B4 POP BC Restore BC from the stack.
The value here is self-modified at:
Location Byte Set
D40C 6B
D417 73
D422 7B
D4B5 LD D,$00 D=00 (as above).
D4B7 LD A,(BC) A=*BC.
D4B8 OR (HL) Set the bits from *HL.
D4B9 LD (DE),A Write A to *DE.
D4BA INC HL Increment HL by one.
D4BB INC BC Increment BC by one.
D4BC INC D Increment D by one.
D4BD LD A,(BC) A=*BC.
D4BE OR (HL) Set the bits from *HL.
D4BF LD (DE),A Write A to *DE.
D4C0 INC HL Increment HL by one.
D4C1 INC BC Increment BC by one.
D4C2 INC D Increment D by one.
D4C3 LD A,(BC) A=*BC.
D4C4 OR (HL) Set the bits from *HL.
D4C5 LD (DE),A Write A to *DE.
D4C6 INC HL Increment HL by one.
D4C7 INC BC Increment BC by one.
D4C8 INC D Increment D by one.
D4C9 LD A,(BC) A=*BC.
D4CA OR (HL) Set the bits from *HL.
D4CB LD (DE),A Write A to *DE.
D4CC INC HL Increment HL by one.
D4CD INC BC Increment BC by one.
D4CE INC D Increment D by one.
D4CF LD A,(BC) A=*BC.
D4D0 OR (HL) Set the bits from *HL.
D4D1 LD (DE),A Write A to *DE.
D4D2 INC HL Increment HL by one.
D4D3 INC BC Increment BC by one.
D4D4 INC D Increment D by one.
D4D5 LD A,(BC) A=*BC.
D4D6 OR (HL) Set the bits from *HL.
D4D7 LD (DE),A Write A to *DE.
D4D8 INC HL Increment HL by one.
D4D9 INC BC Increment BC by one.
D4DA INC D Increment D by one.
D4DB LD A,(BC) A=*BC.
D4DC OR (HL) Set the bits from *HL.
D4DD LD (DE),A Write A to *DE.
D4DE INC HL Increment HL by one.
D4DF INC BC Increment BC by one.
D4E0 INC D Increment D by one.
D4E1 LD A,(BC) A=*BC.
D4E2 OR (HL) Set the bits from *HL.
D4E3 LD (DE),A Write A to *DE.
D4E4 POP BC Restore BC from the stack.
D4E5 JP WriteSceneToShadowBuffer_Loop_3 Jump to WriteSceneToShadowBuffer_Loop_3.
Prev: D408 Up: Map Next: D4E8