answersLogoWhite

0

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

13y ago

What else can I help you with?

Continue Learning about Engineering
Related Questions

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.


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.


8086 assembly language that accepts two input digits?

In 8086 assembly language, you can accept two input digits by using interrupts to read from the keyboard. You would typically use the INT 21h service with function 01h to read a character, storing each digit in a register or memory location. After reading both digits, you can convert them from ASCII to their numeric values by subtracting 30h from each character. This allows you to perform arithmetic operations on the input digits as needed.


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.


Can you construct a DFA that accepts the language specified?

Yes, a DFA (Deterministic Finite Automaton) can be constructed to accept the specified language.


Can you construct a Turing machine that accepts the language defined by the keyword?

A Turing machine can be built to accept the language defined by the keyword.


What language is accepted by the PDA for input and processing?

The PDA accepts and processes input in various languages.


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


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 to design a DFA that accepts an identifier in c language?

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