mirror of
https://github.com/TomHarte/CLK.git
synced 2025-04-09 15:39:08 +00:00
Added some additional documentation, started making steps towards returning sprites, fixed a counter bug that would exhibit as incorrect sync.
This commit is contained in:
parent
abe04334c2
commit
f2437cb257
@ -205,7 +205,7 @@ void TIA::set_player_delay(int player, bool delay)
|
||||
|
||||
void TIA::set_player_position(int player)
|
||||
{
|
||||
// TODO
|
||||
player_[player].position = ((horizontal_counter_ - 68) + 6)%160;
|
||||
}
|
||||
|
||||
void TIA::set_player_motion(int player, uint8_t motion)
|
||||
@ -267,15 +267,6 @@ void TIA::clear_collision_flags()
|
||||
{
|
||||
}
|
||||
|
||||
// case 0: case 1: case 2: case 3: state = OutputState::Blank; break;
|
||||
// case 4: case 5: case 6: case 7: state = OutputState::Sync; break;
|
||||
// case 8: case 9: case 10: case 11: state = OutputState::ColourBurst; break;
|
||||
// case 12: case 13: case 14:
|
||||
// case 15: case 16: state = OutputState::Blank; break;
|
||||
//
|
||||
// case 17: case 18: state = vbextend ? OutputState::Blank : OutputState::Pixel; break;
|
||||
// default: state = OutputState::Pixel; break;
|
||||
|
||||
void TIA::output_for_cycles(int number_of_cycles)
|
||||
{
|
||||
/*
|
||||
@ -284,7 +275,7 @@ void TIA::output_for_cycles(int number_of_cycles)
|
||||
NTSC colour clock.
|
||||
|
||||
Therefore, each line is composed of:
|
||||
|
||||
|
||||
16 cycles: blank ; -> 16
|
||||
16 cycles: sync ; -> 32
|
||||
16 cycles: colour burst ; -> 48
|
||||
@ -301,7 +292,7 @@ void TIA::output_for_cycles(int number_of_cycles)
|
||||
if(horizontal_counter_ <= target) \
|
||||
{ \
|
||||
crt_->function((unsigned int)((horizontal_counter_ - output_cursor) * 2)); \
|
||||
output_cursor = horizontal_counter_; \
|
||||
horizontal_counter_ %= cycles_per_line; \
|
||||
return; \
|
||||
} \
|
||||
else \
|
||||
@ -337,7 +328,6 @@ void TIA::output_for_cycles(int number_of_cycles)
|
||||
}
|
||||
int duration = std::min(228, horizontal_counter_) - output_cursor;
|
||||
crt_->output_blank((unsigned int)(duration * 2));
|
||||
output_cursor += duration;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -68,8 +68,12 @@ class TIA {
|
||||
std::shared_ptr<Outputs::CRT::CRT> crt_;
|
||||
|
||||
// drawing methods
|
||||
void output_for_cycles(int number_of_cycles);
|
||||
void output_line();
|
||||
inline void output_for_cycles(int number_of_cycles);
|
||||
inline void output_line();
|
||||
|
||||
inline void draw_background(uint8_t *target, int start, int length);
|
||||
inline void draw_playfield(uint8_t *target, int start, int length);
|
||||
inline void draw_background_and_playfield(uint8_t *target, int start, int length);
|
||||
|
||||
// the master counter; counts from 0 to 228 with all visible pixels being in the final 160
|
||||
int horizontal_counter_;
|
||||
@ -84,8 +88,14 @@ class TIA {
|
||||
// playfield state
|
||||
uint8_t playfield_ball_colour_;
|
||||
uint8_t background_colour_;
|
||||
uint32_t background_[2];
|
||||
int background_half_mask_;
|
||||
uint32_t background_[2]; // contains two 20-bit bitfields representing the background state;
|
||||
// at index 0 is the left-hand side of the playfield with bit 0 being
|
||||
// the first bit to display, bit 1 the second, etc. Index 1 contains
|
||||
// a mirror image of index 0. If the playfield is being displayed in
|
||||
// mirroring mode, background_[0] will be output on the left and
|
||||
// background_[1] on the right; otherwise background_[0] will be
|
||||
// output twice.
|
||||
|
||||
// player state
|
||||
struct Player {
|
||||
@ -95,6 +105,8 @@ class TIA {
|
||||
uint8_t colour; // the player colour
|
||||
int reverse_mask; // 7 for a reflected player, 0 for normal
|
||||
uint8_t motion; // low four bits used
|
||||
uint8_t position; // in the range [0, 160) to indicate offset from the left margin, i.e. phase difference
|
||||
// between the player counter and the background pixel counter.
|
||||
} player_[2];
|
||||
|
||||
// missile state
|
||||
|
Loading…
x
Reference in New Issue
Block a user