So after furiously straining for weeks (since late December), my BAGASM is finally coming out at full force! "What is BAGASM?" you might ask. Well I can tell you what it's not! It's not a sandwhich, or an amazing massage. No, it is merely an interpreter for a language I have created similar to the general syntax that Assembly languages may follow. What does this allow? Well for one, you don't have to setup and deal with the finicky development environment,the DSTwo SDK, to create content for the DSTwo! All you need is a regular text editor and the PC or DS2 version of the interpreter to get started. PC Interpreter you say? Yes that's right! Due to the nature of the language, I was easily able to create a PC version of the same interpreter that runs on the DSTwo. This allows for the easy and fast testing of your amazing creations without the need of constantly transfering files to your DSTwo. Take a gander below at the screenshot for yourself. At this point, you're all probably thinking, "Wow, this is too good to be true!". I'd be inclined to agree with you on that part my good man/woman/dinosaur! As awesome as this may sound, there are limits to keep in mind: -You can only load 16 sprites (subject to change in future) -Currently there is no support for animations, sprite transparency or alpha blending (subject to change in future) -No support for stylus input (again subject to change in future) -source files can not have blank lines or tabs => white space sensitive (this will be fixed in the future) However, these are merely limits I am imposing on said programs. Here are some limits in which I lack the control over! -DS2 process is slower than a PC, thus your program may or may not perform as well on the DSTwo as it does in the PC interpreter -Language interpreting is always much slower than native code so high performance applications are not recommended -The syntax of ASM is very confusing and not easy to read ( i guess i could have used a different syntax, but that would cost speed!) So with that all out of the way, if your slightly degraded enthusiasm hasn't already sent you in a spiral of depression, you're probably curious as to how it works? Well it is quite simple. -First you type up your code, lets say we wanted to create a hello world program. It would start out something like this: Code: ;Any line with ; as the first character is a comment, yay! ;This debug text flag is only good for the PC interpreter, ;Debug text slows the DS2 interpreter down a lot/ ;[Debug Text] ;Here we are setting the DS2 CPU speed to its highest value [CPU_freq 13] ;_start: marks the start of the program, this is where white space ;matters _start: ;this will output Hello World! to the console (top screen on DS) PRINT "Hello World!" ;finally this will end the program HALT -Then you'd save the code as Hello World.asm where you plan on launching it -Finally, you run the interpreter which will then run Hello World.asm The interpreter parses the source file and converts it to a more optimized format for super fast parsing. You can actually dump this optimized format as its own binary and run it on its own (cuts down loading times, and obfuscates code if that's your thing) simply by adding the [Compile] flag to the top of your code (more info on this to come in tutorials). Are you still here? Excellent! You've got balls to continue reading this far. Now we get to the fun part, Documentation! Well currently I do not have any tutorials or examples made up, but I will update this section with a few after I have finished eating my delicious lasagna dinner. This section will contain a list of all the possible operations, what they do, how they work etc, and general tips on programming this eye gouging-ly, monolithic-ally sphincter clenching beast of a language. The ginormous list of operations! Code: Input detection! GETKEY X - stores current input in X CHKKEY X;Y - checks the key value for a specified key press eg. to check for Y button; GETKEY $R5 CHKKEY $R5;#2048 Key values: A = 0 B = 2 X = 1024 Y = 2048 L = 512 R = 256 START = 8 SELECT = 4 LEFT = 32 RIGHT = 16 UP = 64 DOWN = 128 Variables Note! All variables must be loaded to a register to perform operations on the stored values DATA - used to define a variable eg. SMALL DATA '0 -creates a variable called SMALL with an initial value of 0 as a 8 bit byte value(') PENIS DATA #0 -creates a variable called PENIS with an initial value of 0 as a 32 bit integer(#) LOAD X;Y - loads integer variable Y to X register eg. LOAD $R0;GIRAFFE -loads value of GIRAFFE to register 0 LOADC X;Y - loads byte variable Y to X register STORE X;Y - stores value of register X to variable Y eg. STORE $R0;SHOOP - stores value of register 0 to variable SHOOP Math Operations! ADD X;Y - adds Y to X SUB X;Y - subtracts Y from X AND X;Y - bitwise and Y to X DECR X - decreases the value of X by 1 INCR X - increases the value of X by 1 DIV X;Y - divides X by Y MUL X;Y - multiplies X by Y RANDM X;Y - X becomes a random number with a max possible value Y REM X;Y - get the remainder of X divided by Y SHL X;Y - bitshift value X by Y left eg. SHL $R0;#1 - multiply by 2 SHR X;Y - bitshift value X by Y right Logic stuff! All bits are updated after a math operation is called. JMPC LABEL - jumps program to LABEL when collision bit is set (CHKCOL) JMPN LABEL - jumps program to LABEL when negative bit is set JMPP LABEL - jumps program to LABEL when positive bit is set JMPZ LABEL - jumps program to LABEL when zero bit is set JUMP LABEL - jumps without condition to LABEL Output! OUT X - outputs the integer value of X to the console OUTC X - outputs the ascii character of value X to console PRINT "x" - prints string X to console LDSPR X;S - loads a sprite to slot X(0-15) with file name S DRWSPR X;Y - draws a sprite to screen X (0 = bottom, 1 == top), from sprite slot Y(0 - 15) FLIP X - updates screen X (0 = bottom, 1 = top) VSYNC - locks program to 60 FPS CHKCOL X;Y - checks collision between two sprites X and Y, sprites defined by their sprite number (0 - 15) eg. CHKCOL #0;#1 Misc Operations! HALT - ends the program immediately NOP - no operation to be performed on line SET X;Y - set value X to value Y Code: [b][u]A quick guide for getting started.[/u][/b] [b][u]Registers:[/u][/b] $R(Z) = register value with Z as a value between 0 and 15 (16 registers total) eg. $R4, $R14 All math operations must use a register to store the computed value. [u][b]Screen buffer:[/b][/u] $VX(Z) = x pixel position of screen buffer to edit, Z is the screen to modify the X pointer to (0 = bottom, 1 = top) $VY(Z) = y pixel position of screen buffer to edit, Z is the screen to modify the Y pointer to (0 = bottom, 1 = top) $VM(Z) = screen buffer access with Z the screen to access (0 = bottom, 1 = top) To draw a white pixel to the bottom screen at 64,128: SET $VX0;#64 SET $VY0;#128 SET $VM0;#65535 [u][b]Sprites:[/b][/u] $SX(Z) = x pixel position to draw sprite number Z (0 - 15, 16 sprites total) $SY(Z) = y pixel position to draw sprite number Z (0 - 15, 16 sprites total) To draw a sprite loaded to slot 5 on the bottom screen at 52,76 LDSPR #5;SpiteName.bmp SET $SX5;#52 SET $SY5;#76 DRWSPR #0;#5 Note: Root path for files are set to the same directory where the program is launched at [b][u]Jumps:[/u][/b] Jump lables can be placed on any line and must have an operation following it. eg. HELLO_LOOP PRINT "HELLO!" JUMP HELLO_LOOP Note: Jumps occur immediately as they are called. The line after a jump call is not executed (Thanks to spiritofcat for bringing that up!) or for an easier read you can follow the jump label with the NOP keyword (no operation) HELLO_LOOP NOP PRINT "HELLO!" JUMP HELLO_LOOP [u][b]Printing:[/b][/u] You can print on a newline using the command: OUTC '10 which prints the ascii value for \n to the console. This can be used to print other special characters. [b][u]Variable declarations:[/u][/b] There are two types of variables supported, integers (32bit signed) and bytes (8 bit signed). A variable can be declared as such: VAR_NAME DATA #0 This initializes a variable called VAR_NAME as an integer (#) assigned the initial value of 0. A byte can be declared using a ' symbol instead of #. Variables can be declared at any point within the source, but are converted to NOP operations before run time, thus it is recommended to declare them initially or at the end after your final halt statement for best performance. At last we have reached the end! However, I think you'd like to look at the awesomeness I have masterfully created some more! This however isn't possible in the current version cause I fixed the glitch. Finally, the DOWNLOAD (PROJECT PAGE)! This link contains the latest source code, binaries, and test programs. The DS2 interpreter loads files via ARGV so a menu such as Imenu or BAGPlug are required to load the .asm and .basm files. To run the DS2 version on BAGPlug, simply: -copy the two .arg files in the DS folder to /_bagui/ext, -then copy BAGASM.plg to your sd card -edit the two .arg files to match the program location to your current path of BAGASM.plg -Then browse to your .asm or .basm files and click them! The PC interpreter can be launched by the ASM.bat file, with the asm file specified as the first argument And with that, I bid you guys good luck on your creations.