Prev: 34684 Up: Map Next: 34859
34743: AdvanceCursor
Move the cursor one strip row forward (key 6), skipping cells that are not selectable; also holds the retreat handler (key 7) and the action-key dispatch. Cell values steer the movement: >= 82 is header text / empty padding (never a landing spot), 70-81 are two-row fixture labels whose second row must be stepped over.
Used by the routines at 34684, 35814, 36859 and 37493.
34743 CALL 34859 remove the highlight from the current row
34746 LD HL,33683 HL -> cursor position
34749 LD A,(33685) A = cell value the cursor is leaving
34752 CP 70 leaving a two-row fixture label?
34754 JR C,34757
34756 INC (HL) yes: step over its second row too
34757 LD HL,33683
34760 LD A,(HL) A = cursor position
34761 CP 18 already on the last strip row?
34763 JR C,34767
34765 LD A,255 yes: wrap so the INC restarts at row 0
34767 INC A step forward one row
34768 LD (HL),A
34769 LD D,0
34771 LD E,A
34772 LD HL,29630 index CorridorPosTable by the new position
34775 ADD HL,DE
34776 LD A,(HL) A = the cell value there
34777 CP 82 header text / empty padding?
34779 JR NC,34757 yes: not selectable, keep stepping
34781 CALL 34882 highlight the new row, mirror its cell value
34784 CALL 34933 re-place the blinking box if it is a room row
34787 RET
34788 CALL 34859 remove the highlight from the current row
34791 LD A,(33683) A = cursor position
34794 AND A at the top row (0)?
34795 JR NZ,34799
34797 LD A,19 yes: wrap so the DEC restarts at row 18
34799 DEC A step back one row
34800 LD (33683),A
34803 LD D,0
34805 LD E,A
34806 LD HL,29630 index CorridorPosTable by the new position
34809 ADD HL,DE
34810 LD A,(HL) A = the cell value there
34811 CP 82 header text / empty padding?
34813 JR NC,34791 yes: not selectable, keep stepping
34815 CP 70 a two-row fixture label?
34817 JR C,34833 no: done
34819 DEC HL peek at the cell one row up
34820 LD A,(HL)
34821 CP 70 is it also part of a two-row label?
34823 JR C,34833 no: we are already on the first row
34825 CP 82
34827 JR NC,34833
34829 LD HL,33683 we landed on the label's second row:
34832 DEC (HL) back up onto its first row
34833 CALL 34882 highlight the new row, mirror its cell value
34836 CALL 34933 re-place the blinking box if it is a room row
34839 RET
34840 XOR A action key released:
34841 OUT (254),A restore black border
34843 LD HL,33794 RoomDispatchTable
34846 LD A,(31252) A = current room mode
34849 LD E,A
34850 LD D,0
34852 ADD HL,DE
34853 ADD HL,DE HL = table + mode*2
34854 LD A,(HL) fetch the handler address
34855 INC HL
34856 LD H,(HL)
34857 LD L,A
34858 JP (HL) jump to the room's action handler
Prev: 34684 Up: Map Next: 34859