mirror of
https://github.com/ArthurFerreira2/reinette-IIe.git
synced 2025-01-16 12:30:36 +00:00
initial commit
fixed tab alignment for better readability
This commit is contained in:
parent
ed300523fe
commit
92c895243f
2094
puce65c02.cpp
2094
puce65c02.cpp
File diff suppressed because it is too large
Load Diff
64
puce65c02.h
64
puce65c02.h
@ -1,6 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
puce65c02, a WDC 65c02 cpu emulator, based on puce6502 by the same author
|
puce65c02, a WDC 65c02 cpu emulator, based on puce6502 by the same author
|
||||||
|
|
||||||
Last modified 1st of July 2021
|
Last modified 1st of July 2021
|
||||||
|
|
||||||
Copyright (c) 2021 Arthur Ferreira (arthur.ferreira2@gmail.com)
|
Copyright (c) 2021 Arthur Ferreira (arthur.ferreira2@gmail.com)
|
||||||
@ -10,7 +9,7 @@
|
|||||||
in the Software without restriction, including without limitation the rights
|
in the Software without restriction, including without limitation the rights
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
furnished to do so, subject to the following conditions:
|
furnished to do so, subject to the following conditions :
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in
|
The above copyright notice and this permission notice shall be included in
|
||||||
all copies or substantial portions of the Software.
|
all copies or substantial portions of the Software.
|
||||||
@ -24,17 +23,12 @@
|
|||||||
THE SOFTWARE.
|
THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
|
||||||
This version is slightly modified for reinette IIe, a french Apple IIe
|
|
||||||
emulator using SDL2 (https://github.com/ArthurFerreira2/reinette-IIe).
|
|
||||||
Please download the latest version from
|
|
||||||
https://github.com/ArthurFerreira2/puce65c02
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef _PUCE65C02_H
|
#ifndef _PUCE65C02_H
|
||||||
#define _PUCE65C02_H
|
#define _PUCE65C02_H
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
typedef enum {run, step, stop, wait} status;
|
typedef enum {run, step, stop, wait} status;
|
||||||
|
|
||||||
#define CARRY 0x01
|
#define CARRY 0x01
|
||||||
@ -46,45 +40,49 @@ typedef enum {run, step, stop, wait} status;
|
|||||||
#define OFLOW 0x40
|
#define OFLOW 0x40
|
||||||
#define SIGN 0x80
|
#define SIGN 0x80
|
||||||
|
|
||||||
typedef struct Pbits_t {
|
|
||||||
uint8_t C : 1; // Carry
|
|
||||||
uint8_t Z : 1; // Zero
|
|
||||||
uint8_t I : 1; // Interupt disabled
|
|
||||||
uint8_t D : 1; // Decimal
|
|
||||||
uint8_t B : 1; // Break
|
|
||||||
uint8_t U : 1; // Undefined
|
|
||||||
uint8_t V : 1; // Overflow
|
|
||||||
uint8_t S : 1; // Sign
|
|
||||||
} Pbits;
|
|
||||||
|
|
||||||
|
|
||||||
class puce65c02 {
|
class puce65c02 {
|
||||||
private:
|
public:
|
||||||
uint16_t PC; // Program Counter
|
|
||||||
uint8_t A, X, Y, SP; // Accumulator, X and y indexes and Stack Pointer
|
unsigned long long int ticks;
|
||||||
|
// private:
|
||||||
|
status state;
|
||||||
|
uint16_t PC; // Program Counter
|
||||||
|
uint8_t A, X, Y, SP; // Accumulator, X and y indexes and Stack Pointer
|
||||||
union {
|
union {
|
||||||
uint8_t byte;
|
uint8_t byte;
|
||||||
Pbits bits;
|
struct {
|
||||||
} P; // Processor Status
|
uint8_t C : 1; // Carry
|
||||||
|
uint8_t Z : 1; // Zero
|
||||||
|
uint8_t I : 1; // Interupt disabled
|
||||||
|
uint8_t D : 1; // Decimal
|
||||||
|
uint8_t B : 1; // Break
|
||||||
|
uint8_t U : 1; // Undefined
|
||||||
|
uint8_t V : 1; // Overflow
|
||||||
|
uint8_t S : 1; // Sign
|
||||||
|
};
|
||||||
|
} P; // Processor Status
|
||||||
|
|
||||||
public:
|
public:
|
||||||
unsigned long long int ticks;
|
puce65c02() { ticks = 0; RST(); }
|
||||||
|
puce65c02(uint16_t address) { ticks = 0; RST(); PC = address; }
|
||||||
status state;
|
|
||||||
|
|
||||||
puce65c02();
|
|
||||||
~puce65c02();
|
~puce65c02();
|
||||||
|
|
||||||
|
uint16_t getPC() { return PC; };
|
||||||
|
void setPC(uint16_t address) { PC = address; };
|
||||||
|
|
||||||
void RST();
|
void RST();
|
||||||
void IRQ();
|
void IRQ();
|
||||||
void NMI();
|
void NMI();
|
||||||
uint16_t exec(unsigned long long int cycleCount);
|
uint16_t exec(unsigned long long int cycleCount);
|
||||||
|
|
||||||
uint16_t getPC();
|
#if __TESTS__
|
||||||
void setPC(uint16_t address);
|
void dasm(uint16_t address);
|
||||||
|
void printRegs();
|
||||||
int getRegs(char* buffer);
|
int getRegs(char* buffer);
|
||||||
int getCode(uint16_t address, char* buffer, int size, int numLines);
|
int getCode(uint16_t address, char* buffer, int size, int numLines);
|
||||||
|
#endif
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user