aboutsummaryrefslogtreecommitdiff
path: root/arch/casiowin/monochromelib/src/clear_vram.c
blob: 489ea6da7375c491d5baa2682049ed0b444c8866 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/* *****************************************************************************
 * clear_vram.c -- Clear the VRAM.
 * Copyright (C) 2011      Pierre "PierrotLL" Le Gall <legallpierre89@gmail.com>
 * Copyright (C) 2016-2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
 *
 * This file is part of libcarrot.
 * libcarrot is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation; either version 3.0 of the License,
 * or (at your option) any later version.
 *
 * libcarrot is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with the libcarrot; if not, see <http://www.gnu.org/licenses/>.
 * ************************************************************************** */
#include <monochrome.h>

void ML_clear_vram()
{
	int i, end, *pointer_long, vram;
	char *pointer_byte;
	vram = (int)ML_vram_adress();
	end = 4-vram&3;
	pointer_byte = (char*)vram;
	for(i=0 ; i<end ; i++) pointer_byte[i] = 0;
	pointer_long = (int*) (vram+end);
	for(i=0 ; i<255 ; i++) pointer_long[i] = 0;
	pointer_byte += 1020+end;
	end = vram&3;
	for(i=0 ; i<end ; i++) pointer_byte[i] = 0;
}