initialization for modes 7 and 8