Question

Write an assembly intel 8088 16 bit code MASM,(The 8088 includes has four 16-bit data registers...

Write an assembly intel 8088 16 bit code MASM,(The 8088 includes has four 16-bit data registers (AX, BX, CX and DX). BX can also be used as an address register for indirect addressing. The most/least significant byte of each register can also be addressed directly)

using push, pop, and stack

print the array 8,9,10,1,2,3,4,5,6,7

please provide the full assembly code.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Registers

The 8088 includes has four 16-bit data registers(ax,bx,cx and dx) bx can also be used as an addressregister fr indirect addressing . the most/least significant byte of each register can also be addressed directly (e.g AL is the LS byte of AX,CH is MS byte of CX.

three bits in a 16 bit program status word(psw)are used to indicate whether the resultof the previous arithmetic/logical instrunction was zero, negative,or generated a carry. An interrupt enable bit controls whether interrup requests on the IRQ pin are recognized

the address of the next instructin to be executed is held in a 16-bit instrunction pointer(IP) regsiter (the program counter)

exeecie: how many bytes can be addressed by a 16- bit value?

a 16- bit stack pointer (SP) is used to implement a stack to support subroutine calls and interupts/ exceptions.

there are also three segment registers(CS,DS,SS) which are used to allow the code. data and stack to be located in any three 64 kbyte" segments" within a 1 megabyte(20-bit) address space a sdescribed below

instruction set

Data Transfer

Transfer of 8nand 16-bit data is done using the MOV instruction. Either the source or destination has to be a register. The other operand can come from another register, from memory,from immediate data (a value encoded in the instrction ) or from a memory location " pointed at " by register BX . For example . if COUNT is the label of a memory location the followingare possibe

: register : move contents of BX to AX

MOV AX,BX

:direct : move contents of AX to memory

MOV COUNT,AX

: immediate: load CX with the value 240

MOV CX,OFOH

:register indirect:move contents of AL

:to memory location in BX

16-bit regsiters can be pushed (SP is first decremented by two and then the value stored at SP) or popped (the value is restored from memory at SP and then SP is incremented by 2 )

for example:

PUSH AX : push contents of AX

POP BX : restore into BX

8088 ASSEMBLY LANGUAGE:

The operand format is destination .source,eg.MOV AX,13 H loads AX with 19

The assembler keeps track of the type of the each symbol and uses it select immediate or direct addressing . This can be changed by using the OFFSET operator to convert a memory reference to a 16-bit value

EXAMPLE:

this is a simpole program that demostrates the mainfeatures of the 8088 instruction set. It uses the INT operatation of invoke MS-DOS to writecharaters to the screen.

: sample 8088 assembly language program. this programprints the printable charaters in a null-teminated string (similar to the unix(" strings" program)

: There is only one "segment" call "code" and the linker can assume DS and CS will be set to the right values for "code". The code begins at offset 100h with in the segment"code" (MS-DOS.COM files).

code segment public

assume cs:code,ds:code

org 100h

start:

mov bx, offset msg ;bx points to string

loop:

mov al, [bx] ;load a charater into al

cmp al,0 ; see if it's a zer0

jz done ; quit if so

cmp al,31 ;see if it's printable

jl noprt ;don't print if not

call printc ;otherwise print it

nonprt:

inc bx ;point to next charater

jmp loop ;and loop back

done:

int 20h :;return to DOS

;subroutine to print the byte in al

printc:

push ax ;push ax and dx

push dx ;

mov dl,al ;use DOS to

mov ah,02H ;print character

int 21H

pop dx ; restore ax and dx

pop ax

ret

msg db 'this ',9,31,32,'is',20H,'a string .',0

;example of how to reserve memory (not used above):

buf db 128 dup(?) ; 128 uninitialized bytes

code ends

end start

MOV [BX] ,AL

Add a comment
Know the answer?
Add Answer to:
Write an assembly intel 8088 16 bit code MASM,(The 8088 includes has four 16-bit data registers...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • On a typical microprocessor, a distinct I/O address is used to refer to the I/O data...

    On a typical microprocessor, a distinct I/O address is used to refer to the I/O data registers and a distinct address for the control and status registers in an I/O controller for a given device. Such registers are referred to as ports. In the Intel 8088, two I/O instruction formats are used. In one format, the 8-bit opcode specifies an I/O operation; this is followed by an 8- bit port address. Other I/O opcodes imply that the port address is...

  • III. THE INTEL 8088 PROCESSING ENVIRONMENT use the below processing environment diagram as a reference. AH...

    III. THE INTEL 8088 PROCESSING ENVIRONMENT use the below processing environment diagram as a reference. AH BH General Registers AL AX - Accumulator Register BX - Base Register CL CX Count Register DE. DX.Data Register Segment Registers CS Code Segment DS-Data Segment SS.Stack Segment ES - Extra Segment CH DH Program Counter SP- Stack Pointer BP - Base Pointer S-Source Index DI - Destination Index IP - Instruction Pointer FLAGS Flag Register OD TISZ A P 15 14 13 12...

  • Need help on Assembly language 1.Solve the following conditions: A. Suppose AL contains 11001011 and CF...

    Need help on Assembly language 1.Solve the following conditions: A. Suppose AL contains 11001011 and CF = 1.    Give the new contents of AL after each of the following instructions is executed.    Assume the above initial conditions for each part of this question. a. SHL AL,1 b. SHR AL,1 c. ROL AL,2 d. ROR AL,3 e. SAR AL,2 f. RCL AL,1 g. RCR AL,3 B. Suppose EAX contain ABCDH.    Show the contents of BX and CX after...

  • MARIE Assembly Code Problem For the following problem, please create new MARIE instructions by pr...

    MARIE Assembly Code Problem For the following problem, please create new MARIE instructions by providing the full MARIE RTN (register transfer notation) for the described operation. Your answer should include the fetch, decode, operand fetch (if necessary), execution and store result (if necessary) stages. When you see X in these instructions, this is a main memory address (the last 12 bits of the 16-bit instruction) – refer to this as IR[11..0] and not X. Also, assume there is an additional...

  • Write a program that turns a 32-bit numeric value (e.g., 0xFFFFh) and converts it to a...

    Write a program that turns a 32-bit numeric value (e.g., 0xFFFFh) and converts it to a byte array such that it can be printed to the screen using a system call method. A loop is necessary for converting the numeric value to ASCII for output. Again, use a system call (e.g., int 80h) to print the value to the console. Calling external functions (e.g. printf) is not allowed. You may use the starter file attached to this assignment. PLEASE WRITE...

  • (f) and (g) please f and g please letters Question 2 Indirect addressing mode in assembly language is sanilar to pointers in C. Answer the following questions: (1 point) a) How many 8-bit reg...

    (f) and (g) please f and g please letters Question 2 Indirect addressing mode in assembly language is sanilar to pointers in C. Answer the following questions: (1 point) a) How many 8-bit registers can a FSR access in the PICI8F452 MCU? b) Write the assembly language command to load the address of the variable with name: PVal into one of the FSR? (2 points) (2 points) (2 points) c) What is the meaning of: movf PREINC2, F? d) What...

  • Need to write a MIPS assembly program that finds the minimum and maximum and sum of...

    Need to write a MIPS assembly program that finds the minimum and maximum and sum of a stored array. It also finds the locations of the minimum and maximum. The interaction between the main program and the function is solely through the stack. The function stores $ra immediately after being called and restores $ra before returning to main. The main program reserves a static C like array (index starts from 0) of 10 elements and initializes it. The maximum should...

  • X86 Assembly Language Help to implement the CipherChar Procedure at the end of the given code...

    X86 Assembly Language Help to implement the CipherChar Procedure at the end of the given code INCLUDE Irvine32.inc         .data       KeyPrompt BYTE "Enter the passphrase: ",0       TextPrompt BYTE "Enter the plaintest: ",0           str1 BYTE "The passphrase has length:",0           str2 BYTE "The plaintest has length:",0       KeyIs BYTE "The passphrase: ",0       PlainTextIs BYTE "The plaintext: ",0       CipherTextIs BYTE "The ciphertext: ",0       KMAX = 64                        ; passphrase buffer maximum size       BMAX = 128                       ; test...

  • Implement the following statements using MS430 assembly instructions. You may use more than one, ...

    Implement the following statements using MS430 assembly instructions. You may use more than one, but you should minimize the number of instructions required. You can use both native and emulated instructions. Use hex notation for all numbers 1. (a) Move the word located in register R14 to R15 (b) Increment the word in R6 by 2. (c) Perform a bitwise ANDing of the word located at address 0x0240 with the datum in R15, placing the results in R15. (d) Rotate...

  • 1.) a.) Using the simplified instruction set shown for part b, write code for the following....

    1.) a.) Using the simplified instruction set shown for part b, write code for the following. Suppose memory locations 1400 to 1449 contain 16-bit words. Each word represents 2 ASCII characters. Write code to read in and write out these 100 characters. Left-side character from location 1400 should be first, right-side character from location 1400 should be second, and remaining characters follow in numeric order. Assume you have access to 4 registers: R1, R2, R3, R4. Each register holds one...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT