Advertisement 40 years of improving on the best. In 1981 the first BBC Microcomputer was released with 16K RAM, 8 colours, and a clock speed of 2MHz. Over the next 40 years a pedigree of fast machines running the world’s best , RISC OS, appeared. We won’t bore you with the rest of the facts. Except to tell you about the latest . Which runs RISC OS*, of course. It has 253,952 as much RAM, 2 million more colours, runs 900 times faster, and is 10 times lighter than the BBC Microcomputer.

BBC Microcomputer Model A. 8 colours, 16K RAM, 2MHz, 3700g. Raspberry Pi 400. 16M colours, 3968MB RAM, 1.8GHz, 386g. The new Raspberry Pi 400. Still improving on the best. Raspberry Pi 400 machine available from all good internet retailers. RISC OS downloadable separately. *Other operating systems available. “Raspberry Pi” is a trademark of the Raspberry Pi Foundation. E&OE.

Drag ’N Drop | www.dragdrop.co.uk | Winter 2021 | Page 2 Contents EDITORIAL Welcome to another edition of Drag ’N Drop. Amongst the gloom of the pandemic, there’s something to look forward to in 2021 and that’s 40 years of the BBC Micro. Incredible to think the little beige machine and its sucessors like the Archimedes and RISC OS introduced many people to and programming in a fun way, your editor being just one! Were it not for that I doubt I would have been remotely interested in computers as they’d just be drab, inaccessible things running horrible operating systems. So do please keep on supporting RISC OS developers, large and small. Enjoy the read. CONTENTS

Copyright ©2021 Drag ‘N Drop Editorial...... 3 Produced on RISC OS computers. Beginner’s Page ...... 4 This issue has been blessed with contributions from the following people: Norman Lawrence (Schema2) News and App Updates ...... 5 Christopher Dewhurst (everything else) Text Editing with Outline Fonts...... 7 The views expressed in this magazine are not necessarily those of the editor. Alternative views are always welcome and can be expressed by Raspberry Pi 400 first look ...... 11 either writing an article or a short editorial. All articles and advertisements are published in Acorn – a World in Pixels review ...... 10 good faith. No materials in this publication are meant to be offensive or misleading. If you Fast Icons...... 11 come across something you believe is either of the above please contact the editor using the details below. Desktop Solitaire...... 14 Contact Information Programming in Postscript ...... 17 Editor: Christopher Dewhurst Email: [email protected] www.dragdrop.co.uk Toolbox with Basic...... 20 Using WimpWorks2...... 26

