Computer Systems Organization I - Prof. Grishman

Assignment #3

Write an LC-3 program which will convert a number from the ASCII encoding of its hexadecimal value to a binary value.  The input will be a sequence of one to four ASCII characters, each either '0' through '9' or 'A' through 'F' (upper case only).  Each character will be stored in the low-order seven bits of a word;  the sequence will be terminated by a full zero word.  You may assume that the input is correct (no invalid digits;  no more than four hex digits).

The program should contain two lines with labels "INPUT" (a character string) and "OUTPUT" (a single word);  for example,
      INPUT  .STRINGZ  "12AB"
      OUTPUT .FILL     0
We will test the program by modifying the string at INPUT and seeing if you produce the correct value at OUTPUT.

Enter the program in assembly language, with comments as appropriate.  Also include your name as a comment.  Terminate the program with an infinite loop.

Submit your program (.asm file) by email, as an attachment, to the e-tutor, Ian Lau <>, by one minute before midnight on Thursday, October 14th. (Late assignments will be penalized 1/2 point for each day late, out of a total of 5 points.) Label your email "CSO Asgn 3".

For 10% (0.5 points) extra credit, allow a leading '#' character to indicate that the number is in decimal rather than binary  (For example, "#12" would be converted to 00000000000011002 while "12" would be converted to 00000000000100102.)