Skip to content

Commit

Permalink
fix gb save size calculations, upped the serial baud rate.
Browse files Browse the repository at this point in the history
  • Loading branch information
DacoTaco committed Jun 1, 2019
1 parent f81903c commit a7df639
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 9 deletions.
2 changes: 1 addition & 1 deletion AVR Code/GBC_Dumper.c
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ int main(void)
{
cprintf("gb mode\r\n");
Setup_Pins_8bitMode();
}
}
/*cprintf("address (0x%X): 0x%02X%02X%02X\r\n",addr, addr & 0xFF,(addr >> 8) & 0xFF,(addr >> 16) & 0xFF);
uint16_t data = Read24BitBytes(addr);
uint8_t d1 = data >> 8;
Expand Down
2 changes: 1 addition & 1 deletion AVR Code/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ DEBUG = dwarf-2
# _VA_SUPPORT is for Variadic functions in cprintf (accepting arguments)
# SAVE_SPACE is to set it so all code having defines for saving space will disable code to do so
#SHIFTING_MODE
CUSTOMDEFINES = -DBAUD=500000 -DSAVE_SPACE
CUSTOMDEFINES = -DBAUD=1000000 -DSAVE_SPACE
#CUSTOMDEFINES = -D_VA_SUPPORT -DSCL_CLOCK=400

ifeq ($(MCU),atmega8)
Expand Down
27 changes: 22 additions & 5 deletions AVR Code/gbc_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,11 @@ int8_t API_Get_Memory(ROM_TYPE type,int8_t _gbaMode)

if(end_addr < 0xC000)
{
gameInfo.fileSize = end_addr - 0xA000;
gameInfo.fileSize = end_addr - 0xA000UL;
}
else
{
gameInfo.fileSize = 0x2000 * _banks;
gameInfo.fileSize = 0x2000UL * _banks;
}
}
}
Expand Down Expand Up @@ -215,11 +215,11 @@ int8_t API_WriteGBRam(void)
//for WRITERAM we need to send Ram size, wait for the OK(0x80) or NOK(anything NOT 0x80) signal, and then start receiving.
if(end_addr < 0xC000)
{
gameInfo.fileSize = end_addr - 0xA000;
gameInfo.fileSize = end_addr - 0xA000UL;
}
else
{
gameInfo.fileSize = 0x2000 * banks;
gameInfo.fileSize = 0x2000UL * banks;
}

API_Send_Size();
Expand Down Expand Up @@ -331,6 +331,23 @@ int8_t API_WriteGBRam(void)
EnableSerialInterrupt();
return ret;
}
int8_t API_WriteGBARam()
{
if(gameInfo.CartFlag != GBA_SAVE_NONE)
return ERR_NO_SAVE;

int8_t ret = -1;

if(gameInfo.CartFlag != GBA_SAVE_SRAM)
{
ret = ERR_NO_INFO;
goto end_write_gba;
}

end_write_gba:
API_ResetGameInfo();
return ret;
}
int8_t API_WriteRam(int8_t _gbaMode)
{
API_SetupPins(_gbaMode);
Expand All @@ -348,7 +365,7 @@ int8_t API_WriteRam(int8_t _gbaMode)

if(_gba_cart)
{
return -1;
return API_WriteGBARam();
}
else
{
Expand Down
Binary file added Documentation/DS_FT232R.pdf
Binary file not shown.
1 change: 0 additions & 1 deletion Windows Tool/GB_Dumper/API/API.Functions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,6 @@ private bool API_ProcessHeader(byte[] data)
if (serialInterface.BytesToRead > 0)
{
//we have data!
data = serialInterface.Read(serialInterface.BytesToRead);
data = data.Concat(serialInterface.Read(serialInterface.BytesToRead)).ToArray();
}

Expand Down
2 changes: 1 addition & 1 deletion Windows Tool/GB_Dumper/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public void RefreshSerial()

cbBaudRate.ItemsSource = apiHandler.BaudRates;
if (cbBaudRate.Items.Count > 0)
cbBaudRate.SelectedItem = 500000;
cbBaudRate.SelectedItem = 1000000;
else
cbBaudRate.SelectedIndex = -1;

Expand Down

0 comments on commit a7df639

Please sign in to comment.