A.C.Lab5 CerlatPavel FAF-192 [PDF]

Raport Arhitectura Calculatoarelor Lucrarea de Laborator NR.4 Tema:,,PRELUCRAREA SIRURILOR UTILIZAREA TABELELOR PENTRU C

26 0 99KB

Report DMCA / Copyright

DOWNLOAD PDF FILE

Papiere empfehlen

A.C.Lab5 CerlatPavel FAF-192 [PDF]

  • 0 0 0
  • Gefällt Ihnen dieses papier und der download? Sie können Ihre eigene PDF-Datei in wenigen Minuten kostenlos online veröffentlichen! Anmelden
Datei wird geladen, bitte warten...
Zitiervorschau

Raport Arhitectura Calculatoarelor Lucrarea de Laborator NR.4 Tema:,,PRELUCRAREA SIRURILOR UTILIZAREA TABELELOR PENTRU CONVERSII DE CODURI’’

Elaborat: Cerlat Pavel FAF-192 Controlat: Postovan Dumitru

Exemplu: INCLUDE Irvine32.inc .data N=5 mas byte 5 dup (3 dup (0)) .code main proc xor eax,eax mov esi,0 mov ecx,N go: mov dl,mas[esi] inc dl mov mas[esi],dl add esi,3 loop go mov esi,0 mov ecx,N show: movsx eax,mas[esi] call WriteDec add esi,3 loop show quit: call crlf exit main ENDP END main

Listing: INCLUDE Irvine32.inc C ; Include file for Irvine32.lib C C ;OPTION CASEMAP:NONE C C INCLUDE SmallWin.inc C .NOLIST C .LIST C C INCLUDE VirtualKeys.inc C ; VirtualKeys.inc C .NOLIST C .LIST C

(Irvine32.inc)

C C .NOLIST C .LIST C 00000000 .data = 00000005 N=5 00000000 00000005 [ mas 00000003 [ 00 ] ] 00000000 .code 00000000 main proc 00000000 33 C0 xor 00000002 BE 00000000 00000007 B9 00000005 0000000C go: 0000000C 8A 96 00000000 R 00000012 FE C2 inc 00000014 88 96 00000000 R 0000001A 83 C6 03 add 0000001D E2 ED loop 0000001F BE 00000000 00000024 B9 00000005 00000029 show: 00000029 0F BE 86 00000000 R 00000030 E8 00000000 E 00000035 83 C6 03 00000038 E2 EF 0000003A quit: 0000003A E8 00000000 E

byte

5 dup (3 dup (0))

eax,eax mov esi,0 mov ecx,N mov dl mov esi,3 go mov mov

dl,mas[esi] mas[esi],dl

esi,0 ecx,N

movsx eax,mas[esi] call WriteDec add esi,3 loop

show

call crlf exit 0000003F 6A 00 * push +000000000h 00000041 E8 00000000 E * call ExitProcess 00000046 main ENDP END main ;

Ex. Individual: INCLUDE Irvine32.inc holo MACRO ad1, ad2 mov edi,OFFSET ad1 add edi, ad2 inc ad2 ENDM .data string1 byte 'String 1 : ', 0 string2 byte 'String 2 :', 0 string3 byte 'String 3 : ', 0 string_final byte 'String 4 : ', 0 str1 byte 'Lab 5$', 0 str2 byte ' ass$embler', 0 str3 byte ' $$$$$$!', 0 str4 byte 30 dup(? ) .code main PROC cld mov edx, offset string1 call WriteString mov edx, offset str1 call WriteString call Crlf mov edx, offset string2 call WriteString mov edx, offset str2 call WriteString call Crlf mov edx, offset string3 call WriteString mov edx, offset str3 call WriteString call Crlf mov ecx, LENGTHOF str1 mov esi, offset str1 mov edi, offset str4

cond : movsb loop cond mov ecx, LENGTHOF str2 mov esi, offset str2 mov edi, offset str4 add edi, LENGTHOF str1 sub edi, 1 cond1: movsb loop cond1 mov ecx, LENGTHOF str3 mov esi, offset str3 mov edi, offset str4 add edi, LENGTHOF str1 add edi, LENGTHOF str2 sub edi, 2 cond11: movsb loop cond11 mov edi, offset str4 mov al, ' ' mov ecx, lengthof str4 cld c1 : mov al, ' ' scasb je cond2 cmp ecx, 0 jz quit loop c1 cond2 : mov al, ' ' sub edi, 1 stosb jmp c1 quit : cld mov ecx,LENGTHOF str4 mov esi,OFFSET str4 mov ebx,0 cycle: mov al, [esi] cmp al, '$' jnz strdo jmp exl strdo: holo str4, ebx exl:

movsb loop cycle mov edx, offset string_final call WriteString mov edx, offset str4 call WriteString call Crlf call ReadChar call ReadKey exit main ENDP END main

