Writing a Demoscene Intro for the ZX Spectrum

本文为原文前 6,000 字符的节选翻译,完整内容请查看原文。

Writing a Demoscene Intro for the ZX Spectrum

Download Now View on pouet.net Intro In the late 80s, I spent an embarrassing number of hours hunched over my ZX Spectrum, typing in Sinclair BASIC programs and rudimentary assembler routines copied from magazines, trying to re-create the Amiga crack intros I’d seen round at a friend’s house. Obviously, they never came even slightly close - but now, many decades later, I’ve finally managed it! I’m now the proud author of a hand-rolled retro demoscene intro that runs on a stock 128Kb Spectrum. It features all those late 80s tropes: A smooth scrolltext (with ‘leet custom fonts!), a three-channel AY soundtrack, bouncing VU meters and the essential parallax starfield. It’s currently 10287 bytes of code, or 19552 bytes as a complete tape image - which, given I’ve been working on this since December 13th last year, means my average rate of code-production is a paltry ~ 455 bytes per week! This blog post is a technical overview of how I got there, some cool tricks I picked up, and everything I had to learn (and re-learn) about the Speccy and Z80 assembly along the way. It simultaneously rates as one of my favourite side-projects ever, and also the one that most often nearly triggered a foot put through my monitor in frustration. I’ll reflect on all that at the end, but for now if you just want to see the finished product, the download button is at the top of the article and the included .tap cassette tape image should load into any emulator. There’s also a YouTube capture, links to the production on pouet.net, and you can run it from within a web browser by visiting my TNFS site portal - check option 4 for recent uploads.

在80年代末,我曾花费了令人尴尬的大量时间蜷缩在我的ZX Spectrum电脑前,输入从杂志上抄来的Sinclair BASIC程序和基础汇编例程,试图重现我在朋友家看到的Amiga破解版开场动画(crack intros)。显然,它们从未达到过那种效果——但几十年后的今天,我终于做到了!我现在是一位自制复古演示场景(demoscene)开场动画的骄傲作者,它可以在一台标准的128Kb Spectrum上运行。它具备了80年代末的所有典型特征:平滑滚动的文字(带有“leet”风格的自定义字体!)、三声道AY音轨、跳动的VU表以及必不可少的视差星空。目前代码大小为10287字节,作为完整的磁带镜像则为19552字节。考虑到我从去年12月13日就开始着手制作,这意味着我平均每周的代码产出量仅为可怜的约455字节!这篇博文是对我如何实现这一目标的技术概述,包括我学到的一些酷炫技巧,以及我在过程中必须学习(和重学)的关于Speccy和Z80汇编的所有知识。这既是我最喜欢的副业项目之一,也是最常让我因挫败感而差点一脚踢碎显示器的项目。我会在最后反思这一切,但现在如果你只想看成品,文章顶部有下载按钮,附带的.tap磁带镜像应该可以在任何模拟器中加载。此外还有YouTube录像、pouet.net上的作品链接,你也可以通过访问我的TNFS站点门户在网页浏览器中运行它——查看选项4获取最近的上传内容。

Be Kind, Rewind But let’s skip back briefly to the late 80s. Coming from the world of an 8-bit, cassette tape loading computer, seeing an Amiga for the first time was like encountering something from outer space. Like everyone who saw one back in the day, I was blown away by the amazing graphics and sound on display, not to mention the library of ground-breaking games. But I found myself even more captivated by the mysterious (and totally badass) “intros” displayed at the beginning of pirated games. Created by the software piracy groups that had cracked the copy protection and distributed the floppy-disk based games, they were mini works of art in their own right - music, graphics and usually some cool-looking effect to show off the group’s prowess. There’s a great collection of these intros (or “cracktros”) archived on YouTube. Watch a few of those videos and you’ll quickly notice the “design” tropes that almost every cracktro shares: a cool, edgy logo at the top of the screen (bonus points if it’s dripping blood or in any way “metal”), some boastful text displayed on top of an effect of some sort - usually a scrolling parallax starfield, or rotating 3d object - and a further scroll-text full of shout outs, greetings to fellow pseudonymous crackers and adverts for illegal BBS systems galore. Needless to say, to a kid in the 80/early 90s this was possibly the coolest thing ever.

倒带重播。但让我们简要回到80年代末。作为一个来自8位、使用磁带加载程序的计算机世界的人,第一次见到Amiga就像遇到了外星科技。和当时所有见到它的人一样,我被它展示的惊人图形和声音所震撼,更不用说那些开创性的游戏库了。但我发现自己更被盗版游戏开头显示的神秘(且极其酷炫)的“开场动画”所吸引。这些动画由破解了防拷贝保护并分发软盘游戏的软件盗版组织制作,它们本身就是微型的艺术品——包含音乐、图形,通常还有一些展示组织实力的酷炫特效。YouTube上存档了大量此类开场动画(或称“cracktros”)。观看其中几个视频,你很快就会注意到几乎每个cracktro都共有的“设计”套路:屏幕顶部有一个酷炫、前卫的Logo(如果带有滴血效果或任何“金属”风格则加分),在某种特效之上显示一些吹嘘的文字——通常是滚动的视差星空或旋转的3D物体——以及一段充满致敬、对其他匿名破解者的问候以及大量非法BBS系统广告的滚动文字。不用说,对于80年代或90年代初的孩子来说,这可能是最酷的事情了。

