flat assembler
Message board for the users of flat assembler.
Index
> Projects and Ideas > the worse x86 emitter ever seen |
Author |
|
guignol 27 Jul 2017, 07:35
It's like at some point in life you actually start hatin' Roman languages
|
|||
27 Jul 2017, 07:35 |
|
pber 27 Jul 2017, 08:27
I studied Roman: its similar to CommonLisp.
|
|||
27 Jul 2017, 08:27 |
|
pber 28 Jul 2017, 20:49
...the second try does not use FASM.DLL but OLLY.DLL.
Now I can control each single opcode and re-implement my mini-assembler in Lua. This version includes also some peep-hole optimizations. The source: Code: fmt = "<< %s %d >>\n" a = 0 b = 3 c = 1 a = 123 * b s = "Hello world" while c<=4 do printf(fmt, s, c) c=c+1 end The dump: Code: 01 [2AD1860]. 53 push ebx ; 02 [2AD1861]. 51 push ecx ; 03 [2AD1862]. C8 28 00 00 enter 28, 0 ; 04 [2AD1866]. C7 C0 00 00 00 00 mov eax, 00h ; 05 [2AD186C]. C7 45 FC 98 18 AD 02 mov dword [ebp - 04h], 02AD1898h ; !glob.str #1 06 [2AD1873]. C7 45 F8 A4 18 AD 02 mov dword [ebp - 08h], 02AD18A4h ; !glob.str #2 07 [2AD187A]. C7 C0 7B 00 00 00 mov eax, 07Bh ; 08 [2AD1880]. 89 45 F4 mov [ebp - 0Ch], eax ; >a 09 [2AD1883]. 50 push eax ; 10 [2AD1884]. 8B 45 F8 mov eax, [ebp - 08h] ; s> 11 [2AD1887]. 50 push eax ; 12 [2AD1888]. 8B 45 FC mov eax, [ebp - 04h] ; fmt> 13 [2AD188B]. 50 push eax ; 14 [2AD188C]. E8 D9 FF 16 75 call 077C4186Ah ; call: printf 15 [2AD1891]. 58 pop eax ; 16 [2AD1892]. 58 pop eax ; 17 [2AD1893]. 58 pop eax ; 18 [2AD1894]. C9 leave ; 19 [2AD1895]. 59 pop ecx ; 20 [2AD1896]. 5B pop ebx ; 21 [2AD1897]. C3 ret ; 23 [2AD1898]. global_001: 3C 3C 20 25 73 20 25 64 20 3E 3E 00 db '<< %s %d >>' ; 25 [2AD18A4]. global_002: 48 65 6C 6C 6F 20 77 6F 72 6C 64 00 db 'Hello world' ; The happiness: Code: << Hello world 1 >>\n<< Hello world 2 >>\n<< Hello world 3 >>\n<< Hello world 4 >>\n>> 5 Ah ah...if it was C a back-slash plus one "n" could had been made a LF bye bye paolo |
|||
28 Jul 2017, 20:49 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.