Merge branch 'v8_maintenance'

This commit is contained in:
Irmen de Jong 2023-05-21 16:08:42 +02:00
commit 0c94e377fc
4 changed files with 13 additions and 45 deletions

View File

@ -67,7 +67,7 @@ asmsub STOP2() -> ubyte @A {
}
asmsub RDTIM16() -> uword @AY {
; -- like RDTIM() but only returning the lower 16 bits in AY for convenience
; -- like RDTIM() but only returning the lower 16 bits in AY for convenience. Also avoids ram bank issue for irqs.
%asm {{
phx
sei

View File

@ -229,13 +229,13 @@ internal class BeforeAsmAstChanger(val program: Program,
override fun after(arrayIndexedExpression: ArrayIndexedExpression, parent: Node): Iterable<IAstModification> {
val containingStatement = getContainingStatement(arrayIndexedExpression)
if(getComplexArrayIndexedExpressions(containingStatement).size > 1) {
errors.err("it's not possible to use more than one complex array indexing expression in a single statement; break it up via a temporary variable for instance", containingStatement.position)
return noModifications
}
if(options.compTarget.name!=VMTarget.NAME) { // don't apply this optimization/check for Vm target
val containingStatement = getContainingStatement(arrayIndexedExpression)
if(getComplexArrayIndexedExpressions(containingStatement).size > 1) {
errors.err("it's not possible to use more than one complex array indexing expression in a single statement; break it up via a temporary variable for instance", containingStatement.position)
return noModifications
}
if(options.compTarget.name!=VMTarget.NAME) { // don't apply this optimization for Vm target
val index = arrayIndexedExpression.indexer.indexExpr
if (index !is NumericLiteral && index !is IdentifierReference) {
// replace complex indexing expression with a temp variable to hold the computed index first

View File

@ -15,7 +15,7 @@ For 9.0 major changes
- DONE: asmsub params or return values passed in cpu flags (like carry) now must be declared as booleans (previously ubyte was still accepted).
- DONE: (on cx16) added diskio.save_raw() to save without the 2 byte prg header
- [much work:] add special (u)word array type (or modifier such as @fast? ) that puts the array into memory as 2 separate byte-arrays 1 for LSB 1 for MSB -> allows for word arrays of length 256 and faster indexing
- [much work:] add special (u)word array type (or modifier such as @fast or @split? ) that puts the array into memory as 2 separate byte-arrays 1 for LSB 1 for MSB -> allows for word arrays of length 256 and faster indexing
this is an enormous amout of work, if this type is to be treated equally as existing (u)word , because all expression / lookup / assignment routines need to know about the distinction....
So maybe only allow the bare essentials? (store, get, ++/--/+/-, bitwise operations?)
- [much work:] more support for (64tass) SEGMENTS ?

View File

@ -5,44 +5,12 @@
main {
sub start() {
word ww = -1234
uword uww = 1234
float fl = 123.34
byte bb = -123
ubyte ub = 123
ubyte[] array = [ $00, $11, $22, $33, $44, $55, $66, $77, $88, $99, $aa, $bb]
txt.print_w(clamp(ww, -2000, -500))
txt.spc()
txt.print_w(clamp(ww, -1000, -500))
txt.spc()
txt.print_w(clamp(ww, -2000, -1500))
txt.nl()
txt.print_uw(clamp(uww, 500, 2000))
txt.spc()
txt.print_uw(clamp(uww, 500, 1000))
txt.spc()
txt.print_uw(clamp(uww, 1500, 2000))
txt.nl()
txt.print_b(clamp(bb, -127, -50))
txt.spc()
txt.print_b(clamp(bb, -100, -50))
txt.spc()
txt.print_b(clamp(bb, -127, -125))
txt.nl()
txt.print_ub(clamp(ub, 50, 200))
txt.spc()
txt.print_ub(clamp(ub, 50, 100))
txt.spc()
txt.print_ub(clamp(ub, 150, 200))
txt.nl()
floats.print_f(floats.clampf(fl, 50.0, 200.0))
txt.spc()
floats.print_f(floats.clampf(fl, 50.0, 100.0))
txt.spc()
floats.print_f(floats.clampf(fl, 150.0, 200.0))
txt.nl()
ubyte x = 2
ubyte y = 3
txt.print_uwhex(mkword(array[9], array[8]), true)
txt.print_uwhex(mkword(array[x*y+y], array[y*x+x]), true)
}
}