Assembly Language for Beginners
2.5. AND AND OR AS SUBTRACTION AND ADDITION break; }; printf ("%c", hw[i]); }; }; Nowwhatisinteresting, since8thbitisthemostsign ...
2.6 XOR (exclusive OR) 2.6 XOR (exclusive OR) XORis widely used when one needs just to flip specific bit(s). Indeed, theXORopera ...
2.6. XOR (EXCLUSIVE OR) X = X XOR Y Y = Y XOR X X = X XOR Y What X and Y has at each step? Just keep in mind the simple rule:(X⊕ ...
2.7 Population count // we have 8*8 board and 12 pieces (6 for white side and 6 for black) uint64_t table[12][8][8]; // filled w ...
2.8 Endianness. The instruction is also known as “NSA^22 instruction” due to rumors: This branch of cryptography is fast-paced a ...
2.9 Memory. (((char)&v)+3)); }; After running it we get: root@debian-mips:~# ./a.out 00 00 00 7B That is it. 0x7B is 123 in ...
2.10 CPU. Another problem is the “use after free”—using a memory block afterfree()has been called on it, which is very dangerous ...
2.11. HASH FUNCTIONS 4 6 0 1 3 5 7 8 9 2 ^ ^ Let’s swap them and we get this result: 4 6 0 1 7 5 3 8 9 2 While looking at the re ...
Chapter 3 3 Slightly more advanced examples 3.1 Double negation A popular way^1 to convert non-zero value into 1 (or booleantrue ...
3.2 strstr() example 3.2 strstr() example Let’s back to the fact that GCC sometimes can use part of string:1.5.3 on page 18. The ...
3.3. TEMPERATURE CONVERTING exit(0); }; printf ("Celsius: %d\n", celsius); }; Optimizing MSVC 2012 x86 Listing 3.1: Optimizing M ...
3.3. TEMPERATURE CONVERTING The address ofprintf()is first loaded in theESIregister, so the subsequentprintf()calls are done ju ...
3.3. TEMPERATURE CONVERTING $SG4041 DB 'Error while parsing your input', 0aH, 00H $SG4043 DB 'Error: incorrect temperature!', 0a ...
3.4 Fibonacci numbers. _fahr$ = -8 ; size = 8 _main PROC sub esp, 8 push esi mov esi, DWORD PTR impprintf push OFFSET $SG4228 ; ...
3.4. FIBONACCI NUMBERS 3.4.1 Example #1. The implementation is simple. This program generates the sequence until 21. include < ...
3.4. FIBONACCI NUMBERS We will illustrate the stack frames with this. ...
3.4. FIBONACCI NUMBERS Let’s load the example in OllyDbg and trace to the last call off(): Figure 3.1:OllyDbg: last call off() ...
3.4. FIBONACCI NUMBERS Let’s investigate the stack more closely. Comments were added by the author of this book^4 : 0035F940 00F ...
3.4. FIBONACCI NUMBERS include <stdio.h> void fib (int a, int b, int limit) { int next=a+b; printf ("%d\n", next); if (nex ...
3.4. FIBONACCI NUMBERS _main ENDP ...
«
20
21
22
23
24
25
26
27
28
29
»
Free download pdf