summaryrefslogblamecommitdiffstats
path: root/private/ntos/fw/mips/conftest.c
blob: 78514fe07cb2a0a4ddd01e67d64493e5efc09a49 (plain) (tree)
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




































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































                                                                                                                   
/*++

Copyright (c) 1991  Microsoft Corporation

Module Name:

    conftest.c

Abstract:

    This program tests the ARC configuration functions.

Author:

    David M. Robinson (davidro) 4-Sept-1991

Revision History:

--*/

#include "fwp.h"
#include "jzsetup.h"
#include "oli2msft.h"
#include "inc.h"

#define MAXIMUM_DEVICE_SPECIFIC_DATA 32

PCHAR Banner1 = " JAZZ Configuration Test Program Version 0.15\r\n";
PCHAR Banner2 = " Copyright (c) 1991, 1992  Microsoft Corporation\r\n";

ULONG
CtReadProcessorId(
    VOID
    );


VOID
JzShowTime (
    BOOLEAN First
    )
{
    return;
}


VOID
CtPrintData(
    PCONFIGURATION_COMPONENT Component
    )

/*++

--*/

{
    ARC_STATUS Status;
    MONITOR_CONFIGURATION_DATA MonitorData;  // TEMPTEMP
    EISA_ADAPTER_DETAILS EisaDetails;
    JAZZ_G300_CONFIGURATION_DATA VideoData;  // TEMPTEMP
    PCM_VIDEO_DEVICE_DATA VideoDeviceData;
    PCM_MONITOR_DEVICE_DATA MonitorDeviceData;
    PCM_SONIC_DEVICE_DATA SonicDeviceData;
    PCM_SCSI_DEVICE_DATA ScsiDeviceData;
    PCM_FLOPPY_DEVICE_DATA FloppyDeviceData;
    PCM_SERIAL_DEVICE_DATA SerialDeviceData;
    ULONG LineSize;
    UCHAR Buffer[sizeof(CM_PARTIAL_RESOURCE_LIST) +
                 (sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR) * 5) +
                 MAXIMUM_DEVICE_SPECIFIC_DATA];
    PCM_PARTIAL_RESOURCE_LIST Descriptor = (PCM_PARTIAL_RESOURCE_LIST)&Buffer;
    ULONG Count;
    PCM_PARTIAL_RESOURCE_DESCRIPTOR Partial;
    ULONG Prid;
    BOOLEAN OldData;
    ULONG Version;
    ULONG Index;

    JzPrint("\n\r");

    if (Component == NULL) {
        JzPrint(" NULL component");
        return;
    }

    if (Component->IdentifierLength != 0) {
        JzPrint(" Identifier  = ");
        JzPrint(Component->Identifier);
    }
    JzPrint("\n\r");

    OldData = FALSE;
    switch (Component->Class) {

    case SystemClass:
        JzPrint(" Class       = System\r\n");
        JzPrint(" Type        = ");
        if (Component->Type == ArcSystem) {
            JzPrint("Arc");
        } else {
            JzPrint("Unknown");
        }
        JzPrint("\r\n");
        break;
    case ProcessorClass:
        JzPrint(" Class       = Processor\r\n");
        JzPrint(" Type        = ");

        switch (Component->Type) {
        case CentralProcessor:
            JzPrint("CPU");
            break;

        case FloatingPointProcessor:
            JzPrint("FPU");
            break;

        default:
            JzPrint("Unknown");
            break;
        }
        JzPrint("\r\n");
        JzPrint(" Number      = %d\r\n", Component->Key);

        JzPrint(" Processor   = ");
        Prid = CtReadProcessorId();
        if ((Prid >> 8) != 4) {
            JzPrint("Unknown\r\n");
        } else {
            JzPrint("R4000\r\n");
            JzPrint(" Revision    = %d.%d\r\n", (Prid >> 4) & 0xF, Prid & 0xF);
        }

        break;

    case CacheClass:
        JzPrint(" Class       = Cache\r\n");
        JzPrint(" Type        = ");

        switch (Component->Type) {
        case PrimaryIcache:
            JzPrint("Primary Instruction");
            break;

        case PrimaryDcache:
            JzPrint("Primary Data");
            break;

        case SecondaryIcache:
            JzPrint("Secondary Instruction");
            break;

        case SecondaryDcache:
            JzPrint("Secondary Data");
            break;

        case SecondaryCache:
            JzPrint("Secondary");
            break;

        default:
            JzPrint("Unknown");
            break;

        }

        LineSize = 1 << ((Component->Key & 0xFF0000) >> 16);
        JzPrint("\r\n");
        JzPrint(" Block       = %d\r\n", ((Component->Key & 0xFF000000) >> 24) * LineSize);
        JzPrint(" Line        = %d\r\n", LineSize);
        JzPrint(" Size        = %d\r\n", (1 << (Component->Key & 0xFFFF) << PAGE_SHIFT));
        break;

    case AdapterClass:
        JzPrint(" Class       = Adapter\r\n");
        JzPrint(" Type        = ");

        switch (Component->Type) {
        case EisaAdapter:
            JzPrint("EISA");
            OldData = TRUE;
            break;

        case TcAdapter:
            JzPrint("Turbochannel");
            break;

        case ScsiAdapter:
            JzPrint("SCSI");
            break;

        case DtiAdapter:
            JzPrint("Desktop Interface");
            break;

        case MultiFunctionAdapter:
            JzPrint("Multifunction");
            break;

        default:
            JzPrint("Unknown");
            break;

        }
        JzPrint("\r\n");
        break;

    case ControllerClass:
        JzPrint(" Class       = Controller\r\n");
        JzPrint(" Type        = ");

        switch (Component->Type) {

        case DiskController:
            JzPrint("Disk");
            break;

        case TapeController:
            JzPrint("Tape");
            break;

        case CdromController:
            JzPrint("CDROM");
            break;

        case WormController:
            JzPrint("WORM");
            break;

        case SerialController:
            JzPrint("Serial");
            break;

        case NetworkController:
            JzPrint("Network");
            break;

        case DisplayController:
            OldData = TRUE;
            JzPrint("Display");
            break;

        case ParallelController:
            JzPrint("Parallel");
            break;

        case PointerController:
            JzPrint("Pointer");
            break;

        case KeyboardController:
            JzPrint("Keyboard");
            break;

        case AudioController:
            JzPrint("Audio");
            break;

        case OtherController:
            JzPrint("Other");
            break;

        default:
            JzPrint("Unknown");
            break;

        }
        JzPrint("\r\n");
        break;

    case PeripheralClass:
        JzPrint(" Class       = Peripheral\r\n");
        JzPrint(" Type        = ");

        switch (Component->Type) {

        case DiskPeripheral:
            JzPrint("Disk");
            break;

        case FloppyDiskPeripheral:
            JzPrint("Floppy disk");
            break;

        case TapePeripheral:
            JzPrint("Tape");
            break;

        case ModemPeripheral:
            JzPrint("Modem");
            break;

        case PrinterPeripheral:
            JzPrint("Printer");
            break;

        case KeyboardPeripheral:
            JzPrint("Keyboard");
            break;

        case PointerPeripheral:
            JzPrint("Pointer");
            break;

        case MonitorPeripheral:
            OldData = TRUE;
            JzPrint("Monitor");
            break;

        case TerminalPeripheral:
            JzPrint("Terminal");
            break;

        case OtherPeripheral:
            JzPrint("Other");
            break;

        default:
            JzPrint("Unknown");
            break;

        }
        JzPrint("\r\n");
        break;


    default:
        JzPrint(" Unknown class,");
        break;
    }

    JzPrint(" Key         = %08lx\r\n", Component->Key);
