1 " ***********************************************************
  2 " *                                                         *
  3 " * Copyright, (C) Honeywell Bull Inc., 1987                *
  4 " *                                                         *
  5 " * Copyright, (C) Honeywell Information Systems Inc., 1982 *
  6 " *                                                         *
  7 " ***********************************************************
  8 
  9 " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " "
 10 "
 11 " BOOTLOAD_CONSOLE
 12 "
 13 "  console io for collection 0 (bound_bootload_0)
 14 "
 15 "
 16 
 17 " HISTORY COMMENTS:
 18 "  1) change(85-09-09,Farley), approve(85-09-09,MCR6979),
 19 "     audit(86-03-04,GDixon), install(86-03-21,MR12.0-1033):
 20 "      Support IMU and FIPS.
 21 "                                                      END HISTORY COMMENTS
 22 
 23           name      bootload_console
 24 "
 25 "
 26 " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " "
 27 " BIM 1982-08-08
 28 " Modified 830622 for multiple OPC cards, (and consoles)... -E. A. Ranzenbach
 29 " Modified 9/83 for adp by Keith Loepere.
 30 " Modified 840306 for IPC-CONS-2 IDCW I/O... -E. A. Ranzenbach
 31 " Modified June-July 1984 by Paul Farley to get IPC-CONS-2 to work.
 32 " Modified June 1985 by Paul Farley to remove tape mpc reset/mask-connect.
 33 
 34           include   bootload_equs
 35           include   bootload_cpu_macros
 36           include_nolist      make_data_macros
 37           include_nolist      iom_word_macros
 38           include   console_io_commands
 39           include   config_deck
 40           include   config_prph_opc_card
 41           include   coll0_segnos
 42           include   system_types
 43 "^L
 44 
 45 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 46 "
 47 "         tsx2      bootload_console$write
 48 "         arg       line_to_write
 49 "         arg       length_in_chars
 50 "
 51 "
 52 "         tsx2      bootload_console$write_alert
 53 "
 54 "         tsx2      bootload_console$init
 55 "
 56 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 57 
 58 
 59           mod       16
 60           bss       pr_save,16
 61           bss       register_save,8
 62 
 63           segdef    in_bootload_console
 64           bss       in_bootload_console,1
 65 
 66           macro     Centry
 67           Bentry    &F1
 68 
 69           macro     &1_return          " redefine
 70           stz       in_bootload_console
 71           lreg      register_save
 72           lpri      pr_save
 73           Breturn   &<&K,2&[0&;&2&]
 74 &&end
 75 
 76 &1:       Bpush
 77           stc1      in_bootload_console
 78           sreg      register_save
 79           spri      pr_save
 80 &end
 81 
 82 
 83 " WRITE entry begins here
 84 
 85           Centry    write,2
 86 
 87           szn       bootload_info$console_available
 88           tmi       write.okay
 89           write_return
 90 write.okay:
 91 
 92           absa_au   0,x2*               " address of the string
 93           stca      write_ascii_ddcw,70
 94 
 95           lda       1,x2*               " length
 96           ada       3,dl                " round up
 97           ars       2                   " divide by 4, console dont unnerstand
 98                                         " chars.
 99           stca      write_ascii_ddcw,03 " bottom 6 bits is tally.
