mirror of
https://github.com/TomHarte/CLK.git
synced 2024-12-25 03:32:01 +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;
|
||||||
|
|
||||||
@ -80,9 +79,9 @@ void Machine::get_output_pixel(uint8_t *pixel, int offset)
|
|||||||
{
|
{
|
||||||
case 0: break;
|
case 0: break;
|
||||||
default:
|
default:
|
||||||
if (repeatMask&4 && relativeTimer >= 64) relativeTimer -= 64;
|
if(repeatMask&4 && relativeTimer >= 64) relativeTimer -= 64;
|
||||||
else if (repeatMask&2 && relativeTimer >= 32) relativeTimer -= 32;
|
else if(repeatMask&2 && relativeTimer >= 32) relativeTimer -= 32;
|
||||||
else if (repeatMask&1 && relativeTimer >= 16) relativeTimer -= 16;
|
else if(repeatMask&1 && relativeTimer >= 16) relativeTimer -= 16;
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
relativeTimer >>= 1;
|
relativeTimer >>= 1;
|
||||||
@ -97,16 +96,15 @@ 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)
|
||||||
{
|
{
|
||||||
case 0: break;
|
case 0: break;
|
||||||
default:
|
default:
|
||||||
if (repeatMask&4 && missileIndex >= 64) missileIndex -= 64;
|
if(repeatMask&4 && missileIndex >= 64) missileIndex -= 64;
|
||||||
else if (repeatMask&2 && missileIndex >= 32) missileIndex -= 32;
|
else if(repeatMask&2 && missileIndex >= 32) missileIndex -= 32;
|
||||||
else if (repeatMask&1 && missileIndex >= 16) missileIndex -= 16;
|
else if(repeatMask&1 && missileIndex >= 16) missileIndex -= 16;
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
missileIndex >>= 1;
|
missileIndex >>= 1;
|
||||||
@ -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);
|
||||||
|
|
||||||
@ -157,8 +152,8 @@ void Machine::get_output_pixel(uint8_t *pixel, int offset)
|
|||||||
uint8_t outputColour = playfieldPixel ? playfieldColour : _backgroundColour;
|
uint8_t outputColour = playfieldPixel ? playfieldColour : _backgroundColour;
|
||||||
|
|
||||||
if(!(_playfieldControl&0x04) || !playfieldPixel) {
|
if(!(_playfieldControl&0x04) || !playfieldPixel) {
|
||||||
if (playerPixels[1] || missilePixels[1]) outputColour = _playerColour[1];
|
if(playerPixels[1] || missilePixels[1]) outputColour = _playerColour[1];
|
||||||
if (playerPixels[0] || missilePixels[0]) outputColour = _playerColour[0];
|
if(playerPixels[0] || missilePixels[0]) outputColour = _playerColour[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
// map that colour to separate Y and phase components
|
// map that colour to separate Y and phase components
|
||||||
@ -180,13 +175,13 @@ void Machine::output_pixels(unsigned int count)
|
|||||||
OutputState state;
|
OutputState state;
|
||||||
|
|
||||||
// update hmove
|
// update hmove
|
||||||
if (!(_horizontalTimer&3)) {
|
if(!(_horizontalTimer&3)) {
|
||||||
|
|
||||||
if(_hMoveFlags) {
|
if(_hMoveFlags) {
|
||||||
const uint8_t counterValue = _hMoveCounter ^ 0x7;
|
const uint8_t counterValue = _hMoveCounter ^ 0x7;
|
||||||
for(int c = 0; c < 5; c++) {
|
for(int c = 0; c < 5; c++) {
|
||||||
if (counterValue == (_objectMotion[c] >> 4)) _hMoveFlags &= ~(1 << c);
|
if(counterValue == (_objectMotion[c] >> 4)) _hMoveFlags &= ~(1 << c);
|
||||||
if (_hMoveFlags&(1 << c)) increment_object_counter(c);
|
if(_hMoveFlags&(1 << c)) increment_object_counter(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -206,15 +201,15 @@ void Machine::output_pixels(unsigned int count)
|
|||||||
|
|
||||||
// it'll be about 43 cycles from start of hsync to start of visible frame, so...
|
// it'll be about 43 cycles from start of hsync to start of visible frame, so...
|
||||||
// guesses, until I can find information: 26 cycles blank, 16 sync, 40 blank, 160 pixels
|
// guesses, until I can find information: 26 cycles blank, 16 sync, 40 blank, 160 pixels
|
||||||
if (_horizontalTimer < (_vBlankExtend ? 152 : 160)) {
|
if(_horizontalTimer < (_vBlankExtend ? 152 : 160)) {
|
||||||
if(_vBlankEnabled) {
|
if(_vBlankEnabled) {
|
||||||
state = OutputState::Blank;
|
state = OutputState::Blank;
|
||||||
} else {
|
} else {
|
||||||
state = OutputState::Pixel;
|
state = OutputState::Pixel;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (_horizontalTimer < end_of_sync) state = OutputState::Blank;
|
else if(_horizontalTimer < end_of_sync) state = OutputState::Blank;
|
||||||
else if (_horizontalTimer < start_of_sync) state = OutputState::Sync;
|
else if(_horizontalTimer < start_of_sync) state = OutputState::Sync;
|
||||||
else state = OutputState::Blank;
|
else state = OutputState::Blank;
|
||||||
|
|
||||||
// logic: if vsync is enabled, output the opposite of the automatic hsync output
|
// logic: if vsync is enabled, output the opposite of the automatic hsync output
|
||||||
@ -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);
|
||||||
|
|
||||||
@ -318,13 +309,12 @@ unsigned int Machine::perform_bus_operation(CPU6502::BusOperation operation, uin
|
|||||||
}
|
}
|
||||||
|
|
||||||
// check for a ROM read
|
// check for a ROM read
|
||||||
if ((address&0x1000) && isReadOperation(operation)) {
|
if((address&0x1000) && isReadOperation(operation)) {
|
||||||
returnValue &= _romPages[(address >> 10)&3][address&1023];
|
returnValue &= _romPages[(address >> 10)&3][address&1023];
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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 {
|
||||||
@ -333,7 +323,7 @@ unsigned int Machine::perform_bus_operation(CPU6502::BusOperation operation, uin
|
|||||||
}
|
}
|
||||||
|
|
||||||
// check for a TIA access
|
// check for a TIA access
|
||||||
if (!(address&0x1080)) {
|
if(!(address&0x1080)) {
|
||||||
if(isReadOperation(operation)) {
|
if(isReadOperation(operation)) {
|
||||||
const uint16_t decodedAddress = address & 0xf;
|
const uint16_t decodedAddress = address & 0xf;
|
||||||
switch(decodedAddress) {
|
switch(decodedAddress) {
|
||||||
@ -478,7 +468,7 @@ unsigned int Machine::perform_bus_operation(CPU6502::BusOperation operation, uin
|
|||||||
|
|
||||||
case 0x28:
|
case 0x28:
|
||||||
case 0x29:
|
case 0x29:
|
||||||
if (!(*value&0x02) && _missileGraphicsReset[decodedAddress - 0x28]&0x02)
|
if(!(*value&0x02) && _missileGraphicsReset[decodedAddress - 0x28]&0x02)
|
||||||
_objectCounter[decodedAddress - 0x26] = _objectCounter[decodedAddress - 0x28]; // TODO: +3 for normal, +6 for double, +10 for quad
|
_objectCounter[decodedAddress - 0x26] = _objectCounter[decodedAddress - 0x28]; // TODO: +3 for normal, +6 for double, +10 for quad
|
||||||
_missileGraphicsReset[decodedAddress - 0x28] = *value;
|
_missileGraphicsReset[decodedAddress - 0x28] = *value;
|
||||||
break;
|
break;
|
||||||
@ -505,7 +495,7 @@ unsigned int Machine::perform_bus_operation(CPU6502::BusOperation operation, uin
|
|||||||
}
|
}
|
||||||
|
|
||||||
// check for a PIA access
|
// check for a PIA access
|
||||||
if ((address&0x1280) == 0x280) {
|
if((address&0x1280) == 0x280) {
|
||||||
if(isReadOperation(operation)) {
|
if(isReadOperation(operation)) {
|
||||||
const uint8_t decodedAddress = address & 0xf;
|
const uint8_t decodedAddress = address & 0xf;
|
||||||
switch(address & 0xf) {
|
switch(address & 0xf) {
|
||||||
|
@ -399,7 +399,7 @@ unsigned int Machine::perform_bus_operation(CPU6502::BusOperation operation, uin
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
// const int end_of_field =
|
// const int end_of_field =
|
||||||
// if (_frameCycles < (256 + first_graphics_line) << 7))
|
// if(_frameCycles < (256 + first_graphics_line) << 7))
|
||||||
|
|
||||||
const unsigned int pixel_line_clock = _frameCycles;// + 128 - first_graphics_cycle + 80;
|
const unsigned int pixel_line_clock = _frameCycles;// + 128 - first_graphics_cycle + 80;
|
||||||
const unsigned int line_before_cycle = graphics_line(pixel_line_clock);
|
const unsigned int line_before_cycle = graphics_line(pixel_line_clock);
|
||||||
|
@ -28,7 +28,7 @@ struct SpeakerDelegate: public Outputs::Speaker::Delegate {
|
|||||||
- (instancetype)init {
|
- (instancetype)init {
|
||||||
self = [super init];
|
self = [super init];
|
||||||
|
|
||||||
if (self) {
|
if(self) {
|
||||||
_serialDispatchQueue = dispatch_queue_create("Machine queue", DISPATCH_QUEUE_SERIAL);
|
_serialDispatchQueue = dispatch_queue_create("Machine queue", DISPATCH_QUEUE_SERIAL);
|
||||||
_speakerDelegate.machine = self;
|
_speakerDelegate.machine = self;
|
||||||
[self setSpeakerDelegate:&_speakerDelegate sampleRate:44100];
|
[self setSpeakerDelegate:&_speakerDelegate sampleRate:44100];
|
||||||
|
@ -83,7 +83,7 @@ class MachineJamHandler: public CPU6502::AllRAMProcessor::JamHandler {
|
|||||||
- (instancetype)init {
|
- (instancetype)init {
|
||||||
self = [super init];
|
self = [super init];
|
||||||
|
|
||||||
if (self) {
|
if(self) {
|
||||||
_cppJamHandler = new MachineJamHandler(self);
|
_cppJamHandler = new MachineJamHandler(self);
|
||||||
_processor.set_jam_handler(_cppJamHandler);
|
_processor.set_jam_handler(_cppJamHandler);
|
||||||
}
|
}
|
||||||
|
@ -178,7 +178,7 @@ void CRT::advance_cycles(unsigned int number_of_cycles, unsigned int source_divi
|
|||||||
_openGL_output_builder->add_to_field_time(next_run_length);
|
_openGL_output_builder->add_to_field_time(next_run_length);
|
||||||
|
|
||||||
// either charge or deplete the vertical retrace capacitor (making sure it stops at 0)
|
// either charge or deplete the vertical retrace capacitor (making sure it stops at 0)
|
||||||
if (vsync_charging)
|
if(vsync_charging)
|
||||||
_sync_capacitor_charge_level += next_run_length;
|
_sync_capacitor_charge_level += next_run_length;
|
||||||
else
|
else
|
||||||
_sync_capacitor_charge_level = std::max(_sync_capacitor_charge_level - (int)next_run_length, 0);
|
_sync_capacitor_charge_level = std::max(_sync_capacitor_charge_level - (int)next_run_length, 0);
|
||||||
|
@ -67,7 +67,7 @@ Shader::Shader(const char *vertex_shader, const char *fragment_shader, const Att
|
|||||||
{
|
{
|
||||||
GLint logLength;
|
GLint logLength;
|
||||||
glGetProgramiv(_shader_program, GL_INFO_LOG_LENGTH, &logLength);
|
glGetProgramiv(_shader_program, GL_INFO_LOG_LENGTH, &logLength);
|
||||||
if (logLength > 0) {
|
if(logLength > 0) {
|
||||||
GLchar *log = (GLchar *)malloc((size_t)logLength);
|
GLchar *log = (GLchar *)malloc((size_t)logLength);
|
||||||
glGetProgramInfoLog(_shader_program, logLength, &logLength, log);
|
glGetProgramInfoLog(_shader_program, logLength, &logLength, log);
|
||||||
printf("Link log:\n%s\n", log);
|
printf("Link log:\n%s\n", log);
|
||||||
|
@ -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\
|
||||||
@ -582,7 +581,7 @@ template <class T> class Processor {
|
|||||||
|
|
||||||
while (!_ready_is_active && number_of_cycles > 0) {
|
while (!_ready_is_active && number_of_cycles > 0) {
|
||||||
|
|
||||||
if (nextBusOperation != BusOperation::None) {
|
if(nextBusOperation != BusOperation::None) {
|
||||||
_irq_request_history[0] = _irq_request_history[1];
|
_irq_request_history[0] = _irq_request_history[1];
|
||||||
_irq_request_history[1] = _irq_line_is_enabled && !_interruptFlag;
|
_irq_request_history[1] = _irq_line_is_enabled && !_interruptFlag;
|
||||||
number_of_cycles -= static_cast<T *>(this)->perform_bus_operation(nextBusOperation, busAddress, busValue);
|
number_of_cycles -= static_cast<T *>(this)->perform_bus_operation(nextBusOperation, busAddress, busValue);
|
||||||
@ -682,7 +681,7 @@ template <class T> class Processor {
|
|||||||
static const MicroOp jam[] = JAM;
|
static const MicroOp jam[] = JAM;
|
||||||
schedule_program(jam);
|
schedule_program(jam);
|
||||||
|
|
||||||
if (_jam_handler) {
|
if(_jam_handler) {
|
||||||
_jam_handler->processor_did_jam(this, _pc.full - 1);
|
_jam_handler->processor_did_jam(this, _pc.full - 1);
|
||||||
checkSchedule(_is_jammed = false);
|
checkSchedule(_is_jammed = false);
|
||||||
}
|
}
|
||||||
@ -899,7 +898,7 @@ template <class T> class Processor {
|
|||||||
case CycleAddXToAddressLow:
|
case CycleAddXToAddressLow:
|
||||||
nextAddress.full = _address.full + _x;
|
nextAddress.full = _address.full + _x;
|
||||||
_address.bytes.low = nextAddress.bytes.low;
|
_address.bytes.low = nextAddress.bytes.low;
|
||||||
if (_address.bytes.high != nextAddress.bytes.high) {
|
if(_address.bytes.high != nextAddress.bytes.high) {
|
||||||
throwaway_read(_address.full);
|
throwaway_read(_address.full);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -911,7 +910,7 @@ template <class T> class Processor {
|
|||||||
case CycleAddYToAddressLow:
|
case CycleAddYToAddressLow:
|
||||||
nextAddress.full = _address.full + _y;
|
nextAddress.full = _address.full + _y;
|
||||||
_address.bytes.low = nextAddress.bytes.low;
|
_address.bytes.low = nextAddress.bytes.low;
|
||||||
if (_address.bytes.high != nextAddress.bytes.high) {
|
if(_address.bytes.high != nextAddress.bytes.high) {
|
||||||
throwaway_read(_address.full);
|
throwaway_read(_address.full);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -1020,11 +1019,10 @@ template <class T> class Processor {
|
|||||||
_zeroResult = _negativeResult = _a;
|
_zeroResult = _negativeResult = _a;
|
||||||
_overflowFlag = (_a^(_a << 1))&Flag::Overflow;
|
_overflowFlag = (_a^(_a << 1))&Flag::Overflow;
|
||||||
|
|
||||||
if ((unshiftedA&0xf) + (unshiftedA&0x1) > 5) _a = ((_a + 6)&0xf) | (_a & 0xf0);
|
if((unshiftedA&0xf) + (unshiftedA&0x1) > 5) _a = ((_a + 6)&0xf) | (_a & 0xf0);
|
||||||
|
|
||||||
_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));
|
||||||
@ -1043,7 +1041,7 @@ template <class T> class Processor {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isReadOperation(nextBusOperation) && _ready_line_is_enabled) {
|
if(isReadOperation(nextBusOperation) && _ready_line_is_enabled) {
|
||||||
_ready_is_active = true;
|
_ready_is_active = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -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…
Reference in New Issue
Block a user