Einstein 256 Primer cover: Graphics 7's 256 colours on the Einstein 256's screen
← Back to Modules
module
1

What This Primer Is

Introduction

This primer is for someone who has finished the Z80 assembly course on this site, which was written for the Einstein TC-01, and now wants to write games for the Einstein 256. It does not teach assembly language again, and it does not go back over anything that works the same on both machines. It shows you what is different, and above all how to use what the 256 has that the TC-01 does not.

If you haven't done the assembly course, start there. This primer takes for granted that you can write a program, call MOS, drive the VDP through ports 8 and 9, set up sprites and run a game loop.

The Machine

The 256 is named after its memory. The Z80 has the same 64K of RAM as the TC-01, but the video chip has 192K of its own: 128K that you reach in 16K pages, and a further 64K beside it. The TC-01 had 16K.

That video chip is the other big change. It keeps the TC-01's ports and registers, works most of them the same way, and does a good deal more. Switch it on and you see the familiar start-up screen, with a new banner:

***  EINSTEIN 256  ***

and TATUNG/Xtal MOS 2.1 where the TC-01 says MOS 1.2.

What Carries Over

Most of what you learned works unchanged. You print with RST 8 / DEFB 158. The keyboard calls, the control codes and the line-drawing call behave just as they did. The CTC and its IM 2 interrupts, and the AY sound chip, are the same. Ports 8 and 9 still reach the video chip by the same protocol, and at start-up MOS lays out the first 16K of video memory the same way as on the TC-01. So a TC-01 program that writes to the screen directly may need very little changed.

The things that don't carry over are few, and S3 covers them in one place, so you know what to check before you move a TC-01 program across.

What the 256 Adds

Everything from S4 on is something the TC-01 cannot do at all:

  • A palette: 16 colours on screen, each one chosen from 512.
  • A real frame interrupt: once a frame, 50 times a second, to drive your game.
  • Eight sprites on a line instead of four, with a different colour on every line of a sprite.
  • Bitmap screens: 256 pixels across with any of 16 colours per pixel, 512 across, 256 colours on screen at once, up to 424 lines.
  • Page flipping: draw on a page the player can't see, then show it.
  • Hardware scrolling: move the whole screen up or down by changing one register.
  • A line interrupt: change things part-way down the screen, for a fixed score panel or a colour split.
  • A blitter: a command engine inside the video chip that fills, copies and draws lines while your program gets on with something else.
  • 80-column text.
  • Digital joysticks, read straight from a port.

The primer ends with a small game that puts many of these together.

What You Need

  • Everything from the assembly course's S2: VS Code, the Einstein extension, z80asm and MAME. S2 shows which version of the extension you need.
  • The Einstein 256 ROM for MAME: S2 shows where it goes and how to start the machine.

How Each Section Is Laid Out

The same way as the assembly course.

  • What it teaches, and which assembly course sections it builds on, at the top.
  • The explanation, starting from the TC-01 way you already know.
  • The code: a complete program, with What you should see.
  • Change one thing: small edits with a question attached.
  • When it goes wrong: the failures we actually hit.

Appendix I sets the whole primer out as one table: each thing as the TC-01 does it, and what the 256 does instead.

Found A Mistake? Stuck? Want To Help?

All three are worth a message.

Next

S2, Setting Up: the 256 in MAME, and your first program on it.

Get the Newsletter

New guides, disk images and community finds, roughly once a quarter. No spam, we promise, this isn't Tatung's marketing department.
Your subscription could not be saved. Please try again.
Your subscription has been successful.

Newsletter

Subscribe to our newsletter and stay updated.