try to reduce code size
This commit is contained in:
parent
97137ed993
commit
185b833929
@ -8,7 +8,7 @@
|
||||
# Revision: $:Id: checksize 83 2006-01-05 22:20:53Z cs $
|
||||
|
||||
error=0
|
||||
codelimit=65536 # default value
|
||||
codelimit=61440 # default value
|
||||
datalimit=4064 # default value; leave 32 bytes for stack
|
||||
|
||||
if [ $# -gt 1 ]; then
|
||||
|
||||
@ -33,6 +33,9 @@
|
||||
#include "loader.h"
|
||||
#include "system.h"
|
||||
|
||||
#include "neginf/neginf.h"
|
||||
#include "inflate.h"
|
||||
|
||||
|
||||
extern usb_transaction_t usb_trans;
|
||||
extern system_t system;
|
||||
@ -93,7 +96,11 @@ void set_rom_mode()
|
||||
void boot_startup_rom(uint16_t init_delay)
|
||||
{
|
||||
uint8_t i;
|
||||
uint8_t c;
|
||||
uint16_t j;
|
||||
uint32_t addr = 0x000000;
|
||||
PGM_VOID_P p_addr;
|
||||
|
||||
info_P(PSTR("Fetch loader rom\n"));
|
||||
|
||||
system_set_bus_avr();
|
||||
@ -108,8 +115,17 @@ void boot_startup_rom(uint16_t init_delay)
|
||||
//snes_irq_off();
|
||||
//snes_lorom();
|
||||
|
||||
inflate_init();
|
||||
for (i=0; i<ROM_BUFFER_CNT; i++){
|
||||
addr += rle_decode(_rom[i], _rom_size[i], addr);
|
||||
p_addr = _rom[i];
|
||||
printf("idx: %i %lx\n",i,p_addr);
|
||||
for (j=0; j<_rom_size[i]; j++){
|
||||
//rle_decode(_rom[i], _rom_size[i], addr);
|
||||
c = pgm_read_byte((PGM_VOID_P)p_addr++);
|
||||
printf("%02x ",c);
|
||||
neginf_process_byte(c);
|
||||
|
||||
}
|
||||
}
|
||||
info_P(PSTR("\n"));
|
||||
|
||||
|
||||
@ -30,21 +30,6 @@ extern FILE uart_stdout;
|
||||
|
||||
extern int debug_level; /* the higher, the more messages... */
|
||||
|
||||
#if defined(NO_DEBUG) && defined(__GNUC__)
|
||||
#else
|
||||
void debug(int level, char* format, ...) {
|
||||
#ifdef NO_DEBUG
|
||||
|
||||
#else
|
||||
va_list args;
|
||||
if (!(debug_level & level))
|
||||
return;
|
||||
va_start(args, format);
|
||||
vprintf(format, args);
|
||||
va_end(args);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef NO_INFO
|
||||
uint8_t buffer_debug[FORMAT_BUFFER_LEN];
|
||||
|
||||
@ -29,6 +29,7 @@ char inflate_done = 0;
|
||||
|
||||
void inflate_init()
|
||||
{
|
||||
printf("inflate_init\n");
|
||||
neginf_init(0);
|
||||
sram_bulk_write_start(0x000000);
|
||||
}
|
||||
@ -40,29 +41,30 @@ void neginf_cb_completed()
|
||||
|
||||
void neginf_cb_seq_byte(nbyte byte)
|
||||
{
|
||||
//printf("neginf_cb_seq_byte %x", byte);
|
||||
sram_bulk_write(byte);
|
||||
}
|
||||
|
||||
uint8_t buffer[512];
|
||||
//uint8_t buffer[512];
|
||||
|
||||
void neginf_cb_copy(nsize from, nsize to, nint length)
|
||||
{
|
||||
uint32_t addr;
|
||||
uint8_t c;
|
||||
|
||||
printf("neginf_cb_copy %lx %lx %li", from, to, length);
|
||||
/*
|
||||
printf("neginf_cb_copy %lx %lx %li\n", from, to, length);
|
||||
|
||||
sram_bulk_addr_save();
|
||||
for (addr=from; addr<from+length; addr++){
|
||||
c = sram_read(addr);
|
||||
sram_write(addr,c);
|
||||
}
|
||||
sram_bulk_addr_restore();
|
||||
*/
|
||||
/*
|
||||
|
||||
sram_bulk_addr_save();
|
||||
sram_bulk_copy_into_buffer(from, buffer, length);
|
||||
sram_bulk_copy_from_buffer(to, buffer, length);
|
||||
sram_bulk_addr_restore();
|
||||
|
||||
*/
|
||||
}
|
||||
|
||||
@ -32,24 +32,6 @@
|
||||
extern FILE uart_stdout;
|
||||
|
||||
|
||||
#if defined(NO_INFO) && defined(__GNUC__)
|
||||
|
||||
#define info(format, args...) ((void)0)
|
||||
|
||||
#else
|
||||
void info(char* format, ...) {
|
||||
#ifdef NO_INFO
|
||||
|
||||
#else
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
vprintf(format, args);
|
||||
va_end(args);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef NO_INFO
|
||||
uint8_t buffer_info[FORMAT_BUFFER_LEN];
|
||||
#endif
|
||||
|
||||
@ -254,11 +254,11 @@ int main(void)
|
||||
shared_memory_init();
|
||||
system_init();
|
||||
sram_init();
|
||||
pwm_init();
|
||||
//pwm_init();
|
||||
irq_init();
|
||||
boot_startup_rom(50);
|
||||
globals_init();
|
||||
pwm_stop();
|
||||
//pwm_stop();
|
||||
usbInit();
|
||||
usb_connect();
|
||||
sei();
|
||||
@ -275,8 +275,10 @@ int main(void)
|
||||
info_P(PSTR("USB poll\n"));
|
||||
while (usb_trans.req_state != REQ_STATUS_SNES) {
|
||||
usbPoll();
|
||||
#ifdef DO_SHELL
|
||||
#ifndef NO_DEBUG
|
||||
shell_run();
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -312,9 +314,12 @@ int main(void)
|
||||
info_P(PSTR("Poll USB\n"));
|
||||
while ((usb_trans.req_state != REQ_STATUS_AVR)) {
|
||||
usbPoll();
|
||||
#ifdef DO_SHELL
|
||||
#ifndef NO_DEBUG
|
||||
shell_run();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
}
|
||||
//info_P(PSTR("-->Switch TO AVR\n"));
|
||||
shared_memory_init();
|
||||
|
||||
@ -31,6 +31,8 @@
|
||||
#define PWM_SINE_MAX 64
|
||||
#define PWM_OVERFLOW_MAX 1024
|
||||
|
||||
#if 0
|
||||
|
||||
uint8_t pwm_sine_table[] = {
|
||||
0x7f,0x8b,0x97,0xa4,0xaf,0xbb,0xc5,0xcf,0xd9,0xe1,0xe8,0xef,0xf4,0xf8,0xfb,0xfd,
|
||||
0xfd,0xfd,0xfb,0xf8,0xf3,0xee,0xe7,0xe0,0xd7,0xce,0xc4,0xb9,0xae,0xa2,0x96,0x89,
|
||||
@ -99,3 +101,4 @@ void pwm_init(void) {
|
||||
TIMSK2 |= (1<<OCIE2A);
|
||||
sei();
|
||||
}
|
||||
#endif
|
||||
@ -32,6 +32,8 @@
|
||||
|
||||
#define RUNCHAR 0x90
|
||||
|
||||
#if 0
|
||||
|
||||
uint32_t rle_decode(PGM_VOID_P in_addr, int32_t in_len, uint32_t out_addr)
|
||||
{
|
||||
uint8_t in_byte, in_repeat, last_byte;
|
||||
@ -100,3 +102,5 @@ uint32_t rle_decode(PGM_VOID_P in_addr, int32_t in_len, uint32_t out_addr)
|
||||
info_P(PSTR("\nDone addr=0x%08lx\n"), out_addr);
|
||||
return out_addr;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@ -44,13 +44,6 @@
|
||||
|
||||
extern system_t system;
|
||||
|
||||
const char STR_ROM[] PROGMEM = "Rom";
|
||||
const char STR_RAM[] PROGMEM = "Sram";
|
||||
const char STR_BAT[] PROGMEM = "Battery";
|
||||
const char STR_SUPERFX[] PROGMEM = "SuperFX";
|
||||
const char STR_SA[] PROGMEM = "SA-1";
|
||||
|
||||
|
||||
uint8_t command_buf[RECEIVE_BUF_LEN];
|
||||
uint8_t recv_buf[RECEIVE_BUF_LEN];
|
||||
|
||||
@ -59,6 +52,8 @@ volatile uint8_t cr = 0;
|
||||
|
||||
uint8_t *token_ptr;
|
||||
|
||||
#ifdef DO_SHELL
|
||||
|
||||
uint8_t *get_token(void)
|
||||
{
|
||||
uint8_t *p = token_ptr;
|
||||
@ -489,3 +484,4 @@ void shell_run(void)
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user