Host Engineering Forum
General Category => Do-more CPUs and Do-more Designer Software => Topic started by: Controls Guy on July 15, 2019, 12:24:33 PM
-
Why will MEMCOPY let me cast but MEMCLEAR not?
MEMCOPY CustomWP0:UW LastCustomWP0:UW 0x20000 MaxRelayWords
MEMCLEAR LastCustomWP0 MaxRelayCount
-
Why will MEMCOPY let me cast but MEMCLEAR not?
MEMCOPY CustomWP0:UW LastCustomWP0:UW 0x20000 MaxRelayWords
MEMCLEAR LastCustomWP0 MaxRelayCount
Because we're mean.
MEMCOPY is blind. MEMCLEAR is type-aware and does struct initialization. We could probably make it work for simple types, but it wasn't straightforward.
-
Ah, gotcha. That makes sense. I was kind of classing the two together mentally.
-
Ah, gotcha. That makes sense. I was kind of classing the two together mentally.
In a perfect world, they would be, but 'cleared' isn't always 'zero'. For simple types it is, but the instruction is built around type awareness and casting violates that.