19 Commits

Author SHA1 Message Date
Godzil
1ac164cbda Slight version bump 2017-03-17 12:59:59 +01:00
Godzil
4da1c434cd Merge branch 'master' of github.com:Godzil/TI-NESulator 2017-03-17 12:31:54 +01:00
Godzil
6a1064a852 Some more update on coverages thingys 2017-03-17 12:31:20 +01:00
Manoël Trapier
0a0d086f31 Shut up GCC with your stupid warnings. 2017-03-17 09:03:46 +00:00
Godzil
a09f33fe33 Correct test call 2017-03-16 20:03:37 +01:00
Godzil
b6c4793f44 Update code coverage test to run headless for a full minute, correct some warning and bugs 2017-03-16 19:54:00 +01:00
Godzil
b0ed951235 More Travis/Code coverage things 2017-03-16 16:13:06 +01:00
Godzil
ff80e60879 Should now build under Linux. 2017-03-16 15:18:52 +01:00
Godzil
bfd4597afa Merge branch 'master' of github.com:Godzil/TI-NESulator 2017-03-16 13:23:19 +01:00
Godzil
7ffe343e7a More travis test 2017-03-16 13:23:11 +01:00
Godzil
75bac739ee Test travis CI 2017-03-16 13:14:32 +01:00
Manoël Trapier
779a22006c Update README.md 2017-03-16 12:06:47 +00:00
Manoël Trapier
3d3d6729f6 Update README.md 2017-03-16 11:35:55 +00:00
Godzil
d26bd788cf Update Win32 source folder 2017-02-24 12:16:03 +00:00
Godzil
cc9fe51828 Switch graphic & key management to OpenGL/GLFW3, correct sprite behaviour, still not perfect, but way better (no more issue with overlapping and overflow is correctly handled now)
->PPU still need a complete rewrite.
 Bump version to 0.7!
2016-12-29 18:21:39 +01:00
Godzil
866dcfa969 Add glfw as a submodule 2016-12-29 18:06:48 +01:00
Manoël Trapier
54a685cdaa Update memory.c
Correct a "bug" in the define of DEBUG, only one of define and undef should be enable at the same...
2016-11-17 14:40:31 +00:00
Godzil
bcf60e8d96 And add a link to it for markdown rendering 2016-11-17 08:36:22 +00:00
Godzil
0d6ed068ca Add a slightly proper readme file 2016-11-17 08:35:38 +00:00
65 changed files with 2022 additions and 969 deletions

6
.gitmodules vendored Normal file
View File

@@ -0,0 +1,6 @@
[submodule "external/glfw"]
path = external/glfw
url = https://github.com/glfw/glfw.git
[submodule "external/coveralls-cmake"]
path = external/coveralls-cmake
url = https://github.com/JoakimSoderberg/coveralls-cmake.git

32
.travis.yml Normal file
View File

@@ -0,0 +1,32 @@
language: c
git:
submodule: true
compiler:
- clang
- gcc
script:
- mkdir build
- cd build
- cmake -DUSE_ALLEGRO=OFF -DUSE_PROFILING=OFF -DCOVERALLS=OFF -DCMAKE_BUILD_TYPE=Release ..
- cmake --build .
- cd ..
- mkdir coverage
- cd coverage
- cmake -DUSE_ALLEGRO=OFF -DUSE_PROFILING=OFF -DCOVERALLS=ON -DCMAKE_BUILD_TYPE=Debug ..
- cmake --build .
- cmake --build . --target coveralls
install: true
env:
global:
- CODECOV_TOKEN=$COVERALLS_REPO_TOKEN
addons:
apt:
sources:
- george-edison55-precise-backports # cmake 3.2.3 / doxygen 1.8.3
packages:
- cmake
- cmake-data
- lcov
- curl
after_success:
- bash <(curl -s https://codecov.io/bash)

View File

@@ -9,8 +9,20 @@
# $HeadURL$
# $Revision$
cmake_minimum_required (VERSION 2.8)
cmake_minimum_required (VERSION 2.6)
project (TINES)
set(GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE)
set(GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE)
set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
add_subdirectory("external/glfw")
find_package(OpenGL REQUIRED)
include_directories(${OPENGL_INCLUDE_DIR})
if (COVERALLS)
enable_testing()
endif (COVERALLS)
add_subdirectory (src)

21
README.md Normal file
View File

@@ -0,0 +1,21 @@
TI-NESulator
============
[![Coverage Status](https://coveralls.io/repos/github/Godzil/TI-NESulator/badge.svg?branch=master)](https://coveralls.io/github/Godzil/TI-NESulator?branch=master) [![codecov](https://codecov.io/gh/Godzil/TI-NESulator/branch/master/graph/badge.svg)](https://codecov.io/gh/Godzil/TI-NESulator) [![travis](https://travis-ci.org/Godzil/TI-NESulator.svg?branch=master)](https://travis-ci.org/Godzil/TI-NESulator)
This is a cleaned version of the TI-NESulator repository (all non free data has been removed)
Some part of the original subversion has been lost because of harddrive crash so the
early stage of the project is completely lost. Or I would need to check all the
backups arount to recreate part of that history, but that not a fun thing to do to be
honest, and there is virtually nothing to gain from that.
The source is given as is, I have to select a proper licence for this code, but concider
it to be in a 3 clause BSD with a non commercial clause:
- You are free to use that code and integrate some part in your project
- Will need to state where some of your code come from
- This code is given as-is without any waranty of working as expected
- You CAN'T use that code for commercial product without my prior consent.

19
README.txt Normal file
View File

@@ -0,0 +1,19 @@
TI-NESulator
============
This is a cleaned version of the TI-NESulator repository (all data has been removed)
Some part of the original subversion has been lost because of harddrive crash so the
early stage of the project is completely lost. Or I would need to check all the
backups arount to recreate part of that history, but that not a fun thing to do to be
honest, and there is virtually nothing to gain from that.
The source is given as is, I have to select a proper licence for this code, but concider
it to be in a 3 clause BSD with a non commercial clause:
- You are free to use that code and integrate some part in your project
- Will need to state where some of your code come from
- This code is given as-is without any waranty of working as expected
- You CAN'T use that code for commercial product without my prior consent.

BIN
data/bad_apple_2.nes Normal file

Binary file not shown.

1
external/coveralls-cmake vendored Submodule

1
external/glfw vendored Submodule

Submodule external/glfw added at 0f488ac286

View File

@@ -2,15 +2,13 @@
# TI-NES CMake
#
# Created by Manoel TRAPIER.
# Copyright (c) 2003-2008 986Corp. All rights reserved.
# Copyright (c) 2003-2016 986-Studio. All rights reserved.
#
# $LastChangedDate$
# $Author$
# $HeadURL$
# $Revision$
include_directories($(TINES_SOURCE_DIR)/include)
##########################
# Configurations variables
##########################
@@ -22,28 +20,20 @@ set(DETECT_BUS_CONFLICT OFF CACHE BOOL "Activate the bus conflit detector? (Coul
set(USE_EFENCE OFF CACHE BOOL "Use electricfence memory debugger?")
set(USE_PROFILING OFF CACHE BOOL "Use profiling tools? (Will slow down a lot.)")
set(USE_ALLEGRO ON CACHE BOOL "Use Allegro backend" FORCE)
set(USE_ALLEGRO ON CACHE BOOL "Use Allegro backend")
IF(NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE Debug CACHE STRING
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
FORCE)
ENDIF(NOT CMAKE_BUILD_TYPE)
if (APPLE)
SET (CMAKE_FIND_FRAMEWORK LAST)
endif (APPLE)
option(COVERALLS "Generate coveralls data" OFF)
##########################
# Link & Compile flags
##########################
set (CMAKE_C_FLAGS "-Wall -Wextra -Wno-unused-parameter -Werror ${PLATFORM_FLAGS}")
set (CMAKE_CXX_FLAGS "-Wall -Wextra -Wno-unused-parameter -Werror ${PLATFORM_FLAGS}")
set (CMAKE_C_FLAGS "-Wall -Wextra -Wno-unused-parameter -Wno-unused-result -Werror ${PLATFORM_FLAGS}")
set (CMAKE_CXX_FLAGS "-Wall -Wextra -Wno-unused-parameter -Wno-unused-result -Werror ${PLATFORM_FLAGS}")
add_definitions (-DNO_DECIMAL -DFAST_RDOP)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/external/coveralls-cmake/cmake)
SET ( CMAKE_EXE_LINKER_FLAGS "-mmacosx-version-min=10.4")
add_definitions (-DNO_DECIMAL)
if (PPU_ISPAL)
add_definitions (-DISPAL)
@@ -63,15 +53,6 @@ if (DETECT_BUS_CONFLICT)
add_definitions (-DDETECT_BUS_CONFLICT)
endif (DETECT_BUS_CONFLICT)
if (USE_EFENCE)
if (CMAKE_BUILD_TYPE MATCHES Release)
SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Debug info is forced" FORCE)
else(CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE Debug CACHE STRING "Debug info is forced" FORCE)
endif(CMAKE_BUILD_TYPE)
endif (USE_EFENCE)
if (USE_PROFILING)
if (CMAKE_BUILD_TYPE MATCHES Rel)
SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Debug info is forced" FORCE)
@@ -82,18 +63,13 @@ if (USE_PROFILING)
set(CMAKE_C_FLAGS -pg)
endif (USE_PROFILING)
if (APPLE)
include_directories(BEFORE /usr/include)
endif (APPLE)
if (COVERALLS)
add_definitions (-DRUN_COVERAGE)
include(Coveralls)
coveralls_turn_on_coverage()
endif()
#if the CPU is LSB set the define
if (CMAKE_SYSTEM_PROCESSOR MATCHES i386 OR CMAKE_SYSTEM_PROCESSOR MATCHES [aA][rR][mM])
add_definitions (-DLSB_FIRST)
endif (CMAKE_SYSTEM_PROCESSOR MATCHES i386 OR CMAKE_SYSTEM_PROCESSOR MATCHES [aA][rR][mM])
#Add release mode extra C Flags
set (CMAKE_C_FLAGS_RELEASE "-fomit-frame-pointer -funroll-loops -Wall ${CMAKE_C_FLAGS_RELEASE}")
set (CMAKE_C_FLAGS_RELWITHDEBINFO "-fomit-frame-pointer -funroll-loops -Wall ${CMAKE_C_FLAGS_RELWITHDEBINFO}")
include_directories(include)
add_subdirectory(apu)
add_subdirectory(corecpu)
@@ -105,36 +81,26 @@ add_subdirectory(ppu)
if (TARGET_TI68k)
add_subdirectory(os/ti68k)
elseif (APPLE AND ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
add_subdirectory(os/macos)
elseif (UNIX)
add_subdirectory(os/unix)
else (TARGET_TI68k)
#So we target UNIX like OS
elseif (WIN32)
add_subdirectory(os/win32)
else (TARGET_TI68k)
add_subdirectory(os/unix)
endif (TARGET_TI68k)
add_library (main main.c paddle.c NESCarts.c)
add_executable(tines main.c)
set(CMAKE_FIND_FRAMEWORK LAST)
find_library(ALLEGROLIB allegro)
find_library(PTHREADLIB pthread)
if (USE_EFENCE)
find_library(EFENCELIB efence)
target_link_libraries(tines ${EFENCELIB})
endif (USE_EFENCE)
if (USE_ALLEGRO)
target_link_libraries(tines debug alld-main)
# target_link_libraries(tines)
if (APPLE)
find_library(COCOALIB Cocoa)
target_link_libraries(tines ${COCOALIB})
endif (APPLE)
endif (USE_ALLEGRO)
if (COVERALLS)
set(COVERAGE_SRCS src/main.c src/paddle.c src/NESCarts.c ${COVERAGE_SRCS})
target_link_libraries(tines main apu corecpu mappermanager memorymanager pluginsmanager ppu oslib ${ALLEGROLIB} ${PTHREADLIB})
# Create the coveralls target.
coveralls_setup(
"${COVERAGE_SRCS}" # The source files.
ON # If we should upload.
) # (Optional) Alternate project cmake module path.
endif()
add_executable(tines main.c paddle.c NESCarts.c)
target_link_libraries(tines apu corecpu mappermanager memorymanager pluginsmanager ppu oslib ${PTHREADLIB})
add_test(NAME tines_test COMMAND $<TARGET_FILE:tines> ${PROJECT_SOURCE_DIR}/data/bad_apple_2.nes)

View File

@@ -3,7 +3,7 @@
* NESCart.c
*
* Created by Manoel TRAPIER.
* Copyright (c) 2003-2008 986Corp. All rights reserved.
* Copyright (c) 2003-2016 986-Studio. All rights reserved.
*
* $LastChangedDate$
* $Author$
@@ -57,7 +57,7 @@ int LoadCart(const char *filename, NesCart * cart)
cart->File = (byte *)LoadFilePtr((char *)filename);
if ((cart->File == NULL) || ((int)cart->File == -1))
if (cart->File == NULL)
return -1;
sprintf(buffer, "%c%c%c%c", 0x4E, 0x45, 0x53, 0x1A);

View File

@@ -2,7 +2,7 @@
# TI-NES CMake
#
# Created by Manoel TRAPIER.
# Copyright (c) 2003-2008 986Corp. All rights reserved.
# Copyright (c) 2003-2016 986-Studio. All rights reserved.
#
# $LastChangedDate$
# $Author$

View File

@@ -10,7 +10,7 @@
/** commercially. Please, notify me, if you make any **/
/** changes to this file. **/
/*************************************************************/
#include "Sound.h"
//#include "Sound.h"
#include <stdlib.h>
#include <stdio.h>
@@ -20,7 +20,7 @@
#include <sys/ioctl.h>
#include <os_dependent.h>
#if 0
#ifdef SUN_AUDIO
#include <sys/audioio.h>
@@ -553,3 +553,4 @@ void UnixDrum(int Type,int Force)
{
/* This function is currently empty */
}
#endif

View File

@@ -9,4 +9,8 @@
# $HeadURL$
# $Revision$
add_library(corecpu corecpu.c)
if (COVERALLS)
set(COVERAGE_SRCS src/corecpu/corecpu.c ${COVERAGE_SRCS} PARENT_SCOPE)
endif()
add_library(corecpu corecpu.c)

View File

@@ -3,7 +3,7 @@
* NESCart.h
*
* Created by Manoel TRAPIER.
* Copyright (c) 2003-2008 986Corp. All rights reserved.
* Copyright (c) 2003-2016 986-Studio. All rights reserved.
*
* $LastChangedDate$
* $Author$

View File

@@ -1,9 +1,9 @@
/**
* ANSI Color definitiont - The Quick6502 Project
* ANSI Color definition - The Quick6502 Project
* include/color.h
*
* Created by Manoel Trapier on 25/06/10
* Copyright 2010 986 Corp. All rights reserved.
* Copyright (c) 2003-2016 986-Studio. All rights reserved.
*
* $LastChangedDate:$
* $Author:$

View File

@@ -3,7 +3,7 @@
* corecpu.h
*
* Created by Manoel Trapier on 24/02/08
* Copyright 2008 986 Corp. All rights reserved.
* Copyright (c) 2003-2016 986-Studio. All rights reserved.
*
* $LastChangedDate$
* $Author$

View File

@@ -3,7 +3,7 @@
* include/log.h
*
* Created by Manoel Trapier on 19/05/10
* Copyright 2010 986 Corp. All rights reserved.
* Copyright (c) 2003-2016 986-Studio. All rights reserved.
*
* $LastChangedDate:$
* $Author:$

View File

@@ -3,7 +3,7 @@
* os_dependent.h
*
* Created by Manoel TRAPIER on 08/05/08.
* Copyright (c) 2003-2008 986Corp. All rights reserved.
* Copyright (c) 2003-2016 986-Studio. All rights reserved.
*
* $LastChangedDate$
* $Author$
@@ -15,11 +15,21 @@
#ifndef OS_DEPENDENT_H
#define OS_DEPENDENT_H
#include <stdint.h>
/* File related functions */
/* Graphics related functions */
int graphics_init();
int graphics_drawpixel(long x, long y, long color);
int graphics_blit(long x, long y, long w, long h);
int graphics_drawline(long x, long y, long x1, long y1, long color);
typedef struct Palette_t
{
uint8_t r,g,b,a;
} Palette;
int getKeyStatus(int key);
/* Sound related functions */
@@ -37,7 +47,6 @@ typedef enum ConsoleLevel_t
Console_Debug,
} ConsoleLevel;
int console_init(ConsoleLevel DefaultLevel);
int console_printf(const ConsoleLevel level, const char *format, ...);
int console_printf_d(const char *format, ...);

View File

@@ -3,7 +3,7 @@
* paddle.h
*
* Created by Manoel TRAPIER.
* Copyright (c) 2003-2008 986Corp. All rights reserved.
* Copyright (c) 2003-2016 986-Studio. All rights reserved.
*
* $LastChangedDate$
* $Author$

View File

@@ -6,7 +6,7 @@
* $Revision$
*/
PALETTE basicPalette = {
Palette basicPalette[] = {
{ 0x1E, 0x1E, 0x1E, 0x07 },
{ 0x03, 0x09, 0x28, 0xB7 },
{ 0x0A, 0x04, 0x2B, 0x0D },

View File

@@ -5,7 +5,7 @@
* Define and emulate the PPU (Picture Processing Unit) of the real NES
*
* Created by Manoel TRAPIER.
* Copyright (c) 2003-2008 986Corp. All rights reserved.
* Copyright (c) 2003-2016 986-Studio. All rights reserved.
*
* $LastChangedDate$
* $Author$
@@ -21,10 +21,10 @@
typedef struct PPU_Sprite_
{
byte y;
byte tileid;
byte flags;
byte x;
uint8_t y;
uint8_t tileid;
uint8_t flags;
uint8_t x;
} PPU_Sprite;
/*
@@ -32,13 +32,13 @@ PPU must be initialized after memory initialisation..
*/
int ppu_init();
int ppu_hblank(int scanline);
int ppu_hblank(uint16_t scanline);
byte ppu_readReg(byte id);
uint8_t ppu_readReg(uint8_t id);
void ppu_writeReg(byte id, byte val);
void ppu_writeReg(uint8_t id, uint8_t val);
void ppu_fillSprRamDMA(byte value);
void ppu_fillSprRamDMA(uint8_t value);
#define PPU_MIRROR_HORIZTAL 0
#define PPU_MIRROR_VERTICAL 1
@@ -52,15 +52,15 @@ void ppu_fillSprRamDMA(byte value);
#define PPU_SCMODE_NORMAL 1
#define PPU_SCMODE_FOURSC 2
void ppu_setMirroring(byte direction);
void ppu_setSingleScreen(byte screen);
void ppu_setScreenMode(byte mode);
void ppu_setMirroring(uint8_t direction);
void ppu_setSingleScreen(uint8_t screen);
void ppu_setScreenMode(uint8_t mode);
PPU_Sprite ppu_getSprite(unsigned short i);
PPU_Sprite ppu_getSprite(uint16_t i);
unsigned char ppu_memoryRead(byte page, byte addr);
void ppu_memoryWrite(byte page, byte addr, byte value);
unsigned char ppu_memoryRead(uint8_t page, uint8_t addr);
void ppu_memoryWrite(uint8_t page, uint8_t addr, uint8_t value);
void ppu_debugSprites();
void ppu_debugColor();

View File

@@ -3,7 +3,7 @@
* types.h - Taken from the Quick6502 project
*
* Created by Manoel Trapier on 18/09/06.
* Copyright 2003-2008 986 Corp. All rights reserved.
* Copyright (c) 2003-2016 986-Studio. All rights reserved.
*
* $LastChangedDate$
* $Author$
@@ -15,12 +15,14 @@
#ifndef TYPES_H
#define TYPES_H
#include <stdint.h>
#ifndef BYTE_TYPE_DEFINED
#define BYTE_TYPE_DEFINED
typedef unsigned char byte;
typedef uint8_t byte;
#endif
typedef unsigned char bool;
typedef uint8_t bool;
#define true (0)
#define false (!true)

View File

@@ -3,7 +3,7 @@
* main.c
*
* Created by Manoel TRAPIER.
* Copyright (c) 2003-2012 986Corp. All rights reserved.
* Copyright (c) 2003-2016 986-Studio. All rights reserved.
*
* $LastChangedDate$
* $Author$
@@ -20,21 +20,15 @@
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/mman.h>
#include <sys/time.h>
#include <time.h>
#include <ctype.h>
/* Allegro includes */
#ifdef __APPLE__
#define USE_CONSOLE
#include <Allegro/allegro.h>
#else
#define USE_CONSOLE
#include <allegro.h>
#endif
#include <GLFW/glfw3.h>
#else
@@ -61,23 +55,11 @@
#include <Sound.h>
#endif
#include <palette.h>
/* PAL support is broken, so force NTSC mode */
#if ISPAL || ISNTSC
#undef ISPAL
#undef ISNTSC
#endif
#define ISNTSC 1
#if ISPAL && !ISNTSC
int VBLANK_TIME = 70;
int HBLANK_TIME = 140;
int HBLANK_TIME = 103;
double APU_BASEFREQ = 1.7734474;
#elif !ISPAL && ISNTSC
int VBLANK_TIME = 20;
int HBLANK_TIME = 113;
double APU_BASEFREQ = 1.7897725;
@@ -91,13 +73,16 @@ double APU_BASEFREQ = 1.7897725;
/* TI-NESulator Version */
#define V_MAJOR 0
#define V_MINOR 40
#define V_MINOR 71
#ifdef USE_SOUND
#undef USE_SOUND
#endif
/* SVN specific values */
#define VS_ID "$Id$"
#define VS_REVISION "$Revision$"
#define VS_LASTCHANGEDDATE "$LastChangedDate$"
#define VS_HEADURL "$HeadURL$"
#define VS_AUTHOR "$Author$"
/*
@@ -113,10 +98,6 @@ NesCart *Cart;
byte *FDSRom;
byte *FDSRam;
/* Allegro main screen */
BITMAP *Buffer;
/* Command line options */
byte START_DEBUG = 0;
byte START_WITH_FDS = 0;
@@ -139,8 +120,6 @@ struct timeval timeEnd;
volatile unsigned long FPS, IPS;
PALETTE pal;
short IRQScanHit = -1;
short SZHit = -1;
@@ -166,21 +145,12 @@ void CloseHook(void)
WantClosing = 1;
}
void ips_fps_counter(void)
{
FPS = frame;
IPS = ccount;
frame = 0;
ccount = 0;
}
END_OF_FUNCTION(ips_fps_counter);
void SaveSaveRam(char *name)
{
FILE *fp;
int i;
char fname[512];
int ret;
strcpy(fname, name);
strcat(fname, ".svt");
if ((fp = fopen(fname, "wb")))
@@ -188,7 +158,7 @@ void SaveSaveRam(char *name)
console_printf(Console_Default, "Saving savestate '%s'\n", fname);
for( i = 0x60; i < 0x80; i++)
{
ret = fwrite(get_page_ptr(i), 1, 0x100, fp);
fwrite(get_page_ptr(i), 1, 0x100, fp);
}
fclose(fp);
@@ -200,7 +170,7 @@ void LoadSaveRam(char *name)
FILE *fp;
int i;
char fname[512];
int ret;
strcpy(fname, name);
strcat(fname, ".svt");
if ((fp = fopen(fname, "rb")))
@@ -208,7 +178,7 @@ void LoadSaveRam(char *name)
console_printf(Console_Default, "Loading savestate '%s'\n", fname);
for( i = 0x60; i < 0x80; i++)
{
ret = fread(get_page_ptr(i), 1, 0x0100, fp);
fread(get_page_ptr(i), 1, 0x0100, fp);
}
fclose(fp);
@@ -216,10 +186,9 @@ void LoadSaveRam(char *name)
}
void LoadPalette(char *filename, PALETTE pal)
void LoadPalette(char *filename, Palette *pal)
{
FILE *fp;
int ret;
unsigned char r, v, b, i;
console_printf(Console_Default, "%s: try to load pallette file '%s'", __func__, filename);
if ((fp = fopen(filename, "rb")) != NULL)
@@ -228,9 +197,9 @@ void LoadPalette(char *filename, PALETTE pal)
for (i = 0; i < 64; i++)
{
ret = fread(&r, 1, 1, fp);
ret = fread(&v, 1, 1, fp);
ret = fread(&b, 1, 1, fp);
fread(&r, 1, 1, fp);
fread(&v, 1, 1, fp);
fread(&b, 1, 1, fp);
/* r = (r * 64) / 255;
v = (v * 64) / 255;
@@ -288,12 +257,20 @@ void LoadPalette(char *filename, PALETTE pal)
}
}
#ifdef RUN_COVERAGE
void alarmHandler(int sig)
{
signal(SIGALRM, SIG_IGN);
WantClosing = 1;
}
#endif
void signalhandler(int sig)
{
static int state=0;
char name[512];
static FILE *fp = NULL;
sprintf(name, "crashdump-%d.txt", (int)time(NULL));
if (state != 0)
@@ -380,6 +357,7 @@ byte Page40[256];
void WrHook4000Multiplexer(byte addr, byte value)
{
#ifdef USE_SOUND
static byte SQ1V = 0;
static byte SQ2V = 0;
static byte NOIV = 0;
@@ -400,6 +378,8 @@ void WrHook4000Multiplexer(byte addr, byte value)
static byte Sq2_reg3 = 0;
double SQ = 0.0;
#endif
switch(addr)
{
#ifdef USE_SOUND
@@ -655,14 +635,9 @@ int main(int argc, char *argv[])
/* Print the banner */
console_printf(Console_Default, "--------------------------------------------------------------------------------\n"
"Welcome to TI-NESulator v%d.%d - by Godzil\n"
"Copyright 2003-2012 TRAPIER Manoel (godzil@godzil.net)\n"
"%s\n%s\n%s\n"
"Copyright 2003-2016 TRAPIER Manoel (godzil@godzil.net)\n"
"--------------------------------------------------------------------------------\n\n",
V_MAJOR,
V_MINOR,
VS_REVISION,
VS_LASTCHANGEDDATE,
VS_AUTHOR);
V_MAJOR, V_MINOR);
console_printf(Console_Default, "Install signal handlers...\t[");
signal(SIGABRT, signalhandler);
@@ -675,7 +650,11 @@ int main(int argc, char *argv[])
console_printf(Console_Default, "S");
signal(SIGTERM, signalhandler);
console_printf(Console_Default, "T]\n");
#ifdef RUN_COVERAGE
signal(SIGALRM, alarmHandler);
#endif
/* */
console_printf(Console_Default, "Initialize memory...\t\t");
InitMemory();
@@ -928,23 +907,7 @@ int main(int argc, char *argv[])
unmap_sram();
InitPaddle(&P1);
console_printf(Console_Default, "Initializing Allegro...\t\t");
allegro_init();
install_timer();
install_keyboard();
console_printf(Console_Default, "[ OK ]\n");
console_printf(Console_Default, "Set graphic mode...\t\t");
set_color_depth(8);
set_gfx_mode(GFX_AUTODETECT_WINDOWED, 512 + 256, 480, 512 + 256, 480);
Buffer = create_bitmap(512 + 256, 480);
clear_to_color(Buffer, 0x0D);
//set_close_button_callback(CloseHook);
//set_window_title("TI-NESulator");
console_printf(Console_Default, "[ OK ]\n");
console_printf(Console_Default, "Init PPU...\n");
if (ppu_init() != 0)
@@ -970,16 +933,8 @@ int main(int argc, char *argv[])
return -1;
console_printf(Console_Default, "[ OK ]\n");
if (PALETTE_FILENAME == NULL)
{
set_palette(basicPalette);
}
else
{
LoadPalette(PALETTE_FILENAME, pal);
set_palette(pal);
}
// set_palette(basicPalette);
#ifdef USE_SOUND
InitSound(44400,!0);
@@ -990,7 +945,7 @@ int main(int argc, char *argv[])
#endif
// Actually no real debugguer...
//console_printf(Console_Default, "Press ESC to pause emulation and jump to debugguer\n");
install_int(ips_fps_counter, 1000);
ScanLine = 0;
/* Initialize the CPU */
@@ -1013,6 +968,10 @@ int main(int argc, char *argv[])
*/
gettimeofday(&timeStart, NULL);
#ifdef RUN_COVERAGE
alarm(1 * 60); /* Run for 1 minutes */
#endif
while(!WantClosing)
{
@@ -1027,7 +986,6 @@ int main(int argc, char *argv[])
}
return 0;
}
END_OF_MAIN()
/* Access directly to Memory pages *HACKISH* */
extern byte *memory_pages[0xFF];
@@ -1079,7 +1037,7 @@ void MemoryPageZeroWrite (unsigned short Addr, byte Value)
void Loop6502(quick6502_cpu *R)
{
byte ret;
short skey;
// short skey;
long WaitTime;
static long delta=0;
@@ -1122,7 +1080,7 @@ void Loop6502(quick6502_cpu *R)
#endif
/* If we press Page Up, we want to accelerate "time" */
if ((!key[KEY_PGUP]) && (!key[KEY_Y]))
if (!getKeyStatus('Y'))
if ((WaitTime >= 0) && (WaitTime < 100000))
usleep(WaitTime);
@@ -1148,13 +1106,12 @@ void Loop6502(quick6502_cpu *R)
ScanLine++;
//console_printf(Console_Default, "SL:%d HBT:%d VbT:%d\n", ScanLine, HBLANK_TIME, VBLANK_TIME);
if (keypressed())
{
skey = (readkey() & 0xFF);
// TODO: NO DEBUGER
/* if (skey == 27)
R->Trace = 1;*/
if (getKeyStatus(GLFW_KEY_ESCAPE))
exit(0);
#if 0
if (skey == '9')
{
VBLANK_TIME += 2;
@@ -1178,17 +1135,16 @@ void Loop6502(quick6502_cpu *R)
HBLANK_TIME -= 1;
console_printf(Console_Default, "HBLT: %d\n", HBLANK_TIME);
}
if ((skey == 'r') || (skey == 'R'))
#endif
if (getKeyStatus('r') || getKeyStatus('R'))
{
/* Force the PPU to stop NMIs */
MemoryWrite(0x2000, 0x00);
quick6502_reset(R);
}
plugin_keypress(skey);
}
// plugin_keypress(skey);
if (ret != 0)
quick6502_int(R, ret);

View File

@@ -2,7 +2,7 @@
# TI-NES CMake
#
# Created by Manoel TRAPIER.
# Copyright (c) 2003-2008 986Corp. All rights reserved.
# Copyright (c) 2003-2016 986-Studio. All rights reserved.
#
# $LastChangedDate$
# $Author$
@@ -10,4 +10,9 @@
# $Revision$
file(GLOB mappers_list mappers/*.c)
add_library(mappermanager utils.c manager.c ${mappers_list} )
if (COVERALLS)
set(COVERAGE_SRCS src/mappersmanager/manager.c src/mappersmanager/utils.c ${COVERAGE_SRCS} PARENT_SCOPE)
endif()
add_library(mappermanager utils.c manager.c ${mappers_list} )

View File

@@ -3,7 +3,7 @@
* manager.c
*
* Created by Manoel TRAPIER.
* Copyright (c) 2003-2008 986Corp. All rights reserved.
* Copyright (c) 2003-2016 986-Studio. All rights reserved.
*
* $LastChangedDate$
* $Author$

View File

@@ -3,7 +3,7 @@
* aorom.c
*
* Created by Manoel TRAPIER.
* Copyright (c) 2003-2008 986Corp. All rights reserved.
* Copyright (c) 2003-2016 986-Studio. All rights reserved.
*
* $LastChangedDate$
* $Author$
@@ -55,7 +55,7 @@ void aorom_MapperWriteHook(register byte Addr, register byte Value)
aorom_load_bank = BankNb;
console_printf(Console_Default, "aorom: Asking bank %d - NT is 0x%04X\n",BankNb,(Value&0x10)?0x2400:0x2000);
//console_printf(Console_Default, "aorom: Asking bank %d - NT is 0x%04X\n",BankNb,(Value&0x10)?0x2400:0x2000);
set_prom_bank_32k(0x8000,BankNb);
}

View File

@@ -3,7 +3,7 @@
* aorom.h
*
* Created by Manoel TRAPIER.
* Copyright (c) 2003-2008 986Corp. All rights reserved.
* Copyright (c) 2003-2016 986-Studio. All rights reserved.
*
* $LastChangedDate$
* $Author$

View File

@@ -3,7 +3,7 @@
* cnrom.c
*
* Created by Manoel TRAPIER.
* Copyright (c) 2003-2008 986Corp. All rights reserved.
* Copyright (c) 2003-2016 986-Studio. All rights reserved.
*
* $LastChangedDate$
* $Author$

View File

@@ -3,7 +3,7 @@
* cnrom.h
*
* Created by Manoel TRAPIER.
* Copyright (c) 2003-2008 986Corp. All rights reserved.
* Copyright (c) 2003-2016 986-Studio. All rights reserved.
*
* $LastChangedDate$
* $Author$

View File

@@ -3,7 +3,7 @@
* iremh3001.c
*
* Created by Manoel TRAPIER.
* Copyright (c) 2003-2008 986Corp. All rights reserved.
* Copyright (c) 2003-2016 986-Studio. All rights reserved.
*
* $LastChangedDate$
* $Author$

View File

@@ -3,7 +3,7 @@
* iremh3001.h
*
* Created by Manoel TRAPIER.
* Copyright (c) 2003-2008 986Corp. All rights reserved.
* Copyright (c) 2003-2016 986-Studio. All rights reserved.
*
* $LastChangedDate$
* $Author$

View File

@@ -3,7 +3,7 @@
* mmc1.h
*
* Created by Manoel TRAPIER.
* Copyright (c) 2003-2008 986Corp. All rights reserved.
* Copyright (c) 2003-2016 986-Studio. All rights reserved.
*
* $LastChangedDate$
* $Author$

View File

@@ -3,7 +3,7 @@
* mmc1.h
*
* Created by Manoel TRAPIER.
* Copyright (c) 2003-2008 986Corp. All rights reserved.
* Copyright (c) 2003-2016 986-Studio. All rights reserved.
*
* $LastChangedDate$
* $Author$

View File

@@ -3,7 +3,7 @@
* mmc3.h
*
* Created by Manoel TRAPIER.
* Copyright (c) 2003-2008 986Corp. All rights reserved.
* Copyright (c) 2003-2016 986-Studio. All rights reserved.
*
* $LastChangedDate$
* $Author$

View File

@@ -3,7 +3,7 @@
* mmc3.h
*
* Created by Manoel TRAPIER.
* Copyright (c) 2003-2008 986Corp. All rights reserved.
* Copyright (c) 2003-2016 986-Studio. All rights reserved.
*
* $LastChangedDate$
* $Author$

View File

@@ -3,7 +3,7 @@
* mmc4.h
*
* Created by Manoel TRAPIER.
* Copyright (c) 2007-2008 986Corp. All rights reserved.
* Copyright (c) 2003-2016 986-Studio. All rights reserved.
*
* $LastChangedDate$
* $Author$

View File

@@ -3,7 +3,7 @@
* mmc4.h
*
* Created by Manoel TRAPIER.
* Copyright (c) 2007-2008 986Corp. All rights reserved.
* Copyright (c) 2003-2016 986-Studio. All rights reserved.
*
* $LastChangedDate$
* $Author$

View File

@@ -3,7 +3,7 @@
* norom.c
*
* Created by Manoel TRAPIER.
* Copyright (c) 2003-2008 986Corp. All rights reserved.
* Copyright (c) 2003-2016 986-Studio. All rights reserved.
*
* $LastChangedDate$
* $Author$

View File

@@ -3,7 +3,7 @@
* norom.c
*
* Created by Manoel TRAPIER.
* Copyright (c) 2003-2008 986Corp. All rights reserved.
* Copyright (c) 2003-2016 986-Studio. All rights reserved.
*
* $LastChangedDate$
* $Author$

View File

@@ -3,7 +3,7 @@
* unrom.h
*
* Created by Manoel TRAPIER.
* Copyright (c) 2003-2008 986Corp. All rights reserved.
* Copyright (c) 2003-2016 986-Studio. All rights reserved.
*
* $LastChangedDate$
* $Author$

View File

@@ -3,7 +3,7 @@
* unrom.h
*
* Created by Manoel TRAPIER.
* Copyright (c) 2003-2008 986Corp. All rights reserved.
* Copyright (c) 2003-2016 986-Studio. All rights reserved.
*
* $LastChangedDate$
* $Author$

View File

@@ -3,7 +3,7 @@
* mappers_list.h
*
* Created by Manoel TRAPIER on 25/10/07.
* Copyright (c) 2003-2008 986Corp. All rights reserved.
* Copyright (c) 2003-2016 986-Studio. All rights reserved.
*
* $LastChangedDate$
* $Author$

View File

@@ -3,7 +3,7 @@
* mappers.c
*
* Created by Manoel TRAPIER.
* Copyright (c) 2003-2008 986Corp. All rights reserved.
* Copyright (c) 2003-2016 986-Studio. All rights reserved.
*
* $LastChangedDate$
* $Author$

View File

@@ -2,11 +2,15 @@
# TI-NES CMake
#
# Created by Manoel TRAPIER.
# Copyright (c) 2003-2008 986Corp. All rights reserved.
# Copyright (c) 2003-2016 986-Studio. All rights reserved.
#
# $LastChangedDate$
# $Author$
# $HeadURL$
# $Revision$
add_library(memorymanager memory.c)
if (COVERALLS)
set(COVERAGE_SRCS src/memorymanager/memory.c ${COVERAGE_SRCS} PARENT_SCOPE)
endif()
add_library(memorymanager memory.c)

View File

@@ -3,7 +3,7 @@
* memory.c - Taken from the Quick6502 project
*
* Created by Manoel Trapier on 18/09/06.
* Copyright 2003-2008 986 Corp. All rights reserved.
* Copyright (c) 2003-2016 986-Studio. All rights reserved.
*
* $LastChangedDate$
* $Author$
@@ -40,7 +40,7 @@ byte memory_pages_attr[0x100];
func_rdhook rdh_table[0x100];
func_wrhook wrh_table[0x100];
#define DEBUG
//#define DEBUG
#undef DEBUG
#ifdef DEBUG

View File

@@ -2,11 +2,18 @@
# TI-NES CMake
#
# Created by Manoel TRAPIER.
# Copyright (c) 2003-2008 986Corp. All rights reserved.
# Copyright (c) 2003-2016 986-Studio. All rights reserved.
#
# $LastChangedDate$
# $Author$
# $HeadURL$
# $Revision$
add_library(oslib loadfile.c graphics.c sound.c io.c)
if (COVERALLS)
set(COVERAGE_SRCS src/os/unix/loadfile.c src/os/unix/graphics_dummy.c src/os/unix/sound.c src/os/unix/io.c ${COVERAGE_SRCS} PARENT_SCOPE)
add_library(oslib loadfile.c graphics_dummy.c sound.c io.c)
else()
add_library(oslib loadfile.c graphics.c sound.c io.c)
endif()
target_link_libraries(oslib glfw ${OPENGL_glu_LIBRARY} ${OPENGL_gl_LIBRARY})

View File

@@ -3,7 +3,7 @@
* os/macos/graphics.c
*
* Created by Manoel TRAPIER on 08/05/08.
* Copyright (c) 2003-2008 986Corp. All rights reserved.
* Copyright (c) 2003-2016 986-Studio. All rights reserved.
*
* $LastChangedDate$
* $Author$
@@ -11,19 +11,426 @@
* $Revision$
*
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdint.h>
#include <os_dependent.h>
#include <GLFW/glfw3.h>
//#include <OpenGL/glext.h>
#include <palette.h>
typedef struct GLWindow_t GLWindow;
struct KeyArray
{
unsigned char lastState;
unsigned char curState;
unsigned char debounced;
GLFWwindow* window;
};
struct GLWindow_t
{
struct KeyArray keyArray[512];
GLFWwindow* windows;
unsigned char *videoMemory;
GLint videoTexture;
int WIDTH;
int HEIGHT;
};
#ifndef GL_TEXTURE_RECTANGLE_EXT
#define GL_TEXTURE_RECTANGLE_EXT GL_TEXTURE_RECTANGLE_NV
#endif
static int window_num = 0;
void GLWindowInitEx(GLWindow *g, int w, int h)
{
g->WIDTH = w;
g->HEIGHT = h;
g->videoTexture = window_num++;
}
void GLWindowInit(GLWindow *g)
{
GLWindowInitEx(g, 100, 100);
}
void ShowScreen(GLWindow *g, int w, int h)
{
glBindTexture(GL_TEXTURE_RECTANGLE_EXT, g->videoTexture);
// glTexSubImage2D is faster when not using a texture range
glTexSubImage2D(GL_TEXTURE_RECTANGLE_EXT, 0, 0, 0, w, h, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, g->videoMemory);
glBegin(GL_QUADS);
glTexCoord2f(0.0f, 0.0f);
glVertex2f(-1.0f,1.0f);
glTexCoord2f(0.0f, h);
glVertex2f(-1.0f, -1.0f);
glTexCoord2f(w, h);
glVertex2f(1.0f, -1.0f);
glTexCoord2f(w, 0.0f);
glVertex2f(1.0f, 1.0f);
glEnd();
glFlush();
}
void setupGL(GLWindow *g, int w, int h)
{
g->videoMemory = (unsigned char*)malloc(w*h*sizeof(unsigned int));
memset(g->videoMemory, 0,w*h*sizeof(unsigned int));
//Tell OpenGL how to convert from coordinates to pixel values
glViewport(0, 0, w, h);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
glClearColor(1.0f, 0.f, 1.0f, 1.0f);
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glDisable(GL_TEXTURE_2D);
glEnable(GL_TEXTURE_RECTANGLE_EXT);
glBindTexture(GL_TEXTURE_RECTANGLE_EXT, g->videoTexture);
// glTextureRangeAPPLE(GL_TEXTURE_RECTANGLE_NV_EXT, 0, NULL);
// glTexParameteri(GL_TEXTURE_RECTANGLE_NV_EXT, GL_TEXTURE_STORAGE_HINT_APPLE , GL_STORAGE_CACHED_APPLE);
// glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE);
glTexParameteri(GL_TEXTURE_RECTANGLE_EXT, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_RECTANGLE_EXT, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_RECTANGLE_EXT, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_RECTANGLE_EXT, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
glTexImage2D(GL_TEXTURE_RECTANGLE_EXT, 0, GL_RGBA, w,
h, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, g->videoMemory);
glDisable(GL_DEPTH_TEST);
}
void restoreGL(GLWindow *g, int w, int h)
{
//Tell OpenGL how to convert from coordinates to pixel values
glViewport(0, 0, w, h);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
glClearColor(1.0f, 0.f, 1.0f, 1.0f);
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glDisable(GL_TEXTURE_2D);
glEnable(GL_TEXTURE_RECTANGLE_EXT);
glDisable(GL_DEPTH_TEST);
}
void kbHandler(GLFWwindow* window, int key, int scan, int action, int mod )
{
struct KeyArray *keyArray;
keyArray = (struct KeyArray*) glfwGetWindowUserPointer(window);
keyArray[key].lastState=keyArray[key].curState;
if (action==GLFW_RELEASE)
{
keyArray[key].curState=GLFW_RELEASE;
}
else
{
keyArray[key].curState=GLFW_PRESS;
}
keyArray[key].debounced |= (keyArray[key].lastState==GLFW_RELEASE)&&(keyArray[key].curState==GLFW_PRESS);
keyArray[key].window = window;
}
void sizeHandler(GLFWwindow* window,int xs,int ys)
{
glfwMakeContextCurrent(window);
glViewport(0, 0, xs, ys);
}
void initDisplay(GLWindow *g)
{
int h = g->HEIGHT;
int w = g->WIDTH;
/// Initialize GLFW
glfwInit();
// Open screen OpenGL window
if( !(g->windows=glfwCreateWindow( g->WIDTH, g->HEIGHT, "Main", NULL, NULL)) )
{
glfwTerminate();
fprintf(stderr, "Window creation error...\n");
return;
}
glfwMakeContextCurrent(g->windows);
setupGL(g, g->WIDTH, g->HEIGHT);
glfwSwapInterval(0); // Disable VSYNC
glfwGetWindowSize(g->windows, &w, &h);
glfwSetWindowUserPointer(g->windows, g->keyArray);
glfwSetKeyCallback(g->windows, kbHandler);
glfwSetWindowSizeCallback(g->windows, sizeHandler);
}
void drawPixel(GLWindow *gw, int x, int y, uint32_t colour)
{
uint8_t r,g,b,a;
uint32_t offset = (y*gw->WIDTH*4)+4*x;
if ((x < 0) || (x > gw->WIDTH) || (y < 0) || (y > gw->HEIGHT))
return;
b = colour & 0xFF;
g = (colour >> 8) & 0xFF;
r = (colour >> 16) & 0xFF;
a = (colour >> 24) & 0xFF;
gw->videoMemory[offset + 0] = a;
gw->videoMemory[offset + 1] = r;
gw->videoMemory[offset + 2] = g;
gw->videoMemory[offset + 3] = b;
}
void drawLine(GLWindow *g, int x0, int y0, int x1, int y1, uint32_t colour)
{
int d, dx, dy, aincr, bincr, xincr, yincr, x, y;
if (abs(x1 - x0) < abs(y1 - y0))
{
/* parcours par l'axe vertical */
if (y0 > y1)
{
drawLine(g, x1, y1, x0, y0, colour);
goto exit;
}
xincr = x1 > x0 ? 1 : -1;
dy = y1 - y0;
dx = abs(x1 - x0);
d = 2 * dx - dy;
aincr = 2 * (dx - dy);
bincr = 2 * dx;
x = x0;
y = y0;
drawPixel(g, x, y, colour);
for (y = y0+1; y <= y1; y++)
{
if (d >= 0)
{
x += xincr;
d += aincr;
}
else
{
d += bincr;
}
drawPixel(g, x, y, colour);
}
}
else
{
/* parcours par l'axe horizontal */
if (x0 > x1)
{
drawLine(g, x1, y1, x0, y0, colour);
goto exit;
}
yincr = y1 > y0 ? 1 : -1;
dx = x1 - x0;
dy = abs(y1 - y0);
d = 2 * dy - dx;
aincr = 2 * (dy - dx);
bincr = 2 * dy;
x = x0;
y = y0;
drawPixel(g, x, y, colour);
for (x = x0+1; x <= x1; ++x)
{
if (d >= 0)
{
y += yincr;
d += aincr;
}
else
{
d += bincr;
}
drawPixel(g, x, y, colour);
}
}
exit:
return;
}
void drawCircle(GLWindow *g, int xc, int yc, int radius, uint32_t colour)
{
int f = 1 - radius;
int ddF_x = 0;
int ddF_y = -2 * radius;
int x = 0;
int y = radius;
int pX, pY;
pX = xc; pY = yc + radius;
drawPixel(g, pX, pY, colour);
pY -= (2*radius);
drawPixel(g, pX, pY, colour);
pY += radius; pX += radius;
drawPixel(g, pX, pY, colour);
pX -= (2*radius);
drawPixel(g, pX, pY, colour);
while(x < y)
{
if(f >= 0)
{
y--;
ddF_y += 2;
f += ddF_y;
}
x++;
ddF_x += 2;
f += ddF_x + 1;
pX = xc+x ; pY = yc+y;
drawPixel(g, pX, pY, colour);
pX = xc-x ; pY = yc+y;
drawPixel(g, pX, pY, colour);
pX = xc+x ; pY = yc-y;
drawPixel(g, pX, pY, colour);
pX = xc-x ; pY = yc-y;
drawPixel(g, pX, pY, colour);
pX = xc+y ; pY = yc+x;
drawPixel(g, pX, pY, colour);
pX = xc-y ; pY = yc+x;
drawPixel(g, pX, pY, colour);
pX = xc+y ; pY = yc-x;
drawPixel(g, pX, pY, colour);
pX = xc-y ; pY = yc-x;
drawPixel(g, pX, pY, colour);
}
return;
}
void drawRect(GLWindow *g, int x0, int y0, int w, int h, uint32_t colour)
{
drawLine(g, x0 , y0 , x0 + w, y0 , colour);
drawLine(g, x0 + w, y0 , x0 + w, y0 + h, colour);
drawLine(g, x0 + w, y0 + h, x0 , y0 + h, colour);
drawLine(g, x0 , y0 + h, x0 , y0 , colour);
}
void drawFillrect(GLWindow *g, int x0, int y0, int w, int h, uint32_t colour)
{
int i;
for(i = 0; i < h; i++)
drawLine(g, x0, y0+i, x0+w, y0+i, colour);
}
void clearScreen(GLWindow *g)
{
memset(g->videoMemory, 0, sizeof(uint8_t) * g->WIDTH * g->HEIGHT * 4);
}
void updateScreen(GLWindow *g)
{
/*Update windows code */
glfwMakeContextCurrent(g->windows);
ShowScreen(g, g->WIDTH, g->HEIGHT);
glfwSwapBuffers(g->windows);
glfwPollEvents();
}
void updateScreenAndWait(GLWindow *g)
{
while (glfwGetKey(g->windows,GLFW_KEY_ESCAPE) != GLFW_PRESS)
{
updateScreen(g);
glfwPollEvents();
}
while(glfwGetKey(g->windows,GLFW_KEY_ESCAPE) != GLFW_RELEASE)
{
glfwPollEvents();
}
}
GLWindow mainWindow;
int graphics_init()
{
GLWindowInitEx(&mainWindow, 256, 240);
initDisplay(&mainWindow);
clearScreen(&mainWindow);
updateScreen(&mainWindow);
return 0;
}
static unsigned long getColour(long color)
{
Palette *pal = &basicPalette[color];
uint8_t r, g, b, a;
r = pal->r;
b = pal->b;
g = pal->g;
a = 255;//pal->a;
return (b << 24) | (g << 16) | (r << 8) | a;
}
int graphics_drawpixel(long x, long y, long color)
{
drawPixel(&mainWindow, x, y, getColour(color));
return 0;
}
int graphics_drawline(long x, long y, long x1, long y1, long color)
{
drawLine(&mainWindow, x, y, x1, y1, getColour(color));
return 0;
}
int graphics_blit(long x, long y, long w, long h)
{
updateScreen(&mainWindow);
return 0;
}
int getKeyStatus(int key)
{
return mainWindow.keyArray[key].curState;
}

View File

@@ -0,0 +1,138 @@
/*
* Graphic Manager - The TI-NESulator Project
* os/macos/graphics.c
*
* Created by Manoel TRAPIER on 08/05/08.
* Copyright (c) 2003-2016 986-Studio. All rights reserved.
*
* $LastChangedDate$
* $Author$
* $HeadURL$
* $Revision$
*
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdint.h>
#include <os_dependent.h>
#include <GLFW/glfw3.h>
//#include <OpenGL/glext.h>
#include <palette.h>
typedef struct GLWindow_t GLWindow;
struct KeyArray
{
unsigned char lastState;
unsigned char curState;
unsigned char debounced;
GLFWwindow* window;
};
struct GLWindow_t
{
struct KeyArray keyArray[512];
GLFWwindow* windows;
unsigned char *videoMemory;
GLint videoTexture;
int WIDTH;
int HEIGHT;
};
#ifndef GL_TEXTURE_RECTANGLE_EXT
#define GL_TEXTURE_RECTANGLE_EXT GL_TEXTURE_RECTANGLE_NV
#endif
void GLWindowInitEx(GLWindow *g, int w, int h)
{
}
void GLWindowInit(GLWindow *g)
{
}
void ShowScreen(GLWindow *g, int w, int h)
{
}
void setupGL(GLWindow *g, int w, int h)
{
}
void restoreGL(GLWindow *g, int w, int h)
{
}
void kbHandler(GLFWwindow* window, int key, int scan, int action, int mod )
{
}
void sizeHandler(GLFWwindow* window,int xs,int ys)
{
}
void initDisplay(GLWindow *g)
{
}
void drawPixel(GLWindow *gw, int x, int y, uint32_t colour)
{
}
void drawLine(GLWindow *g, int x0, int y0, int x1, int y1, uint32_t colour)
{
}
void drawCircle(GLWindow *g, int xc, int yc, int radius, uint32_t colour)
{
}
void drawRect(GLWindow *g, int x0, int y0, int w, int h, uint32_t colour)
{
}
void drawFillrect(GLWindow *g, int x0, int y0, int w, int h, uint32_t colour)
{
}
void clearScreen(GLWindow *g)
{
}
void updateScreen(GLWindow *g)
{
}
void updateScreenAndWait(GLWindow *g)
{
}
int graphics_init()
{
return 0;
}
int graphics_drawpixel(long x, long y, long color)
{
return 0;
}
int graphics_drawline(long x, long y, long x1, long y1, long color)
{
return 0;
}
int graphics_blit(long x, long y, long w, long h)
{
return 0;
}
int getKeyStatus(int key)
{
return 0;
}

View File

@@ -3,7 +3,7 @@
* os/macos/graphics.c
*
* Created by Manoël Trapier on 04/01/09.
* Copyright (c) 2003-2009 986 Corp. All rights reserved.
* Copyright (c) 2003-2016 986-Studio. All rights reserved.
*
* $LastChangedDate$
* $Author$
@@ -40,11 +40,10 @@ int console_vprintf(const ConsoleLevel level, const char *format, va_list ap)
int console_printf(const ConsoleLevel level, const char *format, ...)
{
int ret = 0;
va_list ap;
va_start(ap, format);
ret = console_vprintf(level, format, ap);
console_vprintf(level, format, ap);
va_end(ap);
return 0;
@@ -58,4 +57,4 @@ int console_printf_d(const char *format, ...)
console_vprintf (Console_Debug, format, ap);
return 0;
}
}

View File

@@ -1,3 +1,6 @@
/*
* Copyright (c) 2003-2016 986-Studio. All rights reserved.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -27,5 +30,10 @@ void *LoadFilePtr(char * filename)
close(fd);
if ( RetPtr == MAP_FAILED )
{
RetPtr = NULL;
}
return RetPtr;
}

View File

@@ -2,11 +2,13 @@
# TI-NES CMake
#
# Created by Manoel TRAPIER.
# Copyright (c) 2003-2008 986Corp. All rights reserved.
# Copyright (c) 2003-2016 986-Studio. All rights reserved.
#
# $LastChangedDate$
# $Author$
# $HeadURL$
# $Revision$
add_library(oslib loadfile.c)
add_library(oslib loadfile.c graphics.c sound.c io.c)
target_link_libraries(oslib glfw ${OPENGL_glu_LIBRARY})

436
src/os/win32/graphics.c Normal file
View File

@@ -0,0 +1,436 @@
/*
* Graphic Manager - The TI-NESulator Project
* os/macos/graphics.c
*
* Created by Manoel TRAPIER on 08/05/08.
* Copyright (c) 2003-2016 986-Studio. All rights reserved.
*
* $LastChangedDate$
* $Author$
* $HeadURL$
* $Revision$
*
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdint.h>
#include <os_dependent.h>
#include <GLFW/glfw3.h>
#include <OpenGL/glext.h>
#include <palette.h>
typedef struct GLWindow_t GLWindow;
struct KeyArray
{
unsigned char lastState;
unsigned char curState;
unsigned char debounced;
GLFWwindow* window;
};
struct GLWindow_t
{
struct KeyArray keyArray[512];
GLFWwindow* windows;
unsigned char *videoMemory;
GLint videoTexture;
int WIDTH;
int HEIGHT;
};
#ifndef GL_TEXTURE_RECTANGLE_EXT
#define GL_TEXTURE_RECTANGLE_EXT GL_TEXTURE_RECTANGLE_NV
#endif
static int window_num = 0;
void GLWindowInitEx(GLWindow *g, int w, int h)
{
g->WIDTH = w;
g->HEIGHT = h;
g->videoTexture = window_num++;
}
void GLWindowInit(GLWindow *g)
{
GLWindowInitEx(g, 100, 100);
}
void ShowScreen(GLWindow *g, int w, int h)
{
glBindTexture(GL_TEXTURE_RECTANGLE_EXT, g->videoTexture);
// glTexSubImage2D is faster when not using a texture range
glTexSubImage2D(GL_TEXTURE_RECTANGLE_EXT, 0, 0, 0, w, h, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, g->videoMemory);
glBegin(GL_QUADS);
glTexCoord2f(0.0f, 0.0f);
glVertex2f(-1.0f,1.0f);
glTexCoord2f(0.0f, h);
glVertex2f(-1.0f, -1.0f);
glTexCoord2f(w, h);
glVertex2f(1.0f, -1.0f);
glTexCoord2f(w, 0.0f);
glVertex2f(1.0f, 1.0f);
glEnd();
glFlush();
}
void setupGL(GLWindow *g, int w, int h)
{
g->videoMemory = (unsigned char*)malloc(w*h*sizeof(unsigned int));
memset(g->videoMemory, 0,w*h*sizeof(unsigned int));
//Tell OpenGL how to convert from coordinates to pixel values
glViewport(0, 0, w, h);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
glClearColor(1.0f, 0.f, 1.0f, 1.0f);
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glDisable(GL_TEXTURE_2D);
glEnable(GL_TEXTURE_RECTANGLE_EXT);
glBindTexture(GL_TEXTURE_RECTANGLE_EXT, g->videoTexture);
// glTextureRangeAPPLE(GL_TEXTURE_RECTANGLE_NV_EXT, 0, NULL);
// glTexParameteri(GL_TEXTURE_RECTANGLE_NV_EXT, GL_TEXTURE_STORAGE_HINT_APPLE , GL_STORAGE_CACHED_APPLE);
// glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE);
glTexParameteri(GL_TEXTURE_RECTANGLE_EXT, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_RECTANGLE_EXT, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_RECTANGLE_EXT, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_RECTANGLE_EXT, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
glTexImage2D(GL_TEXTURE_RECTANGLE_EXT, 0, GL_RGBA, w,
h, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, g->videoMemory);
glDisable(GL_DEPTH_TEST);
}
void restoreGL(GLWindow *g, int w, int h)
{
//Tell OpenGL how to convert from coordinates to pixel values
glViewport(0, 0, w, h);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
glClearColor(1.0f, 0.f, 1.0f, 1.0f);
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glDisable(GL_TEXTURE_2D);
glEnable(GL_TEXTURE_RECTANGLE_EXT);
glDisable(GL_DEPTH_TEST);
}
void kbHandler(GLFWwindow* window, int key, int scan, int action, int mod )
{
struct KeyArray *keyArray;
keyArray = (struct KeyArray*) glfwGetWindowUserPointer(window);
keyArray[key].lastState=keyArray[key].curState;
if (action==GLFW_RELEASE)
{
keyArray[key].curState=GLFW_RELEASE;
}
else
{
keyArray[key].curState=GLFW_PRESS;
}
keyArray[key].debounced |= (keyArray[key].lastState==GLFW_RELEASE)&&(keyArray[key].curState==GLFW_PRESS);
keyArray[key].window = window;
}
void sizeHandler(GLFWwindow* window,int xs,int ys)
{
glfwMakeContextCurrent(window);
glViewport(0, 0, xs, ys);
}
void initDisplay(GLWindow *g)
{
int h = g->HEIGHT;
int w = g->WIDTH;
/// Initialize GLFW
glfwInit();
// Open screen OpenGL window
if( !(g->windows=glfwCreateWindow( g->WIDTH, g->HEIGHT, "Main", NULL, NULL)) )
{
glfwTerminate();
fprintf(stderr, "Window creation error...\n");
return;
}
glfwMakeContextCurrent(g->windows);
setupGL(g, g->WIDTH, g->HEIGHT);
glfwSwapInterval(0); // Disable VSYNC
glfwGetWindowSize(g->windows, &w, &h);
glfwSetWindowUserPointer(g->windows, g->keyArray);
glfwSetKeyCallback(g->windows, kbHandler);
glfwSetWindowSizeCallback(g->windows, sizeHandler);
}
void drawPixel(GLWindow *gw, int x, int y, uint32_t colour)
{
uint8_t r,g,b,a;
uint32_t offset = (y*gw->WIDTH*4)+4*x;
if ((x < 0) || (x > gw->WIDTH) || (y < 0) || (y > gw->HEIGHT))
return;
b = colour & 0xFF;
g = (colour >> 8) & 0xFF;
r = (colour >> 16) & 0xFF;
a = (colour >> 24) & 0xFF;
gw->videoMemory[offset + 0] = a;
gw->videoMemory[offset + 1] = r;
gw->videoMemory[offset + 2] = g;
gw->videoMemory[offset + 3] = b;
}
void drawLine(GLWindow *g, int x0, int y0, int x1, int y1, uint32_t colour)
{
int d, dx, dy, aincr, bincr, xincr, yincr, x, y;
if (abs(x1 - x0) < abs(y1 - y0))
{
/* parcours par l'axe vertical */
if (y0 > y1)
{
drawLine(g, x1, y1, x0, y0, colour);
goto exit;
}
xincr = x1 > x0 ? 1 : -1;
dy = y1 - y0;
dx = abs(x1 - x0);
d = 2 * dx - dy;
aincr = 2 * (dx - dy);
bincr = 2 * dx;
x = x0;
y = y0;
drawPixel(g, x, y, colour);
for (y = y0+1; y <= y1; y++)
{
if (d >= 0)
{
x += xincr;
d += aincr;
}
else
{
d += bincr;
}
drawPixel(g, x, y, colour);
}
}
else
{
/* parcours par l'axe horizontal */
if (x0 > x1)
{
drawLine(g, x1, y1, x0, y0, colour);
goto exit;
}
yincr = y1 > y0 ? 1 : -1;
dx = x1 - x0;
dy = abs(y1 - y0);
d = 2 * dy - dx;
aincr = 2 * (dy - dx);
bincr = 2 * dy;
x = x0;
y = y0;
drawPixel(g, x, y, colour);
for (x = x0+1; x <= x1; ++x)
{
if (d >= 0)
{
y += yincr;
d += aincr;
}
else
{
d += bincr;
}
drawPixel(g, x, y, colour);
}
}
exit:
return;
}
void drawCircle(GLWindow *g, int xc, int yc, int radius, uint32_t colour)
{
int f = 1 - radius;
int ddF_x = 0;
int ddF_y = -2 * radius;
int x = 0;
int y = radius;
int pX, pY;
pX = xc; pY = yc + radius;
drawPixel(g, pX, pY, colour);
pY -= (2*radius);
drawPixel(g, pX, pY, colour);
pY += radius; pX += radius;
drawPixel(g, pX, pY, colour);
pX -= (2*radius);
drawPixel(g, pX, pY, colour);
while(x < y)
{
if(f >= 0)
{
y--;
ddF_y += 2;
f += ddF_y;
}
x++;
ddF_x += 2;
f += ddF_x + 1;
pX = xc+x ; pY = yc+y;
drawPixel(g, pX, pY, colour);
pX = xc-x ; pY = yc+y;
drawPixel(g, pX, pY, colour);
pX = xc+x ; pY = yc-y;
drawPixel(g, pX, pY, colour);
pX = xc-x ; pY = yc-y;
drawPixel(g, pX, pY, colour);
pX = xc+y ; pY = yc+x;
drawPixel(g, pX, pY, colour);
pX = xc-y ; pY = yc+x;
drawPixel(g, pX, pY, colour);
pX = xc+y ; pY = yc-x;
drawPixel(g, pX, pY, colour);
pX = xc-y ; pY = yc-x;
drawPixel(g, pX, pY, colour);
}
return;
}
void drawRect(GLWindow *g, int x0, int y0, int w, int h, uint32_t colour)
{
drawLine(g, x0 , y0 , x0 + w, y0 , colour);
drawLine(g, x0 + w, y0 , x0 + w, y0 + h, colour);
drawLine(g, x0 + w, y0 + h, x0 , y0 + h, colour);
drawLine(g, x0 , y0 + h, x0 , y0 , colour);
}
void drawFillrect(GLWindow *g, int x0, int y0, int w, int h, uint32_t colour)
{
int i;
for(i = 0; i < h; i++)
drawLine(g, x0, y0+i, x0+w, y0+i, colour);
}
void clearScreen(GLWindow *g)
{
memset(g->videoMemory, 0, sizeof(uint8_t) * g->WIDTH * g->HEIGHT * 4);
}
void updateScreen(GLWindow *g)
{
/*Update windows code */
glfwMakeContextCurrent(g->windows);
ShowScreen(g, g->WIDTH, g->HEIGHT);
glfwSwapBuffers(g->windows);
glfwPollEvents();
}
void updateScreenAndWait(GLWindow *g)
{
while (glfwGetKey(g->windows,GLFW_KEY_ESCAPE) != GLFW_PRESS)
{
updateScreen(g);
glfwPollEvents();
}
while(glfwGetKey(g->windows,GLFW_KEY_ESCAPE) != GLFW_RELEASE)
{
glfwPollEvents();
}
}
GLWindow mainWindow;
int graphics_init()
{
GLWindowInitEx(&mainWindow, 256, 240);
initDisplay(&mainWindow);
clearScreen(&mainWindow);
updateScreen(&mainWindow);
return 0;
}
static unsigned long getColour(long color)
{
Palette *pal = &basicPalette[color];
uint8_t r, g, b, a;
r = pal->r;
b = pal->b;
g = pal->g;
a = 255;//pal->a;
return (b << 24) | (g << 16) | (r << 8) | a;
}
int graphics_drawpixel(long x, long y, long color)
{
drawPixel(&mainWindow, x, y, getColour(color));
return 0;
}
int graphics_drawline(long x, long y, long x1, long y1, long color)
{
drawLine(&mainWindow, x, y, x1, y1, getColour(color));
return 0;
}
int graphics_blit(long x, long y, long w, long h)
{
updateScreen(&mainWindow);
return 0;
}
int getKeyStatus(int key)
{
return mainWindow.keyArray[key].curState;
}

61
src/os/win32/io.c Normal file
View File

@@ -0,0 +1,61 @@
/*
* IO Manager - The TI-NESulator Project
* os/macos/graphics.c
*
* Created by Manoël Trapier on 04/01/09.
* Copyright (c) 2003-2016 986-Studio. All rights reserved.
*
* $LastChangedDate$
* $Author$
* $HeadURL$
* $Revision$
*
*/
#include <stdio.h>
#include <stdarg.h>
#include <os_dependent.h>
char LevelChar[] = { 'E', 'W', 'A', 'N', 'V', 'D'};
ConsoleLevel console_ActualLevel = Console_Default;
/* Actually nothing to do */
int console_init(ConsoleLevel DefaultLevel)
{
console_ActualLevel = DefaultLevel;
return 0;
}
/* Actually a simple printf with levels */
int console_vprintf(const ConsoleLevel level, const char *format, va_list ap)
{
if (console_ActualLevel >= level)
vprintf(format, ap);
return 0;
}
int console_printf(const ConsoleLevel level, const char *format, ...)
{
int ret = 0;
va_list ap;
va_start(ap, format);
ret = console_vprintf(level, format, ap);
va_end(ap);
return 0;
}
int console_printf_d(const char *format, ...)
{
va_list ap;
va_start(ap, format);
console_vprintf (Console_Debug, format, ap);
return 0;
}

34
src/os/win32/loadfile.c Normal file
View File

@@ -0,0 +1,34 @@
/*
* Copyright (c) 2003-2016 986-Studio. All rights reserved.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h>
/* Map a file in memory */
void *LoadFilePtr(char * filename)
{
int fd;
void *RetPtr = NULL;
struct stat FileStat;
fd = open(filename, O_RDONLY);
fstat(fd, &FileStat);
RetPtr = mmap(NULL, FileStat.st_size, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd, 0);
close(fd);
return RetPtr;
}

0
src/os/win32/sound.c Normal file
View File

View File

@@ -3,7 +3,7 @@
* paddle.c
*
* Created by Manoel TRAPIER.
* Copyright (c) 2003-2008 986Corp. All rights reserved.
* Copyright (c) 2003-2016 986-Studio. All rights reserved.
*
* $LastChangedDate$
* $Author$
@@ -12,117 +12,83 @@
*
*/
/* Allegro includes */
#ifdef __APPLE__
#define USE_CONSOLE
#include <Allegro/allegro.h>
#else
#define USE_CONSOLE
#include <allegro.h>
#endif
#include <os_dependent.h>
#include "paddle.h"
void InitPaddle(Paddle * pdl)
void InitPaddle(Paddle *pdl)
{
pdl->Bit = 1;
pdl->LastWrite = 0;
}
pdl->Bit = 1;
pdl->LastWrite = 0;
}
void WritePaddle(Paddle *pdl, unsigned char val)
void WritePaddle(Paddle *pdl, unsigned char val)
{
if ((pdl->LastWrite == 1) && (val == 0))
InitPaddle(pdl);
pdl->LastWrite = val;
}
unsigned char ReadPaddle(Paddle * pdl)
if ( ( pdl->LastWrite == 1 ) && ( val == 0 ) )
InitPaddle(pdl);
pdl->LastWrite = val;
}
unsigned char ReadPaddle(Paddle *pdl)
{
switch (pdl->Bit++)
{
case 1:
if (key[KEY_Z])
return 0x41;
break;
case 2:
if (key[KEY_X])
return 0x41;
break;
case 3:
if (key[KEY_P])
return 0x41;
break;
case 4:
if (key[KEY_ENTER])
return 0x41;
break;
case 5:
if (key[KEY_UP])
return 0x41;
break;
case 6:
if (key[KEY_DOWN])
return 0x41;
break;
case 7:
if (key[KEY_LEFT])
return 0x41;
break;
case 8:
if (key[KEY_RIGHT])
return 0x41;
break;
case 20:
return 0x40;
break;
case 24:
pdl->Bit = 1;
return 0x40;
default:
return 0x40;
break;
}
switch(pdl->Bit++)
{
case 1:
if ( getKeyStatus('O') )
return 0x41;
break;
case 2:
if ( getKeyStatus('P') )
return 0x41;
break;
case 3:
if ( getKeyStatus('I') )
return 0x41;
break;
case 4:
if ( getKeyStatus('U') )
return 0x41;
break;
case 5:
if ( getKeyStatus('W') )
return 0x41;
break;
case 6:
if ( getKeyStatus('S') )
return 0x41;
break;
case 7:
if ( getKeyStatus('A') )
return 0x41;
break;
case 8:
if ( getKeyStatus('D') )
return 0x41;
break;
case 20:
return 0x40;
break;
case 24:
pdl->Bit = 1;
return 0x40;
default:
return 0x40;
break;
}
return 0x40;
}

View File

@@ -2,7 +2,7 @@
# TI-NES CMake
#
# Created by Manoel TRAPIER.
# Copyright (c) 2003-2008 986Corp. All rights reserved.
# Copyright (c) 2003-2016 986-Studio. All rights reserved.
#
# $LastChangedDate$
# $Author$
@@ -10,4 +10,9 @@
# $Revision$
file(GLOB plugins_list plugins/*.c)
add_library(pluginsmanager manager.c ${plugins_list})
if (COVERALLS)
set(COVERAGE_SRCS src/pluginsmanager/manager.c ${COVERAGE_SRCS} PARENT_SCOPE)
endif()
add_library(pluginsmanager manager.c ${plugins_list})

View File

@@ -3,7 +3,7 @@
* plugins.c
*
* Created by Manoel TRAPIER on 02/04/07.
* Copyright (c) 2003-2008 986Corp. All rights reserved.
* Copyright (c) 2003-2016 986-Studio. All rights reserved.
*
* $LastChangedDate$
* $Author$

View File

@@ -3,7 +3,7 @@
* gamegenie.c: Hack your games with unlimited lives of add new powers!
*
* Created by Manoel Trapier.
* Copyright 2003-2008 986 Corp. All rights reserved.
* Copyright (c) 2003-2016 986-Studio. All rights reserved.
*
* $LastChangedDate$
* $Author$
@@ -24,6 +24,7 @@
#include <memory/manager.h>
#include <types.h>
#if 0
/* Allegro includes */
#ifdef __APPLE__
#define USE_CONSOLE
@@ -824,3 +825,4 @@ int gg_Deinit()
{
return 0;
}
#endif

View File

@@ -3,7 +3,7 @@
* gamegenie.h
*
* Created by Manoel Trapier.
* Copyright 2003-2008 986 Corp. All rights reserved.
* Copyright (c) 2003-2016 986-Studio. All rights reserved.
*
* $LastChangedDate$
* $Author$

View File

@@ -3,7 +3,7 @@
* plugins_list.h
*
* Created by Manoel Trapier.
* Copyright 2003-2008 986 Corp. All rights reserved.
* Copyright (c) 2003-2016 986-Studio. All rights reserved.
*
* $LastChangedDate$
* $Author$
@@ -17,7 +17,7 @@
#include "plugins/gamegenie.h"
Plugin Plugins[] = {
{ "Game Genie", gg_Init, gg_Deinit },
// { "Game Genie", gg_Init, gg_Deinit },
/* EOL tag */
{ NULL, NULL, NULL }

View File

@@ -10,4 +10,10 @@
# $Revision$
file(GLOB ppu_debug_list debug/*.c)
add_library(ppu ppu.c ppu.memory.c ${ppu_debug_list})
if (COVERALLS)
set(COVERAGE_SRCS src/ppu/ppu.c src/ppu/ppu.memory.c ${COVERAGE_SRCS} PARENT_SCOPE)
endif()
add_library(ppu ppu.c ppu.memory.c ${ppu_debug_list})

View File

@@ -15,6 +15,7 @@
#include <stdio.h>
#include <stdlib.h>
#if 0
/* Allegro includes */
#ifdef __APPLE__
#define USE_CONSOLE
@@ -367,3 +368,4 @@ void ppu_dumpPalette(int x, int y)
rectfill(Buffer, x + 91 + (i % 4) * 20, y + 21 +(i / 4) * 20, x + 91 + (i % 4) * 20 + 20, y + 21 +(i / 4) * 20 + 20, ppu_readMemory(0x3F, i+0x10));
}
}
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -3,7 +3,7 @@
* ppu.memory.c - Inspired from the memory manager of the Quick6502 Project.
*
* Created by Manoel Trapier on 12/04/07.
* Copyright 2003-2008 986 Corp. All rights reserved.
* Copyright (c) 2003-2016 986-Studio. All rights reserved.
*
* $LastChangedDate$
* $Author$