the one and only truly amazing katster (katster) wrote,
the one and only truly amazing katster

  • Mood:
  • Music:

muah ha ha ha.

Not that you'd understand this, or anything...but here's a program in MIPS assembly to take a keyboard decimal number and turn it into a hexadecimal number. ph33r.

prompt: .asciiz "Give me a number\n"
buffer: .asciiz "0x       "
.globl main

	li $v0,4
	la $a0,prompt

	li $v0,5

	move $a0,$v0

	la $a1, buffer
	addi $a1,$a1, 10
	li $s1,57
	li $t0,8

	andi $t1, $a0, 15
	addi $t1, $t1, 0x30
	ble $t1,$s1, here
	addi $t1,$t1,7
	sb $t1, 0($a1)
	addi $a1,$a1,-1
	srl $a0,$a0,4
	addi $t0,$t0,-1
	bgtz $t0, hexloop

li $v0,4
la $a0,buffer

li $v0,10
syscall incorporate it into my first programming assignment...


  • People I Think Are Quite Keen: Richard and Jennifer Crawford

    (What is this? An Introduction) So, it’s Thursday. Who’s going to get the first nod as a person I happen to think is quite keen? Well,…

  • most awesome birthday weekend ever

    So yeah, this weekend went really well. If I had to ring in the start of another lap around the sun, this is about the way I want to do it. Bear…

  • fried

    So it’s November. November means it’s NaNoWriMo month, which means that I’m running around like a crazy person. Then I stupidly…

  • Post a new comment


    default userpic

    Your reply will be screened

    Your IP address will be recorded 

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.