I thought this one was the absolute bomb when I first saw it. Sine-scroller, pirate BBS adverts, cool logo with a sword - and of course, a starfield. There’s something for everyone here. The music from this is burned into my brain. I think pretty much everyone of my classmates knew this intro given the popularity of Lemmings in the early 90s. Skid Row as a group are still active to this day and this is probably the quintessential Amiga cracktro of the period. Endless Piracy. Edgy. Another cool logo, sine-wave scroller, starfield and boasting text. The classics never go out of style. Another great combination of all the essential ingredients. Cool logo, even cooler text font, scrolling starfield and a scroll-text running along the bottom. Vintage stuff. Logo. Text. Scroller. But no starfield - otherwise a solid effort from Anthrox here :)

我第一次看到这个时,觉得它简直棒极了。正弦波滚动文字、盗版BBS广告、带有剑的酷炫Logo——当然,还有星空。这里应有尽有。其中的音乐深深烙印在我的脑海里。考虑到90年代初《百战小旅鼠》(Lemmings)的流行,我想我所有的同学几乎都知道这个开场。Skid Row作为一个组织至今仍然活跃,这可能是那个时期最典型的Amiga cracktro。无尽的盗版。前卫。另一个酷炫的Logo、正弦波滚动文字、星空和吹嘘的文字。经典永不过时。这是所有必要元素的又一次完美结合。酷炫的Logo、更酷的字体、滚动的星空以及底部运行的滚动文字。复古的东西。Logo。文字。滚动条。但没有星空——不过这是Anthrox的一次扎实尝试 :)

The demoscene grew out of these intros. The cracking eventually faded into the background, and coders, “graphicians” and musicians all contributed to feature-length productions that showcased their abilities, competed with other groups and pushed the machine to its limits. In amazing feats of ingenuity and pure “code as an art form”, the scene lives on today, with groups producing breathtaking productions like this and this - bear in mind, both of those are running on a 7Mhz home computer equipped with a floppy disk, 1Mb of memory and a sound chip from 1985. But much as I admire the sheer skill and dedication that takes, it’s the early “single screen” scrolly-text-and-starfield cracktros I’ve always found captivating. They took on a sort of mystical quality for me, hinting at a scene and a culture I could only ever experience from the outside - which is exactly why I spent all those hours in Sinclair BASIC, trying in vain to re-create them, and dreaming of the day I’d eventually have an Amiga of my own.

演示场景(Demoscene)正是从这些开场动画中发展而来的。破解行为最终退居幕后,程序员、“图形设计师”和音乐家们共同贡献了长篇作品,展示他们的能力,与其他组织竞争,并将机器推向极限。凭借惊人的独创性和纯粹的“代码作为艺术形式”,这一场景延续至今,各个组织制作出如这般和那般令人叹为观止的作品——请记住,这两者都是在一台配备软盘驱动器、1Mb内存和1985年产音效芯片的7Mhz家用电脑上运行的。尽管我非常钦佩这背后所需的纯粹技能和奉献精神,但我一直觉得早期的“单屏”滚动文字加星空效果的cracktros最令人着迷。它们对我来说带有一种神秘感,暗示着一个我只能从外部体验的场景和文化——这正是为什么我花费了那么多时间在Sinclair BASIC上,徒劳地试图重现它们,并梦想着有一天能拥有属于自己的Amiga。

The Jump Back I eventually did trade up to a range of Amiga systems, joined a few “scene” groups myself and threw myself into a variety of activities until exams and the end of my teenage years beckoned. I dabbled with Z80 code back then, and at one point knew enough 68k assembly to bluff my way through - partly from the Amiga’s heyday, partly from a few “embedded systems” modules at University where I had to program a set of traffic lights or lift-controllers. Given there’s not much call for that sort of thing at my $DAYJOB, though, it had all pretty much faded from my memory. I have kept working on a bunch of projects in my spare time, and one of my favourites is my TNFS site - sort of an old-school BBS system or interactive “website” for the Spectrum, which grew out of a fun experiment to see how far I could push Sinclair BASIC. It relies on a modern network card fitted to the Spectrum, which is how I came to be chatting to “Desertkun”, another TNFS-protocol enthusiast. He’s now producing a great new WiFi network card for the Speccy, and was kind enough to send me a

回溯。我最终确实换用了一系列Amiga系统,自己也加入了一些“场景”组织,并投入到各种活动中,直到考试和青少年时代的结束。那时我涉猎过Z80代码,一度也掌握了足够的68k汇编知识来应付差事——部分源于Amiga的全盛时期,部分源于大学里的一些“嵌入式系统”课程,我必须在课上编写交通灯或电梯控制器的程序。不过,鉴于我的日常工作($DAYJOB)中对这类东西的需求不多,这些记忆几乎已经从我的脑海中淡去了。我在业余时间一直致力于一系列项目,其中我最喜欢的是我的TNFS站点——这是一种为Spectrum设计的类似老式BBS系统或交互式“网站”,它源于一次有趣的实验,旨在看看我能将Sinclair BASIC推向何种程度。它依赖于安装在Spectrum上的现代网卡,这也是我与另一位TNFS协议爱好者“Desertkun”交流的原因。他现在正在为Speccy生产一款很棒的新型WiFi网卡,并好心地寄给了我一个。