/****^ *********************************************************** * * * Copyright, (C) Honeywell Bull Inc., 1987 * * * * Copyright, (C) Honeywell Information Systems Inc., 1985 * * * *********************************************************** */ /****^ HISTORY COMMENTS: 1) change(86-07-17,MAgar), approve(86-12-12,MCR7548), audit(86-12-12,Gilcrease), install(87-08-07,MR12.1-1075): Created. 2) change(87-03-25,Flegel), approve(87-03-25,MCR7548), audit(87-07-30,RBarstad), install(87-08-07,MR12.1-1075): Corrected mechanism for locating the source to using standard search rules (hcs_$make_ptr). END HISTORY COMMENTS */ /* format: style4,indattr,ifthen,^indcomtxt,thendo,^indproc,^indblkcom,initcol1,declareind8,dclind4,struclvlind3,comcol55 */ load_mowse: proc (); /* FUNCTION This program will read mowse.com, exitmows.com, bft.com, or bft_load.com wsterm.exe on Multics and convert them to Hex and ship them out over the communicatons line to the PC. */ /* SUBSYSTEM DOCUMENTATION */ /* NOTES */ /* INPUT PARAMETERS */ /* OUTPUT PARAMETERS */ /* SYSTEM CALLS */ dcl hcs_$fs_get_path_name entry (ptr, char (*), fixed bin, char (*), fixed bin (35)); dcl hcs_$status_mins entry (ptr, fixed bin (2), fixed bin (24), fixed bin (35)); dcl hcs_$make_ptr entry (ptr, char (*), char (*), ptr, fixed bin (35)); dcl ioa_$ioa_switch entry () options (variable); dcl com_err_ entry options (variable); dcl iox_$modes entry (ptr, char (*), char (*), fixed bin (35)); dcl cu_$arg_ptr_rel entry (fixed bin, ptr, fixed bin, fixed bin (35), ptr); dcl cu_$arg_list_ptr entry (ptr); dcl cu_$arg_count_rel entry (fixed bin, ptr, fixed bin (35)); dcl iox_$detach_iocb entry (ptr, fixed bin (35)); dcl iox_$destroy_iocb entry (ptr, fixed bin (35)); dcl iox_$attach_name entry (char (*), ptr, char (*), ptr, fixed bin (35)); dcl iox_$put_chars entry (ptr, ptr, fixed bin (21), fixed bin (35)); dcl iox_$get_chars entry (ptr, ptr, fixed bin (21), fixed bin (21), fixed bin (35)); dcl iox_$open entry (ptr, fixed bin, bit (1) aligned, fixed bin (35)); dcl iox_$close entry (ptr, fixed bin (35)); /* SYSTEM CALL SUPPORT */ dcl bit_count fixed bin (24); /* bits in file */ dcl cont_ptr ptr; /* ptr to continue */ dcl arg_ptr ptr; /* ptr to filename */ dcl arg char (arg_len) based (arg_ptr); /* filename */ dcl arg_len fixed bin; /* length of filename */ dcl arg_count fixed bin; /* number of args */ dcl arg_list_ptr ptr; /* ptr to args list */ dcl iox_$error_output ptr ext static; /* Error message IOCB */ dcl error_table_$wrong_no_of_args fixed bin (35) ext static; /* EXTERNAL CALLS */ /* EXTERNAL CALL SUPPORT */ dcl start_ptr ptr; /* ptr to start transmit packet */ dcl start char (50); /* start packet */ dcl num_left fixed bin (21); /* number of chars to EOF */ dcl num_read fixed bin (21); /* number of chars read */ dcl iox_$user_io ptr external; /* screen ptr */ dcl in_ptr ptr; /* input file ptr */ dcl code fixed bin (35); /* error code */ /* BUILTINS */ dcl rtrim builtin; dcl substr builtin; dcl addr builtin; dcl convert builtin; dcl length builtin; dcl mod builtin; dcl null builtin; /* CONSTANTS */ dcl TRUE bit (1) init ("1"b) int static options (constant); dcl FALSE bit (1) init ("0"b) int static options (constant); dcl USAGE char (31) int static options (constant) init ("^/^5tUsage: load_mowse FILENAME"); dcl MY_NAME char (10) int static options (constant) init ("load_mowse"); dcl PACKET_SIZE fixed bin (21) int static options (constant) init (4); dcl CHECK_SUM_MASK fixed bin int static options (constant) init (30); dcl ASCII_MASK bit (5) int static options (constant) init ("00010"b); dcl BYTE_SIZE fixed bin int static options (constant) init (9); dcl BYTE_ON bit (9) int static options (constant) init ("111111111"b); /* MISC VARIABLES */ dcl temp_string char (5); dcl path_name char (168); /* Full pathname of source */ dcl entry_name char (32); /* Segment name */ dcl dir_name_len fixed bin; /* Length of dir name */ dcl dir_name char (168); /* Directory of source */ dcl seg_type fixed bin (2); /* segment type */ dcl seg_ptr ptr; /* segment pointer to source */ dcl maxsize fixed bin (21); /* maximum file size */ dcl temp fixed bin (21); /* temporary storage for check sum */ dcl check_out_ptr ptr; /* ptr to check_sum */ dcl buf_check char (1) aligned; /* aligned address of check_sum */ dcl check_out bit (9) based (check_out_ptr); /* transmitted check sum */ dcl check_sum fixed bin (8); /* check_sum */ dcl ttl_read fixed bin (21); /* number of characters read */ dcl new_modes char (256); /* new terminal modes */ dcl old_modes char (256); /* original terminal modes */ dcl eof bit (1); /* end of file */ dcl continue char (1); /* continuation */ dcl line_in_ptr ptr; /* ptr to input */ dcl buf_in char (1) aligned; /* aligned address of line in */ dcl 01 line_in based (line_in_ptr), /* input storage */ 02 drop1 bit (1), /* drop multics first bit */ 02 top1 bit (4), /* save top 4 bits from character */ 02 bot1 bit (4), /* save bottom 4 bits from character */ 02 drop2 bit (1), /* second character */ 02 top2 bit (4), 02 bot2 bit (4), 02 drop3 bit (1), /* third character */ 02 top3 bit (4), 02 bot3 bit (4), 02 drop4 bit (1), /* fourth character */ 02 top4 bit (4), 02 bot4 bit (4); dcl line_out_ptr ptr; /* ptr to output */ dcl buf_out char (2) aligned; /* aligned address of output line */ dcl 01 line_out based (line_out_ptr), /* output strg */ 02 ntop1 bit (9), /* new top for character 1 */ 02 nbot1 bit (9), /* new bottom for character 1 */ 02 ntop2 bit (9), /* new top for charater 2 */ 02 nbot2 bit (9), /* new bottom for charater 2 */ 02 ntop3 bit (9), /* new top for character 3 */ 02 nbot3 bit (9), /* new bottom for character 3 */ 02 ntop4 bit (9), /* new top for character 4 */ 02 nbot4 bit (9); /* new bottom for character 4 */ /* */ /* INITIALIZATION */ temp_string = "*****"; path_name = ""; entry_name = ""; dir_name_len = 0; dir_name = ""; check_sum = 0; /* init check sum */ code = 0; /* init code */ ttl_read = 0; /* init total characters read */ eof = FALSE; /* set end of file to false */ start = " strt"; /* init start packet(34strt) */ in_ptr = null (); /* Infile IOCB pointer */ cont_ptr = addr (continue); /* set pointer to continue */ line_in_ptr = addr (buf_in); /* set pointer to input line */ line_out_ptr = addr (buf_out); /* set pointer to output line */ check_out_ptr = addr (buf_check); /* set pointer to check sum */ start_ptr = addr (start); /* set pointer to start packet */ /* : get arguments */ call cu_$arg_list_ptr (arg_list_ptr); call cu_$arg_count_rel (arg_count, arg_list_ptr, code); if code ^= 0 then do; call com_err_ (code, MY_NAME, "Unable to get argument count."); return; end; /* : if wrong number of arguments given then quit */ if arg_count ^= 1 then do; call com_err_ (error_table_$wrong_no_of_args, MY_NAME, USAGE); return; end; /* : connect to file name for input */ call cu_$arg_ptr_rel (1, arg_ptr, arg_len, code, arg_list_ptr); if code ^= 0 then do; call com_err_ (code, MY_NAME, "Getting arguments."); return; end; if (arg ^= "bft.com") & (arg ^= "mowse.com") & (arg ^= "wsterm.exe") & (arg ^= "bft_load.com") & (arg ^= "exitmows.com") then do; call com_err_ (0, MY_NAME, "Incorrect file ^a." || USAGE, arg); return; end; /* : Find the absolute path of the argument in the user's paths or initiated segments */ call hcs_$make_ptr (null, arg, "", seg_ptr, code); if code ^= 0 then do; call com_err_ (code, MY_NAME, "Finding ^a.", arg); return; end; /* : set maxsize for each file */ call hcs_$status_mins (seg_ptr, seg_type, bit_count, code); if code ^= 0 then do; call com_err_ (code, MY_NAME, "Getting size of ^a.", arg); return; end; maxsize = bit_count / BYTE_SIZE; /* : Find the absolute path of the segment */ call hcs_$fs_get_path_name (seg_ptr, dir_name, dir_name_len, entry_name, code); if code ^= 0 then do; call com_err_ (code, MY_NAME, "Getting pathname of ^a.", arg); return; end; path_name = substr (dir_name, 1, dir_name_len) || ">" || rtrim (entry_name); /* : Attach the IOCB for the file to be transferred */ call iox_$attach_name ("load_mowse_in", in_ptr, "vfile_ " || rtrim (path_name), null (), code); if code ^= 0 then do; call com_err_ (code, MY_NAME, "Unable to attach I/O switch."); return; end; /* : make sure file is in a closed state */ call iox_$close (in_ptr, (0)); /* : open file, quit if not found */ call iox_$open (in_ptr, 1, "0"b, code); if code ^= 0 then do; call clean_up; call com_err_ (code, MY_NAME, "Looking for ^a.", arg); return; end; /* : set initial modes */ new_modes = "^echoplex"; call iox_$modes (iox_$user_io, new_modes, old_modes, code); if code ^= 0 then do; call clean_up; call com_err_ (code, MY_NAME, "Setting modes."); return; end; /* : send start of comm to PC */ call iox_$put_chars (iox_$user_io, start_ptr, length (rtrim (start)), code); if code ^= 0 then do; call clean_up; call com_err_ (code, MY_NAME, "Start packet failed."); return; end; call wait; if (continue = "q") then do; call clean_up; call ioa_$ioa_switch (iox_$error_output, "load_mowse: Start packet failed."); return; end; /* : transfer file name to PC */ call iox_$put_chars (iox_$user_io, addr (temp_string), 5, (0)); call iox_$put_chars (iox_$user_io, addr (entry_name), length (rtrim (entry_name)), code); call wait; if (continue = "q") then do; call clean_up; call ioa_$ioa_switch (iox_$error_output, "load_mowse: Name packet failed."); return; end; /* : transfer file to PC */ call send; /* : reset modes and close files */ call clean_up; /* */ /* INTERNAL PROCEDURES */ clean_up: proc; /* FUNCTION This procedure will close the open file, detach the pointer and quit */ /* : reset terminal modes */ call iox_$modes (iox_$user_io, old_modes, new_modes, (0)); /* : close and detach and destroy file IOCB */ call iox_$close (in_ptr, (0)); call iox_$detach_iocb (in_ptr, (0)); call iox_$destroy_iocb (in_ptr, (0)); /* wipe in iocb out */ /* : end of program */ return; end; wait: proc; /* FUNCTION This procedure will wait until it receives a reply from the PC */ code = 0; continue = "n"; do while ((continue ^= "y") & (continue ^= "q")); call iox_$get_chars (iox_$user_io, cont_ptr, 1, num_read, code); end; end; end_of_send: proc; /* FUNCTION This procedure will send the end of transmission info to the PC */ /* : print end of transmission to PC */ ntop1 = BYTE_ON; nbot1 = BYTE_ON; ntop2 = BYTE_ON; nbot2 = BYTE_ON; ntop3 = BYTE_ON; nbot3 = BYTE_ON; ntop4 = BYTE_ON; nbot4 = BYTE_ON; call iox_$put_chars (iox_$user_io, line_out_ptr, num_left * 2, code); call clean_up; return; end; /* */ send: proc; /* FUNCTION This procedure will send the file to the PC. It will transfer the entire file unless there is a transmission error. On any such error the transmission is stopped. There is no provision for retransmitting a packet or for error correction. */ continue = "y"; eof = FALSE; /* : read a line from input file */ call iox_$get_chars (in_ptr, line_in_ptr, PACKET_SIZE, num_read, code); if code ^= 0 then do; call clean_up; call com_err_ (code, MY_NAME, "Error reading ^a.", arg); return; end; if (num_read = 0) then eof = TRUE; ttl_read = ttl_read + num_read; /* : transmit while there is more to do and no errors have occured */ do while ((eof = FALSE) & (continue ^= "q")); /* : initialize output line */ ntop1 = ""b; nbot1 = ""b; ntop2 = ""b; nbot2 = ""b; ntop3 = ""b; nbot3 = ""b; ntop4 = ""b; nbot4 = ""b; /* : convert to ascii */ ntop1 = ASCII_MASK || top1; nbot1 = ASCII_MASK || bot1; ntop2 = ASCII_MASK || top2; nbot2 = ASCII_MASK || bot2; ntop3 = ASCII_MASK || top3; nbot3 = ASCII_MASK || bot3; ntop4 = ASCII_MASK || top4; nbot4 = ASCII_MASK || bot4; /* : calculate check-sum for error checking */ check_sum = 0; temp = convert (check_sum, ntop1); check_sum = check_sum + temp; temp = convert (check_sum, nbot1); check_sum = check_sum + temp; temp = convert (check_sum, ntop2); check_sum = check_sum + temp; temp = convert (check_sum, nbot2); check_sum = check_sum + temp; temp = convert (check_sum, ntop3); check_sum = check_sum + temp; temp = convert (check_sum, nbot3); check_sum = check_sum + temp; temp = convert (check_sum, ntop4); check_sum = check_sum + temp; temp = convert (check_sum, nbot4); check_sum = check_sum + temp; check_sum = mod (check_sum, CHECK_SUM_MASK) + CHECK_SUM_MASK; check_out = convert (check_out, check_sum); /* : transfer chars to PC */ call iox_$put_chars (iox_$user_io, line_out_ptr, num_read * 2, code); if code ^= 0 then do; call clean_up; call com_err_ (code, MY_NAME, "Error in transfer of ^a.", arg); return; end; if (num_read < PACKET_SIZE) then do; num_left = PACKET_SIZE - num_read; call end_of_send; return; end; /* : wait for acknowledgment before continuing */ call wait; if (continue = "q") then do; call clean_up; call ioa_$ioa_switch (iox_$error_output, "load_mowse: Error in transfer of ^a.", arg); return; end; /* : send check_sum to PC */ call iox_$put_chars (iox_$user_io, check_out_ptr, 1, code); if code ^= 0 then do; call clean_up; call com_err_ (code, MY_NAME, "Transfer error in checksum."); return; end; call wait; if (continue = "q") then do; call clean_up; call ioa_$ioa_switch (iox_$error_output, MY_NAME, "Received checksum error in ^a.", arg); return; end; /* : read a line from input file */ num_read = 0; call iox_$get_chars (in_ptr, line_in_ptr, PACKET_SIZE, num_read, code); ttl_read = ttl_read + num_read; if (num_read = 0) then do; num_left = PACKET_SIZE; call end_of_send; return; end; end; end; %page; /* INCLUDE FILES */ end; */ ----------------------------------------------------------- Historical Background This edition of the Multics software materials and documentation is provided and donated to Massachusetts Institute of Technology by Group Bull including Bull HN Information Systems Inc. as a contribution to computer science knowledge. This donation is made also to give evidence of the common contributions of Massachusetts Institute of Technology, Bell Laboratories, General Electric, Honeywell Information Systems Inc., Honeywell Bull Inc., Groupe Bull and Bull HN Information Systems Inc. to the development of this operating system. Multics development was initiated by Massachusetts Institute of Technology Project MAC (1963-1970), renamed the MIT Laboratory for Computer Science and Artificial Intelligence in the mid 1970s, under the leadership of Professor Fernando Jose Corbato. Users consider that Multics provided the best software architecture for managing computer hardware properly and for executing programs. Many subsequent operating systems incorporated Multics principles. Multics was distributed in 1975 to 2000 by Group Bull in Europe , and in the U.S. by Bull HN Information Systems Inc., as successor in interest by change in name only to Honeywell Bull Inc. and Honeywell Information Systems Inc. . ----------------------------------------------------------- Permission to use, copy, modify, and distribute these programs and their documentation for any purpose and without fee is hereby granted,provided that the below copyright notice and historical background appear in all copies and that both the copyright notice and historical background and this permission notice appear in supporting documentation, and that the names of MIT, HIS, Bull or Bull HN not be used in advertising or publicity pertaining to distribution of the programs without specific prior written permission. Copyright 1972 by Massachusetts Institute of Technology and Honeywell Information Systems Inc. Copyright 2006 by Bull HN Information Systems Inc. Copyright 2006 by Bull SAS All Rights Reserved */