[gccsdk] Fw: Lost key codes __os.s ?

Ronald ronanon at zoho.com
Fri May 29 05:47:24 PDT 2020

Begin forwarded message:

Date: Thu, 28 May 2020 15:40:18 +1200
From: Ronald <ronanon at zoho.com>
To: gccsdk mailing list <gcc at gccsdk.riscos.info>
Subject: Lost key codes  __os.s ?

I am wondering if the recipe file --os.s  is part of the unixlib
module build or if I am in the right area.
I cant remember if building Native outputs the unixlib module.

I would like to try altering the following snippet
	.global	__os_inkey
	NAME	__os_inkey
	MOV	ip, a1
	MOV	a1, #0x81
	AND	a2, ip, #0xff
	MOV	a3, ip, LSR #8
	MVNVS	a1, #0
	MOVVS	pc, lr

	TEQ	a3, #0
	MOVEQ	a1, a2
	MVNNE	a1, #0
	MOV	pc, lr

I haven't worked out what the #0x81 or the XOS_Byte is doing yet.
But the end goal is to get keyboard values (maybe all above
0x100) or at least the arrow key area OR'd with 0x10 to get them back
to what they should be.
Currently these keys are EOR'd and shifting down by 0x10.
The arrow keys (0x18c-18f are not getting converted to a readable byte,
and the Up key higher shifted value of 0x19c appears as 0x8c instead.

I had no copy of this post sent back, so I'm forwarding my copy with
a further post.

I built this program to use OsByte129 with both unixlib and libscl and
the output result is the same wrong codes. I guess it would be
interesting if the Norcroft compiler would do it differently, but if we
are stuck with it, maybe will have to just add ox10 to arrow/page etc

#include <oslib/os.h>
#include <oslib/osbyte.h>
#include <stdio.h>

int main (void) {
	int r1_in;
	int r2_in;
	int *r1_out;
	int *r2_out;
	while (1)  {
	r1_in = 64;
	r2_in = 68;
	printf("%d  &%02X   %d\n",*r1_out,*r1_out,*r2_out);
	return 0;

I just took a guess at the r1 and r2 in (timer) values, seems to have
worked for this exercise.

Is there a way to build unixlib module separately from RONATIVE?

Further to this,
adjusts the destination area for what should be in &80 range.
126 puts the arrow keys at &8a-&8D just below the pgup and pgdn values
Probably doesn't need to be done at every key press, but if it was in
unxlib, it would save linking OSLib every time.

I will do some more checking on my Iyonix and maybe dig out a RiscPC.
There may be more keys that can be picked up, supposed to have f10 -f12
and insert too but they probably cross ovetr into system use, f12 does
definetly. From a line editiong point of view, the arrow keys will make
a big difference. The Backspace key can be set to 127 inside termios.h,
and the delete key could be set to an unused value that can be
converted by the line editor to do the same or similar. 


More information about the gcc mailing list