Jump to content
IGNORED

Re-Pete: a Simon clone (first CV game)


ezod

Recommended Posts

Hi all, new here. I built a RC2014 last year with TMS9918A and SN76489 (and soon, YM2149F), and one of its tricks is launching ColecoVision games from CP/M. I figured writing a simple game of my own would be a good way to learn Z80 assembly and the graphics and sound chips at the same time.

 

Attached is Re-Pete, a reasonably faithful clone of the original Simon. If you try it out let me know what you think! The code isn't up anywhere yet but I'm happy to share and/or explain how it works.

 

  • Used some of @Tony Cruise's template/library code and book to get started. Very useful, thanks!
  • Runs in "graphics mode 1" (aka mode 0), no sprites, just a few byte updates at a time to the color table and layout, glitches may exist but are rare.
  • Someone helpfully reverse-engineered Simon and documented it, which made this easier to get right.
  • It seems hard to get a random number from 1-4 that doesn't feel decidedly un-random; settled on a LFSR with 64-bit seed XOR'd with the clock, maybe there's a better way?
  • Under 8K ROM, without compressing graphics (incl. 52 unused patterns out of 256, made loading & arithmetic easier) or aggressively optimizing code.
  • I use a whole 99 bytes of RAM to store the pattern sequence when I could be using a quarter of that (only 4 possible values = 2 bits), but this is easier and faster.
  • No idea what chaos you will unleash if you somehow exceed a pattern length of 99.

 

This took me just under a week hacking on it here and there (with lots of C, embedded, and digital electronics experience, and some assembly experience on other architectures). Easier to pick up than I thought it would be! Hope that's encouraging to anyone else starting out. That said, things that took a little while to figure out as a newbie:

 

  • How to get the VDP into graphics mode 1 (actually very easy once you RTFM).
  • How to play sounds. Spent a bunch of time trying to poke at the SN76489 directly before I found some documentation about the OS7 sound interface from @newcoleco, and then went back to actually read @Tony Cruise's stuff about it as well.
  • How to request, await, and free a one-shot timer without any example code (I had it mostly right, but was trying to be clever and didn't store A).
  • How to get decently random sequences. Still not sure I do, and still not sure I'm not just imagining the lack of randomness.
  • Lots of WTFs related to BIOS calls clobbering registers.

repete.rom

  • Like 5
Link to comment
Share on other sites

Nice effort for being your first game!

 

I put together a small manual:

 

1. Press keypad * to start the game.

2. Re-Pete will blink one light to start. Use the stick direction to illuminate the correct light (up for green, right for red, left for yellow, down for blue).

3. If you repeated the sequence correctly, Re-Pete will blink one extra light.

4. If you failed to repeat the sequence, Re-Pete will show your best score so far.

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...