Homework#1

Deadline: 16 September 2002 at 18.00.
See Homework Submission page for more details about submission and bonus.

In this homework, students are asked to write a simple ASCII code printout program. Your program must use a subroutine called getchar (see more details below) to read one character from the keyboard and printout a binary number of the ASCII code of the character that has been typed in.

For example, if you type "A", the program must print out "01000001" since the ASCII code of "A" is 0x41 (base-16) or 65 (base-10).

You can try an example program to see the output by running:

/home/natawut/hw1
Note that when the program waits for your input, you can type in one character and you must press an "Enter" key.

GETCHAR Subroutine

To use a getchar subroutine, you can call it similar to ".mul" subroutine. The program will wait for an input. The ASCII code of the first character that has been typed in will be returned in register %o0. You can take a look at this sample program...sample1.s.


Natawut Nupairoj - Natawut.N@chula.ac.th