Prev: 26853 Up: Map Next: 27118
26906: Initialise data and start a new game
Used by the routine at 26673.
Input
IY 23610
26906 LD A,(40140) Load input device selection into A
26909 CALL 37857 Change input device based on A
26912 CALL 37816 Clear display file
26915 LD A,70 Flood attribute file with value 70 (yellow INK, black PAPER, BRIGHT)...
26917 LD (23695),A ...
26920 CALL 37841 ...
26923 LD HL,42170 Copy initial characters' stats into "current" (modifiable) slots...
26926 LD DE,25315 ...
26929 LD BC,72 ...
26932 LDIR ...
26934 LD HL,40141 Copy initial Magic Knight properties (position) into "current" (modifiable) slots...
26937 LD BC,8 ...
26940 LDIR ...
26942 LD HL,41017 Copy initial characters' inventories into "current" (modifiable) slots...
26945 LD BC,45 ...
26948 LDIR ...
26950 LD HL,41062 Copy initial characters' positions into "current" (modifiable) slots...
26953 LD BC,24 ...
26956 LDIR ...
26958 LD HL,41086 Copy initial objects' locations into "current" (modifiable) slots (at 25464)...
26961 LD BC,150 ...
26964 LDIR ...
26966 XOR A Set A to zero
26967 LD (23675),A Reset interrupt routine flags
26970 LD (23676),A Store zero at 23676 (see trivia)
26973 LD (23382),A Set lift control panel to display R as current floor
26976 LD (41713),A Set left-hand exit of the left-most Roof Garden room to lead to the lift
26979 INC A Set right-hand exit of the lift to lead to the Roof Garden (i.e. move the lift to the roof)...
26980 LD (41712),A ...
26983 LD A,255 Set left-hand exits of left-most rooms on all other floors to be inaccessible (i.e. lift isn't there!)...
26985 LD (41729),A ...4th Floor...
26988 LD (41745),A ...3rd Floor...
26991 LD (41761),A ...2nd Floor...
26994 LD (41777),A ...1st Floor...
26997 LD (41793),A ...Ground Floor...
27000 LD (41809),A ...and Basement
27003 CALL 35495 Set Magic Knight's available action flags
27006 XOR A Set A to zero
27007 LD (23560),A Clear last pressed key (LAST K system variable)
27010 LD (23484),A Set unused memory address to zero
27013 LD (23407),A Set number of 1/50 seconds elapsed to zero
27016 LD H,A Load HL with zero...
27017 LD L,A ...
27018 LD (23405),HL Set number of minutes elapsed to zero
27021 LD (23672),A Set frame counter to zero...
27024 LD (23673),HL ...
27027 INC A Set A to 1
27028 LD (25307),A Set Gimbal's current slot to 1
27031 LD (65528),A Set temporary store for Magic Knight's frame number to zero
27034 LD (23505),A Set animate-Magic-Knight's-puff-of-smoke-appearance-on-next-room-redraw flag
27037 LD A,48 Set number of hours left...
27039 LD (23404),A ...
27042 LD A,127 Set Gimbal's current attribute to 127 (white INK, white PAPER, BRIGHT)...
27044 LD (29939),A ...
27047 LD A,139 Set read-text property of the Crystal Ball to 139...
27049 LD (42292),A ...
27052 LD HL,25443 Point HL at Thor's current position
27055 LD BC,1791 Load B with 6 and C with 255
27058 INC C Increase C (current character index)
27059 PUSH BC Store B and C
27060 LD B,C Copy C into B
27061 LD C,(HL) Load character's screen number into C
27062 PUSH HL Store HL
27063 CALL 36327 Assign a slot in room C to character B and get x- and y-coordinates in BC
27066 POP HL Restore HL
27067 INC HL Advance HL to character's x-coordinate
27068 LD (HL),C Update current x-coordinate based upon position of assigned slot
27069 INC HL Advance HL to character's y-coordinate
27070 LD (HL),B Update current y-coordinate based upon position of assigned slot
27071 INC HL Advance HL to start of next character's data
27072 POP BC Restore B and C
27073 DJNZ 27058 Repeat loop for next character
27075 LD A,69 Assign an attribute of 69 (cyan INK, black PAPER, BRIGHT) to...
27077 LD (42360),A ...Broken Glass...
27080 LD (42640),A ...and Teleport Pad
27083 LD L,41 Set room layout pointer for "The Wall" to 53289...
27085 LD H,208 ...
27087 LD (51971),HL ...
27090 LD HL,33565 Point HL at start of character summoning sequence to return them home
27093 LD (23503),HL Store this at 23503
27096 LD A,9 Make right-wall in Secret Tunnel Entrance height 9 (i.e. full height of room)...
27098 LD (53598),A ...
27101 LD A,8 Set character whose turn it is to move to Banshee (8)...
27103 LD (55218),A ...
27106 LD A,21 Load A with 21 (The Start Room)
27108 CALL 27865 Move Magic Knight into room A, initialise room-specific data and draw room
27111 SET 0,(IY+65) Set update-game-time-and-locate-arrow-glow flag
27115 JP 27189 Jump into main game loop (process keyboard input and move Magic Knight, enter menus or execute other command)
Prev: 26853 Up: Map Next: 27118