add mem_mask to paletteram writes (nw)