TopicReporter::TopicReporter(Gateway* gateway1, Gateway* gateway2, Gateway* gateway3, Gateway* gateway4) { gateways[0] = gateway1; gateways[1] = gateway2; gateways[2] = gateway3; gateways[3] = gateway4; numberOfGateways = not0(gateway1) + not0(gateway2) + not0(gateway3) + not0(gateway4); }
int run(cpu *pcpu) { char byte; pcpu->fl = CPU_CLEAN; if ((byte = get_byte(pcpu->ip)) < 0) { pcpu->fl = CPU_ERROR; pcpu->ip++; return -1; } //printf("Cel id-> %d, byte : 0x%x, at IP: %s\n",pcpu->pcel->id ,byte, decodificar(get_byte(pcpu->ip))); //show_regs(pcpu,0); switch(byte) { case 0X00 : nop0(pcpu); break; case 0X01 : nop1(pcpu); break; case 0X02 : pushax(pcpu); break; case 0X03 : pushbx(pcpu); break; case 0X04 : pushcx(pcpu); break; case 0X05 : pushdx(pcpu); break; case 0X06 : popax(pcpu); break; case 0X07 : popbx(pcpu); break; case 0X08 : popcx(pcpu); break; case 0X09 : popdx(pcpu); break; case 0X0a : movcd(pcpu); break; case 0X0b : movab(pcpu); break; case 0X0c : movii(pcpu); break; case 0X0d : sub_ab(pcpu); break; case 0X0e : sub_ac(pcpu); break; case 0X0f : inc_a(pcpu); break; case 0X10 : inc_b(pcpu); break; case 0X11 : dec_c(pcpu); break; case 0X12 : inc_c(pcpu); break; case 0X13 : zero(pcpu); break; case 0X14 : not0(pcpu); break; case 0X15 : shl(pcpu); break; case 0X16 : ifz(pcpu); break; case 0X17 : jmp(pcpu); break; case 0X18 : jmpb(pcpu); break; case 0X19 : call(pcpu); break; case 0X1a : ret(pcpu); break; case 0X1b : adr(pcpu); break; case 0X1c : adrb(pcpu); break; case 0x1d : adrf(pcpu); break; case 0X1e : mal(pcpu); break; case 0X1f : divide(pcpu); break; //default:printf("CPU: Instruccion No Encontrada!\n");break; } return 0; }