mirror of
https://github.com/mcanlas/6502-opcodes.git
synced 2024-06-27 23:29:43 +00:00
defines block
This commit is contained in:
parent
77785bef50
commit
9b4aac9a62
|
@ -1,22 +1,22 @@
|
||||||
; define COLOR_Black 0
|
define COLOR_Black 0
|
||||||
; define COLOR_White 1
|
define COLOR_White 1
|
||||||
; define COLOR_Red 2
|
define COLOR_Red 2
|
||||||
; define COLOR_Cyan 3
|
define COLOR_Cyan 3
|
||||||
; define COLOR_Purple 4
|
define COLOR_Purple 4
|
||||||
; define COLOR_Green 5
|
define COLOR_Green 5
|
||||||
; define COLOR_Blue 6
|
define COLOR_Blue 6
|
||||||
; define COLOR_Yellow 7
|
define COLOR_Yellow 7
|
||||||
; define COLOR_Orange 8
|
define COLOR_Orange 8
|
||||||
; define COLOR_Brown 9
|
define COLOR_Brown 9
|
||||||
; define COLOR_LightRed 10
|
define COLOR_LightRed 10
|
||||||
; define COLOR_DarkGrey 11
|
define COLOR_DarkGrey 11
|
||||||
; define COLOR_Grey 12
|
define COLOR_Grey 12
|
||||||
; define COLOR_LightGreen 13
|
define COLOR_LightGreen 13
|
||||||
; define COLOR_LightBlue 14
|
define COLOR_LightBlue 14
|
||||||
; define COLOR_LightGrey 15
|
define COLOR_LightGrey 15
|
||||||
|
|
||||||
|
|
||||||
; define SCREEN TODO
|
define SCREEN TODO
|
||||||
|
|
||||||
|
|
||||||
; Screen(0) = White
|
; Screen(0) = White
|
||||||
|
|
|
@ -1,22 +1,22 @@
|
||||||
; define COLOR_Black 0
|
define COLOR_Black 0
|
||||||
; define COLOR_White 1
|
define COLOR_White 1
|
||||||
; define COLOR_Red 2
|
define COLOR_Red 2
|
||||||
; define COLOR_Cyan 3
|
define COLOR_Cyan 3
|
||||||
; define COLOR_Purple 4
|
define COLOR_Purple 4
|
||||||
; define COLOR_Green 5
|
define COLOR_Green 5
|
||||||
; define COLOR_Blue 6
|
define COLOR_Blue 6
|
||||||
; define COLOR_Yellow 7
|
define COLOR_Yellow 7
|
||||||
; define COLOR_Orange 8
|
define COLOR_Orange 8
|
||||||
; define COLOR_Brown 9
|
define COLOR_Brown 9
|
||||||
; define COLOR_LightRed 10
|
define COLOR_LightRed 10
|
||||||
; define COLOR_DarkGrey 11
|
define COLOR_DarkGrey 11
|
||||||
; define COLOR_Grey 12
|
define COLOR_Grey 12
|
||||||
; define COLOR_LightGreen 13
|
define COLOR_LightGreen 13
|
||||||
; define COLOR_LightBlue 14
|
define COLOR_LightBlue 14
|
||||||
; define COLOR_LightGrey 15
|
define COLOR_LightGrey 15
|
||||||
|
|
||||||
|
|
||||||
; define SCREEN TODO
|
define SCREEN TODO
|
||||||
|
|
||||||
|
|
||||||
; Screen(0) = White
|
; Screen(0) = White
|
||||||
|
|
|
@ -9,6 +9,8 @@ object AsmBlock:
|
||||||
def fromMultiline(s: String): CommentBlock =
|
def fromMultiline(s: String): CommentBlock =
|
||||||
CommentBlock(s.split("\\n").toList)
|
CommentBlock(s.split("\\n").toList)
|
||||||
|
|
||||||
|
case class DefinesBlock(xs: List[(String, String)]) extends AsmBlock
|
||||||
|
|
||||||
case class NamedCodeBlock(name: String, comment: Option[String], intents: List[AsmBlock.Intent]) extends AsmBlock
|
case class NamedCodeBlock(name: String, comment: Option[String], intents: List[AsmBlock.Intent]) extends AsmBlock
|
||||||
|
|
||||||
case class AnonymousCodeBlock(intents: List[AsmBlock.Intent]) extends AsmBlock
|
case class AnonymousCodeBlock(intents: List[AsmBlock.Intent]) extends AsmBlock
|
||||||
|
@ -32,6 +34,12 @@ object AsmBlock:
|
||||||
case CommentBlock(ys) =>
|
case CommentBlock(ys) =>
|
||||||
ys.map(toComment)
|
ys.map(toComment)
|
||||||
|
|
||||||
|
case DefinesBlock(kvs) =>
|
||||||
|
kvs
|
||||||
|
.map { case (k, v) =>
|
||||||
|
s"define $k $v"
|
||||||
|
}
|
||||||
|
|
||||||
case NamedCodeBlock(label, oComment, intents) =>
|
case NamedCodeBlock(label, oComment, intents) =>
|
||||||
val headerParagraph =
|
val headerParagraph =
|
||||||
List(label + ":") ++ oComment.map(toComment).map(withIndent).toList
|
List(label + ":") ++ oComment.map(toComment).map(withIndent).toList
|
||||||
|
|
|
@ -39,30 +39,14 @@ object PrintThree:
|
||||||
case AssemblerOptions.DefinitionsMode.UseLiterals =>
|
case AssemblerOptions.DefinitionsMode.UseLiterals =>
|
||||||
Nil
|
Nil
|
||||||
|
|
||||||
case AssemblerOptions.DefinitionsMode.UseDefinitions =>
|
case AssemblerOptions.DefinitionsMode.UseDefinitions | AssemblerOptions.DefinitionsMode.UseDefinitionsWithMath =>
|
||||||
program
|
program
|
||||||
.flatMap(_.defines)
|
.flatMap(_.defines)
|
||||||
.distinct
|
.distinct
|
||||||
.map { xs =>
|
.map { xs =>
|
||||||
xs
|
xs
|
||||||
.toList
|
.toList
|
||||||
.map { case (k, v) =>
|
.pipe(AsmBlock.DefinesBlock(_))
|
||||||
s"define $k $v"
|
|
||||||
}
|
|
||||||
.pipe(AsmBlock.CommentBlock(_))
|
|
||||||
}
|
|
||||||
|
|
||||||
case AssemblerOptions.DefinitionsMode.UseDefinitionsWithMath =>
|
|
||||||
program
|
|
||||||
.flatMap(_.defines.toList)
|
|
||||||
.distinct
|
|
||||||
.map { xs =>
|
|
||||||
xs
|
|
||||||
.toList
|
|
||||||
.map { case (k, v) =>
|
|
||||||
s"define $k $v"
|
|
||||||
}
|
|
||||||
.pipe(AsmBlock.CommentBlock(_))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private def codes(opts: AssemblerOptions) =
|
private def codes(opts: AssemblerOptions) =
|
||||||
|
|
Loading…
Reference in New Issue
Block a user