Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .data 0x0
- magicNum: .asciiz "P2" #Address 0x00
- newline: .asciiz "\n" #Address 0x03
- newFormat: .asciiz "255" #Address 0x05
- .text 0x3000
- main:
- addi $a1, $0, 10 #load 10 as string limit
- addi $a0, $0, 0x10
- addi $t7, $0, 255 #new max
- addi $v0, $0, 8 #$t0 = read magic value
- syscall
- add $t0, $0, $v0
- addi $v0, $0, 5 #$t1 = columns
- syscall
- add $t1, $0, $v0
- addi $v0, $0, 5 #$t2 = rows
- syscall
- add $t2, $0, $v0
- addi $v0, $0, 5 #$t3 = maxValue
- syscall
- add $t3, $0, $v0
- addi $s0, $0, 3
- mult $s0, $t3
- mflo $s1 #3 * max (denomonator in division)
- ori $v0, $0, 4 #print out "P2"
- addi $a0, $0, 0x00
- syscall
- ori $v0, $0, 4 #print out "New Line"
- addi $a0, $0, 0x03
- syscall
- ori $v0, $0, 1 #print out "Columns"
- add $a0, $0, $t1
- syscall
- ori $v0, $0, 4 #print out "New Line"
- addi $a0, $0, 0x03
- syscall
- ori $v0, $0, 1 #print out "Rows"
- add $a0, $0, $t2
- syscall
- ori $v0, $0, 4 #print out "New Line"
- addi $a0, $0, 0x03
- syscall
- ori $v0, $0, 4 #print out "newFormat"
- addi $a0, $0, 0x05
- syscall
- ori $v0, $0, 4 #print out "New Line"
- addi $a0, $0, 0x03
- syscall
- j rowsLoop
Add Comment
Please, Sign In to add comment