samedi 18 novembre 2017

I'm having trouble turning this program from an if-else-if statement into a switch statement. Any help would be appreciated

I'm having trouble turning this program from an if-else-if statement into a switch statement. Any help would be appreciated.

public void tick() {
    if (s.word == 0)
        return;

    short t = this.sc.word;
    short d = this.get_opcode();
    short i = this.get_indirect_bit();

    if (t == 0 || t == 1)
        this.instruction_fetch(t);

    if (t == 2)
        this.instruction_decode();

    if (t == 3 && d != 7)
        this.operand_fetch(i);

    if (t > 3 && d != 7)
        this.execute_mri(d, t);

    if (t == 3 && d == 7) {
        this.execute_rri((short) (this.ir.word & 0xFFF));
    }
}

Aucun commentaire:

Enregistrer un commentaire