Listing: 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 holo MACRO ad1, ad2 mov edi,OFFSET ad1 add edi, ad2 inc ad2 ENDM 00000000 .data 00000000 53 74 72 69 6E string1 byte 'String 1 : ', 0 67 20 31 20 3A 20 00 0000000C 53 74 72 69 6E string2 byte 'String 2 :', 0 67 20 32 20 3A

00 00000017 53 74 72 69 6E string3 byte 'String 3 : ', 0 67 20 33 20 3A 20 00 00000023 53 74 72 69 6E string_final byte 'String 4 : ', 0 67 20 34 20 3A 20 00 0000002F 4C 61 62 20 35 24 00 00000036 20 61 73 73 24 65 6D 62 6C 65 72 00 00000042 20 24 24 24 24 24 24 21 00 0000004B 0000001E [ 00 ]

str1 byte 'Lab 5$', 0 str2 byte ' ass$embler', 0

str3 byte ' $$$$$$!', 0 str4 byte 30 dup(? )

00000000 00000000 00000000 00000001 00000006 0000000B 00000010 00000015

.code main PROC FC cld BA 00000000 R mov edx, offset string1 E8 00000000 E call WriteString BA 0000002F R mov edx, offset str1 E8 00000000 E call WriteString E8 00000000 E call Crlf

0000001A 0000001F 00000024 00000029 0000002E

BA 0000000C R E8 00000000 E BA 00000036 R E8 00000000 E E8 00000000 E

mov edx, offset string2 call WriteString mov edx, offset str2 call WriteString call Crlf

00000033 00000038 0000003D 00000042 00000047

BA 00000017 R E8 00000000 E BA 00000042 R E8 00000000 E E8 00000000 E

mov edx, offset string3 call WriteString mov edx, offset str3 call WriteString call Crlf

0000004C 00000051 00000056 0000005B 0000005C

B9 00000007 mov ecx, LENGTHOF str1 BE 0000002F R mov esi, offset str1 BF 0000004B R mov edi, offset str4 A4 cond : movsb E2 FD loop cond

0000005E B9 0000000C mov ecx, LENGTHOF str2 00000063 BE 00000036 R mov esi, offset str2

00000068 0000006D 00000070 00000073 00000074

BF 0000004B R mov edi, offset str4 83 C7 07 add edi, LENGTHOF str1 83 EF 01 sub edi, 1 A4 cond1: movsb E2 FD loop cond1

00000076 0000007B 00000080 00000085 00000088 0000008B 0000008E 0000008F

B9 00000009 mov ecx, LENGTHOF str3 BE 00000042 R mov esi, offset str3 BF 0000004B R mov edi, offset str4 83 C7 07 add edi, LENGTHOF str1 83 C7 0C add edi, LENGTHOF str2 83 EF 02 sub edi, 2 A4 cond11: movsb E2 FD loop cond11

00000091 00000096 00000098 0000009D 0000009E 0000009E 000000A0 000000A1 000000A3 000000A6 000000A8

BF 0000004B R mov edi, offset str4 B0 20 mov al, ' ' B9 0000001E mov ecx, lengthof str4 FC cld c1 : B0 20 mov al, ' ' AE scasb 74 07 je cond2 83 F9 00 cmp ecx, 0 74 0A jz quit E2 F4 loop c1

000000AA 000000AA 000000AC 000000AF 000000B0

cond2 : B0 20 mov al, ' ' 83 EF 01 sub edi, 1 AA stosb EB EC jmp c1

000000B2 quit : 000000B2 FC cld 000000B3 B9 0000001E mov ecx,LENGTHOF str4 000000B8 BE 0000004B R mov esi,OFFSET str4 000000BD BB 00000000 mov ebx,0 000000C2 cycle: 000000C2 8A 06 mov al, [esi] 000000C4 3C 24 cmp al, '$' 000000C6 75 02 jnz strdo 000000C8 EB 08 jmp exl 000000CA strdo: holo str4, ebx 000000CA BF 0000004B R 1 mov edi,OFFSET str4 000000CF 03 FB 1 add edi, ebx 000000D1 43 1 inc ebx

000000D2 exl: 000000D2 A4 movsb 000000D3 E2 ED loop cycle 000000D5 BA 00000023 R mov edx, offset string_final 000000DA E8 00000000 E call WriteString 000000DF BA 0000004B R mov edx, offset str4 000000E4 E8 00000000 E call WriteString 000000E9 E8 00000000 E call Crlf 000000EE E8 00000000 E call ReadChar 000000F3 E8 00000000 E call ReadKey exit 000000F8 6A 00 * push +000000000h 000000FA E8 00000000 E * call ExitProcess 000000FF main ENDP END main

Concluzie: În această lucrare de laborator, unele aspecte ale limbajului de asamblare au fost consolidate și studiate în continuare. În procesul de realizare a lucrării, am studiat metodele și principiile de utilizare a comenzilor de manipulare a șirurilor. Codul scris a arătat simplitatea de a lucra cu comenzi de prelucrare a datelor cu minuscule.