programming

May 24, 2015

.model small

.stack 100H

.data

AÂ Â  dbÂ Â  ‘Â Â Â Â  ThisÂ Â Â Â  isÂ Â Â Â  aÂ Â Â Â Â Â Â Â  testÂ Â Â Â  \$’

BÂ Â  dbÂ Â  100 dup(‘\$’)

.code

end

Question 1 :

1.1Write a program that counts how many CharÂ spaces does the A string have. You can assume that the string ends with the \$ sign.
The answer has to beÂ keep in CX register.

1.2 Write a program that counts how many words the A string have. You can assume that the string ends with the \$ sign.
The answer has to beÂ keep in CX register.

1.3 Write a programÂ that copys the String A to an array B.Â you can assume that the string A endsÂ  with \$ sign and the maximum length does not exceed 100 chars including \$.

Question 2 :

Change the following program ( That can print an integer number in the size of a word ( 16 bit ) , the program bellow can print signed numbers from -32768 to 32767 ) Make the appropriated changes to the program , that we will be able to print unsigned numbers in the size of a word ,the range of the unsigned numbers is : 0 to 65535.

.modelÂ  small
.stackÂ Â  100h
.data
numÂ  dwÂ  -32768
numS dbÂ  6 dup(‘ ‘),’\$’

.code
movÂ ax,Â @data
movÂ ds,Â ax

movÂ ax,Â num
movÂ bx,Â 10

movÂ si,Â offset numS+5

next:Â cwd
idivÂ bx
cmpÂ dx,Â 0
jgeÂ cont
negÂ dx
cont:
movÂ [si],Â dl
decÂ si
cmpÂ ax,Â 0
jzÂ sof
jmpÂ Â Â Â Â Â Â Â  next
sof:
cmpÂ num,Â 0
jgeÂ soff
movÂ byte ptr[si],Â ‘-‘
soff:
movÂ ah,Â 9
movÂ dx,Â si
intÂ 21h
.exit

Question 3

Given a Â one-dimensional array “A”Â ofÂ marked values(signed numbers/values)Â , the size of a Byte and In theÂ segmentÂ code a constantÂ N. Write a program that finds the maximumÂ value in the Â array and save it in the lastÂ cell of theÂ arrayÂ Â by scanningÂ  the array only ONCE.

The program prints the array at the end of the process.
Fixed value is defined in the data segment as follows:

N equ **VALUE**

Question 4 :

Given a Â one-dimensional array “A”Â ofÂ unmarked values(unsigned numbers/values)Â , the size of a Byte and In theÂ segmentÂ code a constantÂ N. Write a program that finds the maximumÂ value in the Â array and save it in the lastÂ cell of theÂ arrayÂ Â by scanningÂ  the array only ONCE.

comparing adjacent cells and replace them if necessary.
The program prints the array at the end of the process.
Fixed value is defined in the data segment as follows:

N equ **VALUE**

Question 5 :

Given twoÂ one-dimensionalÂ  arrays :’A’ andÂ ‘B’,Â in a fixed size N1, N2 (Constants)Â which contain marked values ( signed values )sorted in ascending order. In addition,Â given anotherÂ one-dimensional array ‘ C’ Â size N1 + N2. Write program merging the arrays A, B into C.Â CÂ must be Â sorted too. The program will print to the screen the three arrays.

Question 6
Given a one-dimensional array of signed numbers . Size of the array is N (fixed). GivenÂ  a variable ‘SUM’Â that is defined in the data section. In the following sections you will need to sum all the elements of an array and save the answer on Sum under the following requirements:
A. The elements of the array size Byte and the size of the variable Sum is Byte.
B. The elements of the array size Byte and the size of the variable Sum is Word

1. C. The elements of the array size Word and the size of the variable Sum is Word

Important note:
– In all the clauses the summing ends when you move past all the elements in the array or you get an exception while summing.
– Each section has to be writenÂ  in a separate program.

Get a 20 % discount on an order above \$ 120
Use the following coupon code :
today2015

Category: Computer Science

Order a customized paper today!