Professional Documents
Culture Documents
COAL Lab 9 (22k-4136)
COAL Lab 9 (22k-4136)
Task 1:
INCLUDE Irvine32.inc
.data
.code
main PROC
mov eax,50
shl eax,4
mov ebx,50
shl ebx,2
add eax,ebx
mov ebx,50
shl ebx,0
add eax,ebx
mov edx,OFFSET prompt
call writeString
call writeDec
exit
main ENDP
END main
Task 2:
INCLUDE Irvine32.inc
.data
.code
main PROC
mov eax,0
mov ax,-128
call dumpregs
rol eax,16
sar eax,16
call crlf
call crlf
call dumpregs
exit
main ENDP
END main
Task 3:
INCLUDE Irvine32.inc
.data
bMinutes BYTE ?
prompt BYTE "The minutes are: ",0
.code
main PROC
mov ax,101010011101010b
shr ax,5
and al,00111111b
mov bMinutes,al
mov eax,0
mov al,bMinutes
mov edx,OFFSET prompt
call writeString
call writeDec
call crlf
exit
main ENDP
END main
Task 4:
INCLUDE Irvine32.inc
.data
.code
main PROC
mov eax,0
mov ebx,0
mov ax,10010001b
call writeBin
clc
rcr eax,1
rcl bx,1
shl bx,3
mov eax,0
mov ax,bx
call crlf
call crlf
mov edx,OFFSET prompt2
call writeString
call crlf
call crlf
call writebin
mov edx,OFFSET prompt
call crlf
mov ax,325Bh
mov dx,7931h
shrd ax,dx,4
exit
main ENDP
END main
Task 5:
INCLUDE Irvine32.inc
.data
.code
main PROC
mov eax,val2
cdq
idiv val3
mov ebx, eax
mov eax,val1
cdq
idiv val2
imul eax,ebx
mov edx,OFFSET prompt
call writeString
call writeDEC
exit
main ENDP
END main
Task 6:
INCLUDE Irvine32.inc
.data
.code
main PROC
call Extended_Add
exit
main ENDP
Extended_Add PROC
mov eax,0
mov edx,0
mov esi,OFFSET val1
add eax,[esi+ TYPE val1]
mov edi,OFFSET val2
add eax,[edi+ TYPE val2]
adc edx,0
mov ebx,0
add ebx,[esi]
add ebx,[edi]
add eax,ebx
adc edx,0
call dumpregs
ret
Extended_Add ENDP
END main