+-----------------------------------------------------+ | ETCH-A-SKETCH | | For "black box" Sinclair QL (Gold Card recommended) | +-----------------------------------------------------+ | Another completely unoriginal CSSCGC entry | | written quickly and dirtily by | | Jim Waterman, 24-25 November 2024 | +-----------------------------------------------------+ NOTES ===== Sinclair Research never was very good about getting their products out on time, and when they did so, the build quality would have embarrassed another Great British Institution of yesteryear, British Leyland. But we admired the cheap and simple computers That Taught A Generation How To Codeā„¢. This probably explains why Sir Clive was desperate not to miss the boat when it came to launching his business machine in 1984. The QL was announced *one day* before the unveiling of the original Apple Macintosh, in April... though deliveries didn't start until July. Some early adopters had to put up with the "dongle" that supplied the bits of the ROM that it didn't ship with, released as it was in little more than a beta-testing phase. But I grew to like the QL, mainly because I'm only experiencing it in emulated form, with the complete JS ROM, and no need to use those horribly unreliable microdrives. And I couldn't possibly let the QL's 40th birthday pass without *some* kind of CSSCGC tribute. My intended program will not be finished in time for the end of this year's CSSCGC - but rather than be as fashionably late as Sinclair Research and finish it for 2025 (the equally ill-fated C5's big four-zero), I've cobbled together this Etch-A-Sketch program. It's not as if I don't already have a habit of doing so (see Next-A-Sketch from the 2023 competition), but mainly this was because the intended entry was going to have an all-singing-all-dancing intro screen for which I would need to plot pixels accurately... and no matter what I set the SCALE to in QL SuperBASIC, plotting an individual point never *exactly* corresponds to the pixel I want. Hence, I wrote a couple of procedures... PLOT4 and PLOT8, which will plot pixels *accurately* on the QL screen by poking directly to screen memory. All it takes is to supply X and Y coordinates and a colour (note that the X coordinate in PLOT8 runs from 0-255, rather than 0-510 in steps of 2). From there, the obvious way to demonstrate it was YET ANOTHER Etch-A-Sketch program. It's a simple one, this - no geometric shapes or anything like that, just a moveable cursor in the colours available in the selected mode. I was going to restrict the Classic Etch-A-Sketch in mode 4 to just black, but figured it was better to allow all the colours. Controls are: - QAOP or the cursor keys - move the dot (and it will move diagonally); - M to move the dot position to specified coordinates (0,0 is the top left of the drawing area); - C to change colour (0,2,4,7 only on MODE 4); - L and S to load and save a picture. Picture files are given the extension _SC4 and _SC8 according to which mode they've been saved from - don't want to get those mixed up! There are two example files included in the package, SIRCLIVE_SC4 and BIRTHDAY_SC8 - marvel at my horrific lack of artistic talent if you must. Also note that the program is SLOW on an original QL - if you've got an unregistered QemuLator (which this program has been written on and for), you're stuck with it; if you've registered, at least switch on the Gold Card option to speed it up (Full Speed is not necessary). DEVELOPMENT LOG =============== 24 November 2024: - Wrote PLOT8 and PLOT4 procedures (and optimised them as much as possible) to plot pixels *accurately* on the QL screen rather than trying to rely on getting the SCALE exactly right (which is complicated by the rectangular pixels). As this involves bit manipulation it would be very much more advantageous to do this via machine code, and I've just bought an old book about QL/68008 machine code at Crash Live... - Needed something to demonstrate this with that could be a very quick and dirty CSSCGC entry... - Drew the Etch-A-Sketch border and the dials (which *are* done with the QL's graphics commands). (etch1_bas) 25 November 2024: - Added status window (#0) and select-mode option. (etch2_bas) - Added screen for Super Awesome Colour Etch-A-Sketch. (etch3_bas) - Added a *very* rudimentary routine for MODE 4 that would suffice if this was a ZX81 listing in issue 1 of Sinclair Programs, in that it just draws black lines. Use of KEYROW instead of INKEY$ allows diagonal lines at least. (etch4_bas) - Minor edit to the coordinate system (PLOT4 is unchanged but the top left of the white window is now 0,0). Coordinates shown in the status window. Added the facility to save and load screens (the non-standard _SC4 extension shows this is a MODE 4 drawing). (etch5_bas) - Added the ability to move to selected coordinates (press M). (etch6_bas) - Added change of colour (press C), and the use of cursor keys as well as QAOP to move the dot. (etch7_bas) And now for the changes to the MODE 8 part of the program: - Added the rudimentary MODE 8 drawing routine (i.e. no colours, moveable coordinates, load or save yet... or anything else). (etch8_bas) - Added the facility to load and save MODE 8 screens (this time, the non-standard extension is _SC8). (etch9_bas) - Added the ability to move coordinates. (etch10_bas) - Added the change of ALL 8 COLOURS! (etch11_bas) - Added the list of commands to the MODE 8 program (press H, they're not all displayed on screen permanently). (etch12_bas) 26 November 2024: - Abandoned any plans for geometric shapes (as for Next-A-Sketch, or even the drawing programs sent to Sinclair Programs in 1983). Trying to draw a circle with the PLOT4/8 routines will require drawing an ellipse and I don't have the time to work out the maths. Just use the program as-is!