-w=warning
Toggle warnings: a=all, o=overflow
-.SH PREPROCESSOR
-
-The preprocessor is a text based way of modifying the input before
-the assembly step. Stray tokens after a directive are ignored!
-
-Preprocessor directives start with a # and have to be the first non-space character in a line.
-All lines that are not a preprocessor directive, or are not part of a preprocessor block (macro, or if)
-will be output as-is. If a line contains the name of a preprocessot define or macro
-,surrounded by token any character that is not alphanumeric or an underscore,
-the define or macro will be expanded.
-
-Withing preprocessor macros
-- $0 will expand to the literal argument string
-- $1 to $9 will expand to the comma separated arguments of the macro
-- $$ will insert a unique numeric literal
-
-Macros:
-
-#macro my_macro
-label$$:
- adc $1, $2
-#endmacro
-
-my_macro a, b
-
-Define:
-
-#define name value
-name ; will be replaced with 'value'
-#undefine name
-
-.SH ASSEMBLY SYNTAX
-
-
-
-.SH EXPRESSION SYNTAX
-
-Expressions are written in Reverse Polish Notation style and evaluated based on their expected data type.
-For example when an expression expects an int type the expression will assume all values that are pushed to it
-are integers.
-
-.SH ASSEMBLY DIRECTIVES
-
-During assembly sometimes it is required to set certain parameters of the assembler such as the base address (represented by the $@ symbol in expressions).
-
-Valid directives:
-
- \.org <expression>
- Sets the base address
-
.SH EXAMPLES
ulas -o example.gb ./src/main.s
.SH SEE ALSO
+ ulas(5) for a syntax reference.
+
The documentation for make(1) for compilation instructions.
A compiler documentation such as cc(1) gcc(1) or clang(1).
--- /dev/null
+.\" Manpage for ulas.
+.\" Contact lukas@krickl.dev to correct errors or typos.
+
+.TH man 1 "29 October 2024" "0.0.1" "ulas language reference"
+
+.SH PREPROCESSOR
+
+The preprocessor is a text based way of modifying the input before
+the assembly step. Stray tokens after a directive are ignored!
+
+Preprocessor directives start with a # and have to be the first non-space character in a line.
+All lines that are not a preprocessor directive, or are not part of a preprocessor block (macro, or if)
+will be output as-is. If a line contains the name of a preprocessot define or macro
+,surrounded by token any character that is not alphanumeric or an underscore,
+the define or macro will be expanded.
+
+.SH Macros:
+
+Within preprocessor macros
+- $0 will expand to the literal argument string
+- $1 to $9 will expand to the comma separated arguments of the macro
+- $$ will insert a unique numeric literal
+
+#macro my_macro
+.br
+label$$:
+.br
+ adc $1, $2
+.br
+#endmacro
+
+my_macro a, b
+
+.SH Define:
+
+#define name value
+name ; will be replaced with 'value'
+
+.SH Undefine:
+
+#undefine name
+name will be undefined
+
+.SH ifdef:
+
+#ifdef [defined value]
+.br
+ <instructions>
+.br
+#endif
+
+If the symbol is defined everything inside of ifdef will be assembled.
+If it is undefined it will be skipped.
+
+.SH ifndef:
+
+#ifndef [defined value]
+.br
+ <instructions>
+.br
+#endif
+
+The inverse of ifdef.
+
+.SH include:
+
+#include "path/to/file.s"
+
+This will include the literal file into the assembly input.
+
+.SH ASSEMBLY SYNTAX
+
+.SH ASSEMBLY DIRECTIVES
+
+During assembly sometimes it is required to set certain parameters of the assembler such as the base address (represented by the $@ symbol in expressions).
+The special value $ will evaluate to the current address.
+
+.SH org:
+
+ \.org <expression>
+ Sets the base address
+
+.SH set
+ \.set variable = <expression>
+ Sets a previously defined expression
+
+.SH db
+ \.db value[, value...]
+ Defines a sequence of bytes.
+
+.SH str
+ \.str "String"
+ Defines a literal string
+
+.SH fill
+ \.fill <value>, <n>
+ \.fill <value>, $ - n
+ Fills the rom for n bytest.
+
+.SH incbin
+ \.incbin "path/to/file.bin"
+ Includes a literal binary file.
+
+.SH def
+ \.def int int_val = 1
+ \.def str str_vale = "hello"
+ Defines a variable
+
+.SH chksm
+ \.chksm
+ Inserts a checksum into the rom.
+ Can be used for header.
+
+.SH adv
+ \.adv <n>
+ Advances address by n bytest but does not emit data.
+
+.SH se
+ \.se <n>
+ Sets a global enumerator value.
+
+.SH .de
+ \.de <name>, <len>
+ Defines a name for the current se value and advances se by len.
+
+.SH scc
+ \.scc 'a' = 'b'
+ Re-defines the ascii value for one character to another value.
+ Can be used for custom encodings.
+
+.SH .chr
+ \.chr 01233213
+ Outputs a byte as a 2bpp sprite.
+ Must have exactly 8 values ranging from 0-3
+
+.SH rep
+ \.rep <counter>, <n>, <step>, <instruction>
+ Repeats the instruction n times advancing from 0 by step each iteration.
+ The first parameter is a counter value that allows the instruction to access the
+ current iterator value.
+.SH SEE ALSO
+
+ ulas(1) for a rference on how to use ulas.
+
+.SH AUTHOR
+ Lukas Krickl (lukas@krickl.dev)
+
+.SH COPYRIGHT
+ Copyright 2024 Lukas Krickl (lukas@krickl.dev)