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!
This commit is contained in:
Godzil
2016-12-29 18:21:39 +01:00
parent 866dcfa969
commit cc9fe51828
49 changed files with 1171 additions and 946 deletions

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)