| alien | Routines |
| Prev: 34636 | Up: Map | Next: 34967 |
|
Reads the keyboard and moves the corridor cursor. Calls the key-scanner at 34636, which packs five keys into 33682 (set bit = pressed): bit 0 = key 8, bit 1 = key 5, bit 2 = key 7, bit 3 = key 6, bit 4 = key 0 (action). While the action key is held the border flashes yellow/black; on RELEASE control jumps to 34840, which dispatches through RoomDispatchTable (33794) on the current room mode (31252) — this is how a room's action handler / menu is opened. Otherwise: key 6 -> 34743 (advance the cursor along the corridor), key 7 -> 34788 (retreat), and keys 8/5 move between rows when the room view has more than one row (mode != 0).
|
||||||||
| 34684 | CALL 34636 | scan keyboard → 33642 bitmask | ||||||
| 34687 | LD A,(33682) | A = key bitmask (33642) | ||||||
| 34690 | AND A | any key pressed? | ||||||
| 34691 | RET Z | no: return immediately | ||||||
| 34692 | BIT 4,A | action/fire key held? | ||||||
| 34694 | JR Z,34716 | no: check directional keys | ||||||
| 34696 | XOR A | A = 0 (border black) | ||||||
| 34697 | EX AF,AF' | save border colour to A' | ||||||
| 34698 | CALL 34636 | re-scan keyboard (wait for release) | ||||||
| 34701 | LD A,(33682) | read updated key state | ||||||
| 34704 | BIT 4,A | action key still held? | ||||||
| 34706 | JP Z,34840 | released: open the room-action dispatch | ||||||
| 34709 | EX AF,AF' | restore A' border colour | ||||||
| 34710 | XOR 6 | toggle between 0 (black) and 6 (yellow) | ||||||
| 34712 | OUT (254),A | flash border | ||||||
| 34714 | JR 34697 | repeat until key released | ||||||
| 34716 | BIT 3,A | key 6 (advance)? | ||||||
| 34718 | JR NZ,34743 | yes: advance cursor along the corridor | ||||||
| 34720 | BIT 2,A | key 7 (retreat)? | ||||||
| 34722 | JR NZ,34788 | yes: retreat cursor along the corridor | ||||||
| 34724 | AND 3 | key 5 or key 8 (row movement)? | ||||||
| 34726 | RET Z | no directional key: return | ||||||
| 34727 | LD A,(31252) | A = room mode (31252) | ||||||
| 34730 | AND A | mode 0 = single-row corridor (no up/down) | ||||||
| 34731 | RET Z | in single-row mode: up/down keys ignored | ||||||
| 34732 | LD A,(33685) | A = cell value under the cursor ($8395) | ||||||
| 34735 | CP 61 | column 61 = leftmost valid position | ||||||
| 34737 | RET Z | at left wall: cannot move | ||||||
| 34738 | CALL 34743 | move one step (shares forward-move code) | ||||||
| 34741 | JR 34732 | keep moving while at edge | ||||||
|
This entry point is used by the routines at 35578, 36859 and 37490.
|
||||||||
| 34743 | CALL 34859 | |||||||
| 34746 | LD HL,33683 | |||||||
| 34749 | LD A,(33685) | |||||||
| 34752 | CP 70 | |||||||
| 34754 | JR C,34757 | |||||||
| 34756 | INC (HL) | |||||||
| 34757 | LD HL,33683 | |||||||
| 34760 | LD A,(HL) | |||||||
| 34761 | CP 18 | |||||||
| 34763 | JR C,34767 | |||||||
| 34765 | LD A,255 | |||||||
| 34767 | INC A | |||||||
| 34768 | LD (HL),A | |||||||
| 34769 | LD D,0 | |||||||
| 34771 | LD E,A | |||||||
| 34772 | LD HL,29630 | |||||||
| 34775 | ADD HL,DE | |||||||
| 34776 | LD A,(HL) | |||||||
| 34777 | CP 82 | |||||||
| 34779 | JR NC,34757 | |||||||
| 34781 | CALL 34882 | |||||||
| 34784 | CALL 34933 | |||||||
| 34787 | RET | |||||||
| 34788 | CALL 34859 | |||||||
| 34791 | LD A,(33683) | |||||||
| 34794 | AND A | |||||||
| 34795 | JR NZ,34799 | |||||||
| 34797 | LD A,19 | |||||||
| 34799 | DEC A | |||||||
| 34800 | LD (33683),A | |||||||
| 34803 | LD D,0 | |||||||
| 34805 | LD E,A | |||||||
| 34806 | LD HL,29630 | |||||||
| 34809 | ADD HL,DE | |||||||
| 34810 | LD A,(HL) | |||||||
| 34811 | CP 82 | |||||||
| 34813 | JR NC,34791 | |||||||
| 34815 | CP 70 | |||||||
| 34817 | JR C,34833 | |||||||
| 34819 | DEC HL | |||||||
| 34820 | LD A,(HL) | |||||||
| 34821 | CP 70 | |||||||
| 34823 | JR C,34833 | |||||||
| 34825 | CP 82 | |||||||
| 34827 | JR NC,34833 | |||||||
| 34829 | LD HL,33683 | |||||||
| 34832 | DEC (HL) | |||||||
| 34833 | CALL 34882 | |||||||
| 34836 | CALL 34933 | |||||||
| 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) | |||||||
| 34855 | INC HL | |||||||
| 34856 | LD H,(HL) | |||||||
| 34857 | LD L,A | |||||||
| 34858 | JP (HL) | jump to the room's action handler | ||||||
|
UnhighlightMenuRow: undo the cursor highlight — restore the saved attribute (SavedRowAttr) on the row under the cursor; two rows when the cell value is >= 70 (first word of a two-row label).
|
||||||||
| 34859 | LD A,(33683) | A = cursor row | ||||||
| 34862 | CALL 34920 | HL = its attribute address | ||||||
| 34865 | LD A,(33685) | cell value >= 70 (two-row label)? | ||||||
| 34868 | LD C,1 | |||||||
| 34870 | CP 70 | |||||||
| 34872 | JR C,34875 | |||||||
| 34874 | INC C | yes: restore two rows | ||||||
| 34875 | LD A,(33684) | repaint the saved attribute | ||||||
| 34878 | CALL 31612 | |||||||
| 34881 | RET | |||||||
|
This entry point is used by the routines at 31577, 31634, 35290 and 35578. HighlightMenuRow: mirror the CorridorPosTable cell under the cursor into CursorCellValue ($8395), save the attribute under the cursor row into SavedRowAttr, then paint the row bright white (attr 120) — two rows when the cell value is >= 70 (two-row label).
|
||||||||
| 34882 | LD A,(33683) | A = cursor row | ||||||
| 34885 | PUSH AF | |||||||
| 34886 | LD E,A | |||||||
| 34887 | LD D,0 | |||||||
| 34889 | LD HL,29630 | |||||||
| 34892 | ADD HL,DE | |||||||
| 34893 | LD A,(HL) | A = cell value under the cursor | ||||||
| 34894 | LD (33685),A | mirror it for the dispatchers | ||||||
| 34897 | EX AF,AF' | keep the cell value in A' | ||||||
| 34898 | POP AF | |||||||
| 34899 | CALL 34920 | HL = the row's attribute address | ||||||
| 34902 | LD A,(HL) | |||||||
| 34903 | LD (33684),A | save the attribute for the un-highlight | ||||||
| 34906 | EX AF,AF' | cell value >= 70 (two-row label)? | ||||||
| 34907 | LD C,1 | |||||||
| 34909 | CP 70 | |||||||
| 34911 | JR C,34914 | |||||||
| 34913 | INC C | yes: highlight two rows | ||||||
| 34914 | LD A,120 | bright white paper, black ink | ||||||
| 34916 | CALL 31612 | |||||||
| 34919 | RET | |||||||
|
GetMenuRowAttrAddr: HL = attribute address of menu row A — the strip rows sit on screen rows 1-19, columns 22-31, so row 0 -> $5836 (22582) and each further row adds 32.
|
||||||||
| 34920 | LD HL,22582 | attr addr of menu row 0 (screen row 1, col 22) | ||||||
| 34923 | AND A | |||||||
| 34924 | RET Z | |||||||
| 34925 | LD DE,32 | |||||||
| 34928 | LD B,A | |||||||
| 34929 | ADD HL,DE | +32 per row | ||||||
| 34930 | DJNZ 34929 | |||||||
| 34932 | RET | |||||||
|
UpdateRoomMarkerB: cursor-move hook, called from HandleInput's cursor handlers. Erases the blinking candidate-room box (marker channel B), then, in the room view only, re-places it if the row now under the cursor is a room (an exit row, value < 34) that lies on the deck currently shown in the map pane.
|
||||||||
| 34933 | CALL 35146 | erase/freeze marker channel B | ||||||
| 34936 | LD A,(31252) | room view (mode 1)? | ||||||
| 34939 | CP 1 | |||||||
| 34941 | RET NZ | no: done | ||||||
| 34942 | LD A,(33685) | cell under the cursor a room id? | ||||||
| 34945 | CP 34 | |||||||
| 34947 | RET NC | no: done | ||||||
| 34948 | LD E,A | |||||||
| 34949 | LD D,0 | |||||||
| 34951 | LD HL,29905 | RoomTypeTable[room] | ||||||
| 34954 | ADD HL,DE | |||||||
| 34955 | LD A,(31243) | on the deck currently displayed? | ||||||
| 34958 | CP (HL) | |||||||
| 34959 | RET NZ | no: done | ||||||
| 34960 | LD A,(33685) | yes: blink that room's indicator box | ||||||
| 34963 | CALL 35128 | |||||||
| 34966 | RET | |||||||
| Prev: 34636 | Up: Map | Next: 34967 |