//    JzPrint(" Affinity    = %08lx\r\n", Component->AffinityMask);
    JzPrint(" Flags:\r\n");

    if (Component->Flags.Failed) {
        JzPrint("   Failed\r\n");
    }

    if (Component->Flags.ReadOnly) {
        JzPrint("   ReadOnly\r\n");
    }

    if (Component->Flags.Removable) {
        JzPrint("   Removable\r\n");
    }

    if (Component->Flags.ConsoleIn) {
        JzPrint("   ConsoleIn\r\n");
    }

    if (Component->Flags.ConsoleOut) {
        JzPrint("   ConsoleOut\r\n");
    }

    if (Component->Flags.Input) {
        JzPrint("   Input\r\n");
    }

    if (Component->Flags.Output) {
        JzPrint("   Output\r\n");
    }

    JzPrint("\r\n");

    if (!OldData &&
        (Component->ConfigurationDataLength != 0) &&
        (Component->ConfigurationDataLength < sizeof(Buffer))) {

        Status = ArcGetConfigurationData( Descriptor, Component );
        if ((Status != ESUCCESS) || (Descriptor->Count > 10)) {
            JzPrint(" Error reading configuration data");
        } else {
            JzPrint(" Version %d.%d\r\n", Descriptor->Version, Descriptor->Revision);
            Version = Descriptor->Version * 100 + Descriptor->Revision;
            for (Count = 0 ; Count < Descriptor->Count ; Count++ ) {
                Partial = &Descriptor->PartialDescriptors[Count];
                switch (Partial->Type) {
                case CmResourceTypePort:
                    JzPrint(" Port Config -- %08lx - %08lx\r\n",
                              Partial->u.Port.Start.LowPart,
                              Partial->u.Port.Start.LowPart +
                              Partial->u.Port.Length - 1);
                    break;
                case CmResourceTypeInterrupt:
                    JzPrint(" Interrupt Config -- ");
                    if (Partial->Flags & CM_RESOURCE_INTERRUPT_LEVEL_SENSITIVE) {
                        JzPrint(" Level triggered,");
                    } else {
                        JzPrint(" Edge triggered,");
                    }
                    JzPrint(" Irql = ");
                    switch (Partial->u.Interrupt.Level) {
                    case DEVICE_LEVEL:
                        JzPrint("DEVICE_LEVEL");
                        break;
                    case PASSIVE_LEVEL:
                        JzPrint("PASSIVE_LEVEL");
                        break;
                    case APC_LEVEL:
                        JzPrint("APC_LEVEL");
                        break;
                    case DISPATCH_LEVEL:
                        JzPrint("DISPATCH_LEVEL");
                        break;
                    case IPI_LEVEL:
                        JzPrint("IPI_LEVEL");
                        break;
                    case HIGH_LEVEL:
                        JzPrint("HIGH_LEVEL");
                        break;
                    default:
                        JzPrint("Unknown level");
                    }
                    JzPrint(", Vector = %08lx\r\n", Partial->u.Interrupt.Vector);
                    break;
                case CmResourceTypeMemory:
                    JzPrint(" Memory Config -- %08lx - %08lx\r\n",
                              Partial->u.Memory.Start.LowPart,
                              Partial->u.Memory.Start.LowPart +
                              Partial->u.Memory.Length - 1);
                    break;
                case CmResourceTypeDma:
                    JzPrint(" DMA Config -- Channel = %d\r\n",
                              Partial->u.Dma.Channel);
                    break;
                case CmResourceTypeDeviceSpecific:
                    switch (Component->Class) {

                    case AdapterClass:
                        switch (Component->Type) {
                        case ScsiAdapter:
                            ScsiDeviceData = (PCM_SCSI_DEVICE_DATA)&Descriptor->PartialDescriptors[Count+1];
                            JzPrint(" Scsi Host Identifier = %d\r\n",
                                       ScsiDeviceData->HostIdentifier);
                            break;
                        default:
                            break;
                        }

                    case ControllerClass:
                        switch (Component->Type) {
                        case DisplayController:
                            VideoDeviceData = (PCM_VIDEO_DEVICE_DATA)&Descriptor->PartialDescriptors[Count+1];
                            JzPrint(" Video Clock = %d\r\n",
                                       VideoDeviceData->VideoClock);
                            break;
                        case NetworkController:
                            SonicDeviceData = (PCM_SONIC_DEVICE_DATA)&Descriptor->PartialDescriptors[Count+1];
                            JzPrint(" Sonic Data Configuration Register = %04x\r\n",
                                      SonicDeviceData->DataConfigurationRegister);
                            if (Version >= 101) {
                                JzPrint(" Sonic Ethernet Address  = ");
                                for (Index = 0; Index < 6 ; Index++) {
                                    JzPrint("%02lx", SonicDeviceData->EthernetAddress[Index]);
                                }
                                JzPrint("\r\n");
                                JzPrint(" Sonic Ethernet Checksum = ");
                                for (Index = 6; Index < 8 ; Index++) {
                                    JzPrint("%02lx", SonicDeviceData->EthernetAddress[Index]);
                                }
                                JzPrint("\r\n");

                            }
                            break;

                        case SerialController:
                            SerialDeviceData = (PCM_SERIAL_DEVICE_DATA)&Descriptor->PartialDescriptors[Count+1];
                            JzPrint(" Serial Baud Clock = %d\r\n",
                                      SerialDeviceData->BaudClock);
                            break;

                        default:
                            break;
                        }
                        break;

                    case PeripheralClass:

                        switch (Component->Type) {

                        case FloppyDiskPeripheral:
                            FloppyDeviceData = (PCM_FLOPPY_DEVICE_DATA)&Descriptor->PartialDescriptors[Count+1];
                            JzPrint(" Floppy data:\n\r");
                            JzPrint("   Size       = %s\n\r", FloppyDeviceData->Size);
                            JzPrint("   MaxDensity = %d Kb\n\r", FloppyDeviceData->MaxDensity);
                            break;

                        case MonitorPeripheral:
                            MonitorDeviceData = (PCM_MONITOR_DEVICE_DATA)&Descriptor->PartialDescriptors[Count+1];
                            JzPrint(" Monitor data:\n\r");
                            JzPrint("   HorizontalResolution  = %d\n\r", MonitorDeviceData->HorizontalResolution);
                            JzPrint("   HorizontalDisplayTime = %d\n\r", MonitorDeviceData->HorizontalDisplayTime);
                            JzPrint("   HorizontalBackPorch   = %d\n\r", MonitorDeviceData->HorizontalBackPorch);
                            JzPrint("   HorizontalFrontPorch  = %d\n\r", MonitorDeviceData->HorizontalFrontPorch);
                            JzPrint("   HorizontalSync        = %d\n\r", MonitorDeviceData->HorizontalSync);
                            JzPrint("   VerticalResolution    = %d\n\r", MonitorDeviceData->VerticalResolution);
                            JzPrint("   VerticalBackPorch     = %d\n\r", MonitorDeviceData->VerticalBackPorch);
                            JzPrint("   VerticalFrontPorch    = %d\n\r", MonitorDeviceData->VerticalFrontPorch);
                            JzPrint("   VerticalSync          = %d\n\r", MonitorDeviceData->VerticalSync);
                            JzPrint("   HorizontalScreenSize  = %d\n\r", MonitorDeviceData->HorizontalScreenSize);
                            JzPrint("   VerticalScreenSize    = %d\n\r", MonitorDeviceData->VerticalScreenSize);
                            break;

                        default:
                            break;
                        }
                        break;

                    default:
                        break;
                    }
                    break;

                default:
                    JzPrint(" Unknown data\r\n");
                    break;
                }
            }
        }
    } else {
        if (OldData) {
            if (Component->Type == DisplayController) {
                Status = ArcGetConfigurationData( &VideoData, Component);
                if (Status != ESUCCESS) {
                    JzPrint(" Error reading video configuration data");
                } else {
                    JzPrint(" Video controller data:\n\r");
                    JzPrint("   Irql        = %d\n\r", VideoData.Irql);
                    JzPrint("   Vector      = %d\n\r", VideoData.Vector);
                    JzPrint("   ControlBase = %08xl\n\r", VideoData.ControlBase);
                    JzPrint("   ControlSize = %d\n\r", VideoData.ControlSize);
                    JzPrint("   CursorBase  = %08xl\n\r", VideoData.CursorBase);
                    JzPrint("   CursorSize  = %d\n\r", VideoData.CursorSize);
                    JzPrint("   FrameBase   = %08xl\n\r", VideoData.FrameBase);
                    JzPrint("   FrameSize   = %d\n\r", VideoData.FrameSize);
                }
            } else if (Component->Type == MonitorPeripheral) {
                Status = ArcGetConfigurationData( &MonitorData, Component);
                if (Status != ESUCCESS) {
                    JzPrint(" Error reading monitor configuration data");
                } else {
                    JzPrint(" Monitor data:\n\r");
                    JzPrint("   HorizontalResolution  = %d\n\r", MonitorData.HorizontalResolution);
                    JzPrint("   HorizontalDisplayTime = %d\n\r", MonitorData.HorizontalDisplayTime);
                    JzPrint("   HorizontalBackPorch   = %d\n\r", MonitorData.HorizontalBackPorch);
                    JzPrint("   HorizontalFrontPorch  = %d\n\r", MonitorData.HorizontalFrontPorch);
                    JzPrint("   HorizontalSync        = %d\n\r", MonitorData.HorizontalSync);
                    JzPrint("   VerticalResolution    = %d\n\r", MonitorData.VerticalResolution);
                    JzPrint("   VerticalBackPorch     = %d\n\r", MonitorData.VerticalBackPorch);
                    JzPrint("   VerticalFrontPorch    = %d\n\r", MonitorData.VerticalFrontPorch);
                    JzPrint("   VerticalSync          = %d\n\r", MonitorData.VerticalSync);
                    JzPrint("   HorizontalScreenSize  = %d\n\r", MonitorData.HorizontalScreenSize);
                    JzPrint("   VerticalScreenSize    = %d\n\r", MonitorData.VerticalScreenSize);
                }
            } else if (Component->Type == EisaAdapter) {
                Status = ArcGetConfigurationData( &EisaDetails, Component);
                if (Status != ESUCCESS) {
                    JzPrint(" Error reading Eisa bus data");
                } else {
                    JzPrint(" Eisa Details:\n\r");
                    JzPrint("   Number of slots       = %d\n\r", EisaDetails.NumberOfSlots);
                    JzPrint("   Io start address      = %08lx\n\r", EisaDetails.IoStart);
                    JzPrint("   Io size               = %lx\n\r", EisaDetails.IoSize);
                }
            }
        }
    }
    return;
}

