fixed assigning a memory byte from an array

This commit is contained in:
Irmen de Jong 2020-10-15 22:15:00 +02:00
parent beaf6d449b
commit 5060f0bb19
3 changed files with 35 additions and 15 deletions

View File

@ -1220,6 +1220,7 @@ internal class AssignmentAsmGen(private val program: Program, private val asmgen
asmgen.storeByteIntoPointer(addressExpr, ldaInstructionArg) asmgen.storeByteIntoPointer(addressExpr, ldaInstructionArg)
} }
else -> { else -> {
asmgen.out(" lda $ldaInstructionArg | pha")
asmgen.translateExpression(addressExpr) asmgen.translateExpression(addressExpr)
asmgen.out(""" asmgen.out("""
inx inx
@ -1227,8 +1228,8 @@ internal class AssignmentAsmGen(private val program: Program, private val asmgen
sta P8ZP_SCRATCH_W2 sta P8ZP_SCRATCH_W2
lda P8ESTACK_HI,x lda P8ESTACK_HI,x
sta P8ZP_SCRATCH_W2+1 sta P8ZP_SCRATCH_W2+1
lda $ldaInstructionArg
ldy #0 ldy #0
pla
sta (P8ZP_SCRATCH_W2),y""") sta (P8ZP_SCRATCH_W2),y""")
} }
} }

View File

@ -5,6 +5,7 @@ TODO
- get rid of all other TODO's in the code ;-) - get rid of all other TODO's in the code ;-)
- introduce strcmp() - introduce strcmp()
- modify string comparsion expressions to use strcmp() automatically - modify string comparsion expressions to use strcmp() automatically
- only allow array indexing via a number, a variable, or a typecast of one of those (eliminate complex expression calcs for array indexing, force explicit use of an index variable)
- implement @stack for asmsub parameters - implement @stack for asmsub parameters
- make it possible to use cpu opcodes such as 'nop' as variable names by prefixing all asm vars with something such as '_' - make it possible to use cpu opcodes such as 'nop' as variable names by prefixing all asm vars with something such as '_'
- option to load the built-in library files from a directory instead of the embedded ones (for easier library development/debugging) - option to load the built-in library files from a directory instead of the embedded ones (for easier library development/debugging)

View File

@ -1,12 +1,42 @@
%import textio %import textio
%import diskio %import conv
%zeropage basicsafe %zeropage basicsafe
main { main {
sub start() { sub start() {
dinges.travel_to(5) str num1 = "01234"
str num2 = @"01234"
str hex1 = "a04E"
str hex2 = "$a04E"
str hex3 = @"a04E"
str hex4 = @"$a04E"
; txt.print(num1)
; txt.chrout('\n')
; txt.print(num2)
; txt.chrout('\n')
; txt.print(hex1)
; txt.chrout('\n')
; txt.print(hex2)
; txt.chrout('\n')
; txt.print(hex3)
; txt.chrout('\n')
; txt.print(hex4)
; txt.chrout('\n')
ubyte cc
for cc in 0 to len(hex3)-1 {
@($0410+cc) = hex3[cc]
txt.setchr(16+cc,2,hex3[cc])
}
for cc in 0 to len(hex4)-1 {
@($0420+cc) = hex4[cc]
txt.setchr(32+cc,2,hex4[cc])
}
testX() testX()
} }
@ -25,15 +55,3 @@ _saveX .byte 0
}} }}
} }
} }
dinges {
sub foo(ubyte x) {
}
sub travel_to(ubyte d2) {
ubyte travel_to=d2
foo(travel_to)
}
}