Code:
add // add registers addi // add immediate sub lui // load upper immediate and andi or ori xor xori nor sll // shift left logical srl // shift right logical sra // shift right arithmetic lw // load word lh // load half word lb // load byte sw // store word sh sb beq // branch on equal bne // branch on not equal blt // branch on less than ble // branch on less than or equal j // jump jal // jump and link jr // jump register
addi r1, r0, 1 // add 1 to zero register, store in r1
addi r2, r0, 1 // add 1 to zero register, store in r2
add r3, r2, r1 // add r1 and r2, store in r3
sb r3 0(r1) // store contents of r3 to memory address 1 (r1 = 1 and dpl = 0)
I may be completely off track with this so please tell me if it looks weird. Also, if you have any ideas about slightly more complex programs (that use a branching instruction, for example) I'd greatly appreciate your suggestions.


