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 - Operating system for SMS

Reply to topic
Author Message
  • Joined: 06 Jun 2019
  • Posts: 7
  • Location: Quebec City, Canada
Reply with quote
Operating system for SMS
Post Posted: Thu Jun 06, 2019 12:24 am
Last edited by vdupras on Tue Jul 02, 2019 8:38 pm; edited 1 time in total
Hi everyone. I just discovered this website and it looks like a really good ressource for development targeting the SMS.

I'm developing a new operating system for z80 with extremely minimal system requirements and I'm looking into making the SMS and also the MD a viable target for it, I thought you might be interested in looking it up: https://collapseos.org/

It features a z80 assembler written in z80 assembler that weights less than 4Kb and self-compiles with less than 16Kb RAM (yes, I know, a bit too much for the SMS, but I hope to be able to pull some tricks up my sleeve to make it work). The shell/kernel itself runs on just a few bytes of memory.

The project is already pretty advanced and runs well on a RC2014 Classic ( https://rc2014.co.uk/ ) but I lack SMS knowledge. Of course, I expect to learn on the fly, but if the project is of interest to some of you SMS experts, then we can probably have some fun working on this together.

Update: it works! See https://github.com/hsoft/collapseos/tree/master/recipes/sms
  View user's profile Send private message Visit poster's website
  • Joined: 29 Mar 2012
  • Posts: 510
  • Location: Spain
Reply with quote
Post Posted: Thu Jun 06, 2019 6:13 am
Wow, sound totally interesting, although my knowledge about OS's has decreased a lot since my college days...
In any case, taking a look at what Sega Basic does can be helpful to deal with the memory limitations.
  View user's profile Send private message
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 12963
  • Location: London
Reply with quote
Post Posted: Thu Jun 06, 2019 6:42 am
Modern assemblers have a lot of helpful features but it should be possible to make a single pass assembler that only needs as much RAM as it needs to track forward references as it assembles - or you can disallow forward references. I'm not sure about typing assembly using a D-pad though...
  View user's profile Send private message Visit poster's website
  • Joined: 06 Jun 2019
  • Posts: 7
  • Location: Quebec City, Canada
Reply with quote
Post Posted: Thu Jun 06, 2019 10:57 am
An assembly without forward references is too barebone for me :) Having to jump with numerical offsets for every forward jump? ouch.

Also, I don't see how it would free the assembly from keeping symbols in memory: you still need to keep backward references in memory.

As for input, I wasn't planning on using a D-pad :) I was rather planning on hacking an existing keyboard, cut the cord, hook it to a 9-pin connector and develop a driver for this.
  View user's profile Send private message Visit poster's website
  • Joined: 08 Sep 2018
  • Posts: 208
Reply with quote
Post Posted: Thu Jun 06, 2019 12:57 pm
Hmm interesting, I have quite a few questions.
Do you plan on using a cart or making some kind of floppy add-on?
Do you plan on using a memory management kernel and running drivers in on cart ram to keep system ram open for applications?
What about time keeping as well?
  View user's profile Send private message
  • Joined: 06 Jun 2019
  • Posts: 7
  • Location: Quebec City, Canada
Reply with quote
Post Posted: Thu Jun 06, 2019 1:17 pm
I'm happy to answer your questions, keep them coming!

The goal is not to make an OS for the SMS, but rather target the SMS as a proof of concept for something very minimal. Also (and maybe more importantly), the SMS/MD have been very widely sold and are very "scavenge-friendly". Post collapse people finding a SMS/MD will have much of what they need to build themselves a computer that can program microcontrollers (the end goal of this OS).

Considering this, it's possible that Collapse OS is of limited interest to many people here, but nevertheless, I thought that the idea of running a full z80 assembler on a SMS might tap into the interests of some of you.

To keep the code simple, compact and self contained, I limit the scope of it. This OS is strictly to edit text files, binary files, assemble code, program microcontrollers and flash memory.

I'm not planning on adding time keeping functions as I don't see how it fits in that scope.

I bought myself a used SMS, MD and a everdrive. For now, the everdrive will facilitate my work as I can use a SD card for the MD, but yes, soon enough I'll build myself a ROM cart by popping up the ROM of an existing cart and place a eeprom socket in there.

On-cart RAM was one of the things I wanted to try in the "tricks up my sleeve" in my first comment :)

As for memory management, if you mean paging to go over the 64K limit, I'd prefer avoiding this to keep things simple. If you mean a mechanism to allow "userspace" programs assembled independently of the kernel to run from RAM, Collapse OS already supports this.
  View user's profile Send private message Visit poster's website
  • Joined: 08 Sep 2018
  • Posts: 208
Reply with quote
Post Posted: Thu Jun 06, 2019 3:12 pm
Interesting, I've had similar ideas for the Mega Drive but more for novelty rather than absolute functionality. It ran on the Mega CD and had things baked into its ROM like a simple game (snail maze clone lol), text editor, and paint program. Its features allowed reading incoming dump from the P2 port and saving them on a flash/sram cart, it could also save paint files or text documents in sram as well. I planned on having a Music Tracker and z80 asm compiler but at the time I couldn't get the flash/sram cart writes and reads to work very well and couldnt find the time to write a compiler or tracker. I called it Gemini DOS to fit the Sega space theme, but the projects pretty dead. I'm sure I could complete it now but the code is a mess and would probably need a total rewrite.

