News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

What is best alternative?

Started by daydreamer, January 17, 2021, 08:08:18 PM

Previous topic - Next topic

daydreamer

If I have x and Y coordinates.  variables Stored in fixed point 16:16 so I get smooth movement, final fetch upper half for drawing? What is best?
Mov zx?
Mov +shift?
Push /pop?
Packed expand words to dwords?
my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding

hutch--

Depends on how fast you want to access the data, 2 x 16 bit is smaller but you have to extract the data but 2 x 32 bit are faster access in the decoding. Effectively splitting a single value into 2 parts is expensive time wise. If you want them as 16 bit values, store them sequentially as 16 bit values in an array.

daydreamer

Quote from: hutch-- on January 17, 2021, 09:17:14 PM
Depends on how fast you want to access the data, 2 x 16 bit is smaller but you have to extract the data but 2 x 32 bit are faster access in the decoding. Effectively splitting a single value into 2 parts is expensive time wise. If you want them as 16 bit values, store them sequentially as 16 bit values in an array.
could as well go 64bit 32:32 must be most effective with many physics+control code ending in cache xpos,ypos in registers and use only upper 32bit part right before invoke imagedrawing?

my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding

felipe

I belive that in a game you would be updating the position of a game player a lot, so putting those coordinates in registers will be wise. Now, if you code in 64 bits, you have more registers to use, you can still use a 16 bit register part, even in those registers that couldn't do that before, as esi o edi.  :icon_idea:

jj2007

Quote from: felipe on January 18, 2021, 05:36:24 AMyou can still use a 16 bit register part, even in those registers that couldn't do that before, as esi o edi.  :icon_idea:

include \masm32\MasmBasic\MasmBasic.inc
  Init
  mov edi, 11111111h
  mov di, 2222h
  deb 4, "Test", x:edi
EndOfCode


Output: Test    x:edi           11112222

daydreamer

Quote from: felipe on January 18, 2021, 05:36:24 AM
I belive that in a game you would be updating the position of a game player a lot, so putting those coordinates in registers will be wise. Now, if you code in 64 bits, you have more registers to use, you can still use a 16 bit register part, even in those registers that couldn't do that before, as esi o edi.  :icon_idea:
place everything in the same PROC with GetDC/ReleaseDC,64bit registers would have advantage of fast 32:32 bit physics together with invokes takes arguments from registers

actually I update coordinates inside fast timer that has freqency so it fits ca 30fps,a secondary slow timer that spawns/respawns objects that been destroyed
dont know how much faster it would go,if I do packed physics
my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding

TouEnMasm

Quote
If I have x and Y coordinates.  variables Stored in fixed point 16:16 so I get smooth movement, final fetch upper half for drawing? What is best?
Mov zx?
Mov +shift?
Push /pop?
Packed expand words to dwords?

Best way to solve this is to put it in a c program ,use /Ox and /FA,you get an asm who give you the best soluce.
Fa is a musical note to play with CL

felipe

Quote from: jj2007 on January 18, 2021, 09:02:52 AM
Quote from: felipe on January 18, 2021, 05:36:24 AMyou can still use a 16 bit register part, even in those registers that couldn't do that before, as esi o edi.  :icon_idea:

include \masm32\MasmBasic\MasmBasic.inc
  Init
  mov edi, 11111111h
  mov di, 2222h
  deb 4, "Test", x:edi
EndOfCode


Output: Test    x:edi           11112222

You are absolutly right, how can the memory trick me after so much time without coding anything...My statement above should say 8 bit register part, which is not even in the question-topic... :sad:

Shame on me, btw thanks jj you have been very instructive as in other times.  :thup:

jj2007

Quote from: felipe on January 19, 2021, 09:59:26 AMYou are absolutly right, how can the memory trick me after so much time without coding anything...My statement above should say 8 bit register part, which is not even in the question-topic... :sad:

Shame on me, btw thanks jj you have been very instructive as in other times.  :thup:

My pleasure, Felipe. Actually, I wasn't sure myself, as I have never used mov di, ... - so I tested it and it works :cool:

daydreamer

Quote from: jj2007 on January 19, 2021, 10:15:37 AM
Quote from: felipe on January 19, 2021, 09:59:26 AMYou are absolutly right, how can the memory trick me after so much time without coding anything...My statement above should say 8 bit register part, which is not even in the question-topic... :sad:

Shame on me, btw thanks jj you have been very instructive as in other times.  :thup:

My pleasure, Felipe. Actually, I wasn't sure myself, as I have never used mov di, ... - so I tested it and it works :cool:
would be nice to know 64bit choose of register usage,why do my compiler choose R9D(32bit) to use in a loop?
@Toutenmasm
offcourse I try that,but I doubt C compiler know the intention of use fixed point optimizations

my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding

hutch--

Magnus,

The Microsoft ABI (application binary interface) controls the registers that are used for different purposes. I think from memory that there is a list in the 64 bit MASM sub forum.

jj2007

Hutch,

I tried searching for it with abi rax rcx rdx r8 r9 scratch registers - 0 hits. So I took away the "abi" and tried again but was greeted with Your last search was less than 30 seconds ago. Please try again later.

Is that a setting against bots? For human search it makes little sense...

hutch--

> Is that a setting against bots?

Yes.

http://masm32.com/board/index.php?topic=6177.0

jj2007

Can you switch it off for members?

P.S.: I waited long enough and found your post titled Ray Chen on Win64, which explains register use in detail

hutch--

No, its there to stop bot floods.