diff --git a/MCUME_pico/CMakeLists.txt b/MCUME_pico/CMakeLists.txt index 1d52b12..fcc8ab1 100644 --- a/MCUME_pico/CMakeLists.txt +++ b/MCUME_pico/CMakeLists.txt @@ -6,7 +6,18 @@ include(pico_sdk_import.cmake) # We also need PICO EXTRAS #include(pico_extras_import.cmake) -project(mcume C CXX) +#set(TARGET testkeymax) +#set(TARGET pico20) +#set(TARGET pico64) +#set(TARGET pico81) +#set(TARGET picospeccy) +#set(TARGET pico800) +#set(TARGET pico5200) +#set(TARGET picocolem) +#set(TARGET picoo2em) +set(TARGET picovcs) + +project(${TARGET} C CXX) set(CMAKE_C_STANDARD 11) set(CMAKE_CXX_STANDARD 17) @@ -16,32 +27,66 @@ pico_sdk_init() add_subdirectory(FatFs_SPI build) +include_directories(${TARGET}) include_directories(config) -include_directories(vga_t4) +include_directories(display) +#include_directories(vga_t4) #include_directories(picovga_t4) -include_directories(tft_t) +#include_directories(tft_t) include_directories(psram) +if( ${TARGET} MATCHES "pico20" ) +set(PICO20_SOURCES + pico20/IC.cpp + pico20/mos6502.cpp + pico20/MOS6522.cpp + pico20/MOS6561.cpp + pico20/v20.cpp + pico20/pico20.cpp + ) +#add_compile_definitions(OVERRULE_WIDTH=320 OVERRULE_HEIGHT=192) +endif() +if( ${TARGET} MATCHES "pico64" ) +set(PICO64_SOURCES + pico64/c64.cpp + pico64/cia1.cpp + pico64/cia2.cpp + pico64/cpu.cpp + pico64/patches.cpp + pico64/pla.cpp + pico64/roms.cpp + pico64/sid.cpp + pico64/timerutil.cpp + pico64/vic.cpp + pico64/reSID.cpp + pico64/pico64.cpp + ) +endif() + +if( ${TARGET} MATCHES "pico81" ) set(PICO81_SOURCES pico81/Z80.c pico81/AY8910.c pico81/zx81.c - pico81/emuapi.cpp pico81/pico81.cpp - pico81/AudioPlaySystem.cpp ) +# ZX81,ZX Spectrum,Colem,Vic20 +add_compile_definitions(OVERRULE_WIDTH=320 OVERRULE_HEIGHT=192) +endif() +if( ${TARGET} MATCHES "picospeccy" ) set(PICOSPECCY_SOURCES picospeccy/Z80.c picospeccy/AY8910.c picospeccy/spec.c picospeccy/zx_filetyp_z80.c - picospeccy/emuapi.cpp picospeccy/picospeccy.cpp - picospeccy/AudioPlaySystem.cpp ) +add_compile_definitions(OVERRULE_WIDTH=320 OVERRULE_HEIGHT=192) +endif() +if( ${TARGET} MATCHES "pico800" ) set(PICO800_SOURCES pico800/antic.c pico800/atari800.c @@ -52,11 +97,11 @@ set(PICO800_SOURCES pico800/pokey.c pico800/pokeysnd.c pico800/sio.c - pico800/emuapi.cpp - pico800/AudioPlaySystem.cpp pico800/pico800.cpp ) +endif() +if( ${TARGET} MATCHES "pico5200" ) set(PICO5200_SOURCES pico5200/antic.c pico5200/atari5200.c @@ -65,53 +110,21 @@ set(PICO5200_SOURCES pico5200/gtia.c pico5200/pokey.c pico5200/pokeysnd.c - pico5200/emuapi.cpp - pico5200/AudioPlaySystem.cpp pico5200/pico5200.cpp ) +endif() -set(PICO20_SOURCES - pico20/IC.cpp -# pico20/MOS6502.cpp -# pico20/Register8.cpp -# pico20/Register16.cpp -# pico20/cpu.cpp -# pico20/cpu.c - pico20/mos6502.cpp - pico20/MOS6522.cpp - pico20/MOS6561.cpp - pico20/v20.cpp - pico20/emuapi.cpp - pico20/AudioPlaySystem.cpp - pico20/pico20.cpp - ) - -set(PICO64_SOURCES - pico64/c64.cpp - pico64/cia1.cpp - pico64/cia2.cpp - pico64/cpu.cpp - pico64/patches.cpp - pico64/pla.cpp - pico64/roms.cpp - pico64/sid.cpp - pico64/util.cpp - pico64/vic.cpp - pico64/reSID.cpp - pico64/emuapi.cpp - pico64/AudioPlaySystem.cpp - pico64/pico64.cpp - ) - +if( ${TARGET} MATCHES "picocolem" ) set(PICOCOLEM_SOURCES picocolem/Z80.c picocolem/SN76489.c picocolem/Colem.c - picocolem/emuapi.cpp picocolem/picocolem.cpp - picocolem/AudioPlaySystem.cpp ) +add_compile_definitions(OVERRULE_WIDTH=320 OVERRULE_HEIGHT=192) +endif() +if( ${TARGET} MATCHES "picoo2em" ) set(PICOO2EM_SOURCES picoo2em/audio.c picoo2em/cpu.c @@ -123,11 +136,12 @@ set(PICOO2EM_SOURCES picoo2em/vmachine.c picoo2em/vpp_cset.c picoo2em/vpp.c - picoo2em/emuapi.cpp picoo2em/picoo2em.cpp - picoo2em/AudioPlaySystem.cpp ) +add_compile_definitions(OVERRULE_WIDTH=320 OVERRULE_HEIGHT=192) +endif() +if( ${TARGET} MATCHES "picovcs" ) set(PICOVCS_SOURCES picovcs/At2600.c picovcs/Collision.c @@ -142,11 +156,11 @@ set(PICOVCS_SOURCES picovcs/Tiasound.c picovcs/Vcsemu.c picovcs/Vmachine.c - picovcs/emuapi.cpp picovcs/picovcs.cpp - picovcs/AudioPlaySystem.cpp ) +endif() +if( ${TARGET} MATCHES "piconofrendo" ) set(PICONOFRENDO_SOURCES piconofrendo/bitmap.c piconofrendo/config.c @@ -206,11 +220,11 @@ set(PICONOFRENDO_SOURCES piconofrendo/nofrendo.c piconofrendo/vid_drv.c piconofrendo/vrcvisnd.c - piconofrendo/emuapi.cpp piconofrendo/piconofrendo.cpp - piconofrendo/AudioPlaySystem.cpp ) +endif() +if( ${TARGET} MATCHES "pico8086" ) set(PICO8086_SOURCES pico8086/cpu.cpp pico8086/disk.cpp @@ -219,12 +233,44 @@ set(PICO8086_SOURCES pico8086/i8253.cpp pico8086/i8259.cpp pico8086/pc.cpp - pico8086/emuapi.cpp pico8086/pico8086.cpp - pico8086/AudioPlaySystem.cpp + ) +endif() + +if( ${TARGET} MATCHES "testio" ) +set(TESTIO_SOURCES + testio/testio.cpp + testio/emuapi.cpp + ) +endif() + +if( ${TARGET} MATCHES "testvga" ) +set(TESTVGA_SOURCES + testvga/testvga.cpp + ) +endif() + +if( ${TARGET} MATCHES "testkeymax" ) +set(TESTKEYMAX_SOURCES + testkeymax/testkeymax.cpp + ) +endif() + +set(DISPLAY_SOURCES + display/pico_dsp.cpp + display/vga.cpp + display/vga_vmode.cpp + display/emuapi.cpp + display/AudioPlaySystem.cpp ) -set(PICOSND_SOURCES +#if( ${TARGET} MATCHES "gfxengine" ) +#set(GFXENGINE_SOURCES +# gfxengine/gfxengine.cpp +# ) +#endif() + +#set(PICOSND_SOURCES # picosnd/LibFC14/Dump.cpp # picosnd/LibFC14/FC_Data.cpp # picosnd/LibFC14/FC.cpp @@ -238,107 +284,88 @@ set(PICOSND_SOURCES # picosnd/StSnd/Ymload.cpp # picosnd/StSnd/YmMusic.cpp # picosnd/StSnd/YmUserInterface.cpp - picosnd/sndplay.cpp - picosnd/sid.cpp - picosnd/reSID.cpp - picosnd/emuapi.cpp - picosnd/AudioPlaySystem.cpp - picosnd/picosnd.cpp - ) +# picosnd/sndplay.cpp +# picosnd/sid.cpp +# picosnd/reSID.cpp +# picosnd/emuapi.cpp +# picosnd/AudioPlaySystem.cpp +# picosnd/picosnd.cpp +# ) -set(PICOVALIDATION_SOURCES - picovalidation/c64.cpp - picovalidation/cia1.cpp - picovalidation/cia2.cpp - picovalidation/cpu.cpp - picovalidation/patches.cpp - picovalidation/pla.cpp - picovalidation/roms.cpp - picovalidation/sid.cpp - picovalidation/util.cpp - picovalidation/vic.cpp - picovalidation/reSID.cpp - picovalidation/emuapi.cpp - picovalidation/AudioPlaySystem.cpp - picovalidation/pico64.cpp - ) +#set(PICOVALIDATION_SOURCES +# picovalidation/c64.cpp +# picovalidation/cia1.cpp +# picovalidation/cia2.cpp +# picovalidation/cpu.cpp +# picovalidation/patches.cpp +# picovalidation/pla.cpp +# picovalidation/roms.cpp +# picovalidation/sid.cpp +# picovalidation/util.cpp +# picovalidation/vic.cpp +# picovalidation/reSID.cpp +# picovalidation/emuapi.cpp +# picovalidation/AudioPlaySystem.cpp +# picovalidation/pico64.cpp +# ) -set(VGA_T4_SOURCES - vga_t4/VGA_t4.cpp - vga_t4/scanvideo.c - ) +#set(VGA_T4_SOURCES +# vga_t4/VGA_t4.cpp +# vga_t4/scanvideo.c +# ) -set(PICOVGA_T4_SOURCES - picovga_t4/VGA_t4.cpp - picovga_t4/vga.cpp - picovga_t4/vga_vmode.cpp - ) +#set(PICOVGA_T4_SOURCES +# picovga_t4/VGA_t4.cpp +# picovga_t4/vga.cpp +# picovga_t4/vga_vmode.cpp +# ) -set(PSRAM_SOURCES - psram/psram_t.cpp - ) +#set(PSRAM_SOURCES +# psram/psram_t.cpp +# ) -set(TFT_T_SOURCES - tft_t/tft_t_dma.cpp - ) +#set(TFT_T_SOURCES +# tft_t/tft_t_dma.cpp +# ) -set(GFXENGINE_SOURCES - gfxengine/gfxengine.cpp - ) +#set(TESTPSRAM_SOURCES +# testpsram/testpsram.cpp +# testpsram/emuapi.cpp +# ) -set(TESTIO_SOURCES - testio/testio.cpp - testio/emuapi.cpp - ) -set(TESTVGA_SOURCES - testvga/testvga.cpp - ) - -set(TESTKEYMAX_SOURCES - testkeymax/testkeymax.cpp - testkeymax/emuapi.cpp - ) - -set(TESTPSRAM_SOURCES - testpsram/testpsram.cpp - testpsram/emuapi.cpp - ) - -# Vic20,ZX81,ZX Spectrum,Colem -#add_compile_definitions(OVERRULE_WIDTH=320 OVERRULE_HEIGHT=192) - -add_executable(mcume -# ${GFXENGINE_SOURCES} -# ${PICO20_SOURCES} +add_executable(${TARGET} + ${PICO20_SOURCES} ${PICO64_SOURCES} -# ${PICO81_SOURCES} -# ${PICO800_SOURCES} -# ${PICO5200_SOURCES} -# ${PICO8086_SOURCES} -# ${PICOCOLEM_SOURCES} -# ${PICOO2EM_SOURCES} -# ${PICOVCS_SOURCES} -# ${PICOSPECCY_SOURCES} -# ${PICONOFRENDO_SOURCES} + ${PICO81_SOURCES} + ${PICO800_SOURCES} + ${PICO5200_SOURCES} + ${PICO8086_SOURCES} + ${PICOCOLEM_SOURCES} + ${PICOO2EM_SOURCES} + ${PICOVCS_SOURCES} + ${PICOSPECCY_SOURCES} + ${PICONOFRENDO_SOURCES} + ${TESTIO_SOURCES} + ${TESTVGA_SOURCES} + ${TESTKEYMAX_SOURCES} +# ${GFXENGINE_SOURCES} # ${PICOSND_SOURCES} -# ${TESTIO_SOURCES} -# ${TESTVGA_SOURCES} -# ${TESTKEYMAX_SOURCES} # ${TESTPSRAM_SOURCES} # ${PICOVALIDATION_SOURCES} # ${PSRAM_SOURCES} # ${VGA_T4_SOURCES} - ${PICOVGA_T4_SOURCES} - ${TFT_T_SOURCES} +# ${PICOVGA_T4_SOURCES} +# ${TFT_T_SOURCES} + ${DISPLAY_SOURCES} ) -#pico_generate_pio_header(mcume ${CMAKE_CURRENT_LIST_DIR}/vga_t4/timing.pio) -#pico_generate_pio_header(mcume ${CMAKE_CURRENT_LIST_DIR}/vga_t4/scanvideo.pio) -pico_generate_pio_header(mcume ${CMAKE_CURRENT_LIST_DIR}/picovga_t4/picovga.pio) +#pico_generate_pio_header(${TARGET} ${CMAKE_CURRENT_LIST_DIR}/vga_t4/timing.pio) +#pico_generate_pio_header(${TARGET} ${CMAKE_CURRENT_LIST_DIR}/vga_t4/scanvideo.pio) +pico_generate_pio_header(${TARGET} ${CMAKE_CURRENT_LIST_DIR}/display/picovga.pio) -target_link_libraries(mcume pico_multicore +target_link_libraries(${TARGET} pico_multicore pico_stdlib FatFs_SPI # pico_scanvideo_dpi @@ -348,15 +375,15 @@ target_link_libraries(mcume pico_multicore ) -#target_compile_options(mcume PUBLIC -O3) -#target_compile_options(mcume PUBLIC -Wall -Wextra -Wno-unused-function -Wno-unused-parameter) +#target_compile_options(${TARGET} PUBLIC -O3) +#target_compile_options(${TARGET} PUBLIC -Wall -Wextra -Wno-unused-function -Wno-unused-parameter) IF (NOT DEFINED N_SD_CARDS) SET(N_SD_CARDS 1) ENDIF() -target_compile_definitions(mcume PUBLIC N_SD_CARDS=${N_SD_CARDS}) +target_compile_definitions(${TARGET} PUBLIC N_SD_CARDS=${N_SD_CARDS}) -#pico_enable_stdio_uart(mcume 0) -#pico_enable_stdio_usb(mcume 0) +#pico_enable_stdio_uart(${TARGET} 0) +#pico_enable_stdio_usb(${TARGET} 0) -pico_add_extra_outputs(mcume) +pico_add_extra_outputs(${TARGET}) diff --git a/MCUME_pico/bin/PICOZX/pico20.uf2 b/MCUME_pico/bin/PICOZX/pico20.uf2 new file mode 100644 index 0000000..10d6db8 Binary files /dev/null and b/MCUME_pico/bin/PICOZX/pico20.uf2 differ diff --git a/MCUME_pico/bin/PICOZX/pico64.uf2 b/MCUME_pico/bin/PICOZX/pico64.uf2 new file mode 100644 index 0000000..3797124 Binary files /dev/null and b/MCUME_pico/bin/PICOZX/pico64.uf2 differ diff --git a/MCUME_pico/bin/PICOZX/pico800.uf2 b/MCUME_pico/bin/PICOZX/pico800.uf2 new file mode 100644 index 0000000..fea9e2e Binary files /dev/null and b/MCUME_pico/bin/PICOZX/pico800.uf2 differ diff --git a/MCUME_pico/bin/PICOZX/pico81.uf2 b/MCUME_pico/bin/PICOZX/pico81.uf2 new file mode 100644 index 0000000..07ed611 Binary files /dev/null and b/MCUME_pico/bin/PICOZX/pico81.uf2 differ diff --git a/MCUME_pico/bin/PICOZX/picocolem.uf2 b/MCUME_pico/bin/PICOZX/picocolem.uf2 new file mode 100644 index 0000000..908c078 Binary files /dev/null and b/MCUME_pico/bin/PICOZX/picocolem.uf2 differ diff --git a/MCUME_pico/bin/PICOZX/picoo2em.uf2 b/MCUME_pico/bin/PICOZX/picoo2em.uf2 new file mode 100644 index 0000000..f3eb0b8 Binary files /dev/null and b/MCUME_pico/bin/PICOZX/picoo2em.uf2 differ diff --git a/MCUME_pico/bin/PICOZX/picospeccy.uf2 b/MCUME_pico/bin/PICOZX/picospeccy.uf2 new file mode 100644 index 0000000..de8628f Binary files /dev/null and b/MCUME_pico/bin/PICOZX/picospeccy.uf2 differ diff --git a/MCUME_pico/bin/PICOZX/picovcs.uf2 b/MCUME_pico/bin/PICOZX/picovcs.uf2 new file mode 100644 index 0000000..34bc31f Binary files /dev/null and b/MCUME_pico/bin/PICOZX/picovcs.uf2 differ diff --git a/MCUME_pico/bin/PICOZX/testkeymax.uf2 b/MCUME_pico/bin/PICOZX/testkeymax.uf2 new file mode 100644 index 0000000..4946d53 Binary files /dev/null and b/MCUME_pico/bin/PICOZX/testkeymax.uf2 differ diff --git a/MCUME_pico/config/iopins.h b/MCUME_pico/config/iopins.h index 4b78be8..cae3a56 100644 --- a/MCUME_pico/config/iopins.h +++ b/MCUME_pico/config/iopins.h @@ -8,7 +8,6 @@ // Speaker #define AUDIO_PIN 28 - // VGA /* 2-9 RRRGGGBB @@ -48,10 +47,10 @@ #define I2C_SCL_IO 15? #define I2C_SDA_IO 14? */ - #else -#if (defined(PICOMPUTER) && defined(USE_VGA) ) +#if (defined(PICOMPUTER) && defined(USE_VGA) ) + // Speaker #define AUDIO_PIN 9 // VGA @@ -59,6 +58,18 @@ CSYNC */ #define VGA_COLORBASE 0 #define VGA_SYNCBASE 8 +#else + +#ifdef PICOZX + +// Speaker +#define AUDIO_PIN 7 +// VGA +/* RRGGBB + CSYNC */ +#define VGA_COLORBASE 0 +#define VGA_SYNCBASE 6 + #else // Speaker #define AUDIO_PIN 0 @@ -68,10 +79,23 @@ #define VGA_COLORBASE 2 #define VGA_SYNCBASE 14 #define VGA_VSYNC 15 +#endif #endif +#ifdef PICOZX +#define TFT_SPIREG spi0 +#define TFT_SPIDREQ DREQ_SPI0_TX +#define TFT_SCLK 2 +#define TFT_MOSI 3 +#define TFT_MISO 255 // Not required, used for DC... +#define TFT_DC 6 +#define TFT_RST 255 +#define TFT_CS 5 +#define TFT_BACKLIGHT 4 + +#else // TFT #define TFT_SPIREG spi0 #define TFT_SPIDREQ DREQ_SPI0_TX @@ -79,11 +103,13 @@ #define TFT_MOSI 19 #define TFT_MISO 255 // Not required, used for DC... #define TFT_DC 16 + #ifdef PICOMPUTER #ifdef PICOMPUTERMAX #define TFT_RST 255 #define TFT_CS 21 #define TFT_BACKLIGHT 20 + #else #define TFT_RST 21 #define TFT_CS 255 @@ -95,7 +121,7 @@ #define TFT_CS 17 #define TFT_BACKLIGHT 255 // hardwired to 3.3v #endif - +#endif // SD (see SPI0 in code!!!) #define SD_SPIREG spi1 @@ -103,7 +129,7 @@ #define SD_MOSI 11 //15 #define SD_MISO 12 #define SD_CS 13 -#define SD_DETECT 255 // 22 +#define SD_DETECT 255 //22 // PSRAM (exclusive with TFT) #define PSRAM_SPIREG spi0 @@ -114,7 +140,9 @@ #ifdef PICOMPUTER -#if defined(USE_VGA) + +#if defined(USE_VGA) + // Keyboard matrix //Cols (out) #define KCOLOUT1 20 @@ -130,6 +158,7 @@ #define KROWIN4 17 #define KROWIN5 18 #define KROWIN6 19 + #else // Keyboard matrix //Cols (out) @@ -146,11 +175,12 @@ #define KROWIN4 8 #define KROWIN5 7 #define KROWIN6 22 + #endif #define KLED 25 - #else + #ifdef MCUME_REV1 // Analog joystick (primary) for JOY2 and 2 extra buttons @@ -159,8 +189,30 @@ #define PIN_JOY2_BTN 22 #define PIN_KEY_USER1 20 #define PIN_KEY_USER2 21 + #else +#ifdef PICOZX +// Keyboard matrix +//Cols (out) +#define KCOLOUT1 8 +#define KCOLOUT2 9 +#define KCOLOUT3 14 +#define KCOLOUT4 15 +#define KCOLOUT5 16 +#define KCOLOUT6 17 +#define KCOLOUT7 18 +//Rows (in) +#define KROWIN1 19 +#define KROWIN2 20 +#define KROWIN3 21 +#define KROWIN4 22 +#define KROWIN5 26 +#define KROWIN6 27 +#define KROWIN7 28 + + +#else // Digital joystick (primary) for JOY2 and 2 extra buttons //#define PIN_JOY2_A1X 26 //#define PIN_JOY2_A2Y 27 @@ -175,7 +227,7 @@ #endif #endif - +#endif #endif // Second joystick (Not available on PICO) diff --git a/MCUME_pico/config/platform_config.h b/MCUME_pico/config/platform_config.h index a024aaf..999810d 100644 --- a/MCUME_pico/config/platform_config.h +++ b/MCUME_pico/config/platform_config.h @@ -6,11 +6,21 @@ // PICOMPUTER has support for TFT+keymatrix+Sound +#define PICOZX 1 //#define PICOMPUTER 1 //#define PICOMPUTERMAX 1 //#define PICORETROVGA 1 //#define MCUME_REV1 1 -#define MCUME_REV2 1 +//#define MCUME_REV2 1 + +#ifdef PICOZX +//#define USE_VGA 1 +#define VGA222 1 +#define ST7789 1 +#define ST7789_POL 1 +#define HAS_SND 1 +#define INVX 1 +#endif #ifdef PICOMPUTER //#define SWAP_ALT_DEL 1 diff --git a/MCUME_pico/piconofrendo/AudioPlaySystem.cpp b/MCUME_pico/display/AudioPlaySystem.cpp similarity index 98% rename from MCUME_pico/piconofrendo/AudioPlaySystem.cpp rename to MCUME_pico/display/AudioPlaySystem.cpp index 36b764d..87aff84 100644 --- a/MCUME_pico/piconofrendo/AudioPlaySystem.cpp +++ b/MCUME_pico/display/AudioPlaySystem.cpp @@ -87,10 +87,15 @@ static void snd_Reset(void) } -#ifdef CUSTOM_SND +#ifdef CUSTOM_SND + +#ifdef CUSTOM_SND_C extern "C" { +#endif void SND_Process(void *sndbuffer, int sndn); +#ifdef CUSTOM_SND_C } +#endif #endif #include @@ -173,7 +178,4 @@ void AudioPlaySystem::sound(int C, int F, int V) { void AudioPlaySystem::step(void) { } - -void AudioPlaySystem::buzz(int size, int val) { -} #endif diff --git a/MCUME_pico/pico20/AudioPlaySystem.h b/MCUME_pico/display/AudioPlaySystem.h similarity index 100% rename from MCUME_pico/pico20/AudioPlaySystem.h rename to MCUME_pico/display/AudioPlaySystem.h diff --git a/MCUME_pico/pico800/emuapi.cpp b/MCUME_pico/display/emuapi.cpp similarity index 87% rename from MCUME_pico/pico800/emuapi.cpp rename to MCUME_pico/display/emuapi.cpp index 1bc929b..fa1f1c2 100644 --- a/MCUME_pico/pico800/emuapi.cpp +++ b/MCUME_pico/display/emuapi.cpp @@ -16,26 +16,17 @@ extern "C" { static bool emu_writeConfig(void); static bool emu_readConfig(void); static bool emu_eraseConfig(void); +static bool emu_writeGfxConfig(void); +static bool emu_readGfxConfig(void); +static bool emu_eraseGfxConfig(void); - -#if (defined(ILI9341) || defined(ST7789)) && defined(USE_VGA) -// Dual display config, initialize TFT -#include "tft_t_dma.h" -static TFT_T_DMA tft; -#else -// Non Dual display config -#ifdef USE_VGA -#include "vga_t_dma.h" -#else -#include "tft_t_dma.h" -#endif -extern TFT_T_DMA tft; -#endif - +#include "pico_dsp.h" +extern PICO_DSP tft; #define MAX_FILENAME_PATH 64 #define NB_FILE_HANDLER 4 #define AUTORUN_FILENAME "autorun.txt" +#define GFX_CFG_FILENAME "gfxmode.txt" #define MAX_FILES 64 #define MAX_FILENAME_SIZE 24 @@ -66,9 +57,9 @@ static char selected_filename[MAX_FILENAME_SIZE]=""; static char files[MAX_FILES][MAX_FILENAME_SIZE]; static bool menuRedraw=true; -#ifdef PICOMPUTER +#if (defined(PICOMPUTER) || defined(PICOZX) ) static const unsigned short * keys; -static unsigned char keymatrix[6]; +static unsigned char keymatrix[7]; static int keymatrix_hitrow=-1; static bool key_fn=false; static bool key_alt=false; @@ -218,6 +209,7 @@ static void drawOskb(void) // lineOSKB2(KXOFF,KYOFF+0, (char *)"Q1W2E3R4T5Y6U7I8O9P0<=", 0); // lineOSKB2(KXOFF,KYOFF+16, (char *)" A!S@D#F$G%H+J&K*L-EN", 1); // lineOSKB2(KXOFF,KYOFF+32, (char *)" Z(X)C?V/B\"N.,SP ", 2); +/* if (oskbMap == 0) { lineOSKB(KXOFF,KYOFF, keylables_map1_0, 0); lineOSKB(KXOFF,KYOFF, keylables_map1_1, 1); @@ -233,6 +225,7 @@ static void drawOskb(void) lineOSKB(KXOFF,KYOFF, keylables_map3_1, 1); lineOSKB(KXOFF,KYOFF, keylables_map3_2, 2); } +*/ } void toggleOskb(bool forceoff) { @@ -498,13 +491,18 @@ int emu_ReadKeys(void) if ( !gpio_get(PIN_KEY_USER4) ) retval |= MASK_KEY_USER4; #endif -#ifdef PICOMPUTER +#if (defined(PICOMPUTER) || defined(PICOZX) ) keymatrix_hitrow = -1; unsigned char row; +#ifdef PICOZX + unsigned short cols[7]={KCOLOUT1,KCOLOUT2,KCOLOUT3,KCOLOUT4,KCOLOUT5,KCOLOUT6,KCOLOUT7}; + unsigned char keymatrixtmp[7]; + for (int i=0;i<7;i++){ +#else unsigned short cols[6]={KCOLOUT1,KCOLOUT2,KCOLOUT3,KCOLOUT4,KCOLOUT5,KCOLOUT6}; unsigned char keymatrixtmp[6]; - for (int i=0;i<6;i++){ +#endif gpio_set_dir(cols[i], GPIO_OUT); gpio_put(cols[i], 0); #ifdef SWAP_ALT_DEL @@ -512,6 +510,18 @@ int emu_ReadKeys(void) //__asm volatile ("nop\n"); // 4-8ns #endif row=0; +#ifdef PICOZX + row |= (gpio_get(KROWIN1) ? 0 : 0x04); + row |= (gpio_get(KROWIN1) ? 0 : 0x04); + row |= (gpio_get(KROWIN1) ? 0 : 0x04); + row |= (gpio_get(KROWIN1) ? 0 : 0x04); + row |= (gpio_get(KROWIN2) ? 0 : 0x01); + row |= (gpio_get(KROWIN3) ? 0 : 0x08); + row |= (gpio_get(KROWIN4) ? 0 : 0x02); + row |= (gpio_get(KROWIN5) ? 0 : 0x10); + row |= (gpio_get(KROWIN6) ? 0 : 0x20); + row |= (gpio_get(KROWIN7) ? 0 : 0x40); +#else row |= (gpio_get(KROWIN2) ? 0 : 0x01); row |= (gpio_get(KROWIN2) ? 0 : 0x01); row |= (gpio_get(KROWIN2) ? 0 : 0x01); @@ -521,6 +531,7 @@ int emu_ReadKeys(void) row |= (gpio_get(KROWIN3) ? 0 : 0x08); row |= (gpio_get(KROWIN5) ? 0 : 0x10); row |= (gpio_get(KROWIN6) ? 0 : 0x20); +#endif //gpio_set_dir(cols[i], GPIO_OUT); gpio_put(cols[i], 1); gpio_set_dir(cols[i], GPIO_IN); @@ -528,55 +539,7 @@ int emu_ReadKeys(void) keymatrixtmp[i] = row; } -#ifdef MULTI_DEBOUNCE - for (int i=0;i<6;i++){ - gpio_set_dir(cols[i], GPIO_OUT); - gpio_put(cols[i], 0); -#ifdef SWAP_ALT_DEL - sleep_us(1); - //__asm volatile ("nop\n"); // 4-8ns -#endif - row=0; - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN4) ? 0 : 0x02); - row |= (gpio_get(KROWIN1) ? 0 : 0x04); - row |= (gpio_get(KROWIN3) ? 0 : 0x08); - row |= (gpio_get(KROWIN5) ? 0 : 0x10); - row |= (gpio_get(KROWIN6) ? 0 : 0x20); - //gpio_set_dir(cols[i], GPIO_OUT); - gpio_put(cols[i], 1); - gpio_set_dir(cols[i], GPIO_IN); - gpio_disable_pulls(cols[i]); - keymatrixtmp[i] |= row; - } - for (int i=0;i<6;i++){ - gpio_set_dir(cols[i], GPIO_OUT); - gpio_put(cols[i], 0); -#ifdef SWAP_ALT_DEL - sleep_us(1); - //__asm volatile ("nop\n"); // 4-8ns -#endif - row=0; - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN4) ? 0 : 0x02); - row |= (gpio_get(KROWIN1) ? 0 : 0x04); - row |= (gpio_get(KROWIN3) ? 0 : 0x08); - row |= (gpio_get(KROWIN5) ? 0 : 0x10); - row |= (gpio_get(KROWIN6) ? 0 : 0x20); - //gpio_set_dir(cols[i], GPIO_OUT); - gpio_put(cols[i], 1); - gpio_set_dir(cols[i], GPIO_IN); - gpio_disable_pulls(cols[i]); - keymatrixtmp[i] |= row; - } -#endif #ifdef SWAP_ALT_DEL // Swap ALT and DEL @@ -588,15 +551,48 @@ int emu_ReadKeys(void) if (del) keymatrixtmp[0] |= 0x02; #endif + +#ifdef PICOZX + for (int i=0;i<7;i++){ +#else bool alt_pressed=false; if ( keymatrixtmp[5] & 0x20 ) {alt_pressed=true; keymatrixtmp[5] &= ~0x20;}; - for (int i=0;i<6;i++){ +#endif row = keymatrixtmp[i]; if (row) keymatrix_hitrow=i; keymatrix[i] = row; } + +#ifdef PICOZX + key_fn = false; + key_alt = false; + if ( row & 0x02 ) retval |= MASK_KEY_USER1; + if ( row & 0x10 ) retval |= MASK_KEY_USER2; + if ( row & 0x20 ) retval |= MASK_KEY_USER3; + if ( row & 0x40 ) retval |= MASK_KEY_USER4; + row = keymatrix[0]; + //19,20,21,22,26,27,28 +#if INVX + if ( row & 0x2 ) retval |= MASK_JOY2_LEFT; + if ( row & 0x1 ) retval |= MASK_JOY2_RIGHT; +#else + if ( row & 0x1 ) retval |= MASK_JOY2_LEFT; + if ( row & 0x2 ) retval |= MASK_JOY2_RIGHT; +#endif +#if INVY + if ( row & 0x8 ) retval |= MASK_JOY2_DOWN; + if ( row & 0x10 ) retval |= MASK_JOY2_UP; +#else + if ( row & 0x10 ) retval |= MASK_JOY2_DOWN; + if ( row & 0x8 ) retval |= MASK_JOY2_UP; +#endif + if ( row & 0x04 ) retval |= MASK_JOY2_BTN; + if ( row & 0x20 ) key_fn = true; + if ( row & 0x40 ) key_alt = true; + +#else //6,9,15,8,7,22 #if INVX if ( row & 0x2 ) retval |= MASK_JOY2_LEFT; @@ -614,6 +610,9 @@ int emu_ReadKeys(void) #endif if ( row & 0x10 ) retval |= MASK_JOY2_BTN; + if ( key_fn ) retval |= MASK_KEY_USER2; + if ( ( key_fn ) && (keymatrix[0] == 0x02 )) retval |= MASK_KEY_USER1; + // Handle LED flash uint32_t time_ms=to_ms_since_boot (get_absolute_time()); if ((time_ms-last_t_ms) > 100) { @@ -678,6 +677,7 @@ int emu_ReadKeys(void) key_fn = false; } +#ifdef KLED // Handle LED if (key_alt == true) { gpio_put(KLED, (ledflash_toggle?1:0)); @@ -690,9 +690,12 @@ int emu_ReadKeys(void) gpio_put(KLED, 0); } } - +#endif +#endif + if ( key_fn ) retval |= MASK_KEY_USER2; if ( ( key_fn ) && (keymatrix[0] == 0x02 )) retval |= MASK_KEY_USER1; + #endif //Serial.println(retval,HEX); @@ -722,7 +725,7 @@ unsigned short emu_DebounceLocalKeys(void) int emu_ReadI2CKeyboard(void) { int retval=0; -#ifdef PICOMPUTER +#if (defined(PICOMPUTER) || defined(PICOZX) ) if (key_alt) { keys = (const unsigned short *)key_map3; } @@ -752,7 +755,7 @@ int emu_ReadI2CKeyboard(void) { unsigned char emu_ReadI2CKeyboard2(int row) { int retval=0; -#ifdef PICOMPUTER +#if (defined(PICOMPUTER) || defined(PICOZX) ) retval = keymatrix[row]; #endif return retval; @@ -826,8 +829,6 @@ void emu_InitJoysticks(void) { gpio_set_dir(PIN_JOY2_BTN,GPIO_IN); #endif - - #ifdef PIN_JOY2_A1X adc_init(); adc_gpio_init(PIN_JOY2_A1X); @@ -852,12 +853,13 @@ void emu_InitJoysticks(void) { #endif #endif -#ifdef PICOMPUTER +#if (defined(PICOMPUTER) || defined(PICOZX) ) // keyboard LED +#ifdef KLED gpio_init(KLED); gpio_set_dir(KLED, GPIO_OUT); gpio_put(KLED, 1); - +#endif // Output (rows) gpio_init(KCOLOUT1); gpio_init(KCOLOUT2); @@ -865,18 +867,27 @@ void emu_InitJoysticks(void) { gpio_init(KCOLOUT4); gpio_init(KCOLOUT5); gpio_init(KCOLOUT6); +#ifdef PICOZX + gpio_init(KCOLOUT7); +#endif gpio_set_dir(KCOLOUT1, GPIO_OUT); gpio_set_dir(KCOLOUT2, GPIO_OUT); gpio_set_dir(KCOLOUT3, GPIO_OUT); gpio_set_dir(KCOLOUT4, GPIO_OUT); gpio_set_dir(KCOLOUT5, GPIO_OUT); gpio_set_dir(KCOLOUT6, GPIO_OUT); +#ifdef PICOZX + gpio_set_dir(KCOLOUT7, GPIO_OUT); +#endif gpio_put(KCOLOUT1, 1); gpio_put(KCOLOUT2, 1); gpio_put(KCOLOUT3, 1); gpio_put(KCOLOUT4, 1); gpio_put(KCOLOUT5, 1); gpio_put(KCOLOUT6, 1); +#ifdef PICOZX + gpio_put(KCOLOUT7, 1); +#endif // but set as input floating when not used! gpio_set_dir(KCOLOUT1, GPIO_IN); gpio_set_dir(KCOLOUT2, GPIO_IN); @@ -884,13 +895,18 @@ void emu_InitJoysticks(void) { gpio_set_dir(KCOLOUT4, GPIO_IN); gpio_set_dir(KCOLOUT5, GPIO_IN); gpio_set_dir(KCOLOUT6, GPIO_IN); +#ifdef PICOZX + gpio_set_dir(KCOLOUT7, GPIO_IN); +#endif gpio_disable_pulls(KCOLOUT1); gpio_disable_pulls(KCOLOUT2); gpio_disable_pulls(KCOLOUT3); gpio_disable_pulls(KCOLOUT4); gpio_disable_pulls(KCOLOUT5); gpio_disable_pulls(KCOLOUT6); - +#ifdef PICOZX + gpio_disable_pulls(KCOLOUT7); +#endif // Input pins (cols) gpio_init(KROWIN1); gpio_init(KROWIN2); @@ -898,22 +914,32 @@ void emu_InitJoysticks(void) { gpio_init(KROWIN4); gpio_init(KROWIN5); gpio_init(KROWIN6); +#ifdef PICOZX + gpio_init(KROWIN7); +#endif gpio_set_dir(KROWIN1,GPIO_IN); gpio_set_dir(KROWIN2,GPIO_IN); gpio_set_dir(KROWIN3,GPIO_IN); gpio_set_dir(KROWIN4,GPIO_IN); gpio_set_dir(KROWIN5,GPIO_IN); gpio_set_dir(KROWIN6,GPIO_IN); +#ifdef PICOZX + gpio_set_dir(KROWIN7,GPIO_IN); +#endif gpio_pull_up(KROWIN1); gpio_pull_up(KROWIN2); gpio_pull_up(KROWIN3); gpio_pull_up(KROWIN4); gpio_pull_up(KROWIN5); gpio_pull_up(KROWIN6); +#ifdef PICOZX + gpio_pull_up(KROWIN7); +#endif #endif } int emu_setKeymap(int index) { + return 0; } @@ -926,6 +952,7 @@ static FATFS fatfs; static FIL file; extern "C" int sd_init_driver(void); +#ifdef FILEBROWSER static int readNbFiles(char * rootdir) { int totalFiles = 0; @@ -973,16 +1000,32 @@ static void menuLeft(void) #endif } + +bool menuActive(void) +{ + return (menuOn); +} + +void toggleMenu(bool on) { + if (on) { + menuOn = true; + backgroundMenu(); + } else { + tft.fillScreenNoDma(RGBVAL16(0x00,0x00,0x00)); + menuOn = false; + } +} + int handleMenu(uint16_t bClick) { if (autorun) { menuLeft(); - return (ACTION_RUNTFT); + toggleMenu(false); + menuRedraw=false; + return (ACTION_RUN); } - int action = ACTION_NONE; - - if ( (bClick & MASK_JOY2_BTN) ) { + if ( (bClick & MASK_JOY2_BTN) || (bClick & MASK_KEY_USER1) || (bClick & MASK_KEY_USER4) ) { char newpath[MAX_FILENAME_PATH]; strcpy(newpath, selection); strcat(newpath, "/"); @@ -995,24 +1038,34 @@ int handleMenu(uint16_t bClick) fr = f_stat(selection, &entry); if ( (fr == FR_OK) && (entry.fattrib & AM_DIR) ) { curFile = 0; - nbFiles = readNbFiles(selection); + nbFiles = readNbFiles(selection); menuRedraw=true; } else { - action = ACTION_RUNTFT; #ifdef PICOMPUTER if (key_alt) { emu_writeConfig(); } #endif - menuLeft(); +#ifdef PICOZX + if (bClick & MASK_KEY_USER4) { + emu_writeConfig(); + } +#endif + menuLeft(); + toggleMenu(false); + menuRedraw=false; +#ifdef PICOZX + if ( tft.getMode() != MODE_VGA_320x240) { + if ( (bClick & MASK_KEY_USER1) ) { + tft.begin(MODE_VGA_320x240); + } + } +#endif + return (ACTION_RUN); } } - else if ( (bClick & MASK_KEY_USER1) ) { - menuRedraw=true; - action = ACTION_RUNVGA; - } else if ( (bClick & MASK_JOY2_UP) || (bClick & MASK_JOY1_UP) ) { if (curFile!=0) { menuRedraw=true; @@ -1084,28 +1137,14 @@ int handleMenu(uint16_t bClick) menuRedraw=false; } - return (action); -} - -bool menuActive(void) -{ - return (menuOn); -} - -void toggleMenu(bool on) { - if (on) { - menuOn = true; - backgroundMenu(); - } else { - menuOn = false; - } + return (ACTION_NONE); } char * menuSelection(void) { return (selection); } - +#endif /******************************** * File IO @@ -1195,6 +1234,32 @@ unsigned int emu_LoadFile(const char * filepath, void * buf, int size) static FIL outfile; +static bool emu_writeGfxConfig(void) +{ + bool retval = false; + if( !(f_open(&outfile, "/" GFX_CFG_FILENAME, FA_CREATE_NEW | FA_WRITE)) ) { + f_close(&outfile); + retval = true; + } + return retval; +} + +static bool emu_readGfxConfig(void) +{ + bool retval = false; + if( !(f_open(&outfile, "/" GFX_CFG_FILENAME, FA_READ)) ) { + f_close(&outfile); + retval = true; + } + return retval; +} + +static bool emu_eraseGfxConfig(void) +{ + f_unlink ("/" GFX_CFG_FILENAME); + return true; +} + static bool emu_writeConfig(void) { bool retval = false; @@ -1234,6 +1299,7 @@ static bool emu_readConfig(void) static bool emu_eraseConfig(void) { f_unlink (ROMSDIR "/" AUTORUN_FILENAME); + return true; } @@ -1242,20 +1308,20 @@ static bool emu_eraseConfig(void) ********************************/ void emu_init(void) { - // Dual display config, initialize TFT -#if (defined(ILI9341) || defined(ST7789)) && defined(USE_VGA) - tft.begin(); -#endif - + bool forceVga = false; +#ifdef FILEBROWSER sd_init_driver(); FRESULT fr = f_mount(&fatfs, "0:", 1); + forceVga = emu_readGfxConfig(); + strcpy(selection,ROMSDIR); nbFiles = readNbFiles(selection); emu_printf("SD initialized, files found: "); emu_printi(nbFiles); - +#endif + emu_InitJoysticks(); #ifdef SWAP_JOYSTICK joySwapped = true; @@ -1263,7 +1329,43 @@ void emu_init(void) joySwapped = false; #endif - int keypressed = emu_ReadKeys(); +int keypressed = emu_ReadKeys(); + +#ifdef USE_VGA + tft.begin(MODE_VGA_320x240); +#else +#ifdef PICOZX + // Force VGA if LEFT/RIGHT pressed + if (keypressed & MASK_JOY2_UP) + { + tft.begin(MODE_VGA_320x240); +#ifdef FILEBROWSER + emu_writeGfxConfig(); +#endif + } + else + { + if ( (keypressed & MASK_JOY2_LEFT) || (keypressed & MASK_JOY2_RIGHT) ) + { +#ifdef FILEBROWSER + emu_eraseGfxConfig(); +#endif + forceVga = false; + } + if (forceVga) { + tft.begin(MODE_VGA_320x240); + } + else + { + tft.begin(MODE_TFT_320x240); + } + } +#else + tft.begin(MODE_TFT_320x240); +#endif + +#endif + #ifdef PICOMPUTER // Flip screen if UP pressed if (keypressed & MASK_JOY2_UP) @@ -1299,7 +1401,10 @@ void emu_init(void) autorun = true; } } + +#ifdef FILEBROWSER toggleMenu(true); +#endif } diff --git a/MCUME_pico/picovcs/emuapi.h b/MCUME_pico/display/emuapi.h similarity index 53% rename from MCUME_pico/picovcs/emuapi.h rename to MCUME_pico/display/emuapi.h index c6ff728..f97319d 100644 --- a/MCUME_pico/picovcs/emuapi.h +++ b/MCUME_pico/display/emuapi.h @@ -2,68 +2,10 @@ #define EMUAPI_H #include "platform_config.h" +#include "emucfg.h" -//#define TIMER_REND 1 -#define EXTRA_HEAP 0x10 - -// Title: < > -#define TITLE " Atari2600 Emulator" -#define ROMSDIR "2600" - -#define emu_Init(ROM) {vcs_Init();vcs_Start(ROM);} -#define emu_Step() {vcs_Step();} -#define emu_Input(x) {vcs_Input(x);} - -#define PALETTE_SIZE 256 -#define VID_FRAME_SKIP 0x0 -#define TFT_VBUFFER_YCROP 0 -//#define SINGLELINE_RENDERING 1 - -#define ACTION_NONE 0 -#define ACTION_MAXKBDVAL 4 -#define ACTION_EXITKBD 128 -#define ACTION_RUNTFT 129 -#define ACTION_RUNVGA 130 - -#ifdef KEYMAP_PRESENT - -#define keylables_map1_0 (char *)"1234 " -#define keylables_map1_1 (char *)" " -#define keylables_map1_2 (char *)" " -const unsigned short key_map1[] = { - 1,2,3,4,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0, - 0, 0,0,0,0,0,0,0,0,0, - 0,0,0,0 - }; - -#define keylables_map2_0 (char *)" " -#define keylables_map2_1 (char *)" " -#define keylables_map2_2 (char *)" " -const unsigned short key_map2[] = { - 0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0, - 0, 0,0,0,0,0,0,0,0,0, - 0,0,0,0 - }; - -#define keylables_map3_0 (char *)" " -#define keylables_map3_1 (char *)" " -#define keylables_map3_2 (char *)" " -const unsigned short key_map3[] = { - 0,0,0,0,0,0,0,0,0,0,0, // function keys - 0, 0,0,0,0,0,0,0,0,0,0, - 0, 0,0,0,0,0,0,0,0,0, - 0,0,0,0 - }; - -const unsigned short matkeys[] = { - 0x020,0x120,0x220,0x320,0x420,0x408,0x308,0x208,0x108,0x008,0x002, // row 1 - 0x510,0x010,0x110,0x210,0x310,0x410,0x401,0x301,0x201,0x101,0x001, // row 2 - 0x520,0x102,0x202,0x302,0x402,0x404,0x304,0x204,0x104,0x004, // row 3 - 0x508,0x501,0x502,0x504 }; // cursor keys - -#endif +#define ACTION_NONE 0 +#define ACTION_RUN 1 #define MASK_JOY2_RIGHT 0x0001 #define MASK_JOY2_LEFT 0x0002 @@ -81,6 +23,12 @@ const unsigned short matkeys[] = { #define MASK_KEY_USER4 0x2000 #define MASK_OSKB 0x8000 +#define RGBVAL16(r,g,b) ( (((r>>3)&0x1f)<<11) | (((g>>2)&0x3f)<<5) | (((b>>3)&0x1f)<<0) ) + +#ifdef __cplusplus +extern "C" +{ +#endif extern void emu_init(void); extern void emu_start(void); extern void emu_resetSD(void); @@ -101,13 +49,14 @@ extern unsigned int emu_FileSize(const char * filepath); extern unsigned int emu_LoadFile(const char * filepath, void * buf, int size); extern void emu_SetPaletteEntry(unsigned char r, unsigned char g, unsigned char b, int index); -extern void emu_DrawScreen(unsigned char * VBuf, int width, int height, int stride); -extern void emu_DrawLine(unsigned char * VBuf, int width, int height, int line); -extern void emu_DrawLine8(unsigned char * VBuf, int width, int height, int line); +extern void emu_DrawLinePal16(unsigned char * VBuf, int width, int height, int line); extern void emu_DrawLine16(unsigned short * VBuf, int width, int height, int line); +extern void emu_DrawScreenPal16(unsigned char * VBuf, int width, int height, int stride); extern void emu_DrawVsync(void); extern int emu_FrameSkip(void); -extern void * emu_LineBuffer(int line); +extern int emu_IsVga(void); +//extern void emu_DrawLine(unsigned char * VBuf, int width, int height, int line); +//extern void * emu_LineBuffer(int line); extern void emu_InitJoysticks(void); extern int emu_SwapJoysticks(int statusOnly); @@ -117,8 +66,10 @@ extern int emu_GetPad(void); extern int emu_ReadAnalogJoyX(int min, int max); extern int emu_ReadAnalogJoyY(int min, int max); extern int emu_ReadI2CKeyboard(void); +extern unsigned char emu_ReadI2CKeyboard2(int row); extern void emu_KeyboardOnUp(int keymodifer, int key); extern void emu_KeyboardOnDown(int keymodifer, int key); +extern int emu_oskbActive(void); extern void emu_sndPlaySound(int chan, int volume, int freq); extern void emu_sndPlayBuzz(int size, int val); @@ -132,5 +83,9 @@ extern void emu_FileTempInit(void); extern void emu_FileTempRead(int addr, unsigned char * val, int n); extern void emu_FileTempWrite(int addr, unsigned char val); extern void emu_printh(int val); +#ifdef __cplusplus +} +#endif + #endif diff --git a/MCUME_pico/picovga_t4/VGA_font8x8.h b/MCUME_pico/display/font8x8.h similarity index 100% rename from MCUME_pico/picovga_t4/VGA_font8x8.h rename to MCUME_pico/display/font8x8.h diff --git a/MCUME_pico/picovga_t4/include.h b/MCUME_pico/display/include.h similarity index 93% rename from MCUME_pico/picovga_t4/include.h rename to MCUME_pico/display/include.h index 2a1bd5b..f933a1c 100755 --- a/MCUME_pico/picovga_t4/include.h +++ b/MCUME_pico/display/include.h @@ -59,8 +59,8 @@ typedef unsigned char Bool; // ---------------------------------------------------------------------------- // Constants // ---------------------------------------------------------------------------- - #define B0 (1<<0) +/* #define B1 (1<<1) #define B2 (1<<2) #define B3 (1<<3) @@ -92,6 +92,7 @@ typedef unsigned char Bool; #define B29 (1UL<<29) #define B30 (1UL<<30) #define B31 (1UL<<31) +*/ #define BIT(pos) (1UL<<(pos)) @@ -102,7 +103,7 @@ typedef unsigned char Bool; #define PI 3.14159265358979324 #define PI2 (3.14159265358979324*2) -#define VGA_RGB(r,g,b) ( (((r>>5)&0x07)<<5) | (((g>>5)&0x07)<<2) | (((b>>6)&0x3)<<0) ) +//#define VGA_RGB(r,g,b) ( (((r>>5)&0x07)<<5) | (((g>>5)&0x07)<<2) | (((b>>6)&0x3)<<0) ) // system includes diff --git a/MCUME_pico/display/pico_dsp.cpp b/MCUME_pico/display/pico_dsp.cpp new file mode 100755 index 0000000..c174c03 --- /dev/null +++ b/MCUME_pico/display/pico_dsp.cpp @@ -0,0 +1,1429 @@ +/* + This file is part of DISPLAY library. + Supports VGA and TFT display + + DISPLAY library is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Copyright (C) 2020 J-M Harvengt +*/ + +#include "pico/stdlib.h" +#include "pico/multicore.h" +#include "hardware/spi.h" +#include "hardware/dma.h" +#include "hardware/irq.h" +#include + +#include "PICO_DSP.h" +#include "font8x8.h" +#include "include.h" + +static gfx_mode_t gfxmode = MODE_UNDEFINED; + +/* TFT structures / constants */ +#define digitalWrite(pin, val) gpio_put(pin, val) + +#define SPICLOCK 60000000 +#ifdef USE_VGA +#define SPI_MODE SPI_CPOL_1 +#else +#ifdef ST7789 +#ifdef ST7789_POL +#define SPI_MODE SPI_CPOL_0 +#else +#define SPI_MODE SPI_CPOL_1 +#endif +#endif +#ifdef ILI9341 +#define SPI_MODE SPI_CPOL_0 +#endif +#endif + +#define LINES_PER_BLOCK 64 +#define NR_OF_BLOCK 4 + +#define TFT_SWRESET 0x01 +#define TFT_SLPOUT 0x11 +#define TFT_INVON 0x21 +#define TFT_DISPOFF 0x28 +#define TFT_DISPON 0x29 +#define TFT_CASET 0x2A +#define TFT_PASET 0x2B +#define TFT_RAMWR 0x2C +#define TFT_MADCTL 0x36 +#define TFT_PIXFMT 0x3A +#define TFT_MADCTL_MY 0x80 +#define TFT_MADCTL_MX 0x40 +#define TFT_MADCTL_MV 0x20 +#define TFT_MADCTL_ML 0x10 +#define TFT_MADCTL_RGB 0x00 +#define TFT_MADCTL_BGR 0x08 +#define TFT_MADCTL_MH 0x04 + +static void SPItransfer(uint8_t val) +{ + uint8_t dat8=val; + spi_write_blocking(TFT_SPIREG, &dat8, 1); +} + +static void SPItransfer16(uint16_t val) +{ + uint8_t dat8[2]; + dat8[0] = val>>8; + dat8[1] = val&0xff; + spi_write_blocking(TFT_SPIREG, dat8, 2); +} + +#define DELAY_MASK 0x80 +static const uint8_t init_commands[] = { + 1+DELAY_MASK, TFT_SWRESET, 150, + 1+DELAY_MASK, TFT_SLPOUT, 255, + 2+DELAY_MASK, TFT_PIXFMT, 0x55, 10, + 2, TFT_MADCTL, TFT_MADCTL_MV | TFT_MADCTL_BGR, + 1, TFT_INVON, + 1, TFT_DISPON, + 0 +}; + +/* TFT structures / constants */ +#define RGBVAL16(r,g,b) ( (((r>>3)&0x1f)<<11) | (((g>>2)&0x3f)<<5) | (((b>>3)&0x1f)<<0) ) + +static uint16_t * blocks[NR_OF_BLOCK]; +static uint16_t blocklens[NR_OF_BLOCK]; +static dma_channel_config dmaconfig; +static uint dma_tx=0; +static volatile uint8_t rstop = 0; +static volatile bool cancelled = false; +static volatile uint8_t curTransfer = 0; +static uint8_t nbTransfer = 0; + +/* VGA structures / constants */ +#define R16(rgb) ((rgb>>8)&0xf8) +#define G16(rgb) ((rgb>>3)&0xfc) +#define B16(rgb) ((rgb<<3)&0xf8) +#ifdef VGA222 +#define VGA_RGB(r,g,b) ( (((r>>6)&0x03)<<4) | (((g>>6)&0x03)<<2) | (((b>>6)&0x3)<<0) ) +#else +#define VGA_RGB(r,g,b) ( (((r>>5)&0x07)<<5) | (((g>>5)&0x07)<<2) | (((b>>6)&0x3)<<0) ) +#endif + +// 8 bits 320x240 frame buffer => 64K +static vga_pixel * visible_framebuffer = NULL; +static vga_pixel * framebuffer = NULL; +static vga_pixel * fb0 = NULL; +static vga_pixel * fb1 = NULL; + +static int fb_width; +static int fb_height; +static int fb_stride; + +static const sVmode* vmode=NULL; +static const sVmode* volatile VgaVmodeReq = NULL; // request to reinitialize videomode, 1=only stop driver + +static semaphore_t core1_initted; +static void core1_func(); +static void core1_sio_irq(); +static void VgaInitReql(const sVmode* vmode) +{ + if (vmode == NULL) vmode = (const sVmode*)1; + __dmb(); + VgaVmodeReq = vmode; + while (VgaVmodeReq != NULL) { __dmb(); } +} + +static void core1_func() +{ + const sVmode* v; + + multicore_fifo_clear_irq(); + irq_set_exclusive_handler(SIO_IRQ_PROC1,core1_sio_irq); + //irq_set_priority (SIO_IRQ_PROC1, 129); + irq_set_enabled(SIO_IRQ_PROC1,true); + + sem_release(&core1_initted); + + while (true) + { + __dmb(); + + // initialize videomode + v = VgaVmodeReq; + if (v != NULL) + { + if ((u32)v == (u32)1) { + //VgaTerm(); // terminate + } + else + VgaInit(v,(u8*)framebuffer,320,240,320); + __dmb(); + VgaVmodeReq = NULL; + } + } +} + + +void PICO_DSP::setArea(uint16_t x1,uint16_t y1,uint16_t x2,uint16_t y2) { + int dx=0; + int dy=0; +#ifdef ST7789 + if (TFT_REALWIDTH == TFT_REALHEIGHT) + { +#ifdef ROTATE_SCREEN + if (!flipped) { + dy += 80; + } +#else + if (flipped) { + dx += 80; + } +#endif + } +#endif + + digitalWrite(_dc, 0); + SPItransfer(TFT_CASET); + digitalWrite(_dc, 1); + SPItransfer16(x1+dx); + digitalWrite(_dc, 1); + SPItransfer16(x2+dx); + digitalWrite(_dc, 0); + SPItransfer(TFT_PASET); + digitalWrite(_dc, 1); + SPItransfer16(y1+dy); + digitalWrite(_dc, 1); + SPItransfer16(y2+dy); + + digitalWrite(_dc, 0); + SPItransfer(TFT_RAMWR); + digitalWrite(_dc, 1); + + return; +} + + +PICO_DSP::PICO_DSP() +{ +} + +gfx_error_t PICO_DSP::begin(gfx_mode_t mode) +{ + switch(mode) { + case MODE_VGA_320x240: + // Reset SPI if we come from TFT mode + if (gfxmode == MODE_TFT_320x240) { + fillScreenNoDma(RGBVAL16(0x0,0x00,0x00)); + digitalWrite(_cs, 0); + digitalWrite(_dc, 0); + SPItransfer(TFT_DISPOFF); + digitalWrite(_cs, 1); + sleep_ms(20); + digitalWrite(_cs, 0); + digitalWrite(_cs, 1); + if (_bkl != 0xff) { + digitalWrite(_bkl, 0); + } + //spi_init(TFT_SPIREG, 0); + //spi_deinit(TFT_SPIREG); + //spi_set_slave(TFT_SPIREG, true); + } + gfxmode = mode; + fb_width = 320; + fb_height = 240; + fb_stride = fb_width; + /* initialize gfx buffer */ + if (fb0 == NULL) { + void *mallocpt = malloc(fb_stride*fb_height*sizeof(vga_pixel)+4); + fb0 = (vga_pixel *)((void*)((intptr_t)mallocpt & ~3)); + } + visible_framebuffer = fb0; + framebuffer = fb0; + for (uint i = 0; i < fb_height*fb_width; i++) { + framebuffer[i] = VGA_RGB(rand() % 255,rand() % 255,rand() % 255); + } + // create a semaphore to be posted when audio init is complete + sem_init(&core1_initted, 0, 1); + multicore_launch_core1(core1_func); + vmode = Video(DEV_VGA, RES_QVGA); + VgaInitReql(vmode); + // wait for initialization of audio to be complete + sem_acquire_blocking(&core1_initted); + break; + + case MODE_TFT_320x240: + gfxmode = mode; + fb_width = TFT_WIDTH; + fb_height = TFT_HEIGHT; + fb_stride = fb_width; + _cs = TFT_CS; + _dc = TFT_DC; + _rst = TFT_RST; + _mosi = TFT_MOSI; + _sclk = TFT_SCLK; + _bkl = TFT_BACKLIGHT; + gpio_init(_dc); + gpio_set_dir(_dc, GPIO_OUT); + gpio_init(_cs); + gpio_set_dir(_cs, GPIO_OUT); + digitalWrite(_cs, 1); + digitalWrite(_dc, 1); + if (_bkl != 0xff) { + gpio_init(_bkl); + gpio_set_dir(_bkl, GPIO_OUT); + digitalWrite(_bkl, 1); + } + + spi_init(TFT_SPIREG, SPICLOCK); + spi_set_format(TFT_SPIREG, 8, SPI_MODE, SPI_CPHA_0, SPI_MSB_FIRST); + gpio_set_function(_sclk , GPIO_FUNC_SPI); + gpio_set_function(_mosi , GPIO_FUNC_SPI); + + // Initialize display + if (_rst != 0xff) { + gpio_init(_rst); + gpio_set_dir(_rst, GPIO_OUT); + digitalWrite(_rst, 1); + sleep_ms(100); + digitalWrite(_rst, 0); + sleep_ms(100); + digitalWrite(_rst, 1); + sleep_ms(200); + } + const uint8_t *addr = init_commands; + uint8_t count; + digitalWrite(_cs, 0); + while (count = *addr++) { + uint8_t command = *addr++; +#ifdef ILI9341 + if ( command == TFT_INVON ) { + // Skip TFT_INVON for ILI + } + else +#endif + { + digitalWrite(_dc, 0); // command + SPItransfer(command); + uint16_t ms = count & DELAY_MASK; + count &= ~DELAY_MASK; + while (--count > 0) { // data + uint8_t data = *addr++; +#ifdef ILI9341 +#else + if ( command == TFT_MADCTL ) { + data = TFT_MADCTL_MX | TFT_MADCTL_MV |TFT_MADCTL_RGB; + } +#endif + digitalWrite(_dc, 1); + SPItransfer(data); + } + if (ms) { + ms = *addr++; // Read post-command delay time (ms) + if(ms == 255) ms = 500; // If 255, delay for 500 ms + digitalWrite(_cs, 1); + //SPI.endTransaction(); + sleep_ms(ms); + //SPI.beginTransaction(SPISettings(SPICLOCK, MSBFIRST, SPI_MODE)); + digitalWrite(_cs, 0); + } + } + } + digitalWrite(_cs, 1); + break; + } + + + return(GFX_OK); +} + +void PICO_DSP::end() +{ +} + +gfx_mode_t PICO_DSP::getMode(void) +{ + return gfxmode; +} + +void PICO_DSP::flipscreen(bool flip) +{ + digitalWrite(_dc, 0); + digitalWrite(_cs, 0); + SPItransfer(TFT_MADCTL); + digitalWrite(_dc, 1); + if (flip) { + flipped=true; + +#ifdef ILI9341 + SPItransfer(TFT_MADCTL_MV | TFT_MADCTL_BGR); +#endif +#ifdef ST7789 +#ifdef ROTATE_SCREEN + SPItransfer(TFT_MADCTL_RGB); +#else + SPItransfer(TFT_MADCTL_MY | TFT_MADCTL_MV |TFT_MADCTL_RGB); +#endif +#endif + } + else { + flipped=false; + +#ifdef ILI9341 + SPItransfer(TFT_MADCTL_MX | TFT_MADCTL_MY | TFT_MADCTL_MV | TFT_MADCTL_BGR); +#endif +#ifdef ST7789 +#ifdef ROTATE_SCREEN + SPItransfer(TFT_MADCTL_MX | TFT_MADCTL_MY | TFT_MADCTL_RGB); +#else + SPItransfer(TFT_MADCTL_MX | TFT_MADCTL_MV | TFT_MADCTL_RGB); +#endif +#endif + } + digitalWrite(_cs, 1); +} + + +bool PICO_DSP::isflipped(void) +{ + return(flipped); +} + + +/*********************************************************************************************** + DMA functions + ***********************************************************************************************/ +static void dma_isr() { + irq_clear(DMA_IRQ_0); + dma_hw->ints0 = 1u << dma_tx; + curTransfer++; + if (curTransfer >= nbTransfer) { + curTransfer = 0; + } + if (cancelled) { + rstop = 1; + } + else + { + dma_channel_transfer_from_buffer_now(dma_tx, blocks[curTransfer], blocklens[curTransfer]); + } +} + +static void setDmaStruct() { + // Setup the control channel + if (dma_tx == 0) { + dma_tx = dma_claim_unused_channel(true); + } + dmaconfig = dma_channel_get_default_config(dma_tx); + channel_config_set_transfer_data_size(&dmaconfig, DMA_SIZE_16); + channel_config_set_dreq(&dmaconfig, TFT_SPIDREQ); + //channel_config_set_read_increment(&dmaconfig, true); // read incrementing + //channel_config_set_write_increment(&dmaconfig, false); // no write incrementing + + dma_channel_configure( + dma_tx, + &dmaconfig, + &spi_get_hw(TFT_SPIREG)->dr, // write address + blocks[0], + blocklens[0], + false + ); + + irq_set_exclusive_handler(DMA_IRQ_0, dma_isr); + dma_channel_set_irq0_enabled(dma_tx, true); + irq_set_enabled(DMA_IRQ_0, true); + dma_hw->ints0 = 1u << dma_tx; +} + +void PICO_DSP::startRefresh(void) { + if (gfxmode == MODE_TFT_320x240) { + uint32_t remaining = TFT_HEIGHT*TFT_WIDTH*2; + int i=0; + nbTransfer = 0; + while (remaining > 0) { + uint16_t * fb = blocks[i]; + int32_t len = (remaining >= (LINES_PER_BLOCK*TFT_WIDTH*2)?LINES_PER_BLOCK*TFT_WIDTH*2:remaining); + switch (i) { + case 0: + if (fb == 0) fb = (uint16_t*)((int)malloc(len+64)&0xffffffe0); + break; + case 1: + if (fb == 0) fb = (uint16_t*)((int)malloc(len+64)&0xffffffe0); + break; + case 2: + if (fb == 0) fb = (uint16_t*)((int)malloc(len+64)&0xffffffe0); + break; + case 3: + if (fb == 0) fb = (uint16_t*)((int)malloc(len+64)&0xffffffe0); + break; + } + blocks[i] = fb; + blocklens[i] = len/2; + if (blocks[i] == 0) { + fillScreenNoDma(RGBVAL16(0xFF,0xFF,0x00)); + printf("FB allocaltion failed for block %d\n",i); + sleep_ms(10000); + } + nbTransfer++; + remaining -= len; + i++; + } + curTransfer = 0; + rstop = 0; + digitalWrite(_cs, 1); + setDmaStruct(); + fillScreen(RGBVAL16(0x00,0x00,0x00)); + digitalWrite(_cs, 0); + + setArea((TFT_REALWIDTH-TFT_WIDTH)/2, (TFT_REALHEIGHT-TFT_HEIGHT)/2, (TFT_REALWIDTH-TFT_WIDTH)/2 + TFT_WIDTH-1, (TFT_REALHEIGHT-TFT_HEIGHT)/2+TFT_HEIGHT-1); + // we switch to 16bit mode!! + spi_set_format(TFT_SPIREG, 16, SPI_CPOL_0, SPI_CPHA_0, SPI_MSB_FIRST); + dma_start_channel_mask(1u << dma_tx); + } + else { + fillScreen(RGBVAL16(0x00,0x00,0x00)); + } +} + +void PICO_DSP::stopRefresh(void) { + if (gfxmode == MODE_TFT_320x240) { + rstop = 1; + unsigned long m = time_us_32()*1000; + cancelled = true; + while (!rstop) { + if ((time_us_32()*1000 - m) > 100) break; + sleep_ms(100); + asm volatile("wfi"); + }; + rstop = 0; + sleep_ms(100); + cancelled = false; + //dmatx.detachInterrupt(); + fillScreen(RGBVAL16(0x00,0x00,0x00)); + digitalWrite(_cs, 1); + // we switch back to GFX mode!! + begin(gfxmode); + setArea(0, 0, TFT_REALWIDTH-1, TFT_REALHEIGHT-1); + } +} + + +/*********************************************************************************************** + GFX functions + ***********************************************************************************************/ +// retrieve size of the frame buffer +int PICO_DSP::get_frame_buffer_size(int *width, int *height) +{ + if (width != nullptr) *width = fb_width; + if (height != nullptr) *height = fb_height; + return fb_stride; +} + +void PICO_DSP::waitSync() +{ + if (gfxmode == MODE_TFT_320x240) { + } + else { + WaitVSync(); + } +} + +void PICO_DSP::waitLine(int line) +{ + if (gfxmode == MODE_TFT_320x240) { + } + else { +// while (currentLine != line) {}; + } +} + + +/*********************************************************************************************** + GFX functions + ***********************************************************************************************/ +/* +vga_pixel * PICO_DSP::getLineBuffer(int j) { + return (&framebuffer[j*fb_stride]); +} +*/ + +void PICO_DSP::fillScreen(dsp_pixel color) { + int i,j; + if (gfxmode == MODE_TFT_320x240) { + for (j=0; j>6]; + uint16_t * dst=&block[(j&0x3F)*fb_stride]; + for (i=0; i>6]; + uint16_t * dst=&block[(l&0x3F)*fb_stride+x]; + for (i=0; i>6]; + dst=&block[(l&0x3F)*fb_stride+x]; + bits = *charpt; + if (bits&0x01) *dst++=fgcolor; + else *dst++=bgcolor; + bits = bits >> 1; + if (bits&0x01) *dst++=fgcolor; + else *dst++=bgcolor; + bits = bits >> 1; + if (bits&0x01) *dst++=fgcolor; + else *dst++=bgcolor; + bits = bits >> 1; + if (bits&0x01) *dst++=fgcolor; + else *dst++=bgcolor; + bits = bits >> 1; + if (bits&0x01) *dst++=fgcolor; + else *dst++=bgcolor; + bits = bits >> 1; + if (bits&0x01) *dst++=fgcolor; + else *dst++=bgcolor; + bits = bits >> 1; + if (bits&0x01) *dst++=fgcolor; + else *dst++=bgcolor; + bits = bits >> 1; + if (bits&0x01) *dst++=fgcolor; + else *dst++=bgcolor; + l++; + } + block=blocks[l>>6]; + dst=&block[(l&0x3F)*fb_stride+x]; + bits = *charpt++; + if (bits&0x01) *dst++=fgcolor; + else *dst++=bgcolor; + bits = bits >> 1; + if (bits&0x01) *dst++=fgcolor; + else *dst++=bgcolor; + bits = bits >> 1; + if (bits&0x01) *dst++=fgcolor; + else *dst++=bgcolor; + bits = bits >> 1; + if (bits&0x01) *dst++=fgcolor; + else *dst++=bgcolor; + bits = bits >> 1; + if (bits&0x01) *dst++=fgcolor; + else *dst++=bgcolor; + bits = bits >> 1; + if (bits&0x01) *dst++=fgcolor; + else *dst++=bgcolor; + bits = bits >> 1; + if (bits&0x01) *dst++=fgcolor; + else *dst++=bgcolor; + bits = bits >> 1; + if (bits&0x01) *dst++=fgcolor; + else *dst++=bgcolor; + l++; + } + x +=8; + } + } + else { + vga_pixel fgcolor8 = VGA_RGB(R16(fgcolor),G16(fgcolor),B16(fgcolor)); + vga_pixel bgcolor8 = VGA_RGB(R16(bgcolor),G16(bgcolor),B16(bgcolor)); + vga_pixel c; + vga_pixel * dst; + while ((c = *text++)) { + const unsigned char * charpt=&font8x8[c][0]; + int l=y; + for (int i=0;i<8;i++) + { + unsigned char bits; + if (doublesize) { + dst=&framebuffer[l*fb_stride+x]; + bits = *charpt; + if (bits&0x01) *dst++=fgcolor8; + else *dst++=bgcolor8; + bits = bits >> 1; + if (bits&0x01) *dst++=fgcolor8; + else *dst++=bgcolor8; + bits = bits >> 1; + if (bits&0x01) *dst++=fgcolor8; + else *dst++=bgcolor8; + bits = bits >> 1; + if (bits&0x01) *dst++=fgcolor8; + else *dst++=bgcolor8; + bits = bits >> 1; + if (bits&0x01) *dst++=fgcolor8; + else *dst++=bgcolor8; + bits = bits >> 1; + if (bits&0x01) *dst++=fgcolor8; + else *dst++=bgcolor8; + bits = bits >> 1; + if (bits&0x01) *dst++=fgcolor8; + else *dst++=bgcolor8; + bits = bits >> 1; + if (bits&0x01) *dst++=fgcolor8; + else *dst++=bgcolor8; + l++; + } + dst=&framebuffer[l*fb_stride+x]; + bits = *charpt++; + if (bits&0x01) *dst++=fgcolor8; + else *dst++=bgcolor8; + bits = bits >> 1; + if (bits&0x01) *dst++=fgcolor8; + else *dst++=bgcolor8; + bits = bits >> 1; + if (bits&0x01) *dst++=fgcolor8; + else *dst++=bgcolor8; + bits = bits >> 1; + if (bits&0x01) *dst++=fgcolor8; + else *dst++=bgcolor8; + bits = bits >> 1; + if (bits&0x01) *dst++=fgcolor8; + else *dst++=bgcolor8; + bits = bits >> 1; + if (bits&0x01) *dst++=fgcolor8; + else *dst++=bgcolor8; + bits = bits >> 1; + if (bits&0x01) *dst++=fgcolor8; + else *dst++=bgcolor8; + bits = bits >> 1; + if (bits&0x01) *dst++=fgcolor8; + else *dst++=bgcolor8; + l++; + } + x +=8; + } + } +} + +void PICO_DSP::drawSprite(int16_t x, int16_t y, const dsp_pixel *bitmap, uint16_t arx, uint16_t ary, uint16_t arw, uint16_t arh) +{ + int bmp_offx = 0; + int bmp_offy = 0; + uint16_t *bmp_ptr; + int w =*bitmap++; + int h = *bitmap++; + if ( (arw == 0) || (arh == 0) ) { + // no crop window + arx = x; + ary = y; + arw = w; + arh = h; + } + else { + if ( (x>(arx+arw)) || ((x+w)(ary+arh)) || ((y+h) arx) && (x<(arx+arw)) ) { + arw = arw - (x-arx); + arx = arx + (x-arx); + } else { + bmp_offx = arx; + } + if ( ((x+w) > arx) && ((x+w)<(arx+arw)) ) { + arw -= (arx+arw-x-w); + } + if ( (y > ary) && (y<(ary+arh)) ) { + arh = arh - (y-ary); + ary = ary + (y-ary); + } else { + bmp_offy = ary; + } + if ( ((y+h) > ary) && ((y+h)<(ary+arh)) ) { + arh -= (ary+arh-y-h); + } + } + int l=ary; + bitmap = bitmap + bmp_offy*w + bmp_offx; + + + if (gfxmode == MODE_TFT_320x240) { + for (int row=0;row>6]; + uint16_t * dst=&block[(l&0x3F)*fb_stride+arx]; + bmp_ptr = (uint16_t*)bitmap; + for (int col=0;col>6]; + uint16_t * dst=&block[(y&0x3F)*fb_stride]; + if (width > fb_width) { +#ifdef TFT_LINEARINT + int delta = (width/(width-fb_width))-1; + int pos = delta; + for (int i=0; i> 8]; + pos +=step; + } + #endif + } + else if ((width*2) == fb_width) + { + for (int i=0; i 2) ) y += (fb_height-height)/2; + vga_pixel * dst=&framebuffer[y*fb_stride]; + if (width > fb_width) { + int step = ((width << 8)/fb_width); + int pos = 0; + for (int i=0; i> 8]; + *dst++ = VGA_RGB(R16(pix),G16(pix),B16(pix)); + pos +=step; + } + } + else if ((width*2) == fb_width) { + for (int i=0; i 2) ) y += (fb_height-height)/2; + uint16_t * block=blocks[y>>6]; + uint16_t * dst=&block[(y&0x3F)*fb_stride]; + if (width > fb_width) { +#ifdef TFT_LINEARINT + int delta = (width/(width-fb_width))-1; + int pos = delta; + for (int i=0; i> 8]]; + pos +=step; + } +#endif + } + else if ((width*2) == fb_width) { + for (int i=0; i 2) ) y += (fb_height-height)/2; + vga_pixel * dst=&framebuffer[y*fb_stride]; + if (width > fb_width) { + int step = ((width << 8)/fb_width); + int pos = 0; + for (int i=0; i> 8]]; + *dst++= VGA_RGB(R16(pix),G16(pix),B16(pix)); + pos +=step; + } + } + else if ((width*2) == fb_width) { + for (int i=0; i>6]; + uint16_t * dst=&block[(y&0x3F)*fb_stride]; + src=buffer; + for (i=0; i>6]; + dst=&block[(y&0x3F)*fb_stride]; + src=buffer; + for (i=0; i>6]; + uint16_t * dst=&block[(y&0x3F)*fb_stride+(fb_width-width)/2]; + src=buffer; + for (i=0; i>6]; + dst=&block[(y&0x3F)*fb_stride+(fb_width-width)/2]; + src=buffer; + for (i=0; i(arx+arw)) || ((x+w)(ary+arh)) || ((y+h) arx) && (x<(arx+arw)) ) { + arw = arw - (x-arx); + arx = arx + (x-arx); + } else { + bmp_offx = arx; + } + if ( ((x+w) > arx) && ((x+w)<(arx+arw)) ) { + arw -= (arx+arw-x-w); + } + if ( (y > ary) && (y<(ary+arh)) ) { + arh = arh - (y-ary); + ary = ary + (y-ary); + } else { + bmp_offy = ary; + } + if ( ((y+h) > ary) && ((y+h)<(ary+arh)) ) { + arh -= (ary+arh-y-h); + } + } + digitalWrite(_cs, 0); + setArea(arx, ary, arx+arw-1, ary+arh-1); + bitmap = bitmap + bmp_offy*w + bmp_offx; + for (int row=0;row> 1; + if (bits&0x01) SPItransfer16(fgcolor); + else SPItransfer16(bgcolor); + bits = bits >> 1; + if (bits&0x01) SPItransfer16(fgcolor); + else SPItransfer16(bgcolor); + bits = bits >> 1; + if (bits&0x01) SPItransfer16(fgcolor); + else SPItransfer16(bgcolor); + bits = bits >> 1; + if (bits&0x01) SPItransfer16(fgcolor); + else SPItransfer16(bgcolor); + bits = bits >> 1; + if (bits&0x01) SPItransfer16(fgcolor); + else SPItransfer16(bgcolor); + bits = bits >> 1; + if (bits&0x01) SPItransfer16(fgcolor); + else SPItransfer16(bgcolor); + bits = bits >> 1; + if (bits&0x01) SPItransfer16(fgcolor); + else SPItransfer16(bgcolor); + } + bits = *charpt++; + if (bits&0x01) SPItransfer16(fgcolor); + else SPItransfer16(bgcolor); + bits = bits >> 1; + if (bits&0x01) SPItransfer16(fgcolor); + else SPItransfer16(bgcolor); + bits = bits >> 1; + if (bits&0x01) SPItransfer16(fgcolor); + else SPItransfer16(bgcolor); + bits = bits >> 1; + if (bits&0x01) SPItransfer16(fgcolor); + else SPItransfer16(bgcolor); + bits = bits >> 1; + if (bits&0x01) SPItransfer16(fgcolor); + else SPItransfer16(bgcolor); + bits = bits >> 1; + if (bits&0x01) SPItransfer16(fgcolor); + else SPItransfer16(bgcolor); + bits = bits >> 1; + if (bits&0x01) SPItransfer16(fgcolor); + else SPItransfer16(bgcolor); + bits = bits >> 1; + if (bits&0x01) SPItransfer16(fgcolor); + else SPItransfer16(bgcolor); + } + x +=8; +#ifdef ILI9341 + digitalWrite(_dc, 0); + SPItransfer(ILI9341_SLPOUT); + digitalWrite(_dc, 1); +#endif + digitalWrite(_cs, 1); + } + + digitalWrite(_cs, 0); + setArea(0, 0, (TFT_REALWIDTH-1), (TFT_REALHEIGHT-1)); + digitalWrite(_cs, 1); + } + else { + drawText(x, y, text, fgcolor, bgcolor, doublesize); + } +} + +/******************************************************************* + Experimental PWM interrupt based sound driver !!! +*******************************************************************/ +#include "hardware/irq.h" +#include "hardware/pwm.h" + +static bool fillfirsthalf = true; +static uint16_t cnt = 0; +static uint16_t sampleBufferSize = 0; + +static void (*fillsamples)(short * stream, int len) = nullptr; + +static uint32_t * i2s_tx_buffer; +static short * i2s_tx_buffer16; + +static void SOFTWARE_isr() { + if (fillfirsthalf) { + fillsamples((short *)i2s_tx_buffer, sampleBufferSize); + } + else { + fillsamples((short *)&i2s_tx_buffer[sampleBufferSize/2], sampleBufferSize); + } +} + +static void AUDIO_isr() { + pwm_clear_irq(pwm_gpio_to_slice_num(AUDIO_PIN)); + long s = i2s_tx_buffer16[cnt++]; + s += i2s_tx_buffer16[cnt++]; + s = s/2 + 32767; + pwm_set_gpio_level(AUDIO_PIN, s >> 8); + cnt = cnt & (sampleBufferSize*2-1); + + if (cnt == 0) { + fillfirsthalf = false; + //irq_set_pending(RTC_IRQ+1); + multicore_fifo_push_blocking(0); + } + else if (cnt == sampleBufferSize) { + fillfirsthalf = true; + //irq_set_pending(RTC_IRQ+1); + multicore_fifo_push_blocking(0); + } +} + +static void core1_sio_irq() { + irq_clear(SIO_IRQ_PROC1); + while(multicore_fifo_rvalid()) { + uint16_t raw = multicore_fifo_pop_blocking(); + SOFTWARE_isr(); + } + multicore_fifo_clear_irq(); +} + +static void core1_func_tft() { + multicore_fifo_clear_irq(); + irq_set_exclusive_handler(SIO_IRQ_PROC1,core1_sio_irq); + //irq_set_priority (SIO_IRQ_PROC1, 129); + irq_set_enabled(SIO_IRQ_PROC1,true); + + while (true) { + tight_loop_contents(); + } +} + +void PICO_DSP::begin_audio(int samplesize, void (*callback)(short * stream, int len)) +{ + fillsamples = callback; + i2s_tx_buffer = (uint32_t*)malloc(samplesize*sizeof(uint32_t)); + + if (i2s_tx_buffer == NULL) { + printf("sound buffer could not be allocated!!!!!\n"); + return; + } + memset((void*)i2s_tx_buffer,0, samplesize*sizeof(uint32_t)); + printf("sound buffer allocated\n"); + + i2s_tx_buffer16 = (short*)i2s_tx_buffer; + + sampleBufferSize = samplesize; + + gpio_set_function(AUDIO_PIN, GPIO_FUNC_PWM); + + if (gfxmode == MODE_TFT_320x240) { + multicore_launch_core1(core1_func_tft); + } + + int audio_pin_slice = pwm_gpio_to_slice_num(AUDIO_PIN); + // Setup PWM interrupt to fire when PWM cycle is complete + pwm_clear_irq(audio_pin_slice); + pwm_set_irq_enabled(audio_pin_slice, true); + irq_set_exclusive_handler(PWM_IRQ_WRAP, AUDIO_isr); + irq_set_priority (PWM_IRQ_WRAP, 128); + irq_set_enabled(PWM_IRQ_WRAP, true); + + //irq_set_exclusive_handler(RTC_IRQ+1,SOFTWARE_isr); + //irq_set_priority (RTC_IRQ+1, 120); + //irq_set_enabled(RTC_IRQ+1,true); + + + // Setup PWM for audio output + pwm_config config = pwm_get_default_config(); +// pwm_config_set_clkdiv(&config, 5.5f); + pwm_config_set_clkdiv(&config, 50.0f); + pwm_config_set_wrap(&config, 254); + pwm_init(audio_pin_slice, &config, true); + + pwm_set_gpio_level(AUDIO_PIN, 0); + printf("sound initialized\n"); +} + +void PICO_DSP::end_audio() +{ + if (i2s_tx_buffer != NULL) { + free(i2s_tx_buffer); + } +} + + + + diff --git a/MCUME_pico/display/pico_dsp.h b/MCUME_pico/display/pico_dsp.h new file mode 100755 index 0000000..9899489 --- /dev/null +++ b/MCUME_pico/display/pico_dsp.h @@ -0,0 +1,125 @@ +/* + This file is part of DISPLAY library. + Supports VGA and TFT display + + DISPLAY library is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Teensy VGA inspired from the original Teensy3 uVGA library of Eric PREVOTEAU. + QTIMER/FlexIO code based on Teensy4 examples of KurtE, Manitou and easone + from the Teensy4 forum (https://forum.pjrc.com) +*/ + +#ifndef _PICO_DSP_H +#define _PICO_DSP_H + +#ifdef __cplusplus +#include +#include +#include "pico.h" +#endif + +#include "platform_config.h" +#include "iopins.h" + + +#ifdef LOHRES +#define TFT_WIDTH 240 +#define TFT_REALWIDTH 240 +#else +#ifdef OVERRULE_WIDTH +#define TFT_WIDTH OVERRULE_WIDTH +#else +#define TFT_WIDTH 320 +#endif +#define TFT_REALWIDTH 320 +#endif +#ifdef OVERRULE_HEIGHT +#define TFT_HEIGHT OVERRULE_HEIGHT +#else +#define TFT_HEIGHT 240 +#endif +#define TFT_REALHEIGHT 240 + +#define AUDIO_SAMPLE_BUFFER_SIZE 256 +#define DEFAULT_VSYNC_PIN 8 + +typedef uint8_t vga_pixel; +typedef uint16_t dsp_pixel; + +typedef enum gfx_mode_t +{ + MODE_UNDEFINED = 0, + MODE_TFT_320x240 = 1, + MODE_VGA_320x240 = 2 +} gfx_mode_t; + +typedef enum vga_error_t +{ + GFX_OK = 0, + GFX_ERROR = -1 +} gfx_error_t; + +class PICO_DSP +{ +public: + + PICO_DSP(); + + // Initialization + gfx_error_t begin(gfx_mode_t mode); + gfx_mode_t getMode(void); + void end(); + void startRefresh(void); + void stopRefresh(); + void begin_audio(int samplesize, void (*callback)(short * stream, int len)); + void end_audio(); + + + // framebuffer/screen operation + int get_frame_buffer_size(int *width, int *height); + void setArea(uint16_t x1,uint16_t y1,uint16_t x2,uint16_t y2); + void flipscreen(bool flip); + bool isflipped(void); + + // wait next Vsync + void waitSync(); + void waitLine(int line); + + // ========================================================= + // graphic primitives + // ========================================================= + + //dsp_pixel * getLineBuffer(int j); + void writeLine(int width, int height, int y, dsp_pixel *buf); + void writeLinePal(int width, int height, int y, uint8_t *buffer, dsp_pixel *palette16); + void writeScreenPal(int width, int height, int stride, uint8_t *buf, dsp_pixel *palette16); + + void fillScreen(dsp_pixel color); + void drawText(int16_t x, int16_t y, const char * text, dsp_pixel fgcolor, dsp_pixel bgcolor, bool doublesize); + void drawRect(int16_t x, int16_t y, int16_t w, int16_t h, dsp_pixel color); + void drawSprite(int16_t x, int16_t y, const dsp_pixel *bitmap); + void drawSprite(int16_t x, int16_t y, const dsp_pixel *bitmap, uint16_t croparx, uint16_t cropary, uint16_t croparw, uint16_t croparh); + + // NoDMA functions + void fillScreenNoDma(dsp_pixel color); + void drawTextNoDma(int16_t x, int16_t y, const char * text, dsp_pixel fgcolor, dsp_pixel bgcolor, bool doublesize); + void drawRectNoDma(int16_t x, int16_t y, int16_t w, int16_t h, dsp_pixel color); + void drawSpriteNoDma(int16_t x, int16_t y, const dsp_pixel *bitmap); + void drawSpriteNoDma(int16_t x, int16_t y, const dsp_pixel *bitmap, uint16_t croparx, uint16_t cropary, uint16_t croparw, uint16_t croparh); + +private: + static uint8_t _vsync_pin; + +protected: + uint8_t _rst, _cs, _dc; + uint8_t _miso, _mosi, _sclk, _bkl; + bool flipped=false; +}; + + +#endif + + diff --git a/MCUME_pico/picovga_t4/picovga.pio b/MCUME_pico/display/picovga.pio similarity index 100% rename from MCUME_pico/picovga_t4/picovga.pio rename to MCUME_pico/display/picovga.pio diff --git a/MCUME_pico/picovga_t4/vga.cpp b/MCUME_pico/display/vga.cpp similarity index 100% rename from MCUME_pico/picovga_t4/vga.cpp rename to MCUME_pico/display/vga.cpp diff --git a/MCUME_pico/picovga_t4/vga.h b/MCUME_pico/display/vga.h similarity index 100% rename from MCUME_pico/picovga_t4/vga.h rename to MCUME_pico/display/vga.h diff --git a/MCUME_pico/picovga_t4/vga_config.h b/MCUME_pico/display/vga_config.h similarity index 90% rename from MCUME_pico/picovga_t4/vga_config.h rename to MCUME_pico/display/vga_config.h index 8c20247..e79887c 100755 --- a/MCUME_pico/picovga_t4/vga_config.h +++ b/MCUME_pico/display/vga_config.h @@ -34,8 +34,13 @@ // GP7 ... VGA R2 // GP8 ... VGA SYNC synchronization (inverted: negative SYNC=LOW=0x80, BLACK=HIGH=0x00) #define VGA_GPIO_FIRST VGA_COLORBASE // first VGA GPIO -#define VGA_GPIO_NUM 9 // number of VGA GPIOs, including HSYNC and VSYNC +#ifdef VGA222 +#define VGA_GPIO_OUTNUM 6 // number of VGA color GPIOs, without HSYNC and VSYNC +#define VGA_GPIO_NUM 7 // number of VGA GPIOs, including HSYNC and VSYNC +#else #define VGA_GPIO_OUTNUM 8 // number of VGA color GPIOs, without HSYNC and VSYNC +#define VGA_GPIO_NUM 9 // number of VGA GPIOs, including HSYNC and VSYNC +#endif #define VGA_GPIO_LAST (VGA_GPIO_FIRST+VGA_GPIO_NUM-1) // last VGA GPIO #define VGA_GPIO_SYNC VGA_SYNCBASE // VGA SYNC GPIO diff --git a/MCUME_pico/picovga_t4/vga_vmode.cpp b/MCUME_pico/display/vga_vmode.cpp similarity index 100% rename from MCUME_pico/picovga_t4/vga_vmode.cpp rename to MCUME_pico/display/vga_vmode.cpp diff --git a/MCUME_pico/picovga_t4/vga_vmode.h b/MCUME_pico/display/vga_vmode.h similarity index 100% rename from MCUME_pico/picovga_t4/vga_vmode.h rename to MCUME_pico/display/vga_vmode.h diff --git a/MCUME_pico/gfxengine/gfxengine.cpp b/MCUME_pico/gfxengine/gfxengine.cpp deleted file mode 100644 index d022e57..0000000 --- a/MCUME_pico/gfxengine/gfxengine.cpp +++ /dev/null @@ -1,321 +0,0 @@ -/* - * Copyright (c) 2021 Raspberry Pi (Trading) Ltd. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#include -#include - -#include "pico.h" -#include "pico/stdlib.h" - -//#include "VGA_t4.h" -#include "vga_t_dma.h" -VGA_T4 vga; - - -const vga_pixel mario[] = { -0x00,0x00,0x00,0x00,0x00,0x00,0x24,0x24,0x24,0x24,0x24,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x24,0x24,0xe5,0xe1,0xe9,0xf9,0xe9,0x24,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x24,0xe1,0xe1,0xa1,0xa1,0xd0,0xf9,0xff,0x24,0x00,0x00,0x00,0x00, -0x00,0x00,0x24,0xa1,0xe5,0xa1,0x81,0x24,0x24,0x24,0x24,0x24,0x24,0x00,0x00,0x00, -0x00,0x24,0xa5,0xa1,0x81,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x00,0x00, -0x00,0x24,0xf6,0x24,0x24,0x44,0xe9,0x24,0xe9,0x24,0xed,0x00,0x00,0x00,0x00,0x00, -0x24,0xf6,0x8d,0xf6,0x24,0xe9,0xf6,0x24,0xf6,0x24,0xf6,0x8d,0x6c,0x00,0x00,0x00, -0x24,0xe9,0x88,0xf6,0x24,0x24,0xfa,0xf6,0xfa,0xf6,0xfa,0xf6,0xf6,0x68,0x00,0x00, -0x24,0x40,0xe9,0xf6,0x24,0xf6,0xf6,0x44,0xe9,0xed,0xe9,0xed,0xe9,0x68,0x00,0x00, -0x00,0x24,0x40,0xe9,0xed,0xf6,0x44,0x20,0x20,0x20,0x20,0x20,0x24,0x00,0x00,0x00, -0x00,0x00,0x24,0x84,0xe9,0xe9,0xe9,0xe9,0x20,0x24,0x24,0x24,0x00,0x00,0x00,0x00, -0x00,0x00,0x68,0x81,0x84,0x84,0x88,0x88,0x68,0x29,0x24,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x68,0xa5,0xa5,0xe9,0x68,0x4e,0x7a,0x7a,0x29,0x24,0x24,0x00,0x00,0x00, -0x00,0x24,0x68,0xff,0xff,0xff,0x8d,0xff,0xff,0x9b,0xff,0x49,0x24,0x24,0x00,0x00, -0x24,0x64,0x88,0xff,0xff,0x8d,0x4e,0xff,0xff,0x9b,0xff,0x24,0x88,0x88,0x24,0x00, -0x88,0x88,0x68,0xff,0xff,0x68,0x2e,0x4e,0x52,0x7a,0x29,0x20,0x88,0x88,0x24,0x00, -0x88,0x88,0x49,0x68,0x6c,0x2e,0x2e,0x2e,0x2e,0x09,0x00,0x88,0x88,0x88,0x00,0x00, -0x24,0x88,0x88,0x24,0x24,0x09,0x05,0x05,0x09,0x24,0x24,0x88,0x88,0x24,0x00,0x00, -0x00,0x24,0x24,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x24,0x24,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; - -static const unsigned char tilemapL0[] = { - 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, - 0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, - 0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03, - 0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04, - 0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x05, - 0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06, - 0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07, - 0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08, - 0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09, - 0x0A,0x0A,0x0A,0x0A,0x0A,0x0A,0x0A,0x0A,0x0A,0x0A,0x0A,0x0A,0x0A,0x0A,0x0A,0x0A,0x0A,0x0A,0x0A,0x0A,0x0A,0x0A,0x0A,0x0A,0x0A,0x0A,0x0A,0x0A,0x0A,0x0A, - 0x0B,0x0B,0x0B,0x0B,0x0B,0x0B,0x0B,0x0B,0x0B,0x0B,0x0B,0x0B,0x0B,0x0B,0x0B,0x0B,0x0B,0x0B,0x0B,0x0B,0x0B,0x0B,0x0B,0x0B,0x0B,0x0B,0x0B,0x0B,0x0B,0x0B, - 0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C, - 0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D, - 0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E, - 0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F, - 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, - 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, - 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, - 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, - 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, - 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, - 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, - 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, - 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, - 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, - 0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A, - 0x1B,0x1B,0x1B,0x1B,0x1B,0x1B,0x1B,0x1B,0x1B,0x1B,0x1B,0x1B,0x1B,0x1B,0x1B,0x1B,0x1B,0x1B,0x1B,0x1B,0x1B,0x1B,0x1B,0x1B,0x1B,0x1B,0x1B,0x1B,0x1B,0x1B, - 0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C, - 0x1D,0x1D,0x1D,0x1D,0x1D,0x1D,0x1D,0x1D,0x1D,0x1D,0x1D,0x1D,0x1D,0x1D,0x1D,0x1D,0x1D,0x1D,0x1D,0x1D,0x1D,0x1D,0x1D,0x1D,0x1D,0x1D,0x1D,0x1D,0x1D,0x1D, - 0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,0x1E, - 0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, - 0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, - 0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03, - 0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04, - 0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x05, - 0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06, - 0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07, - 0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08, - 0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09, - 0x0A,0x0A,0x0A,0x0A,0x0A,0x0A,0x0A,0x0A,0x0A,0x0A,0x0A,0x0A,0x0A,0x0A,0x0A,0x0A,0x0A,0x0A,0x0A,0x0A,0x0A,0x0A,0x0A,0x0A,0x0A,0x0A,0x0A,0x0A,0x0A,0x0A, - 0x0B,0x0B,0x0B,0x0B,0x0B,0x0B,0x0B,0x0B,0x0B,0x0B,0x0B,0x0B,0x0B,0x0B,0x0B,0x0B,0x0B,0x0B,0x0B,0x0B,0x0B,0x0B,0x0B,0x0B,0x0B,0x0B,0x0B,0x0B,0x0B,0x0B, - 0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C, - 0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D, - 0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E, - 0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F, - 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, - 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, - 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, - 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, - 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, - 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, - 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, - 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, - 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, - 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, - 0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A, - 0x1B,0x1B,0x1B,0x1B,0x1B,0x1B,0x1B,0x1B,0x1B,0x1B,0x1B,0x1B,0x1B,0x1B,0x1B,0x1B,0x1B,0x1B,0x1B,0x1B,0x1B,0x1B,0x1B,0x1B,0x1B,0x1B,0x1B,0x1B,0x1B,0x1B, - 0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C, - 0x1D,0x1D,0x1D,0x1D,0x1D,0x1D,0x1D,0x1D,0x1D,0x1D,0x1D,0x1D,0x1D,0x1D,0x1D,0x1D,0x1D,0x1D,0x1D,0x1D,0x1D,0x1D,0x1D,0x1D,0x1D,0x1D,0x1D,0x1D,0x1D,0x1D, - 0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,0x1E, - 0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 -}; - -static const unsigned char tilemapL1[] = { - 0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x02,0x02,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x02,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x03,0x03,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x03,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x04,0x04,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x04,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x05,0x05,0x05,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x05,0x05,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x02,0x02,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x02,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x03,0x03,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x03,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x04,0x04,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x04,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x05,0x05,0x05,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x05,0x05,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x02,0x02,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x02,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x03,0x03,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x03,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x04,0x04,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x04,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x05,0x05,0x05,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x05,0x05,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x02,0x02,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x02,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x03,0x03,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x03,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x04,0x04,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x04,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x05,0x05,0x05,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x05,0x05,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x02,0x02,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x02,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x03,0x03,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x03,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x04,0x04,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x04,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x05,0x05,0x05,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x05,0x05,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x02,0x02,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x02,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x03,0x03,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x03,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x04,0x04,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x04,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x05,0x05,0x05,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x05,0x05,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x02,0x02,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x02,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x03,0x03,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x03,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x04,0x04,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x04,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x05,0x05,0x05,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x05,0x05,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x02,0x02,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x02,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x03,0x03,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x03,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x04,0x04,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x04,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x05,0x05,0x05,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x05,0x05,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 -}; - - - -// Hight of the tile map (size of 1 row above) -#define TILEMAP_H 30 - -// Only uses rows 3-11 from the TILEMAP_H above for the horizintal scroll -#define HSCR_BEG 3 -#define HSCR_END 11 - -static int fb_width, fb_height; - -static unsigned char * tilemapL0Pt; -static unsigned char * tilemapL1Pt; -static int tilemapL0Width; -static int tilemapL1Width; -static int hscrL0 = 0; -static int hscrL1 = 0; -static int hscrincL0 = 1; -static int hscrincL1 = 2; -static uint8_t spr_angle[SPRITES_MAX]; - - - -int main(void) { - stdio_init_all(); - - vga.begin(VGA_MODE_320x240); - //puts("Color bars ready, press SPACE to invert..."); - vga.clear(VGA_RGB(0xff,0x00,0x00)); - vga.get_frame_buffer_size(&fb_width, &fb_height); - // Initialize game engine - // 2 tiles layers (TILES_MAX_LAYERS) - // 32 sprites (SPRITES_MAX) - // 64 tiles + 64 sprites definitions - // Defaults or change VGA_t4.h: - // 20x15 tiles of 16x16 pixels in 256 colors - // 16x32 pixels sprites in 256 colors - vga.begin_gfxengine(2, 64, 64); - - // Init tilemaps for entire screen - tilemapL0Pt= (unsigned char *)&tilemapL0[0]; - tilemapL1Pt= (unsigned char *)&tilemapL1[0]; - for (int c=0; c< TILES_COLS; c++) { - vga.tile_draw_col(0, c,0,tilemapL0Pt,TILEMAP_H); - vga.tile_draw_col(1, c,0,tilemapL1Pt,TILEMAP_H); - tilemapL0Pt += TILEMAP_H; - tilemapL1Pt += TILEMAP_H; - } - tilemapL0Width = ((sizeof(tilemapL0)/TILEMAP_H)-TILES_COLS+1)*TILES_W; - tilemapL1Width = ((sizeof(tilemapL1)/TILEMAP_H)-TILES_COLS+1)*TILES_W; - - // Init horizontal scrolling area, mask last col (in pixels) at right to hide updates - vga.set_hscroll(0, HSCR_BEG,HSCR_END,TILES_W); - vga.set_hscroll(1, HSCR_BEG,HSCR_END,TILES_W); - - // Init sprite animation - for (int i=0; i> TILES_HBITS) % TILES_COLS; - if (hscrincL0>0) { - vga.tile_draw_col(0, (updcolL0+(TILES_COLS-1))%TILES_COLS,HSCR_BEG,tilemapL0Pt+HSCR_BEG,HSCR_END-HSCR_BEG+1); - tilemapL0Pt += TILEMAP_H; - if (hscrL0 >= tilemapL0Width) { - hscrincL0 = -hscrincL0; - vga.tile_draw_col(0, (updcolL0+(TILES_COLS-1))%TILES_COLS,HSCR_BEG,tilemapL0Pt-(TILES_COLS+1)*TILEMAP_H+HSCR_BEG,HSCR_END-HSCR_BEG+1); - } - } - else if (hscrincL0<0) { - updcolL0 -= 1; // row before !!! - if (updcolL0<0 ) updcolL0 += TILES_COLS; - if (( tilemapL0Pt-(TILES_COLS+2)*TILEMAP_H) >= tilemapL0) - vga.tile_draw_col(0, updcolL0,HSCR_BEG,tilemapL0Pt-(TILES_COLS+2)*TILEMAP_H+HSCR_BEG,HSCR_END-HSCR_BEG+1); - tilemapL0Pt -= TILEMAP_H; - if (hscrL0 <=0) { - hscrincL0 = -hscrincL0; - vga.tile_draw_col(0, updcolL0,HSCR_BEG,tilemapL0Pt-TILEMAP_H+HSCR_BEG,HSCR_END-HSCR_BEG+1); - } - } - } - vga.hscroll(0,hscrL0); - - hscrL1 = hscrL1 + hscrincL1; - if ( (hscrL1 & TILES_HMASK) == 0x0) { - int updcolL1 = (hscrL1 >> TILES_HBITS) % TILES_COLS; - if (hscrincL1 > 0) { - vga.tile_draw_col(1, (updcolL1+(TILES_COLS-1))%TILES_COLS,HSCR_BEG,tilemapL1Pt+HSCR_BEG,HSCR_END-HSCR_BEG+1); - tilemapL1Pt += TILEMAP_H; - if (hscrL1 >= tilemapL1Width) { - hscrincL1 = -hscrincL1; - vga.tile_draw_col(1, (updcolL1+(TILES_COLS-1))%TILES_COLS,HSCR_BEG,tilemapL1Pt-(TILES_COLS+1)*TILEMAP_H+HSCR_BEG,HSCR_END-HSCR_BEG+1); - } - } - else if (hscrincL1 < 0) { - updcolL1 -= 1; // row before !!! - if (updcolL1<0 ) updcolL1 += TILES_COLS; - if (( tilemapL1Pt-(TILES_COLS+2)*TILEMAP_H) >= tilemapL1) - vga.tile_draw_col(1, updcolL1,HSCR_BEG,tilemapL1Pt-(TILES_COLS+2)*TILEMAP_H+HSCR_BEG,HSCR_END-HSCR_BEG+1); - tilemapL1Pt -= TILEMAP_H; - if (hscrL1 <=0) { - hscrincL1 = -hscrincL1; - vga.tile_draw_col(1, updcolL1,HSCR_BEG,tilemapL1Pt-TILEMAP_H+HSCR_BEG,HSCR_END-HSCR_BEG+1); - } - } - } - vga.hscroll(1,hscrL1); - - - for (int i=1; i>8], 100+120*calcsi[(spr_angle[i]*360)>>8], i); - } - vga.sprite(0, 100, 100, 0); - - vga.run_gfxengine(); - - int c = getchar_timeout_us(0); - switch (c) { - case ' ': - printf("Inverted: %d\n", 1); - break; - } - } -} - - - - diff --git a/MCUME_pico/pico20/AudioPlaySystem.cpp b/MCUME_pico/pico20/AudioPlaySystem.cpp deleted file mode 100644 index 639ad5f..0000000 --- a/MCUME_pico/pico20/AudioPlaySystem.cpp +++ /dev/null @@ -1,176 +0,0 @@ -#include "emuapi.h" - -#ifdef HAS_SND - -#include "AudioPlaySystem.h" - -#define SAMPLERATE AUDIO_SAMPLE_RATE_EXACT -#define CLOCKFREQ 985248 - -#ifndef CUSTOM_SND -static const short square[]={ -32767,32767,32767,32767, -32767,32767,32767,32767, -32767,32767,32767,32767, -32767,32767,32767,32767, -32767,32767,32767,32767, -32767,32767,32767,32767, -32767,32767,32767,32767, -32767,32767,32767,32767, --32767,-32767,-32767,-32767, --32767,-32767,-32767,-32767, --32767,-32767,-32767,-32767, --32767,-32767,-32767,-32767, --32767,-32767,-32767,-32767, --32767,-32767,-32767,-32767, --32767,-32767,-32767,-32767, --32767,-32767,-32767,-32767, -}; - -const short noise[] { --32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767, --32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,32767,-32767, --32767,-32767,32767,-32767,-32767,-32767,32767,-32767,-32767,-32767,32767,-32767,-32767,-32767,32767,-32767, --32767,-32767,32767,-32767,-32767,-32767,32767,-32767,-32767,-32767,32767,-32767,-32767,32767,32767,-32767, --32767,-32767,32767,-32767,-32767,32767,32767,-32767,-32767,-32767,32767,-32767,-32767,32767,32767,-32767, --32767,-32767,32767,-32767,-32767,32767,32767,-32767,-32767,-32767,32767,-32767,32767,32767,32767,-32767, -32767,-32767,32767,-32767,-32767,32767,32767,-32767,-32767,-32767,32767,-32767,32767,32767,32767,-32767, -32767,-32767,32767,-32767,-32767,32767,32767,-32767,-32767,-32767,32767,32767,32767,32767,32767,-32767, -32767,-32767,32767,-32767,-32767,32767,32767,-32767,-32767,-32767,32767,32767,32767,32767,32767,-32767, -32767,-32767,32767,-32767,-32767,32767,32767,-32767,-32767,-32767,-32767,32767,32767,32767,-32767,-32767, -32767,-32767,-32767,-32767,-32767,32767,-32767,-32767,-32767,-32767,32767,32767,32767,32767,32767,-32767, -32767,-32767,32767,-32767,-32767,32767,32767,-32767,-32767,32767,-32767,32767,32767,32767,-32767,-32767, -32767,32767,-32767,-32767,-32767,32767,-32767,-32767,-32767,-32767,32767,32767,32767,32767,32767,-32767, -32767,-32767,32767,-32767,-32767,32767,32767,-32767,32767,32767,-32767,32767,-32767,32767,-32767,-32767, -32767,32767,-32767,-32767,-32767,32767,-32767,-32767,-32767,-32767,32767,32767,32767,32767,32767,-32767, -32767,-32767,32767,-32767,-32767,32767,32767,32767,32767,32767,-32767,32767,-32767,32767,-32767,-32767, -}; - -#define NOISEBSIZE 0x100 - -typedef struct -{ - unsigned int spos; - unsigned int sinc; - unsigned int vol; -} Channel; - -static Channel chan[6] = { - {0,0,0}, - {0,0,0}, - {0,0,0}, - {0,0,0}, - {0,0,0}, - {0,0,0} }; - -#endif - -volatile bool playing = false; - - -static void snd_Reset(void) -{ -#ifndef CUSTOM_SND - chan[0].vol = 0; - chan[1].vol = 0; - chan[2].vol = 0; - chan[3].vol = 0; - chan[4].vol = 0; - chan[5].vol = 0; - chan[0].sinc = 0; - chan[1].sinc = 0; - chan[2].sinc = 0; - chan[3].sinc = 0; - chan[4].sinc = 0; - chan[5].sinc = 0; -#endif -} - - -#ifdef CUSTOM_SND -//extern "C" { -void SND_Process(void *sndbuffer, int sndn); -//} -#endif - -#include -void AudioPlaySystem::snd_Mixer(short * stream, int len ) -{ - if (playing) - { -#ifdef CUSTOM_SND - //printf("s\n"); - SND_Process((void*)stream, len); -#else - int i; - long s; - len = len >> 1; - short v0=chan[0].vol; - short v1=chan[1].vol; - short v2=chan[2].vol; - short v3=chan[3].vol; - short v4=chan[4].vol; - short v5=chan[5].vol; - for (i=0;i>8)&0x3f])>>11); - s+=((v1*square[(chan[1].spos>>8)&0x3f])>>11); - s+=((v2*square[(chan[2].spos>>8)&0x3f])>>11); - s+=((v3*noise[(chan[3].spos>>8)&(NOISEBSIZE-1)])>>11); - s+=((v4*noise[(chan[4].spos>>8)&(NOISEBSIZE-1)])>>11); - s+=((v5*noise[(chan[5].spos>>8)&(NOISEBSIZE-1)])>>11); - *stream++ = (short)(s); - *stream++ = (short)(s); - chan[0].spos += chan[0].sinc; - chan[1].spos += chan[1].sinc; - chan[2].spos += chan[2].sinc; - chan[3].spos += chan[3].sinc; - chan[4].spos += chan[4].sinc; - chan[5].spos += chan[5].sinc; - } -#endif - } -} - -void AudioPlaySystem::begin(void) -{ - this->reset(); -} - -void AudioPlaySystem::start(void) -{ - playing = true; -} - -void AudioPlaySystem::setSampleParameters(float clockfreq, float samplerate) { -} - -void AudioPlaySystem::reset(void) -{ - snd_Reset(); -} - -void AudioPlaySystem::stop(void) -{ - playing = false; -} - -bool AudioPlaySystem::isPlaying(void) -{ - return playing; -} - - - -void AudioPlaySystem::sound(int C, int F, int V) { -#ifndef CUSTOM_SND - if (C < 6) { - chan[C].vol = V; - chan[C].sinc = F>>1; - } -#endif -} - -void AudioPlaySystem::step(void) { -} -#endif diff --git a/MCUME_pico/pico20/MOS6561.cpp b/MCUME_pico/pico20/MOS6561.cpp index 6f7d7a7..54941a4 100644 --- a/MCUME_pico/pico20/MOS6561.cpp +++ b/MCUME_pico/pico20/MOS6561.cpp @@ -5,19 +5,12 @@ extern "C" { #include "platform_config.h" } -#ifdef USE_VGA -#include "vga_t_dma.h" -typedef uint8_t Pixel; -#else -#include "tft_t_dma.h" +#include "pico_dsp.h" typedef uint16_t Pixel; -#endif #define WIN_W TFT_WIDTH #define WIN_H TFT_HEIGHT -//#include - // definitions for easy access to registers #define REG_COLPAGE_BASE (0x9400) // 0x9400+0x200 = 0x9600 unexpanded @@ -70,6 +63,8 @@ static uint16_t remap[16] = { 0x1c00 }; +static Pixel linebuf[WIN_W]; + MOS6561::MOS6561() : IC(), curRow(0), frameReady(true) { // Set clock speed this->setClockSpeed(1108000); @@ -102,10 +97,11 @@ void MOS6561::initialize() { void MOS6561::renderBorder(uint16_t raster){ if (raster < WIN_H) { Pixel bcol = vicPalette[REG_BORDER_COLOUR]; - Pixel * dst = (Pixel *)emu_LineBuffer(raster); + Pixel * dst = &linebuf[0]; for (int x=0; x < WIN_W; x++) { *dst++ = bcol; - } + } + emu_DrawLine16(&linebuf[0], WIN_W, WIN_H, raster); } } @@ -137,7 +133,7 @@ void MOS6561::renderLine(uint16_t raster, uint16_t row, uint8_t rowHeight, uint8 cols[bakcol] = vicPalette[REG_BACKGROUND_COLOUR]; // Border Left - Pixel * dst = (Pixel *)emu_LineBuffer(raster); + Pixel * dst = &linebuf[0]; for (int x=0; x < bWidth; x++) { *dst++ = cols[borcol]; } @@ -179,7 +175,8 @@ void MOS6561::renderLine(uint16_t raster, uint16_t row, uint8_t rowHeight, uint8 // Border Right for (int x=0; x < bWidth; x++) { *dst++ = cols[borcol]; - } + } + emu_DrawLine16(&linebuf[0], WIN_W, 1, raster); } } @@ -214,7 +211,7 @@ void MOS6561::renderRow(uint16_t raster, uint16_t row, uint8_t rowHeight) for (int line=0; line < rowHeight; line++) { // Border Left - Pixel * dst = (Pixel *)emu_LineBuffer(curRow*rowHeight+line+raster); + Pixel * dst = &linebuf[0]; for (int x=0; x < bWidth; x++) { *dst++ = cols[borcol]; } @@ -230,25 +227,25 @@ void MOS6561::renderRow(uint16_t raster, uint16_t row, uint8_t rowHeight) uint8_t multiColour = colPointer[x] & 0x8; cols[forcol] = vicPalette[colour]; if (!multiColour) { - Pixel * dest = dst; - for (int a = 0; a < 8; a++) { - if ((characterByte << a) & 0x80) { - *dest++ = cols[forcol]; - } - else { - *dest++ = cols[bakcol]; - } - } + Pixel * dest = dst; + for (int a = 0; a < 8; a++) { + if ((characterByte << a) & 0x80) { + *dest++ = cols[forcol]; + } + else { + *dest++ = cols[bakcol]; + } + } } else { - Pixel * dest = dst; - cols[auxcol] = vicPalette[REG_AUXILIARY_COLOUR]; - for (int a = 0; a < 8; a += 2) { - // Set colour - Pixel col = cols[((characterByte << a) & 0xC0) >> 6]; - *dest++ = col; - *dest++ = col; - } + Pixel * dest = dst; + cols[auxcol] = vicPalette[REG_AUXILIARY_COLOUR]; + for (int a = 0; a < 8; a += 2) { + // Set colour + Pixel col = cols[((characterByte << a) & 0xC0) >> 6]; + *dest++ = col; + *dest++ = col; + } } dst +=8; } @@ -256,7 +253,8 @@ void MOS6561::renderRow(uint16_t raster, uint16_t row, uint8_t rowHeight) // Border Right for (int x=0; x < bWidth; x++) { *dst++ = cols[borcol]; - } + } + emu_DrawLine16(&linebuf[0], WIN_W, 1, curRow*rowHeight+line+raster); } } } diff --git a/MCUME_pico/pico20/emuapi.cpp b/MCUME_pico/pico20/emuapi.cpp deleted file mode 100644 index 1bc929b..0000000 --- a/MCUME_pico/pico20/emuapi.cpp +++ /dev/null @@ -1,1311 +0,0 @@ -#define KEYMAP_PRESENT 1 - -#define PROGMEM - -#include "pico.h" -#include "pico/stdlib.h" -#include "hardware/adc.h" -#include -#include - -extern "C" { - #include "emuapi.h" - #include "iopins.h" -} - -static bool emu_writeConfig(void); -static bool emu_readConfig(void); -static bool emu_eraseConfig(void); - - -#if (defined(ILI9341) || defined(ST7789)) && defined(USE_VGA) -// Dual display config, initialize TFT -#include "tft_t_dma.h" -static TFT_T_DMA tft; -#else -// Non Dual display config -#ifdef USE_VGA -#include "vga_t_dma.h" -#else -#include "tft_t_dma.h" -#endif -extern TFT_T_DMA tft; -#endif - - -#define MAX_FILENAME_PATH 64 -#define NB_FILE_HANDLER 4 -#define AUTORUN_FILENAME "autorun.txt" - -#define MAX_FILES 64 -#define MAX_FILENAME_SIZE 24 -#define MAX_MENULINES 9 -#define TEXT_HEIGHT 16 -#define TEXT_WIDTH 8 -#define MENU_FILE_XOFFSET (6*TEXT_WIDTH) -#define MENU_FILE_YOFFSET (2*TEXT_HEIGHT) -#define MENU_FILE_W (MAX_FILENAME_SIZE*TEXT_WIDTH) -#define MENU_FILE_H (MAX_MENULINES*TEXT_HEIGHT) -#define MENU_FILE_BGCOLOR RGBVAL16(0x00,0x00,0x40) -#define MENU_JOYS_YOFFSET (12*TEXT_HEIGHT) -#define MENU_VBAR_XOFFSET (0*TEXT_WIDTH) -#define MENU_VBAR_YOFFSET (MENU_FILE_YOFFSET) - -#define MENU_TFT_XOFFSET (MENU_FILE_XOFFSET+MENU_FILE_W+8) -#define MENU_TFT_YOFFSET (MENU_VBAR_YOFFSET+32) -#define MENU_VGA_XOFFSET (MENU_FILE_XOFFSET+MENU_FILE_W+8) -#define MENU_VGA_YOFFSET (MENU_VBAR_YOFFSET+MENU_FILE_H-32-37) - - - -static int nbFiles=0; -static int curFile=0; -static int topFile=0; -static char selection[MAX_FILENAME_PATH]=""; -static char selected_filename[MAX_FILENAME_SIZE]=""; -static char files[MAX_FILES][MAX_FILENAME_SIZE]; -static bool menuRedraw=true; - -#ifdef PICOMPUTER -static const unsigned short * keys; -static unsigned char keymatrix[6]; -static int keymatrix_hitrow=-1; -static bool key_fn=false; -static bool key_alt=false; -static uint32_t keypress_t_ms=0; -static uint32_t last_t_ms=0; -static uint32_t hundred_ms_cnt=0; -static bool ledflash_toggle=false; -#endif -static int keyMap; - -static bool joySwapped = false; -static uint16_t bLastState; -static int xRef; -static int yRef; -static uint8_t usbnavpad=0; - -static bool menuOn=true; -static bool autorun=false; - - -/******************************** - * Generic output and malloc -********************************/ -void emu_printf(const char * text) -{ - printf("%s\n",text); -} - -void emu_printf(int val) -{ - printf("%d\n",val); -} - -void emu_printi(int val) -{ - printf("%d\n",val); -} - -void emu_printh(int val) -{ - printf("0x%.8\n",val); -} - -static int malbufpt = 0; -static char malbuf[EXTRA_HEAP]; - -void * emu_Malloc(int size) -{ - void * retval = malloc(size); - if (!retval) { - emu_printf("failled to allocate"); - emu_printf(size); - emu_printf("fallback"); - if ( (malbufpt+size) < sizeof(malbuf) ) { - retval = (void *)&malbuf[malbufpt]; - malbufpt += size; - } - else { - emu_printf("failure to allocate"); - } - } - else { - emu_printf("could allocate dynamic "); - emu_printf(size); - } - - return retval; -} - -void * emu_MallocI(int size) -{ - void * retval = NULL; - - if ( (malbufpt+size) < sizeof(malbuf) ) { - retval = (void *)&malbuf[malbufpt]; - malbufpt += size; - emu_printf("could allocate static "); - emu_printf(size); - } - else { - emu_printf("failure to allocate"); - } - - return retval; -} -void emu_Free(void * pt) -{ - free(pt); -} - -void emu_drawText(unsigned short x, unsigned short y, const char * text, unsigned short fgcolor, unsigned short bgcolor, int doublesize) -{ - tft.drawText(x, y, text, fgcolor, bgcolor, doublesize?true:false); -} - - -/******************************** - * OSKB handling -********************************/ -#if (defined(ILI9341) || defined(ST7789)) && defined(USE_VGA) -// On screen keyboard position -#define KXOFF 28 //64 -#define KYOFF 96 -#define KWIDTH 11 //22 -#define KHEIGHT 3 - -static bool oskbOn = false; -static int cxpos = 0; -static int cypos = 0; -static int oskbMap = 0; -static uint16_t oskbBLastState = 0; - -static void lineOSKB2(int kxoff, int kyoff, char * str, int row) -{ - char c[2] = {'A',0}; - const char * cpt = str; - for (int i=0; i.,SP ", 2); - if (oskbMap == 0) { - lineOSKB(KXOFF,KYOFF, keylables_map1_0, 0); - lineOSKB(KXOFF,KYOFF, keylables_map1_1, 1); - lineOSKB(KXOFF,KYOFF, keylables_map1_2, 2); - } - else if (oskbMap == 1) { - lineOSKB(KXOFF,KYOFF, keylables_map2_0, 0); - lineOSKB(KXOFF,KYOFF, keylables_map2_1, 1); - lineOSKB(KXOFF,KYOFF, keylables_map2_2, 2); - } - else { - lineOSKB(KXOFF,KYOFF, keylables_map3_0, 0); - lineOSKB(KXOFF,KYOFF, keylables_map3_1, 1); - lineOSKB(KXOFF,KYOFF, keylables_map3_2, 2); - } -} - -void toggleOskb(bool forceoff) { - if (forceoff) oskbOn=true; - if (oskbOn) { - oskbOn = false; - tft.fillScreenNoDma(RGBVAL16(0x00,0x00,0x00)); - tft.drawTextNoDma(0,32, "Press USER2 to toggle onscreen keyboard.", RGBVAL16(0xff,0xff,0xff), RGBVAL16(0x00,0x00,0x00), true); - } else { - oskbOn = true; - tft.fillScreenNoDma(RGBVAL16(0x00,0x00,0x00)); - tft.drawTextNoDma(0,32, " Press USER2 to exit onscreen keyboard. ", RGBVAL16(0xff,0xff,0xff), RGBVAL16(0x00,0x00,0x00), true); - tft.drawTextNoDma(0,64, " (USER1 to toggle between keymaps) ", RGBVAL16(0x00,0xff,0xff), RGBVAL16(0x00,0x00,0xff), true); - tft.drawRectNoDma(KXOFF,KYOFF, 22*8, 3*16, RGBVAL16(0x00,0x00,0xFF)); - drawOskb(); - } -} - -static int handleOskb(void) -{ - int retval = 0; - - uint16_t bClick = bLastState & ~oskbBLastState; - oskbBLastState = bLastState; - /* - static const char * digits = "0123456789ABCDEF"; - char buf[5] = {0,0,0,0,0}; - int val = bClick; - buf[0] = digits[(val>>12)&0xf]; - buf[1] = digits[(val>>8)&0xf]; - buf[2] = digits[(val>>4)&0xf]; - buf[3] = digits[val&0xf]; - tft.drawTextNoDma(0,KYOFF+ 64,buf,RGBVAL16(0x00,0x00,0x00),RGBVAL16(0xFF,0xFF,0xFF),1); - */ - if (bClick & MASK_KEY_USER2) - { - toggleOskb(false); - } - if (oskbOn) - { - bool updated = true; - if (bClick & MASK_KEY_USER1) - { - oskbMap += 1; - if (oskbMap == 3) oskbMap = 0; - } - else if (bClick & MASK_JOY2_LEFT) - { - cxpos++; - if (cxpos >= KWIDTH) cxpos = 0; - } - else if (bClick & MASK_JOY2_RIGHT) - { - cxpos--; - if (cxpos < 0) cxpos = KWIDTH-1; - } - else if (bClick & MASK_JOY2_DOWN) - { - cypos++; - if (cypos >= KHEIGHT) cypos = 0; - } - else if (bClick & MASK_JOY2_UP) - { - cypos--; - if (cypos < 0) cypos = KHEIGHT-1; - } - else if (oskbBLastState & MASK_JOY2_BTN) - { - retval = cypos*KWIDTH+cxpos+1; - if (retval) { - retval--; - //if (retval & 1) retval = key_map2[retval>>1]; - //else retval = key_map1[retval>>1]; - if (oskbMap == 0) { - retval = key_map1[retval]; - } - else if (oskbMap == 1) { - retval = key_map2[retval]; - } - else { - retval = key_map3[retval]; - } - //if (retval) { toggleOskb(true); updated=false; }; - } - } - else { - updated=false; - } - if (updated) drawOskb(); - } - - return retval; -} -#endif - -/******************************** - * Input and keyboard -********************************/ -int emu_ReadAnalogJoyX(int min, int max) -{ - adc_select_input(0); - int val = adc_read(); -#if INVX - val = 4095 - val; -#endif - val = val-xRef; - val = ((val*140)/100); - if ( (val > -512) && (val < 512) ) val = 0; - val = val+2048; - return (val*(max-min))/4096; -} - -int emu_ReadAnalogJoyY(int min, int max) -{ - adc_select_input(1); - int val = adc_read(); -#if INVY - val = 4095 - val; -#endif - val = val-yRef; - val = ((val*120)/100); - if ( (val > -512) && (val < 512) ) val = 0; - //val = (val*(max-min))/4096; - val = val+2048; - //return val+(max-min)/2; - return (val*(max-min))/4096; -} - - -static uint16_t readAnalogJoystick(void) -{ - uint16_t joysval = 0; -#ifdef PIN_JOY2_A1X - int xReading = emu_ReadAnalogJoyX(0,256); - if (xReading > 128) joysval |= MASK_JOY2_LEFT; - else if (xReading < 128) joysval |= MASK_JOY2_RIGHT; - - int yReading = emu_ReadAnalogJoyY(0,256); - if (yReading < 128) joysval |= MASK_JOY2_UP; - else if (yReading > 128) joysval |= MASK_JOY2_DOWN; -#endif - // First joystick -#if INVY -#ifdef PIN_JOY2_1 - if ( !gpio_get(PIN_JOY2_1) ) joysval |= MASK_JOY2_DOWN; -#endif -#ifdef PIN_JOY2_2 - if ( !gpio_get(PIN_JOY2_2) ) joysval |= MASK_JOY2_UP; -#endif -#else -#ifdef PIN_JOY2_1 - if ( !gpio_get(PIN_JOY2_1) ) joysval |= MASK_JOY2_UP; -#endif -#ifdef PIN_JOY2_2 - if ( !gpio_get(PIN_JOY2_2) ) joysval |= MASK_JOY2_DOWN; -#endif -#endif -#if INVX -#ifdef PIN_JOY2_3 - if ( !gpio_get(PIN_JOY2_3) ) joysval |= MASK_JOY2_LEFT; -#endif -#ifdef PIN_JOY2_4 - if ( !gpio_get(PIN_JOY2_4) ) joysval |= MASK_JOY2_RIGHT; -#endif -#else -#ifdef PIN_JOY2_3 - if ( !gpio_get(PIN_JOY2_3) ) joysval |= MASK_JOY2_RIGHT; -#endif -#ifdef PIN_JOY2_4 - if ( !gpio_get(PIN_JOY2_4) ) joysval |= MASK_JOY2_LEFT; -#endif -#endif -#ifdef PIN_JOY2_BTN - joysval |= (gpio_get(PIN_JOY2_BTN) ? 0 : MASK_JOY2_BTN); -#endif - - return (joysval); -} - - -int emu_SwapJoysticks(int statusOnly) { - if (!statusOnly) { - if (joySwapped) { - joySwapped = false; - } - else { - joySwapped = true; - } - } - return(joySwapped?1:0); -} - -int emu_GetPad(void) -{ - return(bLastState/*|((joySwapped?1:0)<<7)*/); -} - -int emu_ReadKeys(void) -{ - uint16_t retval; - uint16_t j1 = readAnalogJoystick(); - uint16_t j2 = 0; - - // Second joystick -#if INVY -#ifdef PIN_JOY1_1 - if ( !gpio_get(PIN_JOY1_1) ) j2 |= MASK_JOY2_DOWN; -#endif -#ifdef PIN_JOY1_2 - if ( !gpio_get(PIN_JOY1_2) ) j2 |= MASK_JOY2_UP; -#endif -#else -#ifdef PIN_JOY1_1 - if ( !gpio_get(PIN_JOY1_1) ) j2 |= MASK_JOY2_UP; -#endif -#ifdef PIN_JOY1_2 - if ( !gpio_get(PIN_JOY1_2) ) j2 |= MASK_JOY2_DOWN; -#endif -#endif -#if INVX -#ifdef PIN_JOY1_3 - if ( !gpio_get(PIN_JOY1_3) ) j2 |= MASK_JOY2_LEFT; -#endif -#ifdef PIN_JOY1_4 - if ( !gpio_get(PIN_JOY1_4) ) j2 |= MASK_JOY2_RIGHT; -#endif -#else -#ifdef PIN_JOY1_3 - if ( !gpio_get(PIN_JOY1_3) ) j2 |= MASK_JOY2_RIGHT; -#endif -#ifdef PIN_JOY1_4 - if ( !gpio_get(PIN_JOY1_4) ) j2 |= MASK_JOY2_LEFT; -#endif -#endif -#ifdef PIN_JOY1_BTN - if ( !gpio_get(PIN_JOY1_BTN) ) j2 |= MASK_JOY2_BTN; -#endif - - - if (joySwapped) { - retval = ((j1 << 8) | j2); - } - else { - retval = ((j2 << 8) | j1); - } - - if (usbnavpad & MASK_JOY2_UP) retval |= MASK_JOY2_UP; - if (usbnavpad & MASK_JOY2_DOWN) retval |= MASK_JOY2_DOWN; - if (usbnavpad & MASK_JOY2_LEFT) retval |= MASK_JOY2_LEFT; - if (usbnavpad & MASK_JOY2_RIGHT) retval |= MASK_JOY2_RIGHT; - if (usbnavpad & MASK_JOY2_BTN) retval |= MASK_JOY2_BTN; - -#ifdef PIN_KEY_USER1 - if ( !gpio_get(PIN_KEY_USER1) ) retval |= MASK_KEY_USER1; -#endif -#ifdef PIN_KEY_USER2 - if ( !gpio_get(PIN_KEY_USER2) ) retval |= MASK_KEY_USER2; -#endif -#ifdef PIN_KEY_USER3 - if ( !gpio_get(PIN_KEY_USER3) ) retval |= MASK_KEY_USER3; -#endif -#ifdef PIN_KEY_USER4 - if ( !gpio_get(PIN_KEY_USER4) ) retval |= MASK_KEY_USER4; -#endif - -#ifdef PICOMPUTER - keymatrix_hitrow = -1; - unsigned char row; - unsigned short cols[6]={KCOLOUT1,KCOLOUT2,KCOLOUT3,KCOLOUT4,KCOLOUT5,KCOLOUT6}; - unsigned char keymatrixtmp[6]; - - for (int i=0;i<6;i++){ - gpio_set_dir(cols[i], GPIO_OUT); - gpio_put(cols[i], 0); -#ifdef SWAP_ALT_DEL - sleep_us(1); - //__asm volatile ("nop\n"); // 4-8ns -#endif - row=0; - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN4) ? 0 : 0x02); - row |= (gpio_get(KROWIN1) ? 0 : 0x04); - row |= (gpio_get(KROWIN3) ? 0 : 0x08); - row |= (gpio_get(KROWIN5) ? 0 : 0x10); - row |= (gpio_get(KROWIN6) ? 0 : 0x20); - //gpio_set_dir(cols[i], GPIO_OUT); - gpio_put(cols[i], 1); - gpio_set_dir(cols[i], GPIO_IN); - gpio_disable_pulls(cols[i]); - keymatrixtmp[i] = row; - } - -#ifdef MULTI_DEBOUNCE - for (int i=0;i<6;i++){ - gpio_set_dir(cols[i], GPIO_OUT); - gpio_put(cols[i], 0); -#ifdef SWAP_ALT_DEL - sleep_us(1); - //__asm volatile ("nop\n"); // 4-8ns -#endif - row=0; - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN4) ? 0 : 0x02); - row |= (gpio_get(KROWIN1) ? 0 : 0x04); - row |= (gpio_get(KROWIN3) ? 0 : 0x08); - row |= (gpio_get(KROWIN5) ? 0 : 0x10); - row |= (gpio_get(KROWIN6) ? 0 : 0x20); - //gpio_set_dir(cols[i], GPIO_OUT); - gpio_put(cols[i], 1); - gpio_set_dir(cols[i], GPIO_IN); - gpio_disable_pulls(cols[i]); - keymatrixtmp[i] |= row; - } - - for (int i=0;i<6;i++){ - gpio_set_dir(cols[i], GPIO_OUT); - gpio_put(cols[i], 0); -#ifdef SWAP_ALT_DEL - sleep_us(1); - //__asm volatile ("nop\n"); // 4-8ns -#endif - row=0; - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN4) ? 0 : 0x02); - row |= (gpio_get(KROWIN1) ? 0 : 0x04); - row |= (gpio_get(KROWIN3) ? 0 : 0x08); - row |= (gpio_get(KROWIN5) ? 0 : 0x10); - row |= (gpio_get(KROWIN6) ? 0 : 0x20); - //gpio_set_dir(cols[i], GPIO_OUT); - gpio_put(cols[i], 1); - gpio_set_dir(cols[i], GPIO_IN); - gpio_disable_pulls(cols[i]); - keymatrixtmp[i] |= row; - } -#endif - -#ifdef SWAP_ALT_DEL - // Swap ALT and DEL - unsigned char alt = keymatrixtmp[0] & 0x02; - unsigned char del = keymatrixtmp[5] & 0x20; - keymatrixtmp[0] &= ~0x02; - keymatrixtmp[5] &= ~0x20; - if (alt) keymatrixtmp[5] |= 0x20; - if (del) keymatrixtmp[0] |= 0x02; -#endif - - bool alt_pressed=false; - if ( keymatrixtmp[5] & 0x20 ) {alt_pressed=true; keymatrixtmp[5] &= ~0x20;}; - - for (int i=0;i<6;i++){ - row = keymatrixtmp[i]; - if (row) keymatrix_hitrow=i; - keymatrix[i] = row; - } - - //6,9,15,8,7,22 -#if INVX - if ( row & 0x2 ) retval |= MASK_JOY2_LEFT; - if ( row & 0x1 ) retval |= MASK_JOY2_RIGHT; -#else - if ( row & 0x1 ) retval |= MASK_JOY2_LEFT; - if ( row & 0x2 ) retval |= MASK_JOY2_RIGHT; -#endif -#if INVY - if ( row & 0x8 ) retval |= MASK_JOY2_DOWN; - if ( row & 0x4 ) retval |= MASK_JOY2_UP; -#else - if ( row & 0x4 ) retval |= MASK_JOY2_DOWN; - if ( row & 0x8 ) retval |= MASK_JOY2_UP; -#endif - if ( row & 0x10 ) retval |= MASK_JOY2_BTN; - - // Handle LED flash - uint32_t time_ms=to_ms_since_boot (get_absolute_time()); - if ((time_ms-last_t_ms) > 100) { - last_t_ms = time_ms; - if (ledflash_toggle == false) { - ledflash_toggle = true; - } - else { - ledflash_toggle = false; - } - } - - if ( alt_pressed ) { - if (key_fn == false) - { - // Release to Press transition - if (hundred_ms_cnt == 0) { - keypress_t_ms=time_ms; - hundred_ms_cnt += 1; // 1 - } - else { - hundred_ms_cnt += 1; // 2 - if (hundred_ms_cnt >= 2) - { - hundred_ms_cnt = 0; - /* - if ( (time_ms-keypress_t_ms) < 500) - { - if (key_alt == false) - { - key_alt = true; - } - else - { - key_alt = false; - } - } - */ - } - } - } - else { - // Keep press - if (hundred_ms_cnt == 1) { - if ((to_ms_since_boot (get_absolute_time())-keypress_t_ms) > 2000) - { - if (key_alt == false) - { - key_alt = true; - } - else - { - key_alt = false; - } - hundred_ms_cnt = 0; - } - } - } - key_fn = true; - } - else { - key_fn = false; - } - - // Handle LED - if (key_alt == true) { - gpio_put(KLED, (ledflash_toggle?1:0)); - } - else { - if (key_fn == true) { - gpio_put(KLED, 1); - } - else { - gpio_put(KLED, 0); - } - } - - if ( key_fn ) retval |= MASK_KEY_USER2; - if ( ( key_fn ) && (keymatrix[0] == 0x02 )) retval |= MASK_KEY_USER1; -#endif - - //Serial.println(retval,HEX); - - if ( ((retval & (MASK_KEY_USER1+MASK_KEY_USER2)) == (MASK_KEY_USER1+MASK_KEY_USER2)) - || (retval & MASK_KEY_USER4 ) ) - { - } - -#if (defined(ILI9341) || defined(ST7789)) && defined(USE_VGA) - if (oskbOn) { - retval |= MASK_OSKB; - } -#endif - - return (retval); -} - -unsigned short emu_DebounceLocalKeys(void) -{ - uint16_t bCurState = emu_ReadKeys(); - uint16_t bClick = bCurState & ~bLastState; - bLastState = bCurState; - - return (bClick); -} - -int emu_ReadI2CKeyboard(void) { - int retval=0; -#ifdef PICOMPUTER - if (key_alt) { - keys = (const unsigned short *)key_map3; - } - else if (key_fn) { - keys = (const unsigned short *)key_map2; - } - else { - keys = (const unsigned short *)key_map1; - } - if (keymatrix_hitrow >=0 ) { - unsigned short match = ((unsigned short)keymatrix_hitrow<<8) | keymatrix[keymatrix_hitrow]; - for (int i=0; i=0) { - menuRedraw=true; - curFile -= 9; - } else if (curFile!=0) { - menuRedraw=true; - curFile--; - } - } - else if ( (bClick & MASK_JOY2_DOWN) || (bClick & MASK_JOY1_DOWN) ) { - if ((curFile<(nbFiles-1)) && (nbFiles)) { - curFile++; - menuRedraw=true; - } - } - else if ( (bClick & MASK_JOY2_LEFT) || (bClick & MASK_JOY1_LEFT) ) { - if ((curFile<(nbFiles-9)) && (nbFiles)) { - curFile += 9; - menuRedraw=true; - } - else if ((curFile<(nbFiles-1)) && (nbFiles)) { - curFile++; - menuRedraw=true; - } - } - else if ( (bClick & MASK_KEY_USER2) ) { - emu_SwapJoysticks(0); - menuRedraw=true; - } - - if (menuRedraw && nbFiles) { - int fileIndex = 0; - tft.drawRectNoDma(MENU_FILE_XOFFSET,MENU_FILE_YOFFSET, MENU_FILE_W, MENU_FILE_H, MENU_FILE_BGCOLOR); -// if (curFile <= (MAX_MENULINES/2-1)) topFile=0; -// else topFile=curFile-(MAX_MENULINES/2); - if (curFile <= (MAX_MENULINES-1)) topFile=0; - else topFile=curFile-(MAX_MENULINES/2); - - int i=0; - while (i=nbFiles) { - // no more files - break; - } - char * filename = &files[fileIndex][0]; - if (fileIndex >= topFile) { - if ((i+topFile) < nbFiles ) { - if ((i+topFile)==curFile) { - tft.drawTextNoDma(MENU_FILE_XOFFSET,i*TEXT_HEIGHT+MENU_FILE_YOFFSET, filename, RGBVAL16(0xff,0xff,0x00), RGBVAL16(0xff,0x00,0x00), true); - strcpy(selected_filename,filename); - } - else { - tft.drawTextNoDma(MENU_FILE_XOFFSET,i*TEXT_HEIGHT+MENU_FILE_YOFFSET, filename, RGBVAL16(0xff,0xff,0xff), MENU_FILE_BGCOLOR, true); - } - } - i++; - } - fileIndex++; - } - - - tft.drawTextNoDma(48,MENU_JOYS_YOFFSET+8, (emu_SwapJoysticks(1)?(char*)"SWAP=1":(char*)"SWAP=0"), RGBVAL16(0x00,0xff,0xff), RGBVAL16(0x00,0x00,0xff), false); - menuRedraw=false; - } - - return (action); -} - -bool menuActive(void) -{ - return (menuOn); -} - -void toggleMenu(bool on) { - if (on) { - menuOn = true; - backgroundMenu(); - } else { - menuOn = false; - } -} - -char * menuSelection(void) -{ - return (selection); -} - - -/******************************** - * File IO -********************************/ -int emu_FileOpen(const char * filepath, const char * mode) -{ - int retval = 0; - - emu_printf("FileOpen..."); - emu_printf(filepath); - if( !(f_open(&file, filepath, FA_READ)) ) { - retval = 1; - } - else { - emu_printf("FileOpen failed"); - } - return (retval); -} - -int emu_FileRead(void * buf, int size, int handler) -{ - unsigned int retval=0; - f_read (&file, (void*)buf, size, &retval); - return retval; -} - -int emu_FileGetc(int handler) -{ - unsigned char c; - unsigned int retval=0; - if( !(f_read (&file, &c, 1, &retval)) ) - if (retval != 1) { - emu_printf("emu_FileGetc failed"); - } - return (int)c; -} - -void emu_FileClose(int handler) -{ - f_close(&file); -} - -int emu_FileSeek(int handler, int seek, int origin) -{ - f_lseek(&file, seek); - return (seek); -} - -int emu_FileTell(int handler) -{ - return (f_tell(&file)); -} - - -unsigned int emu_FileSize(const char * filepath) -{ - int filesize=0; - emu_printf("FileSize..."); - emu_printf(filepath); - FILINFO entry; - f_stat(filepath, &entry); - filesize = entry.fsize; - return(filesize); -} - -unsigned int emu_LoadFile(const char * filepath, void * buf, int size) -{ - int filesize = 0; - - emu_printf("LoadFile..."); - emu_printf(filepath); - if( !(f_open(&file, filepath, FA_READ)) ) { - filesize = f_size(&file); - emu_printf(filesize); - if (size >= filesize) - { - unsigned int retval=0; - if( (f_read (&file, buf, filesize, &retval)) ) { - emu_printf("File read failed"); - } - } - f_close(&file); - } - - return(filesize); -} - -static FIL outfile; - -static bool emu_writeConfig(void) -{ - bool retval = false; - if( !(f_open(&outfile, ROMSDIR "/" AUTORUN_FILENAME, FA_CREATE_NEW | FA_WRITE)) ) { - unsigned int sizeread=0; - if( (f_write (&outfile, selection, strlen(selection), &sizeread)) ) { - emu_printf("Config write failed"); - } - else { - retval = true; - } - f_close(&outfile); - } - return retval; -} - -static bool emu_readConfig(void) -{ - bool retval = false; - if( !(f_open(&outfile, ROMSDIR "/" AUTORUN_FILENAME, FA_READ)) ) { - unsigned int filesize = f_size(&outfile); - unsigned int sizeread=0; - if( (f_read (&outfile, selection, filesize, &sizeread)) ) { - emu_printf("Config read failed"); - } - else { - if (sizeread == filesize) { - selection[filesize]=0; - retval = true; - } - } - f_close(&outfile); - } - return retval; -} - -static bool emu_eraseConfig(void) -{ - f_unlink (ROMSDIR "/" AUTORUN_FILENAME); -} - - -/******************************** - * Initialization -********************************/ -void emu_init(void) -{ - // Dual display config, initialize TFT -#if (defined(ILI9341) || defined(ST7789)) && defined(USE_VGA) - tft.begin(); -#endif - - sd_init_driver(); - FRESULT fr = f_mount(&fatfs, "0:", 1); - - strcpy(selection,ROMSDIR); - nbFiles = readNbFiles(selection); - - emu_printf("SD initialized, files found: "); - emu_printi(nbFiles); - - emu_InitJoysticks(); -#ifdef SWAP_JOYSTICK - joySwapped = true; -#else - joySwapped = false; -#endif - - int keypressed = emu_ReadKeys(); -#ifdef PICOMPUTER - // Flip screen if UP pressed - if (keypressed & MASK_JOY2_UP) - { -#ifdef PICOMPUTERMAX -#ifndef USE_VGA - tft.flipscreen(true); -#endif -#else - tft.flipscreen(true); -#endif - } - else - { -#ifdef PICOMPUTERMAX -#ifndef USE_VGA - tft.flipscreen(false); -#endif -#else - tft.flipscreen(false); -#endif - } -#endif - - if (keypressed & MASK_JOY2_DOWN) { - tft.fillScreenNoDma( RGBVAL16(0xff,0x00,0x00) ); - tft.drawTextNoDma(64,48, (char*)" AUTURUN file erased", RGBVAL16(0xff,0xff,0x00), RGBVAL16(0xff,0x00,0x00), true); - tft.drawTextNoDma(64,48+24, (char*)"Please reset the board!", RGBVAL16(0xff,0xff,0x00), RGBVAL16(0xff,0x00,0x00), true); - emu_eraseConfig(); - } - else { - if (emu_readConfig()) { - autorun = true; - } - } - toggleMenu(true); -} - - -void emu_start(void) -{ - usbnavpad = 0; - - keyMap = 0; -} diff --git a/MCUME_pico/pico20/emuapi.h b/MCUME_pico/pico20/emuapi.h deleted file mode 100644 index c0313d3..0000000 --- a/MCUME_pico/pico20/emuapi.h +++ /dev/null @@ -1,144 +0,0 @@ -#ifndef EMUAPI_H -#define EMUAPI_H - -#include "platform_config.h" - -#define CUSTOM_SND 1 -//#define TIMER_REND 1 - -#define EXTRA_HEAP 0x10 - -// Title: < > -#define TITLE " V20 Emulator " -#define ROMSDIR "v20" - -#define emu_Init(ROM) {v20_Init(); v20_Start(ROM);} -#define emu_Step(x) { v20_Step(); } -#define emu_Input(x) { v20_Input(x); } - -#define PALETTE_SIZE 256 -#define VID_FRAME_SKIP 0x0 -#define TFT_VBUFFER_YCROP 0 -#define SINGLELINE_RENDERING 1 - -#define ACTION_NONE 0 -#define ACTION_MAXKBDVAL 12 -#define ACTION_EXITKBD 128 -#define ACTION_RUNTFT 129 -#define ACTION_RUNVGA 130 - -#ifdef KEYMAP_PRESENT - -#define keylables_map1_0 (char *)"qwertyuiop\x1a" -#define keylables_map1_1 (char *)" asdfghjkl\x19" -#define keylables_map1_2 (char *)" zxcvbnm.\x10 " -const unsigned short key_map1[] = { - 'Q','W','E','R','T','Y','U','I','O','P',157, - 0,'A','S','D','F','G','H','J','K','L',0x0D, - 0,'Z','X','C','V','B','N','M','.',' ', - 0,0,0,0 - }; - -#define keylables_map2_0 (char *)"1234567890 " -#define keylables_map2_1 (char *)" !@#$%+&*- " -#define keylables_map2_2 (char *)" ()?/\"<>,: " -const unsigned short key_map2[] = { - '1','2','3','4','5','6','7','8','9','0',0, - 31, '!','@','#','$','%','+','&','*','-','\/', - 0, '(',')','?','\/','"','<','>',',',':', - 145,157,29,17 - }; - -#define keylables_map3_0 (char *)"\x11\x12\x13\x14\x15\x16\x17\x18 " -#define keylables_map3_1 (char *)" " -#define keylables_map3_2 (char *)" ;= " -const unsigned short key_map3[] = { - 133,134,135,136,137,138,139,140,0,0,0, // function keys - 0, 0,0,0,0,0,0,0,0,0,0, - 0, 0,0,0,0,0,0,0,';','=', - 0,0,0,0 - }; - -const unsigned short matkeys[] = { - 0x020,0x120,0x220,0x320,0x420,0x408,0x308,0x208,0x108,0x008,0x002, // row 1 - 0x510,0x010,0x110,0x210,0x310,0x410,0x401,0x301,0x201,0x101,0x001, // row 2 - 0x520,0x102,0x202,0x302,0x402,0x404,0x304,0x204,0x104,0x004, // row 3 - 0x508,0x501,0x502,0x504 }; // cursor keys - -#endif - - -#define MASK_JOY2_RIGHT 0x0001 -#define MASK_JOY2_LEFT 0x0002 -#define MASK_JOY2_UP 0x0004 -#define MASK_JOY2_DOWN 0x0008 -#define MASK_JOY2_BTN 0x0010 -#define MASK_KEY_USER1 0x0020 -#define MASK_KEY_USER2 0x0040 -#define MASK_KEY_USER3 0x0080 -#define MASK_JOY1_RIGHT 0x0100 -#define MASK_JOY1_LEFT 0x0200 -#define MASK_JOY1_UP 0x0400 -#define MASK_JOY1_DOWN 0x0800 -#define MASK_JOY1_BTN 0x1000 -#define MASK_KEY_USER4 0x2000 -#define MASK_OSKB 0x8000 - - - -extern void emu_init(void); -extern void emu_start(void); -extern void emu_resetSD(void); - -extern void emu_printf(const char * text); -extern void emu_printi(int val); -extern void * emu_Malloc(int size); -extern void emu_Free(void * pt); - -extern int emu_FileOpen(const char * filepath, const char * mode); -extern int emu_FileRead(void * buf, int size, int handler); -extern int emu_FileGetc(int handler); -extern int emu_FileSeek(int handler, int seek, int origin); -extern int emu_FileTell(int handler); -extern void emu_FileClose(int handler); - -extern unsigned int emu_FileSize(const char * filepath); -extern unsigned int emu_LoadFile(const char * filepath, void * buf, int size); - -extern void emu_SetPaletteEntry(unsigned char r, unsigned char g, unsigned char b, int index); -extern void emu_DrawScreen(unsigned char * VBuf, int width, int height, int stride); -extern void emu_DrawLine(unsigned char * VBuf, int width, int height, int line); -extern void emu_DrawLine8(unsigned char * VBuf, int width, int height, int line); -extern void emu_DrawLine16(unsigned short * VBuf, int width, int height, int line); -extern void emu_DrawVsync(void); -extern int emu_FrameSkip(void); -extern void * emu_LineBuffer(int line); - -extern void emu_InitJoysticks(void); -extern int emu_SwapJoysticks(int statusOnly); -extern unsigned short emu_DebounceLocalKeys(void); -extern int emu_ReadKeys(void); -extern int emu_GetPad(void); -extern int emu_ReadAnalogJoyX(int min, int max); -extern int emu_ReadAnalogJoyY(int min, int max); -extern int emu_ReadI2CKeyboard(void); -extern unsigned char emu_ReadI2CKeyboard2(int row); -extern void emu_KeyboardOnUp(int keymodifer, int key); -extern void emu_KeyboardOnDown(int keymodifer, int key); -extern int emu_oskbActive(void); - -extern void emu_sndPlaySound(int chan, int volume, int freq); -extern void emu_sndPlayBuzz(int size, int val); -extern void emu_sndInit(); -extern void emu_resetus(void); -extern int emu_us(void); - -extern int emu_setKeymap(int index); - -extern void emu_FileTempInit(void); -extern void emu_FileTempRead(int addr, unsigned char * val, int n); -extern void emu_FileTempWrite(int addr, unsigned char val); -extern void emu_printh(int val); - - -#endif diff --git a/MCUME_pico/pico20/emucfg.h b/MCUME_pico/pico20/emucfg.h new file mode 100644 index 0000000..61c897d --- /dev/null +++ b/MCUME_pico/pico20/emucfg.h @@ -0,0 +1,94 @@ +#ifndef EMUCFG_H +#define EMUCFG_H + +#define PALETTE_SIZE 256 +#define VID_FRAME_SKIP 0x0 +#define TFT_VBUFFER_YCROP 0 +#define SINGLELINE_RENDERING 1 +#define CUSTOM_SND 1 +//#define TIMER_REND 1 +#define EXTRA_HEAP 0x10 +#define FILEBROWSER + +// Title: < > +#define TITLE " V20 Emulator " +#define ROMSDIR "v20" + +#define emu_Init(ROM) {v20_Init(); v20_Start(ROM);} +#define emu_Step(x) { v20_Step(); } +#define emu_Input(x) { v20_Input(x); } + +#ifdef KEYMAP_PRESENT + +#ifdef PICOZX +const unsigned short key_map1[] = { + '1','2','3','4','5','6','7','8','9','0', + 'Q','W','E','R','T','Y','U','I','O','P', + 'A','S','D','F','G','H','J','K','L',0x0D, + 0,'Z','X','C','V','B','N','M',0,' ', + 145,157,29,17,157,29 //U L R D L R + }; + +const unsigned short key_map2[] = { + '!','@','#','$','%','&','\'','(',')','_', + 0,0,0,'<','>',0,0,0,';','"', + 0,0,0,0,0,'^','-','+','=',0x0D, + 0,':',0,'?','\/','*',',','.',0,' ', + 0,0,0,0,0,0 + }; + +const unsigned short key_map3[] = { + 133,134,135,136,137,138,139,140,0,0, // function keys + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0 + }; + +const unsigned short matkeys[] = { + 0x104,0x101,0x108,0x102,0x110,0x120,0x140,0x204,0x201,0x208, // row 1 + 0x202,0x210,0x220,0x240,0x304,0x301,0x308,0x302,0x310,0x320, // row 2 + 0x340,0x404,0x401,0x408,0x402,0x410,0x420,0x440,0x504,0x501, // row 3 + 0x020,0x508,0x502,0x510,0x520,0x540,0x604,0x601,0x040,0x608, // row 4 + 0x008,0x001,0x002,0x010,0x620,0x640 }; // cursor keys up, left, right, down, <<<, >>> + +#else +#define keylables_map1_0 (char *)"qwertyuiop\x1a" +#define keylables_map1_1 (char *)" asdfghjkl\x19" +#define keylables_map1_2 (char *)" zxcvbnm.\x10 " +const unsigned short key_map1[] = { + 'Q','W','E','R','T','Y','U','I','O','P',157, + 0,'A','S','D','F','G','H','J','K','L',0x0D, + 0,'Z','X','C','V','B','N','M','.',' ', + 145,157,29,17 //U L R D + }; + +#define keylables_map2_0 (char *)"1234567890 " +#define keylables_map2_1 (char *)" !@#$%+&*- " +#define keylables_map2_2 (char *)" ()?/\"<>,: " +const unsigned short key_map2[] = { + '1','2','3','4','5','6','7','8','9','0',0, + 0, '!','@','#','$','%','+','&','*','-','\/', + 0, '(',')','?','\/','"','<','>',',',':', + 0,0,0,0 + }; + +#define keylables_map3_0 (char *)"\x11\x12\x13\x14\x15\x16\x17\x18 " +#define keylables_map3_1 (char *)" " +#define keylables_map3_2 (char *)" ;= " +const unsigned short key_map3[] = { + 133,134,135,136,137,138,139,140,0,0,0, // function keys + 0, 0,0,0,0,0,0,0,0,0,0, + 0, 0,0,0,0,0,0,0,';','=', + 0,0,0,0 + }; + +const unsigned short matkeys[] = { + 0x020,0x120,0x220,0x320,0x420,0x408,0x308,0x208,0x108,0x008,0x002, // row 1 + 0x510,0x010,0x110,0x210,0x310,0x410,0x401,0x301,0x201,0x101,0x001, // row 2 + 0x520,0x102,0x202,0x302,0x402,0x404,0x304,0x204,0x104,0x004, // row 3 + 0x508,0x501,0x502,0x504 }; // cursor keys +#endif +#endif + +#endif diff --git a/MCUME_pico/pico20/pico20.cpp b/MCUME_pico/pico20/pico20.cpp index 74f3792..9cdb8c1 100644 --- a/MCUME_pico/pico20/pico20.cpp +++ b/MCUME_pico/pico20/pico20.cpp @@ -7,14 +7,9 @@ extern "C" { } #include "keyboard_osd.h" #include "v20.h" - #include +#include "pico_dsp.h" -#ifdef USE_VGA -#include "vga_t_dma.h" -#else -#include "tft_t_dma.h" -#endif volatile bool vbl=true; bool repeating_timer_callback(struct repeating_timer *t) { @@ -27,8 +22,8 @@ bool repeating_timer_callback(struct repeating_timer *t) { } return true; } -TFT_T_DMA tft; +PICO_DSP tft; static int skip=0; @@ -47,55 +42,54 @@ int main(void) { // set_sys_clock_khz(250000, true); stdio_init_all(); -#ifdef USE_VGA -// tft.begin(VGA_MODE_400x240); - tft.begin(VGA_MODE_320x240); -#else - tft.begin(); -#endif emu_init(); - while (true) { + char * filename; +#ifdef FILEBROWSER + while (true) { if (menuActive()) { uint16_t bClick = emu_DebounceLocalKeys(); int action = handleMenu(bClick); - char * filename = menuSelection(); - if (action == ACTION_RUNTFT) { - toggleMenu(false); - emu_start(); - emu_Init(filename); - tft.fillScreenNoDma( RGBVAL16(0x00,0x00,0x00) ); - tft.startDMA(); - struct repeating_timer timer; - add_repeating_timer_ms(15, repeating_timer_callback, NULL, &timer); - } + filename = menuSelection(); + if (action == ACTION_RUN) { + break; + } tft.waitSync(); } - else { - //uint16_t bClick = emu_DebounceLocalKeys(); - //emu_Input(bClick); - emu_Step(); - } - - //int c = getchar_timeout_us(0); - //switch (c) { - // case ' ': - // printf("test: %d\n", 1); - // break; - //} + } +#endif + emu_start(); + emu_Init(filename); + tft.startRefresh(); + struct repeating_timer timer; + add_repeating_timer_ms(15, repeating_timer_callback, NULL, &timer); + while (true) { + //uint16_t bClick = emu_DebounceLocalKeys(); + //emu_Input(bClick); + emu_Step(); } } -static unsigned char palette8[PALETTE_SIZE]; static unsigned short palette16[PALETTE_SIZE]; - void emu_SetPaletteEntry(unsigned char r, unsigned char g, unsigned char b, int index) { if (index -void AudioPlaySystem::snd_Mixer(short * stream, int len ) -{ - if (playing) - { -#ifdef CUSTOM_SND - //printf("s\n"); - SND_Process((void*)stream, len); -#else - int i; - long s; - len = len >> 1; - short v0=chan[0].vol; - short v1=chan[1].vol; - short v2=chan[2].vol; - short v3=chan[3].vol; - short v4=chan[4].vol; - short v5=chan[5].vol; - for (i=0;i>8)&0x3f])>>11); - s+=((v1*square[(chan[1].spos>>8)&0x3f])>>11); - s+=((v2*square[(chan[2].spos>>8)&0x3f])>>11); - s+=((v3*noise[(chan[3].spos>>8)&(NOISEBSIZE-1)])>>11); - s+=((v4*noise[(chan[4].spos>>8)&(NOISEBSIZE-1)])>>11); - s+=((v5*noise[(chan[5].spos>>8)&(NOISEBSIZE-1)])>>11); - *stream++ = (short)(s); - *stream++ = (short)(s); - chan[0].spos += chan[0].sinc; - chan[1].spos += chan[1].sinc; - chan[2].spos += chan[2].sinc; - chan[3].spos += chan[3].sinc; - chan[4].spos += chan[4].sinc; - chan[5].spos += chan[5].sinc; - } -#endif - } -} - -void AudioPlaySystem::begin(void) -{ - this->reset(); -} - -void AudioPlaySystem::start(void) -{ - playing = true; -} - -void AudioPlaySystem::setSampleParameters(float clockfreq, float samplerate) { -} - -void AudioPlaySystem::reset(void) -{ - snd_Reset(); -} - -void AudioPlaySystem::stop(void) -{ - playing = false; -} - -bool AudioPlaySystem::isPlaying(void) -{ - return playing; -} - - - -void AudioPlaySystem::sound(int C, int F, int V) { -#ifndef CUSTOM_SND - if (C < 6) { - chan[C].vol = V; - chan[C].sinc = F>>1; - } -#endif -} - -void AudioPlaySystem::step(void) { -} -#endif diff --git a/MCUME_pico/pico5200/AudioPlaySystem.h b/MCUME_pico/pico5200/AudioPlaySystem.h deleted file mode 100644 index 5d2efc0..0000000 --- a/MCUME_pico/pico5200/AudioPlaySystem.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef audioplaysystem_h_ -#define audioplaysystem_h_ - -#ifdef HAS_SND - -#include "platform_config.h" - -class AudioPlaySystem -{ -public: - AudioPlaySystem(void) { }; - void begin(void); - void setSampleParameters(float clockfreq, float samplerate); - void reset(void); - void start(void); - void stop(void); - bool isPlaying(void); - void sound(int C, int F, int V); - void buzz(int size, int val); - void step(void); - static void snd_Mixer(short * stream, int len ); -}; - -#endif - -#endif diff --git a/MCUME_pico/pico5200/antic.c b/MCUME_pico/pico5200/antic.c index 26f1392..f62a2d8 100644 --- a/MCUME_pico/pico5200/antic.c +++ b/MCUME_pico/pico5200/antic.c @@ -41,7 +41,7 @@ UWORD Screen_atari[ATARI_WIDTH / 2]; // = NULL; #define DRAWLINE() \ if ( (ANTIC_ypos > 8) && (ANTIC_ypos < 248)) { \ - emu_DrawLine((unsigned char *)&Screen_atari[32/sizeof(Screen_atari[0])], 320, 240, ANTIC_ypos-8); \ + emu_DrawLinePal16((unsigned char *)&Screen_atari[32/sizeof(Screen_atari[0])], 320, 240, ANTIC_ypos-8); \ } diff --git a/MCUME_pico/pico5200/atari5200.c b/MCUME_pico/pico5200/atari5200.c index f2546cd..70e9d42 100644 --- a/MCUME_pico/pico5200/atari5200.c +++ b/MCUME_pico/pico5200/atari5200.c @@ -461,6 +461,9 @@ void emu_KeyboardOnDown(int keymodifer, int key) { void emu_KeyboardOnUp(int keymodifer, int key) { } +#define R32(rgb) ((rgb>>16)&0xff) +#define G32(rgb) ((rgb>>8)&0xff) +#define B32(rgb) (rgb & 0xff) void at5_Init(void) { diff --git a/MCUME_pico/pico5200/emuapi.cpp b/MCUME_pico/pico5200/emuapi.cpp deleted file mode 100644 index 1bc929b..0000000 --- a/MCUME_pico/pico5200/emuapi.cpp +++ /dev/null @@ -1,1311 +0,0 @@ -#define KEYMAP_PRESENT 1 - -#define PROGMEM - -#include "pico.h" -#include "pico/stdlib.h" -#include "hardware/adc.h" -#include -#include - -extern "C" { - #include "emuapi.h" - #include "iopins.h" -} - -static bool emu_writeConfig(void); -static bool emu_readConfig(void); -static bool emu_eraseConfig(void); - - -#if (defined(ILI9341) || defined(ST7789)) && defined(USE_VGA) -// Dual display config, initialize TFT -#include "tft_t_dma.h" -static TFT_T_DMA tft; -#else -// Non Dual display config -#ifdef USE_VGA -#include "vga_t_dma.h" -#else -#include "tft_t_dma.h" -#endif -extern TFT_T_DMA tft; -#endif - - -#define MAX_FILENAME_PATH 64 -#define NB_FILE_HANDLER 4 -#define AUTORUN_FILENAME "autorun.txt" - -#define MAX_FILES 64 -#define MAX_FILENAME_SIZE 24 -#define MAX_MENULINES 9 -#define TEXT_HEIGHT 16 -#define TEXT_WIDTH 8 -#define MENU_FILE_XOFFSET (6*TEXT_WIDTH) -#define MENU_FILE_YOFFSET (2*TEXT_HEIGHT) -#define MENU_FILE_W (MAX_FILENAME_SIZE*TEXT_WIDTH) -#define MENU_FILE_H (MAX_MENULINES*TEXT_HEIGHT) -#define MENU_FILE_BGCOLOR RGBVAL16(0x00,0x00,0x40) -#define MENU_JOYS_YOFFSET (12*TEXT_HEIGHT) -#define MENU_VBAR_XOFFSET (0*TEXT_WIDTH) -#define MENU_VBAR_YOFFSET (MENU_FILE_YOFFSET) - -#define MENU_TFT_XOFFSET (MENU_FILE_XOFFSET+MENU_FILE_W+8) -#define MENU_TFT_YOFFSET (MENU_VBAR_YOFFSET+32) -#define MENU_VGA_XOFFSET (MENU_FILE_XOFFSET+MENU_FILE_W+8) -#define MENU_VGA_YOFFSET (MENU_VBAR_YOFFSET+MENU_FILE_H-32-37) - - - -static int nbFiles=0; -static int curFile=0; -static int topFile=0; -static char selection[MAX_FILENAME_PATH]=""; -static char selected_filename[MAX_FILENAME_SIZE]=""; -static char files[MAX_FILES][MAX_FILENAME_SIZE]; -static bool menuRedraw=true; - -#ifdef PICOMPUTER -static const unsigned short * keys; -static unsigned char keymatrix[6]; -static int keymatrix_hitrow=-1; -static bool key_fn=false; -static bool key_alt=false; -static uint32_t keypress_t_ms=0; -static uint32_t last_t_ms=0; -static uint32_t hundred_ms_cnt=0; -static bool ledflash_toggle=false; -#endif -static int keyMap; - -static bool joySwapped = false; -static uint16_t bLastState; -static int xRef; -static int yRef; -static uint8_t usbnavpad=0; - -static bool menuOn=true; -static bool autorun=false; - - -/******************************** - * Generic output and malloc -********************************/ -void emu_printf(const char * text) -{ - printf("%s\n",text); -} - -void emu_printf(int val) -{ - printf("%d\n",val); -} - -void emu_printi(int val) -{ - printf("%d\n",val); -} - -void emu_printh(int val) -{ - printf("0x%.8\n",val); -} - -static int malbufpt = 0; -static char malbuf[EXTRA_HEAP]; - -void * emu_Malloc(int size) -{ - void * retval = malloc(size); - if (!retval) { - emu_printf("failled to allocate"); - emu_printf(size); - emu_printf("fallback"); - if ( (malbufpt+size) < sizeof(malbuf) ) { - retval = (void *)&malbuf[malbufpt]; - malbufpt += size; - } - else { - emu_printf("failure to allocate"); - } - } - else { - emu_printf("could allocate dynamic "); - emu_printf(size); - } - - return retval; -} - -void * emu_MallocI(int size) -{ - void * retval = NULL; - - if ( (malbufpt+size) < sizeof(malbuf) ) { - retval = (void *)&malbuf[malbufpt]; - malbufpt += size; - emu_printf("could allocate static "); - emu_printf(size); - } - else { - emu_printf("failure to allocate"); - } - - return retval; -} -void emu_Free(void * pt) -{ - free(pt); -} - -void emu_drawText(unsigned short x, unsigned short y, const char * text, unsigned short fgcolor, unsigned short bgcolor, int doublesize) -{ - tft.drawText(x, y, text, fgcolor, bgcolor, doublesize?true:false); -} - - -/******************************** - * OSKB handling -********************************/ -#if (defined(ILI9341) || defined(ST7789)) && defined(USE_VGA) -// On screen keyboard position -#define KXOFF 28 //64 -#define KYOFF 96 -#define KWIDTH 11 //22 -#define KHEIGHT 3 - -static bool oskbOn = false; -static int cxpos = 0; -static int cypos = 0; -static int oskbMap = 0; -static uint16_t oskbBLastState = 0; - -static void lineOSKB2(int kxoff, int kyoff, char * str, int row) -{ - char c[2] = {'A',0}; - const char * cpt = str; - for (int i=0; i.,SP ", 2); - if (oskbMap == 0) { - lineOSKB(KXOFF,KYOFF, keylables_map1_0, 0); - lineOSKB(KXOFF,KYOFF, keylables_map1_1, 1); - lineOSKB(KXOFF,KYOFF, keylables_map1_2, 2); - } - else if (oskbMap == 1) { - lineOSKB(KXOFF,KYOFF, keylables_map2_0, 0); - lineOSKB(KXOFF,KYOFF, keylables_map2_1, 1); - lineOSKB(KXOFF,KYOFF, keylables_map2_2, 2); - } - else { - lineOSKB(KXOFF,KYOFF, keylables_map3_0, 0); - lineOSKB(KXOFF,KYOFF, keylables_map3_1, 1); - lineOSKB(KXOFF,KYOFF, keylables_map3_2, 2); - } -} - -void toggleOskb(bool forceoff) { - if (forceoff) oskbOn=true; - if (oskbOn) { - oskbOn = false; - tft.fillScreenNoDma(RGBVAL16(0x00,0x00,0x00)); - tft.drawTextNoDma(0,32, "Press USER2 to toggle onscreen keyboard.", RGBVAL16(0xff,0xff,0xff), RGBVAL16(0x00,0x00,0x00), true); - } else { - oskbOn = true; - tft.fillScreenNoDma(RGBVAL16(0x00,0x00,0x00)); - tft.drawTextNoDma(0,32, " Press USER2 to exit onscreen keyboard. ", RGBVAL16(0xff,0xff,0xff), RGBVAL16(0x00,0x00,0x00), true); - tft.drawTextNoDma(0,64, " (USER1 to toggle between keymaps) ", RGBVAL16(0x00,0xff,0xff), RGBVAL16(0x00,0x00,0xff), true); - tft.drawRectNoDma(KXOFF,KYOFF, 22*8, 3*16, RGBVAL16(0x00,0x00,0xFF)); - drawOskb(); - } -} - -static int handleOskb(void) -{ - int retval = 0; - - uint16_t bClick = bLastState & ~oskbBLastState; - oskbBLastState = bLastState; - /* - static const char * digits = "0123456789ABCDEF"; - char buf[5] = {0,0,0,0,0}; - int val = bClick; - buf[0] = digits[(val>>12)&0xf]; - buf[1] = digits[(val>>8)&0xf]; - buf[2] = digits[(val>>4)&0xf]; - buf[3] = digits[val&0xf]; - tft.drawTextNoDma(0,KYOFF+ 64,buf,RGBVAL16(0x00,0x00,0x00),RGBVAL16(0xFF,0xFF,0xFF),1); - */ - if (bClick & MASK_KEY_USER2) - { - toggleOskb(false); - } - if (oskbOn) - { - bool updated = true; - if (bClick & MASK_KEY_USER1) - { - oskbMap += 1; - if (oskbMap == 3) oskbMap = 0; - } - else if (bClick & MASK_JOY2_LEFT) - { - cxpos++; - if (cxpos >= KWIDTH) cxpos = 0; - } - else if (bClick & MASK_JOY2_RIGHT) - { - cxpos--; - if (cxpos < 0) cxpos = KWIDTH-1; - } - else if (bClick & MASK_JOY2_DOWN) - { - cypos++; - if (cypos >= KHEIGHT) cypos = 0; - } - else if (bClick & MASK_JOY2_UP) - { - cypos--; - if (cypos < 0) cypos = KHEIGHT-1; - } - else if (oskbBLastState & MASK_JOY2_BTN) - { - retval = cypos*KWIDTH+cxpos+1; - if (retval) { - retval--; - //if (retval & 1) retval = key_map2[retval>>1]; - //else retval = key_map1[retval>>1]; - if (oskbMap == 0) { - retval = key_map1[retval]; - } - else if (oskbMap == 1) { - retval = key_map2[retval]; - } - else { - retval = key_map3[retval]; - } - //if (retval) { toggleOskb(true); updated=false; }; - } - } - else { - updated=false; - } - if (updated) drawOskb(); - } - - return retval; -} -#endif - -/******************************** - * Input and keyboard -********************************/ -int emu_ReadAnalogJoyX(int min, int max) -{ - adc_select_input(0); - int val = adc_read(); -#if INVX - val = 4095 - val; -#endif - val = val-xRef; - val = ((val*140)/100); - if ( (val > -512) && (val < 512) ) val = 0; - val = val+2048; - return (val*(max-min))/4096; -} - -int emu_ReadAnalogJoyY(int min, int max) -{ - adc_select_input(1); - int val = adc_read(); -#if INVY - val = 4095 - val; -#endif - val = val-yRef; - val = ((val*120)/100); - if ( (val > -512) && (val < 512) ) val = 0; - //val = (val*(max-min))/4096; - val = val+2048; - //return val+(max-min)/2; - return (val*(max-min))/4096; -} - - -static uint16_t readAnalogJoystick(void) -{ - uint16_t joysval = 0; -#ifdef PIN_JOY2_A1X - int xReading = emu_ReadAnalogJoyX(0,256); - if (xReading > 128) joysval |= MASK_JOY2_LEFT; - else if (xReading < 128) joysval |= MASK_JOY2_RIGHT; - - int yReading = emu_ReadAnalogJoyY(0,256); - if (yReading < 128) joysval |= MASK_JOY2_UP; - else if (yReading > 128) joysval |= MASK_JOY2_DOWN; -#endif - // First joystick -#if INVY -#ifdef PIN_JOY2_1 - if ( !gpio_get(PIN_JOY2_1) ) joysval |= MASK_JOY2_DOWN; -#endif -#ifdef PIN_JOY2_2 - if ( !gpio_get(PIN_JOY2_2) ) joysval |= MASK_JOY2_UP; -#endif -#else -#ifdef PIN_JOY2_1 - if ( !gpio_get(PIN_JOY2_1) ) joysval |= MASK_JOY2_UP; -#endif -#ifdef PIN_JOY2_2 - if ( !gpio_get(PIN_JOY2_2) ) joysval |= MASK_JOY2_DOWN; -#endif -#endif -#if INVX -#ifdef PIN_JOY2_3 - if ( !gpio_get(PIN_JOY2_3) ) joysval |= MASK_JOY2_LEFT; -#endif -#ifdef PIN_JOY2_4 - if ( !gpio_get(PIN_JOY2_4) ) joysval |= MASK_JOY2_RIGHT; -#endif -#else -#ifdef PIN_JOY2_3 - if ( !gpio_get(PIN_JOY2_3) ) joysval |= MASK_JOY2_RIGHT; -#endif -#ifdef PIN_JOY2_4 - if ( !gpio_get(PIN_JOY2_4) ) joysval |= MASK_JOY2_LEFT; -#endif -#endif -#ifdef PIN_JOY2_BTN - joysval |= (gpio_get(PIN_JOY2_BTN) ? 0 : MASK_JOY2_BTN); -#endif - - return (joysval); -} - - -int emu_SwapJoysticks(int statusOnly) { - if (!statusOnly) { - if (joySwapped) { - joySwapped = false; - } - else { - joySwapped = true; - } - } - return(joySwapped?1:0); -} - -int emu_GetPad(void) -{ - return(bLastState/*|((joySwapped?1:0)<<7)*/); -} - -int emu_ReadKeys(void) -{ - uint16_t retval; - uint16_t j1 = readAnalogJoystick(); - uint16_t j2 = 0; - - // Second joystick -#if INVY -#ifdef PIN_JOY1_1 - if ( !gpio_get(PIN_JOY1_1) ) j2 |= MASK_JOY2_DOWN; -#endif -#ifdef PIN_JOY1_2 - if ( !gpio_get(PIN_JOY1_2) ) j2 |= MASK_JOY2_UP; -#endif -#else -#ifdef PIN_JOY1_1 - if ( !gpio_get(PIN_JOY1_1) ) j2 |= MASK_JOY2_UP; -#endif -#ifdef PIN_JOY1_2 - if ( !gpio_get(PIN_JOY1_2) ) j2 |= MASK_JOY2_DOWN; -#endif -#endif -#if INVX -#ifdef PIN_JOY1_3 - if ( !gpio_get(PIN_JOY1_3) ) j2 |= MASK_JOY2_LEFT; -#endif -#ifdef PIN_JOY1_4 - if ( !gpio_get(PIN_JOY1_4) ) j2 |= MASK_JOY2_RIGHT; -#endif -#else -#ifdef PIN_JOY1_3 - if ( !gpio_get(PIN_JOY1_3) ) j2 |= MASK_JOY2_RIGHT; -#endif -#ifdef PIN_JOY1_4 - if ( !gpio_get(PIN_JOY1_4) ) j2 |= MASK_JOY2_LEFT; -#endif -#endif -#ifdef PIN_JOY1_BTN - if ( !gpio_get(PIN_JOY1_BTN) ) j2 |= MASK_JOY2_BTN; -#endif - - - if (joySwapped) { - retval = ((j1 << 8) | j2); - } - else { - retval = ((j2 << 8) | j1); - } - - if (usbnavpad & MASK_JOY2_UP) retval |= MASK_JOY2_UP; - if (usbnavpad & MASK_JOY2_DOWN) retval |= MASK_JOY2_DOWN; - if (usbnavpad & MASK_JOY2_LEFT) retval |= MASK_JOY2_LEFT; - if (usbnavpad & MASK_JOY2_RIGHT) retval |= MASK_JOY2_RIGHT; - if (usbnavpad & MASK_JOY2_BTN) retval |= MASK_JOY2_BTN; - -#ifdef PIN_KEY_USER1 - if ( !gpio_get(PIN_KEY_USER1) ) retval |= MASK_KEY_USER1; -#endif -#ifdef PIN_KEY_USER2 - if ( !gpio_get(PIN_KEY_USER2) ) retval |= MASK_KEY_USER2; -#endif -#ifdef PIN_KEY_USER3 - if ( !gpio_get(PIN_KEY_USER3) ) retval |= MASK_KEY_USER3; -#endif -#ifdef PIN_KEY_USER4 - if ( !gpio_get(PIN_KEY_USER4) ) retval |= MASK_KEY_USER4; -#endif - -#ifdef PICOMPUTER - keymatrix_hitrow = -1; - unsigned char row; - unsigned short cols[6]={KCOLOUT1,KCOLOUT2,KCOLOUT3,KCOLOUT4,KCOLOUT5,KCOLOUT6}; - unsigned char keymatrixtmp[6]; - - for (int i=0;i<6;i++){ - gpio_set_dir(cols[i], GPIO_OUT); - gpio_put(cols[i], 0); -#ifdef SWAP_ALT_DEL - sleep_us(1); - //__asm volatile ("nop\n"); // 4-8ns -#endif - row=0; - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN4) ? 0 : 0x02); - row |= (gpio_get(KROWIN1) ? 0 : 0x04); - row |= (gpio_get(KROWIN3) ? 0 : 0x08); - row |= (gpio_get(KROWIN5) ? 0 : 0x10); - row |= (gpio_get(KROWIN6) ? 0 : 0x20); - //gpio_set_dir(cols[i], GPIO_OUT); - gpio_put(cols[i], 1); - gpio_set_dir(cols[i], GPIO_IN); - gpio_disable_pulls(cols[i]); - keymatrixtmp[i] = row; - } - -#ifdef MULTI_DEBOUNCE - for (int i=0;i<6;i++){ - gpio_set_dir(cols[i], GPIO_OUT); - gpio_put(cols[i], 0); -#ifdef SWAP_ALT_DEL - sleep_us(1); - //__asm volatile ("nop\n"); // 4-8ns -#endif - row=0; - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN4) ? 0 : 0x02); - row |= (gpio_get(KROWIN1) ? 0 : 0x04); - row |= (gpio_get(KROWIN3) ? 0 : 0x08); - row |= (gpio_get(KROWIN5) ? 0 : 0x10); - row |= (gpio_get(KROWIN6) ? 0 : 0x20); - //gpio_set_dir(cols[i], GPIO_OUT); - gpio_put(cols[i], 1); - gpio_set_dir(cols[i], GPIO_IN); - gpio_disable_pulls(cols[i]); - keymatrixtmp[i] |= row; - } - - for (int i=0;i<6;i++){ - gpio_set_dir(cols[i], GPIO_OUT); - gpio_put(cols[i], 0); -#ifdef SWAP_ALT_DEL - sleep_us(1); - //__asm volatile ("nop\n"); // 4-8ns -#endif - row=0; - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN4) ? 0 : 0x02); - row |= (gpio_get(KROWIN1) ? 0 : 0x04); - row |= (gpio_get(KROWIN3) ? 0 : 0x08); - row |= (gpio_get(KROWIN5) ? 0 : 0x10); - row |= (gpio_get(KROWIN6) ? 0 : 0x20); - //gpio_set_dir(cols[i], GPIO_OUT); - gpio_put(cols[i], 1); - gpio_set_dir(cols[i], GPIO_IN); - gpio_disable_pulls(cols[i]); - keymatrixtmp[i] |= row; - } -#endif - -#ifdef SWAP_ALT_DEL - // Swap ALT and DEL - unsigned char alt = keymatrixtmp[0] & 0x02; - unsigned char del = keymatrixtmp[5] & 0x20; - keymatrixtmp[0] &= ~0x02; - keymatrixtmp[5] &= ~0x20; - if (alt) keymatrixtmp[5] |= 0x20; - if (del) keymatrixtmp[0] |= 0x02; -#endif - - bool alt_pressed=false; - if ( keymatrixtmp[5] & 0x20 ) {alt_pressed=true; keymatrixtmp[5] &= ~0x20;}; - - for (int i=0;i<6;i++){ - row = keymatrixtmp[i]; - if (row) keymatrix_hitrow=i; - keymatrix[i] = row; - } - - //6,9,15,8,7,22 -#if INVX - if ( row & 0x2 ) retval |= MASK_JOY2_LEFT; - if ( row & 0x1 ) retval |= MASK_JOY2_RIGHT; -#else - if ( row & 0x1 ) retval |= MASK_JOY2_LEFT; - if ( row & 0x2 ) retval |= MASK_JOY2_RIGHT; -#endif -#if INVY - if ( row & 0x8 ) retval |= MASK_JOY2_DOWN; - if ( row & 0x4 ) retval |= MASK_JOY2_UP; -#else - if ( row & 0x4 ) retval |= MASK_JOY2_DOWN; - if ( row & 0x8 ) retval |= MASK_JOY2_UP; -#endif - if ( row & 0x10 ) retval |= MASK_JOY2_BTN; - - // Handle LED flash - uint32_t time_ms=to_ms_since_boot (get_absolute_time()); - if ((time_ms-last_t_ms) > 100) { - last_t_ms = time_ms; - if (ledflash_toggle == false) { - ledflash_toggle = true; - } - else { - ledflash_toggle = false; - } - } - - if ( alt_pressed ) { - if (key_fn == false) - { - // Release to Press transition - if (hundred_ms_cnt == 0) { - keypress_t_ms=time_ms; - hundred_ms_cnt += 1; // 1 - } - else { - hundred_ms_cnt += 1; // 2 - if (hundred_ms_cnt >= 2) - { - hundred_ms_cnt = 0; - /* - if ( (time_ms-keypress_t_ms) < 500) - { - if (key_alt == false) - { - key_alt = true; - } - else - { - key_alt = false; - } - } - */ - } - } - } - else { - // Keep press - if (hundred_ms_cnt == 1) { - if ((to_ms_since_boot (get_absolute_time())-keypress_t_ms) > 2000) - { - if (key_alt == false) - { - key_alt = true; - } - else - { - key_alt = false; - } - hundred_ms_cnt = 0; - } - } - } - key_fn = true; - } - else { - key_fn = false; - } - - // Handle LED - if (key_alt == true) { - gpio_put(KLED, (ledflash_toggle?1:0)); - } - else { - if (key_fn == true) { - gpio_put(KLED, 1); - } - else { - gpio_put(KLED, 0); - } - } - - if ( key_fn ) retval |= MASK_KEY_USER2; - if ( ( key_fn ) && (keymatrix[0] == 0x02 )) retval |= MASK_KEY_USER1; -#endif - - //Serial.println(retval,HEX); - - if ( ((retval & (MASK_KEY_USER1+MASK_KEY_USER2)) == (MASK_KEY_USER1+MASK_KEY_USER2)) - || (retval & MASK_KEY_USER4 ) ) - { - } - -#if (defined(ILI9341) || defined(ST7789)) && defined(USE_VGA) - if (oskbOn) { - retval |= MASK_OSKB; - } -#endif - - return (retval); -} - -unsigned short emu_DebounceLocalKeys(void) -{ - uint16_t bCurState = emu_ReadKeys(); - uint16_t bClick = bCurState & ~bLastState; - bLastState = bCurState; - - return (bClick); -} - -int emu_ReadI2CKeyboard(void) { - int retval=0; -#ifdef PICOMPUTER - if (key_alt) { - keys = (const unsigned short *)key_map3; - } - else if (key_fn) { - keys = (const unsigned short *)key_map2; - } - else { - keys = (const unsigned short *)key_map1; - } - if (keymatrix_hitrow >=0 ) { - unsigned short match = ((unsigned short)keymatrix_hitrow<<8) | keymatrix[keymatrix_hitrow]; - for (int i=0; i=0) { - menuRedraw=true; - curFile -= 9; - } else if (curFile!=0) { - menuRedraw=true; - curFile--; - } - } - else if ( (bClick & MASK_JOY2_DOWN) || (bClick & MASK_JOY1_DOWN) ) { - if ((curFile<(nbFiles-1)) && (nbFiles)) { - curFile++; - menuRedraw=true; - } - } - else if ( (bClick & MASK_JOY2_LEFT) || (bClick & MASK_JOY1_LEFT) ) { - if ((curFile<(nbFiles-9)) && (nbFiles)) { - curFile += 9; - menuRedraw=true; - } - else if ((curFile<(nbFiles-1)) && (nbFiles)) { - curFile++; - menuRedraw=true; - } - } - else if ( (bClick & MASK_KEY_USER2) ) { - emu_SwapJoysticks(0); - menuRedraw=true; - } - - if (menuRedraw && nbFiles) { - int fileIndex = 0; - tft.drawRectNoDma(MENU_FILE_XOFFSET,MENU_FILE_YOFFSET, MENU_FILE_W, MENU_FILE_H, MENU_FILE_BGCOLOR); -// if (curFile <= (MAX_MENULINES/2-1)) topFile=0; -// else topFile=curFile-(MAX_MENULINES/2); - if (curFile <= (MAX_MENULINES-1)) topFile=0; - else topFile=curFile-(MAX_MENULINES/2); - - int i=0; - while (i=nbFiles) { - // no more files - break; - } - char * filename = &files[fileIndex][0]; - if (fileIndex >= topFile) { - if ((i+topFile) < nbFiles ) { - if ((i+topFile)==curFile) { - tft.drawTextNoDma(MENU_FILE_XOFFSET,i*TEXT_HEIGHT+MENU_FILE_YOFFSET, filename, RGBVAL16(0xff,0xff,0x00), RGBVAL16(0xff,0x00,0x00), true); - strcpy(selected_filename,filename); - } - else { - tft.drawTextNoDma(MENU_FILE_XOFFSET,i*TEXT_HEIGHT+MENU_FILE_YOFFSET, filename, RGBVAL16(0xff,0xff,0xff), MENU_FILE_BGCOLOR, true); - } - } - i++; - } - fileIndex++; - } - - - tft.drawTextNoDma(48,MENU_JOYS_YOFFSET+8, (emu_SwapJoysticks(1)?(char*)"SWAP=1":(char*)"SWAP=0"), RGBVAL16(0x00,0xff,0xff), RGBVAL16(0x00,0x00,0xff), false); - menuRedraw=false; - } - - return (action); -} - -bool menuActive(void) -{ - return (menuOn); -} - -void toggleMenu(bool on) { - if (on) { - menuOn = true; - backgroundMenu(); - } else { - menuOn = false; - } -} - -char * menuSelection(void) -{ - return (selection); -} - - -/******************************** - * File IO -********************************/ -int emu_FileOpen(const char * filepath, const char * mode) -{ - int retval = 0; - - emu_printf("FileOpen..."); - emu_printf(filepath); - if( !(f_open(&file, filepath, FA_READ)) ) { - retval = 1; - } - else { - emu_printf("FileOpen failed"); - } - return (retval); -} - -int emu_FileRead(void * buf, int size, int handler) -{ - unsigned int retval=0; - f_read (&file, (void*)buf, size, &retval); - return retval; -} - -int emu_FileGetc(int handler) -{ - unsigned char c; - unsigned int retval=0; - if( !(f_read (&file, &c, 1, &retval)) ) - if (retval != 1) { - emu_printf("emu_FileGetc failed"); - } - return (int)c; -} - -void emu_FileClose(int handler) -{ - f_close(&file); -} - -int emu_FileSeek(int handler, int seek, int origin) -{ - f_lseek(&file, seek); - return (seek); -} - -int emu_FileTell(int handler) -{ - return (f_tell(&file)); -} - - -unsigned int emu_FileSize(const char * filepath) -{ - int filesize=0; - emu_printf("FileSize..."); - emu_printf(filepath); - FILINFO entry; - f_stat(filepath, &entry); - filesize = entry.fsize; - return(filesize); -} - -unsigned int emu_LoadFile(const char * filepath, void * buf, int size) -{ - int filesize = 0; - - emu_printf("LoadFile..."); - emu_printf(filepath); - if( !(f_open(&file, filepath, FA_READ)) ) { - filesize = f_size(&file); - emu_printf(filesize); - if (size >= filesize) - { - unsigned int retval=0; - if( (f_read (&file, buf, filesize, &retval)) ) { - emu_printf("File read failed"); - } - } - f_close(&file); - } - - return(filesize); -} - -static FIL outfile; - -static bool emu_writeConfig(void) -{ - bool retval = false; - if( !(f_open(&outfile, ROMSDIR "/" AUTORUN_FILENAME, FA_CREATE_NEW | FA_WRITE)) ) { - unsigned int sizeread=0; - if( (f_write (&outfile, selection, strlen(selection), &sizeread)) ) { - emu_printf("Config write failed"); - } - else { - retval = true; - } - f_close(&outfile); - } - return retval; -} - -static bool emu_readConfig(void) -{ - bool retval = false; - if( !(f_open(&outfile, ROMSDIR "/" AUTORUN_FILENAME, FA_READ)) ) { - unsigned int filesize = f_size(&outfile); - unsigned int sizeread=0; - if( (f_read (&outfile, selection, filesize, &sizeread)) ) { - emu_printf("Config read failed"); - } - else { - if (sizeread == filesize) { - selection[filesize]=0; - retval = true; - } - } - f_close(&outfile); - } - return retval; -} - -static bool emu_eraseConfig(void) -{ - f_unlink (ROMSDIR "/" AUTORUN_FILENAME); -} - - -/******************************** - * Initialization -********************************/ -void emu_init(void) -{ - // Dual display config, initialize TFT -#if (defined(ILI9341) || defined(ST7789)) && defined(USE_VGA) - tft.begin(); -#endif - - sd_init_driver(); - FRESULT fr = f_mount(&fatfs, "0:", 1); - - strcpy(selection,ROMSDIR); - nbFiles = readNbFiles(selection); - - emu_printf("SD initialized, files found: "); - emu_printi(nbFiles); - - emu_InitJoysticks(); -#ifdef SWAP_JOYSTICK - joySwapped = true; -#else - joySwapped = false; -#endif - - int keypressed = emu_ReadKeys(); -#ifdef PICOMPUTER - // Flip screen if UP pressed - if (keypressed & MASK_JOY2_UP) - { -#ifdef PICOMPUTERMAX -#ifndef USE_VGA - tft.flipscreen(true); -#endif -#else - tft.flipscreen(true); -#endif - } - else - { -#ifdef PICOMPUTERMAX -#ifndef USE_VGA - tft.flipscreen(false); -#endif -#else - tft.flipscreen(false); -#endif - } -#endif - - if (keypressed & MASK_JOY2_DOWN) { - tft.fillScreenNoDma( RGBVAL16(0xff,0x00,0x00) ); - tft.drawTextNoDma(64,48, (char*)" AUTURUN file erased", RGBVAL16(0xff,0xff,0x00), RGBVAL16(0xff,0x00,0x00), true); - tft.drawTextNoDma(64,48+24, (char*)"Please reset the board!", RGBVAL16(0xff,0xff,0x00), RGBVAL16(0xff,0x00,0x00), true); - emu_eraseConfig(); - } - else { - if (emu_readConfig()) { - autorun = true; - } - } - toggleMenu(true); -} - - -void emu_start(void) -{ - usbnavpad = 0; - - keyMap = 0; -} diff --git a/MCUME_pico/pico5200/emuapi.h b/MCUME_pico/pico5200/emuapi.h deleted file mode 100644 index 95e6b5f..0000000 --- a/MCUME_pico/pico5200/emuapi.h +++ /dev/null @@ -1,153 +0,0 @@ -#ifndef EMUAPI_H -#define EMUAPI_H - -#include "platform_config.h" - -#define CUSTOM_SND 1 -//#define TIMER_REND 1 -#define EXTRA_HEAP 0x10 - -// Title: < > -#define TITLE " Atari5200 Emulator" -#define ROMSDIR "5200" - -#define emu_Init(ROM) {at5_Init(); at5_Start(ROM);} -#define emu_Step(x) {at5_Step();} -#define emu_Input(x) {} - -#define PALETTE_SIZE 256 -#define VID_FRAME_SKIP 0x0 -#define TFT_VBUFFER_YCROP 0 -#define SINGLELINE_RENDERING 1 - -#define R32(rgb) ((rgb>>16)&0xff) -#define G32(rgb) ((rgb>>8)&0xff) -#define B32(rgb) (rgb & 0xff) - -#define ACTION_NONE 0 -#define ACTION_MAXKBDVAL 16 -#define ACTION_EXITKBD 128 -#define ACTION_RUNTFT 129 -#define ACTION_RUNVGA 130 - - -#ifdef KEYMAP_PRESENT - -#define keylables_map1_0 (char *)" " -#define keylables_map1_1 (char *)" " -#define keylables_map1_2 (char *)" " -const unsigned short key_map1[] = { - 15+1,14+1,13+1,11+1,10+1,9+1,7+1,6+1,5+1,2+1,0, - 0,12+1,8+1,4+1,0+1,1+1,3+1,0,0,0,0, - 0, 0,0,0,0,0,0,0,0,0, - 0,0,0,0 - }; - -// These may be set to 1. The core handles clearing them. -// [BREAK] 0 [ # ] 1 [ 0 ] 2 [ * ] 3 -// [RESET] 4 [ 9 ] 5 [ 8 ] 6 [ 7 ] 7 -// [PAUSE] 8 [ 6 ] 9 [ 5 ] 10 [ 4 ] 11 -// [START] 12 [ 3 ] 13 [ 2 ] 14 [ 1 ] 15 - -#define keylables_map2_0 (char *)" " -#define keylables_map2_1 (char *)" " -#define keylables_map2_2 (char *)" " -const unsigned short key_map2[] = { - 0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0, - 0, 0,0,0,0,0,0,0,0,0, - 0,0,0,0 - }; - -#define keylables_map3_0 (char *)" " -#define keylables_map3_1 (char *)" " -#define keylables_map3_2 (char *)" " -const unsigned short key_map3[] = { - 0,0,0,0,0,0,0,0,0,0,0, // function keys - 0, 0,0,0,0,0,0,0,0,0,0, - 0, 0,0,0,0,0,0,0,0,0, - 0,0,0,0 - }; - -const unsigned short matkeys[] = { - 0x020,0x120,0x220,0x320,0x420,0x408,0x308,0x208,0x108,0x008,0x002, // row 1 - 0x510,0x010,0x110,0x210,0x310,0x410,0x401,0x301,0x201,0x101,0x001, // row 2 - 0x520,0x102,0x202,0x302,0x402,0x404,0x304,0x204,0x104,0x004, // row 3 - 0x508,0x501,0x502,0x504 }; // cursor keys - -#endif - - - -#define MASK_JOY2_RIGHT 0x0001 -#define MASK_JOY2_LEFT 0x0002 -#define MASK_JOY2_UP 0x0004 -#define MASK_JOY2_DOWN 0x0008 -#define MASK_JOY2_BTN 0x0010 -#define MASK_KEY_USER1 0x0020 -#define MASK_KEY_USER2 0x0040 -#define MASK_KEY_USER3 0x0080 -#define MASK_JOY1_RIGHT 0x0100 -#define MASK_JOY1_LEFT 0x0200 -#define MASK_JOY1_UP 0x0400 -#define MASK_JOY1_DOWN 0x0800 -#define MASK_JOY1_BTN 0x1000 -#define MASK_KEY_USER4 0x2000 -#define MASK_OSKB 0x8000 - - -extern void emu_init(void); -extern void emu_start(void); -extern void emu_resetSD(void); - -extern void emu_printf(const char * text); -extern void emu_printi(int val); -extern void * emu_Malloc(int size); -extern void emu_Free(void * pt); - -extern int emu_FileOpen(const char * filepath, const char * mode); -extern int emu_FileRead(void * buf, int size, int handler); -extern int emu_FileGetc(int handler); -extern int emu_FileSeek(int handler, int seek, int origin); -extern int emu_FileTell(int handler); -extern void emu_FileClose(int handler); - -extern unsigned int emu_FileSize(const char * filepath); -extern unsigned int emu_LoadFile(const char * filepath, void * buf, int size); - -extern void emu_SetPaletteEntry(unsigned char r, unsigned char g, unsigned char b, int index); -extern void emu_DrawScreen(unsigned char * VBuf, int width, int height, int stride); -extern void emu_DrawLine(unsigned char * VBuf, int width, int height, int line); -extern void emu_DrawLine8(unsigned char * VBuf, int width, int height, int line); -extern void emu_DrawLine16(unsigned short * VBuf, int width, int height, int line); -extern void emu_DrawVsync(void); -extern int emu_FrameSkip(void); -extern void * emu_LineBuffer(int line); - -extern void emu_InitJoysticks(void); -extern int emu_SwapJoysticks(int statusOnly); -extern unsigned short emu_DebounceLocalKeys(void); -extern int emu_ReadKeys(void); -extern int emu_GetPad(void); -extern int emu_ReadAnalogJoyX(int min, int max); -extern int emu_ReadAnalogJoyY(int min, int max); -extern int emu_ReadI2CKeyboard(void); -extern void emu_KeyboardOnUp(int keymodifer, int key); -extern void emu_KeyboardOnDown(int keymodifer, int key); - -extern void emu_sndPlaySound(int chan, int volume, int freq); -extern void emu_sndPlayBuzz(int size, int val); -extern void emu_sndInit(); -extern void emu_resetus(void); -extern int emu_us(void); - -extern int emu_setKeymap(int index); - -extern void emu_FileTempInit(void); -extern void emu_FileTempRead(int addr, unsigned char * val, int n); -extern void emu_FileTempWrite(int addr, unsigned char val); -extern void emu_printh(int val); - - - -#endif diff --git a/MCUME_pico/pico5200/emucfg.h b/MCUME_pico/pico5200/emucfg.h new file mode 100644 index 0000000..e07dfc7 --- /dev/null +++ b/MCUME_pico/pico5200/emucfg.h @@ -0,0 +1,103 @@ +#ifndef EMUCFG_H +#define EMUCFG_H + +#define PALETTE_SIZE 256 +#define VID_FRAME_SKIP 0x0 +#define TFT_VBUFFER_YCROP 0 +#define SINGLELINE_RENDERING 1 +#define CUSTOM_SND 1 +#define CUSTOM_SND_C 1 +//#define TIMER_REND 1 +#define EXTRA_HEAP 0x10 +#define FILEBROWSER + +// Title: < > +#define TITLE " Atari5200 Emulator" +#define ROMSDIR "5200" + +#define emu_Init(ROM) {at5_Init(); at5_Start(ROM);} +#define emu_Step(x) {at5_Step();} +#define emu_Input(x) {} + +#ifdef KEYMAP_PRESENT + +#ifdef PICOZX +const unsigned short key_map1[] = { + 15+1,14+1,13+1,11+1,10+1,9+1,7+1,6+1,5+1,2+1, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0 //U L R D L R + }; + +const unsigned short key_map2[] = { + 0,0,1+1,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,3+3,0,0,0,0, + 0,0,0,0,0,0 + }; + +const unsigned short key_map3[] = { + 0+1,4+1,8+1,12+1,0,0,0,0,0,0, // function keys break,reset,pause,start + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0 + }; + +const unsigned short matkeys[] = { + 0x104,0x101,0x108,0x102,0x110,0x120,0x140,0x204,0x201,0x208, // row 1 + 0x202,0x210,0x220,0x240,0x304,0x301,0x308,0x302,0x310,0x320, // row 2 + 0x340,0x404,0x401,0x408,0x402,0x410,0x420,0x440,0x504,0x501, // row 3 + 0x020,0x508,0x502,0x510,0x520,0x540,0x604,0x601,0x040,0x608, // row 4 + 0x008,0x001,0x002,0x010,0x620,0x640 }; // cursor keys up, left, right, down, <<<, >>> + +#else + +#define keylables_map1_0 (char *)" " +#define keylables_map1_1 (char *)" " +#define keylables_map1_2 (char *)" " +const unsigned short key_map1[] = { + 15+1,14+1,13+1,11+1,10+1,9+1,7+1,6+1,5+1,2+1,0, + 0,12+1,8+1,4+1,0+1,1+1,3+1,0,0,0,0, + 0, 0,0,0,0,0,0,0,0,0, + 0,0,0,0 + }; + +// These may be set to 1. The core handles clearing them. +// [BREAK] 0 [ # ] 1 [ 0 ] 2 [ * ] 3 +// [RESET] 4 [ 9 ] 5 [ 8 ] 6 [ 7 ] 7 +// [PAUSE] 8 [ 6 ] 9 [ 5 ] 10 [ 4 ] 11 +// [START] 12 [ 3 ] 13 [ 2 ] 14 [ 1 ] 15 + +#define keylables_map2_0 (char *)" " +#define keylables_map2_1 (char *)" " +#define keylables_map2_2 (char *)" " +const unsigned short key_map2[] = { + 0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0, + 0, 0,0,0,0,0,0,0,0,0, + 0,0,0,0 + }; + +#define keylables_map3_0 (char *)" " +#define keylables_map3_1 (char *)" " +#define keylables_map3_2 (char *)" " +const unsigned short key_map3[] = { + 0,0,0,0,0,0,0,0,0,0,0, // function keys + 0, 0,0,0,0,0,0,0,0,0,0, + 0, 0,0,0,0,0,0,0,0,0, + 0,0,0,0 + }; + +const unsigned short matkeys[] = { + 0x020,0x120,0x220,0x320,0x420,0x408,0x308,0x208,0x108,0x008,0x002, // row 1 + 0x510,0x010,0x110,0x210,0x310,0x410,0x401,0x301,0x201,0x101,0x001, // row 2 + 0x520,0x102,0x202,0x302,0x402,0x404,0x304,0x204,0x104,0x004, // row 3 + 0x508,0x501,0x502,0x504 }; // cursor keys + +#endif +#endif + +#endif diff --git a/MCUME_pico/pico5200/font8x8.h b/MCUME_pico/pico5200/font8x8.h deleted file mode 100644 index 4f773da..0000000 --- a/MCUME_pico/pico5200/font8x8.h +++ /dev/null @@ -1,135 +0,0 @@ - -// Font: c64_lower.64c - -const unsigned char font8x8[128][8] PROGMEM = -{ - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0000 (nul) - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0001 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0002 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0003 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0004 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0005 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0006 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0007 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0008 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0009 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000A - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000B - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000C - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000D - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000E - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000F - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0010 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0011 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0012 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0013 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0014 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0015 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0016 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0017 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0018 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0019 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001A - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001B - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001C - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001D - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001E - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001F - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0020 (space) - { 0x18, 0x3C, 0x3C, 0x18, 0x18, 0x00, 0x18, 0x00}, // U+0021 (!) - { 0x36, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0022 (") - { 0x36, 0x36, 0x7F, 0x36, 0x7F, 0x36, 0x36, 0x00}, // U+0023 (#) - { 0x0C, 0x3E, 0x03, 0x1E, 0x30, 0x1F, 0x0C, 0x00}, // U+0024 ($) - { 0x00, 0x63, 0x33, 0x18, 0x0C, 0x66, 0x63, 0x00}, // U+0025 (%) - { 0x1C, 0x36, 0x1C, 0x6E, 0x3B, 0x33, 0x6E, 0x00}, // U+0026 (&) - { 0x06, 0x06, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0027 (') - { 0x18, 0x0C, 0x06, 0x06, 0x06, 0x0C, 0x18, 0x00}, // U+0028 (() - { 0x06, 0x0C, 0x18, 0x18, 0x18, 0x0C, 0x06, 0x00}, // U+0029 ()) - { 0x00, 0x66, 0x3C, 0xFF, 0x3C, 0x66, 0x00, 0x00}, // U+002A (*) - { 0x00, 0x0C, 0x0C, 0x3F, 0x0C, 0x0C, 0x00, 0x00}, // U+002B (+) - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x0C, 0x06}, // U+002C (,) - { 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x00}, // U+002D (-) - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x0C, 0x00}, // U+002E (.) - { 0x60, 0x30, 0x18, 0x0C, 0x06, 0x03, 0x01, 0x00}, // U+002F (/) - { 0x3E, 0x63, 0x73, 0x7B, 0x6F, 0x67, 0x3E, 0x00}, // U+0030 (0) - { 0x0C, 0x0E, 0x0C, 0x0C, 0x0C, 0x0C, 0x3F, 0x00}, // U+0031 (1) - { 0x1E, 0x33, 0x30, 0x1C, 0x06, 0x33, 0x3F, 0x00}, // U+0032 (2) - { 0x1E, 0x33, 0x30, 0x1C, 0x30, 0x33, 0x1E, 0x00}, // U+0033 (3) - { 0x38, 0x3C, 0x36, 0x33, 0x7F, 0x30, 0x78, 0x00}, // U+0034 (4) - { 0x3F, 0x03, 0x1F, 0x30, 0x30, 0x33, 0x1E, 0x00}, // U+0035 (5) - { 0x1C, 0x06, 0x03, 0x1F, 0x33, 0x33, 0x1E, 0x00}, // U+0036 (6) - { 0x3F, 0x33, 0x30, 0x18, 0x0C, 0x0C, 0x0C, 0x00}, // U+0037 (7) - { 0x1E, 0x33, 0x33, 0x1E, 0x33, 0x33, 0x1E, 0x00}, // U+0038 (8) - { 0x1E, 0x33, 0x33, 0x3E, 0x30, 0x18, 0x0E, 0x00}, // U+0039 (9) - { 0x00, 0x0C, 0x0C, 0x00, 0x00, 0x0C, 0x0C, 0x00}, // U+003A (:) - { 0x00, 0x0C, 0x0C, 0x00, 0x00, 0x0C, 0x0C, 0x06}, // U+003B (//) - { 0x18, 0x0C, 0x06, 0x03, 0x06, 0x0C, 0x18, 0x00}, // U+003C (<) - { 0x00, 0x00, 0x3F, 0x00, 0x00, 0x3F, 0x00, 0x00}, // U+003D (=) - { 0x06, 0x0C, 0x18, 0x30, 0x18, 0x0C, 0x06, 0x00}, // U+003E (>) - { 0x1E, 0x33, 0x30, 0x18, 0x0C, 0x00, 0x0C, 0x00}, // U+003F (?) - { 0x3E, 0x63, 0x7B, 0x7B, 0x7B, 0x03, 0x1E, 0x00}, // U+0040 (@) - { 0x0C, 0x1E, 0x33, 0x33, 0x3F, 0x33, 0x33, 0x00}, // U+0041 (A) - { 0x3F, 0x66, 0x66, 0x3E, 0x66, 0x66, 0x3F, 0x00}, // U+0042 (B) - { 0x3C, 0x66, 0x03, 0x03, 0x03, 0x66, 0x3C, 0x00}, // U+0043 (C) - { 0x1F, 0x36, 0x66, 0x66, 0x66, 0x36, 0x1F, 0x00}, // U+0044 (D) - { 0x7F, 0x46, 0x16, 0x1E, 0x16, 0x46, 0x7F, 0x00}, // U+0045 (E) - { 0x7F, 0x46, 0x16, 0x1E, 0x16, 0x06, 0x0F, 0x00}, // U+0046 (F) - { 0x3C, 0x66, 0x03, 0x03, 0x73, 0x66, 0x7C, 0x00}, // U+0047 (G) - { 0x33, 0x33, 0x33, 0x3F, 0x33, 0x33, 0x33, 0x00}, // U+0048 (H) - { 0x1E, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+0049 (I) - { 0x78, 0x30, 0x30, 0x30, 0x33, 0x33, 0x1E, 0x00}, // U+004A (J) - { 0x67, 0x66, 0x36, 0x1E, 0x36, 0x66, 0x67, 0x00}, // U+004B (K) - { 0x0F, 0x06, 0x06, 0x06, 0x46, 0x66, 0x7F, 0x00}, // U+004C (L) - { 0x63, 0x77, 0x7F, 0x7F, 0x6B, 0x63, 0x63, 0x00}, // U+004D (M) - { 0x63, 0x67, 0x6F, 0x7B, 0x73, 0x63, 0x63, 0x00}, // U+004E (N) - { 0x1C, 0x36, 0x63, 0x63, 0x63, 0x36, 0x1C, 0x00}, // U+004F (O) - { 0x3F, 0x66, 0x66, 0x3E, 0x06, 0x06, 0x0F, 0x00}, // U+0050 (P) - { 0x1E, 0x33, 0x33, 0x33, 0x3B, 0x1E, 0x38, 0x00}, // U+0051 (Q) - { 0x3F, 0x66, 0x66, 0x3E, 0x36, 0x66, 0x67, 0x00}, // U+0052 (R) - { 0x1E, 0x33, 0x07, 0x0E, 0x38, 0x33, 0x1E, 0x00}, // U+0053 (S) - { 0x3F, 0x2D, 0x0C, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+0054 (T) - { 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x3F, 0x00}, // U+0055 (U) - { 0x33, 0x33, 0x33, 0x33, 0x33, 0x1E, 0x0C, 0x00}, // U+0056 (V) - { 0x63, 0x63, 0x63, 0x6B, 0x7F, 0x77, 0x63, 0x00}, // U+0057 (W) - { 0x63, 0x63, 0x36, 0x1C, 0x1C, 0x36, 0x63, 0x00}, // U+0058 (X) - { 0x33, 0x33, 0x33, 0x1E, 0x0C, 0x0C, 0x1E, 0x00}, // U+0059 (Y) - { 0x7F, 0x63, 0x31, 0x18, 0x4C, 0x66, 0x7F, 0x00}, // U+005A (Z) - { 0x1E, 0x06, 0x06, 0x06, 0x06, 0x06, 0x1E, 0x00}, // U+005B ([) - { 0x03, 0x06, 0x0C, 0x18, 0x30, 0x60, 0x40, 0x00}, // U+005C (\) - { 0x1E, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1E, 0x00}, // U+005D (]) - { 0x08, 0x1C, 0x36, 0x63, 0x00, 0x00, 0x00, 0x00}, // U+005E (^) - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF}, // U+005F (_) - { 0x0C, 0x0C, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0060 (`) - { 0x00, 0x00, 0x1E, 0x30, 0x3E, 0x33, 0x6E, 0x00}, // U+0061 (a) - { 0x07, 0x06, 0x06, 0x3E, 0x66, 0x66, 0x3B, 0x00}, // U+0062 (b) - { 0x00, 0x00, 0x1E, 0x33, 0x03, 0x33, 0x1E, 0x00}, // U+0063 (c) - { 0x38, 0x30, 0x30, 0x3e, 0x33, 0x33, 0x6E, 0x00}, // U+0064 (d) - { 0x00, 0x00, 0x1E, 0x33, 0x3f, 0x03, 0x1E, 0x00}, // U+0065 (e) - { 0x1C, 0x36, 0x06, 0x0f, 0x06, 0x06, 0x0F, 0x00}, // U+0066 (f) - { 0x00, 0x00, 0x6E, 0x33, 0x33, 0x3E, 0x30, 0x1F}, // U+0067 (g) - { 0x07, 0x06, 0x36, 0x6E, 0x66, 0x66, 0x67, 0x00}, // U+0068 (h) - { 0x0C, 0x00, 0x0E, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+0069 (i) - { 0x30, 0x00, 0x30, 0x30, 0x30, 0x33, 0x33, 0x1E}, // U+006A (j) - { 0x07, 0x06, 0x66, 0x36, 0x1E, 0x36, 0x67, 0x00}, // U+006B (k) - { 0x0E, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+006C (l) - { 0x00, 0x00, 0x33, 0x7F, 0x7F, 0x6B, 0x63, 0x00}, // U+006D (m) - { 0x00, 0x00, 0x1F, 0x33, 0x33, 0x33, 0x33, 0x00}, // U+006E (n) - { 0x00, 0x00, 0x1E, 0x33, 0x33, 0x33, 0x1E, 0x00}, // U+006F (o) - { 0x00, 0x00, 0x3B, 0x66, 0x66, 0x3E, 0x06, 0x0F}, // U+0070 (p) - { 0x00, 0x00, 0x6E, 0x33, 0x33, 0x3E, 0x30, 0x78}, // U+0071 (q) - { 0x00, 0x00, 0x3B, 0x6E, 0x66, 0x06, 0x0F, 0x00}, // U+0072 (r) - { 0x00, 0x00, 0x3E, 0x03, 0x1E, 0x30, 0x1F, 0x00}, // U+0073 (s) - { 0x08, 0x0C, 0x3E, 0x0C, 0x0C, 0x2C, 0x18, 0x00}, // U+0074 (t) - { 0x00, 0x00, 0x33, 0x33, 0x33, 0x33, 0x6E, 0x00}, // U+0075 (u) - { 0x00, 0x00, 0x33, 0x33, 0x33, 0x1E, 0x0C, 0x00}, // U+0076 (v) - { 0x00, 0x00, 0x63, 0x6B, 0x7F, 0x7F, 0x36, 0x00}, // U+0077 (w) - { 0x00, 0x00, 0x63, 0x36, 0x1C, 0x36, 0x63, 0x00}, // U+0078 (x) - { 0x00, 0x00, 0x33, 0x33, 0x33, 0x3E, 0x30, 0x1F}, // U+0079 (y) - { 0x00, 0x00, 0x3F, 0x19, 0x0C, 0x26, 0x3F, 0x00}, // U+007A (z) - { 0x38, 0x0C, 0x0C, 0x07, 0x0C, 0x0C, 0x38, 0x00}, // U+007B ({) - { 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x00}, // U+007C (|) - { 0x07, 0x0C, 0x0C, 0x38, 0x0C, 0x0C, 0x07, 0x00}, // U+007D (}) - { 0x6E, 0x3B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+007E (~) - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} // U+007F -}; - diff --git a/MCUME_pico/pico5200/pico5200.cpp b/MCUME_pico/pico5200/pico5200.cpp index c1814ec..519b3ca 100644 --- a/MCUME_pico/pico5200/pico5200.cpp +++ b/MCUME_pico/pico5200/pico5200.cpp @@ -1,5 +1,7 @@ #include "pico.h" #include "pico/stdlib.h" +#include "hardware/clocks.h" +#include "hardware/vreg.h" extern "C" { #include "iopins.h" @@ -11,116 +13,115 @@ extern "C" { #include "atari5200.h" } #include +#include "pico_dsp.h" -#include "hardware/clocks.h" -#include "hardware/vreg.h" +volatile bool vbl=true; -#ifdef USE_VGA -#include "vga_t_dma.h" -#else -#include "tft_t_dma.h" -#endif -TFT_T_DMA tft; +bool repeating_timer_callback(struct repeating_timer *t) { + //uint16_t bClick = emu_DebounceLocalKeys(); + //emu_Input(bClick); + if (vbl) { + vbl = false; + } else { + vbl = true; + } + return true; +} +PICO_DSP tft; static int skip=0; int main(void) { - vreg_set_voltage(VREG_VOLTAGE_1_05); +// vreg_set_voltage(VREG_VOLTAGE_1_05); // set_sys_clock_khz(125000, true); // set_sys_clock_khz(150000, true); // set_sys_clock_khz(133000, true); // set_sys_clock_khz(200000, true); -// set_sys_clock_khz(225000, true); - set_sys_clock_khz(250000, true); - + set_sys_clock_khz(225000, true); +// set_sys_clock_khz(250000, true); stdio_init_all(); -#ifdef USE_VGA -// tft.begin(VGA_MODE_400x240); - tft.begin(VGA_MODE_320x240); -#else - tft.begin(); -#endif + emu_init(); - while (true) { + char * filename; +#ifdef FILEBROWSER + while (true) { if (menuActive()) { uint16_t bClick = emu_DebounceLocalKeys(); int action = handleMenu(bClick); - char * filename = menuSelection(); - if (action == ACTION_RUNTFT) { - toggleMenu(false); - emu_start(); - emu_Init(filename); - tft.fillScreenNoDma( RGBVAL16(0x00,0x00,0x00) ); - tft.startDMA(); - } + filename = menuSelection(); + if (action == ACTION_RUN) { + break; + } tft.waitSync(); } - else { - emu_Step(); - uint16_t bClick = emu_DebounceLocalKeys(); - emu_Input(bClick); - } - //int c = getchar_timeout_us(0); - //switch (c) { - // case ' ': - // printf("test: %d\n", 1); - // break; - //} + } +#endif + emu_start(); + emu_Init(filename); + tft.startRefresh(); + //struct repeating_timer timer; + //add_repeating_timer_ms(5, repeating_timer_callback, NULL, &timer); + while (true) { + uint16_t bClick = emu_DebounceLocalKeys(); + emu_Input(bClick); + emu_Step(); } } -static unsigned char palette8[PALETTE_SIZE]; static unsigned short palette16[PALETTE_SIZE]; - void emu_SetPaletteEntry(unsigned char r, unsigned char g, unsigned char b, int index) { if (index. - - Diese Datei ist Teil von Teensy64. - - Teensy64 ist Freie Software: Sie können es unter den Bedingungen - der GNU General Public License, wie von der Free Software Foundation, - Version 3 der Lizenz oder (nach Ihrer Wahl) jeder späteren - veröffentlichten Version, weiterverbreiten und/oder modifizieren. - - Teensy64 wird in der Hoffnung, dass es nützlich sein wird, aber - OHNE JEDE GEWÄHRLEISTUNG, bereitgestellt; sogar ohne die implizite - Gewährleistung der MARKTFÄHIGKEIT oder EIGNUNG FÜR EINEN BESTIMMTEN ZWECK. - Siehe die GNU General Public License für weitere Details. - - Sie sollten eine Kopie der GNU General Public License zusammen mit diesem - Programm erhalten haben. Wenn nicht, siehe . - -*/ - -/* - TODOs: - - Fix Bugs.. - - FLD - (OK 08/17) test this more.. - - Sprite Stretching (requires "MOBcounter") - - BA Signal -> CPU - - xFLI - - ... - - DMA Delay (?) - needs partial rewrite (idle - > badline in middle of line. Is the 3.6 fast enough??) - - optimize more -*/ - -#include "Teensy64.h" -#include "vic.h" -#include -#include -#include - -#define min(a, b) (((a) < (b)) ? (a) : (b)) -#define max(a, b) (((a) > (b)) ? (a) : (b)) - -#define PALETTE(r,g,b) (RGBVAL16(r,g,b)) //(((r & 0xF8) << 8) | ((g & 0xFC) << 3) | (b >> 3)) -#include "vic_palette.h" - -#ifdef USE_VGA -typedef uint8_t tpixel; -#else -typedef uint16_t tpixel; -#endif - - -static tpixel * SCREENMEM=NULL; -static int LINE_MEM_WIDTH=0; -static int REAL_XRES=0; -static int REAL_YRES=0; - -#define SCREEN_WIDTH (320) - -/* -static int BORDER=0; -static int SCREEN_HEIGHT=0; -static int FIRSTDISPLAYLINE=0; -static int LASTDISPLAYLINE=0; -static int BORDER_LEFT=0; -static int BORDER_RIGHT=0; -*/ - -#define BORDER ((REAL_YRES-200)/2) -#define SCREEN_HEIGHT (200+2*BORDER) -#define FIRSTDISPLAYLINE ( 51 - BORDER ) -#define LASTDISPLAYLINE ( 250 + BORDER ) -#define BORDER_LEFT ((REAL_XRES-320)/2) -#define BORDER_RIGHT ((REAL_XRES-320)/2) - -#define MAXCYCLESSPRITES0_2 3 -#define MAXCYCLESSPRITES3_7 5 -#define MAXCYCLESSPRITES (MAXCYCLESSPRITES0_2 + MAXCYCLESSPRITES3_7) - - - -/*****************************************************************************************************/ -/*****************************************************************************************************/ -/*****************************************************************************************************/ - -inline __attribute__((always_inline)) -void fastFillLine(tpixel * p, const tpixel * pe, const uint16_t col, uint16_t * spl); -inline __attribute__((always_inline)) -void fastFillLineNoSprites(tpixel * p, const tpixel * pe, const uint16_t col); - - -/*****************************************************************************************************/ -/*****************************************************************************************************/ -/*****************************************************************************************************/ - -#define SPRITENUM(data) (1 << ((data >> 8) & 0x07)) -#define CHARSETPTR() cpu.vic.charsetPtr = cpu.vic.charsetPtrBase + cpu.vic.rc; -#define CYCLES(x) {if (cpu.vic.badline) {cia_clockt(x);} else {cpu_clock(x);} } - -#define BADLINE(x) {if (cpu.vic.badline) { \ - cpu.vic.lineMemChr[x] = cpu.RAM[cpu.vic.videomatrix + vc + x]; \ - cpu.vic.lineMemCol[x] = cpu.vic.COLORRAM[vc + x]; \ - cia1_clock(1); \ - cia2_clock(1); \ - } else { \ - cpu_clock(1); \ - } \ - }; - -#define SPRITEORFIXEDCOLOR() \ - sprite = *spl++; \ - if (sprite) { \ - *p++ = cpu.vic.palette[sprite & 0x0f]; \ - } else { \ - *p++ = col; \ - } - - -#if 0 -#define PRINTOVERFLOW \ - if (p>pe) { \ - Serial.print("VIC overflow Mode "); \ - Serial.println(mode); \ - } - -#define PRINTOVERFLOWS \ - if (p>pe) { \ - Serial.print("VIC overflow (Sprite) Mode "); \ - Serial.println(mode); \ - } -#else -#define PRINTOVERFLOW -#define PRINTOVERFLOWS -#endif - -/*****************************************************************************************************/ -void mode0 (tpixel *p, const tpixel *pe, uint16_t *spl, const uint16_t vc) { - // Standard-Textmodus(ECM/BMM/MCM=0/0/0) - /* - Standard-Textmodus (ECM / BMM / MCM = 0/0/0) - In diesem Modus (wie in allen Textmodi) liest der VIC aus der videomatrix 8-Bit-Zeichenzeiger, - die die Adresse der Punktmatrix des Zeichens im Zeichengenerator angibt. Damit ist ein Zeichensatz - von 256 Zeichen verfügbar, die jeweils aus 8×8 Pixeln bestehen, die in 8 aufeinanderfolgenden Bytes - im Zeichengenerator abgelegt sind. Mit den Bits VM10-13 und CB11-13 aus Register $d018 lassen sich - videomatrix und Zeichengenerator im Speicher verschieben. Im Standard-Textmodus entspricht jedes Bit - im Zeichengenerator direkt einem Pixel auf dem Bildschirm. Die Vordergrundfarbe ist für jedes Zeichen - im Farbnibble aus der videomatrix angegeben, die Hintergrundfarbe wird global durch Register $d021 festgelegt. - - +----+----+----+----+----+----+----+----+ - | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | - +----+----+----+----+----+----+----+----+ - | 8 Pixel (1 Bit/Pixel) | - | | - | "0": Hintergrundfarbe 0 ($d021) | - | "1": Farbe aus Bits 8-11 der c-Daten | - +---------------------------------------+ - - */ - - uint8_t chr, pixel; - uint16_t fgcol; - uint16_t bgcol; - uint16_t x = 0; - - CHARSETPTR(); - - if (cpu.vic.lineHasSprites) { - - do { - - BADLINE(x); - - chr = cpu.vic.charsetPtr[cpu.vic.lineMemChr[x] * 8]; - fgcol = cpu.vic.lineMemCol[x]; - x++; - unsigned m = min(8, pe - p); - for (unsigned i = 0; i < m; i++) { - int sprite = *spl++; - - if (sprite) { // Sprite: Ja - int spritenum = SPRITENUM(sprite); - int spritepixel = sprite & 0x0f; - - if (sprite & 0x4000) { // Sprite: Hinter Text MDP = 1 - if (chr & 0x80) { - cpu.vic.fgcollision |= spritenum; - pixel = fgcol; - } else { - pixel = spritepixel; - } - } else { // Sprite: Vor Text //MDP = 0 - if (chr & 0x80) cpu.vic.fgcollision |= spritenum; - pixel = spritepixel; - } - } else { // Kein Sprite - pixel = (chr & 0x80) ? fgcol : cpu.vic.B0C; - } - - *p++ = cpu.vic.palette[pixel]; - chr = chr << 1; - - } - } while (p < pe); - PRINTOVERFLOWS - } else { //Keine Sprites - - while (p < pe - 8) { - - BADLINE(x) - - chr = cpu.vic.charsetPtr[cpu.vic.lineMemChr[x] * 8]; - fgcol = cpu.vic.palette[cpu.vic.lineMemCol[x]]; - bgcol = cpu.vic.colors[1]; - x++; - - *p++ = (chr & 0x80) ? fgcol : bgcol; - *p++ = (chr & 0x40) ? fgcol : bgcol; - *p++ = (chr & 0x20) ? fgcol : bgcol; - *p++ = (chr & 0x10) ? fgcol : bgcol; - *p++ = (chr & 0x08) ? fgcol : bgcol; - *p++ = (chr & 0x04) ? fgcol : bgcol; - *p++ = (chr & 0x02) ? fgcol : bgcol; - *p++ = (chr & 0x01) ? fgcol : bgcol; - - }; - - while (p < pe) { - - BADLINE(x) - - chr = cpu.vic.charsetPtr[cpu.vic.lineMemChr[x] * 8]; - fgcol = cpu.vic.palette[cpu.vic.lineMemCol[x]]; - bgcol = cpu.vic.colors[1]; - x++; - - *p++ = (chr & 0x80) ? fgcol : bgcol; if (p >= pe) break; - *p++ = (chr & 0x40) ? fgcol : bgcol; if (p >= pe) break; - *p++ = (chr & 0x20) ? fgcol : bgcol; if (p >= pe) break; - *p++ = (chr & 0x10) ? fgcol : bgcol; if (p >= pe) break; - *p++ = (chr & 0x08) ? fgcol : bgcol; if (p >= pe) break; - *p++ = (chr & 0x04) ? fgcol : bgcol; if (p >= pe) break; - *p++ = (chr & 0x02) ? fgcol : bgcol; if (p >= pe) break; - *p++ = (chr & 0x01) ? fgcol : bgcol; - }; - PRINTOVERFLOW - } - while (x<40) {BADLINE(x); x++;} -}; - -/*****************************************************************************************************/ -void mode1 (tpixel *p, const tpixel *pe, uint16_t *spl, const uint16_t vc) { - /* - Multicolor-Textmodus (ECM/BMM/MCM=0/0/1) - Dieser Modus ermöglicht es, auf Kosten der horizontalen Auflösung vierfarbige Zeichen darzustellen. - Ist Bit 11 der c-Daten Null, wird das Zeichen wie im Standard-Textmodus dargestellt, wobei aber nur die - Farben 0-7 für den Vordergrund zur Verfügung stehen. Ist Bit 11 gesetzt, bilden jeweils zwei horizontal - benachbarte Bits der Punktmatrix ein Pixel. Dadurch ist die Auflösung des Zeichens auf 4×8 reduziert - (die Pixel sind doppelt so breit, die Gesamtbreite der Zeichen ändert sich also nicht). - Interessant ist, daß nicht nur die Bitkombination „00”, sondern auch „01” für die Spritepriorität - und -kollisionserkennung zum "Hintergrund" gezählt wird. - - +----+----+----+----+----+----+----+----+ - | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | - +----+----+----+----+----+----+----+----+ - | 8 Pixel (1 Bit/Pixel) | - | | MC-Flag = 0 - | "0": Hintergrundfarbe 0 ($d021) | - | "1": Farbe aus Bits 8-10 der c-Daten | - +---------------------------------------+ - | 4 Pixel (2 Bit/Pixel) | - | | - | "00": Hintergrundfarbe 0 ($d021) | MC-Flag = 1 - | "01": Hintergrundfarbe 1 ($d022) | - | "10": Hintergrundfarbe 2 ($d023) | - | "11": Farbe aus Bits 8-10 der c-Daten | - +---------------------------------------+ - - */ - - // POKE 53270,PEEK(53270) OR 16 - // poke 53270,peek(53270) or 16 - - uint16_t bgcol, fgcol, pixel; - uint16_t colors[4]; - uint8_t chr; - uint8_t x = 0; - - CHARSETPTR(); - - if (cpu.vic.lineHasSprites) { - - colors[0] = cpu.vic.B0C; - - do { - - if (cpu.vic.idle) { - cpu_clock(1); - fgcol = colors[1] = colors[2] = colors[3] = 0; - chr = cpu.RAM[cpu.vic.bank + 0x3fff]; - } else { - BADLINE(x); - fgcol = cpu.vic.lineMemCol[x]; - colors[1] = cpu.vic.R[0x22]; - colors[2] = cpu.vic.R[0x23]; - colors[3] = fgcol & 0x07; - chr = cpu.vic.charsetPtr[cpu.vic.lineMemChr[x] * 8]; - } - - x++; - - if ((fgcol & 0x08) == 0) { //Zeichen ist HIRES - - unsigned m = min(8, pe - p); - for (unsigned i = 0; i < m; i++) { - - int sprite = *spl++; - - if (sprite) { // Sprite: Ja - - /* - Sprite-Prioritäten (Anzeige) - MDP = 1: Grafikhintergrund, Sprite, Vordergrund - MDP = 0: Grafikhintergrund, Vordergrund, Sprite - - Kollision: - Eine Kollision zwischen Sprites und anderen Grafikdaten wird erkannt, - sobald beim Bildaufbau ein nicht transparentes Spritepixel und ein Vordergrundpixel ausgegeben wird. - - */ - int spritenum = SPRITENUM(sprite); - pixel = sprite & 0x0f; //Hintergrundgrafik - if (sprite & 0x4000) { // MDP = 1 - if (chr & 0x80) { //Vordergrundpixel ist gesetzt - cpu.vic.fgcollision |= spritenum; - pixel = colors[3]; - } - } else { // MDP = 0 - if (chr & 0x80) cpu.vic.fgcollision |= spritenum; //Vordergrundpixel ist gesetzt - } - - } else { // Kein Sprite - pixel = (chr >> 7) ? colors[3] : colors[0]; - } - - *p++ = cpu.vic.palette[pixel]; - - chr = chr << 1; - } - - } else {//Zeichen ist MULTICOLOR - - for (unsigned i = 0; i < 4; i++) { - if (p >= pe) break; - int c = (chr >> 6) & 0x03; - chr = chr << 2; - - int sprite = *spl++; - - if (sprite) { // Sprite: Ja - int spritenum = SPRITENUM(sprite); - pixel = sprite & 0x0f; //Hintergrundgrafik - if (sprite & 0x4000) { // MDP = 1 - - if (chr & 0x80) { //Vordergrundpixel ist gesetzt - cpu.vic.fgcollision |= spritenum; - pixel = colors[c]; - } - - } else { // MDP = 0 - if (chr & 0x80) cpu.vic.fgcollision |= spritenum; //Vordergrundpixel ist gesetzt - } - - } else { // Kein Sprite - pixel = colors[c]; - - } - *p++ = cpu.vic.palette[pixel]; - if (p >= pe) break; - - sprite = *spl++; - - //Das gleiche nochmal für das nächste Pixel - if (sprite) { // Sprite: Ja - int spritenum = SPRITENUM(sprite); - pixel = sprite & 0x0f; //Hintergrundgrafik - if (sprite & 0x4000) { // MDP = 1 - - if (chr & 0x80) { //Vordergrundpixel ist gesetzt - cpu.vic.fgcollision |= spritenum; - pixel = colors[c]; - } - } else { // MDP = 0 - if (chr & 0x80) cpu.vic.fgcollision |= spritenum; //Vordergrundpixel ist gesetzt - } - } else { // Kein Sprite - pixel = colors[c]; - } - *p++ = cpu.vic.palette[pixel]; - - } - - } - - } while (p < pe); - PRINTOVERFLOWS - } else { //Keine Sprites - - while (p < pe - 8) { - - int c; - - bgcol = cpu.vic.colors[1]; - colors[0] = bgcol; - - if (cpu.vic.idle) { - cpu_clock(1); - c = colors[1] = colors[2] = colors[3] = 0; - chr = cpu.RAM[cpu.vic.bank + 0x3fff]; - } else { - BADLINE(x); - - colors[1] = cpu.vic.colors[2]; - colors[2] = cpu.vic.colors[3]; - - chr = cpu.vic.charsetPtr[cpu.vic.lineMemChr[x] * 8]; - c = cpu.vic.lineMemCol[x]; - } - - x++; - - if ((c & 0x08) == 0) { //Zeichen ist HIRES - fgcol = cpu.vic.palette[c & 0x07]; - *p++ = (chr & 0x80) ? fgcol : bgcol; - *p++ = (chr & 0x40) ? fgcol : bgcol; - *p++ = (chr & 0x20) ? fgcol : bgcol; - *p++ = (chr & 0x10) ? fgcol : bgcol; - *p++ = (chr & 0x08) ? fgcol : bgcol; - *p++ = (chr & 0x04) ? fgcol : bgcol; - *p++ = (chr & 0x02) ? fgcol : bgcol; - *p++ = (chr & 0x01) ? fgcol : bgcol; - } else {//Zeichen ist MULTICOLOR - - colors[3] = cpu.vic.palette[c & 0x07]; - pixel = colors[(chr >> 6) & 0x03]; *p++ = pixel; *p++ = pixel; - pixel = colors[(chr >> 4) & 0x03]; *p++ = pixel; *p++ = pixel; - pixel = colors[(chr >> 2) & 0x03]; *p++ = pixel; *p++ = pixel; - pixel = colors[(chr ) & 0x03]; *p++ = pixel; *p++ = pixel; - } - - }; - - while (p < pe) { - - int c; - - bgcol = cpu.vic.colors[1]; - colors[0] = bgcol; - - if (cpu.vic.idle) { - cpu_clock(1); - c = colors[1] = colors[2] = colors[3] = 0; - chr = cpu.RAM[cpu.vic.bank + 0x3fff]; - } else { - BADLINE(x); - - colors[1] = cpu.vic.colors[2]; - colors[2] = cpu.vic.colors[3]; - - chr = cpu.vic.charsetPtr[cpu.vic.lineMemChr[x] * 8]; - c = cpu.vic.lineMemCol[x]; - } - - x++; - - if ((c & 0x08) == 0) { //Zeichen ist HIRES - fgcol = cpu.vic.palette[c & 0x07]; - *p++ = (chr & 0x80) ? fgcol : bgcol; if (p >= pe) break; - *p++ = (chr & 0x40) ? fgcol : bgcol; if (p >= pe) break; - *p++ = (chr & 0x20) ? fgcol : bgcol; if (p >= pe) break; - *p++ = (chr & 0x10) ? fgcol : bgcol; if (p >= pe) break; - *p++ = (chr & 0x08) ? fgcol : bgcol; if (p >= pe) break; - *p++ = (chr & 0x04) ? fgcol : bgcol; if (p >= pe) break; - *p++ = (chr & 0x02) ? fgcol : bgcol; if (p >= pe) break; - *p++ = (chr & 0x01) ? fgcol : bgcol; - } else {//Zeichen ist MULTICOLOR - - colors[3] = cpu.vic.palette[c & 0x07]; - pixel = colors[(chr >> 6) & 0x03]; *p++ = pixel; if (p >= pe) break; *p++ = pixel; if (p >= pe) break; - pixel = colors[(chr >> 4) & 0x03]; *p++ = pixel; if (p >= pe) break; *p++ = pixel; if (p >= pe) break; - pixel = colors[(chr >> 2) & 0x03]; *p++ = pixel; if (p >= pe) break; *p++ = pixel; if (p >= pe) break; - pixel = colors[(chr ) & 0x03]; *p++ = pixel; if (p >= pe) break; *p++ = pixel; - } - - }; - PRINTOVERFLOW - } - while (x<40) {BADLINE(x); x++;} -} - -/*****************************************************************************************************/ -void mode2 (tpixel *p, const tpixel *pe, uint16_t *spl, const uint16_t vc) { - /* - Standard-Bitmap-Modus (ECM / BMM / MCM = 0/1/0) ("HIRES") - In diesem Modus (wie in allen Bitmap-Modi) liest der VIC die Grafikdaten aus einer 320×200-Bitmap, - in der jedes Bit direkt einem Punkt auf dem Bildschirm entspricht. Die Daten aus der videomatrix - werden für die Farbinformation benutzt. Da die videomatrix weiterhin nur eine 40×25-Matrix ist, - können die Farben nur für Blöcke von 8×8 Pixeln individuell bestimmt werden (also eine Art YC-8:1-Format). - Da die Entwickler des VIC-II den Bitmap-Modus mit sowenig zusätzlichem Schaltungsaufwand wie möglich realisieren wollten - (der VIC-I hatte noch keinen Bitmap-Modus), ist die Bitmap etwas ungewöhnlich im Speicher abgelegt: - Im Gegensatz zu modernen Videochips, die die Bitmap linear aus dem Speicher lesen, bilden beim VIC jeweils 8 aufeinanderfolgende Bytes einen 8×8-Pixelblock - auf dem Bildschirm. Mit den Bits VM10-13 und CB13 aus Register $d018 lassen sich videomatrix und Bitmap im Speicher verschieben. - Im Standard-Bitmap-Modus entspricht jedes Bit in der Bitmap direkt einem Pixel auf dem Bildschirm. - Für jeden 8×8-Block können Vorder- und Hintergrundfarbe beliebig eingestellt werden. - - +----+----+----+----+----+----+----+----+ - | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | - +----+----+----+----+----+----+----+----+ - | 8 Pixel (1 Bit/Pixel) | - | | - | "0": Farbe aus Bits 0-3 der c-Daten | - | "1": Farbe aus Bits 4-7 der c-Daten | - +---------------------------------------+ - - - http://www.devili.iki.fi/Computers/Commodore/C64/Programmers_Reference/Chapter_3/page_127.html - */ - - uint8_t chr; - uint16_t fgcol, pixel; - uint16_t bgcol; - uint8_t x = 0; - uint8_t * bP = cpu.vic.bitmapPtr + vc * 8 + cpu.vic.rc; - - if (cpu.vic.lineHasSprites) { - do { - - BADLINE(x); - - uint8_t t = cpu.vic.lineMemChr[x]; - fgcol = t >> 4; - bgcol = t & 0x0f; - chr = bP[x * 8]; - - x++; - - unsigned m = min(8, pe - p); - for (unsigned i = 0; i < m; i++) { - - int sprite = *spl++; - - chr = chr << 1; - if (sprite) { // Sprite: Ja - /* - Sprite-Prioritäten (Anzeige) - MDP = 1: Grafikhintergrund, Sprite, Vordergrund - MDP = 0: Grafikhintergung, Vordergrund, Sprite - - Kollision: - Eine Kollision zwischen Sprites und anderen Grafikdaten wird erkannt, - sobald beim Bildaufbau ein nicht transparentes Spritepixel und ein Vordergrundpixel ausgegeben wird. - - */ - int spritenum = SPRITENUM(sprite); - pixel = sprite & 0x0f; //Hintergrundgrafik - if (sprite & 0x4000) { // MDP = 1 - if (chr & 0x80) { //Vordergrundpixel ist gesetzt - cpu.vic.fgcollision |= spritenum; - pixel = fgcol; - } - } else { // MDP = 0 - if (chr & 0x80) cpu.vic.fgcollision |= spritenum; //Vordergrundpixel ist gesetzt - } - - } else { // Kein Sprite - pixel = (chr & 0x80) ? fgcol :cpu.vic.B0C; - } - - *p++ = cpu.vic.palette[pixel]; - - } - } while (p < pe); - PRINTOVERFLOWS - } else { //Keine Sprites - - while (p < pe - 8) { - //color-ram not used! - BADLINE(x); - - uint8_t t = cpu.vic.lineMemChr[x]; - fgcol = cpu.vic.palette[t >> 4]; - bgcol = cpu.vic.palette[t & 0x0f]; - chr = bP[x * 8]; - x++; - - *p++ = (chr & 0x80) ? fgcol : bgcol; - *p++ = (chr & 0x40) ? fgcol : bgcol; - *p++ = (chr & 0x20) ? fgcol : bgcol; - *p++ = (chr & 0x10) ? fgcol : bgcol; - *p++ = (chr & 0x08) ? fgcol : bgcol; - *p++ = (chr & 0x04) ? fgcol : bgcol; - *p++ = (chr & 0x02) ? fgcol : bgcol; - *p++ = (chr & 0x01) ? fgcol : bgcol; - }; - while (p < pe) { - //color-ram not used! - BADLINE(x); - - uint8_t t = cpu.vic.lineMemChr[x]; - fgcol = cpu.vic.palette[t >> 4]; - bgcol = cpu.vic.palette[t & 0x0f]; - chr = bP[x * 8]; - - x++; - - *p++ = (chr & 0x80) ? fgcol : bgcol; if (p >= pe) break; - *p++ = (chr & 0x40) ? fgcol : bgcol; if (p >= pe) break; - *p++ = (chr & 0x20) ? fgcol : bgcol; if (p >= pe) break; - *p++ = (chr & 0x10) ? fgcol : bgcol; if (p >= pe) break; - *p++ = (chr & 0x08) ? fgcol : bgcol; if (p >= pe) break; - *p++ = (chr & 0x04) ? fgcol : bgcol; if (p >= pe) break; - *p++ = (chr & 0x02) ? fgcol : bgcol; if (p >= pe) break; - *p++ = (chr & 0x01) ? fgcol : bgcol; - - }; - PRINTOVERFLOW - } - while (x<40) {BADLINE(x); x++;} -} -/*****************************************************************************************************/ -void mode3 (tpixel *p, const tpixel *pe, uint16_t *spl, const uint16_t vc) { - /* - Multicolor-Bitmap-Modus (ECM/BMM/MCM=0/1/1) - - Ähnlich wie beim Multicolor-Textmodus bilden auch in diesem Modus jeweils - zwei benachbarte Bits ein (doppelt so breites) Pixel. Die Auflösung - reduziert sich damit auf 160×200 Pixel. - - Genau wie beim Multicolor-Textmodus wird die Bitkombination "01" für die - Spritepriorität und -kollisionserkennung zum "Hintergrund" gezählt. - - +----+----+----+----+----+----+----+----+ - | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | - +----+----+----+----+----+----+----+----+ - | 4 Pixel (2 Bit/Pixel) | - | | - | "00": Hintergrundfarbe 0 ($d021) | - | "01": Farbe aus Bits 4-7 der c-Daten | - | "10": Farbe aus Bits 0-3 der c-Daten | - | "11": Farbe aus Bits 8-11 der c-Daten | - +---------------------------------------+ - - POKE 53265,PEEK(53625)OR 32: POKE 53270,PEEK(53270)OR 16 - */ - uint8_t * bP = cpu.vic.bitmapPtr + vc * 8 + cpu.vic.rc; - uint16_t colors[4]; - uint16_t pixel; - uint8_t chr, x; - - x = 0; - - if (cpu.vic.lineHasSprites) { - colors[0] = cpu.vic.B0C; - do { - - if (cpu.vic.idle) { - cpu_clock(1); - colors[1] = colors[2] = colors[3] = 0; - chr = cpu.RAM[cpu.vic.bank + 0x3fff]; - } else { - BADLINE(x); - uint8_t t = cpu.vic.lineMemChr[x]; - colors[1] = t >> 4;//10 - colors[2] = t & 0x0f; //01 - colors[3] = cpu.vic.lineMemCol[x]; - chr = bP[x * 8]; - }; - - x++; - - for (unsigned i = 0; i < 4; i++) { - if (p >= pe) break; - uint32_t c = (chr >> 6) & 0x03; - chr = chr << 2; - - int sprite = *spl++; - - if (sprite) { // Sprite: Ja - int spritenum = SPRITENUM(sprite); - pixel = sprite & 0x0f; //Hintergrundgrafik - if (sprite & 0x4000) { // MDP = 1 - if (c & 0x02) { //Vordergrundpixel ist gesetzt - cpu.vic.fgcollision |= spritenum; - pixel = colors[c]; - } - } else { // MDP = 0 - if (c & 0x02) cpu.vic.fgcollision |= spritenum; //Vordergundpixel ist gesetzt - } - } else { // Kein Sprite - pixel = colors[c]; - } - - *p++ = cpu.vic.palette[pixel]; - if (p >= pe) break; - - sprite = *spl++; - - if (sprite) { // Sprite: Ja - int spritenum = SPRITENUM(sprite); - pixel = sprite & 0x0f; //Hintergrundgrafik - if (sprite & 0x4000) { // MDP = 1 - - if (c & 0x02) { //Vordergrundpixel ist gesetzt - cpu.vic.fgcollision |= spritenum; - pixel = colors[c]; - } - } else { // MDP = 0 - if (c & 0x02) cpu.vic.fgcollision |= spritenum; //Vordergundpixel ist gesetzt - } - } else { // Kein Sprite - pixel = colors[c]; - } - - *p++ = cpu.vic.palette[pixel]; - - } - - } while (p < pe); - PRINTOVERFLOWS - - } else { //Keine Sprites - - while (p < pe - 8) { - - colors[0] = cpu.vic.colors[1]; - - if (cpu.vic.idle) { - cpu_clock(1); - colors[1] = colors[2] = colors[3] = 0; - chr = cpu.RAM[cpu.vic.bank + 0x3fff]; - } else { - BADLINE(x); - - uint8_t t = cpu.vic.lineMemChr[x]; - colors[1] = cpu.vic.palette[t >> 4];//10 - colors[2] = cpu.vic.palette[t & 0x0f]; //01 - colors[3] = cpu.vic.palette[cpu.vic.lineMemCol[x]]; - chr = bP[x * 8]; - } - - x++; - pixel = colors[(chr >> 6) & 0x03]; *p++ = pixel; *p++ = pixel; - pixel = colors[(chr >> 4) & 0x03]; *p++ = pixel; *p++ = pixel; - pixel = colors[(chr >> 2) & 0x03]; *p++ = pixel; *p++ = pixel; - pixel = colors[chr & 0x03]; *p++ = pixel; *p++ = pixel; - - }; - while (p < pe) { - - colors[0] = cpu.vic.colors[1]; - - if (cpu.vic.idle) { - cpu_clock(1); - colors[1] = colors[2] = colors[3] = 0; - chr = cpu.RAM[cpu.vic.bank + 0x3fff]; - } else { - BADLINE(x); - - uint8_t t = cpu.vic.lineMemChr[x]; - colors[1] = cpu.vic.palette[t >> 4];//10 - colors[2] = cpu.vic.palette[t & 0x0f]; //01 - colors[3] = cpu.vic.palette[cpu.vic.lineMemCol[x]]; - chr = bP[x * 8]; - } - - x++; - pixel = colors[(chr >> 6) & 0x03]; *p++ = pixel; if (p >= pe) break; *p++ = pixel; if (p >= pe) break; - pixel = colors[(chr >> 4) & 0x03]; *p++ = pixel; if (p >= pe) break; *p++ = pixel; if (p >= pe) break; - pixel = colors[(chr >> 2) & 0x03]; *p++ = pixel; if (p >= pe) break; *p++ = pixel; if (p >= pe) break; - pixel = colors[chr & 0x03]; *p++ = pixel; if (p >= pe) break; *p++ = pixel; - - }; - PRINTOVERFLOW - } - while (x<40) {BADLINE(x); x++;} -} -/*****************************************************************************************************/ -void mode4 (tpixel *p, const tpixel *pe, uint16_t *spl, const uint16_t vc) { - //ECM-Textmodus (ECM/BMM/MCM=1/0/0) - /* - Dieser Textmodus entspricht dem Standard-Textmodus, erlaubt es aber, für - jedes einzelne Zeichen eine von vier Hintergrundfarben auszuwählen. Die - Auswahl geschieht über die oberen beiden Bits des Zeichenzeigers. Dadurch - reduziert sich der Zeichenvorrat allerdings von 256 auf 64 Zeichen. - - +----+----+----+----+----+----+----+----+ - | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | - +----+----+----+----+----+----+----+----+ - | 8 Pixel (1 Bit/Pixel) | - | | - | "0": Je nach Bits 6/7 der c-Daten | - | 00: Hintergrundfarbe 0 ($d021) | - | 01: Hintergrundfarbe 1 ($d022) | - | 10: Hintergrundfarbe 2 ($d023) | - | 11: Hintergrundfarbe 3 ($d024) | - | "1": Farbe aus Bits 8-11 der c-Daten | - +---------------------------------------+ - */ - // https://www.c64-wiki.de/wiki/Hintergrundfarbe - // POKE 53265, PEEK(53265) OR 64:REM CURSOR BLINKT ROT abc - - uint8_t chr, pixel; - uint16_t fgcol; - uint16_t bgcol; - uint8_t x = 0; - - CHARSETPTR(); - if (cpu.vic.lineHasSprites) { - do { - - BADLINE(x); - - uint32_t td = cpu.vic.lineMemChr[x]; - bgcol = cpu.vic.R[0x21 + ((td >> 6) & 0x03)]; - chr = cpu.vic.charsetPtr[(td & 0x3f) * 8]; - fgcol = cpu.vic.lineMemCol[x]; - - x++; - - unsigned m = min(8, pe - p); - for (unsigned i = 0; i < m; i++) { - - int sprite = *spl++; - - if (sprite) { // Sprite: Ja - int spritenum = SPRITENUM(sprite); - if (sprite & 0x4000) { // Sprite: Hinter Text - if (chr & 0x80) { - cpu.vic.fgcollision |= spritenum; - pixel = fgcol; - } else pixel = bgcol; - } else { // Sprite: Vor Text - if (chr & 0x80) cpu.vic.fgcollision |= spritenum; - pixel = sprite & 0x0f; - } - } else { // Kein Sprite - pixel = (chr & 0x80) ? fgcol : bgcol; - } - - chr = chr << 1; - *p++ = cpu.vic.palette[pixel]; - } - } while (p < pe); - PRINTOVERFLOWS - } - else //Keine Sprites - while (p < pe - 8) { - - BADLINE(x); - - uint32_t td = cpu.vic.lineMemChr[x]; - bgcol = cpu.vic.palette[cpu.vic.R[0x21 + ((td >> 6) & 0x03)]]; - chr = cpu.vic.charsetPtr[(td & 0x3f) * 8]; - fgcol = cpu.vic.palette[cpu.vic.lineMemCol[x]]; - x++; - - *p++ = (chr & 0x80) ? fgcol : bgcol; - *p++ = (chr & 0x40) ? fgcol : bgcol; - *p++ = (chr & 0x20) ? fgcol : bgcol; - *p++ = (chr & 0x10) ? fgcol : bgcol; - *p++ = (chr & 0x08) ? fgcol : bgcol; - *p++ = (chr & 0x04) ? fgcol : bgcol; - *p++ = (chr & 0x02) ? fgcol : bgcol; - *p++ = (chr & 0x01) ? fgcol : bgcol; - - }; - while (p < pe) { - - BADLINE(x); - - uint32_t td = cpu.vic.lineMemChr[x]; - bgcol = cpu.vic.palette[cpu.vic.R[0x21 + ((td >> 6) & 0x03)]]; - chr = cpu.vic.charsetPtr[(td & 0x3f) * 8]; - fgcol = cpu.vic.palette[cpu.vic.lineMemCol[x]]; - - x++; - - *p++ = (chr & 0x80) ? fgcol : bgcol; if (p >= pe) break; - *p++ = (chr & 0x40) ? fgcol : bgcol; if (p >= pe) break; - *p++ = (chr & 0x20) ? fgcol : bgcol; if (p >= pe) break; - *p++ = (chr & 0x10) ? fgcol : bgcol; if (p >= pe) break; - *p++ = (chr & 0x08) ? fgcol : bgcol; if (p >= pe) break; - *p++ = (chr & 0x04) ? fgcol : bgcol; if (p >= pe) break; - *p++ = (chr & 0x02) ? fgcol : bgcol; if (p >= pe) break; - *p++ = (chr & 0x01) ? fgcol : bgcol; - - }; - PRINTOVERFLOW - while (x<40) {BADLINE(x); x++;} -} - -/*****************************************************************************************************/ -/* Ungültige Modi ************************************************************************************/ -/*****************************************************************************************************/ - -void mode5 (tpixel *p, const tpixel *pe, uint16_t *spl, const uint16_t vc) { - /* - Ungültiger Textmodus (ECM/BMM/MCM=1/0/1) - - Das gleichzeitige Setzen der ECM- und MCM-Bits wählt keinen der - "offiziellen" Grafikmodi des VIC, sondern erzeugt nur schwarze Pixel. - Nichtsdestotrotz erzeugt der Grafikdatensequenzer auch in diesem Modus - intern gültige Grafikdaten, die die Spritekollisionserkennung triggern - können. Über den Umweg der Spritekollisionen kann man die erzeugten Daten - auch auslesen (sehen kann man nichts, das Bild ist schwarz). Man kann so - allerdings nur Vordergrund- und Hintergrundpixel unterscheiden, die - Farbinformation läßt sich aus den Spritekollisionen nicht gewinnen. - - Die erzeugte Grafik entspricht der des Multicolor-Textmodus, allerdings ist - der Zeichenvorrat genau wie im ECM-Modus auf 64 Zeichen eingeschränkt. - */ - CHARSETPTR(); - - uint8_t chr, pixel; - uint16_t fgcol; - uint8_t x = 0; - - if (cpu.vic.lineHasSprites) { - - do { - - BADLINE(x); - - chr = cpu.vic.charsetPtr[(cpu.vic.lineMemChr[x] & 0x3F) * 8]; - fgcol = cpu.vic.lineMemCol[x]; - - x++; - - if ((fgcol & 0x08) == 0) { //Zeichen ist HIRES - - unsigned m = min(8, pe - p); - for (unsigned i = 0; i < m; i++) { - - int sprite = *spl; - *spl++ = 0; - - if (sprite) { // Sprite: Ja - - /* - Sprite-Prioritäten (Anzeige) - MDP = 1: Grafikhintergrund, Sprite, Vordergrund - MDP = 0: Grafikhintergrund, Vordergrund, Sprite - - Kollision: - Eine Kollision zwischen Sprites und anderen Grafikdaten wird erkannt, - sobald beim Bildaufbau ein nicht transparentes Spritepixel und ein Vordergrundpixel ausgegeben wird. - - */ - int spritenum = SPRITENUM(sprite); - pixel = sprite & 0x0f; //Hintergrundgrafik - - if (sprite & 0x4000) { // MDP = 1 - if (chr & 0x80) { //Vordergrundpixel ist gesetzt - cpu.vic.fgcollision |= spritenum; - pixel = 0; - } - } else { // MDP = 0 - if (chr & 0x80) cpu.vic.fgcollision |= spritenum; //Vordergrundpixel ist gesetzt - } - - } else { // Kein Sprite - pixel = 0; - } - - *p++ = cpu.vic.palette[pixel]; - - chr = chr << 1; - } - - } else {//Zeichen ist MULTICOLOR - - for (unsigned i = 0; i < 4; i++) { - if (p >= pe) break; - - chr = chr << 2; - - int sprite = *spl; - *spl++ = 0; - - if (sprite) { // Sprite: Ja - int spritenum = SPRITENUM(sprite); - pixel = sprite & 0x0f; //Hintergrundgrafik - if (sprite & 0x4000) { // MDP = 1 - - if (chr & 0x80) { //Vordergrundpixel ist gesetzt - cpu.vic.fgcollision |= spritenum; - pixel = 0; - } - } else { // MDP = 0 - if (chr & 0x80) cpu.vic.fgcollision |= spritenum; //Vordergrundpixel ist gesetzt - } - - } else { // Kein Sprite - pixel = 0; - - } - *p++ = cpu.vic.palette[pixel]; - if (p >= pe) break; - - sprite = *spl; - *spl++ = 0; - //Das gleiche nochmal für das nächste Pixel - if (sprite) { // Sprite: Ja - int spritenum = SPRITENUM(sprite); - pixel = sprite & 0x0f; //Hintergrundgrafik - if (sprite & 0x4000) { // MDP = 1 - if (chr & 0x80) { //Vordergrundpixel ist gesetzt - cpu.vic.fgcollision |= spritenum; - pixel = 0; - } - } else { // MDP = 0 - if (chr & 0x80) cpu.vic.fgcollision |= spritenum; //Vordergrundpixel ist gesetzt - } - } else { // Kein Sprite - pixel = 0; - } - *p++ = cpu.vic.palette[pixel]; - - } - - } - - } while (p < pe); - PRINTOVERFLOWS - - } else { //Keine Sprites - //Farbe immer schwarz - const uint16_t bgcol = palette[0]; - while (p < pe - 8) { - - BADLINE(x); - x++; - *p++ = bgcol; *p++ = bgcol; - *p++ = bgcol; *p++ = bgcol; - *p++ = bgcol; *p++ = bgcol; - *p++ = bgcol; *p++ = bgcol; - - }; - while (p < pe) { - - BADLINE(x); - x++; - *p++ = bgcol; if (p >= pe) break; *p++ = bgcol; if (p >= pe) break; - *p++ = bgcol; if (p >= pe) break; *p++ = bgcol; if (p >= pe) break; - *p++ = bgcol; if (p >= pe) break; *p++ = bgcol; if (p >= pe) break; - *p++ = bgcol; if (p >= pe) break; *p++ = bgcol; - - }; - PRINTOVERFLOW - } - while (x<40) {BADLINE(x); x++;} -} -/*****************************************************************************************************/ -void mode6 (tpixel *p, const tpixel *pe, uint16_t *spl, const uint16_t vc) { - /* - Ungültiger Bitmap-Modus 1 (ECM/BMM/MCM=1/1/0) - - Dieser Modus erzeugt nur ebenfalls nur ein schwarzes Bild, die Pixel lassen - sich allerdings auch hier mit dem Spritekollisionstrick auslesen. - - Der Aufbau der Grafik ist im Prinzip wie im Standard-Bitmap-Modus, aber die - Bits 9 und 10 der g-Adressen sind wegen dem gesetzten ECM-Bit immer Null, - entsprechend besteht auch die Grafik - grob gesagt - aus vier - "Abschnitten", die jeweils viermal wiederholt dargestellt werden. - - */ - - uint8_t chr, pixel; - uint8_t x = 0; - uint8_t * bP = cpu.vic.bitmapPtr + vc * 8 + cpu.vic.rc; - - if (cpu.vic.lineHasSprites) { - - do { - - BADLINE(x); - - chr = bP[x * 8]; - - x++; - - unsigned m = min(8, pe - p); - for (unsigned i = 0; i < m; i++) { - - int sprite = *spl; - *spl++ = 0; - - chr = chr << 1; - if (sprite) { // Sprite: Ja - /* - Sprite-Prioritäten (Anzeige) - MDP = 1: Grafikhintergrund, Sprite, Vordergrund - MDP = 0: Grafikhintergung, Vordergrund, Sprite - - Kollision: - Eine Kollision zwischen Sprites und anderen Grafikdaten wird erkannt, - sobald beim Bildaufbau ein nicht transparentes Spritepixel und ein Vordergrundpixel ausgegeben wird. - - */ - int spritenum = SPRITENUM(sprite); - pixel = sprite & 0x0f; //Hintergrundgrafik - if (sprite & 0x4000) { // MDP = 1 - if (chr & 0x80) { //Vordergrundpixel ist gesetzt - cpu.vic.fgcollision |= spritenum; - pixel = 0; - } - } else { // MDP = 0 - if (chr & 0x80) cpu.vic.fgcollision |= spritenum; //Vordergrundpixel ist gesetzt - } - - } else { // Kein Sprite - pixel = 0; - } - - *p++ = cpu.vic.palette[pixel]; - - } - - } while (p < pe); - PRINTOVERFLOWS - - } else { //Keine Sprites - //Farbe immer schwarz - const uint16_t bgcol = palette[0]; - while (p < pe - 8) { - - BADLINE(x); - x++; - *p++ = bgcol; *p++ = bgcol; - *p++ = bgcol; *p++ = bgcol; - *p++ = bgcol; *p++ = bgcol; - *p++ = bgcol; *p++ = bgcol; - - }; - while (p < pe) { - - BADLINE(x); - x++; - *p++ = bgcol; if (p >= pe) break; *p++ = bgcol; if (p >= pe) break; - *p++ = bgcol; if (p >= pe) break; *p++ = bgcol; if (p >= pe) break; - *p++ = bgcol; if (p >= pe) break; *p++ = bgcol; if (p >= pe) break; - *p++ = bgcol; if (p >= pe) break; *p++ = bgcol; - - }; - PRINTOVERFLOW - } - while (x<40) {BADLINE(x); x++;} -} -/*****************************************************************************************************/ -void mode7 (tpixel *p, const tpixel *pe, uint16_t *spl, const uint16_t vc) { - /* - Ungültiger Bitmap-Modus 2 (ECM/BMM/MCM=1/1/1) - - Der letzte ungültige Modus liefert auch ein schwarzes Bild, das sich jedoch - genauso mit Hilfe der Sprite-Grafik-Kollisionen "abtasten" läßt. - - Der Aufbau der Grafik ist im Prinzip wie im Multicolor-Bitmap-Modus, aber - die Bits 9 und 10 der g-Adressen sind wegen dem gesetzten ECM-Bit immer - Null, was sich in der Darstellung genauso wie beim ersten ungültigen - Bitmap-Modus wiederspiegelt. Die Bitkombination "01" wird wie gewohnt zum - Hintergrund gezählt. - - */ - - uint8_t chr; - uint8_t x = 0; - uint16_t pixel; - uint8_t * bP = cpu.vic.bitmapPtr + vc * 8 + cpu.vic.rc; - - if (cpu.vic.lineHasSprites) { - - do { - - BADLINE(x); - - chr = bP[x * 8]; - x++; - - for (unsigned i = 0; i < 4; i++) { - if (p >= pe) break; - - chr = chr << 2; - - int sprite = *spl; - *spl++ = 0; - - if (sprite) { // Sprite: Ja - int spritenum = SPRITENUM(sprite); - pixel = sprite & 0x0f;//Hintergrundgrafik - if (sprite & 0x4000) { // MDP = 1 - - if (chr & 0x80) { //Vordergrundpixel ist gesetzt - cpu.vic.fgcollision |= spritenum; - pixel = 0; - } - } else { // MDP = 0 - if (chr & 0x80) cpu.vic.fgcollision |= spritenum; //Vordergundpixel ist gesetzt - } - } else { // Kein Sprite - pixel = 0; - } - - *p++ = cpu.vic.palette[pixel]; - if (p >= pe) break; - - sprite = *spl; - *spl++ = 0; - - if (sprite) { // Sprite: Ja - int spritenum = SPRITENUM(sprite); - pixel = sprite & 0x0f;//Hintergrundgrafik - if (sprite & 0x4000) { // MDP = 1 - - if (chr & 0x80) { //Vordergrundpixel ist gesetzt - cpu.vic.fgcollision |= spritenum; - pixel = 0; - } - } else { // MDP = 0 - if (chr & 0x80) cpu.vic.fgcollision |= spritenum; //Vordergundpixel ist gesetzt - } - } else { // Kein Sprite - pixel = 0; - } - - *p++ = cpu.vic.palette[pixel]; - - } - - } while (p < pe); - PRINTOVERFLOWS - - } else { //Keine Sprites - - const uint16_t bgcol = palette[0]; - while (p < pe - 8) { - - BADLINE(x); - x++; - *p++ = bgcol; *p++ = bgcol; - *p++ = bgcol; *p++ = bgcol; - *p++ = bgcol; *p++ = bgcol; - *p++ = bgcol; *p++ = bgcol; - - }; - while (p < pe) { - - BADLINE(x); - x++; - *p++ = bgcol; if (p >= pe) break; *p++ = bgcol; if (p >= pe) break; - *p++ = bgcol; if (p >= pe) break; *p++ = bgcol; if (p >= pe) break; - *p++ = bgcol; if (p >= pe) break; *p++ = bgcol; if (p >= pe) break; - *p++ = bgcol; if (p >= pe) break; *p++ = bgcol; - - }; - PRINTOVERFLOW - - } - while (x<40) {BADLINE(x); x++;} -} -/*****************************************************************************************************/ -/*****************************************************************************************************/ -/*****************************************************************************************************/ - -typedef void (*modes_t)( tpixel *p, const tpixel *pe, uint16_t *spl, const uint16_t vc ); //Funktionspointer -const modes_t modes[8] = {mode0, mode1, mode2, mode3, mode4, mode5, mode6, mode7}; - - -void vic_do(void) { - - uint16_t vc; - uint16_t xscroll; - tpixel *pe; - tpixel *p; - uint16_t *spl; - uint8_t mode; - - /*****************************************************************************************************/ - /* Linecounter ***************************************************************************************/ - /*****************************************************************************************************/ - /* - ?PEEK(678) NTSC =0 - ?PEEK(678) PAL = 1 - */ - - if ( cpu.vic.rasterLine >= LINECNT ) { - - //reSID sound needs much time - too much to keep everything in sync and with stable refreshrate - //but it is not called very often, so most of the time, we have more time than needed. - //We can measure the time needed for a frame and calc a correction factor to speed things up. - unsigned long m = fbmicros(); - cpu.vic.neededTime = (m - cpu.vic.timeStart); - cpu.vic.timeStart = m; - cpu.vic.lineClock.setIntervalFast(LINETIMER_DEFAULT_FREQ - ((float)cpu.vic.neededTime / (float)LINECNT - LINETIMER_DEFAULT_FREQ )); - - cpu.vic.rasterLine = 0; - cpu.vic.vcbase = 0; - cpu.vic.denLatch = 0; - emu_DrawVsync(); - - } else cpu.vic.rasterLine++; - - int r = cpu.vic.rasterLine; - -// if ( (r >= LASTDISPLAYLINE) && (emu_oskbActive()) ) return; - - if (r == cpu.vic.intRasterLine )//Set Rasterline-Interrupt - cpu.vic.R[0x19] |= 1 | ((cpu.vic.R[0x1a] & 1) << 7); - - /*****************************************************************************************************/ - /* Badlines ******************************************************************************************/ - /*****************************************************************************************************/ - /* - Ein Bad-Line-Zustand liegt in einem beliebigen Taktzyklus vor, wenn an der - negativen Flanke von ø0 zu Beginn des Zyklus RASTER >= $30 und RASTER <= - $f7 und die unteren drei Bits von RASTER mit YSCROLL übereinstimmen und in - einem beliebigen Zyklus von Rasterzeile $30 das DEN-Bit gesetzt war. - - (default 3) - yscroll : POKE 53265, PEEK(53265) AND 248 OR 1:POKE 1024,0 - yscroll : poke 53265, peek(53265) and 248 or 1 - - DEN : POKE 53265, PEEK(53265) AND 224 Bildschirm aus - - Die einzige Verwendung von YSCROLL ist der Vergleich mit r in der Badline - - */ - - if (r == 0x30 ) cpu.vic.denLatch |= cpu.vic.DEN; - - /* 3.7.2 - 2. In der ersten Phase von Zyklus 14 jeder Zeile wird VC mit VCBASE geladen - (VCBASE->VC) und VMLI gelöscht. Wenn zu diesem Zeitpunkt ein - Bad-Line-Zustand vorliegt, wird zusätzlich RC auf Null gesetzt. - */ - - vc = cpu.vic.vcbase; - - cpu.vic.badline = (cpu.vic.denLatch && (r >= 0x30) && (r <= 0xf7) && ( (r & 0x07) == cpu.vic.YSCROLL)); - - if (cpu.vic.badline) { - cpu.vic.idle = 0; - cpu.vic.rc = 0; - } - - /*****************************************************************************************************/ - /*****************************************************************************************************/ -#if 1 - { - int t = MAXCYCLESSPRITES3_7 - cpu.vic.spriteCycles3_7; - if (t > 0) cpu_clock(t); - if (cpu.vic.spriteCycles3_7 > 0) cia_clockt(cpu.vic.spriteCycles3_7); - } -#endif - - //HBlank: - cpu_clock(10); - -#ifdef ADDITIONALCYCLES - cpu_clock(ADDITIONALCYCLES); -#endif - - //cpu.vic.videomatrix = cpu.vic.bank + (unsigned)(cpu.vic.R[0x18] & 0xf0) * 64; - - /* Rand oben /unten **********************************************************************************/ - /* - RSEL Höhe des Anzeigefensters Erste Zeile Letzte Zeile - 0 24 Textzeilen/192 Pixel 55 ($37) 246 ($f6) = 192 sichtbare Zeilen, der Rest ist Rand oder unsichtbar - 1 25 Textzeilen/200 Pixel 51 ($33) 250 ($fa) = 200 sichtbare Zeilen, der Rest ist Rand oder unsichtbar - */ - - if (cpu.vic.borderFlag) { - int firstLine = (cpu.vic.RSEL) ? 0x33 : 0x37; - if ((cpu.vic.DEN) && (r == firstLine)) cpu.vic.borderFlag = false; - } else { - int lastLine = (cpu.vic.RSEL) ? 0xfb : 0xf7; - if (r == lastLine) cpu.vic.borderFlag = true; - } - - if (r < FIRSTDISPLAYLINE || r > LASTDISPLAYLINE ) { - if (r == 0) - cpu_clock(CYCLESPERRASTERLINE - 10 - 2 - MAXCYCLESSPRITES - 1); // (minus hblank l + r) - else - cpu_clock(CYCLESPERRASTERLINE - 10 - 2 - MAXCYCLESSPRITES ); - goto noDisplayIncRC; - } - - //max_x = (!cpu.vic.CSEL) ? 40:38; - p = SCREENMEM + (r - FIRSTDISPLAYLINE) * LINE_MEM_WIDTH; - - - uint16_t col; -//#if !VGA -if(REAL_XRES == SCREEN_WIDTH) { - pe = p + SCREEN_WIDTH; - //Left Screenborder: Cycle 10 - spl = &cpu.vic.spriteLine[24]; - cpu_clock(6); -} -else { - pe = p + SCREEN_WIDTH + BORDER_LEFT; - col = cpu.vic.colors[0]; - - //Left Screenborder: Cycle 10 - for (int i = 0; i <2; i++) { - cpu_clock(1); - *p++ = col;*p++ = col;*p++ = col;*p++ = col; - *p++ = col;*p++ = col;*p++ = col;*p++ = col; - } - - //Left Screenborder: Cycle 13 -#if 0 //mit Sprites - spl = &cpu.vic.spriteLine[0]; - uint16_t sprite; - for (int i=0; i<3; i++) { - cpu_clock(1); - SPRITEORFIXEDCOLOR(); - SPRITEORFIXEDCOLOR(); - SPRITEORFIXEDCOLOR(); - SPRITEORFIXEDCOLOR(); - SPRITEORFIXEDCOLOR(); - SPRITEORFIXEDCOLOR(); - SPRITEORFIXEDCOLOR(); - SPRITEORFIXEDCOLOR(); - } -#else //ohne sprites - spl = &cpu.vic.spriteLine[24]; - for (int i=0; i<3; i++) { - cpu_clock(1); - *p++ = col;*p++ = col;*p++ = col;*p++ = col; - *p++ = col;*p++ = col;*p++ = col;*p++ = col; - } -#endif -} - - - if (cpu.vic.borderFlag) { -//#if !VGA - if(REAL_XRES == SCREEN_WIDTH) { - cpu_clock(5); - } - if ( (!emu_oskbActive()) ) - fastFillLineNoSprites(p, pe + BORDER_RIGHT, cpu.vic.colors[0]); - goto noDisplayIncRC ; - } - - - /*****************************************************************************************************/ - /* DISPLAY *******************************************************************************************/ - /*****************************************************************************************************/ - - - //max_x = (!cpu.vic.CSEL) ? 40:38; - //X-Scrolling: - - xscroll = cpu.vic.XSCROLL; - - if (xscroll > 0) { - uint16_t col = cpu.vic.colors[0]; - - if (!cpu.vic.CSEL) { - cpu_clock(1); - uint16_t sprite; - for (int i = 0; i < xscroll; i++) { - SPRITEORFIXEDCOLOR(); - } - } else { - spl += xscroll; - for (unsigned i = 0; i < xscroll; i++) { - *p++ = col; - } - - } - } - - /*****************************************************************************************************/ - /*****************************************************************************************************/ - /*****************************************************************************************************/ - - - cpu.vic.fgcollision = 0; - mode = (cpu.vic.ECM << 2) | (cpu.vic.BMM << 1) | cpu.vic.MCM; - - if ( !cpu.vic.idle) { - -#if 0 - static uint8_t omode = 99; - if (mode != omode) { - Serial.print("Graphicsmode:"); - Serial.println(mode); - omode = mode; - } -#endif - - modes[mode](p, pe, spl, vc); - vc = (vc + 40) & 0x3ff; - - } else { - /* -3.7.3.9. Idle-Zustand ---------------------- - -Im Idle-Zustand liest der VIC die Grafikdaten von Adresse $3fff (bzw. $39ff -bei gesetztem ECM-Bit) und stellt sie im ausgewählten Grafikmodus dar, -wobei aber die Videomatrix-Daten (normalerweise in den c-Zugriffen gelesen) -nur aus "0"-Bits bestehen. Es wird also immer wiederholt das Byte an -Adresse $3fff/$39ff ausgegeben. - -c-Zugriff - - Es werden keine c-Zugriffe ausgeführt. - - Daten - - +----+----+----+----+----+----+----+----+----+----+----+----+ - | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | - +----+----+----+----+----+----+----+----+----+----+----+----+ - | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | - +----+----+----+----+----+----+----+----+----+----+----+----+ - -g-Zugriff - - Adressen (ECM=0) - - +----+----+----+----+----+----+----+----+----+----+----+----+----+----+ - | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | - +----+----+----+----+----+----+----+----+----+----+----+----+----+----+ - | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | - +----+----+----+----+----+----+----+----+----+----+----+----+----+----+ - - Adressen (ECM=1) - - +----+----+----+----+----+----+----+----+----+----+----+----+----+----+ - | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | - +----+----+----+----+----+----+----+----+----+----+----+----+----+----+ - | 1 | 1 | 1 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | - +----+----+----+----+----+----+----+----+----+----+----+----+----+----+ - - Daten - - +----+----+----+----+----+----+----+----+ - | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | - +----+----+----+----+----+----+----+----+ - | 8 Pixel (1 Bit/Pixel) | Standard-Textmodus/ - | | Multicolor-Textmodus/ - | "0": Hintergrundfarbe 0 ($d021) | ECM-Textmodus - | "1": Schwarz | - +---------------------------------------+ - | 8 Pixel (1 Bit/Pixel) | Standard-Bitmap-Modus/ - | | Ungültiger Textmodus/ - | "0": Schwarz (Hintergrund) | Ungültiger Bitmap-Modus 1 - | "1": Schwarz (Vordergrund) | - +---------------------------------------+ - | 4 Pixel (2 Bit/Pixel) | Multicolor-Bitmap-Modus - | | - | "00": Hintergrundfarbe 0 ($d021) | - | "01": Schwarz (Hintergrund) | - | "10": Schwarz (Vordergrund) | - | "11": Schwarz (Vordergrund) | - +---------------------------------------+ - | 4 Pixel (2 Bit/Pixel) | Ungültiger Bitmap-Modus 2 - | | - | "00": Schwarz (Hintergrund) | - | "01": Schwarz (Hintergrund) | - | "10": Schwarz (Vordergrund) | - | "11": Schwarz (Vordergrund) | - +---------------------------------------+ -*/ - //Modes 1 & 3 - if (mode == 1 || mode == 3) { - modes[mode](p, pe, spl, vc); - } else {//TODO: all other modes - fastFillLine(p, pe, cpu.vic.palette[0], spl); - } - } - - /* - Bei den MBC- und MMC-Interrupts löst jeweils nur die erste Kollision einen - Interrupt aus (d.h. wenn die Kollisionsregister $d01e bzw. $d01f vor der - Kollision den Inhalt Null hatten). Um nach einer Kollision weitere - Interrupts auszulösen, muß das betreffende Register erst durch Auslesen - gelöscht werden. - */ - - if (cpu.vic.fgcollision) { - if (cpu.vic.MD == 0) { - cpu.vic.R[0x19] |= 2 | ( (cpu.vic.R[0x1a] & 2) << 6); - } - cpu.vic.MD |= cpu.vic.fgcollision; - } - - /*****************************************************************************************************/ - - if (!cpu.vic.CSEL) { - cpu_clock(1); - uint16_t col = cpu.vic.colors[0]; - //p = &screen[r - FIRSTDISPLAYLINE][0]; - p = SCREENMEM + (r - FIRSTDISPLAYLINE) * LINE_MEM_WIDTH + BORDER_LEFT; -#if 0 - // Sprites im Rand - uint16_t sprite; - uint16_t * spl; - spl = &cpu.vic.spriteLine[24 + xscroll]; - - SPRITEORFIXEDCOLOR() - SPRITEORFIXEDCOLOR() - SPRITEORFIXEDCOLOR() - SPRITEORFIXEDCOLOR() - SPRITEORFIXEDCOLOR() - SPRITEORFIXEDCOLOR() - SPRITEORFIXEDCOLOR() //7 -#else - //keine Sprites im Rand - *p++ = col; *p++ = col; *p++ = col; *p++ = col; - *p++ = col; *p++ = col; *p = col; - -#endif - - //Rand rechts: - //p = &screen[r - FIRSTDISPLAYLINE][SCREEN_WIDTH - 9]; - p = SCREENMEM + (r - FIRSTDISPLAYLINE) * LINE_MEM_WIDTH + SCREEN_WIDTH - 9 + BORDER_LEFT; - pe = p + 9; - -#if 0 - // Sprites im Rand - spl = &cpu.vic.spriteLine[24 + SCREEN_WIDTH - 9 + xscroll]; - while (p < pe) { - SPRITEORFIXEDCOLOR(); - } -#else - //keine Sprites im Rand - while (p < pe) { - *p++ = col; - } -#endif - - } - - -//Rechter Rand nach CSEL, im Textbereich -cpu_clock(5); -//#if VGA -if(REAL_XRES != SCREEN_WIDTH) { - p = SCREENMEM + (r - FIRSTDISPLAYLINE) * LINE_MEM_WIDTH + SCREEN_WIDTH + BORDER_LEFT; - pe += BORDER_RIGHT; -#if 0 - // Sprites im Rand - while (p < pe) { - SPRITEORFIXEDCOLOR(); - } -#else - //keine Sprites im Rand - while (p < pe) { - *p++ = col; - } -#endif -} - - -noDisplayIncRC: - /* 3.7.2 - 5. In der ersten Phase von Zyklus 58 wird geprüft, ob RC=7 ist. Wenn ja, - geht die Videologik in den Idle-Zustand und VCBASE wird mit VC geladen - (VC->VCBASE). Ist die Videologik danach im Display-Zustand (liegt ein - Bad-Line-Zustand vor, ist dies immer der Fall), wird RC erhöht. - */ - - if (cpu.vic.rc == 7) { - cpu.vic.idle = 1; - cpu.vic.vcbase = vc; - } - //Ist dies richtig ?? - if ((!cpu.vic.idle) || (cpu.vic.denLatch && (r >= 0x30) && (r <= 0xf7) && ( (r & 0x07) == cpu.vic.YSCROLL))) { - cpu.vic.rc = (cpu.vic.rc + 1) & 0x07; - } - - - /*****************************************************************************************************/ - /* Sprites *******************************************************************************************/ - /*****************************************************************************************************/ - - cpu.vic.spriteCycles0_2 = 0; - cpu.vic.spriteCycles3_7 = 0; - - if (cpu.vic.lineHasSprites) { - cpu.vic.lineHasSprites = 0; - memset(cpu.vic.spriteLine, 0, sizeof(cpu.vic.spriteLine) ); - } - - uint32_t spriteYCheck = cpu.vic.R[0x15]; //Sprite enabled Register - - if (spriteYCheck) { - - unsigned short R17 = cpu.vic.R[0x17]; //Sprite-y-expansion - unsigned char collision = 0; - short lastSpriteNum = 0; - - for (unsigned short i = 0; i < 8; i++) { - if (!spriteYCheck) break; - - unsigned b = 1 << i; - - if (spriteYCheck & b ) { - spriteYCheck &= ~b; - short y = cpu.vic.R[i * 2 + 1]; - - if ( (r >= y ) && //y-Position > Sprite-y ? - (((r < y + 21) && (~R17 & b )) || // ohne y-expansion - ((r < y + 2 * 21 ) && (R17 & b ))) ) //mit y-expansion - { - - //Sprite Cycles - if (i < 3) { - if (!lastSpriteNum) cpu.vic.spriteCycles0_2 += 1; - cpu.vic.spriteCycles0_2 += 2; - } else { - if (!lastSpriteNum) cpu.vic.spriteCycles3_7 += 1; - cpu.vic.spriteCycles3_7 += 2; - } - lastSpriteNum = i; - //Sprite Cycles END - - - if (r < FIRSTDISPLAYLINE || r > LASTDISPLAYLINE ) continue; - - uint16_t x = (((cpu.vic.R[0x10] >> i) & 1) << 8) | cpu.vic.R[i * 2]; - if (x >= SPRITE_MAX_X) continue; - - unsigned short lineOfSprite = r - y; - if (R17 & b) lineOfSprite = lineOfSprite / 2; // Y-Expansion - unsigned short spriteadr = cpu.vic.bank | cpu.RAM[cpu.vic.videomatrix + (1024 - 8) + i] << 6 | (lineOfSprite * 3); - unsigned spriteData = ((unsigned)cpu.RAM[ spriteadr ] << 16) | ((unsigned)cpu.RAM[ spriteadr + 1 ] << 8) | ((unsigned)cpu.RAM[ spriteadr + 2 ]); - - if (!spriteData) continue; - cpu.vic.lineHasSprites = 1; - - uint16_t * slp = &cpu.vic.spriteLine[x]; //Sprite-Line-Pointer - unsigned short upperByte = ( 0x80 | ( (cpu.vic.MDP & b) ? 0x40 : 0 ) | i ) << 8; //Bit7 = Sprite "da", Bit 6 = Sprite-Priorität vor Grafik/Text, Bits 3..0 = Spritenummer - - //Sprite in Spritezeile schreiben: - if ((cpu.vic.MMC & b) == 0) { // NO MULTICOLOR - - uint16_t color = upperByte | cpu.vic.R[0x27 + i]; - - if ((cpu.vic.MXE & b) == 0) { // NO MULTICOLOR, NO SPRITE-EXPANSION - - for (unsigned cnt = 0; (spriteData > 0) && (cnt < 24); cnt++) { - int c = (spriteData >> 23) & 0x01; - spriteData = (spriteData << 1); - - if (c) { - if (*slp == 0) *slp = color; - else collision |= b | (1 << ((*slp >> 8) & 0x07)); - } - slp++; - - } - - } else { // NO MULTICOLOR, SPRITE-EXPANSION - - for (unsigned cnt = 0; (spriteData > 0) && (cnt < 24); cnt++) { - int c = (spriteData >> 23) & 0x01; - spriteData = (spriteData << 1); - //So wie oben, aber zwei gleiche Pixel - - if (c) { - if (*slp == 0) *slp = color; - else collision |= b | (1 << ((*slp >> 8) & 0x07)); - slp++; - if (*slp == 0) *slp = color; - else collision |= b | (1 << ((*slp >> 8) & 0x07)); - slp++; - } else { - slp += 2; - } - - } - } - - - - } else { // MULTICOLOR - /* Im Mehrfarbenmodus (Multicolor-Modus) bekommen alle Sprites zwei zusätzliche gemeinsame Farben. - Die horizontale Auflösung wird von 24 auf 12 halbiert, da bei der Sprite-Definition jeweils zwei Bits zusammengefasst werden. - */ - uint16_t colors[4]; - //colors[0] = 1; //dummy, color 0 is transparent - colors[1] = upperByte | cpu.vic.R[0x25]; - colors[2] = upperByte | cpu.vic.R[0x27 + i]; - colors[3] = upperByte | cpu.vic.R[0x26]; - - if ((cpu.vic.MXE & b) == 0) { // MULTICOLOR, NO SPRITE-EXPANSION - for (unsigned cnt = 0; (spriteData > 0) && (cnt < 24); cnt++) { - int c = (spriteData >> 22) & 0x03; - spriteData = (spriteData << 2); - - if (c) { - if (*slp == 0) *slp = colors[c]; - else collision |= b | (1 << ((*slp >> 8) & 0x07)); - slp++; - if (*slp == 0) *slp = colors[c]; - else collision |= b | (1 << ((*slp >> 8) & 0x07)); - slp++; - } else { - slp += 2; - } - - } - - } else { // MULTICOLOR, SPRITE-EXPANSION - for (unsigned cnt = 0; (spriteData > 0) && (cnt < 24); cnt++) { - int c = (spriteData >> 22) & 0x03; - spriteData = (spriteData << 2); - - //So wie oben, aber vier gleiche Pixel - if (c) { - if (*slp == 0) *slp = colors[c]; - else collision |= b | (1 << ((*slp >> 8) & 0x07)); - slp++; - if (*slp == 0) *slp = colors[c]; - else collision |= b | (1 << ((*slp >> 8) & 0x07)); - slp++; - if (*slp == 0) *slp = colors[c]; - else collision |= b | (1 << ((*slp >> 8) & 0x07)); - slp++; - if (*slp == 0) *slp = colors[c]; - else collision |= b | (1 << ((*slp >> 8) & 0x07)); - slp++; - } else { - slp += 4; - } - - } - - } - } - - } - else lastSpriteNum = 0; - } - - } - - if (collision) { - if (cpu.vic.MM == 0) { - cpu.vic.R[0x19] |= 4 | ((cpu.vic.R[0x1a] & 4) << 5 ); - } - cpu.vic.MM |= collision; - } - - } - /*****************************************************************************************************/ -#if 0 - { - int t = MAXCYCLESSPRITES0_2 - cpu.vic.spriteCycles0_2; - if (t > 0) cpu_clock(t); - if (cpu.vic.spriteCycles0_2 > 0) cia_clockt(cpu.vic.spriteCycles0_2); - } -#endif - - //HBlank: -#if PAL - cpu_clock(2); -#else - cpu_clock(3); -#endif - - -#if 0 - if (cpu.vic.idle) { - Serial.print("Cycles line "); - Serial.print(r); - Serial.print(": "); - Serial.println(cpu.lineCyclesAbs); - } -#endif - - - return; -} - -/*****************************************************************************************************/ -/*****************************************************************************************************/ -/*****************************************************************************************************/ -void fastFillLineNoSprites(tpixel * p, const tpixel * pe, const uint16_t col) { - int i = 0; - - while (p < pe) { - *p++ = col; - i = (i + 1) & 0x07; - if (!i) CYCLES(1); - } - - -} - -void fastFillLine(tpixel * p, const tpixel * pe, const uint16_t col, uint16_t * spl) { - if (spl != NULL && cpu.vic.lineHasSprites) { - int i = 0; - uint16_t sprite; - while ( p < pe ) { - SPRITEORFIXEDCOLOR(); - i = (i + 1) & 0x07; - if (!i) CYCLES(1); - }; - - } else { - - fastFillLineNoSprites(p, pe, col); - - } -} - -/*****************************************************************************************************/ -/*****************************************************************************************************/ -/*****************************************************************************************************/ - -void vic_displaySimpleModeScreen(void) { -} - - -void vic_do_simple(void) { - uint16_t vc; - int cycles = 0; - -if ( cpu.vic.rasterLine >= LINECNT ) { - - //reSID sound needs much time - too much to keep everything in sync and with stable refreshrate - //but it is not called very often, so most of the time, we have more time than needed. - //We can measure the time needed for a frame and calc a correction factor to speed things up. - unsigned long m = fbmicros(); - cpu.vic.neededTime = (m - cpu.vic.timeStart); - cpu.vic.timeStart = m; - cpu.vic.lineClock.setIntervalFast(LINETIMER_DEFAULT_FREQ - ((float)cpu.vic.neededTime / (float)LINECNT - LINETIMER_DEFAULT_FREQ )); - - cpu.vic.rasterLine = 0; - cpu.vic.vcbase = 0; - cpu.vic.denLatch = 0; - emu_DrawVsync(); - } else { - cpu.vic.rasterLine++; - cpu_clock(1); - cycles += 1; - } - - int r = cpu.vic.rasterLine; - -// if ( (r >= LASTDISPLAYLINE) && (emu_oskbActive()) ) return; - - if (r == cpu.vic.intRasterLine )//Set Rasterline-Interrupt - cpu.vic.R[0x19] |= 1 | ((cpu.vic.R[0x1a] & 1) << 7); - - cpu_clock(9); - cycles += 9; - - if (r == 0x30 ) cpu.vic.denLatch |= cpu.vic.DEN; - - vc = cpu.vic.vcbase; - - cpu.vic.badline = (cpu.vic.denLatch && (r >= 0x30) && (r <= 0xf7) && ( (r & 0x07) == cpu.vic.YSCROLL)); - - if (cpu.vic.badline) { - cpu.vic.idle = 0; - cpu.vic.rc = 0; - } - - - /* Rand oben /unten **********************************************************************************/ - /* - RSEL Höhe des Anzeigefensters Erste Zeile Letzte Zeile - 0 24 Textzeilen/192 Pixel 55 ($37) 246 ($f6) = 192 sichtbare Zeilen, der Rest ist Rand oder unsichtbar - 1 25 Textzeilen/200 Pixel 51 ($33) 250 ($fa) = 200 sichtbare Zeilen, der Rest ist Rand oder unsichtbar - */ - - if (cpu.vic.borderFlag) { - int firstLine = (cpu.vic.RSEL) ? 0x33 : 0x37; - if ((cpu.vic.DEN) && (r == firstLine)) cpu.vic.borderFlag = false; - } else { - int lastLine = (cpu.vic.RSEL) ? 0xfb : 0xf7; - if (r == lastLine) cpu.vic.borderFlag = true; - } - - - //left screenborder - cpu_clock(6); - cycles += 6; - - CYCLES(40); - cycles += 40; - vc += 40; - - //right screenborder - cpu_clock(4); //1 - cycles += 4; - - - if (cpu.vic.rc == 7) { - cpu.vic.idle = 1; - cpu.vic.vcbase = vc; - } - //Ist dies richtig ?? - if ((!cpu.vic.idle) || (cpu.vic.denLatch && (r >= 0x30) && (r <= 0xf7) && ( (r & 0x07) == cpu.vic.YSCROLL))) { - cpu.vic.rc = (cpu.vic.rc + 1) & 0x07; - } - - cpu_clock(3); //1 - cycles += 3; - - int cyclesleft = CYCLESPERRASTERLINE - cycles; - if (cyclesleft) cpu_clock(cyclesleft); - -} - -/*****************************************************************************************************/ -/*****************************************************************************************************/ -/*****************************************************************************************************/ - -void vic_adrchange(void) { - uint8_t r18 = cpu.vic.R[0x18]; - cpu.vic.videomatrix = cpu.vic.bank + (unsigned)(r18 & 0xf0) * 64; - - unsigned charsetAddr = r18 & 0x0e; - if ((cpu.vic.bank & 0x4000) == 0) { - if (charsetAddr == 0x04) cpu.vic.charsetPtrBase = ((uint8_t *)&rom_characters); - else if (charsetAddr == 0x06) cpu.vic.charsetPtrBase = ((uint8_t *)&rom_characters) + 0x800; - else - cpu.vic.charsetPtrBase = &cpu.RAM[charsetAddr * 0x400 + cpu.vic.bank] ; - } else - cpu.vic.charsetPtrBase = &cpu.RAM[charsetAddr * 0x400 + cpu.vic.bank]; - - cpu.vic.bitmapPtr = (uint8_t*) &cpu.RAM[cpu.vic.bank | ((r18 & 0x08) * 0x400)]; - if ((cpu.vic.R[0x11] & 0x60) == 0x60) cpu.vic.bitmapPtr = (uint8_t*)((uintptr_t)cpu.vic.bitmapPtr & 0xf9ff); - -} -/*****************************************************************************************************/ -void vic_write(uint32_t address, uint8_t value) { - - address &= 0x3F; - - switch (address) { - case 0x11 : - cpu.vic.R[address] = value; - cpu.vic.intRasterLine = (cpu.vic.intRasterLine & 0xff) | ((((uint16_t) value) << 1) & 0x100); - if (cpu.vic.rasterLine == 0x30 ) cpu.vic.denLatch |= value & 0x10; - - cpu.vic.badline = (cpu.vic.denLatch && (cpu.vic.rasterLine >= 0x30) && (cpu.vic.rasterLine <= 0xf7) && ( (cpu.vic.rasterLine & 0x07) == (value & 0x07))); - - if (cpu.vic.badline) { - cpu.vic.idle = 0; - } - - vic_adrchange(); - - break; - case 0x12 : - cpu.vic.intRasterLine = (cpu.vic.intRasterLine & 0x100) | value; - cpu.vic.R[address] = value; - break; - case 0x18 : - cpu.vic.R[address] = value; - vic_adrchange(); - break; - case 0x19 : //IRQs - cpu.vic.R[0x19] &= (~value & 0x0f); - break; - case 0x1A : //IRQ Mask - cpu.vic.R[address] = value & 0x0f; - break; - case 0x1e: - case 0x1f: - cpu.vic.R[address] = 0; - break; - case 0x20 ... 0x2E: - cpu.vic.R[address] = value & 0x0f; - cpu.vic.colors[address - 0x20] = cpu.vic.palette[value & 0x0f]; - break; - case 0x2F ... 0x3F: - break; - default : - cpu.vic.R[address] = value; - break; - } - - //#if DEBUGVIC -#if 0 - Serial.print("VIC "); - Serial.print(address, HEX); - Serial.print("="); - Serial.println(value, HEX); - //logAddr(address, value, 1); -#endif -} - -/*****************************************************************************************************/ -/*****************************************************************************************************/ -/*****************************************************************************************************/ - -uint8_t vic_read(uint32_t address) { - uint8_t ret; - - address &= 0x3F; - switch (address) { - - case 0x11: - ret = (cpu.vic.R[address] & 0x7F) | ((cpu.vic.rasterLine & 0x100) >> 1); - break; - case 0x12: - ret = cpu.vic.rasterLine; - break; - case 0x16: - ret = cpu.vic.R[address] | 0xC0; - break; - case 0x18: - ret = cpu.vic.R[address] | 0x01; - break; - case 0x19: - ret = cpu.vic.R[address] | 0x70; - break; - case 0x1a: - ret = cpu.vic.R[address] | 0xF0; - break; - case 0x1e: - case 0x1f: - ret = cpu.vic.R[address]; - cpu.vic.R[address] = 0; - break; - case 0x20 ... 0x2E: - ret = cpu.vic.R[address] | 0xF0; - break; - case 0x2F ... 0x3F: - ret = 0xFF; - break; - default: - ret = cpu.vic.R[address]; - break; - } - -#if DEBUGVIC - Serial.print("VIC "); - logAddr(address, ret, 0); -#endif - return ret; -} - -/*****************************************************************************************************/ -/*****************************************************************************************************/ -/*****************************************************************************************************/ - -void installPalette(void) { - memcpy(cpu.vic.palette, (void*)palette, sizeof(cpu.vic.palette)); -} - - -/*****************************************************************************************************/ -/*****************************************************************************************************/ -/*****************************************************************************************************/ -#define XOFFSET 4 -#define YOFFSET 16 - - -void resetVic(void) { - LINE_MEM_WIDTH = tft.get_frame_buffer_size(&REAL_XRES,&REAL_YRES); - SCREENMEM=(tpixel*)emu_LineBuffer(0); - /* - if (REAL_XRES == SCREEN_WIDTH) { - BORDER = (REAL_YRES-200)/2; - SCREEN_HEIGHT = (200+2*BORDER); - FIRSTDISPLAYLINE = ( 51 - BORDER ); - LASTDISPLAYLINE = ( 250 + BORDER ); - BORDER_LEFT = 0; - BORDER_RIGHT = 0; - } - else { - BORDER = (REAL_YRES-200)/2; - SCREEN_HEIGHT = (200+2*BORDER); - FIRSTDISPLAYLINE = ( 51 - BORDER ); - LASTDISPLAYLINE = ( 250 + BORDER ); - BORDER_LEFT = (REAL_XRES-320)/2; - BORDER_RIGHT = (REAL_XRES-320)/2; - } - */ - - enableCycleCounter(); - - cpu.vic.intRasterLine = 0; - cpu.vic.rasterLine = 0; - cpu.vic.lineHasSprites = 0; - memset(&cpu.RAM[0x400], 0, 1000); - memset(&cpu.vic, 0, sizeof(cpu.vic)); - - installPalette(); - - //http://dustlayer.com/vic-ii/2013/4/22/when-visibility-matters - cpu.vic.R[0x11] = 0x9B; - cpu.vic.R[0x16] = 0x08; - cpu.vic.R[0x18] = 0x14; - cpu.vic.R[0x19] = 0x0f; - - for (unsigned i = 0; i < sizeof(cpu.vic.COLORRAM); i++) - cpu.vic.COLORRAM[i] = (rand() & 0x0F); - - cpu.RAM[0x39FF] = 0x0; - cpu.RAM[0x3FFF] = 0x0; - cpu.RAM[0x39FF + 16384] = 0x0; - cpu.RAM[0x3FFF + 16384] = 0x0; - cpu.RAM[0x39FF + 32768] = 0x0; - cpu.RAM[0x3FFF + 32768] = 0x0; - cpu.RAM[0x39FF + 49152] = 0x0; - cpu.RAM[0x3FFF + 49152] = 0x0; - - vic_adrchange(); -} - - -/* - ?PEEK(678) NTSC =0 - ?PEEK(678) PAL = 1 - PRINT TIME$ -*/ -/* - Raster- Takt- sichtb. sichtbare - VIC-II System zeilen zyklen Zeilen Pixel/Zeile - ------------------------------------------------------- - 6569 PAL 312 63 284 403 - 6567R8 NTSC 263 65 235 418 - 6567R56A NTSC 262 64 234 411 -*/ diff --git a/MCUME_pico/pico64/AudioPlaySystem.cpp b/MCUME_pico/pico64/AudioPlaySystem.cpp deleted file mode 100644 index 639ad5f..0000000 --- a/MCUME_pico/pico64/AudioPlaySystem.cpp +++ /dev/null @@ -1,176 +0,0 @@ -#include "emuapi.h" - -#ifdef HAS_SND - -#include "AudioPlaySystem.h" - -#define SAMPLERATE AUDIO_SAMPLE_RATE_EXACT -#define CLOCKFREQ 985248 - -#ifndef CUSTOM_SND -static const short square[]={ -32767,32767,32767,32767, -32767,32767,32767,32767, -32767,32767,32767,32767, -32767,32767,32767,32767, -32767,32767,32767,32767, -32767,32767,32767,32767, -32767,32767,32767,32767, -32767,32767,32767,32767, --32767,-32767,-32767,-32767, --32767,-32767,-32767,-32767, --32767,-32767,-32767,-32767, --32767,-32767,-32767,-32767, --32767,-32767,-32767,-32767, --32767,-32767,-32767,-32767, --32767,-32767,-32767,-32767, --32767,-32767,-32767,-32767, -}; - -const short noise[] { --32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767, --32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,32767,-32767, --32767,-32767,32767,-32767,-32767,-32767,32767,-32767,-32767,-32767,32767,-32767,-32767,-32767,32767,-32767, --32767,-32767,32767,-32767,-32767,-32767,32767,-32767,-32767,-32767,32767,-32767,-32767,32767,32767,-32767, --32767,-32767,32767,-32767,-32767,32767,32767,-32767,-32767,-32767,32767,-32767,-32767,32767,32767,-32767, --32767,-32767,32767,-32767,-32767,32767,32767,-32767,-32767,-32767,32767,-32767,32767,32767,32767,-32767, -32767,-32767,32767,-32767,-32767,32767,32767,-32767,-32767,-32767,32767,-32767,32767,32767,32767,-32767, -32767,-32767,32767,-32767,-32767,32767,32767,-32767,-32767,-32767,32767,32767,32767,32767,32767,-32767, -32767,-32767,32767,-32767,-32767,32767,32767,-32767,-32767,-32767,32767,32767,32767,32767,32767,-32767, -32767,-32767,32767,-32767,-32767,32767,32767,-32767,-32767,-32767,-32767,32767,32767,32767,-32767,-32767, -32767,-32767,-32767,-32767,-32767,32767,-32767,-32767,-32767,-32767,32767,32767,32767,32767,32767,-32767, -32767,-32767,32767,-32767,-32767,32767,32767,-32767,-32767,32767,-32767,32767,32767,32767,-32767,-32767, -32767,32767,-32767,-32767,-32767,32767,-32767,-32767,-32767,-32767,32767,32767,32767,32767,32767,-32767, -32767,-32767,32767,-32767,-32767,32767,32767,-32767,32767,32767,-32767,32767,-32767,32767,-32767,-32767, -32767,32767,-32767,-32767,-32767,32767,-32767,-32767,-32767,-32767,32767,32767,32767,32767,32767,-32767, -32767,-32767,32767,-32767,-32767,32767,32767,32767,32767,32767,-32767,32767,-32767,32767,-32767,-32767, -}; - -#define NOISEBSIZE 0x100 - -typedef struct -{ - unsigned int spos; - unsigned int sinc; - unsigned int vol; -} Channel; - -static Channel chan[6] = { - {0,0,0}, - {0,0,0}, - {0,0,0}, - {0,0,0}, - {0,0,0}, - {0,0,0} }; - -#endif - -volatile bool playing = false; - - -static void snd_Reset(void) -{ -#ifndef CUSTOM_SND - chan[0].vol = 0; - chan[1].vol = 0; - chan[2].vol = 0; - chan[3].vol = 0; - chan[4].vol = 0; - chan[5].vol = 0; - chan[0].sinc = 0; - chan[1].sinc = 0; - chan[2].sinc = 0; - chan[3].sinc = 0; - chan[4].sinc = 0; - chan[5].sinc = 0; -#endif -} - - -#ifdef CUSTOM_SND -//extern "C" { -void SND_Process(void *sndbuffer, int sndn); -//} -#endif - -#include -void AudioPlaySystem::snd_Mixer(short * stream, int len ) -{ - if (playing) - { -#ifdef CUSTOM_SND - //printf("s\n"); - SND_Process((void*)stream, len); -#else - int i; - long s; - len = len >> 1; - short v0=chan[0].vol; - short v1=chan[1].vol; - short v2=chan[2].vol; - short v3=chan[3].vol; - short v4=chan[4].vol; - short v5=chan[5].vol; - for (i=0;i>8)&0x3f])>>11); - s+=((v1*square[(chan[1].spos>>8)&0x3f])>>11); - s+=((v2*square[(chan[2].spos>>8)&0x3f])>>11); - s+=((v3*noise[(chan[3].spos>>8)&(NOISEBSIZE-1)])>>11); - s+=((v4*noise[(chan[4].spos>>8)&(NOISEBSIZE-1)])>>11); - s+=((v5*noise[(chan[5].spos>>8)&(NOISEBSIZE-1)])>>11); - *stream++ = (short)(s); - *stream++ = (short)(s); - chan[0].spos += chan[0].sinc; - chan[1].spos += chan[1].sinc; - chan[2].spos += chan[2].sinc; - chan[3].spos += chan[3].sinc; - chan[4].spos += chan[4].sinc; - chan[5].spos += chan[5].sinc; - } -#endif - } -} - -void AudioPlaySystem::begin(void) -{ - this->reset(); -} - -void AudioPlaySystem::start(void) -{ - playing = true; -} - -void AudioPlaySystem::setSampleParameters(float clockfreq, float samplerate) { -} - -void AudioPlaySystem::reset(void) -{ - snd_Reset(); -} - -void AudioPlaySystem::stop(void) -{ - playing = false; -} - -bool AudioPlaySystem::isPlaying(void) -{ - return playing; -} - - - -void AudioPlaySystem::sound(int C, int F, int V) { -#ifndef CUSTOM_SND - if (C < 6) { - chan[C].vol = V; - chan[C].sinc = F>>1; - } -#endif -} - -void AudioPlaySystem::step(void) { -} -#endif diff --git a/MCUME_pico/pico64/AudioPlaySystem.h b/MCUME_pico/pico64/AudioPlaySystem.h deleted file mode 100644 index 5d2efc0..0000000 --- a/MCUME_pico/pico64/AudioPlaySystem.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef audioplaysystem_h_ -#define audioplaysystem_h_ - -#ifdef HAS_SND - -#include "platform_config.h" - -class AudioPlaySystem -{ -public: - AudioPlaySystem(void) { }; - void begin(void); - void setSampleParameters(float clockfreq, float samplerate); - void reset(void); - void start(void); - void stop(void); - bool isPlaying(void); - void sound(int C, int F, int V); - void buzz(int size, int val); - void step(void); - static void snd_Mixer(short * stream, int len ); -}; - -#endif - -#endif diff --git a/MCUME_pico/pico64/IntervalTimer.h_old b/MCUME_pico/pico64/IntervalTimer.h_old deleted file mode 100755 index 42359dd..0000000 --- a/MCUME_pico/pico64/IntervalTimer.h_old +++ /dev/null @@ -1,150 +0,0 @@ -/* Teensyduino Core Library - * http://www.pjrc.com/teensy/ - * Copyright (c) 2017 PJRC.COM, LLC. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * 1. The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * 2. If the Software is incorporated into a build system that allows - * selection among a list of target devices, then similar target - * devices manufactured by PJRC.COM must be included in the list of - * target devices and selectable in the same manner. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS - * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - - /* - - Added : - - - void setIntervalFast(float microseconds) - - bool setInterval(float microseconds) - - F.B. - - */ - -#ifndef __INTERVALTIMERX_H__ -#define __INTERVALTIMERX_H__ - -//#include "kinetis.h" - -#ifdef __cplusplus -extern "C" { -#endif - -class MyIntervalTimer { -private: - static const uint32_t MAX_PERIOD = UINT32_MAX / (F_BUS / 1000000.0); -public: - MyIntervalTimer() { - //channel = NULL; - nvic_priority = 128; - } - ~MyIntervalTimer() { - end(); - } - bool begin(void (*funct)(), unsigned int microseconds) { - if (microseconds == 0 || microseconds > MAX_PERIOD) return false; - uint32_t cycles = (F_BUS / 1000000) * microseconds - 1; - if (cycles < 36) return false; - return beginCycles(funct, cycles); - } - bool begin(void (*funct)(), int microseconds) { - if (microseconds < 0) return false; - return begin(funct, (unsigned int)microseconds); - } - bool begin(void (*funct)(), unsigned long microseconds) { - return begin(funct, (unsigned int)microseconds); - } - bool begin(void (*funct)(), long microseconds) { - return begin(funct, (int)microseconds); - } - bool begin(void (*funct)(), float microseconds) { - if (microseconds <= 0 || microseconds > MAX_PERIOD) return false; - uint32_t cycles = (float)(F_BUS / 1000000) * microseconds - 0.5; - if (cycles < 36) return false; - return beginCycles(funct, cycles); - } - bool begin(void (*funct)(), double microseconds) { - return begin(funct, (float)microseconds); - } - - void setIntervalFast(float microseconds) { /*NEW*/ - uint32_t cycles = (float)(F_BUS / 1000000) * microseconds - 0.5; - //channel->LDVAL = cycles; - } - bool setInterval(float microseconds) { /*NEW*/ - //if (!channel) return false; - if (microseconds <= 0 || microseconds > MAX_PERIOD) return false; - setIntervalFast(microseconds); - return true; - } - - void end() {}; - void priority(uint8_t n) { - nvic_priority = n; - #if defined(KINETISK) - /* - if (channel) { - int index = channel - KINETISK_PIT_CHANNELS; - NVIC_SET_PRIORITY(IRQ_PIT_CH0 + index, nvic_priority); - } - */ - #elif defined(KINETISL) - /* - if (channel) { - int index = channel - KINETISK_PIT_CHANNELS; - nvic_priorites[index] = nvic_priority; - if (nvic_priorites[0] <= nvic_priorites[1]) { - NVIC_SET_PRIORITY(IRQ_PIT, nvic_priorites[0]); - } else { - NVIC_SET_PRIORITY(IRQ_PIT, nvic_priorites[1]); - } - } - */ - #endif - } - //operator IRQ_NUMBER_t() { - /* - if (channel) { - #if defined(KINETISK) - int index = channel - KINETISK_PIT_CHANNELS; - return (IRQ_NUMBER_t)(IRQ_PIT_CH0 + index); - #elif defined(KINETISL) - return IRQ_PIT; - #endif - } - */ - //return (IRQ_NUMBER_t)NVIC_NUM_INTERRUPTS; - //} -private: - //KINETISK_PIT_CHANNEL_t *channel; - uint8_t nvic_priority; - #if defined(KINETISL) - static uint8_t nvic_priorites[2]; - #endif - bool beginCycles(void (*funct)(), uint32_t cycles); - -}; - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/MCUME_pico/pico64/Teensy64.h b/MCUME_pico/pico64/Teensy64.h index f77fb5f..59e710d 100644 --- a/MCUME_pico/pico64/Teensy64.h +++ b/MCUME_pico/pico64/Teensy64.h @@ -51,19 +51,10 @@ #define NTSC (!PAL) #define USBHOST (!PS2KEYBOARD) - extern "C" { #include "emuapi.h" } -#ifdef USE_VGA -#include "vga_t_dma.h" -#else -#include "tft_t_dma.h" -#endif -extern TFT_T_DMA tft; - - inline unsigned long millis() { return (to_ms_since_boot(get_absolute_time ())); } diff --git a/MCUME_pico/pico64/c64.cpp b/MCUME_pico/pico64/c64.cpp index 605a8fe..ba679a7 100644 --- a/MCUME_pico/pico64/c64.cpp +++ b/MCUME_pico/pico64/c64.cpp @@ -297,6 +297,7 @@ static char textkey[1]; static bool res=false; static bool firsttime=true; +static int loadtimeout=100; //100*20ms; #ifndef PICOMPUTER /* @@ -411,17 +412,22 @@ void c64_Input(int bClick) { } else */ -#endif +#endif + if (loadtimeout > 0) { + loadtimeout--; + } if ( (bClick & MASK_KEY_USER1) && !(emu_GetPad() & MASK_OSKB) ) { - if (firsttime) { - firsttime = false; - textseq = textload; - nbkeys = strlen(textseq); - kcnt=0; + if (loadtimeout == 0) { + if (firsttime) { + firsttime = false; + textseq = textload; + nbkeys = strlen(textseq); + kcnt=0; + } + else { + cpu.swapJoysticks = !cpu.swapJoysticks; + } } - else { - cpu.swapJoysticks = !cpu.swapJoysticks; - } } else { diff --git a/MCUME_pico/pico64/cpu.h b/MCUME_pico/pico64/cpu.h index 1c6c602..5c7f33f 100755 --- a/MCUME_pico/pico64/cpu.h +++ b/MCUME_pico/pico64/cpu.h @@ -49,7 +49,7 @@ #include "Teensy64.h" #include "roms.h" #include "patches.h" -#include "util.h" +#include "timerutil.h" #include "pla.h" #include "vic.h" #include "keyboard.h" diff --git a/MCUME_pico/pico64/emuapi.cpp b/MCUME_pico/pico64/emuapi.cpp deleted file mode 100644 index 1bc929b..0000000 --- a/MCUME_pico/pico64/emuapi.cpp +++ /dev/null @@ -1,1311 +0,0 @@ -#define KEYMAP_PRESENT 1 - -#define PROGMEM - -#include "pico.h" -#include "pico/stdlib.h" -#include "hardware/adc.h" -#include -#include - -extern "C" { - #include "emuapi.h" - #include "iopins.h" -} - -static bool emu_writeConfig(void); -static bool emu_readConfig(void); -static bool emu_eraseConfig(void); - - -#if (defined(ILI9341) || defined(ST7789)) && defined(USE_VGA) -// Dual display config, initialize TFT -#include "tft_t_dma.h" -static TFT_T_DMA tft; -#else -// Non Dual display config -#ifdef USE_VGA -#include "vga_t_dma.h" -#else -#include "tft_t_dma.h" -#endif -extern TFT_T_DMA tft; -#endif - - -#define MAX_FILENAME_PATH 64 -#define NB_FILE_HANDLER 4 -#define AUTORUN_FILENAME "autorun.txt" - -#define MAX_FILES 64 -#define MAX_FILENAME_SIZE 24 -#define MAX_MENULINES 9 -#define TEXT_HEIGHT 16 -#define TEXT_WIDTH 8 -#define MENU_FILE_XOFFSET (6*TEXT_WIDTH) -#define MENU_FILE_YOFFSET (2*TEXT_HEIGHT) -#define MENU_FILE_W (MAX_FILENAME_SIZE*TEXT_WIDTH) -#define MENU_FILE_H (MAX_MENULINES*TEXT_HEIGHT) -#define MENU_FILE_BGCOLOR RGBVAL16(0x00,0x00,0x40) -#define MENU_JOYS_YOFFSET (12*TEXT_HEIGHT) -#define MENU_VBAR_XOFFSET (0*TEXT_WIDTH) -#define MENU_VBAR_YOFFSET (MENU_FILE_YOFFSET) - -#define MENU_TFT_XOFFSET (MENU_FILE_XOFFSET+MENU_FILE_W+8) -#define MENU_TFT_YOFFSET (MENU_VBAR_YOFFSET+32) -#define MENU_VGA_XOFFSET (MENU_FILE_XOFFSET+MENU_FILE_W+8) -#define MENU_VGA_YOFFSET (MENU_VBAR_YOFFSET+MENU_FILE_H-32-37) - - - -static int nbFiles=0; -static int curFile=0; -static int topFile=0; -static char selection[MAX_FILENAME_PATH]=""; -static char selected_filename[MAX_FILENAME_SIZE]=""; -static char files[MAX_FILES][MAX_FILENAME_SIZE]; -static bool menuRedraw=true; - -#ifdef PICOMPUTER -static const unsigned short * keys; -static unsigned char keymatrix[6]; -static int keymatrix_hitrow=-1; -static bool key_fn=false; -static bool key_alt=false; -static uint32_t keypress_t_ms=0; -static uint32_t last_t_ms=0; -static uint32_t hundred_ms_cnt=0; -static bool ledflash_toggle=false; -#endif -static int keyMap; - -static bool joySwapped = false; -static uint16_t bLastState; -static int xRef; -static int yRef; -static uint8_t usbnavpad=0; - -static bool menuOn=true; -static bool autorun=false; - - -/******************************** - * Generic output and malloc -********************************/ -void emu_printf(const char * text) -{ - printf("%s\n",text); -} - -void emu_printf(int val) -{ - printf("%d\n",val); -} - -void emu_printi(int val) -{ - printf("%d\n",val); -} - -void emu_printh(int val) -{ - printf("0x%.8\n",val); -} - -static int malbufpt = 0; -static char malbuf[EXTRA_HEAP]; - -void * emu_Malloc(int size) -{ - void * retval = malloc(size); - if (!retval) { - emu_printf("failled to allocate"); - emu_printf(size); - emu_printf("fallback"); - if ( (malbufpt+size) < sizeof(malbuf) ) { - retval = (void *)&malbuf[malbufpt]; - malbufpt += size; - } - else { - emu_printf("failure to allocate"); - } - } - else { - emu_printf("could allocate dynamic "); - emu_printf(size); - } - - return retval; -} - -void * emu_MallocI(int size) -{ - void * retval = NULL; - - if ( (malbufpt+size) < sizeof(malbuf) ) { - retval = (void *)&malbuf[malbufpt]; - malbufpt += size; - emu_printf("could allocate static "); - emu_printf(size); - } - else { - emu_printf("failure to allocate"); - } - - return retval; -} -void emu_Free(void * pt) -{ - free(pt); -} - -void emu_drawText(unsigned short x, unsigned short y, const char * text, unsigned short fgcolor, unsigned short bgcolor, int doublesize) -{ - tft.drawText(x, y, text, fgcolor, bgcolor, doublesize?true:false); -} - - -/******************************** - * OSKB handling -********************************/ -#if (defined(ILI9341) || defined(ST7789)) && defined(USE_VGA) -// On screen keyboard position -#define KXOFF 28 //64 -#define KYOFF 96 -#define KWIDTH 11 //22 -#define KHEIGHT 3 - -static bool oskbOn = false; -static int cxpos = 0; -static int cypos = 0; -static int oskbMap = 0; -static uint16_t oskbBLastState = 0; - -static void lineOSKB2(int kxoff, int kyoff, char * str, int row) -{ - char c[2] = {'A',0}; - const char * cpt = str; - for (int i=0; i.,SP ", 2); - if (oskbMap == 0) { - lineOSKB(KXOFF,KYOFF, keylables_map1_0, 0); - lineOSKB(KXOFF,KYOFF, keylables_map1_1, 1); - lineOSKB(KXOFF,KYOFF, keylables_map1_2, 2); - } - else if (oskbMap == 1) { - lineOSKB(KXOFF,KYOFF, keylables_map2_0, 0); - lineOSKB(KXOFF,KYOFF, keylables_map2_1, 1); - lineOSKB(KXOFF,KYOFF, keylables_map2_2, 2); - } - else { - lineOSKB(KXOFF,KYOFF, keylables_map3_0, 0); - lineOSKB(KXOFF,KYOFF, keylables_map3_1, 1); - lineOSKB(KXOFF,KYOFF, keylables_map3_2, 2); - } -} - -void toggleOskb(bool forceoff) { - if (forceoff) oskbOn=true; - if (oskbOn) { - oskbOn = false; - tft.fillScreenNoDma(RGBVAL16(0x00,0x00,0x00)); - tft.drawTextNoDma(0,32, "Press USER2 to toggle onscreen keyboard.", RGBVAL16(0xff,0xff,0xff), RGBVAL16(0x00,0x00,0x00), true); - } else { - oskbOn = true; - tft.fillScreenNoDma(RGBVAL16(0x00,0x00,0x00)); - tft.drawTextNoDma(0,32, " Press USER2 to exit onscreen keyboard. ", RGBVAL16(0xff,0xff,0xff), RGBVAL16(0x00,0x00,0x00), true); - tft.drawTextNoDma(0,64, " (USER1 to toggle between keymaps) ", RGBVAL16(0x00,0xff,0xff), RGBVAL16(0x00,0x00,0xff), true); - tft.drawRectNoDma(KXOFF,KYOFF, 22*8, 3*16, RGBVAL16(0x00,0x00,0xFF)); - drawOskb(); - } -} - -static int handleOskb(void) -{ - int retval = 0; - - uint16_t bClick = bLastState & ~oskbBLastState; - oskbBLastState = bLastState; - /* - static const char * digits = "0123456789ABCDEF"; - char buf[5] = {0,0,0,0,0}; - int val = bClick; - buf[0] = digits[(val>>12)&0xf]; - buf[1] = digits[(val>>8)&0xf]; - buf[2] = digits[(val>>4)&0xf]; - buf[3] = digits[val&0xf]; - tft.drawTextNoDma(0,KYOFF+ 64,buf,RGBVAL16(0x00,0x00,0x00),RGBVAL16(0xFF,0xFF,0xFF),1); - */ - if (bClick & MASK_KEY_USER2) - { - toggleOskb(false); - } - if (oskbOn) - { - bool updated = true; - if (bClick & MASK_KEY_USER1) - { - oskbMap += 1; - if (oskbMap == 3) oskbMap = 0; - } - else if (bClick & MASK_JOY2_LEFT) - { - cxpos++; - if (cxpos >= KWIDTH) cxpos = 0; - } - else if (bClick & MASK_JOY2_RIGHT) - { - cxpos--; - if (cxpos < 0) cxpos = KWIDTH-1; - } - else if (bClick & MASK_JOY2_DOWN) - { - cypos++; - if (cypos >= KHEIGHT) cypos = 0; - } - else if (bClick & MASK_JOY2_UP) - { - cypos--; - if (cypos < 0) cypos = KHEIGHT-1; - } - else if (oskbBLastState & MASK_JOY2_BTN) - { - retval = cypos*KWIDTH+cxpos+1; - if (retval) { - retval--; - //if (retval & 1) retval = key_map2[retval>>1]; - //else retval = key_map1[retval>>1]; - if (oskbMap == 0) { - retval = key_map1[retval]; - } - else if (oskbMap == 1) { - retval = key_map2[retval]; - } - else { - retval = key_map3[retval]; - } - //if (retval) { toggleOskb(true); updated=false; }; - } - } - else { - updated=false; - } - if (updated) drawOskb(); - } - - return retval; -} -#endif - -/******************************** - * Input and keyboard -********************************/ -int emu_ReadAnalogJoyX(int min, int max) -{ - adc_select_input(0); - int val = adc_read(); -#if INVX - val = 4095 - val; -#endif - val = val-xRef; - val = ((val*140)/100); - if ( (val > -512) && (val < 512) ) val = 0; - val = val+2048; - return (val*(max-min))/4096; -} - -int emu_ReadAnalogJoyY(int min, int max) -{ - adc_select_input(1); - int val = adc_read(); -#if INVY - val = 4095 - val; -#endif - val = val-yRef; - val = ((val*120)/100); - if ( (val > -512) && (val < 512) ) val = 0; - //val = (val*(max-min))/4096; - val = val+2048; - //return val+(max-min)/2; - return (val*(max-min))/4096; -} - - -static uint16_t readAnalogJoystick(void) -{ - uint16_t joysval = 0; -#ifdef PIN_JOY2_A1X - int xReading = emu_ReadAnalogJoyX(0,256); - if (xReading > 128) joysval |= MASK_JOY2_LEFT; - else if (xReading < 128) joysval |= MASK_JOY2_RIGHT; - - int yReading = emu_ReadAnalogJoyY(0,256); - if (yReading < 128) joysval |= MASK_JOY2_UP; - else if (yReading > 128) joysval |= MASK_JOY2_DOWN; -#endif - // First joystick -#if INVY -#ifdef PIN_JOY2_1 - if ( !gpio_get(PIN_JOY2_1) ) joysval |= MASK_JOY2_DOWN; -#endif -#ifdef PIN_JOY2_2 - if ( !gpio_get(PIN_JOY2_2) ) joysval |= MASK_JOY2_UP; -#endif -#else -#ifdef PIN_JOY2_1 - if ( !gpio_get(PIN_JOY2_1) ) joysval |= MASK_JOY2_UP; -#endif -#ifdef PIN_JOY2_2 - if ( !gpio_get(PIN_JOY2_2) ) joysval |= MASK_JOY2_DOWN; -#endif -#endif -#if INVX -#ifdef PIN_JOY2_3 - if ( !gpio_get(PIN_JOY2_3) ) joysval |= MASK_JOY2_LEFT; -#endif -#ifdef PIN_JOY2_4 - if ( !gpio_get(PIN_JOY2_4) ) joysval |= MASK_JOY2_RIGHT; -#endif -#else -#ifdef PIN_JOY2_3 - if ( !gpio_get(PIN_JOY2_3) ) joysval |= MASK_JOY2_RIGHT; -#endif -#ifdef PIN_JOY2_4 - if ( !gpio_get(PIN_JOY2_4) ) joysval |= MASK_JOY2_LEFT; -#endif -#endif -#ifdef PIN_JOY2_BTN - joysval |= (gpio_get(PIN_JOY2_BTN) ? 0 : MASK_JOY2_BTN); -#endif - - return (joysval); -} - - -int emu_SwapJoysticks(int statusOnly) { - if (!statusOnly) { - if (joySwapped) { - joySwapped = false; - } - else { - joySwapped = true; - } - } - return(joySwapped?1:0); -} - -int emu_GetPad(void) -{ - return(bLastState/*|((joySwapped?1:0)<<7)*/); -} - -int emu_ReadKeys(void) -{ - uint16_t retval; - uint16_t j1 = readAnalogJoystick(); - uint16_t j2 = 0; - - // Second joystick -#if INVY -#ifdef PIN_JOY1_1 - if ( !gpio_get(PIN_JOY1_1) ) j2 |= MASK_JOY2_DOWN; -#endif -#ifdef PIN_JOY1_2 - if ( !gpio_get(PIN_JOY1_2) ) j2 |= MASK_JOY2_UP; -#endif -#else -#ifdef PIN_JOY1_1 - if ( !gpio_get(PIN_JOY1_1) ) j2 |= MASK_JOY2_UP; -#endif -#ifdef PIN_JOY1_2 - if ( !gpio_get(PIN_JOY1_2) ) j2 |= MASK_JOY2_DOWN; -#endif -#endif -#if INVX -#ifdef PIN_JOY1_3 - if ( !gpio_get(PIN_JOY1_3) ) j2 |= MASK_JOY2_LEFT; -#endif -#ifdef PIN_JOY1_4 - if ( !gpio_get(PIN_JOY1_4) ) j2 |= MASK_JOY2_RIGHT; -#endif -#else -#ifdef PIN_JOY1_3 - if ( !gpio_get(PIN_JOY1_3) ) j2 |= MASK_JOY2_RIGHT; -#endif -#ifdef PIN_JOY1_4 - if ( !gpio_get(PIN_JOY1_4) ) j2 |= MASK_JOY2_LEFT; -#endif -#endif -#ifdef PIN_JOY1_BTN - if ( !gpio_get(PIN_JOY1_BTN) ) j2 |= MASK_JOY2_BTN; -#endif - - - if (joySwapped) { - retval = ((j1 << 8) | j2); - } - else { - retval = ((j2 << 8) | j1); - } - - if (usbnavpad & MASK_JOY2_UP) retval |= MASK_JOY2_UP; - if (usbnavpad & MASK_JOY2_DOWN) retval |= MASK_JOY2_DOWN; - if (usbnavpad & MASK_JOY2_LEFT) retval |= MASK_JOY2_LEFT; - if (usbnavpad & MASK_JOY2_RIGHT) retval |= MASK_JOY2_RIGHT; - if (usbnavpad & MASK_JOY2_BTN) retval |= MASK_JOY2_BTN; - -#ifdef PIN_KEY_USER1 - if ( !gpio_get(PIN_KEY_USER1) ) retval |= MASK_KEY_USER1; -#endif -#ifdef PIN_KEY_USER2 - if ( !gpio_get(PIN_KEY_USER2) ) retval |= MASK_KEY_USER2; -#endif -#ifdef PIN_KEY_USER3 - if ( !gpio_get(PIN_KEY_USER3) ) retval |= MASK_KEY_USER3; -#endif -#ifdef PIN_KEY_USER4 - if ( !gpio_get(PIN_KEY_USER4) ) retval |= MASK_KEY_USER4; -#endif - -#ifdef PICOMPUTER - keymatrix_hitrow = -1; - unsigned char row; - unsigned short cols[6]={KCOLOUT1,KCOLOUT2,KCOLOUT3,KCOLOUT4,KCOLOUT5,KCOLOUT6}; - unsigned char keymatrixtmp[6]; - - for (int i=0;i<6;i++){ - gpio_set_dir(cols[i], GPIO_OUT); - gpio_put(cols[i], 0); -#ifdef SWAP_ALT_DEL - sleep_us(1); - //__asm volatile ("nop\n"); // 4-8ns -#endif - row=0; - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN4) ? 0 : 0x02); - row |= (gpio_get(KROWIN1) ? 0 : 0x04); - row |= (gpio_get(KROWIN3) ? 0 : 0x08); - row |= (gpio_get(KROWIN5) ? 0 : 0x10); - row |= (gpio_get(KROWIN6) ? 0 : 0x20); - //gpio_set_dir(cols[i], GPIO_OUT); - gpio_put(cols[i], 1); - gpio_set_dir(cols[i], GPIO_IN); - gpio_disable_pulls(cols[i]); - keymatrixtmp[i] = row; - } - -#ifdef MULTI_DEBOUNCE - for (int i=0;i<6;i++){ - gpio_set_dir(cols[i], GPIO_OUT); - gpio_put(cols[i], 0); -#ifdef SWAP_ALT_DEL - sleep_us(1); - //__asm volatile ("nop\n"); // 4-8ns -#endif - row=0; - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN4) ? 0 : 0x02); - row |= (gpio_get(KROWIN1) ? 0 : 0x04); - row |= (gpio_get(KROWIN3) ? 0 : 0x08); - row |= (gpio_get(KROWIN5) ? 0 : 0x10); - row |= (gpio_get(KROWIN6) ? 0 : 0x20); - //gpio_set_dir(cols[i], GPIO_OUT); - gpio_put(cols[i], 1); - gpio_set_dir(cols[i], GPIO_IN); - gpio_disable_pulls(cols[i]); - keymatrixtmp[i] |= row; - } - - for (int i=0;i<6;i++){ - gpio_set_dir(cols[i], GPIO_OUT); - gpio_put(cols[i], 0); -#ifdef SWAP_ALT_DEL - sleep_us(1); - //__asm volatile ("nop\n"); // 4-8ns -#endif - row=0; - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN4) ? 0 : 0x02); - row |= (gpio_get(KROWIN1) ? 0 : 0x04); - row |= (gpio_get(KROWIN3) ? 0 : 0x08); - row |= (gpio_get(KROWIN5) ? 0 : 0x10); - row |= (gpio_get(KROWIN6) ? 0 : 0x20); - //gpio_set_dir(cols[i], GPIO_OUT); - gpio_put(cols[i], 1); - gpio_set_dir(cols[i], GPIO_IN); - gpio_disable_pulls(cols[i]); - keymatrixtmp[i] |= row; - } -#endif - -#ifdef SWAP_ALT_DEL - // Swap ALT and DEL - unsigned char alt = keymatrixtmp[0] & 0x02; - unsigned char del = keymatrixtmp[5] & 0x20; - keymatrixtmp[0] &= ~0x02; - keymatrixtmp[5] &= ~0x20; - if (alt) keymatrixtmp[5] |= 0x20; - if (del) keymatrixtmp[0] |= 0x02; -#endif - - bool alt_pressed=false; - if ( keymatrixtmp[5] & 0x20 ) {alt_pressed=true; keymatrixtmp[5] &= ~0x20;}; - - for (int i=0;i<6;i++){ - row = keymatrixtmp[i]; - if (row) keymatrix_hitrow=i; - keymatrix[i] = row; - } - - //6,9,15,8,7,22 -#if INVX - if ( row & 0x2 ) retval |= MASK_JOY2_LEFT; - if ( row & 0x1 ) retval |= MASK_JOY2_RIGHT; -#else - if ( row & 0x1 ) retval |= MASK_JOY2_LEFT; - if ( row & 0x2 ) retval |= MASK_JOY2_RIGHT; -#endif -#if INVY - if ( row & 0x8 ) retval |= MASK_JOY2_DOWN; - if ( row & 0x4 ) retval |= MASK_JOY2_UP; -#else - if ( row & 0x4 ) retval |= MASK_JOY2_DOWN; - if ( row & 0x8 ) retval |= MASK_JOY2_UP; -#endif - if ( row & 0x10 ) retval |= MASK_JOY2_BTN; - - // Handle LED flash - uint32_t time_ms=to_ms_since_boot (get_absolute_time()); - if ((time_ms-last_t_ms) > 100) { - last_t_ms = time_ms; - if (ledflash_toggle == false) { - ledflash_toggle = true; - } - else { - ledflash_toggle = false; - } - } - - if ( alt_pressed ) { - if (key_fn == false) - { - // Release to Press transition - if (hundred_ms_cnt == 0) { - keypress_t_ms=time_ms; - hundred_ms_cnt += 1; // 1 - } - else { - hundred_ms_cnt += 1; // 2 - if (hundred_ms_cnt >= 2) - { - hundred_ms_cnt = 0; - /* - if ( (time_ms-keypress_t_ms) < 500) - { - if (key_alt == false) - { - key_alt = true; - } - else - { - key_alt = false; - } - } - */ - } - } - } - else { - // Keep press - if (hundred_ms_cnt == 1) { - if ((to_ms_since_boot (get_absolute_time())-keypress_t_ms) > 2000) - { - if (key_alt == false) - { - key_alt = true; - } - else - { - key_alt = false; - } - hundred_ms_cnt = 0; - } - } - } - key_fn = true; - } - else { - key_fn = false; - } - - // Handle LED - if (key_alt == true) { - gpio_put(KLED, (ledflash_toggle?1:0)); - } - else { - if (key_fn == true) { - gpio_put(KLED, 1); - } - else { - gpio_put(KLED, 0); - } - } - - if ( key_fn ) retval |= MASK_KEY_USER2; - if ( ( key_fn ) && (keymatrix[0] == 0x02 )) retval |= MASK_KEY_USER1; -#endif - - //Serial.println(retval,HEX); - - if ( ((retval & (MASK_KEY_USER1+MASK_KEY_USER2)) == (MASK_KEY_USER1+MASK_KEY_USER2)) - || (retval & MASK_KEY_USER4 ) ) - { - } - -#if (defined(ILI9341) || defined(ST7789)) && defined(USE_VGA) - if (oskbOn) { - retval |= MASK_OSKB; - } -#endif - - return (retval); -} - -unsigned short emu_DebounceLocalKeys(void) -{ - uint16_t bCurState = emu_ReadKeys(); - uint16_t bClick = bCurState & ~bLastState; - bLastState = bCurState; - - return (bClick); -} - -int emu_ReadI2CKeyboard(void) { - int retval=0; -#ifdef PICOMPUTER - if (key_alt) { - keys = (const unsigned short *)key_map3; - } - else if (key_fn) { - keys = (const unsigned short *)key_map2; - } - else { - keys = (const unsigned short *)key_map1; - } - if (keymatrix_hitrow >=0 ) { - unsigned short match = ((unsigned short)keymatrix_hitrow<<8) | keymatrix[keymatrix_hitrow]; - for (int i=0; i=0) { - menuRedraw=true; - curFile -= 9; - } else if (curFile!=0) { - menuRedraw=true; - curFile--; - } - } - else if ( (bClick & MASK_JOY2_DOWN) || (bClick & MASK_JOY1_DOWN) ) { - if ((curFile<(nbFiles-1)) && (nbFiles)) { - curFile++; - menuRedraw=true; - } - } - else if ( (bClick & MASK_JOY2_LEFT) || (bClick & MASK_JOY1_LEFT) ) { - if ((curFile<(nbFiles-9)) && (nbFiles)) { - curFile += 9; - menuRedraw=true; - } - else if ((curFile<(nbFiles-1)) && (nbFiles)) { - curFile++; - menuRedraw=true; - } - } - else if ( (bClick & MASK_KEY_USER2) ) { - emu_SwapJoysticks(0); - menuRedraw=true; - } - - if (menuRedraw && nbFiles) { - int fileIndex = 0; - tft.drawRectNoDma(MENU_FILE_XOFFSET,MENU_FILE_YOFFSET, MENU_FILE_W, MENU_FILE_H, MENU_FILE_BGCOLOR); -// if (curFile <= (MAX_MENULINES/2-1)) topFile=0; -// else topFile=curFile-(MAX_MENULINES/2); - if (curFile <= (MAX_MENULINES-1)) topFile=0; - else topFile=curFile-(MAX_MENULINES/2); - - int i=0; - while (i=nbFiles) { - // no more files - break; - } - char * filename = &files[fileIndex][0]; - if (fileIndex >= topFile) { - if ((i+topFile) < nbFiles ) { - if ((i+topFile)==curFile) { - tft.drawTextNoDma(MENU_FILE_XOFFSET,i*TEXT_HEIGHT+MENU_FILE_YOFFSET, filename, RGBVAL16(0xff,0xff,0x00), RGBVAL16(0xff,0x00,0x00), true); - strcpy(selected_filename,filename); - } - else { - tft.drawTextNoDma(MENU_FILE_XOFFSET,i*TEXT_HEIGHT+MENU_FILE_YOFFSET, filename, RGBVAL16(0xff,0xff,0xff), MENU_FILE_BGCOLOR, true); - } - } - i++; - } - fileIndex++; - } - - - tft.drawTextNoDma(48,MENU_JOYS_YOFFSET+8, (emu_SwapJoysticks(1)?(char*)"SWAP=1":(char*)"SWAP=0"), RGBVAL16(0x00,0xff,0xff), RGBVAL16(0x00,0x00,0xff), false); - menuRedraw=false; - } - - return (action); -} - -bool menuActive(void) -{ - return (menuOn); -} - -void toggleMenu(bool on) { - if (on) { - menuOn = true; - backgroundMenu(); - } else { - menuOn = false; - } -} - -char * menuSelection(void) -{ - return (selection); -} - - -/******************************** - * File IO -********************************/ -int emu_FileOpen(const char * filepath, const char * mode) -{ - int retval = 0; - - emu_printf("FileOpen..."); - emu_printf(filepath); - if( !(f_open(&file, filepath, FA_READ)) ) { - retval = 1; - } - else { - emu_printf("FileOpen failed"); - } - return (retval); -} - -int emu_FileRead(void * buf, int size, int handler) -{ - unsigned int retval=0; - f_read (&file, (void*)buf, size, &retval); - return retval; -} - -int emu_FileGetc(int handler) -{ - unsigned char c; - unsigned int retval=0; - if( !(f_read (&file, &c, 1, &retval)) ) - if (retval != 1) { - emu_printf("emu_FileGetc failed"); - } - return (int)c; -} - -void emu_FileClose(int handler) -{ - f_close(&file); -} - -int emu_FileSeek(int handler, int seek, int origin) -{ - f_lseek(&file, seek); - return (seek); -} - -int emu_FileTell(int handler) -{ - return (f_tell(&file)); -} - - -unsigned int emu_FileSize(const char * filepath) -{ - int filesize=0; - emu_printf("FileSize..."); - emu_printf(filepath); - FILINFO entry; - f_stat(filepath, &entry); - filesize = entry.fsize; - return(filesize); -} - -unsigned int emu_LoadFile(const char * filepath, void * buf, int size) -{ - int filesize = 0; - - emu_printf("LoadFile..."); - emu_printf(filepath); - if( !(f_open(&file, filepath, FA_READ)) ) { - filesize = f_size(&file); - emu_printf(filesize); - if (size >= filesize) - { - unsigned int retval=0; - if( (f_read (&file, buf, filesize, &retval)) ) { - emu_printf("File read failed"); - } - } - f_close(&file); - } - - return(filesize); -} - -static FIL outfile; - -static bool emu_writeConfig(void) -{ - bool retval = false; - if( !(f_open(&outfile, ROMSDIR "/" AUTORUN_FILENAME, FA_CREATE_NEW | FA_WRITE)) ) { - unsigned int sizeread=0; - if( (f_write (&outfile, selection, strlen(selection), &sizeread)) ) { - emu_printf("Config write failed"); - } - else { - retval = true; - } - f_close(&outfile); - } - return retval; -} - -static bool emu_readConfig(void) -{ - bool retval = false; - if( !(f_open(&outfile, ROMSDIR "/" AUTORUN_FILENAME, FA_READ)) ) { - unsigned int filesize = f_size(&outfile); - unsigned int sizeread=0; - if( (f_read (&outfile, selection, filesize, &sizeread)) ) { - emu_printf("Config read failed"); - } - else { - if (sizeread == filesize) { - selection[filesize]=0; - retval = true; - } - } - f_close(&outfile); - } - return retval; -} - -static bool emu_eraseConfig(void) -{ - f_unlink (ROMSDIR "/" AUTORUN_FILENAME); -} - - -/******************************** - * Initialization -********************************/ -void emu_init(void) -{ - // Dual display config, initialize TFT -#if (defined(ILI9341) || defined(ST7789)) && defined(USE_VGA) - tft.begin(); -#endif - - sd_init_driver(); - FRESULT fr = f_mount(&fatfs, "0:", 1); - - strcpy(selection,ROMSDIR); - nbFiles = readNbFiles(selection); - - emu_printf("SD initialized, files found: "); - emu_printi(nbFiles); - - emu_InitJoysticks(); -#ifdef SWAP_JOYSTICK - joySwapped = true; -#else - joySwapped = false; -#endif - - int keypressed = emu_ReadKeys(); -#ifdef PICOMPUTER - // Flip screen if UP pressed - if (keypressed & MASK_JOY2_UP) - { -#ifdef PICOMPUTERMAX -#ifndef USE_VGA - tft.flipscreen(true); -#endif -#else - tft.flipscreen(true); -#endif - } - else - { -#ifdef PICOMPUTERMAX -#ifndef USE_VGA - tft.flipscreen(false); -#endif -#else - tft.flipscreen(false); -#endif - } -#endif - - if (keypressed & MASK_JOY2_DOWN) { - tft.fillScreenNoDma( RGBVAL16(0xff,0x00,0x00) ); - tft.drawTextNoDma(64,48, (char*)" AUTURUN file erased", RGBVAL16(0xff,0xff,0x00), RGBVAL16(0xff,0x00,0x00), true); - tft.drawTextNoDma(64,48+24, (char*)"Please reset the board!", RGBVAL16(0xff,0xff,0x00), RGBVAL16(0xff,0x00,0x00), true); - emu_eraseConfig(); - } - else { - if (emu_readConfig()) { - autorun = true; - } - } - toggleMenu(true); -} - - -void emu_start(void) -{ - usbnavpad = 0; - - keyMap = 0; -} diff --git a/MCUME_pico/pico64/emuapi.h b/MCUME_pico/pico64/emuapi.h deleted file mode 100644 index f496a19..0000000 --- a/MCUME_pico/pico64/emuapi.h +++ /dev/null @@ -1,144 +0,0 @@ -#ifndef EMUAPI_H -#define EMUAPI_H - -#include "platform_config.h" - -#define CUSTOM_SND 1 -//#define TIMER_REND 1 - -#define EXTRA_HEAP 0x10 - -// Title: < > -#define TITLE " C64 Emulator " -#define ROMSDIR "c64" - -#define emu_Init(ROM) {c64_Start(ROM); c64_Init(); } -#define emu_Step(x) { c64_Step(); } -#define emu_Input(x) { c64_Input(x); } - -#define PALETTE_SIZE 256 -#define VID_FRAME_SKIP 0x0 -#define TFT_VBUFFER_YCROP 0 -#define SINGLELINE_RENDERING 1 - -#define ACTION_NONE 0 -#define ACTION_MAXKBDVAL 12 -#define ACTION_EXITKBD 128 -#define ACTION_RUNTFT 129 -#define ACTION_RUNVGA 130 - -#ifdef KEYMAP_PRESENT - -#define keylables_map1_0 (char *)"qwertyuiop\x1a" -#define keylables_map1_1 (char *)" asdfghjkl\x19" -#define keylables_map1_2 (char *)" zxcvbnm.\x10 " -const unsigned short key_map1[] = { - 'Q','W','E','R','T','Y','U','I','O','P',157, - 0,'A','S','D','F','G','H','J','K','L',0x0D, - 0,'Z','X','C','V','B','N','M','.',' ', - 145,157,29,17 - }; - -#define keylables_map2_0 (char *)"1234567890 " -#define keylables_map2_1 (char *)" !@#$%+&*- " -#define keylables_map2_2 (char *)" ()?/\"<>,: " -const unsigned short key_map2[] = { - '1','2','3','4','5','6','7','8','9','0',0, - 0, '!','@','#','$','%','+','&','*','-','\/', - 0, '(',')','?','\/','"','<','>',',',':', - 0,0,0,0 - }; - -#define keylables_map3_0 (char *)"\x11\x12\x13\x14\x15\x16\x17\x18 " -#define keylables_map3_1 (char *)" " -#define keylables_map3_2 (char *)" ;= " -const unsigned short key_map3[] = { - 133,134,135,136,137,138,139,140,0,0,0, // function keys - 0, 0,0,0,0,0,0,0,0,0,0, - 0, 0,0,0,0,0,0,0,';','=', - 0,0,0,0 - }; - -const unsigned short matkeys[] = { - 0x020,0x120,0x220,0x320,0x420,0x408,0x308,0x208,0x108,0x008,0x002, // row 1 - 0x510,0x010,0x110,0x210,0x310,0x410,0x401,0x301,0x201,0x101,0x001, // row 2 - 0x520,0x102,0x202,0x302,0x402,0x404,0x304,0x204,0x104,0x004, // row 3 - 0x508,0x501,0x502,0x504 }; // cursor keys - -#endif - - -#define MASK_JOY2_RIGHT 0x0001 -#define MASK_JOY2_LEFT 0x0002 -#define MASK_JOY2_UP 0x0004 -#define MASK_JOY2_DOWN 0x0008 -#define MASK_JOY2_BTN 0x0010 -#define MASK_KEY_USER1 0x0020 -#define MASK_KEY_USER2 0x0040 -#define MASK_KEY_USER3 0x0080 -#define MASK_JOY1_RIGHT 0x0100 -#define MASK_JOY1_LEFT 0x0200 -#define MASK_JOY1_UP 0x0400 -#define MASK_JOY1_DOWN 0x0800 -#define MASK_JOY1_BTN 0x1000 -#define MASK_KEY_USER4 0x2000 -#define MASK_OSKB 0x8000 - - - -extern void emu_init(void); -extern void emu_start(void); -extern void emu_resetSD(void); - -extern void emu_printf(const char * text); -extern void emu_printi(int val); -extern void * emu_Malloc(int size); -extern void emu_Free(void * pt); - -extern int emu_FileOpen(const char * filepath, const char * mode); -extern int emu_FileRead(void * buf, int size, int handler); -extern int emu_FileGetc(int handler); -extern int emu_FileSeek(int handler, int seek, int origin); -extern int emu_FileTell(int handler); -extern void emu_FileClose(int handler); - -extern unsigned int emu_FileSize(const char * filepath); -extern unsigned int emu_LoadFile(const char * filepath, void * buf, int size); - -extern void emu_SetPaletteEntry(unsigned char r, unsigned char g, unsigned char b, int index); -extern void emu_DrawScreen(unsigned char * VBuf, int width, int height, int stride); -extern void emu_DrawLine(unsigned char * VBuf, int width, int height, int line); -extern void emu_DrawLine8(unsigned char * VBuf, int width, int height, int line); -extern void emu_DrawLine16(unsigned short * VBuf, int width, int height, int line); -extern void emu_DrawVsync(void); -extern int emu_FrameSkip(void); -extern void * emu_LineBuffer(int line); - -extern void emu_InitJoysticks(void); -extern int emu_SwapJoysticks(int statusOnly); -extern unsigned short emu_DebounceLocalKeys(void); -extern int emu_ReadKeys(void); -extern int emu_GetPad(void); -extern int emu_ReadAnalogJoyX(int min, int max); -extern int emu_ReadAnalogJoyY(int min, int max); -extern int emu_ReadI2CKeyboard(void); -extern unsigned char emu_ReadI2CKeyboard2(int row); -extern void emu_KeyboardOnUp(int keymodifer, int key); -extern void emu_KeyboardOnDown(int keymodifer, int key); -extern int emu_oskbActive(void); - -extern void emu_sndPlaySound(int chan, int volume, int freq); -extern void emu_sndPlayBuzz(int size, int val); -extern void emu_sndInit(); -extern void emu_resetus(void); -extern int emu_us(void); - -extern int emu_setKeymap(int index); - -extern void emu_FileTempInit(void); -extern void emu_FileTempRead(int addr, unsigned char * val, int n); -extern void emu_FileTempWrite(int addr, unsigned char val); -extern void emu_printh(int val); - - -#endif diff --git a/MCUME_pico/pico64/emucfg.h b/MCUME_pico/pico64/emucfg.h new file mode 100644 index 0000000..5c495f5 --- /dev/null +++ b/MCUME_pico/pico64/emucfg.h @@ -0,0 +1,94 @@ +#ifndef EMUCFG_H +#define EMUCFG_H + +#define PALETTE_SIZE 256 +#define VID_FRAME_SKIP 0x0 +#define TFT_VBUFFER_YCROP 0 +#define SINGLELINE_RENDERING 1 +#define CUSTOM_SND 1 +//#define TIMER_REND 1 +#define EXTRA_HEAP 0x10 +#define FILEBROWSER + +// Title: < > +#define TITLE " C64 Emulator " +#define ROMSDIR "c64" + +#define emu_Init(ROM) {c64_Start(ROM); c64_Init(); } +#define emu_Step(x) { c64_Step(); } +#define emu_Input(x) { c64_Input(x); } + +#ifdef KEYMAP_PRESENT + +#ifdef PICOZX +const unsigned short key_map1[] = { + '1','2','3','4','5','6','7','8','9','0', + 'Q','W','E','R','T','Y','U','I','O','P', + 'A','S','D','F','G','H','J','K','L',0x0D, + 0,'Z','X','C','V','B','N','M',0,' ', + 145,157,29,17,157,29 //U L R D L R + }; + +const unsigned short key_map2[] = { + '!','@','#','$','%','&','\'','(',')','_', + 0,0,0,'<','>',0,0,0,';','"', + 0,0,0,0,0,'^','-','+','=',0x0D, + 0,':',0,'?','\/','*',',','.',0,' ', + 0,0,0,0,0,0 + }; + +const unsigned short key_map3[] = { + 133,134,135,136,137,138,139,140,0,0, // function keys + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0 + }; + +const unsigned short matkeys[] = { + 0x104,0x101,0x108,0x102,0x110,0x120,0x140,0x204,0x201,0x208, // row 1 + 0x202,0x210,0x220,0x240,0x304,0x301,0x308,0x302,0x310,0x320, // row 2 + 0x340,0x404,0x401,0x408,0x402,0x410,0x420,0x440,0x504,0x501, // row 3 + 0x020,0x508,0x502,0x510,0x520,0x540,0x604,0x601,0x040,0x608, // row 4 + 0x008,0x001,0x002,0x010,0x620,0x640 }; // cursor keys up, left, right, down, <<<, >>> + +#else +#define keylables_map1_0 (char *)"qwertyuiop\x1a" +#define keylables_map1_1 (char *)" asdfghjkl\x19" +#define keylables_map1_2 (char *)" zxcvbnm.\x10 " +const unsigned short key_map1[] = { + 'Q','W','E','R','T','Y','U','I','O','P',157, + 0,'A','S','D','F','G','H','J','K','L',0x0D, + 0,'Z','X','C','V','B','N','M','.',' ', + 145,157,29,17 //U L R D + }; + +#define keylables_map2_0 (char *)"1234567890 " +#define keylables_map2_1 (char *)" !@#$%+&*- " +#define keylables_map2_2 (char *)" ()?/\"<>,: " +const unsigned short key_map2[] = { + '1','2','3','4','5','6','7','8','9','0',0, + 0, '!','@','#','$','%','+','&','*','-','\/', + 0, '(',')','?','\/','"','<','>',',',':', + 0,0,0,0 + }; + +#define keylables_map3_0 (char *)"\x11\x12\x13\x14\x15\x16\x17\x18 " +#define keylables_map3_1 (char *)" " +#define keylables_map3_2 (char *)" ;= " +const unsigned short key_map3[] = { + 133,134,135,136,137,138,139,140,0,0,0, // function keys + 0, 0,0,0,0,0,0,0,0,0,0, + 0, 0,0,0,0,0,0,0,';','=', + 0,0,0,0 + }; + +const unsigned short matkeys[] = { + 0x020,0x120,0x220,0x320,0x420,0x408,0x308,0x208,0x108,0x008,0x002, // row 1 + 0x510,0x010,0x110,0x210,0x310,0x410,0x401,0x301,0x201,0x101,0x001, // row 2 + 0x520,0x102,0x202,0x302,0x402,0x404,0x304,0x204,0x104,0x004, // row 3 + 0x508,0x501,0x502,0x504 }; // cursor keys +#endif +#endif + +#endif diff --git a/MCUME_pico/pico64/pico64.cpp b/MCUME_pico/pico64/pico64.cpp index 0447186..24425ad 100644 --- a/MCUME_pico/pico64/pico64.cpp +++ b/MCUME_pico/pico64/pico64.cpp @@ -9,12 +9,8 @@ extern "C" { #include "c64.h" #include +#include "pico_dsp.h" -#ifdef USE_VGA -#include "vga_t_dma.h" -#else -#include "tft_t_dma.h" -#endif volatile bool vbl=true; bool repeating_timer_callback(struct repeating_timer *t) { @@ -27,11 +23,10 @@ bool repeating_timer_callback(struct repeating_timer *t) { } return true; } -TFT_T_DMA tft; +PICO_DSP tft; static int skip=0; - #include "hardware/clocks.h" #include "hardware/vreg.h" @@ -42,83 +37,74 @@ int main(void) { // set_sys_clock_khz(133000, true); // set_sys_clock_khz(200000, true); // set_sys_clock_khz(210000, true); - set_sys_clock_khz(230000, true); +// set_sys_clock_khz(230000, true); // set_sys_clock_khz(225000, true); -// set_sys_clock_khz(250000, true); + set_sys_clock_khz(250000, true); stdio_init_all(); -#ifdef USE_VGA -// tft.begin(VGA_MODE_400x240); - tft.begin(VGA_MODE_320x240); -#else - tft.begin(); -#endif emu_init(); - while (true) { + char * filename; +#ifdef FILEBROWSER + while (true) { if (menuActive()) { uint16_t bClick = emu_DebounceLocalKeys(); int action = handleMenu(bClick); - char * filename = menuSelection(); - if (action == ACTION_RUNTFT) { - toggleMenu(false); - emu_start(); - emu_Init(filename); - tft.fillScreenNoDma( RGBVAL16(0x00,0x00,0x00) ); - tft.startDMA(); - struct repeating_timer timer; - add_repeating_timer_ms(25, repeating_timer_callback, NULL, &timer); - } + filename = menuSelection(); + if (action == ACTION_RUN) { + break; + } tft.waitSync(); } - else { - emu_Step(); - } - - //int c = getchar_timeout_us(0); - //switch (c) { - // case ' ': - // printf("test: %d\n", 1); - // break; - //} + } +#endif + emu_start(); + emu_Init(filename); + tft.startRefresh(); + struct repeating_timer timer; + add_repeating_timer_ms(25, repeating_timer_callback, NULL, &timer); + while (true) { + //uint16_t bClick = emu_DebounceLocalKeys(); + //emu_Input(bClick); + emu_Step(); } } -static unsigned char palette8[PALETTE_SIZE]; static unsigned short palette16[PALETTE_SIZE]; - void emu_SetPaletteEntry(unsigned char r, unsigned char g, unsigned char b, int index) { if (index #include -#include "util.h" +#include "timerutil.h" //Attention, don't use WFI-instruction - the CPU does not count cycles during sleep void enableCycleCounter(void) { diff --git a/MCUME_pico/pico64/util.h b/MCUME_pico/pico64/timerutil.h similarity index 100% rename from MCUME_pico/pico64/util.h rename to MCUME_pico/pico64/timerutil.h diff --git a/MCUME_pico/pico64/vic.cpp b/MCUME_pico/pico64/vic.cpp index bc1d3d7..8c8f019 100644 --- a/MCUME_pico/pico64/vic.cpp +++ b/MCUME_pico/pico64/vic.cpp @@ -52,6 +52,7 @@ #include #include + #define min(a, b) (((a) < (b)) ? (a) : (b)) #define max(a, b) (((a) > (b)) ? (a) : (b)) @@ -69,11 +70,7 @@ #define BORDER_LEFT (400-320)/2 #define BORDER_RIGHT 0 -#ifdef USE_VGA -typedef uint8_t tpixel; -#else typedef uint16_t tpixel; -#endif #define MAXCYCLESSPRITES0_2 3 #define MAXCYCLESSPRITES3_7 5 @@ -1275,7 +1272,7 @@ typedef void (*modes_t)( tpixel *p, const tpixel *pe, uint16_t *spl, const uint1 const modes_t modes[8] = {mode0, mode1, mode2, mode3, mode4, mode5, mode6, mode7}; -static tpixel linebuffer[SCREEN_WIDTH]; +static tpixel linebuffer[SCREEN_WIDTH*16]; void vic_do(void) { @@ -1396,11 +1393,7 @@ void vic_do(void) { } //max_x = (!cpu.vic.CSEL) ? 40:38; -#ifdef USE_VGA - p = (tpixel*)emu_LineBuffer((r - FIRSTDISPLAYLINE)); -#else p = &linebuffer[0]; -#endif pe = p + SCREEN_WIDTH; //Left Screenborder: Cycle 10 spl = &cpu.vic.spriteLine[24]; @@ -1563,11 +1556,7 @@ g-Zugriff if (!cpu.vic.CSEL) { cpu_clock(1); uint16_t col = cpu.vic.colors[0]; -#ifdef USE_VGA - p = (tpixel*)emu_LineBuffer((r - FIRSTDISPLAYLINE)) + BORDER_LEFT; -#else p = &linebuffer[0]; // tft.getLineBuffer((r - FIRSTDISPLAYLINE)); -#endif #if 0 // Sprites im Rand uint16_t sprite; @@ -1589,11 +1578,7 @@ g-Zugriff #endif //Rand rechts: -#ifdef USE_VGA - p = (tpixel*)emu_LineBuffer((r - FIRSTDISPLAYLINE)) + SCREEN_WIDTH - 9 + BORDER_LEFT; -#else p = &linebuffer[SCREEN_WIDTH - 9 + BORDER_LEFT]; //tft.getLineBuffer((r - FIRSTDISPLAYLINE)) + SCREEN_WIDTH - 9 + BORDER_LEFT; -#endif pe = p + 9; #if 0 @@ -1613,12 +1598,8 @@ g-Zugriff } -#ifdef USE_VGA - //emu_DrawLine8(&linebuffer[0], SCREEN_WIDTH, SCREEN_HEIGHT, (r - FIRSTDISPLAYLINE)); -#else emu_DrawLine16(&linebuffer[0], SCREEN_WIDTH, SCREEN_HEIGHT, (r - FIRSTDISPLAYLINE)); - //memset(&linebuffer[0],0,320*2); -#endif + memset(&linebuffer[0],0,SCREEN_WIDTH*2); diff --git a/MCUME_pico/pico800/AudioPlaySystem.cpp b/MCUME_pico/pico800/AudioPlaySystem.cpp deleted file mode 100644 index aee40a1..0000000 --- a/MCUME_pico/pico800/AudioPlaySystem.cpp +++ /dev/null @@ -1,176 +0,0 @@ -#include "emuapi.h" - -#ifdef HAS_SND - -#include "AudioPlaySystem.h" - -#define SAMPLERATE AUDIO_SAMPLE_RATE_EXACT -#define CLOCKFREQ 985248 - -#ifndef CUSTOM_SND -static const short square[]={ -32767,32767,32767,32767, -32767,32767,32767,32767, -32767,32767,32767,32767, -32767,32767,32767,32767, -32767,32767,32767,32767, -32767,32767,32767,32767, -32767,32767,32767,32767, -32767,32767,32767,32767, --32767,-32767,-32767,-32767, --32767,-32767,-32767,-32767, --32767,-32767,-32767,-32767, --32767,-32767,-32767,-32767, --32767,-32767,-32767,-32767, --32767,-32767,-32767,-32767, --32767,-32767,-32767,-32767, --32767,-32767,-32767,-32767, -}; - -const short noise[] { --32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767, --32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,32767,-32767, --32767,-32767,32767,-32767,-32767,-32767,32767,-32767,-32767,-32767,32767,-32767,-32767,-32767,32767,-32767, --32767,-32767,32767,-32767,-32767,-32767,32767,-32767,-32767,-32767,32767,-32767,-32767,32767,32767,-32767, --32767,-32767,32767,-32767,-32767,32767,32767,-32767,-32767,-32767,32767,-32767,-32767,32767,32767,-32767, --32767,-32767,32767,-32767,-32767,32767,32767,-32767,-32767,-32767,32767,-32767,32767,32767,32767,-32767, -32767,-32767,32767,-32767,-32767,32767,32767,-32767,-32767,-32767,32767,-32767,32767,32767,32767,-32767, -32767,-32767,32767,-32767,-32767,32767,32767,-32767,-32767,-32767,32767,32767,32767,32767,32767,-32767, -32767,-32767,32767,-32767,-32767,32767,32767,-32767,-32767,-32767,32767,32767,32767,32767,32767,-32767, -32767,-32767,32767,-32767,-32767,32767,32767,-32767,-32767,-32767,-32767,32767,32767,32767,-32767,-32767, -32767,-32767,-32767,-32767,-32767,32767,-32767,-32767,-32767,-32767,32767,32767,32767,32767,32767,-32767, -32767,-32767,32767,-32767,-32767,32767,32767,-32767,-32767,32767,-32767,32767,32767,32767,-32767,-32767, -32767,32767,-32767,-32767,-32767,32767,-32767,-32767,-32767,-32767,32767,32767,32767,32767,32767,-32767, -32767,-32767,32767,-32767,-32767,32767,32767,-32767,32767,32767,-32767,32767,-32767,32767,-32767,-32767, -32767,32767,-32767,-32767,-32767,32767,-32767,-32767,-32767,-32767,32767,32767,32767,32767,32767,-32767, -32767,-32767,32767,-32767,-32767,32767,32767,32767,32767,32767,-32767,32767,-32767,32767,-32767,-32767, -}; - -#define NOISEBSIZE 0x100 - -typedef struct -{ - unsigned int spos; - unsigned int sinc; - unsigned int vol; -} Channel; - -static Channel chan[6] = { - {0,0,0}, - {0,0,0}, - {0,0,0}, - {0,0,0}, - {0,0,0}, - {0,0,0} }; - -#endif - -volatile bool playing = false; - - -static void snd_Reset(void) -{ -#ifndef CUSTOM_SND - chan[0].vol = 0; - chan[1].vol = 0; - chan[2].vol = 0; - chan[3].vol = 0; - chan[4].vol = 0; - chan[5].vol = 0; - chan[0].sinc = 0; - chan[1].sinc = 0; - chan[2].sinc = 0; - chan[3].sinc = 0; - chan[4].sinc = 0; - chan[5].sinc = 0; -#endif -} - - -#ifdef CUSTOM_SND -extern "C" { -void SND_Process(void *sndbuffer, int sndn); -} -#endif - -#include -void AudioPlaySystem::snd_Mixer(short * stream, int len ) -{ - if (playing) - { -#ifdef CUSTOM_SND - //printf("s\n"); - SND_Process((void*)stream, len); -#else - int i; - long s; - len = len >> 1; - short v0=chan[0].vol; - short v1=chan[1].vol; - short v2=chan[2].vol; - short v3=chan[3].vol; - short v4=chan[4].vol; - short v5=chan[5].vol; - for (i=0;i>8)&0x3f])>>11); - s+=((v1*square[(chan[1].spos>>8)&0x3f])>>11); - s+=((v2*square[(chan[2].spos>>8)&0x3f])>>11); - s+=((v3*noise[(chan[3].spos>>8)&(NOISEBSIZE-1)])>>11); - s+=((v4*noise[(chan[4].spos>>8)&(NOISEBSIZE-1)])>>11); - s+=((v5*noise[(chan[5].spos>>8)&(NOISEBSIZE-1)])>>11); - *stream++ = (short)(s); - *stream++ = (short)(s); - chan[0].spos += chan[0].sinc; - chan[1].spos += chan[1].sinc; - chan[2].spos += chan[2].sinc; - chan[3].spos += chan[3].sinc; - chan[4].spos += chan[4].sinc; - chan[5].spos += chan[5].sinc; - } -#endif - } -} - -void AudioPlaySystem::begin(void) -{ - this->reset(); -} - -void AudioPlaySystem::start(void) -{ - playing = true; -} - -void AudioPlaySystem::setSampleParameters(float clockfreq, float samplerate) { -} - -void AudioPlaySystem::reset(void) -{ - snd_Reset(); -} - -void AudioPlaySystem::stop(void) -{ - playing = false; -} - -bool AudioPlaySystem::isPlaying(void) -{ - return playing; -} - - - -void AudioPlaySystem::sound(int C, int F, int V) { -#ifndef CUSTOM_SND - if (C < 6) { - chan[C].vol = V; - chan[C].sinc = F>>1; - } -#endif -} - -void AudioPlaySystem::step(void) { -} -#endif diff --git a/MCUME_pico/pico800/AudioPlaySystem.h b/MCUME_pico/pico800/AudioPlaySystem.h deleted file mode 100644 index 5d2efc0..0000000 --- a/MCUME_pico/pico800/AudioPlaySystem.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef audioplaysystem_h_ -#define audioplaysystem_h_ - -#ifdef HAS_SND - -#include "platform_config.h" - -class AudioPlaySystem -{ -public: - AudioPlaySystem(void) { }; - void begin(void); - void setSampleParameters(float clockfreq, float samplerate); - void reset(void); - void start(void); - void stop(void); - bool isPlaying(void); - void sound(int C, int F, int V); - void buzz(int size, int val); - void step(void); - static void snd_Mixer(short * stream, int len ); -}; - -#endif - -#endif diff --git a/MCUME_pico/pico800/antic.c b/MCUME_pico/pico800/antic.c index 542f5fa..843d3eb 100644 --- a/MCUME_pico/pico800/antic.c +++ b/MCUME_pico/pico800/antic.c @@ -41,7 +41,7 @@ UWORD Screen_atari[ATARI_WIDTH / 2]; // = NULL; #define DRAWLINE() \ if ( (ANTIC_ypos > 8) && (ANTIC_ypos < 248)) { \ - emu_DrawLine((unsigned char *)&Screen_atari[32/sizeof(Screen_atari[0])], 320, 240, ANTIC_ypos-8); \ + emu_DrawLinePal16((unsigned char *)&Screen_atari[32/sizeof(Screen_atari[0])], 320, 240, ANTIC_ypos-8); \ } diff --git a/MCUME_pico/pico800/atari800.c b/MCUME_pico/pico800/atari800.c index 3a37b0d..d656ae1 100644 --- a/MCUME_pico/pico800/atari800.c +++ b/MCUME_pico/pico800/atari800.c @@ -33,9 +33,6 @@ typedef struct } CONTROLLER; - - - // global variables unsigned char mem[MEMORY_SIZE]; unsigned char * memory=mem; @@ -247,6 +244,10 @@ static void Initialise(void) //add_esc(0xe459, ESC_SIOV); } +#define R32(rgb) ((rgb>>16)&0xff) +#define G32(rgb) ((rgb>>8)&0xff) +#define B32(rgb) (rgb & 0xff) + void at8_Init(void) { int i; diff --git a/MCUME_pico/pico800/emuapi.h b/MCUME_pico/pico800/emuapi.h deleted file mode 100644 index 4080ace..0000000 --- a/MCUME_pico/pico800/emuapi.h +++ /dev/null @@ -1,207 +0,0 @@ -#ifndef EMUAPI_H -#define EMUAPI_H - -#include "platform_config.h" - -#define CUSTOM_SND 1 -//#define TIMER_REND 1 -#define EXTRA_HEAP 0x10 - -// Title: < > -#define TITLE " Atari 800 Emulator" -#define ROMSDIR "800" - -#define emu_Init(ROM) {at8_Init(); at8_Start(ROM);} -#define emu_Step(x) {at8_Step();} -#define emu_Input(x) {} - -#define PALETTE_SIZE 256 -#define VID_FRAME_SKIP 0x0 -#define TFT_VBUFFER_YCROP 0 -#define SINGLELINE_RENDERING 1 - -#define R32(rgb) ((rgb>>16)&0xff) -#define G32(rgb) ((rgb>>8)&0xff) -#define B32(rgb) (rgb & 0xff) - -#define ACTION_NONE 0 -#define ACTION_MAXKBDVAL 0X40 -#define ACTION_EXITKBD 127 -#define ACTION_RUNTFT 126 -#define ACTION_RUNVGA 125 - - -#ifdef KEYMAP_PRESENT - -#define keylables_map1_0 (char *)"qwertyuiop\x1a" -#define keylables_map1_1 (char *)" asdfghjkl\x19" -#define keylables_map1_2 (char *)" zxcvbnm.\x10 " -const unsigned short key_map1[] = { - 0x2F+1,0x2F,0x2A+1,0x28+1,0x2D+1,0x2B+1,0x0B+1,0x0D+1,0x08+1,0x0A+1,0x34+1, - 0,0x3F+1,0x3F,0x3A+1,0x38+1,0x3D+1,0x39+1,0x01+1,0x05+1,0x00+1,0x0C+1, - 0,0x17+1,0x16+1,0x12+1,0x10+1,0x15+1,0x23+1,0x25+1,0x22+1, 0x21+1, - 0,0,0,0 - }; - -#define keylables_map2_0 (char *)"1234567890=" -#define keylables_map2_1 (char *)"T!@#$%+&*- " -#define keylables_map2_2 (char *)" ()?/\"<>,: " -const unsigned short key_map2[] = { - 0x1F+1,0x1F,0x1A+1,0x18+1,0x1D+1,0x1B+1,0x33+1,0x35+1,0x30+1,0x32+1,0x0F+1, // Digits - 0x2C+1,95+1,117+1,90+1,88+1,93+1,0x06+1,91+1,0x07+1,0x0E + 1,0, // various - 0, 112+1,114+1,102+1,0x26+1,94+1,0x36+1,0x37+1,0x20+1,66+1, - 0,0,0,0 - }; - //0x07+1=*, 0x22+1=.,0x26+1=/, 0x02+1=;, 0x06+1=+, 0x36+1=<, 0x37+1=>, 0x0F+1==, 0x0E+1=-, 0x06+1=+ - -#define keylables_map3_0 (char *)"\x11\x12\x13\x14H " -#define keylables_map3_1 (char *)" " -#define keylables_map3_2 (char *)" ' ; " -const unsigned short key_map3[] = { - 3+1,4+1,19+1,20+1,17+1,0,0,0,0,0,0, // function keys - 0, 0,0,0,0,0,0,0,0,0,0, - 0, 0,0,0,0,115+1,0,0,0x02+1,0, - 0,0,0,0 - }; - - -const unsigned short matkeys[] = { - 0x020,0x120,0x220,0x320,0x420,0x408,0x308,0x208,0x108,0x008,0x002, // row 1 - 0x510,0x010,0x110,0x210,0x310,0x410,0x401,0x301,0x201,0x101,0x001, // row 2 - 0x520,0x102,0x202,0x302,0x402,0x404,0x304,0x204,0x104,0x004, // row 3 - 0x508,0x501,0x502,0x504 }; // cursor keys - -#endif - -/* Pokey code -KEY_A = 63 -KEY_S = 62 -KEY_G = 61 -KEY_Cap = 60 -KEY_D = 58 -KEY_H = 57 -KEY_F = 56 -KEY_Great = 55 -KEY_Less = 54 -KEY_8 = 53 -KEY_BSp = 52 -KEY_7 = 51 -KEY_0 = 50 -KEY_9 = 48 -KEY_Q = 47 -KEY_W = 46 -KEY_T = 45 -KEY_Tab = 44 -KEY_Y = 43 -KEY_E = 42 -KEY_R = 40 -KEY_Inv = 39 -KEY_Slash = 38 -KEY_M = 37 -KEY_N = 35 -KEY_Dot = 34 -KEY_Spa = 33 -KEY_Comma = 32 -KEY_1 = 31 -KEY_2 = 30 -KEY_5 = 29 -KEY_Esc = 28 -KEY_6 = 27 -KEY_3 = 26 -KEY_4 = 24 -KEY_Z = 23 -KEY_X = 22 -KEY_B = 21 -KEY_F4 = 20 -KEY_F3 = 19 -KEY_C = 18 -KEY_Hlp = 17 -KEY_V = 16 -KEY_Equal = 15 -KEY_Minus = 14 -KEY_I = 13 -KEY_Ret = 12 -KEY_U = 11 -KEY_P = 10 -KEY_O = 8 -KEY_Aster = 7 -KEY_plus = 6 -KEY_K = 5 -KEY_F2 = 4 -KEY_F1 = 3 -KEY_Semi = 2 -KEY_J = 1 -KEY_L = 0 -*/ - -#define MASK_JOY2_RIGHT 0x0001 -#define MASK_JOY2_LEFT 0x0002 -#define MASK_JOY2_UP 0x0004 -#define MASK_JOY2_DOWN 0x0008 -#define MASK_JOY2_BTN 0x0010 -#define MASK_KEY_USER1 0x0020 -#define MASK_KEY_USER2 0x0040 -#define MASK_KEY_USER3 0x0080 -#define MASK_JOY1_RIGHT 0x0100 -#define MASK_JOY1_LEFT 0x0200 -#define MASK_JOY1_UP 0x0400 -#define MASK_JOY1_DOWN 0x0800 -#define MASK_JOY1_BTN 0x1000 -#define MASK_KEY_USER4 0x2000 -#define MASK_OSKB 0x8000 - - -extern void emu_init(void); -extern void emu_start(void); -extern void emu_resetSD(void); - -extern void emu_printf(const char * text); -extern void emu_printi(int val); -extern void * emu_Malloc(int size); -extern void emu_Free(void * pt); - -extern int emu_FileOpen(const char * filepath, const char * mode); -extern int emu_FileRead(void * buf, int size, int handler); -extern int emu_FileGetc(int handler); -extern int emu_FileSeek(int handler, int seek, int origin); -extern int emu_FileTell(int handler); -extern void emu_FileClose(int handler); - -extern unsigned int emu_FileSize(const char * filepath); -extern unsigned int emu_LoadFile(const char * filepath, void * buf, int size); - -extern void emu_SetPaletteEntry(unsigned char r, unsigned char g, unsigned char b, int index); -extern void emu_DrawScreen(unsigned char * VBuf, int width, int height, int stride); -extern void emu_DrawLine(unsigned char * VBuf, int width, int height, int line); -extern void emu_DrawLine8(unsigned char * VBuf, int width, int height, int line); -extern void emu_DrawLine16(unsigned short * VBuf, int width, int height, int line); -extern void emu_DrawVsync(void); -extern int emu_FrameSkip(void); -extern void * emu_LineBuffer(int line); - -extern void emu_InitJoysticks(void); -extern int emu_SwapJoysticks(int statusOnly); -extern unsigned short emu_DebounceLocalKeys(void); -extern int emu_ReadKeys(void); -extern int emu_GetPad(void); -extern int emu_ReadAnalogJoyX(int min, int max); -extern int emu_ReadAnalogJoyY(int min, int max); -extern int emu_ReadI2CKeyboard(void); -extern void emu_KeyboardOnUp(int keymodifer, int key); -extern void emu_KeyboardOnDown(int keymodifer, int key); - -extern void emu_sndPlaySound(int chan, int volume, int freq); -extern void emu_sndPlayBuzz(int size, int val); -extern void emu_sndInit(); -extern void emu_resetus(void); -extern int emu_us(void); - -extern int emu_setKeymap(int index); - -extern void emu_FileTempInit(void); -extern void emu_FileTempRead(int addr, unsigned char * val, int n); -extern void emu_FileTempWrite(int addr, unsigned char val); -extern void emu_printh(int val); - - -#endif diff --git a/MCUME_pico/pico800/emucfg.h b/MCUME_pico/pico800/emucfg.h new file mode 100644 index 0000000..b372d8c --- /dev/null +++ b/MCUME_pico/pico800/emucfg.h @@ -0,0 +1,98 @@ +#ifndef EMUCFG_H +#define EMUCFG_H + +#define PALETTE_SIZE 256 +#define VID_FRAME_SKIP 0x0 +#define TFT_VBUFFER_YCROP 0 +#define SINGLELINE_RENDERING 1 +#define CUSTOM_SND 1 +#define CUSTOM_SND_C 1 +//#define TIMER_REND 1 +#define EXTRA_HEAP 0x10 +#define FILEBROWSER + +// Title: < > +#define TITLE " Atari 800 Emulator" +#define ROMSDIR "800" + +#define emu_Init(ROM) {at8_Init(); at8_Start(ROM);} +#define emu_Step(x) {at8_Step();} +#define emu_Input(x) {} + +#ifdef KEYMAP_PRESENT + +#ifdef PICOZX +const unsigned short key_map1[] = { + 0x1F+1,0x1F,0x1A+1,0x18+1,0x1D+1,0x1B+1,0x33+1,0x35+1,0x30+1,0x32+1, + 0x2F+1,0x2F,0x2A+1,0x28+1,0x2D+1,0x2B+1,0x0B+1,0x0D+1,0x08+1,0x0A+1, + 0x3F+1,0x3F,0x3A+1,0x38+1,0x3D+1,0x39+1,0x01+1,0x05+1,0x00+1,0x0D, + 0,0x17+1,0x16+1,0x12+1,0x10+1,0x15+1,0x23+1,0x25+1,0,0x21+1, + 0,0,0,0,0,0 //U L R D L R + }; + +const unsigned short key_map2[] = { + 95+1,117+1,90+1,88+1,93+1,91+1,115+1,112+1,114+1,0, + 0,0,0,0x36+1,0x37+1,0,0,0,0x02+1,94+1, + 0,0,0,0,0,0,0x0E + 1,0x06+1,0x0F+1,0x0D, + 0,66+1,0,102+1,0x26+1,0x07+1,0x20+1,0x22+1,0,' ', + 0,0,0,0,0,0 + }; + +const unsigned short key_map3[] = { + 3+1,4+1,19+1,20+1,17+1,0,0,0,0,0, // function keys + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0 + }; + +const unsigned short matkeys[] = { + 0x104,0x101,0x108,0x102,0x110,0x120,0x140,0x204,0x201,0x208, // row 1 + 0x202,0x210,0x220,0x240,0x304,0x301,0x308,0x302,0x310,0x320, // row 2 + 0x340,0x404,0x401,0x408,0x402,0x410,0x420,0x440,0x504,0x501, // row 3 + 0x020,0x508,0x502,0x510,0x520,0x540,0x604,0x601,0x040,0x608, // row 4 + 0x008,0x001,0x002,0x010,0x620,0x640 }; // cursor keys up, left, right, down, <<<, >>> + +#else + +#define keylables_map1_0 (char *)"qwertyuiop\x1a" +#define keylables_map1_1 (char *)" asdfghjkl\x19" +#define keylables_map1_2 (char *)" zxcvbnm.\x10 " +const unsigned short key_map1[] = { + 0x2F+1,0x2F,0x2A+1,0x28+1,0x2D+1,0x2B+1,0x0B+1,0x0D+1,0x08+1,0x0A+1,0x34+1, + 0,0x3F+1,0x3F,0x3A+1,0x38+1,0x3D+1,0x39+1,0x01+1,0x05+1,0x00+1,0x0C+1, + 0,0x17+1,0x16+1,0x12+1,0x10+1,0x15+1,0x23+1,0x25+1,0x22+1, 0x21+1, + 0,0,0,0 + }; + +#define keylables_map2_0 (char *)"1234567890=" +#define keylables_map2_1 (char *)"T!@#$%+&*- " +#define keylables_map2_2 (char *)" ()?/\"<>,: " +const unsigned short key_map2[] = { + 0x1F+1,0x1F,0x1A+1,0x18+1,0x1D+1,0x1B+1,0x33+1,0x35+1,0x30+1,0x32+1,0x0F+1, // Digits + 0x2C+1,95+1,117+1,90+1,88+1,93+1,0x06+1,91+1,0x07+1,0x0E + 1,0, // various + 0, 112+1,114+1,102+1,0x26+1,94+1,0x36+1,0x37+1,0x20+1,66+1, + 0,0,0,0 + }; + //0x07+1=*, 0x22+1=.,0x26+1=/, 0x02+1=;, 0x06+1=+, 0x36+1=<, 0x37+1=>, 0x0F+1==, 0x0E+1=-, 0x06+1=+ + +#define keylables_map3_0 (char *)"\x11\x12\x13\x14H " +#define keylables_map3_1 (char *)" " +#define keylables_map3_2 (char *)" ' ; " +const unsigned short key_map3[] = { + 3+1,4+1,19+1,20+1,17+1,0,0,0,0,0,0, // function keys + 0, 0,0,0,0,0,0,0,0,0,0, + 0, 0,0,0,0,115+1,0,0,0x02+1,0, + 0,0,0,0 + }; + + +const unsigned short matkeys[] = { + 0x020,0x120,0x220,0x320,0x420,0x408,0x308,0x208,0x108,0x008,0x002, // row 1 + 0x510,0x010,0x110,0x210,0x310,0x410,0x401,0x301,0x201,0x101,0x001, // row 2 + 0x520,0x102,0x202,0x302,0x402,0x404,0x304,0x204,0x104,0x004, // row 3 + 0x508,0x501,0x502,0x504 }; // cursor keys +#endif +#endif + +#endif diff --git a/MCUME_pico/pico800/font8x8.h b/MCUME_pico/pico800/font8x8.h deleted file mode 100644 index 03edc95..0000000 --- a/MCUME_pico/pico800/font8x8.h +++ /dev/null @@ -1,135 +0,0 @@ - -// Font: c64_lower.64c - -const unsigned char PROGMEM font8x8[128][8] = -{ - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0000 (nul) - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0001 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0002 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0003 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0004 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0005 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0006 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0007 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0008 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0009 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000A - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000B - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000C - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000D - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000E - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000F - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0010 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0011 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0012 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0013 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0014 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0015 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0016 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0017 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0018 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0019 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001A - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001B - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001C - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001D - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001E - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001F - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0020 (space) - { 0x18, 0x3C, 0x3C, 0x18, 0x18, 0x00, 0x18, 0x00}, // U+0021 (!) - { 0x36, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0022 (") - { 0x36, 0x36, 0x7F, 0x36, 0x7F, 0x36, 0x36, 0x00}, // U+0023 (#) - { 0x0C, 0x3E, 0x03, 0x1E, 0x30, 0x1F, 0x0C, 0x00}, // U+0024 ($) - { 0x00, 0x63, 0x33, 0x18, 0x0C, 0x66, 0x63, 0x00}, // U+0025 (%) - { 0x1C, 0x36, 0x1C, 0x6E, 0x3B, 0x33, 0x6E, 0x00}, // U+0026 (&) - { 0x06, 0x06, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0027 (') - { 0x18, 0x0C, 0x06, 0x06, 0x06, 0x0C, 0x18, 0x00}, // U+0028 (() - { 0x06, 0x0C, 0x18, 0x18, 0x18, 0x0C, 0x06, 0x00}, // U+0029 ()) - { 0x00, 0x66, 0x3C, 0xFF, 0x3C, 0x66, 0x00, 0x00}, // U+002A (*) - { 0x00, 0x0C, 0x0C, 0x3F, 0x0C, 0x0C, 0x00, 0x00}, // U+002B (+) - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x0C, 0x06}, // U+002C (,) - { 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x00}, // U+002D (-) - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x0C, 0x00}, // U+002E (.) - { 0x60, 0x30, 0x18, 0x0C, 0x06, 0x03, 0x01, 0x00}, // U+002F (/) - { 0x3E, 0x63, 0x73, 0x7B, 0x6F, 0x67, 0x3E, 0x00}, // U+0030 (0) - { 0x0C, 0x0E, 0x0C, 0x0C, 0x0C, 0x0C, 0x3F, 0x00}, // U+0031 (1) - { 0x1E, 0x33, 0x30, 0x1C, 0x06, 0x33, 0x3F, 0x00}, // U+0032 (2) - { 0x1E, 0x33, 0x30, 0x1C, 0x30, 0x33, 0x1E, 0x00}, // U+0033 (3) - { 0x38, 0x3C, 0x36, 0x33, 0x7F, 0x30, 0x78, 0x00}, // U+0034 (4) - { 0x3F, 0x03, 0x1F, 0x30, 0x30, 0x33, 0x1E, 0x00}, // U+0035 (5) - { 0x1C, 0x06, 0x03, 0x1F, 0x33, 0x33, 0x1E, 0x00}, // U+0036 (6) - { 0x3F, 0x33, 0x30, 0x18, 0x0C, 0x0C, 0x0C, 0x00}, // U+0037 (7) - { 0x1E, 0x33, 0x33, 0x1E, 0x33, 0x33, 0x1E, 0x00}, // U+0038 (8) - { 0x1E, 0x33, 0x33, 0x3E, 0x30, 0x18, 0x0E, 0x00}, // U+0039 (9) - { 0x00, 0x0C, 0x0C, 0x00, 0x00, 0x0C, 0x0C, 0x00}, // U+003A (:) - { 0x00, 0x0C, 0x0C, 0x00, 0x00, 0x0C, 0x0C, 0x06}, // U+003B (//) - { 0x18, 0x0C, 0x06, 0x03, 0x06, 0x0C, 0x18, 0x00}, // U+003C (<) - { 0x00, 0x00, 0x3F, 0x00, 0x00, 0x3F, 0x00, 0x00}, // U+003D (=) - { 0x06, 0x0C, 0x18, 0x30, 0x18, 0x0C, 0x06, 0x00}, // U+003E (>) - { 0x1E, 0x33, 0x30, 0x18, 0x0C, 0x00, 0x0C, 0x00}, // U+003F (?) - { 0x3E, 0x63, 0x7B, 0x7B, 0x7B, 0x03, 0x1E, 0x00}, // U+0040 (@) - { 0x0C, 0x1E, 0x33, 0x33, 0x3F, 0x33, 0x33, 0x00}, // U+0041 (A) - { 0x3F, 0x66, 0x66, 0x3E, 0x66, 0x66, 0x3F, 0x00}, // U+0042 (B) - { 0x3C, 0x66, 0x03, 0x03, 0x03, 0x66, 0x3C, 0x00}, // U+0043 (C) - { 0x1F, 0x36, 0x66, 0x66, 0x66, 0x36, 0x1F, 0x00}, // U+0044 (D) - { 0x7F, 0x46, 0x16, 0x1E, 0x16, 0x46, 0x7F, 0x00}, // U+0045 (E) - { 0x7F, 0x46, 0x16, 0x1E, 0x16, 0x06, 0x0F, 0x00}, // U+0046 (F) - { 0x3C, 0x66, 0x03, 0x03, 0x73, 0x66, 0x7C, 0x00}, // U+0047 (G) - { 0x33, 0x33, 0x33, 0x3F, 0x33, 0x33, 0x33, 0x00}, // U+0048 (H) - { 0x1E, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+0049 (I) - { 0x78, 0x30, 0x30, 0x30, 0x33, 0x33, 0x1E, 0x00}, // U+004A (J) - { 0x67, 0x66, 0x36, 0x1E, 0x36, 0x66, 0x67, 0x00}, // U+004B (K) - { 0x0F, 0x06, 0x06, 0x06, 0x46, 0x66, 0x7F, 0x00}, // U+004C (L) - { 0x63, 0x77, 0x7F, 0x7F, 0x6B, 0x63, 0x63, 0x00}, // U+004D (M) - { 0x63, 0x67, 0x6F, 0x7B, 0x73, 0x63, 0x63, 0x00}, // U+004E (N) - { 0x1C, 0x36, 0x63, 0x63, 0x63, 0x36, 0x1C, 0x00}, // U+004F (O) - { 0x3F, 0x66, 0x66, 0x3E, 0x06, 0x06, 0x0F, 0x00}, // U+0050 (P) - { 0x1E, 0x33, 0x33, 0x33, 0x3B, 0x1E, 0x38, 0x00}, // U+0051 (Q) - { 0x3F, 0x66, 0x66, 0x3E, 0x36, 0x66, 0x67, 0x00}, // U+0052 (R) - { 0x1E, 0x33, 0x07, 0x0E, 0x38, 0x33, 0x1E, 0x00}, // U+0053 (S) - { 0x3F, 0x2D, 0x0C, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+0054 (T) - { 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x3F, 0x00}, // U+0055 (U) - { 0x33, 0x33, 0x33, 0x33, 0x33, 0x1E, 0x0C, 0x00}, // U+0056 (V) - { 0x63, 0x63, 0x63, 0x6B, 0x7F, 0x77, 0x63, 0x00}, // U+0057 (W) - { 0x63, 0x63, 0x36, 0x1C, 0x1C, 0x36, 0x63, 0x00}, // U+0058 (X) - { 0x33, 0x33, 0x33, 0x1E, 0x0C, 0x0C, 0x1E, 0x00}, // U+0059 (Y) - { 0x7F, 0x63, 0x31, 0x18, 0x4C, 0x66, 0x7F, 0x00}, // U+005A (Z) - { 0x1E, 0x06, 0x06, 0x06, 0x06, 0x06, 0x1E, 0x00}, // U+005B ([) - { 0x03, 0x06, 0x0C, 0x18, 0x30, 0x60, 0x40, 0x00}, // U+005C (\) - { 0x1E, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1E, 0x00}, // U+005D (]) - { 0x08, 0x1C, 0x36, 0x63, 0x00, 0x00, 0x00, 0x00}, // U+005E (^) - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF}, // U+005F (_) - { 0x0C, 0x0C, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0060 (`) - { 0x00, 0x00, 0x1E, 0x30, 0x3E, 0x33, 0x6E, 0x00}, // U+0061 (a) - { 0x07, 0x06, 0x06, 0x3E, 0x66, 0x66, 0x3B, 0x00}, // U+0062 (b) - { 0x00, 0x00, 0x1E, 0x33, 0x03, 0x33, 0x1E, 0x00}, // U+0063 (c) - { 0x38, 0x30, 0x30, 0x3e, 0x33, 0x33, 0x6E, 0x00}, // U+0064 (d) - { 0x00, 0x00, 0x1E, 0x33, 0x3f, 0x03, 0x1E, 0x00}, // U+0065 (e) - { 0x1C, 0x36, 0x06, 0x0f, 0x06, 0x06, 0x0F, 0x00}, // U+0066 (f) - { 0x00, 0x00, 0x6E, 0x33, 0x33, 0x3E, 0x30, 0x1F}, // U+0067 (g) - { 0x07, 0x06, 0x36, 0x6E, 0x66, 0x66, 0x67, 0x00}, // U+0068 (h) - { 0x0C, 0x00, 0x0E, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+0069 (i) - { 0x30, 0x00, 0x30, 0x30, 0x30, 0x33, 0x33, 0x1E}, // U+006A (j) - { 0x07, 0x06, 0x66, 0x36, 0x1E, 0x36, 0x67, 0x00}, // U+006B (k) - { 0x0E, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+006C (l) - { 0x00, 0x00, 0x33, 0x7F, 0x7F, 0x6B, 0x63, 0x00}, // U+006D (m) - { 0x00, 0x00, 0x1F, 0x33, 0x33, 0x33, 0x33, 0x00}, // U+006E (n) - { 0x00, 0x00, 0x1E, 0x33, 0x33, 0x33, 0x1E, 0x00}, // U+006F (o) - { 0x00, 0x00, 0x3B, 0x66, 0x66, 0x3E, 0x06, 0x0F}, // U+0070 (p) - { 0x00, 0x00, 0x6E, 0x33, 0x33, 0x3E, 0x30, 0x78}, // U+0071 (q) - { 0x00, 0x00, 0x3B, 0x6E, 0x66, 0x06, 0x0F, 0x00}, // U+0072 (r) - { 0x00, 0x00, 0x3E, 0x03, 0x1E, 0x30, 0x1F, 0x00}, // U+0073 (s) - { 0x08, 0x0C, 0x3E, 0x0C, 0x0C, 0x2C, 0x18, 0x00}, // U+0074 (t) - { 0x00, 0x00, 0x33, 0x33, 0x33, 0x33, 0x6E, 0x00}, // U+0075 (u) - { 0x00, 0x00, 0x33, 0x33, 0x33, 0x1E, 0x0C, 0x00}, // U+0076 (v) - { 0x00, 0x00, 0x63, 0x6B, 0x7F, 0x7F, 0x36, 0x00}, // U+0077 (w) - { 0x00, 0x00, 0x63, 0x36, 0x1C, 0x36, 0x63, 0x00}, // U+0078 (x) - { 0x00, 0x00, 0x33, 0x33, 0x33, 0x3E, 0x30, 0x1F}, // U+0079 (y) - { 0x00, 0x00, 0x3F, 0x19, 0x0C, 0x26, 0x3F, 0x00}, // U+007A (z) - { 0x38, 0x0C, 0x0C, 0x07, 0x0C, 0x0C, 0x38, 0x00}, // U+007B ({) - { 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x00}, // U+007C (|) - { 0x07, 0x0C, 0x0C, 0x38, 0x0C, 0x0C, 0x07, 0x00}, // U+007D (}) - { 0x6E, 0x3B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+007E (~) - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} // U+007F -}; - diff --git a/MCUME_pico/pico800/pico800.cpp b/MCUME_pico/pico800/pico800.cpp index c1641b7..95960aa 100644 --- a/MCUME_pico/pico800/pico800.cpp +++ b/MCUME_pico/pico800/pico800.cpp @@ -6,23 +6,17 @@ extern "C" { #include "emuapi.h" } #include "keyboard_osd.h" - extern "C" { #include "atari800.h" } #include +#include "pico_dsp.h" -#include "hardware/clocks.h" -#include "hardware/vreg.h" - -#ifdef USE_VGA -#include "vga_t_dma.h" -#else -#include "tft_t_dma.h" -#endif volatile bool vbl=true; bool repeating_timer_callback(struct repeating_timer *t) { + //uint16_t bClick = emu_DebounceLocalKeys(); + //emu_Input(bClick); if (vbl) { vbl = false; } else { @@ -30,8 +24,8 @@ bool repeating_timer_callback(struct repeating_timer *t) { } return true; } -TFT_T_DMA tft; +PICO_DSP tft; static int skip=0; @@ -47,102 +41,87 @@ int main(void) { // set_sys_clock_khz(250000, true); stdio_init_all(); -#ifdef USE_VGA -// tft.begin(VGA_MODE_400x240); - tft.begin(VGA_MODE_320x240); -#else - tft.begin(); -#endif emu_init(); - while (true) { + char * filename; +#ifdef FILEBROWSER + while (true) { if (menuActive()) { uint16_t bClick = emu_DebounceLocalKeys(); int action = handleMenu(bClick); - char * filename = menuSelection(); - if (action == ACTION_RUNTFT) { - toggleMenu(false); - emu_start(); - emu_Init(filename); - tft.fillScreenNoDma( RGBVAL16(0x00,0x00,0x00) ); - tft.startDMA(); - struct repeating_timer timer; - add_repeating_timer_ms(5, repeating_timer_callback, NULL, &timer); - } + filename = menuSelection(); + if (action == ACTION_RUN) { + break; + } tft.waitSync(); } - else { - emu_Step(); - uint16_t bClick = emu_DebounceLocalKeys(); - emu_Input(bClick); - } - //int c = getchar_timeout_us(0); - //switch (c) { - // case ' ': - // printf("test: %d\n", 1); - // break; - //} + } +#endif + emu_start(); + emu_Init(filename); + tft.startRefresh(); + struct repeating_timer timer; + add_repeating_timer_ms(5, repeating_timer_callback, NULL, &timer); + while (true) { + uint16_t bClick = emu_DebounceLocalKeys(); + emu_Input(bClick); + emu_Step(); } } -static unsigned char palette8[PALETTE_SIZE]; static unsigned short palette16[PALETTE_SIZE]; - void emu_SetPaletteEntry(unsigned char r, unsigned char g, unsigned char b, int index) { if (index -void AudioPlaySystem::snd_Mixer(short * stream, int len ) -{ - if (playing) - { -#ifdef CUSTOM_SND - //printf("s\n"); - SND_Process((void*)stream, len); -#else - int i; - long s; - len = len >> 1; - short v0=chan[0].vol; - short v1=chan[1].vol; - short v2=chan[2].vol; - short v3=chan[3].vol; - short v4=chan[4].vol; - short v5=chan[5].vol; - for (i=0;i>8)&0x3f])>>11); - s+=((v1*square[(chan[1].spos>>8)&0x3f])>>11); - s+=((v2*square[(chan[2].spos>>8)&0x3f])>>11); - s+=((v3*noise[(chan[3].spos>>8)&(NOISEBSIZE-1)])>>11); - s+=((v4*noise[(chan[4].spos>>8)&(NOISEBSIZE-1)])>>11); - s+=((v5*noise[(chan[5].spos>>8)&(NOISEBSIZE-1)])>>11); - *stream++ = (short)(s); - *stream++ = (short)(s); - chan[0].spos += chan[0].sinc; - chan[1].spos += chan[1].sinc; - chan[2].spos += chan[2].sinc; - chan[3].spos += chan[3].sinc; - chan[4].spos += chan[4].sinc; - chan[5].spos += chan[5].sinc; - } -#endif - } -} - -void AudioPlaySystem::begin(void) -{ - this->reset(); -} - -void AudioPlaySystem::start(void) -{ - playing = true; -} - -void AudioPlaySystem::setSampleParameters(float clockfreq, float samplerate) { -} - -void AudioPlaySystem::reset(void) -{ - snd_Reset(); -} - -void AudioPlaySystem::stop(void) -{ - playing = false; -} - -bool AudioPlaySystem::isPlaying(void) -{ - return playing; -} - - - -void AudioPlaySystem::sound(int C, int F, int V) { -#ifndef CUSTOM_SND - if (C < 6) { - chan[C].vol = V; - chan[C].sinc = F>>1; - } -#endif -} - -void AudioPlaySystem::step(void) { -} -#endif diff --git a/MCUME_pico/pico8086/AudioPlaySystem.h b/MCUME_pico/pico8086/AudioPlaySystem.h deleted file mode 100644 index 5d2efc0..0000000 --- a/MCUME_pico/pico8086/AudioPlaySystem.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef audioplaysystem_h_ -#define audioplaysystem_h_ - -#ifdef HAS_SND - -#include "platform_config.h" - -class AudioPlaySystem -{ -public: - AudioPlaySystem(void) { }; - void begin(void); - void setSampleParameters(float clockfreq, float samplerate); - void reset(void); - void start(void); - void stop(void); - bool isPlaying(void); - void sound(int C, int F, int V); - void buzz(int size, int val); - void step(void); - static void snd_Mixer(short * stream, int len ); -}; - -#endif - -#endif diff --git a/MCUME_pico/pico8086/cpu.cpp b/MCUME_pico/pico8086/cpu.cpp deleted file mode 100755 index 477478b..0000000 --- a/MCUME_pico/pico8086/cpu.cpp +++ /dev/null @@ -1,2267 +0,0 @@ -#include -#include -#include "emu.h" -#include "rom.h" - - - -extern void portout(uint16_t portnum, uint16_t value); -extern uint16_t portin(uint16_t portnum); - -extern void readdisk(uint8_t drivenum, uint16_t dstseg, uint16_t dstoff, uint16_t cyl, uint16_t sect, uint16_t head, uint16_t sectcount); -extern void insertdisk(); - -extern void doirq(uint8_t irqnum); -extern uint8_t nextintr(); -extern struct structpic { - uint8_t imr; //mask register - uint8_t irr; //request register - uint8_t isr; //service register - uint8_t icwstep; //used during initialization to keep track of which ICW we're at - uint8_t icw[5]; - uint8_t intoffset; //interrupt vector offset - uint8_t priority; //which IRQ has highest priority - uint8_t autoeoi; //automatic EOI mode - uint8_t readmode; //remember what to return on read register from OCW3 - uint8_t enabled; -} i8259; - -extern uint8_t curkey; -void intcall86(uint8_t intnum); - -uint64_t curtimer, lasttimer, timerfreq; - -char *biosfile = NULL; -uint8_t byteregtable[8] = { regal, regcl, regdl, regbl, regah, regch, regdh, regbh }; - -uint8_t parity[0x100]; - -_bytewordregs_ regs; - -uint16_t segregs[6]; -uint8_t opcode, segoverride, reptype, bootdrive, hdcount = 0; -uint16_t savecs, saveip, ip, useseg, oldsp; -uint8_t tempcf, oldcf, cf, pf, af, zf, sf, tf, ifl, df, of, nt, iopriv, mode, reg, rm, msw = 0; -uint16_t oper1, oper2, res16, disp16, temp16, dummy, stacksize, frametemp; -uint8_t oper1b, oper2b, res8, disp8, temp8, nestlev, addrbyte; -uint16_t cr0 = 0, cr1 = 0, cr2 = 0, cr3 = 0; -uint32_t ldtr = 0, gdtr = 0, gdtlimit = 0, idtr = 0, idtlimit = 0; -uint32_t temp1, temp2, temp3, temp4, temp5, temp32, tempaddr32, ea; -int32_t result, speed = 0; -uint32_t totalexec; -uint32_t ips[10] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -uint16_t *tempwordptr; - -uint8_t vidmode, cgabg, blankattr, vidgfxmode, vidcolor; -uint16_t cursx, cursy, cols, rows, vgapage, cursorposition, cursorvisible; -uint8_t updatedscreen, port3da, port6, portout16; -//uint16_t VGA_SC[0xFF], VGA_CRTC[0xFF], VGA_ATTR[0xFF], VGA_GC[0xFF]; -uint32_t videobase, textbase, x, y; - -uint8_t debugmode, showcsip, verbose, mouseemu; - - - -extern void write_loram(int address, uint8_t val); -extern uint8_t read_loram(int address); -extern void write_hiram(int address, uint8_t val); -extern uint8_t read_hiram(int address); - -void write86(uint32_t addr32, uint8_t value) { - if (addr32 < NATIVE_RAM) { - write_loram(addr32, value); - return; - } - else if (addr32 < RAM_SIZE) { - write_hiram(addr32, value); - return; - } - else if ((addr32 >= 0xB8000) && (addr32 < 0xC0000)) { - VRAM_write(addr32 - 0xB8000UL, value); - } -} - -#define writew86(addr32,value) {write86((addr32),(uint8_t)(value));write86((addr32)+1,(uint8_t)((uint16_t)(value)>>8));} - -uint8_t read86(uint32_t addr32) { - if (addr32 < NATIVE_RAM) { - switch (addr32) { //some hardcoded values for the BIOS data area - case 0x410: //0040:0010 is the equipment word -#ifdef VGA - return (0x41); //video type (0x41 is VGA/EGA, 0x61 is CGA, 0x31 = MDA) -#else - return (0x61); //video type (0x41 is VGA/EGA, 0x61 is CGA, 0x31 = MDA) -#endif - case 0x475: //hard drive count - return (hdcount); - default: - return read_loram(addr32); - } - } - else if (addr32 < RAM_SIZE) { - return read_hiram(addr32); - } - else if ((addr32 >= 0xB8000) && (addr32 < 0xC0000)) { - addr32 -= 0xB8000UL; - return VRAM_read(addr32); - } - else if (addr32 >= 0xFE000UL) { - addr32 -= 0xFE000UL; - return ROM_READ(BIOS, addr32); //BIOS[addr32]; - } - else if ((addr32 >= 0xD0000) && (addr32 < 0xD0640)) { - return net_read_ram(addr32 - 0xD0000); - } - else if ((addr32 >= 0xE0000) && (addr32 < 0xE0006)) { - return net_mac[addr32 - 0xE0000]; - } -#ifdef INCLUDE_ROM_BASIC - else if ((addr32 >= 0xF6000UL) && (addr32 < 0xFA000UL)) { - addr32 -= 0xF6000UL; - return ROM_READ(BASICL, addr32); //BASICL[addr32]; - } else if ((addr32 >= 0xFA000UL) && (addr32 < 0xFE000UL)) { - addr32 -= 0xFA000UL; - return ROM_READ(BASICH, addr32); //BASICH[addr32]; - } -#endif - else return 0; -} - - - -#define readw86(addr32) ((uint16_t)read86((addr32))|((uint16_t)read86((addr32)+1)<<8)) - -//inline void flag_szp8(uint8_t value) { -#define flag_szp8(value) {\ - if (!(value)) zf = 1; else zf = 0;\ - if ((value) & 0x80) sf = 1; else sf = 0;\ - pf = parity[value];\ -} - -//inline void flag_szp16(uint16_t value) { -#define flag_szp16(value) {\ - if (!(value)) zf = 1; else zf = 0;\ - if (value & 0x8000) sf = 1; else sf = 0;\ - pf = parity[(uint8_t)value];\ -} - -//inline void flag_log8(uint8_t value) { -#define flag_log8(value) {\ - flag_szp8(value);\ - cf = 0; of = 0;\ -} - -//inline void flag_log16(uint16_t value) { -#define flag_log16(value) {\ - flag_szp16(value);\ - cf = 0; of = 0;\ -} - -//inline void flag_adc8(uint8_t v1, uint8_t v2, uint8_t v3) { //v1 = destination operand, v2 = source operand, v3 = carry flag -#define flag_adc8(v1, v2, v3) {\ - uint16_t dst;\ - dst = (uint16_t)(v1) + (uint16_t)(v2) + (uint16_t)(v3);\ - flag_szp8((uint8_t)dst);\ - if (((dst ^ (v1)) & (dst ^ (v2)) & 0x80) == 0x80) of = 1; else of = 0;\ - if (dst & 0xFF00) cf = 1; else cf = 0;\ - if ((((v1) ^ (v2) ^ dst) & 0x10) == 0x10) af = 1; else af = 0;\ -} - -//inline void flag_adc16(uint16_t v1, uint16_t v2, uint16_t v3) { //v1 = destination operand, v2 = source operand, v3 = carry flag -#define flag_adc16(v1, v2, v3) {\ - uint32_t dst;\ - dst = (uint32_t)(v1) + (uint32_t)(v2) + (uint32_t)(v3);\ - flag_szp16((uint16_t)dst);\ - if ((((dst ^ (v1)) & (dst ^ (v2))) & 0x8000) == 0x8000) of = 1; else of = 0;\ - if (dst & 0xFFFF0000UL) cf = 1; else cf = 0;\ - if ((((v1) ^ (v2) ^ dst) & 0x10) == 0x10) af = 1; else af = 0;\ -} - -//inline void flag_add8(uint8_t v1, uint8_t v2) { //v1 = destination operand, v2 = source operand -#define flag_add8(v1, v2) {\ - uint16_t dst;\ - dst = (uint16_t)(v1) + (uint16_t)(v2);\ - flag_szp8((uint8_t)dst);\ - if (dst & 0xFF00) cf = 1; else cf = 0;\ - if (((dst ^ (v1)) & (dst ^ (v2)) & 0x80) == 0x80) of = 1; else of = 0;\ - if ((((v1) ^ (v2) ^ dst) & 0x10) == 0x10) af = 1; else af = 0;\ -} - -//inline void flag_add16(uint16_t v1, uint16_t v2) { //v1 = destination operand, v2 = source operand -#define flag_add16(v1, v2) {\ - uint32_t dst;\ - dst = (uint32_t)(v1) + (uint32_t)(v2);\ - flag_szp16((uint16_t)dst);\ - if (dst & 0xFFFF0000UL) cf = 1; else cf = 0;\ - if (((dst ^ (v1)) & (dst ^ (v2)) & 0x8000) == 0x8000) of = 1; else of = 0;\ - if ((((v1) ^ (v2) ^ dst) & 0x10) == 0x10) af = 1; else af = 0;\ -} - -//inline void flag_sbb8(uint8_t v1, uint8_t v2, uint8_t v3) { //v1 = destination operand, v2 = source operand, v3 = carry flag -#define flag_sbb8(v1, v2, v3) {\ - uint16_t dst;\ - uint16_t newv2;\ - newv2 = (uint16_t)(v2) + (uint16_t)(v3);\ - dst = (uint16_t)(v1) - (uint16_t)newv2;\ - flag_szp8((uint8_t)dst);\ - if (dst & 0xFF00) cf = 1; else cf = 0;\ - if ((dst ^ (v1)) & ((v1) ^ newv2) & 0x80) of = 1; else of = 0;\ - if (((v1) ^ newv2 ^ dst) & 0x10) af = 1; else af = 0;\ -} - -//inline void flag_sbb16(uint16_t v1, uint16_t v2, uint16_t v3) { //v1 = destination operand, v2 = source operand, v3 = carry flag -#define flag_sbb16(v1, v2, v3){\ - uint32_t dst;\ - uint32_t newv2;\ - newv2 = (uint32_t)(v2) + (uint32_t)(v3);\ - dst = (uint32_t)v1 - newv2;\ - flag_szp16((uint16_t)dst);\ - if (dst & 0xFFFF0000UL) cf = 1; else cf = 0;\ - if ((dst ^ (v1)) & (v1 ^ newv2) & 0x8000) of = 1; else of = 0;\ - if (((v1) ^ newv2 ^ dst) & 0x10) af = 1; else af = 0;\ -} - -//inline void flag_sub8(uint8_t v1, uint8_t v2) { //v1 = destination operand, v2 = source operand -#define flag_sub8(v1, v2) {\ - uint16_t dst;\ - dst = (uint16_t)(v1) - (uint16_t)(v2);\ - flag_szp8((uint8_t)dst);\ - if (dst & 0xFF00) cf = 1; else cf = 0;\ - if ((dst ^ (v1)) & ((v1) ^ (v2)) & 0x80) of = 1; else of = 0;\ - if (((v1) ^ (v2) ^ dst) & 0x10) af = 1; else af = 0;\ -} - -//inline void flag_sub16(uint16_t v1, uint16_t v2) { //v1 = destination operand, v2 = source operand -#define flag_sub16(v1, v2) {\ - uint32_t dst;\ - dst = (uint32_t)(v1) - (uint32_t)(v2);\ - flag_szp16((uint16_t)dst);\ - if (dst & 0xFFFF0000UL) cf = 1; else cf = 0;\ - if ((dst ^ (v1)) & ((v1) ^ (v2)) & 0x8000) of = 1; else of = 0;\ - if (((v1) ^ (v2) ^ dst) & 0x10) af = 1; else af = 0;\ -} - -//inline void op_adc8() { -#define op_adc8() {\ - res8 = oper1b + oper2b + cf;\ - flag_adc8(oper1b, oper2b, cf);\ -} - -//inline void op_adc16() { -#define op_adc16() {\ - res16 = oper1 + oper2 + cf;\ - flag_adc16(oper1, oper2, cf);\ -} - -//inline void op_add8() { -#define op_add8() {\ - res8 = oper1b + oper2b;\ - flag_add8(oper1b, oper2b);\ -} - -//inline void op_add16() { -#define op_add16() {\ - res16 = oper1 + oper2;\ - flag_add16(oper1, oper2);\ -} - -//inline void op_and8() { -#define op_and8() {\ - res8 = oper1b & oper2b;\ - flag_log8(res8);\ -} - -//inline void op_and16() { -#define op_and16() {\ - res16 = oper1 & oper2;\ - flag_log16(res16);\ -} - -//inline void op_or8() { -#define op_or8() {\ - res8 = oper1b | oper2b;\ - flag_log8(res8);\ -} - -//inline void op_or16() { -#define op_or16() {\ - res16 = oper1 | oper2;\ - flag_log16(res16);\ -} - -//inline void op_xor8() { -#define op_xor8() {\ - res8 = oper1b ^ oper2b;\ - flag_log8(res8);\ -} - -//inline void op_xor16() { -#define op_xor16() {\ - res16 = oper1 ^ oper2;\ - flag_log16(res16);\ -} - -//inline void op_sub8() { -#define op_sub8() {\ - res8 = oper1b - oper2b;\ - flag_sub8(oper1b, oper2b);\ -} - -//inline void op_sub16() { -#define op_sub16() {\ - res16 = oper1 - oper2;\ - flag_sub16(oper1, oper2);\ -} - -//inline void op_sbb8() { -#define op_sbb8() {\ - res8 = oper1b - (oper2b + cf);\ - flag_sbb8(oper1b, oper2b, cf);\ -} - -//inline void op_sbb16() { -#define op_sbb16() {\ - res16 = oper1 - (oper2 + cf);\ - flag_sbb16(oper1, oper2, cf);\ -} - -//inline void modregrm() { -#define modregrm() {\ - addrbyte = getmem8(segregs[regcs], ip); StepIP(1);\ - mode = addrbyte >> 6;\ - reg = (addrbyte >> 3) & 7;\ - rm = addrbyte & 7;\ - switch (mode) {\ - case 0:\ - if (rm == 6) {\ - disp16 = getmem16(segregs[regcs], ip);\ - StepIP(2);\ - }\ - if (((rm == 2) || (rm == 3)) && !segoverride) useseg = segregs[regss]; break;\ - case 1:\ - disp16 = signext(getmem8(segregs[regcs], ip)); StepIP(1);\ - if (((rm == 2) || (rm == 3) || (rm == 6)) && !segoverride) useseg = segregs[regss]; break;\ - case 2:\ - disp16 = getmem16(segregs[regcs], ip); StepIP(2);\ - if (((rm == 2) || (rm == 3) || (rm == 6)) && !segoverride) useseg = segregs[regss]; break;\ - default:\ - disp8 = 0; disp16 = 0;\ - }\ - if (mode < 3) getea(rm);\ -} - -//inline void getea(uint8_t rmval) { -#define getea(rmval) {\ - uint32_t tempea;\ - tempea = 0;\ - switch (mode) {\ - case 0:\ - switch (rmval) {\ - case 0: tempea = regs.wordregs[regbx] + regs.wordregs[regsi]; break;\ - case 1: tempea = regs.wordregs[regbx] + regs.wordregs[regdi]; break;\ - case 2: tempea = regs.wordregs[regbp] + regs.wordregs[regsi]; break;\ - case 3: tempea = regs.wordregs[regbp] + regs.wordregs[regdi]; break;\ - case 4: tempea = regs.wordregs[regsi]; break;\ - case 5: tempea = regs.wordregs[regdi]; break;\ - case 6: tempea = disp16; break;\ - case 7: tempea = regs.wordregs[regbx]; break;\ - } break;\ - case 1: case 2:\ - switch (rmval) {\ - case 0: tempea = regs.wordregs[regbx] + regs.wordregs[regsi] + disp16; break;\ - case 1: tempea = regs.wordregs[regbx] + regs.wordregs[regdi] + disp16; break;\ - case 2: tempea = regs.wordregs[regbp] + regs.wordregs[regsi] + disp16; break;\ - case 3: tempea = regs.wordregs[regbp] + regs.wordregs[regdi] + disp16; break;\ - case 4: tempea = regs.wordregs[regsi] + disp16; break;\ - case 5: tempea = regs.wordregs[regdi] + disp16; break;\ - case 6: tempea = regs.wordregs[regbp] + disp16; break;\ - case 7: tempea = regs.wordregs[regbx] + disp16; break;\ - } break;\ - }\ - ea = useseg;\ - ea <<= 4;\ - ea += (tempea & 0xFFFF);\ -} - -inline void push(uint16_t pushval) { - putreg16(regsp, getreg16(regsp) - 2); - //printf(" %04X:%04X PUSH\n", segregs[regss], getreg16(regsp)); - putmem16(segregs[regss], getreg16(regsp), pushval); -} - -inline uint16_t pop() { - uint16_t tempval; - //printf(" %04X:%04X POP\n", segregs[regss], getreg16(regsp)); - tempval = getmem16(segregs[regss], getreg16(regsp)); - putreg16(regsp, getreg16(regsp) + 2); - return (tempval); -} - -void reset86() { - uint16_t i, cnt, bitcount; - segregs[regcs] = 0xFFFF; - ip = 0x0000; - segregs[regss] = 0x0000; - regs.wordregs[regsp] = 0xFFFE; - - //generate parity lookup table - for (i = 0; i < 256; i++) { - bitcount = 0; - for (cnt = 0; cnt < 8; cnt++) - bitcount += ((i >> cnt) & 1); - if (bitcount & 1) parity[i] = 0; else parity[i] = 1; - } -} - -/*inline uint16_t readrm16(uint8_t rmval) { - if (mode < 3) { - getea(rmval); - return (read86(ea) | ((uint16_t)read86(ea + 1) << 8)); - } else { - return (getreg16(rmval)); - } -}*/ - -#define readrm16(rmval) ( (mode < 3) ? (read86(ea) | ((uint16_t)read86(ea + 1) << 8)) : (getreg16(rmval)) ) - -/*inline uint8_t readrm8(uint8_t rmval) { - if (mode < 3) { - //getea(rmval); - return (read86(ea)); - } else { - return (getreg8(rmval)); - } -}*/ - -#define readrm8(rmval) ( (mode < 3) ? read86(ea) : getreg8(rmval) ) - -inline void writerm16(uint8_t rmval, uint16_t value) { -//#define writerm16(rmval, value) { - if (mode < 3) {\ - /*getea(rmval);*/\ - write86(ea, value & 0xFF);\ - write86(ea + 1, value >> 8);\ - } else {\ - putreg16(rmval, value);\ - }\ -} - -inline void writerm8(uint8_t rmval, uint8_t value) { -//#define writerm8(rmval, value) { - if (mode < 3) {\ - /*getea(rmval);*/\ - write86(ea, value);\ - } else {\ - putreg8(rmval, value);\ - }\ -} - -inline uint8_t op_grp2_8(uint8_t cnt) { - uint16_t s, oldcf, msb; - uint8_t shift; - s = oper1b; - oldcf = cf; - switch (reg) { - case 0: //ROL r/m8 - for (shift = 1; shift <= cnt; shift++) { - if (s & 0x80) cf = 1; else cf = 0; - s = s << 1; - s = s | cf; - } - if (cnt == 1) of = cf ^ ((s >> 7) & 1); - break; - - case 1: //ROR r/m8 - for (shift = 1; shift <= cnt; shift++) { - cf = s & 1; - s = (s >> 1) | (cf << 7); - } - if (cnt == 1) of = (s >> 7) ^ ((s >> 6) & 1); - break; - - case 2: //RCL r/m8 - for (shift = 1; shift <= cnt; shift++) { - oldcf = cf; - if (s & 0x80) cf = 1; else cf = 0; - s = s << 1; - s = s | oldcf; - } - if (cnt == 1) of = cf ^ ((s >> 7) & 1); - break; - - case 3: //RCR r/m8 - for (shift = 1; shift <= cnt; shift++) { - oldcf = cf; - cf = s & 1; - s = (s >> 1) | (oldcf << 7); - } - if (cnt == 1) of = (s >> 7) ^ ((s >> 6) & 1); - break; - - case 4: case 6: //SHL r/m8 - for (shift = 1; shift <= cnt; shift++) { - if (s & 0x80) cf = 1; else cf = 0; - s = (s << 1) & 0xFF; - } - if ((cnt == 1) && (cf == (s >> 7))) of = 0; else of = 1; - flag_szp8((uint8_t)s); break; - - case 5: //SHR r/m8 - if ((cnt == 1) && (s & 0x80)) of = 1; else of = 0; - for (shift = 1; shift <= cnt; shift++) { - cf = s & 1; - s = s >> 1; - } - flag_szp8((uint8_t)s); break; - - case 7: //SAR r/m8 - for (shift = 1; shift <= cnt; shift++) { - msb = s & 0x80; - cf = s & 1; - s = (s >> 1) | msb; - } - of = 0; - flag_szp8((uint8_t)s); break; - - } - return (s & 0xFF); -} - -inline uint16_t op_grp2_16(uint8_t cnt) { - uint32_t s, oldcf, msb; - uint8_t shift; - s = oper1; - oldcf = cf; - switch (reg) { - case 0: //ROL r/m8 - for (shift = 1; shift <= cnt; shift++) { - if (s & 0x8000) cf = 1; else cf = 0; - s = s << 1; - s = s | cf; - } - if (cnt == 1) of = cf ^ ((s >> 15) & 1); - break; - - case 1: //ROR r/m8 - for (shift = 1; shift <= cnt; shift++) { - cf = s & 1; - s = (s >> 1) | (cf << 15); - } - if (cnt == 1) of = (s >> 15) ^ ((s >> 14) & 1); - break; - - case 2: //RCL r/m8 - for (shift = 1; shift <= cnt; shift++) { - oldcf = cf; - if (s & 0x8000) cf = 1; else cf = 0; - s = s << 1; - s = s | oldcf; - } - if (cnt == 1) of = cf ^ ((s >> 15) & 1); - break; - - case 3: //RCR r/m8 - for (shift = 1; shift <= cnt; shift++) { - oldcf = cf; - cf = s & 1; - s = (s >> 1) | (oldcf << 15); - } - if (cnt == 1) of = (s >> 15) ^ ((s >> 14) & 1); - break; - - case 4: case 6: //SHL r/m8 - for (shift = 1; shift <= cnt; shift++) { - if (s & 0x8000) cf = 1; else cf = 0; - s = (uint16_t)(s << 1); - } - if ((cnt == 1) && (cf == (s >> 15))) of = 0; else of = 1; - flag_szp16((uint16_t)s); break; - - case 5: //SHR r/m8 - if ((cnt == 1) && (s & 0x8000)) of = 1; else of = 0; - for (shift = 1; shift <= cnt; shift++) { - cf = s & 1; - s = s >> 1; - } - flag_szp16((uint16_t)s); break; - - case 7: //SAR r/m8 - for (shift = 1; shift <= cnt; shift++) { - msb = s & 0x8000; - cf = s & 1; - s = (s >> 1) | msb; - } - of = 0; - flag_szp16((uint16_t)s); break; - - } - return ((uint16_t)s); -} - -inline void op_div8(uint16_t valdiv, uint8_t divisor) { - if (divisor == 0) { - intcall86(0); - return; - } - if ((valdiv / (uint16_t)divisor) > 0xFF) { - intcall86(0); - return; - } - regs.byteregs[regah] = valdiv % (uint16_t)divisor; - regs.byteregs[regal] = valdiv / (uint16_t)divisor; -} - -inline void op_idiv8(uint16_t valdiv, uint8_t divisor) { - uint16_t s1, s2, d1, d2, sign; - if (divisor == 0) { - intcall86(0); - return; - } - s1 = valdiv; - s2 = divisor; - sign = (((s1 ^ s2) & 0x8000) != 0); - s1 = (s1 < 0x8000) ? s1 : (uint16_t)(~s1 + 1); - s2 = (s2 < 0x8000) ? s2 : (uint16_t)(~s2 + 1); - d1 = s1 / s2; - d2 = s1 % s2; - if (d1 & 0xFF00) { - intcall86(0); - return; - } - if (sign) { - d1 = (~d1 + 1) & 0xff; - d2 = (~d2 + 1) & 0xff; - } - regs.byteregs[regah] = d2; - regs.byteregs[regal] = d1; -} - -inline void op_grp3_8() { - oper1 = signext(oper1b); oper2 = signext(oper2b); - switch (reg) { - case 0: case 1: //TEST - flag_log8(oper1b & getmem8(segregs[regcs], ip)); StepIP(1); - break; - - case 2: //NOT - res8 = ~oper1b; break; - - case 3: //NEG - res8 = (~oper1b) + 1; - flag_sub8(0, oper1b); - if (res8 == 0) cf = 0; else cf = 1; - break; - - case 4: //MUL - temp1 = (uint32_t)oper1b * (uint32_t)regs.byteregs[regal]; - putreg16(regax, (uint16_t)temp1); - flag_szp8((uint8_t)temp1); - if (regs.byteregs[regah]) { - cf = 1; - of = 1; - } else { - cf = 0; - of = 0; - } - break; - - case 5: //IMUL - oper1 = signext(oper1b); - temp1 = signext(regs.byteregs[regal]); - temp2 = oper1; - if ((temp1 & 0x80) == 0x80) temp1 = temp1 | 0xFFFFFF00UL; - if ((temp2 & 0x80) == 0x80) temp2 = temp2 | 0xFFFFFF00UL; - temp3 = (uint16_t)(temp1 * temp2); - putreg16(regax, (uint16_t)temp3); - if (regs.byteregs[regah]) { - cf = 1; - of = 1; - } else { - cf = 0; - of = 0; - } - break; - - case 6: //DIV - op_div8(getreg16(regax), oper1b); - break; - - case 7: //IDIV - op_idiv8(getreg16(regax), oper1b); - break; - } -} - -void op_div16(uint32_t valdiv, uint16_t divisor) { - if (divisor == 0) { - intcall86(0); - return; - } - if ((valdiv / (uint32_t)divisor) > 0xFFFF) { - intcall86(0); - return; - } - putreg16(regdx, valdiv % (uint32_t)divisor); - putreg16(regax, valdiv / (uint32_t)divisor); -} - -void op_idiv16(uint32_t valdiv, uint16_t divisor) { - uint32_t d1, d2, s1, s2, sign; - if (divisor == 0) { - intcall86(0); - return; - } - s1 = valdiv; - s2 = divisor; - s2 = (s2 & 0x8000) ? (s2 | 0xffff0000UL) : s2; - sign = (((s1 ^ s2) & 0x80000000UL) != 0); - s1 = (s1 < 0x80000000UL) ? s1 : ((~s1 + 1) & 0xffffffffUL); - s2 = (s2 < 0x80000000UL) ? s2 : ((~s2 + 1) & 0xffffffffUL); - d1 = s1 / s2; - d2 = s1 % s2; - if (d1 & 0xFFFF0000UL) { - intcall86(0); - return; - } - if (sign) { - d1 = (uint16_t)(~d1 + 1); - d2 = (uint16_t)(~d2 + 1); - } - putreg16(regax, d1); - putreg16(regdx, d2); -} - -inline void op_grp3_16() { - switch (reg) { - case 0: case 1: //TEST - flag_log16(oper1 & getmem16(segregs[regcs], ip)); StepIP(2); break; - case 2: //NOT - res16 = ~oper1; break; - case 3: //NEG - res16 = (~oper1) + 1; - flag_sub16(0, oper1); - if (res16) cf = 1; else cf = 0; - break; - case 4: //MUL - temp1 = (uint32_t)oper1 * (uint32_t)getreg16(regax); - putreg16(regax, (uint16_t)temp1); - putreg16(regdx, temp1 >> 16); - flag_szp16((uint16_t)temp1); - if (getreg16(regdx)) { - cf = 1; - of = 1; - } else { - cf = 0; - of = 0; - } - break; - case 5: //IMUL - temp1 = getreg16(regax); - temp2 = oper1; - if (temp1 & 0x8000) temp1 |= 0xFFFF0000UL; - if (temp2 & 0x8000) temp2 |= 0xFFFF0000UL; - temp3 = temp1 * temp2; - putreg16(regax, (uint16_t)temp3); //into register ax - putreg16(regdx, temp3 >> 16); //into register dx - if (getreg16(regdx)) { - cf = 1; - of = 1; - } else { - cf = 0; - of = 0; - } - break; - case 6: //DIV - op_div16(((uint32_t)getreg16(regdx) << 16) + (uint32_t)getreg16(regax), oper1); break; - case 7: //DIV - op_idiv16(((uint32_t)getreg16(regdx) << 16) + (uint32_t)getreg16(regax), oper1); break; - } -} - -//inline void op_grp5() { -#define op_grp5() {\ - switch (reg) {\ - case 0: /*INC Ev*/\ - oper2 = 1;\ - tempcf = cf;\ - op_add16();\ - cf = tempcf;\ - writerm16(rm, res16); break;\ - case 1: /*DEC Ev*/\ - oper2 = 1;\ - tempcf = cf;\ - op_sub16();\ - cf = tempcf;\ - writerm16(rm, res16); break;\ - case 2: /*CALL Ev*/\ - push(ip);\ - ip = oper1; break;\ - case 3: /*CALL Mp*/\ - push(segregs[regcs]); push(ip);\ - /*getea(rm);*/\ - ip = (uint16_t)read86(ea) + ((uint16_t)read86(ea + 1) << 8);\ - segregs[regcs] = (uint16_t)read86(ea + 2) + ((uint16_t)read86(ea + 3) << 8); break;\ - case 4: /*JMP Ev*/\ - ip = oper1; break;\ - case 5: /*JMP Mp*/\ - /*getea(rm);*/\ - ip = (uint16_t)read86(ea) + ((uint16_t)read86(ea + 1) << 8);\ - segregs[regcs] = (uint16_t)read86(ea + 2) + ((uint16_t)read86(ea + 3) << 8); break;\ - case 6: /*PUSH Ev*/\ - push(oper1); break;\ - }\ -} - -uint8_t didintr = 0; - -void intcall86(uint8_t intnum) { - didintr = 1; - - switch (intnum) { - case 0x10: //video services - if (regs.byteregs[regah] == 0) { //video mode set -#ifdef ADVANCED_CLIENT - Serial.write(0xFF); - Serial.write(0x02); - Serial.write(regs.byteregs[regal]); - Serial.write(regs.byteregs[regal]); //duplicate for checksum - Serial.write(0xFE); - Serial.write(0x02); -#endif -#ifdef USE_DISPLAY - if (vidmode != regs.byteregs[regal]) clear_display(); - palettereset(); -#endif - vidmode = regs.byteregs[regal]; - //Serial.print("vidmode = "); Serial.println(vidmode); - } - break; - case 0x13: //disk services - diskhandler(); - return; - case 0x19: //bootstrap - //Serial.println("Bootstrap!"); - if (bootdrive < 255) { //read first sector of boot drive into 07C0:0000 and execute it - regs.byteregs[regdl] = bootdrive; - readdisk((bootdrive & 0x80) ? bootdrive - 126 : bootdrive, 0x07C0, 0x0000, 0, 1, 0, 1); - segregs[regcs] = 0x0000; ip = 0x7C00; - } else { - segregs[regcs] = 0xF600; //start ROM BASIC at bootstrap if requested - ip = 0x0000; - } - return; - case 0xFC: - net_handler(); - return; - default: - break; - } - - push(makeflagsword()); - push(segregs[regcs]); - push(ip); - segregs[regcs] = getmem16(0, ((uint16_t)intnum << 2) + 2); - ip = getmem16(0, (uint16_t)intnum << 2); - ifl = 0; - tf = 0; -} - -uint64_t frametimer = 0, didwhen = 0, didticks = 0; -uint32_t makeupticks = 0; -extern float timercomp; -uint64_t timerticks = 0, realticks = 0; -uint64_t lastcountertimer = 0, counterticks = 10000; - -#ifdef PROFILING -uint32_t startmicros, endmicros; -uint32_t instrtime[0x100]; -#endif - -#ifdef PS2_KEYBOARD -extern uint8_t kbloop; -#endif - -extern volatile uint8_t timerTick; - -void exec86(uint32_t execloops) { - uint32_t loopcount; - uint8_t docontinue; - static uint16_t firstip, trap_toggle = 0; - - for (loopcount = 0; loopcount < execloops; loopcount++) { - /*Serial.print(segregs[regcs], HEX); - Serial.write(':'); - Serial.println(ip, HEX);*/ - #ifdef PS2_KEYBOARD - if (kbloop) { - uint32_t msnow; - msnow = micros(); - while ((micros() - msnow) < 20000) { } - kbloop = 0; - ps2poll(); - } - #endif - - if (timerTick) { - //printf("isr\n"); - timerTick = 0; - doirq(0); - } - - if (trap_toggle) intcall86(1); - if (tf) trap_toggle = 1; - else trap_toggle = 0; - if (!trap_toggle && (ifl && (i8259.irr & (~i8259.imr)))) intcall86(nextintr()); //get next interrupt from the i8259, if any - reptype = 0; segoverride = 0; - useseg = segregs[regds]; docontinue = 0; - firstip = ip; - while (!docontinue) { - segregs[regcs] = segregs[regcs] & 0xFFFF; ip = ip & 0xFFFF; - savecs = segregs[regcs]; saveip = ip; - opcode = getmem8(segregs[regcs], ip); StepIP(1); - - switch (opcode) { - //segment prefix check - case 0x2E: //segment segregs[regcs] - useseg = segregs[regcs]; segoverride = 1; break; - case 0x3E: //segment segregs[regds] - useseg = segregs[regds]; segoverride = 1; break; - case 0x26: //segment segregs[reges] - useseg = segregs[reges]; segoverride = 1; break; - case 0x36: //segment segregs[regss] - useseg = segregs[regss]; segoverride = 1; break; - - //repetition prefix check - case 0xF3: //REP/REPE/REPZ - reptype = 1; break; - case 0xF2: //REPNE/REPNZ - reptype = 2; break; - default: - docontinue = 1; - break; - } - } - totalexec++; - //printf("%04X:%04X %02X\n", segregs[regcs], ip, opcode); - //if ((segregs[regcs]==0xF000) && (ip < 0xE000)) exit(0); - -#ifdef PROFILING - startmicros = micros(); -#endif - switch (opcode) { - case 0x0: //00 ADD Eb Gb - modregrm(); - oper1b = readrm8(rm); oper2b = getreg8(reg); - op_add8(); - writerm8(rm, res8); - break; - case 0x1: //01 ADD Ev Gv - modregrm(); - oper1 = readrm16(rm); oper2 = getreg16(reg); - op_add16(); - writerm16(rm, res16); - break; - case 0x2: //02 ADD Gb Eb - modregrm(); - oper1b = getreg8(reg); oper2b = readrm8(rm); - op_add8(); - putreg8(reg, res8); - break; - case 0x3: //03 ADD Gv Ev - modregrm(); - oper1 = getreg16(reg); oper2 = readrm16(rm); - op_add16(); - putreg16(reg, res16); - break; - case 0x4: //04 ADD regs.byteregs[regal] Ib - oper1b = regs.byteregs[regal]; oper2b = getmem8(segregs[regcs], ip); StepIP(1); - op_add8(); - regs.byteregs[regal] = res8; - break; - case 0x5: //05 ADD eAX Iv - oper1 = (getreg16(regax)); oper2 = getmem16(segregs[regcs], ip); StepIP(2); - op_add16(); - putreg16(regax, res16); - break; - case 0x6: //06 PUSH segregs[reges] - push(segregs[reges]); - break; - case 0x7: //07 POP segregs[reges] - segregs[reges] = pop(); - break; - case 0x8: //08 OR Eb Gb - modregrm(); - oper1b = readrm8(rm); oper2b = getreg8(reg); - op_or8(); - writerm8(rm, res8); - break; - case 0x9: //09 OR Ev Gv - modregrm(); - oper1 = readrm16(rm); oper2 = getreg16(reg); - op_or16(); - writerm16(rm, res16); - break; - case 0xA: //0A OR Gb Eb - modregrm(); - oper1b = getreg8(reg); oper2b = readrm8(rm); - op_or8(); - putreg8(reg, res8); - break; - case 0xB: //0B OR Gv Ev - modregrm(); - oper1 = getreg16(reg); oper2 = readrm16(rm); - op_or16(); - if ((oper1 == 0xF802) && (oper2 == 0xF802)) sf = 0; //cheap hack to make Wolf 3D think we're a 286 so it plays - putreg16(reg, res16); - break; - case 0xC: //0C OR regs.byteregs[regal] Ib - oper1b = regs.byteregs[regal]; oper2b = getmem8(segregs[regcs], ip); StepIP(1); - op_or8(); - regs.byteregs[regal] = res8; - break; - case 0xD: //0D OR eAX Iv - oper1 = getreg16(regax); oper2 = getmem16(segregs[regcs], ip); StepIP(2); - op_or16(); - putreg16(regax, res16); - break; - case 0xE: //0E PUSH segregs[regcs] - push(segregs[regcs]); - break; - case 0xF: //0F POP CS - segregs[regcs] = pop(); - break; - /*case 0xF: //0F 80286+ extended opcodes - segregs[regcs] = segregs[regcs] & 0xFFFF; ip = ip & 0xFFFF; - savecs = segregs[regcs]; saveip = ip; - opcode = getmem8(segregs[regcs], ip); StepIP(1); - op_286(); - break;*/ - case 0x10: //10 ADC Eb Gb - modregrm(); - oper1b = readrm8(rm); oper2b = getreg8(reg); - op_adc8(); - writerm8(rm, res8); - break; - case 0x11: //11 ADC Ev Gv - modregrm(); - oper1 = readrm16(rm); oper2 = getreg16(reg); - op_adc16(); - writerm16(rm, res16); - break; - case 0x12: //12 ADC Gb Eb - modregrm(); - oper1b = getreg8(reg); oper2b = readrm8(rm); - op_adc8(); - putreg8(reg, res8); - break; - case 0x13: //13 ADC Gv Ev - modregrm(); - oper1 = getreg16(reg); oper2 = readrm16(rm); - op_adc16(); - putreg16(reg, res16); - break; - case 0x14: //14 ADC regs.byteregs[regal] Ib - oper1b = regs.byteregs[regal]; oper2b = getmem8(segregs[regcs], ip); StepIP(1); - op_adc8(); - regs.byteregs[regal] = res8; - break; - case 0x15: //15 ADC eAX Iv - oper1 = getreg16(regax); oper2 = getmem16(segregs[regcs], ip); StepIP(2); - op_adc16(); - putreg16(regax, res16); - break; - case 0x16: //16 PUSH segregs[regss] - push(segregs[regss]); - break; - case 0x17: //17 POP segregs[regss] - segregs[regss] = pop(); - break; - case 0x18: //18 SBB Eb Gb - modregrm(); - oper1b = readrm8(rm); oper2b = getreg8(reg); - op_sbb8(); - writerm8(rm, res8); - break; - case 0x19: //19 SBB Ev Gv - modregrm(); - oper1 = readrm16(rm); oper2 = getreg16(reg); - op_sbb16(); - writerm16(rm, res16); - break; - case 0x1A: //1A SBB Gb Eb - modregrm(); - oper1b = getreg8(reg); oper2b = readrm8(rm); - op_sbb8(); - putreg8(reg, res8); - break; - case 0x1B: //1B SBB Gv Ev - modregrm(); - oper1 = getreg16(reg); oper2 = readrm16(rm); - op_sbb16(); - putreg16(reg, res16); - break; - case 0x1C: //1C SBB regs.byteregs[regal] Ib; - oper1b = regs.byteregs[regal]; oper2b = getmem8(segregs[regcs], ip); StepIP(1); - op_sbb8(); - regs.byteregs[regal] = res8; - break; - case 0x1D: //1D SBB eAX Iv - oper1 = getreg16(regax); oper2 = getmem16(segregs[regcs], ip); StepIP(2); - op_sbb16(); - putreg16(regax, res16); - break; - case 0x1E: //1E PUSH segregs[regds] - push(segregs[regds]); - break; - case 0x1F: //1F POP segregs[regds] - segregs[regds] = pop(); - break; - case 0x20: //20 AND Eb Gb - modregrm(); - oper1b = readrm8(rm); oper2b = getreg8(reg); - op_and8(); - writerm8(rm, res8); - break; - case 0x21: //21 AND Ev Gv - modregrm(); - oper1 = readrm16(rm); oper2 = getreg16(reg); - op_and16(); - writerm16(rm, res16); - break; - case 0x22: //22 AND Gb Eb - modregrm(); - oper1b = getreg8(reg); oper2b = readrm8(rm); - op_and8(); - putreg8(reg, res8); - break; - case 0x23: //23 AND Gv Ev - modregrm(); - oper1 = getreg16(reg); oper2 = readrm16(rm); - op_and16(); - putreg16(reg, res16); - break; - case 0x24: //24 AND regs.byteregs[regal] Ib - oper1b = regs.byteregs[regal]; oper2b = getmem8(segregs[regcs], ip); StepIP(1); - op_and8(); - regs.byteregs[regal] = res8; - break; - case 0x25: //25 AND eAX Iv - oper1 = getreg16(regax); oper2 = getmem16(segregs[regcs], ip); StepIP(2); - op_and16(); - putreg16(regax, res16); - break; - case 0x27: //27 DAA - if (((regs.byteregs[regal] & 0xF) > 9) || (af == 1)) { - oper1 = regs.byteregs[regal] + 6; - regs.byteregs[regal] = oper1 & 255; - if (oper1 & 0xFF00) cf = 1; else cf = 0; - af = 1; - } else af = 0; - if (((regs.byteregs[regal] & 0xF0) > 0x90) || (cf == 1)) { - regs.byteregs[regal] = regs.byteregs[regal] + 0x60; - cf = 1; - } else cf = 0; - regs.byteregs[regal] = regs.byteregs[regal] & 255; - flag_szp8(regs.byteregs[regal]); - break; - case 0x28: //28 SUB Eb Gb - modregrm(); - oper1b = readrm8(rm); oper2b = getreg8(reg); - op_sub8(); - writerm8(rm, res8); - break; - case 0x29: //29 SUB Ev Gv - modregrm(); - oper1 = readrm16(rm); oper2 = getreg16(reg); - op_sub16(); - writerm16(rm, res16); - break; - case 0x2A: //2A SUB Gb Eb - modregrm(); - oper1b = getreg8(reg); oper2b = readrm8(rm); - op_sub8(); - putreg8(reg, res8); - break; - case 0x2B: //2B SUB Gv Ev - modregrm(); - oper1 = getreg16(reg); oper2 = readrm16(rm); - op_sub16(); - putreg16(reg, res16); - break; - case 0x2C: //2C SUB regs.byteregs[regal] Ib - oper1b = regs.byteregs[regal]; oper2b = getmem8(segregs[regcs], ip); StepIP(1); - op_sub8(); - regs.byteregs[regal] = res8; - break; - case 0x2D: //2D SUB eAX Iv - oper1 = getreg16(regax); oper2 = getmem16(segregs[regcs], ip); StepIP(2); - op_sub16(); - putreg16(regax, res16); - break; - case 0x2F: //2F DAS - if (((regs.byteregs[regal] & 15) > 9) || (af == 1)) { - oper1 = regs.byteregs[regal] - 6; - regs.byteregs[regal] = oper1 & 255; - if (oper1 & 0xFF00) cf = 1; else cf = 0; - af = 1; - } else af = 0; - if (((regs.byteregs[regal] & 0xF0) > 0x90) || (cf == 1)) { - regs.byteregs[regal] = regs.byteregs[regal] - 0x60; - cf = 1; - } else cf = 0; - flag_szp8(regs.byteregs[regal]); - break; - case 0x30: //30 XOR Eb Gb - modregrm(); - oper1b = readrm8(rm); oper2b = getreg8(reg); - op_xor8(); - writerm8(rm, res8); - break; - case 0x31: //31 XOR Ev Gv - modregrm(); - oper1 = readrm16(rm); oper2 = getreg16(reg); - op_xor16(); - writerm16(rm, res16); - break; - case 0x32: //32 XOR Gb Eb - modregrm(); - oper1b = getreg8(reg); oper2b = readrm8(rm); - op_xor8(); - putreg8(reg, res8); - break; - case 0x33: //33 XOR Gv Ev - modregrm(); - oper1 = getreg16(reg); oper2 = readrm16(rm); - op_xor16(); - putreg16(reg, res16); - break; - case 0x34: //34 XOR regs.byteregs[regal] Ib - oper1b = regs.byteregs[regal]; oper2b = getmem8(segregs[regcs], ip); StepIP(1); - op_xor8(); - regs.byteregs[regal] = res8; - break; - case 0x35: //35 XOR eAX Iv - oper1 = getreg16(regax); oper2 = getmem16(segregs[regcs], ip); StepIP(2); - op_xor16(); - putreg16(regax, res16); - break; - case 0x37: //37 AAA ASCII - if (((regs.byteregs[regal] & 0xF) > 9) || (af == 1)) { - regs.byteregs[regal] = regs.byteregs[regal] + 6; - regs.byteregs[regah] = regs.byteregs[regah] + 1; - af = 1; - cf = 1; - } else { - af = 0; - cf = 0; - } - regs.byteregs[regal] = regs.byteregs[regal] & 0xF; - break; - case 0x38: //38 CMP Eb Gb - modregrm(); - oper1b = readrm8(rm); oper2b = getreg8(reg); - flag_sub8(oper1b, oper2b); - break; - case 0x39: //39 CMP Ev Gv - modregrm(); - oper1 = readrm16(rm); oper2 = getreg16(reg); - flag_sub16(oper1, oper2); - break; - case 0x3A: //3A CMP Gb Eb - modregrm(); - oper1b = getreg8(reg); oper2b = readrm8(rm); - flag_sub8(oper1b, oper2b); - break; - case 0x3B: //3B CMP Gv Ev - modregrm(); - oper1 = getreg16(reg); oper2 = readrm16(rm); - flag_sub16(oper1, oper2); - break; - case 0x3C: //3C CMP regs.byteregs[regal] Ib - oper1b = regs.byteregs[regal]; oper2b = getmem8(segregs[regcs], ip); StepIP(1); - flag_sub8(oper1b, oper2b); - break; - case 0x3D: //3D CMP eAX Iv - oper1 = getreg16(regax); oper2 = getmem16(segregs[regcs], ip); StepIP(2); - flag_sub16(oper1, oper2); - break; - case 0x3F: //3F AAS ASCII - if (((regs.byteregs[regal] & 0xF) > 9) || (af == 1)) { - regs.byteregs[regal] = regs.byteregs[regal] - 6; - regs.byteregs[regah] = regs.byteregs[regah] - 1; - af = 1; - cf = 1; - } else { - af = 0; - cf = 0; - } - regs.byteregs[regal] = regs.byteregs[regal] & 0xF; - break; - case 0x40: //40 INC eAX - oldcf = cf; - oper1 = getreg16(regax); oper2 = 1; - op_add16(); - cf = oldcf; - putreg16(regax, res16); - break; - case 0x41: //41 INC eCX - oldcf = cf; - oper1 = getreg16(regcx); oper2 = 1; - op_add16(); - cf = oldcf; - putreg16(regcx, res16); - break; - case 0x42: //42 INC eDX - oldcf = cf; - oper1 = getreg16(regdx); oper2 = 1; - op_add16(); - cf = oldcf; - putreg16(regdx, res16); - break; - case 0x43: //43 INC eBX - oldcf = cf; - oper1 = getreg16(regbx); oper2 = 1; - op_add16(); - cf = oldcf; - putreg16(regbx, res16); - break; - case 0x44: //44 INC eSP - oldcf = cf; - oper1 = getreg16(regsp); oper2 = 1; - op_add16(); - cf = oldcf; - putreg16(regsp, res16); - break; - case 0x45: //45 INC eBP - oldcf = cf; - oper1 = getreg16(regbp); oper2 = 1; - op_add16(); - cf = oldcf; - putreg16(regbp, res16); - break; - case 0x46: //46 INC eSI - oldcf = cf; - oper1 = getreg16(regsi); oper2 = 1; - op_add16(); - cf = oldcf; - putreg16(regsi, res16); - break; - case 0x47: //47 INC eDI - oldcf = cf; - oper1 = getreg16(regdi); oper2 = 1; - op_add16(); - cf = oldcf; - putreg16(regdi, res16); - break; - case 0x48: //48 DEC eAX - oldcf = cf; - oper1 = getreg16(regax); oper2 = 1; - op_sub16(); - cf = oldcf; - putreg16(regax, res16); - break; - case 0x49: //49 DEC eCX - oldcf = cf; - oper1 = getreg16(regcx); oper2 = 1; - op_sub16(); - cf = oldcf; - putreg16(regcx, res16); - break; - case 0x4A: //4A DEC eDX - oldcf = cf; - oper1 = getreg16(regdx); oper2 = 1; - op_sub16(); - cf = oldcf; - putreg16(regdx, res16); - break; - case 0x4B: //4B DEC eBX - oldcf = cf; - oper1 = getreg16(regbx); oper2 = 1; - op_sub16(); - cf = oldcf; - putreg16(regbx, res16); - break; - case 0x4C: //4C DEC eSP - oldcf = cf; - oper1 = getreg16(regsp); oper2 = 1; - op_sub16(); - cf = oldcf; - putreg16(regsp, res16); - break; - case 0x4D: //4D DEC eBP - oldcf = cf; - oper1 = getreg16(regbp); oper2 = 1; - op_sub16(); - cf = oldcf; - putreg16(regbp, res16); - break; - case 0x4E: //4E DEC eSI - oldcf = cf; - oper1 = getreg16(regsi); oper2 = 1; - op_sub16(); - cf = oldcf; - putreg16(regsi, res16); - break; - case 0x4F: //4F DEC eDI - oldcf = cf; - oper1 = getreg16(regdi); oper2 = 1; - op_sub16(); - cf = oldcf; - putreg16(regdi, res16); - break; - case 0x50: //50 PUSH eAX - push (getreg16(regax)); - break; - case 0x51: //51 PUSH eCX - push (getreg16(regcx)); - break; - case 0x52: //52 PUSH eDX - push (getreg16(regdx)); - break; - case 0x53: //53 PUSH eBX - push (getreg16(regbx)); - break; - case 0x54: //54 PUSH eSP - push (getreg16(regsp) - 2); - break; - case 0x55: //55 PUSH eBP - push (getreg16(regbp)); - break; - case 0x56: //56 PUSH eSI - push (getreg16(regsi)); - break; - case 0x57: //57 PUSH eDI - push (getreg16(regdi)); - break; - case 0x58: //58 POP eAX - putreg16(regax, pop()); - break; - case 0x59: //59 POP eCX - putreg16(regcx, pop()); - break; - case 0x5A: //5A POP eDX - putreg16(regdx, pop()); - break; - case 0x5B: //5B POP eBX - putreg16(regbx, pop()); - break; - case 0x5C: //5C POP eSP - putreg16(regsp, pop()); - break; - case 0x5D: //5D POP eBP - putreg16(regbp, pop()); - break; - case 0x5E: //5E POP eSI - putreg16(regsi, pop()); - break; - case 0x5F: //5F POP eDI - putreg16(regdi, pop()); - break; - case 0x60: //60 PUSHA (80186+) - oldsp = getreg16(regsp); - push(getreg16(regax)); - push(getreg16(regcx)); - push(getreg16(regdx)); - push(getreg16(regbx)); - push(oldsp); - push(getreg16(regbp)); - push(getreg16(regsi)); - push(getreg16(regdi)); - break; - case 0x61: //61 POPA (80186+) - putreg16(regdi, pop()); - putreg16(regsi, pop()); - putreg16(regbp, pop()); - dummy = pop(); - putreg16(regbx, pop()); - putreg16(regdx, pop()); - putreg16(regcx, pop()); - putreg16(regax, pop()); - break; - case 0x68: //68 PUSH Iv (80186+) - push(getmem16(segregs[regcs], ip)); StepIP(2); - break; - case 0x69: //69 IMUL Gv Ev Iv (80186+) - //print("WE HIT 69h IMUL\r\n"); - modregrm(); - temp1 = readrm16(rm); - temp2 = getmem16(segregs[regcs], ip); StepIP(2); - if ((temp1 & 0x8000L) == 0x8000L) temp1 = temp1 | 0xFFFF0000L; - if ((temp2 & 0x8000L) == 0x8000L) temp2 = temp2 | 0xFFFF0000L; - temp3 = temp1 * temp2; - putreg16(reg, temp3 & 0xFFFFL); - if (temp3 & 0xFFFF0000L) { - cf = 1; - of = 1; - } else { - cf = 0; - of = 0; - } - break; - case 0x6A: //6A PUSH Ib (80186+) - push(getmem8(segregs[regcs], ip)); StepIP(1); - break; - case 0x6B: //6B IMUL Gv Eb Ib (80186+) - //print("WE HIT 6Bh IMUL\r\n"); - modregrm(); - temp1 = readrm16(rm); - temp2 = signext(getmem8(segregs[regcs], ip)); StepIP(1); - if ((temp1 & 0x8000L) == 0x8000L) temp1 = temp1 | 0xFFFF0000L; - if ((temp2 & 0x8000L) == 0x8000L) temp2 = temp2 | 0xFFFF0000L; - temp3 = temp1 * temp2; - putreg16(reg, temp3 & 0xFFFFL); - if (temp3 & 0xFFFF0000L) { - cf = 1; - of = 1; - } else { - cf = 0; - of = 0; - } - break; - //case 0x6C ... 0x6F: //80186 port operations, just act as if they//re NOPs for now... - // StepIP(1); //they have a modregrm(); byte we must skip... i may properly emulate these later. - // break; - case 0x6E: //6E OUTSB - if (reptype && (getreg16(regcx) == 0)) break; - portout16 = 0; - portout(regs.wordregs[regdx], getmem16(useseg, getreg16(regsi))); - if (df) { - putreg16(regsi, getreg16(regsi) - 1); - putreg16(regdi, getreg16(regdi) - 1); - } - else { - putreg16(regsi, getreg16(regsi) + 1); - putreg16(regdi, getreg16(regdi) + 1); - } - if (reptype) putreg16(regcx, getreg16(regcx) - 1); - if (!reptype) break; - ip = firstip; - break; - case 0x6F: //6F OUTSW - if (reptype && (getreg16(regcx) == 0)) break; - portout16 = 1; - portout(regs.wordregs[regdx], getmem16(useseg, getreg16(regsi))); - if (df) { - putreg16(regsi, getreg16(regsi) - 2); - putreg16(regdi, getreg16(regdi) - 2); - } - else { - putreg16(regsi, getreg16(regsi) + 2); - putreg16(regdi, getreg16(regdi) + 2); - } - if (reptype) putreg16(regcx, getreg16(regcx) - 1); - if (!reptype) break; - ip = firstip; - break; - - case 0x70: //70 JO Jb - temp16 = signext(getmem8(segregs[regcs], ip)); StepIP(1); - if (of) ip = ip + temp16; - break; - case 0x71: //71 JNO Jb - temp16 = signext(getmem8(segregs[regcs], ip)); StepIP(1); - if (!of) ip = ip + temp16; - break; - case 0x72: //72 JB Jb - temp16 = signext(getmem8(segregs[regcs], ip)); StepIP(1); - if (cf) ip = ip + temp16; - break; - case 0x73: //73 JNB Jb - temp16 = signext(getmem8(segregs[regcs], ip)); StepIP(1); - if (!cf) ip = ip + temp16; - break; - case 0x74: //74 JZ Jb - temp16 = signext(getmem8(segregs[regcs], ip)); StepIP(1); - if (zf) ip = ip + temp16; - break; - case 0x75: //75 JNZ Jb - temp16 = signext(getmem8(segregs[regcs], ip)); StepIP(1); - if (!zf) ip = ip + temp16; - break; - case 0x76: //76 JBE Jb - temp16 = signext(getmem8(segregs[regcs], ip)); StepIP(1); - if (cf || zf) ip = ip + temp16; - break; - case 0x77: //77 JA Jb - temp16 = signext(getmem8(segregs[regcs], ip)); StepIP(1); - if (!cf && !zf) ip = ip + temp16; - break; - case 0x78: //78 JS Jb - temp16 = signext(getmem8(segregs[regcs], ip)); StepIP(1); - if (sf) ip = ip + temp16; - break; - case 0x79: //79 JNS Jb - temp16 = signext(getmem8(segregs[regcs], ip)); StepIP(1); - if (!sf) ip = ip + temp16; - break; - case 0x7A: //7A JPE Jb - temp16 = signext(getmem8(segregs[regcs], ip)); StepIP(1); - if (pf) ip = ip + temp16; - break; - case 0x7B: //7B JPO Jb - temp16 = signext(getmem8(segregs[regcs], ip)); StepIP(1); - if (!pf) ip = ip + temp16; - break; - case 0x7C: //7C JL Jb - temp16 = signext(getmem8(segregs[regcs], ip)); StepIP(1); - if (sf != of) ip = ip + temp16; - break; - case 0x7D: //7D JGE Jb - temp16 = signext(getmem8(segregs[regcs], ip)); StepIP(1); - if (sf == of) ip = ip + temp16; - break; - case 0x7E: //7E JLE Jb - temp16 = signext(getmem8(segregs[regcs], ip)); StepIP(1); - if ((sf != of) || zf) ip = ip + temp16; - break; - case 0x7F: //7F JG Jb - temp16 = signext(getmem8(segregs[regcs], ip)); StepIP(1); - if (!zf && (sf == of)) ip = ip + temp16; - break; - case 0x80: case 0x82: //80/82 GRP1 Eb Ib - modregrm(); - oper1b = readrm8(rm); - oper2b = getmem8(segregs[regcs], ip); StepIP(1); - switch (reg) { - case 0: op_add8(); break; - case 1: op_or8(); break; - case 2: op_adc8(); break; - case 3: op_sbb8(); break; - case 4: op_and8(); break; - case 5: op_sub8(); break; - case 6: op_xor8(); break; - case 7: flag_sub8(oper1b, oper2b); break; - default: break; //to avoid compiler warnings - } - if (reg < 7) writerm8(rm, res8); - break; - case 0x81: //81 GRP1 Ev Iv - case 0x83: //83 GRP1 Ev Ib - modregrm(); - oper1 = readrm16(rm); - if (opcode == 0x81) { - oper2 = getmem16(segregs[regcs], ip); StepIP(2); - } else { - oper2 = signext(getmem8(segregs[regcs], ip)); StepIP(1); - } - switch (reg) { - case 0: op_add16(); break; - case 1: op_or16(); break; - case 2: op_adc16(); break; - case 3: op_sbb16(); break; - case 4: op_and16(); break; - case 5: op_sub16(); break; - case 6: op_xor16(); break; - case 7: flag_sub16(oper1, oper2); break; - default: break; //to avoid compiler warnings - } - if (reg < 7) writerm16(rm, res16); - break; - case 0x84: //84 TEST Gb Eb - modregrm(); - oper1b = getreg8(reg); oper2b = readrm8(rm); - flag_log8(oper1b & oper2b); - break; - case 0x85: //85 TEST Gv Ev - modregrm(); - oper1 = getreg16(reg); oper2 = readrm16(rm); - flag_log16(oper1 & oper2); - break; - case 0x86: //86 XCHG Gb Eb - modregrm(); - oper1b = getreg8(reg); - putreg8(reg, readrm8(rm)); - writerm8(rm, oper1b); - break; - case 0x87: //87 XCHG Gv Ev - modregrm(); - oper1 = getreg16(reg); - putreg16(reg, readrm16(rm)); - writerm16(rm, oper1); - break; - case 0x88: //88 MOV Eb Gb - modregrm(); - writerm8(rm, getreg8(reg)); - break; - case 0x89: //89 MOV Ev Gv - modregrm(); - writerm16(rm, getreg16(reg)); - break; - case 0x8A: //8A MOV Gb Eb - modregrm(); - putreg8(reg, readrm8(rm)); - break; - case 0x8B: //8B MOV Gv Ev - modregrm(); - putreg16(reg, readrm16(rm)); - break; - case 0x8C: //8C MOV Ew Sw - modregrm(); - writerm16(rm, getsegreg(reg)); - break; - case 0x8D: //8D LEA Gv M - modregrm(); - //getea(rm); - putreg16(reg, ea - segbase(useseg)); - break; - case 0x8E: //8E MOV Sw Ew - modregrm(); - putsegreg(reg, readrm16(rm)); - break; - case 0x8F: //8F POP Ev - modregrm(); - writerm16(rm, pop()); - break; - case 0x90: //90 NOP - break; - case 0x91: //91 XCHG eCX eAX - oper1 = getreg16(regcx); - putreg16(regcx, getreg16(regax)); - putreg16(regax, oper1); - break; - case 0x92: //92 XCHG eDX eAX - oper1 = getreg16(regdx); - putreg16(regdx, getreg16(regax)); - putreg16(regax, oper1); - break; - case 0x93: //93 XCHG eBX eAX - oper1 = getreg16(regbx); - putreg16(regbx, getreg16(regax)); - putreg16(regax, oper1); - break; - case 0x94: //94 XCHG eSP eAX - oper1 = getreg16(regsp); - putreg16(regsp, getreg16(regax)); - putreg16(regax, oper1); - break; - case 0x95: //95 XCHG eBP eAX - oper1 = getreg16(regbp); - putreg16(regbp, getreg16(regax)); - putreg16(regax, oper1); - break; - case 0x96: //96 XCHG eSI eAX - oper1 = getreg16(regsi); - putreg16(regsi, getreg16(regax)); - putreg16(regax, oper1); - break; - case 0x97: //97 XCHG eDI eAX - oper1 = getreg16(regdi); - putreg16(regdi, getreg16(regax)); - putreg16(regax, oper1); - break; - case 0x98: //98 CBW - if ((regs.byteregs[regal] & 0x80) == 0x80) regs.byteregs[regah] = 0xFF; else regs.byteregs[regah] = 0; - break; - case 0x99: //99 CWD - if ((regs.byteregs[regah] & 0x80) == 0x80) putreg16(regdx, 0xFFFF); else putreg16(regdx, 0); - break; - case 0x9A: //9A CALL Ap - oper1 = getmem16(segregs[regcs], ip); StepIP(2); - oper2 = getmem16(segregs[regcs], ip); StepIP(2); - push(segregs[regcs]); push(ip); ip = oper1; segregs[regcs] = oper2; - break; - case 0x9B: //9B WAIT - break; - case 0x9C: //9C PUSHF - push(makeflagsword() | 0xF800); - break; - case 0x9D: //9D POPF - temp16 = pop(); - decodeflagsword(temp16); - break; - case 0x9E: //9E SAHF - decodeflagsword ((makeflagsword() & 0xFF00) | regs.byteregs[regah]); - break; - case 0x9F: //9F LAHF - regs.byteregs[regah] = makeflagsword() & 0xFF; - break; - case 0xA0: //A0 MOV regs.byteregs[regal] Ob - regs.byteregs[regal] = getmem8(useseg, getmem16(segregs[regcs], ip)); StepIP(2); - break; - case 0xA1: //A1 MOV eAX Ov - oper1 = getmem16(useseg, getmem16(segregs[regcs], ip)); StepIP(2); - putreg16(regax, oper1); - break; - case 0xA2: //A2 MOV Ob regs.byteregs[regal] - putmem8(useseg, getmem16(segregs[regcs], ip), regs.byteregs[regal]); StepIP(2); - break; - case 0xA3: //A3 MOV Ov eAX - putmem16(useseg, getmem16(segregs[regcs], ip), getreg16(regax)); StepIP(2); - break; - case 0xA4: //A4 MOVSB - if (reptype && (getreg16(regcx) == 0)) break; - putmem8(segregs[reges], getreg16(regdi), getmem8(useseg, getreg16(regsi))); - if (df) { - putreg16(regsi, getreg16(regsi) - 1); - putreg16(regdi, getreg16(regdi) - 1); - } - else { - putreg16(regsi, getreg16(regsi) + 1); - putreg16(regdi, getreg16(regdi) + 1); - } - if (reptype) putreg16(regcx, getreg16(regcx) - 1); - if (!reptype) break; - ip = firstip; - break; - case 0xA5: //A5 MOVSW - if (reptype && (getreg16(regcx) == 0)) break; - putmem16(segregs[reges], getreg16(regdi), getmem16(useseg, getreg16(regsi))); - if (df) { - putreg16(regsi, getreg16(regsi) - 2); - putreg16(regdi, getreg16(regdi) - 2); - } - else { - putreg16(regsi, getreg16(regsi) + 2); - putreg16(regdi, getreg16(regdi) + 2); - } - if (reptype) putreg16(regcx, getreg16(regcx) - 1); - if (!reptype) break; - ip = firstip; - break; - case 0xA6: //A6 CMPSB - if (reptype && (getreg16(regcx) == 0)) break; - oper1b = getmem8(useseg, getreg16(regsi)); oper2b = getmem8(segregs[reges], getreg16(regdi)); - if (df) { - putreg16(regsi, getreg16(regsi) - 1); - putreg16(regdi, getreg16(regdi) - 1); - } - else { - putreg16(regsi, getreg16(regsi) + 1); - putreg16(regdi, getreg16(regdi) + 1); - } - flag_sub8(oper1b, oper2b); - if (reptype) putreg16(regcx, getreg16(regcx) - 1); - if ((reptype == 1) && !zf) break; - else if ((reptype == 2) && (zf == 1)) break; - if (!reptype) break; - ip = firstip; - break; - case 0xA7: //A7 CMPSW - if (reptype && (getreg16(regcx) == 0)) break; - oper1 = getmem16(useseg, getreg16(regsi)); oper2 = getmem16(segregs[reges], getreg16(regdi)); - if (df) { - putreg16(regsi, getreg16(regsi) - 2); - putreg16(regdi, getreg16(regdi) - 2); - } - else { - putreg16(regsi, getreg16(regsi) + 2); - putreg16(regdi, getreg16(regdi) + 2); - } - flag_sub16(oper1, oper2); - if (reptype) putreg16(regcx, getreg16(regcx) - 1); - if ((reptype == 1) && !zf) break; - if ((reptype == 2) && (zf == 1)) break; - if (!reptype) break; - ip = firstip; - break; - case 0xA8: //A8 TEST regs.byteregs[regal] Ib - oper1b = regs.byteregs[regal]; oper2b = getmem8(segregs[regcs], ip); StepIP(1); - flag_log8(oper1b & oper2b); - break; - case 0xA9: //A9 TEST eAX Iv - oper1 = getreg16(regax); oper2 = getmem16(segregs[regcs], ip); StepIP(2); - flag_log16(oper1 & oper2); - break; - case 0xAA: //AA STOSB - if (reptype && (getreg16(regcx) == 0)) break; - putmem8(segregs[reges], getreg16(regdi), regs.byteregs[regal]); - if (df) putreg16(regdi, getreg16(regdi) - 1); - else putreg16(regdi, getreg16(regdi) + 1); - if (reptype) putreg16(regcx, getreg16(regcx) - 1); - if (!reptype) break; - ip = firstip; - break; - case 0xAB: //AB STOSW - if (reptype && (getreg16(regcx) == 0)) break; - putmem16(segregs[reges], getreg16(regdi), getreg16(regax)); - if (df) putreg16(regdi, getreg16(regdi) - 2); - else putreg16(regdi, getreg16(regdi) + 2); - if (reptype) putreg16(regcx, getreg16(regcx) - 1); - if (!reptype) break; - ip = firstip; - break; - case 0xAC: //AC LODSB - if (reptype && (getreg16(regcx) == 0)) break; - regs.byteregs[regal] = getmem8(useseg, getreg16(regsi)); - if (df) putreg16(regsi, getreg16(regsi) - 1); - else putreg16(regsi, getreg16(regsi) + 1); - if (reptype) putreg16(regcx, getreg16(regcx) - 1); - if (!reptype) break; - ip = firstip; - break; - case 0xAD: //AD LODSW - if (reptype && (getreg16(regcx) == 0)) break; - oper1 = getmem16(useseg, getreg16(regsi)); - putreg16(regax, oper1); - if (df) putreg16(regsi, getreg16(regsi) - 2); - else putreg16(regsi, getreg16(regsi) + 2); - if (reptype) putreg16(regcx, getreg16(regcx) - 1); - if (!reptype) break; - ip = firstip; - break; - case 0xAE: //AE SCASB - if (reptype && (getreg16(regcx) == 0)) break; - oper1b = getmem8(segregs[reges], getreg16(regdi)); oper2b = regs.byteregs[regal]; - flag_sub8(oper1b, oper2b); - if (df) putreg16(regdi, getreg16(regdi) - 1); - else putreg16(regdi, getreg16(regdi) + 1); - if (reptype) putreg16(regcx, getreg16(regcx) - 1); - if ((reptype == 1) && !zf) break; - else if ((reptype == 2) && (zf == 1)) break; - if (!reptype) break; - ip = firstip; - break; - case 0xAF: //AF SCASW - if (reptype && (getreg16(regcx) == 0)) break; - oper1 = getmem16(segregs[reges], getreg16(regdi)); oper2 = getreg16(regax); - flag_sub16(oper1, oper2); - if (df) putreg16(regdi, getreg16(regdi) - 2); - else putreg16(regdi, getreg16(regdi) + 2); - if (reptype) putreg16(regcx, getreg16(regcx) - 1); - if ((reptype == 1) && !zf) break; - else if ((reptype == 2) & (zf == 1)) break; - if (!reptype) break; - ip = firstip; - break; - case 0xB0: //B0 MOV regs.byteregs[regal] Ib - regs.byteregs[regal] = getmem8(segregs[regcs], ip); StepIP(1); - break; - case 0xB1: //B1 MOV regs.byteregs[regcl] Ib - regs.byteregs[regcl] = getmem8(segregs[regcs], ip); StepIP(1); - break; - case 0xB2: //B2 MOV regs.byteregs[regdl] Ib - regs.byteregs[regdl] = getmem8(segregs[regcs], ip); StepIP(1); - break; - case 0xB3: //B3 MOV regs.byteregs[regbl] Ib - regs.byteregs[regbl] = getmem8(segregs[regcs], ip); StepIP(1); - break; - case 0xB4: //B4 MOV regs.byteregs[regah] Ib - regs.byteregs[regah] = getmem8(segregs[regcs], ip); StepIP(1); - break; - case 0xB5: //B5 MOV regs.byteregs[regch] Ib - regs.byteregs[regch] = getmem8(segregs[regcs], ip); StepIP(1); - break; - case 0xB6: //B6 MOV regs.byteregs[regdh] Ib - regs.byteregs[regdh] = getmem8(segregs[regcs], ip); StepIP(1); - break; - case 0xB7: //B7 MOV regs.byteregs[regbh] Ib - regs.byteregs[regbh] = getmem8(segregs[regcs], ip); StepIP(1); - break; - case 0xB8: //B8 MOV eAX Iv - oper1 = getmem16(segregs[regcs], ip); StepIP(2); - putreg16(regax, oper1); - break; - case 0xB9: //B9 MOV eCX Iv - oper1 = getmem16(segregs[regcs], ip); StepIP(2); - putreg16(regcx, oper1); - break; - case 0xBA: //BA MOV eDX Iv - oper1 = getmem16(segregs[regcs], ip); StepIP(2); - putreg16(regdx, oper1); - break; - case 0xBB: //BB MOV eBX Iv - oper1 = getmem16(segregs[regcs], ip); StepIP(2); - putreg16(regbx, oper1); - break; - case 0xBC: //BC MOV eSP Iv - putreg16(regsp, getmem16(segregs[regcs], ip)); StepIP(2); - break; - case 0xBD: //BD MOV eBP Iv - putreg16(regbp, getmem16(segregs[regcs], ip)); StepIP(2); - break; - case 0xBE: //BE MOV eSI Iv - putreg16(regsi, getmem16(segregs[regcs], ip)); StepIP(2); - break; - case 0xBF: //BF MOV eDI Iv - putreg16(regdi, getmem16(segregs[regcs], ip)); StepIP(2); - break; - case 0xC0: //C0 GRP2 byte imm8 (80186+) - modregrm(); - oper1b = readrm8(rm); - oper2b = getmem8(segregs[regcs], ip); StepIP(1); - writerm8(rm, op_grp2_8(oper2b)); - break; - case 0xC1: //C1 GRP2 word imm8 (80186+) - modregrm(); - oper1 = readrm16(rm); - oper2 = getmem8(segregs[regcs], ip); StepIP(1); - writerm16(rm, op_grp2_16(oper2)); - break; - case 0xC2: //C2 RET Iw - oper1 = getmem16(segregs[regcs], ip); - ip = pop(); - putreg16(regsp, getreg16(regsp) + oper1); - break; - case 0xC3: //C3 RET - ip = pop(); - break; - case 0xC4: //C4 LES Gv Mp - modregrm(); - //getea(rm); - putreg16(reg, read86(ea) + ((uint16_t)read86(ea + 1) << 8)); - segregs[reges] = read86(ea + 2) + ((uint16_t)read86(ea + 3) << 8); - break; - case 0xC5: //C5 LDS Gv Mp - modregrm(); - //getea(rm); - putreg16(reg, read86(ea) + ((uint16_t)read86(ea + 1) << 8)); - segregs[regds] = read86(ea + 2) + ((uint16_t)read86(ea + 3) << 8); - break; - case 0xC6: //C6 MOV Eb Ib - modregrm(); - writerm8(rm, getmem8(segregs[regcs], ip)); StepIP(1); - break; - case 0xC7: //C7 MOV Ev Iv - modregrm(); - writerm16(rm, getmem16(segregs[regcs], ip)); StepIP(2); - break; - case 0xC8: //C8 ENTER (80186+) - stacksize = getmem16(segregs[regcs], ip); StepIP(2); - nestlev = getmem8(segregs[regcs], ip); StepIP(1); - push(getreg16(regbp)); - frametemp = getreg16(regsp); - if (nestlev) { - for (temp16 = 1; temp16 < nestlev; temp16++) { - putreg16(regbp, getreg16(regbp) - 2); - push(getreg16(regbp)); - } - push(getreg16(regsp)); - } - putreg16(regbp, frametemp); - putreg16(regsp, getreg16(regbp) - stacksize); - - break; - case 0xC9: //C9 LEAVE (80186+) - putreg16(regsp, getreg16(regbp)); - putreg16(regbp, pop()); - - break; - case 0xCA: //CA RETF Iw - oper1 = getmem16(segregs[regcs], ip); - ip = pop(); segregs[regcs] = pop(); - putreg16(regsp, getreg16(regsp) + oper1); - break; - case 0xCB: //CB RETF - ip = pop();; segregs[regcs] = pop(); - break; - case 0xCC: //CC INT 3 - intcall86(3); - break; - case 0xCD: //CD INT Ib - oper1 = getmem8(segregs[regcs], ip); StepIP(1); - intcall86(oper1); - break; - case 0xCE: //CE INTO - if (of) intcall86(4); - break; - case 0xCF: //CF IRET - ip = pop(); segregs[regcs] = pop(); - decodeflagsword(pop()); - //if (net.enabled) net.canrecv = 1; - break; - case 0xD0: //D0 GRP2 Eb 1 - modregrm(); - oper1b = readrm8(rm); - writerm8(rm, op_grp2_8(1)); - break; - case 0xD1: //D1 GRP2 Ev 1 - modregrm(); - oper1 = readrm16(rm); - writerm16(rm, op_grp2_16(1)); - break; - case 0xD2: //D2 GRP2 Eb regs.byteregs[regcl] - modregrm(); - oper1b = readrm8(rm); - writerm8(rm, op_grp2_8(regs.byteregs[regcl])); - break; - case 0xD3: //D3 GRP2 Ev regs.byteregs[regcl] - modregrm(); - oper1 = readrm16(rm); - writerm16(rm, op_grp2_16(regs.byteregs[regcl])); - break; - case 0xD4: //D4 AAM I0 - oper1 = getmem8(segregs[regcs], ip); StepIP(1); - if (!oper1) { - intcall86(0); //division by zero - return; - } - regs.byteregs[regah] = (regs.byteregs[regal] / oper1) & 255; - regs.byteregs[regal] = (regs.byteregs[regal] % oper1) & 255; - flag_szp16 (getreg16(regax)); - break; - case 0xD5: //D5 AAD I0 - oper1 = getmem8(segregs[regcs], ip); StepIP(1); - regs.byteregs[regal] = (regs.byteregs[regah] * oper1 + regs.byteregs[regal]) & 255; - regs.byteregs[regah] = 0; - flag_szp16(regs.byteregs[regah] * oper1 + regs.byteregs[regal]); - sf = 0; - break; - case 0xD6: //D6 XLAT on V20/V30, SALC on 8086/8088 - regs.byteregs[regal] = cf; - break; - case 0xD7: //D7 XLAT - putreg8(regal, read86(segbase(useseg) + (uint32_t)getreg16(regbx) + (uint32_t)getreg8(regal))); - break; - case 0xD8: case 0xD9: case 0xDA: case 0xDB: case 0xDC: case 0xDE: case 0xDD: case 0xDF: //escape - StepIP(1); - break; - case 0xE0: //E0 LOOPNZ Jb - temp16 = signext(getmem8(segregs[regcs], ip)); StepIP(1); - putreg16(regcx, getreg16(regcx) - 1); - if ((getreg16(regcx)) && !zf) ip = ip + temp16; - break; - case 0xE1: //E1 LOOPZ Jb - temp16 = signext(getmem8(segregs[regcs], ip)); StepIP(1); - putreg16(regcx, (getreg16(regcx)) - 1); - if ((getreg16(regcx)) && (zf == 1)) ip = ip + temp16; - break; - case 0xE2: //E2 LOOP Jb - temp16 = signext(getmem8(segregs[regcs], ip)); StepIP(1); - putreg16(regcx, (getreg16(regcx)) - 1); - if (getreg16(regcx)) ip = ip + temp16; - break; - case 0xE3: //E3 JCXZ Jb - temp16 = signext(getmem8(segregs[regcs], ip)); StepIP(1); - if (!(getreg16(regcx))) ip = ip + temp16; - break; - case 0xE4: //E4 IN regs.byteregs[regal] Ib - oper1b = getmem8(segregs[regcs], ip); - StepIP(1); - regs.byteregs[regal] = portin(oper1b); - break; - case 0xE5: //E5 IN eAX Ib - oper1b = getmem8(segregs[regcs], ip); - StepIP(1); - putreg16(regax, portin(oper1b)); - break; - case 0xE6: //E6 OUT Ib regs.byteregs[regal] - oper1b = getmem8(segregs[regcs], ip); - StepIP(1); - portout16 = 0; - portout(oper1b, regs.byteregs[regal]); - break; - case 0xE7: //E7 OUT Ib eAX - oper1b = getmem8(segregs[regcs], ip); - StepIP(1); - portout16 = 1; - portout(oper1b, (getreg16(regax))); - break; - case 0xE8: //E8 CALL Jv - oper1 = getmem16(segregs[regcs], ip); StepIP(2); - push(ip); - ip = ip + oper1; - break; - case 0xE9: //E9 JMP Jv - oper1 = getmem16(segregs[regcs], ip); StepIP(2); - ip = ip + oper1; - break; - case 0xEA: //EA JMP Ap - oper1 = getmem16(segregs[regcs], ip); StepIP(2); - oper2 = getmem16(segregs[regcs], ip); - ip = oper1; segregs[regcs] = oper2; - break; - case 0xEB: //EB JMP Jb - oper1 = signext(getmem8(segregs[regcs], ip)); StepIP(1); - ip = ip + oper1; - break; - case 0xEC: //EC IN regs.byteregs[regal] regdx - oper1 = (getreg16(regdx)); - regs.byteregs[regal] = portin(oper1); - break; - case 0xED: //ED IN eAX regdx - oper1 = (getreg16(regdx)); - putreg16(regax, portin(oper1)); - break; - case 0xEE: //EE OUT regdx regs.byteregs[regal] - oper1 = (getreg16(regdx)); - portout16 = 0; - portout(oper1, regs.byteregs[regal]); - break; - case 0xEF: //EF OUT regdx eAX - oper1 = (getreg16(regdx)); - portout16 = 1; - portout(oper1, (getreg16(regax))); - break; - case 0xF0: //F0 LOCK - case 0xF4: //F4 HLT - break; - case 0xF5: //F5 CMC - if (!cf) cf = 1; else cf = 0; - break; - case 0xF6: //F6 GRP3a Eb - modregrm(); - oper1b = readrm8(rm); - op_grp3_8(); - if ((reg > 1) && (reg < 4)) writerm8(rm, res8); - - break; - case 0xF7: //F7 GRP3b Ev - modregrm(); - oper1 = readrm16(rm); - op_grp3_16(); - if ((reg > 1) && (reg < 4)) writerm16(rm, res16); - break; - case 0xF8: //F8 CLC - cf = 0; - break; - case 0xF9: //F9 STC - cf = 1; - break; - case 0xFA: //FA CLI - ifl = 0; - break; - case 0xFB: //FB STI - ifl = 1; - break; - case 0xFC: //FC CLD - df = 0; - break; - case 0xFD: //FD STD - df = 1; - break; - case 0xFE: //FE GRP4 Eb - modregrm(); - oper1b = readrm8(rm); oper2b = 1; - if (!reg) { - tempcf = cf; - res8 = oper1b + oper2b; - flag_add8(oper1b, oper2b); - cf = tempcf; writerm8(rm, res8); - } else { - tempcf = cf; - res8 = oper1b - oper2b; - flag_sub8(oper1b, oper2b); - cf = tempcf; writerm8(rm, res8); - } - break; - case 0xFF: //FF GRP5 Ev - modregrm(); - oper1 = readrm16(rm); - op_grp5(); - break; - default: - intcall86(6); //trip invalid opcode exception (this occurs on the 80186+, 8086/8088 CPUs treat them as NOPs - if (verbose) { - //if (opcode==0xF) sprintf(msg, "Illegal opcode: %02X @ %04X:%04X\n", opcode, savecs, saveip); - //else - //sprintf(msg, "Illegal opcode: %02X %02X @ %04X:%04X\n", opcode, getmem8(savecs, saveip + 1), savecs, saveip); - } - - break; - } -#ifdef PROFILING - endmicros = micros(); - if (instrtime[opcode]) { - instrtime[opcode] = (instrtime[opcode] + (endmicros - startmicros)) >> 1; - } else { - instrtime[opcode] = endmicros - startmicros; - } -#endif - //if (!running) return; - } -} - -void testmem() { - -} - diff --git a/MCUME_pico/pico8086/disk.cpp b/MCUME_pico/pico8086/disk.cpp deleted file mode 100644 index 3757199..0000000 --- a/MCUME_pico/pico8086/disk.cpp +++ /dev/null @@ -1,257 +0,0 @@ -#include -#include -#include "emu.h" -extern "C" { -#include "emuapi.h" -} -extern uint8_t bootdrive, hdcount; -extern uint16_t segregs[6]; -extern uint8_t cf; -extern _bytewordregs_ regs; - -int file; - -struct struct_drive { - uint32_t filesize; - uint16_t cyls; - uint16_t sects; - uint16_t heads; - uint8_t inserted; -} disk[4]; -uint8_t sectorbuffer[512]; - -uint8_t insertdisk(uint8_t drivenum) { - if (drivenum & 0x80) { - drivenum -= 126; - disk[drivenum].sects = 63; - disk[drivenum].heads = 16; - disk[drivenum].cyls = 1023; //up to 512 MB - hdcount = 1; - } else { -#ifdef FDD_144M - disk[drivenum].cyls = 80; - disk[drivenum].sects = 18; - disk[drivenum].heads = 2; -#endif -#ifdef FDD_122M - disk[drivenum].cyls = 80; - disk[drivenum].sects = 15; - disk[drivenum].heads = 2; -#endif -#ifdef FDD_720K - disk[drivenum].cyls = 80; - disk[drivenum].sects = 9; - disk[drivenum].heads = 2; -#endif -#ifdef FDD_360K - disk[drivenum].cyls = 40; - disk[drivenum].sects = 9; - disk[drivenum].heads = 2; -#endif -#ifdef FDD_320K - disk[drivenum].cyls = 40; - disk[drivenum].sects = 8; - disk[drivenum].heads = 2; -#endif -#ifdef FDD_180K - disk[drivenum].cyls = 40; - disk[drivenum].sects = 9; - disk[drivenum].heads = 1; -#endif - } - disk[drivenum].inserted = 1; - return 0; -} - -void ejectdisk(uint8_t drivenum) { - if (drivenum & 0x80) drivenum -= 126; - disk[drivenum].inserted = 0; -} - -extern uint16_t ramseg; -extern "C" { -extern void emu_SdReadBlock(int block, void * buf); -} -uint8_t sectdone; -void getsect(uint32_t lba, uint8_t *dst) { -#ifdef USB_DISK - uint8_t chksum; - uint32_t curmicros; -retrysectget: - Serial.write(0xFF); - Serial.write(0x05); - outByte(lba & 0xFF); chksum = lba & 0xFF; - outByte((lba >> 8) & 0xFF); chksum += (lba >> 8) & 0xFF; - outByte((lba >> 16) & 0xFF); chksum += (lba >> 16) & 0xFF; - outByte((lba >> 24) & 0xFF); chksum += (lba >> 24) & 0xFF; - outByte(chksum); - Serial.write(0xFE); - Serial.write(0x02); - sectdone = 0; - curmicros = micros(); - while (!sectdone) { - if (micros() < curmicros) curmicros = micros(); - if ((micros() - curmicros) >= 200000) goto retrysectget; - net_loop(); - } -#else - if (file) - { - //printf("read block %d\n",lba); - emu_FileSeek(lba*512); - emu_FileRead((char *)dst,1*512); - } -#endif -} - -void putsect(uint32_t lba, uint8_t *src) { -#ifdef USB_DISK - uint8_t chksum; - uint16_t i; - uint32_t curmicros; -retrysectput: - Serial.write(0xFF); - Serial.write(0x06); - outByte(lba & 0xFF); chksum = lba & 0xFF; - outByte((lba >> 8) & 0xFF); chksum += (lba >> 8) & 0xFF; - outByte((lba >> 16) & 0xFF); chksum += (lba >> 16) & 0xFF; - outByte((lba >> 24) & 0xFF); chksum += (lba >> 24) & 0xFF; - for (i=0; i<512; i++) { - outByte(src[i]); - chksum += src[i]; - } - outByte(chksum); - Serial.write(0xFE); - Serial.write(0x02); - sectdone = 0; - curmicros = micros(); - while (!sectdone) { - if (micros() < curmicros) curmicros = micros(); - if ((micros() - curmicros) >= 200000) goto retrysectput; - net_loop(); - } -#else - //card.writeBlock(lba, src); -#endif -} -void readdisk(uint8_t drivenum, uint16_t dstseg, uint16_t dstoff, uint16_t cyl, uint16_t sect, uint16_t head, uint16_t sectcount) { - uint32_t memdest, goodsects, dummy, lba; - if ((sect == 0) || !disk[drivenum].inserted) return; -#ifdef MEGA - SPI.setClockDivider(SPI_CLOCK_SDCARD); -#endif - lba = ((long)cyl * (long)disk[drivenum].heads + (long)head) * (long)disk[drivenum].sects + (long)sect - 1; - memdest = (uint32_t)dstseg * 16 + (uint32_t)dstoff; - for (goodsects = 0; goodsects < sectcount; goodsects++) { - getsect(lba, sectorbuffer); - memdest = (uint32_t)dstseg * 16 + (uint32_t)dstoff; - for (dummy = 0; dummy < 512; dummy++) { - write86(memdest++, sectorbuffer[dummy]); - //Serial.write(sectorbuffer[dummy]); - } - dstoff += 512; - lba++; - } - cf = 0; regs.byteregs[regah] = 0; regs.byteregs[regal] = sectcount; -#ifdef MEGA - SPI.setClockDivider(SPI_CLOCK_SPIRAM); -#endif -} - -void writedisk(uint8_t drivenum, uint16_t dstseg, uint16_t dstoff, uint16_t cyl, uint16_t sect, uint16_t head, uint16_t sectcount) { - uint32_t memdest, goodsects, dummy, lba; - if ((sect == 0) || !disk[drivenum].inserted) return; -#ifdef MEGA - SPI.setClockDivider(SPI_CLOCK_SDCARD); -#endif - lba = ((long)cyl * (long)disk[drivenum].heads + (long)head) * (long)disk[drivenum].sects + (long)sect - 1; - for (goodsects = 0; goodsects < sectcount; goodsects++) { - memdest = (uint32_t)dstseg * 16 + (uint32_t)dstoff; - for (dummy = 0; dummy < 512; dummy++) { - sectorbuffer[dummy] = read86(memdest++); - } - //card.erase(lba, lba); - putsect(lba, sectorbuffer); - dstoff += 512; - lba++; - } - cf = 0; regs.byteregs[regah] = 0; regs.byteregs[regal] = sectcount; -#ifdef MEGA - SPI.setClockDivider(SPI_CLOCK_SPIRAM); -#endif -} - -void diskhandler() { - static uint8_t lastdiskah[4], lastdiskcf[4]; - uint8_t drivenum; - drivenum = regs.byteregs[regdl]; - if (drivenum & 0x80) drivenum -= 126; - switch (regs.byteregs[regah]) { - case 0: //reset disk system - regs.byteregs[regah] = 0; cf = 0; //useless function in an emulator. say success and return. - break; - case 1: //return last status - regs.byteregs[regah] = lastdiskah[drivenum]; - cf = lastdiskcf[drivenum]; - return; - case 2: //read sector(s) into memory - if (disk[drivenum].inserted) { - readdisk(drivenum, segregs[reges], getreg16(regbx), (uint16_t)regs.byteregs[regch] + ((uint16_t)regs.byteregs[regcl] / 64) * 256, regs.byteregs[regcl] & 63, regs.byteregs[regdh], regs.byteregs[regal]); - cf = 0; regs.byteregs[regah] = 0; - } else { - cf = 1; - regs.byteregs[regah] = 1; - } - break; - case 3: //write sector(s) from memory - if (disk[drivenum].inserted) { - writedisk(drivenum, segregs[reges], getreg16(regbx), regs.byteregs[regch] + (regs.byteregs[regcl] / 64) * 256, regs.byteregs[regcl] & 63, regs.byteregs[regdh], regs.byteregs[regal]); - cf = 0; regs.byteregs[regah] = 0; - } else { - cf = 1; - regs.byteregs[regah] = 1; - } - break; - case 4: - case 5: //format track - cf = 0; regs.byteregs[regah] = 0; - break; - case 8: //get drive parameters - if (disk[drivenum].inserted) { - cf = 0; regs.byteregs[regah] = 0; - regs.byteregs[regch] = disk[drivenum].cyls - 1; - regs.byteregs[regcl] = disk[drivenum].sects & 63; - regs.byteregs[regcl] = regs.byteregs[regcl] + (disk[drivenum].cyls / 256) * 64; - regs.byteregs[regdh] = disk[drivenum].heads - 1; - //segregs[reges] = 0; regs.wordregs[regdi] = 0x7C0B; //floppy parameter table - if (drivenum < 2) { - regs.byteregs[regbl] = 4; //else regs.byteregs[regbl] = 0; - regs.byteregs[regdl] = 2; - } else regs.byteregs[regdl] = hdcount; - } else { - cf = 1; regs.byteregs[regah] = 0xAA; - } - break; - default: - cf = 1; - } - lastdiskah[drivenum] = regs.byteregs[regah]; - lastdiskcf[drivenum] = cf; - if (regs.byteregs[regdl] & 0x80) write86(0x474, regs.byteregs[regah]); -} - -void initDisk(char * filename) { - int len=emu_FileSize(filename); - file = emu_FileOpen(filename); - if (len) { - bootdrive = 0x80; - insertdisk(0x80); - hdcount = 1; - } - else { - bootdrive = 0xFF; - emu_FileClose(); - file = NULL; - } -} - diff --git a/MCUME_pico/pico8086/emu.h b/MCUME_pico/pico8086/emu.h deleted file mode 100644 index 18e3738..0000000 --- a/MCUME_pico/pico8086/emu.h +++ /dev/null @@ -1,159 +0,0 @@ -//Uncomment MEGA define if using a Mega 2560, otherwise leave undefined if using a Teensy 3.6 -//#define MEGA - -extern "C" { -#include "iopins.h" -#include "emuapi.h" -} - -#define NATIVE_RAM (0x20000) // 128k total -#define NATIVE_START 0UL -#ifdef HAS_PSRAM -#define RAM_SIZE (0xA0000) // 640k total -#else -#define RAM_SIZE (0x24000) // 128+16k total -#endif - - -#define ROM_READ(a,b) a[b] - - -//#define INCLUDE_ROM_BASIC - - -//#define BOOT_FDD -#define BOOT_HDD -//#define BOOT_BASIC - -//#define FDD_180K -//#define FDD_320K -//#define FDD_360K -//#define FDD_720K -//#define FDD_122M -//#define FDD_144M - - -#define BAUD_RATE 1000000 - -//#define USE_NETWORKING -//#define USE_PARALLEL - -//#define PROFILING - -// END ARDUINO86 USER CONFIGURABLE OPTIONS - -#define regax 0 -#define regcx 1 -#define regdx 2 -#define regbx 3 -#define regsp 4 -#define regbp 5 -#define regsi 6 -#define regdi 7 -#define reges 0 -#define regcs 1 -#define regss 2 -#define regds 3 - -#define regal 0 -#define regah 1 -#define regcl 2 -#define regch 3 -#define regdl 4 -#define regdh 5 -#define regbl 6 -#define regbh 7 - -#define StepIP(x) ip+=x -#define getmem8(x,y) read86(segbase(x)+(uint32_t)y) -//#define getmem16(x,y) (read86(segbase(x)+y) | ((uint16_t)read86(segbase(x)+y+1)<<8)) -#define getmem16(x,y) readw86(segbase(x)+(uint32_t)y) -#define putmem8(x,y,z) write86(segbase(x)+(uint32_t)y, z) -//#define putmem16(x,y,z) write86(segbase(x)+y, ((z)&0xFF)); write86(segbase(x)+y+1, (((z)>>8)&0xFF)) -#define putmem16(x,y,z) writew86(segbase(x)+(uint32_t)y, z) -#define signext(value) ((((uint16_t)value&0x80)*0x1FE)|(uint16_t)value) -#define signext32(value) ((((uint32_t)value&0x8000)*0x1FFFE)|(uint32_t)value) -#define getreg16(regid) regs.wordregs[regid] -#define getreg8(regid) regs.byteregs[byteregtable[regid]] -#define putreg16(regid, writeval) regs.wordregs[regid] = writeval -#define putreg8(regid, writeval) regs.byteregs[byteregtable[regid]] = writeval -#define getsegreg(regid) segregs[regid] -#define putsegreg(regid, writeval) segregs[regid] = writeval -#define segbase(x) ((uint32_t)x<<4) - -#define makeflagsword() (2 | (uint16_t)cf | ((uint16_t)pf << 2) | ((uint16_t)af << 4) | ((uint16_t)zf << 6) \ - | ((uint16_t)sf << 7) | ((uint16_t)tf << 8) | ((uint16_t)ifl << 9) | ((uint16_t)df << 10) | ((uint16_t)of << 11)) - -#define decodeflagsword(x) {\ - temp16 = x;\ - cf = temp16 & 1;\ - pf = (temp16 >> 2) & 1;\ - af = (temp16 >> 4) & 1;\ - zf = (temp16 >> 6) & 1;\ - sf = (temp16 >> 7) & 1;\ - tf = (temp16 >> 8) & 1;\ - ifl = (temp16 >> 9) & 1;\ - df = (temp16 >> 10) & 1;\ - of = (temp16 >> 11) & 1;\ -} - - - -//#define RAM_write(a,v) { -//} - -//#define RAM_read(a,v) { -//} - - -void setup_memory(); -void setup_timer(); -uint8_t insertdisk(uint8_t drivenum); -void reset86(); -void exec86(uint32_t execloops); -uint8_t read86(uint32_t addr32); -void write86(uint32_t addr32, uint8_t value); -void doirq(uint8_t irqnum); -void incsends(); -void init_display(); -void write_video(uint16_t addr); -void clear_display(); -void palettereset(); -void display_CSIP(); -void ps2poll(); -void setup_ps2(uint8_t data_pin, uint8_t irq_pin); -void video_init(); -uint8_t VRAM_read(uint32_t addr32); -void VRAM_write(uint32_t addr32, uint8_t value); -void setup_ps2(uint8_t data_pin, uint8_t irq_pin); -void ps2poll(); -void out8253 (uint16_t portnum, uint8_t value); -uint8_t in8253 (uint16_t portnum); -void init8259(); -void out8259(uint16_t portnum, uint8_t value); -uint8_t in8259(uint16_t portnum); - -extern uint8_t port3da; - -void initDisk(char * filename); -void init8253(); -void net_init(); -void net_loop(); -void net_handler(); -uint8_t cached_read(uint32_t addr32); -void cached_write(uint32_t addr32, uint8_t value); -void cache_init(); - -uint8_t net_read_ram(uint32_t addr32); -void diskhandler(); - -//extern uint8_t SPI_RAM_pins[8]; -extern uint8_t net_mac[6]; -extern uint8_t bufSerial[1600]; -void outByte(uint8_t cc); - -extern struct i8253_s i8253; -union _bytewordregs_{ - uint16_t wordregs[8]; - uint8_t byteregs[8]; -} ; diff --git a/MCUME_pico/pico8086/emuapi.cpp b/MCUME_pico/pico8086/emuapi.cpp deleted file mode 100644 index 122a71e..0000000 --- a/MCUME_pico/pico8086/emuapi.cpp +++ /dev/null @@ -1,1278 +0,0 @@ -#define KEYMAP_PRESENT 1 - -#define PROGMEM - -#include "pico.h" -#include "pico/stdlib.h" -#include "hardware/adc.h" -#include -#include - -extern "C" { - #include "emuapi.h" - #include "iopins.h" -} - -#if (defined(ILI9341) || defined(ST7789)) && defined(USE_VGA) -// Dual display config, initialize TFT -#include "tft_t_dma.h" -static TFT_T_DMA tft; -#else -// Non Dual display config -#ifdef USE_VGA -#include "vga_t_dma.h" -#else -#include "tft_t_dma.h" -#endif -extern TFT_T_DMA tft; -#endif - - -#define MAX_FILES 64 -#define MAX_FILENAME_SIZE 24 -#define MAX_MENULINES 9 -#define TEXT_HEIGHT 16 -#define TEXT_WIDTH 8 -#define MENU_FILE_XOFFSET (6*TEXT_WIDTH) -#define MENU_FILE_YOFFSET (2*TEXT_HEIGHT) -#define MENU_FILE_W (MAX_FILENAME_SIZE*TEXT_WIDTH) -#define MENU_FILE_H (MAX_MENULINES*TEXT_HEIGHT) -#define MENU_FILE_BGCOLOR RGBVAL16(0x00,0x00,0x40) -#define MENU_JOYS_YOFFSET (12*TEXT_HEIGHT) -#define MENU_VBAR_XOFFSET (0*TEXT_WIDTH) -#define MENU_VBAR_YOFFSET (MENU_FILE_YOFFSET) - -#define MENU_TFT_XOFFSET (MENU_FILE_XOFFSET+MENU_FILE_W+8) -#define MENU_TFT_YOFFSET (MENU_VBAR_YOFFSET+32) -#define MENU_VGA_XOFFSET (MENU_FILE_XOFFSET+MENU_FILE_W+8) -#define MENU_VGA_YOFFSET (MENU_VBAR_YOFFSET+MENU_FILE_H-32-37) - - - -static char romspath[64]; -static int nbFiles=0; -static int curFile=0; -static int topFile=0; -static char selection[MAX_FILENAME_SIZE+1]=""; -static char files[MAX_FILES][MAX_FILENAME_SIZE]; -static bool menuRedraw=true; - -#ifdef PICOMPUTER -static const unsigned short * keys; -static unsigned char keymatrix[6]; -static int keymatrix_hitrow=-1; -static bool key_fn=false; -static bool key_alt=false; -static uint32_t keypress_t_ms=0; -static uint32_t last_t_ms=0; -static uint32_t hundred_ms_cnt=0; -static bool ledflash_toggle=false; -#endif -static int keyMap; - -static bool joySwapped = false; -static uint16_t bLastState; -static int xRef; -static int yRef; -static uint8_t usbnavpad=0; - -static bool menuOn=true; - - - -/******************************** - * Generic output and malloc -********************************/ -void emu_printf(char * text) -{ - printf("%s\n",text); -} - -void emu_printf(int val) -{ - printf("%d\n",val); -} - -void emu_printi(int val) -{ - printf("%d\n",val); -} - -void emu_printh(int val) -{ - printf("0x%.8\n",val); -} - -static int malbufpt = 0; -static char malbuf[EXTRA_HEAP]; - -void * emu_Malloc(int size) -{ - void * retval = malloc(size); - if (!retval) { - emu_printf("failled to allocate"); - emu_printf(size); - emu_printf("fallback"); - if ( (malbufpt+size) < sizeof(malbuf) ) { - retval = (void *)&malbuf[malbufpt]; - malbufpt += size; - } - else { - emu_printf("failure to allocate"); - } - } - else { - emu_printf("could allocate dynamic "); - emu_printf(size); - } - - return retval; -} - -void * emu_MallocI(int size) -{ - void * retval = NULL; - - if ( (malbufpt+size) < sizeof(malbuf) ) { - retval = (void *)&malbuf[malbufpt]; - malbufpt += size; - emu_printf("could allocate static "); - emu_printf(size); - } - else { - emu_printf("failure to allocate"); - } - - return retval; -} -void emu_Free(void * pt) -{ - free(pt); -} - -void emu_drawText(unsigned short x, unsigned short y, const char * text, unsigned short fgcolor, unsigned short bgcolor, int doublesize) -{ - tft.drawText(x, y, text, fgcolor, bgcolor, doublesize?true:false); -} - - -/******************************** - * OSKB handling -********************************/ -#if (defined(ILI9341) || defined(ST7789)) && defined(USE_VGA) -// On screen keyboard position -#define KXOFF 28 //64 -#define KYOFF 96 -#define KWIDTH 11 //22 -#define KHEIGHT 3 - -static bool oskbOn = false; -static int cxpos = 0; -static int cypos = 0; -static int oskbMap = 0; -static uint16_t oskbBLastState = 0; - -static void lineOSKB2(int kxoff, int kyoff, char * str, int row) -{ - char c[2] = {'A',0}; - const char * cpt = str; - for (int i=0; i.,SP ", 2); - if (oskbMap == 0) { - lineOSKB(KXOFF,KYOFF, keylables_map1_0, 0); - lineOSKB(KXOFF,KYOFF, keylables_map1_1, 1); - lineOSKB(KXOFF,KYOFF, keylables_map1_2, 2); - } - else if (oskbMap == 1) { - lineOSKB(KXOFF,KYOFF, keylables_map2_0, 0); - lineOSKB(KXOFF,KYOFF, keylables_map2_1, 1); - lineOSKB(KXOFF,KYOFF, keylables_map2_2, 2); - } - else { - lineOSKB(KXOFF,KYOFF, keylables_map3_0, 0); - lineOSKB(KXOFF,KYOFF, keylables_map3_1, 1); - lineOSKB(KXOFF,KYOFF, keylables_map3_2, 2); - } -} - -void toggleOskb(bool forceoff) { - if (forceoff) oskbOn=true; - if (oskbOn) { - oskbOn = false; - tft.fillScreenNoDma(RGBVAL16(0x00,0x00,0x00)); - tft.drawTextNoDma(0,32, "Press USER2 to toggle onscreen keyboard.", RGBVAL16(0xff,0xff,0xff), RGBVAL16(0x00,0x00,0x00), true); - } else { - oskbOn = true; - tft.fillScreenNoDma(RGBVAL16(0x00,0x00,0x00)); - tft.drawTextNoDma(0,32, " Press USER2 to exit onscreen keyboard. ", RGBVAL16(0xff,0xff,0xff), RGBVAL16(0x00,0x00,0x00), true); - tft.drawTextNoDma(0,64, " (USER1 to toggle between keymaps) ", RGBVAL16(0x00,0xff,0xff), RGBVAL16(0x00,0x00,0xff), true); - tft.drawRectNoDma(KXOFF,KYOFF, 22*8, 3*16, RGBVAL16(0x00,0x00,0xFF)); - drawOskb(); - } -} - -static int handleOskb(void) -{ - int retval = 0; - - uint16_t bClick = bLastState & ~oskbBLastState; - oskbBLastState = bLastState; - /* - static const char * digits = "0123456789ABCDEF"; - char buf[5] = {0,0,0,0,0}; - int val = bClick; - buf[0] = digits[(val>>12)&0xf]; - buf[1] = digits[(val>>8)&0xf]; - buf[2] = digits[(val>>4)&0xf]; - buf[3] = digits[val&0xf]; - tft.drawTextNoDma(0,KYOFF+ 64,buf,RGBVAL16(0x00,0x00,0x00),RGBVAL16(0xFF,0xFF,0xFF),1); - */ - if (bClick & MASK_KEY_USER2) - { - toggleOskb(false); - } - if (oskbOn) - { - bool updated = true; - if (bClick & MASK_KEY_USER1) - { - oskbMap += 1; - if (oskbMap == 3) oskbMap = 0; - } - else if (bClick & MASK_JOY2_LEFT) - { - cxpos++; - if (cxpos >= KWIDTH) cxpos = 0; - } - else if (bClick & MASK_JOY2_RIGHT) - { - cxpos--; - if (cxpos < 0) cxpos = KWIDTH-1; - } - else if (bClick & MASK_JOY2_DOWN) - { - cypos++; - if (cypos >= KHEIGHT) cypos = 0; - } - else if (bClick & MASK_JOY2_UP) - { - cypos--; - if (cypos < 0) cypos = KHEIGHT-1; - } - else if (oskbBLastState & MASK_JOY2_BTN) - { - retval = cypos*KWIDTH+cxpos+1; - if (retval) { - retval--; - //if (retval & 1) retval = key_map2[retval>>1]; - //else retval = key_map1[retval>>1]; - if (oskbMap == 0) { - retval = key_map1[retval]; - } - else if (oskbMap == 1) { - retval = key_map2[retval]; - } - else { - retval = key_map3[retval]; - } - //if (retval) { toggleOskb(true); updated=false; }; - } - } - else { - updated=false; - } - if (updated) drawOskb(); - } - - return retval; -} -#endif - -/******************************** - * Input and keyboard -********************************/ -int emu_ReadAnalogJoyX(int min, int max) -{ - adc_select_input(0); - int val = adc_read(); -#if INVX - val = 4095 - val; -#endif - val = val-xRef; - val = ((val*140)/100); - if ( (val > -512) && (val < 512) ) val = 0; - val = val+2048; - return (val*(max-min))/4096; -} - -int emu_ReadAnalogJoyY(int min, int max) -{ - adc_select_input(1); - int val = adc_read(); -#if INVY - val = 4095 - val; -#endif - val = val-yRef; - val = ((val*120)/100); - if ( (val > -512) && (val < 512) ) val = 0; - //val = (val*(max-min))/4096; - val = val+2048; - //return val+(max-min)/2; - return (val*(max-min))/4096; -} - - -static uint16_t readAnalogJoystick(void) -{ - uint16_t joysval = 0; -#ifdef PIN_JOY2_A1X - int xReading = emu_ReadAnalogJoyX(0,256); - if (xReading > 128) joysval |= MASK_JOY2_LEFT; - else if (xReading < 128) joysval |= MASK_JOY2_RIGHT; - - int yReading = emu_ReadAnalogJoyY(0,256); - if (yReading < 128) joysval |= MASK_JOY2_UP; - else if (yReading > 128) joysval |= MASK_JOY2_DOWN; -#endif - // First joystick -#if INVY -#ifdef PIN_JOY2_1 - if ( !gpio_get(PIN_JOY2_1) ) joysval |= MASK_JOY2_DOWN; -#endif -#ifdef PIN_JOY2_2 - if ( !gpio_get(PIN_JOY2_2) ) joysval |= MASK_JOY2_UP; -#endif -#else -#ifdef PIN_JOY2_1 - if ( !gpio_get(PIN_JOY2_1) ) joysval |= MASK_JOY2_UP; -#endif -#ifdef PIN_JOY2_2 - if ( !gpio_get(PIN_JOY2_2) ) joysval |= MASK_JOY2_DOWN; -#endif -#endif -#if INVX -#ifdef PIN_JOY2_3 - if ( !gpio_get(PIN_JOY2_3) ) joysval |= MASK_JOY2_LEFT; -#endif -#ifdef PIN_JOY2_4 - if ( !gpio_get(PIN_JOY2_4) ) joysval |= MASK_JOY2_RIGHT; -#endif -#else -#ifdef PIN_JOY2_3 - if ( !gpio_get(PIN_JOY2_3) ) joysval |= MASK_JOY2_RIGHT; -#endif -#ifdef PIN_JOY2_4 - if ( !gpio_get(PIN_JOY2_4) ) joysval |= MASK_JOY2_LEFT; -#endif -#endif -#ifdef PIN_JOY2_BTN - joysval |= (gpio_get(PIN_JOY2_BTN) ? 0 : MASK_JOY2_BTN); -#endif - - return (joysval); -} - - -int emu_SwapJoysticks(int statusOnly) { - if (!statusOnly) { - if (joySwapped) { - joySwapped = false; - } - else { - joySwapped = true; - } - } - return(joySwapped?1:0); -} - -int emu_GetPad(void) -{ - return(bLastState/*|((joySwapped?1:0)<<7)*/); -} - -int emu_ReadKeys(void) -{ - uint16_t retval; - uint16_t j1 = readAnalogJoystick(); - uint16_t j2 = 0; - - // Second joystick -#if INVY -#ifdef PIN_JOY1_1 - if ( !gpio_get(PIN_JOY1_1) ) j2 |= MASK_JOY2_DOWN; -#endif -#ifdef PIN_JOY1_2 - if ( !gpio_get(PIN_JOY1_2) ) j2 |= MASK_JOY2_UP; -#endif -#else -#ifdef PIN_JOY1_1 - if ( !gpio_get(PIN_JOY1_1) ) j2 |= MASK_JOY2_UP; -#endif -#ifdef PIN_JOY1_2 - if ( !gpio_get(PIN_JOY1_2) ) j2 |= MASK_JOY2_DOWN; -#endif -#endif -#if INVX -#ifdef PIN_JOY1_3 - if ( !gpio_get(PIN_JOY1_3) ) j2 |= MASK_JOY2_LEFT; -#endif -#ifdef PIN_JOY1_4 - if ( !gpio_get(PIN_JOY1_4) ) j2 |= MASK_JOY2_RIGHT; -#endif -#else -#ifdef PIN_JOY1_3 - if ( !gpio_get(PIN_JOY1_3) ) j2 |= MASK_JOY2_RIGHT; -#endif -#ifdef PIN_JOY1_4 - if ( !gpio_get(PIN_JOY1_4) ) j2 |= MASK_JOY2_LEFT; -#endif -#endif -#ifdef PIN_JOY1_BTN - if ( !gpio_get(PIN_JOY1_BTN) ) j2 |= MASK_JOY2_BTN; -#endif - - - if (joySwapped) { - retval = ((j1 << 8) | j2); - } - else { - retval = ((j2 << 8) | j1); - } - - if (usbnavpad & MASK_JOY2_UP) retval |= MASK_JOY2_UP; - if (usbnavpad & MASK_JOY2_DOWN) retval |= MASK_JOY2_DOWN; - if (usbnavpad & MASK_JOY2_LEFT) retval |= MASK_JOY2_LEFT; - if (usbnavpad & MASK_JOY2_RIGHT) retval |= MASK_JOY2_RIGHT; - if (usbnavpad & MASK_JOY2_BTN) retval |= MASK_JOY2_BTN; - -#ifdef PIN_KEY_USER1 - if ( !gpio_get(PIN_KEY_USER1) ) retval |= MASK_KEY_USER1; -#endif -#ifdef PIN_KEY_USER2 - if ( !gpio_get(PIN_KEY_USER2) ) retval |= MASK_KEY_USER2; -#endif -#ifdef PIN_KEY_USER3 - if ( !gpio_get(PIN_KEY_USER3) ) retval |= MASK_KEY_USER3; -#endif -#ifdef PIN_KEY_USER4 - if ( !gpio_get(PIN_KEY_USER4) ) retval |= MASK_KEY_USER4; -#endif - -#ifdef PICOMPUTER - keymatrix_hitrow = -1; - unsigned char row; - unsigned short cols[6]={KCOLOUT1,KCOLOUT2,KCOLOUT3,KCOLOUT4,KCOLOUT5,KCOLOUT6}; - unsigned char keymatrixtmp[6]; - - for (int i=0;i<6;i++){ - gpio_set_dir(cols[i], GPIO_OUT); - gpio_put(cols[i], 0); -#ifdef SWAP_ALT_DEL - sleep_us(1); - //__asm volatile ("nop\n"); // 4-8ns -#endif - row=0; - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN4) ? 0 : 0x02); - row |= (gpio_get(KROWIN1) ? 0 : 0x04); - row |= (gpio_get(KROWIN3) ? 0 : 0x08); - row |= (gpio_get(KROWIN5) ? 0 : 0x10); - row |= (gpio_get(KROWIN6) ? 0 : 0x20); - //gpio_set_dir(cols[i], GPIO_OUT); - gpio_put(cols[i], 1); - gpio_set_dir(cols[i], GPIO_IN); - gpio_disable_pulls(cols[i]); - keymatrixtmp[i] = row; - } - -#ifdef MULTI_DEBOUNCE - for (int i=0;i<6;i++){ - gpio_set_dir(cols[i], GPIO_OUT); - gpio_put(cols[i], 0); -#ifdef SWAP_ALT_DEL - sleep_us(1); - //__asm volatile ("nop\n"); // 4-8ns -#endif - row=0; - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN4) ? 0 : 0x02); - row |= (gpio_get(KROWIN1) ? 0 : 0x04); - row |= (gpio_get(KROWIN3) ? 0 : 0x08); - row |= (gpio_get(KROWIN5) ? 0 : 0x10); - row |= (gpio_get(KROWIN6) ? 0 : 0x20); - //gpio_set_dir(cols[i], GPIO_OUT); - gpio_put(cols[i], 1); - gpio_set_dir(cols[i], GPIO_IN); - gpio_disable_pulls(cols[i]); - keymatrixtmp[i] |= row; - } - - for (int i=0;i<6;i++){ - gpio_set_dir(cols[i], GPIO_OUT); - gpio_put(cols[i], 0); -#ifdef SWAP_ALT_DEL - sleep_us(1); - //__asm volatile ("nop\n"); // 4-8ns -#endif - row=0; - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN4) ? 0 : 0x02); - row |= (gpio_get(KROWIN1) ? 0 : 0x04); - row |= (gpio_get(KROWIN3) ? 0 : 0x08); - row |= (gpio_get(KROWIN5) ? 0 : 0x10); - row |= (gpio_get(KROWIN6) ? 0 : 0x20); - //gpio_set_dir(cols[i], GPIO_OUT); - gpio_put(cols[i], 1); - gpio_set_dir(cols[i], GPIO_IN); - gpio_disable_pulls(cols[i]); - keymatrixtmp[i] |= row; - } -#endif - -#ifdef SWAP_ALT_DEL - // Swap ALT and DEL - unsigned char alt = keymatrixtmp[0] & 0x02; - unsigned char del = keymatrixtmp[5] & 0x20; - keymatrixtmp[0] &= ~0x02; - keymatrixtmp[5] &= ~0x20; - if (alt) keymatrixtmp[5] |= 0x20; - if (del) keymatrixtmp[0] |= 0x02; -#endif - - bool alt_pressed=false; - if ( keymatrixtmp[5] & 0x20 ) {alt_pressed=true; keymatrixtmp[5] &= ~0x20;}; - - for (int i=0;i<6;i++){ - row = keymatrixtmp[i]; - if (row) keymatrix_hitrow=i; - keymatrix[i] = row; - } - - //6,9,15,8,7,22 -#if INVX - if ( row & 0x2 ) retval |= MASK_JOY2_LEFT; - if ( row & 0x1 ) retval |= MASK_JOY2_RIGHT; -#else - if ( row & 0x1 ) retval |= MASK_JOY2_LEFT; - if ( row & 0x2 ) retval |= MASK_JOY2_RIGHT; -#endif -#if INVY - if ( row & 0x8 ) retval |= MASK_JOY2_DOWN; - if ( row & 0x4 ) retval |= MASK_JOY2_UP; -#else - if ( row & 0x4 ) retval |= MASK_JOY2_DOWN; - if ( row & 0x8 ) retval |= MASK_JOY2_UP; -#endif - if ( row & 0x10 ) retval |= MASK_JOY2_BTN; - - // Handle LED flash - uint32_t time_ms=to_ms_since_boot (get_absolute_time()); - if ((time_ms-last_t_ms) > 100) { - last_t_ms = time_ms; - if (ledflash_toggle == false) { - ledflash_toggle = true; - } - else { - ledflash_toggle = false; - } - } - - if ( alt_pressed ) { - if (key_fn == false) - { - // Release to Press transition - if (hundred_ms_cnt == 0) { - keypress_t_ms=time_ms; - hundred_ms_cnt += 1; // 1 - } - else { - hundred_ms_cnt += 1; // 2 - if (hundred_ms_cnt >= 2) - { - hundred_ms_cnt = 0; - /* - if ( (time_ms-keypress_t_ms) < 500) - { - if (key_alt == false) - { - key_alt = true; - } - else - { - key_alt = false; - } - } - */ - } - } - } - else { - // Keep press - if (hundred_ms_cnt == 1) { - if ((to_ms_since_boot (get_absolute_time())-keypress_t_ms) > 2000) - { - if (key_alt == false) - { - key_alt = true; - } - else - { - key_alt = false; - } - hundred_ms_cnt = 0; - } - } - } - key_fn = true; - } - else { - key_fn = false; - } - - // Handle LED - if (key_alt == true) { - gpio_put(KLED, (ledflash_toggle?1:0)); - } - else { - if (key_fn == true) { - gpio_put(KLED, 1); - } - else { - gpio_put(KLED, 0); - } - } - - if ( key_fn ) retval |= MASK_KEY_USER2; - if ( ( key_fn ) && (keymatrix[0] == 0x02 )) retval |= MASK_KEY_USER1; -#endif - - //Serial.println(retval,HEX); - - if ( ((retval & (MASK_KEY_USER1+MASK_KEY_USER2)) == (MASK_KEY_USER1+MASK_KEY_USER2)) - || (retval & MASK_KEY_USER4 ) ) - { - } - -#if (defined(ILI9341) || defined(ST7789)) && defined(USE_VGA) - if (oskbOn) { - retval |= MASK_OSKB; - } -#endif - - return (retval); -} - -unsigned short emu_DebounceLocalKeys(void) -{ - uint16_t bCurState = emu_ReadKeys(); - uint16_t bClick = bCurState & ~bLastState; - bLastState = bCurState; - - return (bClick); -} - -int emu_ReadI2CKeyboard(void) { - int retval=0; -#ifdef PICOMPUTER - if (key_alt) { - keys = (const unsigned short *)key_map3; - } - else if (key_fn) { - keys = (const unsigned short *)key_map2; - } - else { - keys = (const unsigned short *)key_map1; - } - if (keymatrix_hitrow >=0 ) { - unsigned short match = ((unsigned short)keymatrix_hitrow<<8) | keymatrix[keymatrix_hitrow]; - for (int i=0; i=0) { - menuRedraw=true; - curFile -= 9; - } else if (curFile!=0) { - menuRedraw=true; - curFile--; - } - } - else if ( (bClick & MASK_JOY2_DOWN) || (bClick & MASK_JOY1_DOWN) ) { - if ((curFile<(nbFiles-1)) && (nbFiles)) { - curFile++; - menuRedraw=true; - } - } - else if ( (bClick & MASK_JOY2_LEFT) || (bClick & MASK_JOY1_LEFT) ) { - if ((curFile<(nbFiles-9)) && (nbFiles)) { - curFile += 9; - menuRedraw=true; - } - else if ((curFile<(nbFiles-1)) && (nbFiles)) { - curFile++; - menuRedraw=true; - } - } - else if ( (bClick & MASK_KEY_USER2) ) { - emu_SwapJoysticks(0); - menuRedraw=true; - } - - if (menuRedraw && nbFiles) { - int fileIndex = 0; - tft.drawRectNoDma(MENU_FILE_XOFFSET,MENU_FILE_YOFFSET, MENU_FILE_W, MENU_FILE_H, MENU_FILE_BGCOLOR); -// if (curFile <= (MAX_MENULINES/2-1)) topFile=0; -// else topFile=curFile-(MAX_MENULINES/2); - if (curFile <= (MAX_MENULINES-1)) topFile=0; - else topFile=curFile-(MAX_MENULINES/2); - - //Serial.print("curfile: "); - //Serial.println(curFile); - //Serial.print("topFile: "); - //Serial.println(topFile); - - int i=0; - while (i=nbFiles) { - // no more files - break; - } - char * filename = &files[fileIndex][0]; - if (fileIndex >= topFile) { - if ((i+topFile) < nbFiles ) { - if ((i+topFile)==curFile) { - tft.drawTextNoDma(MENU_FILE_XOFFSET,i*TEXT_HEIGHT+MENU_FILE_YOFFSET, filename, RGBVAL16(0xff,0xff,0x00), RGBVAL16(0xff,0x00,0x00), true); - strcpy(selection,filename); - } - else { - tft.drawTextNoDma(MENU_FILE_XOFFSET,i*TEXT_HEIGHT+MENU_FILE_YOFFSET, filename, RGBVAL16(0xff,0xff,0xff), MENU_FILE_BGCOLOR, true); - } - } - i++; - } - fileIndex++; - } - - - tft.drawTextNoDma(48,MENU_JOYS_YOFFSET+8, (emu_SwapJoysticks(1)?(char*)"SWAP=1":(char*)"SWAP=0"), RGBVAL16(0x00,0xff,0xff), RGBVAL16(0x00,0x00,0xff), false); - menuRedraw=false; - } - - return (action); -} - -bool menuActive(void) -{ - return (menuOn); -} - -void toggleMenu(bool on) { - if (on) { - menuOn = true; - backgroundMenu(); - } else { - menuOn = false; - } -} - -char * menuSelection(void) -{ - return (selection); -} - - -/******************************** - * File IO -********************************/ -int emu_FileOpen(char * filename) -{ - int retval = 0; - - char filepath[80]; - strcpy(filepath, romspath); - strcat(filepath, "/"); - strcat(filepath, filename); - emu_printf("FileOpen..."); - emu_printf(filepath); - if( !(f_open(&file, filepath, FA_READ)) ) { - retval = 1; - } - else { - emu_printf("FileOpen failed"); - } - return (retval); -} - -int emu_FileRead(char * buf, int size) -{ - unsigned char buffer[256]; - int remaining = size; - int byteread = 0; - unsigned int retval=0; - if (size < 256) { - if( !(f_read (&file, buffer, size, &retval)) ) - if (retval>0) { - memcpy(buf,buffer,retval); - byteread += retval; - } - } - else { - while (remaining>0) { - if( !(f_read (&file, buffer, 256, &retval)) ) - //f_read (&file, buffer, 256, &retval); - if (retval>0) { - //emu_printi(retval); - memcpy(buf,buffer,retval); - buf += retval; - byteread += retval; - remaining -= retval; - } - else { - break; - } - } - } - return byteread; -} - -unsigned char emu_FileGetc(void) { - unsigned char c; - unsigned int retval=0; - if( !(f_read (&file, &c, 1, &retval)) ) - if (retval != 1) { - emu_printf("emu_FileGetc failed"); - } - return c; -} - -void emu_FileClose(void) -{ - f_close(&file); -} - -int emu_FileSize(char * filename) -{ - int filesize=0; - char filepath[80]; - strcpy(filepath, romspath); - strcat(filepath, "/"); - strcat(filepath, filename); - emu_printf("FileSize..."); - emu_printf(filepath); - FILINFO entry; - f_stat(filepath, &entry); - filesize = entry.fsize; - return(filesize); -} - -int emu_FileSeek(int seek) -{ - f_lseek(&file, seek); - return (seek); -} - -int emu_FileTell(void) -{ - return (f_tell(&file)); -} - -int emu_LoadFile(char * filename, char * buf, int size) -{ - int filesize = 0; - - char filepath[80]; - strcpy(filepath, romspath); - strcat(filepath, "/"); - strcat(filepath, filename); - emu_printf("LoadFile..."); - emu_printf(filepath); - if( !(f_open(&file, filepath, FA_READ)) ) { - filesize = f_size(&file); - emu_printf(filesize); - if (size >= filesize) - { - unsigned int retval=0; - if( (f_read (&file, buf, filesize, &retval)) ) { - emu_printf("File read failed"); - } - } - f_close(&file); - } - - return(filesize); -} - - - - -/******************************** - * Initialization -********************************/ -void emu_init(void) -{ - // Dual display config, initialize TFT -#if (defined(ILI9341) || defined(ST7789)) && defined(USE_VGA) - tft.begin(); -#endif - - sd_init_driver(); - FRESULT fr = f_mount(&fatfs, "0:", 1); - - strcpy(romspath,ROMSDIR); - nbFiles = readNbFiles(romspath); - - emu_printf("SD initialized, files found: "); - emu_printi(nbFiles); - - emu_InitJoysticks(); -#ifdef SWAP_JOYSTICK - joySwapped = true; -#else - joySwapped = false; -#endif - -#ifdef PICOMPUTER - // Flip screen if UP pressed - if (emu_ReadKeys() & MASK_JOY2_UP) - { -#ifdef PICOMPUTERMAX -#ifndef USE_VGA - tft.flipscreen(true); -#endif -#else - tft.flipscreen(true); -#endif - } - else - { -#ifdef PICOMPUTERMAX -#ifndef USE_VGA - tft.flipscreen(false); -#endif -#else - tft.flipscreen(false); -#endif - } -#endif - - toggleMenu(true); -} - - -void emu_start(void) -{ - usbnavpad = 0; - - keyMap = 0; -} diff --git a/MCUME_pico/pico8086/emuapi.h b/MCUME_pico/pico8086/emuapi.h deleted file mode 100644 index 28b100c..0000000 --- a/MCUME_pico/pico8086/emuapi.h +++ /dev/null @@ -1,147 +0,0 @@ -#ifndef EMUAPI_H -#define EMUAPI_H - -#include "platform_config.h" - -#define CUSTOM_SND 1 -//#define TIMER_REND 1 - -#define EXTRA_HEAP 0x10 - -// Title: < > -#define TITLE " 8086 PC Emulator" -#define ROMSDIR "pc" - -#define emu_Init(ROM) {apc_Start(ROM); apc_Init(); } -#define emu_Step(x) { apc_Step(); } -#define emu_Input(x) { apc_Input(x); } - -#define PALETTE_SIZE 256 -#define VID_FRAME_SKIP 0x0 -#define TFT_VBUFFER_YCROP 0 -#define SINGLELINE_RENDERING 1 - -#define ACTION_NONE 0 -#define ACTION_MAXKBDVAL 12 -#define ACTION_EXITKBD 128 -#define ACTION_RUNTFT 129 -#define ACTION_RUNVGA 130 - -#ifdef KEYMAP_PRESENT - -#define keylables_map1_0 (char *)"qwertyuiop\x1a" -#define keylables_map1_1 (char *)" asdfghjkl\x19" -#define keylables_map1_2 (char *)" zxcvbnm.\x10 " -const unsigned short key_map1[] = { - 'Q','W','E','R','T','Y','U','I','O','P',157, - 0,'A','S','D','F','G','H','J','K','L',0x0D, - 0,'Z','X','C','V','B','N','M','.',' ', - 145,157,29,17 - }; - -#define keylables_map2_0 (char *)"1234567890 " -#define keylables_map2_1 (char *)" !@#$%+&*- " -#define keylables_map2_2 (char *)" ()?/\"<>,: " -const unsigned short key_map2[] = { - '1','2','3','4','5','6','7','8','9','0',0, - 0, '!','@','#','$','%','+','&','*','-','\/', - 0, '(',')','?','\/','"','<','>',',',':', - 0,0,0,0 - }; - -#define keylables_map3_0 (char *)"\x11\x12\x13\x14\x15\x16\x17\x18 " -#define keylables_map3_1 (char *)" " -#define keylables_map3_2 (char *)" ;= " -const unsigned short key_map3[] = { - 133,134,135,136,137,138,139,140,0,0,0, // function keys - 0, 0,0,0,0,0,0,0,0,0,0, - 0, 0,0,0,0,0,0,0,';','=', - 0,0,0,0 - }; - -const unsigned short matkeys[] = { - 0x020,0x120,0x220,0x320,0x420,0x408,0x308,0x208,0x108,0x008,0x002, // row 1 - 0x510,0x010,0x110,0x210,0x310,0x410,0x401,0x301,0x201,0x101,0x001, // row 2 - 0x520,0x102,0x202,0x302,0x402,0x404,0x304,0x204,0x104,0x004, // row 3 - 0x508,0x501,0x502,0x504 }; // cursor keys - -#endif - - -#define MASK_JOY2_RIGHT 0x0001 -#define MASK_JOY2_LEFT 0x0002 -#define MASK_JOY2_UP 0x0004 -#define MASK_JOY2_DOWN 0x0008 -#define MASK_JOY2_BTN 0x0010 -#define MASK_KEY_USER1 0x0020 -#define MASK_KEY_USER2 0x0040 -#define MASK_KEY_USER3 0x0080 -#define MASK_JOY1_RIGHT 0x0100 -#define MASK_JOY1_LEFT 0x0200 -#define MASK_JOY1_UP 0x0400 -#define MASK_JOY1_DOWN 0x0800 -#define MASK_JOY1_BTN 0x1000 -#define MASK_KEY_USER4 0x2000 -#define MASK_OSKB 0x8000 - - - -extern void emu_init(void); -extern void emu_start(void); -extern void emu_resetSD(void); - -extern void emu_printf(char * text); -extern void emu_printi(int val); -extern void * emu_Malloc(int size); -extern void emu_Free(void * pt); - - -extern int emu_FileOpen(char * filename); -extern int emu_FileRead(char * buf, int size); -extern unsigned char emu_FileGetc(void); -extern int emu_FileSeek(int seek); -extern void emu_FileClose(void); -extern int emu_FileSize(char * filename); -extern int emu_LoadFile(char * filename, char * buf, int size); -extern int emu_LoadFileSeek(char * filename, char * buf, int size, int seek); -extern void emu_FileTempInit(void); -extern void emu_FileTempRead(int addr, unsigned char * val, int n); -extern void emu_FileTempWrite(int addr, unsigned char val); - -extern void emu_SetPaletteEntry(unsigned char r, unsigned char g, unsigned char b, int index); -extern void emu_DrawScreen(unsigned char * VBuf, int width, int height, int stride); -extern void emu_DrawLine(unsigned char * VBuf, int width, int height, int line); -extern void emu_DrawLine8(unsigned char * VBuf, int width, int height, int line); -extern void emu_DrawLine16(unsigned short * VBuf, int width, int height, int line); -extern void emu_DrawVsync(void); -extern int emu_FrameSkip(void); -extern void * emu_LineBuffer(int line); - -extern void emu_InitJoysticks(void); -extern int emu_SwapJoysticks(int statusOnly); -extern unsigned short emu_DebounceLocalKeys(void); -extern int emu_ReadKeys(void); -extern int emu_GetPad(void); -extern int emu_ReadAnalogJoyX(int min, int max); -extern int emu_ReadAnalogJoyY(int min, int max); -extern int emu_ReadI2CKeyboard(void); -extern unsigned char emu_ReadI2CKeyboard2(int row); -extern void emu_KeyboardOnUp(int keymodifer, int key); -extern void emu_KeyboardOnDown(int keymodifer, int key); -extern int emu_oskbActive(void); - -extern void emu_sndPlaySound(int chan, int volume, int freq); -extern void emu_sndPlayBuzz(int size, int val); -extern void emu_sndInit(); -extern void emu_resetus(void); -extern int emu_us(void); - -extern int emu_setKeymap(int index); - -extern void emu_FileTempInit(void); -extern void emu_FileTempRead(int addr, unsigned char * val, int n); -extern void emu_FileTempWrite(int addr, unsigned char val); -extern void emu_printh(int val); - - -#endif diff --git a/MCUME_pico/pico8086/font.h b/MCUME_pico/pico8086/font.h deleted file mode 100644 index 1edec9d..0000000 --- a/MCUME_pico/pico8086/font.h +++ /dev/null @@ -1,264 +0,0 @@ -#ifdef MEGA -#include - const uint8_t font[2048] PROGMEM = { -#else - const uint8_t font[2048] = { -#endif - 0,0,0,0,0,0,0, - 0,126,129,165,129,189,153,129, - 126,126,255,219,255,195,231,255, - 126,54,127,127,127,62,28,8, - 0,8,28,62,127,62,28,8, - 0,28,62,28,127,127,62,28, - 62,8,8,28,62,127,62,28, - 62,0,0,0,0,0,0,0, - 0,255,255,231,195,195,231,255, - 255,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0, - 0,254,198,254,198,198,230,103, - 3,153,90,60,231,231,60,90, - 153,1,7,31,127,31,7,1, - 0,64,112,124,127,124,112,64, - 0,24,60,126,24,24,126,60, - 24,102,102,102,102,102,0,102, - 0,254,219,219,222,216,216,216, - 0,124,198,28,54,54,28,51, - 30,0,0,0,0,126,126,126, - 0,24,60,126,24,126,60,24, - 255,24,60,126,24,24,24,24, - 0,24,24,24,24,126,60,24, - 0,0,24,48,127,48,24,0, - 0,0,12,6,127,6,12,0, - 0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0, - 0,12,30,30,12,12,0,12, - 0,54,54,54,0,0,0,0, - 0,54,54,127,54,127,54,54, - 0,12,62,3,30,48,31,12, - 0,0,99,51,24,12,102,99, - 0,28,54,28,110,59,51,110, - 0,6,6,3,0,0,0,0, - 0,24,12,6,6,6,12,24, - 0,6,12,24,24,24,12,6, - 0,0,102,60,255,60,102,0, - 0,0,12,12,63,12,12,0, - 0,0,0,0,0,0,12,12, - 6,0,0,0,63,0,0,0, - 0,0,0,0,0,0,12,12, - 0,96,48,24,12,6,3,1, - 0,62,99,115,123,111,103,62, - 0,12,14,12,12,12,12,63, - 0,30,51,48,28,6,51,63, - 0,30,51,48,28,48,51,30, - 0,56,60,54,51,127,48,120, - 0,63,3,31,48,48,51,30, - 0,28,6,3,31,51,51,30, - 0,63,51,48,24,12,12,12, - 0,30,51,51,30,51,51,30, - 0,30,51,51,62,48,24,14, - 0,0,12,12,0,0,12,12, - 0,0,12,12,0,0,12,12, - 6,24,12,6,3,6,12,24, - 0,0,0,63,0,0,63,0, - 0,6,12,24,48,24,12,6, - 0,30,51,48,24,12,0,12, - 0,62,99,123,123,123,3,30, - 0,12,30,51,51,63,51,51, - 0,63,102,102,62,102,102,63, - 0,60,102,3,3,3,102,60, - 0,31,54,102,102,102,54,31, - 0,127,70,22,30,22,70,127, - 0,127,70,22,30,22,6,15, - 0,60,102,3,3,115,102,124, - 0,51,51,51,63,51,51,51, - 0,30,12,12,12,12,12,30, - 0,120,48,48,48,51,51,30, - 0,103,102,54,30,54,102,103, - 0,15,6,6,6,70,102,127, - 0,99,119,127,127,107,99,99, - 0,99,103,111,123,115,99,99, - 0,28,54,99,99,99,54,28, - 0,63,102,102,62,6,6,15, - 0,30,51,51,51,59,30,56, - 0,63,102,102,62,54,102,103, - 0,30,51,7,14,56,51,30, - 0,63,45,12,12,12,12,30, - 0,51,51,51,51,51,51,63, - 0,51,51,51,51,51,30,12, - 0,99,99,99,107,127,119,99, - 0,99,99,54,28,28,54,99, - 0,51,51,51,30,12,12,30, - 0,127,99,49,24,76,102,127, - 0,30,6,6,6,6,6,30, - 0,3,6,12,24,48,96,64, - 0,30,24,24,24,24,24,30, - 0,8,28,54,99,0,0,0, - 0,0,0,0,0,0,0,0, - 255,12,12,24,0,0,0,0, - 0,0,0,30,48,62,51,110, - 0,7,6,6,62,102,102,59, - 0,0,0,30,51,3,51,30, - 0,56,48,48,62,51,51,110, - 0,0,0,30,51,63,3,30, - 0,28,54,6,15,6,6,15, - 0,0,0,110,51,51,62,48, - 31,7,6,54,110,102,102,103, - 0,12,0,14,12,12,12,30, - 0,48,0,48,48,48,51,51, - 30,7,6,102,54,30,54,103, - 0,14,12,12,12,12,12,30, - 0,0,0,51,127,127,107,99, - 0,0,0,31,51,51,51,51, - 0,0,0,30,51,51,51,30, - 0,0,0,59,102,102,62,6, - 15,0,0,110,51,51,62,48, - 120,0,0,59,110,102,6,15, - 0,0,0,62,3,30,48,31, - 0,8,12,62,12,12,44,24, - 0,0,0,51,51,51,51,110, - 0,0,0,51,51,51,30,12, - 0,0,0,99,107,127,127,54, - 0,0,0,99,54,28,54,99, - 0,0,0,51,51,51,62,48, - 31,0,0,63,25,12,38,63, - 0,56,12,12,7,12,12,56, - 0,24,24,24,0,24,24,24, - 0,7,12,12,56,12,12,7, - 0,110,59,0,0,0,0,0, - 0,0,8,28,54,99,99,127, - 0,30,51,3,51,30,24,48, - 30,0,51,0,51,51,51,126, - 0,56,0,30,51,63,3,30, - 0,126,195,60,96,124,102,252, - 0,51,0,30,48,62,51,126, - 0,7,0,30,48,62,51,126, - 0,12,12,30,48,62,51,126, - 0,0,0,30,3,3,30,48, - 28,126,195,60,102,126,6,60, - 0,51,0,30,51,63,3,30, - 0,7,0,30,51,63,3,30, - 0,51,0,14,12,12,12,30, - 0,62,99,28,24,24,24,60, - 0,7,0,14,12,12,12,30, - 0,99,28,54,99,127,99,99, - 0,12,12,0,30,51,63,51, - 0,56,0,63,6,30,6,63, - 0,0,0,254,48,254,51,254, - 0,124,54,51,127,51,51,115, - 0,30,51,0,30,51,51,30, - 0,0,51,0,30,51,51,30, - 0,0,7,0,30,51,51,30, - 0,30,51,0,51,51,51,126, - 0,0,7,0,51,51,51,126, - 0,0,51,0,51,51,62,48, - 31,195,24,60,102,102,60,24, - 0,51,0,51,51,51,51,30, - 0,24,24,126,3,3,126,24, - 24,28,54,38,15,6,103,63, - 0,51,51,30,63,12,63,12, - 12,31,51,51,95,99,243,99, - 227,112,216,24,60,24,24,27, - 14,56,0,30,48,62,51,126, - 0,28,0,14,12,12,12,30, - 0,0,56,0,30,51,51,30, - 0,0,56,0,51,51,51,126, - 0,0,31,0,31,51,51,51, - 0,63,0,51,55,63,59,51, - 0,60,54,54,124,0,126,0, - 0,28,54,54,28,0,62,0, - 0,12,0,12,6,3,51,30, - 0,0,0,0,63,3,3,0, - 0,0,0,0,63,48,48,0, - 0,195,99,51,123,204,102,51, - 240,195,99,51,219,236,246,243, - 192,24,24,0,24,24,24,24, - 0,0,204,102,51,102,204,0, - 0,0,51,102,204,102,51,0, - 0,68,17,68,17,68,17,68, - 17,170,85,170,85,170,85,170, - 85,219,238,219,119,219,238,219, - 119,24,24,24,24,24,24,24, - 24,24,24,24,24,31,24,24, - 24,24,24,31,24,31,24,24, - 24,108,108,108,108,111,108,108, - 108,0,0,0,0,127,108,108, - 108,0,0,31,24,31,24,24, - 24,108,108,111,96,111,108,108, - 108,108,108,108,108,108,108,108, - 108,0,0,127,96,111,108,108, - 108,108,108,111,96,127,0,0, - 0,108,108,108,108,127,0,0, - 0,24,24,31,24,31,0,0, - 0,0,0,0,0,31,24,24, - 24,24,24,24,24,248,0,0, - 0,24,24,24,24,255,0,0, - 0,0,0,0,0,255,24,24, - 24,24,24,24,24,248,24,24, - 24,0,0,0,0,255,0,0, - 0,24,24,24,24,255,24,24, - 24,24,24,248,24,248,24,24, - 24,108,108,108,108,236,108,108, - 108,108,108,236,12,252,0,0, - 0,0,0,252,12,236,108,108, - 108,108,108,239,0,255,0,0, - 0,0,0,255,0,239,108,108, - 108,108,108,236,12,236,108,108, - 108,0,0,255,0,255,0,0, - 0,108,108,239,0,239,108,108, - 108,24,24,255,0,255,0,0, - 0,108,108,108,108,255,0,0, - 0,0,0,255,0,255,24,24, - 24,0,0,0,0,255,108,108, - 108,108,108,108,108,252,0,0, - 0,24,24,248,24,248,0,0, - 0,0,0,248,24,248,24,24, - 24,0,0,0,0,252,108,108, - 108,108,108,108,108,255,108,108, - 108,24,24,255,24,255,24,24, - 24,24,24,24,24,31,0,0, - 0,0,0,0,0,248,24,24, - 24,255,255,255,255,255,255,255, - 255,0,0,0,0,255,255,255, - 255,15,15,15,15,15,15,15, - 15,240,240,240,240,240,240,240, - 240,255,255,255,255,0,0,0, - 0,0,0,110,59,19,59,110, - 0,0,30,51,31,51,31,3, - 3,0,63,51,3,3,3,3, - 0,0,127,54,54,54,54,54, - 0,63,51,6,12,6,51,63, - 0,0,0,126,27,27,27,14, - 0,0,102,102,102,102,62,6, - 3,0,110,59,24,24,24,24, - 0,63,12,30,51,51,30,12, - 63,28,54,99,127,99,54,28, - 0,28,54,99,99,54,54,119, - 0,56,12,24,62,51,51,30, - 0,0,0,126,219,219,126,0, - 0,96,48,126,219,219,126,6, - 3,28,6,3,31,3,6,28, - 0,30,51,51,51,51,51,51, - 0,0,63,0,63,0,63,0, - 0,12,12,63,12,12,0,63, - 0,6,12,24,12,6,0,63, - 0,24,12,6,12,24,0,63, - 0,112,216,216,24,24,24,24, - 24,24,24,24,24,24,27,27, - 14,12,12,0,63,0,12,12, - 0,0,110,59,0,110,59,0, - 0,28,54,54,28,0,0,0, - 0,0,0,0,24,24,0,0, - 0,0,0,0,0,24,0,0, - 0,240,48,48,48,55,54,60, - 56,30,54,54,54,54,0,0, - 0,14,24,12,6,30,0,0, - 0,0,0,60,60,60,60,0, - 0,0,0,0,0,0,0,0,0 -}; - diff --git a/MCUME_pico/pico8086/i8253.cpp b/MCUME_pico/pico8086/i8253.cpp deleted file mode 100644 index 24cdad8..0000000 --- a/MCUME_pico/pico8086/i8253.cpp +++ /dev/null @@ -1,119 +0,0 @@ -#include -#include - -#ifdef MEGA -#include -#include -#else -#include "pico.h" -#include "pico/stdlib.h" -struct repeating_timer timer; -#endif - -#define PIT_MODE_LATCHCOUNT 0 -#define PIT_MODE_LOBYTE 1 -#define PIT_MODE_HIBYTE 2 -#define PIT_MODE_TOGGLE 3 - - -struct i8253_s { - uint16_t chandata[3]; - uint8_t accessmode[3]; - uint8_t bytetoggle[3]; - uint32_t effectivedata[3]; - float chanfreq[3]; - uint8_t active[3]; - uint16_t counter[3]; -} i8253; - -volatile uint8_t timerTick = 0; - -#ifdef MEGA -void timer_isr() { - timerTick = 1; -} -#else -static bool timer_isr(struct repeating_timer *t) { - timerTick = 1; - return true; -} -#endif - -void out8253 (uint16_t portnum, uint8_t value) { - uint8_t curbyte; - portnum &= 3; - switch (portnum) { - case 0: - case 1: - case 2: //channel data - if ( (i8253.accessmode[portnum] == PIT_MODE_LOBYTE) || ( (i8253.accessmode[portnum] == PIT_MODE_TOGGLE) && (i8253.bytetoggle[portnum] == 0) ) ) curbyte = 0; - else if ( (i8253.accessmode[portnum] == PIT_MODE_HIBYTE) || ( (i8253.accessmode[portnum] == PIT_MODE_TOGGLE) && (i8253.bytetoggle[portnum] == 1) ) ) curbyte = 1; - if (curbyte == 0) { //low byte - i8253.chandata[portnum] = (i8253.chandata[portnum] & 0xFF00) | value; - } - else { //high byte - i8253.chandata[portnum] = (i8253.chandata[portnum] & 0x00FF) | ( (uint16_t) value << 8); - } - if (i8253.chandata[portnum] == 0) i8253.effectivedata[portnum] = 65536; - else i8253.effectivedata[portnum] = i8253.chandata[portnum]; - i8253.active[portnum] = 1; - if (i8253.accessmode[portnum] == PIT_MODE_TOGGLE) i8253.bytetoggle[portnum] = (~i8253.bytetoggle[portnum]) & 1; - //i8253.chanfreq[portnum] = (float) ( (uint32_t) ( ( (float) 1193182.0 / (float) i8253.effectivedata[portnum]) * (float) 1000.0) ); - //Serial.print("period "); Serial.println((uint32_t) ((float)1000000.0 / ( ( (float) 1193182.0 / (float) i8253.effectivedata[portnum])))); - if (portnum == 0) { - uint32_t period; - period = (uint32_t) ((float)1000000.0 / ( ( (float) 1193182.0 / (float) i8253.effectivedata[portnum]))); -#ifdef MEGA - if (period < 4000) period = 4000; //limit to 250 Hz, or the emulator just can't keep up on a Mega - //Serial.println((float)1000000.0 / (float)period); - Timer1.attachInterrupt(timer_isr, period); -#else - cancel_repeating_timer (&timer); - add_repeating_timer_us(period, timer_isr, NULL, &timer); -#endif - } - break; - case 3: //mode/command - i8253.accessmode[value>>6] = (value >> 4) & 3; - if (i8253.accessmode[value>>6] == PIT_MODE_TOGGLE) i8253.bytetoggle[value>>6] = 0; - break; - } -} - -uint8_t in8253 (uint16_t portnum) { - uint8_t curbyte; - portnum &= 3; - switch (portnum) { - case 0: - case 1: - case 2: //channel data - if ( (i8253.accessmode[portnum] == 0) || (i8253.accessmode[portnum] == PIT_MODE_LOBYTE) || ( (i8253.accessmode[portnum] == PIT_MODE_TOGGLE) && (i8253.bytetoggle[portnum] == 0) ) ) curbyte = 0; - else if ( (i8253.accessmode[portnum] == PIT_MODE_HIBYTE) || ( (i8253.accessmode[portnum] == PIT_MODE_TOGGLE) && (i8253.bytetoggle[portnum] == 1) ) ) curbyte = 1; - if ( (i8253.accessmode[portnum] == 0) || (i8253.accessmode[portnum] == PIT_MODE_LOBYTE) || ( (i8253.accessmode[portnum] == PIT_MODE_TOGGLE) && (i8253.bytetoggle[portnum] == 0) ) ) curbyte = 0; - else if ( (i8253.accessmode[portnum] == PIT_MODE_HIBYTE) || ( (i8253.accessmode[portnum] == PIT_MODE_TOGGLE) && (i8253.bytetoggle[portnum] == 1) ) ) curbyte = 1; - if ( (i8253.accessmode[portnum] == 0) || (i8253.accessmode[portnum] == PIT_MODE_TOGGLE) ) i8253.bytetoggle[portnum] = (~i8253.bytetoggle[portnum]) & 1; - if (curbyte == 0) { //low byte - if (i8253.counter[portnum] < 10) i8253.counter[portnum] = i8253.chandata[portnum]; - i8253.counter[portnum] -= 10; - return ( (uint8_t) i8253.counter[portnum]); - } - else { //high byte - return ( (uint8_t) (i8253.counter[portnum] >> 8) ); - } - break; - } - return (0); -} - -void init8253() { - memset (&i8253, 0, sizeof (i8253) ); -#ifdef MEGA - Timer1.initialize(54925); - Timer1.attachInterrupt(timer_isr, 54925); -#else - add_repeating_timer_us(54925, timer_isr, NULL, &timer); -#endif - //set_port_write_redirector (0x40, 0x43, &out8253); - //set_port_read_redirector (0x40, 0x43, &in8253); -} - diff --git a/MCUME_pico/pico8086/i8259.cpp b/MCUME_pico/pico8086/i8259.cpp deleted file mode 100755 index f26f2cd..0000000 --- a/MCUME_pico/pico8086/i8259.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* i8259.c - emulation code for the Intel 8259 controller. - Note: This is not a very complete i8259 interrupt controller - implementation, but for the purposes of a PC, it's all we need. */ - -#include -#include - -struct structpic { - uint8_t imr; //mask register - uint8_t irr; //request register - uint8_t isr; //service register - uint8_t icwstep; //used during initialization to keep track of which ICW we're at - uint8_t icw[5]; - uint8_t intoffset; //interrupt vector offset - uint8_t priority; //which IRQ has highest priority - uint8_t autoeoi; //automatic EOI mode - uint8_t readmode; //remember what to return on read register from OCW3 - uint8_t enabled; -} i8259; - - -void init8259() { - memset((void *)&i8259, 0, sizeof(i8259)); -} - -uint8_t in8259(uint16_t portnum) { - switch (portnum & 1) { - case 0: - if (i8259.readmode==0) return(i8259.irr); else return(i8259.isr); - case 1: //read mask register - return(i8259.imr); - } - return(0); //can't get here, but the compiler bitches -} - -extern uint32_t makeupticks; -void out8259(uint16_t portnum, uint8_t value) { - uint8_t i; - switch (portnum & 1) { - case 0: - if (value & 0x10) { //begin initialization sequence - i8259.icwstep = 1; - i8259.imr = 0; //clear interrupt mask register - i8259.icw[i8259.icwstep++] = value; - return; - } - if ((value & 0x98)==8) { //it's an OCW3 - if (value & 2) i8259.readmode = value & 2; - } - if (value & 0x20) { //EOI command - for (i=0; i<8; i++) - if ((i8259.isr >> i) & 1) { - i8259.isr ^= (1 << i); - if ((i==0) && (makeupticks>0)) { makeupticks = 0; i8259.irr |= 1; } - return; - } - } - break; - case 1: - if ((i8259.icwstep==3) && (i8259.icw[1] & 2)) i8259.icwstep = 4; //single mode, so don't read ICW3 - if (i8259.icwstep<5) { i8259.icw[i8259.icwstep++] = value; return; } - //if we get to this point, this is just a new IMR value - i8259.imr = value; - break; - } -} - -uint8_t nextintr() { - uint8_t i, tmpirr; - tmpirr = i8259.irr & (~i8259.imr); //XOR request register with inverted mask register - for (i=0; i<8; i++) - if ((tmpirr >> i) & 1) { - i8259.irr ^= (1 << i); - i8259.isr |= (1 << i); - return(i8259.icw[2] + i); - } - return(0); //can't get here, but the compiler bitches -} - -void doirq(uint8_t irqnum) { - i8259.irr |= (1 << irqnum); -} - diff --git a/MCUME_pico/pico8086/network.cpp b/MCUME_pico/pico8086/network.cpp deleted file mode 100755 index 3c10ff5..0000000 --- a/MCUME_pico/pico8086/network.cpp +++ /dev/null @@ -1,146 +0,0 @@ - -#include -#include - -#include "emu.h" - - -#ifdef USE_ENC28J60 -#include - -byte ENC28J60::buffer[1514]; -//uint8_t net_mac[6] = { 0x90, 0xAD, 0xBE, 0xEF, 0x13, 0x37 }; -uint8_t net_mac[6] = { 0x2C, 0xFD, 0x13, 0x37, 0x13, 0x37 }; - -extern union _bytewordregs_ regs; -extern uint16_t segregs[6]; - -struct netstruct { - uint8_t enabled; - uint8_t canrecv; - uint16_t pktlen; -} net; - -void net_handler() { - uint32_t i; - uint16_t j; - //if (ethif==254) return; //networking not enabled - switch (regs.byteregs[regah]) { //function number - case 0x00: //enable packet reception - net.enabled = 1; - net.canrecv = 1; - return; - case 0x01: //send packet of CX at DS:SI - //if (verbose) { - //Serial.println("Sending packet of %u bytes.", regs.wordregs[regcx]); - //} - //sendpkt (&RAM[ ( (uint32_t) segregs[regds] << 4) + (uint32_t) regs.wordregs[regsi]], regs.wordregs[regcx]); - i = ( (uint32_t) segregs[regds] << 4) + (uint32_t) regs.wordregs[regsi]; - for (j=0; j 0) { - for (i=0; i -#include -#include "emu.h" -#include "ps2.h" - - -static uint8_t LOMEM[NATIVE_RAM]; - -#ifdef HAS_PSRAM -#include "psram_t.h" - -PSRAM_T psram = PSRAM_T(PSRAM_CS, PSRAM_MOSI, PSRAM_SCLK, PSRAM_MISO); - -#else -static uint8_t HIMEM[RAM_SIZE-NATIVE_RAM]; -#endif - -extern void write_loram(int address, uint8_t val) { - LOMEM[address] = val; -} - -extern uint8_t read_loram(int address) { - return LOMEM[address]; -} - -extern void write_hiram(int address, uint8_t val) { -#ifdef HAS_PSRAM - psram.pswrite(address,val); -#else - HIMEM[address] = val; -#endif -} - -extern uint8_t read_hiram(int address) { -#ifdef HAS_PSRAM - return (psram.psread(address)); -#else - return HIMEM[address]; -#endif -} - - - - -#define PALMULT8(x) ((x)<<5) -#define RGBVAL16(r,g,b) ( (((r>>3)&0x1f)<<11) | (((g>>2)&0x3f)<<5) | (((b>>3)&0x1f)<<0) ) - -struct i8253_s { - uint16_t chandata[3]; - uint8_t accessmode[3]; - uint8_t bytetoggle[3]; - uint32_t effectivedata[3]; - float chanfreq[3]; - uint8_t active[3]; - uint16_t counter[3]; -}; - -extern struct i8253_s i8253; - -void doirq(uint8_t irqnum); -void write86(uint32_t addr32, uint8_t value); -uint8_t read86(uint32_t addr32); - -uint8_t curkey = 0; - - - -uint8_t VRAM[16384]; - - -uint32_t updateaddrs[64]; -uint8_t updatepos = 0; - -void VRAM_write(uint32_t addr32, uint8_t value) { - - if (addr32 < 16384) { - VRAM[addr32] = value; - -//printf("%d %d\n",addr32,value); - } -} - -uint8_t VRAM_read(uint32_t addr32) { - - if (addr32 < 16384) return VRAM[addr32]; - return 0; -} - -uint8_t ansicolor[16] = { 0, 4, 2, 6, 1, 5, 3, 7, 0, 4, 2, 6, 1, 5, 3, 7 }; -uint16_t palettecga[16], palettevga[256]; - - -void installPalette(void) { - palettecga[0] = RGBVAL16(0, 0, 0); - palettecga[1] = RGBVAL16(0, 0, 0xAA); - palettecga[2] = RGBVAL16(0, 0xAA, 0); - palettecga[3] = RGBVAL16(0, 0xAA, 0xAA); - palettecga[4] = RGBVAL16(0xAA, 0, 0); - palettecga[5] = RGBVAL16(0xAA, 0, 0xAA); - palettecga[6] = RGBVAL16(0xAA, 0x55, 0); - palettecga[7] = RGBVAL16(0xAA, 0xAA, 0xAA); - palettecga[8] = RGBVAL16(0x55, 0x55, 0x55); - palettecga[9] = RGBVAL16(0x55, 0x55, 0xFF); - palettecga[10] = RGBVAL16(0x55, 0xFF, 0x55); - palettecga[11] = RGBVAL16(0x55, 0xFF, 0xFF); - palettecga[12] = RGBVAL16(0xFF, 0x55, 0x55); - palettecga[13] = RGBVAL16(0xFF, 0x55, 0xFF); - palettecga[14] = RGBVAL16(0xFF, 0xFF, 0x55); - palettecga[15] = RGBVAL16(0xFF, 0xFF, 0xFF); - palettevga[0] = RGBVAL16(0, 0, 0); - palettevga[1] = RGBVAL16(0, 0, 169); - palettevga[2] = RGBVAL16(0, 169, 0); - palettevga[3] = RGBVAL16(0, 169, 169); - palettevga[4] = RGBVAL16(169, 0, 0); - palettevga[5] = RGBVAL16(169, 0, 169); - palettevga[6] = RGBVAL16(169, 169, 0); - palettevga[7] = RGBVAL16(169, 169, 169); - palettevga[8] = RGBVAL16(0, 0, 84); - palettevga[9] = RGBVAL16(0, 0, 255); - palettevga[10] = RGBVAL16(0, 169, 84); - palettevga[11] = RGBVAL16(0, 169, 255); - palettevga[12] = RGBVAL16(169, 0, 84); - palettevga[13] = RGBVAL16(169, 0, 255); - palettevga[14] = RGBVAL16(169, 169, 84); - palettevga[15] = RGBVAL16(169, 169, 255); - palettevga[16] = RGBVAL16(0, 84, 0); - palettevga[17] = RGBVAL16(0, 84, 169); - palettevga[18] = RGBVAL16(0, 255, 0); - palettevga[19] = RGBVAL16(0, 255, 169); - palettevga[20] = RGBVAL16(169, 84, 0); - palettevga[21] = RGBVAL16(169, 84, 169); - palettevga[22] = RGBVAL16(169, 255, 0); - palettevga[23] = RGBVAL16(169, 255, 169); - palettevga[24] = RGBVAL16(0, 84, 84); - palettevga[25] = RGBVAL16(0, 84, 255); - palettevga[26] = RGBVAL16(0, 255, 84); - palettevga[27] = RGBVAL16(0, 255, 255); - palettevga[28] = RGBVAL16(169, 84, 84); - palettevga[29] = RGBVAL16(169, 84, 255); - palettevga[30] = RGBVAL16(169, 255, 84); - palettevga[31] = RGBVAL16(169, 255, 255); - palettevga[32] = RGBVAL16(84, 0, 0); - palettevga[33] = RGBVAL16(84, 0, 169); - palettevga[34] = RGBVAL16(84, 169, 0); - palettevga[35] = RGBVAL16(84, 169, 169); - palettevga[36] = RGBVAL16(255, 0, 0); - palettevga[37] = RGBVAL16(255, 0, 169); - palettevga[38] = RGBVAL16(255, 169, 0); - palettevga[39] = RGBVAL16(255, 169, 169); - palettevga[40] = RGBVAL16(84, 0, 84); - palettevga[41] = RGBVAL16(84, 0, 255); - palettevga[42] = RGBVAL16(84, 169, 84); - palettevga[43] = RGBVAL16(84, 169, 255); - palettevga[44] = RGBVAL16(255, 0, 84); - palettevga[45] = RGBVAL16(255, 0, 255); - palettevga[46] = RGBVAL16(255, 169, 84); - palettevga[47] = RGBVAL16(255, 169, 255); - palettevga[48] = RGBVAL16(84, 84, 0); - palettevga[49] = RGBVAL16(84, 84, 169); - palettevga[50] = RGBVAL16(84, 255, 0); - palettevga[51] = RGBVAL16(84, 255, 169); - palettevga[52] = RGBVAL16(255, 84, 0); - palettevga[53] = RGBVAL16(255, 84, 169); - palettevga[54] = RGBVAL16(255, 255, 0); - palettevga[55] = RGBVAL16(255, 255, 169); - palettevga[56] = RGBVAL16(84, 84, 84); - palettevga[57] = RGBVAL16(84, 84, 255); - palettevga[58] = RGBVAL16(84, 255, 84); - palettevga[59] = RGBVAL16(84, 255, 255); - palettevga[60] = RGBVAL16(255, 84, 84); - palettevga[61] = RGBVAL16(255, 84, 255); - palettevga[62] = RGBVAL16(255, 255, 84); - palettevga[63] = RGBVAL16(255, 255, 255); - palettevga[64] = RGBVAL16(255, 125, 125); - palettevga[65] = RGBVAL16(255, 157, 125); - palettevga[66] = RGBVAL16(255, 190, 125); - palettevga[67] = RGBVAL16(255, 222, 125); - palettevga[68] = RGBVAL16(255, 255, 125); - palettevga[69] = RGBVAL16(222, 255, 125); - palettevga[70] = RGBVAL16(190, 255, 125); - palettevga[71] = RGBVAL16(157, 255, 125); - palettevga[72] = RGBVAL16(125, 255, 125); - palettevga[73] = RGBVAL16(125, 255, 157); - palettevga[74] = RGBVAL16(125, 255, 190); - palettevga[75] = RGBVAL16(125, 255, 222); - palettevga[76] = RGBVAL16(125, 255, 255); - palettevga[77] = RGBVAL16(125, 222, 255); - palettevga[78] = RGBVAL16(125, 190, 255); - palettevga[79] = RGBVAL16(125, 157, 255); - palettevga[80] = RGBVAL16(182, 182, 255); - palettevga[81] = RGBVAL16(198, 182, 255); - palettevga[82] = RGBVAL16(218, 182, 255); - palettevga[83] = RGBVAL16(234, 182, 255); - palettevga[84] = RGBVAL16(255, 182, 255); - palettevga[85] = RGBVAL16(255, 182, 234); - palettevga[86] = RGBVAL16(255, 182, 218); - palettevga[87] = RGBVAL16(255, 182, 198); - palettevga[88] = RGBVAL16(255, 182, 182); - palettevga[89] = RGBVAL16(255, 198, 182); - palettevga[90] = RGBVAL16(255, 218, 182); - palettevga[91] = RGBVAL16(255, 234, 182); - palettevga[92] = RGBVAL16(255, 255, 182); - palettevga[93] = RGBVAL16(234, 255, 182); - palettevga[94] = RGBVAL16(218, 255, 182); - palettevga[95] = RGBVAL16(198, 255, 182); - palettevga[96] = RGBVAL16(182, 255, 182); - palettevga[97] = RGBVAL16(182, 255, 198); - palettevga[98] = RGBVAL16(182, 255, 218); - palettevga[99] = RGBVAL16(182, 255, 234); - palettevga[100] = RGBVAL16(182, 255, 255); - palettevga[101] = RGBVAL16(182, 234, 255); - palettevga[102] = RGBVAL16(182, 218, 255); - palettevga[103] = RGBVAL16(182, 198, 255); - palettevga[104] = RGBVAL16(0, 0, 113); - palettevga[105] = RGBVAL16(28, 0, 113); - palettevga[106] = RGBVAL16(56, 0, 113); - palettevga[107] = RGBVAL16(84, 0, 113); - palettevga[108] = RGBVAL16(113, 0, 113); - palettevga[109] = RGBVAL16(113, 0, 84); - palettevga[110] = RGBVAL16(113, 0, 56); - palettevga[111] = RGBVAL16(113, 0, 28); - palettevga[112] = RGBVAL16(113, 0, 0); - palettevga[113] = RGBVAL16(113, 28, 0); - palettevga[114] = RGBVAL16(113, 56, 0); - palettevga[115] = RGBVAL16(113, 84, 0); - palettevga[116] = RGBVAL16(113, 113, 0); - palettevga[117] = RGBVAL16(84, 113, 0); - palettevga[118] = RGBVAL16(56, 113, 0); - palettevga[119] = RGBVAL16(28, 113, 0); - palettevga[120] = RGBVAL16(0, 113, 0); - palettevga[121] = RGBVAL16(0, 113, 28); - palettevga[122] = RGBVAL16(0, 113, 56); - palettevga[123] = RGBVAL16(0, 113, 84); - palettevga[124] = RGBVAL16(0, 113, 113); - palettevga[125] = RGBVAL16(0, 84, 113); - palettevga[126] = RGBVAL16(0, 56, 113); - palettevga[127] = RGBVAL16(0, 28, 113); - palettevga[128] = RGBVAL16(56, 56, 113); - palettevga[129] = RGBVAL16(68, 56, 113); - palettevga[130] = RGBVAL16(84, 56, 113); - palettevga[131] = RGBVAL16(97, 56, 113); - palettevga[132] = RGBVAL16(113, 56, 113); - palettevga[133] = RGBVAL16(113, 56, 97); - palettevga[134] = RGBVAL16(113, 56, 84); - palettevga[135] = RGBVAL16(113, 56, 68); - palettevga[136] = RGBVAL16(113, 56, 56); - palettevga[137] = RGBVAL16(113, 68, 56); - palettevga[138] = RGBVAL16(113, 84, 56); - palettevga[139] = RGBVAL16(113, 97, 56); - palettevga[140] = RGBVAL16(113, 113, 56); - palettevga[141] = RGBVAL16(97, 113, 56); - palettevga[142] = RGBVAL16(84, 113, 56); - palettevga[143] = RGBVAL16(68, 113, 56); - palettevga[144] = RGBVAL16(56, 113, 56); - palettevga[145] = RGBVAL16(56, 113, 68); - palettevga[146] = RGBVAL16(56, 113, 84); - palettevga[147] = RGBVAL16(56, 113, 97); - palettevga[148] = RGBVAL16(56, 113, 113); - palettevga[149] = RGBVAL16(56, 97, 113); - palettevga[150] = RGBVAL16(56, 84, 113); - palettevga[151] = RGBVAL16(56, 68, 113); - palettevga[152] = RGBVAL16(80, 80, 113); - palettevga[153] = RGBVAL16(89, 80, 113); - palettevga[154] = RGBVAL16(97, 80, 113); - palettevga[155] = RGBVAL16(105, 80, 113); - palettevga[156] = RGBVAL16(113, 80, 113); - palettevga[157] = RGBVAL16(113, 80, 105); - palettevga[158] = RGBVAL16(113, 80, 97); - palettevga[159] = RGBVAL16(113, 80, 89); - palettevga[160] = RGBVAL16(113, 80, 80); - palettevga[161] = RGBVAL16(113, 89, 80); - palettevga[162] = RGBVAL16(113, 97, 80); - palettevga[163] = RGBVAL16(113, 105, 80); - palettevga[164] = RGBVAL16(113, 113, 80); - palettevga[165] = RGBVAL16(105, 113, 80); - palettevga[166] = RGBVAL16(97, 113, 80); - palettevga[167] = RGBVAL16(89, 113, 80); - palettevga[168] = RGBVAL16(80, 113, 80); - palettevga[169] = RGBVAL16(80, 113, 89); - palettevga[170] = RGBVAL16(80, 113, 97); - palettevga[171] = RGBVAL16(80, 113, 105); - palettevga[172] = RGBVAL16(80, 113, 113); - palettevga[173] = RGBVAL16(80, 105, 113); - palettevga[174] = RGBVAL16(80, 97, 113); - palettevga[175] = RGBVAL16(80, 89, 113); - palettevga[176] = RGBVAL16(0, 0, 64); - palettevga[177] = RGBVAL16(16, 0, 64); - palettevga[178] = RGBVAL16(32, 0, 64); - palettevga[179] = RGBVAL16(48, 0, 64); - palettevga[180] = RGBVAL16(64, 0, 64); - palettevga[181] = RGBVAL16(64, 0, 48); - palettevga[182] = RGBVAL16(64, 0, 32); - palettevga[183] = RGBVAL16(64, 0, 16); - palettevga[184] = RGBVAL16(64, 0, 0); - palettevga[185] = RGBVAL16(64, 16, 0); - palettevga[186] = RGBVAL16(64, 32, 0); - palettevga[187] = RGBVAL16(64, 48, 0); - palettevga[188] = RGBVAL16(64, 64, 0); - palettevga[189] = RGBVAL16(48, 64, 0); - palettevga[190] = RGBVAL16(32, 64, 0); - palettevga[191] = RGBVAL16(16, 64, 0); - palettevga[192] = RGBVAL16(0, 64, 0); - palettevga[193] = RGBVAL16(0, 64, 16); - palettevga[194] = RGBVAL16(0, 64, 32); - palettevga[195] = RGBVAL16(0, 64, 48); - palettevga[196] = RGBVAL16(0, 64, 64); - palettevga[197] = RGBVAL16(0, 48, 64); - palettevga[198] = RGBVAL16(0, 32, 64); - palettevga[199] = RGBVAL16(0, 16, 64); - palettevga[200] = RGBVAL16(32, 32, 64); - palettevga[201] = RGBVAL16(40, 32, 64); - palettevga[202] = RGBVAL16(48, 32, 64); - palettevga[203] = RGBVAL16(56, 32, 64); - palettevga[204] = RGBVAL16(64, 32, 64); - palettevga[205] = RGBVAL16(64, 32, 56); - palettevga[206] = RGBVAL16(64, 32, 48); - palettevga[207] = RGBVAL16(64, 32, 40); - palettevga[208] = RGBVAL16(64, 32, 32); - palettevga[209] = RGBVAL16(64, 40, 32); - palettevga[210] = RGBVAL16(64, 48, 32); - palettevga[211] = RGBVAL16(64, 56, 32); - palettevga[212] = RGBVAL16(64, 64, 32); - palettevga[213] = RGBVAL16(56, 64, 32); - palettevga[214] = RGBVAL16(48, 64, 32); - palettevga[215] = RGBVAL16(40, 64, 32); - palettevga[216] = RGBVAL16(32, 64, 32); - palettevga[217] = RGBVAL16(32, 64, 40); - palettevga[218] = RGBVAL16(32, 64, 48); - palettevga[219] = RGBVAL16(32, 64, 56); - palettevga[220] = RGBVAL16(32, 64, 64); - palettevga[221] = RGBVAL16(32, 56, 64); - palettevga[222] = RGBVAL16(32, 48, 64); - palettevga[223] = RGBVAL16(32, 40, 64); - palettevga[224] = RGBVAL16(44, 44, 64); - palettevga[225] = RGBVAL16(48, 44, 64); - palettevga[226] = RGBVAL16(52, 44, 64); - palettevga[227] = RGBVAL16(60, 44, 64); - palettevga[228] = RGBVAL16(64, 44, 64); - palettevga[229] = RGBVAL16(64, 44, 60); - palettevga[230] = RGBVAL16(64, 44, 52); - palettevga[231] = RGBVAL16(64, 44, 48); - palettevga[232] = RGBVAL16(64, 44, 44); - palettevga[233] = RGBVAL16(64, 48, 44); - palettevga[234] = RGBVAL16(64, 52, 44); - palettevga[235] = RGBVAL16(64, 60, 44); - palettevga[236] = RGBVAL16(64, 64, 44); - palettevga[237] = RGBVAL16(60, 64, 44); - palettevga[238] = RGBVAL16(52, 64, 44); - palettevga[239] = RGBVAL16(48, 64, 44); - palettevga[240] = RGBVAL16(44, 64, 44); - palettevga[241] = RGBVAL16(44, 64, 48); - palettevga[242] = RGBVAL16(44, 64, 52); - palettevga[243] = RGBVAL16(44, 64, 60); - palettevga[244] = RGBVAL16(44, 64, 64); - palettevga[245] = RGBVAL16(44, 60, 64); - palettevga[246] = RGBVAL16(44, 52, 64); - palettevga[247] = RGBVAL16(44, 48, 64); - palettevga[248] = RGBVAL16(0, 0, 0); - palettevga[249] = RGBVAL16(0, 0, 0); - palettevga[250] = RGBVAL16(0, 0, 0); - palettevga[251] = RGBVAL16(0, 0, 0); - palettevga[252] = RGBVAL16(0, 0, 0); - palettevga[253] = RGBVAL16(0, 0, 0); - palettevga[254] = RGBVAL16(0, 0, 0); - palettevga[255] = RGBVAL16(0, 0, 0); -} - -extern uint8_t vidmode, portram[0x400]; - -#define XRES_MAX 640 -#define XRES_HI 640 -#define XRES_LO 320 -#define YRES 200 - -#include "font.h" - - -static unsigned short line[XRES_MAX]; - -void drawscreentext80(void) { - uint16_t row, col, y, x, xpos; - uint16_t fontdata; - - for (y=0; y<(25*8); y++) - { - row = y>>3; - uint8_t * vrampt=&VRAM[160*row]; - xpos = 0; - for (col=0; col<80; col++) - { - uint8_t bold, attrib, cc, bg, fg; - cc = *vrampt++; - attrib = *vrampt++; - bg = (attrib >> 4) & 7; - fg = attrib & 0x0F; - //if (y == 0) {printf("0x%02X",cc);} - fontdata = ROM_READ(font, ((uint32_t)cc << 3) + (y&0x7)); - for (x=0; x<8; x++) - //for (x=0; x<4; x++) - { - if (fontdata & 1) { - line[xpos++] = palettecga[fg]; - } else { - line[xpos++] = palettecga[bg]; - } - fontdata >>= 1; - //fontdata >>= 2; - } - } - emu_DrawLine16(&line[0], XRES_HI, YRES, y); - } -} - -void drawscreenlorescga(void) { - uint16_t y, x, xpos; - uint8_t intensity, usepal; - uint16_t color; - usepal = (portram[0x3D9]>>5) & 1; - intensity = ( (portram[0x3D9]>>4) & 1) << 3; - - for (y=0; y<(25*8); y++) - { - xpos = 0; - for (x=0; x> 1; - int xchar = x;// >> 1; - uint8_t curchar = VRAM[((ychar & 1) * 8192 + (ychar >> 1) * 80 + (xchar >> 2))]; - switch (xchar & 3) { - case 3: color = curchar & 3; break; - case 2: color = (curchar >> 2) & 3; break; - case 1: color = (curchar >> 4) & 3; break; - case 0: color = (curchar >> 6) & 3; break; - } - color = (color << 1) + usepal + intensity; - if (color == (usepal + intensity)) color = 0; - line[xpos++] = palettecga[color]; - } - emu_DrawLine16(&line[0], XRES_LO, YRES, y); - } -} - - -void drawscreenhirescga(void) { - uint16_t y, x, xpos; - uint16_t color; - for (y=0; y<(25*8); y++) - { - xpos = 0; - for (x=0; x> 1; - int xchar = x; - uint8_t curchar = VRAM[((ychar & 1) * 8192 + (ychar >> 1) * 80 + (xchar >> 3))]; - color = ((curchar >> (7-(x&7))) & 1) ? 15 : 0; - line[xpos++] = palettecga[color]; - } - emu_DrawLine16(&line[0], XRES_HI, YRES, y); - } -} - - -void updatescreen() { - switch (vidmode & 0x7F) { - case 0: - case 1: - //drawtext40(origaddr, value); - break; - case 2: - case 3: - //case 7: - drawscreentext80(); - break; - case 4: - drawscreenlorescga(); - break; - case 5: - drawscreenlorescga(); //change to BW function later - break; - case 6: - drawscreenhirescga(); - break; - } -//printf("%d\n",vidmode & 0x7F); -} - -static uint8_t nbkeys=0; -static uint8_t kcnt=0; -static int toggle=1; - -static char * seq; -static char * seq1="PRINCE.BAT\r"; -static char * seq2="CAT.EXE\r"; -static char * seq3="y\r"; - -static int mouse_x = 160; -static int mouse_y = 100; -static int prev_key = 0; -static int prev_j = 0; -static int prev_mouseb = 0; -static bool isMouse = true; -static int joynum = 1; -static int hk = 0; -static int prev_hk = 0; -static int k = 0; - -static void keyevent(int keysym, int isdown) -{ - uint8_t scancode = translatescancode(keysym); - if (scancode != 0xFF) { - portram[0x60] = scancode; - if (!isdown) portram[0x60] |= 0x80; - portram[0x64] |= 2; - doirq(1); - } -} - -extern void apc_Input(int bClick) { - hk = emu_ReadI2CKeyboard(); - k = emu_ReadKeys(); - - if (nbkeys == 0) { - if ( (bClick & MASK_KEY_USER1) && (bClick & MASK_KEY_USER2) ) { - nbkeys = strlen(seq3); - seq=seq3; - kcnt=0; - } - else if (bClick & MASK_KEY_USER1) { - nbkeys = strlen(seq1); - seq=seq1; - kcnt=0; - } - else if (bClick & MASK_KEY_USER2) { - nbkeys = strlen(seq2); - seq=seq2; - kcnt=0; - } - - } - else { - char k = seq[kcnt]; - if (k == 13) keyevent(0xFF0D,toggle); - else keyevent(k,toggle); - //setKey(ascii2scan[k],toggle); - if (!toggle) { - kcnt++; - nbkeys--; - toggle = true; - } - else { - toggle = false; - } - } -} - -static void do_events(void) -{ - if (hk != prev_hk) { - prev_hk == hk; - if ( (hk != 0) && (hk != prev_key) ) { - prev_key = hk; - keyevent ( hk, 0 ); - if (hk == 68) { - if (isMouse) isMouse = false; - else isMouse = true; - } - } - } - if ( (hk == 0) && (prev_key) ) { - keyevent ( prev_key, 1 ); - prev_key = 0; - } - - - if (!isMouse) - { - int j = 0; - if (( k & MASK_JOY1_RIGHT) || ( k & MASK_JOY2_RIGHT)) { - j |= 0x08; - } - if (( k & MASK_JOY1_LEFT) || ( k & MASK_JOY2_LEFT)) { - j |= 0x04; - } - if (( k & MASK_JOY1_UP) || ( k & MASK_JOY2_UP)) { - j |= 0x01; - } - if (( k & MASK_JOY1_DOWN) || ( k & MASK_JOY2_DOWN)) { - j |= 0x02; - } - if ( k & MASK_JOY2_BTN) { - j |= 0x80; - } - if (j != prev_j) { - //IkbdJoystickChange(joynum,j); - prev_j = j; - } - } - else { - if (( k & MASK_JOY1_RIGHT) || ( k & MASK_JOY2_RIGHT)) { - if ( mouse_x < XRES_HI ) { - mouse_x += 1; - } - } - else if (( k & MASK_JOY1_LEFT) || ( k & MASK_JOY2_LEFT)) { - if ( mouse_x > 1 ) { - mouse_x -= 1; - } - } - else if (( k & MASK_JOY1_UP) || ( k & MASK_JOY2_UP)) { - if ( mouse_y > 1 ) { - mouse_y -= 1; - } - } - else if (( k & MASK_JOY1_DOWN) || ( k & MASK_JOY2_DOWN)) { - if ( mouse_y < YRES ) { - mouse_y += 1; - } - } - - int mouseb=0; - if ( ( k & MASK_JOY2_BTN) ){ - mouseb=1; - } - if ( (mouseb != prev_mouseb) ){ - prev_mouseb = mouseb; - } - } -} - -void emu_KeyboardOnDown(int keymodifer, int key) { -} - -void emu_KeyboardOnUp(int keymodifer, int key) { -} - -void apc_Step(void) -{ - exec86(8000); - updatescreen(); - do_events(); - emu_DrawVsync(); -} - - - -void apc_Init(void) -{ -#ifdef HAS_PSRAM - psram.begin(); -#endif - installPalette(); - init8253(); - reset86(); - init8259(); -} - -void apc_Start(char * filename) -{ - emu_printf("init started"); - initDisk(filename); - emu_printf("init done"); -} diff --git a/MCUME_pico/pico8086/pc.h b/MCUME_pico/pico8086/pc.h deleted file mode 100644 index 2b13c4a..0000000 --- a/MCUME_pico/pico8086/pc.h +++ /dev/null @@ -1,5 +0,0 @@ -extern void apc_Init(void); -extern void apc_Step(void); -extern void apc_Start(char * filename); -extern void apc_Input(int click); - diff --git a/MCUME_pico/pico8086/pico8086.cpp b/MCUME_pico/pico8086/pico8086.cpp deleted file mode 100644 index 8692588..0000000 --- a/MCUME_pico/pico8086/pico8086.cpp +++ /dev/null @@ -1,178 +0,0 @@ -#include "pico.h" -#include "pico/stdlib.h" - -extern "C" { - #include "iopins.h" - #include "emuapi.h" -} -#include "keyboard_osd.h" - -#include "pc.h" -#include - -#ifdef USE_VGA -#include "vga_t_dma.h" -#else -#include "tft_t_dma.h" -#endif -volatile bool vbl=true; - -bool repeating_timer_callback(struct repeating_timer *t) { - if (vbl) { - vbl = false; - } else { - vbl = true; - } - return true; -} -TFT_T_DMA tft; - -static int skip=0; - -#include "hardware/clocks.h" -#include "hardware/vreg.h" - -int main(void) { - vreg_set_voltage(VREG_VOLTAGE_1_05); -// set_sys_clock_khz(125000, true); -// set_sys_clock_khz(150000, true); -// set_sys_clock_khz(133000, true); -// set_sys_clock_khz(200000, true); -// set_sys_clock_khz(225000, true); - set_sys_clock_khz(150000, true); - stdio_init_all(); -#ifdef USE_VGA -// tft.begin(VGA_MODE_400x240); - tft.begin(VGA_MODE_320x240); -#else - tft.begin(); -#endif - emu_init(); - while (true) { - if (menuActive()) { - uint16_t bClick = emu_DebounceLocalKeys(); - int action = handleMenu(bClick); - char * filename = menuSelection(); - if (action == ACTION_RUNTFT) { - toggleMenu(false); - emu_start(); - emu_Init(filename); - tft.fillScreenNoDma( RGBVAL16(0x00,0x00,0x00) ); - tft.startDMA(); - struct repeating_timer timer; - add_repeating_timer_ms(15, repeating_timer_callback, NULL, &timer); - } - tft.waitSync(); - } - else { - uint16_t bClick = emu_DebounceLocalKeys(); - emu_Input(bClick); - emu_Step(); - } - //int c = getchar_timeout_us(0); - //switch (c) { - // case ' ': - // printf("test: %d\n", 1); - // break; - //} - } -} - -static unsigned char palette8[PALETTE_SIZE]; -static unsigned short palette16[PALETTE_SIZE]; - -void emu_SetPaletteEntry(unsigned char r, unsigned char g, unsigned char b, int index) -{ - if (index -#include "emu.h" - -volatile uint16_t pit0counter = 65535; -volatile uint32_t speakercountdown, latch42, pit0latch, pit0command, pit0divisor; -uint8_t portram[0x400]; -uint8_t crt_controller_idx, crt_controller[256], port3D9 = 0; - -void portout(uint16_t portnum, uint16_t value) { - if (portnum < 0x400) portram[portnum] = value; - switch (portnum) { - case 0x20: - case 0x21: //i8259 - out8259(portnum, value); - return; - case 0x40: - case 0x41: - case 0x42: - case 0x43: //i8253 - out8253(portnum, value); - break; - case 0x3D4: - crt_controller_idx = value; - break; - case 0x3D5: - crt_controller[crt_controller_idx] = value; - if ((crt_controller_idx == 0x0E) || (crt_controller_idx == 0x0F)) { - //setcursor(((uint16_t)crt_controller[0x0E] << 8) | crt_controller[0x0F]); - //Serial.write(27); Serial.write('['); Serial.print(crt_controller[0x0E] + 1); Serial.write(';'); Serial.print(crt_controller[0x0F] + 1); Serial.write('H'); - } - break; - case 0x3D9: - port3D9 = value; - break; - } - -#ifdef ADVANCED_CLIENT - if ((portnum >= 0x3C0) && (portnum <= 0x3DA)) { - uint8_t chksum; - Serial.write(0xFF); - Serial.write(0x04); - outByte(portnum & 0xFF); chksum = portnum & 0xFF; - outByte(portnum >> 8); chksum += portnum >> 8; - outByte(value); chksum += value; - outByte(chksum); - Serial.write(0xFE); - Serial.write(0x02); - } -#endif - -#ifdef VGA - if ((portnum >= 0x3C0) && (portnum <= 0x3DA)) outVGA(portnum, value); -#endif -} - -uint16_t portin(uint16_t portnum) { -#ifdef VGA - if ((portnum >= 0x3C0) && (portnum <= 0x3DA)) return inVGA(portnum); -#endif -/* uint8_t chksum; - Serial.write(0xFF); - Serial.write(0x07); - outByte(portnum & 0xFF); chksum = portnum & 0xFF; - outByte((portnum >> 8) & 0xFF); chksum += (portnum >> 8) & 0xFF; - outByte(chksum); - Serial.write(0xFE); - Serial.write(0x02);*/ - switch (portnum) { - case 0x20: - case 0x21: //i8259 - return (in8259(portnum)); - case 0x40: - case 0x41: - case 0x42: - case 0x43: //i8253 - return in8253(portnum); - case 0x60: - case 0x64: - return portram[portnum]; - case 0x3D4: - return crt_controller_idx; - break; - case 0x3D5: - return crt_controller[crt_controller_idx]; - break; - case 0x3DA: - port3da ^= 1; - if (!(port3da & 1)) port3da ^= 8; - //port3da = random(256) & 9; - return (port3da); - default: - return (0xFF); - } -} - - diff --git a/MCUME_pico/pico8086/ps2.h b/MCUME_pico/pico8086/ps2.h deleted file mode 100755 index dc6f578..0000000 --- a/MCUME_pico/pico8086/ps2.h +++ /dev/null @@ -1,89 +0,0 @@ -uint8_t translatescancode(uint32_t keysym) { - if ((keysym >= 'a') && (keysym <= 'z')) { - keysym -= 0x20; - } - switch (keysym) { - case 0xFF08: return 0x0E; //backspace - case 0xFF09: return 0x0F; //tab - case 0xFF0D: return 0x1C; //enter - case 0xFF1B: return 0x01; //escape - case 0xFF63: return 0x52; //KP 0 / insert - case 0xFFFF: return 0x53; //KP . / delete - case 0xFF55: return 0x49; //pgup - case 0xFF56: return 0x51; //pgdn - case 0xFF50: return 0x47; //home - case 0xFF57: return 0x4F; //end - case 'A': return 0x1E; - case 'B': return 0x30; - case 'C': return 0x2E; - case 'D': return 0x20; - case 'E': return 0x12; - case 'F': return 0x21; - case 'G': return 0x22; - case 'H': return 0x23; - case 'I': return 0x17; - case 'J': return 0x24; - case 'K': return 0x25; - case 'L': return 0x26; - case 'M': return 0x32; - case 'N': return 0x31; - case 'O': return 0x18; - case 'P': return 0x19; - case 'Q': return 0x10; - case 'R': return 0x13; - case 'S': return 0x1F; - case 'T': return 0x14; - case 'U': return 0x16; - case 'V': return 0x2F; - case 'W': return 0x11; - case 'X': return 0x2D; - case 'Y': return 0x15; - case 'Z': return 0x2C; - case '0': case ')': return 0x0B; - case '1': case '!': return 0x02; - case '2': case '@': return 0x03; - case '3': case '#': return 0x04; - case '4': case '$': return 0x05; - case '5': case '%': return 0x06; - case '6': case '^': return 0x07; - case '7': case '&': return 0x08; - case '8': case '*': return 0x09; - case '9': case '(': return 0x0A; - case '`': case '~': return 0x29; - case '-': case '_': return 0x0C; - case '=': case '+': return 0x0D; - case '[': case '{': return 0x1A; - case ']': case '}': return 0x1B; - case '\\': case '|': return 0x2B; - case ';': case ':': return 0x27; - case '\'': case '"': return 0x28; - case ' ': return 0x39; - case ',': case '<': return 0x33; - case '.': case '>': return 0x34; - case '/': case '?': return 0x35; - case 0xFFBE: return 0x3B; //F1 - case 0xFFBF: return 0x3C; //F2 - case 0xFFC0: return 0x3D; //F3 - case 0xFFC1: return 0x3E; //F4 - case 0xFFC2: return 0x3F; //F5 - case 0xFFC3: return 0x40; //F6 - case 0xFFC4: return 0x41; //F7 - case 0xFFC5: return 0x42; //F8 - case 0xFFC6: return 0x43; //F9 - case 0xFFC7: return 0x44; //F10 - case 0xFFC8: return 0x57; //F11 - case 0xFFC9: return 0x58; //F12 - case 0xFFE1: return 0x2A; //left shift - case 0xFFE2: return 0x36; //right shift - case 0xFFE3: case 0xFFE4: return 0x1D; //control - case 0xFFE9: case 0xFFEA: return 0x38; //alt - case 0xFF51: return 0x4B; //left - case 0xFF52: return 0x48; //up - case 0xFF53: return 0x4D; //right - case 0xFF54: return 0x50; //down - } - return 0xFF; -} - - - diff --git a/MCUME_pico/pico8086/rom.h b/MCUME_pico/pico8086/rom.h deleted file mode 100644 index ca3cb84..0000000 --- a/MCUME_pico/pico8086/rom.h +++ /dev/null @@ -1,3749 +0,0 @@ -#ifdef MEGA - #include - const uint8_t BIOS[8192] PROGMEM = { -#else - const uint8_t BIOS[8192] = { -#endif - 0x54, 0x75, 0x72, 0x62, 0x6F, 0x20, 0x58, 0x54, 0x20, 0x42, 0x49, - 0x4F, 0x53, 0x20, 0x76, 0x32, 0x2E, 0x35, 0x20, 0x66, 0x6F, 0x72, - 0x20, 0x38, 0x30, 0x38, 0x38, 0x2F, 0x56, 0x32, 0x30, 0x00, 0xC3, - 0x20, 0x45, 0x47, 0x41, 0x2F, 0x56, 0x47, 0x41, 0x20, 0x47, 0x72, - 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x00, 0xC3, 0x20, 0x50, 0x61, - 0x72, 0x61, 0x6C, 0x6C, 0x65, 0x6C, 0x20, 0x50, 0x6F, 0x72, 0x74, - 0x20, 0x61, 0x74, 0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, 0xC7, - 0x05, 0xF8, 0x03, 0x47, 0x47, 0xBA, 0xFB, 0x02, 0xB0, 0x1A, 0xEE, - 0xB0, 0xFF, 0xE6, 0xC0, 0xEC, 0x3C, 0x1A, 0x75, 0x06, 0xC7, 0x05, - 0xF8, 0x02, 0x47, 0x47, 0x8B, 0xC7, 0x08, 0x06, 0x11, 0x00, 0xB9, - 0x64, 0x00, 0xBA, 0x01, 0x02, 0xEC, 0x3C, 0xFF, 0x75, 0x05, 0x49, - 0xE3, 0x07, 0xEB, 0xF6, 0x80, 0x0E, 0x11, 0x00, 0x10, 0xE8, 0x65, - 0x04, 0xBA, 0x00, 0xC0, 0x8B, 0x1E, 0x72, 0x00, 0x53, 0x1E, 0xE4, - 0x61, 0x34, 0x0C, 0xE6, 0x61, 0x8E, 0xDA, 0xEB, 0x13, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xE9, 0x99, 0x15, 0x33, 0xDB, 0x8B, 0x07, 0x3D, - 0x55, 0xAA, 0x75, 0x36, 0xB8, 0x40, 0x00, 0x8E, 0xC0, 0xB4, 0x00, - 0x8A, 0x47, 0x02, 0xB1, 0x05, 0xD3, 0xE0, 0x03, 0xD0, 0xB1, 0x04, - 0xD3, 0xE0, 0x8B, 0xC8, 0xE8, 0x27, 0x17, 0x75, 0x15, 0x52, 0x26, - 0xC7, 0x06, 0x67, 0x00, 0x03, 0x00, 0x26, 0x8C, 0x1E, 0x69, 0x00, - 0x26, 0xFF, 0x1E, 0x67, 0x00, 0x5A, 0xEB, 0x0A, 0x26, 0x80, 0x0E, - 0x15, 0x00, 0x20, 0x81, 0xC2, 0x80, 0x00, 0x81, 0xFA, 0x00, 0xF6, - 0x7C, 0xA0, 0x1F, 0x5B, 0x89, 0x1E, 0x72, 0x00, 0xE4, 0x21, 0x24, - 0xBC, 0xE6, 0x21, 0xB4, 0x12, 0xBB, 0x10, 0xFF, 0xCD, 0x10, 0x80, - 0xFF, 0xFF, 0x74, 0x07, 0x80, 0x26, 0x10, 0x00, 0xCF, 0xEB, 0x09, - 0xA0, 0x49, 0x00, 0xE8, 0xDF, 0x0B, 0xE8, 0x90, 0x16, 0xB4, 0x01, - 0xB5, 0xF0, 0xCD, 0x10, 0xE8, 0xDB, 0x01, 0xC6, 0x06, 0x96, 0x00, - 0x10, 0x81, 0x3E, 0x72, 0x00, 0x34, 0x12, 0x1E, 0x07, 0x0E, 0x1F, - 0x75, 0x05, 0xB7, 0xFD, 0xE9, 0x28, 0x01, 0xBE, 0x00, 0xE0, 0xE8, - 0x3E, 0x16, 0xBE, 0x5C, 0xE5, 0xE8, 0x20, 0x16, 0x26, 0xF6, 0x06, - 0x15, 0x00, 0xFF, 0x74, 0x3E, 0xB8, 0x00, 0x03, 0xE8, 0x1D, 0x16, - 0xBE, 0xF9, 0xE7, 0xE8, 0x0C, 0x16, 0x26, 0xA0, 0x15, 0x00, 0xE8, - 0xE2, 0x15, 0xBE, 0x42, 0xF9, 0xE8, 0xFF, 0x15, 0xB3, 0x02, 0xE8, - 0x60, 0x16, 0xE8, 0x58, 0x16, 0x50, 0xE8, 0xE8, 0x15, 0x58, 0x3C, - 0x59, 0x74, 0x09, 0x3C, 0x79, 0x74, 0x05, 0xEA, 0x5B, 0xE0, 0x00, - 0xF0, 0x26, 0xC6, 0x06, 0x15, 0x00, 0x00, 0xE8, 0x75, 0x01, 0xEB, - 0xAE, 0xB8, 0x00, 0x03, 0xE8, 0xDF, 0x15, 0xE8, 0x84, 0x01, 0xBE, - 0xB1, 0xE5, 0xB8, 0x07, 0x04, 0xE8, 0xD3, 0x15, 0x26, 0xA0, 0x49, - 0x00, 0x3C, 0x07, 0x74, 0x10, 0x26, 0xA0, 0x10, 0x00, 0x24, 0x30, - 0x75, 0x05, 0xBE, 0x20, 0xE0, 0xEB, 0x03, 0xBE, 0x36, 0xF0, 0xE8, - 0xAD, 0x15, 0xBB, 0x07, 0x05, 0x26, 0xA0, 0x11, 0x00, 0x50, 0xB1, - 0x06, 0xD2, 0xC8, 0x24, 0x03, 0x74, 0x09, 0xBD, 0x08, 0x00, 0xBE, - 0x33, 0xE0, 0xE8, 0xC9, 0x00, 0x58, 0x50, 0xBE, 0x19, 0xF9, 0xD0, - 0xC8, 0x24, 0x03, 0x74, 0x05, 0x33, 0xED, 0xE8, 0xB9, 0x00, 0x58, - 0xBE, 0x47, 0xE0, 0xA8, 0x10, 0x74, 0x0A, 0x8B, 0xC3, 0xE8, 0x82, - 0x15, 0xE8, 0x74, 0x15, 0xFE, 0xC7, 0xE8, 0xF0, 0x00, 0x72, 0x0D, - 0x8B, 0xC3, 0xE8, 0x73, 0x15, 0xFE, 0xC7, 0xBE, 0xC2, 0xFF, 0xE8, - 0x60, 0x15, 0xFE, 0xCF, 0xB3, 0x07, 0x8B, 0xC3, 0xE8, 0x62, 0x15, - 0xBE, 0xA2, 0xF0, 0xE8, 0x51, 0x15, 0xFE, 0xC7, 0xFE, 0xC7, 0x32, - 0xDB, 0x8B, 0xC3, 0xE8, 0x51, 0x15, 0xBE, 0x9C, 0xE5, 0xE8, 0x40, - 0x15, 0x06, 0x26, 0x8B, 0x2E, 0x13, 0x00, 0x4D, 0x4D, 0xBE, 0x02, - 0x00, 0x8B, 0xD6, 0xB8, 0x80, 0x00, 0x8E, 0xC0, 0x80, 0xC3, 0x0D, - 0x53, 0x58, 0x50, 0x8C, 0xC1, 0x83, 0xFD, 0x01, 0x74, 0x09, 0xF7, - 0xC1, 0xFF, 0x01, 0x74, 0x02, 0x32, 0xED, 0x4A, 0xE8, 0x20, 0x15, - 0xE8, 0x69, 0x00, 0x42, 0xE8, 0xA5, 0x15, 0x72, 0x2D, 0x4D, 0x75, - 0xDF, 0x5B, 0x07, 0xE8, 0x13, 0x13, 0xB3, 0x01, 0xE8, 0x65, 0x15, - 0xE8, 0x95, 0x00, 0x33, 0xC0, 0x8E, 0xD8, 0xC7, 0x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, 0x14, 0xBE, 0x00, 0xF8, 0x26, 0xF6, 0x06, 0x10, 0x00, - 0x02, 0x74, 0x03, 0xBE, 0x08, 0xF8, 0xE8, 0x30, 0x14, 0xC3, 0x50, - 0x8A, 0xC4, 0xE8, 0x06, 0x14, 0xE9, 0x16, 0x14, 0x0D, 0x0A, 0x42, - 0x49, 0x4F, 0x53, 0x20, 0x62, 0x79, 0x20, 0x59, 0x2E, 0x20, 0x4D, - 0x69, 0x6C, 0x65, 0x73, 0x20, 0x61, 0x6E, 0x64, 0x20, 0x4A, 0x2E, - 0x20, 0x50, 0x65, 0x74, 0x72, 0x6F, 0x73, 0x6B, 0x79, 0x2C, 0x20, - 0x41, 0x72, 0x64, 0x75, 0x69, 0x6E, 0x6F, 0x38, 0x36, 0x20, 0x62, - 0x79, 0x20, 0x4D, 0x69, 0x6B, 0x65, 0x20, 0x43, 0x68, 0x61, 0x6D, - 0x62, 0x65, 0x72, 0x73, 0x00, 0x00, 0x54, 0x65, 0x73, 0x74, 0x69, - 0x6E, 0x67, 0x20, 0x52, 0x41, 0x4D, 0x3A, 0x20, 0x20, 0x20, 0x20, - 0x4B, 0x20, 0x4F, 0x4B, 0x00, 0xC3, 0x20, 0x4D, 0x6F, 0x6E, 0x6F, - 0x2F, 0x48, 0x65, 0x72, 0x63, 0x75, 0x6C, 0x65, 0x73, 0x20, 0x47, - 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x00, 0x49, 0x6E, 0x73, - 0x65, 0x72, 0x74, 0x20, 0x42, 0x4F, 0x4F, 0x54, 0x20, 0x64, 0x69, - 0x73, 0x6B, 0x20, 0x69, 0x6E, 0x20, 0x41, 0x3A, 0x0D, 0x0A, 0x50, - 0x72, 0x65, 0x73, 0x73, 0x20, 0x61, 0x6E, 0x79, 0x20, 0x6B, 0x65, - 0x79, 0x20, 0x77, 0x68, 0x65, 0x6E, 0x20, 0x72, 0x65, 0x61, 0x64, - 0x79, 0x0D, 0x0A, 0x0A, 0x00, 0xFF, 0xFF, 0xFB, 0x33, 0xC0, 0x8E, - 0xD8, 0xC7, 0x06, 0x78, 0x00, 0xC7, 0xEF, 0x8C, 0x0E, 0x7A, 0x00, - 0xB8, 0x06, 0x00, 0x50, 0x33, 0xD2, 0x3C, 0x02, 0x77, 0x03, 0x80, - 0xCA, 0x80, 0x52, 0xB4, 0x00, 0xCD, 0x13, 0x5A, 0x72, 0x17, 0x33, - 0xC0, 0x8E, 0xC0, 0xB8, 0x01, 0x02, 0xBB, 0x00, 0x7C, 0xB1, 0x01, - 0xB5, 0x00, 0xCD, 0x13, 0x72, 0x05, 0xEA, 0x00, 0x7C, 0x00, 0x00, - 0x58, 0xFE, 0xC8, 0x75, 0xD2, 0x0A, 0xE4, 0x75, 0x10, 0x0E, 0x1F, - 0xBE, 0xCA, 0xE5, 0xE8, 0x36, 0x13, 0xE8, 0x94, 0x13, 0xB8, 0x08, - 0xFF, 0xEB, 0xBE, 0x33, 0xC0, 0x8E, 0xD8, 0xA1, 0x62, 0x00, 0x3D, - 0x00, 0xF6, 0x75, 0xE4, 0xCD, 0x18, 0x3C, 0xE0, 0x75, 0x10, 0x80, - 0xCB, 0x02, 0x59, 0x50, 0x55, 0x8B, 0xEC, 0xC7, 0x46, 0x02, 0xB3, - 0xE9, 0x5D, 0xEB, 0x54, 0x3C, 0x57, 0x74, 0x55, 0x3C, 0x58, 0x74, - 0x51, 0xF6, 0xC3, 0x02, 0x74, 0x47, 0x80, 0xE3, 0xFD, 0x3C, 0xAA, - 0x75, 0x06, 0x8A, 0xC7, 0x0C, 0x80, 0x8A, 0xE0, 0x8A, 0xF8, 0x8A, - 0xC8, 0x80, 0xE1, 0x7F, 0x80, 0xF9, 0x2A, 0x74, 0xCD, 0x80, 0xF9, - 0x36, 0x74, 0xC8, 0x3C, 0x35, 0x74, 0x25, 0x3C, 0x1C, 0x74, 0x21, - 0x3C, 0x1D, 0x74, 0x1D, 0x3C, 0x38, 0x74, 0x19, 0x3C, 0x46, 0x74, - 0x15, 0xE8, 0x88, 0x08, 0xE8, 0xFA, 0x04, 0x72, 0x0D, 0xB0, 0xE0, - 0x59, 0x50, 0x55, 0x8B, 0xEC, 0xC7, 0x46, 0x02, 0xA4, 0xEB, 0x5D, - 0x89, 0x1E, 0x96, 0x00, 0xC3, 0x80, 0xC4, 0x2E, 0xA0, 0x17, 0x00, - 0xA8, 0x08, 0x75, 0x0A, 0xA8, 0x04, 0x75, 0x09, 0xA8, 0x03, 0x75, - 0x08, 0xEB, 0x09, 0x80, 0xC4, 0x02, 0x80, 0xC4, 0x02, 0x80, 0xC4, - 0x02, 0x32, 0xC0, 0xEB, 0xCF, 0xFF, 0xFF, 0xE9, 0x0B, 0xFF, 0x32, - 0xC0, 0xB0, 0x40, 0xF6, 0xE0, 0x74, 0x04, 0xBE, 0xEB, 0xF7, 0xC3, - 0xBE, 0xF6, 0xF7, 0xC3, 0xDB, 0xE3, 0xBE, 0x00, 0x02, 0xC6, 0x44, - 0x01, 0x00, 0xD9, 0x3C, 0x8A, 0x64, 0x01, 0x80, 0xFC, 0x03, 0x75, - 0x06, 0x80, 0x0E, 0x10, 0x00, 0x02, 0xC3, 0x80, 0x26, 0x10, 0x00, - 0xFD, 0xC3, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x17, 0x04, 0x00, 0x03, - 0x80, 0x01, 0xC0, 0x00, 0x60, 0x00, 0x30, 0x00, 0x18, 0x00, 0x0C, - 0x00, 0xFB, 0x1E, 0x52, 0x56, 0x57, 0x51, 0x53, 0xBB, 0x40, 0x00, - 0x8E, 0xDB, 0x8B, 0xFA, 0x8B, 0xDA, 0xD1, 0xE3, 0x8B, 0x17, 0x0B, - 0xD2, 0x74, 0x10, 0x0A, 0xE4, 0x74, 0x13, 0xFE, 0xCC, 0x74, 0x3A, - 0xFE, 0xCC, 0x74, 0x53, 0xFE, 0xCC, 0x74, 0x63, 0x5B, 0x59, 0x5F, - 0x5E, 0x5A, 0x1F, 0xCF, 0x50, 0x8A, 0xD8,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- 0xC1, 0xE8, 0xBA, 0x03, 0xB0, 0x00, 0x73, 0x25, 0xFE, 0xC0, 0xEB, - 0x21, 0xFF, 0xFF, 0xFF, 0xFB, 0x1E, 0x53, 0xBB, 0x40, 0x00, 0x8E, - 0xDB, 0x80, 0xFC, 0x05, 0x74, 0xE3, 0x8B, 0xD8, 0x80, 0xE4, 0x0F, - 0x0A, 0xE4, 0x74, 0x0B, 0xFE, 0xCC, 0x74, 0xC0, 0xFE, 0xCC, 0x74, - 0xCD, 0x5B, 0x1F, 0xCF, 0xFA, 0xA1, 0x1A, 0x00, 0x3B, 0x06, 0x1C, - 0x00, 0x75, 0x03, 0xFB, 0xEB, 0xF3, 0xF6, 0xC7, 0x10, 0x9C, 0x93, - 0x8B, 0x07, 0x9D, 0x75, 0x06, 0x3C, 0xE0, 0x75, 0x02, 0x32, 0xC0, - 0x43, 0x43, 0x89, 0x1E, 0x1A, 0x00, 0x3B, 0x1E, 0x82, 0x00, 0x75, - 0xD4, 0x8B, 0x1E, 0x80, 0x00, 0x89, 0x1E, 0x1A, 0x00, 0xEB, 0xCA, - 0xFF, 0xFF, 0xFF, 0x00, 0x37, 0x2E, 0x20, 0x2F, 0x30, 0x31, 0x21, - 0x32, 0x33, 0x34, 0x35, 0x22, 0x36, 0x38, 0x3E, 0x11, 0x17, 0x05, - 0x12, 0x14, 0x19, 0x15, 0x09, 0x0F, 0x10, 0x39, 0x3A, 0x3B, 0x84, - 0x01, 0x13, 0x04, 0x06, 0x07, 0x08, 0x0A, 0x0B, 0x0C, 0x3F, 0x40, - 0x41, 0x82, 0x3C, 0x1A, 0x18, 0x03, 0x16, 0x02, 0x0E, 0x0D, 0x42, - 0x43, 0x44, 0x81, 0x3D, 0x88, 0x2D, 0xC0, 0x23, 0x24, 0x25, 0x26, - 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0xA0, 0x90, 0x32, 0x36, 0x2D, - 0xBB, 0xBC, 0xBD, 0xBE, 0xBF, 0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0x20, - 0x31, 0x33, 0x34, 0x35, 0x37, 0x38, 0x39, 0x30, 0x3D, 0x1B, 0x08, - 0x5B, 0x5D, 0x0D, 0x5C, 0x2A, 0x09, 0x3B, 0x27, 0x60, 0x2C, 0x2E, - 0x2F, 0x40, 0x5E, 0x5F, 0xD4, 0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA, - 0xDB, 0xDC, 0xDD, 0x20, 0x21, 0x23, 0x24, 0x25, 0x26, 0x2A, 0x28, - 0x29, 0x2B, 0x1B, 0x08, 0x7B, 0x7D, 0x0D, 0x7C, 0x05, 0x8F, 0x3A, - 0x22, 0x7E, 0x3C, 0x3E, 0x3F, 0x03, 0x1E, 0x1F, 0xDE, 0xDF, 0xE0, - 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0x20, 0x05, 0x05, 0x05, - 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x1B, 0x7F, 0x1B, 0x1D, 0x0A, - 0x1C, 0xF2, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0xF9, 0xFD, - 0x02, 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF, 0xF0, 0xF1, - 0x20, 0xF8, 0xFA, 0xFB, 0xFC, 0xFE, 0xFF, 0x00, 0x01, 0x03, 0x05, - 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, - 0x05, 0x05, 0x37, 0x38, 0x39, 0x2D, 0x34, 0x35, 0x36, 0x2B, 0x31, - 0x32, 0x33, 0x30, 0x2E, 0xF7, 0x05, 0x04, 0x05, 0xF3, 0x05, 0xF4, - 0x05, 0xF5, 0x05, 0xF6, 0x05, 0x05, 0xC7, 0xC8, 0xC9, 0x2D, 0xCB, - 0x05, 0xCD, 0x2B, 0xCF, 0xD0, 0xD1, 0xD2, 0xD3, 0xFB, 0x50, 0x53, - 0x51, 0x52, 0x56, 0x57, 0x1E, 0xFC, 0xB8, 0x40, 0x00, 0x8E, 0xD8, - 0xE4, 0x60, 0x50, 0xE4, 0x61, 0x50, 0x0C, 0x80, 0xE6, 0x61, 0x58, - 0xE6, 0x61, 0x58, 0x8A, 0xE0, 0x8B, 0x1E, 0x96, 0x00, 0xE8, 0xB6, - 0xFC, 0x3C, 0xFF, 0x75, 0x0F, 0xE9, 0xF6, 0x01, 0xB0, 0x20, 0xE6, - 0x20, 0x1F, 0x5F, 0x5E, 0x5A, 0x59, 0x5B, 0x58, 0xCF, 0x24, 0x7F, - 0x3C, 0x46, 0x76, 0x03, 0xE9, 0x22, 0x01, 0xBB, 0x85, 0xE8, 0x2E, - 0xD7, 0x0A, 0xC0, 0x78, 0x06, 0x0A, 0xE4, 0x78, 0xDE, 0xEB, 0x4D, - 0x24, 0x7F, 0x0A, 0xE4, 0x78, 0x21, 0x3C, 0x10, 0x73, 0x06, 0x08, - 0x06, 0x17, 0x00, 0xEB, 0xCC, 0xF6, 0x06, 0x17, 0x00, 0x04, 0x75, - 0x36, 0x84, 0x06, 0x18, 0x00, 0x75, 0xBF, 0x08, 0x06, 0x18, 0x00, - 0x30, 0x06, 0x17, 0x00, 0xEB, 0xB5, 0x3C, 0x10, 0x73, 0x1A, 0xF6, - 0xD0, 0x20, 0x06, 0x17, 0x00, 0x3C, 0xF7, 0x75, 0xA7, 0xA0, 0x19, - 0x00, 0xB4, 0x00, 0x88, 0x26, 0x19, 0x00, 0x3A, 0xC4, 0x74, 0x9A, - 0xE9, 0x95, 0x01, 0xF6, 0xD0, 0x20, 0x06, 0x18, 0x00, 0xEB, 0x8F, - 0xF6, 0x06, 0x18, 0x00, 0x08, 0x74, 0x0D, 0x80, 0xFC, 0x45, 0x74, - 0x05, 0x80, 0x26, 0x18, 0x00, 0xF7, 0xE9, 0x7B, 0xFF, 0x8A, 0x16, - 0x17, 0x00, 0xF6, 0xC2, 0x08, 0x75, 0x1D, 0xF6, 0xC2, 0x04, 0x75, - 0x2B, 0xF6, 0xC2, 0x03, 0x75, 0x7E, 0x3C, 0x1A, 0x77, 0x05, 0x04, - 0x60, 0xE9, 0x16, 0x01, 0xBB, 0xCC, 0xE8, 0x2C, 0x20, 0x2E, 0xD7, - 0xE9, 0x0C, 0x01, 0x3C, 0x1A, 0x77, 0x05, 0xB0, 0x00, 0xE9, 0x3D, - 0x01, 0xBB, 0x3B, 0xE9, 0x2C, 0x20, 0x2E, 0xD7, 0xE9, 0xF9, 0x00, - 0x80, 0xFC, 0x46, 0x75, 0x15, 0xC6, 0x06, 0x71, 0x00, 0x80, 0xA1, - 0x80, 0x00, 0xA3, 0x1C, 0x00, 0xA3, 0x1A, 0x00, 0xCD, 0x1B, 0x2B, - 0xC0, 0xE9, 0xF1, 0x00, 0x80, 0xFC, 0x45, 0x75, 0x21, 0x80, 0x0E, - 0x18, 0x00, 0x08, 0xB0, 0x20, 0xE6, 0x20, 0x80, 0x3E, 0x49, 0x00, - 0x07, 0x74, 0x07, 0xBA, 0xD8, 0x03, 0xA0, 0x65, 0x00, 0xEE, 0xF6, - 0x06, 0x18, 0x00, 0x08, 0x75, 0xF9, 0xE9, 0x06, 0xFF, 0x80, 0xFC, - 0x03, 0x75, 0x05, 0xB0, 0x00, 0xE9, 0xE9, 0x00, 0x3C, 0x1A, 0x76, - 0xF9, 0xBB, 0x16, 0xE9, 0x2C, 0x20, 0x2E, 0xD7, 0xE9, 0xA1, 0x00, - 0x80, 0xFC, 0x37, 0x75, 0x09, 0xB0, 0x20, 0xE6, 0x20, 0xCD, 0x05, - 0xE9, 0xE0, 0xFE, 0x3C, 0x1A, 0x77, 0x05, 0x04, 0x40, 0xE9, 0x8A, - 0x00, 0xBB, 0xF1, 0xE8, 0x2C, 0x20, 0x2E, 0xD7, 0xE9, 0x80, 0x00, - 0x2C, 0x47, 0x8A, 0x1E, 0x17, 0x00, 0xF6, 0xC3, 0x08, 0x75, 0x18, - 0xF6, 0xC3, 0x04, 0x75, 0x50, 0xF6, 0xC3, 0x20, 0x74, 0x07, 0xF6, - 0xC3, 0x03, 0x75, 0x51, 0xEB, 0x5B, 0xF6, 0xC3, 0x03, 0x74, 0x4A, - 0xEB, 0x54, 0x0A, 0xE4, 0x78, 0x36, 0xF6, 0x06, 0x17, 0x00, 0x04, - 0x74, 0x16, 0x80, 0xFC, 0x53, 0x75, 0x09, 0xC7, 0x06, 0x72, 0x00, - 0x34, 0x12, 0xE9, 0x40, 0xF5, 0x80, 0xFC, 0x4A, 0x75, 0x03, 0xE8, - 0xD1, 0x00, 0xBB, 0x60, 0xE9, 0x2E, 0xD7, 0x3C, 0x30, 0x72, 0x10, - 0x2C, 0x30, 0x8A, 0xD8, 0xA0, 0x19, 0x00, 0xB4, 0x0A, 0xF6, 0xE4, - 0x02, 0xC3, 0xA2, 0x19, 0x00, 0xE9, 0x69, 0xFE, 0x0A, 0xE4, 0x78, - 0xF9, 0xBB, 0x6D, 0xE9, 0x2E, 0xD7, 0xEB, 0x15, 0xE8, 0x5D, 0x00, - 0x72, 0xED, 0xBB, 0x7A, 0xE9, 0x2E, 0xD7, 0xEB, 0x09, 0x0A, 0xE4, - 0x78, 0xE2, 0xBB, 0x60, 0xE9, 0x2E, 0xD7, 0x3C, 0x05, 0x74, 0x40, - 0x3C, 0x04, 0x77, 0x04, 0x0C, 0x80, 0xEB, 0x06, 0xA8, 0x80, 0x74, - 0x06, 0x24, 0x7F, 0x8A, 0xE0, 0xB0, 0x00, 0xF6, 0x06, 0x17, 0x00, - 0x40, 0x74, 0x1D, 0xF6, 0x06, 0x17, 0x00, 0x03, 0x74, 0x0C, 0x3C, - 0x41, 0x72, 0x12, 0x3C, 0x5A, 0x77, 0x0E, 0x04, 0x20, 0xEB, 0x0A, - 0x3C, 0x61, 0x72, 0x06, 0x3C, 0x7A, 0x77, 0x02, 0x2C, 0x20, 0xE8, - 0x36, 0x00, 0x73, 0x05, 0xB3, 0x01, 0xE8, 0x3A, 0x0E, 0xE9, 0x02, - 0xFE, 0xB4, 0x38, 0xEB, 0xEF, 0x80, 0xFC, 0xD2, 0x75, 0x07, 0x80, - 0x26, 0x18, 0x00, 0x7F, 0xF9, 0xC3, 0x0A, 0xE4, 0x78, 0xFA, 0x80, - 0xFC, 0x52, 0x75, 0x11, 0xF6, 0x06, 0x18, 0x00, 0x80, 0x75, 0x0A, - 0x80, 0x36, 0x17, 0x00, 0x80, 0x80, 0x0E, 0x18, 0x00, 0x80, 0xF8, - 0xC3, 0x8B, 0x1E, 0x1C, 0x00, 0x8B, 0xFB, 0x43, 0x43, 0x3B, 0x1E, - 0x82, 0x00, 0x75, 0x04, 0x8B, 0x1E, 0x80, 0x00, 0x3B, 0x1E, 0x1A, - 0x00, 0x75, 0x02, 0xF9, 0xC3, 0x89, 0x05, 0x89, 0x1E, 0x1C, 0x00, - 0xF8, 0xC3, 0x50, 0x53, 0x51, 0xE4, 0x61, 0x34, 0x0C, 0xE6, 0x61, - 0xBB, 0x89, 0x0F, 0x24, 0x04, 0x74, 0x03, 0xBB, 0x2E, 0x05, 0xB0, - 0xB6, 0xE6, 0x43, 0x8B, 0xC3, 0xE6, 0x42, 0x8A, 0xC4, 0xE6, 0x42, - 0xE4, 0x61, 0x50, 0x0C, 0x03, 0xE6, 0x61, 0xB9, 0x00, 0x20, 0xE2, - 0xFE, 0x58, 0xE6, 0x61, 0x59, 0x5B, 0x58, 0xC3, 0x4E, 0x6F, 0x20, - 0x52, 0x4F, 0x4D, 0x20, 0x42, 0x41, 0x53, 0x49, 0x43, 0x2C, 0x20, - 0x62, 0x6F, 0x6F, 0x74, 0x69, 0x6E, 0x67, 0x20, 0x66, 0x72, 0x6F, - 0x6D, 0x20, 0x64, 0x69, 0x73, 0x6B, 0x2E, 0x2E, 0x2E, 0x00, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFB, 0x55, 0x56, 0x57, 0x1E, 0x06, 0x53, - 0x8B, 0xF8, 0x33, 0xC0, 0x8E, 0xD8, 0xC4, 0x36, 0x78, 0x00, 0xB8, - 0x40, 0x00, 0x8E, 0xD8, 0xBB, 0x05, 0x00, 0x26, 0x8B, 0x00, 0x50, - 0x4B, 0x4B, 0x26, 0x8B, 0x00, 0x50, 0x86, 0xCE, 0x86, 0xD1, 0x52, - 0x51, 0x57, 0x8B, 0xEC, 0xE8, 0x22, 0x00, 0x26, 0x8A, 0x64, 0x02, - 0x88, 0x26, 0x40, 0x00, 0x8A, 0x26, 0x41, 0x00, 0x80, 0xFC, 0x01, - 0xF5, 0x5B, 0x59, 0x5A, 0x86, 0xD1, 0x86, 0xCE, 0x5B, 0x5B, 0x5B, - 0x07, 0x1F, 0x5F, 0x5E, 0x5D, 0xCA, 0x02, 0x00, 0x8A, 0x46, 0x01, - 0x0A, 0xC0, 0x74, 0x1B, 0xFE, 0xC8, 0x74, 0x13, 0x80, 0x7E, 0x02, - 0x03, 0x77, 0x04, 0x3C, 0x05, 0x76, 0x06, 0xC6, 0x06, 0x41, 0x00, - 0x01, 0xC3, 0xE9, 0x81, 0x00, 0xA0, 0x41, 0x00, 0xC3, 0xBA, 0xF2, - 0x03, 0xFA, 0x80, 0x26, 0x3F, 0x00, 0x0F, 0xA0, 0x3F, 0x00, 0xB1, - 0x04, 0xD2, 0xE0, 0xA8, 0x20, 0x75, 0x0C, 0xA8, 0x40, 0x75, 0x06, - 0xA8, 0x80, 0x74, 0x06, 0xFE, 0xC0, 0xFE, 0xC0, 0xFE, 0xC0, 0xC6, - 0x06, 0x3E, 0x00, 0x00, 0xC6, 0x06, 0x41, 0x00, 0x00, 0x0C, 0x08, - 0xEE, 0x0C, 0x04, 0xEE, 0xFB, 0xE8, 0xB3, 0x01, 0xE8, 0x66, 0x02, - 0xA0, 0x42, 0x00, 0x3C, 0xC0, 0x74, 0x07, 0xC6, 0x06, 0x41, 0x00, - 0x20, 0xEB, 0x12, 0xB0, 0x03, 0xE8, 0x7B, 0x02, 0x26, 0x8A, 0x04, - 0xE8, 0x75, 0x02, 0x26, 0x8A, 0x44, 0x01, 0xE8, 0x6E, 0x02, 0xC3, - 0x03, 0x00, 0xE6, 0xC5, 0xE6, 0x4D, 0x00, 0x00, 0x46, 0x4A, 0x42, - 0x4A, 0x00, 0x00, 0x00, 0x80, 0x00, 0x80, 0x01, 0x02, 0x04, 0x08, - 0x80, 0x20, 0x10, 0x04, 0x02, 0x01, 0x04, 0x10, 0x08, 0x04, 0x03, - 0x02, 0x20, 0xFA, 0xC6, 0x06, 0x41, 0x00, 0x00, 0x8A, 0x46, 0x01, - 0xB4, 0x00, 0x8B, 0xF8, 0xE6, 0x0C, 0x2E, 0x8A, 0x85, 0x2C, 0xED, - 0xE6, 0x0B, 0x8B, 0x46, 0x0C, 0xB1, 0x04, 0xD3, 0xC0, 0x8A, 0xE8, - 0x80, 0xE5, 0x0F, 0x24, 0xF0, 0x03, 0x46, 0x0A, 0x80, 0xD5, 0x00, - 0x8B, 0xD0, 0xE6, 0x04, 0x8A, 0xC4, 0xE6, 0x04, 0x8A, 0xC5, 0xE6, - 0x81, 0x8A, 0x66, 0x00, 0xB0, 0x00, 0xD1, 0xE8, 0x8A, 0x4E, 0x06, - 0xD3, 0xE0, 0x48, 0xE6, 0x05, 0x86, 0xC4, 0xE6, 0x05, 0x86, 0xC4, - 0x03, 0xC2, 0x73, 0x09, 0xFB, 0xC6, 0x06, 0x41, 0x00, 0x09, 0xE9, - 0x11, 0x01, 0xB0, 0x02, 0xE6, 0x0A, 0xC6, 0x06, 0x40, 0x00, 0xFF, - 0x8A, 0x5E, 0x02, 0xB7, 0x00, 0x2E, 0x8A, 0x87, 0x38, 0xED, 0x8A, - 0xE8, 0xB1, 0x04, 0xD2, 0xE0, 0x0A, 0xC3, 0x0C, 0x0C, 0xBA, 0xF2, - 0x03, 0xEE, 0xFB, 0x2E, 0x8A, 0x85, 0x32, 0xED, 0x08, 0x06, 0x3F, - 0x00, 0x0A, 0xC0, 0x79, 0x11, 0x26, 0x8A, 0x64, 0x0A, 0x0A, 0xE4, - 0x74, 0x09, 0x84, 0x2E, 0x3F, 0x00, 0x75, 0x03, 0xE8, 0x27, 0x01, - 0x08, 0x2E, 0x3F, 0x00, 0x84, 0x2E, 0x3E, 0x00, 0x75, 0x14, 0x08, - 0x2E, 0x3E, 0x00, 0xB0, 0x07, 0xE8, 0x9F, 0x01, 0x8A, 0xC3, 0xE8, - 0x9A, 0x01, 0xE8, 0xB9, 0x00, 0xE8, 0xBB, 0x01, 0xB0, 0x0F, 0xE8, - 0x8F, 0x01, 0x8A, 0xC3, 0xE8, 0x8A, 0x01, 0x8A, 0x46, 0x03, 0xE8, - 0x84, 0x01, 0xE8, 0xA3, 0x00, 0xE8, 0x56, 0x01, 0x26, 0x8A, 0x44, - 0x09, 0x0A, 0xC0, 0x74, 0x09, 0xB9, 0x26, 0x02, 0xE2, 0xFE, 0xFE, - 0xC8, 0x75, 0xF7, 0x2E, 0x8A, 0x85, 0x26, 0xED, 0xE8, 0x65, 0x01, - 0x8A, 0x46, 0x04, 0x24, 0x01, 0xD0, 0xE0, 0xD0, 0xE0, 0x0A, 0xC3, - 0xE8, 0x57, 0x01, 0x80, 0x7E, 0x01, 0x05, 0x75, 0x1C, 0x8A, 0x46, - 0x06, 0xE8, 0x4B, 0x01, 0x8A, 0x46, 0x07, 0xE8, 0x45, 0x01, 0x26, - 0x8A, 0x44, 0x07, 0xE8, 0x3E, 0x01, 0x26, 0x8A, 0x44, 0x08, 0xE8, - 0x37, 0x01, 0xEB, 0x0E, 0xB9, 0x07, 0x00, 0xBF, 0x03, 0x00, 0x8A, - 0x03, 0xE8, 0x2A, 0x01, 0x47, 0xE2, 0xF8, 0xE8, 0x46, 0x00, 0xE8, - 0xFE, 0x00, 0xA0, 0x42, 0x00, 0x24, 0xC0, 0x74, 0x25, 0x3C, 0x40, - 0x74, 0x07, 0xC6, 0x06, 0x41, 0x00, 0x20, 0xEB, 0x1A, 0xA0, 0x43, - 0x00, 0xB9, 0x06, 0x00, 0x33, 0xDB, 0x2E, 0x84, 0x87, 0x3C, 0xED, - 0x75, 0x03, 0x43, 0xE2, 0xF6, 0x2E, 0x8A, 0x87, 0x42, 0xED, 0xA2, - 0x41, 0x00, 0xA0, 0x45, 0x00, 0x3A, 0x46, 0x03, 0xA0, 0x47, 0x00, - 0x74, 0x05, 0x8A, 0x46, 0x07, 0xFE, 0xC0, 0x2A, 0x46, 0x05, 0xC3, - 0xB0, 0x00, 0xC3, 0xFB, 0x33, 0xC9, 0xB0, 0x02, 0xF6, 0x06, 0x3E, - 0x00, 0x80, 0xF8, 0x75, 0x10, 0xE2, 0xF6, 0xFE, 0xC8, 0x75, 0xF2, - 0xC6, 0x06, 0x41, 0x00, 0x80, 0x58, 0xB0, 0x00, 0xF9, 0xC3, 0x80, - 0x26, 0x3E, 0x00, 0x7F, 0xC3, 0x51, 0x33, 0xC9, 0xBA, 0xF4, 0x03, - 0xEC, 0x0A, 0xC0, 0x78, 0x09, 0xE2, 0xF9, 0xC6, 0x06, 0x41, 0x00, - 0x80, 0xEB, 0x09, 0xA8, 0x40, 0x75, 0x08, 0xC6, 0x06, 0x41, 0x00, - 0x20, 0x59, 0xF9, 0xC3, 0x42, 0xEC, 0x50, 0xB9, 0x0A, 0x00, 0xE2, - 0xFE, 0x4A, 0xEC, 0xA8, 0x10, 0xF8, 0x58, 0x59, 0xC3, 0x51, 0x33, - 0xC9, 0xE2, 0xFE, 0xFE, 0xCC, 0x75, 0xF8, 0x59, 0xC3, 0xBD, 0x04, - 0x00, 0xBB, 0x00, 0xB0, 0x3C, 0x07, 0x74, 0x06, 0xBD, 0x10, 0x00, - 0xBB, 0x00, 0xB8, 0x53, 0x07, 0xA0, 0x65, 0x00, 0x24, 0xF7, 0x8B, - 0x16, 0x63, 0x00, 0x83, 0xC2, 0x04, 0xEE, 0xE8, 0xE4, 0x0A, 0x4D, - 0x75, 0xFA, 0x73, 0x05, 0x80, 0x0E, 0x15, 0x00, 0x04, 0xC3, 0x3C, - 0x53, 0x75, 0x11, 0x8A, 0x0E, 0x17, 0x00, 0xF6, 0xC1, 0x04, 0x74, - 0x08, 0xF6, 0xC1, 0x08, 0x74, 0x03, 0xE9, 0xC8, 0xFB, 0xC3, 0xFF, - 0xFB, 0x1E, 0x50, 0xB8, 0x40, 0x00, 0x8E, 0xD8, 0x80, 0x0E, 0x3E, - 0x00, 0x80, 0xB0, 0x20, 0xE6, 0x20, 0x58, 0x1F, 0xCF, 0xB0, 0x08, - 0xE8, 0x23, 0x00, 0x53, 0x51, 0xB9, 0x07, 0x00, 0x33, 0xDB, 0xE8, - 0x5E, 0xFF, 0x72, 0x0D, 0x88, 0x47, 0x42, 0x74, 0x0F, 0x43, 0xE2, - 0xF3, 0xC6, 0x06, 0x41, 0x00, 0x20, 0xF9, 0x59, 0x5B, 0x58, 0xB0, - 0x00, 0xC3, 0x59, 0x5B, 0xC3, 0x51, 0x52, 0x50, 0x33, 0xC9, 0xBA, - 0xF4, 0x03, 0xEC, 0x0A, 0xC0, 0x78, 0x09, 0xE2, 0xF9, 0xC6, 0x06, - 0x41, 0x00, 0x80, 0xEB, 0x12, 0xA8, 0x40, 0x74, 0x07, 0xC6, 0x06, - 0x41, 0x00, 0x20, 0xEB, 0x07, 0x42, 0x58, 0xEE, 0xF8, 0x5A, 0x59, - 0xC3, 0x58, 0x5A, 0x59, 0x58, 0xB0, 0x00, 0xF9, 0xC3, 0xFF, 0xFF, - 0xFF, 0xFF, 0xCF, 0x02, 0x25, 0x02, 0x08, 0x2A, 0xFF, 0x50, 0xF6, - 0x19, 0x04, 0xFB, 0x1E, 0x53, 0x51, 0x52, 0xBB, 0x40, 0x00, 0x8E, - 0xDB, 0x8B, 0xDA, 0xD1, 0xE3, 0x8B, 0x57, 0x08, 0x0B, 0xD2, 0x74, - 0x0C, 0x0A, 0xE4, 0x74, 0x0D, 0xFE, 0xCC, 0x74, 0x39, 0xFE, 0xCC, - 0x74, 0x29, 0x5A, 0x59, 0x5B, 0x1F, 0xCF, 0xEE, 0x42, 0x8A, 0x7F, - 0x78, 0x8A, 0xE0, 0x33, 0xC9,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0x5A, - 0x0A, 0x1F, 0x06, 0x19, 0x1C, 0x02, 0x07, 0x06, 0x07, 0x00, 0x00, - 0x00, 0x00, 0x38, 0x28, 0x2D, 0x0A, 0x7F, 0x06, 0x64, 0x70, 0x02, - 0x01, 0x06, 0x07, 0x00, 0x00, 0x00, 0x00, 0x61, 0x50, 0x52, 0x0F, - 0x19, 0x06, 0x19, 0x19, 0x02, 0x0D, 0x0B, 0x0C, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x08, 0x00, 0x10, 0x00, 0x40, 0x00, 0x40, 0x28, 0x28, - 0x50, 0x50, 0x28, 0x28, 0x50, 0x50, 0x2C, 0x28, 0x2D, 0x29, 0x2A, - 0x2E, 0x1E, 0x29, 0x00, 0x00, 0x10, 0x10, 0x20, 0x20, 0x20, 0x30, - 0x80, 0xFC, 0x0F, 0x76, 0x01, 0xC3, 0xD0, 0xE4, 0x8A, 0xDC, 0xB7, - 0x00, 0x2E, 0xFF, 0xA7, 0x45, 0xF0, 0xA0, 0x10, 0x00, 0xBA, 0xB4, - 0x03, 0x24, 0x30, 0x3C, 0x30, 0xB0, 0x01, 0xB3, 0x07, 0x74, 0x07, - 0x8A, 0x5E, 0x02, 0xB2, 0xD4, 0xFE, 0xC8, 0x89, 0x16, 0x63, 0x00, - 0x80, 0xC2, 0x04, 0xEE, 0x88, 0x1E, 0x49, 0x00, 0x1E, 0x33, 0xC0, - 0x8E, 0xD8, 0xC4, 0x36, 0x74, 0x00, 0x1F, 0xB7, 0x00, 0x53, 0x2E, - 0x8A, 0x9F, 0xFC, 0xF0, 0x03, 0xF3, 0xB9, 0x10, 0x00, 0x26, 0x8A, - 0x04, 0xE8, 0x2D, 0x06, 0xFE, 0xC4, 0x46, 0xE2, 0xF5, 0x8B, 0x5E, - 0x00, 0x8E, 0xC3, 0x33, 0xFF, 0xE8, 0x80, 0x05, 0xB9, 0x00, 0x20, - 0xB8, 0x00, 0x00, 0x72, 0x08, 0x75, 0x03, 0xB9, 0x00, 0x08, 0xB8, - 0x20, 0x07, 0xF3, 0xAB, 0x8B, 0x16, 0x63, 0x00, 0x80, 0xC2, 0x04, - 0x5B, 0x2E, 0x8A, 0x87, 0xF4, 0xF0, 0xEE, 0xA2, 0x65, 0x00, 0x42, - 0xB0, 0x30, 0x80, 0xFB, 0x06, 0x75, 0x02, 0xB0, 0x3F, 0xA2, 0x66, - 0x00, 0xEE, 0x33, 0xC0, 0xA3, 0x4E, 0x00, 0xA2, 0x62, 0x00, 0xB9, - 0x08, 0x00, 0xBF, 0x50, 0x00, 0x89, 0x05, 0x47, 0xE2, 0xFB, 0x2E, - 0x8A, 0x87, 0xEC, 0xF0, 0xA3, 0x4A, 0x00, 0x80, 0xE3, 0xFE, 0x2E, - 0x8B, 0x87, 0xE4, 0xF0, 0xA3, 0x4C, 0x00, 0xC3, 0x8B, 0x4E, 0x06, - 0x89, 0x0E, 0x60, 0x00, 0xB4, 0x0A, 0xE8, 0xB1, 0x05, 0xC3, 0x8A, - 0x5E, 0x05, 0xD0, 0xE3, 0xB7, 0x00, 0x8B, 0x46, 0x08, 0x89, 0x47, - 0x50, 0xE9, 0x8B, 0x05, 0x8A, 0x5E, 0x05, 0xD0, 0xE3, 0xB7, 0x00, - 0x8B, 0x47, 0x50, 0x89, 0x46, 0x08, 0xA1, 0x60, 0x00, 0x89, 0x46, - 0x06, 0xC3, 0x03, 0x03, 0x05, 0x05, 0x03, 0x03, 0x03, 0x04, 0x8B, - 0x16, 0x63, 0x00, 0x80, 0xC2, 0x06, 0xC6, 0x46, 0x03, 0x00, 0xEC, - 0xA8, 0x04, 0x74, 0x68, 0xA8, 0x02, 0x75, 0x01, 0xC3, 0xB4, 0x10, - 0xE8, 0x10, 0x05, 0x8A, 0x1E, 0x49, 0x00, 0x8A, 0xCB, 0xB7, 0x00, - 0x2E, 0x8A, 0x9F, 0xED, 0xF1, 0x2B, 0xCB, 0x79, 0x02, 0x33, 0xC0, - 0xE8, 0xBF, 0x04, 0x73, 0x25, 0xB5, 0x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A, 0x74, 0x3D, 0x3C, 0x07, 0x74, 0x23, 0x3C, - 0x0D, 0x74, 0x25, 0x8A, 0x5E, 0x04, 0xB4, 0x0A, 0xB9, 0x01, 0x00, - 0xCD, 0x10, 0xFE, 0xC2, 0x3A, 0x16, 0x4A, 0x00, 0x75, 0x15, 0xB2, - 0x00, 0xEB, 0x1F, 0x80, 0xFA, 0x00, 0x74, 0x0C, 0xFE, 0xCA, 0xEB, - 0x08, 0xB3, 0x01, 0xE8, 0x53, 0x03, 0xC3, 0xB2, 0x00, 0x8A, 0x1E, - 0x62, 0x00, 0xD0, 0xE3, 0xB7, 0x00, 0x89, 0x57, 0x50, 0xE9, 0xBE, - 0x00, 0x80, 0xFE, 0x18, 0x74, 0x04, 0xFE, 0xC6, 0x75, 0xE9, 0xB4, - 0x02, 0xCD, 0x10, 0xE8, 0x2E, 0x00, 0xB7, 0x00, 0x72, 0x06, 0xB4, - 0x08, 0xCD, 0x10, 0x8A, 0xFC, 0xB4, 0x06, 0xB0, 0x01, 0x33, 0xC9, - 0xB6, 0x18, 0x8A, 0x16, 0x4A, 0x00, 0xFE, 0xCA, 0xCD, 0x10, 0xC3, - 0xA0, 0x4A, 0x00, 0x88, 0x46, 0x03, 0xA0, 0x49, 0x00, 0x88, 0x46, - 0x02, 0xA0, 0x62, 0x00, 0x88, 0x46, 0x05, 0xC3, 0x50, 0xA0, 0x49, - 0x00, 0x3C, 0x07, 0x74, 0x08, 0x3C, 0x04, 0xF5, 0x73, 0x03, 0x1A, - 0xC0, 0xF9, 0x58, 0xC3, 0xB0, 0x50, 0x33, 0xF6, 0xD0, 0xEA, 0x73, - 0x03, 0xBE, 0x00, 0x20, 0xF6, 0xE2, 0x03, 0xF0, 0x8B, 0xD1, 0xB9, - 0x02, 0x03, 0x80, 0x3E, 0x49, 0x00, 0x06, 0x9C, 0x75, 0x03, 0xB9, - 0x03, 0x07, 0x22, 0xEA, 0xD3, 0xEA, 0x03, 0xF2, 0x86, 0xCD, 0x9D, - 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, 0x32, 0xE4, 0xCD, 0x16, 0x0A, 0xD2, 0x74, 0xF6, - 0x3C, 0x20, 0x74, 0x02, 0xEB, 0xF0, 0xCD, 0x18, 0x53, 0x79, 0x73, - 0x74, 0x65, 0x6D, 0x20, 0xC2, 0x20, 0x00, 0x38, 0x30, 0x38, 0x38, - 0x20, 0x43, 0x50, 0x55, 0x20, 0x28, 0x00, 0x56, 0x32, 0x30, 0x20, - 0x43, 0x50, 0x55, 0x20, 0x28, 0x00, 0x4E, 0x6F, 0x20, 0x46, 0x50, - 0x55, 0x29, 0x00, 0x38, 0x30, 0x38, 0x37, 0x20, 0x46, 0x50, 0x55, - 0x29, 0x00, 0x50, 0x72, 0x65, 0x73, 0x73, 0x20, 0x53, 0x50, 0x41, - 0x43, 0x45, 0x20, 0x74, 0x6F, 0x20, 0x62, 0x6F, 0x6F, 0x74, 0x20, - 0x52, 0x4F, 0x4D, 0x20, 0x42, 0x41, 0x53, 0x49, 0x43, 0x2E, 0x2E, - 0x2E, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFB, 0x1E, 0xB8, 0x40, 0x00, 0x8E, - 0xD8, 0xA1, 0x13, 0x00, 0x1F, 0xCF, 0xFB, 0x1E, 0xB8, 0x40, 0x00, - 0x8E, 0xD8, 0xA1, 0x10, 0x00, 0x1F, 0xCF, 0xF9, 0xB4, 0x86, 0xCA, - 0x02, 0x00, 0x50, 0xE4, 0x62, 0xA8, 0xC0, 0x75, 0x03, 0xE9, 0xA8, - 0x00, 0x53, 0x51, 0x52, 0x56, 0x57, 0x55, 0x1E, 0x06, 0xB8, 0x40, - 0x00, 0x8E, 0xD8, 0xE8, 0x4E, 0x01, 0x1E, 0x0E, 0x1F, 0xBE, 0x2B, - 0xF9, 0xE8, 0x00, 0x01, 0x1F, 0xB8, 0x11, 0x00, 0xE8, 0x04, 0x01, - 0xB0, 0x00,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x00, 0x0D, 0x0A, - 0x43, 0x6F, 0x6E, 0x74, 0x69, 0x6E, 0x75, 0x65, 0x3F, 0x20, 0x00, - 0x50, 0x24, 0x0F, 0x3C, 0x09, 0x76, 0x02, 0x04, 0x07, 0x04, 0x30, - 0xE8, 0x1A, 0x00, 0x58, 0xC3, 0x50, 0xB1, 0x04, 0xD2, 0xE8, 0xE8, - 0xE8, 0xFF, 0x58, 0xE8, 0xE4, 0xFF, 0xC3, 0x50, 0x8A, 0xC4, 0xE8, - 0xDD, 0xFF, 0x58, 0xE8, 0xE9, 0xFF, 0xC3, 0x53, 0x50, 0xB4, 0x0E, - 0xB3, 0x07, 0xCD, 0x10, 0x58, 0x5B, 0xC3, 0xAC, 0x0A, 0xC0, 0x74, - 0x05, 0xE8, 0xED, 0xFF, 0xEB, 0xF6, 0xC3, 0x52, 0x53, 0x8B, 0xD0, - 0xB4, 0x02, 0xB7, 0x00, 0xCD, 0x10, 0x5B, 0x5A, 0xC3, 0xBB, 0x70, - 0x00, 0x26, 0x80, 0x3E, 0x49, 0x00, 0x07, 0x74, 0x03, 0xBB, 0x1F, - 0x00, 0xB9, 0x01, 0x00, 0xAC, 0x0A, 0xC0, 0x74, 0x05, 0xE8, 0x05, - 0x00, 0xEB, 0xF3, 0xB9, 0x31, 0x00, 0xB4, 0x09, 0xCD, 0x10, 0xB4, - 0x03, 0xCD, 0x10, 0xB4, 0x02, 0xFE, 0xC2, 0xCD, 0x10, 0xC3, 0x8A, - 0x26, 0x10, 0x00, 0x80, 0xE4, 0x30, 0xB0, 0x00, 0x80, 0xFC, 0x30, - 0x74, 0x09, 0xB0, 0x01, 0x80, 0xFC, 0x10, 0x74, 0x02, 0xB0, 0x03, - 0xB4, 0x00, 0xCD, 0x10, 0xC3, 0xB4, 0x00, 0xCD, 0x16, 0xC3, 0x50, - 0x51, 0xB0, 0xB6, 0xE6, 0x43, 0xB8, 0x28, 0x05, 0xE6, 0x42, 0x8A, - 0xC4, 0xE6, 0x42, 0xE4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, 0x3C, 0x3C, 0x18, 0x00, 0x00, 0xFF, - 0xFF, 0xE7, 0xC3, 0xC3, 0xE7, 0xFF, 0xFF, 0x00, 0x3C, 0x66, 0x42, - 0x42, 0x66, 0x3C, 0x00, 0xFF, 0xC3, 0x99, 0xBD, 0xBD, 0x99, 0xC3, - 0xFF, 0x0F, 0x07, 0x0F, 0x7D, 0xCC, 0xCC, 0xCC, 0x78, 0x3C, 0x66, - 0x66, 0x66, 0x3C, 0x18, 0x7E, 0x18, 0x3F, 0x33, 0x3F, 0x30, 0x30, - 0x70, 0xF0, 0xE0, 0x7F, 0x63, 0x7F, 0x63, 0x63, 0x67, 0xE6, 0xC0, - 0x99, 0x5A, 0x3C, 0xE7, 0xE7, 0x3C, 0x5A, 0x99, 0x80, 0xE0, 0xF8, - 0xFE, 0xF8, 0xE0, 0x80, 0x00, 0x02, 0x0E, 0x3E, 0xFE, 0x3E, 0x0E, - 0x02, 0x00, 0x18, 0x3C, 0x7E, 0x18, 0x18, 0x7E, 0x3C, 0x18, 0x66, - 0x66, 0x66, 0x66, 0x66, 0x00, 0x66, 0x00, 0x7F, 0xDB, 0xDB, 0x7B, - 0x1B, 0x1B, 0x1B, 0x00, 0x3E, 0x63, 0x38, 0x6C, 0x6C, 0x38, 0xCC, - 0x78, 0x00, 0x00, 0x00, 0x00, 0x7E, 0x7E, 0x7E, 0x00, 0x18, 0x3C, - 0x7E, 0x18, 0x7E, 0x3C, 0x18, 0xFF, 0x18, 0x3C, 0x7E, 0x18, 0x18, - 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x18, 0x7E, 0x3C, 0x18, 0x00, - 0x00, 0x18, 0x0C, 0xFE, 0x0C, 0x18, 0x00, 0x00, 0x00, 0x30, 0x60, - 0xFE, 0x60, 0x30, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xC0, 0xC0, 0xFE, - 0x00, 0x00, 0x00, 0x24, 0x66, 0xFF, 0x66, 0x24, 0x00, 0x00, 0x00, - 0x18, 0x3C, 0x7E, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x7E, - 0x3C, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x30, 0x78, 0x78, 0x30, 0x30, 0x00, 0x30, 0x00, 0x6C, 0x6C, - 0x6C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6C, 0x6C, 0xFE, 0x6C, 0xFE, - 0x6C, 0x6C, 0x00, 0x30, 0x7C, 0xC0, 0x78, 0x0C, 0xF8, 0x30, 0x00, - 0x00, 0xC6, 0xCC, 0x18, 0x30, 0x66, 0xC6, 0x00, 0x38, 0x6C, 0x38, - 0x76, 0xDC, 0xCC, 0x76, 0x00, 0x60, 0x60, 0xC0, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x18, 0x30, 0x60, 0x60, 0x60, 0x30, 0x18, 0x00, 0x60, - 0x30, 0x18, 0x18, 0x18, 0x30, 0x60, 0x00, 0x00, 0x66, 0x3C, 0xFF, - 0x3C, 0x66, 0x00, 0x00, 0x00, 0x30, 0x30, 0xFC, 0x30, 0x30, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x60, 0x00, 0x00, - 0x00, 0xFC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x30, 0x30, 0x00, 0x06, 0x0C, 0x18, 0x30, 0x60, 0xC0, 0x80, 0x00, - 0x7C, 0xC6, 0xCE, 0xDE, 0xF6, 0xE6, 0x7C, 0x00, 0x30, 0x70, 0x30, - 0x30, 0x30, 0x30, 0xFC, 0x00, 0x78, 0xCC, 0x0C, 0x38, 0x60, 0xCC, - 0xFC, 0x00, 0x78, 0xCC, 0x0C, 0x38, 0x0C, 0xCC, 0x78, 0x00, 0x1C, - 0x3C, 0x6C, 0xCC, 0xFE, 0x0C, 0x1E, 0x00, 0xFC, 0xC0, 0xF8, 0x0C, - 0x0C, 0xCC, 0x78, 0x00, 0x38, 0x60, 0xC0, 0xF8, 0xCC, 0xCC, 0x78, - 0x00, 0xFC, 0xCC, 0x0C, 0x18, 0x30, 0x30, 0x30, 0x00, 0x78, 0xCC, - 0xCC, 0x78, 0xCC, 0xCC, 0x78, 0x00, 0x78, 0xCC, 0xCC, 0x7C, 0x0C, - 0x18, 0x70, 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, 0x30, 0x30, 0x00, - 0x00, 0x30, 0x30, 0x00, 0x00, 0x30, 0x30, 0x60, 0x18, 0x30, 0x60, - 0xC0, 0x60, 0x30, 0x18, 0x00, 0x00, 0x00, 0xFC, 0x00, 0x00, 0xFC, - 0x00, 0x00, 0x60, 0x30, 0x18, 0x0C, 0x18, 0x30, 0x60, 0x00, 0x78, - 0xCC, 0x0C, 0x18, 0x30, 0x00, 0x30, 0x00, 0x7C, 0xC6, 0xDE, 0xDE, - 0xDE, 0xC0, 0x78, 0x00, 0x30, 0x78, 0xCC, 0xCC, 0xFC, 0xCC, 0xCC, - 0x00, 0xFC, 0x66, 0x66, 0x7C, 0x66, 0x66, 0xFC, 0x00, 0x3C, 0x66, - 0xC0, 0xC0, 0xC0, 0x66, 0x3C, 0x00, 0xF8, 0x6C, 0x66, 0x66, 0x66, - 0x6C, 0xF8, 0x00, 0xFE, 0x62, 0x68, 0x78, 0x68, 0x62, 0xFE, 0x00, - 0xFE, 0x62, 0x68, 0x78, 0x68, 0x60, 0xF0, 0x00, 0x3C, 0x66, 0xC0, - 0xC0, 0xCE, 0x66, 0x3E, 0x00, 0xCC, 0xCC, 0xCC, 0xFC, 0xCC, 0xCC, - 0xCC, 0x00, 0x78, 0x30, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00, 0x1E, - 0x0C, 0x0C, 0x0C, 0xCC, 0xCC, 0x78, 0x00, 0xE6, 0x66, 0x6C, 0x78, - 0x6C, 0x66, 0xE6, 0x00, 0xF0, 0x60, 0x60, 0x60, 0x62, 0x66, 0xFE, - 0x00, 0xC6, 0xEE, 0xFE, 0xFE, 0xD6, 0xC6, 0xC6, 0x00, 0xC6, 0xE6, - 0xF6, 0xDE, 0xCE, 0xC6, 0xC6, 0x00, 0x38, 0x6C, 0xC6, 0xC6, 0xC6, - 0x6C, 0x38, 0x00, 0xFC, 0x66, 0x66, 0x7C, 0x60, 0x60, 0xF0, 0x00, - 0x78, 0xCC, 0xCC, 0xCC, 0xDC, 0x78, 0x1C, 0x00, 0xFC, 0x66, 0x66, - 0x7C, 0x6C, 0x66, 0xE6, 0x00, 0x78, 0xCC, 0xE0, 0x70, 0x1C, 0xCC, - 0x78, 0x00, 0xFC, 0xB4, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00, 0xCC, - 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xFC, 0x00, 0xCC, 0xCC, 0xCC, 0xCC, - 0xCC, 0x78, 0x30, 0x00, 0xC6, 0xC6, 0xC6, 0xD6, 0xFE, 0xEE, 0xC6, - 0x00, 0xC6, 0xC6, 0x6C, 0x38, 0x38, 0x6C, 0xC6, 0x00, 0xCC, 0xCC, - 0xCC, 0x78, 0x30, 0x30, 0x78, 0x00, 0xFE, 0xC6, 0x8C, 0x18, 0x32, - 0x66, 0xFE, 0x00, 0x78, 0x60, 0x60, 0x60, 0x60, 0x60, 0x78, 0x00, - 0xC0, 0x60, 0x30, 0x18, 0x0C, 0x06, 0x02, 0x00, 0x78, 0x18, 0x18, - 0x18, 0x18, 0x18, 0x78, 0x00, 0x10, 0x38, 0x6C, 0xC6, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x30, - 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x0C, - 0x7C, 0xCC, 0x76, 0x00, 0xE0, 0x60, 0x60, 0x7C, 0x66, 0x66, 0xDC, - 0x00, 0x00, 0x00, 0x78, 0xCC, 0xC0, 0xCC, 0x78, 0x00, 0x1C, 0x0C, - 0x0C, 0x7C, 0xCC, 0xCC, 0x76, 0x00, 0x00, 0x00, 0x78, 0xCC, 0xFC, - 0xC0, 0x78, 0x00, 0x38, 0x6C, 0x60, 0xF0, 0x60, 0x60, 0xF0, 0x00, - 0x00, 0x00, 0x76, 0xCC, 0xCC, 0x7C, 0x0C, 0xF8, 0xE0, 0x60, 0x6C, - 0x76, 0x66, 0x66, 0xE6, 0x00, 0x30, 0x00, 0x70, 0x30, 0x30, 0x30, - 0x78, 0x00, 0x0C, 0x00, 0x0C, 0x0C, 0x0C, 0xCC, 0xCC, 0x78, 0xE0, - 0x60, 0x66, 0x6C, 0x78, 0x6C, 0xE6, 0x00, 0x70, 0x30, 0x30, 0x30, - 0x30, 0x30, 0x78, 0x00, 0x00, 0x00, 0xCC, 0xFE, 0xFE, 0xD6, 0xC6, - 0x00, 0x00, 0x00, 0xF8, 0xCC, 0xCC, 0xCC, 0xCC, 0x00, 0x00, 0x00, - 0x78, 0xCC, 0xCC, 0xCC, 0x78, 0x00, 0x00, 0x00, 0xDC, 0x66, 0x66, - 0x7C, 0x60, 0xF0, 0x00, 0x00, 0x76, 0xCC, 0xCC, 0x7C, 0x0C, 0x1E, - 0x00, 0x00, 0xDC, 0x76, 0x66, 0x60, 0xF0, 0x00, 0x00, 0x00, 0x7C, - 0xC0, 0x78, 0x0C, 0xF8, 0x00, 0x10, 0x30, 0x7C, 0x30, 0x30, 0x34, - 0x18, 0x00, 0x00, 0x00, 0xCC, 0xCC, 0xCC, 0xCC, 0x76, 0x00, 0x00, - 0x00, 0xCC, 0xCC, 0xCC, 0x78, 0x30, 0x00, 0x00, 0x00, 0xC6, 0xD6, - 0xFE, 0xFE, 0x6C, 0x00, 0x00, 0x00, 0xC6, 0x6C, 0x38, 0x6C, 0xC6, - 0x00, 0x00, 0x00, 0xCC, 0xCC, 0xCC, 0x7C, 0x0C, 0xF8, 0x00, 0x00, - 0xFC, 0x98, 0x30, 0x64, 0xFC, 0x00, 0x1C, 0x30, 0x30, 0xE0, 0x30, - 0x30, 0x1C, 0x00, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x00, - 0xE0, 0x30, 0x30, 0x1C, 0x30, 0x30, 0xE0, 0x00, 0x76, 0xDC, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x6C, 0xC6, 0xC6, - 0xFE, 0x00, 0xFB, 0x1E, 0x50, 0xB8, 0x40, 0x00, 0x8E, 0xD8, 0x58, - 0xFA, 0x0A, 0xE4, 0x74, 0x13, 0xFE, 0xCC, 0x75, 0x1A, 0x89, 0x16, - 0x6C, 0x00, 0x89, 0x0E, 0x6E, 0x00, 0xC6, 0x06, 0x70, 0x00, 0x00, - 0xEB, 0x0B, 0x8B, 0x0E, 0x6E, 0x00, 0x8B, 0x16, 0x6C, 0x00, 0xE8, - 0x03, 0x00, 0xFB, 0x1F, 0xCF, 0xA0, 0x70, 0x00, 0x30, 0x06, 0x70, - 0x00, 0xC3, 0xFB, 0x1E, 0x52, 0x50, 0xB8, 0x40, 0x00, 0x8E, 0xD8, - 0xFE, 0x0E, 0x40, 0x00, 0x75, 0x0B, 0x80, 0x26, 0x3F, 0x00, 0xF0, - 0xB0, 0x0C, 0xBA, 0xF2, 0x03, 0xEE, 0xFF, 0x06, 0x6C, 0x00, 0x75, - 0x04, 0xFF, 0x06, 0x6E, 0x00, 0x83, 0x3E, 0x6E, 0x00, 0x18, 0x75, - 0x19, 0x81, 0x3E, 0x6C, 0x00, 0xB0, 0x00, 0x75, 0x11, 0xC7, 0x06, - 0x6E, 0x00, 0x00, 0x00, 0xC7, 0x06, 0x6C, 0x00, 0x00, 0x00, 0xC6, - 0x06, 0x70, 0x00, 0x01, 0xCD, 0x1C, 0xB0, 0x20, 0xE6, 0x20, 0x58, - 0x5A, 0x1F, 0xCF, 0xA5, 0xFE, 0x87, 0xE9, 0x23, 0xFF, 0x23, 0xFF, - 0x23, 0xFF, 0x23, 0xFF, 0x57, 0xEF, 0x23, 0xFF,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 0xB4, 0x02, 0xCD, 0x10, 0x5A, 0x59, 0x5B, 0x58, 0x1F, - 0xCF, 0xC3, 0x20, 0x54, 0x69, 0x6D, 0x65, 0x72, 0x00, 0xFF, 0x52, - 0x33, 0xD2, 0x8A, 0xE2, 0xB0, 0x0A, 0xCD, 0x17, 0xB4, 0x00, 0xB0, - 0x0D, 0xCD, 0x17, 0x5A, 0xC3, 0xC7, 0x06, 0x60, 0x00, 0x07, 0x06, - 0x80, 0x3E, 0x49, 0x00, 0x07, 0x75, 0x06, 0xC7, 0x06, 0x60, 0x00, - 0x0C, 0x0B, 0xC3, 0xEA, 0x5B, 0xE0, 0x00, 0xF0, 0x30, 0x35, 0x2F, - 0x30, 0x32, 0x2F, 0x31, 0x32, 0xFF, 0xFE, 0xE2 -}; - -#ifdef INCLUDE_ROM_BASIC -#ifdef MEGA - const uint8_t BASICL[16384] PROGMEM = { -#else - const uint8_t BASICL[16384] = { -#endif - 0xE9, 0x8F, 0x7E, 0xE8, 0xA7, 0x6B, 0xCB, 0xE8, 0x2, 0x65, 0xCB, - 0x5D, 0xE8, 0xC7, 0x2F, 0x74, 0xD, 0x8B, 0x36, 0xE9, 0x4, 0x8A, - 0x44, 0x2E, 0x3C, 0xFE, 0x74, 0x2, 0x3C, 0xFD, 0xC3, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x33, 0x2E, 0x94, 0xD, 0x68, 0x73, 0x5B, - 0x11, 0x59, 0x15, 0x66, 0x37, 0x3E, 0x16, 0x8F, 0x11, 0xED, 0x10, - 0xB6, 0x10, 0xF8, 0x12, 0xC, 0x2E, 0xCE, 0x10, 0x35, 0x11, 0x5F, - 0x11, 0x2D, 0x2E, 0x48, 0x13, 0x50, 0x2F, 0x35, 0x1F, 0x1B, 0x2D, - 0xFE, 0x11, 0x58, 0x1E, 0xF0, 0x1B, 0x91, 0x22, 0x85, 0x2E, 0xBE, - 0x7, 0xBE, 0x7, 0x53, 0x1E, 0x43, 0x13, 0x2E, 0x1F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0xD4, 0x91, 0x4F, 0x4B, 0xC5, 0x98, 0x4F, 0xD3, 0x11, 0x45, 0x45, - 0xCB, 0x17, 0x53, 0x45, 0xD4, 0xC6, 0x52, 0x45, 0x53, 0x45, 0xD4, - 0xC7, 0x4F, 0x49, 0x4E, 0xD4, 0xDC, 0x45, 0xCE, 0x20, 0x0, 0x0, - 0x55, 0xCE, 0x8A, 0x45, 0x54, 0x55, 0x52, 0xCE, 0x8E, 0x45, 0x41, - 0xC4, 0x87, 0x45, 0x53, 0x54, 0x4F, 0x52, 0xC5, 0x8C, 0x45, 0xCD, - 0x8F, 0x45, 0x53, 0x55, 0x4D, 0xC5, 0xA8, 0x49, 0x47, 0x48, 0x54, - 0xA4, 0x2, 0x4E, 0xC4, 0x8, 0x45, 0x4E, 0x55, 0xCD, 0xAB, 0x41, - 0x4E, 0x44, 0x4F, 0x4D, 0x49, 0x5A, 0xC5, 0xB9, 0x0, 0x43, 0x52, - 0x45, 0x45, 0xCE, 0xC8, 0x54, 0x4F, 0xD0, 0x90, 0x57, 0x41, 0xD0, - 0xA4, 0x41, 0x56, 0xC5, 0xBE, 0x50, 0x43, 0xA8, 0xD2, 0x54, 0x45, - 0xD0, 0xCF, 0x47, 0xCE, 0x4, 0x51, 0xD2, 0x7, 0x49, 0xCE, 0x9, - 0x54, 0x52, 0xA4, 0x13, 0x54, 0x52, 0x49, 0x4E, 0x47, 0xA4, 0xD6, - 0x50, 0x41, 0x43, 0x45, 0xA4, 0x18, 0x4F, 0x55, 0x4E, 0xC4, 0xC4, - 0x54, 0x49, 0x43, 0xCB, 0x21, 0x54, 0x52, 0x49, 0xC7, 0x22, 0x0, - 0x48, 0x45, 0xCE, 0xCD, 0x52, 0x4F, 0xCE, 0xA2, 0x52, 0x4F, 0x46, - 0xC6, 0xA3, 0x41, 0x42, 0xA8, 0xCE, 0xCF, 0xCC, 0x41, 0xCE, 0xD, - 0x0, 0x53, 0x49, 0x4E, 0xC7, 0xD7, 0x53, 0xD2, 0xD0, 0x0, 0x41, - 0xCC, 0x14, 0x41, 0x52, 0x50, 0x54, 0xD2, 0xDA, 0x0, 0x49, 0x44, - 0x54, 0xC8, 0xA0, 0x41, 0x49, 0xD4, 0x96, 0x48, 0x49, 0x4C, 0xC5, - 0xB1, 0x45, 0x4E, 0xC4, 0xB2, 0x52, 0x49, 0x54, 0xC5, 0xB7, 0x0, - 0x4F, 0xD2, 0xF0, 0x0, 0x0, 0x0, 0xAB, 0xE9, 0xAD, 0xEA, 0xAA, - 0xEB, 0xAF, 0xEC, 0xDE, 0xED, 0xDC, 0xF4, 0xA7, 0xD9, 0xBE, 0xE6, - 0xBD, 0xE7, 0xBC, 0xE8, 0x0, 0x79, 0x79, 0x7C, 0x7C, 0x7F, 0x50, - 0x46, 0x3C, 0x32, 0x28, 0x7A, 0x7B, 0x82, 0x6B, 0x0, 0x0, 0xAD, - 0x6B, 0x3B, 0x64, 0x51, 0x6B, 0xA8, 0x66, 0x3, 0x63, 0x53, 0x6C, - 0x20, 0x63, 0x74, 0x65, 0x12, 0x63, 0x19, 0x63, 0x41, 0x63, 0x28, - 0x63, 0x31, 0x64, 0x6A, 0x63, 0x4F, 0x63, 0x89, 0x63, 0xD7, 0x18, - 0xB4, 0x65, 0x0, 0x4E, 0x45, 0x58, 0x54, 0x20, 0x77, 0x69, 0x74, - 0x68, 0x6F, 0x75, 0x74, 0x20, 0x46, 0x4F, 0x52, 0x0, 0x53, 0x79, - 0x6E, 0x74, 0x61, 0x78, 0x20, 0x65, 0x72, 0x72, 0x6F, 0x72, 0x0, - 0x52, 0x45, 0x54, 0x55, 0x52, 0x4E, 0x20, 0x77, 0x69, 0x74, 0x68, - 0x6F, 0x75, 0x74, 0x20, 0x47, 0x4F, 0x53, 0x55, 0x42, 0x0, 0x4F, - 0x75, 0x74, 0x20, 0x6F, 0x66, 0x20, 0x44, 0x41, 0x54, 0x41, 0x0, - 0x49, 0x6C, 0x6C, 0x65, 0x67, 0x61, 0x6C, 0x20, 0x66, 0x75, 0x6E, - 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x20, 0x63, 0x61, 0x6C, 0x6C, 0x0, - 0x4F, 0x76, 0x65, 0x72, 0x66, 0x6C, 0x6F, 0x77, 0x0, 0x4F, 0x75, - 0x74, 0x20, 0x6F, 0x66, 0x20, 0x6D, 0x65, 0x6D, 0x6F, 0x72, 0x79, - 0x0, 0x55, 0x6E, 0x64, 0x65, 0x66, 0x69, 0x6E, 0x65, 0x64, 0x20, - 0x6C, 0x69, 0x6E, 0x65, 0x20, 0x6E, 0x75, 0x6D, 0x62, 0x65, 0x72, - 0x0, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x20, - 0x6F, 0x75, 0x74, 0x20, 0x6F, 0x66, 0x20, 0x72, 0x61, 0x6E, 0x67, - 0x65, 0x0, 0x44, 0x75, 0x70, 0x6C, 0x69, 0x63, 0x61, 0x74, 0x65, - 0x20, 0x44, 0x65, 0x66, 0x69, 0x6E, 0x69, 0x74, 0x69, 0x6F, 0x6E, - 0x0, 0x44, 0x69, 0x76, 0x69, 0x73, 0x69, 0x6F, 0x6E, 0x20, 0x62, - 0x79, 0x20, 0x7A, 0x65, 0x72, 0x6F, 0x0, 0x49, 0x6C, 0x6C, 0x65, - 0x67, 0x61, 0x6C, 0x20, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x0, - 0x54, 0x79, 0x70, 0x65, 0x20, 0x6D, 0x69, 0x73, 0x6D, 0x61, 0x74, - 0x63, 0x68, 0x0, 0x4F, 0x75, 0x74, 0x20, 0x6F, 0x66, 0x20, 0x73, - 0x74, 0x72, 0x69, 0x6E, 0x67, 0x20, 0x73, 0x70, 0x61, 0x63, 0x65, - 0x0, 0x53, 0x74, 0x72, 0x69, 0x6E, 0x67, 0x20, 0x74, 0x6F, 0x6F, - 0x20, 0x6C, 0x6F, 0x6E, 0x67, 0x0, 0x53, 0x74, 0x72, 0x69, 0x6E, - 0x67, 0x20, 0x66, 0x6F, 0x72, 0x6D, 0x75, 0x6C, 0x61, 0x20, 0x74, - 0x6F, 0x6F, 0x20, 0x63, 0x6F, 0x6D, 0x70, 0x6C, 0x65, 0x78, 0x0, - 0x43, 0x61, 0x6E, 0x27, 0x74, 0x20, 0x63, 0x6F, 0x6E, 0x74, 0x69, - 0x6E, 0x75, 0x65, 0x0, 0x55, 0x6E, 0x64, 0x65, 0x66, 0x69, 0x6E, - 0x65, 0x64, 0x20, 0x75, 0x73, 0x65, 0x72, 0x20, 0x66, 0x75, 0x6E, - 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x0, 0x4E, 0x6F, 0x20, 0x52, 0x45, - 0x53, 0x55, 0x4D, 0x45, 0x0, 0x52, 0x45, 0x53, 0x55, 0x4D, 0x45, - 0x20, 0x77, 0x69, 0x74, 0x68, 0x6F, 0x75, 0x74, 0x20, 0x65, 0x72, - 0x72, 0x6F, 0x72, 0x0, 0x55, 0x6E, 0x70, 0x72, 0x69, 0x6E, 0x74, - 0x61, 0x62, 0x6C, 0x65, 0x20, 0x65, 0x72, 0x72, 0x6F, 0x72, 0x0, - 0x4D, 0x69, 0x73, 0x73, 0x69, 0x6E, 0x67, 0x20, 0x6F, 0x70, 0x65, - 0x72, 0x61, 0x6E, 0x64, 0x0, 0x4C, 0x69, 0x6E, 0x65, 0x20, 0x62, - 0x75, 0x66, 0x66, 0x65, 0x72, 0x20, 0x6F, 0x76, 0x65, 0x72, 0x66, - 0x6C, 0x6F, 0x77, 0x0, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x20, - 0x54, 0x69, 0x6D, 0x65, 0x6F, 0x75, 0x74, 0x0, 0x44, 0x65, 0x76, - 0x69, 0x63, 0x65, 0x20, 0x46, 0x61, 0x75, 0x6C, 0x74, 0x0, 0x46, - 0x4F, 0x52, 0x20, 0x57, 0x69, 0x74, 0x68, 0x6F, 0x75, 0x74, 0x20, - 0x4E, 0x45, 0x58, 0x54, 0x0, 0x4F, 0x75, 0x74, 0x20, 0x6F, 0x66, - 0x20, 0x50, 0x61, 0x70, 0x65, 0x72, 0x0, 0x3F, 0x0, 0x57, 0x48, - 0x49, 0x4C, 0x45, 0x20, 0x77, 0x69, 0x74, 0x68, 0x6F, 0x75, 0x74, - 0x20, 0x57, 0x45, 0x4E, 0x44, 0x0, 0x57, 0x45, 0x4E, 0x44, 0x20, - 0x77, 0x69, 0x74, 0x68, 0x6F, 0x75, 0x74, 0x20, 0x57, 0x48, 0x49, - 0x4C, 0x45, 0x0, 0x46, 0x49, 0x45, 0x4C, 0x44, 0x20, 0x6F, 0x76, - 0x65, 0x72, 0x66, 0x6C, 0x6F, 0x77, 0x0, 0x49, 0x6E, 0x74, 0x65, - 0x72, 0x6E, 0x61, 0x6C, 0x20, 0x65, 0x72, 0x72, 0x6F, 0x72, 0x0, - 0x42, 0x61, 0x64, 0x20, 0x66, 0x69, 0x6C, 0x65, 0x20, 0x6E, 0x75, - 0x6D, 0x62, 0x65, 0x72, 0x0, 0x46, 0x69, 0x6C, 0x65, 0x20, 0x6E, - 0x6F, 0x74, 0x20, 0x66, 0x6F, 0x75, 0x6E, 0x64, 0x0, 0x42, 0x61, - 0x64, 0x20, 0x66, 0x69, 0x6C, 0x65, 0x20, 0x6D, 0x6F, 0x64, 0x65, - 0x0, 0x46, 0x69, 0x6C, 0x65, 0x20, 0x61, 0x6C, 0x72, 0x65, 0x61, - 0x64, 0x79, 0x20, 0x6F, 0x70, 0x65, 0x6E, 0x0, 0x3F, 0x0, 0x44, - 0x65, 0x76, 0x69, 0x63, 0x65, 0x20, 0x49, 0x2F, 0x4F, 0x20, 0x45, - 0x72, 0x72, 0x6F, 0x72, 0x0, 0x46, 0x69, 0x6C, 0x65, 0x20, 0x61, - 0x6C, 0x72, 0x65, 0x61, 0x64, 0x79, 0x20, 0x65, 0x78, 0x69, 0x73, - 0x74, 0x73, 0x0, 0x3F, 0x0, 0x3F, 0x0, 0x44, 0x69, 0x73, 0x6B, - 0x20, 0x66, 0x75, 0x6C, 0x6C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0x8C, 0xE, 0x6E, 0x0, - 0x8C, 0xE, 0x72, 0x0, 0x1F, 0xE8, 0x32, 0x0, 0xBB, 0x18, 0x2, - 0xB9, 0x0, 0x0, 0x8E, 0xC1, 0xB9, 0x7A, 0x0, 0x26, 0x8C, 0x8F, - 0x2, 0x0, 0x26, 0xC7, 0x7, 0x94, 0x4C, 0x83, 0xC3, 0x4, 0xE0, - 0xF1, 0x8C, 0xDB, 0x8E, 0xC3, 0xE8, 0x48, 0xE1, 0xFB, 0xB4, 0x1, - 0xCD, 0x17, 0xE8, 0x77, 0x6, 0xBB, 0x9B, 0x4C, 0xE8, 0xDF, 0x2E, - 0xE9, 0x63, 0x32, 0xBE, 0xED, 0x4C, 0xBB, 0x53, 0x6, 0xB9, 0xA, - 0x0, 0x53, 0xFC, 0x2E, 0xAC, 0x88, 0x7, 0x43, 0xA, 0xC0, 0x75, - 0xF6, 0x5B, 0x83, 0xC3, 0x10, 0xE0, 0xEF, 0xC3, 0xCF, 0x3E, 0xFF, - 0x2E, 0x0, 0x7, 0xCB, 0x54, 0x68, 0x65, 0x20, 0x49, 0x42, 0x4D, - 0x20, 0x50, 0x65, 0x72, 0x73, 0x6F, 0x6E, 0x61, 0x6C, 0x20, 0x43, - 0x6F, 0x6D, 0x70, 0x75, 0x74, 0x65, 0x72, 0x20, 0x42, 0x61, 0x73, - 0x69, 0x63, 0xFF, 0xD, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6F, 0x6E, - 0x20, 0x43, 0x31, 0x2E, 0x31, 0x30, 0x20, 0x43, 0x6F, 0x70, 0x79, - 0x72, 0x69, 0x67, 0x68, 0x74, 0x20, 0x49, 0x42, 0x4D, 0x20, 0x43, - 0x6F, 0x72, 0x70, 0x20, 0x31, 0x39, 0x38, 0x31, 0xFF, 0xD, 0x0, - 0x32, 0x35, 0x2D, 0x41, 0x70, 0x72, 0x2D, 0x38, 0x31, 0x4C, 0x49, - 0x53, 0x54, 0x20, 0x0, 0x52, 0x55, 0x4E, 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0xEE, 0x8A, 0xC4, 0xEE, 0x75, - 0x7, 0xBA, 0x61, 0x0, 0xEC, 0xC, 0x3, 0xEE, 0x5A, 0x89, 0x16, - 0x66, 0x0, 0xC6, 0x6, 0x65, 0x0, 0x0, 0xC3, 0xA, 0x5A, 0x4D, - 0x41, 0x59, 0x10, 0x59, 0x10, 0x19, 0x5A, 0x59, 0x10, 0x59, 0x10, - 0x59, 0x10, 0x59, 0x10, 0x2D, 0x5A, 0x59, 0x10, 0x34, 0x5A, 0x4D, - 0x41, 0x59, 0x10, 0x45, 0x5A, 0x59, 0x10, 0x59, 0x10, 0x59, 0x10, - 0x59, 0x10, 0x59, 0x10, 0x59, 0x10, 0x5D, 0x5A, 0x63, 0x5A, 0x4D, - 0x41, 0x59, 0x10, 0x7C, 0x5A, 0x59, 0x10, 0x59, 0x10, 0x59, 0x10, - 0x59, 0x10, 0x59, 0x10, 0x59, 0x10, 0xAA, 0x5A, 0xB1, 0x5A, 0x6E, - 0x5B, 0x59, 0x10, 0xAB, 0x5B, 0xF0, 0x5B, 0x59, 0x10, 0x59, 0x10, - 0x6C, 0x5C, 0x59, 0x10, 0x76, 0x5C, 0x59, 0x10, 0x22, 0xC2, 0x75, - 0x22, 0x9C, 0x50, 0x53, 0x89, 0x1E, 0xE9, 0x4, 0x88, 0x17, 0x83, - 0xC3, 0x2D, 0xC6, 0x7, 0x0, 0x43, 0x43, 0x88, 0x2F, 0x43, 0xC6, - 0x7, 0x0, 0x43, 0x88, 0xF, 0x43, 0xC6, 0x7, 0x0, 0x5B, 0x58, - 0x9D, 0xC3, 0xE9, 0x98, 0xAE, 0x58, 0x5B, 0xC3, 0x80, 0xFA, 0x80, - 0x75, 0x2, 0xB2, 0x2, 0xC3, 0x58, 0x86, 0xC4, 0x9E, 0x59, 0x5A, - 0x5B, 0xC3, 0x5A, 0x5B, 0x59, 0xC3, 0x83, 0xC3, 0x2E, 0x8A, 0x7, - 0xF6, 0xD0, 0xC3, 0x8B, 0x1E, 0xE9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1A, 0xC7, - 0x8A, 0xF8, 0x73, 0x3, 0xE9, 0x4A, 0xAD, 0x89, 0x1E, 0xA, 0x3, - 0x87, 0xDA, 0x89, 0x1E, 0x2C, 0x0, 0x89, 0x1E, 0x2F, 0x3, 0x8B, - 0xE3, 0x89, 0x1E, 0x45, 0x3, 0x8B, 0x1E, 0x30, 0x0, 0x87, 0xDA, - 0xE8, 0x3D, 0xAD, 0x2B, 0xDA, 0x4B, 0x4B, 0x53, 0x5B, 0xE8, 0x80, - 0xE5, 0xBB, 0xDC, 0x7F, 0xE8, 0x7F, 0xFB, 0xE8, 0x98, 0xAC, 0xE9, - 0x8F, 0xC3, 0x20, 0x42, 0x79, 0x74, 0x65, 0x73, 0x20, 0x66, 0x72, - 0x65, 0x65, 0x0, 0x14, 0xE8, 0xA5, 0xF0, 0x33, 0xC9, 0x52, 0xFF, - 0x36, 0x81, 0x4, 0xE9, 0x68, 0xF6, 0xFD, 0xFF, 0x3, 0xBF, 0xC9, - 0x1B, 0xE, 0xB6, 0x0, 0x0 -}; -#endif - diff --git a/MCUME_pico/pico81/AudioPlaySystem.cpp b/MCUME_pico/pico81/AudioPlaySystem.cpp deleted file mode 100644 index aee40a1..0000000 --- a/MCUME_pico/pico81/AudioPlaySystem.cpp +++ /dev/null @@ -1,176 +0,0 @@ -#include "emuapi.h" - -#ifdef HAS_SND - -#include "AudioPlaySystem.h" - -#define SAMPLERATE AUDIO_SAMPLE_RATE_EXACT -#define CLOCKFREQ 985248 - -#ifndef CUSTOM_SND -static const short square[]={ -32767,32767,32767,32767, -32767,32767,32767,32767, -32767,32767,32767,32767, -32767,32767,32767,32767, -32767,32767,32767,32767, -32767,32767,32767,32767, -32767,32767,32767,32767, -32767,32767,32767,32767, --32767,-32767,-32767,-32767, --32767,-32767,-32767,-32767, --32767,-32767,-32767,-32767, --32767,-32767,-32767,-32767, --32767,-32767,-32767,-32767, --32767,-32767,-32767,-32767, --32767,-32767,-32767,-32767, --32767,-32767,-32767,-32767, -}; - -const short noise[] { --32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767, --32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,32767,-32767, --32767,-32767,32767,-32767,-32767,-32767,32767,-32767,-32767,-32767,32767,-32767,-32767,-32767,32767,-32767, --32767,-32767,32767,-32767,-32767,-32767,32767,-32767,-32767,-32767,32767,-32767,-32767,32767,32767,-32767, --32767,-32767,32767,-32767,-32767,32767,32767,-32767,-32767,-32767,32767,-32767,-32767,32767,32767,-32767, --32767,-32767,32767,-32767,-32767,32767,32767,-32767,-32767,-32767,32767,-32767,32767,32767,32767,-32767, -32767,-32767,32767,-32767,-32767,32767,32767,-32767,-32767,-32767,32767,-32767,32767,32767,32767,-32767, -32767,-32767,32767,-32767,-32767,32767,32767,-32767,-32767,-32767,32767,32767,32767,32767,32767,-32767, -32767,-32767,32767,-32767,-32767,32767,32767,-32767,-32767,-32767,32767,32767,32767,32767,32767,-32767, -32767,-32767,32767,-32767,-32767,32767,32767,-32767,-32767,-32767,-32767,32767,32767,32767,-32767,-32767, -32767,-32767,-32767,-32767,-32767,32767,-32767,-32767,-32767,-32767,32767,32767,32767,32767,32767,-32767, -32767,-32767,32767,-32767,-32767,32767,32767,-32767,-32767,32767,-32767,32767,32767,32767,-32767,-32767, -32767,32767,-32767,-32767,-32767,32767,-32767,-32767,-32767,-32767,32767,32767,32767,32767,32767,-32767, -32767,-32767,32767,-32767,-32767,32767,32767,-32767,32767,32767,-32767,32767,-32767,32767,-32767,-32767, -32767,32767,-32767,-32767,-32767,32767,-32767,-32767,-32767,-32767,32767,32767,32767,32767,32767,-32767, -32767,-32767,32767,-32767,-32767,32767,32767,32767,32767,32767,-32767,32767,-32767,32767,-32767,-32767, -}; - -#define NOISEBSIZE 0x100 - -typedef struct -{ - unsigned int spos; - unsigned int sinc; - unsigned int vol; -} Channel; - -static Channel chan[6] = { - {0,0,0}, - {0,0,0}, - {0,0,0}, - {0,0,0}, - {0,0,0}, - {0,0,0} }; - -#endif - -volatile bool playing = false; - - -static void snd_Reset(void) -{ -#ifndef CUSTOM_SND - chan[0].vol = 0; - chan[1].vol = 0; - chan[2].vol = 0; - chan[3].vol = 0; - chan[4].vol = 0; - chan[5].vol = 0; - chan[0].sinc = 0; - chan[1].sinc = 0; - chan[2].sinc = 0; - chan[3].sinc = 0; - chan[4].sinc = 0; - chan[5].sinc = 0; -#endif -} - - -#ifdef CUSTOM_SND -extern "C" { -void SND_Process(void *sndbuffer, int sndn); -} -#endif - -#include -void AudioPlaySystem::snd_Mixer(short * stream, int len ) -{ - if (playing) - { -#ifdef CUSTOM_SND - //printf("s\n"); - SND_Process((void*)stream, len); -#else - int i; - long s; - len = len >> 1; - short v0=chan[0].vol; - short v1=chan[1].vol; - short v2=chan[2].vol; - short v3=chan[3].vol; - short v4=chan[4].vol; - short v5=chan[5].vol; - for (i=0;i>8)&0x3f])>>11); - s+=((v1*square[(chan[1].spos>>8)&0x3f])>>11); - s+=((v2*square[(chan[2].spos>>8)&0x3f])>>11); - s+=((v3*noise[(chan[3].spos>>8)&(NOISEBSIZE-1)])>>11); - s+=((v4*noise[(chan[4].spos>>8)&(NOISEBSIZE-1)])>>11); - s+=((v5*noise[(chan[5].spos>>8)&(NOISEBSIZE-1)])>>11); - *stream++ = (short)(s); - *stream++ = (short)(s); - chan[0].spos += chan[0].sinc; - chan[1].spos += chan[1].sinc; - chan[2].spos += chan[2].sinc; - chan[3].spos += chan[3].sinc; - chan[4].spos += chan[4].sinc; - chan[5].spos += chan[5].sinc; - } -#endif - } -} - -void AudioPlaySystem::begin(void) -{ - this->reset(); -} - -void AudioPlaySystem::start(void) -{ - playing = true; -} - -void AudioPlaySystem::setSampleParameters(float clockfreq, float samplerate) { -} - -void AudioPlaySystem::reset(void) -{ - snd_Reset(); -} - -void AudioPlaySystem::stop(void) -{ - playing = false; -} - -bool AudioPlaySystem::isPlaying(void) -{ - return playing; -} - - - -void AudioPlaySystem::sound(int C, int F, int V) { -#ifndef CUSTOM_SND - if (C < 6) { - chan[C].vol = V; - chan[C].sinc = F>>1; - } -#endif -} - -void AudioPlaySystem::step(void) { -} -#endif diff --git a/MCUME_pico/pico81/AudioPlaySystem.h b/MCUME_pico/pico81/AudioPlaySystem.h deleted file mode 100644 index 5d2efc0..0000000 --- a/MCUME_pico/pico81/AudioPlaySystem.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef audioplaysystem_h_ -#define audioplaysystem_h_ - -#ifdef HAS_SND - -#include "platform_config.h" - -class AudioPlaySystem -{ -public: - AudioPlaySystem(void) { }; - void begin(void); - void setSampleParameters(float clockfreq, float samplerate); - void reset(void); - void start(void); - void stop(void); - bool isPlaying(void); - void sound(int C, int F, int V); - void buzz(int size, int val); - void step(void); - static void snd_Mixer(short * stream, int len ); -}; - -#endif - -#endif diff --git a/MCUME_pico/pico81/emuapi.cpp b/MCUME_pico/pico81/emuapi.cpp deleted file mode 100644 index 1bc929b..0000000 --- a/MCUME_pico/pico81/emuapi.cpp +++ /dev/null @@ -1,1311 +0,0 @@ -#define KEYMAP_PRESENT 1 - -#define PROGMEM - -#include "pico.h" -#include "pico/stdlib.h" -#include "hardware/adc.h" -#include -#include - -extern "C" { - #include "emuapi.h" - #include "iopins.h" -} - -static bool emu_writeConfig(void); -static bool emu_readConfig(void); -static bool emu_eraseConfig(void); - - -#if (defined(ILI9341) || defined(ST7789)) && defined(USE_VGA) -// Dual display config, initialize TFT -#include "tft_t_dma.h" -static TFT_T_DMA tft; -#else -// Non Dual display config -#ifdef USE_VGA -#include "vga_t_dma.h" -#else -#include "tft_t_dma.h" -#endif -extern TFT_T_DMA tft; -#endif - - -#define MAX_FILENAME_PATH 64 -#define NB_FILE_HANDLER 4 -#define AUTORUN_FILENAME "autorun.txt" - -#define MAX_FILES 64 -#define MAX_FILENAME_SIZE 24 -#define MAX_MENULINES 9 -#define TEXT_HEIGHT 16 -#define TEXT_WIDTH 8 -#define MENU_FILE_XOFFSET (6*TEXT_WIDTH) -#define MENU_FILE_YOFFSET (2*TEXT_HEIGHT) -#define MENU_FILE_W (MAX_FILENAME_SIZE*TEXT_WIDTH) -#define MENU_FILE_H (MAX_MENULINES*TEXT_HEIGHT) -#define MENU_FILE_BGCOLOR RGBVAL16(0x00,0x00,0x40) -#define MENU_JOYS_YOFFSET (12*TEXT_HEIGHT) -#define MENU_VBAR_XOFFSET (0*TEXT_WIDTH) -#define MENU_VBAR_YOFFSET (MENU_FILE_YOFFSET) - -#define MENU_TFT_XOFFSET (MENU_FILE_XOFFSET+MENU_FILE_W+8) -#define MENU_TFT_YOFFSET (MENU_VBAR_YOFFSET+32) -#define MENU_VGA_XOFFSET (MENU_FILE_XOFFSET+MENU_FILE_W+8) -#define MENU_VGA_YOFFSET (MENU_VBAR_YOFFSET+MENU_FILE_H-32-37) - - - -static int nbFiles=0; -static int curFile=0; -static int topFile=0; -static char selection[MAX_FILENAME_PATH]=""; -static char selected_filename[MAX_FILENAME_SIZE]=""; -static char files[MAX_FILES][MAX_FILENAME_SIZE]; -static bool menuRedraw=true; - -#ifdef PICOMPUTER -static const unsigned short * keys; -static unsigned char keymatrix[6]; -static int keymatrix_hitrow=-1; -static bool key_fn=false; -static bool key_alt=false; -static uint32_t keypress_t_ms=0; -static uint32_t last_t_ms=0; -static uint32_t hundred_ms_cnt=0; -static bool ledflash_toggle=false; -#endif -static int keyMap; - -static bool joySwapped = false; -static uint16_t bLastState; -static int xRef; -static int yRef; -static uint8_t usbnavpad=0; - -static bool menuOn=true; -static bool autorun=false; - - -/******************************** - * Generic output and malloc -********************************/ -void emu_printf(const char * text) -{ - printf("%s\n",text); -} - -void emu_printf(int val) -{ - printf("%d\n",val); -} - -void emu_printi(int val) -{ - printf("%d\n",val); -} - -void emu_printh(int val) -{ - printf("0x%.8\n",val); -} - -static int malbufpt = 0; -static char malbuf[EXTRA_HEAP]; - -void * emu_Malloc(int size) -{ - void * retval = malloc(size); - if (!retval) { - emu_printf("failled to allocate"); - emu_printf(size); - emu_printf("fallback"); - if ( (malbufpt+size) < sizeof(malbuf) ) { - retval = (void *)&malbuf[malbufpt]; - malbufpt += size; - } - else { - emu_printf("failure to allocate"); - } - } - else { - emu_printf("could allocate dynamic "); - emu_printf(size); - } - - return retval; -} - -void * emu_MallocI(int size) -{ - void * retval = NULL; - - if ( (malbufpt+size) < sizeof(malbuf) ) { - retval = (void *)&malbuf[malbufpt]; - malbufpt += size; - emu_printf("could allocate static "); - emu_printf(size); - } - else { - emu_printf("failure to allocate"); - } - - return retval; -} -void emu_Free(void * pt) -{ - free(pt); -} - -void emu_drawText(unsigned short x, unsigned short y, const char * text, unsigned short fgcolor, unsigned short bgcolor, int doublesize) -{ - tft.drawText(x, y, text, fgcolor, bgcolor, doublesize?true:false); -} - - -/******************************** - * OSKB handling -********************************/ -#if (defined(ILI9341) || defined(ST7789)) && defined(USE_VGA) -// On screen keyboard position -#define KXOFF 28 //64 -#define KYOFF 96 -#define KWIDTH 11 //22 -#define KHEIGHT 3 - -static bool oskbOn = false; -static int cxpos = 0; -static int cypos = 0; -static int oskbMap = 0; -static uint16_t oskbBLastState = 0; - -static void lineOSKB2(int kxoff, int kyoff, char * str, int row) -{ - char c[2] = {'A',0}; - const char * cpt = str; - for (int i=0; i.,SP ", 2); - if (oskbMap == 0) { - lineOSKB(KXOFF,KYOFF, keylables_map1_0, 0); - lineOSKB(KXOFF,KYOFF, keylables_map1_1, 1); - lineOSKB(KXOFF,KYOFF, keylables_map1_2, 2); - } - else if (oskbMap == 1) { - lineOSKB(KXOFF,KYOFF, keylables_map2_0, 0); - lineOSKB(KXOFF,KYOFF, keylables_map2_1, 1); - lineOSKB(KXOFF,KYOFF, keylables_map2_2, 2); - } - else { - lineOSKB(KXOFF,KYOFF, keylables_map3_0, 0); - lineOSKB(KXOFF,KYOFF, keylables_map3_1, 1); - lineOSKB(KXOFF,KYOFF, keylables_map3_2, 2); - } -} - -void toggleOskb(bool forceoff) { - if (forceoff) oskbOn=true; - if (oskbOn) { - oskbOn = false; - tft.fillScreenNoDma(RGBVAL16(0x00,0x00,0x00)); - tft.drawTextNoDma(0,32, "Press USER2 to toggle onscreen keyboard.", RGBVAL16(0xff,0xff,0xff), RGBVAL16(0x00,0x00,0x00), true); - } else { - oskbOn = true; - tft.fillScreenNoDma(RGBVAL16(0x00,0x00,0x00)); - tft.drawTextNoDma(0,32, " Press USER2 to exit onscreen keyboard. ", RGBVAL16(0xff,0xff,0xff), RGBVAL16(0x00,0x00,0x00), true); - tft.drawTextNoDma(0,64, " (USER1 to toggle between keymaps) ", RGBVAL16(0x00,0xff,0xff), RGBVAL16(0x00,0x00,0xff), true); - tft.drawRectNoDma(KXOFF,KYOFF, 22*8, 3*16, RGBVAL16(0x00,0x00,0xFF)); - drawOskb(); - } -} - -static int handleOskb(void) -{ - int retval = 0; - - uint16_t bClick = bLastState & ~oskbBLastState; - oskbBLastState = bLastState; - /* - static const char * digits = "0123456789ABCDEF"; - char buf[5] = {0,0,0,0,0}; - int val = bClick; - buf[0] = digits[(val>>12)&0xf]; - buf[1] = digits[(val>>8)&0xf]; - buf[2] = digits[(val>>4)&0xf]; - buf[3] = digits[val&0xf]; - tft.drawTextNoDma(0,KYOFF+ 64,buf,RGBVAL16(0x00,0x00,0x00),RGBVAL16(0xFF,0xFF,0xFF),1); - */ - if (bClick & MASK_KEY_USER2) - { - toggleOskb(false); - } - if (oskbOn) - { - bool updated = true; - if (bClick & MASK_KEY_USER1) - { - oskbMap += 1; - if (oskbMap == 3) oskbMap = 0; - } - else if (bClick & MASK_JOY2_LEFT) - { - cxpos++; - if (cxpos >= KWIDTH) cxpos = 0; - } - else if (bClick & MASK_JOY2_RIGHT) - { - cxpos--; - if (cxpos < 0) cxpos = KWIDTH-1; - } - else if (bClick & MASK_JOY2_DOWN) - { - cypos++; - if (cypos >= KHEIGHT) cypos = 0; - } - else if (bClick & MASK_JOY2_UP) - { - cypos--; - if (cypos < 0) cypos = KHEIGHT-1; - } - else if (oskbBLastState & MASK_JOY2_BTN) - { - retval = cypos*KWIDTH+cxpos+1; - if (retval) { - retval--; - //if (retval & 1) retval = key_map2[retval>>1]; - //else retval = key_map1[retval>>1]; - if (oskbMap == 0) { - retval = key_map1[retval]; - } - else if (oskbMap == 1) { - retval = key_map2[retval]; - } - else { - retval = key_map3[retval]; - } - //if (retval) { toggleOskb(true); updated=false; }; - } - } - else { - updated=false; - } - if (updated) drawOskb(); - } - - return retval; -} -#endif - -/******************************** - * Input and keyboard -********************************/ -int emu_ReadAnalogJoyX(int min, int max) -{ - adc_select_input(0); - int val = adc_read(); -#if INVX - val = 4095 - val; -#endif - val = val-xRef; - val = ((val*140)/100); - if ( (val > -512) && (val < 512) ) val = 0; - val = val+2048; - return (val*(max-min))/4096; -} - -int emu_ReadAnalogJoyY(int min, int max) -{ - adc_select_input(1); - int val = adc_read(); -#if INVY - val = 4095 - val; -#endif - val = val-yRef; - val = ((val*120)/100); - if ( (val > -512) && (val < 512) ) val = 0; - //val = (val*(max-min))/4096; - val = val+2048; - //return val+(max-min)/2; - return (val*(max-min))/4096; -} - - -static uint16_t readAnalogJoystick(void) -{ - uint16_t joysval = 0; -#ifdef PIN_JOY2_A1X - int xReading = emu_ReadAnalogJoyX(0,256); - if (xReading > 128) joysval |= MASK_JOY2_LEFT; - else if (xReading < 128) joysval |= MASK_JOY2_RIGHT; - - int yReading = emu_ReadAnalogJoyY(0,256); - if (yReading < 128) joysval |= MASK_JOY2_UP; - else if (yReading > 128) joysval |= MASK_JOY2_DOWN; -#endif - // First joystick -#if INVY -#ifdef PIN_JOY2_1 - if ( !gpio_get(PIN_JOY2_1) ) joysval |= MASK_JOY2_DOWN; -#endif -#ifdef PIN_JOY2_2 - if ( !gpio_get(PIN_JOY2_2) ) joysval |= MASK_JOY2_UP; -#endif -#else -#ifdef PIN_JOY2_1 - if ( !gpio_get(PIN_JOY2_1) ) joysval |= MASK_JOY2_UP; -#endif -#ifdef PIN_JOY2_2 - if ( !gpio_get(PIN_JOY2_2) ) joysval |= MASK_JOY2_DOWN; -#endif -#endif -#if INVX -#ifdef PIN_JOY2_3 - if ( !gpio_get(PIN_JOY2_3) ) joysval |= MASK_JOY2_LEFT; -#endif -#ifdef PIN_JOY2_4 - if ( !gpio_get(PIN_JOY2_4) ) joysval |= MASK_JOY2_RIGHT; -#endif -#else -#ifdef PIN_JOY2_3 - if ( !gpio_get(PIN_JOY2_3) ) joysval |= MASK_JOY2_RIGHT; -#endif -#ifdef PIN_JOY2_4 - if ( !gpio_get(PIN_JOY2_4) ) joysval |= MASK_JOY2_LEFT; -#endif -#endif -#ifdef PIN_JOY2_BTN - joysval |= (gpio_get(PIN_JOY2_BTN) ? 0 : MASK_JOY2_BTN); -#endif - - return (joysval); -} - - -int emu_SwapJoysticks(int statusOnly) { - if (!statusOnly) { - if (joySwapped) { - joySwapped = false; - } - else { - joySwapped = true; - } - } - return(joySwapped?1:0); -} - -int emu_GetPad(void) -{ - return(bLastState/*|((joySwapped?1:0)<<7)*/); -} - -int emu_ReadKeys(void) -{ - uint16_t retval; - uint16_t j1 = readAnalogJoystick(); - uint16_t j2 = 0; - - // Second joystick -#if INVY -#ifdef PIN_JOY1_1 - if ( !gpio_get(PIN_JOY1_1) ) j2 |= MASK_JOY2_DOWN; -#endif -#ifdef PIN_JOY1_2 - if ( !gpio_get(PIN_JOY1_2) ) j2 |= MASK_JOY2_UP; -#endif -#else -#ifdef PIN_JOY1_1 - if ( !gpio_get(PIN_JOY1_1) ) j2 |= MASK_JOY2_UP; -#endif -#ifdef PIN_JOY1_2 - if ( !gpio_get(PIN_JOY1_2) ) j2 |= MASK_JOY2_DOWN; -#endif -#endif -#if INVX -#ifdef PIN_JOY1_3 - if ( !gpio_get(PIN_JOY1_3) ) j2 |= MASK_JOY2_LEFT; -#endif -#ifdef PIN_JOY1_4 - if ( !gpio_get(PIN_JOY1_4) ) j2 |= MASK_JOY2_RIGHT; -#endif -#else -#ifdef PIN_JOY1_3 - if ( !gpio_get(PIN_JOY1_3) ) j2 |= MASK_JOY2_RIGHT; -#endif -#ifdef PIN_JOY1_4 - if ( !gpio_get(PIN_JOY1_4) ) j2 |= MASK_JOY2_LEFT; -#endif -#endif -#ifdef PIN_JOY1_BTN - if ( !gpio_get(PIN_JOY1_BTN) ) j2 |= MASK_JOY2_BTN; -#endif - - - if (joySwapped) { - retval = ((j1 << 8) | j2); - } - else { - retval = ((j2 << 8) | j1); - } - - if (usbnavpad & MASK_JOY2_UP) retval |= MASK_JOY2_UP; - if (usbnavpad & MASK_JOY2_DOWN) retval |= MASK_JOY2_DOWN; - if (usbnavpad & MASK_JOY2_LEFT) retval |= MASK_JOY2_LEFT; - if (usbnavpad & MASK_JOY2_RIGHT) retval |= MASK_JOY2_RIGHT; - if (usbnavpad & MASK_JOY2_BTN) retval |= MASK_JOY2_BTN; - -#ifdef PIN_KEY_USER1 - if ( !gpio_get(PIN_KEY_USER1) ) retval |= MASK_KEY_USER1; -#endif -#ifdef PIN_KEY_USER2 - if ( !gpio_get(PIN_KEY_USER2) ) retval |= MASK_KEY_USER2; -#endif -#ifdef PIN_KEY_USER3 - if ( !gpio_get(PIN_KEY_USER3) ) retval |= MASK_KEY_USER3; -#endif -#ifdef PIN_KEY_USER4 - if ( !gpio_get(PIN_KEY_USER4) ) retval |= MASK_KEY_USER4; -#endif - -#ifdef PICOMPUTER - keymatrix_hitrow = -1; - unsigned char row; - unsigned short cols[6]={KCOLOUT1,KCOLOUT2,KCOLOUT3,KCOLOUT4,KCOLOUT5,KCOLOUT6}; - unsigned char keymatrixtmp[6]; - - for (int i=0;i<6;i++){ - gpio_set_dir(cols[i], GPIO_OUT); - gpio_put(cols[i], 0); -#ifdef SWAP_ALT_DEL - sleep_us(1); - //__asm volatile ("nop\n"); // 4-8ns -#endif - row=0; - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN4) ? 0 : 0x02); - row |= (gpio_get(KROWIN1) ? 0 : 0x04); - row |= (gpio_get(KROWIN3) ? 0 : 0x08); - row |= (gpio_get(KROWIN5) ? 0 : 0x10); - row |= (gpio_get(KROWIN6) ? 0 : 0x20); - //gpio_set_dir(cols[i], GPIO_OUT); - gpio_put(cols[i], 1); - gpio_set_dir(cols[i], GPIO_IN); - gpio_disable_pulls(cols[i]); - keymatrixtmp[i] = row; - } - -#ifdef MULTI_DEBOUNCE - for (int i=0;i<6;i++){ - gpio_set_dir(cols[i], GPIO_OUT); - gpio_put(cols[i], 0); -#ifdef SWAP_ALT_DEL - sleep_us(1); - //__asm volatile ("nop\n"); // 4-8ns -#endif - row=0; - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN4) ? 0 : 0x02); - row |= (gpio_get(KROWIN1) ? 0 : 0x04); - row |= (gpio_get(KROWIN3) ? 0 : 0x08); - row |= (gpio_get(KROWIN5) ? 0 : 0x10); - row |= (gpio_get(KROWIN6) ? 0 : 0x20); - //gpio_set_dir(cols[i], GPIO_OUT); - gpio_put(cols[i], 1); - gpio_set_dir(cols[i], GPIO_IN); - gpio_disable_pulls(cols[i]); - keymatrixtmp[i] |= row; - } - - for (int i=0;i<6;i++){ - gpio_set_dir(cols[i], GPIO_OUT); - gpio_put(cols[i], 0); -#ifdef SWAP_ALT_DEL - sleep_us(1); - //__asm volatile ("nop\n"); // 4-8ns -#endif - row=0; - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN4) ? 0 : 0x02); - row |= (gpio_get(KROWIN1) ? 0 : 0x04); - row |= (gpio_get(KROWIN3) ? 0 : 0x08); - row |= (gpio_get(KROWIN5) ? 0 : 0x10); - row |= (gpio_get(KROWIN6) ? 0 : 0x20); - //gpio_set_dir(cols[i], GPIO_OUT); - gpio_put(cols[i], 1); - gpio_set_dir(cols[i], GPIO_IN); - gpio_disable_pulls(cols[i]); - keymatrixtmp[i] |= row; - } -#endif - -#ifdef SWAP_ALT_DEL - // Swap ALT and DEL - unsigned char alt = keymatrixtmp[0] & 0x02; - unsigned char del = keymatrixtmp[5] & 0x20; - keymatrixtmp[0] &= ~0x02; - keymatrixtmp[5] &= ~0x20; - if (alt) keymatrixtmp[5] |= 0x20; - if (del) keymatrixtmp[0] |= 0x02; -#endif - - bool alt_pressed=false; - if ( keymatrixtmp[5] & 0x20 ) {alt_pressed=true; keymatrixtmp[5] &= ~0x20;}; - - for (int i=0;i<6;i++){ - row = keymatrixtmp[i]; - if (row) keymatrix_hitrow=i; - keymatrix[i] = row; - } - - //6,9,15,8,7,22 -#if INVX - if ( row & 0x2 ) retval |= MASK_JOY2_LEFT; - if ( row & 0x1 ) retval |= MASK_JOY2_RIGHT; -#else - if ( row & 0x1 ) retval |= MASK_JOY2_LEFT; - if ( row & 0x2 ) retval |= MASK_JOY2_RIGHT; -#endif -#if INVY - if ( row & 0x8 ) retval |= MASK_JOY2_DOWN; - if ( row & 0x4 ) retval |= MASK_JOY2_UP; -#else - if ( row & 0x4 ) retval |= MASK_JOY2_DOWN; - if ( row & 0x8 ) retval |= MASK_JOY2_UP; -#endif - if ( row & 0x10 ) retval |= MASK_JOY2_BTN; - - // Handle LED flash - uint32_t time_ms=to_ms_since_boot (get_absolute_time()); - if ((time_ms-last_t_ms) > 100) { - last_t_ms = time_ms; - if (ledflash_toggle == false) { - ledflash_toggle = true; - } - else { - ledflash_toggle = false; - } - } - - if ( alt_pressed ) { - if (key_fn == false) - { - // Release to Press transition - if (hundred_ms_cnt == 0) { - keypress_t_ms=time_ms; - hundred_ms_cnt += 1; // 1 - } - else { - hundred_ms_cnt += 1; // 2 - if (hundred_ms_cnt >= 2) - { - hundred_ms_cnt = 0; - /* - if ( (time_ms-keypress_t_ms) < 500) - { - if (key_alt == false) - { - key_alt = true; - } - else - { - key_alt = false; - } - } - */ - } - } - } - else { - // Keep press - if (hundred_ms_cnt == 1) { - if ((to_ms_since_boot (get_absolute_time())-keypress_t_ms) > 2000) - { - if (key_alt == false) - { - key_alt = true; - } - else - { - key_alt = false; - } - hundred_ms_cnt = 0; - } - } - } - key_fn = true; - } - else { - key_fn = false; - } - - // Handle LED - if (key_alt == true) { - gpio_put(KLED, (ledflash_toggle?1:0)); - } - else { - if (key_fn == true) { - gpio_put(KLED, 1); - } - else { - gpio_put(KLED, 0); - } - } - - if ( key_fn ) retval |= MASK_KEY_USER2; - if ( ( key_fn ) && (keymatrix[0] == 0x02 )) retval |= MASK_KEY_USER1; -#endif - - //Serial.println(retval,HEX); - - if ( ((retval & (MASK_KEY_USER1+MASK_KEY_USER2)) == (MASK_KEY_USER1+MASK_KEY_USER2)) - || (retval & MASK_KEY_USER4 ) ) - { - } - -#if (defined(ILI9341) || defined(ST7789)) && defined(USE_VGA) - if (oskbOn) { - retval |= MASK_OSKB; - } -#endif - - return (retval); -} - -unsigned short emu_DebounceLocalKeys(void) -{ - uint16_t bCurState = emu_ReadKeys(); - uint16_t bClick = bCurState & ~bLastState; - bLastState = bCurState; - - return (bClick); -} - -int emu_ReadI2CKeyboard(void) { - int retval=0; -#ifdef PICOMPUTER - if (key_alt) { - keys = (const unsigned short *)key_map3; - } - else if (key_fn) { - keys = (const unsigned short *)key_map2; - } - else { - keys = (const unsigned short *)key_map1; - } - if (keymatrix_hitrow >=0 ) { - unsigned short match = ((unsigned short)keymatrix_hitrow<<8) | keymatrix[keymatrix_hitrow]; - for (int i=0; i=0) { - menuRedraw=true; - curFile -= 9; - } else if (curFile!=0) { - menuRedraw=true; - curFile--; - } - } - else if ( (bClick & MASK_JOY2_DOWN) || (bClick & MASK_JOY1_DOWN) ) { - if ((curFile<(nbFiles-1)) && (nbFiles)) { - curFile++; - menuRedraw=true; - } - } - else if ( (bClick & MASK_JOY2_LEFT) || (bClick & MASK_JOY1_LEFT) ) { - if ((curFile<(nbFiles-9)) && (nbFiles)) { - curFile += 9; - menuRedraw=true; - } - else if ((curFile<(nbFiles-1)) && (nbFiles)) { - curFile++; - menuRedraw=true; - } - } - else if ( (bClick & MASK_KEY_USER2) ) { - emu_SwapJoysticks(0); - menuRedraw=true; - } - - if (menuRedraw && nbFiles) { - int fileIndex = 0; - tft.drawRectNoDma(MENU_FILE_XOFFSET,MENU_FILE_YOFFSET, MENU_FILE_W, MENU_FILE_H, MENU_FILE_BGCOLOR); -// if (curFile <= (MAX_MENULINES/2-1)) topFile=0; -// else topFile=curFile-(MAX_MENULINES/2); - if (curFile <= (MAX_MENULINES-1)) topFile=0; - else topFile=curFile-(MAX_MENULINES/2); - - int i=0; - while (i=nbFiles) { - // no more files - break; - } - char * filename = &files[fileIndex][0]; - if (fileIndex >= topFile) { - if ((i+topFile) < nbFiles ) { - if ((i+topFile)==curFile) { - tft.drawTextNoDma(MENU_FILE_XOFFSET,i*TEXT_HEIGHT+MENU_FILE_YOFFSET, filename, RGBVAL16(0xff,0xff,0x00), RGBVAL16(0xff,0x00,0x00), true); - strcpy(selected_filename,filename); - } - else { - tft.drawTextNoDma(MENU_FILE_XOFFSET,i*TEXT_HEIGHT+MENU_FILE_YOFFSET, filename, RGBVAL16(0xff,0xff,0xff), MENU_FILE_BGCOLOR, true); - } - } - i++; - } - fileIndex++; - } - - - tft.drawTextNoDma(48,MENU_JOYS_YOFFSET+8, (emu_SwapJoysticks(1)?(char*)"SWAP=1":(char*)"SWAP=0"), RGBVAL16(0x00,0xff,0xff), RGBVAL16(0x00,0x00,0xff), false); - menuRedraw=false; - } - - return (action); -} - -bool menuActive(void) -{ - return (menuOn); -} - -void toggleMenu(bool on) { - if (on) { - menuOn = true; - backgroundMenu(); - } else { - menuOn = false; - } -} - -char * menuSelection(void) -{ - return (selection); -} - - -/******************************** - * File IO -********************************/ -int emu_FileOpen(const char * filepath, const char * mode) -{ - int retval = 0; - - emu_printf("FileOpen..."); - emu_printf(filepath); - if( !(f_open(&file, filepath, FA_READ)) ) { - retval = 1; - } - else { - emu_printf("FileOpen failed"); - } - return (retval); -} - -int emu_FileRead(void * buf, int size, int handler) -{ - unsigned int retval=0; - f_read (&file, (void*)buf, size, &retval); - return retval; -} - -int emu_FileGetc(int handler) -{ - unsigned char c; - unsigned int retval=0; - if( !(f_read (&file, &c, 1, &retval)) ) - if (retval != 1) { - emu_printf("emu_FileGetc failed"); - } - return (int)c; -} - -void emu_FileClose(int handler) -{ - f_close(&file); -} - -int emu_FileSeek(int handler, int seek, int origin) -{ - f_lseek(&file, seek); - return (seek); -} - -int emu_FileTell(int handler) -{ - return (f_tell(&file)); -} - - -unsigned int emu_FileSize(const char * filepath) -{ - int filesize=0; - emu_printf("FileSize..."); - emu_printf(filepath); - FILINFO entry; - f_stat(filepath, &entry); - filesize = entry.fsize; - return(filesize); -} - -unsigned int emu_LoadFile(const char * filepath, void * buf, int size) -{ - int filesize = 0; - - emu_printf("LoadFile..."); - emu_printf(filepath); - if( !(f_open(&file, filepath, FA_READ)) ) { - filesize = f_size(&file); - emu_printf(filesize); - if (size >= filesize) - { - unsigned int retval=0; - if( (f_read (&file, buf, filesize, &retval)) ) { - emu_printf("File read failed"); - } - } - f_close(&file); - } - - return(filesize); -} - -static FIL outfile; - -static bool emu_writeConfig(void) -{ - bool retval = false; - if( !(f_open(&outfile, ROMSDIR "/" AUTORUN_FILENAME, FA_CREATE_NEW | FA_WRITE)) ) { - unsigned int sizeread=0; - if( (f_write (&outfile, selection, strlen(selection), &sizeread)) ) { - emu_printf("Config write failed"); - } - else { - retval = true; - } - f_close(&outfile); - } - return retval; -} - -static bool emu_readConfig(void) -{ - bool retval = false; - if( !(f_open(&outfile, ROMSDIR "/" AUTORUN_FILENAME, FA_READ)) ) { - unsigned int filesize = f_size(&outfile); - unsigned int sizeread=0; - if( (f_read (&outfile, selection, filesize, &sizeread)) ) { - emu_printf("Config read failed"); - } - else { - if (sizeread == filesize) { - selection[filesize]=0; - retval = true; - } - } - f_close(&outfile); - } - return retval; -} - -static bool emu_eraseConfig(void) -{ - f_unlink (ROMSDIR "/" AUTORUN_FILENAME); -} - - -/******************************** - * Initialization -********************************/ -void emu_init(void) -{ - // Dual display config, initialize TFT -#if (defined(ILI9341) || defined(ST7789)) && defined(USE_VGA) - tft.begin(); -#endif - - sd_init_driver(); - FRESULT fr = f_mount(&fatfs, "0:", 1); - - strcpy(selection,ROMSDIR); - nbFiles = readNbFiles(selection); - - emu_printf("SD initialized, files found: "); - emu_printi(nbFiles); - - emu_InitJoysticks(); -#ifdef SWAP_JOYSTICK - joySwapped = true; -#else - joySwapped = false; -#endif - - int keypressed = emu_ReadKeys(); -#ifdef PICOMPUTER - // Flip screen if UP pressed - if (keypressed & MASK_JOY2_UP) - { -#ifdef PICOMPUTERMAX -#ifndef USE_VGA - tft.flipscreen(true); -#endif -#else - tft.flipscreen(true); -#endif - } - else - { -#ifdef PICOMPUTERMAX -#ifndef USE_VGA - tft.flipscreen(false); -#endif -#else - tft.flipscreen(false); -#endif - } -#endif - - if (keypressed & MASK_JOY2_DOWN) { - tft.fillScreenNoDma( RGBVAL16(0xff,0x00,0x00) ); - tft.drawTextNoDma(64,48, (char*)" AUTURUN file erased", RGBVAL16(0xff,0xff,0x00), RGBVAL16(0xff,0x00,0x00), true); - tft.drawTextNoDma(64,48+24, (char*)"Please reset the board!", RGBVAL16(0xff,0xff,0x00), RGBVAL16(0xff,0x00,0x00), true); - emu_eraseConfig(); - } - else { - if (emu_readConfig()) { - autorun = true; - } - } - toggleMenu(true); -} - - -void emu_start(void) -{ - usbnavpad = 0; - - keyMap = 0; -} diff --git a/MCUME_pico/pico81/emuapi.h b/MCUME_pico/pico81/emuapi.h deleted file mode 100644 index de6b018..0000000 --- a/MCUME_pico/pico81/emuapi.h +++ /dev/null @@ -1,149 +0,0 @@ -#ifndef EMUAPI_H -#define EMUAPI_H - -#include "platform_config.h" - -//#define TIMER_REND 1 -#define EXTRA_HEAP 0x10 - -// Title: < > -#define TITLE " ZX81/ZX80 Emulator" -#define ROMSDIR "z81" - -#define emu_Init(ROM) {z81_Start(ROM); z81_Init(); } -#define emu_Step(x) {z81_Step();} -#define emu_Input(x) {z81_Input(x);} - -#define PALETTE_SIZE 2 -#define VID_FRAME_SKIP 0x0 -#define TFT_VBUFFER_YCROP 0 -#define SINGLELINE_RENDERING 1 - -#define ACTION_NONE 0 -#define ACTION_MAXKBDVAL 225 -#define ACTION_EXITKBD 128 -#define ACTION_RUNTFT 129 -#define ACTION_RUNVGA 130 - - -#ifdef KEYMAP_PRESENT -/* - {25, 6,27,29,224},// vcxz - {10, 9, 7,22, 4}, // gfdsa - {23,21, 8,26,20}, // trewq - {34,33,32,31,30}, // 54321 - {35,36,37,38,39}, // 67890 - {28,24,12,18,19}, // yuiop - {11,13,14,15,40}, // hjkl - { 5,17,16,1,44}, // bnm. -*/ - -#define keylables_map1_0 (char *)"qwertyuiop\x1a" -#define keylables_map1_1 (char *)" asdfghjkl\x19" -#define keylables_map1_2 (char *)" zxcvbnm.\x10 " -const unsigned short key_map1[] = { - 20,26,8,21,23,28,24,12,18,19,39+64, - 0, 4, 22, 7,9, 10,11,13,14,15,40, - 0,29,27,6,25,5,17,16,1,44, - 0,0,0,0 //up,left,right,down - }; - -#define keylables_map2_0 (char *)"1234567890=" -#define keylables_map2_1 (char *)" $ + *- " -#define keylables_map2_2 (char *)" ()?/\"<>,: " -const unsigned short key_map2[] = { - 30,31,32,33,34,35,36,37,38,39,15+64, - 0, 0,0,0,24+64,0,14+64,0,5+64,13+64,0, - 0, 12+64,18+64,6+64,25+64,19+64,17+64,16+64,1+64,29+64, - 36+64,34+64,37+64,35+64 //up,left,right,down - }; - -#define keylables_map3_0 (char *)" " -#define keylables_map3_1 (char *)" " -#define keylables_map3_2 (char *)" ; " -const unsigned short key_map3[] = { - 0, 0,0,0,0,0,0,0,0,0,0, // Upper case - 0, 0,0,0,0,0,0,0,0,0,0, - 0, 0,0,0,0,0,0,0,27+64,0, - 36+64,34+64,37+64,35+64 //up,left,right,down - }; - -const unsigned short matkeys[] = { - 0x020,0x120,0x220,0x320,0x420,0x408,0x308,0x208,0x108,0x008,0x002, // row 1 - 0x510,0x010,0x110,0x210,0x310,0x410,0x401,0x301,0x201,0x101,0x001, // row 2 - 0x520,0x102,0x202,0x302,0x402,0x404,0x304,0x204,0x104,0x004, // row 3 - 0x508,0x501,0x502,0x504 }; // cursor keys -#endif - - -#define MASK_JOY2_RIGHT 0x0001 -#define MASK_JOY2_LEFT 0x0002 -#define MASK_JOY2_UP 0x0004 -#define MASK_JOY2_DOWN 0x0008 -#define MASK_JOY2_BTN 0x0010 -#define MASK_KEY_USER1 0x0020 -#define MASK_KEY_USER2 0x0040 -#define MASK_KEY_USER3 0x0080 -#define MASK_JOY1_RIGHT 0x0100 -#define MASK_JOY1_LEFT 0x0200 -#define MASK_JOY1_UP 0x0400 -#define MASK_JOY1_DOWN 0x0800 -#define MASK_JOY1_BTN 0x1000 -#define MASK_KEY_USER4 0x2000 -#define MASK_OSKB 0x8000 - - -extern void emu_init(void); -extern void emu_start(void); -extern void emu_resetSD(void); - -extern void emu_printf(const char * text); -extern void emu_printi(int val); -extern void * emu_Malloc(int size); -extern void emu_Free(void * pt); - -extern int emu_FileOpen(const char * filepath, const char * mode); -extern int emu_FileRead(void * buf, int size, int handler); -extern int emu_FileGetc(int handler); -extern int emu_FileSeek(int handler, int seek, int origin); -extern int emu_FileTell(int handler); -extern void emu_FileClose(int handler); - -extern unsigned int emu_FileSize(const char * filepath); -extern unsigned int emu_LoadFile(const char * filepath, void * buf, int size); - -extern void emu_SetPaletteEntry(unsigned char r, unsigned char g, unsigned char b, int index); -extern void emu_DrawScreen(unsigned char * VBuf, int width, int height, int stride); -extern void emu_DrawLine(unsigned char * VBuf, int width, int height, int line); -extern void emu_DrawLine8(unsigned char * VBuf, int width, int height, int line); -extern void emu_DrawLine16(unsigned short * VBuf, int width, int height, int line); -extern void emu_DrawVsync(void); -extern int emu_FrameSkip(void); -extern void * emu_LineBuffer(int line); - -extern void emu_InitJoysticks(void); -extern int emu_SwapJoysticks(int statusOnly); -extern unsigned short emu_DebounceLocalKeys(void); -extern int emu_ReadKeys(void); -extern int emu_GetPad(void); -extern int emu_ReadAnalogJoyX(int min, int max); -extern int emu_ReadAnalogJoyY(int min, int max); -extern int emu_ReadI2CKeyboard(void); -extern void emu_KeyboardOnUp(int keymodifer, int key); -extern void emu_KeyboardOnDown(int keymodifer, int key); - -extern void emu_sndPlaySound(int chan, int volume, int freq); -extern void emu_sndPlayBuzz(int size, int val); -extern void emu_sndInit(); -extern void emu_resetus(void); -extern int emu_us(void); - -extern int emu_setKeymap(int index); - -extern void emu_FileTempInit(void); -extern void emu_FileTempRead(int addr, unsigned char * val, int n); -extern void emu_FileTempWrite(int addr, unsigned char val); -extern void emu_printh(int val); - - -#endif diff --git a/MCUME_pico/pico81/emucfg.h b/MCUME_pico/pico81/emucfg.h new file mode 100644 index 0000000..70b3b54 --- /dev/null +++ b/MCUME_pico/pico81/emucfg.h @@ -0,0 +1,113 @@ +#ifndef EMUCFG_H +#define EMUCFG_H + +#define PALETTE_SIZE 2 +#define VID_FRAME_SKIP 0x0 +#define TFT_VBUFFER_YCROP 0 +#define SINGLELINE_RENDERING 1 +//#define CUSTOM_SND 1 +//#define TIMER_REND 1 +#define EXTRA_HEAP 0x10 +#define FILEBROWSER + +// Title: < > +#define TITLE " ZX81/ZX80 Emulator" +#define ROMSDIR "z81" + +#define emu_Init(ROM) {z81_Start(ROM); z81_Init(); } +#define emu_Step(x) {z81_Step();} +#define emu_Input(x) {z81_Input(x);} + +#ifdef KEYMAP_PRESENT + +#ifdef PICOZX +const unsigned short key_map1[] = { + 30,31,32,33,34,35,36,37,38,39, + 20,26, 8,21,23,28,24,12,18,19, + 4,22, 7, 9,10,11,13,14,15,40, + 0,29,27, 6,25, 5,17,16, 0,44, + 0,0,0,0,0,0 + }; + +const unsigned short key_map2[] = { + 0,0,0,24+64,34+64,35+64,36+64,37+64,18+64,0, + 21+64,23+64,28+64,17+64,16+64,31+64,26+64,0,0,19+64, + 0,0,0,12+64,18+64,0,13+64,14+64,15+64,40+64, + 0,29+64,27+64, 6+64,25+64, 5+64,1+64,1,0,44+64, + + 0,0,0,0,0,0 + }; + // To be mapped + //30+64,0,32+64,33+64,0,0,0,0,38+64,39+64, + //20+64,0, 8+64,0,0,0,0,0,0,0, + //4+64,22+64, 7+64, 9+64,10+64,11+64,0,0,0,0, + //0, 0,0, 0,0, 0,0,0, 0,0, + //0,0,0,0,0,0 + //}; + +const unsigned short key_map3[] = { + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0 + }; + +const unsigned short matkeys[] = { + 0x104,0x101,0x108,0x102,0x110,0x120,0x140,0x204,0x201,0x208, // row 1 + 0x202,0x210,0x220,0x240,0x304,0x301,0x308,0x302,0x310,0x320, // row 2 + 0x340,0x404,0x401,0x408,0x402,0x410,0x420,0x440,0x504,0x501, // row 3 + 0x020,0x508,0x502,0x510,0x520,0x540,0x604,0x601,0x040,0x608, // row 4 + 0x008,0x001,0x002,0x010,0x620,0x640 }; // cursor keys up, left, right, down, <<<, >>> + +#else +/* + {25, 6,27,29,224},// vcxz + {10, 9, 7,22, 4}, // gfdsa + {23,21, 8,26,20}, // trewq + {34,33,32,31,30}, // 54321 + {35,36,37,38,39}, // 67890 + {28,24,12,18,19}, // yuiop + {11,13,14,15,40}, // hjkl + { 5,17,16,1,44}, // bnm. +*/ + +#define keylables_map1_0 (char *)"qwertyuiop\x1a" +#define keylables_map1_1 (char *)" asdfghjkl\x19" +#define keylables_map1_2 (char *)" zxcvbnm.\x10 " +const unsigned short key_map1[] = { + 20,26,8,21,23,28,24,12,18,19,39+64, + 0, 4, 22, 7,9, 10,11,13,14,15,40, + 0,29,27,6,25,5,17,16,1,44, + 0,0,0,0 //up,left,right,down + }; + +#define keylables_map2_0 (char *)"1234567890=" +#define keylables_map2_1 (char *)" $ + *- " +#define keylables_map2_2 (char *)" ()?/\"<>,: " +const unsigned short key_map2[] = { + 30,31,32,33,34,35,36,37,38,39,15+64, + 0, 0,0,0,24+64,0,14+64,0,5+64,13+64,0, + 0, 12+64,18+64,6+64,25+64,19+64,17+64,16+64,1+64,29+64, + 36+64,34+64,37+64,35+64 //up,left,right,down + }; + +#define keylables_map3_0 (char *)" " +#define keylables_map3_1 (char *)" " +#define keylables_map3_2 (char *)" ; " +const unsigned short key_map3[] = { + 0, 0,0,0,0,0,0,0,0,0,0, // Upper case + 0, 0,0,0,0,0,0,0,0,0,0, + 0, 0,0,0,0,0,0,0,27+64,0, + 36+64,34+64,37+64,35+64 //up,left,right,down + }; + +const unsigned short matkeys[] = { + 0x020,0x120,0x220,0x320,0x420,0x408,0x308,0x208,0x108,0x008,0x002, // row 1 + 0x510,0x010,0x110,0x210,0x310,0x410,0x401,0x301,0x201,0x101,0x001, // row 2 + 0x520,0x102,0x202,0x302,0x402,0x404,0x304,0x204,0x104,0x004, // row 3 + 0x508,0x501,0x502,0x504 }; // cursor keys +#endif +#endif + +#endif diff --git a/MCUME_pico/pico81/font8x8.h b/MCUME_pico/pico81/font8x8.h deleted file mode 100644 index 4f773da..0000000 --- a/MCUME_pico/pico81/font8x8.h +++ /dev/null @@ -1,135 +0,0 @@ - -// Font: c64_lower.64c - -const unsigned char font8x8[128][8] PROGMEM = -{ - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0000 (nul) - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0001 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0002 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0003 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0004 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0005 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0006 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0007 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0008 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0009 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000A - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000B - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000C - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000D - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000E - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000F - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0010 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0011 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0012 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0013 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0014 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0015 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0016 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0017 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0018 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0019 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001A - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001B - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001C - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001D - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001E - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001F - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0020 (space) - { 0x18, 0x3C, 0x3C, 0x18, 0x18, 0x00, 0x18, 0x00}, // U+0021 (!) - { 0x36, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0022 (") - { 0x36, 0x36, 0x7F, 0x36, 0x7F, 0x36, 0x36, 0x00}, // U+0023 (#) - { 0x0C, 0x3E, 0x03, 0x1E, 0x30, 0x1F, 0x0C, 0x00}, // U+0024 ($) - { 0x00, 0x63, 0x33, 0x18, 0x0C, 0x66, 0x63, 0x00}, // U+0025 (%) - { 0x1C, 0x36, 0x1C, 0x6E, 0x3B, 0x33, 0x6E, 0x00}, // U+0026 (&) - { 0x06, 0x06, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0027 (') - { 0x18, 0x0C, 0x06, 0x06, 0x06, 0x0C, 0x18, 0x00}, // U+0028 (() - { 0x06, 0x0C, 0x18, 0x18, 0x18, 0x0C, 0x06, 0x00}, // U+0029 ()) - { 0x00, 0x66, 0x3C, 0xFF, 0x3C, 0x66, 0x00, 0x00}, // U+002A (*) - { 0x00, 0x0C, 0x0C, 0x3F, 0x0C, 0x0C, 0x00, 0x00}, // U+002B (+) - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x0C, 0x06}, // U+002C (,) - { 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x00}, // U+002D (-) - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x0C, 0x00}, // U+002E (.) - { 0x60, 0x30, 0x18, 0x0C, 0x06, 0x03, 0x01, 0x00}, // U+002F (/) - { 0x3E, 0x63, 0x73, 0x7B, 0x6F, 0x67, 0x3E, 0x00}, // U+0030 (0) - { 0x0C, 0x0E, 0x0C, 0x0C, 0x0C, 0x0C, 0x3F, 0x00}, // U+0031 (1) - { 0x1E, 0x33, 0x30, 0x1C, 0x06, 0x33, 0x3F, 0x00}, // U+0032 (2) - { 0x1E, 0x33, 0x30, 0x1C, 0x30, 0x33, 0x1E, 0x00}, // U+0033 (3) - { 0x38, 0x3C, 0x36, 0x33, 0x7F, 0x30, 0x78, 0x00}, // U+0034 (4) - { 0x3F, 0x03, 0x1F, 0x30, 0x30, 0x33, 0x1E, 0x00}, // U+0035 (5) - { 0x1C, 0x06, 0x03, 0x1F, 0x33, 0x33, 0x1E, 0x00}, // U+0036 (6) - { 0x3F, 0x33, 0x30, 0x18, 0x0C, 0x0C, 0x0C, 0x00}, // U+0037 (7) - { 0x1E, 0x33, 0x33, 0x1E, 0x33, 0x33, 0x1E, 0x00}, // U+0038 (8) - { 0x1E, 0x33, 0x33, 0x3E, 0x30, 0x18, 0x0E, 0x00}, // U+0039 (9) - { 0x00, 0x0C, 0x0C, 0x00, 0x00, 0x0C, 0x0C, 0x00}, // U+003A (:) - { 0x00, 0x0C, 0x0C, 0x00, 0x00, 0x0C, 0x0C, 0x06}, // U+003B (//) - { 0x18, 0x0C, 0x06, 0x03, 0x06, 0x0C, 0x18, 0x00}, // U+003C (<) - { 0x00, 0x00, 0x3F, 0x00, 0x00, 0x3F, 0x00, 0x00}, // U+003D (=) - { 0x06, 0x0C, 0x18, 0x30, 0x18, 0x0C, 0x06, 0x00}, // U+003E (>) - { 0x1E, 0x33, 0x30, 0x18, 0x0C, 0x00, 0x0C, 0x00}, // U+003F (?) - { 0x3E, 0x63, 0x7B, 0x7B, 0x7B, 0x03, 0x1E, 0x00}, // U+0040 (@) - { 0x0C, 0x1E, 0x33, 0x33, 0x3F, 0x33, 0x33, 0x00}, // U+0041 (A) - { 0x3F, 0x66, 0x66, 0x3E, 0x66, 0x66, 0x3F, 0x00}, // U+0042 (B) - { 0x3C, 0x66, 0x03, 0x03, 0x03, 0x66, 0x3C, 0x00}, // U+0043 (C) - { 0x1F, 0x36, 0x66, 0x66, 0x66, 0x36, 0x1F, 0x00}, // U+0044 (D) - { 0x7F, 0x46, 0x16, 0x1E, 0x16, 0x46, 0x7F, 0x00}, // U+0045 (E) - { 0x7F, 0x46, 0x16, 0x1E, 0x16, 0x06, 0x0F, 0x00}, // U+0046 (F) - { 0x3C, 0x66, 0x03, 0x03, 0x73, 0x66, 0x7C, 0x00}, // U+0047 (G) - { 0x33, 0x33, 0x33, 0x3F, 0x33, 0x33, 0x33, 0x00}, // U+0048 (H) - { 0x1E, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+0049 (I) - { 0x78, 0x30, 0x30, 0x30, 0x33, 0x33, 0x1E, 0x00}, // U+004A (J) - { 0x67, 0x66, 0x36, 0x1E, 0x36, 0x66, 0x67, 0x00}, // U+004B (K) - { 0x0F, 0x06, 0x06, 0x06, 0x46, 0x66, 0x7F, 0x00}, // U+004C (L) - { 0x63, 0x77, 0x7F, 0x7F, 0x6B, 0x63, 0x63, 0x00}, // U+004D (M) - { 0x63, 0x67, 0x6F, 0x7B, 0x73, 0x63, 0x63, 0x00}, // U+004E (N) - { 0x1C, 0x36, 0x63, 0x63, 0x63, 0x36, 0x1C, 0x00}, // U+004F (O) - { 0x3F, 0x66, 0x66, 0x3E, 0x06, 0x06, 0x0F, 0x00}, // U+0050 (P) - { 0x1E, 0x33, 0x33, 0x33, 0x3B, 0x1E, 0x38, 0x00}, // U+0051 (Q) - { 0x3F, 0x66, 0x66, 0x3E, 0x36, 0x66, 0x67, 0x00}, // U+0052 (R) - { 0x1E, 0x33, 0x07, 0x0E, 0x38, 0x33, 0x1E, 0x00}, // U+0053 (S) - { 0x3F, 0x2D, 0x0C, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+0054 (T) - { 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x3F, 0x00}, // U+0055 (U) - { 0x33, 0x33, 0x33, 0x33, 0x33, 0x1E, 0x0C, 0x00}, // U+0056 (V) - { 0x63, 0x63, 0x63, 0x6B, 0x7F, 0x77, 0x63, 0x00}, // U+0057 (W) - { 0x63, 0x63, 0x36, 0x1C, 0x1C, 0x36, 0x63, 0x00}, // U+0058 (X) - { 0x33, 0x33, 0x33, 0x1E, 0x0C, 0x0C, 0x1E, 0x00}, // U+0059 (Y) - { 0x7F, 0x63, 0x31, 0x18, 0x4C, 0x66, 0x7F, 0x00}, // U+005A (Z) - { 0x1E, 0x06, 0x06, 0x06, 0x06, 0x06, 0x1E, 0x00}, // U+005B ([) - { 0x03, 0x06, 0x0C, 0x18, 0x30, 0x60, 0x40, 0x00}, // U+005C (\) - { 0x1E, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1E, 0x00}, // U+005D (]) - { 0x08, 0x1C, 0x36, 0x63, 0x00, 0x00, 0x00, 0x00}, // U+005E (^) - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF}, // U+005F (_) - { 0x0C, 0x0C, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0060 (`) - { 0x00, 0x00, 0x1E, 0x30, 0x3E, 0x33, 0x6E, 0x00}, // U+0061 (a) - { 0x07, 0x06, 0x06, 0x3E, 0x66, 0x66, 0x3B, 0x00}, // U+0062 (b) - { 0x00, 0x00, 0x1E, 0x33, 0x03, 0x33, 0x1E, 0x00}, // U+0063 (c) - { 0x38, 0x30, 0x30, 0x3e, 0x33, 0x33, 0x6E, 0x00}, // U+0064 (d) - { 0x00, 0x00, 0x1E, 0x33, 0x3f, 0x03, 0x1E, 0x00}, // U+0065 (e) - { 0x1C, 0x36, 0x06, 0x0f, 0x06, 0x06, 0x0F, 0x00}, // U+0066 (f) - { 0x00, 0x00, 0x6E, 0x33, 0x33, 0x3E, 0x30, 0x1F}, // U+0067 (g) - { 0x07, 0x06, 0x36, 0x6E, 0x66, 0x66, 0x67, 0x00}, // U+0068 (h) - { 0x0C, 0x00, 0x0E, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+0069 (i) - { 0x30, 0x00, 0x30, 0x30, 0x30, 0x33, 0x33, 0x1E}, // U+006A (j) - { 0x07, 0x06, 0x66, 0x36, 0x1E, 0x36, 0x67, 0x00}, // U+006B (k) - { 0x0E, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+006C (l) - { 0x00, 0x00, 0x33, 0x7F, 0x7F, 0x6B, 0x63, 0x00}, // U+006D (m) - { 0x00, 0x00, 0x1F, 0x33, 0x33, 0x33, 0x33, 0x00}, // U+006E (n) - { 0x00, 0x00, 0x1E, 0x33, 0x33, 0x33, 0x1E, 0x00}, // U+006F (o) - { 0x00, 0x00, 0x3B, 0x66, 0x66, 0x3E, 0x06, 0x0F}, // U+0070 (p) - { 0x00, 0x00, 0x6E, 0x33, 0x33, 0x3E, 0x30, 0x78}, // U+0071 (q) - { 0x00, 0x00, 0x3B, 0x6E, 0x66, 0x06, 0x0F, 0x00}, // U+0072 (r) - { 0x00, 0x00, 0x3E, 0x03, 0x1E, 0x30, 0x1F, 0x00}, // U+0073 (s) - { 0x08, 0x0C, 0x3E, 0x0C, 0x0C, 0x2C, 0x18, 0x00}, // U+0074 (t) - { 0x00, 0x00, 0x33, 0x33, 0x33, 0x33, 0x6E, 0x00}, // U+0075 (u) - { 0x00, 0x00, 0x33, 0x33, 0x33, 0x1E, 0x0C, 0x00}, // U+0076 (v) - { 0x00, 0x00, 0x63, 0x6B, 0x7F, 0x7F, 0x36, 0x00}, // U+0077 (w) - { 0x00, 0x00, 0x63, 0x36, 0x1C, 0x36, 0x63, 0x00}, // U+0078 (x) - { 0x00, 0x00, 0x33, 0x33, 0x33, 0x3E, 0x30, 0x1F}, // U+0079 (y) - { 0x00, 0x00, 0x3F, 0x19, 0x0C, 0x26, 0x3F, 0x00}, // U+007A (z) - { 0x38, 0x0C, 0x0C, 0x07, 0x0C, 0x0C, 0x38, 0x00}, // U+007B ({) - { 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x00}, // U+007C (|) - { 0x07, 0x0C, 0x0C, 0x38, 0x0C, 0x0C, 0x07, 0x00}, // U+007D (}) - { 0x6E, 0x3B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+007E (~) - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} // U+007F -}; - diff --git a/MCUME_pico/pico81/pico81.cpp b/MCUME_pico/pico81/pico81.cpp index 963fbc8..4322f41 100644 --- a/MCUME_pico/pico81/pico81.cpp +++ b/MCUME_pico/pico81/pico81.cpp @@ -11,15 +11,11 @@ extern "C" { #include "zx81.h" } #include +#include "pico_dsp.h" -#ifdef USE_VGA -#include "vga_t_dma.h" -#else -#include "tft_t_dma.h" -#endif volatile bool vbl=true; -bool repeating_timer_callback(struct repeating_timer *t) { +bool repeating_timer_callback(struct repeating_timer *t) { if (vbl) { vbl = false; } else { @@ -27,8 +23,8 @@ bool repeating_timer_callback(struct repeating_timer *t) { } return true; } -TFT_T_DMA tft; +PICO_DSP tft; static int skip=0; #include "hardware/clocks.h" @@ -40,86 +36,85 @@ int main(void) { // set_sys_clock_khz(150000, true); // set_sys_clock_khz(133000, true); set_sys_clock_khz(200000, true); +// set_sys_clock_khz(210000, true); +// set_sys_clock_khz(230000, true); // set_sys_clock_khz(225000, true); -// set_sys_clock_khz(240000, true); // set_sys_clock_khz(250000, true); stdio_init_all(); -#ifdef USE_VGA - tft.begin(VGA_MODE_320x240); -#else - tft.begin(); -#endif + emu_init(); - while (true) { + char * filename; +#ifdef FILEBROWSER + while (true) { if (menuActive()) { uint16_t bClick = emu_DebounceLocalKeys(); int action = handleMenu(bClick); - char * filename = menuSelection(); - if (action == ACTION_RUNTFT) { - toggleMenu(false); - emu_start(); - emu_Init(filename); - tft.fillScreenNoDma( RGBVAL16(0x00,0x00,0x00) ); - tft.startDMA(); - struct repeating_timer timer; - add_repeating_timer_ms(15, repeating_timer_callback, NULL, &timer); - } + filename = menuSelection(); + if (action == ACTION_RUN) { + break; + } tft.waitSync(); } - else { - uint16_t bClick = emu_DebounceLocalKeys(); - emu_Input(bClick); - emu_Step(); - } - //int c = getchar_timeout_us(0); - //switch (c) { - // case ' ': - // printf("test: %d\n", 1); - // break; - //} + } +#endif + emu_start(); + emu_Init(filename); + tft.startRefresh(); + struct repeating_timer timer; + add_repeating_timer_ms(15, repeating_timer_callback, NULL, &timer); + while (true) { + uint16_t bClick = emu_DebounceLocalKeys(); + emu_Input(bClick); + emu_Step(); } } - -static unsigned char palette8[PALETTE_SIZE]; static unsigned short palette16[PALETTE_SIZE]; - void emu_SetPaletteEntry(unsigned char r, unsigned char g, unsigned char b, int index) { if (index=128) hk -= 128; - else if (hk >=64) hk -= 64; + if (hk >=64) hk -= 64; // scan all possibilities for (int j=0;j<8;j++) { for(int i=0;i<5;i++){ @@ -577,8 +576,8 @@ void z81_Start(char * filename) //emu_setKeymap(1); if ( (endsWith(filename, ".80")) || (endsWith(filename, ".o")) || (endsWith(filename, ".O"))) { - zx80=1; - ramsize=48; + zx80 = 1; + ramsize = 48; //emu_setKeymap(0); } else if (endsWith(filename, ".56") ) { diff --git a/MCUME_pico/picocolem/AudioPlaySystem.cpp b/MCUME_pico/picocolem/AudioPlaySystem.cpp deleted file mode 100644 index 36b764d..0000000 --- a/MCUME_pico/picocolem/AudioPlaySystem.cpp +++ /dev/null @@ -1,179 +0,0 @@ -#include "emuapi.h" - -#ifdef HAS_SND - -#include "AudioPlaySystem.h" - -#define SAMPLERATE AUDIO_SAMPLE_RATE_EXACT -#define CLOCKFREQ 985248 - -#ifndef CUSTOM_SND -static const short square[]={ -32767,32767,32767,32767, -32767,32767,32767,32767, -32767,32767,32767,32767, -32767,32767,32767,32767, -32767,32767,32767,32767, -32767,32767,32767,32767, -32767,32767,32767,32767, -32767,32767,32767,32767, --32767,-32767,-32767,-32767, --32767,-32767,-32767,-32767, --32767,-32767,-32767,-32767, --32767,-32767,-32767,-32767, --32767,-32767,-32767,-32767, --32767,-32767,-32767,-32767, --32767,-32767,-32767,-32767, --32767,-32767,-32767,-32767, -}; - -const short noise[] { --32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767, --32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,32767,-32767, --32767,-32767,32767,-32767,-32767,-32767,32767,-32767,-32767,-32767,32767,-32767,-32767,-32767,32767,-32767, --32767,-32767,32767,-32767,-32767,-32767,32767,-32767,-32767,-32767,32767,-32767,-32767,32767,32767,-32767, --32767,-32767,32767,-32767,-32767,32767,32767,-32767,-32767,-32767,32767,-32767,-32767,32767,32767,-32767, --32767,-32767,32767,-32767,-32767,32767,32767,-32767,-32767,-32767,32767,-32767,32767,32767,32767,-32767, -32767,-32767,32767,-32767,-32767,32767,32767,-32767,-32767,-32767,32767,-32767,32767,32767,32767,-32767, -32767,-32767,32767,-32767,-32767,32767,32767,-32767,-32767,-32767,32767,32767,32767,32767,32767,-32767, -32767,-32767,32767,-32767,-32767,32767,32767,-32767,-32767,-32767,32767,32767,32767,32767,32767,-32767, -32767,-32767,32767,-32767,-32767,32767,32767,-32767,-32767,-32767,-32767,32767,32767,32767,-32767,-32767, -32767,-32767,-32767,-32767,-32767,32767,-32767,-32767,-32767,-32767,32767,32767,32767,32767,32767,-32767, -32767,-32767,32767,-32767,-32767,32767,32767,-32767,-32767,32767,-32767,32767,32767,32767,-32767,-32767, -32767,32767,-32767,-32767,-32767,32767,-32767,-32767,-32767,-32767,32767,32767,32767,32767,32767,-32767, -32767,-32767,32767,-32767,-32767,32767,32767,-32767,32767,32767,-32767,32767,-32767,32767,-32767,-32767, -32767,32767,-32767,-32767,-32767,32767,-32767,-32767,-32767,-32767,32767,32767,32767,32767,32767,-32767, -32767,-32767,32767,-32767,-32767,32767,32767,32767,32767,32767,-32767,32767,-32767,32767,-32767,-32767, -}; - -#define NOISEBSIZE 0x100 - -typedef struct -{ - unsigned int spos; - unsigned int sinc; - unsigned int vol; -} Channel; - -static Channel chan[6] = { - {0,0,0}, - {0,0,0}, - {0,0,0}, - {0,0,0}, - {0,0,0}, - {0,0,0} }; - -#endif - -volatile bool playing = false; - - -static void snd_Reset(void) -{ -#ifndef CUSTOM_SND - chan[0].vol = 0; - chan[1].vol = 0; - chan[2].vol = 0; - chan[3].vol = 0; - chan[4].vol = 0; - chan[5].vol = 0; - chan[0].sinc = 0; - chan[1].sinc = 0; - chan[2].sinc = 0; - chan[3].sinc = 0; - chan[4].sinc = 0; - chan[5].sinc = 0; -#endif -} - - -#ifdef CUSTOM_SND -extern "C" { -void SND_Process(void *sndbuffer, int sndn); -} -#endif - -#include -void AudioPlaySystem::snd_Mixer(short * stream, int len ) -{ - if (playing) - { -#ifdef CUSTOM_SND - //printf("s\n"); - SND_Process((void*)stream, len); -#else - int i; - long s; - len = len >> 1; - short v0=chan[0].vol; - short v1=chan[1].vol; - short v2=chan[2].vol; - short v3=chan[3].vol; - short v4=chan[4].vol; - short v5=chan[5].vol; - for (i=0;i>8)&0x3f])>>11); - s+=((v1*square[(chan[1].spos>>8)&0x3f])>>11); - s+=((v2*square[(chan[2].spos>>8)&0x3f])>>11); - s+=((v3*noise[(chan[3].spos>>8)&(NOISEBSIZE-1)])>>11); - s+=((v4*noise[(chan[4].spos>>8)&(NOISEBSIZE-1)])>>11); - s+=((v5*noise[(chan[5].spos>>8)&(NOISEBSIZE-1)])>>11); - *stream++ = (short)(s); - *stream++ = (short)(s); - chan[0].spos += chan[0].sinc; - chan[1].spos += chan[1].sinc; - chan[2].spos += chan[2].sinc; - chan[3].spos += chan[3].sinc; - chan[4].spos += chan[4].sinc; - chan[5].spos += chan[5].sinc; - } -#endif - } -} - -void AudioPlaySystem::begin(void) -{ - this->reset(); -} - -void AudioPlaySystem::start(void) -{ - playing = true; -} - -void AudioPlaySystem::setSampleParameters(float clockfreq, float samplerate) { -} - -void AudioPlaySystem::reset(void) -{ - snd_Reset(); -} - -void AudioPlaySystem::stop(void) -{ - playing = false; -} - -bool AudioPlaySystem::isPlaying(void) -{ - return playing; -} - - - -void AudioPlaySystem::sound(int C, int F, int V) { -#ifndef CUSTOM_SND - if (C < 6) { - chan[C].vol = V; - chan[C].sinc = F>>1; - } -#endif -} - -void AudioPlaySystem::step(void) { -} - -void AudioPlaySystem::buzz(int size, int val) { -} -#endif diff --git a/MCUME_pico/picocolem/AudioPlaySystem.h b/MCUME_pico/picocolem/AudioPlaySystem.h deleted file mode 100644 index 5d2efc0..0000000 --- a/MCUME_pico/picocolem/AudioPlaySystem.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef audioplaysystem_h_ -#define audioplaysystem_h_ - -#ifdef HAS_SND - -#include "platform_config.h" - -class AudioPlaySystem -{ -public: - AudioPlaySystem(void) { }; - void begin(void); - void setSampleParameters(float clockfreq, float samplerate); - void reset(void); - void start(void); - void stop(void); - bool isPlaying(void); - void sound(int C, int F, int V); - void buzz(int size, int val); - void step(void); - static void snd_Mixer(short * stream, int len ); -}; - -#endif - -#endif diff --git a/MCUME_pico/picocolem/Colem.c b/MCUME_pico/picocolem/Colem.c index f80ab45..f76ac43 100644 --- a/MCUME_pico/picocolem/Colem.c +++ b/MCUME_pico/picocolem/Colem.c @@ -284,7 +284,9 @@ void Joysticks(void) JS[N]&=0xBFFF; //Fire 1 } #if (defined(ILI9341) || defined(ST7789)) && defined(USE_VGA) -#else +#else +#ifdef PICOZX +#else if (k & MASK_KEY_USER1) { JS[N]&=0xFFBF; //Fire 2 @@ -293,6 +295,7 @@ void Joysticks(void) { JS[0]=(JS[0]&0xFFF0)|(2); //1 } +#endif #endif // JS[0]=(JS[0]&0xFFF0)|(12); // JS[0]=(JS[0]&0xFFF0)|(13); @@ -437,7 +440,7 @@ word LoopZ80(Z80 *R, int * ras) if(!UCount) { (SCR[ScrMode].Refresh)(CurLine); #if SINGLELINE_RENDERING - emu_DrawLine(XBuf, WIDTH, HEIGHT, CurLine); + emu_DrawLinePal16(XBuf, WIDTH, HEIGHT, CurLine); #else #endif } diff --git a/MCUME_pico/picocolem/emuapi.cpp b/MCUME_pico/picocolem/emuapi.cpp deleted file mode 100644 index 1bc929b..0000000 --- a/MCUME_pico/picocolem/emuapi.cpp +++ /dev/null @@ -1,1311 +0,0 @@ -#define KEYMAP_PRESENT 1 - -#define PROGMEM - -#include "pico.h" -#include "pico/stdlib.h" -#include "hardware/adc.h" -#include -#include - -extern "C" { - #include "emuapi.h" - #include "iopins.h" -} - -static bool emu_writeConfig(void); -static bool emu_readConfig(void); -static bool emu_eraseConfig(void); - - -#if (defined(ILI9341) || defined(ST7789)) && defined(USE_VGA) -// Dual display config, initialize TFT -#include "tft_t_dma.h" -static TFT_T_DMA tft; -#else -// Non Dual display config -#ifdef USE_VGA -#include "vga_t_dma.h" -#else -#include "tft_t_dma.h" -#endif -extern TFT_T_DMA tft; -#endif - - -#define MAX_FILENAME_PATH 64 -#define NB_FILE_HANDLER 4 -#define AUTORUN_FILENAME "autorun.txt" - -#define MAX_FILES 64 -#define MAX_FILENAME_SIZE 24 -#define MAX_MENULINES 9 -#define TEXT_HEIGHT 16 -#define TEXT_WIDTH 8 -#define MENU_FILE_XOFFSET (6*TEXT_WIDTH) -#define MENU_FILE_YOFFSET (2*TEXT_HEIGHT) -#define MENU_FILE_W (MAX_FILENAME_SIZE*TEXT_WIDTH) -#define MENU_FILE_H (MAX_MENULINES*TEXT_HEIGHT) -#define MENU_FILE_BGCOLOR RGBVAL16(0x00,0x00,0x40) -#define MENU_JOYS_YOFFSET (12*TEXT_HEIGHT) -#define MENU_VBAR_XOFFSET (0*TEXT_WIDTH) -#define MENU_VBAR_YOFFSET (MENU_FILE_YOFFSET) - -#define MENU_TFT_XOFFSET (MENU_FILE_XOFFSET+MENU_FILE_W+8) -#define MENU_TFT_YOFFSET (MENU_VBAR_YOFFSET+32) -#define MENU_VGA_XOFFSET (MENU_FILE_XOFFSET+MENU_FILE_W+8) -#define MENU_VGA_YOFFSET (MENU_VBAR_YOFFSET+MENU_FILE_H-32-37) - - - -static int nbFiles=0; -static int curFile=0; -static int topFile=0; -static char selection[MAX_FILENAME_PATH]=""; -static char selected_filename[MAX_FILENAME_SIZE]=""; -static char files[MAX_FILES][MAX_FILENAME_SIZE]; -static bool menuRedraw=true; - -#ifdef PICOMPUTER -static const unsigned short * keys; -static unsigned char keymatrix[6]; -static int keymatrix_hitrow=-1; -static bool key_fn=false; -static bool key_alt=false; -static uint32_t keypress_t_ms=0; -static uint32_t last_t_ms=0; -static uint32_t hundred_ms_cnt=0; -static bool ledflash_toggle=false; -#endif -static int keyMap; - -static bool joySwapped = false; -static uint16_t bLastState; -static int xRef; -static int yRef; -static uint8_t usbnavpad=0; - -static bool menuOn=true; -static bool autorun=false; - - -/******************************** - * Generic output and malloc -********************************/ -void emu_printf(const char * text) -{ - printf("%s\n",text); -} - -void emu_printf(int val) -{ - printf("%d\n",val); -} - -void emu_printi(int val) -{ - printf("%d\n",val); -} - -void emu_printh(int val) -{ - printf("0x%.8\n",val); -} - -static int malbufpt = 0; -static char malbuf[EXTRA_HEAP]; - -void * emu_Malloc(int size) -{ - void * retval = malloc(size); - if (!retval) { - emu_printf("failled to allocate"); - emu_printf(size); - emu_printf("fallback"); - if ( (malbufpt+size) < sizeof(malbuf) ) { - retval = (void *)&malbuf[malbufpt]; - malbufpt += size; - } - else { - emu_printf("failure to allocate"); - } - } - else { - emu_printf("could allocate dynamic "); - emu_printf(size); - } - - return retval; -} - -void * emu_MallocI(int size) -{ - void * retval = NULL; - - if ( (malbufpt+size) < sizeof(malbuf) ) { - retval = (void *)&malbuf[malbufpt]; - malbufpt += size; - emu_printf("could allocate static "); - emu_printf(size); - } - else { - emu_printf("failure to allocate"); - } - - return retval; -} -void emu_Free(void * pt) -{ - free(pt); -} - -void emu_drawText(unsigned short x, unsigned short y, const char * text, unsigned short fgcolor, unsigned short bgcolor, int doublesize) -{ - tft.drawText(x, y, text, fgcolor, bgcolor, doublesize?true:false); -} - - -/******************************** - * OSKB handling -********************************/ -#if (defined(ILI9341) || defined(ST7789)) && defined(USE_VGA) -// On screen keyboard position -#define KXOFF 28 //64 -#define KYOFF 96 -#define KWIDTH 11 //22 -#define KHEIGHT 3 - -static bool oskbOn = false; -static int cxpos = 0; -static int cypos = 0; -static int oskbMap = 0; -static uint16_t oskbBLastState = 0; - -static void lineOSKB2(int kxoff, int kyoff, char * str, int row) -{ - char c[2] = {'A',0}; - const char * cpt = str; - for (int i=0; i.,SP ", 2); - if (oskbMap == 0) { - lineOSKB(KXOFF,KYOFF, keylables_map1_0, 0); - lineOSKB(KXOFF,KYOFF, keylables_map1_1, 1); - lineOSKB(KXOFF,KYOFF, keylables_map1_2, 2); - } - else if (oskbMap == 1) { - lineOSKB(KXOFF,KYOFF, keylables_map2_0, 0); - lineOSKB(KXOFF,KYOFF, keylables_map2_1, 1); - lineOSKB(KXOFF,KYOFF, keylables_map2_2, 2); - } - else { - lineOSKB(KXOFF,KYOFF, keylables_map3_0, 0); - lineOSKB(KXOFF,KYOFF, keylables_map3_1, 1); - lineOSKB(KXOFF,KYOFF, keylables_map3_2, 2); - } -} - -void toggleOskb(bool forceoff) { - if (forceoff) oskbOn=true; - if (oskbOn) { - oskbOn = false; - tft.fillScreenNoDma(RGBVAL16(0x00,0x00,0x00)); - tft.drawTextNoDma(0,32, "Press USER2 to toggle onscreen keyboard.", RGBVAL16(0xff,0xff,0xff), RGBVAL16(0x00,0x00,0x00), true); - } else { - oskbOn = true; - tft.fillScreenNoDma(RGBVAL16(0x00,0x00,0x00)); - tft.drawTextNoDma(0,32, " Press USER2 to exit onscreen keyboard. ", RGBVAL16(0xff,0xff,0xff), RGBVAL16(0x00,0x00,0x00), true); - tft.drawTextNoDma(0,64, " (USER1 to toggle between keymaps) ", RGBVAL16(0x00,0xff,0xff), RGBVAL16(0x00,0x00,0xff), true); - tft.drawRectNoDma(KXOFF,KYOFF, 22*8, 3*16, RGBVAL16(0x00,0x00,0xFF)); - drawOskb(); - } -} - -static int handleOskb(void) -{ - int retval = 0; - - uint16_t bClick = bLastState & ~oskbBLastState; - oskbBLastState = bLastState; - /* - static const char * digits = "0123456789ABCDEF"; - char buf[5] = {0,0,0,0,0}; - int val = bClick; - buf[0] = digits[(val>>12)&0xf]; - buf[1] = digits[(val>>8)&0xf]; - buf[2] = digits[(val>>4)&0xf]; - buf[3] = digits[val&0xf]; - tft.drawTextNoDma(0,KYOFF+ 64,buf,RGBVAL16(0x00,0x00,0x00),RGBVAL16(0xFF,0xFF,0xFF),1); - */ - if (bClick & MASK_KEY_USER2) - { - toggleOskb(false); - } - if (oskbOn) - { - bool updated = true; - if (bClick & MASK_KEY_USER1) - { - oskbMap += 1; - if (oskbMap == 3) oskbMap = 0; - } - else if (bClick & MASK_JOY2_LEFT) - { - cxpos++; - if (cxpos >= KWIDTH) cxpos = 0; - } - else if (bClick & MASK_JOY2_RIGHT) - { - cxpos--; - if (cxpos < 0) cxpos = KWIDTH-1; - } - else if (bClick & MASK_JOY2_DOWN) - { - cypos++; - if (cypos >= KHEIGHT) cypos = 0; - } - else if (bClick & MASK_JOY2_UP) - { - cypos--; - if (cypos < 0) cypos = KHEIGHT-1; - } - else if (oskbBLastState & MASK_JOY2_BTN) - { - retval = cypos*KWIDTH+cxpos+1; - if (retval) { - retval--; - //if (retval & 1) retval = key_map2[retval>>1]; - //else retval = key_map1[retval>>1]; - if (oskbMap == 0) { - retval = key_map1[retval]; - } - else if (oskbMap == 1) { - retval = key_map2[retval]; - } - else { - retval = key_map3[retval]; - } - //if (retval) { toggleOskb(true); updated=false; }; - } - } - else { - updated=false; - } - if (updated) drawOskb(); - } - - return retval; -} -#endif - -/******************************** - * Input and keyboard -********************************/ -int emu_ReadAnalogJoyX(int min, int max) -{ - adc_select_input(0); - int val = adc_read(); -#if INVX - val = 4095 - val; -#endif - val = val-xRef; - val = ((val*140)/100); - if ( (val > -512) && (val < 512) ) val = 0; - val = val+2048; - return (val*(max-min))/4096; -} - -int emu_ReadAnalogJoyY(int min, int max) -{ - adc_select_input(1); - int val = adc_read(); -#if INVY - val = 4095 - val; -#endif - val = val-yRef; - val = ((val*120)/100); - if ( (val > -512) && (val < 512) ) val = 0; - //val = (val*(max-min))/4096; - val = val+2048; - //return val+(max-min)/2; - return (val*(max-min))/4096; -} - - -static uint16_t readAnalogJoystick(void) -{ - uint16_t joysval = 0; -#ifdef PIN_JOY2_A1X - int xReading = emu_ReadAnalogJoyX(0,256); - if (xReading > 128) joysval |= MASK_JOY2_LEFT; - else if (xReading < 128) joysval |= MASK_JOY2_RIGHT; - - int yReading = emu_ReadAnalogJoyY(0,256); - if (yReading < 128) joysval |= MASK_JOY2_UP; - else if (yReading > 128) joysval |= MASK_JOY2_DOWN; -#endif - // First joystick -#if INVY -#ifdef PIN_JOY2_1 - if ( !gpio_get(PIN_JOY2_1) ) joysval |= MASK_JOY2_DOWN; -#endif -#ifdef PIN_JOY2_2 - if ( !gpio_get(PIN_JOY2_2) ) joysval |= MASK_JOY2_UP; -#endif -#else -#ifdef PIN_JOY2_1 - if ( !gpio_get(PIN_JOY2_1) ) joysval |= MASK_JOY2_UP; -#endif -#ifdef PIN_JOY2_2 - if ( !gpio_get(PIN_JOY2_2) ) joysval |= MASK_JOY2_DOWN; -#endif -#endif -#if INVX -#ifdef PIN_JOY2_3 - if ( !gpio_get(PIN_JOY2_3) ) joysval |= MASK_JOY2_LEFT; -#endif -#ifdef PIN_JOY2_4 - if ( !gpio_get(PIN_JOY2_4) ) joysval |= MASK_JOY2_RIGHT; -#endif -#else -#ifdef PIN_JOY2_3 - if ( !gpio_get(PIN_JOY2_3) ) joysval |= MASK_JOY2_RIGHT; -#endif -#ifdef PIN_JOY2_4 - if ( !gpio_get(PIN_JOY2_4) ) joysval |= MASK_JOY2_LEFT; -#endif -#endif -#ifdef PIN_JOY2_BTN - joysval |= (gpio_get(PIN_JOY2_BTN) ? 0 : MASK_JOY2_BTN); -#endif - - return (joysval); -} - - -int emu_SwapJoysticks(int statusOnly) { - if (!statusOnly) { - if (joySwapped) { - joySwapped = false; - } - else { - joySwapped = true; - } - } - return(joySwapped?1:0); -} - -int emu_GetPad(void) -{ - return(bLastState/*|((joySwapped?1:0)<<7)*/); -} - -int emu_ReadKeys(void) -{ - uint16_t retval; - uint16_t j1 = readAnalogJoystick(); - uint16_t j2 = 0; - - // Second joystick -#if INVY -#ifdef PIN_JOY1_1 - if ( !gpio_get(PIN_JOY1_1) ) j2 |= MASK_JOY2_DOWN; -#endif -#ifdef PIN_JOY1_2 - if ( !gpio_get(PIN_JOY1_2) ) j2 |= MASK_JOY2_UP; -#endif -#else -#ifdef PIN_JOY1_1 - if ( !gpio_get(PIN_JOY1_1) ) j2 |= MASK_JOY2_UP; -#endif -#ifdef PIN_JOY1_2 - if ( !gpio_get(PIN_JOY1_2) ) j2 |= MASK_JOY2_DOWN; -#endif -#endif -#if INVX -#ifdef PIN_JOY1_3 - if ( !gpio_get(PIN_JOY1_3) ) j2 |= MASK_JOY2_LEFT; -#endif -#ifdef PIN_JOY1_4 - if ( !gpio_get(PIN_JOY1_4) ) j2 |= MASK_JOY2_RIGHT; -#endif -#else -#ifdef PIN_JOY1_3 - if ( !gpio_get(PIN_JOY1_3) ) j2 |= MASK_JOY2_RIGHT; -#endif -#ifdef PIN_JOY1_4 - if ( !gpio_get(PIN_JOY1_4) ) j2 |= MASK_JOY2_LEFT; -#endif -#endif -#ifdef PIN_JOY1_BTN - if ( !gpio_get(PIN_JOY1_BTN) ) j2 |= MASK_JOY2_BTN; -#endif - - - if (joySwapped) { - retval = ((j1 << 8) | j2); - } - else { - retval = ((j2 << 8) | j1); - } - - if (usbnavpad & MASK_JOY2_UP) retval |= MASK_JOY2_UP; - if (usbnavpad & MASK_JOY2_DOWN) retval |= MASK_JOY2_DOWN; - if (usbnavpad & MASK_JOY2_LEFT) retval |= MASK_JOY2_LEFT; - if (usbnavpad & MASK_JOY2_RIGHT) retval |= MASK_JOY2_RIGHT; - if (usbnavpad & MASK_JOY2_BTN) retval |= MASK_JOY2_BTN; - -#ifdef PIN_KEY_USER1 - if ( !gpio_get(PIN_KEY_USER1) ) retval |= MASK_KEY_USER1; -#endif -#ifdef PIN_KEY_USER2 - if ( !gpio_get(PIN_KEY_USER2) ) retval |= MASK_KEY_USER2; -#endif -#ifdef PIN_KEY_USER3 - if ( !gpio_get(PIN_KEY_USER3) ) retval |= MASK_KEY_USER3; -#endif -#ifdef PIN_KEY_USER4 - if ( !gpio_get(PIN_KEY_USER4) ) retval |= MASK_KEY_USER4; -#endif - -#ifdef PICOMPUTER - keymatrix_hitrow = -1; - unsigned char row; - unsigned short cols[6]={KCOLOUT1,KCOLOUT2,KCOLOUT3,KCOLOUT4,KCOLOUT5,KCOLOUT6}; - unsigned char keymatrixtmp[6]; - - for (int i=0;i<6;i++){ - gpio_set_dir(cols[i], GPIO_OUT); - gpio_put(cols[i], 0); -#ifdef SWAP_ALT_DEL - sleep_us(1); - //__asm volatile ("nop\n"); // 4-8ns -#endif - row=0; - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN4) ? 0 : 0x02); - row |= (gpio_get(KROWIN1) ? 0 : 0x04); - row |= (gpio_get(KROWIN3) ? 0 : 0x08); - row |= (gpio_get(KROWIN5) ? 0 : 0x10); - row |= (gpio_get(KROWIN6) ? 0 : 0x20); - //gpio_set_dir(cols[i], GPIO_OUT); - gpio_put(cols[i], 1); - gpio_set_dir(cols[i], GPIO_IN); - gpio_disable_pulls(cols[i]); - keymatrixtmp[i] = row; - } - -#ifdef MULTI_DEBOUNCE - for (int i=0;i<6;i++){ - gpio_set_dir(cols[i], GPIO_OUT); - gpio_put(cols[i], 0); -#ifdef SWAP_ALT_DEL - sleep_us(1); - //__asm volatile ("nop\n"); // 4-8ns -#endif - row=0; - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN4) ? 0 : 0x02); - row |= (gpio_get(KROWIN1) ? 0 : 0x04); - row |= (gpio_get(KROWIN3) ? 0 : 0x08); - row |= (gpio_get(KROWIN5) ? 0 : 0x10); - row |= (gpio_get(KROWIN6) ? 0 : 0x20); - //gpio_set_dir(cols[i], GPIO_OUT); - gpio_put(cols[i], 1); - gpio_set_dir(cols[i], GPIO_IN); - gpio_disable_pulls(cols[i]); - keymatrixtmp[i] |= row; - } - - for (int i=0;i<6;i++){ - gpio_set_dir(cols[i], GPIO_OUT); - gpio_put(cols[i], 0); -#ifdef SWAP_ALT_DEL - sleep_us(1); - //__asm volatile ("nop\n"); // 4-8ns -#endif - row=0; - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN4) ? 0 : 0x02); - row |= (gpio_get(KROWIN1) ? 0 : 0x04); - row |= (gpio_get(KROWIN3) ? 0 : 0x08); - row |= (gpio_get(KROWIN5) ? 0 : 0x10); - row |= (gpio_get(KROWIN6) ? 0 : 0x20); - //gpio_set_dir(cols[i], GPIO_OUT); - gpio_put(cols[i], 1); - gpio_set_dir(cols[i], GPIO_IN); - gpio_disable_pulls(cols[i]); - keymatrixtmp[i] |= row; - } -#endif - -#ifdef SWAP_ALT_DEL - // Swap ALT and DEL - unsigned char alt = keymatrixtmp[0] & 0x02; - unsigned char del = keymatrixtmp[5] & 0x20; - keymatrixtmp[0] &= ~0x02; - keymatrixtmp[5] &= ~0x20; - if (alt) keymatrixtmp[5] |= 0x20; - if (del) keymatrixtmp[0] |= 0x02; -#endif - - bool alt_pressed=false; - if ( keymatrixtmp[5] & 0x20 ) {alt_pressed=true; keymatrixtmp[5] &= ~0x20;}; - - for (int i=0;i<6;i++){ - row = keymatrixtmp[i]; - if (row) keymatrix_hitrow=i; - keymatrix[i] = row; - } - - //6,9,15,8,7,22 -#if INVX - if ( row & 0x2 ) retval |= MASK_JOY2_LEFT; - if ( row & 0x1 ) retval |= MASK_JOY2_RIGHT; -#else - if ( row & 0x1 ) retval |= MASK_JOY2_LEFT; - if ( row & 0x2 ) retval |= MASK_JOY2_RIGHT; -#endif -#if INVY - if ( row & 0x8 ) retval |= MASK_JOY2_DOWN; - if ( row & 0x4 ) retval |= MASK_JOY2_UP; -#else - if ( row & 0x4 ) retval |= MASK_JOY2_DOWN; - if ( row & 0x8 ) retval |= MASK_JOY2_UP; -#endif - if ( row & 0x10 ) retval |= MASK_JOY2_BTN; - - // Handle LED flash - uint32_t time_ms=to_ms_since_boot (get_absolute_time()); - if ((time_ms-last_t_ms) > 100) { - last_t_ms = time_ms; - if (ledflash_toggle == false) { - ledflash_toggle = true; - } - else { - ledflash_toggle = false; - } - } - - if ( alt_pressed ) { - if (key_fn == false) - { - // Release to Press transition - if (hundred_ms_cnt == 0) { - keypress_t_ms=time_ms; - hundred_ms_cnt += 1; // 1 - } - else { - hundred_ms_cnt += 1; // 2 - if (hundred_ms_cnt >= 2) - { - hundred_ms_cnt = 0; - /* - if ( (time_ms-keypress_t_ms) < 500) - { - if (key_alt == false) - { - key_alt = true; - } - else - { - key_alt = false; - } - } - */ - } - } - } - else { - // Keep press - if (hundred_ms_cnt == 1) { - if ((to_ms_since_boot (get_absolute_time())-keypress_t_ms) > 2000) - { - if (key_alt == false) - { - key_alt = true; - } - else - { - key_alt = false; - } - hundred_ms_cnt = 0; - } - } - } - key_fn = true; - } - else { - key_fn = false; - } - - // Handle LED - if (key_alt == true) { - gpio_put(KLED, (ledflash_toggle?1:0)); - } - else { - if (key_fn == true) { - gpio_put(KLED, 1); - } - else { - gpio_put(KLED, 0); - } - } - - if ( key_fn ) retval |= MASK_KEY_USER2; - if ( ( key_fn ) && (keymatrix[0] == 0x02 )) retval |= MASK_KEY_USER1; -#endif - - //Serial.println(retval,HEX); - - if ( ((retval & (MASK_KEY_USER1+MASK_KEY_USER2)) == (MASK_KEY_USER1+MASK_KEY_USER2)) - || (retval & MASK_KEY_USER4 ) ) - { - } - -#if (defined(ILI9341) || defined(ST7789)) && defined(USE_VGA) - if (oskbOn) { - retval |= MASK_OSKB; - } -#endif - - return (retval); -} - -unsigned short emu_DebounceLocalKeys(void) -{ - uint16_t bCurState = emu_ReadKeys(); - uint16_t bClick = bCurState & ~bLastState; - bLastState = bCurState; - - return (bClick); -} - -int emu_ReadI2CKeyboard(void) { - int retval=0; -#ifdef PICOMPUTER - if (key_alt) { - keys = (const unsigned short *)key_map3; - } - else if (key_fn) { - keys = (const unsigned short *)key_map2; - } - else { - keys = (const unsigned short *)key_map1; - } - if (keymatrix_hitrow >=0 ) { - unsigned short match = ((unsigned short)keymatrix_hitrow<<8) | keymatrix[keymatrix_hitrow]; - for (int i=0; i=0) { - menuRedraw=true; - curFile -= 9; - } else if (curFile!=0) { - menuRedraw=true; - curFile--; - } - } - else if ( (bClick & MASK_JOY2_DOWN) || (bClick & MASK_JOY1_DOWN) ) { - if ((curFile<(nbFiles-1)) && (nbFiles)) { - curFile++; - menuRedraw=true; - } - } - else if ( (bClick & MASK_JOY2_LEFT) || (bClick & MASK_JOY1_LEFT) ) { - if ((curFile<(nbFiles-9)) && (nbFiles)) { - curFile += 9; - menuRedraw=true; - } - else if ((curFile<(nbFiles-1)) && (nbFiles)) { - curFile++; - menuRedraw=true; - } - } - else if ( (bClick & MASK_KEY_USER2) ) { - emu_SwapJoysticks(0); - menuRedraw=true; - } - - if (menuRedraw && nbFiles) { - int fileIndex = 0; - tft.drawRectNoDma(MENU_FILE_XOFFSET,MENU_FILE_YOFFSET, MENU_FILE_W, MENU_FILE_H, MENU_FILE_BGCOLOR); -// if (curFile <= (MAX_MENULINES/2-1)) topFile=0; -// else topFile=curFile-(MAX_MENULINES/2); - if (curFile <= (MAX_MENULINES-1)) topFile=0; - else topFile=curFile-(MAX_MENULINES/2); - - int i=0; - while (i=nbFiles) { - // no more files - break; - } - char * filename = &files[fileIndex][0]; - if (fileIndex >= topFile) { - if ((i+topFile) < nbFiles ) { - if ((i+topFile)==curFile) { - tft.drawTextNoDma(MENU_FILE_XOFFSET,i*TEXT_HEIGHT+MENU_FILE_YOFFSET, filename, RGBVAL16(0xff,0xff,0x00), RGBVAL16(0xff,0x00,0x00), true); - strcpy(selected_filename,filename); - } - else { - tft.drawTextNoDma(MENU_FILE_XOFFSET,i*TEXT_HEIGHT+MENU_FILE_YOFFSET, filename, RGBVAL16(0xff,0xff,0xff), MENU_FILE_BGCOLOR, true); - } - } - i++; - } - fileIndex++; - } - - - tft.drawTextNoDma(48,MENU_JOYS_YOFFSET+8, (emu_SwapJoysticks(1)?(char*)"SWAP=1":(char*)"SWAP=0"), RGBVAL16(0x00,0xff,0xff), RGBVAL16(0x00,0x00,0xff), false); - menuRedraw=false; - } - - return (action); -} - -bool menuActive(void) -{ - return (menuOn); -} - -void toggleMenu(bool on) { - if (on) { - menuOn = true; - backgroundMenu(); - } else { - menuOn = false; - } -} - -char * menuSelection(void) -{ - return (selection); -} - - -/******************************** - * File IO -********************************/ -int emu_FileOpen(const char * filepath, const char * mode) -{ - int retval = 0; - - emu_printf("FileOpen..."); - emu_printf(filepath); - if( !(f_open(&file, filepath, FA_READ)) ) { - retval = 1; - } - else { - emu_printf("FileOpen failed"); - } - return (retval); -} - -int emu_FileRead(void * buf, int size, int handler) -{ - unsigned int retval=0; - f_read (&file, (void*)buf, size, &retval); - return retval; -} - -int emu_FileGetc(int handler) -{ - unsigned char c; - unsigned int retval=0; - if( !(f_read (&file, &c, 1, &retval)) ) - if (retval != 1) { - emu_printf("emu_FileGetc failed"); - } - return (int)c; -} - -void emu_FileClose(int handler) -{ - f_close(&file); -} - -int emu_FileSeek(int handler, int seek, int origin) -{ - f_lseek(&file, seek); - return (seek); -} - -int emu_FileTell(int handler) -{ - return (f_tell(&file)); -} - - -unsigned int emu_FileSize(const char * filepath) -{ - int filesize=0; - emu_printf("FileSize..."); - emu_printf(filepath); - FILINFO entry; - f_stat(filepath, &entry); - filesize = entry.fsize; - return(filesize); -} - -unsigned int emu_LoadFile(const char * filepath, void * buf, int size) -{ - int filesize = 0; - - emu_printf("LoadFile..."); - emu_printf(filepath); - if( !(f_open(&file, filepath, FA_READ)) ) { - filesize = f_size(&file); - emu_printf(filesize); - if (size >= filesize) - { - unsigned int retval=0; - if( (f_read (&file, buf, filesize, &retval)) ) { - emu_printf("File read failed"); - } - } - f_close(&file); - } - - return(filesize); -} - -static FIL outfile; - -static bool emu_writeConfig(void) -{ - bool retval = false; - if( !(f_open(&outfile, ROMSDIR "/" AUTORUN_FILENAME, FA_CREATE_NEW | FA_WRITE)) ) { - unsigned int sizeread=0; - if( (f_write (&outfile, selection, strlen(selection), &sizeread)) ) { - emu_printf("Config write failed"); - } - else { - retval = true; - } - f_close(&outfile); - } - return retval; -} - -static bool emu_readConfig(void) -{ - bool retval = false; - if( !(f_open(&outfile, ROMSDIR "/" AUTORUN_FILENAME, FA_READ)) ) { - unsigned int filesize = f_size(&outfile); - unsigned int sizeread=0; - if( (f_read (&outfile, selection, filesize, &sizeread)) ) { - emu_printf("Config read failed"); - } - else { - if (sizeread == filesize) { - selection[filesize]=0; - retval = true; - } - } - f_close(&outfile); - } - return retval; -} - -static bool emu_eraseConfig(void) -{ - f_unlink (ROMSDIR "/" AUTORUN_FILENAME); -} - - -/******************************** - * Initialization -********************************/ -void emu_init(void) -{ - // Dual display config, initialize TFT -#if (defined(ILI9341) || defined(ST7789)) && defined(USE_VGA) - tft.begin(); -#endif - - sd_init_driver(); - FRESULT fr = f_mount(&fatfs, "0:", 1); - - strcpy(selection,ROMSDIR); - nbFiles = readNbFiles(selection); - - emu_printf("SD initialized, files found: "); - emu_printi(nbFiles); - - emu_InitJoysticks(); -#ifdef SWAP_JOYSTICK - joySwapped = true; -#else - joySwapped = false; -#endif - - int keypressed = emu_ReadKeys(); -#ifdef PICOMPUTER - // Flip screen if UP pressed - if (keypressed & MASK_JOY2_UP) - { -#ifdef PICOMPUTERMAX -#ifndef USE_VGA - tft.flipscreen(true); -#endif -#else - tft.flipscreen(true); -#endif - } - else - { -#ifdef PICOMPUTERMAX -#ifndef USE_VGA - tft.flipscreen(false); -#endif -#else - tft.flipscreen(false); -#endif - } -#endif - - if (keypressed & MASK_JOY2_DOWN) { - tft.fillScreenNoDma( RGBVAL16(0xff,0x00,0x00) ); - tft.drawTextNoDma(64,48, (char*)" AUTURUN file erased", RGBVAL16(0xff,0xff,0x00), RGBVAL16(0xff,0x00,0x00), true); - tft.drawTextNoDma(64,48+24, (char*)"Please reset the board!", RGBVAL16(0xff,0xff,0x00), RGBVAL16(0xff,0x00,0x00), true); - emu_eraseConfig(); - } - else { - if (emu_readConfig()) { - autorun = true; - } - } - toggleMenu(true); -} - - -void emu_start(void) -{ - usbnavpad = 0; - - keyMap = 0; -} diff --git a/MCUME_pico/picocolem/emuapi.h b/MCUME_pico/picocolem/emuapi.h deleted file mode 100644 index 553c694..0000000 --- a/MCUME_pico/picocolem/emuapi.h +++ /dev/null @@ -1,148 +0,0 @@ -#ifndef EMUAPI_H -#define EMUAPI_H - -#include "platform_config.h" - -//#define TIMER_REND 1 -#define EXTRA_HEAP 0x10 - -// Title: < > -#define TITLE " Coleco Emulator" -#define ROMSDIR "coleco" - -#define emu_Init(ROM) {coc_Init();coc_Start(ROM);} -#define emu_Step() {coc_Step();} -#define emu_Input(x) {} - -#define PALETTE_SIZE 16 -#define VID_FRAME_SKIP 0x0 -#define TFT_VBUFFER_YCROP 0 -#define SINGLELINE_RENDERING 1 - -#define ACTION_NONE 0 -#define ACTION_MAXKBDVAL 12 -#define ACTION_EXITKBD 128 -#define ACTION_RUNTFT 129 -#define ACTION_RUNVGA 130 - - -#ifdef KEYMAP_PRESENT - -#define keylables_map1_0 (char *)"1234567890 " -#define keylables_map1_1 (char *)" # * " -#define keylables_map1_2 (char *)" " -const unsigned short key_map1[] = { - 2,3,4,5,6,7,8,9,10,1,0, - 0,0,0,11,0,0,0,0,12,0,0, - 0, 0,0,0,0,0,0,0,0,0, - 0,0,0,0 - }; - -/* -const unsigned short key_map1[] = { - 2,3,4, - 5,6,7, - 8,9,10, - 11,1,12}; -*/ - -#define keylables_map2_0 (char *)" " -#define keylables_map2_1 (char *)" " -#define keylables_map2_2 (char *)" " -const unsigned short key_map2[] = { - 0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0, - 0, 0,0,0,0,0,0,0,0,0, - 0,0,0,0 - }; - -#define keylables_map3_0 (char *)" " -#define keylables_map3_1 (char *)" " -#define keylables_map3_2 (char *)" " -const unsigned short key_map3[] = { - 0,0,0,0,0,0,0,0,0,0,0, // function keys - 0, 0,0,0,0,0,0,0,0,0,0, - 0, 0,0,0,0,0,0,0,0,0, - 0,0,0,0 - }; - -const unsigned short matkeys[] = { - 0x020,0x120,0x220,0x320,0x420,0x408,0x308,0x208,0x108,0x008,0x002, // row 1 - 0x510,0x010,0x110,0x210,0x310,0x410,0x401,0x301,0x201,0x101,0x001, // row 2 - 0x520,0x102,0x202,0x302,0x402,0x404,0x304,0x204,0x104,0x004, // row 3 - 0x508,0x501,0x502,0x504 }; // cursor keys - -#endif - - -#define MASK_JOY2_RIGHT 0x0001 -#define MASK_JOY2_LEFT 0x0002 -#define MASK_JOY2_UP 0x0004 -#define MASK_JOY2_DOWN 0x0008 -#define MASK_JOY2_BTN 0x0010 -#define MASK_KEY_USER1 0x0020 -#define MASK_KEY_USER2 0x0040 -#define MASK_KEY_USER3 0x0080 -#define MASK_JOY1_RIGHT 0x0100 -#define MASK_JOY1_LEFT 0x0200 -#define MASK_JOY1_UP 0x0400 -#define MASK_JOY1_DOWN 0x0800 -#define MASK_JOY1_BTN 0x1000 -#define MASK_KEY_USER4 0x2000 -#define MASK_OSKB 0x8000 - -extern void emu_init(void); -extern void emu_start(void); -extern void emu_resetSD(void); - -extern void emu_printf(const char * text); -extern void emu_printi(int val); -extern void * emu_Malloc(int size); -extern void emu_Free(void * pt); - -extern int emu_FileOpen(const char * filepath, const char * mode); -extern int emu_FileRead(void * buf, int size, int handler); -extern int emu_FileGetc(int handler); -extern int emu_FileSeek(int handler, int seek, int origin); -extern int emu_FileTell(int handler); -extern void emu_FileClose(int handler); - -extern unsigned int emu_FileSize(const char * filepath); -extern unsigned int emu_LoadFile(const char * filepath, void * buf, int size); - -extern void emu_SetPaletteEntry(unsigned char r, unsigned char g, unsigned char b, int index); -extern void emu_DrawScreen(unsigned char * VBuf, int width, int height, int stride); -extern void emu_DrawLine(unsigned char * VBuf, int width, int height, int line); -extern void emu_DrawLine8(unsigned char * VBuf, int width, int height, int line); -extern void emu_DrawLine16(unsigned short * VBuf, int width, int height, int line); -extern void emu_DrawVsync(void); -extern int emu_FrameSkip(void); -extern void * emu_LineBuffer(int line); - -extern void emu_InitJoysticks(void); -extern int emu_SwapJoysticks(int statusOnly); -extern unsigned short emu_DebounceLocalKeys(void); -extern int emu_ReadKeys(void); -extern int emu_GetPad(void); -extern int emu_ReadAnalogJoyX(int min, int max); -extern int emu_ReadAnalogJoyY(int min, int max); -extern int emu_ReadI2CKeyboard(void); -extern void emu_KeyboardOnUp(int keymodifer, int key); -extern void emu_KeyboardOnDown(int keymodifer, int key); - -extern void emu_sndPlaySound(int chan, int volume, int freq); -extern void emu_sndPlayBuzz(int size, int val); -extern void emu_sndInit(); -extern void emu_resetus(void); -extern int emu_us(void); - -extern int emu_setKeymap(int index); - -extern void emu_FileTempInit(void); -extern void emu_FileTempRead(int addr, unsigned char * val, int n); -extern void emu_FileTempWrite(int addr, unsigned char val); -extern void emu_printh(int val); - - - -#endif diff --git a/MCUME_pico/picocolem/emucfg.h b/MCUME_pico/picocolem/emucfg.h new file mode 100644 index 0000000..c1c21e4 --- /dev/null +++ b/MCUME_pico/picocolem/emucfg.h @@ -0,0 +1,102 @@ +#ifndef EMUCFG_H +#define EMUCFG_H + +#define PALETTE_SIZE 16 +#define VID_FRAME_SKIP 0x0 +#define TFT_VBUFFER_YCROP 0 +#define SINGLELINE_RENDERING 1 +//#define CUSTOM_SND 1 +//#define TIMER_REND 1 +#define EXTRA_HEAP 0x10 +#define FILEBROWSER + +// Title: < > +#define TITLE " Coleco Emulator" +#define ROMSDIR "coleco" + +#define emu_Init(ROM) {coc_Init();coc_Start(ROM);} +#define emu_Step() {coc_Step();} +#define emu_Input(x) {} + +#ifdef KEYMAP_PRESENT + +#ifdef PICOZX +const unsigned short key_map1[] = { + 2,3,4,5,6,7,8,9,10,1, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0 + }; + +const unsigned short key_map2[] = { + 0,0,11,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,12,0,0,0,0, + 0,0,0,0,0,0 + }; + +const unsigned short key_map3[] = { + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0 + }; + +const unsigned short matkeys[] = { + 0x104,0x101,0x108,0x102,0x110,0x120,0x140,0x204,0x201,0x208, // row 1 + 0x202,0x210,0x220,0x240,0x304,0x301,0x308,0x302,0x310,0x320, // row 2 + 0x340,0x404,0x401,0x408,0x402,0x410,0x420,0x440,0x504,0x501, // row 3 + 0x020,0x508,0x502,0x510,0x520,0x540,0x604,0x601,0x040,0x608, // row 4 + 0x008,0x001,0x002,0x010,0x620,0x640 }; // cursor keys up, left, right, down, <<<, >>> + +#else +#define keylables_map1_0 (char *)"1234567890 " +#define keylables_map1_1 (char *)" # * " +#define keylables_map1_2 (char *)" " +const unsigned short key_map1[] = { + 2,3,4,5,6,7,8,9,10,1,0, + 0,0,0,11,0,0,0,0,12,0,0, + 0, 0,0,0,0,0,0,0,0,0, + 0,0,0,0 + }; + +/* +const unsigned short key_map1[] = { + 2,3,4, + 5,6,7, + 8,9,10, + 11,1,12}; +*/ + +#define keylables_map2_0 (char *)" " +#define keylables_map2_1 (char *)" " +#define keylables_map2_2 (char *)" " +const unsigned short key_map2[] = { + 0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0, + 0, 0,0,0,0,0,0,0,0,0, + 0,0,0,0 + }; + +#define keylables_map3_0 (char *)" " +#define keylables_map3_1 (char *)" " +#define keylables_map3_2 (char *)" " +const unsigned short key_map3[] = { + 0,0,0,0,0,0,0,0,0,0,0, // function keys + 0, 0,0,0,0,0,0,0,0,0,0, + 0, 0,0,0,0,0,0,0,0,0, + 0,0,0,0 + }; + +const unsigned short matkeys[] = { + 0x020,0x120,0x220,0x320,0x420,0x408,0x308,0x208,0x108,0x008,0x002, // row 1 + 0x510,0x010,0x110,0x210,0x310,0x410,0x401,0x301,0x201,0x101,0x001, // row 2 + 0x520,0x102,0x202,0x302,0x402,0x404,0x304,0x204,0x104,0x004, // row 3 + 0x508,0x501,0x502,0x504 }; // cursor keys +#endif +#endif + +#endif diff --git a/MCUME_pico/picocolem/font8x8.h b/MCUME_pico/picocolem/font8x8.h deleted file mode 100644 index 4f773da..0000000 --- a/MCUME_pico/picocolem/font8x8.h +++ /dev/null @@ -1,135 +0,0 @@ - -// Font: c64_lower.64c - -const unsigned char font8x8[128][8] PROGMEM = -{ - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0000 (nul) - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0001 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0002 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0003 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0004 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0005 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0006 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0007 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0008 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0009 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000A - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000B - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000C - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000D - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000E - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000F - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0010 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0011 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0012 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0013 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0014 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0015 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0016 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0017 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0018 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0019 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001A - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001B - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001C - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001D - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001E - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001F - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0020 (space) - { 0x18, 0x3C, 0x3C, 0x18, 0x18, 0x00, 0x18, 0x00}, // U+0021 (!) - { 0x36, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0022 (") - { 0x36, 0x36, 0x7F, 0x36, 0x7F, 0x36, 0x36, 0x00}, // U+0023 (#) - { 0x0C, 0x3E, 0x03, 0x1E, 0x30, 0x1F, 0x0C, 0x00}, // U+0024 ($) - { 0x00, 0x63, 0x33, 0x18, 0x0C, 0x66, 0x63, 0x00}, // U+0025 (%) - { 0x1C, 0x36, 0x1C, 0x6E, 0x3B, 0x33, 0x6E, 0x00}, // U+0026 (&) - { 0x06, 0x06, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0027 (') - { 0x18, 0x0C, 0x06, 0x06, 0x06, 0x0C, 0x18, 0x00}, // U+0028 (() - { 0x06, 0x0C, 0x18, 0x18, 0x18, 0x0C, 0x06, 0x00}, // U+0029 ()) - { 0x00, 0x66, 0x3C, 0xFF, 0x3C, 0x66, 0x00, 0x00}, // U+002A (*) - { 0x00, 0x0C, 0x0C, 0x3F, 0x0C, 0x0C, 0x00, 0x00}, // U+002B (+) - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x0C, 0x06}, // U+002C (,) - { 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x00}, // U+002D (-) - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x0C, 0x00}, // U+002E (.) - { 0x60, 0x30, 0x18, 0x0C, 0x06, 0x03, 0x01, 0x00}, // U+002F (/) - { 0x3E, 0x63, 0x73, 0x7B, 0x6F, 0x67, 0x3E, 0x00}, // U+0030 (0) - { 0x0C, 0x0E, 0x0C, 0x0C, 0x0C, 0x0C, 0x3F, 0x00}, // U+0031 (1) - { 0x1E, 0x33, 0x30, 0x1C, 0x06, 0x33, 0x3F, 0x00}, // U+0032 (2) - { 0x1E, 0x33, 0x30, 0x1C, 0x30, 0x33, 0x1E, 0x00}, // U+0033 (3) - { 0x38, 0x3C, 0x36, 0x33, 0x7F, 0x30, 0x78, 0x00}, // U+0034 (4) - { 0x3F, 0x03, 0x1F, 0x30, 0x30, 0x33, 0x1E, 0x00}, // U+0035 (5) - { 0x1C, 0x06, 0x03, 0x1F, 0x33, 0x33, 0x1E, 0x00}, // U+0036 (6) - { 0x3F, 0x33, 0x30, 0x18, 0x0C, 0x0C, 0x0C, 0x00}, // U+0037 (7) - { 0x1E, 0x33, 0x33, 0x1E, 0x33, 0x33, 0x1E, 0x00}, // U+0038 (8) - { 0x1E, 0x33, 0x33, 0x3E, 0x30, 0x18, 0x0E, 0x00}, // U+0039 (9) - { 0x00, 0x0C, 0x0C, 0x00, 0x00, 0x0C, 0x0C, 0x00}, // U+003A (:) - { 0x00, 0x0C, 0x0C, 0x00, 0x00, 0x0C, 0x0C, 0x06}, // U+003B (//) - { 0x18, 0x0C, 0x06, 0x03, 0x06, 0x0C, 0x18, 0x00}, // U+003C (<) - { 0x00, 0x00, 0x3F, 0x00, 0x00, 0x3F, 0x00, 0x00}, // U+003D (=) - { 0x06, 0x0C, 0x18, 0x30, 0x18, 0x0C, 0x06, 0x00}, // U+003E (>) - { 0x1E, 0x33, 0x30, 0x18, 0x0C, 0x00, 0x0C, 0x00}, // U+003F (?) - { 0x3E, 0x63, 0x7B, 0x7B, 0x7B, 0x03, 0x1E, 0x00}, // U+0040 (@) - { 0x0C, 0x1E, 0x33, 0x33, 0x3F, 0x33, 0x33, 0x00}, // U+0041 (A) - { 0x3F, 0x66, 0x66, 0x3E, 0x66, 0x66, 0x3F, 0x00}, // U+0042 (B) - { 0x3C, 0x66, 0x03, 0x03, 0x03, 0x66, 0x3C, 0x00}, // U+0043 (C) - { 0x1F, 0x36, 0x66, 0x66, 0x66, 0x36, 0x1F, 0x00}, // U+0044 (D) - { 0x7F, 0x46, 0x16, 0x1E, 0x16, 0x46, 0x7F, 0x00}, // U+0045 (E) - { 0x7F, 0x46, 0x16, 0x1E, 0x16, 0x06, 0x0F, 0x00}, // U+0046 (F) - { 0x3C, 0x66, 0x03, 0x03, 0x73, 0x66, 0x7C, 0x00}, // U+0047 (G) - { 0x33, 0x33, 0x33, 0x3F, 0x33, 0x33, 0x33, 0x00}, // U+0048 (H) - { 0x1E, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+0049 (I) - { 0x78, 0x30, 0x30, 0x30, 0x33, 0x33, 0x1E, 0x00}, // U+004A (J) - { 0x67, 0x66, 0x36, 0x1E, 0x36, 0x66, 0x67, 0x00}, // U+004B (K) - { 0x0F, 0x06, 0x06, 0x06, 0x46, 0x66, 0x7F, 0x00}, // U+004C (L) - { 0x63, 0x77, 0x7F, 0x7F, 0x6B, 0x63, 0x63, 0x00}, // U+004D (M) - { 0x63, 0x67, 0x6F, 0x7B, 0x73, 0x63, 0x63, 0x00}, // U+004E (N) - { 0x1C, 0x36, 0x63, 0x63, 0x63, 0x36, 0x1C, 0x00}, // U+004F (O) - { 0x3F, 0x66, 0x66, 0x3E, 0x06, 0x06, 0x0F, 0x00}, // U+0050 (P) - { 0x1E, 0x33, 0x33, 0x33, 0x3B, 0x1E, 0x38, 0x00}, // U+0051 (Q) - { 0x3F, 0x66, 0x66, 0x3E, 0x36, 0x66, 0x67, 0x00}, // U+0052 (R) - { 0x1E, 0x33, 0x07, 0x0E, 0x38, 0x33, 0x1E, 0x00}, // U+0053 (S) - { 0x3F, 0x2D, 0x0C, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+0054 (T) - { 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x3F, 0x00}, // U+0055 (U) - { 0x33, 0x33, 0x33, 0x33, 0x33, 0x1E, 0x0C, 0x00}, // U+0056 (V) - { 0x63, 0x63, 0x63, 0x6B, 0x7F, 0x77, 0x63, 0x00}, // U+0057 (W) - { 0x63, 0x63, 0x36, 0x1C, 0x1C, 0x36, 0x63, 0x00}, // U+0058 (X) - { 0x33, 0x33, 0x33, 0x1E, 0x0C, 0x0C, 0x1E, 0x00}, // U+0059 (Y) - { 0x7F, 0x63, 0x31, 0x18, 0x4C, 0x66, 0x7F, 0x00}, // U+005A (Z) - { 0x1E, 0x06, 0x06, 0x06, 0x06, 0x06, 0x1E, 0x00}, // U+005B ([) - { 0x03, 0x06, 0x0C, 0x18, 0x30, 0x60, 0x40, 0x00}, // U+005C (\) - { 0x1E, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1E, 0x00}, // U+005D (]) - { 0x08, 0x1C, 0x36, 0x63, 0x00, 0x00, 0x00, 0x00}, // U+005E (^) - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF}, // U+005F (_) - { 0x0C, 0x0C, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0060 (`) - { 0x00, 0x00, 0x1E, 0x30, 0x3E, 0x33, 0x6E, 0x00}, // U+0061 (a) - { 0x07, 0x06, 0x06, 0x3E, 0x66, 0x66, 0x3B, 0x00}, // U+0062 (b) - { 0x00, 0x00, 0x1E, 0x33, 0x03, 0x33, 0x1E, 0x00}, // U+0063 (c) - { 0x38, 0x30, 0x30, 0x3e, 0x33, 0x33, 0x6E, 0x00}, // U+0064 (d) - { 0x00, 0x00, 0x1E, 0x33, 0x3f, 0x03, 0x1E, 0x00}, // U+0065 (e) - { 0x1C, 0x36, 0x06, 0x0f, 0x06, 0x06, 0x0F, 0x00}, // U+0066 (f) - { 0x00, 0x00, 0x6E, 0x33, 0x33, 0x3E, 0x30, 0x1F}, // U+0067 (g) - { 0x07, 0x06, 0x36, 0x6E, 0x66, 0x66, 0x67, 0x00}, // U+0068 (h) - { 0x0C, 0x00, 0x0E, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+0069 (i) - { 0x30, 0x00, 0x30, 0x30, 0x30, 0x33, 0x33, 0x1E}, // U+006A (j) - { 0x07, 0x06, 0x66, 0x36, 0x1E, 0x36, 0x67, 0x00}, // U+006B (k) - { 0x0E, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+006C (l) - { 0x00, 0x00, 0x33, 0x7F, 0x7F, 0x6B, 0x63, 0x00}, // U+006D (m) - { 0x00, 0x00, 0x1F, 0x33, 0x33, 0x33, 0x33, 0x00}, // U+006E (n) - { 0x00, 0x00, 0x1E, 0x33, 0x33, 0x33, 0x1E, 0x00}, // U+006F (o) - { 0x00, 0x00, 0x3B, 0x66, 0x66, 0x3E, 0x06, 0x0F}, // U+0070 (p) - { 0x00, 0x00, 0x6E, 0x33, 0x33, 0x3E, 0x30, 0x78}, // U+0071 (q) - { 0x00, 0x00, 0x3B, 0x6E, 0x66, 0x06, 0x0F, 0x00}, // U+0072 (r) - { 0x00, 0x00, 0x3E, 0x03, 0x1E, 0x30, 0x1F, 0x00}, // U+0073 (s) - { 0x08, 0x0C, 0x3E, 0x0C, 0x0C, 0x2C, 0x18, 0x00}, // U+0074 (t) - { 0x00, 0x00, 0x33, 0x33, 0x33, 0x33, 0x6E, 0x00}, // U+0075 (u) - { 0x00, 0x00, 0x33, 0x33, 0x33, 0x1E, 0x0C, 0x00}, // U+0076 (v) - { 0x00, 0x00, 0x63, 0x6B, 0x7F, 0x7F, 0x36, 0x00}, // U+0077 (w) - { 0x00, 0x00, 0x63, 0x36, 0x1C, 0x36, 0x63, 0x00}, // U+0078 (x) - { 0x00, 0x00, 0x33, 0x33, 0x33, 0x3E, 0x30, 0x1F}, // U+0079 (y) - { 0x00, 0x00, 0x3F, 0x19, 0x0C, 0x26, 0x3F, 0x00}, // U+007A (z) - { 0x38, 0x0C, 0x0C, 0x07, 0x0C, 0x0C, 0x38, 0x00}, // U+007B ({) - { 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x00}, // U+007C (|) - { 0x07, 0x0C, 0x0C, 0x38, 0x0C, 0x0C, 0x07, 0x00}, // U+007D (}) - { 0x6E, 0x3B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+007E (~) - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} // U+007F -}; - diff --git a/MCUME_pico/picocolem/keyboard.h b/MCUME_pico/picocolem/keyboard.h deleted file mode 100644 index 7f8dac3..0000000 --- a/MCUME_pico/picocolem/keyboard.h +++ /dev/null @@ -1,132 +0,0 @@ -/**************************************************************************** -* Purpose : Keyboard input driver. -* Module : Keyboard -* Author : J-M Harvengt -* History : 10/08/97 Creation -****************************************************************************/ -#ifndef _KEYBOARD -#define _KEYBOARD - -/**************************************************************************** -* Macros / typedefs -****************************************************************************/ -#define SOURCE_REM 0x01 -#define SOURCE_PAD 0x02 -#define SOURCE_KEYB 0x03 - -/* keys id */ -#define KEY_UNKNOWN 0x00 -#define KEY_LEFT 0x01 -#define KEY_RIGHT 0x02 -#define KEY_UP 0x03 -#define KEY_DOWN 0x04 -#define KEY_SPACE 0x05 - -#define KEY_FONE 0x06 -#define KEY_FTWO 0x07 -#define KEY_FTHREE 0x08 -#define KEY_FFOUR 0x09 -#define KEY_FFIVE 0x0a -#define KEY_FSIX 0x0b -#define KEY_FSEVEN 0x0c -#define KEY_FEIGHT 0x0d -#define KEY_FNINE 0x0e -#define KEY_FZERO 0x0f - -#define KEY_ONE 0x10 -#define KEY_TWO 0x11 -#define KEY_THREE 0x12 -#define KEY_FOUR 0x13 -#define KEY_FIVE 0x14 -#define KEY_SIX 0x15 -#define KEY_SEVEN 0x16 -#define KEY_EIGHT 0x17 -#define KEY_NINE 0x18 -#define KEY_ZERO 0x19 - -#define KEY_OK KEY_SPACE -#define KEY_BUT KEY_SPACE -#define KEY_BACK KEY_FONE -#define KEY_MENU KEY_FTWO -#define KEY_TELEWEB KEY_FTHREE -#define KEY_TELETEXT KEY_FFOUR -#define KEY_COIN KEY_FTHREE -#define KEY_ONEUP KEY_FFOUR - -/* Bit mask for pad keys */ -#define JKEY_PLEFT 0x0001 -#define JKEY_PRIGHT 0x0002 -#define JKEY_PUP 0x0004 -#define JKEY_PDOWN 0x0008 -#define JKEY_PSPACE 0x0010 -#define JKEY_PONE 0x0020 -#define JKEY_PTWO 0x0040 -#define JKEY_PTHREE 0x0080 -#define JKEY_PFOUR 0x0100 -#define JKEY_PFIVE 0x0200 -#define JKEY_PSIX 0x0400 -#define JKEY_PSEVEN 0x0800 -#define JKEY_PEIGHT 0x1000 -#define JKEY_PNINE 0x2000 -#define JKEY_PZERO 0x4000 - -#define JKEY_LEFT 0x00010000 -#define JKEY_RIGHT 0x00020000 -#define JKEY_UP 0x00040000 -#define JKEY_DOWN 0x00080000 -#define JKEY_SPACE 0x00100000 -#define JKEY_ONE 0x00200000 -#define JKEY_TWO 0x00400000 -#define JKEY_THREE 0x00800000 -#define JKEY_FOUR 0x01000000 -#define JKEY_FIVE 0x02000000 -#define JKEY_SIX 0x04000000 -#define JKEY_SEVEN 0x08000000 -#define JKEY_EIGHT 0x10000000 -#define JKEY_NINE 0x20000000 -#define JKEY_ZERO 0x40000000 - -#define JKEY_OK JKEY_SPACE -#define JKEY_BUT JKEY_SPACE -#define JKEY_BACK JKEY_ONE -#define JKEY_MENU JKEY_TWO -#define JKEY_TELEWEB JKEY_THREE -#define JKEY_TELETEXT JKEY_FOUR -#define JKEY_COIN JKEY_THREE -#define JKEY_ONEUP JKEY_FOUR -#define JKEY_PPLUS JKEY_EIGHT -#define JKEY_PMINUS JKEY_NINE - -#define JKEY_POK JKEY_PSPACE -#define JKEY_PBUT JKEY_PSPACE -#define JKEY_PBACK JKEY_PONE -#define JKEY_PMENU JKEY_PTWO -#define JKEY_PTELEWEB JKEY_PTHREE -#define JKEY_PTELETEXT JKEY_PFOUR -#define JKEY_PEPG JKEY_PFIVE -#define JKEY_PCOIN JKEY_PTHREE -#define JKEY_PONEUP JKEY_PFOUR -#define JKEY_PPPLUS JKEY_PEIGHT -#define JKEY_PPMINUS JKEY_PNINE - -/* Bit mask for mouse button */ -#define LMOUSEDOWN 0x40 -#define LMOUSEUP 0x80 - -/**************************************************************************** -* Exported procedures -****************************************************************************/ -extern void key_Init(void); -extern void key_TurnOn(void); -extern void key_TurnOff(void); - -extern void key_OnKeyDown(int aSource, int aKey); -extern void key_OnKeyUp(int aSource, int aKey); -extern void key_SubscribeKeyUp(void * callback); -extern void key_SubscribeKeyDown(void * callback); -extern void key_OnKeyTimer(void); -extern int key_GetKeyPad(void); - -extern void key_OnMouseMove(int x, int y, int b); -extern void key_GetMouseMove(int *x, int *y, int *b); -#endif diff --git a/MCUME_pico/picocolem/picocolem.cpp b/MCUME_pico/picocolem/picocolem.cpp index 43f552c..07740b1 100644 --- a/MCUME_pico/picocolem/picocolem.cpp +++ b/MCUME_pico/picocolem/picocolem.cpp @@ -12,11 +12,9 @@ extern "C" { } #include -#ifdef USE_VGA -#include "vga_t_dma.h" -#else -#include "tft_t_dma.h" -#endif +#include +#include "pico_dsp.h" + volatile bool vbl=true; bool repeating_timer_callback(struct repeating_timer *t) { @@ -27,8 +25,8 @@ bool repeating_timer_callback(struct repeating_timer *t) { } return true; } -TFT_T_DMA tft; +PICO_DSP tft; static int skip=0; #include "hardware/clocks.h" @@ -40,87 +38,86 @@ int main(void) { // set_sys_clock_khz(150000, true); // set_sys_clock_khz(133000, true); set_sys_clock_khz(200000, true); +// set_sys_clock_khz(210000, true); +// set_sys_clock_khz(230000, true); // set_sys_clock_khz(225000, true); -// set_sys_clock_khz(240000, true); // set_sys_clock_khz(250000, true); stdio_init_all(); -#ifdef USE_VGA - tft.begin(VGA_MODE_320x240); -#else - tft.begin(); -#endif + emu_init(); - while (true) { + char * filename; +#ifdef FILEBROWSER + while (true) { if (menuActive()) { uint16_t bClick = emu_DebounceLocalKeys(); int action = handleMenu(bClick); - char * filename = menuSelection(); - if (action == ACTION_RUNTFT) { - toggleMenu(false); - emu_start(); - emu_Init(filename); - tft.fillScreenNoDma( RGBVAL16(0x00,0x00,0x00) ); - tft.startDMA(); - struct repeating_timer timer; - add_repeating_timer_ms(25, repeating_timer_callback, NULL, &timer); - } + filename = menuSelection(); + if (action == ACTION_RUN) { + break; + } tft.waitSync(); } - else { - uint16_t bClick = emu_DebounceLocalKeys(); - emu_Input(bClick); - emu_Step(); - } - //int c = getchar_timeout_us(0); - //switch (c) { - // case ' ': - // printf("test: %d\n", 1); - // break; - //} + } +#endif + emu_start(); + emu_Init(filename); + tft.startRefresh(); + struct repeating_timer timer; + add_repeating_timer_ms(25, repeating_timer_callback, NULL, &timer); + while (true) { + uint16_t bClick = emu_DebounceLocalKeys(); + emu_Input(bClick); + emu_Step(); } } -static unsigned char palette8[PALETTE_SIZE]; static unsigned short palette16[PALETTE_SIZE]; - void emu_SetPaletteEntry(unsigned char r, unsigned char g, unsigned char b, int index) { if (index -#include -#include "noftypes.h" -#include "bitmap.h" - -// JMH this file had to be adapted for the ESP - - -#include "emuapi.h" - -void bmp_clear(const bitmap_t *bitmap, uint8 color) -{ - // - //memset(bitmap->data, color, bitmap->pitch * bitmap->height); -} - -static bitmap_t *_make_bitmap(uint8 *data_addr, bool hw, int width, - int height, int pitch, int overdraw) -{ - bitmap_t *bitmap; - int i; - - /* quick safety check */ - if (NULL == data_addr) - return NULL; - - /* Make sure to add in space for line pointers */ - bitmap = emu_Malloc(sizeof(bitmap_t) + (sizeof(uint8 *) * height)); - if (NULL == bitmap) - { - return NULL; - } - bitmap->hardware = hw; - bitmap->height = height; - bitmap->width = width; - bitmap->data = data_addr; - bitmap->pitch = pitch + (overdraw * 2); - - /* Set up line pointers */ - /* we want to make some 32-bit aligned adjustment - ** if we haven't been given a hardware bitmap - */ - //printf("setting up bitmap %d\n",(int)bitmap); - for (i = 0; i < height; i++) { - bitmap->line[i] = emu_LineBuffer(i); - } - - return bitmap; -} - -static char fb[1]; -/* Allocate and initialize a bitmap structure */ -bitmap_t *bmp_create(int width, int height, int overdraw) -{ -// uint8 *addr; -// int pitch; -// -// pitch = width + (overdraw * 2); /* left and right */ -// addr = malloc((pitch * height) + 3); /* add max 32-bit aligned adjustment */ -// if (NULL == addr) -// return NULL; -//printf("bmp_create\n"); - return _make_bitmap((uint8*)fb, false, width, height, width, overdraw); -} - - -/* allocate and initialize a hardware bitmap */ -bitmap_t *bmp_createhw(uint8 *addr, int width, int height, int pitch) -{ - return _make_bitmap(addr, true, width, height, pitch, 0); /* zero overdraw */ -} - -/* Deallocate space for a bitmap structure */ -void bmp_destroy(bitmap_t **bitmap) -{ - if (*bitmap) - { - free(*bitmap); - *bitmap = NULL; - } -} - -/* -** $Log: bitmap.c,v $ -** Revision 1.2 2001/04/27 14:37:11 neil -** wheeee -** -** Revision 1.1.1.1 2001/04/27 07:03:54 neil -** initial -** -** Revision 1.16 2000/11/05 16:37:18 matt -** rolled rgb.h into bitmap.h -** -** Revision 1.15 2000/10/10 13:58:13 matt -** stroustrup squeezing his way in the door -** -** Revision 1.14 2000/09/18 02:06:48 matt -** -pedantic is your friend -** -** Revision 1.13 2000/08/13 13:16:30 matt -** bugfix for alignment adjustment -** -** Revision 1.12 2000/07/24 04:31:43 matt -** pitch/data area on non-hw bitmaps get padded to 32-bit boundaries -** -** Revision 1.11 2000/07/17 01:52:27 matt -** made sure last line of all source files is a newline -** -** Revision 1.10 2000/07/09 14:43:01 matt -** pitch is now configurable for bmp_createhw() -** -** Revision 1.9 2000/07/06 17:55:57 matt -** two big bugs fixed -** -** Revision 1.8 2000/07/06 17:38:11 matt -** replaced missing string.h include -** -** Revision 1.7 2000/07/06 16:46:57 matt -** added bmp_clear() routine -** -** Revision 1.6 2000/06/26 04:56:24 matt -** minor cleanup -** -** Revision 1.5 2000/06/09 15:12:25 matt -** initial revision -** -*/ diff --git a/MCUME_pico/piconofrendo/bitmap.h b/MCUME_pico/piconofrendo/bitmap.h deleted file mode 100644 index 4e3ce7a..0000000 --- a/MCUME_pico/piconofrendo/bitmap.h +++ /dev/null @@ -1,93 +0,0 @@ -/* -** Nofrendo (c) 1998-2000 Matthew Conte (matt@conte.com) -** -** -** This program is free software; you can redistribute it and/or -** modify it under the terms of version 2 of the GNU Library General -** Public License as published by the Free Software Foundation. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** Library General Public License for more details. To obtain a -** copy of the GNU Library General Public License, write to the Free -** Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -** -** Any permitted reproduction of these routines, in whole or in part, -** must bear this legend. -** -** -** bitmap.h -** -** Bitmap object defines / prototypes -** $Id: bitmap.h,v 1.2 2001/04/27 14:37:11 neil Exp $ -*/ - -#ifndef _BITMAP_H_ -#define _BITMAP_H_ - -#include "noftypes.h" - -/* a bitmap rectangle */ -typedef struct rect_s -{ - int16 x, y; - uint16 w, h; -} rect_t; - -typedef struct rgb_s -{ - int r, g, b; -} rgb_t; - -typedef struct bitmap_s -{ - int width, height, pitch; - bool hardware; /* is data a hardware region? */ - uint8 *data; /* protected */ - uint8 *line[ZERO_LENGTH]; /* will hold line pointers */ -} bitmap_t; - -extern void bmp_clear(const bitmap_t *bitmap, uint8 color); -extern bitmap_t *bmp_create(int width, int height, int overdraw); -extern bitmap_t *bmp_createhw(uint8 *addr, int width, int height, int pitch); -extern void bmp_destroy(bitmap_t **bitmap); - -#endif /* _BITMAP_H_ */ - -/* -** $Log: bitmap.h,v $ -** Revision 1.2 2001/04/27 14:37:11 neil -** wheeee -** -** Revision 1.1.1.1 2001/04/27 07:03:54 neil -** initial -** -** Revision 1.12 2000/11/05 16:37:18 matt -** rolled rgb.h into bitmap.h -** -** Revision 1.11 2000/10/10 13:58:13 matt -** stroustrup squeezing his way in the door -** -** Revision 1.10 2000/09/18 02:06:48 matt -** -pedantic is your friend -** -** Revision 1.9 2000/07/31 04:28:46 matt -** one million cleanups -** -** Revision 1.8 2000/07/24 04:31:43 matt -** pitch/data area on non-hw bitmaps get padded to 32-bit boundaries -** -** Revision 1.7 2000/07/17 01:52:27 matt -** made sure last line of all source files is a newline -** -** Revision 1.6 2000/07/09 14:43:01 matt -** pitch is now configurable for bmp_createhw() -** -** Revision 1.5 2000/07/06 16:46:57 matt -** added bmp_clear() routine -** -** Revision 1.4 2000/06/09 15:12:25 matt -** initial revision -** -*/ diff --git a/MCUME_pico/piconofrendo/config.c b/MCUME_pico/piconofrendo/config.c deleted file mode 100644 index 806d41b..0000000 --- a/MCUME_pico/piconofrendo/config.c +++ /dev/null @@ -1,75 +0,0 @@ -/* Nofrendo Configuration Braindead Sample Implementation -** -** $Id: config.c,v 1.2 2001/04/27 14:37:11 neil Exp $ -*/ - -#include -#include -#include -#include - -#include "noftypes.h" -#include "log.h" -#include "osd.h" -#include "nofconfig.h" -#include "version.h" - - -/* interface */ -config_t config = -{ - CONFIG_FILE -}; - -/* -** $Log: config.c,v $ -** Revision 1.2 2001/04/27 14:37:11 neil -** wheeee -** -** Revision 1.1.1.1 2001/04/27 07:03:54 neil -** initial -** -** Revision 1.14 2000/11/05 06:23:10 matt -** realloc was incompatible with memguard -** -** Revision 1.13 2000/10/10 13:58:13 matt -** stroustrup squeezing his way in the door -** -** Revision 1.12 2000/09/20 01:13:28 matt -** damn tabs -** -** Revision 1.11 2000/08/04 12:41:04 neil -** current not a bug -** -** Revision 1.10 2000/07/31 04:28:46 matt -** one million cleanups -** -** Revision 1.9 2000/07/24 04:30:42 matt -** slight cleanup -** -** Revision 1.8 2000/07/23 15:16:08 matt -** changed strcasecmp to stricmp -** -** Revision 1.7 2000/07/19 15:58:55 neil -** config file now configurable (ha) -** -** Revision 1.6 2000/07/18 03:28:32 matt -** help me! I'm a complete mess! -** -** Revision 1.5 2000/07/12 11:03:08 neil -** Always write a config, even if no defaults are changed -** -** Revision 1.4 2000/07/11 15:09:30 matt -** suppressed all warnings -** -** Revision 1.3 2000/07/11 14:59:27 matt -** minor cosmetics.. =) -** -** Revision 1.2 2000/07/11 13:35:38 bsittler -** Changed the config API, implemented config file "nofrendo.cfg". The -** GGI drivers use the group [GGI]. Visual= and Mode= keys are understood. -** -** Revision 1.1 2000/07/11 09:21:10 bsittler -** This is a skeletal configuration system. -** -*/ diff --git a/MCUME_pico/piconofrendo/emuapi.cpp b/MCUME_pico/piconofrendo/emuapi.cpp deleted file mode 100644 index 1bc929b..0000000 --- a/MCUME_pico/piconofrendo/emuapi.cpp +++ /dev/null @@ -1,1311 +0,0 @@ -#define KEYMAP_PRESENT 1 - -#define PROGMEM - -#include "pico.h" -#include "pico/stdlib.h" -#include "hardware/adc.h" -#include -#include - -extern "C" { - #include "emuapi.h" - #include "iopins.h" -} - -static bool emu_writeConfig(void); -static bool emu_readConfig(void); -static bool emu_eraseConfig(void); - - -#if (defined(ILI9341) || defined(ST7789)) && defined(USE_VGA) -// Dual display config, initialize TFT -#include "tft_t_dma.h" -static TFT_T_DMA tft; -#else -// Non Dual display config -#ifdef USE_VGA -#include "vga_t_dma.h" -#else -#include "tft_t_dma.h" -#endif -extern TFT_T_DMA tft; -#endif - - -#define MAX_FILENAME_PATH 64 -#define NB_FILE_HANDLER 4 -#define AUTORUN_FILENAME "autorun.txt" - -#define MAX_FILES 64 -#define MAX_FILENAME_SIZE 24 -#define MAX_MENULINES 9 -#define TEXT_HEIGHT 16 -#define TEXT_WIDTH 8 -#define MENU_FILE_XOFFSET (6*TEXT_WIDTH) -#define MENU_FILE_YOFFSET (2*TEXT_HEIGHT) -#define MENU_FILE_W (MAX_FILENAME_SIZE*TEXT_WIDTH) -#define MENU_FILE_H (MAX_MENULINES*TEXT_HEIGHT) -#define MENU_FILE_BGCOLOR RGBVAL16(0x00,0x00,0x40) -#define MENU_JOYS_YOFFSET (12*TEXT_HEIGHT) -#define MENU_VBAR_XOFFSET (0*TEXT_WIDTH) -#define MENU_VBAR_YOFFSET (MENU_FILE_YOFFSET) - -#define MENU_TFT_XOFFSET (MENU_FILE_XOFFSET+MENU_FILE_W+8) -#define MENU_TFT_YOFFSET (MENU_VBAR_YOFFSET+32) -#define MENU_VGA_XOFFSET (MENU_FILE_XOFFSET+MENU_FILE_W+8) -#define MENU_VGA_YOFFSET (MENU_VBAR_YOFFSET+MENU_FILE_H-32-37) - - - -static int nbFiles=0; -static int curFile=0; -static int topFile=0; -static char selection[MAX_FILENAME_PATH]=""; -static char selected_filename[MAX_FILENAME_SIZE]=""; -static char files[MAX_FILES][MAX_FILENAME_SIZE]; -static bool menuRedraw=true; - -#ifdef PICOMPUTER -static const unsigned short * keys; -static unsigned char keymatrix[6]; -static int keymatrix_hitrow=-1; -static bool key_fn=false; -static bool key_alt=false; -static uint32_t keypress_t_ms=0; -static uint32_t last_t_ms=0; -static uint32_t hundred_ms_cnt=0; -static bool ledflash_toggle=false; -#endif -static int keyMap; - -static bool joySwapped = false; -static uint16_t bLastState; -static int xRef; -static int yRef; -static uint8_t usbnavpad=0; - -static bool menuOn=true; -static bool autorun=false; - - -/******************************** - * Generic output and malloc -********************************/ -void emu_printf(const char * text) -{ - printf("%s\n",text); -} - -void emu_printf(int val) -{ - printf("%d\n",val); -} - -void emu_printi(int val) -{ - printf("%d\n",val); -} - -void emu_printh(int val) -{ - printf("0x%.8\n",val); -} - -static int malbufpt = 0; -static char malbuf[EXTRA_HEAP]; - -void * emu_Malloc(int size) -{ - void * retval = malloc(size); - if (!retval) { - emu_printf("failled to allocate"); - emu_printf(size); - emu_printf("fallback"); - if ( (malbufpt+size) < sizeof(malbuf) ) { - retval = (void *)&malbuf[malbufpt]; - malbufpt += size; - } - else { - emu_printf("failure to allocate"); - } - } - else { - emu_printf("could allocate dynamic "); - emu_printf(size); - } - - return retval; -} - -void * emu_MallocI(int size) -{ - void * retval = NULL; - - if ( (malbufpt+size) < sizeof(malbuf) ) { - retval = (void *)&malbuf[malbufpt]; - malbufpt += size; - emu_printf("could allocate static "); - emu_printf(size); - } - else { - emu_printf("failure to allocate"); - } - - return retval; -} -void emu_Free(void * pt) -{ - free(pt); -} - -void emu_drawText(unsigned short x, unsigned short y, const char * text, unsigned short fgcolor, unsigned short bgcolor, int doublesize) -{ - tft.drawText(x, y, text, fgcolor, bgcolor, doublesize?true:false); -} - - -/******************************** - * OSKB handling -********************************/ -#if (defined(ILI9341) || defined(ST7789)) && defined(USE_VGA) -// On screen keyboard position -#define KXOFF 28 //64 -#define KYOFF 96 -#define KWIDTH 11 //22 -#define KHEIGHT 3 - -static bool oskbOn = false; -static int cxpos = 0; -static int cypos = 0; -static int oskbMap = 0; -static uint16_t oskbBLastState = 0; - -static void lineOSKB2(int kxoff, int kyoff, char * str, int row) -{ - char c[2] = {'A',0}; - const char * cpt = str; - for (int i=0; i.,SP ", 2); - if (oskbMap == 0) { - lineOSKB(KXOFF,KYOFF, keylables_map1_0, 0); - lineOSKB(KXOFF,KYOFF, keylables_map1_1, 1); - lineOSKB(KXOFF,KYOFF, keylables_map1_2, 2); - } - else if (oskbMap == 1) { - lineOSKB(KXOFF,KYOFF, keylables_map2_0, 0); - lineOSKB(KXOFF,KYOFF, keylables_map2_1, 1); - lineOSKB(KXOFF,KYOFF, keylables_map2_2, 2); - } - else { - lineOSKB(KXOFF,KYOFF, keylables_map3_0, 0); - lineOSKB(KXOFF,KYOFF, keylables_map3_1, 1); - lineOSKB(KXOFF,KYOFF, keylables_map3_2, 2); - } -} - -void toggleOskb(bool forceoff) { - if (forceoff) oskbOn=true; - if (oskbOn) { - oskbOn = false; - tft.fillScreenNoDma(RGBVAL16(0x00,0x00,0x00)); - tft.drawTextNoDma(0,32, "Press USER2 to toggle onscreen keyboard.", RGBVAL16(0xff,0xff,0xff), RGBVAL16(0x00,0x00,0x00), true); - } else { - oskbOn = true; - tft.fillScreenNoDma(RGBVAL16(0x00,0x00,0x00)); - tft.drawTextNoDma(0,32, " Press USER2 to exit onscreen keyboard. ", RGBVAL16(0xff,0xff,0xff), RGBVAL16(0x00,0x00,0x00), true); - tft.drawTextNoDma(0,64, " (USER1 to toggle between keymaps) ", RGBVAL16(0x00,0xff,0xff), RGBVAL16(0x00,0x00,0xff), true); - tft.drawRectNoDma(KXOFF,KYOFF, 22*8, 3*16, RGBVAL16(0x00,0x00,0xFF)); - drawOskb(); - } -} - -static int handleOskb(void) -{ - int retval = 0; - - uint16_t bClick = bLastState & ~oskbBLastState; - oskbBLastState = bLastState; - /* - static const char * digits = "0123456789ABCDEF"; - char buf[5] = {0,0,0,0,0}; - int val = bClick; - buf[0] = digits[(val>>12)&0xf]; - buf[1] = digits[(val>>8)&0xf]; - buf[2] = digits[(val>>4)&0xf]; - buf[3] = digits[val&0xf]; - tft.drawTextNoDma(0,KYOFF+ 64,buf,RGBVAL16(0x00,0x00,0x00),RGBVAL16(0xFF,0xFF,0xFF),1); - */ - if (bClick & MASK_KEY_USER2) - { - toggleOskb(false); - } - if (oskbOn) - { - bool updated = true; - if (bClick & MASK_KEY_USER1) - { - oskbMap += 1; - if (oskbMap == 3) oskbMap = 0; - } - else if (bClick & MASK_JOY2_LEFT) - { - cxpos++; - if (cxpos >= KWIDTH) cxpos = 0; - } - else if (bClick & MASK_JOY2_RIGHT) - { - cxpos--; - if (cxpos < 0) cxpos = KWIDTH-1; - } - else if (bClick & MASK_JOY2_DOWN) - { - cypos++; - if (cypos >= KHEIGHT) cypos = 0; - } - else if (bClick & MASK_JOY2_UP) - { - cypos--; - if (cypos < 0) cypos = KHEIGHT-1; - } - else if (oskbBLastState & MASK_JOY2_BTN) - { - retval = cypos*KWIDTH+cxpos+1; - if (retval) { - retval--; - //if (retval & 1) retval = key_map2[retval>>1]; - //else retval = key_map1[retval>>1]; - if (oskbMap == 0) { - retval = key_map1[retval]; - } - else if (oskbMap == 1) { - retval = key_map2[retval]; - } - else { - retval = key_map3[retval]; - } - //if (retval) { toggleOskb(true); updated=false; }; - } - } - else { - updated=false; - } - if (updated) drawOskb(); - } - - return retval; -} -#endif - -/******************************** - * Input and keyboard -********************************/ -int emu_ReadAnalogJoyX(int min, int max) -{ - adc_select_input(0); - int val = adc_read(); -#if INVX - val = 4095 - val; -#endif - val = val-xRef; - val = ((val*140)/100); - if ( (val > -512) && (val < 512) ) val = 0; - val = val+2048; - return (val*(max-min))/4096; -} - -int emu_ReadAnalogJoyY(int min, int max) -{ - adc_select_input(1); - int val = adc_read(); -#if INVY - val = 4095 - val; -#endif - val = val-yRef; - val = ((val*120)/100); - if ( (val > -512) && (val < 512) ) val = 0; - //val = (val*(max-min))/4096; - val = val+2048; - //return val+(max-min)/2; - return (val*(max-min))/4096; -} - - -static uint16_t readAnalogJoystick(void) -{ - uint16_t joysval = 0; -#ifdef PIN_JOY2_A1X - int xReading = emu_ReadAnalogJoyX(0,256); - if (xReading > 128) joysval |= MASK_JOY2_LEFT; - else if (xReading < 128) joysval |= MASK_JOY2_RIGHT; - - int yReading = emu_ReadAnalogJoyY(0,256); - if (yReading < 128) joysval |= MASK_JOY2_UP; - else if (yReading > 128) joysval |= MASK_JOY2_DOWN; -#endif - // First joystick -#if INVY -#ifdef PIN_JOY2_1 - if ( !gpio_get(PIN_JOY2_1) ) joysval |= MASK_JOY2_DOWN; -#endif -#ifdef PIN_JOY2_2 - if ( !gpio_get(PIN_JOY2_2) ) joysval |= MASK_JOY2_UP; -#endif -#else -#ifdef PIN_JOY2_1 - if ( !gpio_get(PIN_JOY2_1) ) joysval |= MASK_JOY2_UP; -#endif -#ifdef PIN_JOY2_2 - if ( !gpio_get(PIN_JOY2_2) ) joysval |= MASK_JOY2_DOWN; -#endif -#endif -#if INVX -#ifdef PIN_JOY2_3 - if ( !gpio_get(PIN_JOY2_3) ) joysval |= MASK_JOY2_LEFT; -#endif -#ifdef PIN_JOY2_4 - if ( !gpio_get(PIN_JOY2_4) ) joysval |= MASK_JOY2_RIGHT; -#endif -#else -#ifdef PIN_JOY2_3 - if ( !gpio_get(PIN_JOY2_3) ) joysval |= MASK_JOY2_RIGHT; -#endif -#ifdef PIN_JOY2_4 - if ( !gpio_get(PIN_JOY2_4) ) joysval |= MASK_JOY2_LEFT; -#endif -#endif -#ifdef PIN_JOY2_BTN - joysval |= (gpio_get(PIN_JOY2_BTN) ? 0 : MASK_JOY2_BTN); -#endif - - return (joysval); -} - - -int emu_SwapJoysticks(int statusOnly) { - if (!statusOnly) { - if (joySwapped) { - joySwapped = false; - } - else { - joySwapped = true; - } - } - return(joySwapped?1:0); -} - -int emu_GetPad(void) -{ - return(bLastState/*|((joySwapped?1:0)<<7)*/); -} - -int emu_ReadKeys(void) -{ - uint16_t retval; - uint16_t j1 = readAnalogJoystick(); - uint16_t j2 = 0; - - // Second joystick -#if INVY -#ifdef PIN_JOY1_1 - if ( !gpio_get(PIN_JOY1_1) ) j2 |= MASK_JOY2_DOWN; -#endif -#ifdef PIN_JOY1_2 - if ( !gpio_get(PIN_JOY1_2) ) j2 |= MASK_JOY2_UP; -#endif -#else -#ifdef PIN_JOY1_1 - if ( !gpio_get(PIN_JOY1_1) ) j2 |= MASK_JOY2_UP; -#endif -#ifdef PIN_JOY1_2 - if ( !gpio_get(PIN_JOY1_2) ) j2 |= MASK_JOY2_DOWN; -#endif -#endif -#if INVX -#ifdef PIN_JOY1_3 - if ( !gpio_get(PIN_JOY1_3) ) j2 |= MASK_JOY2_LEFT; -#endif -#ifdef PIN_JOY1_4 - if ( !gpio_get(PIN_JOY1_4) ) j2 |= MASK_JOY2_RIGHT; -#endif -#else -#ifdef PIN_JOY1_3 - if ( !gpio_get(PIN_JOY1_3) ) j2 |= MASK_JOY2_RIGHT; -#endif -#ifdef PIN_JOY1_4 - if ( !gpio_get(PIN_JOY1_4) ) j2 |= MASK_JOY2_LEFT; -#endif -#endif -#ifdef PIN_JOY1_BTN - if ( !gpio_get(PIN_JOY1_BTN) ) j2 |= MASK_JOY2_BTN; -#endif - - - if (joySwapped) { - retval = ((j1 << 8) | j2); - } - else { - retval = ((j2 << 8) | j1); - } - - if (usbnavpad & MASK_JOY2_UP) retval |= MASK_JOY2_UP; - if (usbnavpad & MASK_JOY2_DOWN) retval |= MASK_JOY2_DOWN; - if (usbnavpad & MASK_JOY2_LEFT) retval |= MASK_JOY2_LEFT; - if (usbnavpad & MASK_JOY2_RIGHT) retval |= MASK_JOY2_RIGHT; - if (usbnavpad & MASK_JOY2_BTN) retval |= MASK_JOY2_BTN; - -#ifdef PIN_KEY_USER1 - if ( !gpio_get(PIN_KEY_USER1) ) retval |= MASK_KEY_USER1; -#endif -#ifdef PIN_KEY_USER2 - if ( !gpio_get(PIN_KEY_USER2) ) retval |= MASK_KEY_USER2; -#endif -#ifdef PIN_KEY_USER3 - if ( !gpio_get(PIN_KEY_USER3) ) retval |= MASK_KEY_USER3; -#endif -#ifdef PIN_KEY_USER4 - if ( !gpio_get(PIN_KEY_USER4) ) retval |= MASK_KEY_USER4; -#endif - -#ifdef PICOMPUTER - keymatrix_hitrow = -1; - unsigned char row; - unsigned short cols[6]={KCOLOUT1,KCOLOUT2,KCOLOUT3,KCOLOUT4,KCOLOUT5,KCOLOUT6}; - unsigned char keymatrixtmp[6]; - - for (int i=0;i<6;i++){ - gpio_set_dir(cols[i], GPIO_OUT); - gpio_put(cols[i], 0); -#ifdef SWAP_ALT_DEL - sleep_us(1); - //__asm volatile ("nop\n"); // 4-8ns -#endif - row=0; - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN4) ? 0 : 0x02); - row |= (gpio_get(KROWIN1) ? 0 : 0x04); - row |= (gpio_get(KROWIN3) ? 0 : 0x08); - row |= (gpio_get(KROWIN5) ? 0 : 0x10); - row |= (gpio_get(KROWIN6) ? 0 : 0x20); - //gpio_set_dir(cols[i], GPIO_OUT); - gpio_put(cols[i], 1); - gpio_set_dir(cols[i], GPIO_IN); - gpio_disable_pulls(cols[i]); - keymatrixtmp[i] = row; - } - -#ifdef MULTI_DEBOUNCE - for (int i=0;i<6;i++){ - gpio_set_dir(cols[i], GPIO_OUT); - gpio_put(cols[i], 0); -#ifdef SWAP_ALT_DEL - sleep_us(1); - //__asm volatile ("nop\n"); // 4-8ns -#endif - row=0; - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN4) ? 0 : 0x02); - row |= (gpio_get(KROWIN1) ? 0 : 0x04); - row |= (gpio_get(KROWIN3) ? 0 : 0x08); - row |= (gpio_get(KROWIN5) ? 0 : 0x10); - row |= (gpio_get(KROWIN6) ? 0 : 0x20); - //gpio_set_dir(cols[i], GPIO_OUT); - gpio_put(cols[i], 1); - gpio_set_dir(cols[i], GPIO_IN); - gpio_disable_pulls(cols[i]); - keymatrixtmp[i] |= row; - } - - for (int i=0;i<6;i++){ - gpio_set_dir(cols[i], GPIO_OUT); - gpio_put(cols[i], 0); -#ifdef SWAP_ALT_DEL - sleep_us(1); - //__asm volatile ("nop\n"); // 4-8ns -#endif - row=0; - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN4) ? 0 : 0x02); - row |= (gpio_get(KROWIN1) ? 0 : 0x04); - row |= (gpio_get(KROWIN3) ? 0 : 0x08); - row |= (gpio_get(KROWIN5) ? 0 : 0x10); - row |= (gpio_get(KROWIN6) ? 0 : 0x20); - //gpio_set_dir(cols[i], GPIO_OUT); - gpio_put(cols[i], 1); - gpio_set_dir(cols[i], GPIO_IN); - gpio_disable_pulls(cols[i]); - keymatrixtmp[i] |= row; - } -#endif - -#ifdef SWAP_ALT_DEL - // Swap ALT and DEL - unsigned char alt = keymatrixtmp[0] & 0x02; - unsigned char del = keymatrixtmp[5] & 0x20; - keymatrixtmp[0] &= ~0x02; - keymatrixtmp[5] &= ~0x20; - if (alt) keymatrixtmp[5] |= 0x20; - if (del) keymatrixtmp[0] |= 0x02; -#endif - - bool alt_pressed=false; - if ( keymatrixtmp[5] & 0x20 ) {alt_pressed=true; keymatrixtmp[5] &= ~0x20;}; - - for (int i=0;i<6;i++){ - row = keymatrixtmp[i]; - if (row) keymatrix_hitrow=i; - keymatrix[i] = row; - } - - //6,9,15,8,7,22 -#if INVX - if ( row & 0x2 ) retval |= MASK_JOY2_LEFT; - if ( row & 0x1 ) retval |= MASK_JOY2_RIGHT; -#else - if ( row & 0x1 ) retval |= MASK_JOY2_LEFT; - if ( row & 0x2 ) retval |= MASK_JOY2_RIGHT; -#endif -#if INVY - if ( row & 0x8 ) retval |= MASK_JOY2_DOWN; - if ( row & 0x4 ) retval |= MASK_JOY2_UP; -#else - if ( row & 0x4 ) retval |= MASK_JOY2_DOWN; - if ( row & 0x8 ) retval |= MASK_JOY2_UP; -#endif - if ( row & 0x10 ) retval |= MASK_JOY2_BTN; - - // Handle LED flash - uint32_t time_ms=to_ms_since_boot (get_absolute_time()); - if ((time_ms-last_t_ms) > 100) { - last_t_ms = time_ms; - if (ledflash_toggle == false) { - ledflash_toggle = true; - } - else { - ledflash_toggle = false; - } - } - - if ( alt_pressed ) { - if (key_fn == false) - { - // Release to Press transition - if (hundred_ms_cnt == 0) { - keypress_t_ms=time_ms; - hundred_ms_cnt += 1; // 1 - } - else { - hundred_ms_cnt += 1; // 2 - if (hundred_ms_cnt >= 2) - { - hundred_ms_cnt = 0; - /* - if ( (time_ms-keypress_t_ms) < 500) - { - if (key_alt == false) - { - key_alt = true; - } - else - { - key_alt = false; - } - } - */ - } - } - } - else { - // Keep press - if (hundred_ms_cnt == 1) { - if ((to_ms_since_boot (get_absolute_time())-keypress_t_ms) > 2000) - { - if (key_alt == false) - { - key_alt = true; - } - else - { - key_alt = false; - } - hundred_ms_cnt = 0; - } - } - } - key_fn = true; - } - else { - key_fn = false; - } - - // Handle LED - if (key_alt == true) { - gpio_put(KLED, (ledflash_toggle?1:0)); - } - else { - if (key_fn == true) { - gpio_put(KLED, 1); - } - else { - gpio_put(KLED, 0); - } - } - - if ( key_fn ) retval |= MASK_KEY_USER2; - if ( ( key_fn ) && (keymatrix[0] == 0x02 )) retval |= MASK_KEY_USER1; -#endif - - //Serial.println(retval,HEX); - - if ( ((retval & (MASK_KEY_USER1+MASK_KEY_USER2)) == (MASK_KEY_USER1+MASK_KEY_USER2)) - || (retval & MASK_KEY_USER4 ) ) - { - } - -#if (defined(ILI9341) || defined(ST7789)) && defined(USE_VGA) - if (oskbOn) { - retval |= MASK_OSKB; - } -#endif - - return (retval); -} - -unsigned short emu_DebounceLocalKeys(void) -{ - uint16_t bCurState = emu_ReadKeys(); - uint16_t bClick = bCurState & ~bLastState; - bLastState = bCurState; - - return (bClick); -} - -int emu_ReadI2CKeyboard(void) { - int retval=0; -#ifdef PICOMPUTER - if (key_alt) { - keys = (const unsigned short *)key_map3; - } - else if (key_fn) { - keys = (const unsigned short *)key_map2; - } - else { - keys = (const unsigned short *)key_map1; - } - if (keymatrix_hitrow >=0 ) { - unsigned short match = ((unsigned short)keymatrix_hitrow<<8) | keymatrix[keymatrix_hitrow]; - for (int i=0; i=0) { - menuRedraw=true; - curFile -= 9; - } else if (curFile!=0) { - menuRedraw=true; - curFile--; - } - } - else if ( (bClick & MASK_JOY2_DOWN) || (bClick & MASK_JOY1_DOWN) ) { - if ((curFile<(nbFiles-1)) && (nbFiles)) { - curFile++; - menuRedraw=true; - } - } - else if ( (bClick & MASK_JOY2_LEFT) || (bClick & MASK_JOY1_LEFT) ) { - if ((curFile<(nbFiles-9)) && (nbFiles)) { - curFile += 9; - menuRedraw=true; - } - else if ((curFile<(nbFiles-1)) && (nbFiles)) { - curFile++; - menuRedraw=true; - } - } - else if ( (bClick & MASK_KEY_USER2) ) { - emu_SwapJoysticks(0); - menuRedraw=true; - } - - if (menuRedraw && nbFiles) { - int fileIndex = 0; - tft.drawRectNoDma(MENU_FILE_XOFFSET,MENU_FILE_YOFFSET, MENU_FILE_W, MENU_FILE_H, MENU_FILE_BGCOLOR); -// if (curFile <= (MAX_MENULINES/2-1)) topFile=0; -// else topFile=curFile-(MAX_MENULINES/2); - if (curFile <= (MAX_MENULINES-1)) topFile=0; - else topFile=curFile-(MAX_MENULINES/2); - - int i=0; - while (i=nbFiles) { - // no more files - break; - } - char * filename = &files[fileIndex][0]; - if (fileIndex >= topFile) { - if ((i+topFile) < nbFiles ) { - if ((i+topFile)==curFile) { - tft.drawTextNoDma(MENU_FILE_XOFFSET,i*TEXT_HEIGHT+MENU_FILE_YOFFSET, filename, RGBVAL16(0xff,0xff,0x00), RGBVAL16(0xff,0x00,0x00), true); - strcpy(selected_filename,filename); - } - else { - tft.drawTextNoDma(MENU_FILE_XOFFSET,i*TEXT_HEIGHT+MENU_FILE_YOFFSET, filename, RGBVAL16(0xff,0xff,0xff), MENU_FILE_BGCOLOR, true); - } - } - i++; - } - fileIndex++; - } - - - tft.drawTextNoDma(48,MENU_JOYS_YOFFSET+8, (emu_SwapJoysticks(1)?(char*)"SWAP=1":(char*)"SWAP=0"), RGBVAL16(0x00,0xff,0xff), RGBVAL16(0x00,0x00,0xff), false); - menuRedraw=false; - } - - return (action); -} - -bool menuActive(void) -{ - return (menuOn); -} - -void toggleMenu(bool on) { - if (on) { - menuOn = true; - backgroundMenu(); - } else { - menuOn = false; - } -} - -char * menuSelection(void) -{ - return (selection); -} - - -/******************************** - * File IO -********************************/ -int emu_FileOpen(const char * filepath, const char * mode) -{ - int retval = 0; - - emu_printf("FileOpen..."); - emu_printf(filepath); - if( !(f_open(&file, filepath, FA_READ)) ) { - retval = 1; - } - else { - emu_printf("FileOpen failed"); - } - return (retval); -} - -int emu_FileRead(void * buf, int size, int handler) -{ - unsigned int retval=0; - f_read (&file, (void*)buf, size, &retval); - return retval; -} - -int emu_FileGetc(int handler) -{ - unsigned char c; - unsigned int retval=0; - if( !(f_read (&file, &c, 1, &retval)) ) - if (retval != 1) { - emu_printf("emu_FileGetc failed"); - } - return (int)c; -} - -void emu_FileClose(int handler) -{ - f_close(&file); -} - -int emu_FileSeek(int handler, int seek, int origin) -{ - f_lseek(&file, seek); - return (seek); -} - -int emu_FileTell(int handler) -{ - return (f_tell(&file)); -} - - -unsigned int emu_FileSize(const char * filepath) -{ - int filesize=0; - emu_printf("FileSize..."); - emu_printf(filepath); - FILINFO entry; - f_stat(filepath, &entry); - filesize = entry.fsize; - return(filesize); -} - -unsigned int emu_LoadFile(const char * filepath, void * buf, int size) -{ - int filesize = 0; - - emu_printf("LoadFile..."); - emu_printf(filepath); - if( !(f_open(&file, filepath, FA_READ)) ) { - filesize = f_size(&file); - emu_printf(filesize); - if (size >= filesize) - { - unsigned int retval=0; - if( (f_read (&file, buf, filesize, &retval)) ) { - emu_printf("File read failed"); - } - } - f_close(&file); - } - - return(filesize); -} - -static FIL outfile; - -static bool emu_writeConfig(void) -{ - bool retval = false; - if( !(f_open(&outfile, ROMSDIR "/" AUTORUN_FILENAME, FA_CREATE_NEW | FA_WRITE)) ) { - unsigned int sizeread=0; - if( (f_write (&outfile, selection, strlen(selection), &sizeread)) ) { - emu_printf("Config write failed"); - } - else { - retval = true; - } - f_close(&outfile); - } - return retval; -} - -static bool emu_readConfig(void) -{ - bool retval = false; - if( !(f_open(&outfile, ROMSDIR "/" AUTORUN_FILENAME, FA_READ)) ) { - unsigned int filesize = f_size(&outfile); - unsigned int sizeread=0; - if( (f_read (&outfile, selection, filesize, &sizeread)) ) { - emu_printf("Config read failed"); - } - else { - if (sizeread == filesize) { - selection[filesize]=0; - retval = true; - } - } - f_close(&outfile); - } - return retval; -} - -static bool emu_eraseConfig(void) -{ - f_unlink (ROMSDIR "/" AUTORUN_FILENAME); -} - - -/******************************** - * Initialization -********************************/ -void emu_init(void) -{ - // Dual display config, initialize TFT -#if (defined(ILI9341) || defined(ST7789)) && defined(USE_VGA) - tft.begin(); -#endif - - sd_init_driver(); - FRESULT fr = f_mount(&fatfs, "0:", 1); - - strcpy(selection,ROMSDIR); - nbFiles = readNbFiles(selection); - - emu_printf("SD initialized, files found: "); - emu_printi(nbFiles); - - emu_InitJoysticks(); -#ifdef SWAP_JOYSTICK - joySwapped = true; -#else - joySwapped = false; -#endif - - int keypressed = emu_ReadKeys(); -#ifdef PICOMPUTER - // Flip screen if UP pressed - if (keypressed & MASK_JOY2_UP) - { -#ifdef PICOMPUTERMAX -#ifndef USE_VGA - tft.flipscreen(true); -#endif -#else - tft.flipscreen(true); -#endif - } - else - { -#ifdef PICOMPUTERMAX -#ifndef USE_VGA - tft.flipscreen(false); -#endif -#else - tft.flipscreen(false); -#endif - } -#endif - - if (keypressed & MASK_JOY2_DOWN) { - tft.fillScreenNoDma( RGBVAL16(0xff,0x00,0x00) ); - tft.drawTextNoDma(64,48, (char*)" AUTURUN file erased", RGBVAL16(0xff,0xff,0x00), RGBVAL16(0xff,0x00,0x00), true); - tft.drawTextNoDma(64,48+24, (char*)"Please reset the board!", RGBVAL16(0xff,0xff,0x00), RGBVAL16(0xff,0x00,0x00), true); - emu_eraseConfig(); - } - else { - if (emu_readConfig()) { - autorun = true; - } - } - toggleMenu(true); -} - - -void emu_start(void) -{ - usbnavpad = 0; - - keyMap = 0; -} diff --git a/MCUME_pico/piconofrendo/emuapi.h b/MCUME_pico/piconofrendo/emuapi.h deleted file mode 100644 index 4ea812a..0000000 --- a/MCUME_pico/piconofrendo/emuapi.h +++ /dev/null @@ -1,145 +0,0 @@ -#ifndef EMUAPI_H -#define EMUAPI_H - -#include "platform_config.h" - -#define CUSTOM_SND 1 -//#define TIMER_REND 1 - -#define EXTRA_HEAP 0x10 - -// Title: < > -#define TITLE " NES Emulator" -#define ROMSDIR "nes" - -#define emu_Init(ROM) {nes_Start(ROM); nes_Init(); } -#define emu_Step(x) { nes_Step(); } -#define emu_Input(x) {} - -#define PALETTE_SIZE 256 -#define VID_FRAME_SKIP 0x0 -#define TFT_VBUFFER_YCROP 0 -#define SINGLELINE_RENDERING 1 - -#define ACTION_NONE 0 -#define ACTION_MAXKBDVAL 12 -#define ACTION_EXITKBD 128 -#define ACTION_RUNTFT 129 -#define ACTION_RUNVGA 130 - - -#ifdef KEYMAP_PRESENT - -#define keylables_map1_0 (char *)"12 " -#define keylables_map1_1 (char *)" " -#define keylables_map1_2 (char *)" " -const unsigned short key_map1[] = { - 2,3,0,0,0,0,0,0,0,0, 0, - 0, 0,0,0,0,0,0,0,0,0,0, - 0, 0,0,0,0,0,0,0,0,0, // not usable except last ones - 0,0,0,0 - }; - -#define keylables_map2_0 (char *)" " -#define keylables_map2_1 (char *)" " -#define keylables_map2_2 (char *)" " -const unsigned short key_map2[] = { - 0,0,0,0,0,0,0,0,0,0, 0, - 0, 0,0,0,0,0,0,0,0,0,0, - 0, 0,0,0,0,0,0,0,0,0, // not usable except last ones - 0,0,0,0 - }; - - -#define keylables_map3_0 (char *)" " -#define keylables_map3_1 (char *)" " -#define keylables_map3_2 (char *)" " -const unsigned short key_map3[] = { - 0,0,0,0,0,0,0,0,0,0,0, // function keys - 0, 0,0,0,0,0,0,0,0,0,0, - 0, 0,0,0,0,0,0,0,0,0, - 0,0,0,0 - }; - -const unsigned short matkeys[] = { - 0x020,0x120,0x220,0x320,0x420,0x408,0x308,0x208,0x108,0x008,0x002, // row 1 - 0x510,0x010,0x110,0x210,0x310,0x410,0x401,0x301,0x201,0x101,0x001, // row 2 - 0x520,0x102,0x202,0x302,0x402,0x404,0x304,0x204,0x104,0x004, // row 3 - 0x508,0x501,0x502,0x504 }; // cursor keys - -#endif - - - -#define MASK_JOY2_RIGHT 0x0001 -#define MASK_JOY2_LEFT 0x0002 -#define MASK_JOY2_UP 0x0004 -#define MASK_JOY2_DOWN 0x0008 -#define MASK_JOY2_BTN 0x0010 -#define MASK_KEY_USER1 0x0020 -#define MASK_KEY_USER2 0x0040 -#define MASK_KEY_USER3 0x0080 -#define MASK_JOY1_RIGHT 0x0100 -#define MASK_JOY1_LEFT 0x0200 -#define MASK_JOY1_UP 0x0400 -#define MASK_JOY1_DOWN 0x0800 -#define MASK_JOY1_BTN 0x1000 -#define MASK_KEY_USER4 0x2000 -#define MASK_OSKB 0x8000 - - -extern void emu_init(void); -extern void emu_start(void); -extern void emu_resetSD(void); - -extern void emu_printf(const char * text); -extern void emu_printi(int val); -extern void * emu_Malloc(int size); -extern void emu_Free(void * pt); - -extern int emu_FileOpen(const char * filepath, const char * mode); -extern int emu_FileRead(void * buf, int size, int handler); -extern int emu_FileGetc(int handler); -extern int emu_FileSeek(int handler, int seek, int origin); -extern int emu_FileTell(int handler); -extern void emu_FileClose(int handler); - -extern unsigned int emu_FileSize(const char * filepath); -extern unsigned int emu_LoadFile(const char * filepath, void * buf, int size); - -extern void emu_SetPaletteEntry(unsigned char r, unsigned char g, unsigned char b, int index); -extern void emu_DrawScreen(unsigned char * VBuf, int width, int height, int stride); -extern void emu_DrawLine(unsigned char * VBuf, int width, int height, int line); -extern void emu_DrawLine8(unsigned char * VBuf, int width, int height, int line); -extern void emu_DrawLine16(unsigned short * VBuf, int width, int height, int line); -extern void emu_DrawVsync(void); -extern int emu_FrameSkip(void); -extern void * emu_LineBuffer(int line); - -extern void emu_InitJoysticks(void); -extern int emu_SwapJoysticks(int statusOnly); -extern unsigned short emu_DebounceLocalKeys(void); -extern int emu_ReadKeys(void); -extern int emu_GetPad(void); -extern int emu_ReadAnalogJoyX(int min, int max); -extern int emu_ReadAnalogJoyY(int min, int max); -extern int emu_ReadI2CKeyboard(void); -extern void emu_KeyboardOnUp(int keymodifer, int key); -extern void emu_KeyboardOnDown(int keymodifer, int key); - -extern void emu_sndPlaySound(int chan, int volume, int freq); -extern void emu_sndPlayBuzz(int size, int val); -extern void emu_sndInit(); -extern void emu_resetus(void); -extern int emu_us(void); - -extern int emu_setKeymap(int index); - -extern void emu_FileTempInit(void); -extern void emu_FileTempRead(int addr, unsigned char * val, int n); -extern void emu_FileTempWrite(int addr, unsigned char val); -extern void emu_printh(int val); - - - -#endif diff --git a/MCUME_pico/piconofrendo/event.c b/MCUME_pico/piconofrendo/event.c deleted file mode 100644 index a6f8dcb..0000000 --- a/MCUME_pico/piconofrendo/event.c +++ /dev/null @@ -1,324 +0,0 @@ -/* -** Nofrendo (c) 1998-2000 Matthew Conte (matt@conte.com) -** -** -** This program is free software; you can redistribute it and/or -** modify it under the terms of version 2 of the GNU Library General -** Public License as published by the Free Software Foundation. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** Library General Public License for more details. To obtain a -** copy of the GNU Library General Public License, write to the Free -** Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -** -** Any permitted reproduction of these routines, in whole or in part, -** must bear this legend. -** -** -** event.c -** -** OS-independent event handling -** $Id: event.c,v 1.3 2001/04/27 14:37:11 neil Exp $ -*/ - -#include -#include "noftypes.h" -#include "event.h" -#include "nesinput.h" - - - -/* pointer to our current system's event handler table */ -static event_t *system_events = NULL; - -/* standard keyboard input */ -static nesinput_t kb_input = { INP_JOYPAD0, 0 }; -static nesinput_t kb_alt_input = { INP_JOYPAD1, 0 }; - - - -static void func_event_joypad1_a(int code) -{ - input_event(&kb_input, code, INP_PAD_A); -} - -static void func_event_joypad1_b(int code) -{ - input_event(&kb_input, code, INP_PAD_B); -} - -static void func_event_joypad1_start(int code) -{ - input_event(&kb_input, code, INP_PAD_START); -} - -static void func_event_joypad1_select(int code) -{ - input_event(&kb_input, code, INP_PAD_SELECT); -} - -static void func_event_joypad1_up(int code) -{ - input_event(&kb_input, code, INP_PAD_UP); -} - -static void func_event_joypad1_down(int code) -{ - input_event(&kb_input, code, INP_PAD_DOWN); -} - -static void func_event_joypad1_left(int code) -{ - input_event(&kb_input, code, INP_PAD_LEFT); -} - -static void func_event_joypad1_right(int code) -{ - input_event(&kb_input, code, INP_PAD_RIGHT); -} - -static void func_event_joypad2_a(int code) -{ - input_event(&kb_alt_input, code, INP_PAD_A); -} - -static void func_event_joypad2_b(int code) -{ - input_event(&kb_alt_input, code, INP_PAD_B); -} - -static void func_event_joypad2_start(int code) -{ - input_event(&kb_alt_input, code, INP_PAD_START); -} - -static void func_event_joypad2_select(int code) -{ - input_event(&kb_alt_input, code, INP_PAD_SELECT); -} - -static void func_event_joypad2_up(int code) -{ - input_event(&kb_alt_input, code, INP_PAD_UP); -} - -static void func_event_joypad2_down(int code) -{ - input_event(&kb_alt_input, code, INP_PAD_DOWN); -} - -static void func_event_joypad2_left(int code) -{ - input_event(&kb_alt_input, code, INP_PAD_LEFT); -} - -static void func_event_joypad2_right(int code) -{ - input_event(&kb_alt_input, code, INP_PAD_RIGHT); -} - - - -/* NES events */ -static const event_t nes_events[] = -{ - NULL, /* 0 */ - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - /* saves */ - NULL, - NULL, /* 10 */ - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, /* 20 */ - /* GUI */ - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - /* sound */ - NULL, - NULL, /* 30 */ - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - /* picture */ - NULL, - NULL, - NULL, - NULL, /* 40 */ - NULL, - NULL, - NULL, - /* joypad 1 */ - func_event_joypad1_a, - func_event_joypad1_b, - func_event_joypad1_start, - func_event_joypad1_select, - func_event_joypad1_up, - func_event_joypad1_down, - func_event_joypad1_left, /* 50 */ - func_event_joypad1_right, - /* joypad 2 */ - func_event_joypad2_a, - func_event_joypad2_b, - func_event_joypad2_start, - func_event_joypad2_select, - func_event_joypad2_up, - func_event_joypad2_down, - func_event_joypad2_left, - func_event_joypad2_right, - /* NSF control */ - NULL, /* 60 */ - NULL, - NULL, - /* OS-specific */ - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, /* 70 */ - NULL, - /* last */ - NULL -}; -static event_t *event_system_table[NUM_SUPPORTED_SYSTEMS] = -{ - NULL, /* unknown */ - NULL, /* autodetect */ - nes_events, /* nes */ -}; - - - -void event_init(void) -{ - input_register(&kb_input); - input_register(&kb_alt_input); -} - -/* set up the event system for a certain console/system type */ -void event_set_system(system_t type) -{ - ASSERT(type < NUM_SUPPORTED_SYSTEMS); - - system_events = event_system_table[type]; -} - -void event_set(int index, event_t handler) -{ - /* now, event_set is used to set osd-specific events. We should assume - ** (for now, at least) that these events should be used across all - ** emulated systems, so let's loop through all system event handler - ** tables and add this event... - */ - int i; - - for (i = 0; i < NUM_SUPPORTED_SYSTEMS; i++) - { - if(event_system_table[i]) - { - event_system_table[i][index] = handler; - } - } -} - - -event_t event_get(int index) -{ - return system_events[index]; -} - - -/* -** $Log: event.c,v $ -** Revision 1.3 2001/04/27 14:37:11 neil -** wheeee -** -** Revision 1.2 2001/04/27 11:10:08 neil -** compile -** -** Revision 1.1.1.1 2001/04/27 07:03:54 neil -** initial -** -** Revision 1.18 2000/11/25 20:26:05 matt -** removed fds "system" -** -** Revision 1.17 2000/11/09 14:05:42 matt -** state load fixed, state save mostly fixed -** -** Revision 1.16 2000/11/05 16:37:18 matt -** rolled rgb.h into bitmap.h -** -** Revision 1.15 2000/11/01 17:33:26 neil -** little crash bugs fixed -** -** Revision 1.14 2000/11/01 14:15:35 matt -** multi-system event system, or whatever -** -** Revision 1.13 2000/10/27 12:59:48 matt -** api change for ppu palette functions -** -** Revision 1.12 2000/10/26 22:48:05 matt -** no need for extern -** -** Revision 1.11 2000/10/25 00:23:16 matt -** makefiles updated for new directory structure -** -** Revision 1.10 2000/10/23 17:50:46 matt -** adding fds support -** -** Revision 1.9 2000/10/23 15:52:04 matt -** better system handling -** -** Revision 1.8 2000/10/22 15:01:51 matt -** prevented palette changing in VS unisystem games -** -** Revision 1.7 2000/10/10 13:03:54 matt -** Mr. Clean makes a guest appearance -** -** Revision 1.6 2000/08/16 02:58:34 matt -** random cleanups -** -** Revision 1.5 2000/07/27 01:15:33 matt -** name changes -** -** Revision 1.4 2000/07/26 21:36:13 neil -** Big honkin' change -- see the mailing list -** -** Revision 1.3 2000/07/23 15:17:19 matt -** non-osd calls moved from osd.c to gui.c -** -** Revision 1.2 2000/07/21 12:07:40 neil -** added room in event_array for all osd events -** -** Revision 1.1 2000/07/21 04:26:38 matt -** initial revision -** -*/ diff --git a/MCUME_pico/piconofrendo/event.h b/MCUME_pico/piconofrendo/event.h deleted file mode 100755 index 9710412..0000000 --- a/MCUME_pico/piconofrendo/event.h +++ /dev/null @@ -1,154 +0,0 @@ -/* vim: set tabstop=3 expandtab: -** -** Nofrendo (c) 1998-2000 Matthew Conte (matt@conte.com) -** -** -** This program is free software; you can redistribute it and/or -** modify it under the terms of version 2 of the GNU Library General -** Public License as published by the Free Software Foundation. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** Library General Public License for more details. To obtain a -** copy of the GNU Library General Public License, write to the Free -** Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -** -** Any permitted reproduction of these routines, in whole or in part, -** must bear this legend. -** -** -** event.h -** -** OS-independent event handling -** $Id: event.h,v 1.2 2001/04/27 14:37:11 neil Exp $ -*/ - -#ifndef _EVENT_H_ -#define _EVENT_H_ - -#include "nofrendo.h" - -enum -{ - event_none = 0, - event_quit, - event_insert, - event_eject, - event_togglepause, - event_soft_reset, - event_hard_reset, - event_snapshot, - event_toggle_frameskip, - /* saves */ - event_state_save, - event_state_load, - event_state_slot_0, - event_state_slot_1, - event_state_slot_2, - event_state_slot_3, - event_state_slot_4, - event_state_slot_5, - event_state_slot_6, - event_state_slot_7, - event_state_slot_8, - event_state_slot_9, - /* GUI */ - event_gui_toggle_oam, - event_gui_toggle_wave, - event_gui_toggle_pattern, - event_gui_pattern_color_up, - event_gui_pattern_color_down, - event_gui_toggle_fps, - event_gui_display_info, - event_gui_toggle, - /* sound */ - event_toggle_channel_0, - event_toggle_channel_1, - event_toggle_channel_2, - event_toggle_channel_3, - event_toggle_channel_4, - event_toggle_channel_5, - event_set_filter_0, - event_set_filter_1, - event_set_filter_2, - /* picture */ - event_toggle_sprites, - event_palette_hue_up, - event_palette_hue_down, - event_palette_tint_up, - event_palette_tint_down, - event_palette_set_default, - event_palette_set_shady, - /* joypad 1 */ - event_joypad1_a, - event_joypad1_b, - event_joypad1_start, - event_joypad1_select, - event_joypad1_up, - event_joypad1_down, - event_joypad1_left, - event_joypad1_right, - /* joypad 2 */ - event_joypad2_a, - event_joypad2_b, - event_joypad2_start, - event_joypad2_select, - event_joypad2_up, - event_joypad2_down, - event_joypad2_left, - event_joypad2_right, - /* NSF control */ - event_songup, - event_songdown, - event_startsong, - /* OS specific */ - event_osd_1, - event_osd_2, - event_osd_3, - event_osd_4, - event_osd_5, - event_osd_6, - event_osd_7, - event_osd_8, - event_osd_9, - /* last */ - event_last -}; - -typedef void (*event_t)(int code); - -extern void event_init(void); -extern void event_set(int index, event_t handler); -extern event_t event_get(int index); -extern void event_set_system(system_t type); - -#endif /* !_EVENT_H_ */ - -/* -** $Log: event.h,v $ -** Revision 1.2 2001/04/27 14:37:11 neil -** wheeee -** -** Revision 1.1.1.1 2001/04/27 07:03:54 neil -** initial -** -** Revision 1.6 2000/11/01 14:15:35 matt -** multi-system event system, or whatever -** -** Revision 1.5 2000/10/10 13:03:54 matt -** Mr. Clean makes a guest appearance -** -** Revision 1.4 2000/07/31 04:28:46 matt -** one million cleanups -** -** Revision 1.3 2000/07/26 21:36:13 neil -** Big honkin' change -- see the mailing list -** -** Revision 1.2 2000/07/21 04:27:40 matt -** don't mind me... -** -** Revision 1.1 2000/07/21 04:26:38 matt -** initial revision -** -*/ diff --git a/MCUME_pico/piconofrendo/font8x8.h b/MCUME_pico/piconofrendo/font8x8.h deleted file mode 100644 index 4f773da..0000000 --- a/MCUME_pico/piconofrendo/font8x8.h +++ /dev/null @@ -1,135 +0,0 @@ - -// Font: c64_lower.64c - -const unsigned char font8x8[128][8] PROGMEM = -{ - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0000 (nul) - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0001 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0002 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0003 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0004 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0005 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0006 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0007 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0008 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0009 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000A - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000B - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000C - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000D - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000E - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000F - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0010 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0011 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0012 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0013 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0014 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0015 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0016 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0017 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0018 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0019 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001A - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001B - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001C - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001D - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001E - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001F - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0020 (space) - { 0x18, 0x3C, 0x3C, 0x18, 0x18, 0x00, 0x18, 0x00}, // U+0021 (!) - { 0x36, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0022 (") - { 0x36, 0x36, 0x7F, 0x36, 0x7F, 0x36, 0x36, 0x00}, // U+0023 (#) - { 0x0C, 0x3E, 0x03, 0x1E, 0x30, 0x1F, 0x0C, 0x00}, // U+0024 ($) - { 0x00, 0x63, 0x33, 0x18, 0x0C, 0x66, 0x63, 0x00}, // U+0025 (%) - { 0x1C, 0x36, 0x1C, 0x6E, 0x3B, 0x33, 0x6E, 0x00}, // U+0026 (&) - { 0x06, 0x06, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0027 (') - { 0x18, 0x0C, 0x06, 0x06, 0x06, 0x0C, 0x18, 0x00}, // U+0028 (() - { 0x06, 0x0C, 0x18, 0x18, 0x18, 0x0C, 0x06, 0x00}, // U+0029 ()) - { 0x00, 0x66, 0x3C, 0xFF, 0x3C, 0x66, 0x00, 0x00}, // U+002A (*) - { 0x00, 0x0C, 0x0C, 0x3F, 0x0C, 0x0C, 0x00, 0x00}, // U+002B (+) - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x0C, 0x06}, // U+002C (,) - { 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x00}, // U+002D (-) - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x0C, 0x00}, // U+002E (.) - { 0x60, 0x30, 0x18, 0x0C, 0x06, 0x03, 0x01, 0x00}, // U+002F (/) - { 0x3E, 0x63, 0x73, 0x7B, 0x6F, 0x67, 0x3E, 0x00}, // U+0030 (0) - { 0x0C, 0x0E, 0x0C, 0x0C, 0x0C, 0x0C, 0x3F, 0x00}, // U+0031 (1) - { 0x1E, 0x33, 0x30, 0x1C, 0x06, 0x33, 0x3F, 0x00}, // U+0032 (2) - { 0x1E, 0x33, 0x30, 0x1C, 0x30, 0x33, 0x1E, 0x00}, // U+0033 (3) - { 0x38, 0x3C, 0x36, 0x33, 0x7F, 0x30, 0x78, 0x00}, // U+0034 (4) - { 0x3F, 0x03, 0x1F, 0x30, 0x30, 0x33, 0x1E, 0x00}, // U+0035 (5) - { 0x1C, 0x06, 0x03, 0x1F, 0x33, 0x33, 0x1E, 0x00}, // U+0036 (6) - { 0x3F, 0x33, 0x30, 0x18, 0x0C, 0x0C, 0x0C, 0x00}, // U+0037 (7) - { 0x1E, 0x33, 0x33, 0x1E, 0x33, 0x33, 0x1E, 0x00}, // U+0038 (8) - { 0x1E, 0x33, 0x33, 0x3E, 0x30, 0x18, 0x0E, 0x00}, // U+0039 (9) - { 0x00, 0x0C, 0x0C, 0x00, 0x00, 0x0C, 0x0C, 0x00}, // U+003A (:) - { 0x00, 0x0C, 0x0C, 0x00, 0x00, 0x0C, 0x0C, 0x06}, // U+003B (//) - { 0x18, 0x0C, 0x06, 0x03, 0x06, 0x0C, 0x18, 0x00}, // U+003C (<) - { 0x00, 0x00, 0x3F, 0x00, 0x00, 0x3F, 0x00, 0x00}, // U+003D (=) - { 0x06, 0x0C, 0x18, 0x30, 0x18, 0x0C, 0x06, 0x00}, // U+003E (>) - { 0x1E, 0x33, 0x30, 0x18, 0x0C, 0x00, 0x0C, 0x00}, // U+003F (?) - { 0x3E, 0x63, 0x7B, 0x7B, 0x7B, 0x03, 0x1E, 0x00}, // U+0040 (@) - { 0x0C, 0x1E, 0x33, 0x33, 0x3F, 0x33, 0x33, 0x00}, // U+0041 (A) - { 0x3F, 0x66, 0x66, 0x3E, 0x66, 0x66, 0x3F, 0x00}, // U+0042 (B) - { 0x3C, 0x66, 0x03, 0x03, 0x03, 0x66, 0x3C, 0x00}, // U+0043 (C) - { 0x1F, 0x36, 0x66, 0x66, 0x66, 0x36, 0x1F, 0x00}, // U+0044 (D) - { 0x7F, 0x46, 0x16, 0x1E, 0x16, 0x46, 0x7F, 0x00}, // U+0045 (E) - { 0x7F, 0x46, 0x16, 0x1E, 0x16, 0x06, 0x0F, 0x00}, // U+0046 (F) - { 0x3C, 0x66, 0x03, 0x03, 0x73, 0x66, 0x7C, 0x00}, // U+0047 (G) - { 0x33, 0x33, 0x33, 0x3F, 0x33, 0x33, 0x33, 0x00}, // U+0048 (H) - { 0x1E, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+0049 (I) - { 0x78, 0x30, 0x30, 0x30, 0x33, 0x33, 0x1E, 0x00}, // U+004A (J) - { 0x67, 0x66, 0x36, 0x1E, 0x36, 0x66, 0x67, 0x00}, // U+004B (K) - { 0x0F, 0x06, 0x06, 0x06, 0x46, 0x66, 0x7F, 0x00}, // U+004C (L) - { 0x63, 0x77, 0x7F, 0x7F, 0x6B, 0x63, 0x63, 0x00}, // U+004D (M) - { 0x63, 0x67, 0x6F, 0x7B, 0x73, 0x63, 0x63, 0x00}, // U+004E (N) - { 0x1C, 0x36, 0x63, 0x63, 0x63, 0x36, 0x1C, 0x00}, // U+004F (O) - { 0x3F, 0x66, 0x66, 0x3E, 0x06, 0x06, 0x0F, 0x00}, // U+0050 (P) - { 0x1E, 0x33, 0x33, 0x33, 0x3B, 0x1E, 0x38, 0x00}, // U+0051 (Q) - { 0x3F, 0x66, 0x66, 0x3E, 0x36, 0x66, 0x67, 0x00}, // U+0052 (R) - { 0x1E, 0x33, 0x07, 0x0E, 0x38, 0x33, 0x1E, 0x00}, // U+0053 (S) - { 0x3F, 0x2D, 0x0C, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+0054 (T) - { 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x3F, 0x00}, // U+0055 (U) - { 0x33, 0x33, 0x33, 0x33, 0x33, 0x1E, 0x0C, 0x00}, // U+0056 (V) - { 0x63, 0x63, 0x63, 0x6B, 0x7F, 0x77, 0x63, 0x00}, // U+0057 (W) - { 0x63, 0x63, 0x36, 0x1C, 0x1C, 0x36, 0x63, 0x00}, // U+0058 (X) - { 0x33, 0x33, 0x33, 0x1E, 0x0C, 0x0C, 0x1E, 0x00}, // U+0059 (Y) - { 0x7F, 0x63, 0x31, 0x18, 0x4C, 0x66, 0x7F, 0x00}, // U+005A (Z) - { 0x1E, 0x06, 0x06, 0x06, 0x06, 0x06, 0x1E, 0x00}, // U+005B ([) - { 0x03, 0x06, 0x0C, 0x18, 0x30, 0x60, 0x40, 0x00}, // U+005C (\) - { 0x1E, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1E, 0x00}, // U+005D (]) - { 0x08, 0x1C, 0x36, 0x63, 0x00, 0x00, 0x00, 0x00}, // U+005E (^) - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF}, // U+005F (_) - { 0x0C, 0x0C, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0060 (`) - { 0x00, 0x00, 0x1E, 0x30, 0x3E, 0x33, 0x6E, 0x00}, // U+0061 (a) - { 0x07, 0x06, 0x06, 0x3E, 0x66, 0x66, 0x3B, 0x00}, // U+0062 (b) - { 0x00, 0x00, 0x1E, 0x33, 0x03, 0x33, 0x1E, 0x00}, // U+0063 (c) - { 0x38, 0x30, 0x30, 0x3e, 0x33, 0x33, 0x6E, 0x00}, // U+0064 (d) - { 0x00, 0x00, 0x1E, 0x33, 0x3f, 0x03, 0x1E, 0x00}, // U+0065 (e) - { 0x1C, 0x36, 0x06, 0x0f, 0x06, 0x06, 0x0F, 0x00}, // U+0066 (f) - { 0x00, 0x00, 0x6E, 0x33, 0x33, 0x3E, 0x30, 0x1F}, // U+0067 (g) - { 0x07, 0x06, 0x36, 0x6E, 0x66, 0x66, 0x67, 0x00}, // U+0068 (h) - { 0x0C, 0x00, 0x0E, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+0069 (i) - { 0x30, 0x00, 0x30, 0x30, 0x30, 0x33, 0x33, 0x1E}, // U+006A (j) - { 0x07, 0x06, 0x66, 0x36, 0x1E, 0x36, 0x67, 0x00}, // U+006B (k) - { 0x0E, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+006C (l) - { 0x00, 0x00, 0x33, 0x7F, 0x7F, 0x6B, 0x63, 0x00}, // U+006D (m) - { 0x00, 0x00, 0x1F, 0x33, 0x33, 0x33, 0x33, 0x00}, // U+006E (n) - { 0x00, 0x00, 0x1E, 0x33, 0x33, 0x33, 0x1E, 0x00}, // U+006F (o) - { 0x00, 0x00, 0x3B, 0x66, 0x66, 0x3E, 0x06, 0x0F}, // U+0070 (p) - { 0x00, 0x00, 0x6E, 0x33, 0x33, 0x3E, 0x30, 0x78}, // U+0071 (q) - { 0x00, 0x00, 0x3B, 0x6E, 0x66, 0x06, 0x0F, 0x00}, // U+0072 (r) - { 0x00, 0x00, 0x3E, 0x03, 0x1E, 0x30, 0x1F, 0x00}, // U+0073 (s) - { 0x08, 0x0C, 0x3E, 0x0C, 0x0C, 0x2C, 0x18, 0x00}, // U+0074 (t) - { 0x00, 0x00, 0x33, 0x33, 0x33, 0x33, 0x6E, 0x00}, // U+0075 (u) - { 0x00, 0x00, 0x33, 0x33, 0x33, 0x1E, 0x0C, 0x00}, // U+0076 (v) - { 0x00, 0x00, 0x63, 0x6B, 0x7F, 0x7F, 0x36, 0x00}, // U+0077 (w) - { 0x00, 0x00, 0x63, 0x36, 0x1C, 0x36, 0x63, 0x00}, // U+0078 (x) - { 0x00, 0x00, 0x33, 0x33, 0x33, 0x3E, 0x30, 0x1F}, // U+0079 (y) - { 0x00, 0x00, 0x3F, 0x19, 0x0C, 0x26, 0x3F, 0x00}, // U+007A (z) - { 0x38, 0x0C, 0x0C, 0x07, 0x0C, 0x0C, 0x38, 0x00}, // U+007B ({) - { 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x00}, // U+007C (|) - { 0x07, 0x0C, 0x0C, 0x38, 0x0C, 0x0C, 0x07, 0x00}, // U+007D (}) - { 0x6E, 0x3B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+007E (~) - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} // U+007F -}; - diff --git a/MCUME_pico/piconofrendo/keyboard_osd.h b/MCUME_pico/piconofrendo/keyboard_osd.h deleted file mode 100644 index 062eb4e..0000000 --- a/MCUME_pico/piconofrendo/keyboard_osd.h +++ /dev/null @@ -1,20 +0,0 @@ - -#ifndef keyboard_osd_h_ -#define keyboard_osd_h_ - -extern bool virtualkeyboardIsActive(void); -extern void drawVirtualkeyboard(void); -extern void toggleVirtualkeyboard(bool keepOn); -extern void handleVirtualkeyboard(void); - -extern bool callibrationActive(void); -extern int handleCallibration(uint16_t bClick); - -extern bool menuActive(void); -extern char * menuSelection(void); -extern void toggleMenu(bool on); -extern int handleMenu(uint16_t bClick); - - -#endif - diff --git a/MCUME_pico/piconofrendo/libsnss.h b/MCUME_pico/piconofrendo/libsnss.h deleted file mode 100755 index 576227c..0000000 --- a/MCUME_pico/piconofrendo/libsnss.h +++ /dev/null @@ -1,397 +0,0 @@ -/**************************************************************************/ -/* - libsnss.h - - (C) 2000 The SNSS Group - See README.TXT file for license and terms of use. - - $Id: libsnss.h,v 1.1 2001/04/27 12:54:40 neil Exp $ -*/ -/**************************************************************************/ - -#ifndef _LIBSNSS_H_ -#define _LIBSNSS_H_ - -#include - -/**************************************************************************/ -/* endian customization */ -/**************************************************************************/ -/* - Endian-ness quick reference: - the number is: - $12345678 - the little-endian representation (e.g.: 6502, Intel x86) is: - 78 56 34 12 - the big-endian representation (e.g.: Motorola 68000) is: - 12 34 56 78 - the SNSS file format uses big-endian representation -*/ - -/* comment/uncomment depending on your processor architecture */ -/* commenting this out implies BIG ENDIAN */ -#define USE_LITTLE_ENDIAN - -/**************************************************************************/ -/* SNSS constants */ -/**************************************************************************/ - -typedef enum _SNSS_OPEN_MODES -{ - SNSS_OPEN_READ, - SNSS_OPEN_WRITE -} SNSS_OPEN_MODE; - -/* block types */ -typedef enum _SNSS_BLOCK_TYPES -{ - SNSS_BASR, - SNSS_VRAM, - SNSS_SRAM, - SNSS_MPRD, - SNSS_CNTR, - SNSS_SOUN, - SNSS_UNKNOWN_BLOCK -} SNSS_BLOCK_TYPE; - -/* function return types */ -typedef enum _SNSS_RETURN_CODES -{ - SNSS_OK, - SNSS_BAD_FILE_TAG, - SNSS_OPEN_FAILED, - SNSS_CLOSE_FAILED, - SNSS_READ_FAILED, - SNSS_WRITE_FAILED, - SNSS_OUT_OF_MEMORY, - SNSS_UNSUPPORTED_BLOCK -} SNSS_RETURN_CODE; - - -#define TAG_LENGTH 4 -#define SNSS_BLOCK_VERSION 1 - -/**************************************************************************/ -/* SNSS data structures */ -/**************************************************************************/ - -struct mapper1Data -{ - unsigned char registers[4]; - unsigned char latch; - unsigned char numberOfBits; -}; - -struct mapper4Data -{ - unsigned char irqCounter; - unsigned char irqLatchCounter; - unsigned char irqCounterEnabled; - unsigned char last8000Write; -}; - -struct mapper5Data -{ - unsigned char dummy; /* needed for some compilers; remove if any members are added */ -}; - -struct mapper6Data -{ - unsigned char irqCounter; - unsigned char irqLatchCounter; - unsigned char irqCounterEnabled; - unsigned char last43FEWrite; - unsigned char last4500Write; -}; - -struct mapper9Data -{ - unsigned char latch[2]; - unsigned char lastB000Write; - unsigned char lastC000Write; - unsigned char lastD000Write; - unsigned char lastE000Write; -}; - -struct mapper10Data -{ - unsigned char latch[2]; - unsigned char lastB000Write; - unsigned char lastC000Write; - unsigned char lastD000Write; - unsigned char lastE000Write; -}; - -struct mapper16Data -{ - unsigned char irqCounterLowByte; - unsigned char irqCounterHighByte; - unsigned char irqCounterEnabled; -}; - -struct mapper17Data -{ - unsigned char irqCounterLowByte; - unsigned char irqCounterHighByte; - unsigned char irqCounterEnabled; -}; - -struct mapper18Data -{ - unsigned char irqCounterLowByte; - unsigned char irqCounterHighByte; - unsigned char irqCounterEnabled; -}; - -struct mapper19Data -{ - unsigned char irqCounterLowByte; - unsigned char irqCounterHighByte; - unsigned char irqCounterEnabled; -}; - -struct mapper21Data -{ - unsigned char irqCounter; - unsigned char irqCounterEnabled; -}; - -struct mapper24Data -{ - unsigned char irqCounter; - unsigned char irqCounterEnabled; -}; - -struct mapper40Data -{ - unsigned char irqCounter; - unsigned char irqCounterEnabled; -}; - -struct mapper69Data -{ - unsigned char irqCounterLowByte; - unsigned char irqCounterHighByte; - unsigned char irqCounterEnabled; -}; - -struct mapper90Data -{ - unsigned char irqCounter; - unsigned char irqLatchCounter; - unsigned char irqCounterEnabled; -}; - -struct mapper224Data -{ - unsigned char chrRamWriteable; -}; - -struct mapper225Data -{ - unsigned char prgSize; - unsigned char registers[4]; -}; - -struct mapper226Data -{ - unsigned char chrRamWriteable; -}; - -struct mapper228Data -{ - unsigned char prgChipSelected; -}; - -struct mapper230Data -{ - unsigned char numberOfResets; -}; - -typedef struct _SnssFileHeader -{ - char tag[TAG_LENGTH + 1]; - unsigned int numberOfBlocks; -} SnssFileHeader; - -/* this block appears before every block in the SNSS file */ -typedef struct _SnssBlockHeader -{ - char tag[TAG_LENGTH + 1]; - unsigned int blockVersion; - unsigned int blockLength; -} SnssBlockHeader; - -#define BASE_BLOCK_LENGTH 0x1931 -typedef struct _SnssBaseBlock -{ - unsigned char regA; - unsigned char regX; - unsigned char regY; - unsigned char regFlags; - unsigned char regStack; - unsigned short regPc; - unsigned char reg2000; - unsigned char reg2001; - unsigned char cpuRam[0x800]; - unsigned char spriteRam[0x100]; - unsigned char ppuRam[0x1000]; - unsigned char palette[0x20]; - unsigned char mirrorState[4]; - unsigned short vramAddress; - unsigned char spriteRamAddress; - unsigned char tileXOffset; -} SnssBaseBlock; - -#define VRAM_8K 0x2000 -#define VRAM_16K 0x4000 -typedef struct _SnssVramBlock -{ - unsigned short vramSize; - unsigned char vram[VRAM_16K]; -} SnssVramBlock; - -#define SRAM_1K 0x0400 -#define SRAM_2K 0x0800 -#define SRAM_3K 0x0C00 -#define SRAM_4K 0x1000 -#define SRAM_5K 0x1400 -#define SRAM_6K 0x1800 -#define SRAM_7K 0x1C00 -#define SRAM_8K 0x2000 -typedef struct _SnssSramBlock -{ - unsigned short sramSize; - unsigned char sramEnabled; - unsigned char sram[SRAM_8K]; -} SnssSramBlock; - -#define MAPPER_BLOCK_LENGTH 0x98 -typedef struct _SnssMapperBlock -{ - unsigned short prgPages[4]; - unsigned short chrPages[8]; - - union _extraData - { - unsigned char mapperData[128]; - struct mapper1Data mapper1; - struct mapper4Data mapper4; - struct mapper5Data mapper5; - struct mapper6Data mapper6; - struct mapper9Data mapper9; - struct mapper10Data mapper10; - struct mapper16Data mapper16; - struct mapper17Data mapper17; - struct mapper18Data mapper18; - struct mapper19Data mapper19; - struct mapper21Data mapper21; - struct mapper24Data mapper24; - struct mapper40Data mapper40; - struct mapper69Data mapper69; - struct mapper90Data mapper90; - struct mapper224Data mapper224; - struct mapper225Data mapper225; - struct mapper226Data mapper226; - struct mapper228Data mapper228; - struct mapper230Data mapper230; - } extraData; -} SnssMapperBlock; - -typedef struct _SnssControllersBlock -{ - unsigned char dummy; /* needed for some compilers; remove if any members are added */ -} SnssControllersBlock; - -#define SOUND_BLOCK_LENGTH 0x16 -typedef struct _SnssSoundBlock -{ - unsigned char soundRegisters[0x16]; -} SnssSoundBlock; - -/**************************************************************************/ -/* SNSS file manipulation functions */ -/**************************************************************************/ - -typedef struct _SNSS_FILE -{ - FILE *fp; - SNSS_OPEN_MODE mode; - SnssFileHeader headerBlock; - SnssBaseBlock baseBlock; - SnssVramBlock vramBlock; - SnssSramBlock sramBlock; - SnssMapperBlock mapperBlock; - SnssControllersBlock contBlock; - SnssSoundBlock soundBlock; -} SNSS_FILE; - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/* general file manipulation routines */ -SNSS_RETURN_CODE SNSS_OpenFile (SNSS_FILE **snssFile, const char *filename, - SNSS_OPEN_MODE mode); -SNSS_RETURN_CODE SNSS_CloseFile (SNSS_FILE **snssFile); - -/* block traversal */ -SNSS_RETURN_CODE SNSS_GetNextBlockType (SNSS_BLOCK_TYPE *blockType, - SNSS_FILE *snssFile); -SNSS_RETURN_CODE SNSS_SkipNextBlock (SNSS_FILE *snssFile); - -/* functions to read/write SNSS blocks */ -SNSS_RETURN_CODE SNSS_ReadBlock (SNSS_FILE *snssFile, SNSS_BLOCK_TYPE blockType); -SNSS_RETURN_CODE SNSS_WriteBlock (SNSS_FILE *snssFile, SNSS_BLOCK_TYPE blockType); - -/* support functions */ -const char *SNSS_GetErrorString (SNSS_RETURN_CODE code); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _LIBSNSS_H_ */ - -/* -** $Log: libsnss.h,v $ -** Revision 1.1 2001/04/27 12:54:40 neil -** blah -** -** Revision 1.1.1.1 2001/04/27 07:03:54 neil -** initial -** -** Revision 1.2 2000/11/09 14:07:41 matt -** minor update -** -** Revision 1.1 2000/10/24 12:19:01 matt -** changed directory structure -** -** Revision 1.9 2000/09/18 02:06:48 matt -** -pedantic is your friend -** -** Revision 1.8 2000/07/17 01:52:27 matt -** made sure last line of all source files is a newline -** -** Revision 1.7 2000/07/15 23:49:14 matt -** fixed some typos in the mapper-specific data -** -** Revision 1.6 2000/07/09 15:37:21 matt -** all block read/write calls now pass through a common handler -** -** Revision 1.5 2000/07/09 03:39:06 matt -** minor modifications -** -** Revision 1.4 2000/07/08 16:01:39 matt -** added bald's changes, made error checking more robust -** -** Revision 1.3 2000/07/05 22:46:52 matt -** cleaned up header -** -** Revision 1.2 2000/07/04 04:46:06 matt -** simplified handling of SNSS states -** -** Revision 1.1 2000/06/29 14:13:28 matt -** initial revision -** -*/ diff --git a/MCUME_pico/piconofrendo/log.c b/MCUME_pico/piconofrendo/log.c deleted file mode 100755 index c75d482..0000000 --- a/MCUME_pico/piconofrendo/log.c +++ /dev/null @@ -1,121 +0,0 @@ -/* -** Nofrendo (c) 1998-2000 Matthew Conte (matt@conte.com) -** -** -** This program is free software; you can redistribute it and/or -** modify it under the terms of version 2 of the GNU Library General -** Public License as published by the Free Software Foundation. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** Library General Public License for more details. To obtain a -** copy of the GNU Library General Public License, write to the Free -** Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -** -** Any permitted reproduction of these routines, in whole or in part, -** must bear this legend. -** -** -** log.c -** -** Error logging functions -** $Id: log.c,v 1.2 2001/04/27 14:37:11 neil Exp $ -*/ - -#include -#include -#include -#include "noftypes.h" -#include "log.h" - - -//static FILE *errorlog = NULL; -static int (*log_func)(const char *string) = NULL; - - -int log_init(void) -{ - return 0; -} - -void log_shutdown(void) -{ -} - -int log_print(const char *string) -{ - UNUSED(string); - - return 0; -} - -int log_printf(const char *format, ... ) -{ - UNUSED(format); - - return 0; /* should be number of chars written */ -} - -void log_chain_logfunc(int (*func)(const char *string)) -{ - log_func = func; -} - -void log_assert(int expr, int line, const char *file, char *msg) -{ - if (expr) - return; - - if (NULL != msg) - log_printf("ASSERT: line %d of %s, %s\n", line, file, msg); - else - log_printf("ASSERT: line %d of %s\n", line, file); - - //asm("break.n 1"); -// exit(-1); -} - - -/* -** $Log: log.c,v $ -** Revision 1.2 2001/04/27 14:37:11 neil -** wheeee -** -** Revision 1.1.1.1 2001/04/27 07:03:54 neil -** initial -** -** Revision 1.14 2000/11/13 00:56:17 matt -** doesn't look as nasty now -** -** Revision 1.13 2000/11/06 02:15:07 matt -** more robust logging routines -** -** Revision 1.12 2000/10/15 13:28:12 matt -** need stdlib.h for exit() -** -** Revision 1.11 2000/10/10 13:13:13 matt -** dumb bug in log_chain_logfunc -** -** Revision 1.10 2000/10/10 13:03:54 matt -** Mr. Clean makes a guest appearance -** -** Revision 1.9 2000/08/28 01:47:10 matt -** quelled fricking compiler complaints -** -** Revision 1.8 2000/07/31 04:28:46 matt -** one million cleanups -** -** Revision 1.7 2000/07/17 01:52:27 matt -** made sure last line of all source files is a newline -** -** Revision 1.6 2000/07/06 17:20:52 matt -** block manager space itself wasn't being freed - d'oh! -** -** Revision 1.5 2000/06/26 04:55:33 matt -** minor change -** -** Revision 1.4 2000/06/09 15:12:25 matt -** initial revision -** -*/ diff --git a/MCUME_pico/piconofrendo/log.h b/MCUME_pico/piconofrendo/log.h deleted file mode 100755 index 58d93c7..0000000 --- a/MCUME_pico/piconofrendo/log.h +++ /dev/null @@ -1,57 +0,0 @@ -/* -** Nofrendo (c) 1998-2000 Matthew Conte (matt@conte.com) -** -** -** This program is free software; you can redistribute it and/or -** modify it under the terms of version 2 of the GNU Library General -** Public License as published by the Free Software Foundation. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** Library General Public License for more details. To obtain a -** copy of the GNU Library General Public License, write to the Free -** Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -** -** Any permitted reproduction of these routines, in whole or in part, -** must bear this legend. -** -** -** log.h -** -** Error logging header file -** $Id: log.h,v 1.1.1.1 2001/04/27 07:03:54 neil Exp $ -*/ - -#ifndef _LOG_H_ -#define _LOG_H_ - -#include - -extern int log_init(void); -extern void log_shutdown(void); -extern int log_print(const char *string); -extern int log_printf(const char *format, ...); -extern void log_chain_logfunc(int (*logfunc)(const char *string)); -extern void log_assert(int expr, int line, const char *file, char *msg); - -#endif /* _LOG_H_ */ - -/* -** $Log: log.h,v $ -** Revision 1.1.1.1 2001/04/27 07:03:54 neil -** initial -** -** Revision 1.7 2000/11/06 02:15:07 matt -** more robust logging routines -** -** Revision 1.6 2000/10/10 13:03:54 matt -** Mr. Clean makes a guest appearance -** -** Revision 1.5 2000/07/17 01:52:27 matt -** made sure last line of all source files is a newline -** -** Revision 1.4 2000/06/09 15:12:25 matt -** initial revision -** -*/ diff --git a/MCUME_pico/piconofrendo/map000.c b/MCUME_pico/piconofrendo/map000.c deleted file mode 100644 index f5ab3cc..0000000 --- a/MCUME_pico/piconofrendo/map000.c +++ /dev/null @@ -1,63 +0,0 @@ -/* -** Nofrendo (c) 1998-2000 Matthew Conte (matt@conte.com) -** -** -** This program is free software; you can redistribute it and/or -** modify it under the terms of version 2 of the GNU Library General -** Public License as published by the Free Software Foundation. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** Library General Public License for more details. To obtain a -** copy of the GNU Library General Public License, write to the Free -** Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -** -** Any permitted reproduction of these routines, in whole or in part, -** must bear this legend. -** -** -** map0.c -** -** mapper 0 interface -** $Id: map000.c,v 1.2 2001/04/27 14:37:11 neil Exp $ -*/ - -#include "noftypes.h" -#include "nes_mmc.h" - -const mapintf_t map0_intf = -{ - 0, /* mapper number */ - "None", /* mapper name */ - NULL, /* init routine */ - NULL, /* vblank callback */ - NULL, /* hblank callback */ - NULL, /* get state (snss) */ - NULL, /* set state (snss) */ - NULL, /* memory read structure */ - NULL, /* memory write structure */ - NULL /* external sound device */ -}; - -/* -** $Log: map000.c,v $ -** Revision 1.2 2001/04/27 14:37:11 neil -** wheeee -** -** Revision 1.1 2001/04/27 12:54:40 neil -** blah -** -** Revision 1.1.1.1 2001/04/27 07:03:54 neil -** initial -** -** Revision 1.1 2000/10/24 12:19:32 matt -** changed directory structure -** -** Revision 1.2 2000/07/06 02:48:43 matt -** clearly labelled structure members -** -** Revision 1.1 2000/07/04 23:11:45 matt -** initial revision -** -*/ diff --git a/MCUME_pico/piconofrendo/map001.c b/MCUME_pico/piconofrendo/map001.c deleted file mode 100644 index af6be33..0000000 --- a/MCUME_pico/piconofrendo/map001.c +++ /dev/null @@ -1,242 +0,0 @@ -/* -** Nofrendo (c) 1998-2000 Matthew Conte (matt@conte.com) -** -** -** This program is free software; you can redistribute it and/or -** modify it under the terms of version 2 of the GNU Library General -** Public License as published by the Free Software Foundation. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** Library General Public License for more details. To obtain a -** copy of the GNU Library General Public License, write to the Free -** Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -** -** Any permitted reproduction of these routines, in whole or in part, -** must bear this legend. -** -** -** map1.c -** -** mapper 1 interface -** $Id: map001.c,v 1.2 2001/04/27 14:37:11 neil Exp $ -*/ - -#include -#include "noftypes.h" -#include "nes_mmc.h" -#include "nes_ppu.h" - -/* TODO: WRAM enable ala Mark Knibbs: - ================================== -The SNROM board uses 8K CHR-RAM. The CHR-RAM is paged (i.e. it can be split -into two 4Kbyte pages). - -The CRA16 line of the MMC1 is connected to the /CS1 pin of the WRAM. THIS MEANS -THAT THE WRAM CAN BE ENABLED OR DISABLED ACCORDING TO THE STATE OF THE CRA16 -LINE. The CRA16 line corresponds to bit 4 of MMC1 registers 1 & 2. - -The WRAM is enabled when the CRA16 line is low, and disabled when CRA16 is -high. This has implications when CHR page size is 4K, if the two page numbers -set have different CRA16 states (e.g. reg 1 bit 4 = 0, reg 2 bit 4 = 1). Then -the WRAM will be enabled and disabled depending on what CHR address is being -accessed. - -When CHR page size is 8K, bit 4 of MMC1 register 1 (and not register 2, because -page size is 8K) controls whether the WRAM is enabled or not. It must be low -to be enabled. When the WRAM is disabled, reading from and writing to it will -not be possible. -*/ - -/* TODO: roll this into something... */ -static int bitcount = 0; -static uint8 latch = 0; -static uint8 regs[4]; -static int bank_select; -static uint8 lastreg; - -static void map1_write(uint32 address, uint8 value) -{ - int regnum = (address >> 13) - 4; - - if (value & 0x80) - { - regs[0] |= 0x0C; - bitcount = 0; - latch = 0; - return; - } - - if (lastreg != regnum) - { - bitcount = 0; - latch = 0; - lastreg = regnum; - } - //lastreg = regnum; - - latch |= ((value & 1) << bitcount++); - - /* 5 bit registers */ - if (5 != bitcount) - return; - - regs[regnum] = latch; - value = latch; - bitcount = 0; - latch = 0; - - switch (regnum) - { - case 0: - { - if (0 == (value & 2)) - { - int mirror = value & 1; - ppu_mirror(mirror, mirror, mirror, mirror); - } - else - { - if (value & 1) - ppu_mirror(0, 0, 1, 1); - else - ppu_mirror(0, 1, 0, 1); - } - } - break; - - case 1: - if (regs[0] & 0x10) - mmc_bankvrom(4, 0x0000, value); - else - mmc_bankvrom(8, 0x0000, value >> 1); - break; - - case 2: - if (regs[0] & 0x10) - mmc_bankvrom(4, 0x1000, value); - break; - - case 3: - if (mmc_getinfo()->rom_banks == 0x20) - { - bank_select = (regs[1] & 0x10) ? 0 : 0x10; - } - else if (mmc_getinfo()->rom_banks == 0x40) - { - if (regs[0] & 0x10) - bank_select = (regs[1] & 0x10) | ((regs[2] & 0x10) << 1); - else - bank_select = (regs[1] & 0x10) << 1; - } - else - { - bank_select = 0; - } - - if (0 == (regs[0] & 0x08)) - mmc_bankrom(32, 0x8000, ((regs[3] >> 1) + (bank_select >> 1))); - else if (regs[0] & 0x04) - mmc_bankrom(16, 0x8000, ((regs[3] & 0xF) + bank_select)); - else - mmc_bankrom(16, 0xC000, ((regs[3] & 0xF) + bank_select)); - - default: - break; - } -} - -static void map1_init(void) -{ - bitcount = 0; - latch = 0; - - memset(regs, 0, sizeof(regs)); - - if (mmc_getinfo()->rom_banks == 0x20) - mmc_bankrom(16, 0xC000, 0x0F); - - map1_write(0x8000, 0x80); -} - -static void map1_getstate(SnssMapperBlock *state) -{ - state->extraData.mapper1.registers[0] = regs[0]; - state->extraData.mapper1.registers[1] = regs[1]; - state->extraData.mapper1.registers[2] = regs[2]; - state->extraData.mapper1.registers[3] = regs[3]; - state->extraData.mapper1.latch = latch; - state->extraData.mapper1.numberOfBits = bitcount; -} - - -static void map1_setstate(SnssMapperBlock *state) -{ - regs[1] = state->extraData.mapper1.registers[0]; - regs[1] = state->extraData.mapper1.registers[1]; - regs[2] = state->extraData.mapper1.registers[2]; - regs[3] = state->extraData.mapper1.registers[3]; - latch = state->extraData.mapper1.latch; - bitcount = state->extraData.mapper1.numberOfBits; -} - -static map_memwrite map1_memwrite[] = -{ - { 0x8000, 0xFFFF, map1_write }, - { -1, -1, NULL } -}; - -const mapintf_t map1_intf = -{ - 1, /* mapper number */ - "MMC1", /* mapper name */ - map1_init, /* init routine */ - NULL, /* vblank callback */ - NULL, /* hblank callback */ - map1_getstate, /* get state (snss) */ - map1_setstate, /* set state (snss) */ - NULL, /* memory read structure */ - map1_memwrite, /* memory write structure */ - NULL /* external sound device */ -}; - -/* -** $Log: map001.c,v $ -** Revision 1.2 2001/04/27 14:37:11 neil -** wheeee -** -** Revision 1.1 2001/04/27 12:54:40 neil -** blah -** -** Revision 1.1.1.1 2001/04/27 07:03:54 neil -** initial -** -** Revision 1.1 2000/10/24 12:19:32 matt -** changed directory structure -** -** Revision 1.8 2000/10/22 19:46:50 matt -** mirroring bugfix -** -** Revision 1.7 2000/10/22 19:17:46 matt -** mapper cleanups galore -** -** Revision 1.6 2000/10/22 15:03:13 matt -** simplified mirroring -** -** Revision 1.5 2000/10/21 19:33:38 matt -** many more cleanups -** -** Revision 1.4 2000/07/15 23:52:19 matt -** rounded out a bunch more mapper interfaces -** -** Revision 1.3 2000/07/10 05:29:03 matt -** cleaned up some mirroring issues -** -** Revision 1.2 2000/07/06 02:48:43 matt -** clearly labelled structure members -** -** Revision 1.1 2000/07/04 23:11:45 matt -** initial revision -** -*/ diff --git a/MCUME_pico/piconofrendo/map002.c b/MCUME_pico/piconofrendo/map002.c deleted file mode 100644 index 73f9dfd..0000000 --- a/MCUME_pico/piconofrendo/map002.c +++ /dev/null @@ -1,86 +0,0 @@ -/* -** Nofrendo (c) 1998-2000 Matthew Conte (matt@conte.com) -** -** -** This program is free software; you can redistribute it and/or -** modify it under the terms of version 2 of the GNU Library General -** Public License as published by the Free Software Foundation. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** Library General Public License for more details. To obtain a -** copy of the GNU Library General Public License, write to the Free -** Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -** -** Any permitted reproduction of these routines, in whole or in part, -** must bear this legend. -** -** -** map2.c -** -** mapper 2 interface -** $Id: map002.c,v 1.2 2001/04/27 14:37:11 neil Exp $ -*/ - -#include "noftypes.h" -#include "nes_mmc.h" - -/* mapper 2: UNROM */ -static void map2_write(uint32 address, uint8 value) -{ - UNUSED(address); - - mmc_bankrom(16, 0x8000, value); -} - -static const map_memwrite map2_memwrite[] = -{ - { 0x8000, 0xFFFF, map2_write }, - { -1, -1, NULL } -}; - -const mapintf_t map2_intf = -{ - 2, /* mapper number */ - "UNROM", /* mapper name */ - NULL, /* init routine */ - NULL, /* vblank callback */ - NULL, /* hblank callback */ - NULL, /* get state (snss) */ - NULL, /* set state (snss) */ - NULL, /* memory read structure */ - map2_memwrite, /* memory write structure */ - NULL /* external sound device */ -}; - -/* -** $Log: map002.c,v $ -** Revision 1.2 2001/04/27 14:37:11 neil -** wheeee -** -** Revision 1.1 2001/04/27 12:54:40 neil -** blah -** -** Revision 1.1.1.1 2001/04/27 07:03:54 neil -** initial -** -** Revision 1.1 2000/10/24 12:19:32 matt -** changed directory structure -** -** Revision 1.5 2000/10/22 19:17:46 matt -** mapper cleanups galore -** -** Revision 1.4 2000/10/21 19:33:38 matt -** many more cleanups -** -** Revision 1.3 2000/08/16 02:50:11 matt -** random mapper cleanups -** -** Revision 1.2 2000/07/06 02:48:43 matt -** clearly labelled structure members -** -** Revision 1.1 2000/07/04 23:11:45 matt -** initial revision -** -*/ diff --git a/MCUME_pico/piconofrendo/map003.c b/MCUME_pico/piconofrendo/map003.c deleted file mode 100644 index 2a37c57..0000000 --- a/MCUME_pico/piconofrendo/map003.c +++ /dev/null @@ -1,85 +0,0 @@ -/* -** Nofrendo (c) 1998-2000 Matthew Conte (matt@conte.com) -** -** -** This program is free software; you can redistribute it and/or -** modify it under the terms of version 2 of the GNU Library General -** Public License as published by the Free Software Foundation. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** Library General Public License for more details. To obtain a -** copy of the GNU Library General Public License, write to the Free -** Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -** -** Any permitted reproduction of these routines, in whole or in part, -** must bear this legend. -** -** -** map3.c -** -** mapper 3 interface -** $Id: map003.c,v 1.2 2001/04/27 14:37:11 neil Exp $ -*/ -#include "noftypes.h" -#include "nes_mmc.h" - -/* mapper 3: CNROM */ -static void map3_write(uint32 address, uint8 value) -{ - UNUSED(address); - - mmc_bankvrom(8, 0x0000, value); -} - -static const map_memwrite map3_memwrite[] = -{ - { 0x8000, 0xFFFF, map3_write }, - { -1, -1, NULL } -}; - -const mapintf_t map3_intf = -{ - 3, /* mapper number */ - "CNROM", /* mapper name */ - NULL, /* init routine */ - NULL, /* vblank callback */ - NULL, /* hblank callback */ - NULL, /* get state (snss) */ - NULL, /* set state (snss) */ - NULL, /* memory read structure */ - map3_memwrite, /* memory write structure */ - NULL /* external sound device */ -}; - -/* -** $Log: map003.c,v $ -** Revision 1.2 2001/04/27 14:37:11 neil -** wheeee -** -** Revision 1.1 2001/04/27 12:54:40 neil -** blah -** -** Revision 1.1.1.1 2001/04/27 07:03:54 neil -** initial -** -** Revision 1.1 2000/10/24 12:19:32 matt -** changed directory structure -** -** Revision 1.5 2000/10/22 19:17:46 matt -** mapper cleanups galore -** -** Revision 1.4 2000/10/21 19:33:38 matt -** many more cleanups -** -** Revision 1.3 2000/08/16 02:50:11 matt -** random mapper cleanups -** -** Revision 1.2 2000/07/06 02:48:43 matt -** clearly labelled structure members -** -** Revision 1.1 2000/07/04 23:11:45 matt -** initial revision -** -*/ diff --git a/MCUME_pico/piconofrendo/map004.c b/MCUME_pico/piconofrendo/map004.c deleted file mode 100644 index 6587b91..0000000 --- a/MCUME_pico/piconofrendo/map004.c +++ /dev/null @@ -1,269 +0,0 @@ -/* -** Nofrendo (c) 1998-2000 Matthew Conte (matt@conte.com) -** -** -** This program is free software; you can redistribute it and/or -** modify it under the terms of version 2 of the GNU Library General -** Public License as published by the Free Software Foundation. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** Library General Public License for more details. To obtain a -** copy of the GNU Library General Public License, write to the Free -** Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -** -** Any permitted reproduction of these routines, in whole or in part, -** must bear this legend. -** -** -** map4.c -** -** mapper 4 interface -** $Id: map004.c,v 1.2 2001/04/27 14:37:11 neil Exp $ -*/ - -#include "noftypes.h" -#include "nes_mmc.h" -#include "nes.h" -#include "libsnss.h" - -static struct -{ - int counter, latch; - bool enabled, reset; -} irq; - -static uint8 reg; -static uint8 command; -static uint16 vrombase; - -/* mapper 4: MMC3 */ -static void map4_write(uint32 address, uint8 value) -{ - switch (address & 0xE001) - { - case 0x8000: - command = value; - vrombase = (command & 0x80) ? 0x1000 : 0x0000; - - if (reg != (value & 0x40)) - { - if (value & 0x40) - mmc_bankrom(8, 0x8000, (mmc_getinfo()->rom_banks * 2) - 2); - else - mmc_bankrom(8, 0xC000, (mmc_getinfo()->rom_banks * 2) - 2); - } - reg = value & 0x40; - break; - - case 0x8001: - switch (command & 0x07) - { - case 0: - value &= 0xFE; - mmc_bankvrom(1, vrombase ^ 0x0000, value); - mmc_bankvrom(1, vrombase ^ 0x0400, value + 1); - break; - - case 1: - value &= 0xFE; - mmc_bankvrom(1, vrombase ^ 0x0800, value); - mmc_bankvrom(1, vrombase ^ 0x0C00, value + 1); - break; - - case 2: - mmc_bankvrom(1, vrombase ^ 0x1000, value); - break; - - case 3: - mmc_bankvrom(1, vrombase ^ 0x1400, value); - break; - - case 4: - mmc_bankvrom(1, vrombase ^ 0x1800, value); - break; - - case 5: - mmc_bankvrom(1, vrombase ^ 0x1C00, value); - break; - - case 6: - mmc_bankrom(8, (command & 0x40) ? 0xC000 : 0x8000, value); - break; - - case 7: - mmc_bankrom(8, 0xA000, value); - break; - } - break; - - case 0xA000: - /* four screen mirroring crap */ - if (0 == (mmc_getinfo()->flags & ROM_FLAG_FOURSCREEN)) - { - if (value & 1) - ppu_mirror(0, 0, 1, 1); /* horizontal */ - else - ppu_mirror(0, 1, 0, 1); /* vertical */ - } - break; - - case 0xA001: - /* Save RAM enable / disable */ - /* Messes up Startropics I/II if implemented -- bah */ - break; - - case 0xC000: - irq.latch = value; -// if (irq.reset) -// irq.counter = irq.latch; - break; - - case 0xC001: - irq.reset = true; - irq.counter = irq.latch; - break; - - case 0xE000: - irq.enabled = false; -// if (irq.reset) -// irq.counter = irq.latch; - break; - - case 0xE001: - irq.enabled = true; -// if (irq.reset) -// irq.counter = irq.latch; - break; - - default: - break; - } - - if (true == irq.reset) - irq.counter = irq.latch; -} - -static void map4_hblank(int vblank) -{ - if (vblank) - return; - - if (ppu_enabled()) - { - if (irq.counter >= 0) - { - irq.reset = false; - irq.counter--; - - if (irq.counter < 0) - { - if (irq.enabled) - { - irq.reset = true; - nes_irq(); - } - } - } - } -} - -static void map4_getstate(SnssMapperBlock *state) -{ - state->extraData.mapper4.irqCounter = irq.counter; - state->extraData.mapper4.irqLatchCounter = irq.latch; - state->extraData.mapper4.irqCounterEnabled = irq.enabled; - state->extraData.mapper4.last8000Write = command; -} - -static void map4_setstate(SnssMapperBlock *state) -{ - irq.counter = state->extraData.mapper4.irqCounter; - irq.latch = state->extraData.mapper4.irqLatchCounter; - irq.enabled = state->extraData.mapper4.irqCounterEnabled; - command = state->extraData.mapper4.last8000Write; -} - -static void map4_init(void) -{ - irq.counter = irq.latch = 0; - irq.enabled = irq.reset = false; - reg = command = 0; - vrombase = 0x0000; -} - -static const map_memwrite map4_memwrite[] = -{ - { 0x8000, 0xFFFF, map4_write }, - { -1, -1, NULL } -}; - -const mapintf_t map4_intf = -{ - 4, /* mapper number */ - "MMC3", /* mapper name */ - map4_init, /* init routine */ - NULL, /* vblank callback */ - map4_hblank, /* hblank callback */ - map4_getstate, /* get state (snss) */ - map4_setstate, /* set state (snss) */ - NULL, /* memory read structure */ - map4_memwrite, /* memory write structure */ - NULL /* external sound device */ -}; - -/* -** $Log: map004.c,v $ -** Revision 1.2 2001/04/27 14:37:11 neil -** wheeee -** -** Revision 1.1 2001/04/27 12:54:40 neil -** blah -** -** Revision 1.1.1.1 2001/04/27 07:03:54 neil -** initial -** -** Revision 1.2 2000/11/26 15:40:49 matt -** hey, it actually works now -** -** Revision 1.1 2000/10/24 12:19:32 matt -** changed directory structure -** -** Revision 1.12 2000/10/23 15:53:27 matt -** suppressed warnings -** -** Revision 1.11 2000/10/22 19:17:46 matt -** mapper cleanups galore -** -** Revision 1.10 2000/10/22 15:03:13 matt -** simplified mirroring -** -** Revision 1.9 2000/10/21 19:33:38 matt -** many more cleanups -** -** Revision 1.8 2000/10/10 13:58:17 matt -** stroustrup squeezing his way in the door -** -** Revision 1.7 2000/10/08 18:05:44 matt -** kept old version around, just in case.... -** -** Revision 1.6 2000/07/15 23:52:19 matt -** rounded out a bunch more mapper interfaces -** -** Revision 1.5 2000/07/10 13:51:25 matt -** using generic nes_irq() routine now -** -** Revision 1.4 2000/07/10 05:29:03 matt -** cleaned up some mirroring issues -** -** Revision 1.3 2000/07/06 02:48:43 matt -** clearly labelled structure members -** -** Revision 1.2 2000/07/05 05:04:39 matt -** minor modifications -** -** Revision 1.1 2000/07/04 23:11:45 matt -** initial revision -** -*/ diff --git a/MCUME_pico/piconofrendo/map005.c b/MCUME_pico/piconofrendo/map005.c deleted file mode 100755 index 16a8347..0000000 --- a/MCUME_pico/piconofrendo/map005.c +++ /dev/null @@ -1,326 +0,0 @@ -/* -** Nofrendo (c) 1998-2000 Matthew Conte (matt@conte.com) -** -** -** This program is free software; you can redistribute it and/or -** modify it under the terms of version 2 of the GNU Library General -** Public License as published by the Free Software Foundation. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** Library General Public License for more details. To obtain a -** copy of the GNU Library General Public License, write to the Free -** Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -** -** Any permitted reproduction of these routines, in whole or in part, -** must bear this legend. -** -** -** map5.c -** -** mapper 5 interface -** $Id: map005.c,v 1.2 2001/04/27 14:37:11 neil Exp $ -*/ - -#include "noftypes.h" -#include "nes_mmc.h" -#include "nes.h" -#include "log.h" -#include "mmc5_snd.h" - -/* TODO: there's lots of info about this mapper now; -** let's implement it correctly/completely -*/ - -static struct -{ - int counter, enabled; - int reset, latch; -} irq; - -/* MMC5 - Castlevania III, etc */ -static void map5_hblank(int vblank) -{ - UNUSED(vblank); - - if (irq.counter == nes_getcontextptr()->scanline) - { - if (true == irq.enabled) - { - nes_irq(); - irq.reset = true; - } - //else - // irq.reset = false; - irq.counter = irq.latch; - } -} - -static void map5_write(uint32 address, uint8 value) -{ - static int page_size = 8; - - /* ex-ram memory-- bleh! */ - if (address >= 0x5C00 && address <= 0x5FFF) - return; - - switch (address) - { - case 0x5100: - /* PRG page size setting */ - /* 0:32k 1:16k 2,3:8k */ - switch (value & 3) - { - case 0: - page_size = 32; - break; - - case 1: - page_size = 16; - break; - - case 2: - case 3: - page_size = 8; - break; - } - break; - - case 0x5101: - /* CHR page size setting */ - /* 0:8k 1:4k 2:2k 3:1k */ - break; - - case 0x5104: - /* GFX mode setting */ - /* - 00:split mode - 01:split & exgraffix - 10:ex-ram - 11:exram + write protect - */ - break; - - case 0x5105: - /* TODO: exram needs to fill in nametables 2-3 */ - ppu_mirror(value & 3, (value >> 2) & 3, (value >> 4) & 3, value >> 6); - break; - - case 0x5106: - case 0x5107: - /* ex-ram fill mode stuff */ - break; - - case 0x5113: - /* ram page for $6000-7FFF? bit 2*/ - break; - - case 0x5114: - mmc_bankrom(8, 0x8000, value); - //if (page_size == 8) - // mmc_bankrom(8, 0x8000, value); - break; - - case 0x5115: - mmc_bankrom(8, 0x8000, value); - mmc_bankrom(8, 0xA000, value + 1); - //if (page_size == 8) - // mmc_bankrom(8, 0xA000, value); - //else if (page_size == 16) - // mmc_bankrom(16, 0x8000, value >> 1); - //mmc_bankrom(16, 0x8000, value & 0xFE); - break; - - case 0x5116: - mmc_bankrom(8, 0xC000, value); - //if (page_size == 8) - // mmc_bankrom(8, 0xC000, value); - break; - - case 0x5117: - //if (page_size == 8) - // mmc_bankrom(8, 0xE000, value); - //else if (page_size == 16) - // mmc_bankrom(16, 0xC000, value >> 1); - //mmc_bankrom(16, 0xC000, value & 0xFE); - //else if (page_size == 32) - // mmc_bankrom(32, 0x8000, value >> 2); - //mmc_bankrom(32, 0x8000, value & 0xFC); - break; - - case 0x5120: - mmc_bankvrom(1, 0x0000, value); - break; - - case 0x5121: - mmc_bankvrom(1, 0x0400, value); - break; - - case 0x5122: - mmc_bankvrom(1, 0x0800, value); - break; - - case 0x5123: - mmc_bankvrom(1, 0x0C00, value); - break; - - case 0x5124: - case 0x5125: - case 0x5126: - case 0x5127: - /* more VROM shit? */ - break; - - case 0x5128: - mmc_bankvrom(1, 0x1000, value); - break; - - case 0x5129: - mmc_bankvrom(1, 0x1400, value); - break; - - case 0x512A: - mmc_bankvrom(1, 0x1800, value); - break; - - case 0x512B: - mmc_bankvrom(1, 0x1C00, value); - break; - - case 0x5203: - irq.counter = value; - irq.latch = value; -// irq.reset = false; - break; - - case 0x5204: - irq.enabled = (value & 0x80) ? true : false; -// irq.reset = false; - break; - - default: -#ifdef NOFRENDO_DEBUG - log_printf("unknown mmc5 write: $%02X to $%04X\n", value, address); -#endif /* NOFRENDO_DEBUG */ - break; - } -} - -static uint8 map5_read(uint32 address) -{ - /* Castlevania 3 IRQ counter */ - if (address == 0x5204) - { - /* if reset == 1, we've hit scanline */ - return (irq.reset ? 0x40 : 0x00); - } - else - { -#ifdef NOFRENDO_DEBUG - log_printf("invalid MMC5 read: $%04X", address); -#endif - return 0xFF; - } -} - -static void map5_init(void) -{ - mmc_bankrom(8, 0x8000, MMC_LASTBANK); - mmc_bankrom(8, 0xA000, MMC_LASTBANK); - mmc_bankrom(8, 0xC000, MMC_LASTBANK); - mmc_bankrom(8, 0xE000, MMC_LASTBANK); - - irq.counter = irq.enabled = 0; - irq.reset = irq.latch = 0; -} - -/* incomplete SNSS definition */ -static void map5_getstate(SnssMapperBlock *state) -{ - state->extraData.mapper5.dummy = 0; -} - -static void map5_setstate(SnssMapperBlock *state) -{ - UNUSED(state); -} - -static map_memwrite map5_memwrite[] = -{ - /* $5000 - $5015 handled by sound */ - { 0x5016, 0x5FFF, map5_write }, - { 0x8000, 0xFFFF, map5_write }, - { -1, -1, NULL } -}; - -static map_memread map5_memread[] = -{ - { 0x5204, 0x5204, map5_read }, - { -1, -1, NULL } -}; - -mapintf_t map5_intf = -{ - 5, /* mapper number */ - "MMC5", /* mapper name */ - map5_init, /* init routine */ - NULL, /* vblank callback */ - map5_hblank, /* hblank callback */ - map5_getstate, /* get state (snss) */ - map5_setstate, /* set state (snss) */ - map5_memread, /* memory read structure */ - map5_memwrite, /* memory write structure */ - &mmc5_ext /* external sound device */ -}; -/* -** $Log: map005.c,v $ -** Revision 1.2 2001/04/27 14:37:11 neil -** wheeee -** -** Revision 1.1 2001/04/27 12:54:40 neil -** blah -** -** Revision 1.1.1.1 2001/04/27 07:03:54 neil -** initial -** -** Revision 1.2 2000/11/25 20:32:33 matt -** scanline interface change -** -** Revision 1.1 2000/10/24 12:19:32 matt -** changed directory structure -** -** Revision 1.11 2000/10/22 19:17:46 matt -** mapper cleanups galore -** -** Revision 1.10 2000/10/21 19:33:37 matt -** many more cleanups -** -** Revision 1.9 2000/10/17 03:23:16 matt -** added mmc5 sound interface -** -** Revision 1.8 2000/10/10 13:58:17 matt -** stroustrup squeezing his way in the door -** -** Revision 1.7 2000/08/16 02:50:11 matt -** random mapper cleanups -** -** Revision 1.6 2000/07/15 23:52:19 matt -** rounded out a bunch more mapper interfaces -** -** Revision 1.5 2000/07/10 13:51:25 matt -** using generic nes_irq() routine now -** -** Revision 1.4 2000/07/10 05:29:03 matt -** cleaned up some mirroring issues -** -** Revision 1.3 2000/07/06 02:48:43 matt -** clearly labelled structure members -** -** Revision 1.2 2000/07/05 05:04:51 matt -** fixed h-blank callback -** -** Revision 1.1 2000/07/04 23:11:45 matt -** initial revision -** -*/ diff --git a/MCUME_pico/piconofrendo/map007.c b/MCUME_pico/piconofrendo/map007.c deleted file mode 100644 index f1530f1..0000000 --- a/MCUME_pico/piconofrendo/map007.c +++ /dev/null @@ -1,99 +0,0 @@ -/* -** Nofrendo (c) 1998-2000 Matthew Conte (matt@conte.com) -** -** -** This program is free software; you can redistribute it and/or -** modify it under the terms of version 2 of the GNU Library General -** Public License as published by the Free Software Foundation. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** Library General Public License for more details. To obtain a -** copy of the GNU Library General Public License, write to the Free -** Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -** -** Any permitted reproduction of these routines, in whole or in part, -** must bear this legend. -** -** -** map7.c -** -** mapper 7 interface -** $Id: map007.c,v 1.2 2001/04/27 14:37:11 neil Exp $ -*/ - -#include "noftypes.h" -#include "nes_mmc.h" -#include "nes_ppu.h" -#include "log.h" - -/* mapper 7: AOROM */ -static void map7_write(uint32 address, uint8 value) -{ - int mirror; - UNUSED(address); - - mmc_bankrom(32, 0x8000, value); - mirror = (value & 0x10) >> 4; - ppu_mirror(mirror, mirror, mirror, mirror); -} - -static void map7_init(void) -{ - mmc_bankrom(32, 0x8000, 0); -} - -static const map_memwrite map7_memwrite[] = -{ - { 0x8000, 0xFFFF, map7_write }, - { -1, -1, NULL } -}; - -const mapintf_t map7_intf = -{ - 7, /* mapper number */ - "AOROM", /* mapper name */ - map7_init, /* init routine */ - NULL, /* vblank callback */ - NULL, /* hblank callback */ - NULL, /* get state (snss) */ - NULL, /* set state (snss) */ - NULL, /* memory read structure */ - map7_memwrite, /* memory write structure */ - NULL /* external sound device */ -}; - -/* -** $Log: map007.c,v $ -** Revision 1.2 2001/04/27 14:37:11 neil -** wheeee -** -** Revision 1.1 2001/04/27 12:54:40 neil -** blah -** -** Revision 1.1.1.1 2001/04/27 07:03:54 neil -** initial -** -** Revision 1.1 2000/10/24 12:19:32 matt -** changed directory structure -** -** Revision 1.6 2000/10/22 19:17:46 matt -** mapper cleanups galore -** -** Revision 1.5 2000/10/22 15:03:13 matt -** simplified mirroring -** -** Revision 1.4 2000/10/21 19:33:38 matt -** many more cleanups -** -** Revision 1.3 2000/08/16 02:50:11 matt -** random mapper cleanups -** -** Revision 1.2 2000/07/06 02:48:43 matt -** clearly labelled structure members -** -** Revision 1.1 2000/07/04 23:11:45 matt -** initial revision -** -*/ diff --git a/MCUME_pico/piconofrendo/map008.c b/MCUME_pico/piconofrendo/map008.c deleted file mode 100644 index 5b7ad2b..0000000 --- a/MCUME_pico/piconofrendo/map008.c +++ /dev/null @@ -1,94 +0,0 @@ -/* -** Nofrendo (c) 1998-2000 Matthew Conte (matt@conte.com) -** -** -** This program is free software; you can redistribute it and/or -** modify it under the terms of version 2 of the GNU Library General -** Public License as published by the Free Software Foundation. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** Library General Public License for more details. To obtain a -** copy of the GNU Library General Public License, write to the Free -** Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -** -** Any permitted reproduction of these routines, in whole or in part, -** must bear this legend. -** -** -** map8.c -** -** mapper 8 interface -** $Id: map008.c,v 1.2 2001/04/27 14:37:11 neil Exp $ -*/ - -#include "noftypes.h" -#include "nes_mmc.h" - -/* mapper 8: FFE F3xxx -- what the hell uses this? */ -static void map8_write(uint32 address, uint8 value) -{ - UNUSED(address); - - mmc_bankrom(16, 0x8000, value >> 3); - mmc_bankvrom(8, 0x0000, value & 7); -} - -static void map8_init(void) -{ - mmc_bankrom(16, 0x8000, 0); - mmc_bankrom(16, 0xC000, 1); - mmc_bankvrom(8, 0x0000, 0); -} - -static const map_memwrite map8_memwrite[] = -{ - { 0x8000, 0xFFFF, map8_write }, - { -1, -1, NULL } -}; - -const mapintf_t map8_intf = -{ - 8, /* mapper number */ - "FFE F3xxx", /* mapper name */ - map8_init, /* init routine */ - NULL, /* vblank callback */ - NULL, /* hblank callback */ - NULL, /* get state (snss) */ - NULL, /* set state (snss) */ - NULL, /* memory read structure */ - map8_memwrite, /* memory write structure */ - NULL /* external sound device */ -}; - -/* -** $Log: map008.c,v $ -** Revision 1.2 2001/04/27 14:37:11 neil -** wheeee -** -** Revision 1.1 2001/04/27 12:54:40 neil -** blah -** -** Revision 1.1.1.1 2001/04/27 07:03:54 neil -** initial -** -** Revision 1.1 2000/10/24 12:19:32 matt -** changed directory structure -** -** Revision 1.5 2000/10/22 19:17:47 matt -** mapper cleanups galore -** -** Revision 1.4 2000/10/21 19:33:38 matt -** many more cleanups -** -** Revision 1.3 2000/08/16 02:50:11 matt -** random mapper cleanups -** -** Revision 1.2 2000/07/06 02:48:43 matt -** clearly labelled structure members -** -** Revision 1.1 2000/07/04 23:11:45 matt -** initial revision -** -*/ diff --git a/MCUME_pico/piconofrendo/map009.c b/MCUME_pico/piconofrendo/map009.c deleted file mode 100644 index c01c44e..0000000 --- a/MCUME_pico/piconofrendo/map009.c +++ /dev/null @@ -1,199 +0,0 @@ -/* -** Nofrendo (c) 1998-2000 Matthew Conte (matt@conte.com) -** -** -** This program is free software; you can redistribute it and/or -** modify it under the terms of version 2 of the GNU Library General -** Public License as published by the Free Software Foundation. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** Library General Public License for more details. To obtain a -** copy of the GNU Library General Public License, write to the Free -** Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -** -** Any permitted reproduction of these routines, in whole or in part, -** must bear this legend. -** -** -** map9.c -** -** mapper 9 interface -** $Id: map009.c,v 1.2 2001/04/27 14:37:11 neil Exp $ -*/ - -#include -#include "noftypes.h" -#include "nes_mmc.h" -#include "nes_ppu.h" -#include "libsnss.h" - -static uint8 latch[2]; -static uint8 regs[4]; - -/* Used when tile $FD/$FE is accessed */ -static void mmc9_latchfunc(uint32 address, uint8 value) -{ - if (0xFD == value || 0xFE == value) - { - int reg; - - if (address) - { - latch[1] = value; - reg = 2 + (value - 0xFD); - } - else - { - latch[0] = value; - reg = value - 0xFD; - } - - mmc_bankvrom(4, address, regs[reg]); - } -} - -/* mapper 9: MMC2 */ -/* MMC2: Punch-Out! */ -static void map9_write(uint32 address, uint8 value) -{ - switch ((address & 0xF000) >> 12) - { - case 0xA: - mmc_bankrom(8, 0x8000, value); - break; - - case 0xB: - regs[0] = value; - if (0xFD == latch[0]) - mmc_bankvrom(4, 0x0000, value); - break; - - case 0xC: - regs[1] = value; - if (0xFE == latch[0]) - mmc_bankvrom(4, 0x0000, value); - break; - - case 0xD: - regs[2] = value; - if (0xFD == latch[1]) - mmc_bankvrom(4, 0x1000, value); - break; - - case 0xE: - regs[3] = value; - if (0xFE == latch[1]) - mmc_bankvrom(4, 0x1000, value); - break; - - case 0xF: - if (value & 1) - ppu_mirror(0, 0, 1, 1); /* horizontal */ - else - ppu_mirror(0, 1, 0, 1); /* vertical */ - break; - - default: - break; - } -} - -static void map9_init(void) -{ - memset(regs, 0, sizeof(regs)); - - mmc_bankrom(8, 0x8000, 0); - mmc_bankrom(8, 0xA000, (mmc_getinfo()->rom_banks * 2) - 3); - mmc_bankrom(8, 0xC000, (mmc_getinfo()->rom_banks * 2) - 2); - mmc_bankrom(8, 0xE000, (mmc_getinfo()->rom_banks * 2) - 1); - - latch[0] = 0xFE; - latch[1] = 0xFE; - - ppu_setlatchfunc(mmc9_latchfunc); -} - -static void map9_getstate(SnssMapperBlock *state) -{ - state->extraData.mapper9.latch[0] = latch[0]; - state->extraData.mapper9.latch[1] = latch[1]; - state->extraData.mapper9.lastB000Write = regs[0]; - state->extraData.mapper9.lastC000Write = regs[1]; - state->extraData.mapper9.lastD000Write = regs[2]; - state->extraData.mapper9.lastE000Write = regs[3]; -} - -static void map9_setstate(SnssMapperBlock *state) -{ - latch[0] = state->extraData.mapper9.latch[0]; - latch[1] = state->extraData.mapper9.latch[1]; - regs[0] = state->extraData.mapper9.lastB000Write; - regs[1] = state->extraData.mapper9.lastC000Write; - regs[2] = state->extraData.mapper9.lastD000Write; - regs[3] = state->extraData.mapper9.lastE000Write; -} - -static map_memwrite map9_memwrite[] = -{ - { 0x8000, 0xFFFF, map9_write }, - { -1, -1, NULL } -}; - -const mapintf_t map9_intf = -{ - 9, /* mapper number */ - "MMC2", /* mapper name */ - map9_init, /* init routine */ - NULL, /* vblank callback */ - NULL, /* hblank callback */ - map9_getstate, /* get state (snss) */ - map9_setstate, /* set state (snss) */ - NULL, /* memory read structure */ - map9_memwrite, /* memory write structure */ - NULL /* external sound device */ -}; - -/* -** $Log: map009.c,v $ -** Revision 1.2 2001/04/27 14:37:11 neil -** wheeee -** -** Revision 1.1 2001/04/27 12:54:40 neil -** blah -** -** Revision 1.1.1.1 2001/04/27 07:03:54 neil -** initial -** -** Revision 1.1 2000/10/24 12:19:33 matt -** changed directory structure -** -** Revision 1.9 2000/10/22 19:17:46 matt -** mapper cleanups galore -** -** Revision 1.8 2000/10/22 15:03:14 matt -** simplified mirroring -** -** Revision 1.7 2000/10/21 19:33:38 matt -** many more cleanups -** -** Revision 1.6 2000/07/17 05:11:35 matt -** minor update from making PPU code less filthy -** -** Revision 1.5 2000/07/15 23:52:19 matt -** rounded out a bunch more mapper interfaces -** -** Revision 1.4 2000/07/10 05:29:03 matt -** cleaned up some mirroring issues -** -** Revision 1.3 2000/07/06 02:48:43 matt -** clearly labelled structure members -** -** Revision 1.2 2000/07/05 22:50:33 matt -** fixed punchout -- works 100% now -** -** Revision 1.1 2000/07/05 05:05:18 matt -** initial revision -** -*/ diff --git a/MCUME_pico/piconofrendo/map011.c b/MCUME_pico/piconofrendo/map011.c deleted file mode 100644 index f253945..0000000 --- a/MCUME_pico/piconofrendo/map011.c +++ /dev/null @@ -1,94 +0,0 @@ -/* -** Nofrendo (c) 1998-2000 Matthew Conte (matt@conte.com) -** -** -** This program is free software; you can redistribute it and/or -** modify it under the terms of version 2 of the GNU Library General -** Public License as published by the Free Software Foundation. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** Library General Public License for more details. To obtain a -** copy of the GNU Library General Public License, write to the Free -** Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -** -** Any permitted reproduction of these routines, in whole or in part, -** must bear this legend. -** -** -** map11.c -** -** mapper 11 interface -** $Id: map011.c,v 1.2 2001/04/27 14:37:11 neil Exp $ -*/ - -#include "noftypes.h" -#include "nes_mmc.h" - - -/* mapper 11: Color Dreams, Wisdom Tree */ -static void map11_write(uint32 address, uint8 value) -{ - UNUSED(address); - - mmc_bankrom(32, 0x8000, value & 0x0F); - mmc_bankvrom(8, 0x0000, value >> 4); -} - -static void map11_init(void) -{ - mmc_bankrom(32, 0x8000, 0); - mmc_bankvrom(8, 0x0000, 0); -} - -static const map_memwrite map11_memwrite[] = -{ - { 0x8000, 0xFFFF, map11_write }, - { -1, -1, NULL } -}; - -const mapintf_t map11_intf = -{ - 11, /* mapper number */ - "Color Dreams", /* mapper name */ - map11_init, /* init routine */ - NULL, /* vblank callback */ - NULL, /* hblank callback */ - NULL, /* get state (snss) */ - NULL, /* set state (snss) */ - NULL, /* memory read structure */ - map11_memwrite, /* memory write structure */ - NULL /* external sound device */ -}; - -/* -** $Log: map011.c,v $ -** Revision 1.2 2001/04/27 14:37:11 neil -** wheeee -** -** Revision 1.1 2001/04/27 12:54:40 neil -** blah -** -** Revision 1.1.1.1 2001/04/27 07:03:54 neil -** initial -** -** Revision 1.1 2000/10/24 12:19:33 matt -** changed directory structure -** -** Revision 1.5 2000/10/22 19:17:46 matt -** mapper cleanups galore -** -** Revision 1.4 2000/10/21 19:33:38 matt -** many more cleanups -** -** Revision 1.3 2000/08/16 02:50:11 matt -** random mapper cleanups -** -** Revision 1.2 2000/07/06 02:48:43 matt -** clearly labelled structure members -** -** Revision 1.1 2000/07/04 23:11:45 matt -** initial revision -** -*/ diff --git a/MCUME_pico/piconofrendo/map015.c b/MCUME_pico/piconofrendo/map015.c deleted file mode 100644 index d1b3b63..0000000 --- a/MCUME_pico/piconofrendo/map015.c +++ /dev/null @@ -1,144 +0,0 @@ -/* -** Nofrendo (c) 1998-2000 Matthew Conte (matt@conte.com) -** -** -** This program is free software; you can redistribute it and/or -** modify it under the terms of version 2 of the GNU Library General -** Public License as published by the Free Software Foundation. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** Library General Public License for more details. To obtain a -** copy of the GNU Library General Public License, write to the Free -** Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -** -** Any permitted reproduction of these routines, in whole or in part, -** must bear this legend. -** -** -** map15.c -** -** mapper 15 interface -** $Id: map015.c,v 1.2 2001/04/27 14:37:11 neil Exp $ -*/ - -#include "noftypes.h" -#include "nes_mmc.h" -#include "nes_ppu.h" - -/* mapper 15: Contra 100-in-1 */ -static void map15_write(uint32 address, uint8 value) -{ - int bank = value & 0x3F; - uint8 swap = (value & 0x80) >> 7; - - switch (address & 0x3) - { - case 0: - mmc_bankrom(8, 0x8000, (bank << 1) + swap); - mmc_bankrom(8, 0xA000, (bank << 1) + (swap ^ 1)); - mmc_bankrom(8, 0xC000, ((bank + 1) << 1) + swap); - mmc_bankrom(8, 0xE000, ((bank + 1) << 1) + (swap ^ 1)); - - if (value & 0x40) - ppu_mirror(0, 0, 1, 1); /* horizontal */ - else - ppu_mirror(0, 1, 0, 1); /* vertical */ - break; - - case 1: - mmc_bankrom(8, 0xC000, (bank << 1) + swap); - mmc_bankrom(8, 0xE000, (bank << 1) + (swap ^ 1)); - break; - - case 2: - if (swap) - { - mmc_bankrom(8, 0x8000, (bank << 1) + 1); - mmc_bankrom(8, 0xA000, (bank << 1) + 1); - mmc_bankrom(8, 0xC000, (bank << 1) + 1); - mmc_bankrom(8, 0xE000, (bank << 1) + 1); - } - else - { - mmc_bankrom(8, 0x8000, (bank << 1)); - mmc_bankrom(8, 0xA000, (bank << 1)); - mmc_bankrom(8, 0xC000, (bank << 1)); - mmc_bankrom(8, 0xE000, (bank << 1)); - } - break; - - case 3: - mmc_bankrom(8, 0xC000, (bank << 1) + swap); - mmc_bankrom(8, 0xE000, (bank << 1) + (swap ^ 1)); - - if (value & 0x40) - ppu_mirror(0, 0, 1, 1); /* horizontal */ - else - ppu_mirror(0, 1, 0, 1); /* vertical */ - break; - - default: - break; - } -} - -static void map15_init(void) -{ - mmc_bankrom(32, 0x8000, 0); -} - -static const map_memwrite map15_memwrite[] = -{ - { 0x8000, 0xFFFF, map15_write }, - { -1, -1, NULL } -}; - -const mapintf_t map15_intf = -{ - 15, /* mapper number */ - "Contra 100-in-1", /* mapper name */ - map15_init, /* init routine */ - NULL, /* vblank callback */ - NULL, /* hblank callback */ - NULL, /* get state (snss) */ - NULL, /* set state (snss) */ - NULL, /* memory read structure */ - map15_memwrite, /* memory write structure */ - NULL /* external sound device */ -}; - -/* -** $Log: map015.c,v $ -** Revision 1.2 2001/04/27 14:37:11 neil -** wheeee -** -** Revision 1.1 2001/04/27 12:54:40 neil -** blah -** -** Revision 1.1.1.1 2001/04/27 07:03:54 neil -** initial -** -** Revision 1.1 2000/10/24 12:19:33 matt -** changed directory structure -** -** Revision 1.6 2000/10/22 19:17:46 matt -** mapper cleanups galore -** -** Revision 1.5 2000/10/22 15:03:13 matt -** simplified mirroring -** -** Revision 1.4 2000/10/21 19:33:38 matt -** many more cleanups -** -** Revision 1.3 2000/07/10 05:29:03 matt -** cleaned up some mirroring issues -** -** Revision 1.2 2000/07/06 02:48:43 matt -** clearly labelled structure members -** -** Revision 1.1 2000/07/05 05:05:18 matt -** initial revision -** -*/ diff --git a/MCUME_pico/piconofrendo/map016.c b/MCUME_pico/piconofrendo/map016.c deleted file mode 100755 index 3d193b1..0000000 --- a/MCUME_pico/piconofrendo/map016.c +++ /dev/null @@ -1,192 +0,0 @@ -/* -** Nofrendo (c) 1998-2000 Matthew Conte (matt@conte.com) -** -** -** This program is free software; you can redistribute it and/or -** modify it under the terms of version 2 of the GNU Library General -** Public License as published by the Free Software Foundation. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** Library General Public License for more details. To obtain a -** copy of the GNU Library General Public License, write to the Free -** Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -** -** Any permitted reproduction of these routines, in whole or in part, -** must bear this legend. -** -** -** map16.c -** -** mapper 16 interface -** $Id: map016.c,v 1.2 2001/04/27 14:37:11 neil Exp $ -*/ - -#include "noftypes.h" -#include "nes_mmc.h" -#include "nes_ppu.h" -#include "nes.h" - -static struct -{ - int counter; - bool enabled; -} irq; - -/* mapper 16: Bandai */ - -static void map16_init(void) -{ - mmc_bankrom(16, 0x8000, 0); - mmc_bankrom(16, 0xC000, MMC_LASTBANK); - irq.counter = 0; - irq.enabled = false; -} - -static void map16_write(uint32 address, uint8 value) -{ - int reg = address & 0xF; - - if (reg < 8) - { - mmc_bankvrom(1, reg << 10, value); - } - else - { - switch (address & 0x000F) - { - case 0x8: - mmc_bankrom(16, 0x8000, value); - break; - - case 0x9: - switch (value & 3) - { - case 0: - ppu_mirror(0, 0, 1, 1); /* horizontal */ - break; - - case 1: - ppu_mirror(0, 1, 0, 1); /* vertical */ - break; - - case 2: - ppu_mirror(0, 0, 0, 0); - break; - - case 3: - ppu_mirror(1, 1, 1, 1); - break; - } - break; - - case 0xA: - irq.enabled = (value & 1) ? true : false; - break; - - case 0xB: - irq.counter = (irq.counter & 0xFF00) | value; - break; - - case 0xC: - irq.counter = (value << 8) | (irq.counter & 0xFF); - break; - - case 0xD: - /* eeprom I/O port? */ - break; - } - } -} - -static void map16_hblank(int vblank) -{ - UNUSED(vblank); - - if (irq.enabled) - { - if (irq.counter) - { - if (0 == --irq.counter) - nes_irq(); - } - } -} - -static void map16_getstate(SnssMapperBlock *state) -{ - state->extraData.mapper16.irqCounterLowByte = irq.counter & 0xFF; - state->extraData.mapper16.irqCounterHighByte = irq.counter >> 8; - state->extraData.mapper16.irqCounterEnabled = irq.enabled; -} - -static void map16_setstate(SnssMapperBlock *state) -{ - irq.counter = (state->extraData.mapper16.irqCounterHighByte << 8) - | state->extraData.mapper16.irqCounterLowByte; - irq.enabled = state->extraData.mapper16.irqCounterEnabled; -} - -static const map_memwrite map16_memwrite[] = -{ - { 0x6000, 0x600D, map16_write }, - { 0x7FF0, 0x7FFD, map16_write }, - { 0x8000, 0x800D, map16_write }, - { -1, -1, NULL } -}; - -const mapintf_t map16_intf = -{ - 16, /* mapper number */ - "Bandai", /* mapper name */ - map16_init, /* init routine */ - NULL, /* vblank callback */ - map16_hblank, /* hblank callback */ - map16_getstate, /* get state (snss) */ - map16_setstate, /* set state (snss) */ - NULL, /* memory read structure */ - map16_memwrite, /* memory write structure */ - NULL /* external sound device */ -}; - -/* -** $Log: map016.c,v $ -** Revision 1.2 2001/04/27 14:37:11 neil -** wheeee -** -** Revision 1.1 2001/04/27 12:54:40 neil -** blah -** -** Revision 1.1.1.1 2001/04/27 07:03:54 neil -** initial -** -** Revision 1.1 2000/10/24 12:19:33 matt -** changed directory structure -** -** Revision 1.8 2000/10/22 19:17:46 matt -** mapper cleanups galore -** -** Revision 1.7 2000/10/22 15:03:13 matt -** simplified mirroring -** -** Revision 1.6 2000/10/21 19:33:38 matt -** many more cleanups -** -** Revision 1.5 2000/10/10 13:58:16 matt -** stroustrup squeezing his way in the door -** -** Revision 1.4 2000/08/16 02:50:11 matt -** random mapper cleanups -** -** Revision 1.3 2000/07/15 23:52:20 matt -** rounded out a bunch more mapper interfaces -** -** Revision 1.2 2000/07/11 05:03:49 matt -** value masking isn't necessary for the banking routines -** -** Revision 1.1 2000/07/11 03:14:18 melanson -** Initial commit for mappers 16, 34, and 231 -** -** -*/ diff --git a/MCUME_pico/piconofrendo/map018.c b/MCUME_pico/piconofrendo/map018.c deleted file mode 100755 index 6f182ef..0000000 --- a/MCUME_pico/piconofrendo/map018.c +++ /dev/null @@ -1,215 +0,0 @@ -/* -** Nofrendo (c) 1998-2000 Matthew Conte (matt@conte.com) -** -** -** This program is free software; you can redistribute it and/or -** modify it under the terms of version 2 of the GNU Library General -** Public License as published by the Free Software Foundation. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** Library General Public License for more details. To obtain a -** copy of the GNU Library General Public License, write to the Free -** Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -** -** Any permitted reproduction of these routines, in whole or in part, -** must bear this legend. -** -** -** map18.c -** -** mapper 18 interface -** $Id: map018.c,v 1.2 2001/04/27 14:37:11 neil Exp $ -*/ - -#include "noftypes.h" -#include "nes_mmc.h" -#include "nes_ppu.h" - -/* mapper 18: Jaleco SS8806 */ -#define VRC_PBANK(bank, value, high) \ -do { \ - if ((high)) \ - highprgnybbles[(bank)] = (value) & 0x0F; \ - else \ - lowprgnybbles[(bank)] = (value) & 0x0F; \ - mmc_bankrom(8, 0x8000 + ((bank) << 13), (highprgnybbles[(bank)] << 4)+lowprgnybbles[(bank)]); \ -} while (0) - -#define VRC_VBANK(bank, value, high) \ -{ \ - if ((high)) \ - highnybbles[(bank)] = (value) & 0x0F; \ - else \ - lownybbles[(bank)] = (value) & 0x0F; \ - mmc_bankvrom(1, (bank) << 10, (highnybbles[(bank)] << 4)+lownybbles[(bank)]); \ -} - -static struct -{ - int counter, enabled; - uint8 nybbles[4]; - int clockticks; -} irq; - -static void map18_init(void) -{ - irq.counter = irq.enabled = 0; -} - -static uint8 lownybbles[8]; -static uint8 highnybbles[8]; -static uint8 lowprgnybbles[3]; -static uint8 highprgnybbles[3]; - - -static void map18_write(uint32 address, uint8 value) -{ - switch (address) - { - case 0x8000: VRC_PBANK(0, value, 0); break; - case 0x8001: VRC_PBANK(0, value, 1); break; - case 0x8002: VRC_PBANK(1, value, 0); break; - case 0x8003: VRC_PBANK(1, value, 1); break; - case 0x9000: VRC_PBANK(2, value, 0); break; - case 0x9001: VRC_PBANK(2, value, 1); break; - case 0xA000: VRC_VBANK(0, value, 0); break; - case 0xA001: VRC_VBANK(0, value, 1); break; - case 0xA002: VRC_VBANK(1, value, 0); break; - case 0xA003: VRC_VBANK(1, value, 1); break; - case 0xB000: VRC_VBANK(2, value, 0); break; - case 0xB001: VRC_VBANK(2, value, 1); break; - case 0xB002: VRC_VBANK(3, value, 0); break; - case 0xB003: VRC_VBANK(3, value, 1); break; - case 0xC000: VRC_VBANK(4, value, 0); break; - case 0xC001: VRC_VBANK(4, value, 1); break; - case 0xC002: VRC_VBANK(5, value, 0); break; - case 0xC003: VRC_VBANK(5, value, 1); break; - case 0xD000: VRC_VBANK(6, value, 0); break; - case 0xD001: VRC_VBANK(6, value, 1); break; - case 0xD002: VRC_VBANK(7, value, 0); break; - case 0xD003: VRC_VBANK(7, value, 1); break; - case 0xE000: - irq.nybbles[0]=value&0x0F; - irq.clockticks= (irq.nybbles[0]) | (irq.nybbles[1]<<4) | - (irq.nybbles[2]<<8) | (irq.nybbles[3]<<12); - irq.counter=(uint8)(irq.clockticks/114); - if(irq.counter>15) irq.counter-=16; - break; - case 0xE001: - irq.nybbles[1]=value&0x0F; - irq.clockticks= (irq.nybbles[0]) | (irq.nybbles[1]<<4) | - (irq.nybbles[2]<<8) | (irq.nybbles[3]<<12); - irq.counter=(uint8)(irq.clockticks/114); - if(irq.counter>15) irq.counter-=16; - break; - case 0xE002: - irq.nybbles[2]=value&0x0F; - irq.clockticks= (irq.nybbles[0]) | (irq.nybbles[1]<<4) | - (irq.nybbles[2]<<8) | (irq.nybbles[3]<<12); - irq.counter=(uint8)(irq.clockticks/114); - if(irq.counter>15) irq.counter-=16; - break; - case 0xE003: - irq.nybbles[3]=value&0x0F; - irq.clockticks= (irq.nybbles[0]) | (irq.nybbles[1]<<4) | - (irq.nybbles[2]<<8) | (irq.nybbles[3]<<12); - irq.counter=(uint8)(irq.clockticks/114); - if(irq.counter>15) irq.counter-=16; - break; - case 0xF000: - if(value&0x01) irq.enabled=true; - break; - case 0xF001: - irq.enabled=value&0x01; - break; - case 0xF002: - switch(value&0x03) - { - case 0: ppu_mirror(0, 0, 1, 1); break; - case 1: ppu_mirror(0, 1, 0, 1); break; - case 2: ppu_mirror(1,1,1,1);break; - case 3: ppu_mirror(1,1,1,1);break; // should this be zero? - default: break; - } - break; - default: - break; - } -} - - -static const map_memwrite map18_memwrite[] = -{ - { 0x8000, 0xFFFF, map18_write }, - { -1, -1, NULL } -}; - -static void map18_getstate(SnssMapperBlock *state) -{ - state->extraData.mapper18.irqCounterLowByte = irq.counter & 0xFF; - state->extraData.mapper18.irqCounterHighByte = irq.counter >> 8; - state->extraData.mapper18.irqCounterEnabled = irq.enabled; -} - -static void map18_setstate(SnssMapperBlock *state) -{ - irq.counter = (state->extraData.mapper18.irqCounterHighByte << 8) - | state->extraData.mapper18.irqCounterLowByte; - irq.enabled = state->extraData.mapper18.irqCounterEnabled; -} - -const mapintf_t map18_intf = -{ - 18, /* mapper number */ - "Jaleco SS8806", /* mapper name */ - map18_init, /* init routine */ - NULL, /* vblank callback */ - NULL, /* hblank callback */ - map18_getstate, /* get state (snss) */ - map18_setstate, /* set state (snss) */ - NULL, /* memory read structure */ - map18_memwrite, /* memory write structure */ - NULL /* external sound device */ -}; - -/* -** $Log: map018.c,v $ -** Revision 1.2 2001/04/27 14:37:11 neil -** wheeee -** -** Revision 1.1 2001/04/27 12:54:40 neil -** blah -** -** Revision 1.1.1.1 2001/04/27 07:03:54 neil -** initial -** -** Revision 1.1 2000/10/24 12:19:33 matt -** changed directory structure -** -** Revision 1.8 2000/10/22 19:17:46 matt -** mapper cleanups galore -** -** Revision 1.7 2000/10/22 15:03:13 matt -** simplified mirroring -** -** Revision 1.6 2000/10/21 19:33:38 matt -** many more cleanups -** -** Revision 1.5 2000/10/10 13:58:17 matt -** stroustrup squeezing his way in the door -** -** Revision 1.4 2000/07/15 23:52:19 matt -** rounded out a bunch more mapper interfaces -** -** Revision 1.3 2000/07/10 05:29:03 matt -** cleaned up some mirroring issues -** -** Revision 1.2 2000/07/06 02:48:42 matt -** clearly labelled structure members -** -** Revision 1.1 2000/07/06 01:01:56 matt -** initial revision -** -*/ diff --git a/MCUME_pico/piconofrendo/map019.c b/MCUME_pico/piconofrendo/map019.c deleted file mode 100755 index e5f6f1c..0000000 --- a/MCUME_pico/piconofrendo/map019.c +++ /dev/null @@ -1,170 +0,0 @@ -/* -** Nofrendo (c) 1998-2000 Matthew Conte (matt@conte.com) -** -** -** This program is free software; you can redistribute it and/or -** modify it under the terms of version 2 of the GNU Library General -** Public License as published by the Free Software Foundation. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** Library General Public License for more details. To obtain a -** copy of the GNU Library General Public License, write to the Free -** Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -** -** Any permitted reproduction of these routines, in whole or in part, -** must bear this legend. -** -** -** map19.c -** -** mapper 19 interface -** $Id: map019.c,v 1.2 2001/04/27 14:37:11 neil Exp $ -*/ - -#include "noftypes.h" -#include "nes_mmc.h" -#include "nes_ppu.h" - -/* TODO: shouldn't there be an h-blank IRQ handler??? */ - -/* Special mirroring macro for mapper 19 */ -#define N_BANK1(table, value) \ -{ \ - if ((value) < 0xE0) \ - ppu_setpage(1, (table) + 8, &mmc_getinfo()->vrom[((value) % (mmc_getinfo()->vrom_banks * 8)) << 10] - (0x2000 + ((table) << 10))); \ - else \ - ppu_setpage(1, (table) + 8, &mmc_getinfo()->vram[((value) & 7) << 10] - (0x2000 + ((table) << 10))); \ - ppu_mirrorhipages(); \ -} - -static struct -{ - int counter, enabled; -} irq; - -static void map19_init(void) -{ - irq.counter = irq.enabled = 0; -} - -/* mapper 19: Namcot 106 */ -static void map19_write(uint32 address, uint8 value) -{ - int reg = address >> 11; - switch (reg) - { - case 0xA: - irq.counter &= ~0xFF; - irq.counter |= value; - break; - - case 0xB: - irq.counter = ((value & 0x7F) << 8) | (irq.counter & 0xFF); - irq.enabled = (value & 0x80) ? true : false; - break; - - case 0x10: - case 0x11: - case 0x12: - case 0x13: - case 0x14: - case 0x15: - case 0x16: - case 0x17: - mmc_bankvrom(1, (reg & 7) << 10, value); - break; - - case 0x18: - case 0x19: - case 0x1A: - case 0x1B: - N_BANK1(reg & 3, value); - break; - - case 0x1C: - mmc_bankrom(8, 0x8000, value); - break; - - case 0x1D: - mmc_bankrom(8, 0xA000, value); - break; - - case 0x1E: - mmc_bankrom(8, 0xC000, value); - break; - - default: - break; - } -} - -static void map19_getstate(SnssMapperBlock *state) -{ - state->extraData.mapper19.irqCounterLowByte = irq.counter & 0xFF; - state->extraData.mapper19.irqCounterHighByte = irq.counter >> 8; - state->extraData.mapper19.irqCounterEnabled = irq.enabled; -} - -static void map19_setstate(SnssMapperBlock *state) -{ - irq.counter = (state->extraData.mapper19.irqCounterHighByte << 8) - | state->extraData.mapper19.irqCounterLowByte; - irq.enabled = state->extraData.mapper19.irqCounterEnabled; -} - -static const map_memwrite map19_memwrite[] = -{ - { 0x5000, 0x5FFF, map19_write }, - { 0x8000, 0xFFFF, map19_write }, - { -1, -1, NULL } -}; - -const mapintf_t map19_intf = -{ - 19, /* mapper number */ - "Namcot 106", /* mapper name */ - map19_init, /* init routine */ - NULL, /* vblank callback */ - NULL, /* hblank callback */ - map19_getstate, /* get state (snss) */ - map19_setstate, /* set state (snss) */ - NULL, /* memory read structure */ - map19_memwrite, /* memory write structure */ - NULL /* external sound device */ -}; - -/* -** $Log: map019.c,v $ -** Revision 1.2 2001/04/27 14:37:11 neil -** wheeee -** -** Revision 1.1 2001/04/27 12:54:40 neil -** blah -** -** Revision 1.1.1.1 2001/04/27 07:03:54 neil -** initial -** -** Revision 1.1 2000/10/24 12:19:33 matt -** changed directory structure -** -** Revision 1.6 2000/10/22 19:17:46 matt -** mapper cleanups galore -** -** Revision 1.5 2000/10/21 19:33:38 matt -** many more cleanups -** -** Revision 1.4 2000/10/10 13:58:17 matt -** stroustrup squeezing his way in the door -** -** Revision 1.3 2000/07/15 23:52:20 matt -** rounded out a bunch more mapper interfaces -** -** Revision 1.2 2000/07/06 02:48:43 matt -** clearly labelled structure members -** -** Revision 1.1 2000/07/06 01:01:56 matt -** initial revision -** -*/ diff --git a/MCUME_pico/piconofrendo/map024.c b/MCUME_pico/piconofrendo/map024.c deleted file mode 100755 index 785e215..0000000 --- a/MCUME_pico/piconofrendo/map024.c +++ /dev/null @@ -1,235 +0,0 @@ -/* -** Nofrendo (c) 1998-2000 Matthew Conte (matt@conte.com) -** -** -** This program is free software; you can redistribute it and/or -** modify it under the terms of version 2 of the GNU Library General -** Public License as published by the Free Software Foundation. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** Library General Public License for more details. To obtain a -** copy of the GNU Library General Public License, write to the Free -** Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -** -** Any permitted reproduction of these routines, in whole or in part, -** must bear this legend. -** -** -** map24.c -** -** mapper 24 interface -** $Id: map024.c,v 1.2 2001/04/27 14:37:11 neil Exp $ -*/ - -#include "noftypes.h" -#include "nes_mmc.h" -#include "nes.h" -#include "log.h" -#include "vrcvisnd.h" - -static struct -{ - int counter, enabled; - int latch, wait_state; -} irq; - -static void map24_init(void) -{ - irq.counter = irq.enabled = 0; - irq.latch = irq.wait_state = 0; -} - -static void map24_hblank(int vblank) -{ - UNUSED(vblank); - - if (irq.enabled) - { - if (256 == ++irq.counter) - { - irq.counter = irq.latch; - nes_irq(); - //irq.enabled = false; - irq.enabled = irq.wait_state; - } - } -} - -static void map24_write(uint32 address, uint8 value) -{ - switch (address & 0xF003) - { - case 0x8000: - mmc_bankrom(16, 0x8000, value); - break; - - case 0x9003: - /* ??? */ - break; - - case 0xB003: - switch (value & 0x0C) - { - case 0x00: - ppu_mirror(0, 1, 0, 1); /* vertical */ - break; - - case 0x04: - ppu_mirror(0, 0, 1, 1); /* horizontal */ - break; - - case 0x08: - ppu_mirror(0, 0, 0, 0); - break; - - case 0x0C: - ppu_mirror(1, 1, 1, 1); - break; - - default: - break; - } - break; - - - case 0xC000: - mmc_bankrom(8, 0xC000, value); - break; - - case 0xD000: - mmc_bankvrom(1, 0x0000, value); - break; - - case 0xD001: - mmc_bankvrom(1, 0x0400, value); - break; - - case 0xD002: - mmc_bankvrom(1, 0x0800, value); - break; - - case 0xD003: - mmc_bankvrom(1, 0x0C00, value); - break; - - case 0xE000: - mmc_bankvrom(1, 0x1000, value); - break; - - case 0xE001: - mmc_bankvrom(1, 0x1400, value); - break; - - case 0xE002: - mmc_bankvrom(1, 0x1800, value); - break; - - case 0xE003: - mmc_bankvrom(1, 0x1C00, value); - break; - - case 0xF000: - irq.latch = value; - break; - - case 0xF001: - irq.enabled = (value >> 1) & 0x01; - irq.wait_state = value & 0x01; - if (irq.enabled) - irq.counter = irq.latch; - break; - - case 0xF002: - irq.enabled = irq.wait_state; - break; - - default: -#ifdef NOFRENDO_DEBUG - log_printf("invalid VRC6 write: $%02X to $%04X", value, address); -#endif - break; - } -} - -static void map24_getstate(SnssMapperBlock *state) -{ - state->extraData.mapper24.irqCounter = irq.counter; - state->extraData.mapper24.irqCounterEnabled = irq.enabled; -} - -static void map24_setstate(SnssMapperBlock *state) -{ - irq.counter = state->extraData.mapper24.irqCounter; - irq.enabled = state->extraData.mapper24.irqCounterEnabled; -} - -static const map_memwrite map24_memwrite[] = -{ - { 0x8000, 0xF002, map24_write }, - { -1, -1, NULL } -}; - -mapintf_t const map24_intf = -{ - 24, /* mapper number */ - "Konami VRC6", /* mapper name */ - map24_init, /* init routine */ - NULL, /* vblank callback */ - map24_hblank, /* hblank callback */ - map24_getstate, /* get state (snss) */ - map24_setstate, /* set state (snss) */ - NULL, /* memory read structure */ - map24_memwrite, /* memory write structure */ - &vrcvi_ext /* external sound device */ -}; - -/* -** $Log: map024.c,v $ -** Revision 1.2 2001/04/27 14:37:11 neil -** wheeee -** -** Revision 1.1 2001/04/27 12:54:40 neil -** blah -** -** Revision 1.1.1.1 2001/04/27 07:03:54 neil -** initial -** -** Revision 1.1 2000/10/24 12:19:33 matt -** changed directory structure -** -** Revision 1.11 2000/10/22 19:17:46 matt -** mapper cleanups galore -** -** Revision 1.10 2000/10/22 15:03:13 matt -** simplified mirroring -** -** Revision 1.9 2000/10/21 19:33:38 matt -** many more cleanups -** -** Revision 1.8 2000/10/10 13:58:17 matt -** stroustrup squeezing his way in the door -** -** Revision 1.7 2000/10/09 12:00:53 matt -** removed old code -** -** Revision 1.6 2000/08/16 02:50:11 matt -** random mapper cleanups -** -** Revision 1.5 2000/07/15 23:52:19 matt -** rounded out a bunch more mapper interfaces -** -** Revision 1.4 2000/07/10 13:51:25 matt -** using generic nes_irq() routine now -** -** Revision 1.3 2000/07/10 05:29:03 matt -** cleaned up some mirroring issues -** -** Revision 1.2 2000/07/06 02:48:43 matt -** clearly labelled structure members -** -** Revision 1.1 2000/07/04 23:11:45 matt -** initial revision -** -*/ diff --git a/MCUME_pico/piconofrendo/map032.c b/MCUME_pico/piconofrendo/map032.c deleted file mode 100755 index 6719678..0000000 --- a/MCUME_pico/piconofrendo/map032.c +++ /dev/null @@ -1,121 +0,0 @@ -/* -** Nofrendo (c) 1998-2000 Matthew Conte (matt@conte.com) -** -** -** This program is free software; you can redistribute it and/or -** modify it under the terms of version 2 of the GNU Library General -** Public License as published by the Free Software Foundation. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** Library General Public License for more details. To obtain a -** copy of the GNU Library General Public License, write to the Free -** Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -** -** Any permitted reproduction of these routines, in whole or in part, -** must bear this legend. -** -** -** map32.c -** -** mapper 32 interface -** $Id: map032.c,v 1.2 2001/04/27 14:37:11 neil Exp $ -*/ - -#include "noftypes.h" -#include "nes_mmc.h" -#include "nes_ppu.h" - -static int select_c000 = 0; - -/* mapper 32: Irem G-101 */ -static void map32_write(uint32 address, uint8 value) -{ - switch (address >> 12) - { - case 0x08: - if (select_c000) - mmc_bankrom(8, 0xC000, value); - else - mmc_bankrom(8, 0x8000, value); - break; - - case 0x09: - if (value & 1) - ppu_mirror(0, 0, 1, 1); /* horizontal */ - else - ppu_mirror(0, 1, 0, 1); /* vertical */ - - select_c000 = (value & 0x02); - break; - - case 0x0A: - mmc_bankrom(8, 0xA000, value); - break; - - case 0x0B: - { - int loc = (address & 0x07) << 10; - mmc_bankvrom(1, loc, value); - } - break; - - default: - break; - } -} - -static const map_memwrite map32_memwrite[] = -{ - { 0x8000, 0xFFFF, map32_write }, - { -1, -1, NULL } -}; - -const mapintf_t map32_intf = -{ - 32, /* mapper number */ - "Irem G-101", /* mapper name */ - NULL, /* init routine */ - NULL, /* vblank callback */ - NULL, /* hblank callback */ - NULL, /* get state (snss) */ - NULL, /* set state (snss) */ - NULL, /* memory read structure */ - map32_memwrite, /* memory write structure */ - NULL /* external sound device */ -}; - -/* -** $Log: map032.c,v $ -** Revision 1.2 2001/04/27 14:37:11 neil -** wheeee -** -** Revision 1.1 2001/04/27 12:54:40 neil -** blah -** -** Revision 1.1.1.1 2001/04/27 07:03:54 neil -** initial -** -** Revision 1.1 2000/10/24 12:19:33 matt -** changed directory structure -** -** Revision 1.6 2000/10/22 19:17:46 matt -** mapper cleanups galore -** -** Revision 1.5 2000/10/22 15:03:13 matt -** simplified mirroring -** -** Revision 1.4 2000/10/21 19:33:38 matt -** many more cleanups -** -** Revision 1.3 2000/07/10 05:29:03 matt -** cleaned up some mirroring issues -** -** Revision 1.2 2000/07/06 02:48:43 matt -** clearly labelled structure members -** -** Revision 1.1 2000/07/06 01:01:56 matt -** initial revision -** -*/ diff --git a/MCUME_pico/piconofrendo/map033.c b/MCUME_pico/piconofrendo/map033.c deleted file mode 100755 index fb70233..0000000 --- a/MCUME_pico/piconofrendo/map033.c +++ /dev/null @@ -1,145 +0,0 @@ -/* -** Nofrendo (c) 1998-2000 Matthew Conte (matt@conte.com) -** -** -** This program is free software; you can redistribute it and/or -** modify it under the terms of version 2 of the GNU Library General -** Public License as published by the Free Software Foundation. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** Library General Public License for more details. To obtain a -** copy of the GNU Library General Public License, write to the Free -** Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -** -** Any permitted reproduction of these routines, in whole or in part, -** must bear this legend. -** -** -** map33.c -** -** mapper 33 interface -** $Id: map033.c,v 1.2 2001/04/27 14:37:11 neil Exp $ -*/ - -#include "noftypes.h" -#include "nes_mmc.h" -#include "nes_ppu.h" - -/* mapper 33: Taito TC0190*/ -static void map33_write(uint32 address, uint8 value) -{ - int page = (address >> 13) & 3; - int reg = address & 3; - - switch (page) - { - case 0: /* $800X */ - switch (reg) - { - case 0: - mmc_bankrom(8, 0x8000, value); - break; - - case 1: - mmc_bankrom(8, 0xA000, value); - break; - - case 2: - mmc_bankvrom(2, 0x0000, value); - break; - - case 3: - mmc_bankvrom(2, 0x0800, value); - break; - } - break; - - case 1: /* $A00X */ - { - int loc = 0x1000 + (reg << 10); - mmc_bankvrom(1, loc, value); - } - break; - - case 2: /* $C00X */ - case 3: /* $E00X */ - switch (reg) - { - case 0: - /* irqs maybe ? */ - //break; - - case 1: - /* this doesn't seem to work just right */ - if (value & 1) - ppu_mirror(0, 0, 1, 1); /* horizontal */ - else - ppu_mirror(0, 1, 0, 1); - break; - - default: - break; - } - break; - } -} - - -static const map_memwrite map33_memwrite[] = -{ - { 0x8000, 0xFFFF, map33_write }, - { -1, -1, NULL } -}; - -const mapintf_t map33_intf = -{ - 33, /* mapper number */ - "Taito TC0190", /* mapper name */ - NULL, /* init routine */ - NULL, /* vblank callback */ - NULL, /* hblank callback */ - NULL, /* get state (snss) */ - NULL, /* set state (snss) */ - NULL, /* memory read structure */ - map33_memwrite, /* memory write structure */ - NULL /* external sound device */ -}; - -/* -** $Log: map033.c,v $ -** Revision 1.2 2001/04/27 14:37:11 neil -** wheeee -** -** Revision 1.1 2001/04/27 12:54:40 neil -** blah -** -** Revision 1.1.1.1 2001/04/27 07:03:54 neil -** initial -** -** Revision 1.1 2000/10/24 12:19:33 matt -** changed directory structure -** -** Revision 1.7 2000/10/22 19:17:46 matt -** mapper cleanups galore -** -** Revision 1.6 2000/10/22 15:03:13 matt -** simplified mirroring -** -** Revision 1.5 2000/10/21 19:33:38 matt -** many more cleanups -** -** Revision 1.4 2000/07/15 23:52:19 matt -** rounded out a bunch more mapper interfaces -** -** Revision 1.3 2000/07/10 05:29:03 matt -** cleaned up some mirroring issues -** -** Revision 1.2 2000/07/06 02:48:43 matt -** clearly labelled structure members -** -** Revision 1.1 2000/07/06 01:01:56 matt -** initial revision -** -*/ diff --git a/MCUME_pico/piconofrendo/map034.c b/MCUME_pico/piconofrendo/map034.c deleted file mode 100755 index b8cadc0..0000000 --- a/MCUME_pico/piconofrendo/map034.c +++ /dev/null @@ -1,100 +0,0 @@ -/* -** Nofrendo (c) 1998-2000 Matthew Conte (matt@conte.com) -** -** -** This program is free software; you can redistribute it and/or -** modify it under the terms of version 2 of the GNU Library General -** Public License as published by the Free Software Foundation. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** Library General Public License for more details. To obtain a -** copy of the GNU Library General Public License, write to the Free -** Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -** -** Any permitted reproduction of these routines, in whole or in part, -** must bear this legend. -** -** -** map34.c -** -** mapper 34 interface -** $Id: map034.c,v 1.2 2001/04/27 14:37:11 neil Exp $ -*/ - -#include "noftypes.h" -#include "nes_mmc.h" - -static void map34_init(void) -{ - mmc_bankrom(32, 0x8000, MMC_LASTBANK); -} - -static void map34_write(uint32 address, uint8 value) -{ - if ((address & 0x8000) || (0x7FFD == address)) - { - mmc_bankrom(32, 0x8000, value); - } - else if (0x7FFE == address) - { - mmc_bankvrom(4, 0x0000, value); - } - else if (0x7FFF == address) - { - mmc_bankvrom(4, 0x1000, value); - } -} - -static const map_memwrite map34_memwrite[] = -{ - { 0x7FFD, 0xFFFF, map34_write }, - { -1, -1, NULL } -}; - -const mapintf_t map34_intf = -{ - 34, /* mapper number */ - "Nina-1", /* mapper name */ - map34_init, /* init routine */ - NULL, /* vblank callback */ - NULL, /* hblank callback */ - NULL, /* get state (snss) */ - NULL, /* set state (snss) */ - NULL, /* memory read structure */ - map34_memwrite, /* memory write structure */ - NULL /* external sound device */ -}; - -/* -** $Log: map034.c,v $ -** Revision 1.2 2001/04/27 14:37:11 neil -** wheeee -** -** Revision 1.1 2001/04/27 12:54:40 neil -** blah -** -** Revision 1.1.1.1 2001/04/27 07:03:54 neil -** initial -** -** Revision 1.1 2000/10/24 12:19:33 matt -** changed directory structure -** -** Revision 1.5 2000/10/22 19:17:46 matt -** mapper cleanups galore -** -** Revision 1.4 2000/10/21 19:33:38 matt -** many more cleanups -** -** Revision 1.3 2000/07/11 05:03:49 matt -** value masking isn't necessary for the banking routines -** -** Revision 1.2 2000/07/11 03:35:08 bsittler -** Fixes to make mikes new mappers compile. -** -** Revision 1.1 2000/07/11 03:14:18 melanson -** Initial commit for mappers 16, 34, and 231 -** -** -*/ diff --git a/MCUME_pico/piconofrendo/map040.c b/MCUME_pico/piconofrendo/map040.c deleted file mode 100755 index 0d744fe..0000000 --- a/MCUME_pico/piconofrendo/map040.c +++ /dev/null @@ -1,163 +0,0 @@ -/* -** Nofrendo (c) 1998-2000 Matthew Conte (matt@conte.com) -** -** -** This program is free software; you can redistribute it and/or -** modify it under the terms of version 2 of the GNU Library General -** Public License as published by the Free Software Foundation. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** Library General Public License for more details. To obtain a -** copy of the GNU Library General Public License, write to the Free -** Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -** -** Any permitted reproduction of these routines, in whole or in part, -** must bear this legend. -** -** -** map40.c -** -** mapper 40 interface -** $Id: map040.c,v 1.2 2001/04/27 14:37:11 neil Exp $ -*/ - -#include "noftypes.h" -#include "nes_mmc.h" -#include "nes.h" -#include "libsnss.h" -#include "log.h" - -#define MAP40_IRQ_PERIOD (4096 / 113.666666) - -static struct -{ - int enabled, counter; -} irq; - -/* mapper 40: SMB 2j (hack) */ -static void map40_init(void) -{ - mmc_bankrom(8, 0x6000, 6); - mmc_bankrom(8, 0x8000, 4); - mmc_bankrom(8, 0xA000, 5); - mmc_bankrom(8, 0xE000, 7); - - irq.enabled = false; - irq.counter = (int) MAP40_IRQ_PERIOD; -} - -static void map40_hblank(int vblank) -{ - UNUSED(vblank); - - if (irq.enabled && irq.counter) - { - irq.counter--; - if (0 == irq.counter) - { - nes_irq(); - irq.enabled = false; - } - } -} - -static void map40_write(uint32 address, uint8 value) -{ - int range = (address >> 13) - 4; - - switch (range) - { - case 0: /* 0x8000-0x9FFF */ - irq.enabled = false; - irq.counter = (int) MAP40_IRQ_PERIOD; - break; - - case 1: /* 0xA000-0xBFFF */ - irq.enabled = true; - break; - - case 3: /* 0xE000-0xFFFF */ - mmc_bankrom(8, 0xC000, value & 7); - break; - - default: - break; - } -} - -static void map40_getstate(SnssMapperBlock *state) -{ - state->extraData.mapper40.irqCounter = irq.counter; - state->extraData.mapper40.irqCounterEnabled = irq.enabled; -} - -static void map40_setstate(SnssMapperBlock *state) -{ - irq.counter = state->extraData.mapper40.irqCounter; - irq.enabled = state->extraData.mapper40.irqCounterEnabled; -} - -static const map_memwrite map40_memwrite[] = -{ - { 0x8000, 0xFFFF, map40_write }, - { -1, -1, NULL } -}; - -const mapintf_t map40_intf = -{ - 40, /* mapper number */ - "SMB 2j (pirate)", /* mapper name */ - map40_init, /* init routine */ - NULL, /* vblank callback */ - map40_hblank, /* hblank callback */ - map40_getstate, /* get state (snss) */ - map40_setstate, /* set state (snss) */ - NULL, /* memory read structure */ - map40_memwrite, /* memory write structure */ - NULL /* external sound device */ -}; - -/* -** $Log: map040.c,v $ -** Revision 1.2 2001/04/27 14:37:11 neil -** wheeee -** -** Revision 1.1 2001/04/27 12:54:40 neil -** blah -** -** Revision 1.1.1.1 2001/04/27 07:03:54 neil -** initial -** -** Revision 1.1 2000/10/24 12:19:33 matt -** changed directory structure -** -** Revision 1.9 2000/10/23 15:53:27 matt -** suppressed warnings -** -** Revision 1.8 2000/10/22 19:17:46 matt -** mapper cleanups galore -** -** Revision 1.7 2000/10/21 19:33:38 matt -** many more cleanups -** -** Revision 1.6 2000/10/10 13:58:17 matt -** stroustrup squeezing his way in the door -** -** Revision 1.5 2000/08/16 02:50:11 matt -** random mapper cleanups -** -** Revision 1.4 2000/07/15 23:52:19 matt -** rounded out a bunch more mapper interfaces -** -** Revision 1.3 2000/07/10 13:51:25 matt -** using generic nes_irq() routine now -** -** Revision 1.2 2000/07/06 02:48:43 matt -** clearly labelled structure members -** -** Revision 1.1 2000/07/05 05:05:18 matt -** initial revision -** -*/ diff --git a/MCUME_pico/piconofrendo/map041.c b/MCUME_pico/piconofrendo/map041.c deleted file mode 100755 index f823ff2..0000000 --- a/MCUME_pico/piconofrendo/map041.c +++ /dev/null @@ -1,167 +0,0 @@ -/* -** Nofrendo (c) 1998-2000 Matthew Conte (matt@conte.com) -** -** -** This program is free software; you can redistribute it and/or -** modify it under the terms of version 2 of the GNU Library General -** Public License as published by the Free Software Foundation. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** Library General Public License for more details. To obtain a -** copy of the GNU Library General Public License, write to the Free -** Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -** -** Any permitted reproduction of these routines, in whole or in part, -** must bear this legend. -** -** -** map041.c -** -** Mapper #41 (Caltron 6 in 1) -** Implementation by Firebug -** Mapper information courtesy of Kevin Horton -** $Id: map041.c,v 1.2 2001/04/27 14:37:11 neil Exp $ -** -*/ - -#include "noftypes.h" -#include "nes_mmc.h" -#include "nes.h" -#include "libsnss.h" -#include "log.h" - -static uint8 register_low; -static uint8 register_high; - -/*****************************************************/ -/* Set 8K CHR bank from the combined register values */ -/*****************************************************/ -static void map41_set_chr (void) -{ - /* Set the CHR bank from the appropriate register bits */ - mmc_bankvrom (8, 0x0000, ((register_low >> 1) & 0x0C) | (register_high)); - - /* Done */ - return; -} - -/******************************/ -/* Mapper #41: Caltron 6 in 1 */ -/******************************/ -static void map41_init (void) -{ - /* Both registers set to zero at power on */ - /* TODO: Registers should also be cleared on a soft reset */ - register_low = 0x00; - register_high = 0x00; - mmc_bankrom (32, 0x8000, 0x00); - map41_set_chr (); - - /* Done */ - return; -} - -/******************************************/ -/* Mapper #41 write handler ($6000-$67FF) */ -/******************************************/ -static void map41_low_write (uint32 address, uint8 value) -{ - /* Within this range the value written is irrelevant */ - UNUSED (value); - - /* $6000-$67FF: A5 = mirroring (1=horizontal, 0=vertical) */ - /* A4-A3 = high two bits of 8K CHR bank */ - /* A2 = register 1 enable (0=disabled, 1=enabled) */ - /* A2-A0 = 32K PRG bank */ - register_low = (uint8) (address & 0x3F); - mmc_bankrom (32, 0x8000, register_low & 0x07); - map41_set_chr (); - if (register_low & 0x20) ppu_mirror(0, 0, 1, 1); /* horizontal */ - else ppu_mirror(0, 1, 0, 1); /* vertical */ - - /* Done */ - return; -} - -/******************************************/ -/* Mapper #41 write handler ($8000-$FFFF) */ -/******************************************/ -static void map41_high_write (uint32 address, uint8 value) -{ - /* Address doesn't matter within this range */ - UNUSED (address); - - /* $8000-$FFFF: D1-D0 = low two bits of 8K CHR bank */ - if (register_low & 0x04) - { - register_high = value & 0x03; - map41_set_chr (); - } - - /* Done */ - return; -} - -/****************************************************/ -/* Shove extra mapper information into a SNSS block */ -/****************************************************/ -static void map41_setstate (SnssMapperBlock *state) -{ - /* TODO: Store SNSS information */ - UNUSED (state); - - /* Done */ - return; -} - -/*****************************************************/ -/* Pull extra mapper information out of a SNSS block */ -/*****************************************************/ -static void map41_getstate (SnssMapperBlock *state) -{ - /* TODO: Retrieve SNSS information */ - UNUSED (state); - - /* Done */ - return; -} - -static const map_memwrite map41_memwrite [] = -{ - { 0x6000, 0x67FF, map41_low_write }, - { 0x8000, 0xFFFF, map41_high_write }, - { -1, -1, NULL } -}; - -const mapintf_t map41_intf = -{ - 41, /* Mapper number */ - "Caltron 6 in 1", /* Mapper name */ - map41_init, /* Initialization routine */ - NULL, /* VBlank callback */ - NULL, /* HBlank callback */ - map41_getstate, /* Get state (SNSS) */ - map41_setstate, /* Set state (SNSS) */ - NULL, /* Memory read structure */ - map41_memwrite, /* Memory write structure */ - NULL /* External sound device */ -}; - -/* -** $Log: map041.c,v $ -** Revision 1.2 2001/04/27 14:37:11 neil -** wheeee -** -** Revision 1.1 2001/04/27 12:54:40 neil -** blah -** -** Revision 1.1 2001/04/27 10:57:41 neil -** wheee -** -** Revision 1.1 2000/12/30 00:33:15 firebug -** initial revision -** -** -*/ diff --git a/MCUME_pico/piconofrendo/map042.c b/MCUME_pico/piconofrendo/map042.c deleted file mode 100755 index 1ca5af1..0000000 --- a/MCUME_pico/piconofrendo/map042.c +++ /dev/null @@ -1,188 +0,0 @@ -/* -** Nofrendo (c) 1998-2000 Matthew Conte (matt@conte.com) -** -** -** This program is free software; you can redistribute it and/or -** modify it under the terms of version 2 of the GNU Library General -** Public License as published by the Free Software Foundation. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** Library General Public License for more details. To obtain a -** copy of the GNU Library General Public License, write to the Free -** Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -** -** Any permitted reproduction of these routines, in whole or in part, -** must bear this legend. -** -** -** map042.c -** -** Mapper #42 (Baby Mario bootleg) -** Implementation by Firebug -** Mapper information courtesy of Kevin Horton -** $Id: map042.c,v 1.2 2001/04/27 14:37:11 neil Exp $ -** -*/ - -#include "noftypes.h" -#include "nes_mmc.h" -#include "nes.h" -#include "libsnss.h" -#include "log.h" - -static struct -{ - bool enabled; - uint32 counter; -} irq; - -/********************************/ -/* Mapper #42 IRQ reset routine */ -/********************************/ -static void map42_irq_reset (void) -{ - /* Turn off IRQs */ - irq.enabled = false; - irq.counter = 0x0000; - - /* Done */ - return; -} - -/********************************************/ -/* Mapper #42: Baby Mario bootleg cartridge */ -/********************************************/ -static void map42_init (void) -{ - /* Set the hardwired pages */ - mmc_bankrom (8, 0x8000, 0x0C); - mmc_bankrom (8, 0xA000, 0x0D); - mmc_bankrom (8, 0xC000, 0x0E); - mmc_bankrom (8, 0xE000, 0x0F); - - /* Reset the IRQ counter */ - map42_irq_reset (); - - /* Done */ - return; -} - -/****************************************/ -/* Mapper #42 callback for IRQ handling */ -/****************************************/ -static void map42_hblank (int vblank) -{ - /* Counter is M2 based so it doesn't matter whether */ - /* the PPU is in its VBlank period or not */ - UNUSED(vblank); - - /* Increment the counter if it is enabled and check for strike */ - if (irq.enabled) - { - /* Is there a constant for cycles per scanline? */ - /* If so, someone ought to substitute it here */ - irq.counter = irq.counter + 114; - - /* IRQ is triggered after 24576 M2 cycles */ - if (irq.counter >= 0x6000) - { - /* Trigger the IRQ */ - nes_irq (); - - /* Reset the counter */ - map42_irq_reset (); - } - } -} - -/******************************************/ -/* Mapper #42 write handler ($E000-$FFFF) */ -/******************************************/ -static void map42_write (uint32 address, uint8 value) -{ - switch (address & 0x03) - { - /* Register 0: Select ROM page at $6000-$7FFF */ - case 0x00: mmc_bankrom (8, 0x6000, value & 0x0F); - break; - - /* Register 1: mirroring */ - case 0x01: if (value & 0x08) ppu_mirror(0, 0, 1, 1); /* horizontal */ - else ppu_mirror(0, 1, 0, 1); /* vertical */ - break; - - /* Register 2: IRQ */ - case 0x02: if (value & 0x02) irq.enabled = true; - else map42_irq_reset (); - break; - - /* Register 3: unused */ - default: break; - } - - /* Done */ - return; -} - -/****************************************************/ -/* Shove extra mapper information into a SNSS block */ -/****************************************************/ -static void map42_setstate (SnssMapperBlock *state) -{ - /* TODO: Store SNSS information */ - UNUSED (state); - - /* Done */ - return; -} - -/*****************************************************/ -/* Pull extra mapper information out of a SNSS block */ -/*****************************************************/ -static void map42_getstate (SnssMapperBlock *state) -{ - /* TODO: Retrieve SNSS information */ - UNUSED (state); - - /* Done */ - return; -} - -static const map_memwrite map42_memwrite [] = -{ - { 0xE000, 0xFFFF, map42_write }, - { -1, -1, NULL } -}; - -const mapintf_t map42_intf = -{ - 42, /* Mapper number */ - "Baby Mario (bootleg)", /* Mapper name */ - map42_init, /* Initialization routine */ - NULL, /* VBlank callback */ - map42_hblank, /* HBlank callback */ - map42_getstate, /* Get state (SNSS) */ - map42_setstate, /* Set state (SNSS) */ - NULL, /* Memory read structure */ - map42_memwrite, /* Memory write structure */ - NULL /* External sound device */ -}; - -/* -** $Log: map042.c,v $ -** Revision 1.2 2001/04/27 14:37:11 neil -** wheeee -** -** Revision 1.1 2001/04/27 12:54:40 neil -** blah -** -** Revision 1.1 2001/04/27 10:57:41 neil -** wheee -** -** Revision 1.1 2000/12/27 19:23:30 firebug -** initial revision -** -** -*/ diff --git a/MCUME_pico/piconofrendo/map046.c b/MCUME_pico/piconofrendo/map046.c deleted file mode 100755 index 9bd9f5c..0000000 --- a/MCUME_pico/piconofrendo/map046.c +++ /dev/null @@ -1,152 +0,0 @@ -/* -** Nofrendo (c) 1998-2000 Matthew Conte (matt@conte.com) -** -** -** This program is free software; you can redistribute it and/or -** modify it under the terms of version 2 of the GNU Library General -** Public License as published by the Free Software Foundation. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** Library General Public License for more details. To obtain a -** copy of the GNU Library General Public License, write to the Free -** Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -** -** Any permitted reproduction of these routines, in whole or in part, -** must bear this legend. -** -** -** map046.c -** -** Mapper #46 (Pelican Game Station) -** Implementation by Firebug -** Mapper information courtesy of Kevin Horton -** $Id: map046.c,v 1.2 2001/04/27 14:37:11 neil Exp $ -** -*/ - -#include "noftypes.h" -#include "nes_mmc.h" -#include "nes.h" -#include "libsnss.h" -#include "log.h" - -static uint8 prg_low_bank; -static uint8 chr_low_bank; -static uint8 prg_high_bank; -static uint8 chr_high_bank; - -/*************************************************/ -/* Set banks from the combined register values */ -/*************************************************/ -static void map46_set_banks (void) -{ - /* Set the PRG and CHR pages */ - mmc_bankrom (32, 0x8000, (prg_high_bank << 1) | (prg_low_bank)); - mmc_bankvrom (8, 0x0000, (chr_high_bank << 3) | (chr_low_bank)); - - /* Done */ - return; -} - -/*********************************************************/ -/* Mapper #46: Pelican Game Station (aka Rumble Station) */ -/*********************************************************/ -static void map46_init (void) -{ - /* High bank switch register is set to zero on reset */ - prg_high_bank = 0x00; - chr_high_bank = 0x00; - map46_set_banks (); - - /* Done */ - return; -} - -/******************************************/ -/* Mapper #46 write handler ($6000-$FFFF) */ -/******************************************/ -static void map46_write (uint32 address, uint8 value) -{ - /* $8000-$FFFF: D6-D4 = lower three bits of CHR bank */ - /* D0 = low bit of PRG bank */ - /* $6000-$7FFF: D7-D4 = high four bits of CHR bank */ - /* D3-D0 = high four bits of PRG bank */ - if (address & 0x8000) - { - prg_low_bank = value & 0x01; - chr_low_bank = (value >> 4) & 0x07; - map46_set_banks (); - } - else - { - prg_high_bank = value & 0x0F; - chr_high_bank = (value >> 4) & 0x0F; - map46_set_banks (); - } - - /* Done */ - return; -} - -/****************************************************/ -/* Shove extra mapper information into a SNSS block */ -/****************************************************/ -static void map46_setstate (SnssMapperBlock *state) -{ - /* TODO: Store SNSS information */ - UNUSED (state); - - /* Done */ - return; -} - -/*****************************************************/ -/* Pull extra mapper information out of a SNSS block */ -/*****************************************************/ -static void map46_getstate (SnssMapperBlock *state) -{ - /* TODO: Retrieve SNSS information */ - UNUSED (state); - - /* Done */ - return; -} - -static const map_memwrite map46_memwrite [] = -{ - { 0x6000, 0xFFFF, map46_write }, - { -1, -1, NULL } -}; - -const mapintf_t map46_intf = -{ - 46, /* Mapper number */ - "Pelican Game Station", /* Mapper name */ - map46_init, /* Initialization routine */ - NULL, /* VBlank callback */ - NULL, /* HBlank callback */ - map46_getstate, /* Get state (SNSS) */ - map46_setstate, /* Set state (SNSS) */ - NULL, /* Memory read structure */ - map46_memwrite, /* Memory write structure */ - NULL /* External sound device */ -}; - -/* -** $Log: map046.c,v $ -** Revision 1.2 2001/04/27 14:37:11 neil -** wheeee -** -** Revision 1.1 2001/04/27 12:54:40 neil -** blah -** -** Revision 1.1 2001/04/27 10:57:41 neil -** wheee -** -** Revision 1.1 2000/12/27 19:23:05 firebug -** initial revision -** -** -*/ diff --git a/MCUME_pico/piconofrendo/map050.c b/MCUME_pico/piconofrendo/map050.c deleted file mode 100755 index 89d8578..0000000 --- a/MCUME_pico/piconofrendo/map050.c +++ /dev/null @@ -1,192 +0,0 @@ -/* -** Nofrendo (c) 1998-2000 Matthew Conte (matt@conte.com) -** -** -** This program is free software; you can redistribute it and/or -** modify it under the terms of version 2 of the GNU Library General -** Public License as published by the Free Software Foundation. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** Library General Public License for more details. To obtain a -** copy of the GNU Library General Public License, write to the Free -** Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -** -** Any permitted reproduction of these routines, in whole or in part, -** must bear this legend. -** -** -** map050.c -** -** Mapper #50 (SMB2j - 3rd discovered variation) -** Implementation by Firebug -** Mapper information courtesy of Kevin Horton -** $Id: map050.c,v 1.2 2001/04/27 14:37:11 neil Exp $ -** -*/ - -#include "noftypes.h" -#include "nes_mmc.h" -#include "nes.h" -#include "libsnss.h" -#include "log.h" - -static struct -{ - bool enabled; - uint32 counter; -} irq; - -/********************************/ -/* Mapper #50 IRQ reset routine */ -/********************************/ -static void map50_irq_reset (void) -{ - /* Turn off IRQs */ - irq.enabled = false; - irq.counter = 0x0000; - - /* Done */ - return; -} - -/**************************************************************/ -/* Mapper #50: 3rd discovered variation of SMB2j cart bootleg */ -/**************************************************************/ -static void map50_init (void) -{ - /* Set the hardwired pages */ - mmc_bankrom (8, 0x6000, 0x0F); - mmc_bankrom (8, 0x8000, 0x08); - mmc_bankrom (8, 0xA000, 0x09); - mmc_bankrom (8, 0xE000, 0x0B); - - /* Reset the IRQ counter */ - map50_irq_reset (); - - /* Done */ - return; -} - -/****************************************/ -/* Mapper #50 callback for IRQ handling */ -/****************************************/ -static void map50_hblank (int vblank) -{ - /* Counter is M2 based so it doesn't matter whether */ - /* the PPU is in its VBlank period or not */ - UNUSED(vblank); - - /* Increment the counter if it is enabled and check for strike */ - if (irq.enabled) - { - /* Is there a constant for cycles per scanline? */ - /* If so, someone ought to substitute it here */ - irq.counter = irq.counter + 114; - - /* IRQ line is hooked to Q12 of the counter */ - if (irq.counter & 0x1000) - { - /* Trigger the IRQ */ - nes_irq (); - - /* Reset the counter */ - map50_irq_reset (); - } - } -} - -/******************************************/ -/* Mapper #50 write handler ($4000-$5FFF) */ -/******************************************/ -static void map50_write (uint32 address, uint8 value) -{ - uint8 selectable_bank; - - /* For address to be decoded, A5 must be high and A6 low */ - if ((address & 0x60) != 0x20) return; - - /* A8 low = $C000-$DFFF page selection */ - /* A8 high = IRQ timer toggle */ - if (address & 0x100) - { - /* IRQ settings */ - if (value & 0x01) irq.enabled = true; - else map50_irq_reset (); - } - else - { - /* Stupid data line swapping */ - selectable_bank = 0x00; - if (value & 0x08) selectable_bank |= 0x08; - if (value & 0x04) selectable_bank |= 0x02; - if (value & 0x02) selectable_bank |= 0x01; - if (value & 0x01) selectable_bank |= 0x04; - mmc_bankrom (8, 0xC000, selectable_bank); - } - - /* Done */ - return; -} - -/****************************************************/ -/* Shove extra mapper information into a SNSS block */ -/****************************************************/ -static void map50_setstate (SnssMapperBlock *state) -{ - /* TODO: Store SNSS information */ - UNUSED (state); - - /* Done */ - return; -} - -/*****************************************************/ -/* Pull extra mapper information out of a SNSS block */ -/*****************************************************/ -static void map50_getstate (SnssMapperBlock *state) -{ - /* TODO: Retrieve SNSS information */ - UNUSED (state); - - /* Done */ - return; -} - -static const map_memwrite map50_memwrite [] = -{ - { 0x4000, 0x5FFF, map50_write }, - { -1, -1, NULL } -}; - -const mapintf_t map50_intf = -{ - 50, /* Mapper number */ - "SMB2j (3rd discovered variant)", /* Mapper name */ - map50_init, /* Initialization routine */ - NULL, /* VBlank callback */ - map50_hblank, /* HBlank callback */ - map50_getstate, /* Get state (SNSS) */ - map50_setstate, /* Set state (SNSS) */ - NULL, /* Memory read structure */ - map50_memwrite, /* Memory write structure */ - NULL /* External sound device */ -}; - -/* -** $Log: map050.c,v $ -** Revision 1.2 2001/04/27 14:37:11 neil -** wheeee -** -** Revision 1.1 2001/04/27 12:54:40 neil -** blah -** -** Revision 1.1 2001/04/27 10:57:41 neil -** wheee -** -** Revision 1.1 2000/12/27 19:22:13 firebug -** initial revision -** -** -*/ diff --git a/MCUME_pico/piconofrendo/map064.c b/MCUME_pico/piconofrendo/map064.c deleted file mode 100755 index 59b668f..0000000 --- a/MCUME_pico/piconofrendo/map064.c +++ /dev/null @@ -1,234 +0,0 @@ -/* -** Nofrendo (c) 1998-2000 Matthew Conte (matt@conte.com) -** -** -** This program is free software; you can redistribute it and/or -** modify it under the terms of version 2 of the GNU Library General -** Public License as published by the Free Software Foundation. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** Library General Public License for more details. To obtain a -** copy of the GNU Library General Public License, write to the Free -** Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -** -** Any permitted reproduction of these routines, in whole or in part, -** must bear this legend. -** -** -** map64.c -** -** mapper 64 interface -** $Id: map064.c,v 1.2 2001/04/27 14:37:11 neil Exp $ -*/ - -#include "noftypes.h" -#include "nes_mmc.h" -#include "nes.h" -#include "log.h" - -static struct -{ - int counter, latch; - bool enabled, reset; -} irq; - -static uint8 command = 0; -static uint16 vrombase = 0x0000; - -static void map64_hblank(int vblank) -{ - if (vblank) - return; - - irq.reset = false; - - if (ppu_enabled()) - { - if (0 == irq.counter--) - { - irq.counter = irq.latch; - - if (true == irq.enabled) - nes_irq(); - - irq.reset = true; - } - } -} - -/* mapper 64: Tengen RAMBO-1 */ -static void map64_write(uint32 address, uint8 value) -{ - switch (address & 0xE001) - { - case 0x8000: - command = value; - vrombase = (value & 0x80) ? 0x1000 : 0x0000; - break; - - case 0x8001: - switch (command & 0xF) - { - case 0: - mmc_bankvrom(1, 0x0000 ^ vrombase, value); - mmc_bankvrom(1, 0x0400 ^ vrombase, value); - break; - - case 1: - mmc_bankvrom(1, 0x0800 ^ vrombase, value); - mmc_bankvrom(1, 0x0C00 ^ vrombase, value); - break; - - case 2: - mmc_bankvrom(1, 0x1000 ^ vrombase, value); - break; - - case 3: - mmc_bankvrom(1, 0x1400 ^ vrombase, value); - break; - - case 4: - mmc_bankvrom(1, 0x1800 ^ vrombase, value); - break; - - case 5: - mmc_bankvrom(1, 0x1C00 ^ vrombase, value); - break; - - case 6: - mmc_bankrom(8, (command & 0x40) ? 0xA000 : 0x8000, value); - break; - - case 7: - mmc_bankrom(8, (command & 0x40) ? 0xC000 : 0xA000, value); - break; - - case 8: - mmc_bankvrom(1, 0x0400, value); - break; - - case 9: - mmc_bankvrom(1, 0x0C00, value); - break; - - case 15: - mmc_bankrom(8, (command & 0x40) ? 0x8000 : 0xC000, value); - break; - - default: -#ifdef NOFRENDO_DEBUG - log_printf("mapper 64: unknown command #%d", command & 0xF); -#endif - break; - } - break; - - case 0xA000: - if (value & 1) - ppu_mirror(0, 0, 1, 1); - else - ppu_mirror(0, 1, 0, 1); - break; - - case 0xC000: - //irq.counter = value; - irq.latch = value; - break; - - case 0xC001: - //irq.latch = value; - irq.reset = true; - break; - - case 0xE000: - //irq.counter = irq.latch; - irq.enabled = false; - break; - - case 0xE001: - irq.enabled = true; - break; - - default: -#ifdef NOFRENDO_DEBUG - log_printf("mapper 64: Wrote $%02X to $%04X", value, address); -#endif - break; - } - - if (true == irq.reset) - irq.counter = irq.latch; -} - -static void map64_init(void) -{ - mmc_bankrom(8, 0x8000, MMC_LASTBANK); - mmc_bankrom(8, 0xA000, MMC_LASTBANK); - mmc_bankrom(8, 0xC000, MMC_LASTBANK); - mmc_bankrom(8, 0xE000, MMC_LASTBANK); - - irq.counter = irq.latch = 0; - irq.reset = irq.enabled = false; -} - -static const map_memwrite map64_memwrite[] = -{ - { 0x8000, 0xFFFF, map64_write }, - { -1, -1, NULL } -}; - -const mapintf_t map64_intf = -{ - 64, /* mapper number */ - "Tengen RAMBO-1", /* mapper name */ - map64_init, /* init routine */ - NULL, /* vblank callback */ - map64_hblank, /* hblank callback */ - NULL, /* get state (snss) */ - NULL, /* set state (snss) */ - NULL, /* memory read structure */ - map64_memwrite, /* memory write structure */ - NULL /* external sound device */ -}; - -/* -** $Log: map064.c,v $ -** Revision 1.2 2001/04/27 14:37:11 neil -** wheeee -** -** Revision 1.1 2001/04/27 12:54:40 neil -** blah -** -** Revision 1.1.1.1 2001/04/27 07:03:54 neil -** initial -** -** Revision 1.1 2000/10/24 12:19:33 matt -** changed directory structure -** -** Revision 1.8 2000/10/22 19:17:46 matt -** mapper cleanups galore -** -** Revision 1.7 2000/10/22 15:03:13 matt -** simplified mirroring -** -** Revision 1.6 2000/10/21 19:33:38 matt -** many more cleanups -** -** Revision 1.5 2000/10/10 13:58:17 matt -** stroustrup squeezing his way in the door -** -** Revision 1.4 2000/07/10 13:51:25 matt -** using generic nes_irq() routine now -** -** Revision 1.3 2000/07/10 05:29:03 matt -** cleaned up some mirroring issues -** -** Revision 1.2 2000/07/06 02:48:43 matt -** clearly labelled structure members -** -** Revision 1.1 2000/07/05 05:05:18 matt -** initial revision -** -*/ diff --git a/MCUME_pico/piconofrendo/map065.c b/MCUME_pico/piconofrendo/map065.c deleted file mode 100755 index a152ee3..0000000 --- a/MCUME_pico/piconofrendo/map065.c +++ /dev/null @@ -1,144 +0,0 @@ -/* -** Nofrendo (c) 1998-2000 Matthew Conte (matt@conte.com) -** -** -** This program is free software; you can redistribute it and/or -** modify it under the terms of version 2 of the GNU Library General -** Public License as published by the Free Software Foundation. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** Library General Public License for more details. To obtain a -** copy of the GNU Library General Public License, write to the Free -** Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -** -** Any permitted reproduction of these routines, in whole or in part, -** must bear this legend. -** -** -** map65.c -** -** mapper 65 interface -** $Id: map065.c,v 1.2 2001/04/27 14:37:11 neil Exp $ -*/ - -#include "noftypes.h" -#include "nes_mmc.h" -#include "nes_ppu.h" - -static struct -{ - int counter; - bool enabled; - int cycles; - uint8 low, high; -} irq; - -static void map65_init(void) -{ - irq.counter = 0; - irq.enabled = false; - irq.low = irq.high = 0; - irq.cycles = 0; -} - -/* TODO: shouldn't there be some kind of HBlank callback??? */ - -/* mapper 65: Irem H-3001*/ -static void map65_write(uint32 address, uint8 value) -{ - int range = address & 0xF000; - int reg = address & 7; - - switch (range) - { - case 0x8000: - case 0xA000: - case 0xC000: - mmc_bankrom(8, range, value); - break; - - case 0xB000: - mmc_bankvrom(1, reg << 10, value); - break; - - case 0x9000: - switch (reg) - { - case 4: - irq.enabled = (value & 0x01) ? false : true; - break; - - case 5: - irq.high = value; - irq.cycles = (irq.high << 8) | irq.low; - irq.counter = (uint8)(irq.cycles / 128); - break; - - case 6: - irq.low = value; - irq.cycles = (irq.high << 8) | irq.low; - irq.counter = (uint8)(irq.cycles / 128); - break; - - default: - break; - } - break; - - default: - break; - } -} - -static const map_memwrite map65_memwrite[] = -{ - { 0x8000, 0xFFFF, map65_write }, - { -1, -1, NULL } -}; - -const mapintf_t map65_intf = -{ - 65, /* mapper number */ - "Irem H-3001", /* mapper name */ - map65_init, /* init routine */ - NULL, /* vblank callback */ - NULL, /* hblank callback */ - NULL, /* get state (snss) */ - NULL, /* set state (snss) */ - NULL, /* memory read structure */ - map65_memwrite, /* memory write structure */ - NULL /* external sound device */ -}; - -/* -** $Log: map065.c,v $ -** Revision 1.2 2001/04/27 14:37:11 neil -** wheeee -** -** Revision 1.1 2001/04/27 12:54:40 neil -** blah -** -** Revision 1.1.1.1 2001/04/27 07:03:54 neil -** initial -** -** Revision 1.1 2000/10/24 12:19:33 matt -** changed directory structure -** -** Revision 1.5 2000/10/22 19:17:46 matt -** mapper cleanups galore -** -** Revision 1.4 2000/10/21 19:33:38 matt -** many more cleanups -** -** Revision 1.3 2000/10/10 13:58:17 matt -** stroustrup squeezing his way in the door -** -** Revision 1.2 2000/07/06 02:48:43 matt -** clearly labelled structure members -** -** Revision 1.1 2000/07/06 01:01:56 matt -** initial revision -** -*/ diff --git a/MCUME_pico/piconofrendo/map066.c b/MCUME_pico/piconofrendo/map066.c deleted file mode 100755 index 1e789a7..0000000 --- a/MCUME_pico/piconofrendo/map066.c +++ /dev/null @@ -1,94 +0,0 @@ -/* -** Nofrendo (c) 1998-2000 Matthew Conte (matt@conte.com) -** -** -** This program is free software; you can redistribute it and/or -** modify it under the terms of version 2 of the GNU Library General -** Public License as published by the Free Software Foundation. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** Library General Public License for more details. To obtain a -** copy of the GNU Library General Public License, write to the Free -** Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -** -** Any permitted reproduction of these routines, in whole or in part, -** must bear this legend. -** -** -** map66.c -** -** mapper 66 interface -** $Id: map066.c,v 1.2 2001/04/27 14:37:11 neil Exp $ -*/ - -#include "noftypes.h" -#include "nes_mmc.h" - -/* mapper 66: GNROM */ -static void map66_write(uint32 address, uint8 value) -{ - UNUSED(address); - - mmc_bankrom(32, 0x8000, (value >> 4) & 3); - mmc_bankvrom(8, 0x0000, value & 3); -} - -static void map66_init(void) -{ - mmc_bankrom(32, 0x8000, 0); - mmc_bankvrom(8, 0x0000, 0); -} - - -static const map_memwrite map66_memwrite[] = -{ - { 0x8000, 0xFFFF, map66_write }, - { -1, -1, NULL } -}; - -const mapintf_t map66_intf = -{ - 66, /* mapper number */ - "GNROM", /* mapper name */ - map66_init, /* init routine */ - NULL, /* vblank callback */ - NULL, /* hblank callback */ - NULL, /* get state (snss) */ - NULL, /* set state (snss) */ - NULL, /* memory read structure */ - map66_memwrite, /* memory write structure */ - NULL /* external sound device */ -}; - -/* -** $Log: map066.c,v $ -** Revision 1.2 2001/04/27 14:37:11 neil -** wheeee -** -** Revision 1.1 2001/04/27 12:54:40 neil -** blah -** -** Revision 1.1.1.1 2001/04/27 07:03:54 neil -** initial -** -** Revision 1.1 2000/10/24 12:19:33 matt -** changed directory structure -** -** Revision 1.5 2000/10/22 19:17:46 matt -** mapper cleanups galore -** -** Revision 1.4 2000/10/21 19:33:38 matt -** many more cleanups -** -** Revision 1.3 2000/08/16 02:50:11 matt -** random mapper cleanups -** -** Revision 1.2 2000/07/06 02:48:43 matt -** clearly labelled structure members -** -** Revision 1.1 2000/07/05 05:05:18 matt -** initial revision -** -*/ diff --git a/MCUME_pico/piconofrendo/map070.c b/MCUME_pico/piconofrendo/map070.c deleted file mode 100755 index 2299b8a..0000000 --- a/MCUME_pico/piconofrendo/map070.c +++ /dev/null @@ -1,115 +0,0 @@ -/* -** Nofrendo (c) 1998-2000 Matthew Conte (matt@conte.com) -** -** -** This program is free software; you can redistribute it and/or -** modify it under the terms of version 2 of the GNU Library General -** Public License as published by the Free Software Foundation. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** Library General Public License for more details. To obtain a -** copy of the GNU Library General Public License, write to the Free -** Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -** -** Any permitted reproduction of these routines, in whole or in part, -** must bear this legend. -** -** -** map70.c -** -** mapper 70 interface -** $Id: map070.c,v 1.2 2001/04/27 14:37:11 neil Exp $ -*/ - -#include "noftypes.h" -#include "nes_mmc.h" -#include "nes_ppu.h" - -/* mapper 70: Arkanoid II, Kamen Rider Club, etc. */ -/* ($8000-$FFFF) D6-D4 = switch $8000-$BFFF */ -/* ($8000-$FFFF) D3-D0 = switch PPU $0000-$1FFF */ -/* ($8000-$FFFF) D7 = switch mirroring */ -static void map70_write(uint32 address, uint8 value) -{ - UNUSED(address); - - mmc_bankrom(16, 0x8000, (value >> 4) & 0x07); - mmc_bankvrom(8, 0x0000, value & 0x0F); - - /* Argh! FanWen used the 4-screen bit to determine - ** whether the game uses D7 to switch between - ** horizontal and vertical mirroring, or between - ** one-screen mirroring from $2000 or $2400. - */ - if (mmc_getinfo()->flags & ROM_FLAG_FOURSCREEN) - { - if (value & 0x80) - ppu_mirror(0, 0, 1, 1); /* horiz */ - else - ppu_mirror(0, 1, 0, 1); /* vert */ - } - else - { - int mirror = (value & 0x80) >> 7; - ppu_mirror(mirror, mirror, mirror, mirror); - } -} - -static const map_memwrite map70_memwrite[] = -{ - { 0x8000, 0xFFFF, map70_write }, - { -1, -1, NULL } -}; - -const mapintf_t map70_intf = -{ - 70, /* mapper number */ - "Mapper 70", /* mapper name */ - NULL, /* init routine */ - NULL, /* vblank callback */ - NULL, /* hblank callback */ - NULL, /* get state (snss) */ - NULL, /* set state (snss) */ - NULL, /* memory read structure */ - map70_memwrite, /* memory write structure */ - NULL /* external sound device */ -}; - -/* -** $Log: map070.c,v $ -** Revision 1.2 2001/04/27 14:37:11 neil -** wheeee -** -** Revision 1.1 2001/04/27 12:54:40 neil -** blah -** -** Revision 1.1.1.1 2001/04/27 07:03:54 neil -** initial -** -** Revision 1.1 2000/10/24 12:19:33 matt -** changed directory structure -** -** Revision 1.7 2000/10/22 19:17:46 matt -** mapper cleanups galore -** -** Revision 1.6 2000/10/22 15:03:13 matt -** simplified mirroring -** -** Revision 1.5 2000/10/21 19:33:38 matt -** many more cleanups -** -** Revision 1.4 2000/08/16 02:50:11 matt -** random mapper cleanups -** -** Revision 1.3 2000/07/10 05:29:03 matt -** cleaned up some mirroring issues -** -** Revision 1.2 2000/07/06 02:48:43 matt -** clearly labelled structure members -** -** Revision 1.1 2000/07/06 01:01:56 matt -** initial revision -** -*/ diff --git a/MCUME_pico/piconofrendo/map073.c b/MCUME_pico/piconofrendo/map073.c deleted file mode 100755 index 619ad60..0000000 --- a/MCUME_pico/piconofrendo/map073.c +++ /dev/null @@ -1,173 +0,0 @@ -/* -** Nofrendo (c) 1998-2000 Matthew Conte (matt@conte.com) -** -** -** This program is free software; you can redistribute it and/or -** modify it under the terms of version 2 of the GNU Library General -** Public License as published by the Free Software Foundation. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** Library General Public License for more details. To obtain a -** copy of the GNU Library General Public License, write to the Free -** Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -** -** Any permitted reproduction of these routines, in whole or in part, -** must bear this legend. -** -** -** map073.c -** -** Mapper #73 (Konami VRC3) -** Implementation by Firebug -** $Id: map073.c,v 1.2 2001/04/27 14:37:11 neil Exp $ -** -*/ - -#include "noftypes.h" -#include "nes_mmc.h" -#include "nes.h" -#include "libsnss.h" -#include "log.h" - -static struct -{ - bool enabled; - uint32 counter; -} irq; - -/**************************/ -/* Mapper #73: Salamander */ -/**************************/ -static void map73_init (void) -{ - /* Turn off IRQs */ - irq.enabled = false; - irq.counter = 0x0000; - - /* Done */ - return; -} - -/****************************************/ -/* Mapper #73 callback for IRQ handling */ -/****************************************/ -static void map73_hblank (int vblank) -{ - /* Counter is M2 based so it doesn't matter whether */ - /* the PPU is in its VBlank period or not */ - UNUSED (vblank); - - /* Increment the counter if it is enabled and check for strike */ - if (irq.enabled) - { - /* Is there a constant for cycles per scanline? */ - /* If so, someone ought to substitute it here */ - irq.counter = irq.counter + 114; - - /* Counter triggered on overflow into Q16 */ - if (irq.counter & 0x10000) - { - /* Clip to sixteen-bit word */ - irq.counter &= 0xFFFF; - - /* Trigger the IRQ */ - nes_irq (); - - /* Shut off IRQ counter */ - irq.enabled = false; - } - } -} - -/******************************************/ -/* Mapper #73 write handler ($8000-$FFFF) */ -/******************************************/ -static void map73_write (uint32 address, uint8 value) -{ - switch (address & 0xF000) - { - case 0x8000: irq.counter &= 0xFFF0; - irq.counter |= (uint32) (value); - break; - case 0x9000: irq.counter &= 0xFF0F; - irq.counter |= (uint32) (value << 4); - break; - case 0xA000: irq.counter &= 0xF0FF; - irq.counter |= (uint32) (value << 8); - break; - case 0xB000: irq.counter &= 0x0FFF; - irq.counter |= (uint32) (value << 12); - break; - case 0xC000: if (value & 0x02) irq.enabled = true; - else irq.enabled = false; - break; - case 0xF000: mmc_bankrom (16, 0x8000, value); - default: break; - } - - /* Done */ - return; -} - -/****************************************************/ -/* Shove extra mapper information into a SNSS block */ -/****************************************************/ -static void map73_setstate (SnssMapperBlock *state) -{ - /* TODO: Store SNSS information */ - UNUSED (state); - - /* Done */ - return; -} - -/*****************************************************/ -/* Pull extra mapper information out of a SNSS block */ -/*****************************************************/ -static void map73_getstate (SnssMapperBlock *state) -{ - /* TODO: Retrieve SNSS information */ - UNUSED (state); - - /* Done */ - return; -} - -static const map_memwrite map73_memwrite [] = -{ - { 0x8000, 0xFFFF, map73_write }, - { -1, -1, NULL } -}; - -const mapintf_t map73_intf = -{ - 73, /* Mapper number */ - "Konami VRC3", /* Mapper name */ - map73_init, /* Initialization routine */ - NULL, /* VBlank callback */ - map73_hblank, /* HBlank callback */ - map73_getstate, /* Get state (SNSS) */ - map73_setstate, /* Set state (SNSS) */ - NULL, /* Memory read structure */ - map73_memwrite, /* Memory write structure */ - NULL /* External sound device */ -}; - -/* -** $Log: map073.c,v $ -** Revision 1.2 2001/04/27 14:37:11 neil -** wheeee -** -** Revision 1.1 2001/04/27 12:54:40 neil -** blah -** -** Revision 1.1 2001/04/27 10:57:41 neil -** wheee -** -** Revision 1.1 2000/12/30 06:35:05 firebug -** Initial revision -** -** -*/ diff --git a/MCUME_pico/piconofrendo/map075.c b/MCUME_pico/piconofrendo/map075.c deleted file mode 100755 index 5622e2d..0000000 --- a/MCUME_pico/piconofrendo/map075.c +++ /dev/null @@ -1,131 +0,0 @@ -/* -** Nofrendo (c) 1998-2000 Matthew Conte (matt@conte.com) -** -** -** This program is free software; you can redistribute it and/or -** modify it under the terms of version 2 of the GNU Library General -** Public License as published by the Free Software Foundation. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** Library General Public License for more details. To obtain a -** copy of the GNU Library General Public License, write to the Free -** Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -** -** Any permitted reproduction of these routines, in whole or in part, -** must bear this legend. -** -** -** map75.c -** -** mapper 75 interface -** $Id: map075.c,v 1.2 2001/04/27 14:37:11 neil Exp $ -*/ - -#include "noftypes.h" -#include "nes_mmc.h" -#include "nes_ppu.h" - - -static uint8 latch[2]; -static uint8 hibits; - -/* mapper 75: Konami VRC1 */ -static void map75_write(uint32 address, uint8 value) -{ - switch ((address & 0xF000) >> 12) - { - case 0x8: - mmc_bankrom(8, 0x8000, value); - break; - - case 0x9: - hibits = (value & 0x06); - - mmc_bankvrom(4, 0x0000, ((hibits & 0x02) << 3) | latch[0]); - mmc_bankvrom(4, 0x1000, ((hibits & 0x04) << 2) | latch[1]); - - if (value & 1) - ppu_mirror(0, 1, 0, 1); /* vert */ - else - ppu_mirror(0, 0, 1, 1); /* horiz */ - - break; - - case 0xA: - mmc_bankrom(8, 0xA000, value); - break; - - case 0xC: - mmc_bankrom(8, 0xC000, value); - break; - - case 0xE: - latch[0] = (value & 0x0F); - mmc_bankvrom(4, 0x0000, ((hibits & 0x02) << 3) | latch[0]); - break; - - case 0xF: - latch[1] = (value & 0x0F); - mmc_bankvrom(4, 0x1000, ((hibits & 0x04) << 2) | latch[1]); - break; - - default: - break; - } -} - -static const map_memwrite map75_memwrite[] = -{ - { 0x8000, 0xFFFF, map75_write }, - { -1, -1, NULL } -}; - -const mapintf_t map75_intf = -{ - 75, /* mapper number */ - "Konami VRC1", /* mapper name */ - NULL, /* init routine */ - NULL, /* vblank callback */ - NULL, /* hblank callback */ - NULL, /* get state (snss) */ - NULL, /* set state (snss) */ - NULL, /* memory read structure */ - map75_memwrite, /* memory write structure */ - NULL /* external sound device */ -}; - -/* -** $Log: map075.c,v $ -** Revision 1.2 2001/04/27 14:37:11 neil -** wheeee -** -** Revision 1.1 2001/04/27 12:54:40 neil -** blah -** -** Revision 1.1.1.1 2001/04/27 07:03:54 neil -** initial -** -** Revision 1.1 2000/10/24 12:19:33 matt -** changed directory structure -** -** Revision 1.6 2000/10/22 19:17:46 matt -** mapper cleanups galore -** -** Revision 1.5 2000/10/22 15:03:14 matt -** simplified mirroring -** -** Revision 1.4 2000/10/21 19:33:38 matt -** many more cleanups -** -** Revision 1.3 2000/07/10 05:29:03 matt -** cleaned up some mirroring issues -** -** Revision 1.2 2000/07/06 02:48:43 matt -** clearly labelled structure members -** -** Revision 1.1 2000/07/06 01:01:56 matt -** initial revision -** -*/ diff --git a/MCUME_pico/piconofrendo/map078.c b/MCUME_pico/piconofrendo/map078.c deleted file mode 100755 index 306da78..0000000 --- a/MCUME_pico/piconofrendo/map078.c +++ /dev/null @@ -1,111 +0,0 @@ -/* -** Nofrendo (c) 1998-2000 Matthew Conte (matt@conte.com) -** -** -** This program is free software; you can redistribute it and/or -** modify it under the terms of version 2 of the GNU Library General -** Public License as published by the Free Software Foundation. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** Library General Public License for more details. To obtain a -** copy of the GNU Library General Public License, write to the Free -** Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -** -** Any permitted reproduction of these routines, in whole or in part, -** must bear this legend. -** -** -** map78.c -** -** mapper 78 interface -** $Id: map078.c,v 1.2 2001/04/27 14:37:11 neil Exp $ -*/ - -#include "noftypes.h" -#include "nes_mmc.h" -#include "nes_ppu.h" - -/* mapper 78: Holy Diver, Cosmo Carrier */ -/* ($8000-$FFFF) D2-D0 = switch $8000-$BFFF */ -/* ($8000-$FFFF) D7-D4 = switch PPU $0000-$1FFF */ -/* ($8000-$FFFF) D3 = switch mirroring */ -static void map78_write(uint32 address, uint8 value) -{ - UNUSED(address); - - mmc_bankrom(16, 0x8000, value & 7); - mmc_bankvrom(8, 0x0000, (value >> 4) & 0x0F); - - /* Ugh! Same abuse of the 4-screen bit as with Mapper #70 */ - if (mmc_getinfo()->flags & ROM_FLAG_FOURSCREEN) - { - if (value & 0x08) - ppu_mirror(0, 1, 0, 1); /* vert */ - else - ppu_mirror(0, 0, 1, 1); /* horiz */ - } - else - { - int mirror = (value >> 3) & 1; - ppu_mirror(mirror, mirror, mirror, mirror); - } -} - -static const map_memwrite map78_memwrite[] = -{ - { 0x8000, 0xFFFF, map78_write }, - { -1, -1, NULL } -}; - -const mapintf_t map78_intf = -{ - 78, /* mapper number */ - "Mapper 78", /* mapper name */ - NULL, /* init routine */ - NULL, /* vblank callback */ - NULL, /* hblank callback */ - NULL, /* get state (snss) */ - NULL, /* set state (snss) */ - NULL, /* memory read structure */ - map78_memwrite, /* memory write structure */ - NULL /* external sound device */ -}; - -/* -** $Log: map078.c,v $ -** Revision 1.2 2001/04/27 14:37:11 neil -** wheeee -** -** Revision 1.1 2001/04/27 12:54:40 neil -** blah -** -** Revision 1.1.1.1 2001/04/27 07:03:54 neil -** initial -** -** Revision 1.1 2000/10/24 12:19:33 matt -** changed directory structure -** -** Revision 1.7 2000/10/22 19:17:46 matt -** mapper cleanups galore -** -** Revision 1.6 2000/10/22 15:03:14 matt -** simplified mirroring -** -** Revision 1.5 2000/10/21 19:33:38 matt -** many more cleanups -** -** Revision 1.4 2000/08/16 02:50:11 matt -** random mapper cleanups -** -** Revision 1.3 2000/07/10 05:29:03 matt -** cleaned up some mirroring issues -** -** Revision 1.2 2000/07/06 02:48:43 matt -** clearly labelled structure members -** -** Revision 1.1 2000/07/06 01:01:56 matt -** initial revision -** -*/ diff --git a/MCUME_pico/piconofrendo/map079.c b/MCUME_pico/piconofrendo/map079.c deleted file mode 100755 index 3f92f6e..0000000 --- a/MCUME_pico/piconofrendo/map079.c +++ /dev/null @@ -1,92 +0,0 @@ -/* -** Nofrendo (c) 1998-2000 Matthew Conte (matt@conte.com) -** -** -** This program is free software; you can redistribute it and/or -** modify it under the terms of version 2 of the GNU Library General -** Public License as published by the Free Software Foundation. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** Library General Public License for more details. To obtain a -** copy of the GNU Library General Public License, write to the Free -** Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -** -** Any permitted reproduction of these routines, in whole or in part, -** must bear this legend. -** -** -** map78.c -** -** mapper 78 interface -** $Id: map079.c,v 1.2 2001/04/27 14:37:11 neil Exp $ -*/ - -#include "noftypes.h" -#include "nes_mmc.h" - - -/* mapper 79: NINA-03/06 */ -static void map79_write(uint32 address, uint8 value) -{ - if ((address & 0x5100) == 0x4100) - { - mmc_bankrom(32, 0x8000, (value >> 3) & 1); - mmc_bankvrom(8, 0x0000, value & 7); - } -} - -static void map79_init(void) -{ - mmc_bankrom(32, 0x8000, 0); - mmc_bankvrom(8, 0x0000, 0); -} - -static const map_memwrite map79_memwrite[] = -{ - { 0x4100, 0x5FFF, map79_write }, /* ????? incorrect range ??? */ - { -1, -1, NULL } -}; - -const mapintf_t map79_intf = -{ - 79, /* mapper number */ - "NINA-03/06", /* mapper name */ - map79_init, /* init routine */ - NULL, /* vblank callback */ - NULL, /* hblank callback */ - NULL, /* get state (snss) */ - NULL, /* set state (snss) */ - NULL, /* memory read structure */ - map79_memwrite, /* memory write structure */ - NULL /* external sound device */ -}; - -/* -** $Log: map079.c,v $ -** Revision 1.2 2001/04/27 14:37:11 neil -** wheeee -** -** Revision 1.1 2001/04/27 12:54:40 neil -** blah -** -** Revision 1.1.1.1 2001/04/27 07:03:54 neil -** initial -** -** Revision 1.1 2000/10/24 12:19:33 matt -** changed directory structure -** -** Revision 1.4 2000/10/22 19:17:47 matt -** mapper cleanups galore -** -** Revision 1.3 2000/10/21 19:33:38 matt -** many more cleanups -** -** Revision 1.2 2000/07/06 02:48:43 matt -** clearly labelled structure members -** -** Revision 1.1 2000/07/06 01:01:56 matt -** initial revision -** -*/ diff --git a/MCUME_pico/piconofrendo/map085.c b/MCUME_pico/piconofrendo/map085.c deleted file mode 100755 index a1252d0..0000000 --- a/MCUME_pico/piconofrendo/map085.c +++ /dev/null @@ -1,232 +0,0 @@ -/* -** Nofrendo (c) 1998-2000 Matthew Conte (matt@conte.com) -** -** -** This program is free software; you can redistribute it and/or -** modify it under the terms of version 2 of the GNU Library General -** Public License as published by the Free Software Foundation. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** Library General Public License for more details. To obtain a -** copy of the GNU Library General Public License, write to the Free -** Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -** -** Any permitted reproduction of these routines, in whole or in part, -** must bear this legend. -** -** -** map85.c -** -** mapper 85 interface -** $Id: map085.c,v 1.3 2001/05/06 01:42:03 neil Exp $ -*/ - -#include "noftypes.h" -#include "nes_mmc.h" -#include "nes.h" -#include "log.h" - -static struct -{ - int counter, latch; - int wait_state; - bool enabled; -} irq; - -/* mapper 85: Konami VRC7 */ -static void map85_write(uint32 address, uint8 value) -{ - uint8 bank = address >> 12; - uint8 reg = (address & 0x10) | ((address & 0x08) << 1); - - switch (bank) - { - case 0x08: - if (0x10 == reg) - mmc_bankrom(8, 0xA000, value); - else - mmc_bankrom(8, 0x8000, value); - break; - - case 0x09: - /* 0x10 & 0x30 should be trapped by sound emulation */ - mmc_bankrom(8, 0xC000, value); - break; - - case 0x0A: - if (0x10 == reg) - mmc_bankvrom(1, 0x0400, value); - else - mmc_bankvrom(1, 0x0000, value); - break; - - case 0x0B: - if (0x10 == reg) - mmc_bankvrom(1, 0x0C00, value); - else - mmc_bankvrom(1, 0x0800, value); - break; - - case 0x0C: - if (0x10 == reg) - mmc_bankvrom(1, 0x1400, value); - else - mmc_bankvrom(1, 0x1000, value); - break; - - case 0x0D: - if (0x10 == reg) - mmc_bankvrom(1, 0x1C00, value); - else - mmc_bankvrom(1, 0x1800, value); - break; - - case 0x0E: - if (0x10 == reg) - { - irq.latch = value; - } - else - { - switch (value & 3) - { - case 0: - ppu_mirror(0, 1, 0, 1); /* vertical */ - break; - - case 1: - ppu_mirror(0, 0, 1, 1); /* horizontal */ - break; - - case 2: - ppu_mirror(0, 0, 0, 0); - break; - - case 3: - ppu_mirror(1, 1, 1, 1); - break; - } - } - break; - - case 0x0F: - if (0x10 == reg) - { - irq.enabled = irq.wait_state; - } - else - { - irq.wait_state = value & 0x01; - irq.enabled = (value & 0x02) ? true : false; - if (true == irq.enabled) - irq.counter = irq.latch; - } - break; - - default: -#ifdef NOFRENDO_DEBUG - log_printf("unhandled vrc7 write: $%02X to $%04X\n", value, address); -#endif /* NOFRENDO_DEBUG */ - break; - } -} - -static void map85_hblank(int vblank) -{ - UNUSED(vblank); - - if (irq.enabled) - { - if (++irq.counter > 0xFF) - { - irq.counter = irq.latch; - nes_irq(); - - //return; - } - //irq.counter++; - } -} - -static const map_memwrite map85_memwrite[] = -{ - { 0x8000, 0xFFFF, map85_write }, - { -1, -1, NULL } -}; - -static void map85_init(void) -{ - mmc_bankrom(16, 0x8000, 0); - mmc_bankrom(16, 0xC000, MMC_LASTBANK); - - mmc_bankvrom(8, 0x0000, 0); - - irq.counter = irq.latch = 0; - irq.wait_state = 0; - irq.enabled = false; -} - -const mapintf_t map85_intf = -{ - 85, /* mapper number */ - "Konami VRC7", /* mapper name */ - map85_init, /* init routine */ - NULL, /* vblank callback */ - map85_hblank, /* hblank callback */ - NULL, /* get state (snss) */ - NULL, /* set state (snss) */ - NULL, /* memory read structure */ - map85_memwrite, /* memory write structure */ - NULL -}; - -/* -** $Log: map085.c,v $ -** Revision 1.3 2001/05/06 01:42:03 neil -** boooo -** -** Revision 1.2 2001/04/27 14:37:11 neil -** wheeee -** -** Revision 1.1 2001/04/27 12:54:40 neil -** blah -** -** Revision 1.1.1.1 2001/04/27 07:03:54 neil -** initial -** -** Revision 1.1 2000/10/24 12:19:33 matt -** changed directory structure -** -** Revision 1.10 2000/10/22 19:17:46 matt -** mapper cleanups galore -** -** Revision 1.9 2000/10/22 15:03:14 matt -** simplified mirroring -** -** Revision 1.8 2000/10/21 19:33:38 matt -** many more cleanups -** -** Revision 1.7 2000/10/10 13:58:17 matt -** stroustrup squeezing his way in the door -** -** Revision 1.6 2000/08/16 02:50:11 matt -** random mapper cleanups -** -** Revision 1.5 2000/07/23 14:37:21 matt -** added a break statement -** -** Revision 1.4 2000/07/15 23:52:19 matt -** rounded out a bunch more mapper interfaces -** -** Revision 1.3 2000/07/10 13:51:25 matt -** using generic nes_irq() routine now -** -** Revision 1.2 2000/07/10 05:29:03 matt -** cleaned up some mirroring issues -** -** Revision 1.1 2000/07/06 02:47:47 matt -** initial revision -** -*/ diff --git a/MCUME_pico/piconofrendo/map087.c b/MCUME_pico/piconofrendo/map087.c deleted file mode 100755 index 4941167..0000000 --- a/MCUME_pico/piconofrendo/map087.c +++ /dev/null @@ -1,85 +0,0 @@ -/* -** Nofrendo (c) 1998-2000 Matthew Conte (matt@conte.com) -** -** -** This program is free software; you can redistribute it and/or -** modify it under the terms of version 2 of the GNU Library General -** Public License as published by the Free Software Foundation. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** Library General Public License for more details. To obtain a -** copy of the GNU Library General Public License, write to the Free -** Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -** -** Any permitted reproduction of these routines, in whole or in part, -** must bear this legend. -** -** -** map087.c -** -** Mapper #87 (16K VROM switch) -** Implementation by Firebug -** $Id: map087.c,v 1.2 2001/04/27 14:37:11 neil Exp $ -** -*/ - -#include "noftypes.h" -#include "nes_mmc.h" -#include "nes.h" -#include "libsnss.h" -#include "log.h" - -/******************************************/ -/* Mapper #87 write handler ($6000-$7FFF) */ -/******************************************/ -static void map87_write (uint32 address, uint8 value) -{ - /* Within range, address written to is irrelevant */ - UNUSED (address); - - /* Very simple: 8K CHR page is selected by D1 */ - if (value & 0x02) mmc_bankvrom (8, 0x0000, 0x01); - else mmc_bankvrom (8, 0x0000, 0x00); - - /* Done */ - return; -} - -static const map_memwrite map87_memwrite [] = -{ - { 0x6000, 0x7FFF, map87_write }, - { -1, -1, NULL } -}; - -const mapintf_t map87_intf = -{ - 87, /* Mapper number */ - "16K VROM switch", /* Mapper name */ - NULL, /* Initialization routine */ - NULL, /* VBlank callback */ - NULL, /* HBlank callback */ - NULL, /* Get state (SNSS) */ - NULL, /* Set state (SNSS) */ - NULL, /* Memory read structure */ - map87_memwrite, /* Memory write structure */ - NULL /* External sound device */ -}; - -/* -** $Log: map087.c,v $ -** Revision 1.2 2001/04/27 14:37:11 neil -** wheeee -** -** Revision 1.1 2001/04/27 12:54:40 neil -** blah -** -** Revision 1.1 2001/04/27 10:57:41 neil -** wheee -** -** Revision 1.1 2000/12/30 06:34:44 firebug -** Initial revision -** -** -*/ diff --git a/MCUME_pico/piconofrendo/map093.c b/MCUME_pico/piconofrendo/map093.c deleted file mode 100755 index 80b9be5..0000000 --- a/MCUME_pico/piconofrendo/map093.c +++ /dev/null @@ -1,77 +0,0 @@ -/* -** Nofrendo (c) 1998-2000 Matthew Conte (matt@conte.com) -** -** -** This program is free software; you can redistribute it and/or -** modify it under the terms of version 2 of the GNU Library General -** Public License as published by the Free Software Foundation. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** Library General Public License for more details. To obtain a -** copy of the GNU Library General Public License, write to the Free -** Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -** -** Any permitted reproduction of these routines, in whole or in part, -** must bear this legend. -** -** -** map93.c -** -** mapper 93 interface -** $Id: map093.c,v 1.2 2001/04/27 14:37:11 neil Exp $ -*/ - -#include "noftypes.h" -#include "nes_mmc.h" -#include "nes_ppu.h" - -static void map93_write(uint32 address, uint8 value) -{ - UNUSED(address); - - /* ($8000-$FFFF) D7-D4 = switch $8000-$BFFF D0: mirror */ - mmc_bankrom(16, 0x8000, value >> 4); - - if (value & 1) - ppu_mirror(0, 1, 0, 1); /* vert */ - else - ppu_mirror(0, 0, 1, 1); /* horiz */ -} - -static const map_memwrite map93_memwrite[] = -{ - { 0x8000, 0xFFFF, map93_write }, - { -1, -1, NULL } -}; - -const mapintf_t map93_intf = -{ - 93, /* mapper number */ - "Mapper 93", /* mapper name */ - NULL, /* init routine */ - NULL, /* vblank callback */ - NULL, /* hblank callback */ - NULL, /* get state (snss) */ - NULL, /* set state (snss) */ - NULL, /* memory read structure */ - map93_memwrite, /* memory write structure */ - NULL /* external sound device */ -}; - -/* -** $Log: map093.c,v $ -** Revision 1.2 2001/04/27 14:37:11 neil -** wheeee -** -** Revision 1.1 2001/04/27 12:54:40 neil -** blah -** -** Revision 1.1.1.1 2001/04/27 07:03:54 neil -** initial -** -** Revision 1.1 2000/12/11 12:33:48 matt -** initial revision -** -*/ diff --git a/MCUME_pico/piconofrendo/map094.c b/MCUME_pico/piconofrendo/map094.c deleted file mode 100755 index 04f3922..0000000 --- a/MCUME_pico/piconofrendo/map094.c +++ /dev/null @@ -1,87 +0,0 @@ -/* -** Nofrendo (c) 1998-2000 Matthew Conte (matt@conte.com) -** -** -** This program is free software; you can redistribute it and/or -** modify it under the terms of version 2 of the GNU Library General -** Public License as published by the Free Software Foundation. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** Library General Public License for more details. To obtain a -** copy of the GNU Library General Public License, write to the Free -** Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -** -** Any permitted reproduction of these routines, in whole or in part, -** must bear this legend. -** -** -** map94.c -** -** mapper 94 interface -** $Id: map094.c,v 1.2 2001/04/27 14:37:11 neil Exp $ -*/ - -#include "noftypes.h" -#include "nes_mmc.h" - -/* mapper 94: Senjou no Ookami */ -static void map94_write(uint32 address, uint8 value) -{ - UNUSED(address); - - /* ($8000-$FFFF) D7-D2 = switch $8000-$BFFF */ - mmc_bankrom(16, 0x8000, value >> 2); -} - -static const map_memwrite map94_memwrite[] = -{ - { 0x8000, 0xFFFF, map94_write }, - { -1, -1, NULL } -}; - -const mapintf_t map94_intf = -{ - 94, /* mapper number */ - "Mapper 94", /* mapper name */ - NULL, /* init routine */ - NULL, /* vblank callback */ - NULL, /* hblank callback */ - NULL, /* get state (snss) */ - NULL, /* set state (snss) */ - NULL, /* memory read structure */ - map94_memwrite, /* memory write structure */ - NULL /* external sound device */ -}; - -/* -** $Log: map094.c,v $ -** Revision 1.2 2001/04/27 14:37:11 neil -** wheeee -** -** Revision 1.1 2001/04/27 12:54:40 neil -** blah -** -** Revision 1.1.1.1 2001/04/27 07:03:54 neil -** initial -** -** Revision 1.1 2000/10/24 12:19:33 matt -** changed directory structure -** -** Revision 1.5 2000/10/22 19:17:47 matt -** mapper cleanups galore -** -** Revision 1.4 2000/10/21 19:33:38 matt -** many more cleanups -** -** Revision 1.3 2000/08/16 02:50:11 matt -** random mapper cleanups -** -** Revision 1.2 2000/07/06 02:48:43 matt -** clearly labelled structure members -** -** Revision 1.1 2000/07/06 01:01:56 matt -** initial revision -** -*/ diff --git a/MCUME_pico/piconofrendo/map099.c b/MCUME_pico/piconofrendo/map099.c deleted file mode 100755 index 01ceec4..0000000 --- a/MCUME_pico/piconofrendo/map099.c +++ /dev/null @@ -1,90 +0,0 @@ -/* -** Nofrendo (c) 1998-2000 Matthew Conte (matt@conte.com) -** -** -** This program is free software; you can redistribute it and/or -** modify it under the terms of version 2 of the GNU Library General -** Public License as published by the Free Software Foundation. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** Library General Public License for more details. To obtain a -** copy of the GNU Library General Public License, write to the Free -** Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -** -** Any permitted reproduction of these routines, in whole or in part, -** must bear this legend. -** -** -** map99.c -** -** mapper 99 interface -** $Id: map099.c,v 1.2 2001/04/27 14:37:11 neil Exp $ -*/ - -#include "noftypes.h" -#include "nes_mmc.h" -#include "nes_ppu.h" - -/* Switch VROM for VS games */ -static void map99_vromswitch(uint8 value) -{ - int bank = (value & 0x04) >> 2; - mmc_bankvrom(8, 0x0000, bank); -} - -/* mapper 99: VS. System */ -static const void map99_init(void) -{ - ppu_mirror(0, 1, 2, 3); - ppu_setvromswitch(map99_vromswitch); -} - -const mapintf_t map99_intf = -{ - 99, /* mapper number */ - "VS. System", /* mapper name */ - map99_init, /* init routine */ - NULL, /* vblank callback */ - NULL, /* hblank callback */ - NULL, /* get state (snss) */ - NULL, /* set state (snss) */ - NULL, /* memory read structure */ - NULL, /* memory write structure */ - NULL /* external sound device */ -}; - -/* -** $Log: map099.c,v $ -** Revision 1.2 2001/04/27 14:37:11 neil -** wheeee -** -** Revision 1.1 2001/04/27 12:54:40 neil -** blah -** -** Revision 1.1.1.1 2001/04/27 07:03:54 neil -** initial -** -** Revision 1.1 2000/10/24 12:19:33 matt -** changed directory structure -** -** Revision 1.6 2000/10/22 19:17:47 matt -** mapper cleanups galore -** -** Revision 1.5 2000/10/21 19:33:38 matt -** many more cleanups -** -** Revision 1.4 2000/10/10 13:58:17 matt -** stroustrup squeezing his way in the door -** -** Revision 1.3 2000/07/10 05:29:03 matt -** cleaned up some mirroring issues -** -** Revision 1.2 2000/07/06 02:48:43 matt -** clearly labelled structure members -** -** Revision 1.1 2000/07/05 05:05:18 matt -** initial revision -** -*/ diff --git a/MCUME_pico/piconofrendo/map160.c b/MCUME_pico/piconofrendo/map160.c deleted file mode 100755 index 9b53339..0000000 --- a/MCUME_pico/piconofrendo/map160.c +++ /dev/null @@ -1,140 +0,0 @@ -/* -** Nofrendo (c) 1998-2000 Matthew Conte (matt@conte.com) -** -** -** This program is free software; you can redistribute it and/or -** modify it under the terms of version 2 of the GNU Library General -** Public License as published by the Free Software Foundation. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** Library General Public License for more details. To obtain a -** copy of the GNU Library General Public License, write to the Free -** Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -** -** Any permitted reproduction of these routines, in whole or in part, -** must bear this legend. -** -** -** map160.c -** -** mapper 160 interface -** $Id: map160.c,v 1.2 2001/04/27 14:37:11 neil Exp $ -*/ - -#include "noftypes.h" -#include "nes_mmc.h" -#include "nes_ppu.h" -#include "nes.h" - -static struct -{ - bool enabled, expired; - int counter; - int latch_c005, latch_c003; -} irq; - -static void map160_write(uint32 address, uint8 value) -{ - if (address >= 0x8000 && address <= 0x8003) - { - mmc_bankrom(8, 0x8000 + 0x2000 * (address & 3), value); - } - else if (address >= 0x9000 && address <= 0x9007) - { - mmc_bankvrom(1, 0x400 * (address & 7), value); - } - else if (0xC002 == address) - { - irq.enabled = false; - irq.latch_c005 = irq.latch_c003; - } - else if (0xC003 == address) - { - if (false == irq.expired) - { - irq.counter = value; - } - else - { - irq.expired = false; - irq.enabled = true; - irq.counter = irq.latch_c005; - } - } - else if (0xC005 == address) - { - irq.latch_c005 = value; - irq.counter = value; - } -#ifdef NOFRENDO_DEBUG - else - { - log_printf("mapper 160: untrapped write $%02X to $%04X\n", value, address); - } -#endif /* NOFRENDO_DEBUG */ -} - -static void map160_hblank(int vblank) -{ - if (!vblank) - { - if (ppu_enabled() && irq.enabled) - { - if (0 == irq.counter && false == irq.expired) - { - irq.expired = true; - nes_irq(); - } - else - { - irq.counter--; - } - } - } -} - -static void map160_init(void) -{ - irq.enabled = false; - irq.expired = false; - irq.counter = 0; - irq.latch_c003 = irq.latch_c005 = 0; -} - -static const map_memwrite map160_memwrite[] = -{ - { 0x8000, 0xFFFF, map160_write }, - { -1, -1, NULL } -}; - -const mapintf_t map160_intf = -{ - 160, /* mapper number */ - "Aladdin (pirate)", /* mapper name */ - map160_init, /* init routine */ - NULL, /* vblank callback */ - map160_hblank, /* hblank callback */ - NULL, /* get state (snss) */ - NULL, /* set state (snss) */ - NULL, /* memory read structure */ - map160_memwrite, /* memory write structure */ - NULL /* external sound device */ -}; - -/* -** $Log: map160.c,v $ -** Revision 1.2 2001/04/27 14:37:11 neil -** wheeee -** -** Revision 1.1 2001/04/27 12:54:40 neil -** blah -** -** Revision 1.1 2001/04/27 10:57:41 neil -** wheee -** -** Revision 1.1 2000/12/27 04:24:46 matt -** initial revision -** -*/ diff --git a/MCUME_pico/piconofrendo/map229.c b/MCUME_pico/piconofrendo/map229.c deleted file mode 100755 index f3114fa..0000000 --- a/MCUME_pico/piconofrendo/map229.c +++ /dev/null @@ -1,114 +0,0 @@ -/* -** Nofrendo (c) 1998-2000 Matthew Conte (matt@conte.com) -** -** -** This program is free software; you can redistribute it and/or -** modify it under the terms of version 2 of the GNU Library General -** Public License as published by the Free Software Foundation. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** Library General Public License for more details. To obtain a -** copy of the GNU Library General Public License, write to the Free -** Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -** -** Any permitted reproduction of these routines, in whole or in part, -** must bear this legend. -** -** -** map229.c -** -** Mapper #229 (31 in 1) -** Implementation by Firebug -** Mapper information courtesy of Mark Knibbs -** $Id: map229.c,v 1.2 2001/04/27 14:37:11 neil Exp $ -** -*/ - -#include "noftypes.h" -#include "nes_mmc.h" -#include "nes.h" -#include "libsnss.h" -#include "log.h" - -/************************/ -/* Mapper #229: 31 in 1 */ -/************************/ -static void map229_init (void) -{ - /* On reset, PRG is set to first 32K and CHR to first 8K */ - mmc_bankrom (32, 0x8000, 0x00); - mmc_bankvrom (8, 0x0000, 0x00); - - /* Done */ - return; -} - -/*******************************************/ -/* Mapper #229 write handler ($8000-$FFFF) */ -/*******************************************/ -static void map229_write (uint32 address, uint8 value) -{ - /* Value written is irrelevant */ - UNUSED (value); - - /* A4-A0 sets 8K CHR page */ - mmc_bankvrom (8, 0x0000, (uint8) (address & 0x1F)); - - /* If A4-A1 are all low then select the first 32K, */ - /* otherwise select a 16K bank at both $8000 and $C000 */ - if ((address & 0x1E) == 0x00) - { - mmc_bankrom (32, 0x8000, 0x00); - } - else - { - mmc_bankrom (16, 0x8000, (uint8) (address & 0x1F)); - mmc_bankrom (16, 0xC000, (uint8) (address & 0x1F)); - } - - /* A5: mirroring (low = vertical, high = horizontal) */ - if (address & 0x20) ppu_mirror(0, 0, 1, 1); - else ppu_mirror(0, 1, 0, 1); - - /* Done */ - return; -} - -static const map_memwrite map229_memwrite [] = -{ - { 0x8000, 0xFFFF, map229_write }, - { -1, -1, NULL } -}; - -const mapintf_t map229_intf = -{ - 229, /* Mapper number */ - "31 in 1 (bootleg)", /* Mapper name */ - map229_init, /* Initialization routine */ - NULL, /* VBlank callback */ - NULL, /* HBlank callback */ - NULL, /* Get state (SNSS) */ - NULL, /* Set state (SNSS) */ - NULL, /* Memory read structure */ - map229_memwrite, /* Memory write structure */ - NULL /* External sound device */ -}; - -/* -** $Log: map229.c,v $ -** Revision 1.2 2001/04/27 14:37:11 neil -** wheeee -** -** Revision 1.1 2001/04/27 12:54:40 neil -** blah -** -** Revision 1.1 2001/04/27 10:57:41 neil -** wheee -** -** Revision 1.1 2000/12/30 06:34:31 firebug -** Initial revision -** -** -*/ diff --git a/MCUME_pico/piconofrendo/map231.c b/MCUME_pico/piconofrendo/map231.c deleted file mode 100755 index 5946b2b..0000000 --- a/MCUME_pico/piconofrendo/map231.c +++ /dev/null @@ -1,95 +0,0 @@ -/* -** Nofrendo (c) 1998-2000 Matthew Conte (matt@conte.com) -** -** -** This program is free software; you can redistribute it and/or -** modify it under the terms of version 2 of the GNU Library General -** Public License as published by the Free Software Foundation. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** Library General Public License for more details. To obtain a -** copy of the GNU Library General Public License, write to the Free -** Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -** -** Any permitted reproduction of these routines, in whole or in part, -** must bear this legend. -** -** -** map231.c -** -** mapper 231 interface -** $Id: map231.c,v 1.2 2001/04/27 14:37:11 neil Exp $ -*/ - -#include "noftypes.h" -#include "nes_mmc.h" - -/* mapper 231: NINA-07, used in Wally Bear and the NO! Gang */ - -static void map231_init(void) -{ - mmc_bankrom(32, 0x8000, MMC_LASTBANK); -} - -static void map231_write(uint32 address, uint8 value) -{ - int bank, vbank; - UNUSED(address); - - bank = ((value & 0x80) >> 5) | (value & 0x03); - vbank = (value >> 4) & 0x07; - - mmc_bankrom(32, 0x8000, bank); - mmc_bankvrom(8, 0x0000, vbank); -} - -static const map_memwrite map231_memwrite[] = -{ - { 0x8000, 0xFFFF, map231_write }, - { -1, -1, NULL } -}; - -const mapintf_t map231_intf = -{ - 231, /* mapper number */ - "NINA-07", /* mapper name */ - map231_init, /* init routine */ - NULL, /* vblank callback */ - NULL, /* hblank callback */ - NULL, /* get state (snss) */ - NULL, /* set state (snss) */ - NULL, /* memory read structure */ - map231_memwrite, /* memory write structure */ - NULL /* external sound device */ -}; - -/* -** $Log: map231.c,v $ -** Revision 1.2 2001/04/27 14:37:11 neil -** wheeee -** -** Revision 1.1 2001/04/27 12:54:40 neil -** blah -** -** Revision 1.1.1.1 2001/04/27 07:03:54 neil -** initial -** -** Revision 1.1 2000/10/24 12:19:33 matt -** changed directory structure -** -** Revision 1.4 2000/10/22 19:17:46 matt -** mapper cleanups galore -** -** Revision 1.3 2000/10/21 19:33:38 matt -** many more cleanups -** -** Revision 1.2 2000/08/16 02:50:11 matt -** random mapper cleanups -** -** Revision 1.1 2000/07/11 03:14:18 melanson -** Initial commit for mappers 16, 34, and 231 -** -** -*/ diff --git a/MCUME_pico/piconofrendo/mapvrc.c b/MCUME_pico/piconofrendo/mapvrc.c deleted file mode 100755 index 67124f2..0000000 --- a/MCUME_pico/piconofrendo/mapvrc.c +++ /dev/null @@ -1,452 +0,0 @@ -/* -** Nofrendo (c) 1998-2000 Matthew Conte (matt@conte.com) -** -** -** This program is free software; you can redistribute it and/or -** modify it under the terms of version 2 of the GNU Library General -** Public License as published by the Free Software Foundation. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** Library General Public License for more details. To obtain a -** copy of the GNU Library General Public License, write to the Free -** Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -** -** Any permitted reproduction of these routines, in whole or in part, -** must bear this legend. -** -** -** map_vrc.c -** -** VRC mapper interface -** $Id: mapvrc.c,v 1.2 2001/04/27 14:37:11 neil Exp $ -*/ - -#include "noftypes.h" -#include "nes_mmc.h" -#include "nes.h" -#include "log.h" - -#define VRC_VBANK(bank, value, high) \ -{ \ - if ((high)) \ - highnybbles[(bank)] = (value) & 0x0F; \ - else \ - lownybbles[(bank)] = (value) & 0x0F; \ - mmc_bankvrom(1, (bank) << 10, (highnybbles[(bank)] << 4)+lownybbles[(bank)]); \ -} - -static struct -{ - int counter, enabled; - int latch, wait_state; -} irq; - -static int select_c000 = 0; -static uint8 lownybbles[8]; -static uint8 highnybbles[8]; - -static void vrc_init(void) -{ - irq.counter = irq.enabled = 0; - irq.latch = irq.wait_state = 0; -} - -static void map21_write(uint32 address, uint8 value) -{ - switch (address) - { - case 0x8000: - if (select_c000) - mmc_bankrom(8, 0xC000,value); - else - mmc_bankrom(8, 0x8000,value); - break; - - case 0x9000: - switch (value & 3) - { - case 0: - ppu_mirror(0, 1, 0, 1); /* vertical */ - break; - - case 1: - ppu_mirror(0, 0, 1, 1); /* horizontal */ - break; - - case 2: - ppu_mirror(0, 0, 0, 0); - break; - - case 3: - ppu_mirror(1, 1, 1, 1); - break; - - default: - break; - } - break; - case 0x9002: select_c000=(value&0x02)>>1; break; - case 0xA000: mmc_bankrom(8, 0xA000,value); break; - - case 0xB000: VRC_VBANK(0,value,0); break; - case 0xB002: - case 0xB040: VRC_VBANK(0,value,1); break; - case 0xB001: - case 0xB004: - case 0xB080: VRC_VBANK(1,value,0); break; - case 0xB003: - case 0xB006: - case 0xB0C0: VRC_VBANK(1,value,1); break; - case 0xC000: VRC_VBANK(2,value,0); break; - case 0xC002: - case 0xC040: VRC_VBANK(2,value,1); break; - case 0xC001: - case 0xC004: - case 0xC080: VRC_VBANK(3,value,0); break; - case 0xC003: - case 0xC006: - case 0xC0C0: VRC_VBANK(3,value,1); break; - case 0xD000: VRC_VBANK(4,value,0); break; - case 0xD002: - case 0xD040: VRC_VBANK(4,value,1); break; - case 0xD001: - case 0xD004: - case 0xD080: VRC_VBANK(5,value,0); break; - case 0xD003: - case 0xD006: - case 0xD0C0: VRC_VBANK(5,value,1); break; - case 0xE000: VRC_VBANK(6,value,0); break; - case 0xE002: - case 0xE040: VRC_VBANK(6,value,1); break; - case 0xE001: - case 0xE004: - case 0xE080: VRC_VBANK(7,value,0); break; - case 0xE003: - case 0xE006: - case 0xE0C0: VRC_VBANK(7,value,1); break; - - case 0xF000: - irq.latch &= 0xF0; - irq.latch |= (value & 0x0F); - break; - case 0xF002: - case 0xF040: - irq.latch &= 0x0F; - irq.latch |= ((value & 0x0F) << 4); - break; - case 0xF004: - case 0xF001: - case 0xF080: - irq.enabled = (value >> 1) & 0x01; - irq.wait_state = value & 0x01; - irq.counter = irq.latch; - break; - case 0xF006: - case 0xF003: - case 0xF0C0: - irq.enabled = irq.wait_state; - break; - - default: -#ifdef NOFRENDO_DEBUG - log_printf("wrote $%02X to $%04X", value, address); -#endif - break; - } -} - -static void map22_write(uint32 address, uint8 value) -{ - int reg = address >> 12; - - switch (reg) - { - case 0x8: - mmc_bankrom(8, 0x8000, value); - break; - - case 0xA: - mmc_bankrom(8, 0xA000, value); - break; - - case 0x9: - switch (value & 3) - { - case 0: - ppu_mirror(0, 1, 0, 1); /* vertical */ - break; - - case 1: - ppu_mirror(0, 0, 1, 1); /* horizontal */ - break; - - case 2: - ppu_mirror(1, 1, 1, 1); - break; - - case 3: - ppu_mirror(0, 0, 0, 0); - break; - } - break; - - case 0xB: - case 0xC: - case 0xD: - case 0xE: - { - int loc = (((reg - 0xB) << 1) + (address & 1)) << 10; - mmc_bankvrom(1, loc, value >> 1); - } - break; - - default: - break; - } -} - -static void map23_write(uint32 address, uint8 value) -{ - switch (address) - { - case 0x8000: - case 0x8FFF: - mmc_bankrom(8, 0x8000, value); - break; - - case 0xA000: - case 0xAFFF: - mmc_bankrom(8, 0xA000, value); - break; - - case 0x9000: - case 0x9004: - case 0x9008: - switch(value & 3) - { - case 0: - ppu_mirror(0, 1, 0, 1); /* vertical */ - break; - - case 1: - ppu_mirror(0, 0, 1, 1); /* horizontal */ - break; - - case 2: - ppu_mirror(0, 0, 0, 0); - break; - - case 3: - ppu_mirror(1, 1, 1, 1); - break; - } - break; - - case 0xB000: VRC_VBANK(0,value,0); break; - case 0xB001: - case 0xB004: VRC_VBANK(0,value,1); break; - case 0xB002: - case 0xB008: VRC_VBANK(1,value,0); break; - case 0xB003: - case 0xB00C: VRC_VBANK(1,value,1); break; - case 0xC000: VRC_VBANK(2,value,0); break; - case 0xC001: - case 0xC004: VRC_VBANK(2,value,1); break; - case 0xC002: - case 0xC008: VRC_VBANK(3,value,0); break; - case 0xC003: - case 0xC00C: VRC_VBANK(3,value,1); break; - case 0xD000: VRC_VBANK(4,value,0); break; - case 0xD001: - case 0xD004: VRC_VBANK(4,value,1); break; - case 0xD002: - case 0xD008: VRC_VBANK(5,value,0); break; - case 0xD003: - case 0xD00C: VRC_VBANK(5,value,1); break; - case 0xE000: VRC_VBANK(6,value,0); break; - case 0xE001: - case 0xE004: VRC_VBANK(6,value,1); break; - case 0xE002: - case 0xE008: VRC_VBANK(7,value,0); break; - case 0xE003: - case 0xE00C: VRC_VBANK(7,value,1); break; - - case 0xF000: - irq.latch &= 0xF0; - irq.latch |= (value & 0x0F); - break; - - case 0xF004: - irq.latch &= 0x0F; - irq.latch |= ((value & 0x0F) << 4); - break; - - case 0xF008: - irq.enabled = (value >> 1) & 0x01; - irq.wait_state = value & 0x01; - irq.counter = irq.latch; - break; - - case 0xF00C: - irq.enabled = irq.wait_state; - break; - - default: -#ifdef NOFRENDO_DEBUG - log_printf("wrote $%02X to $%04X",value,address); -#endif - break; - } -} - -static void vrc_hblank(int vblank) -{ - UNUSED(vblank); - - if (irq.enabled) - { - if (256 == ++irq.counter) - { - irq.counter = irq.latch; - nes_irq(); - //irq.enabled = false; - irq.enabled = irq.wait_state; - } - } -} - - - -static map_memwrite map21_memwrite[] = -{ - { 0x8000, 0xFFFF, map21_write }, - { -1, -1, NULL } -}; - -static map_memwrite map22_memwrite[] = -{ - { 0x8000, 0xFFFF, map22_write }, - { -1, -1, NULL } -}; - -static map_memwrite map23_memwrite[] = -{ - { 0x8000, 0xFFFF, map23_write }, - { -1, -1, NULL } -}; - -static void map21_getstate(SnssMapperBlock *state) -{ - state->extraData.mapper21.irqCounter = irq.counter; - state->extraData.mapper21.irqCounterEnabled = irq.enabled; -} - -static void map21_setstate(SnssMapperBlock *state) -{ - irq.counter = state->extraData.mapper21.irqCounter; - irq.enabled = state->extraData.mapper21.irqCounterEnabled; -} - -const mapintf_t map21_intf = -{ - 21, /* mapper number */ - "Konami VRC4 A", /* mapper name */ - vrc_init, /* init routine */ - NULL, /* vblank callback */ - vrc_hblank, /* hblank callback */ - map21_getstate, /* get state (snss) */ - map21_setstate, /* set state (snss) */ - NULL, /* memory read structure */ - map21_memwrite, /* memory write structure */ - NULL /* external sound device */ -}; - -const mapintf_t map22_intf = -{ - 22, /* mapper number */ - "Konami VRC2 A", /* mapper name */ - vrc_init, /* init routine */ - NULL, /* vblank callback */ - NULL, /* hblank callback */ - NULL, /* get state (snss) */ - NULL, /* set state (snss) */ - NULL, /* memory read structure */ - map22_memwrite, /* memory write structure */ - NULL /* external sound device */ -}; - -const mapintf_t map23_intf = -{ - 23, /* mapper number */ - "Konami VRC2 B", /* mapper name */ - vrc_init, /* init routine */ - NULL, /* vblank callback */ - vrc_hblank, /* hblank callback */ - NULL, /* get state (snss) */ - NULL, /* set state (snss) */ - NULL, /* memory read structure */ - map23_memwrite, /* memory write structure */ - NULL /* external sound device */ -}; - -const mapintf_t map25_intf = -{ - 25, /* mapper number */ - "Konami VRC4 B", /* mapper name */ - NULL, /* init routine */ - NULL, /* vblank callback */ - vrc_hblank, /* hblank callback */ - NULL, /* get state (snss) */ - NULL, /* set state (snss) */ - NULL, /* memory read structure */ - map21_memwrite, /* memory write structure */ - NULL /* external sound device */ -}; - -/* -** $Log: mapvrc.c,v $ -** Revision 1.2 2001/04/27 14:37:11 neil -** wheeee -** -** Revision 1.1 2001/04/27 12:54:40 neil -** blah -** -** Revision 1.1.1.1 2001/04/27 07:03:54 neil -** initial -** -** Revision 1.1 2000/10/24 12:19:33 matt -** changed directory structure -** -** Revision 1.10 2000/10/22 19:17:46 matt -** mapper cleanups galore -** -** Revision 1.9 2000/10/22 15:03:14 matt -** simplified mirroring -** -** Revision 1.8 2000/10/21 19:33:38 matt -** many more cleanups -** -** Revision 1.7 2000/10/10 13:58:17 matt -** stroustrup squeezing his way in the door -** -** Revision 1.6 2000/08/16 02:50:11 matt -** random mapper cleanups -** -** Revision 1.5 2000/07/15 23:52:20 matt -** rounded out a bunch more mapper interfaces -** -** Revision 1.4 2000/07/10 13:51:25 matt -** using generic nes_irq() routine now -** -** Revision 1.3 2000/07/10 05:29:03 matt -** cleaned up some mirroring issues -** -** Revision 1.2 2000/07/06 02:48:43 matt -** clearly labelled structure members -** -** Revision 1.1 2000/07/06 01:01:56 matt -** initial revision -** -*/ diff --git a/MCUME_pico/piconofrendo/mmc5_snd.c b/MCUME_pico/piconofrendo/mmc5_snd.c deleted file mode 100755 index 29fb00e..0000000 --- a/MCUME_pico/piconofrendo/mmc5_snd.c +++ /dev/null @@ -1,447 +0,0 @@ -/* -** Nofrendo (c) 1998-2000 Matthew Conte (matt@conte.com) -** -** -** This program is free software; you can redistribute it and/or -** modify it under the terms of version 2 of the GNU Library General -** Public License as published by the Free Software Foundation. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** Library General Public License for more details. To obtain a -** copy of the GNU Library General Public License, write to the Free -** Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -** -** Any permitted reproduction of these routines, in whole or in part, -** must bear this legend. -** -** -** mmc5_snd.c -** -** Nintendo MMC5 sound emulation -** $Id: mmc5_snd.c,v 1.2 2001/04/27 14:37:11 neil Exp $ -*/ - -#include -#include "noftypes.h" -#include "mmc5_snd.h" -#include "nes_apu.h" - -/* TODO: encapsulate apu/mmc5 rectangle */ - -#define APU_OVERSAMPLE -#define APU_VOLUME_DECAY(x) ((x) -= ((x) >> 7)) - -/* look up table madness */ -static int32 decay_lut[16]; -static int vbl_lut[32]; - -/* various sound constants for sound emulation */ -/* vblank length table used for rectangles, triangle, noise */ -static const uint8 vbl_length[32] = -{ - 5, 127, 10, 1, 19, 2, 40, 3, 80, 4, 30, 5, 7, 6, 13, 7, - 6, 8, 12, 9, 24, 10, 48, 11, 96, 12, 36, 13, 8, 14, 16, 15 -}; - -/* ratios of pos/neg pulse for rectangle waves -** 2/16 = 12.5%, 4/16 = 25%, 8/16 = 50%, 12/16 = 75% -** (4-bit adder in rectangles, hence the 16) -*/ -static const int duty_lut[4] = -{ - 2, 4, 8, 12 -}; - - -#define MMC5_WRA0 0x5000 -#define MMC5_WRA1 0x5001 -#define MMC5_WRA2 0x5002 -#define MMC5_WRA3 0x5003 -#define MMC5_WRB0 0x5004 -#define MMC5_WRB1 0x5005 -#define MMC5_WRB2 0x5006 -#define MMC5_WRB3 0x5007 -#define MMC5_SMASK 0x5015 - -typedef struct mmc5rectangle_s -{ - uint8 regs[4]; - - bool enabled; - - float accum; - int32 freq; - int32 output_vol; - bool fixed_envelope; - bool holdnote; - uint8 volume; - - int32 env_phase; - int32 env_delay; - uint8 env_vol; - - int vbl_length; - uint8 adder; - int duty_flip; -} mmc5rectangle_t; - -typedef struct mmc5dac_s -{ - int32 output; - bool enabled; -} mmc5dac_t; - - -static struct -{ - float incsize; - uint8 mul[2]; - mmc5rectangle_t rect[2]; - mmc5dac_t dac; -} mmc5; - - -#define MMC5_RECTANGLE_OUTPUT chan->output_vol -static int32 mmc5_rectangle(mmc5rectangle_t *chan) -{ - int32 output; - -#ifdef APU_OVERSAMPLE - int num_times; - int32 total; -#endif /* APU_OVERSAMPLE */ - - /* reg0: 0-3=volume, 4=envelope, 5=hold, 6-7=duty cycle - ** reg1: 0-2=sweep shifts, 3=sweep inc/dec, 4-6=sweep length, 7=sweep on - ** reg2: 8 bits of freq - ** reg3: 0-2=high freq, 7-4=vbl length counter - */ - - APU_VOLUME_DECAY(chan->output_vol); - - if (false == chan->enabled || 0 == chan->vbl_length) - return MMC5_RECTANGLE_OUTPUT; - - /* vbl length counter */ - if (false == chan->holdnote) - chan->vbl_length--; - - /* envelope decay at a rate of (env_delay + 1) / 240 secs */ - chan->env_phase -= 4; /* 240/60 */ - while (chan->env_phase < 0) - { - chan->env_phase += chan->env_delay; - - if (chan->holdnote) - chan->env_vol = (chan->env_vol + 1) & 0x0F; - else if (chan->env_vol < 0x0F) - chan->env_vol++; - } - - if (chan->freq < 4) - return MMC5_RECTANGLE_OUTPUT; - - chan->accum -= mmc5.incsize; /* # of cycles per sample */ - if (chan->accum >= 0) - return MMC5_RECTANGLE_OUTPUT; - -#ifdef APU_OVERSAMPLE - num_times = total = 0; - - if (chan->fixed_envelope) - output = chan->volume << 8; /* fixed volume */ - else - output = (chan->env_vol ^ 0x0F) << 8; -#endif - - while (chan->accum < 0) - { - chan->accum += chan->freq; - chan->adder = (chan->adder + 1) & 0x0F; - -#ifdef APU_OVERSAMPLE - if (chan->adder < chan->duty_flip) - total += output; - else - total -= output; - - num_times++; -#endif - } - -#ifdef APU_OVERSAMPLE - chan->output_vol = total / num_times; -#else - if (chan->fixed_envelope) - output = chan->volume << 8; /* fixed volume */ - else - output = (chan->env_vol ^ 0x0F) << 8; - - if (0 == chan->adder) - chan->output_vol = output; - else if (chan->adder == chan->duty_flip) - chan->output_vol = -output; -#endif - - return MMC5_RECTANGLE_OUTPUT; -} - -static uint8 mmc5_read(uint32 address) -{ - uint32 retval; - - retval = (uint32) (mmc5.mul[0] * mmc5.mul[1]); - - switch (address) - { - case 0x5205: - return (uint8) retval; - - case 0x5206: - return (uint8) (retval >> 8); - - default: - return 0xFF; - } -} - -/* mix vrcvi sound channels together */ -static int32 mmc5_process(void) -{ - int32 accum; - - accum = mmc5_rectangle(&mmc5.rect[0]); - accum += mmc5_rectangle(&mmc5.rect[1]); - if (mmc5.dac.enabled) - accum += mmc5.dac.output; - - return accum; -} - -/* write to registers */ -static void mmc5_write(uint32 address, uint8 value) -{ - int chan; - - switch (address) - { - /* rectangles */ - case MMC5_WRA0: - case MMC5_WRB0: - chan = (address & 4) ? 1 : 0; - mmc5.rect[chan].regs[0] = value; - - mmc5.rect[chan].volume = value & 0x0F; - mmc5.rect[chan].env_delay = decay_lut[value & 0x0F]; - mmc5.rect[chan].holdnote = (value & 0x20) ? true : false; - mmc5.rect[chan].fixed_envelope = (value & 0x10) ? true : false; - mmc5.rect[chan].duty_flip = duty_lut[value >> 6]; - break; - - case MMC5_WRA1: - case MMC5_WRB1: - break; - - case MMC5_WRA2: - case MMC5_WRB2: - chan = (address & 4) ? 1 : 0; - mmc5.rect[chan].regs[2] = value; - if (mmc5.rect[chan].enabled) - mmc5.rect[chan].freq = (((mmc5.rect[chan].regs[3] & 7) << 8) + value) + 1; - break; - - case MMC5_WRA3: - case MMC5_WRB3: - chan = (address & 4) ? 1 : 0; - mmc5.rect[chan].regs[3] = value; - - if (mmc5.rect[chan].enabled) - { - mmc5.rect[chan].vbl_length = vbl_lut[value >> 3]; - mmc5.rect[chan].env_vol = 0; - mmc5.rect[chan].freq = (((value & 7) << 8) + mmc5.rect[chan].regs[2]) + 1; - mmc5.rect[chan].adder = 0; - } - break; - - case MMC5_SMASK: - if (value & 0x01) - { - mmc5.rect[0].enabled = true; - } - else - { - mmc5.rect[0].enabled = false; - mmc5.rect[0].vbl_length = 0; - } - - if (value & 0x02) - { - mmc5.rect[1].enabled = true; - } - else - { - mmc5.rect[1].enabled = false; - mmc5.rect[1].vbl_length = 0; - } - - break; - - case 0x5010: - if (value & 0x01) - mmc5.dac.enabled = true; - else - mmc5.dac.enabled = false; - break; - - case 0x5011: - mmc5.dac.output = (value ^ 0x80) << 8; - break; - - case 0x5205: - mmc5.mul[0] = value; - break; - - case 0x5206: - mmc5.mul[1] = value; - break; - - case 0x5114: - case 0x5115: - /* ???? */ - break; - - default: - break; - } -} - -/* reset state of vrcvi sound channels */ -static void mmc5_reset(void) -{ - int i; - apu_t apu; - - - /* get the phase period from the apu */ - apu_getcontext(&apu); - mmc5.incsize = apu.cycle_rate; - - for (i = 0x5000; i < 0x5008; i++) - mmc5_write(i, 0); - - mmc5_write(0x5010, 0); - mmc5_write(0x5011, 0); -} - -static int mmc5_init(void) -{ - int i, num_samples; - apu_t apu; - - apu_getcontext(&apu); - num_samples = apu.num_samples; - - /* lut used for enveloping and frequency sweeps */ - for (i = 0; i < 16; i++) - decay_lut[i] = num_samples * (i + 1); - - /* used for note length, based on vblanks and size of audio buffer */ - for (i = 0; i < 32; i++) - vbl_lut[i] = vbl_length[i] * num_samples; - - return 0; -} - -static const apu_memread mmc5_memread[] = -{ - { 0x5205, 0x5206, mmc5_read }, - { -1, -1, NULL } -}; - -static const apu_memwrite mmc5_memwrite[] = -{ - { 0x5000, 0x5015, mmc5_write }, - { 0x5114, 0x5115, mmc5_write }, - { 0x5205, 0x5206, mmc5_write }, - { -1, -1, NULL } -}; - -const apuext_t mmc5_ext = -{ - mmc5_init, - NULL, /* no shutdown */ - mmc5_reset, - mmc5_process, - mmc5_memread, - mmc5_memwrite -}; - -/* -** $Log: mmc5_snd.c,v $ -** Revision 1.2 2001/04/27 14:37:11 neil -** wheeee -** -** Revision 1.1 2001/04/27 12:54:40 neil -** blah -** -** Revision 1.1.1.1 2001/04/27 07:03:54 neil -** initial -** -** Revision 1.2 2000/11/13 00:57:08 matt -** doesn't look as nasty now -** -** Revision 1.1 2000/10/24 12:19:59 matt -** changed directory structure -** -** Revision 1.16 2000/10/17 11:56:42 matt -** selectable apu base frequency -** -** Revision 1.15 2000/10/10 14:04:29 matt -** make way for bjarne -** -** Revision 1.14 2000/10/10 13:58:18 matt -** stroustrup squeezing his way in the door -** -** Revision 1.13 2000/10/08 17:50:18 matt -** appears $5114/$5115 do something -** -** Revision 1.12 2000/10/03 11:56:20 matt -** better support for optional sound ext routines -** -** Revision 1.11 2000/09/27 12:26:03 matt -** changed sound accumulators back to floats -** -** Revision 1.10 2000/09/15 13:38:40 matt -** changes for optimized apu core -** -** Revision 1.9 2000/09/15 04:58:07 matt -** simplifying and optimizing APU core -** -** Revision 1.8 2000/07/30 04:32:59 matt -** no more apu_getcyclerate hack -** -** Revision 1.7 2000/07/17 01:52:31 matt -** made sure last line of all source files is a newline -** -** Revision 1.6 2000/07/04 04:51:41 matt -** cleanups -** -** Revision 1.5 2000/07/03 02:18:53 matt -** much better external module exporting -** -** Revision 1.4 2000/06/28 22:03:51 matt -** fixed stupid oversight -** -** Revision 1.3 2000/06/20 20:46:58 matt -** minor cleanups -** -** Revision 1.2 2000/06/20 04:06:16 matt -** migrated external sound definition to apu module -** -** Revision 1.1 2000/06/20 00:06:47 matt -** initial revision -** -*/ diff --git a/MCUME_pico/piconofrendo/mmc5_snd.h b/MCUME_pico/piconofrendo/mmc5_snd.h deleted file mode 100644 index 1681611..0000000 --- a/MCUME_pico/piconofrendo/mmc5_snd.h +++ /dev/null @@ -1,70 +0,0 @@ -/* -** Nofrendo (c) 1998-2000 Matthew Conte (matt@conte.com) -** -** -** This program is free software; you can redistribute it and/or -** modify it under the terms of version 2 of the GNU Library General -** Public License as published by the Free Software Foundation. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** Library General Public License for more details. To obtain a -** copy of the GNU Library General Public License, write to the Free -** Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -** -** Any permitted reproduction of these routines, in whole or in part, -** must bear this legend. -** -** -** mmc5_snd.h -** -** Nintendo MMC5 sound emulation header -** $Id: mmc5_snd.h,v 1.2 2001/04/27 14:37:11 neil Exp $ -*/ - -#ifndef _MMC5_SND_H_ -#define _MMC5_SND_H_ - -#include "nes_apu.h" - -extern const apuext_t mmc5_ext; - -#endif /* !_MMC5_SND_H_ */ - -/* -** $Log: mmc5_snd.h,v $ -** Revision 1.2 2001/04/27 14:37:11 neil -** wheeee -** -** Revision 1.1 2001/04/27 12:54:40 neil -** blah -** -** Revision 1.1.1.1 2001/04/27 07:03:54 neil -** initial -** -** Revision 1.2 2000/11/13 00:57:08 matt -** doesn't look as nasty now -** -** Revision 1.1 2000/10/24 12:19:59 matt -** changed directory structure -** -** Revision 1.6 2000/10/10 13:58:18 matt -** stroustrup squeezing his way in the door -** -** Revision 1.5 2000/09/27 12:26:03 matt -** changed sound accumulators back to floats -** -** Revision 1.4 2000/09/15 13:38:40 matt -** changes for optimized apu core -** -** Revision 1.3 2000/07/17 01:52:31 matt -** made sure last line of all source files is a newline -** -** Revision 1.2 2000/06/20 04:06:16 matt -** migrated external sound definition to apu module -** -** Revision 1.1 2000/06/20 00:06:47 matt -** initial revision -** -*/ diff --git a/MCUME_pico/piconofrendo/mmclist.c b/MCUME_pico/piconofrendo/mmclist.c deleted file mode 100755 index 3e0d5e7..0000000 --- a/MCUME_pico/piconofrendo/mmclist.c +++ /dev/null @@ -1,122 +0,0 @@ -/* -** Nofrendo (c) 1998-2000 Matthew Conte (matt@conte.com) -** -** -** This program is free software; you can redistribute it and/or -** modify it under the terms of version 2 of the GNU Library General -** Public License as published by the Free Software Foundation. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** Library General Public License for more details. To obtain a -** copy of the GNU Library General Public License, write to the Free -** Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -** -** Any permitted reproduction of these routines, in whole or in part, -** must bear this legend. -** -** -** mmclist.c -** -** list of all mapper interfaces -** $Id: mmclist.c,v 1.2 2001/04/27 14:37:11 neil Exp $ -*/ - -#include "noftypes.h" -#include "nes_mmc.h" - -/* mapper interfaces */ -extern mapintf_t map0_intf; -extern mapintf_t map1_intf; -extern mapintf_t map2_intf; -extern mapintf_t map3_intf; -extern mapintf_t map4_intf; -extern mapintf_t map5_intf; -extern mapintf_t map7_intf; -extern mapintf_t map8_intf; -extern mapintf_t map9_intf; -extern mapintf_t map11_intf; -extern mapintf_t map15_intf; -extern mapintf_t map16_intf; -extern mapintf_t map18_intf; -extern mapintf_t map19_intf; -extern mapintf_t map21_intf; -extern mapintf_t map22_intf; -extern mapintf_t map23_intf; -extern mapintf_t map24_intf; -extern mapintf_t map25_intf; -extern mapintf_t map32_intf; -extern mapintf_t map33_intf; -extern mapintf_t map34_intf; -extern mapintf_t map40_intf; -extern mapintf_t map64_intf; -extern mapintf_t map65_intf; -extern mapintf_t map66_intf; -extern mapintf_t map70_intf; -extern mapintf_t map75_intf; -extern mapintf_t map78_intf; -extern mapintf_t map79_intf; -extern mapintf_t map85_intf; -extern mapintf_t map94_intf; -extern mapintf_t map99_intf; -extern mapintf_t map231_intf; - -/* implemented mapper interfaces */ -const mapintf_t *mappers[] = -{ - &map0_intf, - &map1_intf, - &map2_intf, - &map3_intf, - &map4_intf, - &map5_intf, - &map7_intf, - &map8_intf, - &map9_intf, - &map11_intf, - &map15_intf, - &map16_intf, - &map18_intf, - &map19_intf, - &map21_intf, - &map22_intf, - &map23_intf, - &map24_intf, - &map25_intf, - &map32_intf, - &map33_intf, - &map34_intf, - &map40_intf, - &map64_intf, - &map65_intf, - &map66_intf, - &map70_intf, - &map75_intf, - &map78_intf, - &map79_intf, - &map85_intf, - &map94_intf, - &map99_intf, - &map231_intf, - NULL -}; - -/* -** $Log: mmclist.c,v $ -** Revision 1.2 2001/04/27 14:37:11 neil -** wheeee -** -** Revision 1.1.1.1 2001/04/27 07:03:54 neil -** initial -** -** Revision 1.1 2000/10/24 12:20:28 matt -** changed directory structure -** -** Revision 1.2 2000/10/10 13:05:30 matt -** Mr. Clean makes a guest appearance -** -** Revision 1.1 2000/07/31 04:27:39 matt -** initial revision -** -*/ diff --git a/MCUME_pico/piconofrendo/mmclist.h b/MCUME_pico/piconofrendo/mmclist.h deleted file mode 100755 index da2ac93..0000000 --- a/MCUME_pico/piconofrendo/mmclist.h +++ /dev/null @@ -1,49 +0,0 @@ -/* -** Nofrendo (c) 1998-2000 Matthew Conte (matt@conte.com) -** -** -** This program is free software; you can redistribute it and/or -** modify it under the terms of version 2 of the GNU Library General -** Public License as published by the Free Software Foundation. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** Library General Public License for more details. To obtain a -** copy of the GNU Library General Public License, write to the Free -** Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -** -** Any permitted reproduction of these routines, in whole or in part, -** must bear this legend. -** -** -** mmclist.h -** -** list of all mapper interfaces -** $Id: mmclist.h,v 1.2 2001/04/27 14:37:11 neil Exp $ -*/ - -#ifndef _MMCLIST_H_ -#define _MMCLIST_H_ - -#include "nes_mmc.h" - -extern mapintf_t *mappers[]; - -#endif /* !_MMCLIST_H_ */ - -/* -** $Log: mmclist.h,v $ -** Revision 1.2 2001/04/27 14:37:11 neil -** wheeee -** -** Revision 1.1.1.1 2001/04/27 07:03:54 neil -** initial -** -** Revision 1.1 2000/10/24 12:20:28 matt -** changed directory structure -** -** Revision 1.1 2000/07/31 04:27:40 matt -** initial revision -** -*/ diff --git a/MCUME_pico/piconofrendo/nes.c b/MCUME_pico/piconofrendo/nes.c deleted file mode 100644 index c707cf8..0000000 --- a/MCUME_pico/piconofrendo/nes.c +++ /dev/null @@ -1,762 +0,0 @@ -/* -** Nofrendo (c) 1998-2000 Matthew Conte (matt@conte.com) -** -** -** This program is free software; you can redistribute it and/or -** modify it under the terms of version 2 of the GNU Library General -** Public License as published by the Free Software Foundation. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** Library General Public License for more details. To obtain a -** copy of the GNU Library General Public License, write to the Free -** Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -** -** Any permitted reproduction of these routines, in whole or in part, -** must bear this legend. -** -** -** nes.c -** -** NES hardware related routines -** $Id: nes.c,v 1.2 2001/04/27 14:37:11 neil Exp $ -*/ - -#include -#include -#include -#include "noftypes.h" -#include "nes6502.h" -#include "log.h" -#include "osd.h" -#include "nes.h" -#include "nes_apu.h" -#include "nes_ppu.h" -#include "nes_rom.h" -#include "nes_mmc.h" -#include "vid_drv.h" -#include "nofrendo.h" - - -#define NES_CLOCK_DIVIDER 12 -//#define NES_MASTER_CLOCK 21477272.727272727272 -#define NES_MASTER_CLOCK (236250000 / 11) -#define NES_SCANLINE_CYCLES (1364.0 / NES_CLOCK_DIVIDER) -#define NES_FIQ_PERIOD (NES_MASTER_CLOCK / NES_CLOCK_DIVIDER / 60) - -#define NES_RAMSIZE 0x800 - -#define NES_SKIP_LIMIT (NES_REFRESH_RATE / 5) /* 12 or 10, depending on PAL/NTSC */ - -static nes_t nes; - -/* find out if a file is ours */ -int nes_isourfile(const char *filename) -{ - return rom_checkmagic(filename); -} - -/* TODO: just asking for problems -- please remove */ -nes_t *nes_getcontextptr(void) -{ - return &nes; -} - -void nes_getcontext(nes_t *machine) -{ - apu_getcontext(nes.apu); - ppu_getcontext(nes.ppu); - nes6502_getcontext(nes.cpu); - mmc_getcontext(nes.mmc); - - *machine = nes; -} - -void nes_setcontext(nes_t *machine) -{ - ASSERT(machine); - - apu_setcontext(machine->apu); - ppu_setcontext(machine->ppu); - nes6502_setcontext(machine->cpu); - mmc_setcontext(machine->mmc); - - nes = *machine; -} - -static uint8 ram_read(uint32 address) -{ - return nes.cpu->mem_page[0][address & (NES_RAMSIZE - 1)]; -} - -static void ram_write(uint32 address, uint8 value) -{ - nes.cpu->mem_page[0][address & (NES_RAMSIZE - 1)] = value; -} - -static void write_protect(uint32 address, uint8 value) -{ - /* don't allow write to go through */ - UNUSED(address); - UNUSED(value); -} - -static uint8 read_protect(uint32 address) -{ - /* don't allow read to go through */ - UNUSED(address); - - return 0xFF; -} - -#define LAST_MEMORY_HANDLER { -1, -1, NULL } -/* read/write handlers for standard NES */ -static const nes6502_memread default_readhandler[] = -{ - { 0x0800, 0x1FFF, ram_read }, - { 0x2000, 0x3FFF, ppu_read }, - { 0x4000, 0x4015, apu_read }, - { 0x4016, 0x4017, ppu_readhigh }, - LAST_MEMORY_HANDLER -}; - -static const nes6502_memwrite default_writehandler[] = -{ - { 0x0800, 0x1FFF, ram_write }, - { 0x2000, 0x3FFF, ppu_write }, - { 0x4000, 0x4013, apu_write }, - { 0x4015, 0x4015, apu_write }, - { 0x4014, 0x4017, ppu_writehigh }, - LAST_MEMORY_HANDLER -}; - -/* this big nasty boy sets up the address handlers that the CPU uses */ -static void build_address_handlers(nes_t *machine) -{ - int count, num_handlers = 0; - mapintf_t *intf; - - ASSERT(machine); - intf = machine->mmc->intf; - - memset(machine->readhandler, 0, sizeof(machine->readhandler)); - memset(machine->writehandler, 0, sizeof(machine->writehandler)); - - for (count = 0; num_handlers < MAX_MEM_HANDLERS; count++, num_handlers++) - { - if (NULL == default_readhandler[count].read_func) - break; - - memcpy(&machine->readhandler[num_handlers], &default_readhandler[count], - sizeof(nes6502_memread)); - } - - if (intf->sound_ext) - { - if (NULL != intf->sound_ext->mem_read) - { - for (count = 0; num_handlers < MAX_MEM_HANDLERS; count++, num_handlers++) - { - if (NULL == intf->sound_ext->mem_read[count].read_func) - break; - - memcpy(&machine->readhandler[num_handlers], &intf->sound_ext->mem_read[count], - sizeof(nes6502_memread)); - } - } - } - - if (NULL != intf->mem_read) - { - for (count = 0; num_handlers < MAX_MEM_HANDLERS; count++, num_handlers++) - { - if (NULL == intf->mem_read[count].read_func) - break; - - memcpy(&machine->readhandler[num_handlers], &intf->mem_read[count], - sizeof(nes6502_memread)); - } - } - - /* TODO: poof! numbers */ - machine->readhandler[num_handlers].min_range = 0x4018; - machine->readhandler[num_handlers].max_range = 0x5FFF; - machine->readhandler[num_handlers].read_func = read_protect; - num_handlers++; - machine->readhandler[num_handlers].min_range = -1; - machine->readhandler[num_handlers].max_range = -1; - machine->readhandler[num_handlers].read_func = NULL; - num_handlers++; - ASSERT(num_handlers <= MAX_MEM_HANDLERS); - - num_handlers = 0; - - for (count = 0; num_handlers < MAX_MEM_HANDLERS; count++, num_handlers++) - { - if (NULL == default_writehandler[count].write_func) - break; - - memcpy(&machine->writehandler[num_handlers], &default_writehandler[count], - sizeof(nes6502_memwrite)); - } - - if (intf->sound_ext) - { - if (NULL != intf->sound_ext->mem_write) - { - for (count = 0; num_handlers < MAX_MEM_HANDLERS; count++, num_handlers++) - { - if (NULL == intf->sound_ext->mem_write[count].write_func) - break; - - memcpy(&machine->writehandler[num_handlers], &intf->sound_ext->mem_write[count], - sizeof(nes6502_memwrite)); - } - } - } - - if (NULL != intf->mem_write) - { - for (count = 0; num_handlers < MAX_MEM_HANDLERS; count++, num_handlers++) - { - if (NULL == intf->mem_write[count].write_func) - break; - - memcpy(&machine->writehandler[num_handlers], &intf->mem_write[count], - sizeof(nes6502_memwrite)); - } - } - - /* catch-all for bad writes */ - /* TODO: poof! numbers */ - machine->writehandler[num_handlers].min_range = 0x4018; - machine->writehandler[num_handlers].max_range = 0x5FFF; - machine->writehandler[num_handlers].write_func = write_protect; - num_handlers++; - machine->writehandler[num_handlers].min_range = 0x8000; - machine->writehandler[num_handlers].max_range = 0xFFFF; - machine->writehandler[num_handlers].write_func = write_protect; - num_handlers++; - machine->writehandler[num_handlers].min_range = -1; - machine->writehandler[num_handlers].max_range = -1; - machine->writehandler[num_handlers].write_func = NULL; - num_handlers++; - ASSERT(num_handlers <= MAX_MEM_HANDLERS); -} - -/* raise an IRQ */ -void nes_irq(void) -{ - nes6502_irq(); -} - -static uint8 nes_clearfiq(void) -{ - if (nes.fiq_occurred) - { - nes.fiq_occurred = false; - return 0x40; - } - - return 0; -} - -void nes_setfiq(uint8 value) -{ - nes.fiq_state = value; - nes.fiq_cycles = (int) NES_FIQ_PERIOD; -} - -static void nes_checkfiq(int cycles) -{ - nes.fiq_cycles -= cycles; - if (nes.fiq_cycles <= 0) - { - nes.fiq_cycles += (int) NES_FIQ_PERIOD; - if (0 == (nes.fiq_state & 0xC0)) - { - nes.fiq_occurred = true; - nes6502_irq(); - } - } -} - -void nes_nmi(void) -{ - nes6502_nmi(); -} - -static void nes_renderframe(bool draw_flag) -{ - int elapsed_cycles; - mapintf_t *mapintf = nes.mmc->intf; - int in_vblank = 0; - - while (262 != nes.scanline) - { -// ppu_scanline(nes.vidbuf, nes.scanline, draw_flag); - ppu_scanline(vid_getbuffer(), nes.scanline, draw_flag); - - if (241 == nes.scanline) - { - /* 7-9 cycle delay between when VINT flag goes up and NMI is taken */ - elapsed_cycles = nes6502_execute(7); - nes.scanline_cycles -= elapsed_cycles; - nes_checkfiq(elapsed_cycles); - - ppu_checknmi(); - - if (mapintf->vblank) - mapintf->vblank(); - in_vblank = 1; - } - - if (mapintf->hblank) - mapintf->hblank(in_vblank); - - nes.scanline_cycles += (float) NES_SCANLINE_CYCLES; - elapsed_cycles = nes6502_execute((int) nes.scanline_cycles); - nes.scanline_cycles -= (float) elapsed_cycles; - nes_checkfiq(elapsed_cycles); - - ppu_endscanline(nes.scanline); - nes.scanline++; - } - - nes.scanline = 0; -} - -static void system_video(bool draw) -{ - -#ifdef NOLOOP -#else -#endif - /* blit to screen */ - vid_flush(); - - /* grab input */ - osd_getinput(); -} - -/* main emulation loop */ -static int last_ticks, frames_to_render; -void nes_emulate(void) -{ - osd_setsound(nes.apu->process); - - last_ticks = nofrendo_ticks; - frames_to_render = 0; - nes.scanline_cycles = 0; - nes.fiq_cycles = (int) NES_FIQ_PERIOD; -#ifdef NOLOOP -#else - while (false == nes.poweroff) - { - if (nofrendo_ticks != last_ticks) - { - int tick_diff = nofrendo_ticks - last_ticks; - - frames_to_render += tick_diff; - last_ticks = nofrendo_ticks; - } - - if (true == nes.pause) - { - /* TODO: dim the screen, and pause/silence the apu */ - system_video(true); - frames_to_render = 0; - } - else if (frames_to_render > 1) - { - frames_to_render--; - nes_renderframe(false); - system_video(false); - } - else if ((1 == frames_to_render && true == nes.autoframeskip) - || false == nes.autoframeskip) - { - frames_to_render = 0; - nes_renderframe(true); - system_video(true); - } - } -#endif -} - -//ADD ON -#ifdef NOLOOP -void nes_step(int skip) -{ - if (skip) { - nes_renderframe(false); - system_video(false); - } - else { - nes_renderframe(true); - system_video(true); - } - -} -#endif - -static void mem_trash(uint8 *buffer, int length) -{ - int i; - - for (i = 0; i < length; i++) - buffer[i] = (uint8) rand(); -} - -/* Reset NES hardware */ -void nes_reset(int reset_type) -{ - if (HARD_RESET == reset_type) - { - memset(nes.cpu->mem_page[0], 0, NES_RAMSIZE); - if (nes.rominfo->vram) - mem_trash(nes.rominfo->vram, 0x2000 * nes.rominfo->vram_banks); - } - - apu_reset(); - ppu_reset(reset_type); - mmc_reset(); - nes6502_reset(); - - nes.scanline = 241; -} - -void nes_destroy(nes_t **machine) -{ - if (*machine) - { - rom_free(&(*machine)->rominfo); - mmc_destroy(&(*machine)->mmc); - ppu_destroy(&(*machine)->ppu); - apu_destroy(&(*machine)->apu); -// bmp_destroy(&(*machine)->vidbuf); - if ((*machine)->cpu) - { - if ((*machine)->cpu->mem_page[0]) - free((*machine)->cpu->mem_page[0]); - free((*machine)->cpu); - } - - free(*machine); - *machine = NULL; - } -} - -void nes_poweroff(void) -{ - nes.poweroff = true; -} - -void nes_togglepause(void) -{ - nes.pause ^= true; -} - -/* insert a cart into the NES */ -int nes_insertcart(const char *filename, nes_t *machine) -{ - nes6502_setcontext(machine->cpu); - /* rom file */ - machine->rominfo = rom_load(filename); - if (NULL == machine->rominfo) - goto _fail; - /* map cart's SRAM to CPU $6000-$7FFF */ - if (machine->rominfo->sram) - { - machine->cpu->mem_page[6] = machine->rominfo->sram; - machine->cpu->mem_page[7] = machine->rominfo->sram + 0x1000; - } - /* mapper */ - machine->mmc = mmc_create(machine->rominfo); - if (NULL == machine->mmc) - goto _fail; - - /* if there's VRAM, let the PPU know */ - if (NULL != machine->rominfo->vram) - machine->ppu->vram_present = true; - apu_setext(machine->apu, machine->mmc->intf->sound_ext); - build_address_handlers(machine); - nes_setcontext(machine); - nes_reset(HARD_RESET); - - return 0; - -_fail: - nes_destroy(&machine); - return -1; -} - - -/* Initialize NES CPU, hardware, etc. */ -nes_t *nes_create(void) -{ - nes_t *machine; - sndinfo_t osd_sound; - int i; - - machine = malloc(sizeof(nes_t)); - if (NULL == machine) - return NULL; - - memset(machine, 0, sizeof(nes_t)); - - /* bitmap */ - /* 8 pixel overdraw */ -// machine->vidbuf = bmp_create(NES_SCREEN_WIDTH, NES_SCREEN_HEIGHT, 8); -// if (NULL == machine->vidbuf) -// goto _fail; - - machine->autoframeskip = true; - - /* cpu */ - machine->cpu = malloc(sizeof(nes6502_context)); - if (NULL == machine->cpu) - goto _fail; - - memset(machine->cpu, 0, sizeof(nes6502_context)); - - /* allocate 2kB RAM */ - machine->cpu->mem_page[0] = malloc(NES_RAMSIZE); - if (NULL == machine->cpu->mem_page[0]) - goto _fail; - - /* point all pages at NULL for now */ - for (i = 1; i < NES6502_NUMBANKS; i++) - machine->cpu->mem_page[i] = NULL; - - machine->cpu->read_handler = machine->readhandler; - machine->cpu->write_handler = machine->writehandler; - - /* apu */ - osd_getsoundinfo(&osd_sound); - machine->apu = apu_create(0, osd_sound.sample_rate, NES_REFRESH_RATE, osd_sound.bps); - - if (NULL == machine->apu) - goto _fail; - - /* set the IRQ routines */ - machine->apu->irq_callback = nes_irq; - machine->apu->irqclear_callback = nes_clearfiq; - - /* ppu */ - machine->ppu = ppu_create(); - if (NULL == machine->ppu) - goto _fail; - - machine->poweroff = false; - machine->pause = false; - - return machine; - -_fail: - nes_destroy(&machine); - return NULL; -} - -/* -** $Log: nes.c,v $ -** Revision 1.2 2001/04/27 14:37:11 neil -** wheeee -** -** Revision 1.1.1.1 2001/04/27 07:03:54 neil -** initial -** -** Revision 1.18 2000/11/29 12:58:23 matt -** timing/fiq fixes -** -** Revision 1.17 2000/11/27 19:36:15 matt -** more timing fixes -** -** Revision 1.16 2000/11/26 16:13:13 matt -** slight fix (?) to nes_fiq -** -** Revision 1.15 2000/11/26 15:51:13 matt -** frame IRQ emulation -** -** Revision 1.14 2000/11/25 20:30:39 matt -** scanline emulation simplifications/timing fixes -** -** Revision 1.13 2000/11/25 01:53:42 matt -** bool stinks sometimes -** -** Revision 1.12 2000/11/21 13:28:40 matt -** take care to zero allocated mem -** -** Revision 1.11 2000/11/20 13:23:32 matt -** nofrendo.c now handles timer -** -** Revision 1.10 2000/11/09 14:07:27 matt -** state load fixed, state save mostly fixed -** -** Revision 1.9 2000/11/05 22:19:37 matt -** pause buglet fixed -** -** Revision 1.8 2000/11/05 06:27:09 matt -** thinlib spawns changes -** -** Revision 1.7 2000/10/29 14:36:45 matt -** nes_clearframeirq is static -** -** Revision 1.6 2000/10/28 15:20:41 matt -** irq callbacks in nes_apu -** -** Revision 1.5 2000/10/27 12:55:58 matt -** nes6502 now uses 4kB banks across the boards -** -** Revision 1.4 2000/10/25 13:44:02 matt -** no more silly define names -** -** Revision 1.3 2000/10/25 01:23:08 matt -** basic system autodetection -** -** Revision 1.2 2000/10/25 00:23:16 matt -** makefiles updated for new directory structure -** -** Revision 1.1 2000/10/24 12:20:28 matt -** changed directory structure -** -** Revision 1.50 2000/10/23 17:51:09 matt -** adding fds support -** -** Revision 1.49 2000/10/23 15:53:08 matt -** better system handling -** -** Revision 1.48 2000/10/22 20:02:29 matt -** autoframeskip bugfix -** -** Revision 1.47 2000/10/22 19:16:15 matt -** more sane timer ISR / autoframeskip -** -** Revision 1.46 2000/10/21 19:26:59 matt -** many more cleanups -** -** Revision 1.45 2000/10/17 12:00:56 matt -** selectable apu base frequency -** -** Revision 1.44 2000/10/10 13:58:14 matt -** stroustrup squeezing his way in the door -** -** Revision 1.43 2000/10/10 13:05:30 matt -** Mr. Clean makes a guest appearance -** -** Revision 1.42 2000/10/08 17:53:37 matt -** minor accuracy changes -** -** Revision 1.41 2000/09/18 02:09:12 matt -** -pedantic is your friend -** -** Revision 1.40 2000/09/15 13:38:39 matt -** changes for optimized apu core -** -** Revision 1.39 2000/09/15 04:58:07 matt -** simplifying and optimizing APU core -** -** Revision 1.38 2000/09/08 11:57:29 matt -** no more nes_fiq -** -** Revision 1.37 2000/08/31 02:39:01 matt -** moved dos stuff in here (temp) -** -** Revision 1.36 2000/08/16 02:51:55 matt -** random cleanups -** -** Revision 1.35 2000/08/11 02:43:50 matt -** moved frame irq stuff out of APU into here -** -** Revision 1.34 2000/08/11 01:42:43 matt -** change to OSD sound info interface -** -** Revision 1.33 2000/07/31 04:27:59 matt -** one million cleanups -** -** Revision 1.32 2000/07/30 04:32:32 matt -** emulation of the NES frame IRQ -** -** Revision 1.31 2000/07/27 04:07:14 matt -** cleaned up the neighborhood lawns -** -** Revision 1.30 2000/07/27 03:59:52 neil -** pausing tweaks, during fullscreen toggles -** -** Revision 1.29 2000/07/27 03:19:22 matt -** just a little cleaner, that's all -** -** Revision 1.28 2000/07/27 02:55:23 matt -** nes_emulate went through detox -** -** Revision 1.27 2000/07/27 02:49:18 matt -** cleaner flow in nes_emulate -** -** Revision 1.26 2000/07/27 01:17:09 matt -** nes_insertrom -> nes_insertcart -** -** Revision 1.25 2000/07/26 21:36:14 neil -** Big honkin' change -- see the mailing list -** -** Revision 1.24 2000/07/25 02:25:53 matt -** safer xxx_destroy calls -** -** Revision 1.23 2000/07/24 04:32:40 matt -** autoframeskip bugfix -** -** Revision 1.22 2000/07/23 15:13:48 matt -** apu API change, autoframeskip part of nes_t struct -** -** Revision 1.21 2000/07/21 02:44:41 matt -** merged osd_getinput and osd_gethostinput -** -** Revision 1.20 2000/07/17 05:12:55 matt -** nes_ppu.c is no longer a scary place to be-- cleaner & faster -** -** Revision 1.19 2000/07/17 01:52:28 matt -** made sure last line of all source files is a newline -** -** Revision 1.18 2000/07/15 23:51:23 matt -** hack for certain filthy NES titles -** -** Revision 1.17 2000/07/11 04:31:54 matt -** less magic number nastiness for screen dimensions -** -** Revision 1.16 2000/07/11 02:38:25 matt -** encapsulated memory address handlers into nes/nsf -** -** Revision 1.15 2000/07/10 13:50:49 matt -** added function nes_irq() -** -** Revision 1.14 2000/07/10 05:27:55 matt -** cleaned up mapper-specific callbacks -** -** Revision 1.13 2000/07/09 03:43:26 matt -** minor changes to gui handling -** -** Revision 1.12 2000/07/06 16:42:23 matt -** updated for new video driver -** -** Revision 1.11 2000/07/05 19:57:36 neil -** __GNUC -> __DJGPP in nes.c -** -** Revision 1.10 2000/07/05 12:23:03 matt -** removed unnecessary references -** -** Revision 1.9 2000/07/04 23:12:34 matt -** memory protection handlers -** -** Revision 1.8 2000/07/04 04:58:29 matt -** dynamic memory range handlers -** -** Revision 1.7 2000/06/26 04:58:51 matt -** minor bugfix -** -** Revision 1.6 2000/06/20 20:42:12 matt -** fixed some NULL pointer problems -** -** Revision 1.5 2000/06/09 15:12:26 matt -** initial revision -** -*/ diff --git a/MCUME_pico/piconofrendo/nes.h b/MCUME_pico/piconofrendo/nes.h deleted file mode 100755 index dca6d69..0000000 --- a/MCUME_pico/piconofrendo/nes.h +++ /dev/null @@ -1,221 +0,0 @@ -/* -** Nofrendo (c) 1998-2000 Matthew Conte (matt@conte.com) -** -** -** This program is free software; you can redistribute it and/or -** modify it under the terms of version 2 of the GNU Library General -** Public License as published by the Free Software Foundation. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** Library General Public License for more details. To obtain a -** copy of the GNU Library General Public License, write to the Free -** Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -** -** Any permitted reproduction of these routines, in whole or in part, -** must bear this legend. -** -** -** nes.h -** -** NES hardware related definitions / prototypes -** $Id: nes.h,v 1.2 2001/04/27 14:37:11 neil Exp $ -*/ - -#ifndef _NES_H_ -#define _NES_H_ - -#include "noftypes.h" -#include "nes_apu.h" -#include "nes_mmc.h" -#include "nes_ppu.h" -#include "nes_rom.h" -#include "nes6502.h" -#include "bitmap.h" - -/* Visible (NTSC) screen height */ -#ifndef NES_VISIBLE_HEIGHT -#define NES_VISIBLE_HEIGHT 224 -#endif /* !NES_VISIBLE_HEIGHT */ -#define NES_SCREEN_WIDTH 256 -#define NES_SCREEN_HEIGHT 240 - -/* NTSC = 60Hz, PAL = 50Hz */ -#ifdef PAL -#define NES_REFRESH_RATE 50 -#else /* !PAL */ -#define NES_REFRESH_RATE 60 -#endif /* !PAL */ - -#define MAX_MEM_HANDLERS 32 - -enum -{ - SOFT_RESET, - HARD_RESET -}; - - -typedef struct nes_s -{ - /* hardware things */ - nes6502_context *cpu; - nes6502_memread readhandler[MAX_MEM_HANDLERS]; - nes6502_memwrite writehandler[MAX_MEM_HANDLERS]; - - ppu_t *ppu; - apu_t *apu; - mmc_t *mmc; - rominfo_t *rominfo; - - /* video buffer */ - /* For the ESP32, it costs too much memory to render to a separate buffer and blit that to the main buffer. - Instead, the code has been modified to directly grab the primary buffer from the video subsystem and render - there, saving us about 64K of memory. */ -// bitmap_t *vidbuf; - - bool fiq_occurred; - uint8 fiq_state; - int fiq_cycles; - - int scanline; - - /* Timing stuff */ - float scanline_cycles; - bool autoframeskip; - - /* control */ - bool poweroff; - bool pause; - -} nes_t; - - -extern int nes_isourfile(const char *filename); - -/* temp hack */ -extern nes_t *nes_getcontextptr(void); - -/* Function prototypes */ -extern void nes_getcontext(nes_t *machine); -extern void nes_setcontext(nes_t *machine); - -extern nes_t *nes_create(void); -extern void nes_destroy(nes_t **machine); -extern int nes_insertcart(const char *filename, nes_t *machine); - -extern void nes_setfiq(uint8 state); -extern void nes_nmi(void); -extern void nes_irq(void); -extern void nes_emulate(void); - -extern void nes_reset(int reset_type); - -extern void nes_poweroff(void); -extern void nes_togglepause(void); - -#endif /* _NES_H_ */ - -/* -** $Log: nes.h,v $ -** Revision 1.2 2001/04/27 14:37:11 neil -** wheeee -** -** Revision 1.1.1.1 2001/04/27 07:03:54 neil -** initial -** -** Revision 1.8 2000/11/26 15:51:13 matt -** frame IRQ emulation -** -** Revision 1.7 2000/11/25 20:30:39 matt -** scanline emulation simplifications/timing fixes -** -** Revision 1.6 2000/11/25 01:52:17 matt -** bool stinks sometimes -** -** Revision 1.5 2000/11/09 14:07:28 matt -** state load fixed, state save mostly fixed -** -** Revision 1.4 2000/10/29 14:36:45 matt -** nes_clearframeirq is static -** -** Revision 1.3 2000/10/25 01:23:08 matt -** basic system autodetection -** -** Revision 1.2 2000/10/25 00:23:16 matt -** makefiles updated for new directory structure -** -** Revision 1.1 2000/10/24 12:20:28 matt -** changed directory structure -** -** Revision 1.26 2000/10/23 17:51:10 matt -** adding fds support -** -** Revision 1.25 2000/10/23 15:53:08 matt -** better system handling -** -** Revision 1.24 2000/10/22 19:16:15 matt -** more sane timer ISR / autoframeskip -** -** Revision 1.23 2000/10/21 19:26:59 matt -** many more cleanups -** -** Revision 1.22 2000/10/10 13:58:15 matt -** stroustrup squeezing his way in the door -** -** Revision 1.21 2000/10/08 17:53:36 matt -** minor accuracy changes -** -** Revision 1.20 2000/09/15 04:58:07 matt -** simplifying and optimizing APU core -** -** Revision 1.19 2000/09/08 11:57:29 matt -** no more nes_fiq -** -** Revision 1.18 2000/08/11 02:43:50 matt -** moved frame irq stuff out of APU into here -** -** Revision 1.17 2000/07/31 04:27:59 matt -** one million cleanups -** -** Revision 1.16 2000/07/30 04:32:32 matt -** emulation of the NES frame IRQ -** -** Revision 1.15 2000/07/27 01:17:09 matt -** nes_insertrom -> nes_insertcart -** -** Revision 1.14 2000/07/26 21:36:16 neil -** Big honkin' change -- see the mailing list -** -** Revision 1.13 2000/07/25 02:25:53 matt -** safer xxx_destroy calls -** -** Revision 1.12 2000/07/23 15:13:13 matt -** autoframeskip is now a member variable of nes_t -** -** Revision 1.11 2000/07/17 05:12:55 matt -** nes_ppu.c is no longer a scary place to be-- cleaner & faster -** -** Revision 1.10 2000/07/17 01:52:28 matt -** made sure last line of all source files is a newline -** -** Revision 1.9 2000/07/16 09:48:58 neil -** Make visible height compile-time configurable in the Makefile -** -** Revision 1.8 2000/07/11 04:31:55 matt -** less magic number nastiness for screen dimensions -** -** Revision 1.7 2000/07/11 02:40:36 matt -** forgot to remove framecounter -** -** Revision 1.6 2000/07/11 02:38:25 matt -** encapsulated memory address handlers into nes/nsf -** -** Revision 1.5 2000/07/10 13:50:50 matt -** added function nes_irq() -** -** Revision 1.4 2000/06/09 15:12:26 matt -** initial revision -** -*/ diff --git a/MCUME_pico/piconofrendo/nes6502.c b/MCUME_pico/piconofrendo/nes6502.c deleted file mode 100644 index db2ee64..0000000 --- a/MCUME_pico/piconofrendo/nes6502.c +++ /dev/null @@ -1,2573 +0,0 @@ -/* -** Nofrendo (c) 1998-2000 Matthew Conte (matt@conte.com) -** -** -** This program is free software; you can redistribute it and/or -** modify it under the terms of version 2 of the GNU Library General -** Public License as published by the Free Software Foundation. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** Library General Public License for more details. To obtain a -** copy of the GNU Library General Public License, write to the Free -** Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -** -** Any permitted reproduction of these routines, in whole or in part, -** must bear this legend. -** -** -** nes6502.c -** -** NES custom 6502 (2A03) CPU implementation -** $Id: nes6502.c,v 1.2 2001/04/27 14:37:11 neil Exp $ -*/ - - -#include "noftypes.h" -#include "nes6502.h" -//#include "dis6502.h" - -//#define NES6502_DISASM - -#ifdef __GNUC__ -#define NES6502_JUMPTABLE -#endif /* __GNUC__ */ - - -#define ADD_CYCLES(x) \ -{ \ - remaining_cycles -= (x); \ - cpu.total_cycles += (x); \ -} - -/* -** Check to see if an index reg addition overflowed to next page -*/ -#define PAGE_CROSS_CHECK(addr, reg) \ -{ \ - if ((reg) > (uint8) (addr)) \ - ADD_CYCLES(1); \ -} - -#define EMPTY_READ(value) /* empty */ - -/* -** Addressing mode macros -*/ - -/* Immediate */ -#define IMMEDIATE_BYTE(value) \ -{ \ - value = bank_readbyte(PC++); \ -} - -/* Absolute */ -#define ABSOLUTE_ADDR(address) \ -{ \ - address = bank_readword(PC); \ - PC += 2; \ -} - -#define ABSOLUTE(address, value) \ -{ \ - ABSOLUTE_ADDR(address); \ - value = mem_readbyte(address); \ -} - -#define ABSOLUTE_BYTE(value) \ -{ \ - ABSOLUTE(temp, value); \ -} - -/* Absolute indexed X */ -#define ABS_IND_X_ADDR(address) \ -{ \ - ABSOLUTE_ADDR(address); \ - address = (address + X) & 0xFFFF; \ -} - -#define ABS_IND_X(address, value) \ -{ \ - ABS_IND_X_ADDR(address); \ - value = mem_readbyte(address); \ -} - -#define ABS_IND_X_BYTE(value) \ -{ \ - ABS_IND_X(temp, value); \ -} - -/* special page-cross check version for read instructions */ -#define ABS_IND_X_BYTE_READ(value) \ -{ \ - ABS_IND_X_ADDR(temp); \ - PAGE_CROSS_CHECK(temp, X); \ - value = mem_readbyte(temp); \ -} - -/* Absolute indexed Y */ -#define ABS_IND_Y_ADDR(address) \ -{ \ - ABSOLUTE_ADDR(address); \ - address = (address + Y) & 0xFFFF; \ -} - -#define ABS_IND_Y(address, value) \ -{ \ - ABS_IND_Y_ADDR(address); \ - value = mem_readbyte(address); \ -} - -#define ABS_IND_Y_BYTE(value) \ -{ \ - ABS_IND_Y(temp, value); \ -} - -/* special page-cross check version for read instructions */ -#define ABS_IND_Y_BYTE_READ(value) \ -{ \ - ABS_IND_Y_ADDR(temp); \ - PAGE_CROSS_CHECK(temp, Y); \ - value = mem_readbyte(temp); \ -} - -/* Zero-page */ -#define ZERO_PAGE_ADDR(address) \ -{ \ - IMMEDIATE_BYTE(address); \ -} - -#define ZERO_PAGE(address, value) \ -{ \ - ZERO_PAGE_ADDR(address); \ - value = ZP_READBYTE(address); \ -} - -#define ZERO_PAGE_BYTE(value) \ -{ \ - ZERO_PAGE(btemp, value); \ -} - -/* Zero-page indexed X */ -#define ZP_IND_X_ADDR(address) \ -{ \ - ZERO_PAGE_ADDR(address); \ - address += X; \ -} - -#define ZP_IND_X(address, value) \ -{ \ - ZP_IND_X_ADDR(address); \ - value = ZP_READBYTE(address); \ -} - -#define ZP_IND_X_BYTE(value) \ -{ \ - ZP_IND_X(btemp, value); \ -} - -/* Zero-page indexed Y */ -/* Not really an adressing mode, just for LDx/STx */ -#define ZP_IND_Y_ADDR(address) \ -{ \ - ZERO_PAGE_ADDR(address); \ - address += Y; \ -} - -#define ZP_IND_Y_BYTE(value) \ -{ \ - ZP_IND_Y_ADDR(btemp); \ - value = ZP_READBYTE(btemp); \ -} - -/* Indexed indirect */ -#define INDIR_X_ADDR(address) \ -{ \ - ZERO_PAGE_ADDR(btemp); \ - btemp += X; \ - address = zp_readword(btemp); \ -} - -#define INDIR_X(address, value) \ -{ \ - INDIR_X_ADDR(address); \ - value = mem_readbyte(address); \ -} - -#define INDIR_X_BYTE(value) \ -{ \ - INDIR_X(temp, value); \ -} - -/* Indirect indexed */ -#define INDIR_Y_ADDR(address) \ -{ \ - ZERO_PAGE_ADDR(btemp); \ - address = (zp_readword(btemp) + Y) & 0xFFFF; \ -} - -#define INDIR_Y(address, value) \ -{ \ - INDIR_Y_ADDR(address); \ - value = mem_readbyte(address); \ -} - -#define INDIR_Y_BYTE(value) \ -{ \ - INDIR_Y(temp, value); \ -} - -/* special page-cross check version for read instructions */ -#define INDIR_Y_BYTE_READ(value) \ -{ \ - INDIR_Y_ADDR(temp); \ - PAGE_CROSS_CHECK(temp, Y); \ - value = mem_readbyte(temp); \ -} - - - -/* Stack push/pull */ -#define PUSH(value) stack[S--] = (uint8) (value) -#define PULL() stack[++S] - - -/* -** flag register helper macros -*/ - -/* Theory: Z and N flags are set in just about every -** instruction, so we will just store the value in those -** flag variables, and mask out the irrelevant data when -** we need to check them (branches, etc). This makes the -** zero flag only really be 'set' when z_flag == 0. -** The rest of the flags are stored as true booleans. -*/ - -/* Scatter flags to separate variables */ -#define SCATTER_FLAGS(value) \ -{ \ - n_flag = (value) & N_FLAG; \ - v_flag = (value) & V_FLAG; \ - b_flag = (value) & B_FLAG; \ - d_flag = (value) & D_FLAG; \ - i_flag = (value) & I_FLAG; \ - z_flag = (0 == ((value) & Z_FLAG)); \ - c_flag = (value) & C_FLAG; \ -} - -/* Combine flags into flag register */ -#define COMBINE_FLAGS() \ -( \ - (n_flag & N_FLAG) \ - | (v_flag ? V_FLAG : 0) \ - | R_FLAG \ - | (b_flag ? B_FLAG : 0) \ - | (d_flag ? D_FLAG : 0) \ - | (i_flag ? I_FLAG : 0) \ - | (z_flag ? 0 : Z_FLAG) \ - | c_flag \ -) - -/* Set N and Z flags based on given value */ -#define SET_NZ_FLAGS(value) n_flag = z_flag = (value); - -/* For BCC, BCS, BEQ, BMI, BNE, BPL, BVC, BVS */ -#define RELATIVE_BRANCH(condition) \ -{ \ - if (condition) \ - { \ - IMMEDIATE_BYTE(btemp); \ - if (((int8) btemp + (PC & 0x00FF)) & 0x100) \ - ADD_CYCLES(1); \ - ADD_CYCLES(3); \ - PC += (int8) btemp; \ - } \ - else \ - { \ - PC++; \ - ADD_CYCLES(2); \ - } \ -} - -#define JUMP(address) \ -{ \ - PC = bank_readword((address)); \ -} - -/* -** Interrupt macros -*/ -#define NMI_PROC() \ -{ \ - PUSH(PC >> 8); \ - PUSH(PC & 0xFF); \ - b_flag = 0; \ - PUSH(COMBINE_FLAGS()); \ - i_flag = 1; \ - JUMP(NMI_VECTOR); \ -} - -#define IRQ_PROC() \ -{ \ - PUSH(PC >> 8); \ - PUSH(PC & 0xFF); \ - b_flag = 0; \ - PUSH(COMBINE_FLAGS()); \ - i_flag = 1; \ - JUMP(IRQ_VECTOR); \ -} - -/* -** Instruction macros -*/ - -/* Warning! NES CPU has no decimal mode, so by default this does no BCD! */ -#ifdef NES6502_DECIMAL -#define ADC(cycles, read_func) \ -{ \ - read_func(data); \ - if (d_flag) \ - { \ - temp = (A & 0x0F) + (data & 0x0F) + c_flag; \ - if (temp >= 10) \ - temp = (temp - 10) | 0x10; \ - temp += (A & 0xF0) + (data & 0xF0); \ - z_flag = (A + data + c_flag) & 0xFF; \ - n_flag = temp; \ - v_flag = ((~(A ^ data)) & (A ^ temp) & 0x80); \ - if (temp > 0x90) \ - { \ - temp += 0x60; \ - c_flag = 1; \ - } \ - else \ - { \ - c_flag = 0; \ - } \ - A = (uint8) temp; \ - } \ - else \ - { \ - temp = A + data + c_flag; \ - c_flag = (temp >> 8) & 1; \ - v_flag = ((~(A ^ data)) & (A ^ temp) & 0x80); \ - A = (uint8) temp; \ - SET_NZ_FLAGS(A); \ - }\ - ADD_CYCLES(cycles); \ -} -#else -#define ADC(cycles, read_func) \ -{ \ - read_func(data); \ - temp = A + data + c_flag; \ - c_flag = (temp >> 8) & 1; \ - v_flag = ((~(A ^ data)) & (A ^ temp) & 0x80); \ - A = (uint8) temp; \ - SET_NZ_FLAGS(A); \ - ADD_CYCLES(cycles); \ -} -#endif /* NES6502_DECIMAL */ - -/* undocumented */ -#define ANC(cycles, read_func) \ -{ \ - read_func(data); \ - A &= data; \ - c_flag = (n_flag & N_FLAG) >> 7; \ - SET_NZ_FLAGS(A); \ - ADD_CYCLES(cycles); \ -} - -#define AND(cycles, read_func) \ -{ \ - read_func(data); \ - A &= data; \ - SET_NZ_FLAGS(A); \ - ADD_CYCLES(cycles); \ -} - -/* undocumented */ -#define ANE(cycles, read_func) \ -{ \ - read_func(data); \ - A = (A | 0xEE) & X & data; \ - SET_NZ_FLAGS(A); \ - ADD_CYCLES(cycles); \ -} - -/* undocumented */ -#ifdef NES6502_DECIMAL -#define ARR(cycles, read_func) \ -{ \ - read_func(data); \ - data &= A; \ - if (d_flag) \ - { \ - temp = (data >> 1) | (c_flag << 7); \ - SET_NZ_FLAGS(temp); \ - v_flag = (temp ^ data) & 0x40; \ - if (((data & 0x0F) + (data & 0x01)) > 5) \ - temp = (temp & 0xF0) | ((temp + 0x6) & 0x0F); \ - if (((data & 0xF0) + (data & 0x10)) > 0x50) \ - { \ - temp = (temp & 0x0F) | ((temp + 0x60) & 0xF0); \ - c_flag = 1; \ - } \ - else \ - { \ - c_flag = 0; \ - } \ - A = (uint8) temp; \ - } \ - else \ - { \ - A = (data >> 1) | (c_flag << 7); \ - SET_NZ_FLAGS(A); \ - c_flag = (A & 0x40) >> 6; \ - v_flag = ((A >> 6) ^ (A >> 5)) & 1; \ - }\ - ADD_CYCLES(cycles); \ -} -#else -#define ARR(cycles, read_func) \ -{ \ - read_func(data); \ - data &= A; \ - A = (data >> 1) | (c_flag << 7); \ - SET_NZ_FLAGS(A); \ - c_flag = (A & 0x40) >> 6; \ - v_flag = ((A >> 6) ^ (A >> 5)) & 1; \ - ADD_CYCLES(cycles); \ -} -#endif /* NES6502_DECIMAL */ - -#define ASL(cycles, read_func, write_func, addr) \ -{ \ - read_func(addr, data); \ - c_flag = data >> 7; \ - data <<= 1; \ - write_func(addr, data); \ - SET_NZ_FLAGS(data); \ - ADD_CYCLES(cycles); \ -} - -#define ASL_A() \ -{ \ - c_flag = A >> 7; \ - A <<= 1; \ - SET_NZ_FLAGS(A); \ - ADD_CYCLES(2); \ -} - -/* undocumented */ -#define ASR(cycles, read_func) \ -{ \ - read_func(data); \ - data &= A; \ - c_flag = data & 1; \ - A = data >> 1; \ - SET_NZ_FLAGS(A); \ - ADD_CYCLES(cycles); \ -} - -#define BCC() \ -{ \ - RELATIVE_BRANCH(0 == c_flag); \ -} - -#define BCS() \ -{ \ - RELATIVE_BRANCH(0 != c_flag); \ -} - -#define BEQ() \ -{ \ - RELATIVE_BRANCH(0 == z_flag); \ -} - -/* bit 7/6 of data move into N/V flags */ -#define BIT(cycles, read_func) \ -{ \ - read_func(data); \ - n_flag = data; \ - v_flag = data & V_FLAG; \ - z_flag = data & A; \ - ADD_CYCLES(cycles); \ -} - -#define BMI() \ -{ \ - RELATIVE_BRANCH(n_flag & N_FLAG); \ -} - -#define BNE() \ -{ \ - RELATIVE_BRANCH(0 != z_flag); \ -} - -#define BPL() \ -{ \ - RELATIVE_BRANCH(0 == (n_flag & N_FLAG)); \ -} - -/* Software interrupt type thang */ -#define BRK() \ -{ \ - PC++; \ - PUSH(PC >> 8); \ - PUSH(PC & 0xFF); \ - b_flag = 1; \ - PUSH(COMBINE_FLAGS()); \ - i_flag = 1; \ - JUMP(IRQ_VECTOR); \ - ADD_CYCLES(7); \ -} - -#define BVC() \ -{ \ - RELATIVE_BRANCH(0 == v_flag); \ -} - -#define BVS() \ -{ \ - RELATIVE_BRANCH(0 != v_flag); \ -} - -#define CLC() \ -{ \ - c_flag = 0; \ - ADD_CYCLES(2); \ -} - -#define CLD() \ -{ \ - d_flag = 0; \ - ADD_CYCLES(2); \ -} - -#define CLI() \ -{ \ - i_flag = 0; \ - ADD_CYCLES(2); \ - if (cpu.int_pending && remaining_cycles > 0) \ - { \ - cpu.int_pending = 0; \ - IRQ_PROC(); \ - ADD_CYCLES(INT_CYCLES); \ - } \ -} - -#define CLV() \ -{ \ - v_flag = 0; \ - ADD_CYCLES(2); \ -} - -/* C is clear when data > A */ -#define _COMPARE(reg, value) \ -{ \ - temp = (reg) - (value); \ - c_flag = ((temp & 0x100) >> 8) ^ 1; \ - SET_NZ_FLAGS((uint8) temp); \ -} - -#define CMP(cycles, read_func) \ -{ \ - read_func(data); \ - _COMPARE(A, data); \ - ADD_CYCLES(cycles); \ -} - -#define CPX(cycles, read_func) \ -{ \ - read_func(data); \ - _COMPARE(X, data); \ - ADD_CYCLES(cycles); \ -} - -#define CPY(cycles, read_func) \ -{ \ - read_func(data); \ - _COMPARE(Y, data); \ - ADD_CYCLES(cycles); \ -} - -/* undocumented */ -#define DCP(cycles, read_func, write_func, addr) \ -{ \ - read_func(addr, data); \ - data--; \ - write_func(addr, data); \ - CMP(cycles, EMPTY_READ); \ -} - -#define DEC(cycles, read_func, write_func, addr) \ -{ \ - read_func(addr, data); \ - data--; \ - write_func(addr, data); \ - SET_NZ_FLAGS(data); \ - ADD_CYCLES(cycles); \ -} - -#define DEX() \ -{ \ - X--; \ - SET_NZ_FLAGS(X); \ - ADD_CYCLES(2); \ -} - -#define DEY() \ -{ \ - Y--; \ - SET_NZ_FLAGS(Y); \ - ADD_CYCLES(2); \ -} - -/* undocumented (double-NOP) */ -#define DOP(cycles) \ -{ \ - PC++; \ - ADD_CYCLES(cycles); \ -} - -#define EOR(cycles, read_func) \ -{ \ - read_func(data); \ - A ^= data; \ - SET_NZ_FLAGS(A); \ - ADD_CYCLES(cycles); \ -} - -#define INC(cycles, read_func, write_func, addr) \ -{ \ - read_func(addr, data); \ - data++; \ - write_func(addr, data); \ - SET_NZ_FLAGS(data); \ - ADD_CYCLES(cycles); \ -} - -#define INX() \ -{ \ - X++; \ - SET_NZ_FLAGS(X); \ - ADD_CYCLES(2); \ -} - -#define INY() \ -{ \ - Y++; \ - SET_NZ_FLAGS(Y); \ - ADD_CYCLES(2); \ -} - -/* undocumented */ -#define ISB(cycles, read_func, write_func, addr) \ -{ \ - read_func(addr, data); \ - data++; \ - write_func(addr, data); \ - SBC(cycles, EMPTY_READ); \ -} - -/* TODO: make this a function callback */ -#ifdef NES6502_TESTOPS -#define JAM() \ -{ \ - cpu_Jam(); \ -} -#else /* !NES6502_TESTOPS */ -#define JAM() \ -{ \ - PC--; \ - cpu.jammed = true; \ - cpu.int_pending = 0; \ - ADD_CYCLES(2); \ -} -#endif /* !NES6502_TESTOPS */ - -#define JMP_INDIRECT() \ -{ \ - temp = bank_readword(PC); \ - /* bug in crossing page boundaries */ \ - if (0xFF == (temp & 0xFF)) \ - PC = (bank_readbyte(temp & 0xFF00) << 8) | bank_readbyte(temp); \ - else \ - JUMP(temp); \ - ADD_CYCLES(5); \ -} - -#define JMP_ABSOLUTE() \ -{ \ - JUMP(PC); \ - ADD_CYCLES(3); \ -} - -#define JSR() \ -{ \ - PC++; \ - PUSH(PC >> 8); \ - PUSH(PC & 0xFF); \ - JUMP(PC - 1); \ - ADD_CYCLES(6); \ -} - -/* undocumented */ -#define LAS(cycles, read_func) \ -{ \ - read_func(data); \ - A = X = S = (S & data); \ - SET_NZ_FLAGS(A); \ - ADD_CYCLES(cycles); \ -} - -/* undocumented */ -#define LAX(cycles, read_func) \ -{ \ - read_func(A); \ - X = A; \ - SET_NZ_FLAGS(A); \ - ADD_CYCLES(cycles); \ -} - -#define LDA(cycles, read_func) \ -{ \ - read_func(A); \ - SET_NZ_FLAGS(A); \ - ADD_CYCLES(cycles); \ -} - -#define LDX(cycles, read_func) \ -{ \ - read_func(X); \ - SET_NZ_FLAGS(X);\ - ADD_CYCLES(cycles); \ -} - -#define LDY(cycles, read_func) \ -{ \ - read_func(Y); \ - SET_NZ_FLAGS(Y);\ - ADD_CYCLES(cycles); \ -} - -#define LSR(cycles, read_func, write_func, addr) \ -{ \ - read_func(addr, data); \ - c_flag = data & 1; \ - data >>= 1; \ - write_func(addr, data); \ - SET_NZ_FLAGS(data); \ - ADD_CYCLES(cycles); \ -} - -#define LSR_A() \ -{ \ - c_flag = A & 1; \ - A >>= 1; \ - SET_NZ_FLAGS(A); \ - ADD_CYCLES(2); \ -} - -/* undocumented */ -#define LXA(cycles, read_func) \ -{ \ - read_func(data); \ - A = X = ((A | 0xEE) & data); \ - SET_NZ_FLAGS(A); \ - ADD_CYCLES(cycles); \ -} - -#define NOP() \ -{ \ - ADD_CYCLES(2); \ -} - -#define ORA(cycles, read_func) \ -{ \ - read_func(data); \ - A |= data; \ - SET_NZ_FLAGS(A);\ - ADD_CYCLES(cycles); \ -} - -#define PHA() \ -{ \ - PUSH(A); \ - ADD_CYCLES(3); \ -} - -#define PHP() \ -{ \ - /* B flag is pushed on stack as well */ \ - PUSH(COMBINE_FLAGS() | B_FLAG); \ - ADD_CYCLES(3); \ -} - -#define PLA() \ -{ \ - A = PULL(); \ - SET_NZ_FLAGS(A); \ - ADD_CYCLES(4); \ -} - -#define PLP() \ -{ \ - btemp = PULL(); \ - SCATTER_FLAGS(btemp); \ - ADD_CYCLES(4); \ -} - -/* undocumented */ -#define RLA(cycles, read_func, write_func, addr) \ -{ \ - read_func(addr, data); \ - btemp = c_flag; \ - c_flag = data >> 7; \ - data = (data << 1) | btemp; \ - write_func(addr, data); \ - A &= data; \ - SET_NZ_FLAGS(A); \ - ADD_CYCLES(cycles); \ -} - -/* 9-bit rotation (carry flag used for rollover) */ -#define ROL(cycles, read_func, write_func, addr) \ -{ \ - read_func(addr, data); \ - btemp = c_flag; \ - c_flag = data >> 7; \ - data = (data << 1) | btemp; \ - write_func(addr, data); \ - SET_NZ_FLAGS(data); \ - ADD_CYCLES(cycles); \ -} - -#define ROL_A() \ -{ \ - btemp = c_flag; \ - c_flag = A >> 7; \ - A = (A << 1) | btemp; \ - SET_NZ_FLAGS(A); \ - ADD_CYCLES(2); \ -} - -#define ROR(cycles, read_func, write_func, addr) \ -{ \ - read_func(addr, data); \ - btemp = c_flag << 7; \ - c_flag = data & 1; \ - data = (data >> 1) | btemp; \ - write_func(addr, data); \ - SET_NZ_FLAGS(data); \ - ADD_CYCLES(cycles); \ -} - -#define ROR_A() \ -{ \ - btemp = c_flag << 7; \ - c_flag = A & 1; \ - A = (A >> 1) | btemp; \ - SET_NZ_FLAGS(A); \ - ADD_CYCLES(2); \ -} - -/* undocumented */ -#define RRA(cycles, read_func, write_func, addr) \ -{ \ - read_func(addr, data); \ - btemp = c_flag << 7; \ - c_flag = data & 1; \ - data = (data >> 1) | btemp; \ - write_func(addr, data); \ - ADC(cycles, EMPTY_READ); \ -} - -#define RTI() \ -{ \ - btemp = PULL(); \ - SCATTER_FLAGS(btemp); \ - PC = PULL(); \ - PC |= PULL() << 8; \ - ADD_CYCLES(6); \ - if (0 == i_flag && cpu.int_pending && remaining_cycles > 0) \ - { \ - cpu.int_pending = 0; \ - IRQ_PROC(); \ - ADD_CYCLES(INT_CYCLES); \ - } \ -} - -#define RTS() \ -{ \ - PC = PULL(); \ - PC = (PC | (PULL() << 8)) + 1; \ - ADD_CYCLES(6); \ -} - -/* undocumented */ -#define SAX(cycles, read_func, write_func, addr) \ -{ \ - read_func(addr); \ - data = A & X; \ - write_func(addr, data); \ - ADD_CYCLES(cycles); \ -} - -/* Warning! NES CPU has no decimal mode, so by default this does no BCD! */ -#ifdef NES6502_DECIMAL -#define SBC(cycles, read_func) \ -{ \ - read_func(data); \ - temp = A - data - (c_flag ^ 1); \ - if (d_flag) \ - { \ - uint8 al, ah; \ - al = (A & 0x0F) - (data & 0x0F) - (c_flag ^ 1); \ - ah = (A >> 4) - (data >> 4); \ - if (al & 0x10) \ - { \ - al -= 6; \ - ah--; \ - } \ - if (ah & 0x10) \ - { \ - ah -= 6; \ - c_flag = 0; \ - } \ - else \ - { \ - c_flag = 1; \ - } \ - v_flag = (A ^ temp) & (A ^ data) & 0x80; \ - SET_NZ_FLAGS(temp & 0xFF); \ - A = (ah << 4) | (al & 0x0F); \ - } \ - else \ - { \ - v_flag = (A ^ temp) & (A ^ data) & 0x80; \ - c_flag = ((temp & 0x100) >> 8) ^ 1; \ - A = (uint8) temp; \ - SET_NZ_FLAGS(A & 0xFF); \ - } \ - ADD_CYCLES(cycles); \ -} -#else -#define SBC(cycles, read_func) \ -{ \ - read_func(data); \ - temp = A - data - (c_flag ^ 1); \ - v_flag = (A ^ data) & (A ^ temp) & 0x80; \ - c_flag = ((temp >> 8) & 1) ^ 1; \ - A = (uint8) temp; \ - SET_NZ_FLAGS(A); \ - ADD_CYCLES(cycles); \ -} -#endif /* NES6502_DECIMAL */ - -/* undocumented */ -#define SBX(cycles, read_func) \ -{ \ - read_func(data); \ - temp = (A & X) - data; \ - c_flag = ((temp >> 8) & 1) ^ 1; \ - X = temp & 0xFF; \ - SET_NZ_FLAGS(X); \ - ADD_CYCLES(cycles); \ -} - -#define SEC() \ -{ \ - c_flag = 1; \ - ADD_CYCLES(2); \ -} - -#define SED() \ -{ \ - d_flag = 1; \ - ADD_CYCLES(2); \ -} - -#define SEI() \ -{ \ - i_flag = 1; \ - ADD_CYCLES(2); \ -} - -/* undocumented */ -#define SHA(cycles, read_func, write_func, addr) \ -{ \ - read_func(addr); \ - data = A & X & ((uint8) ((addr >> 8) + 1)); \ - write_func(addr, data); \ - ADD_CYCLES(cycles); \ -} - -/* undocumented */ -#define SHS(cycles, read_func, write_func, addr) \ -{ \ - read_func(addr); \ - S = A & X; \ - data = S & ((uint8) ((addr >> 8) + 1)); \ - write_func(addr, data); \ - ADD_CYCLES(cycles); \ -} - -/* undocumented */ -#define SHX(cycles, read_func, write_func, addr) \ -{ \ - read_func(addr); \ - data = X & ((uint8) ((addr >> 8) + 1)); \ - write_func(addr, data); \ - ADD_CYCLES(cycles); \ -} - -/* undocumented */ -#define SHY(cycles, read_func, write_func, addr) \ -{ \ - read_func(addr); \ - data = Y & ((uint8) ((addr >> 8 ) + 1)); \ - write_func(addr, data); \ - ADD_CYCLES(cycles); \ -} - -/* undocumented */ -#define SLO(cycles, read_func, write_func, addr) \ -{ \ - read_func(addr, data); \ - c_flag = data >> 7; \ - data <<= 1; \ - write_func(addr, data); \ - A |= data; \ - SET_NZ_FLAGS(A); \ - ADD_CYCLES(cycles); \ -} - -/* undocumented */ -#define SRE(cycles, read_func, write_func, addr) \ -{ \ - read_func(addr, data); \ - c_flag = data & 1; \ - data >>= 1; \ - write_func(addr, data); \ - A ^= data; \ - SET_NZ_FLAGS(A); \ - ADD_CYCLES(cycles); \ -} - -#define STA(cycles, read_func, write_func, addr) \ -{ \ - read_func(addr); \ - write_func(addr, A); \ - ADD_CYCLES(cycles); \ -} - -#define STX(cycles, read_func, write_func, addr) \ -{ \ - read_func(addr); \ - write_func(addr, X); \ - ADD_CYCLES(cycles); \ -} - -#define STY(cycles, read_func, write_func, addr) \ -{ \ - read_func(addr); \ - write_func(addr, Y); \ - ADD_CYCLES(cycles); \ -} - -#define TAX() \ -{ \ - X = A; \ - SET_NZ_FLAGS(X);\ - ADD_CYCLES(2); \ -} - -#define TAY() \ -{ \ - Y = A; \ - SET_NZ_FLAGS(Y);\ - ADD_CYCLES(2); \ -} - -/* undocumented (triple-NOP) */ -#define TOP() \ -{ \ - PC += 2; \ - ADD_CYCLES(4); \ -} - -#define TSX() \ -{ \ - X = S; \ - SET_NZ_FLAGS(X);\ - ADD_CYCLES(2); \ -} - -#define TXA() \ -{ \ - A = X; \ - SET_NZ_FLAGS(A);\ - ADD_CYCLES(2); \ -} - -#define TXS() \ -{ \ - S = X; \ - ADD_CYCLES(2); \ -} - -#define TYA() \ -{ \ - A = Y; \ - SET_NZ_FLAGS(A); \ - ADD_CYCLES(2); \ -} - - - -/* internal CPU context */ -static nes6502_context cpu; -static int remaining_cycles = 0; /* so we can release timeslice */ -/* memory region pointers */ -static uint8 *ram = NULL, *stack = NULL; -static uint8 null_page[NES6502_BANKSIZE]; - - -/* -** Zero-page helper macros -*/ - -#define ZP_READBYTE(addr) ram[(addr)] -#define ZP_WRITEBYTE(addr, value) ram[(addr)] = (uint8) (value) - -#ifdef HOST_LITTLE_ENDIAN - -/* NOTE: following two functions will fail on architectures -** which do not support byte alignment -*/ -INLINE uint32 zp_readword(register uint8 address) -{ - return (uint32) (*(uint16 *)(ram + address)); -} - -INLINE uint32 bank_readword(register uint32 address) -{ - /* technically, this should fail if the address is $xFFF, but - ** any code that does this would be suspect anyway, as it would - ** be fetching a word across page boundaries, which only would - ** make sense if the banks were physically consecutive. - */ - return (uint32) (*(uint16 *)(cpu.mem_page[address >> NES6502_BANKSHIFT] + (address & NES6502_BANKMASK))); -} - -#else /* !HOST_LITTLE_ENDIAN */ - -INLINE uint32 zp_readword(register uint8 address) -{ -#ifdef TARGET_CPU_PPC - return __lhbrx(ram, address); -#else /* !TARGET_CPU_PPC */ - uint32 x = (uint32) *(uint16 *)(ram + address); - return (x << 8) | (x >> 8); -#endif /* !TARGET_CPU_PPC */ -} - -INLINE uint32 bank_readword(register uint32 address) -{ -#ifdef TARGET_CPU_PPC - return __lhbrx(cpu.mem_page[address >> NES6502_BANKSHIFT], address & NES6502_BANKMASK); -#else /* !TARGET_CPU_PPC */ - uint32 x = (uint32) *(uint16 *)(cpu.mem_page[address >> NES6502_BANKSHIFT] + (address & NES6502_BANKMASK)); - return (x << 8) | (x >> 8); -#endif /* !TARGET_CPU_PPC */ -} - -#endif /* !HOST_LITTLE_ENDIAN */ - -INLINE uint8 bank_readbyte(register uint32 address) -{ - return cpu.mem_page[address >> NES6502_BANKSHIFT][address & NES6502_BANKMASK]; -} - -INLINE void bank_writebyte(register uint32 address, register uint8 value) -{ - cpu.mem_page[address >> NES6502_BANKSHIFT][address & NES6502_BANKMASK] = value; -} - -/* read a byte of 6502 memory */ -static uint8 mem_readbyte(uint32 address) -{ - nes6502_memread *mr; - - /* TODO: following 2 cases are N2A03-specific */ - if (address < 0x800) - { - /* RAM */ - return ram[address]; - } - else if (address >= 0x8000) - { - /* always paged memory */ - return bank_readbyte(address); - } - /* check memory range handlers */ - else - { - for (mr = cpu.read_handler; mr->min_range != 0xFFFFFFFF; mr++) - { - if (address >= mr->min_range && address <= mr->max_range) - return mr->read_func(address); - } - } - - /* return paged memory */ - return bank_readbyte(address); -} - -/* write a byte of data to 6502 memory */ -static void mem_writebyte(uint32 address, uint8 value) -{ - nes6502_memwrite *mw; - - /* RAM */ - if (address < 0x800) - { - ram[address] = value; - return; - } - /* check memory range handlers */ - else - { - for (mw = cpu.write_handler; mw->min_range != 0xFFFFFFFF; mw++) - { - if (address >= mw->min_range && address <= mw->max_range) - { - mw->write_func(address, value); - return; - } - } - } - - /* write to paged memory */ - bank_writebyte(address, value); -} - -/* set the current context */ -void nes6502_setcontext(nes6502_context *context) -{ - int loop; - - ASSERT(context); - - cpu = *context; - - /* set dead page for all pages not pointed at anything */ - for (loop = 0; loop < NES6502_NUMBANKS; loop++) - { - if (NULL == cpu.mem_page[loop]) - cpu.mem_page[loop] = null_page; - } - - ram = cpu.mem_page[0]; /* quick zero-page/RAM references */ - stack = ram + STACK_OFFSET; -} - -/* get the current context */ -void nes6502_getcontext(nes6502_context *context) -{ - int loop; - - ASSERT(context); - - *context = cpu; - - /* reset dead pages to null */ - for (loop = 0; loop < NES6502_NUMBANKS; loop++) - { - if (null_page == context->mem_page[loop]) - context->mem_page[loop] = NULL; - } -} - -/* DMA a byte of data from ROM */ -uint8 nes6502_getbyte(uint32 address) -{ - return bank_readbyte(address); -} - -/* get number of elapsed cycles */ -uint32 nes6502_getcycles(bool reset_flag) -{ - uint32 cycles = cpu.total_cycles; - - if (reset_flag) - cpu.total_cycles = 0; - - return cycles; -} - -#define GET_GLOBAL_REGS() \ -{ \ - PC = cpu.pc_reg; \ - A = cpu.a_reg; \ - X = cpu.x_reg; \ - Y = cpu.y_reg; \ - SCATTER_FLAGS(cpu.p_reg); \ - S = cpu.s_reg; \ -} - -#define STORE_LOCAL_REGS() \ -{ \ - cpu.pc_reg = PC; \ - cpu.a_reg = A; \ - cpu.x_reg = X; \ - cpu.y_reg = Y; \ - cpu.p_reg = COMBINE_FLAGS(); \ - cpu.s_reg = S; \ -} - -#define MIN(a,b) (((a) < (b)) ? (a) : (b)) - -#ifdef NES6502_JUMPTABLE - -#define OPCODE_BEGIN(xx) op##xx: -#ifdef NES6502_DISASM - -#define OPCODE_END \ - if (remaining_cycles <= 0) \ - goto end_execute; \ - log_printf(nes6502_disasm(PC, COMBINE_FLAGS(), A, X, Y, S)); \ - goto *opcode_table[bank_readbyte(PC++)]; - -#else /* !NES6520_DISASM */ - -#define OPCODE_END \ - if (remaining_cycles <= 0) \ - goto end_execute; \ - goto *opcode_table[bank_readbyte(PC++)]; - -#endif /* !NES6502_DISASM */ - -#else /* !NES6502_JUMPTABLE */ -#define OPCODE_BEGIN(xx) case 0x##xx: -#define OPCODE_END break; -#endif /* !NES6502_JUMPTABLE */ - - -/* Execute instructions until count expires -** -** Returns the number of cycles *actually* executed, which will be -** anywhere from zero to timeslice_cycles + 6 -*/ -int nes6502_execute(int timeslice_cycles) -{ - int old_cycles = cpu.total_cycles; - - uint32 temp, addr; /* for macros */ - uint8 btemp, baddr; /* for macros */ - uint8 data; - - /* flags */ - uint8 n_flag, v_flag, b_flag; - uint8 d_flag, i_flag, z_flag, c_flag; - - /* local copies of regs */ - uint32 PC; - uint8 A, X, Y, S; - -#ifdef NES6502_JUMPTABLE - - static const void *opcode_table[256] = - { - &&op00, &&op01, &&op02, &&op03, &&op04, &&op05, &&op06, &&op07, - &&op08, &&op09, &&op0A, &&op0B, &&op0C, &&op0D, &&op0E, &&op0F, - &&op10, &&op11, &&op12, &&op13, &&op14, &&op15, &&op16, &&op17, - &&op18, &&op19, &&op1A, &&op1B, &&op1C, &&op1D, &&op1E, &&op1F, - &&op20, &&op21, &&op22, &&op23, &&op24, &&op25, &&op26, &&op27, - &&op28, &&op29, &&op2A, &&op2B, &&op2C, &&op2D, &&op2E, &&op2F, - &&op30, &&op31, &&op32, &&op33, &&op34, &&op35, &&op36, &&op37, - &&op38, &&op39, &&op3A, &&op3B, &&op3C, &&op3D, &&op3E, &&op3F, - &&op40, &&op41, &&op42, &&op43, &&op44, &&op45, &&op46, &&op47, - &&op48, &&op49, &&op4A, &&op4B, &&op4C, &&op4D, &&op4E, &&op4F, - &&op50, &&op51, &&op52, &&op53, &&op54, &&op55, &&op56, &&op57, - &&op58, &&op59, &&op5A, &&op5B, &&op5C, &&op5D, &&op5E, &&op5F, - &&op60, &&op61, &&op62, &&op63, &&op64, &&op65, &&op66, &&op67, - &&op68, &&op69, &&op6A, &&op6B, &&op6C, &&op6D, &&op6E, &&op6F, - &&op70, &&op71, &&op72, &&op73, &&op74, &&op75, &&op76, &&op77, - &&op78, &&op79, &&op7A, &&op7B, &&op7C, &&op7D, &&op7E, &&op7F, - &&op80, &&op81, &&op82, &&op83, &&op84, &&op85, &&op86, &&op87, - &&op88, &&op89, &&op8A, &&op8B, &&op8C, &&op8D, &&op8E, &&op8F, - &&op90, &&op91, &&op92, &&op93, &&op94, &&op95, &&op96, &&op97, - &&op98, &&op99, &&op9A, &&op9B, &&op9C, &&op9D, &&op9E, &&op9F, - &&opA0, &&opA1, &&opA2, &&opA3, &&opA4, &&opA5, &&opA6, &&opA7, - &&opA8, &&opA9, &&opAA, &&opAB, &&opAC, &&opAD, &&opAE, &&opAF, - &&opB0, &&opB1, &&opB2, &&opB3, &&opB4, &&opB5, &&opB6, &&opB7, - &&opB8, &&opB9, &&opBA, &&opBB, &&opBC, &&opBD, &&opBE, &&opBF, - &&opC0, &&opC1, &&opC2, &&opC3, &&opC4, &&opC5, &&opC6, &&opC7, - &&opC8, &&opC9, &&opCA, &&opCB, &&opCC, &&opCD, &&opCE, &&opCF, - &&opD0, &&opD1, &&opD2, &&opD3, &&opD4, &&opD5, &&opD6, &&opD7, - &&opD8, &&opD9, &&opDA, &&opDB, &&opDC, &&opDD, &&opDE, &&opDF, - &&opE0, &&opE1, &&opE2, &&opE3, &&opE4, &&opE5, &&opE6, &&opE7, - &&opE8, &&opE9, &&opEA, &&opEB, &&opEC, &&opED, &&opEE, &&opEF, - &&opF0, &&opF1, &&opF2, &&opF3, &&opF4, &&opF5, &&opF6, &&opF7, - &&opF8, &&opF9, &&opFA, &&opFB, &&opFC, &&opFD, &&opFE, &&opFF - }; - -#endif /* NES6502_JUMPTABLE */ - - remaining_cycles = timeslice_cycles; - - GET_GLOBAL_REGS(); - - /* check for DMA cycle burning */ - if (cpu.burn_cycles && remaining_cycles > 0) - { - int burn_for; - - burn_for = MIN(remaining_cycles, cpu.burn_cycles); - ADD_CYCLES(burn_for); - cpu.burn_cycles -= burn_for; - } - - if (0 == i_flag && cpu.int_pending && remaining_cycles > 0) - { - cpu.int_pending = 0; - IRQ_PROC(); - ADD_CYCLES(INT_CYCLES); - } - -#ifdef NES6502_JUMPTABLE - /* fetch first instruction */ - OPCODE_END - -#else /* !NES6502_JUMPTABLE */ - - /* Continue until we run out of cycles */ - while (remaining_cycles > 0) - { -#ifdef NES6502_DISASM - log_printf(nes6502_disasm(PC, COMBINE_FLAGS(), A, X, Y, S)); -#endif /* NES6502_DISASM */ - - /* Fetch and execute instruction */ - switch (bank_readbyte(PC++)) - { -#endif /* !NES6502_JUMPTABLE */ - - OPCODE_BEGIN(00) /* BRK */ - BRK(); - OPCODE_END - - OPCODE_BEGIN(01) /* ORA ($nn,X) */ - ORA(6, INDIR_X_BYTE); - OPCODE_END - - OPCODE_BEGIN(02) /* JAM */ - OPCODE_BEGIN(12) /* JAM */ - OPCODE_BEGIN(22) /* JAM */ - OPCODE_BEGIN(32) /* JAM */ - OPCODE_BEGIN(42) /* JAM */ - OPCODE_BEGIN(52) /* JAM */ - OPCODE_BEGIN(62) /* JAM */ - OPCODE_BEGIN(72) /* JAM */ - OPCODE_BEGIN(92) /* JAM */ - OPCODE_BEGIN(B2) /* JAM */ - OPCODE_BEGIN(D2) /* JAM */ - OPCODE_BEGIN(F2) /* JAM */ - JAM(); - /* kill the CPU */ - remaining_cycles = 0; - OPCODE_END - - OPCODE_BEGIN(03) /* SLO ($nn,X) */ - SLO(8, INDIR_X, mem_writebyte, addr); - OPCODE_END - - OPCODE_BEGIN(04) /* NOP $nn */ - OPCODE_BEGIN(44) /* NOP $nn */ - OPCODE_BEGIN(64) /* NOP $nn */ - DOP(3); - OPCODE_END - - OPCODE_BEGIN(05) /* ORA $nn */ - ORA(3, ZERO_PAGE_BYTE); - OPCODE_END - - OPCODE_BEGIN(06) /* ASL $nn */ - ASL(5, ZERO_PAGE, ZP_WRITEBYTE, baddr); - OPCODE_END - - OPCODE_BEGIN(07) /* SLO $nn */ - SLO(5, ZERO_PAGE, ZP_WRITEBYTE, baddr); - OPCODE_END - - OPCODE_BEGIN(08) /* PHP */ - PHP(); - OPCODE_END - - OPCODE_BEGIN(09) /* ORA #$nn */ - ORA(2, IMMEDIATE_BYTE); - OPCODE_END - - OPCODE_BEGIN(0A) /* ASL A */ - ASL_A(); - OPCODE_END - - OPCODE_BEGIN(0B) /* ANC #$nn */ - ANC(2, IMMEDIATE_BYTE); - OPCODE_END - - OPCODE_BEGIN(0C) /* NOP $nnnn */ - TOP(); - OPCODE_END - - OPCODE_BEGIN(0D) /* ORA $nnnn */ - ORA(4, ABSOLUTE_BYTE); - OPCODE_END - - OPCODE_BEGIN(0E) /* ASL $nnnn */ - ASL(6, ABSOLUTE, mem_writebyte, addr); - OPCODE_END - - OPCODE_BEGIN(0F) /* SLO $nnnn */ - SLO(6, ABSOLUTE, mem_writebyte, addr); - OPCODE_END - - OPCODE_BEGIN(10) /* BPL $nnnn */ - BPL(); - OPCODE_END - - OPCODE_BEGIN(11) /* ORA ($nn),Y */ - ORA(5, INDIR_Y_BYTE_READ); - OPCODE_END - - OPCODE_BEGIN(13) /* SLO ($nn),Y */ - SLO(8, INDIR_Y, mem_writebyte, addr); - OPCODE_END - - OPCODE_BEGIN(14) /* NOP $nn,X */ - OPCODE_BEGIN(34) /* NOP */ - OPCODE_BEGIN(54) /* NOP $nn,X */ - OPCODE_BEGIN(74) /* NOP $nn,X */ - OPCODE_BEGIN(D4) /* NOP $nn,X */ - OPCODE_BEGIN(F4) /* NOP ($nn,X) */ - DOP(4); - OPCODE_END - - OPCODE_BEGIN(15) /* ORA $nn,X */ - ORA(4, ZP_IND_X_BYTE); - OPCODE_END - - OPCODE_BEGIN(16) /* ASL $nn,X */ - ASL(6, ZP_IND_X, ZP_WRITEBYTE, baddr); - OPCODE_END - - OPCODE_BEGIN(17) /* SLO $nn,X */ - SLO(6, ZP_IND_X, ZP_WRITEBYTE, baddr); - OPCODE_END - - OPCODE_BEGIN(18) /* CLC */ - CLC(); - OPCODE_END - - OPCODE_BEGIN(19) /* ORA $nnnn,Y */ - ORA(4, ABS_IND_Y_BYTE_READ); - OPCODE_END - - OPCODE_BEGIN(1A) /* NOP */ - OPCODE_BEGIN(3A) /* NOP */ - OPCODE_BEGIN(5A) /* NOP */ - OPCODE_BEGIN(7A) /* NOP */ - OPCODE_BEGIN(DA) /* NOP */ - OPCODE_BEGIN(FA) /* NOP */ - NOP(); - OPCODE_END - - OPCODE_BEGIN(1B) /* SLO $nnnn,Y */ - SLO(7, ABS_IND_Y, mem_writebyte, addr); - OPCODE_END - - OPCODE_BEGIN(1C) /* NOP $nnnn,X */ - OPCODE_BEGIN(3C) /* NOP $nnnn,X */ - OPCODE_BEGIN(5C) /* NOP $nnnn,X */ - OPCODE_BEGIN(7C) /* NOP $nnnn,X */ - OPCODE_BEGIN(DC) /* NOP $nnnn,X */ - OPCODE_BEGIN(FC) /* NOP $nnnn,X */ - TOP(); - OPCODE_END - - OPCODE_BEGIN(1D) /* ORA $nnnn,X */ - ORA(4, ABS_IND_X_BYTE_READ); - OPCODE_END - - OPCODE_BEGIN(1E) /* ASL $nnnn,X */ - ASL(7, ABS_IND_X, mem_writebyte, addr); - OPCODE_END - - OPCODE_BEGIN(1F) /* SLO $nnnn,X */ - SLO(7, ABS_IND_X, mem_writebyte, addr); - OPCODE_END - - OPCODE_BEGIN(20) /* JSR $nnnn */ - JSR(); - OPCODE_END - - OPCODE_BEGIN(21) /* AND ($nn,X) */ - AND(6, INDIR_X_BYTE); - OPCODE_END - - OPCODE_BEGIN(23) /* RLA ($nn,X) */ - RLA(8, INDIR_X, mem_writebyte, addr); - OPCODE_END - - OPCODE_BEGIN(24) /* BIT $nn */ - BIT(3, ZERO_PAGE_BYTE); - OPCODE_END - - OPCODE_BEGIN(25) /* AND $nn */ - AND(3, ZERO_PAGE_BYTE); - OPCODE_END - - OPCODE_BEGIN(26) /* ROL $nn */ - ROL(5, ZERO_PAGE, ZP_WRITEBYTE, baddr); - OPCODE_END - - OPCODE_BEGIN(27) /* RLA $nn */ - RLA(5, ZERO_PAGE, ZP_WRITEBYTE, baddr); - OPCODE_END - - OPCODE_BEGIN(28) /* PLP */ - PLP(); - OPCODE_END - - OPCODE_BEGIN(29) /* AND #$nn */ - AND(2, IMMEDIATE_BYTE); - OPCODE_END - - OPCODE_BEGIN(2A) /* ROL A */ - ROL_A(); - OPCODE_END - - OPCODE_BEGIN(2B) /* ANC #$nn */ - ANC(2, IMMEDIATE_BYTE); - OPCODE_END - - OPCODE_BEGIN(2C) /* BIT $nnnn */ - BIT(4, ABSOLUTE_BYTE); - OPCODE_END - - OPCODE_BEGIN(2D) /* AND $nnnn */ - AND(4, ABSOLUTE_BYTE); - OPCODE_END - - OPCODE_BEGIN(2E) /* ROL $nnnn */ - ROL(6, ABSOLUTE, mem_writebyte, addr); - OPCODE_END - - OPCODE_BEGIN(2F) /* RLA $nnnn */ - RLA(6, ABSOLUTE, mem_writebyte, addr); - OPCODE_END - - OPCODE_BEGIN(30) /* BMI $nnnn */ - BMI(); - OPCODE_END - - OPCODE_BEGIN(31) /* AND ($nn),Y */ - AND(5, INDIR_Y_BYTE_READ); - OPCODE_END - - OPCODE_BEGIN(33) /* RLA ($nn),Y */ - RLA(8, INDIR_Y, mem_writebyte, addr); - OPCODE_END - - OPCODE_BEGIN(35) /* AND $nn,X */ - AND(4, ZP_IND_X_BYTE); - OPCODE_END - - OPCODE_BEGIN(36) /* ROL $nn,X */ - ROL(6, ZP_IND_X, ZP_WRITEBYTE, baddr); - OPCODE_END - - OPCODE_BEGIN(37) /* RLA $nn,X */ - RLA(6, ZP_IND_X, ZP_WRITEBYTE, baddr); - OPCODE_END - - OPCODE_BEGIN(38) /* SEC */ - SEC(); - OPCODE_END - - OPCODE_BEGIN(39) /* AND $nnnn,Y */ - AND(4, ABS_IND_Y_BYTE_READ); - OPCODE_END - - OPCODE_BEGIN(3B) /* RLA $nnnn,Y */ - RLA(7, ABS_IND_Y, mem_writebyte, addr); - OPCODE_END - - OPCODE_BEGIN(3D) /* AND $nnnn,X */ - AND(4, ABS_IND_X_BYTE_READ); - OPCODE_END - - OPCODE_BEGIN(3E) /* ROL $nnnn,X */ - ROL(7, ABS_IND_X, mem_writebyte, addr); - OPCODE_END - - OPCODE_BEGIN(3F) /* RLA $nnnn,X */ - RLA(7, ABS_IND_X, mem_writebyte, addr); - OPCODE_END - - OPCODE_BEGIN(40) /* RTI */ - RTI(); - OPCODE_END - - OPCODE_BEGIN(41) /* EOR ($nn,X) */ - EOR(6, INDIR_X_BYTE); - OPCODE_END - - OPCODE_BEGIN(43) /* SRE ($nn,X) */ - SRE(8, INDIR_X, mem_writebyte, addr); - OPCODE_END - - OPCODE_BEGIN(45) /* EOR $nn */ - EOR(3, ZERO_PAGE_BYTE); - OPCODE_END - - OPCODE_BEGIN(46) /* LSR $nn */ - LSR(5, ZERO_PAGE, ZP_WRITEBYTE, baddr); - OPCODE_END - - OPCODE_BEGIN(47) /* SRE $nn */ - SRE(5, ZERO_PAGE, ZP_WRITEBYTE, baddr); - OPCODE_END - - OPCODE_BEGIN(48) /* PHA */ - PHA(); - OPCODE_END - - OPCODE_BEGIN(49) /* EOR #$nn */ - EOR(2, IMMEDIATE_BYTE); - OPCODE_END - - OPCODE_BEGIN(4A) /* LSR A */ - LSR_A(); - OPCODE_END - - OPCODE_BEGIN(4B) /* ASR #$nn */ - ASR(2, IMMEDIATE_BYTE); - OPCODE_END - - OPCODE_BEGIN(4C) /* JMP $nnnn */ - JMP_ABSOLUTE(); - OPCODE_END - - OPCODE_BEGIN(4D) /* EOR $nnnn */ - EOR(4, ABSOLUTE_BYTE); - OPCODE_END - - OPCODE_BEGIN(4E) /* LSR $nnnn */ - LSR(6, ABSOLUTE, mem_writebyte, addr); - OPCODE_END - - OPCODE_BEGIN(4F) /* SRE $nnnn */ - SRE(6, ABSOLUTE, mem_writebyte, addr); - OPCODE_END - - OPCODE_BEGIN(50) /* BVC $nnnn */ - BVC(); - OPCODE_END - - OPCODE_BEGIN(51) /* EOR ($nn),Y */ - EOR(5, INDIR_Y_BYTE_READ); - OPCODE_END - - OPCODE_BEGIN(53) /* SRE ($nn),Y */ - SRE(8, INDIR_Y, mem_writebyte, addr); - OPCODE_END - - OPCODE_BEGIN(55) /* EOR $nn,X */ - EOR(4, ZP_IND_X_BYTE); - OPCODE_END - - OPCODE_BEGIN(56) /* LSR $nn,X */ - LSR(6, ZP_IND_X, ZP_WRITEBYTE, baddr); - OPCODE_END - - OPCODE_BEGIN(57) /* SRE $nn,X */ - SRE(6, ZP_IND_X, ZP_WRITEBYTE, baddr); - OPCODE_END - - OPCODE_BEGIN(58) /* CLI */ - CLI(); - OPCODE_END - - OPCODE_BEGIN(59) /* EOR $nnnn,Y */ - EOR(4, ABS_IND_Y_BYTE_READ); - OPCODE_END - - OPCODE_BEGIN(5B) /* SRE $nnnn,Y */ - SRE(7, ABS_IND_Y, mem_writebyte, addr); - OPCODE_END - - OPCODE_BEGIN(5D) /* EOR $nnnn,X */ - EOR(4, ABS_IND_X_BYTE_READ); - OPCODE_END - - OPCODE_BEGIN(5E) /* LSR $nnnn,X */ - LSR(7, ABS_IND_X, mem_writebyte, addr); - OPCODE_END - - OPCODE_BEGIN(5F) /* SRE $nnnn,X */ - SRE(7, ABS_IND_X, mem_writebyte, addr); - OPCODE_END - - OPCODE_BEGIN(60) /* RTS */ - RTS(); - OPCODE_END - - OPCODE_BEGIN(61) /* ADC ($nn,X) */ - ADC(6, INDIR_X_BYTE); - OPCODE_END - - OPCODE_BEGIN(63) /* RRA ($nn,X) */ - RRA(8, INDIR_X, mem_writebyte, addr); - OPCODE_END - - OPCODE_BEGIN(65) /* ADC $nn */ - ADC(3, ZERO_PAGE_BYTE); - OPCODE_END - - OPCODE_BEGIN(66) /* ROR $nn */ - ROR(5, ZERO_PAGE, ZP_WRITEBYTE, baddr); - OPCODE_END - - OPCODE_BEGIN(67) /* RRA $nn */ - RRA(5, ZERO_PAGE, ZP_WRITEBYTE, baddr); - OPCODE_END - - OPCODE_BEGIN(68) /* PLA */ - PLA(); - OPCODE_END - - OPCODE_BEGIN(69) /* ADC #$nn */ - ADC(2, IMMEDIATE_BYTE); - OPCODE_END - - OPCODE_BEGIN(6A) /* ROR A */ - ROR_A(); - OPCODE_END - - OPCODE_BEGIN(6B) /* ARR #$nn */ - ARR(2, IMMEDIATE_BYTE); - OPCODE_END - - OPCODE_BEGIN(6C) /* JMP ($nnnn) */ - JMP_INDIRECT(); - OPCODE_END - - OPCODE_BEGIN(6D) /* ADC $nnnn */ - ADC(4, ABSOLUTE_BYTE); - OPCODE_END - - OPCODE_BEGIN(6E) /* ROR $nnnn */ - ROR(6, ABSOLUTE, mem_writebyte, addr); - OPCODE_END - - OPCODE_BEGIN(6F) /* RRA $nnnn */ - RRA(6, ABSOLUTE, mem_writebyte, addr); - OPCODE_END - - OPCODE_BEGIN(70) /* BVS $nnnn */ - BVS(); - OPCODE_END - - OPCODE_BEGIN(71) /* ADC ($nn),Y */ - ADC(5, INDIR_Y_BYTE_READ); - OPCODE_END - - OPCODE_BEGIN(73) /* RRA ($nn),Y */ - RRA(8, INDIR_Y, mem_writebyte, addr); - OPCODE_END - - OPCODE_BEGIN(75) /* ADC $nn,X */ - ADC(4, ZP_IND_X_BYTE); - OPCODE_END - - OPCODE_BEGIN(76) /* ROR $nn,X */ - ROR(6, ZP_IND_X, ZP_WRITEBYTE, baddr); - OPCODE_END - - OPCODE_BEGIN(77) /* RRA $nn,X */ - RRA(6, ZP_IND_X, ZP_WRITEBYTE, baddr); - OPCODE_END - - OPCODE_BEGIN(78) /* SEI */ - SEI(); - OPCODE_END - - OPCODE_BEGIN(79) /* ADC $nnnn,Y */ - ADC(4, ABS_IND_Y_BYTE_READ); - OPCODE_END - - OPCODE_BEGIN(7B) /* RRA $nnnn,Y */ - RRA(7, ABS_IND_Y, mem_writebyte, addr); - OPCODE_END - - OPCODE_BEGIN(7D) /* ADC $nnnn,X */ - ADC(4, ABS_IND_X_BYTE_READ); - OPCODE_END - - OPCODE_BEGIN(7E) /* ROR $nnnn,X */ - ROR(7, ABS_IND_X, mem_writebyte, addr); - OPCODE_END - - OPCODE_BEGIN(7F) /* RRA $nnnn,X */ - RRA(7, ABS_IND_X, mem_writebyte, addr); - OPCODE_END - - OPCODE_BEGIN(80) /* NOP #$nn */ - OPCODE_BEGIN(82) /* NOP #$nn */ - OPCODE_BEGIN(89) /* NOP #$nn */ - OPCODE_BEGIN(C2) /* NOP #$nn */ - OPCODE_BEGIN(E2) /* NOP #$nn */ - DOP(2); - OPCODE_END - - OPCODE_BEGIN(81) /* STA ($nn,X) */ - STA(6, INDIR_X_ADDR, mem_writebyte, addr); - OPCODE_END - - OPCODE_BEGIN(83) /* SAX ($nn,X) */ - SAX(6, INDIR_X_ADDR, mem_writebyte, addr); - OPCODE_END - - OPCODE_BEGIN(84) /* STY $nn */ - STY(3, ZERO_PAGE_ADDR, ZP_WRITEBYTE, baddr); - OPCODE_END - - OPCODE_BEGIN(85) /* STA $nn */ - STA(3, ZERO_PAGE_ADDR, ZP_WRITEBYTE, baddr); - OPCODE_END - - OPCODE_BEGIN(86) /* STX $nn */ - STX(3, ZERO_PAGE_ADDR, ZP_WRITEBYTE, baddr); - OPCODE_END - - OPCODE_BEGIN(87) /* SAX $nn */ - SAX(3, ZERO_PAGE_ADDR, ZP_WRITEBYTE, baddr); - OPCODE_END - - OPCODE_BEGIN(88) /* DEY */ - DEY(); - OPCODE_END - - OPCODE_BEGIN(8A) /* TXA */ - TXA(); - OPCODE_END - - OPCODE_BEGIN(8B) /* ANE #$nn */ - ANE(2, IMMEDIATE_BYTE); - OPCODE_END - - OPCODE_BEGIN(8C) /* STY $nnnn */ - STY(4, ABSOLUTE_ADDR, mem_writebyte, addr); - OPCODE_END - - OPCODE_BEGIN(8D) /* STA $nnnn */ - STA(4, ABSOLUTE_ADDR, mem_writebyte, addr); - OPCODE_END - - OPCODE_BEGIN(8E) /* STX $nnnn */ - STX(4, ABSOLUTE_ADDR, mem_writebyte, addr); - OPCODE_END - - OPCODE_BEGIN(8F) /* SAX $nnnn */ - SAX(4, ABSOLUTE_ADDR, mem_writebyte, addr); - OPCODE_END - - OPCODE_BEGIN(90) /* BCC $nnnn */ - BCC(); - OPCODE_END - - OPCODE_BEGIN(91) /* STA ($nn),Y */ - STA(6, INDIR_Y_ADDR, mem_writebyte, addr); - OPCODE_END - - OPCODE_BEGIN(93) /* SHA ($nn),Y */ - SHA(6, INDIR_Y_ADDR, mem_writebyte, addr); - OPCODE_END - - OPCODE_BEGIN(94) /* STY $nn,X */ - STY(4, ZP_IND_X_ADDR, ZP_WRITEBYTE, baddr); - OPCODE_END - - OPCODE_BEGIN(95) /* STA $nn,X */ - STA(4, ZP_IND_X_ADDR, ZP_WRITEBYTE, baddr); - OPCODE_END - - OPCODE_BEGIN(96) /* STX $nn,Y */ - STX(4, ZP_IND_Y_ADDR, ZP_WRITEBYTE, baddr); - OPCODE_END - - OPCODE_BEGIN(97) /* SAX $nn,Y */ - SAX(4, ZP_IND_Y_ADDR, ZP_WRITEBYTE, baddr); - OPCODE_END - - OPCODE_BEGIN(98) /* TYA */ - TYA(); - OPCODE_END - - OPCODE_BEGIN(99) /* STA $nnnn,Y */ - STA(5, ABS_IND_Y_ADDR, mem_writebyte, addr); - OPCODE_END - - OPCODE_BEGIN(9A) /* TXS */ - TXS(); - OPCODE_END - - OPCODE_BEGIN(9B) /* SHS $nnnn,Y */ - SHS(5, ABS_IND_Y_ADDR, mem_writebyte, addr); - OPCODE_END - - OPCODE_BEGIN(9C) /* SHY $nnnn,X */ - SHY(5, ABS_IND_X_ADDR, mem_writebyte, addr); - OPCODE_END - - OPCODE_BEGIN(9D) /* STA $nnnn,X */ - STA(5, ABS_IND_X_ADDR, mem_writebyte, addr); - OPCODE_END - - OPCODE_BEGIN(9E) /* SHX $nnnn,Y */ - SHX(5, ABS_IND_Y_ADDR, mem_writebyte, addr); - OPCODE_END - - OPCODE_BEGIN(9F) /* SHA $nnnn,Y */ - SHA(5, ABS_IND_Y_ADDR, mem_writebyte, addr); - OPCODE_END - - OPCODE_BEGIN(A0) /* LDY #$nn */ - LDY(2, IMMEDIATE_BYTE); - OPCODE_END - - OPCODE_BEGIN(A1) /* LDA ($nn,X) */ - LDA(6, INDIR_X_BYTE); - OPCODE_END - - OPCODE_BEGIN(A2) /* LDX #$nn */ - LDX(2, IMMEDIATE_BYTE); - OPCODE_END - - OPCODE_BEGIN(A3) /* LAX ($nn,X) */ - LAX(6, INDIR_X_BYTE); - OPCODE_END - - OPCODE_BEGIN(A4) /* LDY $nn */ - LDY(3, ZERO_PAGE_BYTE); - OPCODE_END - - OPCODE_BEGIN(A5) /* LDA $nn */ - LDA(3, ZERO_PAGE_BYTE); - OPCODE_END - - OPCODE_BEGIN(A6) /* LDX $nn */ - LDX(3, ZERO_PAGE_BYTE); - OPCODE_END - - OPCODE_BEGIN(A7) /* LAX $nn */ - LAX(3, ZERO_PAGE_BYTE); - OPCODE_END - - OPCODE_BEGIN(A8) /* TAY */ - TAY(); - OPCODE_END - - OPCODE_BEGIN(A9) /* LDA #$nn */ - LDA(2, IMMEDIATE_BYTE); - OPCODE_END - - OPCODE_BEGIN(AA) /* TAX */ - TAX(); - OPCODE_END - - OPCODE_BEGIN(AB) /* LXA #$nn */ - LXA(2, IMMEDIATE_BYTE); - OPCODE_END - - OPCODE_BEGIN(AC) /* LDY $nnnn */ - LDY(4, ABSOLUTE_BYTE); - OPCODE_END - - OPCODE_BEGIN(AD) /* LDA $nnnn */ - LDA(4, ABSOLUTE_BYTE); - OPCODE_END - - OPCODE_BEGIN(AE) /* LDX $nnnn */ - LDX(4, ABSOLUTE_BYTE); - OPCODE_END - - OPCODE_BEGIN(AF) /* LAX $nnnn */ - LAX(4, ABSOLUTE_BYTE); - OPCODE_END - - OPCODE_BEGIN(B0) /* BCS $nnnn */ - BCS(); - OPCODE_END - - OPCODE_BEGIN(B1) /* LDA ($nn),Y */ - LDA(5, INDIR_Y_BYTE_READ); - OPCODE_END - - OPCODE_BEGIN(B3) /* LAX ($nn),Y */ - LAX(5, INDIR_Y_BYTE_READ); - OPCODE_END - - OPCODE_BEGIN(B4) /* LDY $nn,X */ - LDY(4, ZP_IND_X_BYTE); - OPCODE_END - - OPCODE_BEGIN(B5) /* LDA $nn,X */ - LDA(4, ZP_IND_X_BYTE); - OPCODE_END - - OPCODE_BEGIN(B6) /* LDX $nn,Y */ - LDX(4, ZP_IND_Y_BYTE); - OPCODE_END - - OPCODE_BEGIN(B7) /* LAX $nn,Y */ - LAX(4, ZP_IND_Y_BYTE); - OPCODE_END - - OPCODE_BEGIN(B8) /* CLV */ - CLV(); - OPCODE_END - - OPCODE_BEGIN(B9) /* LDA $nnnn,Y */ - LDA(4, ABS_IND_Y_BYTE_READ); - OPCODE_END - - OPCODE_BEGIN(BA) /* TSX */ - TSX(); - OPCODE_END - - OPCODE_BEGIN(BB) /* LAS $nnnn,Y */ - LAS(4, ABS_IND_Y_BYTE_READ); - OPCODE_END - - OPCODE_BEGIN(BC) /* LDY $nnnn,X */ - LDY(4, ABS_IND_X_BYTE_READ); - OPCODE_END - - OPCODE_BEGIN(BD) /* LDA $nnnn,X */ - LDA(4, ABS_IND_X_BYTE_READ); - OPCODE_END - - OPCODE_BEGIN(BE) /* LDX $nnnn,Y */ - LDX(4, ABS_IND_Y_BYTE_READ); - OPCODE_END - - OPCODE_BEGIN(BF) /* LAX $nnnn,Y */ - LAX(4, ABS_IND_Y_BYTE_READ); - OPCODE_END - - OPCODE_BEGIN(C0) /* CPY #$nn */ - CPY(2, IMMEDIATE_BYTE); - OPCODE_END - - OPCODE_BEGIN(C1) /* CMP ($nn,X) */ - CMP(6, INDIR_X_BYTE); - OPCODE_END - - OPCODE_BEGIN(C3) /* DCP ($nn,X) */ - DCP(8, INDIR_X, mem_writebyte, addr); - OPCODE_END - - OPCODE_BEGIN(C4) /* CPY $nn */ - CPY(3, ZERO_PAGE_BYTE); - OPCODE_END - - OPCODE_BEGIN(C5) /* CMP $nn */ - CMP(3, ZERO_PAGE_BYTE); - OPCODE_END - - OPCODE_BEGIN(C6) /* DEC $nn */ - DEC(5, ZERO_PAGE, ZP_WRITEBYTE, baddr); - OPCODE_END - - OPCODE_BEGIN(C7) /* DCP $nn */ - DCP(5, ZERO_PAGE, ZP_WRITEBYTE, baddr); - OPCODE_END - - OPCODE_BEGIN(C8) /* INY */ - INY(); - OPCODE_END - - OPCODE_BEGIN(C9) /* CMP #$nn */ - CMP(2, IMMEDIATE_BYTE); - OPCODE_END - - OPCODE_BEGIN(CA) /* DEX */ - DEX(); - OPCODE_END - - OPCODE_BEGIN(CB) /* SBX #$nn */ - SBX(2, IMMEDIATE_BYTE); - OPCODE_END - - OPCODE_BEGIN(CC) /* CPY $nnnn */ - CPY(4, ABSOLUTE_BYTE); - OPCODE_END - - OPCODE_BEGIN(CD) /* CMP $nnnn */ - CMP(4, ABSOLUTE_BYTE); - OPCODE_END - - OPCODE_BEGIN(CE) /* DEC $nnnn */ - DEC(6, ABSOLUTE, mem_writebyte, addr); - OPCODE_END - - OPCODE_BEGIN(CF) /* DCP $nnnn */ - DCP(6, ABSOLUTE, mem_writebyte, addr); - OPCODE_END - - OPCODE_BEGIN(D0) /* BNE $nnnn */ - BNE(); - OPCODE_END - - OPCODE_BEGIN(D1) /* CMP ($nn),Y */ - CMP(5, INDIR_Y_BYTE_READ); - OPCODE_END - - OPCODE_BEGIN(D3) /* DCP ($nn),Y */ - DCP(8, INDIR_Y, mem_writebyte, addr); - OPCODE_END - - OPCODE_BEGIN(D5) /* CMP $nn,X */ - CMP(4, ZP_IND_X_BYTE); - OPCODE_END - - OPCODE_BEGIN(D6) /* DEC $nn,X */ - DEC(6, ZP_IND_X, ZP_WRITEBYTE, baddr); - OPCODE_END - - OPCODE_BEGIN(D7) /* DCP $nn,X */ - DCP(6, ZP_IND_X, ZP_WRITEBYTE, baddr); - OPCODE_END - - OPCODE_BEGIN(D8) /* CLD */ - CLD(); - OPCODE_END - - OPCODE_BEGIN(D9) /* CMP $nnnn,Y */ - CMP(4, ABS_IND_Y_BYTE_READ); - OPCODE_END - - OPCODE_BEGIN(DB) /* DCP $nnnn,Y */ - DCP(7, ABS_IND_Y, mem_writebyte, addr); - OPCODE_END - - OPCODE_BEGIN(DD) /* CMP $nnnn,X */ - CMP(4, ABS_IND_X_BYTE_READ); - OPCODE_END - - OPCODE_BEGIN(DE) /* DEC $nnnn,X */ - DEC(7, ABS_IND_X, mem_writebyte, addr); - OPCODE_END - - OPCODE_BEGIN(DF) /* DCP $nnnn,X */ - DCP(7, ABS_IND_X, mem_writebyte, addr); - OPCODE_END - - OPCODE_BEGIN(E0) /* CPX #$nn */ - CPX(2, IMMEDIATE_BYTE); - OPCODE_END - - OPCODE_BEGIN(E1) /* SBC ($nn,X) */ - SBC(6, INDIR_X_BYTE); - OPCODE_END - - OPCODE_BEGIN(E3) /* ISB ($nn,X) */ - ISB(8, INDIR_X, mem_writebyte, addr); - OPCODE_END - - OPCODE_BEGIN(E4) /* CPX $nn */ - CPX(3, ZERO_PAGE_BYTE); - OPCODE_END - - OPCODE_BEGIN(E5) /* SBC $nn */ - SBC(3, ZERO_PAGE_BYTE); - OPCODE_END - - OPCODE_BEGIN(E6) /* INC $nn */ - INC(5, ZERO_PAGE, ZP_WRITEBYTE, baddr); - OPCODE_END - - OPCODE_BEGIN(E7) /* ISB $nn */ - ISB(5, ZERO_PAGE, ZP_WRITEBYTE, baddr); - OPCODE_END - - OPCODE_BEGIN(E8) /* INX */ - INX(); - OPCODE_END - - OPCODE_BEGIN(E9) /* SBC #$nn */ - OPCODE_BEGIN(EB) /* USBC #$nn */ - SBC(2, IMMEDIATE_BYTE); - OPCODE_END - - OPCODE_BEGIN(EA) /* NOP */ - NOP(); - OPCODE_END - - OPCODE_BEGIN(EC) /* CPX $nnnn */ - CPX(4, ABSOLUTE_BYTE); - OPCODE_END - - OPCODE_BEGIN(ED) /* SBC $nnnn */ - SBC(4, ABSOLUTE_BYTE); - OPCODE_END - - OPCODE_BEGIN(EE) /* INC $nnnn */ - INC(6, ABSOLUTE, mem_writebyte, addr); - OPCODE_END - - OPCODE_BEGIN(EF) /* ISB $nnnn */ - ISB(6, ABSOLUTE, mem_writebyte, addr); - OPCODE_END - - OPCODE_BEGIN(F0) /* BEQ $nnnn */ - BEQ(); - OPCODE_END - - OPCODE_BEGIN(F1) /* SBC ($nn),Y */ - SBC(5, INDIR_Y_BYTE_READ); - OPCODE_END - - OPCODE_BEGIN(F3) /* ISB ($nn),Y */ - ISB(8, INDIR_Y, mem_writebyte, addr); - OPCODE_END - - OPCODE_BEGIN(F5) /* SBC $nn,X */ - SBC(4, ZP_IND_X_BYTE); - OPCODE_END - - OPCODE_BEGIN(F6) /* INC $nn,X */ - INC(6, ZP_IND_X, ZP_WRITEBYTE, baddr); - OPCODE_END - - OPCODE_BEGIN(F7) /* ISB $nn,X */ - ISB(6, ZP_IND_X, ZP_WRITEBYTE, baddr); - OPCODE_END - - OPCODE_BEGIN(F8) /* SED */ - SED(); - OPCODE_END - - OPCODE_BEGIN(F9) /* SBC $nnnn,Y */ - SBC(4, ABS_IND_Y_BYTE_READ); - OPCODE_END - - OPCODE_BEGIN(FB) /* ISB $nnnn,Y */ - ISB(7, ABS_IND_Y, mem_writebyte, addr); - OPCODE_END - - OPCODE_BEGIN(FD) /* SBC $nnnn,X */ - SBC(4, ABS_IND_X_BYTE_READ); - OPCODE_END - - OPCODE_BEGIN(FE) /* INC $nnnn,X */ - INC(7, ABS_IND_X, mem_writebyte, addr); - OPCODE_END - - OPCODE_BEGIN(FF) /* ISB $nnnn,X */ - ISB(7, ABS_IND_X, mem_writebyte, addr); - OPCODE_END - -#ifdef NES6502_JUMPTABLE -end_execute: - -#else /* !NES6502_JUMPTABLE */ - } - } -#endif /* !NES6502_JUMPTABLE */ - - /* store local copy of regs */ - STORE_LOCAL_REGS(); - - /* Return our actual amount of executed cycles */ - return (cpu.total_cycles - old_cycles); -} - -/* Issue a CPU Reset */ -void nes6502_reset(void) -{ - cpu.p_reg = Z_FLAG | R_FLAG | I_FLAG; /* Reserved bit always 1 */ - cpu.int_pending = 0; /* No pending interrupts */ - cpu.int_latency = 0; /* No latent interrupts */ - cpu.pc_reg = bank_readword(RESET_VECTOR); /* Fetch reset vector */ - cpu.burn_cycles = RESET_CYCLES; - cpu.jammed = false; -} - -/* following macro is used for below 2 functions */ -#define DECLARE_LOCAL_REGS \ - uint32 PC; \ - uint8 A, X, Y, S; \ - uint8 n_flag, v_flag, b_flag; \ - uint8 d_flag, i_flag, z_flag, c_flag; - -/* Non-maskable interrupt */ -void nes6502_nmi(void) -{ - DECLARE_LOCAL_REGS - - if (false == cpu.jammed) - { - GET_GLOBAL_REGS(); - NMI_PROC(); - cpu.burn_cycles += INT_CYCLES; - STORE_LOCAL_REGS(); - } -} - -/* Interrupt request */ -void nes6502_irq(void) -{ - DECLARE_LOCAL_REGS - - if (false == cpu.jammed) - { - GET_GLOBAL_REGS(); - if (0 == i_flag) - { - IRQ_PROC(); - cpu.burn_cycles += INT_CYCLES; - } - else - { - cpu.int_pending = 1; - } - STORE_LOCAL_REGS(); - } -} - -/* Set dead cycle period */ -void nes6502_burn(int cycles) -{ - cpu.burn_cycles += cycles; -} - -/* Release our timeslice */ -void nes6502_release(void) -{ - remaining_cycles = 0; -} - -/* -** $Log: nes6502.c,v $ -** Revision 1.2 2001/04/27 14:37:11 neil -** wheeee -** -** Revision 1.1 2001/04/27 12:54:39 neil -** blah -** -** Revision 1.1.1.1 2001/04/27 07:03:54 neil -** initial -** -** Revision 1.34 2000/11/27 19:33:07 matt -** concise interrupts -** -** Revision 1.33 2000/11/26 15:39:54 matt -** timing fixes -** -** Revision 1.32 2000/11/20 13:22:51 matt -** added note about word fetches across page boundaries -** -** Revision 1.31 2000/11/13 00:57:39 matt -** trying to add 1-instruction interrupt latency... and failing. -** -** Revision 1.30 2000/10/10 13:58:14 matt -** stroustrup squeezing his way in the door -** -** Revision 1.29 2000/10/10 13:05:05 matt -** Mr. Clean makes a guest appearance -** -** Revision 1.28 2000/10/08 17:55:41 matt -** check burn cycles before ints -** -** Revision 1.27 2000/09/15 03:42:32 matt -** nes6502_release to release current timeslice -** -** Revision 1.26 2000/09/15 03:16:17 matt -** optimized C flag handling, and ADC/SBC/ROL/ROR macros -** -** Revision 1.25 2000/09/14 02:12:03 matt -** disassembling now works with goto table, and removed memcpy from context get/set -** -** Revision 1.24 2000/09/11 03:55:57 matt -** cosmetics -** -** Revision 1.23 2000/09/11 01:45:45 matt -** flag optimizations. this thing is fast! -** -** Revision 1.22 2000/09/08 13:29:25 matt -** added switch()-less execution for gcc -** -** Revision 1.21 2000/09/08 11:54:48 matt -** optimize -** -** Revision 1.20 2000/09/07 21:58:18 matt -** api change for nes6502_burn, optimized core -** -** Revision 1.19 2000/09/07 13:39:01 matt -** resolved a few conflicts -** -** Revision 1.18 2000/09/07 01:34:55 matt -** nes6502_init deprecated, moved flag regs to separate vars -** -** Revision 1.17 2000/08/31 13:26:35 matt -** added DISASM flag, to sync with asm version -** -** Revision 1.16 2000/08/29 05:38:00 matt -** removed faulty failure note -** -** Revision 1.15 2000/08/28 12:53:44 matt -** fixes for disassembler -** -** Revision 1.14 2000/08/28 04:32:28 matt -** naming convention changes -** -** Revision 1.13 2000/08/28 01:46:15 matt -** moved some of them defines around, cleaned up jamming code -** -** Revision 1.12 2000/08/16 04:56:37 matt -** accurate CPU jamming, added dead page emulation -** -** Revision 1.11 2000/07/30 04:32:00 matt -** now emulates the NES frame IRQ -** -** Revision 1.10 2000/07/17 01:52:28 matt -** made sure last line of all source files is a newline -** -** Revision 1.9 2000/07/11 04:27:18 matt -** new disassembler calling convention -** -** Revision 1.8 2000/07/10 05:26:38 matt -** cosmetic -** -** Revision 1.7 2000/07/06 17:10:51 matt -** minor (er, spelling) error fixed -** -** Revision 1.6 2000/07/04 04:50:07 matt -** minor change to includes -** -** Revision 1.5 2000/07/03 02:18:16 matt -** added a few notes about potential failure cases -** -** Revision 1.4 2000/06/09 15:12:25 matt -** initial revision -** -*/ diff --git a/MCUME_pico/piconofrendo/nes6502.h b/MCUME_pico/piconofrendo/nes6502.h deleted file mode 100755 index 7a2d040..0000000 --- a/MCUME_pico/piconofrendo/nes6502.h +++ /dev/null @@ -1,175 +0,0 @@ -/* -** Nofrendo (c) 1998-2000 Matthew Conte (matt@conte.com) -** -** -** This program is free software; you can redistribute it and/or -** modify it under the terms of version 2 of the GNU Library General -** Public License as published by the Free Software Foundation. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** Library General Public License for more details. To obtain a -** copy of the GNU Library General Public License, write to the Free -** Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -** -** Any permitted reproduction of these routines, in whole or in part, -** must bear this legend. -** -** -** nes6502.h -** -** NES custom 6502 CPU definitions / prototypes -** $Id: nes6502.h,v 1.2 2001/04/27 14:37:11 neil Exp $ -*/ - -/* NOTE: 16-bit addresses avoided like the plague: use 32-bit values -** wherever humanly possible -*/ -#ifndef _NES6502_H_ -#define _NES6502_H_ - -#include "noftypes.h" - -/* Define this to enable decimal mode in ADC / SBC (not needed in NES) */ -/*#define NES6502_DECIMAL*/ - -#define NES6502_NUMBANKS 16 -#define NES6502_BANKSHIFT 12 -#define NES6502_BANKSIZE (0x10000 / NES6502_NUMBANKS) -#define NES6502_BANKMASK (NES6502_BANKSIZE - 1) - -/* P (flag) register bitmasks */ -#define N_FLAG 0x80 -#define V_FLAG 0x40 -#define R_FLAG 0x20 /* Reserved, always 1 */ -#define B_FLAG 0x10 -#define D_FLAG 0x08 -#define I_FLAG 0x04 -#define Z_FLAG 0x02 -#define C_FLAG 0x01 - -/* Vector addresses */ -#define NMI_VECTOR 0xFFFA -#define RESET_VECTOR 0xFFFC -#define IRQ_VECTOR 0xFFFE - -/* cycle counts for interrupts */ -#define INT_CYCLES 7 -#define RESET_CYCLES 6 - -#define NMI_MASK 0x01 -#define IRQ_MASK 0x02 - -/* Stack is located on 6502 page 1 */ -#define STACK_OFFSET 0x0100 - -typedef struct -{ - uint32 min_range, max_range; - uint8 (*read_func)(uint32 address); -} nes6502_memread; - -typedef struct -{ - uint32 min_range, max_range; - void (*write_func)(uint32 address, uint8 value); -} nes6502_memwrite; - -typedef struct -{ - uint8 *mem_page[NES6502_NUMBANKS]; /* memory page pointers */ - - nes6502_memread *read_handler; - nes6502_memwrite *write_handler; - - uint32 pc_reg; - uint8 a_reg, p_reg; - uint8 x_reg, y_reg; - uint8 s_reg; - - uint8 jammed; /* is processor jammed? */ - - uint8 int_pending, int_latency; - - int32 total_cycles, burn_cycles; -} nes6502_context; - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/* Functions which govern the 6502's execution */ -extern void nes6502_reset(void); -extern int nes6502_execute(int total_cycles); -extern void nes6502_nmi(void); -extern void nes6502_irq(void); -extern uint8 nes6502_getbyte(uint32 address); -extern uint32 nes6502_getcycles(bool reset_flag); -extern void nes6502_burn(int cycles); -extern void nes6502_release(void); - -/* Context get/set */ -extern void nes6502_setcontext(nes6502_context *cpu); -extern void nes6502_getcontext(nes6502_context *cpu); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _NES6502_H_ */ - -/* -** $Log: nes6502.h,v $ -** Revision 1.2 2001/04/27 14:37:11 neil -** wheeee -** -** Revision 1.1 2001/04/27 12:54:39 neil -** blah -** -** Revision 1.1.1.1 2001/04/27 07:03:54 neil -** initial -** -** Revision 1.17 2000/11/13 00:57:39 matt -** trying to add 1-instruction interrupt latency... and failing. -** -** Revision 1.16 2000/10/27 12:53:36 matt -** banks are always 4kB now -** -** Revision 1.15 2000/10/10 13:58:14 matt -** stroustrup squeezing his way in the door -** -** Revision 1.14 2000/09/15 03:42:32 matt -** nes6502_release to release current timeslice -** -** Revision 1.13 2000/09/11 03:55:32 matt -** cosmetics -** -** Revision 1.12 2000/09/08 11:54:48 matt -** optimize -** -** Revision 1.11 2000/09/07 21:58:18 matt -** api change for nes6502_burn, optimized core -** -** Revision 1.10 2000/09/07 01:34:55 matt -** nes6502_init deprecated, moved flag regs to separate vars -** -** Revision 1.9 2000/08/28 12:53:44 matt -** fixes for disassembler -** -** Revision 1.8 2000/08/28 01:46:15 matt -** moved some of them defines around, cleaned up jamming code -** -** Revision 1.7 2000/08/16 04:56:37 matt -** accurate CPU jamming, added dead page emulation -** -** Revision 1.6 2000/07/30 04:32:00 matt -** now emulates the NES frame IRQ -** -** Revision 1.5 2000/07/17 01:52:28 matt -** made sure last line of all source files is a newline -** -** Revision 1.4 2000/06/09 15:12:25 matt -** initial revision -** -*/ diff --git a/MCUME_pico/piconofrendo/nes_apu.c b/MCUME_pico/piconofrendo/nes_apu.c deleted file mode 100755 index 9707411..0000000 --- a/MCUME_pico/piconofrendo/nes_apu.c +++ /dev/null @@ -1,1195 +0,0 @@ -/* -** Nofrendo (c) 1998-2000 Matthew Conte (matt@conte.com) -** -** -** This program is free software; you can redistribute it and/or -** modify it under the terms of version 2 of the GNU Library General -** Public License as published by the Free Software Foundation. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** Library General Public License for more details. To obtain a -** copy of the GNU Library General Public License, write to the Free -** Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -** -** Any permitted reproduction of these routines, in whole or in part, -** must bear this legend. -** -** -** nes_apu.c -** -** NES APU emulation -** $Id: nes_apu.c,v 1.2 2001/04/27 14:37:11 neil Exp $ -*/ - -#include -#include "noftypes.h" -#include "log.h" -#include "nes_apu.h" -#include "nes6502.h" - - -#define APU_OVERSAMPLE -#define APU_VOLUME_DECAY(x) ((x) -= ((x) >> 7)) - -/* the following seem to be the correct (empirically determined) -** relative volumes between the sound channels -*/ -#define APU_RECTANGLE_OUTPUT(channel) (apu.rectangle[channel].output_vol) -#define APU_TRIANGLE_OUTPUT (apu.triangle.output_vol + (apu.triangle.output_vol >> 2)) -#define APU_NOISE_OUTPUT ((apu.noise.output_vol + apu.noise.output_vol + apu.noise.output_vol) >> 2) -#define APU_DMC_OUTPUT ((apu.dmc.output_vol + apu.dmc.output_vol + apu.dmc.output_vol) >> 2) - -/* active APU */ -static apu_t apu; - -/* look up table madness */ -static int32 decay_lut[16]; -static int vbl_lut[32]; -static int trilength_lut[128]; - -/* noise lookups for both modes */ -#ifndef REALTIME_NOISE -static int8 noise_long_lut[APU_NOISE_32K]; -static int8 noise_short_lut[APU_NOISE_93]; -#endif /* !REALTIME_NOISE */ - - -/* vblank length table used for rectangles, triangle, noise */ -static const uint8 vbl_length[32] = -{ - 5, 127, - 10, 1, - 19, 2, - 40, 3, - 80, 4, - 30, 5, - 7, 6, - 13, 7, - 6, 8, - 12, 9, - 24, 10, - 48, 11, - 96, 12, - 36, 13, - 8, 14, - 16, 15 -}; - -/* frequency limit of rectangle channels */ -static const int freq_limit[8] = -{ - 0x3FF, 0x555, 0x666, 0x71C, 0x787, 0x7C1, 0x7E0, 0x7F0 -}; - -/* noise frequency lookup table */ -static const int noise_freq[16] = -{ - 4, 8, 16, 32, 64, 96, 128, 160, - 202, 254, 380, 508, 762, 1016, 2034, 4068 -}; - -/* DMC transfer freqs */ -const int dmc_clocks[16] = -{ - 428, 380, 340, 320, 286, 254, 226, 214, - 190, 160, 142, 128, 106, 85, 72, 54 -}; - -/* ratios of pos/neg pulse for rectangle waves */ -static const int duty_flip[4] = { 2, 4, 8, 12 }; - - -void apu_setcontext(apu_t *src_apu) -{ - apu = *src_apu; -} - -void apu_getcontext(apu_t *dest_apu) -{ - *dest_apu = apu; -} - -void apu_setchan(int chan, bool enabled) -{ - if (enabled) - apu.mix_enable |= (1 << chan); - else - apu.mix_enable &= ~(1 << chan); -} - -/* emulation of the 15-bit shift register the -** NES uses to generate pseudo-random series -** for the white noise channel -*/ -#ifdef REALTIME_NOISE -INLINE int8 shift_register15(uint8 xor_tap) -{ - static int sreg = 0x4000; - int bit0, tap, bit14; - - bit0 = sreg & 1; - tap = (sreg & xor_tap) ? 1 : 0; - bit14 = (bit0 ^ tap); - sreg >>= 1; - sreg |= (bit14 << 14); - return (bit0 ^ 1); -} -#else /* !REALTIME_NOISE */ -static void shift_register15(int8 *buf, int count) -{ - static int sreg = 0x4000; - int bit0, bit1, bit6, bit14; - - if (count == APU_NOISE_93) - { - while (count--) - { - bit0 = sreg & 1; - bit6 = (sreg & 0x40) >> 6; - bit14 = (bit0 ^ bit6); - sreg >>= 1; - sreg |= (bit14 << 14); - *buf++ = bit0 ^ 1; - } - } - else /* 32K noise */ - { - while (count--) - { - bit0 = sreg & 1; - bit1 = (sreg & 2) >> 1; - bit14 = (bit0 ^ bit1); - sreg >>= 1; - sreg |= (bit14 << 14); - *buf++ = bit0 ^ 1; - } - } -} -#endif /* !REALTIME_NOISE */ - -/* RECTANGLE WAVE -** ============== -** reg0: 0-3=volume, 4=envelope, 5=hold, 6-7=duty cycle -** reg1: 0-2=sweep shifts, 3=sweep inc/dec, 4-6=sweep length, 7=sweep on -** reg2: 8 bits of freq -** reg3: 0-2=high freq, 7-4=vbl length counter -*/ -#ifdef APU_OVERSAMPLE - -#define APU_MAKE_RECTANGLE(ch) \ -static int32 apu_rectangle_##ch(void) \ -{ \ - int32 output, total; \ - int num_times; \ -\ - APU_VOLUME_DECAY(apu.rectangle[ch].output_vol); \ -\ - if (false == apu.rectangle[ch].enabled || 0 == apu.rectangle[ch].vbl_length) \ - return APU_RECTANGLE_OUTPUT(ch); \ -\ - /* vbl length counter */ \ - if (false == apu.rectangle[ch].holdnote) \ - apu.rectangle[ch].vbl_length--; \ -\ - /* envelope decay at a rate of (env_delay + 1) / 240 secs */ \ - apu.rectangle[ch].env_phase -= 4; /* 240/60 */ \ - while (apu.rectangle[ch].env_phase < 0) \ - { \ - apu.rectangle[ch].env_phase += apu.rectangle[ch].env_delay; \ -\ - if (apu.rectangle[ch].holdnote) \ - apu.rectangle[ch].env_vol = (apu.rectangle[ch].env_vol + 1) & 0x0F; \ - else if (apu.rectangle[ch].env_vol < 0x0F) \ - apu.rectangle[ch].env_vol++; \ - } \ -\ - /* TODO: find true relation of freq_limit to register values */ \ - if (apu.rectangle[ch].freq < 8 \ - || (false == apu.rectangle[ch].sweep_inc \ - && apu.rectangle[ch].freq > apu.rectangle[ch].freq_limit)) \ - return APU_RECTANGLE_OUTPUT(ch); \ -\ - /* frequency sweeping at a rate of (sweep_delay + 1) / 120 secs */ \ - if (apu.rectangle[ch].sweep_on && apu.rectangle[ch].sweep_shifts) \ - { \ - apu.rectangle[ch].sweep_phase -= 2; /* 120/60 */ \ - while (apu.rectangle[ch].sweep_phase < 0) \ - { \ - apu.rectangle[ch].sweep_phase += apu.rectangle[ch].sweep_delay; \ -\ - if (apu.rectangle[ch].sweep_inc) /* ramp up */ \ - { \ - if (0 == ch) \ - apu.rectangle[ch].freq += ~(apu.rectangle[ch].freq >> apu.rectangle[ch].sweep_shifts); \ - else \ - apu.rectangle[ch].freq -= (apu.rectangle[ch].freq >> apu.rectangle[ch].sweep_shifts); \ - } \ - else /* ramp down */ \ - { \ - apu.rectangle[ch].freq += (apu.rectangle[ch].freq >> apu.rectangle[ch].sweep_shifts); \ - } \ - } \ - } \ -\ - apu.rectangle[ch].accum -= apu.cycle_rate; \ - if (apu.rectangle[ch].accum >= 0) \ - return APU_RECTANGLE_OUTPUT(ch); \ -\ - if (apu.rectangle[ch].fixed_envelope) \ - output = apu.rectangle[ch].volume << 8; /* fixed volume */ \ - else \ - output = (apu.rectangle[ch].env_vol ^ 0x0F) << 8; \ -\ - num_times = total = 0; \ -\ - while (apu.rectangle[ch].accum < 0) \ - { \ - apu.rectangle[ch].accum += apu.rectangle[ch].freq + 1; \ - apu.rectangle[ch].adder = (apu.rectangle[ch].adder + 1) & 0x0F; \ -\ - if (apu.rectangle[ch].adder < apu.rectangle[ch].duty_flip) \ - total += output; \ - else \ - total -= output; \ -\ - num_times++; \ - } \ -\ - apu.rectangle[ch].output_vol = total / num_times; \ - return APU_RECTANGLE_OUTPUT(ch); \ -} - -#else /* !APU_OVERSAMPLE */ -#define APU_MAKE_RECTANGLE(ch) \ -static int32 apu_rectangle_##ch(void) \ -{ \ - int32 output; \ -\ - APU_VOLUME_DECAY(apu.rectangle[ch].output_vol); \ -\ - if (false == apu.rectangle[ch].enabled || 0 == apu.rectangle[ch].vbl_length) \ - return APU_RECTANGLE_OUTPUT(ch); \ -\ - /* vbl length counter */ \ - if (false == apu.rectangle[ch].holdnote) \ - apu.rectangle[ch].vbl_length--; \ -\ - /* envelope decay at a rate of (env_delay + 1) / 240 secs */ \ - apu.rectangle[ch].env_phase -= 4; /* 240/60 */ \ - while (apu.rectangle[ch].env_phase < 0) \ - { \ - apu.rectangle[ch].env_phase += apu.rectangle[ch].env_delay; \ -\ - if (apu.rectangle[ch].holdnote) \ - apu.rectangle[ch].env_vol = (apu.rectangle[ch].env_vol + 1) & 0x0F; \ - else if (apu.rectangle[ch].env_vol < 0x0F) \ - apu.rectangle[ch].env_vol++; \ - } \ -\ - /* TODO: find true relation of freq_limit to register values */ \ - if (apu.rectangle[ch].freq < 8 || (false == apu.rectangle[ch].sweep_inc && apu.rectangle[ch].freq > apu.rectangle[ch].freq_limit)) \ - return APU_RECTANGLE_OUTPUT(ch); \ -\ - /* frequency sweeping at a rate of (sweep_delay + 1) / 120 secs */ \ - if (apu.rectangle[ch].sweep_on && apu.rectangle[ch].sweep_shifts) \ - { \ - apu.rectangle[ch].sweep_phase -= 2; /* 120/60 */ \ - while (apu.rectangle[ch].sweep_phase < 0) \ - { \ - apu.rectangle[ch].sweep_phase += apu.rectangle[ch].sweep_delay; \ -\ - if (apu.rectangle[ch].sweep_inc) /* ramp up */ \ - { \ - if (0 == ch) \ - apu.rectangle[ch].freq += ~(apu.rectangle[ch].freq >> apu.rectangle[ch].sweep_shifts); \ - else \ - apu.rectangle[ch].freq -= (apu.rectangle[ch].freq >> apu.rectangle[ch].sweep_shifts); \ - } \ - else /* ramp down */ \ - { \ - apu.rectangle[ch].freq += (apu.rectangle[ch].freq >> apu.rectangle[ch].sweep_shifts); \ - } \ - } \ - } \ -\ - apu.rectangle[ch].accum -= apu.cycle_rate; \ - if (apu.rectangle[ch].accum >= 0) \ - return APU_RECTANGLE_OUTPUT(ch); \ -\ - while (apu.rectangle[ch].accum < 0) \ - { \ - apu.rectangle[ch].accum += (apu.rectangle[ch].freq + 1); \ - apu.rectangle[ch].adder = (apu.rectangle[ch].adder + 1) & 0x0F; \ - } \ -\ - if (apu.rectangle[ch].fixed_envelope) \ - output = apu.rectangle[ch].volume << 8; /* fixed volume */ \ - else \ - output = (apu.rectangle[ch].env_vol ^ 0x0F) << 8; \ -\ - if (0 == apu.rectangle[ch].adder) \ - apu.rectangle[ch].output_vol = output; \ - else if (apu.rectangle[ch].adder == apu.rectangle[ch].duty_flip) \ - apu.rectangle[ch].output_vol = -output; \ -\ - return APU_RECTANGLE_OUTPUT(ch); \ -} - -#endif /* !APU_OVERSAMPLE */ - -/* generate the functions */ -APU_MAKE_RECTANGLE(0) -APU_MAKE_RECTANGLE(1) - - -/* TRIANGLE WAVE -** ============= -** reg0: 7=holdnote, 6-0=linear length counter -** reg2: low 8 bits of frequency -** reg3: 7-3=length counter, 2-0=high 3 bits of frequency -*/ -static int32 apu_triangle(void) -{ - APU_VOLUME_DECAY(apu.triangle.output_vol); - - if (false == apu.triangle.enabled || 0 == apu.triangle.vbl_length) - return APU_TRIANGLE_OUTPUT; - - if (apu.triangle.counter_started) - { - if (apu.triangle.linear_length > 0) - apu.triangle.linear_length--; - if (apu.triangle.vbl_length && false == apu.triangle.holdnote) - apu.triangle.vbl_length--; - } - else if (false == apu.triangle.holdnote && apu.triangle.write_latency) - { - if (--apu.triangle.write_latency == 0) - apu.triangle.counter_started = true; - } - - if (0 == apu.triangle.linear_length || apu.triangle.freq < 4) /* inaudible */ - return APU_TRIANGLE_OUTPUT; - - apu.triangle.accum -= apu.cycle_rate; \ - while (apu.triangle.accum < 0) - { - apu.triangle.accum += apu.triangle.freq; - apu.triangle.adder = (apu.triangle.adder + 1) & 0x1F; - - if (apu.triangle.adder & 0x10) - apu.triangle.output_vol -= (2 << 8); - else - apu.triangle.output_vol += (2 << 8); - } - - return APU_TRIANGLE_OUTPUT; -} - - -/* WHITE NOISE CHANNEL -** =================== -** reg0: 0-3=volume, 4=envelope, 5=hold -** reg2: 7=small(93 byte) sample,3-0=freq lookup -** reg3: 7-4=vbl length counter -*/ -/* TODO: AAAAAAAAAAAAAAAAAAAAAAAA! #ifdef MADNESS! */ -static int32 apu_noise(void) -{ - int32 outvol; - -#if defined(APU_OVERSAMPLE) && defined(REALTIME_NOISE) -#else /* !(APU_OVERSAMPLE && REALTIME_NOISE) */ - int32 noise_bit; -#endif /* !(APU_OVERSAMPLE && REALTIME_NOISE) */ -#ifdef APU_OVERSAMPLE - int num_times; - int32 total; -#endif /* APU_OVERSAMPLE */ - - APU_VOLUME_DECAY(apu.noise.output_vol); - - if (false == apu.noise.enabled || 0 == apu.noise.vbl_length) - return APU_NOISE_OUTPUT; - - /* vbl length counter */ - if (false == apu.noise.holdnote) - apu.noise.vbl_length--; - - /* envelope decay at a rate of (env_delay + 1) / 240 secs */ - apu.noise.env_phase -= 4; /* 240/60 */ - while (apu.noise.env_phase < 0) - { - apu.noise.env_phase += apu.noise.env_delay; - - if (apu.noise.holdnote) - apu.noise.env_vol = (apu.noise.env_vol + 1) & 0x0F; - else if (apu.noise.env_vol < 0x0F) - apu.noise.env_vol++; - } - - apu.noise.accum -= apu.cycle_rate; - if (apu.noise.accum >= 0) - return APU_NOISE_OUTPUT; - -#ifdef APU_OVERSAMPLE - if (apu.noise.fixed_envelope) - outvol = apu.noise.volume << 8; /* fixed volume */ - else - outvol = (apu.noise.env_vol ^ 0x0F) << 8; - - num_times = total = 0; -#endif /* APU_OVERSAMPLE */ - - while (apu.noise.accum < 0) - { - apu.noise.accum += apu.noise.freq; - -#ifdef REALTIME_NOISE - -#ifdef APU_OVERSAMPLE - if (shift_register15(apu.noise.xor_tap)) - total += outvol; - else - total -= outvol; - - num_times++; -#else /* !APU_OVERSAMPLE */ - noise_bit = shift_register15(apu.noise.xor_tap); -#endif /* !APU_OVERSAMPLE */ - -#else /* !REALTIME_NOISE */ - apu.noise.cur_pos++; - - if (apu.noise.short_sample) - { - if (APU_NOISE_93 == apu.noise.cur_pos) - apu.noise.cur_pos = 0; - } - else - { - if (APU_NOISE_32K == apu.noise.cur_pos) - apu.noise.cur_pos = 0; - } - -#ifdef APU_OVERSAMPLE - if (apu.noise.short_sample) - noise_bit = noise_short_lut[apu.noise.cur_pos]; - else - noise_bit = noise_long_lut[apu.noise.cur_pos]; - - if (noise_bit) - total += outvol; - else - total -= outvol; - - num_times++; -#endif /* APU_OVERSAMPLE */ -#endif /* !REALTIME_NOISE */ - } - -#ifdef APU_OVERSAMPLE - apu.noise.output_vol = total / num_times; -#else /* !APU_OVERSAMPLE */ - if (apu.noise.fixed_envelope) - outvol = apu.noise.volume << 8; /* fixed volume */ - else - outvol = (apu.noise.env_vol ^ 0x0F) << 8; - -#ifndef REALTIME_NOISE - if (apu.noise.short_sample) - noise_bit = noise_short_lut[apu.noise.cur_pos]; - else - noise_bit = noise_long_lut[apu.noise.cur_pos]; -#endif /* !REALTIME_NOISE */ - - if (noise_bit) - apu.noise.output_vol = outvol; - else - apu.noise.output_vol = -outvol; -#endif /* !APU_OVERSAMPLE */ - - return APU_NOISE_OUTPUT; -} - - -INLINE void apu_dmcreload(void) -{ - apu.dmc.address = apu.dmc.cached_addr; - apu.dmc.dma_length = apu.dmc.cached_dmalength; - apu.dmc.irq_occurred = false; -} - -/* DELTA MODULATION CHANNEL -** ========================= -** reg0: 7=irq gen, 6=looping, 3-0=pointer to clock table -** reg1: output dc level, 6 bits unsigned -** reg2: 8 bits of 64-byte aligned address offset : $C000 + (value * 64) -** reg3: length, (value * 16) + 1 -*/ -static int32 apu_dmc(void) -{ - int delta_bit; - - APU_VOLUME_DECAY(apu.dmc.output_vol); - - /* only process when channel is alive */ - if (apu.dmc.dma_length) - { - apu.dmc.accum -= apu.cycle_rate; - - while (apu.dmc.accum < 0) - { - apu.dmc.accum += apu.dmc.freq; - - delta_bit = (apu.dmc.dma_length & 7) ^ 7; - - if (7 == delta_bit) - { - apu.dmc.cur_byte = nes6502_getbyte(apu.dmc.address); - - /* steal a cycle from CPU*/ - nes6502_burn(1); - - /* prevent wraparound */ - if (0xFFFF == apu.dmc.address) - apu.dmc.address = 0x8000; - else - apu.dmc.address++; - } - - if (--apu.dmc.dma_length == 0) - { - /* if loop bit set, we're cool to retrigger sample */ - if (apu.dmc.looping) - { - apu_dmcreload(); - } - else - { - /* check to see if we should generate an irq */ - if (apu.dmc.irq_gen) - { - apu.dmc.irq_occurred = true; - if (apu.irq_callback) - apu.irq_callback(); - } - - /* bodge for timestamp queue */ - apu.dmc.enabled = false; - break; - } - } - - /* positive delta */ - if (apu.dmc.cur_byte & (1 << delta_bit)) - { - if (apu.dmc.regs[1] < 0x7D) - { - apu.dmc.regs[1] += 2; - apu.dmc.output_vol += (2 << 8); - } - } - /* negative delta */ - else - { - if (apu.dmc.regs[1] > 1) - { - apu.dmc.regs[1] -= 2; - apu.dmc.output_vol -= (2 << 8); - } - } - } - } - - return APU_DMC_OUTPUT; -} - - -void apu_write(uint32 address, uint8 value) -{ - int chan; - - switch (address) - { - /* rectangles */ - case APU_WRA0: - case APU_WRB0: - chan = (address & 4) >> 2; - apu.rectangle[chan].regs[0] = value; - apu.rectangle[chan].volume = value & 0x0F; - apu.rectangle[chan].env_delay = decay_lut[value & 0x0F]; - apu.rectangle[chan].holdnote = (value & 0x20) ? true : false; - apu.rectangle[chan].fixed_envelope = (value & 0x10) ? true : false; - apu.rectangle[chan].duty_flip = duty_flip[value >> 6]; - break; - - case APU_WRA1: - case APU_WRB1: - chan = (address & 4) >> 2; - apu.rectangle[chan].regs[1] = value; - apu.rectangle[chan].sweep_on = (value & 0x80) ? true : false; - apu.rectangle[chan].sweep_shifts = value & 7; - apu.rectangle[chan].sweep_delay = decay_lut[(value >> 4) & 7]; - apu.rectangle[chan].sweep_inc = (value & 0x08) ? true : false; - apu.rectangle[chan].freq_limit = freq_limit[value & 7]; - break; - - case APU_WRA2: - case APU_WRB2: - chan = (address & 4) >> 2; - apu.rectangle[chan].regs[2] = value; - apu.rectangle[chan].freq = (apu.rectangle[chan].freq & ~0xFF) | value; - break; - - case APU_WRA3: - case APU_WRB3: - chan = (address & 4) >> 2; - apu.rectangle[chan].regs[3] = value; - apu.rectangle[chan].vbl_length = vbl_lut[value >> 3]; - apu.rectangle[chan].env_vol = 0; - apu.rectangle[chan].freq = ((value & 7) << 8) | (apu.rectangle[chan].freq & 0xFF); - apu.rectangle[chan].adder = 0; - break; - - /* triangle */ - case APU_WRC0: - apu.triangle.regs[0] = value; - apu.triangle.holdnote = (value & 0x80) ? true : false; - - if (false == apu.triangle.counter_started && apu.triangle.vbl_length) - apu.triangle.linear_length = trilength_lut[value & 0x7F]; - - break; - - case APU_WRC2: - apu.triangle.regs[1] = value; - apu.triangle.freq = (((apu.triangle.regs[2] & 7) << 8) + value) + 1; - break; - - case APU_WRC3: - - apu.triangle.regs[2] = value; - - /* this is somewhat of a hack. there appears to be some latency on - ** the Real Thing between when trireg0 is written to and when the - ** linear length counter actually begins its countdown. we want to - ** prevent the case where the program writes to the freq regs first, - ** then to reg 0, and the counter accidentally starts running because - ** of the sound queue's timestamp processing. - ** - ** set latency to a couple hundred cycles -- should be plenty of time - ** for the 6502 code to do a couple of table dereferences and load up - ** the other triregs - */ - apu.triangle.write_latency = (int) (228 / apu.cycle_rate); - apu.triangle.freq = (((value & 7) << 8) + apu.triangle.regs[1]) + 1; - apu.triangle.vbl_length = vbl_lut[value >> 3]; - apu.triangle.counter_started = false; - apu.triangle.linear_length = trilength_lut[apu.triangle.regs[0] & 0x7F]; - break; - - /* noise */ - case APU_WRD0: - apu.noise.regs[0] = value; - apu.noise.env_delay = decay_lut[value & 0x0F]; - apu.noise.holdnote = (value & 0x20) ? true : false; - apu.noise.fixed_envelope = (value & 0x10) ? true : false; - apu.noise.volume = value & 0x0F; - break; - - case APU_WRD2: - apu.noise.regs[1] = value; - apu.noise.freq = noise_freq[value & 0x0F]; - -#ifdef REALTIME_NOISE - apu.noise.xor_tap = (value & 0x80) ? 0x40: 0x02; -#else /* !REALTIME_NOISE */ - /* detect transition from long->short sample */ - if ((value & 0x80) && false == apu.noise.short_sample) - { - /* recalculate short noise buffer */ - shift_register15(noise_short_lut, APU_NOISE_93); - apu.noise.cur_pos = 0; - } - apu.noise.short_sample = (value & 0x80) ? true : false; -#endif /* !REALTIME_NOISE */ - break; - - case APU_WRD3: - apu.noise.regs[2] = value; - apu.noise.vbl_length = vbl_lut[value >> 3]; - apu.noise.env_vol = 0; /* reset envelope */ - break; - - /* DMC */ - case APU_WRE0: - apu.dmc.regs[0] = value; - apu.dmc.freq = dmc_clocks[value & 0x0F]; - apu.dmc.looping = (value & 0x40) ? true : false; - - if (value & 0x80) - { - apu.dmc.irq_gen = true; - } - else - { - apu.dmc.irq_gen = false; - apu.dmc.irq_occurred = false; - } - break; - - case APU_WRE1: /* 7-bit DAC */ - /* add the _delta_ between written value and - ** current output level of the volume reg - */ - value &= 0x7F; /* bit 7 ignored */ - apu.dmc.output_vol += ((value - apu.dmc.regs[1]) << 8); - apu.dmc.regs[1] = value; - break; - - case APU_WRE2: - apu.dmc.regs[2] = value; - apu.dmc.cached_addr = 0xC000 + (uint16) (value << 6); - break; - - case APU_WRE3: - apu.dmc.regs[3] = value; - apu.dmc.cached_dmalength = ((value << 4) + 1) << 3; - break; - - case APU_SMASK: - /* bodge for timestamp queue */ - apu.dmc.enabled = (value & 0x10) ? true : false; - apu.enable_reg = value; - - for (chan = 0; chan < 2; chan++) - { - if (value & (1 << chan)) - { - apu.rectangle[chan].enabled = true; - } - else - { - apu.rectangle[chan].enabled = false; - apu.rectangle[chan].vbl_length = 0; - } - } - - if (value & 0x04) - { - apu.triangle.enabled = true; - } - else - { - apu.triangle.enabled = false; - apu.triangle.vbl_length = 0; - apu.triangle.linear_length = 0; - apu.triangle.counter_started = false; - apu.triangle.write_latency = 0; - } - - if (value & 0x08) - { - apu.noise.enabled = true; - } - else - { - apu.noise.enabled = false; - apu.noise.vbl_length = 0; - } - - if (value & 0x10) - { - if (0 == apu.dmc.dma_length) - apu_dmcreload(); - } - else - { - apu.dmc.dma_length = 0; - } - - apu.dmc.irq_occurred = false; - break; - - /* unused, but they get hit in some mem-clear loops */ - case 0x4009: - case 0x400D: - break; - - default: - break; - } -} - -/* Read from $4000-$4017 */ -uint8 apu_read(uint32 address) -{ - uint8 value; - - switch (address) - { - case APU_SMASK: - value = 0; - /* Return 1 in 0-5 bit pos if a channel is playing */ - if (apu.rectangle[0].enabled && apu.rectangle[0].vbl_length) - value |= 0x01; - if (apu.rectangle[1].enabled && apu.rectangle[1].vbl_length) - value |= 0x02; - if (apu.triangle.enabled && apu.triangle.vbl_length) - value |= 0x04; - if (apu.noise.enabled && apu.noise.vbl_length) - value |= 0x08; - - /* bodge for timestamp queue */ - if (apu.dmc.enabled) - value |= 0x10; - - if (apu.dmc.irq_occurred) - value |= 0x80; - - if (apu.irqclear_callback) - value |= apu.irqclear_callback(); - - break; - - default: - value = (address >> 8); /* heavy capacitance on data bus */ - break; - } - - return value; -} - -#define CLIP_OUTPUT16(out) \ -{ \ - /*out <<= 1;*/ \ - if (out > 0x7FFF) \ - out = 0x7FFF; \ - else if (out < -0x8000) \ - out = -0x8000; \ -} - -void apu_process(void *buffer, int num_samples) -{ - static int32 prev_sample = 0; - - int16 *buf16; - uint8 *buf8; - - if (NULL != buffer) - { - /* bleh */ - apu.buffer = buffer; - - buf16 = (int16 *) buffer; - buf8 = (uint8 *) buffer; - - while (num_samples--) - { - int32 next_sample, accum = 0; - - if (apu.mix_enable & 0x01) - accum += apu_rectangle_0(); - if (apu.mix_enable & 0x02) - accum += apu_rectangle_1(); - if (apu.mix_enable & 0x04) - accum += apu_triangle(); - if (apu.mix_enable & 0x08) - accum += apu_noise(); - if (apu.mix_enable & 0x10) - accum += apu_dmc(); - if (apu.ext && (apu.mix_enable & 0x20)) - accum += apu.ext->process(); - - /* do any filtering */ - if (APU_FILTER_NONE != apu.filter_type) - { - next_sample = accum; - - if (APU_FILTER_LOWPASS == apu.filter_type) - { - accum += prev_sample; - accum >>= 1; - } - else - accum = (accum + accum + accum + prev_sample) >> 2; - - prev_sample = next_sample; - } - - /* do clipping */ - CLIP_OUTPUT16(accum); - - /* signed 16-bit output, unsigned 8-bit */ - if (16 == apu.sample_bits) - *buf16++ = (int16) accum; - else - *buf8++ = (accum >> 8) ^ 0x80; - } - } -} - -/* set the filter type */ -void apu_setfilter(int filter_type) -{ - apu.filter_type = filter_type; -} - -void apu_reset(void) -{ - uint32 address; - - /* initialize all channel members */ - for (address = 0x4000; address <= 0x4013; address++) - apu_write(address, 0); - - apu_write(0x4015, 0); - - if (apu.ext && NULL != apu.ext->reset) - apu.ext->reset(); -} - -void apu_build_luts(int num_samples) -{ - int i; - - /* lut used for enveloping and frequency sweeps */ - for (i = 0; i < 16; i++) - decay_lut[i] = num_samples * (i + 1); - - /* used for note length, based on vblanks and size of audio buffer */ - for (i = 0; i < 32; i++) - vbl_lut[i] = vbl_length[i] * num_samples; - - /* triangle wave channel's linear length table */ - for (i = 0; i < 128; i++) - trilength_lut[i] = (int) (0.25 * i * num_samples); - -#ifndef REALTIME_NOISE - /* generate noise samples */ - shift_register15(noise_long_lut, APU_NOISE_32K); - shift_register15(noise_short_lut, APU_NOISE_93); -#endif /* !REALTIME_NOISE */ -} - -void apu_setparams(double base_freq, int sample_rate, int refresh_rate, int sample_bits) -{ - apu.sample_rate = sample_rate; - apu.refresh_rate = refresh_rate; - apu.sample_bits = sample_bits; - apu.num_samples = sample_rate / refresh_rate; - if (0 == base_freq) - apu.base_freq = APU_BASEFREQ; - else - apu.base_freq = base_freq; - apu.cycle_rate = (float) (apu.base_freq / sample_rate); - - /* build various lookup tables for apu */ - apu_build_luts(apu.num_samples); - - apu_reset(); -} - -/* Initializes emulated sound hardware, creates waveforms/voices */ -apu_t *apu_create(double base_freq, int sample_rate, int refresh_rate, int sample_bits) -{ - apu_t *temp_apu; - int channel; - - temp_apu = malloc(sizeof(apu_t)); - if (NULL == temp_apu) - return NULL; - - memset(temp_apu, 0, sizeof(apu_t)); - - /* set the update routine */ - temp_apu->process = apu_process; - temp_apu->ext = NULL; - - /* clear the callbacks */ - temp_apu->irq_callback = NULL; - temp_apu->irqclear_callback = NULL; - - apu_setcontext(temp_apu); - - apu_setparams(base_freq, sample_rate, refresh_rate, sample_bits); - - for (channel = 0; channel < 6; channel++) - apu_setchan(channel, true); - - apu_setfilter(APU_FILTER_WEIGHTED); - - apu_getcontext(temp_apu); - - return temp_apu; -} - -void apu_destroy(apu_t **src_apu) -{ - if (*src_apu) - { - if ((*src_apu)->ext && NULL != (*src_apu)->ext->shutdown) - (*src_apu)->ext->shutdown(); - free(*src_apu); - *src_apu = NULL; - } -} - -void apu_setext(apu_t *src_apu, apuext_t *ext) -{ - ASSERT(src_apu); - - src_apu->ext = ext; - - /* initialize it */ - if (src_apu->ext && NULL != src_apu->ext->init) - src_apu->ext->init(); -} - -/* -** $Log: nes_apu.c,v $ -** Revision 1.2 2001/04/27 14:37:11 neil -** wheeee -** -** Revision 1.1 2001/04/27 12:54:40 neil -** blah -** -** Revision 1.1.1.1 2001/04/27 07:03:54 neil -** initial -** -** Revision 1.6 2000/12/08 02:36:14 matt -** bye bye apu queue (for now) -** -** Revision 1.5 2000/11/27 19:33:53 matt -** no special treatment for nsf -** -** Revision 1.4 2000/11/25 20:29:17 matt -** weighted filter is now default -** -** Revision 1.3 2000/11/21 13:28:19 matt -** take care to zero allocated mem -** -** Revision 1.2 2000/10/28 15:20:59 matt -** irq callbacks in nes_apu -** -** Revision 1.1 2000/10/24 12:19:59 matt -** changed directory structure -** -** Revision 1.44 2000/10/23 17:53:06 matt -** set ptr to NULL after freeing -** -** Revision 1.43 2000/10/17 11:56:42 matt -** selectable apu base frequency -** -** Revision 1.42 2000/10/13 12:16:01 matt -** macro-ized the stuff that should be removed -** -** Revision 1.41 2000/10/10 13:58:18 matt -** stroustrup squeezing his way in the door -** -** Revision 1.40 2000/10/03 11:56:20 matt -** better support for optional sound ext routines -** -** Revision 1.39 2000/09/27 12:26:03 matt -** changed sound accumulators back to floats -** -** Revision 1.38 2000/09/18 02:12:55 matt -** more optimizations -** -** Revision 1.37 2000/09/15 13:38:40 matt -** changes for optimized apu core -** -** Revision 1.36 2000/09/15 04:58:07 matt -** simplifying and optimizing APU core -** -** Revision 1.35 2000/09/07 21:57:14 matt -** api change -** -** Revision 1.34 2000/08/16 05:01:01 matt -** small buglet fixed -** -** Revision 1.33 2000/08/15 12:38:04 matt -** removed debug output -** -** Revision 1.32 2000/08/15 12:36:51 matt -** calling apu_process with buffer=NULL causes silent emulation of APU -** -** Revision 1.31 2000/08/11 02:27:21 matt -** general cleanups, plus apu_setparams routine -** -** Revision 1.30 2000/07/31 04:32:52 matt -** fragsize problem fixed, perhaps -** -** Revision 1.29 2000/07/30 04:32:59 matt -** no more apu_getcyclerate hack -** -** Revision 1.28 2000/07/28 03:15:46 matt -** accuracy changes for rectangle frequency sweeps -** -** Revision 1.27 2000/07/27 02:49:50 matt -** eccentricity in sweeping hardware now emulated correctly -** -** Revision 1.26 2000/07/25 02:25:14 matt -** safer apu_destroy -** -** Revision 1.25 2000/07/23 15:10:54 matt -** hacks for win32 -** -** Revision 1.24 2000/07/17 01:52:31 matt -** made sure last line of all source files is a newline -** -** Revision 1.23 2000/07/10 19:24:55 matt -** irqs are not supported in NSF playing mode -** -** Revision 1.22 2000/07/10 13:54:32 matt -** using generic nes_irq() now -** -** Revision 1.21 2000/07/10 05:29:34 matt -** moved joypad/oam dma from apu to ppu -** -** Revision 1.20 2000/07/09 03:49:31 matt -** apu irqs now draw an irq line (bleh) -** -** Revision 1.19 2000/07/04 04:53:26 matt -** minor changes, sound amplification -** -** Revision 1.18 2000/07/03 02:18:53 matt -** much better external module exporting -** -** Revision 1.17 2000/06/26 11:01:55 matt -** made triangle a tad quieter -** -** Revision 1.16 2000/06/26 05:10:33 matt -** fixed cycle rate generation accuracy -** -** Revision 1.15 2000/06/26 05:00:37 matt -** cleanups -** -** Revision 1.14 2000/06/23 11:06:24 matt -** more faithful mixing of channels -** -** Revision 1.13 2000/06/23 03:29:27 matt -** cleaned up external sound inteface -** -** Revision 1.12 2000/06/20 00:08:39 matt -** bugfix to rectangle wave -** -** Revision 1.11 2000/06/13 13:48:58 matt -** fixed triangle write latency for fixed point apu cycle rate -** -** Revision 1.10 2000/06/12 01:14:36 matt -** minor change to clipping extents -** -** Revision 1.9 2000/06/09 20:00:56 matt -** fixed noise hiccup in NSF player mode -** -** Revision 1.8 2000/06/09 16:49:02 matt -** removed all floating point from sound generation -** -** Revision 1.7 2000/06/09 15:12:28 matt -** initial revision -** -*/ diff --git a/MCUME_pico/piconofrendo/nes_apu.h b/MCUME_pico/piconofrendo/nes_apu.h deleted file mode 100755 index 523c969..0000000 --- a/MCUME_pico/piconofrendo/nes_apu.h +++ /dev/null @@ -1,349 +0,0 @@ -/* -** Nofrendo (c) 1998-2000 Matthew Conte (matt@conte.com) -** -** -** This program is free software; you can redistribute it and/or -** modify it under the terms of version 2 of the GNU Library General -** Public License as published by the Free Software Foundation. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** Library General Public License for more details. To obtain a -** copy of the GNU Library General Public License, write to the Free -** Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -** -** Any permitted reproduction of these routines, in whole or in part, -** must bear this legend. -** -** -** nes_apu.h -** -** NES APU emulation header file -** $Id: nes_apu.h,v 1.1 2001/04/27 12:54:40 neil Exp $ -*/ - -#ifndef _NES_APU_H_ -#define _NES_APU_H_ - - -/* define this for realtime generated noise */ -#define REALTIME_NOISE - -#define APU_WRA0 0x4000 -#define APU_WRA1 0x4001 -#define APU_WRA2 0x4002 -#define APU_WRA3 0x4003 -#define APU_WRB0 0x4004 -#define APU_WRB1 0x4005 -#define APU_WRB2 0x4006 -#define APU_WRB3 0x4007 -#define APU_WRC0 0x4008 -#define APU_WRC2 0x400A -#define APU_WRC3 0x400B -#define APU_WRD0 0x400C -#define APU_WRD2 0x400E -#define APU_WRD3 0x400F -#define APU_WRE0 0x4010 -#define APU_WRE1 0x4011 -#define APU_WRE2 0x4012 -#define APU_WRE3 0x4013 - -#define APU_SMASK 0x4015 - -/* length of generated noise */ -#define APU_NOISE_32K 0x7FFF -#define APU_NOISE_93 93 - -#define APU_BASEFREQ 1789772.7272727272727272 - - -/* channel structures */ -/* As much data as possible is precalculated, -** to keep the sample processing as lean as possible -*/ - -typedef struct rectangle_s -{ - uint8 regs[4]; - - bool enabled; - - float accum; - int32 freq; - int32 output_vol; - bool fixed_envelope; - bool holdnote; - uint8 volume; - - int32 sweep_phase; - int32 sweep_delay; - bool sweep_on; - uint8 sweep_shifts; - uint8 sweep_length; - bool sweep_inc; - - /* this may not be necessary in the future */ - int32 freq_limit; - int32 env_phase; - int32 env_delay; - uint8 env_vol; - - int vbl_length; - uint8 adder; - int duty_flip; -} rectangle_t; - -typedef struct triangle_s -{ - uint8 regs[3]; - - bool enabled; - - float accum; - int32 freq; - int32 output_vol; - - uint8 adder; - - bool holdnote; - bool counter_started; - /* quasi-hack */ - int write_latency; - - int vbl_length; - int linear_length; -} triangle_t; - - -typedef struct noise_s -{ - uint8 regs[3]; - - bool enabled; - - float accum; - int32 freq; - int32 output_vol; - - int32 env_phase; - int32 env_delay; - uint8 env_vol; - bool fixed_envelope; - bool holdnote; - - uint8 volume; - - int vbl_length; - -#ifdef REALTIME_NOISE - uint8 xor_tap; -#else - bool short_sample; - int cur_pos; -#endif /* REALTIME_NOISE */ -} noise_t; - -typedef struct dmc_s -{ - uint8 regs[4]; - - /* bodge for timestamp queue */ - bool enabled; - - float accum; - int32 freq; - int32 output_vol; - - uint32 address; - uint32 cached_addr; - int dma_length; - int cached_dmalength; - uint8 cur_byte; - - bool looping; - bool irq_gen; - bool irq_occurred; - -} dmc_t; - -enum -{ - APU_FILTER_NONE, - APU_FILTER_LOWPASS, - APU_FILTER_WEIGHTED -}; - -typedef struct -{ - uint32 min_range, max_range; - uint8 (*read_func)(uint32 address); -} apu_memread; - -typedef struct -{ - uint32 min_range, max_range; - void (*write_func)(uint32 address, uint8 value); -} apu_memwrite; - -/* external sound chip stuff */ -typedef struct apuext_s -{ - int (*init)(void); - void (*shutdown)(void); - void (*reset)(void); - int32 (*process)(void); - apu_memread *mem_read; - apu_memwrite *mem_write; -} apuext_t; - - -typedef struct apu_s -{ - rectangle_t rectangle[2]; - triangle_t triangle; - noise_t noise; - dmc_t dmc; - uint8 enable_reg; - - void *buffer; /* pointer to output buffer */ - int num_samples; - - uint8 mix_enable; - int filter_type; - - double base_freq; - float cycle_rate; - - int sample_rate; - int sample_bits; - int refresh_rate; - - void (*process)(void *buffer, int num_samples); - void (*irq_callback)(void); - uint8 (*irqclear_callback)(void); - - /* external sound chip */ - apuext_t *ext; -} apu_t; - - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/* Function prototypes */ -extern void apu_setcontext(apu_t *src_apu); -extern void apu_getcontext(apu_t *dest_apu); - -extern void apu_setparams(double base_freq, int sample_rate, int refresh_rate, int sample_bits); -extern apu_t *apu_create(double base_freq, int sample_rate, int refresh_rate, int sample_bits); -extern void apu_destroy(apu_t **apu); - -extern void apu_process(void *buffer, int num_samples); -extern void apu_reset(void); - -extern void apu_setext(apu_t *apu, apuext_t *ext); -extern void apu_setfilter(int filter_type); -extern void apu_setchan(int chan, bool enabled); - -extern uint8 apu_read(uint32 address); -extern void apu_write(uint32 address, uint8 value); - - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _NES_APU_H_ */ - -/* -** $Log: nes_apu.h,v $ -** Revision 1.1 2001/04/27 12:54:40 neil -** blah -** -** Revision 1.1.1.1 2001/04/27 07:03:54 neil -** initial -** -** Revision 1.3 2000/12/08 02:36:14 matt -** bye bye apu queue (for now) -** -** Revision 1.2 2000/10/28 15:20:59 matt -** irq callbacks in nes_apu -** -** Revision 1.1 2000/10/24 12:19:59 matt -** changed directory structure -** -** Revision 1.28 2000/10/17 11:56:42 matt -** selectable apu base frequency -** -** Revision 1.27 2000/10/10 13:58:18 matt -** stroustrup squeezing his way in the door -** -** Revision 1.26 2000/09/28 23:20:58 matt -** bye bye, fixed point -** -** Revision 1.25 2000/09/27 12:26:03 matt -** changed sound accumulators back to floats -** -** Revision 1.24 2000/09/18 02:12:55 matt -** more optimizations -** -** Revision 1.23 2000/09/15 13:38:40 matt -** changes for optimized apu core -** -** Revision 1.22 2000/09/15 04:58:07 matt -** simplifying and optimizing APU core -** -** Revision 1.21 2000/08/11 02:27:21 matt -** general cleanups, plus apu_setparams routine -** -** Revision 1.20 2000/07/30 04:32:59 matt -** no more apu_getcyclerate hack -** -** Revision 1.19 2000/07/27 02:49:50 matt -** eccentricity in sweeping hardware now emulated correctly -** -** Revision 1.18 2000/07/25 02:25:15 matt -** safer apu_destroy -** -** Revision 1.17 2000/07/23 15:10:54 matt -** hacks for win32 -** -** Revision 1.16 2000/07/23 00:48:15 neil -** Win32 SDL -** -** Revision 1.15 2000/07/17 01:52:31 matt -** made sure last line of all source files is a newline -** -** Revision 1.14 2000/07/11 02:39:26 matt -** added setcontext() routine -** -** Revision 1.13 2000/07/10 05:29:34 matt -** moved joypad/oam dma from apu to ppu -** -** Revision 1.12 2000/07/04 04:54:48 matt -** minor changes that helped with MAME -** -** Revision 1.11 2000/07/03 02:18:53 matt -** much better external module exporting -** -** Revision 1.10 2000/06/26 05:00:37 matt -** cleanups -** -** Revision 1.9 2000/06/23 03:29:28 matt -** cleaned up external sound inteface -** -** Revision 1.8 2000/06/20 04:06:16 matt -** migrated external sound definition to apu module -** -** Revision 1.7 2000/06/20 00:07:35 matt -** added convenience members to apu_t struct -** -** Revision 1.6 2000/06/09 16:49:02 matt -** removed all floating point from sound generation -** -** Revision 1.5 2000/06/09 15:12:28 matt -** initial revision -** -*/ diff --git a/MCUME_pico/piconofrendo/nes_emu.c b/MCUME_pico/piconofrendo/nes_emu.c deleted file mode 100644 index 3acef0f..0000000 --- a/MCUME_pico/piconofrendo/nes_emu.c +++ /dev/null @@ -1,289 +0,0 @@ - -#include "emuapi.h" - -#include -#include -#include - -//Nes stuff wants to define this as well... -#undef false -#undef true -#undef bool - -#include "noftypes.h" - - -#include "nes.h" -#include "nofrendo.h" -#include "osd.h" -#include "nesinput.h" -#include "event.h" -#include "nofconfig.h" - -#define DEFAULT_WIDTH 256 -#define DEFAULT_HEIGHT NES_VISIBLE_HEIGHT - - -char configfilename[]="na"; -char romname[64]; - -/* This is os-specific part of main() */ -int osd_main(int argc, char *argv[]) -{ - config.filename = configfilename; - - return main_loop(romname, system_autodetect); -} - -/* File system interface */ -void osd_fullname(char *fullname, const char *shortname) -{ - strncpy(fullname, shortname, 64); -} - -/* This gives filenames for storage of saves */ -char *osd_newextension(char *string, char *ext) -{ - return string; -} - -/* This gives filenames for storage of PCX snapshots */ -int osd_makesnapname(char *filename, int len) -{ - return -1; -} - -#if HAS_SND -static void (*audio_callback)(void *buffer, int length) = NULL; - -void SND_Process( void * stream, int len ) -{ - if (audio_callback != NULL) { - audio_callback(stream,len); - } -} -#endif - -void osd_setsound(void (*playfunc)(void *buffer, int length)) -{ - //Indicates we should call playfunc() to get more data. -#if HAS_SND - audio_callback = playfunc; -#endif -} - -static void osd_stopsound(void) -{ -#if HAS_SND - audio_callback = NULL; -#endif -} - - -static int osd_init_sound(void) -{ -#if HAS_SND - audio_callback = NULL; -#endif - - return 0; -} - -void osd_getsoundinfo(sndinfo_t *info) -{ - info->sample_rate = 22050; - info->bps = 16; -} - - -void osd_getinput(void) -{ - const int ev[16]={ - event_joypad1_select,0,0,event_joypad1_start,event_joypad1_up,event_joypad1_right,event_joypad1_down,event_joypad1_left, - 0,0,0,0,event_soft_reset,event_joypad1_a,event_joypad1_b,event_hard_reset - }; - - int j=emu_ReadKeys(); - int hk = emu_ReadI2CKeyboard(); - int b=0xffff; - - if ( (j & MASK_KEY_USER2) ) // B - b &= ~0x4000; - if ( (j & MASK_KEY_USER3) || (hk == 2) ) // SELECT - b &= ~0x0001; - if ( (j & MASK_KEY_USER1) || (hk == 3) ) // START - b &= ~0x0008; - if (j & MASK_JOY2_UP) - b &= ~0x0010; - if (j & MASK_JOY2_LEFT) - b &= ~0x0020; - if (j & MASK_JOY2_DOWN) - b &= ~0x0040; - if (j & MASK_JOY2_RIGHT) - b &= ~0x0080; - if (j & MASK_JOY2_BTN) // A - b &= ~0x2000; - - - static int oldb=0xffff; - - int chg=b^oldb; - int x; - oldb=b; - event_t evh; - for (x=0; x<16; x++) { - if (chg&1) { - evh=event_get(ev[x]); - if (evh) evh((b&1)?INP_STATE_BREAK:INP_STATE_MAKE); - } - chg>>=1; - b>>=1; - } -} - - -void osd_getmouse(int *x, int *y, int *button) -{ -} - -/* this is at the bottom, to eliminate warnings */ -void osd_shutdown() -{ -} - -int osd_init() -{ - return 0; -} - - -/* -** Video -*/ -static int init(int width, int height) -{ - return 0; -} - -static void shutdown(void) -{ -} - -static int set_mode(int width, int height) -{ - return 0; -} - -static bitmap_t *myBitmap=NULL; -static void set_palette(rgb_t *pal) -{ - int i; - for (i = 0; i < PALETTE_SIZE; i++) - { - emu_SetPaletteEntry(pal[i].r, pal[i].g, pal[i].b,i); - } - -} - -/* clear all frames to a particular color */ -static void clear(uint8 color) -{ -} - -/* acquire the directbuffer for writing */ -static char fb[1]; //dummy -static bitmap_t *lock_write(void) -{ - if (myBitmap == NULL) - myBitmap = bmp_createhw((uint8*)fb, DEFAULT_WIDTH, DEFAULT_HEIGHT, DEFAULT_WIDTH*2); - - return myBitmap; -} - -/* release the resource */ -static void free_write(int num_dirties, rect_t *dirty_rects) -{ - //bmp_destroy(&myBitmap); -} - - -static void custom_blit(bitmap_t *bmp, int num_dirties, rect_t *dirty_rects) { -} - -static viddriver_t sdlDriver = -{ - "Simple DirectMedia Layer", /* name */ - init, /* init */ - shutdown, /* shutdown */ - set_mode, /* set_mode */ - set_palette, /* set_palette */ - clear, /* clear */ - lock_write, /* lock_write */ - free_write, /* free_write */ - custom_blit, /* custom_blit */ - false /* invalidate flag */ -}; - -void osd_getvideoinfo(vidinfo_t *info) -{ - info->default_width = DEFAULT_WIDTH; - info->default_height = DEFAULT_HEIGHT; - info->driver = &sdlDriver; -} - -void osd_togglefullscreen(int code) -{ -} - -//Seemingly, this will be called only once. Should call func with a freq of frequency, -int osd_installtimer(int frequency, void *func, int funcsize, void *counter, int countersize) -{ - return 0; -} - -char* romdata=NULL; - -char *osd_getromdata() { - - return (char*)romdata; -} - -void emu_KeyboardOnDown(int keymodifer, int key) { -} - -void emu_KeyboardOnUp(int keymodifer, int key) { -} - -void nes_Init(void) -{ -#if HAS_SND - emu_sndInit(); -#endif - nofrendo_main(0, NULL); -} - -void nes_Step(void) -{ - nes_step(emu_FrameSkip()); - //delay(20); - emu_DrawVsync(); -} - -void nes_Start(char * filename) -{ - strcpy(romname,filename); - int romsize = emu_FileSize(filename); - romdata = (char*)emu_Malloc(romsize); - if (romdata) - { - int f = emu_FileOpen(filename, "r+b"); - if (f) { - if (emu_FileRead((char*)romdata, romsize, f) != romsize ) { - romdata = NULL; - } - emu_FileClose(f); - } else { - romdata = NULL; - } - } -} diff --git a/MCUME_pico/piconofrendo/nes_emu.h b/MCUME_pico/piconofrendo/nes_emu.h deleted file mode 100644 index 2ece48c..0000000 --- a/MCUME_pico/piconofrendo/nes_emu.h +++ /dev/null @@ -1,4 +0,0 @@ -extern void nes_Init(void); -extern void nes_Step(void); -extern void nes_Start(char * filename); - diff --git a/MCUME_pico/piconofrendo/nes_mmc.c b/MCUME_pico/piconofrendo/nes_mmc.c deleted file mode 100755 index b6bad5c..0000000 --- a/MCUME_pico/piconofrendo/nes_mmc.c +++ /dev/null @@ -1,353 +0,0 @@ -/* -** Nofrendo (c) 1998-2000 Matthew Conte (matt@conte.com) -** -** -** This program is free software; you can redistribute it and/or -** modify it under the terms of version 2 of the GNU Library General -** Public License as published by the Free Software Foundation. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** Library General Public License for more details. To obtain a -** copy of the GNU Library General Public License, write to the Free -** Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -** -** Any permitted reproduction of these routines, in whole or in part, -** must bear this legend. -** -** -** nes_mmc.c -** -** NES Memory Management Controller (mapper) emulation -** $Id: nes_mmc.c,v 1.2 2001/04/27 14:37:11 neil Exp $ -*/ - -#include -#include "noftypes.h" -#include "nes6502.h" -#include "nes_mmc.h" -#include "nes_ppu.h" -#include "libsnss.h" -#include "log.h" -#include "mmclist.h" -#include "nes_rom.h" - -#define MMC_8KROM (mmc.cart->rom_banks * 2) -#define MMC_16KROM (mmc.cart->rom_banks) -#define MMC_32KROM (mmc.cart->rom_banks / 2) -#define MMC_8KVROM (mmc.cart->vrom_banks) -#define MMC_4KVROM (mmc.cart->vrom_banks * 2) -#define MMC_2KVROM (mmc.cart->vrom_banks * 4) -#define MMC_1KVROM (mmc.cart->vrom_banks * 8) - -#define MMC_LAST8KROM (MMC_8KROM - 1) -#define MMC_LAST16KROM (MMC_16KROM - 1) -#define MMC_LAST32KROM (MMC_32KROM - 1) -#define MMC_LAST8KVROM (MMC_8KVROM - 1) -#define MMC_LAST4KVROM (MMC_4KVROM - 1) -#define MMC_LAST2KVROM (MMC_2KVROM - 1) -#define MMC_LAST1KVROM (MMC_1KVROM - 1) - -static mmc_t mmc; - -rominfo_t *mmc_getinfo(void) -{ - return mmc.cart; -} - -void mmc_setcontext(mmc_t *src_mmc) -{ - ASSERT(src_mmc); - - mmc = *src_mmc; -} - -void mmc_getcontext(mmc_t *dest_mmc) -{ - *dest_mmc = mmc; -} - -/* VROM bankswitching */ -void mmc_bankvrom(int size, uint32 address, int bank) -{ - if (0 == mmc.cart->vrom_banks) - return; - - switch (size) - { - case 1: - if (bank == MMC_LASTBANK) - bank = MMC_LAST1KVROM; - ppu_setpage(1, address >> 10, &mmc.cart->vrom[(bank % MMC_1KVROM) << 10] - address); - break; - - case 2: - if (bank == MMC_LASTBANK) - bank = MMC_LAST2KVROM; - ppu_setpage(2, address >> 10, &mmc.cart->vrom[(bank % MMC_2KVROM) << 11] - address); - break; - - case 4: - if (bank == MMC_LASTBANK) - bank = MMC_LAST4KVROM; - ppu_setpage(4, address >> 10, &mmc.cart->vrom[(bank % MMC_4KVROM) << 12] - address); - break; - - case 8: - if (bank == MMC_LASTBANK) - bank = MMC_LAST8KVROM; - ppu_setpage(8, 0, &mmc.cart->vrom[(bank % MMC_8KVROM) << 13]); - break; - - default: - log_printf("invalid VROM bank size %d\n", size); - } -} - -/* ROM bankswitching */ -void mmc_bankrom(int size, uint32 address, int bank) -{ - nes6502_context mmc_cpu; - - nes6502_getcontext(&mmc_cpu); - - switch (size) - { - case 8: - if (bank == MMC_LASTBANK) - bank = MMC_LAST8KROM; - { - int page = address >> NES6502_BANKSHIFT; - mmc_cpu.mem_page[page] = &mmc.cart->rom[(bank % MMC_8KROM) << 13]; - mmc_cpu.mem_page[page + 1] = mmc_cpu.mem_page[page] + 0x1000; - } - - break; - - case 16: - if (bank == MMC_LASTBANK) - bank = MMC_LAST16KROM; - { - int page = address >> NES6502_BANKSHIFT; - mmc_cpu.mem_page[page] = &mmc.cart->rom[(bank % MMC_16KROM) << 14]; - mmc_cpu.mem_page[page + 1] = mmc_cpu.mem_page[page] + 0x1000; - mmc_cpu.mem_page[page + 2] = mmc_cpu.mem_page[page] + 0x2000; - mmc_cpu.mem_page[page + 3] = mmc_cpu.mem_page[page] + 0x3000; - } - break; - - case 32: - if (bank == MMC_LASTBANK) - bank = MMC_LAST32KROM; - - mmc_cpu.mem_page[8] = &mmc.cart->rom[(bank % MMC_32KROM) << 15]; - mmc_cpu.mem_page[9] = mmc_cpu.mem_page[8] + 0x1000; - mmc_cpu.mem_page[10] = mmc_cpu.mem_page[8] + 0x2000; - mmc_cpu.mem_page[11] = mmc_cpu.mem_page[8] + 0x3000; - mmc_cpu.mem_page[12] = mmc_cpu.mem_page[8] + 0x4000; - mmc_cpu.mem_page[13] = mmc_cpu.mem_page[8] + 0x5000; - mmc_cpu.mem_page[14] = mmc_cpu.mem_page[8] + 0x6000; - mmc_cpu.mem_page[15] = mmc_cpu.mem_page[8] + 0x7000; - break; - - default: - log_printf("invalid ROM bank size %d\n", size); - break; - } - - nes6502_setcontext(&mmc_cpu); -} - -/* Check to see if this mapper is supported */ -bool mmc_peek(int map_num) -{ - mapintf_t **map_ptr = mappers; - - while (NULL != *map_ptr) - { - if ((*map_ptr)->number == map_num) - return true; - map_ptr++; - } - - return false; -} - -static void mmc_setpages(void) -{ - log_printf("setting up mapper %d\n", mmc.intf->number); - - /* Switch ROM into CPU space, set VROM/VRAM (done for ALL ROMs) */ - mmc_bankrom(16, 0x8000, 0); - mmc_bankrom(16, 0xC000, MMC_LASTBANK); - mmc_bankvrom(8, 0x0000, 0); - - if (mmc.cart->flags & ROM_FLAG_FOURSCREEN) - { - ppu_mirror(0, 1, 2, 3); - } - else - { - if (MIRROR_VERT == mmc.cart->mirror) - ppu_mirror(0, 1, 0, 1); - else - ppu_mirror(0, 0, 1, 1); - } - - /* if we have no VROM, switch in VRAM */ - /* TODO: fix this hack implementation */ - if (0 == mmc.cart->vrom_banks) - { - ASSERT(mmc.cart->vram); - - ppu_setpage(8, 0, mmc.cart->vram); - ppu_mirrorhipages(); - } -} - -/* Mapper initialization routine */ -void mmc_reset(void) -{ - mmc_setpages(); - - ppu_setlatchfunc(NULL); - ppu_setvromswitch(NULL); - - if (mmc.intf->init) - mmc.intf->init(); - - log_printf("reset memory mapper\n"); -} - - -void mmc_destroy(mmc_t **nes_mmc) -{ - if (*nes_mmc) - free(*nes_mmc); -} - -mmc_t *mmc_create(rominfo_t *rominfo) -{ - mmc_t *temp; - mapintf_t **map_ptr; - - for (map_ptr = mappers; (*map_ptr)->number != rominfo->mapper_number; map_ptr++) - { - if (NULL == *map_ptr) - return NULL; /* Should *never* happen */ - } - - temp = malloc(sizeof(mmc_t)); - if (NULL == temp) - return NULL; - - memset(temp, 0, sizeof(mmc_t)); - - temp->intf = *map_ptr; - temp->cart = rominfo; - - mmc_setcontext(temp); - - log_printf("created memory mapper: %s\n", (*map_ptr)->name); - - return temp; -} - - -/* -** $Log: nes_mmc.c,v $ -** Revision 1.2 2001/04/27 14:37:11 neil -** wheeee -** -** Revision 1.1.1.1 2001/04/27 07:03:54 neil -** initial -** -** Revision 1.4 2000/11/21 13:28:40 matt -** take care to zero allocated mem -** -** Revision 1.3 2000/10/27 12:55:58 matt -** nes6502 now uses 4kB banks across the boards -** -** Revision 1.2 2000/10/25 00:23:16 matt -** makefiles updated for new directory structure -** -** Revision 1.1 2000/10/24 12:20:28 matt -** changed directory structure -** -** Revision 1.28 2000/10/22 19:17:24 matt -** mapper cleanups galore -** -** Revision 1.27 2000/10/22 15:02:32 matt -** simplified mirroring -** -** Revision 1.26 2000/10/21 19:38:56 matt -** that two year old crap code *was* flushed -** -** Revision 1.25 2000/10/21 19:26:59 matt -** many more cleanups -** -** Revision 1.24 2000/10/17 03:22:57 matt -** cleaning up rom module -** -** Revision 1.23 2000/10/10 13:58:15 matt -** stroustrup squeezing his way in the door -** -** Revision 1.22 2000/08/16 02:51:55 matt -** random cleanups -** -** Revision 1.21 2000/07/31 04:27:59 matt -** one million cleanups -** -** Revision 1.20 2000/07/25 02:25:53 matt -** safer xxx_destroy calls -** -** Revision 1.19 2000/07/23 15:11:45 matt -** removed unused variables -** -** Revision 1.18 2000/07/15 23:50:03 matt -** migrated state get/set from nes_mmc.c to state.c -** -** Revision 1.17 2000/07/11 03:15:09 melanson -** Added support for mappers 16, 34, and 231 -** -** Revision 1.16 2000/07/10 05:27:41 matt -** cleaned up mapper-specific callbacks -** -** Revision 1.15 2000/07/10 03:02:49 matt -** minor change on loading state -** -** Revision 1.14 2000/07/06 17:38:49 matt -** replaced missing string.h include -** -** Revision 1.13 2000/07/06 02:47:11 matt -** mapper addition madness -** -** Revision 1.12 2000/07/05 05:04:15 matt -** added more mappers -** -** Revision 1.11 2000/07/04 23:12:58 matt -** brand spankin' new mapper interface implemented -** -** Revision 1.10 2000/07/04 04:56:36 matt -** modifications for new SNSS -** -** Revision 1.9 2000/06/29 14:17:18 matt -** uses snsslib now -** -** Revision 1.8 2000/06/29 03:09:24 matt -** modified to support new snss code -** -** Revision 1.7 2000/06/26 04:57:54 matt -** bugfix - irqs/mmcstate not cleared on reset -** -** Revision 1.6 2000/06/23 11:01:10 matt -** updated for new external sound interface -** -** Revision 1.5 2000/06/20 04:04:57 matt -** hacked to use new external soundchip struct -** -** Revision 1.4 2000/06/09 15:12:26 matt -** initial revision -** -*/ diff --git a/MCUME_pico/piconofrendo/nes_mmc.h b/MCUME_pico/piconofrendo/nes_mmc.h deleted file mode 100755 index 97205d3..0000000 --- a/MCUME_pico/piconofrendo/nes_mmc.h +++ /dev/null @@ -1,146 +0,0 @@ -/* -** Nofrendo (c) 1998-2000 Matthew Conte (matt@conte.com) -** -** -** This program is free software; you can redistribute it and/or -** modify it under the terms of version 2 of the GNU Library General -** Public License as published by the Free Software Foundation. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** Library General Public License for more details. To obtain a -** copy of the GNU Library General Public License, write to the Free -** Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -** -** Any permitted reproduction of these routines, in whole or in part, -** must bear this legend. -** -** -** nes_mmc.h -** -** NES Memory Management Controller (mapper) defines / prototypes -** $Id: nes_mmc.h,v 1.2 2001/04/27 14:37:11 neil Exp $ -*/ - -#ifndef _NES_MMC_H_ -#define _NES_MMC_H_ - -#include "libsnss.h" -#include "nes_apu.h" - -#define MMC_LASTBANK -1 - -typedef struct -{ - uint32 min_range, max_range; - uint8 (*read_func)(uint32 address); -} map_memread; - -typedef struct -{ - uint32 min_range, max_range; - void (*write_func)(uint32 address, uint8 value); -} map_memwrite; - - -typedef struct mapintf_s -{ - int number; - char *name; - void (*init)(void); - void (*vblank)(void); - void (*hblank)(int vblank); - void (*get_state)(SnssMapperBlock *state); - void (*set_state)(SnssMapperBlock *state); - map_memread *mem_read; - map_memwrite *mem_write; - apuext_t *sound_ext; -} mapintf_t; - - -#include "nes_rom.h" -typedef struct mmc_s -{ - mapintf_t *intf; - rominfo_t *cart; /* link it back to the cart */ -} mmc_t; - -extern rominfo_t *mmc_getinfo(void); - -extern void mmc_bankvrom(int size, uint32 address, int bank); -extern void mmc_bankrom(int size, uint32 address, int bank); - -/* Prototypes */ -extern mmc_t *mmc_create(rominfo_t *rominfo); -extern void mmc_destroy(mmc_t **nes_mmc); - -extern void mmc_getcontext(mmc_t *dest_mmc); -extern void mmc_setcontext(mmc_t *src_mmc); - -extern bool mmc_peek(int map_num); - -extern void mmc_reset(void); - -#endif /* _NES_MMC_H_ */ - -/* -** $Log: nes_mmc.h,v $ -** Revision 1.2 2001/04/27 14:37:11 neil -** wheeee -** -** Revision 1.1.1.1 2001/04/27 07:03:54 neil -** initial -** -** Revision 1.2 2000/10/25 00:23:16 matt -** makefiles updated for new directory structure -** -** Revision 1.1 2000/10/24 12:20:28 matt -** changed directory structure -** -** Revision 1.18 2000/10/22 19:17:24 matt -** mapper cleanups galore -** -** Revision 1.17 2000/10/21 19:26:59 matt -** many more cleanups -** -** Revision 1.16 2000/10/17 03:22:58 matt -** cleaning up rom module -** -** Revision 1.15 2000/10/10 13:58:15 matt -** stroustrup squeezing his way in the door -** -** Revision 1.14 2000/07/31 04:27:59 matt -** one million cleanups -** -** Revision 1.13 2000/07/25 02:25:53 matt -** safer xxx_destroy calls -** -** Revision 1.12 2000/07/17 01:52:28 matt -** made sure last line of all source files is a newline -** -** Revision 1.11 2000/07/15 23:50:03 matt -** migrated state get/set from nes_mmc.c to state.c -** -** Revision 1.10 2000/07/11 02:38:01 matt -** added setcontext() routine -** -** Revision 1.9 2000/07/10 05:27:41 matt -** cleaned up mapper-specific callbacks -** -** Revision 1.8 2000/07/04 23:12:58 matt -** brand spankin' new mapper interface implemented -** -** Revision 1.7 2000/07/04 04:56:36 matt -** modifications for new SNSS -** -** Revision 1.6 2000/06/29 14:17:18 matt -** uses snsslib now -** -** Revision 1.5 2000/06/29 03:09:24 matt -** modified to support new snss code -** -** Revision 1.4 2000/06/09 15:12:26 matt -** initial revision -** -*/ diff --git a/MCUME_pico/piconofrendo/nes_pal.c b/MCUME_pico/piconofrendo/nes_pal.c deleted file mode 100644 index 9d44570..0000000 --- a/MCUME_pico/piconofrendo/nes_pal.c +++ /dev/null @@ -1,185 +0,0 @@ -/* -** Nofrendo (c) 1998-2000 Matthew Conte (matt@conte.com) -** -** -** This program is free software; you can redistribute it and/or -** modify it under the terms of version 2 of the GNU Library General -** Public License as published by the Free Software Foundation. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** Library General Public License for more details. To obtain a -** copy of the GNU Library General Public License, write to the Free -** Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -** -** Any permitted reproduction of these routines, in whole or in part, -** must bear this legend. -** -** -** nes_pal.c -** -** NES RGB palette -** $Id: nes_pal.c,v 1.2 2001/04/27 14:37:11 neil Exp $ -*/ - -#include -#include "noftypes.h" -#include "bitmap.h" -#include "nes_pal.h" - -#ifndef PI -#define PI 3.1415926535897932384626433832795 -#endif - -/* my NES palette, converted to RGB */ -const rgb_t shady_palette[] = -{ - {0x80,0x80,0x80}, {0x00,0x00,0xBB}, {0x37,0x00,0xBF}, {0x84,0x00,0xA6}, - {0xBB,0x00,0x6A}, {0xB7,0x00,0x1E}, {0xB3,0x00,0x00}, {0x91,0x26,0x00}, - {0x7B,0x2B,0x00}, {0x00,0x3E,0x00}, {0x00,0x48,0x0D}, {0x00,0x3C,0x22}, - {0x00,0x2F,0x66}, {0x00,0x00,0x00}, {0x05,0x05,0x05}, {0x05,0x05,0x05}, - - {0xC8,0xC8,0xC8}, {0x00,0x59,0xFF}, {0x44,0x3C,0xFF}, {0xB7,0x33,0xCC}, - {0xFF,0x33,0xAA}, {0xFF,0x37,0x5E}, {0xFF,0x37,0x1A}, {0xD5,0x4B,0x00}, - {0xC4,0x62,0x00}, {0x3C,0x7B,0x00}, {0x1E,0x84,0x15}, {0x00,0x95,0x66}, - {0x00,0x84,0xC4}, {0x11,0x11,0x11}, {0x09,0x09,0x09}, {0x09,0x09,0x09}, - - {0xFF,0xFF,0xFF}, {0x00,0x95,0xFF}, {0x6F,0x84,0xFF}, {0xD5,0x6F,0xFF}, - {0xFF,0x77,0xCC}, {0xFF,0x6F,0x99}, {0xFF,0x7B,0x59}, {0xFF,0x91,0x5F}, - {0xFF,0xA2,0x33}, {0xA6,0xBF,0x00}, {0x51,0xD9,0x6A}, {0x4D,0xD5,0xAE}, - {0x00,0xD9,0xFF}, {0x66,0x66,0x66}, {0x0D,0x0D,0x0D}, {0x0D,0x0D,0x0D}, - - {0xFF,0xFF,0xFF}, {0x84,0xBF,0xFF}, {0xBB,0xBB,0xFF}, {0xD0,0xBB,0xFF}, - {0xFF,0xBF,0xEA}, {0xFF,0xBF,0xCC}, {0xFF,0xC4,0xB7}, {0xFF,0xCC,0xAE}, - {0xFF,0xD9,0xA2}, {0xCC,0xE1,0x99}, {0xAE,0xEE,0xB7}, {0xAA,0xF7,0xEE}, - {0xB3,0xEE,0xFF}, {0xDD,0xDD,0xDD}, {0x11,0x11,0x11}, {0x11,0x11,0x11} -}; - -/* dynamic palette building routines, -** care of Kevin Horton (khorton@iquest.net) -*/ - -/* our global palette */ -rgb_t nes_palette[64]; - - -static float hue = 334.0f; -static float tint = 0.4f; - - -static const float brightness[4][4] = -{ - { 0.50f, 0.75f, 1.00f, 1.00f }, - { 0.29f, 0.45f, 0.73f, 0.90f }, - { 0.00f, 0.24f, 0.47f, 0.77f }, - { 0.02f, 0.04f, 0.05f, 0.07f } -}; - -static const int col_angles[16] = -{ - 0, 240, 210, 180, 150, 120, 90, 60, 30, 0, 330, 300, 270, 0, 0, 0 -}; - -void pal_generate(void) -{ - int x, z; - float s, y, theta; - int r, g, b; - - for (x = 0; x < 4; x++) - { - for (z = 0; z < 16; z++) - { - switch (z) - { - case 0: - /* is color $x0? If so, get luma */ - s = 0; - y = brightness[0][x]; - break; - - case 13: - /* is color $xD? If so, get luma */ - s = 0; - y = brightness[2][x]; - break; - - case 14: - case 15: - /* is color $xE/F? If so, set to black */ - s = 0; - y = brightness[3][x]; - - break; - - default: - s = tint; /* grab tint */ - y = brightness[1][x]; /* grab default luminance */ - break; - } - - theta = (float) (PI * ((col_angles[z] + hue) / 180.0)); - - r = (int) (256.0 * (y + s * sin(theta))); - g = (int) (256.0 * (y - ((27 / 53.0) * s * sin(theta)) + ((10 / 53.0) * s * cos(theta)))); - b = (int) (256.0 * (y - (s * cos(theta)))); - - if (r > 255) - r = 255; - else if (r < 0) - r = 0; - - if (g > 255) - g = 255; - else if (g < 0) - g = 0; - - if (b > 255) - b = 255; - else if (b < 0) - b = 0; - - nes_palette[(x << 4) + z].r = r; - nes_palette[(x << 4) + z].g = g; - nes_palette[(x << 4) + z].b = b; - } - } -} - -/* -** $Log: nes_pal.c,v $ -** Revision 1.2 2001/04/27 14:37:11 neil -** wheeee -** -** Revision 1.1.1.1 2001/04/27 07:03:54 neil -** initial -** -** Revision 1.3 2000/11/06 02:17:18 matt -** no more double->float warnings -** -** Revision 1.2 2000/11/05 16:35:41 matt -** rolled rgb.h into bitmap.h -** -** Revision 1.1 2000/10/24 12:20:28 matt -** changed directory structure -** -** Revision 1.9 2000/07/17 01:52:28 matt -** made sure last line of all source files is a newline -** -** Revision 1.8 2000/07/10 13:49:31 matt -** renamed my palette and extern'ed it -** -** Revision 1.7 2000/06/26 04:59:13 matt -** selectable tint/hue hack (just for the time being) -** -** Revision 1.6 2000/06/21 21:48:19 matt -** changed range multiplier from 255.0 to 256.0 -** -** Revision 1.5 2000/06/20 20:42:47 matt -** accuracy changes -** -** Revision 1.4 2000/06/09 15:12:26 matt -** initial revision -** -*/ diff --git a/MCUME_pico/piconofrendo/nes_pal.h b/MCUME_pico/piconofrendo/nes_pal.h deleted file mode 100644 index eb4828e..0000000 --- a/MCUME_pico/piconofrendo/nes_pal.h +++ /dev/null @@ -1,65 +0,0 @@ -/* -** Nofrendo (c) 1998-2000 Matthew Conte (matt@conte.com) -** -** -** This program is free software; you can redistribute it and/or -** modify it under the terms of version 2 of the GNU Library General -** Public License as published by the Free Software Foundation. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** Library General Public License for more details. To obtain a -** copy of the GNU Library General Public License, write to the Free -** Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -** -** Any permitted reproduction of these routines, in whole or in part, -** must bear this legend. -** -** -** nes_pal.h -** -** NES palette definition -** $Id: nes_pal.h,v 1.1.1.1 2001/04/27 07:03:54 neil Exp $ -*/ - -#ifndef _NESPAL_H_ -#define _NESPAL_H_ - -extern rgb_t nes_palette[]; -extern const rgb_t shady_palette[]; - -extern void pal_generate(void); - -/* TODO: these are temporary hacks */ -extern void pal_dechue(void); -extern void pal_inchue(void); -extern void pal_dectint(void); -extern void pal_inctint(void); - -#endif /* _NESPAL_H_ */ - -/* -** $Log: nes_pal.h,v $ -** Revision 1.1.1.1 2001/04/27 07:03:54 neil -** initial -** -** Revision 1.1 2000/10/24 12:20:28 matt -** changed directory structure -** -** Revision 1.8 2000/07/31 04:27:59 matt -** one million cleanups -** -** Revision 1.7 2000/07/21 04:20:35 matt -** added some nasty externs -** -** Revision 1.6 2000/07/10 13:49:32 matt -** renamed my palette and extern'ed it -** -** Revision 1.5 2000/07/05 17:14:34 neil -** Linux: Act Two, Scene One -** -** Revision 1.4 2000/06/09 15:12:26 matt -** initial revision -** -*/ diff --git a/MCUME_pico/piconofrendo/nes_ppu.c b/MCUME_pico/piconofrendo/nes_ppu.c deleted file mode 100644 index ac884ca..0000000 --- a/MCUME_pico/piconofrendo/nes_ppu.c +++ /dev/null @@ -1,1340 +0,0 @@ -/* -** Nofrendo (c) 1998-2000 Matthew Conte (matt@conte.com) -** -** -** This program is free software; you can redistribute it and/or -** modify it under the terms of version 2 of the GNU Library General -** Public License as published by the Free Software Foundation. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** Library General Public License for more details. To obtain a -** copy of the GNU Library General Public License, write to the Free -** Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -** -** Any permitted reproduction of these routines, in whole or in part, -** must bear this legend. -** -** -** nes_ppu.c -** -** NES PPU emulation -** $Id: nes_ppu.c,v 1.2 2001/04/27 14:37:11 neil Exp $ -*/ - -#include -#include -#include "noftypes.h" -#include "nes_ppu.h" -#include "nes.h" -#include "nes6502.h" -#include "log.h" -#include "nes_mmc.h" - -#include "bitmap.h" -#include "vid_drv.h" -#include "nes_pal.h" -#include "nesinput.h" - - -/* PPU access */ -#define PPU_MEM(x) ppu.page[(x) >> 10][(x)] - -/* Background (color 0) and solid sprite pixel flags */ -#define BG_TRANS 0x80 -#define SP_PIXEL 0x40 -#define BG_CLEAR(V) ((V) & BG_TRANS) -#define BG_SOLID(V) (0 == BG_CLEAR(V)) -#define SP_CLEAR(V) (0 == ((V) & SP_PIXEL)) - -/* Full BG color */ -#define FULLBG (ppu.palette[0] | BG_TRANS) - -/* the NES PPU */ -static ppu_t ppu; - - -void ppu_displaysprites(bool display) -{ - ppu.drawsprites = display; -} - -void ppu_setcontext(ppu_t *src_ppu) -{ - int nametab[4]; - ASSERT(src_ppu); - ppu = *src_ppu; - - /* we can't just copy contexts here, because more than likely, - ** the top 8 pages of the ppu are pointing to internal PPU memory, - ** which means we need to recalculate the page pointers. - ** TODO: we can either get rid of the page pointing in the code, - ** or add more robust checks to make sure that pages 8-15 are - ** definitely pointing to internal PPU RAM, not just something - ** that some crazy mapper paged in. - */ - nametab[0] = (src_ppu->page[8] - src_ppu->nametab + 0x2000) >> 10; - nametab[1] = (src_ppu->page[9] - src_ppu->nametab + 0x2400) >> 10; - nametab[2] = (src_ppu->page[10] - src_ppu->nametab + 0x2800) >> 10; - nametab[3] = (src_ppu->page[11] - src_ppu->nametab + 0x2C00) >> 10; - - ppu.page[8] = ppu.nametab + (nametab[0] << 10) - 0x2000; - ppu.page[9] = ppu.nametab + (nametab[1] << 10) - 0x2400; - ppu.page[10] = ppu.nametab + (nametab[2] << 10) - 0x2800; - ppu.page[11] = ppu.nametab + (nametab[3] << 10) - 0x2C00; - ppu.page[12] = ppu.page[8] - 0x1000; - ppu.page[13] = ppu.page[9] - 0x1000; - ppu.page[14] = ppu.page[10] - 0x1000; - ppu.page[15] = ppu.page[11] - 0x1000; -} - -void ppu_getcontext(ppu_t *dest_ppu) -{ - int nametab[4]; - - ASSERT(dest_ppu); - *dest_ppu = ppu; - - /* we can't just copy contexts here, because more than likely, - ** the top 8 pages of the ppu are pointing to internal PPU memory, - ** which means we need to recalculate the page pointers. - ** TODO: we can either get rid of the page pointing in the code, - ** or add more robust checks to make sure that pages 8-15 are - ** definitely pointing to internal PPU RAM, not just something - ** that some crazy mapper paged in. - */ - nametab[0] = (ppu.page[8] - ppu.nametab + 0x2000) >> 10; - nametab[1] = (ppu.page[9] - ppu.nametab + 0x2400) >> 10; - nametab[2] = (ppu.page[10] - ppu.nametab + 0x2800) >> 10; - nametab[3] = (ppu.page[11] - ppu.nametab + 0x2C00) >> 10; - - dest_ppu->page[8] = dest_ppu->nametab + (nametab[0] << 10) - 0x2000; - dest_ppu->page[9] = dest_ppu->nametab + (nametab[1] << 10) - 0x2400; - dest_ppu->page[10] = dest_ppu->nametab + (nametab[2] << 10) - 0x2800; - dest_ppu->page[11] = dest_ppu->nametab + (nametab[3] << 10) - 0x2C00; - dest_ppu->page[12] = dest_ppu->page[8] - 0x1000; - dest_ppu->page[13] = dest_ppu->page[9] - 0x1000; - dest_ppu->page[14] = dest_ppu->page[10] - 0x1000; - dest_ppu->page[15] = dest_ppu->page[11] - 0x1000; -} - -ppu_t *ppu_create(void) -{ - static bool pal_generated = false; - ppu_t *temp; - - temp = malloc(sizeof(ppu_t)); - if (NULL == temp) - return NULL; - - memset(temp, 0, sizeof(ppu_t)); - - temp->latchfunc = NULL; - temp->vromswitch = NULL; - temp->vram_present = false; - temp->drawsprites = true; - - /* TODO: probably a better way to do this... */ - if (false == pal_generated) - { - pal_generate(); - pal_generated = true; - } - - ppu_setdefaultpal(temp); - - return temp; -} - -void ppu_destroy(ppu_t **src_ppu) -{ - if (*src_ppu) - { - free(*src_ppu); - *src_ppu = NULL; - } -} - -void ppu_setpage(int size, int page_num, uint8 *location) -{ - /* deliberately fall through */ - switch (size) - { - case 8: - ppu.page[page_num++] = location; - ppu.page[page_num++] = location; - ppu.page[page_num++] = location; - ppu.page[page_num++] = location; - case 4: - ppu.page[page_num++] = location; - ppu.page[page_num++] = location; - case 2: - ppu.page[page_num++] = location; - case 1: - ppu.page[page_num++] = location; - break; - } -} - -/* make sure $3000-$3F00 mirrors $2000-$2F00 */ -void ppu_mirrorhipages(void) -{ - ppu.page[12] = ppu.page[8] - 0x1000; - ppu.page[13] = ppu.page[9] - 0x1000; - ppu.page[14] = ppu.page[10] - 0x1000; - ppu.page[15] = ppu.page[11] - 0x1000; -} - -void ppu_mirror(int nt1, int nt2, int nt3, int nt4) -{ - ppu.page[8] = ppu.nametab + (nt1 << 10) - 0x2000; - ppu.page[9] = ppu.nametab + (nt2 << 10) - 0x2400; - ppu.page[10] = ppu.nametab + (nt3 << 10) - 0x2800; - ppu.page[11] = ppu.nametab + (nt4 << 10) - 0x2C00; - ppu.page[12] = ppu.page[8] - 0x1000; - ppu.page[13] = ppu.page[9] - 0x1000; - ppu.page[14] = ppu.page[10] - 0x1000; - ppu.page[15] = ppu.page[11] - 0x1000; -} - -/* bleh, for snss */ -uint8 *ppu_getpage(int page) -{ - return ppu.page[page]; -} - -static void mem_trash(uint8 *buffer, int length) -{ - int i; - - for (i = 0; i < length; i++) - buffer[i] = (uint8) rand(); -} - -/* reset state of ppu */ -void ppu_reset(int reset_type) -{ - if (HARD_RESET == reset_type) - mem_trash(ppu.oam, 256); - - ppu.ctrl0 = 0; - ppu.ctrl1 = PPU_CTRL1F_OBJON | PPU_CTRL1F_BGON; - ppu.stat = 0; - ppu.flipflop = 0; - ppu.vaddr = ppu.vaddr_latch = 0x2000; - ppu.oam_addr = 0; - ppu.tile_xofs = 0; - - ppu.latch = 0; - ppu.vram_accessible = true; -} - -/* we render a scanline of graphics first so we know exactly -** where the sprite 0 strike is going to occur (in terms of -** cpu cycles), using the relation that 3 pixels == 1 cpu cycle -*/ -static void ppu_setstrike(int x_loc) -{ - if (false == ppu.strikeflag) - { - ppu.strikeflag = true; - - /* 3 pixels per cpu cycle */ - ppu.strike_cycle = nes6502_getcycles(false) + (x_loc / 3); - } -} - -static void ppu_oamdma(uint8 value) -{ - uint32 cpu_address; - uint8 oam_loc; - - cpu_address = (uint32) (value << 8); - - /* Sprite DMA starts at the current SPRRAM address */ - oam_loc = ppu.oam_addr; - do - { - ppu.oam[oam_loc++] = nes6502_getbyte(cpu_address++); - } - while (oam_loc != ppu.oam_addr); - - /* TODO: enough with houdini */ - cpu_address -= 256; - /* Odd address in $2003 */ - if ((ppu.oam_addr >> 2) & 1) - { - for (oam_loc = 4; oam_loc < 8; oam_loc++) - ppu.oam[oam_loc] = nes6502_getbyte(cpu_address++); - cpu_address += 248; - for (oam_loc = 0; oam_loc < 4; oam_loc++) - ppu.oam[oam_loc] = nes6502_getbyte(cpu_address++); - } - /* Even address in $2003 */ - else - { - for (oam_loc = 0; oam_loc < 8; oam_loc++) - ppu.oam[oam_loc] = nes6502_getbyte(cpu_address++); - } - - /* make the CPU spin for DMA cycles */ - nes6502_burn(513); - nes6502_release(); -} - -/* TODO: this isn't the PPU! */ -void ppu_writehigh(uint32 address, uint8 value) -{ - switch (address) - { - case PPU_OAMDMA: - ppu_oamdma(value); - break; - - case PPU_JOY0: - /* VS system VROM switching - bleh!*/ - if (ppu.vromswitch) - ppu.vromswitch(value); - - /* see if we need to strobe them joypads */ - value &= 1; - - if (0 == value && ppu.strobe) - input_strobe(); - - ppu.strobe = value; - break; - - case PPU_JOY1: /* frame IRQ control */ - nes_setfiq(value); - break; - - default: - break; - } -} - -/* TODO: this isn't the PPU! */ -uint8 ppu_readhigh(uint32 address) -{ - uint8 value; - - switch (address) - { - case PPU_JOY0: - value = input_get(INP_JOYPAD0); - break; - - case PPU_JOY1: - /* TODO: better input handling */ - value = input_get(INP_ZAPPER | INP_JOYPAD1 - /*| INP_ARKANOID*/ - /*| INP_POWERPAD*/); - break; - - default: - value = 0xFF; - break; - } - - return value; -} - -/* Read from $2000-$2007 */ -uint8 ppu_read(uint32 address) -{ - uint8 value; - - /* handle mirrored reads up to $3FFF */ - switch (address & 0x2007) - { - case PPU_STAT: - value = (ppu.stat & 0xE0) | (ppu.latch & 0x1F); - - if (ppu.strikeflag) - { - if (nes6502_getcycles(false) >= ppu.strike_cycle) - value |= PPU_STATF_STRIKE; - } - - /* clear both vblank flag and vram address flipflop */ - ppu.stat &= ~PPU_STATF_VBLANK; - ppu.flipflop = 0; - break; - - case PPU_VDATA: - /* buffered VRAM reads */ - value = ppu.latch = ppu.vdata_latch; - - /* VRAM only accessible during VBL */ - if ((ppu.bg_on || ppu.obj_on) && !ppu.vram_accessible) - { - ppu.vdata_latch = 0xFF; - log_printf("VRAM read at $%04X, scanline %d\n", - ppu.vaddr, nes_getcontextptr()->scanline); - } - else - { - uint32 addr = ppu.vaddr; - if (addr >= 0x3000) - addr -= 0x1000; - ppu.vdata_latch = PPU_MEM(addr); - } - - ppu.vaddr += ppu.vaddr_inc; - ppu.vaddr &= 0x3FFF; - break; - - case PPU_OAMDATA: - case PPU_CTRL0: - case PPU_CTRL1: - case PPU_OAMADDR: - case PPU_SCROLL: - case PPU_VADDR: - default: - value = ppu.latch; - break; - } - - return value; -} - -/* Write to $2000-$2007 */ -void ppu_write(uint32 address, uint8 value) -{ - /* write goes into ppu latch... */ - ppu.latch = value; - - switch (address & 0x2007) - { - case PPU_CTRL0: - ppu.ctrl0 = value; - - ppu.obj_height = (value & PPU_CTRL0F_OBJ16) ? 16 : 8; - ppu.bg_base = (value & PPU_CTRL0F_BGADDR) ? 0x1000 : 0; - ppu.obj_base = (value & PPU_CTRL0F_OBJADDR) ? 0x1000 : 0; - ppu.vaddr_inc = (value & PPU_CTRL0F_ADDRINC) ? 32 : 1; - ppu.tile_nametab = value & PPU_CTRL0F_NAMETAB; - - /* Mask out bits 10 & 11 in the ppu latch */ - ppu.vaddr_latch &= ~0x0C00; - ppu.vaddr_latch |= ((value & 3) << 10); - break; - - case PPU_CTRL1: - ppu.ctrl1 = value; - - ppu.obj_on = (value & PPU_CTRL1F_OBJON) ? true : false; - ppu.bg_on = (value & PPU_CTRL1F_BGON) ? true : false; - ppu.obj_mask = (value & PPU_CTRL1F_OBJMASK) ? false : true; - ppu.bg_mask = (value & PPU_CTRL1F_BGMASK) ? false : true; - break; - - case PPU_OAMADDR: - ppu.oam_addr = value; - break; - - case PPU_OAMDATA: - ppu.oam[ppu.oam_addr++] = value; - break; - - case PPU_SCROLL: - if (0 == ppu.flipflop) - { - /* Mask out bits 4 - 0 in the ppu latch */ - ppu.vaddr_latch &= ~0x001F; - ppu.vaddr_latch |= (value >> 3); /* Tile number */ - ppu.tile_xofs = (value & 7); /* Tile offset (0-7 pix) */ - } - else - { - /* Mask out bits 14-12 and 9-5 in the ppu latch */ - ppu.vaddr_latch &= ~0x73E0; - ppu.vaddr_latch |= ((value & 0xF8) << 2); /* Tile number */ - ppu.vaddr_latch |= ((value & 7) << 12); /* Tile offset (0-7 pix) */ - } - - ppu.flipflop ^= 1; - - break; - - case PPU_VADDR: - if (0 == ppu.flipflop) - { - /* Mask out bits 15-8 in ppu latch */ - ppu.vaddr_latch &= ~0xFF00; - ppu.vaddr_latch |= ((value & 0x3F) << 8); - } - else - { - /* Mask out bits 7-0 in ppu latch */ - ppu.vaddr_latch &= ~0x00FF; - ppu.vaddr_latch |= value; - ppu.vaddr = ppu.vaddr_latch; - } - - ppu.flipflop ^= 1; - - break; - - case PPU_VDATA: - if (ppu.vaddr < 0x3F00) - { - /* VRAM only accessible during scanlines 241-260 */ - if ((ppu.bg_on || ppu.obj_on) && !ppu.vram_accessible) - { - log_printf("VRAM write to $%04X, scanline %d\n", - ppu.vaddr, nes_getcontextptr()->scanline); - PPU_MEM(ppu.vaddr) = 0xFF; /* corrupt */ - } - else - { - uint32 addr = ppu.vaddr; - - if (false == ppu.vram_present && addr >= 0x3000) - ppu.vaddr -= 0x1000; - - PPU_MEM(addr) = value; - } - } - else - { - if (0 == (ppu.vaddr & 0x0F)) - { - int i; - - for (i = 0; i < 8; i ++) - ppu.palette[i << 2] = (value & 0x3F) | BG_TRANS; - } - else if (ppu.vaddr & 3) - { - ppu.palette[ppu.vaddr & 0x1F] = value & 0x3F; - } - } - - ppu.vaddr += ppu.vaddr_inc; - ppu.vaddr &= 0x3FFF; - break; - - default: - break; - } -} - -/* Builds a 256 color 8-bit palette based on a 64-color NES palette -** Note that we set it up 3 times so that we flip bits on the primary -** NES buffer for priorities -*/ -static void ppu_buildpalette(ppu_t *src_ppu, rgb_t *pal) -{ - int i; - - /* Set it up 3 times, for sprite priority/BG transparency trickery */ - for (i = 0; i < 64; i++) - { - src_ppu->curpal[i].r = src_ppu->curpal[i + 64].r - = src_ppu->curpal[i + 128].r = pal[i].r; - src_ppu->curpal[i].g = src_ppu->curpal[i + 64].g - = src_ppu->curpal[i + 128].g = pal[i].g; - src_ppu->curpal[i].b = src_ppu->curpal[i + 64].b - = src_ppu->curpal[i + 128].b = pal[i].b; - } -} - -/* build the emulator specific palette based on a 64-entry palette -** input palette can be either nes_palette or a 64-entry RGB palette -** read in from disk (i.e. for VS games) -*/ -void ppu_setpal(ppu_t *src_ppu, rgb_t *pal) -{ - ppu_buildpalette(src_ppu, pal); - vid_setpalette(src_ppu->curpal); -} - -void ppu_setdefaultpal(ppu_t *src_ppu) -{ - ppu_setpal(src_ppu, nes_palette); -} - -void ppu_setlatchfunc(ppulatchfunc_t func) -{ - ppu.latchfunc = func; -} - -void ppu_setvromswitch(ppuvromswitch_t func) -{ - ppu.vromswitch = func; -} - -/* rendering routines */ -INLINE void draw_bgtile(uint8 *surface, uint8 pat1, uint8 pat2, - const uint8 *colors) -{ - uint32 pattern = ((pat2 & 0xAA) << 8) | ((pat2 & 0x55) << 1) - | ((pat1 & 0xAA) << 7) | (pat1 & 0x55); - - *surface++ = colors[(pattern >> 14) & 3]; - *surface++ = colors[(pattern >> 6) & 3]; - *surface++ = colors[(pattern >> 12) & 3]; - *surface++ = colors[(pattern >> 4) & 3]; - *surface++ = colors[(pattern >> 10) & 3]; - *surface++ = colors[(pattern >> 2) & 3]; - *surface++ = colors[(pattern >> 8) & 3]; - *surface = colors[pattern & 3]; -} - -INLINE int draw_oamtile(uint8 *surface, uint8 attrib, uint8 pat1, - uint8 pat2, const uint8 *col_tbl, bool check_strike) -{ - int strike_pixel = -1; - uint32 color = ((pat2 & 0xAA) << 8) | ((pat2 & 0x55) << 1) - | ((pat1 & 0xAA) << 7) | (pat1 & 0x55); - - /* sprite is not 100% transparent */ - if (color) - { - uint8 colors[8]; - - /* swap pixels around if our tile is flipped */ - if (0 == (attrib & OAMF_HFLIP)) - { - colors[0] = (color >> 14) & 3; - colors[1] = (color >> 6) & 3; - colors[2] = (color >> 12) & 3; - colors[3] = (color >> 4) & 3; - colors[4] = (color >> 10) & 3; - colors[5] = (color >> 2) & 3; - colors[6] = (color >> 8) & 3; - colors[7] = color & 3; - } - else - { - colors[7] = (color >> 14) & 3; - colors[6] = (color >> 6) & 3; - colors[5] = (color >> 12) & 3; - colors[4] = (color >> 4) & 3; - colors[3] = (color >> 10) & 3; - colors[2] = (color >> 2) & 3; - colors[1] = (color >> 8) & 3; - colors[0] = color & 3; - } - - /* check for solid sprite pixel overlapping solid bg pixel */ - if (check_strike) - { - if (colors[0] && BG_SOLID(surface[0])) - strike_pixel = 0; - else if (colors[1] && BG_SOLID(surface[1])) - strike_pixel = 1; - else if (colors[2] && BG_SOLID(surface[2])) - strike_pixel = 2; - else if (colors[3] && BG_SOLID(surface[3])) - strike_pixel = 3; - else if (colors[4] && BG_SOLID(surface[4])) - strike_pixel = 4; - else if (colors[5] && BG_SOLID(surface[5])) - strike_pixel = 5; - else if (colors[6] && BG_SOLID(surface[6])) - strike_pixel = 6; - else if (colors[7] && BG_SOLID(surface[7])) - strike_pixel = 7; - } - - /* draw the character */ - if (attrib & OAMF_BEHIND) - { - if (colors[0]) - surface[0] = SP_PIXEL | (BG_CLEAR(surface[0]) ? col_tbl[colors[0]] : surface[0]); - if (colors[1]) - surface[1] = SP_PIXEL | (BG_CLEAR(surface[1]) ? col_tbl[colors[1]] : surface[1]); - if (colors[2]) - surface[2] = SP_PIXEL | (BG_CLEAR(surface[2]) ? col_tbl[colors[2]] : surface[2]); - if (colors[3]) - surface[3] = SP_PIXEL | (BG_CLEAR(surface[3]) ? col_tbl[colors[3]] : surface[3]); - if (colors[4]) - surface[4] = SP_PIXEL | (BG_CLEAR(surface[4]) ? col_tbl[colors[4]] : surface[4]); - if (colors[5]) - surface[5] = SP_PIXEL | (BG_CLEAR(surface[5]) ? col_tbl[colors[5]] : surface[5]); - if (colors[6]) - surface[6] = SP_PIXEL | (BG_CLEAR(surface[6]) ? col_tbl[colors[6]] : surface[6]); - if (colors[7]) - surface[7] = SP_PIXEL | (BG_CLEAR(surface[7]) ? col_tbl[colors[7]] : surface[7]); - } - else - { - if (colors[0] && SP_CLEAR(surface[0])) - surface[0] = SP_PIXEL | col_tbl[colors[0]]; - if (colors[1] && SP_CLEAR(surface[1])) - surface[1] = SP_PIXEL | col_tbl[colors[1]]; - if (colors[2] && SP_CLEAR(surface[2])) - surface[2] = SP_PIXEL | col_tbl[colors[2]]; - if (colors[3] && SP_CLEAR(surface[3])) - surface[3] = SP_PIXEL | col_tbl[colors[3]]; - if (colors[4] && SP_CLEAR(surface[4])) - surface[4] = SP_PIXEL | col_tbl[colors[4]]; - if (colors[5] && SP_CLEAR(surface[5])) - surface[5] = SP_PIXEL | col_tbl[colors[5]]; - if (colors[6] && SP_CLEAR(surface[6])) - surface[6] = SP_PIXEL | col_tbl[colors[6]]; - if (colors[7] && SP_CLEAR(surface[7])) - surface[7] = SP_PIXEL | col_tbl[colors[7]]; - } - } - - return strike_pixel; -} - -static void ppu_renderbg(uint8 *vidbuf) -{ - uint8 *bmp_ptr, *data_ptr, *tile_ptr, *attrib_ptr; - uint32 refresh_vaddr, bg_offset, attrib_base; - int tile_count; - uint8 tile_index, x_tile, y_tile; - uint8 col_high, attrib, attrib_shift; - - /* draw a line of transparent background color if bg is disabled */ - if (false == ppu.bg_on) - { - memset(vidbuf, FULLBG, NES_SCREEN_WIDTH); - return; - } - - bmp_ptr = vidbuf - ppu.tile_xofs; /* scroll x */ - refresh_vaddr = 0x2000 + (ppu.vaddr & 0x0FE0); /* mask out x tile */ - x_tile = ppu.vaddr & 0x1F; - y_tile = (ppu.vaddr >> 5) & 0x1F; /* to simplify calculations */ - bg_offset = ((ppu.vaddr >> 12) & 7) + ppu.bg_base; /* offset in y tile */ - - /* calculate initial values */ - tile_ptr = &PPU_MEM(refresh_vaddr + x_tile); /* pointer to tile index */ - attrib_base = (refresh_vaddr & 0x2C00) + 0x3C0 + ((y_tile & 0x1C) << 1); - attrib_ptr = &PPU_MEM(attrib_base + (x_tile >> 2)); - attrib = *attrib_ptr++; - attrib_shift = (x_tile & 2) + ((y_tile & 2) << 1); - col_high = ((attrib >> attrib_shift) & 3) << 2; - - /* ppu fetches 33 tiles */ - tile_count = 33; - while (tile_count--) - { - /* Tile number from nametable */ - tile_index = *tile_ptr++; - data_ptr = &PPU_MEM(bg_offset + (tile_index << 4)); - - /* Handle $FD/$FE tile VROM switching (PunchOut) */ - if (ppu.latchfunc) - ppu.latchfunc(ppu.bg_base, tile_index); - - draw_bgtile(bmp_ptr, data_ptr[0], data_ptr[8], ppu.palette + col_high); - bmp_ptr += 8; - - x_tile++; - - if (0 == (x_tile & 1)) /* check every 2 tiles */ - { - if (0 == (x_tile & 3)) /* check every 4 tiles */ - { - if (32 == x_tile) /* check every 32 tiles */ - { - x_tile = 0; - refresh_vaddr ^= (1 << 10); /* switch nametable */ - attrib_base ^= (1 << 10); - - /* recalculate pointers */ - tile_ptr = &PPU_MEM(refresh_vaddr); - attrib_ptr = &PPU_MEM(attrib_base); - } - - /* Get the attribute byte */ - attrib = *attrib_ptr++; - } - - attrib_shift ^= 2; - col_high = ((attrib >> attrib_shift) & 3) << 2; - } - } - - /* Blank left hand column if need be */ - if (ppu.bg_mask) - { - uint32 *buf_ptr = (uint32 *) vidbuf; - uint32 bg_clear = FULLBG | FULLBG << 8 | FULLBG << 16 | FULLBG << 24; - - ((uint32 *) buf_ptr)[0] = bg_clear; - ((uint32 *) buf_ptr)[1] = bg_clear; - } -} - -/* OAM entry */ -typedef struct obj_s -{ - uint8 y_loc; - uint8 tile; - uint8 atr; - uint8 x_loc; -} obj_t; - -/* TODO: fetch valid OAM a scanline before, like the Real Thing */ -static void ppu_renderoam(uint8 *vidbuf, int scanline) -{ - uint8 *buf_ptr; - uint32 vram_offset, savecol[2]; - int sprite_num, spritecount; - obj_t *sprite_ptr; - uint8 sprite_height; - - if (false == ppu.obj_on) - return; - - /* Get our buffer pointer */ - buf_ptr = vidbuf; - - /* Save left hand column? */ - if (ppu.obj_mask) - { - savecol[0] = ((uint32 *) buf_ptr)[0]; - savecol[1] = ((uint32 *) buf_ptr)[1]; - } - - sprite_height = ppu.obj_height; - vram_offset = ppu.obj_base; - spritecount = 0; - - sprite_ptr = (obj_t *) ppu.oam; - - for (sprite_num = 0; sprite_num < 64; sprite_num++, sprite_ptr++) - { - uint8 *data_ptr, *bmp_ptr; - uint32 vram_adr; - int y_offset; - uint8 tile_index, attrib, col_high; - uint8 sprite_y, sprite_x; - bool check_strike; - int strike_pixel; - - sprite_y = sprite_ptr->y_loc + 1; - - /* Check to see if sprite is out of range */ - if ((sprite_y > scanline) || (sprite_y <= (scanline - sprite_height)) - || (0 == sprite_y) || (sprite_y >= 240)) - continue; - - sprite_x = sprite_ptr->x_loc; - tile_index = sprite_ptr->tile; - attrib = sprite_ptr->atr; - - bmp_ptr = buf_ptr + sprite_x; - - /* Handle $FD/$FE tile VROM switching (PunchOut) */ - if (ppu.latchfunc) - ppu.latchfunc(vram_offset, tile_index); - - /* Get upper two bits of color */ - col_high = ((attrib & 3) << 2); - - /* 8x16 even sprites use $0000, odd use $1000 */ - if (16 == ppu.obj_height) - vram_adr = ((tile_index & 1) << 12) | ((tile_index & 0xFE) << 4); - else - vram_adr = vram_offset + (tile_index << 4); - - /* Get the address of the tile */ - data_ptr = &PPU_MEM(vram_adr); - - /* Calculate offset (line within the sprite) */ - y_offset = scanline - sprite_y; - if (y_offset > 7) - y_offset += 8; - - /* Account for vertical flippage */ - if (attrib & OAMF_VFLIP) - { - if (16 == ppu.obj_height) - y_offset -= 23; - else - y_offset -= 7; - - data_ptr -= y_offset; - } - else - { - data_ptr += y_offset; - } - - /* if we're on sprite 0 and sprite 0 strike flag isn't set, - ** check for a strike - */ - check_strike = (0 == sprite_num) && (false == ppu.strikeflag); - strike_pixel = draw_oamtile(bmp_ptr, attrib, data_ptr[0], data_ptr[8], ppu.palette + 16 + col_high, check_strike); - if (strike_pixel >= 0) - ppu_setstrike(strike_pixel); - - /* maximum of 8 sprites per scanline */ - if (++spritecount == PPU_MAXSPRITE) - { - ppu.stat |= PPU_STATF_MAXSPRITE; - break; - } - } - - /* Restore lefthand column */ - if (ppu.obj_mask) - { - ((uint32 *) buf_ptr)[0] = savecol[0]; - ((uint32 *) buf_ptr)[1] = savecol[1]; - } -} - -/* Fake rendering a line */ -/* This is needed for sprite 0 hits when we're skipping drawing a frame */ -static void ppu_fakeoam(int scanline) -{ - uint8 *data_ptr; - obj_t *sprite_ptr; - uint32 vram_adr, color; - int y_offset; - uint8 pat1, pat2; - uint8 tile_index, attrib; - uint8 sprite_height, sprite_y, sprite_x; - - /* we don't need to be here if strike flag is set */ - - if (false == ppu.obj_on || ppu.strikeflag) - return; - - sprite_height = ppu.obj_height; - sprite_ptr = (obj_t *) ppu.oam; - sprite_y = sprite_ptr->y_loc + 1; - - /* Check to see if sprite is out of range */ - if ((sprite_y > scanline) || (sprite_y <= (scanline - sprite_height)) - || (0 == sprite_y) || (sprite_y > 240)) - return; - - sprite_x = sprite_ptr->x_loc; - tile_index = sprite_ptr->tile; - attrib = sprite_ptr->atr; - - /* 8x16 even sprites use $0000, odd use $1000 */ - if (16 == ppu.obj_height) - vram_adr = ((tile_index & 1) << 12) | ((tile_index & 0xFE) << 4); - else - vram_adr = ppu.obj_base + (tile_index << 4); - - data_ptr = &PPU_MEM(vram_adr); - - /* Calculate offset (line within the sprite) */ - y_offset = scanline - sprite_y; - if (y_offset > 7) - y_offset += 8; - - /* Account for vertical flippage */ - if (attrib & OAMF_VFLIP) - { - if (16 == ppu.obj_height) - y_offset -= 23; - else - y_offset -= 7; - data_ptr -= y_offset; - } - else - { - data_ptr += y_offset; - } - - /* check for a solid sprite 0 pixel */ - pat1 = data_ptr[0]; - pat2 = data_ptr[8]; - color = ((pat2 & 0xAA) << 8) | ((pat2 & 0x55) << 1) - | ((pat1 & 0xAA) << 7) | (pat1 & 0x55); - - if (color) - { - uint8 colors[8]; - - /* buckle up, it's going to get ugly... */ - if (0 == (attrib & OAMF_HFLIP)) - { - colors[0] = (color >> 14) & 3; - colors[1] = (color >> 6) & 3; - colors[2] = (color >> 12) & 3; - colors[3] = (color >> 4) & 3; - colors[4] = (color >> 10) & 3; - colors[5] = (color >> 2) & 3; - colors[6] = (color >> 8) & 3; - colors[7] = color & 3; - } - else - { - colors[7] = (color >> 14) & 3; - colors[6] = (color >> 6) & 3; - colors[5] = (color >> 12) & 3; - colors[4] = (color >> 4) & 3; - colors[3] = (color >> 10) & 3; - colors[2] = (color >> 2) & 3; - colors[1] = (color >> 8) & 3; - colors[0] = color & 3; - } - - if (colors[0]) - ppu_setstrike(sprite_x + 0); - else if (colors[1]) - ppu_setstrike(sprite_x + 1); - else if (colors[2]) - ppu_setstrike(sprite_x + 2); - else if (colors[3]) - ppu_setstrike(sprite_x + 3); - else if (colors[4]) - ppu_setstrike(sprite_x + 4); - else if (colors[5]) - ppu_setstrike(sprite_x + 5); - else if (colors[6]) - ppu_setstrike(sprite_x + 6); - else if (colors[7]) - ppu_setstrike(sprite_x + 7); - } -} - -bool ppu_enabled(void) -{ - return (ppu.bg_on || ppu.obj_on); -} - -static uint8 line[320]; - -static void ppu_renderscanline(bitmap_t *bmp, int scanline, bool draw_flag) -{ - uint8 *buf = &line[0]; //bmp->line[scanline]; - - /* start scanline - transfer ppu latch into vaddr */ - if (ppu.bg_on || ppu.obj_on) - { - if (0 == scanline) - { - ppu.vaddr = ppu.vaddr_latch; - } - else - { - ppu.vaddr &= ~0x041F; - ppu.vaddr |= (ppu.vaddr_latch & 0x041F); - } - } - - if (draw_flag) - ppu_renderbg(buf); - - /* TODO: fetch obj data 1 scanline before */ - if (true == ppu.drawsprites && true == draw_flag) - ppu_renderoam(buf, scanline); - else - ppu_fakeoam(scanline); - - if (draw_flag) - emu_DrawLine(buf, 256, 240, scanline); -} - - -void ppu_endscanline(int scanline) -{ - /* modify vram address at end of scanline */ - if (scanline < 240 && (ppu.bg_on || ppu.obj_on)) - { - int ytile; - - /* check for max 3 bit y tile offset */ - if (7 == (ppu.vaddr >> 12)) - { - ppu.vaddr &= ~0x7000; /* clear y tile offset */ - ytile = (ppu.vaddr >> 5) & 0x1F; - - if (29 == ytile) - { - ppu.vaddr &= ~0x03E0; /* clear y tile */ - ppu.vaddr ^= 0x0800; /* toggle nametable */ - } - else if (31 == ytile) - { - ppu.vaddr &= ~0x03E0; /* clear y tile */ - } - else - { - ppu.vaddr += 0x20; /* increment y tile */ - } - } - else - { - ppu.vaddr += 0x1000; /* increment tile y offset */ - } - } -} - -void ppu_checknmi(void) -{ - if (ppu.ctrl0 & PPU_CTRL0F_NMI) - nes_nmi(); -} - -void ppu_scanline(bitmap_t *bmp, int scanline, bool draw_flag) -{ - if (scanline < 240) - { - /* Lower the Max Sprite per scanline flag */ - ppu.stat &= ~PPU_STATF_MAXSPRITE; - ppu_renderscanline(bmp, scanline, draw_flag); - } - else if (241 == scanline) - { - ppu.stat |= PPU_STATF_VBLANK; - ppu.vram_accessible = true; - } - else if (261 == scanline) - { - ppu.stat &= ~PPU_STATF_VBLANK; - ppu.strikeflag = false; - ppu.strike_cycle = (uint32) -1; - - ppu.vram_accessible = false; - } -} - - - -/* Stuff for the OAM viewer */ -static void draw_sprite(bitmap_t *bmp, int x, int y, uint8 tile_num, uint8 attrib) -{ - int line, height; - int col_high, vram_adr; - uint8 *vid, *data_ptr; - - vid = bmp->line[y] + x; - - /* Get upper two bits of color */ - col_high = ((attrib & 3) << 2); - - /* 8x16 even sprites use $0000, odd use $1000 */ - height = ppu.obj_height; - if (16 == height) - vram_adr = ((tile_num & 1) << 12) | ((tile_num & 0xFE) << 4); - /* else just use the offset from $2000 */ - else - vram_adr = ppu.obj_base + (tile_num << 4); - - data_ptr = &PPU_MEM(vram_adr); - - for (line = 0; line < height; line++) - { - if (line == 8) - data_ptr += 8; - - draw_bgtile(vid, data_ptr[0], data_ptr[8], ppu.palette + 16 + col_high); - //draw_oamtile(vid, attrib, data_ptr[0], data_ptr[8], ppu.palette + 16 + col_high); - - data_ptr++; - vid += bmp->pitch; - } -} - -void ppu_dumpoam(bitmap_t *bmp, int x_loc, int y_loc) -{ - int sprite, x_pos, y_pos, height; - obj_t *spr_ptr; - - spr_ptr = (obj_t *) ppu.oam; - height = ppu.obj_height; - - for (sprite = 0; sprite < 64; sprite++) - { - x_pos = ((sprite & 0x0F) << 3) + (sprite & 0x0F) + x_loc; - if (height == 16) - y_pos = (sprite & 0xF0) + (sprite >> 4) + y_loc; - else - y_pos = ((sprite & 0xF0) >> 1) + (sprite >> 4) + y_loc; - - draw_box(bmp, x_pos, y_pos, height); - - if (spr_ptr->y_loc && spr_ptr->y_loc < 240) - draw_sprite(bmp, x_pos + 1, y_pos + 1, spr_ptr->tile, spr_ptr->atr); - else - draw_deadsprite(bmp, x_pos + 1, y_pos + 1, height); - - spr_ptr++; - } -} - -/* More of a debugging thing than anything else */ -void ppu_dumppattern(bitmap_t *bmp, int table_num, int x_loc, int y_loc, int col) -{ - int x_tile, y_tile; - uint8 *bmp_ptr, *data_ptr, *ptr; - int tile_num, line; - uint8 col_high; - - tile_num = 0; - col_high = col << 2; - - for (y_tile = 0; y_tile < 16; y_tile++) - { - /* Get our pointer to the bitmap */ - bmp_ptr = bmp->line[y_loc] + x_loc; - - for (x_tile = 0; x_tile < 16; x_tile++) - { - data_ptr = &PPU_MEM((table_num << 12) + (tile_num << 4)); - ptr = bmp_ptr; - - for (line = 0; line < 8; line ++) - { - draw_bgtile(ptr, data_ptr[0], data_ptr[8], ppu.palette + col_high); - data_ptr++; - ptr += bmp->pitch; - } - - bmp_ptr += 8; - tile_num++; - } - y_loc += 8; - } -} - -/* -** $Log: nes_ppu.c,v $ -** Revision 1.2 2001/04/27 14:37:11 neil -** wheeee -** -** Revision 1.1.1.1 2001/04/27 07:03:54 neil -** initial -** -** Revision 1.14 2000/11/29 12:58:23 matt -** timing/fiq fixes -** -** Revision 1.13 2000/11/27 19:36:15 matt -** more timing fixes -** -** Revision 1.12 2000/11/26 15:51:13 matt -** frame IRQ emulation -** -** Revision 1.11 2000/11/25 20:30:39 matt -** scanline emulation simplifications/timing fixes -** -** Revision 1.10 2000/11/24 14:56:02 matt -** fixed a long-standing sprite 0 strike bug -** -** Revision 1.9 2000/11/20 13:23:17 matt -** PPU fixes -** -** Revision 1.8 2000/11/19 13:47:30 matt -** problem with frame irqs fixed -** -** Revision 1.7 2000/11/19 13:40:19 matt -** more accurate ppu behavior -** -** Revision 1.6 2000/11/14 12:09:37 matt -** only generate the palette once, please -** -** Revision 1.5 2000/11/11 14:51:43 matt -** context get/set fixed -** -** Revision 1.4 2000/11/09 12:35:50 matt -** fixed timing problem with VRAM reads/writes -** -** Revision 1.3 2000/11/05 16:35:41 matt -** rolled rgb.h into bitmap.h -** -** Revision 1.2 2000/10/27 12:55:03 matt -** palette generating functions now take *this pointers -** -** Revision 1.1 2000/10/24 12:20:28 matt -** changed directory structure -** -** Revision 1.33 2000/10/23 15:53:08 matt -** better system handling -** -** Revision 1.32 2000/10/22 15:02:32 matt -** simplified mirroring -** -** Revision 1.31 2000/10/21 21:36:04 matt -** ppu cleanups / fixes -** -** Revision 1.30 2000/10/21 19:26:59 matt -** many more cleanups -** -** Revision 1.29 2000/10/10 13:58:15 matt -** stroustrup squeezing his way in the door -** -** Revision 1.28 2000/10/08 17:54:32 matt -** reject VRAM access out of VINT period -** -** Revision 1.27 2000/09/15 04:58:07 matt -** simplifying and optimizing APU core -** -** Revision 1.26 2000/09/08 11:57:29 matt -** no more nes_fiq -** -** Revision 1.25 2000/09/07 21:57:31 matt -** api change -** -** Revision 1.24 2000/07/31 04:27:59 matt -** one million cleanups -** -** Revision 1.23 2000/07/30 06:13:12 matt -** default to no FIQs on startup -** -** Revision 1.22 2000/07/30 04:32:32 matt -** emulation of the NES frame IRQ -** -** Revision 1.21 2000/07/25 02:25:53 matt -** safer xxx_destroy calls -** -** Revision 1.20 2000/07/23 15:12:43 matt -** removed unused variables, changed INLINE -** -** Revision 1.19 2000/07/21 04:50:39 matt -** moved palette calls out of nofrendo.c and into ppu_create -** -** Revision 1.18 2000/07/17 05:12:55 matt -** nes_ppu.c is no longer a scary place to be-- cleaner & faster -** -** Revision 1.17 2000/07/17 01:52:28 matt -** made sure last line of all source files is a newline -** -** Revision 1.16 2000/07/11 04:42:39 matt -** updated for new screen dimension defines -** -** Revision 1.15 2000/07/10 19:10:16 matt -** should bomb out now if a game tries to write to VROM -** -** Revision 1.14 2000/07/10 05:28:30 matt -** moved joypad/oam dma from apu to ppu -** -** Revision 1.13 2000/07/10 03:03:16 matt -** added ppu_getcontext() routine -** -** Revision 1.12 2000/07/09 03:46:05 matt -** using pitch instead of width... -** -** Revision 1.11 2000/07/06 16:42:40 matt -** better palette setting interface -** -** Revision 1.10 2000/07/05 22:49:25 matt -** changed mmc2 (punchout) tile-access switching -** -** Revision 1.9 2000/07/04 23:13:26 matt -** added an irq line drawing debug feature hack -** -** Revision 1.8 2000/06/26 04:58:08 matt -** accuracy changes -** -** Revision 1.7 2000/06/22 02:13:49 matt -** more accurate emulation of $2002 -** -** Revision 1.6 2000/06/20 20:42:47 matt -** accuracy changes -** -** Revision 1.5 2000/06/20 00:05:12 matt -** tested and verified STAT quirk, added code -** -** Revision 1.4 2000/06/09 15:12:26 matt -** initial revision -** -*/ diff --git a/MCUME_pico/piconofrendo/nes_ppu.h b/MCUME_pico/piconofrendo/nes_ppu.h deleted file mode 100755 index 46a9813..0000000 --- a/MCUME_pico/piconofrendo/nes_ppu.h +++ /dev/null @@ -1,241 +0,0 @@ -/* -** Nofrendo (c) 1998-2000 Matthew Conte (matt@conte.com) -** -** -** This program is free software; you can redistribute it and/or -** modify it under the terms of version 2 of the GNU Library General -** Public License as published by the Free Software Foundation. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** Library General Public License for more details. To obtain a -** copy of the GNU Library General Public License, write to the Free -** Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -** -** Any permitted reproduction of these routines, in whole or in part, -** must bear this legend. -** -** -** nes_ppu.h -** -** NES Picture Processing Unit (PPU) emulation header file -** $Id: nes_ppu.h,v 1.2 2001/04/27 14:37:11 neil Exp $ -*/ - -#ifndef _NES_PPU_H_ -#define _NES_PPU_H_ - -#include "bitmap.h" - -/* PPU register defines */ -#define PPU_CTRL0 0x2000 -#define PPU_CTRL1 0x2001 -#define PPU_STAT 0x2002 -#define PPU_OAMADDR 0x2003 -#define PPU_OAMDATA 0x2004 -#define PPU_SCROLL 0x2005 -#define PPU_VADDR 0x2006 -#define PPU_VDATA 0x2007 - -#define PPU_OAMDMA 0x4014 -#define PPU_JOY0 0x4016 -#define PPU_JOY1 0x4017 - -/* $2000 */ -#define PPU_CTRL0F_NMI 0x80 -#define PPU_CTRL0F_OBJ16 0x20 -#define PPU_CTRL0F_BGADDR 0x10 -#define PPU_CTRL0F_OBJADDR 0x08 -#define PPU_CTRL0F_ADDRINC 0x04 -#define PPU_CTRL0F_NAMETAB 0x03 - -/* $2001 */ -#define PPU_CTRL1F_OBJON 0x10 -#define PPU_CTRL1F_BGON 0x08 -#define PPU_CTRL1F_OBJMASK 0x04 -#define PPU_CTRL1F_BGMASK 0x02 - -/* $2002 */ -#define PPU_STATF_VBLANK 0x80 -#define PPU_STATF_STRIKE 0x40 -#define PPU_STATF_MAXSPRITE 0x20 - -/* Sprite attribute byte bitmasks */ -#define OAMF_VFLIP 0x80 -#define OAMF_HFLIP 0x40 -#define OAMF_BEHIND 0x20 - -/* Maximum number of sprites per horizontal scanline */ -#define PPU_MAXSPRITE 8 - -/* some mappers do *dumb* things */ -typedef void (*ppulatchfunc_t)(uint32 address, uint8 value); -typedef void (*ppuvromswitch_t)(uint8 value); - -typedef struct ppu_s -{ - /* big nasty memory chunks */ - uint8 nametab[0x1000]; - uint8 oam[256]; - uint8 palette[32]; - uint8 *page[16]; - - /* hardware registers */ - uint8 ctrl0, ctrl1, stat, oam_addr; - uint32 vaddr, vaddr_latch; - int tile_xofs, flipflop; - int vaddr_inc; - uint32 tile_nametab; - - uint8 obj_height; - uint32 obj_base, bg_base; - - bool bg_on, obj_on; - bool obj_mask, bg_mask; - - uint8 latch, vdata_latch; - uint8 strobe; - - bool strikeflag; - uint32 strike_cycle; - - /* callbacks for naughty mappers */ - ppulatchfunc_t latchfunc; - ppuvromswitch_t vromswitch; - - /* copy of our current palette */ - rgb_t curpal[256]; - - bool vram_accessible; - - bool vram_present; - bool drawsprites; -} ppu_t; - - -/* TODO: should use this pointers */ -extern void ppu_setlatchfunc(ppulatchfunc_t func); -extern void ppu_setvromswitch(ppuvromswitch_t func); - -extern void ppu_getcontext(ppu_t *dest_ppu); -extern void ppu_setcontext(ppu_t *src_ppu); - -/* Mirroring */ -/* TODO: this is only used bloody once */ -extern void ppu_mirrorhipages(void); - -extern void ppu_mirror(int nt1, int nt2, int nt3, int nt4); - -extern void ppu_setpage(int size, int page_num, uint8 *location); -extern uint8 *ppu_getpage(int page); - - -/* control */ -extern void ppu_reset(int reset_type); -extern bool ppu_enabled(void); -extern void ppu_scanline(bitmap_t *bmp, int scanline, bool draw_flag); -extern void ppu_endscanline(int scanline); -extern void ppu_checknmi(); - -extern ppu_t *ppu_create(void); -extern void ppu_destroy(ppu_t **ppu); - -/* IO */ -extern uint8 ppu_read(uint32 address); -extern void ppu_write(uint32 address, uint8 value); -extern uint8 ppu_readhigh(uint32 address); -extern void ppu_writehigh(uint32 address, uint8 value); - -/* rendering */ -extern void ppu_setpal(ppu_t *src_ppu, rgb_t *pal); -extern void ppu_setdefaultpal(ppu_t *src_ppu); - -/* bleh */ -extern void ppu_dumppattern(bitmap_t *bmp, int table_num, int x_loc, int y_loc, int col); -extern void ppu_dumpoam(bitmap_t *bmp, int x_loc, int y_loc); -extern void ppu_displaysprites(bool display); - -#endif /* _NES_PPU_H_ */ - -/* -** $Log: nes_ppu.h,v $ -** Revision 1.2 2001/04/27 14:37:11 neil -** wheeee -** -** Revision 1.1.1.1 2001/04/27 07:03:54 neil -** initial -** -** Revision 1.8 2000/11/29 12:58:23 matt -** timing/fiq fixes -** -** Revision 1.7 2000/11/27 19:36:16 matt -** more timing fixes -** -** Revision 1.6 2000/11/26 15:51:13 matt -** frame IRQ emulation -** -** Revision 1.5 2000/11/25 20:30:39 matt -** scanline emulation simplifications/timing fixes -** -** Revision 1.4 2000/11/19 13:40:19 matt -** more accurate ppu behavior -** -** Revision 1.3 2000/11/05 16:35:41 matt -** rolled rgb.h into bitmap.h -** -** Revision 1.2 2000/10/27 12:55:03 matt -** palette generating functions now take *this pointers -** -** Revision 1.1 2000/10/24 12:20:28 matt -** changed directory structure -** -** Revision 1.19 2000/10/22 15:02:32 matt -** simplified mirroring -** -** Revision 1.18 2000/10/21 21:36:04 matt -** ppu cleanups / fixes -** -** Revision 1.17 2000/10/21 19:26:59 matt -** many more cleanups -** -** Revision 1.16 2000/10/10 13:58:15 matt -** stroustrup squeezing his way in the door -** -** Revision 1.15 2000/07/31 04:27:59 matt -** one million cleanups -** -** Revision 1.14 2000/07/30 04:32:33 matt -** emulation of the NES frame IRQ -** -** Revision 1.13 2000/07/25 02:25:53 matt -** safer xxx_destroy calls -** -** Revision 1.12 2000/07/17 05:12:56 matt -** nes_ppu.c is no longer a scary place to be-- cleaner & faster -** -** Revision 1.11 2000/07/17 01:52:28 matt -** made sure last line of all source files is a newline -** -** Revision 1.10 2000/07/10 05:28:30 matt -** moved joypad/oam dma from apu to ppu -** -** Revision 1.9 2000/07/10 03:03:16 matt -** added ppu_getcontext() routine -** -** Revision 1.8 2000/07/06 16:42:40 matt -** better palette setting interface -** -** Revision 1.7 2000/07/04 23:13:26 matt -** added an irq line drawing debug feature hack -** -** Revision 1.6 2000/06/26 04:58:08 matt -** accuracy changes -** -** Revision 1.5 2000/06/20 00:04:35 matt -** removed STATQUIRK macro -** -** Revision 1.4 2000/06/09 15:12:26 matt -** initial revision -** -*/ diff --git a/MCUME_pico/piconofrendo/nes_rom.h b/MCUME_pico/piconofrendo/nes_rom.h deleted file mode 100755 index f6c17a2..0000000 --- a/MCUME_pico/piconofrendo/nes_rom.h +++ /dev/null @@ -1,110 +0,0 @@ -/* -** Nofrendo (c) 1998-2000 Matthew Conte (matt@conte.com) -** -** -** This program is free software; you can redistribute it and/or -** modify it under the terms of version 2 of the GNU Library General -** Public License as published by the Free Software Foundation. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** Library General Public License for more details. To obtain a -** copy of the GNU Library General Public License, write to the Free -** Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -** -** Any permitted reproduction of these routines, in whole or in part, -** must bear this legend. -** -** -** nes_rom.h -** -** NES ROM loading/saving related defines / prototypes -** $Id: nes_rom.h,v 1.2 2001/04/27 14:37:11 neil Exp $ -*/ - -#ifndef _NES_ROM_H_ -#define _NES_ROM_H_ - -#include -#include "osd.h" - -typedef enum -{ - MIRROR_HORIZ = 0, - MIRROR_VERT = 1 -} mirror_t; - -#define ROM_FLAG_BATTERY 0x01 -#define ROM_FLAG_TRAINER 0x02 -#define ROM_FLAG_FOURSCREEN 0x04 -#define ROM_FLAG_VERSUS 0x08 - -typedef struct rominfo_s -{ - /* pointers to ROM and VROM */ - uint8 *rom, *vrom; - - /* pointers to SRAM and VRAM */ - uint8 *sram, *vram; - - /* number of banks */ - int rom_banks, vrom_banks; - int sram_banks, vram_banks; - - int mapper_number; - mirror_t mirror; - - uint8 flags; - - char filename[PATH_MAX + 1]; -} rominfo_t; - - -extern int rom_checkmagic(const char *filename); -extern rominfo_t *rom_load(const char *filename); -extern void rom_free(rominfo_t **rominfo); -extern char *rom_getinfo(rominfo_t *rominfo); - - -#endif /* _NES_ROM_H_ */ - -/* -** $Log: nes_rom.h,v $ -** Revision 1.2 2001/04/27 14:37:11 neil -** wheeee -** -** Revision 1.1.1.1 2001/04/27 07:03:54 neil -** initial -** -** Revision 1.2 2000/10/25 01:23:08 matt -** basic system autodetection -** -** Revision 1.1 2000/10/24 12:20:28 matt -** changed directory structure -** -** Revision 1.11 2000/10/22 15:01:29 matt -** irrelevant mirroring modes removed -** -** Revision 1.10 2000/10/17 03:22:38 matt -** cleaning up rom module -** -** Revision 1.9 2000/10/10 13:58:13 matt -** stroustrup squeezing his way in the door -** -** Revision 1.8 2000/10/10 13:03:54 matt -** Mr. Clean makes a guest appearance -** -** Revision 1.7 2000/07/25 02:20:58 matt -** cleanups -** -** Revision 1.6 2000/07/19 15:59:39 neil -** PATH_MAX, strncpy, snprintf, and strncat are our friends -** -** Revision 1.5 2000/07/17 01:52:27 matt -** made sure last line of all source files is a newline -** -** Revision 1.4 2000/06/09 15:12:25 matt -** initial revision -** -*/ diff --git a/MCUME_pico/piconofrendo/nes_rom_light.c b/MCUME_pico/piconofrendo/nes_rom_light.c deleted file mode 100644 index b3bffd3..0000000 --- a/MCUME_pico/piconofrendo/nes_rom_light.c +++ /dev/null @@ -1,411 +0,0 @@ -/* -** Nofrendo (c) 1998-2000 Matthew Conte (matt@conte.com) -** -** -** This program is free software; you can redistribute it and/or -** modify it under the terms of version 2 of the GNU Library General -** Public License as published by the Free Software Foundation. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** Library General Public License for more details. To obtain a -** copy of the GNU Library General Public License, write to the Free -** Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -** -** Any permitted reproduction of these routines, in whole or in part, -** must bear this legend. -** -** -** nes_rom.c -** -** NES ROM loading/saving related functions -** $Id: nes_rom.c,v 1.2 2001/04/27 14:37:11 neil Exp $ -*/ - -/* TODO: make this a generic ROM loading routine */ - -#include -#include -#include "noftypes.h" -#include "nes_rom.h" -#include "nes_mmc.h" -#include "nes_ppu.h" -#include "nes.h" -#include "log.h" -#include "osd.h" - -extern char *osd_getromdata(); - -/* Max length for displayed filename */ -#define ROM_DISP_MAXLEN 20 - - -#define ROM_FOURSCREEN 0x08 -#define ROM_TRAINER 0x04 -#define ROM_BATTERY 0x02 -#define ROM_MIRRORTYPE 0x01 -#define ROM_INES_MAGIC "NES\x1A" - -//ToDo: packed - JD -typedef struct inesheader_s -{ - uint8 ines_magic[4] ; - uint8 rom_banks ; - uint8 vrom_banks ; - uint8 rom_type ; - uint8 mapper_hinybble ; - uint8 reserved[8] ; -} inesheader_t; - - -#define TRAINER_OFFSET 0x1000 -#define TRAINER_LENGTH 0x200 -#define VRAM_LENGTH 0x2000 - -#define ROM_BANK_LENGTH 0x4000 -#define VROM_BANK_LENGTH 0x2000 - -#define SRAM_BANK_LENGTH 0x0400 -#define VRAM_BANK_LENGTH 0x2000 - - - - - -static int rom_loadrom(unsigned char **rom, rominfo_t *rominfo) -{ - ASSERT(rom); - ASSERT(rominfo); - /* Allocate ROM space, and load it up! */ - rominfo->rom=*rom; - *rom+=ROM_BANK_LENGTH*rominfo->rom_banks; - - /* If there's VROM, allocate and stuff it in */ - if (rominfo->vrom_banks) - { - rominfo->vrom=*rom; - *rom+=VROM_BANK_LENGTH*rominfo->vrom_banks; - } - else - { - rominfo->vram = emu_Malloc(VRAM_LENGTH); - if (NULL == rominfo->vram) - { - return -1; - } - memset(rominfo->vram, 0, VRAM_LENGTH); - } - return 0; -} - - -static int *rom_findrom(const char *filename, rominfo_t *rominfo) -{ - int fp; - - ASSERT(rominfo); - - if (NULL == filename) - return NULL; - - /* Make a copy of the name so we can extend it */ - osd_fullname(rominfo->filename, filename); - - fp = emu_FileOpen(rominfo->filename); - if (!fp) - { - /* Didn't find the file? Maybe the .NES extension was omitted */ - if (NULL == strrchr(rominfo->filename, '.')) - strncat(rominfo->filename, ".nes", PATH_MAX - strlen(rominfo->filename)); - - /* this will either return NULL or a valid file pointer */ - fp = emu_FileOpen(rominfo->filename); - } - - return fp; -} - -/* Add ROM name to a list with dirty headers */ -static int rom_adddirty(char *filename) -{ - return 0; -} - -/* return 0 if this *is* an iNES file */ -int rom_checkmagic(const char *filename) -{ - inesheader_t head; - rominfo_t rominfo; - int fp; - - fp = rom_findrom(filename, &rominfo); - if (0 == fp) - return -1; - - emu_FileRead(&head, 1*sizeof(head)); - - emu_FileClose(); - - if (0 == memcmp(head.ines_magic, ROM_INES_MAGIC, 4)) - /* not an iNES file */ - return 0; - - return -1; -} - - - -static int rom_getheader(unsigned char **rom, rominfo_t *rominfo) -{ -#define RESERVED_LENGTH 8 - inesheader_t head; - uint8 reserved[RESERVED_LENGTH]; - bool header_dirty; - - ASSERT(rom); - ASSERT(*rom); - ASSERT(rominfo); - - /* Read in the header */ -// _fread(&head, 1, sizeof(head), fp); - log_printf("Head: %p (%x %x %x %x)\n", *rom, (*rom)[0], (*rom)[1], (*rom)[2], (*rom)[3]); - memcpy(&head, *rom, sizeof(head)); - *rom+=sizeof(head); - - if (memcmp(head.ines_magic, ROM_INES_MAGIC, 4)) - { - return -1; - } - - rominfo->rom_banks = head.rom_banks; - rominfo->vrom_banks = head.vrom_banks; - /* iNES assumptions */ - rominfo->sram_banks = 8; /* 1kB banks, so 8KB */ - rominfo->vram_banks = 1; /* 8kB banks, so 8KB */ - rominfo->mirror = (head.rom_type & ROM_MIRRORTYPE) ? MIRROR_VERT : MIRROR_HORIZ; - rominfo->flags = 0; - if (head.rom_type & ROM_BATTERY) - rominfo->flags |= ROM_FLAG_BATTERY; - if (head.rom_type & ROM_TRAINER) - rominfo->flags |= ROM_FLAG_TRAINER; - if (head.rom_type & ROM_FOURSCREEN) - rominfo->flags |= ROM_FLAG_FOURSCREEN; - /* TODO: fourscreen a mirroring type? */ - rominfo->mapper_number = head.rom_type >> 4; - - /* Do a compare - see if we've got a clean extended header */ - memset(reserved, 0, RESERVED_LENGTH); - if (0 == memcmp(head.reserved, reserved, RESERVED_LENGTH)) - { - /* We were clean */ - header_dirty = false; - rominfo->mapper_number |= (head.mapper_hinybble & 0xF0); - } - else - { - header_dirty = true; - - /* @!?#@! DiskDude. */ - if (('D' == head.mapper_hinybble) && (0 == memcmp(head.reserved, "iskDude!", 8))) - log_printf("`DiskDude!' found in ROM header, ignoring high mapper nybble\n"); - else - { - log_printf("ROM header dirty, possible problem\n"); - rominfo->mapper_number |= (head.mapper_hinybble & 0xF0); - } - - rom_adddirty(rominfo->filename); - } - - /* TODO: this is an ugly hack, but necessary, I guess */ - /* Check for VS unisystem mapper */ - if (99 == rominfo->mapper_number) - rominfo->flags |= ROM_FLAG_VERSUS; - - return 0; -} - -/* Build the info string for ROM display */ -char *rom_getinfo(rominfo_t *rominfo) -{ - static char info[PATH_MAX + 1]; - char romname[PATH_MAX + 1], temp[PATH_MAX + 1]; - - /* Look to see if we were given a path along with filename */ - /* TODO: strip extensions */ - if (strrchr(rominfo->filename, PATH_SEP)) - strncpy(romname, strrchr(rominfo->filename, PATH_SEP) + 1, PATH_MAX); - else - strncpy(romname, rominfo->filename, PATH_MAX); - - /* If our filename is too long, truncate our displayed filename */ - if (strlen(romname) > ROM_DISP_MAXLEN) - { - strncpy(info, romname, ROM_DISP_MAXLEN - 3); - strcpy(info + (ROM_DISP_MAXLEN - 3), "..."); - } - else - { - strcpy(info, romname); - } - - sprintf(temp, " [%d] %dk/%dk %c", rominfo->mapper_number, - rominfo->rom_banks * 16, rominfo->vrom_banks * 8, - (rominfo->mirror == MIRROR_VERT) ? 'V' : 'H'); - - /* Stick it on there! */ - strncat(info, temp, PATH_MAX - strlen(info)); - - if (rominfo->flags & ROM_FLAG_BATTERY) - strncat(info, "B", PATH_MAX - strlen(info)); - if (rominfo->flags & ROM_FLAG_TRAINER) - strncat(info, "T", PATH_MAX - strlen(info)); - if (rominfo->flags & ROM_FLAG_FOURSCREEN) - strncat(info, "4", PATH_MAX - strlen(info)); - - return info; -} - -/* Load a ROM image into memory */ -rominfo_t *rom_load(const char *filename) -{ - unsigned char *rom=(unsigned char*)osd_getromdata(); - rominfo_t *rominfo; - - rominfo = emu_Malloc(sizeof(rominfo_t)); - if (NULL == rominfo) - return NULL; - - memset(rominfo, 0, sizeof(rominfo_t)); - - /* Get the header and stick it into rominfo struct */ - if (rom_getheader(&rom, rominfo)) - goto _fail; - - /* Make sure we really support the mapper */ - if (false == mmc_peek(rominfo->mapper_number)) - { - goto _fail; - } - - if (rom_loadrom(&rom, rominfo)) - goto _fail; - - return rominfo; - -_fail: - rom_free(&rominfo); - return NULL; -} - -/* Free a ROM */ -void rom_free(rominfo_t **rominfo) -{ - if (NULL == *rominfo) - { - return; - } - - /* Restore palette if we loaded in a VS jobber */ - if ((*rominfo)->flags & ROM_FLAG_VERSUS) - { - /* TODO: bad idea calling nes_getcontextptr... */ - ppu_setdefaultpal(nes_getcontextptr()->ppu); - log_printf("Default NES palette restored\n"); - } - - - if ((*rominfo)->sram) - free((*rominfo)->sram); - if ((*rominfo)->rom) - free((*rominfo)->rom); - if ((*rominfo)->vrom) - free((*rominfo)->vrom); - if ((*rominfo)->vram) - free((*rominfo)->vram); - - free(*rominfo); -} - -/* -** $Log: nes_rom.c,v $ -** Revision 1.2 2001/04/27 14:37:11 neil -** wheeee -** -** Revision 1.1.1.1 2001/04/27 07:03:54 neil -** initial -** -** Revision 1.8 2000/11/21 13:28:40 matt -** take care to zero allocated mem -** -** Revision 1.7 2000/11/09 14:07:28 matt -** state load fixed, state save mostly fixed -** -** Revision 1.6 2000/10/28 14:24:54 matt -** where did I put that underscore? -** -** Revision 1.5 2000/10/27 12:56:35 matt -** api change for ppu palette functions -** -** Revision 1.4 2000/10/26 22:51:44 matt -** correct NULL filename handling -** -** Revision 1.3 2000/10/25 01:23:08 matt -** basic system autodetection -** -** Revision 1.2 2000/10/25 00:23:16 matt -** makefiles updated for new directory structure -** -** Revision 1.1 2000/10/24 12:20:28 matt -** changed directory structure -** -** Revision 1.19 2000/10/21 14:35:58 matt -** typo -** -** Revision 1.18 2000/10/17 03:22:37 matt -** cleaning up rom module -** -** Revision 1.17 2000/10/10 13:58:13 matt -** stroustrup squeezing his way in the door -** -** Revision 1.16 2000/10/10 13:03:54 matt -** Mr. Clean makes a guest appearance -** -** Revision 1.15 2000/07/31 04:28:46 matt -** one million cleanups -** -** Revision 1.14 2000/07/30 04:31:26 matt -** automagic loading of the nofrendo intro -** -** Revision 1.13 2000/07/25 02:20:58 matt -** cleanups -** -** Revision 1.12 2000/07/20 01:53:27 matt -** snprintf() ain't no standard function, eh? -** -** Revision 1.11 2000/07/19 16:06:54 neil -** little error fixed (tempinfo vs rominfo->info) -** -** Revision 1.10 2000/07/19 15:59:39 neil -** PATH_MAX, strncpy, snprintf, and strncat are our friends -** -** Revision 1.9 2000/07/17 01:52:27 matt -** made sure last line of all source files is a newline -** -** Revision 1.8 2000/07/06 16:47:50 matt -** new ppu palette setting calls -** -** Revision 1.7 2000/07/05 23:21:54 neil -** fclose(fp) should not be done if fp == NULL -** -** Revision 1.6 2000/07/04 04:45:14 matt -** changed include -** -** Revision 1.5 2000/06/26 04:56:10 matt -** minor cleanup -** -** Revision 1.4 2000/06/09 15:12:25 matt -** initial revision -** -*/ diff --git a/MCUME_pico/piconofrendo/nesinput.c b/MCUME_pico/piconofrendo/nesinput.c deleted file mode 100755 index f881070..0000000 --- a/MCUME_pico/piconofrendo/nesinput.c +++ /dev/null @@ -1,212 +0,0 @@ -/* -** Nofrendo (c) 1998-2000 Matthew Conte (matt@conte.com) -** -** -** This program is free software; you can redistribute it and/or -** modify it under the terms of version 2 of the GNU Library General -** Public License as published by the Free Software Foundation. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** Library General Public License for more details. To obtain a -** copy of the GNU Library General Public License, write to the Free -** Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -** -** Any permitted reproduction of these routines, in whole or in part, -** must bear this legend. -** -** -** nesinput.c -** -** Event handling system routines -** $Id: nesinput.c,v 1.2 2001/04/27 14:37:11 neil Exp $ -*/ - -#include "noftypes.h" -#include "nesinput.h" -#include "log.h" - -/* TODO: make a linked list of inputs sources, so they -** can be removed if need be -*/ - -static nesinput_t *nes_input[MAX_CONTROLLERS]; -static int active_entries = 0; - -/* read counters */ -static int pad0_readcount, pad1_readcount, ppad_readcount, ark_readcount; - - -static int retrieve_type(int type) -{ - int i, value = 0; - - for (i = 0; i < active_entries; i++) - { - ASSERT(nes_input[i]); - - if (type == nes_input[i]->type) - value |= nes_input[i]->data; - } - - return value; -} - -static uint8 get_pad0(void) -{ - uint8 value; - - value = (uint8) retrieve_type(INP_JOYPAD0); - - /* mask out left/right simultaneous keypresses */ - if ((value & INP_PAD_UP) && (value & INP_PAD_DOWN)) - value &= ~(INP_PAD_UP | INP_PAD_DOWN); - - if ((value & INP_PAD_LEFT) && (value & INP_PAD_RIGHT)) - value &= ~(INP_PAD_LEFT | INP_PAD_RIGHT); - - /* return (0x40 | value) due to bus conflicts */ - return (0x40 | ((value >> pad0_readcount++) & 1)); -} - -static uint8 get_pad1(void) -{ - uint8 value; - - value = (uint8) retrieve_type(INP_JOYPAD1); - - /* mask out left/right simultaneous keypresses */ - if ((value & INP_PAD_UP) && (value & INP_PAD_DOWN)) - value &= ~(INP_PAD_UP | INP_PAD_DOWN); - - if ((value & INP_PAD_LEFT) && (value & INP_PAD_RIGHT)) - value &= ~(INP_PAD_LEFT | INP_PAD_RIGHT); - - /* return (0x40 | value) due to bus conflicts */ - return (0x40 | ((value >> pad1_readcount++) & 1)); -} - -static uint8 get_zapper(void) -{ - return (uint8) (retrieve_type(INP_ZAPPER)); -} - -static uint8 get_powerpad(void) -{ - int value; - uint8 ret_val = 0; - - value = retrieve_type(INP_POWERPAD); - - if (((value >> 8) >> ppad_readcount) & 1) - ret_val |= 0x10; - if (((value & 0xFF) >> ppad_readcount) & 1) - ret_val |= 0x08; - - ppad_readcount++; - - return ret_val; -} - -static uint8 get_vsdips0(void) -{ - return (retrieve_type(INP_VSDIPSW0)); -} - -static uint8 get_vsdips1(void) -{ - return (retrieve_type(INP_VSDIPSW1)); -} - -static uint8 get_arkanoid(void) -{ - uint8 value = retrieve_type(INP_ARKANOID); - - if ((value >> (7 - ark_readcount++)) & 1) - return 0x02; - else - return 0; -} - -/* return input state for all types indicated (can be ORed together) */ -uint8 input_get(int types) -{ - uint8 value = 0; - - if (types & INP_JOYPAD0) - value |= get_pad0(); - if (types & INP_JOYPAD1) - value |= get_pad1(); - if (types & INP_ZAPPER) - value |= get_zapper(); - if (types & INP_POWERPAD) - value |= get_powerpad(); - if (types & INP_VSDIPSW0) - value |= get_vsdips0(); - if (types & INP_VSDIPSW1) - value |= get_vsdips1(); - if (types & INP_ARKANOID) - value |= get_arkanoid(); - - return value; -} - -/* register an input type */ -void input_register(nesinput_t *input) -{ - if (NULL == input) - return; - - nes_input[active_entries] = input; - active_entries++; -} - -void input_event(nesinput_t *input, int state, int value) -{ - ASSERT(input); - - if (state == INP_STATE_MAKE) - input->data |= value; /* OR it in */ - else /* break state */ - input->data &= ~value; /* mask it out */ -} - -void input_strobe(void) -{ - pad0_readcount = 0; - pad1_readcount = 0; - ppad_readcount = 0; - ark_readcount = 0; -} - -/* -** $Log: nesinput.c,v $ -** Revision 1.2 2001/04/27 14:37:11 neil -** wheeee -** -** Revision 1.1.1.1 2001/04/27 07:03:54 neil -** initial -** -** Revision 1.1 2000/10/24 12:20:28 matt -** changed directory structure -** -** Revision 1.9 2000/09/10 23:25:03 matt -** minor changes -** -** Revision 1.8 2000/07/31 04:27:59 matt -** one million cleanups -** -** Revision 1.7 2000/07/23 15:11:45 matt -** removed unused variables -** -** Revision 1.6 2000/07/17 01:52:28 matt -** made sure last line of all source files is a newline -** -** Revision 1.5 2000/07/04 04:56:50 matt -** include changes -** -** Revision 1.4 2000/06/09 15:12:26 matt -** initial revision -** -*/ diff --git a/MCUME_pico/piconofrendo/nesinput.h b/MCUME_pico/piconofrendo/nesinput.h deleted file mode 100755 index 49871dc..0000000 --- a/MCUME_pico/piconofrendo/nesinput.h +++ /dev/null @@ -1,104 +0,0 @@ -/* -** Nofrendo (c) 1998-2000 Matthew Conte (matt@conte.com) -** -** -** This program is free software; you can redistribute it and/or -** modify it under the terms of version 2 of the GNU Library General -** Public License as published by the Free Software Foundation. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** Library General Public License for more details. To obtain a -** copy of the GNU Library General Public License, write to the Free -** Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -** -** Any permitted reproduction of these routines, in whole or in part, -** must bear this legend. -** -** -** nesinput.h -** -** Platform independent input definitions -** $Id: nesinput.h,v 1.1.1.1 2001/04/27 07:03:54 neil Exp $ -*/ - -#ifndef _NESINPUT_H_ -#define _NESINPUT_H_ - -/* NES control pad bitmasks */ -#define INP_PAD_A 0x01 -#define INP_PAD_B 0x02 -#define INP_PAD_SELECT 0x04 -#define INP_PAD_START 0x08 -#define INP_PAD_UP 0x10 -#define INP_PAD_DOWN 0x20 -#define INP_PAD_LEFT 0x40 -#define INP_PAD_RIGHT 0x80 - -#define INP_ZAPPER_HIT 0x00 -#define INP_ZAPPER_MISS 0x08 -#define INP_ZAPPER_TRIG 0x10 - -#define INP_JOYPAD0 0x0001 -#define INP_JOYPAD1 0x0002 -#define INP_ZAPPER 0x0004 -#define INP_POWERPAD 0x0008 -#define INP_ARKANOID 0x0010 -#define INP_VSDIPSW0 0x0020 -#define INP_VSDIPSW1 0x0040 - -/* upper byte is what's returned in D4, lower is D3 */ -#define INP_PPAD_1 0x0002 -#define INP_PPAD_2 0x0001 -#define INP_PPAD_3 0x0200 -#define INP_PPAD_4 0x0100 -#define INP_PPAD_5 0x0004 -#define INP_PPAD_6 0x0010 -#define INP_PPAD_7 0x0080 -#define INP_PPAD_8 0x0800 -#define INP_PPAD_9 0x0008 -#define INP_PPAD_10 0x0020 -#define INP_PPAD_11 0x0040 -#define INP_PPAD_12 0x0400 - - -enum -{ - INP_STATE_BREAK, - INP_STATE_MAKE -}; - -typedef struct nesinput_s -{ - int type; - int data; -} nesinput_t; - -#define MAX_CONTROLLERS 32 - -extern uint8 input_get(int type); -extern void input_register(nesinput_t *input); -extern void input_event(nesinput_t *input, int state, int value); -extern void input_strobe(void); - -#endif /* _NESINPUT_H_ */ - -/* -** $Log: nesinput.h,v $ -** Revision 1.1.1.1 2001/04/27 07:03:54 neil -** initial -** -** Revision 1.1 2000/10/24 12:20:28 matt -** changed directory structure -** -** Revision 1.6 2000/09/10 23:25:02 matt -** minor changes -** -** Revision 1.5 2000/07/17 01:52:29 matt -** made sure last line of all source files is a newline -** -** Revision 1.4 2000/06/09 15:12:26 matt -** initial revision -** -*/ diff --git a/MCUME_pico/piconofrendo/nofconfig.h b/MCUME_pico/piconofrendo/nofconfig.h deleted file mode 100755 index 44005ff..0000000 --- a/MCUME_pico/piconofrendo/nofconfig.h +++ /dev/null @@ -1,49 +0,0 @@ -/* Nofrendo Configuration API -** -** This file is in the public domain. -** -** $Id: nofconfig.h,v 1.1 2001/04/27 14:37:11 neil Exp $ -*/ - -#ifndef _CONFIG_H_ -#define _CONFIG_H_ - -#ifndef CONFIG_FILE -#define CONFIG_FILE "nofrendo.cfg" -#endif - -typedef struct config_s -{ - char *filename; -} config_t; - -extern config_t config; - -#endif /* !_CONFIG_H_ */ - -/* -** $Log: nofconfig.h,v $ -** Revision 1.1 2001/04/27 14:37:11 neil -** wheeee -** -** Revision 1.1.1.1 2001/04/27 07:03:54 neil -** initial -** -** Revision 1.5 2000/10/10 13:58:13 matt -** stroustrup squeezing his way in the door -** -** Revision 1.4 2000/07/19 15:58:55 neil -** config file now configurable (ha) -** -** Revision 1.3 2000/07/11 14:59:27 matt -** minor cosmetics.. =) -** -** Revision 1.2 2000/07/11 13:35:38 bsittler -** Changed the config API, implemented config file "nofrendo.cfg". The -** GGI drivers use the group [GGI]. Visual= and Mode= keys are understood. -** -** Revision 1.1 2000/07/11 07:46:11 neil -** Initial commit -** -** -*/ diff --git a/MCUME_pico/piconofrendo/nofrendo.c b/MCUME_pico/piconofrendo/nofrendo.c deleted file mode 100644 index 123ba5d..0000000 --- a/MCUME_pico/piconofrendo/nofrendo.c +++ /dev/null @@ -1,394 +0,0 @@ -/* -** Nofrendo (c) 1998-2000 Matthew Conte (matt@conte.com) -** -** -** This program is free software; you can redistribute it and/or -** modify it under the terms of version 2 of the GNU Library General -** Public License as published by the Free Software Foundation. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** Library General Public License for more details. To obtain a -** copy of the GNU Library General Public License, write to the Free -** Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -** -** Any permitted reproduction of these routines, in whole or in part, -** must bear this legend. -** -** -** nofrendo.c -** -** Entry point of program -** Note: all architectures should call these functions -** $Id: nofrendo.c,v 1.3 2001/04/27 14:37:11 neil Exp $ -*/ - -#include -#include -#include "noftypes.h" -#include "nofrendo.h" -#include "event.h" -#include "nofconfig.h" -#include "log.h" -#include "osd.h" -#include "vid_drv.h" - -/* emulated system includes */ -#include "nes.h" - -/* our global machine structure */ -static struct -{ - char *filename, *nextfilename; - system_t type, nexttype; - - union - { - nes_t *nes; - } machine; - - int refresh_rate; - - bool quit; -} console; - -/* our happy little timer ISR */ -volatile int nofrendo_ticks = 0; -static void timer_isr(void) -{ - nofrendo_ticks++; -} - -static void timer_isr_end(void) {} /* code marker for djgpp */ - -static void shutdown_everything(void) -{ - if (console.filename) - { - free(console.filename); - console.filename = NULL; - } - if (console.nextfilename) - { - free(console.nextfilename); - console.nextfilename = NULL; - } - - //config.close(); JMH - osd_shutdown(); - vid_shutdown(); - log_shutdown(); -} - -/* End the current context */ -void main_eject(void) -{ - switch (console.type) - { - case system_nes: - nes_poweroff(); - nes_destroy(&(console.machine.nes)); - break; - - default: - break; - } - - if (NULL != console.filename) - { - free(console.filename); - console.filename = NULL; - } - console.type = system_unknown; -} - -/* Act on the user's quit requests */ -void main_quit(void) -{ - console.quit = true; - - main_eject(); - - /* if there's a pending filename / system, clear */ - if (NULL != console.nextfilename) - { - free(console.nextfilename); - console.nextfilename = NULL; - } - console.nexttype = system_unknown; -} - -/* brute force system autodetection */ -static system_t detect_systemtype(const char *filename) -{ - if (NULL == filename) - return system_unknown; - - if (0 == nes_isourfile(filename)) - return system_nes; - - /* can't figure out what this thing is */ - return system_unknown; -} - -static int install_timer(int hertz) -{ - return osd_installtimer(hertz, (void *) timer_isr, - (int) timer_isr_end - (int) timer_isr, - (void *) &nofrendo_ticks, - sizeof(nofrendo_ticks)); -} - -/* This assumes there is no current context */ -static int internal_insert(const char *filename, system_t type) -{ - /* autodetect system type? */ - if (system_autodetect == type) - type = detect_systemtype(filename); - - console.filename = strdup(filename); - console.type = type; - - /* set up the event system for this system type */ - event_set_system(type); - - switch (console.type) - { - case system_nes: - console.machine.nes = nes_create(); - if (NULL == console.machine.nes) - { - log_printf("Failed to create NES instance.\n"); - return -1; - } - if (nes_insertcart(console.filename, console.machine.nes)) - return -1; - vid_setmode(NES_SCREEN_WIDTH, NES_VISIBLE_HEIGHT); - if (install_timer(NES_REFRESH_RATE)) - return -1; - - nes_emulate(); - break; - - case system_unknown: - default: - log_printf("system type unknown, playing nofrendo NES intro.\n"); - if (NULL != console.filename) - free(console.filename); - - /* oooh, recursion */ - return internal_insert(filename, system_nes); - } - - return 0; -} - -/* This tells main_loop to load this next image */ -void main_insert(const char *filename, system_t type) -{ - console.nextfilename = strdup(filename); - console.nexttype = type; - - main_eject(); -} - -int nofrendo_main(int argc, char *argv[]) -{ - /* initialize our system structure */ - console.filename = NULL; - console.nextfilename = NULL; - console.type = system_unknown; - console.nexttype = system_unknown; - console.refresh_rate = 0; - console.quit = false; - - if (log_init()) - return -1; - - event_init(); - - return osd_main(argc, argv); -} - -/* This is the final leg of main() */ -int main_loop(const char *filename, system_t type) -{ - vidinfo_t video; - - /* register shutdown, in case of assertions, etc. */ -// atexit(shutdown_everything); - - //if (config.open()) // JMH - // return -1; - - if (osd_init()) - return -1; - - osd_getvideoinfo(&video); - if (vid_init(video.default_width, video.default_height, video.driver)) - return -1; - //log printf("vid_init done\n"); - - console.nextfilename = strdup(filename); - console.nexttype = type; - -// while (false == console.quit) -// { -//emu_printf("internal_insert in loop\n"); - if (internal_insert(console.nextfilename, console.nexttype)) - return 1; -// } - - return 0; -} - - -/* -** $Log: nofrendo.c,v $ -** Revision 1.3 2001/04/27 14:37:11 neil -** wheeee -** -** Revision 1.2 2001/04/27 11:10:08 neil -** compile -** -** Revision 1.1.1.1 2001/04/27 07:03:54 neil -** initial -** -** Revision 1.48 2000/11/27 12:47:08 matt -** free them strings -** -** Revision 1.47 2000/11/25 20:26:05 matt -** removed fds "system" -** -** Revision 1.46 2000/11/25 01:51:53 matt -** bool stinks sometimes -** -** Revision 1.45 2000/11/20 13:22:12 matt -** standardized timer ISR, added nofrendo_ticks -** -** Revision 1.44 2000/11/05 22:53:13 matt -** only one video driver per system, please -** -** Revision 1.43 2000/11/01 14:15:35 matt -** multi-system event system, or whatever -** -** Revision 1.42 2000/10/28 15:16:24 matt -** removed nsf_init -** -** Revision 1.41 2000/10/27 12:58:44 matt -** gui_init can now fail -** -** Revision 1.40 2000/10/26 22:48:57 matt -** prelim NSF support -** -** Revision 1.39 2000/10/25 13:42:02 matt -** strdup - giddyap! -** -** Revision 1.38 2000/10/25 01:23:08 matt -** basic system autodetection -** -** Revision 1.37 2000/10/23 17:50:47 matt -** adding fds support -** -** Revision 1.36 2000/10/23 15:52:04 matt -** better system handling -** -** Revision 1.35 2000/10/21 19:25:59 matt -** many more cleanups -** -** Revision 1.34 2000/10/10 13:58:13 matt -** stroustrup squeezing his way in the door -** -** Revision 1.33 2000/10/10 13:03:54 matt -** Mr. Clean makes a guest appearance -** -** Revision 1.32 2000/09/15 04:58:06 matt -** simplifying and optimizing APU core -** -** Revision 1.31 2000/09/10 23:19:14 matt -** i'm a sloppy coder -** -** Revision 1.30 2000/09/07 01:30:57 matt -** nes6502_init deprecated -** -** Revision 1.29 2000/08/16 03:17:49 matt -** bpb -** -** Revision 1.28 2000/08/16 02:58:19 matt -** changed video interface a wee bit -** -** Revision 1.27 2000/07/31 04:28:46 matt -** one million cleanups -** -** Revision 1.26 2000/07/30 04:31:26 matt -** automagic loading of the nofrendo intro -** -** Revision 1.25 2000/07/27 01:16:36 matt -** sorted out the video problems -** -** Revision 1.24 2000/07/26 21:54:53 neil -** eject has to clear the nextfilename and nextsystem -** -** Revision 1.23 2000/07/26 21:36:13 neil -** Big honkin' change -- see the mailing list -** -** Revision 1.22 2000/07/25 02:21:36 matt -** safer xxx_destroy calls -** -** Revision 1.21 2000/07/23 16:46:47 matt -** fixed crash in win32 by reodering shutdown calls -** -** Revision 1.20 2000/07/23 15:18:23 matt -** removed unistd.h from includes -** -** Revision 1.19 2000/07/23 00:48:15 neil -** Win32 SDL -** -** Revision 1.18 2000/07/21 13:42:06 neil -** get_options removed, as it should be handled by osd_main -** -** Revision 1.17 2000/07/21 04:53:48 matt -** moved palette calls out of nofrendo.c and into ppu_create -** -** Revision 1.16 2000/07/21 02:40:43 neil -** more main fixes -** -** Revision 1.15 2000/07/21 02:09:07 neil -** new main structure? -** -** Revision 1.14 2000/07/20 17:05:12 neil -** Moved osd_init before setup_video -** -** Revision 1.13 2000/07/11 15:01:05 matt -** moved config.close() into registered atexit() routine -** -** Revision 1.12 2000/07/11 13:35:38 bsittler -** Changed the config API, implemented config file "nofrendo.cfg". The -** GGI drivers use the group [GGI]. Visual= and Mode= keys are understood. -** -** Revision 1.11 2000/07/11 04:32:21 matt -** less magic number nastiness for screen dimensions -** -** Revision 1.10 2000/07/10 03:04:15 matt -** removed scanlines, backbuffer from custom blit -** -** Revision 1.9 2000/07/07 04:39:54 matt -** removed garbage dpp shite -** -** Revision 1.8 2000/07/06 16:48:25 matt -** new video driver -** -** Revision 1.7 2000/07/05 17:26:16 neil -** Moved the externs in nofrendo.c to osd.h -** -** Revision 1.6 2000/06/26 04:55:44 matt -** cleaned up main() -** -** Revision 1.5 2000/06/20 20:41:21 matt -** moved include to top (duh) -** -** Revision 1.4 2000/06/09 15:12:25 matt -** initial revision -** -*/ diff --git a/MCUME_pico/piconofrendo/nofrendo.h b/MCUME_pico/piconofrendo/nofrendo.h deleted file mode 100755 index 01075a8..0000000 --- a/MCUME_pico/piconofrendo/nofrendo.h +++ /dev/null @@ -1,98 +0,0 @@ -/* -** Nofrendo (c) 1998-2000 Matthew Conte (matt@conte.com) -** -** -** This program is free software; you can redistribute it and/or -** modify it under the terms of version 2 of the GNU Library General -** Public License as published by the Free Software Foundation. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** Library General Public License for more details. To obtain a -** copy of the GNU Library General Public License, write to the Free -** Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -** -** Any permitted reproduction of these routines, in whole or in part, -** must bear this legend. -** -** -** nofrendo.h (c) 1998-2000 Matthew Conte (matt@conte.com) -** (c) 2000 Neil Stevens (multivac@fcmail.com) -** -** Note: all architectures should call these functions -** -** $Id: nofrendo.h,v 1.2 2001/04/27 11:10:08 neil Exp $ -*/ - -#ifndef _NOFRENDO_H_ -#define _NOFRENDO_H_ - -#define NOLOOP 1 - -typedef enum -{ - system_unknown, - system_autodetect, - system_nes, - NUM_SUPPORTED_SYSTEMS -} system_t; - -int nofrendo_main(int argc, char *argv[]); - - -extern volatile int nofrendo_ticks; /* system timer ticks */ - -/* osd_main should end with a call to main_loop(). -** Pass filename = NULL if you want to start with the demo rom -*/ -extern int main_loop(const char *filename, system_t type); - -/* These should not be called directly. Use the event interface */ -extern void main_insert(const char *filename, system_t type); -extern void main_eject(void); -extern void main_quit(void); - -#ifdef NOLOOP -extern void nes_step(int skip); -#endif - -#endif /* !_NOFRENDO_H_ */ - -/* -** $Log: nofrendo.h,v $ -** Revision 1.2 2001/04/27 11:10:08 neil -** compile -** -** Revision 1.1.1.1 2001/04/27 07:03:54 neil -** initial -** -** Revision 1.9 2000/11/25 20:26:05 matt -** removed fds "system" -** -** Revision 1.8 2000/11/20 13:22:12 matt -** standardized timer ISR, added nofrendo_ticks -** -** Revision 1.7 2000/11/01 14:15:35 matt -** multi-system event system, or whatever -** -** Revision 1.6 2000/10/25 13:42:02 matt -** strdup - giddyap! -** -** Revision 1.5 2000/10/25 01:23:08 matt -** basic system autodetection -** -** Revision 1.4 2000/10/23 15:52:04 matt -** better system handling -** -** Revision 1.3 2000/07/31 04:28:46 matt -** one million cleanups -** -** Revision 1.2 2000/07/27 01:16:36 matt -** sorted out the video problems -** -** Revision 1.1 2000/07/26 21:36:13 neil -** Big honkin' change -- see the mailing list -** -** -*/ diff --git a/MCUME_pico/piconofrendo/noftypes.h b/MCUME_pico/piconofrendo/noftypes.h deleted file mode 100644 index 7e3c67c..0000000 --- a/MCUME_pico/piconofrendo/noftypes.h +++ /dev/null @@ -1,121 +0,0 @@ -/* -** Nofrendo (c) 1998-2000 Matthew Conte (matt@conte.com) -** -** -** This program is free software; you can redistribute it and/or -** modify it under the terms of version 2 of the GNU Library General -** Public License as published by the Free Software Foundation. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** Library General Public License for more details. To obtain a -** copy of the GNU Library General Public License, write to the Free -** Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -** -** Any permitted reproduction of these routines, in whole or in part, -** must bear this legend. -** -** -** types.h -** -** Data type definitions -** $Id: noftypes.h,v 1.1 2001/04/27 14:37:11 neil Exp $ -*/ - -#ifndef _TYPES_H_ -#define _TYPES_H_ - - - -/* Define this if running on little-endian (x86) systems */ -#define HOST_LITTLE_ENDIAN - -#ifdef __GNUC__ -#define INLINE static inline -#define ZERO_LENGTH 0 -#elif defined(WIN32) -#define INLINE static __inline -#define ZERO_LENGTH 0 -#else /* crapintosh? */ -#define INLINE static -#define ZERO_LENGTH 1 -#endif - -/* quell stupid compiler warnings */ -#define UNUSED(x) ((x) = (x)) - -typedef signed char int8; -typedef signed short int16; -typedef signed int int32; -typedef unsigned char uint8; -typedef unsigned short uint16; -typedef unsigned int uint32; - -#ifndef __cplusplus -typedef enum -{ - false = 0, - true = 1 -} bool; - -#ifndef NULL -#define NULL ((void *) 0) -#endif -#endif /* !__cplusplus */ - -#include "log.h" - -#ifdef NOFRENDO_DEBUG - -#define ASSERT(expr) log_assert((int) (expr), __LINE__, __FILE__, NULL) -#define ASSERT_MSG(msg) log_assert(false, __LINE__, __FILE__, (msg)) - -#else /* !NOFRENDO_DEBUG */ - -#define ASSERT(expr) -#define ASSERT_MSG(msg) - -#endif /* !NOFRENDO_DEBUG */ - -#endif /* _TYPES_H_ */ - -/* -** $Log: noftypes.h,v $ -** Revision 1.1 2001/04/27 14:37:11 neil -** wheeee -** -** Revision 1.1.1.1 2001/04/27 07:03:54 neil -** initial -** -** Revision 1.15 2000/11/05 16:37:18 matt -** rolled rgb.h into bitmap.h -** -** Revision 1.14 2000/10/17 03:22:16 matt -** safe UNUSED -** -** Revision 1.13 2000/10/10 13:58:14 matt -** stroustrup squeezing his way in the door -** -** Revision 1.12 2000/10/10 13:03:54 matt -** Mr. Clean makes a guest appearance -** -** Revision 1.11 2000/08/11 01:44:05 matt -** cosmeses -** -** Revision 1.10 2000/07/31 04:28:47 matt -** one million cleanups -** -** Revision 1.9 2000/07/24 04:30:17 matt -** ASSERTs should have been calling log_shutdown -** -** Revision 1.8 2000/07/17 01:52:28 matt -** made sure last line of all source files is a newline -** -** Revision 1.7 2000/07/04 04:46:44 matt -** moved INLINE define from osd.h -** -** Revision 1.6 2000/06/09 15:12:25 matt -** initial revision -** -*/ diff --git a/MCUME_pico/piconofrendo/osd.h b/MCUME_pico/piconofrendo/osd.h deleted file mode 100755 index 06d2677..0000000 --- a/MCUME_pico/piconofrendo/osd.h +++ /dev/null @@ -1,188 +0,0 @@ -/* -** Nofrendo (c) 1998-2000 Matthew Conte (matt@conte.com) -** -** -** This program is free software; you can redistribute it and/or -** modify it under the terms of version 2 of the GNU Library General -** Public License as published by the Free Software Foundation. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** Library General Public License for more details. To obtain a -** copy of the GNU Library General Public License, write to the Free -** Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -** -** Any permitted reproduction of these routines, in whole or in part, -** must bear this legend. -** -** -** osd.h -** -** O/S dependent routine defintions (must be customized) -** $Id: osd.h,v 1.2 2001/04/27 14:37:11 neil Exp $ -*/ - -#ifndef _OSD_H_ -#define _OSD_H_ - -#include -#ifndef PATH_MAX -#define PATH_MAX 512 -#endif /* PATH_MAX */ - -#ifdef __GNUC__ -#define __PACKED__ __attribute__ ((packed)) - -#ifdef __DJGPP__ -#define PATH_SEP '\\' -#else /* !__DJGPP__ */ -#define PATH_SEP '/' -#endif /* !__DJGPP__ */ - -#elif defined(WIN32) -#define __PACKED__ -#define PATH_SEP '\\' -#else /* !defined(WIN32) && !__GNUC__ */ -#define __PACKED__ -#define PATH_SEP ':' -#endif /* !defined(WIN32) && !__GNUC__ */ - -#if !defined(WIN32) && !defined(__DJGPP__) -#define stricmp strcasecmp -#endif /* !WIN32 && !__DJGPP__ */ - - -extern void osd_setsound(void (*playfunc)(void *buffer, int size)); - - -#ifndef NSF_PLAYER -#include "noftypes.h" -#include "vid_drv.h" - -typedef struct vidinfo_s -{ - int default_width, default_height; - viddriver_t *driver; -} vidinfo_t; - -typedef struct sndinfo_s -{ - int sample_rate; - int bps; -} sndinfo_t; - -/* get info */ -extern void osd_getvideoinfo(vidinfo_t *info); -extern void osd_getsoundinfo(sndinfo_t *info); - -/* init / shutdown */ -extern int osd_init(void); -extern void osd_shutdown(void); -extern int osd_main(int argc, char *argv[]); - -extern int osd_installtimer(int frequency, void *func, int funcsize, - void *counter, int countersize); - -/* filename manipulation */ -extern void osd_fullname(char *fullname, const char *shortname); -extern char *osd_newextension(char *string, char *ext); - -/* input */ -extern void osd_getinput(void); -extern void osd_getmouse(int *x, int *y, int *button); - -/* build a filename for a snapshot, return -ve for error */ -extern int osd_makesnapname(char *filename, int len); - -#endif /* !NSF_PLAYER */ - -#endif /* _OSD_H_ */ - -/* -** $Log: osd.h,v $ -** Revision 1.2 2001/04/27 14:37:11 neil -** wheeee -** -** Revision 1.1.1.1 2001/04/27 07:03:54 neil -** initial -** -** Revision 1.30 2000/11/05 22:53:13 matt -** only one video driver per system, please -** -** Revision 1.29 2000/11/05 06:23:41 matt -** thinlib spawns changes -** -** Revision 1.28 2000/10/22 19:15:39 matt -** more sane timer ISR / autoframeskip -** -** Revision 1.27 2000/10/21 19:25:59 matt -** many more cleanups -** -** Revision 1.26 2000/10/10 13:03:53 matt -** Mr. Clean makes a guest appearance -** -** Revision 1.25 2000/10/02 15:01:12 matt -** frag size has been removed -** -** Revision 1.24 2000/08/31 02:40:18 matt -** fixed some crap -** -** Revision 1.23 2000/08/16 02:57:14 matt -** changed video interface a wee bit -** -** Revision 1.22 2000/08/11 01:46:30 matt -** new OSD sound information interface -** -** Revision 1.21 2000/08/04 15:01:32 neil -** BeOS cleanups -** -** Revision 1.20 2000/08/04 14:36:14 neil -** BeOS is working.. kinda -** -** Revision 1.19 2000/07/26 21:36:13 neil -** Big honkin' change -- see the mailing list -** -** Revision 1.18 2000/07/23 16:21:35 neil -** neither stricmp nor strcasecmp works everywhere -** -** Revision 1.17 2000/07/23 15:17:40 matt -** osd_getfragsize -** -** Revision 1.16 2000/07/21 13:37:20 neil -** snap filenames are OS-dependent -** -** Revision 1.15 2000/07/21 04:58:37 matt -** new osd_main structure -** -** Revision 1.14 2000/07/21 04:26:15 matt -** added some nasty externs -** -** Revision 1.13 2000/07/21 02:42:45 matt -** merged osd_getinput and osd_gethostinput -** -** Revision 1.12 2000/07/19 13:10:35 neil -** PATH_MAX -** -** Revision 1.11 2000/07/10 03:04:15 matt -** removed scanlines, backbuffer from custom blit -** -** Revision 1.10 2000/07/06 16:48:25 matt -** new video driver -** -** Revision 1.9 2000/07/05 17:26:16 neil -** Moved the externs in nofrendo.c to osd.h -** -** Revision 1.8 2000/07/04 23:07:06 matt -** djgpp path separator bugfix -** -** Revision 1.7 2000/07/04 04:45:33 matt -** moved INLINE define into types.h -** -** Revision 1.6 2000/06/29 16:06:18 neil -** Wrapped DOS-specific headers in an ifdef -** -** Revision 1.5 2000/06/09 15:12:25 matt -** initial revision -** -*/ diff --git a/MCUME_pico/piconofrendo/piconofrendo.cpp b/MCUME_pico/piconofrendo/piconofrendo.cpp deleted file mode 100644 index 1b3d653..0000000 --- a/MCUME_pico/piconofrendo/piconofrendo.cpp +++ /dev/null @@ -1,163 +0,0 @@ -#include "pico.h" -#include "pico/stdlib.h" - -extern "C" { - #include "iopins.h" - #include "emuapi.h" -} -#include "keyboard_osd.h" - -extern "C" { -#include "nes_emu.h" -} -#include - - -#ifdef USE_VGA -#include "vga_t_dma.h" -#else -#include "tft_t_dma.h" -#endif -TFT_T_DMA tft; - -static int skip=0; - -int main(void) { -// vreg_set_voltage(VREG_VOLTAGE_1_05); -// set_sys_clock_khz(125000, true); -// set_sys_clock_khz(150000, true); -// set_sys_clock_khz(133000, true); -// set_sys_clock_khz(200000, true); -// set_sys_clock_khz(210000, true); - set_sys_clock_khz(230000, true); -// set_sys_clock_khz(225000, true); -// set_sys_clock_khz(250000, true); - stdio_init_all(); - -#ifdef USE_VGA -// tft.begin(VGA_MODE_400x240); - tft.begin(VGA_MODE_320x240); -#else - tft.begin(); -#endif - emu_init(); - while (true) { - if (menuActive()) { - uint16_t bClick = emu_DebounceLocalKeys(); - int action = handleMenu(bClick); - char * filename = menuSelection(); - if (action == ACTION_RUNTFT) { - toggleMenu(false); - emu_start(); - emu_Init(filename); - tft.fillScreenNoDma( RGBVAL16(0x00,0x00,0x00) ); - tft.startDMA(); - } - tft.waitSync(); - } - else { - emu_Step(); - uint16_t bClick = emu_DebounceLocalKeys(); - emu_Input(bClick); - } - //int c = getchar_timeout_us(0); - //switch (c) { - // case ' ': - // printf("test: %d\n", 1); - // break; - //} - } -} - -static unsigned char palette8[PALETTE_SIZE]; -static unsigned short palette16[PALETTE_SIZE]; - -void emu_SetPaletteEntry(unsigned char r, unsigned char g, unsigned char b, int index) -{ - if (index -#include "noftypes.h" -#include "log.h" -#include "bitmap.h" -#include "vid_drv.h" -#include "osd.h" - -/* hardware surface */ -static bitmap_t *screen = NULL; - -/* primary / backbuffer surfaces */ -static bitmap_t *primary_buffer = NULL; //, *back_buffer = NULL; - -static viddriver_t *driver = NULL; - -/* fast automagic loop unrolling */ -#define DUFFS_DEVICE(transfer, count) \ -{ \ - register int n = (count + 7) / 8; \ - switch (count % 8) \ - { \ - case 0: do { { transfer; } \ - case 7: { transfer; } \ - case 6: { transfer; } \ - case 5: { transfer; } \ - case 4: { transfer; } \ - case 3: { transfer; } \ - case 2: { transfer; } \ - case 1: { transfer; } \ - } while (--n > 0); \ - } \ -} - -/* some system dependent replacement routines (for speed) */ -INLINE int vid_memcmp(const void *p1, const void *p2, int len) -{ - /* check for 32-bit aligned data */ - if (0 == (((uint32) p1 & 3) | ((uint32) p2 & 3))) - { - uint32 *dw1 = (uint32 *) p1; - uint32 *dw2 = (uint32 *) p2; - - len >>= 2; - - DUFFS_DEVICE(if (*dw1++ != *dw2++) return -1, len); - } - else - /* fall back to 8-bit compares */ - { - uint8 *b1 = (uint8 *) p1; - uint8 *b2 = (uint8 *) p2; - - DUFFS_DEVICE(if (*b1++ != *b2++) return -1, len); - } - - return 0; -} - -/* super-dooper assembly memcpy (thanks, SDL!) */ -#if defined(__GNUC__) && defined(i386) -#define vid_memcpy(dest, src, len) \ -{ \ - int u0, u1, u2; \ - __asm__ __volatile__ ( \ - " cld \n" \ - " rep \n" \ - " movsl \n" \ - " testb $2,%b4 \n" \ - " je 1f \n" \ - " movsw \n" \ - "1: \n" \ - " testb $1,%b4 \n" \ - " je 2f \n" \ - " movsb \n" \ - "2: \n" \ - : "=&c" (u0), "=&D" (u1), "=&S" (u2) \ - : "0" ((len)/4), "q" (len), "1" (dest), "2" (src) \ - : "memory"); \ -} -#else /* !(defined(__GNUC__) && defined(i386)) */ -INLINE void vid_memcpy(void *dest, const void *src, int len) -{ - uint32 *s = (uint32 *) src; - uint32 *d = (uint32 *) dest; - - ASSERT(0 == ((len & 3) | ((uint32) src & 3) | ((uint32) dest & 3))); - len >>= 2; - - DUFFS_DEVICE(*d++ = *s++, len); -} -#endif /* !(defined(__GNUC__) && defined(i386)) */ - - -extern bitmap_t *lock_write(void); -/* TODO: any way to remove this filth (GUI needs it)? */ -bitmap_t *vid_getbuffer(void) -{ - return primary_buffer; -} - -void vid_setpalette(rgb_t *p) -{ - ASSERT(driver); - ASSERT(p); - - driver->set_palette(p); -} - -/* blits a bitmap onto primary buffer */ -void vid_blit(bitmap_t *bitmap, int src_x, int src_y, int dest_x, int dest_y, - int width, int height) -{ - int bitmap_pitch, primary_pitch; - uint8 *dest_ptr, *src_ptr; - - ASSERT(bitmap); - - /* clip to source */ - if (src_y >= bitmap->height) - return; - if (src_y + height > bitmap->height) - height = bitmap->height - src_y; - - if (src_x >= bitmap->width) - return; - if (src_x + width > bitmap->width) - width = bitmap->width - src_x; - - /* clip to dest */ - if (dest_y + height <= 0) - { - return; - } - else if (dest_y < 0) - { - height += dest_y; - src_y -= dest_y; - dest_y = 0; - } - - if (dest_y >= primary_buffer->height) - return; - if (dest_y + height > primary_buffer->height) - height = primary_buffer->height - dest_y; - - if (dest_x + width <= 0) - { - return; - } - else if (dest_x < 0) - { - width += dest_x; - src_x -= dest_x; - dest_x = 0; - } - - if (dest_x >= primary_buffer->width) - return; - if (dest_x + width > primary_buffer->width) - width = primary_buffer->width - dest_x; - - src_ptr = bitmap->line[src_y] + src_x; - dest_ptr = primary_buffer->line[dest_y] + dest_x; - - /* Avoid doing unnecessary indexed lookups */ - bitmap_pitch = bitmap->pitch; - primary_pitch = primary_buffer->pitch; - - /* do the copy */ - while (height--) - { - vid_memcpy(dest_ptr, src_ptr, width); - src_ptr += bitmap_pitch; - dest_ptr += primary_pitch; - } -} - -static void vid_blitscreen(int num_dirties, rect_t *dirty_rects) -{ - int src_x, src_y, dest_x, dest_y; - int blit_width, blit_height; - - screen = driver->lock_write(); - - /* center in y direction */ - if (primary_buffer->height <= screen->height) - { - src_y = 0; - blit_height = primary_buffer->height; - dest_y = (screen->height - blit_height) >> 1; - } - else - { - src_y = (primary_buffer->height - screen->height) >> 1; - blit_height = screen->height; - dest_y = 0; - } - - /* and in x */ - if (primary_buffer->width <= screen->width) - { - src_x = 0; - blit_width = primary_buffer->width; - dest_x = (screen->width - blit_width) >> 1; - } - else - { - src_x = (primary_buffer->width - screen->width) >> 1; - blit_width = screen->width; - dest_x = 0; - } - - /* should we just copy the entire screen? */ - if (-1 == num_dirties) - { - uint8 *dest, *src; - - src = primary_buffer->line[src_y] + src_x; - dest = screen->line[dest_y] + dest_x; - - while (blit_height--) - { - vid_memcpy(dest, src, primary_buffer->width); - src += primary_buffer->pitch; - dest += screen->pitch; - } - } - else - { - /* we need to blit just a bunch of dirties */ - int i, j, height; - rect_t *rects = dirty_rects; - - for (i = 0; i < num_dirties && blit_height; i++) - { - height = rects->h; - if (blit_height < height) - height = blit_height; - - j = 0; - DUFFS_DEVICE( - { - vid_memcpy(screen->line[dest_y + rects->y + j] + rects->x + dest_x, - primary_buffer->line[src_y + rects->y + j] + rects->x + src_x, - rects->w); - j++; - blit_height--; - }, height); - - rects++; - } - } - - if (driver->free_write) - driver->free_write(num_dirties, dirty_rects); -} - -/* TODO: this code is sickly */ - -#define CHUNK_WIDTH 256 -#define CHUNK_HEIGHT 16 -#define MAX_DIRTIES ((256 / CHUNK_WIDTH) * (240 / CHUNK_HEIGHT)) -#define DIRTY_CUTOFF ((3 * MAX_DIRTIES) / 4) - -#if 0 -INLINE int calc_dirties(rect_t *list) -{ - bool dirty; - int num_dirties = 0; - int i = 0, j, line_offset = 0; - int iterations = primary_buffer->height / CHUNK_HEIGHT; - - for (i = 0; i < iterations; i++) - { - dirty = false; - - j = line_offset; - DUFFS_DEVICE( - { - if (vid_memcmp(back_buffer->line[j], primary_buffer->line[j], - CHUNK_WIDTH)) - { - dirty = true; - break; - } - - j++; - }, CHUNK_HEIGHT); - - if (true == dirty) - { - list->h = CHUNK_HEIGHT; - list->w = CHUNK_WIDTH; - list->x = 0; - list->y = line_offset; - list++; - - /* totally arbitrary at this point */ - if (++num_dirties > DIRTY_CUTOFF) - return -1; - } - - line_offset += CHUNK_HEIGHT; - } - - return num_dirties; -} -#endif - -void vid_flush(void) -{ - bitmap_t *temp; - int num_dirties; - rect_t dirty_rects[MAX_DIRTIES]; - - ASSERT(driver); - - if (true == driver->invalidate) - { - driver->invalidate = false; - num_dirties = -1; - } - else - { - //num_dirties = calc_dirties(dirty_rects); - num_dirties = -1; - } - - if (driver->custom_blit) - driver->custom_blit(primary_buffer, num_dirties, dirty_rects); - else - vid_blitscreen(num_dirties, dirty_rects); - - /* Swap pointers to the main/back buffers */ -// temp = back_buffer; -// back_buffer = primary_buffer; -// primary_buffer = temp; -} - -/* emulated machine tells us which resolution it wants */ -int vid_setmode(int width, int height) -{ - if (NULL != primary_buffer) - bmp_destroy(&primary_buffer); -// if (NULL != back_buffer) -// bmp_destroy(&back_buffer); - primary_buffer = bmp_create(width, height, 0); /* no overdraw */ - if (NULL == primary_buffer) - return -1; - - return 0; -} - -static int vid_findmode(int width, int height, viddriver_t *osd_driver) -{ - if (osd_driver->init(width, height)) - { - driver = NULL; - return -1; /* mode not available! */ - } - - /* we got our driver */ - driver = osd_driver; - - /* re-assert dimensions, clear the surface */ - screen = driver->lock_write(); - - /* release surface */ - if (driver->free_write) - driver->free_write(-1, NULL); - - log_printf("video driver: %s at %dx%d\n", driver->name, - screen->width, screen->height); - - return 0; -} - -/* This is the interface to the drivers, used in nofrendo.c */ -int vid_init(int width, int height, viddriver_t *osd_driver) -{ - if (vid_findmode(width, height, osd_driver)) - { - log_printf("video initialization failed for %s at %dx%d\n", - osd_driver->name, width, height); - return -1; - } - log_printf("vid_init done\n"); - - return 0; -} - -void vid_shutdown(void) -{ - if (NULL == driver) - return; - - if (NULL != primary_buffer) - bmp_destroy(&primary_buffer); -#if 0 - if (NULL != back_buffer) - bmp_destroy(&back_buffer); -#endif - - if (driver && driver->shutdown) - driver->shutdown(); -} - - -/* -** $Log: vid_drv.c,v $ -** Revision 1.2 2001/04/27 14:37:11 neil -** wheeee -** -** Revision 1.1.1.1 2001/04/27 07:03:54 neil -** initial -** -** Revision 1.40 2000/11/25 20:26:42 matt -** not much -** -** Revision 1.39 2000/11/16 14:27:27 matt -** even more crash-proofness -** -** Revision 1.38 2000/11/16 14:11:18 neil -** Better *not* to crash in case of catastrophic failure in the driver -** -** Revision 1.37 2000/11/13 00:55:16 matt -** no dirties seems to be faster (!?!?) -** -** Revision 1.36 2000/11/06 05:16:18 matt -** minor clipping bug -** -** Revision 1.35 2000/11/06 02:16:26 matt -** cleanups -** -** Revision 1.34 2000/11/05 22:53:13 matt -** only one video driver per system, please -** -** Revision 1.33 2000/11/05 16:37:18 matt -** rolled rgb.h into bitmap.h -** -** Revision 1.32 2000/11/05 06:23:41 matt -** thinlib spawns changes -** -** Revision 1.31 2000/10/10 13:58:14 matt -** stroustrup squeezing his way in the door -** -** Revision 1.30 2000/10/10 13:03:53 matt -** Mr. Clean makes a guest appearance -** -** Revision 1.29 2000/10/08 17:58:23 matt -** lock_read() should not allow us to clear the bitmap -** -** Revision 1.28 2000/09/18 02:06:48 matt -** -pedantic is your friend -** -** Revision 1.27 2000/08/16 02:53:05 matt -** changed init() interface a wee bit -** -** Revision 1.26 2000/08/14 02:45:59 matt -** fixed nasty bug in vid_blitscreen -** -** Revision 1.24 2000/08/11 01:44:37 matt -** clipping bugfix -** -** Revision 1.23 2000/07/31 04:28:47 matt -** one million cleanups -** -** Revision 1.22 2000/07/28 07:25:49 neil -** Video driver has an invalidate flag, telling vid_drv not to calculate dirties for the next frame -** -** Revision 1.21 2000/07/28 03:51:45 matt -** lock_read used instead of lock_write in some places -** -** Revision 1.20 2000/07/28 01:24:05 matt -** dirty rectangle support -** -** Revision 1.19 2000/07/27 23:49:52 matt -** no more getmode -** -** Revision 1.18 2000/07/27 04:30:37 matt -** change to get_mode api -** -** Revision 1.17 2000/07/27 04:05:58 matt -** changed place where name goes -** -** Revision 1.16 2000/07/27 01:16:22 matt -** api changes for new main and dirty rects -** -** Revision 1.15 2000/07/26 21:36:13 neil -** Big honkin' change -- see the mailing list -** -** Revision 1.14 2000/07/24 04:33:57 matt -** skeleton of dirty rectangle code in place -** -** Revision 1.13 2000/07/23 14:35:39 matt -** cleanups -** -** Revision 1.12 2000/07/18 19:41:26 neil -** use screen->pitch in blitscreen, not screen_width -** -** Revision 1.11 2000/07/11 04:30:16 matt -** overdraw unnecessary! -** -** Revision 1.10 2000/07/10 19:07:57 matt -** added custom clear() member call to video driver -** -** Revision 1.9 2000/07/10 03:06:49 matt -** my dependency file is broken... *snif* -** -** Revision 1.8 2000/07/10 03:04:15 matt -** removed scanlines, backbuffer from custom blit -** -** Revision 1.7 2000/07/10 01:03:20 neil -** New video scheme allows for custom blitters to be determined by the driver at runtime -** -** Revision 1.6 2000/07/09 03:34:46 matt -** temporary cleanup -** -** Revision 1.5 2000/07/08 23:48:29 neil -** Another assumption GGI kills: pitch == width for hardware bitmaps -** -** Revision 1.4 2000/07/07 20:18:03 matt -** added overdraw, fixed some bugs in blitters -** -** Revision 1.3 2000/07/07 18:33:55 neil -** no need to lock for reading just to get the dimensions -** -** Revision 1.2 2000/07/07 18:11:37 neil -** Generalizing the video driver -** -** Revision 1.1 2000/07/06 16:48:47 matt -** initial revision -** -*/ diff --git a/MCUME_pico/piconofrendo/vid_drv.h b/MCUME_pico/piconofrendo/vid_drv.h deleted file mode 100755 index e97ed03..0000000 --- a/MCUME_pico/piconofrendo/vid_drv.h +++ /dev/null @@ -1,145 +0,0 @@ -/* -** Nofrendo (c) 1998-2000 Matthew Conte (matt@conte.com) -** -** -** This program is free software; you can redistribute it and/or -** modify it under the terms of version 2 of the GNU Library General -** Public License as published by the Free Software Foundation. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** Library General Public License for more details. To obtain a -** copy of the GNU Library General Public License, write to the Free -** Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -** -** Any permitted reproduction of these routines, in whole or in part, -** must bear this legend. -** -** -** vid_drv.h -** -** Video driver -** $Id: vid_drv.h,v 1.2 2001/04/27 14:37:11 neil Exp $ -*/ - -#ifndef _VID_DRV_H_ -#define _VID_DRV_H_ - -#include "bitmap.h" - -typedef struct viddriver_s -{ - /* name of driver */ - const char *name; - /* init function - return 0 on success, nonzero on failure */ - int (*init)(int width, int height); - /* clean up after driver (can be NULL) */ - void (*shutdown)(void); - /* set a video mode - return 0 on success, nonzero on failure */ - int (*set_mode)(int width, int height); - /* set up a palette */ - void (*set_palette)(rgb_t *palette); - /* custom bitmap clear (can be NULL) */ - void (*clear)(uint8 color); - /* lock surface for writing (required) */ - bitmap_t *(*lock_write)(void); - /* free a locked surface (can be NULL) */ - void (*free_write)(int num_dirties, rect_t *dirty_rects); - /* custom blitter - num_dirties == -1 if full blit required */ - void (*custom_blit)(bitmap_t *primary, int num_dirties, - rect_t *dirty_rects); - /* immediately invalidate the buffer, i.e. full redraw */ - bool invalidate; -} viddriver_t; - -/* TODO: filth */ -extern bitmap_t *vid_getbuffer(void); - -extern int vid_init(int width, int height, viddriver_t *osd_driver); -extern void vid_shutdown(void); - -extern int vid_setmode(int width, int height); -extern void vid_setpalette(rgb_t *pal); - -extern void vid_blit(bitmap_t *bitmap, int src_x, int src_y, int dest_x, - int dest_y, int blit_width, int blit_height); -extern void vid_flush(void); - -#endif /* _VID_DRV_H_ */ - -/* -** $Log: vid_drv.h,v $ -** Revision 1.2 2001/04/27 14:37:11 neil -** wheeee -** -** Revision 1.1.1.1 2001/04/27 07:03:54 neil -** initial -** -** Revision 1.22 2000/11/05 22:53:13 matt -** only one video driver per system, please -** -** Revision 1.21 2000/11/05 16:37:18 matt -** rolled rgb.h into bitmap.h -** -** Revision 1.20 2000/11/05 06:23:41 matt -** thinlib spawns changes -** -** Revision 1.19 2000/10/10 13:58:14 matt -** stroustrup squeezing his way in the door -** -** Revision 1.18 2000/10/10 13:03:54 matt -** Mr. Clean makes a guest appearance -** -** Revision 1.17 2000/08/16 02:53:04 matt -** changed init() interface a wee bit -** -** Revision 1.16 2000/07/31 04:28:47 matt -** one million cleanups -** -** Revision 1.15 2000/07/28 07:25:49 neil -** Video driver has an invalidate flag, telling vid_drv not to calculate dirties for the next frame -** -** Revision 1.14 2000/07/27 23:49:52 matt -** no more getmode -** -** Revision 1.13 2000/07/27 04:30:37 matt -** change to get_mode api -** -** Revision 1.12 2000/07/27 04:08:04 matt -** char * -> const char * -** -** Revision 1.11 2000/07/27 04:05:58 matt -** changed place where name goes -** -** Revision 1.10 2000/07/27 01:16:22 matt -** api changes for new main and dirty rects -** -** Revision 1.9 2000/07/26 21:36:14 neil -** Big honkin' change -- see the mailing list -** -** Revision 1.8 2000/07/24 04:33:57 matt -** skeleton of dirty rectangle code in place -** -** Revision 1.7 2000/07/10 19:07:57 matt -** added custom clear() member call to video driver -** -** Revision 1.6 2000/07/10 03:04:15 matt -** removed scanlines, backbuffer from custom blit -** -** Revision 1.5 2000/07/10 01:03:20 neil -** New video scheme allows for custom blitters to be determined by the driver at runtime -** -** Revision 1.4 2000/07/09 03:34:47 matt -** temporary cleanup -** -** Revision 1.3 2000/07/07 20:17:35 matt -** better custom blitting support -** -** Revision 1.2 2000/07/07 18:11:38 neil -** Generalizing the video driver -** -** Revision 1.1 2000/07/06 16:48:47 matt -** initial revision -** -*/ diff --git a/MCUME_pico/piconofrendo/vrcvisnd.c b/MCUME_pico/piconofrendo/vrcvisnd.c deleted file mode 100755 index ca3d95c..0000000 --- a/MCUME_pico/piconofrendo/vrcvisnd.c +++ /dev/null @@ -1,278 +0,0 @@ -/* -** Nofrendo (c) 1998-2000 Matthew Conte (matt@conte.com) -** -** -** This program is free software; you can redistribute it and/or -** modify it under the terms of version 2 of the GNU Library General -** Public License as published by the Free Software Foundation. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** Library General Public License for more details. To obtain a -** copy of the GNU Library General Public License, write to the Free -** Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -** -** Any permitted reproduction of these routines, in whole or in part, -** must bear this legend. -** -** -** vrcvisnd.c -** -** VRCVI sound hardware emulation -** $Id: vrcvisnd.c,v 1.2 2001/04/27 14:37:11 neil Exp $ -*/ - -#include "noftypes.h" -#include "vrcvisnd.h" -#include "nes_apu.h" - -typedef struct vrcvirectangle_s -{ - bool enabled; - - uint8 reg[3]; - - float accum; - uint8 adder; - - int32 freq; - int32 volume; - uint8 duty_flip; -} vrcvirectangle_t; - -typedef struct vrcvisawtooth_s -{ - bool enabled; - - uint8 reg[3]; - - float accum; - uint8 adder; - uint8 output_acc; - - int32 freq; - uint8 volume; -} vrcvisawtooth_t; - -typedef struct vrcvisnd_s -{ - vrcvirectangle_t rectangle[2]; - vrcvisawtooth_t saw; - float incsize; -} vrcvisnd_t; - - -static vrcvisnd_t vrcvi; - -/* VRCVI rectangle wave generation */ -static int32 vrcvi_rectangle(vrcvirectangle_t *chan) -{ - /* reg0: 0-3=volume, 4-6=duty cycle - ** reg1: 8 bits of freq - ** reg2: 0-3=high freq, 7=enable - */ - - chan->accum -= vrcvi.incsize; /* # of clocks per wave cycle */ - while (chan->accum < 0) - { - chan->accum += chan->freq; - chan->adder = (chan->adder + 1) & 0x0F; - } - - /* return if not enabled */ - if (false == chan->enabled) - return 0; - - if (chan->adder < chan->duty_flip) - return -(chan->volume); - else - return chan->volume; -} - -/* VRCVI sawtooth wave generation */ -static int32 vrcvi_sawtooth(vrcvisawtooth_t *chan) -{ - /* reg0: 0-5=phase accumulator bits - ** reg1: 8 bits of freq - ** reg2: 0-3=high freq, 7=enable - */ - - chan->accum -= vrcvi.incsize; /* # of clocks per wav cycle */ - while (chan->accum < 0) - { - chan->accum += chan->freq; - chan->output_acc += chan->volume; - - chan->adder++; - if (7 == chan->adder) - { - chan->adder = 0; - chan->output_acc = 0; - } - } - - /* return if not enabled */ - if (false == chan->enabled) - return 0; - - return (chan->output_acc >> 3) << 9; -} - -/* mix vrcvi sound channels together */ -static int32 vrcvi_process(void) -{ - int32 output; - - output = vrcvi_rectangle(&vrcvi.rectangle[0]); - output += vrcvi_rectangle(&vrcvi.rectangle[1]); - output += vrcvi_sawtooth(&vrcvi.saw); - - return output; -} - -/* write to registers */ -static void vrcvi_write(uint32 address, uint8 value) -{ - int chan = (address >> 12) - 9; - - switch (address & 0xB003) - { - case 0x9000: - case 0xA000: - vrcvi.rectangle[chan].reg[0] = value; - vrcvi.rectangle[chan].volume = (value & 0x0F) << 8; - vrcvi.rectangle[chan].duty_flip = (value >> 4) + 1; - break; - - case 0x9001: - case 0xA001: - vrcvi.rectangle[chan].reg[1] = value; - vrcvi.rectangle[chan].freq = ((vrcvi.rectangle[chan].reg[2] & 0x0F) << 8) + value + 1; - break; - - case 0x9002: - case 0xA002: - vrcvi.rectangle[chan].reg[2] = value; - vrcvi.rectangle[chan].freq = ((value & 0x0F) << 8) + vrcvi.rectangle[chan].reg[1] + 1; - vrcvi.rectangle[chan].enabled = (value & 0x80) ? true : false; - break; - - case 0xB000: - vrcvi.saw.reg[0] = value; - vrcvi.saw.volume = value & 0x3F; - break; - - case 0xB001: - vrcvi.saw.reg[1] = value; - vrcvi.saw.freq = (((vrcvi.saw.reg[2] & 0x0F) << 8) + value + 1) << 1; - break; - - case 0xB002: - vrcvi.saw.reg[2] = value; - vrcvi.saw.freq = (((value & 0x0F) << 8) + vrcvi.saw.reg[1] + 1) << 1; - vrcvi.saw.enabled = (value & 0x80) ? true : false; - break; - - default: - break; - } -} - -/* reset state of vrcvi sound channels */ -static void vrcvi_reset(void) -{ - int i; - apu_t apu; - - /* get the phase period from the apu */ - apu_getcontext(&apu); - vrcvi.incsize = apu.cycle_rate; - - /* preload regs */ - for (i = 0; i < 3; i++) - { - vrcvi_write(0x9000 + i, 0); - vrcvi_write(0xA000 + i, 0); - vrcvi_write(0xB000 + i, 0); - } -} - -static apu_memwrite vrcvi_memwrite[] = -{ - { 0x9000, 0x9002, vrcvi_write }, /* vrc6 */ - { 0xA000, 0xA002, vrcvi_write }, - { 0xB000, 0xB002, vrcvi_write }, - { -1, -1, NULL } -}; - -apuext_t vrcvi_ext = -{ - NULL, /* no init */ - NULL, /* no shutdown */ - vrcvi_reset, - vrcvi_process, - NULL, /* no reads */ - vrcvi_memwrite -}; - -/* -** $Log: vrcvisnd.c,v $ -** Revision 1.2 2001/04/27 14:37:11 neil -** wheeee -** -** Revision 1.1 2001/04/27 12:54:40 neil -** blah -** -** Revision 1.1.1.1 2001/04/27 07:03:54 neil -** initial -** -** Revision 1.2 2000/11/05 22:21:00 matt -** help me! -** -** Revision 1.1 2000/10/24 12:20:00 matt -** changed directory structure -** -** Revision 1.17 2000/10/10 13:58:18 matt -** stroustrup squeezing his way in the door -** -** Revision 1.16 2000/10/03 11:56:20 matt -** better support for optional sound ext routines -** -** Revision 1.15 2000/09/27 12:26:03 matt -** changed sound accumulators back to floats -** -** Revision 1.14 2000/09/15 13:38:40 matt -** changes for optimized apu core -** -** Revision 1.13 2000/09/15 04:58:07 matt -** simplifying and optimizing APU core -** -** Revision 1.12 2000/07/30 04:32:59 matt -** no more apu_getcyclerate hack -** -** Revision 1.11 2000/07/17 01:52:31 matt -** made sure last line of all source files is a newline -** -** Revision 1.10 2000/07/06 11:42:41 matt -** forgot to remove FDS register range -** -** Revision 1.9 2000/07/04 04:51:41 matt -** cleanups -** -** Revision 1.8 2000/07/03 02:18:53 matt -** much better external module exporting -** -** Revision 1.7 2000/06/20 04:06:16 matt -** migrated external sound definition to apu module -** -** Revision 1.6 2000/06/20 00:08:58 matt -** changed to driver based API -** -** Revision 1.5 2000/06/09 16:49:02 matt -** removed all floating point from sound generation -** -** Revision 1.4 2000/06/09 15:12:28 matt -** initial revision -** -*/ diff --git a/MCUME_pico/piconofrendo/vrcvisnd.h b/MCUME_pico/piconofrendo/vrcvisnd.h deleted file mode 100755 index 136cbc2..0000000 --- a/MCUME_pico/piconofrendo/vrcvisnd.h +++ /dev/null @@ -1,70 +0,0 @@ -/* -** Nofrendo (c) 1998-2000 Matthew Conte (matt@conte.com) -** -** -** This program is free software; you can redistribute it and/or -** modify it under the terms of version 2 of the GNU Library General -** Public License as published by the Free Software Foundation. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** Library General Public License for more details. To obtain a -** copy of the GNU Library General Public License, write to the Free -** Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -** -** Any permitted reproduction of these routines, in whole or in part, -** must bear this legend. -** -** -** vrcvisnd.h -** -** VRCVI (Konami MMC) sound hardware emulation header -** $Id: vrcvisnd.h,v 1.2 2001/04/27 14:37:11 neil Exp $ -*/ - -#ifndef _VRCVISND_H_ -#define _VRCVISND_H_ - -#include "nes_apu.h" - -extern apuext_t vrcvi_ext; - -#endif /* _VRCVISND_H_ */ - -/* -** $Log: vrcvisnd.h,v $ -** Revision 1.2 2001/04/27 14:37:11 neil -** wheeee -** -** Revision 1.1 2001/04/27 12:54:40 neil -** blah -** -** Revision 1.1.1.1 2001/04/27 07:03:54 neil -** initial -** -** Revision 1.1 2000/10/24 12:20:00 matt -** changed directory structure -** -** Revision 1.10 2000/09/27 12:26:03 matt -** changed sound accumulators back to floats -** -** Revision 1.9 2000/09/15 13:38:40 matt -** changes for optimized apu core -** -** Revision 1.8 2000/07/17 01:52:31 matt -** made sure last line of all source files is a newline -** -** Revision 1.7 2000/06/20 04:06:16 matt -** migrated external sound definition to apu module -** -** Revision 1.6 2000/06/20 00:08:58 matt -** changed to driver based API -** -** Revision 1.5 2000/06/09 16:49:02 matt -** removed all floating point from sound generation -** -** Revision 1.4 2000/06/09 15:12:28 matt -** initial revision -** -*/ diff --git a/MCUME_pico/picoo2em/AudioPlaySystem.cpp b/MCUME_pico/picoo2em/AudioPlaySystem.cpp deleted file mode 100644 index 36b764d..0000000 --- a/MCUME_pico/picoo2em/AudioPlaySystem.cpp +++ /dev/null @@ -1,179 +0,0 @@ -#include "emuapi.h" - -#ifdef HAS_SND - -#include "AudioPlaySystem.h" - -#define SAMPLERATE AUDIO_SAMPLE_RATE_EXACT -#define CLOCKFREQ 985248 - -#ifndef CUSTOM_SND -static const short square[]={ -32767,32767,32767,32767, -32767,32767,32767,32767, -32767,32767,32767,32767, -32767,32767,32767,32767, -32767,32767,32767,32767, -32767,32767,32767,32767, -32767,32767,32767,32767, -32767,32767,32767,32767, --32767,-32767,-32767,-32767, --32767,-32767,-32767,-32767, --32767,-32767,-32767,-32767, --32767,-32767,-32767,-32767, --32767,-32767,-32767,-32767, --32767,-32767,-32767,-32767, --32767,-32767,-32767,-32767, --32767,-32767,-32767,-32767, -}; - -const short noise[] { --32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767, --32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,32767,-32767, --32767,-32767,32767,-32767,-32767,-32767,32767,-32767,-32767,-32767,32767,-32767,-32767,-32767,32767,-32767, --32767,-32767,32767,-32767,-32767,-32767,32767,-32767,-32767,-32767,32767,-32767,-32767,32767,32767,-32767, --32767,-32767,32767,-32767,-32767,32767,32767,-32767,-32767,-32767,32767,-32767,-32767,32767,32767,-32767, --32767,-32767,32767,-32767,-32767,32767,32767,-32767,-32767,-32767,32767,-32767,32767,32767,32767,-32767, -32767,-32767,32767,-32767,-32767,32767,32767,-32767,-32767,-32767,32767,-32767,32767,32767,32767,-32767, -32767,-32767,32767,-32767,-32767,32767,32767,-32767,-32767,-32767,32767,32767,32767,32767,32767,-32767, -32767,-32767,32767,-32767,-32767,32767,32767,-32767,-32767,-32767,32767,32767,32767,32767,32767,-32767, -32767,-32767,32767,-32767,-32767,32767,32767,-32767,-32767,-32767,-32767,32767,32767,32767,-32767,-32767, -32767,-32767,-32767,-32767,-32767,32767,-32767,-32767,-32767,-32767,32767,32767,32767,32767,32767,-32767, -32767,-32767,32767,-32767,-32767,32767,32767,-32767,-32767,32767,-32767,32767,32767,32767,-32767,-32767, -32767,32767,-32767,-32767,-32767,32767,-32767,-32767,-32767,-32767,32767,32767,32767,32767,32767,-32767, -32767,-32767,32767,-32767,-32767,32767,32767,-32767,32767,32767,-32767,32767,-32767,32767,-32767,-32767, -32767,32767,-32767,-32767,-32767,32767,-32767,-32767,-32767,-32767,32767,32767,32767,32767,32767,-32767, -32767,-32767,32767,-32767,-32767,32767,32767,32767,32767,32767,-32767,32767,-32767,32767,-32767,-32767, -}; - -#define NOISEBSIZE 0x100 - -typedef struct -{ - unsigned int spos; - unsigned int sinc; - unsigned int vol; -} Channel; - -static Channel chan[6] = { - {0,0,0}, - {0,0,0}, - {0,0,0}, - {0,0,0}, - {0,0,0}, - {0,0,0} }; - -#endif - -volatile bool playing = false; - - -static void snd_Reset(void) -{ -#ifndef CUSTOM_SND - chan[0].vol = 0; - chan[1].vol = 0; - chan[2].vol = 0; - chan[3].vol = 0; - chan[4].vol = 0; - chan[5].vol = 0; - chan[0].sinc = 0; - chan[1].sinc = 0; - chan[2].sinc = 0; - chan[3].sinc = 0; - chan[4].sinc = 0; - chan[5].sinc = 0; -#endif -} - - -#ifdef CUSTOM_SND -extern "C" { -void SND_Process(void *sndbuffer, int sndn); -} -#endif - -#include -void AudioPlaySystem::snd_Mixer(short * stream, int len ) -{ - if (playing) - { -#ifdef CUSTOM_SND - //printf("s\n"); - SND_Process((void*)stream, len); -#else - int i; - long s; - len = len >> 1; - short v0=chan[0].vol; - short v1=chan[1].vol; - short v2=chan[2].vol; - short v3=chan[3].vol; - short v4=chan[4].vol; - short v5=chan[5].vol; - for (i=0;i>8)&0x3f])>>11); - s+=((v1*square[(chan[1].spos>>8)&0x3f])>>11); - s+=((v2*square[(chan[2].spos>>8)&0x3f])>>11); - s+=((v3*noise[(chan[3].spos>>8)&(NOISEBSIZE-1)])>>11); - s+=((v4*noise[(chan[4].spos>>8)&(NOISEBSIZE-1)])>>11); - s+=((v5*noise[(chan[5].spos>>8)&(NOISEBSIZE-1)])>>11); - *stream++ = (short)(s); - *stream++ = (short)(s); - chan[0].spos += chan[0].sinc; - chan[1].spos += chan[1].sinc; - chan[2].spos += chan[2].sinc; - chan[3].spos += chan[3].sinc; - chan[4].spos += chan[4].sinc; - chan[5].spos += chan[5].sinc; - } -#endif - } -} - -void AudioPlaySystem::begin(void) -{ - this->reset(); -} - -void AudioPlaySystem::start(void) -{ - playing = true; -} - -void AudioPlaySystem::setSampleParameters(float clockfreq, float samplerate) { -} - -void AudioPlaySystem::reset(void) -{ - snd_Reset(); -} - -void AudioPlaySystem::stop(void) -{ - playing = false; -} - -bool AudioPlaySystem::isPlaying(void) -{ - return playing; -} - - - -void AudioPlaySystem::sound(int C, int F, int V) { -#ifndef CUSTOM_SND - if (C < 6) { - chan[C].vol = V; - chan[C].sinc = F>>1; - } -#endif -} - -void AudioPlaySystem::step(void) { -} - -void AudioPlaySystem::buzz(int size, int val) { -} -#endif diff --git a/MCUME_pico/picoo2em/AudioPlaySystem.h b/MCUME_pico/picoo2em/AudioPlaySystem.h deleted file mode 100644 index 5d2efc0..0000000 --- a/MCUME_pico/picoo2em/AudioPlaySystem.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef audioplaysystem_h_ -#define audioplaysystem_h_ - -#ifdef HAS_SND - -#include "platform_config.h" - -class AudioPlaySystem -{ -public: - AudioPlaySystem(void) { }; - void begin(void); - void setSampleParameters(float clockfreq, float samplerate); - void reset(void); - void start(void); - void stop(void); - bool isPlaying(void); - void sound(int C, int F, int V); - void buzz(int size, int val); - void step(void); - static void snd_Mixer(short * stream, int len ); -}; - -#endif - -#endif diff --git a/MCUME_pico/picoo2em/Oddemu.c b/MCUME_pico/picoo2em/Oddemu.c index c59eaaa..9f524ac 100644 --- a/MCUME_pico/picoo2em/Oddemu.c +++ b/MCUME_pico/picoo2em/Oddemu.c @@ -197,6 +197,14 @@ void odd_Step(void) { run(); - emu_DrawScreen((unsigned char *)getGBuf()+BORDERW/2, BMPW-BORDERW, BMPH, BMPW); +#if SINGLELINE_RENDERING + unsigned char * src=(unsigned char *)getGBuf(); + for (int y=0; y -#include - -extern "C" { - #include "emuapi.h" - #include "iopins.h" -} - -static bool emu_writeConfig(void); -static bool emu_readConfig(void); -static bool emu_eraseConfig(void); - - -#if (defined(ILI9341) || defined(ST7789)) && defined(USE_VGA) -// Dual display config, initialize TFT -#include "tft_t_dma.h" -static TFT_T_DMA tft; -#else -// Non Dual display config -#ifdef USE_VGA -#include "vga_t_dma.h" -#else -#include "tft_t_dma.h" -#endif -extern TFT_T_DMA tft; -#endif - - -#define MAX_FILENAME_PATH 64 -#define NB_FILE_HANDLER 4 -#define AUTORUN_FILENAME "autorun.txt" - -#define MAX_FILES 64 -#define MAX_FILENAME_SIZE 24 -#define MAX_MENULINES 9 -#define TEXT_HEIGHT 16 -#define TEXT_WIDTH 8 -#define MENU_FILE_XOFFSET (6*TEXT_WIDTH) -#define MENU_FILE_YOFFSET (2*TEXT_HEIGHT) -#define MENU_FILE_W (MAX_FILENAME_SIZE*TEXT_WIDTH) -#define MENU_FILE_H (MAX_MENULINES*TEXT_HEIGHT) -#define MENU_FILE_BGCOLOR RGBVAL16(0x00,0x00,0x40) -#define MENU_JOYS_YOFFSET (12*TEXT_HEIGHT) -#define MENU_VBAR_XOFFSET (0*TEXT_WIDTH) -#define MENU_VBAR_YOFFSET (MENU_FILE_YOFFSET) - -#define MENU_TFT_XOFFSET (MENU_FILE_XOFFSET+MENU_FILE_W+8) -#define MENU_TFT_YOFFSET (MENU_VBAR_YOFFSET+32) -#define MENU_VGA_XOFFSET (MENU_FILE_XOFFSET+MENU_FILE_W+8) -#define MENU_VGA_YOFFSET (MENU_VBAR_YOFFSET+MENU_FILE_H-32-37) - - - -static int nbFiles=0; -static int curFile=0; -static int topFile=0; -static char selection[MAX_FILENAME_PATH]=""; -static char selected_filename[MAX_FILENAME_SIZE]=""; -static char files[MAX_FILES][MAX_FILENAME_SIZE]; -static bool menuRedraw=true; - -#ifdef PICOMPUTER -static const unsigned short * keys; -static unsigned char keymatrix[6]; -static int keymatrix_hitrow=-1; -static bool key_fn=false; -static bool key_alt=false; -static uint32_t keypress_t_ms=0; -static uint32_t last_t_ms=0; -static uint32_t hundred_ms_cnt=0; -static bool ledflash_toggle=false; -#endif -static int keyMap; - -static bool joySwapped = false; -static uint16_t bLastState; -static int xRef; -static int yRef; -static uint8_t usbnavpad=0; - -static bool menuOn=true; -static bool autorun=false; - - -/******************************** - * Generic output and malloc -********************************/ -void emu_printf(const char * text) -{ - printf("%s\n",text); -} - -void emu_printf(int val) -{ - printf("%d\n",val); -} - -void emu_printi(int val) -{ - printf("%d\n",val); -} - -void emu_printh(int val) -{ - printf("0x%.8\n",val); -} - -static int malbufpt = 0; -static char malbuf[EXTRA_HEAP]; - -void * emu_Malloc(int size) -{ - void * retval = malloc(size); - if (!retval) { - emu_printf("failled to allocate"); - emu_printf(size); - emu_printf("fallback"); - if ( (malbufpt+size) < sizeof(malbuf) ) { - retval = (void *)&malbuf[malbufpt]; - malbufpt += size; - } - else { - emu_printf("failure to allocate"); - } - } - else { - emu_printf("could allocate dynamic "); - emu_printf(size); - } - - return retval; -} - -void * emu_MallocI(int size) -{ - void * retval = NULL; - - if ( (malbufpt+size) < sizeof(malbuf) ) { - retval = (void *)&malbuf[malbufpt]; - malbufpt += size; - emu_printf("could allocate static "); - emu_printf(size); - } - else { - emu_printf("failure to allocate"); - } - - return retval; -} -void emu_Free(void * pt) -{ - free(pt); -} - -void emu_drawText(unsigned short x, unsigned short y, const char * text, unsigned short fgcolor, unsigned short bgcolor, int doublesize) -{ - tft.drawText(x, y, text, fgcolor, bgcolor, doublesize?true:false); -} - - -/******************************** - * OSKB handling -********************************/ -#if (defined(ILI9341) || defined(ST7789)) && defined(USE_VGA) -// On screen keyboard position -#define KXOFF 28 //64 -#define KYOFF 96 -#define KWIDTH 11 //22 -#define KHEIGHT 3 - -static bool oskbOn = false; -static int cxpos = 0; -static int cypos = 0; -static int oskbMap = 0; -static uint16_t oskbBLastState = 0; - -static void lineOSKB2(int kxoff, int kyoff, char * str, int row) -{ - char c[2] = {'A',0}; - const char * cpt = str; - for (int i=0; i.,SP ", 2); - if (oskbMap == 0) { - lineOSKB(KXOFF,KYOFF, keylables_map1_0, 0); - lineOSKB(KXOFF,KYOFF, keylables_map1_1, 1); - lineOSKB(KXOFF,KYOFF, keylables_map1_2, 2); - } - else if (oskbMap == 1) { - lineOSKB(KXOFF,KYOFF, keylables_map2_0, 0); - lineOSKB(KXOFF,KYOFF, keylables_map2_1, 1); - lineOSKB(KXOFF,KYOFF, keylables_map2_2, 2); - } - else { - lineOSKB(KXOFF,KYOFF, keylables_map3_0, 0); - lineOSKB(KXOFF,KYOFF, keylables_map3_1, 1); - lineOSKB(KXOFF,KYOFF, keylables_map3_2, 2); - } -} - -void toggleOskb(bool forceoff) { - if (forceoff) oskbOn=true; - if (oskbOn) { - oskbOn = false; - tft.fillScreenNoDma(RGBVAL16(0x00,0x00,0x00)); - tft.drawTextNoDma(0,32, "Press USER2 to toggle onscreen keyboard.", RGBVAL16(0xff,0xff,0xff), RGBVAL16(0x00,0x00,0x00), true); - } else { - oskbOn = true; - tft.fillScreenNoDma(RGBVAL16(0x00,0x00,0x00)); - tft.drawTextNoDma(0,32, " Press USER2 to exit onscreen keyboard. ", RGBVAL16(0xff,0xff,0xff), RGBVAL16(0x00,0x00,0x00), true); - tft.drawTextNoDma(0,64, " (USER1 to toggle between keymaps) ", RGBVAL16(0x00,0xff,0xff), RGBVAL16(0x00,0x00,0xff), true); - tft.drawRectNoDma(KXOFF,KYOFF, 22*8, 3*16, RGBVAL16(0x00,0x00,0xFF)); - drawOskb(); - } -} - -static int handleOskb(void) -{ - int retval = 0; - - uint16_t bClick = bLastState & ~oskbBLastState; - oskbBLastState = bLastState; - /* - static const char * digits = "0123456789ABCDEF"; - char buf[5] = {0,0,0,0,0}; - int val = bClick; - buf[0] = digits[(val>>12)&0xf]; - buf[1] = digits[(val>>8)&0xf]; - buf[2] = digits[(val>>4)&0xf]; - buf[3] = digits[val&0xf]; - tft.drawTextNoDma(0,KYOFF+ 64,buf,RGBVAL16(0x00,0x00,0x00),RGBVAL16(0xFF,0xFF,0xFF),1); - */ - if (bClick & MASK_KEY_USER2) - { - toggleOskb(false); - } - if (oskbOn) - { - bool updated = true; - if (bClick & MASK_KEY_USER1) - { - oskbMap += 1; - if (oskbMap == 3) oskbMap = 0; - } - else if (bClick & MASK_JOY2_LEFT) - { - cxpos++; - if (cxpos >= KWIDTH) cxpos = 0; - } - else if (bClick & MASK_JOY2_RIGHT) - { - cxpos--; - if (cxpos < 0) cxpos = KWIDTH-1; - } - else if (bClick & MASK_JOY2_DOWN) - { - cypos++; - if (cypos >= KHEIGHT) cypos = 0; - } - else if (bClick & MASK_JOY2_UP) - { - cypos--; - if (cypos < 0) cypos = KHEIGHT-1; - } - else if (oskbBLastState & MASK_JOY2_BTN) - { - retval = cypos*KWIDTH+cxpos+1; - if (retval) { - retval--; - //if (retval & 1) retval = key_map2[retval>>1]; - //else retval = key_map1[retval>>1]; - if (oskbMap == 0) { - retval = key_map1[retval]; - } - else if (oskbMap == 1) { - retval = key_map2[retval]; - } - else { - retval = key_map3[retval]; - } - //if (retval) { toggleOskb(true); updated=false; }; - } - } - else { - updated=false; - } - if (updated) drawOskb(); - } - - return retval; -} -#endif - -/******************************** - * Input and keyboard -********************************/ -int emu_ReadAnalogJoyX(int min, int max) -{ - adc_select_input(0); - int val = adc_read(); -#if INVX - val = 4095 - val; -#endif - val = val-xRef; - val = ((val*140)/100); - if ( (val > -512) && (val < 512) ) val = 0; - val = val+2048; - return (val*(max-min))/4096; -} - -int emu_ReadAnalogJoyY(int min, int max) -{ - adc_select_input(1); - int val = adc_read(); -#if INVY - val = 4095 - val; -#endif - val = val-yRef; - val = ((val*120)/100); - if ( (val > -512) && (val < 512) ) val = 0; - //val = (val*(max-min))/4096; - val = val+2048; - //return val+(max-min)/2; - return (val*(max-min))/4096; -} - - -static uint16_t readAnalogJoystick(void) -{ - uint16_t joysval = 0; -#ifdef PIN_JOY2_A1X - int xReading = emu_ReadAnalogJoyX(0,256); - if (xReading > 128) joysval |= MASK_JOY2_LEFT; - else if (xReading < 128) joysval |= MASK_JOY2_RIGHT; - - int yReading = emu_ReadAnalogJoyY(0,256); - if (yReading < 128) joysval |= MASK_JOY2_UP; - else if (yReading > 128) joysval |= MASK_JOY2_DOWN; -#endif - // First joystick -#if INVY -#ifdef PIN_JOY2_1 - if ( !gpio_get(PIN_JOY2_1) ) joysval |= MASK_JOY2_DOWN; -#endif -#ifdef PIN_JOY2_2 - if ( !gpio_get(PIN_JOY2_2) ) joysval |= MASK_JOY2_UP; -#endif -#else -#ifdef PIN_JOY2_1 - if ( !gpio_get(PIN_JOY2_1) ) joysval |= MASK_JOY2_UP; -#endif -#ifdef PIN_JOY2_2 - if ( !gpio_get(PIN_JOY2_2) ) joysval |= MASK_JOY2_DOWN; -#endif -#endif -#if INVX -#ifdef PIN_JOY2_3 - if ( !gpio_get(PIN_JOY2_3) ) joysval |= MASK_JOY2_LEFT; -#endif -#ifdef PIN_JOY2_4 - if ( !gpio_get(PIN_JOY2_4) ) joysval |= MASK_JOY2_RIGHT; -#endif -#else -#ifdef PIN_JOY2_3 - if ( !gpio_get(PIN_JOY2_3) ) joysval |= MASK_JOY2_RIGHT; -#endif -#ifdef PIN_JOY2_4 - if ( !gpio_get(PIN_JOY2_4) ) joysval |= MASK_JOY2_LEFT; -#endif -#endif -#ifdef PIN_JOY2_BTN - joysval |= (gpio_get(PIN_JOY2_BTN) ? 0 : MASK_JOY2_BTN); -#endif - - return (joysval); -} - - -int emu_SwapJoysticks(int statusOnly) { - if (!statusOnly) { - if (joySwapped) { - joySwapped = false; - } - else { - joySwapped = true; - } - } - return(joySwapped?1:0); -} - -int emu_GetPad(void) -{ - return(bLastState/*|((joySwapped?1:0)<<7)*/); -} - -int emu_ReadKeys(void) -{ - uint16_t retval; - uint16_t j1 = readAnalogJoystick(); - uint16_t j2 = 0; - - // Second joystick -#if INVY -#ifdef PIN_JOY1_1 - if ( !gpio_get(PIN_JOY1_1) ) j2 |= MASK_JOY2_DOWN; -#endif -#ifdef PIN_JOY1_2 - if ( !gpio_get(PIN_JOY1_2) ) j2 |= MASK_JOY2_UP; -#endif -#else -#ifdef PIN_JOY1_1 - if ( !gpio_get(PIN_JOY1_1) ) j2 |= MASK_JOY2_UP; -#endif -#ifdef PIN_JOY1_2 - if ( !gpio_get(PIN_JOY1_2) ) j2 |= MASK_JOY2_DOWN; -#endif -#endif -#if INVX -#ifdef PIN_JOY1_3 - if ( !gpio_get(PIN_JOY1_3) ) j2 |= MASK_JOY2_LEFT; -#endif -#ifdef PIN_JOY1_4 - if ( !gpio_get(PIN_JOY1_4) ) j2 |= MASK_JOY2_RIGHT; -#endif -#else -#ifdef PIN_JOY1_3 - if ( !gpio_get(PIN_JOY1_3) ) j2 |= MASK_JOY2_RIGHT; -#endif -#ifdef PIN_JOY1_4 - if ( !gpio_get(PIN_JOY1_4) ) j2 |= MASK_JOY2_LEFT; -#endif -#endif -#ifdef PIN_JOY1_BTN - if ( !gpio_get(PIN_JOY1_BTN) ) j2 |= MASK_JOY2_BTN; -#endif - - - if (joySwapped) { - retval = ((j1 << 8) | j2); - } - else { - retval = ((j2 << 8) | j1); - } - - if (usbnavpad & MASK_JOY2_UP) retval |= MASK_JOY2_UP; - if (usbnavpad & MASK_JOY2_DOWN) retval |= MASK_JOY2_DOWN; - if (usbnavpad & MASK_JOY2_LEFT) retval |= MASK_JOY2_LEFT; - if (usbnavpad & MASK_JOY2_RIGHT) retval |= MASK_JOY2_RIGHT; - if (usbnavpad & MASK_JOY2_BTN) retval |= MASK_JOY2_BTN; - -#ifdef PIN_KEY_USER1 - if ( !gpio_get(PIN_KEY_USER1) ) retval |= MASK_KEY_USER1; -#endif -#ifdef PIN_KEY_USER2 - if ( !gpio_get(PIN_KEY_USER2) ) retval |= MASK_KEY_USER2; -#endif -#ifdef PIN_KEY_USER3 - if ( !gpio_get(PIN_KEY_USER3) ) retval |= MASK_KEY_USER3; -#endif -#ifdef PIN_KEY_USER4 - if ( !gpio_get(PIN_KEY_USER4) ) retval |= MASK_KEY_USER4; -#endif - -#ifdef PICOMPUTER - keymatrix_hitrow = -1; - unsigned char row; - unsigned short cols[6]={KCOLOUT1,KCOLOUT2,KCOLOUT3,KCOLOUT4,KCOLOUT5,KCOLOUT6}; - unsigned char keymatrixtmp[6]; - - for (int i=0;i<6;i++){ - gpio_set_dir(cols[i], GPIO_OUT); - gpio_put(cols[i], 0); -#ifdef SWAP_ALT_DEL - sleep_us(1); - //__asm volatile ("nop\n"); // 4-8ns -#endif - row=0; - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN4) ? 0 : 0x02); - row |= (gpio_get(KROWIN1) ? 0 : 0x04); - row |= (gpio_get(KROWIN3) ? 0 : 0x08); - row |= (gpio_get(KROWIN5) ? 0 : 0x10); - row |= (gpio_get(KROWIN6) ? 0 : 0x20); - //gpio_set_dir(cols[i], GPIO_OUT); - gpio_put(cols[i], 1); - gpio_set_dir(cols[i], GPIO_IN); - gpio_disable_pulls(cols[i]); - keymatrixtmp[i] = row; - } - -#ifdef MULTI_DEBOUNCE - for (int i=0;i<6;i++){ - gpio_set_dir(cols[i], GPIO_OUT); - gpio_put(cols[i], 0); -#ifdef SWAP_ALT_DEL - sleep_us(1); - //__asm volatile ("nop\n"); // 4-8ns -#endif - row=0; - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN4) ? 0 : 0x02); - row |= (gpio_get(KROWIN1) ? 0 : 0x04); - row |= (gpio_get(KROWIN3) ? 0 : 0x08); - row |= (gpio_get(KROWIN5) ? 0 : 0x10); - row |= (gpio_get(KROWIN6) ? 0 : 0x20); - //gpio_set_dir(cols[i], GPIO_OUT); - gpio_put(cols[i], 1); - gpio_set_dir(cols[i], GPIO_IN); - gpio_disable_pulls(cols[i]); - keymatrixtmp[i] |= row; - } - - for (int i=0;i<6;i++){ - gpio_set_dir(cols[i], GPIO_OUT); - gpio_put(cols[i], 0); -#ifdef SWAP_ALT_DEL - sleep_us(1); - //__asm volatile ("nop\n"); // 4-8ns -#endif - row=0; - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN4) ? 0 : 0x02); - row |= (gpio_get(KROWIN1) ? 0 : 0x04); - row |= (gpio_get(KROWIN3) ? 0 : 0x08); - row |= (gpio_get(KROWIN5) ? 0 : 0x10); - row |= (gpio_get(KROWIN6) ? 0 : 0x20); - //gpio_set_dir(cols[i], GPIO_OUT); - gpio_put(cols[i], 1); - gpio_set_dir(cols[i], GPIO_IN); - gpio_disable_pulls(cols[i]); - keymatrixtmp[i] |= row; - } -#endif - -#ifdef SWAP_ALT_DEL - // Swap ALT and DEL - unsigned char alt = keymatrixtmp[0] & 0x02; - unsigned char del = keymatrixtmp[5] & 0x20; - keymatrixtmp[0] &= ~0x02; - keymatrixtmp[5] &= ~0x20; - if (alt) keymatrixtmp[5] |= 0x20; - if (del) keymatrixtmp[0] |= 0x02; -#endif - - bool alt_pressed=false; - if ( keymatrixtmp[5] & 0x20 ) {alt_pressed=true; keymatrixtmp[5] &= ~0x20;}; - - for (int i=0;i<6;i++){ - row = keymatrixtmp[i]; - if (row) keymatrix_hitrow=i; - keymatrix[i] = row; - } - - //6,9,15,8,7,22 -#if INVX - if ( row & 0x2 ) retval |= MASK_JOY2_LEFT; - if ( row & 0x1 ) retval |= MASK_JOY2_RIGHT; -#else - if ( row & 0x1 ) retval |= MASK_JOY2_LEFT; - if ( row & 0x2 ) retval |= MASK_JOY2_RIGHT; -#endif -#if INVY - if ( row & 0x8 ) retval |= MASK_JOY2_DOWN; - if ( row & 0x4 ) retval |= MASK_JOY2_UP; -#else - if ( row & 0x4 ) retval |= MASK_JOY2_DOWN; - if ( row & 0x8 ) retval |= MASK_JOY2_UP; -#endif - if ( row & 0x10 ) retval |= MASK_JOY2_BTN; - - // Handle LED flash - uint32_t time_ms=to_ms_since_boot (get_absolute_time()); - if ((time_ms-last_t_ms) > 100) { - last_t_ms = time_ms; - if (ledflash_toggle == false) { - ledflash_toggle = true; - } - else { - ledflash_toggle = false; - } - } - - if ( alt_pressed ) { - if (key_fn == false) - { - // Release to Press transition - if (hundred_ms_cnt == 0) { - keypress_t_ms=time_ms; - hundred_ms_cnt += 1; // 1 - } - else { - hundred_ms_cnt += 1; // 2 - if (hundred_ms_cnt >= 2) - { - hundred_ms_cnt = 0; - /* - if ( (time_ms-keypress_t_ms) < 500) - { - if (key_alt == false) - { - key_alt = true; - } - else - { - key_alt = false; - } - } - */ - } - } - } - else { - // Keep press - if (hundred_ms_cnt == 1) { - if ((to_ms_since_boot (get_absolute_time())-keypress_t_ms) > 2000) - { - if (key_alt == false) - { - key_alt = true; - } - else - { - key_alt = false; - } - hundred_ms_cnt = 0; - } - } - } - key_fn = true; - } - else { - key_fn = false; - } - - // Handle LED - if (key_alt == true) { - gpio_put(KLED, (ledflash_toggle?1:0)); - } - else { - if (key_fn == true) { - gpio_put(KLED, 1); - } - else { - gpio_put(KLED, 0); - } - } - - if ( key_fn ) retval |= MASK_KEY_USER2; - if ( ( key_fn ) && (keymatrix[0] == 0x02 )) retval |= MASK_KEY_USER1; -#endif - - //Serial.println(retval,HEX); - - if ( ((retval & (MASK_KEY_USER1+MASK_KEY_USER2)) == (MASK_KEY_USER1+MASK_KEY_USER2)) - || (retval & MASK_KEY_USER4 ) ) - { - } - -#if (defined(ILI9341) || defined(ST7789)) && defined(USE_VGA) - if (oskbOn) { - retval |= MASK_OSKB; - } -#endif - - return (retval); -} - -unsigned short emu_DebounceLocalKeys(void) -{ - uint16_t bCurState = emu_ReadKeys(); - uint16_t bClick = bCurState & ~bLastState; - bLastState = bCurState; - - return (bClick); -} - -int emu_ReadI2CKeyboard(void) { - int retval=0; -#ifdef PICOMPUTER - if (key_alt) { - keys = (const unsigned short *)key_map3; - } - else if (key_fn) { - keys = (const unsigned short *)key_map2; - } - else { - keys = (const unsigned short *)key_map1; - } - if (keymatrix_hitrow >=0 ) { - unsigned short match = ((unsigned short)keymatrix_hitrow<<8) | keymatrix[keymatrix_hitrow]; - for (int i=0; i=0) { - menuRedraw=true; - curFile -= 9; - } else if (curFile!=0) { - menuRedraw=true; - curFile--; - } - } - else if ( (bClick & MASK_JOY2_DOWN) || (bClick & MASK_JOY1_DOWN) ) { - if ((curFile<(nbFiles-1)) && (nbFiles)) { - curFile++; - menuRedraw=true; - } - } - else if ( (bClick & MASK_JOY2_LEFT) || (bClick & MASK_JOY1_LEFT) ) { - if ((curFile<(nbFiles-9)) && (nbFiles)) { - curFile += 9; - menuRedraw=true; - } - else if ((curFile<(nbFiles-1)) && (nbFiles)) { - curFile++; - menuRedraw=true; - } - } - else if ( (bClick & MASK_KEY_USER2) ) { - emu_SwapJoysticks(0); - menuRedraw=true; - } - - if (menuRedraw && nbFiles) { - int fileIndex = 0; - tft.drawRectNoDma(MENU_FILE_XOFFSET,MENU_FILE_YOFFSET, MENU_FILE_W, MENU_FILE_H, MENU_FILE_BGCOLOR); -// if (curFile <= (MAX_MENULINES/2-1)) topFile=0; -// else topFile=curFile-(MAX_MENULINES/2); - if (curFile <= (MAX_MENULINES-1)) topFile=0; - else topFile=curFile-(MAX_MENULINES/2); - - int i=0; - while (i=nbFiles) { - // no more files - break; - } - char * filename = &files[fileIndex][0]; - if (fileIndex >= topFile) { - if ((i+topFile) < nbFiles ) { - if ((i+topFile)==curFile) { - tft.drawTextNoDma(MENU_FILE_XOFFSET,i*TEXT_HEIGHT+MENU_FILE_YOFFSET, filename, RGBVAL16(0xff,0xff,0x00), RGBVAL16(0xff,0x00,0x00), true); - strcpy(selected_filename,filename); - } - else { - tft.drawTextNoDma(MENU_FILE_XOFFSET,i*TEXT_HEIGHT+MENU_FILE_YOFFSET, filename, RGBVAL16(0xff,0xff,0xff), MENU_FILE_BGCOLOR, true); - } - } - i++; - } - fileIndex++; - } - - - tft.drawTextNoDma(48,MENU_JOYS_YOFFSET+8, (emu_SwapJoysticks(1)?(char*)"SWAP=1":(char*)"SWAP=0"), RGBVAL16(0x00,0xff,0xff), RGBVAL16(0x00,0x00,0xff), false); - menuRedraw=false; - } - - return (action); -} - -bool menuActive(void) -{ - return (menuOn); -} - -void toggleMenu(bool on) { - if (on) { - menuOn = true; - backgroundMenu(); - } else { - menuOn = false; - } -} - -char * menuSelection(void) -{ - return (selection); -} - - -/******************************** - * File IO -********************************/ -int emu_FileOpen(const char * filepath, const char * mode) -{ - int retval = 0; - - emu_printf("FileOpen..."); - emu_printf(filepath); - if( !(f_open(&file, filepath, FA_READ)) ) { - retval = 1; - } - else { - emu_printf("FileOpen failed"); - } - return (retval); -} - -int emu_FileRead(void * buf, int size, int handler) -{ - unsigned int retval=0; - f_read (&file, (void*)buf, size, &retval); - return retval; -} - -int emu_FileGetc(int handler) -{ - unsigned char c; - unsigned int retval=0; - if( !(f_read (&file, &c, 1, &retval)) ) - if (retval != 1) { - emu_printf("emu_FileGetc failed"); - } - return (int)c; -} - -void emu_FileClose(int handler) -{ - f_close(&file); -} - -int emu_FileSeek(int handler, int seek, int origin) -{ - f_lseek(&file, seek); - return (seek); -} - -int emu_FileTell(int handler) -{ - return (f_tell(&file)); -} - - -unsigned int emu_FileSize(const char * filepath) -{ - int filesize=0; - emu_printf("FileSize..."); - emu_printf(filepath); - FILINFO entry; - f_stat(filepath, &entry); - filesize = entry.fsize; - return(filesize); -} - -unsigned int emu_LoadFile(const char * filepath, void * buf, int size) -{ - int filesize = 0; - - emu_printf("LoadFile..."); - emu_printf(filepath); - if( !(f_open(&file, filepath, FA_READ)) ) { - filesize = f_size(&file); - emu_printf(filesize); - if (size >= filesize) - { - unsigned int retval=0; - if( (f_read (&file, buf, filesize, &retval)) ) { - emu_printf("File read failed"); - } - } - f_close(&file); - } - - return(filesize); -} - -static FIL outfile; - -static bool emu_writeConfig(void) -{ - bool retval = false; - if( !(f_open(&outfile, ROMSDIR "/" AUTORUN_FILENAME, FA_CREATE_NEW | FA_WRITE)) ) { - unsigned int sizeread=0; - if( (f_write (&outfile, selection, strlen(selection), &sizeread)) ) { - emu_printf("Config write failed"); - } - else { - retval = true; - } - f_close(&outfile); - } - return retval; -} - -static bool emu_readConfig(void) -{ - bool retval = false; - if( !(f_open(&outfile, ROMSDIR "/" AUTORUN_FILENAME, FA_READ)) ) { - unsigned int filesize = f_size(&outfile); - unsigned int sizeread=0; - if( (f_read (&outfile, selection, filesize, &sizeread)) ) { - emu_printf("Config read failed"); - } - else { - if (sizeread == filesize) { - selection[filesize]=0; - retval = true; - } - } - f_close(&outfile); - } - return retval; -} - -static bool emu_eraseConfig(void) -{ - f_unlink (ROMSDIR "/" AUTORUN_FILENAME); -} - - -/******************************** - * Initialization -********************************/ -void emu_init(void) -{ - // Dual display config, initialize TFT -#if (defined(ILI9341) || defined(ST7789)) && defined(USE_VGA) - tft.begin(); -#endif - - sd_init_driver(); - FRESULT fr = f_mount(&fatfs, "0:", 1); - - strcpy(selection,ROMSDIR); - nbFiles = readNbFiles(selection); - - emu_printf("SD initialized, files found: "); - emu_printi(nbFiles); - - emu_InitJoysticks(); -#ifdef SWAP_JOYSTICK - joySwapped = true; -#else - joySwapped = false; -#endif - - int keypressed = emu_ReadKeys(); -#ifdef PICOMPUTER - // Flip screen if UP pressed - if (keypressed & MASK_JOY2_UP) - { -#ifdef PICOMPUTERMAX -#ifndef USE_VGA - tft.flipscreen(true); -#endif -#else - tft.flipscreen(true); -#endif - } - else - { -#ifdef PICOMPUTERMAX -#ifndef USE_VGA - tft.flipscreen(false); -#endif -#else - tft.flipscreen(false); -#endif - } -#endif - - if (keypressed & MASK_JOY2_DOWN) { - tft.fillScreenNoDma( RGBVAL16(0xff,0x00,0x00) ); - tft.drawTextNoDma(64,48, (char*)" AUTURUN file erased", RGBVAL16(0xff,0xff,0x00), RGBVAL16(0xff,0x00,0x00), true); - tft.drawTextNoDma(64,48+24, (char*)"Please reset the board!", RGBVAL16(0xff,0xff,0x00), RGBVAL16(0xff,0x00,0x00), true); - emu_eraseConfig(); - } - else { - if (emu_readConfig()) { - autorun = true; - } - } - toggleMenu(true); -} - - -void emu_start(void) -{ - usbnavpad = 0; - - keyMap = 0; -} diff --git a/MCUME_pico/picoo2em/emuapi.h b/MCUME_pico/picoo2em/emuapi.h deleted file mode 100644 index 247d50a..0000000 --- a/MCUME_pico/picoo2em/emuapi.h +++ /dev/null @@ -1,158 +0,0 @@ -#ifndef EMUAPI_H -#define EMUAPI_H - -#include "platform_config.h" - -//#define TIMER_REND 1 -#define EXTRA_HEAP 0x10 - -// Title: < > -#define TITLE " Oddysey Emulator" -#define ROMSDIR "o2em" - - -#define emu_Init(ROM) {odd_Init();odd_Start(ROM);} -#define emu_Step() {odd_Step();} -#define emu_Input(x) {odd_Input(x);} - -#define VID_FRAME_SKIP 0x0 -#define PALETTE_SIZE 256 -#define TFT_VBUFFER_YCROP 20 - -#define ACTION_NONE 0 -#define ACTION_MAXKBDVAL 45 -#define ACTION_EXITKBD 128 -#define ACTION_RUNTFT 129 -#define ACTION_RUNVGA 130 - -#ifdef KEYMAP_PRESENT - -#define keylables_map1_0 (char *)"1234567890 " -#define keylables_map1_1 (char *)" " -#define keylables_map1_2 (char *)" " -const unsigned short key_map1[] = { - 1,2,3,4,5,6,7,8,9,10,0, - 0,0,0,0,0,0,0,0,0,0,0, - 0, 0,0,0,0,0,0,0,0,0, - 0,0,0,0 - }; - -/* -const unsigned short key_map1[] = { - 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, - 35,36,40,39,42,34,23,42,43,44, - 27,33,15,28,30,35,31,19,25,26, - - ACTION_NONE, 11,29,14,16,17,18,20,21,22, - ACTION_NONE, 36,34,13,32,12,24,23,ACTION_NONE,ACTION_NONE, - ACTION_NONE, 41}; -*/ -/* -"A B C D E F G H I J" - 11,12,13,14,15,16,17,18,19,20, - -"K L M N O P Q R S T" - 21,22,23,24,25,26,27,28,29,30, - -"U V W X Y Z - 31,32,33,34,35,36,37,36,39,40, -*/ - -#define keylables_map2_0 (char *)" " -#define keylables_map2_1 (char *)" " -#define keylables_map2_2 (char *)" " -const unsigned short key_map2[] = { - 0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0, - 0, 0,0,0,0,0,0,0,0,0, - 0,0,0,0 - }; - -#define keylables_map3_0 (char *)" " -#define keylables_map3_1 (char *)" " -#define keylables_map3_2 (char *)" " -const unsigned short key_map3[] = { - 0,0,0,0,0,0,0,0,0,0,0, // function keys - 0, 0,0,0,0,0,0,0,0,0,0, - 0, 0,0,0,0,0,0,0,0,0, - 0,0,0,0 - }; - -const unsigned short matkeys[] = { - 0x020,0x120,0x220,0x320,0x420,0x408,0x308,0x208,0x108,0x008,0x002, // row 1 - 0x510,0x010,0x110,0x210,0x310,0x410,0x401,0x301,0x201,0x101,0x001, // row 2 - 0x520,0x102,0x202,0x302,0x402,0x404,0x304,0x204,0x104,0x004, // row 3 - 0x508,0x501,0x502,0x504 }; // cursor keys - -#endif - -#define MASK_JOY2_RIGHT 0x0001 -#define MASK_JOY2_LEFT 0x0002 -#define MASK_JOY2_UP 0x0004 -#define MASK_JOY2_DOWN 0x0008 -#define MASK_JOY2_BTN 0x0010 -#define MASK_KEY_USER1 0x0020 -#define MASK_KEY_USER2 0x0040 -#define MASK_KEY_USER3 0x0080 -#define MASK_JOY1_RIGHT 0x0100 -#define MASK_JOY1_LEFT 0x0200 -#define MASK_JOY1_UP 0x0400 -#define MASK_JOY1_DOWN 0x0800 -#define MASK_JOY1_BTN 0x1000 -#define MASK_KEY_USER4 0x2000 -#define MASK_OSKB 0x8000 - - -extern void emu_init(void); -extern void emu_start(void); -extern void emu_resetSD(void); - -extern void emu_printf(const char * text); -extern void emu_printi(int val); -extern void * emu_Malloc(int size); -extern void emu_Free(void * pt); - -extern int emu_FileOpen(const char * filepath, const char * mode); -extern int emu_FileRead(void * buf, int size, int handler); -extern int emu_FileGetc(int handler); -extern int emu_FileSeek(int handler, int seek, int origin); -extern int emu_FileTell(int handler); -extern void emu_FileClose(int handler); - -extern unsigned int emu_FileSize(const char * filepath); -extern unsigned int emu_LoadFile(const char * filepath, void * buf, int size); - -extern void emu_SetPaletteEntry(unsigned char r, unsigned char g, unsigned char b, int index); -extern void emu_DrawScreen(unsigned char * VBuf, int width, int height, int stride); -extern void emu_DrawLine(unsigned char * VBuf, int width, int height, int line); -extern void emu_DrawLine8(unsigned char * VBuf, int width, int height, int line); -extern void emu_DrawLine16(unsigned short * VBuf, int width, int height, int line); -extern void emu_DrawVsync(void); -extern int emu_FrameSkip(void); -extern void * emu_LineBuffer(int line); - -extern void emu_InitJoysticks(void); -extern int emu_SwapJoysticks(int statusOnly); -extern unsigned short emu_DebounceLocalKeys(void); -extern int emu_ReadKeys(void); -extern int emu_GetPad(void); -extern int emu_ReadAnalogJoyX(int min, int max); -extern int emu_ReadAnalogJoyY(int min, int max); -extern int emu_ReadI2CKeyboard(void); -extern void emu_KeyboardOnUp(int keymodifer, int key); -extern void emu_KeyboardOnDown(int keymodifer, int key); - -extern void emu_sndPlaySound(int chan, int volume, int freq); -extern void emu_sndPlayBuzz(int size, int val); -extern void emu_sndInit(); -extern void emu_resetus(void); -extern int emu_us(void); - -extern int emu_setKeymap(int index); - -extern void emu_FileTempInit(void); -extern void emu_FileTempRead(int addr, unsigned char * val, int n); -extern void emu_FileTempWrite(int addr, unsigned char val); -extern void emu_printh(int val); - -#endif diff --git a/MCUME_pico/picoo2em/emucfg.h b/MCUME_pico/picoo2em/emucfg.h new file mode 100644 index 0000000..136c245 --- /dev/null +++ b/MCUME_pico/picoo2em/emucfg.h @@ -0,0 +1,116 @@ +#ifndef EMUCFG_H +#define EMUCFG_H + +#define PALETTE_SIZE 256 +#define VID_FRAME_SKIP 0x0 +#define TFT_VBUFFER_YCROP 20 +//#define SINGLELINE_RENDERING 1 +//#define CUSTOM_SND 1 +//#define TIMER_REND 1 +#define EXTRA_HEAP 0x10 +#define FILEBROWSER + +// Title: < > +#define TITLE " Oddysey Emulator" +#define ROMSDIR "o2em" + + +#define emu_Init(ROM) {odd_Init();odd_Start(ROM);} +#define emu_Step() {odd_Step();} +#define emu_Input(x) {odd_Input(x);} + +#ifdef KEYMAP_PRESENT + +#ifdef PICOZX +const unsigned short key_map1[] = { + 1,2,3,4,5,6,7,8,9,10, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0 + }; + +const unsigned short key_map2[] = { + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0 + }; + +const unsigned short key_map3[] = { + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0 + }; + +const unsigned short matkeys[] = { + 0x104,0x101,0x108,0x102,0x110,0x120,0x140,0x204,0x201,0x208, // row 1 + 0x202,0x210,0x220,0x240,0x304,0x301,0x308,0x302,0x310,0x320, // row 2 + 0x340,0x404,0x401,0x408,0x402,0x410,0x420,0x440,0x504,0x501, // row 3 + 0x020,0x508,0x502,0x510,0x520,0x540,0x604,0x601,0x040,0x608, // row 4 + 0x008,0x001,0x002,0x010,0x620,0x640 }; // cursor keys up, left, right, down, <<<, >>> + +#else +#define keylables_map1_0 (char *)"1234567890 " +#define keylables_map1_1 (char *)" " +#define keylables_map1_2 (char *)" " +const unsigned short key_map1[] = { + 1,2,3,4,5,6,7,8,9,10,0, + 0,0,0,0,0,0,0,0,0,0,0, + 0, 0,0,0,0,0,0,0,0,0, + 0,0,0,0 + }; + +/* +const unsigned short key_map1[] = { + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, + 35,36,40,39,42,34,23,42,43,44, + 27,33,15,28,30,35,31,19,25,26, + + ACTION_NONE, 11,29,14,16,17,18,20,21,22, + ACTION_NONE, 36,34,13,32,12,24,23,ACTION_NONE,ACTION_NONE, + ACTION_NONE, 41}; +*/ +/* +"A B C D E F G H I J" + 11,12,13,14,15,16,17,18,19,20, + +"K L M N O P Q R S T" + 21,22,23,24,25,26,27,28,29,30, + +"U V W X Y Z + 31,32,33,34,35,36,37,36,39,40, +*/ + +#define keylables_map2_0 (char *)" " +#define keylables_map2_1 (char *)" " +#define keylables_map2_2 (char *)" " +const unsigned short key_map2[] = { + 0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0, + 0, 0,0,0,0,0,0,0,0,0, + 0,0,0,0 + }; + +#define keylables_map3_0 (char *)" " +#define keylables_map3_1 (char *)" " +#define keylables_map3_2 (char *)" " +const unsigned short key_map3[] = { + 0,0,0,0,0,0,0,0,0,0,0, // function keys + 0, 0,0,0,0,0,0,0,0,0,0, + 0, 0,0,0,0,0,0,0,0,0, + 0,0,0,0 + }; + +const unsigned short matkeys[] = { + 0x020,0x120,0x220,0x320,0x420,0x408,0x308,0x208,0x108,0x008,0x002, // row 1 + 0x510,0x010,0x110,0x210,0x310,0x410,0x401,0x301,0x201,0x101,0x001, // row 2 + 0x520,0x102,0x202,0x302,0x402,0x404,0x304,0x204,0x104,0x004, // row 3 + 0x508,0x501,0x502,0x504 }; // cursor keys +#endif +#endif + +#endif diff --git a/MCUME_pico/picoo2em/font8x8.h b/MCUME_pico/picoo2em/font8x8.h deleted file mode 100644 index 4f773da..0000000 --- a/MCUME_pico/picoo2em/font8x8.h +++ /dev/null @@ -1,135 +0,0 @@ - -// Font: c64_lower.64c - -const unsigned char font8x8[128][8] PROGMEM = -{ - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0000 (nul) - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0001 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0002 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0003 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0004 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0005 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0006 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0007 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0008 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0009 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000A - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000B - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000C - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000D - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000E - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000F - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0010 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0011 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0012 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0013 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0014 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0015 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0016 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0017 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0018 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0019 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001A - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001B - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001C - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001D - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001E - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001F - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0020 (space) - { 0x18, 0x3C, 0x3C, 0x18, 0x18, 0x00, 0x18, 0x00}, // U+0021 (!) - { 0x36, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0022 (") - { 0x36, 0x36, 0x7F, 0x36, 0x7F, 0x36, 0x36, 0x00}, // U+0023 (#) - { 0x0C, 0x3E, 0x03, 0x1E, 0x30, 0x1F, 0x0C, 0x00}, // U+0024 ($) - { 0x00, 0x63, 0x33, 0x18, 0x0C, 0x66, 0x63, 0x00}, // U+0025 (%) - { 0x1C, 0x36, 0x1C, 0x6E, 0x3B, 0x33, 0x6E, 0x00}, // U+0026 (&) - { 0x06, 0x06, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0027 (') - { 0x18, 0x0C, 0x06, 0x06, 0x06, 0x0C, 0x18, 0x00}, // U+0028 (() - { 0x06, 0x0C, 0x18, 0x18, 0x18, 0x0C, 0x06, 0x00}, // U+0029 ()) - { 0x00, 0x66, 0x3C, 0xFF, 0x3C, 0x66, 0x00, 0x00}, // U+002A (*) - { 0x00, 0x0C, 0x0C, 0x3F, 0x0C, 0x0C, 0x00, 0x00}, // U+002B (+) - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x0C, 0x06}, // U+002C (,) - { 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x00}, // U+002D (-) - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x0C, 0x00}, // U+002E (.) - { 0x60, 0x30, 0x18, 0x0C, 0x06, 0x03, 0x01, 0x00}, // U+002F (/) - { 0x3E, 0x63, 0x73, 0x7B, 0x6F, 0x67, 0x3E, 0x00}, // U+0030 (0) - { 0x0C, 0x0E, 0x0C, 0x0C, 0x0C, 0x0C, 0x3F, 0x00}, // U+0031 (1) - { 0x1E, 0x33, 0x30, 0x1C, 0x06, 0x33, 0x3F, 0x00}, // U+0032 (2) - { 0x1E, 0x33, 0x30, 0x1C, 0x30, 0x33, 0x1E, 0x00}, // U+0033 (3) - { 0x38, 0x3C, 0x36, 0x33, 0x7F, 0x30, 0x78, 0x00}, // U+0034 (4) - { 0x3F, 0x03, 0x1F, 0x30, 0x30, 0x33, 0x1E, 0x00}, // U+0035 (5) - { 0x1C, 0x06, 0x03, 0x1F, 0x33, 0x33, 0x1E, 0x00}, // U+0036 (6) - { 0x3F, 0x33, 0x30, 0x18, 0x0C, 0x0C, 0x0C, 0x00}, // U+0037 (7) - { 0x1E, 0x33, 0x33, 0x1E, 0x33, 0x33, 0x1E, 0x00}, // U+0038 (8) - { 0x1E, 0x33, 0x33, 0x3E, 0x30, 0x18, 0x0E, 0x00}, // U+0039 (9) - { 0x00, 0x0C, 0x0C, 0x00, 0x00, 0x0C, 0x0C, 0x00}, // U+003A (:) - { 0x00, 0x0C, 0x0C, 0x00, 0x00, 0x0C, 0x0C, 0x06}, // U+003B (//) - { 0x18, 0x0C, 0x06, 0x03, 0x06, 0x0C, 0x18, 0x00}, // U+003C (<) - { 0x00, 0x00, 0x3F, 0x00, 0x00, 0x3F, 0x00, 0x00}, // U+003D (=) - { 0x06, 0x0C, 0x18, 0x30, 0x18, 0x0C, 0x06, 0x00}, // U+003E (>) - { 0x1E, 0x33, 0x30, 0x18, 0x0C, 0x00, 0x0C, 0x00}, // U+003F (?) - { 0x3E, 0x63, 0x7B, 0x7B, 0x7B, 0x03, 0x1E, 0x00}, // U+0040 (@) - { 0x0C, 0x1E, 0x33, 0x33, 0x3F, 0x33, 0x33, 0x00}, // U+0041 (A) - { 0x3F, 0x66, 0x66, 0x3E, 0x66, 0x66, 0x3F, 0x00}, // U+0042 (B) - { 0x3C, 0x66, 0x03, 0x03, 0x03, 0x66, 0x3C, 0x00}, // U+0043 (C) - { 0x1F, 0x36, 0x66, 0x66, 0x66, 0x36, 0x1F, 0x00}, // U+0044 (D) - { 0x7F, 0x46, 0x16, 0x1E, 0x16, 0x46, 0x7F, 0x00}, // U+0045 (E) - { 0x7F, 0x46, 0x16, 0x1E, 0x16, 0x06, 0x0F, 0x00}, // U+0046 (F) - { 0x3C, 0x66, 0x03, 0x03, 0x73, 0x66, 0x7C, 0x00}, // U+0047 (G) - { 0x33, 0x33, 0x33, 0x3F, 0x33, 0x33, 0x33, 0x00}, // U+0048 (H) - { 0x1E, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+0049 (I) - { 0x78, 0x30, 0x30, 0x30, 0x33, 0x33, 0x1E, 0x00}, // U+004A (J) - { 0x67, 0x66, 0x36, 0x1E, 0x36, 0x66, 0x67, 0x00}, // U+004B (K) - { 0x0F, 0x06, 0x06, 0x06, 0x46, 0x66, 0x7F, 0x00}, // U+004C (L) - { 0x63, 0x77, 0x7F, 0x7F, 0x6B, 0x63, 0x63, 0x00}, // U+004D (M) - { 0x63, 0x67, 0x6F, 0x7B, 0x73, 0x63, 0x63, 0x00}, // U+004E (N) - { 0x1C, 0x36, 0x63, 0x63, 0x63, 0x36, 0x1C, 0x00}, // U+004F (O) - { 0x3F, 0x66, 0x66, 0x3E, 0x06, 0x06, 0x0F, 0x00}, // U+0050 (P) - { 0x1E, 0x33, 0x33, 0x33, 0x3B, 0x1E, 0x38, 0x00}, // U+0051 (Q) - { 0x3F, 0x66, 0x66, 0x3E, 0x36, 0x66, 0x67, 0x00}, // U+0052 (R) - { 0x1E, 0x33, 0x07, 0x0E, 0x38, 0x33, 0x1E, 0x00}, // U+0053 (S) - { 0x3F, 0x2D, 0x0C, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+0054 (T) - { 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x3F, 0x00}, // U+0055 (U) - { 0x33, 0x33, 0x33, 0x33, 0x33, 0x1E, 0x0C, 0x00}, // U+0056 (V) - { 0x63, 0x63, 0x63, 0x6B, 0x7F, 0x77, 0x63, 0x00}, // U+0057 (W) - { 0x63, 0x63, 0x36, 0x1C, 0x1C, 0x36, 0x63, 0x00}, // U+0058 (X) - { 0x33, 0x33, 0x33, 0x1E, 0x0C, 0x0C, 0x1E, 0x00}, // U+0059 (Y) - { 0x7F, 0x63, 0x31, 0x18, 0x4C, 0x66, 0x7F, 0x00}, // U+005A (Z) - { 0x1E, 0x06, 0x06, 0x06, 0x06, 0x06, 0x1E, 0x00}, // U+005B ([) - { 0x03, 0x06, 0x0C, 0x18, 0x30, 0x60, 0x40, 0x00}, // U+005C (\) - { 0x1E, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1E, 0x00}, // U+005D (]) - { 0x08, 0x1C, 0x36, 0x63, 0x00, 0x00, 0x00, 0x00}, // U+005E (^) - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF}, // U+005F (_) - { 0x0C, 0x0C, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0060 (`) - { 0x00, 0x00, 0x1E, 0x30, 0x3E, 0x33, 0x6E, 0x00}, // U+0061 (a) - { 0x07, 0x06, 0x06, 0x3E, 0x66, 0x66, 0x3B, 0x00}, // U+0062 (b) - { 0x00, 0x00, 0x1E, 0x33, 0x03, 0x33, 0x1E, 0x00}, // U+0063 (c) - { 0x38, 0x30, 0x30, 0x3e, 0x33, 0x33, 0x6E, 0x00}, // U+0064 (d) - { 0x00, 0x00, 0x1E, 0x33, 0x3f, 0x03, 0x1E, 0x00}, // U+0065 (e) - { 0x1C, 0x36, 0x06, 0x0f, 0x06, 0x06, 0x0F, 0x00}, // U+0066 (f) - { 0x00, 0x00, 0x6E, 0x33, 0x33, 0x3E, 0x30, 0x1F}, // U+0067 (g) - { 0x07, 0x06, 0x36, 0x6E, 0x66, 0x66, 0x67, 0x00}, // U+0068 (h) - { 0x0C, 0x00, 0x0E, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+0069 (i) - { 0x30, 0x00, 0x30, 0x30, 0x30, 0x33, 0x33, 0x1E}, // U+006A (j) - { 0x07, 0x06, 0x66, 0x36, 0x1E, 0x36, 0x67, 0x00}, // U+006B (k) - { 0x0E, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+006C (l) - { 0x00, 0x00, 0x33, 0x7F, 0x7F, 0x6B, 0x63, 0x00}, // U+006D (m) - { 0x00, 0x00, 0x1F, 0x33, 0x33, 0x33, 0x33, 0x00}, // U+006E (n) - { 0x00, 0x00, 0x1E, 0x33, 0x33, 0x33, 0x1E, 0x00}, // U+006F (o) - { 0x00, 0x00, 0x3B, 0x66, 0x66, 0x3E, 0x06, 0x0F}, // U+0070 (p) - { 0x00, 0x00, 0x6E, 0x33, 0x33, 0x3E, 0x30, 0x78}, // U+0071 (q) - { 0x00, 0x00, 0x3B, 0x6E, 0x66, 0x06, 0x0F, 0x00}, // U+0072 (r) - { 0x00, 0x00, 0x3E, 0x03, 0x1E, 0x30, 0x1F, 0x00}, // U+0073 (s) - { 0x08, 0x0C, 0x3E, 0x0C, 0x0C, 0x2C, 0x18, 0x00}, // U+0074 (t) - { 0x00, 0x00, 0x33, 0x33, 0x33, 0x33, 0x6E, 0x00}, // U+0075 (u) - { 0x00, 0x00, 0x33, 0x33, 0x33, 0x1E, 0x0C, 0x00}, // U+0076 (v) - { 0x00, 0x00, 0x63, 0x6B, 0x7F, 0x7F, 0x36, 0x00}, // U+0077 (w) - { 0x00, 0x00, 0x63, 0x36, 0x1C, 0x36, 0x63, 0x00}, // U+0078 (x) - { 0x00, 0x00, 0x33, 0x33, 0x33, 0x3E, 0x30, 0x1F}, // U+0079 (y) - { 0x00, 0x00, 0x3F, 0x19, 0x0C, 0x26, 0x3F, 0x00}, // U+007A (z) - { 0x38, 0x0C, 0x0C, 0x07, 0x0C, 0x0C, 0x38, 0x00}, // U+007B ({) - { 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x00}, // U+007C (|) - { 0x07, 0x0C, 0x0C, 0x38, 0x0C, 0x0C, 0x07, 0x00}, // U+007D (}) - { 0x6E, 0x3B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+007E (~) - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} // U+007F -}; - diff --git a/MCUME_pico/picoo2em/picoo2em.cpp b/MCUME_pico/picoo2em/picoo2em.cpp index bc6fda6..aa3f771 100644 --- a/MCUME_pico/picoo2em/picoo2em.cpp +++ b/MCUME_pico/picoo2em/picoo2em.cpp @@ -11,12 +11,8 @@ extern "C" { #include "Oddemu.h" } #include +#include "pico_dsp.h" -#ifdef USE_VGA -#include "vga_t_dma.h" -#else -#include "tft_t_dma.h" -#endif volatile bool vbl=true; bool repeating_timer_callback(struct repeating_timer *t) { @@ -27,8 +23,8 @@ bool repeating_timer_callback(struct repeating_timer *t) { } return true; } -TFT_T_DMA tft; +PICO_DSP tft; static int skip=0; #include "hardware/clocks.h" @@ -40,118 +36,85 @@ int main(void) { // set_sys_clock_khz(150000, true); // set_sys_clock_khz(133000, true); set_sys_clock_khz(200000, true); +// set_sys_clock_khz(210000, true); +// set_sys_clock_khz(230000, true); // set_sys_clock_khz(225000, true); -// set_sys_clock_khz(240000, true); // set_sys_clock_khz(250000, true); stdio_init_all(); -#ifdef USE_VGA -// tft.begin(VGA_MODE_400x240); - tft.begin(VGA_MODE_320x240); -#else - tft.begin(); -#endif + emu_init(); - while (true) { + char * filename; +#ifdef FILEBROWSER + while (true) { if (menuActive()) { uint16_t bClick = emu_DebounceLocalKeys(); int action = handleMenu(bClick); - char * filename = menuSelection(); - if (action == ACTION_RUNTFT) { - toggleMenu(false); - emu_start(); - emu_Init(filename); - tft.fillScreenNoDma( RGBVAL16(0x00,0x00,0x00) ); - tft.startDMA(); - struct repeating_timer timer; - add_repeating_timer_ms(15, repeating_timer_callback, NULL, &timer); - } + filename = menuSelection(); + if (action == ACTION_RUN) { + break; + } tft.waitSync(); } - else { - uint16_t bClick = emu_DebounceLocalKeys(); - emu_Input(bClick); - emu_Step(); - } - //int c = getchar_timeout_us(0); - //switch (c) { - // case ' ': - // printf("test: %d\n", 1); - // break; - //} + } +#endif + emu_start(); + emu_Init(filename); + tft.startRefresh(); + struct repeating_timer timer; + add_repeating_timer_ms(15, repeating_timer_callback, NULL, &timer); + while (true) { + uint16_t bClick = emu_DebounceLocalKeys(); + emu_Input(bClick); + emu_Step(); } } -static unsigned char palette8[PALETTE_SIZE]; -static unsigned short palette16[PALETTE_SIZE]; +static unsigned short palette16[PALETTE_SIZE]; void emu_SetPaletteEntry(unsigned char r, unsigned char g, unsigned char b, int index) { if (index -void AudioPlaySystem::snd_Mixer(short * stream, int len ) -{ - if (playing) - { -#ifdef CUSTOM_SND - //printf("s\n"); - SND_Process((void*)stream, len); -#else - int i; - long s; - len = len >> 1; - short v0=chan[0].vol; - short v1=chan[1].vol; - short v2=chan[2].vol; - short v3=chan[3].vol; - short v4=chan[4].vol; - short v5=chan[5].vol; - for (i=0;i>8)&0x3f])>>11); - s+=((v1*square[(chan[1].spos>>8)&0x3f])>>11); - s+=((v2*square[(chan[2].spos>>8)&0x3f])>>11); - s+=((v3*noise[(chan[3].spos>>8)&(NOISEBSIZE-1)])>>11); - s+=((v4*noise[(chan[4].spos>>8)&(NOISEBSIZE-1)])>>11); - s+=((v5*noise[(chan[5].spos>>8)&(NOISEBSIZE-1)])>>11); - *stream++ = (short)(s); - *stream++ = (short)(s); - chan[0].spos += chan[0].sinc; - chan[1].spos += chan[1].sinc; - chan[2].spos += chan[2].sinc; - chan[3].spos += chan[3].sinc; - chan[4].spos += chan[4].sinc; - chan[5].spos += chan[5].sinc; - } -#endif - } -} - -void AudioPlaySystem::begin(void) -{ - this->reset(); -} - -void AudioPlaySystem::start(void) -{ - playing = true; -} - -void AudioPlaySystem::setSampleParameters(float clockfreq, float samplerate) { -} - -void AudioPlaySystem::reset(void) -{ - snd_Reset(); -} - -void AudioPlaySystem::stop(void) -{ - playing = false; -} - -bool AudioPlaySystem::isPlaying(void) -{ - return playing; -} - - - -void AudioPlaySystem::sound(int C, int F, int V) { -#ifndef CUSTOM_SND - if (C < 6) { - chan[C].vol = V; - chan[C].sinc = F>>1; - } -#endif -} - -void AudioPlaySystem::step(void) { -} -#endif diff --git a/MCUME_pico/picosnd/AudioPlaySystem.h b/MCUME_pico/picosnd/AudioPlaySystem.h deleted file mode 100644 index 5d2efc0..0000000 --- a/MCUME_pico/picosnd/AudioPlaySystem.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef audioplaysystem_h_ -#define audioplaysystem_h_ - -#ifdef HAS_SND - -#include "platform_config.h" - -class AudioPlaySystem -{ -public: - AudioPlaySystem(void) { }; - void begin(void); - void setSampleParameters(float clockfreq, float samplerate); - void reset(void); - void start(void); - void stop(void); - bool isPlaying(void); - void sound(int C, int F, int V); - void buzz(int size, int val); - void step(void); - static void snd_Mixer(short * stream, int len ); -}; - -#endif - -#endif diff --git a/MCUME_pico/picosnd/LibFC14/Config.h b/MCUME_pico/picosnd/LibFC14/Config.h deleted file mode 100644 index 18f2ba8..0000000 --- a/MCUME_pico/picosnd/LibFC14/Config.h +++ /dev/null @@ -1,96 +0,0 @@ -/* src/Config.h. Generated from Config.h.in by configure. */ -/* src/Config.h.in. Generated from configure.ac by autoheader. */ - -/* Define if building universal (internal helper macro) */ -/* #undef AC_APPLE_UNIVERSAL_BUILD */ - -/* Define if ``nothrow allocator'' is available. */ -#define FC_HAVE_NOTHROW 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_DLFCN_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_INTTYPES_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_IOSTREAM 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_MEMORY_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDINT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDLIB_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRING 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRINGS_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRING_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_STAT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_TYPES_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_UNISTD_H 1 - -/* Define to the sub-directory in which libtool stores uninstalled libraries. - */ -#define LT_OBJDIR ".libs/" - -/* Define this to make little/big endian machines access little/big endian - values in memory structures or arrays directly, disregarding alignment */ -//#define OPTIMIZE_ENDIAN_ACCESS 1 - -/* Name of package */ -#define PACKAGE "libfc14audiodecoder" - -/* Define to the address where bug reports for this package should be sent. */ -#define PACKAGE_BUGREPORT "" - -/* Define to the full name of this package. */ -#define PACKAGE_NAME "libfc14audiodecoder" - -/* Define to the full name and version of this package. */ -#define PACKAGE_STRING "libfc14audiodecoder 1.0.3" - -/* Define to the one symbol short name of this package. */ -#define PACKAGE_TARNAME "libfc14audiodecoder" - -/* Define to the home page for this package. */ -#define PACKAGE_URL "" - -/* Define to the version of this package. */ -#define PACKAGE_VERSION "1.0.3" - -/* The size of `char', as computed by sizeof. */ -#define SIZEOF_CHAR 1 - -/* The size of `int', as computed by sizeof. */ -#define SIZEOF_INT 4 - -/* The size of `long int', as computed by sizeof. */ -#define SIZEOF_LONG_INT 8 - -/* The size of `short int', as computed by sizeof. */ -#define SIZEOF_SHORT_INT 2 - -/* Define to 1 if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* Version number of package */ -#define VERSION "1.0.3" - -/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most - significant byte first (like Motorola and SPARC, unlike Intel). */ -//#define WORDS_BIGENDIAN 1 -/* # undef WORDS_BIGENDIAN */ diff --git a/MCUME_pico/picosnd/LibFC14/Dump.cpp b/MCUME_pico/picosnd/LibFC14/Dump.cpp deleted file mode 100644 index e33e668..0000000 --- a/MCUME_pico/picosnd/LibFC14/Dump.cpp +++ /dev/null @@ -1,53 +0,0 @@ -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. - -#include "Dump.h" - -#include -#include -using namespace std; - -void dumpLines(smartPtr& fcBuf, udword startOffset, sdword length, int blockLen) { - int num = 0; - while (length > 0) { - cout << "(0x" << hex << setw(2) << setfill('0') << num << "): "; - num++; - - int b = 0; - for (int i=0; i& fcBuf, udword startOffset, sdword length, int blockLen) { - int num = 0; - while (length > 0) { - cout << "(0x" << hex << setw(2) << setfill('0') << num << "):" << endl; - num++; - - int b = 0; - for (int i=0; i& fcBuf, udword startOffset, sdword length, int blockLen); -void dumpLines(smartPtr& fcBuf, udword startOffset, sdword length, int blockLen); - -#endif // DUMP_H diff --git a/MCUME_pico/picosnd/LibFC14/FC.cpp b/MCUME_pico/picosnd/LibFC14/FC.cpp deleted file mode 100644 index 183d913..0000000 --- a/MCUME_pico/picosnd/LibFC14/FC.cpp +++ /dev/null @@ -1,1165 +0,0 @@ -// Future Composer audio decoder -- Copyright (C) Michael Schwendt -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -#include "FC.h" - -#include -#ifdef FC_HAVE_NOTHROW -#include -#endif - -//#define DEBUG 1 -//#define DEBUG2 1 -//#define DEBUG3 1 -#if defined(DEBUG) || defined(DEBUG2) || defined(DEBUG3) -#include -#include -using namespace std; -#include "Dump.h" -#endif - -FC::FC() { - input = 0; - inputLen = 0; - _admin.initialized = false; - - // Set up some dummy voices to decouple the decoder from the mixer. - for (int v=0; voff(); - } - // (AMIGA) Power-LED on = low-pass filter on. - // May be simulated by external audio post-processing. -} - - -void FC::setMixer(PaulaMixer* mixer) { - // Create needed number of voices and replace the dummies. - mixer->init(channels); - for (int v=0; vgetVoice(v); - _CHdata[v].ch->off(); - killChannel(_CHdata[v]); - } -} - - -bool FC::isOurData(void *data, unsigned long int length) { - if ( length<5 ) { - return false; - } - ubyte *d = static_cast(data); - // Check for "SMOD" ID (Future Composer 1.0 to 1.3). - isSMOD = (d[0]==0x53 && d[1]==0x4D && d[2]==0x4F && d[3]==0x44 && - d[4]==0x00); - // Check for "FC14" ID (Future Composer 1.4). - isFC14 = (d[0]==0x46 && d[1]==0x43 && d[2]==0x31 && d[3]==0x34 && - d[4]==0x00); - // (NOTE) A very few hacked "SMOD" modules exist which contain an ID - // string "FC13". Although this could be supported easily, it should - // NOT. Format detection must be able to rely on the ID field. As no - // version of Future Composer has ever created a "FC13" ID, such hacked - // modules are likely to be incompatible in other parts due to incorrect - // conversion, e.g. effect parameters. It is like creating non-standard - // module files whose only purpose is to confuse accurate music players. - return (isSMOD || isFC14); -} - - -bool FC::init(void *data, udword length, int startStep, int endStep) { - if ( !isOurData(data,length) ) { - formatName = UNKNOWN_FORMAT_NAME; - return false; - } - if (isSMOD) - formatName = SMOD_FORMAT_NAME; - else if (isFC14) - formatName = FC14_FORMAT_NAME; - - udword copyLen = length+sizeof(silenceData); - if (copyLen > inputLen) { - delete[] input; - inputLen = 0; -#ifdef FC_HAVE_NOTHROW - if ( (input = new(std::nothrow) ubyte[copyLen]) == 0 ) { -#else - if ( (input = new ubyte[copyLen]) == 0 ) { -#endif - return false; - } - } - memcpy(input,data,copyLen); - inputLen = copyLen; - - // Set up smart pointers for signed and unsigned input buffer access. - // Ought to be read-only (const), but this implementation appends - // a few values to the end of the buffer (see further below). - fcBufS.setBuffer((sbyte*)input,inputLen); - fcBuf.setBuffer((ubyte*)input,inputLen); - - // (NOTE) This next bit is just for convenience. - // - // It is the only place where the module buffer is written to. - // - // Copy ``silent'' modulation sequence to end of FC module buffer so it - // is in the address space of the FC module and thus allows using the - // same smart pointers as throughout the rest of the code. - _admin.offsets.silence = inputLen-sizeof(silenceData); - for (ubyte i=0; i get speed at first step). - _admin.RScount = 4; - // (NOTE) Some FC implementations instead count from 0 to 4. - - // At +4 is length of track table. - udword trackTabLen = readEndian(fcBuf[4],fcBuf[5],fcBuf[6],fcBuf[7]); -#if defined(DEBUG) - cout << "trackTabLen = " << hex << setw(8) << setfill('0') << trackTabLen << endl; -#endif - - off(); - for (ubyte c=0; cpaula.period = _CHdata[c].period; - _CHdata[c].ch->paula.volume = _CHdata[c].volume; - - if (_CHdata[c].repeatDelay != 0) { - if (--_CHdata[c].repeatDelay == 1) { - _CHdata[c].repeatDelay = 0; - _CHdata[c].ch->paula.start = _CHdata[c].pSampleStart + - _CHdata[c].repeatOffset; - _CHdata[c].ch->paula.length = _CHdata[c].repeatLength; - _CHdata[c].ch->takeNextBuf(); - } - } - } - - // Finally decide which audio channels to start. - // This could be moved into previous loop. - for (ubyte c=0; con(); - } - } -} - -// -------------------------------------------------------------------------- - -void FC::killChannel(CHdata& CHXdata) { - // The interface to a cheap Paula simulator/mixer. - CHXdata.ch->off(); - CHXdata.ch->paula.start = fcBuf.tellBegin()+_admin.offsets.silence+1; - // (NOTE) Some implementations set this to 0x0100. - CHXdata.ch->paula.length = 1; - CHXdata.ch->takeNextBuf(); -} - -void FC::nextNote(CHdata& CHXdata) -{ - // Get offset to (or address of) current pattern position. - udword pattOffs = CHXdata.pattStart+CHXdata.pattPos; - - // Check for pattern end or whether pattern BREAK - // command is set. - if (CHXdata.pattPos==PATTERN_LENGTH - || (isFC14 && fcBuf[pattOffs]==PATTERN_BREAK)) - { - // End pattern. - -#if defined(DEBUG3) - if (fcBuf[pattOffs] == PATTERN_BREAK) - cout << "--- PATTERN BREAK ---" << endl; -#endif - - // (NOTE) In order for pattern break to work correctly, the - // pattern break value 0x49 must be at the same position in - // each of the four patterns which are currently activated - // for the four voices. - // - // Alternatively, one could advance all voices to the next - // track step here in a 4-voice loop to make sure voices - // stay in sync. - - CHXdata.pattPos = 0; - - // Advance one step in track table. - CHXdata.trackPos += TRACKTAB_ENTRY_LENGTH; // 0x000d - udword trackOffs = CHXdata.trackStart+CHXdata.trackPos; - - // (BUG-FIX) Some FC players here apply a normal - // compare-if-equal which is not accurate enough and - // can cause the player to step beyond the song end. - // - // (BUG-FIX) Some FC14 modules have a pattern table length - // which is not a multiple of 13. Hence we check whether - // the currently activated table line would fit. - - if ((trackOffs+12) >= CHXdata.trackEnd) // pattern table end? - { - CHXdata.trackPos = 0; // restart by default - trackOffs = CHXdata.trackStart; - - songEnd = true; - - // (NOTE) Some songs better stop here or reset all - // channels to cut off any pending sounds. - } - - // Step Voice 1 Voice 2 Voice 3 Voice 4 Speed - // SP PT TR ST PT TR ST PT TR ST PT TR ST RS - // - // SP = STEP - // PT = PATTERN - // TR = TRANSPOSE - // ST = SOUND TRANSPOSE - // RS = REPLAY SPEED - - // Decide whether to read new song speed. - if (++_admin.RScount == 5) - { - _admin.RScount = 1; - ubyte newSpeed = fcBuf[trackOffs+12]; // RS (replay speed) - if (newSpeed != 0) // 0 would be underflow - { - _admin.count = _admin.speed = newSpeed; - } - } - - uword pattern = fcBuf[trackOffs++]; // PT - CHXdata.transpose = fcBufS[trackOffs++]; - CHXdata.soundTranspose = fcBufS[trackOffs++]; - - CHXdata.pattStart = _admin.offsets.patterns+(pattern<<6); - // Get new pattern pointer (pattPos is 0 already, see above). - pattOffs = CHXdata.pattStart; - } - -#if defined(DEBUG2) - if (CHXdata.dmaMask==1 - && CHXdata.pattPos==0) - { - cout << endl; - cout << "Step = " << hex << setw(4) << setfill('0') << CHXdata.trackPos/ TRACKTAB_ENTRY_LENGTH; - cout << " | " << hex << setw(5) << setfill('0') << (int)CHXdata.trackStart << ", " << (int)(CHXdata.trackStart+CHXdata.trackPos) << ", " << (int)CHXdata.trackEnd << endl; - udword tmp = CHXdata.trackStart+CHXdata.trackPos; - for (int t = 0; t < 13; ++t) - cout << hex << setw(2) << setfill('0') << (int)fcBuf[tmp++] << ' '; - cout << endl; - cout << endl; - } - - cout << hex << setw(2) << setfill('0') << (int)fcBuf[pattOffs] << ' ' - << setw(2) << (int)fcBuf[pattOffs+1]; - if (CHXdata.dmaMask != 8) - cout << " | "; -#endif - - // Process pattern entry. - - ubyte note = fcBuf[pattOffs++]; - ubyte info1 = fcBuf[pattOffs]; // info byte #1 - - if (note != 0) - { - CHXdata.portaOffs = 0; // reset portamento offset - CHXdata.portaInfo = 0; // stop port., erase old parameter - - // (BUG-FIX) Disallow signed underflow here. - CHXdata.noteValue = note&0x7f; - - // (NOTE) Since first note is 0x01, first period at array - // offset 0 cannot be accessed directly (i.e. without adding - // transpose values from track table or modulation sequence). - - // Disable channel right now. - CHXdata.ch->off(); - // Later enable channel. - _admin.dmaFlags |= CHXdata.dmaMask; - - // Pattern offset stills points to info byte #1. - // Get instrument/volModSeq number from info byte #1 - // and add sound transpose value from track table. - uword sound = (fcBuf[pattOffs]&0x3f)+CHXdata.soundTranspose; - // - // (FC14 BUG-FIX) Better mask here to take care of overflow. - // - sound &= 0x3f; - - // (NOTE) Some FC players here put pattern info byte #1 - // into an unused byte variable at structure offset 9. - - udword seqOffs; // the modulation sequence for this sound - - if (sound > (_admin.usedVolModSeqs-1)) - { - seqOffs = _admin.offsets.silence; - } - else - { - seqOffs = _admin.offsets.volModSeqs+(sound<<6); - } - CHXdata.envelopeSpeed = CHXdata.envelopeCount = fcBuf[seqOffs++]; - // Get sound modulation sequence number. - sound = fcBuf[seqOffs++]; - CHXdata.vibSpeed = fcBuf[seqOffs++]; - CHXdata.vibFlag = 0x40; // vibrato UP at start - CHXdata.vibAmpl = CHXdata.vibCurOffs = fcBuf[seqOffs++]; - CHXdata.vibDelay = fcBuf[seqOffs++]; - CHXdata.volSeq = seqOffs; - CHXdata.volSeqPos = 0; - CHXdata.volSustainTime = 0; - - if (sound > (_admin.usedSndModSeqs-1)) - { - // (NOTE) Silent sound modulation sequence is different - // from silent instrument definition sequence. - seqOffs = _admin.offsets.silence+1; - } - else - { - seqOffs = _admin.offsets.sndModSeqs+(sound<<6); - } - CHXdata.sndSeq = seqOffs; - CHXdata.sndSeqPos = 0; - CHXdata.sndModSustainTime = 0; - } - - // Portamento: bit 7 set = ON, bit 6 set = OFF, bits 5-0 = speed - // New note resets and clears portamento working values. - - if ((info1&0x40) != 0) // portamento OFF? - { - CHXdata.portaInfo = 0; // stop port., erase old parameter - } - - if ((info1&0x80) != 0) // portamento ON? - { - // - // (FC14 BUG-FIX) Kill portamento ON/OFF bits. - // - // Get portamento speed from info byte #2. - // Info byte #2 is info byte #1 in next line of pattern, - // Therefore the +2 offset. - CHXdata.portaInfo = fcBuf[pattOffs+2]&0x3f; - } - - // Advance to next pattern entry. - CHXdata.pattPos += 2; -} - -// -------------------------------------------------------------------------- -// The order of func/proc calls might be confusing, but is necessary -// to simulate JMP instructions in the original player code without -// making use of ``goto''. - -inline void FC::setWave(CHdata& CHXdata, ubyte num) -{ - CHXdata.pSampleStart = _sounds[num].start; - CHXdata.ch->paula.start = _sounds[num].start; - CHXdata.ch->paula.length = _sounds[num].len; - CHXdata.ch->takeNextBuf(); - CHXdata.repeatOffset = _sounds[num].repOffs; - CHXdata.repeatLength = _sounds[num].repLen; - CHXdata.repeatDelay = 3; -} - -inline void FC::readSeqTranspose(CHdata& CHXdata) -{ - CHXdata.seqTranspose = fcBufS[CHXdata.sndSeq+CHXdata.sndSeqPos]; - ++CHXdata.sndSeqPos; -} - -void FC::processModulation(CHdata& CHXdata) -{ - if (CHXdata.sndModSustainTime != 0) - { - --CHXdata.sndModSustainTime; - processPerVol(CHXdata); - return; - } - readModCommand(CHXdata); -} - -void FC::readModCommand(CHdata& CHXdata) -{ - udword seqOffs = CHXdata.sndSeq+CHXdata.sndSeqPos; - - // (NOTE) After each command (except LOOP, END, SUSTAIN, - // and NEWVIB) follows a transpose value. - - if (fcBuf[seqOffs] == SNDMOD_LOOP) - { - CHXdata.sndSeqPos = fcBuf[seqOffs+1]&0x3f; - // Calc new sequence address. - seqOffs = CHXdata.sndSeq+CHXdata.sndSeqPos; - } - - if (fcBuf[seqOffs] == SNDMOD_END) - { - processPerVol(CHXdata); - return; - } - - else if (fcBuf[seqOffs] == SNDMOD_SETWAVE) - { - // Disable channel right now. - CHXdata.ch->off(); - // Enable channel later. - _admin.dmaFlags |= CHXdata.dmaMask; - // Restart envelope. - CHXdata.volSeqPos = 0; - CHXdata.envelopeCount = 1; - - setWave(CHXdata,fcBuf[seqOffs+1]); - CHXdata.sndSeqPos += 2; - - readSeqTranspose(CHXdata); - - processPerVol(CHXdata); - return; - } - - else if (fcBuf[seqOffs] == SNDMOD_CHANGEWAVE) - { - setWave(CHXdata,fcBuf[seqOffs+1]); - CHXdata.sndSeqPos += 2; - - readSeqTranspose(CHXdata); - - processPerVol(CHXdata); - return; - } - - else if (fcBuf[seqOffs] == SNDMOD_SETPACKWAVE) - { - // Disable channel right now. - CHXdata.ch->off(); - // Enable channel later. - _admin.dmaFlags |= CHXdata.dmaMask; - - uword i = fcBuf[seqOffs+1]; // sample/pack nr. - if (i < 10) // sample or waveform? - { - udword sndOffs = _sounds[i].start - fcBuf.tellBegin(); - // "SSMP"? sample-pack? - if (fcBuf[sndOffs]==0x53 && fcBuf[sndOffs+1]==0x53 && - fcBuf[sndOffs+2]==0x4D && fcBuf[sndOffs+3]==0x50) - { - sndOffs += 4; - // Skip header and 10*2 info blocks of size 16. - udword smpStart = sndOffs+320; - i = fcBuf[seqOffs+2]; // sample nr. - i <<= 4; // *16 (block size) - sndOffs += i; - smpStart += readEndian(fcBuf[sndOffs],fcBuf[sndOffs+1], - fcBuf[sndOffs+2],fcBuf[sndOffs+3]); - CHXdata.pSampleStart = smpStart+fcBuf.tellBegin(); - CHXdata.ch->paula.start = CHXdata.pSampleStart; - CHXdata.ch->paula.length = readEndian(fcBuf[sndOffs+4], - fcBuf[sndOffs+5]); - CHXdata.ch->takeNextBuf(); - - // (FC14 BUG-FIX): Players set period here by accident. - // m68k code move.l 4(a2),4(a3), but 6(a3) is period. - - CHXdata.repeatOffset = readEndian(fcBuf[sndOffs+6], - fcBuf[sndOffs+7]); - CHXdata.repeatLength = readEndian(fcBuf[sndOffs+8], - fcBuf[sndOffs+9]); - if (CHXdata.repeatLength == 1) - { - // Erase first word behind sample to avoid beeping - // one-shot mode upon true emulation of Paula. - fcBuf[smpStart+CHXdata.repeatOffset] = 0; - fcBuf[smpStart+CHXdata.repeatOffset+1] = 0; - } - // Restart envelope. - CHXdata.volSeqPos = 0; - CHXdata.envelopeCount = 1; - // - CHXdata.repeatDelay = 3; - } - } - CHXdata.sndSeqPos += 3; - - readSeqTranspose(CHXdata); - - processPerVol(CHXdata); - return; - } - - else if (fcBuf[seqOffs] == SNDMOD_NEWSEQ) - { - uword seq = fcBuf[seqOffs+1]; - CHXdata.sndSeq = _admin.offsets.sndModSeqs+(seq<<6); - CHXdata.sndSeqPos = 0; - // Recursive call (ought to be protected via a counter). - readModCommand(CHXdata); - return; - } - - else if (fcBuf[seqOffs] == SNDMOD_SUSTAIN) - { - CHXdata.sndModSustainTime = fcBuf[seqOffs+1]; - CHXdata.sndSeqPos += 2; - - // Decrease sustain counter and decide whether to continue - // to envelope modulation. - // Recursive call (ought to be protected via a counter). - processModulation(CHXdata); - return; - } - - else if (fcBuf[seqOffs] == SNDMOD_NEWVIB) - { - CHXdata.vibSpeed = fcBuf[seqOffs+1]; - CHXdata.vibAmpl = fcBuf[seqOffs+2]; - CHXdata.sndSeqPos += 3; - - processPerVol(CHXdata); - return; - } - - else if (fcBuf[seqOffs] == SNDMOD_PITCHBEND) - { - CHXdata.pitchBendSpeed = fcBufS[seqOffs+1]; - CHXdata.pitchBendTime = fcBuf[seqOffs+2]; - CHXdata.sndSeqPos += 3; - - readSeqTranspose(CHXdata); - - processPerVol(CHXdata); - return; - } - - else // Not a command, but a transpose value. - { - readSeqTranspose(CHXdata); - - processPerVol(CHXdata); - } -} - -// -------------------------------------------------------------------------- -// (NOTE) This part of the code is not protected against a deadlock -// caused by damaged music module data. - -void FC::volSlide(CHdata& CHXdata) -{ - // Following flag divides the volume sliding speed by two. - CHXdata.volSlideDelayFlag ^= 0xff; // = NOT - if (CHXdata.volSlideDelayFlag != 0) - { - --CHXdata.volSlideTime; - CHXdata.volume += CHXdata.volSlideSpeed; - if (CHXdata.volume < 0) - { - CHXdata.volume = CHXdata.volSlideTime = 0; - } - - // (NOTE) Most FC players do not check whether Paula's - // maximum volume level is exceeded. - - if (CHXdata.volume > 64) - { - CHXdata.volume = 64; - CHXdata.volSlideTime = 0; - } - } -} - -void FC::processPerVol(CHdata& CHXdata) -{ - bool repeatVolSeq; // JUMP/GOTO - WHILE conversion - do - { - repeatVolSeq = false; - - // Sustain current volume level? NE => yes, EQ => no. - if (CHXdata.volSustainTime != 0) - { - --CHXdata.volSustainTime; - } - - // Slide volume? NE => yes, EQ => no. - else if (CHXdata.volSlideTime != 0) - { - volSlide(CHXdata); - } - - // Time to set next volume level? NE => no, EQ => yes. - else if (--CHXdata.envelopeCount == 0) - { - CHXdata.envelopeCount = CHXdata.envelopeSpeed; - - bool readNextVal; // JUMP/GOTO - WHILE conversion - do - { - readNextVal = false; - - udword seqOffs = CHXdata.volSeq+CHXdata.volSeqPos; - ubyte command = fcBuf[seqOffs]; - - switch (command) - { - case ENVELOPE_SUSTAIN: - { - CHXdata.volSustainTime = fcBuf[seqOffs+1]; - CHXdata.volSeqPos += 2; - // This shall loop to beginning of proc. - repeatVolSeq = true; - break; - } - case ENVELOPE_SLIDE: - { - CHXdata.volSlideSpeed = fcBuf[seqOffs+1]; - CHXdata.volSlideTime = fcBuf[seqOffs+2]; - CHXdata.volSeqPos += 3; - volSlide(CHXdata); - break; - } - case ENVELOPE_LOOP: - { - // Range check should be done here. - CHXdata.volSeqPos = (fcBuf[seqOffs+1]-5)&0x3f; - // (FC14 BUG) Some FC players here do not read a - // parameter at the new sequence position. They - // leave the pos value in d0, which then passes - // as parameter through all the command comparisons - // (this switch statement) in FC_effa() up to - // FC_effno(). - readNextVal = true; - break; - } - case ENVELOPE_END: - { - break; - } - default: - { - // Read volume value and advance. - CHXdata.volume = fcBuf[seqOffs]; - if (++CHXdata.volSeqPos > 0x3f) { - CHXdata.volSeqPos = 0x3f; - } - // Full range check for volume 0-64. - if (CHXdata.volume > 64) { - CHXdata.volume = 64; - } - else if (CHXdata.volume < 0) { - CHXdata.volume = 0; - } - break; - } - } - } - while (readNextVal); - } - } - while (repeatVolSeq); - - // Now determine note and period value to play. - - sdword tmp0, tmp1; - - tmp0 = CHXdata.seqTranspose; - if (tmp0 >= 0) - { - tmp0 += CHXdata.noteValue; - tmp0 += CHXdata.transpose; - // (NOTE) Permit underflow at this point. Some modules - // need it because--for some unknown reason--they work - // with huge values such as transpose = 0x8c. - } - // else: lock note (i.e. transpose value from sequence is note to play) - -#if defined(DEBUG2) - if ((tmp0&0x7f)>0x53) - { - cout << "X "; -#if defined(DEBUG3) - cout << "=== NOTE > 0x53 ===" << endl; -#endif - } -#endif - - tmp0 &= 0x7f; - tmp1 = tmp0<<1; // *2 (later used to find octave) - tmp0 = periods[tmp0]; - - // Vibrato. - // - // Vibrato offset changes between [0,1,...,2*vibAmpl] - // Offset minus vibAmpl is value to apply. - - if (CHXdata.vibDelay == 0) - { - uword noteTableOffset = tmp1; // tmp1 is note*2; - - sword vibDelta = CHXdata.vibAmpl; - vibDelta <<= 1; // pos/neg amplitude delta - - // vibFlag bit 5: 0 => vibrato down, 1 => vibrato up - // - // (NOTE) In the original player code the vibrato half speed delay - // flag (D6) in bit 0 is toggled but never checked, because the - // vibrato flag byte will never get negative. - - tmp1 = CHXdata.vibCurOffs; - - if ((CHXdata.vibFlag&(1<<5))==0) - { - tmp1 -= CHXdata.vibSpeed; - // Lowest value reached? - if (tmp1 < 0) - { - tmp1 = 0; - CHXdata.vibFlag |= (1<<5); // switch to vibrato up - } - } - else - { - tmp1 += CHXdata.vibSpeed; - // Amplitude reached? - if (tmp1 > vibDelta) - { - tmp1 = vibDelta; - CHXdata.vibFlag &= ~(1<<5); // switch to vibrato down - } - } - - CHXdata.vibCurOffs = tmp1; - - // noteTableOffset is note*2; - - tmp1 -= CHXdata.vibAmpl; - - // Octave 5 at period table byte-offset 96 contains the highest - // period only. 96+160 = 256. This next bit ensures that vibrato - // does not exceed the five octaves in the period table. - // Octave 6 (but lowest!) is FC14 only. - noteTableOffset += 160; // + $a0 - while (noteTableOffset < 256) - { - tmp1 <<= 1; // double vibrato value for each octave - noteTableOffset += 2*12; // advance octave index - }; - tmp0 += tmp1; // apply vibrato to period - - // (NOTE) Questionable code here in the original player sources. - // Although bit 0 of D6 is toggled, the code (see above) that - // checks it is unreachable. - } - else - { - --CHXdata.vibDelay; - - // (NOTE) Questionable code here in existing FC players. Although - // bit 0 of D6 is toggled, the code that checks it is unreachable. - // That bad code has not been converted. - } - - // Portamento. - - // (NOTE) As of FC 1.4 portamento plays at half speed compared to - // old versions. - - // Following flag divides the portamento speed by two - // for FC14 modules. - CHXdata.portDelayFlag ^= 0xff; // = NOT - if (isSMOD || CHXdata.portDelayFlag!=0) - { - sbyte param = CHXdata.portaInfo; - if (param != 0) - { - if (param > 0x1f) // > 0x20 = portamento down - { - param &= 0x1f; - param = (-param); - } - CHXdata.portaOffs -= param; - } - } - - // Pitchbend. - - // Following flag divides the pitch bending speed by two. - CHXdata.pitchBendDelayFlag ^= 0xff; // not - if (CHXdata.pitchBendDelayFlag != 0) - { - if (CHXdata.pitchBendTime != 0) - { - --CHXdata.pitchBendTime; - sbyte speed = CHXdata.pitchBendSpeed; - if (speed != 0) - { - CHXdata.portaOffs -= speed; - } - } - } - - tmp0 += CHXdata.portaOffs; - if (tmp0 <= 0x0070) - { - tmp0 = 0x0071; - } - // (NOTE) This should be 0x1ac0, but the extra low octave has - // been added in FC 1.4 and is a non-working hack due to this - // range-check (see header file). - if (tmp0 > 0x0d60) - { - tmp0 = 0x0d60; - } - CHXdata.period = tmp0; -} diff --git a/MCUME_pico/picosnd/LibFC14/FC.h b/MCUME_pico/picosnd/LibFC14/FC.h deleted file mode 100644 index 8b8af7c..0000000 --- a/MCUME_pico/picosnd/LibFC14/FC.h +++ /dev/null @@ -1,188 +0,0 @@ -// Future Composer audio decoder -- Copyright (C) Michael Schwendt -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -#ifndef FC_H -#define FC_H - -#include - -#include "MyTypes.h" -#include "MyEndian.h" -#include "SmartPtr.h" -#include "Paula.h" - -class FC : public PaulaPlayer { - public: - FC(); - ~FC(); - - void setMixer(PaulaMixer*); - bool isOurData(void*,unsigned long int); - bool init(void*,udword,int=0,int=0); - void run(); - void restart(int=0,int=0); - void off(); - bool songEnd; // whether song end has been reached - - bool isSMOD; // whether file is in Future Composer 1.0 - 1.3 format - bool isFC14; // whether file is in Future Composer 1.4 format - - std::string formatName; - static const std::string SMOD_FORMAT_NAME; - static const std::string FC14_FORMAT_NAME; - static const std::string UNKNOWN_FORMAT_NAME; - - static const uword SMOD_SONGTAB_OFFSET = 0x0064; // 100 - - static const uword FC14_SMPHEADERS_OFFSET = 0x0028; // 40 - static const uword FC14_WAVEHEADERS_OFFSET = 0x0064; // 100 - static const uword FC14_SONGTAB_OFFSET = 0x00b4; // 180 - - static const uword TRACKTAB_ENTRY_LENGTH = 0x000d; // 3*4+1 - static const uword PATTERN_LENGTH = 0x0040; // 32*2 - static const ubyte PATTERN_BREAK = 0x49; - - static const ubyte SEQ_END = 0xE1; - - static const ubyte SNDMOD_LOOP = 0xE0; - static const ubyte SNDMOD_END = SEQ_END; - static const ubyte SNDMOD_SETWAVE = 0xE2; - static const ubyte SNDMOD_CHANGEWAVE = 0xE4; - static const ubyte SNDMOD_NEWVIB = 0xE3; - static const ubyte SNDMOD_SUSTAIN = 0xE8; - static const ubyte SNDMOD_NEWSEQ = 0xE7; - static const ubyte SNDMOD_SETPACKWAVE = 0xE9; - static const ubyte SNDMOD_PITCHBEND = 0xEA; - - static const ubyte ENVELOPE_LOOP = 0xE0; - static const ubyte ENVELOPE_END = SEQ_END; - static const ubyte ENVELOPE_SUSTAIN = 0xE8; - static const ubyte ENVELOPE_SLIDE = 0xEA; - - static const int channels = 4; - - private: - PaulaVoice _dummyVoices[channels]; - - ubyte *input; - udword inputLen; - - smartPtr fcBuf; // for safe unsigned access - smartPtr fcBufS; // for safe signed access - - // This array will be moved behind the input file. So don't forget - // to allocate additional sizeof(..) bytes. - static const ubyte silenceData[8]; - - // Index is AND 0x7f. Table is longer. - static const uword periods[(5+6)*12+4]; - - static const uword SMOD_waveInfo[47*4]; - static const ubyte SMOD_waveforms[]; - - struct Admin { - uword dmaFlags; // which audio channels to turn on (AMIGA related) - ubyte count; // speed count - ubyte speed; // speed - ubyte RScount; - bool initialized; // true => restartable - bool isEnabled; // player on => true, else false - - struct _moduleOffsets { - udword trackTable; - udword patterns; - udword sndModSeqs; - udword volModSeqs; - udword silence; - } offsets; - - int usedPatterns; - int usedSndModSeqs; - int usedVolModSeqs; - } _admin; - - struct Sound { - const ubyte* start; - uword len, repOffs, repLen; - // rest was place-holder (6 bytes) - }; - // 10 samples/sample-packs - // 80 waveforms - Sound _sounds[10+80]; - - struct CHdata - { - PaulaVoice *ch; // paula and mixer interface - - uword dmaMask; - - udword trackStart; // track/step pattern table - udword trackEnd; - uword trackPos; - - udword pattStart; - uword pattPos; - - sbyte transpose; // TR - sbyte soundTranspose; // ST - sbyte seqTranspose; // from sndModSeq - - ubyte noteValue; - - sbyte pitchBendSpeed; - ubyte pitchBendTime, pitchBendDelayFlag; - - ubyte portaInfo, portDelayFlag; - sword portaOffs; - - udword volSeq; - uword volSeqPos; - - ubyte volSlideSpeed, volSlideTime, volSustainTime, - volSlideDelayFlag; - - ubyte envelopeSpeed, envelopeCount; - - udword sndSeq; - uword sndSeqPos; - - ubyte sndModSustainTime; - - ubyte vibFlag, vibDelay, vibSpeed, - vibAmpl, vibCurOffs; - - sbyte volume; - uword period; - - const ubyte* pSampleStart; - uword repeatOffset; - uword repeatLength; - uword repeatDelay; - }; - - struct CHdata _CHdata[channels]; - - void killChannel(CHdata&); - void nextNote(CHdata&); - void processModulation(CHdata&); - void readModCommand(CHdata&); - void processPerVol(CHdata&); - inline void setWave(CHdata&, ubyte num); - inline void readSeqTranspose(CHdata&); - void volSlide(CHdata&); -}; - -#endif // FC_H diff --git a/MCUME_pico/picosnd/LibFC14/FC_Data.cpp b/MCUME_pico/picosnd/LibFC14/FC_Data.cpp deleted file mode 100644 index 384f991..0000000 --- a/MCUME_pico/picosnd/LibFC14/FC_Data.cpp +++ /dev/null @@ -1,215 +0,0 @@ -// Future Composer audio decoder -- Copyright (C) Michael Schwendt -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -#include "FC.h" - -const std::string FC::SMOD_FORMAT_NAME = "Future Composer 1.0 - 1.3 (AMIGA)"; -const std::string FC::FC14_FORMAT_NAME = "Future Composer 1.4 (AMIGA)"; -const std::string FC::UNKNOWN_FORMAT_NAME = "unknown format"; - -const ubyte FC::silenceData[8] = { - // Used as ``silent'' volume and modulation sequence. - // seqSpeed, sndSeq, vibSpeed, vibAmp, vibDelay, initial Volume, ... - // - // Silent volume sequence starts here. - 0x01, - // Silent modulation sequence starts here. - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, SEQ_END -}; - -const uword FC::periods[(5+6)*12+4] = { - 0x06b0, 0x0650, 0x05f4, 0x05a0, 0x054c, 0x0500, 0x04b8, 0x0474, - 0x0434, 0x03f8, 0x03c0, 0x038a, - // +0x0c (*2 = byte-offset) - 0x0358, 0x0328, 0x02fa, 0x02d0, 0x02a6, 0x0280, 0x025c, 0x023a, - 0x021a, 0x01fc, 0x01e0, 0x01c5, - // +0x18 (*2 = byte-offset) - 0x01ac, 0x0194, 0x017d, 0x0168, 0x0153, 0x0140, 0x012e, 0x011d, - 0x010d, 0x00fe, 0x00f0, 0x00e2, - // +0x24 (*2 = byte-offset) - 0x00d6, 0x00ca, 0x00be, 0x00b4, 0x00aa, 0x00a0, 0x0097, 0x008f, - 0x0087, 0x007f, 0x0078, 0x0071, - // +0x30 (*2 = byte-offset) - 0x0071, 0x0071, 0x0071, 0x0071, 0x0071, 0x0071, 0x0071, 0x0071, - 0x0071, 0x0071, 0x0071, 0x0071, - // +0x3c (*2 = byte-offset) - 0x0d60, 0x0ca0, 0x0be8, 0x0b40, 0x0a98, 0x0a00, 0x0970, 0x08e8, - 0x0868, 0x07f0, 0x0780, 0x0714, - // +0x48 (*2 = byte-offset) - // - // (NOTE) 0x49 = PATTERN BREAK, so the extra low octave would be - // useless for direct access. Transpose values would be required. - // However, the FC 1.4 player still has hardcoded 0x0d60 as the lowest - // sample period and does a range-check prior to writing a period to - // the AMIGA custom chip. In short: This octave is useless! Plus: - // Since some music modules access the periods at offset 0x54 via - // transpose, the useless octave cause breakage. - // 0x1ac0, 0x1940, 0x17d0, 0x1680, 0x1530, 0x1400, 0x12e0, 0x11d0, - // 0x10d0, 0x0fe0, 0x0f00, 0x0e28, - // - // End of Future Composer 1.0 - 1.3 period table. - 0x06b0, 0x0650, 0x05f4, 0x05a0, 0x054c, 0x0500, 0x04b8, 0x0474, - 0x0434, 0x03f8, 0x03c0, 0x038a, - // +0x54 (*2 = byte-offset) - 0x0358, 0x0328, 0x02fa, 0x02d0, 0x02a6, 0x0280, 0x025c, 0x023a, - 0x021a, 0x01fc, 0x01e0, 0x01c5, - // +0x60 (*2 = byte-offset) - 0x01ac, 0x0194, 0x017d, 0x0168, 0x0153, 0x0140, 0x012e, 0x011d, - 0x010d, 0x00fe, 0x00f0, 0x00e2, - // +0x6c (*2 = byte-offset) - 0x00d6, 0x00ca, 0x00be, 0x00b4, 0x00aa, 0x00a0, 0x0097, 0x008f, - // +0x78 (*2 = byte-offset) - 0x0087, 0x007f, 0x0078, 0x0071 - // +0x80 (*2 = byte-offset), everything from here on is unreachable - // due to 0x7f AND. -}; - -const uword FC::SMOD_waveInfo[47*4] = { - 0x0000, 0x0010, 0x0000, 0x0010, - 0x0020, 0x0010, 0x0000, 0x0010, - 0x0040, 0x0010, 0x0000, 0x0010, - 0x0060, 0x0010, 0x0000, 0x0010, - 0x0080, 0x0010, 0x0000, 0x0010, - 0x00a0, 0x0010, 0x0000, 0x0010, - 0x00c0, 0x0010, 0x0000, 0x0010, - 0x00e0, 0x0010, 0x0000, 0x0010, - 0x0100, 0x0010, 0x0000, 0x0010, - 0x0120, 0x0010, 0x0000, 0x0010, - 0x0140, 0x0010, 0x0000, 0x0010, - 0x0160, 0x0010, 0x0000, 0x0010, - 0x0180, 0x0010, 0x0000, 0x0010, - 0x01a0, 0x0010, 0x0000, 0x0010, - 0x01c0, 0x0010, 0x0000, 0x0010, - 0x01e0, 0x0010, 0x0000, 0x0010, - 0x0200, 0x0010, 0x0000, 0x0010, - 0x0220, 0x0010, 0x0000, 0x0010, - 0x0240, 0x0010, 0x0000, 0x0010, - 0x0260, 0x0010, 0x0000, 0x0010, - 0x0280, 0x0010, 0x0000, 0x0010, - 0x02a0, 0x0010, 0x0000, 0x0010, - 0x02c0, 0x0010, 0x0000, 0x0010, - 0x02e0, 0x0010, 0x0000, 0x0010, - 0x0300, 0x0010, 0x0000, 0x0010, - 0x0320, 0x0010, 0x0000, 0x0010, - 0x0340, 0x0010, 0x0000, 0x0010, - 0x0360, 0x0010, 0x0000, 0x0010, - 0x0380, 0x0010, 0x0000, 0x0010, - 0x03a0, 0x0010, 0x0000, 0x0010, - 0x03c0, 0x0010, 0x0000, 0x0010, - 0x03e0, 0x0010, 0x0000, 0x0010, - 0x0400, 0x0008, 0x0000, 0x0008, - 0x0410, 0x0008, 0x0000, 0x0008, - 0x0420, 0x0008, 0x0000, 0x0008, - 0x0430, 0x0008, 0x0000, 0x0008, - 0x0440, 0x0008, 0x0000, 0x0008, - 0x0450, 0x0008, 0x0000, 0x0008, - 0x0460, 0x0008, 0x0000, 0x0008, - 0x0470, 0x0008, 0x0000, 0x0008, - 0x0480, 0x0010, 0x0000, 0x0010, - 0x04a0, 0x0008, 0x0000, 0x0008, - 0x04b0, 0x0010, 0x0000, 0x0010, - 0x04d0, 0x0010, 0x0000, 0x0010, - 0x04f0, 0x0008, 0x0000, 0x0008, - 0x0500, 0x0008, 0x0000, 0x0008, - 0x0510, 0x0018, 0x0000, 0x0018 -}; - -const ubyte FC::SMOD_waveforms[] = { - 0xc0,0xc0,0xd0,0xd8,0xe0,0xe8,0xf0,0xf8,0x00,0xf8,0xf0,0xe8,0xe0,0xd8,0xd0,0xc8, - 0x3f,0x37,0x2f,0x27,0x1f,0x17,0x0f,0x07,0xff,0x07,0x0f,0x17,0x1f,0x27,0x2f,0x37, - 0xc0,0xc0,0xd0,0xd8,0xe0,0xe8,0xf0,0xf8,0x00,0xf8,0xf0,0xe8,0xe0,0xd8,0xd0,0xc8, - 0xc0,0x37,0x2f,0x27,0x1f,0x17,0x0f,0x07,0xff,0x07,0x0f,0x17,0x1f,0x27,0x2f,0x37, - 0xc0,0xc0,0xd0,0xd8,0xe0,0xe8,0xf0,0xf8,0x00,0xf8,0xf0,0xe8,0xe0,0xd8,0xd0,0xc8, - 0xc0,0xb8,0x2f,0x27,0x1f,0x17,0x0f,0x07,0xff,0x07,0x0f,0x17,0x1f,0x27,0x2f,0x37, - 0xc0,0xc0,0xd0,0xd8,0xe0,0xe8,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, - 0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f, - 0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81, - 0x81,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f, - 0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81, - 0x81,0x81,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f, - 0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81, - 0x81,0x81,0x81,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f, - 0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81, - 0x81,0x81,0x81,0x81,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f, - 0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81, - 0x81,0x81,0x81,0x81,0x81,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f, - 0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81, - 0x81,0x81,0x81,0x81,0x81,0x81,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f, - 0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81, - 0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f, - 0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81, - 0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f, - 0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81, - 0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f, - 0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81, - 0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f, - 0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81, - 0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x7f,0x7f,0x7f,0x7f,0x7f, - 0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81, - 0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x7f,0x7f,0x7f,0x7f, - 0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81, - 0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x7f,0x7f,0x7f, - 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, - 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x7f,0x7f, - 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, - 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x7f, - 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f, - 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f, - 0x80,0x80,0x80,0x80,0x80,0x80,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f, - 0x80,0x80,0x80,0x80,0x80,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f, - 0x80,0x80,0x80,0x80,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f, - 0x80,0x80,0x80,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f, - 0x80,0x80,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f, - 0x80,0x80,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f, - 0x80,0x80,0x90,0x98,0xa0,0xa8,0xb0,0xb8,0xc0,0xc8,0xd0,0xd8,0xe0,0xe8,0xf0,0xf8, - 0x00,0x08,0x10,0x18,0x20,0x28,0x30,0x38,0x40,0x48,0x50,0x58,0x60,0x68,0x70,0x7f, - 0x80,0x80,0xa0,0xb0,0xc0,0xd0,0xe0,0xf0,0x00,0x10,0x20,0x30,0x40,0x50,0x60,0x70, - 0x45,0x45,0x79,0x7d,0x7a,0x77,0x70,0x66,0x61,0x58,0x53,0x4d,0x2c,0x20,0x18,0x12, - 0x04,0xdb,0xd3,0xcd,0xc6,0xbc,0xb5,0xae,0xa8,0xa3,0x9d,0x99,0x93,0x8e,0x8b,0x8a, - 0x45,0x45,0x79,0x7d,0x7a,0x77,0x70,0x66,0x5b,0x4b,0x43,0x37,0x2c,0x20,0x18,0x12, - 0x04,0xf8,0xe8,0xdb,0xcf,0xc6,0xbe,0xb0,0xa8,0xa4,0x9e,0x9a,0x95,0x94,0x8d,0x83, - 0x00,0x00,0x40,0x60,0x7f,0x60,0x40,0x20,0x00,0xe0,0xc0,0xa0,0x80,0xa0,0xc0,0xe0, - 0x00,0x00,0x40,0x60,0x7f,0x60,0x40,0x20,0x00,0xe0,0xc0,0xa0,0x80,0xa0,0xc0,0xe0, - 0x80,0x80,0x90,0x98,0xa0,0xa8,0xb0,0xb8,0xc0,0xc8,0xd0,0xd8,0xe0,0xe8,0xf0,0xf8, - 0x00,0x08,0x10,0x18,0x20,0x28,0x30,0x38,0x40,0x48,0x50,0x58,0x60,0x68,0x70,0x7f, - 0x80,0x80,0xa0,0xb0,0xc0,0xd0,0xe0,0xf0,0x00,0x10,0x20,0x30,0x40,0x50,0x60,0x70 -}; diff --git a/MCUME_pico/picosnd/LibFC14/LamePaula.h b/MCUME_pico/picosnd/LibFC14/LamePaula.h deleted file mode 100644 index 1fd83ff..0000000 --- a/MCUME_pico/picosnd/LibFC14/LamePaula.h +++ /dev/null @@ -1,98 +0,0 @@ -// Simple AMIGA Paula Audio channel mixer -- Copyright (C) Michael Schwendt -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. - -#ifndef LAMEPAULA_H -#define LAMEPAULA_H - -#include "Paula.h" - -class LamePaulaMixer; - -class LamePaulaVoice : public PaulaVoice -{ - public: - LamePaulaVoice(); - ~LamePaulaVoice(); - - void on(); - void off(); - void takeNextBuf(); // take parameters from paula.* (or just to repeat.*) - - friend class LamePaulaMixer; - - private: - bool isOn; - bool looping; // whether to loop sample buffer continously (PAULA emu) - - const ubyte* start; - const ubyte* end; - udword length; - - const ubyte* repeatStart; - const ubyte* repeatEnd; - udword repeatLength; - - uword curPeriod; - udword stepSpeed; - udword stepSpeedPnt; - udword stepSpeedAddPnt; -}; - -class LamePaulaMixer : public PaulaMixer -{ - public: - LamePaulaMixer(); - ~LamePaulaMixer(); - void init(udword freq, ubyte bits, ubyte channels, uword zero); - void init(ubyte voices); - PaulaVoice* getVoice(ubyte); - - void fillBuffer(void* buffer, udword bufferLen, PaulaPlayer *player); - - private: - void setReplayingSpeed(); - void setBpm(uword bpm); - void end(); - - void* (LamePaulaMixer::*_fillFunc)(void*, udword); - - void* fill8bitMono(void*, udword); - void* fill8bitStereo(void*, udword); - void* fill16bitMono(void*, udword); - void* fill16bitStereo(void*, udword); - - static const int _maxVoices = 32; - LamePaulaVoice* _voice[_maxVoices]; - int _voices; - - udword _pcmFreq; - ubyte _bitsPerSample; - ubyte _channels; - uword _zero; - - static const udword AMIGA_CLOCK_PAL = 3546895; - static const udword AMIGA_CLOCK_NTSC = 3579546; - const udword AMIGA_CLOCK; - - sbyte mix8[256]; - sword mix16[256]; - - ubyte zero8bit; // ``zero''-sample - uword zero16bit; // either signed or unsigned - - ubyte bufferScale; - - udword samplesAdd; - udword samplesPnt; - uword samples, samplesOrg; - - udword toFill; - - ubyte emptySample; -}; - -#endif // LAMEPAULA_H diff --git a/MCUME_pico/picosnd/LibFC14/LamePaulaMixer.cpp b/MCUME_pico/picosnd/LibFC14/LamePaulaMixer.cpp deleted file mode 100644 index 56e700b..0000000 --- a/MCUME_pico/picosnd/LibFC14/LamePaulaMixer.cpp +++ /dev/null @@ -1,377 +0,0 @@ -// Simple AMIGA Paula Audio channel mixer -- Copyright (C) Michael Schwendt -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. - -// History: This once was a simple mixer (it still is ;) that was -// used in a private MOD/TFMX player and was configured at run-time -// to mix up to 32 individual audio channels. In this particular -// version, 16-bit and mono are moved back in. Most of that old code -// has not been touched though because it has done its job well even -// if it looks quite ugly. So, please bear with me, if you find things -// in here that are not used by the FC player. - -#include "LamePaula.h" - -LamePaulaMixer::LamePaulaMixer() - : AMIGA_CLOCK(AMIGA_CLOCK_PAL) -{ - // Start with no voice ptrs. - _voices = 0; - for (ubyte v=0; v<_maxVoices; v++) { - _voice[v] = 0; - } -} - - -LamePaulaMixer::~LamePaulaMixer() { - end(); -} - - -void LamePaulaMixer::end() { - for (ubyte v=0; v<_voices; v++) { - delete _voice[v]; - _voice[v] = 0; - } - _voices = 0; -} - - -PaulaVoice* LamePaulaMixer::getVoice(ubyte n) { - if (n < _maxVoices) { - return _voice[n]; - } - else { - return 0; - } -} - - -void LamePaulaMixer::init(ubyte voices) { - if ((voices <= _maxVoices) && (voices != _voices)) { - end(); - _voices = voices; - for (ubyte v=0; v<_voices; v++) { - _voice[v] = new LamePaulaVoice; - } - } - for (ubyte v=0; v<_voices; v++) { - LamePaulaVoice* pv = _voice[v]; - pv->start = &emptySample; - pv->end = &emptySample+1; - pv->repeatStart = &emptySample; - pv->repeatEnd = &emptySample+1; - pv->length = 1; - pv->curPeriod = 0; - pv->stepSpeed = 0; - pv->stepSpeedPnt = 0; - pv->stepSpeedAddPnt = 0; - pv->off(); - } -} - - -void LamePaulaMixer::init(udword freq, ubyte bits, ubyte channels, uword zero) -{ - _pcmFreq = freq; - _bitsPerSample = bits; - _channels = channels; - _zero = zero; - - setReplayingSpeed(); - - bufferScale = 0; - toFill = 0; - - if (bits == 8) { - zero8bit = zero; - if (channels == 1) { - _fillFunc = &LamePaulaMixer::fill8bitMono; - } - else { // if (channels == 2) - _fillFunc = &LamePaulaMixer::fill8bitStereo; - ++bufferScale; - } - } - else { // if (bits == 16) - zero16bit = zero; - ++bufferScale; - if (channels == 1) { - _fillFunc = &LamePaulaMixer::fill16bitMono; - } - else { // if (channels == 2) - _fillFunc = &LamePaulaMixer::fill16bitStereo; - ++bufferScale; - } - } - - uword ui; - long si; - ubyte voicesPerChannel = _voices/_channels; - - // Input samples: 80,81,82,...,FE,FF,00,01,02,...,7E,7F - // Array: 00/x, 01/x, 02/x,...,7E/x,7F/x,80/x,81/x,82/x,...,FE/x/,FF/x - ui = 0; - si = 0; - while (si++ < 128) { - mix8[ui++] = (sbyte)(si/voicesPerChannel); - } - si = -128; - while (si++ < 0) { - mix8[ui++] = (sbyte)(si/voicesPerChannel); - } - // Input samples: 80,81,82,...,FE,FF,00,01,02,...,7E,7F - // Array: 0/x, 100/x, 200/x, ..., FF00/x - ui = 0; - si = 0; - while (si < 128*256) { - mix16[ui++] = (sword)(si/voicesPerChannel); - si += 256; - } - si = -128*256; - while (si < 0) { - mix16[ui++] = (sword)(si/voicesPerChannel); - si += 256; - } -} - - -void LamePaulaMixer::setReplayingSpeed() { - samples = ( samplesOrg = _pcmFreq / 50 ); - samplesPnt = (( _pcmFreq % 50 ) * 65536 ) / 50; - samplesAdd = 0; -} - - -void LamePaulaMixer::setBpm(uword bpm) { - uword callsPerSecond = (bpm * 2) / 5; - samples = ( samplesOrg = _pcmFreq / callsPerSecond ); - samplesPnt = (( _pcmFreq % callsPerSecond ) * 65536 ) / callsPerSecond; - samplesAdd = 0; -} - - -void LamePaulaMixer::fillBuffer(void* buffer, udword bufferLen, PaulaPlayer *player) { - // Both, 16-bit and stereo samples take more memory. - // Hence fewer samples fit into the buffer. - bufferLen >>= bufferScale; - - while ( bufferLen > 0 ) { - if ( toFill > bufferLen ) { - buffer = (this->*_fillFunc)(buffer, bufferLen); - toFill -= bufferLen; - bufferLen = 0; - } - else if ( toFill > 0 ) { - buffer = (this->*_fillFunc)(buffer, toFill); - bufferLen -= toFill; - toFill = 0; - } - if ( toFill == 0 ) { - player->run(); - - udword temp = ( samplesAdd += samplesPnt ); - samplesAdd = temp & 0xFFFF; - toFill = samples + ( temp > 65535 ); - - for (ubyte v=0; v<_voices; v++) { - LamePaulaVoice *pv = _voice[v]; - if ( pv->paula.period != pv->curPeriod ) { - pv->curPeriod = pv->paula.period; - if (pv->curPeriod != 0) { - pv->stepSpeed = (AMIGA_CLOCK/_pcmFreq) / pv->curPeriod; - pv->stepSpeedPnt = (((AMIGA_CLOCK/_pcmFreq) % pv->curPeriod ) * 65536 ) / pv->curPeriod; - } - else { - pv->stepSpeed = pv->stepSpeedPnt = 0; - } - } - } // for voices - } - } // while bufferLen -} - - -void* LamePaulaMixer::fill8bitMono(void* buffer, udword numberOfSamples) -{ - ubyte* buffer8bit = static_cast(buffer); - for (ubyte v=0; v<_voices; v++) { - buffer8bit = static_cast(buffer); - LamePaulaVoice *pv = _voice[v]; - for (udword n = numberOfSamples; n>0; n--) { - if (v == 0) { - *buffer8bit = zero8bit; - } - pv->stepSpeedAddPnt += pv->stepSpeedPnt; - pv->start += ( pv->stepSpeed + ( pv->stepSpeedAddPnt > 65535 ) ); - pv->stepSpeedAddPnt &= 65535; - if ( pv->start < pv->end ) { - *buffer8bit += ( pv->paula.volume * mix8[*pv->start] ) >> 6; - } - else { - if ( pv->looping ) { - pv->start = pv->repeatStart; - pv->end = pv->repeatEnd; - if ( pv->start < pv->end ) { - *buffer8bit += ( pv->paula.volume * mix8[*pv->start] ) >> 6; - } - } - } - buffer8bit++; - } - } - return(buffer8bit); -} - - -void* LamePaulaMixer::fill8bitStereo( void* buffer, udword numberOfSamples ) -{ - ubyte* buffer8bit = (static_cast(buffer))+1; - for (ubyte v=1; v<_voices; v+=2) - { - buffer8bit = (static_cast(buffer))+1; - LamePaulaVoice *pv = _voice[v]; - for (udword n = numberOfSamples; n>0; n--) { - if (v == 1) { - *buffer8bit = zero8bit; - } - pv->stepSpeedAddPnt += pv->stepSpeedPnt; - pv->start += ( pv->stepSpeed + ( pv->stepSpeedAddPnt > 65535 ) ); - pv->stepSpeedAddPnt &= 65535; - if ( pv->start < pv->end ) { - *buffer8bit += ( pv->paula.volume * mix8[*pv->start] ) >> 6; - } - else { - if ( pv->looping ) { - pv->start = pv->repeatStart; - pv->end = pv->repeatEnd; - if ( pv->start < pv->end ) { - *buffer8bit += ( pv->paula.volume * mix8[*pv->start] ) >> 6; - } - } - } - buffer8bit += 2; - } - } - buffer8bit = static_cast(buffer); - for (ubyte v=0; v<_voices; v+=2) { - buffer8bit = static_cast(buffer); - LamePaulaVoice *pv = _voice[v]; - for (udword n = numberOfSamples; n>0; n--) { - if (v == 0) { - *buffer8bit = zero8bit; - } - pv->stepSpeedAddPnt += pv->stepSpeedPnt; - pv->start += ( pv->stepSpeed + ( pv->stepSpeedAddPnt > 65535 ) ); - pv->stepSpeedAddPnt &= 65535; - if ( pv->start < pv->end ) { - *buffer8bit += ( pv->paula.volume * mix8[*pv->start] ) >> 6; - } - else { - if ( pv->looping ) { - pv->start = pv->repeatStart; - pv->end = pv->repeatEnd; - if ( pv->start < pv->end ) { - *buffer8bit += ( pv->paula.volume * mix8[*pv->start] ) >> 6; - } - } - } - buffer8bit += 2; - } - } - return(buffer8bit); -} - - -void* LamePaulaMixer::fill16bitMono( void* buffer, udword numberOfSamples ) -{ - sword* buffer16bit = static_cast(buffer); - for (ubyte v=0; v<_voices; v++) { - buffer16bit = static_cast(buffer); - LamePaulaVoice *pv = _voice[v]; - for (udword n = numberOfSamples; n>0; n--) { - if (v == 0) { - *buffer16bit = zero16bit; - } - pv->stepSpeedAddPnt += pv->stepSpeedPnt; - pv->start += ( pv->stepSpeed + ( pv->stepSpeedAddPnt > 65535 ) ); - pv->stepSpeedAddPnt &= 65535; - if ( pv->start < pv->end ) { - *buffer16bit += ( pv->paula.volume * mix16[*pv->start] ) >> 6; - } - else { - if ( pv->looping ) { - pv->start = pv->repeatStart; - pv->end = pv->repeatEnd; - if ( pv->start < pv->end ) { - *buffer16bit += ( pv->paula.volume * mix16[*pv->start] ) >> 6; - } - } - } - buffer16bit++; - } - } - return(buffer16bit); -} - - -void* LamePaulaMixer::fill16bitStereo( void *buffer, udword numberOfSamples ) -{ - sword* buffer16bit = (static_cast(buffer))+1; - for (ubyte v=1; v<_voices; v+=2 ) { - buffer16bit = (static_cast(buffer))+1; - LamePaulaVoice *pv = _voice[v]; - for (udword n = numberOfSamples; n>0; n--) { - if (v == 1) { - *buffer16bit = zero16bit; - } - pv->stepSpeedAddPnt += pv->stepSpeedPnt; - pv->start += ( pv->stepSpeed + ( pv->stepSpeedAddPnt > 65535 ) ); - pv->stepSpeedAddPnt &= 65535; - if ( pv->start < pv->end ) { - *buffer16bit += ( pv->paula.volume * mix16[*pv->start] ) >> 6; - } - else { - if ( pv->looping ) { - pv->start = pv->repeatStart; - pv->end = pv->repeatEnd; - if ( pv->start < pv->end ) - { - *buffer16bit += ( pv->paula.volume * mix16[*pv->start] ) >> 6; - } - } - } - buffer16bit += 2; - } - } - buffer16bit = static_cast(buffer); - for (ubyte v=0; v<_voices; v+=2 ) { - buffer16bit = static_cast(buffer); - LamePaulaVoice *pv = _voice[v]; - for (udword n = numberOfSamples; n>0; n--) { - if (v == 0) { - *buffer16bit = zero16bit; - } - pv->stepSpeedAddPnt += pv->stepSpeedPnt; - pv->start += ( pv->stepSpeed + ( pv->stepSpeedAddPnt > 65535 ) ); - pv->stepSpeedAddPnt &= 65535; - if ( pv->start < pv->end ) { - *buffer16bit += ( pv->paula.volume * mix16[*pv->start] ) >> 6; - } - else { - if ( pv->looping ) { - pv->start = pv->repeatStart; - pv->end = pv->repeatEnd; - if ( pv->start < pv->end ) { - *buffer16bit += ( pv->paula.volume * mix16[*pv->start] ) >> 6; - } - } - } - buffer16bit += 2; - } - } - return(buffer16bit); -} diff --git a/MCUME_pico/picosnd/LibFC14/LamePaulaVoice.cpp b/MCUME_pico/picosnd/LibFC14/LamePaulaVoice.cpp deleted file mode 100644 index 0baca4d..0000000 --- a/MCUME_pico/picosnd/LibFC14/LamePaulaVoice.cpp +++ /dev/null @@ -1,52 +0,0 @@ -// Simple AMIGA Paula Audio channel mixer -- Copyright (C) Michael Schwendt -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. - -#include "LamePaula.h" - -LamePaulaVoice::LamePaulaVoice() { - looping = true; - off(); -} - - -LamePaulaVoice::~LamePaulaVoice() { - off(); -} - - -void LamePaulaVoice::off() { - isOn = false; - paula.period = 0; - paula.volume = 0; -} - - -void LamePaulaVoice::on() { - takeNextBuf(); - isOn = true; -} - - -void LamePaulaVoice::takeNextBuf() { - if (!isOn) { - // If channel is off, take sample START parameters. - start = paula.start; - length = paula.length; - length <<= 1; - if (length == 0) { // Paula would play $FFFF words (!) - length = 1; - } - end = start+length; - } - repeatStart = paula.start; - repeatLength = paula.length; - repeatLength <<= 1; - if (repeatLength == 0) { // Paula would play $FFFF words (!) - repeatLength = 1; - } - repeatEnd = repeatStart+repeatLength; -} diff --git a/MCUME_pico/picosnd/LibFC14/MyEndian.h b/MCUME_pico/picosnd/LibFC14/MyEndian.h deleted file mode 100644 index b43c679..0000000 --- a/MCUME_pico/picosnd/LibFC14/MyEndian.h +++ /dev/null @@ -1,170 +0,0 @@ -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. - -#ifndef MYENDIAN_H -#define MYENDIAN_H - -#include "Config.h" -#include "MyTypes.h" - -// This should never be true. -#if defined(LO) || defined(HI) || defined(LOLO) || defined(LOHI) || defined(HILO) || defined(HIHI) - #error Redefinition of these values can cause trouble. -#endif - -// For optional direct memory access. -// First value in memory/array = index 0. -// Second value in memory/array = index 1. - -// For a pair of bytes/words/longwords. -#undef LO -#undef HI - -// For two pairs of bytes/words/longwords. -#undef LOLO -#undef LOHI -#undef HILO -#undef HIHI - -#if defined(WORDS_BIGENDIAN) -// byte-order: HI..3210..LO - #define LO 1 - #define HI 0 - #define LOLO 3 - #define LOHI 2 - #define HILO 1 - #define HIHI 0 -#else -// byte-order: LO..0123..HI - #define LO 0 - #define HI 1 - #define LOLO 0 - #define LOHI 1 - #define HILO 2 - #define HIHI 3 -#endif - -union cpuLword -{ - uword w[2]; // single 16-bit low and high word - udword l; // complete 32-bit longword -}; - -union cpuWord -{ - ubyte b[2]; // single 8-bit low and high byte - uword w; // complete 16-bit word -}; - -union cpuLBword -{ - ubyte b[4]; // single 8-bit bytes - udword l; // complete 32-bit longword -}; - -// Convert high-byte and low-byte to 16-bit word. -// Used to read 16-bit words in little-endian order. -inline uword readEndian(ubyte hi, ubyte lo) -{ - return(( (uword)hi << 8 ) + (uword)lo ); -} - -// Convert high bytes and low bytes of MSW and LSW to 32-bit word. -// Used to read 32-bit words in little-endian order. -inline udword readEndian(ubyte hihi, ubyte hilo, ubyte hi, ubyte lo) -{ - return(( (udword)hihi << 24 ) + ( (udword)hilo << 16 ) + - ( (udword)hi << 8 ) + (udword)lo ); -} - -// Read a little-endian 16-bit word from two bytes in memory. -inline uword readLEword(const ubyte ptr[2]) -{ -#if defined(WORDS_LITTLEENDIAN) && defined(OPTIMIZE_ENDIAN_ACCESS) - return *((uword*)ptr); -#else - return readEndian(ptr[1],ptr[0]); -#endif -} - -// Write a big-endian 16-bit word to two bytes in memory. -inline void writeLEword(ubyte ptr[2], uword someWord) -{ -#if defined(WORDS_LITTLEENDIAN) && defined(OPTIMIZE_ENDIAN_ACCESS) - *((uword*)ptr) = someWord; -#else - ptr[0] = (someWord & 0xFF); - ptr[1] = (someWord >> 8); -#endif -} - - - -// Read a big-endian 16-bit word from two bytes in memory. -inline uword readBEword(const ubyte ptr[2]) -{ -#if defined(WORDS_BIGENDIAN) && defined(OPTIMIZE_ENDIAN_ACCESS) - return *((uword*)ptr); -#else - return ( (((uword)ptr[0])<<8) + ((uword)ptr[1]) ); -#endif -} - -// Read a big-endian 32-bit word from four bytes in memory. -inline udword readBEdword(const ubyte ptr[4]) -{ -#if defined(WORDS_BIGENDIAN) && defined(OPTIMIZE_ENDIAN_ACCESS) - return *((udword*)ptr); -#else - return ( (((udword)ptr[0])<<24) + (((udword)ptr[1])<<16) - + (((udword)ptr[2])<<8) + ((udword)ptr[3]) ); -#endif -} - -// Write a big-endian 16-bit word to two bytes in memory. -inline void writeBEword(ubyte ptr[2], uword someWord) -{ -#if defined(WORDS_BIGENDIAN) && defined(OPTIMIZE_ENDIAN_ACCESS) - *((uword*)ptr) = someWord; -#else - ptr[0] = someWord >> 8; - ptr[1] = someWord & 0xFF; -#endif -} - -// Write a big-endian 32-bit word to four bytes in memory. -inline void writeBEdword(ubyte ptr[4], udword someDword) -{ -#if defined(WORDS_BIGENDIAN) && defined(OPTIMIZE_ENDIAN_ACCESS) - *((udword*)ptr) = someDword; -#else - ptr[0] = someDword >> 24; - ptr[1] = (someDword>>16) & 0xFF; - ptr[2] = (someDword>>8) & 0xFF; - ptr[3] = someDword & 0xFF; -#endif -} - - - -// Convert 16-bit little-endian word to big-endian order or vice versa. -inline uword convertEndianess( uword intelword ) -{ - uword hi = intelword >> 8; - uword lo = intelword & 255; - return(( lo << 8 ) + hi ); -} - -// Convert 32-bit little-endian word to big-endian order or vice versa. -inline udword convertEndianess( udword inteldword ) -{ - udword hihi = inteldword >> 24; - udword hilo = ( inteldword >> 16 ) & 0xFF; - udword hi = ( inteldword >> 8 ) & 0xFF; - udword lo = inteldword & 0xFF; - return(( lo << 24 ) + ( hi << 16 ) + ( hilo << 8 ) + hihi ); -} - -#endif // MYENDIAN_H diff --git a/MCUME_pico/picosnd/LibFC14/MyTypes.h b/MCUME_pico/picosnd/LibFC14/MyTypes.h deleted file mode 100644 index 997722a..0000000 --- a/MCUME_pico/picosnd/LibFC14/MyTypes.h +++ /dev/null @@ -1,38 +0,0 @@ -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. - -#ifndef MYTYPES_H -#define MYTYPES_H - -#include "Config.h" - -// Wanted: 8-bit signed/unsigned. -#if SIZEOF_CHAR > 1 -#error Platform unsupported. -#endif // SIZEOF_CHAR -typedef signed char sbyte; -typedef unsigned char ubyte; - -// Wanted: 16-bit signed/unsigned. -#if SIZEOF_SHORT_INT >= 2 -typedef signed short int sword; -typedef unsigned short int uword; -#else -typedef signed int sword; -typedef unsigned int uword; -#endif // SIZEOF_SHORT_INT - -// Wanted: 32-bit signed/unsigned. -#if SIZEOF_INT >= 4 -typedef signed int sdword; -typedef unsigned int udword; -#elif SIZEOF_LONG_INT >= 4 -typedef signed long int sdword; -typedef unsigned long int udword; -#else -#error Platform not supported. -#endif // SIZEOF_INT - -#endif // MYTYPES_H diff --git a/MCUME_pico/picosnd/LibFC14/Paula.cpp b/MCUME_pico/picosnd/LibFC14/Paula.cpp deleted file mode 100644 index 659259a..0000000 --- a/MCUME_pico/picosnd/LibFC14/Paula.cpp +++ /dev/null @@ -1,20 +0,0 @@ -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. - -#include "Paula.h" - -void PaulaVoice::off() { - // intentionally left blank -} - - -void PaulaVoice::on() { - // intentionally left blank -} - - -void PaulaVoice::takeNextBuf() { - // intentionally left blank -} diff --git a/MCUME_pico/picosnd/LibFC14/Paula.h b/MCUME_pico/picosnd/LibFC14/Paula.h deleted file mode 100644 index 5b09b21..0000000 --- a/MCUME_pico/picosnd/LibFC14/Paula.h +++ /dev/null @@ -1,37 +0,0 @@ -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. - -#ifndef PAULA_H -#define PAULA_H - -#include "MyTypes.h" - -class PaulaVoice { - public: - // Paula - struct _paula { - const ubyte* start; // start address - uword length; // length in 16-bit words - uword period; - uword volume; // 0-64 - } paula; - - virtual void on(); - virtual void off(); - virtual void takeNextBuf(); // take parameters from paula.* (or just to repeat.*) -}; - -class PaulaMixer { - public: - virtual void init(ubyte voices) = 0; - virtual PaulaVoice* getVoice(ubyte) = 0; -}; - -class PaulaPlayer { - public: - virtual void run() = 0; -}; - -#endif // PAULA_H diff --git a/MCUME_pico/picosnd/LibFC14/SmartPtr.h b/MCUME_pico/picosnd/LibFC14/SmartPtr.h deleted file mode 100644 index 61cf791..0000000 --- a/MCUME_pico/picosnd/LibFC14/SmartPtr.h +++ /dev/null @@ -1,180 +0,0 @@ -// Simple smart pointer class -- Copyright (C) Michael Schwendt -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. - -#ifndef SMARTPTR_H -#define SMARTPTR_H - -typedef unsigned long int ulong; - -template class smartPtrBase { - public: - smartPtrBase(T* buffer, ulong bufferLen, bool bufOwner = false) : dummy(0) { - doFree = bufOwner; - if ( bufferLen >= 1 ) { - pBufCurrent = ( bufBegin = buffer ); - bufEnd = bufBegin + bufferLen; - bufLen = bufferLen; - status = true; - } - else { - pBufCurrent = ( bufBegin = ( bufEnd = 0 )); - bufLen = 0; - status = false; - } - } - - virtual ~smartPtrBase() { - if ( doFree && (bufBegin != 0) ) { -#if defined(_MSC_VER) - delete[] (void*)bufBegin; -#else - delete[] bufBegin; -#endif - } - } - - virtual T* tellBegin() { return bufBegin; } - virtual ulong tellLength() { return bufLen; } - virtual ulong tellPos() { return (ulong)(pBufCurrent-bufBegin); } - - virtual bool checkIndex(ulong index) { - return ((pBufCurrent+index)= 1 ) { - pBufCurrent = bufBegin; - return (status = true); - } - else { - return (status = false); - } - } - - virtual bool good() { - return (pBufCurrent= bufBegin) { - pBufCurrent -= offset; - } - else { - status = false; - } - } - - T operator*() { - if ( good() ) { - return *pBufCurrent; - } - else { - status = false; - return dummy; - } - } - - T& operator[](ulong index) { - if (checkIndex(index)) { - return pBufCurrent[index]; - } - else { - status = false; - return dummy; - } - } - - virtual operator bool() { return status; } - - protected: - T* bufBegin; - T* bufEnd; - T* pBufCurrent; - ulong bufLen; - bool status; - bool doFree; - T dummy; -}; - - -template class smartPtr : public smartPtrBase { - public: - smartPtr(T* buffer, ulong bufferLen, bool bufOwner = false) - : smartPtrBase(buffer, bufferLen, bufOwner) - { - } - - smartPtr() - : smartPtrBase(0,0) - { - } - - void setBuffer(T* buffer, ulong bufferLen) { - if ( bufferLen >= 1 ) { - this->pBufCurrent = ( this->bufBegin = buffer ); - this->bufEnd = this->bufBegin + bufferLen; - this->bufLen = bufferLen; - this->status = true; - } - else { - this->pBufCurrent = this->bufBegin = this->bufEnd = 0; - this->bufLen = 0; - this->status = false; - } - } -}; - -#endif // SMARTPTR_H diff --git a/MCUME_pico/picosnd/LibFC14/fc14audiodecoder.cpp b/MCUME_pico/picosnd/LibFC14/fc14audiodecoder.cpp deleted file mode 100644 index dcc7e3d..0000000 --- a/MCUME_pico/picosnd/LibFC14/fc14audiodecoder.cpp +++ /dev/null @@ -1,99 +0,0 @@ -// C language wrapper library for Future Composer audio decoder -// Copyright (C) 2008 Michael Schwendt -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -#include "fc14audiodecoder.h" - -#include "FC.h" -#include "LamePaula.h" - -#define FC14_DECLARE_DECODER \ - fc14dec *p = (fc14dec*)ptr - -struct fc14dec { - FC decoder; - LamePaulaMixer mixer; -}; - -void* fc14dec_new() { - fc14dec *p = new fc14dec; - p->decoder.setMixer(&p->mixer); - return (void*)p; -} - -void fc14dec_delete(void* ptr) { - FC14_DECLARE_DECODER; - delete p; -} - -int fc14dec_detect(void* ptr, void* data, unsigned long int length) { - FC14_DECLARE_DECODER; - return p->decoder.isOurData(data,length); -} - -int fc14dec_init(void* ptr, void* data, unsigned long int length) { - FC14_DECLARE_DECODER; - return p->decoder.init(data,length); -} - -void fc14dec_restart(void* ptr) { - FC14_DECLARE_DECODER; - p->decoder.restart(); -} - -void fc14dec_seek(void* ptr, long int ms) { - FC14_DECLARE_DECODER; - p->decoder.restart(); - while (ms>=0) { - p->decoder.run(); - ms -= 20; - if ( fc14dec_song_end(p) ) { - break; - } - }; -} - -void fc14dec_mixer_init(void* ptr, int freq, int bits, int channels, int zero) { - FC14_DECLARE_DECODER; - p->mixer.init(freq,bits,channels,zero); -} - -void fc14dec_buffer_fill(void* ptr, void* buffer, unsigned long int length) { - FC14_DECLARE_DECODER; - p->mixer.fillBuffer(buffer,length,&p->decoder); -} - -int fc14dec_song_end(void* ptr) { - FC14_DECLARE_DECODER; - return p->decoder.songEnd; -} - -unsigned long int fc14dec_duration(void* ptr) { - FC14_DECLARE_DECODER; - // Determine duration with a dry-run till song-end. - unsigned long int ms = 0; - do { - p->decoder.run(); - ms += 20; - } while ( !fc14dec_song_end(p) ); - p->decoder.restart(); - return ms; -} - -const char* fc14dec_format_name(void* ptr) { - FC14_DECLARE_DECODER; - return p->decoder.formatName.c_str(); -} diff --git a/MCUME_pico/picosnd/LibFC14/fc14audiodecoder.h b/MCUME_pico/picosnd/LibFC14/fc14audiodecoder.h deleted file mode 100644 index 33b91a6..0000000 --- a/MCUME_pico/picosnd/LibFC14/fc14audiodecoder.h +++ /dev/null @@ -1,73 +0,0 @@ -/* C language wrapper library for Future Composer audio decoder - * Copyright (C) 2008 Michael Schwendt - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ -#ifndef FC14AUDIODECODER_H -#define FC14AUDIODECODER_H - -#ifdef __cplusplus -extern "C" { -#endif - - /* Return ptr to new decoder object. */ - void* fc14dec_new(); - - /* Delete decoder object. */ - void fc14dec_delete(void* decoder); - - /* Apply input format header check to a memory buffer. - Returns: 0 = recognized data, 1 = unknown data */ - int fc14dec_detect(void* decoder, void* buffer, unsigned long int length); - - /* Initialize decoder with input data from a memory buffer. - Input buffer may be freed as buffer contents are copied. - Returns: 0 = success, 1 = failure */ - int fc14dec_init(void* decoder, void* buffer, unsigned long int length); - - /* Restart an already initialized decoder. */ - void fc14dec_restart(void* decoder); - - /* Initialize decoder's audio sample mixer. - frequency : output sample frequency - precision : bits per sample - channels : 1=mono, 2=stereo - zero : value of silent output sample - (e.g. 0x80 for unsigned 8-bit, 0x0000 for signed 16-bit) */ - void fc14dec_mixer_init(void* decoder, int frequency, int precision, - int channels, int zero); - - /* Return 0 if song end has been reached, else 1. */ - int fc14dec_song_end(void* decoder); - - /* Return song duration in milli-seconds [ms]. - Decoder must be initialized and will be restarted afterwards. */ - unsigned long int fc14dec_duration(void* decoder); - - /* Set an initialized decoder's play position in milli-seconds [ms]. */ - void fc14dec_seek(void* decoder, long int ms); - - /* Return C-string describing the detected input data format. - Use only with an initialized decoder. */ - const char* fc14dec_format_name(void* decoder); - - /* Fill output sample buffer with audio. */ - void fc14dec_buffer_fill(void* decoder, void* buffer, unsigned long int length); - -#ifdef __cplusplus -} -#endif - -#endif /* FC14AUDIODECODER_H */ diff --git a/MCUME_pico/picosnd/StSnd/LZH.H b/MCUME_pico/picosnd/StSnd/LZH.H deleted file mode 100755 index 64fcee3..0000000 --- a/MCUME_pico/picosnd/StSnd/LZH.H +++ /dev/null @@ -1,144 +0,0 @@ -/*----------------------------------------------------------------------------- - - ST-Sound ( YM files player library ) - - LZH depacking routine - Original LZH code by Haruhiko Okumura (1991) and Kerwin F. Medina (1996) - - I changed to C++ object to remove global vars, so it should be thread safe now. - ------------------------------------------------------------------------------*/ - -/*----------------------------------------------------------------------------- -* ST-Sound, ATARI-ST Music Emulator -* Copyright (c) 1995-1999 Arnaud Carre ( http://leonard.oxg.free.fr ) -* All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* 1. Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* 2. Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* -* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -* SUCH DAMAGE. -* ------------------------------------------------------------------------------*/ - - -#ifndef LZH_H -#define LZH_H - - -#define BUFSIZE (1024 * 4) - -typedef uint8_t uchar; /* 8 bits or more */ -typedef unsigned int uint; /* 16 bits or more */ -typedef uint16_t ushort; /* 16 bits or more */ - -#ifndef CHAR_BIT - #define CHAR_BIT 8 -#endif - -#ifndef UCHAR_MAX - #define UCHAR_MAX 255 -#endif - -typedef ushort BITBUFTYPE; - -#define BITBUFSIZ (CHAR_BIT * sizeof (BITBUFTYPE)) -#define DICBIT 13 /* 12(-lh4-) or 13(-lh5-) */ -#define DICSIZ (1U << DICBIT) -#define MAXMATCH 256 /* formerly F (not more than UCHAR_MAX + 1) */ -#define THRESHOLD 3 /* choose optimal value */ -#define NC (UCHAR_MAX + MAXMATCH + 2 - THRESHOLD) /* alphabet = {0, 1, 2, ..., NC - 1} */ -#define CBIT 9 /* $\lfloor \log_2 NC \rfloor + 1$ */ -#define CODE_BIT 16 /* codeword length */ - -#define MAX_HASH_VAL (3 * DICSIZ + (DICSIZ / 512 + 1) * UCHAR_MAX) - -#define NP (DICBIT + 1) -#define NT (CODE_BIT + 3) -#define PBIT 4 /* smallest integer such that (1U << PBIT) > NP */ -#define TBIT 5 /* smallest integer such that (1U << TBIT) > NT */ -#if NT > NP - #define NPT NT -#else - #define NPT NP -#endif - - -class CLzhDepacker -{ -public: - - bool LzUnpack(void *pSrc,int srcSize,void *pDst,int dstSize); - -private: - - //---------------------------------------------- - // New stuff to handle memory IO - //---------------------------------------------- - uchar * m_pSrc; - int m_srcSize; - uchar * m_pDst; - int m_dstSize; - - int DataIn(void *pBuffer,int nBytes); - int DataOut(void *pOut,int nBytes); - - - - //---------------------------------------------- - // Original Lzhxlib static func - //---------------------------------------------- - void fillbuf (int n); - ushort getbits (int n); - void init_getbits (void); - int make_table (int nchar, uchar *bitlen,int tablebits, ushort *table); - void read_pt_len (int nn, int nbit, int i_special); - void read_c_len (void); - ushort decode_c(void); - ushort decode_p(void); - void huf_decode_start (void); - void decode_start (void); - void decode (uint count, uchar buffer[]); - - - //---------------------------------------------- - // Original Lzhxlib static vars - //---------------------------------------------- - int fillbufsize; - uchar buf[BUFSIZE]; - uchar outbuf[DICSIZ]; - ushort left [2 * NC - 1]; - ushort right[2 * NC - 1]; - BITBUFTYPE bitbuf; - uint subbitbuf; - int bitcount; - int decode_j; /* remaining bytes to copy */ - uchar c_len[NC]; - uchar pt_len[NPT]; - uint blocksize; - ushort c_table[4096]; - ushort pt_table[256]; - int with_error; - - uint fillbuf_i; // NOTE: these ones are not initialized at constructor time but inside the fillbuf and decode func. - uint decode_i; -}; - - -#endif /* ifndef LZH_H */ diff --git a/MCUME_pico/picosnd/StSnd/LzhLib.cpp b/MCUME_pico/picosnd/StSnd/LzhLib.cpp deleted file mode 100755 index b13a7b7..0000000 --- a/MCUME_pico/picosnd/StSnd/LzhLib.cpp +++ /dev/null @@ -1,441 +0,0 @@ -/*----------------------------------------------------------------------------- - - ST-Sound ( YM files player library ) - - LZH depacking routine - Original LZH code by Haruhiko Okumura (1991) and Kerwin F. Medina (1996) - - I changed to C++ object to remove global vars, so it should be thread safe now. - ------------------------------------------------------------------------------*/ - -/*----------------------------------------------------------------------------- -* ST-Sound, ATARI-ST Music Emulator -* Copyright (c) 1995-1999 Arnaud Carre ( http://leonard.oxg.free.fr ) -* All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* 1. Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* 2. Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* -* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -* SUCH DAMAGE. -* ------------------------------------------------------------------------------*/ - -#include -#include "YmTypes.h" -#include "LZH.H" - -/* - * Additions - */ - - - -int CLzhDepacker::DataIn(void *pBuffer,int nBytes) -{ - const int np = (nBytes <= m_srcSize) ? nBytes : m_srcSize; - if (np > 0) - { - memcpy(pBuffer,m_pSrc,np); - m_pSrc += np; - m_srcSize -= np; - } - return np; -} - -int CLzhDepacker::DataOut(void *pBuffer,int nBytes) -{ - const int np = (nBytes <= m_dstSize) ? nBytes : m_dstSize; - if (np > 0) - { - memcpy(m_pDst,pBuffer,np); - m_pDst += np; - m_dstSize -= np; - } - return np; -} - - - -/* - * io.c - */ - - -/** Shift bitbuf n bits left, read n bits */ -void CLzhDepacker::fillbuf (int n) -{ - bitbuf = (bitbuf << n) & 0xffff; - while (n > bitcount) - { - bitbuf |= subbitbuf << (n -= bitcount); - if (fillbufsize == 0) - { - fillbuf_i = 0; - fillbufsize = DataIn(buf, BUFSIZE - 32); - } - if (fillbufsize > 0) - fillbufsize--, subbitbuf = buf[fillbuf_i++]; - else - subbitbuf = 0; - bitcount = CHAR_BIT; - } - bitbuf |= subbitbuf >> (bitcount -= n); -} - -ushort CLzhDepacker::getbits (int n) -{ - ushort x; - x = bitbuf >> (BITBUFSIZ - n); - fillbuf (n); - return x; -} - -void CLzhDepacker::init_getbits (void) -{ - bitbuf = 0; - subbitbuf = 0; - bitcount = 0; - fillbuf (BITBUFSIZ); -} - -/* - * maketbl.c - */ - -int CLzhDepacker::make_table (int nchar, uchar *bitlen, - int tablebits, ushort *table) -{ - ushort count[17], weight[17], start[18], *p; - uint jutbits, avail, mask; - int i,ch,len,nextcode; - - for (i = 1; i <= 16; i++) - count[i] = 0; - for (i = 0; i < nchar; i++) - count[bitlen[i]]++; - - start[1] = 0; - for (i = 1; i <= 16; i++) - start[i + 1] = start[i] + (count[i] << (16 - i)); - if (start[17] != (ushort) (1U << 16)) - return (1); /* error: bad table */ - - jutbits = 16 - tablebits; - for (i = 1; i <= tablebits; i++) - { - start[i] >>= jutbits; - weight[i] = 1U << (tablebits - i); - } - while (i <= 16) - { - weight[i] = 1U << (16 - i); - i++; - } - - i = start[tablebits + 1] >> jutbits; - if (i != (ushort) (1U << 16)) - { - int k = 1U << tablebits; - while (i != k) - table[i++] = 0; - } - - avail = nchar; - mask = 1U << (15 - tablebits); - for (ch = 0; ch < nchar; ch++) - { - if ((len = bitlen[ch]) == 0) - continue; - nextcode = start[len] + weight[len]; - if (len <= tablebits) - { - for (i = start[len]; i < nextcode; i++) - table[i] = ch; - } - else - { - uint k = start[len]; - p = &table[k >> jutbits]; - i = len - tablebits; - while (i != 0) - { - if (*p == 0) - { - right[avail] = left[avail] = 0; - *p = avail++; - } - if (k & mask) - p = &right[*p]; - else - p = &left[*p]; - k <<= 1; - i--; - } - *p = ch; - } - start[len] = nextcode; - } - return (0); -} - -/* - * huf.c - */ - - -void CLzhDepacker::read_pt_len (int nn, int nbit, int i_special) -{ - int i, n; - short c; - ushort mask; - - n = getbits (nbit); - if (n == 0) - { - c = getbits (nbit); - for (i = 0; i < nn; i++) - pt_len[i] = 0; - for (i = 0; i < 256; i++) - pt_table[i] = c; - } - else - { - i = 0; - while (i < n) - { - c = bitbuf >> (BITBUFSIZ - 3); - if (c == 7) - { - mask = 1U << (BITBUFSIZ - 1 - 3); - while (mask & bitbuf) - { - mask >>= 1; - c++; - } - } - fillbuf ((c < 7) ? 3 : c - 3); - pt_len[i++] = uchar(c); - if (i == i_special) - { - c = getbits (2); - while (--c >= 0) - pt_len[i++] = 0; - } - } - while (i < nn) - pt_len[i++] = 0; - make_table (nn, pt_len, 8, pt_table); - } -} - -void CLzhDepacker::read_c_len (void) -{ - short i, c, n; - ushort mask; - - n = getbits (CBIT); - if (n == 0) - { - c = getbits (CBIT); - for (i = 0; i < NC; i++) - c_len[i] = 0; - for (i = 0; i < 4096; i++) - c_table[i] = c; - } - else - { - i = 0; - while (i < n) - { - c = pt_table[bitbuf >> (BITBUFSIZ - 8)]; - if (c >= NT) - { - mask = 1U << (BITBUFSIZ - 1 - 8); - do - { - if (bitbuf & mask) - c = right[c]; - else - c = left[c]; - mask >>= 1; - } while (c >= NT); - } - fillbuf (pt_len[c]); - if (c <= 2) - { - if (c == 0) - c = 1; - else if (c == 1) - c = getbits (4) + 3; - else - c = getbits (CBIT) + 20; - while (--c >= 0) - c_len[i++] = 0; - } - else - c_len[i++] = c - 2; - } - while (i < NC) - c_len[i++] = 0; - make_table (NC, c_len, 12, c_table); - } -} - -ushort CLzhDepacker::decode_c (void) -{ - ushort j, mask; - - if (blocksize == 0) - { - blocksize = getbits (16); - read_pt_len (NT, TBIT, 3); - read_c_len (); - read_pt_len (NP, PBIT, -1); - } - blocksize--; - j = c_table[bitbuf >> (BITBUFSIZ - 12)]; - if (j >= NC) - { - mask = 1U << (BITBUFSIZ - 1 - 12); - do - { - if (bitbuf & mask) - j = right[j]; - else - j = left[j]; - mask >>= 1; - } - while (j >= NC); - } - fillbuf (c_len[j]); - return j; -} - -ushort CLzhDepacker::decode_p (void) -{ - ushort j, mask; - - j = pt_table[bitbuf >> (BITBUFSIZ - 8)]; - if (j >= NP) - { - mask = 1U << (BITBUFSIZ - 1 - 8); - do - { - if (bitbuf & mask) - j = right[j]; - else - j = left[j]; - mask >>= 1; - } while (j >= NP); - } - fillbuf (pt_len[j]); - if (j != 0) - j = (1U << (j - 1)) + getbits (j - 1); - return j; -} - -void CLzhDepacker::huf_decode_start (void) -{ - init_getbits (); - blocksize = 0; -} - -/* - * decode.c - */ - - -void CLzhDepacker::decode_start (void) -{ - fillbufsize = 0; - huf_decode_start (); - decode_j = 0; -} - -/* - * The calling function must keep the number of bytes to be processed. This - * function decodes either 'count' bytes or 'DICSIZ' bytes, whichever is - * smaller, into the array 'buffer[]' of size 'DICSIZ' or more. Call - * decode_start() once for each new file before calling this function. - */ -void CLzhDepacker::decode (uint count, uchar buffer[]) -{ - uint r, c; - - r = 0; - while (--decode_j >= 0) - { - buffer[r] = buffer[decode_i]; - decode_i = (decode_i + 1) & (DICSIZ - 1); - if (++r == count) - return; - } - for (;;) - { - c = decode_c (); - if (c <= UCHAR_MAX) - { - buffer[r] = c; - if (++r == count) - return; - } - else - { - decode_j = c - (UCHAR_MAX + 1 - THRESHOLD); - decode_i = (r - decode_p () - 1) & (DICSIZ - 1); - while (--decode_j >= 0) - { - buffer[r] = buffer[decode_i]; - decode_i = (decode_i + 1) & (DICSIZ - 1); - if (++r == count) - return; - } - } - } -} - -bool CLzhDepacker::LzUnpack(void *pSrc,int srcSize,void *pDst,int dstSize) -{ - - with_error = 0; - - m_pSrc = (uchar*)pSrc; - m_srcSize = srcSize; - m_pDst = (uchar*)pDst; - m_dstSize = dstSize; - - decode_start (); - - unsigned int origsize = dstSize; - while (origsize != 0) - { - int n = (uint) ((origsize > DICSIZ) ? DICSIZ : origsize); - decode (n, outbuf); - if (with_error) - break; - - DataOut(outbuf,n); - origsize -= n; - if (with_error) - break; - } - - return (0 == with_error); -} diff --git a/MCUME_pico/picosnd/StSnd/StSoundLibrary.h b/MCUME_pico/picosnd/StSnd/StSoundLibrary.h deleted file mode 100755 index 5079323..0000000 --- a/MCUME_pico/picosnd/StSnd/StSoundLibrary.h +++ /dev/null @@ -1,96 +0,0 @@ -/*----------------------------------------------------------------------------- - - ST-Sound ( YM files player library ) - - Main header to use the StSound "C" like API in your production. - ------------------------------------------------------------------------------*/ - -/*----------------------------------------------------------------------------- -* ST-Sound, ATARI-ST Music Emulator -* Copyright (c) 1995-1999 Arnaud Carre ( http://leonard.oxg.free.fr ) -* All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* 1. Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* 2. Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* -* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -* SUCH DAMAGE. -* ------------------------------------------------------------------------------*/ - - -#ifndef __STSOUNDLIBRARY__ -#define __STSOUNDLIBRARY__ - -#include "YmTypes.h" - -typedef void YMMUSIC; - -typedef struct -{ - ymchar * pSongName; - ymchar * pSongAuthor; - ymchar * pSongComment; - ymchar * pSongType; - ymchar * pSongPlayer; - yms32 musicTimeInSec; // keep for compatibility - yms32 musicTimeInMs; -} ymMusicInfo_t; - -#ifdef __cplusplus -extern "C" -{ -#endif - -// Create object -extern YMMUSIC * ymMusicCreate(); - -// Release object -extern void ymMusicDestroy(YMMUSIC *pMusic); - -// Global settings -extern void ymMusicSetLowpassFiler(YMMUSIC *pMus,ymbool bActive); - -// Functions -extern ymbool ymMusicLoad(YMMUSIC *pMusic,const char *fName); // Method 1 : Load file using stdio library (fopen/fread, etc..) -extern ymbool ymMusicLoadMemory(YMMUSIC *pMusic,void *pBlock,ymu32 size); // Method 2 : Load file from a memory block - -extern ymbool ymMusicCompute(YMMUSIC *pMusic,ymsample *pBuffer,ymint nbSample); // Render nbSample samples of current YM tune into pBuffer PCM 16bits mono sample buffer. - -extern void ymMusicSetLoopMode(YMMUSIC *pMusic,ymbool bLoop); -extern const char * ymMusicGetLastError(YMMUSIC *pMusic); -extern int ymMusicGetRegister(YMMUSIC *pMusic,ymint reg); -extern void ymMusicGetInfo(YMMUSIC *pMusic,ymMusicInfo_t *pInfo); -extern void ymMusicPlay(YMMUSIC *pMusic); -extern void ymMusicPause(YMMUSIC *pMusic); -extern void ymMusicStop(YMMUSIC *pMusic); -extern ymbool ymMusicIsOver(YMMUSIC *_pMus); - -extern void ymMusicRestart(YMMUSIC *pMusic); - -extern ymbool ymMusicIsSeekable(YMMUSIC *pMusic); -extern ymu32 ymMusicGetPos(YMMUSIC *pMusic); -extern void ymMusicSeek(YMMUSIC *pMusic,ymu32 timeInMs); - -#ifdef __cplusplus -} -#endif - - -#endif diff --git a/MCUME_pico/picosnd/StSnd/Ym2149Ex.cpp b/MCUME_pico/picosnd/StSnd/Ym2149Ex.cpp deleted file mode 100755 index d501876..0000000 --- a/MCUME_pico/picosnd/StSnd/Ym2149Ex.cpp +++ /dev/null @@ -1,579 +0,0 @@ -/*----------------------------------------------------------------------------- - - ST-Sound ( YM files player library ) - - Extended YM-2149 Emulator, with ATARI music demos effects. - (SID-Like, Digidrum, Sync Buzzer, Sinus SID and Pattern SID) - ------------------------------------------------------------------------------*/ - -/*----------------------------------------------------------------------------- -* ST-Sound, ATARI-ST Music Emulator -* Copyright (c) 1995-1999 Arnaud Carre ( http://leonard.oxg.free.fr ) -* All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* 1. Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* 2. Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* -* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -* SUCH DAMAGE. -* ------------------------------------------------------------------------------*/ - -#include "YmTypes.h" -#include -#include -#include -#include -#include "Ym2149Ex.h" - -//------------------------------------------------------------------- -// env shapes. -//------------------------------------------------------------------- -static const ymint Env00xx[8]={ 1,0,0,0,0,0,0,0 }; -static const ymint Env01xx[8]={ 0,1,0,0,0,0,0,0 }; -static const ymint Env1000[8]={ 1,0,1,0,1,0,1,0 }; -static const ymint Env1001[8]={ 1,0,0,0,0,0,0,0 }; -static const ymint Env1010[8]={ 1,0,0,1,1,0,0,1 }; -static const ymint Env1011[8]={ 1,0,1,1,1,1,1,1 }; -static const ymint Env1100[8]={ 0,1,0,1,0,1,0,1 }; -static const ymint Env1101[8]={ 0,1,1,1,1,1,1,1 }; -static const ymint Env1110[8]={ 0,1,1,0,0,1,1,0 }; -static const ymint Env1111[8]={ 0,1,0,0,0,0,0,0 }; -static const ymint * EnvWave[16] = { Env00xx,Env00xx,Env00xx,Env00xx, - Env01xx,Env01xx,Env01xx,Env01xx, - Env1000,Env1001,Env1010,Env1011, - Env1100,Env1101,Env1110,Env1111}; - -static ymint ymVolumeTable[16] = -{ 62,161,265,377,580,774,1155,1575,2260,3088,4570,6233,9330,13187,21220,32767}; - - -//---------------------------------------------------------------------- -// Very cool and fast DC Adjuster ! This is the *new* stuff of that -// package coz I get that idea working on SainT in 2004 ! -// ( almost everything here is from 1995 !) -//---------------------------------------------------------------------- -CDcAdjuster::CDcAdjuster() -{ - Reset(); -} - -void CDcAdjuster::Reset(void) -{ - for (ymint i=0;i>2)&1); - rndRack = (rndRack>>1) | (rBit<<16); - return (rBit ? 0 : 0xffff); -} - -ymu32 CYm2149Ex::envStepCompute(ymu8 rHigh,ymu8 rLow) -{ - - - ymint per = rHigh; - per = (per<<8)+rLow; - if (per<3) - return 0; - -#ifdef YM_INTEGER_ONLY - yms64 step = internalClock; - step <<= (16+16-9); - step /= (per * replayFrequency); -#else - ymfloat step = internalClock; - step /= ((ymfloat)per*512.0*(ymfloat)replayFrequency); - step *= 65536.0*65536.0; -#endif - - return (ymu32)step; -} - - -void CYm2149Ex::reset(void) -{ - - memset( registers, 0, sizeof(registers) ); - - for (int i=0;i<14;i++) - writeRegister(i,0); - - writeRegister(7,0xff); - - currentNoise = 0xffff; - rndRack = 1; - sidStop(0); - sidStop(1); - sidStop(2); - - envShape = 0; - envPhase = 0; - envPos = 0; - - m_dcAdjust.Reset(); - - memset(specialEffect,0,sizeof(specialEffect)); - - syncBuzzerStop(); - - m_lowPassFilter[0] = 0; - m_lowPassFilter[1] = 0; - -} - - -void CYm2149Ex::sidVolumeCompute(ymint voice,ymint *pVol) -{ - - struct YmSpecialEffect *pVoice = specialEffect+voice; - - if (pVoice->bSid) - { - if (pVoice->sidPos & (1<<31)) - writeRegister(8+voice,pVoice->sidVol); - else - writeRegister(8+voice,0); - } - else if (pVoice->bDrum) - { -// writeRegister(8+voice,pVoice->drumData[pVoice->drumPos>>DRUM_PREC]>>4); - - *pVol = (pVoice->drumData[pVoice->drumPos>>DRUM_PREC] * 255) / 6; - - switch (voice) - { - case 0: - pVolA = &volA; - mixerTA = 0xffff; - mixerNA = 0xffff; - break; - case 1: - pVolB = &volB; - mixerTB = 0xffff; - mixerNB = 0xffff; - break; - case 2: - pVolC = &volC; - mixerTC = 0xffff; - mixerNC = 0xffff; - break; - } - - pVoice->drumPos += pVoice->drumStep; - if ((pVoice->drumPos>>DRUM_PREC) >= pVoice->drumSize) - { - pVoice->bDrum = YMFALSE; - } - - } -} - -int CYm2149Ex::LowPassFilter(int in) -{ - const int out = (m_lowPassFilter[0]>>2) + (m_lowPassFilter[1]>>1) + (in>>2); - m_lowPassFilter[0] = m_lowPassFilter[1]; - m_lowPassFilter[1] = in; - return out; -} - -ymsample CYm2149Ex::nextSample(void) -{ -ymint vol; -ymint bt,bn; - - if (noisePos&0xffff0000) - { - currentNoise ^= rndCompute(); - noisePos &= 0xffff; - } - bn = currentNoise; - - volE = ymVolumeTable[envData[envShape][envPhase][envPos>>(32-5)]]; - - sidVolumeCompute(0,&volA); - sidVolumeCompute(1,&volB); - sidVolumeCompute(2,&volC); - - //--------------------------------------------------- - // Tone+noise+env+DAC for three voices ! - //--------------------------------------------------- - bt = ((((yms32)posA)>>31) | mixerTA) & (bn | mixerNA); - vol = (*pVolA)&bt; - bt = ((((yms32)posB)>>31) | mixerTB) & (bn | mixerNB); - vol += (*pVolB)&bt; - bt = ((((yms32)posC)>>31) | mixerTC) & (bn | mixerNC); - vol += (*pVolC)&bt; - - //--------------------------------------------------- - // Inc - //--------------------------------------------------- - posA += stepA; - posB += stepB; - posC += stepC; - noisePos += noiseStep; - envPos += envStep; - if (0 == envPhase) - { - if (envPos=0) && (reg<=13)) return registers[reg]; - else return -1; -} - -void CYm2149Ex::writeRegister(ymint reg,ymint data) -{ - - switch (reg) - { - case 0: - registers[0] = data&255; - stepA = toneStepCompute(registers[1],registers[0]); - if (!stepA) posA = (1<<31); // Assume output always 1 if 0 period (for Digi-sample !) - break; - - case 2: - registers[2] = data&255; - stepB = toneStepCompute(registers[3],registers[2]); - if (!stepB) posB = (1<<31); // Assume output always 1 if 0 period (for Digi-sample !) - break; - - case 4: - registers[4] = data&255; - stepC = toneStepCompute(registers[5],registers[4]); - if (!stepC) posC = (1<<31); // Assume output always 1 if 0 period (for Digi-sample !) - break; - - case 1: - registers[1] = data&15; - stepA = toneStepCompute(registers[1],registers[0]); - if (!stepA) posA = (1<<31); // Assume output always 1 if 0 period (for Digi-sample !) - break; - - case 3: - registers[3] = data&15; - stepB = toneStepCompute(registers[3],registers[2]); - if (!stepB) posB = (1<<31); // Assume output always 1 if 0 period (for Digi-sample !) - break; - - case 5: - registers[5] = data&15; - stepC = toneStepCompute(registers[5],registers[4]); - if (!stepC) posC = (1<<31); // Assume output always 1 if 0 period (for Digi-sample !) - break; - - case 6: - registers[6] = data&0x1f; - noiseStep = noiseStepCompute(registers[6]); - if (!noiseStep) - { - noisePos = 0; - currentNoise = 0xffff; - } - break; - - case 7: - registers[7] = data&255; - mixerTA = (data&(1<<0)) ? 0xffff : 0; - mixerTB = (data&(1<<1)) ? 0xffff : 0; - mixerTC = (data&(1<<2)) ? 0xffff : 0; - mixerNA = (data&(1<<3)) ? 0xffff : 0; - mixerNB = (data&(1<<4)) ? 0xffff : 0; - mixerNC = (data&(1<<5)) ? 0xffff : 0; - break; - - case 8: - registers[8] = data&31; - volA = ymVolumeTable[data&15]; - if (data&0x10) - pVolA = &volE; - else - pVolA = &volA; - break; - - case 9: - registers[9] = data&31; - volB = ymVolumeTable[data&15]; - if (data&0x10) - pVolB = &volE; - else - pVolB = &volB; - break; - - case 10: - registers[10] = data&31; - volC = ymVolumeTable[data&15]; - if (data&0x10) - pVolC = &volE; - else - pVolC = &volC; - break; - - case 11: - registers[11] = data&255; - envStep = envStepCompute(registers[12],registers[11]); - break; - - case 12: - registers[12] = data&255; - envStep = envStepCompute(registers[12],registers[11]); - break; - - case 13: - registers[13] = data&0xf; - envPos = 0; - envPhase = 0; - envShape = data&0xf; - break; - - } -} - -void CYm2149Ex::update(ymsample *pSampleBuffer,ymint nbSample) -{ - - ymsample *pBuffer = pSampleBuffer; - if (nbSample>0) - { - do - { - *pBuffer++ = nextSample(); - } - while (--nbSample); - } - -} - -void CYm2149Ex::drumStart(ymint voice,ymu8 *pDrumBuffer,ymu32 drumSize,ymint drumFreq) -{ - if ((pDrumBuffer) && (drumSize)) - { - specialEffect[voice].drumData = pDrumBuffer; - specialEffect[voice].drumPos = 0; - specialEffect[voice].drumSize = drumSize; - specialEffect[voice].drumStep = (drumFreq< -#include -#include -#include "YmMusic.h" - -#define _LINEAR_OVRS // Activate linear oversampling (best quality) Only used for DigiMix and UniversalTracker YM file type - - -// ATARI-ST MFP chip predivisor -static const ymint mfpPrediv[8] = {0,4,10,16,50,64,100,200}; - - - -CYmMusic::CYmMusic(ymint _replayRate) -{ - - pBigMalloc = NULL; - pSongName = NULL; - pSongAuthor = NULL; - pSongComment = NULL; - pSongType = NULL; - pSongPlayer = NULL; - - pBigSampleBuffer = NULL; - pMixBlock = NULL; - - replayRate = _replayRate; - innerSamplePos = 0; - currentPos = 0; - nbDrum = 0; - pDrumTab = NULL; - setLoopMode(YMFALSE); - - m_pTimeInfo = NULL; -} - -void CYmMusic::setTimeControl(ymbool bTime) -{ - if (bTime) - attrib |= A_TIMECONTROL; - else - attrib &= (~A_TIMECONTROL); -} - -CYmMusic::~CYmMusic() -{ - stop(); - unLoad(); -} - -void CYmMusic::setLoopMode(ymbool bLoopMode) -{ - bLoop = bLoopMode; -} - -void CYmMusic::setPlayerRate(ymint rate) -{ - playerRate = rate; -} - -ymu32 CYmMusic::getPos() -{ - if ((songType>=YM_MIX1) && (songType0) && (playerRate>0)) - { - return ((ymu32)currentFrame*1000)/(ymu32)playerRate; - } - else - return 0; - -} - -ymu32 CYmMusic::getMusicTime(void) -{ - - if ((songType>=YM_MIX1) && (songType0) && (playerRate>0)) - { - return ((ymu32)nbFrame*1000)/(ymu32)playerRate; - } - else - return 0; - -} - - -void CYmMusic::setMixTime(ymu32 time) -{ - if (time > m_musicLenInMs) - return; - - assert(m_pTimeInfo); - for (int i=0;i= m_pTimeInfo[i].time) && (time < tEnd)) - { - mixPos = m_pTimeInfo[i].nBlock; - pCurrentMixSample = pBigSampleBuffer + pMixBlock[mixPos].sampleStart; - currentSampleLength = (pMixBlock[mixPos].sampleLength)<<12; - currentPente = (((ymu32)pMixBlock[mixPos].replayFreq)<<12) / replayRate; - - ymu32 len = tEnd - m_pTimeInfo[i].time; - ymu32 t0 = ((time - m_pTimeInfo[i].time) * pMixBlock[mixPos].sampleLength) / len; - - currentPos = t0 << 12; - nbRepeat = m_pTimeInfo[i].nRepeat; - break; - } - } - - m_iMusicPosInMs = time; - m_iMusicPosAccurateSample = 0; -} - -ymu32 CYmMusic::setMusicTime(ymu32 time) -{ - if (!isSeekable()) return 0; - ymu32 newTime = 0; - - if ((songType>=YM_V2) && (songType=getMusicTime()) newTime = 0; - currentFrame = (newTime*(ymu32)playerRate)/1000; - } - else if ((songType>=YM_TRACKER1) && (songType=getMusicTime()) newTime = 0; - currentFrame = (newTime*(ymu32)playerRate)/1000; - } - else if ((songType>=YM_MIX1) && (songTypepSongName = pSongName; - pInfo->pSongAuthor = pSongAuthor; - pInfo->pSongComment = pSongComment; - pInfo->pSongType = pSongType; - pInfo->pSongPlayer = pSongPlayer; - - pInfo->musicTimeInMs = getMusicTime(); - pInfo->musicTimeInSec = pInfo->musicTimeInMs / 1000; - } -} - - -void CYmMusic::setAttrib(ymint _attrib) -{ - attrib = _attrib; -} - -ymint CYmMusic::getAttrib(void) -{ - return attrib; -} - -ymbool CYmMusic::isSeekable(void) -{ - return getAttrib()&A_TIMECONTROL; -} - -void CYmMusic::setLastError(char *pError) -{ - pLastError = pError; -} - -char *CYmMusic::getLastError(void) -{ - return pLastError; -} - -void bufferClear(ymsample *pBuffer,ymint nbSample) -{ - memset((void*)pBuffer,0,nbSample*sizeof(ymsample)); -} - -ymbool CYmMusic::update(ymsample *sampleBuffer,ymint nbSample) -{ -ymint sampleToCompute; -ymint vblNbSample; - - - if ((!bMusicOk) || - (bPause) || - (bMusicOver)) - { - bufferClear(sampleBuffer,nbSample); - if (bMusicOver) - return YMFALSE; - else - return YMTRUE; - } - - if ((songType >= YM_MIX1) && (songType < YM_MIXMAX)) - { - stDigitMix(sampleBuffer,nbSample); - - - } - else if ((songType >= YM_TRACKER1) && (songTypenbs) sampleToCompute = nbs; - innerSamplePos += sampleToCompute; - if (innerSamplePos>=vblNbSample) - { - player(); // Lecture de la partition (playerRate Hz) - innerSamplePos -= vblNbSample; - } - if (sampleToCompute>0) - { - ymChip.update(pOut,sampleToCompute); // YM Emulation. - pOut += sampleToCompute; - } - nbs -= sampleToCompute; - } - while (nbs>0); - } - - - return YMTRUE; -} - - - -void CYmMusic::readYm6Effect(unsigned char *pReg,ymint code,ymint prediv,ymint count) -{ -ymint voice; -ymint ndrum; - - code = pReg[code]&0xf0; - prediv = (pReg[prediv]>>5)&7; - count = pReg[count]; - - if (code&0x30) - { - ymu32 tmpFreq; - // Ici il y a un effet sur la voie: - - voice = ((code&0x30)>>4)-1; - switch (code&0xc0) - { - case 0x00: // SID - case 0x80: // Sinus-SID - - prediv = mfpPrediv[prediv]; - prediv *= count; - tmpFreq = 0; - if (prediv) - { - tmpFreq = 2457600L / prediv; - if ((code&0xc0)==0x00) - ymChip.sidStart(voice,tmpFreq,pReg[voice+8]&15); - else - ymChip.sidSinStart(voice,tmpFreq,pReg[voice+8]&15); - } - break; - - case 0x40: // DigiDrum - ndrum = pReg[voice+8]&31; - if ((ndrum>=0) && (ndrum0) - { - tmpFreq = 2457600L / prediv; - ymChip.drumStart(voice,pDrumTab[ndrum].pData,pDrumTab[ndrum].size,tmpFreq); - } - } - break; - - case 0xc0: // Sync-Buzzer. - - prediv = mfpPrediv[prediv]; - prediv *= count; - tmpFreq = 0; - if (prediv) - { - tmpFreq = 2457600L / prediv; - ymChip.syncBuzzerStart(tmpFreq,pReg[voice+8]&15); - } - break; - - - } - - } -} - -void CYmMusic::setVolume(ymint volume) -{ -// ymChip.setGlobalVolume(volume); -} - -void CYmMusic::player(void) - { - ymu8 *ptr; - ymu32 prediv; - ymint voice; - ymint ndrum; - - - if (currentFrame<0) currentFrame = 0; - - if (currentFrame>=nbFrame) - { - if (bLoop) - { - currentFrame = loopFrame; - } - else - { - bMusicOver = YMTRUE; - ymChip.reset(); - return; - } - } - - ptr = pDataStream+currentFrame*streamInc; - - for (ymint i=0;i<=10;i++) - ymChip.writeRegister(i,ptr[i]); - - ymChip.sidStop(0); - ymChip.sidStop(1); - ymChip.sidStop(2); - ymChip.syncBuzzerStop(); - - //--------------------------------------------- - // Check digi-drum - //--------------------------------------------- - if (songType == YM_V2) // MADMAX specific ! - { - if (ptr[13]!=0xff) - { - ymChip.writeRegister(11,ptr[11]); - ymChip.writeRegister(12,0); - ymChip.writeRegister(13,10); // MADMAX specific !! - } - if (ptr[10]&0x80) // bit 7 volume canal C pour annoncer une digi-drum madmax. - { - ymint sampleNum; - ymu32 sampleFrq; - ymChip.writeRegister(7,ymChip.readRegister(7)|0x24) ; // Coupe TONE + NOISE canal C. - sampleNum = ptr[10]&0x7f; // Numero du sample - - if (ptr[12]) - { - sampleFrq = (MFP_CLOCK / ptr[12]); - ymChip.drumStart( 2, // Voice C - sampleAdress[sampleNum], - sampleLen[sampleNum], - sampleFrq); - } - } - } - else if (songType >= YM_V3) - { - ymChip.writeRegister(11,ptr[11]); - ymChip.writeRegister(12,ptr[12]); - if (ptr[13]!=0xff) - { - ymChip.writeRegister(13,ptr[13]); - } - - if (songType >= YM_V5) - { - ymint code; - - if (songType == YM_V6) - { - readYm6Effect(ptr,1,6,14); - readYm6Effect(ptr,3,8,15); - } - else - { // YM5 effect decoding - - //------------------------------------------------------ - // Sid Voice !! - //------------------------------------------------------ - code = (ptr[1]>>4)&3; - if (code!=0) - { - ymu32 tmpFreq; - voice = code-1; - prediv = mfpPrediv[(ptr[6]>>5)&7]; - prediv *= ptr[14]; - tmpFreq = 0; - if (prediv) - { - tmpFreq = 2457600L / prediv; - ymChip.sidStart(voice,tmpFreq,ptr[voice+8]&15); - } - } - - //------------------------------------------------------ - // YM5 Digi Drum. - //------------------------------------------------------ - code = (ptr[3]>>4)&3; - if (code!=0) - { // Ici un digidrum demarre sur la voie voice. - voice = code-1; - ndrum = ptr[8+voice]&31; - if ((ndrum>=0) && (ndrum>5)&7]; - prediv *= ptr[15]; - if (prediv) - { - sampleFrq = MFP_CLOCK / prediv; - ymChip.drumStart(voice,pDrumTab[ndrum].pData,pDrumTab[ndrum].size,sampleFrq); - } - } - } - } - } - } - currentFrame++; - } - -/* - - x x x x x x x x r0 - 0 0 0 0 x x x x r1 // Special FX 1a - x x x x x x x x r2 - 0 0 0 0 x x x x r3 // Special FX 2a - x x x x x x x x r4 - 0 0 0 0 x x x x r5 - 0 0 0 x x x x x r6 // Special FX 1b - 0 0 x x x x x x r7 - 0 0 0 x x x x x r8 // Special FX 2b - 0 0 0 x x x x x r9 - 0 0 0 x x x x x r10 - x x x x x x x x r11 - x x x x x x x x r12 - 0 0 0 0 x x x x r13 - 0 0 0 0 0 0 0 0 r14 // Special FX 1c - 0 0 0 0 0 0 0 0 r15 // Special FX 2c - - - Special Fx ?a - 0 0 0 0 : No special FX running - 0 0 0 1 : Sid Voice A - 0 0 1 0 : Sid Voice B - 0 0 1 1 : Sid Voice C - 0 1 0 0 : Extended Fx voice A - 0 1 0 1 : Digidrum voice A - 0 1 1 0 : Digidrum voice B - 0 1 1 1 : Digidrum voice C - 1 0 0 0 : Extended Fx voice B - 1 0 0 1 : Sinus SID voice A - 1 0 1 0 : Sinus SID voice B - 1 0 1 1 : Sinus SID voice C - 1 1 0 0 : Extended Fx voice C - 1 1 0 1 : Sync Buzzer voice A - 1 1 1 0 : Sync Buzzer voice B - 1 1 1 1 : Sync Buzzer voice C - - - -*/ - -void CYmMusic::computeTimeInfo(void) -{ - - assert(NULL == m_pTimeInfo); - - //------------------------------------------- - // Compute nb of mixblock - //------------------------------------------- - m_nbTimeKey = 0; - ymint i; - for (i=0;i= 32) - pMixBlock[i].nbRepeat = 32; - - m_nbTimeKey += pMixBlock[i].nbRepeat; - } - - //------------------------------------------- - // Parse all mixblock keys - //------------------------------------------- - m_pTimeInfo = (TimeKey*)malloc(sizeof(TimeKey) * m_nbTimeKey); - TimeKey *pKey = m_pTimeInfo; - ymu32 time = 0; - - for (i=0;itime = time; - pKey->nRepeat = pMixBlock[i].nbRepeat - j; - pKey->nBlock = i; - pKey++; - - time += (pMixBlock[i].sampleLength * 1000) / pMixBlock[i].replayFreq; - } - } - m_musicLenInMs = time; - -} - -void CYmMusic::readNextBlockInfo(void) -{ - nbRepeat--; - if (nbRepeat<=0) - { - mixPos++; - if (mixPos >= nbMixBlock) - { - mixPos = 0; - if (!bLoop) bMusicOver = YMTRUE; - - m_iMusicPosAccurateSample = 0; - m_iMusicPosInMs = 0; - } - nbRepeat = pMixBlock[mixPos].nbRepeat; - } - pCurrentMixSample = pBigSampleBuffer + pMixBlock[mixPos].sampleStart; - currentSampleLength = (pMixBlock[mixPos].sampleLength)<<12; - currentPente = (((ymu32)pMixBlock[mixPos].replayFreq)<<12) / replayRate; - currentPos &= ((1<<12)-1); -} - -void CYmMusic::stDigitMix(ymsample *pWrite16,ymint nbs) -{ - - - if (bMusicOver) return; - - if (mixPos == -1) - { - nbRepeat = -1; - readNextBlockInfo(); - } - - m_iMusicPosAccurateSample += nbs * 1000; - m_iMusicPosInMs += ((m_iMusicPosAccurateSample) / (replayRate)); - m_iMusicPosAccurateSample %= (replayRate); - - if (nbs) do - { - - ymint sa = (ymint)(ymsample)(pCurrentMixSample[currentPos>>12]<<8); -#ifdef _LINEAR_OVRS - ymint sb = sa; - if ((currentPos>>12)<((currentSampleLength>>12)-1)) - sb = (ymint)(ymsample)(pCurrentMixSample[(currentPos>>12)+1]<<8); - ymint frac = currentPos&((1<<12)-1); - sa += (((sb-sa)*frac)>>12); -#endif - *pWrite16++ = sa; - - currentPos += currentPente; - if (currentPos>=currentSampleLength) - { - readNextBlockInfo(); - if (bMusicOver) return; - } - } - while (--nbs); -} - -void CYmMusic::ymTrackerDesInterleave(void) -{ -unsigned char *a0,*a1,*a2; -unsigned char *pNewBuffer; -ymint step; -ymu32 n1,n2; - - - if (attrib&A_STREAMINTERLEAVED) - { - a0 = pDataStream; - ymint size = sizeof(ymTrackerLine_t)*nbVoice*nbFrame; - pNewBuffer = (unsigned char*)malloc(size); - step = sizeof(ymTrackerLine_t)*nbVoice; - n1 = step; - a2 = pNewBuffer; - do - { - n2 = nbFrame; - a1 = a2; - do - { - *a1 = *a0++; - a1 += step; - } - while (--n2); - a2++; - } - while (--n1); - memcpy(pDataStream,pNewBuffer,size); - free(pNewBuffer); - attrib &= (~A_STREAMINTERLEAVED); - } -} - - -void CYmMusic::ymTrackerInit(ymint volMaxPercent) -{ -ymint i,s; -ymint vol; -ymint scale; -ymsample *pTab; - - - - for (i=0;ifreqHigh<<8) | pLine->freqLow; - if (pVoice[i].sampleFreq) - { - pVoice[i].sampleVolume = pLine->volume&63; - pVoice[i].bLoop = (pLine->volume&0x40); - n = pLine->noteOn; - if (n != 0xff) // Note ON. - { - pVoice[i].bRunning = 1; - pVoice[i].pSample = pDrumTab[n].pData; - pVoice[i].sampleSize = pDrumTab[n].size; - pVoice[i].repLen = pDrumTab[n].repLen; - pVoice[i].samplePos = 0; - } - } - else - { - pVoice[i].bRunning = 0; - } - pLine++; - } - - currentFrame++; - if (currentFrame >= nbFrame) - { - if (!bLoop) - { - bMusicOver = YMTRUE; - } - currentFrame = 0; - } -} - - -void CYmMusic::ymTrackerVoiceAdd(ymTrackerVoice_t *pVoice,ymsample *pBuffer,ymint nbs) -{ -ymsample *pVolumeTab; -ymu8 *pSample; -ymu32 samplePos; -ymu32 sampleEnd; -ymu32 sampleInc; -ymu32 repLen; -double step; - - - if (!(pVoice->bRunning)) return; - - pVolumeTab = &ymTrackerVolumeTable[256*(pVoice->sampleVolume&63)]; - pSample = pVoice->pSample; - samplePos = pVoice->samplePos; - - step = (double)(pVoice->sampleFreq<sampleSize<repLen<0) do - { - ymint va = pVolumeTab[pSample[samplePos>>YMTPREC]]; -#ifdef _LINEAR_OVRS - ymint vb = va; - if (samplePos < (sampleEnd-(1<>YMTPREC)+1]]; - - ymint frac = samplePos & ((1<>YMTPREC); -#endif - (*pBuffer++) += va; - - samplePos += sampleInc; - if (samplePos>=sampleEnd) - { - if (pVoice->bLoop) - { - samplePos -= repLen; - } - else - { - pVoice->bRunning = 0; - return; - } - } - } - while (--nbs); - pVoice->samplePos = samplePos; -} - -void CYmMusic::ymTrackerUpdate(ymsample *pBuffer,ymint nbSample) -{ -ymint i; -ymint _nbs; - - // Clear les buffers. - memset(pBuffer,0,sizeof(ymsample)*nbSample); - if (bMusicOver) return; - - do - { - if (ymTrackerNbSampleBefore == 0) - { - // Lit la partition ymTracker - ymTrackerPlayer(ymTrackerVoice); - if (bMusicOver) return; - ymTrackerNbSampleBefore = replayRate / playerRate; - } - _nbs = ymTrackerNbSampleBefore; // nb avant playerUpdate. - if (_nbs>nbSample) _nbs = nbSample; - ymTrackerNbSampleBefore -= _nbs; - if (_nbs>0) - { - // Genere les samples. - for (i=0;i0); -} diff --git a/MCUME_pico/picosnd/StSnd/YmMusic.h b/MCUME_pico/picosnd/StSnd/YmMusic.h deleted file mode 100755 index b20c8d2..0000000 --- a/MCUME_pico/picosnd/StSnd/YmMusic.h +++ /dev/null @@ -1,289 +0,0 @@ -/*----------------------------------------------------------------------------- - - ST-Sound ( YM files player library ) - - YM Music Driver - ------------------------------------------------------------------------------*/ - -/*----------------------------------------------------------------------------- -* ST-Sound, ATARI-ST Music Emulator -* Copyright (c) 1995-1999 Arnaud Carre ( http://leonard.oxg.free.fr ) -* All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* 1. Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* 2. Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* -* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -* SUCH DAMAGE. -* ------------------------------------------------------------------------------*/ - - -#ifndef __YMMUSIC__ -#define __YMMUSIC__ - -#include "YmTypes.h" -#include "StSoundLibrary.h" -#include "Ym2149Ex.h" -#include "YmLoad.h" -#include "digidrum.h" - -#define MAX_DIGIDRUM 128 - -#define YMTPREC 16 -#define MAX_VOICE 8 - -typedef enum -{ - YM_V2, - YM_V3, - YM_V4, - YM_V5, - YM_V6, - YM_VMAX, - - YM_TRACKER1=32, - YM_TRACKER2, - YM_TRACKERMAX, - - YM_MIX1=64, - YM_MIX2, - YM_MIXMAX, -} ymFile_t; - -typedef struct -{ - ymu32 sampleStart; - ymu32 sampleLength; - ymu16 nbRepeat; - ymu16 replayFreq; -} mixBlock_t; - -typedef struct -{ - ymu32 size; - ymu8 * pData; - ymu32 repLen; -} digiDrum_t; - -typedef struct -{ - ymint nbVoice; - ymu32 nbVbl; - ymu8 * pDataBufer; - ymu32 currentVbl; - ymu32 flags; - ymbool bLoop; -} ymTrackerPartoche_t; - - -typedef struct -{ - ymu8 * pSample; - ymu32 sampleSize; - ymu32 samplePos; - ymu32 repLen; - yms32 sampleVolume; - ymu32 sampleFreq; - ymbool bLoop; - ymbool bRunning; -} ymTrackerVoice_t; - -typedef struct -{ - ymu8 noteOn; - ymu8 volume; - ymu8 freqHigh; - ymu8 freqLow; -} ymTrackerLine_t; - - -enum -{ - A_STREAMINTERLEAVED = 1, - A_DRUMSIGNED = 2, - A_DRUM4BITS = 4, - A_TIMECONTROL = 8, - A_LOOPMODE = 16, -}; - -class CYmMusic -{ - -public: - CYmMusic(ymint _replayRate=44100); - ~CYmMusic(); - - ymbool load(const char *pName); - ymbool loadMemory(void *pBlock,ymu32 size); - - void unLoad(void); - ymbool isSeekable(void); - ymbool update(ymsample *pBuffer,ymint nbSample); - ymu32 getPos(void); - ymu32 getMusicTime(void); - ymu32 setMusicTime(ymu32 time); - void restart(void); - void play(void); - void pause(void); - void stop(void); - void setVolume(ymint volume); - int getAttrib(void); - void getMusicInfo(ymMusicInfo_t *pInfo); - void setLoopMode(ymbool bLoop); - char *getLastError(void); - int readYmRegister(ymint reg) { return ymChip.readRegister(reg); } - void setLowpassFilter(ymbool bActive) { ymChip.setFilter(bActive); } - - ymbool getMusicOver(void) const { return (bMusicOver); } - ymint GetNbFrame() const { return nbFrame; } - ymint GetStreamInc() const { return streamInc; } - const ymu8* GetDataStream() const { return pDataStream; } - - -//------------------------------------------------------------- -// WAVE Generator -//------------------------------------------------------------- - int waveCreate(char *fName); - - ymbool bMusicOver; - -private: - - ymbool checkCompilerTypes(); - - void setPlayerRate(int rate); - void setAttrib(int _attrib); - void setLastError(char *pError); - ymu8 *depackFile(ymu32 size); - ymbool deInterleave(void); - void readYm6Effect(ymu8 *pReg,int code,int prediv,int count); - void player(void); - void setTimeControl(ymbool bFlag); - - - CYm2149Ex ymChip; - char *pLastError; - ymFile_t songType; - int nbFrame; - int loopFrame; - int currentFrame; - int nbDrum; - digiDrum_t *pDrumTab; - int musicTime; - ymu8 *pBigMalloc; - ymu8 *pDataStream; - ymbool bLoop; - ymint fileSize; - ymbool ymDecode(void); - ymint playerRate; - ymint attrib; - volatile ymbool bMusicOk; - volatile ymbool bPause; - ymint streamInc; - ymint innerSamplePos; - ymint replayRate; - - ymchar *pSongName; - ymchar *pSongAuthor; - ymchar *pSongComment; - ymchar *pSongType; - ymchar *pSongPlayer; - -//------------------------------------------------------------- -// ATARI Digi Mix Music. -//------------------------------------------------------------- - void readNextBlockInfo(void); - void stDigitMix(ymsample *pWrite16,int nbs); - void computeTimeInfo(void); - void setMixTime(ymu32 time); - - ymint nbRepeat; - ymint nbMixBlock; - mixBlock_t *pMixBlock; - ymint mixPos; - ymu8 *pBigSampleBuffer; - ymu8 *pCurrentMixSample; - ymu32 currentSampleLength; - ymu32 currentPente; - ymu32 currentPos; - - - struct TimeKey - { - ymu32 time; - ymu16 nRepeat; - ymu16 nBlock; - }; - - ymint m_nbTimeKey; - TimeKey * m_pTimeInfo; - ymu32 m_musicLenInMs; - ymu32 m_iMusicPosAccurateSample; - ymu32 m_iMusicPosInMs; - -//------------------------------------------------------------- -// YM-Universal-Tracker -//------------------------------------------------------------- - void ymTrackerInit(int volMaxPercent); - void ymTrackerUpdate(ymsample *pBuffer,int nbSample); - void ymTrackerDesInterleave(void); - void ymTrackerPlayer(ymTrackerVoice_t *pVoice); - void ymTrackerVoiceAdd(ymTrackerVoice_t *pVoice,ymsample *pBuffer,int nbs); - - int nbVoice; - ymTrackerVoice_t ymTrackerVoice[MAX_VOICE]; - int ymTrackerNbSampleBefore; - ymsample ymTrackerVolumeTable[256*64]; - int ymTrackerFreqShift; - - -}; - -/* - int version; - SD pos; - UD inc; - UD timeSec; - UD timeMin; - UD loopSec; - UD loopMin; - UD nbVbl; - UD vblRestart; - UD ymFreq; - UD playerFreq; - UB *pRegister; - UB *pFileBuffer; - UD fileSize; - UD attrib; - char *pSongName; - char *pSongComment; - char *pSongAuthor; - mixBlock_t *pMixBlock; - long nbMixBlock; - UD nbDrum; - digiDrum_t *pDrumTab; - int nbVoice; - ymu32 currentVbl; - int bTimeControl; - int timeTotal; - int ymtFreqShift; -*/ - -#endif diff --git a/MCUME_pico/picosnd/StSnd/YmTypes.h b/MCUME_pico/picosnd/StSnd/YmTypes.h deleted file mode 100755 index 6c3e1c2..0000000 --- a/MCUME_pico/picosnd/StSnd/YmTypes.h +++ /dev/null @@ -1,96 +0,0 @@ -/*----------------------------------------------------------------------------- - - ST-Sound ( YM files player library ) - - Define YM types for multi-platform compilation. - Change that file depending of your platform. Please respect the right size - for each type. - ------------------------------------------------------------------------------*/ - -/*----------------------------------------------------------------------------- -* ST-Sound, ATARI-ST Music Emulator -* Copyright (c) 1995-1999 Arnaud Carre ( http://leonard.oxg.free.fr ) -* All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* 1. Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* 2. Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* -* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -* SUCH DAMAGE. -* ------------------------------------------------------------------------------*/ - -#ifndef __YMTYPES__ -#define __YMTYPES__ - -#ifdef _MSC_VER - -typedef __int8 int8_t; -typedef unsigned __int8 uint8_t; -typedef __int16 int16_t; -typedef unsigned __int16 uint16_t; -typedef __int32 int32_t; -typedef unsigned __int32 uint32_t; -typedef __int64 int64_t; -typedef unsigned __int64 uint64_t; - -#else -#include -#endif - - -//#define YM_INTEGER_ONLY - -//----------------------------------------------------------- -// Platform specific stuff -//----------------------------------------------------------- - -#ifdef YM_INTEGER_ONLY -typedef int64_t yms64; -#else -typedef float ymfloat; -#endif - -typedef int8_t yms8; // 8 bits signed integer -typedef int16_t yms16; // 16 bits signed integer -typedef int32_t yms32; // 32 bits signed integer - -typedef uint8_t ymu8; // 8 bits unsigned integer -typedef uint16_t ymu16; // 16 bits unsigned integer -typedef uint32_t ymu32; // 32 bits unsigned integer - -typedef yms32 ymint; // Native "int" for speed purpose. StSound suppose int is signed and at least 32bits. If not, change it to match to yms32 -typedef char ymchar; // 8 bits char character (used for null terminated strings) - - -#ifndef NULL -#define NULL (0L) -#endif - -//----------------------------------------------------------- -// Multi-platform -//----------------------------------------------------------- -typedef int ymbool; // boolean ( theorically nothing is assumed for its size in StSound,so keep using int) -typedef yms16 ymsample; // StSound emulator render mono 16bits signed PCM samples - -#define YMFALSE (0) -#define YMTRUE (!YMFALSE) - -#endif - diff --git a/MCUME_pico/picosnd/StSnd/YmUserInterface.cpp b/MCUME_pico/picosnd/StSnd/YmUserInterface.cpp deleted file mode 100755 index 197c213..0000000 --- a/MCUME_pico/picosnd/StSnd/YmUserInterface.cpp +++ /dev/null @@ -1,154 +0,0 @@ -/*----------------------------------------------------------------------------- - - ST-Sound ( YM files player library ) - - ST-Sound library "C-like" interface wrapper - ------------------------------------------------------------------------------*/ - -/*----------------------------------------------------------------------------- -* ST-Sound, ATARI-ST Music Emulator -* Copyright (c) 1995-1999 Arnaud Carre ( http://leonard.oxg.free.fr ) -* All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* 1. Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* 2. Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* -* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -* SUCH DAMAGE. -* ------------------------------------------------------------------------------*/ - - -#include "YmMusic.h" -#include "StSoundLibrary.h" - - -// Static assert to check various type len - -YMMUSIC * ymMusicCreate() -{ - return (YMMUSIC*)(new CYmMusic); -} - - -ymbool ymMusicLoad(YMMUSIC *pMus, const char *fName) -{ - CYmMusic *pMusic = (CYmMusic*)pMus; - return pMusic->load(fName); -} - -ymbool ymMusicLoadMemory(YMMUSIC *pMus, void *pBlock, ymu32 size) -{ - CYmMusic *pMusic = (CYmMusic*)pMus; - return pMusic->loadMemory(pBlock,size); -} - -void ymMusicDestroy(YMMUSIC *pMus) -{ - CYmMusic *pMusic = (CYmMusic*)pMus; - delete pMusic; -} - -ymbool ymMusicCompute(YMMUSIC *_pMus, ymsample *pBuffer, int nbSample) -{ - CYmMusic *pMusic = (CYmMusic*)_pMus; - return pMusic->update(pBuffer,nbSample); -} - -void ymMusicSetLoopMode(YMMUSIC *_pMus, ymbool bLoop) -{ - CYmMusic *pMusic = (CYmMusic*)_pMus; - pMusic->setLoopMode(bLoop); -} - -const char * ymMusicGetLastError(YMMUSIC *_pMus) -{ - CYmMusic *pMusic = (CYmMusic*)_pMus; - return pMusic->getLastError(); -} - -int ymMusicGetRegister(YMMUSIC *_pMus, ymint reg) -{ - CYmMusic *pMusic = (CYmMusic*)_pMus; - return pMusic->readYmRegister(reg); -} - -void ymMusicGetInfo(YMMUSIC *_pMus, ymMusicInfo_t *pInfo) -{ - CYmMusic *pMusic = (CYmMusic*)_pMus; - pMusic->getMusicInfo(pInfo); -} - -void ymMusicPlay(YMMUSIC *_pMus) -{ - CYmMusic *pMusic = (CYmMusic*)_pMus; - pMusic->play(); -} - -void ymMusicPause(YMMUSIC *_pMus) -{ - CYmMusic *pMusic = (CYmMusic*)_pMus; - pMusic->pause(); -} - -void ymMusicStop(YMMUSIC *_pMus) -{ - CYmMusic *pMusic = (CYmMusic*)_pMus; - pMusic->stop(); -} - -ymbool ymMusicIsOver(YMMUSIC *_pMus) -{ - CYmMusic *pMusic = (CYmMusic*)_pMus; - return (pMusic->getMusicOver()); -} - -ymbool ymMusicIsSeekable(YMMUSIC *_pMus) -{ - CYmMusic *pMusic = (CYmMusic*)_pMus; - return pMusic->isSeekable() ? YMTRUE : YMFALSE; -} - -ymu32 ymMusicGetPos(YMMUSIC *_pMus) -{ - CYmMusic *pMusic = (CYmMusic*)_pMus; - return pMusic->getPos(); -} - -void ymMusicSeek(YMMUSIC *_pMus, ymu32 timeInMs) -{ - CYmMusic *pMusic = (CYmMusic*)_pMus; - if (pMusic->isSeekable()) - { - pMusic->setMusicTime(timeInMs); - } -} - -void ymMusicRestart(YMMUSIC *_pMus) -{ - CYmMusic *pMusic = (CYmMusic*)_pMus; - pMusic->restart(); -} - -void ymMusicSetLowpassFiler(YMMUSIC *_pMus, ymbool bActive) -{ - CYmMusic *pMusic = (CYmMusic*)_pMus; - pMusic->setLowpassFilter(bActive); -} - diff --git a/MCUME_pico/picosnd/StSnd/Ymload.cpp b/MCUME_pico/picosnd/StSnd/Ymload.cpp deleted file mode 100755 index 46246da..0000000 --- a/MCUME_pico/picosnd/StSnd/Ymload.cpp +++ /dev/null @@ -1,742 +0,0 @@ -/*----------------------------------------------------------------------------- - - ST-Sound ( YM files player library ) - - Manage YM file depacking and parsing - ------------------------------------------------------------------------------*/ - -/*----------------------------------------------------------------------------- -* ST-Sound, ATARI-ST Music Emulator -* Copyright (c) 1995-1999 Arnaud Carre ( http://leonard.oxg.free.fr ) -* All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* 1. Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* 2. Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* -* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -* SUCH DAMAGE. -* ------------------------------------------------------------------------------*/ - -#include -#include -#include -#include "YmMusic.h" -#include "LZH.H" -extern "C" { - #include "../emuapi.h" -} - -static ymu16 ymVolumeTable[16] = -{ 62,161,265,377,580,774,1155,1575,2260,3088,4570,6233,9330,13187,21220,32767}; - - -static void signeSample(ymu8 *ptr,yms32 size) -{ - - if (size>0) - { - do - { - *ptr++ ^= 0x80; - } - while (--size); - } -} - -char *mstrdup(char *in) -{ - const int size = strlen(in)+1; - char *out = (char*)malloc(size); - if (out) - strcpy(out,in); - return out; -} - -ymu32 readMotorolaDword(ymu8 **ptr) -{ -ymu32 n; -ymu8 *p = *ptr; - - n = (p[0]<<24)|(p[1]<<16)|(p[2]<<8)|p[3]; - p+=4; - *ptr = p; - return n; -} - -ymu16 readMotorolaWord(ymu8 **ptr) -{ -ymu16 n; -ymu8 *p = *ptr; - - n = (p[0]<<8)|p[1]; - p+=2; - *ptr = p; - return n; -} - -ymchar *readNtString(ymchar **ptr) -{ -ymchar *p; - - p = mstrdup(*ptr); - (*ptr) += strlen(*ptr)+1; - return p; -} - -yms32 ReadLittleEndian32(ymu8 *pLittle) -{ - yms32 v = ( (pLittle[0]<<0) | - (pLittle[1]<<8) | - (pLittle[2]<<16) | - (pLittle[3]<<24)); - - return v; -} - -yms32 ReadBigEndian32(ymu8 *pBig) -{ - yms32 v = ( (pBig[0]<<24) | - (pBig[1]<<16) | - (pBig[2]<<8) | - (pBig[3]<<0)); - - return v; -} - -unsigned char *CYmMusic::depackFile(ymu32 checkOriginalSize) - { - lzhHeader_t *pHeader; - ymu8 *pNew; - ymu8 *pSrc; - - pHeader = (lzhHeader_t*)pBigMalloc; - - if ((pHeader->size==0) || // NOTE: Endianness works because value is 0 - (strncmp(pHeader->id,"-lh5-",5))) - { // Le fichier n'est pas compresse, on retourne l'original. - return pBigMalloc; - } - - fileSize = (ymu32)-1; - - if (pHeader->level != 0) // NOTE: Endianness works because value is 0 - { // Compression LH5, header !=0 : Error. - free(pBigMalloc); - pBigMalloc = NULL; - setLastError("LHARC Header must be 0 !"); - return NULL; - } - - fileSize = ReadLittleEndian32((ymu8*)&pHeader->original); - pNew = (ymu8*)malloc(fileSize); - if (!pNew) - { - setLastError("MALLOC Failed !"); - free(pBigMalloc); - pBigMalloc = NULL; - return NULL; - } - - pSrc = pBigMalloc+sizeof(lzhHeader_t)+pHeader->name_lenght; // NOTE: Endianness works because name_lenght is a byte - - pSrc += 2; // skip CRC16 - - ymu32 packedSize = ReadLittleEndian32((ymu8*)&pHeader->packed); - - checkOriginalSize -= ymu32(pSrc - pBigMalloc); - - if (packedSize > checkOriginalSize) - packedSize = checkOriginalSize; - - // Check for corrupted archive - if (packedSize <= checkOriginalSize) - { - // alloc space for depacker and depack data - CLzhDepacker *pDepacker = new CLzhDepacker; - const bool bRet = pDepacker->LzUnpack(pSrc,packedSize,pNew,fileSize); - delete pDepacker; - - if (!bRet) - { // depacking error - setLastError("LH5 Depacking Error !"); - free(pNew); - pNew = NULL; - } - } - else - { - setLastError("LH5 Depacking Error !"); - free(pNew); - pNew = NULL; - } - - // Free up source buffer, whatever depacking fail or success - free(pBigMalloc); - - return pNew; - } - - - - - -static ymint fileSizeGet(FILE *h) - { - ymint size; - ymint old; - - old = ftell(h); - fseek(h,0,SEEK_END); - size = ftell(h); - fseek(h,old,SEEK_SET); - return size; - } - - -ymbool CYmMusic::deInterleave(void) - { - yms32 nextPlane[32]; - ymu8 *pW,*tmpBuff; - yms32 j,k; - - - if (attrib&A_STREAMINTERLEAVED) - { - - tmpBuff = (ymu8*)malloc(nbFrame*streamInc); - if (!tmpBuff) - { - setLastError("Malloc error in deInterleave()\n"); - return YMFALSE; - } - - // Precalcul les offsets. - for (j=0;j0) - { - pDrumTab=(digiDrum_t*)malloc(nbDrum*sizeof(digiDrum_t)); - for (i=0;i>7; - pw++; - } - } - ptr += pDrumTab[i].size; - } - else - { - pDrumTab[i].pData = NULL; - } - } - attrib &= (~A_DRUM4BITS); - } - pSongName = readNtString((char**)&ptr); - pSongAuthor = readNtString((char**)&ptr); - pSongComment = readNtString((char**)&ptr); - songType = YM_V5; - if (id==e_YM6a)//'YM6!') - { - songType = YM_V6; - pSongType = mstrdup("YM 6"); - } - else - { - pSongType = mstrdup("YM 5"); - } - pDataStream = ptr; - streamInc = 16; - pSongPlayer = mstrdup("YM-Chip driver"); - break; - - case e_MIX1://'MIX1': // ATARI Remix digit format. - - if (strncmp((const char*)(pBigMalloc+4),"LeOnArD!",8)) - { - setLastError("Not a valid YM format !"); - return YMFALSE; - } - ptr = pBigMalloc+12; - songType = YM_MIX1; - tmp = readMotorolaDword(&ptr); - setAttrib(0); - if (tmp&1) setAttrib(A_DRUMSIGNED); - sampleSize = readMotorolaDword(&ptr); - nbMixBlock = readMotorolaDword(&ptr); - pMixBlock = (mixBlock_t*)malloc(nbMixBlock*sizeof(mixBlock_t)); - for (i=0;i0) - { - pDrumTab=(digiDrum_t*)malloc(nbDrum*sizeof(digiDrum_t)); - for (i=0;i<(ymint)nbDrum;i++) - { - pDrumTab[i].size = readMotorolaWord(&ptr); - pDrumTab[i].repLen = pDrumTab[i].size; - if (e_YMT2 == id)//('YMT2' == id) - { - pDrumTab[i].repLen = readMotorolaWord(&ptr); // repLen - readMotorolaWord(&ptr); // flag - } - if (pDrumTab[i].repLen>pDrumTab[i].size) - { - pDrumTab[i].repLen = pDrumTab[i].size; - } - - if (pDrumTab[i].size) - { - pDrumTab[i].pData = (ymu8*)malloc(pDrumTab[i].size); - memcpy(pDrumTab[i].pData,ptr,pDrumTab[i].size); - ptr += pDrumTab[i].size; - } - else - { - pDrumTab[i].pData = NULL; - } - } - } - - ymTrackerFreqShift = 0; - if (e_YMT2 == id)//('YMT2' == id) - { - ymTrackerFreqShift = (attrib>>28)&15; - attrib &= 0x0fffffff; - pSongType = mstrdup("YM-T2"); - } - else - { - pSongType = mstrdup("YM-T1"); - } - - - pDataStream = ptr; - ymChip.setClock(ATARI_CLOCK); - - ymTrackerInit(100); // 80% de volume maxi. - streamInc = 16; - setTimeControl(YMTRUE); - pSongPlayer = mstrdup("Universal Tracker"); - break; - - default: - setLastError("Unknow YM format !"); - return YMFALSE; - break; - } - - if (!deInterleave()) - { - return YMFALSE; - } - - return YMTRUE; - } - - -ymbool CYmMusic::checkCompilerTypes() -{ - setLastError("Basic types size are not correct (check ymTypes.h)"); - - if (1 != sizeof(ymu8)) return YMFALSE; - if (1 != sizeof(yms8)) return YMFALSE; - if (1 != sizeof(ymchar)) return YMFALSE; - - if (2 != sizeof(ymu16)) return YMFALSE; - if (2 != sizeof(yms16)) return YMFALSE; - if (4 != sizeof(ymu32)) return YMFALSE; - if (4 != sizeof(yms32)) return YMFALSE; - - if (2 != sizeof(ymsample)) return YMFALSE; - -#ifdef YM_INTEGER_ONLY - if (8 != sizeof(yms64)) return YMFALSE; -#endif - - if (sizeof(ymint) < 4) return YMFALSE; // ymint should be at least 32bits - - setLastError(""); - return YMTRUE; -} - - -ymbool CYmMusic::load(const char *fileName) -{ -FILE *in; - - - stop(); - unLoad(); - - if (!checkCompilerTypes()) - return YMFALSE; - - in = fopen(fileName,"rb"); - if (!in) - { - setLastError("File not Found"); - return YMFALSE; - } - - //--------------------------------------------------- - // Allocation d'un buffer pour lire le fichier. - //--------------------------------------------------- - fileSize = fileSizeGet(in); - pBigMalloc = (unsigned char*)malloc(fileSize); - if (!pBigMalloc) - { - setLastError("MALLOC Error"); - fclose(in); - return YMFALSE; - } - - //--------------------------------------------------- - // Chargement du fichier complet. - //--------------------------------------------------- - if (fread(pBigMalloc,1,fileSize,in)!=(size_t)fileSize) - { - free(pBigMalloc); - setLastError("File is corrupted."); - fclose(in); - return YMFALSE; - } - fclose(in); - - //--------------------------------------------------- - // Transforme les donnes en donnes valides. - //--------------------------------------------------- - pBigMalloc = depackFile(fileSize); - if (!pBigMalloc) - { - return YMFALSE; - } - - //--------------------------------------------------- - // Lecture des donnes YM: - //--------------------------------------------------- - if (!ymDecode()) - { - free(pBigMalloc); - pBigMalloc = NULL; - return YMFALSE; - } - - ymChip.reset(); - bMusicOk = YMTRUE; - bPause = YMFALSE; - return YMTRUE; - } - -ymbool CYmMusic::loadMemory(void *pBlock,ymu32 size) -{ - - - stop(); - unLoad(); - - if (!checkCompilerTypes()) - return YMFALSE; - - //--------------------------------------------------- - // Allocation d'un buffer pour lire le fichier. - //--------------------------------------------------- - fileSize = size; - pBigMalloc = (unsigned char*)emu_Malloc(fileSize); - if (!pBigMalloc) - { - setLastError("MALLOC Error"); - return YMFALSE; - } - - //--------------------------------------------------- - // Chargement du fichier complet. - //--------------------------------------------------- - memcpy(pBigMalloc,pBlock,size); - - //--------------------------------------------------- - // Transforme les donnes en donnes valides. - //--------------------------------------------------- - pBigMalloc = depackFile(size); - if (!pBigMalloc) - { - return YMFALSE; - } - - //--------------------------------------------------- - // Lecture des donnes YM: - //--------------------------------------------------- - if (!ymDecode()) - { - emu_Free(pBigMalloc); - pBigMalloc = NULL; - return YMFALSE; - } - - ymChip.reset(); - bMusicOk = YMTRUE; - bPause = YMFALSE; - return YMTRUE; - } - -void myFree(void **pPtr) -{ - if (*pPtr) free(*pPtr); - *pPtr = NULL; -} - -void CYmMusic::unLoad(void) -{ - - bMusicOk = YMFALSE; - bPause = YMTRUE; - bMusicOver = YMFALSE; - myFree((void**)&pSongName); - myFree((void**)&pSongAuthor); - myFree((void**)&pSongComment); - myFree((void**)&pSongType); - myFree((void**)&pSongPlayer); - myFree((void**)&pBigMalloc); - if (nbDrum>0) - { - for (ymint i=0;i -#include - -extern "C" { - #include "emuapi.h" - #include "iopins.h" -} - -#if (defined(ILI9341) || defined(ST7789)) && defined(USE_VGA) -// Dual display config, initialize TFT -#include "tft_t_dma.h" -static TFT_T_DMA tft; -#else -// Non Dual display config -#ifdef USE_VGA -#include "vga_t_dma.h" -#else -#include "tft_t_dma.h" -#endif -extern TFT_T_DMA tft; -#endif - - -#define MAX_FILES 64 -#define MAX_FILENAME_SIZE 24 -#define MAX_MENULINES 9 -#define TEXT_HEIGHT 16 -#define TEXT_WIDTH 8 -#define MENU_FILE_XOFFSET (6*TEXT_WIDTH) -#define MENU_FILE_YOFFSET (2*TEXT_HEIGHT) -#define MENU_FILE_W (MAX_FILENAME_SIZE*TEXT_WIDTH) -#define MENU_FILE_H (MAX_MENULINES*TEXT_HEIGHT) -#define MENU_FILE_BGCOLOR RGBVAL16(0x00,0x00,0x40) -#define MENU_JOYS_YOFFSET (12*TEXT_HEIGHT) -#define MENU_VBAR_XOFFSET (0*TEXT_WIDTH) -#define MENU_VBAR_YOFFSET (MENU_FILE_YOFFSET) - -#define MENU_TFT_XOFFSET (MENU_FILE_XOFFSET+MENU_FILE_W+8) -#define MENU_TFT_YOFFSET (MENU_VBAR_YOFFSET+32) -#define MENU_VGA_XOFFSET (MENU_FILE_XOFFSET+MENU_FILE_W+8) -#define MENU_VGA_YOFFSET (MENU_VBAR_YOFFSET+MENU_FILE_H-32-37) - - - -static char romspath[64]; -static int nbFiles=0; -static int curFile=0; -static int topFile=0; -static char selection[MAX_FILENAME_SIZE+1]=""; -static char files[MAX_FILES][MAX_FILENAME_SIZE]; -static bool menuRedraw=true; - -#ifdef PICOMPUTER -static const unsigned short * keys; -static unsigned char keymatrix[6]; -static int keymatrix_hitrow=-1; -static bool key_fn=false; -static bool key_alt=false; -static uint32_t keypress_t_ms=0; -static uint32_t last_t_ms=0; -static uint32_t hundred_ms_cnt=0; -static bool ledflash_toggle=false; -#endif -static int keyMap; - -static bool joySwapped = false; -static uint16_t bLastState; -static int xRef; -static int yRef; -static uint8_t usbnavpad=0; - -static bool menuOn=true; - - - -/******************************** - * Generic output and malloc -********************************/ -void emu_printf(char * text) -{ - printf("%s\n",text); -} - -void emu_printf(int val) -{ - printf("%d\n",val); -} - -void emu_printi(int val) -{ - printf("%d\n",val); -} - -void emu_printh(int val) -{ - printf("0x%.8\n",val); -} - -static int malbufpt = 0; -static char malbuf[EXTRA_HEAP]; - -void * emu_Malloc(int size) -{ - void * retval = malloc(size); - if (!retval) { - emu_printf("failled to allocate"); - emu_printf(size); - emu_printf("fallback"); - if ( (malbufpt+size) < sizeof(malbuf) ) { - retval = (void *)&malbuf[malbufpt]; - malbufpt += size; - } - else { - emu_printf("failure to allocate"); - } - } - else { - emu_printf("could allocate dynamic "); - emu_printf(size); - } - - return retval; -} - -void * emu_MallocI(int size) -{ - void * retval = NULL; - - if ( (malbufpt+size) < sizeof(malbuf) ) { - retval = (void *)&malbuf[malbufpt]; - malbufpt += size; - emu_printf("could allocate static "); - emu_printf(size); - } - else { - emu_printf("failure to allocate"); - } - - return retval; -} -void emu_Free(void * pt) -{ - free(pt); -} - -void emu_drawText(unsigned short x, unsigned short y, const char * text, unsigned short fgcolor, unsigned short bgcolor, int doublesize) -{ - tft.drawText(x, y, text, fgcolor, bgcolor, doublesize?true:false); -} - - -/******************************** - * OSKB handling -********************************/ -#if (defined(ILI9341) || defined(ST7789)) && defined(USE_VGA) -// On screen keyboard position -#define KXOFF 28 //64 -#define KYOFF 96 -#define KWIDTH 11 //22 -#define KHEIGHT 3 - -static bool oskbOn = false; -static int cxpos = 0; -static int cypos = 0; -static int oskbMap = 0; -static uint16_t oskbBLastState = 0; - -static void lineOSKB2(int kxoff, int kyoff, char * str, int row) -{ - char c[2] = {'A',0}; - const char * cpt = str; - for (int i=0; i.,SP ", 2); - if (oskbMap == 0) { - lineOSKB(KXOFF,KYOFF, keylables_map1_0, 0); - lineOSKB(KXOFF,KYOFF, keylables_map1_1, 1); - lineOSKB(KXOFF,KYOFF, keylables_map1_2, 2); - } - else if (oskbMap == 1) { - lineOSKB(KXOFF,KYOFF, keylables_map2_0, 0); - lineOSKB(KXOFF,KYOFF, keylables_map2_1, 1); - lineOSKB(KXOFF,KYOFF, keylables_map2_2, 2); - } - else { - lineOSKB(KXOFF,KYOFF, keylables_map3_0, 0); - lineOSKB(KXOFF,KYOFF, keylables_map3_1, 1); - lineOSKB(KXOFF,KYOFF, keylables_map3_2, 2); - } -} - -void toggleOskb(bool forceoff) { - if (forceoff) oskbOn=true; - if (oskbOn) { - oskbOn = false; - tft.fillScreenNoDma(RGBVAL16(0x00,0x00,0x00)); - tft.drawTextNoDma(0,32, "Press USER2 to toggle onscreen keyboard.", RGBVAL16(0xff,0xff,0xff), RGBVAL16(0x00,0x00,0x00), true); - } else { - oskbOn = true; - tft.fillScreenNoDma(RGBVAL16(0x00,0x00,0x00)); - tft.drawTextNoDma(0,32, " Press USER2 to exit onscreen keyboard. ", RGBVAL16(0xff,0xff,0xff), RGBVAL16(0x00,0x00,0x00), true); - tft.drawTextNoDma(0,64, " (USER1 to toggle between keymaps) ", RGBVAL16(0x00,0xff,0xff), RGBVAL16(0x00,0x00,0xff), true); - tft.drawRectNoDma(KXOFF,KYOFF, 22*8, 3*16, RGBVAL16(0x00,0x00,0xFF)); - drawOskb(); - } -} - -static int handleOskb(void) -{ - int retval = 0; - - uint16_t bClick = bLastState & ~oskbBLastState; - oskbBLastState = bLastState; - /* - static const char * digits = "0123456789ABCDEF"; - char buf[5] = {0,0,0,0,0}; - int val = bClick; - buf[0] = digits[(val>>12)&0xf]; - buf[1] = digits[(val>>8)&0xf]; - buf[2] = digits[(val>>4)&0xf]; - buf[3] = digits[val&0xf]; - tft.drawTextNoDma(0,KYOFF+ 64,buf,RGBVAL16(0x00,0x00,0x00),RGBVAL16(0xFF,0xFF,0xFF),1); - */ - if (bClick & MASK_KEY_USER2) - { - toggleOskb(false); - } - if (oskbOn) - { - bool updated = true; - if (bClick & MASK_KEY_USER1) - { - oskbMap += 1; - if (oskbMap == 3) oskbMap = 0; - } - else if (bClick & MASK_JOY2_LEFT) - { - cxpos++; - if (cxpos >= KWIDTH) cxpos = 0; - } - else if (bClick & MASK_JOY2_RIGHT) - { - cxpos--; - if (cxpos < 0) cxpos = KWIDTH-1; - } - else if (bClick & MASK_JOY2_DOWN) - { - cypos++; - if (cypos >= KHEIGHT) cypos = 0; - } - else if (bClick & MASK_JOY2_UP) - { - cypos--; - if (cypos < 0) cypos = KHEIGHT-1; - } - else if (oskbBLastState & MASK_JOY2_BTN) - { - retval = cypos*KWIDTH+cxpos+1; - if (retval) { - retval--; - //if (retval & 1) retval = key_map2[retval>>1]; - //else retval = key_map1[retval>>1]; - if (oskbMap == 0) { - retval = key_map1[retval]; - } - else if (oskbMap == 1) { - retval = key_map2[retval]; - } - else { - retval = key_map3[retval]; - } - //if (retval) { toggleOskb(true); updated=false; }; - } - } - else { - updated=false; - } - if (updated) drawOskb(); - } - - return retval; -} -#endif - -/******************************** - * Input and keyboard -********************************/ -int emu_ReadAnalogJoyX(int min, int max) -{ - adc_select_input(0); - int val = adc_read(); -#if INVX - val = 4095 - val; -#endif - val = val-xRef; - val = ((val*140)/100); - if ( (val > -512) && (val < 512) ) val = 0; - val = val+2048; - return (val*(max-min))/4096; -} - -int emu_ReadAnalogJoyY(int min, int max) -{ - adc_select_input(1); - int val = adc_read(); -#if INVY - val = 4095 - val; -#endif - val = val-yRef; - val = ((val*120)/100); - if ( (val > -512) && (val < 512) ) val = 0; - //val = (val*(max-min))/4096; - val = val+2048; - //return val+(max-min)/2; - return (val*(max-min))/4096; -} - - -static uint16_t readAnalogJoystick(void) -{ - uint16_t joysval = 0; -#ifdef PIN_JOY2_A1X - int xReading = emu_ReadAnalogJoyX(0,256); - if (xReading > 128) joysval |= MASK_JOY2_LEFT; - else if (xReading < 128) joysval |= MASK_JOY2_RIGHT; - - int yReading = emu_ReadAnalogJoyY(0,256); - if (yReading < 128) joysval |= MASK_JOY2_UP; - else if (yReading > 128) joysval |= MASK_JOY2_DOWN; -#endif - // First joystick -#if INVY -#ifdef PIN_JOY2_1 - if ( !gpio_get(PIN_JOY2_1) ) joysval |= MASK_JOY2_DOWN; -#endif -#ifdef PIN_JOY2_2 - if ( !gpio_get(PIN_JOY2_2) ) joysval |= MASK_JOY2_UP; -#endif -#else -#ifdef PIN_JOY2_1 - if ( !gpio_get(PIN_JOY2_1) ) joysval |= MASK_JOY2_UP; -#endif -#ifdef PIN_JOY2_2 - if ( !gpio_get(PIN_JOY2_2) ) joysval |= MASK_JOY2_DOWN; -#endif -#endif -#if INVX -#ifdef PIN_JOY2_3 - if ( !gpio_get(PIN_JOY2_3) ) joysval |= MASK_JOY2_LEFT; -#endif -#ifdef PIN_JOY2_4 - if ( !gpio_get(PIN_JOY2_4) ) joysval |= MASK_JOY2_RIGHT; -#endif -#else -#ifdef PIN_JOY2_3 - if ( !gpio_get(PIN_JOY2_3) ) joysval |= MASK_JOY2_RIGHT; -#endif -#ifdef PIN_JOY2_4 - if ( !gpio_get(PIN_JOY2_4) ) joysval |= MASK_JOY2_LEFT; -#endif -#endif -#ifdef PIN_JOY2_BTN - joysval |= (gpio_get(PIN_JOY2_BTN) ? 0 : MASK_JOY2_BTN); -#endif - - return (joysval); -} - - -int emu_SwapJoysticks(int statusOnly) { - if (!statusOnly) { - if (joySwapped) { - joySwapped = false; - } - else { - joySwapped = true; - } - } - return(joySwapped?1:0); -} - -int emu_GetPad(void) -{ - return(bLastState/*|((joySwapped?1:0)<<7)*/); -} - -int emu_ReadKeys(void) -{ - uint16_t retval; - uint16_t j1 = readAnalogJoystick(); - uint16_t j2 = 0; - - // Second joystick -#if INVY -#ifdef PIN_JOY1_1 - if ( !gpio_get(PIN_JOY1_1) ) j2 |= MASK_JOY2_DOWN; -#endif -#ifdef PIN_JOY1_2 - if ( !gpio_get(PIN_JOY1_2) ) j2 |= MASK_JOY2_UP; -#endif -#else -#ifdef PIN_JOY1_1 - if ( !gpio_get(PIN_JOY1_1) ) j2 |= MASK_JOY2_UP; -#endif -#ifdef PIN_JOY1_2 - if ( !gpio_get(PIN_JOY1_2) ) j2 |= MASK_JOY2_DOWN; -#endif -#endif -#if INVX -#ifdef PIN_JOY1_3 - if ( !gpio_get(PIN_JOY1_3) ) j2 |= MASK_JOY2_LEFT; -#endif -#ifdef PIN_JOY1_4 - if ( !gpio_get(PIN_JOY1_4) ) j2 |= MASK_JOY2_RIGHT; -#endif -#else -#ifdef PIN_JOY1_3 - if ( !gpio_get(PIN_JOY1_3) ) j2 |= MASK_JOY2_RIGHT; -#endif -#ifdef PIN_JOY1_4 - if ( !gpio_get(PIN_JOY1_4) ) j2 |= MASK_JOY2_LEFT; -#endif -#endif -#ifdef PIN_JOY1_BTN - if ( !gpio_get(PIN_JOY1_BTN) ) j2 |= MASK_JOY2_BTN; -#endif - - - if (joySwapped) { - retval = ((j1 << 8) | j2); - } - else { - retval = ((j2 << 8) | j1); - } - - if (usbnavpad & MASK_JOY2_UP) retval |= MASK_JOY2_UP; - if (usbnavpad & MASK_JOY2_DOWN) retval |= MASK_JOY2_DOWN; - if (usbnavpad & MASK_JOY2_LEFT) retval |= MASK_JOY2_LEFT; - if (usbnavpad & MASK_JOY2_RIGHT) retval |= MASK_JOY2_RIGHT; - if (usbnavpad & MASK_JOY2_BTN) retval |= MASK_JOY2_BTN; - -#ifdef PIN_KEY_USER1 - if ( !gpio_get(PIN_KEY_USER1) ) retval |= MASK_KEY_USER1; -#endif -#ifdef PIN_KEY_USER2 - if ( !gpio_get(PIN_KEY_USER2) ) retval |= MASK_KEY_USER2; -#endif -#ifdef PIN_KEY_USER3 - if ( !gpio_get(PIN_KEY_USER3) ) retval |= MASK_KEY_USER3; -#endif -#ifdef PIN_KEY_USER4 - if ( !gpio_get(PIN_KEY_USER4) ) retval |= MASK_KEY_USER4; -#endif - -#ifdef PICOMPUTER - keymatrix_hitrow = -1; - unsigned char row; - unsigned short cols[6]={KCOLOUT1,KCOLOUT2,KCOLOUT3,KCOLOUT4,KCOLOUT5,KCOLOUT6}; - unsigned char keymatrixtmp[6]; - - for (int i=0;i<6;i++){ - gpio_set_dir(cols[i], GPIO_OUT); - gpio_put(cols[i], 0); -#ifdef SWAP_ALT_DEL - sleep_us(1); - //__asm volatile ("nop\n"); // 4-8ns -#endif - row=0; - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN4) ? 0 : 0x02); - row |= (gpio_get(KROWIN1) ? 0 : 0x04); - row |= (gpio_get(KROWIN3) ? 0 : 0x08); - row |= (gpio_get(KROWIN5) ? 0 : 0x10); - row |= (gpio_get(KROWIN6) ? 0 : 0x20); - //gpio_set_dir(cols[i], GPIO_OUT); - gpio_put(cols[i], 1); - gpio_set_dir(cols[i], GPIO_IN); - gpio_disable_pulls(cols[i]); - keymatrixtmp[i] = row; - } - -#ifdef MULTI_DEBOUNCE - for (int i=0;i<6;i++){ - gpio_set_dir(cols[i], GPIO_OUT); - gpio_put(cols[i], 0); -#ifdef SWAP_ALT_DEL - sleep_us(1); - //__asm volatile ("nop\n"); // 4-8ns -#endif - row=0; - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN4) ? 0 : 0x02); - row |= (gpio_get(KROWIN1) ? 0 : 0x04); - row |= (gpio_get(KROWIN3) ? 0 : 0x08); - row |= (gpio_get(KROWIN5) ? 0 : 0x10); - row |= (gpio_get(KROWIN6) ? 0 : 0x20); - //gpio_set_dir(cols[i], GPIO_OUT); - gpio_put(cols[i], 1); - gpio_set_dir(cols[i], GPIO_IN); - gpio_disable_pulls(cols[i]); - keymatrixtmp[i] |= row; - } - - for (int i=0;i<6;i++){ - gpio_set_dir(cols[i], GPIO_OUT); - gpio_put(cols[i], 0); -#ifdef SWAP_ALT_DEL - sleep_us(1); - //__asm volatile ("nop\n"); // 4-8ns -#endif - row=0; - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN4) ? 0 : 0x02); - row |= (gpio_get(KROWIN1) ? 0 : 0x04); - row |= (gpio_get(KROWIN3) ? 0 : 0x08); - row |= (gpio_get(KROWIN5) ? 0 : 0x10); - row |= (gpio_get(KROWIN6) ? 0 : 0x20); - //gpio_set_dir(cols[i], GPIO_OUT); - gpio_put(cols[i], 1); - gpio_set_dir(cols[i], GPIO_IN); - gpio_disable_pulls(cols[i]); - keymatrixtmp[i] |= row; - } -#endif - -#ifdef SWAP_ALT_DEL - // Swap ALT and DEL - unsigned char alt = keymatrixtmp[0] & 0x02; - unsigned char del = keymatrixtmp[5] & 0x20; - keymatrixtmp[0] &= ~0x02; - keymatrixtmp[5] &= ~0x20; - if (alt) keymatrixtmp[5] |= 0x20; - if (del) keymatrixtmp[0] |= 0x02; -#endif - - bool alt_pressed=false; - if ( keymatrixtmp[5] & 0x20 ) {alt_pressed=true; keymatrixtmp[5] &= ~0x20;}; - - for (int i=0;i<6;i++){ - row = keymatrixtmp[i]; - if (row) keymatrix_hitrow=i; - keymatrix[i] = row; - } - - //6,9,15,8,7,22 -#if INVX - if ( row & 0x2 ) retval |= MASK_JOY2_LEFT; - if ( row & 0x1 ) retval |= MASK_JOY2_RIGHT; -#else - if ( row & 0x1 ) retval |= MASK_JOY2_LEFT; - if ( row & 0x2 ) retval |= MASK_JOY2_RIGHT; -#endif -#if INVY - if ( row & 0x8 ) retval |= MASK_JOY2_DOWN; - if ( row & 0x4 ) retval |= MASK_JOY2_UP; -#else - if ( row & 0x4 ) retval |= MASK_JOY2_DOWN; - if ( row & 0x8 ) retval |= MASK_JOY2_UP; -#endif - if ( row & 0x10 ) retval |= MASK_JOY2_BTN; - - // Handle LED flash - uint32_t time_ms=to_ms_since_boot (get_absolute_time()); - if ((time_ms-last_t_ms) > 100) { - last_t_ms = time_ms; - if (ledflash_toggle == false) { - ledflash_toggle = true; - } - else { - ledflash_toggle = false; - } - } - - if ( alt_pressed ) { - if (key_fn == false) - { - // Release to Press transition - if (hundred_ms_cnt == 0) { - keypress_t_ms=time_ms; - hundred_ms_cnt += 1; // 1 - } - else { - hundred_ms_cnt += 1; // 2 - if (hundred_ms_cnt >= 2) - { - hundred_ms_cnt = 0; - /* - if ( (time_ms-keypress_t_ms) < 500) - { - if (key_alt == false) - { - key_alt = true; - } - else - { - key_alt = false; - } - } - */ - } - } - } - else { - // Keep press - if (hundred_ms_cnt == 1) { - if ((to_ms_since_boot (get_absolute_time())-keypress_t_ms) > 2000) - { - if (key_alt == false) - { - key_alt = true; - } - else - { - key_alt = false; - } - hundred_ms_cnt = 0; - } - } - } - key_fn = true; - } - else { - key_fn = false; - } - - // Handle LED - if (key_alt == true) { - gpio_put(KLED, (ledflash_toggle?1:0)); - } - else { - if (key_fn == true) { - gpio_put(KLED, 1); - } - else { - gpio_put(KLED, 0); - } - } - - if ( key_fn ) retval |= MASK_KEY_USER2; - if ( ( key_fn ) && (keymatrix[0] == 0x02 )) retval |= MASK_KEY_USER1; -#endif - - //Serial.println(retval,HEX); - - if ( ((retval & (MASK_KEY_USER1+MASK_KEY_USER2)) == (MASK_KEY_USER1+MASK_KEY_USER2)) - || (retval & MASK_KEY_USER4 ) ) - { - } - -#if (defined(ILI9341) || defined(ST7789)) && defined(USE_VGA) - if (oskbOn) { - retval |= MASK_OSKB; - } -#endif - - return (retval); -} - -unsigned short emu_DebounceLocalKeys(void) -{ - uint16_t bCurState = emu_ReadKeys(); - uint16_t bClick = bCurState & ~bLastState; - bLastState = bCurState; - - return (bClick); -} - -int emu_ReadI2CKeyboard(void) { - int retval=0; -#ifdef PICOMPUTER - if (key_alt) { - keys = (const unsigned short *)key_map3; - } - else if (key_fn) { - keys = (const unsigned short *)key_map2; - } - else { - keys = (const unsigned short *)key_map1; - } - if (keymatrix_hitrow >=0 ) { - unsigned short match = ((unsigned short)keymatrix_hitrow<<8) | keymatrix[keymatrix_hitrow]; - for (int i=0; i=0) { - menuRedraw=true; - curFile -= 9; - } else if (curFile!=0) { - menuRedraw=true; - curFile--; - } - } - else if ( (bClick & MASK_JOY2_DOWN) || (bClick & MASK_JOY1_DOWN) ) { - if ((curFile<(nbFiles-1)) && (nbFiles)) { - curFile++; - menuRedraw=true; - } - } - else if ( (bClick & MASK_JOY2_LEFT) || (bClick & MASK_JOY1_LEFT) ) { - if ((curFile<(nbFiles-9)) && (nbFiles)) { - curFile += 9; - menuRedraw=true; - } - else if ((curFile<(nbFiles-1)) && (nbFiles)) { - curFile++; - menuRedraw=true; - } - } - else if ( (bClick & MASK_KEY_USER2) ) { - emu_SwapJoysticks(0); - menuRedraw=true; - } - - if (menuRedraw && nbFiles) { - int fileIndex = 0; - tft.drawRectNoDma(MENU_FILE_XOFFSET,MENU_FILE_YOFFSET, MENU_FILE_W, MENU_FILE_H, MENU_FILE_BGCOLOR); -// if (curFile <= (MAX_MENULINES/2-1)) topFile=0; -// else topFile=curFile-(MAX_MENULINES/2); - if (curFile <= (MAX_MENULINES-1)) topFile=0; - else topFile=curFile-(MAX_MENULINES/2); - - //Serial.print("curfile: "); - //Serial.println(curFile); - //Serial.print("topFile: "); - //Serial.println(topFile); - - int i=0; - while (i=nbFiles) { - // no more files - break; - } - char * filename = &files[fileIndex][0]; - if (fileIndex >= topFile) { - if ((i+topFile) < nbFiles ) { - if ((i+topFile)==curFile) { - tft.drawTextNoDma(MENU_FILE_XOFFSET,i*TEXT_HEIGHT+MENU_FILE_YOFFSET, filename, RGBVAL16(0xff,0xff,0x00), RGBVAL16(0xff,0x00,0x00), true); - strcpy(selection,filename); - } - else { - tft.drawTextNoDma(MENU_FILE_XOFFSET,i*TEXT_HEIGHT+MENU_FILE_YOFFSET, filename, RGBVAL16(0xff,0xff,0xff), MENU_FILE_BGCOLOR, true); - } - } - i++; - } - fileIndex++; - } - - - tft.drawTextNoDma(48,MENU_JOYS_YOFFSET+8, (emu_SwapJoysticks(1)?(char*)"SWAP=1":(char*)"SWAP=0"), RGBVAL16(0x00,0xff,0xff), RGBVAL16(0x00,0x00,0xff), false); - menuRedraw=false; - } - - return (action); -} - -bool menuActive(void) -{ - return (menuOn); -} - -void toggleMenu(bool on) { - if (on) { - menuOn = true; - backgroundMenu(); - } else { - menuOn = false; - } -} - -char * menuSelection(void) -{ - return (selection); -} - - -/******************************** - * File IO -********************************/ -int emu_FileOpen(char * filename) -{ - int retval = 0; - - char filepath[80]; - strcpy(filepath, romspath); - strcat(filepath, "/"); - strcat(filepath, filename); - emu_printf("FileOpen..."); - emu_printf(filepath); - if( !(f_open(&file, filepath, FA_READ)) ) { - retval = 1; - } - else { - emu_printf("FileOpen failed"); - } - return (retval); -} - -int emu_FileRead(char * buf, int size) -{ - unsigned char buffer[256]; - int remaining = size; - int byteread = 0; - unsigned int retval=0; - if (size < 256) { - if( !(f_read (&file, buffer, size, &retval)) ) - if (retval>0) { - memcpy(buf,buffer,retval); - byteread += retval; - } - } - else { - while (remaining>0) { - if( !(f_read (&file, buffer, 256, &retval)) ) - //f_read (&file, buffer, 256, &retval); - if (retval>0) { - //emu_printi(retval); - memcpy(buf,buffer,retval); - buf += retval; - byteread += retval; - remaining -= retval; - } - else { - break; - } - } - } - return byteread; -} - -unsigned char emu_FileGetc(void) { - unsigned char c; - unsigned int retval=0; - if( !(f_read (&file, &c, 1, &retval)) ) - if (retval != 1) { - emu_printf("emu_FileGetc failed"); - } - return c; -} - -void emu_FileClose(void) -{ - f_close(&file); -} - -int emu_FileSize(char * filename) -{ - int filesize=0; - char filepath[80]; - strcpy(filepath, romspath); - strcat(filepath, "/"); - strcat(filepath, filename); - emu_printf("FileSize..."); - emu_printf(filepath); - FILINFO entry; - f_stat(filepath, &entry); - filesize = entry.fsize; - return(filesize); -} - -int emu_FileSeek(int seek) -{ - f_lseek(&file, seek); - return (seek); -} - -int emu_FileTell(void) -{ - return (f_tell(&file)); -} - -int emu_LoadFile(char * filename, char * buf, int size) -{ - int filesize = 0; - - char filepath[80]; - strcpy(filepath, romspath); - strcat(filepath, "/"); - strcat(filepath, filename); - emu_printf("LoadFile..."); - emu_printf(filepath); - if( !(f_open(&file, filepath, FA_READ)) ) { - filesize = f_size(&file); - emu_printf(filesize); - if (size >= filesize) - { - unsigned int retval=0; - if( (f_read (&file, buf, filesize, &retval)) ) { - emu_printf("File read failed"); - } - } - f_close(&file); - } - - return(filesize); -} - - - - -/******************************** - * Initialization -********************************/ -void emu_init(void) -{ - // Dual display config, initialize TFT -#if (defined(ILI9341) || defined(ST7789)) && defined(USE_VGA) - tft.begin(); -#endif - - sd_init_driver(); - FRESULT fr = f_mount(&fatfs, "0:", 1); - - strcpy(romspath,ROMSDIR); - nbFiles = readNbFiles(romspath); - - emu_printf("SD initialized, files found: "); - emu_printi(nbFiles); - - emu_InitJoysticks(); -#ifdef SWAP_JOYSTICK - joySwapped = true; -#else - joySwapped = false; -#endif - -#ifdef PICOMPUTER - // Flip screen if UP pressed - if (emu_ReadKeys() & MASK_JOY2_UP) - { -#ifdef PICOMPUTERMAX -#ifndef USE_VGA - tft.flipscreen(true); -#endif -#else - tft.flipscreen(true); -#endif - } - else - { -#ifdef PICOMPUTERMAX -#ifndef USE_VGA - tft.flipscreen(false); -#endif -#else - tft.flipscreen(false); -#endif - } -#endif - - toggleMenu(true); -} - - -void emu_start(void) -{ - usbnavpad = 0; - - keyMap = 0; -} diff --git a/MCUME_pico/picosnd/emuapi.h b/MCUME_pico/picosnd/emuapi.h deleted file mode 100644 index d09fcdb..0000000 --- a/MCUME_pico/picosnd/emuapi.h +++ /dev/null @@ -1,137 +0,0 @@ -#ifndef EMUAPI_H -#define EMUAPI_H - -#include "platform_config.h" - -#define CUSTOM_SND 1 -//#define TIMER_REND 1 - -#define EXTRA_HEAP 0x10 - -// Title: < > -#define TITLE " SND Emulator " -#define ROMSDIR "snd" - -#define emu_Init(ROM) {snd_Start(ROM); snd_Init(); } -#define emu_Step(x) { snd_Step(); } -#define emu_Input(x) { snd_Input(x); } - -#define PALETTE_SIZE 256 -#define VID_FRAME_SKIP 0x0 -#define TFT_VBUFFER_YCROP 0 -#define SINGLELINE_RENDERING 1 - -#define ACTION_NONE 0 -#define ACTION_MAXKBDVAL 12 -#define ACTION_EXITKBD 128 -#define ACTION_RUNTFT 129 -#define ACTION_RUNVGA 130 - -#ifdef KEYMAP_PRESENT -#ifdef PICOMPUTER - -const unsigned short key_map1[] = { - 1,2,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0, - 0, 0,0,0,0,0,0,0,0,0, - 0,0,0,0 - }; - -const unsigned short key_map2[] = { - 0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0, - 0, 0,0,0,0,0,0,0,0,0, - 0,0,0,0 - }; - -const unsigned short key_map3[] = { - 0,0,0,0,0,0,0,0,0,0,0, // function keys - 0, 0,0,0,0,0,0,0,0,0,0, - 0, 0,0,0,0,0,0,0,0,0, - 0,0,0,0 - }; - -const unsigned short matkeys[] = { - 0x020,0x120,0x220,0x320,0x420,0x408,0x308,0x208,0x108,0x008,0x002, // row 1 - 0x510,0x010,0x110,0x210,0x310,0x410,0x401,0x301,0x201,0x101,0x001, // row 2 - 0x520,0x102,0x202,0x302,0x402,0x404,0x304,0x204,0x104,0x004, // row 3 - 0x508,0x501,0x502,0x504 }; // cursor keys - -#endif -#endif - - -#define MASK_JOY2_RIGHT 0x0001 -#define MASK_JOY2_LEFT 0x0002 -#define MASK_JOY2_UP 0x0004 -#define MASK_JOY2_DOWN 0x0008 -#define MASK_JOY2_BTN 0x0010 -#define MASK_KEY_USER1 0x0020 -#define MASK_KEY_USER2 0x0040 -#define MASK_KEY_USER3 0x0080 -#define MASK_JOY1_RIGHT 0x0100 -#define MASK_JOY1_LEFT 0x0200 -#define MASK_JOY1_UP 0x0400 -#define MASK_JOY1_DOWN 0x0800 -#define MASK_JOY1_BTN 0x1000 -#define MASK_KEY_USER4 0x2000 - - - -extern void emu_init(void); -extern void emu_start(void); -extern void emu_resetSD(void); - -extern void emu_printf(char * text); -extern void emu_printi(int val); -extern void * emu_Malloc(int size); -extern void emu_Free(void * pt); - - -extern int emu_FileOpen(char * filename); -extern int emu_FileRead(char * buf, int size); -extern unsigned char emu_FileGetc(void); -extern int emu_FileSeek(int seek); -extern void emu_FileClose(void); -extern int emu_FileSize(char * filename); -extern int emu_LoadFile(char * filename, char * buf, int size); -extern int emu_LoadFileSeek(char * filename, char * buf, int size, int seek); -extern void emu_FileTempInit(void); -extern void emu_FileTempRead(int addr, unsigned char * val, int n); -extern void emu_FileTempWrite(int addr, unsigned char val); - -extern void emu_SetPaletteEntry(unsigned char r, unsigned char g, unsigned char b, int index); -extern void emu_DrawScreen(unsigned char * VBuf, int width, int height, int stride); -extern void emu_DrawLine(unsigned char * VBuf, int width, int height, int line); -extern void emu_DrawLine8(unsigned char * VBuf, int width, int height, int line); -extern void emu_DrawLine16(unsigned short * VBuf, int width, int height, int line); -extern void emu_DrawVsync(void); -extern int emu_FrameSkip(void); -extern void * emu_LineBuffer(int line); - -extern void emu_InitJoysticks(void); -extern int emu_SwapJoysticks(int statusOnly); -extern unsigned short emu_DebounceLocalKeys(void); -extern int emu_ReadKeys(void); -extern int emu_GetPad(void); -extern int emu_ReadAnalogJoyX(int min, int max); -extern int emu_ReadAnalogJoyY(int min, int max); -extern int emu_ReadI2CKeyboard(void); -extern void emu_KeyboardOnUp(int keymodifer, int key); -extern void emu_KeyboardOnDown(int keymodifer, int key); - -extern void emu_sndPlaySound(int chan, int volume, int freq); -extern void emu_sndPlayBuzz(int size, int val); -extern void emu_sndInit(); -extern void emu_resetus(void); -extern int emu_us(void); - -extern int emu_setKeymap(int index); - -extern void emu_FileTempInit(void); -extern void emu_FileTempRead(int addr, unsigned char * val, int n); -extern void emu_FileTempWrite(int addr, unsigned char val); -extern void emu_printh(int val); - - -#endif diff --git a/MCUME_pico/picosnd/font8x8.h b/MCUME_pico/picosnd/font8x8.h deleted file mode 100644 index 4f773da..0000000 --- a/MCUME_pico/picosnd/font8x8.h +++ /dev/null @@ -1,135 +0,0 @@ - -// Font: c64_lower.64c - -const unsigned char font8x8[128][8] PROGMEM = -{ - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0000 (nul) - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0001 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0002 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0003 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0004 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0005 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0006 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0007 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0008 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0009 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000A - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000B - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000C - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000D - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000E - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000F - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0010 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0011 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0012 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0013 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0014 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0015 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0016 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0017 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0018 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0019 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001A - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001B - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001C - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001D - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001E - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001F - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0020 (space) - { 0x18, 0x3C, 0x3C, 0x18, 0x18, 0x00, 0x18, 0x00}, // U+0021 (!) - { 0x36, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0022 (") - { 0x36, 0x36, 0x7F, 0x36, 0x7F, 0x36, 0x36, 0x00}, // U+0023 (#) - { 0x0C, 0x3E, 0x03, 0x1E, 0x30, 0x1F, 0x0C, 0x00}, // U+0024 ($) - { 0x00, 0x63, 0x33, 0x18, 0x0C, 0x66, 0x63, 0x00}, // U+0025 (%) - { 0x1C, 0x36, 0x1C, 0x6E, 0x3B, 0x33, 0x6E, 0x00}, // U+0026 (&) - { 0x06, 0x06, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0027 (') - { 0x18, 0x0C, 0x06, 0x06, 0x06, 0x0C, 0x18, 0x00}, // U+0028 (() - { 0x06, 0x0C, 0x18, 0x18, 0x18, 0x0C, 0x06, 0x00}, // U+0029 ()) - { 0x00, 0x66, 0x3C, 0xFF, 0x3C, 0x66, 0x00, 0x00}, // U+002A (*) - { 0x00, 0x0C, 0x0C, 0x3F, 0x0C, 0x0C, 0x00, 0x00}, // U+002B (+) - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x0C, 0x06}, // U+002C (,) - { 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x00}, // U+002D (-) - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x0C, 0x00}, // U+002E (.) - { 0x60, 0x30, 0x18, 0x0C, 0x06, 0x03, 0x01, 0x00}, // U+002F (/) - { 0x3E, 0x63, 0x73, 0x7B, 0x6F, 0x67, 0x3E, 0x00}, // U+0030 (0) - { 0x0C, 0x0E, 0x0C, 0x0C, 0x0C, 0x0C, 0x3F, 0x00}, // U+0031 (1) - { 0x1E, 0x33, 0x30, 0x1C, 0x06, 0x33, 0x3F, 0x00}, // U+0032 (2) - { 0x1E, 0x33, 0x30, 0x1C, 0x30, 0x33, 0x1E, 0x00}, // U+0033 (3) - { 0x38, 0x3C, 0x36, 0x33, 0x7F, 0x30, 0x78, 0x00}, // U+0034 (4) - { 0x3F, 0x03, 0x1F, 0x30, 0x30, 0x33, 0x1E, 0x00}, // U+0035 (5) - { 0x1C, 0x06, 0x03, 0x1F, 0x33, 0x33, 0x1E, 0x00}, // U+0036 (6) - { 0x3F, 0x33, 0x30, 0x18, 0x0C, 0x0C, 0x0C, 0x00}, // U+0037 (7) - { 0x1E, 0x33, 0x33, 0x1E, 0x33, 0x33, 0x1E, 0x00}, // U+0038 (8) - { 0x1E, 0x33, 0x33, 0x3E, 0x30, 0x18, 0x0E, 0x00}, // U+0039 (9) - { 0x00, 0x0C, 0x0C, 0x00, 0x00, 0x0C, 0x0C, 0x00}, // U+003A (:) - { 0x00, 0x0C, 0x0C, 0x00, 0x00, 0x0C, 0x0C, 0x06}, // U+003B (//) - { 0x18, 0x0C, 0x06, 0x03, 0x06, 0x0C, 0x18, 0x00}, // U+003C (<) - { 0x00, 0x00, 0x3F, 0x00, 0x00, 0x3F, 0x00, 0x00}, // U+003D (=) - { 0x06, 0x0C, 0x18, 0x30, 0x18, 0x0C, 0x06, 0x00}, // U+003E (>) - { 0x1E, 0x33, 0x30, 0x18, 0x0C, 0x00, 0x0C, 0x00}, // U+003F (?) - { 0x3E, 0x63, 0x7B, 0x7B, 0x7B, 0x03, 0x1E, 0x00}, // U+0040 (@) - { 0x0C, 0x1E, 0x33, 0x33, 0x3F, 0x33, 0x33, 0x00}, // U+0041 (A) - { 0x3F, 0x66, 0x66, 0x3E, 0x66, 0x66, 0x3F, 0x00}, // U+0042 (B) - { 0x3C, 0x66, 0x03, 0x03, 0x03, 0x66, 0x3C, 0x00}, // U+0043 (C) - { 0x1F, 0x36, 0x66, 0x66, 0x66, 0x36, 0x1F, 0x00}, // U+0044 (D) - { 0x7F, 0x46, 0x16, 0x1E, 0x16, 0x46, 0x7F, 0x00}, // U+0045 (E) - { 0x7F, 0x46, 0x16, 0x1E, 0x16, 0x06, 0x0F, 0x00}, // U+0046 (F) - { 0x3C, 0x66, 0x03, 0x03, 0x73, 0x66, 0x7C, 0x00}, // U+0047 (G) - { 0x33, 0x33, 0x33, 0x3F, 0x33, 0x33, 0x33, 0x00}, // U+0048 (H) - { 0x1E, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+0049 (I) - { 0x78, 0x30, 0x30, 0x30, 0x33, 0x33, 0x1E, 0x00}, // U+004A (J) - { 0x67, 0x66, 0x36, 0x1E, 0x36, 0x66, 0x67, 0x00}, // U+004B (K) - { 0x0F, 0x06, 0x06, 0x06, 0x46, 0x66, 0x7F, 0x00}, // U+004C (L) - { 0x63, 0x77, 0x7F, 0x7F, 0x6B, 0x63, 0x63, 0x00}, // U+004D (M) - { 0x63, 0x67, 0x6F, 0x7B, 0x73, 0x63, 0x63, 0x00}, // U+004E (N) - { 0x1C, 0x36, 0x63, 0x63, 0x63, 0x36, 0x1C, 0x00}, // U+004F (O) - { 0x3F, 0x66, 0x66, 0x3E, 0x06, 0x06, 0x0F, 0x00}, // U+0050 (P) - { 0x1E, 0x33, 0x33, 0x33, 0x3B, 0x1E, 0x38, 0x00}, // U+0051 (Q) - { 0x3F, 0x66, 0x66, 0x3E, 0x36, 0x66, 0x67, 0x00}, // U+0052 (R) - { 0x1E, 0x33, 0x07, 0x0E, 0x38, 0x33, 0x1E, 0x00}, // U+0053 (S) - { 0x3F, 0x2D, 0x0C, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+0054 (T) - { 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x3F, 0x00}, // U+0055 (U) - { 0x33, 0x33, 0x33, 0x33, 0x33, 0x1E, 0x0C, 0x00}, // U+0056 (V) - { 0x63, 0x63, 0x63, 0x6B, 0x7F, 0x77, 0x63, 0x00}, // U+0057 (W) - { 0x63, 0x63, 0x36, 0x1C, 0x1C, 0x36, 0x63, 0x00}, // U+0058 (X) - { 0x33, 0x33, 0x33, 0x1E, 0x0C, 0x0C, 0x1E, 0x00}, // U+0059 (Y) - { 0x7F, 0x63, 0x31, 0x18, 0x4C, 0x66, 0x7F, 0x00}, // U+005A (Z) - { 0x1E, 0x06, 0x06, 0x06, 0x06, 0x06, 0x1E, 0x00}, // U+005B ([) - { 0x03, 0x06, 0x0C, 0x18, 0x30, 0x60, 0x40, 0x00}, // U+005C (\) - { 0x1E, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1E, 0x00}, // U+005D (]) - { 0x08, 0x1C, 0x36, 0x63, 0x00, 0x00, 0x00, 0x00}, // U+005E (^) - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF}, // U+005F (_) - { 0x0C, 0x0C, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0060 (`) - { 0x00, 0x00, 0x1E, 0x30, 0x3E, 0x33, 0x6E, 0x00}, // U+0061 (a) - { 0x07, 0x06, 0x06, 0x3E, 0x66, 0x66, 0x3B, 0x00}, // U+0062 (b) - { 0x00, 0x00, 0x1E, 0x33, 0x03, 0x33, 0x1E, 0x00}, // U+0063 (c) - { 0x38, 0x30, 0x30, 0x3e, 0x33, 0x33, 0x6E, 0x00}, // U+0064 (d) - { 0x00, 0x00, 0x1E, 0x33, 0x3f, 0x03, 0x1E, 0x00}, // U+0065 (e) - { 0x1C, 0x36, 0x06, 0x0f, 0x06, 0x06, 0x0F, 0x00}, // U+0066 (f) - { 0x00, 0x00, 0x6E, 0x33, 0x33, 0x3E, 0x30, 0x1F}, // U+0067 (g) - { 0x07, 0x06, 0x36, 0x6E, 0x66, 0x66, 0x67, 0x00}, // U+0068 (h) - { 0x0C, 0x00, 0x0E, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+0069 (i) - { 0x30, 0x00, 0x30, 0x30, 0x30, 0x33, 0x33, 0x1E}, // U+006A (j) - { 0x07, 0x06, 0x66, 0x36, 0x1E, 0x36, 0x67, 0x00}, // U+006B (k) - { 0x0E, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+006C (l) - { 0x00, 0x00, 0x33, 0x7F, 0x7F, 0x6B, 0x63, 0x00}, // U+006D (m) - { 0x00, 0x00, 0x1F, 0x33, 0x33, 0x33, 0x33, 0x00}, // U+006E (n) - { 0x00, 0x00, 0x1E, 0x33, 0x33, 0x33, 0x1E, 0x00}, // U+006F (o) - { 0x00, 0x00, 0x3B, 0x66, 0x66, 0x3E, 0x06, 0x0F}, // U+0070 (p) - { 0x00, 0x00, 0x6E, 0x33, 0x33, 0x3E, 0x30, 0x78}, // U+0071 (q) - { 0x00, 0x00, 0x3B, 0x6E, 0x66, 0x06, 0x0F, 0x00}, // U+0072 (r) - { 0x00, 0x00, 0x3E, 0x03, 0x1E, 0x30, 0x1F, 0x00}, // U+0073 (s) - { 0x08, 0x0C, 0x3E, 0x0C, 0x0C, 0x2C, 0x18, 0x00}, // U+0074 (t) - { 0x00, 0x00, 0x33, 0x33, 0x33, 0x33, 0x6E, 0x00}, // U+0075 (u) - { 0x00, 0x00, 0x33, 0x33, 0x33, 0x1E, 0x0C, 0x00}, // U+0076 (v) - { 0x00, 0x00, 0x63, 0x6B, 0x7F, 0x7F, 0x36, 0x00}, // U+0077 (w) - { 0x00, 0x00, 0x63, 0x36, 0x1C, 0x36, 0x63, 0x00}, // U+0078 (x) - { 0x00, 0x00, 0x33, 0x33, 0x33, 0x3E, 0x30, 0x1F}, // U+0079 (y) - { 0x00, 0x00, 0x3F, 0x19, 0x0C, 0x26, 0x3F, 0x00}, // U+007A (z) - { 0x38, 0x0C, 0x0C, 0x07, 0x0C, 0x0C, 0x38, 0x00}, // U+007B ({) - { 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x00}, // U+007C (|) - { 0x07, 0x0C, 0x0C, 0x38, 0x0C, 0x0C, 0x07, 0x00}, // U+007D (}) - { 0x6E, 0x3B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+007E (~) - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} // U+007F -}; - diff --git a/MCUME_pico/picosnd/keyboard_osd.h b/MCUME_pico/picosnd/keyboard_osd.h deleted file mode 100644 index 062eb4e..0000000 --- a/MCUME_pico/picosnd/keyboard_osd.h +++ /dev/null @@ -1,20 +0,0 @@ - -#ifndef keyboard_osd_h_ -#define keyboard_osd_h_ - -extern bool virtualkeyboardIsActive(void); -extern void drawVirtualkeyboard(void); -extern void toggleVirtualkeyboard(bool keepOn); -extern void handleVirtualkeyboard(void); - -extern bool callibrationActive(void); -extern int handleCallibration(uint16_t bClick); - -extern bool menuActive(void); -extern char * menuSelection(void); -extern void toggleMenu(bool on); -extern int handleMenu(uint16_t bClick); - - -#endif - diff --git a/MCUME_pico/picosnd/picosnd.cpp b/MCUME_pico/picosnd/picosnd.cpp deleted file mode 100644 index ca7ff8b..0000000 --- a/MCUME_pico/picosnd/picosnd.cpp +++ /dev/null @@ -1,158 +0,0 @@ -#include "pico.h" -#include "pico/stdlib.h" - -extern "C" { - #include "iopins.h" - #include "emuapi.h" -} -#include "keyboard_osd.h" - -#ifdef USE_VGA -#include "vga_t_dma.h" -#else -#include "tft_t_dma.h" -#endif -TFT_T_DMA tft; - -#include "sndplay.h" - -#include - - -static int skip=0; - -bool repeating_timer_callback(struct repeating_timer *t) { - uint16_t bClick = emu_DebounceLocalKeys(); - emu_Input(bClick); - return true; -} - -int main(void) { - stdio_init_all(); -//set_sys_clock_48mhz(); -//set_sys_clock_khz(133000, true); -//set_sys_clock_khz(48000, true); -//set_sys_clock_khz(270000, true); -#ifdef USE_VGA - tft.begin(VGA_MODE_320x240); -#else - tft.begin(); -#endif - emu_init(); - while (true) { - if (menuActive()) { - uint16_t bClick = emu_DebounceLocalKeys(); - int action = handleMenu(bClick); - char * filename = menuSelection(); - if (action == ACTION_RUNTFT) { - toggleMenu(false); - emu_start(); - emu_Init(filename); - tft.fillScreenNoDma( RGBVAL16(0x00,0x00,0x00) ); - tft.startDMA(); - //struct repeating_timer timer; - //add_repeating_timer_ms(50, repeating_timer_callback, NULL, &timer); - } - tft.waitSync(); - } - else { - uint16_t bClick = emu_DebounceLocalKeys(); - emu_Input(bClick); - emu_Step(); - } - //int c = getchar_timeout_us(0); - //switch (c) { - // case ' ': - // printf("test: %d\n", 1); - // break; - //} - } -} - -static unsigned char palette8[PALETTE_SIZE]; - -void emu_SetPaletteEntry(unsigned char r, unsigned char g, unsigned char b, int index) -{ - if (index. - - Diese Bibliothek ist freie Software: Sie können es unter den Bedingungen - der GNU General Public License, wie von der Free Software Foundation, - Version 3 der Lizenz oder (nach Ihrer Wahl) jeder neueren - veröffentlichten Version, weiterverbreiten und/oder modifizieren. - Diese Bibliothek wird in der Hoffnung, dass es nützlich sein wird, aber - OHNE JEDE GEWÄHRLEISTUNG, bereitgestellt; sogar ohne die implizite - Gewährleistung der MARKTFÄHIGKEIT oder EIGNUNG FÜR EINEN BESTIMMTEN ZWECK. - Siehe die GNU General Public License für weitere Details. - Sie sollten eine Kopie der GNU General Public License zusammen mit diesem - Programm erhalten haben. Wenn nicht, siehe . - - */ -#include "reSID.h" -#include - -#define AUDIO_BLOCK_SAMPLES 443 -#define SAMPLERATE 22050 -#define CLOCKFREQ 985248 - -void AudioPlaySID::begin(void) -{ - sidptr = &sid; - this->reset(); - setSampleParameters(CLOCKFREQ, SAMPLERATE); - playing = true; -} - -void AudioPlaySID::setSampleParameters(float clockfreq, float samplerate) { - sid.set_sampling_parameters(clockfreq, SAMPLE_FAST, samplerate); - csdelta = round((float)clockfreq / ((float)samplerate / AUDIO_BLOCK_SAMPLES)); -} - -void AudioPlaySID::reset(void) -{ - sid.reset(); -} - -void AudioPlaySID::stop(void) -{ - playing = false; -} - -void AudioPlaySID::update(void * stream, int len) { - // only update if we're playing - if (!playing) return; - - cycle_count delta_t = csdelta; - - sidptr->clock(delta_t, (short int*)stream, len); -} diff --git a/MCUME_pico/picosnd/reSID.h b/MCUME_pico/picosnd/reSID.h deleted file mode 100644 index db7021e..0000000 --- a/MCUME_pico/picosnd/reSID.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - Arduino SID - Copyright (c) 2015 Frank Bösing - This library is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with this library. If not, see . - - Diese Bibliothek ist freie Software: Sie können es unter den Bedingungen - der GNU General Public License, wie von der Free Software Foundation, - Version 3 der Lizenz oder (nach Ihrer Wahl) jeder neueren - veröffentlichten Version, weiterverbreiten und/oder modifizieren. - Diese Bibliothek wird in der Hoffnung, dass es nützlich sein wird, aber - OHNE JEDE GEWÄHRLEISTUNG, bereitgestellt; sogar ohne die implizite - Gewährleistung der MARKTFÄHIGKEIT oder EIGNUNG FÜR EINEN BESTIMMTEN ZWECK. - Siehe die GNU General Public License für weitere Details. - Sie sollten eine Kopie der GNU General Public License zusammen mit diesem - Programm erhalten haben. Wenn nicht, siehe . - - */ -#include "reSID/sid.h" -#include - -#ifndef play_sid_h_ -#define play_sid_h_ - - -class AudioPlaySID -{ -public: - AudioPlaySID(void) { begin(); } - void begin(void); - void setSampleParameters(float clockfreq, float samplerate); - inline void setreg(int ofs, int val) { sid.write(ofs, val); } - inline uint8_t getreg(int ofs) { return sid.read(ofs); } - void reset(void); - void stop(void); - void update(void * stream, int len); - inline bool isPlaying(void) { return playing; } -private: - cycle_count csdelta; - volatile bool playing; - SID sid; - SID* sidptr; -}; - - -#endif diff --git a/MCUME_pico/picosnd/reSID/AUTHORS b/MCUME_pico/picosnd/reSID/AUTHORS deleted file mode 100755 index d22e33d..0000000 --- a/MCUME_pico/picosnd/reSID/AUTHORS +++ /dev/null @@ -1,3 +0,0 @@ -Authors of reSID. - -Dag Lem: Designed and programmed complete emulation engine. diff --git a/MCUME_pico/picosnd/reSID/COPYING b/MCUME_pico/picosnd/reSID/COPYING deleted file mode 100755 index d60c31a..0000000 --- a/MCUME_pico/picosnd/reSID/COPYING +++ /dev/null @@ -1,340 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. diff --git a/MCUME_pico/picosnd/reSID/ChangeLog b/MCUME_pico/picosnd/reSID/ChangeLog deleted file mode 100755 index 1c7aa47..0000000 --- a/MCUME_pico/picosnd/reSID/ChangeLog +++ /dev/null @@ -1,313 +0,0 @@ -2004-06-11 Dag Lem - - * Version 0.16 released. - - * envelope.h (EnvelopeGenerator::clock): Corrected off-by-one - error in check for ADSR delay bug in delta_t cycle interface. - - * filter.cc (Filter::set_chip_model): Initialize filter cutoff - mappings before call to set_chip_model. - - * sid.cc (SID::set_sampling_parameters): Build shifted FIR tables - with samples according to the sampling frequency. - (SID::clock_resample_interpolate): New function; factorized linear - interpolation out from filter convolutions, and made convolutions - vectorizable. - (SID::clock_resample_fast): New function; single convolution, same - accuracy as with interpolation by using more filter tables. - (SID::State, SID::read_state, SID::write_state): Read and write - rate_counter_period and exponential_counter_period. Read sustain - value. - -2003-10-20 Dag Lem - - * Version 0.15 released. - - * envelope.h (EnvelopeGenerator): Added public State enum. - (EnvelopeGenerator::clock): Rate counter is 15 bits, count - rate_period - 1 after wrapping from 0x8000 to 0 in ADSR delay bug. - - * sid.cc, sid.h (SID::State): Added envelope_state. - (SID::State::write_state): Restore register 0x18. - (SID::set_sampling_parameters): Scale resampling filter to avoid - clipping. - (SID::clock_resample): Saturated arithmetics to avoid clipping. - -2002-12-31 Dag Lem - - * Version 0.14 released. - - * envelope.h (EnvelopeGenerator::clock): Corrected one cycle error - in ADSR delay bug. Only load the exponential counter period at the - envelope counter values 255, 93, 54, 26, 14, 6, 0. - - * filter.cc (Filter::set_chip_model): Call set_w0() and set_Q() to - update filter settings. - (Filter::set_w0): Limit cutoff frequency for both 1 cycle and - delta_t cycle filter. - - * filter.h (Filter::clock): Mix in external audio input. - - * sid.cc, sid.h (SID::input): New function; accepts external audio - input sample. - - * spline.h (PointPlotter::operator ()): Clamp negative values to - zero. - - * voice.cc, voice.h: Changed misleading name wave_DC to wave_zero. - - * wave.h (WaveformGenerator::clock): Corrected bug in check for - accumulator bit 19 in noise register shift. - -2002-01-19 Dag Lem - - * Version 0.13 released. - - * configure.in: Replaced AC_TRY_COMPILER with AC_TRY_COMPILE, - removed AC_PROG_RANLIB. - - * envelope.h (EnvelopeGenerator::clock): Reset rate_step on state - change. - - * extfilt.cc (ExternalFilter::set_chip_model): New calculation of - maximum mixer DC level. - - * filter.cc (Filter::set_chip_model): Moved calculation of - voice_DC to voice.cc, corrected calculation of mixer_DC. - - * filter.h (Filter::output): Mixer output is not inverted. - - * sid.cc (SID::set_chip_model): Call voice.set_chip_model instead - of voice.wave.set_chip_model. - - * voice.cc (Voice::Voice): Call set_chip_model. - (Voice::set_chip_model): New function; model both waveform D/A - converter and envelope multiplying D/A converter DC offsets. - - * voice.h (Voice::output): Add both waveform D/A converter and - envelope multiplying D/A converter DC offsets. - - * wave.h (WaveformGenerator::output____): Reverted to output - minimum wave level when no waveform is selected. The maximum and - minimum wave output levels are interchanged in C= Hacking Issue #20. - -2001-10-20 Dag Lem - - * Version 0.12 released. - - * envelope.cc, envelope.h, filter.cc, filter.h, wave.cc, wave.h: - Removed bool usage. This avoids unnecessary conversion to 1/0. - - * filter.cc (Filter::set_chip_model): New function; selects voice - and mixer DC offsets and mapping from the FC registers to filter - cutoff frequency. The voice and mixer DC offsets for the MOS6581 are - calculated from measurements made by Hrsfalvi, Levente in - C= Hacking Issue #20. - (Filter::Filter): Call set_chip_model. - (Filter::f0_6581, Filter::f0_8580): Separate FC mapping tables. - (Filter::f0_points_6581, Filter::f0_points_8580): Separate FC mapping - points. - - * extfilt.cc, extfilt.h (ExternalFilter::set_chip_model): New - function supporting separate DC correction for MOS6581 and MOS8580. - - * sid.cc, sid.h (SID::adjust_sampling_frequency): New function for - on-the-fly adjustment of sampling frequency. - (SID::clock_fast): Corrected sample calculation. - (SID::set_chip_model): Set filter chip model. - (SID::output): Added audio clipping. - (SID::clock, SID::clock_fast, SID::clock_interpolate, - SID::clock_resample): Added sample interleaving. - - * spline.h (interpolate): Generalized to accept repeated points to - introduce points of non-differentiability and discontinuity. - - * wave.h (WaveformGenerator::output____): No selected waveform - yields maximum wave output level. This was found by Hrsfalvi, - Levente in C= Hacking Issue #20. - (WaveformGenerator::clock): Optimized for speed (no division). - -2001-03-10 Dag Lem - - * Version 0.11 released. - - * configure.in: Disable building of shared library by default. - Control inlining with RESID_INLINING (0 or 1) and RESID_INLINE - (blank or "inline"). - - * envelope.h, extfilt.h, filter.h, voice.h, wave.h: inline keyword - in both function declarations and function definitions. - - * samp2src.pl: Beautified Perl code. - - * sid.h, sid.cc: Replaced voice variables with array. Removed - filter variables from SID::State. - (SID::clock): New audio sample generating interface. Three - clocking methods are available; clocking at output sample - frequency, clocking at cycle frequency with linear sample - interpolation, and clocking at cycle frequency with audio - resampling. - (SID::clock_fast, SID::clock_interpolate, SID::clock_resample): - New functions called by SID::clock. - (SID::set_sampling_parameters): New function to set up SID for - sample generation. The FIR table used in SID::clock_resample is - calculated here. - (SID::I0): 0th order modified Bessel function to calculate Kaiser - window. - - * siddefs.h: Control inlining with RESID_INLINING (0 or 1) and - RESID_INLINE (blank or "inline"). Added enum sampling_method. - - * voice.h, voice.cc (Voice::set_sync_source): Moved setting of - sync source from constructor. - - * wave.h, wave.cc (WaveformGenerator::set_sync_source): Moved - setting of sync source from constructor. - -2000-11-22 Dag Lem - - * Version 0.10 released. - - * configure.in, Makefile.am: Use libtool to build library. The - hack to "disable" install is removed. - - * extfilt.h, filter.h: Moved filter stability code from sid.cc. - - * sid.cc (SID::clock): Moved filter stability code to - extfilt.h/filter.h. Don't clock the rest of the chip more - frequently than necessary. - - * wave.cc: Typecast for pedantic (and probably incorrect) - compilers. - -2000-05-18 Dag Lem - - * Version 0.9 released. - - * filter.h (Filter::output): The sum of the filter outputs is no - longer weighted. - -1999-06-24 Dag Lem - - * Version 0.8 released. - - * filter.h, filter.cc, wave.h, wave.cc: Typecasts for pedantic - compilers. - - * filter.h (Filter::clock): Voice 3 is only silenced by voice3off - if it is not routed through the filter. - - * sid.cc (SID::State): Added constructor for proper initalization. - - * spline.h: Inlined template functions to avoid problems at link - time with certain compilers. - -1999-02-25 Dag Lem - - * Version 0.7 released. - - * configure.in: Check whether compiler supports bool. - - * extfilt.h, extfilt.cc: Implementation of C64 filter, external to - the SID chip. - - * filter.h (Filter::clock): Optimized filter routing using a switch. - (Filter::output): Optimized filter mixing using a switch, avoiding - integer division. Corrected sign of filtered output, which is - inverted compared to unfiltered output. - - * filter.cc (Filter::set_w0): Removed use of M_PI and math.h - functions. Use spline table to map fc to w0. - (Filter::fc_default): Return array of FC spline interpolation points. - (Filter::fc_plotter): Return FC spline plotter object. - - * sid.h (SID::enable_external_filter): Enable/disable external - filter. - (SID::fc_default): Return array of FC spline interpolation points. - (SID::fc_plotter): Return FC spline plotter object. - (SID::State, SID::read_state, SID::write_state): Read and write - complete SID state. - - * sid.cc (SID::clock): Age bus value. Clock external filter. - (SID::enable_external_filter): Enable/disable external filter. - - * spline.h: Spline implementation. Used to specify mapping from - the FC register to filter cutoff frequency. - -1998-11-14 Dag Lem - - * Version 0.6 released. - - * configure.in: Allow compilation in a separate directory. - - * wave.h (WaveformGenerator::synchronize): Handle special case when a - sync source is synced itself on the same cycle as its MSB is set - high. - - * sid.cc (SID::clock): Only clock on MSB on/off for hard sync. - -1998-09-06 Dag Lem - - * Version 0.5 released. - - * version.cc (resid_version_string): Version string with C linkage. - - * wave.cc (WaveformGenerator::set_chip_model): Emulation of MOS8580 - combined waveforms. - -1998-08-28 Dag Lem - - * Version 0.4 released. - - * envelope.h (EnvelopeGenerator::clock): Count up to rate_period twice - during ADSR delay bug, and add one extra rate counter step. - - * filter.cc (Filter::bsd_copysign): Renamed copysign function for - compilation on platforms where copysign is implemented as a macro. - -1998-08-23 Dag Lem - - * Version 0.3 released. - - * envelope.h (EnvelopeGenerator::clock): Handle ADSR boundary bug. - - * envelope.cc (EnvelopeGenerator::rate_counter_period, - EnvelopeGenerator::exponential_counter_period): Corrected counter - periods. - - * filter.h (Filter::clock): Optimized for speed (division by shifting). - - * sid.h (SID::clock): New one-cycle optimized overload of the clock() - function. - - * wave.h (WaveformGenerator::output_P_T): Combined waveform - pulse+triangle indexing corrected. - (WaveformGenerator::output_P__): Check for test bit to handle - pulse+test bit samples. - (WaveformGenerator::output): Optimized for speed (inlining). - -1998-07-28 Dag Lem - - * Version 0.2 released. - - * envelope.h (EnvelopeGenerator::clock): Start decay cycle immediately - at envelope counter 0xff. New sustain value is zero if the sustain - level is raised above the current envelope counter value. - (EnvelopeGenerator::step_envelope): Handle ADSR delay bug. - - * envelope.cc (EnvelopeGenerator::rate_counter_period, - EnvelopeGenerator::exponential_counter_period): Corrected counter - periods. - (EnvelopeGenerator::writeCONTROL_REG): Do not modify rate counter. - - * filter.cc (Filter::set_Q): Constrain Q to keep filter stable. - - * sid.h (SID::read, SID::write, SID::bypass_filter): Simplified API - routing register access through the SID class. - - * sid.cc (SID::output): Corrected variable-bit audio output return. - (SID::read, SID::write): Allow read of write only registers. - -1998-06-09 Dag Lem - - * Version 0.1 released. diff --git a/MCUME_pico/picosnd/reSID/INSTALL b/MCUME_pico/picosnd/reSID/INSTALL deleted file mode 100755 index 54caf7c..0000000 --- a/MCUME_pico/picosnd/reSID/INSTALL +++ /dev/null @@ -1,229 +0,0 @@ -Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002 Free Software -Foundation, Inc. - - This file is free documentation; the Free Software Foundation gives -unlimited permission to copy, distribute and modify it. - -Basic Installation -================== - - These are generic installation instructions. - - The `configure' shell script attempts to guess correct values for -various system-dependent variables used during compilation. It uses -those values to create a `Makefile' in each directory of the package. -It may also create one or more `.h' files containing system-dependent -definitions. Finally, it creates a shell script `config.status' that -you can run in the future to recreate the current configuration, and a -file `config.log' containing compiler output (useful mainly for -debugging `configure'). - - It can also use an optional file (typically called `config.cache' -and enabled with `--cache-file=config.cache' or simply `-C') that saves -the results of its tests to speed up reconfiguring. (Caching is -disabled by default to prevent problems with accidental use of stale -cache files.) - - If you need to do unusual things to compile the package, please try -to figure out how `configure' could check whether to do them, and mail -diffs or instructions to the address given in the `README' so they can -be considered for the next release. If you are using the cache, and at -some point `config.cache' contains results you don't want to keep, you -may remove or edit it. - - The file `configure.ac' (or `configure.in') is used to create -`configure' by a program called `autoconf'. You only need -`configure.ac' if you want to change it or regenerate `configure' using -a newer version of `autoconf'. - -The simplest way to compile this package is: - - 1. `cd' to the directory containing the package's source code and type - `./configure' to configure the package for your system. If you're - using `csh' on an old version of System V, you might need to type - `sh ./configure' instead to prevent `csh' from trying to execute - `configure' itself. - - Running `configure' takes awhile. While running, it prints some - messages telling which features it is checking for. - - 2. Type `make' to compile the package. - - 3. Optionally, type `make check' to run any self-tests that come with - the package. - - 4. Type `make install' to install the programs and any data files and - documentation. - - 5. You can remove the program binaries and object files from the - source code directory by typing `make clean'. To also remove the - files that `configure' created (so you can compile the package for - a different kind of computer), type `make distclean'. There is - also a `make maintainer-clean' target, but that is intended mainly - for the package's developers. If you use it, you may have to get - all sorts of other programs in order to regenerate files that came - with the distribution. - -Compilers and Options -===================== - - Some systems require unusual options for compilation or linking that -the `configure' script does not know about. Run `./configure --help' -for details on some of the pertinent environment variables. - - You can give `configure' initial values for configuration parameters -by setting variables in the command line or in the environment. Here -is an example: - - ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix - - *Note Defining Variables::, for more details. - -Compiling For Multiple Architectures -==================================== - - You can compile the package for more than one kind of computer at the -same time, by placing the object files for each architecture in their -own directory. To do this, you must use a version of `make' that -supports the `VPATH' variable, such as GNU `make'. `cd' to the -directory where you want the object files and executables to go and run -the `configure' script. `configure' automatically checks for the -source code in the directory that `configure' is in and in `..'. - - If you have to use a `make' that does not support the `VPATH' -variable, you have to compile the package for one architecture at a -time in the source code directory. After you have installed the -package for one architecture, use `make distclean' before reconfiguring -for another architecture. - -Installation Names -================== - - By default, `make install' will install the package's files in -`/usr/local/bin', `/usr/local/man', etc. You can specify an -installation prefix other than `/usr/local' by giving `configure' the -option `--prefix=PATH'. - - You can specify separate installation prefixes for -architecture-specific files and architecture-independent files. If you -give `configure' the option `--exec-prefix=PATH', the package will use -PATH as the prefix for installing programs and libraries. -Documentation and other data files will still use the regular prefix. - - In addition, if you use an unusual directory layout you can give -options like `--bindir=PATH' to specify different values for particular -kinds of files. Run `configure --help' for a list of the directories -you can set and what kinds of files go in them. - - If the package supports it, you can cause programs to be installed -with an extra prefix or suffix on their names by giving `configure' the -option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. - -Optional Features -================= - - Some packages pay attention to `--enable-FEATURE' options to -`configure', where FEATURE indicates an optional part of the package. -They may also pay attention to `--with-PACKAGE' options, where PACKAGE -is something like `gnu-as' or `x' (for the X Window System). The -`README' should mention any `--enable-' and `--with-' options that the -package recognizes. - - For packages that use the X Window System, `configure' can usually -find the X include and library files automatically, but if it doesn't, -you can use the `configure' options `--x-includes=DIR' and -`--x-libraries=DIR' to specify their locations. - -Specifying the System Type -========================== - - There may be some features `configure' cannot figure out -automatically, but needs to determine by the type of machine the package -will run on. Usually, assuming the package is built to be run on the -_same_ architectures, `configure' can figure that out, but if it prints -a message saying it cannot guess the machine type, give it the -`--build=TYPE' option. TYPE can either be a short name for the system -type, such as `sun4', or a canonical name which has the form: - - CPU-COMPANY-SYSTEM - -where SYSTEM can have one of these forms: - - OS KERNEL-OS - - See the file `config.sub' for the possible values of each field. If -`config.sub' isn't included in this package, then this package doesn't -need to know the machine type. - - If you are _building_ compiler tools for cross-compiling, you should -use the `--target=TYPE' option to select the type of system they will -produce code for. - - If you want to _use_ a cross compiler, that generates code for a -platform different from the build platform, you should specify the -"host" platform (i.e., that on which the generated programs will -eventually be run) with `--host=TYPE'. - -Sharing Defaults -================ - - If you want to set default values for `configure' scripts to share, -you can create a site shell script called `config.site' that gives -default values for variables like `CC', `cache_file', and `prefix'. -`configure' looks for `PREFIX/share/config.site' if it exists, then -`PREFIX/etc/config.site' if it exists. Or, you can set the -`CONFIG_SITE' environment variable to the location of the site script. -A warning: not all `configure' scripts look for a site script. - -Defining Variables -================== - - Variables not defined in a site shell script can be set in the -environment passed to `configure'. However, some packages may run -configure again during the build, and the customized values of these -variables may be lost. In order to avoid this problem, you should set -them in the `configure' command line, using `VAR=value'. For example: - - ./configure CC=/usr/local2/bin/gcc - -will cause the specified gcc to be used as the C compiler (unless it is -overridden in the site shell script). - -`configure' Invocation -====================== - - `configure' recognizes the following options to control how it -operates. - -`--help' -`-h' - Print a summary of the options to `configure', and exit. - -`--version' -`-V' - Print the version of Autoconf used to generate the `configure' - script, and exit. - -`--cache-file=FILE' - Enable the cache: use and save the results of the tests in FILE, - traditionally `config.cache'. FILE defaults to `/dev/null' to - disable caching. - -`--config-cache' -`-C' - Alias for `--cache-file=config.cache'. - -`--quiet' -`--silent' -`-q' - Do not print messages saying which checks are being made. To - suppress all normal output, redirect it to `/dev/null' (any error - messages will still be shown). - -`--srcdir=DIR' - Look for the package's source code in directory DIR. Usually - `configure' can determine that directory automatically. - -`configure' also accepts some other, not widely useful, options. Run -`configure --help' for more details. - diff --git a/MCUME_pico/picosnd/reSID/NEWS b/MCUME_pico/picosnd/reSID/NEWS deleted file mode 100755 index e0ff298..0000000 --- a/MCUME_pico/picosnd/reSID/NEWS +++ /dev/null @@ -1,271 +0,0 @@ -Changes in reSID version 0.16 ------------------------------ - -An off-by-one error in the emulation of the ADSR delay bug has been -fixed in the fast version of the envelope clocking. - -An initialization bug in the Filter class which caused floating point -exceptions on some platforms has been fixed. - -Missing fields have been added to SID::State for correct snapshots. - -By building shifted FIR tables with samples according to the sampling -frequency, the resampling code dramatically reduces the computational -effort in the filter convolutions, without any loss of accuracy. The -filter convolutions are now also vectorizable on current hardware. The -implementation builds on ideas by Laurent Ganier. - -The resampling code has been split into two functions, one using -interpolation and a small set of shifted filter tables, and one using -direct lookup and a large set of shifted filter tables. The accuracy -is the same, the difference is that the direct lookup runs has the -potential of running at almost twice the speed (depending on cache -size and memory bandwidth) using approximately 16MB more memory. It is -now possible to run high quality resampling in real time on quite -modest hardware, provided that a vectorizing compiler is used. - - -Changes in reSID version 0.15 ------------------------------ - -An error in the emulation of the ADSR delay bug has been fixed. When -emulation of the ADSR delay bug was introduced in reSID 0.2, the delay -was one cycle too long. One cycle was subtracted from the delay in -reSID 0.4, however unfortunately one rate counter period was added as -well, thus increasing the error. At the time there was no method to -fully synchronize the CPU with envelope 3, so the measurements relied -on averaging. Because of pipelining in the envelope logic the effects -of a write are delayed, and this caused the test code to miss the -target by exactly one rate counter period on a real SID. The current -test code does achieve full synchronization with envelope 3, so this -time the delay should be 100% correct. There are still side effects -caused by pipelining which are not implemented in reSID, however these -effects are not controllable without full synchronization with the -envelope, something which is hard to achieve with envelope 3, and -impossible with envelope 1 and 2. - -The envelope state (ADSR) has been added to the SID state, and the -volume setting is now restored from the SID state. - -Filter scaling and clipping has been added to avoid sample overflows -in the resampling filter. - - -Changes in reSID version 0.14 ------------------------------ - -The SID external audio input is now emulated. This can be used e.g. to -simulate the hack of connecting a resistor from EXT IN to GND to boost -the sample volume on the MOS8580. Calling sid.input(-32768) makes the -MOS8580 sound more or less like the MOS6581 with respect to samples. -The interface could also be used to mix in an external audio signal, -but note that to do this correctly you should really resample the -audio signal to 1MHz first. - -The filter settings are now updated immediately when the chip model is -changed. Earlier the filter cutoff frequency would not change until -the FC registers were updated. - -A one cycle error in the fast version of the envelope clocking has -been fixed. This bug was introduced in reSID 0.13 and could affect the -ADSR delay emulation. - -The exponential counter period is now only loaded at the envelope -counter values 255, 93, 54, 26, 14, 6, 0. The period can be different -for the same envelope counter value, depending on whether the envelope -has been rising (attack -> release) or sinking (decay/release). - -A bug in the fast version of the noise register shift routine has been -corrected. This bug caused too low noise frequency in some cases. - -The filter cutoff frequency is limited to 16kHz to keep the filter stable. - - -Changes in reSID version 0.13 ------------------------------ - -The internal DC levels of the MOS6581 have been double checked and -corrected. The reason for the asymmetric scaling of the voice output -has been found; there is a DC offset from the waveform D/A converter -in addition to the DC offset from the envelope multiplying D/A -converter. No selected waveform (N=P=S=T=0) yields minimum wave output -level again. - -A bug in the fast version of the envelope clocking has been corrected. -This bug could incorrectly invoke the ADSR delay emulation. - - -Changes in reSID version 0.12 ------------------------------ - -A bug causing incorrect sample spacing in the new SAMPLE_FAST sample -calculation has been corrected. - -Audio clipping has been added to guard against sample overflows. - -To support multi-channel sampling, sample interleaving has been added -to the clock() interface. - -To support synchronization with an external timer, an interface for -sample rate adjustment has been added. - -The internal DC levels have been corrected. No selected waveform -(N=P=S=T=0) yields maximum wave output level. Furthermore, each voice -in the MOS6581 independently contributes to the DC level in the mixer, -and the mixer itself has a small DC offset as well. The MOS8580 has no -DC offsets. - -The spline interpolation routine has been generalized to accept -repeated points to introduce points of non-differentiability and -discontinuity. - -A separate mapping from the FC registers to filter cutoff frequency -has been included for the MOS8580, and the mapping for the MOS6581 has -been refined. - - -Changes in reSID version 0.11 ------------------------------ - -A new clock() interface has been added. This function generates audio -samples into a buffer, greatly simplifying the task of writing driver -code for reSID. It also facilitates more advanced audio sample -generation, as described below. - -Three clocking methods are available: clocking at output sample -frequency, clocking at cycle frequency with linear sample -interpolation, and clocking at cycle frequency with audio resampling. - -Clocking at output sample frequency is fast, and yields acceptable -sound quality, except for the SID combined waveforms, which have a -very high frequency content. - -Clocking at cycle frequency with linear sample interpolation is -approximately five to ten times slower at 44.1kHz sampling frequency, -but the sound quality is improved because of the linear sample -interpolation, and because some sampling noise is removed by the SID -external filter, which attenuates signals above 16kHz. - -Finally, clocking at cycle frequency with audio resampling has a work -rate which is independent of the sampling frequency; it is rather -inversely proportional to the percentage of the bandwidth allocated -to the filter transition band. This implies that e.g. with the -transition band starting at ~ 20kHz, it is faster to generate 48kHz -than 44.1kHz samples. - -Audio resampling is the theoretically correct method for sample -generation, and delivers SID sound quality previously unheard of. This -should make connoisseurs nod in appreciation, and for some time to -come it could possibly also make people tear their hair over having to -buy state of the art hardware to handle the obscene workload in real -time. By trading off passband bandwidth for speed, real time -processing is possible on current hardware. A 60% passband bandwidth -is within the reach of reasonably fast machines, while maximum sound -quality at 90% passband bandwidth, requiring four times the processing -power, is not. Yet. - - -Changes in reSID version 0.10 ------------------------------ - -Libtool is now used to build the library. - -To keep the filters stable it is necessary to clock them at above -sample rate. The chip clocking code has been modified to only -"overclock" the filters, not the whole chip. This yields a -considerable speedup without noticeably lowering sound quality. Note -that this is aimed at slow hardware, if possible the 1 cycle clock -interface should be used to eliminate sampling noise. - - -Changes in reSID version 0.9 ----------------------------- - -The sum of the filter outputs is no longer weighted. - - -Changes in reSID version 0.8 ----------------------------- - -voice3off has no effect if voice 3 is routed through the filter. - - -Changes in reSID version 0.7 ----------------------------- - -The audio output filter in the C64, external to the SID chip, has been -modeled. - -The mapping function between the FC register and filter cutoff frequency can -now be specified with spline interpolation points. This facilitates -interactive modification of the mapping function by graphical presentation of -the interpolation curve. The implementation of this novel spline design is -fast and general purpose, and should be well suited for use in other projects -as well. - -Filtered output has been inverted compared to unfiltered output. - -Aging of the bus value obtained when reading write only registers has been -partly implemented. - -To facilitate offline storage the complete state of SID can be read and -written. - - -Changes in reSID version 0.6 ----------------------------- - -A special case in synchronization has been implemented. - -The Autoconf script is cleaned up to allow compilation in a separate directory. - - -Changes in reSID version 0.5 ----------------------------- - -Emulation of MOS8580 combined waveforms. - -Version string resid_version_string provided for e.g. Autoconf tests. -The string has C linkage. - - -Changes in reSID version 0.4 ----------------------------- - -The implementation of the ADSR delay bug has been refined and should now be -cycle exact. - -The patch for VICE has been removed since VICE 0.15 will include reSID support. - - -Changes in reSID version 0.3 ----------------------------- - -The reSID library has changed name from libmos6581.a to libresid.a - -The pulse+sawtooth combined waveform has been corrected. - -Pulse+test bit samples are implemented. - -The envelope rate periods have finally been exactly determined. - -A new SID bug, the ADSR boundary bug, has been discovered and implemented. -This bug makes it possible to step from envelope level 0x00 to 0xff or from -0xff to 0x00 in one step. - -One-cycle optimized overloads of the clock() functions have been implemented -to facilitate sampling at 1MHz. - -The code has been further optimized for speed. - - -Changes in reSID version 0.2 ----------------------------- - -The implementation of the Envelope Generator has been rewritten to handle -the infamous ADSR delay bug. All known envelope related bugs have been -corrected. - -The maximum filter resonance is lowered to keep the filter stable. - -The reSID API has been simplified. Reading write only registers is allowed. diff --git a/MCUME_pico/picosnd/reSID/README b/MCUME_pico/picosnd/reSID/README deleted file mode 100755 index 79da519..0000000 --- a/MCUME_pico/picosnd/reSID/README +++ /dev/null @@ -1,26 +0,0 @@ -This is reSID, a reverse engineered software emulation of the MOS6581 SID -(Sound Interface Device). This chip was used in the Commodore 64 computer. - -reSID is free software. See the file COPYING for copying permission. - -reSID is a C++ library containing a complete emulation of the SID chip. -This library can be linked into programs emulating the MOS6510 MPU to -play music made for the Commodore 64 computer. reSID has been successfully -linked into VICE, a full-fledged Commodore 64 emulator, and SIDPLAY, a -popular SID tune player. The VICE home page is: -http://www.viceteam.org/ -A patch for SIDPLAY can be found on the SIDPLAY home page: -http://www.geocities.com/SiliconValley/Lakes/5147/ - -Various SID emulators exist, however reSID should still be of great -interest to Commodore 64 nostalgics. The emulator engine is cycle-based, -emulating the internal operations of the SID chip. SID's audio filter is -modeled as an actual two-integrator-loop biquadratic filter circuit. -The engine has been developed based on available information on SID, sampling -of the OSC3 and ENV3 registers, filter theory, and meticulous testing. -In short, a scientific approach has been taken to model the SID chip as -accurately as possible. - -To our knowledge reSID is by far the most accurate SID emulator ever created. -This comes at a price; what is considered a fairly fast CPU at the time of -this writing is needed to run the emulator. diff --git a/MCUME_pico/picosnd/reSID/THANKS b/MCUME_pico/picosnd/reSID/THANKS deleted file mode 100755 index 824c682..0000000 --- a/MCUME_pico/picosnd/reSID/THANKS +++ /dev/null @@ -1,87 +0,0 @@ -reSID was written by Dag Lem. - -The project was started after reading an interview with Bob Yannes, the -head engineer of the SID chip. This interview was made by Andreas Varga, -with additional questions from Linus Walleij. The interview can be found on -the SID Homepage: -http://stud1.tuwien.ac.at/~e9426444/sidpage.html -The reverse engineering of the SID chip would not have been possible without -this interview. - -Also found on the SID Homepage is an examination of the SID noise waveform -written by Asger Alstrup. This article was of great help in reverse -engineering the complete algorithm for the noise waveform. - -Lars Haugseth has been invaluable in the testing of reSID. -In a matter of hours after hearing about my project, he had completed a 6510 -disassembler in Perl. The importance of this was not evident to me until the -next day when he had disassembled the music routine for "Outrun Remix" by -Geir Tjelta, made some changes to it, reassembled, and produced a file -containing 48K of SID register values. -The first tests of reSID were run on this file. -With an exceptional memory of Commodore 64 tunes Lars Haugseth has pointed -out several errors in reSID that are now corrected. - -Morten Rollan and Kre Gunnar Nesheim have provided interesting and insightful -information regarding digital filters. Kre Gunnar Nesheim has also kindly -provided a 1901 monitor and a C64C from his private computer museum. His C64C -was used to measure the MOS8580 filter cutoff characteristics. - -VICE has been an inspiration for this project, and testing of reSID has -been greatly simplified by VICEs -sounddev dump option. Teemu Rantanen -has written support for reSID in VICE, making it possible to choose at runtime -between his excellent SID emulation and, given enough CPU power, the reSID -emulator engine. Tibor Biczo, Andreas Boose, and Andr Fachat have provided -combined waveform samples for 6581 R1, R3, R4, and 8580 R5 SID chips. -The VICE home page is found at: -http://www.viceteam.org/ - -The author of SIDPLAY, Michael Schwendt, has implemented a patch to link -libsidplay with reSID. Using his excellent tune player he has pointed out -several bugs in reSID. He has also provided invaluable information related to -the bugs as basis for further investigation. Most notably, the infamous ADSR -delay bug, of which I was previously unaware, has finally been understood and -is now correctly implemented in reSID. The SIDPLAY home page is found at: -http://www.geocities.com/SiliconValley/Lakes/5147/ - -A bug report from Daniel Lacasse led to the discovery of a previously unknown -SID bug, the ADSR boundary bug. - -Anders degrd has explained aspects of analog electronics and audio -equipment. - -Bob Yannes has patiently answered questions and has provided lots of -technical information on the SID filter. Thank you Bob! - -Julius O. Smith III has provided much of the theoretical basis for the -audio resampling with his "Digital Audio Resampling Home Page": -http://www-ccrma.stanford.edu/~jos/resample/ - -Hrsfalvi, Levente has made a thorough investigation of the DC levels -in the MOS6581 chip. His results are available in C= Hacking Issue #20, -and form the basis of DC corrections in reSID. Levente found that each -voice independently contributes to the DC level in the mixer. Note -that some of the conclusions in the article are incorrect, as the -maximum and minimum voice output levels are interchanged. - -The author of SIDPLAY2, Simon White, has given a lot of feedback on -reSID. Most importantly he found and fixed a bug in the fast clock -version of the ADSR emulation. - -Laurent Ovaert found and fixed a bug in the fast version of the noise -register shift routine. - -Andreas Dehmel has reported all sorts of initialization and overflow -errors. - -Laurent Ganier demonstrated two crucial techniques for vectorizable -filter convolution in a patch. Firstly, he made the filter elements -correspond to the sampling frequency, allowing the linear -interpolation to be factorized out from the convolution. Secondly, he -duplicated elements in the sample ring buffer, achieving contiguous -storage of the samples. The current resampling implementation builds -on these ideas, improving on them by using shifted filter tables for -generalization and accuracy. - -Finally I would like to thank my business partner Stian W. Arnesen for -putting up with all this nonsense. diff --git a/MCUME_pico/picosnd/reSID/TODO b/MCUME_pico/picosnd/reSID/TODO deleted file mode 100755 index 4527dfa..0000000 --- a/MCUME_pico/picosnd/reSID/TODO +++ /dev/null @@ -1,8 +0,0 @@ -* Determine the characteristics of the SID filter integrators. Spice - may perhaps be used to simulate the filter circuit. - -* Write documentation. Possibly a paper describing how SID was reverse - engineered. - -* Implement a SID tune player. A PSID player, VSID, is partly - implemented in VICE. diff --git a/MCUME_pico/picosnd/reSID/envelope.cpp b/MCUME_pico/picosnd/reSID/envelope.cpp deleted file mode 100755 index 915c4c4..0000000 --- a/MCUME_pico/picosnd/reSID/envelope.cpp +++ /dev/null @@ -1,231 +0,0 @@ -// --------------------------------------------------------------------------- -// This file is part of reSID, a MOS6581 SID emulator engine. -// Copyright (C) 2004 Dag Lem -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// --------------------------------------------------------------------------- - -#define __ENVELOPE_CC__ -#include "envelope.h" - -RESID_NAMESPACE_START - -// ---------------------------------------------------------------------------- -// Constructor. -// ---------------------------------------------------------------------------- -EnvelopeGenerator::EnvelopeGenerator() -{ - reset(); -} - -// ---------------------------------------------------------------------------- -// SID reset. -// ---------------------------------------------------------------------------- -void EnvelopeGenerator::reset() -{ - envelope_counter = 0; - - attack = 0; - decay = 0; - sustain = 0; - release = 0; - - gate = 0; - - rate_counter = 0; - exponential_counter = 0; - exponential_counter_period = 1; - - state = RELEASE; - rate_period = rate_counter_period[release]; - hold_zero = true; -} - - -// Rate counter periods are calculated from the Envelope Rates table in -// the Programmer's Reference Guide. The rate counter period is the number of -// cycles between each increment of the envelope counter. -// The rates have been verified by sampling ENV3. -// -// The rate counter is a 16 bit register which is incremented each cycle. -// When the counter reaches a specific comparison value, the envelope counter -// is incremented (attack) or decremented (decay/release) and the -// counter is zeroed. -// -// NB! Sampling ENV3 shows that the calculated values are not exact. -// It may seem like most calculated values have been rounded (.5 is rounded -// down) and 1 has beed added to the result. A possible explanation for this -// is that the SID designers have used the calculated values directly -// as rate counter comparison values, not considering a one cycle delay to -// zero the counter. This would yield an actual period of comparison value + 1. -// -// The time of the first envelope count can not be exactly controlled, except -// possibly by resetting the chip. Because of this we cannot do cycle exact -// sampling and must devise another method to calculate the rate counter -// periods. -// -// The exact rate counter periods can be determined e.g. by counting the number -// of cycles from envelope level 1 to envelope level 129, and dividing the -// number of cycles by 128. CIA1 timer A and B in linked mode can perform -// the cycle count. This is the method used to find the rates below. -// -// To avoid the ADSR delay bug, sampling of ENV3 should be done using -// sustain = release = 0. This ensures that the attack state will not lower -// the current rate counter period. -// -// The ENV3 sampling code below yields a maximum timing error of 14 cycles. -// lda #$01 -// l1: cmp $d41c -// bne l1 -// ... -// lda #$ff -// l2: cmp $d41c -// bne l2 -// -// This yields a maximum error for the calculated rate period of 14/128 cycles. -// The described method is thus sufficient for exact calculation of the rate -// periods. -// -const reg16 EnvelopeGenerator::rate_counter_period[] = { - 9, // 2ms*1.0MHz/256 = 7.81 - 32, // 8ms*1.0MHz/256 = 31.25 - 63, // 16ms*1.0MHz/256 = 62.50 - 95, // 24ms*1.0MHz/256 = 93.75 - 149, // 38ms*1.0MHz/256 = 148.44 - 220, // 56ms*1.0MHz/256 = 218.75 - 267, // 68ms*1.0MHz/256 = 265.63 - 313, // 80ms*1.0MHz/256 = 312.50 - 392, // 100ms*1.0MHz/256 = 390.63 - 977, // 250ms*1.0MHz/256 = 976.56 - 1954, // 500ms*1.0MHz/256 = 1953.13 - 3126, // 800ms*1.0MHz/256 = 3125.00 - 3907, // 1 s*1.0MHz/256 = 3906.25 - 11720, // 3 s*1.0MHz/256 = 11718.75 - 19532, // 5 s*1.0MHz/256 = 19531.25 - 31251 // 8 s*1.0MHz/256 = 31250.00 -}; - - -// For decay and release, the clock to the envelope counter is sequentially -// divided by 1, 2, 4, 8, 16, 30, 1 to create a piece-wise linear approximation -// of an exponential. The exponential counter period is loaded at the envelope -// counter values 255, 93, 54, 26, 14, 6, 0. The period can be different for the -// same envelope counter value, depending on whether the envelope has been -// rising (attack -> release) or sinking (decay/release). -// -// Since it is not possible to reset the rate counter (the test bit has no -// influence on the envelope generator whatsoever) a method must be devised to -// do cycle exact sampling of ENV3 to do the investigation. This is possible -// with knowledge of the rate period for A=0, found above. -// -// The CPU can be synchronized with ENV3 by first synchronizing with the rate -// counter by setting A=0 and wait in a carefully timed loop for the envelope -// counter _not_ to change for 9 cycles. We can then wait for a specific value -// of ENV3 with another timed loop to fully synchronize with ENV3. -// -// At the first period when an exponential counter period larger than one -// is used (decay or relase), one extra cycle is spent before the envelope is -// decremented. The envelope output is then delayed one cycle until the state -// is changed to attack. Now one cycle less will be spent before the envelope -// is incremented, and the situation is normalized. -// The delay is probably caused by the comparison with the exponential counter, -// and does not seem to affect the rate counter. This has been verified by -// timing 256 consecutive complete envelopes with A = D = R = 1, S = 0, using -// CIA1 timer A and B in linked mode. If the rate counter is not affected the -// period of each complete envelope is -// (255 + 162*1 + 39*2 + 28*4 + 12*8 + 8*16 + 6*30)*32 = 756*32 = 32352 -// which corresponds exactly to the timed value divided by the number of -// complete envelopes. -// NB! This one cycle delay is not modeled. - - -// From the sustain levels it follows that both the low and high 4 bits of the -// envelope counter are compared to the 4-bit sustain value. -// This has been verified by sampling ENV3. -// -const reg8 EnvelopeGenerator::sustain_level[] = { - 0x00, - 0x11, - 0x22, - 0x33, - 0x44, - 0x55, - 0x66, - 0x77, - 0x88, - 0x99, - 0xaa, - 0xbb, - 0xcc, - 0xdd, - 0xee, - 0xff, -}; - - -// ---------------------------------------------------------------------------- -// Register functions. -// ---------------------------------------------------------------------------- -void EnvelopeGenerator::writeCONTROL_REG(reg8 control) -{ - reg8 gate_next = control & 0x01; - - // The rate counter is never reset, thus there will be a delay before the - // envelope counter starts counting up (attack) or down (release). - - // Gate bit on: Start attack, decay, sustain. - if (!gate && gate_next) { - state = ATTACK; - rate_period = rate_counter_period[attack]; - - // Switching to attack state unlocks the zero freeze. - hold_zero = false; - } - // Gate bit off: Start release. - else if (gate && !gate_next) { - state = RELEASE; - rate_period = rate_counter_period[release]; - } - - gate = gate_next; -} - -void EnvelopeGenerator::writeATTACK_DECAY(reg8 attack_decay) -{ - attack = (attack_decay >> 4) & 0x0f; - decay = attack_decay & 0x0f; - if (state == ATTACK) { - rate_period = rate_counter_period[attack]; - } - else if (state == DECAY_SUSTAIN) { - rate_period = rate_counter_period[decay]; - } -} - -void EnvelopeGenerator::writeSUSTAIN_RELEASE(reg8 sustain_release) -{ - sustain = (sustain_release >> 4) & 0x0f; - release = sustain_release & 0x0f; - if (state == RELEASE) { - rate_period = rate_counter_period[release]; - } -} - -reg8 EnvelopeGenerator::readENV() -{ - return output(); -} - -RESID_NAMESPACE_STOP diff --git a/MCUME_pico/picosnd/reSID/envelope.h b/MCUME_pico/picosnd/reSID/envelope.h deleted file mode 100755 index 7fd86ee..0000000 --- a/MCUME_pico/picosnd/reSID/envelope.h +++ /dev/null @@ -1,309 +0,0 @@ -// --------------------------------------------------------------------------- -// This file is part of reSID, a MOS6581 SID emulator engine. -// Copyright (C) 2004 Dag Lem -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// --------------------------------------------------------------------------- - -#ifndef __ENVELOPE_H__ -#define __ENVELOPE_H__ - -#include "siddefs.h" - -RESID_NAMESPACE_START - -// ---------------------------------------------------------------------------- -// A 15 bit counter is used to implement the envelope rates, in effect -// dividing the clock to the envelope counter by the currently selected rate -// period. -// In addition, another counter is used to implement the exponential envelope -// decay, in effect further dividing the clock to the envelope counter. -// The period of this counter is set to 1, 2, 4, 8, 16, 30 at the envelope -// counter values 255, 93, 54, 26, 14, 6, respectively. -// ---------------------------------------------------------------------------- -class EnvelopeGenerator -{ -public: - EnvelopeGenerator(); - - enum State { ATTACK, DECAY_SUSTAIN, RELEASE }; - - RESID_INLINE void clock(); - RESID_INLINE void clock(cycle_count delta_t); - void reset(); - - void writeCONTROL_REG(reg8); - void writeATTACK_DECAY(reg8); - void writeSUSTAIN_RELEASE(reg8); - reg8 readENV(); - - // 8-bit envelope output. - RESID_INLINE reg8 output(); - -protected: - reg16 rate_counter; - reg16 rate_period; - reg8 exponential_counter; - reg8 exponential_counter_period; - reg8 envelope_counter; - bool hold_zero; - - reg4 attack; - reg4 decay; - reg4 sustain; - reg4 release; - - reg8 gate; - - State state; - - // Lookup table to convert from attack, decay, or release value to rate - // counter period. - static const reg16 rate_counter_period[]; - - // The 16 selectable sustain levels. - static const reg8 sustain_level[]; - -friend class SID; -}; - - -// ---------------------------------------------------------------------------- -// Inline functions. -// The following functions are defined inline because they are called every -// time a sample is calculated. -// ---------------------------------------------------------------------------- - -#if RESID_INLINING || defined(__ENVELOPE_CC__) - -// ---------------------------------------------------------------------------- -// SID clocking - 1 cycle. -// ---------------------------------------------------------------------------- -RESID_INLINE -void EnvelopeGenerator::clock() -{ - // Check for ADSR delay bug. - // If the rate counter comparison value is set below the current value of the - // rate counter, the counter will continue counting up until it wraps around - // to zero at 2^15 = 0x8000, and then count rate_period - 1 before the - // envelope can finally be stepped. - // This has been verified by sampling ENV3. - // - if (++rate_counter & 0x8000) { - ++rate_counter &= 0x7fff; - } - - if (rate_counter != rate_period) { - return; - } - - rate_counter = 0; - - // The first envelope step in the attack state also resets the exponential - // counter. This has been verified by sampling ENV3. - // - if (state == ATTACK || ++exponential_counter == exponential_counter_period) - { - exponential_counter = 0; - - // Check whether the envelope counter is frozen at zero. - if (hold_zero) { - return; - } - - switch (state) { - case ATTACK: - // The envelope counter can flip from 0xff to 0x00 by changing state to - // release, then to attack. The envelope counter is then frozen at - // zero; to unlock this situation the state must be changed to release, - // then to attack. This has been verified by sampling ENV3. - // - ++envelope_counter &= 0xff; - if (envelope_counter == 0xff) { - state = DECAY_SUSTAIN; - rate_period = rate_counter_period[decay]; - } - break; - case DECAY_SUSTAIN: - if (envelope_counter != sustain_level[sustain]) { - --envelope_counter; - } - break; - case RELEASE: - // The envelope counter can flip from 0x00 to 0xff by changing state to - // attack, then to release. The envelope counter will then continue - // counting down in the release state. - // This has been verified by sampling ENV3. - // NB! The operation below requires two's complement integer. - // - --envelope_counter &= 0xff; - break; - } - - // Check for change of exponential counter period. - switch (envelope_counter) { - case 0xff: - exponential_counter_period = 1; - break; - case 0x5d: - exponential_counter_period = 2; - break; - case 0x36: - exponential_counter_period = 4; - break; - case 0x1a: - exponential_counter_period = 8; - break; - case 0x0e: - exponential_counter_period = 16; - break; - case 0x06: - exponential_counter_period = 30; - break; - case 0x00: - exponential_counter_period = 1; - - // When the envelope counter is changed to zero, it is frozen at zero. - // This has been verified by sampling ENV3. - hold_zero = true; - break; - } - } -} - - -// ---------------------------------------------------------------------------- -// SID clocking - delta_t cycles. -// ---------------------------------------------------------------------------- -RESID_INLINE -void EnvelopeGenerator::clock(cycle_count delta_t) -{ - // Check for ADSR delay bug. - // If the rate counter comparison value is set below the current value of the - // rate counter, the counter will continue counting up until it wraps around - // to zero at 2^15 = 0x8000, and then count rate_period - 1 before the - // envelope can finally be stepped. - // This has been verified by sampling ENV3. - // - - // NB! This requires two's complement integer. - int rate_step = rate_period - rate_counter; - if (rate_step <= 0) { - rate_step += 0x7fff; - } - - while (delta_t) { - if (delta_t < rate_step) { - rate_counter += delta_t; - if (rate_counter & 0x8000) { - ++rate_counter &= 0x7fff; - } - return; - } - - rate_counter = 0; - delta_t -= rate_step; - - // The first envelope step in the attack state also resets the exponential - // counter. This has been verified by sampling ENV3. - // - if (state == ATTACK || ++exponential_counter == exponential_counter_period) - { - exponential_counter = 0; - - // Check whether the envelope counter is frozen at zero. - if (hold_zero) { - rate_step = rate_period; - continue; - } - - switch (state) { - case ATTACK: - // The envelope counter can flip from 0xff to 0x00 by changing state to - // release, then to attack. The envelope counter is then frozen at - // zero; to unlock this situation the state must be changed to release, - // then to attack. This has been verified by sampling ENV3. - // - ++envelope_counter &= 0xff; - if (envelope_counter == 0xff) { - state = DECAY_SUSTAIN; - rate_period = rate_counter_period[decay]; - } - break; - case DECAY_SUSTAIN: - if (envelope_counter != sustain_level[sustain]) { - --envelope_counter; - } - break; - case RELEASE: - // The envelope counter can flip from 0x00 to 0xff by changing state to - // attack, then to release. The envelope counter will then continue - // counting down in the release state. - // This has been verified by sampling ENV3. - // NB! The operation below requires two's complement integer. - // - --envelope_counter &= 0xff; - break; - } - - // Check for change of exponential counter period. - switch (envelope_counter) { - case 0xff: - exponential_counter_period = 1; - break; - case 0x5d: - exponential_counter_period = 2; - break; - case 0x36: - exponential_counter_period = 4; - break; - case 0x1a: - exponential_counter_period = 8; - break; - case 0x0e: - exponential_counter_period = 16; - break; - case 0x06: - exponential_counter_period = 30; - break; - case 0x00: - exponential_counter_period = 1; - - // When the envelope counter is changed to zero, it is frozen at zero. - // This has been verified by sampling ENV3. - hold_zero = true; - break; - } - } - - rate_step = rate_period; - } -} - - -// ---------------------------------------------------------------------------- -// Read the envelope generator output. -// ---------------------------------------------------------------------------- -RESID_INLINE -reg8 EnvelopeGenerator::output() -{ - return envelope_counter; -} - -#endif // RESID_INLINING || defined(__ENVELOPE_CC__) - -RESID_NAMESPACE_STOP - -#endif // not __ENVELOPE_H__ diff --git a/MCUME_pico/picosnd/reSID/extfilt.cpp b/MCUME_pico/picosnd/reSID/extfilt.cpp deleted file mode 100755 index e9747f0..0000000 --- a/MCUME_pico/picosnd/reSID/extfilt.cpp +++ /dev/null @@ -1,98 +0,0 @@ -// --------------------------------------------------------------------------- -// This file is part of reSID, a MOS6581 SID emulator engine. -// Copyright (C) 2004 Dag Lem -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// --------------------------------------------------------------------------- - -#define __EXTFILT_CC__ -#include "extfilt.h" - -RESID_NAMESPACE_START - -// ---------------------------------------------------------------------------- -// Constructor. -// ---------------------------------------------------------------------------- -ExternalFilter::ExternalFilter() -{ - reset(); - enable_filter(true); - set_sampling_parameter(15915.6); - //set_chip_model(MOS6581); - {//instead: - mixer_DC = ((((0x800 - 0x380) + 0x800)*0xff*3 - 0xfff*0xff/18) >> 7)*0x0f; - } -} - - -// ---------------------------------------------------------------------------- -// Enable filter. -// ---------------------------------------------------------------------------- -void ExternalFilter::enable_filter(bool enable) -{ - enabled = enable; -} - - -// ---------------------------------------------------------------------------- -// Setup of the external filter sampling parameters. -// ---------------------------------------------------------------------------- -void ExternalFilter::set_sampling_parameter(float pass_freq) -{ - static const float pi = 3.1415926535897932385; - - // Low-pass: R = 10kOhm, C = 1000pF; w0l = 1/RC = 1/(1e4*1e-9) = 100000 - // High-pass: R = 1kOhm, C = 10uF; w0h = 1/RC = 1/(1e3*1e-5) = 100 - // Multiply with 1.048576 to facilitate division by 1 000 000 by right- - // shifting 20 times (2 ^ 20 = 1048576). - - w0hp = 105; - w0lp = (sound_sample) (pass_freq * (2.0 * pi * 1.048576)); - if (w0lp > 104858) - w0lp = 104858; -} - - -// ---------------------------------------------------------------------------- -// Set chip model. -// ---------------------------------------------------------------------------- -/* -void ExternalFilter::set_chip_model(chip_model model) -{ - if (model == MOS6581) { - // Maximum mixer DC output level; to be removed if the external - // filter is turned off: ((wave DC + voice DC)*voices + mixer DC)*volume - // See voice.cc and filter.cc for an explanation of the values. - mixer_DC = ((((0x800 - 0x380) + 0x800)*0xff*3 - 0xfff*0xff/18) >> 7)*0x0f; - } - else { - // No DC offsets in the MOS8580. - mixer_DC = 0; - } -} -*/ - -// ---------------------------------------------------------------------------- -// SID reset. -// ---------------------------------------------------------------------------- -void ExternalFilter::reset() -{ - // State of filter. - Vlp = 0; - Vhp = 0; - Vo = 0; -} - -RESID_NAMESPACE_STOP diff --git a/MCUME_pico/picosnd/reSID/extfilt.h b/MCUME_pico/picosnd/reSID/extfilt.h deleted file mode 100755 index 7b67e52..0000000 --- a/MCUME_pico/picosnd/reSID/extfilt.h +++ /dev/null @@ -1,169 +0,0 @@ -// --------------------------------------------------------------------------- -// This file is part of reSID, a MOS6581 SID emulator engine. -// Copyright (C) 2004 Dag Lem -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// --------------------------------------------------------------------------- - -#ifndef __EXTFILT_H__ -#define __EXTFILT_H__ - -#include "siddefs.h" - -RESID_NAMESPACE_START - -// ---------------------------------------------------------------------------- -// The audio output stage in a Commodore 64 consists of two STC networks, -// a low-pass filter with 3-dB frequency 16kHz followed by a high-pass -// filter with 3-dB frequency 16Hz (the latter provided an audio equipment -// input impedance of 1kOhm). -// The STC networks are connected with a BJT supposedly meant to act as -// a unity gain buffer, which is not really how it works. A more elaborate -// model would include the BJT, however DC circuit analysis yields BJT -// base-emitter and emitter-base impedances sufficiently low to produce -// additional low-pass and high-pass 3dB-frequencies in the order of hundreds -// of kHz. This calls for a sampling frequency of several MHz, which is far -// too high for practical use. -// ---------------------------------------------------------------------------- -class ExternalFilter -{ -public: - ExternalFilter(); - - void enable_filter(bool enable); - void set_sampling_parameter(float pass_freq); - //void set_chip_model(chip_model model); - - RESID_INLINE void clock(sound_sample Vi); - RESID_INLINE void clock(cycle_count delta_t, sound_sample Vi); - void reset(); - - // Audio output (20 bits). - RESID_INLINE sound_sample output(); - -protected: - // Filter enabled. - bool enabled; - - // Maximum mixer DC offset. - sound_sample mixer_DC; - - // State of filters. - sound_sample Vlp; // lowpass - sound_sample Vhp; // highpass - sound_sample Vo; - - // Cutoff frequencies. - sound_sample w0lp; - sound_sample w0hp; - -friend class SID; -}; - - -// ---------------------------------------------------------------------------- -// Inline functions. -// The following functions are defined inline because they are called every -// time a sample is calculated. -// ---------------------------------------------------------------------------- - -#if RESID_INLINING || defined(__EXTFILT_CC__) - -// ---------------------------------------------------------------------------- -// SID clocking - 1 cycle. -// ---------------------------------------------------------------------------- -RESID_INLINE -void ExternalFilter::clock(sound_sample Vi) -{ - // This is handy for testing. - if (!enabled) { - // Remove maximum DC level since there is no filter to do it. - Vlp = Vhp = 0; - Vo = Vi - mixer_DC; - return; - } - - // delta_t is converted to seconds given a 1MHz clock by dividing - // with 1 000 000. - - // Calculate filter outputs. - // Vo = Vlp - Vhp; - // Vlp = Vlp + w0lp*(Vi - Vlp)*delta_t; - // Vhp = Vhp + w0hp*(Vlp - Vhp)*delta_t; - - sound_sample dVlp = (w0lp >> 8)*(Vi - Vlp) >> 12; - sound_sample dVhp = w0hp*(Vlp - Vhp) >> 20; - Vo = Vlp - Vhp; - Vlp += dVlp; - Vhp += dVhp; -} - -// ---------------------------------------------------------------------------- -// SID clocking - delta_t cycles. -// ---------------------------------------------------------------------------- -RESID_INLINE -void ExternalFilter::clock(cycle_count delta_t, - sound_sample Vi) -{ - // This is handy for testing. - if (!enabled) { - // Remove maximum DC level since there is no filter to do it. - Vlp = Vhp = 0; - Vo = Vi - mixer_DC; - return; - } - - // Maximum delta cycles for the external filter to work satisfactorily - // is approximately 8. - cycle_count delta_t_flt = 8; - - while (delta_t) { - if (delta_t < delta_t_flt) { - delta_t_flt = delta_t; - } - - // delta_t is converted to seconds given a 1MHz clock by dividing - // with 1 000 000. - - // Calculate filter outputs. - // Vo = Vlp - Vhp; - // Vlp = Vlp + w0lp*(Vi - Vlp)*delta_t; - // Vhp = Vhp + w0hp*(Vlp - Vhp)*delta_t; - - sound_sample dVlp = (w0lp*delta_t_flt >> 8)*(Vi - Vlp) >> 12; - sound_sample dVhp = w0hp*delta_t_flt*(Vlp - Vhp) >> 20; - Vo = Vlp - Vhp; - Vlp += dVlp; - Vhp += dVhp; - - delta_t -= delta_t_flt; - } -} - - -// ---------------------------------------------------------------------------- -// Audio output (19.5 bits). -// ---------------------------------------------------------------------------- -RESID_INLINE -sound_sample ExternalFilter::output() -{ - return Vo; -} - -#endif // RESID_INLINING || defined(__EXTFILT_CC__) - -RESID_NAMESPACE_STOP - -#endif // not __EXTFILT_H__ diff --git a/MCUME_pico/picosnd/reSID/filter.cpp b/MCUME_pico/picosnd/reSID/filter.cpp deleted file mode 100755 index 8240b11..0000000 --- a/MCUME_pico/picosnd/reSID/filter.cpp +++ /dev/null @@ -1,325 +0,0 @@ -// --------------------------------------------------------------------------- -// This file is part of reSID, a MOS6581 SID emulator engine. -// Copyright (C) 2004 Dag Lem -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// --------------------------------------------------------------------------- - -#define __FILTER_CC__ -#include "filter.h" - -RESID_NAMESPACE_START - -// Maximum cutoff frequency is specified as -// FCmax = 2.6e-5/C = 2.6e-5/2200e-12 = 11818. -// -// Measurements indicate a cutoff frequency range of approximately -// 220Hz - 18kHz on a MOS6581 fitted with 470pF capacitors. The function -// mapping FC to cutoff frequency has the shape of the tanh function, with -// a discontinuity at FCHI = 0x80. -// In contrast, the MOS8580 almost perfectly corresponds with the -// specification of a linear mapping from 30Hz to 12kHz. -// -// The mappings have been measured by feeding the SID with an external -// signal since the chip itself is incapable of generating waveforms of -// higher fundamental frequency than 4kHz. It is best to use the bandpass -// output at full resonance to pick out the cutoff frequency at any given -// FC setting. -// -// The mapping function is specified with spline interpolation points and -// the function values are retrieved via table lookup. -// -// NB! Cutoff frequency characteristics may vary, we have modeled two -// particular Commodore 64s. -/* -const fc_point Filter::f0_points_6581[] = -{ - // FC f FCHI FCLO - // ---------------------------- - { 0, 220 }, // 0x00 - repeated end point - { 0, 220 }, // 0x00 - { 128, 230 }, // 0x10 - { 256, 250 }, // 0x20 - { 384, 300 }, // 0x30 - { 512, 420 }, // 0x40 - { 640, 780 }, // 0x50 - { 768, 1600 }, // 0x60 - { 832, 2300 }, // 0x68 - { 896, 3200 }, // 0x70 - { 960, 4300 }, // 0x78 - { 992, 5000 }, // 0x7c - { 1008, 5400 }, // 0x7e - { 1016, 5700 }, // 0x7f - { 1023, 6000 }, // 0x7f 0x07 - { 1023, 6000 }, // 0x7f 0x07 - discontinuity - { 1024, 4600 }, // 0x80 - - { 1024, 4600 }, // 0x80 - { 1032, 4800 }, // 0x81 - { 1056, 5300 }, // 0x84 - { 1088, 6000 }, // 0x88 - { 1120, 6600 }, // 0x8c - { 1152, 7200 }, // 0x90 - { 1280, 9500 }, // 0xa0 - { 1408, 12000 }, // 0xb0 - { 1536, 14500 }, // 0xc0 - { 1664, 16000 }, // 0xd0 - { 1792, 17100 }, // 0xe0 - { 1920, 17700 }, // 0xf0 - { 2047, 18000 }, // 0xff 0x07 - { 2047, 18000 } // 0xff 0x07 - repeated end point -}; -*/ -/* -const fc_point Filter::f0_points_8580[] = -{ - // FC f FCHI FCLO - // ---------------------------- - { 0, 0 }, // 0x00 - repeated end point - { 0, 0 }, // 0x00 - { 128, 800 }, // 0x10 - { 256, 1600 }, // 0x20 - { 384, 2500 }, // 0x30 - { 512, 3300 }, // 0x40 - { 640, 4100 }, // 0x50 - { 768, 4800 }, // 0x60 - { 896, 5600 }, // 0x70 - { 1024, 6500 }, // 0x80 - { 1152, 7500 }, // 0x90 - { 1280, 8400 }, // 0xa0 - { 1408, 9200 }, // 0xb0 - { 1536, 9800 }, // 0xc0 - { 1664, 10500 }, // 0xd0 - { 1792, 11000 }, // 0xe0 - { 1920, 11700 }, // 0xf0 - { 2047, 12500 }, // 0xff 0x07 - { 2047, 12500 } // 0xff 0x07 - repeated end point -}; -*/ - -// ---------------------------------------------------------------------------- -// Constructor. -// ---------------------------------------------------------------------------- -Filter::Filter() -{ - fc = 0; - - res = 0; - - filt = 0; - - voice3off = 0; - - hp_bp_lp = 0; - - vol = 0; - - // State of filter. - Vhp = 0; - Vbp = 0; - Vlp = 0; - Vnf = 0; - - enable_filter(true); -/* - // Create mappings from FC to cutoff frequency. - interpolate(f0_points_6581, f0_points_6581 - + sizeof(f0_points_6581)/sizeof(*f0_points_6581) - 1, - PointPlotter(f0_6581), 1.0); - - interpolate(f0_points_8580, f0_points_8580 - + sizeof(f0_points_8580)/sizeof(*f0_points_8580) - 1, - PointPlotter(f0_8580), 1.0); -*/ -// set_chip_model(MOS6581); -{//instead: - mixer_DC = -0xfff*0xff/18 >> 7; - - //f0 = f0_6581; - // f0_points = f0_points_6581; - // f0_count = sizeof(f0_points_6581)/sizeof(*f0_points_6581); - set_w0(); - set_Q(); -} - -} - - -// ---------------------------------------------------------------------------- -// Enable filter. -// ---------------------------------------------------------------------------- -void Filter::enable_filter(bool enable) -{ - enabled = enable; -} - - -// ---------------------------------------------------------------------------- -// Set chip model. -// ---------------------------------------------------------------------------- -/* -void Filter::set_chip_model(chip_model model) -{ - if (model == MOS6581) { - // The mixer has a small input DC offset. This is found as follows: - // - // The "zero" output level of the mixer measured on the SID audio - // output pin is 5.50V at zero volume, and 5.44 at full - // volume. This yields a DC offset of (5.44V - 5.50V) = -0.06V. - // - // The DC offset is thus -0.06V/1.05V ~ -1/18 of the dynamic range - // of one voice. See voice.cc for measurement of the dynamic - // range. - - mixer_DC = -0xfff*0xff/18 >> 7; - - f0 = f0_6581; - f0_points = f0_points_6581; - f0_count = sizeof(f0_points_6581)/sizeof(*f0_points_6581); - } - else { - // No DC offsets in the MOS8580. - mixer_DC = 0; - - f0 = f0_8580; - f0_points = f0_points_8580; - f0_count = sizeof(f0_points_8580)/sizeof(*f0_points_8580); - } - - set_w0(); - set_Q(); -} -*/ - - -// ---------------------------------------------------------------------------- -// SID reset. -// ---------------------------------------------------------------------------- -void Filter::reset() -{ - fc = 0; - - res = 0; - - filt = 0; - - voice3off = 0; - - hp_bp_lp = 0; - - vol = 0; - - // State of filter. - Vhp = 0; - Vbp = 0; - Vlp = 0; - Vnf = 0; - - set_w0(); - set_Q(); -} - - -// ---------------------------------------------------------------------------- -// Register functions. -// ---------------------------------------------------------------------------- -void Filter::writeFC_LO(reg8 fc_lo) -{ - fc = (fc & 0x7f8) | (fc_lo & 0x007); - set_w0(); -} - -void Filter::writeFC_HI(reg8 fc_hi) -{ - fc = (((unsigned int)fc_hi << 3) & 0x7f8) | (fc & 0x007); - set_w0(); -} - -void Filter::writeRES_FILT(reg8 res_filt) -{ - res = (res_filt >> 4) & 0x0f; - set_Q(); - - filt = res_filt & 0x0f; -} - -void Filter::writeMODE_VOL(reg8 mode_vol) -{ - voice3off = mode_vol & 0x80; - - hp_bp_lp = (mode_vol >> 4) & 0x07; - - vol = mode_vol & 0x0f; -} - -// Set filter cutoff frequency. -void Filter::set_w0() -{ - const float pi = 3.1415926535897932385; - - // Multiply with 1.048576 to facilitate division by 1 000 000 by right- - // shifting 20 times (2 ^ 20 = 1048576). - w0 = static_cast(2.0*pi*f0[fc]*1.048576); - - // Limit f0 to 16kHz to keep 1 cycle filter stable. - const sound_sample w0_max_1 = static_cast(2.0*pi*16000.0*1.048576); - w0_ceil_1 = w0 <= w0_max_1 ? w0 : w0_max_1; - - // Limit f0 to 4kHz to keep delta_t cycle filter stable. - const sound_sample w0_max_dt = static_cast(2.0*pi*4000.0*1.048576); - w0_ceil_dt = w0 <= w0_max_dt ? w0 : w0_max_dt; -} - -// Set filter resonance. -void Filter::set_Q() -{ - // Q is controlled linearly by res. Q has approximate range [0.707, 1.7]. - // As resonance is increased, the filter must be clocked more often to keep - // stable. - - // The coefficient 1024 is dispensed of later by right-shifting 10 times - // (2 ^ 10 = 1024). - _1024_div_Q = static_cast(1024.0/(0.707 + 1.0*res/15.0)); -} - -// ---------------------------------------------------------------------------- -// Spline functions. -// ---------------------------------------------------------------------------- - -// ---------------------------------------------------------------------------- -// Return the array of spline interpolation points used to map the FC register -// to filter cutoff frequency. -// ---------------------------------------------------------------------------- -/* -void Filter::fc_default(const fc_point*& points, int& count) -{ - points = f0_points; - count = f0_count; -} -*/ -// ---------------------------------------------------------------------------- -// Given an array of interpolation points p with n points, the following -// statement will specify a new FC mapping: -// interpolate(p, p + n - 1, filter.fc_plotter(), 1.0); -// Note that the x range of the interpolation points *must* be [0, 2047], -// and that additional end points *must* be present since the end points -// are not interpolated. -// ---------------------------------------------------------------------------- -/* -PointPlotter Filter::fc_plotter() -{ - return PointPlotter(f0); -} -*/ -RESID_NAMESPACE_STOP diff --git a/MCUME_pico/picosnd/reSID/filter.h b/MCUME_pico/picosnd/reSID/filter.h deleted file mode 100755 index 24cc5ce..0000000 --- a/MCUME_pico/picosnd/reSID/filter.h +++ /dev/null @@ -1,539 +0,0 @@ -// --------------------------------------------------------------------------- -// This file is part of reSID, a MOS6581 SID emulator engine. -// Copyright (C) 2004 Dag Lem -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// --------------------------------------------------------------------------- - -#ifndef __FILTER_H__ -#define __FILTER_H__ - -#include "siddefs.h" -//#include "spline.h" -#include "filter6581.h" - -RESID_NAMESPACE_START - -// ---------------------------------------------------------------------------- -// The SID filter is modeled with a two-integrator-loop biquadratic filter, -// which has been confirmed by Bob Yannes to be the actual circuit used in -// the SID chip. -// -// Measurements show that excellent emulation of the SID filter is achieved, -// except when high resonance is combined with high sustain levels. -// In this case the SID op-amps are performing less than ideally and are -// causing some peculiar behavior of the SID filter. This however seems to -// have more effect on the overall amplitude than on the color of the sound. -// -// The theory for the filter circuit can be found in "Microelectric Circuits" -// by Adel S. Sedra and Kenneth C. Smith. -// The circuit is modeled based on the explanation found there except that -// an additional inverter is used in the feedback from the bandpass output, -// allowing the summer op-amp to operate in single-ended mode. This yields -// inverted filter outputs with levels independent of Q, which corresponds with -// the results obtained from a real SID. -// -// We have been able to model the summer and the two integrators of the circuit -// to form components of an IIR filter. -// Vhp is the output of the summer, Vbp is the output of the first integrator, -// and Vlp is the output of the second integrator in the filter circuit. -// -// According to Bob Yannes, the active stages of the SID filter are not really -// op-amps. Rather, simple NMOS inverters are used. By biasing an inverter -// into its region of quasi-linear operation using a feedback resistor from -// input to output, a MOS inverter can be made to act like an op-amp for -// small signals centered around the switching threshold. -// -// Qualified guesses at SID filter schematics are depicted below. -// -// SID filter -// ---------- -// -// ----------------------------------------------- -// | | -// | ---Rq-- | -// | | | | -// | --------------|--R-----[A>--|--R-----[A>--| -// | | | | -// vi -----R1-- | | | -// -// vhp vbp vlp -// -// -// vi - input voltage -// vhp - highpass output -// vbp - bandpass output -// vlp - lowpass output -// [A> - op-amp -// R1 - summer resistor -// Rq - resistor array controlling resonance (4 resistors) -// R - NMOS FET voltage controlled resistor controlling cutoff frequency -// Rs - shunt resitor -// C - capacitor -// -// -// -// SID integrator -// -------------- -// -// V+ -// -// | -// | -// -----| -// | | -// | ||-- -// -|| -// ---C--- ||-> -// | | | -// |---Rs-----------|---- vo -// | | -// | ||-- -// vi ---- -----|------------|| -// | ^ | ||-> -// |___| | | -// ----- | | -// | | | -// |---R2-- | -// | -// R1 V- -// | -// | -// -// Vw -// -// ---------------------------------------------------------------------------- -class Filter -{ -public: - Filter(); - - void enable_filter(bool enable); - // void set_chip_model(chip_model model); - - RESID_INLINE - void clock(sound_sample voice1, sound_sample voice2, sound_sample voice3, - sound_sample ext_in); - RESID_INLINE - void clock(cycle_count delta_t, - sound_sample voice1, sound_sample voice2, sound_sample voice3, - sound_sample ext_in); - void reset(); - - // Write registers. - void writeFC_LO(reg8); - void writeFC_HI(reg8); - void writeRES_FILT(reg8); - void writeMODE_VOL(reg8); - - // SID audio output (16 bits). - sound_sample output(); - - // Spline functions. - // void fc_default(const fc_point*& points, int& count); - // PointPlotter fc_plotter(); - -protected: - void set_w0(); - void set_Q(); - - // Filter enabled. - bool enabled; - - // Filter cutoff frequency. - reg12 fc; - - // Filter resonance. - reg8 res; - - // Selects which inputs to route through filter. - reg8 filt; - - // Switch voice 3 off. - reg8 voice3off; - - // Highpass, bandpass, and lowpass filter modes. - reg8 hp_bp_lp; - - // Output master volume. - reg4 vol; - - // Mixer DC offset. - sound_sample mixer_DC; - - // State of filter. - sound_sample Vhp; // highpass - sound_sample Vbp; // bandpass - sound_sample Vlp; // lowpass - sound_sample Vnf; // not filtered - - // Cutoff frequency, resonance. - sound_sample w0, w0_ceil_1, w0_ceil_dt; - sound_sample _1024_div_Q; - - // Cutoff frequency tables. - // FC is an 11 bit register. - //sound_sample f0_6581[2048]; - //sound_sample f0_8580[2048]; - //sound_sample* f0; - //const sound_sample* f0 = filter6581; - const short* f0 = filter6581; - //const static fc_point f0_points_6581[]; - - //const static fc_point f0_points_8580[]; - //const fc_point* f0_points; - //int f0_count; - -friend class SID; -}; - - -// ---------------------------------------------------------------------------- -// Inline functions. -// The following functions are defined inline because they are called every -// time a sample is calculated. -// ---------------------------------------------------------------------------- - -#if RESID_INLINING || defined(__FILTER_CC__) - -// ---------------------------------------------------------------------------- -// SID clocking - 1 cycle. -// ---------------------------------------------------------------------------- -RESID_INLINE -void Filter::clock(sound_sample voice1, - sound_sample voice2, - sound_sample voice3, - sound_sample ext_in) -{ - // Scale each voice down from 20 to 13 bits. - voice1 >>= 7; - voice2 >>= 7; - - // NB! Voice 3 is not silenced by voice3off if it is routed through - // the filter. - if (voice3off && !(filt & 0x04)) { - voice3 = 0; - } - else { - voice3 >>= 7; - } - - ext_in >>= 7; - - // This is handy for testing. - if (!enabled) { - Vnf = voice1 + voice2 + voice3 + ext_in; - Vhp = Vbp = Vlp = 0; - return; - } - - // Route voices into or around filter. - // The code below is expanded to a switch for faster execution. - // (filt1 ? Vi : Vnf) += voice1; - // (filt2 ? Vi : Vnf) += voice2; - // (filt3 ? Vi : Vnf) += voice3; - - sound_sample Vi; - - switch (filt) { - default: - case 0x0: - Vi = 0; - Vnf = voice1 + voice2 + voice3 + ext_in; - break; - case 0x1: - Vi = voice1; - Vnf = voice2 + voice3 + ext_in; - break; - case 0x2: - Vi = voice2; - Vnf = voice1 + voice3 + ext_in; - break; - case 0x3: - Vi = voice1 + voice2; - Vnf = voice3 + ext_in; - break; - case 0x4: - Vi = voice3; - Vnf = voice1 + voice2 + ext_in; - break; - case 0x5: - Vi = voice1 + voice3; - Vnf = voice2 + ext_in; - break; - case 0x6: - Vi = voice2 + voice3; - Vnf = voice1 + ext_in; - break; - case 0x7: - Vi = voice1 + voice2 + voice3; - Vnf = ext_in; - break; - case 0x8: - Vi = ext_in; - Vnf = voice1 + voice2 + voice3; - break; - case 0x9: - Vi = voice1 + ext_in; - Vnf = voice2 + voice3; - break; - case 0xa: - Vi = voice2 + ext_in; - Vnf = voice1 + voice3; - break; - case 0xb: - Vi = voice1 + voice2 + ext_in; - Vnf = voice3; - break; - case 0xc: - Vi = voice3 + ext_in; - Vnf = voice1 + voice2; - break; - case 0xd: - Vi = voice1 + voice3 + ext_in; - Vnf = voice2; - break; - case 0xe: - Vi = voice2 + voice3 + ext_in; - Vnf = voice1; - break; - case 0xf: - Vi = voice1 + voice2 + voice3 + ext_in; - Vnf = 0; - break; - } - - // delta_t = 1 is converted to seconds given a 1MHz clock by dividing - // with 1 000 000. - - // Calculate filter outputs. - // Vhp = Vbp/Q - Vlp - Vi; - // dVbp = -w0*Vhp*dt; - // dVlp = -w0*Vbp*dt; - - sound_sample dVbp = (w0_ceil_1*Vhp >> 20); - sound_sample dVlp = (w0_ceil_1*Vbp >> 20); - Vbp -= dVbp; - Vlp -= dVlp; - Vhp = (Vbp*_1024_div_Q >> 10) - Vlp - Vi; -} - -// ---------------------------------------------------------------------------- -// SID clocking - delta_t cycles. -// ---------------------------------------------------------------------------- -RESID_INLINE -void Filter::clock(cycle_count delta_t, - sound_sample voice1, - sound_sample voice2, - sound_sample voice3, - sound_sample ext_in) -{ - // Scale each voice down from 20 to 13 bits. - voice1 >>= 7; - voice2 >>= 7; - - // NB! Voice 3 is not silenced by voice3off if it is routed through - // the filter. - if (voice3off && !(filt & 0x04)) { - voice3 = 0; - } - else { - voice3 >>= 7; - } - - ext_in >>= 7; - - // Enable filter on/off. - // This is not really part of SID, but is useful for testing. - // On slow CPUs it may be necessary to bypass the filter to lower the CPU - // load. - if (!enabled) { - Vnf = voice1 + voice2 + voice3 + ext_in; - Vhp = Vbp = Vlp = 0; - return; - } - - // Route voices into or around filter. - // The code below is expanded to a switch for faster execution. - // (filt1 ? Vi : Vnf) += voice1; - // (filt2 ? Vi : Vnf) += voice2; - // (filt3 ? Vi : Vnf) += voice3; - - sound_sample Vi; - - switch (filt) { - default: - case 0x0: - Vi = 0; - Vnf = voice1 + voice2 + voice3 + ext_in; - break; - case 0x1: - Vi = voice1; - Vnf = voice2 + voice3 + ext_in; - break; - case 0x2: - Vi = voice2; - Vnf = voice1 + voice3 + ext_in; - break; - case 0x3: - Vi = voice1 + voice2; - Vnf = voice3 + ext_in; - break; - case 0x4: - Vi = voice3; - Vnf = voice1 + voice2 + ext_in; - break; - case 0x5: - Vi = voice1 + voice3; - Vnf = voice2 + ext_in; - break; - case 0x6: - Vi = voice2 + voice3; - Vnf = voice1 + ext_in; - break; - case 0x7: - Vi = voice1 + voice2 + voice3; - Vnf = ext_in; - break; - case 0x8: - Vi = ext_in; - Vnf = voice1 + voice2 + voice3; - break; - case 0x9: - Vi = voice1 + ext_in; - Vnf = voice2 + voice3; - break; - case 0xa: - Vi = voice2 + ext_in; - Vnf = voice1 + voice3; - break; - case 0xb: - Vi = voice1 + voice2 + ext_in; - Vnf = voice3; - break; - case 0xc: - Vi = voice3 + ext_in; - Vnf = voice1 + voice2; - break; - case 0xd: - Vi = voice1 + voice3 + ext_in; - Vnf = voice2; - break; - case 0xe: - Vi = voice2 + voice3 + ext_in; - Vnf = voice1; - break; - case 0xf: - Vi = voice1 + voice2 + voice3 + ext_in; - Vnf = 0; - break; - } - - // Maximum delta cycles for the filter to work satisfactorily under current - // cutoff frequency and resonance constraints is approximately 8. - cycle_count delta_t_flt = 8; - - while (delta_t) { - if (delta_t < delta_t_flt) { - delta_t_flt = delta_t; - } - - // delta_t is converted to seconds given a 1MHz clock by dividing - // with 1 000 000. This is done in two operations to avoid integer - // multiplication overflow. - - // Calculate filter outputs. - // Vhp = Vbp/Q - Vlp - Vi; - // dVbp = -w0*Vhp*dt; - // dVlp = -w0*Vbp*dt; - sound_sample w0_delta_t = w0_ceil_dt * delta_t_flt >> 6; - - sound_sample dVbp = (w0_delta_t*Vhp >> 14); - sound_sample dVlp = (w0_delta_t*Vbp >> 14); - Vbp -= dVbp; - Vlp -= dVlp; - Vhp = (Vbp*_1024_div_Q >> 10) - Vlp - Vi; - - delta_t -= delta_t_flt; - } -} - - -// ---------------------------------------------------------------------------- -// SID audio output (20 bits). -// ---------------------------------------------------------------------------- -RESID_INLINE -sound_sample Filter::output() -{ - // This is handy for testing. - if (!enabled) { - return (Vnf + mixer_DC)*static_cast(vol); - } - - // Mix highpass, bandpass, and lowpass outputs. The sum is not - // weighted, this can be confirmed by sampling sound output for - // e.g. bandpass, lowpass, and bandpass+lowpass from a SID chip. - - // The code below is expanded to a switch for faster execution. - // if (hp) Vf += Vhp; - // if (bp) Vf += Vbp; - // if (lp) Vf += Vlp; - - sound_sample Vf; - - switch (hp_bp_lp) { - default: - case 0x0: - Vf = 0; - break; - case 0x1: - Vf = Vlp; - break; - case 0x2: - Vf = Vbp; - break; - case 0x3: - Vf = Vlp + Vbp; - break; - case 0x4: - Vf = Vhp; - break; - case 0x5: - Vf = Vlp + Vhp; - break; - case 0x6: - Vf = Vbp + Vhp; - break; - case 0x7: - Vf = Vlp + Vbp + Vhp; - break; - } - - // Sum non-filtered and filtered output. - // Multiply the sum with volume. - return (Vnf + Vf + mixer_DC)*static_cast(vol); -} - -#endif // RESID_INLINING || defined(__FILTER_CC__) - -RESID_NAMESPACE_STOP - -#endif // not __FILTER_H__ diff --git a/MCUME_pico/picosnd/reSID/filter6581.h b/MCUME_pico/picosnd/reSID/filter6581.h deleted file mode 100755 index 2f7f796..0000000 --- a/MCUME_pico/picosnd/reSID/filter6581.h +++ /dev/null @@ -1,131 +0,0 @@ - -const short filter6581[] = { -0x00DC, 0x00DC, 0x00DC, 0x00DC, 0x00DC, 0x00DC, 0x00DC, 0x00DC, 0x00DC, 0x00DC, 0x00DC, 0x00DC, 0x00DC, 0x00DC, 0x00DC, 0x00DC, -0x00DC, 0x00DD, 0x00DD, 0x00DD, 0x00DD, 0x00DD, 0x00DD, 0x00DD, 0x00DD, 0x00DD, 0x00DD, 0x00DD, 0x00DD, 0x00DD, 0x00DD, 0x00DD, -0x00DD, 0x00DD, 0x00DE, 0x00DE, 0x00DE, 0x00DE, 0x00DE, 0x00DE, 0x00DE, 0x00DE, 0x00DE, 0x00DE, 0x00DE, 0x00DE, 0x00DE, 0x00DE, -0x00DE, 0x00DF, 0x00DF, 0x00DF, 0x00DF, 0x00DF, 0x00DF, 0x00DF, 0x00DF, 0x00DF, 0x00DF, 0x00DF, 0x00DF, 0x00DF, 0x00DF, 0x00DF, -0x00E0, 0x00E0, 0x00E0, 0x00E0, 0x00E0, 0x00E0, 0x00E0, 0x00E0, 0x00E0, 0x00E0, 0x00E0, 0x00E0, 0x00E0, 0x00E1, 0x00E1, 0x00E1, -0x00E1, 0x00E1, 0x00E1, 0x00E1, 0x00E1, 0x00E1, 0x00E1, 0x00E1, 0x00E1, 0x00E2, 0x00E2, 0x00E2, 0x00E2, 0x00E2, 0x00E2, 0x00E2, -0x00E2, 0x00E2, 0x00E2, 0x00E2, 0x00E3, 0x00E3, 0x00E3, 0x00E3, 0x00E3, 0x00E3, 0x00E3, 0x00E3, 0x00E3, 0x00E3, 0x00E4, 0x00E4, -0x00E4, 0x00E4, 0x00E4, 0x00E4, 0x00E4, 0x00E4, 0x00E4, 0x00E4, 0x00E5, 0x00E5, 0x00E5, 0x00E5, 0x00E5, 0x00E5, 0x00E5, 0x00E5, -0x00E6, 0x00E6, 0x00E6, 0x00E6, 0x00E6, 0x00E6, 0x00E6, 0x00E6, 0x00E6, 0x00E7, 0x00E7, 0x00E7, 0x00E7, 0x00E7, 0x00E7, 0x00E7, -0x00E7, 0x00E7, 0x00E8, 0x00E8, 0x00E8, 0x00E8, 0x00E8, 0x00E8, 0x00E8, 0x00E8, 0x00E8, 0x00E9, 0x00E9, 0x00E9, 0x00E9, 0x00E9, -0x00E9, 0x00E9, 0x00E9, 0x00E9, 0x00EA, 0x00EA, 0x00EA, 0x00EA, 0x00EA, 0x00EA, 0x00EA, 0x00EA, 0x00EA, 0x00EB, 0x00EB, 0x00EB, -0x00EB, 0x00EB, 0x00EB, 0x00EB, 0x00EB, 0x00EC, 0x00EC, 0x00EC, 0x00EC, 0x00EC, 0x00EC, 0x00EC, 0x00EC, 0x00ED, 0x00ED, 0x00ED, -0x00ED, 0x00ED, 0x00ED, 0x00ED, 0x00EE, 0x00EE, 0x00EE, 0x00EE, 0x00EE, 0x00EE, 0x00EE, 0x00EF, 0x00EF, 0x00EF, 0x00EF, 0x00EF, -0x00EF, 0x00F0, 0x00F0, 0x00F0, 0x00F0, 0x00F0, 0x00F0, 0x00F1, 0x00F1, 0x00F1, 0x00F1, 0x00F1, 0x00F1, 0x00F2, 0x00F2, 0x00F2, -0x00F2, 0x00F2, 0x00F3, 0x00F3, 0x00F3, 0x00F3, 0x00F3, 0x00F4, 0x00F4, 0x00F4, 0x00F4, 0x00F4, 0x00F5, 0x00F5, 0x00F5, 0x00F5, -0x00F5, 0x00F6, 0x00F6, 0x00F6, 0x00F6, 0x00F7, 0x00F7, 0x00F7, 0x00F7, 0x00F8, 0x00F8, 0x00F8, 0x00F8, 0x00F9, 0x00F9, 0x00F9, -0x00FA, 0x00FA, 0x00FA, 0x00FA, 0x00FB, 0x00FB, 0x00FB, 0x00FB, 0x00FC, 0x00FC, 0x00FC, 0x00FC, 0x00FD, 0x00FD, 0x00FD, 0x00FE, -0x00FE, 0x00FE, 0x00FE, 0x00FF, 0x00FF, 0x00FF, 0x00FF, 0x0100, 0x0100, 0x0100, 0x0101, 0x0101, 0x0101, 0x0101, 0x0102, 0x0102, -0x0102, 0x0103, 0x0103, 0x0103, 0x0103, 0x0104, 0x0104, 0x0104, 0x0105, 0x0105, 0x0105, 0x0105, 0x0106, 0x0106, 0x0106, 0x0107, -0x0107, 0x0107, 0x0108, 0x0108, 0x0108, 0x0109, 0x0109, 0x0109, 0x010A, 0x010A, 0x010A, 0x010B, 0x010B, 0x010B, 0x010C, 0x010C, -0x010C, 0x010D, 0x010D, 0x010D, 0x010E, 0x010E, 0x010E, 0x010F, 0x010F, 0x0110, 0x0110, 0x0110, 0x0111, 0x0111, 0x0111, 0x0112, -0x0112, 0x0113, 0x0113, 0x0114, 0x0114, 0x0114, 0x0115, 0x0115, 0x0116, 0x0116, 0x0117, 0x0117, 0x0117, 0x0118, 0x0118, 0x0119, -0x0119, 0x011A, 0x011A, 0x011B, 0x011B, 0x011C, 0x011C, 0x011D, 0x011D, 0x011E, 0x011E, 0x011F, 0x011F, 0x0120, 0x0121, 0x0121, -0x0122, 0x0122, 0x0123, 0x0123, 0x0124, 0x0125, 0x0125, 0x0126, 0x0126, 0x0127, 0x0128, 0x0128, 0x0129, 0x012A, 0x012A, 0x012B, -0x012C, 0x012C, 0x012D, 0x012D, 0x012E, 0x012F, 0x012F, 0x0130, 0x0131, 0x0131, 0x0132, 0x0132, 0x0133, 0x0134, 0x0134, 0x0135, -0x0136, 0x0136, 0x0137, 0x0137, 0x0138, 0x0138, 0x0139, 0x013A, 0x013A, 0x013B, 0x013B, 0x013C, 0x013D, 0x013D, 0x013E, 0x013E, -0x013F, 0x0140, 0x0140, 0x0141, 0x0141, 0x0142, 0x0143, 0x0143, 0x0144, 0x0144, 0x0145, 0x0146, 0x0146, 0x0147, 0x0148, 0x0148, -0x0149, 0x0149, 0x014A, 0x014B, 0x014B, 0x014C, 0x014D, 0x014E, 0x014E, 0x014F, 0x0150, 0x0150, 0x0151, 0x0152, 0x0153, 0x0153, -0x0154, 0x0155, 0x0156, 0x0156, 0x0157, 0x0158, 0x0159, 0x015A, 0x015B, 0x015B, 0x015C, 0x015D, 0x015E, 0x015F, 0x0160, 0x0161, -0x0162, 0x0163, 0x0164, 0x0165, 0x0166, 0x0167, 0x0168, 0x0169, 0x016A, 0x016B, 0x016C, 0x016D, 0x016E, 0x016F, 0x0171, 0x0172, -0x0173, 0x0174, 0x0175, 0x0177, 0x0178, 0x0179, 0x017A, 0x017C, 0x017D, 0x017F, 0x0180, 0x0181, 0x0183, 0x0184, 0x0186, 0x0187, -0x0189, 0x018A, 0x018C, 0x018D, 0x018F, 0x0190, 0x0192, 0x0194, 0x0195, 0x0197, 0x0199, 0x019A, 0x019C, 0x019E, 0x01A0, 0x01A2, -0x01A4, 0x01A5, 0x01A7, 0x01A9, 0x01AB, 0x01AD, 0x01AF, 0x01B1, 0x01B3, 0x01B4, 0x01B6, 0x01B8, 0x01BA, 0x01BC, 0x01BE, 0x01C0, -0x01C2, 0x01C4, 0x01C6, 0x01C8, 0x01CA, 0x01CC, 0x01CE, 0x01D0, 0x01D2, 0x01D4, 0x01D6, 0x01D8, 0x01DA, 0x01DC, 0x01DE, 0x01E0, -0x01E2, 0x01E4, 0x01E6, 0x01E8, 0x01EA, 0x01EC, 0x01EF, 0x01F1, 0x01F3, 0x01F5, 0x01F7, 0x01F9, 0x01FC, 0x01FE, 0x0200, 0x0202, -0x0205, 0x0207, 0x0209, 0x020C, 0x020E, 0x0210, 0x0213, 0x0215, 0x0218, 0x021A, 0x021D, 0x021F, 0x0222, 0x0224, 0x0227, 0x0229, -0x022C, 0x022E, 0x0231, 0x0234, 0x0236, 0x0239, 0x023C, 0x023E, 0x0241, 0x0244, 0x0247, 0x024A, 0x024D, 0x024F, 0x0252, 0x0255, -0x0258, 0x025B, 0x025E, 0x0261, 0x0264, 0x0267, 0x026B, 0x026E, 0x0271, 0x0274, 0x0277, 0x027B, 0x027E, 0x0281, 0x0285, 0x0288, -0x028C, 0x028F, 0x0292, 0x0296, 0x029A, 0x029D, 0x02A1, 0x02A4, 0x02A8, 0x02AC, 0x02B0, 0x02B3, 0x02B7, 0x02BB, 0x02BF, 0x02C3, -0x02C7, 0x02CB, 0x02CF, 0x02D3, 0x02D7, 0x02DB, 0x02DF, 0x02E4, 0x02E8, 0x02EC, 0x02F1, 0x02F5, 0x02F9, 0x02FE, 0x0302, 0x0307, -0x030C, 0x0310, 0x0315, 0x0319, 0x031E, 0x0323, 0x0328, 0x032D, 0x0331, 0x0336, 0x033B, 0x0340, 0x0345, 0x034A, 0x034F, 0x0354, -0x0359, 0x035E, 0x0364, 0x0369, 0x036E, 0x0373, 0x0379, 0x037E, 0x0383, 0x0389, 0x038E, 0x0393, 0x0399, 0x039E, 0x03A4, 0x03AA, -0x03AF, 0x03B5, 0x03BA, 0x03C0, 0x03C6, 0x03CB, 0x03D1, 0x03D7, 0x03DD, 0x03E3, 0x03E9, 0x03EE, 0x03F4, 0x03FA, 0x0400, 0x0406, -0x040C, 0x0412, 0x0418, 0x041F, 0x0425, 0x042B, 0x0431, 0x0437, 0x043E, 0x0444, 0x044A, 0x0451, 0x0457, 0x045D, 0x0464, 0x046A, -0x0471, 0x0477, 0x047E, 0x0484, 0x048B, 0x0491, 0x0498, 0x049F, 0x04A5, 0x04AC, 0x04B3, 0x04B9, 0x04C0, 0x04C7, 0x04CE, 0x04D5, -0x04DB, 0x04E2, 0x04E9, 0x04F0, 0x04F7, 0x04FE, 0x0505, 0x050C, 0x0513, 0x051A, 0x0521, 0x0529, 0x0530, 0x0537, 0x053E, 0x0545, -0x054D, 0x0554, 0x055B, 0x0562, 0x056A, 0x0571, 0x0578, 0x0580, 0x0587, 0x058F, 0x0596, 0x059E, 0x05A5, 0x05AD, 0x05B4, 0x05BC, -0x05C3, 0x05CB, 0x05D3, 0x05DA, 0x05E2, 0x05EA, 0x05F1, 0x05F9, 0x0601, 0x0609, 0x0610, 0x0618, 0x0620, 0x0628, 0x0630, 0x0638, -0x0640, 0x0647, 0x0650, 0x0658, 0x0660, 0x0669, 0x0671, 0x067A, 0x0683, 0x068C, 0x0695, 0x069F, 0x06A8, 0x06B1, 0x06BB, 0x06C5, -0x06CF, 0x06D9, 0x06E3, 0x06ED, 0x06F7, 0x0701, 0x070C, 0x0716, 0x0721, 0x072C, 0x0736, 0x0741, 0x074C, 0x0757, 0x0762, 0x076E, -0x0779, 0x0784, 0x0790, 0x079B, 0x07A7, 0x07B2, 0x07BE, 0x07CA, 0x07D5, 0x07E1, 0x07ED, 0x07F9, 0x0805, 0x0811, 0x081D, 0x0829, -0x0835, 0x0842, 0x084E, 0x085A, 0x0866, 0x0873, 0x087F, 0x088B, 0x0898, 0x08A4, 0x08B1, 0x08BD, 0x08CA, 0x08D6, 0x08E3, 0x08EF, -0x08FC, 0x0908, 0x0915, 0x0921, 0x092E, 0x093B, 0x0947, 0x0954, 0x0961, 0x096E, 0x097B, 0x0988, 0x0995, 0x09A2, 0x09AF, 0x09BC, -0x09CA, 0x09D7, 0x09E4, 0x09F2, 0x09FF, 0x0A0D, 0x0A1A, 0x0A28, 0x0A36, 0x0A43, 0x0A51, 0x0A5F, 0x0A6D, 0x0A7B, 0x0A88, 0x0A96, -0x0AA5, 0x0AB3, 0x0AC1, 0x0ACF, 0x0ADD, 0x0AEB, 0x0AFA, 0x0B08, 0x0B17, 0x0B25, 0x0B34, 0x0B42, 0x0B51, 0x0B5F, 0x0B6E, 0x0B7D, -0x0B8C, 0x0B9B, 0x0BAA, 0x0BB9, 0x0BC8, 0x0BD7, 0x0BE6, 0x0BF5, 0x0C04, 0x0C13, 0x0C23, 0x0C32, 0x0C41, 0x0C51, 0x0C60, 0x0C70, -0x0C80, 0x0C8F, 0x0C9F, 0x0CAF, 0x0CBE, 0x0CCE, 0x0CDE, 0x0CEE, 0x0CFE, 0x0D0E, 0x0D1E, 0x0D2E, 0x0D3F, 0x0D4F, 0x0D5F, 0x0D6F, -0x0D80, 0x0D90, 0x0DA1, 0x0DB1, 0x0DC2, 0x0DD2, 0x0DE3, 0x0DF4, 0x0E05, 0x0E15, 0x0E26, 0x0E37, 0x0E48, 0x0E59, 0x0E6A, 0x0E7B, -0x0E8D, 0x0E9E, 0x0EAF, 0x0EC0, 0x0ED2, 0x0EE3, 0x0EF5, 0x0F06, 0x0F18, 0x0F29, 0x0F3B, 0x0F4D, 0x0F5E, 0x0F70, 0x0F82, 0x0F94, -0x0FA6, 0x0FB8, 0x0FCA, 0x0FDC, 0x0FEE, 0x1000, 0x1012, 0x1025, 0x1037, 0x1049, 0x105C, 0x106E, 0x1081, 0x1093, 0x10A6, 0x10B9, -0x10CC, 0x10DE, 0x10F2, 0x1105, 0x1119, 0x112D, 0x1141, 0x1156, 0x116B, 0x1180, 0x1195, 0x11AB, 0x11C0, 0x11D6, 0x11EC, 0x1203, -0x1219, 0x122F, 0x1246, 0x125D, 0x1273, 0x128A, 0x12A1, 0x12B8, 0x12CF, 0x12E6, 0x12FD, 0x1314, 0x132B, 0x1343, 0x135A, 0x1371, -0x1388, 0x139E, 0x13B5, 0x13CC, 0x13E4, 0x13FB, 0x1413, 0x142B, 0x1443, 0x145C, 0x1475, 0x148E, 0x14A9, 0x14C3, 0x14DF, 0x14FB, -0x1518, 0x1536, 0x1558, 0x157C, 0x15A3, 0x15CA, 0x15F3, 0x161B, 0x1644, 0x166C, 0x1696, 0x16C0, 0x16EB, 0x1717, 0x1743, 0x1770, -0x11F8, 0x1212, 0x122C, 0x1247, 0x1260, 0x1279, 0x1292, 0x12A9, 0x12C0, 0x12D5, 0x12EB, 0x1300, 0x1315, 0x132A, 0x133F, 0x1354, -0x1369, 0x137D, 0x1392, 0x13A6, 0x13BB, 0x13CF, 0x13E4, 0x13F8, 0x140D, 0x1421, 0x1436, 0x144A, 0x145F, 0x1474, 0x1489, 0x149E, -0x14B4, 0x14C9, 0x14DF, 0x14F4, 0x150A, 0x1520, 0x1536, 0x154D, 0x1563, 0x1579, 0x158F, 0x15A6, 0x15BC, 0x15D3, 0x15E9, 0x1600, -0x1616, 0x162C, 0x1643, 0x1659, 0x166F, 0x1685, 0x169B, 0x16B1, 0x16C7, 0x16DD, 0x16F2, 0x1707, 0x171D, 0x1732, 0x1746, 0x175B, -0x1770, 0x1784, 0x1798, 0x17AC, 0x17BF, 0x17D3, 0x17E6, 0x17F9, 0x180D, 0x1820, 0x1832, 0x1845, 0x1858, 0x186A, 0x187D, 0x188F, -0x18A2, 0x18B4, 0x18C6, 0x18D9, 0x18EB, 0x18FD, 0x190F, 0x1922, 0x1934, 0x1946, 0x1958, 0x196B, 0x197D, 0x1990, 0x19A2, 0x19B5, -0x19C8, 0x19DA, 0x19ED, 0x1A00, 0x1A13, 0x1A26, 0x1A39, 0x1A4B, 0x1A5E, 0x1A71, 0x1A84, 0x1A97, 0x1AAA, 0x1ABD, 0x1AD0, 0x1AE3, -0x1AF6, 0x1B09, 0x1B1C, 0x1B2F, 0x1B41, 0x1B54, 0x1B67, 0x1B7A, 0x1B8C, 0x1B9F, 0x1BB1, 0x1BC4, 0x1BD6, 0x1BE9, 0x1BFB, 0x1C0D, -0x1C20, 0x1C32, 0x1C44, 0x1C56, 0x1C68, 0x1C7A, 0x1C8C, 0x1C9E, 0x1CB0, 0x1CC2, 0x1CD4, 0x1CE6, 0x1CF8, 0x1D0A, 0x1D1C, 0x1D2E, -0x1D40, 0x1D51, 0x1D63, 0x1D75, 0x1D87, 0x1D99, 0x1DAB, 0x1DBD, 0x1DCE, 0x1DE0, 0x1DF2, 0x1E04, 0x1E16, 0x1E27, 0x1E39, 0x1E4B, -0x1E5D, 0x1E6E, 0x1E80, 0x1E92, 0x1EA4, 0x1EB5, 0x1EC7, 0x1ED9, 0x1EEA, 0x1EFC, 0x1F0E, 0x1F20, 0x1F31, 0x1F43, 0x1F55, 0x1F66, -0x1F78, 0x1F8A, 0x1F9C, 0x1FAD, 0x1FBF, 0x1FD1, 0x1FE2, 0x1FF4, 0x2006, 0x2017, 0x2029, 0x203B, 0x204D, 0x205E, 0x2070, 0x2082, -0x2094, 0x20A5, 0x20B7, 0x20C9, 0x20DA, 0x20EC, 0x20FE, 0x2110, 0x2122, 0x2133, 0x2145, 0x2157, 0x2169, 0x217B, 0x218C, 0x219E, -0x21B0, 0x21C2, 0x21D4, 0x21E6, 0x21F8, 0x220A, 0x221B, 0x222D, 0x223F, 0x2251, 0x2263, 0x2275, 0x2287, 0x2299, 0x22AB, 0x22BD, -0x22CF, 0x22E1, 0x22F4, 0x2306, 0x2318, 0x232A, 0x233C, 0x234E, 0x2360, 0x2373, 0x2385, 0x2397, 0x23A9, 0x23BC, 0x23CE, 0x23E0, -0x23F3, 0x2405, 0x2417, 0x242A, 0x243C, 0x244F, 0x2461, 0x2474, 0x2486, 0x2499, 0x24AB, 0x24BE, 0x24D1, 0x24E3, 0x24F6, 0x2509, -0x251C, 0x252E, 0x2541, 0x2554, 0x2567, 0x257A, 0x258C, 0x259F, 0x25B2, 0x25C5, 0x25D8, 0x25EB, 0x25FE, 0x2611, 0x2624, 0x2637, -0x264A, 0x265E, 0x2671, 0x2684, 0x2697, 0x26AA, 0x26BD, 0x26D1, 0x26E4, 0x26F7, 0x270A, 0x271E, 0x2731, 0x2744, 0x2758, 0x276B, -0x277E, 0x2792, 0x27A5, 0x27B9, 0x27CC, 0x27E0, 0x27F3, 0x2806, 0x281A, 0x282D, 0x2841, 0x2855, 0x2868, 0x287C, 0x288F, 0x28A3, -0x28B6, 0x28CA, 0x28DE, 0x28F1, 0x2905, 0x2918, 0x292C, 0x2940, 0x2953, 0x2967, 0x297B, 0x298E, 0x29A2, 0x29B6, 0x29CA, 0x29DD, -0x29F1, 0x2A05, 0x2A18, 0x2A2C, 0x2A40, 0x2A54, 0x2A67, 0x2A7B, 0x2A8F, 0x2AA3, 0x2AB7, 0x2ACA, 0x2ADE, 0x2AF2, 0x2B06, 0x2B19, -0x2B2D, 0x2B41, 0x2B55, 0x2B69, 0x2B7C, 0x2B90, 0x2BA4, 0x2BB8, 0x2BCC, 0x2BDF, 0x2BF3, 0x2C07, 0x2C1B, 0x2C2E, 0x2C42, 0x2C56, -0x2C6A, 0x2C7E, 0x2C91, 0x2CA5, 0x2CB9, 0x2CCD, 0x2CE0, 0x2CF4, 0x2D08, 0x2D1C, 0x2D2F, 0x2D43, 0x2D57, 0x2D6B, 0x2D7E, 0x2D92, -0x2DA6, 0x2DB9, 0x2DCD, 0x2DE1, 0x2DF4, 0x2E08, 0x2E1C, 0x2E2F, 0x2E43, 0x2E56, 0x2E6A, 0x2E7E, 0x2E91, 0x2EA5, 0x2EB8, 0x2ECC, -0x2EE0, 0x2EF3, 0x2F07, 0x2F1A, 0x2F2E, 0x2F42, 0x2F56, 0x2F6A, 0x2F7E, 0x2F92, 0x2FA6, 0x2FBA, 0x2FCE, 0x2FE2, 0x2FF6, 0x300B, -0x301F, 0x3033, 0x3048, 0x305C, 0x3070, 0x3085, 0x3099, 0x30AE, 0x30C3, 0x30D7, 0x30EC, 0x3100, 0x3115, 0x312A, 0x313E, 0x3153, -0x3168, 0x317D, 0x3191, 0x31A6, 0x31BB, 0x31D0, 0x31E5, 0x31F9, 0x320E, 0x3223, 0x3238, 0x324D, 0x3262, 0x3276, 0x328B, 0x32A0, -0x32B5, 0x32CA, 0x32DF, 0x32F3, 0x3308, 0x331D, 0x3332, 0x3346, 0x335B, 0x3370, 0x3384, 0x3399, 0x33AE, 0x33C2, 0x33D7, 0x33EB, -0x3400, 0x3414, 0x3429, 0x343D, 0x3452, 0x3466, 0x347A, 0x348F, 0x34A3, 0x34B7, 0x34CB, 0x34DF, 0x34F3, 0x3507, 0x351B, 0x352F, -0x3543, 0x3557, 0x356B, 0x357F, 0x3592, 0x35A6, 0x35B9, 0x35CD, 0x35E0, 0x35F3, 0x3607, 0x361A, 0x362D, 0x3640, 0x3653, 0x3666, -0x3679, 0x368C, 0x369E, 0x36B1, 0x36C3, 0x36D6, 0x36E8, 0x36FA, 0x370D, 0x371F, 0x3731, 0x3743, 0x3754, 0x3766, 0x3778, 0x3789, -0x379B, 0x37AC, 0x37BD, 0x37CF, 0x37E0, 0x37F1, 0x3801, 0x3812, 0x3823, 0x3833, 0x3844, 0x3854, 0x3864, 0x3874, 0x3884, 0x3894, -0x38A4, 0x38B3, 0x38C3, 0x38D2, 0x38E1, 0x38F0, 0x3900, 0x390F, 0x391D, 0x392C, 0x393B, 0x394A, 0x3958, 0x3967, 0x3975, 0x3983, -0x3992, 0x39A0, 0x39AE, 0x39BC, 0x39CA, 0x39D7, 0x39E5, 0x39F3, 0x3A00, 0x3A0E, 0x3A1B, 0x3A29, 0x3A36, 0x3A43, 0x3A50, 0x3A5D, -0x3A6A, 0x3A77, 0x3A84, 0x3A91, 0x3A9D, 0x3AAA, 0x3AB7, 0x3AC3, 0x3AD0, 0x3ADC, 0x3AE8, 0x3AF4, 0x3B01, 0x3B0D, 0x3B19, 0x3B25, -0x3B31, 0x3B3D, 0x3B49, 0x3B54, 0x3B60, 0x3B6C, 0x3B77, 0x3B83, 0x3B8E, 0x3B9A, 0x3BA5, 0x3BB1, 0x3BBC, 0x3BC7, 0x3BD3, 0x3BDE, -0x3BE9, 0x3BF4, 0x3BFF, 0x3C0A, 0x3C15, 0x3C20, 0x3C2B, 0x3C36, 0x3C41, 0x3C4C, 0x3C56, 0x3C61, 0x3C6C, 0x3C76, 0x3C81, 0x3C8C, -0x3C96, 0x3CA1, 0x3CAB, 0x3CB6, 0x3CC0, 0x3CCB, 0x3CD5, 0x3CDF, 0x3CEA, 0x3CF4, 0x3CFF, 0x3D09, 0x3D13, 0x3D1D, 0x3D28, 0x3D32, -0x3D3C, 0x3D46, 0x3D50, 0x3D5B, 0x3D65, 0x3D6F, 0x3D79, 0x3D83, 0x3D8D, 0x3D97, 0x3DA1, 0x3DAC, 0x3DB6, 0x3DC0, 0x3DCA, 0x3DD4, -0x3DDE, 0x3DE8, 0x3DF2, 0x3DFC, 0x3E06, 0x3E10, 0x3E1A, 0x3E24, 0x3E2F, 0x3E39, 0x3E43, 0x3E4D, 0x3E57, 0x3E61, 0x3E6B, 0x3E75, -0x3E80, 0x3E8A, 0x3E94, 0x3E9E, 0x3EA8, 0x3EB2, 0x3EBC, 0x3EC6, 0x3ED0, 0x3EDA, 0x3EE4, 0x3EEE, 0x3EF8, 0x3F02, 0x3F0C, 0x3F16, -0x3F20, 0x3F29, 0x3F33, 0x3F3D, 0x3F47, 0x3F51, 0x3F5A, 0x3F64, 0x3F6E, 0x3F77, 0x3F81, 0x3F8B, 0x3F94, 0x3F9E, 0x3FA7, 0x3FB1, -0x3FBA, 0x3FC4, 0x3FCD, 0x3FD7, 0x3FE0, 0x3FEA, 0x3FF3, 0x3FFC, 0x4006, 0x400F, 0x4018, 0x4021, 0x402B, 0x4034, 0x403D, 0x4046, -0x404F, 0x4058, 0x4061, 0x406A, 0x4074, 0x407D, 0x4085, 0x408E, 0x4097, 0x40A0, 0x40A9, 0x40B2, 0x40BB, 0x40C4, 0x40CC, 0x40D5, -0x40DE, 0x40E6, 0x40EF, 0x40F8, 0x4100, 0x4109, 0x4111, 0x411A, 0x4122, 0x412B, 0x4133, 0x413C, 0x4144, 0x414C, 0x4155, 0x415D, -0x4165, 0x416D, 0x4176, 0x417E, 0x4186, 0x418E, 0x4196, 0x419E, 0x41A6, 0x41AE, 0x41B6, 0x41BE, 0x41C6, 0x41CE, 0x41D5, 0x41DD, -0x41E5, 0x41ED, 0x41F4, 0x41FC, 0x4204, 0x420B, 0x4213, 0x421A, 0x4222, 0x4229, 0x4231, 0x4238, 0x4240, 0x4247, 0x424E, 0x4255, -0x425D, 0x4264, 0x426B, 0x4272, 0x4279, 0x4280, 0x4287, 0x428E, 0x4295, 0x429C, 0x42A3, 0x42AA, 0x42B1, 0x42B7, 0x42BE, 0x42C5, -0x42CC, 0x42D2, 0x42D9, 0x42DF, 0x42E6, 0x42EC, 0x42F3, 0x42F9, 0x42FF, 0x4306, 0x430C, 0x4312, 0x4318, 0x431E, 0x4324, 0x432A, -0x4330, 0x4336, 0x433C, 0x4342, 0x4348, 0x434E, 0x4354, 0x4359, 0x435F, 0x4365, 0x436A, 0x4370, 0x4376, 0x437B, 0x4381, 0x4386, -0x438C, 0x4391, 0x4396, 0x439C, 0x43A1, 0x43A6, 0x43AC, 0x43B1, 0x43B6, 0x43BB, 0x43C0, 0x43C5, 0x43CA, 0x43CF, 0x43D4, 0x43D9, -0x43DE, 0x43E3, 0x43E8, 0x43ED, 0x43F2, 0x43F6, 0x43FB, 0x4400, 0x4405, 0x4409, 0x440E, 0x4413, 0x4417, 0x441C, 0x4420, 0x4425, -0x4429, 0x442E, 0x4432, 0x4437, 0x443B, 0x443F, 0x4444, 0x4448, 0x444C, 0x4451, 0x4455, 0x4459, 0x445D, 0x4462, 0x4466, 0x446A, -0x446E, 0x4472, 0x4476, 0x447B, 0x447F, 0x4483, 0x4487, 0x448B, 0x448F, 0x4493, 0x4497, 0x449B, 0x449F, 0x44A2, 0x44A6, 0x44AA, -0x44AE, 0x44B2, 0x44B6, 0x44BA, 0x44BD, 0x44C1, 0x44C5, 0x44C9, 0x44CC, 0x44D0, 0x44D4, 0x44D8, 0x44DB, 0x44DF, 0x44E3, 0x44E6, -0x44EA, 0x44EE, 0x44F1, 0x44F5, 0x44F9, 0x44FC, 0x4500, 0x4503, 0x4507, 0x450B, 0x450E, 0x4512, 0x4515, 0x4519, 0x451C, 0x4520, -0x4524, 0x4527, 0x452B, 0x452E, 0x4531, 0x4535, 0x4538, 0x453C, 0x453F, 0x4542, 0x4545, 0x4549, 0x454C, 0x454F, 0x4552, 0x4555, -0x4559, 0x455C, 0x455F, 0x4562, 0x4565, 0x4568, 0x456B, 0x456E, 0x4571, 0x4574, 0x4577, 0x4579, 0x457C, 0x457F, 0x4582, 0x4585, -0x4588, 0x458A, 0x458D, 0x4590, 0x4592, 0x4595, 0x4598, 0x459A, 0x459D, 0x45A0, 0x45A2, 0x45A5, 0x45A7, 0x45AA, 0x45AC, 0x45AF, -0x45B1, 0x45B4, 0x45B6, 0x45B8, 0x45BB, 0x45BD, 0x45C0, 0x45C2, 0x45C4, 0x45C7, 0x45C9, 0x45CB, 0x45CD, 0x45D0, 0x45D2, 0x45D4, -0x45D6, 0x45D9, 0x45DB, 0x45DD, 0x45DF, 0x45E1, 0x45E3, 0x45E6, 0x45E8, 0x45EA, 0x45EC, 0x45EE, 0x45F0, 0x45F2, 0x45F4, 0x45F6, -0x45F8, 0x45FA, 0x45FC, 0x45FE, 0x4600, 0x4602, 0x4604, 0x4606, 0x4608, 0x460A, 0x460C, 0x460E, 0x4610, 0x4612, 0x4614, 0x4615, -0x4617, 0x4619, 0x461B, 0x461D, 0x461F, 0x4621, 0x4622, 0x4624, 0x4626, 0x4628, 0x462A, 0x462C, 0x462D, 0x462F, 0x4631, 0x4633, -0x4635, 0x4637, 0x4638, 0x463A, 0x463C, 0x463E, 0x463F, 0x4641, 0x4643, 0x4645, 0x4647, 0x4648, 0x464A, 0x464C, 0x464E, 0x464F, -}; diff --git a/MCUME_pico/picosnd/reSID/pot.cpp b/MCUME_pico/picosnd/reSID/pot.cpp deleted file mode 100755 index 25ad24e..0000000 --- a/MCUME_pico/picosnd/reSID/pot.cpp +++ /dev/null @@ -1,30 +0,0 @@ -// --------------------------------------------------------------------------- -// This file is part of reSID, a MOS6581 SID emulator engine. -// Copyright (C) 2004 Dag Lem -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// --------------------------------------------------------------------------- - -#include "pot.h" - -RESID_NAMESPACE_START - -reg8 Potentiometer::readPOT() -{ - // NB! Not modeled. - return 0xff; -} - -RESID_NAMESPACE_STOP diff --git a/MCUME_pico/picosnd/reSID/pot.h b/MCUME_pico/picosnd/reSID/pot.h deleted file mode 100755 index 5bed353..0000000 --- a/MCUME_pico/picosnd/reSID/pot.h +++ /dev/null @@ -1,35 +0,0 @@ -// --------------------------------------------------------------------------- -// This file is part of reSID, a MOS6581 SID emulator engine. -// Copyright (C) 2004 Dag Lem -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// --------------------------------------------------------------------------- - -#ifndef __POT_H__ -#define __POT_H__ - -#include "siddefs.h" - -RESID_NAMESPACE_START - -class Potentiometer -{ -public: - reg8 readPOT(); -}; - -RESID_NAMESPACE_STOP - -#endif diff --git a/MCUME_pico/picosnd/reSID/sid.cpp b/MCUME_pico/picosnd/reSID/sid.cpp deleted file mode 100755 index de73cce..0000000 --- a/MCUME_pico/picosnd/reSID/sid.cpp +++ /dev/null @@ -1,771 +0,0 @@ -// --------------------------------------------------------------------------- -// This file is part of reSID, a MOS6581 SID emulator engine. -// Copyright (C) 2004 Dag Lem -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// --------------------------------------------------------------------------- - -#include "sid.h" -#include - -RESID_NAMESPACE_START - -// Resampling constants. -// The error in interpolated lookup is bounded by 1.234/L^2, -// while the error in non-interpolated lookup is bounded by -// 0.7854/L + 0.4113/L^2, see -// http://www-ccrma.stanford.edu/~jos/resample/Choice_Table_Size.html -// For a resolution of 16 bits this yields L >= 285 and L >= 51473, -// respectively. -const int SID::FIR_N = 125; -const int SID::FIR_RES_INTERPOLATE = 285; -const int SID::FIR_RES_FAST = 51473; -const int SID::FIR_SHIFT = 15; -const int SID::RINGSIZE = 16384; - -// Fixpoint constants (16.16 bits). -const int SID::FIXP_SHIFT = 16; -const int SID::FIXP_MASK = 0xffff; - -// ---------------------------------------------------------------------------- -// Constructor. -// ---------------------------------------------------------------------------- -SID::SID() -{ - - voice[0].set_sync_source(&voice[2]); - voice[1].set_sync_source(&voice[0]); - voice[2].set_sync_source(&voice[1]); - - set_sampling_parameters(985248, SAMPLE_FAST, 22050); - - bus_value = 0; - bus_value_ttl = 0; - - ext_in = 0; - -} -/* -void SID::printFilter(void){ - Serial.print(filter.f0_count); - for (int i=0; i< 2048; i++) { - if (i % 16==0) Serial.println(); - Serial.printf("0x%04X, ",filter.f0_6581[i]); - } -} -*/ -// ---------------------------------------------------------------------------- -// Destructor. -// ---------------------------------------------------------------------------- -SID::~SID() -{ -} - - -// ---------------------------------------------------------------------------- -// Set chip model. -// ---------------------------------------------------------------------------- -/* -void SID::set_chip_model(chip_model model) -{ - voice[0].set_chip_model(model); - voice[1].set_chip_model(model); - voice[2].set_chip_model(model); - - filter.set_chip_model(model); - extfilt.set_chip_model(model); -} -*/ - -// ---------------------------------------------------------------------------- -// SID reset. -// ---------------------------------------------------------------------------- -void SID::reset() -{ - - voice[0].reset(); - voice[1].reset(); - voice[2].reset(); - - filter.reset(); - extfilt.reset(); - - bus_value = 0; - bus_value_ttl = 0; -} - - -// ---------------------------------------------------------------------------- -// Write 16-bit sample to audio input. -// NB! The caller is responsible for keeping the value within 16 bits. -// Note that to mix in an external audio signal, the signal should be -// resampled to 1MHz first to avoid sampling noise. -// ---------------------------------------------------------------------------- -void SID::input(int sample) -{ - // Voice outputs are 20 bits. Scale up to match three voices in order - // to facilitate simulation of the MOS8580 "digi boost" hardware hack. - ext_in = (sample << 4)*3; -} - -// ---------------------------------------------------------------------------- -// Read sample from audio output. -// ---------------------------------------------------------------------------- -int SID::output() -{ - const int range = 1 << 16; - const int half = range >> 1; - int sample = extfilt.output()/((4095*255 >> 7)*3*15*2/range); - - //asm ("ssat %0, #16, %1" : "=r" (sample) : "r" (sample)); - - if (sample >= half) { - return half - 1; - } - if (sample < -half) { - return -half; - } - - return sample; -} - - -// ---------------------------------------------------------------------------- -// Read registers. -// -// Reading a write only register returns the last byte written to any SID -// register. The individual bits in this value start to fade down towards -// zero after a few cycles. All bits reach zero within approximately -// $2000 - $4000 cycles. -// It has been claimed that this fading happens in an orderly fashion, however -// sampling of write only registers reveals that this is not the case. -// NB! This is not correctly modeled. -// The actual use of write only registers has largely been made in the belief -// that all SID registers are readable. To support this belief the read -// would have to be done immediately after a write to the same register -// (remember that an intermediate write to another register would yield that -// value instead). With this in mind we return the last value written to -// any SID register for $2000 cycles without modeling the bit fading. -// ---------------------------------------------------------------------------- -reg8 SID::read(reg8 offset) -{ - switch (offset) { - case 0x19: - return potx.readPOT(); - case 0x1a: - return poty.readPOT(); - case 0x1b: - return voice[2].wave.readOSC(); - case 0x1c: - return voice[2].envelope.readENV(); - default: - return bus_value; - } -} - - -// ---------------------------------------------------------------------------- -// Write registers. -// ---------------------------------------------------------------------------- -void SID::write(reg8 offset, reg8 value) -{ - bus_value = value; - bus_value_ttl = 0x2000; - - switch (offset) { - case 0x00: - voice[0].wave.writeFREQ_LO(value); - break; - case 0x01: - voice[0].wave.writeFREQ_HI(value); - break; - case 0x02: - voice[0].wave.writePW_LO(value); - break; - case 0x03: - voice[0].wave.writePW_HI(value); - break; - case 0x04: - voice[0].writeCONTROL_REG(value); - break; - case 0x05: - voice[0].envelope.writeATTACK_DECAY(value); - break; - case 0x06: - voice[0].envelope.writeSUSTAIN_RELEASE(value); - break; - case 0x07: - voice[1].wave.writeFREQ_LO(value); - break; - case 0x08: - voice[1].wave.writeFREQ_HI(value); - break; - case 0x09: - voice[1].wave.writePW_LO(value); - break; - case 0x0a: - voice[1].wave.writePW_HI(value); - break; - case 0x0b: - voice[1].writeCONTROL_REG(value); - break; - case 0x0c: - voice[1].envelope.writeATTACK_DECAY(value); - break; - case 0x0d: - voice[1].envelope.writeSUSTAIN_RELEASE(value); - break; - case 0x0e: - voice[2].wave.writeFREQ_LO(value); - break; - case 0x0f: - voice[2].wave.writeFREQ_HI(value); - break; - case 0x10: - voice[2].wave.writePW_LO(value); - break; - case 0x11: - voice[2].wave.writePW_HI(value); - break; - case 0x12: - voice[2].writeCONTROL_REG(value); - break; - case 0x13: - voice[2].envelope.writeATTACK_DECAY(value); - break; - case 0x14: - voice[2].envelope.writeSUSTAIN_RELEASE(value); - break; - case 0x15: - filter.writeFC_LO(value); - break; - case 0x16: - filter.writeFC_HI(value); - break; - case 0x17: - filter.writeRES_FILT(value); - break; - case 0x18: - filter.writeMODE_VOL(value); - break; - default: - break; - } -} - - -// ---------------------------------------------------------------------------- -// SID voice muting. -// ---------------------------------------------------------------------------- -void SID::mute(reg8 channel, bool enable) -{ - // Only have 3 voices! - if (channel >= 3) - return; - - voice[channel].mute (enable); -} - - -// ---------------------------------------------------------------------------- -// Constructor. -// ---------------------------------------------------------------------------- -SID::State::State() -{ - int i; - - for (i = 0; i < 0x20; i++) { - sid_register[i] = 0; - } - - bus_value = 0; - bus_value_ttl = 0; - - for (i = 0; i < 3; i++) { - accumulator[i] = 0; - shift_register[i] = 0x7ffff8; - rate_counter[i] = 0; - rate_counter_period[i] = 9; - exponential_counter[i] = 0; - exponential_counter_period[i] = 1; - envelope_counter[i] = 0; - envelope_state[i] = EnvelopeGenerator::RELEASE; - hold_zero[i] = true; - } -} - - -// ---------------------------------------------------------------------------- -// Read state. -// ---------------------------------------------------------------------------- -SID::State SID::read_state() -{ - State state; - int i, j; - - for (i = 0, j = 0; i < 3; i++, j += 7) { - WaveformGenerator& wave = voice[i].wave; - EnvelopeGenerator& envelope = voice[i].envelope; - state.sid_register[j + 0] = wave.freq & 0xff; - state.sid_register[j + 1] = wave.freq >> 8; - state.sid_register[j + 2] = wave.pw & 0xff; - state.sid_register[j + 3] = wave.pw >> 8; - state.sid_register[j + 4] = - (wave.waveform << 4) - | (wave.test ? 0x08 : 0) - | (wave.ring_mod ? 0x04 : 0) - | (wave.sync ? 0x02 : 0) - | (envelope.gate ? 0x01 : 0); - state.sid_register[j + 5] = (envelope.attack << 4) | envelope.decay; - state.sid_register[j + 6] = (envelope.sustain << 4) | envelope.release; - } - - state.sid_register[j++] = filter.fc & 0x007; - state.sid_register[j++] = filter.fc >> 3; - state.sid_register[j++] = (filter.res << 4) | filter.filt; - state.sid_register[j++] = - (filter.voice3off ? 0x80 : 0) - | (filter.hp_bp_lp << 4) - | filter.vol; - - // These registers are superfluous, but included for completeness. - for (; j < 0x1d; j++) { - state.sid_register[j] = read(j); - } - for (; j < 0x20; j++) { - state.sid_register[j] = 0; - } - - state.bus_value = bus_value; - state.bus_value_ttl = bus_value_ttl; - - for (i = 0; i < 3; i++) { - state.accumulator[i] = voice[i].wave.accumulator; - state.shift_register[i] = voice[i].wave.shift_register; - state.rate_counter[i] = voice[i].envelope.rate_counter; - state.rate_counter_period[i] = voice[i].envelope.rate_period; - state.exponential_counter[i] = voice[i].envelope.exponential_counter; - state.exponential_counter_period[i] = voice[i].envelope.exponential_counter_period; - state.envelope_counter[i] = voice[i].envelope.envelope_counter; - state.envelope_state[i] = voice[i].envelope.state; - state.hold_zero[i] = voice[i].envelope.hold_zero; - } - - return state; -} - - -// ---------------------------------------------------------------------------- -// Write state. -// ---------------------------------------------------------------------------- -void SID::write_state(const State& state) -{ - int i; - - for (i = 0; i <= 0x18; i++) { - write(i, state.sid_register[i]); - } - - bus_value = state.bus_value; - bus_value_ttl = state.bus_value_ttl; - - for (i = 0; i < 3; i++) { - voice[i].wave.accumulator = state.accumulator[i]; - voice[i].wave.shift_register = state.shift_register[i]; - voice[i].envelope.rate_counter = state.rate_counter[i]; - voice[i].envelope.rate_period = state.rate_counter_period[i]; - voice[i].envelope.exponential_counter = state.exponential_counter[i]; - voice[i].envelope.exponential_counter_period = state.exponential_counter_period[i]; - voice[i].envelope.envelope_counter = state.envelope_counter[i]; - voice[i].envelope.state = state.envelope_state[i]; - voice[i].envelope.hold_zero = state.hold_zero[i]; - } -} - - -// ---------------------------------------------------------------------------- -// Enable filter. -// ---------------------------------------------------------------------------- -void SID::enable_filter(bool enable) -{ - filter.enable_filter(enable); -} - - -// ---------------------------------------------------------------------------- -// Enable external filter. -// ---------------------------------------------------------------------------- -void SID::enable_external_filter(bool enable) -{ - extfilt.enable_filter(enable); -} - - -// ---------------------------------------------------------------------------- -// I0() computes the 0th order modified Bessel function of the first kind. -// This function is originally from resample-1.5/filterkit.c by J. O. Smith. -// ---------------------------------------------------------------------------- -/* -float SID::I0(float x) -{ - // Max error acceptable in I0. - const float I0e = 1e-6; - - float sum, u, halfx, temp; - int n; - - sum = u = n = 1; - halfx = x/2.0; - - do { - temp = halfx/n++; - u *= temp*temp; - sum += u; - } while (u >= I0e*sum); - - return sum; -} -*/ - -// ---------------------------------------------------------------------------- -// Setting of SID sampling parameters. -// -// Use a clock freqency of 985248Hz for PAL C64, 1022730Hz for NTSC C64. -// The default end of passband frequency is pass_freq = 0.9*sample_freq/2 -// for sample frequencies up to ~ 44.1kHz, and 20kHz for higher sample -// frequencies. -// -// For resampling, the ratio between the clock frequency and the sample -// frequency is limited as follows: -// 125*clock_freq/sample_freq < 16384 -// E.g. provided a clock frequency of ~ 1MHz, the sample frequency can not -// be set lower than ~ 8kHz. A lower sample frequency would make the -// resampling code overfill its 16k sample ring buffer. -// -// The end of passband frequency is also limited: -// pass_freq <= 0.9*sample_freq/2 - -// E.g. for a 44.1kHz sampling rate the end of passband frequency is limited -// to slightly below 20kHz. This constraint ensures that the FIR table is -// not overfilled. -// ---------------------------------------------------------------------------- -bool SID::set_sampling_parameters(float clock_freq, sampling_method method, - float sample_freq, float pass_freq, - float filter_scale) -{ - - // The default passband limit is 0.9*sample_freq/2 for sample - // frequencies below ~ 44.1kHz, and 20kHz for higher sample frequencies. - if (pass_freq < 0) { - pass_freq = 20000; - if (2.0*pass_freq/sample_freq >= 0.9) { - pass_freq = 0.9*sample_freq/2.0; - } - } - // Check whether the FIR table would overfill. - else if (pass_freq > 0.9*sample_freq/2.0) { - return false; - } - - // The filter scaling is only included to avoid clipping, so keep - // it sane. - if (filter_scale < 0.9 || filter_scale > 1.0) { - return false; - } - - // Set the external filter to the pass freq - extfilt.set_sampling_parameter (pass_freq); - clock_frequency = clock_freq; - sampling = method; - - cycles_per_sample = - cycle_count(clock_freq/sample_freq*(1 << FIXP_SHIFT) + 0.5); - - sample_offset = 0; - sample_prev = 0; - - return true; -} - - -// ---------------------------------------------------------------------------- -// Adjustment of SID sampling frequency. -// -// In some applications, e.g. a C64 emulator, it can be desirable to -// synchronize sound with a timer source. This is supported by adjustment of -// the SID sampling frequency. -// -// NB! Adjustment of the sampling frequency may lead to noticeable shifts in -// frequency, and should only be used for interactive applications. Note also -// that any adjustment of the sampling frequency will change the -// characteristics of the resampling filter, since the filter is not rebuilt. -// ---------------------------------------------------------------------------- -void SID::adjust_sampling_frequency(float sample_freq) -{ - cycles_per_sample = - cycle_count(clock_frequency/sample_freq*(1 << FIXP_SHIFT) + 0.5); -} - - -// ---------------------------------------------------------------------------- -// Return array of default spline interpolation points to map FC to -// filter cutoff frequency. -// ---------------------------------------------------------------------------- -/* -void SID::fc_default(const fc_point*& points, int& count) -{ - filter.fc_default(points, count); -} -*/ - -// ---------------------------------------------------------------------------- -// Return FC spline plotter object. -// ---------------------------------------------------------------------------- -/* -PointPlotter SID::fc_plotter() -{ - return filter.fc_plotter(); -} -*/ - -// ---------------------------------------------------------------------------- -// SID clocking - 1 cycle. -// ---------------------------------------------------------------------------- -void SID::clock() -{ - - // Age bus value. - if (--bus_value_ttl <= 0) { - bus_value = 0; - bus_value_ttl = 0; - } - - // Clock amplitude modulators. - voice[0].envelope.clock(); - voice[1].envelope.clock(); - voice[2].envelope.clock(); - - // Clock oscillators. - voice[0].wave.clock(); - voice[1].wave.clock(); - voice[2].wave.clock(); - - // Synchronize oscillators. - voice[0].wave.synchronize(); - voice[1].wave.synchronize(); - voice[2].wave.synchronize(); - - // Clock filter. - filter.clock(voice[0].output(), voice[1].output(), voice[2].output(), ext_in); - - // Clock external filter. - extfilt.clock(filter.output()); -} - - -// ---------------------------------------------------------------------------- -// SID clocking - delta_t cycles. -// ---------------------------------------------------------------------------- -void SID::clock(cycle_count delta_t) -{ - int i; - - if (delta_t <= 0) { - return; - } - - // Age bus value. - bus_value_ttl -= delta_t; - if (bus_value_ttl <= 0) { - bus_value = 0; - bus_value_ttl = 0; - } - - // Clock amplitude modulators. - - voice[0].envelope.clock(delta_t); - voice[1].envelope.clock(delta_t); - voice[2].envelope.clock(delta_t); - - // Clock and synchronize oscillators. - // Loop until we reach the current cycle. - cycle_count delta_t_osc = delta_t; - while (delta_t_osc) { - cycle_count delta_t_min = delta_t_osc; - - // Find minimum number of cycles to an oscillator accumulator MSB toggle. - // We have to clock on each MSB on / MSB off for hard sync to operate - // correctly. - for (i = 0; i < 3; i++) { - WaveformGenerator& wave = voice[i].wave; - - // It is only necessary to clock on the MSB of an oscillator that is - // a sync source and has freq != 0. - if (!(wave.sync_dest->sync && wave.freq)) { - continue; - } - - reg16 freq = wave.freq; - reg24 accumulator = wave.accumulator; - - // Clock on MSB off if MSB is on, clock on MSB on if MSB is off. - reg24 delta_accumulator = - (accumulator & 0x800000 ? 0x1000000 : 0x800000) - accumulator; - - cycle_count delta_t_next = delta_accumulator/freq; - if (delta_accumulator%freq) { - ++delta_t_next; - } - - if (delta_t_next < delta_t_min) { - delta_t_min = delta_t_next; - } - } - - // Clock oscillators. - voice[0].wave.clock(delta_t_min); - voice[1].wave.clock(delta_t_min); - voice[2].wave.clock(delta_t_min); - - - // Synchronize oscillators. - voice[0].wave.synchronize(); - voice[1].wave.synchronize(); - voice[2].wave.synchronize(); - - delta_t_osc -= delta_t_min; - } - - // Clock filter. - filter.clock(delta_t, - voice[0].output(), voice[1].output(), voice[2].output(), ext_in); - - // Clock external filter. - extfilt.clock(delta_t, filter.output()); -} - - -// ---------------------------------------------------------------------------- -// SID clocking with audio sampling. -// Fixpoint arithmetics is used. -// -// The example below shows how to clock the SID a specified amount of cycles -// while producing audio output: -// -// while (delta_t) { -// bufindex += sid.clock(delta_t, buf + bufindex, buflength - bufindex); -// write(dsp, buf, bufindex*2); -// bufindex = 0; -// } -// -// ---------------------------------------------------------------------------- -int SID::clock(cycle_count& delta_t, short* buf, int n) -{ - switch (sampling) { - default: - case SAMPLE_FAST: - return clock_fast(delta_t, buf, n); - case SAMPLE_INTERPOLATE: - return clock_interpolate(delta_t, buf, n); - } -} - -// ---------------------------------------------------------------------------- -// SID clocking with audio sampling - delta clocking picking nearest sample. -// ---------------------------------------------------------------------------- -RESID_INLINE -int SID::clock_fast(cycle_count& delta_t, short* buf, int n) -{ - int s = 0; - - for (;;) { - cycle_count next_sample_offset = sample_offset + cycles_per_sample + (1 << (FIXP_SHIFT - 1)); - cycle_count delta_t_sample = next_sample_offset >> FIXP_SHIFT; - if (delta_t_sample > delta_t) { - break; - } - if (s >= n) { - return s; - } - clock(delta_t_sample); - delta_t -= delta_t_sample; - sample_offset = (next_sample_offset & FIXP_MASK) - (1 << (FIXP_SHIFT - 1)); - buf[s++] = output(); - } - - clock(delta_t); - sample_offset -= delta_t << FIXP_SHIFT; - delta_t = 0; - return s; -} - - -// ---------------------------------------------------------------------------- -// SID clocking with audio sampling - cycle based with linear sample -// interpolation. -// -// Here the chip is clocked every cycle. This yields higher quality -// sound since the samples are linearly interpolated, and since the -// external filter attenuates frequencies above 16kHz, thus reducing -// sampling noise. -// ---------------------------------------------------------------------------- -RESID_INLINE -int SID::clock_interpolate(cycle_count& delta_t, short* buf, int n) -{ - - int s = 0; - int i; - - for (;;) { - cycle_count next_sample_offset = sample_offset + cycles_per_sample; - cycle_count delta_t_sample = next_sample_offset >> FIXP_SHIFT; - if (delta_t_sample > delta_t) { - break; - } - if (s >= n) { - return s; - } - for (i = 0; i < delta_t_sample - 1; i++) { - clock(); - } - if (i < delta_t_sample) { - sample_prev = output(); - clock(); - } - - delta_t -= delta_t_sample; - sample_offset = next_sample_offset & FIXP_MASK; - - short sample_now = output(); - buf[s++] = - sample_prev + (sample_offset*(sample_now - sample_prev) >> FIXP_SHIFT); - sample_prev = sample_now; - } - - for (i = 0; i < delta_t - 1; i++) { - clock(); - } - if (i < delta_t) { - sample_prev = output(); - clock(); - } - - sample_offset -= delta_t << FIXP_SHIFT; - delta_t = 0; - return s; -} - - -RESID_NAMESPACE_STOP diff --git a/MCUME_pico/picosnd/reSID/sid.h b/MCUME_pico/picosnd/reSID/sid.h deleted file mode 100755 index 3087e6f..0000000 --- a/MCUME_pico/picosnd/reSID/sid.h +++ /dev/null @@ -1,133 +0,0 @@ -// --------------------------------------------------------------------------- -// This file is part of reSID, a MOS6581 SID emulator engine. -// Copyright (C) 2004 Dag Lem -// -// This program is free float; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free float Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free float -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// --------------------------------------------------------------------------- - -#ifndef __SID_H__ -#define __SID_H__ - -#include "siddefs.h" -#include "voice.h" -#include "filter.h" -#include "extfilt.h" -#include "pot.h" - -RESID_NAMESPACE_START - -class SID -{ -public: - SID(); - ~SID(); - //void printFilter(void); - //void set_chip_model(chip_model model); - void enable_filter(bool enable); - void enable_external_filter(bool enable); - bool set_sampling_parameters(float clock_freq, sampling_method method, - float sample_freq, float pass_freq = -1, - float filter_scale = 0.97); - void adjust_sampling_frequency(float sample_freq); - - //void fc_default(const fc_point*& points, int& count); - //PointPlotter fc_plotter(); - - void clock(); - void clock(cycle_count delta_t); - int clock(cycle_count& delta_t, short* buf, int n); - void reset(); - - // Read/write registers. - reg8 read(reg8 offset); - void write(reg8 offset, reg8 value); - void mute(reg8 channel, bool enable); - - // Read/write state. - class State - { - public: - State(); - - char sid_register[0x20]; - - reg8 bus_value; - cycle_count bus_value_ttl; - - reg24 accumulator[3]; - reg24 shift_register[3]; - reg16 rate_counter[3]; - reg16 rate_counter_period[3]; - reg16 exponential_counter[3]; - reg16 exponential_counter_period[3]; - reg8 envelope_counter[3]; - EnvelopeGenerator::State envelope_state[3]; - bool hold_zero[3]; - }; - - State read_state(); - void write_state(const State& state); - - // 16-bit input (EXT IN). - void input(int sample); - - // 16-bit output (AUDIO OUT). - int output(); - - -protected: - - RESID_INLINE int clock_fast(cycle_count& delta_t, short* buf, int n); - RESID_INLINE int clock_interpolate(cycle_count& delta_t, short* buf, int n); - - Voice voice[3]; - Filter filter; - ExternalFilter extfilt; - Potentiometer potx; - Potentiometer poty; - - reg8 bus_value; - cycle_count bus_value_ttl; - - float clock_frequency; - - // External audio input. - int ext_in; - - // Resampling constants. - static const int FIR_N; - static const int FIR_RES_INTERPOLATE; - static const int FIR_RES_FAST; - static const int FIR_SHIFT; - static const int RINGSIZE; - - // Fixpoint constants. - static const int FIXP_SHIFT; - static const int FIXP_MASK; - - // Sampling variables. - sampling_method sampling; - cycle_count cycles_per_sample; - cycle_count sample_offset; - int sample_index; - short sample_prev; - int fir_N; - int fir_RES; - -}; - -RESID_NAMESPACE_STOP - -#endif // not __SID_H__ diff --git a/MCUME_pico/picosnd/reSID/siddefs.h b/MCUME_pico/picosnd/reSID/siddefs.h deleted file mode 100755 index 05604ea..0000000 --- a/MCUME_pico/picosnd/reSID/siddefs.h +++ /dev/null @@ -1,86 +0,0 @@ -// --------------------------------------------------------------------------- -// This file is part of reSID, a MOS6581 SID emulator engine. -// Copyright (C) 1999 Dag Lem -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// --------------------------------------------------------------------------- - -#ifndef __SIDDEFS_H__ -#define __SIDDEFS_H__ - -// Define bool, true, and false for C++ compilers that lack these keywords. -#define RESID_HAVE_BOOL 1 - -// Inlining on/off. -#define RESID_INLINING 1 -#define RESID_INLINE inline - -// Support namespace - -#ifdef RESID_NAMESPACE -# define RESID_NAMESPACE_START \ - namespace RESID_NAMESPACE \ - { -# define RESID_NAMESPACE_STOP \ - } -#else -# define RESID_NAMESPACE_START -# define RESID_NAMESPACE_STOP -#endif - - -RESID_NAMESPACE_START - -#if !RESID_HAVE_BOOL -typedef int bool; -const bool true = 1; -const bool false = 0; -#endif - -// We could have used the smallest possible data type for each SID register, -// however this would give a slower engine because of data type conversions. -// An int is assumed to be at least 32 bits (necessary in the types reg24, -// cycle_count, and sound_sample). GNU does not support 16-bit machines -// (GNU Coding Standards: Portability between CPUs), so this should be -// a valid assumption. -#include -#include - -typedef uint16_t reg4; -typedef uint16_t reg8; -typedef uint16_t reg12; -typedef uint16_t reg16; -typedef unsigned int reg24; - -typedef int cycle_count; -typedef int sound_sample; -typedef sound_sample fc_point[2]; - -//enum chip_model { MOS6581, MOS8580 }; - -enum sampling_method { SAMPLE_FAST, SAMPLE_INTERPOLATE}; - -extern "C" -{ -#ifndef __VERSION_CC__ -extern const char* resid_version_string; -#else -const char* resid_version_string = VERSION; -#endif -} - -RESID_NAMESPACE_STOP - -#endif // not __SIDDEFS_H__ diff --git a/MCUME_pico/picosnd/reSID/spline.h b/MCUME_pico/picosnd/reSID/spline.h deleted file mode 100755 index c03260c..0000000 --- a/MCUME_pico/picosnd/reSID/spline.h +++ /dev/null @@ -1,275 +0,0 @@ -// --------------------------------------------------------------------------- -// This file is part of reSID, a MOS6581 SID emulator engine. -// Copyright (C) 2004 Dag Lem -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// --------------------------------------------------------------------------- - -#ifndef __SPLINE_H__ -#define __SPLINE_H__ - -RESID_NAMESPACE_START - -// Our objective is to construct a smooth interpolating single-valued function -// y = f(x). -// -// Catmull-Rom splines are widely used for interpolation, however these are -// parametric curves [x(t) y(t) ...] and can not be used to directly calculate -// y = f(x). -// For a discussion of Catmull-Rom splines see Catmull, E., and R. Rom, -// "A Class of Local Interpolating Splines", Computer Aided Geometric Design. -// -// Natural cubic splines are single-valued functions, and have been used in -// several applications e.g. to specify gamma curves for image display. -// These splines do not afford local control, and a set of linear equations -// including all interpolation points must be solved before any point on the -// curve can be calculated. The lack of local control makes the splines -// more difficult to handle than e.g. Catmull-Rom splines, and real-time -// interpolation of a stream of data points is not possible. -// For a discussion of natural cubic splines, see e.g. Kreyszig, E., "Advanced -// Engineering Mathematics". -// -// Our approach is to approximate the properties of Catmull-Rom splines for -// piecewice cubic polynomials f(x) = ax^3 + bx^2 + cx + d as follows: -// Each curve segment is specified by four interpolation points, -// p0, p1, p2, p3. -// The curve between p1 and p2 must interpolate both p1 and p2, and in addition -// f'(p1.x) = k1 = (p2.y - p0.y)/(p2.x - p0.x) and -// f'(p2.x) = k2 = (p3.y - p1.y)/(p3.x - p1.x). -// -// The constraints are expressed by the following system of linear equations -// -// [ 1 xi xi^2 xi^3 ] [ d ] [ yi ] -// [ 1 2*xi 3*xi^2 ] * [ c ] = [ ki ] -// [ 1 xj xj^2 xj^3 ] [ b ] [ yj ] -// [ 1 2*xj 3*xj^2 ] [ a ] [ kj ] -// -// Solving using Gaussian elimination and back substitution, setting -// dy = yj - yi, dx = xj - xi, we get -// -// a = ((ki + kj) - 2*dy/dx)/(dx*dx); -// b = ((kj - ki)/dx - 3*(xi + xj)*a)/2; -// c = ki - (3*xi*a + 2*b)*xi; -// d = yi - ((xi*a + b)*xi + c)*xi; -// -// Having calculated the coefficients of the cubic polynomial we have the -// choice of evaluation by brute force -// -// for (x = x1; x <= x2; x += res) { -// y = ((a*x + b)*x + c)*x + d; -// plot(x, y); -// } -// -// or by forward differencing -// -// y = ((a*x1 + b)*x1 + c)*x1 + d; -// dy = (3*a*(x1 + res) + 2*b)*x1*res + ((a*res + b)*res + c)*res; -// d2y = (6*a*(x1 + res) + 2*b)*res*res; -// d3y = 6*a*res*res*res; -// -// for (x = x1; x <= x2; x += res) { -// plot(x, y); -// y += dy; dy += d2y; d2y += d3y; -// } -// -// See Foley, Van Dam, Feiner, Hughes, "Computer Graphics, Principles and -// Practice" for a discussion of forward differencing. -// -// If we have a set of interpolation points p0, ..., pn, we may specify -// curve segments between p0 and p1, and between pn-1 and pn by using the -// following constraints: -// f''(p0.x) = 0 and -// f''(pn.x) = 0. -// -// Substituting the results for a and b in -// -// 2*b + 6*a*xi = 0 -// -// we get -// -// ki = (3*dy/dx - kj)/2; -// -// or by substituting the results for a and b in -// -// 2*b + 6*a*xj = 0 -// -// we get -// -// kj = (3*dy/dx - ki)/2; -// -// Finally, if we have only two interpolation points, the cubic polynomial -// will degenerate to a straight line if we set -// -// ki = kj = dy/dx; -// - - -#if SPLINE_BRUTE_FORCE -#define interpolate_segment interpolate_brute_force -#else -#define interpolate_segment interpolate_forward_difference -#endif - - -// ---------------------------------------------------------------------------- -// Calculation of coefficients. -// ---------------------------------------------------------------------------- -inline -void cubic_coefficients(double x1, double y1, double x2, double y2, - double k1, double k2, - double& a, double& b, double& c, double& d) -{ - double dx = x2 - x1, dy = y2 - y1; - - a = ((k1 + k2) - 2*dy/dx)/(dx*dx); - b = ((k2 - k1)/dx - 3*(x1 + x2)*a)/2; - c = k1 - (3*x1*a + 2*b)*x1; - d = y1 - ((x1*a + b)*x1 + c)*x1; -} - -// ---------------------------------------------------------------------------- -// Evaluation of cubic polynomial by brute force. -// ---------------------------------------------------------------------------- -template -inline -void interpolate_brute_force(double x1, double y1, double x2, double y2, - double k1, double k2, - PointPlotter plot, double res) -{ - double a, b, c, d; - cubic_coefficients(x1, y1, x2, y2, k1, k2, a, b, c, d); - - // Calculate each point. - for (double x = x1; x <= x2; x += res) { - double y = ((a*x + b)*x + c)*x + d; - plot(x, y); - } -} - -// ---------------------------------------------------------------------------- -// Evaluation of cubic polynomial by forward differencing. -// ---------------------------------------------------------------------------- -template -inline -void interpolate_forward_difference(double x1, double y1, double x2, double y2, - double k1, double k2, - PointPlotter plot, double res) -{ - double a, b, c, d; - cubic_coefficients(x1, y1, x2, y2, k1, k2, a, b, c, d); - - double y = ((a*x1 + b)*x1 + c)*x1 + d; - double dy = (3*a*(x1 + res) + 2*b)*x1*res + ((a*res + b)*res + c)*res; - double d2y = (6*a*(x1 + res) + 2*b)*res*res; - double d3y = 6*a*res*res*res; - - // Calculate each point. - for (double x = x1; x <= x2; x += res) { - plot(x, y); - y += dy; dy += d2y; d2y += d3y; - } -} - -template -inline -double x(PointIter p) -{ - return (*p)[0]; -} - -template -inline -double y(PointIter p) -{ - return (*p)[1]; -} - -// ---------------------------------------------------------------------------- -// Evaluation of complete interpolating function. -// Note that since each curve segment is controlled by four points, the -// end points will not be interpolated. If extra control points are not -// desirable, the end points can simply be repeated to ensure interpolation. -// Note also that points of non-differentiability and discontinuity can be -// introduced by repeating points. -// ---------------------------------------------------------------------------- -template -inline -void interpolate(PointIter p0, PointIter pn, PointPlotter plot, double res) -{ - double k1, k2; - - // Set up points for first curve segment. - PointIter p1 = p0; ++p1; - PointIter p2 = p1; ++p2; - PointIter p3 = p2; ++p3; - - // Draw each curve segment. - for (; p2 != pn; ++p0, ++p1, ++p2, ++p3) { - // p1 and p2 equal; single point. - if (x(p1) == x(p2)) { - continue; - } - // Both end points repeated; straight line. - if (x(p0) == x(p1) && x(p2) == x(p3)) { - k1 = k2 = (y(p2) - y(p1))/(x(p2) - x(p1)); - } - // p0 and p1 equal; use f''(x1) = 0. - else if (x(p0) == x(p1)) { - k2 = (y(p3) - y(p1))/(x(p3) - x(p1)); - k1 = (3*(y(p2) - y(p1))/(x(p2) - x(p1)) - k2)/2; - } - // p2 and p3 equal; use f''(x2) = 0. - else if (x(p2) == x(p3)) { - k1 = (y(p2) - y(p0))/(x(p2) - x(p0)); - k2 = (3*(y(p2) - y(p1))/(x(p2) - x(p1)) - k1)/2; - } - // Normal curve. - else { - k1 = (y(p2) - y(p0))/(x(p2) - x(p0)); - k2 = (y(p3) - y(p1))/(x(p3) - x(p1)); - } - - interpolate_segment(x(p1), y(p1), x(p2), y(p2), k1, k2, plot, res); - } -} - -// ---------------------------------------------------------------------------- -// Class for plotting integers into an array. -// ---------------------------------------------------------------------------- -template -class PointPlotter -{ - protected: - FN* f; - - public: - PointPlotter(FN* arr) : f(arr) - { - } - - void operator ()(double x, double y) - { - // Clamp negative values to zero. - if (y < 0) { - y = 0; - } - - f[FN(x)] = FN(y); - } -}; - -RESID_NAMESPACE_STOP - -#endif // not __SPLINE_H__ diff --git a/MCUME_pico/picosnd/reSID/version.cpp b/MCUME_pico/picosnd/reSID/version.cpp deleted file mode 100755 index 3b61afd..0000000 --- a/MCUME_pico/picosnd/reSID/version.cpp +++ /dev/null @@ -1,21 +0,0 @@ -// --------------------------------------------------------------------------- -// This file is part of reSID, a MOS6581 SID emulator engine. -// Copyright (C) 2004 Dag Lem -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// --------------------------------------------------------------------------- - -#define __VERSION_CC__ -#include "siddefs.h" diff --git a/MCUME_pico/picosnd/reSID/voice.cpp b/MCUME_pico/picosnd/reSID/voice.cpp deleted file mode 100755 index e24bcdb..0000000 --- a/MCUME_pico/picosnd/reSID/voice.cpp +++ /dev/null @@ -1,152 +0,0 @@ -// --------------------------------------------------------------------------- -// This file is part of reSID, a MOS6581 SID emulator engine. -// Copyright (C) 2004 Dag Lem -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// --------------------------------------------------------------------------- - -#define __VOICE_CC__ -#include "voice.h" - -RESID_NAMESPACE_START - -// ---------------------------------------------------------------------------- -// Constructor. -// ---------------------------------------------------------------------------- -Voice::Voice() - : muted(false) -{ - //set_chip_model(MOS6581); - {//instead: - wave_zero = 0x380; - voice_DC = 0x800*0xff; - } -} - -// ---------------------------------------------------------------------------- -// Set chip model. -// ---------------------------------------------------------------------------- -/* -void Voice::set_chip_model(chip_model model) -{ - wave.set_chip_model(model); - - if (model == MOS6581) { - // The waveform D/A converter introduces a DC offset in the signal - // to the envelope multiplying D/A converter. The "zero" level of - // the waveform D/A converter can be found as follows: - // - // Measure the "zero" voltage of voice 3 on the SID audio output - // pin, routing only voice 3 to the mixer ($d417 = $0b, $d418 = - // $0f, all other registers zeroed). - // - // Then set the sustain level for voice 3 to maximum and search for - // the waveform output value yielding the same voltage as found - // above. This is done by trying out different waveform output - // values until the correct value is found, e.g. with the following - // program: - // - // lda #$08 - // sta $d412 - // lda #$0b - // sta $d417 - // lda #$0f - // sta $d418 - // lda #$f0 - // sta $d414 - // lda #$21 - // sta $d412 - // lda #$01 - // sta $d40e - // - // ldx #$00 - // lda #$38 ; Tweak this to find the "zero" level - //l cmp $d41b - // bne l - // stx $d40e ; Stop frequency counter - freeze waveform output - // brk - // - // The waveform output range is 0x000 to 0xfff, so the "zero" - // level should ideally have been 0x800. In the measured chip, the - // waveform output "zero" level was found to be 0x380 (i.e. $d41b - // = 0x38) at 5.94V. - - wave_zero = 0x380; - - // The envelope multiplying D/A converter introduces another DC - // offset. This is isolated by the following measurements: - // - // * The "zero" output level of the mixer at full volume is 5.44V. - // * Routing one voice to the mixer at full volume yields - // 6.75V at maximum voice output (wave = 0xfff, sustain = 0xf) - // 5.94V at "zero" voice output (wave = any, sustain = 0x0) - // 5.70V at minimum voice output (wave = 0x000, sustain = 0xf) - // * The DC offset of one voice is (5.94V - 5.44V) = 0.50V - // * The dynamic range of one voice is |6.75V - 5.70V| = 1.05V - // * The DC offset is thus 0.50V/1.05V ~ 1/2 of the dynamic range. - // - // Note that by removing the DC offset, we get the following ranges for - // one voice: - // y > 0: (6.75V - 5.44V) - 0.50V = 0.81V - // y < 0: (5.70V - 5.44V) - 0.50V = -0.24V - // The scaling of the voice amplitude is not symmetric about y = 0; - // this follows from the DC level in the waveform output. - - voice_DC = 0x800*0xff; - } - else { - // No DC offsets in the MOS8580. - wave_zero = 0x800; - voice_DC = 0; - } -} -*/ -// ---------------------------------------------------------------------------- -// Set sync source. -// ---------------------------------------------------------------------------- -void Voice::set_sync_source(Voice* source) -{ - wave.set_sync_source(&source->wave); -} - -// ---------------------------------------------------------------------------- -// Register functions. -// ---------------------------------------------------------------------------- -void Voice::writeCONTROL_REG(reg8 control) -{ - wave.writeCONTROL_REG(control); - envelope.writeCONTROL_REG(control); -} - -// ---------------------------------------------------------------------------- -// SID reset. -// ---------------------------------------------------------------------------- -void Voice::reset() -{ - wave.reset(); - envelope.reset(); -} - - -// ---------------------------------------------------------------------------- -// Voice mute. -// ---------------------------------------------------------------------------- -void Voice::mute(bool enable) -{ - // enable = true (means voice is muted) - muted = enable; -} - -RESID_NAMESPACE_STOP diff --git a/MCUME_pico/picosnd/reSID/voice.h b/MCUME_pico/picosnd/reSID/voice.h deleted file mode 100755 index 119d26d..0000000 --- a/MCUME_pico/picosnd/reSID/voice.h +++ /dev/null @@ -1,87 +0,0 @@ -// --------------------------------------------------------------------------- -// This file is part of reSID, a MOS6581 SID emulator engine. -// Copyright (C) 2004 Dag Lem -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// --------------------------------------------------------------------------- - -#ifndef __VOICE_H__ -#define __VOICE_H__ - -#include "siddefs.h" -#include "wave.h" -#include "envelope.h" - -RESID_NAMESPACE_START - -class Voice -{ -public: - Voice(); - -// void set_chip_model(chip_model model); - void set_sync_source(Voice*); - void reset(); - void mute(bool enable); - - void writeCONTROL_REG(reg8); - - // Amplitude modulated waveform output. - // Range [-2048*255, 2047*255]. - RESID_INLINE sound_sample output(); - -protected: - WaveformGenerator wave; - EnvelopeGenerator envelope; - bool muted; - - // Waveform D/A zero level. - sound_sample wave_zero; - - // Multiplying D/A DC offset. - sound_sample voice_DC; - -friend class SID; -}; - - -// ---------------------------------------------------------------------------- -// Inline functions. -// The following function is defined inline because it is called every -// time a sample is calculated. -// ---------------------------------------------------------------------------- - -#if RESID_INLINING || defined(__VOICE_CC__) - -// ---------------------------------------------------------------------------- -// Amplitude modulated waveform output. -// Ideal range [-2048*255, 2047*255]. -// ---------------------------------------------------------------------------- -RESID_INLINE -sound_sample Voice::output() -{ - if (!muted) - { // Multiply oscillator output with envelope output. - return (wave.output() - wave_zero)*envelope.output() + voice_DC; - } else { - return 0; - } -} - -#endif // RESID_INLINING || defined(__VOICE_CC__) - -RESID_NAMESPACE_STOP - -#endif // not __VOICE_H__ diff --git a/MCUME_pico/picosnd/reSID/wave.cpp b/MCUME_pico/picosnd/reSID/wave.cpp deleted file mode 100755 index 9da1a58..0000000 --- a/MCUME_pico/picosnd/reSID/wave.cpp +++ /dev/null @@ -1,154 +0,0 @@ -// --------------------------------------------------------------------------- -// This file is part of reSID, a MOS6581 SID emulator engine. -// Copyright (C) 2004 Dag Lem -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// --------------------------------------------------------------------------- - -#define __WAVE_CC__ -#include "wave.h" - -RESID_NAMESPACE_START - -// ---------------------------------------------------------------------------- -// Constructor. -// ---------------------------------------------------------------------------- -WaveformGenerator::WaveformGenerator() -{ - sync_source = this; - - // set_chip_model(MOS6581); - {//instead: - wave__ST = &wave6581__ST[0]; - wave_P_T = &wave6581_P_T[0]; - wave_PS_ = &wave6581_PS_[0]; - wave_PST = &wave6581_PST[0]; - } - reset(); -} - - -// ---------------------------------------------------------------------------- -// Set sync source. -// ---------------------------------------------------------------------------- -void WaveformGenerator::set_sync_source(WaveformGenerator* source) -{ - sync_source = source; - source->sync_dest = this; -} - - -// ---------------------------------------------------------------------------- -// Set chip model. -// ---------------------------------------------------------------------------- -/* -void WaveformGenerator::set_chip_model(chip_model model) -{ - if (model == MOS6581) { - wave__ST = &wave6581__ST[0]; - wave_P_T = &wave6581_P_T[0]; - wave_PS_ = &wave6581_PS_[0]; - wave_PST = &wave6581_PST[0]; - } - else { - wave__ST = &wave8580__ST[0]; - wave_P_T = &wave8580_P_T[0]; - wave_PS_ = &wave8580_PS_[0]; - wave_PST = &wave8580_PST[0]; - } -} -*/ - -// ---------------------------------------------------------------------------- -// Register functions. -// ---------------------------------------------------------------------------- -void WaveformGenerator::writeFREQ_LO(reg8 freq_lo) -{ - freq = (freq & 0xff00) | (freq_lo & 0x00ff); -} - -void WaveformGenerator::writeFREQ_HI(reg8 freq_hi) -{ - freq = (((unsigned int) freq_hi << 8) & 0xff00) | (freq & 0x00ff); -} - -void WaveformGenerator::writePW_LO(reg8 pw_lo) -{ - pw = (pw & 0xf00) | (pw_lo & 0x0ff); -} - -void WaveformGenerator::writePW_HI(reg8 pw_hi) -{ - pw = (((unsigned int)pw_hi << 8) & 0xf00) | (pw & 0x0ff); -} - -void WaveformGenerator::writeCONTROL_REG(reg8 control) -{ - waveform = (control >> 4) & 0x0f; - ring_mod = control & 0x04; - sync = control & 0x02; - - reg8 test_next = control & 0x08; - - // Test bit set. - // The accumulator and the shift register are both cleared. - // NB! The shift register is not really cleared immediately. It seems like - // the individual bits in the shift register start to fade down towards - // zero when test is set. All bits reach zero within approximately - // $2000 - $4000 cycles. - // This is not modeled. There should fortunately be little audible output - // from this peculiar behavior. - if (test_next) { - accumulator = 0; - shift_register = 0; - } - // Test bit cleared. - // The accumulator starts counting, and the shift register is reset to - // the value 0x7ffff8. - // NB! The shift register will not actually be set to this exact value if the - // shift register bits have not had time to fade to zero. - // This is not modeled. - else if (test) { - shift_register = 0x7ffff8; - } - - test = test_next; - - // The gate bit is handled by the EnvelopeGenerator. -} - -reg8 WaveformGenerator::readOSC() -{ - return output() >> 4; -} - -// ---------------------------------------------------------------------------- -// SID reset. -// ---------------------------------------------------------------------------- -void WaveformGenerator::reset() -{ - accumulator = 0; - shift_register = 0x7ffff8; - freq = 0; - pw = 0; - - test = 0; - ring_mod = 0; - sync = 0; - - msb_rising = false; -} - -RESID_NAMESPACE_STOP diff --git a/MCUME_pico/picosnd/reSID/wave.h b/MCUME_pico/picosnd/reSID/wave.h deleted file mode 100755 index 376960d..0000000 --- a/MCUME_pico/picosnd/reSID/wave.h +++ /dev/null @@ -1,514 +0,0 @@ -// --------------------------------------------------------------------------- -// This file is part of reSID, a MOS6581 SID emulator engine. -// Copyright (C) 2004 Dag Lem -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// --------------------------------------------------------------------------- - -#ifndef __WAVE_H__ -#define __WAVE_H__ - -#include "siddefs.h" - -RESID_NAMESPACE_START - -// ---------------------------------------------------------------------------- -// A 24 bit accumulator is the basis for waveform generation. FREQ is added to -// the lower 16 bits of the accumulator each cycle. -// The accumulator is set to zero when TEST is set, and starts counting -// when TEST is cleared. -// The noise waveform is taken from intermediate bits of a 23 bit shift -// register. This register is clocked by bit 19 of the accumulator. -// ---------------------------------------------------------------------------- -class WaveformGenerator -{ -public: - WaveformGenerator(); - - void set_sync_source(WaveformGenerator*); - //void set_chip_model(chip_model model); - - RESID_INLINE void clock(); - RESID_INLINE void clock(cycle_count delta_t); - RESID_INLINE void synchronize(); - void reset(); - - void writeFREQ_LO(reg8); - void writeFREQ_HI(reg8); - void writePW_LO(reg8); - void writePW_HI(reg8); - void writeCONTROL_REG(reg8); - reg8 readOSC(); - - // 12-bit waveform output. - RESID_INLINE reg12 output(); - -protected: - const WaveformGenerator* sync_source; - WaveformGenerator* sync_dest; - - // Tell whether the accumulator MSB was set high on this cycle. - bool msb_rising; - - reg24 accumulator; - reg24 shift_register; - - // Fout = (Fn*Fclk/16777216)Hz - reg16 freq; - // PWout = (PWn/40.95)% - reg12 pw; - - // The control register right-shifted 4 bits; used for output function - // table lookup. - reg8 waveform; - - // The remaining control register bits. - reg8 test; - reg8 ring_mod; - reg8 sync; - // The gate bit is handled by the EnvelopeGenerator. - - // 16 possible combinations of waveforms. - RESID_INLINE reg12 output____(); - RESID_INLINE reg12 output___T(); - RESID_INLINE reg12 output__S_(); - RESID_INLINE reg12 output__ST(); - RESID_INLINE reg12 output_P__(); - RESID_INLINE reg12 output_P_T(); - RESID_INLINE reg12 output_PS_(); - RESID_INLINE reg12 output_PST(); - RESID_INLINE reg12 outputN___(); - RESID_INLINE reg12 outputN__T(); - RESID_INLINE reg12 outputN_S_(); - RESID_INLINE reg12 outputN_ST(); - RESID_INLINE reg12 outputNP__(); - RESID_INLINE reg12 outputNP_T(); - RESID_INLINE reg12 outputNPS_(); - RESID_INLINE reg12 outputNPST(); - - // Sample data for combinations of waveforms. - /* - static reg8 wave6581__ST[]; - static reg8 wave6581_P_T[]; - static reg8 wave6581_PS_[]; - static reg8 wave6581_PST[]; - - static reg8 wave8580__ST[]; - static reg8 wave8580_P_T[]; - static reg8 wave8580_PS_[]; - static reg8 wave8580_PST[]; - - reg8* wave__ST; - reg8* wave_P_T; - reg8* wave_PS_; - reg8* wave_PST; -*/ - - const reg8* wave__ST; - const reg8* wave_P_T; - const reg8* wave_PS_; - const reg8* wave_PST; - -friend class Voice; -friend class SID; -}; - - -// ---------------------------------------------------------------------------- -// Inline functions. -// The following functions are defined inline because they are called every -// time a sample is calculated. -// ---------------------------------------------------------------------------- - -#if RESID_INLINING || defined(__WAVE_CC__) - -// ---------------------------------------------------------------------------- -// SID clocking - 1 cycle. -// ---------------------------------------------------------------------------- -RESID_INLINE -void WaveformGenerator::clock() -{ - // No operation if test bit is set. - if (test) { - return; - } - - reg24 accumulator_prev = accumulator; - - // Calculate new accumulator value; - accumulator += freq; - accumulator &= 0xffffff; - - // Check whether the MSB is set high. This is used for synchronization. - msb_rising = !(accumulator_prev & 0x800000) && (accumulator & 0x800000); - - // Shift noise register once for each time accumulator bit 19 is set high. - if (!(accumulator_prev & 0x080000) && (accumulator & 0x080000)) { - reg24 bit0 = ((shift_register >> 22) ^ (shift_register >> 17)) & 0x1; - shift_register <<= 1; - shift_register &= 0x7fffff; - shift_register |= bit0; - } -} - -// ---------------------------------------------------------------------------- -// SID clocking - delta_t cycles. -// ---------------------------------------------------------------------------- -RESID_INLINE -void WaveformGenerator::clock(cycle_count delta_t) -{ - // No operation if test bit is set. - if (test) { - return; - } - - reg24 accumulator_prev = accumulator; - - // Calculate new accumulator value; - reg24 delta_accumulator = delta_t*freq; - accumulator += delta_accumulator; - accumulator &= 0xffffff; - - // Check whether the MSB is set high. This is used for synchronization. - msb_rising = !(accumulator_prev & 0x800000) && (accumulator & 0x800000); - - // Shift noise register once for each time accumulator bit 19 is set high. - // Bit 19 is set high each time 2^20 (0x100000) is added to the accumulator. - reg24 shift_period = 0x100000; - - while (delta_accumulator) { - if (delta_accumulator < shift_period) { - shift_period = delta_accumulator; - // Determine whether bit 19 is set on the last period. - // NB! Requires two's complement integer. - if (shift_period <= 0x080000) { - // Check for flip from 0 to 1. - if (((accumulator - shift_period) & 0x080000) || !(accumulator & 0x080000)) - { - break; - } - } - else { - // Check for flip from 0 (to 1 or via 1 to 0) or from 1 via 0 to 1. - if (((accumulator - shift_period) & 0x080000) && !(accumulator & 0x080000)) - { - break; - } - } - } - - // Shift the noise/random register. - // NB! The shift is actually delayed 2 cycles, this is not modeled. - reg24 bit0 = ((shift_register >> 22) ^ (shift_register >> 17)) & 0x1; - shift_register <<= 1; - shift_register &= 0x7fffff; - shift_register |= bit0; - - delta_accumulator -= shift_period; - } -} - - -// ---------------------------------------------------------------------------- -// Synchronize oscillators. -// This must be done after all the oscillators have been clock()'ed since the -// oscillators operate in parallel. -// Note that the oscillators must be clocked exactly on the cycle when the -// MSB is set high for hard sync to operate correctly. See SID::clock(). -// ---------------------------------------------------------------------------- -RESID_INLINE -void WaveformGenerator::synchronize() -{ - // A special case occurs when a sync source is synced itself on the same - // cycle as when its MSB is set high. In this case the destination will - // not be synced. This has been verified by sampling OSC3. - if (msb_rising && sync_dest->sync && !(sync && sync_source->msb_rising)) { - sync_dest->accumulator = 0; - } -} - - -// ---------------------------------------------------------------------------- -// Output functions. -// NB! The output from SID 8580 is delayed one cycle compared to SID 6581, -// this is not modeled. -// ---------------------------------------------------------------------------- - -// No waveform: -// Zero output. -// -RESID_INLINE -reg12 WaveformGenerator::output____() -{ - return 0x000; -} - -// Triangle: -// The upper 12 bits of the accumulator are used. -// The MSB is used to create the falling edge of the triangle by inverting -// the lower 11 bits. The MSB is thrown away and the lower 11 bits are -// left-shifted (half the resolution, full amplitude). -// Ring modulation substitutes the MSB with MSB EOR sync_source MSB. -// -RESID_INLINE -reg12 WaveformGenerator::output___T() -{ - reg24 msb = (ring_mod ? accumulator ^ sync_source->accumulator : accumulator) - & 0x800000; - return ((msb ? ~accumulator : accumulator) >> 11) & 0xffe; -} - -// Sawtooth: -// The output is identical to the upper 12 bits of the accumulator. -// -RESID_INLINE -reg12 WaveformGenerator::output__S_() -{ - return accumulator >> 12; -} - -// Pulse: -// The upper 12 bits of the accumulator are used. -// These bits are compared to the pulse width register by a 12 bit digital -// comparator; output is either all one or all zero bits. -// NB! The output is actually delayed one cycle after the compare. -// This is not modeled. -// -// The test bit, when set to one, holds the pulse waveform output at 0xfff -// regardless of the pulse width setting. -// -RESID_INLINE -reg12 WaveformGenerator::output_P__() -{ - return (test || (accumulator >> 12) >= pw) ? 0xfff : 0x000; -} - -// Noise: -// The noise output is taken from intermediate bits of a 23-bit shift register -// which is clocked by bit 19 of the accumulator. -// NB! The output is actually delayed 2 cycles after bit 19 is set high. -// This is not modeled. -// -// Operation: Calculate EOR result, shift register, set bit 0 = result. -// -// ----------------------->--------------------- -// | | -// ----EOR---- | -// | | | -// 2 2 2 1 1 1 1 1 1 1 1 1 1 | -// Register bits: 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 <--- -// | | | | | | | | -// OSC3 bits : 7 6 5 4 3 2 1 0 -// -// Since waveform output is 12 bits the output is left-shifted 4 times. -// -RESID_INLINE -reg12 WaveformGenerator::outputN___() -{ - return - ((shift_register & 0x400000) >> 11) | - ((shift_register & 0x100000) >> 10) | - ((shift_register & 0x010000) >> 7) | - ((shift_register & 0x002000) >> 5) | - ((shift_register & 0x000800) >> 4) | - ((shift_register & 0x000080) >> 1) | - ((shift_register & 0x000010) << 1) | - ((shift_register & 0x000004) << 2); -} - -// Combined waveforms: -// By combining waveforms, the bits of each waveform are effectively short -// circuited. A zero bit in one waveform will result in a zero output bit -// (thus the infamous claim that the waveforms are AND'ed). -// However, a zero bit in one waveform will also affect the neighboring bits -// in the output. The reason for this has not been determined. -// -// Example: -// -// 1 1 -// Bit # 1 0 9 8 7 6 5 4 3 2 1 0 -// ----------------------- -// Sawtooth 0 0 0 1 1 1 1 1 1 0 0 0 -// -// Triangle 0 0 1 1 1 1 1 1 0 0 0 0 -// -// AND 0 0 0 1 1 1 1 1 0 0 0 0 -// -// Output 0 0 0 0 1 1 1 0 0 0 0 0 -// -// -// This behavior would be quite difficult to model exactly, since the SID -// in this case does not act as a digital state machine. Tests show that minor -// (1 bit) differences can actually occur in the output from otherwise -// identical samples from OSC3 when waveforms are combined. To further -// complicate the situation the output changes slightly with time (more -// neighboring bits are successively set) when the 12-bit waveform -// registers are kept unchanged. -// -// It is probably possible to come up with a valid model for the -// behavior, however this would be far too slow for practical use since it -// would have to be based on the mutual influence of individual bits. -// -// The output is instead approximated by using the upper bits of the -// accumulator as an index to look up the combined output in a table -// containing actual combined waveform samples from OSC3. -// These samples are 8 bit, so 4 bits of waveform resolution is lost. -// All OSC3 samples are taken with FREQ=0x1000, adding a 1 to the upper 12 -// bits of the accumulator each cycle for a sample period of 4096 cycles. -// -// Sawtooth+Triangle: -// The sawtooth output is used to look up an OSC3 sample. -// -// Pulse+Triangle: -// The triangle output is right-shifted and used to look up an OSC3 sample. -// The sample is output if the pulse output is on. -// The reason for using the triangle output as the index is to handle ring -// modulation. Only the first half of the sample is used, which should be OK -// since the triangle waveform has half the resolution of the accumulator. -// -// Pulse+Sawtooth: -// The sawtooth output is used to look up an OSC3 sample. -// The sample is output if the pulse output is on. -// -// Pulse+Sawtooth+Triangle: -// The sawtooth output is used to look up an OSC3 sample. -// The sample is output if the pulse output is on. -// -RESID_INLINE -reg12 WaveformGenerator::output__ST() -{ - return wave__ST[output__S_()] << 4; -} - -RESID_INLINE -reg12 WaveformGenerator::output_P_T() -{ - return (wave_P_T[output___T() >> 1] << 4) & output_P__(); -} - -RESID_INLINE -reg12 WaveformGenerator::output_PS_() -{ - return (wave_PS_[output__S_()] << 4) & output_P__(); -} - -RESID_INLINE -reg12 WaveformGenerator::output_PST() -{ - return (wave_PST[output__S_()] << 4) & output_P__(); -} - -// Combined waveforms including noise: -// All waveform combinations including noise output zero after a few cycles. -// NB! The effects of such combinations are not fully explored. It is claimed -// that the shift register may be filled with zeroes and locked up, which -// seems to be true. -// We have not attempted to model this behavior, suffice to say that -// there is very little audible output from waveform combinations including -// noise. We hope that nobody is actually using it. -// -RESID_INLINE -reg12 WaveformGenerator::outputN__T() -{ - return 0; -} - -RESID_INLINE -reg12 WaveformGenerator::outputN_S_() -{ - return 0; -} - -RESID_INLINE -reg12 WaveformGenerator::outputN_ST() -{ - return 0; -} - -RESID_INLINE -reg12 WaveformGenerator::outputNP__() -{ - return 0; -} - -RESID_INLINE -reg12 WaveformGenerator::outputNP_T() -{ - return 0; -} - -RESID_INLINE -reg12 WaveformGenerator::outputNPS_() -{ - return 0; -} - -RESID_INLINE -reg12 WaveformGenerator::outputNPST() -{ - return 0; -} - -// ---------------------------------------------------------------------------- -// Select one of 16 possible combinations of waveforms. -// ---------------------------------------------------------------------------- -RESID_INLINE -reg12 WaveformGenerator::output() -{ - // It may seem cleaner to use an array of member functions to return - // waveform output; however a switch with inline functions is faster. - - switch (waveform) { - default: - case 0x0: - return output____(); - case 0x1: - return output___T(); - case 0x2: - return output__S_(); - case 0x3: - return output__ST(); - case 0x4: - return output_P__(); - case 0x5: - return output_P_T(); - case 0x6: - return output_PS_(); - case 0x7: - return output_PST(); - case 0x8: - return outputN___(); - case 0x9: - return outputN__T(); - case 0xa: - return outputN_S_(); - case 0xb: - return outputN_ST(); - case 0xc: - return outputNP__(); - case 0xd: - return outputNP_T(); - case 0xe: - return outputNPS_(); - case 0xf: - return outputNPST(); - } -} - -#endif // RESID_INLINING || defined(__WAVE_CC__) - -RESID_NAMESPACE_STOP - -#endif // not __WAVE_H__ diff --git a/MCUME_pico/picosnd/reSID/wave6581_PST.cpp b/MCUME_pico/picosnd/reSID/wave6581_PST.cpp deleted file mode 100755 index 2198373..0000000 --- a/MCUME_pico/picosnd/reSID/wave6581_PST.cpp +++ /dev/null @@ -1,541 +0,0 @@ -// --------------------------------------------------------------------------- -// This file is part of reSID, a MOS6581 SID emulator engine. -// Copyright (C) 2004 Dag Lem -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// --------------------------------------------------------------------------- - -#include "wave.h" - -RESID_NAMESPACE_START - -//reg8 WaveformGenerator::wave6581_PST[] = -const reg8 wave6581_PST[] = -{ -/* 0x000: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x008: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x010: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x018: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x020: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x028: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x030: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x038: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x040: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x048: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x050: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x058: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x060: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x068: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x070: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x078: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x080: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x088: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x090: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x098: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0a0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0a8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0b0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0b8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0c0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0c8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0d0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0d8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0e0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0e8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0f0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0f8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x100: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x108: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x110: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x118: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x120: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x128: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x130: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x138: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x140: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x148: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x150: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x158: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x160: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x168: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x170: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x178: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x180: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x188: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x190: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x198: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1a0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1a8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1b0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1b8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1c0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1c8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1d0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1d8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1e0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1e8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1f0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1f8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x200: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x208: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x210: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x218: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x220: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x228: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x230: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x238: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x240: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x248: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x250: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x258: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x260: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x268: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x270: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x278: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x280: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x288: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x290: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x298: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2a0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2a8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2b0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2b8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2c0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2c8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2d0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2d8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2e0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2e8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2f0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2f8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x300: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x308: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x310: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x318: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x320: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x328: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x330: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x338: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x340: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x348: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x350: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x358: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x360: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x368: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x370: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x378: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x380: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x388: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x390: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x398: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x3a0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x3a8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x3b0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x3b8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x3c0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x3c8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x3d0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x3d8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x3e0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x3e8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x3f0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x3f8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, -/* 0x400: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x408: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x410: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x418: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x420: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x428: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x430: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x438: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x440: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x448: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x450: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x458: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x460: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x468: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x470: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x478: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x480: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x488: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x490: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x498: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x4a0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x4a8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x4b0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x4b8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x4c0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x4c8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x4d0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x4d8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x4e0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x4e8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x4f0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x4f8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x500: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x508: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x510: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x518: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x520: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x528: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x530: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x538: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x540: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x548: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x550: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x558: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x560: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x568: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x570: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x578: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x580: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x588: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x590: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x598: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x5a0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x5a8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x5b0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x5b8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x5c0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x5c8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x5d0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x5d8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x5e0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x5e8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x5f0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x5f8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x600: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x608: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x610: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x618: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x620: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x628: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x630: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x638: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x640: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x648: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x650: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x658: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x660: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x668: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x670: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x678: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x680: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x688: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x690: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x698: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x6a0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x6a8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x6b0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x6b8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x6c0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x6c8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x6d0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x6d8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x6e0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x6e8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x6f0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x6f8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x700: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x708: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x710: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x718: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x720: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x728: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x730: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x738: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x740: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x748: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x750: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x758: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x760: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x768: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x770: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x778: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x780: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x788: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x790: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x798: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x7a0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x7a8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x7b0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x7b8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x7c0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x7c8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x7d0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x7d8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x7e0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x7e8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, -/* 0x7f0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, -/* 0x7f8: */ 0x00, 0x00, 0x00, 0x78, 0x78, 0x7e, 0x7f, 0x7f, -/* 0x800: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x808: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x810: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x818: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x820: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x828: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x830: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x838: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x840: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x848: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x850: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x858: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x860: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x868: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x870: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x878: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x880: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x888: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x890: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x898: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x8a0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x8a8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x8b0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x8b8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x8c0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x8c8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x8d0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x8d8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x8e0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x8e8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x8f0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x8f8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x900: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x908: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x910: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x918: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x920: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x928: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x930: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x938: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x940: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x948: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x950: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x958: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x960: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x968: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x970: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x978: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x980: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x988: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x990: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x998: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x9a0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x9a8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x9b0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x9b8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x9c0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x9c8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x9d0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x9d8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x9e0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x9e8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x9f0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x9f8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa00: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa08: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa10: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa18: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa20: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa28: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa30: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa38: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa40: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa48: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa50: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa58: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa60: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa68: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa70: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa78: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa80: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa88: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa90: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa98: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xaa0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xaa8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xab0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xab8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xac0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xac8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xad0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xad8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xae0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xae8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xaf0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xaf8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb00: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb08: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb10: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb18: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb20: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb28: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb30: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb38: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb40: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb48: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb50: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb58: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb60: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb68: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb70: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb78: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb80: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb88: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb90: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb98: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xba0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xba8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xbb0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xbb8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xbc0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xbc8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xbd0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xbd8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xbe0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xbe8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xbf0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xbf8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, -/* 0xc00: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc08: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc10: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc18: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc20: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc28: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc30: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc38: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc40: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc48: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc50: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc58: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc60: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc68: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc70: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc78: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc80: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc88: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc90: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc98: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xca0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xca8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xcb0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xcb8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xcc0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xcc8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xcd0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xcd8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xce0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xce8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xcf0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xcf8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd00: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd08: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd10: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd18: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd20: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd28: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd30: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd38: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd40: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd48: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd50: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd58: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd60: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd68: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd70: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd78: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd80: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd88: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd90: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd98: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xda0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xda8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xdb0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xdb8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xdc0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xdc8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xdd0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xdd8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xde0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xde8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xdf0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xdf8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe00: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe08: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe10: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe18: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe20: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe28: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe30: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe38: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe40: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe48: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe50: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe58: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe60: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe68: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe70: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe78: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe80: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe88: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe90: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe98: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xea0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xea8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xeb0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xeb8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xec0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xec8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xed0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xed8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xee0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xee8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xef0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xef8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xf00: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xf08: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xf10: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xf18: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xf20: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xf28: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xf30: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xf38: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xf40: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xf48: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xf50: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xf58: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xf60: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xf68: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xf70: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xf78: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xf80: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xf88: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xf90: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xf98: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xfa0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xfa8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xfb0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xfb8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xfc0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xfc8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xfd0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xfd8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xfe0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xfe8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, -/* 0xff0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, -/* 0xff8: */ 0x00, 0x00, 0x00, 0x78, 0x78, 0x7e, 0x7f, 0x7f, -}; - -RESID_NAMESPACE_STOP diff --git a/MCUME_pico/picosnd/reSID/wave6581_PS_.cpp b/MCUME_pico/picosnd/reSID/wave6581_PS_.cpp deleted file mode 100755 index 08febfe..0000000 --- a/MCUME_pico/picosnd/reSID/wave6581_PS_.cpp +++ /dev/null @@ -1,541 +0,0 @@ -// --------------------------------------------------------------------------- -// This file is part of reSID, a MOS6581 SID emulator engine. -// Copyright (C) 2004 Dag Lem -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// --------------------------------------------------------------------------- - -#include "wave.h" - -RESID_NAMESPACE_START - -//reg8 WaveformGenerator::wave6581_PS_[] = -const reg8 wave6581_PS_[] = -{ -/* 0x000: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x008: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x010: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x018: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x020: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x028: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x030: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x038: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x040: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x048: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x050: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x058: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x060: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x068: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x070: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x078: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x080: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x088: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x090: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x098: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0a0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0a8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0b0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0b8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0c0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0c8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0d0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0d8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0e0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0e8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0f0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0f8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, -/* 0x100: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x108: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x110: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x118: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x120: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x128: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x130: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x138: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x140: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x148: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x150: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x158: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x160: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x168: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x170: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x178: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, -/* 0x180: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x188: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x190: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x198: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1a0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1a8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1b0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1b8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, -/* 0x1c0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1c8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1d0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1d8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1e0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1e8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1f0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1f8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x1f, -/* 0x200: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x208: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x210: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x218: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x220: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x228: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x230: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x238: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x240: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x248: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x250: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x258: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x260: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x268: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x270: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x278: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, -/* 0x280: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x288: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x290: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x298: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2a0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2a8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2b0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2b8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, -/* 0x2c0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2c8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2d0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2d8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2e0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2e8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2f0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2f8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2f, -/* 0x300: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x308: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x310: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x318: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x320: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x328: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x330: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x338: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x340: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x348: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x350: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x358: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x360: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x368: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x370: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x378: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x37, -/* 0x380: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x388: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x390: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x398: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x3a0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x3a8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x3b0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x3b8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3b, -/* 0x3c0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x3c8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x3d0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x3d8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3d, -/* 0x3e0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x3e8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, -/* 0x3f0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x3f, -/* 0x3f8: */ 0x00, 0x30, 0x38, 0x3f, 0x3e, 0x3f, 0x3f, 0x3f, -/* 0x400: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x408: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x410: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x418: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x420: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x428: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x430: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x438: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x440: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x448: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x450: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x458: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x460: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x468: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x470: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x478: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, -/* 0x480: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x488: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x490: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x498: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x4a0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x4a8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x4b0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x4b8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x4c0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x4c8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x4d0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x4d8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x4e0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x4e8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x4f0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x4f8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4f, -/* 0x500: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x508: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x510: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x518: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x520: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x528: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x530: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x538: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x540: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x548: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x550: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x558: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x560: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x568: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x570: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x578: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, -/* 0x580: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x588: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x590: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x598: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x5a0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x5a8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x5b0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x5b8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5b, -/* 0x5c0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x5c8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x5d0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x5d8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5d, -/* 0x5e0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x5e8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5e, -/* 0x5f0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x5f, -/* 0x5f8: */ 0x00, 0x40, 0x40, 0x5f, 0x5c, 0x5f, 0x5f, 0x5f, -/* 0x600: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x608: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x610: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x618: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x620: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x628: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x630: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x638: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x640: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x648: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x650: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x658: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x660: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x668: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x670: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x678: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x67, -/* 0x680: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x688: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x690: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x698: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x6a0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x6a8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x6b0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x6b8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x6b, -/* 0x6c0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x6c8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x6d0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x6d8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x40, 0x6d, -/* 0x6e0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, -/* 0x6e8: */ 0x00, 0x00, 0x00, 0x40, 0x00, 0x40, 0x40, 0x6e, -/* 0x6f0: */ 0x00, 0x00, 0x00, 0x40, 0x00, 0x60, 0x60, 0x6f, -/* 0x6f8: */ 0x00, 0x60, 0x60, 0x6f, 0x60, 0x6f, 0x6f, 0x6f, -/* 0x700: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x708: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x710: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x718: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, -/* 0x720: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x728: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, -/* 0x730: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, -/* 0x738: */ 0x00, 0x00, 0x00, 0x40, 0x00, 0x40, 0x60, 0x73, -/* 0x740: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x748: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, -/* 0x750: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, -/* 0x758: */ 0x00, 0x00, 0x00, 0x40, 0x00, 0x60, 0x60, 0x75, -/* 0x760: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, -/* 0x768: */ 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x60, 0x76, -/* 0x770: */ 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x60, 0x77, -/* 0x778: */ 0x00, 0x70, 0x70, 0x77, 0x70, 0x77, 0x77, 0x77, -/* 0x780: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x788: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, -/* 0x790: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, -/* 0x798: */ 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x60, 0x79, -/* 0x7a0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, -/* 0x7a8: */ 0x00, 0x00, 0x00, 0x60, 0x00, 0x70, 0x70, 0x7a, -/* 0x7b0: */ 0x00, 0x00, 0x00, 0x70, 0x00, 0x70, 0x70, 0x7b, -/* 0x7b8: */ 0x40, 0x70, 0x70, 0x7b, 0x78, 0x7b, 0x7b, 0x7b, -/* 0x7c0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, -/* 0x7c8: */ 0x00, 0x00, 0x00, 0x70, 0x00, 0x70, 0x70, 0x7c, -/* 0x7d0: */ 0x00, 0x00, 0x00, 0x70, 0x40, 0x70, 0x70, 0x7d, -/* 0x7d8: */ 0x40, 0x70, 0x78, 0x7d, 0x78, 0x7d, 0x7d, 0x7d, -/* 0x7e0: */ 0x00, 0x40, 0x40, 0x78, 0x60, 0x78, 0x78, 0x7e, -/* 0x7e8: */ 0x60, 0x78, 0x78, 0x7e, 0x7c, 0x7e, 0x7e, 0x7e, -/* 0x7f0: */ 0x70, 0x7c, 0x7c, 0x7f, 0x7e, 0x7f, 0x7f, 0x7f, -/* 0x7f8: */ 0x7e, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, -/* 0x800: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x808: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x810: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x818: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x820: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x828: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x830: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x838: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x840: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x848: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x850: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x858: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x860: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x868: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x870: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x878: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x880: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x888: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x890: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x898: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x8a0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x8a8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x8b0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x8b8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x8c0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x8c8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x8d0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x8d8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x8e0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x8e8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x8f0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x8f8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, -/* 0x900: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x908: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x910: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x918: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x920: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x928: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x930: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x938: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x940: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x948: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x950: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x958: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x960: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x968: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x970: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x978: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, -/* 0x980: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x988: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x990: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x998: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x9a0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x9a8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x9b0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x9b8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, -/* 0x9c0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x9c8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x9d0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x9d8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x9e0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x9e8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x9f0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x9f8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x1f, -/* 0xa00: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa08: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa10: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa18: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa20: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa28: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa30: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa38: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa40: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa48: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa50: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa58: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa60: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa68: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa70: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa78: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, -/* 0xa80: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa88: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa90: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa98: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xaa0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xaa8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xab0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xab8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, -/* 0xac0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xac8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xad0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xad8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xae0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xae8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xaf0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xaf8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2f, -/* 0xb00: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb08: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb10: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb18: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb20: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb28: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb30: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb38: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb40: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb48: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb50: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb58: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb60: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb68: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb70: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb78: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x37, -/* 0xb80: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb88: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb90: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb98: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xba0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xba8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xbb0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xbb8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3b, -/* 0xbc0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xbc8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xbd0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xbd8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3d, -/* 0xbe0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xbe8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, -/* 0xbf0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x3f, -/* 0xbf8: */ 0x00, 0x30, 0x38, 0x3f, 0x3e, 0x3f, 0x3f, 0x3f, -/* 0xc00: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc08: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc10: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc18: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc20: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc28: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc30: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc38: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc40: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc48: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc50: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc58: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc60: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc68: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc70: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc78: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, -/* 0xc80: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc88: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc90: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc98: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xca0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xca8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xcb0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xcb8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xcc0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xcc8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xcd0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xcd8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xce0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xce8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xcf0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xcf8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4f, -/* 0xd00: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd08: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd10: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd18: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd20: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd28: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd30: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd38: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd40: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd48: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd50: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd58: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd60: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd68: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd70: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd78: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, -/* 0xd80: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd88: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd90: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd98: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xda0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xda8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xdb0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xdb8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5b, -/* 0xdc0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xdc8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xdd0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xdd8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5d, -/* 0xde0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xde8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5e, -/* 0xdf0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x5f, -/* 0xdf8: */ 0x00, 0x40, 0x40, 0x5f, 0x5c, 0x5f, 0x5f, 0x5f, -/* 0xe00: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe08: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe10: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe18: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe20: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe28: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe30: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe38: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe40: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe48: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe50: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe58: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe60: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe68: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe70: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe78: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x67, -/* 0xe80: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe88: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe90: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe98: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xea0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xea8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xeb0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xeb8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x6b, -/* 0xec0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xec8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xed0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xed8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x6d, -/* 0xee0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, -/* 0xee8: */ 0x00, 0x00, 0x00, 0x40, 0x00, 0x40, 0x40, 0x6e, -/* 0xef0: */ 0x00, 0x00, 0x00, 0x40, 0x00, 0x60, 0x60, 0x6f, -/* 0xef8: */ 0x00, 0x60, 0x60, 0x6f, 0x60, 0x6f, 0x6f, 0x6f, -/* 0xf00: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xf08: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xf10: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xf18: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, -/* 0xf20: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xf28: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, -/* 0xf30: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, -/* 0xf38: */ 0x00, 0x00, 0x00, 0x40, 0x00, 0x40, 0x60, 0x73, -/* 0xf40: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xf48: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, -/* 0xf50: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, -/* 0xf58: */ 0x00, 0x00, 0x00, 0x40, 0x00, 0x60, 0x60, 0x75, -/* 0xf60: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, -/* 0xf68: */ 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x60, 0x76, -/* 0xf70: */ 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x60, 0x77, -/* 0xf78: */ 0x00, 0x70, 0x70, 0x77, 0x70, 0x77, 0x77, 0x77, -/* 0xf80: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xf88: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, -/* 0xf90: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, -/* 0xf98: */ 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x60, 0x79, -/* 0xfa0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, -/* 0xfa8: */ 0x00, 0x00, 0x00, 0x60, 0x00, 0x70, 0x70, 0x7a, -/* 0xfb0: */ 0x00, 0x00, 0x00, 0x70, 0x00, 0x70, 0x70, 0x7b, -/* 0xfb8: */ 0x40, 0x70, 0x70, 0x7b, 0x78, 0x7b, 0x7b, 0x7b, -/* 0xfc0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, -/* 0xfc8: */ 0x00, 0x00, 0x00, 0x70, 0x00, 0x70, 0x70, 0x7c, -/* 0xfd0: */ 0x00, 0x00, 0x00, 0x70, 0x40, 0x70, 0x70, 0x7d, -/* 0xfd8: */ 0x40, 0x70, 0x78, 0x7d, 0x78, 0x7d, 0x7d, 0x7d, -/* 0xfe0: */ 0x00, 0x40, 0x40, 0x78, 0x60, 0x78, 0x78, 0x7e, -/* 0xfe8: */ 0x60, 0x78, 0x78, 0x7e, 0x7c, 0x7e, 0x7e, 0x7e, -/* 0xff0: */ 0x70, 0x7c, 0x7c, 0x7f, 0x7c, 0x7f, 0x7f, 0x7f, -/* 0xff8: */ 0x7e, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, -}; - -RESID_NAMESPACE_STOP diff --git a/MCUME_pico/picosnd/reSID/wave6581_P_T.cpp b/MCUME_pico/picosnd/reSID/wave6581_P_T.cpp deleted file mode 100755 index 03c770f..0000000 --- a/MCUME_pico/picosnd/reSID/wave6581_P_T.cpp +++ /dev/null @@ -1,541 +0,0 @@ -// --------------------------------------------------------------------------- -// This file is part of reSID, a MOS6581 SID emulator engine. -// Copyright (C) 2004 Dag Lem -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// --------------------------------------------------------------------------- - -#include "wave.h" - -RESID_NAMESPACE_START - -//reg8 WaveformGenerator::wave6581_P_T[] = -const reg8 wave6581_P_T[] = -{ -/* 0x000: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x008: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x010: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x018: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x020: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x028: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x030: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x038: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x040: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x048: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x050: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x058: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x060: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x068: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x070: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x078: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x080: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x088: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x090: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x098: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0a0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0a8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0b0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0b8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0c0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0c8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0d0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0d8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0e0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0e8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0f0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0f8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x100: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x108: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x110: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x118: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x120: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x128: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x130: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x138: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x140: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x148: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x150: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x158: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x160: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x168: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x170: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x178: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x180: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x188: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x190: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x198: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1a0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1a8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1b0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1b8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1c0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1c8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1d0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1d8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1e0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1e8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1f0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1f8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x38, 0x3f, -/* 0x200: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x208: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x210: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x218: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x220: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x228: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x230: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x238: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x240: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x248: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x250: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x258: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x260: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x268: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x270: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x278: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x280: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x288: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x290: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x298: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2a0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2a8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2b0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2b8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2c0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2c8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2d0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2d8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2e0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2e8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2f0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2f8: */ 0x00, 0x00, 0x00, 0x40, 0x00, 0x40, 0x40, 0x5f, -/* 0x300: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x308: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x310: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x318: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x320: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x328: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x330: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x338: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x340: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x348: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x350: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x358: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x360: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x368: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, -/* 0x370: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, -/* 0x378: */ 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x60, 0x6f, -/* 0x380: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x388: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x390: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x398: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, -/* 0x3a0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x3a8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, -/* 0x3b0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, -/* 0x3b8: */ 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x70, 0x77, -/* 0x3c0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x3c8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, -/* 0x3d0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, -/* 0x3d8: */ 0x00, 0x00, 0x00, 0x70, 0x40, 0x70, 0x70, 0x7b, -/* 0x3e0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x70, -/* 0x3e8: */ 0x00, 0x40, 0x40, 0x70, 0x60, 0x70, 0x78, 0x7d, -/* 0x3f0: */ 0x00, 0x40, 0x60, 0x78, 0x60, 0x78, 0x78, 0x7e, -/* 0x3f8: */ 0x70, 0x7c, 0x7c, 0x7f, 0x7e, 0x7f, 0x7f, 0x7f, -/* 0x400: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x408: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x410: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x418: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x420: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x428: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x430: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x438: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x440: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x448: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x450: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x458: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x460: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x468: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x470: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x478: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, -/* 0x480: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x488: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x490: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x498: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x4a0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x4a8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x4b0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x4b8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, -/* 0x4c0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x4c8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x4d0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x4d8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, -/* 0x4e0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x4e8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, -/* 0x4f0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, -/* 0x4f8: */ 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x9f, -/* 0x500: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x508: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x510: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x518: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x520: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x528: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x530: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x538: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, -/* 0x540: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x548: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x550: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x558: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, -/* 0x560: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x568: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, -/* 0x570: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, -/* 0x578: */ 0x00, 0x80, 0x80, 0x80, 0x80, 0xa0, 0xa0, 0xaf, -/* 0x580: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x588: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x590: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x598: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, -/* 0x5a0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x5a8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, -/* 0x5b0: */ 0x00, 0x00, 0x00, 0x80, 0x00, 0x80, 0x80, 0xa0, -/* 0x5b8: */ 0x00, 0x80, 0x80, 0xa0, 0x80, 0xa0, 0xb0, 0xb7, -/* 0x5c0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, -/* 0x5c8: */ 0x00, 0x00, 0x00, 0x80, 0x00, 0x80, 0x80, 0xa0, -/* 0x5d0: */ 0x00, 0x00, 0x00, 0x80, 0x00, 0x80, 0x80, 0xa0, -/* 0x5d8: */ 0x00, 0x80, 0x80, 0xa0, 0x80, 0xb0, 0xb0, 0xbb, -/* 0x5e0: */ 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0xb0, -/* 0x5e8: */ 0x80, 0x80, 0x80, 0xb0, 0x80, 0xb0, 0xb8, 0xbd, -/* 0x5f0: */ 0x80, 0x80, 0x80, 0xb8, 0xa0, 0xb8, 0xb8, 0xbe, -/* 0x5f8: */ 0xa0, 0xb8, 0xbc, 0xbf, 0xbe, 0xbf, 0xbf, 0xbf, -/* 0x600: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x608: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x610: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x618: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x620: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x628: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x630: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x638: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, -/* 0x640: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x648: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x650: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x658: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0xc0, -/* 0x660: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x668: */ 0x00, 0x00, 0x00, 0x80, 0x00, 0x80, 0x80, 0xc0, -/* 0x670: */ 0x00, 0x00, 0x00, 0x80, 0x00, 0x80, 0x80, 0xc0, -/* 0x678: */ 0x00, 0x80, 0x80, 0xc0, 0xc0, 0xc0, 0xc0, 0xcf, -/* 0x680: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x688: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, -/* 0x690: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, -/* 0x698: */ 0x00, 0x00, 0x00, 0x80, 0x00, 0x80, 0x80, 0xc0, -/* 0x6a0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, -/* 0x6a8: */ 0x00, 0x00, 0x00, 0x80, 0x00, 0x80, 0x80, 0xc0, -/* 0x6b0: */ 0x00, 0x00, 0x00, 0x80, 0x00, 0x80, 0xc0, 0xc0, -/* 0x6b8: */ 0x80, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xd0, 0xd7, -/* 0x6c0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, -/* 0x6c8: */ 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0xc0, 0xc0, -/* 0x6d0: */ 0x00, 0x80, 0x80, 0xc0, 0x80, 0xc0, 0xc0, 0xc0, -/* 0x6d8: */ 0x80, 0xc0, 0xc0, 0xc0, 0xc0, 0xd0, 0xd0, 0xdb, -/* 0x6e0: */ 0x00, 0x80, 0x80, 0xc0, 0x80, 0xc0, 0xc0, 0xd0, -/* 0x6e8: */ 0x80, 0xc0, 0xc0, 0xd0, 0xc0, 0xd0, 0xd8, 0xdd, -/* 0x6f0: */ 0xc0, 0xc0, 0xc0, 0xd0, 0xc0, 0xd8, 0xd8, 0xde, -/* 0x6f8: */ 0xc0, 0xd8, 0xdc, 0xdf, 0xdc, 0xdf, 0xdf, 0xdf, -/* 0x700: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x708: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, -/* 0x710: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, -/* 0x718: */ 0x00, 0x00, 0x00, 0x80, 0x80, 0xc0, 0xc0, 0xe0, -/* 0x720: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, -/* 0x728: */ 0x00, 0x80, 0x80, 0xc0, 0x80, 0xc0, 0xc0, 0xe0, -/* 0x730: */ 0x00, 0x80, 0x80, 0xc0, 0x80, 0xc0, 0xc0, 0xe0, -/* 0x738: */ 0x80, 0xc0, 0xc0, 0xe0, 0xc0, 0xe0, 0xe0, 0xe7, -/* 0x740: */ 0x00, 0x00, 0x00, 0x80, 0x00, 0x80, 0x80, 0xc0, -/* 0x748: */ 0x00, 0x80, 0x80, 0xc0, 0x80, 0xc0, 0xc0, 0xe0, -/* 0x750: */ 0x00, 0x80, 0x80, 0xc0, 0x80, 0xc0, 0xc0, 0xe0, -/* 0x758: */ 0xc0, 0xc0, 0xc0, 0xe0, 0xe0, 0xe0, 0xe0, 0xeb, -/* 0x760: */ 0x80, 0x80, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xe0, -/* 0x768: */ 0xc0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xed, -/* 0x770: */ 0xc0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe8, 0xe8, 0xee, -/* 0x778: */ 0xe0, 0xe8, 0xec, 0xef, 0xec, 0xef, 0xef, 0xef, -/* 0x780: */ 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0xc0, -/* 0x788: */ 0x80, 0x80, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xf0, -/* 0x790: */ 0x80, 0xc0, 0xc0, 0xc0, 0xc0, 0xe0, 0xe0, 0xf0, -/* 0x798: */ 0xc0, 0xe0, 0xe0, 0xf0, 0xe0, 0xf0, 0xf0, 0xf3, -/* 0x7a0: */ 0x80, 0xc0, 0xc0, 0xe0, 0xc0, 0xe0, 0xe0, 0xf0, -/* 0x7a8: */ 0xc0, 0xe0, 0xe0, 0xf0, 0xe0, 0xf0, 0xf0, 0xf5, -/* 0x7b0: */ 0xe0, 0xe0, 0xe0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 0xe0, 0xc0, 0xc0, 0x80, 0xc0, 0x80, 0x80, 0x00, -/* 0x8d8: */ 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x8e0: */ 0xe0, 0xc0, 0xc0, 0x80, 0x80, 0x00, 0x00, 0x00, -/* 0x8e8: */ 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x8f0: */ 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x8f8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x900: */ 0xdf, 0xdf, 0xdf, 0xdc, 0xdf, 0xdc, 0xd8, 0xc0, -/* 0x908: */ 0xde, 0xd8, 0xd8, 0xc0, 0xd8, 0xc0, 0xc0, 0xc0, -/* 0x910: */ 0xdd, 0xd8, 0xd0, 0xc0, 0xd0, 0xc0, 0xc0, 0x80, -/* 0x918: */ 0xd0, 0xc0, 0xc0, 0x80, 0xc0, 0x80, 0x80, 0x00, -/* 0x920: */ 0xdb, 0xd0, 0xd0, 0xc0, 0xc0, 0xc0, 0xc0, 0x80, -/* 0x928: */ 0xc0, 0xc0, 0xc0, 0x80, 0xc0, 0x80, 0x80, 0x00, -/* 0x930: */ 0xc0, 0xc0, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, -/* 0x938: */ 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x940: */ 0xd7, 0xd0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0x80, -/* 0x948: */ 0xc0, 0xc0, 0x80, 0x00, 0x80, 0x00, 0x00, 0x00, -/* 0x950: */ 0xc0, 0x80, 0x80, 0x00, 0x80, 0x00, 0x00, 0x00, -/* 0x958: */ 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x960: */ 0xc0, 0x80, 0x80, 0x00, 0x80, 0x00, 0x00, 0x00, -/* 0x968: */ 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x970: */ 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x978: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x980: */ 0xcf, 0xc0, 0xc0, 0xc0, 0xc0, 0x80, 0x80, 0x00, -/* 0x988: */ 0xc0, 0x80, 0x80, 0x00, 0x80, 0x00, 0x00, 0x00, -/* 0x990: */ 0xc0, 0x80, 0x80, 0x00, 0x80, 0x00, 0x00, 0x00, -/* 0x998: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x9a0: */ 0xc0, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x9a8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x9b0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x9b8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x9c0: */ 0xc0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x9c8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x9d0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x9d8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x9e0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x9e8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x9f0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x9f8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa00: */ 0xbf, 0xbf, 0xbf, 0xbe, 0xbf, 0xbc, 0xbc, 0xa0, -/* 0xa08: */ 0xbe, 0xbc, 0xb8, 0xa0, 0xb8, 0xa0, 0x80, 0x80, -/* 0xa10: */ 0xbd, 0xb8, 0xb0, 0x80, 0xb0, 0x80, 0x80, 0x80, -/* 0xa18: */ 0xb0, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, -/* 0xa20: */ 0xbb, 0xb0, 0xb0, 0x80, 0xa0, 0x80, 0x80, 0x00, -/* 0xa28: */ 0xa0, 0x80, 0x80, 0x00, 0x80, 0x00, 0x00, 0x00, -/* 0xa30: */ 0xa0, 0x80, 0x80, 0x00, 0x80, 0x00, 0x00, 0x00, -/* 0xa38: */ 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa40: */ 0xb7, 0xb0, 0xa0, 0x80, 0xa0, 0x80, 0x80, 0x00, -/* 0xa48: */ 0xa0, 0x80, 0x80, 0x00, 0x80, 0x00, 0x00, 0x00, -/* 0xa50: */ 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa58: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa60: */ 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa68: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa70: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa78: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa80: */ 0xaf, 0xa0, 0xa0, 0x80, 0x80, 0x80, 0x80, 0x00, -/* 0xa88: */ 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa90: */ 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa98: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xaa0: */ 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xaa8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xab0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xab8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xac0: */ 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xac8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xad0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xad8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xae0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xae8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xaf0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xaf8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb00: */ 0x9f, 0x90, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, -/* 0xb08: */ 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb10: */ 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb18: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb20: */ 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb28: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb30: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb38: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb40: */ 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb48: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb50: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb58: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb60: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb68: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb70: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb78: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb80: */ 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb88: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb90: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb98: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xba0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xba8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xbb0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xbb8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xbc0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xbc8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xbd0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xbd8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xbe0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xbe8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xbf0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xbf8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc00: */ 0x7f, 0x7f, 0x7f, 0x7e, 0x7f, 0x7c, 0x7c, 0x70, -/* 0xc08: */ 0x7e, 0x7c, 0x78, 0x60, 0x78, 0x60, 0x60, 0x00, -/* 0xc10: */ 0x7d, 0x78, 0x78, 0x60, 0x70, 0x40, 0x40, 0x00, -/* 0xc18: */ 0x70, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc20: */ 0x7b, 0x78, 0x70, 0x40, 0x70, 0x40, 0x00, 0x00, -/* 0xc28: */ 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc30: */ 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc38: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc40: */ 0x77, 0x70, 0x70, 0x00, 0x60, 0x00, 0x00, 0x00, -/* 0xc48: */ 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc50: */ 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc58: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc60: */ 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc68: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc70: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc78: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc80: */ 0x6f, 0x60, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, -/* 0xc88: */ 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc90: */ 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc98: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xca0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xca8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xcb0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xcb8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xcc0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xcc8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xcd0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xcd8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xce0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xce8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xcf0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xcf8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd00: */ 0x5f, 0x58, 0x40, 0x00, 0x40, 0x00, 0x00, 0x00, -/* 0xd08: */ 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd10: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd18: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd20: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd28: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd30: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd38: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd40: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd48: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd50: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd58: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd60: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd68: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd70: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd78: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd80: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd88: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd90: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd98: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xda0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xda8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xdb0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xdb8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xdc0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xdc8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xdd0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xdd8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xde0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xde8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xdf0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xdf8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe00: */ 0x3f, 0x3c, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe08: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe10: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe18: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe20: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe28: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe30: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe38: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe40: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe48: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe50: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe58: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe60: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe68: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe70: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe78: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe80: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe88: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe90: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe98: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xea0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xea8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xeb0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xeb8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xec0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xec8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xed0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xed8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xee0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xee8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xef0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xef8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xf00: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xf08: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xf10: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xf18: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xf20: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xf28: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xf30: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xf38: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xf40: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xf48: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xf50: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xf58: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xf60: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xf68: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xf70: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xf78: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xf80: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xf88: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xf90: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xf98: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xfa0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xfa8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xfb0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xfb8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xfc0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xfc8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xfd0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xfd8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xfe0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xfe8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xff0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xff8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; - -RESID_NAMESPACE_STOP diff --git a/MCUME_pico/picosnd/reSID/wave6581__ST.cpp b/MCUME_pico/picosnd/reSID/wave6581__ST.cpp deleted file mode 100755 index ac5f52d..0000000 --- a/MCUME_pico/picosnd/reSID/wave6581__ST.cpp +++ /dev/null @@ -1,541 +0,0 @@ -// --------------------------------------------------------------------------- -// This file is part of reSID, a MOS6581 SID emulator engine. -// Copyright (C) 2004 Dag Lem -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// --------------------------------------------------------------------------- - -#include "wave.h" - -RESID_NAMESPACE_START - -//reg8 WaveformGenerator::wave6581__ST[] = -const reg8 wave6581__ST[] = -{ -/* 0x000: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x008: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x010: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x018: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x020: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x028: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x030: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x038: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x040: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x048: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x050: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x058: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x060: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x068: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x070: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x078: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, -/* 0x080: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x088: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x090: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x098: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0a0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0a8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0b0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0b8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, -/* 0x0c0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0c8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0d0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0d8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0e0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0e8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0f0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0f8: */ 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x07, 0x07, -/* 0x100: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x108: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x110: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x118: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x120: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x128: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x130: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x138: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, -/* 0x140: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x148: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x150: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x158: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x160: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x168: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x170: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x178: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, -/* 0x180: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x188: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x190: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x198: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1a0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1a8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1b0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1b8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, -/* 0x1c0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1c8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1d0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1d8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1e0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1e8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1f0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1f8: */ 0x0e, 0x0e, 0x0e, 0x0e, 0x0f, 0x0f, 0x0f, 0x0f, -/* 0x200: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x208: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x210: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x218: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x220: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x228: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x230: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x238: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x240: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x248: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x250: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x258: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x260: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x268: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x270: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x278: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, -/* 0x280: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x288: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x290: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x298: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2a0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2a8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2b0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2b8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, -/* 0x2c0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2c8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2d0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2d8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2e0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2e8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2f0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2f8: */ 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x07, 0x07, -/* 0x300: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x308: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x310: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x318: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x320: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x328: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x330: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x338: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, -/* 0x340: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x348: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x350: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x358: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x360: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x368: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x370: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x378: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, -/* 0x380: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x388: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x390: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x398: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x3a0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x3a8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x3b0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x3b8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, -/* 0x3c0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x3c8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x3d0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x3d8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x3e0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x3e8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x3f0: */ 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, -/* 0x3f8: */ 0x1e, 0x1e, 0x1e, 0x1e, 0x1f, 0x1f, 0x3f, 0x3f, -/* 0x400: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x408: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x410: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x418: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x420: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x428: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x430: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x438: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x440: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x448: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x450: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x458: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x460: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x468: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x470: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x478: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, -/* 0x480: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x488: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x490: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x498: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x4a0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x4a8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x4b0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x4b8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, -/* 0x4c0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x4c8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x4d0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x4d8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x4e0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x4e8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x4f0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x4f8: */ 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x07, 0x07, -/* 0x500: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x508: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x510: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x518: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x520: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x528: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x530: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x538: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, -/* 0x540: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x548: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x550: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x558: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x560: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x568: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x570: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x578: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, -/* 0x580: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x588: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x590: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x598: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x5a0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x5a8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x5b0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x5b8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, -/* 0x5c0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x5c8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x5d0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x5d8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x5e0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x5e8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x5f0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x5f8: */ 0x0e, 0x0e, 0x0e, 0x0e, 0x0f, 0x0f, 0x0f, 0x1f, -/* 0x600: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x608: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x610: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x618: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x620: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x628: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x630: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x638: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x640: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x648: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x650: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x658: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x660: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x668: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x670: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x678: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, -/* 0x680: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x688: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x690: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x698: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x6a0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x6a8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x6b0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x6b8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, -/* 0x6c0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x6c8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x6d0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x6d8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x6e0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x6e8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x6f0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x6f8: */ 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x07, 0x07, -/* 0x700: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x708: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x710: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x718: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x720: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x728: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x730: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x738: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, -/* 0x740: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x748: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x750: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x758: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x760: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x768: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x770: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x778: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, -/* 0x780: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x788: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x790: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x798: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x7a0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x7a8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x7b0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x7b8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, -/* 0x7c0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x7c8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x7d0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x7d8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x7e0: */ 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, -/* 0x7e8: */ 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, -/* 0x7f0: */ 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, -/* 0x7f8: */ 0x3e, 0x3e, 0x3f, 0x3f, 0x7f, 0x7f, 0x7f, 0x7f, -/* 0x800: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x808: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x810: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x818: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x820: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x828: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x830: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x838: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x840: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x848: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x850: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x858: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x860: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x868: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x870: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x878: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, -/* 0x880: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x888: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x890: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x898: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x8a0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x8a8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x8b0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x8b8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, -/* 0x8c0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x8c8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x8d0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x8d8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x8e0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x8e8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x8f0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x8f8: */ 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x07, 0x07, -/* 0x900: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x908: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x910: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x918: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x920: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x928: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x930: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x938: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, -/* 0x940: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x948: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x950: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x958: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x960: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x968: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x970: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x978: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, -/* 0x980: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x988: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x990: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x998: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x9a0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x9a8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x9b0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x9b8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, -/* 0x9c0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x9c8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x9d0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x9d8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x9e0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x9e8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x9f0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x9f8: */ 0x0e, 0x0e, 0x0e, 0x0e, 0x0f, 0x0f, 0x0f, 0x0f, -/* 0xa00: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa08: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa10: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa18: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa20: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa28: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa30: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa38: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa40: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa48: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa50: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa58: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa60: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa68: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa70: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa78: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, -/* 0xa80: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa88: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa90: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa98: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xaa0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xaa8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xab0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xab8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, -/* 0xac0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xac8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xad0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xad8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xae0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xae8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xaf0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xaf8: */ 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x07, 0x07, -/* 0xb00: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb08: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb10: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb18: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb20: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb28: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb30: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb38: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, -/* 0xb40: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb48: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb50: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb58: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb60: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb68: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb70: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb78: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, -/* 0xb80: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb88: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb90: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb98: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xba0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xba8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xbb0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xbb8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, -/* 0xbc0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xbc8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xbd0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xbd8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xbe0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xbe8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xbf0: */ 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, -/* 0xbf8: */ 0x1e, 0x1e, 0x1e, 0x1e, 0x1f, 0x1f, 0x3f, 0x3f, -/* 0xc00: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc08: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc10: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc18: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc20: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc28: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc30: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc38: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc40: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc48: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc50: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc58: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc60: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc68: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc70: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc78: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, -/* 0xc80: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc88: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc90: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc98: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xca0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xca8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xcb0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xcb8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, -/* 0xcc0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xcc8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xcd0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xcd8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xce0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xce8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xcf0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xcf8: */ 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x07, 0x07, -/* 0xd00: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd08: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd10: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd18: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd20: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd28: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd30: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd38: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, -/* 0xd40: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd48: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd50: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd58: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd60: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd68: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd70: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd78: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, -/* 0xd80: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd88: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd90: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd98: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xda0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xda8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xdb0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xdb8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, -/* 0xdc0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xdc8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xdd0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xdd8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xde0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xde8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xdf0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xdf8: */ 0x0e, 0x0e, 0x0e, 0x0e, 0x0f, 0x0f, 0x0f, 0x1f, -/* 0xe00: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe08: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe10: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe18: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe20: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe28: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe30: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe38: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe40: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe48: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe50: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe58: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe60: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe68: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe70: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe78: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, -/* 0xe80: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe88: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe90: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe98: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xea0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xea8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xeb0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xeb8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, -/* 0xec0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xec8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xed0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xed8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xee0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xee8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xef0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xef8: */ 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x07, 0x07, -/* 0xf00: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xf08: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xf10: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xf18: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xf20: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xf28: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xf30: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xf38: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, -/* 0xf40: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xf48: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xf50: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xf58: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xf60: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xf68: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xf70: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xf78: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, -/* 0xf80: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xf88: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xf90: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xf98: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xfa0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xfa8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xfb0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xfb8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, -/* 0xfc0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xfc8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xfd0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xfd8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xfe0: */ 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, -/* 0xfe8: */ 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, -/* 0xff0: */ 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, -/* 0xff8: */ 0x3e, 0x3e, 0x3f, 0x3f, 0x7f, 0x7f, 0x7f, 0x7f, -}; - -RESID_NAMESPACE_STOP diff --git a/MCUME_pico/picosnd/reSID/wave8580_PST.cpp b/MCUME_pico/picosnd/reSID/wave8580_PST.cpp deleted file mode 100755 index f43f34d..0000000 --- a/MCUME_pico/picosnd/reSID/wave8580_PST.cpp +++ /dev/null @@ -1,541 +0,0 @@ -// --------------------------------------------------------------------------- -// This file is part of reSID, a MOS6581 SID emulator engine. -// Copyright (C) 2004 Dag Lem -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// --------------------------------------------------------------------------- - -#include "wave.h" - -RESID_NAMESPACE_START - -//reg8 WaveformGenerator::wave8580_PST[] = -const reg8 wave8580_PST[] = -{ -/* 0x000: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x008: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x010: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x018: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x020: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x028: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x030: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x038: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x040: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x048: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x050: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x058: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x060: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x068: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x070: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x078: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x080: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x088: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x090: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x098: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0a0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0a8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0b0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0b8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0c0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0c8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0d0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0d8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0e0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0e8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0f0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0f8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x100: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x108: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x110: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x118: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x120: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x128: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x130: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x138: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x140: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x148: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x150: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x158: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x160: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x168: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x170: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x178: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x180: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x188: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x190: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x198: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1a0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1a8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1b0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1b8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1c0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1c8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1d0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1d8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1e0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1e8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1f0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1f8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x200: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x208: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x210: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x218: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x220: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x228: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x230: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x238: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x240: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x248: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x250: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x258: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x260: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x268: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x270: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x278: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x280: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x288: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x290: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x298: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2a0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2a8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2b0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2b8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2c0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2c8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2d0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2d8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2e0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2e8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2f0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2f8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x300: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x308: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x310: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x318: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x320: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x328: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x330: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x338: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x340: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x348: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x350: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x358: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x360: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x368: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x370: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x378: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x380: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x388: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x390: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x398: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x3a0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x3a8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x3b0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x3b8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x3c0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x3c8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x3d0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x3d8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x3e0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x3e8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x3f0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x3f8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, -/* 0x400: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x408: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x410: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x418: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x420: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x428: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x430: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x438: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x440: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x448: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x450: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x458: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x460: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x468: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x470: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x478: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x480: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x488: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x490: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x498: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x4a0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x4a8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x4b0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x4b8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x4c0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x4c8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x4d0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x4d8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x4e0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x4e8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x4f0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x4f8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x500: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x508: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x510: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x518: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x520: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x528: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x530: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x538: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x540: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x548: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x550: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x558: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x560: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x568: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x570: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x578: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x580: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x588: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x590: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x598: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x5a0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x5a8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x5b0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x5b8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x5c0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x5c8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x5d0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x5d8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x5e0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x5e8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x5f0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x5f8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x600: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x608: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x610: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x618: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x620: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x628: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x630: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x638: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x640: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x648: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x650: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x658: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x660: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x668: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x670: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x678: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x680: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x688: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x690: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x698: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x6a0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x6a8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x6b0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x6b8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x6c0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x6c8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x6d0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x6d8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x6e0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x6e8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x6f0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x6f8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x700: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x708: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x710: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x718: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x720: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x728: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x730: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x738: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x740: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x748: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x750: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x758: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x760: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x768: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x770: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x778: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x780: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x788: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x790: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x798: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x7a0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x7a8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x7b0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x7b8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x7c0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x7c8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x7d0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x7d8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x7e0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x7e8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x70, -/* 0x7f0: */ 0x60, 0x20, 0x70, 0x70, 0x70, 0x70, 0x70, 0x78, -/* 0x7f8: */ 0x78, 0x78, 0x7c, 0x7c, 0x7e, 0x7e, 0x7f, 0x7f, -/* 0x800: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x808: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x810: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x818: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x820: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x828: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x830: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x838: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x840: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x848: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x850: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x858: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x860: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x868: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x870: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x878: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x880: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x888: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x890: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x898: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x8a0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x8a8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x8b0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x8b8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x8c0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x8c8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x8d0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x8d8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x8e0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x8e8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x8f0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x8f8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x900: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x908: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x910: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x918: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x920: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x928: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x930: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x938: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x940: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x948: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x950: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x958: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x960: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x968: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x970: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x978: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x980: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x988: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x990: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x998: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x9a0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x9a8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x9b0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x9b8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x9c0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x9c8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x9d0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x9d8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x9e0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x9e8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x9f0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x9f8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa00: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa08: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa10: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa18: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa20: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa28: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa30: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa38: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa40: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa48: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa50: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa58: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa60: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa68: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa70: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa78: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa80: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa88: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa90: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa98: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xaa0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xaa8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xab0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xab8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xac0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xac8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xad0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xad8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xae0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xae8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xaf0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xaf8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb00: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb08: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb10: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb18: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb20: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb28: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb30: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb38: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb40: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb48: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb50: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb58: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb60: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb68: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb70: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb78: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb80: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb88: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb90: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb98: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xba0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xba8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xbb0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xbb8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xbc0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xbc8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xbd0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xbd8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xbe0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xbe8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xbf0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xbf8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x1e, 0x3f, -/* 0xc00: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc08: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc10: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc18: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc20: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc28: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc30: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc38: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc40: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc48: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc50: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc58: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc60: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc68: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc70: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc78: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc80: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc88: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc90: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc98: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xca0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xca8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xcb0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xcb8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xcc0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xcc8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xcd0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xcd8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xce0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xce8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xcf0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xcf8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd00: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd08: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd10: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd18: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd20: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd28: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd30: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd38: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd40: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd48: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd50: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd58: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd60: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd68: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd70: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd78: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd80: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd88: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd90: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd98: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xda0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xda8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xdb0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xdb8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xdc0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xdc8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xdd0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xdd8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xde0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xde8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xdf0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, -/* 0xdf8: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x8c, 0x9f, -/* 0xe00: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe08: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe10: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe18: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe20: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe28: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe30: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe38: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, -/* 0xe40: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe48: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe50: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe58: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, -/* 0xe60: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, -/* 0xe68: */ 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0xe70: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0xe78: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0xe80: */ 0x00, 0x00, 0x80, 0x00, 0x00, 0x80, 0x80, 0x80, -/* 0xe88: */ 0x80, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0xe90: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0xe98: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0xea0: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0xea8: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0xeb0: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0xeb8: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0xec0: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0xec8: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0xed0: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0xed8: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0xee0: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0xee8: */ 0x80, 0x80, 0x80, 0x80, 0x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diff --git a/MCUME_pico/picosnd/reSID/wave8580_PS_.cpp b/MCUME_pico/picosnd/reSID/wave8580_PS_.cpp deleted file mode 100755 index 4b66a4b..0000000 --- a/MCUME_pico/picosnd/reSID/wave8580_PS_.cpp +++ /dev/null @@ -1,541 +0,0 @@ -// --------------------------------------------------------------------------- -// This file is part of reSID, a MOS6581 SID emulator engine. -// Copyright (C) 2004 Dag Lem -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// --------------------------------------------------------------------------- - -#include "wave.h" - -RESID_NAMESPACE_START - -//reg8 WaveformGenerator::wave8580_PS_[] = -const reg8 wave8580_PS_[] = -{ -/* 0x000: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x008: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x010: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x018: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x020: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x028: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x030: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x038: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x040: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x048: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x050: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x058: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x060: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x068: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x070: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x078: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, -/* 0x080: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x088: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x090: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x098: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0a0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0a8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0b0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0b8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, -/* 0x0c0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0c8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0d0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0d8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0e0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0e8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0f0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0f8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, -/* 0x100: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x108: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x110: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x118: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x120: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x128: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x130: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x138: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x140: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x148: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x150: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x158: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x160: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x168: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x170: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x178: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, -/* 0x180: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x188: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x190: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x198: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1a0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1a8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1b0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1b8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, -/* 0x1c0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1c8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1d0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1d8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, -/* 0x1e0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1e8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1f0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1f8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x1f, -/* 0x200: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x208: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x210: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x218: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x220: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x228: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x230: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x238: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x240: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x248: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x250: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x258: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x260: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x268: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x270: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x278: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, -/* 0x280: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x288: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x290: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x298: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2a0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2a8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2b0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2b8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, -/* 0x2c0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2c8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2d0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2d8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, -/* 0x2e0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2e8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2f0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2f8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x0f, -/* 0x300: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x308: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x310: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x318: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x320: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x328: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x330: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x338: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, -/* 0x340: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x348: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x350: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x358: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x360: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x368: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x370: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x378: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, -/* 0x380: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x388: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x390: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x398: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x3a0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x3a8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x3b0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x3b8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3b, -/* 0x3c0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x3c8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x3d0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x3d8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3d, -/* 0x3e0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x3e8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, -/* 0x3f0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, -/* 0x3f8: */ 0x00, 0x0c, 0x1c, 0x3f, 0x1e, 0x3f, 0x3f, 0x3f, -/* 0x400: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x408: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x410: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x418: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x420: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x428: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x430: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x438: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x440: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x448: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x450: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x458: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x460: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x468: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x470: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x478: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, -/* 0x480: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x488: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x490: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x498: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x4a0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x4a8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x4b0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x4b8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, -/* 0x4c0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x4c8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x4d0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x4d8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x4e0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x4e8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x4f0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x4f8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, -/* 0x500: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x508: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x510: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x518: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x520: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x528: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x530: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x538: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, -/* 0x540: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x548: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x550: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x558: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x560: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x568: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x570: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x578: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, -/* 0x580: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x588: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x590: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x598: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x5a0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x5a8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x5b0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x5b8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, -/* 0x5c0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x5c8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x5d0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x5d8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, -/* 0x5e0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x5e8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5e, -/* 0x5f0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5f, -/* 0x5f8: */ 0x00, 0x00, 0x00, 0x5f, 0x0c, 0x5f, 0x5f, 0x5f, -/* 0x600: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x608: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x610: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x618: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x620: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x628: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x630: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x638: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, -/* 0x640: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x648: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x650: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x658: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x660: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x668: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x670: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x678: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, -/* 0x680: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x688: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x690: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x698: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x6a0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x6a8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x6b0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x6b8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x43, -/* 0x6c0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x6c8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x6d0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x6d8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x65, -/* 0x6e0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x6e8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6e, -/* 0x6f0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6f, -/* 0x6f8: */ 0x00, 0x40, 0x40, 0x6f, 0x40, 0x6f, 0x6f, 0x6f, -/* 0x700: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x708: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x710: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x718: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x720: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x728: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x730: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x738: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x63, -/* 0x740: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x748: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x750: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x758: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x61, -/* 0x760: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, -/* 0x768: */ 0x00, 0x00, 0x00, 0x40, 0x00, 0x40, 0x40, 0x70, -/* 0x770: */ 0x00, 0x00, 0x40, 0x40, 0x40, 0x40, 0x40, 0x70, -/* 0x778: */ 0x40, 0x60, 0x60, 0x77, 0x60, 0x77, 0x77, 0x77, -/* 0x780: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x788: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, -/* 0x790: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x60, -/* 0x798: */ 0x00, 0x40, 0x40, 0x60, 0x40, 0x60, 0x60, 0x79, -/* 0x7a0: */ 0x00, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x60, -/* 0x7a8: */ 0x40, 0x40, 0x40, 0x60, 0x60, 0x60, 0x60, 0x78, -/* 0x7b0: */ 0x40, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x78, -/* 0x7b8: */ 0x60, 0x70, 0x70, 0x78, 0x70, 0x79, 0x7b, 0x7b, -/* 0x7c0: */ 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x70, -/* 0x7c8: */ 0x60, 0x60, 0x60, 0x70, 0x60, 0x70, 0x70, 0x7c, -/* 0x7d0: */ 0x60, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x7c, -/* 0x7d8: */ 0x70, 0x78, 0x78, 0x7c, 0x78, 0x7c, 0x7c, 0x7d, -/* 0x7e0: */ 0x70, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x7c, -/* 0x7e8: */ 0x78, 0x7c, 0x7c, 0x7e, 0x7c, 0x7e, 0x7e, 0x7e, -/* 0x7f0: */ 0x7c, 0x7c, 0x7c, 0x7e, 0x7e, 0x7f, 0x7f, 0x7f, -/* 0x7f8: */ 0x7e, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0xff, -/* 0x800: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x808: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x810: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x818: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x820: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x828: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x830: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x838: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x840: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x848: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x850: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x858: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x860: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x868: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x870: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x878: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, -/* 0x880: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x888: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x890: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x898: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x8a0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x8a8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x8b0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x8b8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, -/* 0x8c0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x8c8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x8d0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x8d8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x8e0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x8e8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x8f0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x8f8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8f, -/* 0x900: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x908: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x910: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x918: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x920: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x928: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x930: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x938: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, -/* 0x940: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x948: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x950: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x958: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x960: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x968: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x970: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x978: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x87, -/* 0x980: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x988: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x990: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x998: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x9a0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x9a8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x9b0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x9b8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x83, -/* 0x9c0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x9c8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x9d0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x9d8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x8d, -/* 0x9e0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, -/* 0x9e8: */ 0x00, 0x00, 0x00, 0x80, 0x00, 0x80, 0x80, 0x8e, -/* 0x9f0: */ 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x8f, -/* 0x9f8: */ 0x80, 0x80, 0x80, 0x9f, 0x80, 0x9f, 0x9f, 0x9f, -/* 0xa00: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa08: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa10: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa18: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa20: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa28: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa30: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa38: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, -/* 0xa40: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa48: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa50: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa58: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa60: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa68: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, -/* 0xa70: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, -/* 0xa78: */ 0x00, 0x00, 0x00, 0x80, 0x00, 0x80, 0x80, 0x87, -/* 0xa80: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa88: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa90: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa98: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, -/* 0xaa0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xaa8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, -/* 0xab0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, -/* 0xab8: */ 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x83, -/* 0xac0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xac8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, -/* 0xad0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, -/* 0xad8: */ 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x81, -/* 0xae0: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0xae8: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x84, -/* 0xaf0: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x87, -/* 0xaf8: */ 0x80, 0x80, 0x80, 0x87, 0x80, 0x8f, 0xaf, 0xaf, -/* 0xb00: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb08: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, -/* 0xb10: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, -/* 0xb18: */ 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0xb20: */ 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x80, 0x80, -/* 0xb28: */ 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0xb30: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0xb38: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x83, -/* 0xb40: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0xb48: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0xb50: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0xb58: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x81, -/* 0xb60: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0xb68: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xa0, -/* 0xb70: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xa0, -/* 0xb78: */ 0x80, 0x80, 0x80, 0xa0, 0x80, 0xa3, 0xb7, 0xb7, -/* 0xb80: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0xb88: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0xb90: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0xb98: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xb1, -/* 0xba0: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0xba8: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xb0, -/* 0xbb0: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xb0, -/* 0xbb8: */ 0x80, 0xa0, 0xa0, 0xb0, 0xa0, 0xb8, 0xb9, 0xbb, -/* 0xbc0: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xa0, -/* 0xbc8: */ 0x80, 0x80, 0x80, 0xa0, 0x80, 0xa0, 0xa0, 0xb8, -/* 0xbd0: */ 0x80, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xb8, -/* 0xbd8: */ 0xa0, 0xb0, 0xb0, 0xb8, 0xb0, 0xbc, 0xbc, 0xbd, -/* 0xbe0: */ 0xa0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb8, 0xb8, 0xbc, -/* 0xbe8: */ 0xb0, 0xb8, 0xb8, 0xbc, 0xb8, 0xbc, 0xbe, 0xbe, -/* 0xbf0: */ 0xb8, 0xbc, 0xbc, 0xbe, 0xbc, 0xbe, 0xbe, 0xbf, -/* 0xbf8: */ 0xbe, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, -/* 0xc00: */ 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, -/* 0xc08: */ 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, -/* 0xc10: */ 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0xc18: */ 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0xc20: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0xc28: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0xc30: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0xc38: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x81, -/* 0xc40: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0xc48: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0xc50: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0xc58: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0xc60: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0xc68: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0xc70: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0xc78: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xc7, -/* 0xc80: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0xc88: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0xc90: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0xc98: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0xca0: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0xca8: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0xcb0: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0xcb8: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xc0, 0xc3, -/* 0xcc0: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0xcc8: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xc0, -/* 0xcd0: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xc0, -/* 0xcd8: */ 0x80, 0x80, 0x80, 0xc0, 0x80, 0xc0, 0xc0, 0xc1, -/* 0xce0: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xc0, -/* 0xce8: */ 0x80, 0x80, 0x80, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, -/* 0xcf0: */ 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc7, -/* 0xcf8: */ 0xc0, 0xc0, 0xc0, 0xc7, 0xc0, 0xcf, 0xcf, 0xcf, -/* 0xd00: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0xd08: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0xd10: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0xd18: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xc0, -/* 0xd20: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0xd28: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xc0, -/* 0xd30: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xc0, 0xc0, -/* 0xd38: */ 0x80, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc3, -/* 0xd40: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xc0, -/* 0xd48: */ 0x80, 0x80, 0x80, 0xc0, 0x80, 0xc0, 0xc0, 0xc0, -/* 0xd50: */ 0x80, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, -/* 0xd58: */ 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc1, -/* 0xd60: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0xf8, 0xf8, -/* 0xf90: */ 0xf0, 0xf0, 0xf0, 0xf8, 0xf0, 0xf8, 0xf8, 0xf8, -/* 0xf98: */ 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf9, -/* 0xfa0: */ 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, -/* 0xfa8: */ 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xfa, -/* 0xfb0: */ 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xfb, -/* 0xfb8: */ 0xf8, 0xfa, 0xfa, 0xfb, 0xfb, 0xfb, 0xfb, 0xfb, -/* 0xfc0: */ 0xf8, 0xf8, 0xf8, 0xfc, 0xf8, 0xfc, 0xfc, 0xfc, -/* 0xfc8: */ 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, -/* 0xfd0: */ 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfd, -/* 0xfd8: */ 0xfc, 0xfc, 0xfc, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, -/* 0xfe0: */ 0xfc, 0xfc, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, -/* 0xfe8: */ 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, -/* 0xff0: */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -/* 0xff8: */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -}; - -RESID_NAMESPACE_STOP diff --git a/MCUME_pico/picosnd/reSID/wave8580_P_T.cpp b/MCUME_pico/picosnd/reSID/wave8580_P_T.cpp deleted file mode 100755 index 344e539..0000000 --- a/MCUME_pico/picosnd/reSID/wave8580_P_T.cpp +++ /dev/null @@ -1,541 +0,0 @@ -// --------------------------------------------------------------------------- -// This file is part of reSID, a MOS6581 SID emulator engine. -// Copyright (C) 2004 Dag Lem -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// --------------------------------------------------------------------------- - -#include "wave.h" - -RESID_NAMESPACE_START - -//reg8 WaveformGenerator::wave8580_P_T[] = -const reg8 wave8580_P_T[] = -{ -/* 0x000: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x008: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x010: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x018: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x020: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x028: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x030: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x038: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x040: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x048: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x050: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x058: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x060: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x068: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x070: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x078: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x080: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x088: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x090: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x098: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0a0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0a8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0b0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0b8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0c0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0c8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0d0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0d8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0e0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0e8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0f0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0f8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, -/* 0x100: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x108: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x110: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x118: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x120: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x128: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x130: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x138: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x140: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x148: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x150: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x158: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x160: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x168: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x170: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x178: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x180: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x188: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x190: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x198: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1a0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1a8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1b0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1b8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1c0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1c8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1d0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1d8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1e0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1e8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1f0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1f8: */ 0x00, 0x00, 0x00, 0x1c, 0x00, 0x3c, 0x3f, 0x3f, -/* 0x200: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x208: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x210: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x218: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x220: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x228: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x230: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x238: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x240: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x248: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x250: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x258: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x260: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x268: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x270: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x278: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x280: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x288: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x290: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x298: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2a0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2a8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2b0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2b8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2c0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2c8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2d0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2d8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2e0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2e8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2f0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2f8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x5e, 0x5f, -/* 0x300: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x308: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x310: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x318: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x320: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x328: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x330: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x338: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x340: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x348: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x350: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x358: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x360: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x368: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x370: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, -/* 0x378: */ 0x00, 0x00, 0x00, 0x40, 0x40, 0x60, 0x60, 0x6f, -/* 0x380: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x388: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x390: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x398: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, -/* 0x3a0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x3a8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x40, -/* 0x3b0: */ 0x00, 0x00, 0x00, 0x40, 0x40, 0x40, 0x40, 0x60, -/* 0x3b8: */ 0x40, 0x40, 0x60, 0x60, 0x60, 0x60, 0x70, 0x77, -/* 0x3c0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x40, 0x40, -/* 0x3c8: */ 0x40, 0x40, 0x40, 0x40, 0x40, 0x60, 0x60, 0x60, -/* 0x3d0: */ 0x40, 0x40, 0x40, 0x60, 0x60, 0x60, 0x60, 0x70, -/* 0x3d8: */ 0x60, 0x60, 0x60, 0x70, 0x70, 0x70, 0x78, 0x7b, -/* 0x3e0: */ 0x60, 0x60, 0x60, 0x70, 0x60, 0x70, 0x70, 0x70, -/* 0x3e8: */ 0x70, 0x70, 0x70, 0x78, 0x78, 0x78, 0x78, 0x7c, -/* 0x3f0: */ 0x78, 0x78, 0x78, 0x7c, 0x78, 0x7c, 0x7c, 0x7e, -/* 0x3f8: */ 0x7c, 0x7e, 0x7e, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, -/* 0x400: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x408: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x410: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x418: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x420: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x428: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x430: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x438: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x440: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x448: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x450: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x458: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x460: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x468: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x470: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x478: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, -/* 0x480: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x488: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x490: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x498: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x4a0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x4a8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x4b0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x4b8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, -/* 0x4c0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x4c8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, -/* 0x4d0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, -/* 0x4d8: */ 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0x4e0: */ 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0x4e8: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0x4f0: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0x4f8: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x8e, 0x9f, -/* 0x500: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x508: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x510: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x518: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, -/* 0x520: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x528: */ 0x00, 0x00, 0x00, 0x80, 0x00, 0x80, 0x80, 0x80, -/* 0x530: */ 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0x538: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0x540: */ 0x00, 0x00, 0x00, 0x80, 0x00, 0x80, 0x80, 0x80, -/* 0x548: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0x550: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0x558: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0x560: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0x568: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0x570: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0x578: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xaf, -/* 0x580: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0x588: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0x590: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0x598: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0x5a0: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0x5a8: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0x5b0: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0x5b8: */ 0x80, 0x80, 0x80, 0xa0, 0xa0, 0xa0, 0xa0, 0xb7, -/* 0x5c0: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0x5c8: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xa0, -/* 0x5d0: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xa0, 0xa0, -/* 0x5d8: */ 0xa0, 0xa0, 0xa0, 0xb0, 0xa0, 0xb0, 0xb0, 0xbb, -/* 0x5e0: */ 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xb0, 0xb0, -/* 0x5e8: */ 0xa0, 0xb0, 0xb0, 0xb8, 0xb0, 0xb8, 0xb8, 0xbc, -/* 0x5f0: */ 0xb0, 0xb8, 0xb8, 0xb8, 0xb8, 0xbc, 0xbc, 0xbe, -/* 0x5f8: */ 0xbc, 0xbc, 0xbe, 0xbf, 0xbe, 0xbf, 0xbf, 0xbf, -/* 0x600: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0x608: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0x610: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0x618: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0x620: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0x628: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0x630: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0x638: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xc0, 0xc0, -/* 0x640: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0x648: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0x650: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xc0, -/* 0x658: */ 0x80, 0x80, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, -/* 0x660: */ 0x80, 0x80, 0x80, 0xc0, 0x80, 0xc0, 0xc0, 0xc0, -/* 0x668: */ 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, -/* 0x670: */ 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, -/* 0x678: */ 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xcf, -/* 0x680: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xc0, 0xc0, -/* 0x688: */ 0xc0, 0x80, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, -/* 0x690: */ 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, -/* 0x698: */ 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, -/* 0x6a0: */ 0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/* 0x960: */ 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, -/* 0x968: */ 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, -/* 0x970: */ 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0x80, -/* 0x978: */ 0xc0, 0xc0, 0xc0, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0x980: */ 0xcf, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, -/* 0x988: */ 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, -/* 0x990: */ 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, -/* 0x998: */ 0xc0, 0xc0, 0xc0, 0x80, 0xc0, 0x80, 0x80, 0x80, -/* 0x9a0: */ 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0x80, 0x80, -/* 0x9a8: */ 0xc0, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0x9b0: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0x9b8: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0x9c0: */ 0xc0, 0xc0, 0xc0, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0x9c8: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0x9d0: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0x9d8: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0x9e0: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0x9e8: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0x9f0: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0x9f8: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0xa00: */ 0xbf, 0xbf, 0xbf, 0xbe, 0xbf, 0xbe, 0xbc, 0xbc, -/* 0xa08: */ 0xbe, 0xbc, 0xbc, 0xb8, 0xb8, 0xb8, 0xb8, 0xb0, -/* 0xa10: */ 0xbc, 0xb8, 0xb8, 0xb0, 0xb8, 0xb0, 0xb0, 0xb0, -/* 0xa18: */ 0xb0, 0xb0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, -/* 0xa20: */ 0xbb, 0xb0, 0xb0, 0xa0, 0xb0, 0xa0, 0xa0, 0xa0, -/* 0xa28: */ 0xa0, 0xa0, 0xa0, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0xa30: */ 0xa0, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0xa38: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0xa40: */ 0xb7, 0xb0, 0xa0, 0xa0, 0xa0, 0x80, 0x80, 0x80, -/* 0xa48: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0xa50: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0xa58: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0xa60: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0xa68: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0xa70: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0xa78: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0xa80: */ 0xaf, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0xa88: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0xa90: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0xa98: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0xaa0: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0xaa8: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0xab0: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0xab8: */ 0x80, 0x80, 0x80, 0x00, 0x80, 0x00, 0x00, 0x00, -/* 0xac0: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0xac8: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, -/* 0xad0: */ 0x80, 0x80, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, -/* 0xad8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xae0: */ 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xae8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xaf0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xaf8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb00: */ 0x9f, 0x9e, 0x88, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0xb08: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0xb10: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0xb18: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, -/* 0xb20: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, -/* 0xb28: */ 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb30: */ 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb38: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb40: */ 0x80, 0x80, 0x80, 0x00, 0x80, 0x00, 0x00, 0x00, -/* 0xb48: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb50: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb58: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb60: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb68: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb70: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb78: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb80: */ 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb88: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb90: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb98: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xba0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xba8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xbb0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xbb8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xbc0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xbc8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xbd0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xbd8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xbe0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xbe8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xbf0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xbf8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc00: */ 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7e, 0x7e, 0x7c, -/* 0xc08: */ 0x7e, 0x7c, 0x7c, 0x78, 0x7c, 0x78, 0x78, 0x78, -/* 0xc10: */ 0x7c, 0x78, 0x78, 0x78, 0x78, 0x70, 0x70, 0x70, -/* 0xc18: */ 0x78, 0x70, 0x70, 0x60, 0x70, 0x60, 0x60, 0x60, -/* 0xc20: */ 0x7b, 0x78, 0x70, 0x70, 0x70, 0x60, 0x60, 0x60, -/* 0xc28: */ 0x70, 0x60, 0x60, 0x60, 0x60, 0x40, 0x40, 0x40, -/* 0xc30: */ 0x60, 0x60, 0x60, 0x40, 0x40, 0x40, 0x40, 0x40, -/* 0xc38: */ 0x40, 0x40, 0x40, 0x00, 0x40, 0x00, 0x00, 0x00, -/* 0xc40: */ 0x77, 0x70, 0x60, 0x60, 0x60, 0x60, 0x40, 0x40, -/* 0xc48: */ 0x60, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, -/* 0xc50: */ 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc58: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc60: */ 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc68: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc70: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc78: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc80: */ 0x6f, 0x64, 0x60, 0x40, 0x40, 0x00, 0x00, 0x00, -/* 0xc88: */ 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc90: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc98: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xca0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xca8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xcb0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xcb8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xcc0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xcc8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xcd0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xcd8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xce0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xce8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xcf0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xcf8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd00: */ 0x5f, 0x5e, 0x4c, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd08: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd10: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd18: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd20: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd28: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd30: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd38: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd40: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd48: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd50: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd58: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd60: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd68: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd70: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd78: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd80: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd88: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd90: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd98: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xda0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xda8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xdb0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xdb8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xdc0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xdc8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xdd0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xdd8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xde0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xde8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xdf0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xdf8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe00: */ 0x3f, 0x3f, 0x3e, 0x00, 0x1c, 0x00, 0x00, 0x00, -/* 0xe08: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe10: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe18: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe20: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe28: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe30: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe38: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe40: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe48: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe50: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe58: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe60: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe68: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe70: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe78: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe80: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe88: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe90: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe98: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xea0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xea8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xeb0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xeb8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xec0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xec8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xed0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xed8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xee0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xee8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xef0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xef8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xf00: */ 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xf08: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xf10: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xf18: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xf20: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xf28: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xf30: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xf38: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xf40: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xf48: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xf50: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xf58: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xf60: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xf68: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xf70: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xf78: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xf80: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xf88: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xf90: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xf98: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xfa0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xfa8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xfb0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xfb8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xfc0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xfc8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xfd0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xfd8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xfe0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xfe8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xff0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xff8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; - -RESID_NAMESPACE_STOP diff --git a/MCUME_pico/picosnd/reSID/wave8580__ST.cpp b/MCUME_pico/picosnd/reSID/wave8580__ST.cpp deleted file mode 100755 index e2ca522..0000000 --- a/MCUME_pico/picosnd/reSID/wave8580__ST.cpp +++ /dev/null @@ -1,541 +0,0 @@ -// --------------------------------------------------------------------------- -// This file is part of reSID, a MOS6581 SID emulator engine. -// Copyright (C) 2004 Dag Lem -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// --------------------------------------------------------------------------- - -#include "wave.h" - -RESID_NAMESPACE_START - -//reg8 WaveformGenerator::wave8580__ST[] = -const reg8 wave8580__ST[] = -{ -/* 0x000: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x008: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x010: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x018: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x020: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x028: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x030: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x038: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x040: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x048: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x050: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x058: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x060: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x068: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x070: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x078: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, -/* 0x080: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x088: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x090: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x098: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0a0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0a8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0b0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0b8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0c0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0c8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0d0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0d8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0e0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0e8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0f0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x0f8: */ 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x07, 0x07, -/* 0x100: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x108: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x110: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x118: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x120: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x128: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x130: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x138: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x140: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x148: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x150: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x158: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x160: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x168: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x170: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x178: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, -/* 0x180: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x188: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x190: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x198: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1a0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1a8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1b0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1b8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1c0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1c8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1d0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1d8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1e0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1e8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1f0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x1f8: */ 0x0e, 0x0e, 0x0e, 0x0e, 0x0f, 0x0f, 0x0f, 0x0f, -/* 0x200: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x208: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x210: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x218: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x220: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x228: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x230: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x238: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x240: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x248: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x250: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x258: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x260: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x268: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x270: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x278: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, -/* 0x280: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x288: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x290: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x298: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2a0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2a8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2b0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2b8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2c0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2c8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2d0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2d8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2e0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2e8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2f0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x2f8: */ 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x07, 0x07, -/* 0x300: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x308: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x310: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x318: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x320: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x328: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x330: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x338: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x340: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x348: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x350: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x358: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x360: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x368: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x370: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x378: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, -/* 0x380: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x388: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x390: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x398: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x3a0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x3a8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x3b0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x3b8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, -/* 0x3c0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x3c8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x3d0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x3d8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x3e0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x3e8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x3f0: */ 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, -/* 0x3f8: */ 0x1e, 0x1e, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, -/* 0x400: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x408: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x410: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x418: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x420: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x428: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x430: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x438: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x440: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x448: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x450: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x458: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x460: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x468: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x470: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x478: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, -/* 0x480: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x488: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x490: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x498: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x4a0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x4a8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x4b0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x4b8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x4c0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x4c8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x4d0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x4d8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x4e0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x4e8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x4f0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x4f8: */ 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x07, 0x07, -/* 0x500: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x508: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x510: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x518: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x520: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x528: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x530: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x538: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x540: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x548: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x550: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x558: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x560: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x568: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x570: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x578: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, -/* 0x580: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x588: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x590: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x598: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x5a0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x5a8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x5b0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x5b8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x5c0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x5c8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x5d0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x5d8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x5e0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x5e8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x5f0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x5f8: */ 0x0e, 0x0e, 0x0e, 0x0e, 0x0f, 0x0f, 0x0f, 0x1f, -/* 0x600: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x608: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x610: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x618: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x620: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x628: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x630: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x638: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x640: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x648: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x650: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x658: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x660: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x668: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x670: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x678: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, -/* 0x680: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x688: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x690: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x698: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x6a0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x6a8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x6b0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x6b8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x6c0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x6c8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x6d0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x6d8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x6e0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x6e8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x6f0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x6f8: */ 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x07, 0x07, -/* 0x700: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x708: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x710: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x718: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x720: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x728: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x730: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x738: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x740: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x748: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x750: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x758: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x760: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x768: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x770: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x778: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, -/* 0x780: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x788: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x790: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x798: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x7a0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x7a8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x7b0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x7b8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, -/* 0x7c0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x7c8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x7d0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x7d8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x7e0: */ 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, -/* 0x7e8: */ 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, -/* 0x7f0: */ 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3e, -/* 0x7f8: */ 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, -/* 0x800: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x808: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x810: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x818: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x820: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x828: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x830: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x838: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x840: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x848: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x850: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x858: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x860: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x868: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x870: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x878: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, -/* 0x880: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x888: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x890: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x898: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x8a0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x8a8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x8b0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x8b8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x8c0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x8c8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x8d0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x8d8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x8e0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x8e8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x8f0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x8f8: */ 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x07, 0x07, -/* 0x900: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x908: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x910: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x918: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x920: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x928: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x930: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x938: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x940: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x948: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x950: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x958: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x960: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x968: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x970: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x978: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, -/* 0x980: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x988: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x990: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x998: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x9a0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x9a8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x9b0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x9b8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x9c0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x9c8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x9d0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x9d8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x9e0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x9e8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x9f0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0x9f8: */ 0x0e, 0x0e, 0x0e, 0x0e, 0x0f, 0x0f, 0x0f, 0x0f, -/* 0xa00: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa08: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa10: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa18: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa20: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa28: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa30: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa38: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa40: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa48: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa50: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa58: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa60: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa68: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa70: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa78: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, -/* 0xa80: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa88: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa90: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xa98: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xaa0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xaa8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xab0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xab8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xac0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xac8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xad0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xad8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xae0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xae8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xaf0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xaf8: */ 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x07, 0x07, -/* 0xb00: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb08: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb10: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb18: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb20: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb28: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb30: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb38: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb40: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb48: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb50: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb58: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb60: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb68: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb70: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb78: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, -/* 0xb80: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb88: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb90: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xb98: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xba0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xba8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xbb0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xbb8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, -/* 0xbc0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xbc8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xbd0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xbd8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xbe0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xbe8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xbf0: */ 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, -/* 0xbf8: */ 0x1e, 0x1e, 0x1f, 0x1f, 0x1f, 0x1f, 0x3f, 0x3f, -/* 0xc00: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc08: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc10: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc18: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc20: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc28: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc30: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc38: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc40: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc48: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc50: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc58: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc60: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc68: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc70: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc78: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, -/* 0xc80: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc88: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc90: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xc98: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xca0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xca8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xcb0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xcb8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xcc0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xcc8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xcd0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xcd8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xce0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xce8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xcf0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xcf8: */ 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x07, 0x07, -/* 0xd00: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd08: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd10: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd18: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd20: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd28: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd30: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd38: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd40: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd48: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd50: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd58: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd60: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd68: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd70: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd78: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, -/* 0xd80: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd88: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd90: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xd98: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xda0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xda8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xdb0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xdb8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, -/* 0xdc0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xdc8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xdd0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xdd8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xde0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xde8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xdf0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xdf8: */ 0x0e, 0x0e, 0x0e, 0x0e, 0x0f, 0x0f, 0x1f, 0x1f, -/* 0xe00: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe08: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe10: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe18: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe20: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe28: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe30: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe38: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe40: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe48: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe50: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe58: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe60: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe68: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe70: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 0xe78: */ 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x83, 0x83, -/* 0xe80: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0xe88: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0xe90: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0xe98: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0xea0: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0xea8: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0xeb0: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0xeb8: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0xec0: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0xec8: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0xed0: */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -/* 0xed8: */ 0x80, 0x80, 0x80, 0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, 0xfe, 0xfe, 0xfe, -/* 0xff8: */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -}; - -RESID_NAMESPACE_STOP diff --git a/MCUME_pico/picosnd/sid.cpp b/MCUME_pico/picosnd/sid.cpp deleted file mode 100644 index 76ac568..0000000 --- a/MCUME_pico/picosnd/sid.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/* - Arduino SID - Copyright (c) 2015 Frank Bösing - This library is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with this library. If not, see . - - Diese Bibliothek ist freie Software: Sie können es unter den Bedingungen - der GNU General Public License, wie von der Free Software Foundation, - Version 3 der Lizenz oder (nach Ihrer Wahl) jeder neueren - veröffentlichten Version, weiterverbreiten und/oder modifizieren. - Diese Bibliothek wird in der Hoffnung, dass es nützlich sein wird, aber - OHNE JEDE GEWÄHRLEISTUNG, bereitgestellt; sogar ohne die implizite - Gewährleistung der MARKTFÄHIGKEIT oder EIGNUNG FÜR EINEN BESTIMMTEN ZWECK. - Siehe die GNU General Public License für weitere Details. - Sie sollten eine Kopie der GNU General Public License zusammen mit diesem - Programm erhalten haben. Wenn nicht, siehe . - - */ - -#include "reSID/envelope.cpp" -#include "reSID/extfilt.cpp" -#include "reSID/filter.cpp" -#include "reSID/pot.cpp" -#include "reSID/version.cpp" -#include "reSID/voice.cpp" - - -#include "reSID/wave6581__ST.cpp" -#include "reSID/wave6581_P_T.cpp" -#include "reSID/wave6581_PS_.cpp" -#include "reSID/wave6581_PST.cpp" - -/* -#include "reSID/wave8580__ST.cc" -#include "reSID/wave8580_P_T.cc" -#include "reSID/wave8580_PS_.cc" -#include "reSID/wave8580_PST.cc" -*/ -#include "reSID/wave.cpp" - -#include "reSID/sid.cpp" diff --git a/MCUME_pico/picosnd/sndplay.cpp b/MCUME_pico/picosnd/sndplay.cpp deleted file mode 100644 index 180c4c5..0000000 --- a/MCUME_pico/picosnd/sndplay.cpp +++ /dev/null @@ -1,200 +0,0 @@ -#include "pico.h" -#include "pico/stdlib.h" - -extern "C" { -#include "emuapi.h" -} - - -#include -#include - -//#define FC 1 - - -#include "reSID.h" -#ifdef FC -#include "LibFC14/fc14audiodecoder.h" -#endif -#ifdef YM -#include "StSnd/StSoundLibrary.h" -#endif - - -enum MusType { - Undefined, - C64Dmp, - StYm, - AmFc -}; - -static MusType mustype = Undefined; -static bool playing = false; -static int mussize=0; -static void * musbuffer=nullptr; - -char buffer[26]; -char oldbuffer[26]; - - -static AudioPlaySID playSID; -#ifdef FC -static void *fcDecoder = nullptr; -#endif -#ifdef YM -static YMMUSIC *ymDecoder; -#endif - - -void snd_Init(void) -{ -#ifdef HAS_SND - emu_sndInit(); -#endif - switch (mustype) { - case C64Dmp: - playSID.begin(); - playing = true; - break; -#ifdef FC - case AmFc: - if (musbuffer) { - bool haveModule = false; - fcDecoder = fc14dec_new(); - haveModule = fc14dec_init(fcDecoder,(void*)musbuffer,mussize); - if ( !haveModule ) { - fc14dec_delete(fcDecoder); - printf("FC module not supported\n"); - } - else { - printf("FC music loaded\n"); - fc14dec_mixer_init(fcDecoder,22050,16,1,0 /*32767*/); - playing = true; - } - } - break; -#endif -#ifdef YM - case StYm: - if (musbuffer) { - ymDecoder = ymMusicCreate(); - printf("YM music loader\n"); - if (ymMusicLoadMemory(ymDecoder,(void*)musbuffer,mussize)) - { - printf("YM music loaded\n"); - ymMusicInfo_t info; - ymMusicGetInfo(ymDecoder,&info); - printf("Name.....: %s\n",info.pSongName); - printf("Author...: %s\n",info.pSongAuthor); - printf("Comment..: %s\n",info.pSongComment); - printf("Duration.: %d:%02d\n",info.musicTimeInSec/60,info.musicTimeInSec%60); - printf("Driver...: %s\n", info.pSongPlayer); - ymMusicSetLoopMode(ymDecoder,YMTRUE); - ymMusicPlay(ymDecoder); - playing = true; - } - } - break; -#endif - default: - break; - } -} - -int oldSec = -1; -void snd_Step(void) -{ - sleep_ms(20); - switch (mustype) { - case C64Dmp: - if (emu_FileRead(buffer, 25) == 25 ) { - for(int i=0;i<25;i++) { - if(buffer[i] != oldbuffer[i]) { - playSID.setreg(i, buffer[i]); - oldbuffer[i] = buffer[i]; - } - } - } else { - if (playSID.isPlaying()) { - emu_FileClose(); - playSID.stop(); - } - } - break; -#ifdef FC - case AmFc: - break; -#endif -#ifdef YM - case StYm: - //int sec = ymMusicGetPos(ymDecoder) / 1000; - //if (sec != oldSec) - // { - // printf("Time: %d:%02d\r",sec/60,sec%60); - // oldSec = sec; - // } - break; -#endif - default: - break; - } -} - -void snd_Start(char * filename) -{ - mussize = emu_FileSize(filename); - char *dot = strrchr(filename, '.'); - if (dot && !strcmp(dot, ".dmp")) { - mustype = C64Dmp; - if (emu_FileOpen(filename) == 0) { - printf("SID music failure, cannot open\n"); - } - } - else if (dot && !strcmp(dot, ".fc")) { - mustype = AmFc; - musbuffer = emu_Malloc(mussize); - if (musbuffer) - { - if (emu_FileOpen(filename)) { - if (emu_FileRead((char*)musbuffer, mussize) != mussize ) { - musbuffer = nullptr; - } - emu_FileClose(); - } else { - musbuffer = nullptr; - } - } - if (musbuffer == nullptr) { - printf("FC music failure, cannot open/allocate\n"); - } - } - else if (dot && !strcmp(dot, ".ym")) { - mustype = StYm; - } -} - -void SND_Process( void * stream, int len ) -{ - if (playing) { - switch (mustype) { - case C64Dmp: - playSID.update(stream, len); - break; -#ifdef FC - case AmFc: - fc14dec_buffer_fill(fcDecoder,stream,len*2); - break; -#endif -#ifdef YM - case StYm: - ymMusicCompute((void*)ymDecoder,(ymsample*)stream,len); - break; -#endif - default: - break; - } - } -} - -void snd_Input(int bClick) { -} diff --git a/MCUME_pico/picosnd/sndplay.h b/MCUME_pico/picosnd/sndplay.h deleted file mode 100644 index 1e50486..0000000 --- a/MCUME_pico/picosnd/sndplay.h +++ /dev/null @@ -1,4 +0,0 @@ -extern void snd_Init(void); -extern void snd_Step(void); -extern void snd_Start(char * filename); -extern void snd_Input(int bClick); diff --git a/MCUME_pico/picospeccy/AudioPlaySystem.cpp b/MCUME_pico/picospeccy/AudioPlaySystem.cpp deleted file mode 100644 index 7a3d90b..0000000 --- a/MCUME_pico/picospeccy/AudioPlaySystem.cpp +++ /dev/null @@ -1,179 +0,0 @@ -#include "emuapi.h" - -#ifdef HAS_SND - -#include "AudioPlaySystem.h" - -#define SAMPLERATE AUDIO_SAMPLE_RATE_EXACT -#define CLOCKFREQ 985248 - -#ifndef CUSTOM_SND -static const short square[]={ -32767,32767,32767,32767, -32767,32767,32767,32767, -32767,32767,32767,32767, -32767,32767,32767,32767, -32767,32767,32767,32767, -32767,32767,32767,32767, -32767,32767,32767,32767, -32767,32767,32767,32767, --32767,-32767,-32767,-32767, --32767,-32767,-32767,-32767, --32767,-32767,-32767,-32767, --32767,-32767,-32767,-32767, --32767,-32767,-32767,-32767, --32767,-32767,-32767,-32767, --32767,-32767,-32767,-32767, --32767,-32767,-32767,-32767, -}; - -const short noise[] { --32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767, --32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,-32767,32767,-32767, --32767,-32767,32767,-32767,-32767,-32767,32767,-32767,-32767,-32767,32767,-32767,-32767,-32767,32767,-32767, --32767,-32767,32767,-32767,-32767,-32767,32767,-32767,-32767,-32767,32767,-32767,-32767,32767,32767,-32767, --32767,-32767,32767,-32767,-32767,32767,32767,-32767,-32767,-32767,32767,-32767,-32767,32767,32767,-32767, --32767,-32767,32767,-32767,-32767,32767,32767,-32767,-32767,-32767,32767,-32767,32767,32767,32767,-32767, -32767,-32767,32767,-32767,-32767,32767,32767,-32767,-32767,-32767,32767,-32767,32767,32767,32767,-32767, -32767,-32767,32767,-32767,-32767,32767,32767,-32767,-32767,-32767,32767,32767,32767,32767,32767,-32767, -32767,-32767,32767,-32767,-32767,32767,32767,-32767,-32767,-32767,32767,32767,32767,32767,32767,-32767, -32767,-32767,32767,-32767,-32767,32767,32767,-32767,-32767,-32767,-32767,32767,32767,32767,-32767,-32767, -32767,-32767,-32767,-32767,-32767,32767,-32767,-32767,-32767,-32767,32767,32767,32767,32767,32767,-32767, -32767,-32767,32767,-32767,-32767,32767,32767,-32767,-32767,32767,-32767,32767,32767,32767,-32767,-32767, -32767,32767,-32767,-32767,-32767,32767,-32767,-32767,-32767,-32767,32767,32767,32767,32767,32767,-32767, -32767,-32767,32767,-32767,-32767,32767,32767,-32767,32767,32767,-32767,32767,-32767,32767,-32767,-32767, -32767,32767,-32767,-32767,-32767,32767,-32767,-32767,-32767,-32767,32767,32767,32767,32767,32767,-32767, -32767,-32767,32767,-32767,-32767,32767,32767,32767,32767,32767,-32767,32767,-32767,32767,-32767,-32767, -}; - -#define NOISEBSIZE 0x100 - -typedef struct -{ - unsigned int spos; - unsigned int sinc; - unsigned int vol; -} Channel; - -static Channel chan[6] = { - {0,0,0}, - {0,0,0}, - {0,0,0}, - {0,0,0}, - {0,0,0}, - {0,0,0} }; - -#endif - -volatile bool playing = false; - - -static void snd_Reset(void) -{ -#ifndef CUSTOM_SND - chan[0].vol = 0; - chan[1].vol = 0; - chan[2].vol = 0; - chan[3].vol = 0; - chan[4].vol = 0; - chan[5].vol = 0; - chan[0].sinc = 0; - chan[1].sinc = 0; - chan[2].sinc = 0; - chan[3].sinc = 0; - chan[4].sinc = 0; - chan[5].sinc = 0; -#endif -} - - -#ifdef CUSTOM_SND -extern "C" { -void SND_Process(void *sndbuffer, int sndn); -} -#endif - -#include -void AudioPlaySystem::snd_Mixer(short * stream, int len ) -{ - if (playing) - { -#ifdef CUSTOM_SND - //printf("s\n"); - SND_Process((void*)stream, len); -#else - int i; - long s; - len = len >> 1; - short v0=chan[0].vol; - short v1=chan[1].vol; - short v2=chan[2].vol; - short v3=chan[3].vol; - short v4=chan[4].vol; - short v5=chan[5].vol; - for (i=0;i>8)&0x3f])>>11); - s+=((v1*square[(chan[1].spos>>8)&0x3f])>>11); - s+=((v2*square[(chan[2].spos>>8)&0x3f])>>11); - s+=((v3*noise[(chan[3].spos>>8)&(NOISEBSIZE-1)])>>11); - s+=((v4*noise[(chan[4].spos>>8)&(NOISEBSIZE-1)])>>11); - s+=((v5*noise[(chan[5].spos>>8)&(NOISEBSIZE-1)])>>11); - *stream++ = (short)(s); - *stream++ = (short)(s); - chan[0].spos += chan[0].sinc; - chan[1].spos += chan[1].sinc; - chan[2].spos += chan[2].sinc; - chan[3].spos += chan[3].sinc; - chan[4].spos += chan[4].sinc; - chan[5].spos += chan[5].sinc; - } -#endif - } -} - -void AudioPlaySystem::begin(void) -{ - this->reset(); -} - -void AudioPlaySystem::start(void) -{ - playing = true; -} - -void AudioPlaySystem::setSampleParameters(float clockfreq, float samplerate) { -} - -void AudioPlaySystem::reset(void) -{ - snd_Reset(); -} - -void AudioPlaySystem::stop(void) -{ - playing = false; -} - -bool AudioPlaySystem::isPlaying(void) -{ - return playing; -} - - - -void AudioPlaySystem::sound(int C, int F, int V) { -#ifndef CUSTOM_SND - if (C < 6) { - chan[C].vol = V; - chan[C].sinc = F>>1; - } -#endif -} - -void AudioPlaySystem::step(void) { -} - -void AudioPlaySystem::buzz(int size, int val) { -} -#endif diff --git a/MCUME_pico/picospeccy/AudioPlaySystem.h b/MCUME_pico/picospeccy/AudioPlaySystem.h deleted file mode 100644 index 5d2efc0..0000000 --- a/MCUME_pico/picospeccy/AudioPlaySystem.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef audioplaysystem_h_ -#define audioplaysystem_h_ - -#ifdef HAS_SND - -#include "platform_config.h" - -class AudioPlaySystem -{ -public: - AudioPlaySystem(void) { }; - void begin(void); - void setSampleParameters(float clockfreq, float samplerate); - void reset(void); - void start(void); - void stop(void); - bool isPlaying(void); - void sound(int C, int F, int V); - void buzz(int size, int val); - void step(void); - static void snd_Mixer(short * stream, int len ); -}; - -#endif - -#endif diff --git a/MCUME_pico/picospeccy/Z80.c b/MCUME_pico/picospeccy/Z80.c index 29be44d..17f7572 100644 --- a/MCUME_pico/picospeccy/Z80.c +++ b/MCUME_pico/picospeccy/Z80.c @@ -18,6 +18,8 @@ #include "Tables.h" #include +#include "emuapi.h" + #undef DEBUG /** INLINE ***************************************************/ /** C99 standard has "inline", but older compilers used **/ @@ -546,6 +548,7 @@ int ExecZ80(register Z80 *R,register int RunCycles) asm volatile("nop"); asm volatile("nop"); asm volatile("nop"); +if ( !emu_IsVga() ) { asm volatile("nop"); asm volatile("nop"); asm volatile("nop"); @@ -568,25 +571,8 @@ int ExecZ80(register Z80 *R,register int RunCycles) asm volatile("nop"); asm volatile("nop"); asm volatile("nop"); - -#ifndef USE_VGA - asm volatile("nop"); - asm volatile("nop"); - asm volatile("nop"); - asm volatile("nop"); - asm volatile("nop"); - - asm volatile("nop"); - asm volatile("nop"); - asm volatile("nop"); - asm volatile("nop"); - asm volatile("nop"); - asm volatile("nop"); - asm volatile("nop"); - asm volatile("nop"); - asm volatile("nop"); - asm volatile("nop"); -#endif +} + } /* Interpret opcode */ switch(I) diff --git a/MCUME_pico/picospeccy/emuapi.cpp b/MCUME_pico/picospeccy/emuapi.cpp deleted file mode 100644 index 1bc929b..0000000 --- a/MCUME_pico/picospeccy/emuapi.cpp +++ /dev/null @@ -1,1311 +0,0 @@ -#define KEYMAP_PRESENT 1 - -#define PROGMEM - -#include "pico.h" -#include "pico/stdlib.h" -#include "hardware/adc.h" -#include -#include - -extern "C" { - #include "emuapi.h" - #include "iopins.h" -} - -static bool emu_writeConfig(void); -static bool emu_readConfig(void); -static bool emu_eraseConfig(void); - - -#if (defined(ILI9341) || defined(ST7789)) && defined(USE_VGA) -// Dual display config, initialize TFT -#include "tft_t_dma.h" -static TFT_T_DMA tft; -#else -// Non Dual display config -#ifdef USE_VGA -#include "vga_t_dma.h" -#else -#include "tft_t_dma.h" -#endif -extern TFT_T_DMA tft; -#endif - - -#define MAX_FILENAME_PATH 64 -#define NB_FILE_HANDLER 4 -#define AUTORUN_FILENAME "autorun.txt" - -#define MAX_FILES 64 -#define MAX_FILENAME_SIZE 24 -#define MAX_MENULINES 9 -#define TEXT_HEIGHT 16 -#define TEXT_WIDTH 8 -#define MENU_FILE_XOFFSET (6*TEXT_WIDTH) -#define MENU_FILE_YOFFSET (2*TEXT_HEIGHT) -#define MENU_FILE_W (MAX_FILENAME_SIZE*TEXT_WIDTH) -#define MENU_FILE_H (MAX_MENULINES*TEXT_HEIGHT) -#define MENU_FILE_BGCOLOR RGBVAL16(0x00,0x00,0x40) -#define MENU_JOYS_YOFFSET (12*TEXT_HEIGHT) -#define MENU_VBAR_XOFFSET (0*TEXT_WIDTH) -#define MENU_VBAR_YOFFSET (MENU_FILE_YOFFSET) - -#define MENU_TFT_XOFFSET (MENU_FILE_XOFFSET+MENU_FILE_W+8) -#define MENU_TFT_YOFFSET (MENU_VBAR_YOFFSET+32) -#define MENU_VGA_XOFFSET (MENU_FILE_XOFFSET+MENU_FILE_W+8) -#define MENU_VGA_YOFFSET (MENU_VBAR_YOFFSET+MENU_FILE_H-32-37) - - - -static int nbFiles=0; -static int curFile=0; -static int topFile=0; -static char selection[MAX_FILENAME_PATH]=""; -static char selected_filename[MAX_FILENAME_SIZE]=""; -static char files[MAX_FILES][MAX_FILENAME_SIZE]; -static bool menuRedraw=true; - -#ifdef PICOMPUTER -static const unsigned short * keys; -static unsigned char keymatrix[6]; -static int keymatrix_hitrow=-1; -static bool key_fn=false; -static bool key_alt=false; -static uint32_t keypress_t_ms=0; -static uint32_t last_t_ms=0; -static uint32_t hundred_ms_cnt=0; -static bool ledflash_toggle=false; -#endif -static int keyMap; - -static bool joySwapped = false; -static uint16_t bLastState; -static int xRef; -static int yRef; -static uint8_t usbnavpad=0; - -static bool menuOn=true; -static bool autorun=false; - - -/******************************** - * Generic output and malloc -********************************/ -void emu_printf(const char * text) -{ - printf("%s\n",text); -} - -void emu_printf(int val) -{ - printf("%d\n",val); -} - -void emu_printi(int val) -{ - printf("%d\n",val); -} - -void emu_printh(int val) -{ - printf("0x%.8\n",val); -} - -static int malbufpt = 0; -static char malbuf[EXTRA_HEAP]; - -void * emu_Malloc(int size) -{ - void * retval = malloc(size); - if (!retval) { - emu_printf("failled to allocate"); - emu_printf(size); - emu_printf("fallback"); - if ( (malbufpt+size) < sizeof(malbuf) ) { - retval = (void *)&malbuf[malbufpt]; - malbufpt += size; - } - else { - emu_printf("failure to allocate"); - } - } - else { - emu_printf("could allocate dynamic "); - emu_printf(size); - } - - return retval; -} - -void * emu_MallocI(int size) -{ - void * retval = NULL; - - if ( (malbufpt+size) < sizeof(malbuf) ) { - retval = (void *)&malbuf[malbufpt]; - malbufpt += size; - emu_printf("could allocate static "); - emu_printf(size); - } - else { - emu_printf("failure to allocate"); - } - - return retval; -} -void emu_Free(void * pt) -{ - free(pt); -} - -void emu_drawText(unsigned short x, unsigned short y, const char * text, unsigned short fgcolor, unsigned short bgcolor, int doublesize) -{ - tft.drawText(x, y, text, fgcolor, bgcolor, doublesize?true:false); -} - - -/******************************** - * OSKB handling -********************************/ -#if (defined(ILI9341) || defined(ST7789)) && defined(USE_VGA) -// On screen keyboard position -#define KXOFF 28 //64 -#define KYOFF 96 -#define KWIDTH 11 //22 -#define KHEIGHT 3 - -static bool oskbOn = false; -static int cxpos = 0; -static int cypos = 0; -static int oskbMap = 0; -static uint16_t oskbBLastState = 0; - -static void lineOSKB2(int kxoff, int kyoff, char * str, int row) -{ - char c[2] = {'A',0}; - const char * cpt = str; - for (int i=0; i.,SP ", 2); - if (oskbMap == 0) { - lineOSKB(KXOFF,KYOFF, keylables_map1_0, 0); - lineOSKB(KXOFF,KYOFF, keylables_map1_1, 1); - lineOSKB(KXOFF,KYOFF, keylables_map1_2, 2); - } - else if (oskbMap == 1) { - lineOSKB(KXOFF,KYOFF, keylables_map2_0, 0); - lineOSKB(KXOFF,KYOFF, keylables_map2_1, 1); - lineOSKB(KXOFF,KYOFF, keylables_map2_2, 2); - } - else { - lineOSKB(KXOFF,KYOFF, keylables_map3_0, 0); - lineOSKB(KXOFF,KYOFF, keylables_map3_1, 1); - lineOSKB(KXOFF,KYOFF, keylables_map3_2, 2); - } -} - -void toggleOskb(bool forceoff) { - if (forceoff) oskbOn=true; - if (oskbOn) { - oskbOn = false; - tft.fillScreenNoDma(RGBVAL16(0x00,0x00,0x00)); - tft.drawTextNoDma(0,32, "Press USER2 to toggle onscreen keyboard.", RGBVAL16(0xff,0xff,0xff), RGBVAL16(0x00,0x00,0x00), true); - } else { - oskbOn = true; - tft.fillScreenNoDma(RGBVAL16(0x00,0x00,0x00)); - tft.drawTextNoDma(0,32, " Press USER2 to exit onscreen keyboard. ", RGBVAL16(0xff,0xff,0xff), RGBVAL16(0x00,0x00,0x00), true); - tft.drawTextNoDma(0,64, " (USER1 to toggle between keymaps) ", RGBVAL16(0x00,0xff,0xff), RGBVAL16(0x00,0x00,0xff), true); - tft.drawRectNoDma(KXOFF,KYOFF, 22*8, 3*16, RGBVAL16(0x00,0x00,0xFF)); - drawOskb(); - } -} - -static int handleOskb(void) -{ - int retval = 0; - - uint16_t bClick = bLastState & ~oskbBLastState; - oskbBLastState = bLastState; - /* - static const char * digits = "0123456789ABCDEF"; - char buf[5] = {0,0,0,0,0}; - int val = bClick; - buf[0] = digits[(val>>12)&0xf]; - buf[1] = digits[(val>>8)&0xf]; - buf[2] = digits[(val>>4)&0xf]; - buf[3] = digits[val&0xf]; - tft.drawTextNoDma(0,KYOFF+ 64,buf,RGBVAL16(0x00,0x00,0x00),RGBVAL16(0xFF,0xFF,0xFF),1); - */ - if (bClick & MASK_KEY_USER2) - { - toggleOskb(false); - } - if (oskbOn) - { - bool updated = true; - if (bClick & MASK_KEY_USER1) - { - oskbMap += 1; - if (oskbMap == 3) oskbMap = 0; - } - else if (bClick & MASK_JOY2_LEFT) - { - cxpos++; - if (cxpos >= KWIDTH) cxpos = 0; - } - else if (bClick & MASK_JOY2_RIGHT) - { - cxpos--; - if (cxpos < 0) cxpos = KWIDTH-1; - } - else if (bClick & MASK_JOY2_DOWN) - { - cypos++; - if (cypos >= KHEIGHT) cypos = 0; - } - else if (bClick & MASK_JOY2_UP) - { - cypos--; - if (cypos < 0) cypos = KHEIGHT-1; - } - else if (oskbBLastState & MASK_JOY2_BTN) - { - retval = cypos*KWIDTH+cxpos+1; - if (retval) { - retval--; - //if (retval & 1) retval = key_map2[retval>>1]; - //else retval = key_map1[retval>>1]; - if (oskbMap == 0) { - retval = key_map1[retval]; - } - else if (oskbMap == 1) { - retval = key_map2[retval]; - } - else { - retval = key_map3[retval]; - } - //if (retval) { toggleOskb(true); updated=false; }; - } - } - else { - updated=false; - } - if (updated) drawOskb(); - } - - return retval; -} -#endif - -/******************************** - * Input and keyboard -********************************/ -int emu_ReadAnalogJoyX(int min, int max) -{ - adc_select_input(0); - int val = adc_read(); -#if INVX - val = 4095 - val; -#endif - val = val-xRef; - val = ((val*140)/100); - if ( (val > -512) && (val < 512) ) val = 0; - val = val+2048; - return (val*(max-min))/4096; -} - -int emu_ReadAnalogJoyY(int min, int max) -{ - adc_select_input(1); - int val = adc_read(); -#if INVY - val = 4095 - val; -#endif - val = val-yRef; - val = ((val*120)/100); - if ( (val > -512) && (val < 512) ) val = 0; - //val = (val*(max-min))/4096; - val = val+2048; - //return val+(max-min)/2; - return (val*(max-min))/4096; -} - - -static uint16_t readAnalogJoystick(void) -{ - uint16_t joysval = 0; -#ifdef PIN_JOY2_A1X - int xReading = emu_ReadAnalogJoyX(0,256); - if (xReading > 128) joysval |= MASK_JOY2_LEFT; - else if (xReading < 128) joysval |= MASK_JOY2_RIGHT; - - int yReading = emu_ReadAnalogJoyY(0,256); - if (yReading < 128) joysval |= MASK_JOY2_UP; - else if (yReading > 128) joysval |= MASK_JOY2_DOWN; -#endif - // First joystick -#if INVY -#ifdef PIN_JOY2_1 - if ( !gpio_get(PIN_JOY2_1) ) joysval |= MASK_JOY2_DOWN; -#endif -#ifdef PIN_JOY2_2 - if ( !gpio_get(PIN_JOY2_2) ) joysval |= MASK_JOY2_UP; -#endif -#else -#ifdef PIN_JOY2_1 - if ( !gpio_get(PIN_JOY2_1) ) joysval |= MASK_JOY2_UP; -#endif -#ifdef PIN_JOY2_2 - if ( !gpio_get(PIN_JOY2_2) ) joysval |= MASK_JOY2_DOWN; -#endif -#endif -#if INVX -#ifdef PIN_JOY2_3 - if ( !gpio_get(PIN_JOY2_3) ) joysval |= MASK_JOY2_LEFT; -#endif -#ifdef PIN_JOY2_4 - if ( !gpio_get(PIN_JOY2_4) ) joysval |= MASK_JOY2_RIGHT; -#endif -#else -#ifdef PIN_JOY2_3 - if ( !gpio_get(PIN_JOY2_3) ) joysval |= MASK_JOY2_RIGHT; -#endif -#ifdef PIN_JOY2_4 - if ( !gpio_get(PIN_JOY2_4) ) joysval |= MASK_JOY2_LEFT; -#endif -#endif -#ifdef PIN_JOY2_BTN - joysval |= (gpio_get(PIN_JOY2_BTN) ? 0 : MASK_JOY2_BTN); -#endif - - return (joysval); -} - - -int emu_SwapJoysticks(int statusOnly) { - if (!statusOnly) { - if (joySwapped) { - joySwapped = false; - } - else { - joySwapped = true; - } - } - return(joySwapped?1:0); -} - -int emu_GetPad(void) -{ - return(bLastState/*|((joySwapped?1:0)<<7)*/); -} - -int emu_ReadKeys(void) -{ - uint16_t retval; - uint16_t j1 = readAnalogJoystick(); - uint16_t j2 = 0; - - // Second joystick -#if INVY -#ifdef PIN_JOY1_1 - if ( !gpio_get(PIN_JOY1_1) ) j2 |= MASK_JOY2_DOWN; -#endif -#ifdef PIN_JOY1_2 - if ( !gpio_get(PIN_JOY1_2) ) j2 |= MASK_JOY2_UP; -#endif -#else -#ifdef PIN_JOY1_1 - if ( !gpio_get(PIN_JOY1_1) ) j2 |= MASK_JOY2_UP; -#endif -#ifdef PIN_JOY1_2 - if ( !gpio_get(PIN_JOY1_2) ) j2 |= MASK_JOY2_DOWN; -#endif -#endif -#if INVX -#ifdef PIN_JOY1_3 - if ( !gpio_get(PIN_JOY1_3) ) j2 |= MASK_JOY2_LEFT; -#endif -#ifdef PIN_JOY1_4 - if ( !gpio_get(PIN_JOY1_4) ) j2 |= MASK_JOY2_RIGHT; -#endif -#else -#ifdef PIN_JOY1_3 - if ( !gpio_get(PIN_JOY1_3) ) j2 |= MASK_JOY2_RIGHT; -#endif -#ifdef PIN_JOY1_4 - if ( !gpio_get(PIN_JOY1_4) ) j2 |= MASK_JOY2_LEFT; -#endif -#endif -#ifdef PIN_JOY1_BTN - if ( !gpio_get(PIN_JOY1_BTN) ) j2 |= MASK_JOY2_BTN; -#endif - - - if (joySwapped) { - retval = ((j1 << 8) | j2); - } - else { - retval = ((j2 << 8) | j1); - } - - if (usbnavpad & MASK_JOY2_UP) retval |= MASK_JOY2_UP; - if (usbnavpad & MASK_JOY2_DOWN) retval |= MASK_JOY2_DOWN; - if (usbnavpad & MASK_JOY2_LEFT) retval |= MASK_JOY2_LEFT; - if (usbnavpad & MASK_JOY2_RIGHT) retval |= MASK_JOY2_RIGHT; - if (usbnavpad & MASK_JOY2_BTN) retval |= MASK_JOY2_BTN; - -#ifdef PIN_KEY_USER1 - if ( !gpio_get(PIN_KEY_USER1) ) retval |= MASK_KEY_USER1; -#endif -#ifdef PIN_KEY_USER2 - if ( !gpio_get(PIN_KEY_USER2) ) retval |= MASK_KEY_USER2; -#endif -#ifdef PIN_KEY_USER3 - if ( !gpio_get(PIN_KEY_USER3) ) retval |= MASK_KEY_USER3; -#endif -#ifdef PIN_KEY_USER4 - if ( !gpio_get(PIN_KEY_USER4) ) retval |= MASK_KEY_USER4; -#endif - -#ifdef PICOMPUTER - keymatrix_hitrow = -1; - unsigned char row; - unsigned short cols[6]={KCOLOUT1,KCOLOUT2,KCOLOUT3,KCOLOUT4,KCOLOUT5,KCOLOUT6}; - unsigned char keymatrixtmp[6]; - - for (int i=0;i<6;i++){ - gpio_set_dir(cols[i], GPIO_OUT); - gpio_put(cols[i], 0); -#ifdef SWAP_ALT_DEL - sleep_us(1); - //__asm volatile ("nop\n"); // 4-8ns -#endif - row=0; - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN4) ? 0 : 0x02); - row |= (gpio_get(KROWIN1) ? 0 : 0x04); - row |= (gpio_get(KROWIN3) ? 0 : 0x08); - row |= (gpio_get(KROWIN5) ? 0 : 0x10); - row |= (gpio_get(KROWIN6) ? 0 : 0x20); - //gpio_set_dir(cols[i], GPIO_OUT); - gpio_put(cols[i], 1); - gpio_set_dir(cols[i], GPIO_IN); - gpio_disable_pulls(cols[i]); - keymatrixtmp[i] = row; - } - -#ifdef MULTI_DEBOUNCE - for (int i=0;i<6;i++){ - gpio_set_dir(cols[i], GPIO_OUT); - gpio_put(cols[i], 0); -#ifdef SWAP_ALT_DEL - sleep_us(1); - //__asm volatile ("nop\n"); // 4-8ns -#endif - row=0; - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN4) ? 0 : 0x02); - row |= (gpio_get(KROWIN1) ? 0 : 0x04); - row |= (gpio_get(KROWIN3) ? 0 : 0x08); - row |= (gpio_get(KROWIN5) ? 0 : 0x10); - row |= (gpio_get(KROWIN6) ? 0 : 0x20); - //gpio_set_dir(cols[i], GPIO_OUT); - gpio_put(cols[i], 1); - gpio_set_dir(cols[i], GPIO_IN); - gpio_disable_pulls(cols[i]); - keymatrixtmp[i] |= row; - } - - for (int i=0;i<6;i++){ - gpio_set_dir(cols[i], GPIO_OUT); - gpio_put(cols[i], 0); -#ifdef SWAP_ALT_DEL - sleep_us(1); - //__asm volatile ("nop\n"); // 4-8ns -#endif - row=0; - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN4) ? 0 : 0x02); - row |= (gpio_get(KROWIN1) ? 0 : 0x04); - row |= (gpio_get(KROWIN3) ? 0 : 0x08); - row |= (gpio_get(KROWIN5) ? 0 : 0x10); - row |= (gpio_get(KROWIN6) ? 0 : 0x20); - //gpio_set_dir(cols[i], GPIO_OUT); - gpio_put(cols[i], 1); - gpio_set_dir(cols[i], GPIO_IN); - gpio_disable_pulls(cols[i]); - keymatrixtmp[i] |= row; - } -#endif - -#ifdef SWAP_ALT_DEL - // Swap ALT and DEL - unsigned char alt = keymatrixtmp[0] & 0x02; - unsigned char del = keymatrixtmp[5] & 0x20; - keymatrixtmp[0] &= ~0x02; - keymatrixtmp[5] &= ~0x20; - if (alt) keymatrixtmp[5] |= 0x20; - if (del) keymatrixtmp[0] |= 0x02; -#endif - - bool alt_pressed=false; - if ( keymatrixtmp[5] & 0x20 ) {alt_pressed=true; keymatrixtmp[5] &= ~0x20;}; - - for (int i=0;i<6;i++){ - row = keymatrixtmp[i]; - if (row) keymatrix_hitrow=i; - keymatrix[i] = row; - } - - //6,9,15,8,7,22 -#if INVX - if ( row & 0x2 ) retval |= MASK_JOY2_LEFT; - if ( row & 0x1 ) retval |= MASK_JOY2_RIGHT; -#else - if ( row & 0x1 ) retval |= MASK_JOY2_LEFT; - if ( row & 0x2 ) retval |= MASK_JOY2_RIGHT; -#endif -#if INVY - if ( row & 0x8 ) retval |= MASK_JOY2_DOWN; - if ( row & 0x4 ) retval |= MASK_JOY2_UP; -#else - if ( row & 0x4 ) retval |= MASK_JOY2_DOWN; - if ( row & 0x8 ) retval |= MASK_JOY2_UP; -#endif - if ( row & 0x10 ) retval |= MASK_JOY2_BTN; - - // Handle LED flash - uint32_t time_ms=to_ms_since_boot (get_absolute_time()); - if ((time_ms-last_t_ms) > 100) { - last_t_ms = time_ms; - if (ledflash_toggle == false) { - ledflash_toggle = true; - } - else { - ledflash_toggle = false; - } - } - - if ( alt_pressed ) { - if (key_fn == false) - { - // Release to Press transition - if (hundred_ms_cnt == 0) { - keypress_t_ms=time_ms; - hundred_ms_cnt += 1; // 1 - } - else { - hundred_ms_cnt += 1; // 2 - if (hundred_ms_cnt >= 2) - { - hundred_ms_cnt = 0; - /* - if ( (time_ms-keypress_t_ms) < 500) - { - if (key_alt == false) - { - key_alt = true; - } - else - { - key_alt = false; - } - } - */ - } - } - } - else { - // Keep press - if (hundred_ms_cnt == 1) { - if ((to_ms_since_boot (get_absolute_time())-keypress_t_ms) > 2000) - { - if (key_alt == false) - { - key_alt = true; - } - else - { - key_alt = false; - } - hundred_ms_cnt = 0; - } - } - } - key_fn = true; - } - else { - key_fn = false; - } - - // Handle LED - if (key_alt == true) { - gpio_put(KLED, (ledflash_toggle?1:0)); - } - else { - if (key_fn == true) { - gpio_put(KLED, 1); - } - else { - gpio_put(KLED, 0); - } - } - - if ( key_fn ) retval |= MASK_KEY_USER2; - if ( ( key_fn ) && (keymatrix[0] == 0x02 )) retval |= MASK_KEY_USER1; -#endif - - //Serial.println(retval,HEX); - - if ( ((retval & (MASK_KEY_USER1+MASK_KEY_USER2)) == (MASK_KEY_USER1+MASK_KEY_USER2)) - || (retval & MASK_KEY_USER4 ) ) - { - } - -#if (defined(ILI9341) || defined(ST7789)) && defined(USE_VGA) - if (oskbOn) { - retval |= MASK_OSKB; - } -#endif - - return (retval); -} - -unsigned short emu_DebounceLocalKeys(void) -{ - uint16_t bCurState = emu_ReadKeys(); - uint16_t bClick = bCurState & ~bLastState; - bLastState = bCurState; - - return (bClick); -} - -int emu_ReadI2CKeyboard(void) { - int retval=0; -#ifdef PICOMPUTER - if (key_alt) { - keys = (const unsigned short *)key_map3; - } - else if (key_fn) { - keys = (const unsigned short *)key_map2; - } - else { - keys = (const unsigned short *)key_map1; - } - if (keymatrix_hitrow >=0 ) { - unsigned short match = ((unsigned short)keymatrix_hitrow<<8) | keymatrix[keymatrix_hitrow]; - for (int i=0; i=0) { - menuRedraw=true; - curFile -= 9; - } else if (curFile!=0) { - menuRedraw=true; - curFile--; - } - } - else if ( (bClick & MASK_JOY2_DOWN) || (bClick & MASK_JOY1_DOWN) ) { - if ((curFile<(nbFiles-1)) && (nbFiles)) { - curFile++; - menuRedraw=true; - } - } - else if ( (bClick & MASK_JOY2_LEFT) || (bClick & MASK_JOY1_LEFT) ) { - if ((curFile<(nbFiles-9)) && (nbFiles)) { - curFile += 9; - menuRedraw=true; - } - else if ((curFile<(nbFiles-1)) && (nbFiles)) { - curFile++; - menuRedraw=true; - } - } - else if ( (bClick & MASK_KEY_USER2) ) { - emu_SwapJoysticks(0); - menuRedraw=true; - } - - if (menuRedraw && nbFiles) { - int fileIndex = 0; - tft.drawRectNoDma(MENU_FILE_XOFFSET,MENU_FILE_YOFFSET, MENU_FILE_W, MENU_FILE_H, MENU_FILE_BGCOLOR); -// if (curFile <= (MAX_MENULINES/2-1)) topFile=0; -// else topFile=curFile-(MAX_MENULINES/2); - if (curFile <= (MAX_MENULINES-1)) topFile=0; - else topFile=curFile-(MAX_MENULINES/2); - - int i=0; - while (i=nbFiles) { - // no more files - break; - } - char * filename = &files[fileIndex][0]; - if (fileIndex >= topFile) { - if ((i+topFile) < nbFiles ) { - if ((i+topFile)==curFile) { - tft.drawTextNoDma(MENU_FILE_XOFFSET,i*TEXT_HEIGHT+MENU_FILE_YOFFSET, filename, RGBVAL16(0xff,0xff,0x00), RGBVAL16(0xff,0x00,0x00), true); - strcpy(selected_filename,filename); - } - else { - tft.drawTextNoDma(MENU_FILE_XOFFSET,i*TEXT_HEIGHT+MENU_FILE_YOFFSET, filename, RGBVAL16(0xff,0xff,0xff), MENU_FILE_BGCOLOR, true); - } - } - i++; - } - fileIndex++; - } - - - tft.drawTextNoDma(48,MENU_JOYS_YOFFSET+8, (emu_SwapJoysticks(1)?(char*)"SWAP=1":(char*)"SWAP=0"), RGBVAL16(0x00,0xff,0xff), RGBVAL16(0x00,0x00,0xff), false); - menuRedraw=false; - } - - return (action); -} - -bool menuActive(void) -{ - return (menuOn); -} - -void toggleMenu(bool on) { - if (on) { - menuOn = true; - backgroundMenu(); - } else { - menuOn = false; - } -} - -char * menuSelection(void) -{ - return (selection); -} - - -/******************************** - * File IO -********************************/ -int emu_FileOpen(const char * filepath, const char * mode) -{ - int retval = 0; - - emu_printf("FileOpen..."); - emu_printf(filepath); - if( !(f_open(&file, filepath, FA_READ)) ) { - retval = 1; - } - else { - emu_printf("FileOpen failed"); - } - return (retval); -} - -int emu_FileRead(void * buf, int size, int handler) -{ - unsigned int retval=0; - f_read (&file, (void*)buf, size, &retval); - return retval; -} - -int emu_FileGetc(int handler) -{ - unsigned char c; - unsigned int retval=0; - if( !(f_read (&file, &c, 1, &retval)) ) - if (retval != 1) { - emu_printf("emu_FileGetc failed"); - } - return (int)c; -} - -void emu_FileClose(int handler) -{ - f_close(&file); -} - -int emu_FileSeek(int handler, int seek, int origin) -{ - f_lseek(&file, seek); - return (seek); -} - -int emu_FileTell(int handler) -{ - return (f_tell(&file)); -} - - -unsigned int emu_FileSize(const char * filepath) -{ - int filesize=0; - emu_printf("FileSize..."); - emu_printf(filepath); - FILINFO entry; - f_stat(filepath, &entry); - filesize = entry.fsize; - return(filesize); -} - -unsigned int emu_LoadFile(const char * filepath, void * buf, int size) -{ - int filesize = 0; - - emu_printf("LoadFile..."); - emu_printf(filepath); - if( !(f_open(&file, filepath, FA_READ)) ) { - filesize = f_size(&file); - emu_printf(filesize); - if (size >= filesize) - { - unsigned int retval=0; - if( (f_read (&file, buf, filesize, &retval)) ) { - emu_printf("File read failed"); - } - } - f_close(&file); - } - - return(filesize); -} - -static FIL outfile; - -static bool emu_writeConfig(void) -{ - bool retval = false; - if( !(f_open(&outfile, ROMSDIR "/" AUTORUN_FILENAME, FA_CREATE_NEW | FA_WRITE)) ) { - unsigned int sizeread=0; - if( (f_write (&outfile, selection, strlen(selection), &sizeread)) ) { - emu_printf("Config write failed"); - } - else { - retval = true; - } - f_close(&outfile); - } - return retval; -} - -static bool emu_readConfig(void) -{ - bool retval = false; - if( !(f_open(&outfile, ROMSDIR "/" AUTORUN_FILENAME, FA_READ)) ) { - unsigned int filesize = f_size(&outfile); - unsigned int sizeread=0; - if( (f_read (&outfile, selection, filesize, &sizeread)) ) { - emu_printf("Config read failed"); - } - else { - if (sizeread == filesize) { - selection[filesize]=0; - retval = true; - } - } - f_close(&outfile); - } - return retval; -} - -static bool emu_eraseConfig(void) -{ - f_unlink (ROMSDIR "/" AUTORUN_FILENAME); -} - - -/******************************** - * Initialization -********************************/ -void emu_init(void) -{ - // Dual display config, initialize TFT -#if (defined(ILI9341) || defined(ST7789)) && defined(USE_VGA) - tft.begin(); -#endif - - sd_init_driver(); - FRESULT fr = f_mount(&fatfs, "0:", 1); - - strcpy(selection,ROMSDIR); - nbFiles = readNbFiles(selection); - - emu_printf("SD initialized, files found: "); - emu_printi(nbFiles); - - emu_InitJoysticks(); -#ifdef SWAP_JOYSTICK - joySwapped = true; -#else - joySwapped = false; -#endif - - int keypressed = emu_ReadKeys(); -#ifdef PICOMPUTER - // Flip screen if UP pressed - if (keypressed & MASK_JOY2_UP) - { -#ifdef PICOMPUTERMAX -#ifndef USE_VGA - tft.flipscreen(true); -#endif -#else - tft.flipscreen(true); -#endif - } - else - { -#ifdef PICOMPUTERMAX -#ifndef USE_VGA - tft.flipscreen(false); -#endif -#else - tft.flipscreen(false); -#endif - } -#endif - - if (keypressed & MASK_JOY2_DOWN) { - tft.fillScreenNoDma( RGBVAL16(0xff,0x00,0x00) ); - tft.drawTextNoDma(64,48, (char*)" AUTURUN file erased", RGBVAL16(0xff,0xff,0x00), RGBVAL16(0xff,0x00,0x00), true); - tft.drawTextNoDma(64,48+24, (char*)"Please reset the board!", RGBVAL16(0xff,0xff,0x00), RGBVAL16(0xff,0x00,0x00), true); - emu_eraseConfig(); - } - else { - if (emu_readConfig()) { - autorun = true; - } - } - toggleMenu(true); -} - - -void emu_start(void) -{ - usbnavpad = 0; - - keyMap = 0; -} diff --git a/MCUME_pico/picospeccy/emuapi.h b/MCUME_pico/picospeccy/emuapi.h deleted file mode 100644 index 22513fb..0000000 --- a/MCUME_pico/picospeccy/emuapi.h +++ /dev/null @@ -1,158 +0,0 @@ -#ifndef EMUAPI_H -#define EMUAPI_H - -#include "platform_config.h" - -//#define TIMER_REND 1 -#define EXTRA_HEAP 0x10 -//#define CUSTOM_SND 1 - - -// Title: < > -#define TITLE " SPECTRUM Emulator" -#define ROMSDIR "spec" - -#define emu_Init(ROM) {spec_Init(); spec_Start(ROM);} -#define emu_Step(x) {spec_Step();} -#define emu_Input(x) {spec_Input(x);} - -#define PALETTE_SIZE 16 -#define VID_FRAME_SKIP 0x0 -#define TFT_VBUFFER_YCROP 0 -#define SINGLELINE_RENDERING 1 - -#define ACTION_NONE 0 -#define ACTION_MAXKBDVAL 225 -#define ACTION_EXITKBD 128 -#define ACTION_RUNTFT 129 -#define ACTION_RUNVGA 130 - - -#ifdef KEYMAP_PRESENT -/* - {25, 6,27,29,224},// vcxz - {10, 9, 7,22, 4}, // gfdsa - {23,21, 8,26,20}, // trewq - {34,33,32,31,30}, // 54321 - {35,36,37,38,39}, // 67890 - {28,24,12,18,19}, // yuiop - {11,13,14,15,40}, // hjkl - { 5,17,16,225,44},// bnm -*/ - -#define keylables_map1_0 (char *)"qwertyuiop\x1a" -#define keylables_map1_1 (char *)" asdfghjkl\x19" -#define keylables_map1_2 (char *)" zxcvbnm.\x10 " -const unsigned short key_map1[] = { - 20,26,8,21,23,28,24,12,18,19,39+128, - 0, 4, 22, 7,9, 10,11,13,14,15,40, - 0,29,27,6,25,5,17,16,16+64,44, - 0,0,0,0 //up,left,right,down - }; - -#define keylables_map2_0 (char *)"1234567890=" -#define keylables_map2_1 (char *)" !@#$%+&*- " -#define keylables_map2_2 (char *)" ()?/\"<>,: " -const unsigned short key_map2[] = { - 30,31,32,33,34,35,36,37,38,39,15+64, - 0,30+64,31+64,32+64,33+64,34+64,14+64,35+64,5+64,13+64,0, - 0, 37+64,38+64,6+64,25+64,19+64,21+64,23+64,17+64,29+64, - 36+128,34+128,37+128,35+128 //up,left,right,down - }; - -#define keylables_map3_0 (char *)"QWERTYUIOP " -#define keylables_map3_1 (char *)" ASDFGHJKL " -#define keylables_map3_2 (char *)" ZXCVBNM; " -const unsigned short key_map3[] = { - 20+128,26+128,8+128,21+128,23+128,28+128,24+128,12+128,18+128,19+128,0, // Upper case - 0, 4+128, 22+128, 7+128,9+128, 10+128,11+128,13+128,14+128,15+128,0, - 0,29+128,27+128,6+128,25+128,5+128,17+128,16+128,18+64,44+128, - 36+128,34+128,37+128,35+128 //up,left,right,down - }; - -const unsigned short matkeys[] = { - 0x020,0x120,0x220,0x320,0x420,0x408,0x308,0x208,0x108,0x008,0x002, // row 1 - 0x510,0x010,0x110,0x210,0x310,0x410,0x401,0x301,0x201,0x101,0x001, // row 2 - 0x520,0x102,0x202,0x302,0x402,0x404,0x304,0x204,0x104,0x004, // row 3 - 0x508,0x501,0x502,0x504 }; // cursor keys - -#endif - - -#define MASK_JOY2_RIGHT 0x0001 -#define MASK_JOY2_LEFT 0x0002 -#define MASK_JOY2_UP 0x0004 -#define MASK_JOY2_DOWN 0x0008 -#define MASK_JOY2_BTN 0x0010 -#define MASK_KEY_USER1 0x0020 -#define MASK_KEY_USER2 0x0040 -#define MASK_KEY_USER3 0x0080 -#define MASK_JOY1_RIGHT 0x0100 -#define MASK_JOY1_LEFT 0x0200 -#define MASK_JOY1_UP 0x0400 -#define MASK_JOY1_DOWN 0x0800 -#define MASK_JOY1_BTN 0x1000 -#define MASK_KEY_USER4 0x2000 -#define MASK_OSKB 0x8000 - - -extern void emu_init(void); -extern void emu_start(void); -extern void emu_resetSD(void); - -extern void emu_printf(const char * text); -extern void emu_printi(int val); -extern void * emu_Malloc(int size); -extern void emu_Free(void * pt); - -extern int emu_FileOpen(const char * filepath, const char * mode); -extern int emu_FileRead(void * buf, int size, int handler); -extern int emu_FileGetc(int handler); -extern int emu_FileSeek(int handler, int seek, int origin); -extern int emu_FileTell(int handler); -extern void emu_FileClose(int handler); - -extern unsigned int emu_FileSize(const char * filepath); -extern unsigned int emu_LoadFile(const char * filepath, void * buf, int size); - -extern void emu_SetPaletteEntry(unsigned char r, unsigned char g, unsigned char b, int index); -extern void emu_DrawScreen(unsigned char * VBuf, int width, int height, int stride); -extern void emu_DrawLine(unsigned char * VBuf, int width, int height, int line); -extern void emu_DrawLine8(unsigned char * VBuf, int width, int height, int line); -extern void emu_DrawLine16(unsigned short * VBuf, int width, int height, int line); -extern void emu_DrawVsync(void); -extern int emu_FrameSkip(void); -extern void * emu_LineBuffer(int line); -#define RGBVAL32(r,g,b) ( (r<<16) | (g<<8) | b ) -#define RGBVAL16(r,g,b) ( (((r>>3)&0x1f)<<11) | (((g>>2)&0x3f)<<5) | (((b>>3)&0x1f)<<0) ) -#define RGBVAL8(r,g,b) ( (((r>>5)&0x07)<<5) | (((g>>5)&0x07)<<2) | (((b>>6)&0x3)<<0) ) -#define R16(rgb) ((rgb>>8)&0xf8) -#define G16(rgb) ((rgb>>3)&0xfc) -#define B16(rgb) ((rgb<<3)&0xf8) -extern void emu_drawText(unsigned short x, unsigned short y, const char * text, unsigned short fgcolor, unsigned short bgcolor, int doublesize); - -extern void emu_InitJoysticks(void); -extern int emu_SwapJoysticks(int statusOnly); -extern unsigned short emu_DebounceLocalKeys(void); -extern int emu_ReadKeys(void); -extern int emu_GetPad(void); -extern int emu_ReadAnalogJoyX(int min, int max); -extern int emu_ReadAnalogJoyY(int min, int max); -extern int emu_ReadI2CKeyboard(void); -extern void emu_KeyboardOnUp(int keymodifer, int key); -extern void emu_KeyboardOnDown(int keymodifer, int key); - -extern void emu_sndPlaySound(int chan, int volume, int freq); -extern void emu_sndPlayBuzz(int size, int val); -extern void emu_sndInit(); -extern void emu_resetus(void); -extern int emu_us(void); - -extern int emu_setKeymap(int index); - -extern void emu_FileTempInit(void); -extern void emu_FileTempRead(int addr, unsigned char * val, int n); -extern void emu_FileTempWrite(int addr, unsigned char val); -extern void emu_printh(int val); - -#endif diff --git a/MCUME_pico/picospeccy/emucfg.h b/MCUME_pico/picospeccy/emucfg.h new file mode 100644 index 0000000..036c559 --- /dev/null +++ b/MCUME_pico/picospeccy/emucfg.h @@ -0,0 +1,105 @@ +#ifndef EMUCFG_H +#define EMUCFG_H + +#define PALETTE_SIZE 16 +#define VID_FRAME_SKIP 0x0 +#define TFT_VBUFFER_YCROP 0 +#define SINGLELINE_RENDERING 1 +//#define CUSTOM_SND 1 +//#define TIMER_REND 1 +#define EXTRA_HEAP 0x10 +#define FILEBROWSER + +// Title: < > +#define TITLE " SPECTRUM Emulator" +#define ROMSDIR "spec" + +#define emu_Init(ROM) {spec_Init(); spec_Start(ROM);} +#define emu_Step(x) {spec_Step();} +#define emu_Input(x) {spec_Input(x);} + +#ifdef KEYMAP_PRESENT + +#ifdef PICOZX +const unsigned short key_map1[] = { + 30,31,32,33,34,35,36,37,38,39, + 20,26, 8,21,23,28,24,12,18,19, + 4,22, 7, 9,10,11,13,14,15,40, + 0,29,27, 6,25, 5,17,16, 0,44, + 0,0,0,0,0,0 + }; + +const unsigned short key_map2[] = { + 30+128,31+128,32+128,33+128,34+128,35+128,36+128,37+128,38+128,39+128, + 20+128,26+128, 8+128,21+128,23+128,28+128,24+128,12+128,18+128,19+128, + 4+128,22+128, 7+128, 9+128,10+128,11+128,13+128,14+128,15+128,40+128, + 0, 29+128,27+128, 6+128,25+128, 5+128,17+128,16+128, 0,44+128, + 0,0,0,0,0,0 + }; + +const unsigned short key_map3[] = { + 30+64,31+64,32+64,33+64,34+64,35+64,36+64,37+64,38+64,39+64, + 20+64,26+64, 8+64,21+64,23+64,28+64,24+64,12+64,18+64,19+64, + 4+64,22+64, 7+64, 9+64,10+64,11+64,13+64,14+64,15+64,40+64, + 0, 29+64,27+64, 6+64,25+64, 5+64,17+64,16+64, 0,44+64, + 0,0,0,0,0,0 + }; + +const unsigned short matkeys[] = { + 0x104,0x101,0x108,0x102,0x110,0x120,0x140,0x204,0x201,0x208, // row 1 + 0x202,0x210,0x220,0x240,0x304,0x301,0x308,0x302,0x310,0x320, // row 2 + 0x340,0x404,0x401,0x408,0x402,0x410,0x420,0x440,0x504,0x501, // row 3 + 0x020,0x508,0x502,0x510,0x520,0x540,0x604,0x601,0x040,0x608, // row 4 + 0x008,0x001,0x002,0x010,0x620,0x640 }; // cursor keys up, left, right, down, <<<, >>> + +#else +/* + {25, 6,27,29,224},// vcxz + {10, 9, 7,22, 4}, // gfdsa + {23,21, 8,26,20}, // trewq + {34,33,32,31,30}, // 54321 + {35,36,37,38,39}, // 67890 + {28,24,12,18,19}, // yuiop + {11,13,14,15,40}, // hjkl + { 5,17,16,225,44},// bnm +*/ + +#define keylables_map1_0 (char *)"qwertyuiop\x1a" +#define keylables_map1_1 (char *)" asdfghjkl\x19" +#define keylables_map1_2 (char *)" zxcvbnm.\x10 " +const unsigned short key_map1[] = { + 20,26,8,21,23,28,24,12,18,19,39+128, + 0, 4, 22, 7,9, 10,11,13,14,15,40, + 0,29,27,6,25,5,17,16,16+64,44, + 0,0,0,0 //up,left,right,down + }; + +#define keylables_map2_0 (char *)"1234567890=" +#define keylables_map2_1 (char *)" !@#$%+&*- " +#define keylables_map2_2 (char *)" ()?/\"<>,: " +const unsigned short key_map2[] = { + 30,31,32,33,34,35,36,37,38,39,15+64, + 0,30+64,31+64,32+64,33+64,34+64,14+64,35+64,5+64,13+64,0, + 0, 37+64,38+64,6+64,25+64,19+64,21+64,23+64,17+64,29+64, + 36+128,34+128,37+128,35+128 //up,left,right,down + }; + +#define keylables_map3_0 (char *)"QWERTYUIOP " +#define keylables_map3_1 (char *)" ASDFGHJKL " +#define keylables_map3_2 (char *)" ZXCVBNM; " +const unsigned short key_map3[] = { + 20+128,26+128,8+128,21+128,23+128,28+128,24+128,12+128,18+128,19+128,0, // Upper case + 0, 4+128, 22+128, 7+128,9+128, 10+128,11+128,13+128,14+128,15+128,0, + 0,29+128,27+128,6+128,25+128,5+128,17+128,16+128,18+64,44+128, + 36+128,34+128,37+128,35+128 //up,left,right,down + }; + +const unsigned short matkeys[] = { + 0x020,0x120,0x220,0x320,0x420,0x408,0x308,0x208,0x108,0x008,0x002, // row 1 + 0x510,0x010,0x110,0x210,0x310,0x410,0x401,0x301,0x201,0x101,0x001, // row 2 + 0x520,0x102,0x202,0x302,0x402,0x404,0x304,0x204,0x104,0x004, // row 3 + 0x508,0x501,0x502,0x504 }; // cursor keys +#endif +#endif + +#endif diff --git a/MCUME_pico/picospeccy/font8x8.h b/MCUME_pico/picospeccy/font8x8.h deleted file mode 100644 index 4f773da..0000000 --- a/MCUME_pico/picospeccy/font8x8.h +++ /dev/null @@ -1,135 +0,0 @@ - -// Font: c64_lower.64c - -const unsigned char font8x8[128][8] PROGMEM = -{ - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0000 (nul) - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0001 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0002 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0003 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0004 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0005 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0006 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0007 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0008 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0009 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000A - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000B - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000C - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000D - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000E - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000F - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0010 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0011 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0012 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0013 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0014 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0015 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0016 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0017 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0018 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0019 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001A - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001B - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001C - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001D - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001E - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001F - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0020 (space) - { 0x18, 0x3C, 0x3C, 0x18, 0x18, 0x00, 0x18, 0x00}, // U+0021 (!) - { 0x36, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0022 (") - { 0x36, 0x36, 0x7F, 0x36, 0x7F, 0x36, 0x36, 0x00}, // U+0023 (#) - { 0x0C, 0x3E, 0x03, 0x1E, 0x30, 0x1F, 0x0C, 0x00}, // U+0024 ($) - { 0x00, 0x63, 0x33, 0x18, 0x0C, 0x66, 0x63, 0x00}, // U+0025 (%) - { 0x1C, 0x36, 0x1C, 0x6E, 0x3B, 0x33, 0x6E, 0x00}, // U+0026 (&) - { 0x06, 0x06, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0027 (') - { 0x18, 0x0C, 0x06, 0x06, 0x06, 0x0C, 0x18, 0x00}, // U+0028 (() - { 0x06, 0x0C, 0x18, 0x18, 0x18, 0x0C, 0x06, 0x00}, // U+0029 ()) - { 0x00, 0x66, 0x3C, 0xFF, 0x3C, 0x66, 0x00, 0x00}, // U+002A (*) - { 0x00, 0x0C, 0x0C, 0x3F, 0x0C, 0x0C, 0x00, 0x00}, // U+002B (+) - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x0C, 0x06}, // U+002C (,) - { 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x00}, // U+002D (-) - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x0C, 0x00}, // U+002E (.) - { 0x60, 0x30, 0x18, 0x0C, 0x06, 0x03, 0x01, 0x00}, // U+002F (/) - { 0x3E, 0x63, 0x73, 0x7B, 0x6F, 0x67, 0x3E, 0x00}, // U+0030 (0) - { 0x0C, 0x0E, 0x0C, 0x0C, 0x0C, 0x0C, 0x3F, 0x00}, // U+0031 (1) - { 0x1E, 0x33, 0x30, 0x1C, 0x06, 0x33, 0x3F, 0x00}, // U+0032 (2) - { 0x1E, 0x33, 0x30, 0x1C, 0x30, 0x33, 0x1E, 0x00}, // U+0033 (3) - { 0x38, 0x3C, 0x36, 0x33, 0x7F, 0x30, 0x78, 0x00}, // U+0034 (4) - { 0x3F, 0x03, 0x1F, 0x30, 0x30, 0x33, 0x1E, 0x00}, // U+0035 (5) - { 0x1C, 0x06, 0x03, 0x1F, 0x33, 0x33, 0x1E, 0x00}, // U+0036 (6) - { 0x3F, 0x33, 0x30, 0x18, 0x0C, 0x0C, 0x0C, 0x00}, // U+0037 (7) - { 0x1E, 0x33, 0x33, 0x1E, 0x33, 0x33, 0x1E, 0x00}, // U+0038 (8) - { 0x1E, 0x33, 0x33, 0x3E, 0x30, 0x18, 0x0E, 0x00}, // U+0039 (9) - { 0x00, 0x0C, 0x0C, 0x00, 0x00, 0x0C, 0x0C, 0x00}, // U+003A (:) - { 0x00, 0x0C, 0x0C, 0x00, 0x00, 0x0C, 0x0C, 0x06}, // U+003B (//) - { 0x18, 0x0C, 0x06, 0x03, 0x06, 0x0C, 0x18, 0x00}, // U+003C (<) - { 0x00, 0x00, 0x3F, 0x00, 0x00, 0x3F, 0x00, 0x00}, // U+003D (=) - { 0x06, 0x0C, 0x18, 0x30, 0x18, 0x0C, 0x06, 0x00}, // U+003E (>) - { 0x1E, 0x33, 0x30, 0x18, 0x0C, 0x00, 0x0C, 0x00}, // U+003F (?) - { 0x3E, 0x63, 0x7B, 0x7B, 0x7B, 0x03, 0x1E, 0x00}, // U+0040 (@) - { 0x0C, 0x1E, 0x33, 0x33, 0x3F, 0x33, 0x33, 0x00}, // U+0041 (A) - { 0x3F, 0x66, 0x66, 0x3E, 0x66, 0x66, 0x3F, 0x00}, // U+0042 (B) - { 0x3C, 0x66, 0x03, 0x03, 0x03, 0x66, 0x3C, 0x00}, // U+0043 (C) - { 0x1F, 0x36, 0x66, 0x66, 0x66, 0x36, 0x1F, 0x00}, // U+0044 (D) - { 0x7F, 0x46, 0x16, 0x1E, 0x16, 0x46, 0x7F, 0x00}, // U+0045 (E) - { 0x7F, 0x46, 0x16, 0x1E, 0x16, 0x06, 0x0F, 0x00}, // U+0046 (F) - { 0x3C, 0x66, 0x03, 0x03, 0x73, 0x66, 0x7C, 0x00}, // U+0047 (G) - { 0x33, 0x33, 0x33, 0x3F, 0x33, 0x33, 0x33, 0x00}, // U+0048 (H) - { 0x1E, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+0049 (I) - { 0x78, 0x30, 0x30, 0x30, 0x33, 0x33, 0x1E, 0x00}, // U+004A (J) - { 0x67, 0x66, 0x36, 0x1E, 0x36, 0x66, 0x67, 0x00}, // U+004B (K) - { 0x0F, 0x06, 0x06, 0x06, 0x46, 0x66, 0x7F, 0x00}, // U+004C (L) - { 0x63, 0x77, 0x7F, 0x7F, 0x6B, 0x63, 0x63, 0x00}, // U+004D (M) - { 0x63, 0x67, 0x6F, 0x7B, 0x73, 0x63, 0x63, 0x00}, // U+004E (N) - { 0x1C, 0x36, 0x63, 0x63, 0x63, 0x36, 0x1C, 0x00}, // U+004F (O) - { 0x3F, 0x66, 0x66, 0x3E, 0x06, 0x06, 0x0F, 0x00}, // U+0050 (P) - { 0x1E, 0x33, 0x33, 0x33, 0x3B, 0x1E, 0x38, 0x00}, // U+0051 (Q) - { 0x3F, 0x66, 0x66, 0x3E, 0x36, 0x66, 0x67, 0x00}, // U+0052 (R) - { 0x1E, 0x33, 0x07, 0x0E, 0x38, 0x33, 0x1E, 0x00}, // U+0053 (S) - { 0x3F, 0x2D, 0x0C, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+0054 (T) - { 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x3F, 0x00}, // U+0055 (U) - { 0x33, 0x33, 0x33, 0x33, 0x33, 0x1E, 0x0C, 0x00}, // U+0056 (V) - { 0x63, 0x63, 0x63, 0x6B, 0x7F, 0x77, 0x63, 0x00}, // U+0057 (W) - { 0x63, 0x63, 0x36, 0x1C, 0x1C, 0x36, 0x63, 0x00}, // U+0058 (X) - { 0x33, 0x33, 0x33, 0x1E, 0x0C, 0x0C, 0x1E, 0x00}, // U+0059 (Y) - { 0x7F, 0x63, 0x31, 0x18, 0x4C, 0x66, 0x7F, 0x00}, // U+005A (Z) - { 0x1E, 0x06, 0x06, 0x06, 0x06, 0x06, 0x1E, 0x00}, // U+005B ([) - { 0x03, 0x06, 0x0C, 0x18, 0x30, 0x60, 0x40, 0x00}, // U+005C (\) - { 0x1E, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1E, 0x00}, // U+005D (]) - { 0x08, 0x1C, 0x36, 0x63, 0x00, 0x00, 0x00, 0x00}, // U+005E (^) - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF}, // U+005F (_) - { 0x0C, 0x0C, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0060 (`) - { 0x00, 0x00, 0x1E, 0x30, 0x3E, 0x33, 0x6E, 0x00}, // U+0061 (a) - { 0x07, 0x06, 0x06, 0x3E, 0x66, 0x66, 0x3B, 0x00}, // U+0062 (b) - { 0x00, 0x00, 0x1E, 0x33, 0x03, 0x33, 0x1E, 0x00}, // U+0063 (c) - { 0x38, 0x30, 0x30, 0x3e, 0x33, 0x33, 0x6E, 0x00}, // U+0064 (d) - { 0x00, 0x00, 0x1E, 0x33, 0x3f, 0x03, 0x1E, 0x00}, // U+0065 (e) - { 0x1C, 0x36, 0x06, 0x0f, 0x06, 0x06, 0x0F, 0x00}, // U+0066 (f) - { 0x00, 0x00, 0x6E, 0x33, 0x33, 0x3E, 0x30, 0x1F}, // U+0067 (g) - { 0x07, 0x06, 0x36, 0x6E, 0x66, 0x66, 0x67, 0x00}, // U+0068 (h) - { 0x0C, 0x00, 0x0E, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+0069 (i) - { 0x30, 0x00, 0x30, 0x30, 0x30, 0x33, 0x33, 0x1E}, // U+006A (j) - { 0x07, 0x06, 0x66, 0x36, 0x1E, 0x36, 0x67, 0x00}, // U+006B (k) - { 0x0E, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+006C (l) - { 0x00, 0x00, 0x33, 0x7F, 0x7F, 0x6B, 0x63, 0x00}, // U+006D (m) - { 0x00, 0x00, 0x1F, 0x33, 0x33, 0x33, 0x33, 0x00}, // U+006E (n) - { 0x00, 0x00, 0x1E, 0x33, 0x33, 0x33, 0x1E, 0x00}, // U+006F (o) - { 0x00, 0x00, 0x3B, 0x66, 0x66, 0x3E, 0x06, 0x0F}, // U+0070 (p) - { 0x00, 0x00, 0x6E, 0x33, 0x33, 0x3E, 0x30, 0x78}, // U+0071 (q) - { 0x00, 0x00, 0x3B, 0x6E, 0x66, 0x06, 0x0F, 0x00}, // U+0072 (r) - { 0x00, 0x00, 0x3E, 0x03, 0x1E, 0x30, 0x1F, 0x00}, // U+0073 (s) - { 0x08, 0x0C, 0x3E, 0x0C, 0x0C, 0x2C, 0x18, 0x00}, // U+0074 (t) - { 0x00, 0x00, 0x33, 0x33, 0x33, 0x33, 0x6E, 0x00}, // U+0075 (u) - { 0x00, 0x00, 0x33, 0x33, 0x33, 0x1E, 0x0C, 0x00}, // U+0076 (v) - { 0x00, 0x00, 0x63, 0x6B, 0x7F, 0x7F, 0x36, 0x00}, // U+0077 (w) - { 0x00, 0x00, 0x63, 0x36, 0x1C, 0x36, 0x63, 0x00}, // U+0078 (x) - { 0x00, 0x00, 0x33, 0x33, 0x33, 0x3E, 0x30, 0x1F}, // U+0079 (y) - { 0x00, 0x00, 0x3F, 0x19, 0x0C, 0x26, 0x3F, 0x00}, // U+007A (z) - { 0x38, 0x0C, 0x0C, 0x07, 0x0C, 0x0C, 0x38, 0x00}, // U+007B ({) - { 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x00}, // U+007C (|) - { 0x07, 0x0C, 0x0C, 0x38, 0x0C, 0x0C, 0x07, 0x00}, // U+007D (}) - { 0x6E, 0x3B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+007E (~) - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} // U+007F -}; - diff --git a/MCUME_pico/picospeccy/picospeccy.cpp b/MCUME_pico/picospeccy/picospeccy.cpp index 202276b..791905d 100644 --- a/MCUME_pico/picospeccy/picospeccy.cpp +++ b/MCUME_pico/picospeccy/picospeccy.cpp @@ -11,12 +11,8 @@ extern "C" { #include "spec.h" } #include +#include "pico_dsp.h" -#ifdef USE_VGA -#include "vga_t_dma.h" -#else -#include "tft_t_dma.h" -#endif volatile bool vbl=true; bool repeating_timer_callback(struct repeating_timer *t) { @@ -29,8 +25,8 @@ bool repeating_timer_callback(struct repeating_timer *t) { } return true; } -TFT_T_DMA tft; +PICO_DSP tft; static int skip=0; #include "hardware/clocks.h" @@ -48,82 +44,84 @@ int main(void) { // set_sys_clock_khz(250000, true); stdio_init_all(); -#ifdef USE_VGA - tft.begin(VGA_MODE_320x240); -#else - tft.begin(); -#endif emu_init(); - while (true) { + char * filename; +#ifdef FILEBROWSER + while (true) { if (menuActive()) { uint16_t bClick = emu_DebounceLocalKeys(); int action = handleMenu(bClick); - char * filename = menuSelection(); - if (action == ACTION_RUNTFT) { - toggleMenu(false); - emu_start(); - emu_Init(filename); - tft.fillScreenNoDma( RGBVAL16(0x00,0x00,0x00) ); - tft.startDMA(); - struct repeating_timer timer; - add_repeating_timer_ms(5, repeating_timer_callback, NULL, &timer); - } + filename = menuSelection(); + if (action == ACTION_RUN) { + break; + } tft.waitSync(); } - else { - emu_Step(); - } - //int c = getchar_timeout_us(0); - //switch (c) { - // case ' ': - // printf("test: %d\n", 1); - // break; - //} + } +#endif + emu_start(); + emu_Init(filename); + tft.startRefresh(); + struct repeating_timer timer; + add_repeating_timer_ms(5, repeating_timer_callback, NULL, &timer); + while (true) { + //uint16_t bClick = emu_DebounceLocalKeys(); + //emu_Input(bClick); + emu_Step(); } } -static unsigned char palette8[PALETTE_SIZE]; -static unsigned short palette16[PALETTE_SIZE]; +static unsigned short palette16[PALETTE_SIZE]; void emu_SetPaletteEntry(unsigned char r, unsigned char g, unsigned char b, int index) { if (index -void AudioPlaySystem::snd_Mixer(short * stream, int len ) -{ - if (playing) - { -#ifdef CUSTOM_SND - //printf("s\n"); - SND_Process((void*)stream, len); -#else - int i; - long s; - len = len >> 1; - short v0=chan[0].vol; - short v1=chan[1].vol; - short v2=chan[2].vol; - short v3=chan[3].vol; - short v4=chan[4].vol; - short v5=chan[5].vol; - for (i=0;i>8)&0x3f])>>11); - s+=((v1*square[(chan[1].spos>>8)&0x3f])>>11); - s+=((v2*square[(chan[2].spos>>8)&0x3f])>>11); - s+=((v3*noise[(chan[3].spos>>8)&(NOISEBSIZE-1)])>>11); - s+=((v4*noise[(chan[4].spos>>8)&(NOISEBSIZE-1)])>>11); - s+=((v5*noise[(chan[5].spos>>8)&(NOISEBSIZE-1)])>>11); - *stream++ = (short)(s); - *stream++ = (short)(s); - chan[0].spos += chan[0].sinc; - chan[1].spos += chan[1].sinc; - chan[2].spos += chan[2].sinc; - chan[3].spos += chan[3].sinc; - chan[4].spos += chan[4].sinc; - chan[5].spos += chan[5].sinc; - } -#endif - } -} - -void AudioPlaySystem::begin(void) -{ - this->reset(); -} - -void AudioPlaySystem::start(void) -{ - playing = true; -} - -void AudioPlaySystem::setSampleParameters(float clockfreq, float samplerate) { -} - -void AudioPlaySystem::reset(void) -{ - snd_Reset(); -} - -void AudioPlaySystem::stop(void) -{ - playing = false; -} - -bool AudioPlaySystem::isPlaying(void) -{ - return playing; -} - - - -void AudioPlaySystem::sound(int C, int F, int V) { -#ifndef CUSTOM_SND - if (C < 6) { - chan[C].vol = V; - chan[C].sinc = F>>1; - } -#endif -} - -void AudioPlaySystem::step(void) { -} - -void AudioPlaySystem::buzz(int size, int val) { -} -#endif diff --git a/MCUME_pico/picovcs/AudioPlaySystem.h b/MCUME_pico/picovcs/AudioPlaySystem.h deleted file mode 100644 index 5d2efc0..0000000 --- a/MCUME_pico/picovcs/AudioPlaySystem.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef audioplaysystem_h_ -#define audioplaysystem_h_ - -#ifdef HAS_SND - -#include "platform_config.h" - -class AudioPlaySystem -{ -public: - AudioPlaySystem(void) { }; - void begin(void); - void setSampleParameters(float clockfreq, float samplerate); - void reset(void); - void start(void); - void stop(void); - bool isPlaying(void); - void sound(int C, int F, int V); - void buzz(int size, int val); - void step(void); - static void snd_Mixer(short * stream, int len ); -}; - -#endif - -#endif diff --git a/MCUME_pico/picovcs/Vmachine.c b/MCUME_pico/picovcs/Vmachine.c index 09aa293..785891f 100644 --- a/MCUME_pico/picovcs/Vmachine.c +++ b/MCUME_pico/picovcs/Vmachine.c @@ -180,7 +180,7 @@ void tv_display (void) /* Only display if the frame is a valid one. */ //if ( (tv_counter % nOptions_SkipFrames) == 0) //{ - emu_DrawScreen(VBuf, tv_width, tv_height, tv_width); + emu_DrawScreenPal16(VBuf, tv_width, tv_height, tv_width); emu_DrawVsync(); //} //tv_counter++; diff --git a/MCUME_pico/picovcs/emuapi.cpp b/MCUME_pico/picovcs/emuapi.cpp deleted file mode 100644 index 1bc929b..0000000 --- a/MCUME_pico/picovcs/emuapi.cpp +++ /dev/null @@ -1,1311 +0,0 @@ -#define KEYMAP_PRESENT 1 - -#define PROGMEM - -#include "pico.h" -#include "pico/stdlib.h" -#include "hardware/adc.h" -#include -#include - -extern "C" { - #include "emuapi.h" - #include "iopins.h" -} - -static bool emu_writeConfig(void); -static bool emu_readConfig(void); -static bool emu_eraseConfig(void); - - -#if (defined(ILI9341) || defined(ST7789)) && defined(USE_VGA) -// Dual display config, initialize TFT -#include "tft_t_dma.h" -static TFT_T_DMA tft; -#else -// Non Dual display config -#ifdef USE_VGA -#include "vga_t_dma.h" -#else -#include "tft_t_dma.h" -#endif -extern TFT_T_DMA tft; -#endif - - -#define MAX_FILENAME_PATH 64 -#define NB_FILE_HANDLER 4 -#define AUTORUN_FILENAME "autorun.txt" - -#define MAX_FILES 64 -#define MAX_FILENAME_SIZE 24 -#define MAX_MENULINES 9 -#define TEXT_HEIGHT 16 -#define TEXT_WIDTH 8 -#define MENU_FILE_XOFFSET (6*TEXT_WIDTH) -#define MENU_FILE_YOFFSET (2*TEXT_HEIGHT) -#define MENU_FILE_W (MAX_FILENAME_SIZE*TEXT_WIDTH) -#define MENU_FILE_H (MAX_MENULINES*TEXT_HEIGHT) -#define MENU_FILE_BGCOLOR RGBVAL16(0x00,0x00,0x40) -#define MENU_JOYS_YOFFSET (12*TEXT_HEIGHT) -#define MENU_VBAR_XOFFSET (0*TEXT_WIDTH) -#define MENU_VBAR_YOFFSET (MENU_FILE_YOFFSET) - -#define MENU_TFT_XOFFSET (MENU_FILE_XOFFSET+MENU_FILE_W+8) -#define MENU_TFT_YOFFSET (MENU_VBAR_YOFFSET+32) -#define MENU_VGA_XOFFSET (MENU_FILE_XOFFSET+MENU_FILE_W+8) -#define MENU_VGA_YOFFSET (MENU_VBAR_YOFFSET+MENU_FILE_H-32-37) - - - -static int nbFiles=0; -static int curFile=0; -static int topFile=0; -static char selection[MAX_FILENAME_PATH]=""; -static char selected_filename[MAX_FILENAME_SIZE]=""; -static char files[MAX_FILES][MAX_FILENAME_SIZE]; -static bool menuRedraw=true; - -#ifdef PICOMPUTER -static const unsigned short * keys; -static unsigned char keymatrix[6]; -static int keymatrix_hitrow=-1; -static bool key_fn=false; -static bool key_alt=false; -static uint32_t keypress_t_ms=0; -static uint32_t last_t_ms=0; -static uint32_t hundred_ms_cnt=0; -static bool ledflash_toggle=false; -#endif -static int keyMap; - -static bool joySwapped = false; -static uint16_t bLastState; -static int xRef; -static int yRef; -static uint8_t usbnavpad=0; - -static bool menuOn=true; -static bool autorun=false; - - -/******************************** - * Generic output and malloc -********************************/ -void emu_printf(const char * text) -{ - printf("%s\n",text); -} - -void emu_printf(int val) -{ - printf("%d\n",val); -} - -void emu_printi(int val) -{ - printf("%d\n",val); -} - -void emu_printh(int val) -{ - printf("0x%.8\n",val); -} - -static int malbufpt = 0; -static char malbuf[EXTRA_HEAP]; - -void * emu_Malloc(int size) -{ - void * retval = malloc(size); - if (!retval) { - emu_printf("failled to allocate"); - emu_printf(size); - emu_printf("fallback"); - if ( (malbufpt+size) < sizeof(malbuf) ) { - retval = (void *)&malbuf[malbufpt]; - malbufpt += size; - } - else { - emu_printf("failure to allocate"); - } - } - else { - emu_printf("could allocate dynamic "); - emu_printf(size); - } - - return retval; -} - -void * emu_MallocI(int size) -{ - void * retval = NULL; - - if ( (malbufpt+size) < sizeof(malbuf) ) { - retval = (void *)&malbuf[malbufpt]; - malbufpt += size; - emu_printf("could allocate static "); - emu_printf(size); - } - else { - emu_printf("failure to allocate"); - } - - return retval; -} -void emu_Free(void * pt) -{ - free(pt); -} - -void emu_drawText(unsigned short x, unsigned short y, const char * text, unsigned short fgcolor, unsigned short bgcolor, int doublesize) -{ - tft.drawText(x, y, text, fgcolor, bgcolor, doublesize?true:false); -} - - -/******************************** - * OSKB handling -********************************/ -#if (defined(ILI9341) || defined(ST7789)) && defined(USE_VGA) -// On screen keyboard position -#define KXOFF 28 //64 -#define KYOFF 96 -#define KWIDTH 11 //22 -#define KHEIGHT 3 - -static bool oskbOn = false; -static int cxpos = 0; -static int cypos = 0; -static int oskbMap = 0; -static uint16_t oskbBLastState = 0; - -static void lineOSKB2(int kxoff, int kyoff, char * str, int row) -{ - char c[2] = {'A',0}; - const char * cpt = str; - for (int i=0; i.,SP ", 2); - if (oskbMap == 0) { - lineOSKB(KXOFF,KYOFF, keylables_map1_0, 0); - lineOSKB(KXOFF,KYOFF, keylables_map1_1, 1); - lineOSKB(KXOFF,KYOFF, keylables_map1_2, 2); - } - else if (oskbMap == 1) { - lineOSKB(KXOFF,KYOFF, keylables_map2_0, 0); - lineOSKB(KXOFF,KYOFF, keylables_map2_1, 1); - lineOSKB(KXOFF,KYOFF, keylables_map2_2, 2); - } - else { - lineOSKB(KXOFF,KYOFF, keylables_map3_0, 0); - lineOSKB(KXOFF,KYOFF, keylables_map3_1, 1); - lineOSKB(KXOFF,KYOFF, keylables_map3_2, 2); - } -} - -void toggleOskb(bool forceoff) { - if (forceoff) oskbOn=true; - if (oskbOn) { - oskbOn = false; - tft.fillScreenNoDma(RGBVAL16(0x00,0x00,0x00)); - tft.drawTextNoDma(0,32, "Press USER2 to toggle onscreen keyboard.", RGBVAL16(0xff,0xff,0xff), RGBVAL16(0x00,0x00,0x00), true); - } else { - oskbOn = true; - tft.fillScreenNoDma(RGBVAL16(0x00,0x00,0x00)); - tft.drawTextNoDma(0,32, " Press USER2 to exit onscreen keyboard. ", RGBVAL16(0xff,0xff,0xff), RGBVAL16(0x00,0x00,0x00), true); - tft.drawTextNoDma(0,64, " (USER1 to toggle between keymaps) ", RGBVAL16(0x00,0xff,0xff), RGBVAL16(0x00,0x00,0xff), true); - tft.drawRectNoDma(KXOFF,KYOFF, 22*8, 3*16, RGBVAL16(0x00,0x00,0xFF)); - drawOskb(); - } -} - -static int handleOskb(void) -{ - int retval = 0; - - uint16_t bClick = bLastState & ~oskbBLastState; - oskbBLastState = bLastState; - /* - static const char * digits = "0123456789ABCDEF"; - char buf[5] = {0,0,0,0,0}; - int val = bClick; - buf[0] = digits[(val>>12)&0xf]; - buf[1] = digits[(val>>8)&0xf]; - buf[2] = digits[(val>>4)&0xf]; - buf[3] = digits[val&0xf]; - tft.drawTextNoDma(0,KYOFF+ 64,buf,RGBVAL16(0x00,0x00,0x00),RGBVAL16(0xFF,0xFF,0xFF),1); - */ - if (bClick & MASK_KEY_USER2) - { - toggleOskb(false); - } - if (oskbOn) - { - bool updated = true; - if (bClick & MASK_KEY_USER1) - { - oskbMap += 1; - if (oskbMap == 3) oskbMap = 0; - } - else if (bClick & MASK_JOY2_LEFT) - { - cxpos++; - if (cxpos >= KWIDTH) cxpos = 0; - } - else if (bClick & MASK_JOY2_RIGHT) - { - cxpos--; - if (cxpos < 0) cxpos = KWIDTH-1; - } - else if (bClick & MASK_JOY2_DOWN) - { - cypos++; - if (cypos >= KHEIGHT) cypos = 0; - } - else if (bClick & MASK_JOY2_UP) - { - cypos--; - if (cypos < 0) cypos = KHEIGHT-1; - } - else if (oskbBLastState & MASK_JOY2_BTN) - { - retval = cypos*KWIDTH+cxpos+1; - if (retval) { - retval--; - //if (retval & 1) retval = key_map2[retval>>1]; - //else retval = key_map1[retval>>1]; - if (oskbMap == 0) { - retval = key_map1[retval]; - } - else if (oskbMap == 1) { - retval = key_map2[retval]; - } - else { - retval = key_map3[retval]; - } - //if (retval) { toggleOskb(true); updated=false; }; - } - } - else { - updated=false; - } - if (updated) drawOskb(); - } - - return retval; -} -#endif - -/******************************** - * Input and keyboard -********************************/ -int emu_ReadAnalogJoyX(int min, int max) -{ - adc_select_input(0); - int val = adc_read(); -#if INVX - val = 4095 - val; -#endif - val = val-xRef; - val = ((val*140)/100); - if ( (val > -512) && (val < 512) ) val = 0; - val = val+2048; - return (val*(max-min))/4096; -} - -int emu_ReadAnalogJoyY(int min, int max) -{ - adc_select_input(1); - int val = adc_read(); -#if INVY - val = 4095 - val; -#endif - val = val-yRef; - val = ((val*120)/100); - if ( (val > -512) && (val < 512) ) val = 0; - //val = (val*(max-min))/4096; - val = val+2048; - //return val+(max-min)/2; - return (val*(max-min))/4096; -} - - -static uint16_t readAnalogJoystick(void) -{ - uint16_t joysval = 0; -#ifdef PIN_JOY2_A1X - int xReading = emu_ReadAnalogJoyX(0,256); - if (xReading > 128) joysval |= MASK_JOY2_LEFT; - else if (xReading < 128) joysval |= MASK_JOY2_RIGHT; - - int yReading = emu_ReadAnalogJoyY(0,256); - if (yReading < 128) joysval |= MASK_JOY2_UP; - else if (yReading > 128) joysval |= MASK_JOY2_DOWN; -#endif - // First joystick -#if INVY -#ifdef PIN_JOY2_1 - if ( !gpio_get(PIN_JOY2_1) ) joysval |= MASK_JOY2_DOWN; -#endif -#ifdef PIN_JOY2_2 - if ( !gpio_get(PIN_JOY2_2) ) joysval |= MASK_JOY2_UP; -#endif -#else -#ifdef PIN_JOY2_1 - if ( !gpio_get(PIN_JOY2_1) ) joysval |= MASK_JOY2_UP; -#endif -#ifdef PIN_JOY2_2 - if ( !gpio_get(PIN_JOY2_2) ) joysval |= MASK_JOY2_DOWN; -#endif -#endif -#if INVX -#ifdef PIN_JOY2_3 - if ( !gpio_get(PIN_JOY2_3) ) joysval |= MASK_JOY2_LEFT; -#endif -#ifdef PIN_JOY2_4 - if ( !gpio_get(PIN_JOY2_4) ) joysval |= MASK_JOY2_RIGHT; -#endif -#else -#ifdef PIN_JOY2_3 - if ( !gpio_get(PIN_JOY2_3) ) joysval |= MASK_JOY2_RIGHT; -#endif -#ifdef PIN_JOY2_4 - if ( !gpio_get(PIN_JOY2_4) ) joysval |= MASK_JOY2_LEFT; -#endif -#endif -#ifdef PIN_JOY2_BTN - joysval |= (gpio_get(PIN_JOY2_BTN) ? 0 : MASK_JOY2_BTN); -#endif - - return (joysval); -} - - -int emu_SwapJoysticks(int statusOnly) { - if (!statusOnly) { - if (joySwapped) { - joySwapped = false; - } - else { - joySwapped = true; - } - } - return(joySwapped?1:0); -} - -int emu_GetPad(void) -{ - return(bLastState/*|((joySwapped?1:0)<<7)*/); -} - -int emu_ReadKeys(void) -{ - uint16_t retval; - uint16_t j1 = readAnalogJoystick(); - uint16_t j2 = 0; - - // Second joystick -#if INVY -#ifdef PIN_JOY1_1 - if ( !gpio_get(PIN_JOY1_1) ) j2 |= MASK_JOY2_DOWN; -#endif -#ifdef PIN_JOY1_2 - if ( !gpio_get(PIN_JOY1_2) ) j2 |= MASK_JOY2_UP; -#endif -#else -#ifdef PIN_JOY1_1 - if ( !gpio_get(PIN_JOY1_1) ) j2 |= MASK_JOY2_UP; -#endif -#ifdef PIN_JOY1_2 - if ( !gpio_get(PIN_JOY1_2) ) j2 |= MASK_JOY2_DOWN; -#endif -#endif -#if INVX -#ifdef PIN_JOY1_3 - if ( !gpio_get(PIN_JOY1_3) ) j2 |= MASK_JOY2_LEFT; -#endif -#ifdef PIN_JOY1_4 - if ( !gpio_get(PIN_JOY1_4) ) j2 |= MASK_JOY2_RIGHT; -#endif -#else -#ifdef PIN_JOY1_3 - if ( !gpio_get(PIN_JOY1_3) ) j2 |= MASK_JOY2_RIGHT; -#endif -#ifdef PIN_JOY1_4 - if ( !gpio_get(PIN_JOY1_4) ) j2 |= MASK_JOY2_LEFT; -#endif -#endif -#ifdef PIN_JOY1_BTN - if ( !gpio_get(PIN_JOY1_BTN) ) j2 |= MASK_JOY2_BTN; -#endif - - - if (joySwapped) { - retval = ((j1 << 8) | j2); - } - else { - retval = ((j2 << 8) | j1); - } - - if (usbnavpad & MASK_JOY2_UP) retval |= MASK_JOY2_UP; - if (usbnavpad & MASK_JOY2_DOWN) retval |= MASK_JOY2_DOWN; - if (usbnavpad & MASK_JOY2_LEFT) retval |= MASK_JOY2_LEFT; - if (usbnavpad & MASK_JOY2_RIGHT) retval |= MASK_JOY2_RIGHT; - if (usbnavpad & MASK_JOY2_BTN) retval |= MASK_JOY2_BTN; - -#ifdef PIN_KEY_USER1 - if ( !gpio_get(PIN_KEY_USER1) ) retval |= MASK_KEY_USER1; -#endif -#ifdef PIN_KEY_USER2 - if ( !gpio_get(PIN_KEY_USER2) ) retval |= MASK_KEY_USER2; -#endif -#ifdef PIN_KEY_USER3 - if ( !gpio_get(PIN_KEY_USER3) ) retval |= MASK_KEY_USER3; -#endif -#ifdef PIN_KEY_USER4 - if ( !gpio_get(PIN_KEY_USER4) ) retval |= MASK_KEY_USER4; -#endif - -#ifdef PICOMPUTER - keymatrix_hitrow = -1; - unsigned char row; - unsigned short cols[6]={KCOLOUT1,KCOLOUT2,KCOLOUT3,KCOLOUT4,KCOLOUT5,KCOLOUT6}; - unsigned char keymatrixtmp[6]; - - for (int i=0;i<6;i++){ - gpio_set_dir(cols[i], GPIO_OUT); - gpio_put(cols[i], 0); -#ifdef SWAP_ALT_DEL - sleep_us(1); - //__asm volatile ("nop\n"); // 4-8ns -#endif - row=0; - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN4) ? 0 : 0x02); - row |= (gpio_get(KROWIN1) ? 0 : 0x04); - row |= (gpio_get(KROWIN3) ? 0 : 0x08); - row |= (gpio_get(KROWIN5) ? 0 : 0x10); - row |= (gpio_get(KROWIN6) ? 0 : 0x20); - //gpio_set_dir(cols[i], GPIO_OUT); - gpio_put(cols[i], 1); - gpio_set_dir(cols[i], GPIO_IN); - gpio_disable_pulls(cols[i]); - keymatrixtmp[i] = row; - } - -#ifdef MULTI_DEBOUNCE - for (int i=0;i<6;i++){ - gpio_set_dir(cols[i], GPIO_OUT); - gpio_put(cols[i], 0); -#ifdef SWAP_ALT_DEL - sleep_us(1); - //__asm volatile ("nop\n"); // 4-8ns -#endif - row=0; - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN4) ? 0 : 0x02); - row |= (gpio_get(KROWIN1) ? 0 : 0x04); - row |= (gpio_get(KROWIN3) ? 0 : 0x08); - row |= (gpio_get(KROWIN5) ? 0 : 0x10); - row |= (gpio_get(KROWIN6) ? 0 : 0x20); - //gpio_set_dir(cols[i], GPIO_OUT); - gpio_put(cols[i], 1); - gpio_set_dir(cols[i], GPIO_IN); - gpio_disable_pulls(cols[i]); - keymatrixtmp[i] |= row; - } - - for (int i=0;i<6;i++){ - gpio_set_dir(cols[i], GPIO_OUT); - gpio_put(cols[i], 0); -#ifdef SWAP_ALT_DEL - sleep_us(1); - //__asm volatile ("nop\n"); // 4-8ns -#endif - row=0; - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN4) ? 0 : 0x02); - row |= (gpio_get(KROWIN1) ? 0 : 0x04); - row |= (gpio_get(KROWIN3) ? 0 : 0x08); - row |= (gpio_get(KROWIN5) ? 0 : 0x10); - row |= (gpio_get(KROWIN6) ? 0 : 0x20); - //gpio_set_dir(cols[i], GPIO_OUT); - gpio_put(cols[i], 1); - gpio_set_dir(cols[i], GPIO_IN); - gpio_disable_pulls(cols[i]); - keymatrixtmp[i] |= row; - } -#endif - -#ifdef SWAP_ALT_DEL - // Swap ALT and DEL - unsigned char alt = keymatrixtmp[0] & 0x02; - unsigned char del = keymatrixtmp[5] & 0x20; - keymatrixtmp[0] &= ~0x02; - keymatrixtmp[5] &= ~0x20; - if (alt) keymatrixtmp[5] |= 0x20; - if (del) keymatrixtmp[0] |= 0x02; -#endif - - bool alt_pressed=false; - if ( keymatrixtmp[5] & 0x20 ) {alt_pressed=true; keymatrixtmp[5] &= ~0x20;}; - - for (int i=0;i<6;i++){ - row = keymatrixtmp[i]; - if (row) keymatrix_hitrow=i; - keymatrix[i] = row; - } - - //6,9,15,8,7,22 -#if INVX - if ( row & 0x2 ) retval |= MASK_JOY2_LEFT; - if ( row & 0x1 ) retval |= MASK_JOY2_RIGHT; -#else - if ( row & 0x1 ) retval |= MASK_JOY2_LEFT; - if ( row & 0x2 ) retval |= MASK_JOY2_RIGHT; -#endif -#if INVY - if ( row & 0x8 ) retval |= MASK_JOY2_DOWN; - if ( row & 0x4 ) retval |= MASK_JOY2_UP; -#else - if ( row & 0x4 ) retval |= MASK_JOY2_DOWN; - if ( row & 0x8 ) retval |= MASK_JOY2_UP; -#endif - if ( row & 0x10 ) retval |= MASK_JOY2_BTN; - - // Handle LED flash - uint32_t time_ms=to_ms_since_boot (get_absolute_time()); - if ((time_ms-last_t_ms) > 100) { - last_t_ms = time_ms; - if (ledflash_toggle == false) { - ledflash_toggle = true; - } - else { - ledflash_toggle = false; - } - } - - if ( alt_pressed ) { - if (key_fn == false) - { - // Release to Press transition - if (hundred_ms_cnt == 0) { - keypress_t_ms=time_ms; - hundred_ms_cnt += 1; // 1 - } - else { - hundred_ms_cnt += 1; // 2 - if (hundred_ms_cnt >= 2) - { - hundred_ms_cnt = 0; - /* - if ( (time_ms-keypress_t_ms) < 500) - { - if (key_alt == false) - { - key_alt = true; - } - else - { - key_alt = false; - } - } - */ - } - } - } - else { - // Keep press - if (hundred_ms_cnt == 1) { - if ((to_ms_since_boot (get_absolute_time())-keypress_t_ms) > 2000) - { - if (key_alt == false) - { - key_alt = true; - } - else - { - key_alt = false; - } - hundred_ms_cnt = 0; - } - } - } - key_fn = true; - } - else { - key_fn = false; - } - - // Handle LED - if (key_alt == true) { - gpio_put(KLED, (ledflash_toggle?1:0)); - } - else { - if (key_fn == true) { - gpio_put(KLED, 1); - } - else { - gpio_put(KLED, 0); - } - } - - if ( key_fn ) retval |= MASK_KEY_USER2; - if ( ( key_fn ) && (keymatrix[0] == 0x02 )) retval |= MASK_KEY_USER1; -#endif - - //Serial.println(retval,HEX); - - if ( ((retval & (MASK_KEY_USER1+MASK_KEY_USER2)) == (MASK_KEY_USER1+MASK_KEY_USER2)) - || (retval & MASK_KEY_USER4 ) ) - { - } - -#if (defined(ILI9341) || defined(ST7789)) && defined(USE_VGA) - if (oskbOn) { - retval |= MASK_OSKB; - } -#endif - - return (retval); -} - -unsigned short emu_DebounceLocalKeys(void) -{ - uint16_t bCurState = emu_ReadKeys(); - uint16_t bClick = bCurState & ~bLastState; - bLastState = bCurState; - - return (bClick); -} - -int emu_ReadI2CKeyboard(void) { - int retval=0; -#ifdef PICOMPUTER - if (key_alt) { - keys = (const unsigned short *)key_map3; - } - else if (key_fn) { - keys = (const unsigned short *)key_map2; - } - else { - keys = (const unsigned short *)key_map1; - } - if (keymatrix_hitrow >=0 ) { - unsigned short match = ((unsigned short)keymatrix_hitrow<<8) | keymatrix[keymatrix_hitrow]; - for (int i=0; i=0) { - menuRedraw=true; - curFile -= 9; - } else if (curFile!=0) { - menuRedraw=true; - curFile--; - } - } - else if ( (bClick & MASK_JOY2_DOWN) || (bClick & MASK_JOY1_DOWN) ) { - if ((curFile<(nbFiles-1)) && (nbFiles)) { - curFile++; - menuRedraw=true; - } - } - else if ( (bClick & MASK_JOY2_LEFT) || (bClick & MASK_JOY1_LEFT) ) { - if ((curFile<(nbFiles-9)) && (nbFiles)) { - curFile += 9; - menuRedraw=true; - } - else if ((curFile<(nbFiles-1)) && (nbFiles)) { - curFile++; - menuRedraw=true; - } - } - else if ( (bClick & MASK_KEY_USER2) ) { - emu_SwapJoysticks(0); - menuRedraw=true; - } - - if (menuRedraw && nbFiles) { - int fileIndex = 0; - tft.drawRectNoDma(MENU_FILE_XOFFSET,MENU_FILE_YOFFSET, MENU_FILE_W, MENU_FILE_H, MENU_FILE_BGCOLOR); -// if (curFile <= (MAX_MENULINES/2-1)) topFile=0; -// else topFile=curFile-(MAX_MENULINES/2); - if (curFile <= (MAX_MENULINES-1)) topFile=0; - else topFile=curFile-(MAX_MENULINES/2); - - int i=0; - while (i=nbFiles) { - // no more files - break; - } - char * filename = &files[fileIndex][0]; - if (fileIndex >= topFile) { - if ((i+topFile) < nbFiles ) { - if ((i+topFile)==curFile) { - tft.drawTextNoDma(MENU_FILE_XOFFSET,i*TEXT_HEIGHT+MENU_FILE_YOFFSET, filename, RGBVAL16(0xff,0xff,0x00), RGBVAL16(0xff,0x00,0x00), true); - strcpy(selected_filename,filename); - } - else { - tft.drawTextNoDma(MENU_FILE_XOFFSET,i*TEXT_HEIGHT+MENU_FILE_YOFFSET, filename, RGBVAL16(0xff,0xff,0xff), MENU_FILE_BGCOLOR, true); - } - } - i++; - } - fileIndex++; - } - - - tft.drawTextNoDma(48,MENU_JOYS_YOFFSET+8, (emu_SwapJoysticks(1)?(char*)"SWAP=1":(char*)"SWAP=0"), RGBVAL16(0x00,0xff,0xff), RGBVAL16(0x00,0x00,0xff), false); - menuRedraw=false; - } - - return (action); -} - -bool menuActive(void) -{ - return (menuOn); -} - -void toggleMenu(bool on) { - if (on) { - menuOn = true; - backgroundMenu(); - } else { - menuOn = false; - } -} - -char * menuSelection(void) -{ - return (selection); -} - - -/******************************** - * File IO -********************************/ -int emu_FileOpen(const char * filepath, const char * mode) -{ - int retval = 0; - - emu_printf("FileOpen..."); - emu_printf(filepath); - if( !(f_open(&file, filepath, FA_READ)) ) { - retval = 1; - } - else { - emu_printf("FileOpen failed"); - } - return (retval); -} - -int emu_FileRead(void * buf, int size, int handler) -{ - unsigned int retval=0; - f_read (&file, (void*)buf, size, &retval); - return retval; -} - -int emu_FileGetc(int handler) -{ - unsigned char c; - unsigned int retval=0; - if( !(f_read (&file, &c, 1, &retval)) ) - if (retval != 1) { - emu_printf("emu_FileGetc failed"); - } - return (int)c; -} - -void emu_FileClose(int handler) -{ - f_close(&file); -} - -int emu_FileSeek(int handler, int seek, int origin) -{ - f_lseek(&file, seek); - return (seek); -} - -int emu_FileTell(int handler) -{ - return (f_tell(&file)); -} - - -unsigned int emu_FileSize(const char * filepath) -{ - int filesize=0; - emu_printf("FileSize..."); - emu_printf(filepath); - FILINFO entry; - f_stat(filepath, &entry); - filesize = entry.fsize; - return(filesize); -} - -unsigned int emu_LoadFile(const char * filepath, void * buf, int size) -{ - int filesize = 0; - - emu_printf("LoadFile..."); - emu_printf(filepath); - if( !(f_open(&file, filepath, FA_READ)) ) { - filesize = f_size(&file); - emu_printf(filesize); - if (size >= filesize) - { - unsigned int retval=0; - if( (f_read (&file, buf, filesize, &retval)) ) { - emu_printf("File read failed"); - } - } - f_close(&file); - } - - return(filesize); -} - -static FIL outfile; - -static bool emu_writeConfig(void) -{ - bool retval = false; - if( !(f_open(&outfile, ROMSDIR "/" AUTORUN_FILENAME, FA_CREATE_NEW | FA_WRITE)) ) { - unsigned int sizeread=0; - if( (f_write (&outfile, selection, strlen(selection), &sizeread)) ) { - emu_printf("Config write failed"); - } - else { - retval = true; - } - f_close(&outfile); - } - return retval; -} - -static bool emu_readConfig(void) -{ - bool retval = false; - if( !(f_open(&outfile, ROMSDIR "/" AUTORUN_FILENAME, FA_READ)) ) { - unsigned int filesize = f_size(&outfile); - unsigned int sizeread=0; - if( (f_read (&outfile, selection, filesize, &sizeread)) ) { - emu_printf("Config read failed"); - } - else { - if (sizeread == filesize) { - selection[filesize]=0; - retval = true; - } - } - f_close(&outfile); - } - return retval; -} - -static bool emu_eraseConfig(void) -{ - f_unlink (ROMSDIR "/" AUTORUN_FILENAME); -} - - -/******************************** - * Initialization -********************************/ -void emu_init(void) -{ - // Dual display config, initialize TFT -#if (defined(ILI9341) || defined(ST7789)) && defined(USE_VGA) - tft.begin(); -#endif - - sd_init_driver(); - FRESULT fr = f_mount(&fatfs, "0:", 1); - - strcpy(selection,ROMSDIR); - nbFiles = readNbFiles(selection); - - emu_printf("SD initialized, files found: "); - emu_printi(nbFiles); - - emu_InitJoysticks(); -#ifdef SWAP_JOYSTICK - joySwapped = true; -#else - joySwapped = false; -#endif - - int keypressed = emu_ReadKeys(); -#ifdef PICOMPUTER - // Flip screen if UP pressed - if (keypressed & MASK_JOY2_UP) - { -#ifdef PICOMPUTERMAX -#ifndef USE_VGA - tft.flipscreen(true); -#endif -#else - tft.flipscreen(true); -#endif - } - else - { -#ifdef PICOMPUTERMAX -#ifndef USE_VGA - tft.flipscreen(false); -#endif -#else - tft.flipscreen(false); -#endif - } -#endif - - if (keypressed & MASK_JOY2_DOWN) { - tft.fillScreenNoDma( RGBVAL16(0xff,0x00,0x00) ); - tft.drawTextNoDma(64,48, (char*)" AUTURUN file erased", RGBVAL16(0xff,0xff,0x00), RGBVAL16(0xff,0x00,0x00), true); - tft.drawTextNoDma(64,48+24, (char*)"Please reset the board!", RGBVAL16(0xff,0xff,0x00), RGBVAL16(0xff,0x00,0x00), true); - emu_eraseConfig(); - } - else { - if (emu_readConfig()) { - autorun = true; - } - } - toggleMenu(true); -} - - -void emu_start(void) -{ - usbnavpad = 0; - - keyMap = 0; -} diff --git a/MCUME_pico/picovcs/emucfg.h b/MCUME_pico/picovcs/emucfg.h new file mode 100644 index 0000000..2afc96a --- /dev/null +++ b/MCUME_pico/picovcs/emucfg.h @@ -0,0 +1,94 @@ +#ifndef EMUCFG_H +#define EMUCFG_H + +#define PALETTE_SIZE 256 +#define VID_FRAME_SKIP 0x0 +#define TFT_VBUFFER_YCROP 0 +//#define SINGLELINE_RENDERING 1 +//#define CUSTOM_SND 1 +//#define TIMER_REND 1 +#define EXTRA_HEAP 0x10 +#define FILEBROWSER + +// Title: < > +#define TITLE " Atari2600 Emulator" +#define ROMSDIR "2600" + +#define emu_Init(ROM) {vcs_Init();vcs_Start(ROM);} +#define emu_Step() {vcs_Step();} +#define emu_Input(x) {vcs_Input(x);} + +#ifdef KEYMAP_PRESENT + +#ifdef PICOZX +const unsigned short key_map1[] = { + 1,2,3,4,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0 + }; + +const unsigned short key_map2[] = { + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0 + }; + +const unsigned short key_map3[] = { + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0 + }; + +const unsigned short matkeys[] = { + 0x104,0x101,0x108,0x102,0x110,0x120,0x140,0x204,0x201,0x208, // row 1 + 0x202,0x210,0x220,0x240,0x304,0x301,0x308,0x302,0x310,0x320, // row 2 + 0x340,0x404,0x401,0x408,0x402,0x410,0x420,0x440,0x504,0x501, // row 3 + 0x020,0x508,0x502,0x510,0x520,0x540,0x604,0x601,0x040,0x608, // row 4 + 0x008,0x001,0x002,0x010,0x620,0x640 }; // cursor keys up, left, right, down, <<<, >>> + +#else +#define keylables_map1_0 (char *)"1234 " +#define keylables_map1_1 (char *)" " +#define keylables_map1_2 (char *)" " +const unsigned short key_map1[] = { + 1,2,3,4,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0, + 0, 0,0,0,0,0,0,0,0,0, + 0,0,0,0 + }; + +#define keylables_map2_0 (char *)" " +#define keylables_map2_1 (char *)" " +#define keylables_map2_2 (char *)" " +const unsigned short key_map2[] = { + 0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0, + 0, 0,0,0,0,0,0,0,0,0, + 0,0,0,0 + }; + +#define keylables_map3_0 (char *)" " +#define keylables_map3_1 (char *)" " +#define keylables_map3_2 (char *)" " +const unsigned short key_map3[] = { + 0,0,0,0,0,0,0,0,0,0,0, // function keys + 0, 0,0,0,0,0,0,0,0,0,0, + 0, 0,0,0,0,0,0,0,0,0, + 0,0,0,0 + }; + +const unsigned short matkeys[] = { + 0x020,0x120,0x220,0x320,0x420,0x408,0x308,0x208,0x108,0x008,0x002, // row 1 + 0x510,0x010,0x110,0x210,0x310,0x410,0x401,0x301,0x201,0x101,0x001, // row 2 + 0x520,0x102,0x202,0x302,0x402,0x404,0x304,0x204,0x104,0x004, // row 3 + 0x508,0x501,0x502,0x504 }; // cursor keys +#endif +#endif + +#endif diff --git a/MCUME_pico/picovcs/font8x8.h b/MCUME_pico/picovcs/font8x8.h deleted file mode 100644 index 4f773da..0000000 --- a/MCUME_pico/picovcs/font8x8.h +++ /dev/null @@ -1,135 +0,0 @@ - -// Font: c64_lower.64c - -const unsigned char font8x8[128][8] PROGMEM = -{ - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0000 (nul) - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0001 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0002 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0003 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0004 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0005 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0006 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0007 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0008 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0009 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000A - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000B - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000C - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000D - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000E - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000F - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0010 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0011 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0012 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0013 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0014 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0015 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0016 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0017 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0018 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0019 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001A - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001B - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001C - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001D - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001E - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001F - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0020 (space) - { 0x18, 0x3C, 0x3C, 0x18, 0x18, 0x00, 0x18, 0x00}, // U+0021 (!) - { 0x36, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0022 (") - { 0x36, 0x36, 0x7F, 0x36, 0x7F, 0x36, 0x36, 0x00}, // U+0023 (#) - { 0x0C, 0x3E, 0x03, 0x1E, 0x30, 0x1F, 0x0C, 0x00}, // U+0024 ($) - { 0x00, 0x63, 0x33, 0x18, 0x0C, 0x66, 0x63, 0x00}, // U+0025 (%) - { 0x1C, 0x36, 0x1C, 0x6E, 0x3B, 0x33, 0x6E, 0x00}, // U+0026 (&) - { 0x06, 0x06, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0027 (') - { 0x18, 0x0C, 0x06, 0x06, 0x06, 0x0C, 0x18, 0x00}, // U+0028 (() - { 0x06, 0x0C, 0x18, 0x18, 0x18, 0x0C, 0x06, 0x00}, // U+0029 ()) - { 0x00, 0x66, 0x3C, 0xFF, 0x3C, 0x66, 0x00, 0x00}, // U+002A (*) - { 0x00, 0x0C, 0x0C, 0x3F, 0x0C, 0x0C, 0x00, 0x00}, // U+002B (+) - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x0C, 0x06}, // U+002C (,) - { 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x00}, // U+002D (-) - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x0C, 0x00}, // U+002E (.) - { 0x60, 0x30, 0x18, 0x0C, 0x06, 0x03, 0x01, 0x00}, // U+002F (/) - { 0x3E, 0x63, 0x73, 0x7B, 0x6F, 0x67, 0x3E, 0x00}, // U+0030 (0) - { 0x0C, 0x0E, 0x0C, 0x0C, 0x0C, 0x0C, 0x3F, 0x00}, // U+0031 (1) - { 0x1E, 0x33, 0x30, 0x1C, 0x06, 0x33, 0x3F, 0x00}, // U+0032 (2) - { 0x1E, 0x33, 0x30, 0x1C, 0x30, 0x33, 0x1E, 0x00}, // U+0033 (3) - { 0x38, 0x3C, 0x36, 0x33, 0x7F, 0x30, 0x78, 0x00}, // U+0034 (4) - { 0x3F, 0x03, 0x1F, 0x30, 0x30, 0x33, 0x1E, 0x00}, // U+0035 (5) - { 0x1C, 0x06, 0x03, 0x1F, 0x33, 0x33, 0x1E, 0x00}, // U+0036 (6) - { 0x3F, 0x33, 0x30, 0x18, 0x0C, 0x0C, 0x0C, 0x00}, // U+0037 (7) - { 0x1E, 0x33, 0x33, 0x1E, 0x33, 0x33, 0x1E, 0x00}, // U+0038 (8) - { 0x1E, 0x33, 0x33, 0x3E, 0x30, 0x18, 0x0E, 0x00}, // U+0039 (9) - { 0x00, 0x0C, 0x0C, 0x00, 0x00, 0x0C, 0x0C, 0x00}, // U+003A (:) - { 0x00, 0x0C, 0x0C, 0x00, 0x00, 0x0C, 0x0C, 0x06}, // U+003B (//) - { 0x18, 0x0C, 0x06, 0x03, 0x06, 0x0C, 0x18, 0x00}, // U+003C (<) - { 0x00, 0x00, 0x3F, 0x00, 0x00, 0x3F, 0x00, 0x00}, // U+003D (=) - { 0x06, 0x0C, 0x18, 0x30, 0x18, 0x0C, 0x06, 0x00}, // U+003E (>) - { 0x1E, 0x33, 0x30, 0x18, 0x0C, 0x00, 0x0C, 0x00}, // U+003F (?) - { 0x3E, 0x63, 0x7B, 0x7B, 0x7B, 0x03, 0x1E, 0x00}, // U+0040 (@) - { 0x0C, 0x1E, 0x33, 0x33, 0x3F, 0x33, 0x33, 0x00}, // U+0041 (A) - { 0x3F, 0x66, 0x66, 0x3E, 0x66, 0x66, 0x3F, 0x00}, // U+0042 (B) - { 0x3C, 0x66, 0x03, 0x03, 0x03, 0x66, 0x3C, 0x00}, // U+0043 (C) - { 0x1F, 0x36, 0x66, 0x66, 0x66, 0x36, 0x1F, 0x00}, // U+0044 (D) - { 0x7F, 0x46, 0x16, 0x1E, 0x16, 0x46, 0x7F, 0x00}, // U+0045 (E) - { 0x7F, 0x46, 0x16, 0x1E, 0x16, 0x06, 0x0F, 0x00}, // U+0046 (F) - { 0x3C, 0x66, 0x03, 0x03, 0x73, 0x66, 0x7C, 0x00}, // U+0047 (G) - { 0x33, 0x33, 0x33, 0x3F, 0x33, 0x33, 0x33, 0x00}, // U+0048 (H) - { 0x1E, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+0049 (I) - { 0x78, 0x30, 0x30, 0x30, 0x33, 0x33, 0x1E, 0x00}, // U+004A (J) - { 0x67, 0x66, 0x36, 0x1E, 0x36, 0x66, 0x67, 0x00}, // U+004B (K) - { 0x0F, 0x06, 0x06, 0x06, 0x46, 0x66, 0x7F, 0x00}, // U+004C (L) - { 0x63, 0x77, 0x7F, 0x7F, 0x6B, 0x63, 0x63, 0x00}, // U+004D (M) - { 0x63, 0x67, 0x6F, 0x7B, 0x73, 0x63, 0x63, 0x00}, // U+004E (N) - { 0x1C, 0x36, 0x63, 0x63, 0x63, 0x36, 0x1C, 0x00}, // U+004F (O) - { 0x3F, 0x66, 0x66, 0x3E, 0x06, 0x06, 0x0F, 0x00}, // U+0050 (P) - { 0x1E, 0x33, 0x33, 0x33, 0x3B, 0x1E, 0x38, 0x00}, // U+0051 (Q) - { 0x3F, 0x66, 0x66, 0x3E, 0x36, 0x66, 0x67, 0x00}, // U+0052 (R) - { 0x1E, 0x33, 0x07, 0x0E, 0x38, 0x33, 0x1E, 0x00}, // U+0053 (S) - { 0x3F, 0x2D, 0x0C, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+0054 (T) - { 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x3F, 0x00}, // U+0055 (U) - { 0x33, 0x33, 0x33, 0x33, 0x33, 0x1E, 0x0C, 0x00}, // U+0056 (V) - { 0x63, 0x63, 0x63, 0x6B, 0x7F, 0x77, 0x63, 0x00}, // U+0057 (W) - { 0x63, 0x63, 0x36, 0x1C, 0x1C, 0x36, 0x63, 0x00}, // U+0058 (X) - { 0x33, 0x33, 0x33, 0x1E, 0x0C, 0x0C, 0x1E, 0x00}, // U+0059 (Y) - { 0x7F, 0x63, 0x31, 0x18, 0x4C, 0x66, 0x7F, 0x00}, // U+005A (Z) - { 0x1E, 0x06, 0x06, 0x06, 0x06, 0x06, 0x1E, 0x00}, // U+005B ([) - { 0x03, 0x06, 0x0C, 0x18, 0x30, 0x60, 0x40, 0x00}, // U+005C (\) - { 0x1E, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1E, 0x00}, // U+005D (]) - { 0x08, 0x1C, 0x36, 0x63, 0x00, 0x00, 0x00, 0x00}, // U+005E (^) - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF}, // U+005F (_) - { 0x0C, 0x0C, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0060 (`) - { 0x00, 0x00, 0x1E, 0x30, 0x3E, 0x33, 0x6E, 0x00}, // U+0061 (a) - { 0x07, 0x06, 0x06, 0x3E, 0x66, 0x66, 0x3B, 0x00}, // U+0062 (b) - { 0x00, 0x00, 0x1E, 0x33, 0x03, 0x33, 0x1E, 0x00}, // U+0063 (c) - { 0x38, 0x30, 0x30, 0x3e, 0x33, 0x33, 0x6E, 0x00}, // U+0064 (d) - { 0x00, 0x00, 0x1E, 0x33, 0x3f, 0x03, 0x1E, 0x00}, // U+0065 (e) - { 0x1C, 0x36, 0x06, 0x0f, 0x06, 0x06, 0x0F, 0x00}, // U+0066 (f) - { 0x00, 0x00, 0x6E, 0x33, 0x33, 0x3E, 0x30, 0x1F}, // U+0067 (g) - { 0x07, 0x06, 0x36, 0x6E, 0x66, 0x66, 0x67, 0x00}, // U+0068 (h) - { 0x0C, 0x00, 0x0E, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+0069 (i) - { 0x30, 0x00, 0x30, 0x30, 0x30, 0x33, 0x33, 0x1E}, // U+006A (j) - { 0x07, 0x06, 0x66, 0x36, 0x1E, 0x36, 0x67, 0x00}, // U+006B (k) - { 0x0E, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+006C (l) - { 0x00, 0x00, 0x33, 0x7F, 0x7F, 0x6B, 0x63, 0x00}, // U+006D (m) - { 0x00, 0x00, 0x1F, 0x33, 0x33, 0x33, 0x33, 0x00}, // U+006E (n) - { 0x00, 0x00, 0x1E, 0x33, 0x33, 0x33, 0x1E, 0x00}, // U+006F (o) - { 0x00, 0x00, 0x3B, 0x66, 0x66, 0x3E, 0x06, 0x0F}, // U+0070 (p) - { 0x00, 0x00, 0x6E, 0x33, 0x33, 0x3E, 0x30, 0x78}, // U+0071 (q) - { 0x00, 0x00, 0x3B, 0x6E, 0x66, 0x06, 0x0F, 0x00}, // U+0072 (r) - { 0x00, 0x00, 0x3E, 0x03, 0x1E, 0x30, 0x1F, 0x00}, // U+0073 (s) - { 0x08, 0x0C, 0x3E, 0x0C, 0x0C, 0x2C, 0x18, 0x00}, // U+0074 (t) - { 0x00, 0x00, 0x33, 0x33, 0x33, 0x33, 0x6E, 0x00}, // U+0075 (u) - { 0x00, 0x00, 0x33, 0x33, 0x33, 0x1E, 0x0C, 0x00}, // U+0076 (v) - { 0x00, 0x00, 0x63, 0x6B, 0x7F, 0x7F, 0x36, 0x00}, // U+0077 (w) - { 0x00, 0x00, 0x63, 0x36, 0x1C, 0x36, 0x63, 0x00}, // U+0078 (x) - { 0x00, 0x00, 0x33, 0x33, 0x33, 0x3E, 0x30, 0x1F}, // U+0079 (y) - { 0x00, 0x00, 0x3F, 0x19, 0x0C, 0x26, 0x3F, 0x00}, // U+007A (z) - { 0x38, 0x0C, 0x0C, 0x07, 0x0C, 0x0C, 0x38, 0x00}, // U+007B ({) - { 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x00}, // U+007C (|) - { 0x07, 0x0C, 0x0C, 0x38, 0x0C, 0x0C, 0x07, 0x00}, // U+007D (}) - { 0x6E, 0x3B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+007E (~) - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} // U+007F -}; - diff --git a/MCUME_pico/picovcs/picovcs.cpp b/MCUME_pico/picovcs/picovcs.cpp index fedd181..3c8eb66 100644 --- a/MCUME_pico/picovcs/picovcs.cpp +++ b/MCUME_pico/picovcs/picovcs.cpp @@ -11,12 +11,8 @@ extern "C" { #include "Vcsemu.h" } #include +#include "pico_dsp.h" -#ifdef USE_VGA -#include "vga_t_dma.h" -#else -#include "tft_t_dma.h" -#endif volatile bool vbl=true; bool repeating_timer_callback(struct repeating_timer *t) { @@ -27,8 +23,8 @@ bool repeating_timer_callback(struct repeating_timer *t) { } return true; } -TFT_T_DMA tft; +PICO_DSP tft; static int skip=0; #include "hardware/clocks.h" @@ -40,119 +36,90 @@ int main(void) { // set_sys_clock_khz(150000, true); // set_sys_clock_khz(133000, true); set_sys_clock_khz(200000, true); +// set_sys_clock_khz(210000, true); +// set_sys_clock_khz(230000, true); // set_sys_clock_khz(225000, true); -// set_sys_clock_khz(240000, true); // set_sys_clock_khz(250000, true); stdio_init_all(); -#ifdef USE_VGA -// tft.begin(VGA_MODE_400x240); - tft.begin(VGA_MODE_320x240); -#else - tft.begin(); -#endif + emu_init(); - while (true) { + char * filename; +#ifdef FILEBROWSER + while (true) { if (menuActive()) { uint16_t bClick = emu_DebounceLocalKeys(); int action = handleMenu(bClick); - char * filename = menuSelection(); - if (action == ACTION_RUNTFT) { - toggleMenu(false); - emu_start(); - emu_Init(filename); - tft.fillScreenNoDma( RGBVAL16(0x00,0x00,0x00) ); - tft.startDMA(); - struct repeating_timer timer; - add_repeating_timer_ms(15, repeating_timer_callback, NULL, &timer); - } + filename = menuSelection(); + if (action == ACTION_RUN) { + break; + } tft.waitSync(); } - else { - uint16_t bClick = emu_DebounceLocalKeys(); - emu_Input(bClick); - emu_Step(); - } - //int c = getchar_timeout_us(0); - //switch (c) { - // case ' ': - // printf("test: %d\n", 1); - // break; - //} + } +#endif + emu_start(); + emu_Init(filename); + tft.startRefresh(); + struct repeating_timer timer; + add_repeating_timer_ms(15, repeating_timer_callback, NULL, &timer); + while (true) { + uint16_t bClick = emu_DebounceLocalKeys(); + emu_Input(bClick); + emu_Step(); } } -static unsigned char palette8[PALETTE_SIZE]; -static unsigned short palette16[PALETTE_SIZE]; +static unsigned short palette16[PALETTE_SIZE]; void emu_SetPaletteEntry(unsigned char r, unsigned char g, unsigned char b, int index) { if (index>8)&0xf8) -#define G16(rgb) ((rgb>>3)&0xfc) -#define B16(rgb) ((rgb<<3)&0xf8) - -// 8 bits 320x240 frame buffer => 64K -static vga_pixel * visible_framebuffer = NULL; -static vga_pixel * framebuffer = NULL; -static vga_pixel * fb0 = NULL; -static vga_pixel * fb1 = NULL; - -static int fb_width; -static int fb_height; -static int fb_stride; - - -PolyDef PolySet; // will contain a polygon data - -static const sVmode* vmode=NULL; -static const sVmode* volatile VgaVmodeReq = NULL; // request to reinitialize videomode, 1=only stop driver - - -static semaphore_t core1_initted; -static void core1_func(); - -#define RGBVAL16(r,g,b) ( (((b>>3)&0x1f)<<11) | (((g>>2)&0x3f)<<5) | (((r>>3)&0x1f)<<0) ) - -static void core1_sio_irq(); - -static void VgaInitReql(const sVmode* vmode) -{ - if (vmode == NULL) vmode = (const sVmode*)1; - __dmb(); - VgaVmodeReq = vmode; - while (VgaVmodeReq != NULL) { __dmb(); } -} - -static void core1_func() -{ - const sVmode* v; - - multicore_fifo_clear_irq(); - irq_set_exclusive_handler(SIO_IRQ_PROC1,core1_sio_irq); - //irq_set_priority (SIO_IRQ_PROC1, 129); - irq_set_enabled(SIO_IRQ_PROC1,true); - - sem_release(&core1_initted); - - while (true) - { - __dmb(); - - // initialize videomode - v = VgaVmodeReq; - if (v != NULL) - { - if ((u32)v == (u32)1) { - //VgaTerm(); // terminate - } - else - VgaInit(v,(u8*)framebuffer,320,240,320); - __dmb(); - VgaVmodeReq = NULL; - } - } - - /* - v = VgaVmodeReq; - VgaInit(v); - - while (true) { - tight_loop_contents(); - } - */ -} - -VGA_T4::VGA_T4() -{ -} - -void VGA_T4::tweak_video(int shiftdelta, int numdelta, int denomdelta) -{ -} - -// display VGA image -vga_error_t VGA_T4::begin(vga_mode_t mode) -{ - switch(mode) { - case VGA_MODE_320x240: - fb_width = 320; - fb_height = 240; - fb_stride = fb_width; - break; - case VGA_MODE_352x240: - break; - case VGA_MODE_400x240: - break; - } - - /* initialize gfx buffer */ - if (fb0 == NULL) { - void *mallocpt = malloc(fb_stride*fb_height*sizeof(vga_pixel)+4); - fb0 = (vga_pixel *)((void*)((intptr_t)mallocpt & ~3)); - } - - visible_framebuffer = fb0; - framebuffer = fb0; - for (uint i = 0; i < fb_height*fb_width; i++) { - framebuffer[i] = VGA_RGB(rand() % 255,rand() % 255,rand() % 255); - } - - // create a semaphore to be posted when audio init is complete - sem_init(&core1_initted, 0, 1); - - multicore_launch_core1(core1_func); - vmode = Video(DEV_VGA, RES_QVGA); - VgaInitReql(vmode); - - // wait for initialization of audio to be complete - sem_acquire_blocking(&core1_initted); - - return(VGA_OK); -} - -void VGA_T4::end() -{ -} - -void VGA_T4::debug() -{ -} - -// retrieve size of the frame buffer -int VGA_T4::get_frame_buffer_size(int *width, int *height) -{ - if (width != nullptr) *width = fb_width; - if (height != nullptr) *height = fb_height; - return fb_stride; -} - -void VGA_T4::waitSync() -{ - WaitVSync(); -} - -void VGA_T4::waitLine(int line) -{ -// while (currentLine != line) {}; -} - -void VGA_T4::clear(vga_pixel color) { - int i,j; - for (j=0; j=0) && (x<=fb_width) && (y>=0) && (y<=fb_height)) - framebuffer[y*fb_stride+x] = color; -} - -vga_pixel VGA_T4::getPixel(int x, int y){ - return(framebuffer[y*fb_stride+x]); -} - -vga_pixel * VGA_T4::getLineBuffer(int j) { - return (&framebuffer[j*fb_stride]); -} - -void VGA_T4::drawRect(int16_t x, int16_t y, int16_t w, int16_t h, vga_pixel color) { - int i,j,l=y; - for (j=0; j> 1; - if (bits&0x01) *dst++=fgcolor; - else *dst++=bgcolor; - bits = bits >> 1; - if (bits&0x01) *dst++=fgcolor; - else *dst++=bgcolor; - bits = bits >> 1; - if (bits&0x01) *dst++=fgcolor; - else *dst++=bgcolor; - bits = bits >> 1; - if (bits&0x01) *dst++=fgcolor; - else *dst++=bgcolor; - bits = bits >> 1; - if (bits&0x01) *dst++=fgcolor; - else *dst++=bgcolor; - bits = bits >> 1; - if (bits&0x01) *dst++=fgcolor; - else *dst++=bgcolor; - bits = bits >> 1; - if (bits&0x01) *dst++=fgcolor; - else *dst++=bgcolor; - l++; - } - dst=&framebuffer[l*fb_stride+x]; - bits = *charpt++; - if (bits&0x01) *dst++=fgcolor; - else *dst++=bgcolor; - bits = bits >> 1; - if (bits&0x01) *dst++=fgcolor; - else *dst++=bgcolor; - bits = bits >> 1; - if (bits&0x01) *dst++=fgcolor; - else *dst++=bgcolor; - bits = bits >> 1; - if (bits&0x01) *dst++=fgcolor; - else *dst++=bgcolor; - bits = bits >> 1; - if (bits&0x01) *dst++=fgcolor; - else *dst++=bgcolor; - bits = bits >> 1; - if (bits&0x01) *dst++=fgcolor; - else *dst++=bgcolor; - bits = bits >> 1; - if (bits&0x01) *dst++=fgcolor; - else *dst++=bgcolor; - bits = bits >> 1; - if (bits&0x01) *dst++=fgcolor; - else *dst++=bgcolor; - l++; - } - x +=8; - } -} - -void VGA_T4::drawSprite(int16_t x, int16_t y, const int16_t *bitmap) { - drawSprite(x,y,bitmap, 0,0,0,0); -} - -void VGA_T4::drawSprite(int16_t x, int16_t y, const int16_t *bitmap, uint16_t arx, uint16_t ary, uint16_t arw, uint16_t arh) -{ - int bmp_offx = 0; - int bmp_offy = 0; - int16_t *bmp_ptr; - - int w =*bitmap++; - int h = *bitmap++; - - - if ( (arw == 0) || (arh == 0) ) { - // no crop window - arx = x; - ary = y; - arw = w; - arh = h; - } - else { - if ( (x>(arx+arw)) || ((x+w)(ary+arh)) || ((y+h) arx) && (x<(arx+arw)) ) { - arw = arw - (x-arx); - arx = arx + (x-arx); - } else { - bmp_offx = arx; - } - if ( ((x+w) > arx) && ((x+w)<(arx+arw)) ) { - arw -= (arx+arw-x-w); - } - if ( (y > ary) && (y<(ary+arh)) ) { - arh = arh - (y-ary); - ary = ary + (y-ary); - } else { - bmp_offy = ary; - } - if ( ((y+h) > ary) && ((y+h)<(ary+arh)) ) { - arh -= (ary+arh-y-h); - } - } - - - int l=ary; - bitmap = bitmap + bmp_offy*w + bmp_offx; - for (int row=0;row 2) ) y += (fb_height-height)/2; - vga_pixel * dst=&framebuffer[y*fb_stride]; - if (width > fb_width) { -#ifdef TFT_LINEARINT - int delta = (width/(width-fb_width))-1; - int pos = delta; - for (int i=0; i> 8]]; - pos +=step; - } -#endif - } - else if ((width*2) == fb_width) { - for (int i=0; i 2) ) y += (fb_height-height)/2; - uint8_t * dst=&framebuffer[y*fb_stride]; - if (width > fb_width) { - int step = ((width << 8)/fb_width); - int pos = 0; - for (int i=0; i> 8]; - pos +=step; - } - } - else if ((width*2) == fb_width) { - for (int i=0; i 2) ) y += (fb_height-height)/2; - uint8_t * dst=&framebuffer[y*fb_stride]; - if (width > fb_width) { - int step = ((width << 8)/fb_width); - int pos = 0; - for (int i=0; i> 8]; - *dst++ = VGA_RGB(R16(pix),G16(pix),B16(pix)); - pos +=step; - } - } - else if ((width*2) == fb_width) { - for (int i=0; i 2) ) { - ysrc += (fb_height-height)/2; - ydst += (fb_height-height)/2; - } - uint8_t * src=&framebuffer[ysrc*fb_stride]; - uint8_t * dst=&framebuffer[ydst*fb_stride]; - memcpy(dst,src,width); -} - - -//-------------------------------------------------------------- -// Draw a line between 2 points -// x1,y1 : 1st point -// x2,y2 : 2nd point -// Color : 16bits color -//-------------------------------------------------------------- -void VGA_T4::drawline(int16_t x1, int16_t y1, int16_t x2, int16_t y2, vga_pixel color){ - uint8_t yLonger = 0; - int incrementVal, endVal; - int shortLen = y2-y1; - int longLen = x2-x1; - int decInc; - int j = 0, i = 0; - - if(ABS(shortLen) > ABS(longLen)) { - int swap = shortLen; - shortLen = longLen; - longLen = swap; - yLonger = 1; - } - - endVal = longLen; - - if(longLen < 0) { - incrementVal = -1; - longLen = -longLen; - endVal--; - } else { - incrementVal = 1; - endVal++; - } - - if(longLen == 0) - decInc = 0; - else - decInc = (shortLen << 16) / longLen; - - if(yLonger) { - for(i = 0;i != endVal;i += incrementVal) { - drawPixel(x1 + (j >> 16),y1 + i,color); - j += decInc; - } - } else { - for(i = 0;i != endVal;i += incrementVal) { - drawPixel(x1 + i,y1 + (j >> 16),color); - j += decInc; - } - } -} - -//-------------------------------------------------------------- -// Draw a horizontal line -// x1,y1 : starting point -// lenght : lenght in pixels -// color : 16bits color -//-------------------------------------------------------------- -void VGA_T4::draw_h_line(int16_t x, int16_t y, int16_t lenght, vga_pixel color){ - drawline(x , y , x + lenght , y , color); -} - -//-------------------------------------------------------------- -// Draw a vertical line -// x1,y1 : starting point -// lenght : lenght in pixels -// color : 16bits color -//-------------------------------------------------------------- -void VGA_T4::draw_v_line(int16_t x, int16_t y, int16_t lenght, vga_pixel color){ - drawline(x , y , x , y + lenght , color); -} - -//-------------------------------------------------------------- -// Draw a circle. -// x, y - center of circle. -// r - radius. -// color - color of the circle. -//-------------------------------------------------------------- -void VGA_T4::drawcircle(int16_t x, int16_t y, int16_t radius, vga_pixel color){ - int16_t a, b, P; - - a = 0; - b = radius; - P = 1 - radius; - - do { - drawPixel(a+x, b+y, color); - drawPixel(b+x, a+y, color); - drawPixel(x-a, b+y, color); - drawPixel(x-b, a+y, color); - drawPixel(b+x, y-a, color); - drawPixel(a+x, y-b, color); - drawPixel(x-a, y-b, color); - drawPixel(x-b, y-a, color); - - if(P < 0) - P+= 3 + 2*a++; - else - P+= 5 + 2*(a++ - b--); - } while(a <= b); -} - -//-------------------------------------------------------------- -// Displays a full circle. -// x : specifies the X position -// y : specifies the Y position -// radius : specifies the Circle Radius -// fillcolor : specifies the Circle Fill Color -// bordercolor: specifies the Circle Border Color -//-------------------------------------------------------------- -void VGA_T4::drawfilledcircle(int16_t x, int16_t y, int16_t radius, vga_pixel fillcolor, vga_pixel bordercolor){ - int32_t D; /* Decision Variable */ - uint32_t CurX;/* Current X Value */ - uint32_t CurY;/* Current Y Value */ - - D = 3 - (radius << 1); - - CurX = 0; - CurY = radius; - - while (CurX <= CurY) - { - if(CurY > 0) - { - draw_v_line(x - CurX, y - CurY, 2*CurY, fillcolor); - draw_v_line(x + CurX, y - CurY, 2*CurY, fillcolor); - } - - if(CurX > 0) - { - draw_v_line(x - CurY, y - CurX, 2*CurX, fillcolor); - draw_v_line(x + CurY, y - CurX, 2*CurX, fillcolor); - } - if (D < 0) - { - D += (CurX << 2) + 6; - } - else - { - D += ((CurX - CurY) << 2) + 10; - CurY--; - } - CurX++; - } - - drawcircle(x, y, radius,bordercolor); -} - -//-------------------------------------------------------------- -// Displays an Ellipse. -// cx: specifies the X position -// cy: specifies the Y position -// radius1: minor radius of ellipse. -// radius2: major radius of ellipse. -// color: specifies the Color to use for draw the Border from the Ellipse. -//-------------------------------------------------------------- -void VGA_T4::drawellipse(int16_t cx, int16_t cy, int16_t radius1, int16_t radius2, vga_pixel color){ - int x = -radius1, y = 0, err = 2-2*radius1, e2; - float K = 0, rad1 = 0, rad2 = 0; - - rad1 = radius1; - rad2 = radius2; - - if (radius1 > radius2) - { - do { - K = (float)(rad1/rad2); - drawPixel(cx-x,cy+(uint16_t)(y/K),color); - drawPixel(cx+x,cy+(uint16_t)(y/K),color); - drawPixel(cx+x,cy-(uint16_t)(y/K),color); - drawPixel(cx-x,cy-(uint16_t)(y/K),color); - - e2 = err; - if (e2 <= y) { - err += ++y*2+1; - if (-x == y && e2 <= x) e2 = 0; - } - if (e2 > x) err += ++x*2+1; - } - while (x <= 0); - } - else - { - y = -radius2; - x = 0; - do { - K = (float)(rad2/rad1); - drawPixel(cx-(uint16_t)(x/K),cy+y,color); - drawPixel(cx+(uint16_t)(x/K),cy+y,color); - drawPixel(cx+(uint16_t)(x/K),cy-y,color); - drawPixel(cx-(uint16_t)(x/K),cy-y,color); - - e2 = err; - if (e2 <= x) { - err += ++x*2+1; - if (-y == x && e2 <= y) e2 = 0; - } - if (e2 > y) err += ++y*2+1; - } - while (y <= 0); - } -} - -// Draw a filled ellipse. -// cx: specifies the X position -// cy: specifies the Y position -// radius1: minor radius of ellipse. -// radius2: major radius of ellipse. -// fillcolor : specifies the Color to use for Fill the Ellipse. -// bordercolor: specifies the Color to use for draw the Border from the Ellipse. -void VGA_T4::drawfilledellipse(int16_t cx, int16_t cy, int16_t radius1, int16_t radius2, vga_pixel fillcolor, vga_pixel bordercolor){ - int x = -radius1, y = 0, err = 2-2*radius1, e2; - float K = 0, rad1 = 0, rad2 = 0; - - rad1 = radius1; - rad2 = radius2; - - if (radius1 > radius2) - { - do - { - K = (float)(rad1/rad2); - draw_v_line((cx+x), (cy-(uint16_t)(y/K)), (2*(uint16_t)(y/K) + 1) , fillcolor); - draw_v_line((cx-x), (cy-(uint16_t)(y/K)), (2*(uint16_t)(y/K) + 1) , fillcolor); - - e2 = err; - if (e2 <= y) - { - err += ++y*2+1; - if (-x == y && e2 <= x) e2 = 0; - } - if (e2 > x) err += ++x*2+1; - - } - while (x <= 0); - } - else - { - y = -radius2; - x = 0; - do - { - K = (float)(rad2/rad1); - draw_h_line((cx-(uint16_t)(x/K)), (cy+y), (2*(uint16_t)(x/K) + 1) , fillcolor); - draw_h_line((cx-(uint16_t)(x/K)), (cy-y), (2*(uint16_t)(x/K) + 1) , fillcolor); - - e2 = err; - if (e2 <= x) - { - err += ++x*2+1; - if (-y == x && e2 <= y) e2 = 0; - } - if (e2 > y) err += ++y*2+1; - } - while (y <= 0); - } - drawellipse(cx,cy,radius1,radius2,bordercolor); -} - -//-------------------------------------------------------------- -// Draw a Triangle. -// ax,ay, bx,by, cx,cy - the triangle points. -// color - color of the triangle. -//-------------------------------------------------------------- -void VGA_T4::drawtriangle(int16_t ax, int16_t ay, int16_t bx, int16_t by, int16_t cx, int16_t cy, vga_pixel color){ - drawline(ax , ay , bx , by , color); - drawline(bx , by , cx , cy , color); - drawline(cx , cy , ax , ay , color); -} - -//-------------------------------------------------------------- -// Draw a Filled Triangle. -// ax,ay, bx,by, cx,cy - the triangle points. -// fillcolor - specifies the Color to use for Fill the triangle. -// bordercolor - specifies the Color to use for draw the Border from the triangle. -//-------------------------------------------------------------- -void VGA_T4::drawfilledtriangle(int16_t ax, int16_t ay, int16_t bx, int16_t by, int16_t cx, int16_t cy, vga_pixel fillcolor, vga_pixel bordercolor){ - float ma, mb, mc ; //'gradient of the lines - float start, finish ; //'draw a line from start to finish! - float tempspace ; //'temporary storage for swapping values... - double x1,x2,x3 ; - double y1,y2,y3 ; - int16_t n ; - - //' need to sort out ay, by and cy into order.. highest to lowest - //' - if(ay < by) - { - //'swap x's - tempspace = ax; - ax = bx; - bx = tempspace; - - //'swap y's - tempspace = ay; - ay = by; - by = tempspace; - } - - if(ay < cy) - { - //'swap x's - tempspace = ax; - ax = cx; - cx = tempspace; - - //'swap y's - tempspace = ay; - ay = cy; - cy = tempspace; - } - - if(by < cy) - { - //'swap x's - tempspace = bx; - bx = cx; - cx = tempspace; - - //'swap y's - tempspace = by; - by = cy; - cy = tempspace; - } - - //' Finally - copy the values in order... - - x1 = ax; x2 = bx; x3 = cx; - y1 = ay; y2 = by; y3 = cy; - - //'bodge if y coordinates are the same - if(y1 == y2) y2 = y2 + 0.01; - if(y2 == y3) y3 = y3 + 0.01; - if(y1 == y3) y3 = y3 + 0.01; - - ma = (x1 - x2) / (y1 - y2); - mb = (x3 - x2) / (y2 - y3); - mc = (x3 - x1) / (y1 - y3); - - //'from y1 to y2 - for(n = 0;n >= (y2 - y1);n--) - { - start = n * mc; - finish = n * ma; - drawline((int16_t)(x1 - start), (int16_t)(n + y1), (int16_t)(x1 + finish), (int16_t)(n + y1), fillcolor); - } - - - //'and from y2 to y3 - - for(n = 0;n >= (y3 - y2);n--) - { - start = n * mc; - finish = n * mb; - drawline((int16_t)(x1 - start - ((y2 - y1) * mc)), (int16_t)(n + y2), (int16_t)(x2 - finish), (int16_t)(n + y2), fillcolor); - } - - // draw the border color triangle - drawtriangle(ax,ay,bx,by,cx,cy,bordercolor); -} - - -//-------------------------------------------------------------- -// Displays a Rectangle at a given Angle. -// centerx : specifies the center of the Rectangle. -// centery -// w,h : specifies the size of the Rectangle. -// angle : specifies the angle for drawing the rectangle -// color : specifies the Color to use for Fill the Rectangle. -//-------------------------------------------------------------- -void VGA_T4::drawquad(int16_t centerx, int16_t centery, int16_t w, int16_t h, int16_t angle, vga_pixel color){ - int16_t px[4],py[4]; - float l; - float raddeg = 3.14159 / 180; - float w2 = w / 2.0; - float h2 = h / 2.0; - float vec = (w2*w2)+(h2*h2); - float w2l; - float pangle[4]; - - l = sqrtf(vec); - w2l = w2 / l; - pangle[0] = acosf(w2l) / raddeg; - pangle[1] = 180.0 - (acosf(w2l) / raddeg); - pangle[2] = 180.0 + (acosf(w2l) / raddeg); - pangle[3] = 360.0 - (acosf(w2l) / raddeg); - px[0] = (int16_t)(calcco[((int16_t)(pangle[0]) + angle) % 360] * l + centerx); - py[0] = (int16_t)(calcsi[((int16_t)(pangle[0]) + angle) % 360] * l + centery); - px[1] = (int16_t)(calcco[((int16_t)(pangle[1]) + angle) % 360] * l + centerx); - py[1] = (int16_t)(calcsi[((int16_t)(pangle[1]) + angle) % 360] * l + centery); - px[2] = (int16_t)(calcco[((int16_t)(pangle[2]) + angle) % 360] * l + centerx); - py[2] = (int16_t)(calcsi[((int16_t)(pangle[2]) + angle) % 360] * l + centery); - px[3] = (int16_t)(calcco[((int16_t)(pangle[3]) + angle) % 360] * l + centerx); - py[3] = (int16_t)(calcsi[((int16_t)(pangle[3]) + angle) % 360] * l + centery); - // here we draw the quad - drawline(px[0],py[0],px[1],py[1],color); - drawline(px[1],py[1],px[2],py[2],color); - drawline(px[2],py[2],px[3],py[3],color); - drawline(px[3],py[3],px[0],py[0],color); -} - -//-------------------------------------------------------------- -// Displays a filled Rectangle at a given Angle. -// centerx : specifies the center of the Rectangle. -// centery -// w,h : specifies the size of the Rectangle. -// angle : specifies the angle for drawing the rectangle -// fillcolor : specifies the Color to use for Fill the Rectangle. -// bordercolor : specifies the Color to use for draw the Border from the Rectangle. -//-------------------------------------------------------------- -void VGA_T4::drawfilledquad(int16_t centerx, int16_t centery, int16_t w, int16_t h, int16_t angle, vga_pixel fillcolor, vga_pixel bordercolor){ - int16_t px[4],py[4]; - float l; - float raddeg = 3.14159 / 180; - float w2 = w / 2.0; - float h2 = h / 2.0; - float vec = (w2*w2)+(h2*h2); - float w2l; - float pangle[4]; - - l = sqrtf(vec); - w2l = w2 / l; - pangle[0] = acosf(w2l) / raddeg; - pangle[1] = 180.0 - (acosf(w2l) / raddeg); - pangle[2] = 180.0 + (acosf(w2l) / raddeg); - pangle[3] = 360.0 - (acosf(w2l) / raddeg); - px[0] = (int16_t)(calcco[((int16_t)(pangle[0]) + angle) % 360] * l + centerx); - py[0] = (int16_t)(calcsi[((int16_t)(pangle[0]) + angle) % 360] * l + centery); - px[1] = (int16_t)(calcco[((int16_t)(pangle[1]) + angle) % 360] * l + centerx); - py[1] = (int16_t)(calcsi[((int16_t)(pangle[1]) + angle) % 360] * l + centery); - px[2] = (int16_t)(calcco[((int16_t)(pangle[2]) + angle) % 360] * l + centerx); - py[2] = (int16_t)(calcsi[((int16_t)(pangle[2]) + angle) % 360] * l + centery); - px[3] = (int16_t)(calcco[((int16_t)(pangle[3]) + angle) % 360] * l + centerx); - py[3] = (int16_t)(calcsi[((int16_t)(pangle[3]) + angle) % 360] * l + centery); - // We draw 2 filled triangle for made the quad - // To be uniform we have to use only the Fillcolor - drawfilledtriangle(px[0],py[0],px[1],py[1],px[2],py[2],fillcolor,fillcolor); - drawfilledtriangle(px[2],py[2],px[3],py[3],px[0],py[0],fillcolor,fillcolor); - // here we draw the BorderColor from the quad - drawline(px[0],py[0],px[1],py[1],bordercolor); - drawline(px[1],py[1],px[2],py[2],bordercolor); - drawline(px[2],py[2],px[3],py[3],bordercolor); - drawline(px[3],py[3],px[0],py[0],bordercolor); -} - -//-------------------------------------------------------------- -// Displays a Polygon. -// centerx : are specified with PolySet.Center.x and y. -// centery -// cx : Translate the polygon in x direction -// cy : Translate the polygon in y direction -// bordercolor : specifies the Color to use for draw the Border from the polygon. -// polygon points : are specified with PolySet.Pts[n].x and y -// After the last polygon point , set PolySet.Pts[n + 1].x to 10000 -// Max number of point for the polygon is set by MaxPolyPoint previously defined. -//-------------------------------------------------------------- -void VGA_T4::drawpolygon(int16_t cx, int16_t cy, vga_pixel bordercolor){ - uint8_t n = 1; - while((PolySet.Pts[n].x < 10000) && (n < MaxPolyPoint)){ - drawline(PolySet.Pts[n].x + cx, - PolySet.Pts[n].y + cy, - PolySet.Pts[n - 1].x + cx , - PolySet.Pts[n - 1].y + cy, - bordercolor); - n++; - } - // close the polygon - drawline(PolySet.Pts[0].x + cx, - PolySet.Pts[0].y + cy, - PolySet.Pts[n - 1].x + cx, - PolySet.Pts[n - 1].y + cy, - bordercolor); -} - -//-------------------------------------------------------------- -// Displays a filled Polygon. -// centerx : are specified with PolySet.Center.x and y. -// centery -// cx : Translate the polygon in x direction -// cy : Translate the polygon in y direction -// fillcolor : specifies the Color to use for filling the polygon. -// bordercolor : specifies the Color to use for draw the Border from the polygon. -// polygon points : are specified with PolySet.Pts[n].x and y -// After the last polygon point , set PolySet.Pts[n + 1].x to 10000 -// Max number of point for the polygon is set by MaxPolyPoint previously defined. -//-------------------------------------------------------------- -void VGA_T4::drawfullpolygon(int16_t cx, int16_t cy, vga_pixel fillcolor, vga_pixel bordercolor){ - int n,i,j,k,dy,dx; - int y,temp; - int a[MaxPolyPoint][2],xi[MaxPolyPoint]; - float slope[MaxPolyPoint]; - - n = 0; - - while((PolySet.Pts[n].x < 10000) && (n < MaxPolyPoint)){ - a[n][0] = PolySet.Pts[n].x; - a[n][1] = PolySet.Pts[n].y; - n++; - } - - a[n][0]=PolySet.Pts[0].x; - a[n][1]=PolySet.Pts[0].y; - - for(i=0;iy))|| - ((a[i][1]>y)&&(a[i+1][1]<=y))) - { - xi[k]=(int)(a[i][0]+slope[i]*(y-a[i][1])); - k++; - } - } - - for(j=0;jxi[i+1]) - { - temp=xi[i]; - xi[i]=xi[i+1]; - xi[i+1]=temp; - } - } - - for(i=0;i= (fb_width-hscr_mask)) return; - if ((y + SPRITES_H) <= 0) return; - if (y >= fb_height) return; - - vga_pixel * src=&spritesbuffer[index*SPRITES_W*SPRITES_H]; - int i,j; - vga_pixel pix; - for (j=0; j (fb_width-hscr_mask)) || ((y+j) < 0) || ((y+j) >= fb_height) ) dst++; - else *dst++ = pix; - } - } -} - - -static void drawTile(unsigned char tile, int x, int y) { - vga_pixel * src=&tilesbuffer[tile*TILES_W*TILES_H]; - int i,j; - for (j=0; j (fb_width-hscr_mask)) *dst++=0; - else - *dst++ = pix; - } - } -} - -static void drawTransTile(unsigned char tile, int x, int y) { - vga_pixel * src=&tilesbuffer[tile*TILES_W*TILES_H]; - vga_pixel pix; - int i,j; - for (j=0; j (fb_width-hscr_mask)) src++; - else - if ((pix=*src++)) *dst++ = pix; - else *dst++; - } - } -} - - - -static void tileText(unsigned char index, int16_t x, int16_t y, const char * text, vga_pixel fgcolor, vga_pixel bgcolor, vga_pixel *dstbuffer, int dstwidth, int dstheight) { - vga_pixel c; - vga_pixel * dst; - - while ((c = *text++)) { - const unsigned char * charpt=&font8x8[c][0]; - int l=y; - for (int i=0;i<8;i++) - { - unsigned char bits; - dst=&dstbuffer[(index*dstheight+l)*dstwidth+x]; - bits = *charpt++; - if (bits&0x01) *dst++=fgcolor; - else *dst++=bgcolor; - bits = bits >> 1; - if (bits&0x01) *dst++=fgcolor; - else *dst++=bgcolor; - bits = bits >> 1; - if (bits&0x01) *dst++=fgcolor; - else *dst++=bgcolor; - bits = bits >> 1; - if (bits&0x01) *dst++=fgcolor; - else *dst++=bgcolor; - bits = bits >> 1; - if (bits&0x01) *dst++=fgcolor; - else *dst++=bgcolor; - bits = bits >> 1; - if (bits&0x01) *dst++=fgcolor; - else *dst++=bgcolor; - bits = bits >> 1; - if (bits&0x01) *dst++=fgcolor; - else *dst++=bgcolor; - bits = bits >> 1; - if (bits&0x01) *dst++=fgcolor; - else *dst++=bgcolor; - l++; - } - x +=8; - } -} - -static void tileTextOverlay(int16_t x, int16_t y, const char * text, vga_pixel fgcolor) { - vga_pixel c; - vga_pixel * dst; - - while ((c = *text++)) { - const unsigned char * charpt=&font8x8[c][0]; - int l=y; - for (int i=0;i<8;i++) - { - unsigned char bits; - dst=&framebuffer[+l*fb_stride+x]; - bits = *charpt++; - if (bits&0x01) *dst++=fgcolor; - else dst++; - bits = bits >> 1; - if (bits&0x01) *dst++=fgcolor; - else dst++; - bits = bits >> 1; - if (bits&0x01) *dst++=fgcolor; - else dst++; - bits = bits >> 1; - if (bits&0x01) *dst++=fgcolor; - else dst++; - bits = bits >> 1; - if (bits&0x01) *dst++=fgcolor; - else dst++; - bits = bits >> 1; - if (bits&0x01) *dst++=fgcolor; - else dst++; - bits = bits >> 1; - if (bits&0x01) *dst++=fgcolor; - else dst++; - bits = bits >> 1; - if (bits&0x01) *dst++=fgcolor; - else dst++; - l++; - } - x +=8; - } -} -static const char * hex = "0123456789ABCDEF"; - -void VGA_T4::begin_gfxengine(int nblayers, int nbtiles, int nbsprites) -{ - // Try double buffering - if (fb1 == NULL) { - void *mallocpt = malloc(fb_stride*fb_height*sizeof(vga_pixel)+4); - fb1 = (vga_pixel *)((void*)((intptr_t)mallocpt & ~3)); - } - if (fb1 != NULL) { - framebuffer = fb1; - } - - - nb_layers = nblayers; - nb_tiles = nbtiles; - nb_sprites = nbsprites; - - if (spritesbuffer == NULL) spritesbuffer = (vga_pixel*)malloc(SPRITES_W*SPRITES_H*sizeof(vga_pixel)*nb_sprites); - if (tilesbuffer == NULL) tilesbuffer = (vga_pixel*)malloc(TILES_W*TILES_H*sizeof(vga_pixel)*nb_tiles); - if (tilesram == NULL) tilesram = (unsigned char*)malloc(TILES_COLS*TILES_ROWS*nb_layers); - if (spritesdata == NULL) spritesdata = (Sprite_t *)malloc(SPRITES_MAX*sizeof(Sprite_t)); - - memset((void*)spritesbuffer,0, SPRITES_W*SPRITES_H*sizeof(vga_pixel)*nb_sprites); - memset((void*)tilesbuffer,0, TILES_W*TILES_H*sizeof(vga_pixel)*nb_tiles); - memset((void*)tilesram,0,TILES_COLS*TILES_ROWS*nb_layers); - - /* Random test tiles */ - char numhex[3]; - for (int i=0; i>4) & 0xf]; - numhex[1] = hex[i & 0xf]; - numhex[2] = 0; - if (TILES_W == 16 )tileText(i, 0, 0, numhex, VGA_RGB(0xff,0xff,0xff), VGA_RGB(0x40,0x40,0x40), tilesbuffer,TILES_W,TILES_H); - } - } - /* Random test sprites */ - for (int i=0; i>4) & 0xf]; - numhex[1] = hex[i & 0xf]; - numhex[2] = 0; - tileText(i, 0, 0, numhex, VGA_RGB(0xff,0xff,0x00), VGA_RGB(0x00,0x00,0x00),spritesbuffer,SPRITES_W,SPRITES_H); - } - } -} - - -void VGA_T4::run_gfxengine() -{ - waitSync(); - - if (fb1 != NULL) { - if (visible_framebuffer == fb0) { - visible_framebuffer = fb1; - framebuffer = fb0; - } - else { - visible_framebuffer = fb0; - framebuffer = fb1; - } - } - - unsigned char * tilept; - - // Layer 0 - for (int j=0; j=hscr_beg[0]) && (j<=hscr_end[0]) ) { - int modcol = (hscr[0] >> TILES_HBITS) % TILES_COLS; - for (int i=0; i 1) { - int lcount = 1; - while (lcount < nb_layers) { - for (int j=0; j=hscr_beg[lcount]) && (j<=hscr_end[lcount]) ) { - int modcol = (hscr[lcount] >> TILES_HBITS) % TILES_COLS; - for (int i=0; i> 8); - cnt = cnt & (sampleBufferSize*2-1); - - if (cnt == 0) { - fillfirsthalf = false; - //irq_set_pending(RTC_IRQ+1); - multicore_fifo_push_blocking(0); - } - else if (cnt == sampleBufferSize) { - fillfirsthalf = true; - //irq_set_pending(RTC_IRQ+1); - multicore_fifo_push_blocking(0); - } -} - -static void core1_sio_irq() { - irq_clear(SIO_IRQ_PROC1); - while(multicore_fifo_rvalid()) { - uint16_t raw = multicore_fifo_pop_blocking(); - SOFTWARE_isr(); - } - multicore_fifo_clear_irq(); -} - - -void VGA_T4::begin_audio(int samplesize, void (*callback)(short * stream, int len)) -{ - fillsamples = callback; - i2s_tx_buffer = (uint32_t*)malloc(samplesize*sizeof(uint32_t)); - - if (i2s_tx_buffer == NULL) { - printf("sound buffer could not be allocated!!!!!\n"); - return; - } - memset((void*)i2s_tx_buffer,0, samplesize*sizeof(uint32_t)); - printf("sound buffer allocated\n"); - - i2s_tx_buffer16 = (short*)i2s_tx_buffer; - - sampleBufferSize = samplesize; - - gpio_set_function(AUDIO_PIN, GPIO_FUNC_PWM); - int audio_pin_slice = pwm_gpio_to_slice_num(AUDIO_PIN); - // Setup PWM interrupt to fire when PWM cycle is complete - pwm_clear_irq(audio_pin_slice); - pwm_set_irq_enabled(audio_pin_slice, true); - irq_set_exclusive_handler(PWM_IRQ_WRAP, AUDIO_isr); - irq_set_priority (PWM_IRQ_WRAP, 128); - irq_set_enabled(PWM_IRQ_WRAP, true); - - //irq_set_exclusive_handler(RTC_IRQ+1,SOFTWARE_isr); - //irq_set_priority (RTC_IRQ+1, 120); - //irq_set_enabled(RTC_IRQ+1,true); - - - // Setup PWM for audio output - pwm_config config = pwm_get_default_config(); -// pwm_config_set_clkdiv(&config, 5.5f); - pwm_config_set_clkdiv(&config, 50.0f); - pwm_config_set_wrap(&config, 254); - pwm_init(audio_pin_slice, &config, true); - - pwm_set_gpio_level(AUDIO_PIN, 0); - printf("sound initialized\n"); -} - -void VGA_T4::end_audio() -{ - if (i2s_tx_buffer != NULL) { - free(i2s_tx_buffer); - } -} - -#endif - - diff --git a/MCUME_pico/picovga_t4/VGA_t4.h b/MCUME_pico/picovga_t4/VGA_t4.h deleted file mode 100755 index 0d21ef3..0000000 --- a/MCUME_pico/picovga_t4/VGA_t4.h +++ /dev/null @@ -1,262 +0,0 @@ -/* - This file is part of VGA_t4 library. - - VGA_t4 library is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - Copyright (C) 2020 J-M Harvengt - - Inspired from the original Teensy3 uVGA library of Eric PREVOTEAU. - QTIMER/FlexIO code based on Teensy4 examples of KurtE, Manitou and easone - from the Teensy4 forum (https://forum.pjrc.com) -*/ - -#ifndef _VGA_T4_H -#define _VGA_T4_H - - -#include -#include -#include "pico.h" - - -// Enable debug info (requires serial initialization) -//#define DEBUG - -typedef uint8_t vga_pixel; -#define VGA_RGB(r,g,b) ( (((r>>5)&0x07)<<5) | (((g>>5)&0x07)<<2) | (((b>>6)&0x3)<<0) ) - - -typedef enum vga_mode_t -{ - VGA_MODE_320x240 = 0, - VGA_MODE_352x240 = 1, - VGA_MODE_400x240 = 2, -} vga_mode_t; - - -typedef enum vga_error_t -{ - VGA_OK = 0, - VGA_ERROR = -1 -} vga_error_t; - -#define MaxPolyPoint 100 - -#define AUDIO_SAMPLE_BUFFER_SIZE 256 - -// 2D point structure -typedef struct { - int16_t x; // X Coordinate on screen - int16_t y; // Y Coordinate on screen -}Point2D; - -// Polygon structure -typedef struct { - Point2D Center; // Polygon Center (point where the polygon can rotate arround) - Point2D Pts[MaxPolyPoint]; // Points for the polygon -}PolyDef; - - -#define DEFAULT_VSYNC_PIN 8 - -#ifndef ABS -#define ABS(X) ((X) > 0 ? (X) : -(X)) -#endif - -extern PolyDef PolySet; // polygon data to declare in c file - - -// Precomputed sinus and cosinus table from 0 to 359 degrees -// The tables are in Degrees not in Radian ! -const float calcsi[360]={ - 0.000001 , // 0 - 0.01745239 , 0.03489947 , 0.05233591 , 0.06975641 , 0.08715567 , 0.1045284 , 0.1218692 , 0.139173 , 0.1564343 , 0.173648 , // 1 à 10 - 0.1908088 , 0.2079115 , 0.2249509 , 0.2419217 , 0.2588188 , 0.2756371 , 0.2923715 , 0.3090167 , 0.3255679 , 0.3420198 , // 11 à 20 - 0.3583677 , 0.3746063 , 0.3907308 , 0.4067363 , 0.4226179 , 0.4383708 , 0.4539901 , 0.4694712 , 0.4848093 , 0.4999996 , // 21 à 30 - 0.5150377 , 0.5299189 , 0.5446386 , 0.5591925 , 0.573576 , 0.5877848 , 0.6018146 , 0.615661 , 0.62932 , 0.6427872 , // 31 à 40 - 0.6560586 , 0.6691301 , 0.6819978 , 0.6946579 , 0.7071063 , 0.7193394 , 0.7313532 , 0.7431444 , 0.7547091 , 0.7660439 , // 41 à 50 - 0.7771455 , 0.7880103 , 0.798635 , 0.8090165 , 0.8191515 , 0.8290371 , 0.8386701 , 0.8480476 , 0.8571668 , 0.8660249 , // 51 à 60 - 0.8746193 , 0.8829472 , 0.8910061 , 0.8987936 , 0.9063074 , 0.913545 , 0.9205045 , 0.9271835 , 0.9335801 , 0.9396922 , // 61 à 70 - 0.9455183 , 0.9510562 , 0.9563044 , 0.9612614 , 0.9659255 , 0.9702954 , 0.9743698 , 0.9781474 , 0.981627 , 0.9848075 , // 71 à 80 - 0.9876881 , 0.9902679 , 0.992546 , 0.9945218 , 0.9961946 , 0.9975639 , 0.9986295 , 0.9993908 , 0.9998476 , 0.99999 , // 81 à 90 - 0.9998477 , 0.9993909 , 0.9986296 , 0.9975642 , 0.9961948 , 0.994522 , 0.9925463 , 0.9902682 , 0.9876886 , 0.984808 , // 91 à 100 - 0.9816275 , 0.9781479 , 0.9743704 , 0.9702961 , 0.9659262 , 0.9612621 , 0.9563052 , 0.9510571 , 0.9455191 , 0.9396932 , // 101 à 110 - 0.933581 , 0.9271844 , 0.9205055 , 0.9135461 , 0.9063086 , 0.8987948 , 0.8910073 , 0.8829485 , 0.8746206 , 0.8660263 , // 111 à 120 - 0.8571682 , 0.8480491 , 0.8386716 , 0.8290385 , 0.8191531 , 0.8090182 , 0.7986366 , 0.7880119 , 0.7771472 , 0.7660457 , // 121 à 130 - 0.7547108 , 0.7431462 , 0.7313551 , 0.7193412 , 0.7071083 , 0.6946598 , 0.6819999 , 0.6691321 , 0.6560606 , 0.6427892 , // 131 à 140 - 0.629322 , 0.6156631 , 0.6018168 , 0.5877869 , 0.5735782 , 0.5591948 , 0.5446408 , 0.5299212 , 0.5150401 , 0.5000019 , // 141 à 150 - 0.4848116 , 0.4694737 , 0.4539925 , 0.4383733 , 0.4226205 , 0.4067387 , 0.3907333 , 0.3746087 , 0.3583702 , 0.3420225 , // 151 à 160 - 0.3255703 , 0.3090193 , 0.2923741 , 0.2756396 , 0.2588214 , 0.2419244 , 0.2249534 , 0.2079142 , 0.1908116 , 0.1736506 , // 161 à 170 - 0.156437 , 0.1391758 , 0.1218719 , 0.1045311 , 0.08715825 , 0.06975908 , 0.05233867 , 0.03490207 , 0.01745508 , 0.0277 , // 171 à 180 - -0.01744977 , -0.03489676 , -0.05233313 , -0.06975379 , -0.08715296 , -0.1045256 , -0.1218666 , -0.1391703 , -0.1564316 , -0.1736454 ,// 181 à 190 - -0.1908061 , -0.207909 , -0.2249483 , -0.241919 , -0.2588163 , -0.2756345 , -0.2923688 , -0.3090142 , -0.3255653 , -0.3420173 , // 191 à 200 - -0.3583652 , -0.3746038 , -0.3907282 , -0.4067339 , -0.4226155 , -0.4383683 , -0.4539878 , -0.4694688 , -0.4848068 , -0.4999973 , // 201 à 210 - -0.5150353 , -0.5299166 , -0.5446364 , -0.5591902 , -0.5735739 , -0.5877826 , -0.6018124 , -0.615659 , -0.6293178 , -0.642785 , // 211 à 220 - -0.6560566 , -0.6691281 , -0.6819958 , -0.694656 , -0.7071043 , -0.7193374 , -0.7313514 , -0.7431425 , -0.7547074 , -0.7660421 , // 221 à 230 - -0.7771439 , -0.7880087 , -0.7986334 , -0.8090149 , -0.8191499 , -0.8290355 , -0.8386687 , -0.8480463 , -0.8571655 , -0.8660236 , // 231 à 240 - -0.8746178 , -0.882946 , -0.8910049 , -0.8987925 , -0.9063062 , -0.9135439 , -0.9205033 , -0.9271825 , -0.9335791 , -0.9396913 , // 241 à 250 - -0.9455173 , -0.9510553 , -0.9563036 , -0.9612607 , -0.9659248 , -0.9702948 , -0.9743692 , -0.9781467 , -0.9816265 , -0.9848071 , // 251 à 260 - -0.9876878 , -0.9902675 , -0.9925456 , -0.9945215 , -0.9961944 , -0.9975638 , -0.9986293 , -0.9993907 , -0.9998476 , -0.99999 , // 261 à 270 - -0.9998478 , -0.9993909 , -0.9986298 , -0.9975643 , -0.9961951 , -0.9945223 , -0.9925466 , -0.9902686 , -0.987689 , -0.9848085 , // 271 à 280 - -0.981628 , -0.9781484 , -0.974371 , -0.9702968 , -0.965927 , -0.9612629 , -0.9563061 , -0.9510578 , -0.9455199 , -0.9396941 , // 281 à 290 - -0.933582 , -0.9271856 , -0.9205065 , -0.9135472 , -0.9063097 , -0.898796 , -0.8910086 , -0.8829498 , -0.8746218 , -0.8660276 , // 291 à 300 - -0.8571696 , -0.8480505 , -0.8386731 , -0.8290402 , -0.8191546 , -0.8090196 , -0.7986383 , -0.7880136 , -0.777149 , -0.7660476 , // 301 à 310 - -0.7547125 , -0.7431479 , -0.7313569 , -0.7193431 , -0.7071103 , -0.6946616 , -0.6820017 , -0.6691341 , -0.6560627 , -0.6427914 , // 311 à 320 - -0.6293243 , -0.6156651 , -0.6018188 , -0.5877892 , -0.5735805 , -0.5591971 , -0.5446434 , -0.5299233 , -0.5150422 , -0.5000043 , // 321 à 330 - -0.484814 , -0.4694761 , -0.4539948 , -0.4383755 , -0.4226228 , -0.4067413 , -0.3907359 , -0.3746115 , -0.3583725 , -0.3420248 , // 331 à 340 - -0.325573 , -0.3090219 , -0.2923768 , -0.2756425 , -0.2588239 , -0.2419269 , -0.2249561 , -0.2079169 , -0.1908143 , -0.1736531 , // 341 à 350 - -0.1564395 , -0.1391783 , -0.1218746 , -0.1045339 , -0.08716125 , -0.06976161 , -0.0523412 , -0.03490484 , -0.01745785 }; // 351 à 359 - -const float calcco[360]={ - 0.99999 , // 0 - 0.9998477 , 0.9993908 , 0.9986295 , 0.9975641 , 0.9961947 , 0.9945219 , 0.9925462 , 0.9902681 , 0.9876884 , 0.9848078 , // 1 à 10 - 0.9816272 , 0.9781477 , 0.9743701 , 0.9702958 , 0.9659259 , 0.9612617 , 0.9563049 , 0.9510566 , 0.9455186 , 0.9396928 , // 11 à 20 - 0.9335806 , 0.927184 , 0.920505 , 0.9135456 , 0.906308 , 0.8987943 , 0.8910067 , 0.8829478 , 0.8746199 , 0.8660256 , // 21 à 30 - 0.8571675 , 0.8480483 , 0.8386709 , 0.8290379 , 0.8191524 , 0.8090173 , 0.7986359 , 0.7880111 , 0.7771463 , 0.7660448 , // 31 à 40 - 0.75471 , 0.7431452 , 0.7313541 , 0.7193403 , 0.7071072 , 0.6946589 , 0.6819989 , 0.6691311 , 0.6560596 , 0.6427882 , // 41 à 50 - 0.629321 , 0.6156621 , 0.6018156 , 0.5877859 , 0.5735771 , 0.5591936 , 0.5446398 , 0.52992 , 0.5150389 , 0.5000008 , // 51 à 60 - 0.4848104 , 0.4694724 , 0.4539914 , 0.438372 , 0.4226191 , 0.4067376 , 0.3907321 , 0.3746075 , 0.3583689 , 0.3420211 , // 61 à 70 - 0.3255692 , 0.309018 , 0.2923728 , 0.2756384 , 0.2588201 , 0.241923 , 0.2249522 , 0.2079128 , 0.1908101 , 0.1736494 , // 71 à 80 - 0.1564357 , 0.1391743 , 0.1218706 , 0.1045297 , 0.08715699 , 0.06975782 , 0.05233728 , 0.0349008 , 0.01745369 , 0.0138 , // 81 à 90 - -0.01745104 , -0.03489815 , -0.05233451 , -0.06975505 , -0.08715434 , -0.1045271 , -0.1218679 , -0.1391717 , -0.156433 , -0.1736467 ,// 91 à 100 - -0.1908075 , -0.2079102 , -0.2249495 , -0.2419204 , -0.2588175 , -0.2756359 , -0.2923701 , -0.3090155 , -0.3255666 , -0.3420185 , // 101 à 110 - -0.3583664 , -0.3746051 , -0.3907295 , -0.4067351 , -0.4226166 , -0.4383696 , -0.4539889 , -0.4694699 , -0.4848081 , -0.4999984 , // 111 à 120 - -0.5150366 , -0.5299177 , -0.5446375 , -0.5591914 , -0.5735749 , -0.5877837 , -0.6018136 , -0.6156599 , -0.6293188 , -0.6427862 , // 121 à 130 - -0.6560575 , -0.669129 , -0.6819969 , -0.6946569 , -0.7071053 , -0.7193384 , -0.7313522 , -0.7431435 , -0.7547083 , -0.7660431 , // 131 à 140 - -0.7771447 , -0.7880094 , -0.7986342 , -0.8090158 , -0.8191508 , -0.8290363 , -0.8386694 , -0.8480469 , -0.8571661 , -0.8660243 , // 141 à 150 - -0.8746186 , -0.8829465 , -0.8910055 , -0.898793 , -0.9063068 , -0.9135445 , -0.9205039 , -0.927183 , -0.9335796 , -0.9396918 , // 151 à 160 - -0.9455178 , -0.9510558 , -0.956304 , -0.9612611 , -0.9659252 , -0.9702951 , -0.9743695 , -0.978147 , -0.9816267 , -0.9848073 , // 161 à 170 - -0.9876879 , -0.9902677 , -0.9925459 , -0.9945216 , -0.9961945 , -0.9975639 , -0.9986294 , -0.9993907 , -0.9998476 , -0.99999 , // 171 à 180 - -0.9998477 , -0.9993909 , -0.9986297 , -0.9975642 , -0.9961949 , -0.9945222 , -0.9925465 , -0.9902685 , -0.9876888 , -0.9848083 , // 181 à 190 - -0.9816277 , -0.9781482 , -0.9743707 , -0.9702965 , -0.9659266 , -0.9612625 , -0.9563056 , -0.9510574 , -0.9455196 , -0.9396937 , // 191 à 200 - -0.9335815 , -0.927185 , -0.9205061 , -0.9135467 , -0.9063091 , -0.8987955 , -0.8910079 , -0.8829491 , -0.8746213 , -0.866027 , // 201 à 210 - -0.857169 , -0.8480497 , -0.8386723 , -0.8290394 , -0.8191538 , -0.8090189 , -0.7986375 , -0.7880127 , -0.7771481 , -0.7660466 , // 211 à 220 - -0.7547117 , -0.743147 , -0.731356 , -0.7193421 , -0.7071092 , -0.6946609 , -0.6820008 , -0.6691331 , -0.6560616 , -0.6427905 , // 221 à 230 - -0.6293229 , -0.6156641 , -0.6018178 , -0.5877882 , -0.5735794 , -0.5591961 , -0.5446419 , -0.5299222 , -0.5150412 , -0.5000032 , // 231 à 240 - -0.4848129 , -0.4694746 , -0.4539936 , -0.4383744 , -0.4226216 , -0.4067401 , -0.3907347 , -0.3746099 , -0.3583714 , -0.3420237 , // 241 à 250 - -0.3255718 , -0.3090207 , -0.2923756 , -0.2756409 , -0.2588227 , -0.2419256 , -0.2249549 , -0.2079156 , -0.1908126 , -0.1736519 , // 251 à 260 - -0.1564383 , -0.139177 , -0.1218734 , -0.1045326 , -0.08715951 , -0.06976035 , -0.05233994 , -0.03490358 , -0.01745659 , -0.0427 , // 261 à 270 - 0.01744851 , 0.0348955 , 0.05233186 , 0.06975229 , 0.08715146 , 0.1045246 , 0.1218654 , 0.139169 , 0.1564303 , 0.1736439 , // 271 à 280 - 0.1908047 , 0.2079078 , 0.224947 , 0.2419178 , 0.2588149 , 0.2756331 , 0.2923674 , 0.309013 , 0.3255641 , 0.3420161 , // 281 à 290 - 0.3583638 , 0.3746024 , 0.3907273 , 0.4067327 , 0.4226143 , 0.4383671 , 0.4539864 , 0.4694674 , 0.4848059 , 0.4999962 , // 291 à 300 - 0.5150342 , 0.5299154 , 0.5446351 , 0.559189 , 0.5735728 , 0.5877816 , 0.6018113 , 0.6156578 , 0.6293167 , 0.6427839 , // 301 à 310 - 0.6560556 , 0.6691272 , 0.6819949 , 0.6946549 , 0.7071033 , 0.7193366 , 0.7313506 , 0.7431416 , 0.7547064 , 0.7660413 , // 311 à 320 - 0.7771428 , 0.7880079 , 0.7986327 , 0.8090141 , 0.8191492 , 0.8290347 , 0.8386678 , 0.8480456 , 0.8571648 , 0.8660229 , // 321 à 330 - 0.8746172 , 0.8829452 , 0.8910043 , 0.8987919 , 0.9063057 , 0.9135434 , 0.9205029 , 0.9271819 , 0.9335786 , 0.9396909 , // 331 à 340 - 0.9455169 , 0.9510549 , 0.9563032 , 0.9612602 , 0.9659245 , 0.9702945 , 0.9743689 , 0.9781465 , 0.9816261 , 0.9848069 , // 341 à 350 - 0.9876875 , 0.9902673 , 0.9925455 , 0.9945213 , 0.9961942 , 0.9975637 , 0.9986292 , 0.9993906 , 0.9998476 }; // 351 à 359 - - -class VGA_T4 -{ -public: - - VGA_T4(); - - // display VGA image - vga_error_t begin(vga_mode_t mode); - void begin_audio(int samplesize, void (*callback)(short * stream, int len)); - void end(); - void end_audio(); - void debug(); - void tweak_video(int shiftdelta, int numdelta, int denomdelta); - - // retrieve real size of the frame buffer - int get_frame_buffer_size(int *width, int *height); - - // wait next Vsync - void waitSync(); - void waitLine(int line); - - // ========================================================= - // graphic primitives - // ========================================================= - - void clear(vga_pixel col) ; - void drawPixel(int x, int y, vga_pixel color); - vga_pixel getPixel(int x, int y); - vga_pixel * getLineBuffer(int j); - void drawRect(int16_t x, int16_t y, int16_t w, int16_t h, vga_pixel color); - void drawText(int16_t x, int16_t y, const char * text, vga_pixel fgcolor, vga_pixel bgcolor, bool doublesize); - void drawSprite(int16_t x, int16_t y, const int16_t *bitmap); - void drawSprite(int16_t x, int16_t y, const int16_t *bitmap, uint16_t croparx, uint16_t cropary, uint16_t croparw, uint16_t croparh); - void writeScreen(const vga_pixel *pcolors); - void writeLine(int width, int height, int y, vga_pixel *buf); - void writeLine(int width, int height, int stride, uint8_t *buffer, vga_pixel *palette); - void writeLine16(int width, int height, int y, uint16_t *buf); - void writeScreen(int width, int height, int stride, uint8_t *buffer, vga_pixel *palette); - void copyLine(int width, int height, int ysrc, int ydst); - - // ************************************** GFX API extension from darthvader ****************************************************** - void drawline(int16_t x1, int16_t y1, int16_t x2, int16_t y2, vga_pixel color); - void draw_h_line(int16_t x1, int16_t y1, int16_t lenght, vga_pixel color); - void draw_v_line(int16_t x1, int16_t y1, int16_t lenght, vga_pixel color); - void drawcircle(int16_t x, int16_t y, int16_t radius, vga_pixel color); - void drawfilledcircle(int16_t x, int16_t y, int16_t radius, vga_pixel fillcolor, vga_pixel bordercolor); - void drawellipse(int16_t cx, int16_t cy, int16_t radius1, int16_t radius2, vga_pixel color); - void drawfilledellipse(int16_t cx, int16_t cy, int16_t radius1, int16_t radius2, vga_pixel fillcolor, vga_pixel bordercolor); - void drawtriangle(int16_t ax, int16_t ay, int16_t bx, int16_t by, int16_t cx, int16_t cy, vga_pixel color); - void drawfilledtriangle(int16_t ax, int16_t ay, int16_t bx, int16_t by, int16_t cx, int16_t cy, vga_pixel fillcolor, vga_pixel bordercolor); - void drawquad(int16_t centerx, int16_t centery, int16_t w, int16_t h, int16_t angle, vga_pixel color); - void drawfilledquad(int16_t centerx, int16_t centery, int16_t w, int16_t h, int16_t angle, vga_pixel fillcolor, vga_pixel bordercolor); - void drawpolygon(int16_t cx, int16_t cy, vga_pixel bordercolor); - void drawfullpolygon(int16_t cx, int16_t cy, vga_pixel fillcolor, vga_pixel bordercolor); - void drawrotatepolygon(int16_t cx, int16_t cy, int16_t Angle, vga_pixel fillcolor, vga_pixel bordercolor, uint8_t filled); - // ******************************************************************************************************************************* - - - // ========================================================= - // Game engine - // ========================================================= - - #define TILES_MAX_LAYERS 2 - - // 16x16 pixels tiles or 8x8 if USE_8PIXTILES is set - //#define USE_8PIXTILES 1 - #ifdef USE_8PIXTILES - #define TILES_COLS 40 - #define TILES_ROWS 30 - #define TILES_W 8 - #define TILES_H 8 - #define TILES_HBITS 3 - #define TILES_HMASK 0x7 - #else - #define TILES_COLS 20 - #define TILES_ROWS 15 - #define TILES_W 16 - #define TILES_H 16 - #define TILES_HBITS 4 - #define TILES_HMASK 0xf - #endif - - // 32 sprites 16x32 or max 64 16x16 (not larger!!!) - #define SPRITES_MAX 32 - #define SPRITES_W 16 - #define SPRITES_H 32 - - void begin_gfxengine(int nblayers, int nbtiles, int nbsprites); - void run_gfxengine(); - void tile_data(unsigned char index, vga_pixel * data, int len); - void sprite_data(unsigned char index, vga_pixel * data, int len); - void sprite(int id , int x, int y, unsigned char index); - void sprite_hide(int id); - void tile_draw(int layer, int x, int y, unsigned char index); - void tile_draw_row(int layer, int x, int y, unsigned char * data, int len); - void tile_draw_col(int layer, int x, int y, unsigned char * data, int len); - void set_hscroll(int layer, int rowbeg, int rowend, int mask); - void set_vscroll(int layer, int colbeg, int colend, int mask); - void hscroll(int layer, int value); - void vscroll(int layer, int value); - - -private: - static uint8_t _vsync_pin; -}; - - -#endif - - diff --git a/MCUME_pico/picovga_t4/vga_t_dma.h b/MCUME_pico/picovga_t4/vga_t_dma.h deleted file mode 100644 index ad3305e..0000000 --- a/MCUME_pico/picovga_t4/vga_t_dma.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - Wrapping class to extend VGA_T4 to TFT_T_DMA -*/ - -#ifndef _VGA_T_DMAH_ -#define _VGA_T_DMAH_ - -#ifdef __cplusplus -#include "VGA_t4.h" -#endif - - -#define RGBVAL16(r,g,b) VGA_RGB(r,g,b) -#define RGBVAL8(r,g,b) VGA_RGB(r,g,b) - - - -#ifdef HIRES -#define TFT_WIDTH 640 -#define TFT_REALWIDTH 640 -#else -#define TFT_WIDTH 320 -#define TFT_REALWIDTH 320 -#endif - -#define TFT_HEIGHT 240 -#define TFT_REALHEIGHT 240 - - - -#ifdef __cplusplus - -class TFT_T_DMA: public VGA_T4 -{ - public: - // Fake touch screen functions - bool isTouching(void) { return false; } - void readRaw(uint16_t * oX, uint16_t * oY, uint16_t * oZ) { } - void readCal(uint16_t * oX, uint16_t * oY, uint16_t * oZ) { }; - void callibrateTouch(uint16_t xMin,uint16_t yMin,uint16_t xMax,uint16_t yMax) { } - - // fake DMA functions - void startDMA(void) { }; - void stopDMA(void) { }; - void flipscreen(bool flip) { }; - - // fake no DMA functions - void writeScreenNoDma(const vga_pixel *pcolors) { writeScreen(pcolors); } - void fillScreenNoDma(vga_pixel color) { clear(color); } - void drawTextNoDma(int16_t x, int16_t y, const char * text, vga_pixel fgcolor, vga_pixel bgcolor, bool doublesize) { drawText(x,y,text,fgcolor,bgcolor,doublesize); } - void drawRectNoDma(int16_t x, int16_t y, int16_t w, int16_t h, vga_pixel color) { drawRect(x, y, w, h, color); } - void drawSpriteNoDma(int16_t x, int16_t y, const int16_t *bitmap) { drawSprite(x, y, bitmap); } - void drawSpriteNoDma(int16_t x, int16_t y, const int16_t *bitmap, uint16_t croparx, uint16_t cropary, uint16_t croparw, uint16_t croparh) { drawSprite(x, y, bitmap, croparx, cropary, croparw, croparh); } -}; - - -#endif -#endif diff --git a/MCUME_pico/psram/psram_t.cpp b/MCUME_pico/psram/psram_t.cpp deleted file mode 100644 index b7664fb..0000000 --- a/MCUME_pico/psram/psram_t.cpp +++ /dev/null @@ -1,269 +0,0 @@ -/* - PSRAM driver for IPS6404 -*/ - -#include "iopins.h" - -#include "psram_t.h" - -#ifdef HAS_PSRAM - -Page PSRAM_T::pages[MAX_PAGES]; -uint8_t PSRAM_T::nbPages=0; -int8_t PSRAM_T::top=0; -int8_t PSRAM_T::last=0; - -#include "pico/stdlib.h" -#include "hardware/spi.h" - -#define digitalWrite(pin, val) gpio_put(pin, val) - -static void SPItransfer(uint8_t val) -{ - uint8_t dat8=val; - spi_write_blocking(PSRAM_SPIREG, &dat8, 1); -} - -static uint8_t SPItransferRD(uint8_t val) -{ - uint8_t dat8=0xff; - spi_read_blocking(PSRAM_SPIREG, val, &dat8, 1); - return dat8; -} - - - -#define SPICLOCK 104000000 -//#define SPICLOCK 70000000 -//#define SPICLOCK 50000000 - -#define SPI_MODE SPI_CPOL_0 - -#define RAM_READ 0xB -//#define RAM_READ 0x3 -#define RAM_WRITE 0x2 - - -uint8_t PSRAM_T::_cs, PSRAM_T::_miso, PSRAM_T::_mosi, PSRAM_T::_sclk; - - -PSRAM_T::PSRAM_T(uint8_t cs, uint8_t mosi, uint8_t sclk, uint8_t miso) -{ - _cs = cs; - _mosi = mosi; - _sclk = sclk; - _miso = miso; -} - - -void PSRAM_T::begin(void) -{ - spi_init(PSRAM_SPIREG, SPICLOCK); - spi_set_format(PSRAM_SPIREG, 8, SPI_MODE, SPI_CPHA_0, SPI_MSB_FIRST); - gpio_set_function(_miso , GPIO_FUNC_SPI); - gpio_set_function(_cs , GPIO_FUNC_SPI); - gpio_set_function(_sclk , GPIO_FUNC_SPI); - gpio_set_function(_mosi , GPIO_FUNC_SPI); - gpio_init(_cs); - gpio_set_dir(_cs, GPIO_OUT); - digitalWrite(_cs, 1); - sleep_ms(1); - digitalWrite(_cs, 0); - SPItransfer(0x66); - digitalWrite(_cs, 1); - sleep_ms(1); - digitalWrite(_cs, 0); - SPItransfer(0x99); - digitalWrite(_cs, 1); - sleep_ms(20); -} - - -void PSRAM_T::psram_write(uint32_t addr, uint8_t val) -{ - digitalWrite(_cs, 0); - SPItransfer(RAM_WRITE); - SPItransfer((addr>>16)&0xff); - SPItransfer((addr>>8)&0xff); - SPItransfer(addr&0xff); - SPItransfer(val); - digitalWrite(_cs, 1); -} - -uint8_t PSRAM_T::psram_read(uint32_t addr) -{ - uint8_t val=0; - - digitalWrite(_cs, 0); - SPItransfer(RAM_READ); - SPItransfer((addr>>16)&0xff); - SPItransfer((addr>>8)&0xff); - SPItransfer(addr&0xff); -#if RAM_READ == 0xB - SPItransfer(0xFF); -#endif - val = SPItransferRD(0xFF); - digitalWrite(_cs, 1); - return val; -} - - -void PSRAM_T::psram_read_n(uint32_t addr, uint8_t * val, int n) -{ - digitalWrite(_cs, 0); - SPItransfer(RAM_READ); - SPItransfer((addr>>16)&0xff); - SPItransfer((addr>>8)&0xff); - SPItransfer(addr&0xff); -#if RAM_READ == 0xB - SPItransferRD(0xFF); -#endif - //while (n > 0) { - // *val++ = SPItransferRD(0xFF); - // n--; - //} - spi_read_blocking(PSRAM_SPIREG, 0xFF, val, n); - digitalWrite(_cs, 1); -} - - -static uint8_t resp[PAGE_SIZE]; - - -void PSRAM_T::psram_write_n(uint32_t addr, uint8_t * val, int n) -{ - digitalWrite(_cs, 0); - SPItransfer(RAM_WRITE); - SPItransfer((addr>>16)&0xff); - SPItransfer((addr>>8)&0xff); - SPItransfer(addr&0xff); - - while (n > 0) { - SPItransfer(*val++); - n--; - } - //SPItransfer(val,&resp[0],n); - digitalWrite(_cs, 1); -} - - -void PSRAM_T::pswrite(uint32_t addr, uint8_t val) -{ - psram_write(addr, val); - //return - uint32_t curPage=addr&(~(PAGE_SIZE-1)); - for (int i=0; i -#include - - -#define PAGE_SIZE 256 //2048 //16 //32 //2048 //1024 -#define MAX_PAGES 16//8 - -struct Page { - uint8_t page[PAGE_SIZE]; - uint32_t pageid; - int8_t next; - int8_t prev; -}; - -class PSRAM_T -{ - public: - PSRAM_T(uint8_t _CS, uint8_t _MOSI=11, uint8_t _SCLK=13, uint8_t _MISO=12); - void begin(void); - void pswrite(uint32_t addr, uint8_t val); - uint8_t psread(uint32_t addr); - uint16_t psread_w(uint32_t addr); - - private: - static uint8_t psram_read(uint32_t addr); - static void psram_read_n(uint32_t addr, uint8_t * val, int n); - static void psram_write(uint32_t addr, uint8_t val); - static void psram_write_n(uint32_t addr, uint8_t * val, int n); - - protected: - static uint8_t _cs, _miso, _mosi, _sclk; - static Page pages[MAX_PAGES]; - static uint8_t nbPages; - static int8_t top; - static int8_t last; -}; -#endif - -#endif - -#endif - diff --git a/MCUME_pico/testio/emuapi.cpp b/MCUME_pico/testio/emuapi.cpp deleted file mode 100644 index 0cb6d26..0000000 --- a/MCUME_pico/testio/emuapi.cpp +++ /dev/null @@ -1,798 +0,0 @@ -#define KEYMAP_PRESENT 1 - -#define PROGMEM - -#include "pico.h" -#include "pico/stdlib.h" -#include "hardware/adc.h" -#include -#include - -extern "C" { - #include "emuapi.h" - #include "iopins.h" -} - - -#include "vga_t_dma.h" -const uint16_t deflogo[] = { - 0,0 -}; -static const uint16_t * logo = deflogo; -static const unsigned short * keysw = keyswzx80; - -#define MAX_FILES 64 -#define MAX_FILENAME_SIZE 24 -#define MAX_MENULINES 9 -#define TEXT_HEIGHT 16 -#define TEXT_WIDTH 8 -#define MENU_FILE_XOFFSET (6*TEXT_WIDTH) -#define MENU_FILE_YOFFSET (2*TEXT_HEIGHT) -#define MENU_FILE_W (MAX_FILENAME_SIZE*TEXT_WIDTH) -#define MENU_FILE_H (MAX_MENULINES*TEXT_HEIGHT) -#define MENU_FILE_BGCOLOR RGBVAL16(0x00,0x00,0x40) -#define MENU_JOYS_YOFFSET (12*TEXT_HEIGHT) -#define MENU_VBAR_XOFFSET (0*TEXT_WIDTH) -#define MENU_VBAR_YOFFSET (MENU_FILE_YOFFSET) - -#define MENU_TFT_XOFFSET (MENU_FILE_XOFFSET+MENU_FILE_W+8) -#define MENU_TFT_YOFFSET (MENU_VBAR_YOFFSET+32) -#define MENU_VGA_XOFFSET (MENU_FILE_XOFFSET+MENU_FILE_W+8) -#define MENU_VGA_YOFFSET (MENU_VBAR_YOFFSET+MENU_FILE_H-32-37) - -extern TFT_T_DMA tft; - -static char romspath[64]; -static int nbFiles=0; -static int curFile=0; -static int topFile=0; -static char selection[MAX_FILENAME_SIZE+1]=""; -static char files[MAX_FILES][MAX_FILENAME_SIZE]; -static bool menuRedraw=true; - -static bool i2cKeyboardPresent = false; -static unsigned short * keys; -static int keyMap; - -static int keypadval=0; -static bool joySwapped = false; -static uint16_t bLastState; -static int xRef; -static int yRef; -static uint8_t usbnavpad=0; - -static bool menuOn=true; - - - - -void emu_printf(char * text) -{ - printf("%s\n",text); -} - -void emu_printf(int val) -{ - printf("%d\n",val); -} - -void emu_printi(int val) -{ - printf("%d\n",val); -} - -void emu_printh(int val) -{ - printf("0x%.8\n",val); -} - -static int malbufpt = 0; -static char malbuf[EXTRA_HEAP]; - -void * emu_Malloc(int size) -{ - void * retval = malloc(size); - if (!retval) { - emu_printf("failled to allocate"); - emu_printf(size); - emu_printf("fallback"); - if ( (malbufpt+size) < sizeof(malbuf) ) { - retval = (void *)&malbuf[malbufpt]; - malbufpt += size; - } - else { - emu_printf("failure to allocate"); - } - } - else { - emu_printf("could allocate dynamic "); - emu_printf(size); - } - - return retval; -} - -void * emu_MallocI(int size) -{ - void * retval = NULL; - - if ( (malbufpt+size) < sizeof(malbuf) ) { - retval = (void *)&malbuf[malbufpt]; - malbufpt += size; - emu_printf("could allocate static "); - emu_printf(size); - } - else { - emu_printf("failure to allocate"); - } - - return retval; -} -void emu_Free(void * pt) -{ - free(pt); -} - - - - - -int emu_ReadAnalogJoyX(int min, int max) -{ -#ifdef PIN_JOY2_A1X - adc_select_input(0); - int val = adc_read(); -#else - int val = 0; -#endif -#if INVX - val = 4095 - val; -#endif - val = val-xRef; - val = ((val*140)/100); - if ( (val > -512) && (val < 512) ) val = 0; - val = val+2048; - return (val*(max-min))/4096; -} - -int emu_ReadAnalogJoyY(int min, int max) -{ -#ifdef PIN_JOY2_A2Y - adc_select_input(1); - int val = adc_read(); -#else - int val = 0; -#endif -#if INVY - val = 4095 - val; -#endif - val = val-yRef; - val = ((val*120)/100); - if ( (val > -512) && (val < 512) ) val = 0; - //val = (val*(max-min))/4096; - val = val+2048; - //return val+(max-min)/2; - return (val*(max-min))/4096; -} - - -static uint16_t readAnalogJoystick(void) -{ - uint16_t joysval = 0; - - int xReading = emu_ReadAnalogJoyX(0,256); - if (xReading > 128) joysval |= MASK_JOY2_LEFT; - else if (xReading < 128) joysval |= MASK_JOY2_RIGHT; - - int yReading = emu_ReadAnalogJoyY(0,256); - if (yReading < 128) joysval |= MASK_JOY2_UP; - else if (yReading > 128) joysval |= MASK_JOY2_DOWN; - -#ifdef PIN_JOY2_BTN - joysval |= (gpio_get(PIN_JOY2_BTN) ? 0 : MASK_JOY2_BTN); -#endif - return (joysval); -} - - -int emu_SwapJoysticks(int statusOnly) { - if (!statusOnly) { - if (joySwapped) { - joySwapped = false; - } - else { - joySwapped = true; - } - } - return(joySwapped?1:0); -} - -int emu_GetPad(void) -{ - return(keypadval/*|((joySwapped?1:0)<<7)*/); -} - -int emu_ReadKeys(void) -{ - uint16_t retval; - uint16_t j1 = readAnalogJoystick(); - uint16_t j2 = 0; - - // Second joystick -#if INVY -#ifdef PIN_JOY1_1 - if ( !gpio_get(PIN_JOY1_1) ) j2 |= MASK_JOY2_DOWN; -#endif -#ifdef PIN_JOY1_2 - if ( !gpio_get(PIN_JOY1_2) ) j2 |= MASK_JOY2_UP; -#endif -#else -#ifdef PIN_JOY1_1 - if ( !gpio_get(PIN_JOY1_1) ) j2 |= MASK_JOY2_UP; -#endif -#ifdef PIN_JOY1_2 - if ( !gpio_get(PIN_JOY1_2) ) j2 |= MASK_JOY2_DOWN; -#endif -#endif -#if INVX -#ifdef PIN_JOY1_3 - if ( !gpio_get(PIN_JOY1_3) ) j2 |= MASK_JOY2_LEFT; -#endif -#ifdef PIN_JOY1_4 - if ( !gpio_get(PIN_JOY1_4) ) j2 |= MASK_JOY2_RIGHT; -#endif -#else -#ifdef PIN_JOY1_3 - if ( !gpio_get(PIN_JOY1_3) ) j2 |= MASK_JOY2_RIGHT; -#endif -#ifdef PIN_JOY1_4 - if ( !gpio_get(PIN_JOY1_4) ) j2 |= MASK_JOY2_LEFT; -#endif -#endif -#ifdef PIN_JOY1_BTN - if ( !gpio_get(PIN_JOY1_BTN) ) j2 |= MASK_JOY2_BTN; -#endif - if (joySwapped) { - retval = ((j1 << 8) | j2); - } - else { - retval = ((j2 << 8) | j1); - } - - if (usbnavpad & MASK_JOY2_UP) retval |= MASK_JOY2_UP; - if (usbnavpad & MASK_JOY2_DOWN) retval |= MASK_JOY2_DOWN; - if (usbnavpad & MASK_JOY2_LEFT) retval |= MASK_JOY2_LEFT; - if (usbnavpad & MASK_JOY2_RIGHT) retval |= MASK_JOY2_RIGHT; - if (usbnavpad & MASK_JOY2_BTN) retval |= MASK_JOY2_BTN; -#ifdef PIN_KEY_USER1 - if ( !gpio_get(PIN_KEY_USER1) ) retval |= MASK_KEY_USER1; -#endif -#ifdef PIN_KEY_USER2 - if ( !gpio_get(PIN_KEY_USER2) ) retval |= MASK_KEY_USER2; -#endif -#ifdef PIN_KEY_USER3 - if ( !gpio_get(PIN_KEY_USER3) ) retval |= MASK_KEY_USER3; -#endif -#ifdef PIN_KEY_USER4 - if ( !gpio_get(PIN_KEY_USER4) ) retval |= MASK_KEY_USER4; -#endif - - //Serial.println(retval,HEX); - - if ( ((retval & (MASK_KEY_USER1+MASK_KEY_USER2)) == (MASK_KEY_USER1+MASK_KEY_USER2)) - || (retval & MASK_KEY_USER4 ) ) - { - } - - return (retval); -} - -unsigned short emu_DebounceLocalKeys(void) -{ - uint16_t bCurState = emu_ReadKeys(); - uint16_t bClick = bCurState & ~bLastState; - bLastState = bCurState; - - return (bClick); -} - -int emu_ReadI2CKeyboard(void) { - int retval=0; - - return(retval); -} - -void emu_InitJoysticks(void) { - - // Second Joystick -#ifdef PIN_JOY1_1 - gpio_set_pulls(PIN_JOY1_1,true,false); - gpio_set_dir(PIN_JOY1_1,GPIO_IN); -#endif -#ifdef PIN_JOY1_2 - gpio_set_pulls(PIN_JOY1_2,true,false); - gpio_set_dir(PIN_JOY1_2,GPIO_IN); -#endif -#ifdef PIN_JOY1_3 - gpio_set_pulls(PIN_JOY1_3,true,false); - gpio_set_dir(PIN_JOY1_3,GPIO_IN); -#endif -#ifdef PIN_JOY1_4 - gpio_set_pulls(PIN_JOY1_4,true,false); - gpio_set_dir(PIN_JOY1_4,GPIO_IN); -#endif -#ifdef PIN_JOY1_BTN - gpio_set_pulls(PIN_JOY1_BTN,true,false); - gpio_set_dir(PIN_JOY1_BTN,GPIO_IN); -#endif - -#ifdef PIN_KEY_USER1 - gpio_set_pulls(PIN_KEY_USER1,true,false); - gpio_set_dir(PIN_KEY_USER1,GPIO_IN); -#endif -#ifdef PIN_KEY_USER2 - gpio_set_pulls(PIN_KEY_USER2,true,false); - gpio_set_dir(PIN_KEY_USER2,GPIO_IN); -#endif -#ifdef PIN_KEY_USER3 - gpio_set_pulls(PIN_KEY_USER3,true,false); - gpio_set_dir(PIN_KEY_USER3,GPIO_IN); -#endif -#ifdef PIN_KEY_USER4 - gpio_set_pulls(PIN_KEY_USER4,true,false); - gpio_set_dir(PIN_KEY_USER4,GPIO_IN); -#endif -#ifdef PIN_JOY2_BTN - gpio_set_pulls(PIN_JOY2_BTN,true,false); - gpio_set_dir(PIN_JOY2_BTN,GPIO_IN); -#endif - -#ifdef PIN_JOY2_A1X - adc_init(); - adc_gpio_init(PIN_JOY2_A1X); - adc_gpio_init(PIN_JOY2_A2Y); - xRef=0; yRef=0; - for (int i=0; i<10; i++) { - adc_select_input(0); - xRef += adc_read(); - adc_select_input(1); - yRef += adc_read(); - sleep_ms(20); - } -#endif - -#if INVX - xRef = 4095 -xRef/10; -#else - xRef /= 10; -#endif -#if INVY - yRef = 4095 -yRef/10; -#else - yRef /= 10; -#endif -} - - - - -int emu_setKeymap(int index) { - if (index) { - keysw = keyswzx81; - } - else { - keysw = keyswzx80; - } -} - - - -#include "ff.h" -static FATFS fatfs; -static FIL file; -extern "C" int sd_init_driver(void); - -static int readNbFiles(char * rootdir) { - int totalFiles = 0; - -#ifndef FAKESDIO - DIR dir; - FILINFO entry; - FRESULT fr = f_findfirst(&dir, &entry, rootdir, "*"); - while ( (fr == FR_OK) && (entry.fname[0]) && (totalFiles=0) { - menuRedraw=true; - curFile -= 9; - } else if (curFile!=0) { - menuRedraw=true; - curFile--; - } - } - else if (bClick & MASK_JOY2_DOWN) { - if ((curFile<(nbFiles-1)) && (nbFiles)) { - curFile++; - menuRedraw=true; - } - } - else if ( (bClick & MASK_JOY2_LEFT) || (bClick & MASK_JOY1_LEFT) ) { - if ((curFile<(nbFiles-9)) && (nbFiles)) { - curFile += 9; - menuRedraw=true; - } - else if ((curFile<(nbFiles-1)) && (nbFiles)) { - curFile++; - menuRedraw=true; - } - } - else if ( (bClick & MASK_KEY_USER2) ) { - emu_SwapJoysticks(0); - menuRedraw=true; - } - - if (menuRedraw && nbFiles) { - int fileIndex = 0; - tft.drawRectNoDma(MENU_FILE_XOFFSET,MENU_FILE_YOFFSET, MENU_FILE_W, MENU_FILE_H, MENU_FILE_BGCOLOR); -// if (curFile <= (MAX_MENULINES/2-1)) topFile=0; -// else topFile=curFile-(MAX_MENULINES/2); - if (curFile <= (MAX_MENULINES-1)) topFile=0; - else topFile=curFile-(MAX_MENULINES/2); - - //Serial.print("curfile: "); - //Serial.println(curFile); - //Serial.print("topFile: "); - //Serial.println(topFile); - - int i=0; - while (i=nbFiles) { - // no more files - break; - } - char * filename = &files[fileIndex][0]; - if (fileIndex >= topFile) { - if ((i+topFile) < nbFiles ) { - if ((i+topFile)==curFile) { - tft.drawTextNoDma(MENU_FILE_XOFFSET,i*TEXT_HEIGHT+MENU_FILE_YOFFSET, filename, RGBVAL16(0xff,0xff,0x00), RGBVAL16(0xff,0x00,0x00), true); - strcpy(selection,filename); - } - else { - tft.drawTextNoDma(MENU_FILE_XOFFSET,i*TEXT_HEIGHT+MENU_FILE_YOFFSET, filename, RGBVAL16(0xff,0xff,0xff), MENU_FILE_BGCOLOR, true); - } - } - i++; - } - fileIndex++; - } - - - tft.drawTextNoDma(48,MENU_JOYS_YOFFSET+8, (emu_SwapJoysticks(1)?(char*)"SWAP=1":(char*)"SWAP=0"), RGBVAL16(0x00,0xff,0xff), RGBVAL16(0x00,0x00,0xff), false); - menuRedraw=false; - } - - return (action); -} - -bool menuActive(void) -{ - return (menuOn); -} - -void toggleMenu(bool on) { - if (on) { - menuOn = true; - backgroundMenu(); - } else { - menuOn = false; - } -} - -char * menuSelection(void) -{ - return (selection); -} - - - - - - - - - -int emu_FileOpen(char * filename) -{ - int retval = 0; - - char filepath[80]; - strcpy(filepath, romspath); - strcat(filepath, "/"); - strcat(filepath, filename); - emu_printf("FileOpen..."); - emu_printf(filepath); - if( !(f_open(&file, filepath, FA_READ)) ) { - retval = 1; - } - else { - emu_printf("FileOpen failed"); - } - return (retval); -} - -int emu_FileRead(char * buf, int size) -{ - unsigned char buffer[256]; - int remaining = size; - int byteread = 0; - unsigned int retval=0; - if (size < 256) { - if( !(f_read (&file, buffer, size, &retval)) ) - if (retval>0) { - memcpy(buf,buffer,retval); - byteread += retval; - } - } - else { - while (remaining>0) { - if( !(f_read (&file, buffer, 256, &retval)) ) - //f_read (&file, buffer, 256, &retval); - if (retval>0) { - //emu_printi(retval); - memcpy(buf,buffer,retval); - buf += retval; - byteread += retval; - remaining -= retval; - } - else { - break; - } - } - } - return byteread; -} - -unsigned char emu_FileGetc(void) { - unsigned char c; - unsigned int retval=0; - if( !(f_read (&file, &c, 1, &retval)) ) - if (retval != 1) { - emu_printf("emu_FileGetc failed"); - } - return c; -} - - -void emu_FileClose(void) -{ - f_close(&file); -} - -int emu_FileSize(char * filename) -{ - int filesize=0; - char filepath[80]; - strcpy(filepath, romspath); - strcat(filepath, "/"); - strcat(filepath, filename); - emu_printf("FileSize..."); - emu_printf(filepath); - FILINFO entry; - f_stat(filepath, &entry); - filesize = entry.fsize; - return(filesize); -} - - -#ifdef SDIO - -int emu_FileSeek(int seek) -{ -#ifdef USE_SDFS - f_lseek(&file, seek); -#else - file.seek(seek); -#endif - return (seek); -} - -int emu_FileTell(void) -{ -#ifdef USE_SDFS - return (f_tell(&file)); -#else - return (50); -#endif -} - - -int emu_LoadFile(char * filename, char * buf, int size) -{ - int filesize = 0; - - char filepath[80]; - strcpy(filepath, romspath); - strcat(filepath, "/"); - strcat(filepath, filename); - emu_printf("LoadFile..."); - emu_printf(filepath); -#ifdef USE_SDFS - if( !(f_open(&file, filepath, FA_READ)) ) { - filesize = f_size(&file); - emu_printf(filesize); - if (size >= filesize) - { - int retval=0; - if( (f_read (&file, buf, filesize, &retval)) ) { - emu_printf("File read failed"); - } - } - f_close(&file); - } -#else - if ((file = SD.open(filepath, O_READ))) - { - filesize = file.size(); - emu_printf(filesize); - - if (size >= filesize) - { - if (emu_FileRead(buf, filesize) != filesize) - { - emu_printf("File read failed"); - } - } - file.close(); - } -#endif - - return(filesize); -} - -int emu_LoadFileSeek(char * filename, char * buf, int size, int seek) -{ - int filesize = 0; - - char filepath[80]; - strcpy(filepath, romspath); - strcat(filepath, "/"); - strcat(filepath, filename); - emu_printf("LoadFileSeek..."); - emu_printf(filepath); -#ifdef USE_SDFS - if( !(f_open(&file, filepath, FA_READ)) ) { - f_lseek(&file, seek); - emu_printf(size); - if (size >= filesize) - { - int retval=0; - if( (!f_read (&file, buf, size, &retval)) ) - if (retval != size) - { - emu_printf("File read failed"); - } - } - f_close(&file); - } -#else - if ((file = SD.open(filepath, O_READ))) - { - file.seek(seek); - emu_printf(size); - if (file.read(buf, size) != size) { - emu_printf("File read failed"); - } - file.close(); - } -#endif - - return(filesize); -} -#endif - - - -void emu_init(void) -{ -#ifndef FAKESDIO - sd_init_driver(); - FRESULT fr = f_mount(&fatfs, "0:", 1); -#endif - - strcpy(romspath,ROMSDIR); - nbFiles = readNbFiles(romspath); - - emu_printf("SD initialized, files found: "); - emu_printi(nbFiles); - - emu_InitJoysticks(); -#ifdef SWAP_JOYSTICK - joySwapped = true; -#else - joySwapped = false; -#endif - - toggleMenu(true); -} - - -void emu_start(void) -{ - - usbnavpad = 0; - - keys = (unsigned short *)key_map1; - keyMap = 0; -} diff --git a/MCUME_pico/testio/emuapi.h b/MCUME_pico/testio/emuapi.h deleted file mode 100644 index bffe643..0000000 --- a/MCUME_pico/testio/emuapi.h +++ /dev/null @@ -1,152 +0,0 @@ -#ifndef EMUAPI_H -#define EMUAPI_H - -#include "platform_config.h" - -//#define TIMER_REND 1 -#define EXTRA_HEAP 0x10 - -// Title: < > -#define TITLE " ZX81/ZX80 Emulator" -#define ROMSDIR "z81" - -#define emu_Init(ROM) {z81_Start(ROM); z81_Init(); } -#define emu_Step(x) {z81_Step();} -#define emu_Input(x) {} - -#define PALETTE_SIZE 2 -#define VID_FRAME_SKIP 0x3 -#define TFT_VBUFFER_YCROP 0 -#define SINGLELINE_RENDERING 1 - -#define ACTION_NONE 0 -#define ACTION_MAXKBDVAL 225 -#define ACTION_EXITKBD 128 -#define ACTION_RUNTFT 129 -#define ACTION_RUNVGA 130 - -#ifdef KEYMAP_PRESENT - -#define TAREA_W_DEF 32 -#define TAREA_H_DEF 32 -#define TAREA_END 255 -#define TAREA_NEW_ROW 254 -#define TAREA_NEW_COL 253 -#define TAREA_XY 252 -#define TAREA_WH 251 - -#define KEYBOARD_X 10 -#define KEYBOARD_Y 8 -#define KEYBOARD_KEY_H 40 -#define KEYBOARD_KEY_W 30 -#define KEYBOARD_HIT_COLOR RGBVAL16(0xff,0x00,0x00) - -const unsigned short keyswzx80[] = { - TAREA_XY,KEYBOARD_X,KEYBOARD_Y+16, - TAREA_WH,KEYBOARD_KEY_W,KEYBOARD_KEY_H-6, - TAREA_NEW_ROW,30,30,30,30,30,30,30,30,30,30, - TAREA_NEW_ROW,30,30,30,30,30,30,30,30,30,30, - TAREA_NEW_ROW,30,30,30,30,30,30,30,30,30,30, - TAREA_NEW_ROW,30,30,30,30,30,30,30,30,30,30, - TAREA_END}; - -const unsigned short keyswzx81[] = { - TAREA_XY,KEYBOARD_X,KEYBOARD_Y, - TAREA_WH,KEYBOARD_KEY_W,KEYBOARD_KEY_H, - TAREA_NEW_ROW,30,30,30,30,30,30,30,30,30,30, - TAREA_NEW_ROW,30,30,30,30,30,30,30,30,30,30, - TAREA_NEW_ROW,30,30,30,30,30,30,30,30,30,30, - TAREA_NEW_ROW,30,30,30,30,30,30,30,30,30,30, - TAREA_END}; - -const unsigned short key_map1[] = { - 30,31,32,33,34,35,36,37,38,39, - 20,26, 8,21,23,28,25,12,18,19, - 4, 9, 7,22, 4,11,13,14,15,40, - 25, 6,27,29,224,5,17,16,225,44 - }; - -#ifdef HAS_I2CKBD -const unsigned short i2ckeys[] = { - 0X0080,0X0008,0X0180,0X0108,0X0280,0X0208,0X0380,0X0308,0X0480,0X0408, - 0X0040,0X0004,0X0140,0X0104,0X0240,0X0204,0X0340,0X0304,0X0440,0X0404, - 0X0020,0X0002,0X0120,0X0102,0X0220,0X0202,0X0320,0X0302,0X0420,0X0402, - 0X0010,0X0001,0X0110,0X0101,0X0210,0X0201,0X0310,0X0301,0X0410,0X0401, - }; -#endif - -#endif - -#define MASK_JOY2_RIGHT 0x0001 -#define MASK_JOY2_LEFT 0x0002 -#define MASK_JOY2_UP 0x0004 -#define MASK_JOY2_DOWN 0x0008 -#define MASK_JOY2_BTN 0x0010 -#define MASK_KEY_USER1 0x0020 -#define MASK_KEY_USER2 0x0040 -#define MASK_KEY_USER3 0x0080 -#define MASK_JOY1_RIGHT 0x0100 -#define MASK_JOY1_LEFT 0x0200 -#define MASK_JOY1_UP 0x0400 -#define MASK_JOY1_DOWN 0x0800 -#define MASK_JOY1_BTN 0x1000 -#define MASK_KEY_USER4 0x2000 - - -extern void emu_init(void); -extern void emu_start(void); -extern void emu_resetSD(void); - -extern void emu_printf(char * text); -extern void emu_printi(int val); -extern void * emu_Malloc(int size); -extern void emu_Free(void * pt); - -extern int emu_FileSystemInit(void); -extern int emu_FileOpen(char * filename); -extern int emu_FileRead(char * buf, int size); -extern unsigned char emu_FileGetc(void); -extern int emu_FileSeek(int seek); -extern void emu_FileClose(void); -extern int emu_FileSize(char * filename); -extern int emu_LoadFile(char * filename, char * buf, int size); -extern int emu_LoadFileSeek(char * filename, char * buf, int size, int seek); -extern void emu_FileTempInit(void); -extern void emu_FileTempRead(int addr, unsigned char * val, int n); -extern void emu_FileTempWrite(int addr, unsigned char val); - -extern void emu_SetPaletteEntry(unsigned char r, unsigned char g, unsigned char b, int index); -extern void emu_DrawScreen(unsigned char * VBuf, int width, int height, int stride); -extern void emu_DrawLine(unsigned char * VBuf, int width, int height, int line); -extern void emu_DrawLine8(unsigned char * VBuf, int width, int height, int line); -extern void emu_DrawLine16(unsigned short * VBuf, int width, int height, int line); -extern void emu_DrawVsync(void); -extern int emu_FrameSkip(void); -extern void * emu_LineBuffer(int line); - -extern void emu_InitJoysticks(void); -extern int emu_SwapJoysticks(int statusOnly); -extern unsigned short emu_DebounceLocalKeys(void); -extern int emu_ReadKeys(void); -extern int emu_GetPad(void); -extern int emu_ReadAnalogJoyX(int min, int max); -extern int emu_ReadAnalogJoyY(int min, int max); -extern int emu_ReadI2CKeyboard(void); -extern void emu_KeyboardOnUp(int keymodifer, int key); -extern void emu_KeyboardOnDown(int keymodifer, int key); - -extern void emu_sndPlaySound(int chan, int volume, int freq); -extern void emu_sndPlayBuzz(int size, int val); -extern void emu_sndInit(); -extern void emu_resetus(void); -extern int emu_us(void); - -extern int emu_setKeymap(int index); - -extern void emu_FileTempInit(void); -extern void emu_FileTempRead(int addr, unsigned char * val, int n); -extern void emu_FileTempWrite(int addr, unsigned char val); -extern void emu_printh(int val); - - -#endif diff --git a/MCUME_pico/testio/font8x8.h b/MCUME_pico/testio/font8x8.h deleted file mode 100644 index 4f773da..0000000 --- a/MCUME_pico/testio/font8x8.h +++ /dev/null @@ -1,135 +0,0 @@ - -// Font: c64_lower.64c - -const unsigned char font8x8[128][8] PROGMEM = -{ - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0000 (nul) - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0001 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0002 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0003 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0004 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0005 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0006 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0007 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0008 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0009 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000A - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000B - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000C - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000D - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000E - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000F - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0010 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0011 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0012 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0013 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0014 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0015 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0016 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0017 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0018 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0019 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001A - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001B - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001C - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001D - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001E - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001F - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0020 (space) - { 0x18, 0x3C, 0x3C, 0x18, 0x18, 0x00, 0x18, 0x00}, // U+0021 (!) - { 0x36, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0022 (") - { 0x36, 0x36, 0x7F, 0x36, 0x7F, 0x36, 0x36, 0x00}, // U+0023 (#) - { 0x0C, 0x3E, 0x03, 0x1E, 0x30, 0x1F, 0x0C, 0x00}, // U+0024 ($) - { 0x00, 0x63, 0x33, 0x18, 0x0C, 0x66, 0x63, 0x00}, // U+0025 (%) - { 0x1C, 0x36, 0x1C, 0x6E, 0x3B, 0x33, 0x6E, 0x00}, // U+0026 (&) - { 0x06, 0x06, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0027 (') - { 0x18, 0x0C, 0x06, 0x06, 0x06, 0x0C, 0x18, 0x00}, // U+0028 (() - { 0x06, 0x0C, 0x18, 0x18, 0x18, 0x0C, 0x06, 0x00}, // U+0029 ()) - { 0x00, 0x66, 0x3C, 0xFF, 0x3C, 0x66, 0x00, 0x00}, // U+002A (*) - { 0x00, 0x0C, 0x0C, 0x3F, 0x0C, 0x0C, 0x00, 0x00}, // U+002B (+) - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x0C, 0x06}, // U+002C (,) - { 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x00}, // U+002D (-) - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x0C, 0x00}, // U+002E (.) - { 0x60, 0x30, 0x18, 0x0C, 0x06, 0x03, 0x01, 0x00}, // U+002F (/) - { 0x3E, 0x63, 0x73, 0x7B, 0x6F, 0x67, 0x3E, 0x00}, // U+0030 (0) - { 0x0C, 0x0E, 0x0C, 0x0C, 0x0C, 0x0C, 0x3F, 0x00}, // U+0031 (1) - { 0x1E, 0x33, 0x30, 0x1C, 0x06, 0x33, 0x3F, 0x00}, // U+0032 (2) - { 0x1E, 0x33, 0x30, 0x1C, 0x30, 0x33, 0x1E, 0x00}, // U+0033 (3) - { 0x38, 0x3C, 0x36, 0x33, 0x7F, 0x30, 0x78, 0x00}, // U+0034 (4) - { 0x3F, 0x03, 0x1F, 0x30, 0x30, 0x33, 0x1E, 0x00}, // U+0035 (5) - { 0x1C, 0x06, 0x03, 0x1F, 0x33, 0x33, 0x1E, 0x00}, // U+0036 (6) - { 0x3F, 0x33, 0x30, 0x18, 0x0C, 0x0C, 0x0C, 0x00}, // U+0037 (7) - { 0x1E, 0x33, 0x33, 0x1E, 0x33, 0x33, 0x1E, 0x00}, // U+0038 (8) - { 0x1E, 0x33, 0x33, 0x3E, 0x30, 0x18, 0x0E, 0x00}, // U+0039 (9) - { 0x00, 0x0C, 0x0C, 0x00, 0x00, 0x0C, 0x0C, 0x00}, // U+003A (:) - { 0x00, 0x0C, 0x0C, 0x00, 0x00, 0x0C, 0x0C, 0x06}, // U+003B (//) - { 0x18, 0x0C, 0x06, 0x03, 0x06, 0x0C, 0x18, 0x00}, // U+003C (<) - { 0x00, 0x00, 0x3F, 0x00, 0x00, 0x3F, 0x00, 0x00}, // U+003D (=) - { 0x06, 0x0C, 0x18, 0x30, 0x18, 0x0C, 0x06, 0x00}, // U+003E (>) - { 0x1E, 0x33, 0x30, 0x18, 0x0C, 0x00, 0x0C, 0x00}, // U+003F (?) - { 0x3E, 0x63, 0x7B, 0x7B, 0x7B, 0x03, 0x1E, 0x00}, // U+0040 (@) - { 0x0C, 0x1E, 0x33, 0x33, 0x3F, 0x33, 0x33, 0x00}, // U+0041 (A) - { 0x3F, 0x66, 0x66, 0x3E, 0x66, 0x66, 0x3F, 0x00}, // U+0042 (B) - { 0x3C, 0x66, 0x03, 0x03, 0x03, 0x66, 0x3C, 0x00}, // U+0043 (C) - { 0x1F, 0x36, 0x66, 0x66, 0x66, 0x36, 0x1F, 0x00}, // U+0044 (D) - { 0x7F, 0x46, 0x16, 0x1E, 0x16, 0x46, 0x7F, 0x00}, // U+0045 (E) - { 0x7F, 0x46, 0x16, 0x1E, 0x16, 0x06, 0x0F, 0x00}, // U+0046 (F) - { 0x3C, 0x66, 0x03, 0x03, 0x73, 0x66, 0x7C, 0x00}, // U+0047 (G) - { 0x33, 0x33, 0x33, 0x3F, 0x33, 0x33, 0x33, 0x00}, // U+0048 (H) - { 0x1E, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+0049 (I) - { 0x78, 0x30, 0x30, 0x30, 0x33, 0x33, 0x1E, 0x00}, // U+004A (J) - { 0x67, 0x66, 0x36, 0x1E, 0x36, 0x66, 0x67, 0x00}, // U+004B (K) - { 0x0F, 0x06, 0x06, 0x06, 0x46, 0x66, 0x7F, 0x00}, // U+004C (L) - { 0x63, 0x77, 0x7F, 0x7F, 0x6B, 0x63, 0x63, 0x00}, // U+004D (M) - { 0x63, 0x67, 0x6F, 0x7B, 0x73, 0x63, 0x63, 0x00}, // U+004E (N) - { 0x1C, 0x36, 0x63, 0x63, 0x63, 0x36, 0x1C, 0x00}, // U+004F (O) - { 0x3F, 0x66, 0x66, 0x3E, 0x06, 0x06, 0x0F, 0x00}, // U+0050 (P) - { 0x1E, 0x33, 0x33, 0x33, 0x3B, 0x1E, 0x38, 0x00}, // U+0051 (Q) - { 0x3F, 0x66, 0x66, 0x3E, 0x36, 0x66, 0x67, 0x00}, // U+0052 (R) - { 0x1E, 0x33, 0x07, 0x0E, 0x38, 0x33, 0x1E, 0x00}, // U+0053 (S) - { 0x3F, 0x2D, 0x0C, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+0054 (T) - { 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x3F, 0x00}, // U+0055 (U) - { 0x33, 0x33, 0x33, 0x33, 0x33, 0x1E, 0x0C, 0x00}, // U+0056 (V) - { 0x63, 0x63, 0x63, 0x6B, 0x7F, 0x77, 0x63, 0x00}, // U+0057 (W) - { 0x63, 0x63, 0x36, 0x1C, 0x1C, 0x36, 0x63, 0x00}, // U+0058 (X) - { 0x33, 0x33, 0x33, 0x1E, 0x0C, 0x0C, 0x1E, 0x00}, // U+0059 (Y) - { 0x7F, 0x63, 0x31, 0x18, 0x4C, 0x66, 0x7F, 0x00}, // U+005A (Z) - { 0x1E, 0x06, 0x06, 0x06, 0x06, 0x06, 0x1E, 0x00}, // U+005B ([) - { 0x03, 0x06, 0x0C, 0x18, 0x30, 0x60, 0x40, 0x00}, // U+005C (\) - { 0x1E, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1E, 0x00}, // U+005D (]) - { 0x08, 0x1C, 0x36, 0x63, 0x00, 0x00, 0x00, 0x00}, // U+005E (^) - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF}, // U+005F (_) - { 0x0C, 0x0C, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0060 (`) - { 0x00, 0x00, 0x1E, 0x30, 0x3E, 0x33, 0x6E, 0x00}, // U+0061 (a) - { 0x07, 0x06, 0x06, 0x3E, 0x66, 0x66, 0x3B, 0x00}, // U+0062 (b) - { 0x00, 0x00, 0x1E, 0x33, 0x03, 0x33, 0x1E, 0x00}, // U+0063 (c) - { 0x38, 0x30, 0x30, 0x3e, 0x33, 0x33, 0x6E, 0x00}, // U+0064 (d) - { 0x00, 0x00, 0x1E, 0x33, 0x3f, 0x03, 0x1E, 0x00}, // U+0065 (e) - { 0x1C, 0x36, 0x06, 0x0f, 0x06, 0x06, 0x0F, 0x00}, // U+0066 (f) - { 0x00, 0x00, 0x6E, 0x33, 0x33, 0x3E, 0x30, 0x1F}, // U+0067 (g) - { 0x07, 0x06, 0x36, 0x6E, 0x66, 0x66, 0x67, 0x00}, // U+0068 (h) - { 0x0C, 0x00, 0x0E, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+0069 (i) - { 0x30, 0x00, 0x30, 0x30, 0x30, 0x33, 0x33, 0x1E}, // U+006A (j) - { 0x07, 0x06, 0x66, 0x36, 0x1E, 0x36, 0x67, 0x00}, // U+006B (k) - { 0x0E, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+006C (l) - { 0x00, 0x00, 0x33, 0x7F, 0x7F, 0x6B, 0x63, 0x00}, // U+006D (m) - { 0x00, 0x00, 0x1F, 0x33, 0x33, 0x33, 0x33, 0x00}, // U+006E (n) - { 0x00, 0x00, 0x1E, 0x33, 0x33, 0x33, 0x1E, 0x00}, // U+006F (o) - { 0x00, 0x00, 0x3B, 0x66, 0x66, 0x3E, 0x06, 0x0F}, // U+0070 (p) - { 0x00, 0x00, 0x6E, 0x33, 0x33, 0x3E, 0x30, 0x78}, // U+0071 (q) - { 0x00, 0x00, 0x3B, 0x6E, 0x66, 0x06, 0x0F, 0x00}, // U+0072 (r) - { 0x00, 0x00, 0x3E, 0x03, 0x1E, 0x30, 0x1F, 0x00}, // U+0073 (s) - { 0x08, 0x0C, 0x3E, 0x0C, 0x0C, 0x2C, 0x18, 0x00}, // U+0074 (t) - { 0x00, 0x00, 0x33, 0x33, 0x33, 0x33, 0x6E, 0x00}, // U+0075 (u) - { 0x00, 0x00, 0x33, 0x33, 0x33, 0x1E, 0x0C, 0x00}, // U+0076 (v) - { 0x00, 0x00, 0x63, 0x6B, 0x7F, 0x7F, 0x36, 0x00}, // U+0077 (w) - { 0x00, 0x00, 0x63, 0x36, 0x1C, 0x36, 0x63, 0x00}, // U+0078 (x) - { 0x00, 0x00, 0x33, 0x33, 0x33, 0x3E, 0x30, 0x1F}, // U+0079 (y) - { 0x00, 0x00, 0x3F, 0x19, 0x0C, 0x26, 0x3F, 0x00}, // U+007A (z) - { 0x38, 0x0C, 0x0C, 0x07, 0x0C, 0x0C, 0x38, 0x00}, // U+007B ({) - { 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x00}, // U+007C (|) - { 0x07, 0x0C, 0x0C, 0x38, 0x0C, 0x0C, 0x07, 0x00}, // U+007D (}) - { 0x6E, 0x3B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+007E (~) - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} // U+007F -}; - diff --git a/MCUME_pico/testio/iopins.h b/MCUME_pico/testio/iopins.h deleted file mode 100644 index a636576..0000000 --- a/MCUME_pico/testio/iopins.h +++ /dev/null @@ -1,42 +0,0 @@ -#ifndef IOPINS_H -#define IOPINS_H - -#include "platform_config.h" - - -// VGA (see in code!!!) -/* -2-9 RRRGGGBB -10-11 VSYNC and HSYNC -*/ - -// SD (see SPI0 in code!!!) -/* -#define SD_SCLK 18 -#define SD_MOSI 19 -#define SD_MISO 16 -#define SD_CS 17 -*/ - -// I2C keyboard (not used) -/* -#define I2C_SCL_IO 15? -#define I2C_SDA_IO 14? -*/ - -// Analog joystick (primary) for JOY2 and 3 extra buttons -#define PIN_JOY2_A1X 26 -#define PIN_JOY2_A2Y 27 -#define PIN_JOY2_BTN 22 -#define PIN_KEY_USER1 20 -#define PIN_KEY_USER2 21 - -// Second joystick -//#define PIN_JOY1_BTN 2 -//#define PIN_JOY1_1 14 // UP -//#define PIN_JOY1_2 7 // DOWN -//#define PIN_JOY1_3 6 // RIGHT -//#define PIN_JOY1_4 5 // LEFT - - -#endif diff --git a/MCUME_pico/testio/keyboard_osd.h b/MCUME_pico/testio/keyboard_osd.h deleted file mode 100644 index 081bcdd..0000000 --- a/MCUME_pico/testio/keyboard_osd.h +++ /dev/null @@ -1,21 +0,0 @@ - -#ifndef keyboard_osd_h_ -#define keyboard_osd_h_ - -extern bool virtualkeyboardIsActive(void); -extern void drawVirtualkeyboard(void); -extern void toggleVirtualkeyboard(bool keepOn); -extern void handleVirtualkeyboard(void); - -extern bool callibrationActive(void); -extern int handleCallibration(uint16_t bClick); - -extern bool menuActive(void); -extern char * menuSelection(void); -extern void toggleMenu(bool on); -extern int handleMenu(uint16_t bClick); - - -#endif - - diff --git a/MCUME_pico/testio/platform_config.h b/MCUME_pico/testio/platform_config.h deleted file mode 100644 index d9351ab..0000000 --- a/MCUME_pico/testio/platform_config.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef _PLATFORM_CONFIG_H_ -#define _PLATFORM_CONFIG_H_ - - -#define HAS_SND 1 -//#define INVX 1 -//#define INVY 1 -//#define HAS_USBKEY 1 -//#define HAS_I2CKBD 1 - -//#define ILI9341 1 -//#define ST7789 1 -//#define SWAP_JOYSTICK 1 -//#define LOHRES 1 -//#define ROTATE_SCREEN 1 -//#define EXTERNAL_SD 1 - -//#define HAS_PSRAM 1 - -//#define USE_SDFAT 1 -//#define SD_FAT_TYPE 1 -//#define USE_SDFS 1 -//#define SDFSDEV "1:" - -#endif diff --git a/MCUME_pico/testio/rock.h b/MCUME_pico/testio/rock.h deleted file mode 100755 index b5d1393..0000000 --- a/MCUME_pico/testio/rock.h +++ /dev/null @@ -1,62303 +0,0 @@ -// Clip taken from audio sample 'Angus Lejeune Theme' by maxcruger at -// freesound: (https://freesound.org/people/maxcruger/sounds/556352/) licensed -// under CC BY 3.0: https://creativecommons.org/licenses/by/3.0/ -// 22 kHz sample rate with 8-bit samples. - -#define AUDIO_SAMPLES 62294 - -uint8_t audio_buffer[] = { -127, -127, -127, -128, -128, -127, -128, -127, -127, -127, -128, -127, -128, -127, -128, -127, -128, -128, -128, -127, -127, -127, -128, -127, -127, -127, -128, -128, -127, -127, -127, -128, -127, -127, -127, -127, -127, -128, -127, -128, -128, -127, -128, -127, -127, -127, -128, -127, -127, -127, -127, -127, -128, -128, -127, -128, -127, -128, -127, -127, -127, -128, -127, -128, -127, -128, -127, -128, -128, -127, -128, -128, -127, -128, -127, -128, -127, -128, -127, -128, -127, -127, -128, -127, -127, -128, -127, -128, -128, -127, -127, -127, -127, -127, -128, -127, -127, -128, -128, -127, -127, -127, -128, -127, -128, -127, -128, -127, -128, -127, -128, -127, -128, -128, -127, -128, -128, -127, -128, -127, -128, -128, -127, -128, -127, -128, -127, -128, -127, -128, -128, -128, -128, -128, -127, -128, -127, -128, -127, -128, -128, -128, -128, -128, -127, -128, -127, -127, -127, -128, -128, -128, -127, -128, -127, -127, -127, -128, -127, -127, -127, -127, -128, -127, -127, -127, -127, -128, -128, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -126, -127, -126, -127, -126, -127, -127, -127, -127, -126, -127, -127, -126, -127, -126, -127, -126, -127, -127, -126, -127, -127, -126, -127, -126, -127, -127, -127, -126, -127, -126, -127, -126, -127, -127, -127, -126, -127, -127, -127, -127, -127, -126, -126, -127, -126, -127, -126, -127, -127, -126, -127, -126, -127, -126, -127, -126, -127, -126, -127, -126, -127, -127, -127, -126, -127, -127, -128, -128, -126, -127, -126, -128, -127, -127, -128, -128, -127, -128, -127, -127, -127, -127, -127, -127, -127, -128, -128, -127, -128, -128, -127, -128, -128, -127, -128, -127, -128, -127, -127, -127, -127, -128, -127, -128, -127, -128, -127, -128, -128, -128, -128, -128, -127, -128, -128, -127, -128, -127, -128, -128, -127, -128, -127, -128, -127, -128, -128, -127, -128, -127, -128, -127, -128, -127, -128, -127, -128, -127, -128, -127, -128, -127, -128, -127, -128, -127, -128, -128, -128, -127, -128, -127, -128, -127, -128, -127, -128, -128, -128, -128, -128, -127, -128, -128, -128, -128, -128, -127, -128, -127, -127, -127, -128, -128, -128, -128, -128, -127, -128, -128, -127, -128, -127, -128, -128, -128, -127, -127, -127, -127, -127, -127, -126, -127, -126, -127, -128, -127, -127, -126, -127, -127, -126, -127, -127, -126, -127, -127, -128, -127, -128, -127, -128, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -126, -127, -127, -127, -127, -127, -128, -127, -127, -126, -127, -127, -127, -127, -127, -126, -127, -127, -127, -127, -127, -128, -127, -128, -127, -128, -127, -127, -127, -127, -128, -127, -127, -127, -127, -128, -127, -127, -128, -127, -128, -127, -127, -128, -128, -127, -128, -127, -128, -128, -127, -128, -128, -127, -127, -128, -127, -127, -127, -128, -127, -128, -127, -128, -127, -128, -127, -128, -127, -128, -128, -127, -128, -128, -127, -128, -127, -128, -127, -128, -128, -128, -128, -127, -128, -127, -128, -127, -128, -127, -128, -128, -127, -128, -127, -128, -127, -128, -128, -128, -127, -128, -127, -128, -128, -127, -128, -127, -128, -127, -128, -127, -128, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -128, -127, -127, -127, -127, -128, -127, -128, -128, -127, -128, -128, -127, -128, -127, -128, -127, -128, -127, -128, -127, -127, -127, -128, -128, -128, -127, -128, -128, -127, -128, -128, -127, -128, -127, -128, -127, -128, -127, -128, -127, -128, -128, -127, -128, -128, -127, -128, -127, -128, -128, -127, -128, -127, -128, -128, -127, -128, -128, -127, -128, -127, -128, -127, -127, -127, -127, -127, -128, -127, -128, -128, -127, -128, -127, -127, -127, -127, -127, -127, -126, -127, -127, -126, -127, -126, -127, -127, -126, -127, -127, -126, -127, -127, -126, -127, -126, -127, -127, -126, -127, -127, -127, -126, -127, -126, -127, -127, -127, -126, -127, -126, -127, -126, -127, -126, -127, -126, -127, -127, -126, -127, -126, -127, -126, -127, -127, -127, -126, -127, -126, -127, -127, -126, -127, -126, -127, -127, -127, -127, -127, -127, -126, -127, -126, -127, -128, -126, -127, -126, -127, -127, -127, -128, -127, -127, -128, -127, -128, -127, -128, -127, -127, -128, -128, -128, -128, -127, -128, -128, -128, -128, -127, -128, -127, -128, -127, -128, -127, -128, -127, -128, -127, -128, -127, -127, -128, -127, -128, -128, -127, -128, -127, -128, -127, -128, -127, -128, -127, -127, -127, -128, -128, -128, -127, -128, -127, -128, -127, -128, -127, -128, -127, -128, -127, -128, -127, -128, -127, -128, -127, -128, -127, -128, -127, -128, -127, -127, -127, -128, -127, -127, -127, -128, -128, -127, -128, -127, -128, -128, -127, -128, -127, -128, -127, -128, -127, -128, -127, -128, -128, -127, -128, -127, -128, -127, -128, -127, -128, -127, -128, -127, -127, -127, -128, -127, -128, -127, -128, -128, -128, -127, -128, -127, -128, -127, -128, -127, -128, -128, -127, -128, -128, -128, -128, -128, -127, -128, -127, -128, -127, -128, -127, -128, -127, -127, -127, -128, -127, -128, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -126, -127, -127, -127, -127, -127, -126, -127, -126, -127, -127, -127, -127, -127, -127, -126, -127, -127, -127, -126, -127, -126, -127, -127, -127, -127, -126, -127, -127, -127, -127, -127, -128, -127, -127, -127, -127, -128, -128, -127, -128, -127, -128, -127, -128, -127, -128, -128, -127, -128, -127, -128, -127, -128, -127, -128, -127, -128, -127, -128, -128, -127, -128, -127, -128, -127, -128, -127, -128, -127, -128, -127, -128, -127, -128, -127, -128, -128, -127, -128, -127, -128, -127, -128, -128, -127, -128, -127, -128, -127, -128, -127, -128, -127, -128, -128, -127, -128, -127, -128, -128, -128, -128, -127, -128, -127, -128, -127, -128, -128, -127, -128, -127, -128, -128, -127, -128, -126, -127, -127, -128, -127, -128, -127, -128, -127, -128, -127, -127, -128, -127, -128, -128, -127, -128, -128, -127, -128, -127, -128, -127, -128, -127, -128, -127, -128, -127, -128, -127, -127, -127, -128, -127, -128, -127, -128, -127, -128, -128, -128, -128, -127, -128, -127, -128, -128, -127, -128, -127, -128, -128, -127, -127, -127, -128, -127, -128, -128, -127, -128, -126, -127, -127, -127, -127, -126, -128, -127, -128, -127, -128, -127, -127, -126, -127, -126, -127, -126, -127, -126, -127, -126, -127, -127, -126, -127, -126, -127, -126, -127, -126, -127, -127, -126, -127, -126, -127, -126, -127, -126, -126, -127, -126, -127, -126, -127, -126, -127, -126, -127, -127, -127, -127, -126, -127, -126, -127, -127, -126, -127, -126, -127, -126, -127, -127, -126, -127, -126, -127, -126, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -128, -127, -127, -127, -127, -127, -127, -127, -127, -127, -128, -127, -128, -127, -128, -127, -128, -127, -128, -127, -128, -128, -128, -128, -128, -127, -128, -127, -128, -127, -128, -127, -128, -128, -127, -128, -127, -127, -128, -127, -128, -128, -127, -128, -127, -128, -127, -128, -127, -128, -127, -128, -127, -128, -127, -128, -128, -127, -128, -127, -127, -128, -127, -128, -128, -127, -128, -127, -128, -128, -127, -128, -128, -128, -128, -127, -126, -127, -127, -127, -127, -126, -127, -126, -127, -127, -127, -127, -127, -127, -127, -126, -127, -126, -127, -127, -127, -128, -127, -127, -127, -128, -127, -127, -126, -127, -127, -128, -127, -127, -127, -127, -127, -127, -127, -127, -128, -127, -127, -128, -127, -128, -128, -127, -128, -127, -128, -127, -127, -126, -127, -127, -126, -127, -127, -128, -127, -126, -127, -127, -127, -127, -127, -126, -127, -127, -127, -127, -126, -128, -126, -126, -128, -127, -128, -127, -128, -127, -128, -127, -128, -127, -128, -127, -127, -127, -127, -127, -128, -127, -128, -127, -127, -127, -128, -127, -128, -127, -128, -127, -128, -127, -128, -127, -128, -128, -127, -128, -128, -127, -128, -127, -128, -128, -127, -128, -127, -128, -127, -128, -128, -127, -128, -127, -128, -128, -128, -127, -128, -127, -128, -127, -128, -128, -127, -128, -127, -128, -127, -128, -128, -127, -128, -127, -127, -127, -127, -128, -127, -128, -127, -128, -127, -128, -127, -128, -128, -128, -127, -128, -127, -128, -127, -128, -127, -128, -127, -128, -128, -127, -128, -128, -128, -127, -128, -127, -128, -127, -128, -128, -128, -128, -127, -128, -127, -128, -127, -127, -128, -127, -128, -127, -128, -127, -128, -127, -128, -127, -128, -128, -127, -128, -128, -128, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -128, -128, -128, -128, -128, -128, -127, -127, -127, -128, -127, -128, -127, -128, -127, -127, -128, -127, -127, -127, -127, -127, -127, -128, -127, -128, -127, -128, -127, -127, -127, -128, -128, -127, -128, -128, -127, -128, -128, -127, -128, -127, -128, -127, -128, -128, -128, -127, -128, -127, -128, -128, -127, -128, -127, -127, -128, -128, -127, -128, -128, -127, -128, -128, -127, -128, -127, -127, -128, -127, -127, -127, -126, -127, -127, -126, -127, -126, -127, -126, -127, -127, -127, -127, -127, -126, -127, -126, -127, -126, -126, -127, -126, -127, -126, -126, -127, -126, -127, -127, -127, -126, -127, -126, -127, -126, -127, -126, -127, -127, -126, -127, -126, -127, -126, -127, -126, -127, -126, -127, -127, -126, -127, -126, -127, -127, -127, -126, -127, -126, -127, -127, -127, -127, -127, -127, -127, -126, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -128, -127, -127, -127, -128, -127, -128, -127, -127, -128, -127, -127, -127, -128, -128, -127, -128, -127, -127, -127, -128, -127, -128, -127, -128, -127, -128, -127, -128, -128, -127, -128, -127, -128, -128, -127, -128, -127, -128, -127, -128, -128, -127, -128, -127, -128, -127, -128, -127, -128, -127, -128, -128, -127, -128, -128, -127, -128, -127, -128, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -128, -127, -128, -127, -127, -127, -128, -127, -127, -127, -128, -127, -128, -128, -128, -128, -127, -127, -128, -127, -127, -127, -127, -127, -128, -127, -128, -127, -128, -128, -127, -128, -127, -128, -128, -127, -128, -127, -128, -127, -127, -128, -127, -127, -127, -126, -127, -126, -127, -127, -126, -127, -126, -127, -126, -127, -127, -127, -127, -127, -126, -128, -128, -127, -128, -127, -127, -127, -127, -126, -127, -127, -127, -127, -127, -126, -127, -127, -127, -127, -126, -127, -127, -127, -127, -126, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -126, -128, -127, -128, -127, -128, -127, -128, -127, -128, -127, -128, -128, -127, -128, -127, -128, -127, -128, -127, -127, -127, -127, -128, -127, -127, -127, -128, -127, -128, -127, -128, -128, -128, -128, -128, -128, -127, -128, -127, -128, -127, -128, -127, -128, -127, -128, -127, -128, -127, -128, -127, -127, -128, -128, -127, -128, -127, -128, -127, -128, -127, -128, -127, -128, -127, -128, -128, -128, -128, -127, -128, -127, -128, -128, -127, -128, -127, -128, -128, -127, -128, -127, -127, -128, -127, -128, -127, -128, -127, -127, -128, -127, -127, -127, -128, -127, -127, -128, -127, -127, -127, -128, -128, -128, -127, -128, -127, -127, -127, -127, -128, -127, -128, -127, -128, -128, -127, -128, -127, -127, -127, -127, -127, -128, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -126, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -128, -127, -127, -127, -127, -127, -127, -127, -126, -127, -127, -126, -127, -126, -127, -126, -126, -127, -126, -127, -126, -127, -127, -126, -127, -126, -127, -126, -127, -127, -126, -127, -127, -127, -126, -127, -126, -127, -126, -127, -126, -127, -126, -127, -127, -126, -127, -126, -126, -127, -126, -127, -126, -127, -126, -127, -127, -126, -127, -126, -127, -126, -127, -126, -127, -126, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -128, -127, -127, -127, -127, -127, -127, -127, -127, -128, -127, -128, -127, -128, -127, -127, -127, -128, -127, -128, -127, -128, -127, -128, -128, -127, -127, -127, -127, -127, -127, -127, -128, -127, -127, -128, -128, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -128, -127, -128, -127, -127, -128, -127, -128, -127, -128, -127, -128, -127, -128, -128, -128, -128, -127, -127, -128, -128, -128, -127, -128, -128, -128, -127, -128, -127, -128, -127, -128, -127, -128, -127, -128, -127, -128, -127, -128, -127, -127, -128, -127, -128, -128, -127, -128, -128, -127, -128, -127, -128, -127, -128, -127, -128, -127, -127, -127, -128, -127, -128, -128, -127, -128, -127, -128, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -128, -127, -128, -127, -127, -128, -127, -127, -128, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -128, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -126, -127, -126, -127, -126, -127, -126, -127, -126, -127, -126, -127, -127, -127, -127, -127, -126, -127, -126, -127, -127, -127, -128, -127, -128, -127, -127, -127, -127, -128, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -128, -127, -128, -127, -128, -127, -128, -127, -128, -127, -128, -127, -128, -127, -128, -127, -128, -128, -127, -128, -127, -128, -127, -128, -127, -128, -127, -128, -127, -128, -128, -127, -128, -127, -128, -127, -128, -127, -128, -128, -128, -127, -128, -128, -127, -128, -127, -128, -128, -127, -128, -127, -128, -127, -128, -128, -128, -128, -127, -128, -128, -127, -128, -127, -128, -127, -128, -128, -128, -128, -127, -128, -127, -128, -127, -127, -128, -128, -127, -128, -127, -128, -127, -127, -128, -127, -128, -127, -128, -128, -127, -128, -127, -128, -127, -128, -127, -128, -127, -128, -127, -128, -128, -127, -128, -127, -128, -127, -128, -127, -128, -127, -128, -127, -128, -127, -128, -127, -128, -127, -128, -127, -127, -127, -128, -127, -128, -127, -127, -127, -128, -127, -127, -127, -127, -127, -127, -128, -127, -128, -128, -128, -128, -127, -127, -126, -127, -126, -127, -127, -127, -126, -127, -126, -127, -126, -127, -126, -127, -126, -127, -127, -126, -127, -126, -127, -126, -127, -126, -127, -126, -127, -126, -127, -127, -126, -127, -126, -127, -127, -127, -126, -127, -126, -127, -127, -126, -127, -126, -127, -127, -126, -127, -126, -127, -127, -126, -127, -126, -127, -127, -127, -126, -127, -127, -126, -127, -127, -127, -127, -127, -126, -127, -126, -128, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -128, -128, -128, -127, -128, -128, -127, -128, -127, -128, -127, -128, -127, -128, -128, -127, -128, -127, -128, -127, -128, -127, -128, -128, -127, -128, -127, -128, -128, -128, -127, -128, -127, -128, -127, -128, -128, -127, -128, -127, -128, -128, -128, -127, -128, -128, -128, -128, -127, -128, -127, -128, -127, -128, -127, -128, -127, -128, -128, -127, -128, -128, -128, -127, -128, -127, -127, -127, -127, -127, -127, -127, -128, -127, -127, -127, -127, -127, -127, -128, -127, -128, -127, -128, -128, -127, -128, -128, -127, -128, -127, -128, -127, -128, -127, -128, -127, -128, -127, -127, -127, -127, -127, -127, -128, -127, -127, -127, -127, -128, -127, -127, -128, -127, -128, -127, -128, -128, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -126, -127, -127, -127, -127, -127, -127, -127, -127, -127, -128, -128, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -126, -127, -127, -126, -127, -127, -127, -127, -127, -127, -126, -127, -127, -127, -127, -127, -126, -127, -127, -127, -126, -127, -126, -127, -127, -127, -127, -126, -127, -127, -127, -127, -127, -127, -127, -128, -127, -128, -127, -128, -127, -128, -127, -128, -128, -128, -127, -128, -127, -128, -127, -128, -127, -128, -127, -128, -127, -128, -127, -128, -128, -127, -128, -128, -127, -128, -127, -128, -127, -128, -127, -128, -127, -128, -127, -128, -127, -128, -127, -127, -128, -127, -128, -127, -128, -127, -128, -127, -128, -127, -128, -127, -128, -127, -128, -127, -128, -128, -127, -128, -128, -128, -128, -127, -128, -128, -127, -128, -127, -128, -128, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -126, -127, -126, -126, -127, -127, -126, -127, -126, -127, -127, -127, -127, -128, -128, -127, -128, -128, -128, -128, -127, -128, -127, -128, -127, -128, -128, -128, -127, -127, -127, -128, -127, -128, -127, -128, -126, -127, -127, -127, -127, -128, -127, -127, -127, -128, -128, -128, -127, -128, -127, -127, -127, -128, -127, -127, -126, -128, -128, -127, -128, -127, -128, -127, -127, -128, -127, -128, -127, -128, -127, -128, -128, -128, -128, -128, -129, -129, -128, -128, -128, -128, -127, -128, -127, -128, -128, -128, -128, -127, -128, -128, -127, -127, -127, -128, -128, -129, -129, -127, -127, -126, -126, -126, -126, -126, -125, -126, -124, -125, -125, -126, -126, -126, -125, -124, -124, -123, -123, -124, -124, -126, -126, -126, -125, -126, -124, -125, -124, -125, -124, -123, -122, -123, -124, -125, -126, -127, -127, -126, -125, -124, -124, -124, -126, -127, -128, -128, -126, -123, -121, -125, -131, -134, -135, -134, -135, -135, -133, -133, -133, -134, -133, -132, -132, -135, -137, -137, -137, -135, -132, -130, -130, -131, -133, -135, -136, -137, -135, -132, -129, -127, -128, -131, -135, -135, -130, -125, -122, -121, -122, -125, -118, -136, -134, -124, -124, -127, -127, -127, -131, -127, -140, -130, -121, -123, -126, -122, -120, -121, -124, -129, -125, -124, -129, -135, -136, -135, -131, -129, -129, -136, -143, -148, -148, -144, -139, -137, -139, -148, -154, -141, -127, -128, -136, -134, -135, -131, -122, -117, -108, -118, -134, -123, -114, -116, -124, -120, -121, -132, -128, -129, -134, -141, -127, -114, -121, -128, -117, -113, -131, -141, -130, -107, -111, -123, -124, -106, -102, -111, -124, -130, -120, -108, -99, -112, -124, -139, -133, -105, -95, -110, -132, -139, -153, -153, -122, -100, -97, -134, -165, -167, -162, -149, -136, -124, -122, -121, -121, -129, -131, -120, -105, -96, -104, -114, -110, -108, -120, -134, -139, -146, -154, -160, -162, -163, -163, -160, -154, -146, -141, -139, -141, -146, -149, -152, -153, -153, -152, -152, -147, -151, -156, -161, -164, -164, -162, -155, -155, -159, -163, -166, -169, -170, -168, -168, -164, -161, -161, -160, -161, -163, -163, -165, -164, -156, -147, -141, -142, -144, -144, -153, -156, -153, -155, -154, -150, -147, -150, -147, -147, -148, -149, -151, -151, -148, -137, -129, -125, -124, -128, -131, -131, -130, -129, -124, -124, -130, -130, -132, -134, -135, -136, -134, -130, -123, -119, -117, -116, -119, -122, -124, -124, -119, -110, -105, -100, -101, -103, -106, -104, -98, -93, -92, -99, -103, -104, -99, -97, -101, -104, -104, -107, -104, -100, -100, -104, -108, -109, -106, -105, -104, -106, -105, -103, -104, -100, -100, -101, -103, -103, -101, -102, -100, -99, -106, -108, -113, -111, -105, -99, -94, -100, -102, -105, -106, -106, -108, -108, -108, -107, -105, -105, -100, -103, -106, -105, -105, -103, -104, -100, -103, -109, -113, -116, -119, -115, -115, -109, -100, -94, -95, -103, -109, -119, -115, -110, -108, -111, -112, -113, -118, -122, -128, -129, -128, -119, -114, -110, -114, -118, -119, -114, -113, -117, -118, -120, -119, -117, -121, -124, -128, -127, -131, -139, -140, -141, -142, -147, -148, -150, -151, -149, -146, -137, -133, -133, -142, -148, -147, -142, -136, -134, -131, -134, -133, -136, -135, -140, -143, -146, -140, -134, -127, -125, -125, -128, -133, -133, -137, -139, -144, -144, -144, -143, -144, -147, -150, -149, -144, -138, -139, -143, -151, -159, -159, -163, -162, -160, -159, -156, -158, -161, -162, -164, -164, -165, -164, -165, -164, -164, -164, -161, -162, -164, -161, -156, -151, -152, -154, -160, -164, -164, -160, -158, -157, -156, -158, -163, -164, -163, -162, -159, -156, -151, -148, -144, -143, -144, -143, -141, -138, -138, -138, -138, -137, -136, -142, -146, -146, -140, -133, -129, -131, -134, -134, -133, -131, -128, -126, -124, -117, -113, -109, -113, -115, -113, -109, -106, -109, -111, -114, -114, -113, -113, -117, -121, -120, -117, -118, -123, -127, -131, -130, -127, -124, -122, -116, -109, -103, -102, -106, -108, -112, -114, -113, -107, -101, -97, -97, -98, -95, -94, -98, -98, -98, -99, -104, -112, -114, -116, -113, -112, -112, -108, -107, -107, -107, -111, -110, -107, -102, -97, -94, -93, -94, -97, -100, -102, -102, -103, -107, -113, -118, -119, -117, -109, -103, -101, -103, -109, -108, -103, -97, -99, -103, -105, -103, -104, -106, -106, -110, -111, -111, -114, -115, -120, -119, -119, -120, -129, -137, -142, -142, -135, -133, -129, -126, -121, -119, -118, -117, -116, -113, -112, -110, -108, -110, -115, -120, -126, -133, -142, -141, -139, -136, -131, -132, -133, -130, -132, -128, -126, -125, -121, -121, -117, -116, -114, -114, -115, -121, -126, -125, -123, -117, -111, -112, -117, -125, -133, -133, -132, -131, -130, -131, -132, -132, -133, -138, -139, -140, -137, -135, -135, -132, -132, -130, -129, -133, -136, -137, -135, -126, -124, -125, -127, -129, -131, -138, -143, -146, -145, -142, -136, -130, -128, -130, -136, -145, -152, -157, -156, -149, -140, -132, -130, -131, -126, -125, -126, -126, -125, -120, -114, -110, -111, -117, -121, -121, -119, -114, -108, -109, -109, -112, -117, -120, -122, -122, -121, -115, -112, -109, -109, -111, -112, -115, -112, -106, -102, -98, -96, -91, -90, -91, -93, -92, -90, -89, -94, -103, -108, -112, -113, -116, -122, -118, -109, -101, -100, -106, -110, -117, -117, -114, -113, -111, -107, -103, -101, -98, -98, -99, -99, -100, -107, -109, -110, -104, -97, -94, -90, -88, -88, -96, -105, -116, -120, -118, -113, -109, -110, -104, -98, -96, -99, -105, -108, -108, -102, -96, -99, -103, -106, -99, -91, -86, -92, -109, -114, -114, -109, -106, -109, -115, -121, -126, -126, -124, -120, -116, -113, -114, -119, -129, -142, -147, -144, -140, -139, -143, -144, -141, -141, -145, -148, -151, -149, -147, -143, -145, -148, -148, -149, -152, -157, -159, -161, -157, -154, -153, -151, -154, -155, -153, -152, -150, -150, -151, -147, -146, -150, -156, -160, -159, -155, -153, -154, -153, -157, -157, -157, -157, -159, -164, -163, -156, -145, -136, -137, -143, -155, -163, -167, -167, -163, -164, -167, -168, -165, -159, -158, -158, -163, -174, -175, -169, -155, -144, -142, -150, -165, -172, -164, -152, -140, -135, -140, -146, -152, -155, -159, -164, -165, -166, -170, -173, -169, -164, -163, -167, -175, -181, -179, -175, -172, -167, -165, -163, -162, -159, -159, -160, -158, -153, -148, -144, -151, -154, -156, -151, -146, -143, -141, -143, -141, -140, -141, -146, -154, -157, -159, -154, -147, -143, -141, -141, -139, -137, -137, -136, -140, -138, -134, -125, -116, -114, -116, -117, -121, -123, -123, -121, -120, -125, -128, -127, -123, -120, -124, -129, -129, -119, -110, -107, -116, -128, -130, -123, -114, -110, -117, -122, -120, -113, -118, -131, -144, -143, -129, -117, -115, -126, -133, -129, -119, -114, -113, -115, -112, -105, -105, -119, -136, -143, -135, -118, -105, -105, -115, -123, -127, -128, -128, -130, -131, -119, -110, -105, -110, -117, -122, -120, -114, -107, -100, -96, -99, -109, -116, -121, -124, -121, -110, -97, -94, -102, -116, -123, -122, -115, -109, -111, -117, -120, -120, -114, -110, -110, -113, -123, -129, -132, -134, -135, -132, -131, -134, -141, -138, -132, -129, -125, -127, -132, -138, -141, -145, -146, -142, -137, -135, -134, -140, -147, -149, -144, -140, -138, -137, -138, -133, -130, -134, -144, -150, -152, -149, -145, -142, -135, -129, -128, -133, -136, -137, -133, -130, -128, -133, -140, -144, -143, -135, -126, -131, -142, -150, -148, -141, -136, -135, -137, -142, -149, -153, -156, -156, -154, -151, -144, -141, -141, -139, -134, -132, -132, -135, -137, -137, -139, -141, -144, -149, -153, -158, -156, -152, -146, -144, -145, -147, -143, -136, -129, -126, -129, -134, -138, -142, -143, -137, -129, -123, -121, -124, -126, -126, -126, -127, -131, -135, -139, -136, -130, -123, -123, -124, -126, -125, -122, -121, -115, -111, -109, -112, -110, -105, -99, -98, -99, -104, -108, -111, -108, -105, -110, -114, -114, -112, -113, -111, -109, -106, -105, -105, -110, -113, -112, -112, -112, -115, -116, -114, -108, -100, -95, -95, -97, -99, -98, -96, -98, -99, -99, -98, -96, -98, -101, -102, -97, -87, -83, -89, -100, -104, -101, -98, -96, -99, -98, -96, -91, -88, -87, -89, -92, -93, -92, -92, -97, -103, -107, -107, -110, -114, -120, -122, -115, -103, -95, -96, -105, -110, -111, -109, -110, -110, -111, -111, -109, -106, -106, -108, -111, -108, -98, -87, -84, -87, -89, -89, -94, -105, -118, -122, -113, -102, -98, -99, -105, -108, -106, -101, -99, -98, -101, -102, -108, -122, -142, -154, -150, -134, -121, -121, -125, -131, -133, -131, -134, -137, -137, -133, -129, -125, -123, -126, -132, -139, -140, -137, -134, -131, -126, -120, -121, -127, -132, -138, -134, -126, -118, -123, -135, -143, -139, -135, -134, -130, -123, -118, -115, -117, -121, -130, -138, -143, -141, -136, -128, -123, -119, -117, -119, -121, -122, -122, -119, -123, -126, -128, -129, -131, -131, -129, -124, -123, -124, -125, -127, -130, -133, -133, -130, -128, -130, -128, -125, -126, -128, -130, -133, -139, -144, -145, -142, -138, -131, -123, -118, -122, -130, -131, -127, -123, -128, -133, -135, -133, -135, -140, -139, -136, -130, -127, -126, -128, -125, -120, -114, -115, -120, -123, -127, -129, -131, -134, -139, -140, -138, -133, -134, -134, -134, -131, -129, -126, -131, -137, -140, -135, -126, -123, -122, -122, -119, -119, -120, -124, -130, -131, -123, -114, -112, -117, -122, -122, -121, -119, -117, -116, -114, -114, -116, -126, -135, -141, -138, -128, -114, -103, -102, -109, -118, -126, -130, -131, -131, -133, -135, -127, -111, -103, -106, -112, -118, -125, -132, -128, -117, -110, -116, -127, -131, -128, -123, -118, -115, -111, -109, -109, -111, -114, -115, -118, -121, -121, -115, -103, -89, -79, -80, -90, -103, -110, -112, -113, -115, -118, -112, -99, -89, -91, -100, -109, -113, -104, -95, -90, -94, -99, -102, -101, -102, -107, -114, -117, -114, -108, -108, -110, -109, -112, -114, -117, -120, -120, -120, -119, -114, -105, -101, -104, -112, -117, -121, -123, -123, -121, -119, -118, -115, -113, -113, -117, -124, -133, -138, -138, -139, -134, -128, -132, -141, -143, -140, -133, -128, -130, -138, -139, -137, -137, -149, -157, -158, -153, -146, -140, -140, -151, -156, -148, -135, -132, -144, -153, -154, -150, -145, -144, -144, -148, -152, -152, -151, -151, -152, -154, -152, -152, -153, -152, -142, -137, -143, -151, -151, -144, -147, -151, -150, -154, -169, -185, -190, -185, -175, -162, -152, -148, -154, -164, -178, -187, -179, -160, -145, -140, -141, -145, -152, -165, -172, -174, -167, -160, -156, -153, -155, -158, -159, -154, -150, -143, -137, -131, -127, -130, -145, -156, -159, -152, -147, -144, -133, -128, -131, -134, -132, -130, -131, -129, -124, -122, -122, -122, -124, -130, -134, -131, -125, -124, -132, -137, -141, -144, -143, -138, -129, -121, -116, -120, -126, -136, -140, -139, -132, -128, -124, -120, -119, -124, -132, -134, -128, -120, -118, -119, -120, -126, -137, -142, -144, -143, -136, -121, -105, -99, -108, -118, -127, -132, -127, -112, -99, -96, -102, -107, -114, -122, -130, -132, -127, -125, -124, -123, -125, -127, -130, -131, -134, -136, -137, -130, -124, -122, -127, -138, -144, -144, -138, -131, -123, -125, -134, -138, -135, -130, -128, -129, -127, -123, -123, -128, -139, -144, -138, -121, -109, -112, -122, -127, -126, -125, -127, -137, -141, -138, -131, -126, -128, -136, -144, -143, -139, -142, -149, -154, -149, -141, -141, -148, -154, -158, -156, -151, -147, -151, -162, -171, -167, -160, -154, -148, -145, -145, -145, -140, -138, -139, -135, -127, -121, -123, -129, -139, -150, -160, -160, -156, -151, -147, -146, -142, -139, -141, -143, -140, -136, -134, -132, -132, -134, -138, -138, -139, -137, -134, -133, -129, -126, -131, -141, -149, -149, -143, -138, -135, -134, -134, -133, -129, -135, -145, -148, -137, -123, -117, -121, -130, -136, -134, -128, -121, -122, -129, -132, -129, -134, -148, -154, -147, -137, -131, -131, -132, -138, -143, -141, -136, -134, -136, -141, -142, -139, -141, -152, -158, -153, -148, -141, -130, -120, -120, -126, -130, -131, -135, -136, -131, -123, -113, -107, -108, -118, -128, -133, -129, -122, -118, -112, -111, -120, -122, -116, -115, -119, -116, -104, -99, -104, -114, -124, -133, -131, -124, -118, -117, -113, -107, -112, -120, -128, -135, -140, -137, -127, -120, -120, -118, -118, -119, -120, -116, -113, -113, -116, -114, -115, -119, -120, -117, -117, -115, -108, -106, -109, -105, -98, -98, -107, -115, -115, -114, -110, -106, -107, -108, -99, -89, -93, -104, -111, -115, -123, -128, -125, -119, -113, -109, -103, -99, -96, -94, -91, -94, -98, -94, -88, -88, -90, -93, -96, -101, -101, -95, -92, -91, -91, -97, -107, -104, -94, -89, -93, -97, -95, -90, -91, -95, -102, -111, -114, -113, -112, -113, -109, -111, -119, -123, -118, -111, -112, -115, -116, -116, -118, -118, -117, -120, -127, -125, -115, -105, -106, -115, -124, -132, -133, -126, -119, -114, -112, -113, -117, -117, -118, -124, -130, -129, -129, -136, -144, -147, -145, -137, -130, -125, -129, -132, -132, -136, -149, -163, -162, -154, -148, -147, -146, -139, -135, -133, -132, -137, -144, -145, -133, -123, -122, -128, -134, -137, -142, -145, -144, -139, -134, -135, -135, -135, -136, -141, -146, -149, -148, -148, -151, -148, -145, -143, -146, -148, -151, -157, -160, -158, -161, -166, -167, -162, -158, -156, -154, -146, -140, -141, -150, -160, -171, -171, -160, -145, -141, -143, -139, -133, -134, -138, -146, -151, -148, -136, -126, -123, -121, -117, -116, -120, -125, -124, -120, -114, -106, -104, -107, -112, -114, -117, -121, -126, -135, -139, -131, -117, -114, -124, -136, -141, -140, -136, -128, -117, -111, -110, -106, -103, -106, -115, -120, -124, -128, -128, -123, -118, -113, -111, -115, -123, -121, -110, -102, -101, -103, -103, -105, -109, -110, -112, -111, -103, -92, -88, -87, -89, -97, -108, -111, -106, -100, -96, -90, -87, -88, -95, -101, -101, -103, -105, -101, -91, -88, -90, -92, -96, -101, -105, -104, -99, -96, -95, -103, -111, -111, -109, -111, -114, -111, -107, -105, -110, -112, -112, -108, -102, -100, -102, -104, -110, -120, -129, -129, -122, -118, -116, -115, -114, -119, -122, -121, -115, -114, -116, -114, -108, -107, -114, -121, -127, -131, -138, -142, -142, -142, -140, -141, -140, -138, -137, -138, -139, -140, -136, -134, -135, -138, -139, -136, -132, -132, -141, -147, -148, -148, -149, -147, -144, -143, -147, -149, -152, -154, -155, -150, -144, -147, -157, -156, -144, -128, -124, -129, -134, -137, -140, -139, -137, -136, -138, -137, -137, -136, -135, -132, -128, -129, -134, -146, -154, -153, -144, -134, -131, -137, -147, -149, -142, -137, -146, -160, -165, -158, -145, -142, -148, -155, -159, -157, -150, -145, -145, -145, -136, -125, -127, -139, -151, -155, -153, -148, -142, -139, -138, -136, -139, -147, -156, -162, -160, -149, -138, -133, -139, -151, -159, -158, -151, -148, -148, -148, -141, -135, -140, -151, -155, -152, -143, -135, -135, -140, -145, -146, -143, -139, -142, -151, -147, -134, -123, -124, -128, -135, -142, -145, -145, -140, -137, -134, -130, -126, -129, -133, -137, -137, -132, -125, -127, -138, -150, -156, -154, -150, -145, -143, -139, -134, -134, -141, -150, -154, -157, -159, -155, -146, -139, -137, -135, -134, -134, -139, -140, -128, -113, -106, -109, -112, -117, -124, -128, -127, -124, -122, -121, -116, -111, -111, -112, -114, -114, -110, -108, -110, -110, -105, -103, -103, -107, -112, -114, -113, -114, -120, -126, -125, -120, -116, -109, -99, -93, -98, -107, -113, -114, -118, -121, -113, -102, -97, -98, -103, -110, -123, -132, -127, -115, -103, -97, -95, -94, -98, -106, -116, -123, -122, -117, -117, -115, -113, -113, -117, -117, -118, -120, -120, -122, -129, -135, -138, -136, -134, -132, -130, -133, -138, -139, -133, -123, -121, -125, -127, -118, -110, -109, -120, -135, -147, -154, -153, -148, -146, -145, -142, -135, -129, -129, -134, -138, -136, -132, -131, -134, -138, -139, -139, -141, -146, -154, -152, -148, -148, -153, -156, -155, -154, -151, -147, -146, -146, -144, -138, -134, -135, -145, -150, -143, -134, -131, -136, -142, -146, -151, -152, -148, -148, -154, -161, -156, -148, -147, -154, -162, -161, -156, -152, -148, -145, -146, -151, -153, -155, -157, -157, -152, -152, -158, -159, -152, -145, -144, -147, -148, -149, -145, -134, -124, -123, -132, -141, -133, -111, -100, -106, -115, -115, -113, -121, -132, -138, -136, -127, -110, -95, -96, -108, -118, -118, -118, -119, -122, -122, -118, -117, -120, -126, -132, -130, -120, -113, -119, -128, -130, -124, -120, -121, -128, -129, -122, -109, -101, -101, -109, -121, -124, -113, -100, -98, -102, -103, -100, -98, -100, -100, -101, -102, -100, -95, -89, -85, -83, -84, -83, -86, -90, -92, -90, -89, -88, -88, -90, -94, -94, -94, -98, -104, -105, -104, -101, -99, -97, -96, -97, -99, -98, -97, -96, -100, -100, -96, -91, -90, -91, -91, -90, -99, -109, -116, -120, -119, -113, -104, -102, -106, -109, -109, -104, -97, -95, -96, -99, -102, -107, -109, -110, -114, -120, -123, -126, -133, -138, -137, -134, -134, -133, -131, -129, -129, -129, -127, -129, -135, -137, -130, -121, -118, -123, -128, -130, -131, -130, -127, -127, -129, -125, -119, -115, -117, -123, -134, -141, -141, -138, -139, -139, -141, -141, -137, -131, -128, -129, -127, -126, -131, -138, -140, -138, -136, -132, -130, -128, -130, -132, -133, -134, -137, -140, -132, -121, -116, -117, -117, -119, -121, -127, -132, -139, -142, -140, -132, -124, -120, -119, -121, -123, -126, -126, -127, -126, -129, -134, -139, -139, -141, -143, -143, -141, -141, -144, -142, -137, -135, -134, -132, -133, -139, -145, -143, -132, -127, -128, -130, -129, -130, -136, -139, -135, -135, -134, -132, -128, -125, -123, -121, -119, -120, -125, -123, -115, -105, -102, -109, -118, -126, -134, -137, -129, -119, -114, -113, -111, -115, -128, -138, -140, -137, -130, -120, -110, -111, -118, -126, -126, -126, -126, -119, -106, -96, -98, -105, -115, -126, -137, -139, -131, -120, -113, -116, -121, -126, -132, -137, -138, -136, -130, -128, -126, -125, -125, -127, -128, -127, -128, -128, -125, -127, -134, -142, -140, -131, -120, -115, -111, -111, -110, -109, -106, -105, -111, -115, -106, -91, -84, -88, -95, -100, -102, -102, -101, -101, -100, -98, -95, -95, -99, -104, -107, -107, -107, -104, -99, -99, -106, -116, -123, -123, -123, -120, -113, -106, -110, -120, -127, -122, -115, -113, -116, -121, -125, -129, -127, -123, -123, -129, -124, -114, -107, -109, -118, -123, -127, -127, -124, -120, -117, -115, -114, -115, -119, -123, -126, -125, -123, -124, -128, -127, -124, -121, -122, -126, -135, -145, -152, -149, -147, -149, -154, -153, -149, -144, -143, -139, -136, -136, -140, -142, -146, -153, -151, -139, -130, -130, -137, -141, -144, -148, -151, -153, -153, -153, -151, -150, -151, -151, -149, -144, -141, -140, -143, -146, -151, -156, -158, -157, -158, -157, -153, -143, -137, -142, -153, -161, -162, -161, -159, -161, -163, -165, -166, -162, -160, -162, -160, -146, -133, -130, -140, -150, -156, -162, -164, -163, -163, -163, -163, -160, -157, -161, -166, -170, -167, -159, -149, -141, -139, -145, -155, -159, -155, -146, -140, -134, -131, -135, -148, -157, -159, -153, -147, -141, -138, -139, -142, -140, -135, -137, -145, -144, -132, -119, -115, -116, -123, -133, -142, -142, -135, -127, -125, -127, -130, -135, -138, -137, -129, -120, -115, -115, -119, -123, -131, -136, -139, -144, -147, -146, -137, -132, -135, -144, -150, -147, -138, -127, -118, -114, -116, -119, -119, -123, -131, -131, -118, -103, -99, -102, -109, -113, -113, -109, -105, -103, -101, -97, -95, -100, -106, -114, -118, -114, -103, -94, -91, -92, -96, -100, -103, -106, -108, -110, -107, -102, -103, -112, -122, -124, -121, -118, -116, -117, -118, -121, -120, -119, -122, -120, -110, -99, -96, -98, -101, -108, -115, -120, -125, -130, -133, -130, -125, -121, -121, -124, -128, -129, -127, -127, -129, -132, -134, -135, -133, -133, -133, -134, -135, -131, -130, -137, -143, -141, -135, -129, -126, -122, -125, -131, -135, -136, -141, -146, -139, -125, -119, -122, -131, -134, -132, -126, -119, -119, -122, -127, -129, -129, -128, -128, -128, -127, -124, -119, -120, -123, -128, -131, -131, -132, -132, -131, -131, -127, -126, -130, -140, -144, -141, -135, -132, -132, -127, -122, -115, -112, -117, -129, -133, -126, -116, -110, -110, -112, -117, -124, -131, -133, -133, -129, -124, -121, -116, -114, -114, -117, -118, -119, -120, -123, -124, -123, -122, -127, -136, -147, -154, -153, -146, -143, -149, -150, -140, -123, -115, -119, -128, -136, -141, -139, -134, -132, -133, -128, -117, -109, -109, -113, -118, -123, -129, -129, -124, -118, -115, -112, -113, -119, -126, -128, -126, -123, -119, -114, -112, -111, -112, -115, -116, -112, -112, -110, -112, -118, -128, -130, -130, -131, -135, -136, -135, -130, -126, -124, -126, -127, -129, -131, -126, -117, -112, -113, -118, -119, -121, -125, -129, -131, -131, -130, -124, -121, -123, -127, -130, -126, -119, -114, -112, -114, -117, -121, -121, -120, -119, -119, -115, -112, -113, -111, -106, -99, -95, -97, -99, -99, -99, -99, -99, -100, -101, -103, -108, -107, -99, -92, -94, -97, -96, -94, -96, -100, -101, -105, -107, -105, -100, -100, -106, -113, -119, -122, -124, -123, -124, -125, -126, -126, -125, -126, -127, -129, -132, -134, -139, -140, -134, -124, -116, -118, -121, -124, -123, -121, -118, -118, -118, -122, -125, -120, -113, -111, -118, -124, -127, -126, -129, -131, -132, -132, -131, -132, -130, -125, -116, -109, -108, -112, -117, -121, -125, -130, -137, -141, -142, -139, -139, -142, -145, -145, -146, -146, -139, -131, -133, -143, -151, -151, -153, -151, -146, -140, -137, -135, -138, -141, -138, -132, -131, -134, -136, -136, -138, -136, -131, -134, -142, -143, -136, -132, -135, -144, -152, -153, -149, -141, -137, -136, -135, -131, -131, -136, -146, -154, -158, -158, -158, -155, -149, -137, -130, -135, -150, -165, -172, -171, -161, -149, -142, -144, -144, -142, -143, -152, -157, -154, -144, -138, -136, -136, -137, -140, -141, -139, -137, -135, -132, -128, -123, -120, -122, -124, -124, -121, -123, -131, -135, -126, -113, -105, -104, -108, -118, -129, -136, -136, -137, -139, -140, -139, -140, -144, -145, -140, -135, -130, -127, -125, -126, -124, -124, -124, -124, -126, -122, -115, -109, -109, -116, -122, -121, -117, -117, -117, -116, -115, -112, -112, -111, -114, -117, -120, -118, -114, -114, -115, -114, -108, -104, -103, -101, -100, -99, -101, -100, -99, -99, -101, -103, -104, -104, -105, -107, -105, -104, -104, -107, -110, -108, -104, -102, -103, -107, -116, -125, -126, -115, -105, -99, -101, -104, -111, -118, -121, -115, -107, -101, -98, -101, -106, -111, -120, -129, -135, -138, -139, -135, -130, -129, -133, -139, -141, -143, -146, -145, -142, -138, -135, -138, -145, -149, -149, -148, -147, -144, -141, -141, -144, -148, -150, -150, -148, -143, -137, -136, -137, -132, -127, -129, -133, -135, -131, -129, -128, -126, -127, -129, -129, -128, -130, -136, -140, -143, -142, -142, -144, -145, -143, -141, -141, -138, -136, -137, -140, -142, -141, -138, -138, -141, -142, -136, -130, -127, -126, -126, -128, -130, -133, -137, -143, -141, -136, -130, -131, -140, -146, -142, -129, -122, -124, -129, -133, -135, -134, -130, -131, -131, -125, -116, -110, -116, -126, -136, -140, -140, -135, -132, -132, -133, -133, -133, -137, -141, -144, -141, -138, -136, -135, -136, -139, -142, -142, -144, -146, -144, -140, -137, -136, -138, -139, -135, -132, -129, -128, -127, -129, -126, -120, -114, -114, -116, -121, -128, -135, -136, -132, -130, -127, -123, -119, -119, -123, -130, -136, -133, -126, -126, -132, -133, -127, -125, -130, -136, -139, -140, -139, -134, -127, -125, -131, -135, -136, -135, -134, -134, -133, -133, -133, -135, -139, -139, -141, -141, -138, -134, -137, -144, -143, -137, -131, -127, -126, -128, -133, -133, -129, -125, -127, -124, -116, -106, -102, -102, -104, -103, -104, -110, -116, -113, -104, -100, -100, -100, -105, -111, -115, -115, -112, -109, -112, -114, -115, -114, -115, -112, -107, -101, -98, -99, -102, -107, -110, -114, -114, -118, -125, -128, -120, -110, -106, -111, -115, -119, -122, -123, -122, -120, -119, -117, -115, -116, -119, -122, -123, -121, -122, -126, -132, -129, -124, -121, -121, -123, -125, -127, -125, -123, -123, -123, -125, -129, -133, -136, -136, -132, -125, -117, -111, -116, -126, -134, -134, -129, -125, -126, -136, -142, -138, -126, -120, -121, -126, -130, -132, -133, -133, -131, -130, -128, -124, -123, -124, -127, -130, -136, -141, -148, -155, -154, -145, -136, -132, -136, -141, -148, -148, -143, -137, -135, -141, -154, -165, -169, -167, -163, -154, -145, -135, -133, -135, -137, -138, -138, -139, -138, -139, -141, -141, -133, -126, -125, -130, -133, -136, -141, -142, -142, -140, -137, -135, -136, -139, -147, -155, -157, -152, -149, -149, -151, -152, -154, -158, -158, -154, -150, -148, -144, -140, -137, -134, -134, -138, -143, -146, -140, -129, -121, -118, -119, -120, -120, -122, -123, -119, -115, -109, -106, -113, -121, -123, -120, -116, -115, -115, -117, -118, -119, -117, -118, -119, -118, -114, -110, -108, -108, -109, -113, -121, -128, -129, -128, -123, -117, -113, -118, -127, -130, -125, -119, -117, -118, -124, -127, -127, -122, -117, -115, -112, -109, -105, -105, -106, -107, -101, -95, -87, -84, -86, -93, -93, -91, -90, -92, -91, -86, -84, -85, -89, -93, -96, -96, -93, -89, -87, -91, -96, -102, -107, -106, -102, -102, -106, -109, -109, -111, -111, -107, -102, -102, -104, -105, -111, -120, -124, -127, -131, -135, -133, -131, -130, -130, -130, -130, -132, -132, -130, -127, -130, -132, -122, -111, -107, -113, -120, -126, -133, -138, -140, -139, -135, -130, -125, -124, -124, -126, -128, -129, -131, -131, -130, -130, -130, -127, -123, -122, -125, -131, -133, -133, -130, -127, -128, -133, -139, -145, -147, -146, -142, -139, -137, -137, -136, -137, -138, -139, -138, -135, -133, -132, -126, -117, -109, -104, -104, -107, -117, -127, -128, -122, -118, -121, -124, -123, -120, -119, -120, -130, -144, -152, -148, -137, -130, -126, -126, -127, -132, -138, -141, -140, -132, -122, -117, -123, -136, -146, -148, -144, -140, -135, -134, -131, -126, -125, -129, -138, -143, -144, -144, -147, -144, -138, -127, -118, -116, -122, -133, -145, -152, -152, -147, -141, -136, -133, -133, -133, -132, -133, -138, -144, -145, -141, -132, -124, -119, -118, -123, -132, -138, -140, -140, -137, -131, -134, -144, -151, -149, -146, -143, -139, -131, -127, -126, -128, -128, -131, -139, -147, -150, -148, -141, -127, -116, -112, -112, -115, -119, -127, -134, -136, -136, -134, -130, -129, -131, -135, -137, -140, -147, -156, -160, -153, -141, -133, -134, -139, -141, -141, -140, -138, -137, -135, -132, -131, -131, -130, -127, -124, -121, -116, -111, -108, -108, -109, -109, -111, -114, -115, -113, -111, -112, -107, -99, -95, -94, -98, -101, -105, -111, -108, -102, -95, -93, -93, -94, -98, -101, -103, -109, -120, -127, -125, -120, -118, -117, -114, -114, -118, -120, -122, -123, -125, -122, -122, -128, -135, -138, -136, -134, -128, -124, -123, -124, -125, -125, -126, -127, -127, -123, -120, -119, -120, -114, -109, -107, -111, -116, -117, -116, -114, -111, -112, -113, -113, -110, -112, -120, -129, -138, -141, -137, -134, -133, -132, -129, -125, -125, -130, -135, -137, -137, -135, -131, -128, -129, -136, -142, -143, -143, -142, -140, -139, -143, -149, -155, -157, -154, -148, -142, -137, -137, -142, -141, -134, -133, -140, -147, -150, -150, -148, -143, -134, -130, -129, -126, -124, -124, -130, -135, -140, -145, -148, -147, -143, -139, -139, -140, -141, -146, -151, -155, -156, -155, -151, -147, -150, -155, -161, -167, -171, -168, -160, -150, -148, -149, -156, -165, -174, -176, -172, -163, -157, -149, -136, -127, -126, -130, -133, -138, -140, -139, -132, -123, -116, -107, -101, -101, -109, -118, -126, -128, -126, -121, -119, -121, -123, -124, -128, -135, -143, -147, -145, -141, -136, -133, -137, -144, -148, -145, -137, -126, -118, -113, -115, -119, -123, -125, -127, -133, -138, -141, -141, -134, -120, -107, -103, -106, -111, -115, -117, -118, -115, -111, -107, -103, -99, -98, -97, -98, -101, -104, -103, -98, -94, -93, -93, -92, -93, -96, -96, -94, -90, -89, -88, -90, -96, -106, -113, -115, -113, -107, -100, -94, -93, -96, -99, -103, -107, -111, -111, -107, -102, -102, -98, -95, -95, -100, -102, -104, -111, -120, -121, -120, -117, -116, -117, -118, -119, -121, -126, -131, -132, -132, -133, -133, -129, -124, -123, -126, -135, -142, -145, -143, -138, -133, -134, -142, -147, -148, -144, -141, -135, -131, -131, -130, -128, -125, -126, -130, -132, -133, -133, -135, -131, -123, -117, -119, -124, -128, -131, -133, -133, -134, -136, -138, -136, -133, -130, -133, -137, -141, -140, -136, -135, -134, -134, -132, -132, -132, -135, -138, -139, -137, -135, -132, -130, -132, -136, -137, -137, -138, -142, -145, -146, -144, -143, -141, -144, -146, -147, -145, -145, -144, -137, -122, -111, -108, -112, -115, -118, -121, -122, -122, -122, -121, -120, -118, -116, -116, -120, -124, -130, -133, -133, -132, -133, -136, -136, -135, -138, -145, -155, -160, -161, -155, -147, -146, -150, -154, -151, -148, -141, -134, -127, -123, -122, -126, -135, -141, -138, -128, -122, -125, -132, -129, -121, -118, -121, -124, -130, -135, -135, -129, -121, -116, -113, -114, -120, -127, -132, -132, -131, -132, -134, -132, -126, -117, -109, -107, -110, -117, -126, -129, -132, -133, -133, -137, -142, -147, -147, -145, -143, -140, -137, -136, -134, -132, -131, -135, -142, -147, -146, -141, -139, -132, -123, -115, -114, -116, -118, -117, -113, -107, -99, -93, -93, -96, -98, -99, -101, -103, -108, -107, -100, -91, -87, -88, -93, -98, -100, -100, -102, -101, -97, -93, -89, -91, -99, -112, -120, -120, -117, -111, -107, -110, -114, -116, -116, -115, -117, -117, -116, -114, -114, -116, -115, -108, -106, -106, -110, -113, -116, -119, -117, -115, -116, -116, -116, -114, -114, -115, -120, -122, -121, -120, -122, -126, -126, -124, -122, -118, -115, -116, -117, -119, -120, -121, -124, -131, -137, -143, -146, -146, -142, -139, -137, -135, -130, -127, -128, -131, -132, -131, -133, -140, -140, -132, -126, -123, -124, -127, -132, -137, -138, -139, -142, -145, -143, -137, -134, -134, -138, -144, -148, -148, -142, -140, -144, -153, -159, -161, -161, -161, -157, -154, -148, -145, -146, -154, -157, -155, -149, -145, -142, -142, -142, -143, -141, -141, -143, -144, -144, -140, -140, -144, -146, -140, -132, -128, -131, -135, -141, -146, -148, -148, -149, -151, -150, -148, -146, -147, -154, -163, -170, -171, -165, -158, -153, -151, -149, -147, -148, -148, -149, -150, -147, -140, -133, -131, -135, -133, -129, -127, -130, -134, -137, -138, -135, -126, -122, -127, -136, -141, -141, -140, -136, -127, -116, -113, -112, -112, -113, -117, -120, -120, -118, -117, -116, -113, -113, -119, -127, -134, -135, -131, -128, -129, -128, -128, -126, -127, -127, -130, -132, -132, -128, -122, -116, -118, -121, -125, -124, -121, -116, -110, -104, -102, -100, -99, -98, -100, -101, -101, -99, -99, -98, -93, -85, -78, -74, -75, -79, -86, -91, -91, -88, -89, -90, -90, -87, -87, -90, -96, -103, -104, -101, -95, -94, -97, -104, -109, -112, -115, -118, -124, -127, -127, -125, -125, -132, -140, -144, -141, -139, -136, -131, -129, -129, -130, -133, -137, -141, -143, -140, -136, -133, -131, -123, -116, -113, -113, -117, -120, -123, -125, -122, -120, -116, -115, -114, -117, -123, -128, -132, -135, -136, -134, -131, -130, -130, -132, -136, -139, -142, -141, -140, -140, -140, -143, -152, -156, -156, -152, -149, -143, -136, -134, -136, -137, -140, -141, -141, -141, -138, -133, -132, -130, -124, -114, -107, -106, -112, -121, -127, -130, -128, -130, -134, -136, -137, -134, -133, -134, -138, -140, -140, -140, -137, -132, -126, -123, -122, -122, -120, -118, -118, -122, -130, -140, -146, -145, -142, -140, -133, -125, -120, -120, -126, -131, -136, -137, -137, -140, -143, -141, -137, -135, -136, -136, -133, -129, -125, -124, -126, -129, -130, -131, -131, -133, -132, -127, -120, -118, -121, -127, -132, -135, -134, -133, -133, -134, -135, -133, -131, -131, -137, -143, -142, -138, -133, -133, -132, -131, -129, -127, -124, -123, -123, -124, -126, -127, -124, -121, -117, -118, -121, -123, -125, -127, -129, -127, -123, -121, -121, -121, -123, -125, -128, -129, -129, -129, -127, -126, -125, -128, -130, -135, -140, -144, -146, -147, -145, -141, -136, -132, -130, -128, -128, -129, -128, -126, -121, -116, -112, -110, -110, -112, -112, -108, -101, -95, -93, -92, -92, -95, -96, -97, -97, -94, -90, -85, -81, -80, -82, -88, -93, -97, -100, -104, -109, -114, -114, -113, -110, -108, -109, -109, -111, -112, -113, -114, -116, -118, -122, -123, -126, -131, -133, -135, -132, -131, -129, -127, -126, -125, -127, -127, -126, -127, -127, -125, -122, -122, -121, -118, -113, -112, -111, -112, -115, -117, -117, -113, -108, -105, -107, -111, -121, -129, -133, -131, -126, -119, -115, -116, -117, -119, -122, -124, -128, -135, -140, -140, -141, -139, -141, -146, -149, -151, -152, -153, -151, -148, -147, -146, -146, -147, -145, -145, -148, -152, -156, -155, -154, -151, -151, -152, -149, -149, -147, -143, -135, -132, -133, -134, -128, -122, -122, -125, -130, -135, -137, -136, -135, -132, -134, -136, -138, -140, -144, -147, -149, -150, -148, -149, -152, -156, -157, -157, -158, -162, -165, -167, -163, -158, -152, -147, -148, -156, -164, -171, -170, -166, -159, -153, -152, -148, -146, -146, -146, -143, -141, -135, -128, -122, -119, -116, -124, -133, -141, -142, -144, -139, -130, -122, -119, -119, -125, -129, -133, -135, -133, -132, -130, -126, -122, -123, -126, -133, -136, -139, -139, -137, -134, -132, -132, -132, -131, -134, -138, -140, -142, -143, -140, -136, -133, -130, -131, -130, -127, -118, -106, -99, -100, -102, -104, -106, -109, -116, -121, -119, -115, -108, -103, -101, -101, -102, -104, -106, -108, -107, -108, -107, -101, -98, -99, -101, -103, -104, -107, -107, -106, -105, -100, -101, -103, -108, -110, -110, -107, -99, -97, -99, -105, -108, -109, -109, -111, -114, -116, -114, -110, -105, -103, -106, -110, -111, -112, -114, -117, -118, -119, -115, -111, -112, -113, -118, -121, -124, -122, -124, -126, -125, -124, -127, -134, -141, -145, -145, -141, -138, -140, -144, -145, -141, -136, -133, -133, -133, -132, -132, -128, -126, -124, -124, -124, -127, -132, -140, -141, -138, -133, -133, -135, -135, -132, -127, -123, -120, -124, -126, -122, -119, -117, -121, -123, -125, -122, -120, -118, -121, -122, -122, -121, -124, -130, -138, -140, -139, -137, -138, -139, -136, -133, -131, -134, -136, -134, -130, -129, -130, -134, -139, -139, -132, -123, -120, -119, -121, -119, -121, -121, -121, -128, -131, -129, -120, -111, -109, -109, -113, -119, -128, -132, -131, -129, -125, -126, -128, -130, -132, -132, -133, -132, -133, -134, -136, -138, -140, -140, -137, -136, -139, -140, -144, -149, -152, -153, -148, -144, -145, -151, -154, -150, -148, -146, -144, -139, -136, -133, -132, -133, -137, -139, -139, -132, -124, -117, -114, -116, -116, -113, -111, -112, -108, -102, -99, -100, -103, -107, -116, -129, -136, -135, -130, -122, -117, -116, -119, -124, -129, -134, -133, -127, -128, -136, -142, -134, -122, -116, -117, -119, -127, -137, -143, -144, -141, -139, -131, -126, -129, -134, -132, -130, -132, -132, -127, -118, -110, -107, -106, -107, -107, -105, -102, -97, -93, -88, -85, -87, -91, -91, -96, -97, -93, -89, -87, -87, -90, -94, -98, -100, -99, -99, -100, -104, -110, -116, -120, -120, -120, -112, -108, -113, -129, -135, -128, -120, -122, -128, -131, -135, -136, -130, -124, -123, -128, -128, -126, -125, -134, -142, -141, -129, -117, -109, -106, -113, -121, -129, -132, -134, -139, -145, -146, -137, -125, -118, -125, -133, -135, -132, -131, -126, -121, -114, -112, -113, -119, -125, -126, -120, -117, -119, -125, -122, -122, -128, -134, -142, -149, -156, -155, -152, -150, -150, -152, -154, -158, -159, -160, -160, -159, -154, -144, -141, -145, -147, -143, -145, -152, -158, -156, -150, -144, -144, -146, -148, -146, -148, -155, -165, -166, -159, -147, -135, -134, -138, -147, -150, -146, -148, -151, -146, -133, -123, -124, -129, -136, -141, -146, -144, -141, -140, -140, -139, -139, -143, -150, -158, -162, -158, -151, -147, -148, -154, -159, -162, -162, -163, -160, -155, -153, -154, -157, -156, -150, -144, -145, -147, -149, -145, -144, -142, -139, -132, -127, -128, -137, -145, -145, -135, -122, -114, -112, -120, -128, -132, -131, -130, -130, -130, -121, -110, -104, -104, -108, -113, -120, -122, -121, -116, -109, -106, -102, -101, -102, -110, -117, -116, -104, -92, -92, -101, -106, -105, -101, -99, -101, -107, -114, -116, -118, -122, -126, -124, -119, -120, -125, -126, -122, -117, -111, -104, -100, -103, -106, -106, -103, -100, -95, -94, -96, -100, -99, -93, -88, -85, -85, -90, -97, -97, -89, -86, -86, -91, -96, -98, -101, -101, -99, -103, -107, -112, -113, -113, -115, -115, -114, -108, -105, -107, -113, -118, -120, -122, -124, -130, -138, -142, -144, -145, -143, -143, -141, -138, -138, -139, -141, -141, -142, -145, -146, -144, -141, -140, -135, -133, -136, -144, -155, -159, -154, -140, -129, -125, -126, -126, -129, -133, -134, -128, -120, -116, -116, -118, -123, -129, -132, -136, -138, -137, -127, -113, -106, -108, -120, -132, -140, -138, -130, -123, -118, -115, -115, -115, -118, -125, -135, -140, -138, -137, -136, -137, -137, -134, -136, -140, -143, -143, -138, -134, -130, -130, -133, -136, -137, -140, -143, -144, -141, -133, -126, -121, -124, -135, -143, -141, -136, -131, -121, -109, -99, -98, -103, -110, -118, -123, -124, -121, -120, -117, -116, -116, -121, -126, -132, -138, -142, -142, -137, -131, -127, -126, -128, -136, -145, -150, -149, -145, -139, -137, -139, -142, -136, -130, -133, -143, -146, -145, -139, -129, -119, -116, -120, -126, -128, -130, -132, -133, -132, -128, -125, -124, -126, -130, -131, -129, -134, -134, -123, -109, -104, -107, -114, -122, -128, -130, -127, -124, -122, -118, -116, -117, -120, -124, -127, -132, -138, -141, -144, -144, -143, -142, -137, -136, -138, -142, -144, -144, -143, -140, -136, -129, -128, -133, -138, -137, -133, -130, -123, -114, -109, -110, -112, -115, -117, -118, -115, -110, -105, -102, -104, -110, -111, -111, -109, -113, -115, -109, -95, -86, -85, -90, -97, -106, -112, -111, -107, -107, -106, -107, -106, -109, -115, -123, -128, -128, -128, -126, -123, -120, -118, -118, -124, -131, -136, -137, -138, -142, -143, -142, -135, -133, -140, -148, -143, -130, -123, -122, -125, -130, -132, -131, -128, -129, -130, -129, -125, -119, -117, -116, -118, -119, -113, -106, -106, -108, -105, -97, -95, -101, -113, -124, -131, -133, -129, -126, -126, -127, -126, -127, -125, -122, -120, -117, -118, -121, -130, -138, -140, -135, -127, -122, -123, -125, -129, -130, -135, -145, -148, -142, -136, -140, -147, -148, -147, -150, -159, -161, -157, -147, -137, -132, -139, -151, -159, -159, -154, -146, -137, -132, -130, -130, -131, -140, -155, -160, -154, -144, -139, -140, -138, -138, -143, -151, -153, -152, -146, -140, -134, -132, -135, -143, -152, -156, -156, -153, -147, -139, -132, -130, -132, -136, -148, -161, -170, -169, -159, -147, -133, -131, -143, -162, -170, -167, -160, -153, -146, -138, -136, -138, -143, -150, -155, -154, -148, -140, -135, -136, -138, -136, -130, -127, -131, -137, -136, -124, -110, -103, -107, -113, -120, -122, -122, -119, -119, -116, -107, -99, -101, -112, -123, -129, -125, -115, -109, -107, -110, -110, -111, -111, -113, -115, -114, -110, -106, -104, -105, -104, -102, -107, -114, -115, -106, -98, -97, -102, -107, -110, -108, -100, -96, -98, -101, -101, -100, -97, -97, -104, -114, -113, -102, -90, -85, -87, -86, -85, -89, -96, -101, -102, -102, -101, -101, -108, -116, -116, -111, -107, -107, -113, -117, -117, -119, -125, -133, -140, -138, -131, -125, -122, -122, -127, -133, -143, -148, -150, -144, -133, -123, -127, -136, -142, -141, -142, -141, -138, -136, -136, -130, -125, -122, -124, -128, -135, -138, -140, -133, -121, -108, -105, -111, -122, -134, -139, -125, -109, -103, -108, -118, -130, -136, -135, -130, -126, -122, -115, -109, -108, -112, -120, -128, -130, -131, -132, -135, -136, -134, -133, -134, -135, -137, -140, -141, -138, -135, -139, -142, -138, -132, -132, -132, -134, -138, -143, -142, -139, -138, -138, -136, -133, -132, -130, -130, -131, -132, -130, -125, -121, -121, -125, -131, -138, -140, -133, -122, -115, -116, -122, -126, -128, -128, -126, -126, -126, -125, -127, -127, -128, -124, -124, -126, -130, -132, -133, -133, -133, -134, -134, -133, -137, -143, -149, -151, -150, -149, -143, -142, -147, -154, -154, -148, -143, -141, -142, -139, -138, -140, -145, -151, -154, -154, -152, -148, -143, -136, -132, -131, -132, -134, -138, -144, -144, -132, -121, -118, -122, -128, -130, -132, -133, -133, -131, -129, -125, -120, -119, -121, -124, -126, -126, -125, -123, -119, -117, -115, -117, -119, -118, -116, -111, -108, -113, -122, -127, -122, -109, -109, -123, -137, -140, -131, -119, -112, -114, -122, -126, -122, -117, -116, -120, -121, -119, -116, -113, -114, -115, -115, -116, -119, -121, -122, -119, -110, -97, -92, -97, -103, -106, -106, -108, -109, -113, -119, -121, -118, -111, -108, -109, -112, -118, -123, -126, -125, -119, -114, -112, -114, -120, -125, -130, -131, -129, -122, -116, -110, -108, -112, -121, -130, -132, -127, -123, -118, -112, -108, -110, -118, -125, -132, -133, -129, -125, -121, -115, -113, -111, -111, -112, -114, -114, -114, -115, -109, -100, -94, -97, -104, -109, -111, -114, -111, -105, -97, -97, -102, -107, -109, -111, -113, -116, -117, -118, -118, -118, -125, -136, -142, -140, -131, -125, -123, -127, -129, -130, -130, -134, -144, -153, -154, -150, -147, -146, -148, -150, -153, -154, -156, -158, -160, -159, -159, -158, -157, -156, -158, -159, -158, -156, -159, -164, -168, -166, -150, -135, -130, -134, -141, -142, -141, -147, -161, -171, -171, -157, -141, -140, -152, -161, -160, -154, -149, -149, -154, -159, -157, -153, -161, -178, -184, -175, -165, -162, -167, -171, -169, -165, -166, -169, -171, -168, -163, -156, -151, -151, -155, -155, -152, -149, -154, -163, -169, -167, -161, -156, -152, -149, -146, -143, -137, -130, -130, -134, -132, -119, -107, -103, -110, -117, -123, -123, -120, -113, -111, -107, -101, -94, -92, -96, -99, -101, -99, -97, -92, -91, -89, -88, -88, -90, -90, -92, -97, -92, -82, -74, -80, -98, -114, -119, -115, -110, -103, -99, -97, -97, -98, -100, -106, -109, -107, -100, -93, -87, -87, -90, -95, -97, -96, -96, -95, -93, -90, -91, -99, -105, -103, -95, -89, -86, -86, -91, -100, -104, -105, -108, -116, -125, -123, -113, -104, -105, -113, -115, -113, -111, -115, -122, -127, -125, -117, -114, -115, -118, -122, -129, -142, -151, -150, -142, -132, -126, -125, -128, -133, -134, -136, -139, -141, -142, -143, -139, -130, -125, -132, -140, -143, -138, -128, -117, -116, -124, -132, -136, -139, -141, -135, -125, -113, -105, -105, -115, -128, -138, -138, -133, -128, -126, -124, -122, -124, -131, -137, -143, -142, -138, -132, -131, -133, -137, -140, -142, -145, -143, -140, -138, -141, -145, -148, -148, -146, -140, -136, -136, -138, -139, -142, -146, -149, -150, -154, -156, -155, -151, -148, -151, -153, -150, -147, -142, -138, -135, -132, -130, -129, -131, -135, -134, -126, -122, -122, -124, -126, -128, -132, -137, -139, -138, -137, -133, -127, -123, -123, -127, -132, -134, -135, -136, -138, -140, -140, -140, -139, -139, -139, -137, -138, -141, -145, -142, -134, -127, -128, -135, -140, -140, -135, -134, -140, -147, -145, -136, -133, -139, -150, -152, -143, -133, -128, -135, -141, -137, -127, -121, -125, -131, -135, -133, -122, -111, -105, -107, -108, -107, -107, -111, -113, -111, -103, -94, -93, -99, -107, -114, -113, -107, -101, -99, -100, -102, -105, -107, -112, -117, -120, -120, -114, -107, -106, -107, -110, -110, -110, -108, -107, -105, -104, -103, -104, -105, -109, -112, -114, -115, -115, -115, -115, -115, -116, -117, -119, -120, -121, -119, -115, -111, -113, -119, -125, -122, -112, -103, -103, -108, -114, -115, -114, -115, -113, -108, -100, -93, -92, -98, -108, -119, -123, -123, -119, -116, -114, -113, -113, -114, -117, -121, -124, -125, -124, -126, -132, -135, -138, -140, -141, -139, -132, -128, -127, -127, -128, -131, -133, -134, -134, -133, -131, -128, -126, -125, -125, -126, -126, -128, -129, -127, -121, -116, -115, -119, -121, -118, -114, -113, -116, -119, -122, -126, -127, -128, -129, -129, -128, -127, -129, -129, -129, -133, -138, -143, -147, -151, -151, -151, -149, -149, -150, -154, -155, -157, -159, -165, -167, -163, -160, -159, -161, -167, -171, -174, -171, -168, -166, -164, -159, -155, -149, -145, -144, -148, -150, -148, -146, -144, -147, -155, -159, -152, -142, -141, -144, -145, -146, -145, -142, -139, -141, -144, -147, -147, -146, -147, -148, -148, -146, -147, -154, -162, -167, -166, -156, -146, -141, -143, -145, -148, -149, -152, -155, -156, -152, -152, -157, -163, -163, -158, -155, -155, -154, -154, -153, -149, -144, -143, -143, -145, -143, -136, -126, -117, -112, -111, -118, -123, -123, -121, -115, -110, -104, -98, -94, -86, -81, -79, -84, -90, -96, -98, -101, -102, -96, -82, -71, -69, -77, -87, -95, -98, -98, -98, -97, -99, -99, -99, -100, -102, -106, -106, -104, -104, -105, -108, -107, -108, -113, -117, -116, -109, -102, -96, -95, -98, -105, -109, -112, -114, -114, -110, -106, -101, -99, -101, -109, -116, -117, -116, -114, -112, -113, -115, -115, -114, -109, -103, -99, -103, -109, -111, -111, -113, -114, -119, -125, -128, -128, -124, -122, -121, -124, -125, -123, -120, -119, -121, -123, -126, -128, -129, -133, -138, -143, -142, -138, -134, -137, -141, -141, -135, -129, -127, -126, -127, -128, -131, -135, -135, -132, -127, -122, -123, -129, -137, -141, -141, -137, -135, -134, -131, -128, -125, -124, -127, -132, -132, -125, -116, -115, -120, -129, -133, -134, -132, -129, -128, -127, -125, -123, -122, -125, -131, -135, -139, -140, -140, -136, -132, -128, -128, -129, -133, -141, -147, -150, -149, -149, -154, -157, -160, -157, -149, -143, -141, -140, -140, -138, -136, -135, -134, -135, -138, -139, -139, -136, -133, -131, -129, -129, -131, -133, -135, -134, -134, -133, -132, -132, -129, -124, -119, -120, -124, -129, -133, -135, -134, -133, -133, -131, -125, -121, -124, -129, -136, -139, -140, -140, -140, -141, -142, -142, -138, -131, -129, -136, -145, -147, -142, -140, -143, -149, -149, -144, -140, -142, -146, -148, -147, -142, -137, -137, -138, -137, -134, -128, -123, -120, -119, -118, -117, -116, -117, -115, -112, -107, -100, -97, -101, -104, -103, -99, -99, -99, -101, -101, -102, -103, -105, -106, -107, -107, -107, -108, -105, -101, -97, -96, -97, -102, -108, -111, -111, -108, -108, -110, -114, -115, -115, -117, -122, -128, -130, -130, -126, -125, -123, -123, -124, -129, -136, -139, -139, -134, -127, -122, -117, -116, -117, -119, -118, -116, -111, -109, -106, -102, -98, -97, -96, -100, -108, -114, -117, -115, -112, -108, -107, -107, -108, -108, -109, -109, -111, -112, -114, -115, -116, -117, -120, -123, -125, -124, -125, -128, -133, -134, -136, -133, -127, -122, -125, -134, -141, -140, -135, -127, -124, -127, -135, -141, -146, -144, -138, -132, -126, -122, -120, -123, -125, -127, -128, -129, -130, -132, -130, -129, -127, -127, -129, -130, -130, -128, -127, -124, -122, -121, -125, -129, -132, -133, -135, -136, -137, -138, -139, -141, -143, -144, -147, -154, -160, -159, -153, -149, -147, -149, -153, -160, -162, -160, -156, -157, -160, -161, -159, -155, -157, -160, -162, -160, -156, -156, -162, -165, -159, -150, -147, -152, -161, -166, -167, -159, -152, -146, -147, -146, -146, -145, -147, -149, -151, -150, -150, -148, -145, -139, -135, -135, -136, -139, -141, -142, -142, -143, -144, -146, -150, -148, -146, -148, -153, -154, -153, -150, -145, -144, -150, -157, -160, -158, -156, -151, -143, -133, -128, -128, -134, -141, -144, -142, -135, -127, -120, -117, -115, -113, -109, -104, -101, -103, -109, -117, -119, -116, -107, -99, -99, -101, -105, -104, -98, -91, -87, -85, -88, -89, -90, -91, -91, -89, -89, -88, -87, -84, -85, -89, -93, -95, -97, -97, -96, -94, -95, -98, -98, -96, -92, -91, -94, -100, -106, -108, -105, -106, -112, -117, -116, -110, -105, -105, -111, -118, -122, -125, -125, -125, -122, -120, -116, -114, -114, -117, -119, -119, -117, -118, -123, -129, -130, -129, -124, -121, -120, -121, -119, -112, -105, -104, -106, -110, -113, -114, -114, -114, -114, -115, -114, -114, -115, -116, -119, -121, -122, -124, -125, -127, -127, -129, -130, -134, -137, -139, -137, -136, -133, -132, -134, -141, -146, -148, -145, -142, -140, -139, -139, -140, -141, -139, -135, -133, -132, -135, -139, -144, -147, -145, -140, -136, -134, -131, -129, -128, -128, -129, -131, -131, -132, -131, -129, -128, -130, -131, -133, -130, -122, -114, -117, -130, -142, -145, -141, -133, -129, -132, -138, -141, -142, -144, -144, -141, -135, -134, -139, -147, -147, -142, -134, -130, -128, -129, -129, -128, -128, -130, -136, -140, -139, -132, -129, -132, -139, -144, -144, -139, -133, -131, -132, -134, -136, -139, -139, -141, -142, -142, -139, -137, -138, -138, -136, -134, -134, -137, -138, -138, -134, -129, -125, -121, -117, -115, -120, -127, -133, -133, -131, -132, -134, -136, -136, -137, -138, -138, -138, -137, -133, -131, -131, -132, -134, -135, -136, -133, -131, -128, -121, -116, -113, -113, -115, -118, -120, -120, -119, -116, -114, -113, -110, -110, -111, -114, -116, -116, -115, -112, -111, -111, -112, -112, -110, -105, -99, -95, -95, -96, -98, -102, -106, -105, -105, -103, -104, -104, -105, -107, -110, -113, -115, -118, -123, -124, -124, -124, -126, -131, -134, -135, -132, -126, -122, -120, -120, -119, -119, -118, -120, -120, -118, -114, -112, -111, -110, -107, -108, -115, -120, -121, -119, -116, -113, -111, -112, -112, -111, -109, -110, -112, -112, -114, -117, -118, -121, -122, -124, -124, -122, -119, -123, -130, -134, -130, -124, -120, -118, -120, -121, -124, -128, -132, -137, -140, -136, -125, -119, -122, -127, -129, -127, -125, -126, -129, -130, -129, -127, -126, -127, -130, -131, -132, -132, -131, -134, -136, -137, -136, -136, -136, -136, -136, -136, -137, -138, -139, -141, -144, -144, -143, -142, -143, -144, -144, -144, -145, -144, -147, -153, -158, -157, -155, -155, -154, -148, -144, -141, -142, -144, -148, -152, -152, -151, -147, -148, -153, -158, -152, -141, -135, -140, -149, -157, -161, -162, -161, -160, -162, -162, -156, -147, -145, -146, -149, -149, -148, -153, -159, -163, -162, -157, -150, -146, -145, -147, -150, -151, -152, -152, -153, -151, -147, -145, -145, -144, -144, -142, -141, -140, -140, -139, -140, -139, -143, -150, -158, -160, -154, -148, -142, -140, -138, -138, -137, -133, -127, -124, -124, -122, -120, -118, -115, -112, -111, -110, -111, -108, -106, -105, -109, -109, -105, -99, -96, -96, -96, -96, -99, -102, -102, -101, -100, -100, -98, -97, -99, -104, -109, -107, -101, -95, -93, -92, -92, -94, -96, -98, -100, -102, -102, -98, -94, -91, -96, -99, -98, -93, -93, -97, -102, -101, -95, -91, -92, -94, -96, -96, -98, -103, -108, -112, -112, -109, -108, -108, -110, -111, -110, -107, -108, -114, -122, -125, -121, -118, -117, -121, -126, -126, -121, -118, -122, -127, -129, -124, -119, -115, -115, -118, -121, -123, -123, -124, -124, -125, -125, -126, -126, -126, -125, -123, -121, -121, -121, -122, -122, -122, -123, -125, -128, -129, -126, -121, -119, -127, -136, -144, -148, -146, -142, -140, -142, -143, -142, -140, -140, -140, -142, -141, -141, -139, -140, -140, -139, -138, -137, -136, -135, -134, -133, -132, -134, -136, -136, -135, -135, -136, -138, -142, -140, -135, -128, -124, -125, -129, -133, -134, -132, -133, -136, -139, -140, -142, -147, -150, -153, -154, -152, -145, -137, -132, -133, -138, -144, -150, -153, -150, -143, -136, -129, -127, -129, -131, -130, -128, -129, -128, -127, -127, -133, -138, -137, -135, -130, -129, -129, -134, -137, -135, -138, -153, -167, -167, -151, -139, -135, -134, -132, -133, -134, -126, -119, -120, -123, -118, -111, -109, -117, -126, -131, -132, -126, -123, -130, -142, -153, -154, -151, -143, -138, -137, -136, -128, -116, -116, -124, -133, -135, -134, -132, -129, -123, -116, -112, -118, -130, -125, -105, -93, -100, -116, -124, -127, -126, -120, -117, -121, -126, -124, -118, -112, -108, -109, -108, -106, -101, -102, -107, -109, -103, -98, -91, -91, -101, -114, -118, -115, -111, -111, -112, -114, -110, -103, -100, -105, -112, -119, -124, -126, -126, -126, -124, -126, -134, -146, -148, -132, -115, -110, -118, -122, -126, -129, -130, -128, -124, -122, -117, -113, -112, -114, -114, -112, -114, -112, -105, -98, -102, -112, -121, -126, -120, -113, -112, -117, -119, -121, -122, -122, -125, -128, -127, -119, -114, -115, -119, -121, -125, -125, -124, -124, -122, -121, -129, -132, -127, -122, -120, -113, -106, -106, -114, -117, -118, -123, -130, -131, -132, -135, -141, -140, -131, -119, -113, -114, -118, -123, -130, -133, -131, -128, -129, -132, -135, -137, -137, -138, -137, -136, -137, -137, -135, -130, -130, -134, -137, -139, -141, -143, -140, -138, -140, -147, -155, -161, -161, -161, -155, -147, -145, -151, -158, -159, -158, -155, -147, -142, -142, -145, -150, -153, -151, -146, -145, -149, -153, -151, -149, -146, -145, -146, -149, -152, -152, -154, -155, -155, -151, -149, -152, -159, -158, -151, -145, -145, -146, -146, -148, -147, -146, -144, -142, -141, -143, -147, -148, -147, -145, -144, -146, -153, -160, -161, -158, -152, -147, -147, -156, -163, -168, -167, -158, -146, -138, -136, -133, -130, -133, -137, -133, -126, -118, -107, -101, -107, -119, -125, -125, -123, -123, -117, -107, -99, -96, -97, -100, -105, -111, -112, -110, -109, -110, -110, -111, -114, -113, -107, -95, -81, -79, -88, -104, -114, -117, -115, -111, -105, -102, -100, -102, -104, -104, -103, -101, -103, -102, -103, -104, -105, -103, -101, -97, -94, -98, -101, -99, -93, -92, -95, -101, -104, -101, -96, -93, -92, -94, -98, -102, -106, -107, -108, -110, -109, -112, -116, -118, -117, -114, -110, -112, -120, -129, -131, -131, -133, -134, -135, -131, -128, -126, -126, -120, -114, -110, -113, -115, -117, -121, -124, -126, -123, -118, -118, -120, -122, -123, -124, -126, -127, -127, -127, -121, -115, -117, -121, -122, -122, -127, -135, -139, -139, -136, -133, -131, -133, -133, -134, -130, -123, -123, -131, -139, -140, -140, -142, -144, -143, -143, -142, -141, -143, -142, -136, -128, -126, -127, -130, -132, -133, -134, -133, -133, -132, -130, -129, -132, -134, -136, -136, -139, -141, -140, -137, -134, -132, -133, -134, -139, -147, -152, -155, -151, -145, -143, -145, -142, -136, -134, -134, -140, -148, -153, -150, -144, -140, -134, -129, -126, -127, -129, -138, -142, -132, -115, -106, -107, -113, -122, -135, -148, -155, -156, -149, -140, -137, -142, -148, -148, -141, -133, -128, -125, -118, -114, -113, -117, -125, -137, -145, -145, -137, -130, -128, -133, -136, -133, -129, -129, -132, -140, -148, -150, -147, -143, -143, -141, -138, -135, -131, -129, -131, -131, -124, -121, -121, -121, -120, -119, -121, -119, -115, -112, -109, -113, -120, -128, -135, -139, -139, -135, -130, -119, -104, -94, -93, -100, -108, -115, -120, -119, -114, -110, -110, -108, -104, -100, -101, -102, -102, -107, -112, -115, -112, -115, -123, -129, -125, -117, -111, -107, -112, -119, -119, -115, -112, -113, -114, -117, -122, -125, -121, -115, -107, -107, -115, -124, -128, -129, -128, -126, -125, -124, -115, -106, -102, -105, -111, -116, -118, -116, -112, -113, -117, -120, -117, -112, -110, -108, -107, -107, -116, -126, -130, -129, -128, -125, -120, -117, -118, -118, -121, -125, -125, -116, -108, -107, -113, -122, -126, -124, -120, -113, -111, -113, -119, -122, -124, -130, -137, -142, -140, -133, -123, -117, -117, -119, -119, -123, -126, -128, -122, -118, -121, -126, -132, -136, -138, -138, -133, -132, -137, -144, -146, -146, -149, -151, -149, -146, -143, -142, -141, -148, -151, -146, -139, -137, -140, -142, -144, -148, -154, -156, -154, -156, -158, -155, -147, -145, -147, -153, -160, -164, -157, -147, -145, -152, -157, -160, -162, -160, -153, -147, -145, -145, -145, -147, -151, -153, -153, -156, -157, -156, -154, -153, -157, -157, -154, -150, -151, -151, -153, -154, -147, -135, -129, -131, -135, -139, -142, -148, -150, -150, -146, -142, -144, -150, -155, -155, -151, -146, -142, -139, -136, -137, -144, -151, -154, -153, -150, -143, -137, -131, -130, -127, -123, -117, -114, -112, -108, -109, -120, -130, -134, -131, -128, -122, -115, -111, -110, -112, -115, -120, -118, -108, -97, -91, -89, -88, -94, -99, -100, -96, -88, -83, -82, -86, -89, -93, -98, -105, -111, -111, -105, -94, -89, -92, -98, -105, -109, -110, -107, -103, -102, -100, -97, -93, -91, -90, -88, -89, -95, -101, -105, -111, -121, -126, -125, -119, -115, -111, -109, -107, -105, -97, -93, -95, -100, -102, -107, -111, -116, -116, -111, -107, -108, -115, -120, -122, -123, -124, -127, -136, -138, -125, -108, -102, -107, -117, -125, -130, -130, -129, -128, -127, -126, -123, -123, -123, -124, -124, -127, -132, -133, -133, -134, -137, -137, -138, -141, -143, -141, -139, -136, -130, -122, -120, -119, -118, -120, -125, -132, -136, -136, -132, -127, -129, -135, -141, -144, -145, -144, -146, -145, -138, -131, -130, -136, -142, -145, -146, -143, -141, -139, -140, -140, -135, -130, -127, -125, -126, -134, -145, -150, -150, -150, -147, -138, -128, -127, -136, -144, -152, -159, -157, -151, -144, -141, -139, -139, -139, -140, -138, -131, -122, -119, -129, -142, -148, -147, -142, -133, -130, -127, -121, -116, -117, -127, -139, -151, -156, -152, -140, -129, -124, -122, -123, -125, -129, -132, -134, -136, -136, -133, -131, -132, -135, -135, -134, -132, -131, -129, -127, -132, -140, -146, -144, -137, -129, -124, -121, -123, -130, -132, -133, -138, -145, -147, -142, -137, -133, -131, -132, -127, -115, -105, -108, -119, -127, -131, -130, -127, -125, -125, -121, -114, -106, -102, -107, -116, -123, -130, -136, -137, -133, -129, -120, -111, -104, -106, -111, -115, -117, -119, -122, -123, -115, -104, -99, -102, -107, -106, -102, -96, -96, -104, -116, -120, -118, -113, -108, -107, -111, -110, -102, -95, -100, -109, -116, -120, -123, -122, -120, -116, -114, -114, -117, -119, -121, -119, -117, -122, -129, -132, -129, -126, -123, -118, -114, -115, -115, -115, -115, -119, -124, -125, -116, -107, -105, -111, -114, -114, -117, -123, -125, -125, -122, -120, -117, -116, -115, -115, -117, -121, -121, -115, -110, -111, -114, -117, -120, -123, -123, -122, -121, -121, -120, -118, -118, -116, -117, -127, -139, -145, -143, -141, -137, -132, -130, -127, -124, -123, -125, -131, -138, -137, -126, -115, -113, -117, -123, -127, -130, -133, -132, -131, -132, -138, -143, -145, -144, -143, -145, -145, -140, -133, -130, -133, -139, -144, -148, -153, -152, -149, -147, -144, -140, -139, -146, -150, -149, -151, -156, -161, -160, -158, -158, -161, -163, -166, -166, -160, -152, -148, -150, -155, -154, -146, -141, -140, -146, -152, -154, -155, -150, -147, -153, -166, -170, -161, -151, -144, -144, -147, -148, -141, -134, -132, -134, -137, -139, -141, -141, -142, -146, -148, -149, -145, -141, -141, -148, -155, -157, -152, -149, -146, -143, -140, -142, -147, -155, -161, -164, -159, -153, -147, -139, -128, -121, -119, -120, -121, -123, -122, -113, -103, -102, -114, -129, -135, -136, -131, -126, -122, -115, -103, -97, -98, -103, -106, -109, -112, -111, -106, -99, -91, -82, -79, -82, -90, -95, -102, -110, -116, -116, -113, -108, -103, -100, -101, -104, -107, -111, -111, -106, -105, -102, -96, -90, -89, -92, -94, -101, -107, -109, -102, -96, -98, -105, -114, -117, -118, -117, -117, -113, -103, -94, -92, -95, -101, -110, -116, -116, -108, -103, -100, -100, -100, -101, -107, -111, -115, -121, -127, -126, -128, -132, -137, -133, -125, -120, -118, -119, -120, -121, -122, -130, -134, -129, -117, -106, -105, -110, -116, -121, -122, -121, -124, -133, -137, -135, -129, -127, -131, -131, -125, -119, -119, -120, -119, -119, -122, -124, -126, -127, -126, -126, -127, -129, -133, -133, -133, -139, -147, -150, -151, -149, -148, -145, -143, -146, -149, -151, -150, -148, -148, -150, -145, -133, -123, -122, -126, -128, -131, -131, -130, -130, -137, -142, -143, -139, -136, -132, -133, -135, -130, -126, -132, -147, -156, -155, -148, -138, -130, -126, -129, -131, -134, -136, -140, -141, -145, -154, -161, -161, -156, -149, -142, -134, -132, -136, -139, -139, -143, -148, -153, -154, -147, -128, -108, -102, -106, -115, -124, -133, -133, -125, -121, -128, -134, -134, -131, -129, -131, -139, -142, -137, -128, -127, -130, -135, -139, -142, -139, -130, -123, -121, -123, -126, -129, -132, -135, -141, -148, -148, -143, -138, -134, -128, -125, -125, -125, -126, -129, -136, -135, -131, -125, -118, -110, -109, -112, -114, -114, -118, -121, -119, -118, -119, -121, -118, -115, -114, -116, -120, -115, -108, -102, -105, -111, -115, -119, -121, -118, -116, -113, -108, -102, -96, -92, -99, -113, -124, -125, -119, -114, -109, -107, -108, -111, -116, -119, -123, -123, -122, -119, -119, -118, -112, -107, -107, -112, -116, -119, -121, -122, -115, -113, -119, -127, -129, -127, -123, -122, -121, -117, -110, -105, -108, -113, -118, -123, -122, -120, -119, -121, -124, -124, -120, -114, -105, -102, -108, -116, -119, -119, -119, -120, -120, -122, -125, -126, -124, -124, -124, -125, -125, -122, -113, -105, -103, -107, -112, -115, -122, -126, -123, -118, -119, -123, -128, -130, -127, -124, -122, -122, -121, -121, -122, -127, -131, -135, -138, -138, -135, -132, -132, -133, -134, -136, -136, -136, -139, -145, -145, -143, -140, -141, -143, -143, -144, -145, -144, -144, -146, -147, -146, -144, -147, -146, -139, -132, -132, -134, -137, -141, -145, -144, -145, -151, -156, -159, -159, -159, -158, -149, -140, -136, -138, -144, -152, -159, -161, -159, -153, -150, -147, -147, -147, -148, -151, -153, -161, -171, -174, -163, -149, -141, -141, -144, -151, -155, -153, -148, -144, -142, -142, -145, -147, -143, -136, -134, -140, -144, -148, -148, -146, -144, -148, -153, -153, -145, -134, -127, -125, -132, -139, -142, -140, -140, -140, -142, -142, -138, -131, -125, -123, -119, -111, -108, -109, -113, -118, -128, -139, -141, -137, -132, -125, -119, -116, -115, -118, -119, -121, -123, -122, -116, -105, -93, -82, -80, -87, -96, -103, -110, -112, -108, -103, -105, -107, -106, -105, -105, -103, -101, -101, -98, -91, -90, -97, -106, -112, -112, -108, -103, -104, -107, -109, -107, -104, -103, -101, -104, -113, -119, -119, -116, -114, -115, -116, -117, -117, -117, -118, -116, -112, -106, -106, -106, -101, -94, -94, -98, -103, -111, -118, -118, -117, -122, -131, -137, -134, -123, -114, -110, -114, -118, -119, -121, -123, -126, -124, -120, -113, -110, -111, -117, -121, -122, -121, -120, -118, -120, -125, -129, -128, -126, -127, -130, -129, -129, -130, -130, -133, -136, -134, -129, -127, -127, -122, -115, -115, -121, -128, -135, -139, -139, -137, -141, -145, -143, -138, -136, -138, -143, -145, -142, -135, -131, -134, -138, -140, -138, -135, -131, -132, -134, -131, -125, -122, -125, -133, -146, -155, -153, -145, -138, -136, -135, -139, -144, -144, -141, -142, -145, -145, -143, -142, -139, -133, -128, -133, -140, -146, -150, -154, -150, -140, -138, -141, -143, -141, -140, -142, -141, -138, -136, -133, -132, -133, -136, -141, -139, -131, -121, -119, -122, -120, -116, -116, -118, -120, -123, -131, -139, -144, -145, -144, -142, -138, -137, -138, -140, -140, -140, -135, -131, -130, -132, -128, -116, -107, -109, -120, -130, -139, -139, -134, -130, -132, -129, -124, -118, -116, -116, -122, -124, -119, -112, -110, -118, -127, -131, -130, -125, -120, -119, -120, -121, -118, -114, -108, -107, -114, -123, -127, -124, -122, -121, -119, -117, -116, -117, -119, -120, -120, -118, -114, -110, -104, -100, -94, -94, -96, -101, -105, -105, -109, -116, -123, -122, -118, -115, -112, -112, -111, -108, -103, -101, -105, -111, -118, -122, -122, -118, -116, -116, -118, -119, -121, -123, -122, -121, -125, -130, -129, -126, -122, -123, -123, -123, -125, -126, -127, -128, -127, -126, -124, -125, -124, -116, -106, -101, -101, -105, -110, -111, -115, -123, -135, -139, -137, -131, -120, -112, -114, -119, -119, -116, -115, -119, -120, -121, -119, -115, -111, -115, -120, -120, -117, -117, -115, -115, -123, -134, -140, -135, -130, -128, -129, -129, -131, -134, -136, -138, -141, -142, -139, -138, -138, -134, -127, -122, -124, -127, -131, -136, -137, -141, -149, -154, -152, -148, -145, -142, -144, -147, -145, -139, -137, -140, -145, -146, -147, -147, -142, -138, -138, -138, -139, -140, -144, -150, -149, -150, -157, -161, -161, -160, -157, -159, -156, -161, -160, -165, -166, -160, -160, -158, -161, -156, -146, -142, -145, -148, -151, -151, -155, -157, -160, -155, -146, -149, -156, -155, -170, -165, -138, -119, -112, -113, -110, -113, -114, -117, -115, -121, -118, -122, -123, -130, -131, -131, -136, -142, -154, -146, -175, -141, -136, -174, -166, -141, -166, -187, -152, -184, -190, -192, -166, -153, -162, -177, -192, -177, -176, -163, -145, -144, -146, -149, -141, -104, -99, -101, -101, -127, -108, -103, -104, -63, -56, -57, -75, -78, -66, -48, -60, -83, -74, -51, -45, -52, -49, -61, -57, -70, -78, -43, -42, -70, -54, -66, -62, -60, -87, -86, -97, -87, -70, -70, -93, -122, -101, -97, -83, -78, -99, -100, -109, -109, -111, -90, -93, -110, -108, -113, -111, -110, -123, -140, -129, -125, -122, -113, -101, -107, -118, -133, -150, -147, -135, -148, -161, -155, -155, -139, -130, -134, -138, -143, -144, -139, -138, -156, -170, -167, -161, -159, -149, -147, -151, -154, -149, -150, -143, -131, -144, -159, -156, -151, -147, -157, -160, -152, -147, -146, -151, -150, -141, -137, -130, -117, -126, -126, -127, -132, -119, -112, -119, -132, -124, -119, -131, -129, -117, -119, -132, -133, -123, -122, -127, -132, -129, -119, -120, -116, -117, -119, -113, -114, -121, -117, -121, -120, -112, -113, -118, -128, -131, -133, -127, -127, -121, -115, -115, -108, -111, -113, -121, -129, -123, -109, -106, -114, -130, -140, -140, -130, -114, -117, -115, -109, -102, -114, -123, -117, -116, -123, -141, -150, -144, -142, -140, -126, -129, -132, -130, -136, -142, -138, -125, -125, -123, -125, -129, -129, -133, -135, -137, -140, -139, -146, -151, -150, -156, -164, -163, -160, -158, -152, -150, -159, -154, -142, -140, -149, -168, -181, -180, -174, -161, -147, -138, -135, -142, -143, -140, -152, -160, -168, -160, -140, -131, -128, -141, -156, -154, -159, -158, -140, -134, -131, -122, -122, -126, -132, -134, -133, -132, -128, -123, -136, -136, -131, -131, -129, -146, -146, -135, -125, -118, -118, -120, -121, -104, -110, -117, -129, -123, -109, -112, -93, -109, -121, -126, -122, -113, -113, -92, -73, -68, -70, -75, -89, -88, -89, -98, -99, -86, -77, -65, -58, -65, -83, -107, -98, -84, -87, -84, -74, -69, -91, -98, -92, -102, -103, -91, -84, -77, -74, -85, -97, -105, -105, -97, -81, -66, -59, -67, -72, -89, -97, -91, -101, -111, -114, -115, -114, -101, -107, -114, -120, -118, -128, -122, -115, -127, -126, -124, -127, -128, -118, -131, -138, -121, -112, -107, -109, -120, -133, -139, -122, -121, -123, -125, -130, -130, -131, -129, -138, -149, -151, -158, -158, -149, -152, -155, -156, -145, -153, -152, -166, -164, -160, -170, -166, -170, -163, -171, -170, -170, -167, -183, -184, -171, -177, -174, -180, -172, -166, -180, -178, -175, -179, -175, -164, -163, -161, -157, -173, -170, -173, -178, -176, -166, -164, -160, -151, -150, -150, -165, -163, -163, -167, -173, -169, -163, -162, -159, -157, -154, -158, -160, -162, -154, -155, -146, -153, -166, -158, -158, -150, -145, -143, -144, -141, -137, -143, -151, -158, -149, -135, -135, -133, -117, -118, -117, -115, -121, -123, -129, -126, -108, -101, -103, -101, -109, -112, -111, -98, -94, -114, -123, -110, -105, -97, -92, -93, -102, -104, -97, -95, -106, -112, -101, -105, -108, -102, -105, -116, -126, -126, -125, -114, -105, -104, -95, -100, -101, -97, -87, -84, -89, -89, -89, -80, -83, -86, -93, -80, -88, -101, -103, -107, -92, -91, -82, -91, -98, -101, -102, -97, -103, -98, -108, -113, -111, -113, -104, -105, -104, -101, -103, -95, -94, -102, -96, -100, -116, -117, -121, -120, -126, -134, -131, -139, -141, -134, -130, -132, -128, -139, -134, -127, -126, -129, -142, -141, -140, -139, -139, -139, -140, -133, -140, -139, -136, -133, -130, -140, -138, -138, -135, -137, -146, -144, -143, -136, -130, -140, -149, -162, -161, -158, -148, -137, -130, -132, -131, -128, -135, -136, -146, -143, -135, -122, -115, -116, -119, -125, -140, -146, -129, -118, -110, -114, -119, -131, -130, -138, -144, -143, -141, -131, -130, -134, -139, -139, -145, -142, -135, -141, -140, -127, -123, -121, -130, -126, -131, -130, -119, -129, -128, -123, -127, -123, -121, -122, -117, -110, -108, -120, -119, -119, -122, -124, -122, -121, -123, -116, -118, -127, -132, -128, -121, -114, -123, -129, -128, -130, -136, -136, -123, -124, -126, -126, -135, -141, -155, -152, -140, -139, -141, -138, -131, -132, -132, -130, -127, -134, -128, -126, -123, -114, -121, -129, -132, -125, -134, -140, -138, -133, -134, -131, -122, -127, -137, -139, -141, -140, -142, -137, -139, -141, -137, -140, -134, -132, -132, -143, -138, -131, -131, -127, -131, -133, -135, -141, -139, -141, -147, -147, -139, -135, -133, -128, -126, -123, -133, -132, -125, -117, -121, -117, -122, -125, -118, -116, -120, -120, -115, -125, -129, -132, -120, -123, -130, -129, -136, -133, -128, -124, -119, -123, -118, -121, -123, -117, -111, -110, -116, -112, -105, -95, -102, -104, -104, -109, -112, -111, -115, -113, -95, -91, -99, -105, -95, -100, -101, -110, -112, -110, -105, -95, -93, -90, -104, -108, -106, -111, -107, -104, -101, -105, -108, -100, -105, -106, -109, -114, -105, -114, -116, -110, -112, -117, -125, -128, -124, -122, -116, -113, -105, -104, -112, -117, -123, -130, -133, -133, -130, -125, -125, -119, -118, -115, -124, -118, -112, -118, -111, -106, -105, -99, -105, -114, -120, -121, -129, -131, -125, -125, -128, -140, -147, -151, -142, -143, -141, -141, -141, -137, -136, -136, -142, -154, -150, -155, -159, -159, -160, -159, -160, -150, -155, -161, -168, -169, -168, -171, -167, -163, -161, -165, -159, -163, -165, -163, -158, -157, -164, -157, -152, -149, -149, -151, -152, -156, -167, -158, -147, -142, -137, -148, -150, -154, -154, -154, -162, -154, -152, -160, -152, -156, -160, -157, -153, -154, -160, -149, -150, -156, -152, -147, -151, -156, -160, -156, -148, -146, -140, -138, -132, -135, -147, -154, -156, -152, -148, -139, -128, -125, -127, -128, -118, -116, -115, -115, -104, -104, -108, -109, -108, -104, -109, -105, -108, -103, -115, -107, -89, -87, -95, -97, -97, -106, -106, -112, -112, -103, -104, -115, -116, -118, -124, -130, -122, -117, -118, -117, -120, -127, -121, -113, -111, -106, -108, -110, -114, -105, -102, -106, -98, -106, -114, -121, -120, -116, -115, -116, -115, -111, -115, -118, -115, -112, -106, -96, -98, -104, -101, -93, -88, -101, -102, -93, -101, -102, -93, -88, -87, -88, -102, -115, -122, -133, -127, -117, -111, -107, -109, -112, -121, -121, -122, -130, -129, -123, -104, -104, -109, -120, -117, -124, -135, -135, -129, -113, -120, -117, -113, -113, -127, -139, -134, -127, -122, -127, -133, -126, -137, -147, -137, -127, -133, -137, -123, -129, -137, -129, -126, -139, -133, -128, -122, -121, -124, -122, -119, -109, -113, -125, -125, -122, -121, -127, -123, -124, -123, -129, -128, -124, -123, -132, -140, -140, -146, -148, -141, -131, -134, -129, -128, -128, -133, -136, -139, -144, -142, -149, -143, -141, -150, -159, -150, -144, -150, -147, -142, -141, -144, -137, -136, -134, -135, -140, -138, -135, -133, -127, -126, -132, -140, -131, -119, -131, -133, -120, -112, -111, -103, -116, -128, -133, -141, -141, -142, -139, -139, -133, -138, -134, -133, -139, -139, -141, -134, -141, -143, -137, -128, -125, -130, -133, -133, -132, -136, -124, -117, -125, -127, -123, -123, -130, -125, -134, -134, -122, -113, -113, -113, -110, -123, -121, -120, -128, -130, -117, -114, -111, -106, -106, -109, -116, -109, -114, -117, -106, -100, -100, -101, -100, -111, -118, -115, -109, -106, -116, -118, -122, -115, -120, -129, -131, -128, -122, -124, -118, -134, -132, -135, -136, -135, -139, -135, -133, -129, -132, -128, -130, -125, -136, -141, -148, -150, -143, -136, -133, -127, -121, -128, -129, -130, -123, -131, -128, -128, -120, -122, -125, -116, -122, -128, -130, -129, -121, -114, -111, -103, -101, -105, -106, -110, -115, -113, -116, -116, -113, -118, -125, -126, -128, -125, -120, -116, -112, -111, -115, -119, -124, -121, -118, -123, -119, -122, -125, -122, -120, -120, -120, -125, -130, -120, -129, -139, -131, -124, -127, -136, -131, -130, -140, -139, -142, -147, -138, -138, -135, -134, -137, -133, -133, -128, -128, -133, -122, -110, -105, -107, -116, -114, -124, -127, -123, -127, -121, -116, -113, -122, -119, -117, -131, -129, -121, -122, -124, -128, -125, -124, -130, -128, -135, -138, -129, -136, -136, -133, -137, -135, -131, -127, -142, -153, -158, -162, -160, -159, -152, -148, -151, -147, -149, -164, -173, -168, -156, -161, -162, -157, -154, -162, -159, -163, -163, -154, -151, -146, -139, -138, -151, -159, -158, -158, -164, -154, -157, -154, -142, -148, -152, -164, -175, -180, -161, -153, -150, -149, -145, -140, -151, -151, -152, -142, -140, -141, -134, -139, -137, -140, -148, -147, -149, -149, -146, -138, -136, -135, -134, -124, -122, -130, -129, -125, -128, -129, -118, -113, -116, -116, -115, -124, -121, -112, -117, -112, -97, -95, -98, -95, -99, -109, -107, -111, -113, -104, -105, -111, -102, -106, -107, -104, -104, -111, -114, -115, -106, -95, -92, -95, -93, -85, -98, -105, -100, -102, -101, -95, -95, -95, -104, -118, -121, -116, -116, -106, -105, -99, -106, -112, -104, -111, -110, -117, -110, -100, -97, -98, -97, -96, -93, -94, -97, -101, -100, -95, -88, -81, -81, -94, -113, -106, -111, -113, -107, -106, -115, -114, -106, -108, -113, -119, -113, -113, -112, -112, -107, -111, -120, -125, -122, -117, -125, -131, -126, -126, -132, -133, -131, -133, -141, -146, -149, -151, -143, -145, -143, -138, -138, -134, -147, -138, -140, -145, -144, -146, -142, -137, -132, -130, -132, -140, -146, -138, -129, -119, -116, -114, -117, -129, -131, -135, -134, -136, -135, -131, -129, -130, -128, -123, -123, -129, -124, -129, -132, -125, -128, -123, -124, -128, -135, -131, -130, -132, -129, -127, -126, -134, -132, -140, -146, -149, -147, -139, -147, -145, -139, -142, -141, -138, -144, -157, -150, -139, -136, -133, -128, -121, -129, -132, -131, -128, -126, -132, -123, -109, -112, -109, -105, -113, -122, -128, -119, -115, -119, -120, -122, -120, -118, -117, -127, -128, -131, -133, -127, -125, -132, -139, -128, -133, -133, -136, -128, -120, -130, -131, -131, -126, -129, -130, -130, -132, -134, -143, -136, -136, -143, -136, -137, -138, -135, -136, -136, -139, -138, -126, -127, -137, -135, -129, -129, -128, -122, -125, -109, -102, -100, -110, -119, -116, -121, -123, -123, -123, -123, -122, -132, -136, -130, -132, -140, -140, -131, -134, -133, -138, -143, -139, -134, -142, -155, -146, -142, -143, -141, -140, -141, -132, -135, -142, -136, -137, -148, -147, -140, -134, -131, -137, -137, -129, -126, -131, -126, -128, -131, -137, -129, -121, -122, -120, -112, -116, -127, -121, -109, -107, -110, -110, -117, -121, -126, -123, -119, -123, -120, -116, -112, -116, -130, -126, -130, -131, -127, -126, -112, -109, -111, -111, -115, -119, -125, -126, -117, -116, -120, -125, -115, -113, -119, -118, -125, -122, -125, -123, -123, -118, -116, -115, -115, -120, -121, -128, -129, -126, -127, -121, -114, -110, -117, -117, -105, -98, -96, -109, -106, -110, -106, -105, -107, -106, -112, -115, -121, -116, -117, -111, -118, -132, -137, -131, -121, -118, -111, -114, -119, -117, -107, -107, -117, -122, -117, -119, -119, -117, -116, -115, -119, -119, -113, -113, -131, -147, -144, -132, -132, -129, -132, -131, -132, -138, -137, -131, -140, -140, -135, -133, -126, -127, -124, -127, -117, -111, -117, -127, -124, -124, -127, -135, -138, -138, -136, -133, -135, -140, -144, -141, -138, -151, -161, -152, -150, -138, -137, -140, -135, -128, -125, -136, -136, -137, -140, -138, -138, -141, -132, -133, -134, -131, -128, -138, -157, -162, -149, -141, -149, -143, -141, -140, -143, -150, -151, -147, -153, -152, -144, -138, -133, -141, -142, -137, -130, -128, -128, -128, -127, -130, -136, -138, -145, -151, -152, -139, -129, -130, -123, -132, -151, -162, -160, -148, -150, -151, -136, -127, -126, -119, -125, -131, -142, -151, -153, -143, -141, -136, -124, -132, -122, -120, -135, -147, -144, -144, -137, -128, -131, -124, -130, -128, -122, -127, -126, -128, -124, -126, -118, -119, -122, -117, -124, -118, -109, -105, -98, -91, -98, -104, -109, -113, -117, -111, -104, -111, -112, -109, -105, -105, -126, -137, -130, -120, -116, -121, -122, -117, -111, -106, -104, -105, -111, -118, -116, -110, -109, -119, -124, -125, -119, -111, -113, -125, -128, -126, -126, -131, -128, -125, -129, -134, -137, -132, -133, -125, -126, -122, -123, -120, -108, -115, -125, -117, -108, -97, -102, -104, -101, -109, -111, -113, -117, -123, -112, -110, -112, -107, -110, -131, -140, -126, -125, -118, -109, -117, -128, -119, -111, -113, -120, -125, -122, -125, -117, -116, -116, -126, -120, -118, -120, -121, -133, -144, -144, -139, -130, -127, -130, -130, -129, -130, -138, -146, -150, -140, -141, -134, -130, -133, -122, -125, -136, -126, -111, -116, -122, -127, -119, -121, -131, -135, -132, -134, -139, -128, -119, -122, -134, -147, -146, -143, -141, -140, -139, -128, -132, -127, -120, -123, -131, -139, -132, -135, -134, -133, -130, -129, -128, -125, -131, -128, -138, -143, -146, -148, -137, -132, -134, -138, -139, -134, -138, -144, -143, -143, -136, -136, -128, -132, -132, -138, -137, -123, -111, -113, -121, -114, -115, -123, -127, -122, -124, -125, -125, -123, -123, -122, -129, -140, -140, -131, -129, -125, -124, -127, -119, -114, -106, -110, -118, -123, -120, -118, -120, -120, -117, -115, -120, -114, -100, -111, -126, -130, -136, -131, -130, -128, -117, -116, -119, -121, -124, -126, -130, -133, -125, -117, -107, -112, -117, -117, -112, -105, -97, -100, -108, -110, -104, -115, -115, -116, -124, -121, -120, -114, -110, -108, -126, -135, -136, -128, -124, -122, -121, -125, -116, -111, -111, -121, -119, -123, -119, -122, -124, -130, -132, -122, -126, -119, -122, -134, -143, -151, -147, -141, -143, -137, -133, -137, -140, -143, -135, -144, -152, -146, -137, -132, -131, -129, -133, -143, -136, -123, -121, -130, -132, -133, -132, -135, -138, -131, -138, -141, -141, -136, -135, -138, -147, -155, -149, -146, -142, -141, -137, -138, -134, -125, -121, -128, -135, -135, -134, -137, -137, -139, -134, -135, -135, -129, -135, -144, -155, -152, -151, -147, -143, -140, -139, -142, -140, -141, -145, -142, -137, -137, -135, -124, -118, -115, -127, -127, -114, -112, -111, -110, -108, -115, -112, -114, -122, -123, -124, -122, -114, -116, -118, -115, -129, -138, -129, -119, -114, -119, -113, -105, -114, -103, -103, -112, -116, -118, -113, -115, -111, -112, -115, -118, -115, -111, -110, -123, -133, -135, -131, -125, -127, -123, -114, -120, -123, -119, -126, -125, -133, -129, -120, -116, -110, -114, -115, -117, -108, -102, -100, -109, -114, -116, -122, -119, -119, -126, -126, -124, -126, -123, -124, -128, -134, -146, -141, -135, -136, -132, -126, -122, -115, -116, -117, -126, -133, -128, -130, -129, -124, -128, -133, -130, -129, -124, -130, -139, -148, -148, -144, -145, -146, -140, -139, -139, -137, -146, -143, -146, -149, -146, -140, -135, -134, -135, -139, -134, -122, -117, -123, -127, -127, -130, -135, -137, -138, -143, -143, -135, -134, -132, -137, -143, -151, -156, -152, -149, -147, -138, -136, -126, -122, -123, -126, -136, -136, -132, -129, -127, -128, -136, -133, -134, -126, -122, -131, -139, -149, -146, -140, -144, -141, -133, -134, -130, -140, -136, -134, -139, -139, -127, -126, -125, -116, -124, -129, -127, -119, -113, -108, -110, -109, -105, -119, -126, -122, -125, -122, -118, -115, -117, -115, -127, -139, -132, -128, -123, -115, -118, -113, -102, -101, -102, -108, -112, -120, -112, -112, -106, -103, -110, -116, -117, -112, -113, -110, -121, -128, -131, -127, -124, -126, -122, -122, -121, -121, -124, -127, -129, -130, -122, -114, -115, -110, -112, -115, -112, -117, -116, -109, -100, -102, -104, -111, -116, -120, -117, -117, -120, -118, -121, -112, -114, -128, -135, -137, -136, -129, -117, -113, -113, -110, -107, -114, -121, -124, -127, -125, -122, -121, -117, -122, -129, -123, -124, -127, -129, -137, -142, -140, -137, -137, -140, -139, -136, -129, -136, -131, -132, -139, -134, -134, -128, -128, -125, -118, -122, -124, -124, -122, -111, -108, -115, -115, -124, -131, -128, -129, -132, -132, -124, -125, -130, -136, -145, -150, -149, -141, -131, -125, -126, -119, -121, -126, -128, -130, -134, -138, -133, -132, -132, -133, -135, -134, -133, -135, -140, -143, -140, -144, -151, -151, -147, -147, -148, -142, -134, -136, -140, -141, -138, -143, -138, -129, -132, -132, -128, -123, -124, -135, -132, -125, -125, -126, -123, -123, -128, -134, -135, -132, -133, -130, -130, -134, -137, -138, -143, -139, -135, -133, -131, -127, -119, -123, -124, -123, -128, -131, -134, -129, -127, -130, -129, -129, -126, -132, -128, -131, -132, -130, -133, -136, -142, -144, -144, -146, -141, -132, -136, -140, -140, -132, -135, -139, -137, -131, -136, -129, -121, -127, -130, -127, -119, -122, -119, -125, -127, -122, -123, -126, -123, -124, -128, -127, -133, -133, -129, -129, -129, -127, -122, -117, -117, -117, -124, -122, -119, -116, -115, -119, -119, -122, -123, -121, -122, -120, -119, -122, -125, -122, -121, -121, -136, -139, -134, -133, -133, -137, -134, -124, -124, -129, -131, -128, -127, -128, -123, -124, -124, -122, -122, -120, -121, -118, -112, -115, -121, -121, -121, -119, -121, -116, -119, -123, -125, -112, -109, -115, -115, -117, -115, -123, -121, -118, -115, -111, -111, -107, -114, -116, -113, -120, -116, -117, -118, -117, -117, -121, -123, -122, -122, -118, -127, -127, -127, -129, -129, -131, -132, -130, -128, -133, -134, -134, -134, -134, -136, -129, -128, -130, -124, -126, -129, -132, -131, -126, -125, -124, -118, -119, -123, -121, -119, -121, -121, -117, -118, -119, -118, -115, -115, -117, -118, -113, -112, -119, -118, -115, -111, -115, -118, -113, -114, -112, -118, -118, -119, -118, -111, -120, -121, -123, -123, -120, -118, -118, -126, -127, -127, -131, -126, -127, -124, -125, -131, -139, -138, -135, -137, -130, -132, -132, -136, -139, -135, -128, -126, -132, -131, -130, -126, -128, -129, -129, -128, -126, -126, -131, -128, -124, -121, -124, -131, -126, -127, -129, -125, -126, -131, -132, -131, -133, -132, -133, -134, -134, -132, -132, -132, -129, -131, -134, -133, -134, -134, -136, -131, -134, -134, -129, -134, -136, -138, -138, -141, -143, -143, -142, -145, -144, -143, -149, -151, -152, -154, -153, -152, -148, -149, -151, -144, -141, -140, -137, -139, -135, -137, -137, -133, -138, -136, -138, -135, -135, -132, -133, -137, -136, -131, -134, -135, -130, -135, -134, -134, -135, -135, -132, -130, -126, -127, -130, -132, -132, -136, -131, -123, -127, -120, -122, -125, -122, -126, -125, -123, -126, -131, -129, -128, -129, -131, -130, -127, -129, -128, -133, -134, -130, -130, -132, -133, -137, -132, -132, -134, -133, -128, -125, -123, -117, -122, -120, -116, -114, -117, -120, -122, -119, -114, -108, -108, -115, -115, -115, -116, -117, -112, -112, -115, -117, -116, -114, -110, -114, -120, -117, -113, -111, -110, -110, -112, -113, -110, -112, -111, -111, -114, -114, -113, -114, -121, -121, -120, -121, -121, -120, -122, -123, -121, -122, -127, -128, -127, -125, -125, -128, -128, -126, -126, -128, -132, -128, -127, -131, -127, -125, -123, -121, -120, -123, -121, -117, -117, -120, -123, -124, -122, -120, -118, -121, -121, -119, -121, -121, -120, -122, -123, -124, -122, -117, -117, -123, -118, -119, -121, -121, -120, -125, -126, -124, -123, -125, -128, -125, -126, -128, -129, -129, -129, -128, -130, -129, -128, -133, -135, -141, -141, -140, -136, -135, -137, -135, -140, -147, -144, -141, -138, -144, -143, -142, -144, -140, -133, -134, -135, -135, -136, -134, -132, -132, -131, -134, -136, -131, -135, -139, -135, -134, -130, -124, -130, -135, -132, -132, -137, -139, -137, -126, -131, -134, -130, -133, -133, -133, -134, -134, -132, -134, -131, -133, -131, -126, -129, -130, -129, -129, -130, -129, -131, -131, -132, -134, -132, -133, -133, -136, -136, -134, -137, -138, -139, -141, -141, -140, -140, -142, -139, -134, -137, -134, -133, -134, -133, -130, -126, -125, -126, -128, -126, -126, -121, -123, -118, -117, -123, -121, -118, -118, -120, -119, -120, -121, -122, -123, -126, -120, -115, -116, -117, -124, -121, -117, -118, -118, -113, -114, -121, -120, -119, -120, -120, -122, -125, -122, -122, -123, -124, -128, -127, -128, -128, -126, -126, -132, -136, -134, -132, -136, -136, -134, -135, -135, -133, -131, -130, -131, -133, -126, -128, -123, -123, -130, -128, -127, -122, -117, -120, -118, -118, -123, -120, -118, -119, -118, -118, -116, -117, -121, -125, -122, -122, -124, -123, -125, -123, -116, -117, -123, -119, -122, -123, -121, -117, -114, -117, -115, -119, -121, -119, -122, -123, -120, -116, -118, -125, -125, -120, -123, -126, -128, -132, -129, -129, -132, -130, -128, -130, -139, -139, -132, -133, -134, -134, -131, -129, -124, -121, -122, -125, -125, -126, -129, -122, -118, -118, -120, -120, -121, -124, -124, -119, -124, -124, -121, -120, -117, -120, -120, -117, -118, -122, -122, -120, -122, -121, -123, -117, -118, -121, -121, -121, -118, -123, -122, -120, -124, -125, -126, -127, -128, -131, -133, -136, -136, -133, -136, -136, -140, -145, -139, -142, -141, -142, -147, -145, -146, -149, -148, -143, -141, -140, -137, -135, -136, -137, -133, -131, -130, -130, -132, -128, -128, -131, -128, -131, -131, -126, -130, -132, -131, -127, -128, -132, -130, -131, -129, -130, -131, -130, -126, -131, -129, -124, -126, -128, -124, -123, -130, -127, -130, -131, -132, -133, -131, -130, -130, -137, -136, -137, -141, -142, -139, -141, -140, -139, -142, -140, -140, -139, -144, -144, -139, -141, -145, -145, -144, -138, -135, -134, -132, -128, -133, -133, -133, -131, -129, -130, -126, -128, -129, -126, -129, -126, -123, -125, -127, -121, -124, -123, -124, -126, -123, -124, -120, -120, -122, -122, -121, -122, -121, -124, -126, -121, -118, -122, -123, -124, -123, -121, -122, -126, -127, -126, -128, -126, -126, -126, -129, -129, -131, -133, -132, -132, -127, -132, -135, -136, -134, -134, -131, -130, -130, -127, -124, -123, -125, -120, -121, -119, -122, -121, -116, -118, -121, -118, -114, -117, -115, -116, -115, -115, -113, -110, -109, -111, -112, -111, -109, -113, -113, -113, -114, -115, -110, -109, -112, -115, -114, -111, -111, -110, -112, -116, -113, -114, -113, -111, -117, -120, -118, -120, -123, -122, -122, -120, -124, -124, -126, -127, -130, -129, -129, -129, -130, -134, -135, -137, -138, -137, -133, -131, -129, -131, -129, -131, -129, -130, -131, -130, -128, -125, -125, -127, -127, -126, -123, -124, -124, -123, -123, -125, -125, -128, -128, -125, -128, -126, -123, -124, -125, -126, -126, -125, -124, -126, -125, -127, -126, -127, -130, -128, -127, -127, -127, -130, -130, -137, -137, -136, -139, -142, -143, -137, -140, -142, -143, -141, -143, -141, -143, -148, -147, -146, -145, -144, -141, -139, -141, -140, -136, -137, -134, -135, -136, -132, -131, -132, -136, -133, -124, -127, -133, -131, -128, -129, -126, -130, -132, -126, -127, -130, -131, -131, -130, -128, -127, -129, -128, -129, -129, -129, -127, -127, -127, -126, -125, -125, -126, -123, -123, -126, -127, -128, -128, -128, -129, -128, -132, -131, -129, -130, -132, -136, -136, -137, -136, -136, -137, -139, -141, -140, -138, -136, -133, -132, -131, -131, -130, -132, -129, -128, -128, -122, -122, -123, -124, -125, -123, -123, -126, -120, -119, -123, -123, -124, -123, -120, -121, -121, -117, -117, -119, -121, -117, -116, -118, -118, -115, -115, -115, -117, -116, -113, -115, -116, -118, -116, -116, -115, -117, -119, -120, -125, -121, -121, -123, -125, -129, -130, -126, -126, -129, -131, -130, -132, -132, -132, -131, -133, -132, -130, -127, -125, -125, -124, -127, -127, -127, -124, -124, -118, -121, -122, -123, -124, -121, -124, -123, -121, -124, -125, -125, -124, -123, -125, -127, -127, -126, -122, -122, -121, -119, -122, -120, -120, -122, -124, -119, -114, -115, -119, -121, -122, -121, -121, -122, -124, -126, -124, -126, -129, -132, -134, -134, -134, -134, -135, -135, -136, -134, -132, -136, -135, -136, -139, -142, -142, -138, -137, -135, -134, -133, -134, -134, -135, -132, -133, -131, -131, -130, -128, -129, -128, -129, -129, -128, -124, -126, -122, -123, -127, -127, -125, -122, -123, -123, -122, -120, -119, -119, -123, -124, -124, -124, -125, -122, -122, -125, -125, -123, -122, -125, -126, -125, -129, -131, -128, -126, -129, -133, -133, -132, -133, -133, -138, -136, -136, -140, -140, -139, -141, -140, -138, -138, -134, -131, -130, -128, -132, -130, -127, -128, -128, -129, -124, -124, -124, -124, -125, -124, -124, -122, -123, -127, -129, -124, -122, -123, -123, -121, -125, -125, -125, -127, -123, -122, -126, -126, -125, -122, -126, -125, -123, -125, -123, -126, -125, -125, -127, -130, -129, -126, -129, -132, -132, -129, -131, -133, -133, -135, -136, -141, -139, -139, -138, -134, -140, -144, -147, -146, -141, -138, -137, -136, -134, -135, -134, -134, -132, -131, -134, -132, -129, -127, -125, -126, -124, -125, -122, -122, -126, -127, -126, -125, -125, -124, -125, -124, -125, -123, -127, -123, -121, -124, -123, -119, -118, -121, -119, -118, -120, -121, -120, -121, -122, -123, -126, -127, -128, -126, -127, -130, -130, -132, -134, -135, -136, -136, -136, -136, -138, -135, -137, -139, -141, -138, -135, -134, -130, -128, -129, -128, -130, -127, -126, -127, -126, -125, -124, -125, -122, -120, -121, -120, -120, -120, -117, -116, -116, -117, -120, -120, -120, -122, -118, -116, -116, -117, -117, -120, -120, -118, -121, -120, -118, -116, -116, -117, -118, -119, -121, -120, -121, -122, -121, -121, -121, -124, -124, -126, -129, -130, -131, -127, -130, -130, -131, -132, -133, -136, -137, -137, -135, -134, -131, -129, -127, -125, -127, -129, -131, -130, -131, -128, -124, -124, -124, -123, -126, -127, -125, -123, -123, -126, -128, -126, -125, -123, -124, -126, -126, -124, -126, -128, -123, -121, -122, -123, -124, -122, -124, -126, -127, -125, -123, -125, -125, -126, -124, -127, -127, -130, -131, -129, -129, -131, -129, -128, -132, -136, -134, -135, -135, -133, -134, -132, -134, -138, -144, -144, -140, -136, -136, -135, -131, -132, -131, -133, -129, -129, -131, -129, -126, -123, -120, -119, -122, -125, -125, -124, -127, -126, -128, -126, -127, -126, -124, -127, -128, -127, -129, -129, -127, -128, -124, -121, -118, -118, -119, -121, -125, -125, -123, -123, -123, -125, -127, -130, -127, -130, -127, -127, -130, -128, -128, -131, -133, -134, -134, -132, -134, -133, -131, -131, -129, -129, -129, -132, -133, -128, -129, -130, -133, -131, -129, -128, -129, -130, -128, -129, -130, -127, -126, -124, -124, -125, -125, -127, -126, -126, -128, -127, -127, -124, -123, -126, -128, -126, -123, -126, -128, -127, -125, -123, -125, -125, -126, -125, -127, -127, -128, -126, -125, -125, -125, -126, -122, -123, -125, -128, -130, -131, -134, -134, -133, -130, -131, -132, -134, -132, -132, -131, -129, -127, -128, -127, -123, -124, -126, -129, -127, -125, -123, -122, -124, -125, -127, -128, -129, -129, -128, -130, -128, -127, -127, -127, -129, -131, -129, -127, -128, -127, -129, -126, -126, -124, -122, -121, -121, -122, -122, -120, -122, -124, -124, -123, -122, -124, -126, -127, -126, -126, -127, -128, -124, -120, -119, -119, -118, -123, -126, -127, -125, -124, -126, -126, -129, -128, -126, -125, -128, -129, -133, -137, -139, -137, -136, -134, -132, -127, -124, -126, -132, -134, -134, -134, -131, -127, -126, -126, -124, -124, -122, -125, -124, -120, -121, -125, -124, -122, -121, -120, -122, -123, -121, -121, -121, -120, -122, -128, -130, -130, -127, -124, -123, -125, -125, -124, -122, -123, -127, -130, -129, -130, -129, -128, -130, -129, -126, -123, -128, -130, -132, -132, -133, -132, -131, -131, -130, -131, -131, -131, -130, -131, -133, -133, -133, -131, -131, -130, -130, -130, -128, -128, -126, -125, -123, -126, -127, -126, -126, -128, -127, -126, -128, -128, -129, -128, -127, -127, -127, -129, -128, -130, -132, -133, -131, -131, -130, -127, -126, -125, -125, -125, -128, -129, -126, -124, -124, -126, -126, -127, -127, -126, -126, -131, -132, -131, -133, -136, -130, -125, -125, -126, -129, -128, -127, -128, -130, -128, -129, -131, -131, -129, -130, -133, -132, -129, -128, -129, -129, -131, -130, -127, -126, -127, -128, -126, -125, -124, -126, -127, -127, -128, -130, -127, -126, -123, -125, -126, -126, -127, -131, -129, -128, -128, -128, -127, -130, -131, -131, -131, -129, -131, -132, -128, -122, -121, -125, -124, -127, -129, -127, -125, -126, -127, -127, -125, -126, -127, -126, -127, -129, -128, -129, -128, -129, -128, -126, -126, -125, -128, -126, -125, -129, -128, -125, -124, -123, -121, -120, -120, -122, -122, -122, -121, -120, -120, -124, -124, -124, -126, -128, -128, -127, -123, -123, -123, -124, -127, -127, -127, -128, -130, -129, -128, -124, -122, -126, -128, -130, -129, -128, -129, -130, -127, -127, -127, -126, -126, -126, -127, -126, -125, -127, -126, -124, -123, -124, -125, -123, -124, -125, -127, -127, -126, -127, -128, -128, -128, -127, -128, -129, -129, -130, -129, -128, -125, -125, -125, -126, -127, -125, -126, -125, -125, -126, -127, -125, -124, -128, -129, -127, -129, -129, -129, -129, -129, -127, -129, -127, -129, -130, -131, -130, -130, -131, -129, -127, -125, -125, -126, -128, -128, -127, -126, -124, -125, -126, -125, -123, -124, -124, -128, -128, -127, -126, -126, -127, -125, -125, -127, -130, -129, -128, -128, -129, -129, -127, -127, -128, -127, -127, -131, -132, -130, -129, -128, -130, -130, -129, -132, -131, -131, -129, -129, -127, -124, -123, -121, -124, -125, -129, -130, -132, -135, -132, -133, -131, -133, -135, -133, -131, -129, -131, -132, -127, -124, -123, -122, -125, -123, -123, -124, -123, -125, -125, -125, -124, -126, -127, -129, -131, -131, -131, -132, -132, -131, -130, -129, -127, -130, -132, -130, -131, -132, -132, -131, -129, -126, -128, -130, -130, -130, -130, -128, -125, -125, -126, -126, -125, -127, -127, -126, -127, -126, -126, -125, -124, -128, -131, -131, -131, -131, -129, -127, -127, -125, -123, -123, -122, -119, -120, -122, -123, -123, -125, -124, -125, -126, -126, -126, -128, -129, -129, -127, -125, -125, -124, -122, -125, -125, -124, -124, -127, -125, -126, -130, -133, -133, -135, -136, -134, -132, -129, -128, -125, -121, -120, -118, -119, -119, -120, -123, -124, -126, -128, -125, -124, -124, -128, -129, -132, -133, -131, -128, -125, -118, -113, -116, -120, -123, -125, -135, -143, -143, -137, -130, -126, -123, -118, -120, -122, -128, -133, -126, -117, -111, -114, -117, -123, -127, -130, -130, -130, -131, -127, -123, -123, -125, -128, -132, -134, -132, -127, -121, -130, -140, -138, -128, -124, -127, -129, -128, -132, -134, -131, -130, -128, -126, -128, -133, -135, -133, -134, -134, -131, -128, -127, -125, -126, -129, -131, -133, -132, -129, -126, -124, -121, -120, -125, -128, -123, -114, -111, -111, -114, -115, -116, -121, -123, -125, -125, -125, -123, -123, -123, -126, -126, -130, -140, -143, -136, -130, -132, -134, -130, -125, -127, -130, -133, -134, -137, -135, -134, -132, -133, -131, -126, -124, -132, -140, -142, -139, -136, -134, -130, -127, -129, -131, -130, -133, -133, -132, -131, -129, -123, -121, -125, -126, -118, -111, -111, -116, -120, -121, -123, -125, -125, -125, -124, -124, -123, -125, -128, -130, -130, -133, -134, -131, -132, -131, -132, -131, -133, -132, -130, -128, -129, -129, -128, -128, -129, -133, -134, -134, -129, -123, -125, -134, -142, -143, -140, -136, -133, -130, -128, -128, -126, -126, -126, -129, -130, -131, -124, -119, -122, -125, -120, -111, -104, -107, -114, -118, -123, -121, -121, -120, -119, -118, -117, -119, -120, -124, -127, -128, -128, -127, -128, -126, -126, -125, -126, -127, -130, -128, -125, -121, -124, -127, -128, -127, -129, -130, -129, -129, -130, -123, -119, -126, -137, -140, -138, -134, -132, -130, -126, -127, -127, -127, -128, -130, -129, -129, -127, -127, -129, -125, -116, -109, -108, -114, -118, -121, -123, -123, -121, -122, -122, -121, -118, -118, -121, -126, -129, -130, -131, -129, -127, -128, -131, -135, -135, -133, -132, -131, -130, -130, -126, -126, -130, -133, -134, -135, -134, -130, -125, -124, -130, -138, -143, -141, -138, -135, -133, -132, -132, -130, -132, -132, -132, -132, -129, -126, -122, -123, -128, -127, -117, -112, -112, -115, -116, -118, -122, -122, -122, -121, -121, -122, -122, -124, -125, -127, -132, -132, -128, -127, -127, -133, -132, -127, -131, -136, -138, -128, -125, -125, -122, -125, -129, -132, -131, -129, -131, -132, -127, -129, -134, -139, -141, -138, -136, -133, -129, -127, -129, -129, -131, -130, -130, -128, -125, -121, -119, -122, -126, -118, -113, -110, -114, -119, -120, -122, -122, -123, -121, -123, -121, -119, -119, -120, -126, -129, -132, -130, -129, -134, -135, -128, -127, -135, -140, -135, -129, -128, -130, -130, -127, -130, -131, -131, -130, -133, -131, -125, -125, -130, -138, -143, -141, -135, -127, -125, -125, -126, -126, -130, -126, -131, -132, -131, -128, -122, -123, -124, -127, -120, -112, -108, -112, -117, -120, -124, -123, -120, -122, -121, -121, -123, -123, -124, -128, -131, -134, -134, -135, -133, -129, -132, -132, -129, -134, -137, -136, -133, -132, -129, -131, -132, -131, -130, -128, -131, -126, -124, -127, -135, -140, -139, -135, -134, -131, -130, -130, -131, -129, -129, -129, -129, -128, -125, -123, -120, -122, -127, -123, -114, -109, -111, -114, -118, -120, -125, -125, -124, -124, -124, -121, -117, -120, -124, -128, -130, -133, -129, -129, -130, -130, -129, -127, -129, -132, -131, -127, -127, -128, -125, -125, -128, -131, -132, -133, -133, -126, -127, -135, -141, -139, -132, -131, -130, -129, -131, -129, -131, -129, -128, -128, -128, -127, -120, -120, -121, -127, -130, -122, -111, -108, -111, -116, -116, -122, -125, -122, -123, -123, -125, -122, -121, -122, -122, -128, -131, -130, -130, -130, -131, -126, -127, -136, -140, -137, -126, -124, -125, -126, -126, -129, -132, -131, -133, -135, -129, -126, -130, -139, -142, -134, -130, -131, -134, -133, -130, -131, -130, -129, -131, -132, -130, -125, -124, -124, -125, -130, -126, -116, -106, -106, -111, -116, -120, -121, -122, -121, -124, -123, -121, -120, -122, -124, -130, -134, -134, -134, -131, -128, -125, -126, -135, -142, -135, -128, -125, -127, -126, -125, -130, -130, -133, -133, -134, -130, -123, -125, -137, -139, -131, -128, -137, -141, -138, -135, -132, -133, -127, -127, -132, -131, -127, -125, -123, -123, -124, -127, -121, -111, -106, -106, -112, -115, -121, -125, -126, -123, -122, -122, -120, -117, -119, -122, -126, -131, -133, -130, -127, -126, -127, -132, -136, -133, -128, -125, -127, -127, -127, -131, -131, -132, -133, -133, -131, -128, -128, -129, -130, -127, -130, -138, -143, -140, -138, -133, -129, -126, -126, -127, -129, -129, -129, -129, -127, -127, -126, -126, -119, -111, -108, -111, -115, -118, -121, -124, -123, -122, -121, -121, -121, -121, -122, -127, -130, -131, -130, -130, -126, -127, -133, -143, -140, -128, -125, -126, -128, -127, -128, -130, -131, -132, -133, -134, -133, -128, -126, -127, -127, -132, -136, -140, -140, -138, -138, -134, -132, -128, -128, -131, -129, -127, -128, -128, -126, -123, -126, -123, -117, -110, -108, -113, -117, -120, -122, -124, -123, -121, -121, -122, -122, -124, -124, -127, -130, -132, -129, -126, -125, -134, -143, -138, -131, -125, -126, -126, -125, -128, -127, -128, -128, -132, -132, -130, -129, -127, -129, -129, -128, -128, -134, -139, -139, -136, -133, -128, -127, -128, -129, -128, -128, -129, -128, -127, -124, -125, -127, -120, -114, -111, -113, -116, -119, -121, -123, -123, -124, -124, -123, -120, -121, -122, -125, -130, -130, -129, -123, -125, -131, -133, -130, -127, -123, -125, -130, -132, -133, -130, -128, -128, -130, -129, -127, -127, -126, -129, -131, -130, -130, -130, -138, -141, -140, -139, -133, -130, -130, -130, -130, -130, -134, -133, -132, -129, -128, -127, -126, -119, -112, -111, -116, -119, -122, -122, -125, -125, -121, -118, -118, -117, -118, -122, -124, -128, -129, -129, -128, -130, -133, -130, -127, -126, -126, -127, -130, -130, -129, -128, -128, -129, -130, -129, -129, -131, -129, -133, -133, -129, -128, -133, -140, -143, -140, -138, -134, -130, -129, -129, -131, -129, -129, -130, -132, -129, -126, -127, -125, -118, -109, -106, -111, -117, -121, -122, -125, -124, -124, -122, -121, -119, -120, -124, -125, -127, -128, -128, -129, -133, -133, -129, -126, -127, -133, -137, -133, -127, -124, -124, -125, -130, -132, -132, -129, -131, -131, -132, -129, -126, -127, -134, -143, -144, -138, -135, -131, -130, -126, -128, -127, -125, -128, -127, -129, -126, -124, -128, -126, -118, -111, -110, -112, -118, -122, -123, -122, -122, -122, -122, -119, -120, -120, -122, -128, -130, -130, -129, -129, -128, -124, -124, -128, -135, -139, -136, -127, -122, -122, -124, -125, -129, -131, -131, -132, -130, -131, -128, -123, -121, -127, -136, -141, -138, -136, -132, -130, -129, -132, -131, -130, -130, -130, -131, -128, -125, -122, -125, -123, -116, -111, -112, -112, -116, -120, -124, -125, -123, -122, -121, -121, -119, -121, -124, -127, -132, -132, -131, -130, -125, -123, -124, -135, -144, -140, -131, -122, -123, -123, -123, -125, -129, -130, -134, -133, -132, -129, -125, -122, -127, -136, -144, -143, -139, -135, -131, -127, -124, -127, -127, -129, -132, -133, -130, -126, -122, -125, -125, -123, -114, -110, -113, -116, -120, -124, -127, -126, -123, -123, -123, -121, -120, -122, -125, -130, -135, -135, -134, -130, -123, -121, -131, -141, -140, -129, -121, -119, -124, -125, -126, -129, -130, -130, -132, -133, -128, -123, -118, -121, -129, -138, -143, -141, -134, -131, -130, -125, -125, -126, -127, -130, -133, -132, -130, -125, -123, -126, -128, -121, -114, -113, -114, -119, -124, -126, -126, -125, -125, -124, -124, -123, -121, -123, -125, -130, -132, -132, -129, -124, -124, -132, -141, -140, -127, -120, -120, -123, -125, -125, -129, -129, -131, -132, -132, -128, -125, -123, -123, -129, -137, -142, -141, -137, -135, -133, -130, -129, -129, -130, -130, -132, -133, -132, -129, -125, -126, -128, -125, -117, -110, -111, -115, -120, -120, -124, -124, -125, -124, -125, -123, -122, -121, -124, -128, -131, -132, -129, -124, -124, -129, -139, -141, -130, -121, -120, -122, -123, -127, -130, -132, -130, -132, -133, -130, -125, -123, -125, -128, -136, -141, -142, -138, -133, -131, -127, -126, -127, -129, -131, -133, -132, -130, -126, -123, -122, -124, -128, -125, -116, -110, -112, -116, -121, -123, -125, -125, -124, -124, -124, -123, -121, -121, -125, -133, -134, -130, -127, -123, -127, -136, -139, -133, -124, -124, -126, -126, -126, -129, -130, -131, -132, -133, -132, -129, -125, -125, -127, -131, -137, -141, -137, -135, -132, -130, -127, -126, -127, -129, -130, -132, -130, -128, -128, -123, -124, -128, -129, -119, -112, -111, -114, -117, -119, -123, -126, -127, -127, -126, -125, -121, -119, -122, -126, -131, -131, -129, -126, -128, -132, -132, -130, -124, -124, -126, -130, -130, -130, -130, -128, -127, -127, -128, -127, -126, -126, -127, -128, -132, -135, -138, -136, -136, -134, -132, -130, -129, -131, -131, -132, -132, -129, -128, -126, -123, -125, -127, -125, -114, -109, -111, -115, -119, -126, -130, -128, -126, -126, -124, -121, -120, -121, -124, -130, -133, -132, -130, -128, -130, -131, -129, -127, -126, -126, -127, -130, -131, -131, -129, -127, -129, -131, -130, -129, -129, -128, -128, -129, -132, -134, -135, -134, -134, -133, -131, -128, -127, -129, -127, -129, -129, -128, -125, -124, -125, -129, -127, -118, -109, -109, -113, -117, -121, -126, -127, -126, -124, -123, -123, -121, -122, -123, -128, -132, -131, -129, -125, -127, -133, -134, -131, -125, -123, -126, -127, -129, -128, -127, -127, -128, -130, -130, -128, -126, -125, -128, -130, -129, -131, -135, -137, -136, -135, -134, -129, -128, -128, -130, -129, -129, -130, -130, -128, -127, -128, -129, -123, -113, -109, -112, -117, -121, -126, -127, -127, -125, -123, -122, -119, -119, -121, -126, -129, -131, -131, -130, -130, -129, -129, -128, -126, -125, -128, -130, -130, -129, -129, -128, -129, -128, -129, -128, -128, -127, -129, -129, -128, -130, -135, -140, -140, -138, -136, -134, -131, -129, -131, -131, -131, -132, -130, -130, -127, -123, -126, -124, -117, -108, -110, -115, -119, -123, -127, -127, -123, -122, -120, -120, -121, -121, -125, -128, -131, -132, -128, -126, -127, -127, -127, -127, -127, -128, -131, -132, -130, -130, -128, -126, -127, -130, -131, -131, -129, -129, -129, -129, -128, -133, -138, -139, -137, -134, -133, -130, -127, -126, -127, -128, -129, -129, -129, -127, -125, -126, -127, -123, -113, -109, -111, -115, -120, -126, -129, -129, -125, -124, -122, -121, -120, -123, -128, -129, -129, -129, -127, -126, -128, -127, -127, -127, -127, -129, -128, -129, -130, -130, -130, -131, -131, -131, -129, -130, -128, -125, -124, -123, -127, -134, -139, -138, -136, -134, -130, -127, -125, -128, -128, -128, -128, -129, -130, -128, -127, -128, -129, -121, -113, -108, -111, -117, -124, -129, -128, -125, -123, -122, -119, -118, -119, -122, -126, -130, -133, -132, -128, -128, -127, -125, -126, -128, -132, -134, -133, -128, -127, -126, -126, -127, -130, -132, -131, -131, -130, -129, -127, -129, -134, -140, -140, -138, -136, -133, -132, -131, -130, -130, -130, -131, -132, -130, -128, -126, -126, -127, -123, -115, -110, -111, -117, -121, -124, -126, -125, -124, -124, -125, -122, -122, -123, -125, -130, -131, -132, -130, -127, -125, -126, -126, -128, -130, -133, -133, -132, -130, -130, -129, -127, -128, -130, -130, -130, -129, -130, -128, -126, -128, -135, -140, -139, -135, -136, -132, -129, -126, -126, -126, -128, -129, -130, -130, -127, -124, -126, -125, -117, -112, -111, -116, -119, -123, -127, -126, -123, -121, -122, -121, -120, -121, -124, -127, -130, -130, -127, -126, -126, -126, -126, -127, -128, -128, -129, -131, -132, -130, -129, -129, -128, -130, -130, -130, -130, -130, -130, -125, -126, -131, -137, -138, -136, -135, -133, -129, -129, -128, -129, -128, -130, -133, -132, -130, -127, -127, -126, -120, -112, -109, -113, -118, -123, -125, -127, -125, -122, -121, -121, -120, -120, -121, -124, -126, -129, -131, -130, -128, -126, -125, -125, -126, -128, -130, -132, -132, -130, -128, -125, -126, -126, -127, -129, -130, -130, -129, -127, -126, -130, -138, -142, -140, -136, -134, -131, -129, -126, -127, -127, -129, -132, -130, -127, -126, -128, -124, -116, -110, -110, -115, -120, -124, -126, -126, -123, -123, -124, -122, -121, -121, -124, -128, -130, -130, -130, -132, -136, -137, -128, -119, -116, -120, -125, -130, -135, -135, -132, -126, -125, -125, -124, -124, -127, -130, -133, -132, -126, -122, -125, -133, -138, -138, -137, -135, -132, -129, -128, -127, -125, -127, -130, -136, -133, -122, -110, -109, -115, -119, -125, -128, -130, -129, -127, -125, -120, -120, -126, -135, -140, -140, -136, -130, -125, -124, -123, -125, -129, -131, -125, -119, -117, -118, -120, -123, -127, -129, -127, -124, -122, -121, -121, -122, -124, -126, -130, -130, -128, -130, -138, -141, -140, -137, -135, -132, -131, -133, -132, -129, -132, -136, -134, -123, -116, -115, -116, -119, -124, -129, -128, -129, -129, -127, -125, -128, -132, -136, -138, -138, -134, -130, -129, -128, -128, -128, -130, -132, -129, -119, -113, -112, -114, -117, -121, -126, -126, -125, -125, -122, -119, -121, -127, -132, -136, -138, -137, -137, -135, -133, -131, -130, -131, -132, -127, -122, -119, -121, -121, -123, -125, -127, -127, -127, -125, -123, -123, -125, -128, -133, -134, -135, -134, -130, -129, -128, -128, -125, -121, -121, -122, -123, -125, -129, -131, -133, -132, -127, -119, -114, -115, -118, -124, -130, -135, -136, -135, -132, -127, -125, -124, -124, -124, -123, -126, -127, -128, -129, -130, -129, -128, -124, -118, -116, -114, -117, -122, -128, -135, -136, -137, -135, -133, -128, -124, -121, -122, -126, -131, -132, -133, -132, -132, -131, -131, -126, -121, -119, -119, -121, -123, -128, -133, -133, -133, -129, -128, -125, -121, -118, -121, -129, -136, -141, -140, -137, -132, -129, -126, -121, -116, -118, -120, -123, -125, -128, -130, -129, -128, -126, -122, -120, -119, -122, -124, -128, -133, -137, -139, -138, -136, -131, -125, -122, -121, -122, -127, -132, -136, -136, -135, -132, -129, -126, -123, -120, -119, -121, -124, -128, -133, -135, -136, -133, -128, -123, -119, -115, -116, -121, -127, -133, -136, -135, -132, -129, -127, -123, -119, -118, -120, -124, -129, -133, -133, -135, -135, -133, -129, -124, -120, -120, -121, -125, -131, -137, -137, -134, -133, -130, -126, -121, -119, -119, -122, -126, -131, -136, -137, -134, -133, -130, -127, -122, -120, -120, -122, -124, -129, -133, -136, -135, -133, -128, -122, -115, -114, -117, -123, -129, -134, -136, -137, -134, -130, -126, -121, -119, -119, -121, -123, -125, -127, -131, -134, -134, -133, -130, -128, -125, -124, -124, -124, -127, -127, -128, -128, -129, -126, -120, -117, -117, -119, -122, -125, -127, -128, -130, -133, -134, -131, -128, -126, -125, -125, -125, -127, -130, -132, -135, -137, -132, -124, -117, -116, -118, -122, -126, -128, -131, -132, -134, -132, -130, -127, -125, -123, -124, -124, -125, -125, -128, -131, -133, -133, -132, -131, -129, -125, -123, -122, -125, -130, -134, -136, -135, -132, -125, -118, -114, -114, -119, -124, -129, -128, -129, -135, -140, -139, -135, -130, -128, -128, -128, -131, -129, -129, -134, -133, -125, -116, -112, -112, -116, -121, -126, -127, -125, -125, -124, -123, -121, -122, -126, -131, -134, -134, -134, -138, -141, -136, -125, -120, -121, -125, -128, -131, -132, -131, -129, -130, -125, -119, -120, -127, -133, -134, -135, -133, -129, -126, -128, -131, -128, -125, -125, -131, -135, -135, -130, -126, -123, -122, -123, -124, -124, -120, -122, -125, -121, -111, -104, -104, -109, -116, -121, -126, -127, -126, -126, -125, -125, -126, -124, -126, -131, -139, -144, -144, -133, -120, -112, -114, -119, -126, -130, -135, -137, -135, -132, -127, -121, -118, -126, -139, -145, -145, -140, -136, -131, -127, -126, -126, -128, -131, -135, -137, -136, -134, -130, -128, -127, -127, -126, -125, -124, -123, -120, -124, -127, -122, -113, -108, -111, -114, -119, -125, -127, -127, -128, -130, -129, -122, -118, -123, -132, -141, -146, -140, -127, -115, -115, -121, -127, -132, -137, -139, -140, -137, -133, -125, -118, -117, -127, -141, -149, -148, -141, -135, -130, -127, -127, -128, -131, -134, -138, -139, -137, -130, -125, -125, -127, -129, -128, -125, -121, -120, -119, -120, -119, -120, -121, -120, -113, -107, -108, -111, -116, -121, -125, -127, -128, -123, -120, -121, -131, -139, -135, -128, -121, -120, -119, -121, -126, -130, -131, -134, -135, -134, -127, -123, -121, -123, -128, -131, -133, -134, -133, -132, -129, -129, -134, -139, -143, -143, -141, -137, -131, -127, -126, -129, -133, -130, -123, -120, -124, -127, -127, -124, -124, -122, -121, -122, -124, -123, -122, -120, -121, -125, -129, -121, -110, -106, -110, -116, -122, -126, -129, -129, -126, -123, -125, -131, -136, -130, -122, -118, -120, -124, -126, -127, -129, -130, -131, -132, -134, -131, -126, -126, -128, -132, -134, -133, -132, -132, -132, -130, -131, -136, -141, -141, -140, -138, -133, -127, -126, -128, -132, -129, -123, -118, -122, -127, -129, -128, -128, -127, -125, -123, -123, -123, -122, -123, -124, -126, -128, -128, -119, -111, -109, -113, -119, -122, -126, -130, -129, -126, -126, -131, -137, -135, -127, -121, -122, -123, -123, -125, -126, -128, -129, -131, -132, -130, -128, -128, -129, -132, -133, -135, -134, -133, -131, -129, -127, -129, -132, -138, -140, -139, -132, -126, -123, -125, -129, -129, -126, -121, -122, -130, -137, -137, -133, -129, -128, -126, -126, -124, -122, -121, -123, -126, -126, -127, -124, -118, -110, -110, -113, -118, -121, -126, -129, -128, -128, -131, -136, -138, -135, -127, -121, -121, -122, -120, -119, -121, -127, -130, -132, -132, -127, -125, -124, -125, -127, -127, -128, -131, -133, -135, -131, -128, -127, -133, -139, -141, -138, -134, -132, -130, -131, -132, -129, -123, -122, -124, -130, -135, -137, -135, -130, -126, -123, -121, -120, -122, -124, -127, -128, -127, -126, -125, -118, -111, -108, -112, -118, -123, -127, -129, -127, -125, -128, -134, -132, -124, -121, -128, -131, -125, -118, -118, -120, -123, -128, -130, -129, -126, -125, -127, -129, -128, -129, -130, -130, -131, -132, -129, -129, -133, -139, -143, -140, -137, -135, -133, -134, -132, -129, -126, -123, -123, -128, -133, -137, -135, -131, -128, -125, -123, -119, -119, -120, -123, -125, -126, -127, -125, -125, -123, -119, -113, -112, -115, -120, -125, -127, -128, -130, -134, -133, -129, -125, -129, -129, -124, -113, -108, -109, -115, -122, -128, -130, -129, -126, -127, -127, -127, -125, -127, -131, -134, -136, -136, -133, -131, -129, -132, -136, -138, -137, -135, -134, -132, -131, -130, -131, -129, -126, -127, -131, -135, -134, -131, -128, -127, -126, -125, -124, -124, -123, -124, -126, -126, -125, -123, -123, -120, -113, -110, -111, -116, -121, -126, -131, -131, -126, -121, -121, -125, -133, -136, -129, -119, -115, -117, -120, -124, -127, -130, -131, -133, -135, -134, -129, -128, -129, -133, -136, -138, -136, -134, -133, -135, -139, -140, -137, -136, -137, -140, -136, -127, -121, -123, -127, -130, -133, -136, -137, -136, -135, -134, -128, -124, -121, -123, -126, -128, -128, -125, -124, -122, -125, -125, -120, -110, -106, -107, -113, -118, -123, -126, -128, -126, -124, -122, -126, -132, -131, -125, -119, -119, -122, -126, -127, -129, -129, -131, -132, -132, -128, -124, -123, -124, -129, -130, -131, -130, -129, -131, -130, -129, -129, -131, -136, -139, -142, -141, -136, -130, -126, -128, -128, -129, -130, -133, -137, -134, -129, -124, -120, -120, -119, -120, -120, -121, -120, -118, -117, -121, -123, -119, -111, -108, -111, -117, -121, -126, -129, -129, -127, -130, -134, -139, -139, -130, -119, -115, -116, -119, -121, -126, -129, -131, -132, -133, -132, -128, -126, -128, -131, -134, -134, -133, -134, -135, -135, -135, -137, -138, -139, -138, -139, -136, -133, -131, -129, -127, -125, -124, -125, -130, -135, -137, -135, -131, -126, -123, -122, -122, -121, -122, -123, -125, -125, -122, -121, -122, -120, -112, -110, -113, -120, -123, -127, -130, -128, -126, -128, -134, -136, -132, -123, -113, -112, -115, -121, -125, -128, -130, -131, -131, -128, -126, -124, -125, -127, -131, -132, -133, -132, -132, -133, -133, -131, -129, -132, -137, -140, -138, -134, -131, -128, -126, -123, -120, -120, -123, -131, -135, -135, -132, -129, -126, -124, -123, -123, -123, -124, -125, -128, -128, -125, -124, -123, -118, -110, -108, -112, -115, -119, -122, -126, -125, -123, -125, -131, -135, -130, -123, -118, -118, -119, -122, -125, -129, -131, -133, -134, -134, -130, -126, -126, -128, -131, -134, -134, -132, -132, -132, -130, -129, -130, -135, -138, -139, -137, -135, -132, -130, -127, -126, -124, -127, -131, -135, -134, -130, -129, -129, -129, -128, -126, -124, -122, -123, -124, -124, -120, -119, -122, -126, -122, -114, -111, -112, -117, -123, -128, -129, -126, -128, -133, -138, -136, -131, -124, -119, -117, -119, -120, -122, -125, -130, -133, -135, -134, -130, -128, -127, -129, -130, -133, -133, -133, -131, -130, -129, -128, -128, -131, -135, -137, -136, -136, -135, -129, -123, -118, -120, -130, -141, -141, -134, -129, -129, -132, -131, -128, -125, -124, -124, -127, -126, -124, -121, -120, -123, -127, -124, -116, -108, -109, -115, -122, -127, -128, -128, -130, -134, -135, -132, -125, -120, -119, -118, -120, -121, -121, -123, -126, -128, -128, -127, -123, -122, -123, -125, -127, -128, -129, -131, -134, -135, -133, -131, -130, -132, -136, -139, -139, -140, -137, -129, -121, -120, -127, -134, -133, -126, -121, -123, -131, -134, -133, -129, -127, -126, -126, -126, -123, -120, -119, -123, -128, -131, -126, -117, -111, -112, -116, -119, -121, -123, -126, -131, -135, -133, -128, -122, -121, -122, -120, -119, -116, -117, -120, -126, -130, -132, -130, -129, -129, -128, -129, -129, -129, -130, -130, -134, -136, -134, -131, -130, -134, -138, -141, -140, -138, -132, -125, -123, -128, -136, -136, -131, -124, -123, -129, -137, -136, -131, -127, -128, -129, -128, -126, -123, -121, -123, -126, -129, -132, -126, -118, -112, -114, -117, -119, -122, -126, -129, -131, -132, -129, -125, -124, -126, -124, -118, -115, -115, -118, -123, -128, -132, -132, -131, -131, -131, -130, -131, -130, -131, -132, -133, -134, -133, -129, -127, -128, -133, -137, -138, -137, -133, -127, -124, -126, -133, -135, -132, -126, -122, -125, -133, -139, -138, -134, -131, -130, -127, -125, -122, -121, -122, -126, -128, -128, -127, -122, -114, -108, -108, -111, -114, -118, -125, -129, -131, -131, -130, -128, -128, -128, -122, -116, -113, -114, -120, -126, -130, -131, -130, -127, -127, -125, -124, -123, -124, -126, -131, -134, -136, -134, -131, -128, -130, -135, -139, -140, -136, -130, -127, -129, -134, -137, -134, -126, -121, -119, -125, -134, -137, -136, -133, -132, -132, -128, -122, -119, -119, -123, -127, -129, -126, -123, -121, -114, -108, -109, -112, -117, -121, -126, -129, -128, -125, -125, -127, -129, -131, -126, -120, -116, -118, -121, -123, -125, -129, -130, -131, -131, -130, -128, -127, -128, -131, -134, -133, -133, -131, -129, -129, -134, -139, -143, -141, -135, -131, -130, -133, -136, -133, -129, -124, -121, -123, -130, -137, -139, -135, -133, -129, -126, -121, -117, -115, -117, -122, -124, -125, -125, -128, -125, -116, -110, -110, -113, -119, -126, -132, -132, -130, -130, -131, -131, -131, -126, -119, -112, -112, -116, -120, -124, -128, -132, -134, -134, -132, -128, -125, -125, -128, -132, -134, -135, -134, -133, -131, -131, -134, -137, -136, -132, -130, -130, -133, -135, -136, -130, -124, -120, -121, -126, -132, -139, -139, -135, -132, -129, -125, -121, -120, -121, -125, -127, -129, -127, -124, -125, -123, -116, -110, -111, -116, -120, -127, -129, -129, -127, -127, -130, -132, -133, -128, -120, -113, -114, -117, -121, -124, -129, -130, -131, -130, -128, -126, -124, -126, -129, -131, -132, -134, -134, -133, -132, -133, -137, -138, -135, -133, -132, -134, -135, -136, -132, -125, -121, -121, -123, -124, -130, -135, -137, -135, -133, -129, -125, -121, -119, -121, -124, -126, -127, -126, -126, -127, -124, -115, -109, -109, -114, -120, -123, -126, -125, -127, -129, -132, -130, -129, -124, -118, -114, -114, -117, -121, -125, -130, -133, -134, -134, -133, -129, -126, -127, -129, -131, -132, -134, -134, -133, -130, -131, -132, -133, -132, -133, -135, -136, -138, -135, -128, -122, -121, -124, -125, -127, -131, -136, -138, -137, -132, -127, -123, -120, -121, -123, -125, -126, -125, -125, -124, -126, -125, -118, -111, -112, -116, -121, -124, -126, -125, -126, -129, -132, -131, -129, -124, -118, -115, -116, -119, -121, -125, -130, -134, -136, -134, -132, -128, -126, -129, -131, -132, -132, -133, -133, -133, -134, -133, -131, -129, -128, -129, -132, -133, -135, -133, -126, -120, -120, -123, -124, -124, -130, -138, -142, -140, -135, -129, -125, -122, -122, -123, -124, -127, -128, -126, -125, -125, -123, -117, -110, -110, -115, -120, -124, -124, -126, -129, -134, -135, -133, -131, -125, -119, -115, -116, -120, -122, -125, -129, -134, -134, -133, -130, -127, -126, -128, -129, -130, -129, -130, -131, -132, -132, -132, -129, -128, -129, -132, -137, -138, -137, -133, -128, -122, -122, -123, -125, -126, -133, -139, -143, -140, -135, -130, -126, -124, -124, -124, -126, -128, -129, -129, -126, -126, -124, -118, -111, -109, -113, -118, -122, -123, -125, -126, -129, -130, -131, -129, -125, -117, -114, -115, -119, -122, -125, -130, -133, -134, -131, -129, -126, -126, -126, -126, -127, -127, -129, -129, -131, -132, -130, -126, -128, -132, -134, -137, -136, -135, -132, -128, -124, -122, -123, -124, -126, -130, -137, -141, -139, -133, -128, -123, -120, -119, -121, -122, -124, -126, -128, -125, -125, -123, -118, -110, -109, -113, -118, -122, -124, -127, -130, -133, -133, -133, -128, -123, -116, -114, -115, -117, -121, -124, -129, -133, -134, -132, -130, -128, -128, -130, -130, -130, -129, -131, -132, -134, -134, -132, -129, -130, -132, -135, -135, -134, -133, -132, -129, -126, -124, -126, -127, -127, -132, -140, -143, -141, -136, -133, -128, -124, -123, -125, -126, -128, -129, -129, -127, -125, -125, -121, -114, -110, -112, -117, -122, -124, -126, -128, -132, -134, -133, -127, -118, -113, -112, -116, -120, -124, -127, -130, -132, -131, -129, -126, -126, -126, -129, -131, -132, -131, -131, -132, -132, -133, -131, -129, -130, -134, -137, -135, -133, -134, -132, -129, -125, -124, -125, -126, -128, -132, -136, -139, -137, -135, -132, -128, -124, -123, -124, -125, -126, -127, -127, -124, -124, -125, -122, -113, -108, -109, -114, -118, -119, -122, -127, -131, -134, -132, -127, -120, -113, -112, -115, -120, -124, -128, -131, -133, -133, -131, -129, -127, -128, -128, -129, -129, -130, -130, -131, -132, -132, -131, -128, -128, -133, -137, -137, -136, -135, -135, -129, -124, -123, -126, -127, -129, -134, -140, -142, -139, -134, -128, -124, -121, -122, -124, -125, -126, -126, -126, -123, -122, -124, -120, -115, -110, -112, -117, -121, -123, -126, -130, -134, -134, -132, -127, -122, -116, -114, -115, -118, -122, -125, -130, -133, -132, -132, -130, -129, -128, -128, -129, -131, -133, -134, -135, -134, -134, -132, -130, -131, -133, -133, -133, -135, -136, -135, -128, -122, -121, -123, -126, -128, -131, -137, -140, -139, -134, -129, -123, -121, -121, -123, -127, -129, -130, -127, -124, -122, -123, -121, -116, -111, -113, -118, -121, -122, -124, -130, -133, -133, -130, -126, -124, -121, -117, -115, -116, -120, -124, -128, -131, -132, -130, -129, -129, -128, -128, -128, -129, -129, -131, -133, -132, -132, -130, -128, -129, -131, -133, -133, -135, -135, -131, -125, -121, -123, -125, -127, -128, -131, -136, -140, -140, -136, -130, -125, -124, -124, -126, -127, -129, -129, -129, -126, -123, -123, -123, -118, -112, -111, -115, -118, -121, -125, -129, -130, -129, -126, -126, -125, -120, -117, -116, -118, -122, -125, -129, -131, -132, -132, -131, -130, -128, -127, -127, -128, -129, -131, -131, -132, -132, -131, -129, -129, -129, -131, -132, -133, -134, -131, -125, -121, -122, -125, -129, -131, -132, -135, -138, -139, -135, -129, -125, -124, -124, -125, -126, -125, -125, -125, -124, -124, -124, -124, -118, -112, -111, -114, -118, -121, -128, -132, -134, -132, -131, -129, -126, -123, -117, -115, -117, -122, -125, -129, -132, -133, -132, -131, -129, -128, -126, -126, -128, -130, -129, -129, -129, -130, -129, -127, -127, -128, -132, -134, -137, -136, -131, -123, -120, -122, -126, -130, -131, -134, -137, -140, -139, -135, -129, -126, -125, -126, -127, -127, -127, -126, -126, -126, -125, -127, -127, -123, -115, -113, -115, -118, -120, -125, -129, -133, -133, -133, -131, -127, -120, -113, -110, -114, -119, -124, -127, -131, -132, -129, -127, -124, -124, -123, -125, -128, -129, -130, -130, -131, -131, -130, -128, -128, -130, -134, -136, -136, -135, -129, -122, -120, -122, -126, -130, -133, -134, -134, -137, -139, -136, -131, -128, -127, -128, -129, -130, -129, -127, -127, -126, -125, -126, -127, -122, -116, -112, -115, -117, -120, -121, -126, -129, -131, -130, -130, -126, -119, -110, -109, -112, -118, -123, -128, -132, -133, -132, -130, -127, -125, -125, -126, -129, -131, -131, -132, -132, -132, -130, -128, -127, -130, -134, -137, -138, -134, -127, -122, -121, -124, -128, -131, -134, -134, -136, -139, -140, -137, -132, -129, -128, -128, -128, -127, -127, -126, -126, -126, -125, -125, -126, -121, -115, -111, -112, -115, -118, -121, -124, -126, -129, -131, -130, -126, -119, -114, -112, -116, -120, -125, -128, -131, -133, -134, -133, -129, -128, -126, -128, -129, -131, -131, -131, -132, -132, -131, -128, -127, -129, -133, -136, -136, -132, -128, -123, -122, -124, -128, -130, -133, -134, -135, -137, -139, -136, -132, -129, -128, -128, -127, -126, -126, -126, -125, -125, -125, -127, -124, -116, -110, -110, -114, -117, -121, -125, -131, -134, -134, -133, -129, -124, -119, -116, -116, -118, -121, -123, -126, -129, -131, -131, -129, -129, -127, -128, -128, -128, -127, -128, -129, -129, -131, -130, -130, -129, -129, -133, -136, -136, -134, -130, -126, -124, -126, -129, -132, -133, -133, -135, -139, -139, -137, -131, -128, -127, -127, -126, -126, -125, -125, -126, -126, -127, -126, -125, -124, -119, -114, -111, -114, -115, -118, -125, -133, -136, -134, -129, -124, -118, -112, -113, -115, -120, -125, -128, -130, -130, -129, -128, -127, -127, -128, -129, -131, -131, -131, -132, -132, -133, -130, -127, -129, -137, -142, -140, -137, -133, -130, -128, -133, -134, -128, -121, -123, -130, -132, -129, -121, -117, -120, -129, -136, -136, -132, -128, -126, -125, -125, -122, -120, -121, -127, -130, -125, -117, -115, -118, -124, -130, -133, -131, -127, -126, -123, -121, -118, -118, -117, -117, -117, -118, -120, -121, -125, -128, -132, -132, -132, -129, -128, -127, -128, -129, -131, -132, -131, -131, -130, -128, -127, -129, -134, -139, -138, -132, -124, -119, -119, -123, -128, -132, -132, -135, -138, -141, -137, -131, -127, -126, -127, -129, -131, -130, -129, -127, -126, -125, -125, -126, -124, -117, -113, -113, -115, -116, -121, -129, -133, -131, -127, -126, -124, -120, -118, -121, -126, -130, -131, -127, -123, -121, -122, -125, -128, -131, -131, -131, -129, -129, -127, -127, -128, -130, -132, -131, -129, -128, -131, -135, -134, -128, -123, -120, -122, -125, -129, -131, -132, -131, -130, -134, -138, -136, -131, -127, -126, -125, -125, -125, -126, -127, -127, -127, -127, -125, -126, -127, -123, -117, -114, -116, -118, -121, -126, -133, -135, -132, -125, -119, -116, -120, -125, -126, -125, -124, -124, -124, -125, -125, -126, -127, -129, -130, -130, -129, -126, -124, -125, -127, -130, -131, -131, -130, -131, -134, -135, -136, -134, -130, -123, -122, -125, -128, -130, -132, -133, -133, -134, -139, -139, -135, -131, -128, -128, -127, -128, -127, -126, -126, -127, -129, -128, -127, -128, -126, -121, -114, -112, -116, -123, -132, -137, -135, -131, -126, -124, -121, -119, -117, -117, -119, -125, -128, -126, -124, -123, -124, -126, -128, -128, -128, -127, -127, -127, -128, -128, -128, -129, -129, -129, -131, -134, -136, -135, -132, -130, -125, -123, -123, -127, -130, -133, -133, -132, -134, -136, -138, -135, -133, -131, -131, -130, -129, -128, -127, -125, -125, -126, -125, -125, -126, -124, -120, -116, -113, -114, -118, -126, -133, -135, -131, -125, -122, -118, -117, -117, -119, -121, -124, -126, -127, -127, -125, -126, -126, -128, -129, -128, -128, -127, -127, -127, -127, -126, -127, -128, -128, -128, -131, -134, -136, -136, -131, -124, -121, -122, -126, -129, -134, -136, -137, -137, -141, -141, -137, -132, -129, -129, -129, -130, -130, -129, -127, -127, -126, -125, -124, -126, -125, -119, -114, -111, -115, -119, -122, -124, -126, -127, -126, -127, -125, -122, -118, -120, -122, -125, -125, -123, -123, -125, -126, -127, -127, -127, -126, -126, -127, -127, -127, -127, -128, -129, -129, -128, -130, -133, -135, -134, -134, -132, -128, -124, -124, -127, -130, -133, -136, -136, -136, -138, -139, -138, -134, -131, -129, -128, -128, -128, -127, -126, -127, -128, -126, -124, -124, -123, -118, -115, -114, -116, -118, -123, -129, -131, -130, -128, -124, -123, -122, -122, -122, -122, -122, -122, -122, -124, -127, -129, -130, -129, -130, -127, -127, -126, -126, -126, -128, -130, -132, -132, -130, -129, -131, -133, -136, -136, -133, -127, -123, -123, -126, -129, -133, -135, -136, -134, -136, -138, -137, -134, -131, -130, -128, -127, -124, -124, -124, -126, -127, -127, -126, -126, -125, -121, -115, -113, -114, -117, -122, -126, -128, -127, -125, -123, -119, -116, -118, -121, -123, -122, -121, -120, -121, -124, -125, -126, -128, -129, -130, -130, -129, -128, -127, -127, -129, -131, -130, -131, -131, -138, -129, -136, -147, -131, -123, -121, -125, -125, -134, -131, -143, -144, -127, -124, -130, -135, -134, -136, -136, -137, -131, -125, -125, -130, -133, -133, -130, -129, -126, -126, -126, -124, -120, -118, -117, -119, -126, -135, -145, -140, -121, -114, -119, -124, -128, -132, -130, -126, -118, -118, -136, -140, -127, -126, -128, -132, -128, -129, -130, -124, -122, -132, -130, -122, -124, -137, -132, -118, -130, -140, -141, -117, -110, -120, -129, -120, -112, -122, -139, -147, -141, -129, -112, -114, -125, -136, -141, -121, -97, -99, -126, -133, -139, -151, -129, -96, -80, -96, -130, -144, -146, -141, -135, -131, -129, -132, -131, -130, -137, -133, -121, -109, -111, -120, -114, -105, -107, -120, -139, -152, -159, -164, -163, -163, -160, -157, -153, -154, -158, -157, -158, -160, -159, -160, -164, -171, -169, -165, -156, -155, -158, -164, -169, -169, -174, -178, -179, -174, -177, -174, -177, -177, -177, -175, -172, -171, -167, -170, -172, -172, -171, -170, -171, -169, -169, -161, -153, -151, -156, -168, -178, -178, -173, -167, -161, -155, -150, -151, -153, -151, -157, -159, -157, -157, -149, -136, -132, -139, -138, -139, -142, -143, -142, -138, -139, -133, -130, -127, -130, -136, -138, -134, -128, -126, -124, -126, -129, -126, -124, -127, -129, -130, -124, -125, -122, -122, -117, -113, -111, -109, -105, -104, -108, -111, -111, -106, -104, -100, -100, -103, -112, -116, -111, -106, -100, -101, -98, -97, -97, -98, -97, -99, -97, -93, -89, -87, -85, -83, -81, -85, -86, -84, -83, -82, -85, -81, -79, -80, -77, -76, -78, -87, -85, -77, -75, -73, -77, -80, -84, -88, -85, -85, -83, -83, -84, -83, -85, -87, -90, -92, -91, -93, -92, -97, -95, -92, -99, -108, -113, -109, -104, -100, -95, -97, -102, -95, -91, -91, -95, -99, -100, -103, -99, -102, -100, -101, -102, -96, -92, -98, -110, -115, -116, -113, -109, -105, -104, -104, -106, -106, -111, -115, -117, -113, -103, -99, -103, -113, -126, -128, -125, -119, -114, -112, -108, -112, -117, -123, -128, -133, -136, -135, -130, -119, -119, -123, -133, -136, -140, -141, -142, -142, -141, -140, -137, -137, -137, -146, -155, -160, -159, -159, -151, -146, -140, -140, -148, -154, -164, -170, -168, -158, -146, -138, -139, -146, -152, -158, -163, -166, -164, -159, -154, -151, -147, -154, -156, -154, -159, -166, -172, -170, -164, -161, -159, -157, -156, -157, -159, -158, -158, -158, -157, -155, -151, -151, -152, -158, -159, -157, -157, -155, -153, -153, -155, -154, -155, -156, -158, -159, -159, -156, -154, -154, -150, -145, -143, -146, -146, -147, -149, -150, -149, -148, -146, -146, -147, -147, -148, -149, -151, -151, -153, -151, -147, -151, -157, -164, -166, -157, -145, -137, -134, -138, -142, -146, -150, -151, -151, -146, -142, -136, -132, -131, -136, -136, -137, -141, -146, -147, -144, -142, -138, -134, -132, -135, -134, -133, -134, -139, -133, -117, -114, -122, -130, -132, -127, -124, -119, -118, -118, -119, -121, -118, -120, -122, -125, -124, -120, -119, -116, -113, -111, -110, -112, -114, -113, -119, -118, -114, -112, -108, -107, -105, -108, -111, -115, -118, -118, -118, -118, -119, -117, -115, -116, -117, -119, -121, -118, -119, -117, -115, -115, -118, -119, -117, -116, -116, -115, -112, -112, -111, -110, -112, -111, -110, -110, -115, -119, -118, -116, -112, -112, -107, -106, -106, -107, -109, -108, -108, -108, -107, -105, -104, -103, -102, -102, -103, -100, -100, -97, -97, -97, -98, -102, -98, -100, -101, -101, -99, -91, -87, -90, -93, -99, -103, -108, -106, -104, -103, -101, -100, -99, -102, -104, -109, -111, -111, -109, -110, -108, -105, -105, -108, -119, -125, -116, -101, -94, -94, -98, -104, -110, -115, -114, -114, -113, -110, -107, -106, -104, -107, -113, -122, -125, -120, -116, -110, -110, -107, -109, -110, -112, -112, -112, -113, -111, -109, -107, -104, -107, -108, -108, -105, -103, -105, -108, -107, -109, -110, -108, -110, -112, -112, -111, -114, -116, -110, -103, -103, -106, -107, -111, -115, -119, -118, -112, -110, -109, -110, -110, -114, -117, -121, -123, -121, -122, -121, -120, -121, -121, -126, -129, -131, -132, -129, -127, -123, -125, -130, -137, -136, -129, -121, -115, -116, -117, -122, -127, -129, -129, -126, -125, -125, -128, -133, -134, -134, -131, -130, -124, -121, -124, -125, -125, -128, -128, -129, -130, -125, -124, -121, -122, -123, -125, -125, -125, -125, -124, -124, -124, -126, -126, -128, -129, -131, -130, -126, -121, -121, -124, -131, -135, -140, -138, -136, -134, -131, -132, -131, -132, -134, -138, -142, -142, -138, -138, -144, -152, -155, -153, -150, -146, -144, -144, -150, -149, -144, -141, -141, -143, -144, -144, -146, -146, -147, -149, -149, -150, -148, -146, -145, -147, -155, -163, -160, -155, -154, -149, -146, -145, -145, -152, -155, -153, -148, -141, -141, -150, -154, -157, -155, -154, -152, -149, -145, -144, -145, -146, -152, -154, -153, -152, -153, -155, -147, -140, -138, -140, -144, -146, -151, -153, -151, -149, -145, -148, -152, -157, -154, -146, -144, -147, -148, -152, -151, -155, -161, -167, -168, -163, -154, -145, -141, -145, -150, -154, -153, -151, -152, -152, -151, -150, -146, -145, -146, -150, -153, -153, -150, -151, -150, -150, -150, -158, -161, -158, -153, -149, -143, -140, -140, -142, -143, -144, -144, -140, -140, -136, -135, -133, -136, -139, -136, -137, -140, -141, -141, -141, -141, -141, -142, -140, -139, -138, -137, -140, -144, -138, -130, -125, -126, -127, -130, -132, -134, -134, -133, -130, -128, -127, -126, -129, -132, -137, -137, -138, -144, -147, -142, -133, -130, -131, -134, -136, -139, -139, -138, -136, -134, -131, -129, -126, -129, -130, -131, -129, -129, -127, -125, -127, -132, -141, -142, -139, -137, -134, -129, -128, -129, -129, -131, -132, -134, -134, -132, -128, -125, -123, -123, -126, -127, -126, -125, -123, -124, -122, -123, -120, -120, -121, -120, -121, -122, -125, -119, -115, -112, -116, -117, -119, -122, -125, -124, -124, -123, -120, -118, -117, -117, -118, -122, -123, -125, -123, -122, -122, -121, -122, -121, -124, -125, -126, -127, -128, -124, -123, -121, -123, -124, -125, -126, -125, -124, -125, -124, -122, -125, -124, -123, -127, -131, -135, -132, -127, -125, -120, -117, -117, -117, -119, -119, -120, -120, -120, -119, -118, -117, -116, -116, -117, -115, -116, -117, -118, -117, -116, -116, -114, -111, -114, -116, -115, -108, -101, -103, -106, -110, -113, -117, -117, -116, -116, -115, -115, -113, -115, -118, -121, -122, -123, -128, -136, -137, -134, -134, -130, -123, -116, -112, -116, -119, -123, -127, -130, -128, -125, -120, -119, -117, -118, -118, -121, -125, -123, -125, -127, -134, -135, -132, -129, -126, -125, -123, -123, -124, -121, -120, -123, -122, -122, -122, -116, -106, -95, -94, -107, -120, -127, -126, -123, -120, -115, -112, -113, -116, -117, -115, -116, -118, -120, -120, -120, -123, -127, -127, -126, -122, -122, -126, -133, -136, -131, -120, -111, -109, -112, -116, -118, -122, -125, -127, -126, -127, -131, -133, -133, -132, -132, -132, -129, -123, -123, -123, -120, -114, -112, -111, -111, -114, -125, -131, -126, -114, -110, -114, -118, -118, -117, -118, -118, -114, -109, -106, -104, -104, -108, -113, -121, -126, -126, -124, -126, -126, -125, -121, -118, -119, -121, -124, -122, -115, -110, -110, -114, -119, -123, -125, -125, -123, -119, -120, -120, -120, -120, -119, -120, -120, -120, -119, -119, -117, -120, -125, -132, -135, -131, -130, -128, -125, -122, -121, -120, -118, -117, -114, -116, -118, -116, -108, -101, -101, -106, -111, -113, -117, -118, -118, -119, -117, -119, -121, -125, -125, -125, -124, -125, -122, -117, -112, -110, -113, -116, -119, -124, -124, -124, -123, -119, -115, -112, -119, -126, -130, -128, -125, -124, -121, -120, -122, -125, -122, -116, -116, -118, -121, -121, -122, -123, -124, -122, -120, -117, -119, -121, -121, -121, -121, -117, -115, -115, -116, -120, -120, -122, -122, -122, -121, -121, -121, -121, -121, -121, -121, -123, -125, -125, -119, -111, -107, -110, -115, -118, -124, -127, -127, -125, -125, -125, -123, -124, -126, -130, -133, -133, -132, -132, -131, -132, -135, -137, -140, -135, -128, -121, -120, -122, -125, -125, -129, -134, -139, -140, -136, -131, -128, -127, -127, -130, -132, -133, -131, -133, -132, -130, -127, -124, -124, -127, -123, -115, -113, -111, -113, -118, -128, -135, -134, -127, -120, -117, -118, -120, -123, -129, -134, -140, -138, -136, -132, -126, -125, -128, -131, -126, -124, -123, -124, -127, -128, -130, -128, -127, -128, -129, -128, -125, -123, -123, -126, -134, -141, -140, -135, -127, -119, -117, -117, -121, -125, -129, -134, -134, -131, -130, -133, -135, -135, -135, -133, -130, -125, -124, -125, -127, -128, -128, -128, -128, -127, -125, -126, -127, -124, -119, -115, -119, -121, -120, -123, -123, -121, -120, -120, -124, -126, -126, -120, -118, -118, -120, -123, -125, -127, -129, -130, -129, -126, -123, -124, -129, -135, -134, -128, -118, -109, -110, -114, -118, -121, -123, -125, -125, -123, -120, -118, -117, -119, -123, -125, -129, -134, -136, -133, -128, -123, -120, -117, -118, -120, -121, -122, -121, -120, -119, -116, -115, -116, -115, -116, -116, -115, -116, -116, -118, -120, -118, -120, -119, -118, -120, -121, -117, -111, -109, -110, -113, -114, -117, -120, -121, -121, -120, -118, -117, -116, -119, -120, -124, -126, -126, -124, -126, -133, -135, -136, -133, -130, -131, -131, -129, -123, -119, -121, -125, -131, -134, -135, -134, -132, -130, -131, -135, -140, -140, -140, -140, -139, -135, -134, -133, -133, -135, -138, -139, -140, -139, -137, -133, -127, -123, -124, -126, -133, -139, -142, -141, -136, -132, -128, -129, -128, -130, -133, -140, -146, -144, -138, -133, -132, -133, -136, -140, -143, -144, -142, -143, -140, -138, -136, -135, -138, -142, -143, -143, -141, -141, -142, -141, -142, -146, -148, -148, -151, -157, -163, -162, -159, -156, -152, -149, -146, -146, -147, -149, -153, -151, -144, -135, -132, -132, -135, -140, -145, -147, -146, -146, -149, -150, -147, -145, -142, -142, -143, -143, -142, -142, -137, -133, -133, -135, -136, -139, -142, -144, -146, -146, -144, -145, -147, -151, -153, -154, -153, -151, -147, -145, -146, -147, -144, -138, -136, -137, -141, -144, -145, -146, -146, -146, -147, -144, -140, -141, -148, -156, -160, -157, -153, -149, -144, -143, -144, -146, -146, -149, -150, -150, -149, -144, -141, -140, -138, -132, -127, -128, -130, -133, -136, -139, -139, -137, -138, -138, -139, -138, -139, -141, -146, -150, -150, -145, -142, -139, -138, -142, -144, -145, -145, -144, -144, -141, -138, -138, -145, -148, -149, -147, -144, -140, -136, -135, -136, -138, -143, -146, -146, -140, -133, -129, -129, -130, -133, -135, -139, -143, -143, -139, -135, -128, -124, -122, -122, -124, -127, -127, -123, -120, -118, -117, -120, -130, -137, -140, -137, -131, -125, -119, -118, -121, -122, -117, -114, -116, -119, -120, -121, -122, -124, -125, -126, -128, -128, -130, -127, -125, -129, -136, -139, -136, -130, -125, -120, -119, -119, -117, -113, -111, -113, -116, -119, -119, -118, -119, -124, -129, -131, -126, -123, -120, -119, -119, -120, -120, -121, -121, -122, -123, -123, -120, -112, -105, -105, -110, -112, -113, -116, -116, -114, -114, -112, -111, -110, -113, -117, -121, -122, -124, -126, -130, -130, -130, -128, -124, -122, -121, -122, -126, -124, -118, -113, -111, -114, -117, -117, -119, -119, -119, -119, -118, -117, -114, -112, -116, -122, -128, -131, -130, -127, -124, -122, -115, -108, -106, -107, -112, -117, -119, -118, -117, -120, -121, -120, -118, -115, -112, -112, -113, -115, -115, -116, -116, -120, -122, -121, -121, -117, -112, -106, -104, -107, -110, -114, -115, -118, -118, -115, -112, -110, -111, -113, -113, -115, -116, -118, -119, -120, -120, -126, -132, -135, -133, -129, -124, -119, -116, -114, -118, -119, -116, -109, -106, -106, -108, -110, -113, -116, -118, -119, -120, -118, -118, -116, -117, -121, -129, -134, -134, -129, -124, -122, -119, -116, -112, -111, -114, -118, -118, -122, -124, -127, -127, -127, -124, -122, -117, -116, -118, -119, -122, -124, -127, -128, -126, -127, -126, -123, -116, -112, -113, -117, -120, -122, -123, -123, -121, -120, -119, -120, -119, -117, -114, -116, -118, -119, -119, -125, -133, -139, -139, -136, -130, -125, -123, -122, -122, -125, -128, -125, -121, -116, -116, -117, -118, -120, -123, -125, -125, -124, -124, -122, -122, -122, -126, -133, -138, -138, -134, -130, -127, -122, -117, -117, -118, -121, -122, -125, -129, -131, -130, -127, -126, -124, -122, -120, -120, -122, -124, -127, -128, -128, -127, -126, -126, -128, -125, -119, -113, -114, -115, -118, -120, -121, -120, -120, -120, -120, -119, -117, -115, -117, -121, -125, -124, -124, -126, -133, -139, -139, -136, -131, -127, -124, -124, -126, -127, -128, -124, -120, -118, -118, -119, -121, -123, -126, -127, -126, -124, -124, -122, -120, -121, -126, -135, -138, -138, -134, -132, -128, -121, -113, -112, -114, -118, -123, -126, -131, -131, -129, -127, -125, -122, -120, -119, -121, -124, -126, -128, -128, -129, -130, -129, -128, -128, -126, -120, -115, -116, -118, -121, -123, -125, -125, -124, -122, -122, -119, -119, -118, -121, -123, -128, -130, -128, -130, -135, -143, -145, -143, -139, -135, -132, -129, -128, -131, -132, -132, -127, -125, -122, -121, -123, -125, -128, -131, -132, -133, -133, -133, -131, -130, -133, -139, -146, -148, -146, -142, -138, -131, -126, -122, -124, -127, -130, -136, -139, -141, -138, -136, -134, -133, -132, -132, -133, -134, -136, -137, -138, -138, -139, -139, -138, -139, -139, -134, -128, -125, -127, -130, -133, -135, -136, -135, -135, -133, -131, -129, -127, -127, -129, -133, -136, -135, -137, -144, -151, -154, -151, -146, -141, -139, -138, -138, -140, -143, -143, -140, -134, -132, -131, -130, -133, -136, -139, -140, -141, -140, -139, -137, -135, -138, -144, -150, -152, -150, -146, -140, -133, -127, -126, -129, -134, -137, -142, -143, -143, -139, -136, -134, -136, -136, -136, -138, -137, -137, -136, -137, -138, -137, -136, -136, -138, -136, -132, -127, -126, -127, -130, -132, -134, -134, -133, -134, -134, -131, -128, -127, -130, -134, -137, -137, -136, -139, -145, -152, -153, -151, -146, -143, -140, -139, -137, -136, -138, -139, -137, -129, -125, -124, -126, -129, -135, -138, -138, -137, -135, -134, -134, -133, -135, -140, -145, -148, -147, -144, -138, -131, -123, -120, -122, -126, -132, -138, -141, -136, -129, -126, -127, -130, -131, -134, -135, -134, -134, -133, -132, -132, -133, -135, -136, -137, -138, -133, -126, -121, -121, -124, -126, -130, -131, -131, -131, -129, -125, -123, -122, -123, -126, -131, -134, -134, -132, -132, -136, -142, -144, -144, -140, -136, -132, -129, -128, -129, -129, -129, -127, -125, -121, -117, -115, -118, -122, -126, -127, -127, -127, -126, -126, -126, -127, -131, -134, -137, -135, -132, -125, -118, -114, -117, -120, -124, -125, -127, -128, -125, -123, -122, -124, -126, -128, -129, -131, -129, -127, -128, -128, -128, -130, -131, -131, -130, -130, -127, -123, -118, -115, -118, -119, -119, -121, -121, -122, -121, -119, -117, -115, -114, -115, -116, -119, -120, -120, -123, -128, -131, -131, -130, -128, -125, -123, -121, -121, -120, -121, -121, -122, -121, -118, -115, -115, -115, -117, -119, -122, -123, -124, -124, -125, -126, -127, -127, -128, -127, -126, -123, -120, -117, -116, -118, -122, -123, -125, -124, -123, -124, -122, -120, -118, -117, -118, -121, -125, -127, -127, -128, -126, -124, -121, -120, -117, -117, -118, -122, -124, -126, -124, -123, -121, -121, -119, -118, -116, -116, -118, -119, -120, -118, -116, -116, -116, -117, -119, -121, -123, -124, -125, -124, -123, -119, -118, -117, -117, -118, -118, -119, -118, -120, -120, -120, -118, -118, -117, -117, -119, -121, -122, -122, -123, -123, -122, -120, -120, -119, -118, -115, -113, -113, -116, -118, -119, -119, -120, -119, -120, -120, -120, -119, -118, -117, -118, -119, -120, -121, -124, -127, -125, -123, -117, -113, -111, -114, -117, -120, -121, -123, -122, -121, -119, -119, -117, -117, -118, -121, -123, -123, -123, -124, -125, -126, -126, -126, -126, -125, -125, -125, -125, -123, -122, -121, -121, -121, -119, -116, -117, -117, -116, -115, -115, -114, -115, -116, -117, -118, -121, -123, -125, -125, -126, -125, -127, -128, -128, -129, -128, -127, -125, -123, -121, -119, -120, -120, -122, -123, -123, -122, -121, -120, -120, -119, -118, -120, -122, -125, -125, -125, -123, -122, -121, -119, -120, -121, -123, -124, -126, -128, -127, -127, -125, -123, -121, -121, -122, -123, -126, -128, -130, -129, -128, -126, -126, -125, -127, -129, -130, -129, -127, -126, -125, -124, -124, -122, -123, -125, -126, -127, -123, -121, -120, -120, -121, -121, -123, -124, -126, -128, -129, -129, -127, -125, -122, -121, -121, -122, -122, -123, -123, -120, -116, -113, -112, -112, -115, -117, -120, -123, -126, -127, -126, -125, -124, -124, -125, -129, -131, -131, -127, -125, -121, -121, -120, -121, -124, -125, -125, -124, -123, -120, -119, -119, -120, -123, -126, -129, -129, -128, -127, -126, -126, -126, -128, -129, -131, -133, -133, -132, -129, -128, -127, -126, -124, -124, -125, -126, -126, -126, -123, -122, -120, -118, -118, -118, -119, -122, -123, -125, -124, -124, -123, -121, -120, -121, -122, -124, -127, -127, -126, -125, -124, -125, -126, -127, -128, -129, -130, -131, -131, -129, -131, -131, -132, -133, -133, -133, -130, -130, -129, -128, -127, -125, -125, -126, -127, -128, -128, -128, -127, -126, -128, -128, -130, -132, -136, -139, -140, -140, -137, -135, -133, -134, -134, -135, -138, -137, -137, -136, -134, -132, -129, -129, -129, -129, -130, -130, -132, -130, -128, -126, -126, -127, -128, -130, -132, -133, -134, -136, -136, -135, -136, -136, -137, -137, -136, -136, -135, -136, -135, -134, -134, -134, -132, -132, -132, -133, -132, -132, -131, -130, -129, -130, -130, -131, -131, -134, -135, -136, -133, -131, -128, -126, -126, -129, -134, -137, -137, -136, -136, -132, -127, -125, -125, -127, -130, -133, -134, -133, -129, -123, -119, -117, -118, -120, -125, -128, -130, -131, -131, -130, -129, -130, -132, -134, -136, -137, -137, -136, -135, -133, -130, -130, -131, -132, -134, -134, -135, -134, -132, -131, -129, -129, -130, -131, -133, -133, -134, -134, -135, -134, -135, -135, -135, -136, -137, -139, -141, -140, -140, -138, -137, -138, -137, -136, -136, -134, -134, -133, -133, -130, -128, -128, -126, -128, -127, -126, -125, -124, -125, -126, -127, -128, -128, -130, -130, -132, -133, -134, -134, -134, -135, -134, -136, -136, -135, -136, -136, -135, -134, -135, -134, -134, -134, -135, -134, -134, -133, -131, -130, -129, -129, -127, -128, -129, -130, -130, -129, -130, -129, -129, -128, -130, -133, -136, -137, -139, -139, -138, -135, -134, -133, -133, -132, -133, -133, -133, -135, -134, -131, -129, -128, -129, -129, -128, -129, -129, -129, -127, -126, -126, -126, -125, -124, -126, -127, -127, -129, -131, -134, -132, -130, -128, -128, -128, -130, -132, -134, -134, -133, -131, -128, -125, -125, -127, -129, -132, -131, -129, -126, -122, -121, -123, -127, -128, -131, -133, -133, -130, -126, -123, -122, -122, -123, -127, -130, -131, -129, -127, -124, -119, -118, -119, -122, -124, -125, -125, -122, -120, -115, -112, -110, -112, -114, -118, -120, -123, -124, -124, -123, -121, -120, -121, -123, -127, -129, -131, -132, -129, -127, -122, -119, -118, -120, -122, -125, -125, -125, -124, -123, -121, -119, -117, -118, -119, -122, -122, -122, -122, -123, -124, -125, -126, -128, -128, -129, -129, -129, -128, -129, -128, -127, -126, -126, -126, -126, -125, -124, -122, -121, -121, -120, -119, -118, -118, -119, -119, -119, -118, -115, -113, -112, -114, -117, -120, -120, -121, -122, -122, -122, -121, -121, -121, -124, -126, -128, -129, -129, -128, -126, -126, -127, -127, -128, -127, -126, -124, -123, -122, -123, -122, -120, -120, -118, -118, -118, -118, -120, -122, -122, -124, -125, -125, -125, -123, -125, -126, -127, -127, -128, -127, -128, -129, -128, -128, -126, -126, -126, -124, -123, -122, -122, -121, -122, -123, -123, -124, -125, -124, -124, -122, -122, -121, -121, -121, -123, -124, -125, -126, -126, -126, -126, -125, -126, -127, -127, -127, -128, -127, -127, -126, -127, -127, -126, -124, -125, -125, -125, -122, -119, -118, -120, -122, -126, -127, -127, -126, -123, -122, -120, -119, -119, -120, -123, -126, -126, -126, -124, -123, -121, -123, -126, -128, -128, -126, -123, -121, -118, -117, -117, -114, -113, -113, -115, -116, -118, -118, -118, -118, -120, -120, -123, -125, -126, -128, -129, -130, -129, -128, -128, -126, -124, -122, -122, -121, -123, -123, -123, -121, -121, -120, -121, -121, -121, -120, -121, -120, -121, -121, -123, -124, -127, -128, -130, -132, -133, -132, -129, -127, -129, -129, -130, -131, -132, -131, -130, -128, -126, -126, -125, -125, -123, -121, -122, -123, -123, -122, -122, -120, -120, -120, -120, -122, -121, -122, -123, -125, -125, -126, -125, -125, -124, -125, -125, -125, -124, -125, -127, -129, -131, -130, -131, -130, -129, -129, -127, -126, -125, -127, -128, -129, -129, -127, -123, -120, -120, -120, -121, -123, -124, -126, -127, -128, -127, -126, -127, -127, -130, -131, -133, -133, -131, -131, -132, -133, -133, -132, -131, -128, -126, -126, -126, -124, -125, -125, -127, -129, -128, -127, -123, -123, -124, -125, -123, -121, -122, -123, -126, -128, -130, -129, -129, -130, -130, -131, -130, -129, -128, -128, -130, -132, -134, -134, -132, -130, -128, -128, -127, -127, -127, -129, -130, -131, -131, -131, -130, -128, -127, -127, -128, -130, -129, -128, -128, -128, -127, -125, -126, -128, -130, -131, -133, -134, -133, -130, -129, -127, -125, -123, -122, -122, -120, -118, -118, -119, -120, -121, -123, -124, -125, -125, -128, -130, -132, -132, -133, -134, -134, -134, -135, -135, -132, -129, -127, -128, -130, -131, -132, -132, -132, -132, -131, -131, -130, -130, -129, -128, -129, -129, -130, -131, -134, -136, -138, -138, -138, -138, -138, -139, -139, -139, -138, -140, -140, -141, -139, -137, -135, -134, -134, -133, -132, -130, -131, -130, -128, -126, -125, -126, -126, -127, -127, -127, -126, -127, -129, -130, -132, -133, -134, -133, -134, -134, -134, -133, -133, -134, -137, -137, -136, -137, -137, -138, -136, -135, -135, -134, -134, -133, -134, -134, -135, -135, -133, -130, -127, -128, -128, -129, -130, -132, -133, -134, -133, -135, -134, -134, -132, -132, -135, -136, -135, -134, -134, -134, -134, -131, -131, -132, -134, -134, -131, -129, -128, -128, -130, -130, -131, -132, -132, -134, -134, -133, -128, -126, -126, -129, -129, -130, -132, -133, -134, -134, -134, -132, -131, -130, -132, -132, -133, -134, -136, -136, -135, -133, -131, -130, -130, -131, -132, -133, -133, -131, -129, -128, -127, -127, -127, -129, -130, -130, -129, -128, -125, -121, -118, -120, -125, -129, -133, -133, -132, -129, -126, -125, -124, -125, -125, -124, -124, -124, -122, -121, -119, -120, -121, -123, -125, -127, -127, -127, -127, -129, -130, -133, -133, -133, -132, -132, -131, -130, -130, -129, -128, -125, -125, -125, -126, -125, -125, -126, -126, -125, -124, -123, -122, -123, -122, -123, -126, -127, -127, -127, -127, -127, -127, -128, -130, -132, -132, -133, -130, -129, -127, -128, -128, -129, -129, -129, -128, -127, -127, -127, -125, -125, -122, -123, -121, -122, -122, -123, -122, -123, -122, -124, -125, -126, -125, -125, -125, -125, -127, -125, -123, -122, -122, -124, -125, -128, -128, -128, -128, -128, -129, -129, -129, -129, -128, -129, -130, -129, -127, -125, -125, -123, -120, -120, -122, -123, -124, -125, -126, -126, -125, -126, -125, -125, -124, -126, -128, -130, -132, -130, -129, -128, -128, -126, -126, -127, -125, -125, -125, -125, -123, -123, -123, -124, -124, -126, -128, -129, -127, -124, -121, -120, -122, -123, -124, -125, -125, -126, -125, -122, -120, -119, -120, -121, -124, -125, -125, -121, -119, -116, -116, -116, -118, -120, -123, -124, -125, -122, -122, -122, -123, -122, -123, -125, -127, -125, -124, -123, -122, -121, -121, -118, -115, -114, -114, -116, -117, -120, -120, -117, -118, -123, -125, -118, -112, -116, -127, -131, -131, -128, -126, -122, -120, -121, -122, -121, -120, -122, -127, -129, -122, -112, -107, -108, -113, -117, -120, -119, -119, -120, -122, -121, -121, -120, -122, -125, -128, -127, -127, -125, -126, -128, -131, -131, -131, -129, -128, -126, -125, -125, -125, -122, -122, -122, -125, -125, -125, -124, -125, -126, -127, -126, -127, -128, -129, -129, -130, -131, -130, -129, -128, -129, -127, -122, -117, -117, -119, -125, -129, -128, -122, -117, -115, -120, -127, -131, -131, -129, -126, -125, -122, -120, -119, -120, -124, -129, -134, -136, -130, -119, -114, -115, -118, -120, -122, -126, -128, -129, -129, -127, -122, -121, -122, -126, -129, -131, -132, -134, -137, -139, -138, -136, -133, -131, -128, -127, -124, -124, -125, -128, -129, -127, -124, -119, -118, -118, -122, -124, -124, -125, -127, -131, -130, -129, -128, -129, -130, -132, -135, -137, -134, -131, -129, -132, -133, -132, -130, -127, -126, -124, -122, -121, -121, -124, -127, -130, -131, -130, -128, -122, -118, -119, -125, -132, -135, -135, -131, -128, -128, -129, -130, -129, -131, -133, -136, -137, -137, -132, -131, -131, -131, -129, -128, -126, -126, -126, -129, -130, -131, -129, -129, -128, -127, -125, -124, -123, -122, -122, -124, -125, -125, -127, -127, -128, -128, -127, -129, -132, -134, -134, -134, -133, -132, -129, -129, -128, -125, -124, -124, -124, -125, -126, -128, -127, -126, -124, -124, -124, -124, -124, -125, -126, -128, -131, -133, -134, -132, -131, -131, -133, -134, -135, -133, -132, -132, -134, -133, -131, -130, -128, -126, -125, -125, -126, -126, -124, -124, -124, -126, -126, -126, -124, -125, -126, -128, -127, -127, -127, -129, -131, -132, -132, -133, -133, -133, -133, -135, -135, -134, -133, -132, -131, -130, -128, -128, -127, -128, -129, -130, -128, -128, -127, -126, -123, -123, -123, -125, -127, -129, -130, -131, -132, -134, -134, -132, -130, -128, -128, -130, -131, -133, -134, -135, -134, -135, -133, -128, -125, -124, -124, -127, -127, -129, -129, -130, -128, -126, -124, -123, -123, -123, -123, -124, -124, -126, -130, -131, -131, -128, -128, -129, -131, -131, -132, -132, -133, -134, -134, -135, -134, -131, -130, -128, -128, -128, -127, -128, -128, -128, -127, -125, -126, -128, -127, -125, -124, -124, -127, -130, -130, -131, -128, -128, -127, -126, -125, -126, -126, -128, -131, -132, -132, -130, -127, -125, -123, -123, -124, -126, -127, -128, -129, -127, -127, -126, -124, -122, -121, -123, -125, -126, -125, -126, -126, -125, -125, -127, -127, -126, -127, -129, -132, -133, -133, -133, -130, -129, -128, -128, -127, -128, -128, -129, -130, -130, -129, -127, -127, -127, -125, -124, -124, -123, -122, -124, -124, -126, -125, -126, -126, -124, -123, -123, -125, -127, -128, -128, -128, -129, -130, -131, -127, -126, -125, -126, -128, -131, -131, -132, -132, -131, -129, -127, -126, -125, -122, -122, -123, -125, -127, -127, -128, -128, -127, -127, -128, -127, -128, -128, -130, -130, -131, -129, -127, -125, -125, -125, -127, -129, -129, -128, -127, -128, -129, -126, -124, -123, -124, -123, -124, -128, -129, -129, -130, -129, -128, -125, -124, -123, -125, -125, -126, -126, -128, -127, -128, -128, -128, -127, -126, -123, -124, -126, -129, -132, -132, -131, -130, -130, -129, -127, -125, -125, -124, -124, -126, -128, -130, -129, -128, -128, -125, -124, -123, -124, -125, -126, -128, -129, -128, -128, -127, -127, -126, -125, -125, -126, -128, -129, -129, -130, -130, -128, -126, -126, -126, -128, -127, -128, -129, -130, -129, -126, -125, -123, -122, -123, -126, -126, -124, -123, -124, -127, -128, -126, -125, -123, -123, -124, -126, -126, -128, -129, -129, -131, -130, -130, -128, -126, -125, -125, -126, -127, -128, -130, -130, -129, -127, -128, -129, -128, -128, -129, -129, -127, -126, -125, -125, -124, -124, -124, -125, -125, -126, -125, -126, -127, -128, -129, -127, -127, -126, -128, -129, -129, -130, -132, -131, -129, -127, -127, -125, -125, -126, -128, -128, -128, -128, -127, -127, -126, -125, -124, -125, -125, -128, -128, -130, -130, -129, -128, -128, -129, -129, -128, -128, -128, -128, -127, -127, -127, -129, -130, -130, -127, -125, -125, -127, -127, -127, -127, -127, -126, -127, -127, -126, -124, -124, -126, -127, -128, -128, -128, -127, -128, -129, -129, -127, -127, -129, -129, -129, -129, -131, -133, -134, -134, -132, -130, -128, -127, -126, -124, -124, -125, -126, -125, -125, -124, -121, -119, -119, -123, -125, -126, -128, -130, -131, -132, -132, -131, -129, -128, -125, -125, -125, -127, -128, -129, -129, -131, -129, -128, -125, -125, -125, -125, -125, -125, -126, -125, -124, -122, -122, -123, -123, -124, -125, -127, -129, -131, -131, -131, -130, -128, -128, -128, -130, -129, -130, -129, -129, -129, -127, -126, -124, -123, -123, -124, -124, -125, -125, -126, -127, -127, -127, -125, -124, -123, -124, -126, -127, -127, -126, -125, -125, -125, -126, -127, -128, -126, -125, -125, -126, -127, -128, -129, -130, -129, -129, -128, -129, -129, -130, -130, -129, -128, -129, -130, -130, -130, -128, -128, -127, -127, -127, -126, -125, -125, -125, -125, -122, -120, -120, -121, -123, -125, -127, -129, -128, -129, -130, -129, -127, -128, -130, -132, -131, -131, -131, -131, -131, -127, -125, -123, -123, -124, -125, -127, -126, -124, -125, -125, -124, -121, -119, -118, -119, -121, -123, -124, -124, -126, -129, -130, -130, -128, -128, -128, -133, -136, -138, -136, -133, -133, -132, -130, -128, -126, -126, -127, -128, -128, -128, -127, -125, -125, -124, -123, -122, -123, -124, -126, -127, -128, -131, -131, -130, -128, -129, -128, -128, -128, -129, -130, -130, -132, -132, -130, -129, -126, -126, -125, -125, -126, -126, -126, -125, -123, -123, -124, -123, -123, -121, -120, -118, -119, -120, -122, -124, -126, -128, -129, -130, -130, -129, -130, -130, -131, -131, -132, -133, -133, -134, -134, -133, -130, -131, -131, -132, -130, -129, -128, -127, -126, -125, -123, -123, -122, -122, -123, -123, -123, -123, -125, -126, -127, -125, -124, -124, -127, -130, -133, -134, -133, -131, -128, -124, -120, -117, -118, -122, -126, -128, -128, -127, -124, -122, -120, -119, -120, -123, -127, -129, -129, -128, -127, -125, -125, -127, -131, -134, -137, -138, -139, -136, -133, -132, -130, -129, -127, -126, -127, -127, -126, -126, -125, -125, -124, -124, -122, -120, -119, -121, -124, -127, -127, -129, -132, -134, -134, -133, -133, -133, -133, -134, -134, -133, -130, -130, -130, -131, -130, -130, -128, -127, -123, -121, -126, -124, -117, -111, -111, -116, -119, -120, -123, -122, -119, -117, -118, -118, -120, -121, -124, -127, -130, -130, -128, -127, -127, -128, -129, -131, -132, -131, -129, -135, -144, -141, -130, -122, -122, -124, -125, -130, -133, -133, -130, -129, -128, -126, -125, -123, -123, -130, -141, -146, -142, -136, -132, -127, -124, -123, -125, -128, -131, -133, -131, -129, -124, -121, -120, -121, -123, -125, -124, -124, -123, -122, -122, -123, -123, -123, -123, -122, -124, -126, -121, -115, -111, -114, -120, -123, -126, -128, -129, -128, -128, -125, -122, -120, -122, -126, -129, -131, -131, -130, -130, -132, -133, -129, -130, -136, -142, -146, -146, -137, -125, -117, -119, -124, -129, -133, -138, -139, -137, -134, -130, -124, -123, -125, -129, -131, -136, -141, -142, -139, -135, -129, -126, -124, -125, -128, -129, -132, -133, -132, -130, -127, -126, -124, -123, -123, -123, -122, -122, -122, -122, -121, -120, -121, -122, -123, -124, -127, -128, -121, -114, -113, -116, -119, -123, -127, -129, -128, -126, -126, -124, -121, -122, -124, -125, -126, -130, -134, -134, -130, -127, -126, -125, -131, -138, -144, -145, -137, -125, -116, -114, -119, -124, -130, -135, -137, -136, -132, -126, -120, -119, -121, -126, -127, -130, -136, -141, -139, -135, -130, -126, -120, -118, -120, -122, -124, -125, -127, -129, -124, -117, -116, -120, -123, -123, -122, -123, -122, -121, -121, -122, -121, -121, -122, -123, -129, -132, -127, -119, -113, -114, -117, -120, -123, -128, -129, -128, -127, -125, -123, -121, -123, -127, -130, -133, -133, -131, -129, -130, -129, -128, -129, -136, -145, -151, -144, -129, -118, -115, -118, -122, -127, -134, -136, -136, -135, -132, -126, -121, -119, -124, -127, -129, -130, -136, -140, -140, -136, -132, -129, -126, -124, -124, -125, -125, -130, -133, -127, -118, -119, -124, -126, -124, -125, -125, -124, -122, -123, -121, -120, -121, -122, -128, -131, -132, -133, -125, -118, -115, -117, -120, -123, -131, -131, -132, -129, -126, -122, -118, -119, -122, -124, -128, -128, -127, -128, -128, -126, -125, -130, -137, -146, -148, -142, -130, -117, -115, -119, -124, -129, -133, -137, -133, -134, -131, -124, -122, -122, -127, -132, -133, -128, -127, -132, -138, -137, -134, -131, -127, -128, -128, -128, -130, -131, -133, -131, -121, -117, -125, -129, -128, -127, -132, -130, -123, -123, -123, -122, -120, -124, -126, -130, -129, -130, -128, -121, -114, -113, -117, -123, -125, -128, -131, -125, -124, -124, -123, -122, -121, -125, -125, -126, -128, -125, -125, -126, -129, -130, -137, -141, -143, -141, -134, -123, -121, -123, -127, -131, -135, -136, -135, -134, -132, -126, -124, -124, -122, -128, -133, -130, -126, -128, -132, -136, -139, -135, -132, -129, -129, -126, -127, -130, -132, -133, -124, -118, -121, -128, -125, -121, -123, -123, -119, -119, -121, -122, -118, -119, -120, -123, -123, -121, -125, -126, -122, -116, -118, -118, -123, -124, -128, -128, -126, -123, -122, -122, -122, -123, -122, -126, -129, -128, -128, -127, -125, -126, -128, -134, -142, -141, -134, -126, -122, -124, -127, -131, -133, -134, -135, -135, -132, -130, -126, -126, -126, -132, -134, -133, -133, -128, -127, -132, -137, -140, -136, -135, -131, -126, -122, -121, -125, -128, -124, -120, -122, -129, -127, -123, -122, -120, -121, -121, -125, -124, -122, -124, -123, -126, -128, -124, -123, -125, -125, -120, -113, -115, -116, -124, -127, -129, -131, -129, -126, -124, -123, -121, -121, -124, -126, -129, -132, -133, -131, -130, -132, -135, -137, -136, -130, -128, -128, -127, -132, -133, -134, -132, -130, -132, -128, -127, -126, -126, -127, -131, -132, -131, -131, -128, -127, -126, -130, -135, -138, -136, -135, -134, -130, -128, -126, -130, -128, -125, -124, -127, -128, -126, -123, -122, -122, -121, -124, -123, -123, -122, -122, -124, -125, -125, -123, -123, -127, -127, -122, -114, -112, -115, -118, -124, -126, -129, -130, -126, -126, -123, -119, -118, -119, -124, -126, -131, -131, -132, -131, -134, -138, -138, -131, -128, -126, -127, -127, -131, -133, -132, -133, -134, -133, -130, -128, -124, -124, -127, -128, -131, -131, -132, -131, -128, -127, -131, -135, -137, -135, -133, -130, -126, -123, -124, -126, -125, -126, -128, -130, -128, -124, -120, -119, -120, -122, -124, -125, -125, -124, -122, -121, -122, -122, -122, -122, -126, -128, -121, -115, -113, -117, -122, -125, -127, -129, -128, -128, -125, -123, -122, -121, -125, -129, -131, -132, -130, -127, -127, -130, -136, -137, -132, -129, -128, -128, -128, -128, -131, -133, -136, -135, -132, -131, -129, -129, -129, -130, -132, -132, -129, -130, -129, -127, -127, -133, -140, -139, -137, -132, -126, -122, -120, -122, -124, -126, -128, -128, -128, -124, -122, -121, -121, -122, -122, -125, -124, -125, -124, -122, -122, -122, -123, -123, -126, -131, -127, -120, -112, -113, -114, -120, -125, -128, -131, -129, -127, -125, -123, -122, -121, -122, -124, -131, -133, -130, -126, -132, -141, -144, -142, -136, -133, -129, -127, -128, -129, -128, -131, -134, -132, -121, -114, -111, -114, -120, -125, -130, -131, -126, -127, -126, -124, -123, -118, -127, -138, -146, -142, -134, -128, -124, -123, -124, -130, -131, -131, -133, -134, -130, -127, -122, -123, -129, -130, -125, -118, -114, -115, -119, -122, -128, -130, -130, -130, -130, -130, -128, -125, -125, -130, -132, -137, -135, -133, -130, -128, -130, -126, -127, -127, -128, -124, -124, -131, -136, -139, -137, -136, -134, -128, -125, -124, -126, -129, -130, -131, -137, -136, -127, -117, -111, -116, -123, -126, -131, -133, -131, -125, -122, -120, -118, -114, -122, -135, -142, -141, -134, -128, -121, -120, -120, -124, -124, -126, -129, -128, -127, -122, -118, -117, -122, -126, -121, -112, -110, -110, -116, -120, -125, -125, -124, -124, -125, -125, -123, -123, -123, -127, -130, -131, -130, -126, -127, -127, -127, -127, -128, -128, -129, -129, -126, -124, -131, -139, -141, -141, -138, -135, -131, -128, -130, -132, -134, -136, -138, -139, -140, -134, -124, -117, -119, -125, -129, -132, -132, -132, -127, -125, -124, -121, -114, -118, -130, -140, -139, -135, -130, -122, -122, -121, -124, -125, -126, -129, -131, -132, -130, -125, -121, -123, -127, -124, -116, -115, -116, -121, -124, -127, -129, -128, -130, -129, -127, -124, -124, -125, -128, -131, -133, -132, -129, -128, -128, -127, -129, -129, -129, -132, -131, -128, -126, -128, -137, -141, -141, -140, -138, -133, -130, -128, -130, -131, -132, -134, -137, -138, -133, -121, -110, -110, -115, -120, -124, -127, -127, -123, -121, -121, -115, -109, -112, -123, -136, -138, -134, -126, -121, -120, -120, -124, -124, -127, -130, -129, -131, -128, -125, -122, -122, -126, -125, -119, -114, -113, -117, -122, -126, -128, -127, -128, -127, -126, -126, -126, -126, -128, -132, -134, -133, -129, -127, -125, -128, -130, -131, -132, -129, -129, -127, -125, -128, -135, -141, -140, -138, -136, -131, -127, -125, -126, -128, -131, -134, -133, -133, -133, -127, -115, -109, -113, -118, -122, -124, -125, -124, -122, -122, -121, -115, -116, -125, -136, -140, -138, -135, -126, -123, -123, -126, -127, -128, -130, -131, -132, -130, -127, -124, -123, -128, -127, -123, -117, -115, -117, -122, -125, -125, -126, -126, -128, -129, -129, -127, -128, -129, -133, -134, -134, -130, -128, -127, -128, -130, -131, -131, -130, -131, -127, -123, -123, -129, -136, -138, -136, -134, -129, -124, -123, -124, -126, -127, -130, -132, -135, -136, -133, -120, -112, -112, -118, -122, -124, -127, -127, -125, -123, -121, -115, -113, -121, -133, -140, -138, -130, -125, -122, -121, -124, -128, -129, -130, -132, -131, -129, -125, -125, -126, -127, -131, -128, -124, -119, -118, -121, -124, -126, -127, -128, -129, -129, -128, -127, -126, -127, -130, -132, -131, -132, -129, -126, -125, -124, -126, -129, -131, -131, -130, -125, -123, -128, -136, -139, -138, -137, -133, -130, -128, -128, -127, -129, -131, -131, -131, -133, -132, -122, -114, -114, -120, -121, -125, -127, -127, -126, -123, -124, -120, -116, -121, -133, -140, -140, -135, -130, -126, -125, -126, -128, -127, -129, -130, -131, -132, -128, -125, -124, -123, -126, -127, -126, -121, -115, -115, -120, -124, -127, -128, -130, -129, -128, -126, -126, -127, -127, -128, -129, -130, -129, -127, -125, -125, -125, -125, -125, -125, -127, -127, -124, -129, -135, -137, -137, -134, -133, -129, -126, -127, -127, -128, -131, -132, -133, -137, -137, -128, -117, -113, -116, -120, -124, -128, -131, -128, -125, -125, -122, -116, -117, -125, -134, -140, -139, -136, -130, -127, -126, -127, -128, -129, -129, -129, -129, -129, -128, -125, -123, -124, -125, -126, -124, -117, -112, -113, -116, -121, -125, -128, -129, -128, -127, -127, -126, -126, -128, -130, -132, -131, -128, -125, -124, -125, -128, -130, -131, -131, -127, -125, -127, -133, -137, -138, -136, -135, -132, -130, -128, -128, -127, -129, -132, -134, -137, -140, -133, -120, -115, -117, -121, -124, -127, -130, -129, -129, -128, -125, -119, -116, -120, -129, -136, -137, -133, -129, -125, -122, -123, -122, -121, -123, -125, -129, -130, -128, -125, -125, -123, -124, -127, -129, -126, -120, -117, -118, -122, -124, -128, -129, -129, -128, -128, -127, -125, -127, -127, -129, -131, -130, -127, -125, -124, -126, -128, -129, -130, -128, -126, -128, -136, -140, -139, -137, -135, -132, -129, -127, -127, -127, -129, -132, -130, -133, -135, -128, -116, -109, -113, -117, -121, -124, -128, -126, -123, -122, -120, -117, -112, -115, -126, -137, -141, -138, -132, -127, -123, -122, -124, -125, -126, -128, -130, -131, -129, -125, -123, -123, -125, -127, -129, -125, -117, -114, -118, -123, -126, -130, -132, -131, -129, -129, -128, -126, -126, -129, -132, -134, -130, -127, -125, -126, -127, -127, -128, -127, -125, -123, -129, -136, -140, -137, -136, -134, -132, -128, -125, -127, -126, -128, -130, -132, -133, -137, -131, -118, -111, -112, -118, -120, -124, -128, -128, -125, -124, -123, -121, -115, -117, -125, -136, -139, -135, -131, -128, -125, -125, -127, -127, -128, -129, -132, -132, -131, -128, -125, -126, -126, -129, -130, -128, -122, -117, -117, -121, -123, -126, -130, -131, -129, -127, -126, -125, -126, -128, -129, -132, -131, -129, -126, -126, -127, -125, -126, -127, -126, -124, -125, -133, -137, -137, -133, -131, -127, -126, -124, -126, -125, -127, -129, -130, -132, -137, -135, -124, -115, -114, -118, -120, -125, -128, -129, -128, -127, -124, -122, -119, -116, -122, -134, -141, -141, -137, -131, -125, -121, -122, -124, -125, -129, -133, -135, -134, -130, -127, -124, -123, -125, -127, -130, -126, -121, -118, -121, -122, -126, -128, -130, -129, -127, -126, -126, -126, -126, -127, -129, -129, -129, -126, -123, -122, -122, -123, -127, -128, -126, -126, -133, -139, -140, -137, -133, -132, -129, -126, -126, -126, -127, -129, -130, -133, -136, -136, -125, -115, -111, -115, -120, -123, -128, -130, -129, -127, -125, -121, -119, -116, -120, -129, -142, -145, -139, -133, -127, -123, -123, -127, -128, -128, -129, -130, -131, -130, -126, -124, -122, -126, -130, -128, -122, -114, -114, -118, -124, -127, -130, -130, -127, -126, -126, -125, -124, -126, -128, -131, -133, -132, -126, -125, -124, -124, -124, -125, -125, -125, -122, -124, -131, -137, -138, -136, -134, -132, -130, -126, -125, -126, -128, -133, -135, -136, -138, -136, -127, -117, -115, -118, -121, -125, -128, -129, -128, -126, -123, -122, -119, -117, -121, -132, -140, -140, -134, -130, -127, -124, -122, -124, -125, -127, -129, -133, -132, -128, -125, -121, -122, -125, -127, -124, -119, -116, -119, -122, -124, -124, -126, -127, -126, -126, -125, -126, -126, -126, -128, -129, -131, -130, -128, -127, -128, -128, -127, -128, -129, -128, -126, -128, -133, -138, -139, -140, -138, -135, -129, -126, -125, -126, -129, -134, -137, -135, -133, -132, -128, -122, -117, -117, -119, -123, -126, -128, -126, -124, -121, -121, -122, -120, -119, -125, -133, -136, -134, -130, -126, -123, -121, -122, -126, -127, -129, -131, -132, -131, -127, -125, -122, -121, -123, -126, -126, -123, -121, -121, -121, -122, -123, -124, -124, -125, -128, -128, -129, -128, -127, -126, -126, -127, -127, -128, -127, -128, -127, -127, -128, -128, -127, -130, -134, -137, -137, -136, -136, -132, -130, -127, -127, -125, -127, -128, -131, -130, -129, -130, -129, -123, -115, -111, -112, -116, -119, -124, -126, -124, -124, -122, -122, -121, -119, -119, -127, -136, -140, -138, -132, -128, -125, -123, -125, -125, -128, -130, -132, -133, -130, -128, -125, -124, -126, -129, -133, -133, -129, -123, -121, -121, -123, -124, -128, -131, -132, -134, -133, -130, -126, -123, -124, -125, -128, -129, -131, -129, -128, -127, -125, -124, -124, -123, -126, -132, -136, -139, -136, -134, -130, -125, -123, -124, -127, -129, -132, -134, -134, -132, -131, -128, -122, -115, -115, -116, -120, -122, -125, -126, -124, -122, -121, -121, -121, -122, -123, -127, -132, -136, -136, -134, -131, -130, -129, -128, -130, -130, -131, -132, -132, -130, -129, -128, -129, -131, -130, -130, -129, -126, -121, -117, -117, -120, -122, -124, -127, -129, -128, -127, -124, -123, -122, -123, -123, -125, -127, -128, -126, -124, -123, -123, -127, -130, -132, -133, -133, -131, -130, -128, -128, -126, -126, -126, -128, -129, -129, -127, -127, -127, -129, -129, -125, -119, -117, -121, -125, -128, -130, -129, -128, -125, -123, -122, -121, -122, -124, -128, -129, -129, -130, -132, -133, -133, -132, -133, -131, -130, -129, -130, -130, -131, -132, -132, -133, -132, -131, -129, -127, -128, -127, -124, -120, -119, -120, -120, -121, -122, -123, -123, -124, -125, -125, -124, -123, -124, -125, -125, -125, -127, -130, -133, -135, -134, -131, -129, -127, -127, -128, -129, -129, -129, -131, -133, -133, -132, -129, -124, -124, -127, -126, -123, -120, -119, -122, -124, -126, -128, -129, -129, -127, -126, -125, -124, -122, -125, -127, -130, -129, -127, -125, -123, -124, -127, -132, -136, -136, -134, -133, -131, -131, -129, -127, -128, -128, -131, -131, -129, -127, -125, -126, -130, -128, -123, -119, -119, -121, -123, -126, -127, -127, -125, -124, -124, -122, -121, -120, -120, -124, -128, -133, -136, -137, -135, -134, -131, -128, -127, -126, -127, -128, -131, -133, -132, -132, -130, -127, -126, -126, -128, -128, -123, -121, -120, -122, -123, -125, -126, -126, -125, -123, -124, -123, -119, -119, -120, -124, -126, -126, -127, -126, -128, -130, -130, -130, -130, -131, -132, -132, -132, -131, -129, -129, -127, -128, -127, -129, -128, -128, -130, -132, -130, -125, -119, -117, -118, -122, -125, -127, -129, -129, -127, -126, -124, -122, -121, -122, -124, -128, -130, -130, -131, -133, -135, -134, -131, -131, -130, -131, -131, -131, -133, -131, -131, -131, -130, -130, -128, -126, -127, -128, -128, -122, -118, -117, -119, -120, -122, -123, -124, -124, -121, -120, -118, -118, -120, -123, -127, -128, -127, -126, -129, -132, -133, -132, -132, -132, -131, -131, -130, -130, -130, -130, -131, -133, -133, -131, -129, -126, -127, -129, -127, -122, -118, -118, -120, -124, -126, -129, -129, -127, -127, -124, -124, -121, -121, -123, -126, -130, -130, -129, -127, -127, -124, -125, -127, -130, -132, -132, -134, -133, -133, -130, -126, -125, -125, -127, -128, -129, -128, -129, -130, -129, -124, -120, -118, -120, -121, -123, -124, -123, -123, -123, -123, -123, -122, -122, -124, -126, -127, -128, -129, -132, -134, -136, -137, -136, -133, -130, -128, -127, -128, -129, -130, -132, -132, -132, -130, -128, -128, -129, -129, -128, -123, -120, -118, -120, -121, -124, -126, -127, -126, -125, -124, -123, -122, -122, -122, -124, -126, -126, -125, -127, -129, -131, -130, -130, -130, -130, -131, -130, -130, -129, -127, -127, -129, -130, -129, -129, -128, -129, -130, -128, -124, -120, -121, -122, -123, -125, -125, -125, -126, -125, -126, -125, -123, -124, -125, -128, -130, -129, -129, -130, -132, -135, -136, -136, -134, -133, -132, -132, -132, -131, -130, -131, -131, -132, -130, -129, -128, -128, -128, -127, -121, -117, -116, -118, -121, -122, -124, -125, -124, -124, -122, -122, -122, -121, -121, -122, -124, -125, -123, -125, -128, -132, -133, -134, -133, -132, -130, -128, -129, -129, -129, -130, -130, -132, -132, -131, -128, -128, -128, -128, -123, -119, -117, -119, -121, -124, -126, -128, -126, -125, -123, -122, -120, -121, -124, -128, -130, -131, -130, -129, -127, -126, -125, -126, -129, -134, -136, -136, -136, -134, -132, -128, -126, -126, -126, -129, -130, -131, -131, -131, -123, -118, -116, -117, -121, -124, -128, -130, -128, -127, -126, -122, -118, -124, -134, -140, -138, -134, -130, -125, -122, -123, -124, -125, -129, -134, -130, -122, -115, -115, -116, -122, -134, -141, -139, -131, -126, -125, -128, -134, -135, -132, -128, -126, -126, -125, -126, -126, -126, -127, -129, -129, -126, -123, -120, -122, -123, -126, -127, -125, -123, -122, -124, -124, -122, -121, -129, -140, -146, -142, -137, -131, -127, -127, -133, -135, -127, -116, -120, -134, -142, -140, -136, -132, -127, -125, -125, -122, -118, -118, -126, -128, -122, -113, -107, -108, -113, -119, -126, -126, -126, -126, -126, -123, -123, -130, -136, -141, -140, -138, -133, -127, -125, -125, -126, -127, -130, -134, -133, -126, -119, -116, -117, -119, -123, -125, -125, -124, -122, -121, -119, -119, -121, -122, -126, -132, -138, -138, -139, -142, -138, -128, -119, -117, -119, -129, -142, -149, -147, -139, -133, -127, -121, -119, -121, -123, -127, -131, -136, -134, -121, -110, -108, -114, -121, -127, -131, -133, -130, -128, -126, -124, -122, -123, -127, -132, -136, -135, -131, -127, -123, -122, -123, -126, -128, -129, -129, -128, -125, -124, -123, -126, -128, -130, -130, -130, -130, -128, -126, -130, -137, -141, -138, -135, -134, -135, -131, -121, -115, -117, -122, -125, -130, -137, -141, -137, -133, -130, -127, -121, -118, -119, -122, -123, -124, -123, -124, -120, -113, -106, -109, -115, -121, -123, -124, -128, -132, -135, -135, -132, -125, -120, -118, -122, -123, -121, -119, -122, -125, -127, -127, -123, -121, -121, -123, -124, -123, -122, -122, -123, -125, -125, -123, -125, -126, -125, -125, -134, -142, -144, -143, -140, -137, -136, -134, -130, -119, -115, -124, -139, -144, -142, -136, -130, -126, -123, -124, -124, -123, -124, -129, -136, -132, -118, -108, -109, -116, -123, -127, -130, -130, -130, -128, -126, -123, -124, -130, -138, -143, -143, -138, -133, -127, -125, -125, -127, -129, -133, -135, -130, -124, -119, -119, -120, -124, -129, -131, -131, -126, -123, -121, -121, -122, -124, -125, -124, -129, -136, -144, -146, -135, -123, -117, -116, -120, -132, -143, -147, -145, -142, -138, -130, -122, -118, -119, -122, -128, -130, -130, -129, -127, -118, -109, -108, -112, -119, -124, -130, -131, -129, -125, -122, -121, -121, -123, -129, -133, -134, -132, -127, -124, -122, -122, -121, -123, -125, -128, -127, -126, -125, -125, -125, -126, -128, -128, -128, -128, -129, -129, -127, -127, -131, -137, -139, -139, -141, -136, -123, -113, -112, -119, -124, -129, -133, -137, -138, -137, -133, -127, -121, -119, -118, -120, -123, -123, -122, -122, -124, -127, -126, -119, -113, -112, -116, -120, -127, -135, -138, -135, -130, -127, -126, -127, -123, -117, -115, -118, -121, -123, -124, -126, -125, -125, -127, -128, -126, -125, -123, -125, -127, -127, -124, -123, -124, -128, -130, -128, -126, -132, -141, -146, -145, -140, -139, -137, -131, -122, -121, -127, -136, -142, -143, -142, -136, -130, -126, -124, -124, -124, -125, -128, -131, -133, -127, -115, -107, -108, -113, -117, -123, -127, -130, -129, -129, -126, -123, -128, -138, -146, -148, -143, -138, -130, -126, -125, -128, -129, -132, -135, -135, -129, -120, -117, -118, -120, -124, -129, -131, -129, -127, -123, -121, -121, -123, -122, -122, -127, -139, -148, -143, -129, -120, -119, -123, -125, -130, -139, -145, -145, -143, -138, -130, -120, -116, -118, -123, -126, -127, -127, -125, -127, -128, -122, -111, -107, -112, -119, -123, -127, -128, -127, -125, -124, -123, -121, -120, -122, -125, -127, -126, -125, -122, -122, -123, -125, -128, -128, -129, -127, -127, -125, -123, -121, -121, -124, -128, -130, -130, -129, -126, -123, -125, -133, -136, -138, -140, -136, -126, -115, -115, -119, -124, -129, -134, -135, -136, -139, -137, -131, -125, -122, -121, -122, -123, -124, -122, -121, -121, -124, -125, -121, -113, -110, -114, -121, -124, -126, -130, -135, -135, -134, -130, -128, -125, -120, -116, -116, -117, -120, -123, -125, -129, -129, -128, -127, -125, -124, -123, -123, -123, -125, -126, -127, -126, -128, -129, -129, -126, -128, -137, -144, -144, -140, -139, -136, -134, -133, -131, -126, -124, -130, -138, -140, -137, -133, -128, -126, -126, -127, -125, -124, -126, -130, -134, -131, -120, -110, -109, -112, -118, -123, -127, -129, -129, -129, -127, -124, -127, -135, -142, -143, -141, -136, -129, -125, -124, -127, -129, -130, -133, -137, -136, -127, -117, -114, -114, -120, -125, -130, -131, -129, -125, -123, -121, -119, -118, -119, -127, -137, -139, -133, -126, -126, -130, -134, -135, -134, -138, -144, -146, -143, -137, -131, -125, -122, -123, -124, -124, -124, -125, -125, -128, -129, -124, -113, -109, -113, -119, -124, -128, -131, -132, -128, -125, -123, -122, -121, -123, -124, -128, -130, -130, -129, -126, -123, -122, -124, -129, -131, -128, -123, -122, -121, -121, -122, -125, -128, -129, -132, -129, -125, -122, -128, -132, -135, -137, -138, -130, -119, -115, -118, -122, -125, -131, -135, -133, -134, -136, -134, -128, -125, -124, -125, -125, -126, -126, -124, -121, -121, -120, -122, -122, -119, -114, -115, -117, -118, -121, -129, -134, -135, -132, -129, -125, -118, -114, -114, -118, -121, -125, -127, -129, -128, -127, -126, -126, -124, -123, -123, -124, -124, -123, -124, -125, -127, -127, -128, -125, -124, -129, -138, -144, -143, -140, -137, -135, -134, -135, -134, -127, -120, -126, -137, -145, -143, -137, -132, -128, -126, -125, -127, -127, -126, -129, -134, -131, -119, -109, -108, -114, -121, -125, -130, -131, -132, -131, -129, -126, -129, -135, -141, -144, -142, -137, -130, -125, -124, -126, -128, -131, -136, -138, -133, -124, -117, -116, -119, -124, -129, -133, -133, -130, -125, -121, -118, -119, -120, -123, -127, -132, -132, -131, -129, -129, -130, -132, -132, -129, -133, -139, -145, -142, -138, -133, -129, -125, -124, -126, -125, -125, -126, -127, -129, -130, -126, -115, -109, -111, -118, -122, -126, -128, -128, -125, -122, -119, -119, -118, -122, -127, -131, -130, -129, -125, -122, -123, -132, -136, -131, -122, -119, -119, -120, -120, -122, -124, -127, -130, -132, -130, -124, -118, -121, -129, -135, -140, -139, -135, -125, -117, -117, -120, -124, -129, -135, -136, -136, -138, -137, -133, -128, -128, -128, -126, -125, -124, -123, -121, -121, -121, -120, -121, -123, -122, -119, -113, -112, -117, -126, -135, -138, -133, -127, -121, -121, -123, -124, -119, -115, -117, -123, -127, -128, -128, -127, -124, -126, -127, -126, -123, -122, -122, -125, -127, -129, -127, -127, -126, -125, -124, -128, -136, -140, -141, -139, -138, -136, -133, -130, -124, -117, -120, -133, -144, -146, -143, -136, -131, -126, -126, -127, -127, -128, -130, -132, -135, -131, -119, -109, -108, -115, -120, -125, -128, -130, -129, -128, -127, -122, -124, -132, -140, -143, -141, -135, -127, -120, -122, -126, -130, -132, -137, -137, -132, -123, -117, -116, -118, -123, -129, -132, -130, -127, -124, -122, -119, -120, -121, -122, -127, -130, -131, -130, -130, -128, -130, -131, -131, -130, -134, -142, -142, -139, -135, -132, -128, -124, -124, -124, -125, -124, -126, -126, -127, -130, -126, -116, -110, -110, -116, -120, -125, -129, -129, -126, -121, -119, -118, -119, -123, -126, -128, -129, -127, -126, -131, -135, -132, -123, -119, -120, -123, -124, -125, -125, -124, -125, -127, -129, -128, -126, -123, -123, -128, -133, -134, -132, -135, -137, -131, -120, -115, -119, -125, -132, -136, -137, -136, -136, -137, -134, -131, -128, -127, -125, -126, -126, -125, -122, -121, -121, -121, -124, -125, -119, -113, -112, -120, -128, -128, -127, -127, -129, -131, -132, -131, -123, -114, -111, -115, -122, -131, -135, -132, -128, -125, -124, -123, -121, -122, -125, -128, -130, -131, -128, -126, -125, -127, -129, -128, -125, -129, -137, -145, -144, -141, -139, -136, -131, -124, -120, -119, -126, -136, -146, -148, -144, -136, -128, -123, -122, -125, -126, -129, -132, -134, -135, -129, -118, -107, -107, -113, -121, -125, -128, -130, -128, -126, -123, -125, -131, -138, -141, -140, -138, -131, -124, -120, -122, -127, -131, -133, -137, -138, -131, -122, -116, -116, -119, -124, -129, -131, -131, -128, -127, -123, -121, -121, -121, -124, -128, -131, -131, -129, -129, -129, -132, -132, -130, -130, -134, -140, -141, -139, -135, -131, -126, -122, -122, -123, -123, -124, -126, -127, -128, -129, -121, -111, -105, -109, -114, -121, -125, -129, -127, -124, -121, -119, -117, -117, -120, -125, -128, -129, -129, -129, -129, -127, -124, -123, -127, -130, -130, -127, -124, -122, -122, -123, -126, -128, -129, -129, -130, -128, -127, -129, -131, -135, -139, -137, -125, -116, -118, -125, -130, -136, -137, -136, -136, -139, -140, -134, -129, -129, -129, -128, -126, -124, -121, -119, -121, -124, -124, -122, -121, -121, -119, -117, -113, -111, -116, -127, -137, -140, -137, -129, -115, -106, -107, -116, -126, -132, -134, -133, -127, -122, -119, -119, -120, -124, -130, -134, -134, -132, -127, -123, -123, -124, -127, -131, -131, -131, -135, -142, -143, -138, -135, -137, -136, -130, -125, -124, -123, -129, -141, -149, -148, -141, -135, -129, -124, -123, -126, -130, -132, -134, -134, -132, -125, -112, -106, -108, -116, -121, -126, -128, -127, -125, -124, -124, -124, -128, -133, -139, -140, -138, -131, -125, -121, -122, -126, -131, -132, -132, -135, -134, -125, -116, -113, -114, -120, -125, -130, -129, -126, -123, -122, -121, -119, -120, -121, -126, -130, -131, -130, -128, -129, -131, -133, -132, -133, -139, -144, -144, -140, -135, -131, -126, -123, -125, -126, -127, -127, -127, -127, -125, -126, -123, -116, -109, -110, -116, -121, -125, -127, -126, -123, -121, -120, -119, -118, -122, -126, -128, -128, -129, -128, -125, -122, -124, -129, -136, -134, -125, -119, -117, -118, -120, -123, -127, -129, -131, -132, -131, -125, -120, -122, -128, -137, -139, -133, -121, -116, -119, -125, -129, -134, -134, -134, -137, -143, -142, -135, -129, -128, -129, -129, -129, -127, -124, -123, -122, -124, -121, -121, -122, -123, -119, -112, -112, -118, -127, -134, -137, -135, -126, -116, -110, -111, -118, -128, -134, -135, -130, -125, -121, -119, -119, -120, -124, -128, -131, -131, -129, -124, -120, -121, -124, -127, -130, -130, -128, -125, -129, -137, -140, -138, -138, -139, -135, -127, -123, -121, -120, -129, -144, -152, -151, -144, -136, -128, -123, -124, -127, -129, -131, -132, -132, -132, -128, -118, -110, -110, -117, -122, -124, -126, -128, -128, -128, -126, -124, -125, -131, -139, -142, -140, -135, -130, -125, -125, -128, -130, -132, -134, -135, -130, -123, -118, -119, -120, -125, -127, -130, -128, -126, -125, -123, -122, -121, -123, -124, -127, -129, -130, -128, -128, -130, -134, -140, -142, -141, -139, -135, -131, -128, -127, -127, -127, -127, -127, -125, -124, -121, -120, -120, -122, -124, -123, -122, -122, -122, -116, -111, -114, -119, -125, -129, -127, -119, -112, -114, -119, -123, -124, -127, -128, -129, -128, -126, -121, -120, -122, -127, -131, -131, -128, -125, -123, -125, -127, -133, -138, -142, -141, -138, -135, -132, -127, -126, -128, -132, -134, -135, -135, -132, -131, -129, -129, -129, -128, -131, -130, -129, -128, -126, -122, -122, -123, -126, -124, -122, -122, -121, -121, -122, -123, -123, -123, -123, -122, -123, -125, -124, -118, -115, -114, -118, -119, -121, -123, -125, -126, -127, -129, -128, -127, -125, -126, -127, -131, -133, -132, -133, -133, -134, -132, -131, -131, -137, -141, -144, -141, -139, -134, -130, -128, -129, -130, -129, -130, -133, -134, -133, -130, -127, -126, -129, -130, -130, -129, -128, -127, -126, -126, -128, -129, -122, -114, -110, -114, -119, -122, -124, -125, -126, -124, -124, -121, -119, -119, -121, -124, -126, -128, -127, -126, -125, -124, -126, -133, -138, -139, -138, -136, -134, -129, -125, -123, -126, -134, -139, -139, -134, -129, -124, -121, -122, -122, -124, -126, -127, -129, -128, -121, -112, -108, -111, -116, -119, -119, -124, -131, -136, -137, -132, -126, -121, -120, -122, -126, -127, -128, -129, -126, -119, -115, -115, -118, -120, -125, -129, -129, -127, -126, -123, -120, -119, -119, -120, -123, -126, -129, -130, -130, -128, -127, -127, -131, -132, -132, -134, -139, -145, -145, -143, -138, -132, -127, -126, -128, -128, -129, -129, -129, -128, -129, -128, -123, -115, -113, -116, -121, -124, -127, -130, -131, -130, -130, -133, -134, -134, -128, -124, -123, -126, -128, -129, -131, -132, -132, -132, -130, -126, -127, -132, -136, -137, -133, -131, -128, -125, -125, -126, -128, -130, -130, -131, -130, -128, -120, -115, -115, -118, -123, -125, -128, -128, -128, -127, -126, -122, -121, -121, -124, -126, -128, -127, -127, -126, -125, -125, -128, -131, -134, -133, -133, -132, -129, -126, -124, -126, -127, -129, -130, -131, -129, -128, -127, -126, -124, -122, -120, -121, -122, -124, -123, -123, -122, -122, -123, -124, -123, -124, -124, -125, -126, -127, -127, -126, -124, -128, -134, -138, -138, -135, -134, -131, -128, -127, -126, -128, -131, -135, -137, -137, -135, -132, -131, -129, -125, -120, -120, -122, -123, -125, -126, -127, -126, -126, -126, -125, -123, -123, -124, -125, -127, -129, -129, -129, -128, -129, -134, -136, -136, -134, -131, -127, -124, -123, -124, -124, -127, -129, -131, -132, -130, -127, -124, -125, -127, -127, -122, -120, -120, -122, -123, -123, -124, -124, -123, -122, -122, -120, -120, -121, -123, -126, -127, -129, -128, -128, -128, -131, -135, -136, -136, -134, -133, -131, -130, -128, -127, -128, -129, -130, -131, -129, -127, -125, -125, -122, -119, -116, -118, -120, -122, -123, -122, -123, -122, -123, -123, -122, -122, -122, -122, -125, -127, -127, -127, -130, -135, -138, -137, -135, -132, -130, -128, -127, -128, -128, -130, -132, -134, -131, -127, -125, -123, -123, -121, -120, -120, -122, -123, -124, -125, -126, -126, -126, -125, -124, -124, -123, -125, -126, -127, -127, -125, -126, -126, -126, -126, -131, -137, -140, -138, -135, -133, -130, -128, -127, -130, -131, -132, -132, -132, -129, -127, -124, -125, -126, -126, -125, -124, -124, -125, -126, -125, -125, -126, -127, -128, -127, -125, -123, -123, -124, -126, -127, -128, -128, -129, -132, -135, -137, -136, -135, -133, -130, -128, -128, -129, -130, -131, -132, -134, -133, -130, -128, -127, -127, -125, -120, -117, -117, -117, -119, -120, -123, -124, -124, -122, -121, -121, -120, -121, -123, -126, -127, -128, -128, -132, -136, -137, -137, -135, -132, -129, -129, -128, -127, -125, -126, -127, -129, -129, -129, -127, -125, -125, -125, -123, -120, -118, -120, -122, -122, -122, -122, -123, -123, -124, -125, -124, -123, -122, -123, -125, -126, -126, -125, -124, -127, -133, -136, -136, -133, -129, -128, -125, -125, -125, -127, -129, -131, -133, -132, -130, -129, -127, -125, -123, -123, -123, -124, -124, -126, -129, -130, -127, -126, -124, -124, -124, -125, -126, -127, -129, -131, -133, -135, -134, -134, -133, -133, -133, -132, -131, -130, -130, -129, -129, -128, -128, -127, -126, -127, -127, -127, -125, -124, -125, -128, -128, -125, -120, -119, -118, -120, -121, -124, -125, -126, -126, -126, -125, -123, -121, -120, -123, -124, -126, -126, -130, -133, -135, -135, -136, -134, -131, -128, -128, -129, -130, -132, -134, -135, -136, -134, -133, -129, -125, -123, -123, -123, -123, -122, -122, -121, -121, -120, -121, -121, -121, -122, -122, -123, -122, -122, -124, -124, -127, -130, -135, -137, -137, -135, -133, -130, -128, -127, -128, -130, -130, -131, -131, -131, -131, -130, -129, -127, -125, -119, -118, -118, -120, -122, -124, -125, -124, -125, -125, -126, -125, -125, -124, -124, -125, -125, -127, -127, -127, -128, -131, -134, -136, -136, -135, -134, -130, -127, -126, -125, -127, -129, -132, -133, -132, -130, -126, -124, -122, -125, -126, -122, -118, -114, -115, -116, -119, -122, -125, -125, -125, -125, -124, -122, -123, -123, -126, -129, -129, -128, -130, -135, -139, -138, -135, -131, -129, -127, -128, -128, -128, -128, -130, -131, -131, -130, -127, -124, -122, -122, -123, -122, -122, -122, -124, -126, -127, -126, -126, -126, -127, -126, -126, -125, -124, -124, -124, -126, -129, -132, -134, -135, -134, -132, -131, -128, -126, -125, -128, -129, -131, -131, -133, -133, -132, -131, -128, -128, -129, -130, -125, -121, -118, -119, -121, -125, -127, -129, -128, -126, -126, -126, -125, -125, -125, -126, -128, -128, -129, -129, -126, -123, -126, -137, -143, -142, -138, -135, -130, -127, -128, -128, -130, -136, -140, -134, -124, -117, -118, -120, -124, -128, -131, -131, -130, -128, -125, -122, -120, -120, -123, -126, -127, -127, -123, -122, -122, -123, -123, -125, -127, -128, -127, -127, -126, -128, -128, -126, -130, -137, -142, -141, -136, -134, -133, -131, -132, -133, -133, -131, -131, -132, -132, -129, -127, -124, -123, -121, -121, -124, -121, -113, -108, -108, -112, -115, -118, -121, -121, -121, -120, -120, -119, -118, -117, -123, -134, -140, -139, -133, -131, -129, -126, -128, -130, -124, -118, -118, -123, -127, -127, -127, -127, -126, -126, -126, -123, -116, -117, -127, -136, -139, -136, -133, -130, -127, -129, -130, -131, -131, -132, -134, -136, -134, -129, -128, -130, -126, -119, -115, -116, -119, -120, -122, -125, -127, -127, -126, -124, -123, -122, -121, -123, -127, -129, -130, -130, -131, -131, -129, -129, -129, -131, -133, -133, -133, -133, -133, -131, -131, -130, -130, -131, -133, -132, -129, -132, -138, -142, -141, -137, -135, -133, -132, -133, -133, -133, -132, -132, -132, -131, -127, -128, -129, -122, -111, -108, -110, -115, -117, -121, -123, -123, -122, -123, -120, -118, -118, -119, -121, -124, -125, -125, -125, -123, -128, -127, -123, -132, -137, -143, -163, -149, -116, -97, -91, -92, -93, -97, -94, -93, -92, -96, -98, -100, -97, -111, -125, -135, -139, -140, -139, -130, -161, -135, -136, -168, -159, -134, -167, -184, -149, -173, -165, -158, -134, -128, -147, -172, -193, -187, -194, -183, -147, -123, -118, -132, -140, -120, -128, -128, -120, -141, -121, -123, -124, -86, -88, -94, -115, -113, -97, -79, -86, -111, -103, -86, -81, -88, -91, -100, -88, -88, -94, -68, -84, -118, -99, -110, -96, -85, -107, -107, -116, -110, -98, -101, -122, -142, -118, -114, -106, -97, -105, -110, -123, -118, -123, -110, -126, -140, -141, -135, -126, -117, -129, -157, -155, -161, -152, -140, -127, -134, -140, -152, -167, -166, -160, -174, -185, -173, -154, -127, -119, -125, -135, -139, -148, -147, -144, -153, -157, -156, -159, -161, -164, -168, -170, -166, -152, -152, -153, -143, -143, -148, -144, -144, -143, -154, -165, -154, -144, -136, -140, -140, -134, -134, -135, -128, -138, -128, -116, -118, -113, -113, -117, -126, -117, -115, -124, -122, -110, -110, -115, -107, -101, -104, -109, -115, -107, -103, -110, -108, -111, -111, -102, -105, -108, -107, -111, -114, -107, -108, -116, -121, -122, -119, -116, -117, -110, -112, -110, -108, -110, -107, -111, -112, -105, -104, -105, -101, -92, -92, -101, -101, -95, -106, -108, -96, -91, -101, -104, -96, -98, -100, -113, -118, -116, -117, -118, -111, -115, -118, -122, -137, -146, -148, -146, -145, -132, -122, -123, -130, -131, -137, -139, -145, -148, -148, -145, -133, -141, -145, -150, -157, -171, -172, -162, -164, -157, -155, -155, -156, -159, -161, -155, -155, -158, -154, -142, -132, -142, -148, -146, -151, -152, -155, -154, -139, -139, -135, -139, -147, -142, -148, -150, -144, -150, -150, -144, -147, -148, -148, -143, -142, -143, -140, -141, -146, -147, -141, -135, -134, -147, -150, -140, -133, -132, -134, -144, -147, -134, -140, -140, -150, -141, -129, -136, -115, -128, -122, -118, -117, -114, -120, -103, -98, -95, -88, -82, -90, -85, -91, -100, -103, -98, -98, -91, -79, -80, -86, -106, -95, -87, -95, -100, -94, -85, -98, -95, -87, -94, -100, -103, -114, -105, -93, -92, -93, -95, -96, -105, -103, -99, -98, -104, -98, -102, -104, -99, -103, -113, -123, -131, -130, -120, -123, -124, -123, -116, -130, -120, -117, -127, -126, -127, -134, -129, -109, -120, -130, -125, -124, -127, -131, -132, -138, -140, -127, -135, -135, -134, -135, -141, -141, -130, -133, -138, -140, -148, -151, -146, -151, -152, -151, -140, -149, -144, -156, -151, -144, -161, -155, -152, -146, -154, -152, -146, -137, -152, -157, -155, -168, -166, -167, -156, -149, -158, -157, -154, -160, -158, -148, -152, -154, -150, -151, -129, -125, -132, -137, -129, -131, -133, -133, -132, -128, -138, -128, -126, -127, -139, -138, -138, -136, -131, -128, -125, -129, -130, -131, -130, -141, -131, -132, -137, -123, -122, -119, -120, -121, -126, -124, -117, -112, -116, -121, -113, -109, -123, -135, -123, -119, -119, -117, -112, -107, -112, -115, -104, -107, -114, -112, -115, -115, -106, -83, -81, -97, -106, -105, -115, -112, -102, -96, -105, -109, -97, -97, -108, -116, -106, -111, -113, -107, -110, -109, -111, -111, -118, -117, -113, -120, -115, -114, -112, -109, -111, -112, -115, -119, -118, -109, -110, -112, -119, -110, -113, -121, -126, -140, -135, -136, -123, -127, -124, -123, -123, -118, -123, -123, -131, -135, -134, -125, -110, -110, -111, -114, -131, -135, -138, -141, -132, -132, -136, -128, -128, -131, -142, -148, -143, -152, -158, -150, -149, -149, -147, -158, -153, -154, -151, -147, -152, -147, -149, -148, -151, -149, -151, -144, -152, -154, -154, -154, -148, -152, -154, -156, -158, -160, -160, -156, -154, -151, -149, -151, -144, -146, -144, -147, -146, -144, -134, -126, -120, -122, -135, -131, -141, -132, -134, -131, -130, -131, -129, -120, -120, -128, -128, -136, -129, -126, -125, -129, -119, -123, -128, -128, -131, -122, -121, -125, -121, -108, -101, -98, -104, -116, -125, -118, -117, -114, -113, -106, -110, -108, -98, -118, -124, -123, -125, -114, -110, -110, -107, -105, -104, -111, -112, -114, -118, -110, -95, -90, -94, -87, -100, -109, -110, -105, -101, -101, -104, -105, -103, -104, -107, -114, -107, -114, -117, -115, -117, -116, -123, -120, -115, -118, -130, -129, -122, -125, -124, -125, -127, -133, -127, -130, -127, -122, -129, -133, -134, -125, -135, -142, -143, -143, -145, -141, -137, -139, -148, -148, -149, -147, -151, -146, -148, -151, -143, -136, -120, -120, -128, -140, -138, -145, -150, -144, -142, -138, -138, -138, -136, -143, -148, -153, -147, -149, -147, -145, -143, -137, -143, -143, -142, -136, -141, -135, -140, -141, -133, -134, -136, -136, -130, -137, -139, -135, -130, -133, -132, -129, -141, -147, -141, -139, -136, -134, -123, -125, -131, -129, -126, -127, -132, -130, -128, -115, -113, -105, -105, -112, -117, -118, -123, -125, -113, -113, -116, -118, -106, -112, -111, -120, -121, -119, -117, -115, -119, -110, -118, -109, -109, -115, -115, -114, -110, -112, -114, -106, -113, -114, -117, -119, -109, -115, -120, -115, -115, -120, -128, -128, -124, -119, -116, -119, -115, -117, -119, -120, -121, -122, -118, -117, -116, -110, -116, -117, -113, -103, -110, -109, -106, -116, -118, -121, -120, -112, -116, -121, -118, -113, -122, -129, -130, -131, -131, -133, -136, -135, -128, -131, -135, -136, -138, -137, -137, -133, -135, -142, -136, -141, -144, -143, -140, -142, -145, -141, -145, -147, -157, -158, -156, -154, -149, -144, -140, -144, -141, -146, -148, -144, -140, -138, -150, -148, -141, -133, -129, -132, -130, -129, -138, -138, -138, -138, -131, -135, -130, -130, -125, -127, -137, -130, -133, -139, -134, -134, -133, -130, -129, -133, -138, -125, -124, -130, -125, -124, -128, -132, -134, -133, -128, -129, -124, -120, -115, -117, -134, -141, -141, -140, -135, -129, -122, -121, -123, -125, -120, -122, -125, -124, -113, -116, -119, -115, -101, -94, -100, -100, -109, -106, -118, -120, -111, -109, -111, -106, -100, -109, -110, -120, -122, -113, -116, -125, -120, -115, -116, -118, -113, -114, -120, -118, -116, -116, -109, -110, -114, -111, -115, -118, -120, -111, -110, -113, -113, -120, -121, -126, -130, -133, -132, -132, -130, -124, -125, -128, -130, -130, -126, -118, -122, -127, -121, -113, -111, -122, -115, -105, -114, -117, -118, -127, -132, -126, -126, -129, -131, -140, -138, -134, -135, -135, -136, -137, -142, -140, -142, -144, -139, -132, -119, -126, -132, -139, -132, -134, -142, -144, -140, -129, -141, -142, -138, -135, -145, -154, -151, -151, -149, -155, -155, -143, -147, -156, -149, -140, -150, -150, -135, -141, -149, -131, -120, -126, -124, -129, -131, -133, -135, -137, -139, -129, -131, -137, -134, -127, -129, -137, -136, -135, -131, -135, -133, -126, -126, -136, -134, -125, -128, -129, -122, -115, -124, -126, -128, -127, -128, -127, -125, -124, -119, -122, -117, -125, -142, -146, -132, -124, -130, -127, -122, -123, -127, -120, -123, -121, -118, -118, -117, -121, -118, -106, -100, -101, -110, -105, -99, -112, -114, -107, -109, -111, -99, -104, -109, -109, -113, -115, -117, -112, -110, -105, -115, -117, -118, -122, -118, -119, -112, -117, -118, -112, -106, -106, -116, -118, -121, -121, -126, -116, -111, -118, -127, -133, -134, -134, -126, -134, -135, -124, -122, -127, -126, -124, -133, -128, -122, -130, -135, -120, -117, -113, -113, -116, -123, -133, -125, -126, -131, -130, -131, -129, -123, -121, -131, -142, -145, -138, -134, -144, -154, -159, -148, -144, -147, -144, -141, -132, -131, -124, -138, -135, -141, -141, -138, -139, -136, -136, -131, -138, -141, -147, -142, -148, -143, -145, -145, -139, -139, -140, -138, -135, -142, -141, -138, -133, -139, -129, -121, -116, -123, -130, -124, -131, -137, -132, -126, -125, -130, -133, -126, -128, -134, -135, -135, -134, -129, -130, -128, -125, -127, -133, -135, -136, -132, -127, -121, -122, -123, -127, -130, -131, -126, -120, -123, -116, -121, -126, -127, -122, -123, -127, -135, -133, -117, -123, -129, -119, -113, -121, -127, -119, -118, -127, -122, -120, -122, -116, -114, -103, -98, -101, -101, -109, -110, -118, -122, -113, -107, -107, -109, -112, -106, -117, -119, -120, -124, -119, -112, -110, -122, -119, -117, -126, -119, -115, -117, -119, -125, -122, -122, -126, -120, -126, -125, -114, -118, -119, -115, -127, -135, -139, -130, -131, -128, -126, -127, -126, -129, -126, -127, -130, -128, -126, -134, -138, -136, -124, -125, -122, -116, -118, -127, -129, -135, -133, -126, -132, -132, -126, -119, -127, -133, -132, -138, -148, -139, -144, -142, -132, -137, -135, -137, -144, -151, -141, -141, -140, -138, -133, -131, -142, -142, -145, -140, -140, -141, -135, -146, -152, -158, -157, -146, -140, -139, -140, -140, -144, -146, -146, -137, -133, -137, -132, -126, -128, -131, -126, -123, -126, -122, -119, -129, -128, -120, -119, -113, -107, -114, -123, -117, -120, -125, -121, -126, -132, -124, -126, -127, -120, -125, -127, -122, -119, -122, -123, -127, -124, -120, -120, -124, -121, -114, -123, -127, -118, -118, -119, -121, -131, -136, -135, -133, -121, -115, -120, -115, -121, -116, -125, -131, -124, -124, -115, -128, -122, -110, -106, -109, -109, -109, -108, -112, -116, -115, -117, -118, -118, -113, -109, -113, -128, -118, -123, -120, -115, -121, -137, -138, -127, -126, -126, -123, -110, -110, -116, -121, -118, -124, -132, -133, -126, -115, -120, -125, -122, -121, -132, -141, -145, -144, -141, -135, -132, -134, -130, -137, -137, -134, -132, -126, -137, -126, -128, -130, -122, -118, -118, -120, -121, -122, -128, -135, -137, -131, -128, -129, -130, -126, -126, -136, -137, -140, -140, -143, -139, -138, -137, -140, -138, -131, -130, -134, -132, -139, -140, -133, -140, -139, -140, -137, -140, -133, -136, -136, -133, -135, -143, -154, -144, -142, -137, -139, -137, -133, -140, -140, -134, -138, -136, -131, -131, -137, -127, -115, -111, -114, -112, -110, -122, -127, -129, -125, -121, -124, -120, -117, -125, -120, -115, -121, -129, -131, -119, -120, -128, -132, -133, -132, -127, -119, -120, -119, -127, -128, -116, -107, -111, -117, -106, -112, -112, -121, -117, -111, -118, -121, -127, -125, -129, -125, -120, -117, -117, -125, -120, -122, -128, -120, -121, -120, -122, -118, -112, -107, -108, -101, -108, -118, -119, -113, -115, -114, -110, -113, -106, -110, -115, -127, -132, -122, -124, -124, -126, -127, -126, -124, -134, -137, -126, -123, -129, -129, -122, -126, -126, -131, -132, -123, -118, -127, -140, -128, -122, -132, -142, -146, -144, -131, -135, -140, -132, -132, -142, -142, -140, -138, -138, -144, -142, -132, -134, -133, -120, -118, -125, -135, -130, -128, -134, -132, -122, -124, -135, -134, -128, -131, -134, -134, -142, -140, -140, -136, -133, -138, -136, -137, -136, -137, -142, -130, -133, -136, -132, -134, -130, -136, -136, -132, -130, -129, -129, -127, -122, -134, -144, -150, -134, -129, -133, -127, -126, -120, -127, -131, -135, -133, -130, -125, -118, -122, -121, -123, -115, -108, -114, -116, -117, -117, -124, -123, -122, -120, -117, -125, -117, -118, -116, -122, -128, -127, -125, -122, -126, -120, -124, -121, -124, -128, -127, -124, -118, -119, -117, -122, -126, -127, -122, -122, -126, -124, -114, -120, -129, -138, -138, -132, -132, -128, -120, -114, -121, -129, -125, -120, -124, -121, -123, -118, -113, -122, -124, -113, -113, -108, -110, -116, -117, -118, -118, -122, -119, -117, -122, -126, -118, -115, -119, -129, -134, -133, -128, -122, -123, -128, -132, -128, -120, -128, -134, -129, -132, -122, -124, -128, -130, -126, -126, -135, -132, -129, -130, -133, -143, -149, -138, -136, -139, -139, -132, -132, -140, -141, -134, -134, -144, -136, -130, -127, -128, -128, -121, -115, -124, -128, -130, -131, -129, -133, -133, -131, -123, -122, -124, -128, -129, -136, -139, -134, -133, -138, -141, -135, -128, -133, -129, -131, -136, -139, -138, -129, -134, -138, -131, -130, -133, -129, -132, -131, -130, -131, -137, -138, -147, -144, -132, -140, -129, -126, -135, -136, -129, -134, -135, -130, -135, -126, -128, -127, -118, -116, -111, -114, -113, -118, -115, -123, -125, -119, -127, -123, -120, -127, -127, -122, -128, -129, -128, -126, -129, -122, -114, -123, -126, -128, -123, -116, -125, -128, -122, -116, -117, -125, -126, -121, -121, -125, -123, -120, -122, -125, -126, -131, -137, -140, -134, -128, -124, -123, -127, -132, -126, -121, -123, -128, -123, -121, -122, -121, -114, -104, -104, -103, -109, -113, -123, -126, -112, -117, -125, -122, -124, -122, -130, -131, -125, -129, -125, -123, -128, -134, -119, -112, -114, -112, -113, -126, -127, -120, -130, -127, -120, -123, -132, -123, -122, -125, -132, -129, -127, -137, -142, -148, -145, -145, -134, -129, -133, -133, -138, -139, -137, -136, -131, -128, -131, -130, -122, -115, -116, -126, -129, -124, -131, -132, -134, -136, -124, -124, -133, -128, -123, -131, -139, -142, -133, -131, -138, -141, -136, -136, -138, -128, -124, -131, -137, -138, -130, -129, -130, -134, -137, -126, -130, -132, -131, -135, -136, -142, -141, -149, -147, -144, -138, -134, -130, -131, -143, -135, -136, -133, -136, -139, -127, -119, -126, -130, -124, -111, -109, -116, -113, -117, -115, -120, -112, -114, -113, -117, -118, -112, -112, -120, -129, -123, -122, -123, -124, -119, -125, -124, -127, -125, -127, -122, -119, -120, -119, -116, -121, -123, -125, -124, -115, -118, -113, -114, -121, -132, -133, -133, -133, -130, -123, -118, -126, -127, -120, -125, -128, -124, -127, -121, -126, -128, -114, -107, -104, -107, -113, -114, -118, -124, -123, -118, -113, -118, -119, -117, -119, -121, -121, -125, -131, -129, -121, -130, -128, -126, -132, -130, -134, -134, -131, -123, -128, -128, -131, -128, -130, -129, -132, -133, -129, -132, -138, -144, -138, -140, -135, -135, -136, -138, -138, -129, -135, -135, -137, -139, -133, -132, -126, -125, -132, -120, -110, -112, -120, -125, -118, -126, -133, -128, -125, -126, -127, -124, -123, -134, -138, -137, -138, -142, -137, -136, -134, -136, -136, -125, -129, -133, -137, -135, -136, -130, -130, -133, -134, -137, -137, -136, -132, -134, -137, -133, -128, -135, -147, -149, -149, -149, -145, -141, -127, -129, -133, -131, -136, -135, -136, -127, -127, -126, -122, -120, -123, -128, -122, -118, -116, -112, -110, -118, -125, -123, -124, -119, -127, -125, -119, -126, -127, -126, -122, -129, -124, -126, -132, -128, -127, -124, -120, -124, -124, -116, -121, -124, -121, -120, -122, -129, -123, -120, -131, -120, -123, -133, -136, -133, -128, -131, -123, -119, -121, -126, -125, -125, -125, -127, -126, -123, -119, -113, -121, -121, -110, -109, -107, -103, -109, -109, -120, -120, -117, -116, -117, -118, -114, -115, -116, -119, -121, -127, -127, -124, -126, -122, -125, -128, -127, -125, -131, -129, -131, -127, -122, -131, -129, -130, -135, -133, -130, -125, -123, -132, -136, -142, -141, -133, -134, -133, -127, -131, -135, -132, -135, -135, -137, -131, -127, -123, -123, -129, -132, -129, -127, -126, -125, -133, -128, -122, -121, -118, -121, -123, -127, -129, -133, -133, -131, -132, -134, -131, -126, -126, -131, -134, -133, -136, -134, -129, -131, -131, -135, -134, -131, -133, -132, -138, -141, -136, -136, -129, -132, -142, -148, -152, -146, -141, -137, -132, -132, -140, -137, -138, -133, -135, -140, -135, -134, -126, -125, -134, -124, -111, -109, -110, -126, -123, -122, -124, -126, -118, -124, -125, -117, -123, -125, -126, -128, -136, -136, -136, -130, -123, -133, -130, -115, -114, -112, -112, -117, -125, -125, -128, -130, -123, -122, -122, -118, -123, -118, -115, -127, -136, -138, -135, -136, -126, -127, -122, -120, -125, -128, -129, -125, -127, -116, -116, -113, -117, -119, -116, -112, -103, -102, -106, -109, -115, -118, -119, -122, -119, -119, -124, -117, -119, -123, -123, -129, -131, -129, -127, -128, -128, -129, -127, -125, -121, -123, -128, -127, -132, -125, -124, -129, -126, -130, -133, -131, -122, -126, -139, -145, -140, -140, -138, -136, -134, -133, -136, -136, -133, -137, -140, -133, -130, -128, -126, -128, -128, -126, -126, -121, -116, -115, -116, -116, -124, -122, -126, -131, -126, -129, -126, -125, -123, -118, -126, -135, -144, -150, -141, -134, -136, -128, -130, -129, -124, -130, -131, -128, -118, -123, -123, -124, -128, -131, -134, -130, -122, -122, -133, -136, -143, -144, -139, -135, -132, -132, -131, -133, -133, -135, -138, -139, -134, -130, -130, -132, -127, -120, -118, -115, -115, -119, -128, -125, -120, -121, -125, -125, -122, -128, -127, -122, -133, -137, -136, -130, -131, -138, -134, -129, -132, -131, -126, -126, -128, -131, -130, -127, -128, -125, -123, -126, -126, -122, -122, -123, -131, -139, -141, -136, -128, -128, -127, -124, -129, -129, -132, -129, -131, -133, -129, -124, -118, -122, -123, -125, -117, -107, -106, -106, -112, -115, -118, -122, -118, -115, -119, -123, -120, -112, -115, -123, -125, -123, -128, -120, -117, -124, -128, -126, -119, -123, -122, -130, -130, -126, -122, -125, -123, -127, -128, -126, -131, -128, -122, -127, -137, -139, -134, -129, -131, -131, -135, -133, -129, -126, -124, -128, -129, -128, -125, -121, -123, -120, -120, -128, -128, -118, -108, -104, -118, -121, -117, -121, -123, -130, -128, -121, -121, -125, -127, -127, -131, -135, -133, -135, -132, -133, -137, -139, -137, -127, -120, -125, -134, -136, -137, -136, -138, -136, -139, -142, -136, -122, -125, -141, -148, -149, -144, -147, -142, -137, -136, -132, -133, -130, -139, -140, -135, -137, -129, -125, -127, -129, -129, -124, -117, -114, -115, -114, -125, -127, -127, -129, -128, -129, -129, -124, -120, -125, -128, -135, -135, -134, -135, -128, -128, -131, -125, -126, -127, -129, -131, -126, -127, -127, -124, -126, -131, -130, -128, -127, -125, -124, -135, -145, -142, -138, -133, -132, -129, -124, -125, -131, -131, -129, -126, -128, -129, -120, -116, -113, -119, -119, -120, -119, -110, -112, -108, -108, -109, -108, -109, -111, -122, -120, -122, -123, -119, -118, -117, -120, -124, -128, -127, -124, -125, -121, -125, -127, -129, -131, -128, -122, -121, -126, -126, -129, -127, -130, -129, -125, -123, -126, -135, -143, -139, -134, -128, -129, -134, -130, -130, -131, -128, -131, -137, -133, -127, -125, -122, -122, -127, -126, -121, -114, -112, -111, -117, -122, -121, -124, -125, -128, -123, -125, -124, -119, -125, -129, -130, -130, -130, -131, -129, -131, -137, -135, -126, -124, -124, -124, -127, -128, -130, -130, -133, -137, -133, -131, -129, -122, -127, -135, -147, -150, -143, -144, -140, -140, -135, -136, -130, -131, -136, -138, -134, -135, -132, -124, -126, -127, -126, -122, -114, -112, -115, -115, -122, -132, -137, -138, -140, -132, -125, -125, -117, -123, -130, -134, -139, -133, -121, -119, -123, -120, -120, -122, -128, -124, -123, -124, -123, -125, -124, -120, -121, -127, -130, -131, -120, -120, -132, -143, -145, -142, -138, -131, -134, -131, -127, -126, -128, -133, -136, -134, -130, -119, -117, -120, -121, -123, -124, -119, -107, -106, -112, -118, -121, -123, -121, -124, -129, -126, -119, -115, -116, -121, -129, -132, -131, -130, -125, -122, -124, -129, -135, -135, -133, -121, -116, -117, -118, -119, -124, -128, -129, -132, -133, -129, -125, -128, -134, -140, -140, -136, -134, -133, -135, -131, -129, -132, -130, -131, -130, -129, -125, -123, -120, -121, -123, -121, -116, -109, -109, -109, -111, -114, -117, -114, -119, -121, -121, -121, -122, -123, -126, -127, -132, -136, -129, -126, -127, -129, -129, -134, -131, -130, -128, -132, -132, -128, -129, -132, -132, -132, -134, -130, -126, -124, -131, -139, -142, -143, -142, -139, -133, -131, -134, -130, -133, -137, -136, -133, -127, -132, -132, -129, -124, -117, -111, -118, -121, -124, -128, -128, -126, -124, -124, -125, -126, -123, -129, -133, -130, -131, -128, -124, -128, -133, -127, -128, -132, -135, -136, -126, -131, -132, -127, -129, -125, -126, -126, -130, -130, -131, -129, -138, -140, -137, -138, -136, -132, -128, -126, -130, -135, -134, -129, -128, -126, -123, -122, -123, -125, -125, -127, -122, -113, -108, -110, -112, -115, -120, -121, -121, -124, -121, -121, -120, -119, -119, -120, -122, -127, -127, -125, -127, -124, -127, -120, -119, -127, -127, -125, -124, -123, -121, -125, -127, -130, -132, -136, -127, -123, -127, -128, -128, -124, -130, -143, -145, -138, -137, -140, -134, -129, -129, -128, -127, -132, -130, -130, -129, -124, -124, -120, -121, -123, -124, -119, -117, -116, -114, -114, -119, -122, -124, -125, -127, -127, -126, -125, -127, -130, -127, -132, -130, -130, -135, -131, -132, -129, -129, -131, -127, -126, -129, -125, -125, -127, -128, -128, -130, -133, -134, -130, -128, -135, -145, -144, -145, -138, -129, -126, -130, -129, -136, -139, -139, -136, -132, -132, -125, -124, -123, -125, -131, -127, -115, -108, -110, -117, -119, -116, -121, -124, -126, -129, -125, -123, -123, -122, -121, -125, -136, -135, -130, -130, -132, -136, -134, -134, -127, -125, -127, -130, -129, -131, -133, -129, -126, -127, -130, -128, -123, -126, -133, -135, -140, -139, -138, -137, -131, -132, -130, -126, -126, -129, -127, -124, -124, -121, -123, -118, -120, -122, -120, -118, -117, -125, -118, -106, -104, -105, -111, -114, -116, -120, -121, -121, -120, -117, -118, -114, -118, -125, -122, -126, -123, -124, -125, -120, -122, -125, -126, -122, -124, -125, -125, -124, -127, -130, -125, -123, -123, -132, -141, -139, -138, -139, -134, -133, -129, -125, -131, -132, -133, -132, -135, -135, -130, -125, -123, -129, -129, -120, -107, -111, -115, -120, -127, -130, -125, -122, -128, -124, -124, -123, -123, -127, -131, -133, -132, -131, -127, -128, -137, -140, -134, -129, -120, -119, -125, -125, -126, -129, -138, -140, -134, -135, -135, -133, -126, -124, -133, -144, -146, -140, -142, -140, -135, -131, -129, -132, -131, -136, -139, -136, -134, -127, -121, -123, -126, -126, -127, -119, -114, -115, -117, -122, -120, -120, -123, -124, -126, -128, -128, -129, -132, -127, -128, -132, -132, -130, -128, -128, -130, -133, -134, -131, -133, -128, -126, -123, -126, -126, -128, -132, -133, -132, -125, -124, -121, -125, -134, -142, -141, -140, -138, -134, -129, -128, -131, -127, -129, -129, -136, -132, -124, -121, -120, -116, -116, -124, -125, -118, -109, -106, -108, -108, -112, -119, -124, -124, -122, -127, -125, -118, -115, -120, -130, -138, -144, -143, -136, -130, -124, -120, -124, -127, -120, -118, -117, -115, -120, -121, -118, -123, -127, -126, -124, -117, -115, -119, -130, -138, -142, -139, -137, -132, -128, -130, -129, -128, -130, -131, -132, -133, -128, -124, -121, -125, -127, -123, -117, -111, -110, -111, -115, -120, -125, -125, -122, -126, -128, -125, -123, -124, -129, -136, -139, -138, -139, -134, -131, -130, -129, -129, -129, -130, -131, -134, -132, -132, -127, -126, -130, -131, -130, -126, -127, -137, -141, -145, -138, -131, -132, -134, -135, -133, -136, -138, -137, -136, -135, -129, -128, -131, -130, -129, -129, -131, -123, -114, -113, -115, -115, -120, -124, -129, -129, -122, -120, -121, -125, -123, -118, -123, -130, -130, -128, -126, -121, -126, -127, -122, -125, -131, -133, -134, -131, -126, -125, -125, -125, -126, -130, -132, -129, -123, -125, -132, -135, -136, -134, -132, -129, -129, -127, -128, -127, -127, -126, -125, -127, -125, -121, -121, -121, -123, -126, -128, -120, -110, -103, -104, -111, -116, -122, -124, -123, -121, -122, -122, -120, -122, -121, -125, -130, -126, -127, -128, -130, -129, -127, -126, -129, -125, -126, -130, -129, -131, -130, -129, -132, -135, -129, -123, -125, -133, -138, -137, -139, -138, -133, -131, -130, -134, -133, -131, -135, -135, -134, -128, -126, -122, -120, -119, -125, -131, -120, -109, -105, -109, -116, -120, -119, -123, -126, -128, -127, -127, -123, -121, -120, -125, -131, -135, -134, -133, -133, -131, -132, -131, -131, -130, -130, -129, -132, -132, -130, -129, -126, -130, -129, -130, -132, -129, -130, -139, -145, -146, -143, -142, -139, -135, -135, -133, -131, -132, -133, -133, -136, -135, -127, -120, -122, -126, -127, -124, -119, -119, -119, -121, -115, -105, -102, -108, -114, -121, -123, -125, -123, -122, -122, -123, -122, -119, -125, -127, -130, -130, -132, -129, -126, -127, -127, -128, -128, -128, -128, -129, -127, -128, -128, -129, -124, -126, -134, -141, -141, -137, -132, -130, -131, -128, -130, -136, -137, -136, -132, -132, -130, -128, -125, -124, -123, -126, -129, -127, -121, -114, -108, -110, -117, -117, -120, -121, -124, -122, -122, -124, -126, -120, -117, -123, -127, -125, -127, -132, -133, -130, -122, -118, -120, -121, -122, -129, -130, -128, -130, -128, -128, -127, -127, -125, -123, -127, -137, -142, -139, -134, -134, -132, -129, -129, -130, -131, -133, -133, -134, -133, -126, -123, -124, -126, -127, -129, -124, -120, -123, -119, -120, -123, -124, -123, -122, -127, -126, -122, -119, -115, -118, -117, -118, -120, -125, -124, -123, -125, -127, -124, -120, -120, -124, -126, -128, -127, -128, -127, -129, -130, -128, -132, -130, -127, -132, -140, -145, -145, -140, -137, -136, -130, -129, -129, -130, -135, -135, -136, -134, -131, -130, -128, -127, -125, -126, -130, -131, -122, -118, -119, -119, -121, -122, -126, -127, -133, -129, -126, -123, -123, -124, -131, -137, -135, -130, -130, -133, -135, -141, -138, -129, -119, -117, -123, -124, -123, -125, -126, -130, -133, -134, -128, -120, -125, -134, -142, -139, -136, -135, -134, -132, -133, -133, -128, -127, -130, -130, -132, -128, -125, -122, -121, -120, -124, -125, -115, -107, -105, -106, -109, -111, -112, -115, -119, -121, -125, -123, -124, -124, -123, -126, -129, -131, -129, -129, -130, -131, -134, -129, -123, -123, -125, -126, -126, -125, -125, -124, -125, -128, -127, -125, -123, -130, -134, -137, -135, -134, -135, -129, -130, -131, -133, -132, -131, -133, -132, -130, -127, -125, -123, -123, -125, -122, -117, -116, -115, -115, -116, -116, -116, -123, -124, -126, -128, -129, -125, -124, -124, -128, -131, -132, -134, -134, -135, -136, -135, -136, -142, -141, -129, -123, -125, -128, -130, -129, -132, -137, -135, -130, -130, -136, -141, -137, -133, -133, -133, -132, -131, -130, -131, -133, -132, -128, -129, -130, -125, -125, -125, -125, -128, -128, -126, -117, -114, -112, -111, -111, -117, -123, -122, -125, -127, -127, -121, -118, -121, -122, -126, -128, -129, -129, -126, -127, -129, -134, -133, -124, -121, -122, -127, -129, -130, -132, -131, -129, -130, -131, -127, -127, -122, -124, -133, -142, -145, -140, -137, -132, -129, -128, -127, -128, -130, -133, -133, -133, -125, -119, -121, -119, -120, -122, -124, -127, -121, -113, -109, -108, -109, -114, -120, -127, -128, -130, -129, -121, -119, -121, -126, -130, -133, -134, -134, -130, -126, -126, -127, -125, -126, -127, -127, -130, -129, -129, -125, -124, -125, -127, -127, -122, -124, -133, -142, -141, -134, -133, -132, -130, -130, -130, -132, -132, -133, -134, -134, -130, -126, -122, -121, -122, -125, -125, -121, -122, -120, -115, -108, -105, -107, -112, -118, -123, -125, -126, -124, -120, -121, -122, -123, -124, -130, -133, -132, -131, -131, -133, -130, -127, -128, -129, -133, -133, -132, -132, -131, -130, -129, -132, -131, -128, -132, -138, -142, -144, -139, -134, -133, -131, -134, -131, -130, -131, -133, -135, -133, -129, -126, -121, -123, -124, -124, -123, -122, -123, -125, -121, -110, -106, -108, -116, -119, -125, -127, -125, -121, -122, -124, -123, -121, -123, -126, -127, -132, -131, -126, -125, -123, -123, -125, -129, -131, -130, -129, -127, -129, -130, -128, -125, -129, -134, -142, -144, -140, -136, -133, -131, -130, -132, -130, -131, -132, -133, -136, -137, -132, -126, -122, -122, -127, -127, -118, -112, -114, -117, -120, -125, -124, -122, -120, -120, -123, -124, -123, -123, -121, -125, -128, -131, -131, -133, -136, -133, -125, -117, -112, -113, -122, -128, -135, -136, -131, -130, -129, -127, -124, -125, -122, -124, -132, -143, -145, -139, -137, -132, -128, -126, -128, -131, -131, -130, -132, -132, -130, -129, -126, -122, -123, -126, -126, -123, -115, -110, -112, -115, -117, -120, -122, -125, -126, -126, -128, -126, -126, -125, -127, -130, -131, -134, -133, -131, -131, -131, -131, -127, -127, -126, -126, -127, -127, -125, -126, -130, -130, -125, -126, -128, -123, -123, -132, -142, -144, -141, -137, -134, -132, -129, -131, -134, -136, -135, -136, -136, -131, -123, -120, -119, -126, -131, -125, -113, -108, -110, -114, -118, -119, -124, -125, -125, -124, -122, -119, -115, -120, -133, -144, -148, -141, -135, -131, -126, -123, -129, -130, -125, -120, -121, -121, -121, -118, -122, -125, -127, -125, -126, -124, -117, -118, -128, -136, -139, -142, -140, -135, -130, -128, -128, -125, -127, -131, -135, -138, -134, -128, -121, -118, -122, -126, -124, -115, -109, -112, -114, -115, -120, -122, -123, -123, -128, -129, -128, -126, -128, -131, -135, -137, -135, -132, -133, -132, -131, -130, -129, -130, -132, -134, -134, -131, -126, -124, -125, -128, -130, -125, -127, -136, -142, -141, -137, -132, -131, -129, -127, -131, -133, -133, -133, -132, -132, -130, -128, -125, -124, -122, -124, -126, -128, -121, -112, -108, -110, -112, -113, -118, -123, -122, -122, -119, -120, -118, -119, -121, -123, -125, -125, -126, -126, -127, -126, -125, -125, -125, -126, -128, -131, -129, -130, -133, -133, -129, -129, -131, -131, -126, -126, -130, -138, -139, -137, -136, -133, -129, -126, -129, -130, -131, -129, -130, -127, -125, -122, -120, -119, -120, -127, -130, -121, -110, -106, -109, -115, -118, -121, -124, -124, -125, -124, -121, -120, -121, -123, -127, -131, -133, -131, -128, -128, -127, -127, -127, -131, -132, -132, -133, -131, -130, -128, -128, -131, -135, -133, -125, -126, -133, -142, -142, -139, -140, -136, -135, -132, -134, -133, -131, -134, -136, -136, -138, -131, -124, -121, -120, -123, -124, -125, -119, -110, -110, -110, -112, -116, -122, -125, -126, -124, -123, -122, -120, -119, -123, -127, -132, -134, -133, -130, -128, -125, -125, -128, -129, -129, -133, -134, -130, -128, -125, -125, -127, -129, -128, -129, -125, -125, -135, -144, -146, -142, -138, -137, -133, -131, -130, -129, -129, -132, -135, -138, -136, -129, -125, -122, -121, -121, -123, -123, -121, -123, -123, -118, -112, -107, -106, -108, -114, -117, -124, -128, -127, -126, -126, -126, -122, -122, -125, -129, -132, -132, -132, -130, -126, -127, -129, -130, -129, -133, -130, -129, -127, -129, -127, -125, -127, -136, -142, -142, -138, -135, -132, -129, -128, -130, -131, -134, -136, -135, -133, -132, -129, -125, -126, -127, -126, -126, -127, -122, -113, -112, -113, -116, -118, -120, -122, -121, -120, -121, -121, -124, -122, -122, -124, -126, -127, -125, -123, -123, -126, -127, -130, -129, -127, -125, -126, -127, -128, -128, -132, -134, -134, -130, -126, -126, -133, -138, -141, -140, -138, -133, -129, -128, -131, -129, -132, -136, -136, -135, -129, -124, -120, -120, -123, -124, -125, -124, -123, -121, -122, -120, -121, -121, -119, -121, -121, -122, -123, -125, -123, -118, -114, -116, -117, -120, -122, -124, -125, -126, -124, -125, -123, -123, -123, -124, -124, -127, -127, -127, -126, -127, -130, -128, -126, -127, -136, -145, -146, -143, -137, -134, -130, -129, -130, -132, -134, -135, -136, -137, -134, -129, -126, -127, -129, -130, -131, -132, -127, -118, -116, -116, -118, -121, -123, -126, -128, -132, -129, -126, -123, -123, -126, -129, -131, -131, -132, -130, -130, -131, -129, -127, -125, -124, -126, -128, -130, -130, -130, -132, -132, -129, -127, -128, -136, -141, -142, -140, -138, -135, -132, -131, -131, -131, -130, -134, -137, -136, -130, -126, -124, -123, -122, -121, -119, -123, -124, -118, -109, -104, -106, -109, -112, -116, -121, -125, -125, -124, -122, -121, -120, -123, -124, -128, -129, -127, -126, -125, -127, -128, -125, -123, -124, -126, -126, -127, -126, -124, -125, -126, -122, -121, -127, -136, -137, -134, -133, -131, -128, -126, -129, -130, -129, -129, -131, -132, -129, -128, -126, -123, -121, -123, -122, -122, -123, -122, -121, -123, -126, -124, -116, -111, -112, -115, -118, -122, -128, -129, -127, -126, -126, -126, -125, -126, -128, -129, -129, -128, -128, -129, -130, -130, -131, -130, -132, -135, -135, -132, -133, -138, -143, -143, -142, -139, -136, -132, -132, -132, -131, -133, -133, -135, -137, -137, -134, -131, -130, -128, -128, -129, -128, -127, -127, -126, -126, -122, -120, -121, -123, -128, -125, -122, -112, -113, -117, -122, -126, -125, -126, -126, -126, -124, -124, -121, -121, -123, -127, -131, -132, -129, -129, -130, -131, -134, -130, -129, -130, -130, -131, -130, -132, -131, -133, -136, -134, -131, -132, -133, -134, -136, -135, -133, -132, -128, -128, -125, -126, -126, -127, -127, -125, -125, -125, -121, -120, -120, -120, -123, -124, -124, -122, -120, -125, -125, -120, -112, -110, -111, -116, -121, -125, -127, -124, -122, -122, -121, -117, -117, -119, -123, -124, -127, -127, -122, -123, -124, -124, -124, -127, -126, -127, -131, -132, -132, -131, -132, -132, -133, -135, -133, -132, -131, -131, -134, -138, -138, -138, -135, -134, -130, -129, -130, -125, -125, -128, -126, -125, -123, -121, -120, -123, -124, -119, -122, -126, -127, -117, -110, -110, -113, -118, -121, -125, -126, -126, -124, -124, -123, -122, -124, -129, -131, -134, -132, -131, -130, -129, -129, -130, -133, -132, -133, -132, -133, -133, -133, -132, -130, -129, -133, -138, -141, -140, -135, -134, -134, -134, -131, -130, -132, -132, -130, -132, -131, -131, -130, -128, -128, -128, -127, -125, -124, -125, -126, -125, -123, -123, -127, -121, -112, -110, -113, -115, -117, -121, -124, -119, -121, -120, -121, -120, -119, -123, -126, -129, -130, -126, -124, -124, -126, -130, -132, -132, -131, -133, -131, -130, -132, -131, -132, -134, -136, -134, -131, -132, -131, -129, -129, -133, -137, -142, -139, -138, -135, -134, -129, -128, -129, -127, -128, -129, -131, -129, -127, -126, -125, -126, -124, -120, -123, -125, -123, -114, -109, -111, -115, -120, -120, -122, -125, -122, -122, -122, -121, -121, -123, -128, -129, -129, -131, -127, -127, -127, -130, -128, -129, -128, -127, -128, -127, -127, -126, -128, -126, -130, -129, -129, -129, -128, -127, -127, -132, -136, -139, -139, -137, -136, -136, -134, -135, -133, -132, -131, -130, -130, -130, -125, -124, -125, -124, -122, -120, -125, -125, -120, -109, -108, -108, -110, -117, -119, -123, -122, -121, -123, -120, -121, -121, -123, -127, -127, -128, -127, -127, -127, -128, -130, -130, -131, -130, -131, -132, -131, -130, -130, -131, -131, -133, -131, -129, -131, -135, -138, -138, -139, -137, -135, -130, -130, -130, -130, -130, -130, -132, -132, -130, -127, -125, -123, -122, -122, -123, -123, -122, -121, -125, -125, -117, -109, -108, -112, -117, -121, -122, -124, -123, -124, -127, -125, -124, -125, -127, -127, -127, -127, -126, -123, -124, -127, -129, -129, -129, -130, -128, -129, -130, -129, -128, -130, -131, -130, -130, -130, -134, -135, -138, -139, -136, -135, -132, -133, -132, -134, -135, -134, -134, -133, -131, -128, -125, -125, -126, -126, -127, -127, -127, -122, -120, -124, -119, -113, -108, -109, -114, -119, -122, -123, -123, -123, -122, -122, -120, -120, -122, -125, -126, -127, -128, -129, -127, -129, -130, -130, -131, -129, -129, -130, -132, -132, -131, -134, -137, -137, -134, -134, -132, -134, -133, -132, -130, -127, -129, -132, -134, -133, -132, -129, -128, -130, -127, -127, -125, -124, -124, -124, -125, -124, -124, -120, -124, -128, -124, -117, -112, -113, -117, -119, -124, -125, -124, -124, -123, -125, -124, -121, -124, -124, -126, -126, -126, -126, -126, -126, -126, -128, -129, -129, -129, -128, -131, -130, -128, -128, -130, -130, -132, -133, -134, -139, -143, -145, -143, -139, -135, -133, -132, -131, -132, -132, -134, -132, -132, -131, -128, -127, -125, -124, -125, -123, -126, -124, -124, -122, -120, -123, -124, -120, -112, -108, -111, -114, -119, -120, -123, -123, -122, -124, -123, -123, -124, -123, -124, -127, -127, -125, -124, -124, -127, -128, -130, -129, -130, -129, -130, -129, -130, -131, -130, -132, -131, -131, -130, -133, -135, -135, -136, -132, -128, -126, -128, -131, -133, -133, -135, -134, -130, -124, -123, -124, -126, -127, -128, -131, -131, -129, -125, -125, -122, -124, -127, -123, -113, -111, -115, -117, -118, -121, -121, -121, -121, -122, -122, -123, -121, -121, -123, -128, -127, -126, -126, -126, -130, -132, -132, -131, -129, -131, -132, -135, -136, -138, -139, -138, -135, -132, -130, -128, -128, -130, -135, -137, -138, -135, -131, -129, -130, -130, -128, -130, -135, -130, -122, -113, -117, -128, -134, -134, -133, -128, -125, -122, -119, -118, -119, -123, -128, -126, -118, -115, -113, -112, -116, -120, -125, -127, -129, -130, -128, -124, -123, -123, -128, -131, -131, -132, -128, -128, -130, -131, -129, -132, -132, -132, -133, -132, -130, -130, -130, -134, -134, -131, -129, -125, -124, -128, -134, -137, -139, -138, -134, -131, -129, -131, -134, -133, -137, -137, -127, -114, -114, -125, -132, -133, -133, -132, -128, -123, -121, -117, -115, -114, -120, -127, -122, -114, -108, -107, -110, -115, -118, -121, -121, -123, -125, -125, -124, -121, -121, -121, -124, -125, -124, -125, -126, -127, -128, -130, -131, -129, -129, -129, -131, -131, -133, -132, -134, -135, -131, -129, -128, -126, -128, -129, -132, -132, -129, -127, -126, -130, -131, -136, -139, -134, -121, -110, -116, -127, -134, -136, -135, -135, -130, -127, -122, -120, -116, -117, -125, -134, -130, -119, -111, -110, -111, -116, -120, -123, -125, -127, -127, -127, -121, -120, -119, -122, -127, -131, -132, -132, -131, -131, -133, -133, -131, -132, -132, -134, -137, -139, -140, -139, -136, -132, -128, -128, -127, -128, -129, -131, -135, -134, -132, -128, -125, -124, -124, -128, -132, -131, -123, -112, -112, -124, -132, -134, -134, -132, -128, -125, -121, -119, -118, -117, -123, -131, -128, -119, -109, -109, -112, -117, -122, -124, -126, -127, -131, -130, -129, -125, -124, -128, -132, -136, -132, -131, -132, -133, -135, -136, -136, -135, -133, -133, -135, -136, -133, -134, -135, -135, -133, -131, -130, -128, -129, -135, -141, -140, -129, -121, -123, -130, -136, -141, -143, -140, -128, -115, -120, -131, -136, -136, -136, -135, -133, -129, -124, -119, -117, -118, -122, -127, -130, -123, -111, -104, -105, -111, -114, -117, -121, -124, -123, -122, -122, -119, -118, -122, -125, -128, -128, -126, -123, -123, -127, -129, -129, -130, -131, -132, -133, -129, -129, -129, -129, -128, -131, -129, -127, -125, -123, -126, -128, -130, -125, -120, -123, -128, -133, -137, -137, -128, -124, -124, -124, -120, -122, -129, -134, -133, -132, -128, -122, -118, -119, -120, -120, -122, -125, -126, -118, -108, -106, -108, -113, -117, -122, -125, -127, -127, -125, -122, -121, -122, -124, -128, -130, -131, -130, -129, -128, -130, -130, -131, -132, -133, -135, -137, -137, -135, -135, -138, -137, -134, -132, -134, -137, -138, -136, -131, -129, -127, -127, -129, -130, -132, -132, -131, -130, -128, -127, -128, -123, -115, -109, -116, -129, -138, -137, -132, -128, -122, -120, -118, -118, -118, -124, -129, -126, -118, -112, -111, -114, -118, -125, -129, -130, -131, -132, -130, -127, -127, -126, -129, -132, -135, -135, -135, -134, -134, -135, -135, -136, -138, -139, -138, -137, -138, -139, -141, -140, -137, -132, -128, -125, -123, -122, -122, -124, -126, -128, -131, -133, -135, -134, -136, -137, -135, -133, -132, -133, -130, -118, -111, -116, -128, -137, -137, -131, -125, -120, -115, -115, -115, -116, -120, -126, -127, -119, -110, -106, -107, -112, -119, -126, -128, -129, -129, -126, -124, -121, -122, -127, -132, -137, -136, -133, -130, -129, -130, -131, -131, -130, -129, -131, -131, -129, -127, -129, -130, -128, -128, -127, -128, -124, -122, -122, -123, -123, -125, -127, -126, -125, -127, -130, -133, -131, -128, -126, -127, -126, -120, -111, -106, -112, -125, -135, -137, -131, -124, -118, -116, -115, -116, -117, -122, -129, -129, -120, -112, -110, -112, -117, -125, -130, -129, -126, -126, -127, -126, -126, -128, -131, -135, -139, -138, -133, -129, -129, -132, -136, -138, -139, -136, -132, -129, -128, -129, -130, -131, -132, -132, -132, -130, -126, -124, -124, -123, -124, -125, -125, -122, -123, -127, -127, -126, -125, -127, -131, -134, -128, -118, -113, -112, -115, -122, -133, -140, -138, -132, -128, -123, -120, -120, -121, -125, -134, -137, -130, -121, -117, -118, -122, -126, -131, -133, -131, -131, -131, -131, -132, -133, -133, -136, -138, -137, -135, -132, -131, -131, -133, -135, -135, -134, -132, -128, -124, -123, -126, -130, -133, -135, -136, -135, -130, -126, -125, -128, -130, -129, -128, -130, -132, -131, -129, -128, -130, -132, -131, -133, -132, -125, -113, -104, -109, -121, -133, -136, -134, -130, -123, -118, -114, -113, -114, -117, -125, -133, -132, -120, -111, -111, -114, -121, -127, -131, -131, -130, -130, -128, -125, -123, -125, -129, -131, -130, -128, -125, -123, -125, -127, -129, -128, -126, -127, -128, -126, -126, -127, -128, -131, -135, -134, -130, -125, -123, -125, -126, -122, -121, -123, -128, -130, -129, -125, -123, -125, -131, -136, -139, -134, -124, -115, -111, -115, -124, -134, -142, -143, -139, -134, -127, -119, -116, -119, -122, -125, -134, -135, -125, -112, -110, -114, -116, -120, -127, -130, -130, -129, -128, -126, -123, -124, -127, -132, -135, -133, -130, -126, -127, -131, -134, -136, -135, -134, -132, -130, -129, -127, -128, -133, -135, -133, -129, -123, -119, -118, -120, -121, -119, -121, -127, -131, -129, -123, -119, -122, -131, -140, -141, -138, -131, -125, -123, -126, -124, -117, -115, -126, -141, -146, -138, -129, -121, -118, -120, -123, -122, -123, -127, -127, -121, -116, -114, -114, -117, -123, -129, -131, -129, -127, -129, -130, -130, -128, -128, -130, -133, -134, -131, -132, -132, -132, -133, -134, -135, -133, -131, -133, -135, -136, -134, -133, -131, -129, -126, -127, -127, -127, -128, -128, -127, -124, -123, -126, -127, -127, -124, -125, -129, -134, -136, -134, -130, -124, -121, -124, -126, -125, -116, -108, -114, -128, -136, -134, -128, -126, -125, -125, -124, -121, -119, -123, -128, -126, -120, -116, -116, -116, -121, -127, -131, -129, -128, -130, -131, -131, -128, -128, -129, -132, -133, -134, -132, -133, -133, -130, -123, -121, -121, -125, -127, -130, -133, -132, -130, -129, -129, -130, -131, -131, -129, -129, -127, -121, -118, -122, -127, -130, -129, -129, -130, -129, -131, -135, -136, -135, -132, -130, -130, -131, -130, -124, -112, -107, -116, -131, -137, -135, -131, -127, -123, -120, -121, -120, -119, -121, -130, -131, -123, -111, -108, -114, -122, -127, -132, -132, -132, -132, -131, -129, -125, -123, -127, -130, -130, -128, -128, -127, -129, -128, -126, -119, -115, -116, -120, -123, -126, -129, -129, -130, -132, -132, -129, -127, -127, -126, -126, -126, -128, -130, -130, -126, -125, -125, -127, -126, -128, -130, -130, -131, -131, -130, -131, -131, -129, -122, -113, -108, -111, -121, -131, -139, -140, -136, -130, -125, -122, -121, -120, -122, -131, -137, -134, -124, -117, -116, -119, -124, -129, -130, -130, -129, -131, -129, -126, -123, -123, -125, -129, -133, -134, -134, -131, -128, -124, -121, -120, -123, -126, -129, -130, -132, -133, -132, -132, -132, -133, -133, -133, -132, -130, -129, -127, -127, -130, -130, -130, -130, -128, -129, -131, -133, -131, -130, -133, -134, -132, -132, -132, -125, -116, -109, -111, -121, -130, -136, -137, -131, -125, -121, -120, -121, -124, -124, -127, -134, -134, -124, -114, -110, -113, -119, -126, -130, -131, -127, -127, -127, -126, -126, -125, -126, -128, -129, -127, -127, -128, -129, -131, -128, -127, -125, -126, -127, -130, -131, -131, -129, -131, -135, -136, -137, -135, -133, -132, -132, -133, -132, -133, -132, -126, -121, -121, -125, -127, -130, -127, -125, -128, -131, -128, -128, -126, -121, -114, -110, -110, -116, -126, -133, -138, -138, -134, -129, -122, -119, -120, -122, -124, -131, -136, -131, -119, -111, -110, -113, -118, -123, -127, -129, -128, -129, -127, -125, -122, -122, -125, -127, -129, -133, -136, -137, -134, -130, -128, -124, -124, -125, -127, -130, -131, -133, -134, -134, -134, -132, -131, -127, -124, -123, -124, -130, -132, -130, -123, -119, -120, -122, -126, -128, -128, -127, -131, -135, -137, -135, -132, -127, -121, -120, -123, -118, -114, -119, -131, -138, -136, -133, -129, -125, -123, -124, -125, -123, -124, -129, -130, -123, -119, -117, -118, -121, -125, -130, -129, -128, -128, -129, -129, -127, -124, -124, -126, -131, -131, -129, -127, -128, -128, -127, -127, -127, -126, -127, -128, -130, -128, -128, -131, -134, -135, -133, -130, -127, -125, -125, -127, -131, -130, -129, -126, -128, -130, -133, -132, -128, -123, -118, -114, -117, -124, -133, -136, -135, -133, -128, -118, -112, -112, -113, -113, -124, -139, -146, -141, -133, -126, -122, -120, -121, -124, -127, -135, -137, -128, -118, -113, -113, -115, -122, -131, -134, -132, -130, -128, -126, -124, -125, -127, -131, -135, -135, -135, -135, -134, -133, -130, -130, -131, -129, -127, -127, -129, -129, -129, -128, -126, -124, -127, -130, -132, -131, -132, -132, -133, -133, -132, -128, -125, -124, -129, -132, -133, -130, -125, -122, -120, -120, -122, -129, -135, -135, -130, -128, -126, -120, -112, -108, -108, -117, -130, -142, -144, -137, -131, -126, -122, -120, -123, -124, -129, -138, -141, -132, -119, -114, -114, -119, -124, -128, -128, -127, -126, -125, -123, -120, -120, -123, -128, -132, -132, -130, -129, -129, -130, -129, -128, -125, -126, -130, -135, -134, -131, -130, -129, -129, -129, -129, -128, -128, -129, -133, -134, -129, -122, -117, -117, -120, -125, -129, -130, -127, -124, -120, -115, -112, -114, -122, -130, -133, -134, -131, -129, -124, -116, -110, -109, -111, -121, -136, -147, -147, -139, -131, -126, -121, -120, -122, -125, -130, -135, -135, -125, -113, -110, -112, -116, -122, -126, -128, -127, -128, -127, -125, -123, -122, -126, -130, -132, -132, -133, -133, -130, -127, -124, -125, -127, -131, -132, -133, -130, -130, -130, -131, -130, -127, -124, -124, -127, -130, -132, -132, -130, -128, -126, -127, -124, -125, -128, -133, -131, -126, -122, -120, -120, -124, -129, -136, -139, -138, -137, -134, -126, -116, -111, -112, -117, -127, -141, -146, -143, -136, -131, -126, -121, -119, -120, -124, -131, -139, -138, -125, -114, -108, -112, -116, -123, -128, -130, -130, -127, -126, -122, -120, -121, -124, -129, -132, -134, -135, -134, -130, -127, -128, -130, -131, -131, -131, -131, -130, -130, -131, -130, -129, -128, -131, -131, -131, -130, -129, -129, -131, -133, -132, -132, -132, -135, -136, -132, -124, -119, -120, -122, -124, -125, -129, -132, -133, -133, -132, -126, -115, -106, -107, -110, -116, -125, -138, -143, -141, -134, -129, -121, -117, -118, -124, -127, -132, -137, -134, -124, -116, -115, -116, -118, -123, -127, -129, -127, -127, -125, -122, -121, -123, -126, -131, -132, -132, -130, -128, -128, -130, -133, -135, -133, -129, -128, -128, -131, -132, -132, -129, -127, -129, -129, -128, -128, -128, -130, -129, -126, -123, -122, -122, -126, -128, -129, -127, -122, -119, -118, -117, -118, -119, -125, -133, -137, -136, -133, -124, -112, -110, -119, -125, -121, -117, -124, -134, -139, -138, -133, -128, -125, -125, -129, -130, -130, -130, -133, -131, -125, -121, -120, -119, -123, -129, -131, -130, -129, -127, -128, -127, -128, -128, -130, -133, -134, -131, -128, -126, -127, -126, -127, -127, -128, -129, -130, -130, -127, -126, -126, -127, -128, -130, -132, -132, -132, -130, -130, -130, -129, -128, -128, -128, -127, -124, -124, -127, -128, -126, -121, -120, -120, -121, -123, -122, -125, -128, -133, -134, -133, -129, -126, -125, -126, -125, -123, -121, -120, -124, -135, -143, -143, -136, -130, -129, -126, -123, -119, -119, -124, -129, -127, -120, -116, -116, -118, -120, -127, -128, -127, -127, -127, -128, -125, -123, -122, -124, -128, -130, -132, -132, -131, -128, -124, -121, -123, -125, -128, -130, -130, -131, -129, -127, -126, -127, -129, -132, -135, -137, -137, -137, -135, -133, -131, -129, -127, -127, -130, -131, -129, -126, -123, -121, -122, -121, -120, -118, -116, -120, -125, -130, -130, -130, -128, -125, -122, -122, -123, -122, -120, -119, -120, -129, -138, -140, -137, -132, -128, -125, -122, -122, -121, -123, -130, -134, -129, -120, -116, -117, -119, -121, -125, -125, -125, -125, -126, -126, -126, -126, -128, -129, -130, -130, -130, -129, -128, -128, -130, -132, -134, -133, -132, -131, -131, -130, -126, -125, -126, -129, -132, -133, -133, -132, -131, -131, -130, -128, -127, -125, -125, -128, -129, -127, -123, -124, -127, -128, -123, -120, -118, -120, -123, -127, -131, -133, -134, -132, -129, -127, -130, -129, -124, -121, -120, -120, -121, -130, -138, -139, -134, -131, -129, -126, -123, -124, -124, -127, -132, -131, -122, -113, -113, -116, -121, -125, -127, -125, -124, -123, -124, -123, -120, -121, -123, -128, -130, -130, -129, -129, -129, -128, -127, -127, -130, -131, -132, -130, -129, -128, -127, -128, -128, -130, -133, -134, -135, -133, -133, -130, -129, -129, -130, -129, -126, -122, -125, -129, -132, -131, -127, -123, -119, -119, -119, -120, -124, -130, -135, -136, -135, -130, -129, -129, -129, -123, -117, -114, -115, -117, -125, -136, -142, -138, -135, -131, -128, -123, -119, -120, -121, -128, -135, -135, -125, -117, -116, -118, -120, -124, -126, -127, -128, -129, -129, -126, -123, -122, -125, -130, -133, -133, -130, -128, -127, -129, -131, -131, -131, -130, -131, -133, -132, -130, -127, -128, -130, -133, -134, -134, -131, -131, -130, -130, -128, -126, -126, -126, -126, -126, -126, -125, -125, -125, -123, -119, -116, -115, -116, -121, -128, -130, -131, -130, -130, -131, -131, -130, -124, -118, -116, -121, -122, -122, -128, -136, -140, -138, -135, -129, -124, -121, -124, -127, -128, -133, -137, -132, -121, -116, -115, -117, -120, -126, -129, -129, -127, -127, -126, -124, -125, -127, -128, -129, -129, -129, -128, -128, -128, -128, -128, -129, -131, -131, -130, -129, -129, -128, -129, -128, -128, -127, -130, -133, -135, -132, -129, -127, -128, -129, -129, -128, -128, -128, -127, -126, -122, -121, -122, -124, -124, -121, -119, -119, -120, -124, -126, -128, -126, -126, -128, -131, -134, -134, -134, -134, -131, -123, -116, -115, -119, -121, -126, -136, -143, -143, -137, -131, -127, -123, -122, -125, -127, -129, -133, -131, -123, -113, -112, -114, -120, -126, -131, -133, -131, -129, -127, -125, -124, -125, -127, -130, -133, -132, -130, -128, -128, -128, -129, -129, -129, -128, -129, -130, -131, -129, -129, -128, -130, -131, -133, -133, -134, -132, -131, -131, -131, -131, -130, -129, -128, -127, -125, -121, -118, -119, -121, -123, -122, -120, -117, -115, -117, -118, -119, -121, -122, -125, -125, -127, -128, -129, -131, -131, -132, -129, -124, -118, -116, -117, -119, -122, -130, -138, -142, -140, -135, -129, -124, -122, -123, -127, -130, -133, -135, -133, -123, -113, -111, -114, -119, -126, -131, -133, -132, -131, -128, -127, -125, -124, -123, -126, -127, -127, -126, -125, -125, -127, -128, -128, -128, -128, -130, -131, -133, -132, -131, -132, -134, -137, -137, -134, -132, -131, -133, -133, -133, -130, -128, -127, -129, -129, -127, -124, -127, -130, -130, -125, -119, -118, -119, -122, -124, -126, -125, -124, -125, -125, -127, -128, -130, -132, -134, -134, -130, -119, -112, -112, -116, -117, -120, -130, -140, -144, -140, -135, -128, -123, -121, -123, -127, -128, -131, -134, -131, -121, -113, -112, -114, -119, -125, -130, -131, -129, -128, -127, -125, -124, -124, -126, -128, -129, -129, -126, -125, -125, -128, -131, -131, -128, -128, -131, -133, -132, -132, -132, -133, -135, -134, -134, -131, -131, -131, -132, -132, -132, -130, -127, -125, -124, -124, -124, -122, -122, -122, -123, -120, -117, -116, -116, -120, -123, -125, -124, -123, -123, -126, -129, -130, -130, -130, -133, -134, -130, -122, -116, -117, -119, -121, -127, -135, -143, -143, -140, -136, -131, -125, -123, -125, -128, -130, -133, -134, -129, -118, -111, -111, -115, -121, -127, -131, -131, -130, -131, -129, -127, -125, -125, -128, -130, -128, -126, -125, -124, -126, -127, -129, -127, -126, -126, -126, -126, -125, -127, -129, -132, -134, -133, -132, -131, -130, -130, -131, -132, -130, -128, -126, -126, -126, -126, -129, -131, -131, -129, -123, -119, -118, -118, -122, -125, -130, -131, -129, -127, -124, -123, -125, -130, -133, -136, -135, -132, -126, -124, -123, -121, -120, -121, -123, -123, -125, -133, -139, -139, -133, -130, -127, -124, -123, -122, -123, -126, -129, -128, -120, -114, -114, -117, -120, -126, -130, -131, -130, -132, -132, -131, -128, -125, -127, -128, -130, -130, -127, -125, -127, -128, -128, -125, -126, -129, -133, -136, -139, -137, -135, -133, -133, -132, -131, -129, -128, -126, -128, -128, -127, -128, -128, -128, -127, -126, -126, -125, -124, -125, -125, -123, -120, -120, -120, -121, -122, -122, -123, -122, -124, -126, -127, -125, -126, -129, -132, -134, -134, -131, -130, -126, -125, -126, -127, -125, -123, -121, -121, -120, -126, -134, -139, -139, -136, -133, -128, -124, -122, -123, -124, -127, -134, -134, -127, -119, -116, -118, -120, -125, -130, -132, -130, -126, -122, -119, -117, -118, -121, -124, -126, -126, -124, -124, -123, -125, -127, -128, -131, -133, -136, -136, -136, -134, -134, -134, -133, -133, -130, -128, -125, -125, -127, -129, -130, -128, -127, -126, -126, -125, -126, -127, -128, -129, -129, -126, -125, -122, -122, -122, -125, -124, -121, -121, -120, -121, -123, -124, -124, -125, -126, -127, -128, -128, -129, -128, -129, -129, -131, -132, -129, -125, -120, -120, -126, -134, -141, -142, -140, -136, -133, -129, -126, -124, -124, -126, -128, -131, -131, -128, -119, -112, -111, -113, -117, -120, -124, -127, -127, -125, -122, -120, -120, -123, -125, -127, -127, -127, -126, -126, -128, -130, -131, -133, -133, -134, -136, -137, -137, -134, -131, -129, -129, -128, -126, -125, -126, -128, -129, -130, -129, -127, -126, -129, -132, -132, -131, -129, -127, -127, -126, -126, -125, -125, -123, -122, -121, -121, -121, -121, -121, -123, -123, -125, -126, -125, -126, -126, -129, -131, -134, -134, -133, -129, -125, -121, -121, -124, -129, -137, -142, -144, -140, -136, -131, -128, -125, -125, -126, -129, -128, -126, -125, -125, -121, -116, -112, -112, -116, -120, -124, -126, -125, -124, -122, -122, -122, -122, -122, -123, -126, -129, -129, -129, -127, -127, -128, -130, -132, -131, -132, -132, -132, -133, -133, -131, -130, -128, -128, -128, -130, -132, -132, -130, -129, -130, -132, -132, -131, -130, -130, -128, -127, -126, -126, -128, -128, -125, -121, -118, -117, -117, -116, -118, -120, -123, -124, -127, -128, -126, -124, -124, -129, -133, -135, -135, -133, -129, -126, -121, -119, -121, -130, -138, -141, -141, -139, -134, -128, -123, -123, -125, -125, -128, -129, -130, -128, -126, -122, -118, -117, -117, -121, -124, -128, -128, -127, -125, -125, -126, -126, -124, -125, -125, -126, -126, -126, -126, -124, -124, -125, -127, -129, -128, -129, -130, -135, -136, -137, -136, -133, -132, -131, -133, -134, -132, -128, -127, -129, -133, -134, -134, -131, -129, -128, -129, -130, -127, -123, -121, -123, -125, -125, -121, -117, -116, -116, -120, -123, -126, -126, -127, -127, -127, -127, -130, -131, -132, -133, -134, -135, -130, -123, -119, -120, -124, -127, -131, -134, -137, -137, -134, -129, -125, -123, -122, -124, -127, -128, -127, -127, -127, -123, -118, -115, -117, -120, -124, -127, -128, -126, -123, -123, -123, -123, -123, -123, -122, -124, -125, -125, -123, -123, -125, -127, -129, -129, -131, -131, -133, -135, -136, -135, -134, -132, -129, -131, -133, -133, -131, -128, -127, -128, -131, -132, -133, -132, -129, -128, -127, -126, -125, -125, -124, -124, -124, -122, -121, -119, -119, -120, -122, -124, -126, -125, -124, -122, -124, -126, -128, -128, -126, -123, -123, -125, -129, -131, -132, -130, -128, -127, -126, -128, -127, -126, -124, -128, -137, -142, -142, -137, -133, -129, -126, -125, -125, -126, -127, -129, -131, -133, -131, -122, -114, -111, -113, -117, -118, -118, -118, -118, -119, -119, -120, -120, -121, -122, -125, -126, -127, -127, -128, -127, -130, -131, -131, -132, -132, -132, -132, -133, -134, -135, -134, -133, -129, -126, -127, -129, -132, -132, -133, -132, -130, -129, -128, -129, -129, -130, -130, -132, -134, -132, -130, -125, -122, -119, -120, -122, -125, -125, -124, -122, -121, -122, -123, -124, -124, -125, -125, -125, -124, -122, -123, -126, -132, -135, -136, -134, -130, -127, -126, -127, -130, -131, -133, -135, -139, -141, -138, -135, -132, -128, -126, -124, -125, -125, -126, -126, -126, -125, -125, -125, -126, -126, -123, -119, -117, -118, -119, -120, -120, -122, -123, -123, -124, -123, -123, -122, -124, -126, -127, -129, -130, -130, -130, -129, -129, -130, -131, -130, -130, -130, -132, -134, -134, -135, -134, -132, -130, -129, -130, -130, -131, -132, -132, -132, -129, -126, -124, -125, -126, -125, -126, -124, -120, -117, -117, -120, -122, -121, -121, -120, -122, -125, -129, -130, -127, -125, -124, -125, -124, -126, -128, -131, -132, -133, -131, -130, -127, -125, -123, -120, -120, -123, -129, -135, -138, -138, -134, -128, -125, -122, -121, -123, -127, -130, -132, -132, -129, -125, -123, -123, -123, -123, -121, -119, -119, -118, -119, -118, -118, -117, -118, -121, -123, -124, -125, -124, -124, -124, -126, -129, -130, -131, -132, -133, -135, -135, -136, -136, -136, -135, -137, -137, -138, -136, -134, -131, -130, -129, -130, -129, -129, -127, -126, -125, -125, -128, -129, -127, -128, -126, -124, -122, -124, -124, -123, -123, -125, -126, -124, -125, -126, -128, -131, -130, -127, -125, -125, -127, -127, -128, -130, -131, -130, -130, -129, -130, -127, -124, -122, -122, -126, -130, -135, -137, -138, -136, -133, -129, -126, -125, -125, -127, -130, -130, -130, -128, -126, -126, -123, -123, -123, -122, -118, -116, -116, -116, -117, -116, -118, -120, -121, -123, -125, -125, -125, -124, -125, -126, -127, -129, -130, -131, -131, -134, -135, -136, -133, -131, -133, -134, -136, -136, -135, -133, -132, -132, -131, -131, -132, -132, -131, -131, -130, -129, -128, -128, -128, -128, -128, -127, -124, -124, -123, -124, -122, -121, -121, -121, -122, -125, -126, -128, -127, -125, -122, -120, -124, -126, -128, -129, -132, -134, -133, -133, -131, -127, -121, -122, -123, -126, -129, -134, -138, -140, -138, -134, -127, -123, -122, -125, -126, -129, -130, -130, -129, -128, -126, -124, -124, -126, -127, -126, -123, -122, -120, -119, -119, -120, -121, -123, -123, -124, -124, -124, -122, -121, -122, -122, -124, -126, -128, -129, -129, -127, -127, -128, -128, -129, -131, -135, -136, -135, -131, -128, -125, -126, -127, -129, -129, -129, -128, -126, -127, -126, -125, -122, -122, -123, -123, -125, -125, -124, -121, -119, -119, -119, -120, -123, -126, -128, -129, -129, -129, -127, -126, -126, -127, -129, -131, -132, -132, -133, -132, -130, -127, -123, -121, -119, -121, -125, -129, -132, -136, -137, -134, -130, -127, -126, -126, -126, -128, -129, -129, -129, -129, -127, -126, -126, -127, -128, -128, -125, -120, -117, -116, -117, -116, -117, -120, -123, -125, -125, -123, -123, -120, -121, -123, -128, -130, -132, -132, -133, -133, -133, -131, -130, -131, -134, -136, -138, -135, -132, -131, -131, -131, -133, -133, -132, -130, -130, -130, -130, -128, -127, -128, -127, -128, -128, -128, -127, -125, -124, -122, -122, -122, -122, -124, -128, -130, -129, -126, -125, -126, -125, -126, -126, -127, -128, -128, -129, -131, -132, -132, -130, -129, -128, -128, -125, -122, -120, -122, -124, -125, -126, -127, -130, -133, -135, -135, -133, -130, -128, -126, -126, -125, -127, -128, -128, -127, -127, -126, -124, -123, -124, -122, -119, -117, -116, -118, -120, -121, -122, -124, -124, -125, -125, -124, -124, -125, -125, -127, -128, -129, -130, -131, -130, -130, -128, -128, -129, -131, -130, -130, -128, -128, -130, -132, -134, -134, -135, -135, -133, -130, -129, -128, -128, -130, -132, -133, -132, -130, -129, -128, -128, -127, -125, -120, -119, -118, -118, -121, -124, -126, -126, -125, -124, -124, -124, -124, -124, -128, -129, -129, -129, -130, -133, -134, -133, -133, -132, -130, -128, -125, -122, -119, -119, -120, -122, -126, -128, -131, -132, -134, -135, -135, -134, -132, -130, -129, -130, -130, -131, -131, -131, -130, -128, -126, -124, -123, -121, -118, -114, -114, -115, -117, -117, -117, -118, -118, -119, -120, -121, -121, -123, -125, -128, -129, -130, -133, -135, -134, -131, -130, -129, -131, -131, -132, -133, -134, -134, -132, -131, -131, -131, -128, -127, -126, -126, -125, -126, -127, -128, -129, -131, -132, -130, -130, -129, -129, -130, -129, -125, -123, -123, -125, -127, -125, -125, -126, -128, -128, -128, -129, -128, -124, -122, -121, -123, -123, -125, -125, -126, -126, -127, -126, -126, -125, -126, -124, -123, -124, -125, -126, -125, -128, -131, -132, -134, -136, -136, -134, -130, -130, -130, -130, -130, -132, -132, -132, -129, -128, -127, -126, -125, -126, -125, -120, -115, -112, -114, -116, -120, -123, -126, -126, -125, -125, -124, -123, -123, -124, -128, -130, -130, -130, -129, -129, -128, -127, -128, -129, -131, -133, -132, -132, -131, -132, -131, -133, -134, -134, -131, -128, -125, -124, -125, -128, -132, -133, -132, -133, -133, -134, -133, -133, -133, -132, -128, -126, -124, -124, -125, -128, -130, -130, -130, -129, -128, -127, -127, -126, -126, -125, -125, -125, -123, -121, -119, -120, -122, -122, -121, -120, -117, -117, -117, -119, -120, -121, -123, -124, -126, -127, -127, -126, -125, -127, -128, -129, -128, -128, -126, -127, -128, -130, -130, -127, -122, -120, -119, -121, -119, -115, -113, -114, -117, -121, -124, -125, -126, -128, -131, -132, -133, -132, -133, -135, -138, -142, -142, -140, -137, -135, -135, -135, -134, -134, -134, -135, -134, -134, -135, -134, -131, -128, -128, -128, -127, -126, -128, -131, -133, -134, -133, -134, -133, -133, -134, -135, -133, -133, -132, -129, -124, -122, -122, -124, -125, -124, -123, -125, -130, -135, -136, -134, -131, -129, -129, -127, -126, -126, -126, -126, -126, -127, -126, -124, -118, -116, -116, -117, -117, -118, -119, -118, -119, -120, -125, -127, -127, -124, -122, -122, -122, -121, -122, -121, -119, -120, -121, -122, -120, -116, -112, -110, -107, -105, -100, -96, -95, -98, -101, -104, -108, -112, -114, -117, -118, -118, -119, -121, -125, -128, -133, -136, -137, -136, -133, -133, -135, -137, -136, -135, -135, -135, -135, -136, -136, -137, -135, -134, -134, -138, -141, -141, -140, -139, -139, -140, -142, -143, -143, -141, -141, -141, -140, -137, -135, -133, -133, -130, -127, -120, -118, -117, -120, -125, -128, -129, -128, -129, -129, -130, -128, -127, -124, -127, -134, -143, -148, -143, -134, -128, -130, -130, -128, -126, -127, -130, -135, -138, -139, -139, -140, -145, -144, -142, -142, -142, -137, -134, -135, -136, -132, -128, -125, -125, -125, -122, -120, -117, -117, -116, -110, -105, -103, -109, -118, -129, -132, -127, -118, -113, -115, -117, -118, -122, -129, -138, -143, -145, -139, -128, -117, -114, -119, -124, -123, -120, -119, -119, -120, -121, -121, -121, -120, -123, -128, -127, -124, -119, -120, -122, -125, -130, -133, -137, -139, -137, -133, -127, -122, -119, -121, -124, -126, -127, -127, -126, -124, -123, -121, -121, -121, -123, -124, -127, -129, -129, -127, -124, -125, -129, -130, -129, -127, -125, -124, -124, -123, -124, -123, -123, -122, -120, -122, -125, -128, -131, -132, -133, -133, -132, -132, -133, -134, -134, -131, -130, -132, -136, -137, -136, -133, -127, -121, -117, -115, -112, -109, -108, -111, -113, -116, -119, -120, -119, -119, -119, -123, -127, -132, -136, -136, -133, -128, -126, -125, -126, -127, -127, -128, -126, -126, -126, -127, -127, -127, -130, -135, -139, -141, -137, -128, -117, -113, -116, -121, -125, -129, -136, -142, -145, -142, -139, -134, -129, -125, -122, -122, -122, -127, -131, -133, -133, -132, -133, -132, -130, -129, -125, -125, -126, -127, -126, -126, -126, -126, -125, -125, -120, -115, -111, -110, -116, -125, -132, -136, -137, -136, -136, -134, -132, -131, -132, -134, -135, -137, -137, -135, -133, -130, -126, -122, -122, -131, -140, -141, -131, -119, -111, -112, -118, -125, -129, -132, -133, -129, -121, -114, -112, -115, -122, -133, -140, -141, -140, -137, -134, -131, -127, -126, -129, -133, -136, -131, -123, -114, -113, -117, -123, -126, -129, -134, -140, -141, -138, -135, -136, -137, -136, -135, -135, -135, -135, -136, -138, -142, -147, -149, -149, -148, -144, -140, -136, -136, -138, -138, -139, -136, -135, -130, -129, -118, -125, -131, -114, -112, -119, -128, -128, -133, -123, -128, -126, -115, -117, -120, -118, -115, -116, -114, -114, -109, -104, -109, -119, -120, -119, -111, -107, -108, -110, -118, -125, -130, -127, -124, -127, -124, -137, -150, -150, -136, -129, -135, -135, -134, -137, -139, -138, -130, -127, -142, -144, -132, -132, -140, -139, -132, -131, -128, -123, -125, -136, -136, -127, -132, -141, -137, -116, -116, -131, -130, -113, -114, -132, -138, -125, -111, -117, -129, -135, -133, -121, -111, -117, -127, -142, -142, -115, -93, -96, -124, -134, -141, -155, -130, -96, -72, -87, -131, -149, -155, -150, -142, -130, -124, -119, -114, -112, -115, -110, -101, -98, -107, -113, -103, -93, -92, -106, -122, -134, -142, -145, -147, -142, -139, -137, -139, -142, -147, -148, -144, -144, -144, -145, -147, -149, -149, -153, -153, -154, -152, -147, -142, -136, -143, -152, -158, -166, -170, -165, -166, -166, -162, -160, -167, -171, -179, -185, -182, -177, -172, -172, -166, -166, -166, -165, -168, -168, -159, -148, -141, -139, -142, -148, -146, -145, -142, -139, -142, -145, -151, -152, -154, -156, -155, -157, -159, -156, -150, -145, -140, -144, -148, -155, -157, -158, -152, -145, -139, -134, -130, -123, -123, -126, -135, -143, -143, -141, -138, -138, -138, -140, -140, -142, -144, -147, -146, -143, -137, -131, -125, -126, -121, -114, -112, -109, -106, -99, -98, -94, -95, -101, -101, -105, -111, -117, -124, -125, -128, -125, -122, -121, -117, -115, -112, -112, -118, -123, -128, -123, -118, -115, -112, -113, -112, -113, -114, -119, -118, -110, -105, -105, -102, -106, -108, -110, -112, -114, -119, -121, -127, -120, -113, -107, -107, -109, -107, -104, -101, -98, -95, -89, -83, -82, -84, -92, -101, -101, -91, -84, -86, -91, -96, -92, -86, -85, -86, -91, -96, -100, -103, -100, -100, -97, -92, -88, -89, -94, -94, -96, -93, -99, -104, -109, -105, -101, -97, -96, -97, -99, -102, -102, -106, -105, -99, -96, -98, -98, -102, -99, -100, -100, -101, -102, -97, -98, -98, -101, -103, -106, -108, -111, -115, -117, -116, -109, -102, -100, -101, -105, -112, -110, -112, -111, -114, -127, -129, -127, -120, -114, -117, -121, -127, -135, -140, -143, -143, -141, -137, -134, -134, -139, -152, -161, -158, -141, -127, -127, -142, -156, -161, -161, -153, -148, -147, -146, -143, -142, -145, -153, -160, -163, -158, -151, -150, -155, -159, -161, -162, -164, -162, -158, -155, -154, -158, -163, -165, -164, -161, -159, -157, -158, -162, -164, -160, -160, -166, -174, -179, -176, -172, -166, -161, -160, -157, -152, -144, -141, -144, -151, -159, -164, -163, -158, -152, -148, -147, -152, -159, -163, -163, -163, -158, -147, -141, -136, -136, -136, -135, -136, -134, -134, -135, -135, -133, -128, -126, -125, -127, -133, -134, -131, -124, -121, -122, -121, -121, -128, -136, -140, -133, -130, -133, -128, -121, -113, -112, -120, -127, -132, -128, -121, -116, -112, -111, -114, -120, -127, -133, -134, -128, -122, -115, -112, -117, -121, -124, -123, -118, -111, -110, -109, -109, -114, -118, -113, -107, -109, -113, -115, -113, -103, -100, -99, -104, -109, -111, -112, -113, -115, -113, -113, -114, -116, -120, -123, -126, -129, -127, -123, -119, -121, -123, -129, -132, -134, -135, -132, -125, -118, -115, -122, -132, -142, -146, -140, -138, -133, -132, -134, -135, -138, -139, -139, -133, -128, -124, -122, -128, -135, -140, -139, -137, -134, -125, -117, -117, -123, -133, -145, -148, -146, -137, -126, -118, -118, -125, -133, -138, -136, -133, -126, -116, -107, -104, -111, -121, -127, -132, -132, -131, -127, -121, -115, -111, -114, -115, -118, -122, -122, -117, -111, -113, -119, -125, -125, -122, -120, -117, -113, -108, -103, -105, -112, -115, -112, -107, -95, -87, -79, -75, -77, -83, -93, -102, -105, -99, -94, -88, -89, -93, -96, -100, -106, -112, -115, -117, -114, -113, -113, -113, -107, -100, -101, -108, -113, -112, -108, -102, -98, -97, -95, -88, -85, -85, -85, -83, -83, -86, -97, -105, -106, -104, -101, -101, -102, -100, -97, -94, -96, -98, -100, -101, -96, -96, -98, -99, -96, -91, -90, -96, -102, -112, -110, -106, -102, -101, -111, -118, -124, -123, -123, -122, -121, -117, -112, -109, -109, -116, -123, -128, -132, -128, -119, -114, -109, -105, -104, -112, -117, -122, -124, -129, -128, -123, -127, -131, -138, -144, -142, -134, -125, -126, -136, -145, -144, -136, -130, -127, -128, -127, -120, -115, -115, -128, -144, -150, -144, -128, -118, -121, -128, -131, -134, -134, -138, -144, -151, -147, -133, -124, -131, -149, -156, -151, -139, -135, -140, -142, -142, -139, -140, -150, -156, -156, -149, -140, -135, -138, -141, -141, -140, -138, -142, -146, -142, -133, -117, -111, -115, -121, -127, -128, -125, -121, -113, -113, -115, -120, -128, -132, -132, -133, -136, -135, -131, -125, -120, -124, -132, -143, -154, -156, -151, -145, -141, -141, -143, -145, -146, -144, -144, -148, -153, -152, -146, -137, -132, -138, -147, -153, -156, -159, -156, -148, -144, -144, -150, -155, -161, -157, -144, -132, -131, -138, -148, -155, -162, -159, -157, -154, -157, -157, -146, -141, -138, -143, -147, -152, -156, -154, -156, -160, -165, -162, -156, -152, -159, -169, -175, -174, -173, -177, -180, -180, -181, -185, -186, -184, -181, -184, -189, -192, -195, -194, -188, -181, -178, -177, -176, -175, -182, -185, -184, -181, -183, -187, -189, -187, -181, -179, -178, -179, -181, -180, -169, -153, -141, -141, -147, -155, -159, -160, -152, -146, -148, -153, -158, -152, -145, -141, -143, -151, -154, -150, -147, -144, -142, -142, -140, -142, -146, -149, -149, -145, -140, -134, -132, -129, -129, -127, -123, -121, -115, -116, -114, -108, -104, -107, -118, -126, -128, -123, -117, -115, -119, -119, -112, -110, -113, -122, -134, -143, -140, -131, -120, -115, -112, -116, -122, -128, -125, -117, -110, -101, -95, -87, -81, -79, -86, -100, -109, -107, -102, -96, -97, -100, -100, -99, -97, -100, -110, -120, -124, -123, -118, -115, -113, -110, -107, -109, -114, -125, -131, -128, -121, -114, -113, -110, -108, -105, -102, -105, -111, -117, -111, -105, -99, -100, -107, -118, -125, -123, -109, -97, -91, -95, -102, -109, -115, -119, -120, -120, -116, -106, -99, -96, -98, -106, -117, -127, -131, -129, -125, -116, -109, -113, -123, -129, -130, -127, -123, -117, -108, -104, -106, -112, -119, -125, -131, -124, -113, -106, -100, -100, -107, -118, -129, -135, -136, -131, -120, -113, -107, -108, -110, -114, -118, -125, -132, -134, -124, -110, -101, -101, -113, -117, -117, -113, -109, -99, -88, -83, -90, -100, -113, -119, -120, -118, -115, -114, -109, -100, -94, -102, -113, -119, -117, -112, -106, -103, -104, -105, -108, -109, -111, -111, -115, -121, -127, -123, -114, -108, -107, -111, -117, -121, -119, -115, -112, -110, -107, -108, -114, -122, -124, -119, -116, -114, -116, -116, -114, -113, -115, -118, -115, -113, -113, -112, -114, -118, -124, -132, -136, -133, -126, -121, -120, -121, -127, -133, -133, -124, -113, -110, -118, -130, -140, -142, -143, -140, -137, -129, -120, -113, -115, -127, -140, -143, -135, -121, -112, -112, -119, -120, -122, -128, -138, -142, -137, -126, -119, -120, -127, -133, -139, -152, -166, -171, -166, -156, -148, -147, -150, -155, -160, -166, -172, -175, -167, -149, -135, -128, -131, -139, -150, -159, -158, -153, -147, -141, -132, -127, -132, -146, -157, -158, -152, -146, -141, -138, -137, -139, -138, -138, -141, -145, -149, -150, -145, -139, -134, -129, -132, -140, -142, -137, -126, -121, -122, -130, -135, -133, -126, -121, -126, -134, -137, -135, -127, -122, -120, -121, -121, -118, -115, -114, -111, -110, -107, -107, -107, -105, -106, -109, -113, -116, -117, -113, -108, -103, -104, -103, -102, -105, -116, -124, -126, -121, -116, -111, -104, -98, -96, -101, -109, -116, -114, -103, -90, -84, -85, -90, -91, -92, -94, -97, -103, -109, -113, -109, -102, -98, -103, -112, -121, -126, -127, -125, -116, -105, -102, -109, -119, -127, -129, -129, -121, -111, -102, -98, -102, -105, -110, -112, -117, -120, -121, -116, -108, -102, -102, -107, -115, -118, -121, -121, -118, -114, -112, -117, -124, -130, -131, -129, -128, -125, -123, -121, -125, -130, -134, -135, -136, -133, -132, -130, -130, -127, -122, -115, -114, -123, -136, -144, -146, -139, -127, -119, -123, -134, -136, -128, -120, -117, -121, -126, -130, -124, -117, -114, -114, -114, -114, -117, -123, -125, -121, -109, -103, -107, -114, -115, -113, -111, -111, -110, -106, -106, -108, -114, -116, -121, -124, -126, -125, -123, -120, -117, -115, -115, -112, -111, -112, -116, -116, -112, -101, -95, -95, -99, -100, -104, -114, -123, -129, -125, -117, -110, -105, -105, -106, -109, -110, -119, -129, -133, -124, -108, -93, -91, -98, -109, -120, -127, -125, -118, -112, -109, -108, -110, -115, -123, -127, -127, -128, -125, -119, -114, -119, -133, -145, -153, -152, -144, -132, -121, -117, -119, -126, -134, -142, -145, -144, -137, -127, -121, -122, -124, -126, -129, -136, -145, -146, -140, -127, -119, -119, -126, -133, -138, -141, -140, -140, -134, -126, -120, -124, -133, -141, -144, -144, -141, -138, -141, -149, -159, -162, -160, -158, -159, -156, -156, -156, -161, -164, -164, -159, -153, -148, -145, -148, -153, -153, -156, -159, -159, -156, -151, -150, -147, -143, -135, -133, -142, -150, -151, -149, -143, -137, -132, -133, -138, -142, -143, -146, -149, -149, -146, -142, -138, -136, -135, -136, -140, -138, -134, -133, -137, -142, -140, -136, -136, -139, -145, -150, -149, -144, -132, -125, -122, -122, -127, -135, -143, -146, -143, -133, -128, -129, -133, -139, -146, -152, -151, -146, -136, -124, -113, -111, -119, -134, -144, -148, -148, -143, -133, -123, -115, -117, -127, -138, -145, -143, -131, -115, -107, -106, -110, -113, -115, -123, -132, -135, -128, -120, -118, -125, -131, -131, -128, -125, -131, -138, -142, -137, -130, -129, -135, -142, -148, -148, -145, -137, -127, -121, -122, -126, -132, -133, -131, -132, -133, -135, -133, -125, -119, -119, -125, -125, -122, -122, -126, -129, -127, -124, -122, -129, -139, -145, -145, -143, -145, -148, -149, -149, -147, -144, -144, -145, -144, -141, -142, -147, -150, -144, -136, -131, -130, -131, -134, -140, -143, -142, -144, -144, -140, -134, -129, -132, -140, -153, -158, -152, -140, -137, -142, -146, -149, -153, -156, -153, -149, -146, -145, -140, -134, -130, -132, -141, -148, -140, -125, -113, -112, -120, -127, -133, -135, -138, -139, -143, -139, -130, -123, -126, -132, -132, -132, -133, -132, -129, -123, -117, -113, -114, -116, -121, -126, -131, -128, -122, -116, -113, -108, -107, -111, -118, -125, -127, -130, -132, -130, -127, -127, -135, -140, -139, -131, -122, -115, -115, -121, -128, -131, -125, -116, -112, -114, -115, -113, -114, -117, -123, -130, -134, -134, -129, -121, -115, -112, -118, -125, -134, -138, -138, -137, -136, -138, -135, -127, -123, -125, -131, -136, -135, -131, -128, -125, -121, -126, -134, -143, -144, -137, -128, -123, -126, -132, -137, -138, -138, -137, -137, -139, -138, -137, -136, -140, -148, -156, -162, -163, -159, -154, -151, -152, -157, -160, -164, -170, -174, -172, -162, -149, -142, -143, -150, -157, -165, -169, -170, -169, -159, -147, -138, -140, -145, -154, -164, -166, -155, -141, -132, -132, -140, -146, -147, -148, -148, -150, -145, -136, -128, -127, -132, -140, -146, -145, -142, -136, -131, -127, -125, -126, -133, -139, -136, -132, -131, -133, -130, -128, -124, -121, -118, -115, -113, -112, -117, -123, -120, -111, -103, -102, -111, -120, -123, -117, -110, -108, -110, -111, -105, -98, -98, -106, -115, -121, -119, -114, -114, -118, -121, -115, -103, -94, -93, -100, -108, -113, -110, -98, -86, -79, -78, -82, -89, -94, -95, -94, -98, -103, -104, -101, -97, -93, -96, -104, -112, -114, -109, -106, -104, -104, -105, -108, -113, -120, -122, -118, -107, -98, -95, -93, -96, -103, -112, -117, -111, -104, -103, -100, -95, -95, -99, -106, -111, -110, -105, -99, -96, -99, -102, -107, -110, -116, -120, -124, -122, -115, -105, -102, -108, -119, -126, -128, -124, -120, -121, -123, -121, -115, -109, -111, -114, -114, -116, -125, -134, -136, -128, -117, -109, -112, -120, -126, -126, -119, -113, -113, -122, -129, -128, -123, -121, -123, -121, -119, -116, -119, -120, -116, -108, -108, -114, -119, -119, -110, -100, -94, -98, -108, -116, -119, -123, -128, -131, -131, -126, -122, -118, -118, -119, -122, -121, -116, -110, -105, -107, -108, -108, -107, -106, -102, -98, -94, -97, -101, -102, -101, -102, -103, -105, -107, -109, -113, -112, -113, -117, -127, -128, -122, -111, -104, -104, -111, -120, -127, -129, -123, -114, -107, -103, -102, -103, -107, -111, -120, -128, -127, -119, -109, -105, -112, -120, -127, -131, -133, -132, -131, -130, -128, -126, -126, -133, -138, -138, -136, -130, -126, -127, -131, -134, -131, -126, -122, -126, -133, -135, -128, -122, -123, -130, -140, -142, -140, -136, -132, -130, -131, -130, -132, -138, -149, -158, -159, -152, -144, -141, -146, -154, -163, -165, -165, -162, -157, -156, -162, -165, -162, -158, -153, -151, -153, -158, -163, -164, -165, -165, -164, -161, -156, -154, -154, -160, -165, -165, -160, -154, -152, -153, -155, -155, -154, -153, -151, -147, -145, -144, -141, -139, -136, -135, -141, -147, -152, -151, -149, -149, -150, -150, -147, -143, -144, -151, -160, -160, -158, -156, -154, -151, -144, -138, -133, -132, -138, -148, -150, -140, -125, -119, -121, -128, -134, -139, -140, -135, -132, -127, -121, -119, -126, -134, -140, -142, -142, -141, -142, -139, -128, -114, -113, -121, -132, -137, -138, -133, -122, -108, -98, -93, -96, -108, -118, -123, -118, -111, -108, -105, -109, -117, -128, -135, -135, -130, -130, -129, -129, -128, -129, -132, -137, -141, -144, -143, -133, -123, -116, -113, -114, -119, -126, -134, -133, -126, -119, -115, -115, -117, -121, -123, -125, -127, -127, -121, -109, -103, -103, -112, -123, -132, -136, -135, -131, -123, -115, -109, -108, -116, -126, -135, -137, -132, -123, -118, -122, -129, -132, -130, -125, -123, -122, -126, -132, -139, -140, -136, -131, -130, -136, -139, -139, -135, -134, -133, -132, -133, -137, -143, -146, -142, -133, -126, -125, -129, -133, -135, -132, -131, -134, -140, -137, -128, -118, -114, -118, -121, -124, -127, -131, -135, -137, -137, -136, -136, -138, -137, -132, -122, -117, -119, -128, -133, -131, -126, -119, -111, -107, -107, -109, -111, -117, -123, -127, -124, -118, -111, -109, -111, -116, -122, -123, -122, -120, -119, -117, -117, -120, -128, -135, -138, -131, -123, -115, -112, -114, -114, -111, -108, -112, -121, -128, -126, -117, -110, -107, -111, -113, -116, -122, -130, -133, -132, -131, -128, -128, -129, -132, -134, -134, -135, -135, -135, -133, -130, -129, -136, -141, -140, -133, -129, -123, -118, -119, -127, -135, -137, -140, -141, -139, -138, -137, -134, -132, -131, -131, -132, -136, -139, -144, -148, -150, -149, -149, -148, -148, -150, -155, -161, -164, -166, -164, -162, -157, -157, -163, -169, -168, -159, -149, -148, -154, -161, -165, -167, -164, -160, -157, -153, -150, -154, -159, -163, -160, -157, -154, -154, -154, -149, -145, -144, -144, -145, -147, -151, -148, -141, -135, -133, -138, -146, -151, -153, -151, -148, -139, -131, -132, -139, -148, -154, -157, -156, -149, -138, -125, -119, -123, -133, -143, -146, -142, -132, -122, -112, -104, -101, -108, -119, -128, -133, -131, -125, -118, -112, -108, -106, -112, -122, -131, -131, -124, -114, -107, -106, -108, -110, -110, -114, -117, -117, -112, -103, -92, -88, -90, -97, -102, -102, -96, -91, -87, -87, -87, -90, -95, -105, -115, -118, -114, -105, -100, -104, -112, -117, -119, -116, -115, -113, -111, -105, -99, -96, -95, -101, -109, -113, -111, -104, -98, -96, -97, -99, -101, -103, -102, -99, -96, -95, -96, -100, -105, -104, -100, -93, -92, -97, -106, -111, -107, -99, -94, -95, -99, -100, -105, -111, -117, -118, -118, -115, -113, -112, -115, -119, -121, -122, -125, -127, -125, -124, -122, -120, -119, -119, -120, -121, -122, -121, -121, -121, -120, -120, -119, -120, -122, -125, -122, -114, -109, -109, -112, -111, -106, -102, -106, -113, -124, -130, -129, -121, -109, -102, -101, -108, -116, -123, -126, -129, -128, -122, -116, -111, -112, -116, -123, -127, -127, -125, -121, -115, -107, -102, -105, -113, -122, -120, -111, -102, -100, -107, -114, -118, -115, -114, -115, -117, -115, -110, -107, -105, -105, -109, -117, -125, -126, -122, -115, -109, -105, -107, -111, -115, -117, -116, -112, -107, -102, -101, -101, -104, -109, -114, -117, -118, -118, -115, -110, -110, -111, -116, -123, -129, -132, -131, -129, -127, -127, -127, -128, -128, -130, -132, -134, -131, -128, -129, -130, -130, -132, -134, -132, -127, -124, -125, -126, -124, -127, -134, -135, -131, -130, -134, -135, -132, -130, -128, -129, -132, -136, -136, -137, -137, -139, -141, -146, -153, -158, -159, -155, -151, -149, -151, -151, -151, -153, -160, -164, -166, -164, -160, -160, -158, -154, -147, -145, -148, -153, -156, -155, -152, -149, -150, -152, -152, -150, -148, -148, -148, -149, -146, -139, -134, -137, -146, -151, -147, -142, -142, -146, -148, -148, -142, -138, -139, -141, -147, -151, -153, -154, -151, -140, -127, -121, -128, -139, -148, -149, -147, -142, -138, -133, -130, -125, -121, -121, -126, -132, -136, -138, -137, -136, -129, -123, -122, -128, -135, -136, -134, -129, -126, -122, -124, -130, -135, -130, -123, -117, -116, -120, -122, -123, -122, -119, -117, -114, -109, -103, -103, -107, -112, -112, -112, -113, -117, -120, -118, -116, -113, -112, -112, -115, -118, -125, -130, -136, -136, -134, -127, -120, -114, -109, -107, -111, -122, -130, -132, -129, -125, -119, -111, -106, -108, -114, -117, -120, -122, -123, -121, -116, -112, -109, -105, -105, -108, -110, -115, -120, -123, -119, -113, -109, -112, -121, -131, -136, -134, -128, -125, -125, -124, -124, -129, -137, -141, -140, -136, -130, -126, -120, -118, -118, -122, -129, -134, -135, -132, -128, -126, -126, -127, -128, -131, -135, -135, -129, -121, -117, -114, -115, -121, -128, -134, -135, -134, -131, -129, -124, -119, -117, -118, -122, -125, -130, -134, -137, -138, -134, -129, -127, -130, -132, -129, -126, -126, -130, -133, -135, -133, -130, -125, -120, -112, -103, -102, -107, -116, -124, -130, -133, -126, -111, -100, -99, -106, -115, -120, -122, -120, -119, -119, -121, -120, -120, -122, -123, -124, -120, -114, -112, -114, -116, -113, -109, -109, -113, -116, -116, -113, -111, -110, -113, -118, -126, -133, -137, -136, -131, -126, -125, -129, -133, -139, -144, -143, -136, -128, -124, -124, -127, -128, -129, -134, -140, -146, -145, -134, -121, -114, -113, -116, -125, -137, -145, -147, -146, -144, -138, -133, -133, -138, -145, -147, -145, -141, -140, -140, -140, -142, -144, -147, -149, -155, -161, -163, -162, -158, -156, -156, -157, -161, -165, -168, -168, -166, -160, -159, -163, -169, -176, -179, -176, -168, -162, -160, -159, -158, -158, -159, -159, -159, -159, -159, -155, -154, -152, -150, -147, -147, -150, -154, -154, -148, -142, -142, -147, -152, -155, -151, -144, -137, -135, -144, -156, -164, -164, -164, -157, -146, -132, -125, -127, -137, -150, -156, -155, -150, -143, -134, -129, -125, -122, -120, -127, -135, -141, -141, -139, -134, -124, -119, -118, -121, -129, -135, -139, -135, -127, -121, -122, -121, -117, -115, -115, -120, -121, -119, -113, -108, -108, -103, -98, -95, -96, -98, -98, -101, -99, -99, -102, -108, -113, -114, -111, -105, -98, -96, -102, -110, -115, -118, -124, -126, -125, -121, -117, -111, -105, -99, -101, -107, -115, -119, -121, -118, -110, -99, -92, -94, -102, -109, -113, -112, -109, -109, -108, -105, -100, -100, -100, -99, -100, -103, -106, -108, -104, -100, -98, -97, -102, -111, -119, -121, -119, -112, -107, -105, -108, -112, -115, -118, -120, -121, -121, -120, -122, -121, -121, -119, -116, -111, -111, -113, -114, -117, -118, -119, -118, -118, -118, -120, -120, -119, -117, -118, -118, -117, -112, -109, -108, -112, -118, -128, -133, -128, -114, -104, -100, -103, -108, -117, -126, -131, -131, -128, -124, -117, -115, -113, -114, -116, -122, -128, -131, -128, -124, -116, -110, -106, -105, -107, -114, -120, -121, -117, -115, -114, -110, -102, -97, -96, -102, -110, -117, -118, -114, -110, -107, -109, -112, -118, -121, -122, -119, -115, -111, -111, -112, -112, -114, -116, -114, -111, -110, -108, -108, -107, -107, -112, -118, -121, -119, -115, -113, -117, -122, -123, -123, -123, -127, -132, -136, -134, -129, -118, -111, -113, -121, -131, -138, -142, -141, -138, -130, -122, -115, -111, -114, -121, -129, -133, -136, -134, -132, -131, -129, -128, -127, -131, -134, -132, -131, -131, -133, -132, -133, -136, -138, -142, -143, -147, -151, -154, -152, -148, -147, -149, -150, -148, -147, -149, -153, -157, -162, -165, -163, -156, -153, -154, -155, -153, -153, -157, -159, -159, -155, -152, -149, -149, -151, -153, -151, -151, -151, -152, -148, -141, -138, -143, -149, -155, -158, -156, -149, -138, -132, -128, -132, -139, -149, -157, -166, -166, -157, -145, -138, -132, -127, -126, -134, -146, -156, -157, -153, -145, -137, -131, -129, -129, -135, -142, -143, -141, -137, -133, -126, -123, -121, -123, -124, -130, -135, -136, -131, -125, -122, -124, -127, -127, -127, -126, -125, -126, -126, -123, -118, -113, -112, -114, -116, -115, -109, -105, -104, -111, -118, -122, -120, -116, -113, -113, -112, -109, -103, -100, -102, -109, -119, -128, -131, -129, -126, -121, -114, -108, -105, -110, -118, -124, -126, -125, -118, -107, -100, -96, -98, -107, -115, -121, -121, -117, -113, -111, -111, -109, -108, -109, -108, -106, -107, -109, -112, -116, -116, -114, -113, -113, -116, -121, -126, -126, -123, -121, -120, -121, -123, -126, -127, -127, -128, -129, -129, -128, -125, -123, -122, -128, -136, -137, -133, -125, -118, -113, -114, -119, -125, -130, -131, -130, -130, -130, -130, -126, -119, -116, -118, -125, -131, -135, -131, -129, -125, -119, -116, -117, -123, -126, -129, -129, -131, -132, -134, -134, -134, -134, -133, -130, -127, -128, -129, -131, -132, -130, -125, -120, -118, -120, -119, -120, -123, -126, -125, -126, -127, -127, -124, -119, -113, -108, -111, -118, -124, -127, -125, -122, -120, -122, -119, -114, -116, -122, -125, -124, -119, -117, -117, -119, -122, -120, -118, -114, -111, -111, -117, -122, -121, -117, -116, -114, -116, -118, -122, -123, -120, -121, -129, -138, -143, -143, -138, -132, -126, -121, -119, -123, -128, -133, -142, -146, -143, -135, -129, -124, -123, -123, -127, -135, -141, -146, -147, -145, -140, -137, -135, -135, -134, -135, -138, -145, -150, -147, -139, -133, -134, -139, -144, -148, -151, -154, -156, -154, -151, -149, -150, -154, -154, -152, -153, -156, -160, -162, -158, -154, -156, -165, -171, -174, -173, -171, -165, -158, -155, -153, -154, -156, -161, -163, -162, -159, -157, -156, -154, -152, -152, -152, -154, -156, -159, -162, -159, -151, -142, -138, -140, -149, -156, -159, -158, -159, -161, -162, -156, -146, -136, -129, -131, -139, -149, -156, -155, -152, -149, -145, -138, -134, -129, -130, -136, -141, -139, -133, -133, -133, -131, -127, -125, -124, -128, -135, -137, -136, -132, -130, -129, -130, -129, -128, -126, -124, -122, -117, -114, -112, -112, -112, -114, -115, -118, -115, -111, -108, -105, -105, -109, -115, -116, -119, -121, -120, -114, -107, -103, -104, -106, -113, -123, -129, -129, -123, -115, -108, -104, -103, -111, -118, -121, -117, -114, -111, -109, -102, -95, -94, -99, -106, -113, -114, -110, -107, -102, -100, -98, -95, -97, -101, -105, -103, -99, -101, -107, -110, -108, -106, -103, -104, -109, -115, -119, -116, -112, -111, -112, -114, -115, -116, -117, -118, -118, -116, -115, -113, -117, -124, -130, -128, -118, -110, -108, -113, -116, -115, -114, -116, -119, -120, -121, -118, -115, -118, -122, -121, -113, -108, -110, -116, -120, -119, -117, -115, -116, -113, -110, -107, -107, -109, -114, -120, -124, -127, -126, -123, -121, -117, -114, -111, -112, -117, -124, -128, -128, -124, -116, -112, -109, -107, -109, -117, -121, -122, -119, -117, -116, -112, -108, -102, -98, -100, -109, -116, -120, -116, -112, -110, -109, -109, -106, -106, -111, -114, -115, -111, -109, -109, -112, -113, -113, -113, -117, -118, -113, -106, -105, -107, -108, -109, -108, -108, -109, -113, -114, -112, -107, -104, -112, -124, -135, -138, -133, -126, -120, -117, -117, -120, -125, -134, -142, -146, -141, -130, -121, -119, -119, -125, -131, -138, -140, -138, -135, -133, -128, -124, -120, -120, -122, -131, -140, -143, -140, -134, -128, -126, -128, -133, -137, -141, -143, -146, -146, -146, -148, -150, -153, -152, -151, -151, -155, -156, -156, -155, -154, -156, -157, -162, -166, -169, -167, -163, -158, -154, -151, -148, -150, -154, -157, -160, -160, -160, -157, -154, -154, -153, -153, -154, -153, -155, -157, -156, -150, -145, -143, -143, -145, -148, -153, -153, -153, -158, -162, -159, -147, -136, -130, -133, -141, -150, -155, -158, -158, -155, -151, -142, -136, -133, -134, -139, -146, -152, -155, -154, -144, -130, -118, -114, -118, -123, -129, -135, -136, -134, -131, -129, -127, -127, -124, -120, -116, -116, -120, -123, -124, -119, -117, -120, -123, -125, -127, -125, -118, -111, -111, -115, -121, -122, -121, -119, -120, -116, -110, -104, -98, -95, -101, -109, -116, -118, -119, -121, -121, -117, -113, -111, -114, -118, -121, -122, -121, -116, -110, -104, -104, -108, -114, -120, -120, -117, -112, -110, -109, -103, -98, -98, -102, -106, -106, -107, -108, -109, -108, -104, -102, -101, -105, -109, -113, -119, -123, -125, -125, -123, -121, -119, -120, -120, -122, -122, -122, -121, -122, -122, -124, -124, -125, -125, -125, -127, -124, -116, -107, -105, -110, -120, -129, -131, -130, -127, -127, -126, -124, -118, -117, -120, -129, -134, -135, -131, -128, -126, -122, -118, -115, -114, -116, -121, -129, -133, -132, -128, -126, -125, -122, -118, -117, -120, -128, -134, -136, -134, -130, -124, -119, -118, -118, -122, -130, -136, -136, -130, -125, -122, -120, -119, -118, -117, -114, -113, -113, -113, -113, -115, -117, -120, -118, -110, -103, -103, -112, -120, -124, -124, -123, -123, -122, -121, -121, -119, -121, -123, -121, -114, -108, -107, -109, -111, -113, -115, -118, -120, -120, -118, -113, -110, -112, -121, -132, -135, -132, -129, -128, -126, -124, -124, -128, -135, -136, -136, -137, -138, -138, -133, -129, -130, -134, -139, -140, -139, -135, -131, -127, -122, -120, -121, -126, -132, -140, -145, -149, -145, -132, -119, -115, -121, -130, -137, -144, -149, -151, -152, -152, -152, -149, -145, -146, -152, -158, -160, -158, -155, -152, -151, -155, -162, -167, -168, -165, -163, -158, -153, -147, -147, -149, -153, -159, -162, -161, -157, -154, -153, -153, -151, -150, -153, -153, -152, -151, -154, -153, -149, -143, -140, -145, -152, -153, -152, -149, -149, -148, -144, -140, -136, -135, -139, -146, -150, -151, -151, -154, -156, -153, -149, -144, -143, -146, -152, -154, -154, -154, -150, -143, -136, -131, -126, -119, -116, -121, -128, -133, -134, -133, -130, -129, -125, -118, -111, -110, -115, -122, -126, -128, -127, -124, -123, -122, -123, -125, -123, -118, -112, -111, -114, -119, -123, -124, -122, -121, -119, -114, -108, -103, -100, -99, -103, -114, -125, -128, -125, -119, -114, -112, -110, -110, -112, -114, -119, -124, -124, -116, -104, -102, -108, -115, -119, -116, -112, -110, -109, -105, -100, -95, -94, -95, -101, -108, -114, -113, -108, -100, -91, -88, -92, -101, -106, -109, -112, -118, -122, -121, -118, -116, -117, -119, -120, -121, -121, -120, -118, -117, -117, -119, -119, -120, -124, -125, -122, -112, -104, -100, -104, -113, -118, -123, -127, -129, -129, -128, -126, -123, -122, -122, -124, -125, -126, -128, -127, -128, -128, -126, -119, -115, -111, -109, -112, -119, -127, -129, -125, -121, -120, -122, -122, -117, -113, -117, -125, -134, -135, -126, -118, -116, -118, -120, -124, -127, -128, -127, -125, -124, -120, -116, -113, -113, -111, -110, -111, -116, -119, -120, -120, -118, -115, -111, -106, -105, -110, -118, -123, -125, -124, -125, -124, -124, -124, -124, -123, -124, -125, -119, -110, -107, -112, -121, -125, -124, -119, -113, -112, -110, -107, -104, -108, -117, -128, -135, -135, -127, -120, -116, -118, -119, -120, -122, -129, -137, -139, -134, -126, -121, -121, -127, -134, -136, -135, -134, -133, -132, -127, -123, -120, -123, -128, -136, -141, -144, -146, -145, -139, -128, -122, -123, -129, -136, -142, -144, -142, -140, -143, -152, -156, -159, -159, -159, -159, -158, -155, -154, -153, -154, -154, -157, -165, -168, -166, -160, -156, -150, -146, -145, -148, -150, -156, -163, -169, -167, -158, -147, -142, -144, -148, -152, -153, -151, -151, -153, -153, -149, -144, -141, -141, -144, -149, -150, -149, -147, -146, -144, -141, -138, -138, -140, -148, -153, -154, -153, -156, -159, -158, -153, -147, -144, -144, -151, -157, -157, -154, -150, -147, -142, -136, -131, -127, -124, -124, -129, -133, -136, -135, -133, -130, -124, -117, -115, -115, -115, -118, -122, -126, -126, -126, -126, -123, -123, -124, -123, -123, -120, -116, -110, -109, -110, -113, -113, -113, -113, -112, -105, -100, -98, -97, -98, -101, -108, -113, -118, -120, -121, -118, -115, -111, -112, -116, -121, -127, -125, -120, -115, -112, -112, -113, -114, -112, -110, -107, -109, -112, -110, -104, -100, -100, -101, -101, -102, -105, -112, -115, -112, -102, -94, -93, -99, -103, -107, -113, -120, -124, -126, -123, -120, -116, -114, -114, -115, -116, -117, -115, -114, -114, -115, -115, -120, -126, -127, -122, -117, -114, -113, -113, -114, -119, -126, -132, -136, -131, -122, -116, -117, -118, -114, -112, -114, -121, -125, -129, -125, -117, -111, -109, -111, -110, -114, -121, -131, -138, -137, -129, -120, -118, -121, -124, -126, -126, -124, -126, -130, -130, -125, -120, -116, -114, -116, -121, -127, -128, -126, -123, -123, -122, -118, -113, -111, -113, -115, -117, -118, -119, -117, -115, -117, -116, -114, -109, -107, -108, -112, -119, -123, -126, -126, -124, -124, -123, -121, -120, -121, -122, -120, -117, -114, -115, -119, -121, -121, -119, -117, -115, -115, -114, -115, -117, -121, -126, -131, -128, -124, -120, -119, -120, -122, -123, -124, -123, -123, -127, -135, -142, -145, -145, -145, -144, -144, -141, -138, -137, -136, -133, -130, -128, -128, -127, -129, -134, -140, -141, -143, -144, -136, -126, -122, -126, -131, -132, -129, -129, -130, -133, -134, -137, -141, -145, -150, -154, -149, -141, -140, -149, -158, -160, -157, -156, -161, -164, -165, -162, -157, -149, -146, -152, -159, -163, -163, -161, -156, -149, -144, -139, -135, -133, -138, -143, -146, -147, -146, -146, -149, -148, -145, -140, -140, -146, -149, -151, -151, -149, -143, -140, -138, -138, -141, -147, -152, -151, -150, -152, -156, -154, -150, -144, -141, -141, -147, -152, -155, -154, -151, -144, -138, -135, -136, -138, -137, -136, -137, -140, -143, -142, -139, -136, -132, -127, -121, -117, -116, -120, -126, -132, -137, -139, -139, -138, -135, -131, -127, -127, -127, -125, -119, -113, -111, -112, -113, -113, -113, -114, -112, -108, -104, -102, -101, -103, -109, -113, -118, -120, -120, -119, -114, -107, -102, -106, -114, -122, -126, -125, -120, -118, -121, -125, -126, -123, -118, -113, -109, -109, -106, -103, -100, -103, -104, -106, -111, -118, -120, -115, -105, -96, -92, -96, -105, -110, -111, -111, -117, -122, -123, -120, -116, -114, -115, -116, -118, -118, -118, -118, -119, -120, -120, -119, -116, -114, -114, -113, -110, -105, -102, -102, -113, -124, -133, -134, -131, -122, -115, -111, -111, -113, -117, -122, -124, -122, -122, -123, -124, -123, -122, -119, -115, -113, -118, -122, -123, -121, -121, -123, -129, -131, -128, -118, -111, -111, -113, -114, -117, -124, -130, -134, -135, -130, -124, -122, -124, -127, -126, -122, -115, -112, -112, -114, -113, -111, -109, -111, -113, -113, -114, -113, -111, -106, -102, -101, -103, -110, -117, -123, -124, -121, -117, -118, -122, -125, -122, -119, -117, -116, -118, -122, -125, -127, -124, -118, -112, -108, -105, -101, -96, -92, -94, -104, -117, -127, -131, -128, -120, -109, -102, -98, -101, -110, -122, -127, -127, -125, -126, -128, -129, -133, -136, -139, -139, -138, -135, -132, -129, -126, -125, -127, -130, -135, -134, -128, -123, -124, -128, -133, -138, -142, -143, -142, -140, -139, -140, -141, -143, -146, -146, -148, -153, -162, -169, -169, -162, -157, -160, -164, -168, -171, -171, -170, -167, -166, -165, -164, -160, -153, -152, -155, -161, -164, -164, -163, -157, -153, -152, -154, -155, -154, -153, -151, -149, -150, -151, -154, -157, -160, -160, -155, -150, -147, -148, -153, -159, -160, -156, -150, -148, -148, -149, -146, -144, -146, -151, -156, -158, -157, -155, -154, -153, -151, -150, -147, -145, -141, -134, -130, -128, -125, -127, -126, -127, -129, -138, -142, -141, -141, -137, -132, -124, -119, -119, -121, -123, -126, -129, -132, -131, -129, -130, -134, -133, -130, -127, -121, -118, -116, -116, -117, -117, -118, -118, -117, -116, -113, -111, -107, -107, -109, -112, -113, -115, -115, -114, -113, -111, -109, -106, -101, -100, -104, -106, -104, -101, -100, -100, -105, -116, -124, -126, -121, -115, -107, -104, -108, -116, -119, -112, -106, -103, -104, -107, -110, -117, -120, -123, -123, -118, -110, -102, -102, -103, -106, -108, -114, -119, -124, -124, -122, -116, -111, -105, -102, -105, -113, -120, -124, -127, -126, -123, -119, -113, -109, -109, -113, -113, -109, -107, -109, -114, -116, -114, -108, -107, -109, -112, -113, -108, -106, -106, -107, -107, -109, -112, -115, -117, -115, -114, -116, -116, -112, -110, -110, -109, -109, -111, -111, -111, -112, -115, -119, -122, -125, -122, -116, -111, -108, -108, -113, -122, -129, -130, -129, -130, -132, -132, -126, -119, -112, -109, -112, -114, -120, -127, -133, -136, -138, -135, -129, -123, -118, -118, -119, -127, -132, -133, -132, -132, -132, -131, -128, -127, -128, -126, -121, -116, -111, -109, -112, -121, -129, -128, -122, -117, -111, -107, -105, -105, -106, -110, -116, -123, -128, -129, -126, -122, -122, -127, -125, -117, -112, -113, -121, -129, -137, -140, -140, -137, -135, -134, -131, -129, -130, -131, -129, -128, -134, -138, -139, -136, -135, -136, -143, -147, -149, -148, -148, -148, -148, -145, -141, -140, -142, -147, -149, -149, -147, -145, -146, -150, -156, -159, -162, -164, -166, -164, -158, -153, -150, -150, -148, -148, -147, -145, -145, -146, -149, -151, -154, -154, -151, -145, -142, -140, -140, -140, -139, -137, -136, -139, -144, -148, -150, -151, -148, -144, -143, -144, -147, -154, -159, -160, -156, -147, -139, -138, -142, -147, -147, -144, -137, -134, -133, -135, -141, -148, -155, -158, -155, -150, -145, -142, -141, -142, -142, -138, -137, -141, -146, -150, -149, -148, -147, -143, -138, -135, -137, -140, -142, -140, -135, -129, -125, -122, -120, -116, -113, -115, -123, -130, -135, -132, -130, -128, -123, -116, -113, -111, -108, -106, -110, -117, -123, -123, -119, -120, -123, -127, -123, -111, -101, -100, -110, -117, -115, -109, -108, -113, -119, -117, -114, -115, -121, -128, -128, -125, -123, -121, -120, -119, -117, -117, -114, -111, -108, -108, -106, -108, -115, -119, -118, -116, -114, -114, -114, -115, -113, -108, -101, -99, -101, -108, -115, -118, -119, -119, -119, -115, -113, -113, -122, -129, -132, -129, -122, -118, -116, -117, -118, -120, -123, -122, -117, -112, -109, -111, -111, -113, -115, -114, -110, -103, -97, -93, -95, -101, -105, -102, -96, -91, -92, -95, -100, -101, -103, -109, -117, -122, -123, -122, -119, -115, -111, -115, -121, -126, -128, -126, -123, -124, -127, -133, -136, -133, -124, -117, -114, -116, -119, -119, -114, -106, -105, -112, -121, -123, -120, -115, -111, -112, -118, -126, -132, -129, -118, -109, -110, -119, -122, -117, -113, -115, -121, -127, -127, -125, -119, -118, -123, -128, -131, -131, -130, -127, -124, -121, -120, -122, -125, -124, -121, -117, -115, -111, -109, -117, -127, -135, -130, -120, -111, -108, -108, -112, -119, -125, -130, -134, -134, -133, -129, -129, -131, -137, -136, -129, -126, -135, -147, -153, -153, -146, -135, -129, -128, -130, -132, -132, -133, -133, -137, -143, -147, -146, -146, -144, -144, -145, -144, -142, -143, -144, -145, -147, -153, -161, -167, -167, -161, -154, -148, -144, -140, -139, -142, -146, -144, -139, -138, -142, -146, -147, -146, -146, -151, -157, -159, -160, -156, -151, -145, -140, -136, -137, -142, -146, -147, -139, -131, -125, -128, -132, -137, -143, -146, -147, -144, -139, -137, -140, -143, -148, -149, -149, -148, -147, -144, -141, -139, -139, -143, -148, -148, -147, -143, -142, -138, -135, -132, -130, -129, -131, -135, -131, -121, -113, -114, -121, -129, -138, -141, -139, -135, -134, -134, -132, -123, -116, -115, -123, -132, -138, -136, -132, -129, -130, -134, -136, -139, -137, -133, -127, -126, -131, -134, -135, -134, -128, -119, -111, -117, -130, -137, -135, -129, -125, -126, -125, -123, -119, -116, -116, -118, -119, -119, -123, -129, -133, -132, -127, -122, -121, -120, -121, -122, -123, -124, -124, -126, -131, -134, -131, -124, -120, -119, -120, -116, -114, -118, -126, -128, -127, -122, -121, -122, -123, -121, -118, -116, -115, -117, -117, -115, -116, -119, -127, -132, -131, -126, -120, -114, -114, -117, -121, -122, -122, -120, -119, -118, -115, -111, -108, -108, -109, -111, -109, -104, -98, -96, -98, -102, -104, -104, -105, -103, -100, -93, -88, -86, -90, -94, -101, -108, -113, -113, -108, -100, -93, -90, -91, -94, -95, -94, -97, -107, -117, -120, -120, -116, -112, -109, -106, -106, -107, -103, -98, -96, -102, -109, -114, -115, -115, -114, -108, -102, -98, -94, -98, -108, -116, -116, -118, -122, -120, -110, -98, -94, -102, -117, -127, -131, -128, -124, -123, -122, -123, -121, -122, -122, -124, -124, -123, -119, -117, -120, -121, -119, -116, -119, -125, -128, -127, -126, -123, -125, -128, -131, -130, -128, -130, -131, -131, -131, -134, -139, -145, -150, -154, -151, -144, -138, -135, -139, -145, -154, -161, -165, -163, -155, -144, -136, -135, -140, -145, -147, -152, -160, -164, -158, -151, -149, -153, -158, -162, -163, -163, -156, -151, -147, -148, -150, -154, -156, -161, -166, -168, -163, -157, -155, -159, -162, -161, -158, -158, -160, -163, -165, -162, -158, -154, -152, -152, -152, -150, -146, -139, -136, -135, -135, -136, -137, -139, -136, -132, -132, -132, -132, -128, -125, -126, -133, -143, -147, -146, -141, -136, -133, -136, -136, -133, -128, -129, -136, -144, -146, -144, -142, -138, -136, -133, -131, -124, -118, -114, -113, -112, -114, -124, -131, -130, -125, -120, -121, -120, -118, -115, -119, -127, -135, -140, -140, -137, -134, -134, -134, -134, -132, -133, -132, -134, -137, -140, -143, -144, -145, -141, -132, -127, -126, -130, -130, -128, -126, -125, -120, -119, -129, -136, -139, -137, -134, -133, -131, -132, -130, -125, -122, -123, -126, -123, -115, -108, -111, -121, -128, -126, -118, -110, -107, -108, -110, -112, -109, -109, -116, -124, -121, -108, -98, -102, -113, -119, -113, -106, -105, -112, -121, -125, -121, -113, -110, -113, -111, -105, -96, -94, -100, -106, -107, -104, -104, -109, -116, -118, -116, -113, -116, -120, -124, -120, -112, -104, -102, -103, -106, -106, -105, -105, -108, -110, -108, -101, -95, -91, -94, -100, -103, -102, -101, -104, -105, -100, -93, -88, -90, -94, -99, -99, -97, -96, -93, -92, -90, -93, -100, -108, -113, -114, -113, -109, -105, -102, -105, -113, -120, -125, -126, -127, -125, -124, -119, -117, -118, -118, -117, -117, -122, -129, -132, -130, -123, -120, -121, -126, -130, -131, -128, -126, -124, -122, -116, -111, -114, -126, -138, -144, -145, -144, -142, -140, -138, -137, -138, -140, -141, -138, -136, -137, -144, -150, -148, -139, -130, -130, -137, -146, -151, -151, -146, -141, -141, -147, -155, -160, -153, -145, -139, -139, -140, -149, -164, -175, -174, -169, -162, -160, -164, -166, -164, -161, -161, -165, -169, -172, -171, -169, -166, -165, -165, -165, -165, -164, -163, -165, -169, -170, -167, -163, -158, -156, -154, -152, -151, -155, -161, -166, -170, -165, -157, -154, -156, -158, -157, -154, -156, -160, -159, -154, -147, -143, -142, -144, -145, -142, -134, -131, -132, -131, -126, -120, -122, -129, -134, -136, -134, -128, -121, -115, -109, -105, -100, -102, -112, -122, -126, -125, -118, -111, -102, -98, -95, -102, -117, -131, -129, -116, -102, -101, -110, -121, -124, -121, -119, -118, -117, -109, -104, -103, -105, -106, -104, -101, -98, -99, -101, -101, -100, -97, -97, -101, -105, -107, -107, -107, -108, -107, -104, -102, -103, -106, -111, -114, -112, -108, -110, -113, -117, -121, -122, -119, -117, -114, -111, -109, -107, -108, -114, -123, -126, -121, -109, -103, -103, -105, -106, -113, -125, -132, -135, -133, -130, -123, -115, -112, -114, -118, -122, -125, -124, -124, -123, -120, -116, -114, -117, -122, -126, -126, -122, -120, -126, -131, -127, -117, -113, -117, -124, -127, -125, -122, -120, -124, -132, -135, -133, -127, -126, -124, -118, -111, -107, -114, -124, -131, -129, -122, -120, -119, -118, -116, -119, -122, -128, -131, -132, -128, -122, -118, -119, -117, -113, -109, -109, -110, -112, -113, -111, -109, -108, -111, -113, -112, -111, -109, -107, -105, -103, -100, -100, -101, -106, -110, -113, -113, -113, -111, -107, -105, -105, -107, -109, -110, -116, -122, -127, -127, -126, -124, -123, -122, -121, -127, -134, -137, -131, -122, -122, -128, -134, -132, -127, -123, -124, -126, -128, -129, -128, -129, -129, -131, -134, -136, -137, -135, -134, -131, -128, -123, -120, -121, -122, -124, -129, -141, -152, -159, -156, -149, -142, -141, -143, -143, -139, -139, -143, -152, -158, -159, -149, -139, -136, -143, -152, -154, -149, -148, -151, -154, -156, -155, -151, -151, -151, -149, -144, -144, -150, -155, -156, -155, -158, -165, -174, -179, -177, -168, -163, -164, -167, -167, -165, -164, -163, -163, -162, -161, -159, -157, -156, -161, -164, -165, -161, -156, -149, -146, -144, -144, -149, -155, -157, -158, -155, -154, -153, -152, -154, -158, -164, -165, -160, -151, -146, -145, -145, -143, -139, -139, -144, -149, -150, -142, -131, -121, -118, -124, -134, -140, -139, -136, -132, -127, -120, -116, -114, -113, -111, -114, -118, -115, -110, -104, -102, -103, -106, -111, -112, -110, -107, -104, -99, -90, -87, -93, -107, -118, -121, -119, -113, -105, -98, -97, -102, -110, -118, -123, -118, -110, -100, -94, -95, -96, -99, -100, -100, -100, -102, -103, -102, -98, -96, -100, -108, -112, -113, -110, -107, -105, -102, -99, -96, -102, -111, -120, -123, -123, -119, -117, -117, -117, -114, -111, -111, -117, -124, -127, -126, -123, -119, -115, -112, -115, -115, -112, -113, -118, -124, -125, -122, -116, -114, -115, -116, -114, -111, -107, -107, -114, -121, -124, -126, -126, -128, -129, -129, -126, -124, -125, -124, -124, -122, -120, -118, -119, -120, -119, -121, -126, -131, -133, -128, -126, -127, -126, -122, -118, -117, -119, -124, -126, -125, -120, -118, -121, -125, -124, -120, -117, -117, -121, -124, -125, -127, -130, -133, -133, -127, -117, -109, -108, -111, -116, -118, -120, -122, -123, -122, -117, -115, -113, -112, -108, -105, -103, -104, -107, -108, -105, -102, -103, -110, -118, -122, -119, -111, -106, -104, -106, -109, -116, -121, -127, -129, -130, -128, -124, -120, -119, -122, -129, -134, -137, -138, -134, -125, -116, -111, -115, -122, -126, -125, -126, -127, -126, -126, -127, -130, -132, -136, -137, -137, -136, -132, -128, -122, -116, -113, -113, -117, -125, -137, -146, -149, -145, -139, -137, -137, -141, -147, -148, -144, -141, -140, -144, -150, -156, -158, -158, -156, -154, -152, -152, -151, -150, -150, -149, -151, -152, -152, -148, -143, -137, -135, -136, -142, -147, -151, -153, -154, -156, -164, -169, -174, -177, -180, -177, -171, -164, -160, -161, -162, -161, -160, -159, -161, -163, -163, -163, -166, -168, -165, -157, -148, -143, -145, -150, -155, -157, -155, -157, -163, -169, -165, -159, -156, -154, -151, -147, -149, -156, -162, -162, -154, -148, -146, -148, -147, -140, -130, -124, -125, -132, -140, -142, -142, -141, -139, -135, -130, -124, -120, -113, -106, -106, -115, -124, -125, -117, -110, -109, -111, -112, -106, -100, -98, -106, -114, -114, -104, -96, -98, -103, -103, -97, -94, -99, -110, -117, -118, -111, -103, -101, -108, -111, -109, -103, -99, -99, -100, -100, -98, -97, -100, -103, -102, -99, -98, -102, -106, -108, -105, -101, -99, -100, -101, -103, -103, -102, -97, -96, -99, -107, -115, -119, -120, -117, -114, -109, -106, -107, -106, -109, -116, -124, -125, -118, -111, -105, -99, -96, -100, -111, -122, -128, -129, -124, -115, -106, -105, -109, -114, -116, -115, -115, -115, -112, -114, -118, -124, -127, -129, -129, -129, -129, -133, -132, -125, -114, -110, -114, -121, -125, -126, -127, -127, -124, -122, -124, -128, -130, -128, -124, -119, -118, -119, -122, -122, -122, -125, -134, -138, -133, -120, -112, -111, -115, -123, -128, -130, -132, -136, -138, -135, -126, -116, -110, -109, -111, -111, -113, -115, -119, -122, -125, -126, -125, -121, -116, -112, -109, -107, -106, -109, -112, -115, -116, -118, -119, -116, -110, -104, -101, -102, -105, -108, -111, -111, -111, -117, -123, -125, -125, -123, -118, -114, -113, -119, -129, -137, -138, -134, -126, -124, -124, -123, -125, -128, -130, -129, -127, -128, -131, -134, -133, -128, -128, -131, -137, -139, -136, -133, -131, -130, -125, -118, -114, -117, -129, -142, -151, -150, -146, -143, -144, -144, -139, -134, -133, -138, -148, -156, -157, -156, -153, -148, -144, -142, -142, -146, -149, -152, -154, -153, -153, -154, -153, -153, -151, -147, -142, -146, -152, -156, -152, -150, -156, -164, -170, -169, -169, -171, -171, -167, -161, -158, -156, -157, -159, -158, -157, -157, -159, -162, -164, -163, -160, -157, -156, -156, -155, -157, -156, -158, -159, -162, -163, -161, -161, -160, -161, -160, -160, -160, -158, -154, -150, -152, -156, -157, -155, -154, -155, -153, -145, -135, -128, -130, -135, -138, -141, -145, -148, -146, -142, -135, -128, -123, -122, -122, -122, -120, -118, -119, -121, -118, -109, -101, -100, -106, -112, -117, -116, -110, -102, -95, -93, -98, -107, -113, -112, -106, -104, -108, -111, -108, -100, -94, -99, -110, -118, -118, -111, -106, -101, -98, -97, -96, -96, -98, -102, -103, -97, -89, -89, -96, -105, -108, -108, -109, -107, -104, -99, -96, -98, -99, -97, -101, -109, -121, -126, -122, -114, -102, -93, -94, -100, -108, -111, -111, -111, -113, -117, -116, -111, -105, -101, -102, -109, -116, -121, -120, -121, -120, -118, -114, -115, -114, -111, -106, -105, -104, -105, -108, -116, -123, -128, -127, -125, -121, -121, -125, -128, -127, -124, -121, -117, -114, -115, -116, -116, -123, -131, -134, -131, -122, -116, -115, -116, -118, -121, -124, -128, -131, -131, -126, -123, -124, -126, -125, -123, -123, -123, -123, -126, -132, -134, -131, -128, -129, -135, -138, -133, -123, -114, -110, -111, -115, -119, -122, -124, -122, -121, -118, -115, -110, -107, -107, -108, -110, -110, -113, -116, -118, -114, -109, -109, -113, -121, -122, -116, -108, -105, -108, -111, -113, -116, -123, -126, -124, -117, -109, -108, -113, -122, -131, -132, -130, -130, -135, -137, -131, -119, -111, -114, -128, -139, -144, -141, -134, -126, -119, -116, -117, -126, -135, -141, -141, -138, -133, -131, -126, -118, -111, -109, -116, -131, -143, -150, -147, -142, -139, -142, -144, -145, -144, -142, -140, -140, -138, -142, -150, -157, -159, -158, -155, -151, -147, -145, -142, -142, -144, -151, -157, -159, -156, -152, -146, -143, -142, -142, -143, -147, -155, -163, -169, -172, -171, -168, -171, -176, -177, -171, -162, -153, -146, -146, -154, -164, -170, -170, -166, -162, -156, -152, -149, -150, -152, -155, -159, -161, -161, -160, -159, -156, -156, -156, -158, -160, -160, -159, -158, -155, -153, -153, -159, -169, -171, -164, -152, -143, -137, -131, -125, -123, -130, -140, -147, -151, -151, -149, -145, -140, -136, -131, -128, -127, -129, -131, -132, -130, -127, -121, -116, -112, -110, -109, -111, -111, -110, -105, -101, -100, -104, -111, -115, -113, -104, -93, -87, -90, -98, -105, -108, -111, -117, -124, -123, -115, -105, -100, -99, -99, -99, -98, -97, -97, -97, -99, -98, -97, -94, -90, -91, -96, -103, -106, -106, -104, -103, -103, -104, -105, -106, -106, -105, -106, -113, -118, -115, -111, -106, -104, -106, -109, -111, -108, -104, -101, -106, -109, -109, -104, -97, -90, -91, -99, -110, -120, -123, -122, -118, -116, -114, -114, -112, -110, -107, -106, -104, -107, -111, -116, -120, -120, -119, -116, -115, -118, -119, -120, -119, -120, -118, -114, -111, -110, -114, -123, -129, -127, -121, -115, -114, -116, -124, -134, -139, -137, -130, -125, -121, -121, -120, -121, -120, -120, -119, -121, -120, -119, -121, -126, -130, -129, -129, -132, -133, -135, -133, -125, -117, -113, -113, -115, -118, -121, -123, -125, -128, -133, -132, -122, -111, -105, -103, -107, -112, -116, -117, -117, -117, -118, -117, -115, -118, -116, -113, -109, -110, -112, -115, -117, -118, -116, -114, -113, -114, -115, -120, -126, -129, -129, -125, -126, -131, -137, -138, -128, -118, -117, -122, -127, -127, -129, -132, -136, -139, -140, -136, -128, -121, -120, -125, -132, -138, -140, -140, -141, -141, -132, -120, -112, -115, -128, -140, -149, -149, -148, -146, -144, -139, -137, -136, -138, -139, -141, -146, -151, -153, -148, -142, -139, -142, -150, -157, -161, -158, -154, -150, -150, -151, -154, -160, -163, -160, -151, -143, -139, -140, -148, -157, -165, -167, -168, -167, -165, -161, -158, -153, -150, -151, -159, -166, -172, -172, -169, -166, -162, -159, -157, -158, -159, -162, -163, -164, -161, -159, -159, -161, -161, -161, -160, -161, -162, -160, -158, -156, -156, -157, -157, -155, -154, -156, -157, -157, -156, -152, -148, -143, -139, -134, -132, -137, -142, -144, -145, -148, -147, -145, -141, -136, -131, -128, -128, -129, -129, -125, -123, -120, -121, -120, -115, -110, -106, -105, -103, -101, -99, -103, -109, -113, -111, -106, -100, -100, -100, -100, -98, -97, -106, -117, -121, -115, -108, -102, -100, -102, -107, -109, -105, -99, -95, -98, -104, -109, -108, -98, -89, -84, -86, -92, -101, -107, -108, -107, -105, -104, -102, -102, -101, -101, -100, -105, -113, -119, -116, -108, -101, -97, -101, -106, -107, -102, -98, -97, -101, -103, -100, -94, -91, -95, -101, -108, -115, -120, -122, -120, -117, -115, -116, -120, -122, -121, -114, -106, -99, -100, -109, -117, -122, -122, -120, -117, -117, -115, -114, -113, -113, -116, -117, -120, -122, -123, -117, -110, -108, -114, -122, -125, -121, -117, -118, -126, -133, -131, -126, -120, -119, -121, -124, -125, -123, -122, -121, -123, -123, -122, -121, -123, -127, -128, -129, -132, -134, -134, -133, -131, -128, -124, -118, -115, -115, -118, -122, -124, -128, -129, -127, -121, -115, -111, -111, -114, -117, -117, -116, -115, -115, -116, -119, -119, -118, -115, -111, -107, -108, -110, -114, -117, -117, -118, -117, -115, -114, -115, -118, -119, -119, -121, -127, -131, -133, -131, -131, -134, -137, -136, -129, -124, -126, -133, -141, -143, -143, -140, -133, -124, -115, -115, -120, -128, -138, -141, -142, -140, -134, -123, -113, -111, -118, -127, -134, -137, -140, -145, -147, -144, -135, -132, -139, -146, -149, -145, -139, -136, -139, -142, -141, -143, -146, -151, -155, -154, -149, -143, -142, -144, -146, -151, -156, -161, -164, -160, -153, -142, -137, -139, -148, -158, -163, -163, -161, -160, -160, -160, -154, -147, -150, -157, -164, -164, -160, -157, -156, -157, -157, -156, -154, -154, -156, -161, -166, -167, -162, -158, -155, -156, -158, -159, -161, -160, -158, -157, -154, -153, -152, -153, -154, -153, -149, -151, -159, -166, -163, -154, -146, -142, -140, -139, -136, -136, -139, -147, -154, -156, -151, -145, -140, -138, -137, -134, -133, -132, -129, -120, -111, -111, -116, -123, -127, -127, -121, -114, -108, -104, -104, -104, -106, -114, -122, -126, -122, -113, -102, -97, -94, -96, -101, -107, -112, -114, -114, -110, -106, -103, -102, -104, -108, -112, -112, -113, -110, -105, -99, -93, -91, -93, -99, -108, -115, -117, -114, -109, -105, -104, -105, -107, -108, -108, -107, -107, -107, -107, -104, -102, -106, -114, -118, -115, -109, -103, -100, -100, -102, -105, -101, -99, -100, -103, -105, -108, -113, -116, -118, -117, -114, -112, -112, -118, -118, -112, -102, -96, -100, -108, -116, -118, -116, -112, -111, -111, -111, -110, -111, -113, -118, -121, -124, -123, -119, -113, -109, -112, -115, -117, -115, -113, -110, -113, -121, -129, -137, -138, -130, -123, -116, -116, -117, -120, -120, -120, -121, -122, -123, -121, -119, -118, -119, -124, -126, -127, -129, -132, -135, -134, -127, -116, -106, -104, -111, -121, -129, -131, -130, -126, -127, -129, -129, -125, -121, -116, -115, -115, -114, -111, -110, -114, -121, -123, -121, -113, -106, -103, -106, -109, -112, -119, -126, -129, -123, -115, -111, -110, -114, -117, -123, -129, -133, -134, -131, -132, -132, -128, -121, -117, -118, -125, -134, -139, -139, -137, -134, -131, -121, -113, -112, -119, -126, -130, -130, -134, -139, -144, -142, -131, -122, -119, -123, -127, -129, -131, -135, -140, -145, -144, -143, -142, -145, -144, -140, -134, -132, -134, -137, -138, -139, -141, -147, -152, -154, -151, -147, -143, -145, -148, -152, -155, -156, -158, -160, -162, -158, -150, -144, -146, -150, -154, -155, -155, -153, -154, -157, -160, -156, -150, -147, -151, -156, -159, -160, -159, -158, -156, -155, -155, -155, -156, -159, -166, -171, -169, -161, -156, -154, -155, -156, -159, -162, -164, -164, -163, -161, -159, -157, -155, -154, -153, -153, -156, -158, -159, -156, -153, -151, -148, -145, -141, -141, -144, -149, -150, -147, -145, -148, -150, -151, -148, -145, -140, -135, -129, -122, -117, -120, -126, -130, -131, -127, -119, -107, -100, -98, -101, -104, -110, -115, -120, -122, -118, -111, -102, -98, -99, -102, -105, -110, -114, -115, -113, -111, -107, -107, -110, -113, -111, -108, -106, -106, -105, -107, -108, -103, -95, -90, -89, -93, -100, -106, -109, -108, -106, -105, -105, -105, -104, -102, -100, -100, -101, -105, -108, -107, -103, -99, -101, -110, -115, -113, -105, -99, -97, -97, -96, -93, -93, -98, -102, -105, -110, -113, -115, -116, -115, -114, -112, -113, -116, -119, -119, -116, -111, -109, -110, -111, -109, -107, -107, -106, -106, -107, -109, -112, -114, -115, -118, -118, -118, -115, -113, -113, -112, -109, -108, -107, -108, -114, -123, -132, -136, -135, -128, -120, -116, -116, -120, -123, -125, -126, -126, -128, -128, -125, -123, -122, -122, -121, -124, -133, -143, -148, -146, -140, -134, -128, -121, -113, -110, -114, -122, -128, -129, -128, -128, -132, -132, -128, -120, -115, -112, -115, -115, -115, -112, -113, -114, -118, -120, -116, -112, -110, -112, -113, -116, -118, -118, -118, -123, -127, -128, -124, -119, -116, -116, -117, -121, -128, -132, -136, -139, -137, -129, -123, -121, -126, -133, -140, -141, -141, -139, -135, -127, -115, -109, -113, -122, -128, -132, -134, -135, -139, -139, -131, -117, -109, -114, -122, -128, -133, -136, -138, -139, -140, -138, -137, -137, -143, -145, -142, -134, -130, -131, -133, -135, -140, -145, -149, -149, -148, -144, -140, -139, -141, -144, -148, -152, -155, -155, -154, -153, -153, -155, -151, -146, -143, -145, -148, -151, -151, -152, -153, -155, -156, -152, -150, -150, -153, -155, -155, -153, -149, -149, -151, -154, -155, -158, -164, -171, -172, -165, -157, -153, -154, -159, -162, -165, -166, -167, -168, -167, -163, -158, -154, -153, -152, -153, -152, -152, -155, -158, -161, -161, -156, -151, -148, -146, -143, -144, -144, -148, -151, -155, -154, -153, -150, -147, -143, -140, -137, -134, -132, -129, -128, -126, -124, -122, -123, -125, -123, -114, -105, -97, -97, -102, -111, -116, -121, -121, -117, -109, -104, -101, -99, -100, -105, -112, -117, -117, -116, -115, -108, -102, -102, -109, -117, -119, -115, -110, -107, -101, -94, -86, -85, -87, -96, -105, -113, -113, -109, -105, -102, -100, -101, -102, -104, -105, -105, -104, -101, -101, -104, -109, -114, -116, -113, -106, -99, -97, -95, -97, -99, -101, -101, -103, -101, -101, -101, -104, -109, -113, -113, -112, -111, -112, -113, -113, -116, -119, -120, -114, -108, -104, -103, -103, -104, -106, -107, -109, -110, -111, -112, -112, -114, -116, -117, -118, -115, -110, -105, -103, -106, -109, -114, -117, -118, -120, -124, -131, -133, -128, -124, -121, -123, -126, -130, -130, -130, -130, -129, -129, -128, -126, -124, -124, -124, -127, -132, -140, -146, -146, -138, -128, -117, -110, -109, -115, -122, -127, -127, -126, -128, -131, -133, -133, -127, -121, -116, -116, -117, -116, -114, -111, -109, -110, -114, -117, -113, -109, -106, -106, -107, -110, -110, -113, -120, -127, -129, -124, -118, -113, -110, -113, -119, -128, -132, -135, -136, -135, -130, -122, -116, -117, -127, -139, -144, -144, -138, -127, -120, -115, -113, -115, -119, -125, -131, -137, -139, -139, -136, -130, -120, -112, -111, -117, -124, -128, -132, -133, -134, -135, -137, -136, -138, -139, -139, -136, -131, -128, -128, -133, -140, -147, -152, -153, -149, -145, -141, -140, -141, -143, -146, -148, -151, -154, -154, -155, -154, -152, -154, -153, -149, -143, -142, -144, -149, -152, -155, -156, -156, -157, -156, -154, -152, -153, -156, -159, -160, -156, -153, -153, -154, -158, -160, -161, -160, -161, -162, -161, -159, -155, -156, -158, -161, -165, -167, -169, -169, -167, -162, -160, -157, -157, -155, -157, -158, -161, -161, -159, -155, -152, -152, -156, -158, -156, -153, -151, -151, -149, -150, -154, -156, -157, -157, -153, -149, -145, -141, -134, -127, -125, -127, -133, -136, -136, -129, -122, -115, -110, -104, -99, -101, -107, -116, -121, -122, -117, -108, -100, -98, -100, -102, -106, -111, -115, -117, -115, -112, -106, -105, -109, -117, -120, -118, -112, -107, -106, -106, -103, -94, -86, -84, -88, -97, -105, -108, -107, -103, -101, -98, -97, -99, -100, -102, -104, -104, -103, -102, -104, -108, -109, -107, -103, -100, -101, -102, -101, -99, -97, -100, -102, -103, -99, -96, -95, -93, -96, -100, -106, -110, -112, -113, -114, -113, -113, -115, -117, -120, -117, -112, -106, -104, -103, -104, -106, -107, -108, -109, -108, -111, -112, -112, -110, -112, -114, -115, -112, -108, -107, -108, -113, -116, -117, -117, -123, -131, -136, -134, -128, -123, -123, -126, -130, -132, -133, -131, -129, -128, -126, -124, -122, -123, -124, -124, -123, -126, -135, -140, -140, -131, -126, -126, -130, -127, -121, -116, -116, -123, -131, -137, -138, -136, -132, -128, -121, -116, -113, -114, -116, -118, -116, -115, -114, -114, -115, -117, -116, -110, -107, -107, -110, -113, -117, -122, -122, -121, -118, -118, -118, -117, -117, -120, -128, -132, -133, -131, -131, -127, -122, -120, -121, -125, -132, -137, -137, -130, -121, -116, -113, -115, -118, -121, -124, -129, -134, -138, -138, -129, -117, -108, -107, -112, -120, -129, -136, -142, -143, -141, -138, -138, -140, -139, -137, -133, -132, -132, -134, -135, -140, -145, -150, -152, -151, -147, -143, -141, -141, -142, -143, -146, -149, -151, -153, -153, -153, -153, -153, -148, -143, -140, -142, -145, -150, -153, -155, -155, -156, -155, -152, -151, -151, -151, -153, -152, -149, -147, -147, -151, -155, -159, -160, -160, -159, -158, -157, -158, -158, -159, -161, -162, -166, -167, -167, -169, -169, -168, -166, -163, -161, -160, -159, -160, -160, -161, -160, -158, -156, -157, -160, -160, -158, -150, -144, -139, -138, -141, -149, -157, -161, -159, -153, -147, -142, -139, -138, -137, -138, -137, -137, -134, -131, -127, -124, -121, -115, -112, -110, -106, -100, -97, -102, -108, -115, -119, -116, -110, -103, -102, -102, -102, -102, -105, -110, -116, -120, -119, -115, -111, -113, -115, -117, -115, -113, -111, -112, -112, -107, -95, -84, -84, -93, -104, -111, -111, -107, -101, -98, -95, -94, -96, -98, -102, -107, -107, -105, -103, -101, -100, -98, -100, -103, -105, -107, -106, -104, -100, -98, -101, -108, -109, -106, -101, -98, -96, -98, -104, -111, -113, -115, -115, -117, -117, -118, -117, -118, -114, -106, -101, -103, -109, -114, -116, -115, -113, -112, -113, -113, -113, -113, -114, -116, -118, -120, -118, -112, -109, -109, -109, -112, -116, -117, -116, -118, -126, -131, -130, -126, -124, -124, -126, -127, -132, -138, -141, -137, -131, -126, -123, -123, -125, -127, -127, -126, -129, -134, -138, -136, -133, -128, -122, -116, -110, -111, -117, -124, -128, -132, -135, -138, -138, -136, -129, -121, -115, -117, -120, -123, -122, -119, -118, -117, -117, -115, -116, -117, -116, -116, -114, -113, -117, -121, -123, -120, -113, -108, -106, -109, -110, -108, -111, -116, -123, -126, -127, -125, -123, -121, -121, -121, -125, -129, -129, -123, -118, -115, -114, -117, -122, -128, -131, -132, -132, -133, -127, -116, -104, -101, -105, -118, -133, -142, -142, -138, -132, -129, -127, -131, -135, -136, -134, -133, -132, -133, -132, -134, -140, -146, -151, -151, -149, -144, -141, -138, -139, -140, -145, -147, -150, -151, -150, -149, -147, -148, -149, -148, -146, -147, -154, -157, -155, -152, -151, -151, -153, -154, -152, -149, -150, -154, -154, -148, -144, -146, -150, -156, -159, -160, -161, -162, -163, -164, -164, -163, -163, -164, -165, -166, -165, -166, -167, -170, -171, -171, -170, -168, -166, -164, -162, -163, -162, -161, -162, -161, -161, -159, -156, -155, -153, -152, -150, -149, -147, -149, -153, -158, -163, -163, -159, -153, -148, -144, -142, -141, -139, -139, -138, -136, -133, -129, -125, -123, -118, -110, -106, -104, -106, -108, -112, -111, -110, -109, -108, -102, -98, -96, -98, -102, -104, -104, -104, -107, -112, -115, -114, -109, -108, -111, -113, -114, -110, -107, -105, -106, -108, -101, -92, -88, -93, -99, -104, -105, -104, -100, -97, -95, -94, -94, -95, -97, -100, -101, -101, -100, -101, -101, -101, -101, -101, -102, -103, -104, -105, -104, -102, -99, -103, -107, -107, -101, -96, -95, -96, -97, -103, -110, -115, -118, -118, -117, -116, -117, -117, -115, -111, -109, -110, -112, -114, -115, -113, -112, -112, -114, -114, -115, -115, -116, -117, -116, -117, -117, -121, -123, -119, -114, -110, -110, -111, -112, -118, -126, -133, -132, -127, -123, -122, -123, -124, -129, -133, -133, -131, -128, -125, -124, -124, -127, -129, -131, -132, -130, -132, -134, -135, -134, -133, -130, -125, -119, -117, -117, -118, -118, -120, -126, -135, -141, -143, -141, -133, -125, -118, -118, -120, -122, -124, -124, -122, -119, -118, -117, -117, -117, -117, -117, -117, -117, -121, -122, -116, -107, -103, -104, -108, -113, -114, -111, -111, -115, -120, -123, -125, -124, -122, -118, -114, -116, -126, -132, -132, -127, -123, -120, -118, -120, -126, -131, -131, -127, -122, -121, -117, -111, -108, -111, -119, -129, -137, -141, -138, -133, -129, -129, -132, -131, -129, -129, -131, -135, -137, -138, -137, -138, -141, -145, -145, -143, -141, -142, -140, -139, -137, -139, -143, -147, -148, -148, -148, -146, -144, -145, -147, -145, -145, -149, -156, -157, -153, -147, -144, -146, -148, -151, -150, -150, -151, -153, -151, -148, -146, -148, -152, -156, -157, -159, -159, -161, -161, -163, -162, -162, -163, -164, -167, -167, -168, -170, -171, -174, -173, -172, -170, -168, -166, -165, -165, -165, -165, -163, -162, -160, -159, -158, -161, -163, -162, -155, -150, -146, -149, -153, -153, -154, -155, -158, -158, -156, -151, -146, -142, -142, -143, -142, -141, -139, -135, -133, -130, -126, -117, -111, -107, -106, -108, -115, -118, -117, -114, -111, -109, -106, -101, -99, -99, -101, -103, -103, -107, -113, -117, -118, -115, -111, -106, -105, -110, -113, -115, -112, -111, -108, -106, -103, -104, -104, -103, -99, -92, -86, -80, -81, -87, -96, -101, -101, -101, -100, -99, -97, -96, -96, -97, -100, -102, -106, -105, -104, -103, -103, -104, -103, -102, -100, -100, -105, -108, -109, -106, -103, -99, -100, -103, -108, -110, -111, -110, -109, -109, -111, -109, -105, -104, -111, -121, -127, -126, -116, -107, -102, -103, -106, -110, -113, -115, -116, -116, -116, -114, -114, -117, -118, -115, -111, -108, -109, -113, -117, -119, -121, -122, -124, -127, -129, -129, -130, -130, -132, -131, -132, -132, -134, -135, -137, -136, -135, -132, -130, -128, -127, -130, -134, -139, -139, -135, -127, -121, -117, -118, -120, -122, -120, -121, -127, -137, -144, -143, -137, -127, -121, -121, -123, -126, -128, -127, -126, -125, -122, -120, -118, -116, -116, -115, -114, -112, -114, -119, -117, -111, -103, -102, -105, -111, -116, -115, -111, -110, -114, -121, -125, -126, -120, -115, -111, -113, -120, -124, -127, -125, -122, -124, -123, -129, -134, -132, -128, -116, -112, -108, -109, -108, -97, -110, -122, -132, -159, -158, -130, -112, -104, -101, -94, -92, -87, -87, -94, -102, -108, -114, -114, -118, -129, -134, -145, -150, -154, -144, -175, -154, -131, -169, -177, -156, -181, -215, -166, -185, -194, -192, -171, -153, -168, -193, -226, -221, -216, -197, -167, -150, -151, -163, -170, -148, -147, -148, -139, -161, -151, -143, -155, -120, -113, -120, -136, -138, -127, -113, -115, -140, -139, -118, -111, -125, -132, -143, -128, -123, -133, -107, -103, -139, -123, -130, -127, -111, -143, -145, -149, -140, -125, -122, -139, -170, -152, -140, -135, -131, -147, -151, -165, -158, -160, -149, -152, -174, -174, -171, -156, -141, -151, -175, -175, -175, -165, -154, -141, -135, -135, -139, -149, -144, -134, -143, -159, -161, -160, -143, -123, -115, -107, -103, -111, -114, -115, -129, -142, -144, -149, -152, -145, -147, -146, -141, -129, -131, -141, -132, -134, -137, -132, -127, -125, -136, -148, -137, -118, -112, -110, -110, -108, -117, -119, -105, -106, -102, -95, -100, -98, -89, -94, -101, -90, -86, -100, -100, -89, -88, -94, -92, -82, -81, -83, -91, -91, -85, -87, -79, -68, -65, -66, -76, -95, -101, -103, -101, -90, -92, -91, -90, -83, -80, -82, -89, -96, -94, -96, -88, -86, -85, -88, -91, -88, -83, -87, -94, -97, -97, -101, -105, -98, -100, -98, -88, -76, -84, -96, -89, -93, -106, -115, -120, -117, -116, -119, -110, -117, -118, -118, -129, -137, -141, -137, -136, -135, -137, -139, -140, -140, -140, -134, -139, -145, -148, -151, -145, -152, -158, -158, -149, -153, -156, -148, -158, -162, -158, -159, -154, -157, -156, -152, -151, -155, -154, -156, -153, -149, -146, -134, -133, -136, -141, -144, -134, -132, -127, -134, -145, -139, -130, -126, -113, -118, -129, -130, -130, -133, -134, -131, -130, -127, -129, -128, -142, -147, -140, -135, -130, -141, -147, -140, -134, -129, -129, -131, -133, -117, -110, -109, -116, -126, -120, -127, -112, -117, -116, -112, -114, -109, -111, -96, -85, -86, -96, -100, -111, -109, -105, -113, -112, -107, -111, -116, -109, -104, -107, -120, -104, -83, -93, -104, -108, -103, -115, -114, -102, -109, -112, -108, -109, -110, -110, -121, -127, -127, -125, -125, -121, -114, -104, -111, -111, -119, -124, -113, -118, -122, -130, -140, -147, -138, -145, -152, -155, -150, -156, -153, -142, -156, -160, -162, -172, -176, -168, -176, -187, -179, -173, -170, -168, -170, -175, -181, -170, -177, -183, -179, -175, -174, -172, -166, -171, -181, -180, -182, -182, -169, -171, -171, -176, -168, -176, -181, -193, -192, -168, -173, -172, -175, -172, -183, -180, -170, -159, -164, -166, -144, -147, -144, -147, -146, -139, -158, -160, -149, -153, -148, -133, -128, -133, -129, -142, -136, -132, -134, -134, -125, -125, -129, -128, -127, -115, -127, -124, -125, -127, -133, -131, -124, -128, -120, -120, -118, -123, -117, -116, -113, -122, -119, -111, -114, -94, -88, -87, -88, -90, -90, -91, -86, -86, -96, -103, -93, -82, -82, -93, -83, -79, -84, -85, -85, -79, -83, -88, -82, -81, -91, -86, -81, -82, -85, -79, -78, -84, -87, -80, -86, -90, -80, -74, -75, -84, -78, -77, -86, -93, -83, -88, -96, -93, -93, -95, -95, -92, -99, -102, -98, -108, -104, -103, -105, -98, -91, -86, -89, -94, -99, -95, -96, -101, -111, -104, -103, -110, -109, -119, -121, -124, -118, -124, -128, -126, -128, -122, -128, -127, -138, -144, -143, -143, -136, -138, -138, -133, -140, -143, -142, -146, -143, -145, -154, -151, -143, -136, -134, -137, -133, -144, -151, -143, -138, -142, -138, -147, -148, -146, -143, -138, -147, -147, -149, -148, -149, -150, -152, -145, -152, -155, -152, -155, -146, -150, -148, -145, -144, -145, -151, -146, -144, -147, -143, -147, -138, -140, -146, -152, -155, -146, -145, -145, -145, -136, -139, -130, -136, -130, -126, -128, -128, -135, -138, -134, -124, -121, -112, -114, -106, -104, -105, -106, -101, -102, -109, -109, -109, -104, -102, -111, -120, -119, -121, -121, -119, -123, -120, -107, -107, -115, -125, -120, -121, -122, -106, -111, -114, -108, -115, -116, -119, -126, -121, -111, -96, -104, -107, -104, -108, -110, -113, -112, -114, -102, -102, -110, -117, -119, -115, -112, -115, -123, -125, -124, -122, -124, -116, -121, -134, -133, -134, -132, -137, -143, -136, -138, -148, -152, -149, -151, -151, -152, -153, -157, -155, -155, -157, -152, -153, -158, -167, -164, -170, -172, -164, -161, -160, -160, -156, -160, -170, -174, -176, -171, -166, -152, -149, -154, -154, -162, -159, -158, -163, -171, -169, -159, -159, -151, -148, -151, -152, -157, -156, -160, -166, -168, -162, -162, -166, -162, -159, -154, -160, -159, -154, -145, -150, -146, -146, -150, -139, -135, -132, -131, -121, -125, -127, -125, -113, -116, -120, -112, -116, -122, -118, -118, -115, -114, -108, -111, -123, -127, -127, -121, -121, -115, -109, -101, -104, -109, -109, -114, -118, -110, -109, -113, -105, -106, -115, -124, -113, -112, -108, -103, -98, -92, -95, -95, -107, -102, -104, -98, -88, -93, -96, -96, -96, -98, -104, -95, -93, -89, -83, -85, -76, -80, -88, -87, -88, -87, -88, -89, -86, -82, -81, -89, -93, -96, -103, -100, -101, -108, -112, -113, -114, -111, -117, -114, -116, -114, -125, -121, -108, -115, -113, -116, -119, -113, -112, -119, -124, -129, -136, -140, -129, -127, -132, -138, -142, -138, -127, -126, -130, -137, -146, -147, -146, -142, -140, -144, -134, -128, -135, -136, -142, -147, -156, -153, -157, -156, -152, -149, -144, -146, -143, -142, -144, -150, -148, -153, -156, -154, -153, -148, -153, -148, -145, -145, -146, -146, -143, -139, -145, -144, -140, -144, -134, -135, -134, -132, -131, -132, -140, -130, -127, -136, -131, -130, -132, -125, -118, -119, -126, -115, -112, -119, -119, -123, -130, -129, -125, -115, -108, -111, -109, -110, -107, -110, -123, -125, -123, -118, -114, -109, -106, -107, -108, -111, -102, -105, -111, -115, -107, -104, -114, -118, -114, -107, -107, -103, -112, -108, -118, -126, -119, -118, -118, -114, -103, -107, -101, -107, -111, -104, -107, -119, -120, -113, -110, -113, -109, -110, -119, -118, -115, -117, -112, -109, -116, -114, -121, -123, -127, -122, -113, -114, -110, -120, -123, -124, -123, -122, -127, -128, -131, -127, -123, -122, -119, -128, -131, -125, -130, -141, -145, -139, -127, -131, -137, -129, -138, -142, -141, -147, -149, -146, -146, -143, -135, -138, -137, -139, -143, -142, -144, -143, -148, -149, -145, -151, -149, -150, -137, -140, -148, -149, -138, -136, -150, -154, -155, -143, -148, -148, -142, -141, -149, -154, -144, -138, -142, -157, -171, -162, -161, -168, -156, -143, -148, -154, -142, -144, -155, -144, -134, -142, -135, -131, -134, -133, -137, -138, -142, -137, -136, -141, -142, -134, -131, -135, -138, -138, -135, -137, -136, -130, -128, -134, -138, -134, -141, -144, -139, -128, -128, -122, -116, -115, -119, -125, -128, -132, -122, -126, -122, -121, -130, -131, -121, -116, -126, -128, -127, -126, -126, -118, -118, -120, -114, -114, -110, -109, -111, -108, -102, -104, -109, -106, -94, -101, -105, -99, -99, -105, -96, -99, -107, -104, -109, -108, -112, -112, -121, -119, -126, -127, -120, -124, -121, -124, -118, -122, -126, -121, -109, -99, -100, -100, -107, -114, -127, -124, -116, -123, -126, -119, -112, -113, -108, -113, -117, -110, -108, -110, -111, -107, -119, -123, -123, -133, -138, -129, -127, -130, -125, -125, -126, -135, -128, -128, -135, -134, -133, -133, -129, -121, -125, -134, -133, -131, -127, -136, -139, -146, -142, -142, -150, -148, -147, -142, -145, -137, -145, -139, -136, -136, -133, -138, -134, -138, -135, -141, -135, -137, -130, -136, -134, -135, -139, -133, -133, -131, -131, -124, -129, -132, -133, -123, -127, -126, -125, -124, -127, -137, -133, -135, -140, -138, -133, -132, -133, -136, -128, -124, -126, -126, -127, -131, -128, -130, -129, -123, -121, -123, -122, -124, -121, -117, -122, -126, -131, -132, -130, -130, -124, -112, -110, -102, -102, -108, -111, -114, -112, -111, -112, -113, -101, -102, -113, -104, -98, -101, -111, -108, -103, -111, -110, -111, -118, -109, -107, -106, -104, -108, -107, -112, -111, -115, -121, -115, -112, -114, -116, -119, -113, -115, -114, -106, -110, -109, -108, -105, -118, -117, -110, -120, -115, -107, -108, -114, -123, -124, -125, -132, -128, -131, -132, -120, -120, -119, -115, -125, -126, -125, -117, -119, -122, -124, -133, -138, -143, -140, -133, -135, -130, -128, -140, -145, -141, -130, -136, -142, -136, -131, -136, -138, -138, -140, -132, -139, -142, -138, -128, -133, -135, -131, -129, -141, -137, -140, -142, -133, -140, -141, -143, -149, -154, -146, -143, -143, -143, -141, -137, -147, -151, -151, -143, -137, -143, -137, -143, -144, -147, -154, -147, -143, -143, -143, -139, -139, -141, -141, -134, -127, -136, -139, -135, -137, -142, -136, -131, -133, -130, -128, -139, -138, -126, -129, -132, -128, -131, -140, -134, -130, -134, -128, -129, -136, -129, -131, -139, -132, -133, -136, -129, -125, -126, -128, -131, -128, -123, -125, -126, -126, -115, -122, -132, -126, -126, -128, -123, -121, -122, -122, -125, -121, -117, -125, -121, -123, -118, -119, -125, -115, -118, -115, -124, -125, -121, -122, -126, -123, -119, -116, -117, -122, -121, -122, -122, -125, -124, -119, -119, -132, -120, -121, -122, -117, -116, -124, -128, -116, -115, -116, -121, -118, -120, -122, -124, -119, -119, -126, -130, -128, -119, -124, -130, -128, -127, -132, -132, -131, -132, -133, -129, -127, -134, -131, -133, -135, -128, -126, -117, -130, -124, -121, -129, -129, -132, -133, -130, -128, -123, -122, -127, -131, -128, -127, -130, -133, -132, -126, -132, -129, -130, -131, -134, -134, -129, -128, -130, -128, -122, -119, -125, -126, -130, -138, -129, -133, -132, -133, -131, -135, -132, -130, -136, -134, -131, -127, -133, -129, -128, -128, -129, -131, -127, -132, -133, -125, -126, -126, -123, -124, -131, -127, -118, -117, -117, -118, -110, -118, -122, -123, -123, -120, -127, -126, -119, -125, -120, -110, -110, -117, -123, -117, -113, -117, -118, -120, -119, -117, -108, -111, -114, -118, -121, -114, -111, -113, -122, -108, -111, -110, -114, -112, -104, -115, -115, -117, -112, -115, -116, -113, -115, -117, -125, -119, -116, -126, -119, -117, -117, -115, -118, -122, -126, -129, -118, -115, -123, -124, -120, -120, -122, -117, -125, -122, -124, -122, -126, -133, -123, -123, -122, -120, -121, -121, -120, -129, -139, -132, -130, -137, -137, -128, -128, -126, -127, -133, -126, -120, -124, -140, -134, -130, -135, -136, -135, -135, -128, -129, -139, -134, -132, -142, -147, -142, -140, -138, -144, -145, -136, -131, -137, -134, -137, -141, -147, -142, -134, -137, -138, -129, -126, -140, -140, -138, -137, -141, -139, -144, -146, -147, -147, -142, -146, -144, -143, -144, -142, -148, -137, -134, -140, -136, -138, -132, -137, -141, -138, -139, -136, -134, -132, -125, -127, -132, -140, -131, -126, -135, -133, -132, -126, -127, -132, -135, -133, -132, -130, -126, -129, -125, -130, -130, -125, -127, -123, -122, -119, -124, -127, -127, -128, -123, -131, -124, -122, -118, -116, -122, -118, -120, -117, -120, -117, -120, -120, -121, -122, -120, -117, -111, -113, -110, -116, -123, -125, -120, -120, -125, -124, -118, -119, -122, -125, -125, -121, -121, -124, -122, -116, -120, -128, -127, -118, -120, -119, -122, -121, -118, -125, -125, -117, -124, -124, -120, -122, -119, -117, -115, -122, -122, -119, -124, -132, -126, -120, -119, -123, -125, -124, -124, -120, -121, -127, -134, -131, -120, -119, -128, -121, -125, -119, -120, -127, -128, -124, -120, -129, -128, -125, -127, -127, -127, -133, -126, -125, -129, -132, -128, -125, -131, -132, -125, -120, -131, -130, -124, -124, -124, -134, -139, -132, -135, -136, -134, -132, -129, -135, -136, -135, -132, -131, -132, -134, -134, -134, -139, -135, -131, -135, -138, -134, -128, -132, -129, -128, -134, -136, -136, -128, -130, -136, -131, -129, -134, -129, -130, -129, -129, -133, -135, -129, -134, -138, -124, -129, -124, -118, -127, -131, -125, -127, -131, -128, -133, -125, -124, -123, -117, -124, -127, -130, -127, -126, -123, -123, -129, -122, -131, -129, -125, -131, -133, -125, -126, -127, -126, -126, -128, -125, -115, -123, -128, -128, -126, -117, -125, -131, -128, -122, -121, -128, -130, -123, -120, -123, -124, -120, -121, -125, -122, -118, -119, -124, -124, -119, -118, -118, -120, -124, -121, -117, -117, -122, -122, -119, -121, -123, -126, -121, -121, -116, -118, -121, -128, -130, -119, -120, -130, -124, -123, -120, -124, -128, -119, -125, -125, -123, -125, -130, -121, -115, -123, -121, -119, -125, -130, -118, -124, -127, -120, -124, -135, -131, -124, -125, -126, -126, -123, -127, -124, -128, -127, -133, -128, -122, -128, -127, -129, -130, -129, -127, -125, -123, -129, -131, -128, -128, -132, -138, -140, -129, -130, -129, -130, -136, -127, -124, -135, -131, -120, -126, -131, -137, -131, -127, -133, -135, -129, -125, -130, -122, -120, -128, -139, -144, -137, -130, -132, -131, -133, -125, -129, -137, -138, -145, -145, -144, -129, -127, -128, -129, -129, -131, -138, -141, -153, -141, -130, -123, -124, -131, -128, -128, -137, -143, -142, -135, -128, -129, -121, -121, -122, -133, -136, -139, -139, -134, -131, -118, -113, -118, -132, -134, -137, -140, -139, -126, -118, -114, -114, -120, -132, -137, -135, -136, -129, -120, -115, -113, -115, -126, -129, -136, -136, -131, -125, -118, -110, -112, -123, -131, -131, -126, -128, -123, -105, -103, -110, -111, -125, -126, -128, -129, -116, -110, -109, -109, -114, -116, -119, -125, -126, -122, -113, -112, -111, -105, -107, -113, -119, -124, -131, -127, -110, -109, -106, -105, -120, -127, -134, -135, -126, -109, -106, -108, -115, -123, -130, -136, -133, -133, -120, -113, -113, -123, -124, -132, -130, -128, -126, -123, -124, -117, -126, -130, -133, -136, -132, -132, -130, -125, -132, -129, -126, -128, -132, -138, -131, -133, -141, -133, -127, -122, -126, -130, -134, -145, -148, -140, -132, -131, -125, -127, -134, -139, -147, -137, -133, -131, -126, -124, -130, -136, -140, -148, -144, -140, -131, -125, -121, -126, -135, -139, -140, -137, -135, -128, -123, -126, -133, -143, -141, -142, -142, -132, -131, -126, -124, -122, -132, -141, -141, -137, -134, -132, -125, -122, -127, -128, -128, -137, -145, -138, -133, -119, -115, -118, -115, -129, -137, -140, -136, -135, -123, -113, -115, -116, -122, -132, -134, -140, -139, -120, -112, -112, -110, -113, -121, -134, -136, -130, -139, -123, -108, -107, -110, -118, -123, -134, -136, -131, -126, -120, -114, -107, -108, -117, -127, -132, -133, -124, -122, -118, -110, -115, -123, -124, -133, -129, -127, -121, -113, -115, -116, -124, -128, -135, -135, -128, -118, -114, -110, -113, -127, -132, -137, -140, -136, -127, -125, -119, -115, -118, -118, -136, -141, -136, -134, -125, -117, -118, -121, -131, -134, -137, -137, -127, -124, -124, -117, -120, -131, -133, -138, -137, -138, -130, -122, -117, -115, -126, -137, -141, -140, -140, -134, -134, -127, -124, -131, -135, -137, -138, -139, -136, -133, -131, -126, -127, -132, -137, -135, -132, -132, -131, -127, -129, -130, -128, -130, -132, -135, -134, -128, -128, -125, -129, -135, -130, -132, -130, -128, -132, -130, -136, -135, -131, -129, -128, -130, -137, -135, -136, -131, -127, -133, -133, -137, -134, -131, -137, -137, -130, -133, -128, -137, -133, -126, -130, -134, -130, -130, -132, -123, -126, -129, -127, -126, -128, -124, -125, -122, -117, -125, -128, -120, -123, -121, -118, -118, -123, -122, -123, -128, -122, -122, -122, -120, -123, -125, -118, -120, -123, -122, -121, -125, -118, -120, -120, -114, -118, -121, -126, -122, -126, -119, -121, -121, -121, -122, -120, -125, -123, -122, -123, -122, -122, -122, -119, -123, -122, -120, -125, -122, -121, -125, -121, -123, -127, -126, -124, -126, -126, -127, -127, -124, -120, -120, -125, -124, -132, -129, -124, -129, -125, -126, -128, -128, -123, -125, -130, -131, -126, -127, -127, -126, -126, -127, -126, -128, -126, -128, -132, -127, -125, -128, -129, -132, -134, -129, -127, -127, -132, -135, -134, -129, -134, -130, -127, -134, -130, -132, -132, -133, -132, -127, -132, -132, -131, -135, -131, -129, -136, -134, -134, -135, -126, -128, -131, -135, -129, -132, -133, -130, -130, -131, -133, -131, -128, -127, -134, -131, -132, -135, -131, -128, -127, -131, -129, -131, -133, -133, -134, -132, -130, -126, -130, -131, -126, -126, -131, -133, -129, -128, -132, -130, -122, -124, -129, -131, -127, -131, -131, -122, -125, -127, -127, -121, -121, -132, -131, -124, -125, -126, -121, -120, -122, -128, -130, -127, -128, -125, -122, -122, -121, -119, -124, -125, -125, -126, -128, -127, -119, -120, -124, -119, -123, -125, -130, -127, -124, -126, -122, -123, -119, -125, -126, -127, -130, -126, -125, -121, -120, -121, -121, -127, -129, -125, -129, -131, -130, -120, -119, -124, -126, -124, -131, -131, -123, -127, -129, -127, -119, -124, -125, -131, -133, -126, -124, -126, -125, -125, -129, -125, -130, -131, -128, -126, -128, -125, -125, -123, -129, -130, -137, -135, -130, -126, -123, -126, -126, -130, -132, -131, -132, -129, -125, -126, -130, -128, -126, -124, -132, -137, -128, -126, -124, -129, -129, -123, -124, -132, -134, -131, -127, -128, -125, -127, -132, -131, -133, -133, -132, -128, -121, -121, -127, -130, -132, -134, -135, -131, -130, -133, -135, -125, -121, -130, -132, -134, -131, -137, -134, -130, -130, -127, -129, -126, -131, -132, -128, -131, -129, -127, -128, -126, -126, -131, -133, -131, -130, -124, -129, -131, -128, -132, -131, -134, -136, -133, -127, -128, -129, -130, -130, -130, -135, -130, -130, -133, -129, -126, -129, -131, -134, -128, -128, -130, -127, -126, -131, -129, -125, -125, -128, -125, -125, -130, -128, -124, -123, -123, -125, -120, -119, -126, -129, -126, -122, -123, -126, -121, -122, -120, -125, -126, -126, -126, -116, -123, -126, -127, -127, -123, -122, -119, -125, -125, -123, -127, -123, -123, -123, -122, -124, -125, -125, -121, -123, -118, -122, -123, -126, -129, -127, -120, -115, -122, -123, -126, -123, -124, -124, -124, -123, -120, -122, -127, -126, -124, -121, -123, -130, -126, -125, -126, -124, -123, -128, -128, -125, -128, -127, -127, -126, -126, -126, -126, -127, -125, -128, -131, -129, -128, -128, -129, -125, -127, -131, -126, -129, -130, -128, -128, -129, -132, -131, -129, -129, -129, -125, -130, -130, -130, -130, -131, -130, -128, -129, -132, -129, -127, -131, -127, -130, -128, -129, -131, -128, -133, -133, -136, -133, -132, -129, -129, -134, -136, -132, -135, -138, -131, -132, -130, -131, -132, -132, -131, -134, -132, -130, -131, -132, -132, -134, -132, -127, -134, -128, -128, -132, -128, -129, -128, -125, -127, -134, -132, -130, -129, -130, -127, -123, -124, -126, -132, -134, -129, -126, -128, -126, -128, -123, -122, -126, -128, -128, -127, -128, -122, -128, -128, -123, -122, -125, -129, -131, -129, -127, -121, -121, -126, -127, -124, -125, -127, -123, -121, -123, -124, -124, -125, -123, -124, -129, -127, -122, -119, -120, -122, -124, -125, -124, -128, -127, -127, -126, -125, -124, -125, -132, -131, -129, -128, -129, -126, -126, -125, -123, -122, -127, -131, -131, -127, -124, -126, -127, -124, -125, -128, -132, -129, -126, -130, -128, -125, -125, -125, -126, -129, -130, -126, -125, -127, -129, -128, -128, -127, -126, -128, -130, -127, -128, -127, -126, -127, -127, -128, -129, -127, -127, -133, -128, -124, -126, -128, -127, -131, -132, -132, -131, -132, -134, -129, -128, -131, -132, -131, -134, -131, -132, -129, -127, -128, -129, -132, -135, -134, -131, -128, -131, -127, -129, -134, -132, -128, -126, -133, -134, -132, -136, -134, -128, -129, -130, -130, -133, -132, -131, -131, -130, -132, -133, -129, -130, -136, -131, -132, -130, -123, -127, -131, -127, -126, -131, -134, -136, -125, -126, -131, -126, -130, -127, -127, -127, -129, -128, -130, -127, -127, -127, -121, -125, -128, -128, -126, -124, -124, -125, -125, -122, -123, -123, -123, -125, -126, -128, -125, -125, -126, -123, -123, -123, -123, -123, -125, -126, -122, -126, -125, -124, -126, -126, -126, -121, -121, -120, -122, -120, -124, -122, -126, -123, -119, -125, -124, -121, -121, -123, -122, -124, -125, -127, -128, -132, -126, -120, -122, -124, -130, -129, -125, -128, -129, -124, -124, -129, -129, -125, -126, -127, -127, -131, -128, -127, -127, -125, -129, -128, -129, -129, -128, -126, -129, -132, -129, -126, -129, -131, -129, -129, -130, -127, -127, -126, -126, -131, -127, -130, -128, -126, -132, -131, -131, -127, -125, -128, -129, -128, -131, -129, -127, -129, -128, -127, -127, -128, -132, -134, -129, -127, -129, -128, -131, -132, -126, -126, -132, -129, -129, -132, -128, -126, -123, -129, -129, -130, -132, -130, -131, -129, -126, -123, -125, -132, -135, -128, -128, -128, -128, -130, -127, -126, -132, -131, -127, -125, -131, -132, -125, -126, -129, -133, -132, -133, -129, -125, -124, -126, -127, -128, -132, -130, -125, -125, -127, -127, -127, -128, -126, -122, -126, -131, -129, -128, -125, -126, -125, -121, -123, -127, -128, -125, -127, -127, -128, -122, -120, -124, -123, -127, -124, -131, -129, -124, -127, -127, -126, -126, -124, -125, -127, -130, -130, -124, -124, -123, -125, -130, -125, -125, -126, -125, -129, -124, -123, -127, -128, -125, -126, -127, -125, -124, -124, -127, -122, -121, -122, -123, -127, -125, -125, -127, -125, -126, -128, -123, -127, -130, -129, -124, -123, -125, -124, -125, -125, -128, -131, -130, -126, -128, -129, -124, -128, -130, -128, -126, -132, -131, -130, -130, -128, -130, -128, -128, -128, -131, -131, -128, -131, -131, -128, -129, -130, -129, -133, -130, -128, -127, -130, -133, -125, -126, -130, -133, -134, -131, -130, -129, -128, -124, -126, -129, -128, -129, -127, -130, -128, -130, -131, -128, -130, -129, -127, -129, -132, -126, -126, -127, -128, -130, -128, -131, -130, -128, -130, -129, -128, -127, -127, -128, -132, -130, -126, -128, -130, -129, -129, -128, -127, -130, -131, -128, -130, -128, -127, -125, -128, -128, -128, -130, -129, -128, -122, -124, -127, -126, -126, -126, -126, -126, -127, -127, -125, -124, -128, -125, -125, -124, -127, -130, -123, -125, -129, -126, -123, -125, -126, -127, -127, -126, -125, -123, -122, -124, -125, -126, -122, -125, -127, -125, -126, -127, -126, -123, -126, -129, -129, -125, -125, -124, -125, -129, -127, -128, -128, -122, -127, -130, -125, -126, -128, -127, -127, -126, -127, -126, -126, -126, -126, -126, -126, -126, -126, -128, -128, -128, -129, -128, -125, -125, -124, -126, -127, -129, -128, -128, -129, -129, -128, -126, -126, -128, -131, -131, -129, -127, -129, -126, -127, -128, -129, -130, -132, -129, -133, -130, -127, -128, -128, -129, -128, -126, -127, -129, -129, -130, -129, -128, -130, -129, -127, -127, -126, -128, -126, -129, -128, -126, -129, -132, -133, -128, -128, -130, -130, -129, -128, -127, -126, -134, -133, -132, -129, -130, -128, -127, -130, -131, -127, -130, -131, -131, -134, -129, -127, -127, -133, -132, -124, -125, -131, -131, -128, -128, -125, -128, -131, -126, -127, -130, -130, -131, -129, -127, -126, -127, -127, -127, -129, -129, -127, -124, -126, -125, -125, -125, -126, -126, -123, -126, -126, -126, -126, -125, -125, -124, -127, -126, -124, -126, -126, -127, -126, -127, -127, -125, -124, -122, -125, -126, -124, -124, -121, -123, -124, -124, -124, -126, -123, -122, -124, -121, -122, -124, -125, -126, -125, -124, -126, -124, -121, -127, -125, -127, -126, -125, -125, -126, -124, -123, -127, -128, -125, -121, -126, -127, -124, -124, -123, -127, -126, -124, -126, -127, -127, -125, -126, -127, -128, -128, -128, -131, -127, -124, -126, -127, -130, -131, -127, -126, -129, -129, -128, -129, -128, -128, -126, -128, -130, -130, -130, -128, -130, -128, -131, -131, -132, -130, -130, -126, -128, -131, -130, -130, -126, -129, -130, -130, -132, -133, -132, -130, -129, -130, -131, -133, -132, -131, -131, -130, -128, -130, -128, -127, -129, -133, -131, -126, -127, -128, -130, -128, -127, -126, -126, -127, -130, -126, -126, -127, -127, -130, -128, -128, -129, -128, -128, -130, -131, -127, -130, -127, -127, -128, -130, -130, -128, -129, -127, -129, -128, -128, -127, -128, -126, -127, -128, -127, -126, -126, -128, -128, -128, -129, -128, -126, -128, -127, -126, -129, -130, -128, -124, -125, -125, -126, -126, -125, -124, -127, -127, -126, -125, -126, -125, -124, -128, -127, -126, -124, -125, -124, -124, -127, -130, -127, -123, -126, -128, -126, -125, -125, -124, -128, -127, -127, -126, -126, -124, -125, -127, -125, -128, -125, -125, -125, -125, -127, -128, -124, -125, -126, -127, -124, -125, -125, -125, -125, -123, -125, -127, -127, -127, -130, -125, -124, -126, -128, -125, -128, -128, -127, -129, -127, -125, -129, -129, -128, -126, -130, -129, -125, -128, -126, -131, -131, -128, -128, -130, -129, -126, -127, -130, -130, -127, -129, -130, -128, -129, -128, -130, -128, -130, -131, -127, -129, -129, -130, -130, -129, -128, -128, -128, -126, -128, -128, -128, -128, -126, -131, -131, -129, -129, -127, -129, -129, -129, -126, -126, -128, -130, -129, -128, -130, -127, -128, -126, -128, -125, -130, -129, -127, -129, -128, -127, -127, -130, -129, -127, -128, -128, -126, -127, -128, -128, -128, -128, -129, -128, -127, -128, -126, -126, -126, -125, -126, -125, -126, -127, -129, -126, -124, -125, -128, -126, -126, -128, -127, -125, -126, -125, -127, -125, -126, -128, -128, -128, -128, -129, -127, -125, -125, -125, -125, -127, -126, -125, -126, -125, -127, -126, -126, -128, -125, -125, -125, -127, -127, -129, -128, -127, -129, -128, -124, -125, -126, -127, -127, -128, -128, -126, -125, -126, -126, -125, -126, -128, -127, -126, -127, -125, -127, -123, -123, -125, -126, -127, -125, -127, -126, -125, -126, -127, -129, -129, -127, -125, -126, -128, -129, -128, -130, -128, -125, -127, -128, -127, -128, -129, -129, -127, -127, -127, -129, -127, -127, -126, -126, -127, -130, -128, -129, -130, -126, -125, -127, -128, -130, -127, -127, -128, -130, -128, -127, -129, -130, -130, -126, -128, -127, -127, -129, -126, -127, -129, -129, -125, -127, -130, -127, -127, -128, -126, -128, -128, -126, -126, -127, -129, -127, -126, -128, -129, -126, -127, -128, -129, -126, -125, -129, -128, -129, -127, -126, -126, -125, -127, -127, -127, -126, -125, -128, -127, -126, -126, -126, -127, -127, -125, -127, -129, -127, -128, -129, -125, -124, -125, -126, -127, -128, -128, -127, -127, -127, -128, -128, -130, -126, -128, -126, -124, -129, -126, -125, -127, -126, -127, -127, -127, -129, -128, -126, -125, -124, -125, -126, -128, -130, -126, -123, -126, -128, -128, -126, -126, -128, -127, -127, -128, -129, -127, -127, -126, -126, -127, -128, -128, -126, -126, -128, -127, -128, -125, -126, -128, -128, -128, -123, -125, -127, -128, -128, -124, -125, -124, -126, -126, -128, -127, -127, -127, -126, -126, -128, -128, -125, -124, -126, -128, -130, -127, -127, -128, -128, -125, -126, -127, -128, -127, -128, -129, -128, -126, -127, -129, -127, -127, -128, -130, -129, -127, -127, -126, -128, -129, -128, -129, -128, -128, -126, -128, -129, -127, -126, -127, -127, -129, -129, -126, -128, -127, -129, -128, -128, -126, -125, -127, -127, -127, -127, -127, -127, -128, -127, -127, -126, -126, -127, -129, -128, -128, -127, -127, -127, -127, -128, -128, -126, -127, -129, -127, -125, -125, -126, -126, -128, -129, -126, -125, -126, -125, -126, -127, -129, -127, -127, -125, -126, -126, -126, -126, -129, -128, -126, -128, -128, -126, -126, -128, -127, -129, -127, -127, -128, -125, -126, -128, -129, -127, -127, -126, -129, -130, -128, -128, -129, -128, -126, -128, -129, -127, -126, -125, -126, -127, -127, -128, -126, -126, -128, -128, -127, -126, -127, -127, -129, -129, -127, -124, -127, -128, -129, -128, -125, -126, -126, -128, -127, -129, -128, -127, -126, -126, -128, -125, -126, -125, -126, -126, -128, -128, -128, -126, -126, -128, -127, -129, -128, -127, -128, -128, -127, -128, -129, -128, -128, -127, -126, -126, -124, -126, -127, -127, -126, -128, -127, -127, -127, -128, -127, -128, -128, -127, -127, -128, -128, -127, -127, -130, -129, -129, -129, -127, -127, -129, -130, -127, -127, -130, -129, -125, -125, -127, -129, -129, -127, -127, -129, -127, -125, -127, -129, -128, -127, -128, -129, -126, -126, -126, -128, -129, -129, -126, -126, -127, -127, -127, -126, -126, -127, -127, -127, -127, -127, -127, -126, -126, -126, -128, -126, -127, -128, -127, -126, -126, -127, -126, -127, -127, -127, -128, -126, -128, -129, -129, -126, -124, -127, -127, -128, -128, -126, -125, -126, -127, -126, -125, -126, -128, -126, -127, -127, -125, -125, -125, -127, -127, -127, -127, -126, -128, -126, -125, -126, -126, -124, -127, -127, -126, -125, -125, -126, -126, -126, -127, -127, -126, -127, -125, -125, -127, -128, -127, -127, -126, -126, -126, -127, -128, -127, -128, -127, -128, -128, -128, -125, -124, -127, -129, -129, -129, -126, -128, -129, -126, -126, -128, -128, -128, -127, -128, -126, -128, -127, -126, -125, -127, -129, -129, -127, -126, -127, -127, -127, -126, -127, -128, -128, -127, -126, -126, -125, -125, -126, -127, -128, -126, -127, -127, -128, -129, -127, -126, -127, -126, -128, -130, -128, -126, -130, -130, -127, -127, -128, -127, -128, -127, -128, -128, -128, -128, -129, -130, -129, -127, -129, -129, -131, -129, -128, -128, -128, -127, -127, -127, -126, -127, -128, -127, -126, -126, -127, -128, -129, -127, -126, -127, -129, -127, -126, -126, -128, -128, -126, -128, -129, -129, -126, -127, -127, -128, -127, -128, -130, -127, -126, -127, -127, -128, -126, -127, -127, -128, -126, -127, -128, -127, -127, -125, -128, -128, -129, -126, -126, -128, -126, -127, -127, -126, -128, -127, -125, -126, -127, -128, -126, -124, -126, -125, -127, -125, -125, -125, -126, -127, -127, -126, -126, -127, -127, -128, -128, -127, -126, -127, -126, -127, -127, -126, -125, -127, -128, -126, -128, -129, -128, -126, -126, -126, -127, -129, -127, -127, -126, -125, -127, -128, -129, -127, -125, -127, -128, -127, -126, -125, -125, -127, -126, -128, -129, -127, -126, -127, -127, -126, -126, -127, -127, -127, -128, -126, -128, -129, -128, -128, -128, -126, -127, -130, -129, -127, -129, -129, -130, -127, -127, -127, -128, -128, -129, -129, -127, -127, -129, -128, -129, -130, -129, -126, -128, -128, -128, -128, -127, -128, -127, -127, -127, -127, -127, -128, -127, -127, -127, -128, -128, -128, -126, -127, -129, -128, -126, -128, -128, -127, -127, -128, -127, -128, -128, -128, -128, -127, -128, -128, -128, -127, -127, -129, -128, -125, -127, -128, -128, -127, -127, -127, -127, -127, -128, -127, -127, -127, -127, -128, -127, -126, -126, -128, -127, -127, -128, -126, -126, -126, -126, -127, -126, -126, -125, -125, -127, -126, -126, -127, -127, -127, -126, -126, -126, -126, -128, -128, -128, -127, -126, -126, -127, -127, -128, -128, -126, -128, -127, -126, -127, -127, -126, -127, -127, -129, -127, -127, -128, -127, -127, -127, -127, -127, -128, -127, -130, -128, -129, -129, -128, -127, -128, -128, -127, -127, -127, -127, -126, -127, -128, -129, -127, -126, -127, -126, -127, -126, -127, -128, -127, -129, -127, -126, -126, -128, -127, -128, -126, -126, -127, -127, -127, -128, -127, -127, -128, -126, -126, -127, -126, -125, -126, -126, -128, -126, -127, -126, -127, -125, -126, -127, -129, -128, -128, -128, -128, -129, -127, -127, -125, -128, -128, -126, -128, -127, -126, -126, -126, -125, -126, -125, -127, -127, -126, -127, -126, -126, -128, -127, -125, -125, -127, -128, -129, -127, -127, -127, -127, -128, -128, -129, -128, -129, -127, -127, -126, -129, -128, -127, -127, -127, -127, -127, -127, -126, -127, -128, -128, -127, -128, -129, -128, -126, -125, -128, -129, -128, -127, -126, -126, -127, -127, -126, -126, -127, -127, -126, -126, -126, -125, -124, -126, -128, -128, -125, -125, -127, -126, -127, -128, -127, -125, -127, -128, -127, -128, -126, -127, -128, -127, -127, -126, -127, -127, -127, -127, -126, -128, -129, -128, -126, -126, -126, -126, -127, -128, -127, -127, -126, -127, -128, -128, -129, -128, -127, -127, -128, -128, -127, -128, -129, -127, -127, -126, -129, -127, -126, -127, -127, -127, -128, -128, -126, -128, -128, -128, -128, -129, -127, -127, -126, -128, -127, -128, -129, -129, -129, -127, -129, -130, -128, -129, -128, -128, -129, -128, -128, -127, -126, -126, -127, -127, -128, -128, -128, -127, -126, -127, -128, -128, -126, -127, -128, -127, -129, -128, -125, -126, -126, -127, -127, -128, -128, -127, -128, -127, -126, -125, -127, -127, -127, -128, -127, -128, -126, -126, -126, -126, -128, -127, -127, -127, -126, -125, -126, -126, -127, -128, -127, -127, -127, -127, -125, -125, -128, -127, -127, -127, -126, -126, -126, -127, -126, -126, -127, -126, -127, -127, -127, -128, -128, -128, -127, -127, -127, -126, -126, -127, -126, -128, -127, -127, -127, -126, -127, -127, -128, -126, -127, -127, -128, -126, -126, -127, -126, -127, -128, -128, -128, -128, -127, -127, -128, -127, -128, -128, -128, -127, -126, -126, -128, -128, -127, -127, -126, -128, -128, -128, -126, -127, -127, -129, -129, -129, -129, -129, -128, -128, -127, -127, -127, -127, -130, -129, -129, -127, -128, -128, -128, -129, -129, -129, -128, -128, -127, -128, -128, -129, -128, -127, -127, -129, -128, -129, -127, -127, -127, -128, -128, -127, -128, -130, -128, -128, -127, -127, -126, -128, -127, -127, -127, -126, -127, -127, -127, -126, -126, -126, -127, -127, -127, -126, -127, -126, -126, -126, -127, -126, -127, -126, -129, -128, -126, -127, -127, -126, -127, -126, -126, -126, -125, -125, -127, -126, -126, -127, -126, -126, -126, -128, -126, -126, -126, -127, -126, -127, -128, -128, -127, -127, -129, -128, -127, -126, -128, -128, -127, -127, -128, -130, -128, -127, -127, -126, -126, -126, -128, -129, -127, -127, -127, -128, -129, -128, -127, -128, -127, -128, -127, -126, -128, -128, -126, -126, -127, -126, -128, -128, -127, -127, -127, -126, -126, -127, -126, -127, -126, -126, -127, -127, -126, -126, -126, -127, -126, -127, -126, -126, -126, -128, -127, -126, -127, -127, -127, -127, -127, -127, -126, -126, -126, -127, -126, -126, -126, -127, -128, -126, -125, -126, -126, -125, -126, -127, -128, -127, -127, -128, -128, -128, -128, -128, -129, -127, -127, -127, -128, -127, -128, -128, -127, -127, -127, -127, -128, -127, -128, -128, -128, -128, -128, -127, -127, -128, -127, -129, -129, -128, -129, -129, -129, -129, -129, -130, -129, -127, -128, -128, -129, -129, -129, -128, -127, -126, -127, -127, -127, -126, -128, -127, -128, -126, -126, -126, -127, -128, -127, -128, -127, -128, -127, -127, -126, -126, -125, -126, -127, -128, -128, -127, -126, -128, -126, -126, -126, -126, -127, -126, -127, -128, -127, -126, -126, -127, -127, -127, -128, -127, -128, -127, -126, -127, -127, -127, -127, -127, -127, -128, -127, -127, -126, -126, -127, -126, -127, -126, -126, -126, -127, -126, -126, -125, -126, -126, -128, -128, -128, -127, -125, -126, -128, -128, -127, -127, -127, -127, -128, -127, -127, -127, -127, -127, -127, -127, -127, -128, -127, -127, -128, -128, -128, -127, -127, -129, -129, -127, -128, -128, -127, -128, -128, -129, -127, -129, -128, -129, -129, -129, -130, -129, -129, -127, -127, -128, -128, -128, -128, -127, -128, -129, -128, -128, -127, -128, -128, -129, -128, -128, -127, -127, -127, -128, -127, -127, -127, -128, -127, -127, -127, -128, -127, -128, -127, -128, -127, -127, -128, -127, -127, -126, -126, -127, -129, -128, -127, -128, -127, -128, -128, -126, -128, -128, -127, -127, -127, -125, -126, -128, -128, -126, -126, -126, -127, -125, -125, -125, -126, -126, -126, -126, -127, -125, -127, -127, -127, -128, -128, -128, -128, -127, -127, -127, -127, -127, -126, -126, -127, -126, -127, -127, -127, -127, -127, -127, -126, -127, -128, -127, -127, -127, -127, -127, -127, -128, -128, -128, -127, -128, -128, -129, -128, -128, -128, -128, -128, -127, -128, -128, -127, -127, -128, -129, -128, -127, -127, -127, -128, -128, -127, -129, -128, -128, -127, -127, -128, -129, -129, -127, -127, -127, -128, -128, -127, -127, -127, -128, -128, -127, -128, -128, -128, -127, -126, -126, -127, -127, -127, -127, -128, -128, -127, -128, -127, -128, -127, -127, -127, -128, -128, -128, -128, -128, -128, -128, -128, -126, -127, -127, -128, -127, -127, -127, -128, -128, -127, -127, -127, -128, -127, -127, -127, -128, -129, -128, -128, -127, -128, -128, -127, -127, -127, -128, -127, -127, -127, -127, -128, -127, -128, -127, -126, -126, -127, -126, -127, -126, -126, -126, -126, -127, -126, -126, -126, -127, -127, -126, -128, -127, -127, -126, -127, -128, -127, -127, -126, -127, -127, -127, -128, -126, -126, -126, -126, -127, -126, -126, -127, -126, -127, -126, -127, -127, -127, -126, -125, -126, -127, -127, -126, -126, -125, -126, -126, -127, -127, -125, -125, -126, -126, -127, -126, -126, -126, -127, -126, -125, -126, -126, -126, -126, -127, -127, -125, -127, -127, -127, -127, -127, -126, -127, -126, -127, -127, -126, -127, -126, -127, -126, -126, -127, -126, -127, -127, -128, -128, -128, -126, -126, -127, -128, -127, -128, -127, -128, -127, -128, -127, -129, -129, -128, -129, -129, -128, -128, -127, -128, -128, -129, -127, -128, -128, -128, -128, -127, -127, -127, -128, -128, -128, -128, -127, -128, -128, -127, -127, -128, -127, -129, -128, -129, -129, -129, -128, -128, -128, -129, -129, -129, -128, -128, -129, -128, -128, -128, -128, -128, -128, -127, -127, -128, -129, -128, -127, -128, -128, -127, -127, -128, -127, -127, -127, -128, -127, -127, -126, -126, -127, -127, -126, -127, -126, -126, -126, -127, -126, -126, -126, -126, -127, -126, -126, -125, -126, -127, -126, -127, -127, -126, -126, -126, -126, -125, -126, -127, -126, -126, -126, -125, -125, -127, -126, -126, -126, -126, -127, -126, -127, -127, -126, -126, -127, -126, -127, -127, -126, -127, -127, -126, -128, -127, -128, -128, -127, -127, -127, -128, -127, -127, -127, -128, -127, -127, -128, -127, -127, -126, -128, -128, -128, -128, -128, -128, -127, -128, -127, -128, -128, -127, -127, -128, -128, -128, -128, -128, -128, -128, -128, -127, -128, -128, -129, -128, -129, -128, -128, -128, -128, -128, -129, -128, -129, -128, -129, -129, -127, -128, -128, -128, -129, -129, -129, -128, -128, -128, -128, -127, -128, -128, -128, -127, -128, -128, -127, -128, -128, -128, -128, -128, -126, -128, -128, -127, -128, -127, -128, -127, -129, -127, -127, -127, -129, -129, -127, -127, -128, -128, -127, -127, -127, -127, -128, -128, -127, -128, -127, -127, -126, -128, -126, -127, -127, -128, -127, -126, -126, -126, -126, -127, -127, -127, -127, -126, -128, -127, -127, -127, -127, -128, -127, -127, -127, -127, -127, -127, -127, -127, -126, -127, -127, -127, -126, -127, -128, -127, -127, -125, -126, -126, -127, -126, -127, -126, -127, -126, -127, -126, -127, -127, -127, -127, -128, -128, -127, -128, -128, -127, -127, -127, -127, -127, -127, -127, -128, -127, -128, -127, -128, -127, -127, -127, -128, -128, -128, -127, -127, -128, -127, -128, -128, -128 -}; diff --git a/MCUME_pico/testio/testio.cpp b/MCUME_pico/testio/testio.cpp deleted file mode 100644 index 09411d5..0000000 --- a/MCUME_pico/testio/testio.cpp +++ /dev/null @@ -1,104 +0,0 @@ -#include "pico.h" -#include "pico/stdlib.h" - -extern "C" { - #include "iopins.h" - #include "emuapi.h" -} -#include "keyboard_osd.h" -#include "vga_t_dma.h" - -#include - -TFT_T_DMA tft; -static uint8_t sector_data[1024]; - - -int main(void) { -// set_sys_clock_48mhz(); - stdio_init_all(); - - printf("start\n"); - tft.begin(VGA_MODE_320x240); - emu_init(); - emu_sndInit(); - while (true) { - //printf("Hello, world!\n"); - if (menuActive()) { - uint16_t bClick = emu_DebounceLocalKeys(); - int action = handleMenu(bClick); - char * filename = menuSelection(); - if (action == ACTION_RUNTFT) { - toggleMenu(false); - //emu_start(); - //emu_Init(filename); - tft.fillScreenNoDma( RGBVAL16(0x00,0x00,0x00) ); - tft.startDMA(); - } - tft.waitSync(); - } - else { - //emu_Step(); - uint16_t bClick = emu_DebounceLocalKeys(); - emu_Input(bClick); - } - int c = getchar_timeout_us(0); - switch (c) { - case ' ': - printf("Inverted: %d\n", 1); - break; - } - } -} - - -#include "hardware/irq.h" -#include "hardware/pwm.h" -#include "rock.h" - -#define AUDIO_PIN 28 - - -static int cur_sample = 0; - -void pwm_irh() { - pwm_clear_irq(pwm_gpio_to_slice_num(AUDIO_PIN)); - pwm_set_gpio_level(AUDIO_PIN, audio_buffer[cur_sample >> 2]); - - uint8_t sample = audio_buffer[cur_sample >> 2]; - - if (cur_sample < (AUDIO_SAMPLES * 4) - 1) { - ++cur_sample; - } else { - cur_sample = 0; - } -} - -void emu_sndInit() { - gpio_set_function(AUDIO_PIN, GPIO_FUNC_PWM); - - int audio_pin_slice = pwm_gpio_to_slice_num(AUDIO_PIN); - - // Setup PWM interrupt to fire when PWM cycle is complete - pwm_clear_irq(audio_pin_slice); - pwm_set_irq_enabled(audio_pin_slice, true); - irq_set_exclusive_handler(PWM_IRQ_WRAP, pwm_irh); - irq_set_enabled(PWM_IRQ_WRAP, true); - - // Setup PWM for audio output - pwm_config config = pwm_get_default_config(); - pwm_config_set_clkdiv(&config, 5.5f); - pwm_config_set_wrap(&config, 254); - pwm_init(audio_pin_slice, &config, true); - - pwm_set_gpio_level(AUDIO_PIN, 0); -} - -void emu_sndPlaySound(int chan, int volume, int freq) -{ -} - - - - - diff --git a/MCUME_pico/testkeymax/emuapi.cpp b/MCUME_pico/testkeymax/emuapi.cpp deleted file mode 100644 index 1f87100..0000000 --- a/MCUME_pico/testkeymax/emuapi.cpp +++ /dev/null @@ -1,961 +0,0 @@ -#define KEYMAP_PRESENT 1 - -#define PROGMEM - -#include "pico.h" -#include "pico/stdlib.h" -#include "hardware/adc.h" -#include -#include - -extern "C" { - #include "emuapi.h" - #include "iopins.h" -} - -#if (defined(ILI9341) || defined(ST7789)) && defined(USE_VGA) -// Dual display config, initialize TFT -#include "tft_t_dma.h" -static TFT_T_DMA tft; -#else -// Non Dual display config -#ifdef USE_VGA -#include "vga_t_dma.h" -#else -#include "tft_t_dma.h" -#endif -extern TFT_T_DMA tft; -#endif - - -#define MAX_FILES 64 -#define MAX_FILENAME_SIZE 24 -#define MAX_MENULINES 9 -#define TEXT_HEIGHT 16 -#define TEXT_WIDTH 8 -#define MENU_FILE_XOFFSET (6*TEXT_WIDTH) -#define MENU_FILE_YOFFSET (2*TEXT_HEIGHT) -#define MENU_FILE_W (MAX_FILENAME_SIZE*TEXT_WIDTH) -#define MENU_FILE_H (MAX_MENULINES*TEXT_HEIGHT) -#define MENU_FILE_BGCOLOR RGBVAL16(0x00,0x00,0x40) -#define MENU_JOYS_YOFFSET (12*TEXT_HEIGHT) -#define MENU_VBAR_XOFFSET (0*TEXT_WIDTH) -#define MENU_VBAR_YOFFSET (MENU_FILE_YOFFSET) - -#define MENU_TFT_XOFFSET (MENU_FILE_XOFFSET+MENU_FILE_W+8) -#define MENU_TFT_YOFFSET (MENU_VBAR_YOFFSET+32) -#define MENU_VGA_XOFFSET (MENU_FILE_XOFFSET+MENU_FILE_W+8) -#define MENU_VGA_YOFFSET (MENU_VBAR_YOFFSET+MENU_FILE_H-32-37) - - - -static char romspath[64]; -static int nbFiles=0; -static int curFile=0; -static int topFile=0; -static char selection[MAX_FILENAME_SIZE+1]=""; -static char files[MAX_FILES][MAX_FILENAME_SIZE]; -static bool menuRedraw=true; - -#ifdef PICOMPUTER -static const unsigned short * keys; -static unsigned char keymatrix[6]; -static int keymatrix_hitrow=-1; -static bool key_fn=false; -static bool key_alt=false; -static uint32_t keypress_t_ms=0; -static uint32_t last_t_ms=0; -static uint32_t hundred_ms_cnt=0; -static bool ledflash_toggle=false; -#endif -static int keyMap; - -static bool joySwapped = false; -static uint16_t bLastState; -static int xRef; -static int yRef; -static uint8_t usbnavpad=0; - -static bool menuOn=true; - - - -/******************************** - * Generic output and malloc -********************************/ -void emu_printf(char * text) -{ - printf("%s\n",text); -} - -void emu_printf(int val) -{ - printf("%d\n",val); -} - -void emu_printi(int val) -{ - printf("%d\n",val); -} - -void emu_printh(int val) -{ - printf("0x%.8\n",val); -} - -static int malbufpt = 0; -static char malbuf[EXTRA_HEAP]; - -void * emu_Malloc(int size) -{ - void * retval = malloc(size); - if (!retval) { - emu_printf("failled to allocate"); - emu_printf(size); - emu_printf("fallback"); - if ( (malbufpt+size) < sizeof(malbuf) ) { - retval = (void *)&malbuf[malbufpt]; - malbufpt += size; - } - else { - emu_printf("failure to allocate"); - } - } - else { - emu_printf("could allocate dynamic "); - emu_printf(size); - } - - return retval; -} - -void * emu_MallocI(int size) -{ - void * retval = NULL; - - if ( (malbufpt+size) < sizeof(malbuf) ) { - retval = (void *)&malbuf[malbufpt]; - malbufpt += size; - emu_printf("could allocate static "); - emu_printf(size); - } - else { - emu_printf("failure to allocate"); - } - - return retval; -} -void emu_Free(void * pt) -{ - free(pt); -} - -void emu_drawText(unsigned short x, unsigned short y, const char * text, unsigned short fgcolor, unsigned short bgcolor, int doublesize) -{ - tft.drawText(x, y, text, fgcolor, bgcolor, doublesize?true:false); -} - - -/******************************** - * OSKB handling -********************************/ -#if (defined(ILI9341) || defined(ST7789)) && defined(USE_VGA) -// On screen keyboard position -#define KXOFF 28 //64 -#define KYOFF 96 -#define KWIDTH 11 //22 -#define KHEIGHT 3 - -static bool oskbOn = false; -static int cxpos = 0; -static int cypos = 0; -static int oskbMap = 0; -static uint16_t oskbBLastState = 0; - -static void lineOSKB2(int kxoff, int kyoff, char * str, int row) -{ - char c[2] = {'A',0}; - const char * cpt = str; - for (int i=0; i.,SP ", 2); - if (oskbMap == 0) { - lineOSKB(KXOFF,KYOFF, keylables_map1_0, 0); - lineOSKB(KXOFF,KYOFF, keylables_map1_1, 1); - lineOSKB(KXOFF,KYOFF, keylables_map1_2, 2); - } - else if (oskbMap == 1) { - lineOSKB(KXOFF,KYOFF, keylables_map2_0, 0); - lineOSKB(KXOFF,KYOFF, keylables_map2_1, 1); - lineOSKB(KXOFF,KYOFF, keylables_map2_2, 2); - } - else { - lineOSKB(KXOFF,KYOFF, keylables_map3_0, 0); - lineOSKB(KXOFF,KYOFF, keylables_map3_1, 1); - lineOSKB(KXOFF,KYOFF, keylables_map3_2, 2); - } -} - -void toggleOskb(bool forceoff) { - if (forceoff) oskbOn=true; - if (oskbOn) { - oskbOn = false; - tft.fillScreenNoDma(RGBVAL16(0x00,0x00,0x00)); - tft.drawTextNoDma(0,32, "Press USER2 to toggle onscreen keyboard.", RGBVAL16(0xff,0xff,0xff), RGBVAL16(0x00,0x00,0x00), true); - } else { - oskbOn = true; - tft.fillScreenNoDma(RGBVAL16(0x00,0x00,0x00)); - tft.drawTextNoDma(0,32, " Press USER2 to exit onscreen keyboard. ", RGBVAL16(0xff,0xff,0xff), RGBVAL16(0x00,0x00,0x00), true); - tft.drawTextNoDma(0,64, " (USER1 to toggle between keymaps) ", RGBVAL16(0x00,0xff,0xff), RGBVAL16(0x00,0x00,0xff), true); - tft.drawRectNoDma(KXOFF,KYOFF, 22*8, 3*16, RGBVAL16(0x00,0x00,0xFF)); - drawOskb(); - } -} - -static int handleOskb(void) -{ - int retval = 0; - - uint16_t bClick = bLastState & ~oskbBLastState; - oskbBLastState = bLastState; - /* - static const char * digits = "0123456789ABCDEF"; - char buf[5] = {0,0,0,0,0}; - int val = bClick; - buf[0] = digits[(val>>12)&0xf]; - buf[1] = digits[(val>>8)&0xf]; - buf[2] = digits[(val>>4)&0xf]; - buf[3] = digits[val&0xf]; - tft.drawTextNoDma(0,KYOFF+ 64,buf,RGBVAL16(0x00,0x00,0x00),RGBVAL16(0xFF,0xFF,0xFF),1); - */ - if (bClick & MASK_KEY_USER2) - { - toggleOskb(false); - } - if (oskbOn) - { - bool updated = true; - if (bClick & MASK_KEY_USER1) - { - oskbMap += 1; - if (oskbMap == 3) oskbMap = 0; - } - else if (bClick & MASK_JOY2_LEFT) - { - cxpos++; - if (cxpos >= KWIDTH) cxpos = 0; - } - else if (bClick & MASK_JOY2_RIGHT) - { - cxpos--; - if (cxpos < 0) cxpos = KWIDTH-1; - } - else if (bClick & MASK_JOY2_DOWN) - { - cypos++; - if (cypos >= KHEIGHT) cypos = 0; - } - else if (bClick & MASK_JOY2_UP) - { - cypos--; - if (cypos < 0) cypos = KHEIGHT-1; - } - else if (oskbBLastState & MASK_JOY2_BTN) - { - retval = cypos*KWIDTH+cxpos+1; - if (retval) { - retval--; - //if (retval & 1) retval = key_map2[retval>>1]; - //else retval = key_map1[retval>>1]; - if (oskbMap == 0) { - retval = key_map1[retval]; - } - else if (oskbMap == 1) { - retval = key_map2[retval]; - } - else { - retval = key_map3[retval]; - } - } - } - else { - updated=false; - } - if (updated) drawOskb(); - } - - return retval; -} -#endif - -/******************************** - * Input and keyboard -********************************/ -int emu_ReadAnalogJoyX(int min, int max) -{ - adc_select_input(0); - int val = adc_read(); -#if INVX - val = 4095 - val; -#endif - val = val-xRef; - val = ((val*140)/100); - if ( (val > -512) && (val < 512) ) val = 0; - val = val+2048; - return (val*(max-min))/4096; -} - -int emu_ReadAnalogJoyY(int min, int max) -{ - adc_select_input(1); - int val = adc_read(); -#if INVY - val = 4095 - val; -#endif - val = val-yRef; - val = ((val*120)/100); - if ( (val > -512) && (val < 512) ) val = 0; - //val = (val*(max-min))/4096; - val = val+2048; - //return val+(max-min)/2; - return (val*(max-min))/4096; -} - - -static uint16_t readAnalogJoystick(void) -{ - uint16_t joysval = 0; -#ifdef PIN_JOY2_A1X - int xReading = emu_ReadAnalogJoyX(0,256); - if (xReading > 128) joysval |= MASK_JOY2_LEFT; - else if (xReading < 128) joysval |= MASK_JOY2_RIGHT; - - int yReading = emu_ReadAnalogJoyY(0,256); - if (yReading < 128) joysval |= MASK_JOY2_UP; - else if (yReading > 128) joysval |= MASK_JOY2_DOWN; -#endif - // First joystick -#if INVY -#ifdef PIN_JOY2_1 - if ( !gpio_get(PIN_JOY2_1) ) joysval |= MASK_JOY2_DOWN; -#endif -#ifdef PIN_JOY2_2 - if ( !gpio_get(PIN_JOY2_2) ) joysval |= MASK_JOY2_UP; -#endif -#else -#ifdef PIN_JOY2_1 - if ( !gpio_get(PIN_JOY2_1) ) joysval |= MASK_JOY2_UP; -#endif -#ifdef PIN_JOY2_2 - if ( !gpio_get(PIN_JOY2_2) ) joysval |= MASK_JOY2_DOWN; -#endif -#endif -#if INVX -#ifdef PIN_JOY2_3 - if ( !gpio_get(PIN_JOY2_3) ) joysval |= MASK_JOY2_LEFT; -#endif -#ifdef PIN_JOY2_4 - if ( !gpio_get(PIN_JOY2_4) ) joysval |= MASK_JOY2_RIGHT; -#endif -#else -#ifdef PIN_JOY2_3 - if ( !gpio_get(PIN_JOY2_3) ) joysval |= MASK_JOY2_RIGHT; -#endif -#ifdef PIN_JOY2_4 - if ( !gpio_get(PIN_JOY2_4) ) joysval |= MASK_JOY2_LEFT; -#endif -#endif -#ifdef PIN_JOY2_BTN - joysval |= (gpio_get(PIN_JOY2_BTN) ? 0 : MASK_JOY2_BTN); -#endif - - return (joysval); -} - - -int emu_SwapJoysticks(int statusOnly) { - if (!statusOnly) { - if (joySwapped) { - joySwapped = false; - } - else { - joySwapped = true; - } - } - return(joySwapped?1:0); -} - -int emu_GetPad(void) -{ - return(bLastState/*|((joySwapped?1:0)<<7)*/); -} - -int emu_ReadKeys(void) -{ - uint16_t retval; - uint16_t j1 = readAnalogJoystick(); - uint16_t j2 = 0; - - // Second joystick -#if INVY -#ifdef PIN_JOY1_1 - if ( !gpio_get(PIN_JOY1_1) ) j2 |= MASK_JOY2_DOWN; -#endif -#ifdef PIN_JOY1_2 - if ( !gpio_get(PIN_JOY1_2) ) j2 |= MASK_JOY2_UP; -#endif -#else -#ifdef PIN_JOY1_1 - if ( !gpio_get(PIN_JOY1_1) ) j2 |= MASK_JOY2_UP; -#endif -#ifdef PIN_JOY1_2 - if ( !gpio_get(PIN_JOY1_2) ) j2 |= MASK_JOY2_DOWN; -#endif -#endif -#if INVX -#ifdef PIN_JOY1_3 - if ( !gpio_get(PIN_JOY1_3) ) j2 |= MASK_JOY2_LEFT; -#endif -#ifdef PIN_JOY1_4 - if ( !gpio_get(PIN_JOY1_4) ) j2 |= MASK_JOY2_RIGHT; -#endif -#else -#ifdef PIN_JOY1_3 - if ( !gpio_get(PIN_JOY1_3) ) j2 |= MASK_JOY2_RIGHT; -#endif -#ifdef PIN_JOY1_4 - if ( !gpio_get(PIN_JOY1_4) ) j2 |= MASK_JOY2_LEFT; -#endif -#endif -#ifdef PIN_JOY1_BTN - if ( !gpio_get(PIN_JOY1_BTN) ) j2 |= MASK_JOY2_BTN; -#endif - - - if (joySwapped) { - retval = ((j1 << 8) | j2); - } - else { - retval = ((j2 << 8) | j1); - } - - if (usbnavpad & MASK_JOY2_UP) retval |= MASK_JOY2_UP; - if (usbnavpad & MASK_JOY2_DOWN) retval |= MASK_JOY2_DOWN; - if (usbnavpad & MASK_JOY2_LEFT) retval |= MASK_JOY2_LEFT; - if (usbnavpad & MASK_JOY2_RIGHT) retval |= MASK_JOY2_RIGHT; - if (usbnavpad & MASK_JOY2_BTN) retval |= MASK_JOY2_BTN; - -#ifdef PIN_KEY_USER1 - if ( !gpio_get(PIN_KEY_USER1) ) retval |= MASK_KEY_USER1; -#endif -#ifdef PIN_KEY_USER2 - if ( !gpio_get(PIN_KEY_USER2) ) retval |= MASK_KEY_USER2; -#endif -#ifdef PIN_KEY_USER3 - if ( !gpio_get(PIN_KEY_USER3) ) retval |= MASK_KEY_USER3; -#endif -#ifdef PIN_KEY_USER4 - if ( !gpio_get(PIN_KEY_USER4) ) retval |= MASK_KEY_USER4; -#endif - -#ifdef PICOMPUTER - keymatrix_hitrow = -1; - unsigned char row; - unsigned short cols[6]={KCOLOUT1,KCOLOUT2,KCOLOUT3,KCOLOUT4,KCOLOUT5,KCOLOUT6}; - unsigned char keymatrixtmp[6]; - - for (int i=0;i<6;i++){ - gpio_set_dir(cols[i], GPIO_OUT); - gpio_put(cols[i], 0); -#ifdef SWAP_ALT_DEL - sleep_us(1); - //__asm volatile ("nop\n"); // 4-8ns -#endif - row=0; - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN4) ? 0 : 0x02); - row |= (gpio_get(KROWIN1) ? 0 : 0x04); - row |= (gpio_get(KROWIN3) ? 0 : 0x08); - row |= (gpio_get(KROWIN5) ? 0 : 0x10); - row |= (gpio_get(KROWIN6) ? 0 : 0x20); - //gpio_set_dir(cols[i], GPIO_OUT); - gpio_put(cols[i], 1); - gpio_set_dir(cols[i], GPIO_IN); - gpio_disable_pulls(cols[i]); - keymatrixtmp[i] = row; - } - -#ifdef MULTI_DEBOUNCE - for (int i=0;i<6;i++){ - gpio_set_dir(cols[i], GPIO_OUT); - gpio_put(cols[i], 0); -#ifdef SWAP_ALT_DEL - sleep_us(1); - //__asm volatile ("nop\n"); // 4-8ns -#endif - row=0; - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN4) ? 0 : 0x02); - row |= (gpio_get(KROWIN1) ? 0 : 0x04); - row |= (gpio_get(KROWIN3) ? 0 : 0x08); - row |= (gpio_get(KROWIN5) ? 0 : 0x10); - row |= (gpio_get(KROWIN6) ? 0 : 0x20); - //gpio_set_dir(cols[i], GPIO_OUT); - gpio_put(cols[i], 1); - gpio_set_dir(cols[i], GPIO_IN); - gpio_disable_pulls(cols[i]); - keymatrixtmp[i] |= row; - } - - for (int i=0;i<6;i++){ - gpio_set_dir(cols[i], GPIO_OUT); - gpio_put(cols[i], 0); -#ifdef SWAP_ALT_DEL - sleep_us(1); - //__asm volatile ("nop\n"); // 4-8ns -#endif - row=0; - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN2) ? 0 : 0x01); - row |= (gpio_get(KROWIN4) ? 0 : 0x02); - row |= (gpio_get(KROWIN1) ? 0 : 0x04); - row |= (gpio_get(KROWIN3) ? 0 : 0x08); - row |= (gpio_get(KROWIN5) ? 0 : 0x10); - row |= (gpio_get(KROWIN6) ? 0 : 0x20); - //gpio_set_dir(cols[i], GPIO_OUT); - gpio_put(cols[i], 1); - gpio_set_dir(cols[i], GPIO_IN); - gpio_disable_pulls(cols[i]); - keymatrixtmp[i] |= row; - } -#endif - - -#ifdef SWAP_ALT_DEL - // Swap ALT and DEL - unsigned char alt = keymatrixtmp[0] & 0x02; - unsigned char del = keymatrixtmp[5] & 0x20; - keymatrixtmp[0] &= ~0x02; - keymatrixtmp[5] &= ~0x20; - if (alt) keymatrixtmp[5] |= 0x20; - if (del) keymatrixtmp[0] |= 0x02; -#endif - - bool alt_pressed=false; - if ( keymatrixtmp[5] & 0x20 ) {alt_pressed=true; keymatrixtmp[5] &= ~0x20;}; - - for (int i=0;i<6;i++){ - row = keymatrixtmp[i]; - if (row) keymatrix_hitrow=i; - keymatrix[i] = row; - } - - //6,9,15,8,7,22 -#if INVX - if ( row & 0x2 ) retval |= MASK_JOY2_LEFT; - if ( row & 0x1 ) retval |= MASK_JOY2_RIGHT; -#else - if ( row & 0x1 ) retval |= MASK_JOY2_LEFT; - if ( row & 0x2 ) retval |= MASK_JOY2_RIGHT; -#endif -#if INVY - if ( row & 0x8 ) retval |= MASK_JOY2_DOWN; - if ( row & 0x4 ) retval |= MASK_JOY2_UP; -#else - if ( row & 0x4 ) retval |= MASK_JOY2_DOWN; - if ( row & 0x8 ) retval |= MASK_JOY2_UP; -#endif - if ( row & 0x10 ) retval |= MASK_JOY2_BTN; - - // Handle LED flash - uint32_t time_ms=to_ms_since_boot (get_absolute_time()); - if ((time_ms-last_t_ms) > 100) { - last_t_ms = time_ms; - if (ledflash_toggle == false) { - ledflash_toggle = true; - } - else { - ledflash_toggle = false; - } - } - - if ( alt_pressed ) { - if (key_fn == false) - { - // Release to Press transition - if (hundred_ms_cnt == 0) { - keypress_t_ms=time_ms; - hundred_ms_cnt += 1; // 1 - } - else { - hundred_ms_cnt += 1; // 2 - if (hundred_ms_cnt >= 2) - { - hundred_ms_cnt = 0; - /* - if ( (time_ms-keypress_t_ms) < 500) - { - if (key_alt == false) - { - key_alt = true; - } - else - { - key_alt = false; - } - } - */ - } - } - } - else { - // Keep press - if (hundred_ms_cnt == 1) { - if ((to_ms_since_boot (get_absolute_time())-keypress_t_ms) > 2000) - { - if (key_alt == false) - { - key_alt = true; - } - else - { - key_alt = false; - } - hundred_ms_cnt = 0; - } - } - } - key_fn = true; - } - else { - key_fn = false; - } - - // Handle LED - if (key_alt == true) { - gpio_put(KLED, (ledflash_toggle?1:0)); - } - else { - if (key_fn == true) { - gpio_put(KLED, 1); - } - else { - gpio_put(KLED, 0); - } - } - - if ( key_fn ) retval |= MASK_KEY_USER2; - if ( ( key_fn ) && (keymatrix[0] == 0x02 )) retval |= MASK_KEY_USER1; -#endif - - //Serial.println(retval,HEX); - - if ( ((retval & (MASK_KEY_USER1+MASK_KEY_USER2)) == (MASK_KEY_USER1+MASK_KEY_USER2)) - || (retval & MASK_KEY_USER4 ) ) - { - } - -#if (defined(ILI9341) || defined(ST7789)) && defined(USE_VGA) - if (oskbOn) { - retval |= MASK_OSKB; - } -#endif - - return (retval); -} - -unsigned short emu_DebounceLocalKeys(void) -{ - uint16_t bCurState = emu_ReadKeys(); - uint16_t bClick = bCurState & ~bLastState; - bLastState = bCurState; - - return (bClick); -} - -int emu_ReadI2CKeyboard(void) { - int retval=0; -#ifdef PICOMPUTER - if (key_alt) { - keys = (const unsigned short *)key_map3; - } - else if (key_fn) { - keys = (const unsigned short *)key_map2; - } - else { - keys = (const unsigned short *)key_map1; - } - if (keymatrix_hitrow >=0 ) { - unsigned short match = ((unsigned short)keymatrix_hitrow<<8) | keymatrix[keymatrix_hitrow]; - for (int i=0; i +#define TITLE " keymaptest " +#define ROMSDIR "" #ifdef KEYMAP_PRESENT +#ifdef PICOZX +const unsigned short key_map1[] = { + '1','2','3','4','5','6','7','8','9','0', + 'Q','W','E','R','T','Y','U','I','O','P', + 'A','S','D','F','G','H','J','K','L',0x0D, + 0,'Z','X','C','V','B','N','M',0,' ', + 145,157,29,17,157,29 //U L R D L R + }; + +const unsigned short key_map2[] = { + '!','@','#','$','%','&','\'','(',')','_', + 0,0,0,'<','>',0,0,0,';','"', + 0,0,0,0,0,'^','-','+','=',0x0D, + 0,':',0,'?','\/','*',',','.',0,' ', + 0,0,0,0,0,0 + }; + +const unsigned short key_map3[] = { + 133,134,135,136,137,138,139,140,0,0, // function keys + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0 + }; + +const unsigned short matkeys[] = { + 0x104,0x101,0x108,0x102,0x110,0x120,0x140,0x204,0x201,0x208, // row 1 + 0x202,0x210,0x220,0x240,0x304,0x301,0x308,0x302,0x310,0x320, // row 2 + 0x340,0x404,0x401,0x408,0x402,0x410,0x420,0x440,0x504,0x501, // row 3 + 0x020,0x508,0x502,0x510,0x520,0x540,0x604,0x601,0x040,0x608, // row 4 + 0x008,0x001,0x002,0x010,0x620,0x640 }; // cursor keys up, left, right, down, <<<, >>> + +#else #define keylables_map1_0 (char *)"qwertyuiop\x1a" #define keylables_map1_1 (char *)" asdfghjkl\x19" #define keylables_map1_2 (char *)" zxcvbnm.\x10 " @@ -18,7 +52,7 @@ const unsigned short key_map1[] = { 'Q','W','E','R','T','Y','U','I','O','P',157, 0,'A','S','D','F','G','H','J','K','L',0x0D, 0,'Z','X','C','V','B','N','M','.',' ', - 145,157,29,17 + 145,157,29,17 //U L R D }; #define keylables_map2_0 (char *)"1234567890 " @@ -46,45 +80,7 @@ const unsigned short matkeys[] = { 0x510,0x010,0x110,0x210,0x310,0x410,0x401,0x301,0x201,0x101,0x001, // row 2 0x520,0x102,0x202,0x302,0x402,0x404,0x304,0x204,0x104,0x004, // row 3 0x508,0x501,0x502,0x504 }; // cursor keys - - +#endif #endif - -#define MASK_JOY2_RIGHT 0x0001 -#define MASK_JOY2_LEFT 0x0002 -#define MASK_JOY2_UP 0x0004 -#define MASK_JOY2_DOWN 0x0008 -#define MASK_JOY2_BTN 0x0010 -#define MASK_KEY_USER1 0x0020 -#define MASK_KEY_USER2 0x0040 -#define MASK_KEY_USER3 0x0080 -#define MASK_JOY1_RIGHT 0x0100 -#define MASK_JOY1_LEFT 0x0200 -#define MASK_JOY1_UP 0x0400 -#define MASK_JOY1_DOWN 0x0800 -#define MASK_JOY1_BTN 0x1000 -#define MASK_KEY_USER4 0x2000 - - - -extern void emu_init(void); -extern void emu_start(void); - -extern void emu_InitJoysticks(void); -extern int emu_SwapJoysticks(int statusOnly); -extern unsigned short emu_DebounceLocalKeys(void); -extern int emu_ReadKeys(void); -extern int emu_GetPad(void); -extern int emu_ReadAnalogJoyX(int min, int max); -extern int emu_ReadAnalogJoyY(int min, int max); -extern int emu_ReadI2CKeyboard(void); -extern unsigned char emu_ReadI2CKeyboard2(int row); -extern void emu_KeyboardOnUp(int keymodifer, int key); -extern void emu_KeyboardOnDown(int keymodifer, int key); - - -extern int emu_setKeymap(int index); - - #endif diff --git a/MCUME_pico/pico8086/keyboard_osd.h b/MCUME_pico/testkeymax/keyboard_osd.h similarity index 100% rename from MCUME_pico/pico8086/keyboard_osd.h rename to MCUME_pico/testkeymax/keyboard_osd.h diff --git a/MCUME_pico/testkeymax/testkeymax.cpp b/MCUME_pico/testkeymax/testkeymax.cpp index 2356001..4aa1cde 100644 --- a/MCUME_pico/testkeymax/testkeymax.cpp +++ b/MCUME_pico/testkeymax/testkeymax.cpp @@ -1,24 +1,17 @@ #include "pico.h" #include "pico/stdlib.h" #include - extern "C" { #include "iopins.h" #include "emuapi.h" } - -#ifdef USE_VGA -#include "vga_t_dma.h" -#else -#include "tft_t_dma.h" -#endif - -TFT_T_DMA tft; - +#include "keyboard_osd.h" +#include "pico_dsp.h" #define BLUE RGBVAL16(0, 0, 170) #define LIGHT_BLUE RGBVAL16(0, 136, 255) +PICO_DSP tft; static int fb_width, fb_height; @@ -43,36 +36,41 @@ bool repeating_timer_callback(struct repeating_timer *t) { } int main(void) { - vreg_set_voltage(VREG_VOLTAGE_1_05); +// vreg_set_voltage(VREG_VOLTAGE_1_05); // set_sys_clock_khz(125000, true); // set_sys_clock_khz(150000, true); // set_sys_clock_khz(133000, true); // set_sys_clock_khz(200000, true); +// set_sys_clock_khz(210000, true); + set_sys_clock_khz(230000, true); // set_sys_clock_khz(225000, true); - set_sys_clock_khz(250000, true); +// set_sys_clock_khz(250000, true); stdio_init_all(); printf("start\n"); -#ifdef USE_VGA -// tft.begin(VGA_MODE_400x240); - tft.begin(VGA_MODE_320x240); -#else - tft.begin(); -#endif + emu_init(); +#ifdef FILEBROWSER + while (true) { + if (menuActive()) { + uint16_t bClick = emu_DebounceLocalKeys(); + int action = handleMenu(bClick); + char * filename = menuSelection(); + if (action == ACTION_RUN) { + break; + } + tft.waitSync(); + } + } +#endif emu_start(); - //tft.startDMA(); + tft.startRefresh(); struct repeating_timer timer; add_repeating_timer_ms(20, repeating_timer_callback, NULL, &timer); - - tft.fillScreenNoDma(LIGHT_BLUE); - + tft.fillScreen(LIGHT_BLUE); tft.get_frame_buffer_size(&fb_width, &fb_height); - tft.drawRectNoDma((fb_width-320)/2,(fb_height-200)/2, 320,200, BLUE); - //tft.drawTextNoDma((fb_width-320)/2,(fb_height-200)/2+1*8," **** COMMODORE 64 BASIC V2 **** ",LIGHT_BLUE,BLUE,false); - //tft.drawTextNoDma((fb_width-320)/2,(fb_height-200)/2+3*8," 64K RAM SYSTEM 38911 BASIC BYTES FREE ",LIGHT_BLUE,BLUE,false); - //tft.drawTextNoDma((fb_width-320)/2,(fb_height-200)/2+5*8,"READY.",LIGHT_BLUE,BLUE,false); + tft.drawRect((fb_width-320)/2,(fb_height-200)/2, 320,200, BLUE); char buf[4] = {32,32,32,0}; uint sys_clk = clock_get_hz(clk_sys)/1000000; @@ -84,7 +82,7 @@ int main(void) { buf[0] = digits[r1]; buf[1] = digits[r2]; buf[2] = digits[r3]; - tft.drawTextNoDma(8,8,buf,BLUE,LIGHT_BLUE,false); + tft.drawText(8,8,buf,BLUE,LIGHT_BLUE,false); while (true) { uint16_t bClick = emu_GetPad(); @@ -93,44 +91,49 @@ int main(void) { buf[1] = digits[(bClick>>8)&0xf]; buf[2] = digits[(bClick>>4)&0xf]; buf[3] = digits[bClick&0xf]; - tft.drawTextNoDma(4*8,0,buf,RGBVAL16(0x00,0x00,0x00),RGBVAL16(0xFF,0xFF,0xFF),false); + tft.drawText(4*8,0,buf,RGBVAL16(0x00,0x00,0x00),RGBVAL16(0xFF,0xFF,0xFF),false); buf[3] = 0; int key = emu_ReadI2CKeyboard(); buf[0] = digits[(key>>8)&0xf]; buf[1] = digits[(key>>4)&0xf]; buf[2] = digits[key&0xf]; - tft.drawTextNoDma(4*8,8,buf,RGBVAL16(0x00,0x00,0x00),RGBVAL16(0xFF,0xFF,0xFF),false); + tft.drawText(4*8,8,buf,RGBVAL16(0x00,0x00,0x00),RGBVAL16(0xFF,0xFF,0xFF),false); buf[2] = 0; key = emu_ReadI2CKeyboard2(0); buf[0] = digits[(key>>4)&0xf]; buf[1] = digits[key&0xf]; - tft.drawTextNoDma(9*8+0*24,0*8,buf,RGBVAL16(0x00,0x00,0x00),RGBVAL16(0xFF,0xFF,0xFF),true); + tft.drawText(9*8+0*24,0*8,buf,RGBVAL16(0x00,0x00,0x00),RGBVAL16(0xFF,0xFF,0xFF),true); key = emu_ReadI2CKeyboard2(1); buf[0] = digits[(key>>4)&0xf]; buf[1] = digits[key&0xf]; - tft.drawTextNoDma(9*8+1*24,0*8,buf,RGBVAL16(0x00,0x00,0x00),RGBVAL16(0xFF,0xFF,0xFF),true); + tft.drawText(9*8+1*24,0*8,buf,RGBVAL16(0x00,0x00,0x00),RGBVAL16(0xFF,0xFF,0xFF),true); key = emu_ReadI2CKeyboard2(2); buf[0] = digits[(key>>4)&0xf]; buf[1] = digits[key&0xf]; - tft.drawTextNoDma(9*8+2*24,0*8,buf,RGBVAL16(0x00,0x00,0x00),RGBVAL16(0xFF,0xFF,0xFF),true); + tft.drawText(9*8+2*24,0*8,buf,RGBVAL16(0x00,0x00,0x00),RGBVAL16(0xFF,0xFF,0xFF),true); key = emu_ReadI2CKeyboard2(3); buf[0] = digits[(key>>4)&0xf]; buf[1] = digits[key&0xf]; - tft.drawTextNoDma(9*8+3*24,0*8,buf,RGBVAL16(0x00,0x00,0x00),RGBVAL16(0xFF,0xFF,0xFF),true); + tft.drawText(9*8+3*24,0*8,buf,RGBVAL16(0x00,0x00,0x00),RGBVAL16(0xFF,0xFF,0xFF),true); key = emu_ReadI2CKeyboard2(4); buf[0] = digits[(key>>4)&0xf]; buf[1] = digits[key&0xf]; - tft.drawTextNoDma(9*8+4*24,0*8,buf,RGBVAL16(0x00,0x00,0x00),RGBVAL16(0xFF,0xFF,0xFF),true); + tft.drawText(9*8+4*24,0*8,buf,RGBVAL16(0x00,0x00,0x00),RGBVAL16(0xFF,0xFF,0xFF),true); key = emu_ReadI2CKeyboard2(5); buf[0] = digits[(key>>4)&0xf]; buf[1] = digits[key&0xf]; - tft.drawTextNoDma(9*8+5*24,0*8,buf,RGBVAL16(0x00,0x00,0x00),RGBVAL16(0xFF,0xFF,0xFF),true); - + tft.drawText(9*8+5*24,0*8,buf,RGBVAL16(0x00,0x00,0x00),RGBVAL16(0xFF,0xFF,0xFF),true); +#ifdef PICOZX + key = emu_ReadI2CKeyboard2(6); + buf[0] = digits[(key>>4)&0xf]; + buf[1] = digits[key&0xf]; + tft.drawText(9*8+6*24,0*8,buf,RGBVAL16(0x00,0x00,0x00),RGBVAL16(0xFF,0xFF,0xFF),true); +#endif if ( (hk != 0) && (hk < 128) ) { buf[0] = (char)(hk&0xff); buf[1] = 0; - tft.drawTextNoDma(col*8,(row+3)*8,buf,LIGHT_BLUE,BLUE,false); + tft.drawText(col*8,(row+3)*8,buf,LIGHT_BLUE,BLUE,false); col += 1; if (col >= 40) { col=0; @@ -147,24 +150,7 @@ int main(void) { } } prevhk = hk; - sleep_ms(20); - -/* - sleep_ms(2000); - tft.stopDMA(); - tft.fillScreenNoDma( RGBVAL16(0xff,0x00,0x00) ); - sleep_ms(2000); - tft.startDMA(); - tft.fillScreen(LIGHT_BLUE); -*/ - - //tft.waitSync(); - //tft.drawText((fb_width-320)/2,(fb_height-200)/2+6*8," ",BLUE,LIGHT_BLUE,false); - //sleep_ms(500); - //tft.waitSync(); - //tft.drawText((fb_width-320)/2,(fb_height-200)/2+6*8," ",BLUE,BLUE,false); - //sleep_ms(500); } } diff --git a/MCUME_pico/testpsram/emuapi.cpp b/MCUME_pico/testpsram/emuapi.cpp deleted file mode 100644 index b990cf5..0000000 --- a/MCUME_pico/testpsram/emuapi.cpp +++ /dev/null @@ -1,957 +0,0 @@ -#define KEYMAP_PRESENT 1 - -#define PROGMEM - -#include "pico.h" -#include "pico/stdlib.h" -#include "hardware/adc.h" -#include -#include - -extern "C" { - #include "emuapi.h" - #include "iopins.h" -} - -#if (defined(ILI9341) || defined(ST7789)) && defined(USE_VGA) -// Dual display config, initialize TFT -#include "tft_t_dma.h" -static TFT_T_DMA tft; -#else -// Non Dual display config -#ifdef USE_VGA -#include "vga_t_dma.h" -#else -#include "tft_t_dma.h" -#endif -extern TFT_T_DMA tft; -#endif - - -#define MAX_FILES 64 -#define MAX_FILENAME_SIZE 24 -#define MAX_MENULINES 9 -#define TEXT_HEIGHT 16 -#define TEXT_WIDTH 8 -#define MENU_FILE_XOFFSET (6*TEXT_WIDTH) -#define MENU_FILE_YOFFSET (2*TEXT_HEIGHT) -#define MENU_FILE_W (MAX_FILENAME_SIZE*TEXT_WIDTH) -#define MENU_FILE_H (MAX_MENULINES*TEXT_HEIGHT) -#define MENU_FILE_BGCOLOR RGBVAL16(0x00,0x00,0x40) -#define MENU_JOYS_YOFFSET (12*TEXT_HEIGHT) -#define MENU_VBAR_XOFFSET (0*TEXT_WIDTH) -#define MENU_VBAR_YOFFSET (MENU_FILE_YOFFSET) - -#define MENU_TFT_XOFFSET (MENU_FILE_XOFFSET+MENU_FILE_W+8) -#define MENU_TFT_YOFFSET (MENU_VBAR_YOFFSET+32) -#define MENU_VGA_XOFFSET (MENU_FILE_XOFFSET+MENU_FILE_W+8) -#define MENU_VGA_YOFFSET (MENU_VBAR_YOFFSET+MENU_FILE_H-32-37) - - - -static char romspath[64]; -static int nbFiles=0; -static int curFile=0; -static int topFile=0; -static char selection[MAX_FILENAME_SIZE+1]=""; -static char files[MAX_FILES][MAX_FILENAME_SIZE]; -static bool menuRedraw=true; - -#ifdef PICOMPUTER -static const unsigned short * keys; -static unsigned char keymatrix[6]; -static int keymatrix_hitrow=-1; -static bool key_fn=false; -static bool key_alt=false; -static uint32_t keypress_t_ms=0; -static uint32_t last_t_ms=0; -static uint32_t hundred_ms_cnt=0; -static bool ledflash_toggle=false; -#endif -static int keyMap; - -static bool joySwapped = false; -static uint16_t bLastState; -static int xRef; -static int yRef; -static uint8_t usbnavpad=0; - -static bool menuOn=true; - - - -/******************************** - * Generic output and malloc -********************************/ -void emu_printf(char * text) -{ - printf("%s\n",text); -} - -void emu_printf(int val) -{ - printf("%d\n",val); -} - -void emu_printi(int val) -{ - printf("%d\n",val); -} - -void emu_printh(int val) -{ - printf("0x%.8\n",val); -} - -static int malbufpt = 0; -static char malbuf[EXTRA_HEAP]; - -void * emu_Malloc(int size) -{ - void * retval = malloc(size); - if (!retval) { - emu_printf("failled to allocate"); - emu_printf(size); - emu_printf("fallback"); - if ( (malbufpt+size) < sizeof(malbuf) ) { - retval = (void *)&malbuf[malbufpt]; - malbufpt += size; - } - else { - emu_printf("failure to allocate"); - } - } - else { - emu_printf("could allocate dynamic "); - emu_printf(size); - } - - return retval; -} - -void * emu_MallocI(int size) -{ - void * retval = NULL; - - if ( (malbufpt+size) < sizeof(malbuf) ) { - retval = (void *)&malbuf[malbufpt]; - malbufpt += size; - emu_printf("could allocate static "); - emu_printf(size); - } - else { - emu_printf("failure to allocate"); - } - - return retval; -} -void emu_Free(void * pt) -{ - free(pt); -} - -void emu_drawText(unsigned short x, unsigned short y, const char * text, unsigned short fgcolor, unsigned short bgcolor, int doublesize) -{ - tft.drawText(x, y, text, fgcolor, bgcolor, doublesize?true:false); -} - - -/******************************** - * OSKB handling -********************************/ -#if (defined(ILI9341) || defined(ST7789)) && defined(USE_VGA) -// On screen keyboard position -#define KXOFF 28 //64 -#define KYOFF 96 -#define KWIDTH 11 //22 -#define KHEIGHT 3 - -static bool oskbOn = false; -static int cxpos = 0; -static int cypos = 0; -static int oskbMap = 0; -static uint16_t oskbBLastState = 0; - -static void lineOSKB2(int kxoff, int kyoff, char * str, int row) -{ - char c[2] = {'A',0}; - const char * cpt = str; - for (int i=0; i.,SP ", 2); - if (oskbMap == 0) { - lineOSKB(KXOFF,KYOFF, keylables_map1_0, 0); - lineOSKB(KXOFF,KYOFF, keylables_map1_1, 1); - lineOSKB(KXOFF,KYOFF, keylables_map1_2, 2); - } - else if (oskbMap == 1) { - lineOSKB(KXOFF,KYOFF, keylables_map2_0, 0); - lineOSKB(KXOFF,KYOFF, keylables_map2_1, 1); - lineOSKB(KXOFF,KYOFF, keylables_map2_2, 2); - } - else { - lineOSKB(KXOFF,KYOFF, keylables_map3_0, 0); - lineOSKB(KXOFF,KYOFF, keylables_map3_1, 1); - lineOSKB(KXOFF,KYOFF, keylables_map3_2, 2); - } -} - -void toggleOskb(bool forceoff) { - if (forceoff) oskbOn=true; - if (oskbOn) { - oskbOn = false; - tft.fillScreenNoDma(RGBVAL16(0x00,0x00,0x00)); - tft.drawTextNoDma(0,32, "Press USER2 to toggle onscreen keyboard.", RGBVAL16(0xff,0xff,0xff), RGBVAL16(0x00,0x00,0x00), true); - } else { - oskbOn = true; - tft.fillScreenNoDma(RGBVAL16(0x00,0x00,0x00)); - tft.drawTextNoDma(0,32, " Press USER2 to exit onscreen keyboard. ", RGBVAL16(0xff,0xff,0xff), RGBVAL16(0x00,0x00,0x00), true); - tft.drawTextNoDma(0,64, " (USER1 to toggle between keymaps) ", RGBVAL16(0x00,0xff,0xff), RGBVAL16(0x00,0x00,0xff), true); - tft.drawRectNoDma(KXOFF,KYOFF, 22*8, 3*16, RGBVAL16(0x00,0x00,0xFF)); - drawOskb(); - } -} - -static int handleOskb(void) -{ - int retval = 0; - - uint16_t bClick = bLastState & ~oskbBLastState; - oskbBLastState = bLastState; - /* - static const char * digits = "0123456789ABCDEF"; - char buf[5] = {0,0,0,0,0}; - int val = bClick; - buf[0] = digits[(val>>12)&0xf]; - buf[1] = digits[(val>>8)&0xf]; - buf[2] = digits[(val>>4)&0xf]; - buf[3] = digits[val&0xf]; - tft.drawTextNoDma(0,KYOFF+ 64,buf,RGBVAL16(0x00,0x00,0x00),RGBVAL16(0xFF,0xFF,0xFF),1); - */ - if (bClick & MASK_KEY_USER2) - { - toggleOskb(false); - } - if (oskbOn) - { - bool updated = true; - if (bClick & MASK_KEY_USER1) - { - oskbMap += 1; - if (oskbMap == 3) oskbMap = 0; - } - else if (bClick & MASK_JOY2_LEFT) - { - cxpos++; - if (cxpos >= KWIDTH) cxpos = 0; - } - else if (bClick & MASK_JOY2_RIGHT) - { - cxpos--; - if (cxpos < 0) cxpos = KWIDTH-1; - } - else if (bClick & MASK_JOY2_DOWN) - { - cypos++; - if (cypos >= KHEIGHT) cypos = 0; - } - else if (bClick & MASK_JOY2_UP) - { - cypos--; - if (cypos < 0) cypos = KHEIGHT-1; - } - else if (oskbBLastState & MASK_JOY2_BTN) - { - retval = cypos*KWIDTH+cxpos+1; - if (retval) { - retval--; - //if (retval & 1) retval = key_map2[retval>>1]; - //else retval = key_map1[retval>>1]; - if (oskbMap == 0) { - retval = key_map1[retval]; - } - else if (oskbMap == 1) { - retval = key_map2[retval]; - } - else { - retval = key_map3[retval]; - } - } - } - else { - updated=false; - } - if (updated) drawOskb(); - } - - return retval; -} -#endif - -/******************************** - * Input and keyboard -********************************/ -int emu_ReadAnalogJoyX(int min, int max) -{ - adc_select_input(0); - int val = adc_read(); -#if INVX - val = 4095 - val; -#endif - val = val-xRef; - val = ((val*140)/100); - if ( (val > -512) && (val < 512) ) val = 0; - val = val+2048; - return (val*(max-min))/4096; -} - -int emu_ReadAnalogJoyY(int min, int max) -{ - adc_select_input(1); - int val = adc_read(); -#if INVY - val = 4095 - val; -#endif - val = val-yRef; - val = ((val*120)/100); - if ( (val > -512) && (val < 512) ) val = 0; - //val = (val*(max-min))/4096; - val = val+2048; - //return val+(max-min)/2; - return (val*(max-min))/4096; -} - - -static uint16_t readAnalogJoystick(void) -{ - uint16_t joysval = 0; -#ifdef PIN_JOY2_A1X - int xReading = emu_ReadAnalogJoyX(0,256); - if (xReading > 128) joysval |= MASK_JOY2_LEFT; - else if (xReading < 128) joysval |= MASK_JOY2_RIGHT; - - int yReading = emu_ReadAnalogJoyY(0,256); - if (yReading < 128) joysval |= MASK_JOY2_UP; - else if (yReading > 128) joysval |= MASK_JOY2_DOWN; -#endif - // First joystick -#if INVY -#ifdef PIN_JOY2_1 - if ( !gpio_get(PIN_JOY2_1) ) joysval |= MASK_JOY2_DOWN; -#endif -#ifdef PIN_JOY2_2 - if ( !gpio_get(PIN_JOY2_2) ) joysval |= MASK_JOY2_UP; -#endif -#else -#ifdef PIN_JOY2_1 - if ( !gpio_get(PIN_JOY2_1) ) joysval |= MASK_JOY2_UP; -#endif -#ifdef PIN_JOY2_2 - if ( !gpio_get(PIN_JOY2_2) ) joysval |= MASK_JOY2_DOWN; -#endif -#endif -#if INVX -#ifdef PIN_JOY2_3 - if ( !gpio_get(PIN_JOY2_3) ) joysval |= MASK_JOY2_LEFT; -#endif -#ifdef PIN_JOY2_4 - if ( !gpio_get(PIN_JOY2_4) ) joysval |= MASK_JOY2_RIGHT; -#endif -#else -#ifdef PIN_JOY2_3 - if ( !gpio_get(PIN_JOY2_3) ) joysval |= MASK_JOY2_RIGHT; -#endif -#ifdef PIN_JOY2_4 - if ( !gpio_get(PIN_JOY2_4) ) joysval |= MASK_JOY2_LEFT; -#endif -#endif -#ifdef PIN_JOY2_BTN - joysval |= (gpio_get(PIN_JOY2_BTN) ? 0 : MASK_JOY2_BTN); -#endif - - return (joysval); -} - - -int emu_SwapJoysticks(int statusOnly) { - if (!statusOnly) { - if (joySwapped) { - joySwapped = false; - } - else { - joySwapped = true; - } - } - return(joySwapped?1:0); -} - -int emu_GetPad(void) -{ - return(bLastState/*|((joySwapped?1:0)<<7)*/); -} - -int emu_ReadKeys(void) -{ - uint16_t retval; - uint16_t j1 = readAnalogJoystick(); - uint16_t j2 = 0; - - // Second joystick -#if INVY -#ifdef PIN_JOY1_1 - if ( !gpio_get(PIN_JOY1_1) ) j2 |= MASK_JOY2_DOWN; -#endif -#ifdef PIN_JOY1_2 - if ( !gpio_get(PIN_JOY1_2) ) j2 |= MASK_JOY2_UP; -#endif -#else -#ifdef PIN_JOY1_1 - if ( !gpio_get(PIN_JOY1_1) ) j2 |= MASK_JOY2_UP; -#endif -#ifdef PIN_JOY1_2 - if ( !gpio_get(PIN_JOY1_2) ) j2 |= MASK_JOY2_DOWN; -#endif -#endif -#if INVX -#ifdef PIN_JOY1_3 - if ( !gpio_get(PIN_JOY1_3) ) j2 |= MASK_JOY2_LEFT; -#endif -#ifdef PIN_JOY1_4 - if ( !gpio_get(PIN_JOY1_4) ) j2 |= MASK_JOY2_RIGHT; -#endif -#else -#ifdef PIN_JOY1_3 - if ( !gpio_get(PIN_JOY1_3) ) j2 |= MASK_JOY2_RIGHT; -#endif -#ifdef PIN_JOY1_4 - if ( !gpio_get(PIN_JOY1_4) ) j2 |= MASK_JOY2_LEFT; -#endif -#endif -#ifdef PIN_JOY1_BTN - if ( !gpio_get(PIN_JOY1_BTN) ) j2 |= MASK_JOY2_BTN; -#endif - - - if (joySwapped) { - retval = ((j1 << 8) | j2); - } - else { - retval = ((j2 << 8) | j1); - } - - if (usbnavpad & MASK_JOY2_UP) retval |= MASK_JOY2_UP; - if (usbnavpad & MASK_JOY2_DOWN) retval |= MASK_JOY2_DOWN; - if (usbnavpad & MASK_JOY2_LEFT) retval |= MASK_JOY2_LEFT; - if (usbnavpad & MASK_JOY2_RIGHT) retval |= MASK_JOY2_RIGHT; - if (usbnavpad & MASK_JOY2_BTN) retval |= MASK_JOY2_BTN; - -#ifdef PIN_KEY_USER1 - if ( !gpio_get(PIN_KEY_USER1) ) retval |= MASK_KEY_USER1; -#endif -#ifdef PIN_KEY_USER2 - if ( !gpio_get(PIN_KEY_USER2) ) retval |= MASK_KEY_USER2; -#endif -#ifdef PIN_KEY_USER3 - if ( !gpio_get(PIN_KEY_USER3) ) retval |= MASK_KEY_USER3; -#endif -#ifdef PIN_KEY_USER4 - if ( !gpio_get(PIN_KEY_USER4) ) retval |= MASK_KEY_USER4; -#endif - -#ifdef PICOMPUTER - keymatrix_hitrow = -1; - unsigned char row; - unsigned short cols[6]={1,2,3,4,5,14}; - unsigned char keymatrixtmp[6]; - - for (int i=0;i<6;i++){ - gpio_set_dir(cols[i], GPIO_OUT); - gpio_put(cols[i], 0); -#ifdef SWAP_ALT_DEL - sleep_us(1); - //__asm volatile ("nop\n"); // 4-8ns -#endif - row=0; - row |= (gpio_get(9) ? 0 : 0x01); - row |= (gpio_get(9) ? 0 : 0x01); - row |= (gpio_get(9) ? 0 : 0x01); - row |= (gpio_get(9) ? 0 : 0x01); - row |= (gpio_get(8) ? 0 : 0x02); - row |= (gpio_get(6) ? 0 : 0x04); - row |= (gpio_get(15) ? 0 : 0x08); - row |= (gpio_get(7) ? 0 : 0x10); - row |= (gpio_get(22) ? 0 : 0x20); - //gpio_set_dir(cols[i], GPIO_OUT); - gpio_put(cols[i], 1); - gpio_set_dir(cols[i], GPIO_IN); - gpio_disable_pulls(cols[i]); - keymatrixtmp[i] = row; - } - -#ifdef MULTI_DEBOUNCE - for (int i=0;i<6;i++){ - gpio_set_dir(cols[i], GPIO_OUT); - gpio_put(cols[i], 0); -#ifdef SWAP_ALT_DEL - sleep_us(1); - //__asm volatile ("nop\n"); // 4-8ns -#endif - row=0; - row |= (gpio_get(9) ? 0 : 0x01); - row |= (gpio_get(9) ? 0 : 0x01); - row |= (gpio_get(9) ? 0 : 0x01); - row |= (gpio_get(9) ? 0 : 0x01); - row |= (gpio_get(8) ? 0 : 0x02); - row |= (gpio_get(6) ? 0 : 0x04); - row |= (gpio_get(15) ? 0 : 0x08); - row |= (gpio_get(7) ? 0 : 0x10); - row |= (gpio_get(22) ? 0 : 0x20); - //gpio_set_dir(cols[i], GPIO_OUT); - gpio_put(cols[i], 1); - gpio_set_dir(cols[i], GPIO_IN); - gpio_disable_pulls(cols[i]); - keymatrixtmp[i] |= row; - } - - for (int i=0;i<6;i++){ - gpio_set_dir(cols[i], GPIO_OUT); - gpio_put(cols[i], 0); -#ifdef SWAP_ALT_DEL - sleep_us(1); - //__asm volatile ("nop\n"); // 4-8ns -#endif - row=0; - row |= (gpio_get(9) ? 0 : 0x01); - row |= (gpio_get(9) ? 0 : 0x01); - row |= (gpio_get(9) ? 0 : 0x01); - row |= (gpio_get(9) ? 0 : 0x01); - row |= (gpio_get(8) ? 0 : 0x02); - row |= (gpio_get(6) ? 0 : 0x04); - row |= (gpio_get(15) ? 0 : 0x08); - row |= (gpio_get(7) ? 0 : 0x10); - row |= (gpio_get(22) ? 0 : 0x20); - //gpio_set_dir(cols[i], GPIO_OUT); - gpio_put(cols[i], 1); - gpio_set_dir(cols[i], GPIO_IN); - gpio_disable_pulls(cols[i]); - keymatrixtmp[i] |= row; - } -#endif - - -#ifdef SWAP_ALT_DEL - // Swap ALT and DEL - unsigned char alt = keymatrixtmp[0] & 0x02; - unsigned char del = keymatrixtmp[5] & 0x20; - keymatrixtmp[0] &= ~0x02; - keymatrixtmp[5] &= ~0x20; - if (alt) keymatrixtmp[5] |= 0x20; - if (del) keymatrixtmp[0] |= 0x02; -#endif - - bool alt_pressed=false; - if ( keymatrixtmp[5] & 0x20 ) {alt_pressed=true; keymatrixtmp[5] &= ~0x20;}; - - for (int i=0;i<6;i++){ - row = keymatrixtmp[i]; - if (row) keymatrix_hitrow=i; - keymatrix[i] = row; - } - - //6,9,15,8,7,22 -#if INVX - if ( row & 0x2 ) retval |= MASK_JOY2_LEFT; - if ( row & 0x1 ) retval |= MASK_JOY2_RIGHT; -#else - if ( row & 0x1 ) retval |= MASK_JOY2_LEFT; - if ( row & 0x2 ) retval |= MASK_JOY2_RIGHT; -#endif -#if INVY - if ( row & 0x8 ) retval |= MASK_JOY2_DOWN; - if ( row & 0x4 ) retval |= MASK_JOY2_UP; -#else - if ( row & 0x4 ) retval |= MASK_JOY2_DOWN; - if ( row & 0x8 ) retval |= MASK_JOY2_UP; -#endif - if ( row & 0x10 ) retval |= MASK_JOY2_BTN; - - // Handle LED flash - uint32_t time_ms=to_ms_since_boot (get_absolute_time()); - if ((time_ms-last_t_ms) > 100) { - last_t_ms = time_ms; - if (ledflash_toggle == false) { - ledflash_toggle = true; - } - else { - ledflash_toggle = false; - } - } - - if ( alt_pressed ) { - if (key_fn == false) - { - // Release to Press transition - if (hundred_ms_cnt == 0) { - keypress_t_ms=time_ms; - hundred_ms_cnt += 1; // 1 - } - else { - hundred_ms_cnt += 1; // 2 - if (hundred_ms_cnt >= 2) - { - hundred_ms_cnt = 0; - /* - if ( (time_ms-keypress_t_ms) < 500) - { - if (key_alt == false) - { - key_alt = true; - } - else - { - key_alt = false; - } - } - */ - } - } - } - else { - // Keep press - if (hundred_ms_cnt == 1) { - if ((to_ms_since_boot (get_absolute_time())-keypress_t_ms) > 2000) - { - if (key_alt == false) - { - key_alt = true; - } - else - { - key_alt = false; - } - hundred_ms_cnt = 0; - } - } - } - key_fn = true; - } - else { - key_fn = false; - } - - // Handle LED - if (key_alt == true) { - gpio_put(KLED, (ledflash_toggle?1:0)); - } - else { - if (key_fn == true) { - gpio_put(KLED, 1); - } - else { - gpio_put(KLED, 0); - } - } - - if ( key_fn ) retval |= MASK_KEY_USER2; - if ( ( key_fn ) && (keymatrix[0] == 0x02 )) retval |= MASK_KEY_USER1; -#endif - - //Serial.println(retval,HEX); - - if ( ((retval & (MASK_KEY_USER1+MASK_KEY_USER2)) == (MASK_KEY_USER1+MASK_KEY_USER2)) - || (retval & MASK_KEY_USER4 ) ) - { - } - -#if (defined(ILI9341) || defined(ST7789)) && defined(USE_VGA) - if (oskbOn) { - retval |= MASK_OSKB; - } -#endif - - return (retval); -} - -unsigned short emu_DebounceLocalKeys(void) -{ - uint16_t bCurState = emu_ReadKeys(); - uint16_t bClick = bCurState & ~bLastState; - bLastState = bCurState; - - return (bClick); -} - -int emu_ReadI2CKeyboard(void) { - int retval=0; -#ifdef PICOMPUTER - if (key_alt) { - keys = (const unsigned short *)key_map3; - } - else if (key_fn) { - keys = (const unsigned short *)key_map2; - } - else { - keys = (const unsigned short *)key_map1; - } - if (keymatrix_hitrow >=0 ) { - unsigned short match = ((unsigned short)keymatrix_hitrow<<8) | keymatrix[keymatrix_hitrow]; - for (int i=0; i,: " -const unsigned short key_map2[] = { - '1','2','3','4','5','6','7','8','9','0',0, - 0, '!','@','#','$','%','+','&','*','-','\/', - 0, '(',')','?','\/','"','<','>',',',':', - 0,0,0,0 - }; - -#define keylables_map3_0 (char *)"\x11\x12\x13\x14\x15\x16\x17\x18 " -#define keylables_map3_1 (char *)" " -#define keylables_map3_2 (char *)" ;= " -const unsigned short key_map3[] = { - 133,134,135,136,137,138,139,140,0,0,0, // function keys - 0, 0,0,0,0,0,0,0,0,0,0, - 0, 0,0,0,0,0,0,0,';','=', - 0,0,0,0 - }; - -const unsigned short matkeys[] = { - 0x020,0x120,0x220,0x320,0x420,0x408,0x308,0x208,0x108,0x008,0x002, // row 1 - 0x510,0x010,0x110,0x210,0x310,0x410,0x401,0x301,0x201,0x101,0x001, // row 2 - 0x520,0x102,0x202,0x302,0x402,0x404,0x304,0x204,0x104,0x004, // row 3 - 0x508,0x501,0x502,0x504 }; // cursor keys - - -#endif - - -#define MASK_JOY2_RIGHT 0x0001 -#define MASK_JOY2_LEFT 0x0002 -#define MASK_JOY2_UP 0x0004 -#define MASK_JOY2_DOWN 0x0008 -#define MASK_JOY2_BTN 0x0010 -#define MASK_KEY_USER1 0x0020 -#define MASK_KEY_USER2 0x0040 -#define MASK_KEY_USER3 0x0080 -#define MASK_JOY1_RIGHT 0x0100 -#define MASK_JOY1_LEFT 0x0200 -#define MASK_JOY1_UP 0x0400 -#define MASK_JOY1_DOWN 0x0800 -#define MASK_JOY1_BTN 0x1000 -#define MASK_KEY_USER4 0x2000 - - - -extern void emu_init(void); -extern void emu_start(void); - -extern void emu_InitJoysticks(void); -extern int emu_SwapJoysticks(int statusOnly); -extern unsigned short emu_DebounceLocalKeys(void); -extern int emu_ReadKeys(void); -extern int emu_GetPad(void); -extern int emu_ReadAnalogJoyX(int min, int max); -extern int emu_ReadAnalogJoyY(int min, int max); -extern int emu_ReadI2CKeyboard(void); -extern unsigned char emu_ReadI2CKeyboard2(int row); -extern void emu_KeyboardOnUp(int keymodifer, int key); -extern void emu_KeyboardOnDown(int keymodifer, int key); - - -extern int emu_setKeymap(int index); - - -#endif diff --git a/MCUME_pico/testpsram/testpsram.cpp b/MCUME_pico/testpsram/testpsram.cpp deleted file mode 100644 index d1c9daa..0000000 --- a/MCUME_pico/testpsram/testpsram.cpp +++ /dev/null @@ -1,126 +0,0 @@ -#include "pico.h" -#include "pico/stdlib.h" - -extern "C" { - #include "iopins.h" - #include "emuapi.h" -} - -#include -#include "psram_t.h" - -#ifdef USE_VGA -#include "vga_t_dma.h" -#else -#include "tft_t_dma.h" -#endif - - -TFT_T_DMA tft; - -#define BLUE RGBVAL16(0, 0, 170) -#define LIGHT_BLUE RGBVAL16(0, 136, 255) - -static int fb_width, fb_height; - - -#include "hardware/clocks.h" -#include "hardware/vreg.h" - -static const char * digits = "0123456789ABCDEF"; -static int hk = 0; - -void emu_Input(uint16_t bClick) { - hk = emu_ReadI2CKeyboard(); -} - -bool repeating_timer_callback(struct repeating_timer *t) { - uint16_t bClick = emu_DebounceLocalKeys(); - emu_Input(bClick); - return true; -} - - -PSRAM_T psram = PSRAM_T(PSRAM_CS, PSRAM_MOSI, PSRAM_SCLK, PSRAM_MISO); - -extern void write_loram(int address, uint8_t val) { - psram.pswrite(address,val); -} - -extern uint8_t read_loram(int address) { - return (psram.psread(address)); -} - - - -int main(void) { - vreg_set_voltage(VREG_VOLTAGE_1_05); -// set_sys_clock_khz(125000, true); -// set_sys_clock_khz(150000, true); -// set_sys_clock_khz(133000, true); -// set_sys_clock_khz(200000, true); -// set_sys_clock_khz(225000, true); - set_sys_clock_khz(250000, true); - - stdio_init_all(); - - printf("start\n"); -#ifdef USE_VGA -// tft.begin(VGA_MODE_400x240); - tft.begin(VGA_MODE_320x240); -#else - tft.begin(); -#endif - psram.begin(); - emu_init(); - emu_start(); - tft.startDMA(); - struct repeating_timer timer; - add_repeating_timer_ms(20, repeating_timer_callback, NULL, &timer); - - tft.fillScreenNoDma(LIGHT_BLUE); - tft.get_frame_buffer_size(&fb_width, &fb_height); - tft.drawRect((fb_width-320)/2,(fb_height-200)/2, 320,200, BLUE); - - char buf[4] = {32,32,32,0}; - uint sys_clk = clock_get_hz(clk_sys)/1000000; - uint r1 = sys_clk/100; - uint r = sys_clk - r1*100; - uint r2 = r/10; - r = sys_clk - r1*100 - r2*10; - uint r3 = r; - buf[0] = digits[r1]; - buf[1] = digits[r2]; - buf[2] = digits[r3]; - tft.drawText(0,0,buf,BLUE,LIGHT_BLUE,false); - int addr = 0; - while (true) { - char buf[5] = {0,0,0,0,0}; - buf[0] = digits[(addr>>12)&0xf]; - buf[1] = digits[(addr>>8)&0xf]; - buf[2] = digits[(addr>>4)&0xf]; - buf[3] = digits[addr&0xf]; - buf[4] = 0; - tft.drawText(8,64+0,buf,RGBVAL16(0x00,0x00,0x00),RGBVAL16(0xFF,0xFF,0xFF),false); - - for (int i=0; i<0x10; i++) { - write_loram(addr,i); - uint8_t val = 0xff; - val = read_loram(addr); - buf[0] = digits[(val>>4)&0xf]; - buf[1] = digits[val&0xf]; - buf[2] = 0; - tft.drawText(8,64+16+i*8,buf,RGBVAL16(0x00,0x00,0x00),RGBVAL16(0xFF,0xFF,0xFF),false); - addr += 1; - addr &= 0x1fff; - } - - sleep_ms(100); - } -} - - - - - - diff --git a/MCUME_pico/testvga/testvga.cpp b/MCUME_pico/testvga/testvga.cpp deleted file mode 100644 index 5564c1d..0000000 --- a/MCUME_pico/testvga/testvga.cpp +++ /dev/null @@ -1,76 +0,0 @@ -#include "pico.h" -#include "pico/stdlib.h" - -#include "vga_t_dma.h" - -#include -#include - -TFT_T_DMA vga; - -#define BLUE VGA_RGB(0, 0, 170) -#define LIGHT_BLUE VGA_RGB(0, 136, 255) - -static int fb_width, fb_height; - -static char * digits = "0123456789"; - -#include "hardware/clocks.h" -#include "hardware/vreg.h" - -static uint8_t pix = 0; -int main(void) { -// vreg_set_voltage(VREG_VOLTAGE_1_05); -// set_sys_clock_khz(125000, true); -// set_sys_clock_khz(150000, true); -// set_sys_clock_khz(133000, true); -// set_sys_clock_khz(200000, true); -// set_sys_clock_khz(210000, true); - set_sys_clock_khz(230000, true); -// set_sys_clock_khz(225000, true); -// set_sys_clock_khz(250000, true); - stdio_init_all(); - - printf("start\n"); - -// vga.begin(VGA_MODE_400x240); - vga.begin(VGA_MODE_320x240); - //tft.fillScreenNoDma( RGBVAL16(0xff,0x00,0x00) ); - vga.clear(LIGHT_BLUE); - vga.get_frame_buffer_size(&fb_width, &fb_height); - vga.drawRect((fb_width-320)/2,(fb_height-200)/2, 320,200, BLUE); - vga.drawText((fb_width-320)/2,(fb_height-200)/2+1*8," **** COMMODORE 64 BASIC V2 **** ",LIGHT_BLUE,BLUE,false); - vga.drawText((fb_width-320)/2,(fb_height-200)/2+3*8," 64K RAM SYSTEM 38911 BASIC BYTES FREE ",LIGHT_BLUE,BLUE,false); - vga.drawText((fb_width-320)/2,(fb_height-200)/2+5*8,"READY.",LIGHT_BLUE,BLUE,false); - - uint newclock = clock_get_hz(clk_sys)/1000000; - - char buf[4] = {32,32,32,0}; - uint r1 = newclock/100; - uint r = newclock - r1*100; - uint r2 = r/10; - r = newclock - r1*100 - r2*10; - uint r3 = r; - buf[0] = digits[r1]; - buf[1] = digits[r2]; - buf[2] = digits[r3]; - vga.drawText(4*8,8,buf,BLUE,LIGHT_BLUE,false); - - while (true) { - //tft.fillScreenNoDma( pix++ ); - vga.waitSync(); - vga.drawText((fb_width-320)/2,(fb_height-200)/2+6*8," ",BLUE,LIGHT_BLUE,false); - sleep_ms(500); - //vga.waitSync(); - vga.drawText((fb_width-320)/2,(fb_height-200)/2+6*8," ",BLUE,BLUE,false); - sleep_ms(500); - //vga.waitSync(); - printf("x\n"); - } -} - - - - - - diff --git a/MCUME_pico/tft_t/tft_font8x8.h b/MCUME_pico/tft_t/tft_font8x8.h deleted file mode 100644 index 8a556f3..0000000 --- a/MCUME_pico/tft_t/tft_font8x8.h +++ /dev/null @@ -1,148 +0,0 @@ - -// Font: c64_lower.64c - -const unsigned char font8x8[128][8] = -{ - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0000 (nul) - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0001 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0002 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0003 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0004 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0005 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0006 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0007 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0008 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0009 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000A - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000B - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000C - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000D - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000E - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000F - - { 0x7f, 0x41, 0x41, 0x41, 0x41, 0x41, 0x7f, 0x00 }, // Space // 0x10 - { 0x00, 0x27, 0x31, 0x27, 0x21, 0x71, 0x00, 0x00 }, // F1 // 0x11 - { 0x00, 0x77, 0x41, 0x77, 0x11, 0x71, 0x00, 0x00 }, // F2 - { 0x00, 0x77, 0x41, 0x77, 0x41, 0x71, 0x00, 0x00 }, // F3 - { 0x00, 0x17, 0x51, 0x77, 0x41, 0x41, 0x00, 0x00 }, // F4 - { 0x00, 0x77, 0x11, 0x77, 0x41, 0x71, 0x00, 0x00 }, // F5 - { 0x00, 0x77, 0x11, 0x77, 0x51, 0x71, 0x00, 0x00 }, // F6 - { 0x00, 0x77, 0x41, 0x47, 0x41, 0x41, 0x00, 0x00 }, // F7 - { 0x00, 0x77, 0x51, 0x77, 0x51, 0x71, 0x00, 0x00 }, // F8 // 0x18 - { 0x00, 0x00, 0x20, 0x24, 0x3e, 0x04, 0x00, 0x00 }, // Return // 0x19 - { 0x00, 0x59, 0x4b, 0x5b, 0x4b, 0xd9, 0x00, 0x00 }, // Del // 0x1A - //{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0010 - //{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0011 - //{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0012 - //{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0013 - //{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0014 - //{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0015 - //{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0016 - //{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0017 - //{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0018 - //{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0019 - //{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001A - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001B - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001C - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001D - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001E - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001F - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0020 (space) - { 0x18, 0x3C, 0x3C, 0x18, 0x18, 0x00, 0x18, 0x00}, // U+0021 (!) - { 0x36, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0022 (") - { 0x36, 0x36, 0x7F, 0x36, 0x7F, 0x36, 0x36, 0x00}, // U+0023 (#) - { 0x0C, 0x3E, 0x03, 0x1E, 0x30, 0x1F, 0x0C, 0x00}, // U+0024 ($) - { 0x00, 0x63, 0x33, 0x18, 0x0C, 0x66, 0x63, 0x00}, // U+0025 (%) - { 0x1C, 0x36, 0x1C, 0x6E, 0x3B, 0x33, 0x6E, 0x00}, // U+0026 (&) - { 0x06, 0x06, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0027 (') - { 0x18, 0x0C, 0x06, 0x06, 0x06, 0x0C, 0x18, 0x00}, // U+0028 (() - { 0x06, 0x0C, 0x18, 0x18, 0x18, 0x0C, 0x06, 0x00}, // U+0029 ()) - { 0x00, 0x66, 0x3C, 0xFF, 0x3C, 0x66, 0x00, 0x00}, // U+002A (*) - { 0x00, 0x0C, 0x0C, 0x3F, 0x0C, 0x0C, 0x00, 0x00}, // U+002B (+) - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x0C, 0x06}, // U+002C (,) - { 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x00}, // U+002D (-) - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x0C, 0x00}, // U+002E (.) - { 0x60, 0x30, 0x18, 0x0C, 0x06, 0x03, 0x01, 0x00}, // U+002F (/) - { 0x3E, 0x63, 0x73, 0x7B, 0x6F, 0x67, 0x3E, 0x00}, // U+0030 (0) - { 0x0C, 0x0E, 0x0C, 0x0C, 0x0C, 0x0C, 0x3F, 0x00}, // U+0031 (1) - { 0x1E, 0x33, 0x30, 0x1C, 0x06, 0x33, 0x3F, 0x00}, // U+0032 (2) - { 0x1E, 0x33, 0x30, 0x1C, 0x30, 0x33, 0x1E, 0x00}, // U+0033 (3) - { 0x38, 0x3C, 0x36, 0x33, 0x7F, 0x30, 0x78, 0x00}, // U+0034 (4) - { 0x3F, 0x03, 0x1F, 0x30, 0x30, 0x33, 0x1E, 0x00}, // U+0035 (5) - { 0x1C, 0x06, 0x03, 0x1F, 0x33, 0x33, 0x1E, 0x00}, // U+0036 (6) - { 0x3F, 0x33, 0x30, 0x18, 0x0C, 0x0C, 0x0C, 0x00}, // U+0037 (7) - { 0x1E, 0x33, 0x33, 0x1E, 0x33, 0x33, 0x1E, 0x00}, // U+0038 (8) - { 0x1E, 0x33, 0x33, 0x3E, 0x30, 0x18, 0x0E, 0x00}, // U+0039 (9) - { 0x00, 0x0C, 0x0C, 0x00, 0x00, 0x0C, 0x0C, 0x00}, // U+003A (:) - { 0x00, 0x0C, 0x0C, 0x00, 0x00, 0x0C, 0x0C, 0x06}, // U+003B (//) - { 0x18, 0x0C, 0x06, 0x03, 0x06, 0x0C, 0x18, 0x00}, // U+003C (<) - { 0x00, 0x00, 0x3F, 0x00, 0x00, 0x3F, 0x00, 0x00}, // U+003D (=) - { 0x06, 0x0C, 0x18, 0x30, 0x18, 0x0C, 0x06, 0x00}, // U+003E (>) - { 0x1E, 0x33, 0x30, 0x18, 0x0C, 0x00, 0x0C, 0x00}, // U+003F (?) - { 0x3E, 0x63, 0x7B, 0x7B, 0x7B, 0x03, 0x1E, 0x00}, // U+0040 (@) - { 0x0C, 0x1E, 0x33, 0x33, 0x3F, 0x33, 0x33, 0x00}, // U+0041 (A) - { 0x3F, 0x66, 0x66, 0x3E, 0x66, 0x66, 0x3F, 0x00}, // U+0042 (B) - { 0x3C, 0x66, 0x03, 0x03, 0x03, 0x66, 0x3C, 0x00}, // U+0043 (C) - { 0x1F, 0x36, 0x66, 0x66, 0x66, 0x36, 0x1F, 0x00}, // U+0044 (D) - { 0x7F, 0x46, 0x16, 0x1E, 0x16, 0x46, 0x7F, 0x00}, // U+0045 (E) - { 0x7F, 0x46, 0x16, 0x1E, 0x16, 0x06, 0x0F, 0x00}, // U+0046 (F) - { 0x3C, 0x66, 0x03, 0x03, 0x73, 0x66, 0x7C, 0x00}, // U+0047 (G) - { 0x33, 0x33, 0x33, 0x3F, 0x33, 0x33, 0x33, 0x00}, // U+0048 (H) - { 0x1E, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+0049 (I) - { 0x78, 0x30, 0x30, 0x30, 0x33, 0x33, 0x1E, 0x00}, // U+004A (J) - { 0x67, 0x66, 0x36, 0x1E, 0x36, 0x66, 0x67, 0x00}, // U+004B (K) - { 0x0F, 0x06, 0x06, 0x06, 0x46, 0x66, 0x7F, 0x00}, // U+004C (L) - { 0x63, 0x77, 0x7F, 0x7F, 0x6B, 0x63, 0x63, 0x00}, // U+004D (M) - { 0x63, 0x67, 0x6F, 0x7B, 0x73, 0x63, 0x63, 0x00}, // U+004E (N) - { 0x1C, 0x36, 0x63, 0x63, 0x63, 0x36, 0x1C, 0x00}, // U+004F (O) - { 0x3F, 0x66, 0x66, 0x3E, 0x06, 0x06, 0x0F, 0x00}, // U+0050 (P) - { 0x1E, 0x33, 0x33, 0x33, 0x3B, 0x1E, 0x38, 0x00}, // U+0051 (Q) - { 0x3F, 0x66, 0x66, 0x3E, 0x36, 0x66, 0x67, 0x00}, // U+0052 (R) - { 0x1E, 0x33, 0x07, 0x0E, 0x38, 0x33, 0x1E, 0x00}, // U+0053 (S) - { 0x3F, 0x2D, 0x0C, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+0054 (T) - { 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x3F, 0x00}, // U+0055 (U) - { 0x33, 0x33, 0x33, 0x33, 0x33, 0x1E, 0x0C, 0x00}, // U+0056 (V) - { 0x63, 0x63, 0x63, 0x6B, 0x7F, 0x77, 0x63, 0x00}, // U+0057 (W) - { 0x63, 0x63, 0x36, 0x1C, 0x1C, 0x36, 0x63, 0x00}, // U+0058 (X) - { 0x33, 0x33, 0x33, 0x1E, 0x0C, 0x0C, 0x1E, 0x00}, // U+0059 (Y) - { 0x7F, 0x63, 0x31, 0x18, 0x4C, 0x66, 0x7F, 0x00}, // U+005A (Z) - { 0x1E, 0x06, 0x06, 0x06, 0x06, 0x06, 0x1E, 0x00}, // U+005B ([) - { 0x03, 0x06, 0x0C, 0x18, 0x30, 0x60, 0x40, 0x00}, // U+005C (\) - { 0x1E, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1E, 0x00}, // U+005D (]) - { 0x08, 0x1C, 0x36, 0x63, 0x00, 0x00, 0x00, 0x00}, // U+005E (^) - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF}, // U+005F (_) - { 0x0C, 0x0C, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0060 (`) - { 0x00, 0x00, 0x1E, 0x30, 0x3E, 0x33, 0x6E, 0x00}, // U+0061 (a) - { 0x07, 0x06, 0x06, 0x3E, 0x66, 0x66, 0x3B, 0x00}, // U+0062 (b) - { 0x00, 0x00, 0x1E, 0x33, 0x03, 0x33, 0x1E, 0x00}, // U+0063 (c) - { 0x38, 0x30, 0x30, 0x3e, 0x33, 0x33, 0x6E, 0x00}, // U+0064 (d) - { 0x00, 0x00, 0x1E, 0x33, 0x3f, 0x03, 0x1E, 0x00}, // U+0065 (e) - { 0x1C, 0x36, 0x06, 0x0f, 0x06, 0x06, 0x0F, 0x00}, // U+0066 (f) - { 0x00, 0x00, 0x6E, 0x33, 0x33, 0x3E, 0x30, 0x1F}, // U+0067 (g) - { 0x07, 0x06, 0x36, 0x6E, 0x66, 0x66, 0x67, 0x00}, // U+0068 (h) - { 0x0C, 0x00, 0x0E, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+0069 (i) - { 0x30, 0x00, 0x30, 0x30, 0x30, 0x33, 0x33, 0x1E}, // U+006A (j) - { 0x07, 0x06, 0x66, 0x36, 0x1E, 0x36, 0x67, 0x00}, // U+006B (k) - { 0x0E, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+006C (l) - { 0x00, 0x00, 0x33, 0x7F, 0x7F, 0x6B, 0x63, 0x00}, // U+006D (m) - { 0x00, 0x00, 0x1F, 0x33, 0x33, 0x33, 0x33, 0x00}, // U+006E (n) - { 0x00, 0x00, 0x1E, 0x33, 0x33, 0x33, 0x1E, 0x00}, // U+006F (o) - { 0x00, 0x00, 0x3B, 0x66, 0x66, 0x3E, 0x06, 0x0F}, // U+0070 (p) - { 0x00, 0x00, 0x6E, 0x33, 0x33, 0x3E, 0x30, 0x78}, // U+0071 (q) - { 0x00, 0x00, 0x3B, 0x6E, 0x66, 0x06, 0x0F, 0x00}, // U+0072 (r) - { 0x00, 0x00, 0x3E, 0x03, 0x1E, 0x30, 0x1F, 0x00}, // U+0073 (s) - { 0x08, 0x0C, 0x3E, 0x0C, 0x0C, 0x2C, 0x18, 0x00}, // U+0074 (t) - { 0x00, 0x00, 0x33, 0x33, 0x33, 0x33, 0x6E, 0x00}, // U+0075 (u) - { 0x00, 0x00, 0x33, 0x33, 0x33, 0x1E, 0x0C, 0x00}, // U+0076 (v) - { 0x00, 0x00, 0x63, 0x6B, 0x7F, 0x7F, 0x36, 0x00}, // U+0077 (w) - { 0x00, 0x00, 0x63, 0x36, 0x1C, 0x36, 0x63, 0x00}, // U+0078 (x) - { 0x00, 0x00, 0x33, 0x33, 0x33, 0x3E, 0x30, 0x1F}, // U+0079 (y) - { 0x00, 0x00, 0x3F, 0x19, 0x0C, 0x26, 0x3F, 0x00}, // U+007A (z) - { 0x38, 0x0C, 0x0C, 0x07, 0x0C, 0x0C, 0x38, 0x00}, // U+007B ({) - { 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x00}, // U+007C (|) - { 0x07, 0x0C, 0x0C, 0x38, 0x0C, 0x0C, 0x07, 0x00}, // U+007D (}) - { 0x6E, 0x3B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+007E (~) - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} // U+007F -}; - - diff --git a/MCUME_pico/tft_t/tft_t_dma.cpp b/MCUME_pico/tft_t/tft_t_dma.cpp deleted file mode 100644 index 46129a4..0000000 --- a/MCUME_pico/tft_t/tft_t_dma.cpp +++ /dev/null @@ -1,1160 +0,0 @@ -#include "tft_t_dma.h" - -#if defined(ILI9341) || defined(ST7789) - -#include "tft_font8x8.h" -#include "pico/stdlib.h" -#include "pico/multicore.h" -#include "hardware/spi.h" -#include "hardware/dma.h" -#include "hardware/irq.h" -#include - - -#define digitalWrite(pin, val) gpio_put(pin, val) - -#define SPICLOCK 60000000 -#ifdef ST7789 -#ifdef ST7789_POL -#define SPI_MODE SPI_CPOL_0 -#else -#define SPI_MODE SPI_CPOL_1 -#endif -#endif -#ifdef ILI9341 -#define SPI_MODE SPI_CPOL_0 -#endif - - -static void SPItransfer(uint8_t val) -{ - uint8_t dat8=val; - spi_write_blocking(TFT_SPIREG, &dat8, 1); -} - -static void SPItransfer16(uint16_t val) -{ - uint8_t dat8[2]; - dat8[0] = val>>8; - dat8[1] = val&0xff; - spi_write_blocking(TFT_SPIREG, dat8, 2); -} - -static const uint8_t init_commands[] = { -#ifdef ILI9341 - 4, 0xEF, 0x03, 0x80, 0x02, - 4, 0xCF, 0x00, 0XC1, 0X30, - 5, 0xED, 0x64, 0x03, 0X12, 0X81, - 4, 0xE8, 0x85, 0x00, 0x78, - 6, 0xCB, 0x39, 0x2C, 0x00, 0x34, 0x02, - 2, 0xF7, 0x20, - 3, 0xEA, 0x00, 0x00, - 2, ILI9341_PWCTR1, 0x23, // Power control - 2, ILI9341_PWCTR2, 0x10, // Power control - 3, ILI9341_VMCTR1, 0x3e, 0x28, // VCM control - 2, ILI9341_VMCTR2, 0x86, // VCM control2 - 2, ILI9341_MADCTL, 0x48, // Memory Access Control - 2, ILI9341_PIXFMT, 0x55, - 3, ILI9341_FRMCTR1, 0x00, 0x18, - 4, ILI9341_DFUNCTR, 0x08, 0x82, 0x27, // Display Function Control - 2, 0xF2, 0x00, // Gamma Function Disable - 2, ILI9341_GAMMASET, 0x01, // Gamma curve selected - 16, ILI9341_GMCTRP1, 0x0F, 0x31, 0x2B, 0x0C, 0x0E, 0x08, - 0x4E, 0xF1, 0x37, 0x07, 0x10, 0x03, 0x0E, 0x09, 0x00, // Set Gamma - 16, ILI9341_GMCTRN1, 0x00, 0x0E, 0x14, 0x03, 0x11, 0x07, - 0x31, 0xC1, 0x48, 0x08, 0x0F, 0x0C, 0x31, 0x36, 0x0F, // Set Gamma -// 3, 0xb1, 0x00, 0x1f, // FrameRate Control 61Hz - 3, 0xb1, 0x00, 0x10, // FrameRate Control 119Hz - 2, ILI9341_MADCTL, ILI9341_MADCTL_MX | ILI9341_MADCTL_MY | ILI9341_MADCTL_MV | ILI9341_MADCTL_BGR, - 0 -#endif -#ifdef ST7789 -#define DELAY 0x80 - 9, // 9 commands in list: - ST7735_SWRESET, DELAY, // 1: Software reset, no args, w/delay - 150, // 150 ms delay - ST7735_SLPOUT , DELAY, // 2: Out of sleep mode, no args, w/delay - 255, // 255 = 500 ms delay - ST7735_COLMOD , 1+DELAY, // 3: Set color mode, 1 arg + delay: - 0x55, // 16-bit color - 10, // 10 ms delay - ST7735_MADCTL , 1 , // 4: Memory access ctrl (directions), 1 arg: - 0x08, // Row addr/col addr, bottom to top refresh - ST7735_CASET , 4 , // 5: Column addr set, 4 args, no delay: - 0x00, - 0x00, // XSTART = 0 - 0x00, - 240, // XEND = 240 - ST7735_RASET , 4 , // 6: Row addr set, 4 args, no delay: - 0x00, - 0x00, // YSTART = 0 - 320>>8, - 320 & 0xFF, // YEND = 320 - ST7735_INVON , DELAY, // 7: hack - 10, - ST7735_NORON , DELAY, // 8: Normal display on, no args, w/delay - 10, // 10 ms delay - ST7735_DISPON , DELAY, // 9: Main screen turn on, no args, w/delay - 255 -#endif -}; - - -TFT_T_DMA::TFT_T_DMA() -{ - _cs = TFT_CS; - _dc = TFT_DC; - _rst = TFT_RST; - _mosi = TFT_MOSI; - _sclk = TFT_SCLK; - //_miso = TFT_MISO; - _bkl = TFT_BACKLIGHT; - gpio_init(_dc); - gpio_set_dir(_dc, GPIO_OUT); - gpio_init(_cs); - gpio_set_dir(_cs, GPIO_OUT); - digitalWrite(_cs, 1); - digitalWrite(_dc, 1); - if (_bkl != 0xff) { - gpio_init(_bkl); - gpio_set_dir(_bkl, GPIO_OUT); - digitalWrite(_bkl, 1); - } -} - - -void TFT_T_DMA::setArea(uint16_t x1,uint16_t y1,uint16_t x2,uint16_t y2) { - int dx=0; - int dy=0; -#ifdef ST7789 - if (TFT_REALWIDTH == TFT_REALHEIGHT) - { -#ifdef ROTATE_SCREEN - if (!flipped) { - dy += 80; - } -#else - if (flipped) { - dx += 80; - } -#endif - } -#endif - - digitalWrite(_dc, 0); - SPItransfer(TFT_CASET); - digitalWrite(_dc, 1); - SPItransfer16(x1+dx); - digitalWrite(_dc, 1); - SPItransfer16(x2+dx); - digitalWrite(_dc, 0); - SPItransfer(TFT_PASET); - digitalWrite(_dc, 1); - SPItransfer16(y1+dy); - digitalWrite(_dc, 1); - SPItransfer16(y2+dy); - - digitalWrite(_dc, 0); - SPItransfer(TFT_RAMWR); - digitalWrite(_dc, 1); - - return; -} - - -void TFT_T_DMA::begin(void) { - spi_init(TFT_SPIREG, SPICLOCK); - spi_set_format(TFT_SPIREG, 8, SPI_MODE, SPI_CPHA_0, SPI_MSB_FIRST); - gpio_set_function(_sclk , GPIO_FUNC_SPI); - gpio_set_function(_mosi , GPIO_FUNC_SPI); - //gpio_set_function(_miso, GPIO_FUNC_SPI); - - // Initialize display - if (_rst != 0xff) { - gpio_init(_rst); - gpio_set_dir(_rst, GPIO_OUT); - digitalWrite(_rst, 1); - sleep_ms(100); - digitalWrite(_rst, 0); - sleep_ms(100); - digitalWrite(_rst, 1); - sleep_ms(200); - } - - const uint8_t *addr = init_commands; - digitalWrite(_cs, 0); -#ifdef ILI9341 - while (1) { - uint8_t count = *addr++; - if (count-- == 0) break; - - digitalWrite(_dc, 0); - SPItransfer(*addr++); - - while (count-- > 0) { - digitalWrite(_dc, 1); - SPItransfer(*addr++); - } - } - - digitalWrite(_dc, 0); - SPItransfer(ILI9341_SLPOUT); - digitalWrite(_dc, 1); - digitalWrite(_cs, 1); - - digitalWrite(_dc, 1); - digitalWrite(_cs, 1); - - digitalWrite(_dc, 0); - digitalWrite(_cs, 0); - SPItransfer(ILI9341_DISPON); - digitalWrite(_dc, 1); - digitalWrite(_cs, 1); -#endif -#ifdef ST7789 - uint8_t numCommands, numArgs; - uint16_t ms; - numCommands = *addr++; // Number of commands to follow - while(numCommands--) { // For each command... - digitalWrite(_dc, 0); - SPItransfer(*addr++); - numArgs = *addr++; // Number of args to follow - ms = numArgs & DELAY; // If hibit set, delay follows args - numArgs &= ~DELAY; // Mask out delay bit - while(numArgs > 1) { // For each argument... - digitalWrite(_dc, 1); - SPItransfer(*addr++); - numArgs--; - } - - if (numArgs) { - digitalWrite(_dc, 1); - SPItransfer(*addr++); - } - if(ms) { - ms = *addr++; // Read post-command delay time (ms) - if(ms == 255) ms = 500; // If 255, delay for 500 ms - digitalWrite(_cs, 1); - //SPI.endTransaction(); - sleep_ms(ms); - //SPI.beginTransaction(SPISettings(SPICLOCK, MSBFIRST, SPI_MODE)); - digitalWrite(_cs, 0); - } - } - digitalWrite(_cs, 1); -#endif - setArea(0, 0, TFT_REALWIDTH-1, TFT_REALHEIGHT-1); - -#ifdef FLIP_SCREEN - flipscreen(true); -#else - flipscreen(false); -#endif -#ifdef ST7789 - if (TFT_REALWIDTH != TFT_REALHEIGHT) - { - //flipscreen(true); - } -#endif -}; - -void TFT_T_DMA::flipscreen(bool flip) -{ - digitalWrite(_dc, 0); - digitalWrite(_cs, 0); - SPItransfer(TFT_MADCTL); - digitalWrite(_dc, 1); - if (flip) { - flipped=true; -#ifdef ILI9341 - SPItransfer(ILI9341_MADCTL_MV | ILI9341_MADCTL_BGR); -#endif -#ifdef ST7789 -#ifdef ROTATE_SCREEN - SPItransfer(ST77XX_MADCTL_RGB); -#else - SPItransfer(ST77XX_MADCTL_MY | ST77XX_MADCTL_MV |ST77XX_MADCTL_RGB); -#endif -#endif - } - else { - flipped=false; -#ifdef ILI9341 - SPItransfer(ILI9341_MADCTL_MX | ILI9341_MADCTL_MY | ILI9341_MADCTL_MV | ILI9341_MADCTL_BGR); -#endif -#ifdef ST7789 -#ifdef ROTATE_SCREEN - SPItransfer(ST77XX_MADCTL_MX | ST77XX_MADCTL_MY | ST77XX_MADCTL_RGB); -#else - SPItransfer(ST77XX_MADCTL_MX | ST77XX_MADCTL_MV | ST77XX_MADCTL_RGB); -#endif -#endif - } - digitalWrite(_cs, 1); -} - -bool TFT_T_DMA::isflipped(void) -{ - return(flipped); -} - -void TFT_T_DMA::waitSync() { -} - -/*********************************************************************************************** - No DMA functions - ***********************************************************************************************/ -void TFT_T_DMA::fillScreenNoDma(uint16_t color) { - digitalWrite(_cs, 0); - setArea(0, 0, TFT_REALWIDTH-1, TFT_REALHEIGHT-1); - //digitalWrite(_dc, 0); - //SPItransfer(TFT_RAMWR); - int i,j; - for (j=0; j(arx+arw)) || ((x+w)(ary+arh)) || ((y+h) arx) && (x<(arx+arw)) ) { - arw = arw - (x-arx); - arx = arx + (x-arx); - } else { - bmp_offx = arx; - } - if ( ((x+w) > arx) && ((x+w)<(arx+arw)) ) { - arw -= (arx+arw-x-w); - } - if ( (y > ary) && (y<(ary+arh)) ) { - arh = arh - (y-ary); - ary = ary + (y-ary); - } else { - bmp_offy = ary; - } - if ( ((y+h) > ary) && ((y+h)<(ary+arh)) ) { - arh -= (ary+arh-y-h); - } - } - - - //SPI.beginTransaction(SPISettings(SPICLOCK, MSBFIRST, SPI_MODE)); - digitalWrite(_cs, 0); - setArea(arx, ary, arx+arw-1, ary+arh-1); - - bitmap = bitmap + bmp_offy*w + bmp_offx; - for (int row=0;row> 1; - if (bits&0x01) SPItransfer16(fgcolor); - else SPItransfer16(bgcolor); - bits = bits >> 1; - if (bits&0x01) SPItransfer16(fgcolor); - else SPItransfer16(bgcolor); - bits = bits >> 1; - if (bits&0x01) SPItransfer16(fgcolor); - else SPItransfer16(bgcolor); - bits = bits >> 1; - if (bits&0x01) SPItransfer16(fgcolor); - else SPItransfer16(bgcolor); - bits = bits >> 1; - if (bits&0x01) SPItransfer16(fgcolor); - else SPItransfer16(bgcolor); - bits = bits >> 1; - if (bits&0x01) SPItransfer16(fgcolor); - else SPItransfer16(bgcolor); - bits = bits >> 1; - if (bits&0x01) SPItransfer16(fgcolor); - else SPItransfer16(bgcolor); - } - bits = *charpt++; - //digitalWrite(_dc, 1); - if (bits&0x01) SPItransfer16(fgcolor); - else SPItransfer16(bgcolor); - bits = bits >> 1; - if (bits&0x01) SPItransfer16(fgcolor); - else SPItransfer16(bgcolor); - bits = bits >> 1; - if (bits&0x01) SPItransfer16(fgcolor); - else SPItransfer16(bgcolor); - bits = bits >> 1; - if (bits&0x01) SPItransfer16(fgcolor); - else SPItransfer16(bgcolor); - bits = bits >> 1; - if (bits&0x01) SPItransfer16(fgcolor); - else SPItransfer16(bgcolor); - bits = bits >> 1; - if (bits&0x01) SPItransfer16(fgcolor); - else SPItransfer16(bgcolor); - bits = bits >> 1; - if (bits&0x01) SPItransfer16(fgcolor); - else SPItransfer16(bgcolor); - bits = bits >> 1; - if (bits&0x01) SPItransfer16(fgcolor); - else SPItransfer16(bgcolor); - } - x +=8; -#ifdef ILI9341 - digitalWrite(_dc, 0); - SPItransfer(ILI9341_SLPOUT); - digitalWrite(_dc, 1); -#endif - digitalWrite(_cs, 1); - //SPI.endTransaction(); - } - - //SPI.beginTransaction(SPISettings(SPICLOCK, MSBFIRST, SPI_MODE)); - digitalWrite(_cs, 0); - setArea(0, 0, (TFT_REALWIDTH-1), (TFT_REALHEIGHT-1)); - digitalWrite(_cs, 1); - //SPI.endTransaction(); -} - - -/*********************************************************************************************** - DMA functions - ***********************************************************************************************/ -#ifndef USE_VGA - -#ifdef TFT_STATICFB -static uint16_t fb0[LINES_PER_BLOCK*TFT_WIDTH]; //__attribute__ ((aligned(2048))); -static uint16_t fb1[LINES_PER_BLOCK*TFT_WIDTH]; //__attribute__ ((aligned(2048))); -static uint16_t fb2[LINES_PER_BLOCK*TFT_WIDTH]; //__attribute__ ((aligned(2048))); -static uint16_t fb3[(TFT_HEIGHT-3*LINES_PER_BLOCK)*TFT_WIDTH];// __attribute__ ((aligned(2048))); -static uint16_t * blocks[NR_OF_BLOCK]={fb0,fb1,fb2,fb3}; -static uint16_t blocklens[NR_OF_BLOCK]; -#else -static uint16_t * blocks[NR_OF_BLOCK]; -static uint16_t blocklens[NR_OF_BLOCK]; -#endif - - -static dma_channel_config dmaconfig; -const uint dma_tx = dma_claim_unused_channel(true); -static volatile uint8_t rstop = 0; -static volatile bool cancelled = false; -static volatile uint8_t curTransfer = 0; -static uint8_t nbTransfer = 0; - -static void dma_isr() { - irq_clear(DMA_IRQ_0); - dma_hw->ints0 = 1u << dma_tx; - curTransfer++; - if (curTransfer >= nbTransfer) { - curTransfer = 0; - } - if (cancelled) { - rstop = 1; - } - else - { - dma_channel_transfer_from_buffer_now ( dma_tx, blocks[curTransfer], blocklens[curTransfer]); - } -} - -static void setDmaStruct() { - uint32_t remaining = TFT_HEIGHT*TFT_WIDTH*2; - int i=0; - nbTransfer = 0; - uint16_t col=RGBVAL16(0x00,0x00,0x00);; - while (remaining > 0) { - uint16_t * fb = blocks[i]; - int32_t len = (remaining >= (LINES_PER_BLOCK*TFT_WIDTH*2)?LINES_PER_BLOCK*TFT_WIDTH*2:remaining); -#ifdef TFT_DEBUG - printf("%d\n",(unsigned long)blocks[i]); - printf("%d\n",remaining); -#endif - switch (i) { - case 0: - if (fb == 0) fb = (uint16_t*)((int)malloc(len+64)&0xffffffe0); - //fb=&fb0[0]; -#ifdef TFT_DEBUG - col = RGBVAL16(0x00,0xff,0x00); -#endif - break; - case 1: - if (fb == 0) fb = (uint16_t*)((int)malloc(len+64)&0xffffffe0); - //fb=&fb1[0]; -#ifdef TFT_DEBUG - col = RGBVAL16(0x00,0xff,0xff); -#endif - break; - case 2: - if (fb == 0) fb = (uint16_t*)((int)malloc(len+64)&0xffffffe0); - //fb=&fb2[0]; -#ifdef TFT_DEBUG - col = RGBVAL16(0x00,0x00,0xff); -#endif - break; - case 3: - if (fb == 0) fb = (uint16_t*)((int)malloc(len+64)&0xffffffe0); - //fb=&fb3[0]; -#ifdef TFT_DEBUG - col = RGBVAL16(0xff,0x00,0xff); -#endif - break; - } - blocks[i] = fb; - blocklens[i] = len/2; - if (blocks[i] == 0) { - printf("LI9341 allocaltion failed for block %d\n",i); - sleep_ms(10000); - } - nbTransfer++; - remaining -= len; - i++; - } - - - // Setup the control channel - dmaconfig = dma_channel_get_default_config(dma_tx); - channel_config_set_transfer_data_size(&dmaconfig, DMA_SIZE_16); - channel_config_set_dreq(&dmaconfig, TFT_SPIDREQ); - //channel_config_set_read_increment(&dmaconfig, true); // read incrementing - //channel_config_set_write_increment(&dmaconfig, false); // no write incrementing - - dma_channel_configure( - dma_tx, - &dmaconfig, - &spi_get_hw(TFT_SPIREG)->dr, // write address - blocks[0], - blocklens[0], - false - ); - - irq_set_exclusive_handler(DMA_IRQ_0, dma_isr); - dma_channel_set_irq0_enabled(dma_tx, true); - irq_set_enabled(DMA_IRQ_0, true); - dma_hw->ints0 = 1u << dma_tx; -} - - -void TFT_T_DMA::startDMA(void) { - curTransfer = 0; - rstop = 0; - digitalWrite(_cs, 1); - setDmaStruct(); - fillScreen(RGBVAL16(0x00,0x00,0x00)); - - digitalWrite(_cs, 0); - setArea((TFT_REALWIDTH-TFT_WIDTH)/2, (TFT_REALHEIGHT-TFT_HEIGHT)/2, (TFT_REALWIDTH-TFT_WIDTH)/2 + TFT_WIDTH-1, (TFT_REALHEIGHT-TFT_HEIGHT)/2+TFT_HEIGHT-1); - // we switch to 16bit mode!! - spi_set_format(TFT_SPIREG, 16, SPI_CPOL_0, SPI_CPHA_0, SPI_MSB_FIRST); - dma_start_channel_mask(1u << dma_tx); -} - - -void TFT_T_DMA::stopDMA(void) { - rstop = 0; - wait(); - sleep_ms(100); - cancelled = false; - //dmatx.detachInterrupt(); - fillScreen(RGBVAL16(0x00,0x00,0x00)); - digitalWrite(_cs, 1); - // we switch to 8bit mode!! - //spi_set_format(TFT_SPIREG, 8, SPI_CPOL_0, SPI_CPHA_0, SPI_MSB_FIRST); -//#ifdef ST7789 - begin(); -//#endif -//#ifdef ILI9341 -// SPI.begin(); -// digitalWrite(_cs, 0); -// SPI.beginTransaction(SPISettings(SPICLOCK, MSBFIRST, SPI_MODE)); -// SPI.endTransaction(); -// digitalWrite(_cs, 1); -// digitalWrite(_dc, 1); -//#endif - setArea(0, 0, TFT_REALWIDTH-1, TFT_REALHEIGHT-1); -} - -void TFT_T_DMA::wait(void) { - rstop = 1; - unsigned long m = time_us_32()*1000; - cancelled = true; - while (!rstop) { - if ((time_us_32()*1000 - m) > 100) break; - sleep_ms(100); - asm volatile("wfi"); - }; - rstop = 0; -} - - -int TFT_T_DMA::get_frame_buffer_size(int *width, int *height){ - if (width != nullptr) *width = TFT_REALWIDTH; - if (height != nullptr) *height = TFT_REALHEIGHT; - return TFT_REALWIDTH; -} - - -uint16_t * TFT_T_DMA::getLineBuffer(int j) -{ - uint16_t * block=blocks[j>>6]; - return(&block[(j&0x3F)*TFT_REALWIDTH]); -} - -void TFT_T_DMA::writeScreen(int width, int height, int stride, uint8_t *buf, uint16_t *palette16) { - uint8_t *buffer=buf; - uint8_t *src; - - int i,j,y=0; - if (width*2 <= TFT_REALWIDTH) { - for (j=0; j>6]; - uint16_t * dst=&block[(y&0x3F)*TFT_WIDTH]; - src=buffer; - for (i=0; i>6]; - dst=&block[(y&0x3F)*TFT_WIDTH]; - src=buffer; - for (i=0; i>6]; - uint16_t * dst=&block[(y&0x3F)*TFT_WIDTH+(TFT_WIDTH-width)/2]; - src=buffer; - for (i=0; i>6]; - dst=&block[(y&0x3F)*TFT_WIDTH+(TFT_WIDTH-width)/2]; - src=buffer; - for (i=0; i>6]; - uint16_t * dst=&block[(y&0x3F)*TFT_WIDTH]; - if (width > TFT_WIDTH) { -#ifdef TFT_LINEARINT - int delta = (width/(width-TFT_WIDTH))-1; - int pos = delta; - for (int i=0; i> 8]]; - pos +=step; - } -#endif - } - else if ((width*2) == TFT_WIDTH) { - for (int i=0; i>6]; - uint16_t * dst=&block[(y&0x3F)*TFT_WIDTH]; - if (width > TFT_WIDTH) { -#ifdef TFT_LINEARINT - int delta = (width/(width-TFT_WIDTH))-1; - int pos = delta; - for (int i=0; i> 8]; - pos +=step; - } -#endif - } - else if ((width*2) == TFT_WIDTH) { - for (int i=0; i>6]; - uint16_t * dst=&block[(j&0x3F)*TFT_WIDTH]; - for (i=0; i>6]; - uint16_t * dst=&block[(l&0x3F)*TFT_WIDTH+x]; - for (i=0; i>6]; - dst=&block[(l&0x3F)*TFT_WIDTH+x]; - bits = *charpt; - if (bits&0x01) *dst++=fgcolor; - else *dst++=bgcolor; - bits = bits >> 1; - if (bits&0x01) *dst++=fgcolor; - else *dst++=bgcolor; - bits = bits >> 1; - if (bits&0x01) *dst++=fgcolor; - else *dst++=bgcolor; - bits = bits >> 1; - if (bits&0x01) *dst++=fgcolor; - else *dst++=bgcolor; - bits = bits >> 1; - if (bits&0x01) *dst++=fgcolor; - else *dst++=bgcolor; - bits = bits >> 1; - if (bits&0x01) *dst++=fgcolor; - else *dst++=bgcolor; - bits = bits >> 1; - if (bits&0x01) *dst++=fgcolor; - else *dst++=bgcolor; - bits = bits >> 1; - if (bits&0x01) *dst++=fgcolor; - else *dst++=bgcolor; - l++; - } - block=blocks[l>>6]; - dst=&block[(l&0x3F)*TFT_WIDTH+x]; - bits = *charpt++; - if (bits&0x01) *dst++=fgcolor; - else *dst++=bgcolor; - bits = bits >> 1; - if (bits&0x01) *dst++=fgcolor; - else *dst++=bgcolor; - bits = bits >> 1; - if (bits&0x01) *dst++=fgcolor; - else *dst++=bgcolor; - bits = bits >> 1; - if (bits&0x01) *dst++=fgcolor; - else *dst++=bgcolor; - bits = bits >> 1; - if (bits&0x01) *dst++=fgcolor; - else *dst++=bgcolor; - bits = bits >> 1; - if (bits&0x01) *dst++=fgcolor; - else *dst++=bgcolor; - bits = bits >> 1; - if (bits&0x01) *dst++=fgcolor; - else *dst++=bgcolor; - bits = bits >> 1; - if (bits&0x01) *dst++=fgcolor; - else *dst++=bgcolor; - l++; - } - x +=8; - } -} - -void TFT_T_DMA::drawSprite(int16_t x, int16_t y, const uint16_t *bitmap) { - drawSprite(x,y,bitmap, 0,0,0,0); -} - -void TFT_T_DMA::drawSprite(int16_t x, int16_t y, const uint16_t *bitmap, uint16_t arx, uint16_t ary, uint16_t arw, uint16_t arh) -{ - int bmp_offx = 0; - int bmp_offy = 0; - uint16_t *bmp_ptr; - - int w =*bitmap++; - int h = *bitmap++; - - - if ( (arw == 0) || (arh == 0) ) { - // no crop window - arx = x; - ary = y; - arw = w; - arh = h; - } - else { - if ( (x>(arx+arw)) || ((x+w)(ary+arh)) || ((y+h) arx) && (x<(arx+arw)) ) { - arw = arw - (x-arx); - arx = arx + (x-arx); - } else { - bmp_offx = arx; - } - if ( ((x+w) > arx) && ((x+w)<(arx+arw)) ) { - arw -= (arx+arw-x-w); - } - if ( (y > ary) && (y<(ary+arh)) ) { - arh = arh - (y-ary); - ary = ary + (y-ary); - } else { - bmp_offy = ary; - } - if ( ((y+h) > ary) && ((y+h)<(ary+arh)) ) { - arh -= (ary+arh-y-h); - } - } - - - int l=ary; - bitmap = bitmap + bmp_offy*w + bmp_offx; - for (int row=0;row>6]; - uint16_t * dst=&block[(l&0x3F)*TFT_WIDTH+arx]; - bmp_ptr = (uint16_t*)bitmap; - for (int col=0;col> 8); - cnt = cnt & (sampleBufferSize*2-1); - - if (cnt == 0) { - fillfirsthalf = false; - //irq_set_pending(RTC_IRQ+1); - multicore_fifo_push_blocking(0); - } - else if (cnt == sampleBufferSize) { - fillfirsthalf = true; - //irq_set_pending(RTC_IRQ+1); - multicore_fifo_push_blocking(0); - } -} - -static void core1_sio_irq() { - irq_clear(SIO_IRQ_PROC1); - while(multicore_fifo_rvalid()) { - uint16_t raw = multicore_fifo_pop_blocking(); - SOFTWARE_isr(); - } - multicore_fifo_clear_irq(); -} - -static void core1_func() { - multicore_fifo_clear_irq(); - irq_set_exclusive_handler(SIO_IRQ_PROC1,core1_sio_irq); - //irq_set_priority (SIO_IRQ_PROC1, 129); - irq_set_enabled(SIO_IRQ_PROC1,true); - - while (true) { - tight_loop_contents(); - } -} - -void TFT_T_DMA::begin_audio(int samplesize, void (*callback)(short * stream, int len)) -{ - fillsamples = callback; - i2s_tx_buffer = (uint32_t*)malloc(samplesize*sizeof(uint32_t)); - - if (i2s_tx_buffer == NULL) { - printf("sound buffer could not be allocated!!!!!\n"); - return; - } - memset((void*)i2s_tx_buffer,0, samplesize*sizeof(uint32_t)); - printf("sound buffer allocated\n"); - - i2s_tx_buffer16 = (short*)i2s_tx_buffer; - - sampleBufferSize = samplesize; - - gpio_set_function(AUDIO_PIN, GPIO_FUNC_PWM); - - - multicore_launch_core1(core1_func); - - - int audio_pin_slice = pwm_gpio_to_slice_num(AUDIO_PIN); - // Setup PWM interrupt to fire when PWM cycle is complete - pwm_clear_irq(audio_pin_slice); - pwm_set_irq_enabled(audio_pin_slice, true); - irq_set_exclusive_handler(PWM_IRQ_WRAP, AUDIO_isr); - irq_set_priority (PWM_IRQ_WRAP, 128); - irq_set_enabled(PWM_IRQ_WRAP, true); - - //irq_set_exclusive_handler(RTC_IRQ+1,SOFTWARE_isr); - //irq_set_priority (RTC_IRQ+1, 120); - //irq_set_enabled(RTC_IRQ+1,true); - - - // Setup PWM for audio output - pwm_config config = pwm_get_default_config(); -// pwm_config_set_clkdiv(&config, 5.5f); - pwm_config_set_clkdiv(&config, 50.0f); - pwm_config_set_wrap(&config, 254); - pwm_init(audio_pin_slice, &config, true); - - pwm_set_gpio_level(AUDIO_PIN, 0); - printf("sound initialized\n"); -} - -void TFT_T_DMA::end_audio() -{ - if (i2s_tx_buffer != NULL) { - free(i2s_tx_buffer); - } -} -#endif - -#endif diff --git a/MCUME_pico/tft_t/tft_t_dma.h b/MCUME_pico/tft_t/tft_t_dma.h deleted file mode 100644 index 5b998ea..0000000 --- a/MCUME_pico/tft_t/tft_t_dma.h +++ /dev/null @@ -1,228 +0,0 @@ -#ifndef _TFT_T_DMAH_ -#define _TFT_T_DMAH_ - -#ifdef __cplusplus -#include -#include -#include "pico.h" -#endif - -#include "tft_t_dma_config.h" - -#define RGBVAL32(r,g,b) ( (r<<16) | (g<<8) | b ) -#define RGBVAL16(r,g,b) ( (((r>>3)&0x1f)<<11) | (((g>>2)&0x3f)<<5) | (((b>>3)&0x1f)<<0) ) -#define RGBVAL8(r,g,b) ( (((r>>5)&0x07)<<5) | (((g>>5)&0x07)<<2) | (((b>>6)&0x3)<<0) ) -#define R16(rgb) ((rgb>>8)&0xf8) -#define G16(rgb) ((rgb>>3)&0xfc) -#define B16(rgb) ((rgb<<3)&0xf8) - - -#ifdef LOHRES -#define TFT_WIDTH 240 -#define TFT_REALWIDTH 240 -#else -#ifdef OVERRULE_WIDTH -#define TFT_WIDTH OVERRULE_WIDTH -#else -#define TFT_WIDTH 320 -#endif -#define TFT_REALWIDTH 320 -#endif -#ifdef OVERRULE_HEIGHT -#define TFT_HEIGHT OVERRULE_HEIGHT -#else -#define TFT_HEIGHT 240 -#endif -#define TFT_REALHEIGHT 240 - - -#define LINES_PER_BLOCK 64 -#define NR_OF_BLOCK 4 - - -#ifdef ILI9341 - -#define ILI9341_NOP 0x00 -#define ILI9341_SWRESET 0x01 -#define ILI9341_RDDID 0x04 -#define ILI9341_RDDST 0x09 - -#define ILI9341_SLPIN 0x10 -#define ILI9341_SLPOUT 0x11 -#define ILI9341_PTLON 0x12 -#define ILI9341_NORON 0x13 - -#define ILI9341_RDMODE 0x0A -#define ILI9341_RDMADCTL 0x0B -#define ILI9341_RDPIXFMT 0x0C -#define ILI9341_RDIMGFMT 0x0D -#define ILI9341_RDSELFDIAG 0x0F - -#define ILI9341_INVOFF 0x20 -#define ILI9341_INVON 0x21 -#define ILI9341_GAMMASET 0x26 -#define ILI9341_DISPOFF 0x28 -#define ILI9341_DISPON 0x29 - -#define ILI9341_CASET 0x2A -#define ILI9341_PASET 0x2B -#define ILI9341_RAMWR 0x2C -#define ILI9341_RAMRD 0x2E - -#define ILI9341_PTLAR 0x30 -#define ILI9341_MADCTL 0x36 -#define ILI9341_VSCRSADD 0x37 -#define ILI9341_PIXFMT 0x3A - -#define ILI9341_FRMCTR1 0xB1 -#define ILI9341_FRMCTR2 0xB2 -#define ILI9341_FRMCTR3 0xB3 -#define ILI9341_INVCTR 0xB4 -#define ILI9341_DFUNCTR 0xB6 - -#define ILI9341_PWCTR1 0xC0 -#define ILI9341_PWCTR2 0xC1 -#define ILI9341_PWCTR3 0xC2 -#define ILI9341_PWCTR4 0xC3 -#define ILI9341_PWCTR5 0xC4 -#define ILI9341_VMCTR1 0xC5 -#define ILI9341_VMCTR2 0xC7 - -#define ILI9341_RDID1 0xDA -#define ILI9341_RDID2 0xDB -#define ILI9341_RDID3 0xDC -#define ILI9341_RDID4 0xDD - -#define ILI9341_GMCTRP1 0xE0 -#define ILI9341_GMCTRN1 0xE1 - -#define ILI9341_MADCTL_MY 0x80 -#define ILI9341_MADCTL_MX 0x40 -#define ILI9341_MADCTL_MV 0x20 -#define ILI9341_MADCTL_ML 0x10 -#define ILI9341_MADCTL_RGB 0x00 -#define ILI9341_MADCTL_BGR 0x08 -#define ILI9341_MADCTL_MH 0x04 - -#define TFT_CASET ILI9341_CASET -#define TFT_PASET ILI9341_PASET -#define TFT_RAMWR ILI9341_RAMWR -#define TFT_MADCTL ILI9341_MADCTL - -#endif - - -#ifdef ST7789 - -#define ST7735_NOP 0x00 -#define ST7735_SWRESET 0x01 -#define ST7735_RDDID 0x04 -#define ST7735_RDDST 0x09 - -#define ST7735_SLPIN 0x10 -#define ST7735_SLPOUT 0x11 -#define ST7735_PTLON 0x12 -#define ST7735_NORON 0x13 - -#define ST7735_INVOFF 0x20 -#define ST7735_INVON 0x21 -#define ST7735_DISPOFF 0x28 -#define ST7735_DISPON 0x29 -#define ST7735_CASET 0x2A -#define ST7735_RASET 0x2B -#define ST7735_RAMWR 0x2C -#define ST7735_RAMRD 0x2E - -#define ST7735_PTLAR 0x30 -#define ST7735_COLMOD 0x3A -#define ST7735_MADCTL 0x36 - -#define ST7735_FRMCTR1 0xB1 -#define ST7735_FRMCTR2 0xB2 -#define ST7735_FRMCTR3 0xB3 -#define ST7735_INVCTR 0xB4 -#define ST7735_DISSET5 0xB6 - -#define ST7735_PWCTR1 0xC0 -#define ST7735_PWCTR2 0xC1 -#define ST7735_PWCTR3 0xC2 -#define ST7735_PWCTR4 0xC3 -#define ST7735_PWCTR5 0xC4 -#define ST7735_VMCTR1 0xC5 - -#define ST7735_RDID1 0xDA -#define ST7735_RDID2 0xDB -#define ST7735_RDID3 0xDC -#define ST7735_RDID4 0xDD - -#define ST7735_PWCTR6 0xFC - -#define ST7735_GMCTRP1 0xE0 -#define ST7735_GMCTRN1 0xE1 - -#define ST77XX_MADCTL_MY 0x80 -#define ST77XX_MADCTL_MX 0x40 -#define ST77XX_MADCTL_MV 0x20 -#define ST77XX_MADCTL_ML 0x10 -#define ST77XX_MADCTL_RGB 0x00 -#define ST77XX_MADCTL_BGR 0x08 -#define ST77XX_MADCTL_MH 0x04 - -#define TFT_CASET ST7735_CASET -#define TFT_PASET ST7735_RASET -#define TFT_RAMWR ST7735_RAMWR -#define TFT_MADCTL ST7735_MADCTL - -#endif - - - -#ifdef __cplusplus - -class TFT_T_DMA -{ - public: - TFT_T_DMA(); - - void setArea(uint16_t x1,uint16_t y1,uint16_t x2,uint16_t y2); - void begin(void); - void flipscreen(bool flip); - bool isflipped(void); - void startDMA(void); - void stopDMA(); - int get_frame_buffer_size(int *width, int *height); - void waitSync(); - - void begin_audio(int samplesize, void (*callback)(short * stream, int len)); - void end_audio(); - - // NoDMA functions - void fillScreenNoDma(uint16_t color); - void writeScreenNoDma(const uint16_t *pcolors); - void drawTextNoDma(int16_t x, int16_t y, const char * text, uint16_t fgcolor, uint16_t bgcolor, bool doublesize); - void drawRectNoDma(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color); - void drawSpriteNoDma(int16_t x, int16_t y, const uint16_t *bitmap); - void drawSpriteNoDma(int16_t x, int16_t y, const uint16_t *bitmap, uint16_t croparx, uint16_t cropary, uint16_t croparw, uint16_t croparh); - - // DMA functions - uint16_t * getLineBuffer(int j); - void writeScreen(int width, int height, int stride, uint8_t *buffer, uint16_t *palette16); - void writeLine(int width, int height, int stride, uint8_t *buffer, uint16_t *palette16); - void writeLine(int width, int height, int y, uint16_t *buf); - void fillScreen(uint16_t color); - void drawText(int16_t x, int16_t y, const char * text, uint16_t fgcolor, uint16_t bgcolor, bool doublesize); - void drawRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color); - void drawSprite(int16_t x, int16_t y, const uint16_t *bitmap); - void drawSprite(int16_t x, int16_t y, const uint16_t *bitmap, uint16_t croparx, uint16_t cropary, uint16_t croparw, uint16_t croparh); - - protected: - uint8_t _rst, _cs, _dc; - uint8_t _miso, _mosi, _sclk, _bkl; - bool flipped=false; - - void wait(void); -}; - -#endif -#endif - diff --git a/MCUME_pico/tft_t/tft_t_dma_config.h b/MCUME_pico/tft_t/tft_t_dma_config.h deleted file mode 100644 index bc44d23..0000000 --- a/MCUME_pico/tft_t/tft_t_dma_config.h +++ /dev/null @@ -1,11 +0,0 @@ -#include "platform_config.h" -#include "iopins.h" - -//#define ST7789 1 -//#define ILI9341 1 - -#define TFT_STATICFB 1 -#define TFT_LINEARINT 1 -#define LINEARINT_HACK 1 - - diff --git a/MCUME_pico/vga_t4/VGA_font8x8.h b/MCUME_pico/vga_t4/VGA_font8x8.h deleted file mode 100644 index 8a556f3..0000000 --- a/MCUME_pico/vga_t4/VGA_font8x8.h +++ /dev/null @@ -1,148 +0,0 @@ - -// Font: c64_lower.64c - -const unsigned char font8x8[128][8] = -{ - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0000 (nul) - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0001 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0002 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0003 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0004 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0005 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0006 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0007 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0008 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0009 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000A - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000B - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000C - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000D - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000E - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000F - - { 0x7f, 0x41, 0x41, 0x41, 0x41, 0x41, 0x7f, 0x00 }, // Space // 0x10 - { 0x00, 0x27, 0x31, 0x27, 0x21, 0x71, 0x00, 0x00 }, // F1 // 0x11 - { 0x00, 0x77, 0x41, 0x77, 0x11, 0x71, 0x00, 0x00 }, // F2 - { 0x00, 0x77, 0x41, 0x77, 0x41, 0x71, 0x00, 0x00 }, // F3 - { 0x00, 0x17, 0x51, 0x77, 0x41, 0x41, 0x00, 0x00 }, // F4 - { 0x00, 0x77, 0x11, 0x77, 0x41, 0x71, 0x00, 0x00 }, // F5 - { 0x00, 0x77, 0x11, 0x77, 0x51, 0x71, 0x00, 0x00 }, // F6 - { 0x00, 0x77, 0x41, 0x47, 0x41, 0x41, 0x00, 0x00 }, // F7 - { 0x00, 0x77, 0x51, 0x77, 0x51, 0x71, 0x00, 0x00 }, // F8 // 0x18 - { 0x00, 0x00, 0x20, 0x24, 0x3e, 0x04, 0x00, 0x00 }, // Return // 0x19 - { 0x00, 0x59, 0x4b, 0x5b, 0x4b, 0xd9, 0x00, 0x00 }, // Del // 0x1A - //{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0010 - //{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0011 - //{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0012 - //{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0013 - //{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0014 - //{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0015 - //{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0016 - //{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0017 - //{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0018 - //{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0019 - //{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001A - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001B - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001C - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001D - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001E - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001F - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0020 (space) - { 0x18, 0x3C, 0x3C, 0x18, 0x18, 0x00, 0x18, 0x00}, // U+0021 (!) - { 0x36, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0022 (") - { 0x36, 0x36, 0x7F, 0x36, 0x7F, 0x36, 0x36, 0x00}, // U+0023 (#) - { 0x0C, 0x3E, 0x03, 0x1E, 0x30, 0x1F, 0x0C, 0x00}, // U+0024 ($) - { 0x00, 0x63, 0x33, 0x18, 0x0C, 0x66, 0x63, 0x00}, // U+0025 (%) - { 0x1C, 0x36, 0x1C, 0x6E, 0x3B, 0x33, 0x6E, 0x00}, // U+0026 (&) - { 0x06, 0x06, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0027 (') - { 0x18, 0x0C, 0x06, 0x06, 0x06, 0x0C, 0x18, 0x00}, // U+0028 (() - { 0x06, 0x0C, 0x18, 0x18, 0x18, 0x0C, 0x06, 0x00}, // U+0029 ()) - { 0x00, 0x66, 0x3C, 0xFF, 0x3C, 0x66, 0x00, 0x00}, // U+002A (*) - { 0x00, 0x0C, 0x0C, 0x3F, 0x0C, 0x0C, 0x00, 0x00}, // U+002B (+) - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x0C, 0x06}, // U+002C (,) - { 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x00}, // U+002D (-) - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x0C, 0x00}, // U+002E (.) - { 0x60, 0x30, 0x18, 0x0C, 0x06, 0x03, 0x01, 0x00}, // U+002F (/) - { 0x3E, 0x63, 0x73, 0x7B, 0x6F, 0x67, 0x3E, 0x00}, // U+0030 (0) - { 0x0C, 0x0E, 0x0C, 0x0C, 0x0C, 0x0C, 0x3F, 0x00}, // U+0031 (1) - { 0x1E, 0x33, 0x30, 0x1C, 0x06, 0x33, 0x3F, 0x00}, // U+0032 (2) - { 0x1E, 0x33, 0x30, 0x1C, 0x30, 0x33, 0x1E, 0x00}, // U+0033 (3) - { 0x38, 0x3C, 0x36, 0x33, 0x7F, 0x30, 0x78, 0x00}, // U+0034 (4) - { 0x3F, 0x03, 0x1F, 0x30, 0x30, 0x33, 0x1E, 0x00}, // U+0035 (5) - { 0x1C, 0x06, 0x03, 0x1F, 0x33, 0x33, 0x1E, 0x00}, // U+0036 (6) - { 0x3F, 0x33, 0x30, 0x18, 0x0C, 0x0C, 0x0C, 0x00}, // U+0037 (7) - { 0x1E, 0x33, 0x33, 0x1E, 0x33, 0x33, 0x1E, 0x00}, // U+0038 (8) - { 0x1E, 0x33, 0x33, 0x3E, 0x30, 0x18, 0x0E, 0x00}, // U+0039 (9) - { 0x00, 0x0C, 0x0C, 0x00, 0x00, 0x0C, 0x0C, 0x00}, // U+003A (:) - { 0x00, 0x0C, 0x0C, 0x00, 0x00, 0x0C, 0x0C, 0x06}, // U+003B (//) - { 0x18, 0x0C, 0x06, 0x03, 0x06, 0x0C, 0x18, 0x00}, // U+003C (<) - { 0x00, 0x00, 0x3F, 0x00, 0x00, 0x3F, 0x00, 0x00}, // U+003D (=) - { 0x06, 0x0C, 0x18, 0x30, 0x18, 0x0C, 0x06, 0x00}, // U+003E (>) - { 0x1E, 0x33, 0x30, 0x18, 0x0C, 0x00, 0x0C, 0x00}, // U+003F (?) - { 0x3E, 0x63, 0x7B, 0x7B, 0x7B, 0x03, 0x1E, 0x00}, // U+0040 (@) - { 0x0C, 0x1E, 0x33, 0x33, 0x3F, 0x33, 0x33, 0x00}, // U+0041 (A) - { 0x3F, 0x66, 0x66, 0x3E, 0x66, 0x66, 0x3F, 0x00}, // U+0042 (B) - { 0x3C, 0x66, 0x03, 0x03, 0x03, 0x66, 0x3C, 0x00}, // U+0043 (C) - { 0x1F, 0x36, 0x66, 0x66, 0x66, 0x36, 0x1F, 0x00}, // U+0044 (D) - { 0x7F, 0x46, 0x16, 0x1E, 0x16, 0x46, 0x7F, 0x00}, // U+0045 (E) - { 0x7F, 0x46, 0x16, 0x1E, 0x16, 0x06, 0x0F, 0x00}, // U+0046 (F) - { 0x3C, 0x66, 0x03, 0x03, 0x73, 0x66, 0x7C, 0x00}, // U+0047 (G) - { 0x33, 0x33, 0x33, 0x3F, 0x33, 0x33, 0x33, 0x00}, // U+0048 (H) - { 0x1E, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+0049 (I) - { 0x78, 0x30, 0x30, 0x30, 0x33, 0x33, 0x1E, 0x00}, // U+004A (J) - { 0x67, 0x66, 0x36, 0x1E, 0x36, 0x66, 0x67, 0x00}, // U+004B (K) - { 0x0F, 0x06, 0x06, 0x06, 0x46, 0x66, 0x7F, 0x00}, // U+004C (L) - { 0x63, 0x77, 0x7F, 0x7F, 0x6B, 0x63, 0x63, 0x00}, // U+004D (M) - { 0x63, 0x67, 0x6F, 0x7B, 0x73, 0x63, 0x63, 0x00}, // U+004E (N) - { 0x1C, 0x36, 0x63, 0x63, 0x63, 0x36, 0x1C, 0x00}, // U+004F (O) - { 0x3F, 0x66, 0x66, 0x3E, 0x06, 0x06, 0x0F, 0x00}, // U+0050 (P) - { 0x1E, 0x33, 0x33, 0x33, 0x3B, 0x1E, 0x38, 0x00}, // U+0051 (Q) - { 0x3F, 0x66, 0x66, 0x3E, 0x36, 0x66, 0x67, 0x00}, // U+0052 (R) - { 0x1E, 0x33, 0x07, 0x0E, 0x38, 0x33, 0x1E, 0x00}, // U+0053 (S) - { 0x3F, 0x2D, 0x0C, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+0054 (T) - { 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x3F, 0x00}, // U+0055 (U) - { 0x33, 0x33, 0x33, 0x33, 0x33, 0x1E, 0x0C, 0x00}, // U+0056 (V) - { 0x63, 0x63, 0x63, 0x6B, 0x7F, 0x77, 0x63, 0x00}, // U+0057 (W) - { 0x63, 0x63, 0x36, 0x1C, 0x1C, 0x36, 0x63, 0x00}, // U+0058 (X) - { 0x33, 0x33, 0x33, 0x1E, 0x0C, 0x0C, 0x1E, 0x00}, // U+0059 (Y) - { 0x7F, 0x63, 0x31, 0x18, 0x4C, 0x66, 0x7F, 0x00}, // U+005A (Z) - { 0x1E, 0x06, 0x06, 0x06, 0x06, 0x06, 0x1E, 0x00}, // U+005B ([) - { 0x03, 0x06, 0x0C, 0x18, 0x30, 0x60, 0x40, 0x00}, // U+005C (\) - { 0x1E, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1E, 0x00}, // U+005D (]) - { 0x08, 0x1C, 0x36, 0x63, 0x00, 0x00, 0x00, 0x00}, // U+005E (^) - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF}, // U+005F (_) - { 0x0C, 0x0C, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0060 (`) - { 0x00, 0x00, 0x1E, 0x30, 0x3E, 0x33, 0x6E, 0x00}, // U+0061 (a) - { 0x07, 0x06, 0x06, 0x3E, 0x66, 0x66, 0x3B, 0x00}, // U+0062 (b) - { 0x00, 0x00, 0x1E, 0x33, 0x03, 0x33, 0x1E, 0x00}, // U+0063 (c) - { 0x38, 0x30, 0x30, 0x3e, 0x33, 0x33, 0x6E, 0x00}, // U+0064 (d) - { 0x00, 0x00, 0x1E, 0x33, 0x3f, 0x03, 0x1E, 0x00}, // U+0065 (e) - { 0x1C, 0x36, 0x06, 0x0f, 0x06, 0x06, 0x0F, 0x00}, // U+0066 (f) - { 0x00, 0x00, 0x6E, 0x33, 0x33, 0x3E, 0x30, 0x1F}, // U+0067 (g) - { 0x07, 0x06, 0x36, 0x6E, 0x66, 0x66, 0x67, 0x00}, // U+0068 (h) - { 0x0C, 0x00, 0x0E, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+0069 (i) - { 0x30, 0x00, 0x30, 0x30, 0x30, 0x33, 0x33, 0x1E}, // U+006A (j) - { 0x07, 0x06, 0x66, 0x36, 0x1E, 0x36, 0x67, 0x00}, // U+006B (k) - { 0x0E, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+006C (l) - { 0x00, 0x00, 0x33, 0x7F, 0x7F, 0x6B, 0x63, 0x00}, // U+006D (m) - { 0x00, 0x00, 0x1F, 0x33, 0x33, 0x33, 0x33, 0x00}, // U+006E (n) - { 0x00, 0x00, 0x1E, 0x33, 0x33, 0x33, 0x1E, 0x00}, // U+006F (o) - { 0x00, 0x00, 0x3B, 0x66, 0x66, 0x3E, 0x06, 0x0F}, // U+0070 (p) - { 0x00, 0x00, 0x6E, 0x33, 0x33, 0x3E, 0x30, 0x78}, // U+0071 (q) - { 0x00, 0x00, 0x3B, 0x6E, 0x66, 0x06, 0x0F, 0x00}, // U+0072 (r) - { 0x00, 0x00, 0x3E, 0x03, 0x1E, 0x30, 0x1F, 0x00}, // U+0073 (s) - { 0x08, 0x0C, 0x3E, 0x0C, 0x0C, 0x2C, 0x18, 0x00}, // U+0074 (t) - { 0x00, 0x00, 0x33, 0x33, 0x33, 0x33, 0x6E, 0x00}, // U+0075 (u) - { 0x00, 0x00, 0x33, 0x33, 0x33, 0x1E, 0x0C, 0x00}, // U+0076 (v) - { 0x00, 0x00, 0x63, 0x6B, 0x7F, 0x7F, 0x36, 0x00}, // U+0077 (w) - { 0x00, 0x00, 0x63, 0x36, 0x1C, 0x36, 0x63, 0x00}, // U+0078 (x) - { 0x00, 0x00, 0x33, 0x33, 0x33, 0x3E, 0x30, 0x1F}, // U+0079 (y) - { 0x00, 0x00, 0x3F, 0x19, 0x0C, 0x26, 0x3F, 0x00}, // U+007A (z) - { 0x38, 0x0C, 0x0C, 0x07, 0x0C, 0x0C, 0x38, 0x00}, // U+007B ({) - { 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x00}, // U+007C (|) - { 0x07, 0x0C, 0x0C, 0x38, 0x0C, 0x0C, 0x07, 0x00}, // U+007D (}) - { 0x6E, 0x3B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+007E (~) - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} // U+007F -}; - - diff --git a/MCUME_pico/vga_t4/VGA_t4.cpp b/MCUME_pico/vga_t4/VGA_t4.cpp deleted file mode 100755 index 7c5d1df..0000000 --- a/MCUME_pico/vga_t4/VGA_t4.cpp +++ /dev/null @@ -1,1717 +0,0 @@ -/* - This file is part of VGA_t4 library. - - VGA_t4 library is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - Copyright (C) 2020 J-M Harvengt - - Inspired from the original Teensy3 uVGA library of Eric PREVOTEAU. - QTIMER/FlexIO code based on Teensy4 examples of KurtE, Manitou and easone - from the Teensy4 forum (https://forum.pjrc.com) -*/ - -#include "VGA_t4.h" -#include "VGA_font8x8.h" -#include "pico/stdlib.h" -#include "pico/multicore.h" -#include "scanvideo.h" -#include "composable_scanline.h" -#include "pico/sync.h" -#include "hardware/irq.h" -#include - -#include "platform_config.h" -#include "iopins.h" - -#ifdef USE_VGA - -#define R16(rgb) ((rgb>>8)&0xf8) -#define G16(rgb) ((rgb>>3)&0xfc) -#define B16(rgb) ((rgb<<3)&0xf8) - -#define PIO_FB_OFFSET 4 - -// 8 bits 320x240 frame buffer => 64K -static vga_pixel * visible_framebuffer = NULL; -static vga_pixel * framebuffer = NULL; -static vga_pixel * fb0 = NULL; - -uint32_t * pio_fb = NULL; -int pio_fbwidth=0; - - -static vga_pixel * fb1 = NULL; - -static int fb_width; -static int fb_height; -static int fb_stride; -static int left_border; -static int top_border; - -static scanvideo_mode_t vga_mode; - -static semaphore_t core1_initted; -static void core1_func(); - -PolyDef PolySet; // will contain a polygon data - -#define RGBVAL16(r,g,b) ( (((b>>3)&0x1f)<<11) | (((g>>2)&0x3f)<<5) | (((r>>3)&0x1f)<<0) ) -#define PICO_SCANVIDEO_PIXEL_FROM_RGBVAL8(rgb) (((rgb&0x3)<<(PICO_SCANVIDEO_PIXEL_BSHIFT))|(((rgb&0x1C)>>2)<<(PICO_SCANVIDEO_PIXEL_GSHIFT))|(((rgb&0xE0)>>5)<<(PICO_SCANVIDEO_PIXEL_RSHIFT))) - - - -static void core1_sio_irq(); - - -static void core1_func() { - // initialize video - scanvideo_setup(&vga_mode); - scanvideo_timing_enable(true); - - multicore_fifo_clear_irq(); - irq_set_exclusive_handler(SIO_IRQ_PROC1,core1_sio_irq); - //irq_set_priority (SIO_IRQ_PROC1, 129); - irq_set_enabled(SIO_IRQ_PROC1,true); - - sem_release(&core1_initted); - - while (true) { - tight_loop_contents(); - } -} - -static void init_pio_framebuffer(uint8_t * fb) { - // Code for the PIO + buffer data initialized with random - //memset((void*)fb,0, fb_stride*fb_height*sizeof(vga_pixel)); - uint8_t col = 0; - for( int i=0; i=0) && (x<=fb_width) && (y>=0) && (y<=fb_height)) - framebuffer[y*fb_stride+x] = color; -} - -vga_pixel VGA_T4::getPixel(int x, int y){ - return(framebuffer[y*fb_stride+x]); -} - -vga_pixel * VGA_T4::getLineBuffer(int j) { - return (&framebuffer[j*fb_stride]); -} - -void VGA_T4::drawRect(int16_t x, int16_t y, int16_t w, int16_t h, vga_pixel color) { - int i,j,l=y; - for (j=0; j> 1; - if (bits&0x01) *dst++=fgcolor; - else *dst++=bgcolor; - bits = bits >> 1; - if (bits&0x01) *dst++=fgcolor; - else *dst++=bgcolor; - bits = bits >> 1; - if (bits&0x01) *dst++=fgcolor; - else *dst++=bgcolor; - bits = bits >> 1; - if (bits&0x01) *dst++=fgcolor; - else *dst++=bgcolor; - bits = bits >> 1; - if (bits&0x01) *dst++=fgcolor; - else *dst++=bgcolor; - bits = bits >> 1; - if (bits&0x01) *dst++=fgcolor; - else *dst++=bgcolor; - bits = bits >> 1; - if (bits&0x01) *dst++=fgcolor; - else *dst++=bgcolor; - l++; - } - dst=&framebuffer[l*fb_stride+x]; - bits = *charpt++; - if (bits&0x01) *dst++=fgcolor; - else *dst++=bgcolor; - bits = bits >> 1; - if (bits&0x01) *dst++=fgcolor; - else *dst++=bgcolor; - bits = bits >> 1; - if (bits&0x01) *dst++=fgcolor; - else *dst++=bgcolor; - bits = bits >> 1; - if (bits&0x01) *dst++=fgcolor; - else *dst++=bgcolor; - bits = bits >> 1; - if (bits&0x01) *dst++=fgcolor; - else *dst++=bgcolor; - bits = bits >> 1; - if (bits&0x01) *dst++=fgcolor; - else *dst++=bgcolor; - bits = bits >> 1; - if (bits&0x01) *dst++=fgcolor; - else *dst++=bgcolor; - bits = bits >> 1; - if (bits&0x01) *dst++=fgcolor; - else *dst++=bgcolor; - l++; - } - x +=8; - } -} - -void VGA_T4::drawSprite(int16_t x, int16_t y, const int16_t *bitmap) { - drawSprite(x,y,bitmap, 0,0,0,0); -} - -void VGA_T4::drawSprite(int16_t x, int16_t y, const int16_t *bitmap, uint16_t arx, uint16_t ary, uint16_t arw, uint16_t arh) -{ - int bmp_offx = 0; - int bmp_offy = 0; - int16_t *bmp_ptr; - - int w =*bitmap++; - int h = *bitmap++; - - - if ( (arw == 0) || (arh == 0) ) { - // no crop window - arx = x; - ary = y; - arw = w; - arh = h; - } - else { - if ( (x>(arx+arw)) || ((x+w)(ary+arh)) || ((y+h) arx) && (x<(arx+arw)) ) { - arw = arw - (x-arx); - arx = arx + (x-arx); - } else { - bmp_offx = arx; - } - if ( ((x+w) > arx) && ((x+w)<(arx+arw)) ) { - arw -= (arx+arw-x-w); - } - if ( (y > ary) && (y<(ary+arh)) ) { - arh = arh - (y-ary); - ary = ary + (y-ary); - } else { - bmp_offy = ary; - } - if ( ((y+h) > ary) && ((y+h)<(ary+arh)) ) { - arh -= (ary+arh-y-h); - } - } - - - int l=ary; - bitmap = bitmap + bmp_offy*w + bmp_offx; - for (int row=0;row 2) ) y += (fb_height-height)/2; - vga_pixel * dst=&framebuffer[y*fb_stride]; - if (width > fb_width) { -#ifdef TFT_LINEARINT - int delta = (width/(width-fb_width))-1; - int pos = delta; - for (int i=0; i> 8]]; - pos +=step; - } -#endif - } - else if ((width*2) == fb_width) { - for (int i=0; i 2) ) y += (fb_height-height)/2; - uint8_t * dst=&framebuffer[y*fb_stride]; - if (width > fb_width) { - int step = ((width << 8)/fb_width); - int pos = 0; - for (int i=0; i> 8]; - pos +=step; - } - } - else if ((width*2) == fb_width) { - for (int i=0; i 2) ) y += (fb_height-height)/2; - uint8_t * dst=&framebuffer[y*fb_stride]; - if (width > fb_width) { - int step = ((width << 8)/fb_width); - int pos = 0; - for (int i=0; i> 8]; - *dst++ = VGA_RGB(R16(pix),G16(pix),B16(pix)); - pos +=step; - } - } - else if ((width*2) == fb_width) { - for (int i=0; i 2) ) { - ysrc += (fb_height-height)/2; - ydst += (fb_height-height)/2; - } - uint8_t * src=&framebuffer[ysrc*fb_stride]; - uint8_t * dst=&framebuffer[ydst*fb_stride]; - memcpy(dst,src,width); -} - - -//-------------------------------------------------------------- -// Draw a line between 2 points -// x1,y1 : 1st point -// x2,y2 : 2nd point -// Color : 16bits color -//-------------------------------------------------------------- -void VGA_T4::drawline(int16_t x1, int16_t y1, int16_t x2, int16_t y2, vga_pixel color){ - uint8_t yLonger = 0; - int incrementVal, endVal; - int shortLen = y2-y1; - int longLen = x2-x1; - int decInc; - int j = 0, i = 0; - - if(ABS(shortLen) > ABS(longLen)) { - int swap = shortLen; - shortLen = longLen; - longLen = swap; - yLonger = 1; - } - - endVal = longLen; - - if(longLen < 0) { - incrementVal = -1; - longLen = -longLen; - endVal--; - } else { - incrementVal = 1; - endVal++; - } - - if(longLen == 0) - decInc = 0; - else - decInc = (shortLen << 16) / longLen; - - if(yLonger) { - for(i = 0;i != endVal;i += incrementVal) { - drawPixel(x1 + (j >> 16),y1 + i,color); - j += decInc; - } - } else { - for(i = 0;i != endVal;i += incrementVal) { - drawPixel(x1 + i,y1 + (j >> 16),color); - j += decInc; - } - } -} - -//-------------------------------------------------------------- -// Draw a horizontal line -// x1,y1 : starting point -// lenght : lenght in pixels -// color : 16bits color -//-------------------------------------------------------------- -void VGA_T4::draw_h_line(int16_t x, int16_t y, int16_t lenght, vga_pixel color){ - drawline(x , y , x + lenght , y , color); -} - -//-------------------------------------------------------------- -// Draw a vertical line -// x1,y1 : starting point -// lenght : lenght in pixels -// color : 16bits color -//-------------------------------------------------------------- -void VGA_T4::draw_v_line(int16_t x, int16_t y, int16_t lenght, vga_pixel color){ - drawline(x , y , x , y + lenght , color); -} - -//-------------------------------------------------------------- -// Draw a circle. -// x, y - center of circle. -// r - radius. -// color - color of the circle. -//-------------------------------------------------------------- -void VGA_T4::drawcircle(int16_t x, int16_t y, int16_t radius, vga_pixel color){ - int16_t a, b, P; - - a = 0; - b = radius; - P = 1 - radius; - - do { - drawPixel(a+x, b+y, color); - drawPixel(b+x, a+y, color); - drawPixel(x-a, b+y, color); - drawPixel(x-b, a+y, color); - drawPixel(b+x, y-a, color); - drawPixel(a+x, y-b, color); - drawPixel(x-a, y-b, color); - drawPixel(x-b, y-a, color); - - if(P < 0) - P+= 3 + 2*a++; - else - P+= 5 + 2*(a++ - b--); - } while(a <= b); -} - -//-------------------------------------------------------------- -// Displays a full circle. -// x : specifies the X position -// y : specifies the Y position -// radius : specifies the Circle Radius -// fillcolor : specifies the Circle Fill Color -// bordercolor: specifies the Circle Border Color -//-------------------------------------------------------------- -void VGA_T4::drawfilledcircle(int16_t x, int16_t y, int16_t radius, vga_pixel fillcolor, vga_pixel bordercolor){ - int32_t D; /* Decision Variable */ - uint32_t CurX;/* Current X Value */ - uint32_t CurY;/* Current Y Value */ - - D = 3 - (radius << 1); - - CurX = 0; - CurY = radius; - - while (CurX <= CurY) - { - if(CurY > 0) - { - draw_v_line(x - CurX, y - CurY, 2*CurY, fillcolor); - draw_v_line(x + CurX, y - CurY, 2*CurY, fillcolor); - } - - if(CurX > 0) - { - draw_v_line(x - CurY, y - CurX, 2*CurX, fillcolor); - draw_v_line(x + CurY, y - CurX, 2*CurX, fillcolor); - } - if (D < 0) - { - D += (CurX << 2) + 6; - } - else - { - D += ((CurX - CurY) << 2) + 10; - CurY--; - } - CurX++; - } - - drawcircle(x, y, radius,bordercolor); -} - -//-------------------------------------------------------------- -// Displays an Ellipse. -// cx: specifies the X position -// cy: specifies the Y position -// radius1: minor radius of ellipse. -// radius2: major radius of ellipse. -// color: specifies the Color to use for draw the Border from the Ellipse. -//-------------------------------------------------------------- -void VGA_T4::drawellipse(int16_t cx, int16_t cy, int16_t radius1, int16_t radius2, vga_pixel color){ - int x = -radius1, y = 0, err = 2-2*radius1, e2; - float K = 0, rad1 = 0, rad2 = 0; - - rad1 = radius1; - rad2 = radius2; - - if (radius1 > radius2) - { - do { - K = (float)(rad1/rad2); - drawPixel(cx-x,cy+(uint16_t)(y/K),color); - drawPixel(cx+x,cy+(uint16_t)(y/K),color); - drawPixel(cx+x,cy-(uint16_t)(y/K),color); - drawPixel(cx-x,cy-(uint16_t)(y/K),color); - - e2 = err; - if (e2 <= y) { - err += ++y*2+1; - if (-x == y && e2 <= x) e2 = 0; - } - if (e2 > x) err += ++x*2+1; - } - while (x <= 0); - } - else - { - y = -radius2; - x = 0; - do { - K = (float)(rad2/rad1); - drawPixel(cx-(uint16_t)(x/K),cy+y,color); - drawPixel(cx+(uint16_t)(x/K),cy+y,color); - drawPixel(cx+(uint16_t)(x/K),cy-y,color); - drawPixel(cx-(uint16_t)(x/K),cy-y,color); - - e2 = err; - if (e2 <= x) { - err += ++x*2+1; - if (-y == x && e2 <= y) e2 = 0; - } - if (e2 > y) err += ++y*2+1; - } - while (y <= 0); - } -} - -// Draw a filled ellipse. -// cx: specifies the X position -// cy: specifies the Y position -// radius1: minor radius of ellipse. -// radius2: major radius of ellipse. -// fillcolor : specifies the Color to use for Fill the Ellipse. -// bordercolor: specifies the Color to use for draw the Border from the Ellipse. -void VGA_T4::drawfilledellipse(int16_t cx, int16_t cy, int16_t radius1, int16_t radius2, vga_pixel fillcolor, vga_pixel bordercolor){ - int x = -radius1, y = 0, err = 2-2*radius1, e2; - float K = 0, rad1 = 0, rad2 = 0; - - rad1 = radius1; - rad2 = radius2; - - if (radius1 > radius2) - { - do - { - K = (float)(rad1/rad2); - draw_v_line((cx+x), (cy-(uint16_t)(y/K)), (2*(uint16_t)(y/K) + 1) , fillcolor); - draw_v_line((cx-x), (cy-(uint16_t)(y/K)), (2*(uint16_t)(y/K) + 1) , fillcolor); - - e2 = err; - if (e2 <= y) - { - err += ++y*2+1; - if (-x == y && e2 <= x) e2 = 0; - } - if (e2 > x) err += ++x*2+1; - - } - while (x <= 0); - } - else - { - y = -radius2; - x = 0; - do - { - K = (float)(rad2/rad1); - draw_h_line((cx-(uint16_t)(x/K)), (cy+y), (2*(uint16_t)(x/K) + 1) , fillcolor); - draw_h_line((cx-(uint16_t)(x/K)), (cy-y), (2*(uint16_t)(x/K) + 1) , fillcolor); - - e2 = err; - if (e2 <= x) - { - err += ++x*2+1; - if (-y == x && e2 <= y) e2 = 0; - } - if (e2 > y) err += ++y*2+1; - } - while (y <= 0); - } - drawellipse(cx,cy,radius1,radius2,bordercolor); -} - -//-------------------------------------------------------------- -// Draw a Triangle. -// ax,ay, bx,by, cx,cy - the triangle points. -// color - color of the triangle. -//-------------------------------------------------------------- -void VGA_T4::drawtriangle(int16_t ax, int16_t ay, int16_t bx, int16_t by, int16_t cx, int16_t cy, vga_pixel color){ - drawline(ax , ay , bx , by , color); - drawline(bx , by , cx , cy , color); - drawline(cx , cy , ax , ay , color); -} - -//-------------------------------------------------------------- -// Draw a Filled Triangle. -// ax,ay, bx,by, cx,cy - the triangle points. -// fillcolor - specifies the Color to use for Fill the triangle. -// bordercolor - specifies the Color to use for draw the Border from the triangle. -//-------------------------------------------------------------- -void VGA_T4::drawfilledtriangle(int16_t ax, int16_t ay, int16_t bx, int16_t by, int16_t cx, int16_t cy, vga_pixel fillcolor, vga_pixel bordercolor){ - float ma, mb, mc ; //'gradient of the lines - float start, finish ; //'draw a line from start to finish! - float tempspace ; //'temporary storage for swapping values... - double x1,x2,x3 ; - double y1,y2,y3 ; - int16_t n ; - - //' need to sort out ay, by and cy into order.. highest to lowest - //' - if(ay < by) - { - //'swap x's - tempspace = ax; - ax = bx; - bx = tempspace; - - //'swap y's - tempspace = ay; - ay = by; - by = tempspace; - } - - if(ay < cy) - { - //'swap x's - tempspace = ax; - ax = cx; - cx = tempspace; - - //'swap y's - tempspace = ay; - ay = cy; - cy = tempspace; - } - - if(by < cy) - { - //'swap x's - tempspace = bx; - bx = cx; - cx = tempspace; - - //'swap y's - tempspace = by; - by = cy; - cy = tempspace; - } - - //' Finally - copy the values in order... - - x1 = ax; x2 = bx; x3 = cx; - y1 = ay; y2 = by; y3 = cy; - - //'bodge if y coordinates are the same - if(y1 == y2) y2 = y2 + 0.01; - if(y2 == y3) y3 = y3 + 0.01; - if(y1 == y3) y3 = y3 + 0.01; - - ma = (x1 - x2) / (y1 - y2); - mb = (x3 - x2) / (y2 - y3); - mc = (x3 - x1) / (y1 - y3); - - //'from y1 to y2 - for(n = 0;n >= (y2 - y1);n--) - { - start = n * mc; - finish = n * ma; - drawline((int16_t)(x1 - start), (int16_t)(n + y1), (int16_t)(x1 + finish), (int16_t)(n + y1), fillcolor); - } - - - //'and from y2 to y3 - - for(n = 0;n >= (y3 - y2);n--) - { - start = n * mc; - finish = n * mb; - drawline((int16_t)(x1 - start - ((y2 - y1) * mc)), (int16_t)(n + y2), (int16_t)(x2 - finish), (int16_t)(n + y2), fillcolor); - } - - // draw the border color triangle - drawtriangle(ax,ay,bx,by,cx,cy,bordercolor); -} - - -//-------------------------------------------------------------- -// Displays a Rectangle at a given Angle. -// centerx : specifies the center of the Rectangle. -// centery -// w,h : specifies the size of the Rectangle. -// angle : specifies the angle for drawing the rectangle -// color : specifies the Color to use for Fill the Rectangle. -//-------------------------------------------------------------- -void VGA_T4::drawquad(int16_t centerx, int16_t centery, int16_t w, int16_t h, int16_t angle, vga_pixel color){ - int16_t px[4],py[4]; - float l; - float raddeg = 3.14159 / 180; - float w2 = w / 2.0; - float h2 = h / 2.0; - float vec = (w2*w2)+(h2*h2); - float w2l; - float pangle[4]; - - l = sqrtf(vec); - w2l = w2 / l; - pangle[0] = acosf(w2l) / raddeg; - pangle[1] = 180.0 - (acosf(w2l) / raddeg); - pangle[2] = 180.0 + (acosf(w2l) / raddeg); - pangle[3] = 360.0 - (acosf(w2l) / raddeg); - px[0] = (int16_t)(calcco[((int16_t)(pangle[0]) + angle) % 360] * l + centerx); - py[0] = (int16_t)(calcsi[((int16_t)(pangle[0]) + angle) % 360] * l + centery); - px[1] = (int16_t)(calcco[((int16_t)(pangle[1]) + angle) % 360] * l + centerx); - py[1] = (int16_t)(calcsi[((int16_t)(pangle[1]) + angle) % 360] * l + centery); - px[2] = (int16_t)(calcco[((int16_t)(pangle[2]) + angle) % 360] * l + centerx); - py[2] = (int16_t)(calcsi[((int16_t)(pangle[2]) + angle) % 360] * l + centery); - px[3] = (int16_t)(calcco[((int16_t)(pangle[3]) + angle) % 360] * l + centerx); - py[3] = (int16_t)(calcsi[((int16_t)(pangle[3]) + angle) % 360] * l + centery); - // here we draw the quad - drawline(px[0],py[0],px[1],py[1],color); - drawline(px[1],py[1],px[2],py[2],color); - drawline(px[2],py[2],px[3],py[3],color); - drawline(px[3],py[3],px[0],py[0],color); -} - -//-------------------------------------------------------------- -// Displays a filled Rectangle at a given Angle. -// centerx : specifies the center of the Rectangle. -// centery -// w,h : specifies the size of the Rectangle. -// angle : specifies the angle for drawing the rectangle -// fillcolor : specifies the Color to use for Fill the Rectangle. -// bordercolor : specifies the Color to use for draw the Border from the Rectangle. -//-------------------------------------------------------------- -void VGA_T4::drawfilledquad(int16_t centerx, int16_t centery, int16_t w, int16_t h, int16_t angle, vga_pixel fillcolor, vga_pixel bordercolor){ - int16_t px[4],py[4]; - float l; - float raddeg = 3.14159 / 180; - float w2 = w / 2.0; - float h2 = h / 2.0; - float vec = (w2*w2)+(h2*h2); - float w2l; - float pangle[4]; - - l = sqrtf(vec); - w2l = w2 / l; - pangle[0] = acosf(w2l) / raddeg; - pangle[1] = 180.0 - (acosf(w2l) / raddeg); - pangle[2] = 180.0 + (acosf(w2l) / raddeg); - pangle[3] = 360.0 - (acosf(w2l) / raddeg); - px[0] = (int16_t)(calcco[((int16_t)(pangle[0]) + angle) % 360] * l + centerx); - py[0] = (int16_t)(calcsi[((int16_t)(pangle[0]) + angle) % 360] * l + centery); - px[1] = (int16_t)(calcco[((int16_t)(pangle[1]) + angle) % 360] * l + centerx); - py[1] = (int16_t)(calcsi[((int16_t)(pangle[1]) + angle) % 360] * l + centery); - px[2] = (int16_t)(calcco[((int16_t)(pangle[2]) + angle) % 360] * l + centerx); - py[2] = (int16_t)(calcsi[((int16_t)(pangle[2]) + angle) % 360] * l + centery); - px[3] = (int16_t)(calcco[((int16_t)(pangle[3]) + angle) % 360] * l + centerx); - py[3] = (int16_t)(calcsi[((int16_t)(pangle[3]) + angle) % 360] * l + centery); - // We draw 2 filled triangle for made the quad - // To be uniform we have to use only the Fillcolor - drawfilledtriangle(px[0],py[0],px[1],py[1],px[2],py[2],fillcolor,fillcolor); - drawfilledtriangle(px[2],py[2],px[3],py[3],px[0],py[0],fillcolor,fillcolor); - // here we draw the BorderColor from the quad - drawline(px[0],py[0],px[1],py[1],bordercolor); - drawline(px[1],py[1],px[2],py[2],bordercolor); - drawline(px[2],py[2],px[3],py[3],bordercolor); - drawline(px[3],py[3],px[0],py[0],bordercolor); -} - -//-------------------------------------------------------------- -// Displays a Polygon. -// centerx : are specified with PolySet.Center.x and y. -// centery -// cx : Translate the polygon in x direction -// cy : Translate the polygon in y direction -// bordercolor : specifies the Color to use for draw the Border from the polygon. -// polygon points : are specified with PolySet.Pts[n].x and y -// After the last polygon point , set PolySet.Pts[n + 1].x to 10000 -// Max number of point for the polygon is set by MaxPolyPoint previously defined. -//-------------------------------------------------------------- -void VGA_T4::drawpolygon(int16_t cx, int16_t cy, vga_pixel bordercolor){ - uint8_t n = 1; - while((PolySet.Pts[n].x < 10000) && (n < MaxPolyPoint)){ - drawline(PolySet.Pts[n].x + cx, - PolySet.Pts[n].y + cy, - PolySet.Pts[n - 1].x + cx , - PolySet.Pts[n - 1].y + cy, - bordercolor); - n++; - } - // close the polygon - drawline(PolySet.Pts[0].x + cx, - PolySet.Pts[0].y + cy, - PolySet.Pts[n - 1].x + cx, - PolySet.Pts[n - 1].y + cy, - bordercolor); -} - -//-------------------------------------------------------------- -// Displays a filled Polygon. -// centerx : are specified with PolySet.Center.x and y. -// centery -// cx : Translate the polygon in x direction -// cy : Translate the polygon in y direction -// fillcolor : specifies the Color to use for filling the polygon. -// bordercolor : specifies the Color to use for draw the Border from the polygon. -// polygon points : are specified with PolySet.Pts[n].x and y -// After the last polygon point , set PolySet.Pts[n + 1].x to 10000 -// Max number of point for the polygon is set by MaxPolyPoint previously defined. -//-------------------------------------------------------------- -void VGA_T4::drawfullpolygon(int16_t cx, int16_t cy, vga_pixel fillcolor, vga_pixel bordercolor){ - int n,i,j,k,dy,dx; - int y,temp; - int a[MaxPolyPoint][2],xi[MaxPolyPoint]; - float slope[MaxPolyPoint]; - - n = 0; - - while((PolySet.Pts[n].x < 10000) && (n < MaxPolyPoint)){ - a[n][0] = PolySet.Pts[n].x; - a[n][1] = PolySet.Pts[n].y; - n++; - } - - a[n][0]=PolySet.Pts[0].x; - a[n][1]=PolySet.Pts[0].y; - - for(i=0;iy))|| - ((a[i][1]>y)&&(a[i+1][1]<=y))) - { - xi[k]=(int)(a[i][0]+slope[i]*(y-a[i][1])); - k++; - } - } - - for(j=0;jxi[i+1]) - { - temp=xi[i]; - xi[i]=xi[i+1]; - xi[i+1]=temp; - } - } - - for(i=0;i= (fb_width-hscr_mask)) return; - if ((y + SPRITES_H) <= 0) return; - if (y >= fb_height) return; - - vga_pixel * src=&spritesbuffer[index*SPRITES_W*SPRITES_H]; - int i,j; - vga_pixel pix; - for (j=0; j (fb_width-hscr_mask)) || ((y+j) < 0) || ((y+j) >= fb_height) ) dst++; - else *dst++ = pix; - } - } -} - - -static void drawTile(unsigned char tile, int x, int y) { - vga_pixel * src=&tilesbuffer[tile*TILES_W*TILES_H]; - int i,j; - for (j=0; j (fb_width-hscr_mask)) *dst++=0; - else - *dst++ = pix; - } - } -} - -static void drawTransTile(unsigned char tile, int x, int y) { - vga_pixel * src=&tilesbuffer[tile*TILES_W*TILES_H]; - vga_pixel pix; - int i,j; - for (j=0; j (fb_width-hscr_mask)) src++; - else - if ((pix=*src++)) *dst++ = pix; - else *dst++; - } - } -} - - - -static void tileText(unsigned char index, int16_t x, int16_t y, const char * text, vga_pixel fgcolor, vga_pixel bgcolor, vga_pixel *dstbuffer, int dstwidth, int dstheight) { - vga_pixel c; - vga_pixel * dst; - - while ((c = *text++)) { - const unsigned char * charpt=&font8x8[c][0]; - int l=y; - for (int i=0;i<8;i++) - { - unsigned char bits; - dst=&dstbuffer[(index*dstheight+l)*dstwidth+x]; - bits = *charpt++; - if (bits&0x01) *dst++=fgcolor; - else *dst++=bgcolor; - bits = bits >> 1; - if (bits&0x01) *dst++=fgcolor; - else *dst++=bgcolor; - bits = bits >> 1; - if (bits&0x01) *dst++=fgcolor; - else *dst++=bgcolor; - bits = bits >> 1; - if (bits&0x01) *dst++=fgcolor; - else *dst++=bgcolor; - bits = bits >> 1; - if (bits&0x01) *dst++=fgcolor; - else *dst++=bgcolor; - bits = bits >> 1; - if (bits&0x01) *dst++=fgcolor; - else *dst++=bgcolor; - bits = bits >> 1; - if (bits&0x01) *dst++=fgcolor; - else *dst++=bgcolor; - bits = bits >> 1; - if (bits&0x01) *dst++=fgcolor; - else *dst++=bgcolor; - l++; - } - x +=8; - } -} - -static void tileTextOverlay(int16_t x, int16_t y, const char * text, vga_pixel fgcolor) { - vga_pixel c; - vga_pixel * dst; - - while ((c = *text++)) { - const unsigned char * charpt=&font8x8[c][0]; - int l=y; - for (int i=0;i<8;i++) - { - unsigned char bits; - dst=&framebuffer[+l*fb_stride+x]; - bits = *charpt++; - if (bits&0x01) *dst++=fgcolor; - else dst++; - bits = bits >> 1; - if (bits&0x01) *dst++=fgcolor; - else dst++; - bits = bits >> 1; - if (bits&0x01) *dst++=fgcolor; - else dst++; - bits = bits >> 1; - if (bits&0x01) *dst++=fgcolor; - else dst++; - bits = bits >> 1; - if (bits&0x01) *dst++=fgcolor; - else dst++; - bits = bits >> 1; - if (bits&0x01) *dst++=fgcolor; - else dst++; - bits = bits >> 1; - if (bits&0x01) *dst++=fgcolor; - else dst++; - bits = bits >> 1; - if (bits&0x01) *dst++=fgcolor; - else dst++; - l++; - } - x +=8; - } -} -static const char * hex = "0123456789ABCDEF"; - -void VGA_T4::begin_gfxengine(int nblayers, int nbtiles, int nbsprites) -{ - // Try double buffering - - if (fb1 == NULL) { - void *mallocpt = malloc(fb_stride*fb_height*sizeof(vga_pixel)+4); - fb1 = (vga_pixel *)((void*)((intptr_t)mallocpt & ~3)); - } - if (fb1 != NULL) { - init_pio_framebuffer(fb1); - framebuffer = fb1+PIO_FB_OFFSET; - } - - - nb_layers = nblayers; - nb_tiles = nbtiles; - nb_sprites = nbsprites; - - if (spritesbuffer == NULL) spritesbuffer = (vga_pixel*)malloc(SPRITES_W*SPRITES_H*sizeof(vga_pixel)*nb_sprites); - if (tilesbuffer == NULL) tilesbuffer = (vga_pixel*)malloc(TILES_W*TILES_H*sizeof(vga_pixel)*nb_tiles); - if (tilesram == NULL) tilesram = (unsigned char*)malloc(TILES_COLS*TILES_ROWS*nb_layers); - if (spritesdata == NULL) spritesdata = (Sprite_t *)malloc(SPRITES_MAX*sizeof(Sprite_t)); - - memset((void*)spritesbuffer,0, SPRITES_W*SPRITES_H*sizeof(vga_pixel)*nb_sprites); - memset((void*)tilesbuffer,0, TILES_W*TILES_H*sizeof(vga_pixel)*nb_tiles); - memset((void*)tilesram,0,TILES_COLS*TILES_ROWS*nb_layers); - - /* Random test tiles */ - char numhex[3]; - for (int i=0; i>4) & 0xf]; - numhex[1] = hex[i & 0xf]; - numhex[2] = 0; - if (TILES_W == 16 )tileText(i, 0, 0, numhex, VGA_RGB(0xff,0xff,0xff), VGA_RGB(0x40,0x40,0x40), tilesbuffer,TILES_W,TILES_H); - } - } - /* Random test sprites */ - for (int i=0; i>4) & 0xf]; - numhex[1] = hex[i & 0xf]; - numhex[2] = 0; - tileText(i, 0, 0, numhex, VGA_RGB(0xff,0xff,0x00), VGA_RGB(0x00,0x00,0x00),spritesbuffer,SPRITES_W,SPRITES_H); - } - } -} - - -void VGA_T4::run_gfxengine() -{ - waitSync(); - - if (fb1 != NULL) { - if (pio_fb == (uint32_t*)fb0) { - pio_fb = (uint32_t*)fb1; - visible_framebuffer = fb1+PIO_FB_OFFSET; - framebuffer = fb0+PIO_FB_OFFSET; - } - else { - pio_fb = (uint32_t*)fb0; - visible_framebuffer = fb0+PIO_FB_OFFSET; - framebuffer = fb1+PIO_FB_OFFSET; - } - } - - unsigned char * tilept; - - // Layer 0 - for (int j=0; j=hscr_beg[0]) && (j<=hscr_end[0]) ) { - int modcol = (hscr[0] >> TILES_HBITS) % TILES_COLS; - for (int i=0; i 1) { - int lcount = 1; - while (lcount < nb_layers) { - for (int j=0; j=hscr_beg[lcount]) && (j<=hscr_end[lcount]) ) { - int modcol = (hscr[lcount] >> TILES_HBITS) % TILES_COLS; - for (int i=0; i> 8); - cnt = cnt & (sampleBufferSize*2-1); - - if (cnt == 0) { - fillfirsthalf = false; - //irq_set_pending(RTC_IRQ+1); - multicore_fifo_push_blocking(0); - } - else if (cnt == sampleBufferSize) { - fillfirsthalf = true; - //irq_set_pending(RTC_IRQ+1); - multicore_fifo_push_blocking(0); - } -} - -static void core1_sio_irq() { - irq_clear(SIO_IRQ_PROC1); - while(multicore_fifo_rvalid()) { - uint16_t raw = multicore_fifo_pop_blocking(); - SOFTWARE_isr(); - } - multicore_fifo_clear_irq(); -} - - -void VGA_T4::begin_audio(int samplesize, void (*callback)(short * stream, int len)) -{ - fillsamples = callback; - i2s_tx_buffer = (uint32_t*)malloc(samplesize*sizeof(uint32_t)); - - if (i2s_tx_buffer == NULL) { - printf("sound buffer could not be allocated!!!!!\n"); - return; - } - memset((void*)i2s_tx_buffer,0, samplesize*sizeof(uint32_t)); - printf("sound buffer allocated\n"); - - i2s_tx_buffer16 = (short*)i2s_tx_buffer; - - sampleBufferSize = samplesize; - - gpio_set_function(AUDIO_PIN, GPIO_FUNC_PWM); - int audio_pin_slice = pwm_gpio_to_slice_num(AUDIO_PIN); - // Setup PWM interrupt to fire when PWM cycle is complete - pwm_clear_irq(audio_pin_slice); - pwm_set_irq_enabled(audio_pin_slice, true); - irq_set_exclusive_handler(PWM_IRQ_WRAP, AUDIO_isr); - irq_set_priority (PWM_IRQ_WRAP, 128); - irq_set_enabled(PWM_IRQ_WRAP, true); - - //irq_set_exclusive_handler(RTC_IRQ+1,SOFTWARE_isr); - //irq_set_priority (RTC_IRQ+1, 120); - //irq_set_enabled(RTC_IRQ+1,true); - - - // Setup PWM for audio output - pwm_config config = pwm_get_default_config(); -// pwm_config_set_clkdiv(&config, 5.5f); - pwm_config_set_clkdiv(&config, 50.0f); - pwm_config_set_wrap(&config, 254); - pwm_init(audio_pin_slice, &config, true); - - pwm_set_gpio_level(AUDIO_PIN, 0); - printf("sound initialized\n"); -} - -void VGA_T4::end_audio() -{ - if (i2s_tx_buffer != NULL) { - free(i2s_tx_buffer); - } -} - -#endif - - diff --git a/MCUME_pico/vga_t4/VGA_t4.h b/MCUME_pico/vga_t4/VGA_t4.h deleted file mode 100755 index 0d21ef3..0000000 --- a/MCUME_pico/vga_t4/VGA_t4.h +++ /dev/null @@ -1,262 +0,0 @@ -/* - This file is part of VGA_t4 library. - - VGA_t4 library is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - Copyright (C) 2020 J-M Harvengt - - Inspired from the original Teensy3 uVGA library of Eric PREVOTEAU. - QTIMER/FlexIO code based on Teensy4 examples of KurtE, Manitou and easone - from the Teensy4 forum (https://forum.pjrc.com) -*/ - -#ifndef _VGA_T4_H -#define _VGA_T4_H - - -#include -#include -#include "pico.h" - - -// Enable debug info (requires serial initialization) -//#define DEBUG - -typedef uint8_t vga_pixel; -#define VGA_RGB(r,g,b) ( (((r>>5)&0x07)<<5) | (((g>>5)&0x07)<<2) | (((b>>6)&0x3)<<0) ) - - -typedef enum vga_mode_t -{ - VGA_MODE_320x240 = 0, - VGA_MODE_352x240 = 1, - VGA_MODE_400x240 = 2, -} vga_mode_t; - - -typedef enum vga_error_t -{ - VGA_OK = 0, - VGA_ERROR = -1 -} vga_error_t; - -#define MaxPolyPoint 100 - -#define AUDIO_SAMPLE_BUFFER_SIZE 256 - -// 2D point structure -typedef struct { - int16_t x; // X Coordinate on screen - int16_t y; // Y Coordinate on screen -}Point2D; - -// Polygon structure -typedef struct { - Point2D Center; // Polygon Center (point where the polygon can rotate arround) - Point2D Pts[MaxPolyPoint]; // Points for the polygon -}PolyDef; - - -#define DEFAULT_VSYNC_PIN 8 - -#ifndef ABS -#define ABS(X) ((X) > 0 ? (X) : -(X)) -#endif - -extern PolyDef PolySet; // polygon data to declare in c file - - -// Precomputed sinus and cosinus table from 0 to 359 degrees -// The tables are in Degrees not in Radian ! -const float calcsi[360]={ - 0.000001 , // 0 - 0.01745239 , 0.03489947 , 0.05233591 , 0.06975641 , 0.08715567 , 0.1045284 , 0.1218692 , 0.139173 , 0.1564343 , 0.173648 , // 1 à 10 - 0.1908088 , 0.2079115 , 0.2249509 , 0.2419217 , 0.2588188 , 0.2756371 , 0.2923715 , 0.3090167 , 0.3255679 , 0.3420198 , // 11 à 20 - 0.3583677 , 0.3746063 , 0.3907308 , 0.4067363 , 0.4226179 , 0.4383708 , 0.4539901 , 0.4694712 , 0.4848093 , 0.4999996 , // 21 à 30 - 0.5150377 , 0.5299189 , 0.5446386 , 0.5591925 , 0.573576 , 0.5877848 , 0.6018146 , 0.615661 , 0.62932 , 0.6427872 , // 31 à 40 - 0.6560586 , 0.6691301 , 0.6819978 , 0.6946579 , 0.7071063 , 0.7193394 , 0.7313532 , 0.7431444 , 0.7547091 , 0.7660439 , // 41 à 50 - 0.7771455 , 0.7880103 , 0.798635 , 0.8090165 , 0.8191515 , 0.8290371 , 0.8386701 , 0.8480476 , 0.8571668 , 0.8660249 , // 51 à 60 - 0.8746193 , 0.8829472 , 0.8910061 , 0.8987936 , 0.9063074 , 0.913545 , 0.9205045 , 0.9271835 , 0.9335801 , 0.9396922 , // 61 à 70 - 0.9455183 , 0.9510562 , 0.9563044 , 0.9612614 , 0.9659255 , 0.9702954 , 0.9743698 , 0.9781474 , 0.981627 , 0.9848075 , // 71 à 80 - 0.9876881 , 0.9902679 , 0.992546 , 0.9945218 , 0.9961946 , 0.9975639 , 0.9986295 , 0.9993908 , 0.9998476 , 0.99999 , // 81 à 90 - 0.9998477 , 0.9993909 , 0.9986296 , 0.9975642 , 0.9961948 , 0.994522 , 0.9925463 , 0.9902682 , 0.9876886 , 0.984808 , // 91 à 100 - 0.9816275 , 0.9781479 , 0.9743704 , 0.9702961 , 0.9659262 , 0.9612621 , 0.9563052 , 0.9510571 , 0.9455191 , 0.9396932 , // 101 à 110 - 0.933581 , 0.9271844 , 0.9205055 , 0.9135461 , 0.9063086 , 0.8987948 , 0.8910073 , 0.8829485 , 0.8746206 , 0.8660263 , // 111 à 120 - 0.8571682 , 0.8480491 , 0.8386716 , 0.8290385 , 0.8191531 , 0.8090182 , 0.7986366 , 0.7880119 , 0.7771472 , 0.7660457 , // 121 à 130 - 0.7547108 , 0.7431462 , 0.7313551 , 0.7193412 , 0.7071083 , 0.6946598 , 0.6819999 , 0.6691321 , 0.6560606 , 0.6427892 , // 131 à 140 - 0.629322 , 0.6156631 , 0.6018168 , 0.5877869 , 0.5735782 , 0.5591948 , 0.5446408 , 0.5299212 , 0.5150401 , 0.5000019 , // 141 à 150 - 0.4848116 , 0.4694737 , 0.4539925 , 0.4383733 , 0.4226205 , 0.4067387 , 0.3907333 , 0.3746087 , 0.3583702 , 0.3420225 , // 151 à 160 - 0.3255703 , 0.3090193 , 0.2923741 , 0.2756396 , 0.2588214 , 0.2419244 , 0.2249534 , 0.2079142 , 0.1908116 , 0.1736506 , // 161 à 170 - 0.156437 , 0.1391758 , 0.1218719 , 0.1045311 , 0.08715825 , 0.06975908 , 0.05233867 , 0.03490207 , 0.01745508 , 0.0277 , // 171 à 180 - -0.01744977 , -0.03489676 , -0.05233313 , -0.06975379 , -0.08715296 , -0.1045256 , -0.1218666 , -0.1391703 , -0.1564316 , -0.1736454 ,// 181 à 190 - -0.1908061 , -0.207909 , -0.2249483 , -0.241919 , -0.2588163 , -0.2756345 , -0.2923688 , -0.3090142 , -0.3255653 , -0.3420173 , // 191 à 200 - -0.3583652 , -0.3746038 , -0.3907282 , -0.4067339 , -0.4226155 , -0.4383683 , -0.4539878 , -0.4694688 , -0.4848068 , -0.4999973 , // 201 à 210 - -0.5150353 , -0.5299166 , -0.5446364 , -0.5591902 , -0.5735739 , -0.5877826 , -0.6018124 , -0.615659 , -0.6293178 , -0.642785 , // 211 à 220 - -0.6560566 , -0.6691281 , -0.6819958 , -0.694656 , -0.7071043 , -0.7193374 , -0.7313514 , -0.7431425 , -0.7547074 , -0.7660421 , // 221 à 230 - -0.7771439 , -0.7880087 , -0.7986334 , -0.8090149 , -0.8191499 , -0.8290355 , -0.8386687 , -0.8480463 , -0.8571655 , -0.8660236 , // 231 à 240 - -0.8746178 , -0.882946 , -0.8910049 , -0.8987925 , -0.9063062 , -0.9135439 , -0.9205033 , -0.9271825 , -0.9335791 , -0.9396913 , // 241 à 250 - -0.9455173 , -0.9510553 , -0.9563036 , -0.9612607 , -0.9659248 , -0.9702948 , -0.9743692 , -0.9781467 , -0.9816265 , -0.9848071 , // 251 à 260 - -0.9876878 , -0.9902675 , -0.9925456 , -0.9945215 , -0.9961944 , -0.9975638 , -0.9986293 , -0.9993907 , -0.9998476 , -0.99999 , // 261 à 270 - -0.9998478 , -0.9993909 , -0.9986298 , -0.9975643 , -0.9961951 , -0.9945223 , -0.9925466 , -0.9902686 , -0.987689 , -0.9848085 , // 271 à 280 - -0.981628 , -0.9781484 , -0.974371 , -0.9702968 , -0.965927 , -0.9612629 , -0.9563061 , -0.9510578 , -0.9455199 , -0.9396941 , // 281 à 290 - -0.933582 , -0.9271856 , -0.9205065 , -0.9135472 , -0.9063097 , -0.898796 , -0.8910086 , -0.8829498 , -0.8746218 , -0.8660276 , // 291 à 300 - -0.8571696 , -0.8480505 , -0.8386731 , -0.8290402 , -0.8191546 , -0.8090196 , -0.7986383 , -0.7880136 , -0.777149 , -0.7660476 , // 301 à 310 - -0.7547125 , -0.7431479 , -0.7313569 , -0.7193431 , -0.7071103 , -0.6946616 , -0.6820017 , -0.6691341 , -0.6560627 , -0.6427914 , // 311 à 320 - -0.6293243 , -0.6156651 , -0.6018188 , -0.5877892 , -0.5735805 , -0.5591971 , -0.5446434 , -0.5299233 , -0.5150422 , -0.5000043 , // 321 à 330 - -0.484814 , -0.4694761 , -0.4539948 , -0.4383755 , -0.4226228 , -0.4067413 , -0.3907359 , -0.3746115 , -0.3583725 , -0.3420248 , // 331 à 340 - -0.325573 , -0.3090219 , -0.2923768 , -0.2756425 , -0.2588239 , -0.2419269 , -0.2249561 , -0.2079169 , -0.1908143 , -0.1736531 , // 341 à 350 - -0.1564395 , -0.1391783 , -0.1218746 , -0.1045339 , -0.08716125 , -0.06976161 , -0.0523412 , -0.03490484 , -0.01745785 }; // 351 à 359 - -const float calcco[360]={ - 0.99999 , // 0 - 0.9998477 , 0.9993908 , 0.9986295 , 0.9975641 , 0.9961947 , 0.9945219 , 0.9925462 , 0.9902681 , 0.9876884 , 0.9848078 , // 1 à 10 - 0.9816272 , 0.9781477 , 0.9743701 , 0.9702958 , 0.9659259 , 0.9612617 , 0.9563049 , 0.9510566 , 0.9455186 , 0.9396928 , // 11 à 20 - 0.9335806 , 0.927184 , 0.920505 , 0.9135456 , 0.906308 , 0.8987943 , 0.8910067 , 0.8829478 , 0.8746199 , 0.8660256 , // 21 à 30 - 0.8571675 , 0.8480483 , 0.8386709 , 0.8290379 , 0.8191524 , 0.8090173 , 0.7986359 , 0.7880111 , 0.7771463 , 0.7660448 , // 31 à 40 - 0.75471 , 0.7431452 , 0.7313541 , 0.7193403 , 0.7071072 , 0.6946589 , 0.6819989 , 0.6691311 , 0.6560596 , 0.6427882 , // 41 à 50 - 0.629321 , 0.6156621 , 0.6018156 , 0.5877859 , 0.5735771 , 0.5591936 , 0.5446398 , 0.52992 , 0.5150389 , 0.5000008 , // 51 à 60 - 0.4848104 , 0.4694724 , 0.4539914 , 0.438372 , 0.4226191 , 0.4067376 , 0.3907321 , 0.3746075 , 0.3583689 , 0.3420211 , // 61 à 70 - 0.3255692 , 0.309018 , 0.2923728 , 0.2756384 , 0.2588201 , 0.241923 , 0.2249522 , 0.2079128 , 0.1908101 , 0.1736494 , // 71 à 80 - 0.1564357 , 0.1391743 , 0.1218706 , 0.1045297 , 0.08715699 , 0.06975782 , 0.05233728 , 0.0349008 , 0.01745369 , 0.0138 , // 81 à 90 - -0.01745104 , -0.03489815 , -0.05233451 , -0.06975505 , -0.08715434 , -0.1045271 , -0.1218679 , -0.1391717 , -0.156433 , -0.1736467 ,// 91 à 100 - -0.1908075 , -0.2079102 , -0.2249495 , -0.2419204 , -0.2588175 , -0.2756359 , -0.2923701 , -0.3090155 , -0.3255666 , -0.3420185 , // 101 à 110 - -0.3583664 , -0.3746051 , -0.3907295 , -0.4067351 , -0.4226166 , -0.4383696 , -0.4539889 , -0.4694699 , -0.4848081 , -0.4999984 , // 111 à 120 - -0.5150366 , -0.5299177 , -0.5446375 , -0.5591914 , -0.5735749 , -0.5877837 , -0.6018136 , -0.6156599 , -0.6293188 , -0.6427862 , // 121 à 130 - -0.6560575 , -0.669129 , -0.6819969 , -0.6946569 , -0.7071053 , -0.7193384 , -0.7313522 , -0.7431435 , -0.7547083 , -0.7660431 , // 131 à 140 - -0.7771447 , -0.7880094 , -0.7986342 , -0.8090158 , -0.8191508 , -0.8290363 , -0.8386694 , -0.8480469 , -0.8571661 , -0.8660243 , // 141 à 150 - -0.8746186 , -0.8829465 , -0.8910055 , -0.898793 , -0.9063068 , -0.9135445 , -0.9205039 , -0.927183 , -0.9335796 , -0.9396918 , // 151 à 160 - -0.9455178 , -0.9510558 , -0.956304 , -0.9612611 , -0.9659252 , -0.9702951 , -0.9743695 , -0.978147 , -0.9816267 , -0.9848073 , // 161 à 170 - -0.9876879 , -0.9902677 , -0.9925459 , -0.9945216 , -0.9961945 , -0.9975639 , -0.9986294 , -0.9993907 , -0.9998476 , -0.99999 , // 171 à 180 - -0.9998477 , -0.9993909 , -0.9986297 , -0.9975642 , -0.9961949 , -0.9945222 , -0.9925465 , -0.9902685 , -0.9876888 , -0.9848083 , // 181 à 190 - -0.9816277 , -0.9781482 , -0.9743707 , -0.9702965 , -0.9659266 , -0.9612625 , -0.9563056 , -0.9510574 , -0.9455196 , -0.9396937 , // 191 à 200 - -0.9335815 , -0.927185 , -0.9205061 , -0.9135467 , -0.9063091 , -0.8987955 , -0.8910079 , -0.8829491 , -0.8746213 , -0.866027 , // 201 à 210 - -0.857169 , -0.8480497 , -0.8386723 , -0.8290394 , -0.8191538 , -0.8090189 , -0.7986375 , -0.7880127 , -0.7771481 , -0.7660466 , // 211 à 220 - -0.7547117 , -0.743147 , -0.731356 , -0.7193421 , -0.7071092 , -0.6946609 , -0.6820008 , -0.6691331 , -0.6560616 , -0.6427905 , // 221 à 230 - -0.6293229 , -0.6156641 , -0.6018178 , -0.5877882 , -0.5735794 , -0.5591961 , -0.5446419 , -0.5299222 , -0.5150412 , -0.5000032 , // 231 à 240 - -0.4848129 , -0.4694746 , -0.4539936 , -0.4383744 , -0.4226216 , -0.4067401 , -0.3907347 , -0.3746099 , -0.3583714 , -0.3420237 , // 241 à 250 - -0.3255718 , -0.3090207 , -0.2923756 , -0.2756409 , -0.2588227 , -0.2419256 , -0.2249549 , -0.2079156 , -0.1908126 , -0.1736519 , // 251 à 260 - -0.1564383 , -0.139177 , -0.1218734 , -0.1045326 , -0.08715951 , -0.06976035 , -0.05233994 , -0.03490358 , -0.01745659 , -0.0427 , // 261 à 270 - 0.01744851 , 0.0348955 , 0.05233186 , 0.06975229 , 0.08715146 , 0.1045246 , 0.1218654 , 0.139169 , 0.1564303 , 0.1736439 , // 271 à 280 - 0.1908047 , 0.2079078 , 0.224947 , 0.2419178 , 0.2588149 , 0.2756331 , 0.2923674 , 0.309013 , 0.3255641 , 0.3420161 , // 281 à 290 - 0.3583638 , 0.3746024 , 0.3907273 , 0.4067327 , 0.4226143 , 0.4383671 , 0.4539864 , 0.4694674 , 0.4848059 , 0.4999962 , // 291 à 300 - 0.5150342 , 0.5299154 , 0.5446351 , 0.559189 , 0.5735728 , 0.5877816 , 0.6018113 , 0.6156578 , 0.6293167 , 0.6427839 , // 301 à 310 - 0.6560556 , 0.6691272 , 0.6819949 , 0.6946549 , 0.7071033 , 0.7193366 , 0.7313506 , 0.7431416 , 0.7547064 , 0.7660413 , // 311 à 320 - 0.7771428 , 0.7880079 , 0.7986327 , 0.8090141 , 0.8191492 , 0.8290347 , 0.8386678 , 0.8480456 , 0.8571648 , 0.8660229 , // 321 à 330 - 0.8746172 , 0.8829452 , 0.8910043 , 0.8987919 , 0.9063057 , 0.9135434 , 0.9205029 , 0.9271819 , 0.9335786 , 0.9396909 , // 331 à 340 - 0.9455169 , 0.9510549 , 0.9563032 , 0.9612602 , 0.9659245 , 0.9702945 , 0.9743689 , 0.9781465 , 0.9816261 , 0.9848069 , // 341 à 350 - 0.9876875 , 0.9902673 , 0.9925455 , 0.9945213 , 0.9961942 , 0.9975637 , 0.9986292 , 0.9993906 , 0.9998476 }; // 351 à 359 - - -class VGA_T4 -{ -public: - - VGA_T4(); - - // display VGA image - vga_error_t begin(vga_mode_t mode); - void begin_audio(int samplesize, void (*callback)(short * stream, int len)); - void end(); - void end_audio(); - void debug(); - void tweak_video(int shiftdelta, int numdelta, int denomdelta); - - // retrieve real size of the frame buffer - int get_frame_buffer_size(int *width, int *height); - - // wait next Vsync - void waitSync(); - void waitLine(int line); - - // ========================================================= - // graphic primitives - // ========================================================= - - void clear(vga_pixel col) ; - void drawPixel(int x, int y, vga_pixel color); - vga_pixel getPixel(int x, int y); - vga_pixel * getLineBuffer(int j); - void drawRect(int16_t x, int16_t y, int16_t w, int16_t h, vga_pixel color); - void drawText(int16_t x, int16_t y, const char * text, vga_pixel fgcolor, vga_pixel bgcolor, bool doublesize); - void drawSprite(int16_t x, int16_t y, const int16_t *bitmap); - void drawSprite(int16_t x, int16_t y, const int16_t *bitmap, uint16_t croparx, uint16_t cropary, uint16_t croparw, uint16_t croparh); - void writeScreen(const vga_pixel *pcolors); - void writeLine(int width, int height, int y, vga_pixel *buf); - void writeLine(int width, int height, int stride, uint8_t *buffer, vga_pixel *palette); - void writeLine16(int width, int height, int y, uint16_t *buf); - void writeScreen(int width, int height, int stride, uint8_t *buffer, vga_pixel *palette); - void copyLine(int width, int height, int ysrc, int ydst); - - // ************************************** GFX API extension from darthvader ****************************************************** - void drawline(int16_t x1, int16_t y1, int16_t x2, int16_t y2, vga_pixel color); - void draw_h_line(int16_t x1, int16_t y1, int16_t lenght, vga_pixel color); - void draw_v_line(int16_t x1, int16_t y1, int16_t lenght, vga_pixel color); - void drawcircle(int16_t x, int16_t y, int16_t radius, vga_pixel color); - void drawfilledcircle(int16_t x, int16_t y, int16_t radius, vga_pixel fillcolor, vga_pixel bordercolor); - void drawellipse(int16_t cx, int16_t cy, int16_t radius1, int16_t radius2, vga_pixel color); - void drawfilledellipse(int16_t cx, int16_t cy, int16_t radius1, int16_t radius2, vga_pixel fillcolor, vga_pixel bordercolor); - void drawtriangle(int16_t ax, int16_t ay, int16_t bx, int16_t by, int16_t cx, int16_t cy, vga_pixel color); - void drawfilledtriangle(int16_t ax, int16_t ay, int16_t bx, int16_t by, int16_t cx, int16_t cy, vga_pixel fillcolor, vga_pixel bordercolor); - void drawquad(int16_t centerx, int16_t centery, int16_t w, int16_t h, int16_t angle, vga_pixel color); - void drawfilledquad(int16_t centerx, int16_t centery, int16_t w, int16_t h, int16_t angle, vga_pixel fillcolor, vga_pixel bordercolor); - void drawpolygon(int16_t cx, int16_t cy, vga_pixel bordercolor); - void drawfullpolygon(int16_t cx, int16_t cy, vga_pixel fillcolor, vga_pixel bordercolor); - void drawrotatepolygon(int16_t cx, int16_t cy, int16_t Angle, vga_pixel fillcolor, vga_pixel bordercolor, uint8_t filled); - // ******************************************************************************************************************************* - - - // ========================================================= - // Game engine - // ========================================================= - - #define TILES_MAX_LAYERS 2 - - // 16x16 pixels tiles or 8x8 if USE_8PIXTILES is set - //#define USE_8PIXTILES 1 - #ifdef USE_8PIXTILES - #define TILES_COLS 40 - #define TILES_ROWS 30 - #define TILES_W 8 - #define TILES_H 8 - #define TILES_HBITS 3 - #define TILES_HMASK 0x7 - #else - #define TILES_COLS 20 - #define TILES_ROWS 15 - #define TILES_W 16 - #define TILES_H 16 - #define TILES_HBITS 4 - #define TILES_HMASK 0xf - #endif - - // 32 sprites 16x32 or max 64 16x16 (not larger!!!) - #define SPRITES_MAX 32 - #define SPRITES_W 16 - #define SPRITES_H 32 - - void begin_gfxengine(int nblayers, int nbtiles, int nbsprites); - void run_gfxengine(); - void tile_data(unsigned char index, vga_pixel * data, int len); - void sprite_data(unsigned char index, vga_pixel * data, int len); - void sprite(int id , int x, int y, unsigned char index); - void sprite_hide(int id); - void tile_draw(int layer, int x, int y, unsigned char index); - void tile_draw_row(int layer, int x, int y, unsigned char * data, int len); - void tile_draw_col(int layer, int x, int y, unsigned char * data, int len); - void set_hscroll(int layer, int rowbeg, int rowend, int mask); - void set_vscroll(int layer, int colbeg, int colend, int mask); - void hscroll(int layer, int value); - void vscroll(int layer, int value); - - -private: - static uint8_t _vsync_pin; -}; - - -#endif - - diff --git a/MCUME_pico/vga_t4/composable_scanline.h b/MCUME_pico/vga_t4/composable_scanline.h deleted file mode 100644 index c9fb8d7..0000000 --- a/MCUME_pico/vga_t4/composable_scanline.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (c) 2020 Raspberry Pi (Trading) Ltd. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#ifndef SCANVIDEO_COMPOSABLE_SCANLINE_H_ -#define SCANVIDEO_COMPOSABLE_SCANLINE_H_ - -#include "pico/types.h" -#include "scanvideo.pio.h" - - -#define video_24mhz_composable_prefix video_24mhz_composable_default - -// seems needed on some platforms -#define __EXTRA_CONCAT(x, y) __CONCAT(x,y) -#define video_24mhz_composable_program_extern(x) __EXTRA_CONCAT( __EXTRA_CONCAT(video_24mhz_composable_prefix, _offset_), x) -#define __DVP_JMP(x) ((unsigned)video_24mhz_composable_program_extern(x)) -#define COMPOSABLE_EOL_SKIP_ALIGN __DVP_JMP(end_of_scanline_skip_ALIGN) -#define COMPOSABLE_RAW_RUN __DVP_JMP(raw_run) -#define COMPOSABLE_RAW_1P __DVP_JMP(raw_1p) - -#endif diff --git a/MCUME_pico/vga_t4/scanvideo.c b/MCUME_pico/vga_t4/scanvideo.c deleted file mode 100644 index 0439898..0000000 --- a/MCUME_pico/vga_t4/scanvideo.c +++ /dev/null @@ -1,656 +0,0 @@ -/* - * Copyright (c) 2020 Raspberry Pi (Trading) Ltd. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#pragma GCC push_options - -#if !PICO_SCANVIDEO_DEBUG_IMPL -#undef PARAM_ASSERTIONS_DISABLE_ALL -#define PARAM_ASSERTIONS_DISABLE_ALL 1 -#pragma GCC optimize("O3") -#endif - -#include -#include -#include "pico/platform.h" -#include "pico/sem.h" -#include "hardware/clocks.h" -#include "hardware/dma.h" -#include "hardware/gpio.h" -#include "hardware/pio.h" -#include "hardware/irq.h" -#include "timing.pio.h" -#include "scanvideo.h" -#include "composable_scanline.h" -#include "hardware/structs/bus_ctrl.h" -#include "pico/binary_info.h" - -#include "iopins.h" - -#ifdef USE_VGA - -// PICO_CONFIG: PICO_SCANVIDEO_ADJUST_BUS_PRIORITY, Enable/disable adjust bus priority, type=bool, default=0, group=video -#ifndef PICO_SCANVIDEO_ADJUST_BUS_PRIORITY -#define PICO_SCANVIDEO_ADJUST_BUS_PRIORITY 0 -#endif - - -// PICO_CONFIG: PICO_SCANVIDEO_DEBUG_IMPL, Enable/disable debug implementation, type=bool, default=0, group=video -#ifndef PICO_SCANVIDEO_DEBUG_IMPL -#define PICO_SCANVIDEO_DEBUG_IMPL 0 -#endif - -#define PICO_SCANVIDEO_SCANLINE_SM 0u -#define PICO_SCANVIDEO_SCANLINE_DMA_CHANNEL 0u - -#define PICO_SCANVIDEO_TIMING_SM 3u - -#define PICO_SCANVIDEO_SCANLINE_DMA_CHANNELS_MASK (1u << PICO_SCANVIDEO_SCANLINE_DMA_CHANNEL) - - -extern uint32_t * pio_fb; -extern int pio_fbwidth; - - -const scanvideo_timing_t vga_timing_640x480_60_default = - { - .clock_freq = 25000000, - - .h_active = 640, - .v_active = 480, - - .h_front_porch = 16, - .h_pulse = 64, - .h_total = 800, - .h_sync_polarity = 1, - - .v_front_porch = 1, - .v_pulse = 2, - .v_total = 523, - .v_sync_polarity = 1, - - .enable_clock = 0, - .clock_polarity = 0, - - .enable_den = 0 - }; - -const scanvideo_timing_t vga_timing_wide_480_50 = - { - .clock_freq = 24000000, //24000000, - - .h_active = 800, - .v_active = 480, - - .h_front_porch = 32, //12, - .h_pulse = 48, - .h_total = 960, - .h_sync_polarity = 0, - - .v_front_porch = 1, - .v_pulse = 2, - .v_total = 500, - .v_sync_polarity = 0, - - .enable_clock = 0, - .clock_polarity = 0, - - .enable_den = 0 - }; - -const scanvideo_mode_t vga_mode_320x240_60 = - { - .default_timing = &vga_timing_640x480_60_default, - .pio_program = &video_24mhz_composable, - .width = 320, - .height = 240, - .xscale = 2, - .yscale = 2, - }; - - -const scanvideo_mode_t vga_mode_tft_400x240_50 = - { - .default_timing = &vga_timing_wide_480_50, - .pio_program = &video_24mhz_composable, - .width = 400, - .height = 240, - .xscale = 2, - .yscale = 2, - }; - -#define scanline_assert(x) (void)0 - -#define video_pio pio0 - -#if PICO_SCANVIDEO_ADJUST_BUS_PRIORITY -#define VIDEO_ADJUST_BUS_PRIORITY_VAL (BUSCTRL_BUS_PRIORITY_PROC0_BITS | BUSCTRL_BUS_PRIORITY_PROC1_BITS) -#endif - -#ifdef VIDEO_TIME_CRITICAL_CODE_SECTION -#define __video_time_critical_func(x) __attribute__((section(__XSTRING(VIDEO_TIME_CRITICAL_CODE_SECTION) "." x))) x -#else -#define __video_time_critical_func(x) __not_in_flash_func(x) -#endif -// --- video_24mhz_composable --- - -#define video_24mhz_composable_program __CONCAT(video_24mhz_composable_prefix, _program) -#define video_24mhz_composable_wrap_target __CONCAT(video_24mhz_composable_prefix, _wrap_target) -#define video_24mhz_composable_wrap __CONCAT(video_24mhz_composable_prefix, _wrap) - -bool video_24mhz_composable_adapt_for_mode(const scanvideo_pio_program_t *program, const scanvideo_mode_t *mode, - scanvideo_scanline_buffer_t *missing_scanline_buffer, - uint16_t *modifiable_instructions); - -pio_sm_config video_24mhz_composable_configure_pio(pio_hw_t *pio, uint sm, uint offset); - -const scanvideo_pio_program_t video_24mhz_composable = { - .program = &video_24mhz_composable_program, - .entry_point = video_24mhz_composable_program_extern(entry_point), - .adapt_for_mode = video_24mhz_composable_adapt_for_mode, - .configure_pio = video_24mhz_composable_configure_pio -}; - -static uint8_t video_htiming_load_offset; -static uint8_t video_program_load_offset; - -// --- video timing stuff - -// 4 possible instructions; index into program below -enum { - SET_IRQ_0 = 0u, - SET_IRQ_1 = 1u, - SET_IRQ_SCANLINE = 2u, - CLEAR_IRQ_SCANLINE = 3u, -}; - -static struct { - int32_t v_active; - int32_t v_total; - int32_t v_pulse_start; - int32_t v_pulse_end; - // todo replace with plain polarity - uint32_t vsync_bits_pulse; - uint32_t vsync_bits_no_pulse; - - uint32_t a, a_vblank, b1, b2, c, c_vblank; - uint32_t vsync_bits; - uint16_t dma_state_index; - int32_t timing_scanline; -} timing_state; - -#define DMA_STATE_COUNT 4 -static uint32_t dma_states[DMA_STATE_COUNT]; - -// todo get rid of this altogether -#undef PICO_SCANVIDEO_ENABLE_VIDEO_CLOCK_DOWN -#define PICO_SCANVIDEO_ENABLE_VIDEO_CLOCK_DOWN 1 - -#if PICO_SCANVIDEO_ENABLE_VIDEO_CLOCK_DOWN -static uint16_t video_clock_down_times_2; -#endif - -semaphore_t vblank_begin; - -// --- scanline stuff -// private representation of scanline buffer (adds link for one list this scanline buffer is currently in) -typedef struct full_scanline_buffer { - scanvideo_scanline_buffer_t core; - struct full_scanline_buffer *next; -} full_scanline_buffer_t; - - -// This state is sensitive as it it accessed by either core, and multiple IRQ handlers which may be re-entrant -// Nothing in here should be touched except when protected by the appropriate spin lock. -// -// The separations by spin lock (other than the need for spin locks to protect state consistency) is to allow -// safe concurrent operation by both cores, client, IRQ and nested IRQ (pre-emption) where desirable due -// to timing concerns. -static struct { - struct { - full_scanline_buffer_t *current_scanline_buffer; - uint32_t last_scanline_id; - uint32_t next_scanline_id; - // 0 based index of y repeat... goes 0, 0, 0 in non scaled mode, 0, 1, 0, 1 in doubled etc. - uint16_t y_repeat_index; - uint16_t y_repeat_target; - bool in_vblank; - } scanline; - - - // these are not updated, so not locked -} shared_state; - - - -static full_scanline_buffer_t scanline_buffer; - -static void prepare_for_active_scanline_irqs_enabled(); - -static void scanline_dma_complete_irqs_enabled(); - -static void setup_sm(int sm, uint offset); - -// -- MISC stuff -static scanvideo_mode_t video_mode; -static bool video_timing_enabled = false; -static bool display_enabled = true; - -static scanvideo_scanline_repeat_count_fn _scanline_repeat_count_fn; - - - -static inline uint32_t scanline_id_after(uint32_t scanline_id) { - uint32_t tmp = scanline_id & 0xffffu; - - if (tmp < video_mode.height - 1) { - return scanline_id + 1; - } else { - return scanline_id + 0x10000u - tmp; - } -} - - - -static void set_next_scanline_id(uint32_t scanline_id) { - shared_state.scanline.next_scanline_id = scanline_id; - shared_state.scanline.y_repeat_target = _scanline_repeat_count_fn(scanline_id) * video_mode.yscale; -} - -void __video_time_critical_func(prepare_for_active_scanline_irqs_enabled)() { - full_scanline_buffer_t *fsb = &scanline_buffer; - uint16_t scanline = shared_state.scanline.next_scanline_id & 0xffffu; - if (scanline < 240) - fsb->core.data = &pio_fb[(pio_fbwidth+1)*scanline]; - else - fsb->core.data = &pio_fb[0]; - dma_channel_transfer_from_buffer_now(PICO_SCANVIDEO_SCANLINE_DMA_CHANNEL, fsb->core.data, - (uint32_t) fsb->core.data_used); - shared_state.scanline.in_vblank = false; - shared_state.scanline.y_repeat_index += video_mode.yscale_denominator; - if (shared_state.scanline.y_repeat_index >= shared_state.scanline.y_repeat_target) { - shared_state.scanline.y_repeat_index -= shared_state.scanline.y_repeat_target; - set_next_scanline_id(scanline_id_after(shared_state.scanline.next_scanline_id)); - shared_state.scanline.current_scanline_buffer = NULL; - } else /*if (!was_correct_scanline)*/ { - // not at the the end of yscale, but the wrong (or missing) scanline anyway, so clear that - shared_state.scanline.current_scanline_buffer = NULL; - } -} - -static void __video_time_critical_func(prepare_for_vblank_scanline_irqs_enabled)() { - bool signal = false; - if (!shared_state.scanline.in_vblank) { - shared_state.scanline.in_vblank = true; - shared_state.scanline.y_repeat_index = 0; - - // generally this should already have wrapped, but may not have just after a sync - if (scanvideo_scanline_number(shared_state.scanline.next_scanline_id) != 0) { - // set up for scanline 0 of the next frame when we come out of vblank - shared_state.scanline.next_scanline_id = - (scanvideo_frame_number(shared_state.scanline.next_scanline_id) + 1u) << 16u; - shared_state.scanline.y_repeat_target = _scanline_repeat_count_fn(shared_state.scanline.next_scanline_id); - } - signal = true; - } - if (signal) { - sem_release(&vblank_begin); - } -} - -#define setup_dma_states_vblank() if (true) { dma_states[0] = timing_state.a_vblank; dma_states[1] = timing_state.b1; dma_states[2] = timing_state.b2; dma_states[3] = timing_state.c_vblank; } else __builtin_unreachable() -#define setup_dma_states_no_vblank() if (true) { dma_states[0] = timing_state.a; dma_states[1] = timing_state.b1; dma_states[2] = timing_state.b2; dma_states[3] = timing_state.c; } else __builtin_unreachable() - -static inline void top_up_timing_pio_fifo() { - // todo better irq reset ... we are seeing irq get set again, handled in this loop, then we re-enter here when we don't need to - // keep filling until SM3 TX is full - while (!(video_pio->fstat & (1u << (PICO_SCANVIDEO_TIMING_SM + PIO_FSTAT_TXFULL_LSB)))) { - pio_sm_put(video_pio, PICO_SCANVIDEO_TIMING_SM, dma_states[timing_state.dma_state_index] | timing_state.vsync_bits); - // todo simplify this now we have a1, a2, b, c - // todo display enable (only goes positive on start of screen) - - // todo right now we are fixed... make this generic for timing and improve - if (++timing_state.dma_state_index >= DMA_STATE_COUNT) { - timing_state.dma_state_index = 0; - timing_state.timing_scanline++; - - // todo check code and put these in a current state struct - if (timing_state.timing_scanline >= timing_state.v_active) { - if (timing_state.timing_scanline >= timing_state.v_total) { - timing_state.timing_scanline = 0; - // active display - gives irq 0 and irq 4 - setup_dma_states_no_vblank(); - } else if (timing_state.timing_scanline <= timing_state.v_pulse_end) { - if (timing_state.timing_scanline == timing_state.v_active) { - setup_dma_states_vblank(); - } else if (timing_state.timing_scanline == timing_state.v_pulse_start) { - timing_state.vsync_bits = timing_state.vsync_bits_pulse; - } else if (timing_state.timing_scanline == timing_state.v_pulse_end) { - timing_state.vsync_bits = timing_state.vsync_bits_no_pulse; - } - } - } - } - } -} - -void __isr __video_time_critical_func(isr_pio0_0)() { -#if PICO_SCANVIDEO_ADJUST_BUS_PRIORITY - bus_ctrl_hw->priority = VIDEO_ADJUST_BUS_PRIORITY_VAL; -#endif - - // handler for explicit PIO_IRQ0 from PICO_SCANVIDEO_TIMING_SM at a good time to start a DMA for a scanline - // this called once per scanline during non vblank - if (video_pio->irq & 1u) { - video_pio->irq = 1; - if (display_enabled) { - prepare_for_active_scanline_irqs_enabled(); - } - } -#if PICO_SCANVIDEO_ADJUST_BUS_PRIORITY - bus_ctrl_hw->priority = 0; -#endif - // handler for explicit PIO_IRQ1 from PICO_SCANVIDEO_TIMING_SM at a good time to prepare for a scanline - // this is only called once per scanline during vblank - if (video_pio->irq & 2u) { -// video_pio->irq = 2; - video_pio->irq = 3; // we clear irq1 for good measure, in case we had gotten out of sync - prepare_for_vblank_scanline_irqs_enabled(); - } -} - -// irq for PIO FIFO -void __isr __video_time_critical_func(isr_pio0_1)() { - top_up_timing_pio_fifo(); -} - - -static inline bool is_scanline_sm(int sm) { - return sm == PICO_SCANVIDEO_SCANLINE_SM; -} - -void setup_sm(int sm, uint offset) { - pio_sm_config config = is_scanline_sm(sm) ? video_mode.pio_program->configure_pio(video_pio, sm, offset) : - video_htiming_program_get_default_config(offset); - -#if PICO_SCANVIDEO_ENABLE_VIDEO_CLOCK_DOWN - sm_config_set_clkdiv_int_frac(&config, video_clock_down_times_2 / 2, (video_clock_down_times_2 & 1u) << 7u); -#endif - - if (!is_scanline_sm(sm)) { - // enable auto-pull - sm_config_set_out_shift(&config, true, true, 32); - const uint BASE = PICO_SCANVIDEO_SYNC_PIN_BASE; // hsync and vsync are +0 and +1, clock is +2 - uint pin_count; - // 2 OUT pins and 1 sideset pin following them - pin_count = 2; - sm_config_set_out_pins(&config, BASE, pin_count); - pio_sm_set_consecutive_pindirs(video_pio, sm, BASE, pin_count, true); - } - - pio_sm_init(video_pio, sm, offset, &config); // now paused -} - -scanvideo_mode_t scanvideo_get_mode() { - return video_mode; -} - - -static uint default_scanvideo_scanline_repeat_count_fn(uint32_t scanline_id) { - return 1; -} - - -//#pragma GCC pop_options - -void scanvideo_set_scanline_repeat_fn(scanvideo_scanline_repeat_count_fn fn) { - _scanline_repeat_count_fn = fn ? fn : default_scanvideo_scanline_repeat_count_fn; -} - - -static pio_program_t copy_program(const pio_program_t *program, uint16_t *instructions, - uint32_t max_instructions) { - assert(max_instructions >= program->length); - pio_program_t copy = *program; - __builtin_memcpy(instructions, program->instructions, MIN(program->length, max_instructions) * sizeof(uint16_t)); - copy.instructions = instructions; - return copy; -} - -static bool scanvideo_setup_with_timing(const scanvideo_mode_t *mode, const scanvideo_timing_t *timing) { - __builtin_memset(&shared_state, 0, sizeof(shared_state)); - - // init non zero members - shared_state.scanline.last_scanline_id = 0xffffffff; - video_mode = *mode; - video_mode.default_timing = timing; - - if (!video_mode.yscale_denominator) video_mode.yscale_denominator = 1; - // todo is this still necessary? - //invalid_params_if(SCANVIDEO_DPI, (timing->v_active % mode->yscale)); - - sem_init(&vblank_begin, 0, 1); - - - __mem_fence_release(); - - uint pin_mask = 3u << PICO_SCANVIDEO_SYNC_PIN_BASE; - //bi_decl_if_func_used(bi_2pins_with_names(PICO_SCANVIDEO_SYNC_PIN_BASE, "HSync", - // PICO_SCANVIDEO_SYNC_PIN_BASE + 1, "VSync")); - static_assert(PICO_SCANVIDEO_PIXEL_RSHIFT + PICO_SCANVIDEO_PIXEL_RCOUNT <= PICO_SCANVIDEO_COLOR_PIN_COUNT, "red bits do not fit in color pins"); - static_assert(PICO_SCANVIDEO_PIXEL_GSHIFT + PICO_SCANVIDEO_PIXEL_GCOUNT <= PICO_SCANVIDEO_COLOR_PIN_COUNT, "green bits do not fit in color pins"); - static_assert(PICO_SCANVIDEO_PIXEL_BSHIFT + PICO_SCANVIDEO_PIXEL_BCOUNT <= PICO_SCANVIDEO_COLOR_PIN_COUNT, "blue bits do not fit in color pins"); -#define RMASK ((1u << PICO_SCANVIDEO_PIXEL_RCOUNT) - 1u) -#define GMASK ((1u << PICO_SCANVIDEO_PIXEL_GCOUNT) - 1u) -#define BMASK ((1u << PICO_SCANVIDEO_PIXEL_BCOUNT) - 1u) - pin_mask |= RMASK << (PICO_SCANVIDEO_COLOR_PIN_BASE + PICO_SCANVIDEO_PIXEL_RSHIFT); - pin_mask |= GMASK << (PICO_SCANVIDEO_COLOR_PIN_BASE + PICO_SCANVIDEO_PIXEL_GSHIFT); - pin_mask |= BMASK << (PICO_SCANVIDEO_COLOR_PIN_BASE + PICO_SCANVIDEO_PIXEL_BSHIFT); - //bi_decl_if_func_used(bi_pin_mask_with_name(RMASK << (PICO_SCANVIDEO_COLOR_PIN_BASE + PICO_SCANVIDEO_PIXEL_RSHIFT), RMASK == 1 ? "Red" : ("Red 0-" __XSTRING(PICO_SCANVIDEO_PIXEL_GCOUNT)))); - //bi_decl_if_func_used(bi_pin_mask_with_name(GMASK << (PICO_SCANVIDEO_COLOR_PIN_BASE + PICO_SCANVIDEO_PIXEL_GSHIFT), GMASK == 1 ? "Green" : ("Green 0-" __XSTRING(PICO_SCANVIDEO_PIXEL_GCOUNT)))); - //bi_decl_if_func_used(bi_pin_mask_with_name(BMASK << (PICO_SCANVIDEO_COLOR_PIN_BASE + PICO_SCANVIDEO_PIXEL_BSHIFT), BMASK == 1 ? "Blue" : ("Blue 0-" __XSTRING(PICO_SCANVIDEO_PIXEL_BCOUNT)))); - - for(uint8_t i = 0; pin_mask; i++, pin_mask>>=1u) { - if (pin_mask & 1) gpio_set_function(i, GPIO_FUNC_PIO0); - } - -#if !PICO_SCANVIDEO_ENABLE_VIDEO_CLOCK_DOWN - valid_params_if(SCANVIDEO_DPI, timing->clock_freq == video_clock_freq); -#else - uint sys_clk = clock_get_hz(clk_sys); - video_clock_down_times_2 = sys_clk / timing->clock_freq; - //if (video_clock_down_times_2 * timing->clock_freq != sys_clk) { - // panic("System clock (%d) must be an integer multiple of the requested pixel clock (%d).", sys_clk, timing->clock_freq); - //} -#endif - - valid_params_if(SCANVIDEO_DPI, mode->width * mode->xscale <= timing->h_active); - valid_params_if(SCANVIDEO_DPI, mode->height * mode->yscale <= timing->v_active * video_mode.yscale_denominator); - - uint16_t instructions[32]; - pio_program_t modified_program = copy_program(mode->pio_program->program, instructions, - count_of(instructions)); - - if (!mode->pio_program->adapt_for_mode(mode->pio_program, mode, &scanline_buffer.core, instructions)) { - valid_params_if(SCANVIDEO_DPI, false); - } - valid_params_if(SCANVIDEO_DPI, scanline_buffer.core.data && scanline_buffer.core.data_used); - video_program_load_offset = pio_add_program(video_pio, &modified_program); - - setup_sm(PICO_SCANVIDEO_SCANLINE_SM, video_program_load_offset); - - uint32_t side_set_xor = 0; - modified_program = copy_program(&video_htiming_program, instructions, count_of(instructions)); - - if (timing->clock_polarity) { - side_set_xor = 0x1000; // flip the top side set bit - - for (uint i = 0; i < video_htiming_program.length; i++) { - instructions[i] ^= side_set_xor; - } - } - - video_htiming_load_offset = pio_add_program(video_pio, &modified_program); - - setup_sm(PICO_SCANVIDEO_TIMING_SM, video_htiming_load_offset); - - // make this highest priority -#if PICO_DEFAULT_IRQ_PRIORITY < 0x40 -#warning pico_scanvideo_dpi may not always function correctly without PIO_IRQ_0 at a higher priority than other interrupts. - irq_set_priority(PIO0_IRQ_1, 0x40); // lower priority by 1 - irq_set_priority(DMA_IRQ_0, 0x80); // lower priority by 2 -#else - irq_set_priority(PIO0_IRQ_0, 0); // highest priority - irq_set_priority(PIO0_IRQ_1, 0x40); // lower priority by 1 -#endif - - dma_claim_mask(PICO_SCANVIDEO_SCANLINE_DMA_CHANNELS_MASK); - dma_set_irq0_channel_mask_enabled(PICO_SCANVIDEO_SCANLINE_DMA_CHANNELS_MASK, true); - // also done in scanvideo_timing_enable -// video_pio->inte1 = 1u << (PICO_SCANVIDEO_TIMING_SM + PIO_IRQ1_INTE_SM0_TXNFULL_LSB); - - // todo reset DMA channels - - dma_channel_config channel_config = dma_channel_get_default_config(PICO_SCANVIDEO_SCANLINE_DMA_CHANNEL); - channel_config_set_dreq(&channel_config, DREQ_PIO0_TX0 + - PICO_SCANVIDEO_SCANLINE_SM); // Select scanline dma dreq to be PICO_SCANVIDEO_SCANLINE_SM TX FIFO not full - dma_channel_configure(PICO_SCANVIDEO_SCANLINE_DMA_CHANNEL, - &channel_config, - &video_pio->txf[PICO_SCANVIDEO_SCANLINE_SM], - NULL, // set later - 0, // set later - false); - - // clear scanline irq - pio_sm_exec(video_pio, PICO_SCANVIDEO_TIMING_SM, video_htiming_states_program.instructions[CLEAR_IRQ_SCANLINE]); - - // todo there are probably some restrictions :-) - //assert(timing->v_front_porch == 1); - //assert(timing->v_pulse == 2); - //assert(timing->v_total == 500); - - timing_state.v_total = timing->v_total; - timing_state.v_active = timing->v_active; - timing_state.v_pulse_start = timing->v_active + timing->v_front_porch; - timing_state.v_pulse_end = timing_state.v_pulse_start + timing->v_pulse; - const uint32_t vsync_bit = 0x40000000; - timing_state.vsync_bits_pulse = timing->v_sync_polarity ? 0 : vsync_bit; - timing_state.vsync_bits_no_pulse = timing->v_sync_polarity ? vsync_bit : 0; - - // these are read bitwise backwards (lsb to msb) by PIO pogram - - // we can probably do smaller -#define HTIMING_MIN 8 - -#define TIMING_CYCLE 3u -#define timing_encode(state, length, pins) ((video_htiming_states_program.instructions[state] ^ side_set_xor)| (((uint32_t)(length) - TIMING_CYCLE) << 16u) | ((uint32_t)(pins) << 29u)) -#define A_CMD SET_IRQ_0 -#define A_CMD_VBLANK SET_IRQ_1 -#define B1_CMD CLEAR_IRQ_SCANLINE -#define B2_CMD CLEAR_IRQ_SCANLINE -#define C_CMD SET_IRQ_SCANLINE -#define C_CMD_VBLANK CLEAR_IRQ_SCANLINE - - int h_sync_bit = timing->h_sync_polarity ? 0 : 1; - timing_state.a = timing_encode(A_CMD, 4, h_sync_bit); - static_assert(HTIMING_MIN >= 4, ""); - timing_state.a_vblank = timing_encode(A_CMD_VBLANK, 4, h_sync_bit); - int h_back_porch = timing->h_total - timing->h_front_porch - timing->h_pulse - timing->h_active; - - valid_params_if(SCANVIDEO_DPI, timing->h_pulse - 4 >= HTIMING_MIN); - timing_state.b1 = timing_encode(B1_CMD, timing->h_pulse - 4, h_sync_bit); - - // todo decide on what these should be - we should really be asserting the timings - // - // todo note that the placement of the active scanline IRQ from the timing program is super important. - // if it gets moved too much (or indeed at all) it may be that there are problems with DMA/SM IRQ - // overlap, which may require the addition of a separate timing state for the prepare for scanline - // (separate from the needs of setting the hsync pulse) - valid_params_if(SCANVIDEO_DPI, timing->h_active >= HTIMING_MIN); - //assert(timing->h_front_porch >= HTIMING_MIN); - valid_params_if(SCANVIDEO_DPI, h_back_porch >= HTIMING_MIN); - valid_params_if(SCANVIDEO_DPI, (timing->h_total - h_back_porch - timing->h_pulse) >= HTIMING_MIN); - timing_state.b2 = timing_encode(B2_CMD, h_back_porch, !h_sync_bit); - timing_state.c = timing_encode(C_CMD, timing->h_total - h_back_porch - timing->h_pulse, 4 | !h_sync_bit); - timing_state.c_vblank = timing_encode(C_CMD_VBLANK, timing->h_total - h_back_porch - timing->h_pulse, !h_sync_bit); - - // this is two scanlines in vblank - setup_dma_states_vblank(); - timing_state.vsync_bits = timing_state.vsync_bits_no_pulse; - scanvideo_set_scanline_repeat_fn(NULL); - return true; -} - -bool scanvideo_setup(const scanvideo_mode_t *mode) { - return scanvideo_setup_with_timing(mode, mode->default_timing); -} - - -bool video_24mhz_composable_adapt_for_mode(const scanvideo_pio_program_t *program, const scanvideo_mode_t *mode, - scanvideo_scanline_buffer_t *missing_scanline_buffer, - uint16_t *modifiable_instructions) { - int delay0 = 2 * mode->xscale - 2; - int delay1 = delay0 + 1; - valid_params_if(SCANVIDEO_DPI, delay0 <= 31); - valid_params_if(SCANVIDEO_DPI, delay1 <= 31); - - // todo macro-ify this - modifiable_instructions[video_24mhz_composable_program_extern(delay_d_0)] |= (unsigned) delay0 << 8u; - modifiable_instructions[video_24mhz_composable_program_extern(delay_e_0)] |= (unsigned) delay0 << 8u; - - missing_scanline_buffer->data_used = missing_scanline_buffer->data_max = pio_fbwidth; - missing_scanline_buffer->status = SCANLINE_OK; - - return true; -} - - -pio_sm_config video_24mhz_composable_configure_pio(pio_hw_t *pio, uint sm, uint offset) { - pio_sm_config config = video_24mhz_composable_default_program_get_default_config(offset); - pio_sm_set_consecutive_pindirs(pio, sm, PICO_SCANVIDEO_COLOR_PIN_BASE, PICO_SCANVIDEO_COLOR_PIN_COUNT, true); - sm_config_set_out_pins(&config, PICO_SCANVIDEO_COLOR_PIN_BASE, PICO_SCANVIDEO_COLOR_PIN_COUNT); - sm_config_set_out_shift(&config, true, true, 32); // autopull - sm_config_set_fifo_join(&config, PIO_FIFO_JOIN_TX); - sm_config_set_out_special(&config, 1, 0, 0); - return config; -} - -void scanvideo_timing_enable(bool enable) { - // todo we need to protect our state here... this can't be frame synced obviously (at least turning on) - // todo but we should make sure we clear out state when we turn it off, and probably reset scanline counter when we turn it on - if (enable != video_timing_enabled) { - // todo should we disable these too? if not move to scanvideo_setup - video_pio->inte0 = PIO_IRQ0_INTE_SM0_BITS | PIO_IRQ0_INTE_SM1_BITS; - video_pio->inte1 = (1u << (PICO_SCANVIDEO_TIMING_SM + PIO_IRQ1_INTE_SM0_TXNFULL_LSB)); - irq_set_mask_enabled((1u << PIO0_IRQ_0) - | (1u << PIO0_IRQ_1) - , enable); - uint32_t sm_mask = (1u << PICO_SCANVIDEO_SCANLINE_SM) | 1u << PICO_SCANVIDEO_TIMING_SM; - pio_claim_sm_mask(video_pio, sm_mask); - pio_set_sm_mask_enabled(video_pio, sm_mask, false); -#if PICO_SCANVIDEO_ENABLE_VIDEO_CLOCK_DOWN - pio_clkdiv_restart_sm_mask(video_pio, sm_mask); -#endif - - if (enable) { - uint jmp = video_program_load_offset + pio_encode_jmp(video_mode.pio_program->entry_point); - pio_sm_exec(video_pio, PICO_SCANVIDEO_SCANLINE_SM, jmp); - // todo we should offset the addresses for the SM - pio_sm_exec(video_pio, PICO_SCANVIDEO_TIMING_SM, - pio_encode_jmp(video_htiming_load_offset + video_htiming_offset_entry_point)); - pio_set_sm_mask_enabled(video_pio, sm_mask, true); - } - video_timing_enabled = enable; - } -} - - -void scanvideo_wait_for_vblank() { - sem_acquire_blocking(&vblank_begin); -} - -#endif - -#pragma GCC pop_options diff --git a/MCUME_pico/vga_t4/scanvideo.h b/MCUME_pico/vga_t4/scanvideo.h deleted file mode 100644 index a31109d..0000000 --- a/MCUME_pico/vga_t4/scanvideo.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2020 Raspberry Pi (Trading) Ltd. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#ifndef PICO_SCANVIDEO_H_ -#define PICO_SCANVIDEO_H_ - -// note that defining to false will force non-inclusion also -#if !defined(PICO_SCANVIDEO_DPI) -//#define PICO_SCANVIDEO_DPI 1 - -#ifndef PARAM_ASSERTIONS_ENABLED_SCANVIDEO_DPI -#define PARAM_ASSERTIONS_ENABLED_SCANVIDEO_DPI 0 -#endif - -#include "scanvideo_base.h" - -#ifndef PICO_SCANVIDEO_DPI_PIXEL_RSHIFT -#define PICO_SCANVIDEO_DPI_PIXEL_RSHIFT 0u -#endif - -#ifndef PICO_SCANVIDEO_DPI_PIXEL_GSHIFT -#define PICO_SCANVIDEO_DPI_PIXEL_GSHIFT 3u -#endif - -#ifndef PICO_SCANVIDEO_DPI_PIXEL_BSHIFT -#define PICO_SCANVIDEO_DPI_PIXEL_BSHIFT 6u -#endif - -#ifndef PICO_SCANVIDEO_DPI_PIXEL_RCOUNT -#define PICO_SCANVIDEO_DPI_PIXEL_RCOUNT 3 -#endif - -#ifndef PICO_SCANVIDEO_DPI_PIXEL_GCOUNT -#define PICO_SCANVIDEO_DPI_PIXEL_GCOUNT 3 -#endif - -#ifndef PICO_SCANVIDEO_DPI_PIXEL_BCOUNT -#define PICO_SCANVIDEO_DPI_PIXEL_BCOUNT 2 -#endif - -#ifndef PICO_SCANVIDEO_PIXEL_RSHIFT -#define PICO_SCANVIDEO_PIXEL_RSHIFT PICO_SCANVIDEO_DPI_PIXEL_RSHIFT -#endif - -#ifndef PICO_SCANVIDEO_PIXEL_GSHIFT -#define PICO_SCANVIDEO_PIXEL_GSHIFT PICO_SCANVIDEO_DPI_PIXEL_GSHIFT -#endif - -#ifndef PICO_SCANVIDEO_PIXEL_BSHIFT -#define PICO_SCANVIDEO_PIXEL_BSHIFT PICO_SCANVIDEO_DPI_PIXEL_BSHIFT -#endif - -#ifndef PICO_SCANVIDEO_PIXEL_RCOUNT -#define PICO_SCANVIDEO_PIXEL_RCOUNT PICO_SCANVIDEO_DPI_PIXEL_RCOUNT -#endif - -#ifndef PICO_SCANVIDEO_PIXEL_GCOUNT -#define PICO_SCANVIDEO_PIXEL_GCOUNT PICO_SCANVIDEO_DPI_PIXEL_GCOUNT -#endif - -#ifndef PICO_SCANVIDEO_PIXEL_BCOUNT -#define PICO_SCANVIDEO_PIXEL_BCOUNT PICO_SCANVIDEO_DPI_PIXEL_BCOUNT -#endif - - -/** \file scanvideo.h - * \defgroup pico_scanvideo_dpi pico_scanvideo_dpi - * - * DPI Scan-out Video using the PIO - */ - -#endif -#endif diff --git a/MCUME_pico/vga_t4/scanvideo.pio b/MCUME_pico/vga_t4/scanvideo.pio deleted file mode 100644 index bd70f39..0000000 --- a/MCUME_pico/vga_t4/scanvideo.pio +++ /dev/null @@ -1,39 +0,0 @@ -; -; Copyright (c) 2020 Raspberry Pi (Trading) Ltd. -; -; SPDX-License-Identifier: BSD-3-Clause -; - -; Default scanline program (|| means aligned word boundary, | means hword boundary) -.program video_24mhz_composable_default -.origin 0 ; must load at zero (offsets are hardcoded in instruction stream) -.define extra0 0 ; set later by code based on xscale -.define extra1 0 ; set later by code (1 more than extra0) - -; note bpp must be a factor of 32 -.define bpp 16 - -public end_of_scanline_skip_ALIGN: ; || jmp end_of_scanline_skip_ALIGN | ignored || - ; was 16 but we just discard the reset of the OSR - ; so as to also support 8 bit grayscale - out null, 32; - -public entry_point: - wait irq, 4 ; todo perhaps change this to out exec, 16... so that we can do multiple things (including setting black pixel) - out pc, bpp - -public raw_run: ; | jmp raw_run | color | n | | - out x, bpp -pixel_loop: -public delay_d_0: - out pins, 8 [extra0] - jmp x-- pixel_loop -.wrap_target - -;public raw_1p: ; | jmp raw_1p | color | -public delay_e_0: - out pins, 8 [extra0] - out pc, bpp - - - diff --git a/MCUME_pico/vga_t4/scanvideo_base.h b/MCUME_pico/vga_t4/scanvideo_base.h deleted file mode 100644 index 081c26c..0000000 --- a/MCUME_pico/vga_t4/scanvideo_base.h +++ /dev/null @@ -1,159 +0,0 @@ -/* - * Copyright (c) 2020 Raspberry Pi (Trading) Ltd. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#ifndef SCANVIDEO_scanvideo_H_ -#define SCANVIDEO_scanvideo_H_ - -#include "pico/types.h" -#include "hardware/pio.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** \file scanvideo_base.h - * \defgroup pico_scanvideo pico_scanvideo - * - * Common Scan-out Video API - */ -// == CONFIG ============ - -#ifndef PICO_SCANVIDEO_COLOR_PIN_BASE -#define PICO_SCANVIDEO_COLOR_PIN_BASE VGA_COLORBASE -#endif - -#ifndef PICO_SCANVIDEO_COLOR_PIN_COUNT -#define PICO_SCANVIDEO_COLOR_PIN_COUNT 8 -#endif - -#ifndef PICO_SCANVIDEO_SYNC_PIN_BASE -#define PICO_SCANVIDEO_SYNC_PIN_BASE VGA_SYNCBASE -#endif - - - -// ====================== - -// most likely 24000000 -extern const uint32_t video_clock_freq; - -// todo pragma pack? -typedef struct scanvideo_timing { - uint32_t clock_freq; - - uint16_t h_active; - uint16_t v_active; - - uint16_t h_front_porch; - uint16_t h_pulse; - uint16_t h_total; - uint8_t h_sync_polarity; - - uint16_t v_front_porch; - uint16_t v_pulse; - uint16_t v_total; - uint8_t v_sync_polarity; - - uint8_t enable_clock; - uint8_t clock_polarity; - - uint8_t enable_den; -} scanvideo_timing_t; - -typedef struct scanvideo_pio_program scanvideo_pio_program_t; - -// todo we need to handle blank data correctly (perhaps DMA should just not start for that scanline, -// though obviously this is slightly more complicated with multiple playfields, or perhaps worse with -// just one -typedef struct scanvideo_mode { - const scanvideo_timing_t *default_timing; - const scanvideo_pio_program_t *pio_program; - - uint16_t width; - uint16_t height; - uint8_t xscale; // 1 == normal, 2 == double wide etc. up to what pio timing allows (not sure I have an assert based on delays) - uint16_t yscale; // same for y scale (except any yscale is possible) - // if > 1 then yscale is divided by this to provide the effective yscale; - // note that yscale must be > yscale_denominator; i.e. only stretching is supported - uint16_t yscale_denominator; -} scanvideo_mode_t; - -extern bool scanvideo_setup(const scanvideo_mode_t *mode); -extern void scanvideo_timing_enable(bool enable); - -// --- scanline management --- - -typedef struct scanvideo_scanline_buffer { - uint32_t scanline_id; - uint32_t *data; - uint16_t data_used; - uint16_t data_max; - void *user_data; - uint8_t status; -} scanvideo_scanline_buffer_t; - -enum { - SCANLINE_OK = 1, - SCANLINE_ERROR, - SCANLINE_SKIPPED -}; - -// note frame numbers wrap -static inline uint16_t scanvideo_frame_number(uint32_t scanline_id) { - return (uint16_t) (scanline_id >> 16u); -} - -static inline uint16_t scanvideo_scanline_number(uint32_t scanline_id) { - return (uint16_t) scanline_id; -} - -/** - * @return the current vga mode (if there is one) - */ -extern scanvideo_mode_t scanvideo_get_mode(); - -extern void scanvideo_wait_for_vblank(); - - -/** - * Return a scanline that has been generated / or at least the client is done with. - * - * The status field indicates whether the scanline was actually generated OK - * - * This method may be called concurrently (for different buffers) - * - * @param scanline_buffer \todo - */ -void scanvideo_end_scanline_generation(scanvideo_scanline_buffer_t *scanline_buffer); - -typedef uint (*scanvideo_scanline_repeat_count_fn)(uint32_t scanline_id); -void scanvideo_set_scanline_repeat_fn(scanvideo_scanline_repeat_count_fn fn); - -extern const scanvideo_timing_t vga_timing_640x480_60_default; -extern const scanvideo_mode_t vga_mode_320x240_60; -extern const scanvideo_mode_t vga_mode_tft_400x240_50; - - -// mode implementation - -struct scanvideo_pio_program { - const pio_program_t *program; - const uint8_t entry_point; - // modifiable_instructions is of size program->length - bool (*adapt_for_mode)(const scanvideo_pio_program_t *program, const scanvideo_mode_t *mode, - scanvideo_scanline_buffer_t *missing_scanline_buffer, uint16_t *modifiable_instructions); - pio_sm_config (*configure_pio)(pio_hw_t *pio, uint sm, uint offset); -}; - -extern const scanvideo_pio_program_t video_24mhz_composable; - - - -#ifdef __cplusplus -} -#endif - -#endif //_VIDEO_H diff --git a/MCUME_pico/vga_t4/timing.pio b/MCUME_pico/vga_t4/timing.pio deleted file mode 100644 index aea152c..0000000 --- a/MCUME_pico/vga_t4/timing.pio +++ /dev/null @@ -1,34 +0,0 @@ -; -; Copyright (c) 2020 Raspberry Pi (Trading) Ltd. -; -; SPDX-License-Identifier: BSD-3-Clause -; - -.program video_htiming -.side_set 1 ; used for clock -public entry_point: - ; todo we can do this with one off setup via pio_exec - pull block side 0 -.wrap_target -new_state: - out exec, 16 side 1 ; this does any per state inline work (or it can be a JMP to entry_point to sleep.. - ; note the EXECed instruction should have a side set 0 - out x, 13 side 1 - out pins, 3 side 0 ; we want an OUT EXEC above which sets an IRQ to start scanline output - ; to cause this out and the pixel out in the same cycle (this would be positive clk edge latch) -loop: - nop side 1 - jmp x-- loop side 0 -.wrap - -; these are the values used in the out exec in video_htiming -.program video_htiming_states -.side_set 1 - ; state 0 = set irq 0 - irq 0 side 0 - ; state 1 = set irq 1 - irq 1 side 0 - ; state 2 = set irq 4 - irq 4 side 0 - ; state 3 = clear irq 4 - irq clear 4 side 0 diff --git a/MCUME_pico/vga_t4/vga_t_dma.h b/MCUME_pico/vga_t4/vga_t_dma.h deleted file mode 100644 index e9d96e6..0000000 --- a/MCUME_pico/vga_t4/vga_t_dma.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - Wrapping class to extend VGA_T4 to TFT_T_DMA -*/ - -#ifndef _VGA_T_DMAH_ -#define _VGA_T_DMAH_ - -#ifdef __cplusplus -#include "VGA_t4.h" -#endif - - -#define RGBVAL16(r,g,b) VGA_RGB(r,g,b) -#define RGBVAL8(r,g,b) VGA_RGB(r,g,b) - - - -#ifdef HIRES -#define TFT_WIDTH 640 -#define TFT_REALWIDTH 640 -#else -#define TFT_WIDTH 320 -#define TFT_REALWIDTH 320 -#endif - -#define TFT_HEIGHT 240 -#define TFT_REALHEIGHT 240 - - - -#ifdef __cplusplus - -class TFT_T_DMA: public VGA_T4 -{ - public: - // Fake touch screen functions - bool isTouching(void) { return false; } - void readRaw(uint16_t * oX, uint16_t * oY, uint16_t * oZ) { } - void readCal(uint16_t * oX, uint16_t * oY, uint16_t * oZ) { }; - void callibrateTouch(uint16_t xMin,uint16_t yMin,uint16_t xMax,uint16_t yMax) { } - - // fake DMA functions - void startDMA(void) { }; - void stopDMA(void) { }; - void flipscreen(bool flip) { }; - - // fake no DMA functions - void writeScreenNoDma(const vga_pixel *pcolors) { writeScreen(pcolors); } - void fillScreenNoDma(vga_pixel color) { clear(color); } - void drawTextNoDma(int16_t x, int16_t y, const char * text, vga_pixel fgcolor, vga_pixel bgcolor, bool doublesize) { drawText(x,y,text,fgcolor,bgcolor,doublesize); } - void drawRectNoDma(int16_t x, int16_t y, int16_t w, int16_t h, vga_pixel color) { drawRect(x, y, w, h, color); } - void drawSpriteNoDma(int16_t x, int16_t y, const int16_t *bitmap) { drawSprite(x, y, bitmap); } - void drawSpriteNoDma(int16_t x, int16_t y, const int16_t *bitmap, uint16_t croparx, uint16_t cropary, uint16_t croparw, uint16_t croparh) { drawSprite(x, y, bitmap, croparx, cropary, croparw, croparh); } -}; - - -#endif -#endif