preparing version 7.9

This commit is contained in:
Irmen de Jong 2022-03-02 23:31:07 +01:00
parent 6f87f8706c
commit 2812736ae5
10 changed files with 24 additions and 9 deletions

View File

@ -40,6 +40,8 @@ internal class BuiltinFunctionsAsmGen(private val program: Program,
// TODO make it so that we can assign efficiently from something else as an expression....namely: register(s)
// this is useful in pipe expressions for instance, to skip the use of a temporary variable
// but for now, just assign it to a temporary variable and use that as a source
// Idea: to do this without having to rewrite every single function in translateFunctioncall(),
// hack a special IdentifierReference like "!6502.A/X/Y/AX/AY/XY" to reference a cpu register
val tempvar = asmgen.getTempVarName(singleArg.datatype)
val assignTempvar = AsmAssignment(
singleArg,

View File

@ -68,6 +68,7 @@ sys {
}
asmsub memcopy(uword source @R0, uword target @R1, uword count @AY) clobbers(A,X,Y) {
; note: only works for NON-OVERLAPPING memory regions!
; note: can't be inlined because is called from asm as well
%asm {{
ldx cx16.r0

View File

@ -555,6 +555,7 @@ sys {
}
asmsub memcopy(uword source @R0, uword target @R1, uword count @AY) clobbers(A,X,Y) {
; note: only works for NON-OVERLAPPING memory regions!
; note: can't be inlined because is called from asm as well
%asm {{
ldx cx16.r0

View File

@ -520,6 +520,7 @@ sys {
}
asmsub memcopy(uword source @R0, uword target @R1, uword count @AY) clobbers(A,X,Y) {
; note: only works for NON-OVERLAPPING memory regions!
; note: can't be inlined because is called from asm as well
%asm {{
ldx cx16.r0

View File

@ -822,7 +822,10 @@ sys {
}
asmsub memcopy(uword source @R0, uword target @R1, uword count @AY) clobbers(A,X,Y) {
; note: can't be inlined because is called from asm as well
; note: only works for NON-OVERLAPPING memory regions!
; If you have to copy overlapping memory regions, consider using
; the cx16 specific kernal routine `memory_copy` (make sure kernal rom is banked in).
; note: can't be inlined because is called from asm as well.
; also: doesn't use cx16 ROM routine so this always works even when ROM is not banked in.
%asm {{
cpy #0

View File

@ -1 +1 @@
7.9-dev
7.9

View File

@ -18,8 +18,12 @@ This CPU is from the late 1970's and early 1980's and was used in many home comp
such as the `Commodore-64 <https://en.wikipedia.org/wiki/Commodore_64>`_.
The language aims to provide many conveniences over raw assembly code (even when using a macro assembler),
while still being low level enough to create high performance programs.
You can compile programs for various machines with this CPU such as the Commodore-64 and Commodore-128,
the Commander X16, and the Atari 800 XL.
You can compile programs for various machines with this CPU:
* Commodore 64
* Commander X16
* Commodore 128 (limited support for now)
* Atari 800 XL (limited support for now)
Prog8 is copyright © Irmen de Jong (irmen@razorvine.net | http://www.razorvine.net).

View File

@ -51,7 +51,7 @@ sys (part of syslib)
``memcopy(from, to, numbytes)``
Efficiently copy a number of bytes from a memory location to another.
NOTE: 'to' must NOT overlap with 'from', unless it is *before* 'from'.
*Warning:* can only copy *non-overlapping* memory areas correctly!
Because this function imposes some overhead to handle the parameters,
it is only faster if the number of bytes is larger than a certain threshold.
Compare the generated code to see if it was beneficial or not.

View File

@ -3,6 +3,9 @@ TODO
For next release
^^^^^^^^^^^^^^^^
FIX BUG:
- wormfood noopt crash caused by a change in 7.8; 8ae3bad6f7e73a3913594a983939298b357c7e7e "fix rts in empty asmsub"
...
@ -67,9 +70,9 @@ Expressions:
Optimizations:
- VariableAllocator: can we think of a smarter strategy for allocating variables into zeropage, rather than first-come-first-served
- translateFunctioncall() in BuiltinFunctionsAsmGen: should be able to assign parameters to a builtin function directly from register(s), this will make the use of a builtin function in a pipe expression more efficient without using a temporary variable
aa = startvalue(1) |> sin8u() |> cos8u() |> sin8u() |> cos8u()
versus: aa = cos8u(sin8u(cos8u(sin8u(startvalue(1))))) <--- this one contains no sta cx16.r9L in between.
- translateUnaryFunctioncall() in BuiltinFunctionsAsmGen: should be able to assign parameters to a builtin function directly from register(s), this will make the use of a builtin function in a pipe expression more efficient without using a temporary variable
compare ``aa = startvalue(1) |> sin8u() |> cos8u() |> sin8u() |> cos8u()``
versus: ``aa = cos8u(sin8u(cos8u(sin8u(startvalue(1)))))`` the second one contains no sta cx16.r9L in between.
- AssignmentAsmGen.assignExpression() -> better code gen for assigning boolean comparison expressions
- when a for loop's loopvariable isn't referenced in the body, and the iterations are known, replace the loop by a repeatloop
but we have no efficient way right now to see if the body references a variable.

View File

@ -2,5 +2,5 @@
rm -f *.bin *.xex *.jar *.asm *.prg *.vm.txt *.vice-mon-list *.list a.out imgui.ini
rm -rf build out
rm -rf compiler/build codeGenTargets/build codeGenCpu6502/build codeOptimizers/build compilerInterfaces/build compilerAst/build dbusCompilerService/build httpCompilerService/build parser/build
rm -rf compiler/build codeGenTargets/build codeGenCpu6502/build codeGenExperimental6502/build codeOptimizers/build compilerInterfaces/build compilerAst/build dbusCompilerService/build httpCompilerService/build parser/build