Table of contents

UXN

virtual_machine

%3 cluster_63d9a43e_f462_4b80_b9d1_5d81b0447c69 UXN cluster_26545635_e603_42c8_812d_5fb79aa1a7c5 [3/7] Compudanzas' UXN tutorial _ba7f4525_2b3f_4e5c_9281_98a9206ed401 Day 7 _628e073f_c1fc_4c91_9f3d_f8a19816ffa1 Day 5 _ff567c42_bafb_44ab_b2c9_b563a0288d5b Day 1 _c56b801c_ddf5_4c0c_becd_59b227f80dcc Day 4 _89033ccc_ab34_4c61_a401_13037959e28a Day 2 _260252de_6794_463b_8c3c_2597ecdf5a8b Day 6 _17a56790_cda9_4600_a766_01e16d0e4843 Day 3 _644f8480_3c7f_482e_bfb5_f2afa8a5459b Hundred Rabbits _eca5676b_3bf6_4d87_998a_01345586ffd7 Permacomputing _f3caa4fb_8320_4b32_b502_2a8648894ec6 Compudanzas _f3caa4fb_8320_4b32_b502_2a8648894ec6->__0:cluster_26545635_e603_42c8_812d_5fb79aa1a7c5 _59b70d27_4aea_497e_858b_ad72eccd76bb Forth _01495378_a3ed_497c_b299_b75897828784 Curto _01495378_a3ed_497c_b299_b75897828784->__1:cluster_63d9a43e_f462_4b80_b9d1_5d81b0447c69 __2:cluster_63d9a43e_f462_4b80_b9d1_5d81b0447c69->_644f8480_3c7f_482e_bfb5_f2afa8a5459b __3:cluster_63d9a43e_f462_4b80_b9d1_5d81b0447c69->_eca5676b_3bf6_4d87_998a_01345586ffd7 __4:cluster_63d9a43e_f462_4b80_b9d1_5d81b0447c69->_59b70d27_4aea_497e_858b_ad72eccd76bb

UXN is a minimalistic CPU/virtual machine designed by Hundred Rabbits.

Interesting features, coding-paradigm-wise:

SOMETIME

[ 3/7 ] Compudanzas' UXN tutorial

web_pagetutorial

A UXN tutorial divided in days. Each day covers a number of concepts and instructions from the VM.

DONE

Day 1

  • Url

    https://compudanzas.net/uxn_tutorial_day_1.html

  • Explains the basic concepts of the UXN CPU

    • CPU

      • Can handle words of 1 or two bytes

      • Each instruction is encoded in 1 byte

        • 32 possible instructions + 3 mode flags

    • Memory

      • Four separate spaces

        • main memory

          64 Kibibytes

          • First 256 bytes are "zero page", which can be accessed with 1 byte

          • Stores the program to be executed, starting at

            0x0100

        • i/o memory

          256 bytes divided in 16 sections/devices of 16bytes each

        • working stack

          256 bytes

          • cannot be accessed randomly

        • return stack

          256 bytes

          • cannot be accessed randomly

  • Writes, runs and goes step-by-step describing a "hello-world" program.

  • Explains [ UXNtal ] concepts

    • Runes

runes are special characters that indicate to uxnasm some pre-processing to do when assembling our programs.
  • Absolute pad

    |

    • Pads up elements until a memory position is reached

  • Literal hex

    #

    • Rewrites #AA to LIT AA

  • Raw character

    '

    • Rewrites 'h to 68 (note that in this case LIT may be necessary)

  • Labels

    @ and & to define, . and / to use

    • Can be used to define something like struct-offset macros (difficult to explain in few words).

  • Macros

    %<NAME> to define, just "<name>" to invoke

DONE

Day 2

  • Shows screen usage

    • Pixel drawing

    • Sprite drawing

  • Runes

    • Literal absolute

      ;

      • Push the address of a @ label to the stack

DONE

Day 3

  • Presents

    • the @Controller device

      • Used to receive keyboard (and game controller) events

      • Arrow keys and Ctrl are handled by using the .Controller/button register

    • control flow mechanisms

    • bitwise logic

    • stack manipulation

    • runes for addresses

      • .label

        literal address in zero page

      • ;label

        literal address in main memory

      • ,label

        literal relative address in main memory

      • :label

        main addres in main memory

      • @label

        Label definition

      • &sublabel

        Definition of a sublabel

        • Refer to it as label/sublabel

        • Or just &sublabel for local sublabels

SOMETIME

Day 4

  • Presents

    • How to use the .Screen/vector to interrupt the program at 60Hz

  • Stopped at

    initial values

SOMETIME

Day 5

SOMETIME

Day 6

SOMETIME

Day 7