browser

Syntax

syntax
calendarsave
The syntax of xyw is deliberately minimalist and simple, and a cross between 6502/6809-style assembly and Forth. Only the following token types are defined: dot-single comments dot-single numbers dot-single instructions dot-single directives dot-single symbols === Comments Comments are line-oriented only, and prefixed with a semicolon:
; this is a comment (till end of line)
=== Numbers Only one or two byte integers are supported. They can be either unsigned or signed (via two's complement), and they range between: dot-single 0 and 65535 (unsigned) dot-single -32768 and 32767 (signed) Numbers can be written either in base 16 (hexadecimal) without sign and prefixed with a dollar:
$F2   ; byte   (one byte)
$34BB ; word   (two bytes)
or in base 2 (binary) without sign and prefixed with a percent:
%11011000
%00100101
Note that: dot-single bytes and words can be represented in hexadecimal format dot-single only single bytes can be represented in binary format === Instructions xyw has 32 instructions that are written as uppercase three-letter mnemonics and may be followed by 1-3 lowercase mode flags (x, y, or w):
ADDxy ; add register x with y
LDBx  ; load one byte from register x
STByw ; store a byte from address in register yw
=== Directives xyw provides some directives that are used to instruct the assembler to do certain operations, like create a label or reserve bytes. They are single words prefixed with a dot, and they may or may not have arguments, but they cannot span more than one line:
.macro square DUP MUL
.label main
.string "Hello!\n"
=== Symbols Symbols are user-created identifiers that are defined via either the .label or .macro directive:
main
fact.loop