0 Members and 1 Guest are viewing this topic.

Awesome Eiyeron. If this gets completed and allow everyone to launch the binary directly without much hassle, then this will be a great addition to other Nspire languages. Now we have BASIC, Lua, ASM, C, Python, Javascript and Squirrel.

initBufferingdeinitBufferingupdateScreenclearBufferclearBufferBclearBufferWgetPixelsetPixelUnsafesetPixelsetPixelRGBdrawHLinefillRectdrawSpritedrawSpritePartdrawSpriteScaleddrawSpriteRotateddrawLinefillRectfillCirclefillEllipsedrawStringdrawDecimaldrawChar

extern void drawSpriteScaled(const unsigned short*, const Rect*, int, unsigned short);=> n2d.drawSpriteScaled(sprite, 0, 0, i, i, 0, 0)

function array_to_blob(array){ local b = blob(array[0]*array[1]) foreach(v in array) b.writen(v, 'w') return b}

function array_to_blob(array){ local b = blob(array[0]*array[1]) foreach(v in array) b.writen(v, 'w') return b}local sprite = array_to_blob([ 32, 32, 0x0000, 0x0fe0,0x0fe0,0x0fe0,0x0fe0,0x0fe0,0x0fe0,0x0fe0,0x0fe0,0x0fe0,0x0fe0,0x0fe0,0x0fe0,0x0fe0,0x181f,0x181f,0x181f,0x181f,0x181f,0x0fe0,0x0fe0,0x0fe0,0x0fe0,0x0fe0,0x0fe0,0x0fe0,0x0fe0,0x0fe0,0x0fe0,0x0fe0,0x0fe0,0x0fe0,0x0fe0, 0x0fe0,0x0fe0,0x0fe0,0x0fe0,0x0fe0,0x0fe0,0x0fe0,0x0fe0,0x0fe0,0x0fe0,0x181f,0x181d,0x181d,0x181b,0x181d,0x181b,0x181d,0x181b,0x181d,0x181d,0x181f,0x0fe0,0x0fe0,0x0fe0,0x0fe0,0x0fe0,0x0fe0,0x0fe0,0x0fe0,0x0fe0,0x0fe0,0x0fe0, 0x0f60,0x0f60,0x0f60,0x0f60,0x0f60,0x0f60,0x0f60,0x0f60,0x181d,0x181d,0x181b,0x181b,0x1819,0x1819,0x1817,0x1817,0x1817,0x1819,0x1819,0x181b,0x181b,0x181d,0x181d,0x0f60,0x0f60,0x0f60,0x0f60,0x0f60,0x0f60,0x0f60,0x0f60,0x0f60, 0x0ee0,0x0ee0,0x0ee0,0x0ee0,0x0ee0,0x0ee0,0x181f,0x181d,0x181b,0x1819,0x1819,0x1817,0x1817,0x1815,0x1815,0x1813,0x1815,0x1815,0x1817,0x1817,0x1819,0x1819,0x181b,0x181d,0x181f,0x0ee0,0x0ee0,0x0ee0,0x0ee0,0x0ee0,0x0ee0,0x0ee0, 0x0e60,0x0e60,0x0e60,0x0e60,0x0e60,0x181f,0x181b,0x181b,0x1817,0x1817,0x1813,0x1813,0x1811,0x1811,0x1811,0x1811,0x1811,0x1811,0x1811,0x1813,0x1813,0x1817,0x1817,0x181b,0x181b,0x181f,0x0e60,0x0e60,0x0e60,0x0e60,0x0e60,0x0e60, 0x0dc0,0x0dc0,0x0dc0,0x0dc0,0x181f,0x181b,0x181b,0x1817,0x1815,0x1813,0x1813,0x100e,0x100e,0x100e,0x100e,0x100c,0x100e,0x100e,0x100e,0x100e,0x1813,0x1813,0x1815,0x1817,0x181b,0x181b,0x181f,0x0dc0,0x0dc0,0x0dc0,0x0dc0,0x0dc0, 0x0d40,0x0d40,0x0d40,0x181f,0x181b,0x1819,0x1815,0x1815,0x1811,0x1811,0x100e,0x100c,0x100a,0x100c,0x100a,0x100a,0x100a,0x100c,0x100a,0x100c,0x100e,0x1811,0x1811,0x1815,0x1815,0x1819,0x181b,0x181f,0x0d40,0x0d40,0x0d40,0x0d40, 0x0cc0,0x0cc0,0x0cc0,0x181d,0x181b,0x1817,0x1815,0x1811,0x1811,0x100c,0x100c,0x100a,0x100a,0x1008,0x1008,0x1008,0x1008,0x1008,0x100a,0x100a,0x100c,0x100c,0x1811,0x1811,0x1815,0x1817,0x181b,0x181d,0x0cc0,0x0cc0,0x0cc0,0x0cc0, 0x0c40,0x0c40,0x181d,0x181b,0x1817,0x1815,0x1811,0x1811,0x100c,0x100c,0x1008,0x1008,0x1006,0x1006,0x1006,0x1006,0x1006,0x1006,0x1006,0x1008,0x1008,0x100c,0x100c,0x1811,0x1811,0x1815,0x1817,0x181b,0x181d,0x0c40,0x0c40,0x0c40, 0x03a0,0x03a0,0x181d,0x1819,0x1817,0x1813,0x1811,0x100c,0x100c,0x1008,0x1008,0x1006,0x1006,0x1004,0x1004,0x1004,0x1004,0x1004,0x1006,0x1006,0x1008,0x1008,0x100c,0x100c,0x1811,0x1813,0x1817,0x1819,0x181d,0x03a0,0x03a0,0x03a0, 0x0320,0x181f,0x181b,0x1817,0x1813,0x1811,0x100e,0x100c,0x1008,0x1008,0x1006,0x1004,0x1002,0x1004,0x1002,0x1002,0x1002,0x1004,0x1002,0x1004,0x1006,0x1008,0x1008,0x100c,0x100e,0x1811,0x1813,0x1817,0x181b,0x181f,0x0320,0x0320, 0x02a0,0x181d,0x181b,0x1817,0x1813,0x100e,0x100e,0x100a,0x1008,0x1006,0x1006,0x1004,0x1004,0x1002,0x1002,0x1000,0x1002,0x1002,0x1004,0x1004,0x1006,0x1006,0x1008,0x100a,0x100e,0x100e,0x1813,0x1817,0x181b,0x181d,0x02a0,0x02a0, 0x0220,0x181d,0x1819,0x1815,0x1811,0x100e,0x100a,0x100a,0x1006,0x1006,0x1002,0x1002,0x1000,0x1002,0x1000,0x1000,0x1000,0x1002,0x1000,0x1002,0x1002,0x1006,0x1006,0x100a,0x100a,0x100e,0x1811,0x1815,0x1819,0x181d,0x0220,0x0220, 0x181f,0x181b,0x1819,0x1815,0x1813,0x100e,0x100c,0x1008,0x1008,0x1004,0x1004,0x1002,0x1002,0x1000,0x1000,0x1000,0x1000,0x1000,0x1002,0x1002,0x1004,0x1004,0x1008,0x1008,0x100c,0x100e,0x1813,0x1815,0x1819,0x181b,0x181f,0x0180, 0x181f,0x181b,0x1817,0x1815,0x1811,0x100e,0x100a,0x1008,0x1006,0x1004,0x1002,0x1002,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1002,0x1002,0x1004,0x1006,0x1008,0x100a,0x100e,0x1811,0x1815,0x1817,0x181b,0x181f,0x0100, 0x181f,0x181b,0x1819,0x1813,0x1811,0x100c,0x100c,0x1008,0x1006,0x1004,0x1004,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1004,0x1004,0x1006,0x1008,0x100c,0x100c,0x1811,0x1813,0x1819,0x181b,0x181f,0x0080, 0x181f,0x181b,0x1817,0x1815,0x1811,0x100e,0x100a,0x1008,0x1006,0x1004,0x1002,0x1002,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1002,0x1002,0x1004,0x1006,0x1008,0x100a,0x100e,0x1811,0x1815,0x1817,0x181b,0x181f,0x0000, 0x181f,0x181b,0x1819,0x1815,0x1813,0x100e,0x100c,0x1008,0x1008,0x1004,0x1004,0x1002,0x1002,0x1000,0x1000,0x1000,0x1000,0x1000,0x1002,0x1002,0x1004,0x1004,0x1008,0x1008,0x100c,0x100e,0x1813,0x1815,0x1819,0x181b,0x181f,0x0080, 0x0100,0x181d,0x1819,0x1815,0x1811,0x100e,0x100a,0x100a,0x1006,0x1006,0x1002,0x1002,0x1000,0x1002,0x1000,0x1000,0x1000,0x1002,0x1000,0x1002,0x1002,0x1006,0x1006,0x100a,0x100a,0x100e,0x1811,0x1815,0x1819,0x181d,0x0100,0x0100, 0x0180,0x181d,0x181b,0x1817,0x1813,0x100e,0x100e,0x100a,0x1008,0x1006,0x1006,0x1004,0x1004,0x1002,0x1002,0x1000,0x1002,0x1002,0x1004,0x1004,0x1006,0x1006,0x1008,0x100a,0x100e,0x100e,0x1813,0x1817,0x181b,0x181d,0x0180,0x0180, 0x0220,0x181f,0x181b,0x1817,0x1813,0x1811,0x100e,0x100c,0x1008,0x1008,0x1006,0x1004,0x1002,0x1004,0x1002,0x1002,0x1002,0x1004,0x1002,0x1004,0x1006,0x1008,0x1008,0x100c,0x100e,0x1811,0x1813,0x1817,0x181b,0x181f,0x0220,0x0220, 0x02a0,0x02a0,0x181d,0x1819,0x1817,0x1813,0x1811,0x100c,0x100c,0x1008,0x1008,0x1006,0x1006,0x1004,0x1004,0x1004,0x1004,0x1004,0x1006,0x1006,0x1008,0x1008,0x100c,0x100c,0x1811,0x1813,0x1817,0x1819,0x181d,0x02a0,0x02a0,0x02a0, 0x0320,0x0320,0x181d,0x181b,0x1817,0x1815,0x1811,0x1811,0x100c,0x100c,0x1008,0x1008,0x1006,0x1006,0x1006,0x1006,0x1006,0x1006,0x1006,0x1008,0x1008,0x100c,0x100c,0x1811,0x1811,0x1815,0x1817,0x181b,0x181d,0x0320,0x0320,0x0320, 0x03a0,0x03a0,0x03a0,0x181d,0x181b,0x1817,0x1815,0x1811,0x1811,0x100c,0x100c,0x100a,0x100a,0x1008,0x1008,0x1008,0x1008,0x1008,0x100a,0x100a,0x100c,0x100c,0x1811,0x1811,0x1815,0x1817,0x181b,0x181d,0x03a0,0x03a0,0x03a0,0x03a0, 0x0c40,0x0c40,0x0c40,0x181f,0x181b,0x1819,0x1815,0x1815,0x1811,0x1811,0x100e,0x100c,0x100a,0x100c,0x100a,0x100a,0x100a,0x100c,0x100a,0x100c,0x100e,0x1811,0x1811,0x1815,0x1815,0x1819,0x181b,0x181f,0x0c40,0x0c40,0x0c40,0x0c40, 0x0cc0,0x0cc0,0x0cc0,0x0cc0,0x181f,0x181b,0x181b,0x1817,0x1815,0x1813,0x1813,0x100e,0x100e,0x100e,0x100e,0x100c,0x100e,0x100e,0x100e,0x100e,0x1813,0x1813,0x1815,0x1817,0x181b,0x181b,0x181f,0x0cc0,0x0cc0,0x0cc0,0x0cc0,0x0cc0, 0x0d40,0x0d40,0x0d40,0x0d40,0x0d40,0x181f,0x181b,0x181b,0x1817,0x1817,0x1813,0x1813,0x1811,0x1811,0x1811,0x1811,0x1811,0x1811,0x1811,0x1813,0x1813,0x1817,0x1817,0x181b,0x181b,0x181f,0x0d40,0x0d40,0x0d40,0x0d40,0x0d40,0x0d40, 0x0dc0,0x0dc0,0x0dc0,0x0dc0,0x0dc0,0x0dc0,0x181f,0x181d,0x181b,0x1819,0x1819,0x1817,0x1817,0x1815,0x1815,0x1813,0x1815,0x1815,0x1817,0x1817,0x1819,0x1819,0x181b,0x181d,0x181f,0x0dc0,0x0dc0,0x0dc0,0x0dc0,0x0dc0,0x0dc0,0x0dc0, 0x0e60,0x0e60,0x0e60,0x0e60,0x0e60,0x0e60,0x0e60,0x0e60,0x181d,0x181d,0x181b,0x181b,0x1819,0x1819,0x1817,0x1817,0x1817,0x1819,0x1819,0x181b,0x181b,0x181d,0x181d,0x0e60,0x0e60,0x0e60,0x0e60,0x0e60,0x0e60,0x0e60,0x0e60,0x0e60, 0x0ee0,0x0ee0,0x0ee0,0x0ee0,0x0ee0,0x0ee0,0x0ee0,0x0ee0,0x0ee0,0x0ee0,0x181f,0x181d,0x181d,0x181b,0x181d,0x181b,0x181d,0x181b,0x181d,0x181d,0x181f,0x0ee0,0x0ee0,0x0ee0,0x0ee0,0x0ee0,0x0ee0,0x0ee0,0x0ee0,0x0ee0,0x0ee0,0x0ee0, 0x0f60,0x0f60,0x0f60,0x0f60,0x0f60,0x0f60,0x0f60,0x0f60,0x0f60,0x0f60,0x0f60,0x0f60,0x0f60,0x181f,0x181f,0x181f,0x181f,0x181f,0x0f60,0x0f60,0x0f60,0x0f60,0x0f60,0x0f60,0x0f60,0x0f60,0x0f60,0x0f60,0x0f60,0x0f60,0x0f60,0x0f60, 0x0fe0,0x0fe0,0x0fe0,0x0fe0,0x0fe0,0x0fe0,0x0fe0,0x0fe0,0x0fe0,0x0fe0,0x0fe0,0x0fe0,0x0fe0,0x0fe0,0x0fe0,0x0fe0,0x0fe0,0x0fe0,0x0fe0,0x0fe0,0x0fe0,0x0fe0,0x0fe0,0x0fe0,0x0fe0,0x0fe0,0x0fe0,0x0fe0,0x0fe0,0x0fe0,0x0fe0,0x0fe0 ])n2d.initBuffering()n2d.clearBuffer(0xf000)for(local i = 1; i < 200; i++){ n2d.drawSpriteScaled(sprite, 160, 120, i, i, 0, 0) n2d.drawLine(i, i, i*2, 240, 0x0000) n2d.updateScreen() }for(local i = 0; i < 480; i++) n2d.updateScreen()n2d.deinitBuffering()

local function func(){ return 42}# Explicit root table setting. I'm setting a global variable called a which contains the function func at the index f.::a <- {"f" : f}

dofile("test.nut") // Loads fileprint(a.f()) // a is now in the root table (::), so you can call its function f.// And it'll print '42'

FacebookandTwitterFollow @Codewalr_us