Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

created P4 assembly file a. Still needs work though because not sure …

…how to handle jalr and jr.
  • Loading branch information...
commit 614e67fdf7bdfb2eeed07f04d11bba2ce92160f0 1 parent 1fa9bfc
@rascheel rascheel authored
Showing with 47 additions and 0 deletions.
  1. +47 −0 B/src/P4/P4a.asm
  2. BIN  MARS/Mars_4_2.jar
47 B/src/P4/P4a.asm
@@ -0,0 +1,47 @@
+addi $t1, $zero, 15
+add $t2, $t1, $t1
+addiu $t3, $t1, 5
+addu $t4, $t3, $t2
+and $t1, $t2, $t1
+andi $t2, $t2, 0xFFFF
+and $t1, $t2, $t1
+#skip branch and j instructions
+lb $t7, 0($t2)
+lbu $t7, 0($t2)
+lh $t7, 0($t2)
+lhu $t7, 0($t2)
+lui $t1, 1000
+lw $t7, 2($t1)
+mul $t3, $t1, $t2
+nor $t3, $t1, $t2
+or $t3, $t1, $t2
+ori $t3, $t1, 0x0000
+sb $t2, 0($t1)
+sh $t2, 0($t1)
+sll $t2, $t2, 1
+slti $t3, $t2, 100
+sltiu $t3, $t2, 100
+sltu $t3, $t2, $t1
+sra $t3, $t2, 1
+srav $t3, $t1, $t2
+srl $t3, $t1, 2
+srlv $t3, $t1, $t2
+sub $t3, $t1, $t2
+subu $t3, $t1, $t2
+sw $t1, 0($t1)
+xor $t3, $t1, $t2
+xori $t3, $t1, $t2
+beq $t1, $t2, L_beq
+L_beq: bgez $zero, L_bgez
+L_bgez: bgezal $zero, L_bgezal
+L_bgezal: bgtz $zero, L_bgtz
+L_bgtz: blez $zero, L_blez
+L_blez: bltz $zero, L_bltz
+L_bltz: bltzal $zero, L_bltzal
+L_bltzal: bne $t1, $t2, L_bne
+L_bne: j L_j
+L_j: jal L_jal
+L_jal: jalr $t1 #change these because they are jumping to register 1, need to set register 1 to something that makes sense
+L_jr: jr $t1 #same problem as above
BIN  MARS/Mars_4_2.jar
Binary file not shown
Please sign in to comment.
Something went wrong with that request. Please try again.