Skip to content

Commit

Permalink
Minor updates to support UpNDown
Browse files Browse the repository at this point in the history
  • Loading branch information
Steven Dalton committed Sep 11, 2019
1 parent 5bcb2be commit a50d803
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions cule/atari/tia.hpp
Expand Up @@ -629,7 +629,7 @@ void write(State_t& s, const maddr_t& addr, const uint8_t& value)
}
UPDATE_FIELD(s.POS, FIELD_POSP0, newx);

s.CurrentP0Mask = &player_mask_accessor(newx & 0x03, 0, MODE, 160 - (newx & 0xFC));
s.CurrentP0Mask = &player_mask_accessor(newx & 0x03, (when == 0) || (when == 1), MODE, 160 - (newx & 0xFC));

break;
}
Expand All @@ -655,7 +655,7 @@ void write(State_t& s, const maddr_t& addr, const uint8_t& value)
}
UPDATE_FIELD(s.POS, FIELD_POSP1, newx);

s.CurrentP1Mask = &player_mask_accessor(newx & 0x03, 0, MODE, 160 - (newx & 0xFC));
s.CurrentP1Mask = &player_mask_accessor(newx & 0x03, (when == 0) || (when == 1), MODE, 160 - (newx & 0xFC));

break;
}
Expand Down
7 changes: 5 additions & 2 deletions torchcule/atari_state.cpp
Expand Up @@ -22,7 +22,6 @@ struct encode_states_functor

const AtariState& ts = src_states[index];
cule::atari::state& s = dst_states[index];
/* cule::atari::frame_state& fs = dst_frame_states[index]; */

s.resistance = ts.left_paddle;
Environment_t::setFrameNumber(s, cule::atari::ENV_BASE_FRAMES + 10 + ts.frame_number);
Expand All @@ -36,6 +35,10 @@ struct encode_states_functor
s.PC = ts.PC;
UPDATE_FIELD(s.sysFlags.asBitField(), cule::atari::FIELD_SYS_INT, ts.IR);

s.sysFlags.template change<cule::atari::FLAG_CON_PADDLES>(cart.use_paddles());
s.sysFlags.template change<cule::atari::FLAG_CON_SWAP>(cart.swap_paddles() || cart.swap_ports());
s.sysFlags.template change<cule::atari::FLAG_SW_LEFT_DIFFLAG_A>(!cart.player_left_difficulty_B());
s.sysFlags.template change<cule::atari::FLAG_SW_RIGHT_DIFFLAG_A>(!cart.player_right_difficulty_B());
s.sysFlags.template change<cule::atari::FLAG_NEGATIVE>(ts.N);
s.sysFlags.template change<cule::atari::FLAG_OVERFLOW>(ts.V);
s.sysFlags.template change<cule::atari::FLAG_BREAK>(ts.B);
Expand All @@ -57,10 +60,10 @@ struct encode_states_functor

UPDATE_FIELD(s.riotData, cule::atari::FIELD_RIOT_TIMER, ts.timer);
UPDATE_FIELD(s.riotData, cule::atari::FIELD_RIOT_SHIFT, ts.intervalShift);
UPDATE_FIELD(s.riotData, cule::atari::FIELD_RIOT_DDRA, ts.DDRA);
s.cyclesWhenTimerSet = ts.cyclesWhenTimerSet;
s.cyclesWhenInterruptReset = ts.cyclesWhenInterruptReset;
s.tiaFlags.template change<cule::atari::FLAG_RIOT_READ_INT>(ts.timerReadAfterInterrupt != 0);
UPDATE_FIELD(s.riotData, cule::atari::FIELD_RIOT_DDRA, ts.DDRA);
ALE_t::set_id(s, cart.game_id());

s.clockWhenFrameStarted = ts.clockWhenFrameStarted;
Expand Down

0 comments on commit a50d803

Please sign in to comment.