udgil and the cursed scroll a BASIC game by andy jenkinson. for CCSCGC2023 the zx81 was blessed with a SCROLL command in basic, and meant that games like 'man eating budgies' were very common. especially given the limitations of 1k. the speccy doesn't have a scroll command, but it's easy to find it in the rom and it's only a RANDOMIZE USR 3582 away. But look ... https://skoolkit.ca/disassemblies/rom/asm/3582.html ... there's an entry point only two bytes later at 3584 (0E00h) that is more interesting, it scrolls 'b' lines of the display. a cog turned in my brain i'd always wanted to make a machine code program in the UDGs, and then use the UDGs, somehow. this gave me the perfect opportunity... i genuinely old-school hand coded the five byte program below, looking up the opcodes ld b,n 6 nn ;load b with the number of lines to scroll jp 0E00n 195 0 14 ;jump to the second entry point ;the routine it jumps to ends in a RET, so will return to BASIC and then poked them into the graphics using POKE usr "a",6 POKE usr "a"+1,8 POKE usr "a"+2,195 POKE usr "a"+3,0 POKE usr "a"+4,14 (i picked 8 as the second byte, just cos i wanted to see what it did) then i ran the program i'd written, which was achieved using the quirky looking statement: RANDOMIZE USR USR "a" (the second USR "a" is interpreted as the address the UDGs are stored, as per the the system variable UGDG at 23675/6 - normally 65368 on a 48k speccy) and from this the game was born i initially made the 'game' engine bit, with the ever smaller scroll area (which pleasingly gets quicker as a consequence) then i thought i'd make a couple of udgs for game graphics (just three geometric shapes), and pushed the machinecode udg to position 'd' - initially a capital D. with the machine code poked over the top 5 bytes, and leaving the bottom of the D it could be a face (if you squint), so i used the game graphics, and some ascii to make udgil (as he was now called) a cowl. most mysterious. so now he needed a backstory. obviously a 'scroll'. and something about his face. the game was done. but i carried on faffing, and made the obstacles get wider, and added a score. and skill levels (that made them get wider earlier on the hardest level). on the easiest level you are only point penalised for hitting a bad thing - losing if you go below zero. most people should get to the end on that level. so it needed some reward ... a crappy poem, being revealing into the unscrolling bit of the screen. ideal! and there it is hope you at least find it's genesis interesting, and the calling a tiny machinecode routine with let udgil=usr usr "d" doesn't get old. andy 'uglifruit' jenkinson july 29 2023 features: 3 skill levels 3 and five eighths* of a UDG a udg that doubles as a tiny machine code routine the basic statment let udgil=usr usr "d" some hokum plot a bit inspired by 'man eating budgies'** for the 1k ZX81, which we played as a family. we didn't have a 16k ram pack. this was as exciting as it got. i did borrow andrew vale's once though, just for a weekend. *eighths. What a word! Two vowels and then "ghths". Suzy Dent probably loves it. **this one, it's great http://zx81stuff.org.uk/zx81/emulate.php?track=1KGames(Sinclair).tzx.zip@8&title=Man-eating%20Budgies%20from%201K%20Games