with comments

This commit is contained in:
Mark Canlas 2022-12-07 17:55:54 -05:00
parent 192b36e0a8
commit e9d027f362
4 changed files with 14 additions and 9 deletions

View File

@ -4,15 +4,18 @@
init:
; initializes values
RTS
loop:
; primary game loop
RTS
initSnake:
; initializes the snake
RTS

View File

@ -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 =

View File

@ -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)

View File

@ -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,