static void update_page(){
		int i,r,c,ro,co, all_dirty = 0;
		int offsets[][]={{0,0},{64,0},{0,32},{64,32}};
	
		if( old_tile_bank1 != sys16_tile_bank1 ){
			all_dirty = 1;
			old_tile_bank1 = sys16_tile_bank1;
		}
		if( old_tile_bank0 != sys16_tile_bank0 ){
			all_dirty = 1;
			old_tile_bank0 = sys16_tile_bank0;
			tilemap_mark_all_tiles_dirty( text_layer );
		}
		if (all_dirty != 0)
		{
			tilemap_mark_all_tiles_dirty( background );
			tilemap_mark_all_tiles_dirty( foreground );
			if (sys16_18_mode != 0)
			{
				tilemap_mark_all_tiles_dirty( background2 );
				tilemap_mark_all_tiles_dirty( foreground2 );
			}
		}
		else
		{
			for(i=0;i<4;i++)
			{
				co=offsets[i][0];
				ro=offsets[i][1];
				if( old_bg_page[i]!=sys16_bg_page[i] )
				{
					old_bg_page[i] = sys16_bg_page[i];
					for(r=0;r<32;r++)
						for(c=0;c<64;c++)
							tilemap_mark_tile_dirty( background, c+co, r+ro );
				}
				if( old_fg_page[i]!=sys16_fg_page[i] )
				{
					old_fg_page[i] = sys16_fg_page[i];
					for(r=0;r<32;r++)
						for(c=0;c<64;c++)
							tilemap_mark_tile_dirty( foreground, c+co, r+ro );
				}
				if (sys16_18_mode != 0)
				{
					if( old_bg2_page[i]!=sys16_bg2_page[i] )
					{
						old_bg2_page[i] = sys16_bg2_page[i];
						for(r=0;r<32;r++)
							for(c=0;c<64;c++)
								tilemap_mark_tile_dirty( background2, c+co, r+ro );
					}
					if( old_fg2_page[i]!=sys16_fg2_page[i] )
					{
						old_fg2_page[i] = sys16_fg2_page[i];
						for(r=0;r<32;r++)
							for(c=0;c<64;c++)
								tilemap_mark_tile_dirty( foreground2, c+co, r+ro );
					}
				}
			}
		}
	}