I have to write a program where the user inputs 2 individual hex values, 0-9 and A-F. The program must then add them and display the result in hex. In the following code I allready took care of 0-9 but now I have to add code where the user can input A-F or a-f. I think that I need to add another loop but I'm stuck on where to put it and how. Any help is apprecdiated.
START: jmp begin
;Our data area starts here
message_1 db 'The first digit please (0 - 9): $'
message_2 db 'The second digit please (0 - 9): $'
message_res db 'The result of the addition is: $'
message_exit db 'Do you wish to do another addition (Y or N)?: $'
first_num db 0
second_num db 0
result db 'xx$'
begin: mov ax, cs ;Beginning of program...Make DS point to CS
mov ds, ax ; since data area is in CS
;Clear the display
goofey: mov ah, 06h ;Scroll up window function
mov al, 0 ; Clear entire window
mov bh, 00011100b ; Display "attribute byte" for cleared area
mov ch, 0 ; Y = 0 (Upper left-hand corner X & Y)
mov cl, 0 ; X = 0
mov dh, 24 ; Y = 24 (Lower right-hand corner X & Y)
mov dl, 79 ; X = 79
int 10h ;Call BIOS procedure to clear the display
;Set cursor position
mov ah, 02h ;Set cursor position function
mov bh, 0 ; Display page 0
mov dh, 10 ; Y = 10 (Row position where Y: 0 -> 24)
mov dl, 10 ; X = 10 (Column position where X: 0 -> 79)
int 10h ;Call BIOS procedure to set the cursor position
;Request first number
mov ah, 09h ;Display string function
mov dx, offset message_1;Pass the starting address of string
int 21h ;Call DOS to display a message
;Get first number
mov ah, 00h ;Read keyboard function
;AL now contains ASCII code of key pressed
mov first_num, al ;Copy the ASCII code of the key pressed
; into the memory location