Question: i need to perform the complement on the transpose matrix instead of the original matrix . model small . stack 1 0 0 h .
i need to perform the complement on the transpose matrix instead of the original matrix model small
stack h
data
prompt db "Enter the x matrix values as single digits eg: $
origmsg db "Original Matrix:", $
transmsg db "Transpose Matrix:", $
compmsg db "Complement Transpose Matrix:", $
namemsg db "Name: John Doe", $
uidmsg db "University ID: $
matrix db dup ; Matrix values single digit entries
maxVal db ; To store the highest value found
newline db $ ; New line
code
main proc
mov ax @data
mov ds ax
; Prompt for matrix input
mov dx offset prompt
mov ahh
int h
; Read singledigit values for the matrix
mov ahh
int h
sub al
mov matrix, al
mov ahh
int h
sub al
mov matrix al
mov ahh
int h
sub al
mov matrix al
mov ahh
int h
sub al
mov matrix al
; Assume first element is max and read other elements to find max
mov al matrix
mov bl matrix
mov cl matrix
mov dl matrix
mov maxVal, al
cmp bl maxVal
jb NoUpdate
mov maxVal, bl
NoUpdate:
cmp cl maxVal
jb NoUpdate
mov maxVal, cl
NoUpdate:
cmp dl maxVal
jb NoUpdate
mov maxVal, dl
NoUpdate:
; Print original matrix
mov dx offset origmsg
mov ahh
int h
call PrintMatrix
; Print transpose matrix
mov dx offset transmsg
mov ahh
int h
call PrintTransposeMatrix
; Print complement of transpose matrix
mov dx offset compmsg
mov ahh
int h
call PrintComplementMatrix
; Display name and university ID
mov dx offset namemsg
mov ahh
int h
mov dx offset uidmsg
int h
; End program
mov axCh
int h
main endp
PrintMatrix proc
mov ahh ; Print the first element of the matrix
mov dl matrix
add dl ; Convert character to integer
int h
mov ahh ; Print space for formatting
mov dl
int h
mov ahh ; Print the second element of the matrix
mov dl matrix
add dl ; Convert character to integer
int h
mov ahh ; Print new line
mov dl
int h
mov dl
int h
mov ahh ; Print the third element of the matrix
mov dl matrix
add dl ; Convert character to integer
int h
mov ahh ; Print space for formatting
mov dl
int h
mov ahh ; Print the fourth element of the matrix
mov dl matrix
add dl ; Convert character to integer
int h
mov ahh ; Print new line
mov dl
int h
mov dl
int h
ret
PrintMatrix endp
PrintTransposeMatrix proc
mov dl matrix
call PrintDigit
mov dl matrix
call PrintDigit
mov dx offset newline
mov ahh
int h
mov dl matrix
call PrintDigit
mov dl matrix
call PrintDigit
mov dx offset newline
mov ahh
int h
ret
PrintTransposeMatrix endp
PrintComplementMatrix proc
mov ahh ; Print the complement of the first element of the matrix
mov dl maxVal
sub dl matrix
add dl ; Convert character to integer
int h
mov ahh ; Print space for formatting
mov dl
int h
mov ahh ; Print the complement of the second element of the matrix
mov dl maxVal
sub dl matrix
add dl ; Convert character to integer
int h
mov ahh ; Print new line
mov dl
int h
mov dl
int h
mov ahh ; Print the complement of the third element of the matrix
mov dl maxVal
sub dl matrix
add dl ; Convert character to integer
int h
mov ahh ; Print space for formatting
mov dl
int h
mov ahh ; Print the complement of the fourth element of the matrix
mov dl maxVal
sub dl matrix
add dl ; Convert character to integer
int h
mov ahh ; Print new line
mov dl
int h
mov dl
int h
ret
PrintComplementMatrix endp
PrintDigit proc
add dl
mov ahh
int h
mov dl
int h
ret
PrintDigit endp
end main
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
