Peek, Poke and Big / Little endians.

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

Peek, Poke and Big / Little endians.

Post by evil » Mon Apr 01, 2019 11:16 pm

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: 105
Joined: Fri Nov 14, 2014 6:01 pm

Re: Peek, Poke and Big / Little endians.

Post by bitRocky » Tue Apr 02, 2019 2:21 pm

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: 129
Joined: Mon Jun 14, 2010 1:38 pm

Re: Peek, Poke and Big / Little endians.

Post by evil » Tue Apr 02, 2019 10:56 pm

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: 105
Joined: Fri Nov 14, 2014 6:01 pm

Re: Peek, Poke and Big / Little endians.

Post by bitRocky » Wed Apr 03, 2019 1:14 am

hmm, which Hollywood version are you using?
See here https://www.hollywood-mal.com/docs/html ... /Peek.html

User avatar
airsoftsoftwair
Posts: 3068
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Peek, Poke and Big / Little endians.

Post by airsoftsoftwair » Wed Apr 03, 2019 10:23 pm

@evil: It's a Hollywood 8.0 feature... time to upgrade I guess :)

evil
Posts: 129
Joined: Mon Jun 14, 2010 1:38 pm

Re: Peek, Poke and Big / Little endians.

Post by evil » Thu Apr 04, 2019 8:06 am

I'm using the AmigaOS3-Version of Hollywood 7.1

Post Reply