diff --git a/src/main/scala/com/htmlism/mos6502/dsl/syntax/AsmSyntax.scala b/src/main/scala/com/htmlism/mos6502/dsl/syntax/AsmSyntax.scala index 403db37..9583100 100644 --- a/src/main/scala/com/htmlism/mos6502/dsl/syntax/AsmSyntax.scala +++ b/src/main/scala/com/htmlism/mos6502/dsl/syntax/AsmSyntax.scala @@ -14,6 +14,8 @@ trait AsmSyntax { f(ctx) + ctx.push(RTS) + Subroutine(s, ctx.toFragment, ctx.getJumps) } diff --git a/src/test/scala/com/htmlism/mos6502/dsl/Easy6502Spec.scala b/src/test/scala/com/htmlism/mos6502/dsl/Easy6502Spec.scala index 70b1e58..2ab110c 100644 --- a/src/test/scala/com/htmlism/mos6502/dsl/Easy6502Spec.scala +++ b/src/test/scala/com/htmlism/mos6502/dsl/Easy6502Spec.scala @@ -67,9 +67,20 @@ class Easy6502Spec extends AnyFlatSpec with should.Matchers { } "snake" should "compile" in { + val initSnake = + sub("initSnake") { implicit a => + registers.X.incr + } + + val generateApplePosition = + sub("generateApplePosition") { implicit a => + registers.X.incr + } + val init = sub("init") { implicit a => - registers.X.incr + jump(initSnake) + jump(generateApplePosition) } val readKeys =