From: Branimir Maksimovic on
On Thu, 27 May 2010 14:11:25 -0400
Frank Kotler <fbkotler(a)myfairpoint.net> wrote:

>
fasm version ;) (converted to hex)


bmaxa(a)maxa:~/fasm/strange$
bmaxa(a)maxa:~/fasm/strange$ fasm test.asm
flat assembler version 1.68 (16384 kilobytes memory)
2 passes, 232 bytes.
bmaxa(a)maxa:~/fasm/strange$ ./test
A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A
bmaxa(a)maxa:~/fasm/strange$ cat test.asm
format ELF executable

segment writeable executable

entry $
mov ecx,16
l1:
push ecx
cpuid
rdtsc
push edx
push eax


cpuid
rdtsc

pop ebx
sub eax, ebx
pop ecx
sub edx, ecx
mov edi, ascbuf
call u64toda

mov ecx, ascbuf
mov edx, 33
mov ebx, 1
mov eax, 4
int 80h
pop ecx
loop l1

exit:
mov eax, 1
mov ebx,0
int 80h

xtbl db 30h,31h,32h,33h,34h,35h,36h,37h,38h,39h,41h,42h, \
43h,44h,45h,46h

u64toda:
mov ebx,xtbl
mov cl,16
l2:
mov ch,al
and al,0xf
xlatb
stosb
mov al,ch
shrd edx,eax,4
dec cl
jz e1
mov byte[edi], ','
inc edi
jmp l2
e1: ret


ascbuf db 32 dup (?),0xa

bmaxa(a)maxa:~/fasm/strange$

Greets!

--
http://maxa.homedns.org/

Sometimes online sometimes not

Svima je "dozvoljeno" biti idiot i
> mrak, ali samo neki to odaberu,


From: Frank Kotler on
Branimir Maksimovic wrote:
> On Thu, 27 May 2010 14:11:25 -0400
> Frank Kotler <fbkotler(a)myfairpoint.net> wrote:
>
> fasm version ;) (converted to hex)

Okay...

> bmaxa(a)maxa:~/fasm/strange$
> bmaxa(a)maxa:~/fasm/strange$ fasm test.asm
> flat assembler version 1.68 (16384 kilobytes memory)
> 2 passes, 232 bytes.
> bmaxa(a)maxa:~/fasm/strange$ ./test
> A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A
> 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
> 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
> 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
> 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
> 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
> A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A
> 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
> 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
> 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
> A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A
> 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
> A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A
> 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
> 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
> A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A

Groovy! What does it represent?

Best,
Frank

From: Nathan on
On May 27, 9:18 pm, Branimir Maksimovic <bm...(a)hotmail.com> wrote:
>
> format ELF executable
>
> segment writeable executable
>
> entry $
>         mov ecx,16
>         l1:
>         push ecx
>      cpuid
>      rdtsc
>      push edx
>      push eax
>
>      cpuid
>      rdtsc
>
>      pop ebx
>      sub eax, ebx
>      pop ecx
>      sub edx, ecx
>      mov edi, ascbuf

add edi, 15

>      call u64toda
>
>      mov ecx, ascbuf
>      mov edx, 33
>      mov ebx, 1
>      mov eax, 4
>      int 80h
>         pop ecx
>         loop l1
>
> exit:
>      mov eax, 1
>      mov ebx,0
>      int 80h
>
> xtbl db 30h,31h,32h,33h,34h,35h,36h,37h,38h,39h,41h,42h, \
>         43h,44h,45h,46h
>
> u64toda:
>         mov ebx,xtbl
>         mov cl,16

std

>         l2:
>         mov ch,al
>         and al,0xf
>         xlatb
>         stosb
>         mov al,ch
>         ;;;;shrd edx,eax,4

shrd eax, edx, 4

>         dec cl
>         jz e1
>         ;;;;mov byte[edi], ','
>         ;;;;inc edi
>         jmp l2
>         ;;;;e1:  ret

e1:
cld
ret

>
>      ;;;;ascbuf db 32 dup (?),0xa
>

ascbuf db 15 dup (?), 0xa

From: Frank Kotler on
Nathan wrote:

