Prev: EC5C Up: Map Next: ECF5
ECBC: Action 5 EARN(x). Pay the current character amount in offset x
HL Pointer to the data for this action.
ECBC LD E,(HL) Get the next byte as the ID for earnings and put it in DE.
ECBD INC HL
ECBE LD D,$00
ECC0 PUSH HL Remember the current position in the buffer.
ECC1 LD HL,$EC5C Point HL at the start of the money lookup table. (EC5C)
ECC4 ADD HL,DE Add the ID multiplied by 3 to get to the right address.
ECC5 ADD HL,DE
ECC6 ADD HL,DE
ECC7 LD A,(HL) Get the ID.
ECC8 OR A Is it zero? ie: money not collected
ECC9 JR NZ,$ECF1 Jump forward if not.
Allocate the money to the current character.
ECCB LD (HL),$01 Set the money as collected.
ECCD INC HL Move to the next position in the buffer.
ECCE LD A,(IY-$0A) Get the current player's earnings (tens portion).
ECD1 ADD A,(HL) Add the next tens value to the current player's total.
ECD2 DAA Adjust to give an appropriate value in decimal.
ECD3 LD (IY-$0A),A Set that as the new tens value.
ECD6 INC HL Move to the next position in the buffer.
ECD7 LD A,(IY-$1E) Get the current player's earnings (hundreds portion).
ECDA ADC A,(HL) Add the next hundreds value to the current player's total, including any overflow from the tens portion.
ECDB DAA Adjust to give an appropriate value in decimal.
ECDC LD (IY-$1E),A Set that as the new hundreds value.
Now update the grand total for all players.
ECDF DEC HL Move back to point at the tens portion.
ECE0 LD A,($ECFF) Get the tens portion for the current total.
ECE3 ADD A,(HL) Add the next tens value.
ECE4 DAA Adjust for decimal.
ECE5 LD ($ECFF),A Set the new tens portion.
ECE8 INC HL Move to point at the hundreds portion.
ECE9 LD A,($ECFE) Get the hundreds portion for the current total.
ECEC ADC A,(HL) Add the next hundreds total.
ECED DAA Adjust for decimal.
ECEE LD ($ECFE),A Set the new hunderds portion.
ECF1 POP HL Restore the current position in the buffer.
ECF2 JP $EAEB Jump forward to execute more actions.
Prev: EC5C Up: Map Next: ECF5