VOID
main(
    int argc,
    char *argv[],
    char *envp[]
    )
{
    ULONG Index;
    UCHAR Character;
    ULONG Count;
    LONG DefaultChoice = 0;
    ARC_STATUS Status;
    CHAR PathName[80];
    PCONFIGURATION_COMPONENT Component;
    PCONFIGURATION_COMPONENT NewComponent;
    PSYSTEM_ID SystemId;
    BOOLEAN Update;
    PMEMORY_DESCRIPTOR MemoryDescriptor;
    GETSTRING_ACTION Action;
    PCHAR Choices[] = {
        "Walk through the configuration tree",
        "Enter a pathname and display the configuration data",
        "Display memory configuration",
        "Test Unicode",
        "Other ARC Tests",
        "Exit"
    };
#define NUMBER_OF_CHOICES (sizeof(Choices) / sizeof(ULONG))
    ULONG Fid;
    ULONG CrLf;
    ULONG Space;
    ULONG i, j;
    BOOLEAN Unicode;
    PARC_DISPLAY_STATUS DisplayStatus;
    ULONG x, y;

    while (TRUE) {

        JzSetScreenAttributes( TRUE, FALSE, FALSE);
        JzPrint("%c2J", ASCII_CSI);
        JzSetPosition( 0, 0);
        JzPrint(Banner1);
        JzPrint(Banner2);

        for (Index = 0; Index < NUMBER_OF_CHOICES ; Index++ ) {
            JzSetPosition( Index + 3, 5);
            if (Index == DefaultChoice) {
                JzSetScreenAttributes( TRUE, FALSE, TRUE);
                JzPrint(Choices[Index]);
                JzSetScreenAttributes( TRUE, FALSE, FALSE);
            } else {
                JzPrint(Choices[Index]);
            }
        }

        JzSetPosition(NUMBER_OF_CHOICES + 4, 0);
        SystemId = ArcGetSystemId();
        JzPrint(" System = ");
        JzPrint(&SystemId->VendorId[0]);
        JzPrint("\r\n");
        JzPrint(" Serial = %8lx\r\n", SystemId->ProductId);

        Character = 0;
        do {
            if (ArcGetReadStatus(ARC_CONSOLE_INPUT) == ESUCCESS) {
                ArcRead(ARC_CONSOLE_INPUT, &Character, 1, &Count);
                switch (Character) {

                case ASCII_ESC:
                    return;

                case ASCII_CSI:
                    ArcRead(ARC_CONSOLE_INPUT, &Character, 1, &Count);
                    JzSetPosition( DefaultChoice + 3, 5);
                    JzPrint(Choices[DefaultChoice]);
                    switch (Character) {
                    case 'A':
                    case 'D':
                        DefaultChoice--;
                        if (DefaultChoice < 0) {
                            DefaultChoice = NUMBER_OF_CHOICES-1;
                        }
                        break;
                    case 'B':
                    case 'C':
                        DefaultChoice++;
                        if (DefaultChoice == NUMBER_OF_CHOICES) {
                            DefaultChoice = 0;
                        }
                        break;
                    case 'H':
                        DefaultChoice = 0;
                        break;
                    default:
                        break;
                    }
                    JzSetPosition( DefaultChoice + 3, 5);
                    JzSetScreenAttributes( TRUE, FALSE, TRUE);
                    JzPrint(Choices[DefaultChoice]);
                    JzSetScreenAttributes( TRUE, FALSE, FALSE);
                    continue;

                default:
                    break;
                }
            }

        } while ((Character != '\n') && (Character != '\r'));

        switch (DefaultChoice) {

        case 0:

            Component = ArcGetChild(NULL);
            NewComponent = Component;
            Character = 0;
            do {

                JzSetPosition( 3, 5);
                JzPrint("\x9BJ");
                JzPrint("Use arrow keys to walk the tree, ESC to return");
                JzPrint("\n\r\n\r");

                CtPrintData(Component);
                Update = FALSE;
                do {
                    if (ArcGetReadStatus(ARC_CONSOLE_INPUT) == ESUCCESS) {
                        ArcRead(ARC_CONSOLE_INPUT, &Character, 1, &Count);
                        switch (Character) {

                        case ASCII_CSI:
                            ArcRead(ARC_CONSOLE_INPUT, &Character, 1, &Count);
                            switch (Character) {
                            case 'A':
                                NewComponent = ArcGetParent(Component);
                                Update = TRUE;
                                break;

                            case 'B':
                                NewComponent = ArcGetChild(Component);
                                Update = TRUE;
                                break;

                            case 'C':
                                NewComponent = ArcGetPeer(Component);
                                Update = TRUE;
                                break;

                            case 'D':
                                NewComponent = ArcGetParent(Component);
                                NewComponent = ArcGetChild(NewComponent);
                                while ((NewComponent != NULL) &&
                                       (ArcGetPeer(NewComponent) != Component)) {
                                    NewComponent = ArcGetPeer(NewComponent);
                                }
                                Update = TRUE;
                                break;

                            default:
                                break;

                            }

                            if (NewComponent != NULL) {
                                Component = NewComponent;
                            }

                        default:
                            break;
                        }
                    }
                } while (!Update && (Character != ASCII_ESC));
            } while ((Character != ASCII_ESC));
            break;

        case 1:

            JzSetPosition( 3, 5);
            JzPrint("\x9BJ");
            JzPrint("Enter component pathname: ");
            do {
                Action = FwGetString( PathName,
                                      sizeof(PathName),
                                      NULL,
                                      3,
                                      sizeof("   Enter component pathname: "));

                if (Action == GetStringEscape) {
                    break;
                }

            } while ( Action != GetStringSuccess );
            if (Action == GetStringEscape) {
                continue;
            }
            JzPrint("\n\r");

            Component = ArcGetComponent(PathName);

            CtPrintData(Component);

            JzPrint(" Press any key to continue...");
            ArcRead(ARC_CONSOLE_INPUT, &Character, 1, &Count);
            continue;

        case 2:

            MemoryDescriptor = ArcGetMemoryDescriptor(NULL);
            while (MemoryDescriptor != NULL) {

                JzSetPosition( 3, 5);
                JzPrint("\x9BJ");

                JzPrint("Memory type  = ");
                switch (MemoryDescriptor->MemoryType) {
                case MemoryExceptionBlock:
                    JzPrint("ExceptionBlock");
                    break;
                case MemorySystemBlock:
                    JzPrint("SystemBlock");
                    break;
                case MemoryFree:
                    JzPrint("Free");
                    break;
                case MemoryBad:
                    JzPrint("Bad");
                    break;
                case MemoryLoadedProgram:
                    JzPrint("LoadedProgram");
                    break;
                case MemoryFirmwareTemporary:
                    JzPrint("FirmwareTemporary");
                    break;
                case MemoryFirmwarePermanent:
                    JzPrint("FirmwarePermanent");
                    break;
                default:
                    JzPrint("Unknown");
                    break;
                }

                JzSetPosition( 4, 5);
                JzPrint("Base Page  = %08lx", MemoryDescriptor->BasePage);
                JzSetPosition( 5, 5);
                JzPrint("Page Count = %d", MemoryDescriptor->PageCount);
                JzSetPosition( 6,5);


                JzPrint(" Press any key to continue, ESC to return");
                ArcRead(ARC_CONSOLE_INPUT, &Character, 1, &Count);
                if (Character == ASCII_ESC) {
                    break;
                }

                MemoryDescriptor = ArcGetMemoryDescriptor(MemoryDescriptor);
            }
            break;

        case 3:

            JzPrint("\r\n\r\n");
            CrLf = (ASCII_CR << 16) + ASCII_LF;
            Space = ' ';

            ArcClose(ARC_CONSOLE_OUTPUT);
            ArcOpen("multi()video()monitor()console(1)",ArcOpenWriteOnly,&Fid);
            for (j = 0; j < 16 ; j++ ) {
                for (i = 0 ; i < 9 ; i++ ) {
                    Index = 0x2500 + (i << 4) + j;
                    ArcWrite(ARC_CONSOLE_OUTPUT, &Space, 2, &Count);
                    ArcWrite(ARC_CONSOLE_OUTPUT, &Index, 2, &Count);
                }
                ArcWrite(ARC_CONSOLE_OUTPUT, &CrLf, 4, &Count);
            }
            ArcClose(ARC_CONSOLE_OUTPUT);
            ArcOpen("multi()video()monitor()console()",ArcOpenWriteOnly,&Fid);

            JzPrint("\r\nPress any key to continue");
            ArcRead(ARC_CONSOLE_INPUT, &Character, 1, &Count);


            ArcClose(ARC_CONSOLE_INPUT);
            ArcOpen("multi()key()keyboard()console(1)",ArcOpenReadOnly,&Fid);
            ArcOpen("multi()video()monitor()console(1)",ArcOpenWriteOnly,&Fid);

            do {
                JzPrint("\r\nPress any key, ESC to stop: ");
                ArcRead(ARC_CONSOLE_INPUT, &Index, 2, &Count);
                ArcWrite(Fid, &Index, 2, &Count);
            } while ( Index != ASCII_ESC );

            JzPrint("  \r\n Searching for valid Unicode ranges...");

            Unicode = FALSE;
            for (Index = 0; Index < 0xffff ; Index++ ) {
                if (ArcTestUnicodeCharacter(Fid, (WCHAR)Index) == ESUCCESS) {
                    if (!Unicode) {
                        JzPrint("\r\n Start = %04lx, ", Index);
                        Unicode = TRUE;
                    }
                } else {
                    if (Unicode) {
                        JzPrint("End = %04lx, ", Index);
                        Unicode = FALSE;
                    }
                }
            }

            ArcClose(Fid);
            ArcClose(ARC_CONSOLE_INPUT);
            ArcOpen("multi()key()keyboard()console()",ArcOpenWriteOnly,&Fid);

            JzPrint("\r\nPress any key to continue");
            ArcRead(ARC_CONSOLE_INPUT, &Character, 1, &Count);

            break;

        case 4:

            DisplayStatus = ArcGetDisplayStatus(ARC_CONSOLE_OUTPUT);

            x = (DisplayStatus->CursorMaxXPosition / 2) - 24;
            y = (DisplayStatus->CursorMaxYPosition / 2) - 7;

            JzSetPosition(y++,x);

            JzPrint("ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»");

            for (Index = 0; Index < 10 ; Index++ ) {
                JzSetPosition(y++,x);
                JzPrint("º                                              º");
            }
            JzSetPosition(y++,x);
            JzPrint("ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ");

            x = (DisplayStatus->CursorMaxXPosition / 2) - 23;
            y = (DisplayStatus->CursorMaxYPosition / 2) - 6;

            JzSetPosition(y++,x);
            JzSetScreenColor(ArcColorCyan,ArcColorBlack);

            JzPrint("ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»");

            for (Index = 0; Index < 6 ; Index++ ) {
                JzSetPosition(y++,x);
                JzPrint("º                                            º");
            }
            JzSetPosition(y++,x);
            JzPrint("ÇÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄĶ");
            JzSetPosition(y++,x);
            JzPrint("º                                            º");
            JzSetPosition(y++,x);
            JzPrint("ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ");

            x = (DisplayStatus->CursorMaxXPosition / 2) - 22;
            y = (DisplayStatus->CursorMaxYPosition / 2) - 5;
            JzSetPosition(y++,x);

            DisplayStatus = ArcGetDisplayStatus(ARC_CONSOLE_OUTPUT);

            JzPrint("X Cursor = %d", DisplayStatus->CursorXPosition);
            JzSetPosition(y++,x);
            JzPrint("Y Cursor = %d", DisplayStatus->CursorYPosition);
            JzSetPosition(y++,x);
            JzPrint("Max X Cursor = %d", DisplayStatus->CursorMaxXPosition);
            JzSetPosition(y++,x);
            JzPrint("Max Y Cursor = %d", DisplayStatus->CursorMaxYPosition);


            JzSetPosition(y++,x);
            JzPrint("Press any key to continue...");
            ArcRead(ARC_CONSOLE_INPUT, &Character, 1, &Count);

            for (Index = 0; Index < argc ; Index++ ) {
                JzPrint("\r\n Argument #%d = ", Index);
                JzPrint(argv[Index]);
            }

            if (argc == 0) {
                JzPrint("\r\n No arguments");
            }

            JzPrint("\r\n Press any key to continue...");
            ArcRead(ARC_CONSOLE_INPUT, &Character, 1, &Count);

            break;

        case 5:
            return;

        default:
            continue;
        }
    }
}