Risc OS peek and poke substitutes half way down


there isn’t a peek or poke to be found anywhere,
and if you just want single byte indirection there is the ? operation
so to peek at an address use:-
val = ?address%
or to poke
?address% = val%
? also works with offsets just like !

or
address%!offset%=value%
value%=address%!offset%

or
To complete the list and the confusion:
?(address%+offset%)=val%
!(address%+offset%)=val%
works as well.

Wizard wrote:My webserver runs really well and most php stuff does
what its supposed to do but I have yet to wire in my sensors via GPIO.
I must have a butchers at the documentation first since I’m more or
less in the dark when it comes to GPIO and RISC OS.

RISC OS itself has nothing built in to control the GPIO ports, but I
have added Raspberry Pi support to the GPIO module from
http://www.tankstage.co.uk/Software .
This module will let you control the GPIO ports with a SWI interface.
It also detects any MCP23017 GPIO extenders fitted and allows control of them.

Posts: 43

Joined: Thu Dec 15, 2011 5:51 pm

by Wizard » Mon Oct 29, 2012 9:56 pm

tank wrote:RISC OS itself has nothing built in to control the GPIO
ports, but I have added Raspberry Pi support to the GPIO module from
http://www.tankstage.co.uk/Software .
This module will let you control the GPIO ports with a SWI interface.
It also detects any MCP23017 GPIO extenders fitted and allows control of them.
Sweet!!! 😀

Raspberry Pi – finally a worthy replacement for A500!!!

User avatar

Posts: 107

Joined: Sun Aug 19, 2012 4:52 am

Location: Sweden

by Grumpy Mike » Mon Oct 29, 2012 10:20 pm

@tank
While the last alpha version of RISC OS could talk to the I2C lines,
do you know if there is any way of switching it over to the second I2C
bus that appears in the revision 2 boards?

User avatar

Posts: 685

Joined: Sat Sep 10, 2011 7:49 pm

Location: Manchester (England England)

by pygmy_giant » Tue Oct 30, 2012 12:17 am

Sorry to interupt but I downloaded riscos-2012-10-16-RC5.zip via the
torrent, un-zipped it, got the ro519-rc5-1876M.img.bz file further
unzipped that and got 0.fat, 1.img and ‘2’.

What goes where?

burning 1.img to my SD card does not work on my pi.

extracting ro519-rc5-1876M.img.bz to my SD card will not work on my pi either.

Any pointers appreciated.

Posts: 1246

Joined: Sun Mar 04, 2012 12:49 am

by theom » Tue Oct 30, 2012 1:49 am

SEDev wrote:For ssh you could try the packages offered by PackMan
(NettleSSH, Openssh) but I’m not sure if they’ve been updated for
ARMv6/v7.

They both have been. You probably want to use Nettle – the version in
PackMan comes with SSH support. Confusingly, there’s another version
(not in PackMan) called NettleSSH which is ancient and is almost
certainly not what you want.

FTPc… interesting, that wasn’t publically available when I was
upgrading the packages. 1.44 should work in ARMv5 compatibility mode
(the default setting in Configure) but I don’t remember testing it.

Posts: 62

Joined: Wed Jun 13, 2012 2:53 pm

by theom » Tue Oct 30, 2012 1:52 am

pygmy_giant wrote:Sorry to interupt but I downloaded
riscos-2012-10-16-RC5.zip via the torrent, un-zipped it, got the
ro519-rc5-1876M.img.bz file further unzipped that and got 0.fat, 1.img
and ‘2’.

You should unbzip2 that to get ro519-rc5-1876M.img and write that to
SD with the usual SD write tools – looks like your unzip tool is
pulling apart all the partitions in the image, which you don’t want to
happen.

Posts: 62

Joined: Wed Jun 13, 2012 2:53 pm

by tank » Tue Oct 30, 2012 6:49 am

Grumpy Mike wrote:@tank
While the last alpha version of RISC OS could talk to the I2C lines,
do you know if there is any way of switching it over to the second I2C
bus that appears in the revision 2 boards?

I have just uploaded a version that works OK with I2C on the rev 2 Pi……

Posts: 43

Joined: Thu Dec 15, 2011 5:51 pm

by Grumpy Mike » Tue Oct 30, 2012 6:58 am

tank wrote:I have just uploaded a version that works OK with I2C on
the rev 2 Pi……
Thanks.
Sorry a version of what and where is it?

User avatar

Posts: 685

Joined: Sat Sep 10, 2011 7:49 pm

Location: Manchester (England England)

by pygmy_giant » Tue Oct 30, 2012 10:05 am

Will it work on both revisions?

Posts: 1246

Joined: Sun Mar 04, 2012 12:49 am

by theom » Tue Oct 30, 2012 11:51 am

I think tank’s referring to his GPIO module:
http://www.tankstage.co.uk/software.html

RISC OS should detect what revision of board you have and select the
I2C pins as appropriate, so if you speak ‘I2C’ it comes out of the
same pins on P1 irrespective what rev you have. However rev2 boards
also have a second I2C on P5 with RISC OS supports – I’m sure tank
will be along in a moment to say if that works with his GPIO module.

