// I've just stolen the example code! hahaha // Note that UXNSMAL is VERY INCOMPLETE! // Anything could be changed without any notice. // There is also no documentation, you're on your own. // Good luck. // // http://github.com/bbogdan-ov/uxnsmal // // Hot keys: // Ctrl-Enter - Compile and run // This vector function is the entry point of your program. fun on-reset ( -> ) { // Setting the screen size to 128 by 128 pixels. 128* Screen.width output 128* Screen.height output // Setup the palette. // The first color is the background of our screen. // Our palette looks like this: // #fff, #000, #7db, #f62 // You can read more here: // https://wiki.xxiivv.com/site/varvara.html#system 0xf07f* System.red output 0xf0d6* System.green output 0xf0b2* System.blue output // Placing the sprite at 16, 28 pixels // from top left corner of the screen. 16* Screen.x output 28* Screen.y output // Setting the sprite data to draw. &smiley Screen.addr output // Drawing the sprite using the 4th color in the palette. 0b00000011 Screen.sprite output // Setting the top-left corner of the fill at 64, 64. 64* Screen.x output 64* Screen.y output // Fill the screen with the 3rd color in palette // to the bottom-right corner of the screen. 0b10000010 Screen.pixel output // A better explanation here: // https://wiki.xxiivv.com/site/varvara.html#screen } // Try playing with ones and zeros! data smiley { 0b01111110 0b11111111 0b10111101 0b10111101 0b11111111 0b10111101 0b11000011 0b01111110 } // Here is all the devices you need to start doing things: alias enum byte System { expansion { 0x02 } wst { 0x04 } rst { 0x05 } metadata { 0x06 } red { 0x08 } green { 0x0a } blue { 0x0c } debug { 0x0e } state { 0x0f } } alias enum byte Screen { vector { 0x20 } width { 0x22 } height { 0x24 } auto { 0x26 } x { 0x28 } y { 0x2a } addr { 0x2c } pixel { 0x2e } sprite { 0x2f } } alias enum byte Controller { vector { 0x80 } button { 0x82 } key { 0x83 } } alias enum byte Mouse { vector { 0x90 } x { 0x92 } y { 0x94 } state { 0x96 } scrollx { 0x9a } scrolly { 0x9c } } alias enum byte Datetime { year { 0xc0 } month { 0xc2 } day { 0xc3 } hour { 0xc4 } minute { 0xc5 } second { 0xc6 } dotw { 0xc7 } doty { 0xc8 } isdst { 0xca } }
home
run
go to the original snippet
smiley and a rectangle!
1 month ago
@lobo
0 flowers and 0 comments
x1