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 - My first try at programming the SMS

Reply to topic
Author Message
  • Joined: 01 Feb 2014
  • Posts: 878
Reply with quote
My first try at programming the SMS
Post Posted: Fri Mar 14, 2014 6:25 pm
Long time lurker, first time poster here. The Sega Master System is my favourite Console ever since my parents got me one for Christmas 1987 instead of the Atari 2600 that was actually on my wishlist (thanks, Mum and Dad).

I haven't written a line of code since learning Turbo Pascal in school some 20 years ago, though. So I thoroughly read through Maxim's tutorial (thanks for that) and, additionally, got two books off the Amazon Marketplace ("How to program the Z80" and "Z80 Assembly Language Programming") and went to work.

It would possibly have been smarter to start with a variation on "Hello World", but nevertheless, I'm actually pretty pleased with how my first program turned out (screenshot attached). The learning curve was pretty steep, but in the end I made the emulated SMS display my background graphics on the screen and move around an animated sprite.

The movement of the player sprite (which consists of 5 to 6 tiles, depending on the animation frame) seems a little jerky, though. I guess that's because I don't use a buffer copy of the sprite table in RAM and writing directly to the VDP is too slow for smooth movement.

I definitely have a lot to learn still, but so far it's really fun.
myfirstsmsprogram.png (4.81 KB)
Screenshot of my first SMS program running in Emulitious
myfirstsmsprogram.png

  View user's profile Send private message
  • Joined: 06 Apr 2011
  • Posts: 250
  • Location: Netherlands
Reply with quote
Post Posted: Fri Mar 14, 2014 6:56 pm
Look promising.

Nice graphics. Did you make them yourself?
  View user's profile Send private message
  • Joined: 17 Sep 2013
  • Posts: 140
  • Location: TC, MI
Reply with quote
Post Posted: Fri Mar 14, 2014 8:14 pm
First program my butt! That is gorgeous!
  View user's profile Send private message Visit poster's website
  • Joined: 21 Jul 2005
  • Posts: 412
  • Location: GBG
Reply with quote
Post Posted: Fri Mar 14, 2014 8:41 pm
Really nice remake of the graphics from Bruce Lee) =)
  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 14745
  • Location: London
Reply with quote
Post Posted: Fri Mar 14, 2014 8:44 pm
If you're updating six sprites, there should be plenty of time in the VBlank. However, blasting a copy of the sprite table from RAM to VRAM is more common.

It's also the case for most games that they store the main sprite graphics uncompressed in ROM, and instead of updating the tile indices for animation, write into the tiles themselves for each frame. That's a lot more data, but it allows you to have many more frames of animation. You still have to update the sprite coordinates, of course.
  View user's profile Send private message Visit poster's website
  • Joined: 08 Dec 2013
  • Posts: 200
Reply with quote
Post Posted: Fri Mar 14, 2014 10:55 pm
This is what Sonic 1 does. Because the spirte only uses the first 8 colours the third byte of a tile row will always be 0, so this is excluded from the data to compress it ever so slightly.
  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 08 Jul 2001
  • Posts: 8652
  • Location: Paris, France
Reply with quote
Post Posted: Fri Mar 14, 2014 11:38 pm
The art is beautiful.
  View user's profile Send private message Visit poster's website
  • Joined: 01 Feb 2014
  • Posts: 878
Reply with quote
Post Posted: Sat Mar 15, 2014 9:58 am
Maxim wrote
If you're updating six sprites, there should be plenty of time in the VBlank. However, blasting a copy of the sprite table from RAM to VRAM is more common.

It's also the case for most games that they store the main sprite graphics uncompressed in ROM, and instead of updating the tile indices for animation, write into the tiles themselves for each frame. That's a lot more data, but it allows you to have many more frames of animation. You still have to update the sprite coordinates, of course.

That's what I'm doing, actually. I figured that if I wanted to have three objects with up to six tiles each on screen at the same time, I'd have to treat two of them this way, because otherwise it would be impossible to store all the frames of animation. Each walking cycle alone has six frames.

Anyway, I found out what caused the jerkiness. It was actually me accidently tying the sprite table writes to the animation frames updates. So the movement was calculated correctly all along, but it was only displayed whenever I loaded a new animation frame. A silly mistake, really.

I got the sprites moving and animating smoothly now. When I change direction, though, there's occasionally a single frame where I've got the old tiles in the new spots. I think I'll have to check again which stuff is updated in which order.



