Support

If you have a problem or need to report a bug please email : support@dsprobotics.com

There are 3 sections to this support area:

DOWNLOADS: access to product manuals, support files and drivers

HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects

USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here

NEW REGISTRATIONS - please contact us if you wish to register on the forum

Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright

An alternative Assembler

Post any examples or modules that you want to share here

An alternative Assembler

Postby MyCo » Mon May 11, 2015 1:18 am

Hi,

So here after I figured this out, here is my attempt to implement an assembler.

I've gone a bit crazy in the Ruby code of the project, but that was required to get the most out of it. So I could add error checks and support some weird constructs like "mov ebx,var[eax+ecx*8+1234];". It also supports different argument ordering for the calculation in there.

I just added a bunch of instructions, not all. Some could be very easy to add (just a lookup table entry), some others require some more work in the instruction compilation part.

Use on your own risk :twisted: It might crash when compiling the code while the audio is running.
Attachments
Assembler (MyCo) v11d.fsm
(27.12 KiB) Downloaded 1293 times
Last edited by MyCo on Fri May 22, 2015 12:51 am, edited 12 times in total.
User avatar
MyCo
 
Posts: 718
Joined: Tue Jul 13, 2010 12:33 pm
Location: Germany

Re: An alternative Assembler

Postby TheAudiophileDutchman » Mon May 11, 2015 8:42 pm

Wow, incredible stuff! 8-)
T A D - since 2005
User avatar
TheAudiophileDutchman
 
Posts: 46
Joined: Tue Jul 13, 2010 1:36 pm
Location: Apeldoorn, The Netherlands

Re: An alternative Assembler

Postby martinvicanek » Mon May 11, 2015 9:07 pm

Yes, some serious hacking there! :ugeek: MyCo, are you planning to demo some stuff that you can do with this which would not be possible otherwise? I saw some mems in there witch 16 byte alignment checking... ;)
User avatar
martinvicanek
 
Posts: 1334
Joined: Sat Jun 22, 2013 8:28 pm

Re: An alternative Assembler

Postby MyCo » Tue May 12, 2015 3:24 pm

martinvicanek wrote:Yes, some serious hacking there! :ugeek: MyCo, are you planning to demo some stuff that you can do with this which would not be possible otherwise? I saw some mems in there witch 16 byte alignment checking... ;)


The main memory is not aligned, it doesn't have to anyway. However the stored variables in the memory are aligned, else SSE instructions wouldn't work on them.

I don't have any demo at the moment, but you can do a lot of things much quicker than with the built-in assembler. eg. you can copy one array element with an offset counter in eax to a relative position:
Code: Select all
movaps xmm0,array[eax];
movaps array[eax+4],xmm0;


doing the same in the built-in assembler would be like that:
Code: Select all
movaps xmm0,array[eax];
add eax,16;
movaps array[eax],xmm0;

This would also only work if "array" is a memory defined in the assembler primitive itself... else it won't be aligned for movaps... whereas in my assembler you could use movups instead of movaps for unaligned memory and it work just fine

PS: Updated schematic in the first post.
User avatar
MyCo
 
Posts: 718
Joined: Tue Jul 13, 2010 12:33 pm
Location: Germany

Re: An alternative Assembler

Postby KG_is_back » Tue May 12, 2015 8:48 pm

This is really cool myco... It opens up almost endless possibilities. Only downside is that we can't use it in poly. Perhaps if we stored variables in separate array, we could make an array of arrays, which could hold variables for poly section (and then use voice id to determine which array to use).
KG_is_back
 
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Re: An alternative Assembler

Postby MyCo » Thu May 21, 2015 3:03 am

I've updated the schematic in the first post.

This is a complete rebuild. It's a full parser now, not only one that recognizes a pattern. This step was necessary to support math and static (compile time) functions. The parser itself supports highlevel code (like FS DSP code) as well, but the compiling process doesn't at the moment. It would have to create instructions from the math tree (witch is already decoded)... not a big thing, but it has an anoying downside: You wouldn't know which registers your DSP code uses, so after a DSP code line you'll have to assume all registers were used.

The assembler now supports "automic constants". That's something actually very convenient, you can for example write:
Code: Select all
movaps xmm0,5;

And it turns the "5" into a value in memory automatically, so you don't need to declare a variable for it.

Have fun!
User avatar
MyCo
 
Posts: 718
Joined: Tue Jul 13, 2010 12:33 pm
Location: Germany

Re: An alternative Assembler

Postby martinvicanek » Thu May 21, 2015 6:35 am

MyCo, that's amazing work! :ugeek: :ugeek:
However, it will need documentation and preferrably also examples if others are to use it.
User avatar
martinvicanek
 
Posts: 1334
Joined: Sat Jun 22, 2013 8:28 pm

Re: An alternative Assembler

Postby TheAudiophileDutchman » Thu May 21, 2015 6:46 pm

MyCo wrote:This is a complete rebuild. It's a full parser now..

MyCo for president!

Seriously, FWIW you have my endorsement to become part of a 64-bit FS development team! :idea:

More votes supporting this idea are welcome in order to trigger the FS Dev(s), people.
T A D - since 2005
User avatar
TheAudiophileDutchman
 
Posts: 46
Joined: Tue Jul 13, 2010 1:36 pm
Location: Apeldoorn, The Netherlands

Re: An alternative Assembler

Postby martinvicanek » Thu May 21, 2015 7:44 pm

+1
User avatar
martinvicanek
 
Posts: 1334
Joined: Sat Jun 22, 2013 8:28 pm

Re: An alternative Assembler

Postby MyCo » Thu May 21, 2015 8:03 pm

I would like to work on FS, when Malc would allow it :mrgreen:

I've updated the schematic with some minor changes, mainly fixes for "[base+index+displacement]" memory access. This is a weird brainfuck. Still not all problems sorted out for this. Trying to get "ebp" register working with this, which is treated differently by the cpu.

@Martin: I don't know how I should demonstrate the possibilities. You can basically do anything except "poly" and accessing DLLs (unless you hack it in, which is possible, but extremely difficult).

Thought about reading out CPU features using cpuid instruction... maybe I'll try it when I'm done with my todo list.
User avatar
MyCo
 
Posts: 718
Joined: Tue Jul 13, 2010 12:33 pm
Location: Germany

Next

Return to User Examples

Who is online

Users browsing this forum: No registered users and 36 guests