mirror of
https://github.com/DataKinds/sixty-five-oh-two.git
synced 2024-06-01 01:41:39 +00:00
Documentation
This commit is contained in:
parent
c791607c23
commit
6956b23f54
46
README.md
46
README.md
|
@ -1,4 +1,4 @@
|
|||
# A 65C02 Assembly DSL for Haskell
|
||||
# DSL.SixtyFiveOhTwo: A 65C02 Assembly eDSL in Haskell
|
||||
|
||||
![Example image](https://raw.githubusercontent.com/Aearnus/dsl-sixty-five-oh-two/master/fancy_banner.png)
|
||||
|
||||
|
@ -21,11 +21,51 @@ myProgram = do
|
|||
call "accumulatorLoadNStore"
|
||||
```
|
||||
|
||||
Here's a fun little snippet that adds 10 to the accumulator using Haskell Monad Magic:
|
||||
Here's a fun little snippet that adds 10 to the accumulator using Haskell Monad Magic:tm::
|
||||
|
||||
```haskell
|
||||
test3f2 :: Instruction
|
||||
test3f2 = replicateM_ 10 (inc (Accumulator))
|
||||
```
|
||||
|
||||
More documentation coming soon!
|
||||
Everything that this module exposes is in [src/DSL/SixtyFiveOhTwo.hs](https://github.com/Aearnus/dsl-sixty-five-oh-two/blob/master/src/DSL/SixtyFiveOhTwo.hs). A quick browse through this file will reveal the full extent of the features of this eDSL.
|
||||
|
||||
## What does the language provide me?
|
||||
### <div style="width=100%;text-align:center">The entire breadth of 65C02 opcodes</div>
|
||||
|
||||
* Full coverage. Everything bit of code that the 65C02 can understand is represented in this language. Everywhere `adc` to `wai` can be used. These opcodes are represented as generic operations, each of which simply append to the bytecode that gets passed into it. Here's an example of the definition for a certain opcode:
|
||||
```haskell
|
||||
lda :: AddressingMode -> Instruction
|
||||
lda (Immediate b) = genericOp 169 b
|
||||
lda (ZeroPage b) = genericOp 165 b
|
||||
lda (ZeroPageX b) = genericOp 181 b
|
||||
lda (Absolute b) = genericTwoByteOp 173 b
|
||||
lda (AbsoluteX b) = genericTwoByteOp 189 b
|
||||
lda (AbsoluteY b) = genericTwoByteOp 185 b
|
||||
lda (ZeroPageIndirect b) = genericOp 178 b
|
||||
lda (IndirectX b) = genericOp 161 b
|
||||
lda (IndirectY b) = genericOp 177 b
|
||||
```
|
||||
|
||||
* Type safety. Every addressing mode is represented the Haskell type system, and thus issues will be caught at compile time. The `AddressingMode` ADT is used to represent a function's addressing mode, and opcodes do not take addressing modes that they do not support.
|
||||
```haskell
|
||||
data AddressingMode =
|
||||
Implied |
|
||||
Accumulator |
|
||||
Immediate Word8 |
|
||||
Relative Int8 | -- Signed
|
||||
ZeroPageRelative Int8 | -- Signed
|
||||
Absolute Word16 |
|
||||
AbsoluteX Word16 |
|
||||
AbsoluteY Word16 |
|
||||
ZeroPage Word8 |
|
||||
ZeroPageX Word8 |
|
||||
ZeroPageY Word8 |
|
||||
ZeroPageIndirect Word8 |
|
||||
Indirect Word16 |
|
||||
IndirectX Word8 |
|
||||
IndirectY Word8
|
||||
```
|
||||
|
||||
|
||||
* Easy abstractions. The `define` and `call` keywords automatically generate the code necessary to create and call subroutines.
|
||||
|
|
16
package.yaml
16
package.yaml
|
@ -1,23 +1,23 @@
|
|||
name: dsl-sixty-five-oh-two
|
||||
name: sixty-five-oh-two
|
||||
version: 0.1.0.0
|
||||
github: "githubuser/dsl-sixty-five-oh-two"
|
||||
license: BSD3
|
||||
author: "Author name here"
|
||||
maintainer: "example@example.com"
|
||||
copyright: "2018 Author name here"
|
||||
license: MIT
|
||||
author: "Tyler Limkemann"
|
||||
maintainer: "tslimkemann42@gmail.com"
|
||||
copyright: "2018 Tyler Limkemann"
|
||||
|
||||
extra-source-files:
|
||||
- README.md
|
||||
- ChangeLog.md
|
||||
|
||||
# Metadata used when publishing your package
|
||||
# synopsis: Short description of your package
|
||||
# category: Web
|
||||
synopsis: An eDSL for writing 65(C)02 bytecode.
|
||||
category: DSL
|
||||
|
||||
# To avoid duplicated efforts in documentation and dealing with the
|
||||
# complications of embedding Haddock markup inside cabal files, it is
|
||||
# common to point users to the README.md file.
|
||||
description: A DSL for writing 65(C)02 bytecode. Please see the README on GitHub at <https://github.com/githubuser/dsl-sixty-five-oh-two#readme>
|
||||
description: An eDSL for writing 65(C)02 bytecode. Please see the README on GitHub at <https://github.com/githubuser/dsl-sixty-five-oh-two#readme>
|
||||
|
||||
dependencies:
|
||||
- base >= 4.7 && < 5
|
||||
|
|
Loading…
Reference in New Issue
Block a user