Beispiel #1
0
void gameInit() {
	sramWrite(keepScore, 0);
	sramWrite(counter, 0);

	makeBoard();

	alt_putstr("Welcome to Battleship!\n");
}
Beispiel #2
0
void write16(const u32 address, const u16 value)
{
	switch (address >> 24)
	{
	case 8:
		if (address == 0x80000c4 || address == 0x80000c6 || address == 0x80000c8)
		{
			rtcWrite(address, value);
		}
		break;
	case 13:
		if (game.hasEEPROM())
		{
			eepromWrite(address, (u8)value);
		}
		break;
	case 14:
		if (game.hasSRAM())
		{
			sramWrite(address, (u8)value);
		}
		else if (game.hasFlash())
		{
			flashWrite(address, (u8)value);
		}
		break;
	default:
		break;
	}
}
Beispiel #3
0
void makeBoard() {
	int i, j;
	for (i = 0; i < 10; i++) {
		for (j = 0; j < 10; j++) {
			sramWrite(i * 10 + j, '~');
		}
	}

	for (i = 0; i < 4; i++) {
		sramWrite(i * 10 + 30 + 7, 'd');
	}

	for (i = 0; i < 2; i++) {
		sramWrite(90 + i + 8, 'd');
	}

	for (i = 0; i < 5; i++) {
		sramWrite(i * 10 + 11, 'd');
	}

}
Beispiel #4
0
void write8(const u32 address, const u8 value)
{
	switch (address >> 24)
	{
	case 13:
		if (game.hasEEPROM())
		{
			eepromWrite(address, value);
		}
		break;
	case 14:
		if (game.hasSRAM())
		{
			sramWrite(address, value);
		}
		else if (game.hasFlash())
		{
			flashWrite(address, value);
		}
		break;
	default:
		break;
	}
}