print number in binary MIPS Assembly. Program abruptly ends -


a specific portion of program isn't working properly. supposed print stored decimal value in binary. when debugging, program abruptly ends when finishes 'printzero' branch, @ nop. i'm not sure why. when hits jal puts, doesn't print 0. i'm confused. code below.

andi $a0, $a0, #0 /* reset $a0 */  lw $t0, number  lw $t1, bitmask  andi $t2, $t2, #0 /* reset $t2 */  addi $t2, $t2, #16 /* use our counter */   checkandprintmask:  , $t3, $t1, $t0 beq $t3, $zero, printzero /* branch if zero. else, print 1 */  nop   la $a0, print1  jal puts nop   b done  nop  printzero:  la $a0, print0  jal puts nop  /* (abruptly ends here) */    done:   srl $t1, $t1, 1 addi $t2, $t2, #-1  bgtz $t2, checkandprintmask   .data welcomemessage: .asciiz "welcome converter\n" decimalmessage: .asciiz "the decimal number is: " binarymessage: .asciiz "the binary number is: " number: .word #65535 print0: .asciiz "0"  print1: .asciiz "1"  bitmask: .word 0b1000000000000000  innumericstring: .asciiz "255"  outbinarystring: .asciiz "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz" 


Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -