summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore3
-rw-r--r--CHANGELOG.md8
-rw-r--r--Cargo.toml2
-rw-r--r--README.md3
-rw-r--r--docs/aas.tex219
-rw-r--r--src/aas.rs10
-rw-r--r--src/app.rs8
-rw-r--r--src/app/init.rs8
-rw-r--r--src/app/main.rs8
-rw-r--r--src/app/print_help.rs8
-rw-r--r--src/app/print_version.rs8
-rw-r--r--src/app/run.rs8
-rw-r--r--src/cpu.rs8
-rw-r--r--src/format.rs8
-rw-r--r--src/is_valid_character.rs9
-rw-r--r--src/log.rs8
-rw-r--r--src/token.rs10
-rw-r--r--src/token/tokenise.rs10
18 files changed, 288 insertions, 58 deletions
diff --git a/.gitignore b/.gitignore
index 60b7f3b..49ac90b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,3 @@
-*.bin
-vgcore.*
+/docs/build
/target
Cargo.lock
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b0a3523..47d8a25 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,11 @@
+# 0.1.0
+
+* Bump minor version
+* Add manual
+* Update gitignore
+* Add readme
+* Update license notices
+
# 0.0.0
* Add gitignore
diff --git a/Cargo.toml b/Cargo.toml
index 3840637..a225708 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "aas"
-version = "0.0.0"
+version = "0.1.0"
authors = ["Gabriel Bjørnager Jensen"]
edition = "2021"
description = "Arm assembler."
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..381dd32
--- /dev/null
+++ b/README.md
@@ -0,0 +1,3 @@
+# AAS
+
+Compile the manual using `mkdir -p docs/build && pdflatex --output-directory="docs/build" "docs/aas.tex"`.
diff --git a/docs/aas.tex b/docs/aas.tex
new file mode 100644
index 0000000..6ded09e
--- /dev/null
+++ b/docs/aas.tex
@@ -0,0 +1,219 @@
+\documentclass[a4paper]{article}
+
+\usepackage[english]{babel}
+\usepackage{fancyhdr}
+\usepackage[T1]{fontenc}
+\usepackage[margin=2cm]{geometry}
+\usepackage[hidelinks, pdfusetitle]{hyperref}
+\usepackage{lastpage}
+\usepackage{parskip}
+\usepackage{titlesec}
+\usepackage{varwidth}
+
+\newcommand{\documenttitle}{Using AAS}
+
+\title{\documenttitle}
+\author{Gabriel Bjørnager Jensen}
+\date{2023-12-31}
+
+\pagestyle{fancy}
+\fancyhf{}
+\renewcommand{\headrulewidth}{0pt}
+\fancyhead[c]{\bfseries \documenttitle}
+\fancyfoot[c]{Page $\thepage\over\pageref{LastPage}$}
+
+\titleformat{\section}{\huge\bfseries}{\thesection}{1ex}{}{}
+\titleformat{\subsection}{\large\bfseries}{\thesubsection}{1ex}{}{}
+
+\begin{document}
+ \pagenumbering{gobble}
+ \thispagestyle{empty}
+
+ \vspace*{\fill}
+ \centerline{\huge\bfseries\documenttitle}
+ \vspace*{\fill}
+
+ \clearpage
+ \pagenumbering{arabic}
+ \begin{center}
+ Copyright © 2023 Gabriel Bjørnager Jensen.
+
+ This manual is licensed under a Creative Commons Attribution-ShareAlike-4.0 International license.
+
+ See more at \url{https://creativecommons.org/licenses/by-sa/4.0/}.
+ \end{center}
+
+ \clearpage
+ \tableofcontents
+
+ \clearpage
+ \section{About AAS}
+ AAS -- \textit{Arm Assembler} -- is a cross-assembler for the ARM Instruction Set Architecture.
+
+ \clearpage
+ \section{Setup}
+ \subsection{Download}
+ AAS may be downloaded in source form from one of the following official mirrors:
+
+ \begin{center}
+ \begin{varwidth}{\linewidth}
+ \url{https://mandelbrot.dk/aas}
+
+ \url{https://gitlab.com/bjoernager/aas.git}
+
+ \url{https://github.com/bjoernager/aas.git}
+ \end{varwidth}
+ \end{center}
+
+ \subsection{Installation}
+ A PKGBUILD for AAS will likely be provided in the near future at \url{https://mandelbrot.dk/pkgbuild_aas}.
+
+ \clearpage
+ \section{Usage}
+ Invoke the assembler using the \texttt{aas} command:
+
+ \begin{center}
+ \ttfamily
+ aas \textit{[options]} <input>
+ \end{center}
+
+ Wherein \textit{options} may be any combination of the following parameters:
+
+ \begin{itemize}
+ \item -f\quad{} Sets the target executable format
+ \item -h\quad{} Prints help
+ \item -m\quad{} Sets the target CPU
+ \item -v\quad{} Prints the version number
+ \end{itemize}
+
+ \subsection{Supported Target CPUs}
+ Only the following identifier is supported when provided to the \texttt{-m} parameter:
+
+ \begin{itemize}
+ \item arm7tdmi
+ \end{itemize}
+
+ \subsection{Supported Target Executable Formats}
+ Only the following identifier is supported when provided to the \texttt{-f} parameter:
+
+ \begin{itemize}
+ \item elf
+ \end{itemize}
+
+ \clearpage
+ \section{Syntax}
+ The AAS syntax is designed to be largely compatible with the GAS syntax as well as that of the official armasm assembler.
+
+ Comments are denoted with either a \texttt{;} (semicolon) or an \texttt{@} (commercial at). These comments continue until the end of the current line. Multi-line comments are currently not supported.
+
+ \begin{figure}[h]
+ \centering
+
+ \caption{Example of comments.}
+ \label{fig:comments}
+ \begin{varwidth}{\linewidth}
+ \begin{verbatim}
+ ; This is a comment.
+ @ This is also a comment.
+ mov r0, pc ; This line will be parsed up till the semicolon.
+ /*
+ This is an error (for now).
+ */
+ \end{verbatim}
+ \end{varwidth}
+ \end{figure}
+
+ An identifier prepended with a \texttt{.} (full stop) denotes an assembler directive\footnote{However, if the identifier is also appended with a \texttt{:} (colon), it denotes a label instead.} (see figure \ref{fig:directives}):
+
+ \begin{figure}[h]
+ \centering
+
+ \caption{Example of directives.}
+ \label{fig:directives}
+ \begin{varwidth}{\linewidth}
+ \begin{verbatim}
+ .byte 0x7F ; This embeds the 8-bit value 0xFF.
+ .thumb ; All code after this line will be assembled as Thumb code.
+ \end{verbatim}
+ \end{varwidth}
+ \end{figure}
+
+ An identifier appended with a \texttt{:} (colon) denotes a label (see figure \ref{fig:labels}).
+
+ \begin{figure}[h]
+ \centering
+
+ \caption{Example of labels.}
+ \label{fig:labels}
+ \begin{varwidth}{\linewidth}
+ \begin{verbatim}
+ start: ; This is a label.
+ _start: ; This is also a label.
+ .start: ; This is a label as well.
+ \end{verbatim}
+ \end{varwidth}
+ \end{figure}
+
+ \subsection{Accepted Directives}
+ \subsubsection{arm}
+ \textit{Usage: \texttt{.arm}}
+
+ Specifies that all following code be assembled into ARM (32-bit) opcodes. May be overriden by a new \texttt{.thumb} directive.
+
+ \subsubsection{byte}
+ \textit{Usage: \texttt{.byte <value>}}
+
+ Embeds the 8-bit value \textit{value}.
+
+ \subsubsection{doubleword}
+ \textit{Usage: \texttt{.doubleword <value>}}
+
+ Embeds the 64-bit value \textit{value}.
+
+ \subsubsection{global}
+ \textit{Usage: \texttt{.global}}
+
+ Specifies that the following label shall be externally visible.
+
+ \subsubsection{halfowrd}
+ \textit{Usage: \texttt{.halfword <value>}}
+
+ Embeds the 16-bit value \textit{value}.
+
+ \subsubsection{thumb}
+ \textit{Usage: \texttt{.thumb}}
+
+ Specifies that all following code be assembled into Thumb (16-bit) opcodes. May be overriden by a new \texttt{.arm} directive.
+
+ \subsubsection{word}
+ \textit{Usage: \texttt{.word <value>}}
+
+ Embeds the 32-bit value \textit{value}.
+
+ \subsection{Character Set}
+ AAS requires that all input files be encoded in UTF-8 \textbf{only}.
+
+ Outside of strings and comments, only a small subset of ASCII characters are allowed (see figure \ref{fig:characters}). The presence of any character outside of this subset will yield in an error.
+
+ \begin{figure}[h]
+ \centering
+
+ \caption{ASCII-subset of which character are valid outside strings and comments.}
+ \label{fig:characters}
+ \begin{tabular}{|c|c c c c c c c c c c c c c c c c|}
+ \hline
+ {} & 0 & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & A & B & C & D & E & F \\
+ \hline
+ 0 & \textit{NUL} & {} & {} & {} & {} & {} & {} & {} & {} & \textit{HT} & \textit{LF} & {} & {} & {} & {} & {} \\
+ 1 & {} & {} & {} & {} & {} & {} & {} & {} & {} & {} & {} & {} & {} & {} & {} & {} \\
+ 2 & \textit{SP} & ! & " & \# & {} & {} & {} & {} & {} & {} & * & {} & , & {} & . & {} \\
+ 3 & 0 & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & : & ; & < & {} & > & {} \\
+ 4 & @ & A & B & C & D & E & F & G & H & I & J & K & L & M & N & O \\
+ 5 & P & Q & R & S & T & U & V & W & X & Y & Z & [ & {} & ] & {} & \_ \\
+ 6 & {} & a & b & c & d & e & f & g & h & i & j & k & l & m & n & o \\
+ 7 & p & q & r & s & t & u & v & w & x & y & z & {} & {} & {} & {} & {} \\
+ \hline
+ \end{tabular}
+ \end{figure}
+
+\end{document}
diff --git a/src/aas.rs b/src/aas.rs
index 33ae452..03eba25 100644
--- a/src/aas.rs
+++ b/src/aas.rs
@@ -1,22 +1,22 @@
/*
Copyright 2023 Gabriel Jensen.
- This file is part of aas.
+ This file is part of AAS.
- aas is free software: you can redistribute it
+ AAS is free software: you can redistribute it
and/or modify it under the terms of the GNU
General Public License as published by the Free
Software Foundation, either version 3 of the
License, or (at your option) any later version.
- aas is distributed in the hope that it will
+ AAS is distributed in the hope that it will
be useful, but WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU
- General Public License along with aas. If not,
+ General Public License along with AAS. If not,
see <https://www.gnu.org/licenses/>.
*/
@@ -34,7 +34,7 @@ pub use is_valid_character::*;
pub const VERSION: (u32, u32, u32) = (
0x0, // Major
- 0x0, // Minor
+ 0x1, // Minor
0x0, // Patch
);
diff --git a/src/app.rs b/src/app.rs
index caa9379..74db8a8 100644
--- a/src/app.rs
+++ b/src/app.rs
@@ -1,22 +1,22 @@
/*
Copyright 2023 Gabriel Jensen.
- This file is part of aas.
+ This file is part of AAS.
- aas is free software: you can redistribute it
+ AAS is free software: you can redistribute it
and/or modify it under the terms of the GNU
General Public License as published by the Free
Software Foundation, either version 3 of the
License, or (at your option) any later version.
- aas is distributed in the hope that it will
+ AAS is distributed in the hope that it will
be useful, but WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU
- General Public License along with aas. If not,
+ General Public License along with AAS. If not,
see <https://www.gnu.org/licenses/>.
*/
diff --git a/src/app/init.rs b/src/app/init.rs
index 8ed43ac..6eb0491 100644
--- a/src/app/init.rs
+++ b/src/app/init.rs
@@ -1,22 +1,22 @@
/*
Copyright 2023 Gabriel Jensen.
- This file is part of aas.
+ This file is part of AAS.
- aas is free software: you can redistribute it
+ AAS is free software: you can redistribute it
and/or modify it under the terms of the GNU
General Public License as published by the Free
Software Foundation, either version 3 of the
License, or (at your option) any later version.
- aas is distributed in the hope that it will
+ AAS is distributed in the hope that it will
be useful, but WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU
- General Public License along with aas. If not,
+ General Public License along with AAS. If not,
see <https://www.gnu.org/licenses/>.
*/
diff --git a/src/app/main.rs b/src/app/main.rs
index bd82623..12fe5be 100644
--- a/src/app/main.rs
+++ b/src/app/main.rs
@@ -1,22 +1,22 @@
/*
Copyright 2023 Gabriel Jensen.
- This file is part of aas.
+ This file is part of AAS.
- aas is free software: you can redistribute it
+ AAS is free software: you can redistribute it
and/or modify it under the terms of the GNU
General Public License as published by the Free
Software Foundation, either version 3 of the
License, or (at your option) any later version.
- aas is distributed in the hope that it will
+ AAS is distributed in the hope that it will
be useful, but WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU
- General Public License along with aas. If not,
+ General Public License along with AAS. If not,
see <https://www.gnu.org/licenses/>.
*/
diff --git a/src/app/print_help.rs b/src/app/print_help.rs
index 1df895e..5b77527 100644
--- a/src/app/print_help.rs
+++ b/src/app/print_help.rs
@@ -1,22 +1,22 @@
/*
Copyright 2023 Gabriel Jensen.
- This file is part of aas.
+ This file is part of AAS.
- aas is free software: you can redistribute it
+ AAS is free software: you can redistribute it
and/or modify it under the terms of the GNU
General Public License as published by the Free
Software Foundation, either version 3 of the
License, or (at your option) any later version.
- aas is distributed in the hope that it will
+ AAS is distributed in the hope that it will
be useful, but WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU
- General Public License along with aas. If not,
+ General Public License along with AAS. If not,
see <https://www.gnu.org/licenses/>.
*/
diff --git a/src/app/print_version.rs b/src/app/print_version.rs
index d28e457..cccd08c 100644
--- a/src/app/print_version.rs
+++ b/src/app/print_version.rs
@@ -1,22 +1,22 @@
/*
Copyright 2023 Gabriel Jensen.
- This file is part of aas.
+ This file is part of AAS.
- aas is free software: you can redistribute it
+ AAS is free software: you can redistribute it
and/or modify it under the terms of the GNU
General Public License as published by the Free
Software Foundation, either version 3 of the
License, or (at your option) any later version.
- aas is distributed in the hope that it will
+ AAS is distributed in the hope that it will
be useful, but WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU
- General Public License along with aas. If not,
+ General Public License along with AAS. If not,
see <https://www.gnu.org/licenses/>.
*/
diff --git a/src/app/run.rs b/src/app/run.rs
index 88d0983..e515232 100644
--- a/src/app/run.rs
+++ b/src/app/run.rs
@@ -1,22 +1,22 @@
/*
Copyright 2023 Gabriel Jensen.
- This file is part of aas.
+ This file is part of AAS.
- aas is free software: you can redistribute it
+ AAS is free software: you can redistribute it
and/or modify it under the terms of the GNU
General Public License as published by the Free
Software Foundation, either version 3 of the
License, or (at your option) any later version.
- aas is distributed in the hope that it will
+ AAS is distributed in the hope that it will
be useful, but WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU
- General Public License along with aas. If not,
+ General Public License along with AAS. If not,
see <https://www.gnu.org/licenses/>.
*/
diff --git a/src/cpu.rs b/src/cpu.rs
index 71a82f2..a0bfd05 100644
--- a/src/cpu.rs
+++ b/src/cpu.rs
@@ -1,22 +1,22 @@
/*
Copyright 2023 Gabriel Jensen.
- This file is part of aas.
+ This file is part of AAS.
- aas is free software: you can redistribute it
+ AAS is free software: you can redistribute it
and/or modify it under the terms of the GNU
General Public License as published by the Free
Software Foundation, either version 3 of the
License, or (at your option) any later version.
- aas is distributed in the hope that it will
+ AAS is distributed in the hope that it will
be useful, but WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU
- General Public License along with aas. If not,
+ General Public License along with AAS. If not,
see <https://www.gnu.org/licenses/>.
*/
diff --git a/src/format.rs b/src/format.rs
index b8afcf1..971af7a 100644
--- a/src/format.rs
+++ b/src/format.rs
@@ -1,22 +1,22 @@
/*
Copyright 2023 Gabriel Jensen.
- This file is part of aas.
+ This file is part of AAS.
- aas is free software: you can redistribute it
+ AAS is free software: you can redistribute it
and/or modify it under the terms of the GNU
General Public License as published by the Free
Software Foundation, either version 3 of the
License, or (at your option) any later version.
- aas is distributed in the hope that it will
+ AAS is distributed in the hope that it will
be useful, but WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU
- General Public License along with aas. If not,
+ General Public License along with AAS. If not,
see <https://www.gnu.org/licenses/>.
*/
diff --git a/src/is_valid_character.rs b/src/is_valid_character.rs
index acec7fb..9e16830 100644
--- a/src/is_valid_character.rs
+++ b/src/is_valid_character.rs
@@ -1,27 +1,28 @@
/*
Copyright 2023 Gabriel Jensen.
- This file is part of aas.
+ This file is part of AAS.
- aas is free software: you can redistribute it
+ AAS is free software: you can redistribute it
and/or modify it under the terms of the GNU
General Public License as published by the Free
Software Foundation, either version 3 of the
License, or (at your option) any later version.
- aas is distributed in the hope that it will
+ AAS is distributed in the hope that it will
be useful, but WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU
- General Public License along with aas. If not,
+ General Public License along with AAS. If not,
see <https://www.gnu.org/licenses/>.
*/
pub fn is_valid_character(c: char) -> bool {
return match c {
+ | '\0'
| '\t'
| '\n'
| ' '
diff --git a/src/log.rs b/src/log.rs
index 99601b3..73c24b9 100644
--- a/src/log.rs
+++ b/src/log.rs
@@ -1,22 +1,22 @@
/*
Copyright 2023 Gabriel Jensen.
- This file is part of aas.
+ This file is part of AAS.
- aas is free software: you can redistribute it
+ AAS is free software: you can redistribute it
and/or modify it under the terms of the GNU
General Public License as published by the Free
Software Foundation, either version 3 of the
License, or (at your option) any later version.
- aas is distributed in the hope that it will
+ AAS is distributed in the hope that it will
be useful, but WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU
- General Public License along with aas. If not,
+ General Public License along with AAS. If not,
see <https://www.gnu.org/licenses/>.
*/
diff --git a/src/token.rs b/src/token.rs
index 68b7f4e..52994ae 100644
--- a/src/token.rs
+++ b/src/token.rs
@@ -1,22 +1,22 @@
/*
Copyright 2023 Gabriel Jensen.
- This file is part of aas.
+ This file is part of AAS.
- aas is free software: you can redistribute it
+ AAS is free software: you can redistribute it
and/or modify it under the terms of the GNU
General Public License as published by the Free
Software Foundation, either version 3 of the
License, or (at your option) any later version.
- aas is distributed in the hope that it will
+ AAS is distributed in the hope that it will
be useful, but WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU
- General Public License along with aas. If not,
+ General Public License along with AAS. If not,
see <https://www.gnu.org/licenses/>.
*/
@@ -28,7 +28,7 @@ pub enum Token {
BracketRight,
Colon,
Comma,
- Fullstop,
+ FullStop,
Hashtag,
Return,
StringLiteral(String),
diff --git a/src/token/tokenise.rs b/src/token/tokenise.rs
index 44ce683..d5e569e 100644
--- a/src/token/tokenise.rs
+++ b/src/token/tokenise.rs
@@ -1,22 +1,22 @@
/*
Copyright 2023 Gabriel Jensen.
- This file is part of aas.
+ This file is part of AAS.
- aas is free software: you can redistribute it
+ AAS is free software: you can redistribute it
and/or modify it under the terms of the GNU
General Public License as published by the Free
Software Foundation, either version 3 of the
License, or (at your option) any later version.
- aas is distributed in the hope that it will
+ AAS is distributed in the hope that it will
be useful, but WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU
- General Public License along with aas. If not,
+ General Public License along with AAS. If not,
see <https://www.gnu.org/licenses/>.
*/
@@ -102,7 +102,7 @@ fn get_next_token(input: &str, index: &mut usize) -> Result<Option<Token>, Strin
'\n' => return Ok(Some(Return)),
'[' => return Ok(Some(BracketLeft)),
']' => return Ok(Some(BracketRight)),
- '.' => return Ok(Some(Fullstop)),
+ '.' => return Ok(Some(FullStop)),
',' => return Ok(Some(Comma)),
':' => return Ok(Some(Colon)),
'#' => return Ok(Some(Hashtag)),