C64 血钱
C64 Blood Money

原始链接: https://lemmings.info/c64-blood-money/

这段文字详细描述了作者回忆起1989-1990年将游戏《血钱》移植到Commodore 64的过程。该项目涉及几个关键组成部分:多向滚动、双人动作的精灵复用器、脚本、精灵压缩、炮塔、角色精灵、武器/子弹、碰撞检测以及商店前端。 作者 fondly 回忆起使用PDS(程序员开发系统)——一个PC ISA卡和C64卡带——它内置的编辑器、汇编器和调试器大大加快了开发速度。他们强调了为了优化而有效利用6502的零页内存。 游戏的独特之处在于其基于位图的碰撞检测,允许与背景进行精确的交互。代码还包含一个巧妙的调试系统,由BRK指令触发,以及作者至今仍在使用的变量分配方法。尽管现在有些地方让人尴尬,但作者对代码的注释水平印象深刻,考虑到这是他们第二次做游戏。下一期将深入探讨游戏的IRQ和复用器的复杂性。

## 黑客新闻上的C64开发与怀旧 黑客新闻上的一场讨论围绕着经典Commodore 64游戏《血钱》的开发,以及复古游戏开发。对话强调,尽管许多人认为8位游戏是直接在目标系统上创建的,但专业开发者通常会使用主机PC或工作站。 用户分享了使用Turbo Assembler和Fairlight等工具的经验,并指出C64开发随着时间的推移有所改进,但缺乏版本控制。讨论涉及了基于主机开发(速度、功能)和直接在目标机器上开发(对硬件限制的熟悉)之间的权衡。 几位评论者回忆了《血钱》等游戏的难度,并表达了对现代重制版或精神续作(如《僵尸之夜恐慌》)的渴望。该帖子还引发了关于在Linux上进行现代C64开发工具的讨论,推荐了ca65/cc65、Prog8和oscar64。最后,一些用户分享了早期游戏开发经验如何塑造了他们的职业生涯的个人故事。
相关文章

原文

While I still remember the details, I thought I’d go over my port of Blood Money to the C64. It had some really cool bits in it, and I had great fun doing it. Some parts make me cringe a little now, so it’d be interesting to revive it, and see if I can get it building again – or at the very least, go over the code again…

One thing that DID bug me, even back then, was the crappy starfield. It was just some characters stuck in the map, and it sucked.

So what were the main components?

  1. Multi-Directional scrolling
  2. Sprite Multiplexor
  3. Scripting
  4. Sprite compression
  5. Turrets
  6. Character sprites
  7. Bullets / Weapons
  8. Collision
  9. Shop
  10. Front End

These are the major parts and we’ll take them one at a time. Before that, I want to briefly look over the code, and talk about the devkit – PDS. Programmers Development System. This was a lovely system, and one I’m sad I didn’t find while raiding the DMA Offices.

The PDS system consisted of a PC ISA card, and a C64 cartridge. The ISA card was common for all systems, while the target cartridge was custom for each platform.

As I can’t find a C64 image, here’s the Sam Coupé (Z80) one to show what it might look like.
EDIT: So with the RMC Cave opening up a “Dev Den“, Jason who is running that part, had a C64 one and it turns out there isn’t an interface, just a user port connector. This makes sense as the C64 already has everything it needs to read/write bytes in parallel.

PDS development system | World of SAM

This is the Z80 program, but the 6502 one was the same. It consisted of a built in text editor/assembler/debugger. The text editor could hold 8 files up to a maximum of 32k each, though you could include as many files as you like. It assembled before your finger left the key, and squired down in under a second. This was a massive speed boost from the 20 minutes I sometimes spent waiting on the C64 to disk assemble using a fast parallel disk interface.

The other good thing about PDS, is it remembers the start date, and the last time you touched it – which is very cool and handy. So I started this on 7th of August 1989…. though, this probably isn’t right. This was the month the office opened, and I was still working on Ballistix at this point. However, I did create a C64 framework, and then probably based the game off that. The date below 2/10/89 looks better, and the end date looks about right 25/4/90. Games back then took about 6 months, so this also fits.

So in the main code of all my C64 games, I setup equates (constants), and zero page and normal variables. On the 6502 there are 256 bytes of fast zero page, 2 are taken with I/O control, and the rest are available for use. Zero page instructions typically take 1 cycle less to operate, so are highly desirable for critical code optimisations.

These are some of the constants. At the top you can see the big ticket items – memory map etc. There’s a couple of interesting items here – Charmasks/Shipmasks, and down_load. The collision in Blood Money wasn’t character based, it was bitmap based. I actually read the background tiles, and then masked whatever frame of the ship was active onto these characters. This was pretty slow, but allowed proper collision to the background – something that was vital in later levels. I’ll discuss this mode later of course…

down_load – this was where the debugger/downloader code lived. Whenever the C64 hit a BRK instruction, I would detect this in the IRQ it generated, and jumped to the PDS debugger code.

This is how I allocated Zero Page variables. Prior to having good macros, I’d have to work these out manually, but now I was able to simple set a name and how many bytes I wanted, and the label would be set. I still use this method for variable allocation when need be – it’s really useful.

I use the same method for sprite variable allocation. Have to say… this is a lot of variables for each sprite – oh well….

And this is where I defined general variables, and player structure. There’s 2 of everything as Blood Money is a simultaneous 2 player game. This really effected the multiplexor – but more on that later….

Lastly for today, is the start up code, we take over everything and nuke stack and zero page, flick out ROMs etc and setup IRQs – the usual…

The IRQs in Blood Money are complicated, and heavily tied to the multiplexor, so I’ll talk about that next time…..

Also just to say…. as this was just my second game, and only a couple of months after the office opened, I’m amazed at the level of commenting in the source! 😂

联系我们 contact @ memedata.com