• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Intel 8086 - assembly code

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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:

"""
8086: 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
 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey I just posted something similar for CMa assembly help. I am not sure if we are allowed to leave comments like these, but I looked at your question and although interesting, I am lost on my own CMa assembly code question.
 
John Griner
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I did see this when researching my question " the 8085 moy with it's 14 bit address is capable of addressing 2^14 = 16, 384 memory location. However, after reading your question I can see that it is much more involved.
 
Marshal
Posts: 79978
397
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

John Griner wrote:Hey I just posted something similar . . .

Here it is.
 
What's a year in metric? Do you know this metric stuff tiny ad?
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic