Should I be using MODE?
|
Hi, I’ve been working through the “first steps” programming book that comes with the RPi image and am now up to where I’m working with graphics. I appreciate that this book is very old so I’m not surprised that it’s using the low-resolution MODE 27. I did a bit of research to see whether I could get the thing running in 1920×1080 but haven’t had much luck so far. The BBC BASIC user guide gives an overview of MODE and says to consult the RISC OS User Guide for information on specific modes. However the latest guide that I can find (for RISC OS 3.7) says that the modes are “old style” and are for backward compatibility. Therefore the impression I got is that I should be using something else now. I’ve tried just a simple “CLS” in place of “MODE 27” and while it stays in 1920×1080, it doesn’t actually clear the screen so my sprites are just appearing on top of the desktop. I’ve also seen reference to “mode strings” and I tried “MODE X1920 Y1080 C256” but that returned a 4:3 mode of unknown resolution. What am I missing? :) Edit: I suspect that I’m overthinking this! I don’t think that I actually want to change modes; I just want to clear the screen (i.e. turn it black). What’s the easiest way to do that? Edit 2: I was writing this post from memory while at work; I’m now back home and in front of the Pi. MODE “X1920 Y1080 C16M” keeps it in full HD but doesn’t full clear the screen; I get a blank window and grey desktop underneath the app-generated graphics. I just want a black screen underneath, and preferably don’t want to hard-code a resolution in the first place. Thanks :) |
|
If you run BASIC in a taskwindow the VDU calls do not seem to work. I suggest you type f12 and then type ‘*BASIC’ – you will find that CLS then works. Alternatively use !MultiTask and drag the BASIC file you want to load or run onto its iconbar icon. !MultiTask may be downloaded from !Store and will set the user-directory to where the BASIC file was dragged from [so that SAVE “FRED” without a path name does what you want]. The output will appear in a window – if you type ‘CLS’ the window will clear but if you type ‘MODE “X1920 Y1080 C16M” ’ the whole screen will (almost) clear [type CLS to clear the grey background to black – not sure why it does this but this behaviour is the same as on VA and Iyonix – presumably the text background colour is grey – using MODE 28 (for example) also sets background colour to black]. Type ’QUIT’ or press f1 to return to the desktop. Type ‘EDIT’ to use the ARM Basic Editor (press CTRL-f5 for HELP). !Zap is a nicer editor and can be downloaded from !Store. Hope this helps. I wrote !MultiTask way back (1988/1989?) to overcome exactly the circumstances you describe. |
|
Thanks for that; it seems that I’m not missing something obvious after all. In the interim I figured out that I could use RECTANGLE FILL over the entire screen without having to touch any MODEs at all but naturally I’m open to any “better” ways of accomplishing things :) I’m currently at work so can’t try out your suggestion right now but it looks like it could be useful. |
|
I raised a the exact same issue, although with Beagleboard and not RPi (see thread “Screen MODEs on BB”). As I intend to acquire a RPi it would be useful if we had guidance, from the experts that be, on what MODEs give what resolution please. |
|
I saw that thread before posting this one, but I’m too much of a newbie and it went over my head to the point where I concluded that you were actually asking a different question :) |
|
Just put: MODE MODE at the start of your Basic program. |
|
You need to run BASIC programs outside of a task window if you’re planning on doing graphical things like changing mode, plotting lines and rectangles and things – because task windows swallow the VDU codes for those things. The simplest way is to double-click your BASIC program in a filer window. I’m sure StrongED will also have a way to run the BASIC program direct from the editor window. |
|
That’s exactly what I’m already doing :) (in hindsight I should’ve said so in my first post). I haven’t tried MODE MODE yet but will when I get home. |
|
Success! Thank you very much; easy when you know how :) |
|
This is a clarification of some slightly confusing statements. Chris wrote:
Steve added:
Being pedantic, neither of these statements is completely accurate, so for the sake of interest or extreme pedantry: TaskWindow is a module that allows single-tasking non-Wimp programs to be run in the multitasking desktop alongside other programs. It handles pre-emption of the program and all its input and output. However, it does not actually present the program to the user, that is done through another desktop program, the host. Typically the host is a text editor like Edit, StrongED or Zap. Text editors display text, they can’t display graphics, so those hosts ignore graphical operations. However, other hosts are available, as Chris implied:
!MultiTask being* a graphically-enabled host for the TaskWindow program. TaskWindow talks to the host through Wimp messages, so it is possible to write your own host for a specific operation, so you can (if you wish) write some complex processing as a separate program which you run under TaskWindow, with your desktop program acting as the host – now you have a form of pre-emption for your desktop program. *I assume! |
|
being* a graphically-enabled host for the TaskWindow program. Actually it is much simpler. It just issues a ‘*BASIC -load progname’ type command when a BASIC file is dragged onto its iconbar icon, presenting the loaded program to the user (similar to double clicking but not running the program, just loading it). It also eavesdrops on directory open requests and sets the user directory to suit each time. |
|
No, you’re thinking of David Ruck’s GraphTask – available from http://www.armclub.org.uk/free/ |
|
I recommend you upgrade to the latest ROM image as I have just tried that and the MODEs seem to behave themselves now, I did not even have to change my monitor settings in !Boot. |