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 - Running BBC BASIC on the Sega Master System

Reply to topic
Author Message
  • Joined: 23 Jan 2010
  • Posts: 241
Reply with quote
Running BBC BASIC on the Sega Master System
Post Posted: Thu Dec 01, 2022 8:57 am
https://benryves.com/journal/3763166
Seems that our friend is with problems because our beloved SMS have 8KB of RAM. This project can be feasible with others SMS tools here? For games we have Maxim´s tutorial and sverx devkit in C.
I wonder if not would be better use a SC-3000 basic instead. OR BBC basic is much superior?
  View user's profile Send private message
  • Joined: 05 Sep 2013
  • Posts: 3318
  • Location: Torino, then London, now Stockholm
Reply with quote
Post Posted: Thu Dec 01, 2022 9:06 am
one could use a cartridge with 16 KiB of RAM and have that mapped at $8000 to get a total of 24 KiB contiguous memory...
  View user's profile Send private message Visit poster's website
  • Joined: 06 Mar 2022
  • Posts: 255
  • Location: London, UK
Reply with quote
Post Posted: Thu Dec 01, 2022 9:31 am
sverx wrote
one could use a cartridge with 16 KiB of RAM and have that mapped at $8000 to get a total of 24 KiB contiguous memory...

Yep or, depending on what we think the "rules" are, it should possible to design a cartridge which has more than 16K of RAM if necessary!
  View user's profile Send private message Visit poster's website
  • Joined: 25 Feb 2006
  • Posts: 781
  • Location: Belo Horizonte, MG, Brazil
Reply with quote
Post Posted: Thu Dec 01, 2022 3:28 pm
willbritton wrote
sverx wrote
one could use a cartridge with 16 KiB of RAM and have that mapped at $8000 to get a total of 24 KiB contiguous memory...

Yep or, depending on what we think the "rules" are, it should possible to design a cartridge which has more than 16K of RAM if necessary!


Yes, if you don't mind using a custom mapper, you could have 64K of contiguous RAM at your disposal.
  View user's profile Send private message Visit poster's website
  • Joined: 05 Sep 2013
  • Posts: 3318
  • Location: Torino, then London, now Stockholm
Reply with quote
Post Posted: Thu Dec 01, 2022 5:02 pm
well I just meant by simply using an EverDrive or similar, but of course with custom hardware everything is possible! :)
  View user's profile Send private message Visit poster's website
  • Joined: 23 Jan 2010
  • Posts: 241
Reply with quote
Post Posted: Thu Dec 01, 2022 6:13 pm
sverx wrote
well I just meant by simply using an EverDrive or similar, but of course with custom hardware everything is possible! :)

Ah! I was thinking about this. An everdrive wouldnt be better, considering that have a SD card for save basic projects?
BTW i dream with a basic. I could program a game that i like. It is so simple but funny.

Qbasic gorillas could even be used in your devkit in C. Moreover it also could be played online with NET80´s from ruibjr.
  View user's profile Send private message
  • Joined: 06 Mar 2022
  • Posts: 255
  • Location: London, UK
Reply with quote
Post Posted: Thu Dec 01, 2022 6:50 pm
Oh funny, I was thinking about QBasic Gorillas just the other day!

But I was wondering how it handled the physics of explosions - is it on a per pixel level? If so, might be kind of tricky on the VDP...
  View user's profile Send private message Visit poster's website
  • Joined: 23 Jan 2010
  • Posts: 241
Reply with quote
Post Posted: Thu Dec 01, 2022 8:01 pm
willbritton wrote
Oh funny, I was thinking about QBasic Gorillas just the other day!

But I was wondering how it handled the physics of explosions - is it on a per pixel level? If so, might be kind of tricky on the VDP...

In fact. There is a intellivision port but the results are not exciting:

Who knows what the smspower gurus could achieve?
But would be interesting.
  View user's profile Send private message
  • Joined: 05 Sep 2013
  • Posts: 3318
  • Location: Torino, then London, now Stockholm
Reply with quote
Post Posted: Thu Dec 01, 2022 8:35 pm
willbritton wrote
But I was wondering how it handled the physics of explosions - is it on a per pixel level? If so, might be kind of tricky on the VDP...


fullscreen BMP mode at 2bpp is possible...
  View user's profile Send private message Visit poster's website
  • Joined: 06 Mar 2022
  • Posts: 255
  • Location: London, UK
Reply with quote
Post Posted: Thu Dec 01, 2022 9:00 pm
sverx wrote
fullscreen BMP mode at 2bpp is possible...

You mean mode 2? I completely forgot about that!

Actually thinking about it, it's probably possible to do it with mode 4 as about half the screen is solid sky, and that should leave enough character space left to map one character per tile map slot for the buildings, then when the banana hits you just redefine some characters.

EDIT: hmm...coding competition coming up in a few months :thinking: haha
  View user's profile Send private message Visit poster's website
  • Joined: 23 Jan 2010
  • Posts: 241
Reply with quote
Post Posted: Fri Dec 02, 2022 12:15 am
sverx wrote
willbritton wrote
But I was wondering how it handled the physics of explosions - is it on a per pixel level? If so, might be kind of tricky on the VDP...


fullscreen BMP mode at 2bpp is possible...

@sverx, Lemmings not could be a parameter of those explosions? I mean @willbriton couldnt use the same principle?

Quote
EDIT: hmm...coding competition coming up in a few months :thinking: haha

Please do it! Born a new sms dev!
  View user's profile Send private message
  • Joined: 14 Aug 2000
  • Posts: 708
  • Location: Adelaide, Australia
Reply with quote
Running BBC BASIC on the Sega Master System
Post Posted: Fri Dec 02, 2022 4:22 am
As well as 16KB at 0x8000 to 0xBFFF (with system DRAM giving a total of 24KB RAM) the standard Sega mapper also supports 32KB at 0x8000 to 0x0xFFFF using the 0xFFFC register.

Disable system DRAM using I/O Port 0x3E for that though.
  View user's profile Send private message
  • Joined: 05 Sep 2013
  • Posts: 3318
  • Location: Torino, then London, now Stockholm
Reply with quote
Post Posted: Fri Dec 02, 2022 8:28 am
willbritton wrote
sverx wrote
fullscreen BMP mode at 2bpp is possible...

You mean mode 2? I completely forgot about that!


no, I meant 4-colors full screen image by reusing the BG tiles twice exploiting the dual palette in Mode 4 like this or this.

Quote
the standard Sega mapper also supports 32KB at 0x8000 to 0x0xFFFF using the 0xFFFC register.
Disable system DRAM using I/O Port 0x3E for that though.


But does this work on the EverDrive?
  View user's profile Send private message Visit poster's website
  • Joined: 06 Mar 2022
  • Posts: 255
  • Location: London, UK
Reply with quote
Post Posted: Fri Dec 02, 2022 9:18 am
sverx wrote
no, I meant 4-colors full screen image by reusing the BG tiles twice exploiting the dual palette in Mode 4 like this or this.

Oh, I get it! That's really sneaky, I love it!

EDIT: could you expand the colours by doing a quick palette swaps on hblank interrupts?
  View user's profile Send private message Visit poster's website
  • Joined: 25 Feb 2013
  • Posts: 357
  • Location: Osaka
Reply with quote
Post Posted: Fri Dec 02, 2022 9:53 am
This is also very interesting
  View user's profile Send private message
  • Joined: 06 Mar 2022
  • Posts: 255
  • Location: London, UK
Reply with quote
Post Posted: Fri Dec 02, 2022 10:07 am
kamillebidan wrote
This is also very interesting

Oh that is very interesting - nice find!
  View user's profile Send private message Visit poster's website
  • Joined: 23 Jan 2010
  • Posts: 241
Reply with quote
Post Posted: Thu Dec 08, 2022 9:40 pm
@willbriton i discovered today that my everdrive have 2 basic versions from SC-3000 definitely im excited in try a SC-3000 qbasic gorillas version. I saw the DOS qbasic gorillas source code and it have some commands similar at SC-3000 basic like Paint and Circle. Those commands are important for create the background and explosions for game. Much of game is based in coordinates. The problem is the SMS dont have a keyboard. You think that a PC keyboard could be adapted? How i could do it? You is interessed even in code your Qbasic gorillas version?
  View user's profile Send private message
  • Joined: 25 Feb 2006
  • Posts: 781
  • Location: Belo Horizonte, MG, Brazil
Reply with quote
Post Posted: Fri Dec 09, 2022 12:04 am
Well, if you don't care about keeping hardware compatibility with the SC3000 keyboard, then maybe you could create an adapter to connect an IBM PS2 keyboard to the SMS joystick port, and bit bang the protocol.

I do remember seeing somewhere that someone managed to bit bang the IBM PS2 keyboard protocol from the Game Boy's communication port; with ASM source code and everything.
  View user's profile Send private message Visit poster's website
  • Joined: 23 Jan 2010
  • Posts: 241
Reply with quote
Post Posted: Fri Dec 09, 2022 8:35 am
haroldoop wrote
Well, if you don't care about keeping hardware compatibility with the SC3000 keyboard, then maybe you could create an adapter to connect an IBM PS2 keyboard to the SMS joystick port, and bit bang the protocol.

I do remember seeing somewhere that someone managed to bit bang the IBM PS2 keyboard protocol from the Game Boy's communication port; with ASM source code and everything.

Hi friend. I dont imagined that would be complicated. I was thinking that could only be a case of wire db9 with PC cable.
Rapaz, é tão complicado assim? Pensei que era apenas soldar um Db9 no cabo de PC. Não imaginei que precisava criar um aplicativo para rodar. Se eu fizer o jogo em um emulador do SC-3000, você acha que roda no Master?
  View user's profile Send private message
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 14274
  • Location: London
Reply with quote
Post Posted: Fri Dec 09, 2022 8:51 am
Isn’t all this exactly what Ben Ryves already did?
  View user's profile Send private message Visit poster's website
  • Joined: 23 Jan 2010
  • Posts: 241
Reply with quote
Post Posted: Fri Dec 09, 2022 11:52 am
Maxim wrote
Isn’t all this exactly what Ben Ryves already did?

Hi friend, I saw the statment in site:

For the software side of things I adapted my Emerson AT device library, previously written for the TI-83 Plus calculators, to the Sega Master System hardware. This library handles the low-level AT device protocol and also translates the raw keyboard scancode values to the corresponding characters.


The problem is i dont found in any place in site the software adapted for SMS. The link just show the previous adaptation for TI-83.
https://benryves.com/projects/emerson
  View user's profile Send private message
  • Joined: 25 Feb 2006
  • Posts: 781
  • Location: Belo Horizonte, MG, Brazil
Reply with quote
Post Posted: Fri Dec 09, 2022 12:07 pm
As an alternative, if all you want is a BASIC interpreter, there exists a BASIC interpreter for the GB, with full ASM source code; that one is fully joypad driven; no keyboard required. Or you could add on-screen joypad driven keyboard to BBC BASIC.
  View user's profile Send private message Visit poster's website
  • Joined: 25 Feb 2006
  • Posts: 781
  • Location: Belo Horizonte, MG, Brazil
Reply with quote
Post Posted: Fri Dec 09, 2022 1:17 pm
segarule wrote
Se eu fizer o jogo em um emulador do SC-3000, você acha que roda no Master?

In theory, if the interpreter is compatible, and no hardware-specific routines are used, then it would be possible to write the game on the SC-3000 and then run it on a compatible interpreter on the SMS.
  View user's profile Send private message Visit poster's website
  • Joined: 06 Mar 2022
  • Posts: 255
  • Location: London, UK
Reply with quote
Post Posted: Fri Dec 09, 2022 3:51 pm
segarule wrote
@willbriton i discovered today that my everdrive have 2 basic versions from SC-3000 definitely im excited in try a SC-3000 qbasic gorillas version. I saw the DOS qbasic gorillas source code and it have some commands similar at SC-3000 basic like Paint and Circle. Those commands are important for create the background and explosions for game. Much of game is based in coordinates. The problem is the SMS dont have a keyboard. You think that a PC keyboard could be adapted? How i could do it? You is interessed even in code your Qbasic gorillas version?

I think I'd imagined just rewriting Gorillas "natively" for the SMS in either assembler or C, and I'm still thinking about it.

Trying to make the original BASIC code work does sound like an ambitious and interesting challenge though. I don't personally see the input mechanism as a deal breaker, I reckon if it were me I'd adapt it to use a joypad. It's all numbers anyway right? You could even overload the INPUT keyword so that it triggers interactive character selection via joypad rather than keyboard input.

The graphics is definitely the tricky bit, because of aforementioned lack of first class bitmap mode, but also because the original resolution was I believe the 640x200 mode so you'd have to think about whether or not you can get it to scale nicely.
  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 14274
  • Location: London
Reply with quote
Post Posted: Fri Dec 09, 2022 9:28 pm
Portability of BASIC between dialects is pretty much impossible.

Ben Ryves’ work is here: https://github.com/benryves/BBCBasicSMS but there’s more to it than just a ROM download.
  View user's profile Send private message Visit poster's website
  • Joined: 23 Jan 2010
  • Posts: 241
Reply with quote
Post Posted: Fri Dec 09, 2022 10:28 pm
Quote
I think I'd imagined just rewriting Gorillas "natively" for the SMS in either assembler or C, and I'm still thinking about it.

Trying to make the original BASIC code work does sound like an ambitious and interesting challenge though. I don't personally see the input mechanism as a deal breaker, I reckon if it were me I'd adapt it to use a joypad. It's all numbers anyway right? You could even overload the INPUT keyword so that it triggers interactive character selection via joypad rather than keyboard input.

The graphics is definitely the tricky bit, because of aforementioned lack of first class bitmap mode, but also because the original resolution was I believe the 640x200 mode so you'd have to think about whether or not you can get it to scale nicely.

Thanks for all your technical information friend. I will give up and i will wait your Qbasic gorillas version much better than i already saw.

Quote
Portability of BASIC between dialects is pretty much impossible.

Ben Ryves’ work is here: https://github.com/benryves/BBCBasicSMS but there’s more to it than just a ROM download.

Thanks for help me in this project, friend but a noob like me need of easy tools for start with.
  View user's profile Send private message
Reply to topic



Back to the top of this page

Back to SMS Power!