- 
                Notifications
    
You must be signed in to change notification settings  - Fork 44
 
Open
Description
While coding a SNES audio driver in wiz I noticed I was unable to compile a multiplication statement.
I made an attempt at fixing this bug, but I'm unsure how to fix it without adding a spc700 multiplication exception to Compiler::simplifyBinaryArithmeticExpression() or Compiler::reduceExpression().
// SYSTEM  spc700
bank code     @ 0x200 : [constdata; 0x100];
in code {
func test() {
    ya = y * a;
    ya = a * y;
}
}
Wiz output:
* wiz: version 0.1.2 (alpha)
>> Parsing...
>> Compiling...
mul_test.wiz:8: error: left-hand side of type `u16` cannot be assigned `u8` expression
mul_test.wiz:9: error: left-hand side of type `u16` cannot be assigned `u8` expression
* wiz: failed with 2 error(s).
I did discover a workaround, wrapping the multiplication in an inline func compiles successfully.
// SYSTEM  spc700
bank code     @ 0x200 : [constdata; 0x100];
in code {
inline func mul(u8a : u8 in a, u8y : u8 in y) : u16 in ya {
    return a * y;
}
func test() {
    ya = mul(a, y);
}
}
Metadata
Metadata
Assignees
Labels
No labels