diff --git a/codeGenCpu6502/src/prog8/codegen/cpu6502/AsmGen.kt b/codeGenCpu6502/src/prog8/codegen/cpu6502/AsmGen.kt index 843a7055f..1ac21b985 100644 --- a/codeGenCpu6502/src/prog8/codegen/cpu6502/AsmGen.kt +++ b/codeGenCpu6502/src/prog8/codegen/cpu6502/AsmGen.kt @@ -882,8 +882,8 @@ $repeatLabel""") } private fun repeatCountInY(stmt: PtRepeatLoop, endLabel: String) { - // note: Y must just have been loaded with the (variable) number of loops to be performed! val repeatLabel = makeLabel("repeat") + out(" cpy #0") if(isTargetCpu(CpuType.CPU65c02)) { val counterVar = createRepeatCounterVar(DataType.UBYTE, true, stmt) out(" beq $endLabel | sty $counterVar")