-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7e2509b
commit 95eebcb
Showing
11 changed files
with
79 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
target | ||
fateful-cache | ||
.fateful-cache | ||
zig-cache | ||
zig-out | ||
/.vscode | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Examples | ||
|
||
This directory contains various examples to demonstrate the functionality of the emulator: | ||
|
||
## Box | ||
|
||
`box.asm` showcases many of the features of the language and emulator, | ||
including multiplication, conditional jumps, drawing to the screen, etc. | ||
|
||
This example draws a border with Unicode box-drawing characters along with a simple hello world: | ||
![box.asm output](../misc/box.png) | ||
|
||
## Fib | ||
|
||
`fib.asm` is a fibonacci sequence calculator that calculates the nth fibonacci number, where n=`COUNT`. | ||
The result is stored in the `D` register. | ||
|
||
This example also showcases the `test` functionality of the emulator, | ||
which will check that the final values of the registers match the expected values. | ||
|
||
## Mult | ||
|
||
`mult.asm` showcases multiplication through the [`math`](https://github.com/commonkestrel/fateful_math ) library. | ||
This example calls the `mul16` "function" with the arguments `5` and `120`, | ||
storing the high and low bytes of the result in the `H` and `L` registers respectively. | ||
|
||
## Screen | ||
|
||
`screen.asm` is a relatively small program meant to show off the screen-drawing capabilities. | ||
This program loops through every character in the character set and prints them to the screen. | ||
|
||
This can be useful to see what looks nice together and get a feel for the character set of the emulator: | ||
![screen.asm output](../misc/screen.png) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/// Multiplies 5 and 120, storing the result in the H and L registers. | ||
/// | ||
/// h: 0x02 | ||
/// l: 0x58 | ||
|
||
/// math = https://github.com/commonkestrel/fateful_math | ||
@include <math/mul.asm> | ||
|
||
@cseg | ||
@org 0x0000 | ||
_start: | ||
push 5, 0, 120, 0 | ||
call [mul16] | ||
pop H, L | ||
halt |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters