fork download
  1. ####################################################
  2. # Examines whether the characters of an ASCII string
  3. # are digits.
  4. ####################################################
  5. .data
  6. hex: .asciiz "0AD5"
  7. digit_str: .asciiz " is a digit\n"
  8. .text
  9.  
  10. main:
  11. #load string
  12. la $t0, hex
  13.  
  14. loop:
  15. #examine characters
  16. lb $t1, 0($t0)
  17. beq $t1, $zero, exit
  18.  
  19. #call routine
  20. move $a0, $t1
  21. jal is_digit
  22.  
  23. #print result
  24. beq $v0, $zero, continue
  25. move $a0, $t1
  26. subi $a0, $a0, 48
  27. li $v0, 1
  28. syscall
  29. la $a0, digit_str
  30. li $v0, 4
  31. syscall
  32.  
  33. continue:
  34. #update counter
  35. addi $t0, $t0, 1
  36. j loop
  37.  
  38. exit:
  39. li $v0, 10
  40. syscall
  41.  
  42.  
  43.  
  44.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
abcd
compilation info
prog.asm:1: error: label or instruction expected at start of line
are digits.:1: error: label or instruction expected at start of line
are digits.:2: error: attempt to define a local label before any non-local labels
are digits.:3: error: parser: instruction expected
are digits.:4: error: parser: instruction expected
are digits.:8: error: label or instruction expected at start of line
are digits.:9: error: parser: instruction expected
are digits.:12: error: label or instruction expected at start of line
are digits.:13: error: parser: instruction expected
are digits.:14: error: parser: instruction expected
are digits.:16: error: label or instruction expected at start of line
are digits.:17: error: parser: instruction expected
are digits.:18: error: parser: instruction expected
are digits.:20: error: label or instruction expected at start of line
are digits.:21: error: symbol `beq' redefined
are digits.:21: error: parser: instruction expected
are digits.:22: error: symbol `move' redefined
are digits.:22: error: parser: instruction expected
are digits.:23: error: parser: instruction expected
are digits.:24: error: parser: instruction expected
are digits.:26: error: symbol `la' redefined
are digits.:26: error: parser: instruction expected
are digits.:27: error: symbol `li' redefined
are digits.:27: error: parser: instruction expected
are digits.:31: error: label or instruction expected at start of line
are digits.:32: error: parser: instruction expected
are digits.:36: error: symbol `li' redefined
are digits.:36: error: parser: instruction expected
ld: cannot find prog.o: No such file or directory
stdout
Standard output is empty