TheDevil'sCompass Posted January 22, 2022 Share Posted January 22, 2022 Instead of working on the dozen or so projects that I have started, I decided the other day to delve into SecondBASIC programming for the Genesis. For those that don't know SecondBASIC http://www.sbasic.net/ is a BASIC language developed by Second Dimension. It is in active development and appears to be fairly robust. My biggest gripe is that there are virtually no programming examples for it. Commands are documented and a few code snippets come with the development environment but that's about it. I decided to help rectify this situation by writing a simple Snake game and commenting the hell out of it. The game uses the text functions only (i.e. no shape tiles) and has two very simple sounds. I've tested it with the Fusion 3.64 emulator and everything appears to work as intended. I can't seem to find my flash cart so if someone could test it on real hardware that would be much appreciated. While coding the game I did run into a couple of things. First, I did not see any mention of multi-dimensional arrays on the SecondBASIC site although they are supported. I did only test with 2 dimensional arrays, however. Second, I had to use another program to fix the checksum on the binary. Otherwise, fusion would throw up a checksum error whenever I tested the binary. I ended up using Fix Checksum https://www.romhacking.net/utilities/342/ to correct it. Third, at one point during coding I tried to do an animated spinner using the string: "\|/-" to no avail. Older guys will recognize this as a cursor used by many on the Apple II and C64. Not that big of a deal that it didn't work but I did find it a little odd. I believe the "\" is used by SecondBASIC to denote something, possibly "\n" for newline, etc. Even when I tried to build the string using chr$, it failed to work. Fourth, the ASCII codes don't quite lineup with the text screen that I'm using. I tried using codes: 016,017,030,031 (4 arrows) to do the spinner and one of them kept displaying as a heart. At that point I decided the hell with it and didn't look any further into it. Lastly, the binary generated by SecondBASIC is always named sbasic.bin no matter what your project file is named. You have to manually go to the work folder and rename it if you want to keep a copy. Otherwise, it will be overwritten at the next compile. Attached is the rom file and the basic listing. I'm sure there are things that can be improved along with using actual shape tiles for the visuals. This is just a simple example to hopefully encourage others to take a look at this programming option for the Sega Genesis. Feel free to tinker around with it and see what you can do. Controls are simple (up, down, left, right). Skill level can be chosen at the title screen by pressing left or right. It's a basic Snake game, eat the dot and avoid hitting the walls or yourself. Once you reach 100 points, obstacles will appear in the playfield to make things tougher. Have fun. Snake.bas snake.bin 2 Quote Link to comment Share on other sites More sharing options...
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.