Prev: 9F91 Up: Map Next: A034
A01B: 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 970D): 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 A01B LD A,(IX+$0B) Fetch the amulet pieces collected from the actor record.
A01E LD BC,$0400 Set the amulet piece counter in B to 04 and the number of pieces collected in C to 00.
Poem_CollectCollected_Loop A021 RRCA Rotate the flag for the next amulet piece into the carry flag.
A022 JR NC,Poem_CollectCollected_Skip Jump to Poem_CollectCollected_Skip if the amulet piece has not been collected.
A024 INC C Count the amulet piece.
Poem_CollectCollected_Skip A025 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.
A027 LD A,C Fetch the number of amulet pieces collected.
Choose the poem to display.
A028 DEC A Jump to Poem_1_Reference to show poem 1 if only one amulet piece has been collected.
A029 JR Z,Poem_1_Reference
A02B DEC A Jump to Poem_2_Reference to show poem 2 if two amulet pieces have been collected.
A02C JR Z,Poem_2_Reference
A02E DEC A Jump to Poem_3_Reference to show poem 3 if three amulet pieces have been collected.
A02F JR Z,Poem_3_Reference
Otherwise display poem 4.
A031 LD DE,$A13B Point DE at the first message of poem 4 at Poem_4_Copy.
Prev: 9F91 Up: Map Next: A034