mirror of
https://github.com/irmen/prog8.git
synced 2024-09-30 00:55:52 +00:00
fix endless loop in optimizer, fix cx16 register clobbering in psg interrupt handler, fix crash on certain arrays, fix undefined symbol when it's in another imported module
This commit is contained in:
parent
10ddd5b127
commit
35af53828a
@ -30,8 +30,9 @@ class ExpressionSimplifier(private val program: Program) : AstWalker() {
|
||||
val literal = typecast.expression as? NumericLiteral
|
||||
if (literal != null) {
|
||||
val newLiteral = literal.cast(typecast.type)
|
||||
if (newLiteral.isValid && newLiteral.valueOrZero() !== literal)
|
||||
mods += IAstModification.ReplaceNode(typecast.expression, newLiteral.valueOrZero(), typecast)
|
||||
if (newLiteral.isValid && newLiteral.valueOrZero() !== literal) {
|
||||
mods += IAstModification.ReplaceNode(typecast, newLiteral.valueOrZero(), parent)
|
||||
}
|
||||
}
|
||||
|
||||
// remove redundant nested typecasts
|
||||
|
@ -90,6 +90,10 @@ psg {
|
||||
; cx16.r1L = the voice number
|
||||
; cx16.r2L = attack value
|
||||
|
||||
pushw(cx16.r0)
|
||||
push(cx16.r1L)
|
||||
push(cx16.r2L)
|
||||
pushw(cx16.r9)
|
||||
; calculate new volumes
|
||||
for cx16.r1L in 0 to 15 {
|
||||
when envelope_states[cx16.r1L] {
|
||||
@ -138,6 +142,10 @@ psg {
|
||||
cx16.VERA_DATA0 = cx16.VERA_DATA1 & %11000000 | msb(envelope_volumes[cx16.r1L])
|
||||
}
|
||||
cx16.pop_vera_context()
|
||||
popw(cx16.r9)
|
||||
pop(cx16.r2L)
|
||||
pop(cx16.r1L)
|
||||
popw(cx16.r0)
|
||||
}
|
||||
|
||||
ubyte[16] envelope_states
|
||||
|
@ -1 +1 @@
|
||||
8.3
|
||||
8.4-dev
|
||||
|
@ -197,6 +197,14 @@ interface INameScope: IStatementContainer, INamedStatement {
|
||||
else
|
||||
statementScope = (statementScope as Node).definingScope
|
||||
}
|
||||
|
||||
// still not found, maybe it is a symbol in another module
|
||||
for(module in (this as Node).definingModule.program.modules) {
|
||||
val stmt = module.searchSymbol(name)
|
||||
if(stmt!=null)
|
||||
return stmt
|
||||
}
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
|
@ -757,9 +757,11 @@ class ArrayLiteral(val type: InferredTypes.InferredType, // inferred because
|
||||
}
|
||||
}
|
||||
|
||||
// otherwise, select the "biggegst" datatype based on the elements in the array.
|
||||
// otherwise, select the "biggest" datatype based on the elements in the array.
|
||||
require(value.isNotEmpty()) { "can't determine type of empty array" }
|
||||
val datatypesInArray = value.map { it.inferType(program) }
|
||||
require(datatypesInArray.isNotEmpty() && datatypesInArray.all { it.isKnown }) { "can't determine type of empty array" }
|
||||
if(datatypesInArray.any{ it.isUnknown })
|
||||
return InferredTypes.InferredType.unknown()
|
||||
val dts = datatypesInArray.map { it.getOr(DataType.UNDEFINED) }
|
||||
return when {
|
||||
DataType.FLOAT in dts -> InferredTypes.InferredType.known(DataType.ARRAY_F)
|
||||
|
@ -1,22 +1,17 @@
|
||||
%import textio
|
||||
%zeropage basicsafe
|
||||
|
||||
|
||||
main {
|
||||
sub start() {
|
||||
ubyte value1 = %1110
|
||||
ubyte value2 = %1111
|
||||
|
||||
bool[2] @shared barr = [true, false]
|
||||
|
||||
; if value1 and value2 ; TODO value1 isn't converted to bool in 6502 preprocess
|
||||
; txt.print("ok")
|
||||
; else
|
||||
; txt.print("fail!")
|
||||
; txt.nl()
|
||||
|
||||
if value1 and value2!=255 ; TODO value1 isn't converted to bool in 6502 preprocess
|
||||
txt.print("ok")
|
||||
else
|
||||
txt.print("fail!")
|
||||
repeat {
|
||||
uword keys = cx16.kbdbuf_peek2()
|
||||
txt.print_uwhex(keys, true)
|
||||
if msb(keys) {
|
||||
c64.GETIN()
|
||||
}
|
||||
txt.nl()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user