Either way, good luck on your project! stuff like this is always interesting and its fun to see people try and turn a lot of these old systems into full computers.
  View user's profile Send private message
  • Joined: 06 Jun 2019
  • Posts: 7
  • Location: Quebec City, Canada
Reply with quote
Post Posted: Tue Jul 02, 2019 8:38 pm
Update: it works! I've just finished making Collapse OS run on a Genesis with an Everdrive MD, controlled with a D-pad.

The system is a barebone shell, but otherwise fully functional. It can peek and poke memory and ports.

Using a D-pad to drive a shell isn't very fun, but I haven't finished my keyboard adapter yet.

Also, d-pad support means that soldering isn't a requirement to run Collapse OS on a SMS.

Instructions at https://github.com/hsoft/collapseos/tree/master/recipes/sms
  View user's profile Send private message Visit poster's website
  • Joined: 06 Jun 2019
  • Posts: 7
  • Location: Quebec City, Canada
Reply with quote
Post Posted: Sat Jul 20, 2019 5:00 pm
Another update: I've built a PS/2 keyboard adapter for the SMS! See https://github.com/hsoft/collapseos/tree/master/recipes/sms/kbd

Maybe the adapter by itself could be of some interest to some of you, independently of Collapse OS. I have yet to push the schematics (I haven't scanned it yet), but the code is there, the description is there, I've built the prototype, it works well.
  View user's profile Send private message Visit poster's website
  • Joined: 15 Mar 2010
  • Posts: 47
  • Location: Florida
Reply with quote
Post Posted: Fri Sep 27, 2019 8:41 pm
Maxim wrote
Modern assemblers have a lot of helpful features but it should be possible to make a single pass assembler that only needs as much RAM as it needs to track forward references as it assembles - or you can disallow forward references. I'm not sure about typing assembly using a D-pad though...


what about the megadrive keyboard
  View user's profile Send private message
  • Joined: 06 Jun 2019
  • Posts: 7
  • Location: Quebec City, Canada
Reply with quote
Post Posted: Fri Sep 27, 2019 11:25 pm
I don't have esoteric sega hardware, so I didn't work on driver for them.
  View user's profile Send private message Visit poster's website
  • Joined: 23 Aug 2009
  • Posts: 79
  • Location: Seattle, WA
Reply with quote
Post Posted: Fri Sep 27, 2019 11:43 pm
You can probably use the 16k of VRAM to page in/out large swaths of RAM.
  View user's profile Send private message
  • Joined: 22 Sep 2019
  • Posts: 26
Reply with quote
Post Posted: Mon Sep 30, 2019 6:58 pm
Just a thought, but since you're a hardware-person I thought I'd risk highjacking the thread to mention it...

The Saturn keyboard uses the same pins as the SMS and MD, just with a different connector. Since you're building a PS2 adapter anyway, it would be sweet if you used the same three-line handshake. Your post-collapse survivor might have a Saturn keyboard laying around (they're surprisingly common on eBay).

https://plutiedev.com/saturn-keyboard

https://plutiedev.com/io-pinout

The actual protocol is described in the SMPC user manual, which might be more useful than 68k assembly for you.
  View user's profile Send private message
  • Joined: 06 Jun 2019
  • Posts: 7
  • Location: Quebec City, Canada
Reply with quote
Post Posted: Tue Oct 01, 2019 12:17 am
It took me a while to understand what you meant. I wasn't interested until I read that key sentence:

Quote
They also released an adapter that lets you connect a PS/2 keyboard to the Saturn


So what you mean is that the PS/2 adapter I'm building should try to use the same MD<->Adapter protocol as the one that was developed for the Saturn, right? It's a nice idea. I'll look into it. If it's not too hard, I'll do it.

This would mean that someone with a SMS or MD and a Saturn keyboard or adapter could run Collapse OS driven by a keyboard without any soldering involved. That would be pretty cool.

Do you have that hardware? Could you test it if I end up doing it?
  View user's profile Send private message Visit poster's website
  • Joined: 22 Sep 2019
  • Posts: 26
Reply with quote
Post Posted: Tue Oct 01, 2019 1:47 am
Sorry I wasn't that clear in my previous post. Just to clarify, the Saturn keyboard doesn't connect directly to a DE9 port, but the necessary adapter can be built with a pair of extension cables and a screw terminal in a pinch, so technically no soldering necessary. It's just a case of adapting the connector.

Other than that, you've caught my drift. I can definitely test software against a real MD with Saturn keyboard connected. If you want something to test your adapter against, the Arkagis trial for MD supports the keyboard and even has a controller diagnostic screen.

The actual protocol is documented on page 110 (or 100 if you're using the printed page numbers) in the SMPC user manual.
  View user's profile Send private message
  • Joined: 13 Jun 2011
  • Posts: 8
Reply with quote
Post Posted: Tue Oct 08, 2019 7:44 am
Great thread !!! Great work!!!

[Do you know Subor SB-2000 ???? (A" famiclone" with moooore RAM, keyboard, floppy disk drive ... And Operating System... Pseudo MS-DOS for NES)
Some GUIs exist for that systems, NES-Famicoms with keyboards ]

With help of cousin Z80 system MSX / Playsoniq :
*What do you think about make some port of MSX-DOS for SMS-sc3000-sf7000 ????
*It would be possible with this step away CollapseOS ????
* Have you ever dream about GUI SYMBOS on Sega Master System with everdrive ??? (More RAM is needed??? )
  View user's profile Send private message
Reply to topic



Back to the top of this page

Back to SMS Power!