....
> ;;;;shrd edx,eax,4
>
> shrd eax, edx, 4

Ah.

shr edx, 4

"shrd" does not update its second operand (that wasn't what *I* thought
it did, either!). A 64-bit routine is overkill - edx is zero, in any
sane case - but if we say we're gonna do it, might as well do it. :)

There, now I can time "das", and... it's all over the place!

Thanks, guys!

Best,
Frank


From: Branimir Maksimovic on
On Thu, 27 May 2010 21:55:28 -0700 (PDT)
Nathan <nathancbaker(a)gmail.com> wrote:

> On May 27, 9:18 pm, Branimir Maksimovic <bm...(a)hotmail.com> wrote:
> >
> > format ELF executable
> >
> > segment writeable executable
> >
> > entry $
> >         mov ecx,16
> >         l1:
> >         push ecx
> >      cpuid
> >      rdtsc
> >      push edx
> >      push eax
> >
> >      cpuid
> >      rdtsc
> >
> >      pop ebx
> >      sub eax, ebx
> >      pop ecx
> >      sub edx, ecx
> >      mov edi, ascbuf
>
> add edi, 15
>
> >      call u64toda
> >
> >      mov ecx, ascbuf
> >      mov edx, 33
> >      mov ebx, 1
> >      mov eax, 4
> >      int 80h
> >         pop ecx
> >         loop l1
> >
> > exit:
> >      mov eax, 1
> >      mov ebx,0
> >      int 80h
> >
> > xtbl db 30h,31h,32h,33h,34h,35h,36h,37h,38h,39h,41h,42h, \
> >         43h,44h,45h,46h
> >
> > u64toda:
> >         mov ebx,xtbl
> >         mov cl,16
>
> std
>
> >         l2:
> >         mov ch,al
> >         and al,0xf
> >         xlatb
> >         stosb
> >         mov al,ch
> >         ;;;;shrd edx,eax,4
>
> shrd eax, edx, 4
>
> >         dec cl
> >         jz e1
> >         ;;;;mov byte[edi], ','
> >         ;;;;inc edi
> >         jmp l2
> >         ;;;;e1:  ret
>
> e1:
> cld
> ret
>
> >
> >      ;;;;ascbuf db 32 dup (?),0xa
> >
>
> ascbuf db 15 dup (?), 0xa
>

bmaxa(a)maxa:~/fasm/strange$ fasm test.asm
flat assembler version 1.68 (16384 kilobytes memory)
2 passes, 216 bytes.
bmaxa(a)maxa:~/fasm/strange$ ./test
0000000000000195
0000000000000195
000000000000019E
000000000000019E
000000000000019E
000000000000019E
000000000000019E
000000000000019E
000000000000019E
0000000000000195
0000000000000195
000000000000019E
000000000000019E
000000000000019E
000000000000019E
000000000000019E
bmaxa(a)maxa:~/fasm/strange$ cat test.asm
format ELF executable

segment writeable executable

entry $
mov ecx,16
l1:
push ecx
cpuid
rdtsc
push edx
push eax


cpuid
rdtsc

pop ebx
sub eax, ebx
pop ecx
sub edx, ecx
lea edi, [ascbuf+15]
call u64toda

mov ecx, ascbuf
mov edx, 17
mov ebx, 1
mov eax, 4
int 80h
pop ecx
loop l1

exit:
mov eax, 1
mov ebx,0
int 80h

xtbl db 30h,31h,32h,33h,34h,35h,36h,37h,38h,39h,41h,42h, \
43h,44h,45h,46h

u64toda:
mov ebx,xtbl
std
mov cl,16
l2:
mov ch,al
and al,0xf
xlatb
stosb
mov al,ch
shrd eax,edx,4
shr edx,4 ; forgot
dec cl
jnz l2
cld
ret


ascbuf db 16 dup (?),0xa

bmaxa(a)maxa:~/fasm/strange$

It goes in reverse order?

Greets!

--
http://maxa.homedns.org/

Sometimes online sometimes not

Svima je "dozvoljeno" biti idiot i
> mrak, ali samo neki to odaberu,