Computer Science, asked by thordart69, 9 months ago

Which of the following instructions can be used to interchange the contents of the AX and BX registers?​

Answers

Answered by aswinikumar2604
0

Answer:

Format of a Standard Assembler Program

DOSSEG

.MODEL SMALL

.STACK 4096

.DATA

; data definitions

.CODE

ProgramStart:

; assembler instructions

mov ax,SEG _DATA ; set up data segment

mov ds,ax

mov ah,4ch ; terminate program

int 21h

END ProgramStart

This is only valid for simple assembler programs that are of the small, non-memory resident variety. For larger programs the .MODEL directive can be LARGE or HUGE or COMPACT. The .STACK directive indicates the number of bytes to reserve for the stack of the program. If this number is omitted, the stack defaults to 1k.

Except for the commands to terminate the program, all the other commands are what is termed Assembler Directives. These instruct the assembler on how to assemble the program, without generating any actual assembler code.

All names that are used in the program are converted into memory locations during the assembly process. Thus, any name is generally considered to be analogous to a memory location while writing assembly code.

Data definitions

Within the .DATA section, data items can be defined together with initial values. All declarations are of the form:

Name DataType Value

The Name is used to refer to the data thereafter. The DataType can be either DB (byte) or DW (word). This defines what the assembler should consider as the data type of the first item of data. All other items of data on that line inherit the same data type. There are a number of other data types but DB and DW are the most common. Value can be used to set an initial value/s for the data item. This can be set to "?" to instruct the assembler that no specific value need be assigned to that data item.

The MOV instruction

The MOV instruction is the most important command in the 8086 because it moves data from one location to another. It also has the widest variety of parameters; so it the assembler programmer can use MOV effectively, the rest of the commands are easier to understand.

format:

MOV destination,source

The possible combinations of operands are as follows :

destination

source

example

register

register

mov ax,bx

register

immediate

mov ax,10h

register

memory

mov ax,es:[bx]

memory

immediate

mov aNumber,10h

memory

register

mov aDigit,ax

MOV copies the data in the source to the destination. The data can be either a byte or a word. Sometimes this has to be explicitly stated when the assembler cannot determine from the operands whether a byte or word is being referenced.

The MOV instruction has a few limitations:

an immediate value cannot be moved into a segment register directly (i.e. mov ds,10)

segment registers cannot be copied directly (i.e. mov es,ds)

a memory location cannot be copied into another memory location (i.e. mov aNumber,aDigit)

CS cannot be copied to (i.e. mov cs,ax)

These limitations can be overcome using indirect data movement through a general purpose register as illustrated in the general format given above.

Each of the possible values for the destination and source is called an address. From the above table it becomes apparent that there are a number of different addressing modes (immediate, register, memory).

Similar questions