~swisschili/toolchain-6502

e392aeb7d2eec0f1d06eb574cf66579148738809 — swissChili 3 months ago ad75d54
Add docs
D colors.webm => colors.webm +0 -0

A docs/build.lua => docs/build.lua +15 -0
@@ 0,0 1,15 @@
require "blackjack"

site = Site

-- site.processors.md = markdownProcessor
site.processors.scss = {
	process = cmdProcessor("sass -"),
	extension = "css"
}
site.processors.webm = {
	process = cmdProcessor("cat"),
	extension = "webm"
}

site:build()

A docs/build.sh => docs/build.sh +9 -0
@@ 0,0 1,9 @@
luajit build.lua

CURRENT_WID=$(xdotool getwindowfocus)

WID=$(xdotool search --name "Mozilla Firefox")
xdotool windowactivate $WID
xdotool key F5

xdotool windowactivate $CURRENT_WID

A docs/content/CNAME => docs/content/CNAME +1 -0
@@ 0,0 1,1 @@
6502.swisschili.sh
\ No newline at end of file

A docs/content/building.md => docs/content/building.md +29 -0
@@ 0,0 1,29 @@
@parent = page.html
@title = Building

# Building from source

You need the following libraries installed to build the emulator:

`pthread` `rt` `m` `SDL2` `GL` `GLEW` `GLU` `readline`

The first three will be included on any POSIX compliant operating system (OS X, Linux, BSD, etc).
To install SDL2, visit its <a href="https://www.libsdl.org/">website</a> or use your distributions
package manager.

<br>
You also need `awk` installed if you want to modify the `6502.csv` file from which parts of the
emulator are generated. If you don't want to do this, run cmake with `-DGEN_INSTRUCTIONS_HEADER=OFF`

<br>
You may be able to build this on Windows using Cygwin or MinGW, but I haven't tested that.

<br>
Run the usual commands to build with cmake:
```
$ mkdir build
$ cd build
$ cmake ..
$ make -j
$ ./6502 # you built it, nice
```

A docs/content/colors.dat => docs/content/colors.dat +0 -0

A docs/content/demo.webm => docs/content/demo.webm +0 -0

A docs/content/disco.dat => docs/content/disco.dat +0 -0

A docs/content/examples.md => docs/content/examples.md +56 -0
@@ 0,0 1,56 @@
@parent = page.html
@title = Examples

# Example Programs

Download the compiled programs and try them out in the emulator!

### Colors

Draws every supported color on the screen.
<a href="colors.dat" download>Download</a>

```
	LDY #$0
loop:
	TYA
	STA $200, Y
	STA $300, Y
	STA $400, Y
	STA $500, Y
	INY
	CMP #$ff
	BCC loop
	BRK
```

### Disco

Epilepsy warning: lots of flashing colors. Due to how much faster this emulator is
than the one this program was written for, it's more of just flashing colors than
what it originally looked like.
<a href="disco.dat" download>Download</a>

```
; Taken from 6502asm.com

start:
	inx
	txa
	sta $200, y
	sta $300, y
	sta $400, y
	sta $500, y
	iny
	tya
	cmp 16
	bne do
	iny
	jmp start
do:
	iny
	iny
	iny
	iny
	jmp start
```

A docs/content/index.md => docs/content/index.md +42 -0
@@ 0,0 1,42 @@
@parent = page.html
@title = Home

# 6502 Toolchain

<center>
	<video controls="true">
		<source src="demo.webm" type="video/webm">
	</video>
</center>

This project aims to create a fast, powerful, and easy to use toolchain for writing, debugging,
and running programs for the 6502 processor. It features a graphical and CLI debugger, disassembler,
and emulator.


## Features

### 8 bit color

That's 16 times more colors than <a href="http://6502asm.com/" target="_blank">the competition</a>!

### Graphical debugger

Easily step through, run, and debug your programs using a fast graphical debugger. A traditional
CLI debugger is also available.

### Fully multithreaded

The graphical debugger, cli debugger, and screen are all fully asynchronous. That means your
debugger stays fast, even when the emulator is running at full capacity.
It will soon be possible to even debug an already running instance of the emulator!

### *Fast*

This emulator is incredibly fast. So fast that programs written for other emulators don't work
properly half the time because of how fast it is! At some point I will add an option to slow
the emulator down so it is comparable to other emulators.

<br>

So what are you waiting for? Download the emulator now, or build it from source.
\ No newline at end of file

A docs/content/styles.scss => docs/content/styles.scss +68 -0
@@ 0,0 1,68 @@
html,
body
{
	font-family: /*'Segoe UI', 'Roboto', 'San Francisco', 'IBM Plex Sans',*/ sans-serif;
}

body
{
	display: grid;
	place-items: center center
}


h4 code
{
	font-size: 1.5em;
}

code
{
	background: #f2f4f4;
	border-radius: 5px;
	padding: 3px 5px 3px 5px;
}

.container
{
	width: 60em;
}

.nav
{
	font-size: 1.5rem;
	display: flex;
	flex-direction: row;

	.wide
	{
		flex: 1;
		font-weight: bold;
	}
}

.split
{
	display: grid;
	grid-template-columns: 16em auto;
}

video
{
	width: 100%;
}

@media screen and (max-width: 58em)
{
	.split
	{
		display: flex;
		flex-direction: column;
	}

	.container
	{
		width: calc(100% - 2em);
		margin: 1em;
	}
}

A docs/content/usage.md => docs/content/usage.md +46 -0
@@ 0,0 1,46 @@
@parent = page.html
@title = Usage

# Basic Usage

The `6502` command takes some arguments that control how it functions. Each flag is documented
here. Note that only UNIX style flags are supported, not GNU style. This uses the standard
`getopt()` function, so flags work the same as any UNIX command.

#### `-g`

Opens a GUI debugger window.

#### `-s`

Opens a window that shows the emulators screen. Cannot be used in conjunction with `-g`.

#### `-H`

Keep the emulator running after the CPU halts (after an interrupt is triggered). Useful
for debugging short programs. Does nothing when used with `-D`.

#### `-d`

Disassemble the input file, printing the whole disassembly to `stdout`. You probably want
to use this with `-n`

#### `-r`

Run the input file. Can be used in conjunction with `-s` to run and display the output.

#### `-D`

Open CLI debugger. Can be used with `-s` to view screen while debugging. 

#### `-i input`

Read `input` into the CPUs memory.

#### `-n number_of_instructions`

Disassemble only `number_of_instructions` instructions.

#### `-h, -?`

Print a help message.

A docs/site/CNAME => docs/site/CNAME +1 -0
@@ 0,0 1,1 @@
6502.swisschili.sh
\ No newline at end of file

A docs/site/building.html => docs/site/building.html +61 -0
@@ 0,0 1,61 @@
<html>
	<head>
		<meta name="viewport" content="width=device-width">
		<link rel="stylesheet"
			href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.18.1/styles/default.min.css">
		<link rel="stylesheet" href="styles.css">
		<title>Building</title>
	</head>
	<body>
		<main class="split container">
			<div class="sidebar">
				<h2><a href="/">6502</a></h2>

				<p>
					6502 Toolchain written by <a href="https://github.com/swissChili">swissChili</a>
				</p>

				<ul>
					<li><a href="https://github.com/swissChili/6502">Git</a></li>
					<li><a href="/usage.html">Basic usage</a></li>
					<li><a href="/examples.html">Example programs</a></li>
					<li><a href="/building.html">Building from source</a></li>
				</ul>
			</div>
			<div class="body">
				<h1> Building from source</h1>
You need the following libraries installed to build the emulator:
<br>
<code>pthread</code> <code>rt</code> <code>m</code> <code>SDL2</code> <code>GL</code> <code>GLEW</code> <code>GLU</code> <code>readline</code>
<br>
The first three will be included on any POSIX compliant operating system (OS X, Linux, BSD, etc).
To install SDL2, visit its <a href="https://www.libsdl.org/">website</a> or use your distributions
package manager.
<br>
<br>
You also need <code>awk</code> installed if you want to modify the <code>6502.csv</code> file from which parts of the
emulator are generated. If you don't want to do this, run cmake with <code>-DGEN_INSTRUCTIONS_HEADER=OFF</code>
<br>
<br>
You may be able to build this on Windows using Cygwin or MinGW, but I haven't tested that.
<br>
<br>
Run the usual commands to build with cmake:
<pre><code class>$ mkdir build
$ cd build
$ cmake ..
$ make -j
$ ./6502 # you built it, nice</code></pre>
			</div>
		</main>

		<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.18.1/highlight.min.js"></script>
		<script>
			document.addEventListener('DOMContentLoaded', (event) => {
				document.querySelectorAll('pre code').forEach((block) => {
					hljs.highlightBlock(block);
				});
			});
		</script>
	</body>
</html>

A docs/site/colors.dat => docs/site/colors.dat +0 -0

A docs/site/demo.webm => docs/site/demo.webm +0 -0

A docs/site/disco.dat => docs/site/disco.dat +0 -0

A docs/site/examples.html => docs/site/examples.html +82 -0
@@ 0,0 1,82 @@
<html>
	<head>
		<meta name="viewport" content="width=device-width">
		<link rel="stylesheet"
			href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.18.1/styles/default.min.css">
		<link rel="stylesheet" href="styles.css">
		<title>Examples</title>
	</head>
	<body>
		<main class="split container">
			<div class="sidebar">
				<h2><a href="/">6502</a></h2>

				<p>
					6502 Toolchain written by <a href="https://github.com/swissChili">swissChili</a>
				</p>

				<ul>
					<li><a href="https://github.com/swissChili/6502">Git</a></li>
					<li><a href="/usage.html">Basic usage</a></li>
					<li><a href="/examples.html">Example programs</a></li>
					<li><a href="/building.html">Building from source</a></li>
				</ul>
			</div>
			<div class="body">
				<h1> Example Programs</h1>
Download the compiled programs and try them out in the emulator!
<h3> Colors</h3>
Draws every supported color on the screen.
<a href="colors.dat" download>Download</a>
<br>
<pre><code class>	LDY #$0
loop:
	TYA
	STA $200, Y
	STA $300, Y
	STA $400, Y
	STA $500, Y
	INY
	CMP #$ff
	BCC loop
	BRK</code></pre>
<h3> Disco</h3>
Epilepsy warning: lots of flashing colors. Due to how much faster this emulator is
than the one this program was written for, it's more of just flashing colors than
what it originally looked like.
<a href="disco.dat" download>Download</a>
<br>
<pre><code class>; Taken from 6502asm.com
<br>
start:
	inx
	txa
	sta $200, y
	sta $300, y
	sta $400, y
	sta $500, y
	iny
	tya
	cmp 16
	bne do
	iny
	jmp start
do:
	iny
	iny
	iny
	iny
	jmp start</code></pre>
			</div>
		</main>

		<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.18.1/highlight.min.js"></script>
		<script>
			document.addEventListener('DOMContentLoaded', (event) => {
				document.querySelectorAll('pre code').forEach((block) => {
					hljs.highlightBlock(block);
				});
			});
		</script>
	</body>
</html>

A docs/site/index.html => docs/site/index.html +66 -0
@@ 0,0 1,66 @@
<html>
	<head>
		<meta name="viewport" content="width=device-width">
		<link rel="stylesheet"
			href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.18.1/styles/default.min.css">
		<link rel="stylesheet" href="styles.css">
		<title>Home</title>
	</head>
	<body>
		<main class="split container">
			<div class="sidebar">
				<h2><a href="/">6502</a></h2>

				<p>
					6502 Toolchain written by <a href="https://github.com/swissChili">swissChili</a>
				</p>

				<ul>
					<li><a href="https://github.com/swissChili/6502">Git</a></li>
					<li><a href="/usage.html">Basic usage</a></li>
					<li><a href="/examples.html">Example programs</a></li>
					<li><a href="/building.html">Building from source</a></li>
				</ul>
			</div>
			<div class="body">
				<h1> 6502 Toolchain</h1>
