Commit Graph

  • 5644b3a1cc Fixed scanline sizing and fill issues, as well as shortening vsync to the correct Atari length. Thomas Harte 2015-08-05 20:55:27 -04:00
  • 265d1d5b24 Merge branch 'EdgeTriggeredVSync' Thomas Harte 2015-08-05 20:30:02 -04:00
  • 84d1c2e47d Fixed end of sync time calculation and ensured the pretend capacitor is emptied by the decision to retrace and doesn't refill during retrace. Thomas Harte 2015-08-05 20:29:20 -04:00
  • 04c2640b15 Made a quick attempt to allow vsync triggers only on the raising edge of a sync signal. Will need to investigate more thoroughly. Thomas Harte 2015-08-03 08:42:05 -04:00
  • 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. Thomas Harte 2015-08-02 20:32:18 -04:00
  • 55017b78a5 Made an attempt to unify my variable storage (and, technically, to get beam size correct across the frame). Thomas Harte 2015-08-02 19:30:45 -04:00
  • 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. Thomas Harte 2015-08-02 14:32:29 -04:00
  • 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. Thomas Harte 2015-08-02 14:25:21 -04:00
  • be421587ad Eliminated the vertical retrace counter; vertical retrace ends when the beam gets back to the top. Thomas Harte 2015-08-02 13:48:35 -04:00
  • de4f2bf5dd Maybe the 10 lines resource I saw meant 10 lines including charge time? Thomas Harte 2015-07-31 19:00:40 -04:00
  • 5f1d76e855 Can't seem to find any documentation: assumed horizontal sync is generated during vertical. Thomas Harte 2015-07-31 18:49:02 -04:00
  • c1a12ad4df Fix to make sure end of vertical sync is always correctly spotted as an event, rather than just happening off the books. So I can now watch Joust roll to its heart's content. Thomas Harte 2015-07-31 18:15:59 -04:00
  • 9c91f1a2eb Added an attempt at NTSC/PAL autodetection, based on number of missed vertical syncs. Thomas Harte 2015-07-31 18:04:33 -04:00
  • 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. Thomas Harte 2015-07-31 17:47:10 -04:00
  • c1d1fb65cb Made an attempt properly to emulate the RDY line and the Atari's use of it. Thomas Harte 2015-07-31 16:54:20 -04:00
  • 53dd5c8f16 Trying to fix my RDY line emulation. Switched to PAL timings, at least temporarily, since it's starting to make a difference. Thomas Harte 2015-07-31 16:44:53 -04:00
  • e4615cda2e Switched back to unrealistic solid raster beams for the time being. Thomas Harte 2015-07-30 23:01:59 -04:00
  • 39bfbf1000 Attempted ball graphics enable delay. Thomas Harte 2015-07-30 23:01:28 -04:00
  • 6ad3fbbaf2 Slowed flywheel adjustments a little, the better to highlight phase errors for the time being. Thomas Harte 2015-07-30 23:00:54 -04:00
  • 78e66d2577 Added an attempt at ball rendering. Thomas Harte 2015-07-30 21:30:00 -04:00
  • cfe758daa0 A tweak here, a tweak there, to help with debugging. Thomas Harte 2015-07-30 21:29:40 -04:00
  • a95b36a53d Made first attempt at missile display. In Enduro, at least, one seems to work but the other seems to be absent. Thomas Harte 2015-07-30 21:09:18 -04:00
  • 1b7846f09b Made a first attempt at the sprite latches. Hopefully this should make a few more Activision logos, etc, show up correctly. Thomas Harte 2015-07-30 20:52:26 -04:00
  • 20c2d98b9a Converted remaining spaces to real tabs. Thomas Harte 2015-07-30 20:51:32 -04:00
  • 1fa7a77793 Continuing in my attempts to figure out the complete absence of graphics from some games: there are 262 lines on an NTSC screen, not 256. Also ensured that the CRT has a little spare range at the edges so that its generated triangles don't wrap around just because of integer overflow. Thomas Harte 2015-07-30 20:07:20 -04:00
  • 98efae2536 Reintroduced emergency vertical sync — so that output occurs even when the emulation isn't catching syncs properly — and switched some spaces to tabs. Thomas Harte 2015-07-30 17:16:49 -04:00
  • 14adcd2096 Had a quick bash at timer overflow. Thomas Harte 2015-07-30 16:09:32 -04:00
  • 58908b60ac So, provisionally: this looks like (i) the one cycle to write; plus (ii) the number of cycles to get to the end of the pixels (which is _horizontalTimer+1 for me because _horizontalTimer = 0 is a pixel); plus (iii) one cycle of latency to wake up. Am I making that up? Time will tell. Thomas Harte 2015-07-30 15:49:38 -04:00
  • f5475369d6 Fixed foreshadowing of sprites yet to come. Put flipMask back the other way around. Thomas Harte 2015-07-30 12:07:28 -04:00
  • f653b5dff3 Made a first tentative attempt at supporting all eight sprite modes. Thomas Harte 2015-07-30 11:52:28 -04:00
  • 151c6b4421 Quick fix: add one cycle to get to the genuine end of the line (i.e. after cycle 0, not on it). Not 3, with the video then becoming desynchronised from the CPU clock. Thomas Harte 2015-07-30 00:00:35 -04:00
  • 0124832876 Merge branch 'master' of github.com:TomHarte/CLK Thomas Harte 2015-07-29 23:49:10 -04:00
  • d1ae2caf91 Did the absolute minimum necessary to get some sprites showing in some capacity. Thomas Harte 2015-07-29 23:48:52 -04:00
  • 23df94d011 Got at least as far as putting a single dot at the player 0 and player 1 positions. Which may or may not be accurate. Thomas Harte 2015-07-29 22:37:37 -04:00
  • 596d34190c Fixed: write pointer is calculated only after write x and y are known. This is probably the memory handling problem? Thomas Harte 2015-07-28 08:15:54 -04:00
  • 164866d613 Collapsed two methods into one, to avoid redundant pixel copying. Thomas Harte 2015-07-27 22:12:13 -04:00
  • 828ae66a45 It appears ARC extends its reach into C++ nowadays. Fixed additional retain cycle. Thomas Harte 2015-07-27 21:17:53 -04:00
  • 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. Thomas Harte 2015-07-27 21:15:10 -04:00
  • 1cbebdafcc This now uploads only a portion of the source buffer if possible. Which is usually possible. Thomas Harte 2015-07-27 20:58:51 -04:00
  • 1f229ee6f7 More tweaks to provide a stable image, at least for the time being. Thomas Harte 2015-07-27 20:18:25 -04:00
  • 01109d441b Made an attempt at NTSC colours. Hard coded in RGB, not composite. Short cuts, tsk. Thomas Harte 2015-07-27 19:04:03 -04:00
  • 662e7942ac Enabled multisampling. This is hardly an expensive use case. Thomas Harte 2015-07-27 16:57:11 -04:00
  • b9cf6fd4dc Implemented a virtual skew control, hard coded to what is conveniently exactly the right number. Thomas Harte 2015-07-27 16:44:47 -04:00
  • 31e9a53a44 Removed some debugging code. Thomas Harte 2015-07-27 16:43:51 -04:00
  • 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. Thomas Harte 2015-07-27 00:28:47 -04:00
  • 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. Thomas Harte 2015-07-26 23:50:43 -04:00
  • 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. Thomas Harte 2015-07-26 15:55:19 -04:00
  • 8efd449834 Switched to a down counter and a reset test that remains unconditional but doesn't depend on % (which seems to turn into a big imul-powered deal). Probably pointless mulling around the edges at this point. Thomas Harte 2015-07-26 15:45:19 -04:00
  • 6252f6030f Switched to idiomatic source name, ensured latest project name is in all appropriate header places, threw texture coordinates slightly into the shader mix. Thomas Harte 2015-07-26 15:25:11 -04:00
  • 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. Thomas Harte 2015-07-26 15:13:46 -04:00
  • dd428c5d4d Slightly relaxed time it takes to recognise vertical sync; considered what to do about reviving proper vertical sync but then gave up. Thomas Harte 2015-07-24 23:56:25 -04:00
  • 78a91b67c5 Quickie: make sure the correct context is adjusted; use the intended convertPointToBacking:. Thomas Harte 2015-07-24 23:42:19 -04:00
  • cea2580000 Upped internal precision a little. Thomas Harte 2015-07-24 23:36:44 -04:00
  • 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. Thomas Harte 2015-07-24 23:29:45 -04:00
  • 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. Thomas Harte 2015-07-24 20:37:08 -04:00
  • 31338ef754 Okay; having no minimum size is a user experience nightmare. Fixed. Thomas Harte 2015-07-23 22:54:17 -04:00
  • 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. Thomas Harte 2015-07-23 22:51:53 -04:00
  • 02c786520a More fiddling in the margins in advance of doing the OpenGL stuff: window now supports full-screen display. Thomas Harte 2015-07-23 20:53:26 -04:00
  • b9721d1d3f Okay, treading water slightly, ensured window content is correct aspect ratio. Thomas Harte 2015-07-23 20:50:50 -04:00
  • 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. Thomas Harte 2015-07-23 20:45:07 -04:00
  • 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. Thomas Harte 2015-07-23 20:16:48 -04:00
  • e7237c7bd5 Switched to forcing all processing onto a common queue and piping the completed frame over into the Objective-C class. Thomas Harte 2015-07-23 20:07:35 -04:00
  • d72287a776 Looked up normal retrace time (it's a lot less than 16µs and 26 scanlines — more like 7 and 10) and that the visible portion of a line is defined to start about 12 µs after the start of hsync, put the first two numbers into my CRT to make that more accurate, then derived a newer guess about what the Atari 2600 does for each of its 228 cycles. The text version of a frame is now looking pretty good. So it's probably time to hit OpenGL and the OS X side of things. Though I'll have a quick look to find out whether I can learn the exact real Atari 2600 timings before moving on. Thomas Harte 2015-07-23 19:24:25 -04:00
  • 33c06baffa Explicitly separated vertical and horizontal sync event tracking, so as explicitly to be able to handle a coincidental simultaneous occurrence of both. Also for clarity. Thomas Harte 2015-07-23 18:53:18 -04:00
  • 529f61caa1 Removed a stray newline. Thomas Harte 2015-07-22 20:45:21 -04:00
  • 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. Thomas Harte 2015-07-22 20:45:10 -04:00
  • 065050115f Made an attempt to switch to a triple-buffering scheme for CRT outputs, with an eye towards asynchronicity. Thomas Harte 2015-07-22 20:33:20 -04:00
  • b503e13380 Fix one: vertical scan speed was failing to allow for the number of cycles in a line. Thomas Harte 2015-07-22 18:56:35 -04:00
  • 963cb2f6fb Attempted to switch to slightly more meaningful names within the CRT and implemented a delegate to investigate output. Working on it. Thomas Harte 2015-07-22 18:15:18 -04:00
  • 908c171d2d Commented the heck out of this thing, to put my thoughts in order if nothing else. Thomas Harte 2015-07-21 16:37:39 -04:00
  • a1a1b15d18 Made a quick attempt to accumulate a list of detected output runs. Which means finally having to specify normal frame height. I'm already at too many magic formulae though, so this will need proper revision when I'm next awake. Definitely my horizontal position advancement is way off. Thomas Harte 2015-07-20 23:18:56 -04:00
  • 4fa315ab4d This looks a lot closer to correct. The loss of horizontal sync during vertical sync is odd but the two should be fully decoupled in here. I'll have to check. Probably I've got something wrong. There are approximate sinusoidals when re-establishing sync, so that's promising as to the flywheel. Thomas Harte 2015-07-20 21:58:32 -04:00
  • 4695295dd1 Made complete attempt at sync discrimination. But I seem somehow to be locking such that horizontal sync is in the middle of the line. Obviously my flywheel is at fault somehow. Thomas Harte 2015-07-20 21:43:00 -04:00
  • 4e4c082a05 Made some minor attempt at proper sync response. I think I've gone way off piste and overcomplicated it. Thomas Harte 2015-07-19 23:43:22 -04:00
  • 4a1e9fe2a8 Rephrased the CRT as owning an arbitrary number of buffers and vending storage space for pixel output. That much better maps to potential implementations of this thing in GLSL, with ES 2.0's limitations kept in mind. Thomas Harte 2015-07-19 21:21:34 -04:00
  • 7df5025eef Started sketching out the delegate interface that will allow a branch from the CRT into whatever native display system is used by a particular platform. Thomas Harte 2015-07-19 18:32:42 -04:00
  • 4d1e410150 Fix 1: _horizontalTimer should be treated as read only out here. Thomas Harte 2015-07-19 16:51:11 -04:00
  • 6f78ecdc9c Made first genuine attempt at outputting a meaningful CRT stream. Which shows some significant errors. So work to do. Thomas Harte 2015-07-19 16:48:14 -04:00
  • 2d0f861474 Incoming: a 'CRT' class, to receive information intended for a cathode ray tube. To decode sync, etc. Thomas Harte 2015-07-19 13:36:27 -04:00
  • 03a25c8ff2 Fixed playfield pixel logic. Thomas Harte 2015-07-19 10:56:04 -04:00
  • 12746b35e3 Ensured there's no overflow while changing base. Thomas Harte 2015-07-19 10:54:19 -04:00
  • 412e02fdd8 Merge branch 'master' of github.com:TomHarte/CLK Thomas Harte 2015-07-19 10:52:15 -04:00
  • e0aa1e9f19 Minor project rearrangement to aid findability. Thomas Harte 2015-07-17 09:10:23 -04:00
  • 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. Thomas Harte 2015-07-16 22:14:40 -04:00
  • 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. Thomas Harte 2015-07-16 21:16:21 -04:00
  • 1df2c48668 Introduced my GL view as the window content. Thomas Harte 2015-07-16 21:01:49 -04:00
  • 5160b6bbb8 Separated out different test suites into different XCTest subclasses. Thomas Harte 2015-07-16 20:52:16 -04:00
  • 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. Thomas Harte 2015-07-16 20:40:46 -04:00
  • 24c0579b94 Shuffled things and guessed at things until the Xcode project was happy being subservient to the project proper. Thomas Harte 2015-07-16 20:27:31 -04:00
  • 65d60f065d Started importing unit tests aplenty for the 6502. Thomas Harte 2015-07-16 20:15:30 -04:00
  • 6558ae1425 Imported what little I have so far in the way of a memory-access cycle complete 6502 and just enough of a pretend Atari 2600 on top to be able to see some playfields in ASCII art. Thomas Harte 2015-07-16 19:56:02 -04:00
  • b8947a9aaf Created and imported all the necessary Xcode stuff to create an OS X document-based project that declares itself able to open .a26 files. Thomas Harte 2015-07-16 19:53:53 -04:00
  • 93e76458a8 Create README.md Thomas Harte 2015-07-16 19:47:37 -04:00
  • 4cae5e187a Initial commit Thomas Harte 2015-07-16 19:46:52 -04:00