728x90
반응형
<과제 1-식을 어셈블리로 표현하기>
2(-x+y-1)+z
.386
.MODEL FLAT
ExitProcess PROTO NEAR32 stdcall, dwExitCode: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
_start:
output Prompt1
input Value,16
atod Value
mov edx,eax ;레지스터에 x를 옮김
neg edx ;-x
output Prompt2
input Value, 16
atod Value
add edx,eax ;-x+y
dec edx ;-x+y-1
add edx, edx ;2(-x+y-1)
output Prompt3
input Value, 16
atod Value
add edx,eax ;2(-x+y-1)+z
dtoa Result, edx
output Answer
INVOKE ExitProcess, 0
PUBLIC _start
END
------------------------------------
<과제 2-mul예제 적기>
.386
.MODEL FLAT
ExitProcess PROTO NEAR32 stdcall, dwExitCode: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
_start:
Prompt: 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 _start
END
<과제 3->
2*(length*width+length*height+width*height)
728x90
'코스웨어 > 13년 스마트컨트롤러' 카테고리의 다른 글
어셈블리 과제 - 이수현 (0) | 2013.08.28 |
---|---|
8월 28일 어셈블리 숙제 - 석주원 (0) | 2013.08.28 |
어셈블리 과제 - 전영기 (0) | 2013.08.28 |
어셈블리 과제 _ 김성엽 (0) | 2013.08.28 |
어셈블리 숙제 - 조유진 (0) | 2013.08.28 |
중간프로젝트세미나 자료- 옵티머스드라군[김성엽 진종영 조유진] (6) | 2013.08.23 |
중간 프로젝트 세미나 자료 - 손초롱 (0) | 2013.08.22 |
[중간 프로젝트 세미나 ppt] 김성엽 진종영 조유진 - 드라군 (0) | 2013.08.22 |