finish Flash support, mostly

This commit is contained in:
StapleButter 2017-03-29 22:12:53 +02:00
parent 777623b665
commit 4202a8f826
1 changed files with 48 additions and 0 deletions

View File

@ -361,6 +361,20 @@ void Write_Flash(u8 val, bool islast)
{
switch (CurCmd)
{
case 0x02:
if (DataPos < 3)
{
Addr <<= 8;
Addr |= val;
Data = 0;
}
else
{
SRAM[Addr & (SRAMLength-1)] = 0;
Addr++;
}
break;
case 0x03:
if (DataPos < 3)
{
@ -393,6 +407,40 @@ void Write_Flash(u8 val, bool islast)
Data = 0xFF;
break;
case 0xD8:
if (DataPos < 3)
{
Addr <<= 8;
Addr |= val;
Data = 0;
}
if (DataPos == 2)
{
for (u32 i = 0; i < 0x10000; i++)
{
SRAM[Addr & (SRAMLength-1)] = 0;
Addr++;
}
}
break;
case 0xDB:
if (DataPos < 3)
{
Addr <<= 8;
Addr |= val;
Data = 0;
}
if (DataPos == 2)
{
for (u32 i = 0; i < 0x100; i++)
{
SRAM[Addr & (SRAMLength-1)] = 0;
Addr++;
}
}
break;
default:
if (DataPos==0)
printf("unknown Flash save command %02X\n", CurCmd);