diff --git a/inputs/beq.txt b/inputs/beq.txt new file mode 100644 index 0000000..f530cb6 --- /dev/null +++ b/inputs/beq.txt @@ -0,0 +1,7 @@ +50004043 +50005043 +20005801 +00006C42 +80000000 +10002043 +80000000 diff --git a/inputs/bgez.txt b/inputs/bgez.txt new file mode 100644 index 0000000..b548261 --- /dev/null +++ b/inputs/bgez.txt @@ -0,0 +1,6 @@ +30004043 +20001840 +00006C42 +80000000 +10002043 +80000000 diff --git a/inputs/bgezal.txt b/inputs/bgezal.txt new file mode 100644 index 0000000..9b38b33 --- /dev/null +++ b/inputs/bgezal.txt @@ -0,0 +1,7 @@ +30004043 +30001940 +00006C42 +10002442 +80000000 +10002043 +80000000 diff --git a/inputs/bgtz.txt b/inputs/bgtz.txt new file mode 100644 index 0000000..ec9fef1 --- /dev/null +++ b/inputs/bgtz.txt @@ -0,0 +1,6 @@ +30004043 +200008C1 +00006C42 +80000000 +10002043 +80000000 diff --git a/inputs/blez.txt b/inputs/blez.txt new file mode 100644 index 0000000..5bcbe25 --- /dev/null +++ b/inputs/blez.txt @@ -0,0 +1,6 @@ +FFFF4043 +20000881 +00006C42 +80000000 +10002043 +80000000 diff --git a/inputs/bltz.txt b/inputs/bltz.txt new file mode 100644 index 0000000..0270f40 --- /dev/null +++ b/inputs/bltz.txt @@ -0,0 +1,6 @@ +FFFF4043 +20000840 +00006C42 +80000000 +10002043 +80000000 diff --git a/inputs/bltzal.txt b/inputs/bltzal.txt new file mode 100644 index 0000000..432027d --- /dev/null +++ b/inputs/bltzal.txt @@ -0,0 +1,7 @@ +FFFF4043 +20000940 +00006C42 +10002442 +80000000 +10002043 +80000000 diff --git a/inputs/bne.txt b/inputs/bne.txt new file mode 100644 index 0000000..f99f9c8 --- /dev/null +++ b/inputs/bne.txt @@ -0,0 +1,7 @@ +30004043 +50005043 +20005841 +00006C42 +80000000 +10002043 +80000000 diff --git a/inputs/reference.txt b/inputs/reference.txt index ccf229a..b7ae581 100644 --- a/inputs/reference.txt +++ b/inputs/reference.txt @@ -25,20 +25,167 @@ JR $0 00851021 00000008 -register_vo = 8 +register_v0 = 8 == AND Bitwise and == ANDI Bitwise and immediate -BEQ Branch on equal -BGEZ Branch on greater than or equal to zero -BGEZAL Branch on non-negative (>=0) and link -BGTZ Branch on greater than zero -BLEZ Branch on less than or equal to zero -BLTZ Branch on less than zero -BLTZAL Branch on less than zero and link -BNE Branch on not equal + +==BEQ Branch on equal== + +ORI $4,$0,5 +ORI $5,$0,5 +BEQ $4,$5,2 +ADDIU $6,$6,0 +JR $0 +ORI $2,$0,1 +JR $0 + +50004043 +50005043 +20005801 +00006C42 +80000000 +10002043 +80000000 + +register_v0 = 1 + + +==BGEZ Branch on greater than or equal to zero== + +ORI $4,$0,3 +BGEZ $4,2 +ADDIU $6,$6,0 +JR $0 +ORI $2,$0,1 +JR $0 + +30004043 +20001840 +00006C42 +80000000 +10002043 +80000000 + +register_v0 = 1 + +==BGEZAL Branch on non-negative (>=0) and link== + +ORI $4,$0,3 +BGEZAL $4,3 +ADDIU $6,$6,0 +ADDIU $2,$2,1 +JR $0 +ORI $2,$0,1 +JR $31 + +30004043 +30001940 +00006C42 +10002442 +80000000 +10002043 +80000000 + +register_v0 = 2 + + +==BGTZ Branch on greater than zero== + +ORI $4,$0,3 +BGTZ $4,2 +ADDIU $6,$6,0 +JR $0 +ORI $2,$0,1 +JR $0 + +30004043 +200008C1 +00006C42 +80000000 +10002043 +80000000 + +register_v0 = 1 + +==BLEZ Branch on less than or equal to zero== + +ORI $4,$0,-1 +BLEZ $4,2 +ADDIU $6,$6,0 +JR $0 +ORI $2,$0,1 +JR $0 + +FFFF4043 +20000881 +00006C42 +80000000 +10002043 +80000000 + +register_v0 = 1 + +==BLTZ Branch on less than zero== + +ORI $4,$0,-1 +BLTZ $4,2 +ADDIU $6,$6,0 +JR $0 +ORI $2,$0,1 +JR $0 + +FFFF4043 +20000840 +00006C42 +80000000 +10002043 +80000000 + +register_v0 = 1 + +==BLTZAL Branch on less than zero and link== + +ORI $4,$0,-1 +BLTZAL $4,3 +ADDIU $6,$6,0 +ADDIU $2,$2,1 +JR $0 +ORI $2,$0,1 +JR $31 + +FFFF4043 +20000940 +00006C42 +10002442 +80000000 +10002043 +80000000 + +register_v0 = 2 + +==BNE Branch on not equal== + +ORI $4,$0,3 +ORI $5,$0,5 +BNE $4,$5,2 +ADDIU $6, $6, 0 +JR $0 +ORI $2,$0,1 +JR $ + +30004043 +50005043 +20005841 +00006C42 +80000000 +10002043 +80000000 + +register_v0 = 1 + DIV Divide DIVU Divide unsigned J Jump