Prev: 32886 Up: Map Next: 33100
32895: Process command to communicate
Used by the routine at 55726.
32895 LD A,(23700) Load B with USS Pisces' current location...
32898 LD B,A ...
32899 LD HL,48004 Point HL at start of planets' "REQUEST HELP" strings
32902 CALL 54269 Advance HL to "REQUEST HELP" string for current location
32905 LD A,(HL) Load first byte of data (usually height of text) into A...
32906 OR A ...and if this zero (i.e. the current location is not valid for communication)...
32907 JP Z,55298 ...then display "THERE IS NOBODY WITHIN SUB-SPACE COMMUNICATOR RANGE" window (12) and return to game
32910 CALL 54333 Print or update command summary window at top of screen
32913 LD DE,42180 Point DE at "COMMUNICATE WITH"...
32916 CALL 54283 ...and print in command summary window at top of screen
32919 LD HL,42191 Point HL at "CHOOSE COMMUNICATION" menu text
32922 LD DE,37091 Adjust height of main menu (game) / "choose communication" window to accommodate text...
32925 CALL 33774 ...
32928 PUSH HL Store HL (pointer to start of text to print)
32929 XOR A Draw "choose communication" menu window...
32930 CALL 34982 ...
32933 POP HL Restore HL (pointer to start of text to print)
32934 CALL 34762 Print text to screen
32937 CALL 35296 Process keyboard / joystick input on a menu and load A with selected item index
32940 LD (32984),A Store index of selected menu item as operand of instruction at 32983...
32943 LD B,A ...and load into B
32944 LD HL,42300 Point HL at "REQUEST HELP" text
32947 CALL 54269 Advance HL to "REFUEL STARSHIP" text if refuel option was selected
32950 EX DE,HL Swap HL and DE (DE now points to "REQUEST HELP" or "REFUEL STARSHIP" text)...
32951 CALL 54283 ...and print in command summary window at top of screen
32954 CALL 55115 Display execute / reject command window and return here if execute chosen, else exit to main game loop
32957 CALL 33788 If Gordon and Sarab are both asleep then reset zero flag, otherwise increase their happiness by five if not
32960 JP NZ,55291 If zero flag is reset then display "GORDON AND SARAB ARE BOTH ASLEEP" window (12) and return to game
32963 LD A,27 If Magic Knight is wearing the Gas Mask (27)...
32965 CALL 33640 ...
32968 JP Z,55327 ...then display "GORDON AND SARAB CANNOT UNDERSTAND YOU" window (12) and return to game
32971 LD A,1 Set draw-communicate-window-face flag...
32973 LD (23461),A ...
32976 CALL 27765 Draw Magic Knight's current room, draw objects and characters and initialise room-specific data
32979 XOR A Reset draw-communicate-window-face flag...
32980 LD (23461),A ...
The operand of the instruction at 32983 represents the index of the option selected from "CHOOSE COMMUNICATION" menu. This is modified by the instruction at 32940.
32983 LD A,0 Load A with selected menu option index
32985 CP 1 If "REFUEL STARSHIP" was selected...
32987 JP Z,33019 ...then skip ahead to 33019
Request help option selected
32990 LD A,(23700) Load B with index of USS Pisces' current location...
32993 LD B,A ...
32994 LD HL,48004 Point HL at start of planets' "REQUEST HELP" strings
32997 CALL 54269 Advance HL to B-th entry in this list
33000 LD DE,37211 Adjust height of window 15 to accommodate text...
33003 CALL 33774 ...
33006 PUSH HL Store HL (pointer to start of text to print)
33007 LD A,15 Draw window 15...
33009 CALL 34990 ...
33012 POP HL Restore HL (pointer to start of text to print)
33013 CALL 34762 Print text to screen
33016 JP 29479 Display "PRESS FIRE TO CONTINUE" window and wait for input and return to main game loop
Refuel starship option selected
33019 LD A,1 Draw window 1...
33021 CALL 34990 ...
33024 LD HL,42216 Point HL at "REFUEL STARSHIP REQUESTED" text...
33027 CALL 34762 ...and print to screen
33030 LD A,(23700) Load BC with double index of USS Pisces' current location...
33033 ADD A,A ...
33034 LD C,A ...
33035 LD B,0 ...
33037 LD HL,25397 Point HL at start of current planetary data...
33040 ADD HL,BC ...and add BC as offset
33041 LD B,200 Load B with 200 (as USS Pisces can hold 200 units of fuel)
33043 LD A,(HL) Load A with current location's available fuel level...
33044 OR A ...and if this is zero...
33045 JP Z,33084 ...then skip ahead to 33084
33048 CP 255 If available fuel level is 255 (i.e. unlimited)...
33050 JP Z,33072 ...then skip ahead to 33072
33053 LD B,A Load B with current location's available fuel level
33054 LD A,(25013) Load A with USS Pisces' current star drive fuel level
33057 CP 200 If A is 200...
33059 JR Z,33067 ...then skip ahead to 33067
33061 INC A Increase A (USS Pisces' fuel) by one
33062 DEC B Decrease B (planet's fuel) by one
33063 JR Z,33093 If B is zero then skip ahead to 33093
33065 JR 33057 Loop back to 33057
33067 LD (HL),B Store updated (i.e. reduced) value for planet's fuel
33068 LD B,A Load B with USS Pisces' new fuel level
33069 LD HL,42282 Point HL at "THE USS PISCES IS FULLY REFUELED" text...
33072 LD HL,42282 ... (see trivia)
33075 LD A,B Set USS Pisces' new fuel level...
33076 LD (25013),A ...
33079 CALL 34762 Print text to screen
33082 JR 33016 Display "PRESS FIRE TO CONTINUE" window and wait for input and return to main game loop
33084 LD HL,42226 Point HL at "SORRY MAGIC KNIGHT WE ARE OUT OF FUEL" text...
33087 CALL 34762 ...and print to screen
33090 JP 33016 Display "PRESS FIRE TO CONTINUE" window and wait for input and return to main game loop
33093 LD (HL),B Store updated (i.e. zero) value for planet's fuel
33094 LD HL,42240 Point HL at "...WE DO NOT HAVE ENOUGH FUEL..." text
33097 LD B,A Load B with USS Pisces' new fuel level
33098 JR 33075 Jump back to 33075
Prev: 32886 Up: Map Next: 33100