I have a four part homework assignment for class and I dont know where to begin. I believe if I can get help with this first part then i can disasemble the input code for the output code i will post the question now.

Input (Trap x26): A Trap routine (invoked as TRAP x26) that reads a 4-digit hex from the keyboard and returns the value in R0. This trap may call other traps. You will develop this trap routine and locate it in memory at address x6000. This routine must meet the following requirements

Input Routine (Trap x26)
4-hex digit input: Your project must include an input routine that reads a 4-hex digit input. It must properly translate the ASCII inputs into a 16-bit value returned in R0.
Error checking: Your input routine should verify that the input consist of exactly 4 hexadecimal characters. It should accept uppercase ASCII characters for the hex digits A-F. If an error is detected, the routine must return the value x0000. (You can earn 2 extra-credit points for correctly accepting either upper or lower case A-F digits.)

I havent got the ASCII to Hex conversion done nor do I have the correct code for input. This is what I have so far just for basic ASCII input from the keyboard.

.ORIG x6000
AND R0, R0, #0 ; clear R0
AND R1, R1, #0 ; clear R1
AND R2, R2, #0 ; clear R2
AND R3, R3, #0 ; clear R3
LEA R0, Prompt ; Starting address of prompt string
PUTS
LEA R1, saveAt
GETC
OUT
STR R0, R1, #0
ADD R1, R1, #1

ADD R4, R0, #-13
BRp test

test GETC
OUT
STR R0, R1, #0
ADD R1, R1, #1

ADD R4, R0, #-13
BRp test

LEA R0, Echo ; loads string
PUTS ; Echos String
LEA R0, saveAt ; loads the word entered
PUTS

HALT

Prompt .STRINGZ "Enter Starting Adress without x:"
Echo .STRINGZ " "

saveAt .BLKW 5;

.END