Gears of War 5 - ZX Spectrum Version
Gears of War 5: ZX Spectrum Version
Ok, not really!
Another possible #WCCChallenge topic for this week was Gears. Seen as I'm on some sort of nostalgia trip today, I thought I'd rehash a very old routine that demonstrates a buffer technique in ZX assembly.
I used a Gears 5 wallpaper from some random wallpaper site, so I'm assuming it's fan art, converted it to a ZX Spectrum .scr file and then did some Z80 tomfoolery!
Simply put, you load the screen into a memory location and then use 12 bytes of code to move each byte of the screen data onto the ZX Spectrum's display.
The 12 byte routine goes like this:
LD HL, 32768 ;(Source)
LD DE, 16384 ;(Destination)
LD BC, 6912 ;(Length)
LDIR ; Load, Increment Repeat (basically a loop until you move all 6192 bytes)
RET ; return (go back to the BASIC routine)
Converted to BASIC:
10 CLEAR 32767: BORDER 0: PAPER 0: INK 7: CLS
20 FOR n = 65000 TO 65011
30 READ a: POKE n, a
40 NEXT n
100 RANDOMIZE USR 65000: REM this is like a function in other languages. It basically calls the routine below
1000 DATA 33, 0, 128: REM LD HL, 32768 (Source)
1010 DATA 17, 0, 64: REM LD DE, 16384 (Dest)
1020 DATA 1, 0, 27: REM LD BC, 6912 (Length)
1030 DATA 237, 176: REM LDIR (The Copy Routine)
1040 DATA 201: REM RET (Return)
Use FUSE to load an image you've created into 32768 (6192 bytes long) then create a .tap of the code (zmakebas screen.bas -o screen.tap). Run the code and you should get your picture. Save as a snapshot and then you just need to load the .sna in future.

Comments
Post a Comment