Prev: 7EA8 Up: Map Next: 7EFF
7EBA: Give A of the sentences just said to the character in TARGET
Used by the routine at DO_TALK.
The sentences waiting in ORDERS -- ORDER_COUNT of them, marked $FF -- are given to the character in turn, as many as A says, and the rest are thrown away.
Input
A How many to give
ASSIGN_ORDERS 7EBA PUSH BC
7EBB PUSH IX
7EBD PUSH DE
7EBE LD B,A No more than there are; C = how many are left over
7EBF LD A,(ORDER_COUNT)
7EC2 LD C,A
7EC3 CP B
7EC4 JR NC,ASSIGN_ORDERS_0
7EC6 LD B,A
ASSIGN_ORDERS_0 7EC7 LD A,C
7EC8 SUB B
7EC9 LD C,A
7ECA LD IX,ENDINGS The next A waiting are the character's
7ECE LD DE,$0019
7ED1 XOR A
7ED2 CP B
7ED3 JR Z,ASSIGN_ORDERS_2
ASSIGN_ORDERS_1 7ED5 ADD IX,DE
7ED7 LD A,(IX+$00)
7EDA CP $FF
7EDC JR NZ,ASSIGN_ORDERS_1
7EDE LD A,(TARGET)
7EE1 LD (IX+$00),A
7EE4 DJNZ ASSIGN_ORDERS_1
ASSIGN_ORDERS_2 7EE6 LD B,C The rest are thrown away
7EE7 XOR A
7EE8 CP B
7EE9 JR Z,ASSIGN_ORDERS_4
ASSIGN_ORDERS_3 7EEB ADD IX,DE
7EED LD A,(IX+$00)
7EF0 CP $FF
7EF2 JR NZ,ASSIGN_ORDERS_3
7EF4 LD (IX+$00),$00
7EF8 DJNZ ASSIGN_ORDERS_3
ASSIGN_ORDERS_4 7EFA POP DE
7EFB POP IX
7EFD POP BC
7EFE RET
Prev: 7EA8 Up: Map Next: 7EFF