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
static uint32 JSreturn;
int NoWaiting=0;
-#include "keyscan.h"
-
static int powerpadsc[2][12];
static int powerpadside=0;
+++ /dev/null
-#ifdef SVGALIB\r
-#include <vgakeyboard.h>\r
-#define SCANCODE_DELETE SCANCODE_REMOVE\r
-#define SCANCODE_KP_MINUS SCANCODE_KEYPADMINUS\r
-#define SCANCODE_KP_PLUS SCANCODE_KEYPADPLUS\r
-#define MK(k) SCANCODE_##k\r
-#define MK_COUNT 256\r
-#elif SDL\r
-#ifndef GP2X\r
-#include <SDL.h>\r
-#define SDLK_A SDLK_a\r
-#define SDLK_B SDLK_b\r
-#define SDLK_C SDLK_c\r
-#define SDLK_D SDLK_d\r
-#define SDLK_E SDLK_e\r
-#define SDLK_F SDLK_f\r
-#define SDLK_G SDLK_g\r
-#define SDLK_H SDLK_h\r
-#define SDLK_I SDLK_i\r
-#define SDLK_J SDLK_j\r
-#define SDLK_K SDLK_k\r
-#define SDLK_L SDLK_l\r
-#define SDLK_M SDLK_m\r
-#define SDLK_N SDLK_n\r
-#define SDLK_O SDLK_o\r
-#define SDLK_P SDLK_p\r
-#define SDLK_Q SDLK_q\r
-#define SDLK_R SDLK_r\r
-#define SDLK_S SDLK_s\r
-#define SDLK_T SDLK_t\r
-#define SDLK_U SDLK_u\r
-#define SDLK_V SDLK_v\r
-#define SDLK_W SDLK_w\r
-#define SDLK_X SDLK_x\r
-#define SDLK_Y SDLK_y\r
-#define SDLK_Z SDLK_z\r
-#define SDLK_LEFTCONTROL SDLK_LCTRL\r
-#define SDLK_RIGHTCONTROL SDLK_RCTRL\r
-#define SDLK_LEFTALT SDLK_LALT\r
-#define SDLK_RIGHTALT SDLK_RALT\r
-#define SDLK_LEFTSHIFT SDLK_LSHIFT\r
-#define SDLK_RIGHTSHIFT SDLK_RSHIFT\r
-#define SDLK_CURSORDOWN SDLK_DOWN\r
-#define SDLK_CURSORUP SDLK_UP\r
-#define SDLK_CURSORLEFT SDLK_LEFT\r
-#define SDLK_CURSORRIGHT SDLK_RIGHT\r
-#define SDLK_ENTER SDLK_RETURN\r
-#define SDLK_EQUAL SDLK_EQUALS\r
-#define SDLK_APOSTROPHE SDLK_QUOTE\r
-#define SDLK_BRACKET_LEFT SDLK_LEFTBRACKET\r
-#define SDLK_BRACKET_RIGHT SDLK_RIGHTBRACKET\r
-#define SDLK_SCROLLLOCK SDLK_SCROLLOCK /* I guess the SDL people don't like lots of Ls... */\r
-#define SDLK_GRAVE SDLK_BACKQUOTE\r
-#define MK(k) SDLK_##k\r
-#define MK_COUNT (SDLK_LAST+1)\r
-#elif DOS\r
-\r
-#define SCAN_GRAVE 0x29\r
-#define SCAN_1 0x02\r
-#define SCAN_2 0x03\r
-#define SCAN_3 0x04\r
-#define SCAN_4 0x05\r
-#define SCAN_5 0x06\r
-#define SCAN_6 0x07\r
-#define SCAN_7 0x08\r
-#define SCAN_8 0x09\r
-#define SCAN_9 0x0A\r
-#define SCAN_0 0x0B\r
-#define SCAN_MINUS 0x0C\r
-#define SCAN_EQUAL 0x0D\r
-#define SCAN_BACKSLASH 0x2B\r
-#define SCAN_BACKSPACE 0x0E\r
-#define SCAN_TAB 0x0F\r
-#define SCAN_Q 0x10\r
-#define SCAN_W 0x11\r
-#define SCAN_E 0x12\r
-#define SCAN_R 0x13\r
-#define SCAN_T 0x14\r
-#define SCAN_Y 0x15\r
-#define SCAN_U 0x16\r
-#define SCAN_I 0x17\r
-#define SCAN_O 0x18\r
-#define SCAN_P 0x19\r
-#define SCAN_BRACKET_LEFT 0x1A\r
-#define SCAN_BRACKET_RIGHT 0x1B\r
-#define SCAN_LOWBACKSLASH 0x2B\r
-#define SCAN_CAPSLOCK 0x3A\r
-#define SCAN_A 0x1E\r
-#define SCAN_S 0x1F\r
-#define SCAN_D 0x20\r
-#define SCAN_F 0x21\r
-#define SCAN_G 0x22\r
-#define SCAN_H 0x23\r
-#define SCAN_J 0x24\r
-#define SCAN_K 0x25\r
-#define SCAN_L 0x26\r
-#define SCAN_SEMICOLON 0x27\r
-#define SCAN_APOSTROPHE 0x28\r
-#define SCAN_ENTER 0x1C\r
-#define SCAN_LEFTSHIFT 0x2A\r
-#define SCAN_Z 0x2C\r
-#define SCAN_X 0x2D\r
-#define SCAN_C 0x2E\r
-#define SCAN_V 0x2F\r
-#define SCAN_B 0x30\r
-#define SCAN_N 0x31\r
-#define SCAN_M 0x32\r
-#define SCAN_COMMA 0x33\r
-#define SCAN_PERIOD 0x34\r
-#define SCAN_SLASH 0x35\r
-#define SCAN_RIGHTSHIFT 0x36\r
-#define SCAN_LEFTCONTROL 0x1D\r
-#define SCAN_LEFTALT 0x38\r
-#define SCAN_SPACE 0x39\r
-\r
-/* Extended keys. */\r
-#define SCAN_RIGHTALT (0x38|0x80)\r
-#define SCAN_RIGHTCONTROL (0x1D|0x80)\r
-#define SCAN_BL_INSERT (0x52|0x80)\r
-#define SCAN_BL_DELETE (0x53|0x80)\r
-#define SCAN_BL_CURSORLEFT (0x4B|0x80)\r
-#define SCAN_BL_HOME (0x47|0x80)\r
-#define SCAN_BL_END (0x4F|0x80)\r
-#define SCAN_BL_CURSORUP (0x48|0x80)\r
-#define SCAN_BL_CURSORDOWN (0x50|0x80)\r
-#define SCAN_BL_PAGEUP (0x49|0x80)\r
-#define SCAN_BL_PAGEDOWN (0x51|0x80)\r
-#define SCAN_BL_CURSORRIGHT (0x4D|0x80)\r
-\r
-#define SCAN_SCROLLLOCK 0x46\r
-/* Keys in the key pad area. */\r
-#define SCAN_NUMLOCK 0x45\r
-#define SCAN_HOME 0x47\r
-#define SCAN_CURSORLEFT 0x4B\r
-#define SCAN_END 0x4F\r
-#define SCAN_SLASH 0x35\r
-#define SCAN_CURSORUP 0x48\r
-#define SCAN_CENTER 0x4C\r
-#define SCAN_CURSORDOWN 0x50\r
-#define SCAN_INSERT 0x52\r
-#define SCAN_ASTERISK 0x37\r
-#define SCAN_PAGEUP 0x49\r
-#define SCAN_CURSORRIGHT 0x4D\r
-#define SCAN_PAGEDOWN 0x51\r
-#define SCAN_DELETE 0x53\r
-#define SCAN_KP_MINUS 0x4A\r
-#define SCAN_KP_PLUS 0x4E\r
-#define SCAN_KP_ENTER 0x1C\r
-\r
-#define SCAN_ESCAPE 0x01\r
-#define SCAN_F1 0x3B\r
-#define SCAN_F2 0x3C\r
-#define SCAN_F3 0x3D\r
-#define SCAN_F4 0x3E\r
-#define SCAN_F5 0x3F\r
-#define SCAN_F6 0x40\r
-#define SCAN_F7 0x41\r
-#define SCAN_F8 0x42\r
-#define SCAN_F9 0x43\r
-#define SCAN_F10 0x44\r
-#define SCAN_F11 0x57\r
-#define SCAN_F12 0x58\r
-#define MK_COUNT 256\r
-#define MK(k) SCAN_##k\r
-#endif\r
-\r
-#endif\r
+++ /dev/null
-/* 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 <stdlib.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <errno.h>
-
-#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
-}
+++ /dev/null
-/* 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 <SDL/SDL_net.h>
-#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;
-}
+++ /dev/null
-extern char *netplayhost;
-extern int Port;
-extern int FDnetplay;
-#define netplay FDnetplay
-
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
{
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
}
}
#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]));
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)
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;
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);
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
}
-#ifndef GP2X
-#include <SDL.h>
-#endif
#include "../../driver.h"
#include "../common/args.h"
#include "../common/config.h"
+++ /dev/null
-/* 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 <stdio.h>
-#include <string.h>
-#include <vga.h>
-#include <sys/io.h>
-
-#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" );
- }
- }
-}
-
-
+++ /dev/null
-/* 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);
-
+++ /dev/null
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <vga.h>
-#include <vgamouse.h>
-#include <vgakeyboard.h>
-
-#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));
-}
+++ /dev/null
-#define DO_VSYNC 1
-extern int doptions;
+++ /dev/null
-/* 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;
- }
-}
-