Midnight hackers club. Who wants to write a text scrolly? #ZXSpectrum #specasm #z80

Photograph of a TV screen showing a syntax-coloured machine-language program listing.

Piña colada / collida detecta (if you’ll indulge me one last #fomo toot xx) #Z80 #ASM

Piña colada in a tall glass with what looks like the world’s largest cocktail umbrella. The blue sea glints in the background.Screenshot of annotated Z80 assembly code that’s designed to detect collisions between game objects, “bullet” and “bug”. Some smug guy can be seen reflected in the glass surface of the computer screen. He might be holding a piña colada.

As cool as it’s possible to be in this heat. #SAMCoupé #ZXSpectrum #poolside

Literature by a swimming pool. “SAM Revival” magazine by Quazar, and “Super Charge Your Spectrum” by David Webb. Palm trees and steep mountains are in the background.

Keep cool at the pool. 😎 📚 ⛱️ #zxspectrum #asm #z80

Paperback book in the sunshine by a swimming pool. The title is Advanced Spectrum Machine Language, by David Web.

I’m travelling for work today so I’ve brought the laptop, an Amstrad NC100. For on-the-go connectivity all you need is an RC2014 connected via RS232 at 9600 baud.

P.s. don’t zoom in, I’m doing important Business Work™ not playing Zork.

Amstrad NC100 connected to RC2014 via RS232

This week I’ve been wrestling with SAM networking again! SAVEing works perfectly (Net and Tape format are almost the same so it’s easy to coerce the saved bytes into a .tap image). On the other hand bytes are being dropped on the way back; I’m not sure why. #SamCoupé #MIDI

Television, RC2014 on top, SAM Coupé to the side. Screen shows BASIC listing.Closeup of TV screen. Three columns of information: decimal numbers, hexadecimal numbers and ASCII textHandwritten hexadecimal numbers on a lined notepad. The notepad is on top of SAM CoupéSAM Coupé display showing the text “Code: NOTICE” implying it’s (trying to) load a code block.

Hmm. This feels like homework.

Right angled triangle sketched on feint ruled notepaper. The drawing is annotated with arcane symbols whose meanings have been lost to us, but suggest a high-school level understanding of trigonometry (maybe). Anyway a frog is firing a projectile up at an angle towards a fly, so this is probably about working out that trajectory.

I suppose it’s quite nice sometimes maybe to switch the computer off and go outside for a bit. We saw dolphins and it was lovely (not pictured because I was looking at them and enjoying it and not pointing my pocket computer at them).

Photograph of the coastal cliffs of Mull taken from a small boat on a clear sunny dayPhotograph of the wake behind our small boat. The sea and sky are deep blue, the sun flares on the camera lens highlights the faint whispy clouds. Chrome railings and a red lifebuoy.

Goin’ surfin’ 😎 🏄 #amstrad #nc100

Photograph of Amstrad NC100 computer in the sunshine by the harbour

SAM Coupé fun with images

I experimented a bit more with creating an image to deliberately exploit the effect that a 50Hz alternating image has on my TV (and other upscaler chipsets).

Since the TV seems to display all the even lines of one frame, and all the odd lines of the other I thought I’d create a double-height image of 256x384. The source image is scaled down horizontally (so that it looks stretched) but that will be corrected when displayed at 256x192 because the de-interlacing effect scales down the image by half vertically (each row of the display is half a pixel high).

Screenshot of an image editor application with an image of a space-walking astronaut in orbit above Earth

I exported the image as an (8-bit) 16-colour PNG, then ran it through my 8-bit to 4-bit conversion script that I’ve been using to convert sprites. I modified the script to export all the even lines to one file, and the odd lines to another file. (Each 128 bytes in the file represents one screen line, and the lines are ordered top to bottom).

I thought about just using one contiguous file and doing some processing on SAM but then I’d have to deal with a 48kb image file. The resulting files are basically a normal Mode 4 screen$ file, (just missing the palette data) so that keeps things straightforward.

Screenshot of a Python script

To help further with moving the image around SAM’s memory I compressed the data using zx0. In this case it took the 24kb file down to 7113 bytes. The Z80 implementation of the decompressor is really fast and I use it to dump the two images directly into the respective frame buffers when the program starts up.

I don’t yet have a way of automatically mapping the palette from the PNG index to SAM’s format, so I just opened up the 16-colour PNG in SCADM’s handy image importer and copied the palette entries from there. (The order was wrong; I’m not sure how my image editor assigns the colour indexes so I just reordered them by hand).

The astronaut image from above being reduced to 16 colours and the palette information extracted

I’ve started using Simon Owen’s pyz80 extension for VS Code which provides a wrapper around Andrew Collier’s pyz80 assembler as well as Simon’s samdisk tool for manipulating disk images. So now with a keyboard shortcut the code is assembled with pyz80, and samdisk creates an auto-booting disk image as well as broadcasting the assembled binary to my SAM listening on the local network. The TrinLoad softaware running on SAM recieves the code and launches it. Here’s how the resulting image looks on the TV:

Photograph of a tv screen showing the astronaut image Photograph of a tv screen showing Sonic the Hedgehog

It definitely works to smooth out certain things—like the curvature of the earth, the top of the space helmet or Sonic’s quills (compare that to the stair-stepping inside Sonic’s ear for example):

close-up of the astronaut image another close-up of Sonic, this time without the issues

I noticed I had to load the even lines in to the first buffer; the other way around incorrectly interlaces the images and results in visible comb artefacts:

closee-up of the Sonic image showing issues with the image

But otherwise I think it’s a neat effect. What do you think?

floppy disk icon Here’s a disk image if you’d like to try it out: image-fun.mgt

Denise #KeepingUp #Commodore

A microchip with the Commodore logo in foam on a wooden surface next to a small green circuit board

I had some success removing the yellowing from my SAM with “vapour brite” (works just like Retr0brite but the plastics don’t go directly in the solution). Compare the drive facias (before treatment) to the SAM top case (after half a day in the sun). 😎

a clear Perspex™ box in direct sunlight with a white plastic item inside. aluminium foil underneath, the clear liquid in the box is forming condensation on the walls and lida large clear Perspex™ box in direct sunlight with a SAM Coupé top case inside, aluminium foil underneath, clear lid clipped on tightlySAM Coupé computer with a SamCo card cage accessory. the floppy drive face plave on the SAM is noticeably more yellowed than the rest of the ostensibly white plasticclose up pictire of the SAM Coupé with the floppy drive pulled out slightly to emphasise the contrasting shades of white and yellowish plastic

Sam Coupé MIDI and Serial Networking

Tonight I’m mostly using @shieladixon’s wonderful MIDI interface for RC2014 to take a closer look at how serial Networking is implemented on the SAM Coupé. (TL;DR it’s MIDI).

SAM Coupé with MIDI cables connected

SAM uses DIN-7 connectors but the sockets are compatible with DIN-5 (MIDI).

RC2014 with MIDI cables connected with a laptop showing a serial terminal window

The RC2014 MIDI Interface Z80 Framework gives straightforward access to the raw bytes. I’ve noticed that my USB-MIDI adapter (also pictured but not in use here) automatically translates the bytes into “standard” two- or three-byte MIDI messages (usually by injecting extra control bytes in an attempt to try to make musical sense out of non-musical data).

Screen Shot of serial terminal showing raw data bytes

The data structure is similar to how ZX Spectrum BASIC programs are stored. Header bytes give file type and file name etc, the BASIC keywords are tokenised and variable names and values are tacked on at the end.

Screen Shot: hex view of a saved BASIC progam

This week I’ve been getting to grips with SAM’s VMPR (Video Memory Page Register) and using it for double-buffering the screen. Into that framework I dropped the sprite drawing routines I used on Spectrum, and graphics I made a while ago for a web-based game. #GameDev #SAMCoupé

Those low-colour pixel-art PNGs converted quite nicely to SAM’s 16-colour 4bpp screen mode. I haven’t got round to making a unified/optimised palette yet (the squirrel character isn’t supposed to be blue!)

photograph of a television displaying the same screen as the other attached screenshotSAM Coupé screenshot. town scene with blue squirrel character. the area behind the character is mirrored in a small square top left to help with debugging

I truly love paper magazines but is using OCR for code listings…cheating? (Asking for a friend). #z80

screenshot of a computer display showing an in-progress scan on the left, and a partial view of a code editor on the right with coloured syntax highlighting. the code is Z80 assembly language.

Now playing: SAM Coupé Shanghai by Fuxoft/Franxoft for Pete Prodge’s Covertape wars (YS vs SU - Dec 1992)

The colourful tiles are easier to read than the typically monochrome tiles in Spectrum mahjong games, but overall it’s not as featureful. A nice straightforward solitaire game though.

SAM Coupe and cassette player with tape. tv in the background displays the title screen of Shanghaiscreen shot reads: SHANGHAI ©️ FRANXOFT 90YOUR SINCLAIR magazine cover. December 1992. features illustration of Dizzy who is an anthropomorphic egg wearing boxing gloves and a fancy hat. the headline reads: "DIZZY SEES THE LIGHT"

…and in with the…Old! I replaced the 1984 Z80 with one produced in 2018 but it caused some weird screen corruption. I swapped it for another from 1984 (produced the same week!) and it works perfectly. Meanwhile the 2018 Z80 is perfectly happy in my Harlequin; CMOS/NMOS issue??

ZX Spectrum circuit board with a very shiny heat-sink and a Z80A CPU with the date code of 8425same as the other image but two more Z80 chips are in shot. the second chip also has date code 8425 and the third reads (partly obscured) 1839

Out with the old! My desoldering gun is still not Quite Right so this was mostly done the old fashioned way: a manual pump, braided solder wick some flux and lots of patience. (If the chip is know to be totally gubbed it’s easier to just snip the legs but I wanted to save it).

ZX Spectrum motherboard with the Z80 CPU removedunderside of the Spectrum board showing the empty through-holes where the Z80 used to be

Well it looks like we have a busted M1 signal. It’s not used internally so the Spectrum itself will function without it, but it’s needed for peripherals like the Interface 1 and modern devices like the DivMMC.

ZX Spectrum motherboard. The Z80 processor is being examined with a logic probe, but the probe is showing no activity.

This evening I’ve been fixing a ZX Spectrum+ for a friend. Two bad RAM ICs and a 3rd (previously repaired way back) had gone a bit crusty. Wrong polarity power was maybe used, but the DC circuit measures okay. Needs a new membrane but I’ve given the keys a bath in the meantime.

a ZX Spectrum motherboard with two microchips removedcloseup of a microchip showing discolouration to the legsscreenshot of Jumping Jack loading on an old television loose, wet ZX Spectrum+ plastic keys in a kitchen sieve suspended over a plastic bowl

I ordered some circuit boards from PCBWay using MerlinKV’s PlusD Clone design (CC BY NC SA). Now I’ll need to find all the parts (and work out how to blow a GAL).

slim cardboard postage box with PCBWay brandingseveral band new unpopulated circuit boards

“Oh”, they said, “so that’s what you wanted a serial protocol mouse for!”

#SAMCoupé #Lemmings

a home-made bootleg copy of Lemmings on a blue 3.5 inch disk on top of a SAM Coupé computer

MGT SamBus repair

Update! Thanks to Colin from Quazar for clearing up my disinformation and abject nonsense.

I removed the old crusty battery and replaced it with an equivalent.

I also removed the corroded power socket. Apparently it was never, from a strictly electrical point of view, “entirely safe”, and so the official power supply never materialised. The 3.5mm audio jack would toggle between internal and external power when the jack was inserted or removed. Safe enough so long as all the power is off!

A wire link in place of the socket ensures the power supplied by SAM can still propagate to the connected devices on the four expansion ports.

A good scrub to get rid of the grime and battery juice, and it’s all working properly again.

What about those flat-head screws though, eh? Those MGT boys sure were goofballs! The cases were sent to customers separately after the bare boards were issued. So the original owner (or someone else) may have used any old screws.

Phew! Sorry for all the mistakes!

green circuit board with a new 3.6v NiMH battery and a wire link where a socket used to be.a SAM Coupé computer with SamBus attached at the rear, and a Trinity interface plugged into the top of the SamBusthe underside of SamBus showing flat-head screws and black rubber feet

Yum! This is the special sugar-frosted MGT SamBus. (a.k.a. The SAM Card Cage). It adds extra expansion ports, a real time clock, and special secret coating that will keep you full until lunchtime. #SAMCoupé

printer circuit board with euroconnectors and various components, most notably a leaking battery and corroded 3.5mm jack socketMGT SamBus on a wooden desk not connected to anything. an mostly flat oblong off-white computer accessory with three expansion ports on top and a connector on front

Good news, everyone. It’s mousin’ time!

retail packaging for a Trust "Ami" serial computer mouse still in its original cellophane seala black Labrador dog sniffs the box with suspicion