mirror of
https://github.com/mcanlas/6502-opcodes.git
synced 2025-01-31 23:29:44 +00:00
array print
This commit is contained in:
parent
6e43e197c9
commit
458dc5d329
@ -21,12 +21,12 @@ define SCREEN $200
|
||||
|
||||
; Screen(0) = White
|
||||
LDA #COLOR_White
|
||||
STA $200
|
||||
STA SCREEN+0
|
||||
|
||||
; Screen(1) = Green
|
||||
LDA #COLOR_Green
|
||||
STA $201
|
||||
STA SCREEN+1
|
||||
|
||||
; Screen(2) = Orange
|
||||
LDA #COLOR_Orange
|
||||
STA $202
|
||||
STA SCREEN+2
|
||||
|
@ -21,12 +21,12 @@ define SCREEN $200
|
||||
|
||||
; Screen(0) = White
|
||||
LDA #COLOR_White
|
||||
STA $200
|
||||
STA SCREEN
|
||||
|
||||
; Screen(1) = Green
|
||||
LDA #COLOR_Green
|
||||
STA $201
|
||||
STA TODO
|
||||
|
||||
; Screen(2) = Orange
|
||||
LDA #COLOR_Orange
|
||||
STA $202
|
||||
STA TODO
|
||||
|
@ -11,6 +11,8 @@ trait Definable[A]:
|
||||
|
||||
extension (x: A) def toDefine: String
|
||||
|
||||
extension (x: A) def toDefineWithMath: String
|
||||
|
||||
object Definable:
|
||||
def apply[A](using ev: Definable[A]): Definable[A] =
|
||||
ev
|
||||
|
@ -31,6 +31,10 @@ object Easy6502:
|
||||
def toDefine: String =
|
||||
"COLOR_" + x.toString
|
||||
|
||||
extension (x: Color)
|
||||
def toDefineWithMath: String =
|
||||
"COLOR_" + x.toString
|
||||
|
||||
class Screen(baseAddr: Int):
|
||||
def apply(offset: Int): Screen.Pixel =
|
||||
Screen.Pixel(baseAddr, offset)
|
||||
@ -53,4 +57,11 @@ object Easy6502:
|
||||
|
||||
extension (x: Pixel)
|
||||
def toDefine: String =
|
||||
"TODO"
|
||||
if (x.offset == 0)
|
||||
"SCREEN"
|
||||
else
|
||||
"TODO"
|
||||
|
||||
extension (x: Pixel)
|
||||
def toDefineWithMath: String =
|
||||
"SCREEN+" + x.offset
|
||||
|
@ -61,13 +61,24 @@ object PrintThree:
|
||||
AssemblerOptions.DefinitionsMode.UseDefinitionsWithMath =>
|
||||
"#" + mv.src.toDefine
|
||||
|
||||
val argumentTwo =
|
||||
opts.definitionsMode match
|
||||
case AssemblerOptions.DefinitionsMode.UseLiterals =>
|
||||
AsmBlock.toHex(mv.dest.toValue)
|
||||
|
||||
case AssemblerOptions.DefinitionsMode.UseDefinitions =>
|
||||
mv.dest.toDefine
|
||||
|
||||
case AssemblerOptions.DefinitionsMode.UseDefinitionsWithMath =>
|
||||
mv.dest.toDefineWithMath
|
||||
|
||||
AsmBlock.Intent(
|
||||
s"${mv.dest.toComment} = ${mv.src.toComment}".some,
|
||||
List(
|
||||
AsmBlock.Intent.Instruction(instruction("LDA", opts.instructionCase) + " " + argument, None),
|
||||
AsmBlock
|
||||
.Intent
|
||||
.Instruction(instruction("STA", opts.instructionCase) + " " + AsmBlock.toHex(mv.dest.toValue), None)
|
||||
.Instruction(instruction("STA", opts.instructionCase) + " " + argumentTwo, None)
|
||||
)
|
||||
)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user