Hi everyone! I need to complete 2 simple tasks in my course in assembly for Intel 8086, but my code doesnt work. I tried many times to rewrite it, but I wasnt successful. Can anyone help me with fix?
1st task:
"""
8086: byte number to ascii hex digits
Write a program that prints the contents of a byte variable in the form of 2 hexadecimal digits to a terminal.
Define the byte variable bnum90 in the data segment.
Write the two hexadecimal digits of the contents of the variable bnum90 to the terminal. Use lowercase letters to list digits greater than 9. Terminal output (i.e. a pair of hex digits) end ASCII characters CR, LF.
Write a subroutine starting with the label hex7, which will leave only the lower 4 bits, i.e. the numerical value of the hex digit, in the AND instruction register of your choice. You need to convert the numerical value of the digit to a byte of ASCII code (Relevant part in the slides.) eg as follows: If the numerical value of the digit is less than 10, add the ordinal value of the '0' character in the ASCII code to the numerical value of the digit. If the numeric value of the digit is 10 or greater, add the ordinal value of the 'a' character minus 10 to the numeric value of the digit. Keep the ASCII code of the digit character in the same register and return from the subroutine with a RET instruction.
Place the subroutine, for example, after the HLT instruction.
In the program, gradually insert the 4-bit numerical values of the digits into the lower 4 bits of the register of your choice (use the MOV and SHR instructions). Then call the subroutine (with the CALL instruction). Copy the ASCII code of the digit character returned by the subprogram into the memory inside the string that you will write to the terminal. Mark the starting byte of the digit space in the data segment with the label you will use here. Repeat the subroutine call for each digit.
Don't forget the $ character that ends the input string for the int 21h system call.
"""
My code for 1st task:
My result is:
displayed on terminal: 'AB<CR><LF>'
expected: 'ab<CR><LF>'
2nd task:
"""
8
086: unsigned number in an interval
Write a program that determines the relationship of a given value to the limits of an interval of values.
Define the 16-bit variables hod61, min61, and max61 in the data segment.
If the content of the variable hod61 is in the required relation to the interval of values min61 to max61, then write the string yes followed by the characters CR and LF to the terminal. If it is not, then write the string no followed by CR and LF to the terminal.
Let the contents of all three variables be treated as unsigned numbers. It must be true that min61 < max61.
You must verify with the program that
h61 ≤ min61 or max61 ≤ h61
The laboratory will use your data in the first test. Therefore, you must have, for example, set initial values min61 < max61.
"""
To be honest I dont have any idea how to write it at all, can anyone show me?
Thank you all in advance