To access raw I2C in RISC OS you call SWI OS_IICOp:
https://www.riscosopen.org/wiki/documen … w/OS_IICOp
(the older IIC_Control still works, but doesn’t know about multiple buses)
and there’s some background on what’s happening underneath here:
https://www.riscosopen.org/wiki/documen … 0IIC%20API

Posts: 62

Joined: Wed Jun 13, 2012 2:53 pm

by pygmy_giant » Tue Oct 30, 2012 2:02 pm

Thanks – looks good -will investigate – still finding my feet….

Burngate has put together this helpful basic guide
https://docs.google.com/viewer?a=v&pid=sites&srcid=ZGVmYXVsdGRvbWFpbnxidXJuZ2F0ZWhvdXNlfGd4OjE1NTlkNjMwNDg4MTQ0NDI

Posts: 1246

Joined: Sun Mar 04, 2012 12:49 am

by Steve Drain » Tue Oct 30, 2012 2:17 pm

tank wrote
[GPIO module] It also detects any MCP23017 GPIO extenders fitted and
allows control of them.
I have written a much less comprehensve module, specifically with the
Ciseco SliceOfPIO in mind, that communicates with this chip over IIC
and allows 8-bit port operations. It is not yet registered or publicly
available, but I can certainly send it to anyone interested.

Posts: 22

Joined: Tue Oct 30, 2012 2:08 pm

by tank » Tue Oct 30, 2012 6:07 pm

theom wrote:
RISC OS should detect what revision of board you have and select the
I2C pins as appropriate, so if you speak ‘I2C’ it comes out of the
same pins on P1 irrespective what rev you have. However rev2 boards
also have a second I2C on P5 with RISC OS supports – I’m sure tank
will be along in a moment to say if that works with his GPIO module.

The second I2C is not supported ATM in RISC OS.
The I2C support detects which rev pcb its running on and makes the
port on the main expansion header the primary port.

Steve Drain wrote:I have written a much less comprehensve module,
specifically with the Ciseco SliceOfPIO in mind, that communicates
with this chip over IIC and allows 8-bit port operations. It is not
yet registered or publicly available, but I can certainly send it to
anyone interested.

Steve, the latest GPIO module also has 16 bit wide access to the ports
using SWI GPIO_ReadExp32 and the other …Exp32 calls to read and
write the OE register and data registers (it reads/writes both 8 bit
ports and sends/presents the data in the bottom 16 bits of the
returned/sent register from the SWI’s).

Posts: 43

Joined: Thu Dec 15, 2011 5:51 pm

by stylx » Tue Oct 30, 2012 6:56 pm

I’ve read through the bbc basic manual and there isn’t a peek or poke
to be found anywhere, so the only way to get to the GPIO is if some
acorn or arm programmer to write the machine code for it maybe a wimp
interface would be nice.
only been using risc os for about a month and been using linux since
98. But I would pick risc os every time it’s so fast and linux appears
to be overkill for pi and considering it’s aimed at schools, to much
to learn unless your a real computer geek.
I have been looking at arm assembly and is a little confused by 26bit
and 32bit when programming. I have a book but it only seems to cover
the 26bit programming technic. how simular are they to program any
tips would be helpful

Posts: 30

Joined: Thu Oct 25, 2012 10:06 pm

by Steve Drain » Tue Oct 30, 2012 7:25 pm

tank wrote:
the latest GPIO module also has 16 bit wide access to the ports
That’s a lot closer to what I want, which is to be similar to BBC B
I/O ports. But it does not yet do some things I would like, nor
something similar for the GPIO pins. Could we liaise on this?
steve[at]kappa[dot]me[dot]uk

Posts: 22

Joined: Tue Oct 30, 2012 2:08 pm

by Steve Drain » Tue Oct 30, 2012 7:48 pm

stylx wrote:I’ve read through the bbc basic manual and there isn’t a
peek or poke to be found …

In BBC BASIC you use indirected variables for PEEK and POKE, a much
more powerful construct, eg:

CODE: SELECT ALL

address%!offset%=value$
 value%-=address%!offset%
write and read a 4-byte word to a particular location. There are more
things to find out about indirected variables, and they can be used in
nearly every place that a normal variable can be used. However, they
are no substitute for structures and they can get ugly when used for
complex maniputlations.

For the GPIO you have Tank, who has written a module [in machine code
in this case] so that access is made simpler. A module is an operating
system extension. The interface is through software interupts (SWIs)
which can be called from any language. RISC OS itself is highly
modular.

As for assember, everything now should be written for 32-bit only.
However, nearly everything that you find out about 26-bit is going to
be helpful. The biggest difference is in how the flags are handled,
which has implications for calling subroutines. You will get lot of
help from comp.sys.acorn.programmer.

Posts: 22

Joined: Tue Oct 30, 2012 2:08 pm

by Steve Drain » Tue Oct 30, 2012 7:51 pm

Oops! Finger trouble. 😮

CODE: SELECT ALL

 address%!offset%=value%
   value%=address%!offset%

Posts: 22

Joined: Tue Oct 30, 2012 2:08 pm

by Grumpy Mike » Tue Oct 30, 2012 9:58 pm

