Skip to content

Instantly share code, notes, and snippets.

SET A, 0x0006
JSR LABEL6_fib
SET PUSH, A
SET PUSH, A
SET J, SP
SET A, [0x0001+J]
SET B, 0x8000
JSR itoa_FUNCTION
SET J, A
SET A, POP
function foo(a) { return 9 + a; }
function test(a,b,c,d,e)
{
a = foo(a);
return ((a + b + c) * d / a) + (d * e);
}
var some_var = 3;
var ret = test(1,2,3,4,5);
some_var = some_var + ret;
//
// Test file for the DCPU-16 compiler.
//
void set(char chr, int x, int y)
{
int mem = 0x8000 + x + y * 32;
*mem = chr + 0x7000;
}
SET A, 0x0006
JSR L4fibonacci
SET X, A
IFE X, 0x0008
SET PC, L12THEN
SET A, L7_DATA
JSR L2print
SET PC, L13END
:L12THEN
SET A, L6_DATA
package
{
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Dynamics.Joints.*;
import flash.display.BitmapData;
import flash.display.Sprite;
import flash.events.IMEEvent;
import flash.geom.Matrix;
package
{
import Box2D.Collision.Shapes.b2PolygonShape;
import Box2D.Common.Math.b2Vec2;
import Box2D.Dynamics.b2Body;
import Box2D.Dynamics.b2BodyDef;
import Box2D.Dynamics.b2FixtureDef;
import flash.display.BitmapData;
import flash.display.GraphicsBitmapFill;
import flash.geom.Point;
package
{
import flash.display.BitmapData;
import flash.geom.Rectangle;
import gum.controls.Button;
import gum.controls.CheckBox;
import gum.FlashPunk.UIEntity;
import net.flashpunk.graphics.Image;
import net.flashpunk.graphics.Spritemap;
import net.flashpunk.Sfx;
package
{
import flash.display.BitmapData;
import flash.geom.ColorTransform;
import flash.geom.Matrix;
import flash.geom.Point;
import flash.geom.Rectangle;
import net.flashpunk.graphics.Spritemap;
import net.flashpunk.FP;
function fib(n)
{
if (2 > n) return n;
return fib(n-1) + fib(n-2);
}
var a = fib(6);
; var a = fib(6);
SET A, 0x0006
function fib(n)
{
if (2 > n) return n;
return fib(n-1) + fib(n-2);
}
var a = fib(6);
Compiles too...