Drag ’N Drop | www.dragdrop.co.uk | Winter 2021 | Page 3 Beginners How do I get the BBC Basic the Raspberry icon and under type SAVE "myprog". Application tasks prompt? click and drag the Next slide bar out to the right. How do I open an Applcation Press F12 and type *BASIC and press Return. You can Task window Directory? *BASIC change the screen mode ARM BBC BASIC V Application directories begin with a version 1.54 ! called 'pling'. Hold down the shift with MODE n where n is a Starting with 651516 bytes free key and double click select to open number e.g. MODE 7 or > MODE 0. the directory. Type AUTO for automatic line I get a blank screen when numbering. Press Escape to stop and You can also type programs in a task running games listings type SAVE "myprog" followed by window, press Ctrl and F12. You Check you have the Anymode Return to store myprog on hard disc. can't use the cursor editing facility module installed, download it from To return to the desktop type or change MODE so you might like www.pi-star.co.uk/anymode. It goes *QUIT. GraphTask from armclub.org.uk/ in !Boot.Choices.Boot. Predesk. Programs listed in Drag ’N Drop free/. It allows you to type in and Open the !Boot application are assumed to work on all run Basic programs that use simple directory, in the root directory of the machines with RISC OS 5 e.g. graphics (not sprites) in a window SD Card, that is SDFS::RISCOSPi. Raspberry Pi, unless otherwise on the desktop. $.!Boot. Locate the Loader file and stated. To run Basic programs from with Shift held down double click it to open it. Create a text file in Menu Adjust the desktop, double-clicking How do I with select on the filer icon runs it. Edit with the following line open a Task Select Holding down Shift and double (press Return at the end): clicking loads it into a text editor disable_mode_changes window? Save it inside Loader as CMDLINE/ like !Edit. Menu click TXT and restart your machine. over the Scroll wheel mouse Raspberry icon on the right side of What does ‘currently selected Sounds are strange the iconbar and select click on Task directory’ mean? Some listings need the free RDSP window. Or press Ctrl+F12. Articles may tell you to set the CSD module installed. Download it from (currently selected directory). Click www.amcog-games.co.uk/rdsp.htm You may need to reserve more menu over filer window and choose where you’ll find instructions on memory for the task. Adjust-click on Set directory ^W. It’s where the how to install it. computer stores the file when you Drag ’N Drop | www.dragdrop.co.uk | Winter 2021 | Page 4 News and applications New Raspberry Tails from the Wimp The latest addition to the Pi TailWimp Lite is a family is the Pi 400, released utility for arranging by the Pi Foundation at the desktop windows end of 2020. It’s an all-in-one keyboard shortcuts Arm A72-based compact (Ctrl+Shift and arrow computer with integrated keys). The program is keyboard which can run very much in RISC OS. We take a first look development stages at at it on page 11. the moment and you can try it out by visiting GraphTask github.com/skymandr/ GraphTask is a TailWimpLite/releases/download/ free application inside a GraphTask v0.1.0/TailWmpLt.zip which allows window. many single- Maryland Escapee tasking programs Rainbow snakes live in swamps in (including ones Tutorial Central the Atlanic region of the USA and using VDU One of the one seems to have escaped to star in graphics) to be criticisms of RISC this 'snake' type game. You guide run in a window OS is the lack of on the desktop. It documentation has been (except in your recompiled to fix favourite issues with the Raspberry Pi 4. magazine, of course). A central Version 4.04 can be freely repository of tutorials for new users downloaded from armclub.org.uk/ and advanced users (DDE free/. GraphTask comes with 35 developers, C programming and the programs written in BBC Basic like) has been pulled together at demonstrating what can be done www.riscository.com/tutorials/.

Drag ’N Drop | www.dragdrop.co.uk | Winter 2021 | Page 5 News your creature around the screen enough for A4 paper. www.kevsoft.co.uk. eating strawberries (it doesn't like Small-time developers are the raspberries, evidently) avoiding backbone of the RISC OS economy, your ever-growing tail and the edges and whilst Kevin's applications are of the playing area . free so you should consider making Simple but highly addictive with a small donation at www.ko-fi.com/ great graphics and sound effects, kevsoft (ko-fi, the price of a coffee, Rainbow Snake is free from geddit?) www.proggies.uk/riscosstuff/riscos/ zip/rainbowsnake_riscos.zip.

Lua Help The RISC OS port of Lua, the high- level programming language available for a wide computer platforms now comes with a StrongHelp manual. Download it from www.wra1th.plus.com/lua/ risclua.html.

Pimp your Draws Draw is the free vector-based Counting application which has come bundled CLOC is a command-line program with every RISC OS version and They work for you which counts blank lines and this freeware add-on has received an MPdata+ is an application comment lines in code in a variety update. DrawPrint 1.53 from to keep tabs on your of computer languages. Download it www.sinenomine.co.uk/software/ Member of the UK Parliament. Type from riscosm/downloads.php allows you in your postcode and it retrieves www.coleman.orpheusweb.co.uk/ to print Draw files over several information from Westminster on downloads/cloc_v100.zip. sheets of paper, it even puts cut how your local MP is doing with marks in the margin. Useful if (like attendance, debates and so forth. most of us) your printer is only big Version 2.01 is available from Drag ’N Drop | www.dragdrop.co.uk | Winter 2021 | Page 6 This program TEXT, the address in memory are now made by its handle. demonstrates how where the text is stored. Chocolate bar number one was an to edit text in an The program uses eight SYStem easy one wasn’t it ! outline font on calls concerning outline fonts. They RISC OS. In all take the form SYS 2. SYS "Font_SetPalette",,, essence it’s a very “Font_SomethingOrOther”. Some 1,C,B,F simple word of these calls are very tricky to get Sets up the colours in which the text processor. your head round. Award yourself a is to be painted. C is the number of Two pangrams large chocolate bar for each call you shades used for the anti-aliasing – sentences that use manage to get the hang of ! starting at B (background) and all letters of the finishing at F (foreground). B and F alphabet – are 1. SYS "Font_FindFont",, are 24-bit values in &BBGGRR00 displayed. The user Font$,X,Y TO FH format (BB=Blue, GG=Green and can insert new text This ‘opens’ a font for future use. RR=Red). So for yellow text on by clicking the Font$ holds the name of the font black, B=0 and F=&00FFFF00. The mouse to position required, for example Trinity. program chooses a random colour. the caret then typing Medium or Corpus.Bold. X and Y C can be anything from one to at the keyboard

with outline fonts are the horizontal and vertical type 255 with one giving the the jagged (including Return) sizes, in printer's points multiplied appearance of fonts on inferior to insert text and by 16 (for instance to get a 10 by 12 systems like Microsoft Windows erase it with the Delete or backspace point font, X=160 and Y=192). The and 255 the maximum. In practice, 6 keys. Press Tab to finish the computer returns the 'handle' of the is sufficient for most purposes. program and display the contents of font in FH. All references to the font Drag ’N Drop | www.dragdrop.co.uk | Winter 2021 | Page 7 Review Raspberry Pi 400 – first look Whilst the beginning of a reflash it with a ‘special new decade is marred by the edition’ of RISC OS freely global pandemic, it also downloadable from RISC OS heralds the appearance of a Open, www.riscosopen.org. new generation of Raspberry up, there’s a good Pi’s. 10 seconds or so before the The Raspberry Pi 400 was RISC OS splashbox appears actually released just before announcing an incredible 3,968 Christmas 2020 and branded a meg of Ram! The RISC OS “Personal Computer” coming desktop appears soon after, inside an integrated keyboard, with a dark pink theme; a wire- much like the Acorn Electron frame robot holds the RISC OS nearly 40 years before. cog inside a spinning orb. The machine is styled in As with every new iteration white and dark pink and if you of Pi, there are bound to be buy the full kit for around £93 so the Pi 400 is at least twice as compatibility issues with software you’ll get a mouse in matching much as previous models. and we haven’t had time to test out livery plus (more importantly) the At the heart of the Pi 400 is the many applications. Software cables. These are different from the Arm Cortex A72. Arm chips have developers will iron out any Pi’s 1 to 4. Video output is through powered every native RISC OS problems in due course (programs mini-HDMI sockets and the power machine since the Archimedes in the written in BBC Basic V like Drag is via a USB type-C. 1980s so RISC OS is the natural ’N Drop magazine listings aren't All ports are now located on the choice of operating system for the generally affected). backside of the machine, a vast Pi, though it’s yet to take advantage Some will deem the Pi 400's improvement on the previous Pi’s of features like quad-core ‘scrabble tile’ keyboard too flimsy where they were spread around all processing. (Being so fast anyway, I for serious work and others will see four sides. This includes the user suspect it may not make that much it as just a hobbyist machine with a (GPIO) and ethernet ports, plus two difference to RISC OS.) retro look but the Pi 400 is a normal-sized USB sockets. The Pi 400 ships with its own promising machine. It just depends The machine can be purchased proprietary operating system on a on how quickly (or slowly) yet without accessories for around £67 micro-SD card so you will need to another Raspberry Pi appears ! Drag ’N Drop | www.dragdrop.co.uk | Winter 2021 | Page 11 Review Product: Acorn - A World in Pixels If like me, you’re interested in the to bother with a book on games.) Price: £29.99 technical aspects of the Beeb as well Some shortcomings in the proof- Supplier: Idesine Publishing, as its social history you’ll like the reading of this book made me cringe www.idesine.com programming pearls dropped in by and it makes no mention of the With the country in lockdown, the interviewees, such as assembly Raspberry Pi although the RISC OS what better way to celebrate 40 language tricks and compressing scene isn't entirely forgotten about. years of the BBC Micro than with graphics data into the Beeb’s tiny One or two early Archimedes this sumptuous coffee-table book. memory. I often wondered if Citadel programmers talk about graduating It’s all about the arcade games used some kind of ‘cut out’ routine to the 32-bit scene from their BBC that were released for Britain's to draw its amazing locations and I days. ubiquitous 8-bit computer of the didn’t realise JCB digger had to use G This is a magnificently presented 1980s. The lavish hardback volume two scrolling mechanisms and book and a must for BBC Micro with slipcase contains over 450 full- nicknamed JCB Judder because of gamesters, past and present. colour glossy pages packed with it! screenshots and maps of games plus The foreword is by interviews with nearly 50 games Richard Hanson who’s still authors and BBC Micro journalists. the MD of Superior Software. They chat about their lives when The stories told in A World in they discovered the BBC Micro, Pixels reveal Richard a many of them just schoolkids and supportive publisher to the programming those new micro schoolboy coders. Alas, computer things just for fun. Superior don’t publish any A World in Pixels paints a RISC OS games nowadays, fascinating geography of Britain of odd when you think how well the time. Most of the activity took Repton and the like were place in London, Leeds, the North ported to 32-bit machines. East and of course Cambridge Several well-known where the BBC Micro was born. personalities make an The proto-gaming industry was appearance including Acorn’s vastly different from today's scene design manager and Elite and many of the ‘grown-up’ coders authors; the absence of other are still here in 2021 in one Beeb exponents is notable. computing field or another. (Probably were far too busy

Drag ’N Drop | www.dragdrop.co.uk | Winter 2021 | Page 12 Graphics If you write applicat- icon, preferably one with a white OS there's no need to close the ions for RISC OS then background, and choose Object > menu and navigate through the you may well suffer a Object > Export > Sprite and drag whole structure again.) mental block when it and drop the file onto Paint's icon comes to designing bar icon. You'll get a window called icons. and a sprite window In this article I’ll called bitmap. Click anywhere in the show you how to create background (white) of bitmap so the them in next to no time. window title turns yellow. All you need is Netsurf and Paint. First navigate to images.google.co.uk in Netsurf. Decide the If the sprite doesn't have a mask theme for your icon and add one by Menuing over bitmap > type it in the search box Edit > Mask. Bring up the colours followed by “ico”. For window with Shift+Ctrl+F1 and ICONS example I am writing an choose None for the colour (which application for selects the mask). Press Ctrl+F1 for cataloguing the seeds The RISC OS Style Guide the tools window. Click the paint from my garden so I recommends that application sprites can icon and ensure the Global searched for “flower should be no more than 70 OS units is selected. Now click Select a ico”. (N.B. it's “ico” and square, about 35 × 35 pixels in couple of times in the white not “icon”.) practice. area surrounding the flower. Important point here. Icons exported from Netsurf are Rename bitmap to !flowers, Check the images to 140 pixels square which, unless create a directory called !flowers on ensure they’re not Netsurf or Google has changed by your hard disc, and save the sprites restricted by copyright. the time you read this, is too big. as !flowers.sprites, add a Many pictures are free Press Menu over bitmap and one-line obey file for personal use but choose Edit > Scale X > 0.25, click iconsprites .sp some are not. with Adjust and then choose Scale Y rites Press the Menu and click Select. (The 0.25 is and save it as button over a suitable already there. Remember in RISC !flowers.!boot then double click it.

Drag ’N Drop | www.dragdrop.co.uk | Winter 2021 | Page 13 660B!12 = B!4 + 80 670SYS "DragASprite_Start",16,S,"P ",B 680ENDCASE 690ENDPROC 700: 710DEF PROCDRAG 720PROCGET 730TX = (MX - B!4) DIV 80 740TY = 6 - (MY - B!8) DIV 80 430NEXT "Wimp_ForceRedraw",W1,0,0,1 440SYS 279,1023 450U=U0 TO 6 Y=0 TO 6 : FOR X=0 460FOR PROCMKICON(W1,X 470IF B$(X,Y)<>"-" *80,(6-Y)*80,80,80,&B7006102,B$(X,Y) ,S) 480NEXT:NEXT 490ENDPROC 500: 510DEF PROCCLICK 520PROCGET 530CASE W OF MB OF 540WHEN -2 : CASE 550WHEN 1,4 : PROCOPEN(W1) "Wimp_CreateMenu", 560WHEN 2 : SYS ,N1,MX-80,MY+180 570ENDCASE:ENDPROC 580WHEN W1:IF MB=2 SYS "Wimp_Creat eMenu",,N1,MX,MY:ENDPROC 590IF (MB AND 4)=0 ENDPROC 600CX = (MX - B!4) DIV 80 610CY = 6- (MY - B!8) DIV 80 620IF B$(CX,CY)<>"P" ENDPROC 630!B=CX*80 + B!4 640B!4 = (6-CY)*80 + B!8 650B!8 = !B + 80 410!B=W1 : B!4=I : 410!B=W1 "XWimp_DeleteIcon",,B 420SYS Drag ’N Drop | www.dragdrop.co.uk | Winter 2021 | Page 14 | Winter 2021 | Page Drag ’N Drop | www.dragdrop.co.uk 380: 390DEF PROCBOARD 400FOR I=0 TO 49 250SYS "Wimp_GetWindowState",,B 260SYS "Wimp_OpenWindow",,B 270ENDPROC 280: 290DEF PROCNEW 300RESTORE +1 310DATA --PPP--,--PPP--,PPPPPPP,PP PHPPP,PPPPPPP,--PPP--,--PPP-- 320FOR Y=0 TO 6 : READ A$ 330FOR X=0 TO 6 340B$(X,Y)=MID$(A$,X+1,1) 350NEXT:NEXT 360PROCBOARD 370ENDPROC B "Wimp_CloseWindow", 130WHEN 3: SYS ,B 140WHEN 6: PROCCLICK 150WHEN 7: PROCDRAG 160WHEN 9: PROCMENUSELECT 170WHEN 17,18:Q=(B!16=0) 180ENDCASE 190UNTIL Q 200SYS "Wimp_CloseDown" 210END 220: 230DEF PROCOPEN(W) 240!B=W 00, U 1000,B$(6,6),V 10 1000,B$(6,6),V 00, U 60Q=FALSE : PRO : PROCWINDOWS 70PROCSPRITES PROCMENUS :U0=U CICONS : : PROCOPEN(W1) 80PROCNEW 90REPEAT E "Wimp_Poll",,B TO 100SYS E OF 110CASE 2: SYS "Wimp_OpenWindow",, 120WHEN

Click menu over the Solitaire

Desktop layout with a ‘+’ The game starts 4154,"Solitaire" 10 50DIM B 500, N 1000, S 2000, T 30ON ERROR PROCERROR 40SYS "Wimp_Initialise",200,&4B53 game, or quit the application. 10REM Solitaire 20REM (C) Drag N Drop 2021 program information, to start a new listing SOLITAIRE window, or its iconbar icon, for window, the middle. computer will remove the pebble in computer will remove the pebble horizontally or vertically. The horizontally or vertically. a hole two positions away clicking and dragging the mouse, to clicking and dragging the mouse, of pebbles. Move a pebble, by must clear the board of pebbles. the board of pebbles. must clear classic patience game where you game where classic patience This is a desktop version of the This is a desktop The commands are back to front, they don't need anything from the or post-fixed as we say in he trade, stack. setlinewidth on the other because PostScript uses a stack. hand expects a number between Imagine a stack as a pile of bricks. It zero and 1 on the stack. moveto and starts off empty and items are added lineto each expect two numbers on to the top of the pile. As soon as you the stack. issue an instruction like moveto, The program can be summarised Postscript goes looking for items in bricks as follows: underneath it on the stack:

setlinewidth moveto 0.5 0.5 72 72 empty stack 72 72 72 moveto in Programming 72 72 72 72 72 Postscript It pulls off (or pops) the moveto and empty stack In the introductory article in the the two bricks under it. It's known lineto Autumn edition of Drag ’N Drop as a first in, last out (or first on, last 720 720 off) stack. If there aren't enough 72 72 72 we remarked that PostScript is an empty stack arse-about-face language because bricks there, Postscript throws a commands look back-to-front. wobbly and produces an error message. Now, it's perfectly feasible to re- In Basic we would write write the program to put all the MOVE 72,72 Here is listing 1 again from last time: numbers on the stack first: but in PostScript it's %!PS-Adobe %!PS-Adobe 72 72 moveto newpath newpath .5 setlinewidth 72 720 72 72 .5 (72,72) is a position one inch from 72 72 moveto setlinewidth moveto lineto the bottom left corner of the page. 72 720 lineto stroke stroke Postscript's default measurements showpage showpage are in printer’s points (72 per inch) This can be thought of in bricks as so an A4 sheet measures approx 595 newpath, stroke and showpage in the following diagram: × 842 points. take no parameters, which is to say

Drag ’N Drop | www.dragdrop.co.uk | Winter 2021 | Page 17 (whether designed with a template which are, for simplicity, presented editor or coded in-program like in as single listings, Toolbox apps

Toolboxwith Drag ’N Drop listings). !RunImage require an application directory to would also have to hold procedures be set up. Certain files with certain (maybe in a separate Basic filenames must be present, and LIBRARY) to handle the setting up initialisation procedures carried out

Basic of menus and deal with subsequent in the Basic !RunImage. menu clicks. A minimum of six files have to be If you’re writing applications present in an application directory. regularly this results in displays and The diagram on page 21 summarises chunks of code which are largely the them for a simple app called (wait same from app to app and coding for it) !Simple. then becomes tedious. Three files should be familiar: The Toolbox, on the other hand, !Boot puts the icons in the !Sprites The User Interface Toolbox, automates a lot of these processes: file into the Wimp sprite pool. Here Toolbox User Interface, or just placing an icon on the icon bar, !Sprites contains just one icon called Toolbox as it's known to its creation of menus and opening of !simple (the application directory friends, comes free with RISC OS the ‘About this program’ window name in lower case) to be shown by and it takes some of the drudgery being just several examples. the computer in its filer displays. out of programming desktop Unfortunately, about the only Incidentally if you’re stuck when applications. documentation that has ever been it comes to designing icons, have a For example, it’s common for released for the Toolbox is an look at the Fast Icons article applications to display a small impenetrable 500-page manual elsewhere in this issue. window giving program information dating back to the 1990s which !Boot sets up a system variable, and this often leads off a menu item gives the illusion that Toolbox App$Dir so we can refer to the accessed through an icon bar icon. applications can only be written in application directory by App$Dir. Traditionally, one of the many C. No mysteries there, so let’s setup tasks the application's main This is not so. Toolbox quickly move on. It's the Res and program, usually called !RunImage, applications can easily be written in Messages file which require would have to do is to tell RISC OS BBC Basic. The downside is (you explanation. to place an icon on the icon bar and knew I was going to say that!) that We’ll come to them in a second. it would have to be taught where the there’s a lot of setting up to do. What you should do first of all is to ‘About this program’ window lives Unlike Drag ’N Drop applications set up your own !Simple directory,

Drag ’N Drop | www.dragdrop.co.uk | Winter 2021 | Page 20 Writing graphical user interfaces Wimp started, the modules are from scratch can be a tedious and Using automatically included and ready to error prone process on any Works2 be used in a program. operating system but with the Many users will find help of a suitable integrated !DrawWEM2 of interest since this development environment (IDE), module that adds several commands it can be made a lot easier. to enable easy creation and A demo version is available for manipulation of Draw files. download from the Jaffa Software Information on the additional website www.jaffasoft.co.uk or the commands offered by each application can be purchased for extension can be found from the £39.99 and comes on a CD together "Online Help ..." menu option. with an A5 comb bound manual. the hard copy manual and many The Xtras directory shown in Installation is a simple case of demo applications. Fig.1 contains an application for creating a directory on a hard drive In the Editors directory are some applying upgrades when available and dragging the application from additional examples of editors for from the Jaffa Soft website. the original disc. A big plus of WimpWorks, see fig.1 They are WimpWorks2 makes it easy for WimpWorks for me is that Andrew installed by copying them to windows and menus to be created Flegg of Jaffa Software provides an !WimpWorks.Resources.Editors, see graphically and all the programmer excellent after-sales support service. fig. 2. The WEMs directory (fig.1) is required to write short procedures Setting up WimpWorks2 is fairly contains example WEMs (Window that are automatically called when straightforward. The commercial Extension Modules) which may be the user clicks on a window or icon. version of WimpWorks2 must be useful for particular application. WimpWorks2 achieves all this activated using the activation code These modules are installed by through four editors, a task editor, a supplied. placing them within the template editor, a menu editor and a The application has an extensive !WimpWorks.Resources.WEMs subroutine editor. Strong Help file, a PDF version of directory. When WimpWorks is next The subroutine code editor may

Figure 1 Figure 2. Contents of WimpWorks2 resources directory. Drag ’N Drop | www.dragdrop.co.uk | Winter 2021 | Page 26