Prev: 43559 Up: Map Next: 43668
43575: Build Carried Item Graphic
Used by the routines at RunFrame and BeginLife.
Builds the graphic of the item that is carried by the ship in the buffer at ShipWorkArea_Carried (six bytes to a row) and clears the part of the screen beside the ship where the item will be drawn. Each byte of the sprite of the item is looked up in the shift table at CopyGameDown and combined with the buffer using XOR.
BuildCarriedItemGraphic 43575 LD HL,44923 The sprite tables.
43578 LD A,(51460) The item the ship is about to pick up.
43581 AND %00001111 Keep the bits of A that are set in 15.
43583 LD C,A C=A.
43584 CALL GetTableEntry Call GetTableEntry.
43587 EX DE,HL Swap DE and HL.
43588 LD A,(DE) Read DE.
43589 LD B,A B=A.
43590 LD (23583),A The width of the carried item.
43593 INC DE Advance DE.
43594 LD A,(DE) Read DE.
43595 LD (23584),A Update the segments still to draw.
43598 LD C,A C=A.
43599 LD HL,63162 The carried picture in the ship work area.
BuildCarriedItemGraphic_Row 43602 PUSH HL Stash HL on the stack.
BuildCarriedItemGraphic_Column 43603 PUSH BC Stash BC on the stack.
43604 LD B,252 B=252.
43606 INC DE Advance DE.
43607 LD A,(DE) Read DE.
43608 LD C,A C=A.
43609 LD A,(BC) Read BC.
43610 XOR (HL) Flip the bits of A that are set in the byte at HL.
43611 LD (HL),A Write A where HL points.
43612 INC B Advance B.
43613 INC HL Advance HL.
43614 LD A,(BC) Read BC.
43615 XOR (HL) Flip the bits of A that are set in the byte at HL.
43616 LD (HL),A Write A where HL points.
43617 POP BC Bring BC back off the stack.
43618 DJNZ BuildCarriedItemGraphic_Column Decrease B and jump to BuildCarriedItemGraphic_Column until none remain.
43620 POP HL Bring HL back off the stack.
43621 LD A,(23583) The width of the carried item.
43624 LD B,A B=A.
43625 LD A,6 A=6.
43627 CALL AddAToHL Call AddAToHL.
43630 DEC C Step C back.
43631 JR NZ,BuildCarriedItemGraphic_Row Jump to BuildCarriedItemGraphic_Row if the zero flag is clear.
43633 LD HL,(51458) Fetch the word at 51458 into HL.
43636 CALL GetScreenAddress Call GetScreenAddress.
43639 LD A,(23584) The segments still to draw.
43642 LD B,A B=A.
43643 INC L Advance L.
BuildCarriedItemGraphic_Clear 43644 LD (HL),0 Store 0 at the address in HL.
43646 INC L Advance L.
43647 LD (HL),0 Store 0 at the address in HL.
43649 INC L Advance L.
43650 LD (HL),0 Store 0 at the address in HL.
43652 INC L Advance L.
43653 LD (HL),0 Store 0 at the address in HL.
43655 DEC L Step L back.
43656 DEC L Step L back.
43657 DEC L Step L back.
43658 CALL MoveUpARow Call MoveUpARow.
43661 DJNZ BuildCarriedItemGraphic_Clear Decrease B and jump to BuildCarriedItemGraphic_Clear until none remain.
43663 LD A,(23612) The scroll-in flag.
43666 AND A Return if A is not zero.
43667 RET NZ
Continue on to AttachItemToShip.
Prev: 43559 Up: Map Next: 43668