mirror of
https://github.com/mcanlas/6502-opcodes.git
synced 2025-02-23 18:29:12 +00:00
with comments
This commit is contained in:
parent
192b36e0a8
commit
e9d027f362
data
firepower-core/src/main/scala/com/htmlism/firepower/core
firepower-demo/src/main/scala/com/htmlism/firepower/demo
@ -4,15 +4,18 @@
|
|||||||
|
|
||||||
|
|
||||||
init:
|
init:
|
||||||
|
; initializes values
|
||||||
|
|
||||||
RTS
|
RTS
|
||||||
|
|
||||||
|
|
||||||
loop:
|
loop:
|
||||||
|
; primary game loop
|
||||||
|
|
||||||
RTS
|
RTS
|
||||||
|
|
||||||
|
|
||||||
initSnake:
|
initSnake:
|
||||||
|
; initializes the snake
|
||||||
|
|
||||||
RTS
|
RTS
|
||||||
|
@ -10,7 +10,7 @@ import com.htmlism.firepower.core.*
|
|||||||
sealed trait MetaIntent
|
sealed trait MetaIntent
|
||||||
|
|
||||||
object 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:
|
object Jump:
|
||||||
def toIntent(j: Jump): AsmBlock.Intent =
|
def toIntent(j: Jump): AsmBlock.Intent =
|
||||||
|
@ -4,13 +4,13 @@ import cats.syntax.all.*
|
|||||||
|
|
||||||
import com.htmlism.firepower.core.AsmBlock._
|
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 =
|
def call: MetaIntent.Jump =
|
||||||
MetaIntent.Jump(name, () => intents)
|
MetaIntent.Jump(name, description, () => intents)
|
||||||
|
|
||||||
def attach: NamedCodeBlock =
|
def attach: NamedCodeBlock =
|
||||||
NamedCodeBlock(name, "this is a named block".some, intents.map(_ => Intent("TODO".some, Nil)))
|
NamedCodeBlock(name, "this is a named block".some, intents.map(_ => Intent("TODO".some, Nil)))
|
||||||
|
|
||||||
object Subroutine:
|
object Subroutine:
|
||||||
def apply(name: String): Subroutine =
|
def apply(name: String, description: String): Subroutine =
|
||||||
Subroutine(name, Nil)
|
Subroutine(name, description, Nil)
|
||||||
|
@ -4,6 +4,8 @@ import scala.annotation.tailrec
|
|||||||
import scala.collection.immutable.ListMap
|
import scala.collection.immutable.ListMap
|
||||||
import scala.util.chaining.*
|
import scala.util.chaining.*
|
||||||
|
|
||||||
|
import cats.syntax.all._
|
||||||
|
|
||||||
import com.htmlism.firepower.core.AsmBlock.Intent
|
import com.htmlism.firepower.core.AsmBlock.Intent
|
||||||
import com.htmlism.firepower.core.*
|
import com.htmlism.firepower.core.*
|
||||||
|
|
||||||
@ -15,7 +17,7 @@ object SnakeEasy6502:
|
|||||||
)
|
)
|
||||||
|
|
||||||
lazy val init =
|
lazy val init =
|
||||||
Subroutine("init")
|
Subroutine("init", "initializes values")
|
||||||
.copy(intents =
|
.copy(intents =
|
||||||
List(
|
List(
|
||||||
initSnake.call
|
initSnake.call
|
||||||
@ -23,10 +25,10 @@ object SnakeEasy6502:
|
|||||||
)
|
)
|
||||||
|
|
||||||
lazy val loop =
|
lazy val loop =
|
||||||
Subroutine("loop")
|
Subroutine("loop", "primary game loop")
|
||||||
|
|
||||||
lazy val initSnake =
|
lazy val initSnake =
|
||||||
Subroutine("initSnake")
|
Subroutine("initSnake", "initializes the snake")
|
||||||
|
|
||||||
def firstCodeBlock(xs: List[MetaIntent.Jump]): AsmBlock.AnonymousCodeBlock =
|
def firstCodeBlock(xs: List[MetaIntent.Jump]): AsmBlock.AnonymousCodeBlock =
|
||||||
AsmBlock
|
AsmBlock
|
||||||
@ -49,7 +51,7 @@ object SnakeEasy6502:
|
|||||||
val sub =
|
val sub =
|
||||||
AsmBlock.NamedCodeBlock(
|
AsmBlock.NamedCodeBlock(
|
||||||
head.target,
|
head.target,
|
||||||
None,
|
head.description.some,
|
||||||
List(
|
List(
|
||||||
AsmBlock.Intent(
|
AsmBlock.Intent(
|
||||||
None,
|
None,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user