BasiEg BasiEgaXo aXorz rz - Sega Sega Genes Genesis is BASIC BASIC Compi Compiler ler - v1.3 v1.37 7 Docume Documenta ntatio tion n
http:/ http://de /devst vster er.mo .monkee nkeeh.c h.com/ om/se sega/ ga/bas basieg iegaxo axorz/ rz/bas basieg iegaxo axorz_ rz_full full.ht .html ml
BasiEgaXorz v1.37 Documentation
Sega Genesis Tiny BASIC Compiler
Author: DevSter (Joseph Norman) http://devster.monkeeh.com "Programming for the Sega Genesis is now as easy as jacking your grandmother's stash of porn" - Bobo Gates
For a possible newer version of this document, visit http://devster.monkeeh.com/sega/basiegaxorz/ Index Introduction Document Syntax BASIC Command Set / In ABC Order Sega CD Specific Commands BASIC Function Set / In ABC Order Operators Immediate Operators Data Types Arrays and Multi-Dimensional Arrays Argunerics User-Defined Functions and Subroutines Advanced Techniques Sines/Cosines Interrupters Assembly Language in BASIC User-Defined Assembly Language Language Functions and Subroutines Low-Level Video Setup Programming for the 32X Extension Ono I live in teh Zimbabwe, USA cd's dun works on meh Sega CD! Downloads - YIPEE History OMG This document is lame and the authot can't speak english, help me! Known Bugs Contacts Credits Disclaimer Introduction Basiegaxorz is a BASIC compiler for the Sega Genesis. This compiler is aimed for speed, so there are many (all) things that cannot be dynamic, everything ever ything is static. Line L ine labels are supported suppor ted too - yay.
Document Syntax Expression - A listing of values. Ex: 1+2+3=5, a=4, q<>4+5, etc. Statement, Command, Instruction - They are these: Commands. All commands have to have a space in front of them, unless they are followed by a label. Label - A marking that marks the line. All labels cannot have a space in front of them ! Variable - Integer/String, you name it
If arguments enclosed in < > in thi s document, then that argument is not optional. Op tional arguments are enclosed in [ ]. Commands Note:: All commands have to have a s pace/tab in front Note PRINT CLS GOTO FOR....NEXT DIM IF....ELSE....ENDIF SLEEP DATA DATAINT DATALONG DATAFILE READ READINT READLONG RELOAD
BasiEg BasiEgaXo aXorz rz - Sega Sega Genes Genesis is BASIC BASIC Compi Compiler ler - v1.3 v1.37 7 Docume Documenta ntatio tion n
RESTORE WHILE....WEND END LOCATE GOSUB RETURN ON
ENABLE DISABLE SHLINK INK LOADTILES DRAWTILE DRAWTILES PROPSPRITE MOVESPRITE FREESPRITE HIDESPRITE PALETTE SCROLL SHIFTSPRITE RANDOMIZE OPTION POKE POKEINT POKELONG BRIGHTEN DARKEN HBLANK PALETTES ASM LIBRARY CALL PSG PSGVOL HALT VALT DALT TRAPCPU INPUT WAITPADUP BGCOLOR FREEALLSPRITES SETTEXTPLANE SETGFXPLANE WINDOWPROP PUTS SCROLL2 SETSCROLLMODE SETSCROLLPLANE CONTINUE WHILE CONTINUE FOR EXIT WHILE EXIT FOR RegMove.B RegMove.W RegMove.L Gets Sleep2 TVSet Fake VdpRamWrite MemCopy FastTileCopy DrawTilesOvr DrawTilesInc Const Include Write WriteInt WriteLong WriteP DIM xxx AT xxx VidMode LoadFont WaitRaster TileOrg VIData VIDataInt VIDataLong VIDataFile
Commands in Alphabetical Order
http:/ http://de /devst vster er.mo .monkee nkeeh.c h.com/ om/se sega/ ga/bas basieg iegaxo axorz/ rz/bas basieg iegaxo axorz_ rz_full full.ht .html ml
BasiEg BasiEgaXo aXorz rz - Sega Sega Genes Genesis is BASIC BASIC Compi Compiler ler - v1.3 v1.37 7 Docume Documenta ntatio tion n
RESTORE WHILE....WEND END LOCATE GOSUB RETURN ON ENABLE DISABLE SHLINK INK LOADTILES DRAWTILE DRAWTILES PROPSPRITE MOVESPRITE FREESPRITE HIDESPRITE PALETTE SCROLL SHIFTSPRITE RANDOMIZE OPTION POKE POKEINT POKELONG BRIGHTEN DARKEN HBLANK PALETTES ASM LIBRARY CALL PSG PSGVOL HALT VALT DALT TRAPCPU INPUT WAITPADUP BGCOLOR FREEALLSPRITES SETTEXTPLANE SETGFXPLANE WINDOWPROP PUTS SCROLL2 SETSCROLLMODE SETSCROLLPLANE CONTINUE WHILE CONTINUE FOR EXIT WHILE EXIT FOR RegMove.B RegMove.W RegMove.L Gets Sleep2 TVSet Fake VdpRamWrite MemCopy FastTileCopy DrawTilesOvr DrawTilesInc Const Include Write WriteInt WriteLong WriteP DIM xxx AT xxx VidMode LoadFont WaitRaster TileOrg VIData VIDataInt VIDataLong VIDataFile
Commands in Alphabetical Order
http:/ http://de /devst vster er.mo .monkee nkeeh.c h.com/ om/se sega/ ga/bas basieg iegaxo axorz/ rz/bas basieg iegaxo axorz_ rz_full full.ht .html ml
BasiEg BasiEgaXo aXorz rz - Sega Sega Genes Genesis is BASIC BASIC Compi Compiler ler - v1.3 v1.37 7 Docume Documenta ntatio tion n
Note:: All commands have to have a s pace/tab in front Note ASM BGCOLOR BRIGHTEN CALL CLS CONST CONTINUE WHILE CONTINUE FOR DALT DARKEN DATA DATAFILE DATAINT DATALONG DIM DIM xxx AT xxx DISABLE DRAWTILE DRAWTILES DRAWTILESINC DRAWTILESOVR ENABLE END EXIT WHILE EXIT FOR FAKE FASTTILECOPY FOR....NEXT FREEALLSPRITES FREESPRITE GETS GLOBAL GOSUB GOTO HALT HBLANK HIDESPRITE IF....ELSE....ENDIF INCLUDE INK INPUT LIBRARY LOADFONT LOCAL LOCATE LOADTILES MEMCOPY MOVESPRITE ON OPTION PALETTE PALETTES POKE POKEINT POKELONG PRINT PROPSPRITE PSG PSGVOL PUTS RANDOMIZE READ READINT READLONG REGMOVE.B REGMOVE.W REGMOVE.L RELOAD RESTORE RETURN SCROLL SCROLL2 SETGFXPLANE SETSCROLLMODE SETSCROLLPLANE SETTEXTPLANE SHIFTSPRITE SHLINK SLEEP SLEEP2 TileOrg TRAPCPU
http:/ http://de /devst vster er.mo .monkee nkeeh.c h.com/ om/se sega/ ga/bas basieg iegaxo axorz/ rz/bas basieg iegaxo axorz_ rz_full full.ht .html ml
BasiEgaXorz - Sega Genesis BASIC Compiler - v1.37 Documentation
http://devster.monkeeh.com/sega/basiegaxorz/basiegaxorz_full.html
TVSET VALT VDPRAMWRITE VIDMODE VIData VIDataInt VIDataLong VIDataFile WAITPADUP WaitRaster WHILE....WEND WINDOWPROP WRITE WRITEINT WRITELONG WRITEP
Command_PRINT: Syntax: Print ,,...... Description:Prints characters onto the screen. If a comma (,) is encountered, then a tab is placed. If a semi colon is encountered, then leading characters will be directly displayed appended to the last. Back to the ABC Command Index Command_CLS: Syntax: Cls Description: Clears the frickin screen Back to the ABC Command Index Command_GOTO: Syntax:Goto Description: Jumps to Back to the ABC Command Index Command_FOR: Command_NEXT: Syntax: For = to [step ] ....Commands ....Commands Next
Description: Creates a loop by putting an initial value into , and then incremen ting it by the step (is step is not specified, then 1 is used) until it reaches the value in . Expressions are not calculated during run-time! Expressions are first calculated when the For command if first identified, and the value is then stored into memory. DO NOT use a Goto command to jump outside of the For....Next loop! Only u se goto's to jump to a label inside the loop. For....Next counts are not checked, so if you forget a Next statement, you're program's gonna crash and burn.
Back to the ABC Command Index Command_DIM: Syntax: Dim (Dimmensions) As [* ], (Dimmensions) As [* ], ...
Description: Dimensions a variable. There are three main data types: Integer, Long, and String. Integers are used for real numbers that are 16 bits wide (representing numbers -32768 to 65535). Integers have a % suffix (ommiting the suffix on a variable makes the compiler assume the variable is integer though). Long variables are used for much bigger numbers, and always need to have an & suffix! Strings are used to hold words, or a string of characters, and have to have a $ suffix. The size of strings can be specified by including the number of bytes of the string after STRING with a * .
Newer versions of BasiEgaXorz support multi-dimensional arrays. To specifiy dimensions f or your array, enclose the dimensio ns of your array in between ( a n d ) after the variable name. For advanced users, there is another way to dimmension variables by specifying the address location of the variable. See DIM xxx AT xxx for more details. Also see the GLABAL and LOCAL commands on how to define variables in programs that contain user-defined subroutines or functions . Back to the ABC Command Index Command_DIM_xxx_AT_xxx: Syntax: Dim (Dimmensions) As [* ] At , (Dimmensions) As [* ] At , ...
Description: Dimensions a variable, where the programmer specifies the location of the variable in memory. There are three main data types: Integer, Long, and String. Integers are 16 bits wide, long variables are 32-bit wide, and strings are blocks of 8-bit wide
characters. The location of the variable can be represented by a constant number, specifying the absolute address of the variable within the 68k memory space (eg: 12345, or &h3039). The location can also be represented by a label in the source. The label will
BasiEgaXorz - Sega Genesis BASIC Compiler - v1.37 Documentation
http://devster.monkeeh.com/sega/basiegaxorz/basiegaxorz_full.html
always point to data (eg: data defined by the commands DATA, DATAING, DATALONG, DATAFILE, etc). Label checking must be enabled in options first, prior to using labels. The location can also be specified with the @ character, or the * asterik (both characters perform the same thing!), and using these symbols will point the location of your var iable to the current location of the data counter, or to the next DATA statement. So why is it useful to specify locations of variables? One of the main advantages is to treat data within the ROM (or RAM, if compiling for the SEGA CD unit) like variables, refered to by "Fake Variables" by dev ster. Back to the ABC Command Index Command_IF: Command_ELSE: Command_ENDIF Syntax 1: If Then ....Instructions if true ....Instructions EndIf
Syntax 2: If Then ....Instructions if true ....Instructions Else ....Instructions if false ....Instructions EndIf
Desctip tion: Performs a check on the expression. Blah blah, should be self explanitory, if not, check a basic tutorial. False=$00, True=Any other value. ElseIf is not supported.
Back to the ABC Command Index Command_SLEEP: Syntax: Sleep , [TVBLANK] Description: Pauses execution for (1/60) seconds, or ~16.67 ms. for every unit of the Expression. For example, using a value of 60 pauses execution for 1 second. If the TVBLANK keyword is present in the second argument, the sleep command ends at the begining of the ver ticle blank. By default, when TVBLANK is not present, the sleep command will end sleeping time at the begining of the displaying period. The extra extension is great for when you want to load tiles to VRAM right after the sleep command (tiles load faster because the VDP should be idle at this time). Back to the ABC Command Index Command_DATA: Syntax: Data ,,........ Description: Insets data into the basic program that can be read by command Read. Any data has to be byte-long (see DATAINT for 16-bit data, and DATALONG for 32-bit). Strings can be used in the DATA statement. The latest release of BasiEgaXorz no longer requires the user to zero-terminate any strings, and the newer compiler is backwards compatible with strings that were zero-terminated manually. An example string usage: Data "Hello Data!" . If a value greater than 255 is used (exceeding the byte-long data lim it), the file will not c ompile.
Back to the ABC Command Index Command_DATAFILE: Syntax: Datafile ,[BIN] Description: Inserts data from an external file into the basic program that can be read by command Read. has to be a file inside the compiler directory. When keyword BIN is used, the file will be included as a binary file. Example: Datafile Levels.dat,BIN. If BIN is left out, then the file will be included as a text. Proper text file syntax (same as assembler): dc.b ,...... dc.w ,...... dc.l ,......
Back to the ABC Command Index Command_READ: Command_READINT: Command_READLONG: Syntax: Read ,,........ ReadInt ,,........ ReadLong ,,........
Description: Reads data from the Data statements. If the Read command is used for the first time, then data will be read at the very first Data statement. After that, data will be read one after the other, increasing the data pointer, until a Reload command resets the pointer. If is an integer, then data will be read, an d the msb will be set to 0. If is a string, then the data will be copied into a string one byte after the other until a NULL (0 - Zero) is reached.
BasiEgaXorz - Sega Genesis BASIC Compiler - v1.37 Documentation
http://devster.monkeeh.com/sega/basiegaxorz/basiegaxorz_full.html
Back to the ABC Command Index Command_RELOAD: Command_RESTORE: Syntax: Reload [Line Number/Label] Description: Resets the data pointer to the start of label. The label that Reload is directed to has to be directly in front of the data statement. For example: MyData: data "Wassup",0,45. When [Label] is ommited, the data pointer is reset to the very first Data statement. Back to the ABC Command Index Command_WHILE: Command_WEND: Syntax: While ....Instructions ....Instructions Wend
Description: Keeps on looping until is false.
Back to the ABC Command Index Command_END: Syntax: End Description: Stops execution. Back to the ABC Command Index Command_LOCATE: Syntax: Locate , Description: Repositions the text cursor at and . The range for row is 0 to 25, and the range for column is 0 to 37. If or is omitted, then the corresponding cursor argument will not be changed. If the cursor is moved out of range, the program will not check for this, and text will end up being displayed out of the screen, unless the screen is scrolled. Permitted: Locate 1,2 ' Will move cursor to row 1, column 2 Locate 3, ' Will move cursor to row 3, column unchanged Locate ,5 ' Will move cursor to column 5 , row unchanged
Back to the ABC Command Index Command_GOSUB: Syntax: Gosub Description: Jumps program execution to . Program execution is returned to the instruction after the Gosub instruction after a R e t u r n command is found. Branches may be stretched to inifinite, depending on how much stack space is left. Back to the ABC Command Index Command_RETURN: Syntax: Return Description: Returns program execution to the instructi on after the last Gosub command. Back to the ABC Command Index Command_ON_EVENT: Syntax: On Gosub Description: On the interruption of , the program will immediately change program execution to the specified . An event cannot be restarted if the program is executing in an event subroutine. An event subroutine may be ended by a Return command. The cursor location is always saved - if people don't like this, tell me and i'll remove that. List Of E vents : V B L A N K - Verticle Blank Interrupter. Occurs 60 times per second. H B L A N K - Horizontal Blank Interrupter. E X T I N T - External Interrupter (found on controller ports). Read the ENABLE command for a better description of external hardware interrupters. Back to the ABC Command Index Command_ENABLE: Syntax: Enable Description: Enables . Values for : INTERRUPT VBLANK - Turns on the verticle blank interrupt. This command has to be executed in order for VBLANK events to be triggered. It is recommended that this instruction be placed anywhere after an On command. INTERRUPT HBLANK - Turns on the horizontal blank interrupt. This command has to be executed i n order for HBLANK events to be
BasiEgaXorz - Sega Genesis BASIC Compiler - v1.37 Documentation
http://devster.monkeeh.com/sega/basiegaxorz/basiegaxorz_full.html
triggered. It is recommended that this instruction be placed anywhere after an On command. INTERRUPT EXTERNAL, - Turns on the external interrupter. External interrupters occur on the controller/extension ports. The external interrupter is triggered when a Logic LOW on the TH pin of the controller port is pulsed. When the interrupter occurs, the HV counter is latched (eg: for making an easy light-gun interface). Since the HV counter is being latched, I believe you won't be able to read the HV counter during normal program exe cution (outside the interupter) like you would for doing rasters. When the counter is latched, that means it will stay a constant value, and will not update itself with the TV trace. To re-enable HV counter real time reading, disable this int erupter. is a number between 0 and 2 (0=Player 1, 1=Player 2, 2=Extension port found on old Segas). S C R E E N - Turns on all screen displaying. Back to the ABC Command Index Command_DISABLE: Syntax: Disable Description: Disables . Values for : INTERRUPT VBLANK - Turn off the verticle blank interrupt. See On to make use of this. INTERRUPT HBLANK - Turns off the horizontal blank interrupt. This command has to be executed in order for HBLANK events to be triggered. It is recommended that this instruction be placed anywhere after an On command. INTERRUPT EXTERNAL, - Turns off any external interrupters from the controller/extension ports. You still need to specify the Joypad number in order to properly make the joypad function like it use to. The HV counter is no longer being latched after this command, so now you can read the HV counter. S C R E E N - Turns off all screen displaying. Blanking signals are still sent to the TV, and the b ackdrop color is the only component drawn during the active display period. Note: Verticle and Horizontal interrupters and status signals are disabled when the screen is off, so the command Sleep and other status signal dependent routines will freeze. W I N D O W - Resets the window. Back to the ABC Command Index Command_SHLINK: Syntax: Shlink Description: Jumps program execution to . It is only recommended that this command only be used in an event subroutines to jump immediatly to . Normally, you cannot use G o t o to jump outside of an event subroutine. I thought this command might be useful for things where many instructions are being executed in the main program loop, where there is no room to read the joypad, and therefore needs to use an event to check the joypads, and jump out of the main program loop at a certain condition. Also, this resets the stack space, so if you had subroutines called with Gosub in the main program loop, then these subroutines will be immediatly killed, and you cannot use Return to jump to the instruction right after the relevant Gosub instruction. Back to the ABC Command Index Command_INK: Syntax: Ink Description: Changes the color of the drawing text to . The range is from 0 to 3. The default colors for on reset are: 0 1 2 3
-
White Cyan/Baby blue Green P urple/Magenta
Back to the ABC Command Index Command_LOADTILES: Syntax: LoadTiles , , , [Tile Source Offset from Label]
Description: Loads tiles into video memory. points to the Label that tile data will be loaded from. This has to be a label with a corresponding data/datafile statement. is the number of ti les that will be loaded. One unit of is equal to one 8*8 tile. points to the destination tile number that these tiles will be copied to. One unit of is equal to one 8*8 tile, and the destination starts at 0 and end at 1343. So, the video memory can hold 1344 simultaneous tiles (43008 bytes of VRAM). Tile numbers 0 to 255 is the text font. [Tile Source Offset from Label] is an optional argument, where it starts copying tiles after so and so tiles in the . On unit of is equal to one 8*8 tile. For example, if [Tile Source Offset from Label] is twelve, then tile s will be loaded twelve tiles after the data label. If this argument is ommited, then a value of 0 is used.
Back to the ABC Command Index Command_DRAWTILE: Syntax: DrawTile , , Description: Draws one tile on the screen at and . One unit of X or Y is equal to one 8*8 cell. X and Y start at (0,0), and that is the very upper left part of the screen - FYI: Text starts drawing at (1,1). is the tile number that will be drawn. One unit of this is equal to one 8*8 tile.
BasiEgaXorz - Sega Genesis BASIC Compiler - v1.37 Documentation
http://devster.monkeeh.com/sega/basiegaxorz/basiegaxorz_full.html
Back to the ABC Command Index Command_DRAWTILES: Syntax: DrawTiles , , , , , , [Data Label Offset ] Description: Draws one or more tiles on the screen at and that is and bi g. One unit of X, Y, Width, or Height is equal to one 8*8 cell. X and Y start at (0,0), and that is the very upper left part of the screen. is the tile number that will be drawn. One unit of this is equal to one 8*8 tile. is a data label were the drawing map is located. The data has to be in byte format (using Data). The command draws the map in the order from left to right, up to down. Back to the ABC Command Index
Command_PROPSPRITE: Syntax: PropSprite , , Description: Sets the drawing tile, and color palette of a sprite. is the sprite handle recieved from AddSprite(). [tile vram offset] is the tile that is shown by the sprite, in video memory. One unit of [tile vram offset] is one 8*8 cell. [ palette] is the palette number to des ignate the sprite for color generation. [palette] is in the range from 0 to 3. Back to the ABC Command Index Command_MOVESPRITE: Syntax: MoveSprite , , Description: Changes the locations of a sprite. is the sprite handle recieved from AddSprite(). X and Y are the locations to move the sprite to. One unit of X and Y are equal to one pixel. Sprites are shown on the screen starting at (128,128). eg: MoveSprite MySprite%,200,250 will move the sprite to (200,250), but the sprite will actually appear at (72,122) on the screen. Any value less than 128 is used to hide the sprite. Back to the ABC Command Index Command_FREESPRITE: Syntax: FreeSprite Description: Destroys the sprite, and frees up that handle to be used for another sprite. is the sprite handle recieved from AddSprite() Back to the ABC Command Index .
Command_HIDESPRITE: Syntax: HideSprite Description: Hides the sprite from the active display area. It actually relocates the sprite to (0,0) for actual coordinates, or (-128,-128) for coordinates relative to the actual display. Sprite is not destroyed, unlike the FreeSprite command. Back to the ABC Command Index Command_PALETTE: Syntax: Palette , , Description: Changes the color make-up of one palette entry. The Genesis has a total of 4 palettes, and each palette holds 16 colors (each tile is made up of 1 pixel=4 bits). is the palette number in the range 0 to 3. is the color entry inside the palette, in a range from 0 to 15. Color entry #0 for each palette is trans parent for sprites. You can use the function RGB() to get the using the 3 different color components: red, green, blue. RGB Code Bit Format MSB ooooBBBoGGGoRRRo LSB
o's = Value of 0 RRR = Red value, 0 to 7 GGG = Green value, 0 to 7 BBB = Blue value, 0 to 7 Back to the ABC Command Index Command_SCROLL: Syntax: Scroll , [Quantity], [Entry] Description: Scrolls a background plane. is the direction to scroll in. [Quantity] is the displacement to shift the screen corresponding to its direction. [entry] is the scroll entry. If the scroll mode for a direction is HSCROLL_OVERALL or VSCROLL_OVERALL, then [entry] can be ommited. If the scroll mode for a direction is HSCROLL_CELL then [entry] specifies which horizontal cell will be scrolled, where one unit of [entry] equals 8 horizontal lines (in pixels).If the scroll mode for a direction is HSCROLL_LINE then entry specifies which horizontal line will be scrolled, where one unit of [entry] equals one pixel high line. If the scroll mode for a direction is VSCROLL_2CELL then entry specifies which verticle line will be scrolled, where one unit of [entry] equals a width of two cells (two cells equals 16 pixels). The Scroll command does not scroll sprites along with the background plane. Sprite will have to be shifted manually, if desired. Back to the ABC Command Index Command_SHIFTSPRITE:
BasiEgaXorz - Sega Genesis BASIC Compiler - v1.37 Documentation
http://devster.monkeeh.com/sega/basiegaxorz/basiegaxorz_full.html
Syntax: ShiftSprite , , Description: Relatively moves the sprite (a shift, or scroll). The command does not set the sprite's X and Y coordinates, compared to the command MoveSprite. is the sprite handle recieved from AddSprite(). and are the change in X and
Y to move the sprite. Example directions: dx=-1 and dy=0 will move the sprite left by one pixel, dx=2 and dy=5 will move the sprite right by 2 pixels and down by 5 pixels, dx=-10 and dy=-1 will move the sprite left by 10 pixels and up by 1 pixel. Back to the ABC Command Index Command_RANDOMIZE: Syntax: Randomize [seed] Description: Changes the seed for the random number generator. Changing the seed is essential for making sure that each number being coming out of the random number generator is unique. Having the same seed throughout the program will yield the same pattern of numbers coming out of the random number generator. Ignoring a value for seed will just substitute the video's HV counter for the seed. A good way to make use of getting pure random numbers is to place a Randomize statement right after a joypad routine has detected a key. Back to the ABC Command Index Command_OPTION: Syntax: Option , Description: Changes compilation options
Description
DEDICATED SEGACD
-
Tells the compiler to compiler only for the Sega CD
TITLE
A Title
Sets the title for a Cartidge game
STRING SIZE
Size
Changes the default string size. The default string size is 128
SEGACD
-
Overrides settings in the Options dialog, and compiled the program to a Sega Boot CD
SEGACD PROGRAM
-
Overrides settings in the Options dialog, and compiled the program to a Sega CD Program. Sega CD Programs can be used for programs on a Sega Boot CD. They can also be used on MoD's Transfer Suite .
CARTRIDGE
-
Overrides settings in the Options dialog, and compiled the program to a ROM cartridge
REORGCODE
Address
Sets the compiler base address for Sega CD programs
REORGVARS
Address
Sets the compiler base address to place variables
EXTERNAL SRAM
, Allocates external SRAM space for external variables. All external variables begin , with ext_ [EVEN/ODD /BOTH]
F ONT FOREENT RY
Changes the palette entry that text printing commands will use to draw the foreground of text, or font. The default palette entry is entry 1.
F ONT BACKENT RY
Changes the palette entry that text printing commands will use to draw the background of text, or font. The default palette entry for the background is entry 0 / transparent.
EXPLICIT
-
When OPTION EXPLICIT is defined in the program, all variables will have to be
declared. Failure to declare a variable before using it will show an error. This opti on will overwrite the option set in the options panel. CASESENSE
-
Turns off case sensitivity checking of variables and labels.
CASESENSEOFF
-
Turns off case sensitivity checking of variables and labels. Same exact thing as OPTION CASESENSE
.
CASESENSEON
-
Turns on case sensitivity checking of variables and labels. Variables and labels that have different cases (same spelling, but different capital/lowercase characters) will be recognized different by the compiler.
RUNSCRIPTS
xxx
Not implemented in public releases of basiegaxorz yet.
TEXTPRIORITY
HIGH / LOW
Sets the tile priority of text printed using the text printing commands. Use as simply: OPTION TEXTPRIORITY HIGH, o r OPTION TEXTPRIORITY LOW. This command makes no difference in distinguishing priorities between tile planes A and B, but sprites that are shown over high priority text will be shown behind the text.
GLOBALVARS
-
Defines all variables in a program to be global. This option will even overwrite variables defined by the LOCAL command.
TEXTHEIGHT
Sets the maximum height limits for text printing commands to print on the screen. If text goes past the bottem of the screen, a vram DMA routine will shift all characters up by 1. The default value used in BasiEgaXorz is 26.
BasiEgaXorz - Sega Genesis BASIC Compiler - v1.37 Documentation
http://devster.monkeeh.com/sega/basiegaxorz/basiegaxorz_full.html
TEXTWIDTH
Sets the maximum width limits for text printing commands to print on the screen. If text goes past the right of the screen, text will continue to be printed, starting on the next line, at the first column. The default width value used in BasiEgaXorz is 38.
TEXTSTART
,
Sets where the text displaying routines will start drawing text. The default row is 1 and the defualt column is 1.
NOLOADFONT
-
Forces the startup code to not load the system font at startup.
Back to the ABC Command Index Command_POKE: Command_POKEINT: Command_POKELONG: Syntax: Poke , PokeInt , PokeLong ,
Description: Sets the contents of to . Used for more advanced tricks.
Back to the ABC Command Index Command_BRIGHTEN: Syntax: Brighten , , , , Description: Increases the color intensity of a single color entry. and d efine which color entry to brighten. is a color code. is what the routine uses to increase the intensity. For example, if the color code of a defined entry was gray (0x040404), and the brighten command is used with an increment of 0x000002, then the resulting color after one loop will be 0x040406. is the number of 16.67 ms to delay each time the entry is incremented (Same delay as the Sleep command). is the number of times to brighten the entry. One unit of i s equal to one increment. Back to the ABC Command Index Command_DARKEN: Syntax: Darken , , , , Description: Decreases the color intensity of a single color entry. and define which color entry to brighten. is a color code. is what the routine uses to decrease the intensity. For example, if the color code of a defined entry was gray (0x040404), and the darken command is used with an decrement of 0x000002, then the resulting color after one loop will be 0x040406. is the number of 16.67 ms to delay each time the entry is decremented (Same delay as the Sleep command). is the number of times to brighten the entry. One unit of i s equal to one decrement. Back to the ABC Command Index Command_HBLANK: Syntax: HBlank Description: Used for determining the scanline count for which a horizontal blank interrupter occurs. is a number 0 to 222 determining how many scanlines +1 will be counted until an interrupter is triggered, for one screen. For example, if the number of scanlines were set to 24, then the horizontal interrupt will occur every 25 scanlines, or 8 times during the the active display period (TC is composed of 224 lines, 224/25=8, to be conservative). Each horizontal blank is approximately 14.6 usec long, and each scan line is approximately 64.0 us long. A value of 0 is not recommended, unless you don't utilize the verticle blank interrupter (a value of 0 means a horizontal interrupter will occur every line). On the real system, the verticle blank interrupter will never occur if used with a value of 0. Back to the ABC Command Index Command_PALETTES: Syntax: Palettes , , , , [Data Label Offset] Description: Loads more than one color into color RAM. is a data label that marks were the data starts. The data statements must use the command DataInt for defining color codes. See the Palette command for details on color codes. You can't use the RGB function in data statements, so all color codes need to be constants. is the palette number, ranging from 0 to 3. is the color entry within the color palette, ranging from 0 to 15. is the number of color entries to load. One unit of equals one color entry. Back to the ABC Command Index Command_ASM: Syntax: Asm " [operand 1], [operand 2]" Description: Inserts assembly code directly into the assembler output of the BASIC file. The expr ession must be in quotes, and the expression cannot be in a variable/string. Back to the ABC Command Index Command_LIBRARY: Syntax: Library
BasiEgaXorz - Sega Genesis BASIC Compiler - v1.37 Documentation
http://devster.monkeeh.com/sega/basiegaxorz/basiegaxorz_full.html
Description: Includes an assembly library into compilation. The functions in the library will have to be called by command Call , or function Call()/Call&(). These calling commands/functions will jump directly to the label that you specified for your routine. Assembler errors will be displayed whenever an error occurs, so you can fix. See the corresponding call command/function for details on the requirements of assembly routines. The file must be located in the dir ectory slibrary, inside the directory of the compiler's executable (eg: C:\basiegaxorz\slibrary, if the compiler is located in basiegaxorz).
Back to the ABC Command Index Command_CALL: Syntax: Call , [argument 1], [argument 2],....., [argument n] Description: Calls a user defined assembly routine. is the label of the routine that you defined. The label can be anything, except for some keywords already taken by the compiler's own code. All routines must end with a rts instruction to continue execution. Argu ments: The arguments passed to the routine are stored onto the heap. The begining of the heap is pointed to with register A5 . The heap works from lower addresses to higher addresses. Arguments are pushed onto the stack from left to right on the line where the Call command is being executed. If an argument is an integer, or long, the value of the expression is stored onto the stack as a 4 byte long number. If an argument is a string, the whole solved string i s pushed onto the h eap, from left to right, and is terminated with a null (0). If the address ended by pushing a string is an odd number, then an extra null (0) is added. After an argument is pushed onto the heap, the nest argument is pushed onto the stack right after the last one. Reg isters: All data registers D0-D7 can freely be changed by the routine. Address registers A0-A4 can be freely used also. A5 is reserved to hold the heap pointer. A6 is reserved to hold the data pointer. A7 is reserved to hold the stack pointer. Implementing B ASIC L abels: All BASIC labels and number lines all begin with __LABEL_, and are followed by the label specified. Implementing B ASIC Variables: All BASIC integers begin with __INTEGER_, and are followed by the variable name specified. All BASIC longs begin with __LONG_, and are followed by the variable name specified. All BASIC strings begin with __STRING_, and are followed by the variable name specified. Back to the ABC Command Index Command_PSG: Syntax: Psg , Description: Plays a frequency, or changes noise parameters for a PSG sound channel. is the channel, ranging from 0 to 3. Channels 0 to 2 are the tone channels, and channel 3 is the noise generator. is a 10-bit frequency for a tone channel. If the channel is the noise generator, then has these parameters: Noise Ge nerator MSB: 0 0 0 0 0 FB N F1 NF0 :LSB
F B Noise type 0
Periodic (like low-frequency tone)
1
White (hiss)
N F 1 N F 0 Noise Generator Clock Source 0
0
Clock/2 [Higher pitch, "less coarse"]
0
1
Clock/4
1
0
Clock/8 [Lower pitch, "more coarse"]
1
1
Tone Generator #3
Notes to F requency to PSG C onversion Table Note Hertz PSG
Note
PSG
Hertz
A3
7
110.00
B5
798
493.88
A# 3
64
116.54
C6
810
523.25
B3
118
123.47
C# 6
822
554.37
C4
169
130.81
D6
834
587.33
C# 4
217
138.59
D# 6
844
622.25
D4
262
146.83
E6
854
659.26
D# 4
305
155.56
F6
864
698.46
E4
345
164.81
F# 6
873
739.99
F4
383
174.61
G6
881
783.99
F# 4
419
184.99
G# 6
889
830.61
G4
453
195.99
A6
897
880.00
G# 4
485
207.65
A# 6
904
932.32
A4
516
220.00
B6
911
987.77
A# 4
544
233.08
C7
917
1046.5
B4
571
246.94
C# 7
923
1108.7
C5
596
261.63
D7
929
1174.7
BasiEgaXorz - Sega Genesis BASIC Compiler - v1.37 Documentation
http://devster.monkeeh.com/sega/basiegaxorz/basiegaxorz_full.html
C# 5
620
277.18
D# 7
934
1244.5
D5
643
293.66
E7
939
1318.5
D# 5
664
311.13
F7
944
1396.9
E5
685
329.63
F# 7
948
1480.0
F5
704
349.23
G7
953
1568.0
F# 5
722
369.99
G# 7
957
1661.2
G5
739
391.99
A7
960
1760.0
G# 5
755
415.31
A# 7
964
1864.7
A5
770
440.00
B7
967
1975.5
A# 5
784
466.16
C8
971
2093.0
Mi ddle C = 2 61.63Hz = C 5 Back to the ABC Command Index Command_PSGVOL: Syntax: PsgVol , Description: Changes the volume of a PSG sound channel. is the channel, ranging from 0 to 3. is the volume, ranging from 0 to 7, were 0 is mute, and 7 is the maximum volume. Back to the ABC Command Index Command_HALT: Syntax: Halt e still executed during the pause Description: Pauses execution until the TV enters the horizontal blanking period. Interrupters ar period. Back to the ABC Command Index Command_VALT: Syntax: Valt Description: Pauses execution until the TV enters the verticle blanking period. Interrupters are still executed during the pause period.
Back to the ABC Command Index Command_DALT: Syntax: Dalt Description: Pauses execution until the TV enters the active display region of the screen. Interr upters are still executed during the pause period. Back to the ABC Command Index Command_TRAPCPU: Syntax: TrapCPU Description: Breaks execution at that line. Almost like a breakpoint, but not all that equivalent. When a breakpoint is encountered, all execution is stopped, and text is displayed at the bottem indicating that a break point has occured, the line at which the TrapCPU command was placed, and a query to either return to normal program execution, or to r estart execution. Pressing button START on joystick #1 will return execution. Pressing button C will reset execution. Back to the ABC Command Index Command_INPUT: Syntax: Input [Optional String Text],,... Description: Gets user input. Input is stored onto the string, or integer, or long variable. The Inputting proceedure follows the "password style" way of entering values from a controller. The UP and DOWN buttons change the character. The A button places that character onto the line. The B button erases the last character from the line. The C button switches between upper and lower case letters. The START button ends user input, and takes whatever was entered in. Interru pts are still executed during the time the user is entering stuff. If [Optional String Text] is used, then a question mark will not appe ar automatically in the prompt. If [Optional String Text] is ommited, then a variable can just be placed in i mmediately to act as the inp ut variable. Back to the ABC Command Index Command_WAITPADUP: Syntax: WaitPadUp Description: Pauses execution until all the buttons on a controller are released. is the controller number, starting with 0. A value of 0 is actually joystick #1, a value of 1 is joystick #2, and a value of 2 is the extension on Genesis model 1's. Interrupters are still executed during the pause period. Back to the ABC Command Index Command_BGCOLOR:
BasiEgaXorz - Sega Genesis BASIC Compiler - v1.37 Documentation
http://devster.monkeeh.com/sega/basiegaxorz/basiegaxorz_full.html
Syntax: BGColor , Description: Sets the back drop color palette entry for the screen. The back drop color is the color that is placed behind all planes
where entry 0 is used. Eg: the back drop color is the background color for text. , specify which color palette entry to use. has a range from 0 to 3 and has a range from 0 to 15. Back to the ABC Command Index Command_FREEALLSPRITES: Syntax: FreeAllSprites Description: Clears all displayed sprites, and resets all sprite handles to nothing, like when the Sega goes through a hardware reset. Back to the ABC Command Index Command_SETTEXTPLANE: Syntax: SetTextPlane Description: Sets the drawing plane for all ASCII text commands. The SCROLL_B plane has the lowest display priority of all planes. Sprites will always have the highest priority. SCROLL_A will overlap SCROLL_B. The window plane then overlaps SCROLL_A. Back to the ABC Command Index Command_SETGFXPLANE: Syntax: SetGFXPlane Description: Sets the drawing plane for all tile drawing commands. The commands included are: DrawTile, DrawTiles . The SCROLL_B plane has the lowest display priority of all planes. Sprites will always have the highest priority. SCROLL_A will overlap SCROLL_B. The window plane then overlaps SCROLL_A. Back to the ABC Command Index Command_WINDOWPROP: Syntax: WindowProp , , , Description: Displays the window, and sets its view properties. determines if the wi ndow will be alligned to the left side of the screen, or the right. determines if the window will be alligned to the top of the screen, or the bottem. and designate how large the window should be. T he window overlaps an ything over scroll A and scroll B. Back to the ABC Command Index Command_PUTS: Syntax: Puts , ;,...... Description:Prints characters onto the screen at . Unlike the Print command, Puts doesn't use the Cursor for text position, and it ignores any tabs and carriage returns, and display wrapping, and display scrolling. is the location to place the text. One unit of equals one 8x8 cell. 64 units of equals one horizontal line. When is divided by 64, the remainder of that number determines which ver ticle cell the text will be positioned on. Here's the formula: =Row*64+Column. If a semi colon is encountered between text expressions, then leading characters will be directly displayed appended to the last. The PUTS command uses the same text plane as the PRINT command, or any other text command. The display plane can be changed by using the command SETTEXTPLANE Back to the ABC Command Index .
Command_SCROLL2: Syntax: Scroll2 , [Value], [Entry] Description: Scrolls a background plane. is the direction to scroll to. [Value] is the number to set the scroll quantity to. As [Value] increases, scrolling shifts to the left, or upwards. As [Value] becomes negative, scrolling shifts to the right, or downwards. If [Value] is ommitted, then the scrolling value becomes 0. [entry] is the scroll entry. If the scroll mode for a direction is HSCROLL_OVERALL or VSCROLL_OVERALL, then [entry] can be ommited. If the scroll mode for a direction is HSCROLL_CELL then [entry] specifies which horizontal cell will be scrolled, where one unit of [entry] equals 8 horizontal lines (in pixels).If the scroll mode for a direction is HSCROLL_LINE then entry specifies which horizontal line will be scrolled, where one unit of [entry] equals one pixel high line. If the scroll mode for a direction is VSCROLL_2CELL then entry specifies which verticle line will be scrolled, where one unit of [entry] equals a width of two cells (two cells equals 16 pixels). The Scroll command does not scroll sprites along with the background plane. Sprite will have to be shifted manually, if desired. Back to the ABC Command Index
Command_SETSCROLLMODE: Syntax: SetScrollMode , Description: Sets the scrolling mode. If HSCROLL_OVERALL is used, then when the screen is scrolled horizontally, the entire plane is scrolled. I f HSCROLL_CELL is used, then when the screen is scrolled horizontally, 1 horizontal cell g ets scrolled. If HSCROLL_LINE is used, then when the screen is scr olled horizontally, 1 horizontal line gets scrolled. If VSCROLL_OVERALL is used, then when the screen is scrolled verticle, the entire plane is scrolled verticle. If VSCROLL_2CELL is used, then when the screen is scrolled verticle, 2 verticle cell gets scrolled. Note: when VSCROLL_2CELL is used, both planes SCROLL_A and SCROLL_B will be scrolled together.
BasiEgaXorz - Sega Genesis BASIC Compiler - v1.37 Documentation
http://devster.monkeeh.com/sega/basiegaxorz/basiegaxorz_full.html
Back to the ABC Command Index Command_SETSCROLLPLANE: Syntax: SetScrollMode Description: Sets the plane to scroll. Back to the ABC Command Index Command_CONTINUEWHILE: Syntax: Continue While Description: Interrupts the normal flow of execution in a while loop. The Continue While statement skips all the following statements in the body loop and triggers the next itteration of the loop. This technique can be of use within complex loops where you might wish to skip the next loop iteration from various locations. Back to the ABC Command Index Command_CONTINUEFOR: Syntax: Continue For Description: Interrupts the normal flow of execution in a for loop. The Continue For statement skips all the following statements in the body loop and triggers the next itteration of the loop. This technique can be of use within complex loops where you might wish to skip the next loop iteration from various locations. Back to the ABC Command Index Command_CONTINUEDOLOOP: Syntax: Continue Do Continue Loop
Description: Interrupts the normal flow of execution in a Do/Loop loop. The Continue For statement skips all the following statements in the body loop and triggers the next itteration of the loop. This technique can be of use within complex loops where you might wish to skip the next loop iteration from various locations.
Back to the ABC Command Index Command_EXITWHILE: Syntax: Exit While Description: Interrupts and terminates a While loop immediately. This technique can be of use within complex loops where you might wish to skip the next loop iteration in various locations. Back to the ABC Command Index Command_EXITFOR: Syntax: Exit For Description: Interrupts and terminates a For loop immediately. This technique can be of use withi n complex loops where you might wish to skip the next loop iteration in various locations. Back to the ABC Command Index Command_EXITDOLOOP: Syntax: Exit Do Exit Loop
Description: Interrupts and terminates a Do/Loop loop immediately. This technique can be of use within complex loops where you might wish to skip the next loop iteration in various locations.
Back to the ABC Command Index Command_REGMOVE.B: Command_REGMOVE.W: Command_REGMOVE.L: Syntax: RegMove.X , Description: Copies a 68k register into a BASIC variable, for use with a lower level language. The register names are D0....D7, and A0....A7. The source or destination can either be a 68k register or a BASIC expression, but cannot be both at any same time. Like the assembly Move instruction, the RegMove.X statement will not truncate any registers if the size of the data transfter is a byte of word. Back to the ABC Command Index Command_GETS: Syntax: Gets Description: Gets user input and stores it in a variable. The gets command is cheap compared to the Input command, no sprite for a cursor, no carriage returns, no output text, etc., so its really crude entering values. Interrupts are still executed during the time the user is entering stuff. Back to the ABC Command Index
BasiEgaXorz - Sega Genesis BASIC Compiler - v1.37 Documentation
http://devster.monkeeh.com/sega/basiegaxorz/basiegaxorz_full.html
Command_SLEEP2: Syntax: Sleep2 , [TVBLANK] Description: Pauses execution for one horizontal blank for every unit of the Expression. The period for the horizontal blank is approximately 64 uSec (One Sec is 1,000,000 uSec!!!). If the TVBLANK keyword is present in the second argument, the sleep command ends at the begining of the horizontal blank (Good for color rasters). By def ault, when TVBLANK is not present, the sleep command will end sleeping time at the begining of the displaying period. Back to the ABC Command Index Command_INCASM: Syntax: IncAsm Description: Includes an assembly library into compilation. The functions in the library will have to be called by command Call , or function Call()/Call&(). These calling commands/functions will jump directly to the label that you specified for your routine. Assembler errors will be displayed whenever an error occurs, so you can fix. See the corresponding call command/function for details on the requirements of assembly routines. Back to the ABC Command Index Command_TVSET: Syntax: TVSet Description: Sets NTSC 60hz or PAL 50hz video drawing mode. By default, all programs start out as NTSC. If is 0, NTSC is selected. If is 1, PAL is selected Back to the ABC Command Index Command_FAKE: Syntax: Fake , Description: Converts a variable address into a data label. is a new data label to create that will point to the variable.