there isn’t a peek or poke to be found anywhere,
and if you just want single byte indirection there is the ? operation
so to peek at an address use:-
val = ?address%
or to poke
?address% = val%
? also works with offsets just like !

User avatar

Posts: 685

Joined: Sat Sep 10, 2011 7:49 pm

Location: Manchester (England England)

by Raeddie » Tue Oct 30, 2012 10:30 pm

Grumpy Mike wrote:val = ?address%
or to poke
?address% = val%
? also works with offsets just like !
To complete the list and the confusion:
?(address%+offset%)=val%
!(address%+offset%)=val%
works as well.

Posts: 13

Joined: Sun Aug 05, 2012 9:09 am

by pygmy_giant » Tue Oct 30, 2012 10:57 pm

Nice.

Call me a splitter but … is there a version of GCC(SDK) available
for this flavour of RISC OS?

(http://www.riscos.info/index.php/GCCSDK)

Can I just use the latest release from this page:
(http://www.riscos.info/downloads/gccsdk/)

What compiled programming options are available?

for packages in general, can I just use any old RISCOS app or do I
need architecture specific versions?

Thanks.

Posts: 1246

Joined: Sun Mar 04, 2012 12:49 am

by Steve Drain » Tue Oct 30, 2012 11:08 pm

Grumpy Mike wrote:To complete the list and the confusion:
?(address%+offset%)=val%
!(address%+offset%)=val%
works as well.

As I said, there are more things to find out about indirected
variables, and that does not complete the list, yet. 🙂

Posts: 22

Joined: Tue Oct 30, 2012 2:08 pm

by pygmy_giant » Tue Oct 30, 2012 11:19 pm

Raeddie wrote that, not GM.

Pygmy_giant wrote:

Nice.

Call me a splitter but … is there a version of GCC(SDK) available
for this flavour of RISC OS?

(http://www.riscos.info/index.php/GCCSDK)

Can I just use the latest release from this page:
(http://www.riscos.info/downloads/gccsdk/)

What compiled programming options are available?

for packages in general, can I just use any old RISCOS app or do I
need architecture specific versions?

Thanks.

Posts: 1246

Joined: Sun Mar 04, 2012 12:49 am

by theom » Wed Oct 31, 2012 12:28 am

pygmy_giant wrote:Nice.

Call me a splitter but … is there a version of GCC(SDK) available
for this flavour of RISC OS?

(http://www.riscos.info/index.php/GCCSDK)

Can I just use the latest release from this page:
(http://www.riscos.info/downloads/gccsdk/)

Yes, GCC 4.1.2 release 2 or later should be fine. Previous releases
won’t emit correct code on ARMv7 processors, which includes the Pi
with the CPU set to ARMv7 strict mode (see below). GCCSDK (the cross
compiler – build on Linux/Mac/etc, run on RISC OS) will also work.

for packages in general, can I just use any old RISCOS app or do I
need architecture specific versions?

It’s complicated. ARM keep changing the instruction set, so there have
been a variety of architecture changes which affect compiled programs.
There’s not really any concept of building for a specific architecture
(armhf, armel, etc) – almost all RISC OS programs built today can run
on an ARM2 from 1987 – the problem is running old programs on new
hardware:

•       Pre-2002, things used ’26 bit mode’. These won’t work directly
(there’s an emulator called ‘Aemulor’ that supports them).
•       Post-2002, things should have been written in ’32 bit mode’. These
should work on the Pi with the CPU settings (in Configure) in ‘ARMv5
compatibility mode’ (the default).
•       ARMv7 changed some things that broke ARMv5 programs (specifically
‘unaligned loads’). Beagleboards and similar don’t have an ‘ARMv5
compatibility mode’, so things needed recompiling to work on ARMv7.
You can test this by setting ‘ARMv7 strict mode’ in Configure.
Rough rule of thumb:

•       Pre-2002: need Aemulor
•       2002-2009/10ish: need ARMv5 compatibility mode on, won’t work on
Beagleboard/etc
•       2010-now: should be fine whatever mode and on all hardware
•       New software you write: test in ARMv7 strict mode.

Posts: 62

Joined: Wed Jun 13, 2012 2:53 pm

by pearcecg » Wed Oct 31, 2012 10:34 am

The first release of RiscOS for the Pi is fantastic – well done guys.

Everything seems to work well and response is very snappy – as good as
if not better than Iyonix.

Network over DHCP just works – network printers up and running via
ethernet (don’t know what ethernet over USB means!)

Boot up says ‘keyboard not detected’ but works OK.

Can we arrange for more ram to be used than 128MB, particularly with
the 512MB Pi?

Can we somehow use the extra memory on SD cards > 2GB? Mine is 8GB.

Machine freezes trying to write to Fat32 stick.

Still, for a first release pretty amazing

George Pearce

Posts: 1

Joined: Wed Oct 31, 2012 10:21 am

 Search This Topic

 Post a reply

134 posts   Page 2 of 6

1

2

3

4

5

6

 Return to RISCOS

Advertisements
This entry was posted in http://schemas.google.com/blogger/2008/kind#post, Raspberry Pi. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s