Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 00:11 04 Dec 2021 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : CMM2: Suggestion to replace Peek(ProgMem, of) and Peek(VarTbl, of)

Author Message
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 1943
Posted: 12:13pm 18 Oct 2021
Copy link to clipboard 
Print this post

Hi Peter,

I recognise that PEEK(ProgMem, offset) and PEEK(VarTbl, offset) only have very specialised use-cases but even within those I'm not sure these are the optimal functions to have in the language because they force the user to read a byte at a time.

Should you consider replacing them with PEEK(ProgMemAddr) and PEEK(VarTblAddr) ? That way MEMORY COPY and MEMORY SET can be used with these data structures, and also PEEK(SHORT|WORD|INTEGER) ... though the user has to be careful to avoid data alignment errors ...

... or is this deliberate to prevent the use poking into these areas ... in which case why is there a POKE(VarTbl ...) ?

Best wishes,

Tom
CMM2 Welcome Tape, Creaky old text adventures
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 5460
Posted: 03:17pm 18 Oct 2021
Copy link to clipboard 
Print this post

In both cases there are reasons you may wish to read a byte that isn't word aligned so I don't intend to change this. You can do something completely different in the Linux port as this is of minority interest
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 1943
Posted: 03:35pm 18 Oct 2021
Copy link to clipboard 
Print this post

Thanks Peter,

  matherp said  In both cases there are reasons you may wish to read a byte that isn't word aligned


My suggestion wouldn't preclude that, e.g.
Peek(Byte Peek(VarTblAddr) + offset)


though you could argue for:
Peek(Byte Mm.Info(VarTblAddr) + offset)


  matherp said  so I don't intend to change this. You can do something completely different in the Linux port as this is of minority interest


Fair enough, I probably won't as I don't envision much call for extensions beyond the capabilities of the CMM2 and PicoMite that aren't specifically related to interacting with a "real" operating-system.

Best wishes,

Tom
CMM2 Welcome Tape, Creaky old text adventures
 
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2021