home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / INFO / CROSSASM / 68ASMSIM.ZIP / simsrc / help.c < prev    next >
Encoding:
C/C++ Source or Header  |  1989-04-09  |  11.4 KB  |  314 lines

  1.  
  2. /***************************** 68000 SIMULATOR ****************************
  3.  
  4. File Name: HELP.C
  5. Version: 1.0
  6.  
  7. This file contains the routines to display online help information
  8.  
  9. ***************************************************************************/
  10.  
  11.  
  12.  
  13. #include <stdio.h>
  14. #include "extern.h"
  15.  
  16.  
  17. show_topics()
  18. {
  19.  
  20.     clrscr();
  21.     home();
  22.     printf("BIT_OFF      BIT_ON       Break Points  CHange       CLEAR\n");
  23.     printf("DEC          EX_ON        EX_OFF        EXCeption processing\n");
  24.     printf("EXIT         GO           HELP          HEX          LoaD\n");
  25.     printf("Mem Display  REFRESH      SSOFF         SSTEP        TRACE\n");
  26.     printf("TROFF        VERSION      QUIT to end help.\n");
  27.     printf("\n");
  28.     printf("subtopic ?");
  29.  
  30.     return SUCCESS;
  31.  
  32. }
  33.  
  34. gethelp()
  35. {
  36.     char *sub;
  37.  
  38.     show_topics();
  39.     at (7,12);
  40.     if (wcount > 1)
  41.         sub = gettext(2,"");
  42.     else {
  43.         if (gets(lbuf,80)==NULL)
  44.             exit(0);
  45.         wcount = scan(lbuf,wordptr,10);
  46.         sub = wordptr[0];
  47.         }
  48.  
  49. while (!same("quit",sub))
  50.     {
  51.     show_topics();
  52.     at (10,1);
  53. if (same("exc",sub))
  54.     {
  55.     printf("Exception processing can begin in several different ways.\n");
  56.     printf("Generally, there are three classes of exception conditions:\n");
  57.     printf("\n");
  58.     printf("   Group 0: Reset, Address error, Bus error.\n");
  59.     printf("   Group 1: Trace, Interrupt, Illegal, Privilege violation.\n");
  60.     printf("   Group 2: TRAP, TRAPV, CHK, and Divide by zero.\n");
  61.     printf("\n");
  62.     printf("Reset cannot occur in this simulator.\n");
  63.     printf("Address error occurs when an word or long word is written or\n");
  64.     printf("   read from an odd word boundary.  i.e. an odd memory address.\n");
  65.     printf("Bus error can occur in this simulator by attempting to read\n");
  66.     printf("   or write outside of the virtual memory space.  The virtual\n");
  67.     printf("   memory for this simulator is from location 0 to location\n");
  68.     printf("   0FFF (hex).\n");
  69.     printf("\n");
  70.     printf("Trace is entered if on the completion of an instruction, the\n");
  71.     printf("   trace bit of the status register is on.\n");
  72.     printf("Interrupt occurs when an external device interrupts the\n");
  73.     printf("   processor's operation.  Presently, this cannot occur on\n");
  74.     printf("   this simulator.\n");
  75.     printf("\n");
  76.     printf("<HIT RETURN TO CONTINUE>\n");
  77.     if (gets(lbuf,80)==NULL) exit(0);
  78.     printf("\n");
  79.     printf("Illegal exception occurs when an illegal instruction opcode\n");
  80.     printf("   is executed.  It also occurs when the ILLEGAL instruction\n");
  81.     printf("   is executed.\n");
  82.     printf("Privilege violation occurs when a privileged instruction\n");
  83.     printf("   is attempted and the supervisor bit in the status register\n");
  84.     printf("   is not set.\n");
  85.     printf("\n");
  86.     printf("TRAP exception occurs when a TRAP instruction is executed\n");
  87.     printf("TRAPV exception occurs when a TRAPV instruction is executed\n");
  88.     printf("CHK exception occurs when a CHK instruction is executed\n");
  89.     printf("Divide by zero exception occurs when a DIVU or DIVS instruction\n");
  90.     printf("   attempts a division by zero.\n");
  91.     printf("\n");
  92.     printf("<HIT RETURN TO CONTINUE>\n");
  93.     if (gets(lbuf,80)==NULL) exit(0);
  94.     printf("\n");
  95.     printf("Exception processing begins by creating the appropriate\n");
  96.     printf("   exception stack frame for the particular exception group\n");
  97.     printf("   on the supervisor stack.  Then, the supervisor mode is\n");
  98.     printf("   turned on and trace mode is turned off.  After that,\n");
  99.     printf("   instruction execution resumes at the location referenced\n");
  100.     printf("   by the appropriate exception vector.  The exception vector\n");
  101.     printf("   locations that can be used in this simulator are listed\n");
  102.     printf("   below:\n");
  103.     printf("\n");
  104.     printf("<HIT RETURN TO CONTINUE>\n");
  105.     if (gets(lbuf,80)==NULL) exit(0);
  106.     printf("\n");
  107.     printf("       Location (Hex)        Assignment\n");
  108.     printf("\n");
  109.     printf("           008               Bus error\n");
  110.     printf("           00C               Address error\n");
  111.     printf("           010               Illegal instruction\n");
  112.     printf("           014               Divide by zero\n");
  113.     printf("           018               CHK instruction\n");
  114.     printf("           01C               TRAPV instruction\n");
  115.     printf("           020               Privilege violation\n");
  116.     printf("           024               Trace\n");
  117.     printf("           028               Line 1010 emulator\n");
  118.     printf("           02C               Line 1111 emulator\n");
  119.     printf("        080 to 0BC           TRAP instruction vectors\n");
  120.     printf("\n");
  121.     printf("<HIT RETURN TO CONTINUE>\n");
  122.     if (gets(lbuf,80)==NULL) exit(0);
  123.     printf("\n");
  124.     printf("When the simulator starts up the supervisor bit is set on\n");
  125.     printf("   and the supervisor stack pointer is set to the value\n");
  126.     printf("   F00 (hex).  Note that the stack grows downward, so the\n");
  127.     printf("   stack frame for any exceptions will grow from F00 downward.\n");
  128.     printf("\n");
  129.     printf("For complete information on exception processing, refer to\n");
  130.     printf("   the 68000 Programmer's Reference Manual, Section 4.\n");
  131.     printf("\n");
  132.     printf("<HIT RETURN TO CONTINUE>\n");
  133.     if (gets(lbuf,80)==NULL) exit(0);
  134.     show_topics();
  135.     }
  136. if (same("bp",sub))
  137.     {
  138.     printf("Break Points allows you to set clear and show break points.\n");
  139.     printf("\n");
  140.     printf("sp <loc>  sets a break point at loc.\n");
  141.     printf("dp        displays a list of the break points.\n");
  142.     printf("cp <loc>  clears the break point at loc.\n");
  143.     }
  144. if (same("bit_on",sub))
  145.     {
  146.     printf("bit_on allows you to turn on a specific bit in the status ");
  147.     printf("register");
  148.  
  149.     printf("\n");
  150.     printf("s_on         turns on the supervisor bit\n");
  151.     printf("t_on         turns on the trace bit\n");
  152.     printf("x_on         turns on the extend bit\n");
  153.     printf("n_on         turns on the negative bit\n");
  154.     printf("z_on         turns on the zero bit\n");
  155.     printf("v_on         turns on the overflow bit\n");
  156.     printf("c_on         turns on the carry bit\n");
  157.     }
  158. if (same("bit_off",sub))
  159.     {
  160.     printf("bit_off allows you to turn off a specific bit in the status ");
  161.     printf("register");
  162.  
  163.     printf("\n");
  164.     printf("s_off         turns off the supervisor bit\n");
  165.     printf("t_off         turns off the trace bit\n");
  166.     printf("x_off         turns off the extend bit\n");
  167.     printf("n_off         turns off the negative bit\n");
  168.     printf("z_off         turns off the zero bit\n");
  169.     printf("v_off         turns off the overflow bit\n");
  170.     printf("c_off         turns off the carry bit\n");
  171.     }
  172. if (same("hex",sub))
  173.     {
  174.     printf("Hex allows you to convert a decimal number into hexadecimal");
  175.     printf("    format.\n");
  176.  
  177.     printf("\n");
  178.     printf("hex <number>  shows the number in hexadecimal format.\n");
  179.     printf("              <number> must be input in decimal format.\n");
  180.     }
  181. if (same("dec",sub))
  182.     {
  183.     printf("Dec allows you to convert a hexadecimal number into decimal");
  184.     printf("    format.\n");
  185.  
  186.     printf("\n");
  187.     printf("dec <number>  shows the number in decimal format. <number> must\n");
  188.     printf("              be input in hexadecimal format.\n");
  189.     }
  190. if (same("ch",sub))
  191.     {
  192.     printf("Ch allows you to change the values of elements in the\n");
  193.     printf("    simulator.\n");
  194.     printf("\n");
  195.     printf("D<num> <val>     places val in register D<num>.\n");
  196.     printf("                   <num> is in the range 0 - 7.\n");
  197.     printf("A<num> <val>     places val in A register # num.\n");
  198.     printf("                   <num> is in the range 0 - 8.\n");
  199.     printf("                 NOTE: the supervisor stack pointer (A7') is\n");
  200.     printf("                   referenced as 'A8'.\n");
  201.     printf("PC <val>         places val in the program counter.\n");
  202.     printf("int <val>        places val in the interrupt mask bits of the\n");
  203.     printf("                   status register.  <val> is in the range 0 - 7.\n");
  204.     printf("mem <loc> <val>  places val in location loc.\n");
  205.     printf("io               allows you to modify the port registers.\n");
  206.     }
  207. if (same("clear",sub))
  208.     {
  209.     printf("CLEAR allows you to clear different elements within the processor\n");
  210.     printf("and the simulator.\n");
  211.     printf("\n");
  212.     printf("mem         fills the memory space with zero's.\n");
  213.     printf("reg         fills all the registers with zero's.\n");
  214.     printf("port        clears port.\n");
  215.     printf("int         clears any pending interrupts.\n");
  216.     printf("cy          clears the cycle counter.\n");
  217.     printf("all         clears all of the above items.\n");
  218.     }
  219. if (same("exit",sub))
  220.     {
  221.     printf("EXIT exits the simulator and returns you to the command language.\n");
  222.     }
  223. if (same("go",sub))
  224.     {
  225.     printf("GO starts executing a hector program at the location specified.\n");
  226.     printf("\n");
  227.     printf("go <loc>    start executing at loc.\n");
  228.     }
  229. if (same("help",sub))
  230.     {
  231.     printf("HELP allows access to this help session.\n");
  232.     }
  233. if (same("ld",sub))
  234.     {
  235.     printf("LoaD loads a file from hard disk or floppy disk.\n");
  236.     printf("\n");
  237.     printf("ld <file>   loads ASCII hex file (\".lod\" file\n");
  238.     printf("            produced by the 68000 assembler)\n");
  239.     printf("            into memory.\n");
  240.     }
  241. if (same("md",sub))
  242.     {
  243.     printf("Memory Display allows you to view the contents of a set of\n");
  244.     printf("memory locations.");
  245.     printf("\n");
  246.     printf("md <start> <stop> displays locations between start and stop\n");
  247.     printf("            inclusive. If only a start value is specifed then\n");
  248.     printf("            only that location will be displayed.\n");
  249.     }
  250. if (same("refresh",sub))
  251.     {
  252.     printf("refresh     updates the register set and other\n");
  253.     printf("            on-screen information (such as port registers, SR,\n");
  254.     printf("            and cycles.\n");
  255.     }
  256. if (same("trace",sub))
  257.     {
  258.     printf("trace       turn on trace mode.\n");
  259.     printf("            this activates trace mode while running\n");
  260.     printf("            a program.\n");
  261.     }
  262. if (same("sstep",sub))
  263.     {
  264.     printf("sstep       turns on single stepping mode.\n");
  265.     printf("            this makes the 'go' command run only\n");
  266.     printf("            one instruction at a time.\n");
  267.     }
  268. if (same("ssoff",sub))
  269.     {
  270.     printf("ssoff       turns off single stepping mode.\n");
  271.     printf("            this makes the 'go' command run\n");
  272.     printf("            instructions until one of the following\n");
  273.     printf("            of the following conditions occur :\n");
  274.     printf("               1. the processor encounters a breakpoint,\n");
  275.     printf("               2. an exception condition occurs.\n");
  276.     }
  277. if (same("troff",sub))
  278.     {
  279.     printf("troff       turns off trace mode.\n");
  280.     printf("            this deactivates trace mode while running\n");
  281.     printf("            a program.\n");
  282.     }
  283. if (same("version",sub))
  284.     {
  285.     printf("version     displays the current version number of the simulator.\n");
  286.     }
  287. if (same("ex_on",sub))
  288.     {
  289.     printf("ex_on       enables true exception processing simulation.\n");
  290.     printf("            in this mode, the simulator will respond to\n");
  291.     printf("            exception processing situations as explained under\n");
  292.     printf("            the heading 'EXCeption processing' in the help menu.\n");
  293.     }
  294. if (same("ex_off",sub))
  295.     {
  296.     printf("ex_off      disables true exception processing simulation.\n");
  297.     printf("            this allows easier debugging of programs without\n");
  298.     printf("            the simulator going off to an exception-handling\n");
  299.     printf("            routine if you make a programming mistake.\n");
  300.     }
  301.  
  302.     at (7,12);
  303.     if (gets(lbuf,80)==NULL)
  304.         exit(0);
  305.     wcount = scan(lbuf,wordptr,10);
  306.     sub = wordptr[0];
  307.     }
  308.  
  309. return SUCCESS;
  310.  
  311. }
  312.  
  313.  
  314.