1번 문제
.386
.MODEL FLAT
ExitProcess PROTO NEAR32 stdcall, dxExitCode:DWORD
include io.h
cr equ 0dh
Lf equ 0ah
.STACK 4096
.DATA
Prompt1 BYTE "This program will evaluate the expression", cr,Lf,Lf
BYTE " 2 ( -x + y - 1 ) + z",cr,Lf,Lf
BYTE "for your choice of integer values.",cr,Lf,Lf
BYTE "Enter value for x: ", 0
Prompt2 BYTE "Enter value for y: ", 0
Prompt3 BYTE "Enter value for z: ", 0
Value BYTE 16 DUP (?)
Answer BYTE cr,Lf,"The result is "
Result BYTE 6 DUP (?)
BYTE cr,Lf,0
.CODE
_smart:
output Prompt1
input Value,16
atod Value
mov edx, eax
neg edx
output Prompt2
input Value,16
atod Value
add edx, eax
dec edx
add edx, edx
output Prompt3
input Value,16
atod Value
add edx, eax
dtoa Result, edx
output Answer
INVOKE ExitProcess, 0
PUBLIC _smart
END
2번 문제
.386
.MODEL FLAT
ExitProcess PROTO NEAR32 stdcall, dxExitCode:DWORD
include io.h
cr equ 0dh
Lf equ 0ah
.STACK 4096
.DATA
prompt1 BYTE "This program will find the area of a rectangle",cr,Lf,Lf
BYTE "Width of rectangle? ",0
prompt2 BYTE "Length of rectangle? ",0
value BYTE 16 DUP (?)
answer BYTE cr,Lf,"The area of the rectangle is "
area BYTE 11 DUP (?)
BYTE cr,Lf,0
.CODE
_smart:
output prompt1
input value, 16
atod value
mov ebx, eax
output prompt2
input value, 16
atod value
mul ebx
dtoa area, eax
output answer
INVOKE ExitProcess, 0
PUBLIC _smart
END
3번 문제
.386
.MODEL FLAT
ExitProcess PROTO NEAR32 stdcall, dxExitCode:DWORD
include io.h
cr equ 0dh
Lf equ 0ah
.STACK 4096
.DATA
prompt1 BYTE "This program will find the area of a box",cr,Lf,Lf
BYTE "Width of box? ",0
prompt2 BYTE "Length of box? ",0
prompt3 BYTE "Height of box? ",0
value BYTE 16 DUP (?)
answer BYTE cr,Lf,"The area of a box is "
area BYTE 11 DUP (?)
BYTE cr,Lf,0
.CODE
_smart:
output prompt1
input value, 16
atod value
mov ebx, eax ;ebx = Length
output prompt2
input value, 16
atod value
mov ecx, eax ;ecx = Width
mov edx, eax
imul edx, ebx ;edx = Length * Width
output prompt3
input value, 16
atod value
imul ebx, eax ;ebx = Length * Height, eax = Height
imul eax, ecx ;eax = Width * Height
add eax, ebx
add eax, edx
shl eax, 1
dtoa area, eax
output answer
INVOKE ExitProcess, 0
PUBLIC _smart
END
'코스웨어 > 13년 스마트컨트롤러' 카테고리의 다른 글
옵티머스 드라군(중간프로젝트) (0) | 2013.08.30 |
---|---|
apue.h (0) | 2013.08.29 |
어셈블리어 과제 - 진종영 (0) | 2013.08.29 |
어셈블리 과제 - 문남경 (0) | 2013.08.29 |
어셈블리 과제 - 손초롱 (0) | 2013.08.28 |
어셈블리 과제 - 이수현 (0) | 2013.08.28 |
8월 28일 어셈블리 숙제 - 석주원 (0) | 2013.08.28 |
어셈블리 과제 - 전영기 (0) | 2013.08.28 |