Skip to content

Commit

Permalink
Improve hardware error message
Browse files Browse the repository at this point in the history
  • Loading branch information
KimJorgensen committed Jul 24, 2023
1 parent b6dc53b commit 15a1a2e
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
1 change: 1 addition & 0 deletions firmware/stm32f4xx/c64_interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,7 @@ static void c64_interface_config(void)
{
c64_address_config();
c64_data_config();
c64_control_config();

c64_crt_config();
c64_irq_config();
Expand Down
2 changes: 2 additions & 0 deletions launcher/ef3usb_loader.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
#ifndef _EF3USB_LOADER_H_
#define _EF3USB_LOADER_H_

#define EF_RAM_TEST *((volatile uint8_t*) 0xdf10)

void ef3usb_load_and_run(void);

#endif /* _EF3USB_LOADER_H_ */
20 changes: 18 additions & 2 deletions launcher/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ static const char menuBar[] = {" " KUNG_FU_FLASH_VER " <F1> Help"};

int main(void)
{
uint8_t i, tmp, tst;
initScreen(COLOR_BLACK, COLOR_BLACK, TEXTC);

dir = (Directory *)malloc(sizeof(Directory));
Expand All @@ -111,12 +112,27 @@ int main(void)

isC128 = is_c128() != 0;

if (USB_STATUS == KFF_ID_VALUE)
if (USB_STATUS == KFF_ID_VALUE) // KFF mode
{
mainLoopKFF();
}
else
else // EF3 mode
{
// We can also end up here if there is a hardware problem
// Test EF3 RAM to make sure we are indeed in EF3 mode
tst = tmp = EF_RAM_TEST;
for (i=0; i<=8; i++)
{
if (EF_RAM_TEST != tst)
{
showMessage("Communication with cartridge failed.", ERRORC);
cprintf("Check hardware");
while (true);
}
EF_RAM_TEST = tst = 1<<i;
}
EF_RAM_TEST = tmp;

mainLoopEF3();
}

Expand Down

0 comments on commit 15a1a2e

Please sign in to comment.