|
ForumsSega Master System / Mark III / Game GearSG-1000 / SC-3000 / SF-7000 / OMV |
Home - Forums - Games - Scans - Maps - Cheats - Credits Music - Videos - Development - Hacks - Translations - Homebrew |
Author | Message |
---|---|
|
BBC Basic on the SMS
Posted: Sat Jul 24, 2021 3:24 am
|
Someone sent this to me today and thought it was worth sharing. BBC Basic on the SMS: https://old.reddit.com/r/retrobattlestations/comments/oow1d6/bbc_basic_z80_on_a_...
|
|
|
Posted: Sat Jul 24, 2021 3:26 am |
Here's the relevant text in case reddit disappears someday...
|
|
|
Posted: Sat Jul 24, 2021 7:11 am |
It’s by benryves who is an old friend of the site. Hopefully he’ll be along soon with more details :) or you can visit http://benryves.com/journal/3763166 | |
|
Posted: Sat Jul 24, 2021 10:22 am |
Pretty awesome! | |
|
Posted: Tue Jul 27, 2021 6:49 pm |
Thank you for sharing, Maraakate, and thanks for linking to my site, Maxim! :) Hope everyone's been well here.
I'd been meaning to post something about this over here once I'd got it into a slightly more sensible state, I had been rushing it together to get something working for the RetroBattlestations competition hence the reliance on other retro hardware (such as the Cambridge Z88). Since then I've done quite a lot of additional work, mostly on improving the graphics support (filled/outline circles and ellipses, filled rectangles and triangles are now implemented in both TMS9918 Graphics II and SMS Mode 4) along with getting the SOUND and corresponding ENVELOPE statements working as close to the BBC Micro versions as I can. I've also moved the main BASIC and host interface variables to the high end of memory and put PAGE (the start of memory, where programs are loaded to) to $C000. When booting on-cartridge backup memory is enabled and tested to see if a) it's writable and b) whether it's mirrored to get an idea of its size. If present PAGE is then moved down by the appropriate amount to expand memory. On a plain ROM-only cartridge this means you're still limited to an 8KB environment but if there's an 8KB or 16KB you can end up with a 16KB or 24KB BASIC machine, which is a lot more room to play in! So far I've only got that working on emulators as I don't have a cartridge with SRAM on-board to test with, but one additional side-effect is that if your program is smaller than your cartridge's battery-backed RAM it will be preserved when you switch the console off; when you switch back on just make sure you type in OLD and your program will be there! I still need to make some decisions about connected hardware, though. At the moment a PS/2 keyboard is required in controller port 1 (using TH and TR; the other joystick buttons are passed through so you can still use the d-pad and a single fire button) and an RS-232 serial port is implemented in controller port 2 (using TH, TR, Up and Down, so no practical controller pass-through is supported there). I think the keyboard is going to be a necessary requirement, and it's quite nice that you can still have most of a joystick working with one plugged in. The serial port is also pretty useful, but the way that it takes up four pins instead of two is a shame as it means you can't use it as a joystick pass-through. I think that maybe using the second controller port as an I²C bus interface would be a good plan, as I²C would only take up two pins (TH and TR again, same as the keyboard) and allow for the attachment of inexpensive EEPROM chips for file storage, a real-time clock so TIME$ can be implemented, as well as other common I²C peripherals that could be attached to the bus easily (e.g. ADCs or thermometers) to extend the machine. One thing I really haven't worked on properly is the OSCLI implementation, which allows you to pass strings to the host's command line interface (either directly via a * command, or passing a string to OSCLI in a BASIC program). At the moment I have a handful of single-character commands that can perform some basic tasks (e.g. *T runs a terrible serial terminal, *H sends a "hello" message to the Cambridge Z88 using the PC Link 2 protocol to check it's there, *F:RAM.1/ lists all files on :RAM.1 on the Z88) but I think there should be commands to set up the environment, e.g. to define what controller or device is plugged into which port. At the very least being able to specify the keyboard layout, but also have commands to set the serial port baud rate, specify which device should be used by default to load or save programs from, define which joystick is plugged into which port. Sticking a microcontroller in here would make life easier, but I'm somewhat keen to avoid that as it makes it a lot more challenging for others to replicate the project and it comes back to this idea of "cheating"! :) |
|
|
Posted: Tue Jul 27, 2021 9:00 pm |
I should also say I’m a big fan of the Z88 :) I’ve had mine since about 1994, sadly it doesn’t get much use and needs some repairs but it’s a really awesome little computer and probably the only electronics I own that was made in the UK :) | |
|
Posted: Tue Jul 27, 2021 11:08 pm |
I hope your repairs aren't too tricky! I need to buy some more conductive ink/glue to repaint the corroded traces on the keyboard membrane on my "spare" Z88, I've had to do it two or three times already but it's just disintegrating with age (the rubber keyboard mat is also shrinking). They are great little computers but I wish Sinclair had used somewhat more reliable keyboards on their machines.
I'd really love to have a BBC Micro as that's what got me into computers in the first place but in the meantime running BBC BASIC on a Master System is providing some of that charm. :) |
|
|
Posted: Mon Aug 16, 2021 1:14 am |
I'm still working on this, I posted this video on Twitter a few days ago and people seemed interested in it so I thought I'd share it here - loading BBC BASIC programs from "tape" (well, a phone playing a tape image) onto the Sega Master System:
There's an accompanying journal post on my site here: https://benryves.com/journal/3763171 Now that I'm loading programs designed specifically for the BBC Micro I'm running into more obvious discrepancies between the systems. Has there ever been much done into finding a safe area for the screen to output text to before material gets lost in the overscan? At the moment I've reduced the TMS9918 text mode to 38/40 characters width and moved the left edge over two characters. This seems to match what BASIC on the SC-3000 does. I've also reduced the other modes to 28/32 characters width, bringing in both the left and right margins by two characters. On my TV the left and right columns in the 32-character modes are definitely off screen and half of the second column is also off screen. If I could enlarge the text viewport to the central 30 characters then I'd also need to apply a half-character fine-scroll adjustment to get all 30 characters fully on screen which seems like a bit of a hack, especially as that much of a difference can also be accounted for by switching between SCART and composite cables. On the other hand, I know that my TV has particularly bad (wide) overscan as a lot of games lose stuff in their status bars off the sides of the screen so maybe I'm overthinking this. If you're using a modern TV and some sort of HDMI-scaling box then these tend to show you the entire picture too! If I could at least use a 30x24 text area then that would be great as it would match the aspect ratio of the graphics plotting area. It would be 240x192 pixels and BBC BASIC expects a logical screen size of 1280x1024. It would mean dividing logical coordinates by 5⅓ to get the physical coordinates, but that's the same as multiplying by 48/256 (or 3/16) so not too tricky. My current approach is to use the entire 256 pixel width of the screen and divide logical coordinates by 5, which means some BBC Micro programs draw stuff just off the top edge of the screen. |
|