<center>
	<video controls="true">
		<source src="demo.webm" type="video/webm">
	</video>
</center>
<br>
This project aims to create a fast, powerful, and easy to use toolchain for writing, debugging,
and running programs for the 6502 processor. It features a graphical and CLI debugger, disassembler,
and emulator.
<br>
<h2> Features</h2><h3> 8 bit color</h3>
That's 16 times more colors than <a href="http://6502asm.com/" target="_blank">the competition</a>!
<h3> Graphical debugger</h3>
Easily step through, run, and debug your programs using a fast graphical debugger. A traditional
CLI debugger is also available.
<h3> Fully multithreaded</h3>
The graphical debugger, cli debugger, and screen are all fully asynchronous. That means your
debugger stays fast, even when the emulator is running at full capacity.
It will soon be possible to even debug an already running instance of the emulator!
<h3> <i>Fast</i></h3>
This emulator is incredibly fast. So fast that programs written for other emulators don't work
properly half the time because of how fast it is! At some point I will add an option to slow
the emulator down so it is comparable to other emulators.
<br>
<br>
<br>
So what are you waiting for? Download the emulator now, or build it from source.
			</div>
		</main>

		<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.18.1/highlight.min.js"></script>
		<script>
			document.addEventListener('DOMContentLoaded', (event) => {
				document.querySelectorAll('pre code').forEach((block) => {
					hljs.highlightBlock(block);
				});
			});
		</script>
	</body>
</html>

A docs/site/index.md => docs/site/index.md +9 -0
@@ 0,0 1,9 @@
@parent = home.html
@title = Home

<center>
	<video controls="true">
		<source src="demo.webm" type="video/webm">
	</video>
</center>


A docs/site/styles.css => docs/site/styles.css +54 -0
@@ 0,0 1,54 @@
html,
body {
  font-family: sans-serif;
}

body {
  display: grid;
  place-items: center center;
}

h4 code {
  font-size: 1.5em;
}

code {
  background: #f2f4f4;
  border-radius: 5px;
  padding: 3px 5px 3px 5px;
}

.container {
  width: 60em;
}

.nav {
  font-size: 1.5rem;
  display: flex;
  flex-direction: row;
}
.nav .wide {
  flex: 1;
  font-weight: bold;
}

.split {
  display: grid;
  grid-template-columns: 16em auto;
}

video {
  width: 100%;
}

@media screen and (max-width: 58em) {
  .split {
    display: flex;
    flex-direction: column;
  }

  .container {
    width: calc(100% - 2em);
    margin: 1em;
  }
}

A docs/site/styles.scss => docs/site/styles.scss +31 -0
@@ 0,0 1,31 @@
html,
body {
  font-family: /*'Segoe UI', 'Roboto', 'San Francisco', 'IBM Plex Sans',*/ sans-serif;
}

body {
  display: grid;
  place-items: center center
}

.container {
  width: 50vw;
}

.nav {
  font-size: 1.5rem;
  display: flex;
  flex-direction: row;

  .wide {
    flex: 1;
    font-weight: bold;
  }
}

@media screen and (max-width: 960px) {
  .container {
    width: calc(100% - 2em);
    margin: 1em;
  }
}
\ No newline at end of file

A docs/site/usage.html => docs/site/usage.html +62 -0
@@ 0,0 1,62 @@
<html>
	<head>
		<meta name="viewport" content="width=device-width">
		<link rel="stylesheet"
			href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.18.1/styles/default.min.css">
		<link rel="stylesheet" href="styles.css">
		<title>Usage</title>
	</head>
	<body>
		<main class="split container">
			<div class="sidebar">
				<h2><a href="/">6502</a></h2>

				<p>
					6502 Toolchain written by <a href="https://github.com/swissChili">swissChili</a>
				</p>

				<ul>
					<li><a href="https://github.com/swissChili/6502">Git</a></li>
					<li><a href="/usage.html">Basic usage</a></li>
					<li><a href="/examples.html">Example programs</a></li>
					<li><a href="/building.html">Building from source</a></li>
				</ul>
			</div>
			<div class="body">
				<h1> Basic Usage</h1>
