Prev: D45C Up: Map Next: D48F
D45E: Highlight Active Doors
Used by the routines at Prep_Display_Phase and Door_Prep_01.
This routine highlights the doors which are currently being displayed in the playarea.
ActiveDoors D45E LD A,($D45C) A=CashboxReference_Inactive.
D461 LD C,$38 C=38 (not highlighted).
D463 CALL ActiveDoors_Start Call ActiveDoors_Start.
D466 LD A,($D45D) A=CashboxReference_Active.
D469 LD C,$3A C=3A (highlighted).
Sets a counter as three doors are highlighted as being "in-view".
ActiveDoors_Start D46B LD B,$03 B=03.
ActiveDoors_Loop D46D PUSH AF Stash AF on the stack.
D46E CALL ActiveDoors_Paint Call ActiveDoors_Paint.
D471 POP AF Restore AF from the stack.
D472 INC A Increment A by one.
D473 CP $0D If A is 0D then call ActiveDoors_SetDoorOne.
D475 CALL NC,ActiveDoors_SetDoorOne
D478 DJNZ ActiveDoors_Loop Decrease the B counter by one and loop back to ActiveDoors_Loop until it is zero.
D47A RET Return.
If the active doors spill over the last door, then cycle back to the beginning. For example, if door 11 is active, then it's 11, 12 and 1 which are highlighted.
ActiveDoors_SetDoorOne D47B LD A,$01 A=01.
D47D RET Return.
Handles writing the attribute value held by C to the screen.
ActiveDoors_Paint D47E CP $07 Is A less than 07?
D480 LD HL,$5805 HL=5805 (left-hand side).
D483 JR NC,ActiveDoors_Paint_Skip If A was less than 07 jump to ActiveDoors_Paint_Skip.
D485 LD HL,$58FF HL=58FF (right-hand side).
ActiveDoors_Paint_Skip D488 ADD A,A HL=HL + A * 02.
D489 ADD A,L
D48A LD L,A
D48B LD (HL),C Writes the attribute value held by C to HL and HL + 01. This is because the number images are two characters wide.
D48C INC HL
D48D LD (HL),C
D48E RET Return.
Prev: D45C Up: Map Next: D48F