1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-15 12:08:33 +00:00
Commit Graph

1485 Commits

Author SHA1 Message Date
Thomas Harte
3b71d1a309 Switched to a variable-length buffer based on attempting to hit approximately a certain quality of service. 2016-06-16 21:35:22 -04:00
Thomas Harte
2ee78d42b9 Made an attempt also to trigger updates upon audio packets being returned, and significantly to reduce the size and quantity of those. This should get down to 11ms latency if the output wave is 44100; I might need to scale up the buffer size as the sampling rate increases or this is going to get crazy at 192Khz. 2016-06-16 20:51:35 -04:00
Thomas Harte
00a9f1bf24 Fixed best-effort updater actually to run, finally moved clock rate announcement into the C++ side of things, started working on a mechanism to allow clock rate to be updated. 2016-06-16 20:39:46 -04:00
Thomas Harte
1921a6c469 Rewired the existing cause-an-update route from the OpenGLView through the best-effort updater. 2016-06-16 18:19:23 -04:00
Thomas Harte
530cf3dcbb Made an attempt to consolidate serialisation and clock rate adherence, allowing a floating-point clock rate. 2016-06-16 18:04:54 -04:00
Thomas Harte
ce59ad1911 Minor on-disk shuffle, to try to clarify ownership of responsibility. 2016-06-15 08:11:30 -04:00
Thomas Harte
45999f5b26 This should be strong. 2016-06-15 08:07:59 -04:00
Thomas Harte
e0baaf17f1 Added class prefix. 2016-06-15 08:07:25 -04:00
Thomas Harte
695dd2e9e3 Started upon a delegate protocol for the AudioQueue, resolving my use of a deprecated API while I'm at it. 2016-06-15 07:35:34 -04:00
Thomas Harte
a9036e7aa4 Increased buffering range of audio as a quick fix for now. Basically means: increased latency as a short-term fix. 2016-06-14 07:31:47 -04:00
Thomas Harte
fcf4b14344 Extended to allow floating-point sampling rates. Which makes sense. 2016-06-13 19:30:41 -04:00
Thomas Harte
4fec625b19 Minor cleaning, implemented clearAllKeys. 2016-06-12 10:38:21 -04:00
Thomas Harte
ec604f1414 Expanded mapped keys just a tiny bit further. 2016-06-12 10:35:47 -04:00
Thomas Harte
167ed9b8bb Added enough to load a PRG as a ROM. 2016-06-11 14:00:12 -04:00
Thomas Harte
d9b001d3fc Minor clean-ups. 2016-06-11 13:51:04 -04:00
Thomas Harte
3e8d383615 Improved key map. Possibly enough to type some basic BASIC? 2016-06-11 13:19:59 -04:00
Thomas Harte
d1731b1d26 Hacked my 6522 to work. Mistake is in not returning output as input when appropriate — i.e. that I'm ignoring data direction. Also fixed K and L keys. 2016-06-11 13:06:01 -04:00
Thomas Harte
271de23ee6 Ran on in and introduced a bunch more keys, hopefully to help to diagnose. 2016-06-11 12:26:19 -04:00
Thomas Harte
d7c1f5b18a Made an attempt at hooking up the '2' and '4' keys. A mostly unsuccessful attempt. 2 does nothing, 4 clears the screen. 2016-06-11 11:50:37 -04:00
Thomas Harte
6522530e1c Actually, I'm dithering over whether the 6522 should be an ordinary class or a curiously-recurring template. But it'll need a file, definitely. 2016-06-06 21:56:02 -04:00
Thomas Harte
0b221e773f Fixed ROM naming and sizes, ensured machines without sound outputs don't end up with an audio queue. 2016-06-05 11:20:05 -04:00
Thomas Harte
f922d38ed2 The Vic now captures the ROMs sent to it and has just enough infrastructure to get to a black screen. Progress! 2016-06-05 10:51:07 -04:00
Thomas Harte
12243c40ad Kicking the ball a little further down the road, ROMs and PRGs now reach the actual emulated machine. 2016-06-05 09:06:59 -04:00
Thomas Harte
b29b2a5d08 Added forwarding of a loaded PRG from the Swift document to the wrapper. So I think that possibly completes the Swift side of things? 2016-06-05 09:01:32 -04:00
Thomas Harte
8052ce9223 System ROMs are now supplied to the Vic-20 wrapper, though they stop there. I also factored key forwarding out of the ElectronDocument and into the superclass, depending upon the child conforming to CSKeyboardMachine. 2016-06-05 08:53:05 -04:00
Thomas Harte
363e14a92f Reorganised system ROMs out of the Mac-specific folder, adjusted Mac code to expect to find them organised hierarchically (as how many os.roms am I going to have?) and added readme files to explain what's missing from the Git repository. 2016-06-05 08:33:01 -04:00
Thomas Harte
4c33517228 Added ROMs to the project and ensured they don't get uploaded. 2016-06-04 22:03:38 -04:00
Thomas Harte
b10a06e700 A CRT is still absent but this moves the ball back into the C++ side's court. 2016-06-04 22:00:50 -04:00
Thomas Harte
06e1db8c85 This now gets as far as missing selectors. 2016-06-04 21:49:03 -04:00
Thomas Harte
eff28e95a4 Added XIB file. 2016-06-04 21:45:39 -04:00
Thomas Harte
404873fe58 Started sketching out infrastructure for Vic-20 support. 2016-06-04 21:43:50 -04:00
Thomas Harte
d6e8cd676a Trimmed and reordered just a little. 2016-06-04 16:02:16 -04:00
Thomas Harte
68a8851c52 Increased parallelism, allowing a simplification in the GL view. 2016-06-02 22:29:09 -04:00
Thomas Harte
e3b95b8d2b Back to asynchronous updates and drawing, to try to improve guarantees on audio latency; experimenting with whether other parts of the approach are fundamentally flawed; added a broad-phase for scheduled updates on the 2600. 2016-06-02 21:22:55 -04:00
Thomas Harte
11073daee1 Issues appear to be around timing generally. Working on it. 2016-06-02 20:15:48 -04:00
Thomas Harte
253e5a4203 With no regard to performance whatsoever, endeavoured to bring sound to the 2600. It's very scratchy, so something is wrong. 2016-06-02 19:50:16 -04:00
Thomas Harte
8623dc2833 Consolidated a little more within the common code, adding sampling rate selection based on querying the machine. 2016-06-01 19:04:07 -04:00
Thomas Harte
50543e9676 Minor factoring up: the audio queue is now pushed universally by MachineDocument. 2016-05-31 22:36:53 -04:00
Thomas Harte
c773c3a66c Started trying to clean up and consolidate on the Swift side of things but time is up for the day. 2016-05-31 22:32:38 -04:00
Thomas Harte
8dc66167be Made an attempt to consolidate the Objective-C++ side of things based on the incoming CRTMachine::Machine. 2016-05-31 22:16:20 -04:00
Thomas Harte
5c4f35e13f Finally started on generalising the C++ stuff so as to be able to be able to get a working audio binding on the OS-specific side without further repetition by factoring an appropriate protocol out from the Electron and sketching out the correct speaker class for the Atari. Added a method to ask it what a good output frequency would be. 2016-05-31 21:23:44 -04:00
Thomas Harte
40600b4bcb Made sprite placement consistent at least. Not necessarily yet correct. 2016-05-18 22:07:24 -04:00
Thomas Harte
3765c5fbb5 Fixed error that would prevent an interrupting frame from ever being drawn. 2016-05-18 21:45:35 -04:00
Thomas Harte
ddfc9910e5 Sought to draw in a standard serial arrangement as and when bandwidth allows it. 2016-05-09 07:17:12 -04:00
Thomas Harte
1bb92550f8 It's 2016. 2016-05-02 22:02:06 -04:00
Thomas Harte
6982e945fb Fixed those issues breaking GL state, I hope. 2016-05-01 16:17:52 -04:00
Thomas Harte
8538b62ea2 Made an attempt to extract and consolidate the logic behind the intermediate shaders. 2016-04-28 21:04:59 -04:00
Thomas Harte
496d979aca Made a decision to clean up by creating per-shader classes. Well, more or less. First thing to be factored out: the output shader. 2016-04-27 22:29:54 -04:00
Thomas Harte
416c944f02 Experimental: let's try accumulating history directly in the framebuffer. 2016-04-26 21:41:39 -04:00
Thomas Harte
9b64f64db7 Attempted to normalise some style decisions.` 2016-04-24 22:32:24 -04:00
Thomas Harte
884755c560 Ensured the GL context is available when switching Atari 2600 output, and that it locks the output. 2016-04-24 20:56:21 -04:00
Thomas Harte
d221c712b0 Ensured GL context is active when destructing CRTOpenGL. 2016-04-24 20:34:25 -04:00
Thomas Harte
929cfc49cb Extended window for picking output frequency, attempted to consolidate CRT OpenGL timing uniforms for approprate resetting. 2016-04-24 18:58:31 -04:00
Thomas Harte
082003ed0a Reintroduced the CRT delegate and the 2600's automatic region switching. Albeit that the CRT itself doesn't adjust properly to new timings yet. 2016-04-24 18:36:22 -04:00
Thomas Harte
80a3169674 Started reviving the Atari 2600 emulation. Put new startup sequence into place. 2016-04-24 06:56:08 -04:00
Thomas Harte
9c89b668ae Made further attempts to improve synchronisation and interrelated timing between display and machine update. 2016-04-20 22:35:46 -04:00
Thomas Harte
7aa87723a9 Added: key states are all cleared if the window loses focus. Which resolves sticky key issues. Allowing me just to use command+option+O for options and map both command and option as FUNC. 2016-04-19 21:29:10 -04:00
Thomas Harte
d5bac2f04f Spotted error was in texture target all along. This now gets as far as showing something a lot like the correct display, but precision is way off. Way off. 2016-04-18 21:32:48 -04:00
Thomas Harte
86626bbd72 Switched key that maps to FUNC from command to option. Logic is that command may frequently be used for performing an action which changes the key window, in which case we won't realise if it is released. 2016-04-18 19:20:26 -04:00
Thomas Harte
f89308e913 Set the 'options' windows to hide on application deactivation so that they don't cluelessly sit on top of the rest of the system. 2016-04-18 19:14:58 -04:00
Thomas Harte
bf29c8e2bf Fixed mismatch in television/monitor selection, ticked view for drawing concurrently, since it can, removed stray space. 2016-04-18 19:01:15 -04:00
Thomas Harte
3d53f157de Output selection now takes effect. So I can stop accidentally committing changes back and forth. 2016-04-18 08:27:58 -04:00
Thomas Harte
94f148e212 Wired in options, at least getting as far as the Objective-C bridge. Then fast loading makes it to the emulated machine, display output type doesn't. 2016-04-18 08:21:00 -04:00
Thomas Harte
6158275ea7 Started adding an options panel. 2016-04-17 21:43:39 -04:00
Thomas Harte
499f7ace07 Re-enabled working video output for the Electron for the day and consolidated the rough metric I'm using to pick a number of taps for the audio filter. 2016-04-17 20:43:20 -04:00
Thomas Harte
104f44f27f Attempted to improve deinterlacing, gave the CRT full control over blend mode, switched back to 2000000Mhz audio. 2016-04-14 22:20:47 -04:00
Thomas Harte
2cc72169ff Ensured machines can nominate their own aspect ratio windows. Switched to 11/10 for the Electron. 2016-04-11 23:12:56 -04:00
Thomas Harte
7276a06cc0 Added a helper to calculate a visible rect based on output timings, used it to scale the Electron output up to the full window size. 2016-04-11 21:47:23 -04:00
Thomas Harte
e617bd2bb3 Turned audio quality up to the maximum, at least for now. 2016-04-06 21:12:22 -04:00
Thomas Harte
28e6517234 Switched away from tracking absolute time to tracking relative. 2016-04-06 20:46:00 -04:00
Thomas Harte
d4be4c4769 Of course, I want min. Not max. 2016-04-06 20:27:48 -04:00
Thomas Harte
fd1f6a7e1f Expanded on thinking. 2016-04-06 19:35:53 -04:00
Thomas Harte
e885438363 The penny has finally dropped that I can drive the CPU stuff in a manner completely decoupled from the GPU stuff. For much improved parallelisation. 2016-04-06 19:34:34 -04:00
Thomas Harte
4595741ab0 Made an attempt not to interrupt the display link queue too much when emulation is running slowly. 2016-04-04 20:22:33 -04:00
Thomas Harte
3038704977 Attempted to introduce a lowpass filter to the graphics output, reverted 6502 optimisations as seemingly not working. 2016-03-21 22:01:25 -04:00
Thomas Harte
5966ac845f Switched symbols and updated all-RAM 6502 in order to fix unit test target. 2016-03-20 22:48:56 -04:00
Thomas Harte
902017a962 Fixes: drop any processing backlog, try not to allow an Electron document to close mid-draw, perform a frame grab even if the emulated machine is over-processing, really really don't create a CRT until it's safe. 2016-03-20 18:42:37 -04:00
Thomas Harte
fb6fb5d948 Switched to two-phase setup to deal with OpenGL scheduling. 2016-03-20 13:50:13 -04:00
Thomas Harte
eabc382540 Fixed: of course I can't rely on the pointer to CVTimeStamp not becoming dangling during a queue jump. 2016-03-19 23:02:42 -04:00
Thomas Harte
4c5d66c317 Made sure GL context isn't activated until it's locked. 2016-03-19 22:54:56 -04:00
Thomas Harte
a546277f88 Added the simplest mechanism to decouple emulation from the display link queue. 2016-03-19 22:53:37 -04:00
Thomas Harte
9da7716c72 Attempted to simplify threading, thereby allowing machines to be constructed within a valid GL context, and started adding appropriate GL syncs. Which all oddly drops everything to a negligible FPS. Investigation will follow. 2016-03-19 22:46:17 -04:00
Thomas Harte
4ac1f959e9 A shortcut here and a shortcut there; this allows me at least to determine whether use of a PBO gains anything. 2016-03-19 17:07:05 -04:00
Thomas Harte
4cd0aa3416 Completed FIR filter based audio output. 2016-03-15 23:37:35 -04:00
Thomas Harte
7694297c83 Introduced an adapted version of the previous Clock Signal's FIR filter. 2016-03-15 21:05:20 -04:00
Thomas Harte
1c4acfb599 I think this is a prima facie acceptable implementation of the fast tape hack. 2016-03-13 17:39:53 -04:00
Thomas Harte
bb0cd89574 Got explicit about threading guarantees. 2016-03-13 13:38:03 -04:00
Thomas Harte
cfa616d593 Fixed: timing issue versus supplied test ROM was failure to include the Plus 1 ROM in the mix. 2016-03-12 11:51:20 -05:00
Thomas Harte
bf5747f83e Made an attempt to chop out all the stuff of building up the OpenGL data from the stuff of parsing input. 2016-03-08 22:40:23 -05:00
Thomas Harte
14b2927275 Made further attempts to tidy up; trying to demarcate between public interface and private. 2016-03-08 20:59:16 -05:00
Thomas Harte
1e5fe2b2c1 Made an attempt to reestablish the Atari 2600 output connection despite various changes (TODO: generalise that stuff), and to start creating the composite shader. 2016-03-07 21:04:04 -05:00
Thomas Harte
41c09f8c3f Renamed CSCathodeRayView to CSOpenGLView as it no longer has any CRT-related responsibilities. It just does the GL and manages a serial dispatch queue. 2016-03-05 14:45:09 -05:00
Thomas Harte
95efeb1d56 Ensured all delegate and responder delegate messages occur on the same queue. 2016-03-05 14:35:47 -05:00
Thomas Harte
c754a6e45a Decoupled execution speed and frame rate; cleaned up. 2016-03-03 22:12:31 -05:00
Thomas Harte
60d35fa72b Requested multisampling, if available, rather than supersampling. 2016-02-27 22:46:31 -05:00
Thomas Harte
c7f54d649e Switched back down to two samples per pixel. Though one might do it. Need to investigate. 2016-02-18 23:21:25 -05:00
Thomas Harte
3ea0d04a1a -dealloc now blocks until all audio queue buffers are no longer playing. 2016-02-16 21:47:23 -05:00
Thomas Harte
bbffbb5dc2 Resolved deadlock if an invalidate call was sent to the Electron while it was in the middle of an update. 2016-02-16 20:35:45 -05:00
Thomas Harte
a01f90ff3e Attempted a switch to the real PAL visible area and to something a bit like a real phosphor decay. 2016-02-14 21:57:23 -05:00
Thomas Harte
7580d192d5 Fixes: now setting correct frame time estimate, properly enabling the timestamp attribute, and ensuring that the Electron flushes screen work at least once per host frame update. 2016-02-14 19:28:02 -05:00
Thomas Harte
eeb0e134fd Started the transition towards a more natural collection of rolling buffers, with phosphor decay in mind. 2016-02-13 20:52:23 -05:00
Thomas Harte
7bc5a43c36 Fixed type warning. 2016-02-12 22:30:22 -05:00
Thomas Harte
0527888b15 Endeavoured to ensure safe shutdown. 2016-02-12 22:30:06 -05:00
Thomas Harte
a6574d1f96 Made an attempt to factor out and more clearly to document my implementation of flywheel synchronisation. 2016-02-11 22:12:12 -05:00
Thomas Harte
b5bcadb8d3 Reinstated clipped CRT output, with more appropriate ownership of the decision. 2016-02-07 22:18:55 -05:00
Thomas Harte
4d0a218a57 Certainly at least seriously considering a separate holder for the "compile a shader" logic. Otherwise taking steps back towards PAL/NTSC decoding. 2016-02-07 17:32:38 -05:00
Thomas Harte
602327cd9d Sketched out a quick class for rendering to texture. 2016-02-07 15:42:02 -05:00
Thomas Harte
d3d505b7bc That's one header file less. 2016-02-05 23:05:58 -05:00
Thomas Harte
6ab425deda There is now a semi-reasonable amount of screen output again. 2016-02-05 21:35:39 -05:00
Thomas Harte
80e7e5e602 Updated to return old behaviour of drawing only upon changes. 2016-02-04 23:05:47 -05:00
Thomas Harte
8bc3f8046d This endeavours to move everything into the CRT class except the final version of shader building. 2016-02-04 22:57:46 -05:00
Thomas Harte
e0d51408e4 Onward with carrying this through to the bitter end, this at least results in all the appropriate knowledge and call-ins occuring at the CRT. 2016-02-04 22:28:50 -05:00
Thomas Harte
4554abb755 Made an attempt to be more rigorous in display generation on the Electron, to make sure I deal with mid-line changes to/from blank line mode. Even if it turns out that they generate pixels. 2016-01-29 21:14:13 -05:00
Thomas Harte
0efe4b312c Disabled my various bits of rate interchange debugging; improved test for when to call update_display due to a RAM write. 2016-01-21 22:16:52 -05:00
Thomas Harte
de7218cdf0 Added a lot of commenting to the CPU6502 definition, simplifying its construction. Added missing nullability modifier to CSElectron. Fixed bad-habit Objective-C style naming on the Electron's Interrupt enum. 2016-01-20 21:55:38 -05:00
Thomas Harte
f727582911 Started making first moves towards stripping CSCathodeRayView of its responsibilities. If that can be merely an OpenGL view that presents things, things will be a lot more portable. 2016-01-20 08:21:33 -05:00
Thomas Harte
e65cd4cf06 Some data is marginally reaching the CPU from the tape. 2016-01-19 22:05:34 -05:00
Thomas Harte
956b90e203 Attempted further to improve latency; added view adjustment for non-4:3 output aspect ratios. The 4:3 is currently hardcoded, so further work will be required. 2016-01-18 23:55:52 -05:00
Thomas Harte
90eef1df74 Tightened to provide lower latency audio, hopefully. 2016-01-18 20:01:06 -06:00
Thomas Harte
03f683d588 Gave the audio queue something a lot like a spin lock on waiting to pipe out audio. 2016-01-18 19:57:18 -06:00
Thomas Harte
5a39e42413 Wired up enough such that some basic attempt at parsing a UEF occurs.` 2016-01-18 17:06:09 -06:00
Thomas Harte
2779f0e569 Statred working on support for at least the most fundamental file format. 2016-01-18 15:46:41 -06:00
Thomas Harte
b70fdc2de8 Switched to being explicitly careful about not wrapping around and stomping on data not yet output. 2016-01-18 13:56:20 -06:00
Thomas Harte
ddcc34740b Added lots of debugging output while I attempt to locate the source of audio scratchiness, also simplified manner of dealing with wraparound within the AudioQueue wrapper. 2016-01-18 13:50:19 -06:00
Thomas Harte
781249acf7 Fixed crash. 2016-01-14 20:35:36 -05:00
Thomas Harte
38ffcaa262 Here, at last, is _some_ audio output, at least. 2016-01-14 20:33:22 -05:00
Thomas Harte
afde8dac49 Closed the loop such that audio manages to bubble up into Objective-C. 2016-01-13 22:38:59 -05:00
Thomas Harte
d9a7ef9e46 Edging towards audio output; the speaker is given appropriate input and output rates, and then updated with current divider and enabled/disabled status. 2016-01-13 21:03:43 -05:00
Thomas Harte
d28abdc037 Made an attempt at correct timing, adding support for additional paged ROMs, added file association for .rom. 2016-01-12 22:34:26 -05:00
Thomas Harte
84ba4e2900 Tidied a little, started working towards supporting speaker output. 2016-01-12 22:19:56 -05:00
Thomas Harte
3437781abd Started sketching out an interface for sound generation. Which made me realise that the CRT in CRTDelegate was redundant, since C++ has namespaces. 2016-01-12 16:54:09 -05:00
Thomas Harte
6112f4ef6b Withdrew soft filtering for now; until the sampling frequency is passed on it's not sufficiently rigorous. 2016-01-12 16:42:16 -05:00
Thomas Harte
75d6ec354b Added some very basic filtering in RGB mode. 2016-01-12 16:27:09 -05:00
Thomas Harte
49a36ec9ac Added F12 as break. 2016-01-11 22:35:52 -05:00
Thomas Harte
650077feac Pulled a few things out as constants, zoomed in a little. Still in a 4:3 window though. 2016-01-11 22:18:34 -05:00
Thomas Harte
e93dbdb463 Implemented keyboard input. 2016-01-11 19:48:31 -05:00
Thomas Harte
ce916ebd6a Fixed runaway frame generator. 2016-01-10 23:32:57 -05:00
Thomas Harte
3d6f20b7b9 Output, at last! Though sync is clearly way off. 2016-01-09 21:53:33 -05:00
Thomas Harte
09df218c01 Some output! Showing that three lines of solid sync isn't smart. But here it is. 2016-01-09 21:48:53 -05:00
Thomas Harte
b4f31edea3 Made an attempt to get RGB output mode up and running, and showing at least a box where pixels would be. 2016-01-09 21:32:56 -05:00
Thomas Harte
a900bfed65 Fixed to ensure that frame rendering wraps around, and to properly connect the Electron to its view. Now I need a working pixel shader. 2016-01-09 20:34:22 -05:00
Thomas Harte
716bb3281b This at least now connects up a CRT, though it never talks to it. 2016-01-07 22:26:49 -05:00
Thomas Harte
47a7654c00 Added just enough that this is probably a successful boot. I guess I'm going to need to get invested in graphics next? Hmmm. 2016-01-07 21:01:13 -05:00
Thomas Harte
0db8938d27 Added the option for the CSCathodeRayView to show only a subsection of the full scan area. Zoomed in a little on the 2600. Put in enough piping to give the Electron sight of its ROMs at least. 2016-01-06 23:14:36 -05:00
Thomas Harte
bfd9957c81 You now get an Electron only if you ask for a new file. That'll do for now while it's the only thing that one might want to start without supplying a file. The 6502 now starts from a defined point — being reset. The Electron is starting to grow the absolute most simple buds of its memory map. 2016-01-06 21:09:49 -05:00
Thomas Harte
c69b3256ba Slightly simplified Swift usage. 2016-01-04 23:44:36 -05:00
Thomas Harte
616dc0b57c Okay, so this is the absolute bare minimum about of refactoring and wiring necessary to get the [unimplemented] Electron machine pumping. 2016-01-04 23:40:43 -05:00
Thomas Harte
43ab8bbad5 Okay, so then here's a first shot at the Objective-C -> C++ bridge for the Electron. 2016-01-04 23:16:37 -05:00
Thomas Harte
ab45c1d530 Started working on a shell for the Electron emulation, including factoring out the common CRT delegate -> Objective-C bridging, serial dispatch queue and frameskipping logic from the Atari 2600 shell. 2016-01-04 23:12:47 -05:00
Thomas Harte
22fa024546 Added document XIB. 2016-01-03 20:46:39 -05:00
Thomas Harte
aa0714fe27 Started sketching out an Acorn Electron emulation, as it's a platform I'm familiar with and will force me to figure out PAL decoding. Factored out NTSC-specific parts of the display decoding logic and hence added RGB output mode. 2016-01-03 20:41:43 -05:00
Thomas Harte
96503a3ac5 Switched to nicer nullable/nonnull syntax. 2016-01-02 17:59:21 -05:00
Thomas Harte
feeedbe33b The standard Xcode versioning updates. Nothing of substance. 2016-01-02 17:57:23 -05:00
Thomas Harte
675070c5dd Very, _very_ minor: switched to normal C++ constructor syntax for simple variable initialisation. 2015-12-06 16:53:37 -05:00
Thomas Harte
5feef2110f Added a very basic attempt at shadow mask emulation. 2015-09-24 21:23:16 -04:00
Thomas Harte
63b648be65 Switched down to four samples per pixel, just more than half as many, to fit into a vec4. Edges aren't as smooth but I'm wondering whether it'll make much odds when I implement a shadow mask. 2015-09-17 19:25:15 -04:00
Thomas Harte
5d6bee4927 Of course, being in-phase means being the cosine wave. 2015-09-10 21:30:39 -04:00
Thomas Harte
6a0b4e86c8 An Xcode beta version bump, nothing more. 2015-09-05 17:21:36 -04:00
Thomas Harte
53e699516b Disabled multisampling unless and until I can get the per-pixel cost down. 2015-09-05 17:21:16 -04:00
Thomas Harte
39027b675d Fixed YIQ conversion and made sampling pattern slightly more rational. 2015-09-05 17:09:24 -04:00
Thomas Harte
80cf3d9301 Formally gave the 2600 responsibility for providing the code that decodes one of the things it has put into a buffer into a composite sample. 2015-09-03 12:28:16 -04:00
Thomas Harte
ac8fc9a1a0 Experimenting with pre-encoding luminance and chrominance separation over on the
CPU as otherwise the GPU does them repetitively and more awkwardly (as it's working purely in floats). It means uploading twice as much data though, so I don't
 know. Still only half as much as the RGBA path of a few days ago. Will experiment.

Also slightly adjusted division of responsibility in the fragment shader per the
 desire to have the `sample` function owned externally.
2015-09-03 11:15:23 -04:00
Thomas Harte
11acf3f2d3 Made some further minor attempted improvements. 2015-09-02 20:51:56 -04:00
Thomas Harte
161450942a Removed outdated comment. This is better now than it was. 2015-09-02 17:20:23 -04:00
Thomas Harte
0d6094d842 Attempted very basic vectorisation, plus some minor other clean-ups. 2015-09-02 17:17:22 -04:00
Thomas Harte
f60ba4f487 Added a note about horribleness to the source. You never know who's looking. 2015-09-01 22:38:15 -04:00
Thomas Harte
cb6e6e8acb It's the worst fragment shader you'll ever see. The worst. But this attempts NTSC composite video emulation, artefacts included. 2015-09-01 22:36:45 -04:00
Thomas Harte
5fe0cff692 Fine. I'll accept 'bin' files if I must. 2015-08-19 21:36:50 -04:00
Thomas Harte
a62c7f5c56 At last! Discovered CRT scanning bug; was always moving by the full proposed run length along the scan, not the time until the next event. Using this, have implemented proper vertical sync at last (I think). Have disabled scanline banding too, as now everything meets up it's more helpful to be able to see with clarity. 2015-08-18 22:22:47 -04:00
Thomas Harte
462a791ed3 Ensured that no backlog accumulates of cycles to run. Otherwise the background queue was lagging behind. 2015-08-18 21:13:54 -04:00
Thomas Harte
ca6b54536e Added fire and reset inputs. 2015-08-18 20:58:05 -04:00
Thomas Harte
bc805a90fe Wired up joystick directions, at least, and fire button presses get as far as the C++. But there's some latching to figure out before they'll work. 2015-08-18 20:33:24 -04:00
Thomas Harte
902795d61c Switched vertical sync detection method, at least for now. They never happen automatically (I need to fix that) and just always take effect if detected in the lower half of the display. PAL/NTSC is determined just by looking at the refresh rate. 2015-08-18 00:17:03 -04:00
Thomas Harte
a693c081f8 Switched on the appropriate compiler warnings re: signed comparisons and implicit conversions. Fixed all less-than-explicit calls. 2015-08-16 16:08:29 -04:00
Thomas Harte
1cc479affd Removed redundant GL call. 2015-08-16 15:40:03 -04:00
Thomas Harte
391789e75c Removed stray space. 2015-08-13 23:22:51 +01:00
Thomas Harte
cbe76ea5d5 Got rid of the thread hopping in order to redraw the GL view. Which appears to help significantly with total application cost. 2015-08-13 22:01:25 +01:00
Thomas Harte
cc98534f94 Added test for NOP, discovering the undocumented ones to be the incorrect length. 2015-08-13 07:32:50 +01:00
Thomas Harte
6616265d93 Fixed collision tests, added a few more timing tests. 2015-08-13 03:33:45 +01:00
Thomas Harte
dd0f17130a Found and fixed some timing errors in absolute indexed and in (indirect), y addressing modes: neither is able in write or read-modify-write modes to shave a cycle as then can when reading. 2015-08-13 02:58:39 +01:00
Thomas Harte
975836c30f Added a quick snippet test, discovering that I've cut a cycle from read/modify/writes. 2015-08-13 02:18:41 +01:00
Thomas Harte
503d684af0 Added a couple of timing tests, both of which seem to pass for now. 2015-08-13 01:55:23 +01:00
Thomas Harte
e8f70398c1 Added one basic timing test, for now: implied nop should be two cycles. 2015-08-13 01:06:56 +01:00
Thomas Harte
d19f8ed507 Removed the implicit reset upon 6502 startup, adding a reset line. Hence all tests now pass again. Added an empty shell for timing tests, the all-RAM 6502 now counting bus cycles. 2015-08-13 00:51:06 +01:00
Thomas Harte
0e52b7365e Removed redundant code. 2015-08-10 16:42:25 +01:00
Thomas Harte
eb23a493e5 Switched back to one texel per colour clock, at least for now. Attempted to break _RGBA assumption within the cathode ray view. 2015-08-05 23:36:04 -04:00
Thomas Harte
fd36f13baf The cathode ray view no longer hard codes the frame size. So that's one less coupling. Doubled pixel output size to give sufficient sampling detail to capture the NTSC colour clock (ummm, hopefully). 2015-08-05 21:45:47 -04:00
Thomas Harte
67e82c713f Broke assumption that every item in a vertex description is a short, specifically turning lateral into a byte. Which buys me a byte for phase, if that's sufficient. 2015-08-05 21:12:33 -04:00
Thomas Harte
5644b3a1cc Fixed scanline sizing and fill issues, as well as shortening vsync to the correct Atari length. 2015-08-05 20:55:27 -04:00
Thomas Harte
5313b48ebd I'm ashamed to admit, I: played with numbers until enough things looked stable such that I can investigate other things. Discovery: my PAL autodetection was way off. Fixed, hopefully. 2015-08-02 20:32:18 -04:00
Thomas Harte
6e52e5df1c Full separate 'lateral' usage is go. Also probably at some point I need to throw in a phase property, which this new flexibility will help with. 2015-08-02 14:32:29 -04:00
Thomas Harte
3ab6585789 Started making the format of data included in a CRTFrame less a matter of variously hard-coded magic constants. Which will allow me to separate the idea of an internal lateral position from the direct texture coordinate, avoiding precision sampling errors at the top and bottom. 2015-08-02 14:25:21 -04:00
Thomas Harte
be421587ad Eliminated the vertical retrace counter; vertical retrace ends when the beam gets back to the top. 2015-08-02 13:48:35 -04:00
Thomas Harte
9c91f1a2eb Added an attempt at NTSC/PAL autodetection, based on number of missed vertical syncs. 2015-07-31 18:04:33 -04:00
Thomas Harte
a5d66e9dd6 Factored out a few more constants, started trying to ensure there's enough slack and the mechanisms in place for the CathodeRayView to hold onto two frames if it desires, for potential phosphor simulation, switched once again to additive blending — much more like a real CRT — and added a sine function across the width of spans per my understanding of how an electron gun actually fires.
Why do all this when overall timing is still so far off? It helps me more easily see how overall timing is so far off.
2015-07-31 17:47:10 -04:00
Thomas Harte
53dd5c8f16 Trying to fix my RDY line emulation. Switched to PAL timings, at least temporarily, since it's starting to make a difference. 2015-07-31 16:44:53 -04:00
Thomas Harte
e4615cda2e Switched back to unrealistic solid raster beams for the time being. 2015-07-30 23:01:59 -04:00
Thomas Harte
cfe758daa0 A tweak here, a tweak there, to help with debugging. 2015-07-30 21:29:40 -04:00
Thomas Harte
20c2d98b9a Converted remaining spaces to real tabs. 2015-07-30 20:51:32 -04:00
Thomas Harte
98efae2536 Reintroduced emergency vertical sync — so that output occurs even when the emulation isn't catching syncs properly — and switched some spaces to tabs. 2015-07-30 17:16:49 -04:00
Thomas Harte
828ae66a45 It appears ARC extends its reach into C++ nowadays. Fixed additional retain cycle. 2015-07-27 21:17:53 -04:00
Thomas Harte
3c25ead1f3 Started working out some of my retain cycles and general failures to release. Switched .mm filename so that Xcode will stop getting confused when I try to switch between implementation and interface files. 2015-07-27 21:15:10 -04:00
Thomas Harte
1cbebdafcc This now uploads only a portion of the source buffer if possible. Which is usually possible. 2015-07-27 20:58:51 -04:00
Thomas Harte
1f229ee6f7 More tweaks to provide a stable image, at least for the time being. 2015-07-27 20:18:25 -04:00
Thomas Harte
01109d441b Made an attempt at NTSC colours. Hard coded in RGB, not composite. Short cuts, tsk. 2015-07-27 19:04:03 -04:00
Thomas Harte
662e7942ac Enabled multisampling. This is hardly an expensive use case. 2015-07-27 16:57:11 -04:00
Thomas Harte
b9cf6fd4dc Implemented a virtual skew control, hard coded to what is conveniently exactly the right number. 2015-07-27 16:44:47 -04:00
Thomas Harte
caffe56a2d Slightly expanded width of cathode ray gun, decided to figure out exactly how to deal with off-by-one lengths and precision at a later date, ensured that failure to catch vertical sync doesn't cause out-of-bounds buffer access on the hard-coded, assumed large enough, 512x512 data textures. 2015-07-27 00:28:47 -04:00
Thomas Harte
65bb31d55b With around about a thousand issues, not the least of which being sometimes unsafe memory accesses, I've at last got pixels on screen. 2015-07-26 23:50:43 -04:00
Thomas Harte
cd0a62d21e With a slight tweak to the informal protocol used for 6502 memory access cycles, ensured the wait strobe actually halts the CPU, to give a more accurate linking of machine time to real time. 2015-07-26 15:55:19 -04:00
Thomas Harte
6252f6030f Switched to idiomatic source name, ensured latest project name is in all appropriate header places, threw texture coordinates slightly into the shader mix. 2015-07-26 15:25:11 -04:00
Thomas Harte
e53fbcf9ea Reshuffled to make the OpenGL view explicitly a conduit for CRT-style output, and to give it responsibility for frame drawing. Which is still an awkward thread hop for the time being, but I've yet to read up on the advocated approach to multithreading with an NSOpenGLView; it looked like special provisions were available. 2015-07-26 15:13:46 -04:00
Thomas Harte
78a91b67c5 Quickie: make sure the correct context is adjusted; use the intended convertPointToBacking:. 2015-07-24 23:42:19 -04:00
Thomas Harte
ecb2898bd5 The overall architecture of who has responsibility for what is now very askew but: the CRT now outputs a tightly packed short buffer, with the probable OpenGL destination in mind. So it's now all fixed arithmetic internally. CRTFrame is reduced to a plain C struct with the intention that the OpenGL view will take responsibility for it and stop doing the back-and-forth sprint on getting buffer data. The Atari 2600 now outputs explicit blanks rather than level blacks for its border, so that it's easier visually to debug the CRT in its form as far as it has currently progressed: to drawing lines where the cathode ray gun would run while outputting pixel. I note that I'm still not quite getting vertical sync right yet — I'm just accepting it anywhere in teh frame — but that should be an easy fix. 2015-07-24 23:29:45 -04:00
Thomas Harte
5ab47e600a Got through the requisite amount of invisible pain to get something onto my GL display. But clearly this is factored in entirely the wrong way. Work to do. 2015-07-24 20:37:08 -04:00
Thomas Harte
31338ef754 Okay; having no minimum size is a user experience nightmare. Fixed. 2015-07-23 22:54:17 -04:00
Thomas Harte
44e8ffd01c Ensured windows start and remain 4:3, made sure I request a GL 3.2 context and that an exception is raised if I call any old-fashioned GL functions. 2015-07-23 22:51:53 -04:00
Thomas Harte
02c786520a More fiddling in the margins in advance of doing the OpenGL stuff: window now supports full-screen display. 2015-07-23 20:53:26 -04:00
Thomas Harte
b9721d1d3f Okay, treading water slightly, ensured window content is correct aspect ratio. 2015-07-23 20:50:50 -04:00
Thomas Harte
7276c77027 A full communication pathway now leads to Atari2600.mm (for now) being in possession of a frame and receiving a command to draw, with a suitable OpenGL context being active and whatever is drawn subsequently appearing. 2015-07-23 20:45:07 -04:00
Thomas Harte
0611646181 This then is what the serial dispatch queue and the triple buffer achieve together: I can post the runs over to the main thread for processing while emulation continues separately. 2015-07-23 20:16:48 -04:00
Thomas Harte
e7237c7bd5 Switched to forcing all processing onto a common queue and piping the completed frame over into the Objective-C class. 2015-07-23 20:07:35 -04:00
Thomas Harte
5203f31bf4 Reintroduced a console examination of the output runs being received after fixing a failure to complete or restart frames over in the CRT; weirdly it seems that sync is being obeyed but raster position is off. So work to do. 2015-07-22 20:45:10 -04:00
Thomas Harte
065050115f Made an attempt to switch to a triple-buffering scheme for CRT outputs, with an eye towards asynchronicity. 2015-07-22 20:33:20 -04:00
Thomas Harte
963cb2f6fb Attempted to switch to slightly more meaningful names within the CRT and implemented a delegate to investigate output. Working on it. 2015-07-22 18:15:18 -04:00
Thomas Harte
2d0f861474 Incoming: a 'CRT' class, to receive information intended for a cathode ray tube. To decode sync, etc. 2015-07-19 13:36:27 -04:00
Thomas Harte
12746b35e3 Ensured there's no overflow while changing base. 2015-07-19 10:54:19 -04:00
Thomas Harte
412e02fdd8 Merge branch 'master' of github.com:TomHarte/CLK 2015-07-19 10:52:15 -04:00
Thomas Harte
e0aa1e9f19 Minor project rearrangement to aid findability. 2015-07-17 09:10:23 -04:00
Thomas Harte
195c8a87d8 Introduced enough logic that the Atari 2600 is being run, at least. No output yet though because (i) it has no-one to send output to; and (ii) there's nobody that knows how to display output. Hmmm. 2015-07-16 22:14:40 -04:00
Thomas Harte
4496493e85 Performed the bare necessary steps to get my little OpenGL view to create a CVDisplayLink and then repaint itself in time with the display. 2015-07-16 21:16:21 -04:00
Thomas Harte
1df2c48668 Introduced my GL view as the window content. 2015-07-16 21:01:49 -04:00
Thomas Harte
5160b6bbb8 Separated out different test suites into different XCTest subclasses. 2015-07-16 20:52:16 -04:00
Thomas Harte
3e0679235a This now goes just far enough to create an instance of Atari2600::Machine and push a ROM to it. Next jobs are to get a basic CRT emulation wired up, outputting to the window. 2015-07-16 20:40:46 -04:00
Thomas Harte
24c0579b94 Shuffled things and guessed at things until the Xcode project was happy being subservient to the project proper. 2015-07-16 20:27:31 -04:00