{"id":15287457,"url":"https://github.com/datakinds/sixty-five-oh-two","last_synced_at":"2025-04-13T05:35:14.406Z","repository":{"id":56878153,"uuid":"134555698","full_name":"DataKinds/sixty-five-oh-two","owner":"DataKinds","description":"A 65C02 Assembly eDSL in Haskell","archived":false,"fork":false,"pushed_at":"2018-05-31T08:05:45.000Z","size":362,"stargazers_count":16,"open_issues_count":0,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-13T05:34:10.468Z","etag":null,"topics":["6502","65c02","assembly","dsl","edsl","haskell"],"latest_commit_sha":null,"homepage":"","language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DataKinds.png","metadata":{"files":{"readme":"README.md","changelog":"ChangeLog.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-05-23T10:51:48.000Z","updated_at":"2025-02-26T04:03:24.000Z","dependencies_parsed_at":"2022-08-20T23:10:17.671Z","dependency_job_id":null,"html_url":"https://github.com/DataKinds/sixty-five-oh-two","commit_stats":null,"previous_names":["aearnus/sixty-five-oh-two"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DataKinds%2Fsixty-five-oh-two","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DataKinds%2Fsixty-five-oh-two/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DataKinds%2Fsixty-five-oh-two/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DataKinds%2Fsixty-five-oh-two/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DataKinds","download_url":"https://codeload.github.com/DataKinds/sixty-five-oh-two/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248670508,"owners_count":21142896,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["6502","65c02","assembly","dsl","edsl","haskell"],"created_at":"2024-09-30T15:28:14.080Z","updated_at":"2025-04-13T05:35:14.356Z","avatar_url":"https://github.com/DataKinds.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DSL.SixtyFiveOhTwo: A 65C02 Assembly eDSL in Haskell\n[![Hackage](https://img.shields.io/hackage/v/sixty-five-oh-two.svg)](https://hackage.haskell.org/package/sixty-five-oh-two) ![100% 65C02 Coverage](https://img.shields.io/badge/65C02%20coverage-100%25-brightgreen.svg) ![GitHub stars](https://img.shields.io/github/stars/Aearnus/sixty-five-oh-two.svg?style=social\u0026label=Stars)\n\n![Example image](https://raw.githubusercontent.com/Aearnus/sixty-five-oh-two/master/fancy_banner.png)\n\n_... shut up, show me the code!_\n\nHere's some example code utilizing all of the features of the eDSL:\n\n```haskell\nimport DSL.SixtyFiveOhTwo\n\naccumulatorLoadNStore :: Instruction\naccumulatorLoadNStore = do\n    lda (Immediate 0x10)\n    sta (Absolute 0x0200)\n    rts (Implied)\n\nmyProgram :: Instruction\nmyProgram = do\n    define \"accumulatorLoadNStore\" accumulatorLoadNStore\n    call \"accumulatorLoadNStore\"\n```\n\nHere's a fun little snippet that adds 10 to the accumulator using Haskell Monad Magic:tm::\n\n```haskell\ntest3f2 :: Instruction\ntest3f2 = replicateM_ 10 (inc (Accumulator))\n```\n\nEverything that this module exposes is in [src/DSL/SixtyFiveOhTwo.hs](https://github.com/Aearnus/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.\n\n## What is this?\n\nThis is an **e**mbedded **D**omain **S**pecific **L**anguage that allows a user to write code that runs on the 65C02 CPU. This is the CPU that runs devices such as the Apple II, Commodore 64, or the NES.\n\n## What does the language provide me?\n\n* **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:\n```haskell\nlda :: AddressingMode -\u003e Instruction\nlda (Immediate b) = genericOp 169 b\nlda (ZeroPage b) = genericOp 165 b\nlda (ZeroPageX b) = genericOp 181 b\nlda (Absolute b) = genericTwoByteOp 173 b\nlda (AbsoluteX b) = genericTwoByteOp 189 b\nlda (AbsoluteY b) = genericTwoByteOp 185 b\nlda (ZeroPageIndirect b) = genericOp 178 b\nlda (IndirectX b) = genericOp 161 b\nlda (IndirectY b) = genericOp 177 b\n```\n\n* **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.\n```haskell\ndata AddressingMode =\n    Implied |\n    Accumulator |\n    Immediate Word8 |\n    Relative Int8 | -- Signed\n    ZeroPageRelative Int8 | -- Signed\n    Absolute Word16 |\n    AbsoluteX Word16 |\n    AbsoluteY Word16 |\n    ZeroPage Word8 |\n    ZeroPageX Word8 |\n    ZeroPageY Word8 |\n    ZeroPageIndirect Word8 |\n    Indirect Word16 |\n    IndirectX Word8 |\n    IndirectY Word8\n```\n\n\n* **Easy abstractions**. The `define` and `call` keywords automatically generate the code necessary to create and call subroutines.\n\n## Support or Donate\n\nPlease contact me if you have any wish to support this project or any other projects I've worked on. The information is in `package.yaml`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdatakinds%2Fsixty-five-oh-two","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdatakinds%2Fsixty-five-oh-two","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdatakinds%2Fsixty-five-oh-two/lists"}