add print three demo

This commit is contained in:
Mark Canlas 2022-12-06 12:56:29 -05:00
parent caf9517aa0
commit f491f13215
3 changed files with 51 additions and 1 deletions

8
data/print-three.asm Normal file
View File

@ -0,0 +1,8 @@
LDA #$01
STA $0200
LDA #$05
STA $0201
LDA #$08
STA $0202

View File

@ -28,7 +28,8 @@ object PrintPrograms extends ZIOAppDefault:
)
.pipe(xxs => AsmBlock.interFlatMap(xxs)(List("", ""), identity))
.pipe(Line.mkString),
"annotated-snake.asm" -> AnnotatedSnake.program
"annotated-snake.asm" -> AnnotatedSnake.program,
"print-three.asm" -> PrintThree.program
)
def run: Task[Unit] =

View File

@ -0,0 +1,41 @@
package com.htmlism.firepower.demo
import scala.util.chaining._
import cats.syntax.all._
import com.htmlism.firepower.core.AsmBlock._
import com.htmlism.firepower.core._
object PrintThree:
val program: String =
List(
AnonymousCodeBlock(
List(
AsmBlock.Intent(
None,
List(
AsmBlock.Intent.Instruction("LDA #$01", None),
AsmBlock.Intent.Instruction("STA $0200", None)
)
),
AsmBlock.Intent(
None,
List(
AsmBlock.Intent.Instruction("LDA #$05", None),
AsmBlock.Intent.Instruction("STA $0201", None)
)
),
AsmBlock.Intent(
None,
List(
AsmBlock.Intent.Instruction("LDA #$08", None),
AsmBlock.Intent.Instruction("STA $0202", None)
)
)
)
)
)
.map(AsmBlock.toLines)
.pipe(xs => AsmBlock.interFlatMap(xs)(List("", ""), identity))
.pipe(str.Line.mkString)