Re: [cc65] Macros in inline assembler

From: Ullrich von Bassewitz <uz1musoftware.de>
Date: 2012-01-19 19:23:13
On Thu, Jan 19, 2012 at 06:31:33PM +0100, "Andreas Rückert" wrote:
> I actually had a solution very similar to this:
>
> http://www.forum64.de/wbb3/board25-coder-unter-sich/board308-programmieren/board29-cross-development/45342-bitcoin-mining-auf-dem-c64/index2.html#post579877
>
> Wp was a pointer to W, but as an array of bytes, not longs.

This code from posting #28 is definitely wrong, because it doesn't dereference
the pointer. The "improvement" in posting #22 is also wrong, because it
introduces undefined behaviour. Are you just measuring execution times or do
you really get proper results? I cannot really believe the latter.

> The code actually not copies the first 16 longs, but 16 longs from the
> data array to the first 16 longs in W. If data would be an array of
> longs, the code would be
>
> W[0] = data[0];
> W[1] = data[4];
> W[2] = data[8];
> ...etc. So a simple memcopy plus byteswap does not help. That's why my
> assembler code has this decrement in data for a 4-byte block (a long),
> but then adds 16 (4 four-byte longs) to get the next long.

Are you sure you understand what this code is doing? Above explanation is
wrong. The code copies the first 16 32-bit values of the memory pointed to by
"block" to the array "W" swapping byte order. And this is hopefully what my
asm code does. Your code posted in the forum doesn't do that. It doesn't even
try to dereference the "block" pointer. Instead it corrupts memory. And it is
several times larger.

Regards


        Uz


-- 
Ullrich von Bassewitz                                  uz@musoftware.de
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Thu Jan 19 19:23:25 2012

This archive was generated by hypermail 2.1.8 : 2012-01-19 19:23:28 CET