Welcome, Guest.
Please login or register.
Low Level stuff (ASM inside)
Forum Login
Login Name: Create a new account
Password:     Forgot password

XBLite Forum    General Boards    Working Code Snippets  ›  Low Level stuff (ASM inside)
Users Browsing Forum
No Members and 1 Guests

Low Level stuff (ASM inside)  This thread currently has 5,087 views. Print Print Thread
1 Pages 1 Recommend Thread
26
August 24, 2008, 9:39am Report to Moderator Report to Moderator
Guest User
I am working to rewrite some of my ASM and lowlevel code from NASM to include it directly in XBlite.This is a MMX copying demo and i'll post more if i think they can be usefull.




This post contains attachments; to download them you must login.

Logged
E-mail E-mail
XBLiteAdmin
August 24, 2008, 10:37pm Report to Moderator Report to Moderator
Administrator Group
Posts: 44
Thanks for the mmx mCopyMemory demo.

ciao,
D.
Logged Offline
Site Site Private Message Private message Reply: 1 - 9
13
August 25, 2008, 6:54am Report to Moderator Report to Moderator
Guest User
Hi Fano,

Thanks for this.  One trick that you may not be aware of is that you can also put asm routines in your program between the final END FUNCTION and END PROGRAM.  Then declare them as EXTERNAL.  That way you can have the "purest" assembly in your code, without the xblite stack frame and initialization.

For an example of that, see xblite.x, scroll down to the very end, and you will see the StrCmp function done in that manner.

Excellent coding BTW. I may borrow it.  

Yours,
Greg
Logged
E-mail E-mail Reply: 2 - 9
26
August 25, 2008, 9:23am Report to Moderator Report to Moderator
Guest User
Quoted from 13
One trick that you may not be aware of is that you can also put asm routines in your program between the final END FUNCTION and END PROGRAM.  Then declare them as EXTERNAL.  That way you can have the "purest" assembly in your code, without the xblite stack frame and initialization.

This is a great trick ! I took a look to xblite.x and i think it will be very usefull, thanks a lot
I'm going to try to learn more about goAsm because i'm still a bit confused with its syntax.A last thingie : this is great to have definitions for variables in functions.It is now an easy work to use local variables directly in asm, no more need to work with EBP offsets
Logged
E-mail E-mail Reply: 3 - 9
13
August 25, 2008, 9:47am Report to Moderator Report to Moderator
Guest User
Yeah, I didn't like the EBP offsets either.  The method I implemented using definitions is not perfect, but it works in most cases.

One thing I like about GoAsm is that it's syntax is consistent.  Once you learn it, it will make a lot of sense.

Greg
Logged
E-mail E-mail Reply: 4 - 9
13
August 26, 2008, 8:51am Report to Moderator Report to Moderator
Guest User
Quoted from 26
I am working to rewrite some of my ASM and lowlevel code from NASM to include it directly in XBlite.This is a MMX copying demo and i'll post more if i think they can be usefull.



Have you seen AdaptAsm.exe, which is part of the GoAsm distribution?  It automates some of this.

Greg
Logged
E-mail E-mail Reply: 5 - 9
26
August 26, 2008, 12:23pm Report to Moderator Report to Moderator
Guest User
Thanks i'll take a look to this tool but i think it will not very usefull because i'm trying to rewrite code (Nasm/Xblite) to take advantage of MMX/SSE (speaking about SSE, it is difficult to find a correct doc about that, it is often a list of opcode quickly commented without diagrams :s)
Logged
E-mail E-mail Reply: 6 - 9
26
August 28, 2008, 11:16am Report to Moderator Report to Moderator
Guest User
After testing more mCopy, i realized it was slower when using MMX so i rewrote it to use fully MMX register so now it is faster
I inclued too mFill(MMX) and mCompare(MMX/SSE) , the program testes theses funcs in 6 steps, the size of blocks if powered by 2 each step.

-copying  block to another (use MMX if it is larger than 64bytes)
-filling a block with 0
-comparing  identical blocks
-comparing differents blocks

On a AthlonXP2400+, the MMX code is faster except when blocks are differents (results varies a lot).Theses funcs are not located on the main file so you can include them with m4 without modifications (see memtest.x).To compile demo, load memtest.x and compile with M4 preprocessor checked in options/compiler.



This post contains attachments; to download them you must login.

Logged
E-mail E-mail Reply: 7 - 9
Rhett Thompson
August 28, 2008, 2:57pm Report to Moderator Report to Moderator

Baby Member
Posts: 23
Dude, great job on this!
Logged Offline
Site Site Private Message Private message AIM AIM Windows Live Messenger WLM Reply: 8 - 9
26
August 29, 2008, 10:03am Report to Moderator Report to Moderator
Guest User
Made a little error in mCopy, edited and attached



This post contains attachments; to download them you must login.

Logged
E-mail E-mail Reply: 9 - 9
1 Pages 1 Recommend Thread
Print Print Thread

XBLite Forum    General Boards    Working Code Snippets  ›  Low Level stuff (ASM inside)

Thread Rating
There is currently no rating for this thread