From 9e1b19d04e5020bfbfe2edfbc701543c8fa53e40 Mon Sep 17 00:00:00 2001 From: notaz Date: Sat, 7 Apr 2007 22:44:49 +0000 Subject: [PATCH] more cleanups git-svn-id: file:///home/notaz/opt/svn/fceu@95 be3aeb3a-fb24-0410-a615-afba39da0efa --- Makefile.gp2x | 7 +- drivers/pc/input.c | 2 - drivers/pc/keyscan.h | 167 ------------- drivers/pc/sdl-joystick.c | 213 ---------------- drivers/pc/sdl-netplay.c | 163 ------------- drivers/pc/sdl-netplay.h | 5 - drivers/pc/sdl.c | 70 +----- drivers/pc/sdl.h | 3 - drivers/pc/svga-video.c | 497 -------------------------------------- drivers/pc/svga-video.h | 32 --- drivers/pc/svgalib.c | 179 -------------- drivers/pc/svgalib.h | 2 - drivers/pc/vgatweak.c | 168 ------------- 13 files changed, 10 insertions(+), 1498 deletions(-) delete mode 100644 drivers/pc/keyscan.h delete mode 100644 drivers/pc/sdl-joystick.c delete mode 100644 drivers/pc/sdl-netplay.c delete mode 100644 drivers/pc/sdl-netplay.h delete mode 100644 drivers/pc/svga-video.c delete mode 100644 drivers/pc/svga-video.h delete mode 100644 drivers/pc/svgalib.c delete mode 100644 drivers/pc/svgalib.h delete mode 100644 drivers/pc/vgatweak.c diff --git a/Makefile.gp2x b/Makefile.gp2x index 9d5d47b..be2070a 100644 --- a/Makefile.gp2x +++ b/Makefile.gp2x @@ -16,19 +16,18 @@ gpfce: fceu include zlib/Makefile -OBJDRIVER = ${B}minimal.o ${B}sdl.o ${B}main.o ${B}throttle.o ${B}unix-netplay.o ${B}sdl-sound.o ${B}sdl-video.o ${B}sdl-joystick.o drivers/common/cheat.o drivers/common/config.o drivers/common/args.o drivers/common/vidblit.o ${UNZIPOBJS} ppu.o +OBJDRIVER = ${B}minimal.o ${B}sdl.o ${B}main.o ${B}throttle.o ${B}unix-netplay.o ${B}sdl-sound.o ${B}sdl-video.o ${B}lnx-joystick.o drivers/common/cheat.o drivers/common/config.o drivers/common/args.o drivers/common/vidblit.o ${UNZIPOBJS} ppu.o LDRIVER = -L /mnt/sd/lib -L/mnt/sd/gp2x/usr/lib -lm -lpthread -lz -static # `arm-linux-sdl-config --libs` include Makefile.base -${B}sdl-joystick.o: ${B}sdl-joystick.c -${B}main.o: ${B}main.c ${B}main.h ${B}usage.h ${B}input.c ${B}keyscan.h +${B}lnx-joystick.o: ${B}lnx-joystick.c +${B}main.o: ${B}main.c ${B}main.h ${B}usage.h ${B}input.c ${B}sdl.o: ${B}sdl.c ${B}sdl.h ${B}sdl-video.o: ${B}sdl-video.c ${B}sdl-video.o: ${B}minimal.c ${B}sdl-sound.o: ${B}sdl-sound.c -#${B}sdl-netplay.o: ${B}sdl-netplay.c ${B}unix-netplay.o: ${B}unix-netplay.c ${B}throttle.o: ${B}throttle.c ${B}main.h ${B}throttle.h ppu.o: ppu.c ppu.h diff --git a/drivers/pc/input.c b/drivers/pc/input.c index 608404b..8936ec0 100644 --- a/drivers/pc/input.c +++ b/drivers/pc/input.c @@ -50,8 +50,6 @@ static int InputTypeFC; static uint32 JSreturn; int NoWaiting=0; -#include "keyscan.h" - static int powerpadsc[2][12]; static int powerpadside=0; diff --git a/drivers/pc/keyscan.h b/drivers/pc/keyscan.h deleted file mode 100644 index 4dc73de..0000000 --- a/drivers/pc/keyscan.h +++ /dev/null @@ -1,167 +0,0 @@ -#ifdef SVGALIB -#include -#define SCANCODE_DELETE SCANCODE_REMOVE -#define SCANCODE_KP_MINUS SCANCODE_KEYPADMINUS -#define SCANCODE_KP_PLUS SCANCODE_KEYPADPLUS -#define MK(k) SCANCODE_##k -#define MK_COUNT 256 -#elif SDL -#ifndef GP2X -#include -#define SDLK_A SDLK_a -#define SDLK_B SDLK_b -#define SDLK_C SDLK_c -#define SDLK_D SDLK_d -#define SDLK_E SDLK_e -#define SDLK_F SDLK_f -#define SDLK_G SDLK_g -#define SDLK_H SDLK_h -#define SDLK_I SDLK_i -#define SDLK_J SDLK_j -#define SDLK_K SDLK_k -#define SDLK_L SDLK_l -#define SDLK_M SDLK_m -#define SDLK_N SDLK_n -#define SDLK_O SDLK_o -#define SDLK_P SDLK_p -#define SDLK_Q SDLK_q -#define SDLK_R SDLK_r -#define SDLK_S SDLK_s -#define SDLK_T SDLK_t -#define SDLK_U SDLK_u -#define SDLK_V SDLK_v -#define SDLK_W SDLK_w -#define SDLK_X SDLK_x -#define SDLK_Y SDLK_y -#define SDLK_Z SDLK_z -#define SDLK_LEFTCONTROL SDLK_LCTRL -#define SDLK_RIGHTCONTROL SDLK_RCTRL -#define SDLK_LEFTALT SDLK_LALT -#define SDLK_RIGHTALT SDLK_RALT -#define SDLK_LEFTSHIFT SDLK_LSHIFT -#define SDLK_RIGHTSHIFT SDLK_RSHIFT -#define SDLK_CURSORDOWN SDLK_DOWN -#define SDLK_CURSORUP SDLK_UP -#define SDLK_CURSORLEFT SDLK_LEFT -#define SDLK_CURSORRIGHT SDLK_RIGHT -#define SDLK_ENTER SDLK_RETURN -#define SDLK_EQUAL SDLK_EQUALS -#define SDLK_APOSTROPHE SDLK_QUOTE -#define SDLK_BRACKET_LEFT SDLK_LEFTBRACKET -#define SDLK_BRACKET_RIGHT SDLK_RIGHTBRACKET -#define SDLK_SCROLLLOCK SDLK_SCROLLOCK /* I guess the SDL people don't like lots of Ls... */ -#define SDLK_GRAVE SDLK_BACKQUOTE -#define MK(k) SDLK_##k -#define MK_COUNT (SDLK_LAST+1) -#elif DOS - -#define SCAN_GRAVE 0x29 -#define SCAN_1 0x02 -#define SCAN_2 0x03 -#define SCAN_3 0x04 -#define SCAN_4 0x05 -#define SCAN_5 0x06 -#define SCAN_6 0x07 -#define SCAN_7 0x08 -#define SCAN_8 0x09 -#define SCAN_9 0x0A -#define SCAN_0 0x0B -#define SCAN_MINUS 0x0C -#define SCAN_EQUAL 0x0D -#define SCAN_BACKSLASH 0x2B -#define SCAN_BACKSPACE 0x0E -#define SCAN_TAB 0x0F -#define SCAN_Q 0x10 -#define SCAN_W 0x11 -#define SCAN_E 0x12 -#define SCAN_R 0x13 -#define SCAN_T 0x14 -#define SCAN_Y 0x15 -#define SCAN_U 0x16 -#define SCAN_I 0x17 -#define SCAN_O 0x18 -#define SCAN_P 0x19 -#define SCAN_BRACKET_LEFT 0x1A -#define SCAN_BRACKET_RIGHT 0x1B -#define SCAN_LOWBACKSLASH 0x2B -#define SCAN_CAPSLOCK 0x3A -#define SCAN_A 0x1E -#define SCAN_S 0x1F -#define SCAN_D 0x20 -#define SCAN_F 0x21 -#define SCAN_G 0x22 -#define SCAN_H 0x23 -#define SCAN_J 0x24 -#define SCAN_K 0x25 -#define SCAN_L 0x26 -#define SCAN_SEMICOLON 0x27 -#define SCAN_APOSTROPHE 0x28 -#define SCAN_ENTER 0x1C -#define SCAN_LEFTSHIFT 0x2A -#define SCAN_Z 0x2C -#define SCAN_X 0x2D -#define SCAN_C 0x2E -#define SCAN_V 0x2F -#define SCAN_B 0x30 -#define SCAN_N 0x31 -#define SCAN_M 0x32 -#define SCAN_COMMA 0x33 -#define SCAN_PERIOD 0x34 -#define SCAN_SLASH 0x35 -#define SCAN_RIGHTSHIFT 0x36 -#define SCAN_LEFTCONTROL 0x1D -#define SCAN_LEFTALT 0x38 -#define SCAN_SPACE 0x39 - -/* Extended keys. */ -#define SCAN_RIGHTALT (0x38|0x80) -#define SCAN_RIGHTCONTROL (0x1D|0x80) -#define SCAN_BL_INSERT (0x52|0x80) -#define SCAN_BL_DELETE (0x53|0x80) -#define SCAN_BL_CURSORLEFT (0x4B|0x80) -#define SCAN_BL_HOME (0x47|0x80) -#define SCAN_BL_END (0x4F|0x80) -#define SCAN_BL_CURSORUP (0x48|0x80) -#define SCAN_BL_CURSORDOWN (0x50|0x80) -#define SCAN_BL_PAGEUP (0x49|0x80) -#define SCAN_BL_PAGEDOWN (0x51|0x80) -#define SCAN_BL_CURSORRIGHT (0x4D|0x80) - -#define SCAN_SCROLLLOCK 0x46 -/* Keys in the key pad area. */ -#define SCAN_NUMLOCK 0x45 -#define SCAN_HOME 0x47 -#define SCAN_CURSORLEFT 0x4B -#define SCAN_END 0x4F -#define SCAN_SLASH 0x35 -#define SCAN_CURSORUP 0x48 -#define SCAN_CENTER 0x4C -#define SCAN_CURSORDOWN 0x50 -#define SCAN_INSERT 0x52 -#define SCAN_ASTERISK 0x37 -#define SCAN_PAGEUP 0x49 -#define SCAN_CURSORRIGHT 0x4D -#define SCAN_PAGEDOWN 0x51 -#define SCAN_DELETE 0x53 -#define SCAN_KP_MINUS 0x4A -#define SCAN_KP_PLUS 0x4E -#define SCAN_KP_ENTER 0x1C - -#define SCAN_ESCAPE 0x01 -#define SCAN_F1 0x3B -#define SCAN_F2 0x3C -#define SCAN_F3 0x3D -#define SCAN_F4 0x3E -#define SCAN_F5 0x3F -#define SCAN_F6 0x40 -#define SCAN_F7 0x41 -#define SCAN_F8 0x42 -#define SCAN_F9 0x43 -#define SCAN_F10 0x44 -#define SCAN_F11 0x57 -#define SCAN_F12 0x58 -#define MK_COUNT 256 -#define MK(k) SCAN_##k -#endif - -#endif diff --git a/drivers/pc/sdl-joystick.c b/drivers/pc/sdl-joystick.c deleted file mode 100644 index 167c777..0000000 --- a/drivers/pc/sdl-joystick.c +++ /dev/null @@ -1,213 +0,0 @@ -/* FCE Ultra - NES/Famicom Emulator - * - * Copyright notice for this file: - * Copyright (C) 2002 Ben Parnell - * Copyright (C) 2002 Paul Kuliniewicz - * - * 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 - */ - -/* PK: SDL joystick input stuff */ - -#include -#include -#include -#include - -#include "sdl.h" -#ifndef GP2X -static SDL_Joystick *jo[4] = {NULL, NULL, NULL, NULL}; -static void ConfigJoystick (int z); - -#define JOY_A 0x01 -#define JOY_B 0x02 -#define JOY_SELECT 0x04 -#define JOY_START 0x08 -#define JOY_UP 0x10 -#define JOY_DOWN 0x20 -#define JOY_LEFT 0x40 -#define JOY_RIGHT 0x80 -#endif - -/* Gets the current joystick position information. */ -uint32 GetJSOr (void) -{ -#ifndef GP2X - int n; /* joystick index */ - int b; /* button index */ - int *joym; /* pointer to a joystick's button map */ - Sint16 pos; /* axis position */ - uint32 ret = 0; /* return value */ - - for (n = 0; n < 4; n++) - { - if (joy[n] == 0) - continue; - joym = joyBMap[n]; - - /* Axis information. */ - pos = SDL_JoystickGetAxis(jo[n], joyAMap[n][0]); - if (pos <= -16383) - ret |= JOY_LEFT << (n << 3); - else if (pos >= 16363) - ret |= JOY_RIGHT << (n << 3); - pos = SDL_JoystickGetAxis(jo[n], joyAMap[n][1]); - if (pos <= -16383) - ret |= JOY_UP << (n << 3); - else if (pos >= 16383) - ret |= JOY_DOWN << (n << 3); - - /* Button information. */ - for (b = 0; b < 4; b++) - { - if (SDL_JoystickGetButton(jo[n], joym[b])) - ret |= (1 << b) << (n << 3); - } - } - - return ret; -#else - return 0; -#endif -} - -/* Cleanup opened joysticks. */ -void KillJoysticks (void) -{ -#ifndef GP2X - int n; /* joystick index */ - - for (n = 0; n < 4; n++) - { - if (joy[n] != 0) - SDL_JoystickClose(jo[n]); - } - SDL_QuitSubSystem(SDL_INIT_JOYSTICK); - return; -#endif -} - -/* Initialize joysticks. */ -int InitJoysticks (void) -{ -#ifndef GP2X - int n; /* joystick index */ - if(!(joy[0]|joy[1]|joy[2]|joy[3])) - return(0); - SDL_InitSubSystem(SDL_INIT_JOYSTICK); - for (n = 0; n < 4; n++) - { - if (joy[n] == 0) - continue; - - /* Open the joystick under SDL. */ - jo[n] = SDL_JoystickOpen(joy[n] - 1); - if (jo[n] == NULL) - { - printf("Could not open joystick %d: %s.\n", - joy[n] - 1, SDL_GetError()); - joy[n] = 0; - continue; - } - - /* Check for a button map. */ - if (!(joyBMap[n][0] | joyBMap[n][1] | joyBMap[n][2] | - joyBMap[n][3])) - { - ConfigJoystick(n); - } - } - - return (1); -#endif -} - -#define WNOINPUT(); for(;;){uint8 t; if(read(fileno(stdin),&t,1)==-1) \ - {break;}} - -/* Configure a joystick button. */ -static void BConfig (int n, int b) -{ -#ifndef GP2X - SDL_Event event; /* SDL event structure */ - WNOINPUT(); - while (1) - { - uint8 t; - if (read(fileno(stdin), &t, 1) == -1) - { - if (errno != EAGAIN) - break; - } - else - break; - - if (SDL_PollEvent(&event) && event.type == SDL_JOYBUTTONDOWN) - { - joyBMap[n][b] = event.jbutton.button; - goto endsa; - } - } - - endsa: - WNOINPUT(); - - return; -#endif -} - -/* Joystick button and axis configuration. */ -void ConfigJoystick (int n) -{ -#ifndef GP2X - int sa; /* buffer value */ - char buf[128]; /* input buffer */ - - printf("\n\n Joystick button and axis configuration:\n\n"); - printf(" Select the joystick axes to use for the virtual d-pad.\n"); - printf(" If you do not wish to assign an axis, press Enter to skip\n"); - printf(" that axis.\n"); - printf(" Push the button to map to the virtual joystick.\n"); - printf(" If you do not wish to assign a button, press Enter to skip\n"); - printf(" that button.\n Press enter to continue...\n"); - getchar(); - printf("**** Configuring joystick %d ****\n\n", n + 1); - - printf("** Enter axis to use for the x-axis (default 0).\n"); - fgets(buf, sizeof(buf), stdin); - joyAMap[n][0] = ('0' <= buf[0] && buf[9] <= '9') ? atoi(buf) : 0; - - printf("** Enter axis to use for the y-axis (default 1).\n"); - fgets(buf, sizeof(buf), stdin); - joyAMap[n][1] = ('0' <= buf[0] && buf[9] <= '9') ? atoi(buf) : 1; - - sa = fcntl(fileno(stdin), F_GETFL); - fcntl(fileno(stdin), F_SETFL, O_NONBLOCK); - - printf("** Press button for \"Select\".\n"); - BConfig(n, 2); - - printf("** Press button for \"Start\".\n"); - BConfig(n, 3); - - printf("** Press button for \"B\".\n"); - BConfig(n, 1); - - printf("** Press button for \"A\".\n"); - BConfig(n, 0); - - fcntl(fileno(stdin), F_SETFL, sa); -#endif -} diff --git a/drivers/pc/sdl-netplay.c b/drivers/pc/sdl-netplay.c deleted file mode 100644 index 38a4c81..0000000 --- a/drivers/pc/sdl-netplay.c +++ /dev/null @@ -1,163 +0,0 @@ -/* FCE Ultra - NES/Famicom Emulator - * - * Copyright notice for this file: - * Copyright (C) 2001 LULU - * Copyright (C) 2002 Ben Parnell - * - * 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 "sdl.h" -#include -#include "sdl-netplay.h" - -char *netplayhost=0; - -static int tonowait; - -int Port=0xFCE; -int FDnetplay=0; - - -static SDLNet_SocketSet socketset = NULL; -static TCPsocket tcpsock = NULL, servsock = NULL; - -void cleanup(void) -{ - if (tcpsock != NULL) { - SDLNet_TCP_DelSocket(socketset, tcpsock); - SDLNet_TCP_Close(tcpsock); - tcpsock = NULL; - } - if (servsock != NULL) { - SDLNet_TCP_DelSocket(socketset, servsock); - SDLNet_TCP_Close(servsock); - servsock = NULL; - } - if (socketset != NULL) { - SDLNet_FreeSocketSet(socketset); - socketset = NULL; - } -} - -int FCEUD_NetworkConnect(void) -{ - IPaddress serverIP; - - tonowait=0; - - if (netplay == 2) { - /* client */ - printf("connecting to %s\n", netplayhost); - - SDLNet_ResolveHost(&serverIP, netplayhost, Port); - if (serverIP.host == INADDR_NONE) { - fprintf(stderr, "Couldn't connected to %s\n", netplayhost); - return -1; - } else { - tcpsock = SDLNet_TCP_Open(&serverIP); - if (tcpsock == NULL) { - fprintf(stderr, "Couldn't connected to %s\n", netplayhost); - return -1; - } - } - printf("connected to %s\n", netplayhost); - - socketset = SDLNet_AllocSocketSet(1); - if (socketset == NULL) { - fprintf(stderr, "Couldn't create socket set: %s\n", - SDLNet_GetError()); - return -1; - } - SDLNet_TCP_AddSocket(socketset, tcpsock); - - return 1; - } else { - /* server */ - - SDLNet_ResolveHost(&serverIP, NULL, Port); - printf("Server IP: %x, %d\n", serverIP.host, serverIP.port); - servsock = SDLNet_TCP_Open(&serverIP); - if (servsock == NULL) { - cleanup(); - fprintf(stderr, "Couldn't create server socket: %s\n", - SDLNet_GetError()); - return -1; - } - - socketset = SDLNet_AllocSocketSet(2); - if (socketset == NULL) { - fprintf(stderr, "Couldn't create socket set: %s\n", - SDLNet_GetError()); - return -1; - } - SDLNet_TCP_AddSocket(socketset, servsock); - - if (SDLNet_CheckSockets(socketset, ~0)) { - tcpsock = SDLNet_TCP_Accept(servsock); - if (tcpsock == NULL) { - return -1; - } - SDLNet_TCP_AddSocket(socketset, tcpsock); - - printf("OK, connected\n"); - return 1; - } - } - - return -1; -} - -void FCEUD_NetworkClose(void) -{ - cleanup(); -} - -int FCEUD_NetworkRecvData(uint8 *data, uint32 len, int block) -{ - if(block) - { - if(SDLNet_TCP_Recv(tcpsock, (void *) data, len)!=len) - { - cleanup(); - return(0); - } - switch(SDLNet_CheckSockets(socketset,0)) - { - case -1:return(0); - case 0:NoWaiting&=~2;tonowait=0;break; - default:if(tonowait>=3) - NoWaiting|=2; - else tonowait++; - break; - } - return(1); - } - else - { - int t=SDLNet_CheckSockets(socketset,0); - if(t<0) return(0); - if(!t) return(-1); - return(SDLNet_TCP_Recv(tcpsock, (void *) data, len)==len); - } -} - -/* 0 on failure, 1 on success. This function should always block. */ -int FCEUD_NetworkSendData(uint8 *Value, uint32 len) -{ - if (tcpsock) - return(SDLNet_TCP_Send(tcpsock, (void *) Value, len)==len); - return 0; -} diff --git a/drivers/pc/sdl-netplay.h b/drivers/pc/sdl-netplay.h deleted file mode 100644 index 48769f6..0000000 --- a/drivers/pc/sdl-netplay.h +++ /dev/null @@ -1,5 +0,0 @@ -extern char *netplayhost; -extern int Port; -extern int FDnetplay; -#define netplay FDnetplay - diff --git a/drivers/pc/sdl.c b/drivers/pc/sdl.c index a2bdc69..7826c8c 100644 --- a/drivers/pc/sdl.c +++ b/drivers/pc/sdl.c @@ -14,7 +14,7 @@ int CLImain(int argc, char *argv[]); extern int gp2x_in_sound_thread; extern void pthread_yield(void); extern void SetVideoScaling(int, int, int); - + //#define SOUND_RATE 44100 #define SOUND_RATE 22050 @@ -112,21 +112,13 @@ void GetBaseDirectory(char *BaseDirectory) { char *ol; -#ifdef GP2X ol="/mnt/sd/roms/nes"; -#else - ol=getenv("HOME"); -#endif BaseDirectory[0]=0; if(ol) { strncpy(BaseDirectory,ol,2047); BaseDirectory[2047]=0; -#ifdef GP2X strcat(BaseDirectory,"/fceultra"); -#else - strcat(BaseDirectory,"/.fceultra"); -#endif } } @@ -175,7 +167,7 @@ void DoDriverArgs(void) #endif for(x=0;x<4;x++) - if(!joy[x]) + if(!joy[x]) { memset(joyBMap[x],0,sizeof(joyBMap[0])); memset(joyAMap[x],0,sizeof(joyAMap[0])); @@ -188,20 +180,6 @@ int InitMouse(void) void KillMouse(void){} void GetMouseData(uint32 *d) { -#ifndef GP2X - int x,y; - uint32 t; - - t=SDL_GetMouseState(&x,&y); - d[2]=0; - if(t&SDL_BUTTON(1)) - d[2]|=1; - if(t&SDL_BUTTON(3)) - d[2]|=2; - t=PtoV(x,y); - d[0]=t&0xFFFF; - d[1]=(t>>16)&0xFFFF; -#endif } int InitKeyboard(void) @@ -221,13 +199,9 @@ void KillKeyboard(void) char *GetKeyboard(void) { -#ifndef GP2X - SDL_PumpEvents(); - return (char *)(SDL_GetKeyState(0)); -#else return NULL; -#endif } + #include "unix-basedir.h" extern int showfps; extern int swapbuttons; @@ -235,18 +209,18 @@ extern int swapbuttons; int main(int argc, char *argv[]) { - puts("Starting GPFCE - Port version 0.2 05-29-2006"); + puts("Starting GPFCE - Port version 0.2 05-29-2006"); puts("Based on FCE Ultra "VERSION_STRING"..."); puts("Ported by Zheng Zhu\n"); -#ifdef GP2X + // stereo //gp2x_init (1000, 8, SOUND_RATE, 16, 1, 60); - + // mono 44khz //gp2x_init (1000, 8, SOUND_RATE<<1, 16, 0, 60); // mono 22khz gp2x_init (1000, 8, SOUND_RATE, 16, 0, 60); - + SetDefaults(); int ret=CLImain(argc,argv); @@ -275,35 +249,5 @@ int main(int argc, char *argv[]) execl("./selector","./selector","./gpfce_config",NULL); } return(ret?0:-1); -#else - gp2x_init (1000, 8, SOUND_RATE, 16, 1, 60); - - if(SDL_Init(0)) - { - printf("Could not initialize SDL: %s.\n", SDL_GetError()); - return(-1); - } - SetDefaults(); - - #ifdef BROKEN - if(getenv("SDL_VIDEODRIVER")) - { - if((_fshacksave=malloc(strlen(getenv("SDL_VIDEODRIVER"))+1))) - strcpy(_fshacksave,getenv("SDL_VIDEODRIVER")); - } - else - _fshacksave=0; - #endif - - { - int ret=CLImain(argc,argv); - SDL_Quit(); - // make sure sound thread has exited cleanly - while (gp2x_in_sound_thread) pthread_yield(); - printf("Sound thread exited\n"); - printf("Exiting main(). terminated"); - return(ret); - } -#endif } diff --git a/drivers/pc/sdl.h b/drivers/pc/sdl.h index f8b2bab..7882e5b 100644 --- a/drivers/pc/sdl.h +++ b/drivers/pc/sdl.h @@ -1,6 +1,3 @@ -#ifndef GP2X -#include -#endif #include "../../driver.h" #include "../common/args.h" #include "../common/config.h" diff --git a/drivers/pc/svga-video.c b/drivers/pc/svga-video.c deleted file mode 100644 index 67f4ecb..0000000 --- a/drivers/pc/svga-video.c +++ /dev/null @@ -1,497 +0,0 @@ -/* FCE Ultra - NES/Famicom Emulator - * - * Copyright notice for this file: - * Copyright (C) 1998 \Firebug\ - * Copyright (C) 2002 Ben Parnell - * - * 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 -#include -#include -#include - -#define inportb inb -#define outportb(port, value) outb(value, port) -#define outportw(port, value) outw(value, port) - -#include "main.h" -#include "svgalib.h" -#include "svga-video.h" - - -int vmode=1; - -#ifdef FRAMESKIP -int FCEUDfskip=0; -#endif - -static int vidready=0; -static int conlock=0; - -void LockConsole(void) -{ - if(!conlock) - { - vga_lockvc(); - conlock=1; - FCEUI_DispMessage("Console locked."); - } -} - -void UnlockConsole(void) -{ - if(conlock) - { - vga_unlockvc(); - conlock=0; - FCEUI_DispMessage("Console unlocked."); - } -} - -void SetBorder(void) -{ - if(!conlock) - vga_lockvc(); - inportb(0x3da); - outportb(0x3c0,(0x11|0x20)); - outportb(0x3c0,0x80); - if(!conlock) - vga_unlockvc(); -} - -#include "vgatweak.c" - -void TweakVGA(int VGAMode) -{ - int I; - - if(!conlock) - vga_lockvc(); - - outportb(0x3C8,0x00); - for(I=0;I<768;I++) outportb(0x3C9,0x00); - - outportb(0x3D4,0x11); - I=inportb(0x3D5)&0x7F; - outportb(0x3D4,0x11); - outportb(0x3D5,I); - - switch(VGAMode) - { - case 1: for(I=0;I<25;I++) VGAPortSet(v256x240[I]);break; - case 2: for(I=0;I<25;I++) VGAPortSet(v256x256[I]);break; - case 3: for(I=0;I<25;I++) VGAPortSet(v256x256S[I]);break; - case 6: for(I=0;I<25;I++) VGAPortSet(v256x224S[I]);break; - case 8: for(I=0;I<25;I++) VGAPortSet(v256x224_103[I]);break; - default: break; - } - - outportb(0x3da,0); - if(!conlock) - vga_unlockvc(); -} - - -static uint8 palettedbr[256],palettedbg[256],palettedbb[256]; - -static void FlushPalette(void) -{ - int x; - for(x=0;x<256;x++) - { - int z=x; - if(vmode==4 || vmode==5 || vmode==7) z^=0x80; - vga_setpalette(z,palettedbr[x]>>2,palettedbg[x]>>2,palettedbb[x]>>2); - } -} - -void FCEUD_SetPalette(uint8 index, uint8 r, uint8 g, uint8 b) -{ - palettedbr[index]=r; - palettedbg[index]=g; - palettedbb[index]=b; - - if(vidready) - { - if(vmode==4 || vmode==5 || vmode==7) index^=0x80; - vga_setpalette(index,r>>2,g>>2,b>>2); - } -} - - -void FCEUD_GetPalette(uint8 i, uint8 *r, uint8 *g, uint8 *b) -{ - *r=palettedbr[i]; - *g=palettedbg[i]; - *b=palettedbb[i]; -} - -static void vcfix(void) -{ - int z; - - if(!conlock) - vga_lockvc(); - z=inportb(0x3cc); - if(!conlock) - vga_unlockvc(); - if(z!=0xe3 && z!=0xe7) // Common value in all tweaked video modes(and not in 320x200 mode). - { - TweakVGA(vmode); - SetBorder(); - FlushPalette(); - } -} - -static uint8 *ScreenLoc; - -int InitVideo(void) -{ - #ifdef DUMMY - return(1); - #endif - vidready=0; - - if(vmode<=3 || vmode==6 || vmode==8) - { - if(vga_getcurrentchipset()==FBDEV) - { - puts("Tweaked VGA video modes will not work. Using a 320x240 video mode instead..."); - vmode=7; - } - } - - switch(vmode) - { - default: - case 1: - case 2: - case 3: - case 6: - case 8: - vga_setmode(G320x200x256); - vidready|=1; - ScreenLoc=vga_getgraphmem(); - TweakVGA(vmode); - SetBorder(); - memset(ScreenLoc,128,256*256); - break; - case 4: - case 5: - if(!(vga_getmodeinfo(G640x480x256)->flags & CAPABLE_LINEAR)) - { - puts("Video: No linear addressing mode available!"); - return 0; - } - if(vga_setmode(G640x480x256)==-1) - { - puts("Video: Could not set 640x480x8bpp video mode!"); - return 0; - } - vidready|=1; - - vga_setpage(0); - if(vga_setlinearaddressing()!=-1) - ScreenLoc=vga_getgraphmem(); - else - { - puts("Video: Could not set linear addressing!"); - return 0; - } - memset(ScreenLoc,0,640*480); - break; - case 7: - if(!(vga_getmodeinfo(G320x240x256V)->flags & CAPABLE_LINEAR)) - { - puts("Video: No linear addressing mode available!"); - return 0; - } - if(vga_setmode(G320x240x256V)==-1) - { - puts("Video: Could not set 320x240x8bpp video mode!"); - return 0; - } - vidready|=1; - - vga_setpage(0); - if(vga_setlinearaddressing()!=-1) - ScreenLoc=vga_getgraphmem(); - else - { - puts("Video: Could not set linear addressing!"); - return 0; - } - memset(ScreenLoc,0,320*240); - break; - } - vidready|=2; - FlushPalette(); // Needed for cheat console code(and it isn't a bad thing to do anyway...). - return 1; -} - -void KillVideo(void) -{ - if(vidready) - { - vga_setmode(TEXT); - vidready=0; - } -} - - -void BlitScreen(uint8 *XBuf) -{ - static int conto=0; - uint8 *dest; - int tlines; - #ifdef DUMMY - return; - #endif - #ifdef FRAMESKIP - FCEUI_FrameSkip(FCEUDfskip); - #endif - - if(doptions&DO_VSYNC && !NoWaiting) - { - vga_waitretrace(); - } - - tlines=erendline-srendline+1; - - dest=ScreenLoc; - - if(vmode!=4 && vmode!=5 && vmode!=7) - { - conto=(conto+1)&0x3F; - if(!conto) vcfix(); - } - switch(vmode) - { - case 1:dest+=(((240-tlines)>>1)<<8);break; - case 2: - case 3:dest+=(((256-tlines)>>1)<<8);break; - case 4: - case 5:dest+=(((240-tlines)>>1)*640+((640-512)>>1));break; - case 8: - case 6:if(tlines>224) tlines=224;dest+=(((224-tlines)>>1)<<8);break; - case 7:dest+=(((240-tlines)>>1)*320)+32;break; - } - - XBuf+=(srendline<<8)+(srendline<<4); - - if(eoptions&EO_CLIPSIDES) - { - if(vmode==5) - { - asm volatile( - "xorl %%edx, %%edx\n\t" - "ckoop1:\n\t" - "movb $120,%%al \n\t" - "ckoop2:\n\t" - "movb 1(%%esi),%%dl\n\t" - "shl $16,%%edx\n\t" - "movb (%%esi),%%dl\n\t" - "xorl $0x00800080,%%edx\n\t" - "movl %%edx,(%%edi)\n\t" - "addl $2,%%esi\n\t" - "addl $4,%%edi\n\t" - "decb %%al\n\t" - "jne ckoop2\n\t" - - "addl $32,%%esi\n\t" - "addl $800,%%edi\n\t" - "decb %%bl\n\t" - "jne ckoop1\n\t" - : - : "S" (XBuf+8), "D" (dest+8), "b" (tlines) - : "%al", "%edx", "%cc" ); - } - else if(vmode==4) - { - asm volatile( - "cyoop1:\n\t" - "movb $120,%%al \n\t" - "cyoop2:\n\t" - "movb 1(%%esi),%%dh\n\t" - "movb %%dh,%%dl\n\t" - "shl $16,%%edx\n\t" - "movb (%%esi),%%dl\n\t" - "movb %%dl,%%dh\n\t" // Ugh - "xorl $0x80808080,%%edx\n\t" - "movl %%edx,(%%edi)\n\t" - "addl $2,%%esi\n\t" - "addl $4,%%edi\n\t" - "decb %%al\n\t" - "jne cyoop2\n\t" - - "addl $32,%%esi\n\t" - "addl $800,%%edi\n\t" - "decb %%bl\n\t" - "jne cyoop1\n\t" - : - : "S" (XBuf+8), "D" (dest+8), "b" (tlines) - : "%al", "%edx", "%cc" ); - } - else if(vmode==7) - { - asm volatile( - "cgoop81:\n\t" - "movl $30,%%eax\n\t" - "cgoop82:\n\t" - "movl (%%esi),%%edx\n\t" - "movl 4(%%esi),%%ecx\n\t" - "xorl $0x80808080,%%edx\n\t" - "xorl $0x80808080,%%ecx\n\t" - "movl %%edx,(%%edi)\n\t" - "movl %%ecx,4(%%edi)\n\t" - "addl $8,%%esi\n\t" - "addl $8,%%edi\n\t" - "decl %%eax\n\t" - "jne cgoop82\n\t" - "addl $80,%%edi\n\t" - "addl $32,%%esi\n\t" - "decb %%bl\n\t" - "jne cgoop81\n\t" - : - : "S" (XBuf+8), "D" (dest+8), "b" (tlines) - : "%eax","%cc","%edx","%ecx" ); - } - else - { - asm volatile( - "cgoop1:\n\t" - "movl $30,%%eax\n\t" - "cgoop2:\n\t" - "movl (%%esi),%%edx\n\t" - "movl 4(%%esi),%%ecx\n\t" - "movl %%edx,(%%edi)\n\t" - "movl %%ecx,4(%%edi)\n\t" - "addl $8,%%esi\n\t" - "addl $8,%%edi\n\t" - "decl %%eax\n\t" - "jne cgoop2\n\t" - "addl $32,%%esi\n\t" - "addl $16,%%edi\n\t" - "decb %%bl\n\t" - "jne cgoop1\n\t" - : - : "S" (XBuf+8), "D" (dest+8), "b" (tlines) - : "%eax","%cc","%edx","%ecx" ); - } - } - else - { - if(vmode==5) - { - asm volatile( - "xorl %%edx, %%edx\n\t" - "koop1:\n\t" - "movb $128,%%al \n\t" - "koop2:\n\t" - "movb 1(%%esi),%%dl\n\t" - "shl $16,%%edx\n\t" - "movb (%%esi),%%dl\n\t" - "xorl $0x00800080,%%edx\n\t" - "movl %%edx,(%%edi)\n\t" - "addl $2,%%esi\n\t" - "addl $4,%%edi\n\t" - "decb %%al\n\t" - "jne koop2\n\t" - - "addl $16,%%esi\n\t" - "addl $768,%%edi\n\t" - "decb %%bl\n\t" - "jne koop1\n\t" - : - : "S" (XBuf), "D" (dest), "b" (tlines) - : "%al", "%edx", "%cc" ); - } - else if(vmode==4) - { - asm volatile( - "yoop1:\n\t" - "movb $128,%%al \n\t" - "yoop2:\n\t" - "movb 1(%%esi),%%dh\n\t" - "movb %%dh,%%dl\n\t" - "shl $16,%%edx\n\t" - "movb (%%esi),%%dl\n\t" - "movb %%dl,%%dh\n\t" // Ugh - "xorl $0x80808080,%%edx\n\t" - "movl %%edx,(%%edi)\n\t" - "addl $2,%%esi\n\t" - "addl $4,%%edi\n\t" - "decb %%al\n\t" - "jne yoop2\n\t" - - "addl $16,%%esi\n\t" - "addl $768,%%edi\n\t" - "decb %%bl\n\t" - "jne yoop1\n\t" - : - : "S" (XBuf), "D" (dest), "b" (tlines) - : "%al", "%edx", "%cc" ); - } - else if(vmode==7) - { - asm volatile( - "goop81:\n\t" - "movl $32,%%eax\n\t" - "goop82:\n\t" - "movl (%%esi),%%edx\n\t" - "movl 4(%%esi),%%ecx\n\t" - "xorl $0x80808080,%%edx\n\t" - "xorl $0x80808080,%%ecx\n\t" - "movl %%edx,(%%edi)\n\t" - "movl %%ecx,4(%%edi)\n\t" - "addl $8,%%esi\n\t" - "addl $8,%%edi\n\t" - "decl %%eax\n\t" - "jne goop82\n\t" - "addl $64,%%edi\n\t" - "addl $16,%%esi\n\t" - "decb %%bl\n\t" - "jne goop81\n\t" - : - : "S" (XBuf), "D" (dest), "b" (tlines) - : "%eax","%cc","%edx","%ecx" ); - } - else - { - asm volatile( - "goop1:\n\t" - "movl $32,%%eax\n\t" - "goop2:\n\t" - "movl (%%esi),%%edx\n\t" - "movl 4(%%esi),%%ecx\n\t" - "movl %%edx,(%%edi)\n\t" - "movl %%ecx,4(%%edi)\n\t" - "addl $8,%%esi\n\t" - "addl $8,%%edi\n\t" - "decl %%eax\n\t" - "jne goop2\n\t" - "addl $16,%%esi\n\t" - "decb %%bl\n\t" - "jne goop1\n\t" - : - : "S" (XBuf), "D" (dest), "b" (tlines) - : "%eax","%cc","%edx","%ecx" ); - } - } -} - - diff --git a/drivers/pc/svga-video.h b/drivers/pc/svga-video.h deleted file mode 100644 index e0a991b..0000000 --- a/drivers/pc/svga-video.h +++ /dev/null @@ -1,32 +0,0 @@ -/* FCE Ultra - NES/Famicom Emulator - * - * Copyright notice for this file: - * Copyright (C) 2002 Ben Parnell - * - * 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 - */ - -extern int vmode; - -#ifdef FRAMESKIP -extern int FCEUDfskip; -#endif - -void LockConsole(void); -void UnlockConsole(void); -int InitVideo(void); -void KillVideo(void); -void FCEUD_BlitScreen(uint8 *XBuf); - diff --git a/drivers/pc/svgalib.c b/drivers/pc/svgalib.c deleted file mode 100644 index 3e3cd4d..0000000 --- a/drivers/pc/svgalib.c +++ /dev/null @@ -1,179 +0,0 @@ -#include -#include -#include -#include -#include -#include - -#include "../../driver.h" -#include "../common/args.h" -#include "../common/config.h" -#include "../common/unixdsp.h" - -#include "svgalib.h" -#include "svga-video.h" -#include "lnx-joystick.h" -#include "unix-netplay.h" - -//static int soundo=0; -static int f8bit=0; -static int sfragsize=7,snfrags=8; - -int doptions=0; - -CFGSTRUCT DriverConfig[]={ - NAC("sound",soundo), - AC(doptions), - AC(f8bit), - AC(vmode), - NACA("joybmap",joyBMap), - ACA(joy), - AC(snfrags), - AC(sfragsize), - ENDCFGSTRUCT -}; - - -char *DriverUsage= -"-vmode x Select video mode(all are 8 bpp).\n\ - 1 = 256x240 5 = 640x480(\"1 per 4\")\n\ - 2 = 256x256 6 = 256x224(with scanlines)\n\ - 3 = 256x256(with scanlines) 7 = 320x240\n\ - 4 = 640x480(with scanlines) 8 = 256x224\n\ --vsync x Wait for the screen's vertical retrace before updating the\n\ - screen. Refer to the documentation for caveats.\n\ - 0 = Disabled.\n\ - 1 = Enabled.\n\ --joyx y Joystick mapped to virtual joystick x(1-4).\n\ - 0 = Disabled, reset configuration.\n\ - Otherwise, y(1-inf) = joystick number.\n\ --sound x Sound.\n\ - 0 = Disabled.\n\ - Otherwise, x = playback rate.\n\ --sfragsize x Set sound fragment size to 2^x samples.\n\ --snfrags x Set number of sound fragments to x.\n\ --f8bit x Force 8-bit sound.\n\ - 0 = Disabled.\n\ - 1 = Enabled.\n\ --connect s Connect to server 's' for TCP/IP network play.\n\ --server Be a host/server for TCP/IP network play.\n\ --netport x Use TCP/IP port x for network play."; - - -static int docheckie[2]={0,0}; -ARGPSTRUCT DriverArgs[]={ - {"-joy1",0,&joy[0],0},{"-joy2",0,&joy[1],0}, - {"-joy3",0,&joy[2],0},{"-joy4",0,&joy[3],0}, - {"-snfrags",0,&snfrags,0},{"-sfragsize",0,&sfragsize,0}, - {"-vmode",0,&vmode,0}, - {"-vsync",0,&doptions,0x8000|DO_VSYNC}, - {"-sound",0,&soundo,0}, - {"-f8bit",0,&f8bit,0}, - {"-connect",&docheckie[0],&netplayhost,0x4001}, - {"-server",&docheckie[1],0,0}, - {"-netport",0,&Port,0}, - {0,0,0,0} -}; - -void DoDriverArgs(void) -{ - int x; - - if(docheckie[0]) - netplay=2; - else if(docheckie[1]) - netplay=1; - - if(netplay) - FCEUI_SetNetworkPlay(netplay); - - for(x=0;x<4;x++) - if(!joy[x]) memset(joyBMap[x],0,4*sizeof(int)); -} -/* -int InitSound(void) -{ - printf("Called InitSound svgalib.c\n"); - if(soundo) - { - int rate; - if(soundo==1) - soundo=48000; - rate=soundo; - if(InitUNIXDSPSound(&rate,f8bit?0:1,sfragsize,snfrags)) - { - FCEUI_Sound(rate); - return(1); - } - } - return(0); -}*/ - -void WriteSound(int32 *Buffer, int Count, int NoWaiting) -{ - WriteUNIXDSPSound(Buffer,Count,NoWaiting); -} - -void KillSound(void) -{ - KillUNIXDSPSound(); -} - -int InitMouse(void) -{ - vga_setmousesupport(1); - mouse_setxrange(0,260); - mouse_setyrange(0,260); - mouse_setscale(1); - return(1); -} - -void KillMouse(void) -{ - mouse_close(); -} - -void GetMouseData(uint32 *MouseData) -{ - int z; - mouse_update(); - MouseData[0]=mouse_getx(); - MouseData[1]=mouse_gety(); - z=mouse_getbutton(); - MouseData[2]=((z&MOUSE_LEFTBUTTON)?1:0)|((z&MOUSE_RIGHTBUTTON)?2:0); -} - -#include "unix-basedir.h" - -int InitKeyboard(void) -{ - if(keyboard_init()==-1) - { - puts("Error initializing keyboard."); - return 0; - } - keyboard_translatekeys(TRANSLATE_CURSORKEYS | TRANSLATE_DIAGONAL); - return 1; -} - -int UpdateKeyboard(void) -{ - return(keyboard_update()); -} - -char *GetKeyboard(void) -{ - return(keyboard_getstate()); -} - -void KillKeyboard(void) -{ - keyboard_close(); -} - -int main(int argc, char *argv[]) -{ - puts("\nStarting FCE Ultra "VERSION_STRING"...\n"); - vga_init(); - return(CLImain(argc,argv)); -} diff --git a/drivers/pc/svgalib.h b/drivers/pc/svgalib.h deleted file mode 100644 index 8f18b74..0000000 --- a/drivers/pc/svgalib.h +++ /dev/null @@ -1,2 +0,0 @@ -#define DO_VSYNC 1 -extern int doptions; diff --git a/drivers/pc/vgatweak.c b/drivers/pc/vgatweak.c deleted file mode 100644 index a04cf94..0000000 --- a/drivers/pc/vgatweak.c +++ /dev/null @@ -1,168 +0,0 @@ -/* This file is "#include"d from dos-video.c and svga-video.c */ - -typedef struct { - uint8 p; - uint8 i; - uint8 v; -} vgareg; - -vgareg v256x224_103[25] = -{ - { 0xc2, 0x0, 0xe7}, - { 0xd4, 0x0, 0x45}, - { 0xd4, 0x1, 0x3f}, - { 0xd4, 0x2, 0x40}, - { 0xd4, 0x3, 0x86}, - { 0xd4, 0x4, 0x3f}, - { 0xd4, 0x5, 0x10}, - { 0xd4, 0x6, 0xcd}, - { 0xd4, 0x7, 0x1f}, - { 0xd4, 0x8, 0x0}, - { 0xd4, 0x9, 0x41}, - { 0xd4, 0x10, 0xc0}, - { 0xd4, 0x11, 0xac}, - { 0xd4, 0x12, 0xbf}, - { 0xd4, 0x13, 0x20}, - { 0xd4, 0x14, 0x40}, // - { 0xd4, 0x15, 0xe7}, - { 0xd4, 0x16, 0x06}, // - { 0xd4, 0x17, 0xa3}, - { 0xc4, 0x1, 0x1}, - { 0xc4, 0x4, 0xe}, // - { 0xce, 0x5, 0x40}, - { 0xce, 0x6, 0x5}, - { 0xc0, 0x10, 0x41}, - { 0xc0, 0x13, 0x0}, -}; - -vgareg v256x240[25] = -{ - { 0xc2, 0x0, 0xe3}, - { 0xd4, 0x0, 0x4f}, - { 0xd4, 0x1, 0x3f}, - { 0xd4, 0x2, 0x40}, - { 0xd4, 0x3, 0x92}, - { 0xd4, 0x4, 0x44}, - { 0xd4, 0x5, 0x10}, - { 0xd4, 0x6, 0x0a}, - { 0xd4, 0x7, 0x3e}, - { 0xd4, 0x8, 0x00}, - { 0xd4, 0x9, 0x41}, - { 0xd4, 0x10, 0xea}, - { 0xd4, 0x11, 0xac}, - { 0xd4, 0x12, 0xdf}, - { 0xd4, 0x13, 0x20}, - { 0xd4, 0x14, 0x40}, - { 0xd4, 0x15, 0xe7}, - { 0xd4, 0x16, 0x06}, - { 0xd4, 0x17, 0xa3}, - { 0xc4, 0x1, 0x1}, - { 0xc4, 0x4, 0xe}, - { 0xce, 0x5, 0x40}, - { 0xce, 0x6, 0x5}, - { 0xc0, 0x10, 0x41}, - { 0xc0, 0x13, 0x0} -}; - -vgareg v256x224S[25] = -{ - { 0xc2, 0x0, 0xe3}, - { 0xd4, 0x0, 0x5f}, - { 0xd4, 0x1, 0x3f}, - { 0xd4, 0x2, 0x40}, - { 0xd4, 0x3, 0x82}, - { 0xd4, 0x4, 0x4e}, - { 0xd4, 0x5, 0x96}, - { 0xd4, 0x6, 0x5}, - { 0xd4, 0x7, 0x1}, - { 0xd4, 0x8, 0x0}, - { 0xd4, 0x9, 0x40}, - { 0xd4, 0x10, 0xea}, - { 0xd4, 0x11, 0xac}, - { 0xd4, 0x12, 0xdf}, - { 0xd4, 0x13, 0x20}, - { 0xd4, 0x14, 0x40}, - { 0xd4, 0x15, 0xe7}, - { 0xd4, 0x16, 0x0}, - { 0xd4, 0x17, 0xe3}, - { 0xc4, 0x1, 0x1}, - { 0xc4, 0x4, 0xe}, - { 0xce, 0x5, 0x40}, - { 0xce, 0x6, 0x5}, - { 0xc0, 0x10, 0x41}, - { 0xc0, 0x13, 0x0} -}; - -vgareg v256x256[25] = -{ - { 0xc2, 0x0, 0xe7}, - { 0xd4, 0x0, 0x5f}, - { 0xd4, 0x1, 0x3f}, - { 0xd4, 0x2, 0x40}, - { 0xd4, 0x3, 0x82}, - { 0xd4, 0x4, 0x4a}, - { 0xd4, 0x5, 0x9a}, - { 0xd4, 0x6, 0x23}, - { 0xd4, 0x7, 0xb2}, - { 0xd4, 0x8, 0x0}, - { 0xd4, 0x9, 0x61}, - { 0xd4, 0x10, 0xa}, - { 0xd4, 0x11, 0xac}, - { 0xd4, 0x12, 0xff}, - { 0xd4, 0x13, 0x20}, - { 0xd4, 0x14, 0x40}, - { 0xd4, 0x15, 0x7}, - { 0xd4, 0x16, 0x1a}, - { 0xd4, 0x17, 0xa3}, - { 0xc4, 0x1, 0x1}, - { 0xc4, 0x4, 0xe}, - { 0xce, 0x5, 0x40}, - { 0xce, 0x6, 0x5}, - { 0xc0, 0x10, 0x41}, - { 0xc0, 0x13, 0x0} -}; - -vgareg v256x256S[25] = -{ - { 0xc2, 0x00, 0xe7},{ 0xd4, 0x00, 0x5F},{ 0xd4, 0x01, 0x3f}, - { 0xd4, 0x02, 0x40},{ 0xd4, 0x03, 0x82},{ 0xd4, 0x04, 0x4a}, - { 0xd4, 0x05, 0x9a},{ 0xd4, 0x06, 0x25},{ 0xd4, 0x07, 0x15}, - { 0xd4, 0x08, 0x00},{ 0xd4, 0x09, 0x60},{ 0xd4, 0x10, 0x0a}, - { 0xd4, 0x11, 0xac},{ 0xd4, 0x12, 0xff},{ 0xd4, 0x13, 0x20}, - { 0xd4, 0x14, 0x40},{ 0xd4, 0x15, 0x07},{ 0xd4, 0x16, 0x1a}, - { 0xd4, 0x17, 0xa3},{ 0xc4, 0x01, 0x01},{ 0xc4, 0x04, 0x0e}, - { 0xce, 0x05, 0x40},{ 0xce, 0x06, 0x05},{ 0xc0, 0x10, 0x41}, - { 0xc0, 0x13, 0x00} -}; - -static void VGAPortSet(vgareg R) -{ - int p,i,v; - - p=0x300|R.p; - i=R.i; - v=R.v; - - switch(p) - { - case 0x3C0: inportb(0x3DA); - outportb(0x3C0,i); - outportb(0x3C0,v); - break; - case 0x3C2: - case 0x3C3: - default: outportb(p, v); - break; - case 0x3C4: if(i==1) - { - outportw(0x3c4,0x100); - outportw(0x3c4,(v<<8)|1); - outportw(0x3c4,0x300); - break; - } - case 0x3CE: - case 0x3D4: outportw(p,i|(v<<8)); - break; - } -} - -- 2.39.2