Prev: 40849 Up: Map Next: 41012
40987: Display Poem
Used by the routine at HandlerPoems.
Prints one of the four poems at the bottom of the screen. Which poem is shown depends on how many amulet pieces the player has collected (the number of bits set in the low four bits of 38669): poem 1 for one piece, poem 2 for two pieces, poem 3 for three pieces and poem 4 for all four.
Before After DisplayPoem
display-poem-before display-poem-after
Input
IX Actor record of the player
Count the number of amulet pieces which have been collected.
DisplayPoem 40987 LD A,(IX+11) Fetch the amulet pieces collected from the actor record.
40990 LD BC,1024 Set the amulet piece counter in B to 4 and the number of pieces collected in C to 0.
Poem_CollectCollected_Loop 40993 RRCA Rotate the flag for the next amulet piece into the carry flag.
40994 JR NC,Poem_CollectCollected_Skip Jump to Poem_CollectCollected_Skip if the amulet piece has not been collected.
40996 INC C Count the amulet piece.
Poem_CollectCollected_Skip 40997 DJNZ Poem_CollectCollected_Loop Decrease the amulet piece counter by one and loop back to Poem_CollectCollected_Loop until all four pieces have been checked.
40999 LD A,C Fetch the number of amulet pieces collected.
Choose the poem to display.
41000 DEC A Jump to Poem_1_Reference to show poem 1 if only one amulet piece has been collected.
41001 JR Z,Poem_1_Reference
41003 DEC A Jump to Poem_2_Reference to show poem 2 if two amulet pieces have been collected.
41004 JR Z,Poem_2_Reference
41006 DEC A Jump to Poem_3_Reference to show poem 3 if three amulet pieces have been collected.
41007 JR Z,Poem_3_Reference
Otherwise display poem 4.
41009 LD DE,41275 Point DE at the first message of poem 4 at Poem_4_Copy.
Prev: 40849 Up: Map Next: 41012