answersLogoWhite

0


Best Answer

There should be a jump over the variables/array declaration:

org 100h

jmp code

myArray dw 2, 12, 8, 52, 108

code: mov si, 0

mov ax, myArray[si]

ret

For the computer all bytes look the same, it cannot determine if it's an instruction or a variable. Here is an example of MOV AL, 5 instruction that can be coded with simple variable declarations:

org 100h

byte1 db 176

byte2 db 5

ret

When you run this program in emulator you can see that bytes 176 and 5 are actually assembled into:

MOV AL, 5

This is very typical for Von Neumann Architecture to keep data and instructions in the same memory, It's even possible to write complete program by using only DB (define byte) directive.

org 100h

db 235 ; jump...

db 6 ; 6 - six bytes forward (need to skip characters)

db 72 ; ascii code of 'H'

db 101 ; ascii code of 'e'

db 108 ; ascii code of 'l'

db 108 ; ascii code of 'l'

db 111 ; ascii code of 'o'

db 36 ; ascii code of '$' - DOS function prints until dollar.

db 186 ; mov DX, .... - DX is word = two bytes

db 2 ; 02 - little end

db 1 ; 01 - big end

db 180 ; mov AH, ....

db 9 ; 09

db 205 ; int ...

db 33 ; 21h - 33 is 21h (hexadecimal)

db 195 ; ret - stop the program.

8086 and all other Intel's microprocessors store the least significant byte at a lower address. 102h is the address of 'H' character = org 100h + 2 bytes (jmp instruction). The above assembly code produces identical machine code to this little program:

org 100h

jmp code

msg db 'Hello$'

code: mov DX, offset msg

mov AH, 9

int 21h

ret

If you open the produced ".com" file in any hex editor you can see hexadecimal values, every byte takes two hexadecimal digits, for example 235 = EB, etc... memory window of the emulator shows both hexadecimal and decimal values.

User Avatar

Wiki User

12y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Write a programme in 8086 assembly language that accepts two input digits and creates a packed BCD number in AL register?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is meta assembler?

Meta-assembler is a program that accepts the syntactic and semantic description of an assembly language, and generates an assembler for that language.


What is a meta assembler?

Meta-assembler is a program that accepts the syntactic and semantic description of an assembly language, and generates an assembler for that language.


Write a program in 8086 assembly language that accepts two input characters pack two characters in one word and store them in consecutive locating in a memory buffer The first address of buffer is 400?

develop and test an assembly language to convert a two digit BCD number to binary


What converts mnemonics to machine level languages?

Assembler However, because the computer does not understand mnemonics, we utilise Assembler to convert them into machine language. Assembler is a machine code translator that accepts assembly code as input and outputs machine code. To learn more about data science please visit- Learnbay.co


What is the output of a compiler?

A compiler accepts computer instructions in a language people understand and converts them into a language computers understand.


What is a speech synthesizer?

A speech synthesizer is a computer-based technology that converts text input into spoken language output. It uses algorithms to generate voice sounds that mimic natural human speech, enabling text-to-speech functionality in devices such as computers, smartphones, and smart speakers.


Do KLM accept air miles?

Yes, KLM accepts air miles. Please see this website: http://airmiles.klm.com/airmiles/ KLM, Air France, Kenya Airways and Air Europa also have they own "Flying Blue" Frequent Flyer programme, please see: http://www.klm.com/travel/nl_en/flying_blue/programme/index.htm


How to design a DFA that accepts an identifier in c language?

letter -> [a-zA-Z] digit -> [0-9] identifier -> letter|_(letter|digit|_)


What does the acronym SQL stand for?

SQL stands for Structured Query Language as it refers to the type of database query or database server which accepts the query.


How do you Write a program in 'c' language which accepts int numbers from the users print its reverse number x function which return value?

question clarity


How many words are there in the world's largest language?

It's difficult to determine the exact number of words in any language, including the world's largest language, English. English has one of the largest vocabularies of any language, with estimates of over 1 million words, including technical terms and jargon.


What is the plural of accept?

The plural of "accept" is "accepts."