Skip to content

Commit

Permalink
Hamming: improve error reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
keiravillekode committed Jan 19, 2024
1 parent bfd063d commit 92ae376
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 13 deletions.
12 changes: 6 additions & 6 deletions exercises/practice/hamming/.docs/instructions.append.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

## Registers

| Register | Usage | Type | Description |
| -------- | --------- | ------- | ------------------------------ |
| `$a0` | input | address | first, null-terminated, string |
| `$a1` | input | address | first, null-terminated, string |
| `$v0` | output | integer | hamming distance |
| `$t0-9` | temporary | any | for temporary storage |
| Register | Usage | Type | Description |
| -------- | --------- | ------- | ------------------------------- |
| `$a0` | input | address | first, null-terminated, string |
| `$a1` | input | address | second, null-terminated, string |
| `$v0` | output | integer | hamming distance |
| `$t0-9` | temporary | any | for temporary storage |
12 changes: 6 additions & 6 deletions exercises/practice/hamming/impl.mips
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# | Register | Usage | Type | Description |
# | -------- | --------- | ------- | ------------------------------ |
# | `$a0` | input | address | first, null-terminated, string |
# | `$a1` | input | address | first, null-terminated, string |
# | `$v0` | output | integer | hamming distance |
# | `$t0-9` | temporary | any | for temporary storage |
# | Register | Usage | Type | Description |
# | -------- | --------- | ------- | ------------------------------- |
# | `$a0` | input | address | first, null-terminated, string |
# | `$a1` | input | address | second, null-terminated, string |
# | `$v0` | output | integer | hamming distance |
# | `$t0-9` | temporary | any | for temporary storage |

.globl hamming_distance

Expand Down
10 changes: 9 additions & 1 deletion exercises/practice/hamming/runner.mips
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,15 @@ exit_fail:
li $v0, 4 # 4 is print string
syscall

move $a0, $s1 # print input that failed on
move $a0, $s1 # print input that failed on, first strand
li $v0, 4
syscall

la $a0, comma # put address of comma into a0
li $v0, 4 # 4 is print string
syscall

move $a0, $s2 # print input that failed on, second strand
li $v0, 4
syscall

Expand Down

0 comments on commit 92ae376

Please sign in to comment.