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