NASM assembly language programming, Assembly Language

NASM assembly language program:

Consider a sequence of 19 strictly positive decimal digits, most likely
stored in an array. There are obviously duplicates, and the sequence is
unsorted. You may use the sequence length in your program.

Your job is to compute and print the _median_ of this sequence. Since the
sequence length is odd, the median occupies the central position when the
sequence is sorted.

Sorting the sequence might be challenging as your first assembly-language
program, but there is an easier way. All you need to master is looping,
array indexing, adding 1, and comparing.

Give yourself an auxiliary array ''count'' that records the number of times
each digit appears in the sequence.

A linear scan through the sequence is sufficient to compute ''count''.
A second linear scan through ''count'' is sufficient to compute the median.

This program is to be written in NASM.

Here is an outline of the NASM source text:

segment .data
seq dd 0, 1, 9, 1, 9, 1, 9, 3, 8, 3,
3, 8, 4, 7, 5, 7, 5, 6, 5, 4 ; array of length 20
count dd 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ; array of length 10

segment .text
...
Posted Date: 10/17/2012 11:10:57 AM | Location : United States







Related Discussions:- NASM assembly language programming, Assignment Help, Ask Question on NASM assembly language programming, Get Answer, Expert's Help, NASM assembly language programming Discussions

Write discussion on NASM assembly language programming
Your posts are moderated
Related Questions
move a byte string ,16 bytes long from the offset 0200H to 0300H in the segment 7000H

AAA: ASCII Adjust after Addition operation the AAA instruction is executed after an ADD instruction that adds 2 ASCII coded operands to give a byte of outcome in the AL. The AAA i

NEG: Negate:- The negate instruction forms the 2's complement of the particular destination in the instruction. For obtaining 2's complement, it subtracts the contents of destinat

Machine Coding the Programs So far we have describe five programs which were  written  for hand coding  by a programmer. In this, we will now have a deep look at how these prog

CANI GET HELP WRITTING THIS CODE


Format of Control Register The format for the control register is given in Figure. Bit 0 of this register might be one before data may be output  and  bit  two  might be  one

hey ,, I need to know how to let a symbol moves with mouse ??

Request a depreciation of the item, year of purchase, cost of item, number of years to be depreciated (estimated life ) and,the method of depreciation . Method of depreciation sh

LABEL :   The Label directive which is used to assign a name to the current content of the location counter. At the beginning of the assembly process, the assembler start a loca