root/test/unit/getcmdcode/cmd.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. main

   1 #include <stdio.h>
   2 #include "struct.h"
   3 #include "cerr.h"
   4 #include "exec.h"
   5 #include "monitor.h"
   6 
   7 int main(){
   8     int i;
   9     WORD code;
  10     struct CMDCODELIST {
  11         char *cmd;
  12         CMDTYPE type;
  13     } cmdcodelist[] = {
  14         { "LD", NONE }, { "LD", 066 }, { "NOEX", R1_R2 },
  15         { "NOP", NONE }, { "LD", R_ADR_X }, { "ST", R_ADR_X },
  16         { "LAD", R_ADR_X }, { "LD", R1_R2 }, { "ADDA", R_ADR_X },
  17         { "SUBA", R_ADR_X }, { "ADDL", R_ADR_X }, { "SUBL", R_ADR_X },
  18         { "ADDA", R1_R2 }, { "SUBA", R1_R2 }, { "ADDL", R1_R2 },
  19         { "SUBL", R1_R2 }, { "AND", R_ADR_X }, { "OR", R_ADR_X },
  20         { "XOR", R_ADR_X }, { "AND", R1_R2 }, { "OR", R1_R2 },
  21         { "XOR", R1_R2 }, { "CPA", R_ADR_X }, { "CPL", R_ADR_X },
  22         { "CPA", R1_R2 }, { "CPL", R1_R2 }, { "SLA", R_ADR_X },
  23         { "SRA", R_ADR_X }, { "SLL", R_ADR_X }, { "SRL", R_ADR_X },
  24         { "JMI", ADR_X }, { "JNZ", ADR_X }, { "JZE", ADR_X },
  25         { "JUMP", ADR_X }, { "JPL", ADR_X }, { "JOV", ADR_X },
  26         { "PUSH", ADR_X }, { "POP", R_ }, { "CALL", ADR_X },
  27         { "SVC", ADR_X }, { "RET", NONE }
  28     };
  29     create_cmdtable(HASH_CMDTYPE);
  30     cerr_init();
  31     for(i = 0; i < sizeof(cmdcodelist)/sizeof(cmdcodelist[0]); i++) {
  32         code = getcmdcode(cmdcodelist[i].cmd, cmdcodelist[i].type);
  33         printf("%s:0%02o ---> #%04X\n", cmdcodelist[i].cmd, cmdcodelist[i].type, code);
  34         if(cerr->num != 0) {
  35             printf("\terror - %d: %s", cerr->num, cerr->msg);
  36         }
  37     }
  38     freecerr();
  39     free_cmdtable(HASH_CMDTYPE);
  40     return 0;
  41 }

/* [<][>][^][v][top][bottom][index][help] */