Zipper wrote
Nice graphics. Did you make them yourself?

FluBBa wrote
Really nice remake of the graphics from Bruce Lee) =)

Bock wrote
The art is beautiful.

Thanks a lot.

Yes, I did make the graphics myself. Other than with assembly language I do have some experience here, though. In fact, a couple of years ago I did pixel art for a living. (Google "Gem Jam Fever" and you'll find screenshots of a voodoo-themed Columns clone for cellphones I have worked on.)

Working with the Master System's palette is not easy, as it contains many colours that are very similar to each other and it's tough to create a coherent atmosphere and not end up with too many garish colours on screen. If you apply a little colour psychology, though, you can do some neat stuff with putting logically "wrong" colours in the right places (like the purple on the mountain tops or the green edges on the bull-pig-statue thing).

Of course working within limitations is always a fun challenge. :-)

The screen layout is actually based on the Spectrum version of Bruce Lee, which I chose because it has the same screen resolution as the Master System and, well, I like the game and its madcap setting.



By the way, if someone's project is an artist short, I might be willing to help out, provided the project interests me and I have the spare time needed to do it. Just ask.
  View user's profile Send private message
  • Joined: 16 May 2002
  • Posts: 1356
  • Location: italy
Reply with quote
Post Posted: Sat Mar 15, 2014 12:01 pm
The art looks very good indeed!
  View user's profile Send private message Visit poster's website
  • Joined: 31 Oct 2007
  • Posts: 853
  • Location: Estonia, Rapla city
Reply with quote
Post Posted: Sun Mar 16, 2014 2:05 pm
Whoa, that screenshot is absolutely beautiful !
  View user's profile Send private message Visit poster's website
Revo
  • Guest
Reply with quote
Post Posted: Sun Mar 16, 2014 7:21 pm
Really nice job Kagesan.

Are you submiting the game for the competition end of the month?

Cheers.
 
  • Joined: 05 Sep 2013
  • Posts: 3828
  • Location: Stockholm, Sweden
Reply with quote
Post Posted: Sun Mar 16, 2014 10:50 pm
Looks very nice!
If you need music and SFX in the game you could try my PSGlib, of course I will give you support :)
  View user's profile Send private message Visit poster's website
  • Joined: 25 Feb 2006
  • Posts: 874
  • Location: Belo Horizonte, MG, Brazil
Reply with quote
Post Posted: Sun Mar 16, 2014 11:35 pm
Looking good, so far. Can't wait to see it in action! ;)
  View user's profile Send private message Visit poster's website
  • Joined: 01 Feb 2014
  • Posts: 878
Reply with quote
Post Posted: Mon Mar 17, 2014 5:49 pm
Revo wrote
Are you submiting the game for the competition end of the month?

I don't know. Maybe if I get the basic moves set of the player sprite or at the very least the logic map fully up and running before the deadline. As of yet, I don't really feel my contribution is up to scratch.

sverx wrote
If you need music and SFX in the game you could try my PSGlib, of course I will give you support :)

I have actually followed the development of your PSGlib very closely, and I think you've done some awesome work there. I'm still far from adding sound to my "game", but when it comes to that, it's very likely that I'm going to want to use PSGlib.

However, with the help of mod2psg I do have already composed a short track I plan to use as an ingame tune somewhere along the line. Maybe I'll submit that one for the music competition.
  View user's profile Send private message
  • Joined: 05 Sep 2013
  • Posts: 3828
  • Location: Stockholm, Sweden
Reply with quote
Post Posted: Tue Mar 18, 2014 8:45 am
Kagesan wrote
I have actually followed the development of your PSGlib very closely, and I think you've done some awesome work there.


Yeah, if only I could make it work ;D
  View user's profile Send private message Visit poster's website
  • Joined: 11 Mar 2014
  • Posts: 91
  • Location: France
Reply with quote
Post Posted: Tue Mar 18, 2014 6:38 pm
Kagesan wrote

The screen layout is actually based on the Spectrum version of Bruce Lee, which I chose because it has the same screen resolution as the Master System and, well, I like the game and its madcap setting.


I just wanted to say that I love your artstyle and I really hope you can complete this game. The SMS needs more Bruce Lee!
  View user's profile Send private message
Reply to topic



Back to the top of this page

Back to SMS Power!