diff --git a/compiler/examples/hello.p8 b/compiler/examples/hello.p8 new file mode 100644 index 000000000..0d775be30 --- /dev/null +++ b/compiler/examples/hello.p8 @@ -0,0 +1,26 @@ +%import c64lib +%import c64utils + +~ main { + +sub start() { + + ; set screen colors and activate lowercase charset + c64.EXTCOL = 5 + c64.BGCOL0 = 0 + c64.COLOR = 1 + c64.VMCSB = %10111 + + ; use kernel routine to write text (sorry, loops don't work in asm yet) + c64.CHROUT('H') + c64.CHROUT('e') + c64.CHROUT('l') + c64.CHROUT('l') + c64.CHROUT('o') + c64.CHROUT('!') + c64.CHROUT('\n') + + return +} + +} diff --git a/compiler/examples/test.p8 b/compiler/examples/test.p8 index 448b3f5d0..832b13aa2 100644 --- a/compiler/examples/test.p8 +++ b/compiler/examples/test.p8 @@ -13,8 +13,10 @@ sub start() { uword address memory uword memaddr = $c000 uword[2] wordarray + ubyte[2] ubytearray byte b1 memory byte mb1 = $c991 + memory ubyte mub1 = $c992 str stringvar = "??????????\n\n\nnext line\r\r\rnext line after carriagereturn" @@ -70,8 +72,31 @@ sub start() { ; Y = c64.CHRIN() ; ok! ; v1 = c64.CHRIN() ; ok ! + + c64.CHROUT(X) + c64.CHROUT(b1) ; @todo fix compiler crash expression identifierref should be a vardef, not null + c64.CHROUT(char1) ; @todo fix compiler crash " + c64.CHROUT(mb1) ; @todo fix compiler crash " + c64.CHROUT(mub1) ; @todo fix compiler crash " + c64.CHROUT(ubytearray[1]) ; @todo fix compiler crash null cannot be cast to non-null type prog8.ast.VarDecl + c64.CHROUT(ubytearray[X]) ; @todo fix compiler crash " + c64.CHROUT(wordarray[1]) ; @todo fix compiler crash " + + testsub(X) ; @todo fix compiler crash + testsub(b1) ; @todo fix compiler crash + testsub(char1) ; @todo fix compiler crash + testsub(mb1) ; @todo fix compiler crash + testsub(mub1) ; @todo fix compiler crash + testsub(ubytearray[1]) ; @todo fix compiler crash + testsub(ubytearray[X]) ; @todo fix compiler crash + testsub(wordarray[1]) ; @todo fix compiler crash + return } +sub testsub(arg: ubyte) { + return +} + } diff --git a/compiler/src/prog8/CompilerMain.kt b/compiler/src/prog8/CompilerMain.kt index 06aeea7a1..1a2867815 100644 --- a/compiler/src/prog8/CompilerMain.kt +++ b/compiler/src/prog8/CompilerMain.kt @@ -36,6 +36,7 @@ fun main(args: Array) { val startTime = System.currentTimeMillis() val filepath = Paths.get(moduleFile).normalize() + val programname: String try { // import main module and process additional imports @@ -125,6 +126,7 @@ fun main(args: Array) { val assembly = AsmGen(compilerOptions, intermediate, heap).compileToAssembly() assembly.assemble(compilerOptions) + programname = assembly.name val endTime = System.currentTimeMillis() println("\nTotal compilation+assemble time: ${(endTime-startTime)/1000.0} sec.") @@ -137,10 +139,9 @@ fun main(args: Array) { if(startEmu) { println("\nStarting C64 emulator...") - val program = "foo" - val monitorfile = "foo.mon_list" + val monitorfile = "$programname.mon_list" val cmdline = listOf("x64", "-moncommands", monitorfile, - "-autostartprgmode", "1", "-autostart-warp", "-autostart", program) + "-autostartprgmode", "1", "-autostart-warp", "-autostart", programname+".prg") ProcessBuilder(cmdline).inheritIO().start() } }