0% found this document useful (0 votes)
303 views4 pages

AC Lab 2

The report describes Laboratory Work No. 2 on the basics of assembly language. The goal was to present problems related to data conversion, integer representation, BCD format, character and string representation, and real value representation. The lab work involved obtaining an executable file for a code portion calculating z=(5*a-b/7)/(3/b+a*a) using assembly instructions like ADD, DIV, IMUL, and data types like DB and DW. In conclusion, the student gained skills in basic assembly language concepts.

Uploaded by

DanuIepuras
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
0% found this document useful (0 votes)
303 views4 pages

AC Lab 2

The report describes Laboratory Work No. 2 on the basics of assembly language. The goal was to present problems related to data conversion, integer representation, BCD format, character and string representation, and real value representation. The lab work involved obtaining an executable file for a code portion calculating z=(5*a-b/7)/(3/b+a*a) using assembly instructions like ADD, DIV, IMUL, and data types like DB and DW. In conclusion, the student gained skills in basic assembly language concepts.

Uploaded by

DanuIepuras
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
You are on page 1/ 4

Ministerul Educației al Republicii Moldova

Universitatea Tehnică a Moldovei

Facultatea Calculatoare, Informatică şi Microelectronică

Departamentul Ingineria Software şi Automatică

Raport
Lucrarea de laborator nr.2
Disciplina: Arhitectura Calculatoarelor

A efectuat: st. gr.TI-174 Iepuraș Daniel

A verificat: conf.univ. V.Colesnic

Chișinău - 2018
Tema:”Bazele limbajului Assembler”

Scopul Lucrarii

Se prezinta problemele principale legate de conversii de date, reprezentarea datelor


întregi, reprezentarea întregilor in format BCD, reprezentarea caracterelor si a șirurilor
de caractere, reprezentarea valorilor reale, elemente de memorie, tipuri de date utilizate
si modurile de adresare a operanzilor.

Desfasurarea lucrarii de laborator

Se cere obtinerea fisierului executabil pentru urmatoarea portiune de cod si rularea apoi
pas cu pas.

Varianta Nr.7

z=(5*a-b/7)/(3/b+a*a)
INCLUDE Irvine32.inc
.data
a db 2
b db 7
interm dw ?
interm1 dw ?
interm2 dw ?
rez db ?
.code
main proc
mov eax, 0
mov al,5
imul a
mov interm, ax
mov al, b
cbw
mov bl, 7
idiv bl
xchg ax, interm
sub ax,interm
mov interm,ax

mov al, 3
cbw
mov bl, b
idiv bl
mov rez,al

mov al,a
imul a
mov interm1,ax
mov al,rez
cbw
add ax,interm1

mov interm1,ax
mov ax,interm
cwd
div interm1

call WriteInt
exit
main ENDP
END main

Listingul programului
INCLUDE Irvine32.inc
C ; Include file for Irvine32.lib (Irvine32.inc)
C
C ;OPTION CASEMAP:NONE ; optional: make identifiers
case-sensitive
C
C INCLUDE SmallWin.inc ; MS-Windows prototypes,
structures, and constants
C .NOLIST
C .LIST
C
C INCLUDE VirtualKeys.inc
C ; VirtualKeys.inc
C .NOLIST
C .LIST
C
C
C .NOLIST
C .LIST
C
00000000 .data
00000000 02 a db 2
00000001 07 b db 7
00000002 0000 interm dw ?
00000004 0000 interm1 dw ?
00000006 0000 interm2 dw ?
00000008 00 rez db ?
00000000 .code
00000000 main proc
00000000 B8 00000000 mov eax, 0
00000005 B0 05 mov al,5
00000007 F6 2D 00000000 R imul a
0000000D 66| A3 mov interm, ax
00000002 R
00000013 A0 00000001 R mov al, b
00000018 66| 98 cbw
0000001A B3 07 mov bl, 7
0000001C F6 FB idiv bl
0000001E 66| 87 05 xchg ax, interm
00000002 R
00000025 66| 2B 05 sub ax,interm
00000002 R
0000002C 66| A3 mov interm,ax
00000002 R
00000032 B0 03 mov al, 3
00000034 66| 98 cbw
00000036 8A 1D 00000001 R mov bl, b
0000003C F6 FB idiv bl
0000003E A2 00000008 R mov rez,al

00000043 A0 00000000 R mov al,a


00000048 F6 2D 00000000 R imul a
0000004E 66| A3 mov interm1,ax
00000004 R
00000054 A0 00000008 R mov al,rez
00000059 66| 98 cbw
0000005B 66| 03 05 add ax,interm1
00000004 R

00000062 66| A3 mov interm1,ax


00000004 R
00000068 66| A1 mov ax,interm
00000002 R
0000006E 66| 99 cwd
00000070 66| F7 35 div interm1
00000004 R

00000077 E8 00000000 E call WriteInt


exit
0000007C 6A 00 * push +000000000h
0000007E E8 00000000 E * call ExitProcess
00000083 main ENDP
END main

Concluzie:

In lucrarea de laborator nr.2 am realizat un program in Assembler ce efectueaza


operatia de calculare a unei valori.Am utilizat diferite tipuri de date(db-define
byte,dw-define word),instructiuni cum ar fi (add,div,imul,xchg,cwd) si modurile de
adresare a operanzilor.In general am obtinut abilitati in bazele limbajului Assembler.

You might also like