Forums

Sega Master System / Mark III / Game Gear
SG-1000 / SC-3000 / SF-7000 / OMV
Home - Forums - Games - Scans - Maps - Cheats - Credits
Music - Videos - Development - Hacks - Translations - Homebrew

View topic - Sord M5 Programming?

Reply to topic
Author Message
  • Joined: 25 May 2012
  • Posts: 32
Reply with quote
Sord M5 Programming?
Post Posted: Fri Nov 22, 2013 10:38 am
Hi there.

Has anybody here ever had a look at programming the Sord M5 (CGL M5)?

It's a home micro from 1982, which uses a Zilog Z80 at 3.58 MHz, TMS9918 for video and SN76489 for sound. The interfaces amongst these might be different, but that seems to me like it's very much like a Master System with a keyboard and cassette interface. (Most 80s micros at the same price would have similar guts, I expect. (?))

I'm going to look into it a little further and see how much tweaking I'd have to do to get my Gravity Beam game working on the M5. (Let's not call it the "SM5", that's just confusing haha). I know it's a little outside smspower's scope, so please excuse me while I think aloud for a sec.

It's got super teeny stock RAM (4KiB) so loading programs from tape is probably a daft idea. It's got two cart slots, a 16KiB ROM and a 32KiB ROM/RAM slot, that are directly addressable in the memory map link, so if you expanded the M5 maybe tape would work after all. Sounds simpler to just stick a whocking great ROM in the 32KiB slot though, ta-dah! The TMS9918 and SN76489 aren't memory mapped in the M5.

SMS Gravity Beam is 32KiB; could I just reassemble it for the M5's memory map, blop the new binary in the big slot, and immediately jump to it on boot? (Assuming the M5 jumps to the small ROM slot start on reset if it detects a cart in there.) It couldn't be that simple, could it?

It'd be wild, fun and terribly stupid to try and get something new and Sordy working in hardware, but that'll have to be a job for somebody else.
  View user's profile Send private message
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 14735
  • Location: London
Reply with quote
Post Posted: Fri Nov 22, 2013 11:14 am
It's closer to the SC-3000, which has the same display chip (TMS with 16KB VRAM) and less RAM (2KB vs 4KB). The graphics chip differences will be the biggest problem with porting SMS homebrew - try starting with this:

http://www.smspower.org/Homebrew/Snake-SG

and remapping the I/O and memory map as necessary.
  View user's profile Send private message Visit poster's website
  • Joined: 25 May 2012
  • Posts: 32
Reply with quote
Post Posted: Sun Dec 01, 2013 11:13 pm
Aye, thanks for the info Maxim. I hadn't counted on the graphics chip differences.

The penny dropped when a friend of mine mentioned that his MSX had Spectrum-style attribute clash, which confused me because I thought the MSX, the M5, and the SMS all had a TMS9918 for video. Which, of course "they do". But, really, no they don't, because only the SMS has Mode 4, and wouldn't be seen dead showing attribute clash.

What happened was that I saw the chip name in the M5's specs, but must have assumed that the 'derived from' description about the SMS' version was just a faster clock speed or RAM upgrade rather than an entire new graphics mode, and from that point onwards I'd just started confusing myself more and more.

Without Mode 4, a port would need a whole new graphics system and so on, which is not what I wanted to do. (And I knew the M5 had a smaller amount of RAM but I'd forgotten how much I'd taken the SMS' RAM for granted when I wrote my game. I'd decompressed great wodges of the ship frames into the RAM, as well as the level meta-tile layout, to compress it into my 32kbit EEPROM cart conversion.)

