diff --git a/data/snake-easy-6502.asm b/data/snake-easy-6502.asm index 345f830..508c671 100644 --- a/data/snake-easy-6502.asm +++ b/data/snake-easy-6502.asm @@ -4,15 +4,18 @@ init: + ; initializes values RTS loop: + ; primary game loop RTS initSnake: + ; initializes the snake RTS diff --git a/firepower-core/src/main/scala/com/htmlism/firepower/core/MetaIntent.scala b/firepower-core/src/main/scala/com/htmlism/firepower/core/MetaIntent.scala index 8e1535e..ec01c50 100644 --- a/firepower-core/src/main/scala/com/htmlism/firepower/core/MetaIntent.scala +++ b/firepower-core/src/main/scala/com/htmlism/firepower/core/MetaIntent.scala @@ -10,7 +10,7 @@ import com.htmlism.firepower.core.* sealed trait MetaIntent object MetaIntent: - case class Jump(target: String, xs: () => List[MetaIntent.Jump]) extends MetaIntent + case class Jump(target: String, description: String, xs: () => List[MetaIntent.Jump]) extends MetaIntent object Jump: def toIntent(j: Jump): AsmBlock.Intent = diff --git a/firepower-core/src/main/scala/com/htmlism/firepower/core/Subroutine.scala b/firepower-core/src/main/scala/com/htmlism/firepower/core/Subroutine.scala index 5a87526..e9127f9 100644 --- a/firepower-core/src/main/scala/com/htmlism/firepower/core/Subroutine.scala +++ b/firepower-core/src/main/scala/com/htmlism/firepower/core/Subroutine.scala @@ -4,13 +4,13 @@ import cats.syntax.all.* import com.htmlism.firepower.core.AsmBlock._ -case class Subroutine(name: String, intents: List[MetaIntent.Jump]): +case class Subroutine(name: String, description: String, intents: List[MetaIntent.Jump]): def call: MetaIntent.Jump = - MetaIntent.Jump(name, () => intents) + MetaIntent.Jump(name, description, () => intents) def attach: NamedCodeBlock = NamedCodeBlock(name, "this is a named block".some, intents.map(_ => Intent("TODO".some, Nil))) object Subroutine: - def apply(name: String): Subroutine = - Subroutine(name, Nil) + def apply(name: String, description: String): Subroutine = + Subroutine(name, description, Nil) diff --git a/firepower-demo/src/main/scala/com/htmlism/firepower/demo/SnakeEasy6502.scala b/firepower-demo/src/main/scala/com/htmlism/firepower/demo/SnakeEasy6502.scala index efb5352..02a8e13 100644 --- a/firepower-demo/src/main/scala/com/htmlism/firepower/demo/SnakeEasy6502.scala +++ b/firepower-demo/src/main/scala/com/htmlism/firepower/demo/SnakeEasy6502.scala @@ -4,6 +4,8 @@ import scala.annotation.tailrec import scala.collection.immutable.ListMap import scala.util.chaining.* +import cats.syntax.all._ + import com.htmlism.firepower.core.AsmBlock.Intent import com.htmlism.firepower.core.* @@ -15,7 +17,7 @@ object SnakeEasy6502: ) lazy val init = - Subroutine("init") + Subroutine("init", "initializes values") .copy(intents = List( initSnake.call @@ -23,10 +25,10 @@ object SnakeEasy6502: ) lazy val loop = - Subroutine("loop") + Subroutine("loop", "primary game loop") lazy val initSnake = - Subroutine("initSnake") + Subroutine("initSnake", "initializes the snake") def firstCodeBlock(xs: List[MetaIntent.Jump]): AsmBlock.AnonymousCodeBlock = AsmBlock @@ -49,7 +51,7 @@ object SnakeEasy6502: val sub = AsmBlock.NamedCodeBlock( head.target, - None, + head.description.some, List( AsmBlock.Intent( None,