Snake in 260 bytes for MD
Moderator: Mask of Destiny
Snake in 260 bytes for MD
Hi guys - like snkenjoi and andlabs before me, I'm also from Sonic Retro. =P
I read through snkenjoi's thread on the smallest useful MD ROM and also TascoDLX's Megadrive demo, both of which inspired me to see if I could make some sort of simple game within the 260-byte TMSS limit that still worked on all MD models (note: this is untested on real hardware, but it works on all emulators, even Fusion with the TMSS bios).
The game pretty much plays like a basic Snake clone (collect food to grow bigger, if you hit yourself or the edges of the stage you die). There is no sound in this demo (not enough space ). It doesn't really look very pretty, but I guess that's to be expected.
ROM link.
Known issues are that when you get a food piece, a grey 8x8 tile appears in the top-left corner for a split second, and the controls aren't really as responsive as I'd have liked them to be. However, the game is still very playable.
I'll release the source after I comment it fully. If you're really impatient, you could try disassembling it or something. =P
If you seriously want a screenshot before downloading, behold:
I read through snkenjoi's thread on the smallest useful MD ROM and also TascoDLX's Megadrive demo, both of which inspired me to see if I could make some sort of simple game within the 260-byte TMSS limit that still worked on all MD models (note: this is untested on real hardware, but it works on all emulators, even Fusion with the TMSS bios).
The game pretty much plays like a basic Snake clone (collect food to grow bigger, if you hit yourself or the edges of the stage you die). There is no sound in this demo (not enough space ). It doesn't really look very pretty, but I guess that's to be expected.
ROM link.
Known issues are that when you get a food piece, a grey 8x8 tile appears in the top-left corner for a split second, and the controls aren't really as responsive as I'd have liked them to be. However, the game is still very playable.
I'll release the source after I comment it fully. If you're really impatient, you could try disassembling it or something. =P
If you seriously want a screenshot before downloading, behold:
This is good, though I think you could fit much more in 260 bytes.
The smallest possible Snake game was my obsession some time ago, I wanted to make it into 128 bytes or less. I've made 256 bytes version for ZX Spectrum with sound effects and restarting after game over (it was easily possible to make it smaller without sound, but it would be far from 128 bytes anyway), and few versions for 8086 PC without sound, but with restarting (it was 189 bytes or so). The most smallest Snake implementations I know is 144 bytes for 8086 PC and 121 byte for ZX Spectrum (written in FP calculator code).
The smallest possible Snake game was my obsession some time ago, I wanted to make it into 128 bytes or less. I've made 256 bytes version for ZX Spectrum with sound effects and restarting after game over (it was easily possible to make it smaller without sound, but it would be far from 128 bytes anyway), and few versions for 8086 PC without sound, but with restarting (it was 189 bytes or so). The most smallest Snake implementations I know is 144 bytes for 8086 PC and 121 byte for ZX Spectrum (written in FP calculator code).
-
- Very interested
- Posts: 145
- Joined: Sun Jan 28, 2007 2:01 am
- Location: DCEvolution.net
- Contact:
-
- Very interested
- Posts: 2440
- Joined: Tue Dec 05, 2006 1:37 pm
- Location: Estonia, Rapla City
- Contact:
Problem with 68K is that your typical opcode takes minimally 2 bytes, and lot of them take 4 or more bytes. Z80, 8080 and other 8bit CPUs have things in 1 or 2 bytes usually so you can have much more in same space.
Anyway, this is nice
Anyway, this is nice
Mida sa loed ? Nagunii aru ei saa
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen
-
- Very interested
- Posts: 159
- Joined: Sat Feb 24, 2007 11:35 pm
- Location: San Antonio, TX
An even bigger problem is that the word "SEGA" has to be located at $0100. Thus, no TMSS-compatible ROM can be less than 260 bytes.
Beyond this, there is quite a bit of overhead just to get it to start up: 8 bytes for initial A7 and PC, 4 bytes for "SEGA", and 20 bytes for handling TMSS. But loading A0 saves 4 bytes later, so that's really 8 + 4 + 16 = 28 bytes, before you can do anything useful.
Then the VDP has to be set up, taking 12 more bytes just to set the registers, then you have to clear VRAM, then you have to set up the joypad (but I don't see it storing $40 to set up the control port).
So you can't directly compare the size of this against the size something where the hardware has already been initialized for you.
Beyond this, there is quite a bit of overhead just to get it to start up: 8 bytes for initial A7 and PC, 4 bytes for "SEGA", and 20 bytes for handling TMSS. But loading A0 saves 4 bytes later, so that's really 8 + 4 + 16 = 28 bytes, before you can do anything useful.
Then the VDP has to be set up, taking 12 more bytes just to set the registers, then you have to clear VRAM, then you have to set up the joypad (but I don't see it storing $40 to set up the control port).
So you can't directly compare the size of this against the size something where the hardware has already been initialized for you.
Where can i download a donkey kong country rom that doesn't lag? i want to download a donkey kong country rom (first one) to play with my super nintendo emulator but everytime i download one it lags...where can i download one that i can play at normal game speed and doesn't lag.
_____________________
market samurai ~ marketsamurai ~ marketsamurai.com
_____________________
market samurai ~ marketsamurai ~ marketsamurai.com
Last edited by jeanetti on Sat Nov 07, 2009 9:46 am, edited 1 time in total.
Back on topic...
For those of us unencumbered by TMSS, I wonder what the smallest possible version of this would be. I've got a TMSS-less Gen1 with my trusty SMD so I could test to make sure it works on real hardware. Based on 8bitwizard's post, I see a minimum of 24 bytes that can be discarded (since you don't have to handle TMSS) but I'm wondering if one could abuse the header area (since there are no restrictions on executing code between $0-$1FF AFAIK, even on TMSS MDs). I bet you could get a TMSS-less version of this comparable to other systems (I would guess 160-192 bytes given the differences in instruction set).
For those of us unencumbered by TMSS, I wonder what the smallest possible version of this would be. I've got a TMSS-less Gen1 with my trusty SMD so I could test to make sure it works on real hardware. Based on 8bitwizard's post, I see a minimum of 24 bytes that can be discarded (since you don't have to handle TMSS) but I'm wondering if one could abuse the header area (since there are no restrictions on executing code between $0-$1FF AFAIK, even on TMSS MDs). I bet you could get a TMSS-less version of this comparable to other systems (I would guess 160-192 bytes given the differences in instruction set).