E4.12 Write a subroutine to convert all the uppercase letters in a string into l
ID: 3733720 • Letter: E
Question
E4.12 Write a subroutine to convert all the uppercase letters in a string into lowercase. The starting address of the string is passed to this subroutine in index register X. E4.13 Write a subroutine to generate a 16-bit random number. The result is returned to the caller in D. Pass any appropriate parameters to this subroutine in the stack. E4.14 Write a subroutine to compute the least common multiple of two 16-bit integers Incoming parameters are passed in the stack and the result should be returned in a (Y, D) pair with the upper 16-bit in Y and the lower 16-bit in D E4.15 Write a subroutine to convert an 8-bit signed integer into an ASCII string that represents a decimal number. The 8-bit integer and the pointer to the buffer to hold the ASCII string are passed to this subroutine in accumulator B and index register X, respectively E4.16 Give an instruction sequence to call the out4hex) function to output the 16-bit integer stored in memory location $1000 $1001 EA.17 Give an instruction sequence that outputs the prompt "Please enter a string" and reads the string entered by the user from the keyboard and then echoes the string on the screen again. E4.18 Write a subroutine that will convert a 32-bit signed integer into a BCD ASCIl string so that it can be output to the console terminal (SCI) and appear as a BCD string on the screen. The 32-bit integer to be converted and the pointer to the buffer to hold the resultant string are passed to this subroutine via the stack. E4.19 Write an instruction sequence to configure Port A and Port B for input and output, respectively, read the value of Port A and output the value to Port B E4.20 Give an instruction to configure the pins 7, 5, 1, and 0 of Port B for output and the remaining pins for input. E4.21 For the circuit shown in Figure 4.18, write a program to display 135790 from the left to the right one digit at a time with each digit lasting for about half of a secondExplanation / Answer
E 4.12: Converting Uppercase to Lowercase:-
------------------------------------------------------------
CODE SEGMENT
START:
LEA DX,X
MOV AH,0AH
INT 21H
DISPLAY MSG2
DISPLAY X
DISPLAY MSG3
LEA SI,X
MOV CL,L1
MOV CH,0
CHECK:
CMP [SI],41H
JB UPR
CMP [SI],5BH
JB DONE
CMP [SI],61H
JB DONE
CMP [SI],7BH
JG DONE
UPR: SUB [SI],20H
JMP DONE
DONE: INC SI
LOOP CHECK
DISPLAY X
MOV AH,4CH
INT 21H
CODE ENDS
E 4.13: Random number generator:-
-----------------------------------------------
E 4.14: LCM of two 16-bit number:-
---------------------------------------------
DATA SEGMENT
NUM1 DW 1500
NUM2 DW 2500
HCF DW ?
LCM DW ?
ENDS
CODE SEGMENT
ASSUME DS:DATA CS:CODE
START:
MOV AX,DATA
MOV DS,AX
MOV AX,NUM1
MOV BX,NUM2
WHILE:MOV DX,0
MOV CX,BX
DIV BX
MOV BX,DX
MOV AX,CX
CMP BX,0
JNE WHILE
MOV HCF,AX
MOV CX,AX
MOV AX,NUM1
MOV BX,NUM2
MUL BX
DIV CX
MOV LCM,AX
MOV AH,4CH
INT 21H
ENDS
END START
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.