This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
laboratoare:laborator-04 [2015/11/06 15:09] adrian.bogatu [[2p] 4. Afișarea lungimii unui șir] |
laboratoare:laborator-04 [2015/11/11 08:56] (current) razvan.deaconescu [Alte resurse] |
||
---|---|---|---|
Line 75: | Line 75: | ||
Veți obține un output similar celui de mai jos<code> | Veți obține un output similar celui de mai jos<code> | ||
- | C:\Program Files (x86)\SASM\MinGW\bin>.\objdump.exe -d C:\Users\razvan\test.obj | + | C:\Program Files (x86)\SASM\MinGW\bin>.\objdump.exe -d -M intel C:\Users\razvan\test.obj |
C:\Users\razvan\test.obj: file format pe-i386 | C:\Users\razvan\test.obj: file format pe-i386 | ||
Line 83: | Line 83: | ||
00000000 <_main>: | 00000000 <_main>: | ||
- | 0: 55 push %ebp | + | 0: 55 push ebp |
- | 1: 8b ec mov %esp,%ebp | + | 1: 8b ec mov ebp,esp |
- | 3: 6a 0f push $0xf | + | 3: 6a 0f push 0xf |
5: e8 00 00 00 00 call a <_main+0xa> | 5: e8 00 00 00 00 call a <_main+0xa> | ||
- | a: 83 c4 04 add $0x4,%esp | + | a: 83 c4 04 add esp,0x4 |
- | d: 50 push %eax | + | d: 50 push eax |
- | e: 68 00 00 00 00 push $0x0 | + | e: 68 00 00 00 00 push 0x0 |
13: e8 00 00 00 00 call 18 <_main+0x18> | 13: e8 00 00 00 00 call 18 <_main+0x18> | ||
- | 18: 83 c4 08 add $0x8,%esp | + | 18: 83 c4 08 add esp,0x8 |
- | 1b: 33 c0 xor %eax,%eax | + | 1b: 33 c0 xor eax,eax |
- | 1d: 5d pop %ebp | + | 1d: 5d pop ebp |
1e: c3 ret | 1e: c3 ret | ||
1f: cc int3 | 1f: cc int3 | ||
00000020 <_first_func>: | 00000020 <_first_func>: | ||
- | 20: 55 push %ebp | + | 20: 55 push ebp |
- | 21: 8b ec mov %esp,%ebp | + | 21: 8b ec mov ebp,esp |
- | 23: 51 push %ecx | + | 23: 51 push ecx |
- | 24: c7 45 fc 03 00 00 00 movl $0x3,-0x4(%ebp) | + | 24: c7 45 fc 03 00 00 00 mov DWORD PTR [ebp-0x4],0x3 |
- | 2b: 68 00 00 00 00 push $0x0 | + | 2b: 68 00 00 00 00 push 0x0 |
30: e8 00 00 00 00 call 35 <_first_func+0x15> | 30: e8 00 00 00 00 call 35 <_first_func+0x15> | ||
- | 35: 83 c4 04 add $0x4,%esp | + | 35: 83 c4 04 add esp,0x4 |
- | 38: 8b 45 fc mov -0x4(%ebp),%eax | + | 38: 8b 45 fc mov eax,DWORD PTR [ebp-0x4] |
- | 3b: 50 push %eax | + | 3b: 50 push eax |
- | 3c: 8d 4d 08 lea 0x8(%ebp),%ecx | + | 3c: 8d 4d 08 lea ecx,[ebp+0x8] |
- | 3f: 51 push %ecx | + | 3f: 51 push ecx |
40: e8 00 00 00 00 call 45 <_first_func+0x25> | 40: e8 00 00 00 00 call 45 <_first_func+0x25> | ||
- | 45: 83 c4 08 add $0x8,%esp | + | 45: 83 c4 08 add esp,0x8 |
- | 48: 8b 45 08 mov 0x8(%ebp),%eax | + | 48: 8b 45 08 mov eax,DWORD PTR [ebp+0x8] |
- | 4b: 8b e5 mov %ebp,%esp | + | 4b: 8b e5 mov esp,ebp |
- | 4d: 5d pop %ebp | + | 4d: 5d pop ebp |
4e: c3 ret | 4e: c3 ret | ||
4f: cc int3 | 4f: cc int3 | ||
00000050 <_second_func>: | 00000050 <_second_func>: | ||
- | 50: 55 push %ebp | + | 50: 55 push ebp |
- | 51: 8b ec mov %esp,%ebp | + | 51: 8b ec mov ebp,esp |
- | 53: 8b 45 08 mov 0x8(%ebp),%eax | + | 53: 8b 45 08 mov eax,DWORD PTR [ebp+0x8] |
- | 56: 8b 08 mov (%eax),%ecx | + | 56: 8b 08 mov ecx,DWORD PTR [eax] |
- | 58: 03 4d 0c add 0xc(%ebp),%ecx | + | 58: 03 4d 0c add ecx,DWORD PTR [ebp+0xc] |
- | 5b: 8b 55 08 mov 0x8(%ebp),%edx | + | 5b: 8b 55 08 mov edx,DWORD PTR [ebp+0x8] |
- | 5e: 89 0a mov %ecx,(%edx) | + | 5e: 89 0a mov DWORD PTR [edx],ecx |
- | 60: 5d pop %ebp | + | 60: 5d pop ebp |
- | 61: c3 ret | + | 61: c3 |
</code> | </code> | ||
Line 343: | Line 343: | ||
în care să rețineți fie lungimea totală a șirului (de la începutul până la ultimul ''NUL''-byte), fie numărul de șiruri din array. | în care să rețineți fie lungimea totală a șirului (de la începutul până la ultimul ''NUL''-byte), fie numărul de șiruri din array. | ||
</note> | </note> | ||
+ | ===== Soluții ===== | ||
+ | |||
+ | [[http://elf.cs.pub.ro/asm/res/laboratoare/lab-04-sol.zip|Soluții de referință pentru exercițiile de laborator]] | ||
+ | |||
===== Alte resurse ===== | ===== Alte resurse ===== | ||
* [[http://www.nasm.us/|nasm]] | * [[http://www.nasm.us/|nasm]] | ||
* [[http://dman95.github.io/SASM/english.html|SASM]] | * [[http://dman95.github.io/SASM/english.html|SASM]] |