wernerradio 0 Newbie Poster

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?

.text
.globl __start
__start:

# code asking for the input
li $v0, 4
la $a0, ch
syscall

# read string syscall to read in a single charchter and newline charchter
la $a0, L
li $a1, 3
li $v0, 8
syscall

# store the charchter into a register, t1
li $t0, 0
lw $t1, L($t0)
sw $tl, L


# 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...

...program continues
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.

.text
ch: .asciiz "ch? "
L: .space 12

thanks for any help, if there are more details I need to provide just let me know!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.