mirror of
https://github.com/mcanlas/6502-opcodes.git
synced 2025-01-30 16:29:49 +00:00
with comments
This commit is contained in:
parent
192b36e0a8
commit
e9d027f362
@ -4,15 +4,18 @@
|
||||
|
||||
|
||||
init:
|
||||
; initializes values
|
||||
|
||||
RTS
|
||||
|
||||
|
||||
loop:
|
||||
; primary game loop
|
||||
|
||||
RTS
|
||||
|
||||
|
||||
initSnake:
|
||||
; initializes the snake
|
||||
|
||||
RTS
|
||||
|
@ -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 =
|
||||
|
@ -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)
|
||||
|
@ -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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user