Advertisement
Guest User

Untitled

a guest
Aug 27th, 2010
291
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 10.73 KB | None | 0 0
  1.        switch(opinf&0xFF){
  2.             case 0:{
  3.                 // *******
  4.                 // * ADC *
  5.                 // *******
  6.  
  7.                 // Add with carry.
  8.             readout("Add value at address " + addr + " to Accumulator");            
  9.                 break;
  10.  
  11.           }case 1:{
  12.                 // *******
  13.                 // * AND *
  14.                 // *******
  15.  
  16.                 // AND memory with accumulator.
  17.             readout("AND operation between " + addr + " and Accumulator (stored to Accumulator)");
  18.                 break;
  19.             }case 2:{
  20.                 // *******
  21.                 // * ASL *
  22.                 // *******
  23.  
  24.                 // Shift left one bit
  25.                 if(addrMode == 4){ // ADDR_ACC = 4
  26.  
  27.             readout("Shift the value in Accumulator left one bit");
  28.  
  29.                 }else{
  30.  
  31.             readout("Shift the value at " + addr + " left one bit");
  32.  
  33.                 }
  34.                 break;
  35.  
  36.             }case 3:{
  37.  
  38.                 // *******
  39.                 // * BCC *
  40.                 // *******
  41.  
  42.                 // Branch on carry clear
  43.  
  44.             readout("Jump to instruction at address " + addr + " if carry bit is 0");
  45.                 break;
  46.  
  47.             }case 4:{
  48.  
  49.                 // *******
  50.                 // * BCS *
  51.                 // *******
  52.  
  53.                 // Branch on carry set
  54.  
  55.             readout("Jump to instruction at address " + addr + " if carry bit is 1");
  56.          
  57.                 break;
  58.  
  59.             }case 5:{
  60.  
  61.                 // *******
  62.                 // * BEQ *
  63.                 // *******
  64.  
  65.                 // Branch on zero
  66.             readout("Jump to instruction at address " + addr + " if last operation evaluated to 0");
  67.                 break;
  68.  
  69.             }case 6:{
  70.  
  71.                 // *******
  72.                 // * BIT *
  73.                 // *******
  74.  
  75.                 temp = this.load(addr);
  76.                 this.F_SIGN = (temp>>7)&1;
  77.                 this.F_OVERFLOW = (temp>>6)&1;
  78.                 temp &= this.REG_ACC;
  79.                 this.F_ZERO = temp;
  80.             readout("?");
  81.                 break;
  82.  
  83.  
  84.             }case 7:{
  85.  
  86.                 // *******
  87.                 // * BMI *
  88.                 // *******
  89.  
  90.                 // Branch on negative result
  91.             readout("Jump to instruction at address " + addr + " if last operation returned negative");
  92.                 break;
  93.  
  94.             }case 8:{
  95.  
  96.                 // *******
  97.                 // * BNE *
  98.                 // *******
  99.  
  100.                 // Branch on not zero
  101.             readout("Jump to instruction at address " + addr + " if last operation did not evaluate to 0");
  102.                 break;
  103.  
  104.             }case 9:{
  105.  
  106.                 // *******
  107.                 // * BPL *
  108.                 // *******
  109.  
  110.                 // Branch on positive result
  111.             readout("Jump to instruction at address " + addr + " if last operation returned positive");
  112.                 break;
  113.  
  114.             }case 10:{
  115.  
  116.                 // *******
  117.                 // * BRK *
  118.                 // *******
  119.            
  120.             readout("Break; push CPU status and program counter to the stack");
  121.                 break;
  122.  
  123.             }case 11:{
  124.  
  125.                 // *******
  126.                 // * BVC *
  127.                 // *******
  128.  
  129.                 // Branch on overflow clear
  130.             readout("Jump to instruction at address " + addr + " if overflow bit is 0");
  131.                 break;
  132.  
  133.             }case 12:{
  134.  
  135.                 // *******
  136.                 // * BVS *
  137.                 // *******
  138.  
  139.                 // Branch on overflow set
  140.             readout("Jump to instruction at address " + addr + " if overflow bit is 1");
  141.                 break;
  142.  
  143.             }case 13:{
  144.  
  145.                 // *******
  146.                 // * CLC *
  147.                 // *******
  148.  
  149.                 // Clear carry flag
  150.             readout("Set carry bit to 0");
  151.                 break;
  152.  
  153.             }case 14:{
  154.  
  155.                 // *******
  156.                 // * CLD *
  157.                 // *******
  158.  
  159.                 // Clear decimal flag
  160.             readout("Disable decimal mode");
  161.                 break;
  162.  
  163.             }case 15:{
  164.  
  165.                 // *******
  166.                 // * CLI *
  167.                 // *******
  168.  
  169.                 // Clear interrupt flag
  170.             readout("Enable interrupts");
  171.                 break;
  172.  
  173.             }case 16:{
  174.  
  175.                 // *******
  176.                 // * CLV *
  177.                 // *******
  178.  
  179.                 // Clear overflow flag
  180.             readout("Clear overflow flag bit");
  181.                 break;
  182.  
  183.             }case 17:{
  184.  
  185.                 // *******
  186.                 // * CMP *
  187.                 // *******
  188.  
  189.                 // Compare memory and accumulator:
  190.             readout("Test: set carry to 1 if Accumulator >= value at " + addr + "; else 0");
  191.                 break;
  192.  
  193.             }case 18:{
  194.  
  195.                 // *******
  196.                 // * CPX *
  197.                 // *******
  198.  
  199.                 // Compare memory and index X:
  200.             readout("Test: set carry to 1 if X-index >= value at " + addr + "; else 0");
  201.                 break;
  202.  
  203.             }case 19:{
  204.  
  205.                 // *******
  206.                 // * CPY *
  207.                 // *******
  208.  
  209.                 // Compare memory and index Y:
  210.             readout("Test: set carry to 1 if Y-index >= value at " + addr + "; else 0");
  211.                 break;
  212.  
  213.             }case 20:{
  214.  
  215.                 // *******
  216.                 // * DEC *
  217.                 // *******
  218.  
  219.                 // Decrement memory by one:
  220.             readout("Value at " + addr + " - 1");
  221.                 break;
  222.  
  223.             }case 21:{
  224.  
  225.                 // *******
  226.                 // * DEX *
  227.                 // *******
  228.  
  229.                 // Decrement index X by one:
  230.             readout("X-index - 1");
  231.                 break;
  232.  
  233.             }case 22:{
  234.  
  235.                 // *******
  236.                 // * DEY *
  237.                 // *******
  238.  
  239.                 // Decrement index Y by one:
  240.             readout("Y-index - 1");
  241.                 break;
  242.  
  243.             }case 23:{
  244.  
  245.                 // *******
  246.                 // * EOR *
  247.                 // *******
  248.  
  249.                 // XOR Memory with accumulator, store in accumulator:
  250.             readout("Exclusive OR (XOR) operation between " + addr + " and Accumulator (stored to Accumulator)");
  251.                 break;
  252.  
  253.             }case 24:{
  254.  
  255.                 // *******
  256.                 // * INC *
  257.                 // *******
  258.  
  259.                 // Increment memory by one:
  260.             readout("Value at " + addr + " + 1");
  261.                 break;
  262.  
  263.             }case 25:{
  264.  
  265.                 // *******
  266.                 // * INX *
  267.                 // *******
  268.  
  269.                 // Increment index X by one:
  270.             readout("X-index + 1");
  271.                 break;
  272.  
  273.             }case 26:{
  274.  
  275.                 // *******
  276.                 // * INY *
  277.                 // *******
  278.  
  279.                 // Increment index Y by one:
  280.             readout("Y-index + 1");
  281.                 break;
  282.  
  283.             }case 27:{
  284.  
  285.                 // *******
  286.                 // * JMP *
  287.                 // *******
  288.  
  289.                 // Jump to new location:
  290.             readout("Jump to instruction at address " + addr);
  291.                 break;
  292.  
  293.             }case 28:{
  294.  
  295.                 // *******
  296.                 // * JSR *
  297.                 // *******
  298.  
  299.                 // Jump to new location, saving return address.
  300.                 // Push return address on stack:
  301.             readout("Call subroutine at address " + addr + " (program counter address saved to stack)");
  302.                 break;
  303.  
  304.             }case 29:{
  305.  
  306.                 // *******
  307.                 // * LDA *
  308.                 // *******
  309.  
  310.                 // Load accumulator with memory:
  311.             readout("Jump to instruction at address " + addr);
  312.                 break;
  313.  
  314.             }case 30:{
  315.  
  316.                 // *******
  317.                 // * LDX *
  318.                 // *******
  319.  
  320.                 // Load index X with memory:
  321.             readout("Load value at " + addr + " into X-index");
  322.                 break;
  323.  
  324.             }case 31:{
  325.  
  326.                 // *******
  327.                 // * LDY *
  328.                 // *******
  329.  
  330.                 // Load index Y with memory:
  331.             readout("Load value at " + addr + " into Y-index");
  332.                 break;
  333.  
  334.             }case 32:{
  335.  
  336.                 // *******
  337.                 // * LSR *
  338.                 // *******
  339.  
  340.                 // Shift right one bit:
  341.                 if(addrMode == 4){ // ADDR_ACC
  342.  
  343.             readout("Shift the value in Accumulator right one bit");
  344.                 }else{
  345.  
  346.             readout("Shift the value at address " + addr + " right one bit");
  347.                 }
  348.                 break;
  349.  
  350.             }case 33:{
  351.  
  352.                 // *******
  353.                 // * NOP *
  354.                 // *******
  355.  
  356.                 // No OPeration.
  357.                 // Ignore.
  358.             readout("* no operation *");
  359.                 break;
  360.  
  361.             }case 34:{
  362.  
  363.                 // *******
  364.                 // * ORA *
  365.                 // *******
  366.  
  367.                 // OR memory with accumulator, store in accumulator.
  368.             readout("OR operation between value at address " + addr + " and Accumulator (stored to Accumulator)");
  369.                 break;
  370.  
  371.             }case 35:{
  372.  
  373.                 // *******
  374.                 // * PHA *
  375.                 // *******
  376.  
  377.                 // Push accumulator on stack
  378.             readout("Save value of Accumulator to the stack");
  379.                 break;
  380.  
  381.             }case 36:{
  382.  
  383.                 // *******
  384.                 // * PHP *
  385.                 // *******
  386.  
  387.                 // Push processor status on stack
  388.             readout("Save the CPU status to the stack");
  389.                 break;
  390.  
  391.             }case 37:{
  392.  
  393.                 // *******
  394.                 // * PLA *
  395.                 // *******
  396.  
  397.                 // Pull accumulator from stack
  398.             readout("Read the bottom of the stack into the Accumulator");
  399.                 break;
  400.  
  401.             }case 38:{
  402.  
  403.                 // *******
  404.                 // * PLP *
  405.                 // *******
  406.  
  407.                 // Pull processor status from stack
  408.             readout("Read the CPU status from the bottom of the stack");
  409.                 break;
  410.  
  411.             }case 39:{
  412.  
  413.                 // *******
  414.                 // * ROL *
  415.                 // *******
  416.  
  417.                 // Rotate one bit left
  418.                 if(addrMode == 4){ // ADDR_ACC = 4
  419.  
  420.             readout("Rotate the value in Accumulator left one bit");
  421.  
  422.                 }else{
  423.  
  424.             readout("Rotate the value at " + addr + " left one bit");
  425.                 }
  426.                 break;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement