mirror of
https://github.com/irmen/prog8.git
synced 2024-11-22 00:31:56 +00:00
move shared cbm diskio to its own file (c64/c128) so that pet/atari/neo targets give better error message when trying to import non existing diskio module there
sorted the command line options alphabetically
This commit is contained in:
parent
a3fa527378
commit
4bdabe1961
@ -41,35 +41,35 @@ fun pathFrom(stringPath: String, vararg rest: String): Path = FileSystems.getDe
|
||||
|
||||
private fun compileMain(args: Array<String>): Boolean {
|
||||
val cli = ArgParser("prog8c", prefixStyle = ArgParser.OptionPrefixStyle.JVM)
|
||||
val addMissingRts by cli.option(ArgType.Boolean, fullName = "addmissingrts", description="enable old behavior that silently adds RTS to asmsubs that don't have one (deprecated, may go away in future version)")
|
||||
val asmListfile by cli.option(ArgType.Boolean, fullName = "asmlist", description = "make the assembler produce a listing file as well")
|
||||
val breakpointCpuInstruction by cli.option(ArgType.Choice(listOf("brk", "stp"), { it }), fullName = "breakinstr", description = "the CPU instruction to use as well for %breakpoint")
|
||||
val bytes2float by cli.option(ArgType.String, fullName = "bytes2float", description = "convert a comma separated list of bytes from the target system to a float value. NOTE: you need to supply a target option too, and also still have to supply a dummy module file name as well!")
|
||||
val checkSource by cli.option(ArgType.Boolean, fullName = "check", description = "quickly check program for errors, no output will be produced")
|
||||
val symbolDefs by cli.option(ArgType.String, fullName = "D", description = "define assembly symbol(s) with -D SYMBOL=VALUE").multiple()
|
||||
val dumpSymbols by cli.option(ArgType.Boolean, fullName = "dumpsymbols", description = "print a dump of the variable declarations and subroutine signatures")
|
||||
val dumpVariables by cli.option(ArgType.Boolean, fullName = "dumpvars", description = "print a dump of the variables in the program")
|
||||
val startEmulator1 by cli.option(ArgType.Boolean, fullName = "emu", description = "auto-start emulator after successful compilation")
|
||||
val startEmulator2 by cli.option(ArgType.Boolean, fullName = "emu2", description = "auto-start alternative emulator after successful compilation")
|
||||
val experimentalCodegen by cli.option(ArgType.Boolean, fullName = "expericodegen", description = "use experimental/alternative codegen")
|
||||
val dumpVariables by cli.option(ArgType.Boolean, fullName = "dumpvars", description = "print a dump of the variables in the program")
|
||||
val dumpSymbols by cli.option(ArgType.Boolean, fullName = "dumpsymbols", description = "print a dump of the variable declarations and subroutine signatures")
|
||||
val float2bytes by cli.option(ArgType.String, fullName = "float2bytes", description = "convert floating point number to a list of bytes for the target system. NOTE: you need to supply a target option too, and also still have to supply a dummy module file name as well!")
|
||||
val dontWriteAssembly by cli.option(ArgType.Boolean, fullName = "noasm", description="don't create assembly code")
|
||||
val dontOptimize by cli.option(ArgType.Boolean, fullName = "noopt", description = "don't perform code optimizations")
|
||||
val outputDir by cli.option(ArgType.String, fullName = "out", description = "directory for output files instead of current directory").default(".")
|
||||
val quietAssembler by cli.option(ArgType.Boolean, fullName = "quietasm", description = "don't print assembler output results")
|
||||
val warnSymbolShadowing by cli.option(ArgType.Boolean, fullName = "warnshadow", description="show assembler warnings about symbol shadowing")
|
||||
val addMissingRts by cli.option(ArgType.Boolean, fullName = "addmissingrts", description="enable old behavior that silently adds RTS to asmsubs that don't have one (deprecated, may go away in future version)")
|
||||
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 includeSourcelines by cli.option(ArgType.Boolean, fullName = "sourcelines", description = "include original Prog8 source lines in generated asm code")
|
||||
val splitWordArrays by cli.option(ArgType.Boolean, fullName = "splitarrays", description = "treat all word arrays as tagged with @split to make them lsb/msb split in memory")
|
||||
val printAst1 by cli.option(ArgType.Boolean, fullName = "printast1", description = "print out the compiler AST")
|
||||
val printAst2 by cli.option(ArgType.Boolean, fullName = "printast2", description = "print out the intermediate AST that is used for code generation")
|
||||
val breakpointCpuInstruction by cli.option(ArgType.Choice(listOf("brk", "stp"), { it }), fullName = "breakinstr", description = "the CPU instruction to use as well for %breakpoint")
|
||||
val compilationTarget by cli.option(ArgType.String, fullName = "target", description = "target output of the compiler (one of ${CompilationTargets.joinToString(",")}) (required)")
|
||||
val bytes2float by cli.option(ArgType.String, fullName = "bytes2float", description = "convert a comma separated list of bytes from the target system to a float value. NOTE: you need to supply a target option too, and also still have to supply a dummy module file name as well!")
|
||||
val float2bytes by cli.option(ArgType.String, fullName = "float2bytes", description = "convert floating point number to a list of bytes for the target system. NOTE: you need to supply a target option too, and also still have to supply a dummy module file name as well!")
|
||||
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 varsGolden by cli.option(ArgType.Boolean, fullName = "varsgolden", description = "put uninitialized variables in 'golden ram' memory area instead of at the end of the program. On the cx16 target this is $0400-07ff. This is unavailable on other systems.")
|
||||
val varsHighBank by cli.option(ArgType.Int, fullName = "varshigh", description = "put uninitialized variables in high memory area instead of at the end of the program. On the cx16 target the value specifies the HiRAM bank to use, on other systems this value is ignored.")
|
||||
val quietAssembler by cli.option(ArgType.Boolean, fullName = "quietasm", description = "don't print assembler output results")
|
||||
val slabsGolden by cli.option(ArgType.Boolean, fullName = "slabsgolden", description = "put memory() slabs in 'golden ram' memory area instead of at the end of the program. On the cx16 target this is $0400-07ff. This is unavailable on other systems.")
|
||||
val slabsHighBank by cli.option(ArgType.Int, fullName = "slabshigh", description = "put memory() slabs in high memory area instead of at the end of the program. On the cx16 target the value specifies the HiRAM bank to use, on other systems this value is ignored.")
|
||||
val includeSourcelines by cli.option(ArgType.Boolean, fullName = "sourcelines", description = "include original Prog8 source lines in generated asm code")
|
||||
val splitWordArrays by cli.option(ArgType.Boolean, fullName = "splitarrays", description = "treat all word arrays as tagged with @split to make them lsb/msb split in memory")
|
||||
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 ${CompilationTargets.joinToString(",")}) (required)")
|
||||
val varsGolden by cli.option(ArgType.Boolean, fullName = "varsgolden", description = "put uninitialized variables in 'golden ram' memory area instead of at the end of the program. On the cx16 target this is $0400-07ff. This is unavailable on other systems.")
|
||||
val varsHighBank by cli.option(ArgType.Int, fullName = "varshigh", description = "put uninitialized variables in high memory area instead of at the end of the program. On the cx16 target the value specifies the HiRAM bank to use, on other systems this value is ignored.")
|
||||
val startVm by cli.option(ArgType.Boolean, fullName = "vm", description = "run a .p8ir IR source file in the embedded VM")
|
||||
val warnSymbolShadowing by cli.option(ArgType.Boolean, fullName = "warnshadow", description="show assembler warnings about symbol shadowing")
|
||||
val watchMode by cli.option(ArgType.Boolean, fullName = "watch", description = "continuous compilation mode (watch for file changes)")
|
||||
val moduleFiles by cli.argument(ArgType.String, fullName = "modules", description = "main module file(s) to compile").multiple(999)
|
||||
|
||||
try {
|
||||
|
10
docs/import-all-neo.p8
Normal file
10
docs/import-all-neo.p8
Normal file
@ -0,0 +1,10 @@
|
||||
; all library modules for the atari compiler target
|
||||
|
||||
%import anyall
|
||||
%import buffers
|
||||
%import compression
|
||||
%import conv
|
||||
%import math
|
||||
%import prog8_lib
|
||||
%import string
|
||||
%import syslib
|
@ -133,69 +133,14 @@ One or more .p8 module files
|
||||
``-help``, ``-h``
|
||||
Prints short command line usage information.
|
||||
|
||||
``-target <compilation target>``
|
||||
Sets the target output of the compiler. This option is required.
|
||||
``c64`` = Commodore 64, ``c128`` = Commodore 128, ``cx16`` = Commander X16, ``pet32`` - Commodore PET model 4032,
|
||||
``atari`` = Atari 800 XL, ``neo`` = Neo6502, ``virtual`` = builtin virtual machine.
|
||||
|
||||
``-srcdirs <pathlist>``
|
||||
Specify a list of extra paths (separated with ':'), to search in for imported modules.
|
||||
Useful if you have library modules somewhere that you want to re-use,
|
||||
or to switch implementations of certain routines via a command line switch.
|
||||
|
||||
``-emu``, ``-emu2``
|
||||
Auto-starts target system emulator after successful compilation.
|
||||
emu2 starts the alternative emulator if available.
|
||||
The compiled program and the symbol and breakpoint lists
|
||||
(for the machine code monitor) are immediately loaded into the emulator (if it supports them)
|
||||
|
||||
``-out <directory>``
|
||||
sets directory location for output files instead of current directory
|
||||
|
||||
``-noasm``
|
||||
Do not create assembly code and output program.
|
||||
Useful for debugging or doing quick syntax checks.
|
||||
|
||||
``-noopt``
|
||||
Don't perform any code optimizations.
|
||||
Useful for debugging or faster compilation cycles.
|
||||
|
||||
``-optfloatx``
|
||||
Also optimize float expressions if optimizations are enabled.
|
||||
Warning: can increase program size significantly if a lot of floating point expressions are used.
|
||||
|
||||
``-watch``
|
||||
Enables continuous compilation mode (watches for file changes).
|
||||
This greatly increases compilation speed on subsequent runs:
|
||||
almost instant compilation times (less than a second) can be achieved in this mode.
|
||||
The compiler will compile your program and then instead of exiting, it waits for any changes in the module source files.
|
||||
As soon as a change happens, the program gets compiled again.
|
||||
Note that it is possible to use the watch mode with multiple modules as well, but it will
|
||||
recompile everything in that list even if only one of the files got updated.
|
||||
|
||||
``-warnshadow``
|
||||
Tells the assembler to issue warning messages about symbol shadowing.
|
||||
These *can* be problematic, but usually aren't because prog8 has different scoping rules
|
||||
than the assembler has.
|
||||
You may want to watch out for shadowing of builtin names though. Especially 'a', 'x' and 'y'
|
||||
as those are the cpu register names and if you shadow those, the assembler might
|
||||
interpret certain instructions differently and produce unexpected opcodes (like LDA X getting
|
||||
turned into TXA, or not, depending on the symbol 'x' being defined in your own assembly code or not)
|
||||
|
||||
``-addmissingrts``
|
||||
Enables old compiler behavior that silently adds RTS to asmsubs that don't have one.
|
||||
This was done to fix asmsubs so they return properly to the caller instead of crashing the program.
|
||||
However the new compiler behavior is to not silently modify the code anymore and instead give an error message
|
||||
that tells you how to fix the problem. This option may go away in future version.
|
||||
|
||||
``-quietasm``
|
||||
Don't print assembler output results.
|
||||
|
||||
``-asmlist``
|
||||
Generate an assembler listing file as well.
|
||||
|
||||
``-check``
|
||||
Quickly check the program for errors. No actual compilation will be performed.
|
||||
Also generate an assembler listing file <program>.list
|
||||
|
||||
``-breakinstr <instruction>``
|
||||
Also output the specified CPU instruction for a ``%breakpoint``, as well as the entry in the vice monitor list file.
|
||||
@ -205,9 +150,49 @@ One or more .p8 module files
|
||||
For example for the Commander X16 emulator, ``stp`` is useful because it can actually tyrigger
|
||||
a breakpoint halt in the debugger when this is enabled by running the emulator with -debug.
|
||||
|
||||
``-bytes2float <bytes>``
|
||||
convert a comma separated list of bytes from the target system to a float value.
|
||||
NOTE: you need to supply a target option too, and also still have to supply a dummy module file name as well!
|
||||
Also see -float2bytes
|
||||
|
||||
``-check``
|
||||
Quickly check the program for errors. No actual compilation will be performed.
|
||||
|
||||
``-D SYMBOLNAME=VALUE``
|
||||
Add this user-defined symbol directly to the beginning of the generated assembly file.
|
||||
Can be repeated to define multiple symbols.
|
||||
|
||||
``-dumpsymbols``
|
||||
print a dump of the variable declarations and subroutine signatures
|
||||
|
||||
``-dumpvars``
|
||||
print a dump of the variables in the program
|
||||
|
||||
``-emu``, ``-emu2``
|
||||
Auto-starts target system emulator after successful compilation.
|
||||
emu2 starts the alternative emulator if available.
|
||||
The compiled program and the symbol and breakpoint lists
|
||||
(for the machine code monitor) are immediately loaded into the emulator (if it supports them)
|
||||
|
||||
``-expericodegen``
|
||||
Use experimental code generation backend (*incomplete*).
|
||||
|
||||
``-float2bytes <number>``
|
||||
convert floating point number to a list of bytes for the target system.
|
||||
NOTE: you need to supply a target option too, and also still have to supply a dummy module file name as well!
|
||||
Also see -bytes2float
|
||||
|
||||
``-noasm``
|
||||
Do not create assembly code and output program.
|
||||
Useful for debugging or doing quick syntax checks.
|
||||
|
||||
``-noopt``
|
||||
Don't perform any code optimizations.
|
||||
Useful for debugging or faster compilation cycles.
|
||||
|
||||
``-out <directory>``
|
||||
sets directory location for output files instead of current directory
|
||||
|
||||
``-printast1``
|
||||
Prints the "compiler AST" (the internal representation of the program) after all processing steps.
|
||||
|
||||
@ -215,11 +200,16 @@ One or more .p8 module files
|
||||
Prints the "intermediate AST" which is the reduced representation of the program.
|
||||
This is what is used in the code generators, to generate the executable code from.
|
||||
|
||||
``-dumpvars``
|
||||
print a dump of the variables in the program
|
||||
``-quietasm``
|
||||
Don't print assembler output results.
|
||||
|
||||
``-dumpsymbols``
|
||||
print a dump of the variable declarations and subroutine signatures
|
||||
``-slabsgolden``
|
||||
put memory() slabs in 'golden ram' memory area instead of at the end of the program.
|
||||
On the cx16 target this is $0400-07ff. This is unavailable on other systems.
|
||||
|
||||
``-slabshigh``
|
||||
put memory() slabs in high memory area instead of at the end of the program.
|
||||
On the cx16 target the value specifies the HiRAM bank to use, on other systems this value is ignored.
|
||||
|
||||
``-sourcelines``
|
||||
Also include the original prog8 source code lines as comments in the generated assembly code file,
|
||||
@ -231,12 +221,20 @@ One or more .p8 module files
|
||||
This removes the need to add @split yourself but some programs may fail to compile with
|
||||
this option as not all array operations are implemented yet on split arrays.
|
||||
|
||||
``-vm``
|
||||
load and run a p8-virt or p8-ir listing in the internal VirtualMachine instead of compiling a prog8 program file..
|
||||
``-srcdirs <pathlist>``
|
||||
Specify a list of extra paths (separated with ':'), to search in for imported modules.
|
||||
Useful if you have library modules somewhere that you want to re-use,
|
||||
or to switch implementations of certain routines via a command line switch.
|
||||
|
||||
``-D SYMBOLNAME=VALUE``
|
||||
Add this user-defined symbol directly to the beginning of the generated assembly file.
|
||||
Can be repeated to define multiple symbols.
|
||||
``-target <compilation target>``
|
||||
Sets the target output of the compiler. This option is required.
|
||||
``c64`` = Commodore 64, ``c128`` = Commodore 128, ``cx16`` = Commander X16, ``pet32`` - Commodore PET model 4032,
|
||||
``atari`` = Atari 800 XL, ``neo`` = Neo6502, ``virtual`` = builtin virtual machine.
|
||||
|
||||
``-varsgolden``
|
||||
Like ``-varshigh``, but places the variables in the $0400-$07FF "golden ram" area instead.
|
||||
Because this is in normal system memory, there are no bank switching issues.
|
||||
This mode is only available on the Commander X16.
|
||||
|
||||
``-varshigh <rambank>``
|
||||
Places uninitialized non-zeropage variables in a separate memory area, instead of inside the program itself.
|
||||
@ -254,26 +252,26 @@ One or more .p8 module files
|
||||
(it's called 'BSS' section or Gap at the address mentioned above).
|
||||
Assembling the program will fail if there are too many variables to fit in a single high ram bank.
|
||||
|
||||
``-varsgolden``
|
||||
Like ``-varshigh``, but places the variables in the $0400-$07FF "golden ram" area instead.
|
||||
Because this is in normal system memory, there are no bank switching issues.
|
||||
This mode is only available on the Commander X16.
|
||||
``-vm``
|
||||
load and run a p8-virt or p8-ir listing in the internal VirtualMachine instead of compiling a prog8 program file..
|
||||
|
||||
``-slabshigh``
|
||||
put memory() slabs in high memory area instead of at the end of the program.
|
||||
On the cx16 target the value specifies the HiRAM bank to use, on other systems this value is ignored.
|
||||
``-warnshadow``
|
||||
Tells the assembler to issue warning messages about symbol shadowing.
|
||||
These *can* be problematic, but usually aren't because prog8 has different scoping rules
|
||||
than the assembler has.
|
||||
You may want to watch out for shadowing of builtin names though. Especially 'a', 'x' and 'y'
|
||||
as those are the cpu register names and if you shadow those, the assembler might
|
||||
interpret certain instructions differently and produce unexpected opcodes (like LDA X getting
|
||||
turned into TXA, or not, depending on the symbol 'x' being defined in your own assembly code or not)
|
||||
|
||||
``-slabsgolden``
|
||||
put memory() slabs in 'golden ram' memory area instead of at the end of the program.
|
||||
On the cx16 target this is $0400-07ff. This is unavailable on other systems.
|
||||
|
||||
``-bytes2float <bytes>``
|
||||
convert a comma separated list of bytes from the target system to a float value.
|
||||
NOTE: you need to supply a target option too, and also still have to supply a dummy module file name as well!
|
||||
|
||||
``-float2bytes <number>``
|
||||
convert floating point number to a list of bytes for the target system.
|
||||
NOTE: you need to supply a target option too, and also still have to supply a dummy module file name as well!
|
||||
``-watch``
|
||||
Enables continuous compilation mode (watches for file changes).
|
||||
This greatly increases compilation speed on subsequent runs:
|
||||
almost instant compilation times (less than a second) can be achieved in this mode.
|
||||
The compiler will compile your program and then instead of exiting, it waits for any changes in the module source files.
|
||||
As soon as a change happens, the program gets compiled again.
|
||||
Note that it is possible to use the watch mode with multiple modules as well, but it will
|
||||
recompile everything in that list even if only one of the files got updated.
|
||||
|
||||
|
||||
Module source code files
|
||||
|
Loading…
Reference in New Issue
Block a user