Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- switch(opinf&0xFF){
- case 0:{
- // *******
- // * ADC *
- // *******
- // Add with carry.
- readout("Add value at address " + addr + " to Accumulator");
- break;
- }case 1:{
- // *******
- // * AND *
- // *******
- // AND memory with accumulator.
- readout("AND operation between " + addr + " and Accumulator (stored to Accumulator)");
- break;
- }case 2:{
- // *******
- // * ASL *
- // *******
- // Shift left one bit
- if(addrMode == 4){ // ADDR_ACC = 4
- readout("Shift the value in Accumulator left one bit");
- }else{
- readout("Shift the value at " + addr + " left one bit");
- }
- break;
- }case 3:{
- // *******
- // * BCC *
- // *******
- // Branch on carry clear
- readout("Jump to instruction at address " + addr + " if carry bit is 0");
- break;
- }case 4:{
- // *******
- // * BCS *
- // *******
- // Branch on carry set
- readout("Jump to instruction at address " + addr + " if carry bit is 1");
- break;
- }case 5:{
- // *******
- // * BEQ *
- // *******
- // Branch on zero
- readout("Jump to instruction at address " + addr + " if last operation evaluated to 0");
- break;
- }case 6:{
- // *******
- // * BIT *
- // *******
- temp = this.load(addr);
- this.F_SIGN = (temp>>7)&1;
- this.F_OVERFLOW = (temp>>6)&1;
- temp &= this.REG_ACC;
- this.F_ZERO = temp;
- readout("?");
- break;
- }case 7:{
- // *******
- // * BMI *
- // *******
- // Branch on negative result
- readout("Jump to instruction at address " + addr + " if last operation returned negative");
- break;
- }case 8:{
- // *******
- // * BNE *
- // *******
- // Branch on not zero
- readout("Jump to instruction at address " + addr + " if last operation did not evaluate to 0");
- break;
- }case 9:{
- // *******
- // * BPL *
- // *******
- // Branch on positive result
- readout("Jump to instruction at address " + addr + " if last operation returned positive");
- break;
- }case 10:{
- // *******
- // * BRK *
- // *******
- readout("Break; push CPU status and program counter to the stack");
- break;
- }case 11:{
- // *******
- // * BVC *
- // *******
- // Branch on overflow clear
- readout("Jump to instruction at address " + addr + " if overflow bit is 0");
- break;
- }case 12:{
- // *******
- // * BVS *
- // *******
- // Branch on overflow set
- readout("Jump to instruction at address " + addr + " if overflow bit is 1");
- break;
- }case 13:{
- // *******
- // * CLC *
- // *******
- // Clear carry flag
- readout("Set carry bit to 0");
- break;
- }case 14:{
- // *******
- // * CLD *
- // *******
- // Clear decimal flag
- readout("Disable decimal mode");
- break;
- }case 15:{
- // *******
- // * CLI *
- // *******
- // Clear interrupt flag
- readout("Enable interrupts");
- break;
- }case 16:{
- // *******
- // * CLV *
- // *******
- // Clear overflow flag
- readout("Clear overflow flag bit");
- break;
- }case 17:{
- // *******
- // * CMP *
- // *******
- // Compare memory and accumulator:
- readout("Test: set carry to 1 if Accumulator >= value at " + addr + "; else 0");
- break;
- }case 18:{
- // *******
- // * CPX *
- // *******
- // Compare memory and index X:
- readout("Test: set carry to 1 if X-index >= value at " + addr + "; else 0");
- break;
- }case 19:{
- // *******
- // * CPY *
- // *******
- // Compare memory and index Y:
- readout("Test: set carry to 1 if Y-index >= value at " + addr + "; else 0");
- break;
- }case 20:{
- // *******
- // * DEC *
- // *******
- // Decrement memory by one:
- readout("Value at " + addr + " - 1");
- break;
- }case 21:{
- // *******
- // * DEX *
- // *******
- // Decrement index X by one:
- readout("X-index - 1");
- break;
- }case 22:{
- // *******
- // * DEY *
- // *******
- // Decrement index Y by one:
- readout("Y-index - 1");
- break;
- }case 23:{
- // *******
- // * EOR *
- // *******
- // XOR Memory with accumulator, store in accumulator:
- readout("Exclusive OR (XOR) operation between " + addr + " and Accumulator (stored to Accumulator)");
- break;
- }case 24:{
- // *******
- // * INC *
- // *******
- // Increment memory by one:
- readout("Value at " + addr + " + 1");
- break;
- }case 25:{
- // *******
- // * INX *
- // *******
- // Increment index X by one:
- readout("X-index + 1");
- break;
- }case 26:{
- // *******
- // * INY *
- // *******
- // Increment index Y by one:
- readout("Y-index + 1");
- break;
- }case 27:{
- // *******
- // * JMP *
- // *******
- // Jump to new location:
- readout("Jump to instruction at address " + addr);
- break;
- }case 28:{
- // *******
- // * JSR *
- // *******
- // Jump to new location, saving return address.
- // Push return address on stack:
- readout("Call subroutine at address " + addr + " (program counter address saved to stack)");
- break;
- }case 29:{
- // *******
- // * LDA *
- // *******
- // Load accumulator with memory:
- readout("Jump to instruction at address " + addr);
- break;
- }case 30:{
- // *******
- // * LDX *
- // *******
- // Load index X with memory:
- readout("Load value at " + addr + " into X-index");
- break;
- }case 31:{
- // *******
- // * LDY *
- // *******
- // Load index Y with memory:
- readout("Load value at " + addr + " into Y-index");
- break;
- }case 32:{
- // *******
- // * LSR *
- // *******
- // Shift right one bit:
- if(addrMode == 4){ // ADDR_ACC
- readout("Shift the value in Accumulator right one bit");
- }else{
- readout("Shift the value at address " + addr + " right one bit");
- }
- break;
- }case 33:{
- // *******
- // * NOP *
- // *******
- // No OPeration.
- // Ignore.
- readout("* no operation *");
- break;
- }case 34:{
- // *******
- // * ORA *
- // *******
- // OR memory with accumulator, store in accumulator.
- readout("OR operation between value at address " + addr + " and Accumulator (stored to Accumulator)");
- break;
- }case 35:{
- // *******
- // * PHA *
- // *******
- // Push accumulator on stack
- readout("Save value of Accumulator to the stack");
- break;
- }case 36:{
- // *******
- // * PHP *
- // *******
- // Push processor status on stack
- readout("Save the CPU status to the stack");
- break;
- }case 37:{
- // *******
- // * PLA *
- // *******
- // Pull accumulator from stack
- readout("Read the bottom of the stack into the Accumulator");
- break;
- }case 38:{
- // *******
- // * PLP *
- // *******
- // Pull processor status from stack
- readout("Read the CPU status from the bottom of the stack");
- break;
- }case 39:{
- // *******
- // * ROL *
- // *******
- // Rotate one bit left
- if(addrMode == 4){ // ADDR_ACC = 4
- readout("Rotate the value in Accumulator left one bit");
- }else{
- readout("Rotate the value at " + addr + " left one bit");
- }
- break;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement