Ce diaporama a bien été signalé.
Le téléchargement de votre SlideShare est en cours. ×

Write a function in Assembly language that takes a value passed to it (1).docx

Publicité
Publicité
Publicité
Publicité
Publicité
Publicité
Publicité
Publicité
Publicité
Publicité
Publicité
Publicité
Prochain SlideShare
Programming basic computer
Programming basic computer
Chargement dans…3
×

Consultez-les par la suite

1 sur 2 Publicité

Write a function in Assembly language that takes a value passed to it (1).docx

Télécharger pour lire hors ligne


Write a function in Assembly language that takes a value passed to it in A register. (write only the function code.) The function: (1) first prints the value as a hex number (2) then prints the value as a decimal number (two digits) (3) then determines if the value is a printable ACSII character, and if so prints the character, but if it is not a printable character, the # character is printed instead. Example: if the value passed in A register is 41 hex, the function prints 41 65 A. Your function may call the standard terminal I/O functions such a and out2hex to do its work. You must provide any code or function needed for converting to decimal. it is important to write this function in such a way that the stack is used to save and restore registers, so that none of the registers have been modified when the function returns.
Solution
Solution :
To convert the input value of register in hex number and decimal number, get the offset address and set the number of ascii with start from highest byte like -
Function -
mov gi, offset ascii
mov dl, 5
rol fd,8 // starting with highest byte // use increase and decrease counter
At end 1 + output string
// output is in hex decimal and decimal number of input number
// In last the output prints the ascii and character too ..............................
mov s,8 ;
print s;
or s,60h; // convert to ascii from value
mov d,s;
mov sh,2;
mov fd,d; // print of character
..... Termination .......
.


Write a function in Assembly language that takes a value passed to it in A register. (write only the function code.) The function: (1) first prints the value as a hex number (2) then prints the value as a decimal number (two digits) (3) then determines if the value is a printable ACSII character, and if so prints the character, but if it is not a printable character, the # character is printed instead. Example: if the value passed in A register is 41 hex, the function prints 41 65 A. Your function may call the standard terminal I/O functions such a and out2hex to do its work. You must provide any code or function needed for converting to decimal. it is important to write this function in such a way that the stack is used to save and restore registers, so that none of the registers have been modified when the function returns.
Solution
Solution :
To convert the input value of register in hex number and decimal number, get the offset address and set the number of ascii with start from highest byte like -
Function -
mov gi, offset ascii
mov dl, 5
rol fd,8 // starting with highest byte // use increase and decrease counter
At end 1 + output string
// output is in hex decimal and decimal number of input number
// In last the output prints the ascii and character too ..............................
mov s,8 ;
print s;
or s,60h; // convert to ascii from value
mov d,s;
mov sh,2;
mov fd,d; // print of character
..... Termination .......
.

Publicité
Publicité

Plus De Contenu Connexe

Similaire à Write a function in Assembly language that takes a value passed to it (1).docx (20)

Plus par lez31palka (20)

Publicité

Plus récents (20)

Write a function in Assembly language that takes a value passed to it (1).docx

  1. 1. Write a function in Assembly language that takes a value passed to it in A register. (write only the function code.) The function: (1) first prints the value as a hex number (2) then prints the value as a decimal number (two digits) (3) then determines if the value is a printable ACSII character, and if so prints the character, but if it is not a printable character, the # character is printed instead. Example: if the value passed in A register is 41 hex, the function prints 41 65 A. Your function may call the standard terminal I/O functions such a and out2hex to do its work. You must provide any code or function needed for converting to decimal. it is important to write this function in such a way that the stack is used to save and restore registers, so that none of the registers have been modified when the function returns. Solution Solution : To convert the input value of register in hex number and decimal number, get the offset address and set the number of ascii with start from highest byte like - Function - mov gi, offset ascii mov dl, 5 rol fd,8 // starting with highest byte // use increase and decrease counter At end 1 + output string // output is in hex decimal and decimal number of input number // In last the output prints the ascii and character too .............................. mov s,8 ; print s;
  2. 2. or s,60h; // convert to ascii from value mov d,s; mov sh,2; mov fd,d; // print of character ..... Termination .......

×