Question

Assume an array of unsigned eight bit numbers from MX_ARRAY onwards and length of the array...

Assume an array of unsigned eight bit numbers from MX_ARRAY onwards and length of the array is available at ARRAY_LENGTH. Write 8086 assembly language program with apppropriate comments for displaying the contents of MX_ARRAY in binary format, with one array element per row on screen.

ex: for an array element value 30H, display should be 00111011

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

DATA SEGMENT
HEX DB MX_ARRAY ;The value in MX_ARRAY is copied to DataBit(DB)
BCD DW 0
CNT DB ARRAY_LENGTH ;The array length is copied to the count (CNT)
DATA ENDS
CODE SEGMENT ;Code segment begins
ASSUME CS:CODE,DS:DATA
START:
MOV AX,DATA ;the data is copied to AX register
MOV DS,AX ;the value from AX is moved to DS
MOV AL,HEX ;the HEX number is copied to AL register
CMP AL,00 ;the value in AL is Compared wit 00.
JZ LAST ;if after comparision the value is zero the it jumps to LAST part of the program

LOOP1: ;Conversion Starts from HEX to binary
MOV AH,00 ; if the value is not zero the 00 is copied to AH
MOV BL,0AH ;And 0AH is copied to BL
DIV BL ;the value in AH is divided by 0AH to get a remainder in the from of single number
MOV DH,00 ;now DH is filled with 00
MOV DL,AH ; AH is copied to DL for output
MOV BL,AL ;AL is copied to BL for output
MOV AL,04 ;Now 04 is copied to AL
MUL CNT ;AL is multiplied with CNT
MOV CL,AL ; Copy AL into RAM[CL]
ROL DX,CL ;Rotates the register left by CL bit
OR BCD,DX ; ORing is done between BCD and DX value
MOV AL,BL ;Now BL is Copied to AL
INC CNT ; CNT is incremented to point to next number in the array
CMP AL,0 ; Now AL is compared to check is it contains any number
JNZ LOOP1 ; if AL contains any value the LOOP1 is repeated until Zero
LAST:INT 3
CODE ENDS ; Code segment Ends
END START ; Start ends
END ; Program Ends

Add a comment
Know the answer?
Add Answer to:
Assume an array of unsigned eight bit numbers from MX_ARRAY onwards and length of the array...
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
  • Can someone please help me with this problem? We are using CodeWarrior to write this program...

    Can someone please help me with this problem? We are using CodeWarrior to write this program in assembly language. The array sample contains eight 8-bit signed binary numbers (integers) as shown below. Write a program which stores the negative numbers in the array nelements, computes the sum of the positive numbens to be stored in the variable psum and stores the number of the positive numbers in the variable pnumber. Note that a zero is ther positive nor negative. Your...

  • [C++] Outline: The movie data is read from a file into an array of structs and...

    [C++] Outline: The movie data is read from a file into an array of structs and is sorted using the Selection Sort method and the search is done using the Binary Search algorithm with the year of release as key. This assignment upgrades to an array of pointers to the database elements and converts the Selection Sort and Binary search procedure on the database to selection sort and binary search on the array of pointers to the database.   Requirements: Your...

  • /*************************************************** Name: Date: Homework #7 Program name: HexUtilitySOLUTION Program description: Accepts hexadecimal numbers as input. Valid...

    /*************************************************** Name: Date: Homework #7 Program name: HexUtilitySOLUTION Program description: Accepts hexadecimal numbers as input. Valid input examples: F00D, 000a, 1010, FFFF, Goodbye, BYE Enter BYE (case insensitive) to exit the program. ****************************************************/ import java.util.Scanner; public class HexUtilitySOLUTION { public static void main(String[] args) { // Maximum length of input string final byte INPUT_LENGTH = 4; String userInput = ""; // Initialize to null string Scanner input = new Scanner(System.in); // Process the inputs until BYE is entered do {...

  • Lab 6 Instructions Objectives: • Executing and experimenting with programs that handle array related topics such...

    Lab 6 Instructions Objectives: • Executing and experimenting with programs that handle array related topics such as declaration, initialization, storing, retrieving, and processing elements. • Effectively manipulating and using ArrayList objects. • Becoming familiar with the use of arrays as method arguments and how array elements are passed to and returned from the called method. • Mastering the use of various debugging tools available on the Eclipse IDU. Important: EVERY one of the following Activities MUST be in a separate...

  • pls answer all questions 1) A step-by-step solution to a problem is called a. hardware b....

    pls answer all questions 1) A step-by-step solution to a problem is called a. hardware b. an operating system c. a computer language d. an algorithm 2) separated the programming task from the computer operation tasks. a. Algorithms b. Data processors c. High-level programming languages d. Operating systems 3) is a 16-bit code that can represent symbols in languages other than English. a. ASCII b. Extended ASCII c. EBCDIC d. Unicode 4) When you want to download music to a...

  • Assignment Predator / Prey Objectives Reading from and writing to text files Implementing mathematical formulas in...

    Assignment Predator / Prey Objectives Reading from and writing to text files Implementing mathematical formulas in C++ Implementing classes Using vectors Using command line arguments Modifying previously written code Tasks For this project, you will implement a simulation for predicting the future populations for a group of animals that we’ll call prey and their predators. Given the rate at which prey births exceed natural deaths, the rate of predation, the rate at which predator deaths exceeds births without a food...

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