flat assembler
Message board for the users of flat assembler.

Index > Main > Thue-Morse Sequence Contest

Goto page Previous  1, 2, 3
Author
Thread Post new topic Reply to topic
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4633
Location: Argentina
LocoDelAssembly
Quote:

Heap is not a repository of useless thoughts. It is very suitable for discussions of this type,

Then, looks that you choose to give Heap an arbitrary purpose because the description is very clear, it says: "Everything not related to assembly programming should be posted here".

BTW, may I wonder why you didn't suggest moving the XOR EAX, EAX debate to Heap? What it has to do to the Main's purpose you have described?

My decision was based on current practice rather than strict forum definition, and since there were posted several times on Main algos that were independent of the underlining OS I though this contest, fully based on Assembly, belongs to Main.
Post 29 Jan 2009, 19:10
View user's profile Send private message Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 3043
Location: vpcmipstrm
bitRAKE
Projects seems an applicable place for contests?
Post 30 Jan 2009, 03:10
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17664
Location: In your JS exploiting you and your system
revolution
Code:
        use32

;Input: edi = pointer to zeroed memory

T32:
        xor     eax,eax ;bit counter
    .loop:
        shl     ebx,29
        shld    edx,eax,16
        xor     edx,eax
        xor     dl,dh
        jpe     @f
        bts     [edi+ebx],eax
    @@: inc     eax
        sets    bl
        jnz     .loop
        retn                    ;T32: 26 bytes    
Post 30 Jan 2009, 05:40
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17664
Location: In your JS exploiting you and your system
revolution
This one might take a while to finish:
Code:
        use64

;Input: rdi = pointer to zeroed memory

T64:
        xor     rax,rax ;bit counter
    .loop:
        shl     rcx,61
        shld    rdx,rax,32
        xor     edx,eax
        shld    ebx,edx,16
        xor     ebx,edx
        xor     bl,bh
        jpe     @f
        bts     [rdi+rcx],rax
    @@: inc     rax
        sets    cl
        jnz     .loop
        retn                    ;T64: 38 bytes    
Post 30 Jan 2009, 08:56
View user's profile Send private message Visit poster's website Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 3043
Location: vpcmipstrm
bitRAKE
revolution, these latest two routines T32/T64 have EBX/RCX undefined on entry - not until the end of the loop do the needed bits obtain a known value.

To all: Please, note I have refined the definition of the contest using the terminology of the Wikipedia entry - they refer to Tn as blocks. Thue-Morse is also a constant and confusion exists between the two Wikipedia entries, imho.
Post 31 Jan 2009, 04:57
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17664
Location: In your JS exploiting you and your system
revolution
bitRAKE wrote:
revolution, these latest two routines T32/T64 have EBX/RCX undefined on entry - not until the end of the loop do the needed bits obtain a known value.
Yes, I know that, but the code is still correct. The fist pass through the loop is always with even parity so the undefined value is never used.
Post 31 Jan 2009, 05:10
View user's profile Send private message Visit poster's website Reply with quote
tom tobias



Joined: 09 Sep 2003
Posts: 1320
Location: usa
tom tobias
Loco wrote:
...may I wonder why you didn't suggest moving the XOR EAX, EAX debate to Heap?
Yes, you may.
http://board.flatassembler.net/topic.php?t=6339
Umm. Let's see, first of all, I didn't start that (in)famous thread. Secondly, the question of programming versus coding is so important to me, that it never occurred to me to ask that the thread be displaced from MAIN. Now that you bring up the topic, however, I agree with you, it probably does NOT belong in MAIN, because the thrust of the thread is on assembly language programming, rather than FASM, per se. Thirdly, I am quite often, ok, let's be honest, I am generally inconsistent, anyway; accordingly, it is not surprising that I should argue abc in one post, and xyz in another. Fourthly, I am not sure that back in those days, we were quite as focused, as we are today, on housekeeping chores, i.e. I think that there were not infrequently, in those days, a couple of years ago, i.e. before the big crash, topics which were misfiled on the forum. Maybe I am incorrect in offering such a solution to this particular conundrum...
bitRAKE wrote:
...Projects seems an applicable place for contests?
brilliant, as always...
Smile
Post 31 Jan 2009, 10:08
View user's profile Send private message Reply with quote
tom tobias



Joined: 09 Sep 2003
Posts: 1320
Location: usa
tom tobias
Loco wrote:
...I though this contest, fully based on Assembly, belongs to Main.
You know what, Loco, maybe I err here. Maybe you are correct, and "MAIN" ought to represent, apparently exactly what it currently does, and always has, i.e. Assembly language programming in general, and FASM specific problems should, contrary to the opinion I have expressed, be displaced to "Compiler" issues, exactly as has been done, with great success to date, since the forum commenced... In other words, I am simply confused as usual.
Confused
Post 31 Jan 2009, 10:17
View user's profile Send private message Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 3043
Location: vpcmipstrm
bitRAKE
revolution wrote:
bitRAKE wrote:
revolution, these latest two routines T32/T64 have EBX/RCX undefined on entry - not until the end of the loop do the needed bits obtain a known value.
Yes, I know that, but the code is still correct. The fist pass through the loop is always with even parity so the undefined value is never used.
You are usually so verbose - I hardly expect such tricks from your code. Very Happy Thanks for clarifying.

_________________
¯\(°_o)/¯ unlicense.org
Post 31 Jan 2009, 15:31
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17664
Location: In your JS exploiting you and your system
revolution
bitRAKE wrote:
You are usually so verbose - I hardly expect such tricks from your code. Very Happy Thanks for clarifying.
The sets can be moved up to just below .loop:. Makes no difference though, same size and same result either way.
Post 31 Jan 2009, 15:54
View user's profile Send private message Visit poster's website Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 3043
Location: vpcmipstrm
bitRAKE
Thue–Morse sequence, t_n can be defined as the least bit, of the sum, of one bits in the binary representation of (n) -- BT (POPCNT (n)),0.

_________________
¯\(°_o)/¯ unlicense.org
Post 19 Apr 2020, 03:06
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page Previous  1, 2, 3

< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.