As a nifty consolation prize, the sound hardware -really is- exactly the same as the SMS, so with some random guesses as to the purpose of the 5 magic numbers at the start of a Sord M5 ROM (A zero to make sure the cart is responding and not a pulled-up-cart-missing $FF value, a 16-bit word unknown something, and a 16-bit word vector entry point into the ROM) and the addition of a horrible spin-wait loop to keep time (as I don't have any info on the preferred way to handle interrupts), I now have a completely useless ROM that plays the Gravity Beam MG title screen music. I call it "Sord Play". I'm sure the hundred or so M5 owners in the world will be thrilled. ;D

I think I'll call that particular fight a draw for now. Thanks again.
  View user's profile Send private message
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 14735
  • Location: London
Reply with quote
Post Posted: Sun Dec 01, 2013 11:19 pm
The sound chip isn't the same, it has a different noise pattern... and may be clocked differently, but the effect is negligible in most cases.
  View user's profile Send private message Visit poster's website
  • Joined: 25 May 2012
  • Posts: 32
Reply with quote
Post Posted: Mon Dec 02, 2013 4:11 am
Is that a deviation of the SMS's chip from a typical SN76489, or something else?
  View user's profile Send private message
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 14735
  • Location: London
Reply with quote
Post Posted: Mon Dec 02, 2013 7:28 am
Sega's version has some tweaks to make it sound better (more percussive noise) and the "synchronous noise" mode is exactly 4 octaves lower than the driving frequency, making it easier to use that feature (with the original, the frequency is divided by 15 which would require extra tables to use sensibly). This applies to the Master System and later.
  View user's profile Send private message Visit poster's website
  • Joined: 21 Jul 2005
  • Posts: 412
  • Location: GBG
Reply with quote
Post Posted: Mon Dec 02, 2013 7:30 pm
Did you find any useful info on the Sord M5?
I think I figured out most of the basics from MESS but I'm not sure how IRQ are generated/handled. It seems to have 2 Z80 cpu and that the VDP IRQ is hooked to one of them (some kind of bios/system/controller?) and the other cpu is what runs the normal programs...
  View user's profile Send private message Visit poster's website
  • Joined: 25 May 2012
  • Posts: 32
Reply with quote
Post Posted: Tue Dec 03, 2013 1:27 am
Nothing, sorry. :( I know just enough to get the processor to branch to my code.

You'd have to check the MESS m5/m5p driver source, maybe get a hold of the developers of it? Even then, MESS doesn't support the 32k second slot RAM expansion cart of the M5, so there may be gaps there too.
  View user's profile Send private message
  • Joined: 01 Aug 2012
  • Posts: 322
  • Location: Porto, Portugal
Reply with quote
Post Posted: Tue Feb 28, 2017 2:56 pm
i’m now starting to do something for it on Boriel’s ZX-Basic Compiler - http://www.boriel.com/wiki/en/index.php/ZX_BASIC:Released_Programs_-_SordM5#keyb...

for now i’m not finding really relevant differences between sord-m5, sg-1000 and colecovision - starting the rom at $2000, and starting the code with something like "defb $00,$05,$20,$2E,$00" (i really don’t know what it is exactly, perhaps some info that the bios seeks for starting running the data from the cartridge) might help stuff starting to work

the document i’m using as reference is at https://github.com/mamedev/mame/blob/master/src/mame/drivers/m5.cpp

for now, what i’m really struggling to understand is how the joysticks works, specially their buttons - and how to disable the sound from keyboard as well (might be some system variable somewhere?)
  View user's profile Send private message Visit poster's website
  • Joined: 28 Jan 2017
  • Posts: 556
  • Location: Málaga, Spain
Reply with quote
Post Posted: Tue Feb 28, 2017 7:38 pm
Maxim wrote
The sound chip isn't the same, it has a different noise pattern....


I ask myself what sms emulator has the most exact noise simulation. Emulicious plays the noise stronger than fussion. but never heard a real sms and i like way more emulicious for my songs..
  View user's profile Send private message
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 14735
  • Location: London
Reply with quote
Post Posted: Tue Feb 28, 2017 8:08 pm
Most emulators have an accurate noise pattern now, but I suspect the analogue filters outside the chip play a large part in the perceived balance between tones and noise. I think the noise and tones have exactly the same amplitude coming out of the chip. Emulators may apply some fudge factors to make things sound about right without emulating all the analogue effects.
  View user's profile Send private message Visit poster's website
Reply to topic



Back to the top of this page

Back to SMS Power!