944,155 Members | Top Members by Rank

Ad:
  • Assembly Discussion Thread
  • Unsolved
  • Views: 5171
  • Assembly RSS
Mar 24th, 2005
0

Stuck on a program I am working on, converting a ASCII charchter to 7 Bit (MIPS)

Expand Post »
I am working on a program where I need to convert a ASCII charchter to a 7-bit code, eg. 'A' is 65 (decimal) and it would be 1000001

I am not sure how to attack this...
Below is the code I have started with so far, I guess my main question is how do I get the ASCII code entered to a decimal number?


Assembly Syntax (Toggle Plain Text)
  1. .text
  2. .globl __start
  3. __start:
  4.  
  5. # code asking for the input
  6. li $v0, 4
  7. la $a0, ch
  8. syscall
  9.  
  10. # read string syscall to read in a single charchter and newline charchter
  11. la $a0, L
  12. li $a1, 3
  13. li $v0, 8
  14. syscall
  15.  
  16. # store the charchter into a register, t1
  17. li $t0, 0
  18. lw $t1, L($t0)
  19. sw $tl, L
  20.  
  21.  
  22. # at this point I am stuck, how do I convert the ASCII charchter to a decimal number? I have no idea where to even start, the book I have has no examples of this...
  23.  
  24. ...program continues
  25. The next step I need to do is to take the decimal number and use shifting and msaking to get the value of each bit to convert it to a 7 bit binary code.
  26.  
  27. .text
  28. ch: .asciiz "ch? "
  29. L: .space 12

thanks for any help, if there are more details I need to provide just let me know!
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
wernerradio is offline Offline
1 posts
since Mar 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Assembly Forum Timeline: Line Feed issue in assembler using Win XP
Next Thread in Assembly Forum Timeline: HELP!!how to use MASM 611 compiler?





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC