1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-06-27 01:29:31 +00:00
Commit Graph

218 Commits

Author SHA1 Message Date
Thomas Harte
261fb3d4f8 Implements proper test for ADC/SBC 65C02 NZ, though not yet the proper timing.
This gets Klaus Dorman's test to pass.
2018-08-10 22:42:35 -04:00
Thomas Harte
5d6e479338 Implements RMB and SMB, and fixes SBC (zero). 2018-08-10 22:13:51 -04:00
Thomas Harte
90094529a5 Implements TSB and TRB, and adds the extra BIT instructions. 2018-08-10 22:04:45 -04:00
Thomas Harte
aed4c0539e Implements STZ. 2018-08-10 21:17:02 -04:00
Thomas Harte
8b50ab2593 Corrects (zero) behaviour. 2018-08-10 21:12:55 -04:00
Thomas Harte
95164b79c9 Attempted implementation of (zp) addressing mode. 2018-08-09 21:51:14 -04:00
Thomas Harte
6f838fe190 Implements INA and DEA. 2018-08-08 22:30:19 -04:00
Thomas Harte
bb680b40d8 Implements the 65C02's JMPs. 2018-08-08 22:26:57 -04:00
Thomas Harte
e3f6da6994 Implements the 65C02 NOPs. 2018-08-08 20:00:14 -04:00
Thomas Harte
e46bde35f5 Implements BBS and BBR. 2018-08-07 21:52:17 -04:00
Thomas Harte
32338bea4d Implements BRA. 2018-08-06 22:37:30 -04:00
Thomas Harte
5c881bd19d Implements PLX, PLY, PHX and PHY. 2018-08-06 22:00:23 -04:00
Thomas Harte
1a44ef0469 Introduces Klaus Dorman's 65C02 tests. All failing. 2018-08-06 21:48:43 -04:00
Thomas Harte
ebce9a2e51 Fixes test target. 2018-08-06 21:15:13 -04:00
Thomas Harte
633af4d404 The operations table is now per-instance. 2018-08-06 20:47:14 -04:00
Thomas Harte
76a73c835c Forces 6502 consumers to declare which model — the original, 65C02 or 65SC02.
All present machines use a regular 6502.
2018-08-06 20:06:07 -04:00
Thomas Harte
5d6b5d9f10 Eliminates all emdashes in cross-platform code. 2018-05-13 15:34:31 -04:00
Thomas Harte
0b771ce61a Removes all instances of the copyright symbol. 2018-05-13 15:19:52 -04:00
Thomas Harte
5aef81cf24 Commutes cross-platform #pragma marks to //MARK:s. 2017-11-12 15:59:11 -05:00
Thomas Harte
2e15fab651 Doubles down on <cX> over <X.h> for C includes, and usage of the namespace for those types and functions. 2017-11-11 15:28:40 -05:00
Thomas Harte
4cbc87a17d Corrects out-of-order initialisations for the 1770, Atari 2600 joystick, Pitfall II bus extender, Microdisc and 6502. 2017-11-10 22:20:44 -05:00
Thomas Harte
e983854e71 Converts all uint8_t and uint16_t casts to the functional style. 2017-10-21 21:50:53 -04:00
Thomas Harte
ab2bcb939f Separates 6502Base into its constituent parts. 2017-09-04 11:08:33 -04:00
Thomas Harte
de218611e4 Corrects possible confusion as documentation recommends Cycles(0) as default, but then gives Cycles(1). 2017-09-01 20:49:24 -04:00
Thomas Harte
b306776ba9 Removes from 6502.hpp all remaining implementation details, making it purely an interface document.
Though those details remain visible to files including 6502.hpp through necessity.
2017-09-01 19:46:29 -04:00
Thomas Harte
4af333d5ec Tidies the 6502 template and folder hierarchy.
Specifically: there's now just the one .h file at the top level, giving a clear indication of what a user should read. That separates implementation from interface. It also devolves a lot more to the base class because doing so makes debug builds less of a hassle. The all-RAM 6502 has been shuffled off into a subfolder, to indicate that it's not something you necessarily need know about. Also general documentation improvements have been applied: incorrect citing of the recurring-template pattern has been removed and the meaning of the two BusHandler methods has now accrued at the bus handler.
2017-08-31 22:10:27 -04:00
Thomas Harte
ee71be0e7e Added the option not to include ready line support in the 6502 core, and took advantage of it in the Electron, Oric and Vic-20 implementations. Also tagged those as forceinline and/or override final where applicable. 2017-08-21 21:56:42 -04:00
Thomas Harte
42b5b66305 Remove the 6502's use of runtime polymorphism in favour of ordinary templating. 2017-08-16 11:56:52 -04:00
Thomas Harte
4abd62e62b Standardises on const [Half]Cycles as the thing called and returned, rather than const [Half]Cycles & as it's explicitly defined to be only one int in size, so using a reference is overly weighty. 2017-07-27 22:05:29 -04:00
Thomas Harte
37950143fc Attempted to nudge wait timing onto half-cycle boundaries, which expands the number of partial machine cycles the Z80 can post but pleasingly also regularises them. Switched the AllRAMProcessor to reporting half cycles by default and corrected all Z80 tests. 2017-07-27 20:17:13 -04:00
Thomas Harte
8361756dc4 Switched definitively to the works-for-now approach of requiring an explicit opt-in where somebody wants to clock a whole-cycle receiver from a half-cycle clock. 2017-07-27 07:40:02 -04:00
Thomas Harte
279c369a1f Switched to Cycles as the result from the 6502 perform_bus_operation, helping slightly to clarify what you're intended to return and reducing type jumping within the 6502 implementation. 2017-07-25 22:21:09 -04:00
Thomas Harte
75d67ee770 Relocated ClockReceiver.hpp as it's a dependency for parts of the static analyser, and therefore needs to be distinct from the actual emulation parts. 2017-07-25 20:20:55 -04:00
Thomas Harte
a1e9a54765 Eliminated redundant uses of ClockReceiver and sought to ensure that proper run_fors are inherited all the way down. 2017-07-25 20:09:13 -04:00
Thomas Harte
677ed463f0 Updated comment per new method name. 2017-07-24 21:19:49 -04:00
Thomas Harte
b82bef95f3 Decided to follow through on Cycles and HalfCycles as complete integer-alikes. Which means giving them the interesting range of operators. Also killed the implicit conversion to int as likely to lead to type confusion. 2017-07-24 20:10:05 -04:00
Thomas Harte
2ff157cf7a Switched CRTMachine over to use Cycles as an explicit statement of units, and followed through on the effects of that. 2017-07-22 22:17:29 -04:00
Thomas Harte
83628b285b Experimentally turned the 6502 into a clock receiver. No problem encountered. 2017-07-22 21:52:21 -04:00
Thomas Harte
1a811b1ab1 Eliminated the function call inherent to every decode, and also moved the fixed table of operations into a non-templated base class. 2017-06-03 22:19:35 -04:00
Thomas Harte
c26349624c This, of course, should be inline to gain any benefit from the slightly-tortured private implementation. 2017-06-03 22:00:57 -04:00
Thomas Harte
b642d9f712 Eliminates the 6502's specialised jam handler in favour of the generic trap handler, and simplifies the lookup costs of that as it's otherwise doubling execution costs. 2017-06-03 21:54:42 -04:00
Thomas Harte
fd6623b5a5 Attempted to bring a common hierarchy to the Z80 and 6502 test machines, particularly with a view to eliminating the special-case Jam stuff on the 6502. 2017-06-03 21:22:16 -04:00
Thomas Harte
b304c3a4b9 Eliminated the 6502's reliance on the micro-op scheduler. 2017-06-03 20:30:07 -04:00
Thomas Harte
01f7394f7f Corrected 6502 scheduling when flushing the pipeline. 2017-05-30 20:58:07 -04:00
Thomas Harte
5aa8b03349 Attempted to regularise the 6502 with the Z80 as to scheduling. I think that at least one bug remains. 2017-05-30 20:36:53 -04:00
Thomas Harte
a0189a6fe1 Switched to following the current program via address. 2017-05-30 18:49:40 -04:00
Thomas Harte
21d0602305 Restored the all RAM 6502's lack of power-on reset. 2017-05-17 21:43:40 -04:00
Thomas Harte
7190f927b7 Factored out the stuff that both all-RAM processors would share, rather than duplicating it. 2017-05-16 21:28:17 -04:00
Thomas Harte
d559d8b901 Continued edging towards getting the absolute basics of a testable Z80, for test-driven development. Corrected old-fashioned instance naming issues with the corresponding 6502 class and removed an unnecessary source file while at it. 2017-05-16 21:19:17 -04:00
Thomas Harte
eb8a2de5d6 Settled definitively on flush as more communicative than synchronise (and slightly more locale neutral); culled some more duplication from the Z80. 2017-05-15 07:38:59 -04:00
Thomas Harte
0808e9b6fb Pulled the 6502 into a CPU namespace, making it an instance of something that has micro-opcodes and schedules them, and factoring out the formulation of a register pair. 2017-05-14 22:08:15 -04:00
Thomas Harte
b81a2cc273 First tentative steps towards adding a Z80 implementation. 2017-05-14 17:46:41 -04:00
Thomas Harte
defec2c9b0 Fixed: operation reads now fulfil the promise of seeding the value to be read with 0xff. 2017-03-26 20:56:27 -04:00
Thomas Harte
e01f3f06c8 Completed curly bracket movement. 2017-03-26 14:34:47 -04:00
Thomas Harte
55ce851bb2 Fixed types of the 8k cartridges, ensured the 6502 starts without an IRQ request history. 2017-03-18 17:04:01 -04:00
Thomas Harte
36b58d03b7 Formalised read bus value guarantee from the 6502, fixed missing clock signal wiring on the Atari cartridge class, reintroduced CommaVid support. 2017-03-18 14:46:46 -04:00
Thomas Harte
14a76af0d3 Started trying to float out bus control to cartridges. 2017-03-17 20:28:07 -04:00
Thomas Harte
5be22e2f8d Switched to suffix underscores and underscores in general for instance variables. 2016-12-03 11:38:53 -05:00
Thomas Harte
7ad44f5152 Flipped order of conditional so as negligibly to improve prediction. 2016-10-31 22:17:18 -04:00
Thomas Harte
2452a3104f Corrected test: hitting zero is sufficient. No need to cross it. 2016-10-30 20:24:30 -04:00
Thomas Harte
9309be229c Moved cycle count test down to the only places where it may actually yield a different result. 2016-10-30 20:13:44 -04:00
Thomas Harte
a106018680 Fixed initial state: interrupt flag is initially low. 2016-10-28 21:22:03 -04:00
Thomas Harte
613b5b3f98 Switched to inverse storage of the interrupt flag so as to reduce logical burden when storing IRQ line history. 2016-10-28 20:52:43 -04:00
Thomas Harte
4408c60ef7 This too should continue, not break, since it doesn't schedule a memory access. 2016-10-27 18:32:21 -04:00
Thomas Harte
534b3d085d Improved test reporting, attempted to resolve timing errors just introduced (i.e. to differentiate break/continue where a cycle may or may not be spent). 2016-10-27 08:41:44 -04:00
Thomas Harte
f84b66a5f4 Made an attempt to fix wake-from-WAIT. 2016-10-25 19:06:46 -04:00
Thomas Harte
4b18c76b84 Introduced a bifurcation between break and continue to signify whether a bus access takes place, necessitating a shift in the location of the bus access but allowing the conditional to be dropped. Need to test. 2016-10-25 18:45:53 -04:00
Thomas Harte
c253a4258f Made minor restructuring changes, slightly to reduce number of conditionals per operation and to drop a big hint to the optimiser. 2016-10-25 18:34:24 -04:00
Thomas Harte
fa7c64bb5d Eventually reached an implementation of ADC that continues to satisfy all the formalised unit tests while also satisfying the manual BCDTest, that I need to find a way to formalise. I fixed the unit tests for Swift 3 while here, and attempted to do some unrelated NIB stuff with no real success. 2016-10-03 22:03:39 -04:00
Thomas Harte
5d40d70c92 Fixed 6560 addressing error, added an autotyper for Vic disks (more work potentially needed), fixed semantics for testing whether a 6502 is about to reset. 2016-08-01 10:32:32 -04:00
Thomas Harte
740ea0b7e2 Added overflow-flag setting logic and ensured disk ROM gets through regardless of ROM/disk installation order. 2016-07-31 19:33:18 -04:00
Thomas Harte
1baf21827c Since the ROM is well disassembled, let's actually try to be a 1541 first. 2016-07-06 22:17:32 -04:00
Thomas Harte
41809d4597 Made an attempt at NMI usurption of IRQ/BRK. 2016-06-29 20:59:45 -04:00
Thomas Harte
c02226bc41 Ensured stack pointer goes the right way upon reset. 2016-06-29 20:42:26 -04:00
Thomas Harte
db7c6430b5 Fixed Klaus Dormann termination condition. 2016-06-29 19:16:34 -04:00
Thomas Harte
0182b0483a Added a 'power on' flag that is set automatically at construction but can be declined. Saves all that stuff of every machine having to set and then unset the RST line, and fixes an Electron bug related to that. 2016-06-29 19:13:24 -04:00
Thomas Harte
6419d9c485 Added a single IRQ test case, discovering that I'm two cycles short. Whoops! 2016-06-28 21:29:43 -04:00
Thomas Harte
6e698e908e Made an attempt to reduce cost of the most-likely path. 2016-06-28 18:46:00 -04:00
Thomas Harte
574aa32b72 Made an attempt to implement NMI. Some work to do on the B flag though, I think. 2016-06-27 22:01:48 -04:00
Thomas Harte
88e2b382e5 Made an attempt at a full and thorough 6532 implementation (and got a bit more explicit about flag size in the 6502). 2016-06-20 18:57:35 -04:00
Thomas Harte
ef3ed1f436 Implemented full paste ability for any machine that is a typer. 2016-06-19 16:35:04 -04:00
Thomas Harte
06fb2ff1c7 Started endeavouring to sketch out the boilerplate for writing a 6522 test harness. Added a default implementation of synchronise to the 6522 too, since not everybody is going to want one. 2016-06-18 09:28:46 -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
0242924fb4 Various bits of caveman debugging appearing and disappearing, switched to latching ball behaviour. 2016-05-22 14:26:02 -04:00
Thomas Harte
e636ae37b4 Ensured that calling return_from_subroutine really does unjam the processor if required, causing all tests once again to pass. 2016-05-10 21:44:11 -04:00
Thomas Harte
5a4262d74e Confirmed: it is inaccurate for a 6502 to self reset at power up. So that responsibility now rests in the machines. 2016-05-10 21:05:52 -04:00
Thomas Harte
9b64f64db7 Attempted to normalise some style decisions.` 2016-04-24 22:32:24 -04:00
Thomas Harte
a6ef78862c This'll probably do for now. 2016-03-24 22:20:00 -04:00
Thomas Harte
f1caf62ff2 Continuing the switch around. 2016-03-24 19:31:41 -04:00
Thomas Harte
738186e323 Edging back towards shifting things to the stack. 2016-03-24 19:17:44 -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
5db0f9e2d5 Shunted a few more things onto the stack. 2016-03-20 22:59:21 -04:00
Thomas Harte
9a82f028aa operation is now also stack local. 2016-03-20 22:52:49 -04:00
Thomas Harte
2f174b3a3e Moved operand to stack-local storage. 2016-03-20 22:50:16 -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
a4ec0b023c Made some type conversions explicit. 2016-03-15 21:25:02 -04:00
Thomas Harte
20ac630e4d Some minor optimisations and timing tweaks. Nothing of substance. 2016-03-10 19:58:50 -05:00
Thomas Harte
1eea28b692 Disabled some debugging parts, added some others, marked some things as inline. Ticking over. 2016-02-22 23:35:42 -05:00
Thomas Harte
baef1ccd57 Made the constructor protected, to emphasise that this class isn't for instantiation. Also added extra comments aplenty. 2016-01-21 08:39:34 -05:00
Thomas Harte
9fa35dd559 Killed some whitespace lines. 2016-01-20 21:58:34 -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
93f7df04a0 Ensured correctly timed sampling of the interrupt line. 2016-01-10 22:55:56 -05:00
Thomas Harte
ccf20299a3 Made an attempt at getting some interrupts all up inside this thing. 2016-01-10 19:06:46 -05:00
Thomas Harte
7341f5c341 This is intended to be enough to start producing something of an output. But something's obviously still broken. 2016-01-09 20:26:40 -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
675070c5dd Very, _very_ minor: switched to normal C++ constructor syntax for simple variable initialisation. 2015-12-06 16:53:37 -05: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
9ca57b80a7 Minor steps to help with diagnostics; all commented out or merely to benefit with breakpoint placement. 2015-08-13 08:43:10 +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
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
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
c1d1fb65cb Made an attempt properly to emulate the RDY line and the Atari's use of it. 2015-07-31 16:54:20 -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
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
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. 2015-07-16 19:56:02 -04:00