2015-11-21 07:36:48 +00:00
|
|
|
//NEC uPD7720 (not supported)
|
|
|
|
//NEC uPD7725
|
|
|
|
//NEC uPD96050
|
|
|
|
|
2016-02-02 10:51:17 +00:00
|
|
|
#pragma once
|
2012-03-26 10:13:02 +00:00
|
|
|
|
|
|
|
namespace Processor {
|
|
|
|
|
|
|
|
struct uPD96050 {
|
2015-11-21 07:36:48 +00:00
|
|
|
auto power() -> void;
|
|
|
|
auto exec() -> void;
|
|
|
|
auto serialize(serializer&) -> void;
|
|
|
|
|
|
|
|
auto execOP(uint24 opcode) -> void;
|
|
|
|
auto execRT(uint24 opcode) -> void;
|
|
|
|
auto execJP(uint24 opcode) -> void;
|
|
|
|
auto execLD(uint24 opcode) -> void;
|
|
|
|
|
|
|
|
auto readSR() -> uint8;
|
|
|
|
auto writeSR(uint8 data) -> void;
|
|
|
|
|
|
|
|
auto readDR() -> uint8;
|
|
|
|
auto writeDR(uint8 data) -> void;
|
|
|
|
|
|
|
|
auto readDP(uint12 addr) -> uint8;
|
|
|
|
auto writeDP(uint12 addr, uint8 data) -> void;
|
|
|
|
|
|
|
|
auto disassemble(uint14 ip) -> string;
|
|
|
|
|
|
|
|
enum class Revision : uint { uPD7725, uPD96050 } revision;
|
2012-03-26 10:13:02 +00:00
|
|
|
uint24 programROM[16384];
|
|
|
|
uint16 dataROM[2048];
|
|
|
|
uint16 dataRAM[2048];
|
|
|
|
|
2015-11-21 07:36:48 +00:00
|
|
|
struct Flag {
|
2016-06-08 22:26:35 +00:00
|
|
|
union {
|
|
|
|
uint8_t data = 0;
|
2016-06-28 10:43:47 +00:00
|
|
|
BooleanBitField<uint8_t, 5> s1;
|
|
|
|
BooleanBitField<uint8_t, 4> s0;
|
|
|
|
BooleanBitField<uint8_t, 3> c;
|
|
|
|
BooleanBitField<uint8_t, 2> z;
|
|
|
|
BooleanBitField<uint8_t, 1> ov1;
|
|
|
|
BooleanBitField<uint8_t, 0> ov0;
|
2016-06-08 22:26:35 +00:00
|
|
|
};
|
2012-03-26 10:13:02 +00:00
|
|
|
|
2016-06-08 22:26:35 +00:00
|
|
|
inline operator uint() const { return data & 0x3f; }
|
|
|
|
inline auto& operator=(uint value) { return data = value, *this; }
|
|
|
|
inline auto& operator=(const Flag& value) { return data = value.data, *this; }
|
2015-11-21 07:36:48 +00:00
|
|
|
};
|
2012-03-26 10:13:02 +00:00
|
|
|
|
2015-11-21 07:36:48 +00:00
|
|
|
struct Status {
|
2016-06-08 22:26:35 +00:00
|
|
|
union {
|
|
|
|
uint16_t data = 0;
|
2016-06-28 10:43:47 +00:00
|
|
|
BooleanBitField<uint16_t, 15> rqm;
|
|
|
|
BooleanBitField<uint16_t, 14> usf1;
|
|
|
|
BooleanBitField<uint16_t, 13> usf0;
|
|
|
|
BooleanBitField<uint16_t, 12> drs;
|
|
|
|
BooleanBitField<uint16_t, 11> dma;
|
|
|
|
BooleanBitField<uint16_t, 10> drc;
|
|
|
|
BooleanBitField<uint16_t, 9> soc;
|
|
|
|
BooleanBitField<uint16_t, 8> sic;
|
|
|
|
BooleanBitField<uint16_t, 7> ei;
|
|
|
|
BooleanBitField<uint16_t, 1> p1;
|
|
|
|
BooleanBitField<uint16_t, 0> p0;
|
2016-06-08 22:26:35 +00:00
|
|
|
};
|
2012-03-26 10:13:02 +00:00
|
|
|
|
2016-06-08 22:26:35 +00:00
|
|
|
inline operator uint() const { return data & 0xff83; }
|
|
|
|
inline auto& operator=(uint value) { return data = value, *this; }
|
2015-11-21 07:36:48 +00:00
|
|
|
};
|
2012-03-26 10:13:02 +00:00
|
|
|
|
2015-11-21 07:36:48 +00:00
|
|
|
struct Regs {
|
2016-02-16 09:27:55 +00:00
|
|
|
uint16 stack[16]; //LIFO
|
Update to v097r17 release.
byuu says:
Changelog:
- ruby: if DirectSoundCreate fails (no sound device present), return
false from init instead of crashing
- nall: improved edge case return values for
(basename,pathname,dirname,...)
- nall: renamed file_system_object class to inode
- nall: varuint_t replaced with VariadicNatural; which contains
.bit,.bits,.byte ala Natural/Integer
- nall: fixed boolean compilation error on Windows
- WS: popa should not restore SP
- GBA: rewrote the CPU/APU cores to use the .bit,.bits functions;
removed registers.cpp from each
Note that the GBA changes are extremely major. This is about five hours
worth of extremely delicate work. Any slight errors could break
emulation in extremely bad ways. Let's hold off on extensive testing
until the next WIP, after I do the same to the PPU.
So far ... endrift's SOUNDCNT_X I/O test is failing, although that code
didn't change, so clearly I messed up SOUNDCNT_H somehow ...
To compile on Windows:
1. change nall/string/platform.hpp line 47 to
return slice(result, 0, 3);
2. change ruby/video.wgl.cpp line 72 to
auto lock(uint32_t*& data, uint& pitch, uint width, uint height) -> bool {
3. add this line to the very top of hiro/windows/header.cpp:
#define boolean FuckYouMicrosoft
2016-02-23 11:08:44 +00:00
|
|
|
VariadicNatural pc; //program counter
|
|
|
|
VariadicNatural rp; //ROM pointer
|
|
|
|
VariadicNatural dp; //data pointer
|
2016-02-16 09:27:55 +00:00
|
|
|
uint4 sp; //stack pointer
|
2015-11-21 07:36:48 +00:00
|
|
|
int16 k;
|
|
|
|
int16 l;
|
|
|
|
int16 m;
|
|
|
|
int16 n;
|
2016-02-16 09:27:55 +00:00
|
|
|
int16 a; //accumulator
|
|
|
|
int16 b; //accumulator
|
2015-11-21 07:36:48 +00:00
|
|
|
Flag flaga;
|
|
|
|
Flag flagb;
|
2016-02-16 09:27:55 +00:00
|
|
|
uint16 tr; //temporary register
|
|
|
|
uint16 trb; //temporary register
|
|
|
|
Status sr; //status register
|
|
|
|
uint16 dr; //data register
|
2015-11-21 07:36:48 +00:00
|
|
|
uint16 si;
|
|
|
|
uint16 so;
|
|
|
|
} regs;
|
2012-03-26 10:13:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|