diff -urN MSX.org/LibUnix.c MSX/LibUnix.c --- MSX.org/LibUnix.c Mon May 23 09:10:43 2005 +++ MSX/LibUnix.c Tue May 24 10:02:49 2005 @@ -11,6 +11,7 @@ /** changes to this file. **/ /*************************************************************/ #ifdef UNIX +#ifndef SDL #include "LibUnix.h" @@ -741,4 +742,8 @@ return(Result); } +#else /* #ifndef SDL */ +int ARGC = 0; +char **ARGV = 0; +#endif /* #ifndef SDL */ #endif /* UNIX */ diff -urN MSX.org/MSX.c MSX/MSX.c --- MSX.org/MSX.c Mon May 23 09:10:43 2005 +++ MSX/MSX.c Sat Jun 18 23:46:14 2005 @@ -142,6 +142,11 @@ byte OldMouseX[2],OldMouseY[2]; /* Old mouse coordinates */ byte MCount[2]; /* Mouse nibble counter */ +#ifdef ZAURUS +extern byte JoyState; +extern byte JoyAuto; +#endif + /** General I/O registers: i8255 *****************************/ I8255 PPI; /* i8255 PPI at A8h-ABh */ byte IOReg; /* Storage for AAh port */ @@ -407,6 +412,7 @@ case 0: if(Verbose) printf(" Opening MSX.ROM..."); P=LoadROM("MSX.ROM",0x8000,0); + if(!P) P=LoadROM("msx.rom",0x8000,0); PRINTRESULT(P); if(!P) return(0); MemMap[0][0][0]=P; @@ -418,6 +424,7 @@ case 1: if(Verbose) printf(" Opening MSX2.ROM..."); P=LoadROM("MSX2.ROM",0x8000,0); + if(!P) P=LoadROM("msx2.rom",0x8000,0); PRINTRESULT(P); if(!P) return(0); MemMap[0][0][0]=P; @@ -426,6 +433,7 @@ MemMap[0][0][3]=P+0x6000; if(Verbose) printf(" Opening MSX2EXT.ROM..."); P=LoadROM("MSX2EXT.ROM",0x4000,0); + if(!P) P=LoadROM("msx2ext.rom",0x4000,0); PRINTRESULT(P); if(!P) return(0); MemMap[3][1][0]=P; @@ -435,6 +443,7 @@ case 2: if(Verbose) printf(" Opening MSX2P.ROM..."); P=LoadROM("MSX2P.ROM",0x8000,0); + if(!P) P=LoadROM("msx2p.rom",0x8000,0); PRINTRESULT(P); if(!P) return(0); MemMap[0][0][0]=P; @@ -443,6 +452,7 @@ MemMap[0][0][3]=P+0x6000; if(Verbose) printf(" Opening MSX2PEXT.ROM..."); P=LoadROM("MSX2PEXT.ROM",0x4000,0); + if(!P) P=LoadROM("msx2pext.rom",0x4000,0); PRINTRESULT(P); if(!P) return(0); MemMap[3][1][0]=P; @@ -451,7 +461,9 @@ } /* Try loading DiskROM */ - if(P=LoadROM("DISK.ROM",0x4000,0)) + P=LoadROM("DISK.ROM",0x4000,0); + if(!P) P=LoadROM("disk.rom",0x4000,0); + if(P) { if(Verbose) puts(" Opening DISK.ROM...OK"); MemMap[3][1][2]=P; @@ -484,16 +496,22 @@ if(Verbose) printf("Loading other ROMs: "); /* Try loading CMOS memory contents */ - if(LoadROM("CMOS.ROM",sizeof(RTC),(byte *)RTC)) + P=LoadROM("CMOS.ROM",sizeof(RTC),(byte *)RTC); + if(!P) LoadROM("cmos.rom",sizeof(RTC),(byte *)RTC); + if(P) { if(Verbose) printf("CMOS.ROM.."); } else memcpy(RTC,RTCInit,sizeof(RTC)); /* Try loading Kanji alphabet ROM */ - if(Kanji=LoadROM("KANJI.ROM",0x20000,0)) + Kanji=LoadROM("KANJI.ROM",0x20000,0); + if(!Kanji) Kanji=LoadROM("kanji.rom",0x20000,0); + if(Kanji) { if(Verbose) printf("KANJI.ROM.."); } /* Try loading RS232 support ROM */ - if(P=LoadROM("RS232.ROM..",0x4000,0)) + P=LoadROM("RS232.ROM..",0x4000,0); + if(!P) P=LoadROM("rs232.rom..",0x4000,0); + if(P) { if(Verbose) printf("RS232.ROM.."); MemMap[3][0][2]=P; @@ -501,7 +519,9 @@ } /* Try loading FM-PAC support ROM */ - if(P=LoadROM("FMPAC.ROM",0x4000,0)) + P=LoadROM("FMPAC.ROM",0x4000,0); + if(!P) P=LoadROM("rmpac.rom",0x4000,0); + if(P) { if(Verbose) printf("FMPAC.ROM.."); MemMap[3][3][2]=P; @@ -557,8 +577,8 @@ memset(SRAM,NORAM,0x4000); Chunks[CCount++]=SRAM; /* Try loading SRAM data form disk */ - if(!(F=fopen("GMASTER2.RAM","rb"))) { PRINTOK; } - else + if(!(F=fopen("GMASTER2.RAM","rb"))) if(!(F=fopen("gmaster2.ram","rb"))) { PRINTOK; } + if(F) { if(Verbose) printf("loading GMASTER2.RAM..."); if(fread(SRAM,1,0x2000,F)!=0x2000) { PRINTFAILED; } @@ -591,6 +611,8 @@ if(J==2) ROMTypeB=1; else ROMTypeA=1; if(LoadCart("MSXDOS2.ROM",J-1)) SetMegaROM(J-1,0,1,ROMMask[J-1]-1,ROMMask[J-1]); + else if(LoadCart("msxdos2.rom",J-1)) + SetMegaROM(J-1,0,1,ROMMask[J-1]-1,ROMMask[J-1]); } /* Find an empty slot */ @@ -599,7 +621,7 @@ else J=0; /* Try loading PAINTER ROM if slot found */ - if(J) LoadCart("PAINTER.ROM",J-1); + if(J) if(!LoadCart("PAINTER.ROM",J-1)) LoadCart("painter.rom",J-1); } /* We are now back to working directory */ @@ -783,8 +805,8 @@ if(SaveCMOS) { if(Verbose) printf("Writing CMOS.ROM..."); - if(!(F=fopen("CMOS.ROM","wb"))) SaveCMOS=0; - else + if(!(F=fopen("CMOS.ROM","wb"))) if(!(F=fopen("cmos.rom","wb"))) SaveCMOS=0; + if(F) { if(fwrite(RTC,1,sizeof(RTC),F)!=sizeof(RTC)) SaveCMOS=0; fclose(F); @@ -796,8 +818,8 @@ if(SaveSRAM) { if(Verbose) printf("Writing GMASTER.RAM..."); - if(!(F=fopen("GMASTER2.RAM","wb"))) SaveSRAM=0; - else + if(!(F=fopen("GMASTER2.RAM","wb"))) if(!(F=fopen("gmaster2.ram","wb"))) SaveSRAM=0; + if(F) { if(fwrite(SRAM,1,0x1000,F)!=0x1000) SaveSRAM=0; if(fwrite(SRAM+0x2000,1,0x1000,F)!=0x1000) SaveSRAM=0; @@ -2089,7 +2111,14 @@ /* Autofire emulation */ ACount=(ACount+1)&0x07; +#ifndef ZAURUS if((ACount>3)&&AutoFire) KeyMap[8]|=0x01; +#else + if(AutoFire){ + if(ACount>3){ KeyMap[8]|=0x01; JoyState&=0xEF; } + else if(JoyAuto) JoyState|=0x10; + } +#endif } /* Return whatever interrupt is pending */ @@ -2452,6 +2481,7 @@ { #ifdef NARROW WIDTH=320;HEIGHT=240; + F_WIDTH=320;F_HEIGHT=240; RefreshLine[0]=RefreshLine0; RefreshLine[1]=RefreshLine1; RefreshLine[2]=RefreshLine2; diff -urN MSX.org/MSX.h MSX/MSX.h --- MSX.org/MSX.h Mon May 23 09:10:43 2005 +++ MSX/MSX.h Thu Jun 23 10:29:00 2005 @@ -133,6 +133,13 @@ extern int UseFilter; /* Filter mode */ extern int WIDTH; /* width of window */ extern int HEIGHT; /* height of window */ +#ifdef ZAURUS +extern int F_WIDTH; /* width of window */ +extern int F_HEIGHT; /* height of window */ +extern byte Crop; +extern byte Direct; +extern byte KeyMode; +#endif /* ZAURUS */ #endif /** StartMSX() ***********************************************/ @@ -259,6 +266,11 @@ /** Set tape filepointer to beginning of file. **/ /*************************************************************/ void RewindTape(); +#endif + +#ifdef ZAURUS +void SetCommandKeys(); +void SetNormalKeys(); #endif #endif /* MSX_H */ diff -urN MSX.org/Makefile MSX/Makefile --- MSX.org/Makefile Mon May 23 09:10:43 2005 +++ MSX/Makefile Wed Jun 29 08:48:10 2005 @@ -45,6 +45,8 @@ # EMU8950 - Define this if you wish to include MSX-AUDIO emulation (SDL). # FULLSCREEN- Define this if you wish to have full screen support (SDL). +# ZAURUS - Zaurus + # These are the compiler name, #defines, and the flags used to # build fMSX. Always set flags for the highest possible speed # optimization. For GCC compiler, it will be @@ -57,16 +59,18 @@ # If you are getting linker errors about not found X11 functions, # change the -L/usr/X11R6/lib to the directory where X11 # libraries libX11.* and libXext.* are located on your system. -CC = gcc -DEFINES = -DFMSX -DUNIX -DLSB_FIRST -DDEBUG -DMITSHM \ - -DDISK -DNARROW -DSOUND -DBPP16 -DZLIB -DSDL -CFLAGS = -O3 -Wall -I/usr/include/SDL -L/usr/local/lib ${DEFINES} +CC = arm-linux-gcc +DEFINES = -DFMSX -DUNIX -DLSB_FIRST \ + -DDISK -DNARROW -DSOUND -DSDL \ + -DEMU2413 -DEMU8950 -DZAURUS +CFLAGS = -O3 -mcpu=xscale -mtune=xscale -funroll-loops -fomit-frame-pointer -Wall ${DEFINES} `${SDLCONFIG} --cflags` OBJECTS = fMSX.o MSX.o Patch.o Debug.o Disk.o Sound.o \ Z80.o I8255.o AY8910.o YM2413.o SCC.o V9938.o I8251.o \ Unix.o LibUnix.o SndUnix.o \ SDLgfx.o SDLsnd.o SDLfilter.o \ device/emu2413.o device/emu2212.o device/emu2149.o \ msxaudio/fmopl.o msxaudio/ymdeltat.o +SDLCONFIG = /opt/Embedix/local/arm-linux/bin/sdl-config # Make the standard distribution: fMSX and contributed utilities. all: fmsx contrib @@ -80,11 +84,11 @@ # fMSX Unix/X requires X11 libraries. See note above if you are # experiencing any problems. fmsx: ${OBJECTS} - ${CC} ${CFLAGS} -o fmsx ${OBJECTS} -lz `sdl-config --cflags --libs` + ${CC} ${CFLAGS} -o fmsx ${OBJECTS} `${SDLCONFIG} --cflags --libs` # Clean up. clean: - rm -f *.o fmsx rddsk wrdsk + rm -f *.o device/*.o msxaudio/*.o fmsx rddsk wrdsk # Dependencies for the object files. fMSX.o: fMSX.c MSX.h Z80.h Help.h diff -urN MSX.org/SDLfilter.h MSX/SDLfilter.h --- MSX.org/SDLfilter.h Mon May 23 09:10:43 2005 +++ MSX/SDLfilter.h Sat Jun 11 01:21:58 2005 @@ -1,7 +1,7 @@ #ifdef SDL #ifndef FILTER_H -#include +#include "SDL.h" #ifndef pixel typedef Uint16 pixel; diff -urN MSX.org/SDLgfx.c MSX/SDLgfx.c --- MSX.org/SDLgfx.c Mon May 23 09:10:43 2005 +++ MSX/SDLgfx.c Mon Jul 18 07:32:30 2005 @@ -30,12 +30,12 @@ #endif /** SDL #includes ********************************************/ -#include +#include "SDL.h" /** Public parameters ****************************************/ -char *Title="fMSX SDL 2.5"; /* Window/command line title */ -int UseSound = 22000; /* Sound driver frequency */ -int SyncFreq = 50; /* Screen update freq. in Hz */ +char *Title="fMSX SDL 2.7"; /* Window/command line title */ +int UseSound = 44100; /* Sound driver frequency */ +int SyncFreq = 60; /* Screen update freq. in Hz */ char *Disks[2][MAXDISKS+1]; /* Disk names for each drive */ int UseFilter = 0; @@ -46,20 +46,28 @@ int WIDTH = 640; int HEIGHT = 480; +#ifdef ZAURUS +int F_WIDTH = 512; +int F_HEIGHT = 424; +byte Crop = 0; +int CropX, CropY; +byte Direct = 0; +byte KeyMode = 0; +#endif #ifdef FULLSCREEN #define SDL_INIT SDL_INIT_VIDEO | SDL_INIT_TIMER #define SDL_VIDEOMODE SDL_SWSURFACE | SDL_FULLSCREEN #else #define SDL_INIT SDL_INIT_VIDEO | SDL_INIT_TIMER -#define SDL_VIDEOMODE SDL_SWSURFACE +#define SDL_VIDEOMODE SDL_HWSURFACE #endif /** Various variables ****************************************/ static unsigned long prev_ticks=0; static unsigned int BPal[256],XPal[80],XPal0; -static byte JoyState; +byte JoyState; static byte XKeyMap[16]; static int CurDisk[2]; static pixel *XBuf; @@ -67,6 +75,11 @@ int UseStatic = 0; int UseZoom = 0; int SaveCPU = 0; +#ifdef ZAURUS +byte MsxCtrl = 0; +byte Graph = 0; +byte JoyAuto = 0; +#endif /** On-screen message related variables **********************/ static char *Message; /* message to show */ @@ -74,7 +87,10 @@ /** Various SDL related variables ****************************/ SDL_Surface *screen; - +#ifdef ZAURUS +SDL_Surface *display; +SDL_Rect DspRect; +#endif /** These functions are called on signals ********************/ #ifdef UNIX @@ -89,13 +105,13 @@ {0,0x00},{0,0x00},{0,0x00},{0,0x00},{0,0x00},{0,0x00},{0,0x00},{0,0x00},/* 0010 */ {0,0x00},{0,0x00},{0,0x00},{7,0x04},{0,0x00},{0,0x00},{0,0x00},{0,0x00},/* 0018 */ {8,0x01},{0,0x00},{0,0x00},{0,0x00},{0,0x00},{0,0x00},{0,0x00},{2,0x01},/* 0020 */ - {0,0x00},{0,0x00},{0,0x00},{0,0x00},{2,0x04},{1,0x04},{2,0x08},{2,0x10},/* 0028 */ + {0,0x00},{0,0x00},{2,0x01},{1,0x80},{2,0x04},{1,0x04},{2,0x08},{2,0x10},/* 0028 */ {0,0x01},{0,0x02},{0,0x04},{0,0x08},{0,0x10},{0,0x20},{0,0x40},{0,0x80},/* 0030 */ - {1,0x01},{1,0x02},{0,0x00},{1,0x80},{0,0x00},{1,0x08},{0,0x00},{0,0x00},/* 0038 */ - {0,0x00},{0,0x00},{0,0x00},{0,0x00},{0,0x00},{0,0x00},{0,0x00},{0,0x00},/* 0040 */ + {1,0x01},{1,0x02},{2,0x01},{1,0x80},{2,0x04},{1,0x04},{2,0x08},{2,0x10},/* 0038 */ + {1,0x20},{0,0x00},{0,0x00},{0,0x00},{0,0x00},{0,0x00},{0,0x00},{0,0x00},/* 0040 */ {0,0x00},{0,0x00},{0,0x00},{0,0x00},{0,0x00},{0,0x00},{0,0x00},{0,0x00},/* 0048 */ {0,0x00},{8,0x10},{8,0x20},{8,0x80},{8,0x40},{0,0x00},{0,0x00},{0,0x00},/* 0050 */ - {0,0x00},{0,0x00},{0,0x00},{1,0x20},{1,0x10},{1,0x40},{0,0x00},{0,0x00},/* 0058 */ + {0,0x00},{0,0x00},{0,0x00},{1,0x40},{1,0x10},{2,0x02},{1,0x08},{2,0x20},/* 0058 */ {2,0x02},{2,0x40},{2,0x80},{3,0x01},{3,0x02},{3,0x04},{3,0x08},{3,0x10},/* 0060 */ {3,0x20},{3,0x40},{3,0x80},{4,0x01},{4,0x02},{4,0x04},{4,0x08},{4,0x10},/* 0068 */ {4,0x20},{4,0x40},{4,0x80},{5,0x01},{5,0x02},{5,0x04},{5,0x08},{5,0x10},/* 0070 */ @@ -104,7 +120,7 @@ {0,0x00},{0,0x00},{0,0x00},{0,0x00},{0,0x00},{0,0x00},{0,0x00},{0,0x00},/* 0088 */ {0,0x00},{0,0x00},{0,0x00},{0,0x00},{0,0x00},{0,0x00},{0,0x00},{0,0x00},/* 0090 */ {0,0x00},{0,0x00},{0,0x00},{0,0x00},{0,0x00},{0,0x00},{0,0x00},{0,0x00},/* 0098 */ - {0,0x00},{0,0x00},{0,0x00},{0,0x00},{0,0x00},{0,0x00},{0,0x00},{0,0x00},/* 00A0 */ + {0,0x00},{0,0x00},{6,0x04},{6,0x10},{0,0x00},{6,0x02},{0,0x00},{0,0x00},/* 00A0 */ {0,0x00},{0,0x00},{0,0x00},{0,0x00},{0,0x00},{0,0x00},{0,0x00},{0,0x00},/* 00A8 */ {0,0x00},{0,0x00},{0,0x00},{0,0x00},{0,0x00},{0,0x00},{0,0x00},{0,0x00},/* 00B0 */ {0,0x00},{0,0x00},{0,0x00},{0,0x00},{0,0x00},{0,0x00},{0,0x00},{0,0x00},/* 00B8 */ @@ -121,7 +137,7 @@ {0,0x00},{8,0x20},{8,0x40},{8,0x80},{8,0x10},{8,0x04},{8,0x02},{0,0x00},/* 0110 */ {0,0x00},{0,0x00},{6,0x20},{6,0x40},{6,0x80},{7,0x01},{7,0x02},{0,0x00},/* 0118 */ {7,0x40},{7,0x10},{0,0x00},{0,0x00},{0,0x00},{0,0x00},{0,0x00},{0,0x00},/* 0120 */ - {0,0x00},{0,0x00},{0,0x00},{0,0x00},{0,0x00},{0,0x00},{0,0x00},{6,0x01},/* 0128 */ + {0,0x00},{0,0x00},{0,0x00},{0,0x00},{0,0x00},{6,0x08},{0,0x00},{6,0x01},/* 0128 */ {6,0x01},{2,0x20},{6,0x02},{6,0x10},{6,0x04},{0,0x00},{0,0x00},{0,0x00},/* 0130 */ {0,0x00},{0,0x00},{0,0x00},{0,0x00},{0,0x00},{0,0x00},{0,0x00},{0,0x00},/* 0138 */ {0,0x00},{0,0x00},{0,0x00},{0,0x00},{0,0x00},{0,0x00},{0,0x00},{0,0x00},/* 0140 */ @@ -138,6 +154,20 @@ unsigned int delta; delta = UPeriod*(1000/SyncFreq); + +#ifdef ZAURUS +#include +#include +#include + + ticks = SDL_GetTicks(); + if((prev_ticks + delta) > ticks){ + struct timeval tv; + tv.tv_sec = 0; + tv.tv_usec = (prev_ticks + delta - ticks) * 1000; + select( 0, NULL, NULL, NULL, &tv ); + } +#endif /* wait until delta miliseconds elapsed */ do ticks = SDL_GetTicks(); @@ -171,16 +201,43 @@ /* Open the display */ if(Verbose) printf("OK\n Opening display..."); +#ifndef ZAURUS if ((screen=SDL_SetVideoMode(WIDTH,HEIGHT,16,SDL_VIDEOMODE))==NULL) { if(Verbose) puts("FAILED"); return(0); } +#else + if(Direct){ + if ((screen=SDL_SetVideoMode(WIDTH,HEIGHT,16,SDL_VIDEOMODE))==NULL) { + if(Verbose) puts("FAILED"); + return(0); + } + }else{ + if ((display=SDL_SetVideoMode(WIDTH,HEIGHT,16,SDL_VIDEOMODE))==NULL) { + if(Verbose) puts("FAILED"); + return(0); + } + screen = SDL_CreateRGBSurface(SDL_SWSURFACE, WIDTH, HEIGHT,16, 0,0,0,0); + } + CropX = (WIDTH-F_WIDTH)>>1; + CropY = (HEIGHT-F_HEIGHT)>>1; + if(Crop && WIDTH==640){ + DspRect.x=CropX; DspRect.y=CropY; DspRect.w=F_WIDTH; DspRect.h=F_HEIGHT; + }else{ + DspRect.x=0; DspRect.y=0; DspRect.w=WIDTH; DspRect.h=HEIGHT; + } +#endif + /* Hide mouse cursor */ SDL_ShowCursor(0); /* Init image buffer */ +#ifndef ZAURUS XBuf=malloc(WIDTH*HEIGHT*sizeof(pixel)); +#else + XBuf = (pixel *)screen->pixels; +#endif memset(XBuf,0,WIDTH*HEIGHT*sizeof(pixel)); /* Reset the palette */ @@ -198,7 +255,7 @@ #ifdef SOUND /* Initialize sound */ InitSound(UseSound,Verbose); -#endif SOUND +#endif /* SOUND */ #ifdef UNIX /* Catch all signals */ @@ -206,6 +263,10 @@ signal(SIGQUIT,OnBreak);signal(SIGTERM,OnBreak); #endif +#ifdef ZAURUS + if(KeyMode) SetCommandKeys(); +#endif + /* clear on-screen message */ Message = NULL; MessageTimer = 0; @@ -221,11 +282,13 @@ if(Verbose) printf("Shutting down...\n"); /* Delete graphic buffer */ +#ifndef ZAURUS free(XBuf); +#endif #ifdef SOUND TrashSound(); -#endif SOUND +#endif /* SOUND */ } @@ -320,8 +383,10 @@ break; } +#ifndef ZAURUS /* Copy image */ memcpy(screen->pixels,XBuf,WIDTH*HEIGHT*sizeof(pixel)); +#endif /* Handle on-screen message */ if (Message != NULL) { @@ -332,6 +397,7 @@ free(Message); Message = NULL; MessageTimer = 0; + if(WIDTH==640 && !UseFilter) full_scanline(screen, &XBuf); } } @@ -342,7 +408,16 @@ if (SDL_MUSTLOCK(screen)) SDL_UnlockSurface(screen); /* Update screen */ +#ifndef ZAURUS SDL_UpdateRect(screen,0,0,0,0); +#else + if(Direct){ + SDL_UpdateRect(screen,0,0,0,0); + }else{ + SDL_BlitSurface (screen, &DspRect, display, &DspRect); + SDL_UpdateRect(display,DspRect.x,DspRect.y,DspRect.w,DspRect.h); + } +#endif /* Set timer frequency */ SyncFreq=PALVideo? 50:60; @@ -368,6 +443,9 @@ SDL_Event event; static byte Control=0; +#ifdef ZAURUS + static byte Shift=0; +#endif int key,I; /* Check for keypresses/keyreleases */ @@ -384,7 +462,7 @@ switch(key) { - +#ifndef ZAURUS /******************************/ /* F6: SWITCH AUTOFIRE ON/OFF */ /******************************/ @@ -424,7 +502,7 @@ NewMessage(strdup(StateNotification)); } break; - +#endif /* ZAURUS */ /******************************/ /* END: SWITCH IMAGE FILTER */ @@ -450,7 +528,7 @@ } break; - +#ifndef ZAURUS /**************************/ /* CTRL+F10: SWITCH DISKA */ /* CTRL+F11: SWITCH DISKB */ @@ -473,6 +551,7 @@ } } break; +#endif /* ZAURUS */ /**********************/ @@ -494,13 +573,161 @@ /* CTRL+SCROLL: HARD RESET */ /***************************/ +#ifndef ZAURUS case SDLK_SCROLLOCK: if(Control) ResetMSX(1); else ResetMSX(0); break; +#endif /* ZAURUS */ + +#ifdef ZAURUS + + case SDLK_F11: + case 124: /* Fn + L */ + KeyMode=!KeyMode; + if(KeyMode){ + SetCommandKeys(); + NewMessage(strdup("\n Command Mode \n\n")); + } + else + { + SetNormalKeys(); + NewMessage(strdup("\n Key Mode \n\n")); + } + break; + + case SDLK_LSHIFT: + Shift=1; break; + + case SDLK_BACKSPACE: + if(Shift){ + Keys[SDLK_BACKSPACE][1]=0x00; + XKeyMap[Keys[SDLK_INSERT][0]]&=~Keys[SDLK_INSERT][1]; + } + break; + + case SDLK_WORLD_5: /* Fn + D */ + MsxCtrl=!MsxCtrl; + if(MsxCtrl) NewMessage(strdup("\n Ctrl On \n\n")); + else NewMessage(strdup("\n Ctrl Off \n\n")); + break; + + case SDLK_WORLD_2: /* Fn + U */ + Graph=!Graph; + if(Graph) NewMessage(strdup("\n GRAPH On \n\n")); + else NewMessage(strdup("\n GRAPH Off \n\n")); + break; + case SDLK_WORLD_3: /* Fn + I */ + NewMessage(strdup("\n KANA \n\n")); + break; + + case SDLK_9: + if(KeyMode && Shift) ResetMSX(0); + break; + + case SDLK_0: + if(KeyMode && Shift) ResetMSX(1); + break; + + case SDLK_q: + if(KeyMode) NewMessage(strdup("\n SELECT \n\n")); + break; + + case SDLK_w: + if(KeyMode) NewMessage(strdup("\n STOP \n\n")); + break; + + case SDLK_HOME: + case SDLK_a: + if(key==SDLK_HOME || KeyMode){ + AutoFire=!AutoFire; + if(AutoFire) NewMessage(strdup("\n Autofire On \n\n")); + else NewMessage(strdup("\n Autofire Off \n\n")); + } + break; + + case SDLK_m: + if(KeyMode){ + if(Disks[0][0]) { + char DiskNotification[512]; + CurDisk[0]=(CurDisk[0]+1)%MAXDISKS; + if(!Disks[0][CurDisk[0]]) CurDisk[0]=0; + ChangeDisk(0,Disks[0][CurDisk[0]]); + /* notify user */ + sprintf(DiskNotification, + "\n Disk %c: %s \n\n", + 'A',Disks[0][CurDisk[0]]); + NewMessage(strdup(DiskNotification)); + } + } + break; + + case SDLK_n: + if(KeyMode){ + if(Disks[1][0]) { + char DiskNotification[512]; + CurDisk[1]=(CurDisk[1]+1)%MAXDISKS; + if(!Disks[1][CurDisk[1]]) CurDisk[1]=0; + ChangeDisk(1,Disks[1][CurDisk[1]]); + /* notify user */ + sprintf(DiskNotification, + "\n Disk %c: %s \n\n", + 'B',Disks[1][CurDisk[1]]); + NewMessage(strdup(DiskNotification)); + } + } + break; + + case SDLK_PAGEDOWN: /* Fn + DOWN */ + case SDLK_s: + if(key==SDLK_PAGEDOWN || KeyMode){ + if(StateName) { + char StateNotification[512]; + sprintf(StateNotification,"\n State %s %s \n\n", + StateName,"saved"); + SaveState(StateName); + NewMessage(strdup(StateNotification)); + } + } + break; + + case SDLK_PAGEUP: /* Fn + UP */ + case SDLK_d: + if(key==SDLK_PAGEUP || KeyMode){ + if(StateName) { + char StateNotification[512]; + sprintf(StateNotification,"\n State %s %s \n\n", + StateName,"loaded"); + LoadState(StateName); + NewMessage(strdup(StateNotification)); + } + } + break; + + case SDLK_t: + if(KeyMode) { + RewindTape(); + NewMessage(strdup("\n Tape Rewound \n\n")); + } + break; + + /* Shift On */ + case SDLK_ASTERISK: + case SDLK_PLUS: + case SDLK_LESS: + case SDLK_EQUALS: + case SDLK_GREATER: + case SDLK_UNDERSCORE: + XKeyMap[Keys[SDLK_LSHIFT][0]]&=~Keys[SDLK_LSHIFT][1]; break; + + /* Shift Release */ + case SDLK_SLASH: + XKeyMap[Keys[SDLK_LSHIFT][0]]|=Keys[SDLK_LSHIFT][1]; break; + +#endif /* ZAURUS */ /********************************/ /* CURSOR KEYS: CURSOR MOVEMENT */ @@ -510,11 +737,17 @@ case SDLK_DOWN: JoyState|=0x02;break; case SDLK_LEFT: JoyState|=0x04;break; case SDLK_RIGHT: JoyState|=0x08;break; +#ifndef ZAURUS case SDLK_LALT: JoyState|=0x10;break; case SDLK_LCTRL: if(key==SDLK_LCTRL) JoyState|=0x20; Control=1; break; +#else + case SDLK_x: JoyState|=0x10; JoyAuto=1;break; + case SDLK_z: JoyState|=0x20;break; + case SDLK_LCTRL:Control=1;break; +#endif /* ZAURUS */ } /***********************************/ @@ -523,6 +756,11 @@ if(key<0x150) XKeyMap[Keys[key][0]]&=~Keys[key][1]; +#ifdef ZAURUS + if(MsxCtrl) XKeyMap[Keys[SDLK_WORLD_5][0]]&=~Keys[SDLK_WORLD_5][1]; + if(Graph) XKeyMap[Keys[SDLK_LALT][0]]&=~Keys[SDLK_LALT][1]; + if(Shift) Keys[SDLK_BACKSPACE][1]=0x20; +#endif /* ZAURUS */ } /****************/ @@ -538,12 +776,38 @@ case SDLK_DOWN: JoyState&=0xFD;break; case SDLK_LEFT: JoyState&=0xFB;break; case SDLK_RIGHT: JoyState&=0xF7;break; +#ifndef ZAURUS case SDLK_LALT: JoyState&=0xEF;break; case SDLK_LCTRL: JoyState&=0xDF;Control=0;break; + +#else + case SDLK_x: JoyState&=0xEF; JoyAuto=0;break; + case SDLK_z: JoyState&=0xDF;break; + case SDLK_LCTRL: Control=0;break; + case SDLK_LSHIFT: Shift=0; break; + + case SDLK_BACKSPACE: + XKeyMap[Keys[SDLK_INSERT][0]]|=Keys[SDLK_INSERT][1]; + break; + + case SDLK_ASTERISK: + case SDLK_PLUS: + case SDLK_LESS: + case SDLK_EQUALS: + case SDLK_GREATER: + case SDLK_UNDERSCORE: + XKeyMap[Keys[SDLK_LSHIFT][0]]|=Keys[SDLK_LSHIFT][1]; break; +#endif /* ZAURUS */ + } /* Key released: set bit in KeyMap */ if(key<0x150) XKeyMap[Keys[key][0]]|=Keys[key][1]; + +#ifdef ZAURUS + if(!MsxCtrl) XKeyMap[Keys[SDLK_WORLD_5][0]]|=Keys[SDLK_WORLD_5][1]; + if(!Graph) XKeyMap[Keys[SDLK_LALT][0]]|=Keys[SDLK_LALT][1]; +#endif /* ZAURUS */ } } @@ -582,5 +846,55 @@ #include "Common.h" #endif #include "Hires.h" + +#ifdef ZAURUS +void SetCommandKeys(void) +{ + Keys[SDLK_1][0]=6;Keys[SDLK_1][1]=0x20; + Keys[SDLK_2][0]=6;Keys[SDLK_2][1]=0x40; + Keys[SDLK_3][0]=6;Keys[SDLK_3][1]=0x80; + Keys[SDLK_4][0]=7;Keys[SDLK_4][1]=0x01; + Keys[SDLK_5][0]=7;Keys[SDLK_5][1]=0x02; + + Keys[SDLK_q][0]=7;Keys[SDLK_q][1]=0x40; + Keys[SDLK_w][0]=7;Keys[SDLK_w][1]=0x10; + + Keys[SDLK_c][0]=6;Keys[SDLK_c][1]=0x02; + Keys[SDLK_g][0]=6;Keys[SDLK_g][1]=0x04; + Keys[SDLK_k][0]=6;Keys[SDLK_k][1]=0x10; + + Keys[SDLK_a][1]=0x00; + Keys[SDLK_d][1]=0x00; + Keys[SDLK_m][1]=0x00; + Keys[SDLK_n][1]=0x00; + Keys[SDLK_o][1]=0x00; + Keys[SDLK_s][1]=0x00; + Keys[SDLK_t][1]=0x00; +} + +void SetNormalKeys(void) +{ + Keys[SDLK_1][0]=0;Keys[SDLK_1][1]=0x02; + Keys[SDLK_2][0]=0;Keys[SDLK_2][1]=0x04; + Keys[SDLK_3][0]=0;Keys[SDLK_3][1]=0x08; + Keys[SDLK_4][0]=0;Keys[SDLK_4][1]=0x10; + Keys[SDLK_5][0]=0;Keys[SDLK_5][1]=0x20; + + Keys[SDLK_q][0]=4;Keys[SDLK_q][1]=0x40; + Keys[SDLK_w][0]=5;Keys[SDLK_w][1]=0x10; + + Keys[SDLK_c][0]=3;Keys[SDLK_c][1]=0x01; + Keys[SDLK_g][0]=3;Keys[SDLK_g][1]=0x10; + Keys[SDLK_k][0]=4;Keys[SDLK_k][1]=0x01; + + Keys[SDLK_a][1]=0x40; + Keys[SDLK_d][1]=0x02; + Keys[SDLK_m][1]=0x04; + Keys[SDLK_n][1]=0x08; + Keys[SDLK_o][1]=0x10; + Keys[SDLK_s][1]=0x01; + Keys[SDLK_t][1]=0x02; +} +#endif #endif /* SDL */ diff -urN MSX.org/SDLsnd.c MSX/SDLsnd.c --- MSX.org/SDLsnd.c Mon May 23 09:10:43 2005 +++ MSX/SDLsnd.c Fri Jun 24 12:44:34 2005 @@ -61,12 +61,21 @@ S=SCC_calc(scc); O=Use2413? OPLL_calc(opll): 0; A=Use8950? Y8950UpdateOne(fm_opl): 0; +#ifndef ZAURUS if (UseStereo) { R1=P*FactorPSG+A*Factor8950+S*FactorSCC; R2=O*Factor2413+S*FactorSCC; } else { R1=R2=P*FactorPSG+O*Factor2413+A*Factor8950+S*FactorSCC; } +#else + if (UseStereo) { + R1=P+A/4+S; + R2=O+S; + } else { + R1=R2=P+O+A/4+S; + } +#endif stream[J+0]=R2&0x00FF; stream[J+1]=R2>>8; stream[J+2]=R1&0x00FF; Binary files MSX.org/device/emu2149.o and MSX/device/emu2149.o differ Binary files MSX.org/device/emu2212.o and MSX/device/emu2212.o differ Binary files MSX.org/device/emu2413.o and MSX/device/emu2413.o differ diff -urN MSX.org/fMSX.c MSX/fMSX.c --- MSX.org/fMSX.c Mon May 23 09:10:43 2005 +++ MSX/fMSX.c Wed Jun 29 08:48:13 2005 @@ -37,6 +37,9 @@ #ifdef SDL "msxmusic","msxaudio","buffer","lowres","filter","stereo", #endif +#ifdef ZAURUS + "rate","crop","direct","com", +#endif 0 }; @@ -92,6 +95,10 @@ #endif #endif +#ifdef ZAURUS + Verbose=0; +#endif + /* Clear everything */ CartCount=TypeCount=JoyCount=0; DiskCount[0]=DiskCount[1]=0; @@ -140,6 +147,7 @@ if((J>=256)&&(J<=999)) VPeriod=HPeriod*J; } break; +#endif case 3: N++; if(N>=argc) printf("%s: No screen update period supplied\n",argv[0]); @@ -149,6 +157,7 @@ if((J>=1)&&(J<=20)) UPeriod=J; } break; +#ifndef SDL case 4: VPeriod=VPERIOD_PAL/6; HPeriod=HPERIOD/6; break; @@ -232,7 +241,6 @@ case 20: MSXVersion=0;break; case 21: MSXVersion=1;break; case 22: MSXVersion=2;break; -#ifndef SDL case 23: N++; if(N>=argc) printf("%s: No joystick type supplied\n",argv[0]); @@ -244,6 +252,7 @@ default: printf("%s: Excessive -joy option\n",argv[0]); } break; +#ifndef SDL case 24: N++; if(N>=argc) printf("%s: No home directory name supplied\n",argv[0]); @@ -318,6 +327,15 @@ break; case 45: UseStereo=1;break; #endif /* SDL */ +#ifdef ZAURUS + case 46: N++; + if(N