forked from rcornwell/sims
-
Notifications
You must be signed in to change notification settings - Fork 0
/
scp.c
11098 lines (10180 loc) · 430 KB
/
scp.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/* scp.c: simulator control program
Copyright (c) 1993-2012, Robert M Supnik
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
ROBERT M SUPNIK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of Robert M Supnik shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from Robert M Supnik.
20-Mar-12 MP Fixes to "SHOW <x> SHOW" commands
06-Jan-12 JDB Fixed "SHOW DEVICE" with only one enabled unit (Dave Bryan)
25-Sep-11 MP Added the ability for a simulator built with
SIM_ASYNCH_IO to change whether I/O is actually done
asynchronously by the new scp command SET ASYNCH and
SET NOASYNCH
22-Sep-11 MP Added signal catching of SIGHUP and SIGTERM to cause
simulator STOP. This allows an externally signalled
event (i.e. system shutdown, or logoff) to signal a
running simulator of these events and to allow
reasonable actions to be taken. This will facilitate
running a simulator as a 'service' on *nix platforms,
given a sufficiently flexible simulator .ini file.
20-Apr-11 MP Added expansion of %STATUS% and %TSTATUS% in do command
arguments. STATUS is the numeric value of the last
command error status and TSTATUS is the text message
relating to the last command error status
17-Apr-11 MP Changed sim_rest to defer attaching devices until after
device register contents have been restored since some
attach activities may reference register contained info.
29-Jan-11 MP Adjusted sim_debug to:
- include the simulator timestamp (sim_gtime)
as part of the prefix for each line of output
- write complete lines at a time (avoid asynch I/O issues).
05-Jan-11 MP Added Asynch I/O support
22-Jan-11 MP Added SET ON, SET NOON, ON, GOTO and RETURN command support
13-Jan-11 MP Added "SHOW SHOW" and "SHOW <dev> SHOW" commands
05-Jan-11 RMS Fixed bug in deposit stride for numeric input (John Dundas)
23-Dec-10 RMS Clarified some help messages (Mark Pizzolato)
08-Nov-10 RMS Fixed handling of DO with no arguments (Dave Bryan)
22-May-10 RMS Added *nix READLINE support (Mark Pizzolato)
08-Feb-09 RMS Fixed warnings in help printouts
29-Dec-08 RMS Fixed implementation of MTAB_NC
24-Nov-08 RMS Revised RESTORE unit logic for consistency
05-Sep-08 JDB "detach_all" ignores error status returns if shutting down
17-Aug-08 RMS Revert RUN/BOOT to standard, rather than powerup, reset
25-Jul-08 JDB DO cmd missing params now default to null string
29-Jun-08 JDB DO cmd sub_args now allows "\\" to specify literal backslash
04-Jun-08 JDB label the patch delta more clearly
31-Mar-08 RMS Fixed bug in local/global register search (Mark Pizzolato)
Fixed bug in restore of RO units (Mark Pizzolato)
06-Feb-08 RMS Added SET/SHO/NO BR with default argument
18-Jul-07 RMS Modified match_ext for VMS ext;version support
28-Apr-07 RMS Modified sim_instr invocation to call sim_rtcn_init_all
Fixed bug in get_sim_opt
Fixed bug in restoration with changed memory size
08-Mar-07 JDB Fixed breakpoint actions in DO command file processing
30-Jan-07 RMS Fixed bugs in get_ipaddr
17-Oct-06 RMS Added idle support
04-Oct-06 JDB DO cmd failure now echoes cmd unless -q
30-Aug-06 JDB detach_unit returns SCPE_UNATT if not attached
14-Jul-06 RMS Added sim_activate_abs
02-Jun-06 JDB Fixed do_cmd to exit nested files on assertion failure
Added -E switch to do_cmd to exit on any error
14-Feb-06 RMS Upgraded save file format to V3.5
18-Jan-06 RMS Added fprint_stopped_gen
Added breakpoint spaces
Fixed unaligned register access (Doug Carman)
22-Sep-05 RMS Fixed declarations (Sterling Garwood)
30-Aug-05 RMS Revised to trim trailing spaces on file names
25-Aug-05 RMS Added variable default device support
23-Aug-05 RMS Added Linux line history support
16-Aug-05 RMS Fixed C++ declaration and cast problems
01-May-05 RMS Revised syntax for SET DEBUG (Dave Bryan)
22-Mar-05 JDB Modified DO command to allow ten-level nesting
18-Mar-05 RMS Moved DETACH tests into detach_unit (Dave Bryan)
Revised interface to fprint_sym, fparse_sym
13-Mar-05 JDB ASSERT now requires a conditional operator
07-Feb-05 RMS Added ASSERT command (Dave Bryan)
02-Feb-05 RMS Fixed bug in global register search
26-Dec-04 RMS Qualified SAVE examine, RESTORE deposit with SIM_SW_REST
10-Nov-04 JDB Fixed logging of errors from cmds in "do" file
05-Nov-04 RMS Moved SET/SHOW DEBUG under CONSOLE hierarchy
Renamed unit OFFLINE/ONLINE to DISABLED/ENABLED (Dave Bryan)
Revised to flush output files after simulation stop (Dave Bryan)
15-Oct-04 RMS Fixed HELP to suppress duplicate descriptions
27-Sep-04 RMS Fixed comma-separation options in set (David Bryan)
09-Sep-04 RMS Added -p option for RESET
13-Aug-04 RMS Qualified RESTORE detach with SIM_SW_REST
17-Jul-04 JDB DO cmd file open failure retries with ".sim" appended
17-Jul-04 RMS Added ECHO command (Dave Bryan)
12-Jul-04 RMS Fixed problem ATTACHing to read only files
(John Dundas)
28-May-04 RMS Added SET/SHOW CONSOLE
14-Feb-04 RMS Updated SAVE/RESTORE (V3.2)
RMS Added debug print routines (Dave Hittner)
RMS Added sim_vm_parse_addr and sim_vm_fprint_addr
RMS Added REG_VMAD support
RMS Split out libraries
RMS Moved logging function to SCP
RMS Exposed step counter interface(s)
RMS Fixed double logging of SHOW BREAK (Mark Pizzolato)
RMS Fixed implementation of REG_VMIO
RMS Added SET/SHOW DEBUG, SET/SHOW <device> DEBUG,
SHOW <device> MODIFIERS, SHOW <device> RADIX
RMS Changed sim_fsize to take uptr argument
29-Dec-03 RMS Added Telnet console output stall support
01-Nov-03 RMS Cleaned up implicit detach on attach/restore
Fixed bug in command line read while logging (Mark Pizzolato)
01-Sep-03 RMS Fixed end-of-file problem in dep, idep
Fixed error on trailing spaces in dep, idep
15-Jul-03 RMS Removed unnecessary test in reset_all
15-Jun-03 RMS Added register flag REG_VMIO
25-Apr-03 RMS Added extended address support (V3.0)
Fixed bug in SAVE (Peter Schorn)
Added u5, u6 fields
Added logical name support
03-Mar-03 RMS Added sim_fsize
27-Feb-03 RMS Fixed bug in multiword deposits to files
08-Feb-03 RMS Changed sim_os_sleep to void, match_ext to char*
Added multiple actions, .ini file support
Added multiple switch evaluations per line
07-Feb-03 RMS Added VMS support for ! (Mark Pizzolato)
01-Feb-03 RMS Added breakpoint table extension, actions
14-Jan-03 RMS Added missing function prototypes
10-Jan-03 RMS Added attach/restore flag, dynamic memory size support,
case sensitive SET options
22-Dec-02 RMS Added ! (OS command) feature (Mark Pizzolato)
17-Dec-02 RMS Added get_ipaddr
02-Dec-02 RMS Added EValuate command
16-Nov-02 RMS Fixed bug in register name match algorithm
13-Oct-02 RMS Fixed Borland compiler warnings (Hans Pufal)
05-Oct-02 RMS Fixed bugs in set_logon, ssh_break (David Hittner)
Added support for fixed buffer devices
Added support for Telnet console, removed VT support
Added help <command>
Added VMS file optimizations (Robert Alan Byer)
Added quiet mode, DO with parameters, GUI interface,
extensible commands (Brian Knittel)
Added device enable/disable commands
14-Jul-02 RMS Fixed exit bug in do, added -v switch (Brian Knittel)
17-May-02 RMS Fixed bug in fxread/fxwrite error usage (found by
Norm Lastovic)
02-May-02 RMS Added VT emulation interface, changed {NO}LOG to SET {NO}LOG
22-Apr-02 RMS Fixed laptop sleep problem in clock calibration, added
magtape record length error (Jonathan Engdahl)
26-Feb-02 RMS Fixed initialization bugs in do_cmd, get_aval
(Brian Knittel)
10-Feb-02 RMS Fixed problem in clock calibration
06-Jan-02 RMS Moved device enable/disable to simulators
30-Dec-01 RMS Generalized timer packaged, added circular arrays
19-Dec-01 RMS Fixed DO command bug (John Dundas)
07-Dec-01 RMS Implemented breakpoint package
05-Dec-01 RMS Fixed bug in universal register logic
03-Dec-01 RMS Added read-only units, extended SET/SHOW, universal registers
24-Nov-01 RMS Added unit-based registers
16-Nov-01 RMS Added DO command
28-Oct-01 RMS Added relative range addressing
08-Oct-01 RMS Added SHOW VERSION
30-Sep-01 RMS Relaxed attach test in BOOT
27-Sep-01 RMS Added queue count routine, fixed typo in ex/mod
17-Sep-01 RMS Removed multiple console support
07-Sep-01 RMS Removed conditional externs on function prototypes
Added special modifier print
31-Aug-01 RMS Changed int64 to t_int64 for Windoze (V2.7)
18-Jul-01 RMS Minor changes for Macintosh port
12-Jun-01 RMS Fixed bug in big-endian I/O (Dave Conroy)
27-May-01 RMS Added multiple console support
16-May-01 RMS Added logging
15-May-01 RMS Added features from Tim Litt
12-May-01 RMS Fixed missing return in disable_cmd
25-Mar-01 RMS Added ENABLE/DISABLE
14-Mar-01 RMS Revised LOAD/DUMP interface (again)
05-Mar-01 RMS Added clock calibration support
05-Feb-01 RMS Fixed bug, DETACH buffered unit with hwmark = 0
04-Feb-01 RMS Fixed bug, RESTORE not using device's attach routine
21-Jan-01 RMS Added relative time
22-Dec-00 RMS Fixed find_device for devices ending in numbers
08-Dec-00 RMS V2.5a changes
30-Oct-00 RMS Added output file option to examine
11-Jul-99 RMS V2.5 changes
13-Apr-99 RMS Fixed handling of 32b addresses
04-Oct-98 RMS V2.4 changes
20-Aug-98 RMS Added radix commands
05-Jun-98 RMS Fixed bug in ^D handling for UNIX
10-Apr-98 RMS Added switches to all commands
26-Oct-97 RMS Added search capability
25-Jan-97 RMS Revised data types
23-Jan-97 RMS Added bi-endian I/O
06-Sep-96 RMS Fixed bug in variable length IEXAMINE
16-Jun-96 RMS Changed interface to parse/print_sym
06-Apr-96 RMS Added error checking in reset all
07-Jan-96 RMS Added register buffers in save/restore
11-Dec-95 RMS Fixed ordering bug in save/restore
22-May-95 RMS Added symbolic input
13-Apr-95 RMS Added symbolic printouts
*/
/* Macros and data structures */
#define NOT_MUX_USING_CODE /* sim_tmxr library provider or agnostic */
#include "sim_defs.h"
#include "sim_rev.h"
#include "sim_disk.h"
#include "sim_tape.h"
#include "sim_ether.h"
#include "sim_serial.h"
#include "sim_video.h"
#include "sim_sock.h"
#include "sim_frontpanel.h"
#include <signal.h>
#include <ctype.h>
#include <time.h>
#if defined(_WIN32)
#include <direct.h>
#include <io.h>
#include <fcntl.h>
#else
#include <unistd.h>
#endif
#include <sys/stat.h>
#include <setjmp.h>
#if defined(HAVE_DLOPEN) /* Dynamic Readline support */
#include <dlfcn.h>
#endif
#ifndef MAX
#define MAX(a,b) (((a) >= (b)) ? (a) : (b))
#endif
/* search logical and boolean ops */
#define SCH_OR 0 /* search logicals */
#define SCH_AND 1
#define SCH_XOR 2
#define SCH_E 0 /* search booleans */
#define SCH_N 1
#define SCH_G 2
#define SCH_L 3
#define SCH_EE 4
#define SCH_NE 5
#define SCH_GE 6
#define SCH_LE 7
#define MAX_DO_NEST_LVL 20 /* DO cmd nesting level */
#define SRBSIZ 1024 /* save/restore buffer */
#define SIM_BRK_INILNT 4096 /* bpt tbl length */
#define SIM_BRK_ALLTYP 0xFFFFFFFB
#define UPDATE_SIM_TIME \
if (1) { \
int32 _x; \
AIO_LOCK; \
if (sim_clock_queue == QUEUE_LIST_END) \
_x = noqueue_time; \
else \
_x = sim_clock_queue->time; \
sim_time = sim_time + (_x - sim_interval); \
sim_rtime = sim_rtime + ((uint32) (_x - sim_interval)); \
if (sim_clock_queue == QUEUE_LIST_END) \
noqueue_time = sim_interval; \
else \
sim_clock_queue->time = sim_interval; \
AIO_UNLOCK; \
} \
else \
(void)0 \
#define SZ_D(dp) (size_map[((dp)->dwidth + CHAR_BIT - 1) / CHAR_BIT])
#define SZ_R(rp) \
(size_map[((rp)->width + (rp)->offset + CHAR_BIT - 1) / CHAR_BIT])
#if defined (USE_INT64)
#define SZ_LOAD(sz,v,mb,j) \
if (sz == sizeof (uint8)) v = *(((uint8 *) mb) + ((uint32) j)); \
else if (sz == sizeof (uint16)) v = *(((uint16 *) mb) + ((uint32) j)); \
else if (sz == sizeof (uint32)) v = *(((uint32 *) mb) + ((uint32) j)); \
else v = *(((t_uint64 *) mb) + ((uint32) j));
#define SZ_STORE(sz,v,mb,j) \
if (sz == sizeof (uint8)) *(((uint8 *) mb) + j) = (uint8) v; \
else if (sz == sizeof (uint16)) *(((uint16 *) mb) + ((uint32) j)) = (uint16) v; \
else if (sz == sizeof (uint32)) *(((uint32 *) mb) + ((uint32) j)) = (uint32) v; \
else *(((t_uint64 *) mb) + ((uint32) j)) = v;
#else
#define SZ_LOAD(sz,v,mb,j) \
if (sz == sizeof (uint8)) v = *(((uint8 *) mb) + ((uint32) j)); \
else if (sz == sizeof (uint16)) v = *(((uint16 *) mb) + ((uint32) j)); \
else v = *(((uint32 *) mb) + ((uint32) j));
#define SZ_STORE(sz,v,mb,j) \
if (sz == sizeof (uint8)) *(((uint8 *) mb) + ((uint32) j)) = (uint8) v; \
else if (sz == sizeof (uint16)) *(((uint16 *) mb) + ((uint32) j)) = (uint16) v; \
else *(((uint32 *) mb) + ((uint32) j)) = v;
#endif
#define GET_SWITCHES(cp) \
if ((cp = get_sim_sw (cp)) == NULL) return SCPE_INVSW
#define GET_RADIX(val,dft) \
if (sim_switches & SWMASK ('O')) val = 8; \
else if (sim_switches & SWMASK ('D')) val = 10; \
else if (sim_switches & SWMASK ('H')) val = 16; \
else val = dft;
/* Asynch I/O support */
#if defined (SIM_ASYNCH_IO)
pthread_mutex_t sim_asynch_lock = PTHREAD_MUTEX_INITIALIZER;
pthread_cond_t sim_asynch_wake = PTHREAD_COND_INITIALIZER;
pthread_mutex_t sim_timer_lock = PTHREAD_MUTEX_INITIALIZER;
pthread_cond_t sim_timer_wake = PTHREAD_COND_INITIALIZER;
pthread_mutex_t sim_tmxr_poll_lock = PTHREAD_MUTEX_INITIALIZER;
pthread_cond_t sim_tmxr_poll_cond = PTHREAD_COND_INITIALIZER;
int32 sim_tmxr_poll_count;
pthread_t sim_asynch_main_threadid;
UNIT * volatile sim_asynch_queue;
UNIT * volatile sim_wallclock_queue;
UNIT * volatile sim_wallclock_entry;
t_bool sim_asynch_enabled = TRUE;
int32 sim_asynch_check;
int32 sim_asynch_latency = 4000; /* 4 usec interrupt latency */
int32 sim_asynch_inst_latency = 20; /* assume 5 mip simulator */
#else
t_bool sim_asynch_enabled = FALSE;
#endif
/* The per-simulator init routine is a weak global that defaults to NULL
The other per-simulator pointers can be overrriden by the init routine */
WEAK void (*sim_vm_init) (void);
char* (*sim_vm_read) (char *ptr, int32 size, FILE *stream) = NULL;
void (*sim_vm_post) (t_bool from_scp) = NULL;
CTAB *sim_vm_cmd = NULL;
void (*sim_vm_fprint_addr) (FILE *st, DEVICE *dptr, t_addr addr) = NULL;
t_addr (*sim_vm_parse_addr) (DEVICE *dptr, CONST char *cptr, CONST char **tptr) = NULL;
t_value (*sim_vm_pc_value) (void) = NULL;
t_bool (*sim_vm_is_subroutine_call) (t_addr **ret_addrs) = NULL;
t_bool (*sim_vm_fprint_stopped) (FILE *st, t_stat reason) = NULL;
/* Prototypes */
/* Set and show command processors */
t_stat set_dev_radix (DEVICE *dptr, UNIT *uptr, int32 flag, CONST char *cptr);
t_stat set_dev_enbdis (DEVICE *dptr, UNIT *uptr, int32 flag, CONST char *cptr);
t_stat set_dev_debug (DEVICE *dptr, UNIT *uptr, int32 flag, CONST char *cptr);
t_stat set_unit_enbdis (DEVICE *dptr, UNIT *uptr, int32 flag, CONST char *cptr);
t_stat ssh_break (FILE *st, const char *cptr, int32 flg);
t_stat show_cmd_fi (FILE *ofile, int32 flag, CONST char *cptr);
t_stat show_config (FILE *st, DEVICE *dptr, UNIT *uptr, int32 flag, CONST char *cptr);
t_stat show_queue (FILE *st, DEVICE *dptr, UNIT *uptr, int32 flag, CONST char *cptr);
t_stat show_time (FILE *st, DEVICE *dptr, UNIT *uptr, int32 flag, CONST char *cptr);
t_stat show_mod_names (FILE *st, DEVICE *dptr, UNIT *uptr, int32 flag, CONST char *cptr);
t_stat show_show_commands (FILE *st, DEVICE *dptr, UNIT *uptr, int32 flag, CONST char *cptr);
t_stat show_log_names (FILE *st, DEVICE *dptr, UNIT *uptr, int32 flag, CONST char *cptr);
t_stat show_dev_radix (FILE *st, DEVICE *dptr, UNIT *uptr, int32 flag, CONST char *cptr);
t_stat show_dev_debug (FILE *st, DEVICE *dptr, UNIT *uptr, int32 flag, CONST char *cptr);
t_stat show_dev_logicals (FILE *st, DEVICE *dptr, UNIT *uptr, int32 flag, CONST char *cptr);
t_stat show_dev_modifiers (FILE *st, DEVICE *dptr, UNIT *uptr, int32 flag, CONST char *cptr);
t_stat show_dev_show_commands (FILE *st, DEVICE *dptr, UNIT *uptr, int32 flag, CONST char *cptr);
t_stat show_version (FILE *st, DEVICE *dptr, UNIT *uptr, int32 flag, CONST char *cptr);
t_stat show_default (FILE *st, DEVICE *dptr, UNIT *uptr, int32 flag, CONST char *cptr);
t_stat show_break (FILE *st, DEVICE *dptr, UNIT *uptr, int32 flag, CONST char *cptr);
t_stat show_on (FILE *st, DEVICE *dptr, UNIT *uptr, int32 flag, CONST char *cptr);
t_stat sim_show_send (FILE *st, DEVICE *dptr, UNIT *uptr, int32 flag, CONST char *cptr);
t_stat sim_show_expect (FILE *st, DEVICE *dptr, UNIT *uptr, int32 flag, CONST char *cptr);
t_stat show_device (FILE *st, DEVICE *dptr, int32 flag);
t_stat show_unit (FILE *st, DEVICE *dptr, UNIT *uptr, int32 flag);
t_stat show_all_mods (FILE *st, DEVICE *dptr, UNIT *uptr, int32 flg, int32 *toks);
t_stat show_one_mod (FILE *st, DEVICE *dptr, UNIT *uptr, MTAB *mptr, CONST char *cptr, int32 flag);
t_stat sim_save (FILE *sfile);
t_stat sim_rest (FILE *rfile);
/* Breakpoint package */
t_stat sim_brk_init (void);
t_stat sim_brk_set (t_addr loc, int32 sw, int32 ncnt, CONST char *act);
t_stat sim_brk_clr (t_addr loc, int32 sw);
t_stat sim_brk_clrall (int32 sw);
t_stat sim_brk_show (FILE *st, t_addr loc, int32 sw);
t_stat sim_brk_showall (FILE *st, int32 sw);
CONST char *sim_brk_getact (char *buf, int32 size);
void sim_brk_npc (uint32 cnt);
BRKTAB *sim_brk_new (t_addr loc);
FILE *stdnul;
/* Command support routines */
SCHTAB *get_rsearch (CONST char *cptr, int32 radix, SCHTAB *schptr);
SCHTAB *get_asearch (CONST char *cptr, int32 radix, SCHTAB *schptr);
int32 test_search (t_value *val, SCHTAB *schptr);
static const char *get_glyph_gen (const char *iptr, char *optr, char mchar, t_bool uc, t_bool quote, char escape_char);
int32 get_switches (const char *cptr);
CONST char *get_sim_sw (CONST char *cptr);
t_stat get_aval (t_addr addr, DEVICE *dptr, UNIT *uptr);
t_value get_rval (REG *rptr, uint32 idx);
void put_rval (REG *rptr, uint32 idx, t_value val);
void fprint_help (FILE *st);
void fprint_stopped (FILE *st, t_stat r);
void fprint_capac (FILE *st, DEVICE *dptr, UNIT *uptr);
void fprint_sep (FILE *st, int32 *tokens);
char *read_line (char *ptr, int32 size, FILE *stream);
char *read_line_p (const char *prompt, char *ptr, int32 size, FILE *stream);
REG *find_reg_glob (CONST char *ptr, CONST char **optr, DEVICE **gdptr);
char *sim_trim_endspc (char *cptr);
/* Forward references */
t_stat scp_attach_unit (DEVICE *dptr, UNIT *uptr, const char *cptr);
t_stat scp_detach_unit (DEVICE *dptr, UNIT *uptr);
t_bool qdisable (DEVICE *dptr);
t_stat attach_err (UNIT *uptr, t_stat stat);
t_stat detach_all (int32 start_device, t_bool shutdown);
t_stat assign_device (DEVICE *dptr, const char *cptr);
t_stat deassign_device (DEVICE *dptr);
t_stat ssh_break_one (FILE *st, int32 flg, t_addr lo, int32 cnt, CONST char *aptr);
t_stat exdep_reg_loop (FILE *ofile, SCHTAB *schptr, int32 flag, CONST char *cptr,
REG *lowr, REG *highr, uint32 lows, uint32 highs);
t_stat ex_reg (FILE *ofile, t_value val, int32 flag, REG *rptr, uint32 idx);
t_stat dep_reg (int32 flag, CONST char *cptr, REG *rptr, uint32 idx);
t_stat exdep_addr_loop (FILE *ofile, SCHTAB *schptr, int32 flag, const char *cptr,
t_addr low, t_addr high, DEVICE *dptr, UNIT *uptr);
t_stat ex_addr (FILE *ofile, int32 flag, t_addr addr, DEVICE *dptr, UNIT *uptr);
t_stat dep_addr (int32 flag, const char *cptr, t_addr addr, DEVICE *dptr,
UNIT *uptr, int32 dfltinc);
void fprint_fields (FILE *stream, t_value before, t_value after, BITFIELD* bitdefs);
t_stat step_svc (UNIT *ptr);
t_stat expect_svc (UNIT *ptr);
t_stat shift_args (char *do_arg[], size_t arg_count);
t_stat set_on (int32 flag, CONST char *cptr);
t_stat set_verify (int32 flag, CONST char *cptr);
t_stat set_message (int32 flag, CONST char *cptr);
t_stat set_quiet (int32 flag, CONST char *cptr);
t_stat set_asynch (int32 flag, CONST char *cptr);
t_stat sim_show_asynch (FILE *st, DEVICE *dptr, UNIT *uptr, int32 flag, CONST char *cptr);
t_stat do_cmd_label (int32 flag, CONST char *cptr, CONST char *label);
void int_handler (int signal);
t_stat set_prompt (int32 flag, CONST char *cptr);
t_stat sim_set_asynch (int32 flag, CONST char *cptr);
t_stat sim_set_environment (int32 flag, CONST char *cptr);
static const char *get_dbg_verb (uint32 dbits, DEVICE* dptr);
/* Global data */
DEVICE *sim_dflt_dev = NULL;
UNIT *sim_clock_queue = QUEUE_LIST_END;
int32 sim_interval = 0;
int32 sim_switches = 0;
FILE *sim_ofile = NULL;
TMLN *sim_oline = NULL;
SCHTAB *sim_schrptr = FALSE;
SCHTAB *sim_schaptr = FALSE;
DEVICE *sim_dfdev = NULL;
UNIT *sim_dfunit = NULL;
DEVICE **sim_internal_devices = NULL;
uint32 sim_internal_device_count = 0;
int32 sim_opt_out = 0;
int32 sim_is_running = 0;
t_bool sim_processing_event = FALSE;
uint32 sim_brk_summ = 0;
uint32 sim_brk_types = 0;
uint32 sim_brk_dflt = 0;
char *sim_brk_act[MAX_DO_NEST_LVL];
char *sim_brk_act_buf[MAX_DO_NEST_LVL];
BRKTAB *sim_brk_tab = NULL;
int32 sim_brk_ent = 0;
int32 sim_brk_lnt = 0;
int32 sim_brk_ins = 0;
t_bool sim_brk_pend[SIM_BKPT_N_SPC] = { FALSE };
t_addr sim_brk_ploc[SIM_BKPT_N_SPC] = { 0 };
int32 sim_quiet = 0;
int32 sim_step = 0;
static double sim_time;
static uint32 sim_rtime;
static int32 noqueue_time;
volatile int32 stop_cpu = 0;
static char **sim_argv;
t_value *sim_eval = NULL;
static t_value sim_last_val;
FILE *sim_log = NULL; /* log file */
FILEREF *sim_log_ref = NULL; /* log file file reference */
FILE *sim_deb = NULL; /* debug file */
FILEREF *sim_deb_ref = NULL; /* debug file file reference */
int32 sim_deb_switches = 0; /* debug switches */
struct timespec sim_deb_basetime; /* debug timestamp relative base time */
char *sim_prompt = NULL; /* prompt string */
static FILE *sim_gotofile; /* the currently open do file */
static int32 sim_goto_line[MAX_DO_NEST_LVL+1]; /* the current line number in the currently open do file */
static int32 sim_do_echo = 0; /* the echo status of the currently open do file */
static int32 sim_show_message = 1; /* the message display status of the currently open do file */
static int32 sim_on_inherit = 0; /* the inherit status of on state and conditions when executing do files */
static int32 sim_do_depth = 0;
static int32 sim_on_check[MAX_DO_NEST_LVL+1];
static char *sim_on_actions[MAX_DO_NEST_LVL+1][SCPE_MAX_ERR+1];
static char sim_do_filename[MAX_DO_NEST_LVL+1][CBUFSIZE];
static const char *sim_do_ocptr[MAX_DO_NEST_LVL+1];
static const char *sim_do_label[MAX_DO_NEST_LVL+1];
t_stat sim_last_cmd_stat; /* Command Status */
static SCHTAB sim_stabr; /* Register search specifier */
static SCHTAB sim_staba; /* Memory search specifier */
static UNIT sim_step_unit = { UDATA (&step_svc, 0, 0) };
static UNIT sim_expect_unit = { UDATA (&expect_svc, 0, 0) };
#if defined USE_INT64
static const char *sim_si64 = "64b data";
#else
static const char *sim_si64 = "32b data";
#endif
#if defined USE_ADDR64
static const char *sim_sa64 = "64b addresses";
#else
static const char *sim_sa64 = "32b addresses";
#endif
const char *sim_savename = sim_name; /* Simulator Name used in SAVE/RESTORE images */
/* Tables and strings */
const char save_vercur[] = "V4.0";
const char save_ver40[] = "V4.0";
const char save_ver35[] = "V3.5";
const char save_ver32[] = "V3.2";
const char save_ver30[] = "V3.0";
const struct scp_error {
const char *code;
const char *message;
} scp_errors[1+SCPE_MAX_ERR-SCPE_BASE] =
{{"NXM", "Address space exceeded"},
{"UNATT", "Unit not attached"},
{"IOERR", "I/O error"},
{"CSUM", "Checksum error"},
{"FMT", "Format error"},
{"NOATT", "Unit not attachable"},
{"OPENERR", "File open error"},
{"MEM", "Memory exhausted"},
{"ARG", "Invalid argument"},
{"STEP", "Step expired"},
{"UNK", "Unknown command"},
{"RO", "Read only argument"},
{"INCOMP", "Command not completed"},
{"STOP", "Simulation stopped"},
{"EXIT", "Goodbye"},
{"TTIERR", "Console input I/O error"},
{"TTOERR", "Console output I/O error"},
{"EOF", "End of file"},
{"REL", "Relocation error"},
{"NOPARAM", "No settable parameters"},
{"ALATT", "Unit already attached"},
{"TIMER", "Hardware timer error"},
{"SIGERR", "Signal handler setup error"},
{"TTYERR", "Console terminal setup error"},
{"SUB", "Subscript out of range"},
{"NOFNC", "Command not allowed"},
{"UDIS", "Unit disabled"},
{"NORO", "Read only operation not allowed"},
{"INVSW", "Invalid switch"},
{"MISVAL", "Missing value"},
{"2FARG", "Too few arguments"},
{"2MARG", "Too many arguments"},
{"NXDEV", "Non-existent device"},
{"NXUN", "Non-existent unit"},
{"NXREG", "Non-existent register"},
{"NXPAR", "Non-existent parameter"},
{"NEST", "Nested DO command limit exceeded"},
{"IERR", "Internal error"},
{"MTRLNT", "Invalid magtape record length"},
{"LOST", "Console Telnet connection lost"},
{"TTMO", "Console Telnet connection timed out"},
{"STALL", "Console Telnet output stall"},
{"AFAIL", "Assertion failed"},
{"INVREM", "Invalid remote console command"},
{"NOTATT", "Not attached"},
{"EXPECT", "Expect matched"},
{"REMOTE", "remote console command"},
};
const size_t size_map[] = { sizeof (int8),
sizeof (int8), sizeof (int16), sizeof (int32), sizeof (int32)
#if defined (USE_INT64)
, sizeof (t_int64), sizeof (t_int64), sizeof (t_int64), sizeof (t_int64)
#endif
};
const t_value width_mask[] = { 0,
0x1, 0x3, 0x7, 0xF,
0x1F, 0x3F, 0x7F, 0xFF,
0x1FF, 0x3FF, 0x7FF, 0xFFF,
0x1FFF, 0x3FFF, 0x7FFF, 0xFFFF,
0x1FFFF, 0x3FFFF, 0x7FFFF, 0xFFFFF,
0x1FFFFF, 0x3FFFFF, 0x7FFFFF, 0xFFFFFF,
0x1FFFFFF, 0x3FFFFFF, 0x7FFFFFF, 0xFFFFFFF,
0x1FFFFFFF, 0x3FFFFFFF, 0x7FFFFFFF, 0xFFFFFFFF
#if defined (USE_INT64)
, 0x1FFFFFFFF, 0x3FFFFFFFF, 0x7FFFFFFFF, 0xFFFFFFFFF,
0x1FFFFFFFFF, 0x3FFFFFFFFF, 0x7FFFFFFFFF, 0xFFFFFFFFFF,
0x1FFFFFFFFFF, 0x3FFFFFFFFFF, 0x7FFFFFFFFFF, 0xFFFFFFFFFFF,
0x1FFFFFFFFFFF, 0x3FFFFFFFFFFF, 0x7FFFFFFFFFFF, 0xFFFFFFFFFFFF,
0x1FFFFFFFFFFFF, 0x3FFFFFFFFFFFF, 0x7FFFFFFFFFFFF, 0xFFFFFFFFFFFFF,
0x1FFFFFFFFFFFFF, 0x3FFFFFFFFFFFFF, 0x7FFFFFFFFFFFFF, 0xFFFFFFFFFFFFFF,
0x1FFFFFFFFFFFFFF, 0x3FFFFFFFFFFFFFF,
0x7FFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFF,
0x1FFFFFFFFFFFFFFF, 0x3FFFFFFFFFFFFFFF,
0x7FFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF
#endif
};
static const char simh_help[] =
/***************** 80 character line width template *************************/
"1Commands\n"
#define HLP_RESET "*Commands Resetting Devices"
/***************** 80 character line width template *************************/
"2Resetting Devices\n"
" The RESET command (abbreviation RE) resets a device or the entire simulator\n"
" to a predefined condition. If switch -p is specified, the device is reset\n"
" to its power-up state:\n\n"
"++RESET reset all devices\n"
"++RESET -p powerup all devices\n"
"++RESET ALL reset all devices\n"
"++RESET <device> reset specified device\n\n"
" Typically, RESET stops any in-progress I/O operation, clears any interrupt\n"
" request, and returns the device to a quiescent state. It does not clear\n"
" main memory or affect I/O connections.\n"
#define HLP_EXAMINE "*Commands Examining_and_Changing_State"
#define HLP_IEXAMINE "*Commands Examining_and_Changing_State"
#define HLP_DEPOSIT "*Commands Examining_and_Changing_State"
#define HLP_IDEPOSIT "*Commands Examining_and_Changing_State"
/***************** 80 character line width template *************************/
"2Examining and Changing State\n"
" There are four commands to examine and change state:\n\n"
"++EXAMINE (abbreviated E) examines state\n"
"++DEPOSIT (abbreviated D) changes state\n"
"++IEXAMINE (interactive examine, abbreviated IE) examines state and allows\n"
"++++the user to interactively change it\n"
"++IDEPOSIT (interactive deposit, abbreviated ID) allows the user to\n"
"++++interactively change state\n\n"
" All four commands take the form\n\n"
"++command {modifiers} <object list>\n\n"
" Deposit must also include a deposit value at the end of the command.\n\n"
" There are four kinds of modifiers: switches, device/unit name, search\n"
" specifier, and for EXAMINE, output file. Switches have been described\n"
" previously. A device/unit name identifies the device and unit whose\n"
" address space is to be examined or modified. If no device is specified,\n"
" the CPU (main memory)is selected; if a device but no unit is specified,\n"
" unit 0 of the device is selected.\n\n"
" The search specifier provides criteria for testing addresses or registers\n"
" to see if they should be processed. A specifier consists of a logical\n"
" operator, a relational operator, or both, optionally separated by spaces.\n\n"
"++{<logical op> <value>} <relational op> <value>\n\n"
/***************** 80 character line width template *************************/
" where the logical operator is & (and), | (or), or ^ (exclusive or), and the\n"
" relational operator is = or == (equal), ! or != (not equal), >= (greater\n"
" than or equal), > (greater than), <= (less than or equal), or < (less than).\n"
" If a logical operator is specified without a relational operator, it is\n"
" ignored. If a relational operator is specified without a logical operator,\n"
" no logical operation is performed. All comparisons are unsigned.\n\n"
" The output file modifier redirects command output to a file instead of the\n"
" console. An output file modifier consists of @ followed by a valid file\n"
" name.\n\n"
" Modifiers may be specified in any order. If multiple modifiers of the\n"
" same type are specified, later modifiers override earlier modifiers. Note\n"
" that if the device/unit name comes after the search specifier, the search\n"
" values will interpreted in the radix of the CPU, rather than of the\n"
" device/unit.\n\n"
" The \"object list\" consists of one or more of the following, separated by\n"
" commas:\n\n"
/***************** 80 character line width template *************************/
"++register the specified register\n"
"++register[sub1-sub2] the specified register array locations,\n"
"++ starting at location sub1 up to and\n"
"++ including location sub2\n"
"++register[sub1/length] the specified register array locations,\n"
"++ starting at location sub1 up to but\n"
"++ not including sub1+length\n"
"++register[ALL] all locations in the specified register\n"
"++ array\n"
"++register1-register2 all the registers starting at register1\n"
"++ up to and including register2\n"
"++address the specified location\n"
"++address1-address2 all locations starting at address1 up to\n"
"++ and including address2\n"
"++address/length all location starting at address up to\n"
"++ but not including address+length\n"
"++STATE all registers in the device\n"
"++ALL all locations in the unit\n"
"++$ the last value displayed by an EXAMINE command\n"
" interpreted as an address\n"
"3Switches\n"
" Switches can be used to control the format of display information:\n\n"
/***************** 80 character line width template *************************/
"++-a display as ASCII\n"
"++-c display as character string\n"
"++-m display as instruction mnemonics\n"
"++-o display as octal\n"
"++-d display as decimal\n"
"++-h display as hexadecimal\n\n"
" The simulators typically accept symbolic input (see documentation with each\n"
" simulator).\n\n"
"3Examples\n"
" Examples:\n\n"
"++ex 1000-1100 examine 1000 to 1100\n"
"++de PC 1040 set PC to 1040\n"
"++ie 40-50 interactively examine 40:50\n"
"++ie >1000 40-50 interactively examine the subset\n"
"++ of locations 40:50 that are >1000\n"
"++ex rx0 50060 examine 50060, RX unit 0\n"
"++ex rx sbuf[3-6] examine SBUF[3] to SBUF[6] in RX\n"
"++de all 0 set main memory to 0\n"
"++de &77>0 0 set all addresses whose low order\n"
"++ bits are non-zero to 0\n"
"++ex -m @memdump.txt 0-7777 dump memory to file\n\n"
" Note: to terminate an interactive command, simply type a bad value\n"
" (eg, XYZ) when input is requested.\n"
#define HLP_EVALUATE "*Commands Evaluating_Instructions"
/***************** 80 character line width template *************************/
"2Evaluating Instructions\n"
" The EVAL command evaluates a symbolic expression and returns the equivalent\n"
" numeric value. This is useful for obtaining numeric arguments for a search\n"
" command:\n\n"
"++EVAL <expression>\n"
/***************** 80 character line width template *************************/
"2Loading and Saving Programs\n"
#define HLP_LOAD "*Commands Loading_and_Saving_Programs LOAD"
"3LOAD\n"
" The LOAD command (abbreviation LO) loads a file in binary loader format:\n\n"
"++LOAD <filename> {implementation options}\n\n"
" The types of formats supported are implementation specific. Options (such\n"
" as load within range) are also implementation specific.\n\n"
#define HLP_DUMP "*Commands Loading_and_Saving_Programs DUMP"
"3DUMP\n"
" The DUMP command (abbreviation DU) dumps memory in binary loader format:\n\n"
"++DUMP <filename> {implementation options}\n\n"
" The types of formats supported are implementation specific. Options (such\n"
" as dump within range) are also implementation specific.\n"
/***************** 80 character line width template *************************/
"2Saving and Restoring State\n"
#define HLP_SAVE "*Commands Saving_and_Restoring_State SAVE"
"3SAVE\n"
" The SAVE command (abbreviation SA) save the complete state of the simulator\n"
" to a file. This includes the contents of main memory and all registers,\n"
" and the I/O connections of devices:\n\n"
"++SAVE <filename>\n\n"
#define HLP_RESTORE "*Commands Saving_and_Restoring_State RESTORE"
"3RESTORE\n"
" The RESTORE command (abbreviation REST, alternately GET) restores a\n"
" previously saved simulator state:\n\n"
"++RESTORE <filename>\n"
"4Switches\n"
" Switches can influence the output and behavior of the RESTORE command\n\n"
"++-Q Suppresses version warning messages\n"
"++-D Suppress detaching and attaching devices during a restore\n"
"++-F Overrides the related file timestamp validation check\n"
"\n"
"4Notes:\n"
" 1) SAVE file format compresses zeroes to minimize file size.\n"
" 2) The simulator can't restore active incoming telnet sessions to\n"
" multiplexer devices, but the listening ports will be restored across a\n"
" save/restore.\n"
/***************** 80 character line width template *************************/
"2Running A Simulated Program\n"
#define HLP_RUN "*Commands Running_A_Simulated_Program RUN"
"3RUN\n"
" The RUN command (abbreviated RU) resets all devices, deposits its argument\n"
" (if given) in the PC, and starts execution. If no argument is given,\n"
" execution starts at the current PC.\n"
#define HLP_GO "*Commands Running_A_Simulated_Program GO"
"3GO\n"
" The GO command does not reset devices, deposits its argument (if given)\n"
" in the PC, and starts execution. If no argument is given, execution\n"
" starts at the current PC.\n"
#define HLP_CONTINUE "*Commands Running_A_Simulated_Program CONTINUE"
"3CONTINUE\n"
" The CONT command (abbreviated CO) does not reset devices and resumes\n"
" execution at the current PC.\n"
#define HLP_STEP "*Commands Running_A_Simulated_Program STEP"
"3STEP\n"
" The STEP command (abbreviated S) resumes execution at the current PC for\n"
" the number of instructions given by its argument. If no argument is\n"
" supplied, one instruction is executed.\n"
"4Switches\n"
" If the STEP command is invoked with the -T switch, the step command will\n"
" cause execution to run for microseconds rather than instructions.\n"
#define HLP_NEXT "*Commands Running_A_Simulated_Program NEXT"
"3NEXT\n"
" The NEXT command (abbreviated N) resumes execution at the current PC for\n"
" one instruction, attempting to execute through a subroutine calls.\n"
" If the next instruction to be executed is not a subroutine call,\n"
" one instruction is executed.\n"
#define HLP_BOOT "*Commands Running_A_Simulated_Program BOOT"
"3BOOT\n"
" The BOOT command (abbreviated BO) resets all devices and bootstraps the\n"
" device and unit given by its argument. If no unit is supplied, unit 0 is\n"
" bootstrapped. The specified unit must be attached.\n"
/***************** 80 character line width template *************************/
"2Stopping The Simulator\n"
" Programs run until the simulator detects an error or stop condition, or\n"
" until the user forces a stop condition.\n"
"3Simulator Detected Stop Conditions\n"
" These simulator-detected conditions stop simulation:\n\n"
"++- HALT instruction. If a HALT instruction is decoded, simulation stops.\n"
"++- Breakpoint. The simulator may support breakpoints (see below).\n"
"++- I/O error. If an I/O error occurs during simulation of an I/O\n"
"+++operation, and the device stop-on-I/O-error flag is set, simulation\n"
"+++usually stops.\n\n"
"++- Processor condition. Certain processor conditions can stop\n"
"+++simulation; these are described with the individual simulators.\n"
"3User Specified Stop Conditions\n"
" Typing the interrupt character stops simulation. The interrupt character\n"
" is defined by the WRU (where are you) console option and is initially set\n"
" to 005 (^E).\n\n"
/***************** 80 character line width template *************************/
#define HLP_BREAK "*Commands Stopping_The_Simulator User_Specified_Stop_Conditions BREAK"
#define HLP_NOBREAK "*Commands Stopping_The_Simulator User_Specified_Stop_Conditions BREAK"
"4Breakpoints\n"
" A simulator may offer breakpoint capability. A simulator may define\n"
" breakpoints of different types, identified by letter (for example, E for\n"
" execution, R for read, W for write, etc). At the moment, most simulators\n"
" support only E (execution) breakpoints.\n\n"
" Associated with a breakpoint are a count and, optionally, one or more\n"
" actions. Each time the breakpoint is taken, the associated count is\n"
" decremented. If the count is less than or equal to 0, the breakpoint\n"
" occurs; otherwise, it is deferred. When the breakpoint occurs, the\n"
" optional actions are automatically executed.\n\n"
" A breakpoint is set by the BREAK or the SET BREAK commands:\n\n"
"++BREAK {-types} {<addr range>{[count]},{addr range...}}{;action;action...}\n"
"++SET BREAK {-types} {<addr range>{[count]},{addr range...}}{;action;action...}\n\n"
" If no type is specified, the simulator-specific default breakpoint type\n"
" (usually E for execution) is used. If no address range is specified, the\n"
" current PC is used. As with EXAMINE and DEPOSIT, an address range may be a\n"
" single address, a range of addresses low-high, or a relative range of\n"
" address/length.\n"
/***************** 80 character line width template *************************/
"5Displaying Breakpoints\n"
" Currently set breakpoints can be displayed with the SHOW BREAK command:\n\n"
"++SHOW {-C} {-types} BREAK {ALL|<addr range>{,<addr range>...}}\n\n"
" Locations with breakpoints of the specified type are displayed.\n\n"
" The -C switch displays the selected breakpoint(s) formatted as commands\n"
" which may be subsequently used to establish the same breakpoint(s).\n\n"
"5Removing Breakpoints\n"
" Breakpoints can be cleared by the NOBREAK or the SET NOBREAK commands.\n"
"5Examples\n"
"++BREAK set E break at current PC\n"
"++BREAK -e 200 set E break at 200\n"
"++BREAK 2000/2[2] set E breaks at 2000,2001 with count = 2\n"
"++BREAK 100;EX AC;D MQ 0 set E break at 100 with actions EX AC and\n"
"+++++++++D MQ 0\n"
"++BREAK 100; delete action on break at 100\n\n"
/***************** 80 character line width template *************************/
"2Connecting and Disconnecting Devices\n"
" Except for main memory and network devices, units are simulated as\n"
" unstructured binary disk files in the host file system. Before using a\n"
" simulated unit, the user must specify the file to be accessed by that unit.\n"
#define HLP_ATTACH "*Commands Connecting_and_Disconnecting_Devices ATTACH"
"3ATTACH\n"
" The ATTACH (abbreviation AT) command associates a unit and a file:\n"
"++ATTACH <unit> <filename>\n\n"
"4Switches\n"
"5-n\n"
" If the -n switch is specified when an attach is executed, a new file is\n"
" created, and an appropriate message is printed.\n"
"5-e\n"
" If the file does not exist, and the -e switch was not specified, a new\n"
" file is created, and an appropriate message is printed. If the -e switch\n"
" was specified, a new file is not created, and an error message is printed.\n"
"5-r\n"
" If the -r switch is specified, or the file is write protected, ATTACH tries\n"
" to open the file read only. If the file does not exist, or the unit does\n"
" not support read only operation, an error occurs. Input-only devices, such\n"
" as paper-tape readers, and devices with write lock switches, such as disks\n"
" and tapes, support read only operation; other devices do not. If a file is\n"
" attached read only, its contents can be examined but not modified.\n"
"5-q\n"
" If the -q switch is specified when creating a new file (-n) or opening one\n"
" read only (-r), the message announcing this fact is suppressed.\n"
"5-f\n"
" For simulated magnetic tapes, the ATTACH command can specify the format of\n"
" the attached tape image file:\n\n"
"++ATTACH -f <tape_unit> <format> <filename>\n\n"
" The currently supported tape image file formats are:\n\n"
"++SIMH SIMH simulator format\n"
"++E11 E11 simulator format\n"
"++TPC TPC format\n"
"++P7B Pierce simulator 7-track format\n\n"
/***************** 80 character line width template *************************/
" For some simulated disk devices, the ATTACH command can specify the format\n"
" of the attached disk image file:\n\n"
"++ATTACH -f <disk_unit> <format> <filename>\n\n"
" The currently supported disk image file formats are:\n\n"
"++SIMH SIMH simulator format\n"
"++VHD Virtual Disk format\n"
"++RAW platform specific access to physical disk or\n"
"++ CDROM drives\n"
" The disk format can also be set with the SET command prior to ATTACH:\n\n"
"++SET <disk_unit> FORMAT=<format>\n"
"++ATT <disk_unit> <filename>\n\n"
/***************** 80 character line width template *************************/
" The format of an attached tape or disk file can be displayed with the SHOW\n"
" command:\n"
"++SHOW <unit> FORMAT\n"
" For Telnet-based terminal emulation devices, the ATTACH command associates\n"
" the master unit with a TCP/IP listening port:\n\n"
"++ATTACH <unit> <port>\n\n"
" The port is a decimal number between 1 and 65535 that is not already used\n"
" other TCP/IP applications.\n"
" For Ethernet emulators, the ATTACH command associates the simulated Ethernet\n"
" with a physical Ethernet device:\n\n"
"++ATTACH <unit> <physical device name>\n"
/***************** 80 character line width template *************************/
#define HLP_DETACH "*Commands Connecting_and_Disconnecting_Devices DETACH"
"3DETACH\n"
" The DETACH (abbreviation DET) command breaks the association between a unit\n"
" and a file, port, or network device:\n\n"
"++DETACH ALL detach all units\n"
"++DETACH <unit> detach specified unit\n"
" The EXIT command performs an automatic DETACH ALL.\n"
"2Controlling Simulator Operating Environment\n"
"3Working Directory\n"
#define HLP_CD "*Commands Controlling_Simulator_Operating_Environment Working_Directory CD"
"4CD\n"
" Set the current working directory:\n"
"++CD path\n"
"4SET_DEFAULT\n"
" Set the current working directory:\n"
"++SET DEFAULT path\n"
#define HLP_PWD "*Commands Controlling_Simulator_Operating_Environment Working_Directory PWD"
"4PWD\n"
"++PWD\n"
" Display the current working directory:\n"
"2Listing Files\n"
#define HLP_DIR "*Commands Listing_Files DIR"
"3DIR\n"
"++DIR {path} list directory files\n"
#define HLP_LS "*Commands Listing_Files LS"
"3LS\n"
"++LS {path} list directory files\n"
"2Displaying Files\n"
#define HLP_TYPE "*Commands Displaying_Files TYPE"
"3TYPE\n"
"++TYPE {file} display a file contents\n"
#define HLP_CAT "*Commands Displaying_Files CAT"
"3CAT\n"
"++CAT {file} display a file contents\n"
#define HLP_SET "*Commands SET"
"2SET\n"
/***************** 80 character line width template *************************/
#define HLP_SET_CONSOLE "*Commands SET CONSOLE"
"3Console\n"
"+set console arg{,arg...} set console options\n"
"+set console WRU specify console drop to simh character\n"
"+set console BRK specify console Break character\n"
"+set console DEL specify console delete character\n"
"+set console PCHAR specify console printable characters\n"
"+set console TELNET=port specify console telnet port\n"
"+set console TELNET=LOG=log_file\n"
"++++++++ specify console telnet logging to the\n"
"++++++++ specified destination {LOG,STDOUT,STDERR,\n"
"++++++++ DEBUG or filename)\n"
"+set console TELNET=NOLOG disables console telnet logging\n"
"+set console TELNET=BUFFERED[=bufsize]\n"
"++++++++ specify console telnet buffering\n"
"+set console TELNET=NOBUFFERED\n"
"++++++++ disables console telnet buffering\n"
"+set console TELNET=UNBUFFERED\n"
"++++++++ disables console telnet buffering\n"
"+set console NOTELNET disable console telnet\n"
"+set console SERIAL=serialport[;config]\n"
"++++++++ specify console serial port and optionally\n"
"++++++++ the port config (i.e. ;9600-8n1)\n"
"+set console NOSERIAL disable console serial session\n"
"+set console LOG=log_file enable console logging to the\n"
"++++++++ specified destination {STDOUT,STDERR,DEBUG\n"
"++++++++ or filename)\n"
"+set console NOLOG disable console logging\n"
/***************** 80 character line width template *************************/
#define HLP_SET_REMOTE "*Commands SET REMOTE"
"3Remote\n"
"+set remote TELNET=port specify remote console telnet port\n"
"+set remote NOTELNET disables remote console\n"
"+set remote CONNECTIONS=n specify number of concurrent remote\n"
"++++++++ console sessions\n"
"+set remote TIMEOUT=n specify number of seconds without input\n"
"++++++++ before automatic continue\n"
"+set remote MASTER enable master mode remote console\n"
"+set remote NOMASTER disable remote master mode console\n"
#define HLP_SET_DEFAULT "*Commands SET Working_Directory"
"3Working Directory\n"
"+set default <dir> set the current directory\n"