Re: copy WORD to BYTE array
Hmmm - pseudo-code, but:
point at the start of the word array
point at the start of the byte array
load a byte from the word array
store the byte to the byte array
inc the byte pointer
inc the word pointer by 2
loop
(If the word array is in low-byte-at-high-address order, initially point at the word array + 1)
Re: copy WORD to BYTE array
that's that's the first thing i tried and what the second loop does. but it's slower. the reason is most likely that you have more memory read/write operations and more loop iterations that way. i already optimized the code to read 2 dwords from the word array and write one dword to the byte array inside the first loop. the only way to make it faster seems to be to reduce the slow memory read/write operations, but i have no idea how to reduce them even more.
Re: copy WORD to BYTE array
The only thing faster than memory r/w is register r/w. Get a processor with a few gigs of register space. :)
Seriously, other than a register push being faster than a store, I can't think of anything.
Re: copy WORD to BYTE array
a few gigs of register space :eek2: where can i oder that processor? :p
i guess i can live with this code if this is already the fastet way.
thanks Al42 :)
Re: copy WORD to BYTE array
you could try to implement an old tric - I'll leave the coding to you, but you could save the SP, point it to the top of the destination, point another register to the top of the source, pop the register, transfer the low byte to the SP, pop the register, transfer the low byte to the high byte of the SP, push the SP, etc. Saves having to inc one register.