I am taking an Information Systems Architecture class and the teacher has us writing a program in an LC-3 simulator that gets input from the keyboard until the user enters a asterisk, while each time they enter a capitol letter increment some sort of counter variable and then print it off once they enter an asterisk, all in binary.

So far I have written the program so that it gets input from the user, outputs it (just so I can see it) and then subtracts 42 (the ASCII value for the asterisk, via adding a -16, -16, and a -10 ) to see if they entered an asterisk or not. If it is either positive or negative, go back 6 memory locations and run the code again. If it is a zero, then that means they did enter an asterisk and then the program exits.

The trouble I am coming across is being able to determine whether the value they entered is a capitol letter or not. The ASCII value of a capitol A is 65 and Z is 90. I don't know if there is an easy way to check, but what I was thinking about doing is comparing the ASCII value of what the user entered and see if it is less than A (65) or greater than Z (90). If it matches both criteria, then it is definitely a capitol letter. My biggest issue is figuring out how to do this using the LC-3 simulator and in binary.

The binary below is my actual code, but I included so text describing what it is doing as well.

;	do
;		Obtain a character
;		Output a character
;		Check IF character < A
;		Check IF character > Z
;	while character != *

0011 000000000000 	;set x3000 as beginning location
1111 000000100011 	;input obtain a character
1111 000000100001 	;output output a character

0001 000 000 110000 	;Add -16 from R0
0001 000 000 110000	;ADD -16 from R0
0001 000 000 110110	;ADD -10 from R0
0000 101 111111010	;WHILE character !=* branch to loop if negative or positive by Adding -6

1111000000100101 	;halt