Peek, Poke and Big / Little endians.

Discuss any general programming issues here
Post Reply
evil
Posts: 177
Joined: Mon Jun 14, 2010 1:38 pm

Peek, Poke and Big / Little endians.

Post by evil »

Maybe, I'm wrong, but shouldn't give

Code: Select all

AllocMem(1, 2)
Poke(1, 0, $100, #SHORT, TRUE)
DebugPrint (Peek (1, 0, #SHORT, TRUE))
DebugPrint(Peek(1, 0, #SHORT, FALSE))
d
ifferent values??

Best regards

George
bitRocky
Posts: 120
Joined: Fri Nov 14, 2014 6:01 pm

Re: Peek, Poke and Big / Little endians.

Post by bitRocky »

You used TRUE/FALSE as the "endian" argument, you should use the constants #BIGENDIAN, #NATIVEENDIAN or #LITTLEENDIAN.

Code: Select all

DebugPrint(HexStr(Peek(1, 0, #SHORT, #BIGENDIAN)))
DebugPrint(HexStr(Peek(1, 0, #SHORT, #LITTLEENDIAN)))
evil
Posts: 177
Joined: Mon Jun 14, 2010 1:38 pm

Re: Peek, Poke and Big / Little endians.

Post by evil »

That doesnt help. All three constants return en error: Constant not found.

Also, the Guide says:

ne Optional. True, if you want to use native endian byte order.
(Defaults to FALSE) (V6.0)

At the moment, I use MemToTable() and TableToMem() as a workaround. They seem to work correct, when useing the EndianSwitch-argument.

Also I could use the then Math-function EndianSwap() That also works.

But As I need to look into Millions of Bytes, Every extrac command will slow down the function a lot...


Best regards

George
bitRocky
Posts: 120
Joined: Fri Nov 14, 2014 6:01 pm

Re: Peek, Poke and Big / Little endians.

Post by bitRocky »

hmm, which Hollywood version are you using?
See here https://www.hollywood-mal.com/docs/html ... /Peek.html
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Peek, Poke and Big / Little endians.

Post by airsoftsoftwair »

@evil: It's a Hollywood 8.0 feature... time to upgrade I guess :)
evil
Posts: 177
Joined: Mon Jun 14, 2010 1:38 pm

Re: Peek, Poke and Big / Little endians.

Post by evil »

I'm using the AmigaOS3-Version of Hollywood 7.1
Post Reply