No Center Mouse Key - Can I Map A Keyboard Key?
Steve Pampling (1551) 8172 posts |
Ah, now the next simple stage is to use BBC BASIC for a bit of assembler. A quick example item of what you can interleave and sort of topical is Martin Avison’s QuickFiler Then if you want to go even further you need a copy of NutPi2 which will give you a copy of the DDE as part of a cheaper bundle that only works on the Pi (if you want a future proof works on any machine then the DDE will cost you more) Just follow the link toward the top of the page on the right hand side “ROOL store” |
Mark (2737) 44 posts |
BBC BASIC for assembler? Okay, I’ll probably stumble onto that sometime. I’m really not sure what Quickfiler has to do with this. Then you’re telling me that to go further I need to buy software? Raspbian came with everything I needed, a couple text editors, as, ld, and gcc. I got as far as writing to the GPIO pins to light LEDs. I’d like to trap CRTL-C so I can clean up and end the program. I’d also like to get an interrupt on pressing a button connected to a GPIO pin. I’m sure I’ll come up with more ambitious ideas later. :) |
Chris Mahoney (1684) 2165 posts |
You can download GCC through PackMan if you prefer, but the DDE is more “native”. BBC BASIC is free though (you can use any text editor and just need to save with the “BASIC” file type, then double-click to run). |
Mark (2737) 44 posts |
Does BBC BASIC assemble, or does it interpret assembly language? To download through PackMan I’d have to drag a hundred foot Ethernet cable through the house. It’s much easier if I can download something on my PC and take it to the Pi on a USB stick. Can I also get gdb, or does that come with gcc? Thanks for your help and sorry if I’ve wandered off the original topic. |
Dave Higton (1515) 3534 posts |
It allows you to assemble some assembly language. It provides a couple of methods to call assembled code. It never interprets assembly language. |
Raik (463) 2061 posts |
Try a surfstick with ComCentre ;-) or you can download all packages manually on your PC: http://www.riscos.info/packages/ABCIndex.html |
Steve Pampling (1551) 8172 posts |
Studying what others have done before. |
Steve Drain (222) 1620 posts |
Not always, but the RISC OS community is relatively small so there is not the huge input that Linux benefits from. So, we are generally prepared to pay for some useful software, even if there are free alternatives. There is also a commercial element to the OS and ROOL does need to make some cash to support its activities. Hence the charge for the DDE, I think. If you want to write assember there is no reason to spend anything.
Not just free, it is in the OS ‘image’ and is used in many apsects of the Boot process, for instance.
BBC BASIC has had a built-in assembler since the BBC Micro 30+ years ago. The method of using it will be unfamiliar at first, hence the suggestion that you look at the source to QuickFiler, I think. The latest versions of BASIC will assemble VFP on the Pi and can probably cater for all your immediate needs.
Take note – “RISC OS is not Linux”. This is another country and we do things differently here. ;-)
It might be best to mention before you do it that you should only unpack archives on RISC OS, otherwise you will loose the filetypes and software will not run. This catches out many newcomers. |
Mark (2737) 44 posts |
Thanks for all the tips. I’ll look at Quickfiler again, I didn’t realize it included the source. A couple questions: What is “surfstick with ComCentre”? What key do you use in Risc OS to stop a program in an infinite loop? |
Chris Mahoney (1684) 2165 posts |
Alt-Break. |
Mark (2737) 44 posts |
Thanks. My Rii keyboard doesn’t have a break key. (The PC I’m typing this on has one.) |
Raik (463) 2061 posts |
Surfstick means a 3G GSM/UMTS. USB Stick. ComCentre is a free program collection to use it in RISC OS. Connect with WWW, SMS, locate via CellID, … |
Steve Fryatt (216) 2105 posts |
What key do you use in Risc OS to stop a program in an infinite loop? In the context of Ctrl-C, I’d have thought the RISC OS equivalent would be Escape. |
Steve Fryatt (216) 2105 posts |
You have to make sure that you sort out the dependencies yourself, but you can download the packages manually and install them by hand (a package is just a Zip file). For details, see http://www.riscos.info/index.php/GCC |
Steve Fryatt (216) 2105 posts |
Possibly. The main development suite for RISC OS is the Desktop Development Environment, which is commercial. I think that’s at least partly a licensing thing, as Acorn’s rights for that didn’t all go to Pace and then Castle (the Norcroft compiler is used in ARM’s dev tools, IIRC). For an assembler, you basically have three options. The first, as others have said, is the BASIC Assembler. It’s quirky, and slightly limited, but the fact that you can use any BASIC construct to assist with the assembling is very powerful. A lot of stuff uses the BASIC Assembler, as others have pointed out. Otherwise, you’re looking at ObjAsm or AsAsm – the former comes as part of the aforementioned DDE (and therefore costs you some money); the latter is part of GCC (and hence freely available). ObjAsm is used to build several parts of RISC OS itself, and so is “standard”. AsAsm uses the same source file syntax, but also seems to assume that you already know what that is – making a copy of the ObjAsm manual helpful. |
Rick Murray (539) 13850 posts |
Yes, I think1 that is what raises SIGINT. It can be trapped and handled via a normal signal handler; but if that is too difficult/bothersome, you could use an OS_Byte call or two to make ESCape return a regular keycode (27, I think1) and then just pick it up as a keypress.
If you only want to use the DDE on a Pi, you may like to investigate the “NutPi” package. It contains some useful software (SparkFS – makes zip files behave like regular directories in the filesystem; PhotoDesk – like a simple Photoshop; Writer+ – a word processor; plus the DDE. And a bunch of other things too – look at https://www.riscosopen.org/content/sales/nutpi). It may suck to have to pay for what you might expect to be free, however RISC OS does not have the weight of developer support that other OSs have. If you take a look at low cost or free products, they are often the product of development teams (and increasingly will contain embedded advertising and the like – this is most endemic in mobile device apps). The BASIC assembler is fairly powerful, but code needs to be written to conform to BASIC’s way of doing things (take a quick look at http://www.heyrick.co.uk/armwiki/Tutorial01 for an example “wrapper”); however you can freely hop in and out of BASIC so you can do some fairly powerful stuff in code generation. 1 My memory is hazy because it has been quite a while since I have programmed in the single-tasking world. Things behave a little differently in the desktop world. |
Rick Murray (539) 13850 posts |
Here we go. Some old source from a single-tasking program. At the top, two functions:
And towards the start of the main() function:
In a loop that does stuff, I periodically do this:
The “peek()” and the peculiar “getch()” behaviour is that presented by dos.h and conio.h with TurboC++ v1.0. I wrote a compatibility layer for RISC OS that picks up these specific things and munge RISC OS actions into TurboC-like actions. It was much easier to get RISC OS to fake the DOS style libraries than the other way around.
Whether or not you need to go to this level of complexity depends upon how responsive the system must be. You could, with a module (relocatable module, sort of like a TSR/DLL), periodically poll the state of the GPIO pin, maybe every 10cs, and set a specific word in memory, which a foreground task could pick up and perform an activity upon. |
Chris Mahoney (1684) 2165 posts |
Oops, completely missed that! |
Raik (463) 2061 posts |
ComCentre: A small video you can find here . Sorry, during recording there is a small delay between mouse movement and display. Looks a bit awkward ;-) |
Mark (2737) 44 posts |
An avalanche of information :) Thanks everyone. I have a lot to chew on. |
John WILLIAMS (8368) 495 posts |
For completeness for anyone arriving here from a search, Steve Revill, ROOL MD, has a program !WinMenu to do exactly what the OP wanted, which was to replace the middle mouse button function with a keypress. It can be found at: http://www.7thsoftware.co.uk/download.html and predates this enquiry by 5 years. |
Jean-Michel BRUCK (3009) 362 posts |
Bonjour John, |
Alan Adams (2486) 1149 posts |
My laptop doesn’t have a menu key. Does something exist to use the Windows key? |
John WILLIAMS (8368) 495 posts |
Salut, Jean-Michel! We have an English saying that:
The thread above goes through reams of stuff without getting very far. I added my posting just above Jean-Michel’s after 8 years which answers precisely this question, though I’m sure !Hid can do it as well! I resurrected this thread, as I said, to aid anyone finding it in a search. I use !WinMenu with my Logitech K400+ wireless keyboard to make it at least useable with RISC OS. But I prefer a real 3-button mouse – who wouldn’t? |
Alan Adams (2486) 1149 posts |
So I still have a problem. I’m using VRPC-DL on a Windows 10 laptop. I want to configure one of the laptop keys as menu, probably F9. !Hid says "requires RO 5. something. What would work in this situation? |