Article View: pl.comp.programming
Article #216736back to assembly
From: fir
Date: Sun, 29 Dec 2019 02:06
Date: Sun, 29 Dec 2019 02:06
206 lines
5258 bytes
5258 bytes
i got so terrible problems last half of year i was like unable to concentrate on coding, still not feeling well to be honest but i think maybe i can back for a while the idea is to maybe upbuild (build it up) my assembler (so called organic assembler) so maybe i will show that project and maybe some more specific questions/topics will appear vurrent version to download: http://minddetonator.htw.pl/org-asm.zip (for windows32, i mean it runs as win32 console tool and assembles win32 executables) i added some example pice of asm code in it as sorta example how to use it main: call test_1M_loop call test_1M_loop call test_1M_loop call test_1M_loop call test_1M_loop call test_1M_loop call test_1M_loop call test_1M_loop call test_1M_loop call test_1M_loop call test_1M_loop call test_1M_loop call test_1M_loop call test_1M_loop ret //////////////////////// test_1M_loop: nop nop mov esi 1000000 rdtsc push edx push eax loop: //================== nop nop nop // mov ebx esi // add ebx 19 // mov edx 1000 // mov eax 1000 // div edax ebx //================= dec esi jne loop rdtsc pop ebx pop ecx sub eax ebx sbb edx ecx call print_eax ret //////////////////////////// inner_test: ret ////////////////////////////// @ note_eax: "\x0d\x0a rdtsc eax = %d \x00" print_eax: push eax push note_eax call msvcrt.printf pop eax pop eax ret this pice of asm makes loop of 1M rolls and measures how many cycles it takes by rtdsc command this itself may be interesting for someone who would like to toy a bit and measure what amount of cycles given assembly comands and routines take on your cpu for example gien loop with 3 nops gives that result (here on my old cpu) rdtsc eax = 2000103 rdtsc eax = 2000117 rdtsc eax = 2000082 rdtsc eax = 2000082 rdtsc eax = 2000082 rdtsc eax = 2000082 rdtsc eax = 2000082 rdtsc eax = 2000082 rdtsc eax = 2000082 rdtsc eax = 2000082 rdtsc eax = 2000082 rdtsc eax = 2042404 rdtsc eax = 2415266 rdtsc eax = 2266271 if i delete that 3 nops it gives rdtsc eax = 1000125 rdtsc eax = 1000111 rdtsc eax = 1000083 rdtsc eax = 1000076 rdtsc eax = 1000076 rdtsc eax = 1000083 rdtsc eax = 1000083 rdtsc eax = 1000076 rdtsc eax = 1000076 rdtsc eax = 1000076 rdtsc eax = 1000076 rdtsc eax = 1000076 rdtsc eax = 1000076 rdtsc eax = 1000076 so it shows that 1 nop takes only like 0.33 cycle, and that dec esi and jne jump itself take only one cycle if someone is interested how fast things execute that kind of tests may be usefull (it could be done in more popular assemblers but the entry level of my own may be easier, for me its easier for sure) things can be tested easily, for example if i want to test rand() i just put a line call msvcrt.rand instead of that 3 nops and i get the result rdtsc eax = 28016989 rdtsc eax = 28000112 rdtsc eax = 28043897 rdtsc eax = 28001589 rdtsc eax = 28001498 rdtsc eax = 28105077 rdtsc eax = 28000161 rdtsc eax = 28001904 rdtsc eax = 28016415 rdtsc eax = 28024360 rdtsc eax = 28000084 rdtsc eax = 28012999 rdtsc eax = 28026061 rdtsc eax = 28002849 so its 27 cycles..and so on if someone would like to toy with my assembler i could improve it (i not typed all possiblemnemonic register combinations yet as it seems to be posiibly thousands of them) i need yet also make some improve,ments in syntax of that asm... im quite satisfied as to cyntax of code (which i a bit refreshed if compared to intel by rejecting periods and turning square brackets into round brackets but i quess i still need to work on data format and also repair some holes here
Technical Details
Message-ID:
<d005e615-9afc-42ef-8295-9ee066b08726@googlegroups.com>Path:
mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.edu.pl!newsfeed.pionier.net.pl!feeder.erje.net!2.eu.feeder.erje.net!feeder5.feed.usenet.farm!feed.usenet.farm!feeder.usenetexpress.com!tr1.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!g89no5235117qtd.0!news-out.google.com!w29ni427qtc.0!nntp.google.com!g89no5235105qtd.0!postnews.google.com!google-groups.googlegroups.com!not-for-mailShow Full Headers
Complete Article Headers
X-Received: by 2002:a37:6313:: with SMTP id x19mr50963094qkb.231.1577585193686; Sat, 28 Dec 2019 18:06:33 -0800 (PST) X-Received: by 2002:a05:6214:301:: with SMTP id i1mr44312113qvu.244.1577585193217; Sat, 28 Dec 2019 18:06:33 -0800 (PST) Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.edu.pl!newsfeed.pionier.net.pl!feeder.erje.net!2.eu.feeder.erje.net!feeder5.feed.usenet.farm!feed.usenet.farm!feeder.usenetexpress.com!tr1.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!g89no5235117qtd.0!news-out.google.com!w29ni427qtc.0!nntp.google.com!g89no5235105qtd.0!postnews.google.com!google-groups.googlegroups.com!not-for-mail Newsgroups: pl.comp.programming Date: Sat, 28 Dec 2019 18:06:32 -0800 (PST) Complaints-To: groups-abuse@google.com Injection-Info: google-groups.googlegroups.com; posting-host=5.172.255.230; posting-account=Sb6m8goAAABbWsBL7gouk3bfLsuxwMgN NNTP-Posting-Host: 5.172.255.230 User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <d005e615-9afc-42ef-8295-9ee066b08726@googlegroups.com> Subject: back to assembly From: fir <profesor.fir@gmail.com> Injection-Date: Sun, 29 Dec 2019 02:06:33 +0000 Lines: 222 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit