assignment

This commit is contained in:
Mark Canlas 2022-12-06 13:53:02 -05:00
parent 8c3d8a2bd3
commit aad7c33c42
5 changed files with 24 additions and 18 deletions

View File

@ -7,20 +7,20 @@
; Change direction: W A S D
lda $00
lda $00
lda $01 ; instruction comment
; this block has some preamble
lda $00
lda $00
lda $01 ; instruction comment
labeled:
; This is a subroutine description
lda $00
lda $00
lda $01 ; instruction comment
; this block has some preamble
lda $00
lda $00
lda $01 ; instruction comment

View File

@ -1,8 +1,11 @@
lda #$01
sta $0200
; $0200 = #$01
lda #$01
sta $0200
lda #$03
sta $0201
; $0201 = #$03
lda #$03
sta $0201
lda #$05
sta $0202
; $0202 = #$05
lda #$05
sta $0202

View File

@ -1,8 +1,11 @@
LDA #$01
STA $0200
; $0200 = #$01
LDA #$01
STA $0200
LDA #$03
STA $0201
; $0201 = #$03
LDA #$03
STA $0201
LDA #$05
STA $0202
; $0202 = #$05
LDA #$05
STA $0202

View File

@ -52,5 +52,5 @@ object AsmBlock:
def toLines(x: Intent): List[String] =
x.label.map(toComment).map(withIndent).toList ++ x
.instructions
.map(i => i.code + i.comment.map(toComment).map(" " + _).getOrElse(" "))
.map(i => i.code + i.comment.map(toComment).map(" " + _).getOrElse(""))
.map(withIndent)

View File

@ -21,7 +21,7 @@ object PrintThree:
program
.map { mv =>
AsmBlock.Intent(
None,
s"${mv.dest} = ${mv.src}".some,
List(
AsmBlock.Intent.Instruction(instruction("LDA", opt.instructionCase) + " " + mv.src, None),
AsmBlock.Intent.Instruction(instruction("STA", opt.instructionCase) + " " + mv.dest, None)