Closed est77 closed 2 years ago
The issues with tst
should be resolved now:
bank prg @ 0x8000 : [constdata; 0x8000];
bank zeropage @ 0x2000 : [vardata; 0x100];
bank ram @ 0x2200 : [vardata; 0x600];
in zeropage {
var zp_b0, zp_b1, zp_b2, zp_b3, zp_b4, zp_b5, zp_b6, zp_b7 : u8;
var zp_array : [u8; 16];
}
in ram {
var ram_b0, ram_b1, ram_b2, ram_b3, ram_b4, ram_b5, ram_b6, ram_b7 : u8;
var ram_array : [u8; 16];
}
in prg {
tst(0, zp_b0);
tst(0, zp_array[x]);
tst(0, ram_b0);
tst(0, ram_array[x]);
if zp_b0 & 0x40 != 0 {
// ...
}
}
I also added a support for a tstbit(mem, n)
intstrinsic which takes a bit index from 0 .. 7
and mem being either zero page, zero page indexed by x, absolute or absolute indexed by x, but otherwise works similar to tst
. When generating if
statements that involve bit indexing, wiz will automatically call tstbit
:
tstbit(zp_b0, 2);
if zp_b0 $ 4 {
// ...
}
Thanks for the fixes!
Wrong opcode for jmp (addr, X). See https://github.com/wiz-lang/wiz/issues/138.
Branch on bit (branch on bit - goto label if zp $ n) only works for n == 6 and 7. Other bit indices error with: error: bit indexing
$
operator is not allowed in conditional.Using the tst intrinsic directly or indirectly produces a series of internal error messages and crashes wiz with a fatal: address was supposed to be reserved here, by code.