Commit Graph

217 Commits

Author SHA1 Message Date
Adrian Conlon
4be4a0603e Refactor the Z80 implementation to:
a) Simplify M1 handling
b) Reuse subtract/add implementations
c) Simplify conditional code blocks.

Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2019-09-14 15:04:46 +01:00
Adrian Conlon
74f70af758 Correct more Z80 disassembler problems (the ZX81 seems to use every instruction available!)
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2019-09-08 21:27:35 +01:00
Adrian Conlon
3e12ba6200 Sigh: Another Z80 interrupt related bug fix. Avoid a loop when an INT occurs, but interrupts are disabled.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2019-09-08 16:28:19 +01:00
Adrian Conlon
0e8813cdf3 Show more state information for debugging output.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2019-09-07 23:57:17 +01:00
Adrian Conlon
254cfbe342 Tidied up pin management to be synchronised with the .Net code.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2019-09-06 23:55:57 +01:00
Adrian Conlon
e1f22f6903 Make it slightly easier to call individual opcodes from external control.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2019-08-31 08:45:04 +01:00
Adrian Conlon
4f47f3fc4d Simplifying the Z80 halt implementation looks better.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2019-08-29 08:51:15 +01:00
Adrian Conlon
2efd53d33a Correct problematic continuation from "halt" on Z80.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2019-08-28 23:06:56 +01:00
Adrian Conlon
4b0cf426b9 Add a couple of missing instructions to the disassembler (used by the ZX Spectrum ROM)
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2019-08-18 17:40:18 +01:00
Adrian Conlon
6940a54355 Update all EightBit projects to VS2019 (Latest SDK, C++17)
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2019-08-17 11:04:29 +01:00
Adrian Conlon
5ed01b61d1 Backport fixes from .Net EightBit library to C++
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2019-08-16 21:56:48 +01:00
Adrian Conlon
5e9014997a Upgraded to VS2019, default SDK.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2019-08-06 13:16:38 +01:00
Adrian Conlon
def1c58e9d Tidy project settings across the EightBit library to be more consistent.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2019-07-06 22:45:16 +01:00
Adrian Conlon
1a0d3ad77a Go through all projects for configuration consistency.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2019-05-05 10:25:44 +01:00
Adrian Conlon
934a1f7025 Use the virtual methods, busRead and busWrite for all processor bus actions.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2019-03-02 21:58:34 +00:00
Adrian Conlon
f0376fa81e Use macros to define our device pins.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2019-01-14 23:17:54 +00:00
Adrian Conlon
92d23d82d6 Start big refactor of device/CPU pin usage (to allow pin events throughout).
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2019-01-14 02:10:17 +00:00
Adrian Conlon
68030610d8 Move to an event driven clock tick event for all CPUs
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2019-01-09 23:24:33 +00:00
Adrian Conlon
a13ad5042a Correct constructions of register16_t: the structure is "#ifdef"ed for different endian arrangements.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2019-01-06 11:27:43 +00:00
Adrian Conlon
f38d326ca7 Improve the flexibility of the BUS mapping/read/write architecture.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2018-12-29 19:17:36 +00:00
Adrian Conlon
d6ebf00ccc Merge branch 'master' of https://github.com/MoleskiCoder/EightBit 2018-12-01 16:46:06 +00:00
Adrian Conlon
679275e930 Correct Linux build errors.
Signed-off-by: Adrian Conlon <adrian.conlon@gmail.com>
2018-12-01 16:41:39 +00:00
Adrian Conlon
dc477cd050 Use explicit enumeration types (improves type safety) where appropriate.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2018-12-01 15:24:29 +00:00
Adrian Conlon
cf0828c595 Tidy the Z80 BIT implementation for better code resuse. No functional change
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2018-12-01 13:01:33 +00:00
Adrian Conlon
e80a5bfcd4 Whoops: the bit instruction *can* have its return value discarded...
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2018-11-29 00:14:44 +00:00
Adrian Conlon
9960ad6012 Tidy return parameter usage a little within the EightBit library.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2018-11-29 00:09:40 +00:00
Adrian Conlon
deb9a6d43c Correct more analysis problems. No functional changes.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2018-11-28 21:27:14 +00:00
Adrian Conlon
a940a29283 Unify build settings across all the EightBit libraries.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2018-11-28 21:24:51 +00:00
Adrian Conlon
a673a64c3f Lots of various changes suggested by the code analysis tools.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2018-11-27 22:36:54 +00:00
Adrian Conlon
555423d10a Tidy the Z80 test classes, based on code analysis.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2018-11-27 22:28:09 +00:00
Adrian Conlon
e156b1ff1a Correct some more compilation warnings (across the whole EightBit project).
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2018-11-25 19:02:11 +00:00
Adrian Conlon
85bc2aab12 Reverse "UNLIKELY" conditions that also contain an else. Helps compilers that have no LIKELY/UNLIKELY macros.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2018-11-25 10:38:30 +00:00
Adrian Conlon
5ff883305e Modernise the signal handling and construction sequence of the Z80 test board.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2018-11-24 10:56:00 +00:00
Adrian Conlon
fdbb28828f Apply the concept of powered components to the "board"
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2018-11-11 16:48:44 +00:00
Adrian Conlon
e688411cb9 Refactor memory related code a little to make the hierarchy of classes a little easier to understand.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2018-11-04 16:38:57 +00:00
Adrian Conlon
8ef5d97366 Update boost from 1.65 -> 1.68
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2018-11-04 12:58:01 +00:00
Adrian Conlon
68a785ceec Add an address masking to the memory mapping structure.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2018-11-01 23:43:29 +00:00
Adrian Conlon
b1af0710ba Tidy the Z80 instruction scheduler a little
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2018-10-28 19:29:14 +00:00
Adrian Conlon
fc7b6e49ca Slightly nicer refactoring of the MEMPTR post increment saga
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2018-10-28 13:33:36 +00:00
Adrian Conlon
b3faae34ae Correct a couple of problematic changes picked up by fuse test
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2018-10-28 09:42:04 +00:00
Adrian Conlon
fac2da9ac4 Start refactoring CPU cores to use C++17/14 features. (This commit covers the 6502 and Z80)
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2018-10-27 18:41:55 +01:00
Adrian Conlon
8dbb3eafec Switch to C++17 standard in all EightBit projects.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2018-10-27 14:28:14 +01:00
Adrian Conlon
1b2ddd8843 Don't expose the bus via the CPU any more: if a component needs the bus, it should be prepared to hold a reference to it.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2018-10-20 20:52:41 +01:00
Adrian Conlon
8d3551e681 Refactor bit set/get routines from processor class to lower level chip class.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2018-09-29 14:08:44 +01:00
Adrian Conlon
7adefd380a Sort a bunch of missing argument const specifications.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2018-09-21 00:16:00 +01:00
Adrian Conlon
fe3794e011 Simplify register16_t usage a little.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2018-09-16 12:00:29 +01:00
Adrian Conlon
7d840f1a42 Modifying the manner in which memory is mapped, allows a fairly clean mechanism for loading Intel "hex" files.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2018-09-15 14:35:59 +01:00
Adrian Conlon
97272d650d Simplify processor bus access a little by further allowing register16_t address access.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2018-08-29 13:52:25 +01:00
Adrian Conlon
a8cc289149 Whoops: The "Bus" class *really* isn't allowed to know the "endianness" of the attached processor!
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2018-08-27 11:27:33 +01:00
Adrian Conlon
3a4235f651 Whoops: The NMI line needs to be powered on by individual processors now it's no longer part of the Processor base class.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2018-08-25 22:50:18 +01:00
Adrian Conlon
1212e8d4f0 Tidy some processor virtual specifications.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2018-08-25 13:35:53 +01:00
Adrian Conlon
c105ee37bf Have a stab at sorting out processor pin handling.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2018-08-25 12:09:26 +01:00
Adrian Conlon
6d4223c368 Start moving towards reset being just another style of interrupt.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2018-08-25 01:34:30 +01:00
Adrian Conlon
677b9a608e Default a couple of project configuration options.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2018-08-17 14:02:00 +01:00
Adrian Conlon
ed76038bfa More memptr adjustments
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2018-08-17 13:59:59 +01:00
Adrian Conlon
256e25e344 Tidy up the test suite usage between the 8080 and Z80 processors. 2018-08-12 16:30:32 +01:00
Adrian Conlon
228301573e Refactor Z80 block in/out routines.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2018-08-12 16:25:30 +01:00
Adrian Conlon
70c70af969 Sort out some exception and member initialisation rules.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2018-08-11 21:19:19 +01:00
Adrian Conlon
e40240694f More removal of duplicated code.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2018-06-24 22:33:02 +01:00
Adrian Conlon
cac871cf2b Remove duplicated code (from const definitions) the performance benefit isn't worth the amount of duplicated code.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2018-06-24 20:58:20 +01:00
Adrian Conlon
757d8f3c32 Reduce code density a little.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2018-06-16 10:09:28 +01:00
Adrian Conlon
7d25962f3c Remove commented block.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2018-06-16 09:56:16 +01:00
Adrian Conlon
67487b5b6e Simplify the usage of the register16_t union.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2018-06-16 00:55:32 +01:00
Adrian Conlon
7cb5e137f4 Some small simplifications of the 16-bit arithmetic operators.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2018-06-11 23:01:48 +01:00
Adrian Conlon
2d8c3d4b12 Simplify AF usage. Keeps speed roughly as before
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2018-06-11 00:50:46 +01:00
Adrian Conlon
fbf098ae00 Simplify memory event handlers and ROM recognition a little (bit of speed difference)
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2018-06-10 22:00:52 +01:00
Adrian Conlon
3e854c7c49 Const some more bus/processor usage, and ensure the data bus is a member, not a reference to memory.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2018-06-10 00:40:56 +01:00
Adrian Conlon
116f9961c4 Add a higher/lower nibble mask
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2018-05-25 22:36:10 +01:00
Adrian Conlon
9de0f597f6 Remove some "tricksy" code from the Z80 emulator chain.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2018-04-14 09:39:06 +01:00
Adrian Conlon
4b4f6b1a49 Some *small* consistency changes. Perhaps some performance gains.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2018-04-11 23:53:26 +01:00
Adrian Conlon
d818095815 MEMPTR is really only a concept of Intel style processors.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2018-03-18 22:40:23 +00:00
Adrian Conlon
97a121b8d4 Unneeded UNREACHABLEs can cause gcc to produce problematic code. TBC
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2018-03-17 23:34:27 +00:00
Adrian Conlon
dac58b121a More small tidyups in the core emulator set.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2018-03-12 01:22:28 +00:00
Adrian Conlon
bebc68539b Correct sneaky reference passing in heavily used method. (~205Mhz emulated speed)
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2018-03-10 10:53:11 +00:00
Adrian Conlon
45dc274167 Get rid of wrappers for bus access: i.e. make it clearer where the bus is being read/written.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2018-03-10 01:53:57 +00:00
Adrian Conlon
c6eb68ba13 Further return by value, rather than reference.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2018-02-26 19:47:35 +00:00
Adrian Conlon
adf506a41e Optimisation: Prefer return by value to return by reference. ~10% speed-up!
Just watch a video by Chandler Carruth from 2015, where he talked about C++ optimisers...

Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2018-02-25 19:48:01 +00:00
Adrian Conlon
d34b161255 Simplify some build options.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2018-02-19 23:18:21 +00:00
Adrian Conlon
29edc46966 Simplify some MEMPTR usage in Intel processors.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2018-01-10 23:08:14 +00:00
Adrian Conlon
3bd01e211e Try to avoid so many virtual calls in the Z80 by hanging onto AF a little longer.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2018-01-09 23:30:51 +00:00
Adrian Conlon
1edabd79f3 More pinout oriented method of executing instructions (especially interrupts)
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2017-12-10 21:41:48 +00:00
Adrian Conlon
3d88a8f6d1 Couple of small changes in LIKELY/UNLIKELY usage.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2017-12-05 21:40:23 +00:00
Adrian Conlon
6a47f710b9 More consistency updates between i8080 and Z80.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2017-12-04 23:41:49 +00:00
Adrian Conlon
f1b3fc1932 Correct at least some of the problems with the Z80 interrupt rewrite
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2017-12-04 21:59:38 +00:00
Adrian Conlon
23f7a88480 Further 8080/Z80 interrupt rewrite
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2017-12-03 00:57:47 +00:00
Adrian Conlon
55b989fe13 More likely/unlikely macro usages.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2017-12-02 14:53:35 +00:00
Adrian Conlon
9cbf76daf2 Correct a couple of LIKELY/UNLIKELY usages.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2017-12-02 10:34:37 +00:00
Adrian Conlon
dc58969614 Whoops: missed Z80 test Makefile.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2017-11-30 15:02:58 +00:00
Adrian Conlon
033969bbe3 Add profile guided optimisation to build configuration (profile/profiled)
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2017-11-30 14:59:24 +00:00
Adrian Conlon
a0f7d584b6 Correct a few warnings reported by "clang"
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2017-11-30 14:37:18 +00:00
Adrian Conlon
11062607e6 Start sharing parts of the linux build system.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2017-11-26 22:10:17 +00:00
Adrian Conlon
c513f0cab1 GSL was too problematic when used with GCC. Removed.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2017-11-20 19:17:49 +00:00
Adrian Conlon
67c27d4a3e GSL + CPP core guidelines changes.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2017-11-18 14:29:30 +00:00
Adrian Conlon
dea1847280 Unify more VS2017 build configurations
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2017-11-12 10:38:05 +00:00
Adrian Conlon
d010e3ca2f Start incorporating CPP core guidelines (as an experiment!)
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2017-11-10 22:41:50 +00:00
Adrian Conlon
b3114ed520 Correct some possible one definition rule issues.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2017-11-05 14:48:15 +00:00
Adrian Conlon
7a0ebb9198 Port to VS2015
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2017-11-05 14:47:38 +00:00
Adrian Conlon
c292fb552e A whole bunch of consistency changes. No functional changes.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2017-11-03 22:05:01 +00:00
Adrian Conlon
ff2f44bbd2 ... and some more linux compatibility changes.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2017-10-29 20:15:49 +00:00
Adrian Conlon
a134d935db More linux compatibility
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2017-10-29 19:53:15 +00:00