1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-07-17 13:29:02 +00:00

Merge pull request #61 from TomHarte/TapImprovements

Makes an attempt to improve the handling of Oric TAPs
This commit is contained in:
Thomas Harte 2016-10-25 18:23:30 -04:00 committed by GitHub
commit cb1b81dbef
7 changed files with 29 additions and 24 deletions

View File

@ -116,7 +116,7 @@ void VideoOutput::run_for_cycles(int number_of_cycles)
} }
uint8_t inverse_mask = (control_byte & 0x80) ? 0x77 : 0x00; uint8_t inverse_mask = (control_byte & 0x80) ? 0x77 : 0x00;
if(_blink_text) inverse_mask ^= (_frame_counter&32) ? 0x77 : 0x00; if(_blink_text && (_frame_counter&32)) pixels = 0;
if(control_byte & 0x60) if(control_byte & 0x60)
{ {

View File

@ -12,12 +12,10 @@
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/> <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/> <customObject id="-3" userLabel="Application" customClass="NSObject"/>
<window title="Options" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" hidesOnDeactivate="YES" oneShot="NO" releasedWhenClosed="NO" showsToolbarButton="NO" visibleAtLaunch="NO" frameAutosaveName="" animationBehavior="default" id="gsl-7V-TTU" customClass="Atari2600OptionsPanel" customModule="Clock_Signal" customModuleProvider="target"> <window title="Options" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" hidesOnDeactivate="YES" oneShot="NO" releasedWhenClosed="NO" showsToolbarButton="NO" visibleAtLaunch="NO" frameAutosaveName="" animationBehavior="default" id="gsl-7V-TTU" customClass="Atari2600OptionsPanel" customModule="Clock_Signal" customModuleProvider="target">
<windowStyleMask key="styleMask" titled="YES" closable="YES" utility="YES" nonactivatingPanel="YES" HUD="YES"/> <windowStyleMask key="styleMask" titled="YES" closable="YES" utility="YES" documentModal="YES" nonactivatingPanel="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/> <windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="83" y="102" width="200" height="121"/> <rect key="contentRect" x="83" y="102" width="200" height="121"/>
<rect key="screenRect" x="0.0" y="0.0" width="1366" height="768"/> <rect key="screenRect" x="0.0" y="0.0" width="1366" height="768"/>
<value key="minSize" type="size" width="200" height="121"/>
<value key="maxSize" type="size" width="200" height="121"/>
<view key="contentView" id="aQh-Pm-DEo"> <view key="contentView" id="aQh-Pm-DEo">
<rect key="frame" x="0.0" y="0.0" width="200" height="121"/> <rect key="frame" x="0.0" y="0.0" width="200" height="121"/>
<autoresizingMask key="autoresizingMask"/> <autoresizingMask key="autoresizingMask"/>

View File

@ -16,8 +16,6 @@
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/> <windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="83" y="102" width="200" height="83"/> <rect key="contentRect" x="83" y="102" width="200" height="83"/>
<rect key="screenRect" x="0.0" y="0.0" width="1366" height="768"/> <rect key="screenRect" x="0.0" y="0.0" width="1366" height="768"/>
<value key="minSize" type="size" width="200" height="83"/>
<value key="maxSize" type="size" width="200" height="83"/>
<view key="contentView" id="tpZ-0B-QQu"> <view key="contentView" id="tpZ-0B-QQu">
<rect key="frame" x="0.0" y="0.0" width="200" height="83"/> <rect key="frame" x="0.0" y="0.0" width="200" height="83"/>
<autoresizingMask key="autoresizingMask"/> <autoresizingMask key="autoresizingMask"/>

View File

@ -36,6 +36,7 @@
</view> </view>
<connections> <connections>
<outlet property="delegate" destination="-2" id="0bl-1N-x8E"/> <outlet property="delegate" destination="-2" id="0bl-1N-x8E"/>
<outlet property="initialFirstResponder" destination="DEG-fq-cjd" id="9RI-Kx-QeN"/>
</connections> </connections>
</window> </window>
</objects> </objects>

View File

@ -67,6 +67,9 @@ class MachineDocument:
setupClockRate() setupClockRate()
self.machine.delegate = self self.machine.delegate = self
self.optionsPanel?.establishStoredOptions() self.optionsPanel?.establishStoredOptions()
// bring OpenGL view-holding window on top of the options panel
self.openGLView.window!.makeKeyAndOrderFront(self)
} }
func machineDidChangeClockRate(_ machine: CSMachine!) { func machineDidChangeClockRate(_ machine: CSMachine!) {

View File

@ -42,7 +42,7 @@ OricTAP::~OricTAP()
void OricTAP::virtual_reset() void OricTAP::virtual_reset()
{ {
// fseek(_file, 0, SEEK_SET); fseek(_file, 0, SEEK_SET);
_bit_count = 13; _bit_count = 13;
_phase = _next_phase = LeadIn; _phase = _next_phase = LeadIn;
_phase_counter = 0; _phase_counter = 0;
@ -69,6 +69,10 @@ Tape::Pulse OricTAP::virtual_get_next_pulse()
_phase_counter++; _phase_counter++;
if(_phase_counter == 259) // 256 artificial bytes plus the three in the file = 259 if(_phase_counter == 259) // 256 artificial bytes plus the three in the file = 259
{ {
while(1)
{
if(fgetc(_file) != 0x16) break;
}
_next_phase = Header; _next_phase = Header;
} }
break; break;
@ -106,20 +110,18 @@ Tape::Pulse OricTAP::virtual_get_next_pulse()
case Data: case Data:
next_byte = (uint8_t)fgetc(_file); next_byte = (uint8_t)fgetc(_file);
if(feof(_file)) _phase = End; _phase_counter++;
// _phase_counter++; if(_phase_counter >= (_data_end_address - _data_start_address)+1)
// if(_phase_counter == (_data_end_address - _data_start_address)+1) {
// { if(next_byte == 0x16)
// _phase_counter = 0; {
// if((size_t)ftell(_file) == _file_length) _next_phase = LeadIn;
// { }
// _next_phase = End; else if(feof(_file))
// } {
// else _next_phase = End;
// { }
// _next_phase = LeadIn; }
// }
// }
break; break;
case End: case End:
@ -148,8 +150,10 @@ Tape::Pulse OricTAP::virtual_get_next_pulse()
return pulse; return pulse;
case Gap: case Gap:
next_bit = 1; _bit_count = 13;
break; pulse.type = Pulse::Zero;
pulse.length.length = 100;
return pulse;
default: default:
next_bit = _current_value & 1; next_bit = _current_value & 1;

View File

@ -42,14 +42,15 @@ class OricTAP: public Tape {
FILE *_file; FILE *_file;
size_t _file_length; size_t _file_length;
// byte serialisation and output
uint16_t _current_value; uint16_t _current_value;
int _bit_count; int _bit_count;
int _pulse_counter; int _pulse_counter;
int _phase_counter;
enum Phase { enum Phase {
LeadIn, Header, Data, Gap, End LeadIn, Header, Data, Gap, End
} _phase, _next_phase; } _phase, _next_phase;
int _phase_counter;
uint16_t _data_end_address, _data_start_address; uint16_t _data_end_address, _data_start_address;
}; };