		BASIC64 (MIPS BASIC For Ninendo 64) by GBAGuy Version 2.0
		website: http://k2pts.home.attbi.com/gbaguy/
			

What is it?
-----------

	BASIC64 is a simple BASIC dialect compiler for the N64, it generates
an assembly language file on the standard output stream. It is extremely simple
but supports some BASIC control flow structures such as If and While. It
also allows inline assembly for increased control of the processor.

Usage
-----

	To run BASIC64 (.NET v1.0 program), use the command-line like the following:

		BASIC64 infile.b64 >outfile.asm

	BASIC64 produces code for assembly on ASMN6432 which is part of the PSYQ
	devkit that is easily found with a search on Google. The generated
	Assembly Code is also compatible with U64ASM by HCS which you can download
	at the following URL: http://here.is/halleyscomet .

	To be able to assemble with U64ASM, you must replace all instances of LI
	with LA and replace all tabs with something like 4-8 spaces.

	A future release will support a command-line switch to require BASIC64 to
	generate fully U64ASM compatable assembly code.

Sample Sources
--------------

	In the future, the sample sources will maybe actually do something, but I
created these in the process of testing new features in BASIC64. The following is
a list of sample sources and what should be the generated assembly code:

	c.b64 and c.asm
	w.b64 and w.asm
	o.b64 and o.asm

That's it!

Included .H Files
-----------------

	The .H Files (VI.h,OS.h,AI.h,PIH.h) included in the package are required for
BASIC64 and contain the code for several things including all the VI... functions
such as VIInitialize and VIDrawPicture and VISetPixel. It also contains several other
things, take a look at what you can find! :)

BASIC Syntax
------------

	Include: 

		The Include statement takes a BASIC64 code file and inserts it at the
		currect location in the code.

			Include BASICFILE.b64

		Is how it works. To include an assembly language file use:

			*include ASMFILE.s

		To include a binary file:

			*incbin BINFILE.bin

		cool stuff. DO NOT INCLUDE THE CURRENT FILE, IT IS UNKNOWN
		WHAT WILL HAPPEN (BUT I KNOW IT WON'T BE GOOD!)

	Dim:

		The Dim statement is used such as the following:
		
			Dim a,b(10)
		
		A variable name by itself will be a 32bit word, a variable
	followed by (A_NUMBER) will make that variable be the number of bytes
	specified by A_NUMBER, the "number of bytes" feature is not yet actively
	supported by other constructs of the language, but can be easily used
	with inline assembly code.

	If:

		The If statement is used like this:

			If BOOLEXPRESSION Then
				' code
			End If

		The one line version of the If statement is not yet supported.
		BOOLEXPRESSION must be ONE boolean expression such as
		A+4>GRR*2, the following comparison operators are supported:
			>,<,=

		Things such as Or, And, Not, that join more than one
		BOOLEXPRESSION are not yet supported.

		(For information about how math works in BASIC64, see the
		Assignment Statement)

	While:

		The While statement is used like this:

			While BOOLEXPRESSION
				' code
			End While	

		See If for a description of BOOLEXPRESSION.

	For:

		The For statement of BASIC64 is simplistic and does not reflect
		the highly flexible For of normal BASIC. The BASIC64 For Statement
		is used like this:

			For VAR = START To END
				' code
			Next
		
		VAR must be a variable name and only a variable name. START and
		END must be a valid math expression and START>END.
		
		The generated code for the For statement appears to be correct,
		but if you wish to debate that, please contact me.

	Goto:

		The Goto statement is used just like normal BASIC:

		hell:
			Goto hell
			'an infinite loop

		Simple!

	Labels:

		Labels are just like normal BASIC and (like variable names)
		are carried through to the Assembly Language output.

	Assignment Statements:

		Assignment Statements are simplistic in this dialect of BASIC
		and look like the following:

			a = var1 * 8 + 2 - 1

		Parenthesis, ( and ), are not supported in assignment
		statements, nor is order of operations, nor is any function/
		subroutine calls. Operators allowed in an assignment statement
		are +,-,*,/ ,@,;. The @ symbol can be used in front of a variable
		to mean Address Of. The @ symbol is fairly untested. The ; symbol
		can be used in front of a variable (not at same time with @), and
		is the dereference operator. The ; operator is semi-tested and appears
		to work OK.

		Floating point operations may or may not work
		and are unsupported (use inline ASM for floating point work).
		
		The Math parser prefers things being spaced out, but has been
		fairly well tested with things having no spaces. It's
		recommended to use spaces to make code more pleasing to look
		at.

	Call:

		The Call statement works like this:

			Call LABELNAME(PARAMETERS)

		LABELNAME is a label defined either in your program or in
		the Assembly Language code that comes with this program.
		
		PARAMETERS is a parameter list such as the following Call
		statement:

			Call VISetPixel(10,a+10,a*b)

		As you can see math is supported in parameters (including
		AddressOf (@)). There can only be 4 parameters as the CPU
		registers A0-A3 are used, an error message is generated 
		by having more than 4 parameters. Parameters are currently
		useless to programmer defined subroutines/functions as
		A0-A3 are unaccessable through BASIC code and inline ASM
		is a must for that.

		CALLS CANNOT BE NESTED as no stack has yet been implemented and
		subroutines are created with JAL and JR RA.

	Return:

		Returns from a subroutine and causes the exact two following
		statements to be generated:

			jr ra
			nop

	Inline Assembly Language:

		Any line that starts with a '*' will be directly written to
	the Assembly Language output stream.

	Comments:

		Any line that starts with an apostrophe (') will be taken as
	a comment. Comments do not fall through to output Assembly code.

	Other:

		There are several other statements that are one word long and are
		used by themselves on a line:

			Nop or DoNothing: will cause a NOP instruction at the currect location.
			OSCrashProtect: Should be used as the first statement of every file.
			SetMem: Takes to parameters like a function, first address, then value to
				be stored there. This is essentially a compiler psuedo-function
				and your chosen assembler will get pissed at you if you try
				to assemble code that comes from a "Call SetMem(Blah,Blah)".
			
	Lastly:

		If there's problems or peticularities that I've forgotten to mention here, please
send me an email! :)

