cas: improved test program & fixed some emulation-specific pointer handling