The <code>6502</code> command takes some arguments that control how it functions. Each flag is documented
here. Note that only UNIX style flags are supported, not GNU style. This uses the standard
<code>getopt()</code> function, so flags work the same as any UNIX command.
<h4> <code>-g</code></h4>
Opens a GUI debugger window.
<h4> <code>-s</code></h4>
Opens a window that shows the emulators screen. Cannot be used in conjunction with <code>-g</code>.
<h4> <code>-H</code></h4>
Keep the emulator running after the CPU halts (after an interrupt is triggered). Useful
for debugging short programs. Does nothing when used with <code>-D</code>.
<h4> <code>-d</code></h4>
Disassemble the input file, printing the whole disassembly to <code>stdout</code>. You probably want
to use this with <code>-n</code>
<h4> <code>-r</code></h4>
Run the input file. Can be used in conjunction with <code>-s</code> to run and display the output.
<h4> <code>-D</code></h4>
Open CLI debugger. Can be used with <code>-s</code> to view screen while debugging. 
<h4> <code>-i input</code></h4>
Read <code>input</code> into the CPUs memory.
<h4> <code>-n number_of_instructions</code></h4>
Disassemble only <code>number_of_instructions</code> instructions.
<h4> <code>-h, -?</code></h4>
Print a help message.
			</div>
		</main>

		<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.18.1/highlight.min.js"></script>
		<script>
			document.addEventListener('DOMContentLoaded', (event) => {
				document.querySelectorAll('pre code').forEach((block) => {
					hljs.highlightBlock(block);
				});
			});
		</script>
	</body>
</html>

A docs/site/usage.md => docs/site/usage.md +4 -0
@@ 0,0 1,4 @@
@parent = page.html
@title = Usage

# Basic Usage
\ No newline at end of file

A docs/templates/home.html => docs/templates/home.html +28 -0
@@ 0,0 1,28 @@
<html>
	<head>
		<meta name="viewport" content="width=device-width">
		<link rel="stylesheet"
			href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.18.1/styles/default.min.css">
		<link rel="stylesheet" href="styles.css">
		<title>${title}</title>
	</head>
	<body>
		<div class="container">
			<div class="nav">
				<a href="/" class="wide">6502</a>
				<a href="https://github.com/swissChili/6502">Git</a>
			</div>
			<hr>
			${body}
		</div>

		<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.18.1/highlight.min.js"></script>
		<script>
			document.addEventListener('DOMContentLoaded', (event) => {
				document.querySelectorAll('pre code').forEach((block) => {
					hljs.highlightBlock(block);
				});
			});
		</script>
	</body>
</html>

A docs/templates/page.html => docs/templates/page.html +39 -0
@@ 0,0 1,39 @@
<html>
	<head>
		<meta name="viewport" content="width=device-width">
		<link rel="stylesheet"
			href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.18.1/styles/default.min.css">
		<link rel="stylesheet" href="styles.css">
		<title>${title}</title>
	</head>
	<body>
		<main class="split container">
			<div class="sidebar">
				<h2><a href="/">6502</a></h2>

				<p>
					6502 Toolchain written by <a href="https://github.com/swissChili">swissChili</a>
				</p>

				<ul>
					<li><a href="https://github.com/swissChili/6502">Git</a></li>
					<li><a href="/usage.html">Basic usage</a></li>
					<li><a href="/examples.html">Example programs</a></li>
					<li><a href="/building.html">Building from source</a></li>
				</ul>
			</div>
			<div class="body">
				${body}
			</div>
		</main>

		<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.18.1/highlight.min.js"></script>
		<script>
			document.addEventListener('DOMContentLoaded', (event) => {
				document.querySelectorAll('pre code').forEach((block) => {
					hljs.highlightBlock(block);
				});
			});
		</script>
	</body>
</html>