BasiEgaXorz
From Sega Retro
BasiEgaXorz is a BASIC compiler for the Sega Genesis consoles made by DevPimp. That means, by using this compiler, you can program in a form of BASIC language to create awesome programs, or games for your old Sega Genesis game console. The compiler will also compile CD ISOs for the Sega CD attachment, ROMs that can use the features of the 32x extension, and not to mention, creating ROMs for the regular console without attachements. Today, when most programmers think of the BASIC language, they think about Visual Basic. The language BasiEgaXorz uses is not like Visual Basic, and it certianly wasn't derived from it. This compiler is aimed for speed, so there are many things that cannot be dynamic within the environment, everything is stayed static (like variables for example, no such thing as REDIM). BasiEgaXorz is intended for a beginner's platform in order to give an opportunity to make simple games easily.
Contents
Features
BasiEgaXorz language features:
- Support for both line numbered labels and just regular plain old labels
- User defined subroutines and functions
- Integer (16 bit), Long (32 bit), and String (limited 8 bit) data types
- Multiplication, division, addition, subtraction, bit shift, modulo, compare, and logical operator support
- A wide variety of string data type commands and functions
- Argunerics
- Do....Loop, For....Next, While....Wend looping
- Data storage using the classical BASIC Data statement approach
- Single dimension arrays for integer and long data types
BasiEgaXorz system implementation features:
- Full text displaying and color features withe the PRINT and INK commands
- User input using the INPUT command
- Background tile graphics (for both planes) and sprite graphics of the VDP supported
- Joypad functions included
- Pallette changing and loading commands are there
- Tile graphics changing and loading commands there too
- Limited tile mapping supported
- Background plane scrolling supported
- PSG sound effects support
Getting Started
Installation
Inside your Windows environment, un-zip the setup file somewhere and install. You'll now be able to use BasiEgaXorz.
Getting some code working
If you haven't done so already, make sure you've downloaded a Sega Genesis emulator that will run your compiled ROM. Without a way to test your program, the compiler is pretty useless =P. Here is some sample exercises and code samples for the begining coder.
Exercise 1: For a simple, working program, type in this line and run it (make sure there is a space, or tab before the word "print"):
print "Hello World!"
If you ran compiled the program, and have run it in an emulator, you would have seen that the screen showed Hello World! in big white text. The BASIC language uses commands that are issued to the compiler to tell what you want your program to do. What we have done is use the PRINT command, which simply displays text onto the screen. We always use a space, or tab in front of the command to tell the compiler that we are issuing it a command (if there were no space or tab, the compiler would think the line is a label, which will do nothing then).
Next, we insert a space after PRINT, and type in the first argument. In a compiler, an argument is a word, or a set of words that support the command in performing its function. Without arguments, PRINT couldn't do much, and couldn't display your set of words. We now type in "Hello World!" as our argument. As you can see when running the program, the output showed Hello World! on the screen, which is what was enclosed inside the quotes in the argument. The compiler will never make your program display the quotes, the quotes are there to help the compiler distinguish that you want to use a string of words instead of an expression inside the argument. Also, commands with arguments are called statements.
Exercise 2: This next program will then display two different phrases, but now in a different color:
ink 1 print "This is one line" print "...and this is the next!"
Here, we've used more than one command, compared to the previous exercise. You'll use a new line to specify a new command, or will use a colol (:) between statements. As shown, the INK command will switch text drawing colors between 4 different colors. The numerical argument that appears after INK specifies which color to use. A value of 0 will make text draw in white (white is the default color used if no INK command has changed colors), 1 draws in a light-blueish color, 2 draws in a bright green color, and 3 draws in purple. Text will be continued to be displayed in the color spcified by INK until another ink command is encountered, for example:
ink 3: print "This is one line" ink 2: print " ...ooooh in green!" ink 1: print " Now in cyan!"
This time, the statements are separated by a colon, which is almost the same as useing a new line for code.
Exercise 3: Now we'll get into more intermediate topics, and fly right into using variables. Variables are very useful because they can store data, like numbers, or sets af characters. We can manipulate variables in different ways, some variables we can use elementary arithmetic. We know we are using variables when we simply type in a word without quotes in our code for an argument. For now, we'll start out with using integers:
apples=123 print "If we have ";apples;" apples and then we eat" print "one apple, we'll have "; apples=apples-1 print apples;" left!"
In the first line of code, we are storing the number 123 into variable apples. We use an equals (=) sign to store whatever's in the expression on the right of the equals sign into the variable on the left side. The variable apples will always have a value of 123 until the variable is changed again.
So, what else can we do with variables besides store numbers in them? Well, we can recall variables back, and print them onto the screen, which is what we've done in the second line. The PRINT may be more complicated in this line that what you've already seen in the previous exercises. First, we will print a set of words on the screen inside the quotes. After we're done displaying what's inside the quotes, there's more stuff inside the argument to be displayed, so we'll display that. We use a semi-color (;) to separate different parts of what's being displayed. We do this because if we try to specify a variable inside quotes, it's not going to work because the compiler will literaly make your program display everything exectly what's inside those quotes, and will not take your variable to be a variable. To display the variable, we just simple type the name of our variable after the semi-colon, and it will be recognized as a variable. We'll want to display more text after the variable, so we use another semi-color, and then continue with using a set of words enclosed in quotes. Also, the semi-colon seperator will also ensure that whatever will be displayed next will display on the same line that's currently being displayed on, which is what the third line is emphasizing.
Now, we'll try to manipulate our variable, and subtract 1 from itself. The fourth line is a regular storing statement. First, on the right side of the equal sign, we'll recall our variable back, use the subtraction sign to subtract a number from the variable, and then we will specify a quantity to subtract from, which is 1. If we were to not include the variable name on the right side, it will act just like the first line of code in our code. We can also play around with the operations, and change it to addition, multiplication, and even division. We may also want to change the quantity of what operation we want to use by changing 1 to values like 2, 3, 4, etc. The expression can also be extended longer to include more operations, like: apples=apples*2+1 which will multiply the variable apples by a factor of 2, and then will add 1 to that result.
The fifth line will just display the modified variables apples, and then will display the last word of the sentence.
Changelog
2/20/2008 - v1.23 - BasiEgaXorz now uses the ASMX assembler! - Not everything has been tested 100% with this version, so if something is broken, report the bug, and revert back to version 1.20! 2/11/2008 - v1.20 - Fixed the READ, and READINT commands when using long variables. - Added support for arrays in the commands READ, READINT, READLONG, GETS - Fixed the GETS command to not declare integer or long variables that are very big - Improved the INPUT command to be more BASIC like - Added lower case letters to the INPUT command. Press the C button to switch between lower case letters and upper case - Fixed a major bug with storing data with the DATA command. - Fixed a bug with the Mid$ function, which was broke in v1.00 of the compiler - Fixed a compiler bug when opening a souce file that is in a completely different drive TODO -> Add the command DataStr - When a file has successfully compiled, the ending dialog will now show the time that was spent assembling the source with the SNASM assembler - Fixed the VarPtr&() Function to work with the newer array data types - Fixed expressions having the form: str$(val(a)+val(b)), str$(val(a)<>val(b)) TODO -> Print 1*65536 is broken - Fixed a major bug when declaring more than one sub or function
Downloads
Download BasiEgaXorz v1.23 (latest version, using the ASMX assembler) (1.52 MB) (info)
|