+================================================+ | SCRUMPER | +================================================+ | Spectrum original by S.M. Wakefield | | in Sinclair Programs, March/April 1983 | +================================================+ | QL conversion by Jim Waterman for CSSCGC 2025 | | 27 - 30 December 2024 | +================================================+ The essentials ============== Loading instructions for those who have no idea what they're doing with a QL are provided in a separate document. Read, mark, learn, and inwardly digest. But in short, press F2 to start in TV mode and enter this line: LRUN mdv1_scrumper_bas After stopping the program, use GOTO 20 to re-run it without having to load the machine code again. (This would be much more helpful on a real QL with real and very failure-prone microdrive cartridges.) You are scrumping in a local orchard (like a mischievous teenager of the 1950s would do). Apples will drop from the canopy above from random positions, and your job is to catch them. Move left and right with O and P, and to grab those hard-to-reach apples that are far away from where you're standing, use the SHIFT key to boost your speed, at the cost of the energy bar on the left of the screen. If it runs down to zero, you're stuck at normal speed, so use it sparingly. One point is scored per apple; collect 18, and you'll get a 10 point bonus plus 2 points for every bar of energy remaining. After clearing two orchards, you'll be rewarded with an extra life, to a maximum of three - you'll need it. Drop three fruit, and the farmer will be alerted - he's not known for his tolerance of scrumpers, and he's a former Olympic shooting champion. Unfortunately, this game is SLOW. Slower than the Spectrum original, and it's more like a ZX81 in SLOW mode. There are probably lots of snails in the orchard. They'll be right at home. Plug in a Gold Card and it'll run FAST, but the timings of the tunes and sound effects will be devastated. What's in the program package ============================= scrumper_bas: The SuperBASIC program. scrumper_bin: The machine code to dump the sprites on screen. scrumper_asm: The raw 68K assembly language. scrumper_lst: The raw assembly language, along with its assembled bytes, and where they are relative to the start address. This is a detailed file dumped out by Computer One Assembler, presumably to allow for debugging purposes - I've provided it in case anyone out there wants to learn QL machine code when the machine has passed its 40th birthday. Further waffle ============== Scrumper is one of those magazine games I typed in when I was very young (near-certainly under ten), somehow managed to get it to work (i.e. I typed it in properly, and didn't think I was a better programmer than the original author, correcting "mistakes" that weren't there), and went on to enhance it in the way I tended to do with these type-ins back in the day. Here's the original listing: https://archive.org/details/sinclair-programs-06/page/n41/mode/1up?view=theater Grab it for comparison purposes here: https://spectrumcomputing.co.uk/entry/13295/ZX-Spectrum/Scrumper My modification has survived and is now hosted here: https://www.rickdangerous.co.uk/zx/typeinsplus.html#scrumper ...all that I did is switch the order of the two apple graphics (I thought the apple with the worm in it should be the second level, not the first) and put instructions in the game. That was it. This was all done some time around 1989. 35 years later, needing a quick and dirty entry for the opening day of the 2025 CSSCGC, this program came to mind. How hard could it be to make a QL conversion of a *very* rudimentary Spectrum game that uses less than 3K? As always, I like to make my life difficult. Y'see, a year ago, I took delivery of a Spectrum Next, and I've become used to sprites with no colour clash. And in November 2024, the official QL core was announced and demonstrated for the Next at Crash Live. Can you see where this is going? Just like its 2020s distant progeny, the QL had no colour clash. Every one of its rectalgular pixels could be one of eight colours, if you chose the lower-resolution MODE 8, with landscape-oriented pixels that still *didn't* look like Lego bricks. Didn't see *that* coming on your Amstrad CPC, did you, Lord Yes Sir Alan? Anyway... I digress. I'd recently written a routine to plot pixels accurately on screen by poking the screen memory, testing it with an Etch-a-Sketch program that was hastily sent to the 2024 CSSCGC. I used it to draw some basic sprites of the scrumper and one of the apples (I wasn't going to bother with the wormy apple from the original!). Thing is, even if I'd just built it out of the QL's in-built graphics commands (which are NOT designed for this...), drawing the sprite each time would be so slow that even a ZX80 could outperform it. There was only one solution: machine code. This meant re-learning the basics (lots of MOVE.W/L instructions, and a few ADDA.Ws), finding out a few new aspects (how to loop, for instance), and doing battle with QL-based assemblers until I found one that did what I wanted it to do (Computer One Assmebler was the winner in the end). Initially, it worked very well, and I wrote procedures to drop the sprites on screen with a bit of calculation, so that the positions of the scrumper and apple were directly comparable. But as the program grew, so it SLOWED down, and on an original QL (at least, QemuLator's version of it), it's slower than the Spectrum original. This is, in part, because the apple only drops by four lines per cycle, rather than eight (a full character square) on the Spectrum. If I'd been programming specifically for a Gold Card-equipped QL I might have made it two lines at a time. Likewise, the scrumper sprite - which, like the original, has moving legs - moves by four pixels at a time (i.e. two double-width MODE 8 pixels) - or by eight with the speed boost. The scrumper is 12 pixels wide, the apple only eight and hence there are TWO possible positions of the scrumper sprite relative to the horizontal position of the apple which will allow you to catch it. The QL allows for a rather more detailed screen, as well as the absence of colour clash. The playing area is dictated by the standard size of WINDOW #1 and #2 when starting the QL in TV mode - but that doesn't mean I can't draw a fence outside that area, or a canopy of leaves over the top, which would be in the Spectrum's border area. The scoring in the black area at the bottom is within the confines of WINDOW #0, usually used for text entry and error messages. One annoyance is the QL's insistence that *everything* must be relocatable in memory. This means there are no fixed addresses that I could POKE (or POKE_W) so that the high score would not be lost on each RUN. The game has to load the machine code every time (this would be even more annoying if it was a real QL with a real microdrive - not to mention that the fragile cartridges might fail, and that could get expensive!) - and the two bytes where the high score is stored have to be part of that loaded block, otherwise they'll be overwritten even though there's only 412 bytes of code and I've RESPRed 1024. There's still a lot that's a mystery to me. So, if you want to save your high score, press N at the end of a game and type "savehisc" (without the quotes) to call the procedure that will save the two bytes with the high score... *and all the machine code as well*. That was the only way I could work out how to do it. Type "resethisc" to erase the high score, and save that as well. 128 × 1024 = 131072 which means the highest address on a 128K QL should be 131071. Despite that, POKE 131072,255 still fills the first byte of screen memory (look in the top left corner in either monitor or TV mode), so this should run on a 128K QL with no modifications. Alter the value of variable A in line 20 if the smallest model runs into trouble. Talking of screens, I've added an title screen with the game name drawn out in huge red letters. These are all BLOCK commands. There were supposed to be apples in the gaps, but for some reason they wouldn't show up unless the spacing wasn't quite right. If I put them centrally in the letter gaps, they didn't appear. I have no idea why this would be. And finally... I have done something which is ABSOLUTELY VERBOTEN in QL programming. I have used not one, but *six* GOTO statements. I tried to make the loops work with REPeat ... END REPeat, but I just couldn't find a way to make *everything* do what I needed it to do. Make flag variables here, IF... THEN EXIT there, but sometimes it ignored the flag variable and was stuck in an infinite loop, or looped back where it shouldn't... it was a tangled mess, and because I had the structure of the original program to hand, I reverted to GOTO statements instead. I had a limited time to make the program work, and now it does. I apologise for nothing. DEAL WITH IT. - JRW 31/12/2024