Coin-Op Collection Presents: The Legend of Kage (Taito A54)
Today's release for the Analogue Pocket and MiSTerFPGA platforms is The Legend of Kage, a 1985 Taito arcade game built on the A54 architecture. It is a side-view action game where the ninja Kage leaps through a forest, along a river, over a castle's walls and into its towers to rescue Princess Kiri.
The game was developed and published by Taito. The hardware is split across two boards. The CPU board carries two Z80s, a protection microcontroller labeled A54-09 and two YM2203s, while the video board carries the master clock, three tile layers, the sprites and the priority PROM.
This post covers a technical overview of The Legend of Kage, the work the board required, and the game itself.
Overview:
The Legend of Kage runs on Taito's A54 hardware (CPU board K1100135A, video board K1100136A), driven by a Zilog Z80B at 6 MHz running its program from a fixed map, with a separate data ROM it reads through its I/O ports. A Z80A at 4 MHz handles sound, taking commands from the main processor through a pair of latches with a reply channel back.
A protection microcontroller sits alongside them, a Motorola MC68705P5 marked A54-09, which trades data with the main processor through a latch and a pair of handshake flags. Four PAL devices handle the address decode on the CPU board and the tile and sprite timing on the video board.
The audio is generated by two YM2203s at 4 MHz, each feeding a YM3014 DAC. Each chip's FM and SSG outputs pass through its own Taito PC010SA hybrid built around a TA7630, which sets the SSG level and the bass and treble under the program's control through the YM2203's own I/O ports. The four hybrid outputs are summed by an LM324 and driven out through an MB3731 bridge-tied power amplifier. Audio output is mono.
Every clock on the video board descends from a 12 MHz crystal, halved to 6 MHz for the pixel clock and the Z80B, while the CPU board carries its own 8 MHz crystal, halved to 4 MHz for the Z80A and both YM2203s.
The video system outputs 240x224 in a horizontal orientation. There is no CRTC on this PCB; the raster comes out of the counter chain itself, giving a 6 MHz pixel clock with an HTOTAL of 384 and a VTOTAL of 264. Each 64.00 µs line splits into 240 active pixels (40.00 µs), a 52 pixel front porch (8.67 µs), a 29 pixel sync (4.83 µs) and a 63 pixel back porch (10.50 µs) for a 15.625 kHz horizontal rate, while each 16.90 ms frame splits into 224 active lines (14.34 ms), a 16 line front porch (1.02 ms), an 8 line sync (0.51 ms) and a 16 line back porch (1.02 ms) for a 59.1856 Hz vertical rate. These timings are taken from the PCB.
Graphics are made up of three tile layers and sprites, all at 4bpp. The text, foreground and background layers are each a 32x32 map of 8x8 tiles in video RAM with their own scroll, and up to 24 sprites of 16x16 or 16x32 are drawn into a two-bank line buffer. The tiles and sprites share the same four pattern ROMs. The A54-10, the board's priority PROM, decides which layer wins each pixel, choosing among four layer orders.
The palette is RAM rather than PROM, 1024 entries of 12 bits across three 2148 RAMs, four bits per gun, converted by three Taito PC040DA hybrids. That gives 1024 entries in 12-bit RGB.
Development Challenges:
Main CPU and MCU:
The whole game runs inside the main processor's vertical blank interrupt. The program uses interrupt mode 1 with a single handler, there is no NMI, and a busy frame simply lets the next interrupt nest inside the one still running. A watchdog on the board expects a write every frame. The game's random numbers come from the Z80's refresh register, so they depend on exactly how many instructions the processor has fetched, which is one more reason the processor has to be exact. Below are the main CPU and its decode, from schematic extraction:
The A54-09 is a Motorola MC68705P5, and the game cannot run without it. Every 32 frames the main program asks it for a tamper check fed by a running checksum of the program ROM, and any answer other than zero reboots the board. At every scene change it hands the microcontroller a three-round decryption, and the decrypted result sets the player, the scene and the loop counter the game carries on with. None of the main program's waits on the microcontroller ever times out, so a microcontroller that stops answering freezes the game. Below is the microcontroller and its interface, from schematic extraction:
The microcontroller underneath it is x68705, our own MC68705. It is a fully synchronous Verilog implementation, and with this release it carries the HMOS part's instruction timing alongside the CMOS timing, holding after each decode for the extra cycles so every bus access keeps its position relative to the end of the instruction. A test bench of 158 tests and a cycle test bench of 208 checks pass in full in both timing modes.
Video Pipeline:
Each of the three tile layers is a 32x32 map of 8x8 tiles in video RAM with its own X and Y scroll, and the four pattern ROMs are shared between the tiles and the sprites, one bit plane per ROM. Eight Fujitsu MB112S146 shift registers serialize the pixels, and the A54-12 PAL makes each tile layer's load strobe from three comparisons, which is where the fine scroll comes from. Below are the tile layers and the character path, from schematic extraction:
Sprites come from a list of 24 records the program copies every frame. The A54-11 PAL works out each sprite's row, its vertical flip and the swap for 32-pixel-tall sprites, the A54-13 picks out the sprites that fall on the line and handles the horizontal flip, and the finished pixels land in a two-bank line buffer built from four 93422 RAMs, one bank filling while the other is shown. Where sprites overlap, the earliest entry in the list wins. Emulation has no line buffer. It draws the sprites straight into a frame buffer and uses a priority bitmap to reach the same overlap. The core walks the list on every line into the two-bank buffer, the way the board does. Below are the sprite path and its line buffer, from schematic extraction:
The A54-10 is an MB7122H PROM that decides, for every pixel, which layer is shown. It is addressed by whether the sprite, text and foreground pixels are transparent, by the sprite's priority bit and by a priority bit the program sets, and it holds four layer orders, of which this game uses two; text over sprites over foreground over background, and text over foreground over sprites over background. Emulation loads the A54-10 as unknown and orders the layers in code. The core reads the PROM itself on every pixel, which is where the layer order on the board comes from. Below are the priority PROM and the color mix, from schematic extraction:
The board draws each line as the beam reaches it, and the core latches the scroll, the tile banks and the flip for every line the same way. Emulation takes one snapshot of the registers for the whole frame. The program updates them during the vertical blank, so the two agree on this game, but the core doesn't depend on that.
Sound:
The sound processor is a Z80A at 4 MHz with its own program ROM and RAM. It takes commands from the main processor through a latch that raises its NMI, but only while the program has the NMI enabled, and it answers through a second latch with a flag on each side, which the program uses as a heartbeat. The only tick it runs on is the first YM2203's Timer A at 60.92 Hz, so the music keeps its own time rather than the video's. Below are the sound CPU and its latches, from schematic extraction:
All of the music is FM, six channels across the two chips, and every sound effect plays on an SSG. Each YM2203's I/O ports are set as outputs, and they drive the Taito PC010SA hybrid behind that chip, a TA7630 tone and volume control. Port A sets the SSG level and the two halves of port B set the bass and the treble, rewritten with every sound the program plays. The extra-life jingle and one other effect fade out by stepping port A down while the SSG volumes stay where they are. Emulation lists these as unknown writes to the YM2203's ports and ignores them, so those sounds play at full level to the end. With the PCB filter selected, the core drives the hybrids from the same writes, so they fade the way they do on the board.
Each chip's FM output leaves through its YM3014 and a TL074 follower into one input of its hybrid, its three SSG outputs are tied together into the other, and the four hybrid outputs are summed by an LM324 before the volume control and the MB3731 bridge amplifier. The resistor packs that turn the port values into control voltages can't be read on the board, so the core's control curves were matched against a recording of the PCB. Below is the sound section and output chain, from schematic extraction, along with audio playback with and without the filtering:
Game Speed:
The frame is 384 by 264 at 6 MHz, 59.1856 Hz, the same raster as KiKi KaiKai and Bubble Bobble, and the whole game runs once per frame inside the vertical blank interrupt, so the frame rate is the game's speed. Each frame gives the main processor 101,376 cycles. Emulation runs this game at 60 Hz with 100,000 cycles per frame, so it plays about 1.4 percent faster than the board and has fewer cycles in each frame before a busy one tips into slowdown. The core runs the board's frame, so the game runs at the board's speed. The game also draws its random numbers from the Z80's refresh register, which counts every instruction fetch, so a frame of a different length hands it different numbers. The music is the exception. It runs from the first YM2203's timer at 60.92 Hz everywhere, so its tempo is the same in emulation, on the board and in the core.
Core Options:
The MiSTer core includes video settings for aspect ratio, vertical scaling and cropping, scandoubler effects, and H/V positioning and sync adjustments.
Audio settings provide separate OPN FM and OPN SSG toggles, each with its own volume control, and a filter selector that switches the board's own output chain in or out, including the TA7630 hybrids the program drives. Arcade dip switches are directly accessible from the OSD. Demo Sounds is a working switch, which emulation lists as unused, and the original release carries its own labels, bonus scores shown at a tenth of the later revisions' and a combined coin slot and difficulty switch, where emulation gives it the later revisions' switches. Game settings include per-player auto-fire on either button or both with adjustable rates, mapping options for Player 1 and Player 2, and a synced mapping mode that mirrors Player 1's layout to Player 2.
Cheats are accessible from the OSD and cover invincibility, hit anywhere, no lightning flashes, and infinite lives for each player, on all three sets. The program checksums itself while it runs and has the microcontroller confirm the sum, so whenever a cheat that patches the program is on, the core skips both checks until reset, where emulation leaves that to a separate cheat.
The Pocket core provides auto-fire on either button or both at adjustable rates, shared by both players, and carries invincibility, hit anywhere, no lightning flashes and infinite lives for Player 1. It has no audio settings and plays without the board filter. Arcade dip switches available on Pocket are Extend, Lives, Initial Season, Difficulty, and Invulnerability.
The core supports three sets, The Legend of Kage (Rev 2), The Legend of Kage (Rev 1), and the original release, The Legend of Kage.
History, Gameplay, and Regional Information:
The Legend of Kage was developed and published by Taito, shown at the AM Show in Tokyo in early October 1985 and released in Japan that month. Taito America brought it to North America in January 1986 as a dedicated upright cabinet. The game carries two copyright lines, picked by a dip switch, one reading MCMLXXXIV and the other 1985, which is why some lists date it's release as 1984. The music is by Hisayoshi Ogura of Taito's in-house sound team ZUNTATA, and the rest of the staff is undocumented, since the game has no staff roll. It entered Game Machine's table cabinet chart at number one in the 15 November 1985 issue, and Ogura puts its sales at about 6,000 boards, at a time when 1,500 to 2,000 was already a good result for Taito.
Set at the end of the Edo period, the demon leader Yoshiro Yukigusa and his right-hand man Yukinosuke Kiri kidnap Princess Kiri, and Kage, a young ninja of Iga, sets out alone to bring her back. Kage carries a short sword and shuriken on two buttons, and pushing up on the stick sends him into jumps as tall as the screen. The sword blocks shots and blades, and kills or blocks made with it score double, while the shuriken fly left or right on the ground and in any of eight directions in the air. One hit kills, and the fire-breathing monks' flames and the red ninjas' smoke bombs can't be blocked.
Each chapter runs through a forest, a secret passage along a water channel where ten ninja have to fall, the castle wall, and the castle itself, four floors up to where the princess is tied, before she is snatched away again and Kage settles it in a duel. The chapters follow the seasons, green leaves, autumn leaves and snow, while the ending, with its own tune and a closing cast roll, comes every two chapters, so the seasons and the endings run out of step as the game loops. A magic scroll hidden in one of the forest's trees sets off a ninjutsu that clears the screen for a while. Overall, The Legend of Kage is a game of huge leaps and one-hit deaths that rewards knowing where every enemy comes from.
The three supported sets for the core carry differences. The original release shows every score one digit shorter, with a default high score of 20,000, has no Easy setting, and attacks once per press, and it still holds a level select screen that nothing reaches. Rev 1 multiplied the displayed scores by ten, made the buttons repeat while held, which makes blocking with the sword far easier, and added the Easy setting with its own flame formation. Rev 2 reworked the enemy pacing in the first and third areas and closed off the joystick during the attract demo, which the earlier builds let players steer.
The arcade version of The Legend Of Kage was re-released in the Taito Memories and Taito Legends 2 collections, and through Hamster's Arcade Archives for modern consoles in 2015 and 2019.
Updates:
The Legend of Kage follows The Lost Castle in Darkmist as today's second Taito release, and it is a public release. KiKi KaiKai and Bubble Bobble have also been updated to run on xZ80, our own Z80 and will release later this week.
The files are carried by update_all on MiSTerFPGA and by pupdate on the Analogue Pocket. Please allow the updaters time to sync before pulling them down. The files are attached to this post as well if you would rather install manually.
Comments (6)
Any chance to see umk3+ and cup
Hey guys! Coin-Op Collection, I left you some major feedback on the Keys and report on Mortal Kombat and other games now working. IN private Message. I hope it reachs you . Thank you for the awesome works.
小さな頃、影の伝説のデモ画面で操作できるのでよく遊んでました。奇々怪界、バブルボブルどれも当時好きだったゲームです。ありがとうございます。
Great job on the core and the detailed writeup. Will the schematics be made available eventually?
Yes. I plan on publishing them at some point.
Thx guys
