Want to learn and master MIPS Assembly?

Join Exercism’s MIPS Assembly Track for access to 47 exercises with automatic analysis of your code and personal mentoring, all 100% free.

Explore exercises

About MIPS Assembly

# Convert ascii string of binary digits to integer
#
# $a0 - input, pointer to null-terminated string of 1's and 0's
# $v0 - output, integer form of binary string
# $t0 - ascii value of the char pointed to
# $t1 - integer value (0 or 1) of the char pointed to

.globl binary_convert

binary_convert:
        li      $v0, 0                  # Reset accumulator to 0.

loop:
        lb      $t0, 0($a0)             # Load a character,
        beq     $t0, $zero, end         # if it is null then return.
        sll     $v0, $v0, 1             # Otherwise shift accumulator left,
        addi    $t1, $t0, -48           # calculate the value of the character,
        or      $v0, $v0, $t1           # and add that to the accumulator.
        addi    $a0, $a0, 1             # Finally, increment the pointer
        j       loop                    # and loop.

end:
        jr $ra

Key Features of MIPS Assembly


MIPS Assembly

Easy to Learn

MIPS is a simple assembly language, used in university computer architecture courses.

Widely Used

MIPS is at the core of billions of shipped products.

Extensive documentation

MIPS is widely documented, particulaly in academic texts on computer architecture.

Fast

Fast execution speed, via compact instructions, has been a key feature since its inception.

Small

As a RISC-based assembly language, it boasts a small, orthogonal instruction set.

Stable

MIPS first appeared in 1985, evolved to meet new challenges, and has been stable since 2014.

Get mentored the MIPS Assembly way

Every language has its own way of doing things. MIPS Assembly is no different. Our mentors will help you learn to think like a MIPS Assembly developer and how to write idiomatic code in MIPS Assembly. Once you've solved an exercise, submit it to our volunteer team, and they'll give you hints, ideas, and feedback on how to make it feel more like what you'd normally see in MIPS Assembly - they'll help you discover the things you don't know that you don't know.

Learn more about mentoring

Community-sourced MIPS Assembly exercises

The MIPS Assembly track on Exercism has 47 exercises to help you write better code. Discover new exercises as you progress and get engrossed in learning new concepts and improving the way you currently write.

See all MIPS Assembly exercises
MIPS Assembly

Get started with the MIPS Assembly track

The best part, it’s 100% free for everyone.