Editing Varvara

Jump to navigation Jump to search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.

Latest revision Your text
Line 64: Line 64:
The two reserved devices can be used for implementation specific features that do not need to be part of the specs, or other Uxn/Varvara instances.
The two reserved devices can be used for implementation specific features that do not need to be part of the specs, or other Uxn/Varvara instances.


== Uxntal ==


According to the implentation spec, "Tal is the programming language for the Uxn virtual machine." Tal, commonly referred to as '''Uxntal''', is a unique flavor of assembly language. Uxntal source files are assembled from human-readable source files into Uxn-compatible ROM files with the .tal extension.
The language itself works similarly to Forth, another stack-based language.
=== Opcodes ===
Uxn can perform 32 different operations, and each operation has 3 possible modes. The items in the following table include the Program Counter(PC), Memory(M), Devices(D) and Return Stack(rs).
{| class="wikitable"
|-
!colspan="2"|Stack
!colspan="2"|Memory
|-
| '''BRK/LIT''' - Literal
| a b c M[PC+1]
| '''LDZ''' - Load Zeropage
| a b M[c8]
|-
| '''INC''' - Increment
| a b c+1
| '''STZ''' - Save Zeropage
| a {M[c8]=b}
|-
| '''POP''' - Pop
| a b
| '''LDR''' - Load Rel
| a b M[PC+c8]
|-
| '''NIP''' - Nip
| a c
| '''STR''' - Save Rel
| a {M[PC+c8]=b}
|-
| '''SWP''' - Swap
| a c b
| '''LDA''' - Load Abs
| a b M[c16]
|-
| '''ROT''' - Rotate
| c b a
| '''STA''' - Save Abs
| a {M[c16]=b}
|-
| '''DUP''' - Duplicate
| a b c c
| '''DEI''' - Device In
| a b D[c8]
|-
| '''OVR''' - Over
| a b c b
| '''DEO''' - Device Out
| a {D[c8]=b}
|-
!colspan="2"|Logic
!colspan="2"|Arithmetic
|-
| '''EQU''' - Equal
| a b?c
| '''ADD''' - Add
| a b+c
|-
| '''NEQ''' - Not Equal
| a b!c
| '''SUB''' - Subtract
| a b-c
|-
| '''GTH''' - Greater
| a b>c
| '''MUL''' - Multiply
| a b*c
|-
| '''LTH''' - Lesser
| a b<c
| '''DIV''' - Divide
| a b/c<br />
|-
| '''JMP''' - Jump<br />
| a b {PC+=c}
| '''AND''' - And
| a b&c
|-
| '''JCN''' - JumpCond
| a {(b8)PC+=c}
| '''ORA''' - Or
| <nowiki>a b|c</nowiki>
|-
| '''JSR''' - JumpStash
| a b {rs.PC PC+=c}
| '''EOR''' - ExclusiveOr
| a b^c
|-
| '''STH''' - Stash
| a b {rs.c}
| '''SFT''' - Shift
| a b>>c8l<<c8h
|}


The Uxn CPU reads one byte at a time from the main memory starting at 0100. The program counter is a 16-bit word that indicates the address of the byte to read next. Each byte read corresponds to an opcode which  may cause a change in the stack(s) or the normal flow of the program counter; instead of pointing to the next byte in memory, it can be made to point elsewhere, "jumping" from one place in memory to another.  
The Uxn CPU reads one byte at a time from the main memory starting at 0100. The program counter is a 16-bit word that indicates the address of the byte to read next. Each byte read corresponds to an opcode which  may cause a change in the stack(s) or the normal flow of the program counter; instead of pointing to the next byte in memory, it can be made to point elsewhere, "jumping" from one place in memory to another.  
Please note that all contributions to Fantasy Console Wiki are considered to be released under the Creative Commons Zero (Public Domain) (see FCWiki:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!
Cancel Editing help (opens in new window)

Template used on this page: