[Cosmetics]
- Update some headers that was incorrect - Reformat the code in all files to match the same code style - Removal of unwanted/unneeded files
This commit is contained in:
parent
ad195d6c20
commit
cdda587579
@ -2,7 +2,7 @@
|
|||||||
# peTI-NESulator CMake
|
# peTI-NESulator CMake
|
||||||
#
|
#
|
||||||
# Created by Manoel TRAPIER.
|
# Created by Manoel TRAPIER.
|
||||||
# Copyright (c) 2003-2018 986Corp. All rights reserved.
|
# Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
||||||
#
|
#
|
||||||
# $LastChangedDate$
|
# $LastChangedDate$
|
||||||
# $Author$
|
# $Author$
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# peTI-NESulator CMake
|
# peTI-NESulator CMake
|
||||||
#
|
#
|
||||||
# Created by Manoel TRAPIER.
|
# Created by Manoël TRAPIER.
|
||||||
# Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
# Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
||||||
#
|
#
|
||||||
# $LastChangedDate$
|
# $LastChangedDate$
|
||||||
|
|||||||
@ -2,13 +2,14 @@
|
|||||||
* Cart manager - The peTI-NESulator Project
|
* Cart manager - The peTI-NESulator Project
|
||||||
* NESCart.c
|
* NESCart.c
|
||||||
*
|
*
|
||||||
* Created by Manoel TRAPIER.
|
* Created by Manoël TRAPIER.
|
||||||
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* System Headers */
|
/* System Headers */
|
||||||
#if !defined(__TIGCC__) && !defined(__GCC4TI__) && !defined(__GTC__)
|
#if !defined(__TIGCC__) && !defined(__GCC4TI__) && !defined(__GTC__)
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <memory.h>
|
#include <memory.h>
|
||||||
@ -54,13 +55,17 @@ int LoadCart(const char *filename, NesCart * cart)
|
|||||||
|
|
||||||
|
|
||||||
if ((cart->File == NULL) || (cart->File == MAP_FAILED))
|
if ((cart->File == NULL) || (cart->File == MAP_FAILED))
|
||||||
|
{
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
sprintf(buffer, "%c%c%c%c", 0x4E, 0x45, 0x53, 0x1A);
|
sprintf(buffer, "%c%c%c%c", 0x4E, 0x45, 0x53, 0x1A);
|
||||||
|
|
||||||
/* Verify that this is a real iNES valid file */
|
/* Verify that this is a real iNES valid file */
|
||||||
if (memcmp(cart->File, buffer, 4))
|
if (memcmp(cart->File, buffer, 4) != 0)
|
||||||
|
{
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
/* Before go elsewhere, verify that the header is clean !
|
/* Before go elsewhere, verify that the header is clean !
|
||||||
(aka no DiskDude! in it) */
|
(aka no DiskDude! in it) */
|
||||||
@ -87,8 +92,8 @@ int LoadCart(const char *filename, NesCart * cart)
|
|||||||
/* Now fill the structure */
|
/* Now fill the structure */
|
||||||
cart->FileName = (char *)filename;
|
cart->FileName = (char *)filename;
|
||||||
|
|
||||||
cart->PROMSize = cart->File[4] * 16 * 1024; /* Size of PROM */
|
cart->PROMSize = cart->File[4] * 16U * 1024U; /* Size of PROM */
|
||||||
cart->VROMSize = cart->File[5] * 8 * 1024; /* Size of VROM */
|
cart->VROMSize = cart->File[5] * 8U * 1024U; /* Size of VROM */
|
||||||
cart->Flags = cart->File[6] & 0x0F;
|
cart->Flags = cart->File[6] & 0x0F;
|
||||||
|
|
||||||
/* We don't and we will never support trainer-ed ROM */
|
/* We don't and we will never support trainer-ed ROM */
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# peTI-NESulator CMake
|
# peTI-NESulator CMake
|
||||||
#
|
#
|
||||||
# Created by Manoel TRAPIER.
|
# Created by Manoël TRAPIER.
|
||||||
# Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
# Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
||||||
#
|
#
|
||||||
# $LastChangedDate$
|
# $LastChangedDate$
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
* APU emulation - The peTI-NESulator Project
|
* APU emulation - The peTI-NESulator Project
|
||||||
* apu.c
|
* apu.c
|
||||||
*
|
*
|
||||||
* Created by Manoel TRAPIER.
|
* Created by Manoël TRAPIER.
|
||||||
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
#
|
#
|
||||||
# peTI-NESulator CMake
|
# peTI-NESulator CMake
|
||||||
#
|
#
|
||||||
# Created by Manoel TRAPIER.
|
# Created by Manoël TRAPIER.
|
||||||
# Copyright (c) 2003-2008 986Corp. All rights reserved.
|
# Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
||||||
#
|
#
|
||||||
# $LastChangedDate$
|
# $LastChangedDate$
|
||||||
# $Author$
|
# $Author$
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
* CoreCPU - The Quick6502 Project
|
* CoreCPU - The Quick6502 Project
|
||||||
* corecpu.c
|
* corecpu.c
|
||||||
*
|
*
|
||||||
* Created by Manoel Trapier on 24/02/08
|
* Created by Manoël Trapier on 24/02/08
|
||||||
* Copyright 2008 986 Corp. All rights reserved.
|
* Copyright 2008 986 Corp. All rights reserved.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@ -39,8 +39,8 @@
|
|||||||
* iX: Indirect by X
|
* iX: Indirect by X
|
||||||
* iY: Indirect by Y
|
* iY: Indirect by Y
|
||||||
* zP: Zero Page
|
* zP: Zero Page
|
||||||
* zX: Zero Page Indexec by X
|
* zX: Zero Page Index by X
|
||||||
* zY: Zero Page Indexec by Y
|
* zY: Zero Page Index by Y
|
||||||
* iD: Indirect Double
|
* iD: Indirect Double
|
||||||
* aB: Absolute
|
* aB: Absolute
|
||||||
* aX: Absolute by X
|
* aX: Absolute by X
|
||||||
@ -87,14 +87,15 @@
|
|||||||
#define IPf_rE " $%02X%02X"
|
#define IPf_rE " $%02X%02X"
|
||||||
|
|
||||||
#define _INTERNAL_QUICK6502_CORECPU_
|
#define _INTERNAL_QUICK6502_CORECPU_
|
||||||
|
|
||||||
#include "corecpu.h"
|
#include "corecpu.h"
|
||||||
|
|
||||||
|
|
||||||
/*** Instructions useful macros ***/
|
/*** Instructions useful macros ***/
|
||||||
#define INSTRUCTION(s) static inline void I_##s (quick6502_cpu *cpu)
|
#define INSTRUCTION(s) static inline void I_##s (quick6502_cpu *cpu)
|
||||||
|
|
||||||
#define NZ_FLAG_UPDATE(value) cpu->reg_P = (cpu->reg_P & ~(Q6502_N_FLAG | Q6502_Z_FLAG)) | \
|
#define NZ_FLAG_UPDATE(value) cpu->reg_P = ((cpu->reg_P & ~(Q6502_N_FLAG | Q6502_Z_FLAG)) | \
|
||||||
(value & 0x80) | ((value)?0:Q6502_Z_FLAG)
|
((value) & 0x80) | ((value)?0:Q6502_Z_FLAG))
|
||||||
|
|
||||||
#define CROSS_CYCLE_UPDATE(value) if ((value) & 0x0F00) cpu->page_crossed = 1
|
#define CROSS_CYCLE_UPDATE(value) if ((value) & 0x0F00) cpu->page_crossed = 1
|
||||||
|
|
||||||
@ -235,7 +236,7 @@ static inline int quick6502_exec_one(quick6502_cpu *cpu);
|
|||||||
* Output:
|
* Output:
|
||||||
*
|
*
|
||||||
* (void *): An opaque pointer to the internal structure of the CPU.
|
* (void *): An opaque pointer to the internal structure of the CPU.
|
||||||
* NULL if an error occured !
|
* NULL if an error occurred !
|
||||||
*/
|
*/
|
||||||
quick6502_cpu *quick6502_init(quick6502_cpuconfig *config)
|
quick6502_cpu *quick6502_init(quick6502_cpuconfig *config)
|
||||||
{
|
{
|
||||||
@ -244,7 +245,9 @@ quick6502_cpu *quick6502_init(quick6502_cpuconfig *config)
|
|||||||
/* Alloc structure */
|
/* Alloc structure */
|
||||||
cpu = (quick6502_cpu *)malloc(sizeof(quick6502_cpu));
|
cpu = (quick6502_cpu *)malloc(sizeof(quick6502_cpu));
|
||||||
if (!cpu)
|
if (!cpu)
|
||||||
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/* Initialise other variables */
|
/* Initialise other variables */
|
||||||
cpu->running = 0; /* CPU is currently NOT running */
|
cpu->running = 0; /* CPU is currently NOT running */
|
||||||
@ -263,46 +266,76 @@ quick6502_cpu *quick6502_init(quick6502_cpuconfig *config)
|
|||||||
cpu->reg_P = Q6502_D_FLAG | Q6502_I_FLAG;
|
cpu->reg_P = Q6502_D_FLAG | Q6502_I_FLAG;
|
||||||
|
|
||||||
if (config->memory_read != NULL)
|
if (config->memory_read != NULL)
|
||||||
|
{
|
||||||
cpu->memory_read = config->memory_read;
|
cpu->memory_read = config->memory_read;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
goto init_error;
|
goto init_error;
|
||||||
|
}
|
||||||
|
|
||||||
if (config->memory_write != NULL)
|
if (config->memory_write != NULL)
|
||||||
|
{
|
||||||
cpu->memory_write = config->memory_write;
|
cpu->memory_write = config->memory_write;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
goto init_error;
|
goto init_error;
|
||||||
|
}
|
||||||
|
|
||||||
if (config->memory_opcode_read != NULL)
|
if (config->memory_opcode_read != NULL)
|
||||||
|
{
|
||||||
cpu->memory_opcode_read = config->memory_opcode_read;
|
cpu->memory_opcode_read = config->memory_opcode_read;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
cpu->memory_opcode_read = config->memory_read;
|
cpu->memory_opcode_read = config->memory_read;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (config->memory_page0_read != NULL)
|
if (config->memory_page0_read != NULL)
|
||||||
|
{
|
||||||
cpu->memory_page0_read = config->memory_page0_read;
|
cpu->memory_page0_read = config->memory_page0_read;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
cpu->memory_page0_read = config->memory_read;
|
cpu->memory_page0_read = config->memory_read;
|
||||||
|
}
|
||||||
|
|
||||||
if (config->memory_page0_write != NULL)
|
if (config->memory_page0_write != NULL)
|
||||||
|
{
|
||||||
cpu->memory_page0_write = config->memory_page0_write;
|
cpu->memory_page0_write = config->memory_page0_write;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
cpu->memory_page0_write = config->memory_write;
|
cpu->memory_page0_write = config->memory_write;
|
||||||
|
}
|
||||||
|
|
||||||
if (config->memory_stack_read != NULL)
|
if (config->memory_stack_read != NULL)
|
||||||
|
{
|
||||||
cpu->memory_stack_read = config->memory_stack_read;
|
cpu->memory_stack_read = config->memory_stack_read;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
cpu->memory_stack_read = config->memory_read;
|
cpu->memory_stack_read = config->memory_read;
|
||||||
|
}
|
||||||
|
|
||||||
if (config->memory_stack_write != NULL)
|
if (config->memory_stack_write != NULL)
|
||||||
|
{
|
||||||
cpu->memory_stack_write = config->memory_stack_write;
|
cpu->memory_stack_write = config->memory_stack_write;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
cpu->memory_stack_write = config->memory_write;
|
cpu->memory_stack_write = config->memory_write;
|
||||||
|
}
|
||||||
|
|
||||||
return cpu;
|
return cpu;
|
||||||
|
|
||||||
init_error:
|
init_error:
|
||||||
if (cpu)
|
if (cpu)
|
||||||
|
{
|
||||||
free(cpu);
|
free(cpu);
|
||||||
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -333,7 +366,7 @@ void quick6502_reset(quick6502_cpu *cpu)
|
|||||||
*
|
*
|
||||||
* int: (Number of cycle really done) - (Number of cycle asked)
|
* int: (Number of cycle really done) - (Number of cycle asked)
|
||||||
*/
|
*/
|
||||||
int quick6502_run(quick6502_cpu *cpu, int cycles)
|
uint32_t quick6502_run(quick6502_cpu *cpu, uint32_t cycles)
|
||||||
{
|
{
|
||||||
cpu->running = true;
|
cpu->running = true;
|
||||||
|
|
||||||
@ -389,7 +422,9 @@ void quick6502_int(quick6502_cpu *cpu, quick6502_signal signal)
|
|||||||
cpu->cycle_done += 7;
|
cpu->cycle_done += 7;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
cpu->int_pending = 1;
|
cpu->int_pending = 1;
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -458,7 +493,7 @@ typedef enum InstructionNameTag
|
|||||||
n_PHA, n_PLA, n_PHP, n_PLP,
|
n_PHA, n_PLA, n_PHP, n_PLP,
|
||||||
n_DEX, n_DEY, n_INX, n_INY, n_DEC, n_INC,
|
n_DEX, n_DEY, n_INX, n_INY, n_DEC, n_INC,
|
||||||
n_JSR, n_RTS, n_JMP, n_BRK, n_RTI,
|
n_JSR, n_RTS, n_JMP, n_BRK, n_RTI,
|
||||||
n_BCC, n_BCS, n_BEQ, n_BNE, n_BHI, n_BPL, n_BVS, n_BVC, n_BMI,
|
n_BCC, n_BCS, n_BEQ, n_BNE, n_BPL, n_BVS, n_BVC, n_BMI,
|
||||||
n_EOR, n_AND, n_BIT, n_ORA, n_ADC, n_SBC,
|
n_EOR, n_AND, n_BIT, n_ORA, n_ADC, n_SBC,
|
||||||
n_ROL, n_ROR, n_ASL, n_LSR,
|
n_ROL, n_ROR, n_ASL, n_LSR,
|
||||||
n_CMP, n_CPX, n_CPY,
|
n_CMP, n_CPX, n_CPY,
|
||||||
@ -473,7 +508,7 @@ char *InstructionName[] =
|
|||||||
"PHA", "PLA", "PHP", "PLP",
|
"PHA", "PLA", "PHP", "PLP",
|
||||||
"DEX", "DEY", "INX", "INY", "DEC", "INC",
|
"DEX", "DEY", "INX", "INY", "DEC", "INC",
|
||||||
"JSR", "RTS", "JMP", "BRK", "RTI",
|
"JSR", "RTS", "JMP", "BRK", "RTI",
|
||||||
"BCC", "BCS", "BEQ", "BNE", "BHI", "BPL", "BVS", "BVC", "BVS",
|
"BCC", "BCS", "BEQ", "BNE", "BPL", "BVS", "BVC", "BVS",
|
||||||
"EOR", "AND", "BIT", "ORA", "ADC", "SBC",
|
"EOR", "AND", "BIT", "ORA", "ADC", "SBC",
|
||||||
"ROL", "ROR", "ASL", "LSR",
|
"ROL", "ROR", "ASL", "LSR",
|
||||||
"CMP", "CPX", "CPY",
|
"CMP", "CPX", "CPY",
|
||||||
@ -567,7 +602,7 @@ INSTRUCTION(SEDnP)
|
|||||||
TRACEi(("SED"));
|
TRACEi(("SED"));
|
||||||
cpu->reg_P |= Q6502_D_FLAG;
|
cpu->reg_P |= Q6502_D_FLAG;
|
||||||
}
|
}
|
||||||
/** B8 : CLV - CLear oVerflo **/
|
/** B8 : CLV - CLear oVerflow **/
|
||||||
INSTRUCTION(CLVnP)
|
INSTRUCTION(CLVnP)
|
||||||
{
|
{
|
||||||
TRACEi(("CLV"));
|
TRACEi(("CLV"));
|
||||||
@ -962,7 +997,7 @@ INSTRUCTION(JSRaB)
|
|||||||
cpu->reg_PC = ((cpu->memory_opcode_read(cpu->reg_PC - 1)) | (cpu->memory_opcode_read(cpu->reg_PC) << 8));
|
cpu->reg_PC = ((cpu->memory_opcode_read(cpu->reg_PC - 1)) | (cpu->memory_opcode_read(cpu->reg_PC) << 8));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 60 : RTS - ReTurn from Subrutine */
|
/** 60 : RTS - ReTurn from Subroutine */
|
||||||
INSTRUCTION(RTSnP)
|
INSTRUCTION(RTSnP)
|
||||||
{
|
{
|
||||||
TRACEi(("RTS"));
|
TRACEi(("RTS"));
|
||||||
@ -971,14 +1006,14 @@ INSTRUCTION(RTSnP)
|
|||||||
cpu->reg_PC++;
|
cpu->reg_PC++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 4C : JMP $xxxx - JuMP inconditionaly to $xxxx **/
|
/** 4C : JMP $xxxx - JuMP unconditionally to $xxxx **/
|
||||||
INSTRUCTION(JMPaB)
|
INSTRUCTION(JMPaB)
|
||||||
{
|
{
|
||||||
TRACEi(("JMP $%02X%02X", cpu->memory_opcode_read(cpu->reg_PC + 1), cpu->memory_opcode_read(cpu->reg_PC)));
|
TRACEi(("JMP $%02X%02X", cpu->memory_opcode_read(cpu->reg_PC + 1), cpu->memory_opcode_read(cpu->reg_PC)));
|
||||||
cpu->reg_PC = cpu->memory_opcode_read(cpu->reg_PC) | (cpu->memory_opcode_read(cpu->reg_PC + 1) << 8);
|
cpu->reg_PC = cpu->memory_opcode_read(cpu->reg_PC) | (cpu->memory_opcode_read(cpu->reg_PC + 1) << 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 6C : JMP ($xxxx) - JuMP inconditionaly to ($xxxx) **/
|
/** 6C : JMP ($xxxx) - JuMP unconditionally to ($xxxx) **/
|
||||||
INSTRUCTION(JMPiD)
|
INSTRUCTION(JMPiD)
|
||||||
{
|
{
|
||||||
TRACEi(("JMP ($%02X%02X)", cpu->memory_opcode_read(cpu->reg_PC + 1), cpu->memory_opcode_read(cpu->reg_PC)));
|
TRACEi(("JMP ($%02X%02X)", cpu->memory_opcode_read(cpu->reg_PC + 1), cpu->memory_opcode_read(cpu->reg_PC)));
|
||||||
@ -1028,8 +1063,10 @@ INSTRUCTION(BCCrE)
|
|||||||
/* +2 is another */
|
/* +2 is another */
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
cpu->reg_PC++;
|
cpu->reg_PC++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** B0 : BCS - Branch if Carry Set**/
|
/** B0 : BCS - Branch if Carry Set**/
|
||||||
INSTRUCTION(BCSrE)
|
INSTRUCTION(BCSrE)
|
||||||
@ -1045,8 +1082,10 @@ INSTRUCTION(BCSrE)
|
|||||||
/* +2 is another */
|
/* +2 is another */
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
cpu->reg_PC++;
|
cpu->reg_PC++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** F0 : BEQ - Branch if Equal**/
|
/** F0 : BEQ - Branch if Equal**/
|
||||||
INSTRUCTION(BEQrE)
|
INSTRUCTION(BEQrE)
|
||||||
@ -1062,8 +1101,10 @@ INSTRUCTION(BEQrE)
|
|||||||
/* +2 is another */
|
/* +2 is another */
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
cpu->reg_PC++;
|
cpu->reg_PC++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** 30 : BMI - Branch if MInus**/
|
/** 30 : BMI - Branch if MInus**/
|
||||||
INSTRUCTION(BMIrE)
|
INSTRUCTION(BMIrE)
|
||||||
@ -1079,8 +1120,10 @@ INSTRUCTION(BMIrE)
|
|||||||
/* +2 is another */
|
/* +2 is another */
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
cpu->reg_PC++;
|
cpu->reg_PC++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** D0 : Bxx - Branch if Not Equal**/
|
/** D0 : Bxx - Branch if Not Equal**/
|
||||||
INSTRUCTION(BNErE)
|
INSTRUCTION(BNErE)
|
||||||
@ -1096,8 +1139,10 @@ INSTRUCTION(BNErE)
|
|||||||
/* +2 is another */
|
/* +2 is another */
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
cpu->reg_PC++;
|
cpu->reg_PC++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** 10 : BPL - Branch if PLus **/
|
/** 10 : BPL - Branch if PLus **/
|
||||||
INSTRUCTION(BPLrE)
|
INSTRUCTION(BPLrE)
|
||||||
@ -1113,8 +1158,10 @@ INSTRUCTION(BPLrE)
|
|||||||
/* +2 is another */
|
/* +2 is another */
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
cpu->reg_PC++;
|
cpu->reg_PC++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** 50 : BVC - Branch if oVerflow Clear**/
|
/** 50 : BVC - Branch if oVerflow Clear**/
|
||||||
INSTRUCTION(BVCrE)
|
INSTRUCTION(BVCrE)
|
||||||
@ -1130,8 +1177,10 @@ INSTRUCTION(BVCrE)
|
|||||||
/* +2 is another */
|
/* +2 is another */
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
cpu->reg_PC++;
|
cpu->reg_PC++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** 70 : BVS - Branch if oVerflow Set**/
|
/** 70 : BVS - Branch if oVerflow Set**/
|
||||||
INSTRUCTION(BVSrE)
|
INSTRUCTION(BVSrE)
|
||||||
@ -1147,8 +1196,10 @@ INSTRUCTION(BVSrE)
|
|||||||
/* +2 is another */
|
/* +2 is another */
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
cpu->reg_PC++;
|
cpu->reg_PC++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*** Mathematical functions ***/
|
/*** Mathematical functions ***/
|
||||||
|
|
||||||
@ -1889,8 +1940,8 @@ INSTRUCTION(INCzX)
|
|||||||
* iX: Indirect by X
|
* iX: Indirect by X
|
||||||
* iY: Indirect by Y
|
* iY: Indirect by Y
|
||||||
* zP: Zero Page
|
* zP: Zero Page
|
||||||
* zX: Zero Page Indexec by X
|
* zX: Zero Page Index by X
|
||||||
* zY: Zero Page Indexec by Y
|
* zY: Zero Page Index by Y
|
||||||
* iD: Indirect Double
|
* iD: Indirect Double
|
||||||
* aB: Absolute
|
* aB: Absolute
|
||||||
* aX: Absolute by X
|
* aX: Absolute by X
|
||||||
@ -1899,22 +1950,38 @@ INSTRUCTION(INCzX)
|
|||||||
static InstructionFunction InstructionTable[256] =
|
static InstructionFunction InstructionTable[256] =
|
||||||
{
|
{
|
||||||
/* 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F */
|
/* 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F */
|
||||||
/* 00 */ I_BRKnP, I_ORAiX, I_ILLEG, I_ILLEG, I_ILLEG, I_ORAzP, I_ASLzP, I_ILLEG, I_PHPnP, I_ORAiM, I_ASLnP, I_ILLEG, I_ILLEG, I_ORAaB, I_ASLaB, I_ILLEG,
|
/* 00 */ I_BRKnP, I_ORAiX, I_ILLEG, I_ILLEG, I_ILLEG, I_ORAzP, I_ASLzP, I_ILLEG, I_PHPnP, I_ORAiM,
|
||||||
/* 10 */ I_BPLrE, I_ORAiY, I_ILLEG, I_ILLEG, I_ILLEG, I_ORAzX, I_ASLzX, I_ILLEG, I_CLCnP, I_ORAaY, I_ILLEG, I_ILLEG, I_ILLEG, I_ORAaX, I_ASLaX, I_ILLEG,
|
I_ASLnP, I_ILLEG, I_ILLEG, I_ORAaB, I_ASLaB, I_ILLEG,
|
||||||
/* 20 */ I_JSRaB, I_ANDiX, I_ILLEG, I_ILLEG, I_BITzP, I_ANDzP, I_ROLzP, I_ILLEG, I_PLPnP, I_ANDiM, I_ROLnP, I_ILLEG, I_BITaB, I_ANDaB, I_ROLaB, I_ILLEG,
|
/* 10 */ I_BPLrE, I_ORAiY, I_ILLEG, I_ILLEG, I_ILLEG, I_ORAzX, I_ASLzX, I_ILLEG, I_CLCnP, I_ORAaY,
|
||||||
/* 30 */ I_BMIrE, I_ANDiY, I_ILLEG, I_ILLEG, I_ILLEG, I_ANDzX, I_ROLzX, I_ILLEG, I_SECnP, I_ANDaY, I_ILLEG, I_ILLEG, I_ILLEG, I_ANDaX, I_ROLaX, I_ILLEG,
|
I_ILLEG, I_ILLEG, I_ILLEG, I_ORAaX, I_ASLaX, I_ILLEG,
|
||||||
/* 40 */ I_RTInP, I_EORiX, I_ILLEG, I_ILLEG, I_ILLEG, I_EORzP, I_LSRzP, I_ILLEG, I_PHAnP, I_EORiM, I_LSRnP, I_ILLEG, I_JMPaB, I_EORaB, I_LSRaB, I_ILLEG,
|
/* 20 */ I_JSRaB, I_ANDiX, I_ILLEG, I_ILLEG, I_BITzP, I_ANDzP, I_ROLzP, I_ILLEG, I_PLPnP, I_ANDiM,
|
||||||
/* 50 */ I_BVCrE, I_EORiY, I_ILLEG, I_ILLEG, I_ILLEG, I_EORzX, I_LSRzX, I_ILLEG, I_CLInP, I_EORaY, I_ILLEG, I_ILLEG, I_ILLEG, I_EORaX, I_LSRaX, I_ILLEG,
|
I_ROLnP, I_ILLEG, I_BITaB, I_ANDaB, I_ROLaB, I_ILLEG,
|
||||||
/* 60 */ I_RTSnP, I_ADCiX, I_ILLEG, I_ILLEG, I_ILLEG, I_ADCzP, I_RORzP, I_ILLEG, I_PLAnP, I_ADCiM, I_RORnP, I_ILLEG, I_JMPiD, I_ADCaB, I_RORaB, I_ILLEG,
|
/* 30 */ I_BMIrE, I_ANDiY, I_ILLEG, I_ILLEG, I_ILLEG, I_ANDzX, I_ROLzX, I_ILLEG, I_SECnP, I_ANDaY,
|
||||||
/* 70 */ I_BVSrE, I_ADCiY, I_ILLEG, I_ILLEG, I_ILLEG, I_ADCzX, I_RORzX, I_ILLEG, I_SEInP, I_ADCaY, I_ILLEG, I_ILLEG, I_ILLEG, I_ADCaX, I_RORaX, I_ILLEG,
|
I_ILLEG, I_ILLEG, I_ILLEG, I_ANDaX, I_ROLaX, I_ILLEG,
|
||||||
/* 80 */ I_ILLEG, I_STAiX, I_ILLEG, I_ILLEG, I_STYzP, I_STAzP, I_STXzP, I_ILLEG, I_DEYnP, I_ILLEG, I_TXAnP, I_ILLEG, I_STYaB, I_STAaB, I_STXaB, I_ILLEG,
|
/* 40 */ I_RTInP, I_EORiX, I_ILLEG, I_ILLEG, I_ILLEG, I_EORzP, I_LSRzP, I_ILLEG, I_PHAnP, I_EORiM,
|
||||||
/* 90 */ I_BCCrE, I_STAiY, I_ILLEG, I_ILLEG, I_STYzX, I_STAzX, I_STXzY, I_ILLEG, I_TYAnP, I_STAaY, I_TXSnP, I_ILLEG, I_ILLEG, I_STAaX, I_ILLEG, I_ILLEG,
|
I_LSRnP, I_ILLEG, I_JMPaB, I_EORaB, I_LSRaB, I_ILLEG,
|
||||||
/* A0 */ I_LDYiM, I_LDAiX, I_LDXiM, I_ILLEG, I_LDYzP, I_LDAzP, I_LDXzP, I_ILLEG, I_TAYnP, I_LDAiM, I_TAXnP, I_ILLEG, I_LDYaB, I_LDAaB, I_LDXaB, I_ILLEG,
|
/* 50 */ I_BVCrE, I_EORiY, I_ILLEG, I_ILLEG, I_ILLEG, I_EORzX, I_LSRzX, I_ILLEG, I_CLInP, I_EORaY,
|
||||||
/* B0 */ I_BCSrE, I_LDAiY, I_ILLEG, I_ILLEG, I_LDYzX, I_LDAzX, I_LDXzY, I_ILLEG, I_CLVnP, I_LDAaY, I_TSXnP, I_ILLEG, I_LDYaX, I_LDAaX, I_LDXaY, I_ILLEG,
|
I_ILLEG, I_ILLEG, I_ILLEG, I_EORaX, I_LSRaX, I_ILLEG,
|
||||||
/* C0 */ I_CPYiM, I_CMPiX, I_ILLEG, I_ILLEG, I_CPYzP, I_CMPzP, I_DECzP, I_ILLEG, I_INYnP, I_CMPiM, I_DEXnP, I_ILLEG, I_CPYaB, I_CMPaB, I_DECaB, I_ILLEG,
|
/* 60 */ I_RTSnP, I_ADCiX, I_ILLEG, I_ILLEG, I_ILLEG, I_ADCzP, I_RORzP, I_ILLEG, I_PLAnP, I_ADCiM,
|
||||||
/* D0 */ I_BNErE, I_CMPiY, I_ILLEG, I_ILLEG, I_ILLEG, I_CMPzX, I_DECzX, I_ILLEG, I_CLDnP, I_CMPaY, I_ILLEG, I_ILLEG, I_ILLEG, I_CMPaX, I_DECaX, I_ILLEG,
|
I_RORnP, I_ILLEG, I_JMPiD, I_ADCaB, I_RORaB, I_ILLEG,
|
||||||
/* E0 */ I_CPXiM, I_SBCiX, I_ILLEG, I_ILLEG, I_CPXzP, I_SBCzP, I_INCzP, I_ILLEG, I_INXnP, I_SBCiM, I_NOPnP, I_ILLEG, I_CPXaB, I_SBCaB, I_INCaB, I_ILLEG,
|
/* 70 */ I_BVSrE, I_ADCiY, I_ILLEG, I_ILLEG, I_ILLEG, I_ADCzX, I_RORzX, I_ILLEG, I_SEInP, I_ADCaY,
|
||||||
/* F0 */ I_BEQrE, I_SBCiY, I_ILLEG, I_ILLEG, I_ILLEG, I_SBCzX, I_INCzX, I_ILLEG, I_SEDnP, I_SBCaY, I_ILLEG, I_ILLEG, I_ILLEG, I_SBCaX, I_INCaX, I_ILLEG
|
I_ILLEG, I_ILLEG, I_ILLEG, I_ADCaX, I_RORaX, I_ILLEG,
|
||||||
|
/* 80 */ I_ILLEG, I_STAiX, I_ILLEG, I_ILLEG, I_STYzP, I_STAzP, I_STXzP, I_ILLEG, I_DEYnP, I_ILLEG,
|
||||||
|
I_TXAnP, I_ILLEG, I_STYaB, I_STAaB, I_STXaB, I_ILLEG,
|
||||||
|
/* 90 */ I_BCCrE, I_STAiY, I_ILLEG, I_ILLEG, I_STYzX, I_STAzX, I_STXzY, I_ILLEG, I_TYAnP, I_STAaY,
|
||||||
|
I_TXSnP, I_ILLEG, I_ILLEG, I_STAaX, I_ILLEG, I_ILLEG,
|
||||||
|
/* A0 */ I_LDYiM, I_LDAiX, I_LDXiM, I_ILLEG, I_LDYzP, I_LDAzP, I_LDXzP, I_ILLEG, I_TAYnP, I_LDAiM,
|
||||||
|
I_TAXnP, I_ILLEG, I_LDYaB, I_LDAaB, I_LDXaB, I_ILLEG,
|
||||||
|
/* B0 */ I_BCSrE, I_LDAiY, I_ILLEG, I_ILLEG, I_LDYzX, I_LDAzX, I_LDXzY, I_ILLEG, I_CLVnP, I_LDAaY,
|
||||||
|
I_TSXnP, I_ILLEG, I_LDYaX, I_LDAaX, I_LDXaY, I_ILLEG,
|
||||||
|
/* C0 */ I_CPYiM, I_CMPiX, I_ILLEG, I_ILLEG, I_CPYzP, I_CMPzP, I_DECzP, I_ILLEG, I_INYnP, I_CMPiM,
|
||||||
|
I_DEXnP, I_ILLEG, I_CPYaB, I_CMPaB, I_DECaB, I_ILLEG,
|
||||||
|
/* D0 */ I_BNErE, I_CMPiY, I_ILLEG, I_ILLEG, I_ILLEG, I_CMPzX, I_DECzX, I_ILLEG, I_CLDnP, I_CMPaY,
|
||||||
|
I_ILLEG, I_ILLEG, I_ILLEG, I_CMPaX, I_DECaX, I_ILLEG,
|
||||||
|
/* E0 */ I_CPXiM, I_SBCiX, I_ILLEG, I_ILLEG, I_CPXzP, I_SBCzP, I_INCzP, I_ILLEG, I_INXnP, I_SBCiM,
|
||||||
|
I_NOPnP, I_ILLEG, I_CPXaB, I_SBCaB, I_INCaB, I_ILLEG,
|
||||||
|
/* F0 */ I_BEQrE, I_SBCiY, I_ILLEG, I_ILLEG, I_ILLEG, I_SBCzX, I_INCzX, I_ILLEG, I_SEDnP, I_SBCaY,
|
||||||
|
I_ILLEG, I_ILLEG, I_ILLEG, I_SBCaX, I_INCaX, I_ILLEG
|
||||||
/* 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F */
|
/* 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F */
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1985,7 +2052,8 @@ int quick6502_getinstruction(quick6502_cpu *cpu, char interpret,
|
|||||||
uint16_t value_u16;
|
uint16_t value_u16;
|
||||||
|
|
||||||
curlen = sprintf(str, "%s", InstructionName[InstructionNameTable[opcode]]);
|
curlen = sprintf(str, "%s", InstructionName[InstructionNameTable[opcode]]);
|
||||||
str += curlen; len += curlen;
|
str += curlen;
|
||||||
|
len += curlen;
|
||||||
|
|
||||||
switch (InstructionTypeTable[opcode])
|
switch (InstructionTypeTable[opcode])
|
||||||
{
|
{
|
||||||
@ -1995,7 +2063,8 @@ int quick6502_getinstruction(quick6502_cpu *cpu, char interpret,
|
|||||||
|
|
||||||
case t_IMM:
|
case t_IMM:
|
||||||
curlen = sprintf(str, " #$%02X", cpu->memory_opcode_read(addr + 1));
|
curlen = sprintf(str, " #$%02X", cpu->memory_opcode_read(addr + 1));
|
||||||
str += curlen; len += curlen;
|
str += curlen;
|
||||||
|
len += curlen;
|
||||||
|
|
||||||
/* Nothing to interpret.. Really */
|
/* Nothing to interpret.. Really */
|
||||||
|
|
||||||
@ -2005,7 +2074,8 @@ int quick6502_getinstruction(quick6502_cpu *cpu, char interpret,
|
|||||||
|
|
||||||
case t_IDX:
|
case t_IDX:
|
||||||
curlen = sprintf(str, " ($%02X, X)", cpu->memory_opcode_read(addr + 1));
|
curlen = sprintf(str, " ($%02X, X)", cpu->memory_opcode_read(addr + 1));
|
||||||
str += curlen; len += curlen;
|
str += curlen;
|
||||||
|
len += curlen;
|
||||||
|
|
||||||
if (interpret)
|
if (interpret)
|
||||||
{
|
{
|
||||||
@ -2017,7 +2087,8 @@ int quick6502_getinstruction(quick6502_cpu *cpu, char interpret,
|
|||||||
value_u16 & 0xFF,
|
value_u16 & 0xFF,
|
||||||
cpu->memory_page0_read(value_u16),
|
cpu->memory_page0_read(value_u16),
|
||||||
cpu->memory_page0_read(value_u16 + 1));
|
cpu->memory_page0_read(value_u16 + 1));
|
||||||
str += curlen; len += curlen;
|
str += curlen;
|
||||||
|
len += curlen;
|
||||||
}
|
}
|
||||||
|
|
||||||
readuint8_t += 1;
|
readuint8_t += 1;
|
||||||
@ -2025,7 +2096,8 @@ int quick6502_getinstruction(quick6502_cpu *cpu, char interpret,
|
|||||||
|
|
||||||
case t_IDY:
|
case t_IDY:
|
||||||
curlen = sprintf(str, " ($%02X), Y", cpu->memory_opcode_read(addr + 1));
|
curlen = sprintf(str, " ($%02X), Y", cpu->memory_opcode_read(addr + 1));
|
||||||
str += curlen; len += curlen;
|
str += curlen;
|
||||||
|
len += curlen;
|
||||||
|
|
||||||
if (interpret)
|
if (interpret)
|
||||||
{
|
{
|
||||||
@ -2038,7 +2110,8 @@ int quick6502_getinstruction(quick6502_cpu *cpu, char interpret,
|
|||||||
value_u16, cpu->reg_Y,
|
value_u16, cpu->reg_Y,
|
||||||
value_u16 + cpu->reg_Y
|
value_u16 + cpu->reg_Y
|
||||||
);
|
);
|
||||||
str += curlen; len += curlen;
|
str += curlen;
|
||||||
|
len += curlen;
|
||||||
}
|
}
|
||||||
|
|
||||||
readuint8_t += 1;
|
readuint8_t += 1;
|
||||||
@ -2047,7 +2120,8 @@ int quick6502_getinstruction(quick6502_cpu *cpu, char interpret,
|
|||||||
case t_ABS:
|
case t_ABS:
|
||||||
curlen = sprintf(str, " $%02X%02X", cpu->memory_opcode_read(addr + 2),
|
curlen = sprintf(str, " $%02X%02X", cpu->memory_opcode_read(addr + 2),
|
||||||
cpu->memory_opcode_read(addr + 1));
|
cpu->memory_opcode_read(addr + 1));
|
||||||
str += curlen; len += curlen;
|
str += curlen;
|
||||||
|
len += curlen;
|
||||||
|
|
||||||
/* Nothing to interpret.. Really */
|
/* Nothing to interpret.. Really */
|
||||||
|
|
||||||
@ -2057,7 +2131,8 @@ int quick6502_getinstruction(quick6502_cpu *cpu, char interpret,
|
|||||||
case t_REL:
|
case t_REL:
|
||||||
value_u16 = 2 + addr + (signed char)cpu->memory_opcode_read(addr + 1);
|
value_u16 = 2 + addr + (signed char)cpu->memory_opcode_read(addr + 1);
|
||||||
curlen = sprintf(str, " $%04X", value_u16);
|
curlen = sprintf(str, " $%04X", value_u16);
|
||||||
str += curlen; len += curlen;
|
str += curlen;
|
||||||
|
len += curlen;
|
||||||
|
|
||||||
/* Nothing to interpret.. Really */
|
/* Nothing to interpret.. Really */
|
||||||
|
|
||||||
@ -2066,7 +2141,8 @@ int quick6502_getinstruction(quick6502_cpu *cpu, char interpret,
|
|||||||
|
|
||||||
case t_ZEP:
|
case t_ZEP:
|
||||||
curlen = sprintf(str, " $%02X", cpu->memory_opcode_read(addr + 1));
|
curlen = sprintf(str, " $%02X", cpu->memory_opcode_read(addr + 1));
|
||||||
str += curlen; len += curlen;
|
str += curlen;
|
||||||
|
len += curlen;
|
||||||
|
|
||||||
/* Nothing to interpret.. Really */
|
/* Nothing to interpret.. Really */
|
||||||
|
|
||||||
@ -2075,14 +2151,16 @@ int quick6502_getinstruction(quick6502_cpu *cpu, char interpret,
|
|||||||
|
|
||||||
case t_ZPX:
|
case t_ZPX:
|
||||||
curlen = sprintf(str, " $%02X, X", cpu->memory_opcode_read(addr + 1));
|
curlen = sprintf(str, " $%02X, X", cpu->memory_opcode_read(addr + 1));
|
||||||
str += curlen; len += curlen;
|
str += curlen;
|
||||||
|
len += curlen;
|
||||||
|
|
||||||
if (interpret)
|
if (interpret)
|
||||||
{
|
{
|
||||||
curlen = sprintf(str, " ; $%02X + $%02x -> $%02X",
|
curlen = sprintf(str, " ; $%02X + $%02x -> $%02X",
|
||||||
cpu->memory_opcode_read(addr + 1), cpu->reg_X,
|
cpu->memory_opcode_read(addr + 1), cpu->reg_X,
|
||||||
(cpu->memory_opcode_read(addr + 1) + cpu->reg_X) & 0xFF);
|
(cpu->memory_opcode_read(addr + 1) + cpu->reg_X) & 0xFF);
|
||||||
str += curlen; len += curlen;
|
str += curlen;
|
||||||
|
len += curlen;
|
||||||
}
|
}
|
||||||
|
|
||||||
readuint8_t += 1;
|
readuint8_t += 1;
|
||||||
@ -2090,14 +2168,16 @@ int quick6502_getinstruction(quick6502_cpu *cpu, char interpret,
|
|||||||
|
|
||||||
case t_ZPY:
|
case t_ZPY:
|
||||||
curlen = sprintf(str, " $%02X, Y", cpu->memory_opcode_read(addr + 1));
|
curlen = sprintf(str, " $%02X, Y", cpu->memory_opcode_read(addr + 1));
|
||||||
str += curlen; len += curlen;
|
str += curlen;
|
||||||
|
len += curlen;
|
||||||
|
|
||||||
if (interpret)
|
if (interpret)
|
||||||
{
|
{
|
||||||
curlen = sprintf(str, " ; $%02X + $%02x -> $%02X",
|
curlen = sprintf(str, " ; $%02X + $%02x -> $%02X",
|
||||||
cpu->memory_opcode_read(addr + 1), cpu->reg_Y,
|
cpu->memory_opcode_read(addr + 1), cpu->reg_Y,
|
||||||
(cpu->memory_opcode_read(addr + 1) + cpu->reg_Y) & 0xFF);
|
(cpu->memory_opcode_read(addr + 1) + cpu->reg_Y) & 0xFF);
|
||||||
str += curlen; len += curlen;
|
str += curlen;
|
||||||
|
len += curlen;
|
||||||
}
|
}
|
||||||
|
|
||||||
readuint8_t += 1;
|
readuint8_t += 1;
|
||||||
@ -2106,7 +2186,8 @@ int quick6502_getinstruction(quick6502_cpu *cpu, char interpret,
|
|||||||
case t_ABX:
|
case t_ABX:
|
||||||
curlen = sprintf(str, " $%02X%02X, X", cpu->memory_opcode_read(addr + 2),
|
curlen = sprintf(str, " $%02X%02X, X", cpu->memory_opcode_read(addr + 2),
|
||||||
cpu->memory_opcode_read(addr + 1));
|
cpu->memory_opcode_read(addr + 1));
|
||||||
str += curlen; len += curlen;
|
str += curlen;
|
||||||
|
len += curlen;
|
||||||
|
|
||||||
if (interpret)
|
if (interpret)
|
||||||
{
|
{
|
||||||
@ -2114,7 +2195,8 @@ int quick6502_getinstruction(quick6502_cpu *cpu, char interpret,
|
|||||||
cpu->memory_opcode_read(addr + 1);
|
cpu->memory_opcode_read(addr + 1);
|
||||||
curlen = sprintf(str, " ; $%04X + $%02X -> $%04X", value_u16,
|
curlen = sprintf(str, " ; $%04X + $%02X -> $%04X", value_u16,
|
||||||
cpu->reg_X, value_u16 + cpu->reg_X);
|
cpu->reg_X, value_u16 + cpu->reg_X);
|
||||||
str += curlen; len += curlen;
|
str += curlen;
|
||||||
|
len += curlen;
|
||||||
}
|
}
|
||||||
|
|
||||||
readuint8_t += 2;
|
readuint8_t += 2;
|
||||||
@ -2123,7 +2205,8 @@ int quick6502_getinstruction(quick6502_cpu *cpu, char interpret,
|
|||||||
case t_ABY:
|
case t_ABY:
|
||||||
curlen = sprintf(str, " $%02X%02X, Y", cpu->memory_opcode_read(addr + 2),
|
curlen = sprintf(str, " $%02X%02X, Y", cpu->memory_opcode_read(addr + 2),
|
||||||
cpu->memory_opcode_read(addr + 1));
|
cpu->memory_opcode_read(addr + 1));
|
||||||
str += curlen; len += curlen;
|
str += curlen;
|
||||||
|
len += curlen;
|
||||||
|
|
||||||
if (interpret)
|
if (interpret)
|
||||||
{
|
{
|
||||||
@ -2131,7 +2214,8 @@ int quick6502_getinstruction(quick6502_cpu *cpu, char interpret,
|
|||||||
cpu->memory_opcode_read(addr + 1);
|
cpu->memory_opcode_read(addr + 1);
|
||||||
curlen = sprintf(str, " ; $%04X + $%02X -> $%04X", value_u16,
|
curlen = sprintf(str, " ; $%04X + $%02X -> $%04X", value_u16,
|
||||||
cpu->reg_Y, value_u16 + cpu->reg_Y);
|
cpu->reg_Y, value_u16 + cpu->reg_Y);
|
||||||
str += curlen; len += curlen;
|
str += curlen;
|
||||||
|
len += curlen;
|
||||||
}
|
}
|
||||||
|
|
||||||
readuint8_t += 2;
|
readuint8_t += 2;
|
||||||
@ -2140,7 +2224,8 @@ int quick6502_getinstruction(quick6502_cpu *cpu, char interpret,
|
|||||||
case t_IND:
|
case t_IND:
|
||||||
curlen = sprintf(str, " ($%02X%02X)", cpu->memory_opcode_read(addr + 2),
|
curlen = sprintf(str, " ($%02X%02X)", cpu->memory_opcode_read(addr + 2),
|
||||||
cpu->memory_opcode_read(addr + 1));
|
cpu->memory_opcode_read(addr + 1));
|
||||||
str += curlen; len += curlen;
|
str += curlen;
|
||||||
|
len += curlen;
|
||||||
|
|
||||||
if (interpret)
|
if (interpret)
|
||||||
{
|
{
|
||||||
@ -2153,7 +2238,8 @@ int quick6502_getinstruction(quick6502_cpu *cpu, char interpret,
|
|||||||
cpu->memory_opcode_read(addr + 2),
|
cpu->memory_opcode_read(addr + 2),
|
||||||
cpu->memory_opcode_read(addr + 1),
|
cpu->memory_opcode_read(addr + 1),
|
||||||
cpu->memory_opcode_read(addr));
|
cpu->memory_opcode_read(addr));
|
||||||
str += curlen; len += curlen;
|
str += curlen;
|
||||||
|
len += curlen;
|
||||||
}
|
}
|
||||||
|
|
||||||
readuint8_t += 2;
|
readuint8_t += 2;
|
||||||
@ -2161,7 +2247,9 @@ int quick6502_getinstruction(quick6502_cpu *cpu, char interpret,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (strlength != NULL)
|
if (strlength != NULL)
|
||||||
|
{
|
||||||
*strlength = len;
|
*strlength = len;
|
||||||
|
}
|
||||||
|
|
||||||
return readuint8_t;
|
return readuint8_t;
|
||||||
}
|
}
|
||||||
@ -2241,7 +2329,11 @@ static inline int quick6502_exec_one(quick6502_cpu *cpu)
|
|||||||
printf("%04X: %s\n", cpu->reg_PC, instr);*/
|
printf("%04X: %s\n", cpu->reg_PC, instr);*/
|
||||||
|
|
||||||
cpu->cycle_done += CycleTable[opcode];
|
cpu->cycle_done += CycleTable[opcode];
|
||||||
if (cpu->page_crossed) { cpu->cycle_done++; cpu->page_crossed = 0; }
|
if (cpu->page_crossed)
|
||||||
|
{
|
||||||
|
cpu->cycle_done++;
|
||||||
|
cpu->page_crossed = 0;
|
||||||
|
}
|
||||||
if (cpu->int_pending != 0)
|
if (cpu->int_pending != 0)
|
||||||
{
|
{
|
||||||
quick6502_int(cpu, Q6502_IRQ_SIGNAL);
|
quick6502_int(cpu, Q6502_IRQ_SIGNAL);
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -2,7 +2,7 @@
|
|||||||
* Cart manager - The peTI-NESulator Project
|
* Cart manager - The peTI-NESulator Project
|
||||||
* NESCart.h
|
* NESCart.h
|
||||||
*
|
*
|
||||||
* Created by Manoel TRAPIER.
|
* Created by Manoël TRAPIER.
|
||||||
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@ -1,232 +0,0 @@
|
|||||||
/** EMULib Emulation Library *********************************/
|
|
||||||
/** **/
|
|
||||||
/** Sound.h **/
|
|
||||||
/** **/
|
|
||||||
/** This file defines standard sound generation API and **/
|
|
||||||
/** functions needed to log soundtrack into a MIDI file. **/
|
|
||||||
/** See Sound.c and the sound drivers for the code. **/
|
|
||||||
/** **/
|
|
||||||
/** Copyright (C) Marat Fayzullin 1996-2007 **/
|
|
||||||
/** You are not allowed to distribute this software **/
|
|
||||||
/** commercially. Please, notify me, if you make any **/
|
|
||||||
/** changes to this file. **/
|
|
||||||
/*************************************************************/
|
|
||||||
/*/
|
|
||||||
|
|
||||||
#ifndef SOUND_H
|
|
||||||
#define SOUND_H
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* SetSound() arguments: */
|
|
||||||
#define SND_MELODIC 0 /* Melodic sound (default) */
|
|
||||||
#define SND_RECTANGLE 0 /* Rectangular wave */
|
|
||||||
#define SND_QS_DU0 5
|
|
||||||
#define SND_QS_DU1 6
|
|
||||||
#define SND_QS_DU2 7
|
|
||||||
#define SND_QS_DU3 8
|
|
||||||
#define SND_TRIANGLE 1 /* Triangular wave (1/2 rect.)*/
|
|
||||||
#define SND_NOISE 2 /* White noise */
|
|
||||||
#define SND_PERIODIC 3 /* Periodic noise (not im-ed) */
|
|
||||||
#define SND_WAVE 4 /* Wave sound set by SetWave()*/
|
|
||||||
#define SND_MIDI 0x100 /* MIDI instrument (ORable) */
|
|
||||||
|
|
||||||
/* Drum() arguments: */
|
|
||||||
#define DRM_CLICK 0 /* Click (default) */
|
|
||||||
#define DRM_MIDI 0x100 /* MIDI drum (ORable) */
|
|
||||||
|
|
||||||
/* MIDI characteristics: */
|
|
||||||
#define MIDI_CHANNELS 16 /* Number of MIDI channels */
|
|
||||||
#define MIDI_MINFREQ 9 /* Min MIDI frequency (Hz) */
|
|
||||||
#define MIDI_MAXFREQ 12285 /* Max MIDI frequency (Hz) */
|
|
||||||
#define MIDI_DIVISIONS 1000 /* Number of ticks per second */
|
|
||||||
|
|
||||||
/* MIDILogging() arguments: */
|
|
||||||
#define MIDI_OFF 0 /* Turn MIDI logging off */
|
|
||||||
#define MIDI_ON 1 /* Turn MIDI logging on */
|
|
||||||
#define MIDI_TOGGLE 2 /* Toggle MIDI logging */
|
|
||||||
#define MIDI_QUERY 3 /* Query MIDI logging status */
|
|
||||||
|
|
||||||
/** TrashSound() *********************************************/
|
|
||||||
/** Shut down sound driver. Each driver implements its own **/
|
|
||||||
/** TrashSound() function. **/
|
|
||||||
/*************************************************************/
|
|
||||||
void TrashSound(void);
|
|
||||||
|
|
||||||
/** Sound() **************************************************/
|
|
||||||
/** Generate sound of given frequency (Hz) and volume **/
|
|
||||||
/** (0..255) via given channel. Setting Freq=0 or Volume=0 **/
|
|
||||||
/** turns sound off. **/
|
|
||||||
/*************************************************************/
|
|
||||||
void Sound(int Channel,int Freq,int Volume);
|
|
||||||
|
|
||||||
/** Drum() ***************************************************/
|
|
||||||
/** Hit a drum of given type with given force (0..255). **/
|
|
||||||
/** MIDI drums can be used by ORing their numbers with **/
|
|
||||||
/** SND_MIDI. **/
|
|
||||||
/*************************************************************/
|
|
||||||
void Drum(int Type,int Force);
|
|
||||||
|
|
||||||
/** SetSound() ***********************************************/
|
|
||||||
/** Set sound type at a given channel. MIDI instruments can **/
|
|
||||||
/** be set directly by ORing their numbers with SND_MIDI. **/
|
|
||||||
/*************************************************************/
|
|
||||||
void SetSound(int Channel,int NewType);
|
|
||||||
|
|
||||||
/** SetChannels() ********************************************/
|
|
||||||
/** Set master volume (0..255) and switch channels on/off. **/
|
|
||||||
/** Each channel N has corresponding bit 2^N in Switch. Set **/
|
|
||||||
/** or reset this bit to turn the channel on or off. **/
|
|
||||||
/*************************************************************/
|
|
||||||
void SetChannels(int Volume,int Switch);
|
|
||||||
|
|
||||||
/** SetWave() ************************************************/
|
|
||||||
/** Set waveform for a given channel. The channel will be **/
|
|
||||||
/** marked with sound type SND_WAVE. Set Rate=0 if you want **/
|
|
||||||
/** waveform to be an instrument or set it to the waveform **/
|
|
||||||
/** own playback rate. **/
|
|
||||||
/*************************************************************/
|
|
||||||
void SetWave(int Channel,signed char *Data,int Length,int Rate);
|
|
||||||
|
|
||||||
/** GetWave() ************************************************/
|
|
||||||
/** Get current read position for the buffer set with the **/
|
|
||||||
/** SetWave() call. Returns 0 if no buffer has been set, or **/
|
|
||||||
/** if there is no playrate set (i.e. wave is instrument). **/
|
|
||||||
/*************************************************************/
|
|
||||||
const signed char *GetWave(int Channel);
|
|
||||||
|
|
||||||
/** InitMIDI() ***********************************************/
|
|
||||||
/** Initialize soundtrack logging into MIDI file FileName. **/
|
|
||||||
/** Repeated calls to InitMIDI() will close current MIDI **/
|
|
||||||
/** file and continue logging into a new one. **/
|
|
||||||
/*************************************************************/
|
|
||||||
void InitMIDI(const char *FileName);
|
|
||||||
|
|
||||||
/** TrashMIDI() **********************************************/
|
|
||||||
/** Finish logging soundtrack and close the MIDI file. **/
|
|
||||||
/*************************************************************/
|
|
||||||
void TrashMIDI(void);
|
|
||||||
|
|
||||||
/** MIDILogging() ********************************************/
|
|
||||||
/** Turn soundtrack logging on/off and return its current **/
|
|
||||||
/** status. Possible values of Switch are MIDI_OFF (turn **/
|
|
||||||
/** logging off), MIDI_ON (turn logging on), MIDI_TOGGLE **/
|
|
||||||
/** (toggle logging), and MIDI_QUERY (just return current **/
|
|
||||||
/** state of logging). **/
|
|
||||||
/*************************************************************/
|
|
||||||
int MIDILogging(int Switch);
|
|
||||||
|
|
||||||
/** MIDITicks() **********************************************/
|
|
||||||
/** Log N 1ms MIDI ticks. **/
|
|
||||||
/*************************************************************/
|
|
||||||
void MIDITicks(int N);
|
|
||||||
|
|
||||||
//#ifdef UNIX
|
|
||||||
#define SND_CHANNELS 4 /* Number of channels */
|
|
||||||
#define SND_SAMPLESIZE 256 /* Max. SetWave() sample size */
|
|
||||||
#define SND_BUFSIZE 256 /* Buffer size, <= 2^SND_BITS */
|
|
||||||
#define SND_BITS 8 /* Number of bits in a fragment */
|
|
||||||
#define SND_BUFFERS 64 /* Number of fragments, >= 2 */
|
|
||||||
/* Bigger value results in better behaviour on loaded */
|
|
||||||
/* but output gets more delayed. */
|
|
||||||
|
|
||||||
/** InitSound() **********************************************/
|
|
||||||
/** Initialize Unix sound driver with given synthesis rate. **/
|
|
||||||
/** Returns Rate on success, 0 otherwise. Pass Rate=0 to **/
|
|
||||||
/** skip initialization and be silent. Pass Verbose!=0 to **/
|
|
||||||
/** see initialization messages. **/
|
|
||||||
/*************************************************************/
|
|
||||||
int InitSound(int Rate,int Verbose);
|
|
||||||
|
|
||||||
/** StopSound() **********************************************/
|
|
||||||
/** Temporarily suspend sound. **/
|
|
||||||
/*************************************************************/
|
|
||||||
void StopSound(void);
|
|
||||||
|
|
||||||
/** ResumeSound() ********************************************/
|
|
||||||
/** Resume sound after StopSound(). **/
|
|
||||||
/*************************************************************/
|
|
||||||
void ResumeSound(void);
|
|
||||||
//#endif /* UNIX */
|
|
||||||
|
|
||||||
#ifdef MSDOS
|
|
||||||
#define SND_CHANNELS 16 /* Number of sound channels */
|
|
||||||
#define OPL_CHANNELS 7 /* Number of Adlib channels */
|
|
||||||
#define SND_SAMPLESIZE 256 /* Max. SetWave() sample size */
|
|
||||||
#define SND_BUFSIZE 512 /* Buffer size for DMA */
|
|
||||||
#define SND_MAXDELAY 10 /* Maximal sound delay 1/n s */
|
|
||||||
|
|
||||||
/** InitSound() **********************************************/
|
|
||||||
/** Initialize sound. Returns Rate on success, 0 otherwise. **/
|
|
||||||
/** Rate=0 to skip initialization (will be silent). **/
|
|
||||||
/*************************************************************/
|
|
||||||
int InitSound(uint32_t Rate,uint32_t Latency);
|
|
||||||
#endif /* MSDOS */
|
|
||||||
|
|
||||||
#ifdef WINDOWS
|
|
||||||
#define SND_CHANNELS 16 /* Number of channels */
|
|
||||||
#define SND_SAMPLESIZE 256 /* Max. SetWave() sample size */
|
|
||||||
#define SND_BUFSIZE 512 /* Size of a wave buffer */
|
|
||||||
#define SND_BUFFERS 32 /* Number of wave buffers */
|
|
||||||
|
|
||||||
#include <Windows.h>
|
|
||||||
|
|
||||||
/** InitSound() **********************************************/
|
|
||||||
/** Initialize Windows sound driver with given synthesis **/
|
|
||||||
/** rate. Returns Rate on success, 0 otherwise. Pass Rate=0 **/
|
|
||||||
/** to skip initialization and be silent. Pass Rate=1 to **/
|
|
||||||
/** use MIDI (midiOut). Pass Rate=8192..44100 to use wave **/
|
|
||||||
/** synthesis (waveOut). Number of wave synthesis buffers **/
|
|
||||||
/** must be in 2..SND_BUFFERS range. **/
|
|
||||||
/*************************************************************/
|
|
||||||
uint32_t InitSound(uint32_t Rate,uint32_t Delay);
|
|
||||||
#endif /* WINDOWS */
|
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
|
|
||||||
#ifndef MSDOS
|
|
||||||
#ifndef WINDOWS
|
|
||||||
#ifndef UNIX
|
|
||||||
#define SND_CHANNELS MIDI_CHANNELS /* Default number */
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/** InitSound() **********************************************/
|
|
||||||
/** Initialize Series60 sound driver with given synthesis **/
|
|
||||||
/** rate. Returns Rate on success, 0 otherwise. Pass Rate=0 **/
|
|
||||||
/** to skip initialization and be silent. **/
|
|
||||||
/*************************************************************/
|
|
||||||
uint32_t InitSound(uint32_t Rate,uint32_t Delay);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/** RenderAudio() ********************************************/
|
|
||||||
/** Render given number of melodic sound samples. Returns **/
|
|
||||||
/** number of samples actually rendered. **/
|
|
||||||
/*************************************************************/
|
|
||||||
uint32_t RenderAudio(uint32_t Samples);
|
|
||||||
|
|
||||||
/** SndDriver ************************************************/
|
|
||||||
/** Each sound driver should fill this structure with **/
|
|
||||||
/** pointers to hardware-dependent handlers. This has to be **/
|
|
||||||
/** done inside the InitSound() function. **/
|
|
||||||
/*************************************************************/
|
|
||||||
struct SndDriverStruct
|
|
||||||
{
|
|
||||||
void (*SetSound)(int Channel,int NewType);
|
|
||||||
void (*Drum)(int Type,int Force);
|
|
||||||
void (*SetChannels)(int Volume,int Switch);
|
|
||||||
void (*Sound)(int Channel,int NewFreq,int NewVolume);
|
|
||||||
void (*SetWave)(int Channel,signed char *Data,int Length,int Freq);
|
|
||||||
const signed char *(*GetWave)(int Channel);
|
|
||||||
};
|
|
||||||
extern struct SndDriverStruct SndDriver;
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* SOUND_H */
|
|
||||||
@ -2,7 +2,7 @@
|
|||||||
* APU emulation - The peTI-NESulator Project
|
* APU emulation - The peTI-NESulator Project
|
||||||
* apu.h
|
* apu.h
|
||||||
*
|
*
|
||||||
* Created by Manoel TRAPIER.
|
* Created by Manoël TRAPIER.
|
||||||
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -2,14 +2,9 @@
|
|||||||
* ANSI Color definition - The Quick6502 Project
|
* ANSI Color definition - The Quick6502 Project
|
||||||
* include/color.h
|
* include/color.h
|
||||||
*
|
*
|
||||||
* Created by Manoel Trapier on 25/06/10
|
* Created by Manoël Trapier on 25/06/10
|
||||||
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
||||||
*
|
*
|
||||||
* $LastChangedDate:$
|
|
||||||
* $Author:$
|
|
||||||
* $HeadURL:$
|
|
||||||
* $Revision:$
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef COLOR_H
|
#ifndef COLOR_H
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
* CoreCPU - The Quick6502 Project
|
* CoreCPU - The Quick6502 Project
|
||||||
* corecpu.h
|
* corecpu.h
|
||||||
*
|
*
|
||||||
* Created by Manoel Trapier on 24/02/08
|
* Created by Manoël Trapier on 24/02/08
|
||||||
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@ -134,7 +134,7 @@ void quick6502_reset(quick6502_cpu *cpu);
|
|||||||
*
|
*
|
||||||
* int: (Number of cycle really done) - (Number of cycle asked)
|
* int: (Number of cycle really done) - (Number of cycle asked)
|
||||||
*/
|
*/
|
||||||
int quick6502_run(quick6502_cpu *cpu, int cycles);
|
uint32_t quick6502_run(quick6502_cpu *cpu, uint32_t cycles);
|
||||||
|
|
||||||
/** Loop CPU until explicit quit */
|
/** Loop CPU until explicit quit */
|
||||||
void quick6502_loop(quick6502_cpu *cpu);
|
void quick6502_loop(quick6502_cpu *cpu);
|
||||||
@ -153,6 +153,7 @@ void quick6502_dump(quick6502_cpu *cpu, FILE * fp);
|
|||||||
|
|
||||||
int quick6502_getinstruction(quick6502_cpu *cpu, char interpret,
|
int quick6502_getinstruction(quick6502_cpu *cpu, char interpret,
|
||||||
uint16_t addr, char *buffer, int *strlength);
|
uint16_t addr, char *buffer, int *strlength);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Free the CPU
|
* Free the CPU
|
||||||
*
|
*
|
||||||
|
|||||||
@ -2,14 +2,9 @@
|
|||||||
* Log Facility - The Quick6502 Project
|
* Log Facility - The Quick6502 Project
|
||||||
* include/log.h
|
* include/log.h
|
||||||
*
|
*
|
||||||
* Created by Manoel Trapier on 19/05/10
|
* Created by Manoël Trapier on 19/05/10
|
||||||
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
||||||
*
|
*
|
||||||
* $LastChangedDate:$
|
|
||||||
* $Author:$
|
|
||||||
* $HeadURL:$
|
|
||||||
* $Revision:$
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _LOG_H
|
#ifndef _LOG_H
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
* Mappers manager & facilities - The peTI-NESulator Project
|
* Mappers manager & facilities - The peTI-NESulator Project
|
||||||
* mappers.h
|
* mappers.h
|
||||||
*
|
*
|
||||||
* Created by Manoel TRAPIER.
|
* Created by Manoël TRAPIER.
|
||||||
* Copyright (c) 2003-2008 986Corp. All rights reserved.
|
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -15,8 +15,7 @@
|
|||||||
#include <NESCarts.h>
|
#include <NESCarts.h>
|
||||||
|
|
||||||
typedef int (*MapperInit)(NesCart *cart);
|
typedef int (*MapperInit)(NesCart *cart);
|
||||||
typedef int (*MapperWriteHook) (register uint16_t Addr,
|
typedef int (*MapperWriteHook)(register uint16_t Addr, register uint8_t Value);
|
||||||
register uint8_t Value);
|
|
||||||
typedef int (*MapperIRQ)(int cycledone);
|
typedef int (*MapperIRQ)(int cycledone);
|
||||||
typedef void (*MapperDump)(FILE *fp);
|
typedef void (*MapperDump)(FILE *fp);
|
||||||
|
|
||||||
@ -47,6 +46,7 @@ void set_prom_bank_32k(uint16_t addr,int slot);
|
|||||||
/* Available functions outside of mappers */
|
/* Available functions outside of mappers */
|
||||||
|
|
||||||
void mapper_list();
|
void mapper_list();
|
||||||
|
|
||||||
int mapper_init(NesCart *cart);
|
int mapper_init(NesCart *cart);
|
||||||
|
|
||||||
extern MapperIRQ mapper_irqloop;
|
extern MapperIRQ mapper_irqloop;
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
* 6502 Memory manager - The peTI-NESulator Project
|
* 6502 Memory manager - The peTI-NESulator Project
|
||||||
* memory.h - Taken from the Quick6502 project
|
* memory.h - Taken from the Quick6502 project
|
||||||
*
|
*
|
||||||
* Created by Manoel Trapier on 18/09/06.
|
* Created by Manoël Trapier on 18/09/06.
|
||||||
* Copyright 2003-2008 986 Corp. All rights reserved.
|
* Copyright 2003-2008 986 Corp. All rights reserved.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@ -19,6 +19,7 @@
|
|||||||
#define ATTR_PAGE_MAPPED 0x01
|
#define ATTR_PAGE_MAPPED 0x01
|
||||||
|
|
||||||
typedef uint8_t (*func_rdhook)(uint8_t /* addr */);
|
typedef uint8_t (*func_rdhook)(uint8_t /* addr */);
|
||||||
|
|
||||||
typedef void (*func_wrhook)(uint8_t addr, uint8_t data);
|
typedef void (*func_wrhook)(uint8_t addr, uint8_t data);
|
||||||
|
|
||||||
/* Functions to manage pages data */
|
/* Functions to manage pages data */
|
||||||
@ -29,35 +30,23 @@ void set_page_ptr_4k(uint8_t page, uint8_t *ptr);
|
|||||||
void set_page_ptr_8k(uint8_t page, uint8_t *ptr);
|
void set_page_ptr_8k(uint8_t page, uint8_t *ptr);
|
||||||
void set_page_ptr_16k(uint8_t page, uint8_t *ptr);
|
void set_page_ptr_16k(uint8_t page, uint8_t *ptr);
|
||||||
void set_page_ptr_32k(uint8_t page, uint8_t *ptr);
|
void set_page_ptr_32k(uint8_t page, uint8_t *ptr);
|
||||||
|
|
||||||
uint8_t *get_page_ptr(uint8_t page);
|
uint8_t *get_page_ptr(uint8_t page);
|
||||||
|
|
||||||
|
|
||||||
/* Functions to set pages attributes */
|
/* Functions to set pages attributes */
|
||||||
|
|
||||||
void set_page_rd_hook(uint8_t page, func_rdhook func);
|
void set_page_rd_hook(uint8_t page, func_rdhook func);
|
||||||
|
|
||||||
void set_page_wr_hook(uint8_t page, func_wrhook func);
|
void set_page_wr_hook(uint8_t page, func_wrhook func);
|
||||||
|
|
||||||
void set_page_readable(uint8_t page, uint8_t value);
|
void set_page_readable(uint8_t page, uint8_t value);
|
||||||
|
|
||||||
void set_page_writeable(uint8_t page, uint8_t value);
|
void set_page_writeable(uint8_t page, uint8_t value);
|
||||||
|
|
||||||
void set_page_ghost(uint8_t page, uint8_t value, uint8_t ghost);
|
void set_page_ghost(uint8_t page, uint8_t value, uint8_t ghost);
|
||||||
|
|
||||||
uint8_t get_page_attributes(uint8_t page);
|
uint8_t get_page_attributes(uint8_t page);
|
||||||
|
|
||||||
func_rdhook get_page_rdhook(uint8_t page);
|
func_rdhook get_page_rdhook(uint8_t page);
|
||||||
|
|
||||||
func_wrhook get_page_wrhook(uint8_t page);
|
func_wrhook get_page_wrhook(uint8_t page);
|
||||||
|
|
||||||
/* Generalist functions */
|
/* Generalist functions */
|
||||||
|
|
||||||
void InitMemory();
|
void InitMemory();
|
||||||
|
|
||||||
uint8_t ReadMemory(uint8_t page, uint8_t addr);
|
uint8_t ReadMemory(uint8_t page, uint8_t addr);
|
||||||
void WriteMemory(uint8_t page, uint8_t addr, uint8_t value);
|
void WriteMemory(uint8_t page, uint8_t addr, uint8_t value);
|
||||||
|
|
||||||
void DumpMemoryState(FILE *fp);
|
void DumpMemoryState(FILE *fp);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
* OS Dependent functions - The peTI-NESulator Project
|
* OS Dependent functions - The peTI-NESulator Project
|
||||||
* os_dependent.h
|
* os_dependent.h
|
||||||
*
|
*
|
||||||
* Created by Manoel TRAPIER on 08/05/08.
|
* Created by Manoël TRAPIER on 08/05/08.
|
||||||
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
* Paddle manager - The peTI-NESulator Project
|
* Paddle manager - The peTI-NESulator Project
|
||||||
* paddle.h
|
* paddle.h
|
||||||
*
|
*
|
||||||
* Created by Manoel TRAPIER.
|
* Created by Manoël TRAPIER.
|
||||||
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@ -12,20 +12,12 @@
|
|||||||
|
|
||||||
typedef struct Paddle_
|
typedef struct Paddle_
|
||||||
{
|
{
|
||||||
|
|
||||||
uint8_t Bit;
|
uint8_t Bit;
|
||||||
|
|
||||||
uint8_t LastWrite;
|
uint8_t LastWrite;
|
||||||
|
|
||||||
} Paddle;
|
} Paddle;
|
||||||
|
|
||||||
|
|
||||||
uint8_t ReadPaddle(Paddle *pdl);
|
uint8_t ReadPaddle(Paddle *pdl);
|
||||||
|
|
||||||
|
|
||||||
void InitPaddle(Paddle *pdl);
|
void InitPaddle(Paddle *pdl);
|
||||||
|
|
||||||
void WritePaddle(Paddle *pdl, uint8_t val);
|
void WritePaddle(Paddle *pdl, uint8_t val);
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
* Plugins manager - The peTI-NESulator Project
|
* Plugins manager - The peTI-NESulator Project
|
||||||
* plugins.h
|
* plugins.h
|
||||||
*
|
*
|
||||||
* Created by Manoel TRAPIER on 02/04/07.
|
* Created by Manoël TRAPIER on 02/04/07.
|
||||||
* Copyright (c) 2003-2008 986Corp. All rights reserved.
|
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -30,12 +30,9 @@ int plugin_keypress(uint8_t key);
|
|||||||
|
|
||||||
/* Real Prototype: TBD */
|
/* Real Prototype: TBD */
|
||||||
void plugin_list();
|
void plugin_list();
|
||||||
|
|
||||||
int plugin_load(int id);
|
int plugin_load(int id);
|
||||||
|
|
||||||
int plugin_unload(int id);
|
int plugin_unload(int id);
|
||||||
|
|
||||||
|
|
||||||
#endif /* __TINES_PLUGINS__ */
|
#endif /* __TINES_PLUGINS__ */
|
||||||
|
|
||||||
#endif /* PLUGINS_H */
|
#endif /* PLUGINS_H */
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
* PPU debug utilities - The peTI-NESulator Project
|
* PPU debug utilities - The peTI-NESulator Project
|
||||||
* ppu.debug.h
|
* ppu.debug.h
|
||||||
*
|
*
|
||||||
* Created by Manoel Trapier on 12/04/07.
|
* Created by Manoël Trapier on 12/04/07.
|
||||||
* Copyright 2003-2008 986 Corp. All rights reserved.
|
* Copyright 2003-2008 986 Corp. All rights reserved.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* Define and emulate the PPU (Picture Processing Unit) of the real NES
|
* Define and emulate the PPU (Picture Processing Unit) of the real NES
|
||||||
*
|
*
|
||||||
* Created by Manoel TRAPIER.
|
* Created by Manoël TRAPIER.
|
||||||
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@ -26,13 +26,9 @@ typedef struct PPU_Sprite_
|
|||||||
PPU must be initialized after memory initialisation..
|
PPU must be initialized after memory initialisation..
|
||||||
*/
|
*/
|
||||||
int ppu_init();
|
int ppu_init();
|
||||||
|
|
||||||
int ppu_hblank(uint16_t scanline);
|
int ppu_hblank(uint16_t scanline);
|
||||||
|
|
||||||
uint8_t ppu_readReg(uint8_t id);
|
uint8_t ppu_readReg(uint8_t id);
|
||||||
|
|
||||||
void ppu_writeReg(uint8_t id, uint8_t val);
|
void ppu_writeReg(uint8_t id, uint8_t val);
|
||||||
|
|
||||||
void ppu_fillSprRamDMA(uint8_t value);
|
void ppu_fillSprRamDMA(uint8_t value);
|
||||||
|
|
||||||
#define PPU_MIRROR_HORIZTAL 0
|
#define PPU_MIRROR_HORIZTAL 0
|
||||||
@ -50,13 +46,9 @@ void ppu_fillSprRamDMA(uint8_t value);
|
|||||||
void ppu_setMirroring(uint8_t direction);
|
void ppu_setMirroring(uint8_t direction);
|
||||||
void ppu_setSingleScreen(uint8_t screen);
|
void ppu_setSingleScreen(uint8_t screen);
|
||||||
void ppu_setScreenMode(uint8_t mode);
|
void ppu_setScreenMode(uint8_t mode);
|
||||||
|
|
||||||
|
|
||||||
PPU_Sprite ppu_getSprite(uint16_t i);
|
PPU_Sprite ppu_getSprite(uint16_t i);
|
||||||
|
|
||||||
uint8_t ppu_memoryRead(uint8_t page, uint8_t addr);
|
uint8_t ppu_memoryRead(uint8_t page, uint8_t addr);
|
||||||
void ppu_memoryWrite(uint8_t page, uint8_t addr, uint8_t value);
|
void ppu_memoryWrite(uint8_t page, uint8_t addr, uint8_t value);
|
||||||
|
|
||||||
void ppu_debugSprites();
|
void ppu_debugSprites();
|
||||||
void ppu_debugColor();
|
void ppu_debugColor();
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
* PPU Memory manager - The peTI-NESulator Project
|
* PPU Memory manager - The peTI-NESulator Project
|
||||||
* ppu.memory.h - Inspired from the memory manager of the Quick6502 Project.
|
* ppu.memory.h - Inspired from the memory manager of the Quick6502 Project.
|
||||||
*
|
*
|
||||||
* Created by Manoel Trapier on 12/04/07.
|
* Created by Manoël Trapier on 12/04/07.
|
||||||
* Copyright 2003-2008 986 Corp. All rights reserved.
|
* Copyright 2003-2008 986 Corp. All rights reserved.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@ -16,12 +16,9 @@ void ppu_setPagePtr1k(uint8_t page, uint8_t *ptr);
|
|||||||
void ppu_setPagePtr2k(uint8_t page, uint8_t *ptr);
|
void ppu_setPagePtr2k(uint8_t page, uint8_t *ptr);
|
||||||
void ppu_setPagePtr4k(uint8_t page, uint8_t *ptr);
|
void ppu_setPagePtr4k(uint8_t page, uint8_t *ptr);
|
||||||
void ppu_setPagePtr8k(uint8_t page, uint8_t *ptr);
|
void ppu_setPagePtr8k(uint8_t page, uint8_t *ptr);
|
||||||
|
|
||||||
void ppu_memoryDumpState(FILE *fp);
|
void ppu_memoryDumpState(FILE *fp);
|
||||||
|
|
||||||
uint8_t ppu_readMemory(uint8_t page, uint8_t addr);
|
uint8_t ppu_readMemory(uint8_t page, uint8_t addr);
|
||||||
void ppu_writeMemory(uint8_t page, uint8_t addr, uint8_t value);
|
void ppu_writeMemory(uint8_t page, uint8_t addr, uint8_t value);
|
||||||
|
|
||||||
void ppu_setPageGhost(uint8_t page, uint8_t value, uint8_t ghost);
|
void ppu_setPageGhost(uint8_t page, uint8_t value, uint8_t ghost);
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
* Base type definitions - The peTI-NESulator Project
|
* Base type definitions - The peTI-NESulator Project
|
||||||
* types.h - Taken from the Quick6502 project
|
* types.h - Taken from the Quick6502 project
|
||||||
*
|
*
|
||||||
* Created by Manoel Trapier on 18/09/06.
|
* Created by Manoël Trapier on 18/09/06.
|
||||||
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|||||||
62
src/log.c
62
src/log.c
@ -2,14 +2,9 @@
|
|||||||
* Log Facility - The Quick6502 Project
|
* Log Facility - The Quick6502 Project
|
||||||
* log.c
|
* log.c
|
||||||
*
|
*
|
||||||
* Created by Manoel Trapier on 19/05/10
|
* Created by Manoël Trapier on 19/05/10
|
||||||
* Copyright 2010 986 Corp. All rights reserved.
|
* Copyright 2010 986 Corp. All rights reserved.
|
||||||
*
|
*
|
||||||
* $LastChangedDate:$
|
|
||||||
* $Author:$
|
|
||||||
* $HeadURL:$
|
|
||||||
* $Revision:$
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@ -22,6 +17,7 @@
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
#ifdef TIME_STAMP_LOG
|
#ifdef TIME_STAMP_LOG
|
||||||
|
|
||||||
void time_stamp_line(void)
|
void time_stamp_line(void)
|
||||||
{
|
{
|
||||||
/* Time "0" will be thefirst log line */
|
/* Time "0" will be thefirst log line */
|
||||||
@ -54,9 +50,11 @@ void time_stamp_line(void)
|
|||||||
printf("%c[s", 0x1B);
|
printf("%c[s", 0x1B);
|
||||||
printf("%c[7000D", 0x1B);
|
printf("%c[7000D", 0x1B);
|
||||||
printf("%c[1C", 0x1B);
|
printf("%c[1C", 0x1B);
|
||||||
printf(FWHITE"[" FYELLOW "%03d" FRED "." FBLUE "%02d" FRED "." FGREEN "%03lld" FWHITE "]" CNORMAL, cMin, cSec, cMSec);
|
printf(FWHITE"[" FYELLOW "%03d" FRED "." FBLUE "%02d" FRED "." FGREEN "%03lld" FWHITE "]" CNORMAL, cMin, cSec,
|
||||||
|
cMSec);
|
||||||
printf("%c[u", 0x1B);
|
printf("%c[u", 0x1B);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* TIME_STAMP_LOG */
|
#endif /* TIME_STAMP_LOG */
|
||||||
|
|
||||||
void log_real(int level, char *user, char *fmt, ...)
|
void log_real(int level, char *user, char *fmt, ...)
|
||||||
@ -68,13 +66,25 @@ void log_real(int level, char *user, char *fmt, ...)
|
|||||||
|
|
||||||
switch (level)
|
switch (level)
|
||||||
{
|
{
|
||||||
case LOG_PANIC: printf(BRED FWHITE); break;
|
case LOG_PANIC:
|
||||||
case LOG_ERROR: printf(FRED); break;
|
printf(BRED FWHITE);
|
||||||
case LOG_WARNING: printf(FYELLOW); break;
|
break;
|
||||||
|
case LOG_ERROR:
|
||||||
|
printf(FRED);
|
||||||
|
break;
|
||||||
|
case LOG_WARNING:
|
||||||
|
printf(FYELLOW);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
case LOG_NORMAL: printf(FGREEN); break;
|
case LOG_NORMAL:
|
||||||
case LOG_VERBOSE: printf(FCYAN); break;
|
printf(FGREEN);
|
||||||
case LOG_DEBUG: printf(BBLUE FWHITE); break;
|
break;
|
||||||
|
case LOG_VERBOSE:
|
||||||
|
printf(FCYAN);
|
||||||
|
break;
|
||||||
|
case LOG_DEBUG:
|
||||||
|
printf(BBLUE FWHITE);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef TIME_STAMP_LOG
|
#ifdef TIME_STAMP_LOG
|
||||||
@ -89,21 +99,35 @@ void log_real(int level, char *user, char *fmt, ...)
|
|||||||
{
|
{
|
||||||
i = 12 - i;
|
i = 12 - i;
|
||||||
for (; i >= 0 ; i--)
|
for (; i >= 0 ; i--)
|
||||||
|
{
|
||||||
putchar(' ');
|
putchar(' ');
|
||||||
}
|
}
|
||||||
|
}
|
||||||
printf("%s", user);
|
printf("%s", user);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
switch (level)
|
switch (level)
|
||||||
{
|
{
|
||||||
case LOG_PANIC: printf(" PANIC"); break;
|
case LOG_PANIC:
|
||||||
case LOG_ERROR: printf(" Error"); break;
|
printf(" PANIC");
|
||||||
case LOG_WARNING: printf(" Warning"); break;
|
break;
|
||||||
|
case LOG_ERROR:
|
||||||
|
printf(" Error");
|
||||||
|
break;
|
||||||
|
case LOG_WARNING:
|
||||||
|
printf(" Warning");
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
case LOG_NORMAL: printf(" Info"); break;
|
case LOG_NORMAL:
|
||||||
case LOG_VERBOSE: printf(" Verbose"); break;
|
printf(" Info");
|
||||||
case LOG_DEBUG: printf(" Debug"); break;
|
break;
|
||||||
|
case LOG_VERBOSE:
|
||||||
|
printf(" Verbose");
|
||||||
|
break;
|
||||||
|
case LOG_DEBUG:
|
||||||
|
printf(" Debug");
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
89
src/main.c
89
src/main.c
@ -2,7 +2,7 @@
|
|||||||
* Main application source file - The peTI-NESulator Project
|
* Main application source file - The peTI-NESulator Project
|
||||||
* main.c
|
* main.c
|
||||||
*
|
*
|
||||||
* Created by Manoel TRAPIER.
|
* Created by Manoël TRAPIER.
|
||||||
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@ -74,17 +74,10 @@ double APU_BASEFREQ = 1.7897725;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_SOUND
|
#ifdef USE_SOUND
|
||||||
#undef USE_SOUND
|
#undef USE_SOUND
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* SVN specific values */
|
|
||||||
|
|
||||||
#define VS_REVISION "$Revision$"
|
|
||||||
#define VS_LASTCHANGEDDATE "$LastChangedDate$"
|
|
||||||
#define VS_AUTHOR "$Author$"
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
#define MAXLASTOP 42
|
#define MAXLASTOP 42
|
||||||
|
|
||||||
@ -125,18 +118,16 @@ short SZHit = -1;
|
|||||||
/* palette */
|
/* palette */
|
||||||
uint32_t ColorPalette[8 * 63];
|
uint32_t ColorPalette[8 * 63];
|
||||||
|
|
||||||
#define SET_RGB(r,g,b) ((((r<<8)|g)<<8)|b)|0xFF000000
|
#define SET_RGB(_r, _g, _b) (((_r) << 16) | ((_g) << 8) | (_b) | 0xFF000000)
|
||||||
|
|
||||||
/* Memory functions */
|
/* Memory functions */
|
||||||
uint8_t MemoryRead(uint16_t Addr);
|
uint8_t MemoryRead(uint16_t Addr);
|
||||||
uint8_t MemoryOpCodeRead(uint16_t Addr);
|
uint8_t MemoryOpCodeRead(uint16_t Addr);
|
||||||
uint8_t MemoryStackRead(uint16_t Addr);
|
uint8_t MemoryStackRead(uint16_t Addr);
|
||||||
uint8_t MemoryPageZeroRead(uint16_t Addr);
|
uint8_t MemoryPageZeroRead(uint16_t Addr);
|
||||||
|
|
||||||
void MemoryWrite(uint16_t Addr, uint8_t Value);
|
void MemoryWrite(uint16_t Addr, uint8_t Value);
|
||||||
void MemoryStackWrite(uint16_t Addr, uint8_t Value);
|
void MemoryStackWrite(uint16_t Addr, uint8_t Value);
|
||||||
void MemoryPageZeroWrite(uint16_t Addr, uint8_t Value);
|
void MemoryPageZeroWrite(uint16_t Addr, uint8_t Value);
|
||||||
|
|
||||||
void Loop6502(quick6502_cpu *R);
|
void Loop6502(quick6502_cpu *R);
|
||||||
|
|
||||||
void CloseHook(void)
|
void CloseHook(void)
|
||||||
@ -272,18 +263,26 @@ void signalhandler(int sig)
|
|||||||
state = 1;
|
state = 1;
|
||||||
|
|
||||||
if (fp == NULL)
|
if (fp == NULL)
|
||||||
|
{
|
||||||
fp = fopen(name, "wt");
|
fp = fopen(name, "wt");
|
||||||
|
}
|
||||||
|
|
||||||
state = 2;
|
state = 2;
|
||||||
|
|
||||||
if (fp) console_printf(Console_Error,
|
if (fp)
|
||||||
|
{
|
||||||
|
console_printf(Console_Error,
|
||||||
"\n\n\n\n\n"
|
"\n\n\n\n\n"
|
||||||
"#sick# peTI-NESulator %d.%d.%d%s #sick#\n"
|
"#sick# peTI-NESulator %d.%d.%d%s #sick#\n"
|
||||||
"see %s for more information",
|
"see %s for more information",
|
||||||
V_MAJOR, V_MINOR, V_MICRO, V_TEXT,
|
V_MAJOR, V_MINOR, V_MICRO, V_TEXT,
|
||||||
name);
|
name);
|
||||||
|
}
|
||||||
|
|
||||||
if (!fp) fp = stderr;
|
if (!fp)
|
||||||
|
{
|
||||||
|
fp = stderr;
|
||||||
|
}
|
||||||
|
|
||||||
fprintf(fp, "\n\n\n\n\n"
|
fprintf(fp, "\n\n\n\n\n"
|
||||||
"#sick# peTI-NESulator %d.%d.%d%s #sick# signal: ",
|
"#sick# peTI-NESulator %d.%d.%d%s #sick# signal: ",
|
||||||
@ -291,13 +290,23 @@ void signalhandler(int sig)
|
|||||||
switch (sig)
|
switch (sig)
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
case SIGABRT: fprintf(fp,"Abnormal termination"); break;
|
case SIGABRT:
|
||||||
case SIGILL: fprintf(fp,"Illegal instruction"); break;
|
fprintf(fp, "Abnormal termination");
|
||||||
case SIGINT: fprintf(fp,"CTRL+C signal"); break;
|
break;
|
||||||
case SIGSEGV: fprintf(fp,"Segmentation fault"); break;
|
case SIGILL:
|
||||||
case SIGTERM: fprintf(fp,"Termination request"); break;
|
fprintf(fp, "Illegal instruction");
|
||||||
|
break;
|
||||||
|
case SIGINT:
|
||||||
|
fprintf(fp, "CTRL+C signal");
|
||||||
|
break;
|
||||||
|
case SIGSEGV:
|
||||||
|
fprintf(fp, "Segmentation fault");
|
||||||
|
break;
|
||||||
|
case SIGTERM:
|
||||||
|
fprintf(fp, "Termination request");
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
fprintf(fp,"\nAn error occured during the excution.\n Crash report information :\n");
|
fprintf(fp, "\nAn error occurred during the excution.\n Crash report information :\n");
|
||||||
|
|
||||||
//quick6502_dump(cpu, fp);
|
//quick6502_dump(cpu, fp);
|
||||||
|
|
||||||
@ -337,7 +346,10 @@ void signalhandler(int sig)
|
|||||||
DumpMemoryState(fp);
|
DumpMemoryState(fp);
|
||||||
|
|
||||||
console_printf(Console_Error, "\nPlease join this informations when submiting crash report\n");
|
console_printf(Console_Error, "\nPlease join this informations when submiting crash report\n");
|
||||||
if (fp != stderr) fclose(fp);
|
if (fp != stderr)
|
||||||
|
{
|
||||||
|
fclose(fp);
|
||||||
|
}
|
||||||
|
|
||||||
exit(-42);
|
exit(-42);
|
||||||
}
|
}
|
||||||
@ -438,7 +450,7 @@ int main(int argc, char *argv[])
|
|||||||
/* Print the banner */
|
/* Print the banner */
|
||||||
console_printf(Console_Default, "--------------------------------------------------------------------------------\n"
|
console_printf(Console_Default, "--------------------------------------------------------------------------------\n"
|
||||||
"Welcome to peTI-NESulator v%d.%d.%d%s - by Godzil`\n"
|
"Welcome to peTI-NESulator v%d.%d.%d%s - by Godzil`\n"
|
||||||
"Copyright 2003-2018 Manoel TRAPIER (petines@godzil.net)\n"
|
"Copyright 2003-2018 Manoël TRAPIER (petines@godzil.net)\n"
|
||||||
"--------------------------------------------------------------------------------\n\n",
|
"--------------------------------------------------------------------------------\n\n",
|
||||||
V_MAJOR, V_MINOR, V_MICRO, V_TEXT);
|
V_MAJOR, V_MINOR, V_MICRO, V_TEXT);
|
||||||
|
|
||||||
@ -509,7 +521,9 @@ int main(int argc, char *argv[])
|
|||||||
CART_FILENAME = argv[argc - 1];
|
CART_FILENAME = argv[argc - 1];
|
||||||
|
|
||||||
if (CART_FILENAME == NULL)
|
if (CART_FILENAME == NULL)
|
||||||
|
{
|
||||||
printUsage(argc, argv);
|
printUsage(argc, argv);
|
||||||
|
}
|
||||||
|
|
||||||
console_printf(Console_Default, "Allocating 6502 memory\t\t");
|
console_printf(Console_Default, "Allocating 6502 memory\t\t");
|
||||||
|
|
||||||
@ -728,7 +742,9 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
console_printf(Console_Default, "Init mapper...\t\t\t");
|
console_printf(Console_Default, "Init mapper...\t\t\t");
|
||||||
if (mapper_init(Cart) == -1)
|
if (mapper_init(Cart) == -1)
|
||||||
|
{
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
console_printf(Console_Default, "[ OK ]\n");
|
console_printf(Console_Default, "[ OK ]\n");
|
||||||
|
|
||||||
// set_palette(basicPalette);
|
// set_palette(basicPalette);
|
||||||
@ -829,32 +845,33 @@ void MemoryPageZeroWrite (uint16_t Addr, uint8_t Value)
|
|||||||
|
|
||||||
void Loop6502(quick6502_cpu *R)
|
void Loop6502(quick6502_cpu *R)
|
||||||
{
|
{
|
||||||
uint8_t ret;
|
quick6502_signal cpuSignal;
|
||||||
// short skey;
|
// short skey;
|
||||||
long WaitTime;
|
long WaitTime;
|
||||||
static long delta = 0;
|
static long delta = 0;
|
||||||
|
|
||||||
ret = 0;
|
cpuSignal = Q6502_NO_SIGNAL;
|
||||||
|
|
||||||
if ((mapper_irqloop) && (mapper_irqloop(ScanLine)))
|
if ((mapper_irqloop) && (mapper_irqloop(ScanLine)))
|
||||||
{
|
{
|
||||||
ret = Q6502_IRQ_SIGNAL;
|
cpuSignal = Q6502_IRQ_SIGNAL;
|
||||||
IRQScanHit = ScanLine;
|
IRQScanHit = ScanLine;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (MapperWantIRQ == 1)
|
if (MapperWantIRQ == 1)
|
||||||
{
|
{
|
||||||
MapperWantIRQ = 0;
|
MapperWantIRQ = 0;
|
||||||
ret = Q6502_IRQ_SIGNAL;
|
cpuSignal = Q6502_IRQ_SIGNAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ppu_hblank(ScanLine) != 0)
|
if (ppu_hblank(ScanLine) != 0)
|
||||||
{
|
{
|
||||||
ret = Q6502_NMI_SIGNAL;
|
cpuSignal = Q6502_NMI_SIGNAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ScanLine == (239 + VBLANK_TIME))
|
if (ScanLine == (239 + VBLANK_TIME))
|
||||||
{ /* End of VBlank Time */
|
{
|
||||||
|
/* End of VBlank Time */
|
||||||
frame++;
|
frame++;
|
||||||
SZHit = -1;
|
SZHit = -1;
|
||||||
IRQScanHit = -1;
|
IRQScanHit = -1;
|
||||||
@ -876,8 +893,12 @@ void Loop6502(quick6502_cpu *R)
|
|||||||
/* If we press Page Up, we want to accelerate "time" */
|
/* If we press Page Up, we want to accelerate "time" */
|
||||||
#ifndef RUN_COVERAGE
|
#ifndef RUN_COVERAGE
|
||||||
if (!getKeyStatus('Y'))
|
if (!getKeyStatus('Y'))
|
||||||
|
{
|
||||||
if ((WaitTime >= 0) && (WaitTime < 100000))
|
if ((WaitTime >= 0) && (WaitTime < 100000))
|
||||||
|
{
|
||||||
usleep(WaitTime);
|
usleep(WaitTime);
|
||||||
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Now get the time after sleep */
|
/* Now get the time after sleep */
|
||||||
@ -892,20 +913,28 @@ void Loop6502(quick6502_cpu *R)
|
|||||||
|
|
||||||
/* To avoid strange time warp when stopping emulation or using acceleration a lot */
|
/* To avoid strange time warp when stopping emulation or using acceleration a lot */
|
||||||
if ((delta > 10000) || (delta < -10000))
|
if ((delta > 10000) || (delta < -10000))
|
||||||
|
{
|
||||||
delta = 0;
|
delta = 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* There is Two dummy scanline */
|
/* There is Two dummy scanline */
|
||||||
if (ScanLine >= (239 + VBLANK_TIME + 4))
|
if (ScanLine >= (239 + VBLANK_TIME + 4))
|
||||||
|
{
|
||||||
ScanLine = 0;
|
ScanLine = 0;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
ScanLine++;
|
ScanLine++;
|
||||||
|
}
|
||||||
|
|
||||||
//console_printf(Console_Default, "SL:%d HBT:%d VbT:%d\n", ScanLine, HBLANK_TIME, VBLANK_TIME);
|
//console_printf(Console_Default, "SL:%d HBT:%d VbT:%d\n", ScanLine, HBLANK_TIME, VBLANK_TIME);
|
||||||
|
|
||||||
// TODO: NO DEBUGER
|
// TODO: NO DEBUGER
|
||||||
if (getKeyStatus(GLFW_KEY_ESCAPE))
|
if (getKeyStatus(GLFW_KEY_ESCAPE))
|
||||||
|
{
|
||||||
exit(0);
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
if (skey == '9')
|
if (skey == '9')
|
||||||
@ -942,7 +971,9 @@ void Loop6502(quick6502_cpu *R)
|
|||||||
|
|
||||||
// plugin_keypress(skey);
|
// plugin_keypress(skey);
|
||||||
|
|
||||||
if (ret != 0)
|
if (cpuSignal != 0)
|
||||||
quick6502_int(R, ret);
|
{
|
||||||
|
quick6502_int(R, cpuSignal);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# peTI-NESulator CMake
|
# peTI-NESulator CMake
|
||||||
#
|
#
|
||||||
# Created by Manoel TRAPIER.
|
# Created by Manoël TRAPIER.
|
||||||
# Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
# Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
||||||
#
|
#
|
||||||
# $LastChangedDate$
|
# $LastChangedDate$
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
* Mapper manager - The peTI-NESulator Project
|
* Mapper manager - The peTI-NESulator Project
|
||||||
* manager.c
|
* manager.c
|
||||||
*
|
*
|
||||||
* Created by Manoel TRAPIER.
|
* Created by Manoël TRAPIER.
|
||||||
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@ -34,7 +34,7 @@ typedef struct Mapper_
|
|||||||
void mapper_list()
|
void mapper_list()
|
||||||
{
|
{
|
||||||
Mapper *ptr = &(Mappers[0]);
|
Mapper *ptr = &(Mappers[0]);
|
||||||
console_printf(Console_Default, "Available mapers:\n");
|
console_printf(Console_Default, "Available mappers:\n");
|
||||||
while (ptr->name != NULL)
|
while (ptr->name != NULL)
|
||||||
{
|
{
|
||||||
console_printf(Console_Default, "%d - %s\n", ptr->id, ptr->name);
|
console_printf(Console_Default, "%d - %s\n", ptr->id, ptr->name);
|
||||||
@ -52,7 +52,9 @@ int mapper_init (NesCart *cart)
|
|||||||
{
|
{
|
||||||
console_printf(Console_Default, "Found mapper ID #%d - '%s'\n", ptr->id, ptr->name);
|
console_printf(Console_Default, "Found mapper ID #%d - '%s'\n", ptr->id, ptr->name);
|
||||||
if (ptr->init)
|
if (ptr->init)
|
||||||
|
{
|
||||||
ptr->init(cart);
|
ptr->init(cart);
|
||||||
|
}
|
||||||
|
|
||||||
mapper_irqloop = ptr->irq;
|
mapper_irqloop = ptr->irq;
|
||||||
mapper_dump = ptr->dump;
|
mapper_dump = ptr->dump;
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
* AOROM Mapper - The peTI-NESulator Project
|
* AOROM Mapper - The peTI-NESulator Project
|
||||||
* aorom.c
|
* aorom.c
|
||||||
*
|
*
|
||||||
* Created by Manoel TRAPIER.
|
* Created by Manoël TRAPIER.
|
||||||
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@ -42,9 +42,13 @@ void aorom_MapperWriteHook(register uint8_t Addr, register uint8_t Value)
|
|||||||
int BankNb;
|
int BankNb;
|
||||||
|
|
||||||
if (Value & (1 << 4))
|
if (Value & (1 << 4))
|
||||||
|
{
|
||||||
ppu_setSingleScreen(PPU_SCREEN_000);
|
ppu_setSingleScreen(PPU_SCREEN_000);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
ppu_setSingleScreen(PPU_SCREEN_400);
|
ppu_setSingleScreen(PPU_SCREEN_400);
|
||||||
|
}
|
||||||
|
|
||||||
BankNb = Value & 0x0F;
|
BankNb = Value & 0x0F;
|
||||||
|
|
||||||
|
|||||||
@ -2,12 +2,13 @@
|
|||||||
* AOROM Mapper - The peTI-NESulator Project
|
* AOROM Mapper - The peTI-NESulator Project
|
||||||
* aorom.h
|
* aorom.h
|
||||||
*
|
*
|
||||||
* Created by Manoel TRAPIER.
|
* Created by Manoël TRAPIER.
|
||||||
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define __TINES_MAPPERS__
|
#define __TINES_MAPPERS__
|
||||||
|
|
||||||
#include <mappers/manager.h>
|
#include <mappers/manager.h>
|
||||||
|
|
||||||
int aorom_InitMapper(NesCart *cart);
|
int aorom_InitMapper(NesCart *cart);
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
* CNROM Mapper - The peTI-NESulator Project
|
* CNROM Mapper - The peTI-NESulator Project
|
||||||
* cnrom.c
|
* cnrom.c
|
||||||
*
|
*
|
||||||
* Created by Manoel TRAPIER.
|
* Created by Manoël TRAPIER.
|
||||||
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -2,12 +2,13 @@
|
|||||||
* CNROM Mapper - The peTI-NESulator Project
|
* CNROM Mapper - The peTI-NESulator Project
|
||||||
* cnrom.h
|
* cnrom.h
|
||||||
*
|
*
|
||||||
* Created by Manoel TRAPIER.
|
* Created by Manoël TRAPIER.
|
||||||
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define __TINES_MAPPERS__
|
#define __TINES_MAPPERS__
|
||||||
|
|
||||||
#include <mappers/manager.h>
|
#include <mappers/manager.h>
|
||||||
|
|
||||||
int cnrom_InitMapper(NesCart *cart);
|
int cnrom_InitMapper(NesCart *cart);
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
* Generic mapper implementation - The peTI-NESulator Project
|
* Generic mapper implementation - The peTI-NESulator Project
|
||||||
* genericmapper.h
|
* genericmapper.h
|
||||||
*
|
*
|
||||||
* Created by Manoel TRAPIER.
|
* Created by Manoël TRAPIER.
|
||||||
* Copyright (c) 2003-2008 986Corp. All rights reserved.
|
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
* IREMH3001 Mapper - The peTI-NESulator Project
|
* IREMH3001 Mapper - The peTI-NESulator Project
|
||||||
* iremh3001.c
|
* iremh3001.c
|
||||||
*
|
*
|
||||||
* Created by Manoel TRAPIER.
|
* Created by Manoël TRAPIER.
|
||||||
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -2,12 +2,13 @@
|
|||||||
* IREMH3001 Mapper - The peTI-NESulator Project
|
* IREMH3001 Mapper - The peTI-NESulator Project
|
||||||
* iremh3001.h
|
* iremh3001.h
|
||||||
*
|
*
|
||||||
* Created by Manoel TRAPIER.
|
* Created by Manoël TRAPIER.
|
||||||
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define __TINES_MAPPERS__
|
#define __TINES_MAPPERS__
|
||||||
|
|
||||||
#include <mappers/manager.h>
|
#include <mappers/manager.h>
|
||||||
|
|
||||||
int iremh3001_InitMapper(NesCart *cart);
|
int iremh3001_InitMapper(NesCart *cart);
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
* MMC1 Mapper - The peTI-NESulator Project
|
* MMC1 Mapper - The peTI-NESulator Project
|
||||||
* mmc1.h
|
* mmc1.h
|
||||||
*
|
*
|
||||||
* Created by Manoel TRAPIER.
|
* Created by Manoël TRAPIER.
|
||||||
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@ -39,10 +39,10 @@ uint8_t mmc1_CurrentBank;
|
|||||||
#define MMC1_R3_RESET 0x80
|
#define MMC1_R3_RESET 0x80
|
||||||
|
|
||||||
|
|
||||||
#define MMC1_REG0_DEFAULT MMC1_R0_PRGSIZE | MMC1_R0_PRGAREA
|
#define MMC1_REG0_DEFAULT (MMC1_R0_PRGSIZE | MMC1_R0_PRGAREA)
|
||||||
#define MMC1_REG1_DEFAULT 0
|
#define MMC1_REG1_DEFAULT (0)
|
||||||
#define MMC1_REG2_DEFAULT 0
|
#define MMC1_REG2_DEFAULT (0)
|
||||||
#define MMC1_REG3_DEFAULT 0
|
#define MMC1_REG3_DEFAULT (0)
|
||||||
|
|
||||||
void mmc1_MapperWriteReg0(register uint8_t Addr, register uint8_t Value);
|
void mmc1_MapperWriteReg0(register uint8_t Addr, register uint8_t Value);
|
||||||
void mmc1_MapperWriteReg1(register uint8_t Addr, register uint8_t Value);
|
void mmc1_MapperWriteReg1(register uint8_t Addr, register uint8_t Value);
|
||||||
@ -72,7 +72,9 @@ int mmc1_InitMapper(NesCart * cart)
|
|||||||
mmc1_CurrentBank = 0;
|
mmc1_CurrentBank = 0;
|
||||||
|
|
||||||
if (cart->VROMSize > 0)
|
if (cart->VROMSize > 0)
|
||||||
|
{
|
||||||
set_vrom_bank_4k(0x0000, 0);
|
set_vrom_bank_4k(0x0000, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Mapper should register itself for write hook */
|
/* Mapper should register itself for write hook */
|
||||||
@ -121,11 +123,12 @@ Reg 0
|
|||||||
|
|
||||||
((Addr & 0x6000) >> 13) <- port number
|
((Addr & 0x6000) >> 13) <- port number
|
||||||
*/
|
*/
|
||||||
#define MMC1_GetReg(a) ((a & 0x6000) >> 13)
|
|
||||||
|
#define MMC1_GetReg(_a) (((_a) & 0x6000) >> 13)
|
||||||
/* (Val & 0x01) recuperation du bit */
|
/* (Val & 0x01) recuperation du bit */
|
||||||
#define MMC1_GetBit(v) (v & 0x01)
|
#define MMC1_GetBit(_v) ((_v) & 0x01)
|
||||||
/* ( ( b & (1 << Bit)) | (v << Bit) ) Ajout du bit */
|
/* ( ( b & (1 << Bit)) | (v << Bit) ) Ajout du bit */
|
||||||
#define MMC1_AddBit(b,v) ( ( b & ~(1 << Bit)) | (v << Bit) )
|
#define MMC1_AddBit(_b, _v) ( ( (_b) & ~(1 << Bit)) | ( (_v) << Bit) )
|
||||||
|
|
||||||
void mmc1_ApplyReg0Mod()
|
void mmc1_ApplyReg0Mod()
|
||||||
{
|
{
|
||||||
@ -138,6 +141,7 @@ void mmc1_ApplyReg0Mod()
|
|||||||
|
|
||||||
switch (MMC1_reg0 & 0x03)
|
switch (MMC1_reg0 & 0x03)
|
||||||
{
|
{
|
||||||
|
default:
|
||||||
case 0:
|
case 0:
|
||||||
ppu_setScreenMode(PPU_SCMODE_SINGLE);
|
ppu_setScreenMode(PPU_SCMODE_SINGLE);
|
||||||
ppu_setSingleScreen(PPU_SCREEN_000);
|
ppu_setSingleScreen(PPU_SCREEN_000);
|
||||||
@ -186,7 +190,7 @@ void mmc1_MapperWriteReg0(register uint8_t Addr, register uint8_t Value)
|
|||||||
if (Value & 0x80)
|
if (Value & 0x80)
|
||||||
{
|
{
|
||||||
MMC1_reg0 = MMC1_REG0_DEFAULT;
|
MMC1_reg0 = MMC1_REG0_DEFAULT;
|
||||||
console_printf(Console_Default, "MMC1: Reg0 Reset occured !\n");
|
console_printf(Console_Default, "MMC1: Reg0 Reset occurred !\n");
|
||||||
mmc1_ApplyReg0Mod();
|
mmc1_ApplyReg0Mod();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -213,7 +217,7 @@ void mmc1_MapperWriteReg1(register uint8_t Addr, register uint8_t Value)
|
|||||||
if (Value & 0x80)
|
if (Value & 0x80)
|
||||||
{
|
{
|
||||||
MMC1_reg1 = MMC1_REG1_DEFAULT;
|
MMC1_reg1 = MMC1_REG1_DEFAULT;
|
||||||
console_printf(Console_Default, "MMC1: Reg1 Reset occured !\n");
|
console_printf(Console_Default, "MMC1: Reg1 Reset occurred !\n");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -233,7 +237,8 @@ void mmc1_MapperWriteReg1(register uint8_t Addr, register uint8_t Value)
|
|||||||
|
|
||||||
if (Cart->VROMSize == 0)
|
if (Cart->VROMSize == 0)
|
||||||
{
|
{
|
||||||
console_printf(Console_Default, "Try to change VROM but with didn't have any VROM ! [%04X]\n", VROMBankNb);
|
console_printf(Console_Default, "Try to change VROM but with didn't have any VROM ! [%04X]\n",
|
||||||
|
VROMBankNb);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -256,7 +261,7 @@ void mmc1_MapperWriteReg2(register uint8_t Addr, register uint8_t Value)
|
|||||||
if (Value & 0x80)
|
if (Value & 0x80)
|
||||||
{
|
{
|
||||||
MMC1_reg2 = MMC1_REG2_DEFAULT;
|
MMC1_reg2 = MMC1_REG2_DEFAULT;
|
||||||
console_printf(Console_Default, "MMC1: Reg2 Reset occured !\n");
|
console_printf(Console_Default, "MMC1: Reg2 Reset occurred !\n");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -300,7 +305,7 @@ void mmc1_MapperWriteReg3(register uint8_t Addr, register uint8_t Value)
|
|||||||
if (Value & 0x80)
|
if (Value & 0x80)
|
||||||
{
|
{
|
||||||
MMC1_reg3 = MMC1_REG3_DEFAULT;
|
MMC1_reg3 = MMC1_REG3_DEFAULT;
|
||||||
console_printf(Console_Default, "MMC1: Reg3 Reset occured !\n");
|
console_printf(Console_Default, "MMC1: Reg3 Reset occurred !\n");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -317,7 +322,9 @@ void mmc1_MapperWriteReg3(register uint8_t Addr, register uint8_t Value)
|
|||||||
MMC1_reg3 = BitBuf;
|
MMC1_reg3 = BitBuf;
|
||||||
|
|
||||||
if (((uint32_t)MMC1_reg3 << 14) > Cart->PROMSize)
|
if (((uint32_t)MMC1_reg3 << 14) > Cart->PROMSize)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if ((MMC1_reg0 & MMC1_R0_PRGSIZE) != 0)
|
if ((MMC1_reg0 & MMC1_R0_PRGSIZE) != 0)
|
||||||
{ /* 16K Switch */
|
{ /* 16K Switch */
|
||||||
|
|||||||
@ -2,12 +2,13 @@
|
|||||||
* MMC1 Mapper - The peTI-NESulator Project
|
* MMC1 Mapper - The peTI-NESulator Project
|
||||||
* mmc1.h
|
* mmc1.h
|
||||||
*
|
*
|
||||||
* Created by Manoel TRAPIER.
|
* Created by Manoël TRAPIER.
|
||||||
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define __TINES_MAPPERS__
|
#define __TINES_MAPPERS__
|
||||||
|
|
||||||
#include <mappers/manager.h>
|
#include <mappers/manager.h>
|
||||||
|
|
||||||
int mmc1_InitMapper(NesCart *cart);
|
int mmc1_InitMapper(NesCart *cart);
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
* MMC3 Mapper - The peTI-NESulator Project
|
* MMC3 Mapper - The peTI-NESulator Project
|
||||||
* mmc3.h
|
* mmc3.h
|
||||||
*
|
*
|
||||||
* Created by Manoel TRAPIER.
|
* Created by Manoël TRAPIER.
|
||||||
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@ -27,15 +27,17 @@ uint8_t mmc3_last_prom_switch;
|
|||||||
|
|
||||||
uint16_t dummy;
|
uint16_t dummy;
|
||||||
|
|
||||||
void mmc3_MapperWrite80Hook(uint8_t addr, uint8_t value);
|
void mmc3_MapperWrite80Hook(uint8_t addr, uint8_t Value);
|
||||||
void mmc3_MapperWriteA0Hook(uint8_t addr, uint8_t value);
|
void mmc3_MapperWriteA0Hook(uint8_t addr, uint8_t Value);
|
||||||
void mmc3_MapperWriteC0Hook(uint8_t addr, uint8_t value);
|
void mmc3_MapperWriteC0Hook(uint8_t addr, uint8_t Value);
|
||||||
void mmc3_MapperWriteE0Hook(uint8_t addr, uint8_t value);
|
void mmc3_MapperWriteE0Hook(uint8_t addr, uint8_t Value);
|
||||||
|
|
||||||
void mmc3_MapperDump(FILE *fp)
|
void mmc3_MapperDump(FILE *fp)
|
||||||
{
|
{
|
||||||
fprintf(fp,"MMC3: CMD:%d IC:%d IR:%d IE:%d FPP:0x%04X SPP:0x%04X UX:%d\n",mmc3_command,mmc3_irq_counter,mmc3_irq_counter_reload,mmc3_irq_enable,mmc3_first_prom_page,mmc3_second_prom_page,mmc3_use_xor);
|
fprintf(fp, "MMC3: CMD:%d IC:%d IR:%d IE:%d FPP:0x%04X SPP:0x%04X UX:%d\n", mmc3_command, mmc3_irq_counter,
|
||||||
fprintf(fp,"MMC3: LV0:%d LV1:%d LV2:%d LV3:%d LV4:%d LV5:%d\n",mmc3_last_vrom[0],mmc3_last_vrom[1],mmc3_last_vrom[2],mmc3_last_vrom[3],mmc3_last_vrom[4],mmc3_last_vrom[5]);
|
mmc3_irq_counter_reload, mmc3_irq_enable, mmc3_first_prom_page, mmc3_second_prom_page, mmc3_use_xor);
|
||||||
|
fprintf(fp, "MMC3: LV0:%d LV1:%d LV2:%d LV3:%d LV4:%d LV5:%d\n", mmc3_last_vrom[0], mmc3_last_vrom[1],
|
||||||
|
mmc3_last_vrom[2], mmc3_last_vrom[3], mmc3_last_vrom[4], mmc3_last_vrom[5]);
|
||||||
fprintf(fp, "MMC3: LP0:%d LP1:%d LPS:%d\n", mmc3_last_prom[0], mmc3_last_prom[1], mmc3_last_prom_switch);
|
fprintf(fp, "MMC3: LP0:%d LP1:%d LPS:%d\n", mmc3_last_prom[0], mmc3_last_prom[1], mmc3_last_prom_switch);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -92,7 +94,9 @@ void mmc3_MapperWrite80Hook(uint8_t addr, uint8_t Value)
|
|||||||
{
|
{
|
||||||
//console_printf(Console_Default, "%s(0x%02X, 0x%02X)\n", __func__, addr, Value);
|
//console_printf(Console_Default, "%s(0x%02X, 0x%02X)\n", __func__, addr, Value);
|
||||||
if (addr > 0x01)
|
if (addr > 0x01)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!addr)
|
if (!addr)
|
||||||
{
|
{
|
||||||
@ -157,10 +161,12 @@ void mmc3_MapperWrite80Hook(uint8_t addr, uint8_t Value)
|
|||||||
mmc3_command = Value & 0x07;
|
mmc3_command = Value & 0x07;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
} else { /* 8001 */
|
else
|
||||||
|
{ /* 8001 */
|
||||||
switch (mmc3_command)
|
switch (mmc3_command)
|
||||||
{
|
{
|
||||||
|
default:
|
||||||
case 0:
|
case 0:
|
||||||
case 1:
|
case 1:
|
||||||
case 2:
|
case 2:
|
||||||
@ -168,7 +174,9 @@ void mmc3_MapperWrite80Hook(uint8_t addr, uint8_t Value)
|
|||||||
case 4:
|
case 4:
|
||||||
case 5:
|
case 5:
|
||||||
if (Cart->VROMSize == 0)
|
if (Cart->VROMSize == 0)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
mmc3_last_vrom[mmc3_command] = Value;
|
mmc3_last_vrom[mmc3_command] = Value;
|
||||||
|
|
||||||
@ -220,26 +228,36 @@ void mmc3_MapperWriteA0Hook(uint8_t addr, uint8_t Value)
|
|||||||
{
|
{
|
||||||
//console_printf(Console_Default, "%s(0x%02X, 0x%02X)\n", __func__, addr, Value);
|
//console_printf(Console_Default, "%s(0x%02X, 0x%02X)\n", __func__, addr, Value);
|
||||||
if (addr > 0x01)
|
if (addr > 0x01)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!addr)
|
if (!addr)
|
||||||
{
|
{
|
||||||
//console_printf(Console_Default, "MMC3: Select mirroring (0xA000) : 0x%X\n",Value);
|
//console_printf(Console_Default, "MMC3: Select mirroring (0xA000) : 0x%X\n",Value);
|
||||||
|
|
||||||
if (Value & 0x1)
|
if (Value & 0x1)
|
||||||
|
{
|
||||||
ppu_setMirroring(PPU_MIRROR_HORIZTAL);
|
ppu_setMirroring(PPU_MIRROR_HORIZTAL);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
ppu_setMirroring(PPU_MIRROR_VERTICAL);
|
ppu_setMirroring(PPU_MIRROR_VERTICAL);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//console_printf(Console_Default, "MMC3: SaveRAM Toggle (0xA001) : 0x%X\n",Value);
|
//console_printf(Console_Default, "MMC3: SaveRAM Toggle (0xA001) : 0x%X\n",Value);
|
||||||
if (Value)
|
if (Value)
|
||||||
|
{
|
||||||
map_sram();
|
map_sram();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
unmap_sram();
|
unmap_sram();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -247,7 +265,9 @@ void mmc3_MapperWriteC0Hook(uint8_t addr, uint8_t Value)
|
|||||||
{
|
{
|
||||||
//console_printf(Console_Default, "%s(0x%02X, 0x%02X)\n", __func__, addr, Value);
|
//console_printf(Console_Default, "%s(0x%02X, 0x%02X)\n", __func__, addr, Value);
|
||||||
if (addr > 0x01)
|
if (addr > 0x01)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!addr)
|
if (!addr)
|
||||||
{
|
{
|
||||||
@ -255,7 +275,9 @@ void mmc3_MapperWriteC0Hook(uint8_t addr, uint8_t Value)
|
|||||||
mmc3_irq_counter = Value;
|
mmc3_irq_counter = Value;
|
||||||
//console_printf(Console_Default, "MMC3 IRQ[%d]: SetIRQ reload to %d\n", ScanLine, Value);
|
//console_printf(Console_Default, "MMC3 IRQ[%d]: SetIRQ reload to %d\n", ScanLine, Value);
|
||||||
|
|
||||||
}else{ /* C001 */
|
}
|
||||||
|
else
|
||||||
|
{ /* C001 */
|
||||||
//console_printf(Console_Default, "MMC3: New tmp IRQ value (0xC001) : 0x%X\n",Value);
|
//console_printf(Console_Default, "MMC3: New tmp IRQ value (0xC001) : 0x%X\n",Value);
|
||||||
//console_printf(Console_Default, "MMC3 IRQ[%d]: Reset IRQ counter to val %d [Value = %d]\n", ScanLine, mmc3_irq_counter_reload, Value);
|
//console_printf(Console_Default, "MMC3 IRQ[%d]: Reset IRQ counter to val %d [Value = %d]\n", ScanLine, mmc3_irq_counter_reload, Value);
|
||||||
mmc3_irq_counter = Value;
|
mmc3_irq_counter = Value;
|
||||||
@ -266,7 +288,9 @@ void mmc3_MapperWriteE0Hook(uint8_t addr, uint8_t Value)
|
|||||||
{
|
{
|
||||||
//console_printf(Console_Default, "%s(0x%02X, 0x%02X)\n", __func__, addr, Value);
|
//console_printf(Console_Default, "%s(0x%02X, 0x%02X)\n", __func__, addr, Value);
|
||||||
if (addr > 0x01)
|
if (addr > 0x01)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!addr)
|
if (!addr)
|
||||||
{
|
{
|
||||||
@ -276,7 +300,9 @@ void mmc3_MapperWriteE0Hook(uint8_t addr, uint8_t Value)
|
|||||||
//MapperWantIRQ = 1;
|
//MapperWantIRQ = 1;
|
||||||
// Add a way to raise an IRQ
|
// Add a way to raise an IRQ
|
||||||
|
|
||||||
}else{ /* E001 */
|
}
|
||||||
|
else
|
||||||
|
{ /* E001 */
|
||||||
//console_printf(Console_Default, "MMC3: Writing to 0xE001 : 0x%X\n",Value);
|
//console_printf(Console_Default, "MMC3: Writing to 0xE001 : 0x%X\n",Value);
|
||||||
//console_printf(Console_Default, "MMC3: IRQ Enabled (value : %d)\n",mmc3_irq_counter);
|
//console_printf(Console_Default, "MMC3: IRQ Enabled (value : %d)\n",mmc3_irq_counter);
|
||||||
//console_printf(Console_Default, "MMC3 IRQ[%d]: Enable IRQ\nr", ScanLine);
|
//console_printf(Console_Default, "MMC3 IRQ[%d]: Enable IRQ\nr", ScanLine);
|
||||||
@ -290,13 +316,19 @@ int mmc3_MapperIRQ(int cycledone)
|
|||||||
(ppu.ControlRegister2.b & (PPU_CR2_BGVISIBILITY | PPU_CR2_SPRTVISIBILITY)) == (PPU_CR2_BGVISIBILITY | PPU_CR2_SPRTVISIBILITY)*/)
|
(ppu.ControlRegister2.b & (PPU_CR2_BGVISIBILITY | PPU_CR2_SPRTVISIBILITY)) == (PPU_CR2_BGVISIBILITY | PPU_CR2_SPRTVISIBILITY)*/)
|
||||||
{
|
{
|
||||||
|
|
||||||
if ((mmc3_irq_counter --) > 0 )return 0;
|
if ((mmc3_irq_counter--) > 0)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Load next counter position */
|
/* Load next counter position */
|
||||||
mmc3_irq_counter = mmc3_irq_counter_reload;
|
mmc3_irq_counter = mmc3_irq_counter_reload;
|
||||||
|
|
||||||
if (mmc3_irq_enable == 0) return 0;
|
if (mmc3_irq_enable == 0)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
mmc3_irq_enable = 0;
|
mmc3_irq_enable = 0;
|
||||||
|
|
||||||
|
|||||||
@ -2,12 +2,13 @@
|
|||||||
* MMC3 Mapper - The peTI-NESulator Project
|
* MMC3 Mapper - The peTI-NESulator Project
|
||||||
* mmc3.h
|
* mmc3.h
|
||||||
*
|
*
|
||||||
* Created by Manoel TRAPIER.
|
* Created by Manoël TRAPIER.
|
||||||
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define __TINES_MAPPERS__
|
#define __TINES_MAPPERS__
|
||||||
|
|
||||||
#include <mappers/manager.h>
|
#include <mappers/manager.h>
|
||||||
|
|
||||||
void mmc3_MapperDump(FILE *fp);
|
void mmc3_MapperDump(FILE *fp);
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
* MMC4 Mapper - The peTI-NESulator Project
|
* MMC4 Mapper - The peTI-NESulator Project
|
||||||
* mmc4.h
|
* mmc4.h
|
||||||
*
|
*
|
||||||
* Created by Manoel TRAPIER.
|
* Created by Manoël TRAPIER.
|
||||||
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@ -67,10 +67,14 @@ void mmc4_MapperWriteRegF(register uint8_t Addr, register uint8_t Value)
|
|||||||
LOG(("%s(%02X, %02X)\n", __func__, Addr, Value));
|
LOG(("%s(%02X, %02X)\n", __func__, Addr, Value));
|
||||||
mmc4_RegF = Value;
|
mmc4_RegF = Value;
|
||||||
if (Value & 0x01)
|
if (Value & 0x01)
|
||||||
|
{
|
||||||
ppu_setMirroring(PPU_MIRROR_HORIZTAL);
|
ppu_setMirroring(PPU_MIRROR_HORIZTAL);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
ppu_setMirroring(PPU_MIRROR_VERTICAL);
|
ppu_setMirroring(PPU_MIRROR_VERTICAL);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void mmc4_MapperDump(FILE *fp)
|
void mmc4_MapperDump(FILE *fp)
|
||||||
@ -86,7 +90,9 @@ int mmc4_InitMapper(NesCart * cart)
|
|||||||
set_prom_bank_16k(0xC000, GETLAST16KBANK(cart));
|
set_prom_bank_16k(0xC000, GETLAST16KBANK(cart));
|
||||||
|
|
||||||
if (cart->VROMSize > 0)
|
if (cart->VROMSize > 0)
|
||||||
|
{
|
||||||
set_vrom_bank_8k(0x0000, 0);
|
set_vrom_bank_8k(0x0000, 0);
|
||||||
|
}
|
||||||
|
|
||||||
/* Mapper should register itself for write hook */
|
/* Mapper should register itself for write hook */
|
||||||
for (i = 0xA0 ; i < 0xB0 ; i++)
|
for (i = 0xA0 ; i < 0xB0 ; i++)
|
||||||
|
|||||||
@ -2,12 +2,13 @@
|
|||||||
* MMC4 Mapper - The peTI-NESulator Project
|
* MMC4 Mapper - The peTI-NESulator Project
|
||||||
* mmc4.h
|
* mmc4.h
|
||||||
*
|
*
|
||||||
* Created by Manoel TRAPIER.
|
* Created by Manoël TRAPIER.
|
||||||
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define __TINES_MAPPERS__
|
#define __TINES_MAPPERS__
|
||||||
|
|
||||||
#include <mappers/manager.h>
|
#include <mappers/manager.h>
|
||||||
|
|
||||||
void mmc4_MapperDump(FILE *fp);
|
void mmc4_MapperDump(FILE *fp);
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
* NOROM Mapper - The peTI-NESulator Project
|
* NOROM Mapper - The peTI-NESulator Project
|
||||||
* norom.c
|
* norom.c
|
||||||
*
|
*
|
||||||
* Created by Manoel TRAPIER.
|
* Created by Manoël TRAPIER.
|
||||||
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@ -24,7 +24,9 @@ int norom_InitMapper(NesCart *cart)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (cart->VROMSize > 0)
|
if (cart->VROMSize > 0)
|
||||||
|
{
|
||||||
set_vrom_bank_8k(0x2000, 0);
|
set_vrom_bank_8k(0x2000, 0);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -37,7 +39,6 @@ int norom_MapperIRQ(int cycledone)
|
|||||||
void norom_MapperWriteHook(register uint8_t Addr, register uint8_t Value)
|
void norom_MapperWriteHook(register uint8_t Addr, register uint8_t Value)
|
||||||
{
|
{
|
||||||
/* Nothing to do */
|
/* Nothing to do */
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void norom_MapperDump(FILE *fp)
|
void norom_MapperDump(FILE *fp)
|
||||||
|
|||||||
@ -2,12 +2,13 @@
|
|||||||
* NOROM Mapper - The peTI-NESulator Project
|
* NOROM Mapper - The peTI-NESulator Project
|
||||||
* norom.c
|
* norom.c
|
||||||
*
|
*
|
||||||
* Created by Manoel TRAPIER.
|
* Created by Manoël TRAPIER.
|
||||||
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define __TINES_MAPPERS__
|
#define __TINES_MAPPERS__
|
||||||
|
|
||||||
#include <mappers/manager.h>
|
#include <mappers/manager.h>
|
||||||
|
|
||||||
int norom_InitMapper(NesCart *cart);
|
int norom_InitMapper(NesCart *cart);
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
* UNROM Mapper - The peTI-NESulator Project
|
* UNROM Mapper - The peTI-NESulator Project
|
||||||
* unrom.h
|
* unrom.h
|
||||||
*
|
*
|
||||||
* Created by Manoel TRAPIER.
|
* Created by Manoël TRAPIER.
|
||||||
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@ -21,7 +21,9 @@ int unrom_InitMapper(NesCart * cart)
|
|||||||
set_prom_bank_16k(0x8000, GETLAST16KBANK(cart)); /* Set the last one */
|
set_prom_bank_16k(0x8000, GETLAST16KBANK(cart)); /* Set the last one */
|
||||||
|
|
||||||
if (Cart->VROMSize > 0)
|
if (Cart->VROMSize > 0)
|
||||||
|
{
|
||||||
set_vrom_bank_8k(0x0000, 0);
|
set_vrom_bank_8k(0x0000, 0);
|
||||||
|
}
|
||||||
|
|
||||||
unrom_load_vbank = 0;
|
unrom_load_vbank = 0;
|
||||||
|
|
||||||
|
|||||||
@ -2,12 +2,13 @@
|
|||||||
* UNROM Mapper - The peTI-NESulator Project
|
* UNROM Mapper - The peTI-NESulator Project
|
||||||
* unrom.h
|
* unrom.h
|
||||||
*
|
*
|
||||||
* Created by Manoel TRAPIER.
|
* Created by Manoël TRAPIER.
|
||||||
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define __TINES_MAPPERS__
|
#define __TINES_MAPPERS__
|
||||||
|
|
||||||
#include <mappers/manager.h>
|
#include <mappers/manager.h>
|
||||||
|
|
||||||
int unrom_InitMapper(NesCart *cart);
|
int unrom_InitMapper(NesCart *cart);
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
* UNROM Mapper - The peTI-NESulator Project
|
* UNROM Mapper - The peTI-NESulator Project
|
||||||
* unrom.h
|
* unrom.h
|
||||||
*
|
*
|
||||||
* Created by Manoel TRAPIER.
|
* Created by Manoël TRAPIER.
|
||||||
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@ -19,6 +19,7 @@ static uint8_t loaded_pbank;
|
|||||||
* 32K on such a cart
|
* 32K on such a cart
|
||||||
*/
|
*/
|
||||||
static uint8_t vram[32768];
|
static uint8_t vram[32768];
|
||||||
|
|
||||||
void ppu_setPagePtr8k(uint8_t page, uint8_t *ptr);
|
void ppu_setPagePtr8k(uint8_t page, uint8_t *ptr);
|
||||||
|
|
||||||
static void unrom512_applyValues()
|
static void unrom512_applyValues()
|
||||||
|
|||||||
@ -2,12 +2,13 @@
|
|||||||
* UNROM Mapper - The peTI-NESulator Project
|
* UNROM Mapper - The peTI-NESulator Project
|
||||||
* unrom.h
|
* unrom.h
|
||||||
*
|
*
|
||||||
* Created by Manoel TRAPIER.
|
* Created by Manoël TRAPIER.
|
||||||
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define __TINES_MAPPERS__
|
#define __TINES_MAPPERS__
|
||||||
|
|
||||||
#include <mappers/manager.h>
|
#include <mappers/manager.h>
|
||||||
|
|
||||||
int unrom512_InitMapper(NesCart *cart);
|
int unrom512_InitMapper(NesCart *cart);
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
* Mapper list - The peTI-NESulator Project
|
* Mapper list - The peTI-NESulator Project
|
||||||
* mappers_list.h
|
* mappers_list.h
|
||||||
*
|
*
|
||||||
* Created by Manoel TRAPIER on 25/10/07.
|
* Created by Manoël TRAPIER on 25/10/07.
|
||||||
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
* Generic mapper implementation - The peTI-NESulator Project
|
* Generic mapper implementation - The peTI-NESulator Project
|
||||||
* genericmapper.h
|
* genericmapper.h
|
||||||
*
|
*
|
||||||
* Created by Manoel TRAPIER.
|
* Created by Manoël TRAPIER.
|
||||||
* Copyright (c) 2003-2008 986Corp. All rights reserved.
|
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -22,7 +22,7 @@ int _MapperWriteHook(register word Addr, register uint8_t Value)
|
|||||||
|
|
||||||
if (Addr > 0x7FFF) /* Try to write to the rom */
|
if (Addr > 0x7FFF) /* Try to write to the rom */
|
||||||
{
|
{
|
||||||
set_vrom_bank_8k(0x0000,Value)
|
set_vrom_bank_8k(0x0000,Value);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,18 +2,14 @@
|
|||||||
* MMC1 Mapper - The peTI-NESulator Project
|
* MMC1 Mapper - The peTI-NESulator Project
|
||||||
* mmc1.h
|
* mmc1.h
|
||||||
*
|
*
|
||||||
* Created by Manoel TRAPIER.
|
* Created by Manoël TRAPIER.
|
||||||
* Copyright (c) 2003-2008 986Corp. All rights reserved.
|
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
uint8_t MMC1_reg0;
|
uint8_t MMC1_reg0;
|
||||||
|
|
||||||
uint8_t MMC1_reg1;
|
uint8_t MMC1_reg1;
|
||||||
|
|
||||||
uint8_t MMC1_reg2;
|
uint8_t MMC1_reg2;
|
||||||
|
|
||||||
uint8_t MMC1_reg3;
|
uint8_t MMC1_reg3;
|
||||||
|
|
||||||
uint8_t mmc1_CurrentBank;
|
uint8_t mmc1_CurrentBank;
|
||||||
|
|
||||||
#define MMC1_R0_MIRROR 0x01
|
#define MMC1_R0_MIRROR 0x01
|
||||||
@ -57,11 +53,8 @@ int mmc1_InitMapper(NesCart * cart)
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
MMC1_reg0 = MMC1_REG0_DEFAULT;
|
MMC1_reg0 = MMC1_REG0_DEFAULT;
|
||||||
|
|
||||||
MMC1_reg1 = MMC1_REG1_DEFAULT;
|
MMC1_reg1 = MMC1_REG1_DEFAULT;
|
||||||
|
|
||||||
MMC1_reg2 = MMC1_REG2_DEFAULT;
|
MMC1_reg2 = MMC1_REG2_DEFAULT;
|
||||||
|
|
||||||
MMC1_reg3 = MMC1_REG3_DEFAULT;
|
MMC1_reg3 = MMC1_REG3_DEFAULT;
|
||||||
|
|
||||||
set_prom_bank_16k(0x8000, 0);
|
set_prom_bank_16k(0x8000, 0);
|
||||||
@ -70,7 +63,9 @@ int mmc1_InitMapper(NesCart * cart)
|
|||||||
mmc1_CurrentBank = 0;
|
mmc1_CurrentBank = 0;
|
||||||
|
|
||||||
if (cart->VROMSize > 0)
|
if (cart->VROMSize > 0)
|
||||||
|
{
|
||||||
set_vrom_bank_4k(0x0000, 0);
|
set_vrom_bank_4k(0x0000, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Mapper should register itself for write hook */
|
/* Mapper should register itself for write hook */
|
||||||
@ -101,28 +96,26 @@ int mmc1_InitMapper(NesCart * cart)
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Reg 0
|
* Reg 0
|
||||||
8 : 1000
|
* 8 : 1000
|
||||||
9 : 1001
|
* 9 : 1001
|
||||||
|
*
|
||||||
Reg 1
|
* Reg 1
|
||||||
A : 1010
|
* A : 1010
|
||||||
B : 1011
|
* B : 1011
|
||||||
|
*
|
||||||
Reg 2
|
* Reg 2
|
||||||
C : 1100
|
* C : 1100
|
||||||
D : 1101
|
* D : 1101
|
||||||
|
*
|
||||||
Reg 3
|
* Reg 3
|
||||||
E : 1110
|
* E : 1110
|
||||||
F : 1111
|
* F : 1111
|
||||||
|
*
|
||||||
((Addr & 0x6000) >> 13) <- port number
|
* ((Addr & 0x6000) >> 13) <- port number
|
||||||
*/
|
*/
|
||||||
#define MMC1_GetReg(a) ((a & 0x6000) >> 13)
|
#define MMC1_GetReg(a) ((a & 0x6000) >> 13)
|
||||||
/* (Val & 0x01) recuperation du bit */
|
|
||||||
#define MMC1_GetBit(v) (v & 0x01)
|
#define MMC1_GetBit(v) (v & 0x01)
|
||||||
/* ( ( b & (1 << Bit)) | (v << Bit) ) Ajout du bit */
|
|
||||||
#define MMC1_AddBit(b, v) ( ( b & ~(1 << Bit)) | (v << Bit) )
|
#define MMC1_AddBit(b, v) ( ( b & ~(1 << Bit)) | (v << Bit) )
|
||||||
|
|
||||||
void mmc1_ApplyReg0Mod()
|
void mmc1_ApplyReg0Mod()
|
||||||
@ -130,9 +123,7 @@ void mmc1_ApplyReg0Mod()
|
|||||||
|
|
||||||
static uint8_t OldSwitchArea = MMC1_R0_PRGAREA;
|
static uint8_t OldSwitchArea = MMC1_R0_PRGAREA;
|
||||||
|
|
||||||
|
//console_printf(Console_Default, "Change to reg0 done ! (0x%x)\n\tMirror flag : %d\n\tOneScreen Flag : %d\n\tPRG Size : %d\n\tPRG Area : %d\n\tVROM Switch size : %d\n", MMC1_reg0, MMC1_reg0 & MMC1_R0_MIRROR, MMC1_reg0 & MMC1_R0_ONESCREEN, MMC1_reg0 & MMC1_R0_PRGAREA, MMC1_reg0 & MMC1_R0_PRGSIZE, MMC1_reg0 & MMC1_R0_VROMSW);
|
||||||
|
|
||||||
//console_printf(Console_Default, "Change to reg0 done ! (0x%x)\n\tMiror flag : %d\n\tOneScreen Flag : %d\n\tPRG Size : %d\n\tPRG Area : %d\n\tVROM Switch size : %d\n", MMC1_reg0, MMC1_reg0 & MMC1_R0_MIRROR, MMC1_reg0 & MMC1_R0_ONESCREEN, MMC1_reg0 & MMC1_R0_PRGAREA, MMC1_reg0 & MMC1_R0_PRGSIZE, MMC1_reg0 & MMC1_R0_VROMSW);
|
|
||||||
|
|
||||||
switch (MMC1_reg0 & 0x03)
|
switch (MMC1_reg0 & 0x03)
|
||||||
{
|
{
|
||||||
@ -158,16 +149,16 @@ void mmc1_ApplyReg0Mod()
|
|||||||
{
|
{
|
||||||
|
|
||||||
if ((MMC1_reg0 & MMC1_R0_PRGAREA) != 0)
|
if ((MMC1_reg0 & MMC1_R0_PRGAREA) != 0)
|
||||||
{ /* 0x8000 area */
|
{
|
||||||
|
/* 0x8000 area */
|
||||||
set_prom_bank_16k(0x8000, mmc1_CurrentBank);
|
set_prom_bank_16k(0x8000, mmc1_CurrentBank);
|
||||||
set_prom_bank_16k(0xC000, GETLAST16KBANK(Cart));
|
set_prom_bank_16k(0xC000, GETLAST16KBANK(Cart));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ /* 0xC000 area */
|
{
|
||||||
|
/* 0xC000 area */
|
||||||
set_prom_bank_16k(0x8000, 0);
|
set_prom_bank_16k(0x8000, 0);
|
||||||
set_prom_bank_16k(0xC000, mmc1_CurrentBank);
|
set_prom_bank_16k(0xC000, mmc1_CurrentBank);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
OldSwitchArea = (MMC1_reg0 & MMC1_R0_PRGAREA);
|
OldSwitchArea = (MMC1_reg0 & MMC1_R0_PRGAREA);
|
||||||
@ -184,13 +175,14 @@ void mmc1_MapperWriteReg0(register uint8_t Addr, register uint8_t Value)
|
|||||||
if (Value & 0x80)
|
if (Value & 0x80)
|
||||||
{
|
{
|
||||||
MMC1_reg0 = MMC1_REG0_DEFAULT;
|
MMC1_reg0 = MMC1_REG0_DEFAULT;
|
||||||
console_printf(Console_Default, "MMC1: Reg0 Reset occured !\n");
|
console_printf(Console_Default, "MMC1: Reg0 Reset occurred !\n");
|
||||||
mmc1_ApplyReg0Mod();
|
mmc1_ApplyReg0Mod();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (Bit < 4)
|
if (Bit < 4)
|
||||||
{ /* Pas encore ecrit les 5 bits */
|
{
|
||||||
|
/* Haven't written the 5 bits yet */
|
||||||
BitBuf = MMC1_AddBit(BitBuf, MMC1_GetBit(Value));
|
BitBuf = MMC1_AddBit(BitBuf, MMC1_GetBit(Value));
|
||||||
Bit++;
|
Bit++;
|
||||||
}
|
}
|
||||||
@ -211,12 +203,13 @@ void mmc1_MapperWriteReg1(register uint8_t Addr, register uint8_t Value)
|
|||||||
if (Value & 0x80)
|
if (Value & 0x80)
|
||||||
{
|
{
|
||||||
MMC1_reg1 = MMC1_REG1_DEFAULT;
|
MMC1_reg1 = MMC1_REG1_DEFAULT;
|
||||||
console_printf(Console_Default, "MMC1: Reg1 Reset occured !\n");
|
console_printf(Console_Default, "MMC1: Reg1 Reset occurred !\n");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (Bit < 4)
|
if (Bit < 4)
|
||||||
{ /* Pas encore ecrit les 5 bits */
|
{
|
||||||
|
/* Haven't written the 5 bits yet */
|
||||||
BitBuf = MMC1_AddBit(BitBuf, MMC1_GetBit(Value));
|
BitBuf = MMC1_AddBit(BitBuf, MMC1_GetBit(Value));
|
||||||
Bit++;
|
Bit++;
|
||||||
}
|
}
|
||||||
@ -231,17 +224,20 @@ void mmc1_MapperWriteReg1(register uint8_t Addr, register uint8_t Value)
|
|||||||
|
|
||||||
if (Cart->VROMSize == 0)
|
if (Cart->VROMSize == 0)
|
||||||
{
|
{
|
||||||
console_printf(Console_Default, "Try to change VROM but with didn't have any VROM ! [%04X]\n", VROMBankNb);
|
console_printf(Console_Default, "Try to change VROM but with didn't have any VROM ! [%04X]\n",
|
||||||
|
VROMBankNb);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((MMC1_reg0 & MMC1_R0_VROMSW) != 0)
|
if ((MMC1_reg0 & MMC1_R0_VROMSW) != 0)
|
||||||
{ /* 4K vram */
|
{
|
||||||
|
/* 4K vram */
|
||||||
//console_printf(Console_Default, "Switching VROM at 0x0000 to 4k bank %d\n", VROMBankNb);
|
//console_printf(Console_Default, "Switching VROM at 0x0000 to 4k bank %d\n", VROMBankNb);
|
||||||
set_vrom_bank_4k(0x0000, VROMBankNb);
|
set_vrom_bank_4k(0x0000, VROMBankNb);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ /* 8K vram */
|
{
|
||||||
|
/* 8K vram */
|
||||||
//console_printf(Console_Default, "Switching VROM at 0x0000 to 8k bank %d\n", VROMBankNb>>1);
|
//console_printf(Console_Default, "Switching VROM at 0x0000 to 8k bank %d\n", VROMBankNb>>1);
|
||||||
set_vrom_bank_8k(0x0000, VROMBankNb >> 1);
|
set_vrom_bank_8k(0x0000, VROMBankNb >> 1);
|
||||||
}
|
}
|
||||||
@ -254,12 +250,13 @@ void mmc1_MapperWriteReg2(register uint8_t Addr, register uint8_t Value)
|
|||||||
if (Value & 0x80)
|
if (Value & 0x80)
|
||||||
{
|
{
|
||||||
MMC1_reg2 = MMC1_REG2_DEFAULT;
|
MMC1_reg2 = MMC1_REG2_DEFAULT;
|
||||||
console_printf(Console_Default, "MMC1: Reg2 Reset occured !\n");
|
console_printf(Console_Default, "MMC1: Reg2 Reset occurred !\n");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (Bit < 4)
|
if (Bit < 4)
|
||||||
{ /* Pas encore ecrit les 5 bits */
|
{
|
||||||
|
/* Haven't written the 5 bits yet */
|
||||||
BitBuf = MMC1_AddBit(BitBuf, MMC1_GetBit(Value));
|
BitBuf = MMC1_AddBit(BitBuf, MMC1_GetBit(Value));
|
||||||
Bit++;
|
Bit++;
|
||||||
}
|
}
|
||||||
@ -280,12 +277,14 @@ void mmc1_MapperWriteReg2(register uint8_t Addr, register uint8_t Value)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((MMC1_reg0 & MMC1_R0_VROMSW) != 0)
|
if ((MMC1_reg0 & MMC1_R0_VROMSW) != 0)
|
||||||
{ /* 4K vram */
|
{
|
||||||
|
/* 4K vram */
|
||||||
//console_printf(Console_Default, "Switching VROM at 0x1000 to 4k bank %d\n", VROMBankNb);
|
//console_printf(Console_Default, "Switching VROM at 0x1000 to 4k bank %d\n", VROMBankNb);
|
||||||
set_vrom_bank_4k(0x1000, VROMBankNb);
|
set_vrom_bank_4k(0x1000, VROMBankNb);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ /* 8K vram */
|
{
|
||||||
|
/* 8K vram */
|
||||||
// console_printf(Console_Default, "Switching VROM at 0x1000 to 8k bank %d\n", VROMBankNb>>1);
|
// console_printf(Console_Default, "Switching VROM at 0x1000 to 8k bank %d\n", VROMBankNb>>1);
|
||||||
// set_vrom_bank_8k(0x1000,VROMBankNb>>1);
|
// set_vrom_bank_8k(0x1000,VROMBankNb>>1);
|
||||||
}
|
}
|
||||||
@ -298,12 +297,13 @@ void mmc1_MapperWriteReg3(register uint8_t Addr, register uint8_t Value)
|
|||||||
if (Value & 0x80)
|
if (Value & 0x80)
|
||||||
{
|
{
|
||||||
MMC1_reg3 = MMC1_REG3_DEFAULT;
|
MMC1_reg3 = MMC1_REG3_DEFAULT;
|
||||||
console_printf(Console_Default, "MMC1: Reg3 Reset occured !\n");
|
console_printf(Console_Default, "MMC1: Reg3 Reset occurred !\n");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (Bit < 4)
|
if (Bit < 4)
|
||||||
{ /* Pas encore ecrit les 5 bits */
|
{
|
||||||
|
/* Haven't written the 5 bits yet */
|
||||||
BitBuf = MMC1_AddBit(BitBuf, MMC1_GetBit(Value));
|
BitBuf = MMC1_AddBit(BitBuf, MMC1_GetBit(Value));
|
||||||
Bit++;
|
Bit++;
|
||||||
}
|
}
|
||||||
@ -315,23 +315,29 @@ void mmc1_MapperWriteReg3(register uint8_t Addr, register uint8_t Value)
|
|||||||
MMC1_reg3 = BitBuf;
|
MMC1_reg3 = BitBuf;
|
||||||
|
|
||||||
if (MMC1_reg3 << 14 > Cart->PROMSize)
|
if (MMC1_reg3 << 14 > Cart->PROMSize)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if ((MMC1_reg0 & MMC1_R0_PRGSIZE) != 0)
|
if ((MMC1_reg0 & MMC1_R0_PRGSIZE) != 0)
|
||||||
{ /* 16K Switch */
|
{
|
||||||
|
/* 16K Switch */
|
||||||
if ((MMC1_reg0 & MMC1_R0_PRGAREA) != 0)
|
if ((MMC1_reg0 & MMC1_R0_PRGAREA) != 0)
|
||||||
{ /* 0x8000 switch */
|
{
|
||||||
|
/* 0x8000 switch */
|
||||||
set_prom_bank_16k(0x8000, MMC1_reg3);
|
set_prom_bank_16k(0x8000, MMC1_reg3);
|
||||||
//console_printf(Console_Default, "LowBank is now %d ( 0x%p )\n", MMC1_reg3, mLBank);
|
//console_printf(Console_Default, "LowBank is now %d ( 0x%p )\n", MMC1_reg3, mLBank);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ /* 0xC000 switch */
|
{
|
||||||
|
/* 0xC000 switch */
|
||||||
set_prom_bank_16k(0xC000, MMC1_reg3);
|
set_prom_bank_16k(0xC000, MMC1_reg3);
|
||||||
//console_printf(Console_Default, "HighBank is now %d ( 0x%p )\n", MMC1_reg3, mUBank);
|
//console_printf(Console_Default, "HighBank is now %d ( 0x%p )\n", MMC1_reg3, mUBank);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ /* 32K Switch */
|
{
|
||||||
|
/* 32K Switch */
|
||||||
set_prom_bank_32k(0x8000, MMC1_reg3 >> 1);
|
set_prom_bank_32k(0x8000, MMC1_reg3 >> 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
* Mapper facilities - The peTI-NESulator Project
|
* Mapper facilities - The peTI-NESulator Project
|
||||||
* mappers.c
|
* mappers.c
|
||||||
*
|
*
|
||||||
* Created by Manoel TRAPIER.
|
* Created by Manoël TRAPIER.
|
||||||
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@ -27,7 +27,7 @@ extern NesCart *Cart;
|
|||||||
extern char MapperWantIRQ;
|
extern char MapperWantIRQ;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Here are some fonction useful for mappers
|
* Here are some function useful for mappers
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void set_vrom_bank_1k(uint16_t addr,int slot)
|
void set_vrom_bank_1k(uint16_t addr,int slot)
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# peTI-NESulator CMake
|
# peTI-NESulator CMake
|
||||||
#
|
#
|
||||||
# Created by Manoel TRAPIER.
|
# Created by Manoël TRAPIER.
|
||||||
# Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
# Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
||||||
#
|
#
|
||||||
# $LastChangedDate$
|
# $LastChangedDate$
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
* 6502 Memory manager - The peTI-NESulator Project
|
* 6502 Memory manager - The peTI-NESulator Project
|
||||||
* memory.c - Taken from the Quick6502 project
|
* memory.c - Taken from the Quick6502 project
|
||||||
*
|
*
|
||||||
* Created by Manoel Trapier on 18/09/06.
|
* Created by Manoël Trapier on 18/09/06.
|
||||||
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@ -16,14 +16,14 @@
|
|||||||
|
|
||||||
/* Private structures */
|
/* Private structures */
|
||||||
|
|
||||||
#define Kuint8_t * (1024)
|
#define KByte * (1024)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* What inside memory manager:
|
* What inside memory manager:
|
||||||
*
|
*
|
||||||
* Table of attributes
|
* Table of attributes
|
||||||
* Table of original page ptr
|
* Table of original page ptr
|
||||||
* Table of moded page ptr
|
* Table of modded page ptr
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -77,26 +77,26 @@ void set_page_ptr_4k(uint8_t page, uint8_t *ptr)
|
|||||||
{
|
{
|
||||||
LOG(console_printf(Console_Default, "Set page(4k) 0x%X to ptr %p\n", page, ptr));
|
LOG(console_printf(Console_Default, "Set page(4k) 0x%X to ptr %p\n", page, ptr));
|
||||||
set_page_ptr_2k(page, ptr);
|
set_page_ptr_2k(page, ptr);
|
||||||
set_page_ptr_2k(page+((4 Kuint8_t / 256) / 2), ptr + 2 Kuint8_t);
|
set_page_ptr_2k(page + ((4 KByte / 256) / 2), ptr + 2 KByte);
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_page_ptr_8k(uint8_t page, uint8_t *ptr)
|
void set_page_ptr_8k(uint8_t page, uint8_t *ptr)
|
||||||
{
|
{
|
||||||
LOG(console_printf(Console_Default, "Set page(8k) 0x%X to ptr %p\n", page, ptr));
|
LOG(console_printf(Console_Default, "Set page(8k) 0x%X to ptr %p\n", page, ptr));
|
||||||
set_page_ptr_4k(page, ptr);
|
set_page_ptr_4k(page, ptr);
|
||||||
set_page_ptr_4k(page+((8 Kuint8_t / 256) / 2), ptr + 4 Kuint8_t);
|
set_page_ptr_4k(page + ((8 KByte / 256) / 2), ptr + 4 KByte);
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_page_ptr_16k(uint8_t page, uint8_t *ptr)
|
void set_page_ptr_16k(uint8_t page, uint8_t *ptr)
|
||||||
{
|
{
|
||||||
set_page_ptr_8k(page, ptr);
|
set_page_ptr_8k(page, ptr);
|
||||||
set_page_ptr_8k(page+((16 Kuint8_t / 256) / 2), ptr + 8 Kuint8_t);
|
set_page_ptr_8k(page + ((16 KByte / 256) / 2), ptr + 8 KByte);
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_page_ptr_32k(uint8_t page, uint8_t *ptr)
|
void set_page_ptr_32k(uint8_t page, uint8_t *ptr)
|
||||||
{
|
{
|
||||||
set_page_ptr_16k(page, ptr);
|
set_page_ptr_16k(page, ptr);
|
||||||
set_page_ptr_16k(page+((32 Kuint8_t / 256) / 2), ptr + 16 Kuint8_t);
|
set_page_ptr_16k(page + ((32 KByte / 256) / 2), ptr + 16 KByte);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t *get_page_ptr(uint8_t page)
|
uint8_t *get_page_ptr(uint8_t page)
|
||||||
@ -113,14 +113,18 @@ void set_page_rd_hook(uint8_t page, func_rdhook func)
|
|||||||
{
|
{
|
||||||
memory_pages_attr[page] &= (~ATTR_PAGE_HAVE_RDHOOK);
|
memory_pages_attr[page] &= (~ATTR_PAGE_HAVE_RDHOOK);
|
||||||
if (memory_pages[page] == (uint8_t *)0x01)
|
if (memory_pages[page] == (uint8_t *)0x01)
|
||||||
|
{
|
||||||
memory_pages[page] = NULL;
|
memory_pages[page] = NULL;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
memory_pages_attr[page] |= ATTR_PAGE_HAVE_RDHOOK;
|
memory_pages_attr[page] |= ATTR_PAGE_HAVE_RDHOOK;
|
||||||
if (memory_pages[page] == NULL)
|
if (memory_pages[page] == NULL)
|
||||||
|
{
|
||||||
memory_pages[page] = (uint8_t *)0x01;
|
memory_pages[page] = (uint8_t *)0x01;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
rdh_table[page] = func;
|
rdh_table[page] = func;
|
||||||
}
|
}
|
||||||
@ -131,15 +135,19 @@ void set_page_wr_hook(uint8_t page, func_wrhook func)
|
|||||||
{
|
{
|
||||||
memory_pages_attr[page] &= (~ATTR_PAGE_HAVE_WRHOOK);
|
memory_pages_attr[page] &= (~ATTR_PAGE_HAVE_WRHOOK);
|
||||||
if (memory_pages[page] == (uint8_t *)0x01)
|
if (memory_pages[page] == (uint8_t *)0x01)
|
||||||
|
{
|
||||||
memory_pages[page] = NULL;
|
memory_pages[page] = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
memory_pages_attr[page] |= ATTR_PAGE_HAVE_WRHOOK;
|
memory_pages_attr[page] |= ATTR_PAGE_HAVE_WRHOOK;
|
||||||
if (memory_pages[page] == NULL)
|
if (memory_pages[page] == NULL)
|
||||||
|
{
|
||||||
memory_pages[page] = (uint8_t *)0x01;
|
memory_pages[page] = (uint8_t *)0x01;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
wrh_table[page] = func;
|
wrh_table[page] = func;
|
||||||
}
|
}
|
||||||
@ -147,18 +155,26 @@ void set_page_wr_hook(uint8_t page, func_wrhook func)
|
|||||||
void set_page_readable(uint8_t page, uint8_t value)
|
void set_page_readable(uint8_t page, uint8_t value)
|
||||||
{
|
{
|
||||||
if (value == true)
|
if (value == true)
|
||||||
|
{
|
||||||
memory_pages_attr[page] |= ATTR_PAGE_READABLE;
|
memory_pages_attr[page] |= ATTR_PAGE_READABLE;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
memory_pages_attr[page] &= (~ATTR_PAGE_READABLE);
|
memory_pages_attr[page] &= (~ATTR_PAGE_READABLE);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void set_page_writeable(uint8_t page, uint8_t value)
|
void set_page_writeable(uint8_t page, uint8_t value)
|
||||||
{
|
{
|
||||||
if (value == true)
|
if (value == true)
|
||||||
|
{
|
||||||
memory_pages_attr[page] |= ATTR_PAGE_WRITEABLE;
|
memory_pages_attr[page] |= ATTR_PAGE_WRITEABLE;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
memory_pages_attr[page] &= (~ATTR_PAGE_WRITEABLE);
|
memory_pages_attr[page] &= (~ATTR_PAGE_WRITEABLE);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void set_page_ghost(uint8_t page, uint8_t value, uint8_t ghost)
|
void set_page_ghost(uint8_t page, uint8_t value, uint8_t ghost)
|
||||||
{
|
{
|
||||||
@ -179,7 +195,9 @@ uint8_t get_page_attributes(uint8_t page)
|
|||||||
func_rdhook get_page_rdhook(uint8_t page)
|
func_rdhook get_page_rdhook(uint8_t page)
|
||||||
{
|
{
|
||||||
if (memory_pages_attr[page] & ATTR_PAGE_HAVE_RDHOOK)
|
if (memory_pages_attr[page] & ATTR_PAGE_HAVE_RDHOOK)
|
||||||
|
{
|
||||||
return rdh_table[page];
|
return rdh_table[page];
|
||||||
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -187,14 +205,16 @@ func_rdhook get_page_rdhook(uint8_t page)
|
|||||||
func_wrhook get_page_wrhook(uint8_t page)
|
func_wrhook get_page_wrhook(uint8_t page)
|
||||||
{
|
{
|
||||||
if (memory_pages_attr[page] & ATTR_PAGE_HAVE_WRHOOK)
|
if (memory_pages_attr[page] & ATTR_PAGE_HAVE_WRHOOK)
|
||||||
|
{
|
||||||
return wrh_table[page];
|
return wrh_table[page];
|
||||||
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t ReadMemory(uint8_t page, uint8_t addr)
|
uint8_t ReadMemory(uint8_t page, uint8_t addr)
|
||||||
{
|
{
|
||||||
static uint8_t LastRetuint8_t = 0xA5;
|
static uint8_t LastRetByte = 0xA5;
|
||||||
uint8_t *page_ptr;
|
uint8_t *page_ptr;
|
||||||
uint8_t attributes;
|
uint8_t attributes;
|
||||||
LOG(console_printf(Console_Default, "Read @ 0x%X-%X\n", page, addr));
|
LOG(console_printf(Console_Default, "Read @ 0x%X-%X\n", page, addr));
|
||||||
@ -204,12 +224,16 @@ uint8_t ReadMemory(uint8_t page, uint8_t addr)
|
|||||||
{
|
{
|
||||||
LOG(console_printf(Console_Default, "Page is non null & readable\n"));
|
LOG(console_printf(Console_Default, "Page is non null & readable\n"));
|
||||||
if (attributes & ATTR_PAGE_HAVE_RDHOOK)
|
if (attributes & ATTR_PAGE_HAVE_RDHOOK)
|
||||||
return ( LastRetuint8_t = rdh_table[page](addr) );
|
{
|
||||||
|
return (LastRetByte = rdh_table[page](addr));
|
||||||
|
}
|
||||||
else
|
else
|
||||||
return ( LastRetuint8_t = page_ptr[addr] );
|
{
|
||||||
|
return (LastRetByte = page_ptr[addr]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//console_printf(Console_Default, "Trying to read @ 0x%X-%X\n", page, addr);
|
//console_printf(Console_Default, "Trying to read @ 0x%X-%X\n", page, addr);
|
||||||
return LastRetuint8_t;
|
return LastRetByte;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WriteMemory(uint8_t page, uint8_t addr, uint8_t value)
|
void WriteMemory(uint8_t page, uint8_t addr, uint8_t value)
|
||||||
@ -230,9 +254,14 @@ void WriteMemory(uint8_t page, uint8_t addr, uint8_t value)
|
|||||||
wrh_table[page](addr, value);
|
wrh_table[page](addr, value);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
page_ptr[addr] = value;
|
page_ptr[addr] = value;
|
||||||
}
|
}
|
||||||
else { console_printf(Console_Default, "Trying to write 0x%X @ 0x%X-%X\n", value, page, addr); }
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
console_printf(Console_Default, "Trying to write 0x%X @ 0x%X-%X\n", value, page, addr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DumpMemoryState(FILE *fp)
|
void DumpMemoryState(FILE *fp)
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
#
|
#
|
||||||
# peTI-NESulator CMake
|
# peTI-NESulator CMake
|
||||||
#
|
#
|
||||||
# Created by Manoel TRAPIER.
|
# Created by Manoël TRAPIER.
|
||||||
# Copyright (c) 2003-2008 986Corp. All rights reserved.
|
# Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
||||||
#
|
#
|
||||||
# $LastChangedDate$
|
# $LastChangedDate$
|
||||||
# $Author$
|
# $Author$
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
* Graphic Manager - The peTI-NESulator Project
|
* Graphic Manager - The peTI-NESulator Project
|
||||||
* os/macos/graphics.c
|
* os/macos/graphics.c
|
||||||
*
|
*
|
||||||
* Created by Manoel TRAPIER on 08/05/08.
|
* Created by Manoël TRAPIER on 08/05/08.
|
||||||
* Copyright (c) 2003-2008 986Corp. All rights reserved.
|
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#include <os_dependent.h>
|
#include <os_dependent.h>
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
* File functions - The peTI-NESulator Project
|
* File functions - The peTI-NESulator Project
|
||||||
* os/macos/load.c
|
* os/macos/load.c
|
||||||
*
|
*
|
||||||
* Copyright (c) 2003-2008 986Corp. All rights reserved.
|
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
#
|
#
|
||||||
# peTI-NESulator CMake
|
# peTI-NESulator CMake
|
||||||
#
|
#
|
||||||
# Created by Manoel TRAPIER.
|
# Created by Manoël TRAPIER.
|
||||||
# Copyright (c) 2003-2008 986Corp. All rights reserved.
|
# Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
||||||
#
|
#
|
||||||
# $LastChangedDate$
|
# $LastChangedDate$
|
||||||
# $Author$
|
# $Author$
|
||||||
|
|||||||
@ -2,13 +2,8 @@
|
|||||||
* TI-68k Loading external file functions - The peTI-NESulator Project
|
* TI-68k Loading external file functions - The peTI-NESulator Project
|
||||||
* ti68k/loadfile.c
|
* ti68k/loadfile.c
|
||||||
*
|
*
|
||||||
* Created by Manoel TRAPIER.
|
* Created by Manoël TRAPIER.
|
||||||
* Copyright (c) 2003-2008 986Corp. All rights reserved.
|
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
||||||
*
|
|
||||||
* $LastChangedDate:$
|
|
||||||
* $Author:$
|
|
||||||
* $HeadURL:$
|
|
||||||
* $Revision:$
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -24,7 +19,7 @@ void *LoadFilePtr(char * filename)
|
|||||||
if ((fp = fopen(filename,"rb")) == NULL)
|
if ((fp = fopen(filename,"rb")) == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
/* TI Related stuff, very uggly, and need to be changed.. */
|
/* TI Related stuff, very ugly, and need to be changed.. */
|
||||||
HeapLock(fp->handle);
|
HeapLock(fp->handle);
|
||||||
RetPtr = 2 + HeapDeref(fp->handle);
|
RetPtr = 2 + HeapDeref(fp->handle);
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# peTI-NESulator CMake
|
# peTI-NESulator CMake
|
||||||
#
|
#
|
||||||
# Created by Manoel TRAPIER.
|
# Created by Manoël TRAPIER.
|
||||||
# Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
# Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
||||||
#
|
#
|
||||||
# $LastChangedDate$
|
# $LastChangedDate$
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
* Graphic Manager - The peTI-NESulator Project
|
* Graphic Manager - The peTI-NESulator Project
|
||||||
* os/macos/graphics.c
|
* os/macos/graphics.c
|
||||||
*
|
*
|
||||||
* Created by Manoel TRAPIER on 08/05/08.
|
* Created by Manoël TRAPIER on 08/05/08.
|
||||||
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@ -14,6 +14,7 @@
|
|||||||
#include <os_dependent.h>
|
#include <os_dependent.h>
|
||||||
|
|
||||||
#define GLFW_INCLUDE_GLEXT
|
#define GLFW_INCLUDE_GLEXT
|
||||||
|
|
||||||
#include <GLFW/glfw3.h>
|
#include <GLFW/glfw3.h>
|
||||||
|
|
||||||
/* "Apple" fix */
|
/* "Apple" fix */
|
||||||
@ -38,7 +39,7 @@ struct GLWindow_t
|
|||||||
struct KeyArray keyArray[512];
|
struct KeyArray keyArray[512];
|
||||||
GLFWwindow *windows;
|
GLFWwindow *windows;
|
||||||
uint8_t *videoMemory;
|
uint8_t *videoMemory;
|
||||||
GLint videoTexture;
|
GLuint videoTexture;
|
||||||
int WIDTH;
|
int WIDTH;
|
||||||
int HEIGHT;
|
int HEIGHT;
|
||||||
};
|
};
|
||||||
@ -207,10 +208,12 @@ void drawPixel(GLWindow *gw, int x, int y, uint32_t colour)
|
|||||||
{
|
{
|
||||||
uint8_t r, g, b, a;
|
uint8_t r, g, b, a;
|
||||||
|
|
||||||
uint32_t offset = (y*gw->WIDTH*4)+4*x;
|
uint32_t offset = (y * gw->WIDTH * 4U) + 4U * x;
|
||||||
|
|
||||||
if ((x < 0) || (x > gw->WIDTH) || (y < 0) || (y > gw->HEIGHT))
|
if ((x < 0) || (x > gw->WIDTH) || (y < 0) || (y > gw->HEIGHT))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
b = colour & 0xFF;
|
b = colour & 0xFF;
|
||||||
g = (colour >> 8) & 0xFF;
|
g = (colour >> 8) & 0xFF;
|
||||||
@ -310,11 +313,13 @@ void drawCircle(GLWindow *g, int xc, int yc, int radius, uint32_t colour)
|
|||||||
int y = radius;
|
int y = radius;
|
||||||
int pX, pY;
|
int pX, pY;
|
||||||
|
|
||||||
pX = xc; pY = yc + radius;
|
pX = xc;
|
||||||
|
pY = yc + radius;
|
||||||
drawPixel(g, pX, pY, colour);
|
drawPixel(g, pX, pY, colour);
|
||||||
pY -= (2 * radius);
|
pY -= (2 * radius);
|
||||||
drawPixel(g, pX, pY, colour);
|
drawPixel(g, pX, pY, colour);
|
||||||
pY += radius; pX += radius;
|
pY += radius;
|
||||||
|
pX += radius;
|
||||||
drawPixel(g, pX, pY, colour);
|
drawPixel(g, pX, pY, colour);
|
||||||
pX -= (2 * radius);
|
pX -= (2 * radius);
|
||||||
drawPixel(g, pX, pY, colour);
|
drawPixel(g, pX, pY, colour);
|
||||||
@ -330,25 +335,31 @@ void drawCircle(GLWindow *g, int xc, int yc, int radius, uint32_t colour)
|
|||||||
x++;
|
x++;
|
||||||
ddF_x += 2;
|
ddF_x += 2;
|
||||||
f += ddF_x + 1;
|
f += ddF_x + 1;
|
||||||
pX = xc+x ; pY = yc+y;
|
pX = xc + x;
|
||||||
|
pY = yc + y;
|
||||||
drawPixel(g, pX, pY, colour);
|
drawPixel(g, pX, pY, colour);
|
||||||
pX = xc-x ; pY = yc+y;
|
pX = xc - x;
|
||||||
|
pY = yc + y;
|
||||||
drawPixel(g, pX, pY, colour);
|
drawPixel(g, pX, pY, colour);
|
||||||
pX = xc+x ; pY = yc-y;
|
pX = xc + x;
|
||||||
|
pY = yc - y;
|
||||||
drawPixel(g, pX, pY, colour);
|
drawPixel(g, pX, pY, colour);
|
||||||
pX = xc-x ; pY = yc-y;
|
pX = xc - x;
|
||||||
|
pY = yc - y;
|
||||||
drawPixel(g, pX, pY, colour);
|
drawPixel(g, pX, pY, colour);
|
||||||
pX = xc+y ; pY = yc+x;
|
pX = xc + y;
|
||||||
|
pY = yc + x;
|
||||||
drawPixel(g, pX, pY, colour);
|
drawPixel(g, pX, pY, colour);
|
||||||
pX = xc-y ; pY = yc+x;
|
pX = xc - y;
|
||||||
|
pY = yc + x;
|
||||||
drawPixel(g, pX, pY, colour);
|
drawPixel(g, pX, pY, colour);
|
||||||
pX = xc+y ; pY = yc-x;
|
pX = xc + y;
|
||||||
|
pY = yc - x;
|
||||||
drawPixel(g, pX, pY, colour);
|
drawPixel(g, pX, pY, colour);
|
||||||
pX = xc-y ; pY = yc-x;
|
pX = xc - y;
|
||||||
|
pY = yc - x;
|
||||||
drawPixel(g, pX, pY, colour);
|
drawPixel(g, pX, pY, colour);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void drawRect(GLWindow *g, int x0, int y0, int w, int h, uint32_t colour)
|
void drawRect(GLWindow *g, int x0, int y0, int w, int h, uint32_t colour)
|
||||||
@ -363,8 +374,10 @@ void drawFillrect(GLWindow *g, int x0, int y0, int w, int h, uint32_t colour)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i = 0 ; i < h ; i++)
|
for (i = 0 ; i < h ; i++)
|
||||||
|
{
|
||||||
drawLine(g, x0, y0 + i, x0 + w, y0 + i, colour);
|
drawLine(g, x0, y0 + i, x0 + w, y0 + i, colour);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void clearScreen(GLWindow *g)
|
void clearScreen(GLWindow *g)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
* Graphic Manager - The peTI-NESulator Project
|
* Graphic Manager - The peTI-NESulator Project
|
||||||
* os/macos/graphics.c
|
* os/macos/graphics.c
|
||||||
*
|
*
|
||||||
* Created by Manoel TRAPIER on 08/05/08.
|
* Created by Manoël TRAPIER on 08/05/08.
|
||||||
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -27,7 +27,9 @@ int console_init(ConsoleLevel DefaultLevel)
|
|||||||
int console_vprintf(const ConsoleLevel level, const char *format, va_list ap)
|
int console_vprintf(const ConsoleLevel level, const char *format, va_list ap)
|
||||||
{
|
{
|
||||||
if (console_ActualLevel >= level)
|
if (console_ActualLevel >= level)
|
||||||
|
{
|
||||||
vprintf(format, ap);
|
vprintf(format, ap);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# peTI-NESulator CMake
|
# peTI-NESulator CMake
|
||||||
#
|
#
|
||||||
# Created by Manoel TRAPIER.
|
# Created by Manoël TRAPIER.
|
||||||
# Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
# Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
||||||
#
|
#
|
||||||
# $LastChangedDate$
|
# $LastChangedDate$
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
* Graphic Manager - The peTI-NESulator Project
|
* Graphic Manager - The peTI-NESulator Project
|
||||||
* os/macos/graphics.c
|
* os/macos/graphics.c
|
||||||
*
|
*
|
||||||
* Created by Manoel TRAPIER on 08/05/08.
|
* Created by Manoël TRAPIER on 08/05/08.
|
||||||
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|||||||
23
src/paddle.c
23
src/paddle.c
@ -2,7 +2,7 @@
|
|||||||
* Paddle manager - The peTI-NESulator Project
|
* Paddle manager - The peTI-NESulator Project
|
||||||
* paddle.c
|
* paddle.c
|
||||||
*
|
*
|
||||||
* Created by Manoel TRAPIER.
|
* Created by Manoël TRAPIER.
|
||||||
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@ -21,7 +21,9 @@ void InitPaddle(Paddle *pdl)
|
|||||||
void WritePaddle(Paddle *pdl, uint8_t val)
|
void WritePaddle(Paddle *pdl, uint8_t val)
|
||||||
{
|
{
|
||||||
if ((pdl->LastWrite == 1) && (val == 0))
|
if ((pdl->LastWrite == 1) && (val == 0))
|
||||||
|
{
|
||||||
InitPaddle(pdl);
|
InitPaddle(pdl);
|
||||||
|
}
|
||||||
|
|
||||||
pdl->LastWrite = val;
|
pdl->LastWrite = val;
|
||||||
}
|
}
|
||||||
@ -33,47 +35,62 @@ uint8_t ReadPaddle(Paddle *pdl)
|
|||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
if (getKeyStatus('O'))
|
if (getKeyStatus('O'))
|
||||||
|
{
|
||||||
return 0x41;
|
return 0x41;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
if (getKeyStatus('P'))
|
if (getKeyStatus('P'))
|
||||||
|
{
|
||||||
return 0x41;
|
return 0x41;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
if (getKeyStatus('I'))
|
if (getKeyStatus('I'))
|
||||||
|
{
|
||||||
return 0x41;
|
return 0x41;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 4:
|
case 4:
|
||||||
if (getKeyStatus('U'))
|
if (getKeyStatus('U'))
|
||||||
|
{
|
||||||
return 0x41;
|
return 0x41;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 5:
|
case 5:
|
||||||
if (getKeyStatus('W'))
|
if (getKeyStatus('W'))
|
||||||
|
{
|
||||||
return 0x41;
|
return 0x41;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 6:
|
case 6:
|
||||||
if (getKeyStatus('S'))
|
if (getKeyStatus('S'))
|
||||||
|
{
|
||||||
return 0x41;
|
return 0x41;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 7:
|
case 7:
|
||||||
if (getKeyStatus('A'))
|
if (getKeyStatus('A'))
|
||||||
|
{
|
||||||
return 0x41;
|
return 0x41;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 8:
|
case 8:
|
||||||
if (getKeyStatus('D'))
|
if (getKeyStatus('D'))
|
||||||
|
{
|
||||||
return 0x41;
|
return 0x41;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 20:
|
case 20:
|
||||||
return 0x40;
|
return 0x40;
|
||||||
break;
|
|
||||||
|
|
||||||
case 24:
|
case 24:
|
||||||
pdl->Bit = 1;
|
pdl->Bit = 1;
|
||||||
@ -81,8 +98,6 @@ uint8_t ReadPaddle(Paddle *pdl)
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
return 0x40;
|
return 0x40;
|
||||||
break;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0x40;
|
return 0x40;
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# peTI-NESulator CMake
|
# peTI-NESulator CMake
|
||||||
#
|
#
|
||||||
# Created by Manoel TRAPIER.
|
# Created by Manoël TRAPIER.
|
||||||
# Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
# Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
||||||
#
|
#
|
||||||
# $LastChangedDate$
|
# $LastChangedDate$
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
* Plugins manager - The peTI-NESulator Project
|
* Plugins manager - The peTI-NESulator Project
|
||||||
* plugins.c
|
* plugins.c
|
||||||
*
|
*
|
||||||
* Created by Manoel TRAPIER on 02/04/07.
|
* Created by Manoël TRAPIER on 02/04/07.
|
||||||
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@ -45,7 +45,8 @@ void plugin_list()
|
|||||||
while (ptr->name != NULL)
|
while (ptr->name != NULL)
|
||||||
{
|
{
|
||||||
console_printf(Console_Default, "%d - %s\n", i, ptr->name);
|
console_printf(Console_Default, "%d - %s\n", i, ptr->name);
|
||||||
ptr++; i++;
|
ptr++;
|
||||||
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,7 +64,9 @@ int plugin_load(int id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ptr == NULL)
|
if (ptr == NULL)
|
||||||
|
{
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
return ptr->init();
|
return ptr->init();
|
||||||
}
|
}
|
||||||
@ -73,10 +76,14 @@ int plugin_unload(int id)
|
|||||||
Plugin *ptr = &(Plugins[0]);
|
Plugin *ptr = &(Plugins[0]);
|
||||||
|
|
||||||
for (; id == 0 && ptr != NULL ; id--)
|
for (; id == 0 && ptr != NULL ; id--)
|
||||||
|
{
|
||||||
ptr++;
|
ptr++;
|
||||||
|
}
|
||||||
|
|
||||||
if (ptr == NULL)
|
if (ptr == NULL)
|
||||||
|
{
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
return ptr->deinit();
|
return ptr->deinit();
|
||||||
}
|
}
|
||||||
@ -100,7 +107,9 @@ int plugin_install_keypressHandler(uint8_t key, PluginKeypress func)
|
|||||||
ptr = keyHandlersList;
|
ptr = keyHandlersList;
|
||||||
|
|
||||||
while (ptr->next != NULL)
|
while (ptr->next != NULL)
|
||||||
|
{
|
||||||
ptr = ptr->next;
|
ptr = ptr->next;
|
||||||
|
}
|
||||||
|
|
||||||
ptr->next = (KeyHandler *)malloc(sizeof(KeyHandler));
|
ptr->next = (KeyHandler *)malloc(sizeof(KeyHandler));
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
* Code Breaker plugin - The peTI-NESulator Project
|
* Code Breaker plugin - The peTI-NESulator Project
|
||||||
* gamegenie.c: Hack your games with unlimited lives of add new powers!
|
* gamegenie.c: Hack your games with unlimited lives of add new powers!
|
||||||
*
|
*
|
||||||
* Created by Manoel Trapier.
|
* Created by Manoël Trapier.
|
||||||
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@ -13,22 +13,15 @@
|
|||||||
#include <os_dependent.h>
|
#include <os_dependent.h>
|
||||||
|
|
||||||
#define __TINES_PLUGINS__
|
#define __TINES_PLUGINS__
|
||||||
|
|
||||||
#include <plugins/manager.h>
|
#include <plugins/manager.h>
|
||||||
|
|
||||||
#undef __TINES_PLUGINS_
|
#undef __TINES_PLUGINS_
|
||||||
|
|
||||||
#include <memory/manager.h>
|
#include <memory/manager.h>
|
||||||
#include <types.h>
|
#include <types.h>
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
/* Allegro includes */
|
|
||||||
#ifdef __APPLE__
|
|
||||||
#define USE_CONSOLE
|
|
||||||
#include <Allegro/allegro.h>
|
|
||||||
#else
|
|
||||||
#define USE_CONSOLE
|
|
||||||
#include <allegro.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
typedef enum gg_States_
|
typedef enum gg_States_
|
||||||
{
|
{
|
||||||
@ -76,14 +69,23 @@ uint8_t gg_RdHookPatch##d(uint8_t addr) \
|
|||||||
#define GG_MAX_PATCH 10
|
#define GG_MAX_PATCH 10
|
||||||
/* Defines the rdhook patches */
|
/* Defines the rdhook patches */
|
||||||
GG_RDHOOKPATCH(0)
|
GG_RDHOOKPATCH(0)
|
||||||
|
|
||||||
GG_RDHOOKPATCH(1)
|
GG_RDHOOKPATCH(1)
|
||||||
|
|
||||||
GG_RDHOOKPATCH(2)
|
GG_RDHOOKPATCH(2)
|
||||||
|
|
||||||
GG_RDHOOKPATCH(3)
|
GG_RDHOOKPATCH(3)
|
||||||
|
|
||||||
GG_RDHOOKPATCH(4)
|
GG_RDHOOKPATCH(4)
|
||||||
|
|
||||||
GG_RDHOOKPATCH(5)
|
GG_RDHOOKPATCH(5)
|
||||||
|
|
||||||
GG_RDHOOKPATCH(6)
|
GG_RDHOOKPATCH(6)
|
||||||
|
|
||||||
GG_RDHOOKPATCH(7)
|
GG_RDHOOKPATCH(7)
|
||||||
|
|
||||||
GG_RDHOOKPATCH(8)
|
GG_RDHOOKPATCH(8)
|
||||||
|
|
||||||
GG_RDHOOKPATCH(9)
|
GG_RDHOOKPATCH(9)
|
||||||
|
|
||||||
void gg_SetPatch(int id, uint8_t page, uint8_t addr, uint8_t value)
|
void gg_SetPatch(int id, uint8_t page, uint8_t addr, uint8_t value)
|
||||||
@ -91,7 +93,9 @@ void gg_SetPatch(int id, uint8_t page, uint8_t addr, uint8_t value)
|
|||||||
func_rdhook fptr;
|
func_rdhook fptr;
|
||||||
|
|
||||||
if (id >= GG_MAX_PATCH)
|
if (id >= GG_MAX_PATCH)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* Set parameters for the patch */
|
/* Set parameters for the patch */
|
||||||
if (gg_PatchUsed[id] == 0x00)
|
if (gg_PatchUsed[id] == 0x00)
|
||||||
@ -154,7 +158,6 @@ void gg_SetPatch(int id, uint8_t page, uint8_t addr, uint8_t value)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Access to the bitmap Buffer */
|
/* Access to the bitmap Buffer */
|
||||||
extern BITMAP *Buffer;
|
extern BITMAP *Buffer;
|
||||||
BITMAP *gg_Buffer;
|
BITMAP *gg_Buffer;
|
||||||
@ -249,9 +252,13 @@ uint16_t SelectNumber(char *title, char *msg, uint8_t size)
|
|||||||
textout_centre_ex(gg_Buffer, font, msg, box_w / 2 + box_l, 15 + box_t + 2, 34, 60);
|
textout_centre_ex(gg_Buffer, font, msg, box_w / 2 + box_l, 15 + box_t + 2, 34, 60);
|
||||||
|
|
||||||
if (size == 2)
|
if (size == 2)
|
||||||
|
{
|
||||||
sprintf(valueText, " %02X", value & 0xFF);
|
sprintf(valueText, " %02X", value & 0xFF);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
sprintf(valueText, "%04X", value);
|
sprintf(valueText, "%04X", value);
|
||||||
|
}
|
||||||
|
|
||||||
textout_centre_ex(gg_Buffer, font, valueText, box_w / 2 + box_l, 15 + box_t + 2 + 10, 34, 60);
|
textout_centre_ex(gg_Buffer, font, valueText, box_w / 2 + box_l, 15 + box_t + 2 + 10, 34, 60);
|
||||||
|
|
||||||
@ -294,23 +301,33 @@ uint16_t SelectNumber(char *title, char *msg, uint8_t size)
|
|||||||
{
|
{
|
||||||
usleep(100000);
|
usleep(100000);
|
||||||
if (digit <= 0)
|
if (digit <= 0)
|
||||||
|
{
|
||||||
digit = size - 1;
|
digit = size - 1;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
digit--;
|
digit--;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (key[KEY_LEFT])
|
if (key[KEY_LEFT])
|
||||||
{
|
{
|
||||||
usleep(100000);
|
usleep(100000);
|
||||||
if (digit >= size - 1)
|
if (digit >= size - 1)
|
||||||
|
{
|
||||||
digit = 0;
|
digit = 0;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
digit++;
|
digit++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
release_bitmap(gg_Buffer);
|
release_bitmap(gg_Buffer);
|
||||||
while(key[KEY_ENTER]);
|
while (key[KEY_ENTER])
|
||||||
|
{
|
||||||
|
}
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -333,7 +350,9 @@ int DispMenu(int itemc, char *itemv[], char *title)
|
|||||||
box_w = text_length(font, title) + 10;
|
box_w = text_length(font, title) + 10;
|
||||||
|
|
||||||
for (i = 0 ; i < itemc ; i++)
|
for (i = 0 ; i < itemc ; i++)
|
||||||
|
{
|
||||||
box_w = (box_w > text_length(font, itemv[i])) ? box_w : text_length(font, itemv[i]);
|
box_w = (box_w > text_length(font, itemv[i])) ? box_w : text_length(font, itemv[i]);
|
||||||
|
}
|
||||||
|
|
||||||
box_w += 15 * 2; /*sc_w/2;*/
|
box_w += 15 * 2; /*sc_w/2;*/
|
||||||
box_h = 15 * 2 + itemc * 10;
|
box_h = 15 * 2 + itemc * 10;
|
||||||
@ -353,15 +372,19 @@ int DispMenu(int itemc, char *itemv[], char *title)
|
|||||||
textout_centre_ex(gg_Buffer, font, title, box_w / 2 + box_l, box_t + 2, 34, 60);
|
textout_centre_ex(gg_Buffer, font, title, box_w / 2 + box_l, box_t + 2, 34, 60);
|
||||||
|
|
||||||
/* Display the highlight item */
|
/* Display the highlight item */
|
||||||
rectfill(gg_Buffer, box_l+15, 15 + box_t + (selection * 10) , box_l + box_w - 15, 15 + box_t + (selection * 10) + 10, 34);
|
rectfill(gg_Buffer, box_l + 15, 15 + box_t + (selection * 10), box_l + box_w - 15,
|
||||||
textout_centre_ex(gg_Buffer, font, itemv[selection], box_w / 2 + box_l, 15 + box_t + (selection * 10) + 2, 60, 34);
|
15 + box_t + (selection * 10) + 10, 34);
|
||||||
|
textout_centre_ex(gg_Buffer, font, itemv[selection], box_w / 2 + box_l, 15 + box_t + (selection * 10) + 2, 60,
|
||||||
|
34);
|
||||||
|
|
||||||
/* Display other items */
|
/* Display other items */
|
||||||
for (i = 0 ; i < itemc ; i++)
|
for (i = 0 ; i < itemc ; i++)
|
||||||
{
|
{
|
||||||
if (i != selection)
|
if (i != selection)
|
||||||
|
{
|
||||||
textout_centre_ex(gg_Buffer, font, itemv[i], box_w / 2 + box_l, 15 + box_t + (i * 10) + 2, 34, 60);
|
textout_centre_ex(gg_Buffer, font, itemv[i], box_w / 2 + box_l, 15 + box_t + (i * 10) + 2, 34, 60);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Blit the screen buffer */
|
/* Blit the screen buffer */
|
||||||
@ -372,24 +395,34 @@ int DispMenu(int itemc, char *itemv[], char *title)
|
|||||||
{
|
{
|
||||||
usleep(100000);
|
usleep(100000);
|
||||||
if (selection <= 0)
|
if (selection <= 0)
|
||||||
|
{
|
||||||
selection = itemc - 1;
|
selection = itemc - 1;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
selection--;
|
selection--;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (key[KEY_DOWN])
|
if (key[KEY_DOWN])
|
||||||
{
|
{
|
||||||
usleep(100000);
|
usleep(100000);
|
||||||
if (selection >= (itemc - 1))
|
if (selection >= (itemc - 1))
|
||||||
|
{
|
||||||
selection = 0;
|
selection = 0;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
selection++;
|
selection++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
release_bitmap(gg_Buffer);
|
release_bitmap(gg_Buffer);
|
||||||
while(key[KEY_ENTER]);
|
while (key[KEY_ENTER])
|
||||||
|
{
|
||||||
|
}
|
||||||
return selection;
|
return selection;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -436,11 +469,15 @@ uint8_t gg_SelectPatch()
|
|||||||
tmp = (char *)malloc(0x100);
|
tmp = (char *)malloc(0x100);
|
||||||
console_printf(Console_Default, "Items[%d]: %p\n", i, tmp);
|
console_printf(Console_Default, "Items[%d]: %p\n", i, tmp);
|
||||||
if (gg_PatchUsed[i] == 0x00)
|
if (gg_PatchUsed[i] == 0x00)
|
||||||
|
{
|
||||||
sprintf(tmp, "Patch %d: Not used", i);
|
sprintf(tmp, "Patch %d: Not used", i);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
sprintf(tmp, "Patch %d: Put 0x%02X on address 0x%02X%02X (Code: %08lX)",
|
sprintf(tmp, "Patch %d: Put 0x%02X on address 0x%02X%02X (Code: %08lX)",
|
||||||
i, gg_PatchedValue[i], gg_PatchedPage[i], gg_PatchedAddr[i],
|
i, gg_PatchedValue[i], gg_PatchedPage[i], gg_PatchedAddr[i],
|
||||||
gg_MakeCode((gg_PatchedPage[i] << 8) | gg_PatchedAddr[i], gg_PatchedValue[i]));
|
gg_MakeCode((gg_PatchedPage[i] << 8) | gg_PatchedAddr[i], gg_PatchedValue[i]));
|
||||||
|
}
|
||||||
|
|
||||||
Items[i] = tmp;
|
Items[i] = tmp;
|
||||||
}
|
}
|
||||||
@ -452,10 +489,14 @@ uint8_t gg_SelectPatch()
|
|||||||
ret = DispMenu(GG_MAX_PATCH + 1, Items, "Code Breaker - Select a patch");
|
ret = DispMenu(GG_MAX_PATCH + 1, Items, "Code Breaker - Select a patch");
|
||||||
|
|
||||||
for (i = 0 ; i < GG_MAX_PATCH ; i++)
|
for (i = 0 ; i < GG_MAX_PATCH ; i++)
|
||||||
|
{
|
||||||
free(Items[i]);
|
free(Items[i]);
|
||||||
|
}
|
||||||
|
|
||||||
if (ret == GG_MAX_PATCH)
|
if (ret == GG_MAX_PATCH)
|
||||||
|
{
|
||||||
return 0xFF;
|
return 0xFF;
|
||||||
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -602,7 +643,9 @@ uint8_t gg_DisplayResults()
|
|||||||
for (i = 0 ; i < gg_ResultNumber ; i++)
|
for (i = 0 ; i < gg_ResultNumber ; i++)
|
||||||
{
|
{
|
||||||
while (gg_use_MainRAM[addr] != 0xFF)
|
while (gg_use_MainRAM[addr] != 0xFF)
|
||||||
|
{
|
||||||
addr++;
|
addr++;
|
||||||
|
}
|
||||||
console_printf(Console_Default, "0x%04X [%d]\n", addr, i);
|
console_printf(Console_Default, "0x%04X [%d]\n", addr, i);
|
||||||
tmp = (char *)malloc(0x100);
|
tmp = (char *)malloc(0x100);
|
||||||
sprintf(tmp, "Patch: %08XAddress 0x%04X - Was: 0x%02X - Actual: 0x%02X",
|
sprintf(tmp, "Patch: %08XAddress 0x%04X - Was: 0x%02X - Actual: 0x%02X",
|
||||||
@ -632,8 +675,10 @@ uint8_t gg_DisplayResults()
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0 ; i < gg_ResultNumber + 1 ; i++)
|
for (i = 0 ; i < gg_ResultNumber + 1 ; i++)
|
||||||
|
{
|
||||||
free(Items[i]);
|
free(Items[i]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -730,9 +775,13 @@ S01_MENU:
|
|||||||
|
|
||||||
case 5: /* Results */
|
case 5: /* Results */
|
||||||
if (gg_DisplayResults() == 1)
|
if (gg_DisplayResults() == 1)
|
||||||
|
{
|
||||||
gg_state = GG_S00_MAIN_STATE;
|
gg_state = GG_S00_MAIN_STATE;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
goto S01_MENU;
|
goto S01_MENU;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 6:
|
case 6:
|
||||||
@ -742,7 +791,9 @@ S01_MENU:
|
|||||||
gg_Start();
|
gg_Start();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
goto S01_MENU;
|
goto S01_MENU;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -778,9 +829,13 @@ S02_MENU:
|
|||||||
|
|
||||||
case 4: /* Results */
|
case 4: /* Results */
|
||||||
if (gg_DisplayResults() == 1)
|
if (gg_DisplayResults() == 1)
|
||||||
|
{
|
||||||
gg_state = GG_S00_MAIN_STATE;
|
gg_state = GG_S00_MAIN_STATE;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
goto S02_MENU;
|
goto S02_MENU;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 5:
|
case 5:
|
||||||
@ -790,7 +845,9 @@ S02_MENU:
|
|||||||
gg_Start();
|
gg_Start();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
goto S02_MENU;
|
goto S02_MENU;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -801,7 +858,6 @@ S02_MENU:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int gg_Init()
|
int gg_Init()
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@ -810,7 +866,9 @@ int gg_Init()
|
|||||||
plugin_install_keypressHandler('g', gg_Start);
|
plugin_install_keypressHandler('g', gg_Start);
|
||||||
|
|
||||||
for (i = 0 ; i < GG_MAX_PATCH ; i++)
|
for (i = 0 ; i < GG_MAX_PATCH ; i++)
|
||||||
|
{
|
||||||
gg_PatchUsed[i] = 0x00;
|
gg_PatchUsed[i] = 0x00;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -820,4 +878,5 @@ int gg_Deinit()
|
|||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@ -2,7 +2,7 @@
|
|||||||
* Code Breaker plugin - The peTI-NESulator Project
|
* Code Breaker plugin - The peTI-NESulator Project
|
||||||
* gamegenie.h
|
* gamegenie.h
|
||||||
*
|
*
|
||||||
* Created by Manoel Trapier.
|
* Created by Manoël Trapier.
|
||||||
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
* Plugin Manager plugint list - The peTI-NESulator Project
|
* Plugin Manager plugint list - The peTI-NESulator Project
|
||||||
* plugins_list.h
|
* plugins_list.h
|
||||||
*
|
*
|
||||||
* Created by Manoel Trapier.
|
* Created by Manoël Trapier.
|
||||||
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
#
|
#
|
||||||
# peTI-NESulator CMake
|
# peTI-NESulator CMake
|
||||||
#
|
#
|
||||||
# Created by Manoel TRAPIER.
|
# Created by Manoël TRAPIER.
|
||||||
# Copyright (c) 2003-2008 986Corp. All rights reserved.
|
# Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
||||||
#
|
#
|
||||||
# $LastChangedDate$
|
# $LastChangedDate$
|
||||||
# $Author$
|
# $Author$
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
* PPU Debug utilities - The peTI-NESulator Project
|
* PPU Debug utilities - The peTI-NESulator Project
|
||||||
* ppu.debug.c
|
* ppu.debug.c
|
||||||
*
|
*
|
||||||
* Created by Manoel Trapier.
|
* Created by Manoël Trapier.
|
||||||
* Copyright 2003-2008 986 Corp. All rights reserved.
|
* Copyright 2003-2008 986 Corp. All rights reserved.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* Define and emulate the PPU (Picture Processing Unit) of the real NES
|
* Define and emulate the PPU (Picture Processing Unit) of the real NES
|
||||||
*
|
*
|
||||||
* Created by Manoel TRAPIER.
|
* Created by Manoël TRAPIER.
|
||||||
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@ -55,12 +55,6 @@ typedef struct spriteData
|
|||||||
|
|
||||||
/* PPU registers */
|
/* PPU registers */
|
||||||
|
|
||||||
/* NT: Name Table */
|
|
||||||
uint8_t PPU_Reg_NT;
|
|
||||||
|
|
||||||
/* AT: Attribute/Color Table */
|
|
||||||
uint8_t PPU_Reg_AT;
|
|
||||||
|
|
||||||
/* FV: Fine Vertical Scroll latch/counter */
|
/* FV: Fine Vertical Scroll latch/counter */
|
||||||
uint8_t PPU_Reg_FV;
|
uint8_t PPU_Reg_FV;
|
||||||
|
|
||||||
@ -79,7 +73,7 @@ uint8_t PPU_Reg_V;
|
|||||||
/* H: Horizontal Name Table Selection latch/counter */
|
/* H: Horizontal Name Table Selection latch/counter */
|
||||||
uint8_t PPU_Reg_H;
|
uint8_t PPU_Reg_H;
|
||||||
|
|
||||||
/* S: Playfield pattern table selection latch */
|
/* S: Play-field pattern table selection latch */
|
||||||
uint16_t PPU_Reg_S;
|
uint16_t PPU_Reg_S;
|
||||||
|
|
||||||
/* PAR: Picture Address Register */
|
/* PAR: Picture Address Register */
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
* PPU Memory manager - The peTI-NESulator Project
|
* PPU Memory manager - The peTI-NESulator Project
|
||||||
* ppu.memory.c - Inspired from the memory manager of the Quick6502 Project.
|
* ppu.memory.c - Inspired from the memory manager of the Quick6502 Project.
|
||||||
*
|
*
|
||||||
* Created by Manoel Trapier on 12/04/07.
|
* Created by Manoël Trapier on 12/04/07.
|
||||||
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@ -20,7 +20,7 @@
|
|||||||
#include <types.h>
|
#include <types.h>
|
||||||
|
|
||||||
/* Simple definition only for readability */
|
/* Simple definition only for readability */
|
||||||
#define Kuint8_t * (1024)
|
#define KByte * (1024)
|
||||||
|
|
||||||
/* Internal representation of the PPU memory */
|
/* Internal representation of the PPU memory */
|
||||||
uint8_t *ppu_memoryPages[0x40];
|
uint8_t *ppu_memoryPages[0x40];
|
||||||
@ -102,13 +102,13 @@ void ppu_setPagePtr2k(uint8_t page, uint8_t *ptr)
|
|||||||
void ppu_setPagePtr4k(uint8_t page, uint8_t *ptr)
|
void ppu_setPagePtr4k(uint8_t page, uint8_t *ptr)
|
||||||
{
|
{
|
||||||
ppu_setPagePtr2k(page, ptr);
|
ppu_setPagePtr2k(page, ptr);
|
||||||
ppu_setPagePtr2k(page+((4 Kuint8_t / 256) / 2), ptr + 2 Kuint8_t);
|
ppu_setPagePtr2k(page+((4 KByte / 256) / 2), ptr + 2 KByte);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ppu_setPagePtr8k(uint8_t page, uint8_t *ptr)
|
void ppu_setPagePtr8k(uint8_t page, uint8_t *ptr)
|
||||||
{
|
{
|
||||||
ppu_setPagePtr4k(page, ptr);
|
ppu_setPagePtr4k(page, ptr);
|
||||||
ppu_setPagePtr4k(page+((8 Kuint8_t / 256) / 2), ptr + 4 Kuint8_t);
|
ppu_setPagePtr4k(page+((8 KByte / 256) / 2), ptr + 4 KByte);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ppu_setPageGhost(uint8_t page, uint8_t value, uint8_t ghost)
|
void ppu_setPageGhost(uint8_t page, uint8_t value, uint8_t ghost)
|
||||||
@ -149,7 +149,7 @@ void ppu_writeMemory(uint8_t page, uint8_t addr, uint8_t value)
|
|||||||
{
|
{
|
||||||
if (page == 0x3F)
|
if (page == 0x3F)
|
||||||
{
|
{
|
||||||
/* Here we will cheat with the palette miroring, since we didn't write
|
/* Here we will cheat with the palette mirroring, since we didn't write
|
||||||
as often as we read the palette, we will mirror here */
|
as often as we read the palette, we will mirror here */
|
||||||
//console_printf(Console_Default, "%s palette: color %02X new value : %02d (0x%02X%02X)\n", ((addr&0x10)< 0x10) ? "Bgnd" : "Sprt", addr&0x1F, value & 0x3F, page, addr);
|
//console_printf(Console_Default, "%s palette: color %02X new value : %02d (0x%02X%02X)\n", ((addr&0x10)< 0x10) ? "Bgnd" : "Sprt", addr&0x1F, value & 0x3F, page, addr);
|
||||||
if ((addr & 0xEF) == 0x00)
|
if ((addr & 0xEF) == 0x00)
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
* bin to header - Part of The peTI-NESulator Project
|
* bin to header - Part of The peTI-NESulator Project
|
||||||
* bin2h.c: Convert a binary file to a table of uint8_t in a C header file.
|
* bin2h.c: Convert a binary file to a table of uint8_t in a C header file.
|
||||||
*
|
*
|
||||||
* Created by Manoel Trapier.
|
* Created by Manoël Trapier.
|
||||||
* Copyright 2003-2008 986 Corp. All rights reserved.
|
* Copyright 2003-2008 986 Corp. All rights reserved.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@ -65,9 +65,13 @@ int main(int argc, char *argv[])
|
|||||||
while ((c = fgetc(fpin)) >= 0)
|
while ((c = fgetc(fpin)) >= 0)
|
||||||
{
|
{
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
|
{
|
||||||
fprintf(fpout, "\t\t0x%02X", (uint8_t)c);
|
fprintf(fpout, "\t\t0x%02X", (uint8_t)c);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
fprintf(fpout, ", 0x%02X", (uint8_t)c);
|
fprintf(fpout, ", 0x%02X", (uint8_t)c);
|
||||||
|
}
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
if (i > 10)
|
if (i > 10)
|
||||||
|
|||||||
@ -12,6 +12,7 @@ import sys
|
|||||||
import hashlib.md5 as md5
|
import hashlib.md5 as md5
|
||||||
import hashlib.sha as sha
|
import hashlib.sha as sha
|
||||||
|
|
||||||
|
|
||||||
def get_page(theurl, post_data=None):
|
def get_page(theurl, post_data=None):
|
||||||
"""
|
"""
|
||||||
Helper method that gets the given URL
|
Helper method that gets the given URL
|
||||||
@ -69,7 +70,6 @@ if __name__ == '__main__':
|
|||||||
print(" <diskdude>{diskdude}</diskdude>".format(diskdude=DiskDude))
|
print(" <diskdude>{diskdude}</diskdude>".format(diskdude=DiskDude))
|
||||||
print(" </game>")
|
print(" </game>")
|
||||||
|
|
||||||
|
|
||||||
# will fill the DB :
|
# will fill the DB :
|
||||||
url = "http://127.0.0.1/nesstat/add.php"
|
url = "http://127.0.0.1/nesstat/add.php"
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user