mirror of
https://github.com/mcanlas/6502-opcodes.git
synced 2024-05-28 21:41:31 +00:00
assembler skeleton
This commit is contained in:
parent
0cdc2fc7af
commit
3932c5d856
|
@ -15,7 +15,7 @@ lazy val core =
|
|||
|
||||
lazy val demo =
|
||||
module("demo")
|
||||
.withCats
|
||||
.dependsOn(core)
|
||||
.withEfectMonad
|
||||
.settings(libraryDependencies += "com.htmlism" %% "rufio-zio" % "74-5cd25e9b")
|
||||
|
||||
|
|
|
@ -1,14 +1,18 @@
|
|||
package com.htmlism.firepower.demo.asm
|
||||
package com.htmlism.firepower.core
|
||||
|
||||
sealed trait AsmBlock
|
||||
|
||||
case class CommentBlock(xs: List[String]) extends AsmBlock
|
||||
|
||||
case class NamedCodeBlock(name: String, comment: Option[String], intents: List[AsmBlock.Intent]) extends AsmBlock
|
||||
|
||||
case class AnonymousCodeBlock(intents: List[AsmBlock.Intent]) extends AsmBlock
|
||||
|
||||
object AsmBlock:
|
||||
case class CommentBlock(xs: List[String]) extends AsmBlock
|
||||
|
||||
object CommentBlock:
|
||||
def fromMultiline(s: String): CommentBlock =
|
||||
CommentBlock(s.split("\\n").toList)
|
||||
|
||||
case class NamedCodeBlock(name: String, comment: Option[String], intents: List[AsmBlock.Intent]) extends AsmBlock
|
||||
|
||||
case class AnonymousCodeBlock(intents: List[AsmBlock.Intent]) extends AsmBlock
|
||||
|
||||
def interFlatMap[A, B](xs: List[A])(x: List[B], f: A => List[B]): List[B] =
|
||||
xs match
|
||||
case head :: tail =>
|
||||
|
@ -50,7 +54,3 @@ object AsmBlock:
|
|||
.instructions
|
||||
.map(i => i.code + i.comment.map(toComment).map(" " + _).getOrElse(" "))
|
||||
.map(withIndent)
|
||||
|
||||
object CommentBlock:
|
||||
def fromMultiline(s: String): CommentBlock =
|
||||
CommentBlock(s.split("\\n").toList)
|
|
@ -0,0 +1,7 @@
|
|||
package com.htmlism.firepower.core
|
||||
|
||||
case class AssemblerOptions()
|
||||
|
||||
object AssemblerOptions:
|
||||
enum Definitions:
|
||||
case InlineDefinitions, UseDefinitions, UseDefinitionsWithMath
|
|
@ -0,0 +1,11 @@
|
|||
package com.htmlism.firepower.core
|
||||
|
||||
object MacroAssembler:
|
||||
def assemble(program: List[String], options: AssemblerOptions): List[AsmBlock] =
|
||||
Nil
|
||||
|
||||
def defineGraph(program: List[String]): List[AsmBlock.CommentBlock] =
|
||||
Nil
|
||||
|
||||
def callGraph(program: List[String]): List[String] =
|
||||
Nil
|
|
@ -0,0 +1,14 @@
|
|||
package com.htmlism.firepower.core
|
||||
|
||||
import cats.syntax.all.*
|
||||
|
||||
import com.htmlism.firepower.core.AsmBlock._
|
||||
|
||||
case class Subroutine(name: String, intents: List[Intent]):
|
||||
def call: Intent.Instruction =
|
||||
Intent.Instruction(s"jsr $name", None)
|
||||
|
||||
def attach: NamedCodeBlock =
|
||||
NamedCodeBlock(name, "this is a named block".some, intents)
|
||||
|
||||
object Subroutine
|
|
@ -7,7 +7,8 @@ import scala.util.chaining._
|
|||
import cats.syntax.all._
|
||||
import zio.*
|
||||
|
||||
import com.htmlism.firepower.demo.asm._
|
||||
import com.htmlism.firepower.core.AsmBlock._
|
||||
import com.htmlism.firepower.core._
|
||||
import com.htmlism.firepower.demo.str._
|
||||
import com.htmlism.rufio.withzio.*
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user