mirror of
https://github.com/irmen/prog8.git
synced 2024-12-23 09:32:43 +00:00
-target option is now required; c64 no longer the default
This commit is contained in:
parent
bfaad1388c
commit
9314c346da
@ -48,7 +48,7 @@ private fun compileMain(args: Array<String>): Boolean {
|
|||||||
val quietAssembler by cli.option(ArgType.Boolean, fullName = "quietasm", description = "don't print assembler output results")
|
val quietAssembler by cli.option(ArgType.Boolean, fullName = "quietasm", description = "don't print assembler output results")
|
||||||
val slowCodegenWarnings by cli.option(ArgType.Boolean, fullName = "slowwarn", description="show debug warnings about slow/problematic assembly code generation")
|
val slowCodegenWarnings by cli.option(ArgType.Boolean, fullName = "slowwarn", description="show debug warnings about slow/problematic assembly code generation")
|
||||||
val sourceDirs by cli.option(ArgType.String, fullName="srcdirs", description = "list of extra paths, separated with ${File.pathSeparator}, to search in for imported modules").multiple().delimiter(File.pathSeparator)
|
val sourceDirs by cli.option(ArgType.String, fullName="srcdirs", description = "list of extra paths, separated with ${File.pathSeparator}, to search in for imported modules").multiple().delimiter(File.pathSeparator)
|
||||||
val compilationTarget by cli.option(ArgType.String, fullName = "target", description = "target output of the compiler (one of '${C64Target.NAME}', '${C128Target.NAME}', '${Cx16Target.NAME}', '${AtariTarget.NAME}', '${VMTarget.NAME}')").default(C64Target.NAME)
|
val compilationTarget by cli.option(ArgType.String, fullName = "target", description = "target output of the compiler (one of '${C64Target.NAME}', '${C128Target.NAME}', '${Cx16Target.NAME}', '${AtariTarget.NAME}', '${VMTarget.NAME}')").required()
|
||||||
val startVm by cli.option(ArgType.Boolean, fullName = "vm", description = "load and run a .p8ir IR source file in the VM")
|
val startVm by cli.option(ArgType.Boolean, fullName = "vm", description = "load and run a .p8ir IR source file in the VM")
|
||||||
val watchMode by cli.option(ArgType.Boolean, fullName = "watch", description = "continuous compilation mode (watch for file changes)")
|
val watchMode by cli.option(ArgType.Boolean, fullName = "watch", description = "continuous compilation mode (watch for file changes)")
|
||||||
val varsHigh by cli.option(ArgType.Boolean, fullName = "varshigh", description = "put uninitialized variables in high memory area instead of at the end of the program")
|
val varsHigh by cli.option(ArgType.Boolean, fullName = "varshigh", description = "put uninitialized variables in high memory area instead of at the end of the program")
|
||||||
|
@ -32,6 +32,7 @@ class ModuleImporter(private val program: Program,
|
|||||||
val programPath = path.resolve(normalizedFilePath)
|
val programPath = path.resolve(normalizedFilePath)
|
||||||
if(programPath.exists()) {
|
if(programPath.exists()) {
|
||||||
println("Compiling program ${Path("").absolute().relativize(programPath)}")
|
println("Compiling program ${Path("").absolute().relativize(programPath)}")
|
||||||
|
println("Compiler target: $compilationTargetName")
|
||||||
val source = SourceCode.File(programPath)
|
val source = SourceCode.File(programPath)
|
||||||
return Ok(importModule(source))
|
return Ok(importModule(source))
|
||||||
}
|
}
|
||||||
|
@ -109,10 +109,9 @@ One or more .p8 module files
|
|||||||
Prints short command line usage information.
|
Prints short command line usage information.
|
||||||
|
|
||||||
``-target <compilation target>``
|
``-target <compilation target>``
|
||||||
Sets the target output of the compiler.
|
Sets the target output of the compiler. This option is required.
|
||||||
``c64`` = Commodore 64, ``c128`` = Commodore 128, ``cx16`` = Commander X16, ``atari`` = Atari 800 XL,
|
``c64`` = Commodore 64, ``c128`` = Commodore 128, ``cx16`` = Commander X16, ``atari`` = Atari 800 XL,
|
||||||
``virtual`` = builtin virtual machine.
|
``virtual`` = builtin virtual machine.
|
||||||
Default = ``c64``.
|
|
||||||
|
|
||||||
``-srcdirs <pathlist>``
|
``-srcdirs <pathlist>``
|
||||||
Specify a list of extra paths (separated with ':'), to search in for imported modules.
|
Specify a list of extra paths (separated with ':'), to search in for imported modules.
|
||||||
@ -292,11 +291,11 @@ Examples
|
|||||||
|
|
||||||
A couple of example programs can be found in the 'examples' directory of the source tree.
|
A couple of example programs can be found in the 'examples' directory of the source tree.
|
||||||
Make sure you have installed the :ref:`requirements`. Then, for instance,
|
Make sure you have installed the :ref:`requirements`. Then, for instance,
|
||||||
to compile and run the rasterbars example program, use this command::
|
to compile and run the Commodore 64 rasterbars example program, use this command::
|
||||||
|
|
||||||
$ java -jar prog8compiler.jar -emu examples/rasterbars.p8
|
$ java -jar prog8compiler.jar -target c64 -emu examples/rasterbars.p8
|
||||||
|
|
||||||
or::
|
or::
|
||||||
|
|
||||||
$ ./p8compile.sh -emu examples/rasterbars.p8
|
$ ./p8compile.sh -target c64 -emu examples/rasterbars.p8
|
||||||
|
|
||||||
|
@ -47,8 +47,12 @@ sys (part of syslib)
|
|||||||
system when the program is running.
|
system when the program is running.
|
||||||
The following return values are currently defined:
|
The following return values are currently defined:
|
||||||
|
|
||||||
- 16 = compiled for Commander X16 with 65C02 CPU
|
- 8 = Atari 8 bits
|
||||||
- 64 = compiled for Commodore 64 with 6502/6510 CPU
|
- 16 = Commander X16
|
||||||
|
- 64 = Commodore 64
|
||||||
|
- 128 = Commodore 128
|
||||||
|
- 255 = Virtual machine
|
||||||
|
|
||||||
|
|
||||||
``exit (returncode)``
|
``exit (returncode)``
|
||||||
Immediately stops the program and exits it, with the returncode in the A register.
|
Immediately stops the program and exits it, with the returncode in the A register.
|
||||||
|
@ -23,6 +23,7 @@ Details of several important ones and how to convert version 8 code can be found
|
|||||||
- added gfx2.fill() flood fill routine
|
- added gfx2.fill() flood fill routine
|
||||||
- added @split storage class for (u)word arrays to store them as split lsb/msb arrays which is more efficient (but doesn't yet support all array operations)
|
- added @split storage class for (u)word arrays to store them as split lsb/msb arrays which is more efficient (but doesn't yet support all array operations)
|
||||||
- added -splitarrays command line option and '%option splitarrays' to treat all word arrays as tagged with @split
|
- added -splitarrays command line option and '%option splitarrays' to treat all word arrays as tagged with @split
|
||||||
|
- the -target option is now required, c64 is no longer a default.
|
||||||
|
|
||||||
|
|
||||||
``cx16diskio`` is now just ``diskio``
|
``cx16diskio`` is now just ``diskio``
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
%import string
|
%import string
|
||||||
|
|
||||||
; Animal guessing game where the computer gets smarter every time.
|
; Animal guessing game where the computer gets smarter every time.
|
||||||
; Note: this program is compatible with C64 and CX16.
|
; Note: this program can be compiled for multiple target systems.
|
||||||
|
|
||||||
main {
|
main {
|
||||||
const ubyte database_size = 100
|
const ubyte database_size = 100
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
%import math
|
%import math
|
||||||
%zeropage basicsafe
|
%zeropage basicsafe
|
||||||
|
|
||||||
; Note: this program is compatible with C64 and CX16.
|
; Note: this program can be compiled for multiple target systems.
|
||||||
|
|
||||||
main {
|
main {
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
%option no_sysinit
|
%option no_sysinit
|
||||||
|
|
||||||
; The "Byte Sieve" test. https://en.wikipedia.org/wiki/Byte_Sieve
|
; The "Byte Sieve" test. https://en.wikipedia.org/wiki/Byte_Sieve
|
||||||
; Note: this program is compatible with C64 and CX16.
|
; Note: this program can be compiled for multiple target systems.
|
||||||
|
|
||||||
main {
|
main {
|
||||||
sub start() {
|
sub start() {
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
%import test_stack
|
%import test_stack
|
||||||
%zeropage basicsafe
|
%zeropage basicsafe
|
||||||
|
|
||||||
; Note: this program is compatible with C64 and CX16.
|
; Note: this program can be compiled for multiple target systems.
|
||||||
|
|
||||||
main {
|
main {
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
%import graphics
|
%import graphics
|
||||||
%import math
|
%import math
|
||||||
|
|
||||||
; Note: this program is compatible with C64 and CX16.
|
; Note: this program can be compiled for multiple target systems.
|
||||||
|
|
||||||
main {
|
main {
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
%import math
|
%import math
|
||||||
%import cx16logo
|
%import cx16logo
|
||||||
|
|
||||||
; Note: this program is compatible with C64 and CX16.
|
; Note: this program can be compiled for multiple target systems.
|
||||||
|
|
||||||
main {
|
main {
|
||||||
sub start() {
|
sub start() {
|
||||||
@ -10,7 +10,7 @@ main {
|
|||||||
ubyte col = math.rnd() % (txt.DEFAULT_WIDTH-13) + 3
|
ubyte col = math.rnd() % (txt.DEFAULT_WIDTH-13) + 3
|
||||||
ubyte row = math.rnd() % (txt.DEFAULT_HEIGHT-7)
|
ubyte row = math.rnd() % (txt.DEFAULT_HEIGHT-7)
|
||||||
cx16logo.logo_at(col, row)
|
cx16logo.logo_at(col, row)
|
||||||
txt.plot(col-3, row+7 )
|
txt.plot(col-3, row+7)
|
||||||
txt.print("commander x16")
|
txt.print("commander x16")
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -4,6 +4,8 @@
|
|||||||
%import test_stack
|
%import test_stack
|
||||||
%option no_sysinit
|
%option no_sysinit
|
||||||
|
|
||||||
|
; Note: this program can be compiled for multiple target systems.
|
||||||
|
|
||||||
main {
|
main {
|
||||||
sub start() {
|
sub start() {
|
||||||
diskio.set_drive(8)
|
diskio.set_drive(8)
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
%zeropage basicsafe
|
%zeropage basicsafe
|
||||||
|
|
||||||
; This example computes the first 20 values of the Fibonacci sequence.
|
; This example computes the first 20 values of the Fibonacci sequence.
|
||||||
; Note: this program is compatible with C64 and CX16.
|
; Note: this program can be compiled for multiple target systems.
|
||||||
|
|
||||||
main {
|
main {
|
||||||
sub start() {
|
sub start() {
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
%import test_stack
|
%import test_stack
|
||||||
%import math
|
%import math
|
||||||
|
|
||||||
; Note: this program is compatible with C64 and CX16.
|
; Note: this program can be compiled for multiple target systems.
|
||||||
|
|
||||||
main {
|
main {
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
%import syslib
|
%import syslib
|
||||||
%zeropage basicsafe
|
%zeropage basicsafe
|
||||||
|
|
||||||
; Note: this program is compatible with C64 and CX16.
|
; Note: this program can be compiled for multiple target systems.
|
||||||
|
|
||||||
main {
|
main {
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
; NOTE: this will take an eternity to draw on a real c64. A CommanderX16 is a bit faster.
|
; NOTE: this will take an eternity to draw on a real c64. A CommanderX16 is a bit faster.
|
||||||
; even in Vice in warp mode (700% speed on my machine) it's slow, but you can see progress
|
; even in Vice in warp mode (700% speed on my machine) it's slow, but you can see progress
|
||||||
|
|
||||||
; Note: this program is compatible with C64 and CX16.
|
; Note: this program can be compiled for multiple target systems.
|
||||||
|
|
||||||
main {
|
main {
|
||||||
const uword width = 320
|
const uword width = 320
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
%import test_stack
|
%import test_stack
|
||||||
%zeropage basicsafe
|
%zeropage basicsafe
|
||||||
|
|
||||||
; Note: this program is compatible with C64 and CX16.
|
; Note: this program can be compiled for multiple target systems.
|
||||||
|
|
||||||
main {
|
main {
|
||||||
const uword width = 30
|
const uword width = 30
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
; This program shows a depth-first maze generation algorithm (1 possible path from start to finish),
|
; This program shows a depth-first maze generation algorithm (1 possible path from start to finish),
|
||||||
; and a depth-first maze solver algorithm, both using a stack to store the path taken.
|
; and a depth-first maze solver algorithm, both using a stack to store the path taken.
|
||||||
|
|
||||||
; Note: this program is compatible with C64 and CX16.
|
; Note: this program can be compiled for multiple target systems.
|
||||||
|
|
||||||
main {
|
main {
|
||||||
sub start() {
|
sub start() {
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
%zeropage basicsafe
|
%zeropage basicsafe
|
||||||
|
|
||||||
; The classic number guessing game.
|
; The classic number guessing game.
|
||||||
; Note: this program is compatible with C64 and CX16.
|
; Note: this program can be compiled for multiple target systems.
|
||||||
|
|
||||||
|
|
||||||
main {
|
main {
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
%import textio
|
%import textio
|
||||||
; %import test_stack
|
|
||||||
%zeropage basicsafe
|
%zeropage basicsafe
|
||||||
|
|
||||||
; Note: this program is compatible with C64 and CX16.
|
; Note: this program can be compiled for multiple target systems.
|
||||||
|
|
||||||
main {
|
main {
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
%import textio
|
%import textio
|
||||||
%zeropage basicsafe
|
%zeropage basicsafe
|
||||||
|
|
||||||
; Note: this program is compatible with C64 and CX16.
|
; Note: this program can be compiled for multiple target systems.
|
||||||
|
|
||||||
main {
|
main {
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
%import textio
|
%import textio
|
||||||
%zeropage basicsafe
|
%zeropage basicsafe
|
||||||
|
|
||||||
; Note: this program is compatible with C64 and CX16.
|
; Note: this program can be compiled for multiple target systems.
|
||||||
|
|
||||||
main {
|
main {
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
%import floats
|
%import floats
|
||||||
%zeropage floatsafe
|
%zeropage floatsafe
|
||||||
|
|
||||||
; Note: this program is compatible with C64 and CX16.
|
; Note: this program can be compiled for multiple target systems.
|
||||||
|
|
||||||
main {
|
main {
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
%import textio
|
%import textio
|
||||||
%zeropage basicsafe
|
%zeropage basicsafe
|
||||||
|
|
||||||
; Note: this program is compatible with C64 and CX16.
|
; Note: this program can be compiled for multiple target systems.
|
||||||
|
|
||||||
main {
|
main {
|
||||||
const uword screenwidth = txt.DEFAULT_WIDTH
|
const uword screenwidth = txt.DEFAULT_WIDTH
|
||||||
|
@ -6,7 +6,7 @@ main {
|
|||||||
str name1 = "name1"
|
str name1 = "name1"
|
||||||
str name2 = "name2"
|
str name2 = "name2"
|
||||||
|
|
||||||
uword[] names = [name1, name2, "name3"]
|
uword[] @split names = [name1, name2, "name3"]
|
||||||
|
|
||||||
uword ww
|
uword ww
|
||||||
; for ww in names {
|
; for ww in names {
|
||||||
@ -22,12 +22,12 @@ main {
|
|||||||
names[idx]--
|
names[idx]--
|
||||||
txt.print_uw(names[1])
|
txt.print_uw(names[1])
|
||||||
|
|
||||||
; names = [1111,2222,3333]
|
names = [1111,2222,3333]
|
||||||
; for ww in names {
|
for ww in names {
|
||||||
; txt.print_uw(ww)
|
txt.print_uw(ww)
|
||||||
; txt.spc()
|
txt.spc()
|
||||||
; }
|
}
|
||||||
; txt.nl()
|
txt.nl()
|
||||||
txt.print("end.")
|
txt.print("end.")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
; Prog8 adaptation of the Text-Elite galaxy system trading simulation engine.
|
; Prog8 adaptation of the Text-Elite galaxy system trading simulation engine.
|
||||||
; Original C-version obtained from: http://www.elitehomepage.org/text/index.htm
|
; Original C-version obtained from: http://www.elitehomepage.org/text/index.htm
|
||||||
|
|
||||||
; Note: this program is compatible with C64 and CX16.
|
; Note: this program can be compiled for multiple target systems.
|
||||||
|
|
||||||
main {
|
main {
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user