1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-07-23 06:28:59 +00:00

Extended scheduling plans, inserted initial events for hmove, albeit not yet implemented.

This commit is contained in:
Thomas Harte 2016-05-17 18:21:49 -04:00
parent 6a961c4d28
commit d170bb14e6
2 changed files with 27 additions and 7 deletions

View File

@ -21,7 +21,6 @@ Machine::Machine() :
_lastOutputState(OutputState::Sync),
_piaTimerStatus(0xff),
_rom(nullptr),
_hMoveWillCount(false),
_piaDataValue{0xff, 0xff},
_tiaInputValue{0xff, 0xff},
_upcomingEventsPointer(0)
@ -555,7 +554,21 @@ unsigned int Machine::perform_bus_operation(CPU6502::BusOperation operation, uin
case 0x2a:
_vBlankExtend = true;
_hMoveWillCount = true;
// clear any ongoing moves
if(_hMoveFlags)
{
for(int c = 0; c < number_of_upcoming_events; c++)
{
_upcomingEvents[c].updates &= ~(Event::Action::HMoveCompare | Event::Action::HMoveDecrement);
}
}
// schedule new moves
_hMoveFlags = 0x1f;
_hMoveCounter = 15;
_upcomingEvents[(_upcomingEventsPointer + 15)%number_of_upcoming_events].updates |= Event::Action::HMoveCompare;
_upcomingEvents[(_upcomingEventsPointer + 17)%number_of_upcoming_events].updates |= Event::Action::HMoveDecrement;
break;
case 0x2b:
_objectMotion[0] =

View File

@ -16,7 +16,7 @@
namespace Atari2600 {
const unsigned int number_of_upcoming_events = 8;
const unsigned int number_of_upcoming_events = 18;
class Machine: public CPU6502::Processor<Machine> {
@ -61,11 +61,14 @@ class Machine: public CPU6502::Processor<Machine> {
struct Event {
enum Action {
Playfield = 1 << 0,
Ball = 1 << 1
Ball = 1 << 1,
HMoveCompare = 1 << 2,
HMoveDecrement = 1 << 3
};
unsigned int updates;
int updates;
uint8_t playfieldOutput;
OutputState state;
Event() : updates(0) {}
} _upcomingEvents[number_of_upcoming_events];
unsigned int _upcomingEventsPointer;
@ -95,10 +98,14 @@ class Machine: public CPU6502::Processor<Machine> {
unsigned int _horizontalTimer;
bool _vSyncEnabled, _vBlankEnabled;
bool _vBlankExtend;
// horizontal motion control
uint8_t _hMoveCounter;
bool _hMoveIsCounting, _hMoveWillCount;
uint8_t _objectCounter[5], _objectMotion[5];
uint8_t _hMoveFlags;
uint8_t _objectMotion[5];
// object counters
uint8_t _objectCounter[5];
// joystick state
uint8_t _piaDataDirection[2];