100 
101           tsx2      bootload_io$connect
102           arg       bootload_info$console_iom_number
103           arg       bootload_info$console_channel_number
104           arg       write_pcw_ptr,*
105           arg       write_dcw_list_ptr,*
106 
107           cana      bootload_info$status_mask
108           tnz       console_write_error                     " x2 destroyed
109 
110           write_return
111 
112 "^L
113 
114 " WRITE_NL
115 
116           Centry    write_nl
117           eax5      0
118           tra       nl_alert_common
119 
120 " WRITE_ALERT entry begins here
121 
122           Centry    write_alert
123           eax5      1
124 nl_alert_common:
125           szn       bootload_info$console_available
126           tmi       write_alert.okay
127           write_alert_return
128 
129 write_alert.okay:
130           cmpx5     1,du
131           tnz       nl
132           tsx2      bootload_io$connect
133           arg       bootload_info$console_iom_number
134           arg       bootload_info$console_channel_number
135           arg       write_alert_pcw_ptr,*
136           arg       write_alert_dcw_list_ptr,*
137 
138           tra       nl_alert.check_status
139 
140 nl:
141           tsx2      bootload_io$connect
142           arg       bootload_info$console_iom_number
143           arg       bootload_info$console_channel_number
144           arg       write_pcw_ptr,*
145           arg       write_nl_dcw_list_ptr,*
146 
147 nl_alert.check_status:
148           cana      bootload_info$status_mask
149           tnz       console_write_error                     " x2 destroyed
150 
151           write_alert_return
152 "^L
153 
154 "
155 " READ_LINE
156 "
157 "         tsx2      bootload_console$read_line
158 "         arg       buffer_to_read_to
159 "         arg       length_to_read
160 "         <return with the goods>
161 
162           equ       read_buffer,0
163           equ       read_length,1
164 
165 " We do not set the "in console package" flag.
166 " thus an error on input will provoke an attempt to
167 " do output for a message, which might even work.
168 
169           Bentry    read_line,2
170 
171 read_line:
172           Bpush
173           epp6      read_buffer,x2*
174           lda       read_length,x2*
175 
176           absa_au   pr6|0               " note the buffer address
177           stca      read_line_ddcw,70
178 
179           lda       1,x2*               " length (round DOWN)
180           ars       2                   " divide by 4, console dont unnerstand
181                                         " chars.
182           stca      read_line_ddcw,03   " bottom 6 bits is tally.
183 
184 REREAD:
185           mlr       (),(pr,rl),fill(040)   " clear out buffer
186           desc9a    0
187           desc9a    pr6|0,al
188 
189           tsx2      bootload_io$connect
190           arg       bootload_info$console_iom_number
191           arg       bootload_info$console_channel_number
192           arg       read_line_pcw_ptr,*
193           arg       read_line_dcw_list_ptr,*
194 
195           staq      last_console_status
196 
197           cana      =o200000770000         " power off or central or channel
198           tnz       read_error
199           ana       =o770000,du         " only major status
200           cmpa      =o400000,du         " READY
201           tze       read_succeeded
202           cmpa      =o430000,du         " might be operator error or timeout
203           tnz       read_error          " error based on major
204 
205 " Now analyze minor status
206 
207           lda       last_console_status
208           cana      =o000400,du         " OPERATOR ERROR
209           tze       not_oper_err
210           tsx2      write
211           arg       operator_error_message
212           arg       operator_error_length
213           tra       REPROMPT_REREAD
214 
215 not_oper_err:
216           cana      =o001000,du         " TIMEOUT
217           tze       not_timeout
218           tsx2      write
219           arg       timeout_message
220           arg       timeout_length
221           tra       REPROMPT_REREAD
222 
223 not_timeout:
224           cana      =o004000,du
225           tze       read_error
226           tsx2      write_nl
227           tsx2      write
228           arg       too_long_message
229           arg       too_long_length
230 
231 REPROMPT_REREAD:
232           tsx2      write_nl
233           tsx2      write
234           arg       reprompt_message
235           arg       reprompt_length
236           tra       REREAD
237 
238           " message name,(TEXT OF MESSAGE)
239 
240           macro     message
241 &1_message:
242           aci       ~&2~
243 &1_length:
244           dec       &l2
245 &end
246           message   operator_error,( * Line ignored.)
247           message   timeout,( * Console timeout.)
248           message   too_long,( * Input too long.)
249           message   reprompt,(Answer: )
250 
251 read_succeeded:
252           read_line_return
253 
254 "^L
255 " INIT entry begins here
256 
257           Centry    init
258 
259           absa_au   cr
260           stca      write_nl_ddcw,70                        " relocate DCW
261 
262 " If there is a config deck, expect a PRPH OPC.  If not, find the console.
263 
264           szn       bootload_info$assume_config_deck
265           tze       poll_for_console
266 
267 " Search config deck.
268 
269           epp       seg,=its(config_segno_,0),*   " seg -> config_deck
270           eax1      0                             " for skipping them
271 
272 config_console.next_card:
273 
274           ldaq      seg|0,x1                      " get word and name
275           cmpaq     config_console.FREE_CARD      " is it a fence?...
276           tze       poll_for_console              " yes, find the console...
277           eraq      config_console.OPC_CARD       " or in the card...
278           anaq      config_console.MASK_CARD      " mask it...
279           tze       config_console.found_card
280 
281           eax1      config_card_size,x1           " skip it...
282           tra       config_console.next_card
283 
284           even
285 config_console.OPC_CARD:
286           aci       "prphopc ",8                  " first two words
287 config_console.FREE_CARD:
288           dec       -1                            " all 7's...
289           dec       -1
290 config_console.MASK_CARD:
291           oct       777777777777                  "777777777777777777777000
292           oct       777777777000
293 
294           even
295 config_console.STATE:
296           aci       "on  ",4                      " console must be "on"...
297 
298 " When we get here, seg|0 -> config_deck$, seg|0,x1 -> prph opc card.
299 
300 config_console.found_card:
301 
302           epp       seg2,seg|0,x1                 " point at base of OPC card
303           lda       seg2|prph_opc_card.state      " -> status...
304           cmpa      config_console.STATE          " is it on?...
305           tze       config_console.active_console " yes, start initialization...
306           eax1      config_card_size,x1           " no, skip card...
307           tra       config_console.next_card      " here we go again...
308 
309 config_console.active_console:
310           lda       seg2|prph_opc_card.iom         " multiple IOM's -- some day
311           sta       bootload_info$console_iom_number
312           lda       seg2|prph_opc_card.chan         " channel
313           sta       bootload_info$console_channel_number
314           lda       seg2|prph_opc_card.model        " determines PCW vs. IDCW
315           sta       bootload_info$console_model
316           tra       find.got_it
317 
318 poll_for_console:
319           lda       bootload_info$system_type
320           cmpa      ADP_SYSTEM,dl
321           tze       ssf
322 
323           lda       8,dl                          prepare to find operator's console
324           sta       bootload_info$console_channel_number
325           lda       bootload_info$tape_iom_number
326           sta       bootload_info$console_iom_number
327 
328 find.next:
329           tsx2      bootload_io$connect_timeout
330           arg       bootload_info$console_iom_number
331           arg       bootload_info$console_channel_number
332           arg       write_alert_pcw               " might be an EMC
333           arg       write_alert_idcw              " or an IPC-CONS
334           tra       find.skip_this_channel
335 
336           cana      bootload_info$status_mask
337           tze       find.got_it
338 
339 find.skip_this_channel:
340           aos       bootload_info$console_channel_number
341           lda       bootload_info$console_channel_number
342           cmpa      64,dl
343           tmi       find.next           try next one
344           tra       poll_for_console    keep trying... hope lcc wakes up
345 " ^L
346 " We have a console. Now figure out what kind.
347 
348 ssf:      stz       bootload_info$console_iom_number
349           stz       bootload_info$console_channel_number
350           tra       init.lcc
351 
352 find.got_it:
353 
354 " Short pause for ipc-cons-2 console to settle down
355 
356           even
357           lda       =o40000,dl                    " about a second
358           sba       1,dl
359           tpl       -1,ic
360 
361           tsx2      bootload_io$connect
362           arg       bootload_info$console_iom_number
363           arg       bootload_info$console_channel_number
364           arg       read_id_pcw                   " might be an EMC
365           arg       read_id_idcw                  " or an IPC-CONS
366 
367           cana      bootload_info$status_mask
368           tnz       init.emc
369 
370 init.lcc: lda       6601,dl                       " LCC model #
371           sta       bootload_info$console_model
372 
373           mlr       (),()                         " set up to use IDCW's
374           desc9a    idcw_ptrs,n_dcw_ptrs*4
375           desc9a    dcw_ptrs,n_dcw_ptrs*4
376 
377 " Short pause for ipc-cons-2 console to settle down
378 
379           even
380           lda       =o40000,dl                    " about a second
381           sba       1,dl
382           tpl       -1,ic
383 
384           lda       =o400000,du
385           sta       bootload_info$console_available         " set us up.
386           sta       bootload_info$console_pcw_check " let's chk to see if PCWs are used
387           sta       bootload_info$console_uses_pcw  " set the default to YES
388 
389           tsx2      bootload_io$connect           " bootload_io will make the final desision.
390           arg       bootload_info$console_iom_number
391           arg       bootload_info$console_channel_number
392           arg       write_pcw_ptr,*
393           arg       write_nl_dcw_list_ptr,*
394           tra       init.model_join
395 
396 init.emc:
397           lda       6001,dl
398           sta       bootload_info$console_model
399 
400           mlr       (),()                         " use PCW's
401           desc9a    pcw_ptrs,n_dcw_ptrs*4
402           desc9a    dcw_ptrs,n_dcw_ptrs*4
403           lda       =o400000,du
404           sta       bootload_info$console_available         " set us up.
405 
406 init.model_join:
407           tsx2      bootload_error$first_message            " let them know
408 
409           init_return
410 "^L
411 console_write_error:
412           staq      last_console_status
413 read_error:
414           stz       bootload_info$console_available
415           tra       bootload_error$console_failure
416 
417           even
418           segdef    last_console_status
419 last_console_status:
420           bss       ,2
421 
422 dcw_ptrs:
423 write_pcw_ptr:                arg       0
424 write_alert_pcw_ptr:          arg       0
425 read_line_pcw_ptr:            arg       0
426 write_dcw_list_ptr:           arg       0
427 write_nl_dcw_list_ptr:        arg       0
428 write_alert_dcw_list_ptr:     arg       0
429 read_line_dcw_list_ptr:       arg       0
430           equ       n_dcw_ptrs,*-dcw_ptrs
431 
432 pcw_ptrs:
433           arg       write_pcw           " write
434           arg       write_alert_pcw     " write_alert
435           arg       read_line_pcw       " read_line
436           arg       write_ascii_ddcw    " write
437           arg       write_nl_ddcw       " write_nl
438           arg       0                   " write_alert
439           arg       read_line_ddcw      " read_line
440 
441 idcw_ptrs:
442           arg       reset_status_p_pcw  " reset & proceed
443           arg       reset_status_p_pcw  " reset & proceed
444           arg       reset_status_p_pcw  " reset & proceed
445           arg       write_ascii_idcw    " write
446           arg       write_nl_idcw       " write_nl
447           arg       write_alert_idcw    " write_alert
448           arg       read_line_idcw      " read_line
449 
450           even
451 
452           make_pcw  write_pcw,
453                     CONSOLE.write_ASCII,
454                     0,0,
455                     record,terminate
456 
457           make_pcw  write_alert_pcw,
458                     CONSOLE.write_alert,
459                     0,0,
460                     nondata,terminate
461 
462           make_pcw  read_line_pcw,
463                     CONSOLE.read_ASCII,
464                     0,0,
465                     record,terminate
466 
467           make_pcw  reset_status_pcw,
468                     CONSOLE.reset_status,
469                     0,0,nondata,terminate
470 
471           make_pcw  reset_status_p_pcw,
472                     CONSOLE.reset_status,
473                     0,0,nondata,proceed,1
474 
475           make_pcw  read_id_pcw,
476                     CONSOLE.read_id,
477                     0,0,nondata,terminate
478 
479           null                                    " make room for pcw inserted
480                                                   " as idcw in IOX case
481           make_idcw read_id_idcw,
482                     CONSOLE.read_id,
483                     0,
484                     record,
485                     terminate
486 
487           null
488           make_idcw write_ascii_idcw,
489                     CONSOLE.write_ASCII,
490                     0,
491                     record,
492                     terminate
493           make_ddcw write_ascii_ddcw,
494                     0,0,iotd,word
495 
496           null
497           make_idcw write_alert_idcw,
498                     CONSOLE.write_alert,
499                     0,
500                     record,
501                     terminate
502 
503           null
504           make_idcw write_nl_idcw,
505                     CONSOLE.write_ASCII,
506                     0,
507                     record,
508                     terminate
509           make_ddcw write_nl_ddcw,
510                     0,1,iotd,word
511 
512           null
513           make_idcw read_line_idcw,
514                     CONSOLE.read_ASCII,
515                     0,
516                     record,
517                     terminate
518           make_ddcw read_line_ddcw,
519                     0,0,iotd,word
520 
521 cr:       vfd       o9/012,o9/015,18/0
522           end