mirror of
https://github.com/mcanlas/6502-opcodes.git
synced 2025-04-16 22:37:18 +00:00
expand model
This commit is contained in:
parent
844d34dd5d
commit
a7ab58f660
@ -18,6 +18,7 @@ lazy val scratchpad =
|
||||
|
||||
lazy val demo =
|
||||
module("demo")
|
||||
.withCats
|
||||
.withEfectMonad
|
||||
.settings(libraryDependencies += "com.htmlism" %% "rufio-zio" % "74-5cd25e9b")
|
||||
|
||||
|
@ -6,4 +6,5 @@
|
||||
; Change direction: W A S D
|
||||
|
||||
|
||||
|
||||
labeled:
|
||||
|
@ -1,5 +1,7 @@
|
||||
package com.htmlism.firepower.demo
|
||||
|
||||
import cats.syntax.all._
|
||||
|
||||
import com.htmlism.firepower.demo.asm._
|
||||
import com.htmlism.firepower.demo.str._
|
||||
import zio.*
|
||||
@ -32,8 +34,43 @@ object PrintPrograms extends ZIOAppDefault:
|
||||
List(
|
||||
CommentBlock.fromMultiline(asciiArt),
|
||||
CommentBlock(List("Change direction: W A S D")),
|
||||
CodeBlock(None, Nil),
|
||||
CodeBlock(Some("labeled"), Nil)
|
||||
AnonymousCodeBlock(
|
||||
List(
|
||||
AsmBlock.Intent(
|
||||
None,
|
||||
List(
|
||||
AsmBlock.Intent.Instruction("hello", None),
|
||||
AsmBlock.Intent.Instruction("world", "instruction comment".some)
|
||||
)
|
||||
),
|
||||
AsmBlock.Intent(
|
||||
"this block has some preamble".some,
|
||||
List(
|
||||
AsmBlock.Intent.Instruction("hello", None),
|
||||
AsmBlock.Intent.Instruction("world", "instruction comment".some)
|
||||
)
|
||||
)
|
||||
)
|
||||
),
|
||||
NamedCodeBlock(
|
||||
"labeled",
|
||||
List(
|
||||
AsmBlock.Intent(
|
||||
None,
|
||||
List(
|
||||
AsmBlock.Intent.Instruction("hello", None),
|
||||
AsmBlock.Intent.Instruction("world", "instruction comment".some)
|
||||
)
|
||||
),
|
||||
AsmBlock.Intent(
|
||||
"this block has some preamble".some,
|
||||
List(
|
||||
AsmBlock.Intent.Instruction("hello", None),
|
||||
AsmBlock.Intent.Instruction("world", "instruction comment".some)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
@ -6,13 +6,9 @@ sealed trait AsmBlock
|
||||
|
||||
case class CommentBlock(xs: List[String]) extends AsmBlock
|
||||
|
||||
case class CodeBlock(name: Option[String], chunks: List[CodeBlock.Chunk]) extends AsmBlock
|
||||
case class NamedCodeBlock(name: String, intents: List[AsmBlock.Intent]) extends AsmBlock
|
||||
|
||||
object CodeBlock:
|
||||
case class Chunk(label: Option[String], instructions: List[Chunk.Instruction])
|
||||
|
||||
object Chunk:
|
||||
case class Instruction(code: String, comment: Option[String])
|
||||
case class AnonymousCodeBlock(intents: List[AsmBlock.Intent]) extends AsmBlock
|
||||
|
||||
object AsmBlock:
|
||||
def toParagraph(xs: AsmBlock): Paragraph =
|
||||
@ -20,13 +16,19 @@ object AsmBlock:
|
||||
case CommentBlock(ys) =>
|
||||
Paragraph(ys.map("; " + _))
|
||||
|
||||
case CodeBlock(oLabel, _) =>
|
||||
case NamedCodeBlock(label, _) =>
|
||||
Paragraph(
|
||||
oLabel
|
||||
.map(_ + ":")
|
||||
.toList
|
||||
List(label + ":")
|
||||
)
|
||||
|
||||
case AnonymousCodeBlock(_) =>
|
||||
Paragraph("")
|
||||
|
||||
case class Intent(label: Option[String], instructions: List[Intent.Instruction])
|
||||
|
||||
object Intent:
|
||||
case class Instruction(code: String, comment: Option[String])
|
||||
|
||||
object CommentBlock:
|
||||
def fromMultiline(s: String): CommentBlock =
|
||||
CommentBlock(s.split("\\n").toList)
|
||||
|
Loading…
x
Reference in New Issue
Block a user