diff --git a/avr/usbload/Makefile b/avr/usbload/Makefile index a521040..dbd39d0 100644 --- a/avr/usbload/Makefile +++ b/avr/usbload/Makefile @@ -16,7 +16,7 @@ # Author: Christian Starkjohann # ===================================================================================== -DEBUG = 0 +DEBUG = 1 TTY = /dev/tty.PL2303-00002126 DEVICE = atmega644 F_CPU = 20000000 diff --git a/avr/usbload/command.c b/avr/usbload/command.c index de6ae73..34d6876 100644 --- a/avr/usbload/command.c +++ b/avr/usbload/command.c @@ -31,6 +31,8 @@ #include "usbdrv.h" #include "rle.h" #include "loader.h" +#include "system.h" + extern usb_transaction_t usb_trans; @@ -93,13 +95,9 @@ void boot_startup_rom(uint16_t init_delay) { uint8_t i; uint32_t addr = 0x000000; - info_P(PSTR("Fetch loader rom\n")); - info_P(PSTR("Activate AVR bus\n")); - avr_bus_active(); - info_P(PSTR("IRQ off\n")); - snes_irq_lo(); - snes_irq_off(); - snes_lorom(); + system_set_bus_avr(); + system_snes_irq_off(); + system_set_rom_lorom(); for (i=0; ireq_bank_size == 0x8000) { snes_lorom(); system.rom_mode = LOROM; - info_P(PSTR("Set SNES lowrom \n")); + info_P(PSTR("Set SNES lorom \n")); } else { snes_hirom(); system.rom_mode = HIROM; @@ -121,3 +132,17 @@ void system_set_rom_mode(usb_transaction_t *usb_trans) } } +void system_set_rom_lorom() +{ + snes_lorom(); + system.rom_mode = LOROM; + info_P(PSTR("Set SNES lorom \n")); +} + + +void system_set_rom_hirom() +{ + snes_hirom(); + system.rom_mode = HIROM; + info_P(PSTR("Set SNES hirom \n")); +} diff --git a/avr/usbload/system.h b/avr/usbload/system.h index 007637f..a145518 100644 --- a/avr/usbload/system.h +++ b/avr/usbload/system.h @@ -23,6 +23,8 @@ #ifndef __SYSTEM_H__ #define __SYSTEM_H__ +#include "requests.h" + typedef struct system_t { @@ -38,6 +40,15 @@ typedef struct system_t { } system_t; void system_init(void); +void system_init(void); +void system_send_snes_reset(void); +void system_send_snes_irq(void); +void system_set_bus_avr(void); +void system_set_bus_snes(void); +void system_set_rom_mode(usb_transaction_t *usb_trans); +void system_set_rom_hirom(void); +void system_set_rom_lorom(void); +void system_snes_irq_off(void); #endif diff --git a/scripts/conv_rle.py b/scripts/conv_rle.py index e675c26..5edf65c 100644 --- a/scripts/conv_rle.py +++ b/scripts/conv_rle.py @@ -35,6 +35,7 @@ if huffman == True: os.unlink("/tmp/loader.rle") os.unlink("/tmp/loader.rle.hfm") + cfile = open("/tmp/loader.c","w") hfile = open("/tmp/loader.h","w") @@ -83,7 +84,6 @@ const char _rom%02i[ROM_BUFFER_SIZE%02i] PROGMEM = { l = addr h = addr + parts[idx] addr+= parts[idx] - print l,h for idx,c in enumerate(data[l:h]): c = ord(c) if idx