This commit is contained in:
Irmen de Jong 2024-02-26 01:17:25 +01:00
parent 040d75dafa
commit 82e0877e64
3 changed files with 10 additions and 6 deletions

View File

@ -51,8 +51,8 @@ GNU GPL 3.0 (see file LICENSE), with exception for generated code:
What does Prog8 provide? What does Prog8 provide?
------------------------ ------------------------
- reduction of source code length over raw assembly - all advantages of a higher level language over having to write assembly code manually
- fast execution speed due to compilation to native assembly code. It's possible to write certain raster interrupt 'demoscene' effects purely in Prog8. - programs run very fast because compilation to native machine code. It's possible to write games purely in Prog8, and even certain raster interrupt 'demoscene' effects.
- modularity, symbol scoping, subroutines - modularity, symbol scoping, subroutines
- various data types other than just bytes (16-bit words, floats, strings) - various data types other than just bytes (16-bit words, floats, strings)
- floating point math is supported if the target system provides floating point library routines (C64 and Cx16 both do) - floating point math is supported if the target system provides floating point library routines (C64 and Cx16 both do)
@ -60,6 +60,7 @@ What does Prog8 provide?
- automatic static variable allocations, automatic string and array variables and string sharing - automatic static variable allocations, automatic string and array variables and string sharing
- subroutines with input parameters and result values - subroutines with input parameters and result values
- high-level program optimizations - high-level program optimizations
- no need for forward declarations
- small program boilerplate/compilersupport overhead - small program boilerplate/compilersupport overhead
- programs can be run multiple times without reloading because of automatic variable (re)initializations. - programs can be run multiple times without reloading because of automatic variable (re)initializations.
- conditional branches - conditional branches

View File

@ -70,19 +70,19 @@ Language features
----------------- -----------------
- It is a cross-compiler running on modern machines (Linux, MacOS, Windows, ...) - It is a cross-compiler running on modern machines (Linux, MacOS, Windows, ...)
It generates a machine code program runnable on actual 8-bit 6502 hardware. - Programs run very fast because compilation to native machine code. It's possible to write games purely in Prog8, and even certain raster interrupt 'demoscene' effects.
- Fast execution speed due to compilation to native assembly code. It's possible to write games purely in Prog8, and even certain raster interrupt 'demoscene' effects.
- Provides a very convenient edit/compile/run cycle by being able to directly launch - Provides a very convenient edit/compile/run cycle by being able to directly launch
the compiled program in an emulator and provide debugging information to this emulator. the compiled program in an emulator and provide debugging information to this emulator.
- Based on simple and familiar imperative structured programming (it looks like a mix of C and Python) - Based on simple and familiar imperative structured programming (it looks like a mix of C and Python)
- Modular programming and scoping via modules, code blocks, and subroutines. - Modular programming and scoping via modules, code blocks, and subroutines.
- No need for forward declarations.
- Provide high level programming constructs but at the same time stay close to the metal; - Provide high level programming constructs but at the same time stay close to the metal;
still able to directly use memory addresses and ROM subroutines, still able to directly use memory addresses and ROM subroutines,
and inline assembly to have full control when every register, cycle or byte matters and inline assembly to have full control when every register, cycle or byte matters
- Subroutines with parameters and return values - Subroutines with parameters and return values
- Complex nested expressions are possible - Complex nested expressions are possible
- Variables are all allocated statically - Variables are all allocated statically
- Conditional branches to map directly on processor branch instructions - Conditional branches for status flags that map 1:1 to processor branch instructions
- ``when`` statement to avoid if-else chains - ``when`` statement to avoid if-else chains
- ``in`` expression for concise and efficient multi-value/containment test - ``in`` expression for concise and efficient multi-value/containment test
- Several powerful built-in functions, such as ``lsb``, ``msb``, ``min``, ``max``, ``rol``, ``ror``, ``sort`` and ``reverse`` - Several powerful built-in functions, such as ``lsb``, ``msb``, ``min``, ``max``, ``rol``, ``ror``, ``sort`` and ``reverse``
@ -92,7 +92,7 @@ Language features
- Identifiers can contain Unicode Letters, so ``knäckebröd``, ``приблизительно``, ``見せしめ`` and ``π`` are all valid identifiers. - Identifiers can contain Unicode Letters, so ``knäckebröd``, ``приблизительно``, ``見せしめ`` and ``π`` are all valid identifiers.
- Advanced code optimizations, such as const-folding (zero-allocation constants that are optimized away in expressions), expression and statement simplifications/rewriting. - Advanced code optimizations, such as const-folding (zero-allocation constants that are optimized away in expressions), expression and statement simplifications/rewriting.
- Programs can be run multiple times without reloading because of automatic variable (re)initializations. - Programs can be run multiple times without reloading because of automatic variable (re)initializations.
- Supports the sixteen 'virtual' 16-bit registers R0 .. R15 as defined on the Commander X16, also on the other machines. - Supports the sixteen 'virtual' 16-bit registers R0 to R15 as defined on the Commander X16, also on the other machines.
- Support for low level system features such as Vera Fx hardware word multiplication on the Commander X16 - Support for low level system features such as Vera Fx hardware word multiplication on the Commander X16
- If you only use standard Kernal and core prog8 library routines, it is sometimes possible to compile the *exact same program* for different machines (just change the compilation target flag) - If you only use standard Kernal and core prog8 library routines, it is sometimes possible to compile the *exact same program* for different machines (just change the compilation target flag)

View File

@ -10,6 +10,7 @@ Future Things and Ideas
^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^
Compiler: Compiler:
- IR: add TEST instruction to test memory content and set N/Z flags, without affecting any register. Replace all LOADM+CMPI #0 / LOAD #0+LOADM+CMP+BRANCH by this instruction
- can we support signed % (remainder) somehow? - can we support signed % (remainder) somehow?
- instead of copy-pasting inline asmsubs, make them into a 64tass macro and use that instead. - instead of copy-pasting inline asmsubs, make them into a 64tass macro and use that instead.
that will allow them to be reused from custom user written assembly code as well. that will allow them to be reused from custom user written assembly code as well.
@ -51,6 +52,7 @@ Compiler:
Libraries: Libraries:
- monogfx: add EOR mode support next to Stipple. See PAINT for inspiration. Can this also be added to gfx2? Self modifying code to keep it optimized?
- conv: the routines could return the address of conv.string_out, and/or there could be versions that take the address of a different buffer and use it instead. - conv: the routines could return the address of conv.string_out, and/or there could be versions that take the address of a different buffer and use it instead.
- once kernal rom v47 is released, remove most of the workarounds in cx16 floats.parse_f() . Prototype parse routine in examples/cx16/floatparse.p8 - once kernal rom v47 is released, remove most of the workarounds in cx16 floats.parse_f() . Prototype parse routine in examples/cx16/floatparse.p8
- fix the problems in atari target, and flesh out its libraries. - fix the problems in atari target, and flesh out its libraries.
@ -87,3 +89,4 @@ Other language/syntax features to think about
- add (rom/ram)bank support to romsub. A call will then automatically switch banks, use callfar and something else when in banked ram. - add (rom/ram)bank support to romsub. A call will then automatically switch banks, use callfar and something else when in banked ram.
challenges: how to not make this too X16 specific? How does the compiler know what bank to switch (ram/rom)? challenges: how to not make this too X16 specific? How does the compiler know what bank to switch (ram/rom)?
How to make it performant when we want to (i.e. NOT have it use callfar/auto bank switching) ? How to make it performant when we want to (i.e. NOT have it use callfar/auto bank switching) ?