mirror of
https://github.com/TomHarte/CLK.git
synced 2025-01-12 00:30:31 +00:00
Attempted to normalise some style decisions.`
This commit is contained in:
parent
7a8d100861
commit
9b64f64db7
@ -37,7 +37,7 @@ void Machine::setup_output(float aspect_ratio)
|
|||||||
"vec2 c = vec2(texture(texID, coordinate).rg) / vec2(255.0);"
|
"vec2 c = vec2(texture(texID, coordinate).rg) / vec2(255.0);"
|
||||||
"float y = 0.1 + c.x * 0.91071428571429;"
|
"float y = 0.1 + c.x * 0.91071428571429;"
|
||||||
"float aOffset = 6.283185308 * (2.0/16.0 - c.y);" // - 3.0 / 16.0
|
"float aOffset = 6.283185308 * (2.0/16.0 - c.y);" // - 3.0 / 16.0
|
||||||
"return y + step(0.03125, c.y) * 0.1 * cos(phase - aOffset);"
|
"return y + step(0.03125, c.y) * amplitude * cos(phase - aOffset);"
|
||||||
"}");
|
"}");
|
||||||
_crt->set_output_device(Outputs::CRT::Television);
|
_crt->set_output_device(Outputs::CRT::Television);
|
||||||
}
|
}
|
||||||
@ -70,8 +70,7 @@ void Machine::get_output_pixel(uint8_t *pixel, int offset)
|
|||||||
for(int c = 0; c < 2; c++)
|
for(int c = 0; c < 2; c++)
|
||||||
{
|
{
|
||||||
const uint8_t repeatMask = _playerAndMissileSize[c]&7;
|
const uint8_t repeatMask = _playerAndMissileSize[c]&7;
|
||||||
if(_playerGraphics[c])
|
if(_playerGraphics[c]) {
|
||||||
{
|
|
||||||
// figure out player colour
|
// figure out player colour
|
||||||
int flipMask = (_playerReflection[c]&0x8) ? 0 : 7;
|
int flipMask = (_playerReflection[c]&0x8) ? 0 : 7;
|
||||||
|
|
||||||
@ -97,8 +96,7 @@ void Machine::get_output_pixel(uint8_t *pixel, int offset)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// figure out missile colour
|
// figure out missile colour
|
||||||
if((_missileGraphicsEnable[c]&2) && !(_missileGraphicsReset[c]&2))
|
if((_missileGraphicsEnable[c]&2) && !(_missileGraphicsReset[c]&2)) {
|
||||||
{
|
|
||||||
int missileIndex = _objectCounter[2+c] - 4;
|
int missileIndex = _objectCounter[2+c] - 4;
|
||||||
switch (repeatMask)
|
switch (repeatMask)
|
||||||
{
|
{
|
||||||
@ -122,16 +120,14 @@ void Machine::get_output_pixel(uint8_t *pixel, int offset)
|
|||||||
|
|
||||||
// get the ball proposed colour
|
// get the ball proposed colour
|
||||||
uint8_t ballPixel = 0;
|
uint8_t ballPixel = 0;
|
||||||
if(_ballGraphicsEnable&2)
|
if(_ballGraphicsEnable&2) {
|
||||||
{
|
|
||||||
int ballIndex = _objectCounter[4] - 4;
|
int ballIndex = _objectCounter[4] - 4;
|
||||||
int ballSize = 1 << ((_playfieldControl >> 4)&3);
|
int ballSize = 1 << ((_playfieldControl >> 4)&3);
|
||||||
ballPixel = (ballIndex >= 0 && ballIndex < ballSize) ? 1 : 0;
|
ballPixel = (ballIndex >= 0 && ballIndex < ballSize) ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// accumulate collisions
|
// accumulate collisions
|
||||||
if(playerPixels[0] | playerPixels[1])
|
if(playerPixels[0] | playerPixels[1]) {
|
||||||
{
|
|
||||||
_collisions[0] |= ((missilePixels[0] & playerPixels[1]) << 7) | ((missilePixels[0] & playerPixels[0]) << 6);
|
_collisions[0] |= ((missilePixels[0] & playerPixels[1]) << 7) | ((missilePixels[0] & playerPixels[0]) << 6);
|
||||||
_collisions[1] |= ((missilePixels[1] & playerPixels[0]) << 7) | ((missilePixels[1] & playerPixels[1]) << 6);
|
_collisions[1] |= ((missilePixels[1] & playerPixels[0]) << 7) | ((missilePixels[1] & playerPixels[1]) << 6);
|
||||||
|
|
||||||
@ -141,8 +137,7 @@ void Machine::get_output_pixel(uint8_t *pixel, int offset)
|
|||||||
_collisions[7] |= ((playerPixels[0] & playerPixels[1]) << 7);
|
_collisions[7] |= ((playerPixels[0] & playerPixels[1]) << 7);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(playfieldPixel | ballPixel)
|
if(playfieldPixel | ballPixel) {
|
||||||
{
|
|
||||||
_collisions[4] |= ((playfieldPixel & missilePixels[0]) << 7) | ((ballPixel & missilePixels[0]) << 6);
|
_collisions[4] |= ((playfieldPixel & missilePixels[0]) << 7) | ((ballPixel & missilePixels[0]) << 6);
|
||||||
_collisions[5] |= ((playfieldPixel & missilePixels[1]) << 7) | ((ballPixel & missilePixels[1]) << 6);
|
_collisions[5] |= ((playfieldPixel & missilePixels[1]) << 7) | ((ballPixel & missilePixels[1]) << 6);
|
||||||
|
|
||||||
@ -223,10 +218,8 @@ void Machine::output_pixels(unsigned int count)
|
|||||||
}
|
}
|
||||||
|
|
||||||
_lastOutputStateDuration++;
|
_lastOutputStateDuration++;
|
||||||
if(state != _lastOutputState)
|
if(state != _lastOutputState) {
|
||||||
{
|
switch(_lastOutputState) {
|
||||||
switch(_lastOutputState)
|
|
||||||
{
|
|
||||||
case OutputState::Blank: _crt->output_blank(_lastOutputStateDuration); break;
|
case OutputState::Blank: _crt->output_blank(_lastOutputStateDuration); break;
|
||||||
case OutputState::Sync: _crt->output_sync(_lastOutputStateDuration); break;
|
case OutputState::Sync: _crt->output_sync(_lastOutputStateDuration); break;
|
||||||
case OutputState::Pixel: _crt->output_data(_lastOutputStateDuration, 1); break;
|
case OutputState::Pixel: _crt->output_data(_lastOutputStateDuration, 1); break;
|
||||||
@ -234,16 +227,14 @@ void Machine::output_pixels(unsigned int count)
|
|||||||
_lastOutputStateDuration = 0;
|
_lastOutputStateDuration = 0;
|
||||||
_lastOutputState = state;
|
_lastOutputState = state;
|
||||||
|
|
||||||
if(state == OutputState::Pixel)
|
if(state == OutputState::Pixel) {
|
||||||
{
|
|
||||||
_outputBuffer = _crt->allocate_write_area(160);
|
_outputBuffer = _crt->allocate_write_area(160);
|
||||||
} else {
|
} else {
|
||||||
_outputBuffer = nullptr;
|
_outputBuffer = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(_horizontalTimer < (_vBlankExtend ? 152 : 160))
|
if(_horizontalTimer < (_vBlankExtend ? 152 : 160)) {
|
||||||
{
|
|
||||||
if(_outputBuffer)
|
if(_outputBuffer)
|
||||||
get_output_pixel(&_outputBuffer[_lastOutputStateDuration << 1], 159 - _horizontalTimer);
|
get_output_pixel(&_outputBuffer[_lastOutputStateDuration << 1], 159 - _horizontalTimer);
|
||||||
|
|
||||||
@ -324,7 +315,6 @@ unsigned int Machine::perform_bus_operation(CPU6502::BusOperation operation, uin
|
|||||||
|
|
||||||
// check for a RAM access
|
// check for a RAM access
|
||||||
if((address&0x1280) == 0x80) {
|
if((address&0x1280) == 0x80) {
|
||||||
|
|
||||||
if(isReadOperation(operation)) {
|
if(isReadOperation(operation)) {
|
||||||
returnValue &= _ram[address&0x7f];
|
returnValue &= _ram[address&0x7f];
|
||||||
} else {
|
} else {
|
||||||
|
@ -558,10 +558,9 @@ template <class T> class Processor {
|
|||||||
#define checkSchedule(op) \
|
#define checkSchedule(op) \
|
||||||
if(!_scheduledPrograms[scheduleProgramsReadPointer]) {\
|
if(!_scheduledPrograms[scheduleProgramsReadPointer]) {\
|
||||||
scheduleProgramsReadPointer = _scheduleProgramsWritePointer = scheduleProgramProgramCounter = 0;\
|
scheduleProgramsReadPointer = _scheduleProgramsWritePointer = scheduleProgramProgramCounter = 0;\
|
||||||
if(_reset_line_is_enabled)\
|
if(_reset_line_is_enabled) {\
|
||||||
schedule_program(get_reset_program());\
|
schedule_program(get_reset_program());\
|
||||||
else\
|
} else {\
|
||||||
{\
|
|
||||||
if(_irq_request_history[0])\
|
if(_irq_request_history[0])\
|
||||||
schedule_program(get_irq_program());\
|
schedule_program(get_irq_program());\
|
||||||
else\
|
else\
|
||||||
@ -1024,7 +1023,6 @@ template <class T> class Processor {
|
|||||||
|
|
||||||
_carryFlag = ((unshiftedA&0xf0) + (unshiftedA&0x10) > 0x50) ? 1 : 0;
|
_carryFlag = ((unshiftedA&0xf0) + (unshiftedA&0x10) > 0x50) ? 1 : 0;
|
||||||
if(_carryFlag) _a += 0x60;
|
if(_carryFlag) _a += 0x60;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
_a &= _operand;
|
_a &= _operand;
|
||||||
_a = (uint8_t)((_a >> 1) | (_carryFlag << 7));
|
_a = (uint8_t)((_a >> 1) | (_carryFlag << 7));
|
||||||
@ -1126,10 +1124,9 @@ template <class T> class Processor {
|
|||||||
*/
|
*/
|
||||||
inline void set_ready_line(bool active)
|
inline void set_ready_line(bool active)
|
||||||
{
|
{
|
||||||
if(active)
|
if(active) {
|
||||||
_ready_line_is_enabled = true;
|
_ready_line_is_enabled = true;
|
||||||
else
|
} else {
|
||||||
{
|
|
||||||
_ready_line_is_enabled = false;
|
_ready_line_is_enabled = false;
|
||||||
_ready_is_active = false;
|
_ready_is_active = false;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user