Commit Graph

486 Commits

Author SHA1 Message Date
Irmen de Jong
203ec5fa46 implement taking address of array var with variable index 2023-10-15 20:24:48 +02:00
Irmen de Jong
9ea69c07b8 optimize word array reads with indexvar 2023-10-14 07:30:54 +02:00
Irmen de Jong
68e62e4bd2 added cx16.MCIOUT() kernal call
correct case of several other cx16 kernal calls.

corrected to upper case: cx16 kernal calls CLOSE_ALL, LKUPLA, LKUPSA, JSRFAR, PRIMM, MACPTR.
2023-10-09 22:44:36 +02:00
Irmen de Jong
a48ce35f0b added %option verafxmuls 2023-10-05 22:06:33 +02:00
Irmen de Jong
a289b32053 Revert "added -verafxmul compiler option to use vera fx multiplication routine on cx16"
This reverts commit 690782bf.
It was too risky, using vera (especially fx) transparently in multiple places especially perhaps in IRQ handlers will create havoc unless much intricate care is taken to save/restore the vera state. Better to do vera fx explicitly where the programmer has full control.
2023-10-02 21:08:52 +02:00
Irmen de Jong
690782bf60 added -verafxmul compiler option to use vera fx multiplication routine on cx16 2023-10-01 22:44:45 +02:00
Irmen de Jong
8d177beb78 fix possible register corruption when calling asmsubs that require Carry flag as a parameter 2023-09-24 14:03:31 +02:00
Irmen de Jong
880c0a5da8 allow taking address of array element 2023-09-18 04:37:41 +02:00
Irmen de Jong
ccf6e32bf9 adding setlsb() and setmsb() builtin functions to 6502 codegen 2023-09-17 15:16:47 +02:00
Irmen de Jong
a1874f6f00 adding setlsb() and setmsb() builtin functions to 6502 codegen 2023-09-17 01:48:29 +02:00
Irmen de Jong
95e4490a8a adding setlsb() and setmsb() builtin functions 2023-09-15 02:39:16 +02:00
Irmen de Jong
31c132c2eb several optimizations and compiler error fix for @(&var) and @(&var+1) 2023-09-14 23:04:23 +02:00
Irmen de Jong
a1d0e5bb65 added list of software to docs 2023-09-13 21:51:48 +02:00
Irmen de Jong
03e0d4b2e8 reducing expression codegen complexity (no longer splitting conditional expressions, and using r9 as temp var) 2023-09-13 01:08:42 +02:00
Irmen de Jong
6afdd4e6fd preparing next version 2023-09-12 21:53:49 +02:00
Irmen de Jong
dd2463a440 proper fix for the previous commit. + fix for i/o channel reset in diskio.f_seek()
it wasn't the adressing mode, it was that it assumed the pointer variable was always in zeropage (which might not be)
2023-09-07 22:17:46 +02:00
Irmen de Jong
23a8bebd9e fix invalid addressing mode on 6502 cpu for bytevalue +/- bytearray[i] 2023-09-07 21:40:07 +02:00
Irmen de Jong
3caf9108ad finalizing 9.4.1 release 2023-09-06 21:18:01 +02:00
Irmen de Jong
b570bdaed7 fix codegen for array[i] += float expression 2023-09-05 22:38:52 +02:00
Irmen de Jong
8c0843cc87 fix an invalid 6502 instruction on c64 in certain float assignment 2023-09-05 21:54:52 +02:00
Irmen de Jong
eb018ae660 code optimization for bytearray[x] +/- bytearray[y]
use adc array,y or sbc array,y instead of tempvar
2023-09-04 23:01:53 +02:00
Irmen de Jong
c3fbdf34ca fixed c64 float problem 2023-09-03 16:40:10 +02:00
Irmen de Jong
48bd51e1a5 c64 float problem 2023-09-03 16:29:01 +02:00
Irmen de Jong
10d0b03a90 use less tempvars 2023-09-03 01:32:47 +02:00
Irmen de Jong
e1b3582f08 fix wordvar -= @(memory) 2023-09-03 01:12:26 +02:00
Irmen de Jong
95be1c9e22 fix optimized swapped in-place byte comparisons 2023-09-03 00:47:55 +02:00
Irmen de Jong
1ce8fe06d5 fix in-place <= for bytes 2023-09-03 00:01:11 +02:00
Irmen de Jong
e97303c226 fix word multiplication to not clobber r0 and r1 anymore
This was causing corruption in certain programs such as the cx16/amiga example.
The problem was introduced in 9.4 with the new multiply_words routine
2023-09-02 20:52:16 +02:00
Irmen de Jong
3b786c819d avoid using temp var even more 2023-09-01 23:47:01 +02:00
Irmen de Jong
04959dbd8b optimize asm: don't use temp var for some additions 2023-09-01 22:24:17 +02:00
Irmen de Jong
f14ea1b3de micro optimization to save 2 cycles: change some pha+pla into tax+txa 2023-09-01 20:37:24 +02:00
Irmen de Jong
09a7a4bbe5 optimize comparison against zero 2023-09-01 02:28:11 +02:00
Irmen de Jong
aa4d23a3d5 fix register stack saving on certain expression code that was broken on 6502 but not on 65c02 2023-08-29 11:50:35 +02:00
Irmen de Jong
bad9dd3b3b mention shadowing warnings from assembler 2023-08-28 16:55:28 +02:00
Irmen de Jong
ff35ba3696 added warnshadow cli option to enable assembler warnings about symbol shadowing 2023-08-28 16:41:46 +02:00
Irmen de Jong
75514fc7af fix some invalid instructions on 6502 (instead of 65c02) target for bit shifts 2023-08-14 21:58:26 +02:00
Irmen de Jong
bc8126eb16 2x faster word multiplication routine 2023-08-14 18:11:30 +02:00
Irmen de Jong
2c9e50873c use math.square for optimized X*X calculation (words only).
Added IR SQUARE instruction.
2023-08-14 01:05:17 +02:00
Irmen de Jong
151a206617 experimental Commodore PET target 2023-08-12 23:25:07 +02:00
Irmen de Jong
e3fbe37f9f fixed optimized code for >= and <= 2023-08-12 13:45:08 +02:00
Irmen de Jong
dc870cd5ea fixed optimized code for > and < 2023-08-12 13:15:32 +02:00
Irmen de Jong
584be44743 fix compiler error on float comparison expressions 2023-08-12 00:09:38 +02:00
Irmen de Jong
7c0bde7310 parser: allow curly brace on next line for asmsub too
downgrade antlr4 one version again to what is used in IntelliJ's antlr plugin, to avoid potential version conflicts
2023-08-09 20:01:12 +02:00
Irmen de Jong
017ef8a837 optimization of > and <= in expressions 2023-08-07 21:23:31 +02:00
Irmen de Jong
0d63cdcb96 optimization of < and >= in expressions 2023-08-07 04:54:35 +02:00
Irmen de Jong
68a6f99c9f optimization of < in expressions 2023-08-07 02:32:07 +02:00
Irmen de Jong
60781bcfc4 optimization of == and != in expressions 2023-08-07 01:25:41 +02:00
Irmen de Jong
77fa2e2722 optimization in + or - assignment to word array 2023-08-05 23:28:40 +02:00
Irmen de Jong
c36afd872e optimization in assignment to memory 2023-08-04 23:54:11 +02:00
Irmen de Jong
7e58a4c130 optimization in assignment to array 2023-08-04 23:06:55 +02:00
Irmen de Jong
19a4bf1088 clean up AugmentableAssignmentAsmGen a bit 2023-08-04 21:48:02 +02:00
Irmen de Jong
9678bbae4b dedup 2023-08-02 23:19:52 +02:00
Irmen de Jong
a4d093afa1 added -sourcelines cli option to include src lines in generated assembly (which is now off by default) 2023-08-02 23:05:24 +02:00
Irmen de Jong
ba788bcf0f put the original p8 source lines into the generated assembly as comments (not only the line numbers). 2023-08-02 02:18:13 +02:00
Irmen de Jong
f2c62bee7e docs 2023-08-01 22:49:55 +02:00
Irmen de Jong
1ae950a638 Merge branch 'remove_evalstack'
# Conflicts:
#	codeGenCpu6502/src/prog8/codegen/cpu6502/assignment/AssignmentAsmGen.kt
2023-07-31 21:57:43 +02:00
Irmen de Jong
c9385e93fe fix postincr/decr on indexed pointervariables 2023-07-31 20:13:49 +02:00
Irmen de Jong
9bb16e293c vm: fix postincr/decr on indexed pointervariables 2023-07-31 19:37:30 +02:00
Irmen de Jong
c223702ea0 code cleanups 2023-07-30 18:42:45 +02:00
Irmen de Jong
0cba736446 Merge branch 'master' into remove_evalstack 2023-07-30 14:53:40 +02:00
Irmen de Jong
0816a57032 never add rts to inline asmsubs and always inline them regardless of optimization setting
otherwise they can't specify a sequence of assembly instructions that should be inserted in-place, such as those that manipulate the cpu stack.
for instance cx16.irqsafe_set_irqd() / cx16.irqsafe_clear_irqd()
2023-07-30 14:52:37 +02:00
Irmen de Jong
6cda76a116 comments 2023-07-29 17:32:27 +02:00
Irmen de Jong
46c12a8899 fix byte in array assignment,
remove no longer needed array assignment ast transformation
2023-07-28 22:40:06 +02:00
Irmen de Jong
c5219dfb3f fix assignment of register into byte array 2023-07-28 22:16:01 +02:00
Irmen de Jong
e1b6bb154a Merge branch 'master' into remove_evalstack
# Conflicts:
#	compiler/res/prog8lib/cx16/gfx2.p8
#	docs/source/todo.rst
#	examples/test.p8
2023-07-28 02:09:45 +02:00
Irmen de Jong
2f756f1e3a fix and optimize inplace invert and negate 2023-07-24 23:28:32 +02:00
Irmen de Jong
fea297e409 cleanup some compilation warnings 2023-07-22 23:44:26 +02:00
Irmen de Jong
70ed2b4203 fix compilation of large bitshifts 2023-07-22 23:08:22 +02:00
Irmen de Jong
d5707b7bf3 rebuilding floating point stack evaluation (using cpu stack) 2023-07-20 00:45:04 +02:00
Irmen de Jong
9f247901d4 Merge branch 'master' into remove_evalstack
# Conflicts:
#	codeGenCpu6502/src/prog8/codegen/cpu6502/BuiltinFunctionsAsmGen.kt
#	codeGenCpu6502/src/prog8/codegen/cpu6502/assignment/AssignmentAsmGen.kt
#	compiler/src/prog8/buildversion/BuildVersion.kt
#	examples/test.p8
2023-07-16 23:45:04 +02:00
Irmen de Jong
5659742d97 fixed assigning byte to word not clearing msb sometimes 2023-07-16 23:16:32 +02:00
Irmen de Jong
450eaf7c4a fixed lsb() to uword problem 2023-07-16 20:05:59 +02:00
Irmen de Jong
47485e4b49 added more missing codegen for bit shifts 2023-07-16 17:42:10 +02:00
Irmen de Jong
64254e758d cleaned up cx16 keyboardhandler example and some compiler warnings for redundant else 2023-07-16 13:23:53 +02:00
Irmen de Jong
ab8173637a remove redundant asm optimizer 2023-07-16 11:15:28 +02:00
Irmen de Jong
3841cef497 implemented missing bitshift codegen (non-stack) 2023-07-15 22:26:56 +02:00
Irmen de Jong
b717f1c7eb little refactor of huge if statement 2023-07-15 22:26:56 +02:00
Irmen de Jong
da57f76de3 fix augassign 2023-07-15 22:26:56 +02:00
Irmen de Jong
41af63b333 remove even more X register save/restore code 2023-07-15 22:26:54 +02:00
Irmen de Jong
e2bb0de24d clean up X register save/store in compiler code, remove temp vars for register saving 2023-07-15 22:25:58 +02:00
Irmen de Jong
b791fae9ce remove stack based ExpressionAsmGen 2023-07-15 22:24:22 +02:00
Irmen de Jong
708e296774 remove eval stack assignment source and targets 2023-07-15 22:24:22 +02:00
Irmen de Jong
84925ab69c remove eval stack options 2023-07-15 22:24:19 +02:00
Irmen de Jong
b3cb9b7fe2 added optimizer to remove needless pha/pla pairs 2023-07-15 22:19:48 +02:00
Irmen de Jong
6b6427492d fix forloop 6502 codegen in case of descending word values 2023-07-10 23:10:16 +02:00
Irmen de Jong
fc8955941b slight optimization for certain word multiplications 2023-07-07 21:30:37 +02:00
Irmen de Jong
3126959576 ir: several fixes 2023-07-07 16:53:32 +02:00
Irmen de Jong
70c9ab9074 upgrade libraries 2023-07-06 23:33:58 +02:00
Irmen de Jong
6d1fdf1ba6 upgrade to Kotlin 1.9.0 2023-07-06 23:03:47 +02:00
Irmen de Jong
1f7180d9a8 math.multiply_words returns lower 16 bits of the result also in AY (to avoid repeating some load instructions) 2023-07-06 22:54:13 +02:00
Irmen de Jong
c544b7f5ba fixing up p8_ prefixing 2023-07-02 21:15:05 +02:00
Irmen de Jong
bdf8aa9168 get rid of newexpr compiler option 2023-07-02 15:26:04 +02:00
Irmen de Jong
bb95484c8a uniform symbol prefixing with p8_ 2023-07-02 06:15:09 +02:00
Irmen de Jong
cad18b8a3a uniform symbol prefixing with p8_ 2023-07-02 06:15:02 +02:00
Irmen de Jong
aac5a4c27f optimize word repeat loop codegen 2023-07-02 04:51:22 +02:00
Irmen de Jong
04da44eb98 fix certain inefficient codegen when assigning a type casted value 2023-06-29 22:56:26 +02:00
Irmen de Jong
c9ef777e0f fix rest of possible temp variable conflicts 2023-06-28 23:24:48 +02:00
Irmen de Jong
30c531b39e attempting to fix array expression inplace assign 2023-06-28 00:38:08 +02:00
Irmen de Jong
a9f5dc036c fix cpu stack corruption in array assignment codegen 2023-06-27 18:49:49 +02:00
Irmen de Jong
b0794cf35e added hiram bank number to -varshigh 2023-06-27 00:27:34 +02:00