1
0
mirror of https://github.com/TomHarte/CLK.git synced 2025-10-03 16:16:32 +00:00

Compare commits

...

2199 Commits

Author SHA1 Message Date
Thomas Harte
20b25ce866 Merge pull request #719 from TomHarte/CleanUps
Standardises on `read` and `write` for bus accesses.
2020-01-05 13:59:02 -05:00
Thomas Harte
c1bae49a92 Standardises on read and write for bus accesses.
Logic being: name these things for the bus action they model, not the effect they have.
2020-01-05 13:40:02 -05:00
Thomas Harte
b3f806201b Merge pull request #718 from TomHarte/BusErrorStack
Adds a test and fixes for the bus error stack frame.
2020-01-05 00:08:53 -05:00
Thomas Harte
9f2f547932 Adds and satisfies test on the function code word.
Thanks to ijor's "68000 Address and Bus Error Stack Frame" re: contents.
2020-01-04 23:58:07 -05:00
Thomas Harte
f0d5bbecf2 Introduces a test of stack contents after an address error.
Fixes: stacked PC, address of fault.
2020-01-04 23:22:07 -05:00
Thomas Harte
3d7ef43293 Merge pull request #717 from TomHarte/JSRA7
Fixes A7-relative JSRs.
2020-01-04 22:29:04 -05:00
Thomas Harte
4578b65487 Merge pull request #716 from TomHarte/PartialDecoding
Clarifies IO decoding, adds YM mirrors.
2020-01-04 22:23:22 -05:00
Thomas Harte
a28c52c250 Fixes A7-relative JSRs.
I completely withdraw my earlier statement re: the test cases.
2020-01-04 22:22:33 -05:00
Thomas Harte
e4349f5e05 Slightly clarifies logic. 2020-01-04 21:32:34 -05:00
Thomas Harte
7b2777ac08 Sorts cases into order; adds copious audio mirrors. 2020-01-04 21:06:21 -05:00
Thomas Harte
0fbcbfc61b Switches to more idiomatic address listing. 2020-01-04 20:35:47 -05:00
Thomas Harte
3ab4fb8c79 Enables an assumption of partial address decoding at the ACIA and PSG. 2020-01-04 17:27:55 -05:00
Thomas Harte
42a9585321 Merge pull request #715 from TomHarte/TestsRedux
After rerunning all tests, adds some notes on questionable results.
2020-01-04 16:41:01 -05:00
Thomas Harte
937cba8978 After rerunning all tests, adds some notes on questionable results.
Also renames a file. But no code changes are currently suggested, at least until I can learn more about DIVU/DIVS.
2020-01-04 16:31:45 -05:00
Thomas Harte
627d3c28ea Merge pull request #714 from TomHarte/STJoystick
Adds Joystick key code mode, ensures events aren't posted in interrogation mode.
2020-01-04 10:01:57 -05:00
Thomas Harte
19ddfae6d6 Adds Joystick key code mode, ensures events aren't posted in interrogation mode.
This should fix Turrican due to the latter change; I'm not aware of software that uses the former.
2020-01-04 09:45:59 -05:00
Thomas Harte
56ebd08af0 Merge pull request #713 from TomHarte/MULUS
Adds DIV and MUL tests, correcting some DIV flags.
2020-01-04 09:22:03 -05:00
Thomas Harte
7de1181213 Make a new guess at post-overflow DIV flags, based on tests.
Specifically: for DIVU, stick with the current guess of a fixed set. For DIVS, leave N and Z alone.
2020-01-03 23:44:49 -05:00
Thomas Harte
c7a5b054db There's no TODO here; overflow is always 0 for a 16x16 multiply.
... and the original 68000 doesn't support 32x32 multiplies.
2020-01-03 22:44:19 -05:00
Thomas Harte
ca12ba297b Renames all files that test multiple opcodes; introduces DIV and MUL tests. 2020-01-03 22:43:24 -05:00
Thomas Harte
7abf527084 Merge pull request #712 from TomHarte/MercsTweaks
Corrects vsync placement and BPP-change pipeline flushing.
2020-01-02 23:50:30 -05:00
Thomas Harte
c0b5bfe726 Ensure no possible return without value. 2020-01-02 23:43:53 -05:00
Thomas Harte
414b0cc234 Reintroduces sync write delay. 2020-01-02 23:36:11 -05:00
Thomas Harte
134e828336 Updates note to self. 2020-01-02 23:33:35 -05:00
Thomas Harte
455e831b87 Corrects bug whereby changing pixel mode mid-line will produce an improper amount of data. 2020-01-02 23:18:21 -05:00
Thomas Harte
617e0bada9 Adds some minor extra testing. Highly duplicative, to be honest. 2020-01-02 23:14:05 -05:00
Thomas Harte
7dea99b1cc Update comment, for sense. 2020-01-02 23:13:12 -05:00
Thomas Harte
42ccf48966 Judging by Pompey Pirates Menu 88, vsync should occur a line earlier, ending during line 0. 2020-01-02 20:16:28 -05:00
Thomas Harte
2f8078db22 Switches to should_log as a global when I'm hacking about. 2020-01-02 20:15:48 -05:00
Thomas Harte
ea45ae78d1 Merge pull request #711 from TomHarte/MoreTests
Introduces further comparative tests, prompting a new CHK fix.
2020-01-01 20:12:07 -05:00
Thomas Harte
cb7d6c185c Further expands test coverage. 2020-01-01 20:00:37 -05:00
Thomas Harte
5be30b1f7b Introduces further comparative tests, prompting a new CHK fix.
Specifically: how to set N when both is_under and is_over are true, and to eliminate a failure fully to prefetch in the longer addressing modes.
2020-01-01 19:11:36 -05:00
Thomas Harte
0bf1a87f4c Merge pull request #710 from TomHarte/STOP
Ensure that an interrupt from a STOP doesn't return to the STOP.
2020-01-01 15:00:11 -05:00
Thomas Harte
b184426f2b Ensure that an interrupt from a STOP doesn't return to the STOP. 2020-01-01 14:51:47 -05:00
Thomas Harte
2456fb120d Merge pull request #709 from TomHarte/MoreMouse
Adds Atari ST mouse support for absolute positioning and inverted scales.
2020-01-01 13:56:25 -05:00
Thomas Harte
23ed9ad2de Corrects application of negative relative scale. 2020-01-01 13:22:21 -05:00
Thomas Harte
017681a97c Now honours permitted mouse range. 2020-01-01 12:48:38 -05:00
Thomas Harte
153f60735d Banishes redefined macro warning. 2020-01-01 12:38:30 -05:00
Thomas Harte
90b899c00e Attempts to implement absolute mouse positioning mode.
Along with mouse direction.
2020-01-01 12:29:33 -05:00
Thomas Harte
5ce8d7c0e5 Merge pull request #708 from TomHarte/KeyboardLogs
Adds necessary logging for further IKYB work.
2019-12-30 23:41:38 -05:00
Thomas Harte
c11fe25537 Merge branch 'master' into EnchantedWoods 2019-12-30 23:32:45 -05:00
Thomas Harte
c4edd635c5 Merge pull request #707 from TomHarte/STGraphicsAgain
Further improves the ST graphics subsystem
2019-12-30 23:31:21 -05:00
Thomas Harte
0a12893d63 Shunts vsync back down to top of frame.
It's guess after guess, basically.
2019-12-30 23:01:31 -05:00
Thomas Harte
8e777c299f Switches to latching video interrupts until acknowledged.
Seems to fix Cisco Heat, at least. I have no idea whether I'm latching the correct thing, whether IACK should clear both or only one, etc.
2019-12-30 23:00:55 -05:00
Thomas Harte
09513ec14c Gets explicit about constexpr expectations here. 2019-12-30 22:58:19 -05:00
Thomas Harte
e23d1a2958 Restores vsync active. 2019-12-29 22:03:36 -05:00
Thomas Harte
6449403f6a Corrects pending_events_ test for sequence points.
Simplifies around as possible.
2019-12-29 21:53:45 -05:00
Thomas Harte
c8fe66092b Attempts to correct insertion logic (and mostly bypasses it). 2019-12-29 21:42:41 -05:00
Thomas Harte
b33218c61e Fixes reload test, which really needs to sense the CRT-headed vsync output.
i.e. not the one heading back to the CPU.
2019-12-29 20:55:34 -05:00
Thomas Harte
8ce26e7182 Adds a delay on vsync visibility (i.e. as to generating an interrupt). 2019-12-29 19:03:08 -05:00
Thomas Harte
47068ee081 Ensures visible hsync end generates a sequence point. 2019-12-29 17:51:50 -05:00
Thomas Harte
5361ee2526 Adds specific Union Demo test. 2019-12-29 17:48:43 -05:00
Thomas Harte
214b6a254a Adds a delay on visibility of the hsync signal, and a test on address reload. 2019-12-29 17:37:09 -05:00
Thomas Harte
93f6964d8a Introduces some preliminary line length unit tests.
Thereby fixes one potential issue with load_ toggling.
2019-12-28 22:50:34 -05:00
Thomas Harte
13f11e071a Simplifies border colour change propagation.
I'm not sure it was even technically correct as was.
2019-12-28 10:45:10 -05:00
Thomas Harte
f7825dd2a2 Pulls out address reload position as a separate constant. 2019-12-28 10:36:50 -05:00
Thomas Harte
a9d1f5d925 Pulls out address reload as something I can position independently.
Sadly receding it by 3 did not have the effect I was hoping for, of receding Enchanted Land's first register tweaking.
2019-12-27 23:47:19 -05:00
Thomas Harte
2757e5d600 Removes untrue comment. 2019-12-27 22:51:11 -05:00
Thomas Harte
5026de9653 Rejigs the video stream to ensure shifter really is continuous.
... and definitively to avoid potential buffer overruns. Or, at least, to have a mechanism in place definitively to avoid them. Which will be tested and debugged as necessary.

Also simplifies the colour burst and border/pixels selection logic.
2019-12-27 22:47:34 -05:00
Thomas Harte
5fa8e046d8 It's inaccurrate to call this _the_ shifter. So don't. 2019-12-27 19:03:10 -05:00
Thomas Harte
ec9357e080 Merge pull request #706 from TomHarte/Vic20Flags
Permits Vic-20 memory to be specified in banks;
2019-12-26 23:04:56 -05:00
Thomas Harte
f8dd33b645 Adds necessary header for strcmp. 2019-12-26 22:53:09 -05:00
Thomas Harte
de43e86310 Permits Vic-20 memory to be specified in banks; adds recognition of TheC64-style file tags to specify them. 2019-12-26 22:49:48 -05:00
Thomas Harte
314973a5ef Merge pull request #704 from TomHarte/RTR
Corrects implementation of RTR
2019-12-25 20:47:21 -05:00
Thomas Harte
d26ce65236 Introduces an RTR test. 2019-12-25 19:50:12 -05:00
Thomas Harte
1de4f179c0 Adds more thorough comment on the bus program used. 2019-12-25 19:49:49 -05:00
Thomas Harte
3cb5684d95 Fixes RTR: the whole top half of the SR should be preserved.
Specifically, the 68000 Reference Manual says: "The supervisor portion of the status register is unaffected." Clearly when I first read that I misread it as the supervisor _flag_ (rather than _portion_) should be preserved.
2019-12-25 19:49:20 -05:00
Thomas Harte
a9a92de954 Adds a bunch of shout-outs for unimplemented behaviour. 2019-12-25 15:32:33 -05:00
Thomas Harte
daacd6805e Merge pull request #703 from TomHarte/Sup133
Fixed: the final track field in an MSA is inclusive, not exclusive.
2019-12-24 23:30:04 -05:00
Thomas Harte
54fe01b532 Fixed: the final track is inclusive, not exclusive. 2019-12-24 23:08:16 -05:00
Thomas Harte
42dd70dbff Merge pull request #702 from TomHarte/NZStory
Corrects WD track-zero and write-protect flags.
2019-12-24 22:22:24 -05:00
Thomas Harte
e59de71d79 Disables status logging, at least until next needed. 2019-12-24 21:44:50 -05:00
Thomas Harte
a8ba3607b7 Adds (and disables) a minor additional piece of logging. 2019-12-24 21:43:39 -05:00
Thomas Harte
4205e95883 Switches to capture of the track 0 flag during a type 1 operation. 2019-12-24 21:43:20 -05:00
Thomas Harte
f633cf4c3f Adds a basic implementation of the non-instantaneous index pulse. 2019-12-24 21:05:17 -05:00
Thomas Harte
dfa6b11737 Adds responsibility for an ongoing index pulse to the drive. 2019-12-24 20:53:37 -05:00
Thomas Harte
42926e72cc Adjusted: Flag::WriteProtect works in real time for a type-1 status. 2019-12-24 19:57:12 -05:00
Thomas Harte
80cb06eb33 It provisionally seems as though spin_up should be reset by a force interrupt? 2019-12-24 19:37:37 -05:00
Thomas Harte
5068328a15 Fixes debugging output. 2019-12-24 19:15:58 -05:00
Thomas Harte
adc2b77833 Enhances with constexpr. 2019-12-24 18:53:50 -05:00
Thomas Harte
99415217dc Merge pull request #701 from TomHarte/TestsSyntax
Corrects syntax errors in test suite.
2019-12-23 22:15:16 -05:00
Thomas Harte
48d519d475 Merge branch 'master' into TestsSyntax 2019-12-23 22:13:55 -05:00
Thomas Harte
ed831e5912 Fixes test syntax errors. 2019-12-23 22:13:25 -05:00
Thomas Harte
1db7c7989b Merge pull request #700 from TomHarte/NoNew
Embraces std::make_[unique/shared] in place of .reset(new .
2019-12-23 22:05:57 -05:00
Thomas Harte
b2bed82da6 Switches to standard logging. 2019-12-23 22:00:40 -05:00
Thomas Harte
afae1443b4 Merge branch 'master' into NoNew 2019-12-23 21:32:17 -05:00
Thomas Harte
0dae608da5 Embraces std::make_[unique/shared] in place of .reset(new . 2019-12-23 21:31:46 -05:00
Thomas Harte
8a1fe99fa4 Merge pull request #699 from TomHarte/SpuriousCRCErrors
Ensure the WD won't confuse sector contents for header content.
2019-12-23 21:15:15 -05:00
Thomas Harte
ac604b30f3 Eliminates dangling static_casts in favour of construction. 2019-12-22 20:59:20 -05:00
Thomas Harte
b035b92f33 Corrects accidental use of sector contents as addresses in multi-sector reads and writes.
As a secondary defect, this was also causing erroneous CRC error reports.
2019-12-22 19:58:02 -05:00
Thomas Harte
d25b48878c Cleans up READ_ID macro, inter alia. 2019-12-22 17:58:33 -05:00
Thomas Harte
34a3790e11 Minor static_cast clean-ups. 2019-12-22 17:56:59 -05:00
Thomas Harte
f3378f3e3e Merge pull request #698 from TomHarte/MoreScreenshots
Adds many additional screenshots.
2019-12-22 14:43:08 -05:00
Thomas Harte
78accc1db1 Seeks to fix macOS desktop picture. 2019-12-22 14:41:13 -05:00
Thomas Harte
a756985e18 Makes a further attempt at this table. 2019-12-22 14:40:02 -05:00
Thomas Harte
30e0d4aa30 Attempts a table fix. 2019-12-22 14:37:59 -05:00
Thomas Harte
de72c66c64 Adds a full image gallery, trying to hit every supported system.
... that isn't already pictured, that is.
2019-12-22 14:36:33 -05:00
Thomas Harte
6edd3c9698 Merge pull request #697 from TomHarte/MoreConstexpr
Further propagates `constexpr`.
2019-12-22 13:53:44 -05:00
Thomas Harte
5456a4a39d Eliminates static where constexpra aren't class members; adds some if constexprs for clarity. 2019-12-22 13:42:24 -05:00
Thomas Harte
66d9b60b98 Merge pull request #696 from TomHarte/make_shared
Makes a variety of minor style improvements
2019-12-22 00:27:57 -05:00
Thomas Harte
274867579b Deploys constexpr as a stricter const. 2019-12-22 00:22:17 -05:00
Thomas Harte
a847654ef2 Corrects various old-fashioned bits of indentation, plus the odd const. 2019-12-22 00:00:23 -05:00
Thomas Harte
05d77d3297 Also deploys make_unique/shared to avoid type repetition. 2019-12-21 23:52:04 -05:00
Thomas Harte
e9318efeb6 Switches to std::make_shared/make_unique in a bunch of applicable places.
No doubt many more similar improvements are available, these are just the ones that were easy to find.
2019-12-21 23:34:25 -05:00
Thomas Harte
25da5ebdae Merge pull request #695 from TomHarte/68000ByteAccess
Corrects 16-bit view of the 68000 bus during 8-bit operations.
2019-12-21 21:08:39 -05:00
Thomas Harte
cf16f41939 Makes value8_high/low and value16 branchless. 2019-12-21 20:58:37 -05:00
Thomas Harte
08f2877382 I think the 68000 actually loads a byte value onto both the upper and lower data lines. 2019-12-21 20:37:03 -05:00
Thomas Harte
6f4444d834 Merge pull request #694 from TomHarte/C++17
Standardises on -O2, C++17.
2019-12-21 20:32:04 -05:00
Thomas Harte
993dfeae1b Standardises on -O2, C++17. 2019-12-21 20:25:43 -05:00
Thomas Harte
b4fd506361 Merge pull request #693 from TomHarte/STComposite
Adds colour composite output to the ST
2019-12-21 00:04:54 -05:00
Thomas Harte
e5440a4146 Hacks in a colour burst.
With a major flaw: it's implicit. I think I need a minor rethink of various components here.
2019-12-20 23:49:38 -05:00
Thomas Harte
57ce10418f Switches prescale logic, the better to deal with changes in prescaler.
According to my assumptions about the behaviour, anyway.
2019-12-20 23:33:14 -05:00
Thomas Harte
47508d50a7 Wires through a composite video option for the ST.
Which is great and all, except that I've not yet inserted a colour burst. So it's monochrome.
2019-12-20 20:49:14 -05:00
Thomas Harte
56cc191a8b Merge pull request #692 from TomHarte/11Sectors
Compacts gaps when necessary to fit more sectors.
2019-12-19 23:33:25 -05:00
Thomas Harte
2a1520c04e Removes mostly-uninformative piece of logging. 2019-12-19 22:58:28 -05:00
Thomas Harte
3d83f5ab49 Ensures a proper size handoff and implements a ripple feature I happened to find a forum post about. 2019-12-19 22:58:07 -05:00
Thomas Harte
0007dc23b3 Eliminates bit 0 of the DMA address. 2019-12-19 22:44:21 -05:00
Thomas Harte
416d68ab3a Installs some additional safety guards. 2019-12-19 22:27:50 -05:00
Thomas Harte
ed7f171736 Moves address reload to end of vertical sync.
I have no information as to when it should be, so this is as valid a guess as any other.
2019-12-19 22:20:43 -05:00
Thomas Harte
0e066f0f70 Removes 'done' TODO.
For certain values of done.
2019-12-19 22:19:59 -05:00
Thomas Harte
3e6f51f5cf Merge branch '11Sectors' of github.com:TomHarte/CLK into 11Sectors 2019-12-19 19:36:33 -05:00
Thomas Harte
797abae4b3 Compacts gaps when necessary to fit more sectors. 2019-12-19 19:36:19 -05:00
Thomas Harte
4605b1b264 Compacts gaps when necessary to fit more sectors. 2019-12-19 19:22:48 -05:00
Thomas Harte
d802e8aee3 Merge pull request #690 from TomHarte/YMNotAY
Adds explicit emulation of the YM2149F.
2019-12-18 22:10:16 -05:00
Thomas Harte
206ab380c7 Introduces double-resolution envelopes for the Atari ST. 2019-12-18 22:03:02 -05:00
Thomas Harte
d85ae21b2f Adds an explicit declaration of chip type to all AY users. 2019-12-18 19:28:41 -05:00
Thomas Harte
470cc572fd Merge pull request #689 from TomHarte/STScreenshot
Adds a token Atari ST screenshot.
2019-12-17 23:29:43 -05:00
Thomas Harte
f0d9d8542b Adds a token Atari ST screenshot. 2019-12-17 23:28:38 -05:00
Thomas Harte
d2390fcb11 Merge pull request #688 from TomHarte/NewAtari
Adds the Atari ST to File -> New in Cocoa world.
2019-12-17 23:18:13 -05:00
Thomas Harte
5ce612cb38 Adds the Atari ST to File -> New in Cocoa world. 2019-12-17 23:04:12 -05:00
Thomas Harte
ec7aa2d355 Merge pull request #687 from TomHarte/68000Tests
Significantly increases 68000 testing
2019-12-17 22:31:54 -05:00
Thomas Harte
9464658d1e Adds a count summary. 2019-12-17 22:19:23 -05:00
Thomas Harte
a3e64cae41 Corrects SBCD carry. 2019-12-17 22:16:02 -05:00
Thomas Harte
e969b386f1 Eliminates DIVU/S and MULU/S from this file. 2019-12-17 20:15:11 -05:00
Thomas Harte
af9c0aca97 Added mention of the Atari ST. 2019-12-17 14:36:08 -05:00
Thomas Harte
8a2ac87209 Reverted SBCD/NBCD V behaviour. 2019-12-16 23:08:59 -05:00
Thomas Harte
096b447b4b Corrects MOVE -(An), SR/CCR, which was not previously decrementing.
Also adds a safety check against other instances of the same error. There seem to be none.
2019-12-16 22:38:54 -05:00
Thomas Harte
0d23f141d6 Regenerates without accidentally hitting MODE to SR. 2019-12-16 22:37:57 -05:00
Thomas Harte
84167af54f Corrects CHK N flag. 2019-12-16 20:01:33 -05:00
Thomas Harte
8be26502c4 Fixes NBCD -(An)+, adds some additional comments. 2019-12-16 20:01:19 -05:00
Thomas Harte
ba2436206f Withdraws test of CHK (exception taken). 2019-12-16 20:00:42 -05:00
Thomas Harte
60a9b260b1 Corrects collection of instruction codes. 2019-12-16 00:01:18 -05:00
Thomas Harte
e603fc6aaa Simplifies failure output for me. 2019-12-15 21:26:47 -05:00
Thomas Harte
81cc278b98 Introduces a barrage of further tests. 2019-12-15 21:26:35 -05:00
Thomas Harte
4c068e9bb8 Corrects flags on CMPA.w. 2019-12-15 20:39:47 -05:00
Thomas Harte
f23c5ada31 Ensures tests can be built as a release target. 2019-12-14 23:53:12 -05:00
Thomas Harte
dc1abd874e Corrects indentation typo. 2019-12-14 23:52:53 -05:00
Thomas Harte
1bf4686c59 Adds plentiful additional tests. Though still only a fraction of the anticipated total. 2019-12-14 22:58:51 -05:00
Thomas Harte
a500fbcd73 Expands tests to most of ORI, EORI, ANDI, ADDI and SUBI. 2019-12-14 22:23:40 -05:00
Thomas Harte
d0ef41f11e Adds a temporary manual escape clause for testing specific features. 2019-12-14 21:40:21 -05:00
Thomas Harte
adf6723bf6 Ensures state is evaluated directly at opcode end. 2019-12-14 15:09:06 -05:00
Thomas Harte
37e26c0c37 Eliminates a class of incorrect sign comparison errors. 2019-12-14 14:50:39 -05:00
Thomas Harte
ac1575be27 Resolves false negatives from checking wrong state. 2019-12-14 14:46:00 -05:00
Thomas Harte
923287bf01 Attempts to introduce a basic means for comparative 68000 testing.
i.e. mine versus another source.
2019-12-14 14:26:33 -05:00
Thomas Harte
77fe14cdb3 Merge pull request #685 from TomHarte/LoadDelay
Adds a delay on load following DE
2019-12-13 21:38:10 -05:00
Thomas Harte
c00ae7ce6a Adds a one-cycle delay on frequency changes. 2019-12-13 19:57:54 -05:00
Thomas Harte
d5b2e6514a Merge branch 'master' into LoadDelay 2019-12-13 19:41:35 -05:00
Thomas Harte
fc7f46006e Merge pull request #686 from TomHarte/AptGet
Adds an apt-get update.
2019-12-13 13:32:18 -05:00
Thomas Harte
41503d7253 Allow releaseinfo changes. 2019-12-13 13:16:24 -05:00
Thomas Harte
f88c942fef Adds an apt-get update. 2019-12-12 23:26:12 -05:00
Thomas Harte
4bcf217324 Ensures delayed loading isn't interrupted by blank, hsync. 2019-12-12 23:20:28 -05:00
Thomas Harte
f6f2b4b90f Removes double DE edge test. 2019-12-12 22:50:35 -05:00
Thomas Harte
95b5db4d87 Tweaks timings yet further, adds a FIFO reset.
The accuracy of this may require further research.
2019-12-11 23:22:20 -05:00
Thomas Harte
de4403e021 Corrects blank timing. 2019-12-10 22:17:57 -05:00
Thomas Harte
0a405d1c06 Introduces a latency between DE and load. 2019-12-10 21:24:15 -05:00
Thomas Harte
768b3709b8 Corrects audio clock rate. 2019-12-10 20:25:27 -05:00
Thomas Harte
7cc5d0b209 Merge pull request #683 from TomHarte/MFPPerformance
Switch to faster timer implementation; it seems to work.
2019-12-09 19:52:16 -05:00
Thomas Harte
c2646a415f Switch to faster timer implementation; it seems to work. 2019-12-09 19:23:08 -05:00
Thomas Harte
e1c7a140d0 Merge pull request #682 from TomHarte/AddressError
ST: Adds some initial bus error logic, plus some optimisations.
2019-12-08 22:53:40 -05:00
Thomas Harte
7cd11ecb7f Adds necessary #include for assert. 2019-12-08 22:43:39 -05:00
Thomas Harte
4dd235f677 Adds supervisor/user to logged flags in trace mode. 2019-12-08 22:39:10 -05:00
Thomas Harte
a7cfb840ef Adds but presently disables a diagnostic for border elimination. 2019-12-08 22:34:42 -05:00
Thomas Harte
acfe2c63b8 Adds an assert to verify the interrupt line is clear after a full reset. 2019-12-08 22:34:19 -05:00
Thomas Harte
b192381928 Implements a fuller reset, takes a run at the overran flag. 2019-12-08 21:20:06 -05:00
Thomas Harte
c785797da6 Adds a warning for unhandled reset. 2019-12-08 21:01:30 -05:00
Thomas Harte
0408592ada Switches to byte buffers and seeks to reduce unnecessary video flushing. 2019-12-08 20:20:13 -05:00
Thomas Harte
407cc78c78 Extends to offer simpler 8-bit access handling. 2019-12-08 20:19:44 -05:00
Thomas Harte
4536c6a224 Resolves printf type errors. 2019-12-08 11:56:05 -05:00
Thomas Harte
0ed87c61bd Introduces an explicit area of floating bus, starts adding bus errors. 2019-12-08 11:52:43 -05:00
Thomas Harte
332f0d6167 Ensures MSAs are explicitly read-only. 2019-12-08 11:52:15 -05:00
Thomas Harte
08a27bdec7 NTSC frame length is correct; removes TODO. 2019-12-08 11:51:12 -05:00
Thomas Harte
288cabbad1 Merge pull request #680 from TomHarte/EventCountReload
Implements MFP timer reload when in event counting mode.
2019-11-19 22:54:34 -05:00
Thomas Harte
7ff57f8cdf Starts to flesh out documentation. 2019-11-19 22:32:07 -05:00
Thomas Harte
06edeea866 Adds reload during event count mode.
Plus a helpful bit of TODO.
2019-11-19 22:24:32 -05:00
Thomas Harte
3c77d3bda0 Merge pull request #679 from TomHarte/OffByOne
Corrects off-by-one error in the ST's vertical state machine
2019-11-19 22:02:41 -05:00
Thomas Harte
72cb3a1cf6 Integrates basic unit test for Atari ST video event prediction. 2019-11-19 21:54:13 -05:00
Thomas Harte
e0ceab6642 Pivots towards looking at Timer B as a cause of in-frame inaccuracy. 2019-11-19 21:52:50 -05:00
Thomas Harte
894066984c Moves beginning and end of vertical sync to what I now believe is its proper place.
At least one demo now successfully opens the top border.
2019-11-19 20:13:47 -05:00
Thomas Harte
c91495d068 Merge pull request #678 from TomHarte/DEDelay
Introduces a 28-cycle delay on DE propagation
2019-11-18 23:53:46 -05:00
Thomas Harte
e787c03530 Slightly shortens NTSC frame.
Either: (i) 263 is incorrect; or (ii) my logic as to frame height is incorrect. Given that the horizontal side of things is really well documented, I'm currently guessing (i). Research to do.
2019-11-18 23:47:27 -05:00
Thomas Harte
b12136691a Corrects comment. 2019-11-18 23:46:33 -05:00
Thomas Harte
c04d2f6c6e Restricts DTack delay to RAM and Shifter accesses. 2019-11-18 22:57:13 -05:00
Thomas Harte
6990abc0d3 Tweaks selected output mode when both BPP bits are set. 2019-11-18 22:56:40 -05:00
Thomas Harte
0ce5057fd9 Attempts to factor in event counting direction. 2019-11-18 22:37:20 -05:00
Thomas Harte
ade8df7217 Permits a delay on DE propagation back to the CPU. Plus tests.
Currently set at 28 cycles, but I don't know.
2019-11-18 22:12:24 -05:00
Thomas Harte
b98703bd5b Corrects lack of const. 2019-11-18 22:11:52 -05:00
Thomas Harte
82c984afa4 Switches the joysticks around.
Thereby finally allowing me to control mode games.
2019-11-18 20:02:27 -05:00
Thomas Harte
1202b0a65f Establishes a pipeline for delayed public state visibility. 2019-11-17 23:28:00 -05:00
Thomas Harte
facc0a1976 Amps up the documentation. 2019-11-17 21:28:51 -05:00
Thomas Harte
25da8b7787 Merge pull request #677 from TomHarte/SyncDisturbance
Corrects accidental dropping of pixel residue.
2019-11-17 18:47:27 -05:00
Thomas Harte
253dd84109 Corrects accidental dropping of pixel residue.
Specific issue: the repeated (start_column != end_column) test, which can no longer be correct if start_column has been incremented in the (x_&7) test.

The visible effect was to omit pixels from the output wave, which also affected observed sync timing.
2019-11-17 18:34:13 -05:00
Thomas Harte
9d07765823 Ensures proper precedence of * over %. 2019-11-14 23:19:31 -05:00
Thomas Harte
11de0e198f Removes dead travis.yml.
Travis never worked; GitHub actions do; that's CI.
2019-11-14 19:58:24 -05:00
Thomas Harte
f16f0897d5 Merge pull request #676 from TomHarte/BuildWorkflow
Adds continuous integration via GitHub actions.
2019-11-14 13:59:52 -05:00
Thomas Harte
3d4d45ef62 Remove redundant 'build' 2019-11-14 13:54:24 -05:00
Thomas Harte
04c4f5f321 Removes syntax violating colon. 2019-11-14 13:53:24 -05:00
Thomas Harte
fa900d22e8 Adds a more manageable title. 2019-11-14 13:52:24 -05:00
Thomas Harte
aee2890b25 Switch to title case.
This seems to fit better with the fixed named steps.
2019-11-14 13:50:03 -05:00
Thomas Harte
40e1ec28fb Attempt sudo.
Sorry for the noise; there's no obvious better way to test this stuff.
2019-11-14 13:42:56 -05:00
Thomas Harte
c6e2b1237c Add build workflow 2019-11-14 13:40:06 -05:00
Thomas Harte
efdd27a435 Merge pull request #675 from TomHarte/STFileFormat
Adds support for .ST files.
2019-11-12 23:32:47 -05:00
Thomas Harte
2c4f372872 Adds support for the .ST file format. 2019-11-12 23:23:14 -05:00
Thomas Harte
74be876d72 Corrects track count calculation for DSD disks. 2019-11-12 23:22:56 -05:00
Thomas Harte
e8e166eec5 Ensures no out-of-disk-bounds mirroring. 2019-11-12 23:22:25 -05:00
Thomas Harte
4ec8fa0d20 Merge branch 'LessACIAState' 2019-11-12 22:34:02 -05:00
Thomas Harte
b019c6f8dd Merge pull request #674 from TomHarte/LessACIAState
Reduces redundant ACIA state.
2019-11-12 22:32:47 -05:00
Thomas Harte
6ec3c47cc0 Ensures same-level interrupts don't double trigger. 2019-11-12 22:18:13 -05:00
Thomas Harte
ccce127f13 Merge branch 'master' into LessACIAState 2019-11-12 19:41:18 -05:00
Thomas Harte
f4cfca0451 Merge branch 'master' of github.com:TomHarte/CLK 2019-11-12 19:38:44 -05:00
Thomas Harte
eb287605f7 Switches to a default of TOS 1.04. 2019-11-12 19:38:30 -05:00
Thomas Harte
2026761a07 Merge pull request #673 from TomHarte/FewerSpans
Reduces Atari ST output heft
2019-11-12 19:37:53 -05:00
Thomas Harte
6a82c87320 Withdraws border optimisation temporarily; I think I may be onto an output bug here. 2019-11-12 19:33:13 -05:00
Thomas Harte
f0478225f0 Adjusts logic to reduce number of output spans. 2019-11-12 19:30:28 -05:00
Thomas Harte
d6edfa5c6d Removes the redundant state encased within interrupt_causes_. 2019-11-11 21:49:02 -05:00
Thomas Harte
e7253a8713 Merge pull request #672 from TomHarte/BetterShifter
Introduces a cleaner, separated shifter.
2019-11-10 21:56:45 -05:00
Thomas Harte
c6f6bc68e1 Undoes non-insertion of media. 2019-11-10 21:52:06 -05:00
Thomas Harte
ab34fad8ca Introduces a cleaner, separated shifter. 2019-11-10 21:39:40 -05:00
Thomas Harte
e4c77614c1 Merge pull request #671 from TomHarte/STJoystick
Makes joysticks a little more const correct
2019-11-09 22:11:11 -05:00
Thomas Harte
072b0266af It seems status reads are not required to clear the interrupt line. 2019-11-09 20:12:09 -05:00
Thomas Harte
7ae0902103 Adds additional joystick commands to the dispatcher. 2019-11-09 20:10:54 -05:00
Thomas Harte
8e9428623e Adds joystick events to the Atari ST. 2019-11-09 18:39:22 -05:00
Thomas Harte
2c25135d8a Fixes const correctness for joystick machines; the ST is now one such. 2019-11-09 18:19:05 -05:00
Thomas Harte
3741cba88c Merge pull request #670 from TomHarte/STKeyboard
Corrects: KeyPad -> Keypad. Also fleshes out Atari ST keyboard mapping.
2019-11-09 18:05:52 -05:00
Thomas Harte
860837d894 Corrects: KeyPad -> Keypad. Also fleshes out Atari ST keyboard mapping. 2019-11-09 18:02:14 -05:00
Thomas Harte
cef07038c1 Merge pull request #662 from TomHarte/AtariST
Adds basic and very buggy Atari ST emulation.
2019-11-09 16:18:50 -05:00
Thomas Harte
0bf61c9c99 Updated: there is some ST emulation here now. 2019-11-09 16:18:29 -05:00
Thomas Harte
837dfd1ab8 Corrects StaticAnalyser references. 2019-11-09 16:14:00 -05:00
Thomas Harte
0204003680 Resolves GCC warnings. 2019-11-09 16:12:37 -05:00
Thomas Harte
5fc4e57db7 Eliminates non-portable use of fls. 2019-11-09 16:03:00 -05:00
Thomas Harte
c4fefe1eb3 Updates SConstruct. 2019-11-09 15:42:19 -05:00
Thomas Harte
77ef7dc8fc Shuffles ST and 2600 into a common parent. 2019-11-09 15:31:41 -05:00
Thomas Harte
e3abbc9966 Renames what didn't end up being a whole SerialPort. 2019-11-09 15:21:51 -05:00
Thomas Harte
70c6010fe0 Expands visible area and adds a few more safety barriers. 2019-11-09 15:00:42 -05:00
Thomas Harte
8c736a639a Eliminates unexpected bottleneck created by ACIA. 2019-11-09 15:00:12 -05:00
Thomas Harte
cc7ff1ec9e Corrects typo. 2019-11-09 14:59:35 -05:00
Thomas Harte
9d12ca691f Makes meaning of 2048 here explicit. 2019-11-09 14:59:16 -05:00
Thomas Harte
db03b03276 Corrects [AND/OR/EOR].bw Dn, -(An) to decrement destination.
It was previously doing a predecrement on the internal source address, which is unused. This fixes at least Dan Dare III and Silkworm.
2019-11-09 11:25:23 -05:00
Thomas Harte
45375fb5d0 Makes endian aware. 2019-11-09 09:48:59 -05:00
Thomas Harte
d2324e413d Clarifies ownership of bpp-has-changed test. 2019-11-09 00:10:59 -05:00
Thomas Harte
e0c15f43bb Avoids massive over-flushing of pixel buffers. 2019-11-09 00:05:02 -05:00
Thomas Harte
8b0d550b81 Attempts to move vertical sync out to cycle 30. 2019-11-08 22:18:47 -05:00
Thomas Harte
d1259f829e Moves vertical state decisions back to cycle 502. 2019-11-08 21:42:05 -05:00
Thomas Harte
7caef46c05 Switches back to hsync for interrupts; corrects current address reads. 2019-11-08 21:25:28 -05:00
Thomas Harte
6902251d8b Fixed: returns video address in bytes, not words. 2019-11-08 20:47:08 -05:00
Thomas Harte
0b683b0360 Adds some sanity checks. 2019-11-08 20:46:24 -05:00
Thomas Harte
5d5dc79f2c Corrects raster race condition with CPU. 2019-11-07 23:27:05 -05:00
Thomas Harte
68f9084d9e Fixes timing of wrap. 2019-11-07 23:24:51 -05:00
Thomas Harte
b7c407be10 The palette is meant to be read/write. 2019-11-07 23:11:06 -05:00
Thomas Harte
f45798faf0 Corrects initial safe value of line_length_. 2019-11-07 22:53:26 -05:00
Thomas Harte
7c66d7a13c Corrects sync and line-length latch timings. 2019-11-07 22:53:04 -05:00
Thomas Harte
f9a35c6636 Corrects potential wrap error for non-single-byte targets. 2019-11-07 22:23:26 -05:00
Thomas Harte
5e1570258d I think the horizontal interrupt is blank, not sync. 2019-11-07 22:00:50 -05:00
Thomas Harte
fc8021c0b0 Adds a centre crop. 2019-11-07 20:02:45 -05:00
Thomas Harte
c9cd56915e Corrects typo that was adding an extra line of PAL video. 2019-11-07 19:55:49 -05:00
Thomas Harte
1fd19c5786 Attempts to add proper bus timing. 2019-11-07 19:55:00 -05:00
Thomas Harte
ce66b5fd9c Corrected member variable names. 2019-11-07 19:44:22 -05:00
Thomas Harte
8aa425c9d8 Fixes medium resolution mode. 2019-11-06 23:25:36 -05:00
Thomas Harte
ec68bc5047 Corrects output glitches: channel de sync and improper border beginnings. 2019-11-06 22:37:05 -05:00
Thomas Harte
0971bbeebe Merge branch 'master' into AtariST 2019-11-05 23:24:26 -05:00
Thomas Harte
9292f66c2d Merge pull request #669 from TomHarte/WOZDoc
Update explanation of NIB processing.
2019-11-05 23:21:25 -05:00
Thomas Harte
f3e2e88986 Update explanation of NIB processing. 2019-11-05 23:20:20 -05:00
Thomas Harte
6afefa107e Resolves unused variable warning. 2019-11-05 23:18:25 -05:00
Thomas Harte
0ce807805d Eliminates most masks, at least for now. 2019-11-05 23:17:59 -05:00
Thomas Harte
41f3c29e30 Attempts to switch to correct video state machine.
Some glitches remain to be ironed out.
2019-11-05 23:02:25 -05:00
Thomas Harte
6c75c60149 Merge branch 'master' into AtariST 2019-11-05 22:05:51 -05:00
Thomas Harte
015f2101f8 Merge pull request #668 from TomHarte/OverAllocation
Resolves a potential out-of-bounds array access.
2019-11-05 21:52:44 -05:00
Thomas Harte
35f1a7ab10 Resolves a potential out-of-bounds array access.
Risk was: allocation exactly joins end of buffer. In which case the next get_data won't wrap the texture y coordinate since it won't spot an x overage.
2019-11-05 21:47:40 -05:00
Thomas Harte
8df1eea955 Goes big on flushing. 2019-11-03 23:03:50 -05:00
Thomas Harte
eeafdf2c03 Slightly expands list of recognised Intelligent Keyboard commands. 2019-11-03 21:58:15 -05:00
Thomas Harte
befe2c2929 Adds floppy drive activity indicators. 2019-11-03 21:57:54 -05:00
Thomas Harte
46ec3510be Fixed: ST sectors are numbered from 1, not 0. 2019-11-03 21:18:29 -05:00
Thomas Harte
e9965c2738 Obeys stated memory size. 2019-11-03 21:18:17 -05:00
Thomas Harte
48b0d8c329 Adds bus req/ack to the DMA controller; hacks support into the ST. 2019-11-03 21:11:25 -05:00
Thomas Harte
07582cee4a BusGrant is a further signal I will need. 2019-11-03 21:10:42 -05:00
Thomas Harte
4dbd2a805a Nudges closer to DMA support. 2019-11-03 17:24:36 -05:00
Thomas Harte
20bf425f98 Drive select lines are active low. 2019-11-02 23:37:56 -04:00
Thomas Harte
0567410bcf Attempts to start getting the WDC working. 2019-11-02 23:26:42 -04:00
Thomas Harte
6d1e09ba55 Connects up the AY to floppy drive/side selection. 2019-11-02 23:04:08 -04:00
Thomas Harte
f40dbefa67 Implements most of keyboard input. 2019-11-02 22:30:02 -04:00
Thomas Harte
f93cdd21de Reverses bit order.
So, for the first time: a green desktop.
2019-11-02 21:53:04 -04:00
Thomas Harte
e1dc3b1915 Reverses mouse buttons.
So I can now navigate the disk-less GEM desktop and click on things.
2019-11-02 21:38:57 -04:00
Thomas Harte
cbf25a16dc Adds relative mouse motion input. 2019-11-02 21:25:45 -04:00
Thomas Harte
14e790746b Fixes return value when reading received data. 2019-11-02 21:25:00 -04:00
Thomas Harte
bf7e9cfd62 Pulls the intelligent keyboard into its own file. 2019-11-02 19:47:44 -04:00
Thomas Harte
a67e0014a4 Fixes video base address and mono/colour monitor value.
Now I see a GEM desktop. In blue.
2019-11-02 19:36:15 -04:00
Thomas Harte
c070f2100c Attempts to regularise data bus access. 2019-11-01 23:01:06 -04:00
Thomas Harte
75e34b4215 Reacts to no acknowledgement. 2019-10-31 21:00:05 -04:00
Thomas Harte
a5bbf54a27 Adds the ability for the 68901 to decline an interrupt acknowledgement. 2019-10-31 19:57:36 -04:00
Thomas Harte
5309ac7c30 Annotates JustInTimeActor as force inline. 2019-10-30 23:18:42 -04:00
Thomas Harte
731dc350b4 Adds sometime real-time clocking for DMA. 2019-10-30 22:59:32 -04:00
Thomas Harte
635e18a50d Ensures the MFP requests and receives real-time clocking when needed. 2019-10-30 22:42:06 -04:00
Thomas Harte
4857ceb3eb Attempts to get a bit more systematic.
Spotted that interrupt_enable_ isn't being used properly while doing so, hopefully that's now correct.
2019-10-29 23:16:08 -04:00
Thomas Harte
1c154131f9 Expands size of storage in Cycles/HalfCycles; adjusts widely to compensate. 2019-10-29 22:36:29 -04:00
Thomas Harte
fd02b6fc18 Corrects in-service test; adds pending clearing upon enabled clearing. 2019-10-28 22:51:00 -04:00
Thomas Harte
553f3b6d8b Properly conforms to GPIP input/output blending. 2019-10-28 22:37:11 -04:00
Thomas Harte
1135576a3a Comments in slightly more detail. 2019-10-28 22:12:56 -04:00
Thomas Harte
a5057e6540 Ensures that stop means stop. 2019-10-28 22:12:45 -04:00
Thomas Harte
1d790ec2a9 Adds the option for a clock conversion to JustInTimeActor and slows the MFP's clock rate. 2019-10-28 21:35:10 -04:00
Thomas Harte
0f2d72c436 Ensures receipt of output line changes. 2019-10-28 21:21:53 -04:00
Thomas Harte
aa52652027 Adds a const. 2019-10-28 21:21:35 -04:00
Thomas Harte
4a1fa8fc13 Adds some const qualifiers. 2019-10-28 21:13:42 -04:00
Thomas Harte
95d3b6e79f Adds a through route for the FDC interrupt line. 2019-10-28 21:13:21 -04:00
Thomas Harte
5f6711b72c Ensures interrupt changes are notified to the delegate. 2019-10-28 21:13:06 -04:00
Thomas Harte
d44734d105 Attempts a fuller setting of GPIP inputs. 2019-10-27 22:39:21 -04:00
Thomas Harte
1aaa6331a0 Stores and returns video mode. 2019-10-27 22:39:00 -04:00
Thomas Harte
de1bfb4e24 Stores and returns timer configuration. 2019-10-27 22:38:49 -04:00
Thomas Harte
0cb19421e8 Adds prefix to mouse position response. 2019-10-27 21:46:03 -04:00
Thomas Harte
92847037b3 Merge branch 'master' into AtariST 2019-10-27 21:40:51 -04:00
Thomas Harte
f4556ef6b0 Merge pull request #666 from TomHarte/CPCSafety
Fixes unit test target
2019-10-27 21:40:06 -04:00
Thomas Harte
4266264449 Switches to the more idiomatic .empty(). 2019-10-27 21:31:31 -04:00
Thomas Harte
1aba1db62c Corrects test. 2019-10-27 21:30:58 -04:00
Thomas Harte
0fc191c87d Switched a few static_cast to constructor syntax. 2019-10-27 14:21:22 -04:00
Thomas Harte
dc4a0e4e3b Video only ever reads from RAM, so it can be const *.
(it can also be *const, since I set it only once)
2019-10-27 14:09:38 -04:00
Thomas Harte
3794d94b68 Adds a sanity check on alignment. 2019-10-27 14:09:02 -04:00
Thomas Harte
0082dc4411 Improves logging. 2019-10-27 00:02:55 -04:00
Thomas Harte
22754683f8 Ensures timer divisor values don't go out of range, adds timer interrupts.
I suspect further timer issues remain.
2019-10-26 23:20:13 -04:00
Thomas Harte
909685d87d A drive with no disk is now happy to spin its motor.
It'll continue to produce index-hole events, which might not be accurate for 5.25" drives. Research to do.
2019-10-26 22:57:05 -04:00
Thomas Harte
55710ea00e Switches the presumption to requiring NDEBUG to avoid forced inlines. 2019-10-26 22:43:25 -04:00
Thomas Harte
36a9a5288b Adds drives to the FDC. 2019-10-26 22:39:11 -04:00
Thomas Harte
e89be6249d Adds a logging prefix. 2019-10-26 22:38:56 -04:00
Thomas Harte
ac39fd0235 Starts work on the DMA controller. 2019-10-26 21:33:57 -04:00
Thomas Harte
ecc0cea5a1 Added a potential branch for the newer TOS memory map. 2019-10-26 16:52:06 -04:00
Thomas Harte
eae11cbf17 Adds a dummy response for mouse interrogation. 2019-10-26 16:14:24 -04:00
Thomas Harte
e96386f572 Takes another stab at MFP interrupt management. 2019-10-26 15:55:19 -04:00
Thomas Harte
a8d481a764 Writes to the pending register appear to be able to clear interrupts too. 2019-10-25 22:46:30 -04:00
Thomas Harte
2207638287 Adds hsync and vsync interrupts. 2019-10-25 22:42:13 -04:00
Thomas Harte
872897029e Attempts a complete wiring of 68901 interrupts. 2019-10-25 22:36:01 -04:00
Thomas Harte
51b4b5551d Actually, I think the 6850 is active low for interrupts. 2019-10-24 22:37:53 -04:00
Thomas Harte
7a2de47f58 Corrects interrupt mask generation. 2019-10-24 22:37:32 -04:00
Thomas Harte
f2f98ed60c Attempts some part of interrupt decision making. 2019-10-24 22:33:42 -04:00
Thomas Harte
77f14fa638 Starts trying to make sense of interrupts. 2019-10-23 23:09:49 -04:00
Thomas Harte
f09a240e6c Gives myself more trace details. 2019-10-21 23:20:03 -04:00
Thomas Harte
092a61f93e Does a better job of having just 512kb. 2019-10-21 23:10:30 -04:00
Thomas Harte
e30ba58e0d Attempts to wire ACIA interrupt signals into the MFP. 2019-10-21 23:02:30 -04:00
Thomas Harte
7cb82fccc0 Attempts properly to maintain interrupt flag; adds delegate. 2019-10-21 22:40:38 -04:00
Thomas Harte
ed9a5b0430 Adds receipt interrupt. 2019-10-21 21:27:57 -04:00
Thomas Harte
8f59a73425 Corrects incoming data capture. 2019-10-21 20:18:52 -04:00
Thomas Harte
91223b9ec8 Sets default level to high. 2019-10-21 20:18:33 -04:00
Thomas Harte
83f5f0e2ad Begins trying to receive ACIA data. 2019-10-21 20:10:19 -04:00
Thomas Harte
cf37e9f5de Remove source control markers. 2019-10-20 23:40:51 -04:00
Thomas Harte
e4f7ead894 Merge branch 'AtariST' of github.com:TomHarte/CLK into AtariST 2019-10-20 23:40:01 -04:00
Thomas Harte
4134463094 The ACIA now receives bits. 2019-10-20 23:34:30 -04:00
Thomas Harte
83d73fb088 The keyboard now responds to a reset on its serial line. 2019-10-20 23:13:44 -04:00
Thomas Harte
75c3e2dacd Adds basic, incomplete dispatcher for the intelligent keyboard. 2019-10-20 23:07:19 -04:00
Thomas Harte
cf07982a9b Ensures good serial line and ACIA behaviour.
Next stop: having the intelligent keyboard react.
2019-10-20 22:10:05 -04:00
Thomas Harte
313aaa8f95 Silences temporarily. 2019-10-20 20:38:56 -04:00
Thomas Harte
2e86dada1d Ensures updates even when the event queue is empty. 2019-10-20 20:38:56 -04:00
Thomas Harte
696af5c3a6 Starts to transfer serial line decoding logic into the line itself. 2019-10-20 20:38:56 -04:00
Thomas Harte
f08b38d0ae Silences, temporarily. 2019-10-20 20:38:55 -04:00
Thomas Harte
9a8352282d Mostly but not quite fixes serial work. 2019-10-20 20:38:55 -04:00
Thomas Harte
3d03cce6b1 Starts working on the GPIP functionality block. 2019-10-20 20:38:55 -04:00
Thomas Harte
34075a7674 Attempts to tie an intelligent keyboard to the other end of its serial line. 2019-10-20 20:38:55 -04:00
Thomas Harte
f79c87659f Corrects documentation error. 2019-10-20 20:38:55 -04:00
Thomas Harte
c10b64e1c0 Adds a received_data_ register, that presently can never fill. 2019-10-20 20:38:55 -04:00
Thomas Harte
5d5fe52144 Corrects transmission logic — exactly hitting write_data_time_remaining now works properly. 2019-10-20 20:38:55 -04:00
Thomas Harte
d461331fd2 Ensures remaining_delays_ is set properly after [reset/flush]_writing. 2019-10-20 20:38:55 -04:00
Thomas Harte
ff62eb6dce The ACIA actually has two clocks, though on an ST they're both 500,000 Hz. 2019-10-20 20:38:55 -04:00
Thomas Harte
374439693e Ensures serial lines know their writer's clock rate. 2019-10-20 20:38:55 -04:00
Thomas Harte
c4ef33b23f JustInTimeActors can now specify a clock divider. 2019-10-20 20:38:55 -04:00
Thomas Harte
a7ed357569 Attempts to implement transmission interrupts and ClockingHint::Source. 2019-10-20 20:38:55 -04:00
Thomas Harte
4e5b440145 Attempts mostly to implement 6850 output. 2019-10-20 20:38:55 -04:00
Thomas Harte
2bd7be13b5 Decodes the 6850 control register, and starts working on standardised serial ports. 2019-10-20 20:38:55 -04:00
Thomas Harte
4b09d7c41d Nudges 6850 towards coherence. 2019-10-20 20:38:55 -04:00
Thomas Harte
97d44129cb Ensures all 16 data lines reach the video. 2019-10-20 20:38:55 -04:00
Thomas Harte
b0f5f7bd37 Attempts to start producing actual video. 2019-10-20 20:38:55 -04:00
Thomas Harte
d1dd6876b5 Adds the option to affix a standard prefix to log messages. 2019-10-20 20:38:55 -04:00
Thomas Harte
a59ec9e818 Provides a token something where DMA should be. 2019-10-20 20:38:55 -04:00
Thomas Harte
4ead905c3c Adds an empty shell for the ACIA. 2019-10-20 20:38:55 -04:00
Thomas Harte
127bb043e7 Adds enough logic to advance to an ACIA access error. 2019-10-20 20:38:55 -04:00
Thomas Harte
42ebe06474 Makes an attempt at tracking video sequence points. 2019-10-20 20:38:55 -04:00
Thomas Harte
74fe32da23 Takes a shot at other display outputs. 2019-10-20 20:38:55 -04:00
Thomas Harte
780916551f Corrects sync generation. 2019-10-20 20:38:54 -04:00
Thomas Harte
305b1211ba Makes a first attempt to box out the ST display area. 2019-10-20 20:38:54 -04:00
Thomas Harte
2cf52fb89c Makes an unsuccessful first attempt at some timer functionality. 2019-10-20 20:38:54 -04:00
Thomas Harte
6e1b606adf Adds a target for MFP read/write operations.
Completely without any implementation, so far.
2019-10-20 20:38:54 -04:00
Thomas Harte
3bb0bf9e14 Adds some semblance of an AY. 2019-10-20 20:38:54 -04:00
Thomas Harte
87a6d22894 Starts to formalise the ST memory map a little. 2019-10-20 20:38:54 -04:00
Thomas Harte
484a0ceeb8 Starts forming an Atari ST memory map. 2019-10-20 20:38:54 -04:00
Thomas Harte
da1436abd2 Gifts the Atari ST a 68000 and non-functional video. 2019-10-20 20:38:54 -04:00
Thomas Harte
125f781ced Starts to create an actual shell of a machine. 2019-10-20 20:38:54 -04:00
Thomas Harte
c66c484c54 Removes unused includes. 2019-10-20 20:38:54 -04:00
Thomas Harte
345b32d6e3 Implements read-only MSA support. 2019-10-20 20:38:54 -04:00
Thomas Harte
8b397626bf Adds a route through the static analyser to the Atari ST. 2019-10-20 20:38:54 -04:00
Thomas Harte
0da1881a07 Adds an Atari ST enumeration and factory method. 2019-10-20 20:38:54 -04:00
Thomas Harte
d4077afd30 Merge pull request #665 from TomHarte/CPCCrash
Slightly improves CPC performance
2019-10-20 20:19:29 -04:00
Thomas Harte
95c45b5515 This can be const. 2019-10-20 17:22:56 -04:00
Thomas Harte
684644420a Increases scan buffer availability. 2019-10-20 17:22:41 -04:00
Thomas Harte
735586f5f8 Corrects tabs; adds potential output_border optimisation. 2019-10-19 21:20:34 -04:00
Thomas Harte
ddae086661 Merge pull request #664 from TomHarte/DataAllocationGuards
Adds safety checks around video data allocation
2019-10-19 18:36:05 -04:00
Thomas Harte
9c7aa5f3fc Attempts also to spot data writes without allocations. 2019-10-19 18:26:56 -04:00
Thomas Harte
418cd07e17 Adds a check against overrunning data. 2019-10-19 18:17:44 -04:00
Thomas Harte
2ae5739b8b Silences temporarily. 2019-10-17 23:59:51 -04:00
Thomas Harte
e095a622d3 Ensures updates even when the event queue is empty. 2019-10-17 23:59:43 -04:00
Thomas Harte
9ab49065cd Starts to transfer serial line decoding logic into the line itself. 2019-10-17 23:34:39 -04:00
Thomas Harte
ab50f17d87 Silences, temporarily. 2019-10-16 23:34:49 -04:00
Thomas Harte
f5a2e180f9 Mostly but not quite fixes serial work. 2019-10-16 23:34:37 -04:00
Thomas Harte
f2e1584275 Starts working on the GPIP functionality block. 2019-10-16 23:21:25 -04:00
Thomas Harte
0fd8813ddb Attempts to tie an intelligent keyboard to the other end of its serial line. 2019-10-16 23:21:14 -04:00
Thomas Harte
b69180ba01 Corrects documentation error. 2019-10-16 23:19:42 -04:00
Thomas Harte
c352d8ae8c Adds a received_data_ register, that presently can never fill. 2019-10-13 23:04:57 -04:00
Thomas Harte
530e831064 Corrects transmission logic — exactly hitting write_data_time_remaining now works properly. 2019-10-13 21:40:46 -04:00
Thomas Harte
3b165a78f2 Ensures remaining_delays_ is set properly after [reset/flush]_writing. 2019-10-13 21:39:25 -04:00
Thomas Harte
8d87e9eb1c The ACIA actually has two clocks, though on an ST they're both 500,000 Hz. 2019-10-13 21:32:34 -04:00
Thomas Harte
f86dc082bb Ensures serial lines know their writer's clock rate. 2019-10-13 20:41:08 -04:00
Thomas Harte
d7982aa84e JustInTimeActors can now specify a clock divider. 2019-10-13 18:19:39 -04:00
Thomas Harte
516d78f5a8 Attempts to implement transmission interrupts and ClockingHint::Source. 2019-10-12 23:46:57 -04:00
Thomas Harte
8b50a7d6e3 Attempts mostly to implement 6850 output. 2019-10-12 23:14:29 -04:00
Thomas Harte
4bf81d3b90 Decodes the 6850 control register, and starts working on standardised serial ports. 2019-10-12 18:19:55 -04:00
Thomas Harte
cd75978e4e Nudges 6850 towards coherence. 2019-10-12 00:04:02 -04:00
Thomas Harte
fda99d9c5f Ensures all 16 data lines reach the video. 2019-10-10 23:29:46 -04:00
Thomas Harte
c5ebf75351 Attempts to start producing actual video. 2019-10-10 22:46:58 -04:00
Thomas Harte
2581b520af Adds the option to affix a standard prefix to log messages. 2019-10-10 22:45:03 -04:00
Thomas Harte
52e5296544 Provides a token something where DMA should be. 2019-10-10 21:04:41 -04:00
Thomas Harte
d7ce2c26e8 Adds an empty shell for the ACIA. 2019-10-10 20:54:29 -04:00
Thomas Harte
f88e1b1373 Adds enough logic to advance to an ACIA access error. 2019-10-09 23:01:11 -04:00
Thomas Harte
021d4dbaf1 Makes an attempt at tracking video sequence points. 2019-10-08 23:06:50 -04:00
Thomas Harte
dbde8f2ee7 Takes a shot at other display outputs. 2019-10-08 22:29:58 -04:00
Thomas Harte
5d06930df4 Corrects sync generation. 2019-10-08 21:29:17 -04:00
Thomas Harte
7722596a3b Makes a first attempt to box out the ST display area. 2019-10-08 21:18:08 -04:00
Thomas Harte
1de1818ebb Makes an unsuccessful first attempt at some timer functionality. 2019-10-07 22:44:35 -04:00
Thomas Harte
885f890df1 Adds a target for MFP read/write operations.
Completely without any implementation, so far.
2019-10-06 23:14:05 -04:00
Thomas Harte
e195497ab7 Adds some semblance of an AY. 2019-10-06 22:30:48 -04:00
Thomas Harte
fcd2143697 Starts to formalise the ST memory map a little. 2019-10-06 17:15:29 -04:00
Thomas Harte
3f45cd2380 Starts forming an Atari ST memory map. 2019-10-04 22:38:46 -04:00
Thomas Harte
a8a34497ff Gifts the Atari ST a 68000 and non-functional video. 2019-10-04 21:34:15 -04:00
Thomas Harte
953423cc02 Starts to create an actual shell of a machine. 2019-10-03 22:47:57 -04:00
Thomas Harte
a2ca887b99 Removes unused includes. 2019-10-03 22:47:41 -04:00
Thomas Harte
3c5ae9cf8e Implements read-only MSA support. 2019-10-03 22:41:20 -04:00
Thomas Harte
fe621d7e52 Adds a route through the static analyser to the Atari ST. 2019-10-03 22:10:10 -04:00
Thomas Harte
814bb4ec63 Adds an Atari ST enumeration and factory method. 2019-10-03 20:17:26 -04:00
Thomas Harte
e8bc254f3f Merge pull request #661 from TomHarte/ListMasterSystemOptions
Adds missing Master System option enumerations.
2019-09-30 21:17:20 -04:00
Thomas Harte
3c146a3fb2 Adds missing Master System enumerations. 2019-09-30 21:10:30 -04:00
Thomas Harte
b609ce6fcb Merge pull request #658 from TomHarte/Afterburner
Minor TMS timing correction.
2019-09-28 23:50:28 -04:00
Thomas Harte
929475d31e Minor correction: round down, not up. 2019-09-28 23:49:32 -04:00
Thomas Harte
f14d98452e Merge pull request #657 from TomHarte/DiskIIAgain
Corrects time propagation for Apple II cards
2019-09-28 23:40:07 -04:00
Thomas Harte
9d17d48bca Ensures cycles_per_revolution_ is populated for fixed-rate drives. 2019-09-28 23:23:15 -04:00
Thomas Harte
4ac3839185 Seeks to ensure that card transitions between real-time and just-in-time don't break timing. 2019-09-28 18:34:04 -04:00
Thomas Harte
c089d1cd09 Improves text; nobody normal knows that this is "a view". 2019-09-24 22:52:08 -04:00
Thomas Harte
cb85ec25cc Merge pull request #656 from TomHarte/MacMenu
Adds Macintosh choice to File -> New...
2019-09-24 22:50:43 -04:00
Thomas Harte
fbf95ec2b8 Removes the now empty local namespace. 2019-09-24 22:48:47 -04:00
Thomas Harte
6adca98f34 Adds Macintosh choice to File -> New... 2019-09-24 22:48:34 -04:00
Thomas Harte
48f4d8b875 Merge pull request #655 from TomHarte/EventProtocol
Rationalises protocol for application-level event theft.
2019-09-24 22:32:22 -04:00
Thomas Harte
7758f9d0a9 Improves nomenclature. 2019-09-24 22:31:36 -04:00
Thomas Harte
7112f0336c Rationalises protocol for application-level event theft. 2019-09-24 22:31:20 -04:00
Thomas Harte
298694a881 Merge pull request #654 from TomHarte/GoodbyeFastTapeProtocol
Eliminates fast loading Objective-C/Swift protocol.
2019-09-24 20:22:08 -04:00
Thomas Harte
7ff4594f09 Eliminates fast loading Objective-C/Swift protocol.
A very long time ago, when each machine had its own Objective-C class, this protocol was used to indicate which machines support that feature. It no longer communicates anything.
2019-09-24 20:13:09 -04:00
Thomas Harte
e8bd538182 Merge pull request #653 from TomHarte/CommandCapture
Allows machines to declare modifiers as 'essential'.
2019-09-22 14:04:06 -04:00
Thomas Harte
8489e8650f Attempts another draft of not inundating the user with open file dialogues. 2019-09-22 13:59:31 -04:00
Thomas Harte
114f81941e Completes the wiring necessary for capture of the command key.
At least when coupled with mouse capture.
2019-09-22 13:53:38 -04:00
Thomas Harte
077c7d767f Shifts essential modifiers up to the Keyboard class.
I had forgotten that mappers are not exposed.
2019-09-22 13:48:50 -04:00
Thomas Harte
8f88addf9f Establishes an interface for requesting shortcut theft. Not yet implemented. 2019-09-22 13:15:35 -04:00
Thomas Harte
f28c124039 Adds a route to divert key events before they reach Cocoa.
If you were to use this, it would have the effect of disabling in-app keyboard short-cuts in favour of routing keys to the emulated machine.
2019-09-22 13:15:01 -04:00
Thomas Harte
a416bc0058 Adds an interface allowing keyboard mappers to declare modifiers that are 'essential'.
i.e. ones that, if not delivered reliably, will cause the related machine to behave unexpectedly.
2019-09-22 13:14:09 -04:00
Thomas Harte
e78b1dcf3c Merge pull request #652 from TomHarte/Xcode11
Updates to Xcode11 recommended project settings.
2019-09-22 12:19:39 -04:00
Thomas Harte
8a14f5d814 Updates to Xcode11 recommended project settings.
The updated compiler also flagged a potential issue with CPU::Z80::Register not being a namespace re: 'Refresh' versus CPU::Z80::PartialMachineCycle. I don't entirely see it, but this fixes the problem.

I also finally figured out what the compiler was trying to tell me about ROMRequester.xib.
2019-09-22 12:13:56 -04:00
Thomas Harte
e5f983fbac Merge pull request #651 from TomHarte/MacOpenWindow
Shows the auto-open dialogue only at most once.
2019-09-21 18:01:54 -04:00
Thomas Harte
3e639e96e7 Shows the auto-open dialogue only at most once. 2019-09-21 18:01:16 -04:00
Thomas Harte
61993f0687 Merge pull request #650 from TomHarte/DeadReference
Removes dead reference to video from VIAPortHandler.
2019-09-21 17:40:22 -04:00
Thomas Harte
5f16fa8c08 Removes dead reference to video from VIAPortHandler. 2019-09-21 17:39:45 -04:00
Thomas Harte
dcea9c9ab2 Merge pull request #649 from TomHarte/BetterTiming
Implements every-other-cycle-during-pixels RAM timing.
2019-09-21 17:35:28 -04:00
Thomas Harte
e7bf0799b6 Implements every-other-cycle-during-pixels RAM timing. 2019-09-21 17:25:20 -04:00
Thomas Harte
e760421f6f Merge pull request #648 from TomHarte/QuickBoot
Adds the option to skip the Mac Plus memory test
2019-09-19 22:47:07 -04:00
Thomas Harte
8ea4c17315 Completes Mac GUI wiring. 2019-09-19 22:37:23 -04:00
Thomas Harte
2e24da4614 Implements quick booting, and edges towards exposing it on the Mac.
It should already work in kiosk mode.
2019-09-19 22:32:12 -04:00
Thomas Harte
e46601872b Establishes that the Macintosh offers the quick-boot option. 2019-09-19 21:50:39 -04:00
Thomas Harte
6d0e41b760 Adds "quick boot" as a standard option.
I assume I'm going to reuse this.
2019-09-19 19:41:43 -04:00
Thomas Harte
5a82df837d Merge pull request #647 from TomHarte/SCSIActivity
Adds the SCSI bus as an Activity::Source.
2019-09-19 19:33:06 -04:00
Thomas Harte
776b819a5a Adds the SCSI bus as an Activity::Source. 2019-09-19 19:31:22 -04:00
Thomas Harte
1783f6c84b Update README.md
Corrects alphabetical order.
2019-09-18 22:11:37 -04:00
Thomas Harte
2ef2c73efe The early Macintoshes are less experimental now. 2019-09-18 22:11:04 -04:00
Thomas Harte
55e003ccc1 Merge pull request #646 from TomHarte/LinuxFixes
Corrects hasty merge for more standards-compliant targets
2019-09-18 22:07:57 -04:00
Thomas Harte
3d54d55dbb Adds missing #include for assert. 2019-09-18 22:06:13 -04:00
Thomas Harte
72c0a631f7 Moves includes to correct file. 2019-09-18 22:04:54 -04:00
Thomas Harte
1608a90d5d Takes another stab at finding ssize_t. 2019-09-18 22:03:51 -04:00
Thomas Harte
4f8a45a6ce Adds #include for ssize_t. 2019-09-18 22:02:59 -04:00
Thomas Harte
4f0f1dcf18 Corrects accidental use of #import. 2019-09-18 21:53:22 -04:00
Thomas Harte
839e51d92d Adds newest files to SConstruct. 2019-09-18 21:49:57 -04:00
Thomas Harte
e470cf23d8 Merge pull request #645 from TomHarte/SCSI
Adds basic SCSI support, along with a Mac Plus to use it.
2019-09-18 21:45:48 -04:00
Thomas Harte
8d4a96683a Reduces output noise. 2019-09-18 21:41:29 -04:00
Thomas Harte
f53411a319 Removes local NDEBUG. 2019-09-18 21:35:26 -04:00
Thomas Harte
128a1da626 Enables write support. 2019-09-18 20:18:02 -04:00
Thomas Harte
962275c22a Removes clock for NCR 5380.
It doesn't have one in real life, and now can live off the time counting that occurs on the SCSI bus.
2019-09-18 20:17:47 -04:00
Thomas Harte
3002ac8a4a Adds mapping of READ(8) size 0 to size 256. 2019-09-17 21:59:32 -04:00
Thomas Harte
ff43674638 Corrects partition map: string fields are 32 bytes long. 2019-09-17 21:46:14 -04:00
Thomas Harte
2f6c366668 Makes a concerted effort at properly wrapping a hard disk image. 2019-09-17 21:30:04 -04:00
Thomas Harte
2ce1f0a3b1 Implements multi-sector read/write.
This once again unblocks Apple HD SC Setup. Progress!
2019-09-16 22:20:42 -04:00
Thomas Harte
210129c3a1 Updated as per Inside Macintosh IV.
Of which I now own a copy.
2019-09-16 21:31:43 -04:00
Thomas Harte
934901447a Adds a temporary version of block access writing.
Whatever I'm doing, it's still not correct. The Macintosh ostensibly appears to 0-fill the direct-access device, then reads a sector back and hangs.
2019-09-15 22:06:45 -04:00
Thomas Harte
960b289e70 Edges closer towards proper DMA operation.
Specifically: differentiates the three kinds of DMA operation. Still doesn't act correctly with regard to DACK though, and leaves the bus instantaneously improperly formed. Which I'm tempted to try to fix on the target side by properly obeying delays.
2019-09-15 15:03:06 -04:00
Thomas Harte
243e40cd79 Adds signalling of DACK. 2019-09-14 13:48:33 -04:00
Thomas Harte
c849188016 Adds format and write to the SCSI target.
Now I think I need to switch back to the 5380 to ensure proper DMA mode interactions when writing.
2019-09-12 21:58:09 -04:00
Thomas Harte
87e8dade2f Implements READ BUFFER to do, you know, *something*. Plus READ CAPACITY.
The HD SC utility now offers up drive 6 for formatting. That's progress.
2019-09-11 21:52:02 -04:00
Thomas Harte
6fc5b4e825 Simplifies INQUIRY for future targets; implements enough of SENSE MODE to advance.
The HD SC setup utility is now looking to read buffer.
2019-09-08 21:59:56 -04:00
Thomas Harte
00ce7f8ae0 Takes a first shot at INQUIRY. 2019-09-07 22:04:44 -04:00
Thomas Harte
6e0e9afe2f Fixed: to post a message, I want message in, not message out. 2019-09-07 13:35:38 -04:00
Thomas Harte
cb0d994827 Provides empty data for the unimplemented sectors. 2019-09-07 13:17:53 -04:00
Thomas Harte
bee782234a Ensures no state transitions while acknowledge is still asserted. 2019-09-07 13:17:34 -04:00
Thomas Harte
64dad35026 Decreases logging, at least temporarily. 2019-09-03 22:40:32 -04:00
Thomas Harte
cbd1a8cf78 Factors out command termination, adds a default implementation of test unit ready. 2019-09-03 22:40:18 -04:00
Thomas Harte
a4ab0afce3 Takes a shot at completing a full SCSI interaction. 2019-09-03 21:15:30 -04:00
Thomas Harte
1c7e0f3c9d Fixes control line modification by the 5380 and SCSI target command chaining.
So now I'm back to trying to guess how a SCSI command terminates re: the relative meanings of a message phase and a status phase.
2019-09-02 23:14:37 -04:00
Thomas Harte
318cdb41ea Adds SCSI bus clocking to the Macintosh, and fixes its internal counting. 2019-09-02 16:03:33 -04:00
Thomas Harte
2f8e31bc8b Takes a first bash at implementing the new SCSI::Bus timing infrastructure. 2019-09-02 13:00:01 -04:00
Thomas Harte
310c722cc0 Starts a transition to bus-level knowledge of SCSI-specific bus timing thresholds.
The idea being that bus attachees need not all count time for themselves. They can be very plain finite state machines.

New semantics are not yet implemented within the Bus. The plan is to do that, remove the internal counting of time within the NCR, then adjust the Target to be more explicitly stateful.
2019-08-31 21:44:22 -04:00
Thomas Harte
25956bd90f Mildly improves temporary logging.
A deckchair shuffle, at best.
2019-08-26 22:35:11 -04:00
Thomas Harte
1a60ced61b Starts trying to deal with creating a whole volume from merely a partition. 2019-08-25 23:03:54 -04:00
Thomas Harte
081316c071 Adds some additional commentary as this takes shape. 2019-08-25 17:46:05 -04:00
Thomas Harte
eafbc12cc1 Ensures a clean entry into the command phase. 2019-08-25 17:43:14 -04:00
Thomas Harte
ca08716c52 Introduces real hard disk images to the nascent world of SCSI. 2019-08-25 17:03:41 -04:00
Thomas Harte
30cef1ee22 Adds write support. 2019-08-25 15:16:35 -04:00
Thomas Harte
5598802439 Makes the static analyser aware of mass-storage devices. 2019-08-25 15:10:09 -04:00
Thomas Harte
1c6720b0db Adds new class to Xcode project. 2019-08-25 15:09:43 -04:00
Thomas Harte
404b088199 Adds a trivial mass-storage device, for Macintosh HFV volumes. 2019-08-25 15:09:27 -04:00
Thomas Harte
7d61df238a Localises #include. 2019-08-25 15:09:04 -04:00
Thomas Harte
c86db12f1c Starts implementing DMA support on the 5380.
The Macintosh doesn't actually use the DMA signals, but uses pseudo-DMA mode so they nevertheless need to be appropriate.
2019-08-24 22:47:11 -04:00
Thomas Harte
ce2e85af8b Adds missing bus state callouts. 2019-08-22 23:27:00 -04:00
Thomas Harte
2d82855f26 Attempts to provide a data out phase. 2019-08-22 23:16:58 -04:00
Thomas Harte
faec516a2c Starts pushing towards figuring out a proper infrastructure for mass storage. 2019-08-21 23:22:58 -04:00
Thomas Harte
8e274ec5d0 Merge branch 'master' into SCSI 2019-08-21 22:38:18 -04:00
Thomas Harte
bb1a0a0b76 Sketches out further SCSI infrastructure. 2019-08-21 22:37:39 -04:00
Thomas Harte
252650808d Starts seeking to unbind SCSI bus logic and command performance. 2019-08-19 22:47:01 -04:00
Thomas Harte
e3d9254555 Implements phase-match bit.
Seemingly causing the command phase to proceed.
2019-08-18 23:15:54 -04:00
Thomas Harte
90cf99b626 Takes a wild swings at speeding up startup.
With no success.
2019-08-18 22:40:16 -04:00
Thomas Harte
955e909e61 Attempts to nudge the command phase further towards functioning. 2019-08-18 22:39:27 -04:00
Thomas Harte
8339e2044c Switches to proper SCSI terminology and better attempts a command phase. 2019-08-18 15:10:07 -04:00
Thomas Harte
0e0c789b02 Starts attempting to introduce a direct access device.
Without having access to the SCSI-1 standard, a lot of this is guesswork.
2019-08-17 23:43:42 -04:00
Thomas Harte
7e001c1d03 Corrects data line loading.
Also adds some extra temporary logging. Outstanding question: why is ATN not being signalled? Is SEL enough?
2019-08-17 21:30:59 -04:00
Thomas Harte
9047932b81 Corrected basic error. Arbitration now seems to succeed.
This is seemingly followed by a pattern of signalling BUSY+SEL followed by just SEL with the various other potential device IDs in turn. To which nothing ever responds as currently implemented.
2019-08-15 23:28:30 -04:00
Thomas Harte
f668e4a54c Makes an attempt at getting the 5380 past arbitration.
Not entirely successful. Also gets a bit smarter with `final` on ClockingHint::Sources.
2019-08-15 23:14:40 -04:00
Thomas Harte
ce1c96d68c Starts thinking out the mechanics of emulating a SCSI-1 bus. 2019-08-13 23:09:11 -04:00
Thomas Harte
0f67e490e8 Adjusts NCR address decoding to produce a more plausible initial interaction. 2019-08-11 22:43:25 -04:00
Thomas Harte
895c315fa5 Increases the Mac Plus too 4mb. 2019-08-11 21:41:12 -04:00
Thomas Harte
a90a74a512 Stubs in just enough of the 5380 to get a Mac Plus too boot. 2019-08-11 20:55:20 -04:00
Thomas Harte
3e1286cbef Merge pull request #644 from MaddTheSane/patch-1
Update CSMachine.mm
2019-08-11 19:25:16 -04:00
Thomas Harte
949c1e1668 Adds an empty shell for what will be my 5380 implementation. 2019-08-10 23:53:52 -04:00
Thomas Harte
bbd4e4d3dc Enhances memory map fidelity to allow for ROM holes on the Mac Plus.
This is how the ROM detects the difference between the Plus and the 512ke, it seems.
2019-08-10 23:53:34 -04:00
C.W. Betts
4c5f596533 Update CSMachine.mm
No need to create a temporary NSNumber object to be passed to a variadic method.
2019-08-10 00:43:30 -06:00
Thomas Harte
4859d3781b Merge pull request #643 from TomHarte/Mac512
Simplifies just-in-time usage of the IWM, and the disk-speed accumulator
2019-08-07 21:51:07 -04:00
Thomas Harte
bac0461f7f Switches the drive-speed accumulator to the delegate pattern.
This allows the Macintosh to ensure that the IWM is kept up just-in-time with drive speed changes.
2019-08-07 21:39:23 -04:00
Thomas Harte
f26a200d78 Switches to a JustInTimeActor to wrap the IWM.
Also simplifies potential future usage of the IWM template.
2019-08-07 21:28:02 -04:00
Thomas Harte
28ccb7b54e Merge branch 'master' of github.com:TomHarte/CLK 2019-08-04 21:34:49 -04:00
Thomas Harte
b6e4c8209b Switches to showing 'File -> Open...' at launch.
As per the prevailing wind.
2019-08-04 21:34:30 -04:00
Thomas Harte
16548f0765 Merge pull request #642 from TomHarte/InterruptSampling
Moves timing of interrupt sampling into prefetch queue advancement.
2019-08-04 21:20:22 -04:00
Thomas Harte
6a80832140 Moves timing of interrupt sampling into prefetch queue advancement.
As per comment, that is definitely the only place it can occur; I don't know whether it always occurs there.
2019-08-04 21:06:34 -04:00
Thomas Harte
c6cf0e914b Merge pull request #641 from TomHarte/DIVSTiming
Substantially improves DIVS timing.
2019-08-04 20:46:50 -04:00
Thomas Harte
35b1a55c12 Corrects DIVS negative flag. 2019-08-04 20:36:33 -04:00
Thomas Harte
e3794c0c0e Takes a second pass at DIVS timing, seeming to correct that side of things. 2019-08-04 20:33:43 -04:00
Thomas Harte
f88dc23c71 Corrects comment. 2019-08-04 20:30:41 -04:00
Thomas Harte
0e293e4983 Relocates RAM delay test in order to scrape out a minor performance win. 2019-08-03 21:46:45 -04:00
Thomas Harte
e334abfe20 Partitions the 68000 arithmetic tests, to allow easier per-instruction execution. 2019-08-03 17:44:47 -04:00
Thomas Harte
fd2fbe0e59 Merge pull request #640 from TomHarte/InterruptSignalling
Corrects 68000 address lines during interrupt acknowledgement.
2019-08-03 15:42:15 -04:00
Thomas Harte
330b27d085 Merge branch 'master' into InterruptSignalling 2019-08-03 15:39:22 -04:00
Thomas Harte
478f2533b5 Corrects 68000 address bus during interrupt acknowledge.
All unused bits should be 1, not 0.
2019-08-03 15:38:36 -04:00
Thomas Harte
b96972a4b9 Merge pull request #639 from InvisibleUp/master
Allow for scons to run on Python 3
2019-08-03 08:51:45 -04:00
InvisibleUp
f2b083f4de Allow for scons to run on Python 3 2019-08-03 00:33:53 -04:00
Thomas Harte
80f6d665d9 Merge pull request #638 from TomHarte/SimplifiedBus
Simplifies code around Mac bus decoding.
2019-08-02 22:33:54 -04:00
Thomas Harte
a07488cf1b Introduces the Mac Plus memory map.
Albeit with no SCSI support yet.
2019-08-02 22:26:40 -04:00
Thomas Harte
d67c5145c0 Introduces RAM access delays. 2019-08-02 22:12:34 -04:00
Thomas Harte
5e76d593af Switches to table-based address decoding. 2019-08-02 21:30:04 -04:00
Thomas Harte
83393e8e91 Merge branch 'master' into SimplifiedBus 2019-08-02 21:05:45 -04:00
Thomas Harte
e08a64d455 Fixes erroneous instruction. 2019-08-02 21:04:53 -04:00
Thomas Harte
b93f9b3973 Distinguishes time advancement from bus response. 2019-08-02 19:48:41 -04:00
Thomas Harte
9c517d07d4 Merge pull request #637 from TomHarte/UserInfo
Improves Macintosh user communications
2019-08-02 17:29:44 -04:00
Thomas Harte
f45de5b87a Adds how-to-release-the-mouse instructions for Cocoa. 2019-08-02 17:07:51 -04:00
Thomas Harte
011d76175c Adds mouse release instructions for SDL. 2019-08-02 16:38:05 -04:00
Thomas Harte
96005261c7 Adds activity lights for Macintosh disk activity.
Prompting a quick fix to drives not spinning down.
2019-08-02 16:26:23 -04:00
Thomas Harte
c8177af45a Introduces missing implementation file. 2019-08-02 16:26:08 -04:00
Thomas Harte
97eff5b16d Formally distinguishes Macintosh keys from virtual keys.
Also: adds mappings for keypad keys, and corrects a couple of
long-standing capitalisation errors in my virtual key set.
2019-08-02 16:15:34 -04:00
Thomas Harte
917520fb1e Merge pull request #636 from TomHarte/PWM
Attempts more accurately to match Apple's IWM windowing logic.
2019-08-02 15:15:11 -04:00
Thomas Harte
335dda3d55 Attempts more accurately to match Apple's windowing logic. 2019-08-02 12:49:45 -04:00
Thomas Harte
0c8e313fd5 Merge pull request #635 from TomHarte/Cleanup
Improves code quality, particularly the NSDocument subclass.
2019-08-01 14:32:49 -04:00
Thomas Harte
f64ec11668 Tidies up and simplifies panel flow. 2019-08-01 14:31:45 -04:00
Thomas Harte
9bbccd89d3 Adds an extended rationale for current implementation.
Also strips some cruft of prior guesses.
2019-07-31 23:19:46 -04:00
Thomas Harte
1ae3799aee Merge pull request #634 from TomHarte/OpenCrash
Resolves a potential crash at launch on the Mac
2019-07-31 14:11:58 -04:00
Thomas Harte
260843e5b1 Starts poking at a pure total-based formula.
On the assumption that any relevant DC offset will fall out in the wash. This causes one 400kb disk to boot in a Macintosh 128kb, another couple to do reasonably well. So it's better than what was here before.
2019-07-31 12:42:23 -04:00
Thomas Harte
e3f22e5787 This should actually be PWM, I think.
I'm just unsure of exactly the proper formula, owing to my ignorance on basic electrical engineering. Research ahoy!
2019-07-30 22:02:41 -04:00
Thomas Harte
2aa308efdd Tweaks magic formulas.
The computer now at least seeks outward, until this attempt at drive speed calculation fails.
2019-07-30 16:18:36 -04:00
Thomas Harte
74c18d7861 Attempts a full wiring up of 400kb drive speed. 2019-07-30 15:08:55 -04:00
Thomas Harte
c41cccd9a6 Adds a workaround to display the ROM import banner even from File -> Open... . 2019-07-30 13:07:33 -04:00
Thomas Harte
bba34b28b8 Merge pull request #633 from TomHarte/Deferrer
Starts to formalise just-in-time handling
2019-07-30 11:35:13 -04:00
Thomas Harte
d8a41575c8 Picks a better function name. 2019-07-30 10:54:56 -04:00
Thomas Harte
0521de668a Omits redundant qualifier.
This code can't be anything but `inline`.
2019-07-29 23:07:02 -04:00
Thomas Harte
12441bddab Tries operator overloading as a workaround. 2019-07-29 23:04:02 -04:00
Thomas Harte
bc25c52683 Although duplicative, resolves function redefinition. 2019-07-29 22:49:02 -04:00
Thomas Harte
eb3fb70ea1 Merge branch 'Deferrer' of github.com:TomHarte/CLK into Deferrer 2019-07-29 21:24:21 -04:00
Thomas Harte
2f90ed1f32 Attempts to reformulate into valid C++. 2019-07-29 21:23:37 -04:00
Thomas Harte
f3dd4b028d Rolls out JustInTime acting to the MSX and ColecoVision. 2019-07-29 21:22:31 -04:00
Thomas Harte
7dcad516bd Undoes incorrect project change. 2019-07-29 17:21:34 -04:00
Thomas Harte
9859f99513 Adds a route to not bumping time. 2019-07-29 17:21:27 -04:00
Thomas Harte
51b7f2777d Adds a route to not bumping time. 2019-07-29 17:17:39 -04:00
Thomas Harte
2f2478d2d3 Implements AsyncJustInTimeActor, experimentally. 2019-07-29 16:38:57 -04:00
Thomas Harte
a43ada82b2 Experiments with a JustInTimeActor in the Master System. 2019-07-29 15:38:41 -04:00
Thomas Harte
5149f290d0 Starts trying to formalise just-in-time execution.
Which, at least, simplifies Cycle/HalfCycle to Cycle run_for usage via template.
2019-07-28 21:49:54 -04:00
Thomas Harte
0dc6f08deb Merge pull request #632 from TomHarte/BINSwitch
Eliminates the crutch of PlusToo BIN files.
2019-07-28 16:08:54 -04:00
Thomas Harte
b1f04ed96d Eliminates the crutch of PlusToo BIN files.
Thereby returning the .bin extension to the various consoles.
2019-07-28 16:07:16 -04:00
Thomas Harte
cd49b3c89b Merge pull request #631 from TomHarte/MacPageFlipping
Removes the video and audio base address latches.
2019-07-27 22:25:12 -04:00
Thomas Harte
f894d43111 Removes the video and audio base address latches.
It now seems to me that these take effect immediately.
2019-07-27 22:23:40 -04:00
Thomas Harte
4033c0c754 Merge pull request #630 from TomHarte/IWMWrites
Makes various fixes to `Drive` and `Track`.
2019-07-26 23:41:20 -04:00
Thomas Harte
786b26d23e Adds an admission of incompleteness.
I really need to figure out the 5-and-3 encoding.
2019-07-26 23:23:40 -04:00
Thomas Harte
d08d8ed22c Adds a further drift safeguard. 2019-07-26 23:23:01 -04:00
Thomas Harte
b7b62aa3f6 Resolves some type conversion warnings. 2019-07-26 23:20:40 -04:00
Thomas Harte
39d7e3c62c Ensures relative_exponents less than or equal to -32 don't overflow. 2019-07-26 22:19:40 -04:00
Thomas Harte
81b57ecf7c Adds noexcept. 2019-07-26 22:18:40 -04:00
Thomas Harte
572e8b52e1 At the cost of extra storage, attempts to simplify away potential rounding issues around the index hole. 2019-07-26 17:20:32 -04:00
Thomas Harte
9b634472c6 Gets a little more rigorous on "high resolution". 2019-07-26 15:26:51 -04:00
Thomas Harte
d8bc20b1ab Ensures quieter Release behaviour. 2019-07-25 22:55:27 -04:00
Thomas Harte
d2bfd59953 Ensures positional continuity across rotation speed changes. 2019-07-25 22:29:54 -04:00
Thomas Harte
3d20ae47ea Ensures cycles_since_index_hole_ is wrapped to track length. 2019-07-25 21:48:01 -04:00
Thomas Harte
85cf8d89bc Ensures an initial non-zero value. 2019-07-25 21:47:44 -04:00
Thomas Harte
50e954223a Merge pull request #629 from TomHarte/MinorSpeedImprovements
Attempts to improve 68000 (and Macintosh) emulation speed
2019-07-25 10:39:41 -04:00
Thomas Harte
109d5d16bd Withdraws optimisation, for further testing in the future. 2019-07-25 10:33:38 -04:00
Thomas Harte
1672dc5946 Reduces frequency of update_video() calls. 2019-07-25 10:14:52 -04:00
Thomas Harte
5769944918 Shrinks MicroOp struct size from 16 bytes to 4. 2019-07-25 10:14:36 -04:00
Thomas Harte
9ef1211d53 Adds missing header file. 2019-07-24 22:13:32 -04:00
Thomas Harte
f2ae04597f Updates test case. 2019-07-24 22:07:17 -04:00
Thomas Harte
1327de1c82 Slims the Program struct down to 8 bytes total. 2019-07-24 22:02:50 -04:00
Thomas Harte
827c4e172a Cuts a third from the Program struct.
Observation: [source/destination]_address are always one of the address registers. So you can fit both within a single byte.

Net effect: around a 12% reduction in execution costs, given that this reduces the size of the instructions table from 3mb to 2mb.
2019-07-24 18:39:36 -04:00
Thomas Harte
c300bd17fa Regularises as many source/destination sets as fit the current setter. 2019-07-24 18:22:44 -04:00
Thomas Harte
0187fd8eae Hides all runtime Program member accesses behind macros.
... and fixes unit tests.
2019-07-24 12:01:30 -04:00
Thomas Harte
0469f0240b Moves interrupt level selection outside the loop. 2019-07-23 23:13:03 -04:00
Thomas Harte
4aca6c5ef8 Adds a note of admission here. 2019-07-23 23:03:15 -04:00
Thomas Harte
d69aee4972 Removes stray \n. 2019-07-23 22:17:46 -04:00
Thomas Harte
3da47318b1 Updates copyright year. 2019-07-23 18:03:37 -04:00
Thomas Harte
ef036df2bc Merge pull request #628 from TomHarte/XCodeUpdate
Completes Xcode 10.3 upgrade checks.
2019-07-23 16:27:46 -04:00
Thomas Harte
579f68cf11 Completes Xcode 10.3 upgrade checks. 2019-07-23 16:27:18 -04:00
Thomas Harte
90f6ca4635 Merge pull request #627 from TomHarte/ExtraROMDetails
Extends system ROM details; provides for manual import on the Mac
2019-07-23 16:24:55 -04:00
Thomas Harte
374cac0107 Adds negative feedback to ROM installation process.
As an ugly kludge, code wise.
2019-07-23 16:24:23 -04:00
Thomas Harte
4d361b1952 Adds MIME type for Apple-recognised disk images. 2019-07-23 11:36:47 -04:00
Thomas Harte
fcee7779b0 Inserts missing spaces. 2019-07-22 23:11:37 -04:00
Thomas Harte
b4191b6225 Corrects DiskII boot ROM CRCs and improves corresponding declarations. 2019-07-22 23:07:23 -04:00
Thomas Harte
dbee37ab34 Provides extended ROM details for the VIC-20 and Oric. 2019-07-22 22:15:44 -04:00
Thomas Harte
a3ad0ab09b Completes the successful import path. 2019-07-22 21:46:28 -04:00
Thomas Harte
ed0c4c117b Ensures that machine name reaches Swift. 2019-07-22 21:18:30 -04:00
Thomas Harte
2432151bf8 Puts machine name into ROMMachine::ROM.
Also switches to idiomatic exit codes.
2019-07-22 21:14:21 -04:00
Thomas Harte
2129bfc570 Gets as far as testing ROMs against the missing list.
Though now it strikes me that I've forgotten to retain the machine name.
2019-07-22 18:02:48 -04:00
Thomas Harte
8de6cd3f44 Ensures that ROM files can be dragged and dropped into Swift.
Also adjusts the main window background colour, better to bridge the time between selecting a machine and it starting.
2019-07-22 17:18:31 -04:00
Thomas Harte
9b9831f28b The Mac port will now at least display a list of missing ROMs.
It doesn't yet offer the drag-and-drop functionality it promises, however.
2019-07-22 13:00:17 -04:00
Thomas Harte
8a2cac0d0c Fixes layout constraints. 2019-07-22 11:30:26 -04:00
Thomas Harte
e17b105574 Adds a quick label in exposition. 2019-07-22 11:18:39 -04:00
Thomas Harte
67c5f6b7cb Ensures the missing ROM list bubbles up to Swift. 2019-07-21 22:05:22 -04:00
Thomas Harte
d452d070a1 Extends the Mac ROM fetcher to return a missing-ROMs list. 2019-07-21 18:41:00 -04:00
Thomas Harte
a846c3245d Checks the application support directory before the application bundle for ROM images. 2019-07-20 23:04:46 -04:00
Thomas Harte
4ffa3c1b49 Provides an output for some of the extended ROM information. 2019-07-20 22:52:57 -04:00
Thomas Harte
b2a6682798 Adds extended ROM information for the ZX80 and '81. 2019-07-20 22:46:49 -04:00
Thomas Harte
f3aac603f8 Adds extended Introduces extended ROM details for the C1540, Electron, Master System and MSX. 2019-07-20 21:30:37 -04:00
Thomas Harte
712cb473f7 Adds extended ROM information for the CPC and ColecoVision. 2019-07-20 17:07:59 -04:00
Thomas Harte
3c68a5ca65 Enhances the amount of ROM information posted by the Apple machines. 2019-07-20 16:08:40 -04:00
Thomas Harte
20670bab2f Expands information included in ROM load requests. 2019-07-19 22:35:22 -04:00
Thomas Harte
86d709ae01 Merge pull request #626 from TomHarte/MacScreenshot
Adds a Macintosh screenshot
2019-07-18 20:43:26 -04:00
Thomas Harte
0aba95cc9d Recondenses image placement. 2019-07-18 20:40:25 -04:00
Thomas Harte
de3c8373fd Adds a Macintosh screenshot to the rogue's gallery. 2019-07-18 20:37:14 -04:00
Thomas Harte
75ecd4e72d Adds mention of the Macintosh. 2019-07-17 16:31:24 -04:00
Thomas Harte
56555a4d99 Merge pull request #621 from TomHarte/Mac128k
Adds preliminary emulation of the 512ke Macintosh.
2019-07-17 16:29:58 -04:00
Thomas Harte
cfad20bb33 Surfaces missing Macintosh types. 2019-07-17 16:02:25 -04:00
Thomas Harte
fa226bb1b9 Seeks to reduce enquiry costs. 2019-07-17 15:09:26 -04:00
Thomas Harte
77333ff9f7 It appears that file checksums are not reliable. 2019-07-17 14:56:50 -04:00
Thomas Harte
b9a34bee51 Substitutes a more efficient inner loop for audio generation. 2019-07-17 14:54:06 -04:00
Thomas Harte
22ee51c12c Corrects clocking issues around audio, and cuts down queue costs. 2019-07-17 14:41:36 -04:00
Thomas Harte
ee8d853fcb Ensures you can't get a phase 2 for free with run_for(0). 2019-07-17 14:20:27 -04:00
Thomas Harte
19198ea665 Improves const usage. 2019-07-16 22:13:47 -04:00
Thomas Harte
bcbda4d855 Adds .image as a synonym of .img. 2019-07-16 21:44:59 -04:00
Thomas Harte
79a624e696 Applies more rigorous logic to deciding when to stop parsing. 2019-07-16 18:06:54 -04:00
Thomas Harte
c123ca1054 Slightly improves syntax. 2019-07-16 18:05:58 -04:00
Thomas Harte
9f0f35033d Introduces sector interleaving. 2019-07-16 18:05:40 -04:00
Thomas Harte
3633285aaa Ensures a trailing zero bit isn't dropped. 2019-07-16 16:36:00 -04:00
Thomas Harte
cb16790330 Improves qualifiers. 2019-07-15 22:40:45 -04:00
Thomas Harte
67055d8b56 Reduces CheckingWriteProtect costs, negligibly. 2019-07-15 22:39:55 -04:00
Thomas Harte
ca37fd8f4c Corrects tag preservation. 2019-07-15 17:15:06 -04:00
Thomas Harte
46b98dab70 Bumps up the amount of reserved storage.
To avoid a reallocation when reading Mac data.
2019-07-15 17:12:31 -04:00
Thomas Harte
0568996264 Fixes a couple of data arrangement issues on output. 2019-07-15 17:11:58 -04:00
Thomas Harte
7baad61746 Attempts a full implementation of asynchronous write mode. 2019-07-15 17:11:12 -04:00
Thomas Harte
1d1e0d74f8 Corrects and introduces new parts. 2019-07-12 21:37:33 -04:00
Thomas Harte
d53d1c616f Continues trying to get to write support. 2019-07-12 21:20:05 -04:00
Thomas Harte
5b05a9bc61 Extends Drive to report is_writing and so that writing works as the first action. 2019-07-12 18:53:41 -04:00
Thomas Harte
2c39229b13 Adds has-new-disk flag, allowing mounting of software from the desktop. 2019-07-12 13:17:24 -04:00
Thomas Harte
59b5dfddec Added logic to allow a second disk to be inserted, at least. 2019-07-11 23:03:02 -04:00
Thomas Harte
b730ac5d5a Reintroduces 1-second disable implementation. 2019-07-11 23:02:47 -04:00
Thomas Harte
4860d8a7df Adds ask as a synonym of img. 2019-07-11 22:56:29 -04:00
Thomas Harte
9f0cde3d69 Improves mouse capture behaviour. 2019-07-11 22:56:08 -04:00
Thomas Harte
c8917e677b Edging towards implementing IWM write support, but mainly tidied up. 2019-07-11 21:42:34 -04:00
Thomas Harte
6c2cc206a6 Takes a first stab at write support for Macintosh disk images.
Albeit that the Macintosh itself can't yet write.
2019-07-11 18:09:37 -04:00
Thomas Harte
5a9f3cfc1e Completes Mac GCR decoding and its associated test. 2019-07-11 17:37:07 -04:00
Thomas Harte
8f28b33342 Starts work on Macintosh GCR decoding. 2019-07-11 16:28:52 -04:00
Thomas Harte
cac97a9663 Devolves drive responsibility. 2019-07-10 22:39:56 -04:00
Thomas Harte
2ccb564a7b Throws some extra logging into place, to test the IWM changeover. 2019-07-10 21:39:45 -04:00
Thomas Harte
d1d0430fce Eliminates the SonyDrive class. 2019-07-10 17:38:05 -04:00
Thomas Harte
be251d6b03 Begins substituting the DoubleDensityDrive for the Sony. 2019-07-10 16:24:48 -04:00
Thomas Harte
6cfaf920ee Added attribution and commentary on rotation speeds. 2019-07-10 16:22:06 -04:00
Thomas Harte
1657f8768c Transfers and slightly extends drive logic into the drive. 2019-07-10 16:17:51 -04:00
Thomas Harte
c4ab0bb867 Starts sketching out an interface for IWM drives, eliminating a dangling use of unsigned as it goes. 2019-07-10 16:05:59 -04:00
Thomas Harte
886946cc8c Rejigs time-until-event tracking. 2019-07-09 23:27:27 -04:00
Thomas Harte
ed4ddcfda8 Reduces call/return overhead on Microcycle methods. 2019-07-09 19:55:30 -04:00
Thomas Harte
7886cd63bd Flattens the Macintosh's perform_bus_operation, for legibility. 2019-07-09 19:49:06 -04:00
Thomas Harte
69b94719a1 Switches to faster bit count logic. 2019-07-09 18:41:20 -04:00
Thomas Harte
b4a3f66773 Restores just-in-time processing of video. 2019-07-09 18:08:07 -04:00
Thomas Harte
ab14433151 Tweaks optimisation level. 2019-07-09 18:07:43 -04:00
Thomas Harte
5078f6fb5c Marginally reduces MOVE heft. 2019-07-09 18:07:11 -04:00
Thomas Harte
fc6d62aefb Removes non-functioning workaround. 2019-07-09 16:41:15 -04:00
Thomas Harte
f73bccfec8 Adds a potential workaround for SDL mouse motion. 2019-07-09 16:38:16 -04:00
Thomas Harte
96be1a3f62 Corrects SDL mouse button up/down capture. 2019-07-09 16:32:38 -04:00
Thomas Harte
52e96e3d2a Documents and extends the Video interface.
With the intention of returning it soon to JIT execution.
2019-07-08 22:28:05 -04:00
Thomas Harte
33e2721eb2 Fully embraces forceinline. 2019-07-08 21:11:31 -04:00
Thomas Harte
4bc44666e5 Adds status notes. 2019-07-08 21:11:12 -04:00
Thomas Harte
3d8e4f96c8 Merge branch 'Mac128k' of github.com:TomHarte/CLK into Mac128k 2019-07-08 18:34:45 -04:00
Thomas Harte
94457d81b6 Eliminates redundant and integer-size-troubling AND on ASL. 2019-07-08 18:33:50 -04:00
Thomas Harte
c212bf27db Eliminates redundant and integer-size-troubling AND on ASL. 2019-07-08 18:28:36 -04:00
Thomas Harte
59b5ee65d4 Adds the Zilog SCC to SConstruct. 2019-07-08 18:18:49 -04:00
Thomas Harte
60cedca97b Adds cmath in support of ceilf. 2019-07-08 18:14:03 -04:00
Thomas Harte
1a9aa60bf7 Ensures no compiler will think this can exit without returning. 2019-07-08 18:13:23 -04:00
Thomas Harte
6438a5ca1f Updated SConstruct as per new Apple grouping. 2019-07-08 18:10:39 -04:00
Thomas Harte
3f303511bd Adds cstring include, in support of memcpy. 2019-07-08 18:06:58 -04:00
Thomas Harte
fb352a8d40 Ensures assert is completely excluded if NDEBUG. 2019-07-08 18:00:37 -04:00
Thomas Harte
ea7899f47d Updates the SConstruct in obvious ways. 2019-07-08 17:38:43 -04:00
Thomas Harte
fb6da1de4a Reduces logging temporarily. 2019-07-08 17:37:15 -04:00
Thomas Harte
2651b15db1 Takes a first stab at mouse input support from SDL.
There seems to be something odd going on with mouse buttons though; I'm going to test elsewhere.
2019-07-08 17:36:55 -04:00
Thomas Harte
6e7a733c3c Adds appropriate files to the Mac kiosk build. 2019-07-08 16:57:13 -04:00
Thomas Harte
245e27c893 Solidifies belief that the shift register bit is cleared on read/write. 2019-07-08 16:45:15 -04:00
Thomas Harte
793c2df7ee Fixes keypad keys. 2019-07-08 16:38:06 -04:00
Thomas Harte
28de629c08 Fixes the 6522 sufficiently to fix keyboard input. 2019-07-08 15:29:34 -04:00
Thomas Harte
210bcaa56d Introduces an initial shift unit test, and makes it pass. 2019-07-07 22:13:36 -04:00
Thomas Harte
d7329c1bdd Experiments with a timeout on keyboard interactions. 2019-07-07 14:13:55 -04:00
Thomas Harte
a5f0761a43 Copies in notes for required test functions. 2019-07-07 14:13:00 -04:00
Thomas Harte
dd963d6161 Eliminates call/return cost on WrappedInts. 2019-07-07 14:12:20 -04:00
Thomas Harte
96c0253ee2 Fixes mouse input when a button is pressed; attempts keyboard input.
I think the VIA is somehow sending spurious commands.
2019-07-02 21:14:33 -04:00
Thomas Harte
191a7a9386 Reintroduces an empty second drive.
This prevents the uninitialised disk error. Which is a clue.
2019-07-02 16:59:00 -04:00
Thomas Harte
387be4a0a6 Ensures mouse button presses propagate correctly.
Beyond the one that initiates mouse capture, that is.
2019-07-02 16:57:51 -04:00
Thomas Harte
b9c2c42bc0 Switches drives to using floats for time counting.
Hopefully to eliminate a lot of unnecessary `Time` work; inaccuracies should still be within tolerable range.
2019-07-02 15:43:03 -04:00
Thomas Harte
fffe6ed2df Chops the Macintosh down to a single drive to aid in development. 2019-07-02 13:59:30 -04:00
Thomas Harte
c4cbe9476c Corrects EA selection logic, fixing MOVEP. 2019-07-02 13:54:21 -04:00
Thomas Harte
0a67cc3dab Goes nuclear on ROXL and ROXR. 2019-07-01 23:05:48 -04:00
Thomas Harte
726e07ed5b Corrects ASL overflow flag. 2019-07-01 19:46:58 -04:00
Thomas Harte
ebb6313eef Corrects missing file. 2019-07-01 18:18:46 -04:00
Thomas Harte
11d8f765b2 Corrects divide-by-zero exception length, enables all other DIVS checks. 2019-07-01 15:46:04 -04:00
Thomas Harte
514e57b3e9 Corrects DIVU timing and flags, improves DIVS. 2019-07-01 14:24:32 -04:00
Thomas Harte
d8fb6fb951 Corrects MULU timing. 2019-06-30 22:40:10 -04:00
Thomas Harte
255f0d4b2a Corrects MULS timing. 2019-06-30 22:33:54 -04:00
Thomas Harte
d30e7504c2 Factors out MOVE tests, and ensures test machine RAM is zero initialised. 2019-06-30 21:43:30 -04:00
Thomas Harte
8d0cd356fd Corrects TRAP, TRAPV and CHK timing. 2019-06-29 21:25:22 -04:00
Thomas Harte
aff40bf00a Imports AND tests. 2019-06-29 20:16:10 -04:00
Thomas Harte
eedf7358b4 Imports first part of AND tests. 2019-06-29 16:29:47 -04:00
Thomas Harte
26aebcc167 Imports ROXL and ROXR tests.
Confirming the significant deficiencies I suspected.
2019-06-29 15:26:09 -04:00
Thomas Harte
9d420c727e Factors out rolls and shifts. 2019-06-29 14:12:52 -04:00
Thomas Harte
60fe84ad16 Imports Bcc tests. 2019-06-29 14:07:21 -04:00
Thomas Harte
6a44c682ad Factors out control flow tests. 2019-06-29 13:47:05 -04:00
Thomas Harte
60df44f0ca Imports CMPI tests. 2019-06-29 13:40:02 -04:00
Thomas Harte
ac926f5070 Factors BCD out of general arithmetic. 2019-06-29 13:31:24 -04:00
Thomas Harte
6e9a4a48f7 Imports TAS tests. 2019-06-28 22:56:35 -04:00
Thomas Harte
a8894b308a Splits out arithmetic tests, as so far implemented.
Further subdivision may be advisable.
2019-06-28 22:08:32 -04:00
Thomas Harte
7cc91e1bc5 Factors the bitwise tests out of the main bundle, as that pushes up towards 6,000 lines. 2019-06-28 21:58:38 -04:00
Thomas Harte
9eb51f164c Imports ANDI, ORI and EORI tests. 2019-06-28 21:42:58 -04:00
Thomas Harte
a1c00e9318 Adds BSR tests. 2019-06-28 21:31:41 -04:00
Thomas Harte
17666bc059 Corrects CHK flags. 2019-06-28 19:48:53 -04:00
Thomas Harte
241d29ff7c Imports SBCD and NBCD tests, and fixes corresponding operation. 2019-06-28 19:39:08 -04:00
Thomas Harte
c5039a4719 Imports ANDI, ORI and EORI to SR tests.
Hence corrects supervisor/user privileges for SR/CCR.
2019-06-28 15:05:46 -04:00
Thomas Harte
fd604048db Imports SUBX tests. 2019-06-28 14:30:26 -04:00
Thomas Harte
6a77ed1e07 Imports SUBI test. 2019-06-28 13:53:53 -04:00
Thomas Harte
9e38815ec4 Imports SUBQ tests. 2019-06-28 13:48:02 -04:00
Thomas Harte
86c325c4ec Imports MOVEA tests. 2019-06-28 13:41:37 -04:00
Thomas Harte
bfcc6cf12c Imports MULU tests.
Timing is wrong for now.
2019-06-28 13:33:41 -04:00
Thomas Harte
8ba8cf7c23 Imports TST tests. 2019-06-28 13:17:21 -04:00
Thomas Harte
6c588a1510 Makes some further random swings at tracking the startup procedure. 2019-06-28 13:03:47 -04:00
Thomas Harte
651fd9c4a5 Imports EOR tests. 2019-06-28 13:03:27 -04:00
Thomas Harte
5d0db2198c Imports BRA, EORI CCR and ORI CCR tests, extends PEA tests. 2019-06-27 23:05:00 -04:00
Thomas Harte
d81053ea38 Invents some additional PEA tests, and further fixes PEA. 2019-06-27 17:59:03 -04:00
Thomas Harte
8d39c3bc98 Takes a shot at fixing PEA for A7-relative addresses.
Unit tests required. Tomorrow.
2019-06-26 23:24:54 -04:00
Thomas Harte
da351a3e32 Imports MOVEQ tests. 2019-06-26 22:36:48 -04:00
Thomas Harte
c0591090f5 Imports DIVU tests. 2019-06-26 22:25:48 -04:00
Thomas Harte
538aecb46e Imports CMP tests, and fixes CMP.l timing. 2019-06-26 22:02:04 -04:00
Thomas Harte
dbdbea85c2 Imports CMPA tests, and fixes CMPA.w. 2019-06-26 21:42:48 -04:00
Thomas Harte
ba2224dd06 Imports NEGX tests and thereby fixes NEGX's zero flag. 2019-06-26 19:39:04 -04:00
Thomas Harte
44e2aa9183 Imports MOVEP tests; code corrections to come. 2019-06-26 19:01:09 -04:00
Thomas Harte
202bff70fe Imports BCLR and BTST tests. 2019-06-26 17:51:07 -04:00
Thomas Harte
26c0cd7f7c Imports ADDI tests. 2019-06-26 16:42:23 -04:00
Thomas Harte
cb76301fbe Imports BCHG tests. 2019-06-26 16:33:23 -04:00
Thomas Harte
8bfa12edf1 Adds lengths to ADD tests, imports ANDI ,CCR and MOVE to CCR. 2019-06-26 16:12:27 -04:00
Thomas Harte
7daa969a5a Imports SUBA tests. 2019-06-26 15:47:59 -04:00
Thomas Harte
4aeb60100d Completes import of MOVEM tests. 2019-06-26 15:31:21 -04:00
Thomas Harte
e2c7aaac5a Imports CLR tests. 2019-06-25 22:47:30 -04:00
Thomas Harte
6ff661c30d Imports OR tests. 2019-06-25 22:34:04 -04:00
Thomas Harte
79066f8628 Imports NOT tests, fixes NOT overflow and carry flags. 2019-06-25 22:18:11 -04:00
Thomas Harte
2c813a2692 Imports CMPM tests and fixes CMPM.bw source/destination order. 2019-06-25 21:46:01 -04:00
Thomas Harte
d2cb595b83 Proactively attempts to fix CMPM PostInc addressing. 2019-06-25 21:24:03 -04:00
Thomas Harte
cc4abcb00a Imports ADDQ tests. 2019-06-25 21:19:04 -04:00
Thomas Harte
c1ca85987f Incorporates MOVE to SR test. 2019-06-25 19:30:51 -04:00
Thomas Harte
ecb5a0b8cc Incorporates ADDX tests and fixes ADDX PreDec. 2019-06-25 19:18:07 -04:00
Thomas Harte
e12e8fc616 Incorporates ASR tests, and fixes ASR (xxx).w.
... which was re-injecting the wrong bit to preserve sign.
2019-06-25 18:44:31 -04:00
Thomas Harte
1fbbf32cd2 Adds ASL tests, and corrects ASL (xxx).w.
Overflow is wrong on other ASLs though, I think.
2019-06-25 18:09:01 -04:00
Thomas Harte
31edb15369 Reduces 68000 startup costs a little further. 2019-06-25 17:41:13 -04:00
Thomas Harte
d7883d18d4 Imports CHK tests.
Proving that I need to do some research on CHK's flags.
2019-06-25 14:55:03 -04:00
Thomas Harte
40100773d3 Imports LSR tests. 2019-06-25 13:57:42 -04:00
Thomas Harte
4048ed3a33 Imports ROR tests. 2019-06-25 13:16:44 -04:00
Thomas Harte
11f2d3cea7 Imports EXT tests. 2019-06-24 22:12:29 -04:00
Thomas Harte
aa656a39b8 Imports SUB tests. 2019-06-24 22:00:37 -04:00
Thomas Harte
e830d23533 Incorporates TRAPV tests. 2019-06-24 21:21:35 -04:00
Thomas Harte
9a666fb8cc Imports NEG tests and fixes NEG.l Dn timing. 2019-06-24 19:43:30 -04:00
Thomas Harte
0e208ed432 Fixes cycle counting in the test machine. 2019-06-24 17:55:09 -04:00
Thomas Harte
c8b769de8a Completes import of LSL tests and fixes various LSL issues.
Including LSL (xxx).w actually being LSR, and the carry flag generally being questionable.
2019-06-24 17:45:38 -04:00
Thomas Harte
c447655047 Resolves assumption that shifts greater than the bit count of the relevant int are well-defined in C. 2019-06-24 16:51:43 -04:00
Thomas Harte
3ec9a1d869 Incorporates JMP tests, fixes JSR (xxx).l timing. 2019-06-24 15:36:33 -04:00
Thomas Harte
d326886852 Completes BSET tests. 2019-06-24 14:04:08 -04:00
Thomas Harte
faef917cbd Improves resizeable microcycle test. 2019-06-24 10:55:22 -04:00
Thomas Harte
d27ba90c07 Attempts to introduce more rigour to variable-length instruction handling. 2019-06-24 10:43:28 -04:00
Thomas Harte
db4ca746e3 Introduces BSET tests, fixes BSET timing. 2019-06-23 22:53:37 -04:00
Thomas Harte
d50fbfb506 Imports EXG and PEA tests, and fixes EXG timing. 2019-06-23 22:21:25 -04:00
Thomas Harte
5d283a9f1f Imports LEA tests. 2019-06-23 21:48:47 -04:00
Thomas Harte
86fdc75feb Incorporates RTR test, adding a ProcessorState helper. 2019-06-23 18:37:32 -04:00
Thomas Harte
b63231523a Completes import of ROL tests. 2019-06-23 17:33:12 -04:00
Thomas Harte
70e296674d Starts import of ROL tests.
Including time tests, this time.
2019-06-22 22:42:57 -04:00
Thomas Harte
5089fcd2f6 Makes a slightly futile attempt to resolve Heisen-failures. 2019-06-22 18:52:06 -04:00
Thomas Harte
df2ce8ca6f Imports MOVE tests. 2019-06-21 22:03:27 -04:00
Thomas Harte
7e209353bb Imports UNLINK and NOP tests. 2019-06-21 21:29:02 -04:00
Thomas Harte
c2806a94e2 Imports further MOVEM tests. 2019-06-21 21:20:13 -04:00
Thomas Harte
d428120776 Completes import of LINK tests. 2019-06-21 18:33:44 -04:00
Thomas Harte
8c8493bc9d Ensures proper loading of the SP at reset. 2019-06-21 18:20:26 -04:00
Thomas Harte
6b996ae57d Improves test machine and incorporates a first test of LINK. 2019-06-21 18:20:13 -04:00
Thomas Harte
ccfe1b13cb Imports DIVS, MULS and MOVE from SR tests.
Not all passing.
2019-06-21 16:03:11 -04:00
Thomas Harte
0c1c10bc66 Introduces a test that proves that DIVS' attempt to set proper timing isn't working. 2019-06-20 19:29:02 -04:00
Thomas Harte
fafd1801fe Introduces first DIVS test, and associated fixes. 2019-06-20 19:02:03 -04:00
Thomas Harte
bcf6f665b8 Simplifies and completes DBcc tests.
Subject to omitting a few that look to me like duplicates.
2019-06-20 17:19:25 -04:00
Thomas Harte
bd069490b5 Incorporates approximately half of the DBcc tests. 2019-06-20 16:29:32 -04:00
Thomas Harte
79d8d27b4c Reintroduces use of locations_by_bus_step_ to decrease 68000 construction time. 2019-06-20 15:10:11 -04:00
Thomas Harte
624b0b6372 Adds Scc tests. No implementation fixes required. 2019-06-19 21:42:54 -04:00
Thomas Harte
7976cf5b3c Adds ADDA tests. All passing without 68000 changes. 2019-06-19 21:31:14 -04:00
Thomas Harte
440f52c943 Incorporates TRAP test. 2019-06-19 21:18:30 -04:00
Thomas Harte
47b1218a68 Adds a couple of the one-shots: SWAP, MOVE USP. 2019-06-19 19:10:36 -04:00
Thomas Harte
91ced056d2 Adds tests for ADD. No failures. 2019-06-19 18:56:21 -04:00
Thomas Harte
8dace34e63 Imports third-party tests for ABCD, and thereby fixes ABCD. 2019-06-19 18:13:06 -04:00
Thomas Harte
8182b0363f Adds enum to help with status decoding. 2019-06-19 17:01:49 -04:00
Thomas Harte
c5b036fedf Ensures aborted decodes don't overwrite prior correct ones. 2019-06-19 17:00:44 -04:00
Thomas Harte
e26ddd0ed5 Corrects address fetches for CMPI.l #, (xxx).w. 2019-06-19 13:52:56 -04:00
Thomas Harte
ca83431e54 Fixed: Scc is a byte operation.
It was, until now, post-incrementing and pre-decrementing registers other than A7 incorrectly.
2019-06-19 13:15:12 -04:00
Thomas Harte
68a3e5a739 Renamed DiskCopy42 to MacintoshIMG, now that it's not just DiskCopy 4.2 files. 2019-06-18 14:32:58 -04:00
Thomas Harte
b98f10cb45 Substitutes working GCR test. 2019-06-18 14:24:55 -04:00
Thomas Harte
9730800b6a Adds support for raw sector dumps. 2019-06-18 14:14:25 -04:00
Thomas Harte
506276a2bd Corrected: use format tag as intended. 2019-06-18 14:04:28 -04:00
Thomas Harte
00c32e4b59 Further miscellaneous changes to debug logging. All temporary. 2019-06-18 10:34:31 -04:00
Thomas Harte
df56e6fe53 Fixed: the sector number also goes into sector bodies.
Also the checksum is written in the other order, and the final byte of data isn't output.
2019-06-18 10:34:10 -04:00
Thomas Harte
756641e837 Fixed: tags go first, then data. 2019-06-16 22:00:12 -04:00
Thomas Harte
05c2854dbc Makes at least some attempt at producing real disk tracks. 2019-06-16 21:17:24 -04:00
Thomas Harte
5c8aacdc17 Fixes the more obvious issues with GCR encoding: byte order, top bit selection. 2019-06-16 17:17:24 -04:00
Thomas Harte
745a5ab749 Introduces failing test of Macintosh GCR data encoding. 2019-06-16 16:53:03 -04:00
Thomas Harte
fe0dc4df88 Starts building out some tests for Apple GCR encoding. 2019-06-15 22:48:24 -04:00
Thomas Harte
33f2664fe9 Makes a first attempt at Macintosh GCR encoding. 2019-06-15 22:29:02 -04:00
Thomas Harte
a17e47fa43 Apple's GCR header varies between the Mac and the Apple II. 2019-06-15 16:32:56 -04:00
Thomas Harte
877b46d2c1 Advances IWM/drive emulation very close to the point of 'Welcome to Macintosh'. 2019-06-15 16:08:54 -04:00
Thomas Harte
cc7226ae9f Starts trying to get a bit more rigorous about collected meanings. 2019-06-13 22:48:10 -04:00
Thomas Harte
bde975a3b9 Possibly mights the tiniest bit of headway with 'the IWM'.
I'm now pretty sure that my 3.5" drive, which for now is implemented in the IWM (yuck) is just responding to queries incorrectly.
2019-06-13 22:38:09 -04:00
Thomas Harte
f6f9024631 Corrects Macintosh aspect ratio (and framing). 2019-06-13 18:41:38 -04:00
Thomas Harte
39aae34323 Avoids multiple calls to -[NSCursor hide] and -unhide.
Those are reference counted.
2019-06-13 13:39:35 -04:00
Thomas Harte
5630141ad7 Ensures randomised memory contents at startup. 2019-06-13 13:35:16 -04:00
Thomas Harte
535747e3f2 Restores single-line logging format. 2019-06-13 13:35:03 -04:00
Thomas Harte
59a94943aa Resolves final set of build warnings. 2019-06-13 10:55:29 -04:00
Thomas Harte
bf4889f238 Reduces warnings to 6. 2019-06-13 10:43:00 -04:00
Thomas Harte
7cc5afd798 Eliminates another couple of implicit type conversion warnings. 2019-06-13 10:30:26 -04:00
Thomas Harte
11ab021672 Further reduces implicit conversion warnings, to 17. 2019-06-13 10:27:49 -04:00
Thomas Harte
feafd4bdae Eliminates further type conversion warnings. 2019-06-13 10:20:17 -04:00
Thomas Harte
d6150645c0 By hook or by crook, mouse input now works. 2019-06-12 22:19:25 -04:00
Thomas Harte
ccd2cb44a2 Fills in enough of the SCC to allow completion of the Macintosh side of that relationship. 2019-06-12 17:51:50 -04:00
Thomas Harte
ec5701459c Makes various temporary logging changes. 2019-06-11 19:54:07 -04:00
Thomas Harte
ad8b68c998 Switches to a proper form of zero-upon-read data.
Not that it's necessarily correct.
2019-06-11 19:53:51 -04:00
Thomas Harte
c8066b01b6 Restores attempt at proper audio behaviour. 2019-06-11 19:53:22 -04:00
Thomas Harte
ebd59f4dd3 Performs the trivial part of wiring up the Macintosh mouse.
SCC still to go.
2019-06-11 19:52:37 -04:00
Thomas Harte
109953ef49 Ensures proper routing of mouse events from Cocoa. 2019-06-11 18:41:41 -04:00
Thomas Harte
124c7bcbb0 Makes the Macintosh a mouse machine, and makes mouse machines detectable. 2019-06-11 18:21:56 -04:00
Thomas Harte
a0321aa6ff Starts sketching out an emulator interface for mice. 2019-06-11 17:47:24 -04:00
Thomas Harte
567feaac10 Adds a proper shout out for releasing the mouse. 2019-06-11 16:35:04 -04:00
Thomas Harte
15c38e2f15 Adds the option for mouse capture. 2019-06-11 16:30:53 -04:00
Thomas Harte
3c075e9542 Switches drives 0 and 1. 2019-06-10 14:58:39 -04:00
Thomas Harte
9230969f43 Corrects enough of the 6522 and Keyboard to get an initial command seemingly working. 2019-06-10 09:28:27 -04:00
Thomas Harte
0e16c67805 Improves shift register connection, towards having the keyboard function properly.
It now seems not to receive a command terminator, but is at least getting a command.
2019-06-08 23:04:55 -04:00
Thomas Harte
697e094a4e Sketches out the absolute basics of an SCC interface. 2019-06-08 18:47:11 -04:00
Thomas Harte
50d37798a2 Eradicates magic constants. 2019-06-06 21:37:43 -04:00
Thomas Harte
e9d0676e75 Fiddles further with the tachometer. 2019-06-06 21:36:19 -04:00
Thomas Harte
7591906777 Numerous IWM fixes: the machine now seems to be trying to measure the tachometer. 2019-06-06 18:32:11 -04:00
Thomas Harte
08671ed69c Fixes setting of a Time to a float. 2019-06-05 14:43:34 -04:00
Thomas Harte
511d292e73 Ensures gain noise is forgotten upon assumption of a new track. 2019-06-05 14:43:17 -04:00
Thomas Harte
a413ae11cb Makes some sort of first attempt at having the IWM read. 2019-06-04 22:13:00 -04:00
Thomas Harte
833258f3d7 Sets things up to allow variable rotation rates, and especially Sony 800kb-style self-selecting rates. 2019-06-04 21:41:54 -04:00
Thomas Harte
b8a1553368 Adds putative support for PlusToo-style BIN files.
Albeit a bit of a guess, since it's not intended to be an emulator file format.
2019-06-04 21:41:09 -04:00
Thomas Harte
058fe3e986 Fixes some other low-hanging warning fruit. 2019-06-04 16:47:10 -04:00
Thomas Harte
51ee83a427 Resolves a further 11 conversion errors. 2019-06-04 16:34:45 -04:00
Thomas Harte
5b21da7874 Reduces number of warnings to 70. 2019-06-04 16:27:09 -04:00
Thomas Harte
bd7f00bd9c Resolves a further handful of implicit type conversion warnings. 2019-06-04 15:43:44 -04:00
Thomas Harte
517cca251f Corrected: the repository shouldn't default to a Release build. 2019-06-04 15:41:36 -04:00
Thomas Harte
1033abd9fe Starts making some space for Macintosh-style GCR encoding. 2019-06-04 15:41:15 -04:00
Thomas Harte
113d022741 Merge branch 'master' into Mac128k 2019-06-03 21:58:22 -04:00
Thomas Harte
299a7b99ae Merge pull request #624 from TomHarte/BookendCrash
Permits end_data only after a begin_data.
2019-06-03 21:57:59 -04:00
Thomas Harte
66540ff86f Permits end_data only after a begin_data. 2019-06-03 21:56:53 -04:00
Thomas Harte
8557558bd8 Mildly improves investigatory reporting. 2019-06-03 21:51:45 -04:00
Thomas Harte
376cf08c71 Merge branch 'master' into Mac128k 2019-06-03 15:59:33 -04:00
Thomas Harte
83e5e650d2 Merge pull request #623 from TomHarte/SharpEdges
Disallows smaller buffer use for 'sharp' displays and tightens sampling window.
2019-06-03 15:59:05 -04:00
Thomas Harte
b860ba2ee3 Disallows smaller buffer use for 'sharp' displays and tightens sampling window. 2019-06-03 15:58:14 -04:00
Thomas Harte
661fe1e649 Disables logging, for now. 2019-06-03 15:57:53 -04:00
Thomas Harte
5b8375f0a0 Disallows smaller buffer use for 'sharp' displays and tightens sampling window. 2019-06-03 15:57:31 -04:00
Thomas Harte
abe55fe950 Adds Timer 1 toggling of PB7. 2019-06-03 15:39:20 -04:00
Thomas Harte
4d4ddded6d Fixes register-relative JMP and JSR. 2019-06-03 15:29:50 -04:00
Thomas Harte
1328708a70 Switches to testing against the Mac Plus ROM.
Immediately uncovering an issue with JMP.
2019-06-03 14:54:18 -04:00
Thomas Harte
85298319fa Expands towards supporting multiple Macintosh models.
To provide another variable to help with bug isolation.
2019-06-03 14:50:36 -04:00
Thomas Harte
881feb1bd3 Adds preliminary parsing of the Disk Copy 4.2 format. 2019-06-02 13:39:25 -04:00
Thomas Harte
3e9fa63799 Adds a receiver for drive-motor control bytes.
My new belief is that I'm either reading the buffer from the wrong place, or the 68000 isn't filling it for some reason.
2019-06-01 19:31:32 -04:00
Thomas Harte
da2b190288 Stores expected bit length. 2019-06-01 19:08:29 -04:00
Thomas Harte
48d837c636 Attempts to respond more sensibly to various queries.
Including adding a 1-second delay on motor off.
2019-06-01 18:43:47 -04:00
Thomas Harte
983407896c Ensures consistent audio pipeline. 2019-06-01 17:29:57 -04:00
Thomas Harte
5c08bb810e In theory provides a full implementation of audio.
Albeit seemingly ineffective.
2019-06-01 15:44:29 -04:00
Thomas Harte
17635da812 Pushes Mac audio further towards being able to function. 2019-06-01 15:18:27 -04:00
Thomas Harte
6d985866ee All proper inputs are now provided to the audio generator.
Hopefully. The next job is to generate audio. If that sounds correct, then the disk motor speed question can be tackled.
2019-06-01 15:03:15 -04:00
Thomas Harte
723137c0d4 With some time additions to the 6522, starts wiring in Macintosh audio.
The audio buffer is also the disk motor buffer, so this is preparatory to further disk work.
2019-06-01 14:39:40 -04:00
Thomas Harte
938928865d Merge branch 'master' into Mac128k 2019-05-30 22:29:56 -04:00
Thomas Harte
d80b0cbf90 Merge pull request #622 from TomHarte/SConstructUTF
Adds recommended fix for 0xc3 in position 12 error.
2019-05-30 22:25:57 -04:00
Thomas Harte
e88ef30ce6 Adds recommended fix for 0xc3 in position 12 error. 2019-05-30 22:20:15 -04:00
Thomas Harte
4197c6f149 Attempts to make some further semantic sense of the various IWM controls. 2019-05-30 22:17:49 -04:00
Thomas Harte
035f07877c Reduces conversions to vector. 2019-05-30 12:08:35 -04:00
Thomas Harte
4632be4fe5 Wires up the final IWM signal, SEL, preparatory to an implementation. 2019-05-30 12:08:00 -04:00
Thomas Harte
b3d2b4cd37 Fixes the interrupt return address. 2019-05-29 20:27:46 -04:00
Thomas Harte
c86fe9ada9 Ensures replace_write_values works in release builds. 2019-05-29 19:00:53 -04:00
Thomas Harte
ecf93b7822 Eliminates some type conversion warnings. 2019-05-29 14:56:50 -04:00
Thomas Harte
541b75ee6e Further fixes PEA, and OR/AND/EOR Dn, (An). 2019-05-29 14:37:15 -04:00
Thomas Harte
77b08febdb Corrects PEA and adds an additional debugging aid. 2019-05-29 12:47:17 -04:00
Thomas Harte
fcda376f33 Removes three further type conversion warnings. 2019-05-28 21:56:49 -04:00
Thomas Harte
0848fc7e03 Ensures the Mac uses auto vectored interrupts. 2019-05-28 16:24:41 -04:00
Thomas Harte
3bb8d6717f Ensures A7 is correct at end of an UNLINK. 2019-05-28 16:02:42 -04:00
Thomas Harte
5e2496d59c Simplifies and corrects MOVE logic. 2019-05-28 15:17:03 -04:00
Thomas Harte
c52da9d802 Adds some logging preparatory to a MOVE change. 2019-05-28 15:05:42 -04:00
Thomas Harte
1d3dde32f2 Ensures final byte of data can be accessed. 2019-05-09 07:24:26 -04:00
Thomas Harte
0b999ce0e4 Attempts to fix register-relative JSRs. 2019-05-09 06:43:07 -04:00
Thomas Harte
b04bd7069d Corrects Scc and DBcc (xxx).l and (xxx).w. 2019-05-09 06:28:55 -04:00
Thomas Harte
249b0fbb32 Corrects PC on stack after an illegal instruction.
Also fixed LOG_TRACE functionality.
2019-05-08 22:36:25 -04:00
Thomas Harte
41740fb45e Implements video position feedback.
At a substantial performance cost for now, but I'll worry about that once things are working.
2019-05-08 16:54:19 -04:00
Thomas Harte
0ad88508f7 Removes ROM mirroring above $600000. 2019-05-08 15:07:03 -04:00
Thomas Harte
8293b18278 Adds a TODO on what I think might be an incorrect implementation? 2019-05-08 15:06:40 -04:00
Thomas Harte
2ba0364850 Adds the shift register interrupt. 2019-05-08 15:02:07 -04:00
Thomas Harte
8b72043f33 Ensures no uninitialised variables. 2019-05-08 14:54:54 -04:00
Thomas Harte
2e7bc0b98a Attempts the shift register. 2019-05-08 14:54:40 -04:00
Thomas Harte
f0f9722ca6 Takes a first crack at the keyboard's serial protocol.
Albeit that without a working shift register in the VIA, this shouldn't really work yet.
2019-05-08 14:20:28 -04:00
Thomas Harte
b5ef88902b Edges further towards a functioning keyboard. 2019-05-08 13:58:52 -04:00
Thomas Harte
8278809383 Attempts to get more rigorous on communicating outward control line changes. 2019-05-08 13:33:22 -04:00
Thomas Harte
4367459cf2 Takes a first go at handshake and pulse modes. 2019-05-08 12:48:29 -04:00
Thomas Harte
254132b83d Eliminates 6522Base in pursuit of working handshake modes.
Specifically: this means that the places from which the BusHandler may be called are more numerous.
2019-05-08 12:35:17 -04:00
Thomas Harte
7b466e6d0a Begins work on a functioning keyboard. 2019-05-08 12:34:26 -04:00
Thomas Harte
7e6d4f5a3e Adds emulation of the real-time clock. 2019-05-08 00:12:19 -04:00
Thomas Harte
ce099a297a Eliminates RAM writes in ROM area.
I no longer think that logic is correct.
2019-05-07 17:16:22 -04:00
Thomas Harte
949c848815 Broadens address decoding.
To no obvious change in output.
2019-05-06 22:57:29 -04:00
Thomas Harte
9bf9b9ea8c Ensures unmapped peripherals return a consistent value. 2019-05-06 21:32:10 -04:00
Thomas Harte
d8ed8b66f3 Improves carry/extend for ROXL and ROXR. 2019-05-06 21:14:16 -04:00
Thomas Harte
a131d39451 I now believe only the 6522 is on the synchronous bus. 2019-05-06 14:10:13 -04:00
Thomas Harte
b540f58457 Sets a more appropriate display type. 2019-05-05 23:22:05 -04:00
Thomas Harte
4f5a38b5c5 Adds support for the alternate video buffer. 2019-05-05 23:05:24 -04:00
Thomas Harte
cefc3af08b Corrects RAM read decoding when the ROM overlay is enabled. 2019-05-05 22:48:40 -04:00
Thomas Harte
e6ed50383c Corrects PEA and MOVE.l (An)[+], (xxx).L; also adds an extra test that caught the latter. 2019-05-05 22:47:54 -04:00
Thomas Harte
96facc103a Adds an IWM shim and corrects graphics output.
... now that there is some.
2019-05-05 21:55:34 -04:00
Thomas Harte
407bbfb379 Pretending the Disk II is an IWM doesn't seem to achieve much. 2019-05-05 18:12:25 -04:00
Thomas Harte
a99ebda513 Takes a first shot at (inverted) Mac video output. 2019-05-04 22:27:58 -04:00
Thomas Harte
537b604fc9 It looks like writes should always go to RAM.
Now I see the screen buffer being filled with `0xffff`s, along with what is probably disk motor control data.
2019-05-04 17:29:30 -04:00
Thomas Harte
98bc570bf7 Adds further boilerplate around VIA and IWM decoding. 2019-05-04 17:12:26 -04:00
Thomas Harte
181b77c490 Adds decoding of IWM accesses and respect for the ROM overlay bit. 2019-05-04 16:38:01 -04:00
Thomas Harte
bc9eb82e6f Adds in VIA access decoding, and a note to self on video.
The Mac now proceeds to try to talk to the IWM.
2019-05-04 14:23:37 -04:00
Thomas Harte
29fc024ecd Starts negotiating the Macintosh memory map. 2019-05-04 12:33:27 -04:00
Thomas Harte
c1695d0910 Adds various notes to self. 2019-05-03 23:55:28 -04:00
Thomas Harte
6d6a4e79c9 Adds the absolute basics to include a 6522 in the Macintosh.
Not yet wired to anything.
2019-05-03 23:40:22 -04:00
Thomas Harte
417a3e1540 Adds missing call to flush. 2019-05-03 23:31:12 -04:00
Thomas Harte
fa8c804d47 Makes explicit a few implicit type conversions.
There's plenty more down this well, alas.
2019-05-03 23:26:03 -04:00
Thomas Harte
68392ce6f5 Adds enough of a concept of Mac video to get a properly initialised display.
Completely empty at present, naturally. Also this is the very first time I've run my 68000 at live speed. From just one data point, it's not terrible. Phew!
2019-05-03 23:25:42 -04:00
Thomas Harte
6873f62ad8 Ensures that the Mac now retains its ROM properly. 2019-05-03 22:39:09 -04:00
Thomas Harte
5f385e15f6 Adds the bare bones necessary to be able to create a Macintosh from File -> New... . 2019-05-03 22:16:07 -04:00
Thomas Harte
8c5d37b6ee Refactors the AppleII into a sub-namespace to make room for other Apple machines. 2019-05-03 18:14:10 -04:00
Thomas Harte
9c3c2192dd Merge pull request #611 from TomHarte/68000
Adds an Initial Emulation of the 68000
2019-05-03 15:08:24 -04:00
Thomas Harte
4f9f73ca81 Corrects tests affected by change in run_for_instructions semantics and new program base address. 2019-05-03 15:05:14 -04:00
Thomas Harte
2c9a1f7b16 Restores vector. 2019-05-03 14:50:07 -04:00
Thomas Harte
0ea4c1ac80 Evicts #includes from my namespace. 2019-05-03 14:48:39 -04:00
Thomas Harte
a873ec97eb Also previously missing: vector.h. 2019-05-03 14:43:31 -04:00
Thomas Harte
cc8a65780e Adds further missing includes. 2019-05-03 14:42:36 -04:00
Thomas Harte
c117deb43b Introduces a couple of missing #includes. 2019-05-03 14:37:05 -04:00
Thomas Harte
ae31d45c88 Introduces the 68000 to SConstruct. 2019-05-03 14:31:09 -04:00
Thomas Harte
a0eb20ff1f Tweaks divide-by-zero timing. 2019-05-03 14:29:36 -04:00
Thomas Harte
34fe9981e4 Added necessary mea culpas. 2019-05-03 14:25:25 -04:00
Thomas Harte
291e91375f Takes a shot at the synchronous bus. 2019-05-03 14:20:59 -04:00
Thomas Harte
857f74b320 Fixed: the accepted interrupt level now appears on the bus. 2019-05-02 15:47:12 -04:00
Thomas Harte
1d9608efc7 Alters the order of interrupt bus activity, to bring it into line with a real 68000. 2019-05-02 15:25:43 -04:00
Thomas Harte
93616a4903 Completes test of a vectored interrupt.
Correcting issues uncovered.
2019-05-02 00:00:09 -04:00
Thomas Harte
bb07206c55 Corrects internet response to work as currently implemented.
Also makes corrections to the bus error and address error exceptions.
2019-05-01 21:59:06 -04:00
Thomas Harte
2e5c0811e7 Makes some effort at getting into interrupt processing. 2019-05-01 15:26:36 -04:00
Thomas Harte
f6ac407e4d Takes further steps towards supporting interrupts.
Specifically:
* introduces the necessary bus signalling; and
* adds corresponding functional steps.

Still to figure out: getting into and out of an interrupt cycle.
2019-05-01 15:19:24 -04:00
Thomas Harte
078c3135df The 5/3 split of microcycles appears not accurately to model when lines are tested.
Therefore I've reverted to a more normative 4:4 form.
2019-04-30 22:09:13 -04:00
Thomas Harte
92568c90c8 Adds support for HALT as an input, and puts some effort into how to calculate E. 2019-04-30 22:07:48 -04:00
Thomas Harte
f1879c5fbc Corrects interrupt level test within STOP. 2019-04-30 19:32:35 -04:00
Thomas Harte
31bb770fdd Implement STOPpages, waits for DTack, and bus and address error exceptions. 2019-04-30 19:24:22 -04:00
Thomas Harte
e430f2658f Adds a test and by that means fixes divide-by-zero exception return addresses. 2019-04-29 23:09:50 -04:00
Thomas Harte
3060175ff5 Eliminates constructions of std::tuple for performance reasons.
Specifically: reduces 68000 construction time from 10+ seconds to more like 2.8.
2019-04-29 22:43:15 -04:00
Thomas Harte
eb4233e2fd Joins some commonalities, shaving about 150 lines of code. 2019-04-29 22:37:23 -04:00
Thomas Harte
6b4c656849 Reverses order of instruction instantiation, reducing total bus step heft by about 11%.
... since that means inserting more complicated instructions before simpler ones in general, making subset finds more likely.
2019-04-29 22:20:18 -04:00
Thomas Harte
1b8fada6aa Restores accidentally-cropped functionality. 2019-04-29 22:10:00 -04:00
Thomas Harte
7332c64964 Improves testing of function as distinct from timing. 2019-04-29 22:08:37 -04:00
Thomas Harte
977f9ee831 Takes a run at divide-by-zero exceptions and starts looking towards ways to improve startup time. 2019-04-29 22:08:16 -04:00
Thomas Harte
16fb3b49a5 It leads to a TODO, but implemented decoding and initial setup of STOPpages. 2019-04-29 19:30:00 -04:00
Thomas Harte
3da1b3bf9b Introduces storage for various bus inputs. 2019-04-29 19:22:05 -04:00
Thomas Harte
bc00856c05 Removed TODO; it appears this is just the standard stack frame. 2019-04-29 19:09:20 -04:00
Thomas Harte
52e3dece81 Improves exposition. 2019-04-29 19:07:14 -04:00
Thomas Harte
2c1d8fa18a Adds a check for instruction privilege violation, albeit that I think I need different bus steps. 2019-04-29 19:06:10 -04:00
Thomas Harte
3e34ae67f6 Implements support for the trace flag. 2019-04-29 19:02:59 -04:00
Thomas Harte
d6e16d0042 Adds a test of TOS 1.00, as far as it goes without meaningful hardware. 2019-04-29 18:04:57 -04:00
Thomas Harte
8e02d29ae6 Trims test to length of trace capture. 2019-04-29 17:56:49 -04:00
Thomas Harte
ceebecec8d Corrects zero and negative flags for EXT.w. 2019-04-29 17:54:33 -04:00
Thomas Harte
05d1eda422 Fixes crossed-over decoding of EORI and ORI. 2019-04-29 17:45:52 -04:00
Thomas Harte
31f318ad43 Fixes MOVE.bw #, (xxx).w. 2019-04-29 17:41:46 -04:00
Thomas Harte
270f46e147 Normalises CMPl. 2019-04-29 17:27:56 -04:00
Thomas Harte
c0e9c37cc7 Improves memory map model, as far as it goes. 2019-04-29 17:27:44 -04:00
Thomas Harte
8564945713 Corrects vector nomination for unrecognised opcodes. 2019-04-29 17:10:33 -04:00
Thomas Harte
7bd7f3fb73 Sign-extends (xxx).w addresses. 2019-04-29 16:55:43 -04:00
Thomas Harte
5b5bfc8445 Applies trace testing to EmuTOS. 2019-04-29 16:55:21 -04:00
Thomas Harte
c466b6f9e7 Factors out the [unit testing] stuff of being a trace-checking 68000 bus handler. 2019-04-29 16:11:01 -04:00
Thomas Harte
407643c575 Tweaks test length slightly to ensure this doesn't run beyond the final line's end. 2019-04-29 15:40:17 -04:00
Thomas Harte
d9071ee9f1 Starts sketching out the asynchronous bus. 2019-04-29 13:45:53 -04:00
Thomas Harte
97e118abfa Corrects accidental exclusion of MOVE.bw (xxx).w, [(xxx).w/(xxx).l]. 2019-04-28 23:25:46 -04:00
Thomas Harte
412f091d76 Implements a missing form of BTST. 2019-04-28 23:20:50 -04:00
Thomas Harte
d9278e9827 Attempts to complete the list of things I can't disassemble.
Mysteries to be solved here, definitely. But: 13 missing opcodes remaining.
2019-04-28 23:11:49 -04:00
Thomas Harte
ca1f669e64 Implements MOVEP.
371 is now the alleged number of missing opcodes. But I'd dare imagine it's more like three or four.
2019-04-28 22:52:54 -04:00
Thomas Harte
0298b1b3b7 Implements LINK and UNLINK.
Also starts excluding opcodes that I can't determine the mapping of from the list of those tested against.

Due to those two things together, the latter incomplete: 627 opcodes outstanding. But only STOP and MOVEP remain on my list of things to implement prior to exceptions.
2019-04-28 17:12:31 -04:00
Thomas Harte
4b1324de77 Takes a run at TRAPV.
... to leave 1466 as the unimplemented count.
2019-04-28 15:52:58 -04:00
Thomas Harte
8e8dce9bec Attempts an implementation of CHK.
1467 is now the official count of things to implement, though I'm starting to get suspicious.
2019-04-28 15:47:21 -04:00
Thomas Harte
f4350522bf Implements NBCD.
Now outstanding: 1891.
2019-04-27 21:29:50 -04:00
Thomas Harte
e2abb66a11 Adds missing addressing modes for ADDA and SUBA.
... reducing missing opcodes to 1941.
2019-04-27 17:22:26 -04:00
Thomas Harte
ab5fcab9bf Attempts an implementation of ADDX and SUBX.
Leaving 2005 non-[A/F]-line instructions.
2019-04-27 16:57:47 -04:00
Thomas Harte
cf547ef569 Improves semantic communications and temporarily omits A- and F-line instructions.
So it looks like 2773 instructions left to go.
2019-04-27 15:15:03 -04:00
Thomas Harte
e75b386f7d Attempts DIVU and DIVS.
Reportedly leaving 10965 operations now unimplemented.
2019-04-26 22:22:35 -04:00
Thomas Harte
796203859f Implements PEA.
This decreases the unimplemented count by 28 from 11841 to 11813.
2019-04-26 13:49:59 -04:00
Thomas Harte
40f68b70c1 Adds quantification of reports.
Depressingly; 11,841 opcodes are still missing. Better get on with it!
2019-04-26 13:25:34 -04:00
Thomas Harte
40b2fe7339 Merge branch 'master' into 68000 2019-04-26 00:02:35 -04:00
Thomas Harte
a3b6d2d16e Corrects test and resolves all instances of opcodes that are valid but shouldn't be.
The converse case will require implementation of the remaining instructions.
2019-04-25 22:54:58 -04:00
Thomas Harte
3983f8303f Introduces failing test of 68000 opcode coverage. 2019-04-25 22:06:05 -04:00
Thomas Harte
7cbd5e0ef6 Imports additional files used as test cases. 2019-04-25 21:43:47 -04:00
Thomas Harte
dab9bb6575 Implements EXT. 2019-04-25 18:22:19 -04:00
Thomas Harte
7df85ea695 Cleans up and formally introduces a comparative source for QL startup. 2019-04-25 15:42:41 -04:00
Thomas Harte
c132bda01c Implements MOVE from SR. 2019-04-25 14:39:32 -04:00
Thomas Harte
4e25bcfcdc Corrects decoding of AND/OR x, Dn. 2019-04-25 14:19:13 -04:00
Thomas Harte
ea463549c7 Corrects overflow flag for LSL and LSR. 2019-04-25 13:59:10 -04:00
Thomas Harte
723acb31b3 Corrects various flag issues with ADD, SUB and NEG. 2019-04-25 13:53:23 -04:00
Thomas Harte
5725db9234 Corrects calculated-address TAS. 2019-04-25 12:42:05 -04:00
Thomas Harte
8557e563bc Takes a run at TAS, clarifying bus cycles. 2019-04-25 12:19:40 -04:00
Thomas Harte
d2491633ce Ensures MOVEM to M .w correctly updates A7. 2019-04-24 23:21:15 -04:00
Thomas Harte
002796e5f5 Takes a run at BSET and BCHG. 2019-04-24 23:01:32 -04:00
Thomas Harte
fa0accf251 Attempts to correct flags for ASL, ASR, LSL, LSR. 2019-04-24 21:04:47 -04:00
Thomas Harte
dcb8176d90 Corrects potential failure properly to set stack pointer state. 2019-04-24 17:58:27 -04:00
Thomas Harte
be32b1a198 Fixes JSR (An) return address [again]. 2019-04-24 17:50:38 -04:00
Thomas Harte
582e4acc11 Implements ANDI/ORI/EOR to SR/CCR. 2019-04-24 17:38:59 -04:00
Thomas Harte
10f75acf71 Causes EXG to function. 2019-04-24 16:32:16 -04:00
Thomas Harte
b9933f512f Fixed: the word/long-word bit works the other way around. 2019-04-24 16:30:15 -04:00
Thomas Harte
75a7f7ab22 Inserts missing program fetch for CMPI.bw #, (d8/16...). 2019-04-24 14:45:24 -04:00
Thomas Harte
757be2906e Merge pull request #620 from rzumer/fix_typos
Correct typos in Z80.hpp
2019-04-24 13:25:06 -04:00
Thomas Harte
e214584c76 SWAP should clear overflow and carry. 2019-04-24 13:19:56 -04:00
Thomas Harte
0bb6b498ce Simplifies and fixes post-inc MOVE behaviour. 2019-04-24 13:14:25 -04:00
Thomas Harte
958d44a20d Causes SWAP actually to perform. 2019-04-24 13:06:12 -04:00
Thomas Harte
bb9424d944 Corrects byte increment/decrement actions for A7. 2019-04-24 13:01:08 -04:00
Thomas Harte
11bf706aa2 Attempts to fix LT and LTE conditions. 2019-04-24 10:07:17 -04:00
Thomas Harte
033b8e6b36 ADD/SUBQ #, An shouldn't set flags.
Also, temporarily at least, adds a new means for observing CPU behaviour.
2019-04-24 09:59:54 -04:00
Thomas Harte
7c3ea7b2ea Resolves additional byte accesses being signalled as word. 2019-04-23 21:23:20 -04:00
Thomas Harte
a08043ae88 Ensures that MOVE.b #, (xxx).l writes only a byte.
Also rearranges some of the temporary logging functionality.
2019-04-23 19:01:58 -04:00
Thomas Harte
7c132a3ed5 Ensures 16-bit values of Xn for (d8, An, Xn) are sign extended. 2019-04-22 22:13:02 -04:00
Thomas Harte
20e774be1e Corrects return address of JSR (An). 2019-04-22 21:11:49 -04:00
Thomas Harte
6d6046757d Fixes predecrementing MOVEM to leave the proper address in the relevant register. 2019-04-22 15:41:09 -04:00
Thomas Harte
55073b0a52 Corrects a bunch of MOVEs to (d8/16, PC/An, [Xn]). 2019-04-21 22:55:23 -04:00
Thomas Harte
44eb4e51ed Ensures DBcc properly signals program fetches. 2019-04-21 22:54:20 -04:00
Thomas Harte
3cb042a49d Corrects the carry and extend flags for various long-word operations. 2019-04-21 22:08:18 -04:00
Thomas Harte
b78ea7d24c Further simplifies CMPA. 2019-04-20 21:23:36 -04:00
Thomas Harte
c66728dce2 Corrects decoding of CMPA. 2019-04-20 21:21:33 -04:00
Thomas Harte
0be9a0cb88 Corrects Scc (and other conditionals) for complex addressing modes. 2019-04-20 18:35:19 -04:00
Thomas Harte
a90f12dab7 Corrects return address for TRAP. 2019-04-20 15:49:32 -04:00
Thomas Harte
ef33b004f9 Corrects word access order of MOVEM.l. 2019-04-20 15:13:12 -04:00
Thomas Harte
2cac4b0d74 Corrects EA usage for ADDA and SUBA. 2019-04-19 23:02:41 -04:00
Thomas Harte
a49f516265 Corrects direction of MOVE [to/from] USP. 2019-04-19 22:41:06 -04:00
Raphaël Zumer
71ac26944d Correct typos in Z80.hpp 2019-04-19 17:44:52 -04:00
Thomas Harte
2d97fc1f59 Beefs up documentation and developer support. 2019-04-19 13:29:35 -04:00
Thomas Harte
9ef7743205 Attempts to unify type decoding a little further. 2019-04-19 13:29:20 -04:00
Thomas Harte
ee7ae11e90 Implements EXG and SWAP. 2019-04-19 11:27:43 -04:00
Thomas Harte
f67d7f1db5 Adds the final (!) set of missing MOVEs. 2019-04-19 11:11:38 -04:00
Thomas Harte
99981751a2 Adds the official NOP.
Which is a freebie.
2019-04-18 23:46:01 -04:00
Thomas Harte
ffdf02c5df Adds MOVE XXX.lw, -(An) 2019-04-18 23:40:54 -04:00
Thomas Harte
27c7d00a05 Commutes final missing MOVEs to TODOs. 2019-04-18 23:35:32 -04:00
Thomas Harte
64c4137e5b Begins a cleanup procedure on MOVE. 2019-04-18 23:25:19 -04:00
Thomas Harte
8c26d0c6e6 Makes an attempt at RTE and RTR. 2019-04-18 20:50:58 -04:00
Thomas Harte
81dcfd9f85 Implements AND, OR and EOR.
As well as introducing a little more nuance to the double-decoding test.
2019-04-18 16:34:48 -04:00
Thomas Harte
9334557fbf Added important TODO. 2019-04-17 23:12:32 -04:00
Thomas Harte
b09de8efce Attempts to fill in the rest of MOVE x, -(An). 2019-04-17 23:05:16 -04:00
Thomas Harte
5a50eb56dd Marginally increases coverage of MOVE x, -(An). 2019-04-17 22:30:07 -04:00
Thomas Harte
e49b257e94 Takes a run at TRAP. 2019-04-17 22:21:56 -04:00
Thomas Harte
b8a0f4e831 Implements MOVE to/from USP. 2019-04-17 16:58:59 -04:00
Thomas Harte
c265ea9847 Corrects byte writes in both test machines. 2019-04-17 16:39:10 -04:00
Thomas Harte
29f8dcfb40 Fixes a bunch of (d16, An)-type MOVEs and implements MOVE (XXX).wl, (d16,An)/etc. 2019-04-17 16:13:35 -04:00
Thomas Harte
0c05983617 Shortens impact of MULU on the instruction stream to correct parsing.
I need to look into this.
2019-04-17 15:15:48 -04:00
Thomas Harte
0bd653708c Corrects MOVE.bw Dn, (An)[+]. 2019-04-17 14:31:20 -04:00
Thomas Harte
41d800cb63 Fixes ADD/SUB Dn,x to use the proper destination value. 2019-04-17 10:23:47 -04:00
Thomas Harte
cadc0bd509 Mental delusion lifted: JSR doesn't look enough like BSR. 2019-04-17 10:02:14 -04:00
Thomas Harte
b64da2710a Corrects a few MOVE #s. 2019-04-17 10:00:14 -04:00
Thomas Harte
82b08d0e3a Corrects addressing behaviour of nRd[+-]. 2019-04-17 08:53:34 -04:00
Thomas Harte
8f77d1831b Implements MULU and MULS. 2019-04-16 22:16:43 -04:00
Thomas Harte
be722143e1 Completes addressing modes for ADDI/etc/etc. 2019-04-16 21:34:16 -04:00
Thomas Harte
d8d974e2d7 Consolidates JSR and BSR preparation. 2019-04-16 21:29:37 -04:00
Thomas Harte
9b7ca6f271 Implements the basics of EORI, ORI, ANDI, SUBI and ADDI.
Also corrects the BSR return address.
2019-04-16 19:50:10 -04:00
Thomas Harte
8ce018dbab Adds the necessary runtime support for AND, EOR and OR. 2019-04-16 15:17:40 -04:00
Thomas Harte
180062c58c Finishes fleshing out [ADD/SUB]Q. 2019-04-16 14:28:31 -04:00
Thomas Harte
6076b8df69 Merge branch 'master' into 68000 2019-04-16 14:07:23 -04:00
Thomas Harte
5e65ee79b1 Merge pull request #617 from TomHarte/MSXDisk
Removes hard-coded assumption about disk ROM list placement.
2019-04-16 11:22:52 -04:00
Thomas Harte
c0861c7362 Removes hard-coded assumption about disk ROM list placement. 2019-04-16 11:22:03 -04:00
Thomas Harte
37656f14d8 Adds basic addressing modes for [ADD/SUB]Q. 2019-04-16 11:19:45 -04:00
Thomas Harte
dec5535e54 Implements (arguably: fixes) BSR. 2019-04-15 23:20:36 -04:00
Thomas Harte
1f0e3b157a Corrects a couple of JSR and JMP addressing modes. 2019-04-15 22:37:11 -04:00
Thomas Harte
d802e83f49 Fills in further MOVEs. 2019-04-15 22:25:22 -04:00
Thomas Harte
ebcae25762 Adjusts JSR behaviour and further extends MOVE. 2019-04-15 22:02:52 -04:00
Thomas Harte
5330267d16 Implements BCLR. 2019-04-15 18:11:02 -04:00
Thomas Harte
892476973b Attempts RO{X}[L/R]. 2019-04-15 17:31:58 -04:00
Thomas Harte
84f4a25bc9 Completes TST. 2019-04-15 16:28:20 -04:00
Thomas Harte
1460a88bb3 Takes a run at JSR and RTS. 2019-04-15 15:14:38 -04:00
Thomas Harte
62e4c23961 Corrects memory map, causing the RAM test no longer to fail. 2019-04-15 13:03:32 -04:00
Thomas Harte
d25ab35d58 Finally gets setw usage correct. 2019-04-15 12:41:56 -04:00
Thomas Harte
a223cd90a1 Adds predecrement TSTs, increases QL running time, reduces logging. 2019-04-15 12:36:08 -04:00
Thomas Harte
aef92ba29c Corrects immediate shift count. 2019-04-15 12:25:45 -04:00
Thomas Harte
328d297490 Implements the first few addressing modes for TST. 2019-04-15 10:03:52 -04:00
Thomas Harte
3d240f3f18 Corrects decoding of DBcc. 2019-04-15 09:49:23 -04:00
Thomas Harte
45f35236a7 Corrects decoding of ADDA and SUBA. 2019-04-15 09:44:06 -04:00
Thomas Harte
fba210f7ce Corrects MOVE.l Dn, (An)[+]. 2019-04-15 09:30:49 -04:00
Thomas Harte
8a09e5fc16 Implements Scc. 2019-04-14 22:39:13 -04:00
Thomas Harte
52e33e861c Starts to introduce the QL as a second source for 68000 testing.
It's advantageous over the ST in that a commented disassembly of the ROM is available.
2019-04-14 22:15:09 -04:00
Thomas Harte
75d8824e6b Eliminates implicit type conversion. 2019-04-14 21:02:28 -04:00
Thomas Harte
325af677d3 Implements MOVEM to M with an implicit type conversion. 2019-04-14 20:53:27 -04:00
Thomas Harte
1003e70b5e Implements MOVEM to R. 2019-04-14 20:02:18 -04:00
Thomas Harte
d70229201d Advances right up to the lack of MOVEM actions being the final piece. 2019-04-14 14:45:29 -04:00
Thomas Harte
823f91605b Still slow pedalling slightly, adds further MOVEM storage. 2019-04-14 14:31:13 -04:00
Thomas Harte
53f75034fc Commits at least to decoding MOVEM. 2019-04-14 14:09:28 -04:00
Thomas Harte
78649a5b54 Fleshes out MOVE, (XXX) a little further. 2019-04-12 17:16:03 -04:00
Thomas Harte
f48db625a0 Corrects write-back and zero flag for ADD/SUB.l. 2019-04-12 16:41:00 -04:00
Thomas Harte
2ba66c4457 Corrects MOVEA, adds extra test safeguards. 2019-04-12 16:10:17 -04:00
Thomas Harte
2c78ea1a4e Completes conversion away from magic constants. 2019-04-12 15:48:29 -04:00
Thomas Harte
73f50ac44e Commits further to elimination of magic constants. 2019-04-12 13:45:28 -04:00
Thomas Harte
9ce48953c1 Improves debugging printout. 2019-04-12 13:45:03 -04:00
Thomas Harte
1098cd0c6b Begins rooting out magic constants. 2019-04-11 22:31:17 -04:00
Thomas Harte
652ebd143c Corrects addressing mode support for LEA. 2019-04-11 11:58:34 -04:00
Thomas Harte
8e9d7c0f40 Corrects register-relative address calculation. 2019-04-10 23:09:03 -04:00
Thomas Harte
a64948a2ba Permits zero-bus-op non-terminals. 2019-04-10 22:42:43 -04:00
Thomas Harte
43f619a081 Implements ASL, ASR, LSL and LSR. 2019-04-10 22:31:04 -04:00
Thomas Harte
a07de97df4 Implements the fixed part of register shifts. 2019-04-09 22:12:37 -04:00
Thomas Harte
85d25068a8 Attempts a full implementation of memory shifts. 2019-04-09 22:04:25 -04:00
Thomas Harte
7a0319cfe5 Kicks the work of dealing with ASL/etc into the runtime. 2019-04-09 21:48:08 -04:00
Thomas Harte
f750671f33 Stepping gingerly onwards, adds a double-decoding test.
As a result of that, collapses BRA into Bcc. Which provisionally looks correct.
2019-04-09 16:54:41 -04:00
Thomas Harte
7886fe677a Cleans up commenting. 2019-04-08 22:51:18 -04:00
Thomas Harte
73c027f8e3 Implements CMPA and CMPM. [Provisionally] completing the CMPs. 2019-04-08 22:40:38 -04:00
Thomas Harte
eda88cc462 Implements MOVE to CCR. 2019-04-07 22:24:17 -04:00
Thomas Harte
652f4ebfed Implements CLR, NEG, NEGX and NOT. 2019-04-07 22:07:39 -04:00
Thomas Harte
06a2f59bd0 Implements DBcc. 2019-04-06 23:21:01 -04:00
Thomas Harte
0af57806da Adds a hard-coded value sufficient to advance in TOS startup. 2019-04-06 20:00:34 -04:00
Thomas Harte
03f365e696 Corrects source/destination order of CMP setup. 2019-04-06 20:00:15 -04:00
Thomas Harte
49a22674ba Corrects MOVE destinations. 2019-04-06 18:33:53 -04:00
Thomas Harte
ec494511ec Implements CMP. 2019-04-06 10:41:19 -04:00
Thomas Harte
af02ce9c6e Attempts to correct various instances of PC-relative addressing. 2019-04-05 23:49:13 -04:00
Thomas Harte
56e42859ab Ensures the supervisor flag is updated properly on MOVE to SR. 2019-04-05 23:21:50 -04:00
Thomas Harte
2d153359f8 Adds BTST. 2019-04-04 21:43:22 -04:00
Thomas Harte
068ce23716 Adds a few more MOVEs. 2019-04-04 19:49:19 -04:00
Thomas Harte
03be2e3652 Adds decoding of ADDA and SUBA. 2019-04-03 22:39:01 -04:00
Thomas Harte
4ef2c0bed8 Completes ADD and SUB. 2019-04-03 21:41:59 -04:00
Thomas Harte
bfd405613c Reuse of addresses is also no longer implicit. 2019-04-03 21:27:11 -04:00
Thomas Harte
73e1c8c780 Corrects now-unimplemented ADD/SUB. 2019-04-03 19:43:54 -04:00
Thomas Harte
689ba1d4a2 Effective address adjustments now have to be explicit. 2019-04-03 19:13:10 -04:00
Thomas Harte
39b9d00550 Moves some way towards mapping out ADD and SUB, fixing a bug with address register modification. 2019-04-02 21:50:58 -04:00
Thomas Harte
64f99d83a4 Takes a stab at offering ADD, ADDA, SUB and SUBA operations.
Not yet decoded.
2019-04-01 21:21:26 -04:00
Thomas Harte
8f1faefa1c Implements further MOVEs and fixes a potential error in program formation. 2019-03-31 22:34:28 -04:00
Thomas Harte
2c5ff9ada0 Switches to running the real TOS, at least temporarily, and enables better testing. 2019-03-31 22:27:57 -04:00
Thomas Harte
a9ceef5c37 Improves communication slightly. 2019-03-31 22:27:33 -04:00
Thomas Harte
c6f977ed4b Corrects CMPI and documentation; implements JMP. 2019-03-31 21:13:26 -04:00
Thomas Harte
cb240cd32a Switches to a more explicit tokeniser, to allow for greater flexibility momentarily. 2019-03-30 23:11:39 -04:00
Thomas Harte
bc6349f823 Adds RESET, fixes branches and attempts to fix CMPI. 2019-03-29 23:40:54 -04:00
Thomas Harte
a93a1ae40f Completes MOVE.blw <ea>, Dn/An/(An)/(An)+, implements MOVEq. 2019-03-29 23:13:41 -04:00
Thomas Harte
25254255fe Implements a few additional MOVEs. 2019-03-27 21:26:04 -04:00
Thomas Harte
b0b2798f39 Updates to track Swift. 2019-03-27 21:25:51 -04:00
Thomas Harte
7f5c637aeb Updates to Swift 5. 2019-03-26 22:15:38 -04:00
Thomas Harte
42634b500c Implements LEA. 2019-03-26 22:07:28 -04:00
Thomas Harte
6f0eb5eccd Merge branch 'master' into 68000 2019-03-26 21:03:57 -04:00
Thomas Harte
3d83891eb0 Merge pull request #613 from TomHarte/Swift5
Performs basic migration to Xcode 10.2.
2019-03-26 21:03:30 -04:00
Thomas Harte
69a2a133d5 Performs basic migration to Xcode 10.2 — project settings, the one new warning, etc. 2019-03-26 19:47:41 -04:00
Thomas Harte
be4b38c76a Adds BRA and Bcc. 2019-03-25 22:54:49 -04:00
Thomas Harte
7163b1132c Takes a run at CMPI.
Also factors out a couple of mode things, clarifies on where things from the
prefetch are assembled to, and switches to ordering implemented instructions
alphabetically.
2019-03-24 23:05:57 -04:00
Thomas Harte
3ccec1c996 Implements MOVE to SR, fleshing out the final bits of storage for the status word. 2019-03-24 18:20:54 -04:00
Thomas Harte
47359dc8f1 Adds tests for MOVE.l (An), Dn, and thereby correct their implementation. 2019-03-23 21:41:47 -04:00
Thomas Harte
43532c8455 Starts to make incursions into MOVE[A].l. 2019-03-23 21:03:52 -04:00
Thomas Harte
d7c3d4ce52 Adds test for MOVEA.w (0x1000), A1 and fixes implementation thereof. 2019-03-22 23:27:48 -04:00
Thomas Harte
ed7060a105 Made an initial stab at completing MOVEA.w.
I think I'm probably peeking into the prefetch queue incorrectly.
2019-03-22 21:43:51 -04:00
Thomas Harte
db0da4b741 Improves get/set state. 2019-03-22 19:34:17 -04:00
Thomas Harte
c9c16968bb Implements MOVEA as distinct from MOVE.
At least as far as MOVE is implemented, that is.
2019-03-22 19:25:53 -04:00
Thomas Harte
87420881c8 Extends to a failing test. 2019-03-21 23:32:03 -04:00
Thomas Harte
fdc598f2e1 Starts MOVE tests; in pursuit of which talks the 68000 into obeying run lengths. 2019-03-21 22:30:41 -04:00
Thomas Harte
f679145bd1 Makes a further push into the MOVEs.
With some quick notation shortening.
2019-03-20 23:21:02 -04:00
Thomas Harte
eeb161ec51 Converts the prefetch queue into a 32-bit quantity. 2019-03-19 21:33:52 -04:00
Thomas Harte
21cb7307d0 Adds MOVE #, Dn and MOVEA An, An.
As well as the scheduling for `(d16,PC), Dd` and `MOVE (d8,As,Xn), Dd` other than the .ls.
2019-03-19 11:53:37 -04:00
Thomas Harte
412a1eb7ee Takes an initial run at (An)+, -(An), (d16,An) and (d8,An,Xn) addressing modes.
With only MOVEs from those to a data register implemented so far.
2019-03-18 22:51:32 -04:00
Thomas Harte
1d801acf72 Switched to a better ABCD fix. 2019-03-17 22:04:32 -04:00
Thomas Harte
0d7bbdad54 Begins a basic get/set state API, allowing some actual unit tests, implying an ABCD fix. 2019-03-17 21:57:00 -04:00
Thomas Harte
53b3d9cf9d Implements a few more MOVE variants, plus MOVEA. 2019-03-17 14:34:16 -04:00
Thomas Harte
c3ebbfb10e Implements all MOVE Dn, Dn. 2019-03-16 23:14:18 -04:00
Thomas Harte
58f035e31a Makes error more communicative. 2019-03-16 23:05:12 -04:00
Thomas Harte
a8f1d98d40 Small further adjustments; seems likely to be correct now. 2019-03-16 23:01:56 -04:00
Thomas Harte
cf6fa98433 Corrects detection of terminal micro-ops. 2019-03-16 22:50:44 -04:00
Thomas Harte
937b3ca81d Attempts properly to honour the bus-op and microcycle contract. 2019-03-16 22:36:09 -04:00
Thomas Harte
d0c5cf0d2d Starts attempting to kill the need to prepare all bus step sequences in advance. 2019-03-16 21:47:46 -04:00
Thomas Harte
4cbf2bef82 By way of a friend, clears a bunch of transient stuff out of 68000Storage.hpp.
As, even if not in the programmer's eye, this does affect recompilation times.
2019-03-16 19:41:07 -04:00
Thomas Harte
388d808536 Switches to providing UDS and LDS implicitly via address.
Also makes sure that the difference between a non-data cycle that starts without the address strobe active and one that starts with it active can be discerned.
2019-03-16 17:54:58 -04:00
Thomas Harte
720aba3f2d Adds an implementation of SBCD and slightly neatens syntax for building programs. 2019-03-14 21:22:02 -04:00
Thomas Harte
f9101de956 This might very well be the 68000's first real gasp: performing an ABCD. 2019-03-14 19:32:15 -04:00
Thomas Harte
bb04981280 I'm still dithering on address management, but this seeks fully to implement ABCD and SUBD bus programs. 2019-03-13 21:08:13 -04:00
Thomas Harte
57898ed6dd This is where my thinking now resides. Two levels of indirection, and consolidated collections. 2019-03-12 22:46:31 -04:00
Thomas Harte
33b53e7605 Settles upon disassembly as the route in, and begins work in that direction. 2019-03-11 22:47:58 -04:00
Thomas Harte
9e8928aad9 Implements as much as I currently care about of the Atari ST memory map. 2019-03-11 22:47:37 -04:00
Thomas Harte
89c71f9119 Introduces EmuTOS, and starts constructing test cases around it. 2019-03-10 18:40:12 -04:00
Thomas Harte
a4f6db6719 Removes ArrayBuilderTests as the ArrayBuilder is long gone. Disables TIA tests for now. 2019-03-10 18:07:23 -04:00
Thomas Harte
2d8e65ea32 Merge branch 'master' into 68000 2019-03-10 17:56:58 -04:00
Thomas Harte
48d1d27067 Merge pull request #612 from TomHarte/HighPrecisionTimer
Sketches a high-precision timer class.
2019-03-10 17:47:20 -04:00
Thomas Harte
98aa597510 A theoretical 68000 could now perform its /RESET. That's all though. 2019-03-10 17:42:13 -04:00
Thomas Harte
de56d48b2f Embraces a more communicative 68000 bus. 2019-03-10 17:27:34 -04:00
Thomas Harte
4aeb9a7c56 Genericises RegisterPair. 2019-03-09 21:16:11 -05:00
Thomas Harte
b9b52b7c8b Begins some very early sketching out of a 68000. 2019-03-09 00:00:23 -05:00
Thomas Harte
dc464a0b7b Introduces a wrapper class for high-precision timers. 2019-03-07 22:04:29 -05:00
Thomas Harte
13b6079826 Merge pull request #609 from TomHarte/ReducedScanTargetContention
Reduces draw/update contention.
2019-03-07 19:31:35 -05:00
Thomas Harte
6f7dd10d95 Reduces draw/update contention.
This won't yet have any effect on either port owing to the way they handle contexts, but here it is.
2019-03-07 19:28:32 -05:00
Thomas Harte
24fb95291a Reverts to support a full RGBA colour buffer. 2019-03-07 19:22:40 -05:00
Thomas Harte
48430bee60 Merge pull request #606 from TomHarte/MouseHiding
Causes the Mac mouse pointer to hide after 3 seconds.
2019-03-06 22:52:40 -05:00
Thomas Harte
42997dcb80 Switches brace style, to bring this into line with other source files. 2019-03-06 21:54:21 -05:00
Thomas Harte
0ace189e38 Takes a basic stab at mouse cursor hiding. 2019-03-06 21:49:50 -05:00
Thomas Harte
d03a7911b5 Merge pull request #605 from TomHarte/DisplayMetrics
UNREADY! Introduces dynamic output quality selection.
2019-03-06 19:20:35 -05:00
Thomas Harte
84422676cb Switches to more coherent logic about buffer sizing. 2019-03-06 19:19:30 -05:00
Thomas Harte
7441e3f4c5 Corrects aspect ratio when changing accumulation texture size. 2019-03-05 22:10:32 -05:00
Thomas Harte
f18132d674 Makes effort to round out draft 1 of Outputs::Display::Metrics. 2019-03-05 22:01:58 -05:00
Thomas Harte
5660007221 Experimentally introduces adaptive quality intermediate buffers. 2019-03-05 21:41:20 -05:00
Thomas Harte
cfebf1dc4a Merge branch 'master' into DisplayMetrics 2019-03-05 20:21:44 -05:00
Thomas Harte
5b0111b4c8 Merge pull request #604 from TomHarte/AYInputOutput
Implements proper AY IO output behaviour.
2019-03-05 20:21:21 -05:00
Thomas Harte
62a1d69cee Implements proper AY IO output behaviour. 2019-03-05 20:20:26 -05:00
Thomas Harte
86a6b04d4a Begins attempts to keep track of display metrics.
i.e. a system that can both make smart decisions about when to use a lower resolution, and hopefully allow some sort of flywheel-esque horizontal retrace synchronisation. And possibly some raster beam chasing?
2019-03-04 21:54:50 -05:00
Thomas Harte
8915950c7d Merge pull request #601 from TomHarte/8ppStencil
Switches to an 8bpp stencil, for Nvidia compatibility.
2019-03-03 20:39:50 -05:00
Thomas Harte
641e349f33 Switches to an 8bpp stencil, for Nvidia compatibility. 2019-03-03 20:38:24 -05:00
Thomas Harte
72b4bf9c98 Merge pull request #600 from TomHarte/MacCrash
Reintroduces proper locking of the Mac OpenGL context.
2019-03-03 15:25:26 -05:00
Thomas Harte
ccdeb3fbc8 Ensures draw is a no-op prior to pipeline setup. 2019-03-03 15:04:14 -05:00
Thomas Harte
34047fa60a Reintroduces proper locking of the OpenGL context in macOS. 2019-03-03 14:49:20 -05:00
Thomas Harte
05d483bc5b Corrects potential machine shutdown race condition. 2019-03-02 23:17:31 -05:00
Thomas Harte
113efd9b16 Merge pull request #598 from TomHarte/SVideoColeco
Introduces S-Video support for the ColecoVision.
2019-03-02 23:03:02 -05:00
Thomas Harte
c11a1f9679 Introduces S-Video support for the ColecoVision. 2019-03-02 23:02:37 -05:00
Thomas Harte
2beeaa513b Ensures a machine exists before messaging it. 2019-03-02 21:27:34 -05:00
Thomas Harte
5b56ad0d78 Merge pull request #597 from TomHarte/MacRaceCondition
Splits OpenGL ScanTarget update and draw functions.
2019-03-02 19:36:19 -05:00
Thomas Harte
bee0d09877 Splits display update and draw functions.
On the Mac, draw is now called without an update for resizing events, and
anything else requested by AppKit. In all other cases — including from
the SDL version — both are called as if they were still a single function.
2019-03-02 19:33:28 -05:00
Thomas Harte
42d8d187b3 Merge pull request #596 from TomHarte/MSXLogging
Eliminates dangling uses of `printf`.
2019-03-02 18:23:32 -05:00
Thomas Harte
d97348dd38 Eliminates dangling uses of printf. 2019-03-02 18:07:05 -05:00
Thomas Harte
e1ebb7ce9c Ensures no attempt to call nullptr. 2019-03-02 17:37:56 -05:00
Thomas Harte
47dd8ad069 Minor grammar fix. 2019-03-02 17:31:11 -05:00
Thomas Harte
6a55d75b3d Merge pull request #595 from TomHarte/MSXTapeMotor
Fixes various MSX tape-handling bugs, and adds a status LED.
2019-03-02 15:00:03 -05:00
Thomas Harte
d5b4ddd9e5 Simplifies use_fast_tape_ logic. 2019-03-02 14:54:26 -05:00
Thomas Harte
9c8a2265b5 Breaks infinite loop where signature[0] == 0x1f but some of the rest doesn't match. 2019-03-02 14:47:52 -05:00
Thomas Harte
84d7157dfb Corrects arithmetic on raw data blocks. 2019-03-02 14:40:48 -05:00
Thomas Harte
ddce4fb46b Ensures that unexpected padding goes somewhere. 2019-03-02 14:35:16 -05:00
Thomas Harte
1ccee036c4 Switches complete logic behind CAS to wave conversion to parsing tape files. 2019-03-02 14:19:54 -05:00
Thomas Harte
ef085e3f93 MSX: introduces a tape motor LED, and limits the fast-tape hack to the BIOS. 2019-03-01 18:49:21 -05:00
Thomas Harte
3862a93ff9 Removes mapping of the equals key to break.
... because I keep pressing it by accident.
2019-02-28 21:47:12 -05:00
Thomas Harte
fc21fbd1f1 Merge pull request #594 from TomHarte/MSXRegions
Introduces region support to the MSX.
2019-02-28 21:03:34 -05:00
Thomas Harte
903f9b5240 Gives the static analyser an opinion, at least. 2019-02-28 20:59:07 -05:00
Thomas Harte
816ad0a94c Introduces region support to the MSX. 2019-02-28 20:54:43 -05:00
Thomas Harte
0536697d8f Corrects scope of delay. 2019-02-28 18:46:28 -05:00
Thomas Harte
0dbd8a667d Corrects delay for SN access. 2019-02-27 22:58:43 -05:00
Thomas Harte
56e691f256 Merge pull request #592 from TomHarte/RecursiveMultiMachine
Resolves a potential deadlock on multi machine handover.
2019-02-27 22:42:40 -05:00
Thomas Harte
b0503efa3d Resolves a potential deadlock on multi machine handover. 2019-02-27 22:39:33 -05:00
Thomas Harte
b81e59fd8f Merge pull request #591 from TomHarte/ColecoVisionM1
Adds a single-cycle M1 delay to the ColecoVision.
2019-02-27 22:02:58 -05:00
Thomas Harte
d2da55aa03 Adds a single-cycle M1 delay to the ColecoVision. 2019-02-27 22:01:30 -05:00
Thomas Harte
28e69152d8 Merge pull request #590 from TomHarte/Screenshots
Unifies the OpenGL screenshot code and corrects it for arbitrary alignment.
2019-02-27 21:14:22 -05:00
Thomas Harte
d122535a65 Unifies the OpenGL screenshot code and corrects it for arbitrary alignment. 2019-02-27 21:05:02 -05:00
Thomas Harte
c8c24f81c8 Merge pull request #581 from TomHarte/ScanTarget
Decouples output of raster scans from their generation
2019-02-27 18:52:19 -05:00
Thomas Harte
db078c7363 Minor tweak: don't start counting phase from zero.
This should ensure no first pixel issues resulting from clamping.
2019-02-27 18:51:51 -05:00
Thomas Harte
6b4f6971de Disables upper limit on frame buffer size.
Filtering is sufficiently imperfect as to make this justifiable only when performance requires it. So I need a test for that. Marked as TODO.
2019-02-26 22:39:07 -05:00
Thomas Harte
79707a3c66 Improves filtering slightly, and ensures coefficients are always set when needed. 2019-02-26 22:35:55 -05:00
Thomas Harte
694783efe9 Brings S-Video inside the group that filters luminance.
Thereby revealing some sort of error in offset selection.
2019-02-26 22:27:40 -05:00
Thomas Harte
68c5474e36 Reintroduces basic filtering for RGB mode (and introduces it for monochrome composite). 2019-02-26 22:21:49 -05:00
Thomas Harte
cd055a0298 Introduces an upper bound on output resolution, and resolves full-screen clear colour. 2019-02-25 22:07:48 -05:00
Thomas Harte
8f2abab0d9 Ensures texture targets are initially clear. 2019-02-25 21:55:14 -05:00
Thomas Harte
4c5dee866b Ensures a proper black fill for Luminance8Phase8 input data. 2019-02-25 21:32:15 -05:00
Thomas Harte
7030abca97 Corrects PAL colours for the Vic-20. 2019-02-25 19:28:52 -05:00
Thomas Harte
c7c21a7e2c Sorry, ColecoVision, it's composite only for you. 2019-02-24 22:37:24 -05:00
Thomas Harte
b23e10e261 Improves error messaging and avoids trying to use a null window. 2019-02-24 22:31:59 -05:00
Thomas Harte
16731661e8 Switches back to being explicit about the colour burst phase.
Some sort of phase inversion otherwise seems to be achievable by software that switch modes often.
2019-02-24 22:28:11 -05:00
Thomas Harte
7bb90c78d9 Resolves out-of-bounds initial condition whenever this loop began with start_line = 2047.
This, I believe, was the remaining cause of screen flashes.
2019-02-24 19:50:19 -05:00
Thomas Harte
a6e61ef83b Reverts the clear colour to black.
The change was related to debugging; it was not intentionally committed.
2019-02-24 14:36:08 -05:00
Thomas Harte
d4134cd0d8 Restores proper colour phase to the Apple II.
Given that its timing errors were fixed, this also switches back to using 'default' colour bursts — i.e. ones with implicit phase. The Apple II continues to be an excellent bellwether for issues in the pipeline, and this helps further to ensure that.
2019-02-24 14:35:13 -05:00
Thomas Harte
c775a6c0f8 Introduces but disables a couple of bits of logging that might be helpful again in the future. 2019-02-24 14:30:39 -05:00
Thomas Harte
2f9e825728 Forces the outward-communicated composite angles to have the same precision as the cycle counts.
While also making a minor improvement to output range. Which is neither here nor there.
2019-02-24 14:29:43 -05:00
Thomas Harte
2f491b5be1 Reintroduces fragment snapping for composite colour sampling.
Thereby uncovers some sort of slightly-off recording of scan lines. On the Apple II, individual scans reach the ScanTarget at a density of exactly 0.25 colour cycles per pixel. So that timing information propagates exactly. But the whole lines that are composed via ::announce end up trying to fit 0.250154 colour cycles per pixel. Which creates a phase error as the display progresses from left to right.

This will need to be resolved in order to be able to fix the Apple II's intended colour phase. But, also, it's probably what was wrong with the Oric. And, quite possibly, why the single-step shader didn't work.
2019-02-24 13:39:14 -05:00
Thomas Harte
de7ebead23 Ensures the line_allocation_has_failed_ condition can be exited. 2019-02-21 22:30:41 -05:00
Thomas Harte
c0c4704419 Ensures that failure to allocate a line blocks all other allocations. 2019-02-21 21:38:48 -05:00
Thomas Harte
ec14750ff1 Minor text improvement. 2019-02-20 22:32:42 -05:00
Thomas Harte
e43de5f1ba Allows for failure to get a GL context as a reportable issue. 2019-02-20 22:06:22 -05:00
Thomas Harte
080f949f89 Ensures OpenGL version is logged prior to any other GL calls. 2019-02-20 20:21:17 -05:00
Thomas Harte
9f6956bd87 Awards default values to Scan, to appease GCC 7.3. 2019-02-19 21:40:42 -05:00
Thomas Harte
ddf5e1632d Ensures log memory is automatically initialised. 2019-02-18 22:08:03 -05:00
Thomas Harte
40bfde41cb Adds an OpenGL version shout out. 2019-02-18 22:01:56 -05:00
Thomas Harte
e0751af56d Handles the 0 return case. 2019-02-18 21:56:49 -05:00
Thomas Harte
3979faf43b Gets more explicit about potential causes of failure. 2019-02-18 21:53:35 -05:00
Thomas Harte
878b480a44 Tidies up marginally. 2019-02-18 21:37:07 -05:00
Thomas Harte
b35b6b2ba8 Resolves a couple of missing #includes for cassert. 2019-02-18 21:29:39 -05:00
Thomas Harte
d0b967ce53 Corrects typo; disables original colour ROM usage for now. 2019-02-18 20:49:54 -05:00
Thomas Harte
e5addb27ec Corrects log output. 2019-02-18 20:49:01 -05:00
Thomas Harte
ac8d43cc4a Improves use of const. 2019-02-18 20:21:41 -05:00
Thomas Harte
40ee215b1b By #define provides a means not to use the real composite samples.
To aid with debugging.
2019-02-18 17:20:52 -05:00
Thomas Harte
6c1d94beaa Adds composite monochrome output for the Oric. At least temporarily. 2019-02-18 16:56:48 -05:00
Thomas Harte
6b2e1fe62b Makes error reporting more communicative. 2019-02-18 11:13:54 -05:00
Thomas Harte
8ecf885629 Attempts to put in better OpenGL safety rails. 2019-02-18 10:29:40 -05:00
Thomas Harte
6d76b7cd94 Attempts to ensure proper colour output during alternating PAL lines. 2019-02-17 21:50:15 -05:00
Thomas Harte
7bd721f334 Resolves improper state if an end-of-frame clear is triggered by the first new line. 2019-02-17 21:49:53 -05:00
Thomas Harte
7939897622 Fixes announced timing difference between pixel and border lines.
The Apple II sync fault is now fixed!
2019-02-12 22:32:02 -05:00
Thomas Harte
77bebd4a65 Accounts for periods near an expected sync after a sync actually occurred. 2019-02-12 22:30:40 -05:00
Thomas Harte
5d68a5bdd0 Merge pull request #588 from TomHarte/SeparateChromaBuffer
Reintroduces a separate chrominance buffer
2019-02-12 19:52:54 -05:00
Thomas Harte
3e0b5433b9 Institutes colour/monochrome screen selection as an Apple II option.
Allowing me to test that straight-through composite still works.
2019-02-12 19:52:32 -05:00
Thomas Harte
ec8f1157c8 Corrects S-Video output. 2019-02-12 19:31:12 -05:00
Thomas Harte
037cbd534e Corrects phase error in chrominance separation. 2019-02-12 19:24:28 -05:00
Thomas Harte
208ef70e31 Corrects documentation. 2019-02-12 18:55:58 -05:00
Thomas Harte
2fa4c59523 Correction: use the QAM texture for colours. 2019-02-12 18:42:28 -05:00
Thomas Harte
cda0a2de79 Establishes QAM colour buffer lookups within the composite colour path.
Subject to errors in channel scaling and absolute position.
2019-02-10 23:02:31 -05:00
Thomas Harte
008f50832c Fixed: the two shaders that use a common input array should use common bindings. 2019-02-10 22:39:24 -05:00
Thomas Harte
c94acb1ca2 With a little more debug logging, discovered an issue with incrementing by four. 2019-02-09 22:45:20 -05:00
Thomas Harte
d341f98b09 Corrects horizontal scale. 2019-02-09 18:52:43 -05:00
Thomas Harte
e35a3ab566 Ensures proper uniforms and varyings for the qam_separation_shader. 2019-02-09 18:35:14 -05:00
Thomas Harte
b3b4b7cf0c Corrects QAM texture generation logic. 2019-02-09 17:20:13 -05:00
Thomas Harte
1cd6d58f17 Restores S-Video through line, as monochrome. 2019-02-09 17:13:43 -05:00
Thomas Harte
eecd4417e7 Bites the bullet and accepts that an additional texture will be useful for QAM separation. 2019-02-09 16:54:31 -05:00
Thomas Harte
21908dfcef Restores Oric audio. 2019-02-05 21:43:07 -05:00
Thomas Harte
75987f64ec Restores Oric audio. 2019-02-05 21:42:39 -05:00
Thomas Harte
798cc58f76 Simplifies the composite colour shader no longer to handle colour. 2019-02-05 19:22:35 -05:00
Thomas Harte
6ba1194d74 Sets a clear colour appropriate for phase-linked luminance clearing. 2019-02-03 22:33:04 -05:00
Thomas Harte
e5f75b5df2 Resolves repetition between svideo_sample and composite_sample. 2019-02-03 22:09:16 -05:00
Thomas Harte
b75ad3def2 Updates the multimachine for the ScanTarget world. 2019-02-03 15:07:22 -05:00
Thomas Harte
10c98f0a15 Switches TapeUEF to using LOG.
Reducing console noise for release builds.
2019-02-02 22:30:10 -05:00
Thomas Harte
caf72afcb4 Switches to a seven-point scheme, to determine whether falsely-shared luminance is at fault.
It doesn't seem to be, alas.
2019-01-31 21:19:30 -05:00
Thomas Harte
687e0b376e Enhances error checking around setting of uniforms. 2019-01-31 21:17:49 -05:00
Thomas Harte
122857e5b5 Improves automatic index generation, to allow for matrices implicitly taking up to four slots. 2019-01-31 18:49:01 -05:00
Thomas Harte
5002290428 Makes consistent use of textureLod rather than texture. 2019-01-26 22:05:15 -05:00
Thomas Harte
d09ac3384f Eliminates some old-school manual memory management.
In favour of additional copying, but I still think this is safer.
2019-01-25 22:54:23 -05:00
Thomas Harte
b6a4a7e0a5 This is no longer TODO. 2019-01-25 22:47:15 -05:00
Thomas Harte
c87994336c Switches the Shader class to using LOG. 2019-01-25 22:45:47 -05:00
Thomas Harte
85ad490089 Offers a less error-prone route to attribute binding. 2019-01-25 21:56:55 -05:00
Thomas Harte
73e32a9c76 Adds a missing directory. 2019-01-25 20:26:20 -05:00
Thomas Harte
a321ff3037 Adds some default values. 2019-01-25 20:21:24 -05:00
Thomas Harte
68d6feaa03 Adds missing includes and gets more explicit about exceptions. 2019-01-25 20:19:50 -05:00
Thomas Harte
74e1a9a621 Declines improper use of offset within loops and adds missing header. 2019-01-25 20:14:53 -05:00
Thomas Harte
097bc7055e Adds a default selection, for invalid models. 2019-01-25 19:31:44 -05:00
Thomas Harte
6a43fc5df0 Resolves a GCC-troubling circular declaration issue vs. atomic.h. 2019-01-25 19:30:39 -05:00
Thomas Harte
312f38906b Corrects two improper include paths. 2019-01-25 19:19:23 -05:00
Thomas Harte
f0ec9fa5d2 Updates the SConstruct file for new Outputs. 2019-01-25 19:11:57 -05:00
Thomas Harte
20b4896940 Eliminates the dead stuff of CRTConstants.hpp. 2019-01-25 19:11:39 -05:00
Thomas Harte
6a93d2d006 Corrects some minor spaces-instead-of-tabs errors. 2019-01-24 22:59:03 -05:00
Thomas Harte
ae0bc7e7aa Calculates sampling offsets up front. 2019-01-23 20:53:10 -05:00
Thomas Harte
a8acadbe13 Gives the shader builders freer rein over what to use as inputs, and turns angles into a varying.
All dropping out during the never-ending diagnosis at play here.
2019-01-22 22:20:12 -05:00
Thomas Harte
727f2e2ba0 Updates to the ScanTarget world. 2019-01-17 22:28:02 -05:00
Thomas Harte
a6683cb9b8 Avoids scaling luminance prior to extracting chrominance. 2019-01-17 20:52:33 -05:00
Thomas Harte
5ceb711bd3 Allows amplitude to be specified even for a default colour burst. 2019-01-17 20:47:42 -05:00
Thomas Harte
4748b09721 Ensures safe OpenGL shutdown. 2019-01-17 20:44:18 -05:00
Thomas Harte
d593796dae Reintroduces less-filtered black and white video where there's no colour burst. 2019-01-16 22:22:29 -05:00
Thomas Harte
ef0dbc2a41 Undoes hard-coding of target framebuffer and display gamma. 2019-01-15 21:33:30 -05:00
Thomas Harte
6c49953115 Returns gamma correction, and corrects Amstrad CPC brightness. 2019-01-14 22:56:08 -05:00
Thomas Harte
55290f4dad Attempts a fix of frame_was_complete_ logic, to try to eliminate black flashes. 2019-01-14 21:42:45 -05:00
Thomas Harte
f373a3fbb1 Merge branch 'TrigonometricDecode' into ScanTarget 2019-01-13 23:08:21 -05:00
Thomas Harte
bb03d2f2ad Removes redundant enumeration. 2019-01-13 23:07:50 -05:00
Thomas Harte
82922aa2c7 Merge pull request #585 from TomHarte/TrigonometricDecode
Collapses video pipeline down to two stages.
2019-01-13 23:07:09 -05:00
Thomas Harte
7aec5be61a Cleans up and simplifies shader creation. 2019-01-13 22:49:01 -05:00
Thomas Harte
2ef6d4327c Resolves further build warnings. 2019-01-13 20:37:50 -05:00
Thomas Harte
cc95e587db Adds virtual destructors for various interface classes. 2019-01-13 19:19:01 -05:00
Thomas Harte
e89e55a9bb Attempts to factor actual composite amplitude into output. 2019-01-13 14:45:17 -05:00
Thomas Harte
7c2c243985 Corrects sample spacing, and removes a lot of detritus. 2019-01-12 18:36:54 -05:00
Thomas Harte
25a1f23fc0 Takes a first shot at re[re,re]-implementing composite colour decoding. 2019-01-12 17:59:24 -05:00
Thomas Harte
27541196cc Corrects Luminance8Phase8 and PhaseLinkedLuminance8 composite encodings. 2019-01-11 22:46:50 -05:00
Thomas Harte
5d9521fcb9 Advances back to a semi-complete monochrome composite output.
i.e. composite phase and amplitude is ostensibly flowing to its new destination.
2019-01-11 22:02:15 -05:00
Thomas Harte
ccb52fb625 Ensures no writes to pixel_pointer_ when allocation has failed. 2019-01-11 22:00:44 -05:00
Thomas Harte
028e530232 Shunts output shader to its proper place. 2019-01-06 22:59:14 -05:00
Thomas Harte
906a2ff6eb Switches to using clock times for buffer merging and output. 2019-01-06 18:47:01 -05:00
Thomas Harte
248a8efd2f Corrects declared pixel clock GCD. 2019-01-06 16:32:13 -05:00
Thomas Harte
c392c819c1 Switches to using the announce is_visible flag to spot line ends. 2019-01-06 13:37:34 -05:00
Thomas Harte
e9d9ff0da0 Enhances ScanTarget to provide additional timing information. 2019-01-05 23:09:17 -05:00
Thomas Harte
46d756d298 Starts towards a flattening of the intermediate video processing.
Immediate issue: using x position to index into a bitmap sampled at the input data rate doesn't allow for the disconnection between input rate and output speed provided by the flywheels.
2019-01-05 18:11:39 -05:00
Thomas Harte
fd0ffc7085 Attempts an initial flattening of the pipeline, seemingly losing all output. 2019-01-01 21:02:21 -05:00
Thomas Harte
601961deeb Wires through set_display_type. 2018-11-29 20:44:21 -08:00
Thomas Harte
557a2a0ddf Moves pipeline setup into draw(), where there'll definitely be an OpenGL context. 2018-11-29 19:41:54 -08:00
Thomas Harte
b723740f64 Improves PAL colours. 2018-11-29 19:12:20 -08:00
Thomas Harte
6be46ae921 Mostly restores Atari 2600 output. PAL colours need work. 2018-11-29 18:26:05 -08:00
Thomas Harte
a25470ee41 Permits tweaking of PhaseLinkedLuminance8 sampling offset. 2018-11-29 16:29:28 -08:00
Thomas Harte
fd579a019b Introduces a new scan source data type, motivated by the reasoning used by the Oric.
Specifically: it'll allow PCM sampling of the potentially arbitrary composite generation logic of various machines.
2018-11-28 20:40:22 -08:00
Thomas Harte
e39ecf59ef Restores RGB mode to the Oric. More thought required for composite. 2018-11-28 18:40:43 -08:00
Thomas Harte
5f90941e4e Starts nudging the Oric back to functionality under the new regime.
i.e. one where it can't invent internal pixel formats.
2018-11-28 18:16:13 -08:00
Thomas Harte
64465f97b6 Starts towards reintroducing the proper mechanisms for selecting a display type at runtime. 2018-11-28 17:53:33 -08:00
Thomas Harte
aa22af6f05 Corrects regression in VDP type selection. 2018-11-26 22:40:01 -05:00
Thomas Harte
a6383247fc Attempts further to ensure proper CRT signalling. 2018-11-26 22:36:22 -05:00
Thomas Harte
d45c2a1f28 Settles, at least for now, on 15-tap notch filtering. 2018-11-26 22:34:31 -05:00
Thomas Harte
61a63a673c Adds a negative operator. 2018-11-26 22:34:04 -05:00
Thomas Harte
5618288459 Reduces visible area, producing a tighter crop. 2018-11-25 22:32:12 -05:00
Thomas Harte
b69ac4ec2f Ensures video stability is no longer affected by transient allocation failures. 2018-11-25 22:04:04 -05:00
Thomas Harte
f3174069fa Attempts a linear comb filter for YC separation, plus post-separation Y filtering. 2018-11-25 21:54:12 -05:00
Thomas Harte
cd1e796093 Attempts to add clearing of the destination framebuffer too. 2018-11-24 23:31:56 -05:00
Thomas Harte
dd4af4f0df Removes dead files. 2018-11-24 22:40:06 -05:00
Thomas Harte
76656fab23 Applies harsher filtering. 2018-11-24 22:39:53 -05:00
Thomas Harte
cf49603a9e Makes first reintroduction of colour composite decoding. 2018-11-24 22:30:39 -05:00
Thomas Harte
6c92853461 Corrects monochrome composite generation. 2018-11-24 21:55:15 -05:00
Thomas Harte
6a62cf9146 Corrects shader generation for S-Video input to S-Video output. 2018-11-24 21:40:34 -05:00
Thomas Harte
4fa6bc0ad1 Corrects S-Video decoding for most machines.
Ironically, that being those other than luminance/chrominance input machines. Further investigation required.
2018-11-24 21:30:09 -05:00
Thomas Harte
95685749ad Attempts fully to implement the S-Video pipeline, without success. 2018-11-24 18:51:07 -05:00
Thomas Harte
d7c0f0c804 Switches to an ordinary sampler for scan processing. 2018-11-24 18:03:44 -05:00
Thomas Harte
6b42b92930 Kills CRTOpenGL.cpp and simplifies shader output very slightly. 2018-11-24 17:37:58 -05:00
Thomas Harte
f4764ea680 Fixes divider. 2018-11-24 16:56:41 -05:00
Thomas Harte
538c57664f Establishes attribute bindings to allow multiple shaders to use the same vertex array. 2018-11-24 16:06:26 -05:00
Thomas Harte
a66a20f7fe Manages to get a brilliant white out of the new pipeline. 2018-11-23 22:54:52 -05:00
Thomas Harte
d4ac79b0af Attempts to introduce a full-on processing pipeline, in theory putting me two shaders away from completion.
Well, subject to finding the last flashing bug and updating the multimachine, anyway.
2018-11-23 22:34:38 -05:00
Thomas Harte
a5a3769a0f Reaches for conceptual const correctness. 2018-11-23 22:33:28 -05:00
Thomas Harte
dc4b5cc37d Effects DefaultAttenuation as an explicit default. 2018-11-23 22:33:01 -05:00
Thomas Harte
ee89be6730 Removes many stray spaces. 2018-11-23 22:32:32 -05:00
Thomas Harte
770d7e90e9 Removes stale sampling functions. 2018-11-22 22:47:29 -05:00
Thomas Harte
b9aca39eb0 Reintroduces Vic-20 output.
Resolving errors in shader generation while I'm here.
2018-11-22 22:43:42 -05:00
Thomas Harte
c0454ff101 Corrects chrominance scale. 2018-11-22 18:18:16 -05:00
Thomas Harte
a697a2e4f6 Attempts to complete all input processing — an RGB, S-Video or composite input buffer is now produced.
... for all input data types.
2018-11-22 17:20:31 -05:00
Thomas Harte
396cf72029 Renames OutputType as DisplayType and promotes it to a scan target modal. 2018-11-22 14:36:46 -05:00
Thomas Harte
bfe9704829 Reintroduces respect of each machine's nominated visible area. 2018-11-22 13:22:04 -05:00
Thomas Harte
43ee540233 Avoids race condition on .is_first_in_frame 2018-11-21 18:27:04 -05:00
Thomas Harte
817aa186c2 Revokes 'synchronous' as a function of onlyIfDirty, as it doesn't allow for double buffering. 2018-11-20 22:00:40 -05:00
Thomas Harte
38ffc4fdb3 Invalidates the stencil buffer upon buffer resizes. 2018-11-20 19:51:11 -05:00
Thomas Harte
f12d734957 Disables multisampling, since there's no way it's being helpful. 2018-11-19 23:36:29 -05:00
Thomas Harte
a70991d50e Eliminates minor gap. 2018-11-19 23:35:12 -05:00
Thomas Harte
4c00456166 Makes first attempt to draw only new lines. 2018-11-19 23:25:26 -05:00
Thomas Harte
26219213d7 Marginally increases scan size. 2018-11-18 23:03:56 -05:00
Thomas Harte
97c5ee6c0a Corrects stencil buffer creation, and edges towards using it for [guaranteed] full-screen decay. 2018-11-18 22:22:43 -05:00
Thomas Harte
75bc0e451d Reintroduces the accumulation texture.
Disables automatic clearing of the texture target, as the profiler indicates the vector instantiation to be a huge time sink.
2018-11-18 21:39:11 -05:00
Thomas Harte
6496b6313c Attempts to fix random stray noise lines. 2018-11-17 23:27:25 -05:00
Thomas Harte
c5d9bf2c12 Optimises slightly for black borders.
Specifically to help to debug proper display of unused lines in the new scan target.
2018-11-17 18:23:42 -05:00
Thomas Harte
8f05560dd7 Corrects right-edge bookending. 2018-11-17 17:46:57 -05:00
Thomas Harte
06c0c64c1a Shifts intermediate buffer sampling into the middle of each pixel row. 2018-11-17 17:31:32 -05:00
Thomas Harte
c173777d12 Extends TextureTarget so that targets can be created with a one-bit stencil. 2018-11-17 15:51:12 -05:00
Thomas Harte
16dfeb3fc8 Discards empty lines, yet makes some attempt at restoring transparency.
The two things conflict more than a little, so work to do.
2018-11-15 21:51:27 -05:00
Thomas Harte
5a31891048 Returns Amstrad CPC output.
Which is probably it until I get some more composite processing back in.
2018-11-15 21:32:22 -05:00
Thomas Harte
8b37496447 Restores video output to the Master System. 2018-11-15 21:21:54 -05:00
Thomas Harte
8f6664f0d7 Starts towards picking an input shader based on data type and pipeline. 2018-11-15 21:02:46 -05:00
Thomas Harte
15b1176841 Ensures no border output if space is not allocated. 2018-11-14 22:32:33 -05:00
Thomas Harte
3eab1f8f7c Removes a little cruft. 2018-11-14 22:26:31 -05:00
Thomas Harte
9dff13cbbf Re-establishes output from the machines with 9918s and derivatives. 2018-11-14 22:25:19 -05:00
Thomas Harte
a47de9a884 Returns the Apple II to submitting video. 2018-11-14 22:04:57 -05:00
Thomas Harte
8a699b6072 Kills setup_output definitively, saving some indirection. set_scan_target takes its place. 2018-11-14 21:52:57 -05:00
Thomas Harte
87df8b9e85 Makes an attempt at pre-emptive line buffer clearing. 2018-11-14 21:19:14 -05:00
Thomas Harte
91b19c5c70 Adds bookending, and finally kills the TextureBuilder. Farewell. 2018-11-14 20:49:06 -05:00
Thomas Harte
0487580a1a Corrects initial state of is_drawing_ and expands lines to full display. 2018-11-14 20:10:38 -05:00
Thomas Harte
3dca836571 Ensures no overflow, and adds a couple of consts. 2018-11-14 20:09:57 -05:00
Thomas Harte
6ba02c44d0 Better binds buffer sizes. 2018-11-13 23:08:51 -05:00
Thomas Harte
bf3ab4e260 Proceeds as drawing to the unprocessed line buffer and drawing from it.
Very, very slowly, and without yet clearing.
2018-11-13 21:15:33 -05:00
Thomas Harte
02f9cada43 Communicates the colour subcarrier frequency, and uses it to pick a buffer width. 2018-11-13 18:33:44 -05:00
Thomas Harte
654a19ea15 Switches back to working on the scan shaders.
Pixels from the emulated machine are now starting to appear.
2018-11-12 22:52:26 -05:00
Thomas Harte
ecb5504bd1 Switches enable_vertex_attribute_with_pointer to silent failure (versus glGetError). 2018-11-12 22:51:44 -05:00
Thomas Harte
2adf3d353e Subtracts retrace periods from output scale. 2018-11-12 20:20:09 -05:00
Thomas Harte
3045e85004 Ensures redraws when resizing; declines to busy wait otherwise. 2018-11-12 20:15:38 -05:00
Thomas Harte
e9d1afd515 Appears to demonstrates that the line buffer is approximately working. 2018-11-12 19:10:48 -05:00
Thomas Harte
833ab7945b Slow steps towards switching to line output. 2018-11-12 18:56:54 -05:00
Thomas Harte
0af1d668a6 Takes a first step towards generality, and thereby starts submitting lines. 2018-11-12 18:47:55 -05:00
Thomas Harte
0ac62e3805 Flips and properly sizes output scans. 2018-11-12 18:28:09 -05:00
Thomas Harte
938d09f34a Corrects scan outline generation. 2018-11-12 18:23:45 -05:00
Thomas Harte
dce52d740d Finally gets some pixels back on screen.
For now, just the raw scans, direct to the framebuffer, with no intermediate processing. But it seems to prove that at least some of the proper data is reaching the GPU.
2018-11-11 23:23:42 -05:00
Thomas Harte
3ae333fa84 Edges further towards reviving the shaders. 2018-11-11 21:41:13 -05:00
Thomas Harte
d5af1f3948 Removes some migrated work. 2018-11-11 16:22:14 -05:00
Thomas Harte
0ba3ae53ab Connects up the necessary recording to use intermediate composite buffers. 2018-11-11 15:20:18 -05:00
Thomas Harte
be12d78c83 Corrects vertical event announcement, and adjusts namespaces for OpenGL primitives. 2018-11-11 15:11:32 -05:00
Thomas Harte
b70227ac1b Ensures proper write area locations end up in the scans. 2018-11-10 21:10:33 -05:00
Thomas Harte
6d277fecd5 Makes ScanTarget a little more communicative and orthogonal. 2018-11-10 19:52:57 -05:00
Thomas Harte
491817d85c Corrects allocation error and begins submitting raw textures. 2018-11-08 23:02:36 -05:00
Thomas Harte
20faf4e477 Adds submission of scans to the GPU. 2018-11-08 22:21:11 -05:00
Thomas Harte
4fe5c7c24e Conspires to handle multithreading side of things in a lockless fashion.
At least on x86-64.
2018-11-08 21:57:28 -05:00
Thomas Harte
36bf640c6f Acts as if it is going to submit scans, at least. 2018-11-07 22:53:46 -05:00
Thomas Harte
7881e40e0b Shuffles the OpenGL primitives into their own collection. 2018-11-07 19:11:01 -05:00
Thomas Harte
55da1e9c0f Simplifies semantics a little and starts accepting a single buffer of pixel data. 2018-11-06 22:23:38 -05:00
Thomas Harte
9799aa0975 Completes documentation and rounds out implementation. 2018-11-04 22:17:33 -05:00
Thomas Harte
1effb97b74 Reintroduces colour phase acquisition from the colour burst. 2018-11-04 21:57:46 -05:00
Thomas Harte
eb28095041 Ensures proper accumulation and reporting of colour phase across lines. 2018-11-04 21:44:22 -05:00
Thomas Harte
014da41471 Ensures scan positions are communicated with a specified range, and switches manner of pixel clock communication. 2018-11-04 21:06:25 -05:00
Thomas Harte
0446e350d3 Resolves sizing of texture coordinates, and improves constness slightly. 2018-11-03 23:51:26 -04:00
Thomas Harte
05fb7db147 Reduces CRT chattiness. 2018-11-03 23:47:41 -04:00
Thomas Harte
f6562de325 Possibly adds enough for the Electron and ZX80 to start outputting dummy lines.
Let's see!
2018-11-03 23:40:39 -04:00
Thomas Harte
b40211d2c0 Starts to bend 'CRTMachine' to a world farther from owning the GPU relationship. 2018-11-03 21:54:25 -04:00
Thomas Harte
da4d883321 Adds first, incomplete attempts to talk to a ScanTarget from the CRT.
Does away with the hassle of `unsigned` while I'm here; that was a schoolboy error.
2018-11-03 19:58:44 -04:00
Thomas Harte
373820f080 Attempts to establish interface to decouple scan output from generation.
Restores some functionality that had dropped out in the interim: diagonal scans, decoupling of scan scaling from timing of the composite subcarrier.
2018-10-30 21:50:35 -04:00
Thomas Harte
6e517983b9 Merge branch 'master' into ScanTarget 2018-10-30 18:15:55 -04:00
Thomas Harte
b9a752fda1 Merge pull request #580 from TomHarte/NameInitialisation
Ensures offset and flags are initialised to 0.
2018-10-29 22:10:28 -04:00
Thomas Harte
f65d80b7d1 Ensures offset and flags are initialised to 0.
This prevents a potential crash at startup.
2018-10-29 22:09:32 -04:00
Thomas Harte
4701aa149a Adds first draft of an interface to separate CRT logic from the GPU-side stuff. 2018-10-29 22:08:17 -04:00
Thomas Harte
0d051502e2 Merge pull request #579 from TomHarte/MasterSystemOfficial
Promotes the Master System to full mention.
2018-10-26 21:25:09 -04:00
Thomas Harte
2e28a8e51c Promotes the Master System to full mention. 2018-10-26 21:24:40 -04:00
Thomas Harte
4af0b74a42 Merge pull request #578 from TomHarte/SMSBIOSFallback
Attempts to carry on even if no BIOS is found.
2018-10-26 21:20:43 -04:00
Thomas Harte
d1fc39d6e5 Attempts to carry on even if no BIOS is found. 2018-10-26 21:19:16 -04:00
Thomas Harte
4f0d324a6b Merge pull request #577 from TomHarte/9918RandomStart
(Mostly) randomises the 9918 start position.
2018-10-26 21:10:54 -04:00
Thomas Harte
8652d8b23d (Mostly) randomises the 9918 start position. 2018-10-26 21:02:56 -04:00
Thomas Harte
e02aa885d8 Testing against the ColecoVision suggests this is probably always 7. 2018-10-26 20:59:12 -04:00
Thomas Harte
1fc9356796 Merge pull request #576 from TomHarte/CRAMDots
Adds display of CRAM dots and enforces VRAM delays.
2018-10-26 20:32:00 -04:00
Thomas Harte
bb09762029 Introduces extra delays to VRAM access. 2018-10-26 20:19:08 -04:00
Thomas Harte
05a5c7120e Shunts CRAM dots into their proper place. 2018-10-26 20:06:51 -04:00
Thomas Harte
521d603902 Adds a first attempt at CRAM dot output. With a TODO. 2018-10-26 19:26:46 -04:00
Thomas Harte
916710353a Makes it explicit that I want the reference. 2018-10-25 23:18:34 -04:00
Thomas Harte
53b00dea3f Adds missing include. 2018-10-25 23:12:41 -04:00
Thomas Harte
0587b9f257 Edges to within millimetres of CRAM dots.
... but all the way up to bedtime.
2018-10-25 23:12:03 -04:00
Thomas Harte
9621ba59ae Merge pull request #574 from TomHarte/MulticolourMode
Fixes broken implementation of 9918 multicolour mode.
2018-10-24 22:41:18 -04:00
Thomas Harte
5accd8cf08 Fixes broken implementation of 9918 multicolour mode. 2018-10-24 22:40:38 -04:00
Thomas Harte
38c130df2b Merge pull request #573 from TomHarte/SmallKeyboard
Extends the concept of a 'keyboard' to sets of keys less than a full keyboard in size
2018-10-24 22:32:55 -04:00
Thomas Harte
8730ffb4e2 Restores multi-machine keyboard propagation. 2018-10-24 22:20:58 -04:00
Thomas Harte
a8645f80bf Introduces 'non-exclusive' emulator-space keyboards.
i.e. sets of keys that don't amount to an entire keyboard in the modern sense. Experimentally used by the Master System for its reset key.
2018-10-24 21:59:30 -04:00
Thomas Harte
278585fd94 Merge pull request #572 from TomHarte/TallModeSprites
Fixes sprite list termination in 224- and 240-line modes.
2018-10-24 19:56:42 -04:00
Thomas Harte
d61c3a9442 Fixes sprite list termination in 224- and 240-line modes. 2018-10-24 19:53:46 -04:00
Thomas Harte
2cdeaa2575 Moves misplaced bracket. 2018-10-23 22:37:19 -04:00
Thomas Harte
286783e880 Accepts GCC's suggestion of extra clarity brackets. 2018-10-23 22:36:23 -04:00
Thomas Harte
f7b0f1af70 Merge pull request #571 from TomHarte/DisplaySelection
Adds composite/RGB selection for the Master System.
2018-10-23 22:32:59 -04:00
Thomas Harte
f69cb28933 Reverts accidental project configuration change. 2018-10-23 22:32:05 -04:00
Thomas Harte
e3fd63b2d7 Adds composite/RGB selection for the Master System. 2018-10-23 22:30:24 -04:00
Thomas Harte
6cb956d1d6 Merge pull request #570 from TomHarte/TecToyEtc
Separates request for an SMS2 VDP from current graphics mode.
2018-10-23 22:20:11 -04:00
Thomas Harte
00e7958a97 Separates request for an SMS2 VDP from current graphics mode.
Thereby fixes various minor segments of Codemasters games.
2018-10-23 22:19:45 -04:00
Thomas Harte
cba8e6814f Merge pull request #569 from TomHarte/224px
Adds 'full' support for 224- and 240-line SMS modes
2018-10-23 21:22:19 -04:00
Thomas Harte
2f995eb622 Adjusts vertical timing for display height. 2018-10-23 21:20:44 -04:00
Thomas Harte
90fbad0f1c Implements SMS2-style addressing if in a 224 or 240-line mode.
This isn't quite accurate, but it'll do for development.
2018-10-23 20:30:08 -04:00
Thomas Harte
2cbd28478d Allows the sprite terminator to be specified. 2018-10-23 20:01:47 -04:00
Thomas Harte
7eeefd2602 Ensures LOGs look like statements even in release builds. 2018-10-22 22:37:11 -04:00
Thomas Harte
1331457314 Merge pull request #567 from TomHarte/VDPDelay
Slightly adjusts pixel output time.
2018-10-22 22:10:47 -04:00
Thomas Harte
7855145ebd Slightly adjusts pixel output time.
i.e. respective to reading; sprite collision times now seem correct.
2018-10-22 19:58:33 -04:00
Thomas Harte
6ab30e9cac Adds a mention of the Master System.
Given that Mac users are only one constituency now; others are directly tracking the repository.
2018-10-22 13:47:43 -04:00
Thomas Harte
027e9c7816 Merge pull request #563 from TomHarte/ResizeCrash
Corrects likely crash shortly after starting a TMS9918 or derivative
2018-10-22 10:19:20 -04:00
Thomas Harte
7c65cfd932 Adds default values for WriteArea. 2018-10-21 21:18:54 -04:00
Thomas Harte
883680731a Uses explicit state to determine whether a pixel target has been requested. 2018-10-21 21:18:41 -04:00
Thomas Harte
fb3171f366 Merge pull request #562 from TomHarte/TimingTweaks
Corrects residual Master System interrupt timing issues.
2018-10-21 18:47:25 -04:00
Thomas Harte
c07f9fed99 Corrects test and implementation to pass the exhaustive VDP interrupt prediction test. 2018-10-21 18:42:49 -04:00
Thomas Harte
616777517d Makes the failing test more communicative, in the hope of more easily debugging errors. 2018-10-21 14:35:44 -04:00
Thomas Harte
b3f1677da5 Introduces new failing test for rational continuous interrupt prediction. 2018-10-21 13:59:14 -04:00
Thomas Harte
16f08eb654 Slightly tweaks Master System timing numbers. 2018-10-21 13:58:34 -04:00
Thomas Harte
a38974ef2e Merge pull request #559 from TomHarte/RowPhase
Corrects row reporting for modes other than 192-line NTSC
2018-10-20 18:28:26 -04:00
Thomas Harte
725b364bbc Improves testing; now tests for time to the first interrupt. 2018-10-20 18:25:55 -04:00
Thomas Harte
30b99f0049 Fixes a couple of interrupt prediction errors. 2018-10-20 18:25:28 -04:00
Thomas Harte
b61de65b43 Restores proper phase with the CPU. 2018-10-19 23:18:16 -04:00
Thomas Harte
0822c96ce0 Implements the proper row counter values for > 192 row modes. 2018-10-19 22:37:56 -04:00
Thomas Harte
3b164e5ffe Adds missing #includes. 2018-10-19 22:20:23 -04:00
Thomas Harte
d5f1e76707 Merge pull request #558 from TomHarte/CodemastersDetection
Implements the Codemasters paging scheme
2018-10-19 22:11:33 -04:00
Thomas Harte
f49718e94b Ensures Codemasters games have the proper initial state. 2018-10-19 22:10:14 -04:00
Thomas Harte
b18db78cce Merge pull request #557 from TomHarte/MasterSystemScreenshot
Sneaks in a Master System screenshot.
2018-10-19 21:57:07 -04:00
Thomas Harte
c39fd17e54 Corrects extension. 2018-10-19 21:55:35 -04:00
Thomas Harte
78fff5bdd9 Sneaks a Sonic picture into the readme.
Without even yet claiming to be a Master System emulator, given that I've still quite a few things to do there.
2018-10-19 21:54:21 -04:00
Thomas Harte
6fff514901 Honours the region by implementing Japanese (no BIOS) and European (PAL) paths. 2018-10-19 21:37:05 -04:00
Thomas Harte
f9a6c00493 Makes first attempt to support PAL timings. 2018-10-19 21:36:13 -04:00
Thomas Harte
fa77d81813 Corrects test for whether to consider a European or American region. 2018-10-19 21:35:52 -04:00
Thomas Harte
f0b6c406ff The Sega static analyser now attempts to differentiate region and paging scheme. 2018-10-19 20:32:09 -04:00
Thomas Harte
c365cca38a Makes order of operations explicit. 2018-10-18 22:37:04 -04:00
Thomas Harte
4cd65eab5c Seeks to avoid bad macro expansion. 2018-10-18 22:36:25 -04:00
Thomas Harte
2ee360e6ba Merge pull request #553 from TomHarte/MasterSystemVDP
Adds Initial Sega SG1000 and Master System emulation
2018-10-18 22:30:57 -04:00
Thomas Harte
9bc09046c0 Attempts to ensure that sprites can go off the top of the screen. 2018-10-18 21:48:57 -04:00
Thomas Harte
10d9cbdeb1 Adds an extra LOG to track the memory map as a potential cause of emulation failure. 2018-10-18 21:48:37 -04:00
Thomas Harte
57f03e660c Ensures console output only in debug builds. 2018-10-18 21:16:56 -04:00
Thomas Harte
512f085891 Ensures proper left clipping of sprites. 2018-10-18 21:14:16 -04:00
Thomas Harte
6a2db52adb Ensures safe Megacart cartridge sizes too. 2018-10-18 21:09:05 -04:00
Thomas Harte
34e13d0d4d Clears top bit when reading the keypad and ensures no undefined behaviour reading the cartridge. 2018-10-18 21:05:58 -04:00
Thomas Harte
da00c832f5 Corrects colour fetching for multicolour text mode. 2018-10-18 20:38:00 -04:00
Thomas Harte
8ff265c3a1 Corrects multicolour text mode. 2018-10-18 20:25:42 -04:00
Thomas Harte
0278d5b61c Restores SG1000 compatibility. 2018-10-18 19:13:15 -04:00
Thomas Harte
1fc88c4eff Corrects off-by-one error in line fetching coroutines. 2018-10-16 21:36:31 -04:00
Thomas Harte
58ca74c68a Resolves right-side TMS sprite droppages. 2018-10-16 21:25:08 -04:00
Thomas Harte
b4f871a2ef Corrects first line sprite row selection. 2018-10-16 21:16:29 -04:00
Thomas Harte
0f7bf6d6c6 Resolves attempt to output graphics on the line one before the display. 2018-10-16 21:02:31 -04:00
Thomas Harte
5dfe7d8596 Corrects most of TMS sprite drawing. 2018-10-16 20:49:04 -04:00
Thomas Harte
231009b901 Makes faulty attempt to reintroduce TMS-mode sprites. 2018-10-16 20:00:06 -04:00
Thomas Harte
1c5f939aea Reintroduces tiles and some element of sprites in regular TMS mode. 2018-10-14 21:52:13 -04:00
Thomas Harte
c1e6406fc9 Corrects sprite accumulation. 2018-10-14 19:56:09 -04:00
Thomas Harte
d66979c68f Switched to a very large number of buffers, and resolved stupid attempt to reassign a reference. 2018-10-14 18:19:11 -04:00
Thomas Harte
6c09abc6cb Makes a flawed attempt to reformulate this exactly as two separate processes on a common clock with an interchange buffer.
Specifically because closer inspection of the TMS modes shows it isn't quite valid to model output of one line as having fully completed prior to fetching of the next. So some sort of extra buffer is required. At which point it is most natural to continue with the logic that each fetch routine is oriented around the fetching process for a single line, and each output routine has the same view, suggesting separate read/write addresses.

Something is wrong though, as video data is being output too rapidly (I think) and with occasional sync issues (again: subject to investigation).
2018-10-14 16:23:45 -04:00
Thomas Harte
9e52ead09a Ensures sprite scanning doesn't improperly set collision flag; that slot 151 is filled. 2018-10-12 19:50:48 -04:00
Thomas Harte
9ab0c54426 Eliminates faulty attempt to satisfy SMSVDP vertical counter test. 2018-10-12 18:57:07 -04:00
Thomas Harte
f6af6778ab Moves scrolling latch to proper position and implements 4-window fetching offset. 2018-10-11 22:36:27 -04:00
Thomas Harte
6a94dda60d Selects potentially-correct interrupt times. 2018-10-11 21:42:09 -04:00
Thomas Harte
82b7944599 Fixes horizontal counter wrapping. 2018-10-11 20:37:29 -04:00
Thomas Harte
52e02db5c8 Introduces horizontal counter latching and reading.
Then makes a new guess at frame IRQ position. But gets it wrong. Hmmm.
2018-10-11 19:56:32 -04:00
Thomas Harte
9a933993f5 Added TODO. 2018-10-10 22:17:17 -04:00
Thomas Harte
062b2ae8d3 Corrects calculation of [NTSC, 192 line] current row. 2018-10-10 22:15:38 -04:00
Thomas Harte
9f69dbf31a Adds half-updating of RAM pointer.
This emulator now passes the first screen of the SMS VDP test.
2018-10-10 21:59:08 -04:00
Thomas Harte
63fb3f03d1 Corrects address loading upon accesses of registers other than 0. 2018-10-10 21:47:48 -04:00
Thomas Harte
2e379b0834 Adds latching of scroll values. 2018-10-10 21:28:18 -04:00
Thomas Harte
f00f6c8c23 Allows the frame interrupt to be placed anywhere in the frame. 2018-10-10 21:07:39 -04:00
Thomas Harte
50e23f4a2e Fixes 16px-high sprites. 2018-10-10 20:34:00 -04:00
Thomas Harte
acdc84e08c Improves test slightly, and fixes line interrupt reload value setting. 2018-10-09 22:14:35 -04:00
Thomas Harte
c128ddb549 Introduces a first unit test for line interrupts and corrects backup behaviour. 2018-10-09 21:49:21 -04:00
Thomas Harte
dccf17e770 Makes a first serious attempt at Master System line interrupts. 2018-10-09 20:51:09 -04:00
Thomas Harte
2d8ab72e22 Fixed proper starting position for (interrupted) tile drawing. 2018-10-08 23:13:37 -04:00
Thomas Harte
748366c70e Corrects buffer overrun when the horizontal scroll lock is on. 2018-10-08 23:06:22 -04:00
Thomas Harte
7a74fe2ff7 Corrects tile plotting window and eliminates a redundant local. 2018-10-08 22:56:31 -04:00
Thomas Harte
e410302237 Switches to real SMS line output composition.
Including setting the sprite collision bit.
2018-10-08 22:43:10 -04:00
Thomas Harte
bca2161a05 Fixes TMS text mode for the new addressing order. 2018-10-07 21:09:01 -04:00
Thomas Harte
5f789092be Flips sprite priority in the temporary renderer.
The better to test other issues in the interim.
2018-10-07 19:16:35 -04:00
Thomas Harte
6975ed22c0 Doubles down on address-storage format, and implements the vertical scrolling lock. 2018-10-07 18:55:35 -04:00
Thomas Harte
24644f1dd1 Adds a low-pass filter, picked entirely by ear, and switches to composite output, at least for now. 2018-10-07 18:39:03 -04:00
Thomas Harte
3bead07043 Introduces proper indirection for sprite patterns.
This seems to work, so the onus is now back on the rendering loop.
2018-10-07 17:15:42 -04:00
Thomas Harte
ee20e42372 Makes initial attempt at collecting sprite contents.
With test plotting, indicating some sort of issue.
2018-10-07 16:53:25 -04:00
Thomas Harte
df411b4ede Corrects storage of visible sprites. 2018-10-07 16:40:32 -04:00
Thomas Harte
bfb9d8ccb6 At least attempts to use proper addressing for sprite info fetches. 2018-10-07 14:32:20 -04:00
Thomas Harte
338aec2930 Groups background fetches and experimentally seeks to daub sprites as white. 2018-10-06 22:07:04 -04:00
Thomas Harte
e6510dc87b Attempts to get at least as far as picking visible sprite indices. 2018-10-06 19:27:19 -04:00
Thomas Harte
76f3b9f6ba Fixed: paging writes don't obstruct RAM. 2018-10-06 14:26:00 -04:00
Thomas Harte
7830cda912 Implements line querying and most of line interrupts. 2018-10-04 22:50:35 -04:00
Thomas Harte
aac97a8983 Re-revokes fine scroll on the top two lines when requested. 2018-10-04 19:18:15 -04:00
Thomas Harte
ca26dfcd61 Correct Master System palette writes. 2018-10-04 19:12:31 -04:00
Thomas Harte
858721a7a5 Added left border hiding. 2018-10-04 18:52:23 -04:00
Thomas Harte
89db1d6a6a Switches to a more accurate means of left-padding. 2018-10-04 18:44:49 -04:00
Thomas Harte
de4e5c40aa Implements horizontal scrolling lock. 2018-10-03 23:28:33 -04:00
Thomas Harte
05248ab990 Starts to reimplement Master System output. 2018-10-03 23:13:21 -04:00
Thomas Harte
252f47a425 Ensures no pixel output on line one before end, and adds a temporary debugging test. 2018-10-02 22:59:20 -04:00
Thomas Harte
be52b31b5c Attempts fully to revive text mode. 2018-10-02 22:05:58 -04:00
Thomas Harte
23c3fa6993 Fixed: it's the SMS that has 8 sprites, not text mode (which has none). 2018-10-02 22:01:43 -04:00
Thomas Harte
499fc62187 Sets things up for implementation of the inner mode-specific logic. 2018-10-02 21:58:09 -04:00
Thomas Harte
1dd5272190 Ensures real-time output of all areas, to ensure proper palette response. 2018-10-02 21:18:28 -04:00
Thomas Harte
5361120353 Restores a stable frame. 2018-10-02 21:05:30 -04:00
Thomas Harte
60bab8fdf1 Starts to reformulate TMS collection as coroutines.
For the time being, thereby breaks all video. A static screen of the border colour is all you'll see.
2018-10-01 23:03:17 -04:00
Thomas Harte
cc99b0f532 Fixes typo. 2018-09-30 20:48:55 -04:00
Thomas Harte
91aa8f9295 Amps up colour content a little. 2018-09-30 20:47:26 -04:00
Thomas Harte
e9328d819e Switches to RGB output, at least for development. 2018-09-30 20:47:03 -04:00
Thomas Harte
48ece623e7 Adds the Sega Master System to SConstruct. 2018-09-30 20:46:38 -04:00
Thomas Harte
23191efc05 Starts writing and referring to colour RAM for colours. 2018-09-29 19:50:13 -04:00
Thomas Harte
0d8af010b6 Takes a stab at tile reversal and vertical scrolling. 2018-09-28 22:37:10 -04:00
Thomas Harte
7b9bb772ca Corrected to give a not-exactly-indexed-correctly approximation of what's on display. 2018-09-28 21:03:51 -04:00
Thomas Harte
f7e211c245 Makes first attempt to put something vaguely like the Master System tile map on screen. 2018-09-28 20:39:14 -04:00
Thomas Harte
43bcb6415b Merge branch 'master' into MasterSystemVDP 2018-09-27 22:38:15 -04:00
Thomas Harte
15ec4aaa43 Merge pull request #554 from TomHarte/65C02s
Corrects Rockwell and WDC references.
2018-09-27 22:37:45 -04:00
Thomas Harte
364859467f Corrects Rockwell and WDC references.
Also shuffles the NES CPU type up into the top position, so this is a strict progression in terms of functionality.
2018-09-27 22:36:45 -04:00
Thomas Harte
35c2e74af8 Attempts to establish a coroutine-ish structure for access patterns.
The Master System mode, inevitably, is the test case.
2018-09-27 22:33:41 -04:00
Thomas Harte
19482a563f Attempts to explicitly make room for the SMS VDP mode. 2018-09-27 21:22:57 -04:00
Thomas Harte
2e4c4c3e91 Makes some attempt to implement paging.
This causes several of the 32kb games to be recognised by the BIOS and permitted to start, so it really really may be time to stop deferring work on the VDP.
2018-09-24 21:34:42 -04:00
Thomas Harte
7515fa8a98 Ensures the SG1000 gets an unadulterated TMS and SN. 2018-09-23 22:24:29 -04:00
Thomas Harte
5b9e7213dd Adds a couple of joystick inputs.
SG1000 titles all seem to work now.
2018-09-23 21:55:07 -04:00
Thomas Harte
2253341904 This now goes far enough for the only SG1000 game I'm testing to start up.
Which hopefully gives me as much as I need to implement joypads, etc, and definitively get to just the VDP being outstanding.
2018-09-23 17:42:42 -04:00
Thomas Harte
e155dc8d6e Adds fairly standard memory map indirection. 2018-09-23 17:36:30 -04:00
Thomas Harte
00b2db4fb9 Ensures the Master System is informed when it should pretend to be an SG1000. 2018-09-23 16:34:47 -04:00
Thomas Harte
f59386f523 Adds just enough input logic that the Sega sound now plays. 2018-09-23 16:05:37 -04:00
Thomas Harte
9683c8f664 Advances towards the Master System actually receiving interrupts. 2018-09-23 15:58:23 -04:00
Thomas Harte
38a1fde3bf Attempts to permit Master System interrupts. 2018-09-23 00:07:46 -04:00
Thomas Harte
40c7a63fb5 Makes a first attempt at Master System IO decoding. 2018-09-22 23:45:29 -04:00
Thomas Harte
d9e65cd758 Ensures neither the ColecoVision nor the MSX processes mid-cycles. 2018-09-21 22:53:35 -04:00
Thomas Harte
e511261b04 Adds a Master System class, so that SMSs can end up somewhere. 2018-09-21 22:13:07 -04:00
Thomas Harte
0d01346ad4 Advertises SMS support and goes as far as realising it needs to spawn a Master System. 2018-09-20 22:04:28 -04:00
Thomas Harte
e7f4babf41 Starts taking steps towards SMS/GG and V9938/9958 support.
Specifically: routine namespace stuff, plus the intention to move to a table-based operation+cost version of timing. Reordering works fine for the TMS, and probably would also for the SMS/GG, but it'd be problematic with the command engine of the V9938/9958 and maintaining a consistent set of code is easier.
2018-09-17 22:59:16 -04:00
Thomas Harte
a29a8e292b Merge pull request #552 from TomHarte/AppleIIBrightness
Turns down the Apple II brightness a little.
2018-09-17 20:09:06 -04:00
Thomas Harte
a8b116e217 Turns down the Apple II brightness a little.
So that light blue is more like a blue.
2018-09-17 20:08:20 -04:00
Thomas Harte
e582b4c8ca Eliminates some dangling references to iCoordinate. 2018-09-13 19:35:15 -04:00
Thomas Harte
3b70dbfebe Merge pull request #550 from TomHarte/ElectronCorruption
Resolves potential Electron output errors
2018-09-12 21:04:20 -04:00
Thomas Harte
868cd5cb09 Improves alignment request. 2018-09-12 20:27:02 -04:00
Thomas Harte
dec18d9acc Restores full pixel output to the Electron. 2018-09-12 20:25:30 -04:00
Thomas Harte
a7508bc2ae Switching explicitly to one pixel per sample eliminates the need for a bookender. 2018-09-12 20:11:17 -04:00
Thomas Harte
a38639d099 Eliminates the concept of an iCoordinate.
Real-life precision appears not to support the idea of sub-sample pixel storage.
2018-09-12 20:05:39 -04:00
Thomas Harte
c6e94bc2a6 Adds missing #include. 2018-09-11 21:55:03 -04:00
Thomas Harte
12e9478a81 Merge pull request #549 from TomHarte/MSXPaste
Simplifies and corrects MSX pasting behaviour.
2018-09-11 21:47:41 -04:00
Thomas Harte
09dafb1a79 Simplifies and corrects MSX pasting behaviour.
Now including mapping \n -> \r.
2018-09-11 21:46:28 -04:00
Thomas Harte
3358c07107 Merge pull request #548 from TomHarte/MoreBooleans
Adds 'false' and 'f' to the list of acceptable command-line option falses.
2018-09-11 20:38:11 -04:00
Thomas Harte
36ff2105fb Updates C-style (bool) casts. 2018-09-11 20:37:15 -04:00
Thomas Harte
1739d18433 Adds 'false' and 'f' to the list of acceptable refusals. 2018-09-11 20:36:49 -04:00
Thomas Harte
61272cfe20 Merge pull request #547 from TomHarte/VicUB
Fixes undefined behaviour resulting from uninitialised VIC state.
2018-09-10 22:35:14 -04:00
Thomas Harte
31b048f966 Ensures all bools start in a valid state. 2018-09-10 22:21:03 -04:00
Thomas Harte
7e29d49451 Merge branch 'master' of github.com:TomHarte/CLK 2018-09-10 21:38:38 -04:00
Thomas Harte
5445081c96 It's eight pixels that aren't written in double output mode, not four. 2018-09-10 21:38:05 -04:00
Thomas Harte
d791facc87 Update README.md
Promoted my estimation of the Apple IIs.
2018-09-10 17:57:40 -04:00
Thomas Harte
21a9bd927a Merge pull request #545 from TomHarte/LeftBorder
Adds a left gutter to complement the right.
2018-09-09 21:53:25 -04:00
Thomas Harte
d73d3b4480 Adds a left border to complement the right. 2018-09-09 21:52:48 -04:00
Thomas Harte
7b9c1bb69c Makes minor layout improvements. 2018-09-09 21:02:31 -04:00
Thomas Harte
224b3163f2 Merge pull request #544 from TomHarte/MSXColours
Corrects composition-time over-saturation.
2018-09-09 20:39:13 -04:00
Thomas Harte
fc84ae611e Resolves various instances of spaces in place of tabs. 2018-09-09 20:33:56 -04:00
Thomas Harte
22a52bdca2 Merge branch 'master' into MSXColours 2018-09-09 20:31:24 -04:00
Thomas Harte
6e9cd5cb21 Resolves over-brightness created by over-composition. 2018-09-09 20:30:43 -04:00
Thomas Harte
c73445199c Eliminates a couple of instances of manual memory management. 2018-09-09 20:29:58 -04:00
Thomas Harte
ab02f82470 Merge pull request #543 from TomHarte/CFBundleTypeOSTypes
Removes `LSItemContentTypes` so as not to reject files.
2018-09-09 17:49:16 -04:00
Thomas Harte
1e3318816c Removes LSItemContentTypes so as not to reject files. 2018-09-09 17:47:03 -04:00
Thomas Harte
4c8781c762 Increases documentation slightly. 2018-09-09 17:17:38 -04:00
Thomas Harte
3a3dec92c7 Merge pull request #540 from MaddTheSane/plistFix
Remove LSItemContentTypes
2018-09-09 10:07:19 -04:00
Thomas Harte
5a5fc1ae1a Merge pull request #541 from TomHarte/Annunciator3
Implements the two undocumented annunciator 3 graphics modes
2018-09-09 10:06:52 -04:00
Thomas Harte
8d79a1e381 Corrected fat low-res implementation.
As per comment of awanderin that "the odd addresses don't get their pixels auto-shifted by the hardware as with normal lo-res".
2018-09-09 10:06:21 -04:00
Thomas Harte
d70f5da94e Attempts an implementation of the undocumented low res + annunciator 3 graphics mode. 2018-09-08 20:51:15 -04:00
C.W. Betts
05d4274019 Remove LSItemContentTypes: they should be unique identifiers, not generic types like public.item or public.data.
This can result in strange icons showing up in the wrong places.

Also added a category type.
2018-09-07 16:39:52 -06:00
Thomas Harte
afeec09902 Gets explicit about DHIRES being annunciator 3; implements four-colour high res mode. 2018-09-06 23:23:19 -04:00
Thomas Harte
0526ac2ee2 Slightly increases const correctness.
The converters from source data to output pixels do not modify the source data. It's a shame there's no `restrict` in C++.
2018-09-05 11:36:40 -04:00
Thomas Harte
6725ee2190 Merge pull request #539 from TomHarte/40ColumnTextCorruption
Corrects 40-column alternative text mode corruption
2018-09-05 10:27:09 -04:00
Thomas Harte
8b661fb90f Introduces an extra level of indirection for text mapping. 2018-09-05 10:26:08 -04:00
Thomas Harte
dab7d3db1b Merge branch 'master' into 40ColumnTextCorruption 2018-08-30 20:24:47 -04:00
Thomas Harte
1cba3d48d9 Merge pull request #538 from TomHarte/AppleDecodingAgain
Correction: 0xc011 et al get the keyboard value in bits 0 to 6...
2018-08-30 20:19:48 -04:00
Thomas Harte
d53b38ec7e Correction: 0xc011 et al get the keyboard value in bits 0 to 6 and the switch value in bit 7. 2018-08-30 20:18:36 -04:00
Thomas Harte
5d0f47eda2 Merge pull request #536 from TomHarte/AppleDecoding
Adds mirrors for keyboard input and the audio toggle.
2018-08-27 21:14:48 -04:00
Thomas Harte
2e04c4442c Adds mirrors for keyboard input and the audio toggle. 2018-08-27 21:14:21 -04:00
Thomas Harte
f639cdc8ad Merge pull request #535 from TomHarte/DSKFixes
Corrects Apple DSK track length, inter-track skew, and Pro-DOS volume number.
2018-08-27 21:07:11 -04:00
Thomas Harte
71ec7624ca Corrects Apple DSK track length, inter-track skew, and Pro-DOS volume number. 2018-08-27 20:56:25 -04:00
Thomas Harte
0599d9602e Ensures no out-of-bounds accesses to inverses on a IIe. 2018-08-26 23:02:31 -04:00
Thomas Harte
234bef2a88 Adds default to make it explicit that fetch_address is initialised. 2018-08-24 22:26:03 -04:00
Thomas Harte
adb574e1cd Merge pull request #529 from TomHarte/AppleDelay
Corrects Apple II video defects
2018-08-24 22:11:41 -04:00
Thomas Harte
1f491e764e Nudges visible area slightly to the right. 2018-08-24 22:08:11 -04:00
Thomas Harte
114a43a662 Corrects improper indexing for byte shift. 2018-08-24 21:58:43 -04:00
Thomas Harte
5547c39c91 Corrects documentation. 2018-08-24 20:06:40 -04:00
Thomas Harte
97a89aaf4d Factors out the stuff of deferred action interleaving, as I suspect it'll come in handy. 2018-08-24 20:04:26 -04:00
Thomas Harte
61e46399dc About face! There should be no delay on serialisation, but a delay on interpretation-affecting soft switches. 2018-08-22 21:56:45 -04:00
Thomas Harte
e802f6ecc2 Rearranges draw loop around a fixed-size 568-sample line buffer. 2018-08-19 22:31:04 -04:00
Thomas Harte
4209f0e044 Moves memory collection into a separate loop. 2018-08-18 21:54:24 -04:00
Thomas Harte
33576aa2c4 Uses const to ensure output_* are properly constrained. 2018-08-18 21:36:48 -04:00
Thomas Harte
17bf1a64bf Moves the stuff of generating pixels out of the main loop. 2018-08-18 18:44:31 -04:00
Thomas Harte
f8d46f8f3d Merge branch 'master' into AppleDelay 2018-08-18 14:11:21 -04:00
Thomas Harte
8787d85e64 Eliminates #undefs as being (i) unnecessary, now this is a source file; and (ii) incomplete in any case. 2018-08-17 22:24:42 -04:00
Thomas Harte
7f0f17f435 Merge pull request #523 from TomHarte/Further65C02
Further corrects 65C02 behaviour
2018-08-17 21:58:38 -04:00
Thomas Harte
0e7f54f375 Implements STP and WAI, and ensures all unimplemented 65C02 instructions are NOP for all 65C02s. 2018-08-17 21:49:06 -04:00
Thomas Harte
b3bdfa9f46 Corrected: it's three-cycle 65C02 branches that ignore interrupts, not two. 2018-08-16 20:47:49 -04:00
Thomas Harte
592ec69d36 Causes the 65C02 not to accept interrupts immediately after untaken branches. 2018-08-15 22:42:04 -04:00
Thomas Harte
60e00ddd02 Correction: the test for not skipping an operand fetch requires a 65C02. 2018-08-15 22:07:17 -04:00
Thomas Harte
6806193dc2 Ensures that "Read/Modify/Write instructions absolute indexed in same page" take only six cycles on a 65C02. 2018-08-15 19:17:37 -04:00
Thomas Harte
c35dca783f Ensures that page-crossing indexing no longer causes an extra read of an invalid address on the 65C02.
It rereads the last byte of the instruction stream instead.
2018-08-15 18:47:53 -04:00
Thomas Harte
901e0d65b9 Documents all 6502 micro-operations.
Also makes sure 1-cycle NOPs really, definitely are one cycle only on a 65C02 and eliminates OperationCopyOperandFromA as a redundant copy of OperationSTA.
2018-08-14 22:17:53 -04:00
Thomas Harte
ddf45a0010 Ensures NMI and RST reset D on 65C02s. 2018-08-14 19:49:14 -04:00
Thomas Harte
1eca4463b3 Ensures NMI can no longer usurp BRK on 65C02s. 2018-08-14 19:33:48 -04:00
Thomas Harte
be01203cc1 Starts to expand the range of supported 6502s.
This fully implements the NES 6502 because, well, it's virtually no extra work, and ensures that RDY takes effect on write cycles on 65C02s.
2018-08-13 22:17:22 -04:00
Thomas Harte
4d1d19a464 Introduces an intermediate buffer for Apple II video data. 2018-08-12 20:36:08 -04:00
Thomas Harte
760817eb3b Merge pull request #521 from TomHarte/AppleVideo
Fixes Apple II double low resolution graphics
2018-08-11 23:20:40 -04:00
Thomas Harte
cb47575860 Eliminates stdout chatter. 2018-08-11 22:57:54 -04:00
Thomas Harte
434d184503 Corrects deserialisation order in double low res mode. 2018-08-11 22:53:06 -04:00
Thomas Harte
7374c665e8 Corrects regression in video flushing. 2018-08-11 19:57:39 -04:00
Thomas Harte
10c930a59d Merge pull request #520 from TomHarte/EnhancedIIe
Adds Enhanced IIe emulation.
2018-08-11 19:42:47 -04:00
Thomas Harte
60ab6f0c2a Entrusts IIe-esque character logic fully to the ROM. 2018-08-11 18:45:39 -04:00
Thomas Harte
a13eb351da Implements the Enhanced IIe, other than some text selection errors. 2018-08-11 10:26:30 -04:00
Thomas Harte
4b91910fab Removes erroneous addition. 2018-08-10 23:27:09 -04:00
Thomas Harte
f46d52364c Merge pull request #519 from TomHarte/65C02
Makes an initial pass at 65C02 emulation
2018-08-10 23:21:45 -04:00
Thomas Harte
878c63dcd2 Ensures ADC and SBC decimal take an extra cycle on the 65C02. 2018-08-10 22:52:55 -04:00
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
b63e0cff72 Improves has-completed test. 2018-08-10 22:27:01 -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
c1d1c451ef Merge pull request #518 from TomHarte/MacInsertDisplay
Tweaks the Mac UI
2018-08-06 19:12:17 -04:00
Thomas Harte
3be30d8c71 Tries once again to introduce file type icons. 2018-08-06 19:08:27 -04:00
Thomas Harte
d4c1244485 Adds a hint for users. 2018-08-06 18:56:59 -04:00
Thomas Harte
c61b9dca17 Ensures the Mac doesn't show the 'Insert...' option for machines that can't accept an insertion. 2018-08-06 18:52:42 -04:00
Thomas Harte
39bf682016 Adds mentions of the IIe. 2018-08-06 12:03:54 -04:00
Thomas Harte
60ac9b49ea Merge pull request #517 from TomHarte/MacInsertUI
Completes Mac UI 'Insert...' change
2018-08-05 22:58:16 -04:00
Thomas Harte
a8bb18e2cf Merge branch 'master' into MacInsertUI 2018-08-05 22:57:28 -04:00
Thomas Harte
1852786609 Merge pull request #516 from TomHarte/MacInsertUI
Adds an 'Insert...' menu option.
2018-08-05 22:51:00 -04:00
Thomas Harte
31df8c7e91 Corrects improper NSWindowController sheet stack manipulation.
As a result, 'Insert...' now seems to work properly.
2018-08-05 22:47:51 -04:00
Thomas Harte
832939f5b7 Merge branch 'master' into MacInsertUI 2018-08-05 22:39:00 -04:00
Thomas Harte
c2d9e1ec81 Merge pull request #515 from TomHarte/POPImage
Adds an Apple II screenshot to the readme.
2018-08-05 17:58:53 -04:00
Thomas Harte
673b915ee8 Reduces post-table image size a little. 2018-08-05 17:57:37 -04:00
Thomas Harte
032a62dfff Adds An Apple II screenshot to the mix. 2018-08-05 17:56:10 -04:00
Thomas Harte
f2d78182a3 Merge pull request #514 from TomHarte/VideoFixes
Fixes various IIe video deficiencies.
2018-08-05 17:49:13 -04:00
Thomas Harte
de68e70246 Fixes various IIe video deficiencies.
Specifically:
* the double-high resolution switches should be read/write; and
* the other IIe-specific switches should cause a video update for real-time effect.
2018-08-05 17:47:23 -04:00
Thomas Harte
e07447eb9a Merge pull request #513 from TomHarte/JoystickRange
Significant improves Apple II joystick compatibility
2018-08-05 17:37:38 -04:00
Thomas Harte
5cdeb58571 Makes digital to analogue conversion more extreme. 2018-08-05 17:36:20 -04:00
Thomas Harte
ce14cc8677 Flips meaning of analogue input bits, correcting most joystick titles.
Mysteriously, some functioned correctly before this. But they continue to do so.
2018-08-05 17:36:01 -04:00
Thomas Harte
bcd0479074 This in principle completes the insert action.
With the caveat that 'New...' machines seem to have blocked the window's panel queue somehow.
2018-08-05 13:12:02 -04:00
Thomas Harte
d72dd8c4ff Merge branch 'master' into macInsertUI 2018-08-05 11:54:26 -04:00
Thomas Harte
f7ce86fef8 Merge pull request #512 from TomHarte/80Text
Extends correct text handling to 80-column mode.
2018-08-04 22:28:59 -04:00
Thomas Harte
55f2fccf5e Extends correct text handling to 80-column mode. 2018-08-04 22:25:29 -04:00
Thomas Harte
c939a274be Makes first attempt to connect up an in-machine open panel. 2018-08-04 22:21:23 -04:00
Thomas Harte
101fb5d7bf Merge pull request #511 from TomHarte/ColecoSizeCheck
Relaxes ColecoVision cartridge image size check
2018-08-04 21:47:30 -04:00
Thomas Harte
3c51e335c3 Makes extra sure not to try to read from an empty characters list. 2018-08-04 21:40:26 -04:00
Thomas Harte
33ea90678c Relaxes ColecoVision cartridge size test. 2018-08-04 21:40:02 -04:00
Thomas Harte
11ae2c64ba Merge pull request #502 from TomHarte/IIe
Extends Apple II emulation to include the IIe
2018-08-04 21:02:45 -04:00
Thomas Harte
26624d7652 Fixes vertical blank signal; it should be the other way around. 2018-08-04 20:57:02 -04:00
Thomas Harte
85fb4773b0 Tweaks Apple key mapping and implements reset_all_keys. 2018-08-04 20:31:37 -04:00
Thomas Harte
099d66804e Makes colour burst phase explicit. 2018-08-04 19:29:34 -04:00
Thomas Harte
086596c28e Adds reading of vertical blank and implements the full IIe keyboard logic.
i.e. there are now two Apple keys, and shift isn't assumed.
2018-08-04 19:17:04 -04:00
Thomas Harte
3aeb4213fe Implements the C010 read value. 2018-08-04 17:57:02 -04:00
Thomas Harte
558b96bc05 Corrects IIe text display. 2018-08-04 16:52:29 -04:00
Thomas Harte
e97cc40a2c Corrects typo in Cx-page ROM paging. 2018-08-04 12:44:58 -04:00
Thomas Harte
94503ed771 Disables the macOS Apple II options panel, since it now has no options. 2018-08-04 12:37:55 -04:00
Thomas Harte
c4f86cc324 The Disk II now being its proper speed, withdraws the quickload option. 2018-08-03 21:20:21 -04:00
Thomas Harte
70c4d6b9b3 Adds a one second delay between controller and drive motor off. 2018-08-03 21:13:18 -04:00
Thomas Harte
78c7137427 Avoids observer communication if motor status hasn't changed. 2018-08-03 21:11:22 -04:00
Thomas Harte
74a2f717b3 Turns down the composite signal amplitude a little, to help colour distinctness. 2018-08-01 18:52:42 -04:00
Thomas Harte
98bb5bd9f1 Ensures flux bits are observable for two cycles rather than one; it should be 1us. 2018-07-31 23:01:11 -04:00
Thomas Harte
c91eaaf8da Takes a stab at double low-res graphics. 2018-07-31 21:45:09 -04:00
Thomas Harte
a36f37d240 Introduces a 1/14th delay in output of double high res. 2018-07-31 21:29:51 -04:00
Thomas Harte
c773d3501a Implements the INTC8ROM switch.
Finally causing the Zellyn tests to pass! Is this nightmare behind me?
2018-07-31 19:00:46 -04:00
Thomas Harte
5810f9b3f9 Fixes high resolution address range and switching logic. 2018-07-30 23:23:18 -04:00
Thomas Harte
3f56683342 Fixes order of deserialisation between auxiliary and base RAM. 2018-07-30 23:08:45 -04:00
Thomas Harte
16ccbdefd6 Of course, | has higher precedence than ?. Classic! 2018-07-30 23:08:22 -04:00
Thomas Harte
a533d09fe7 Sets the IIe as the default model. 2018-07-30 23:07:34 -04:00
Thomas Harte
e9aaa5bbdf Factors out the page-mapping function.
For one less potential source of failure.
2018-07-30 22:23:48 -04:00
Thomas Harte
ecb26e3281 Corrections: slot_C3_rom_ works the other way around; 80STORE doesn't affect most of RAM but does always affect the text screen.
Also factored out `set_zero_page_paging` for consistency.
2018-07-30 19:54:25 -04:00
Thomas Harte
5aa0b17720 Improves IIe paging further. 2018-07-29 23:02:27 -04:00
Thomas Harte
632b37ecec Attempts an implementation of auxiliary memory. 2018-07-29 10:41:12 -04:00
Thomas Harte
c905de2e40 Restores IIe ROM-over-card paging. 2018-07-28 13:31:25 -04:00
Thomas Harte
bc2afe69e1 Accepting that memory mapping on a IIe is more complicated than I anticiapted, introduces mapping for all pages.
Also picks a name for the Unenhanced Apple IIe ROM.
2018-07-28 13:02:49 -04:00
Thomas Harte
894998b163 Merge branch 'master' into IIe 2018-07-28 10:54:04 -04:00
Thomas Harte
51192d8397 Merge pull request #508 from TomHarte/Whitespace
Eliminates various blank lines.
2018-07-28 10:53:17 -04:00
Thomas Harte
3c33ccd730 Eliminates various blank lines. 2018-07-28 10:52:34 -04:00
Thomas Harte
3e35109d63 Merge pull request #507 from TomHarte/BetterBMPDestination
Use `xdg-user-dir PICTURES` instead of $HOME for screenshots
2018-07-28 10:48:28 -04:00
Thomas Harte
99c770eab4 Ensure that the output of xdg-user-dir is properly filtered. 2018-07-28 10:45:50 -04:00
Thomas Harte
34aa78b7ce Attempts to use xdg-user-dir PICTURES in preference to $HOME for pictures. 2018-07-28 09:14:18 -04:00
Thomas Harte
8cca9c2055 Merge branch 'master' into IIe 2018-07-27 23:52:39 -04:00
Thomas Harte
85ce21c79f Merge pull request #505 from TomHarte/MacScreenshots
Attempts to introduce screenshot capture for macOS.
2018-07-27 23:43:13 -04:00
Thomas Harte
d19d949b9c Removes unnecessary import. 2018-07-27 23:41:55 -04:00
Thomas Harte
1cb3713b84 Attempts to introduce screenshot capture for macOS. 2018-07-27 23:37:24 -04:00
Thomas Harte
689850d698 Merge pull request #504 from TomHarte/SDLBMPByteOrder
Ensures SDL is properly informed of buffer byte order.
2018-07-27 18:53:16 -04:00
Thomas Harte
c572a52049 Ensures SDL is properly informed of buffer byte order. 2018-07-27 18:51:38 -04:00
Thomas Harte
41765e00c4 Merge branch 'master' into IIe 2018-07-26 21:24:46 -04:00
Thomas Harte
080aa0acc5 Merge pull request #503 from TomHarte/SDLScreenshots
Adds screenshot saving upon ctrl+shift+d.
2018-07-26 20:58:35 -04:00
Thomas Harte
5e7c46a72a Adds screenshot saving upon ctrl+shift+d. 2018-07-26 20:53:12 -04:00
Thomas Harte
5f2b9b2d5a Implements the alternative zero page soft switch. 2018-07-25 22:10:21 -04:00
Thomas Harte
5c4506a9db Talks the IIe into proceeding to a beep and an improperly-formed logo. 2018-07-25 21:43:12 -04:00
Thomas Harte
55a6431fb3 Puts in enough logic to be able to launch a non-functional IIe. 2018-07-25 18:58:34 -04:00
Thomas Harte
ede2696a77 Edges further towards implementing the IIe video subsystem.
All video-specific switches are in place, and mostly honoured, and a IIe machine configuration is advertised at least.
2018-07-24 22:15:42 -04:00
Thomas Harte
59b9e39022 Starts the process of supporting the Apple IIe graphics modes.
Albeit that I'm not yet even up on the proper soft switches.
2018-07-23 22:14:41 -04:00
Thomas Harte
6b2970f2f2 Ensures no-hat input doesn't override analogue axes. 2018-07-22 17:29:37 -04:00
Thomas Harte
6a73fe7d65 Merge pull request #500 from TomHarte/MacJoysticks
Implements initial joystick support for the Mac
2018-07-22 16:56:40 -04:00
Thomas Harte
1362906f94 Wires joystick support all the way through to machines.
Ensures there's only one joystick manager, which is shared by all machines, with input going only to the key window.
2018-07-22 16:55:47 -04:00
Thomas Harte
8f4042c4bb Permits joysticks to be queried for number of fire buttons. 2018-07-22 16:52:58 -04:00
Thomas Harte
c05b6397b0 Attempts a full implementation of the joystick manager.
So it currently vends a list of existing joysticks plus their states. More work will be required for a UI — e.g. there is no way to identify one joystick from another — but this'll do for now.
2018-07-22 15:23:26 -04:00
Thomas Harte
8d18808efe Walks a few steps further along device inspection. 2018-07-20 23:33:04 -04:00
Thomas Harte
09950d9414 Gamely starts to create a HID input manager for joysticks/pads/etc. 2018-07-19 22:43:01 -04:00
Thomas Harte
badbbdf155 Merge pull request #498 from TomHarte/DisplayBorder
Resolves border issues in fullscreen mode
2018-07-16 22:01:08 -04:00
Thomas Harte
2832792fed Corrects improper use of doubles. 2018-07-16 21:55:19 -04:00
Thomas Harte
efa45b9504 Adds a right gutter to clip persistence errors.
Also uncovers and corrects a long-standing centring error.
2018-07-16 21:52:31 -04:00
Thomas Harte
523749edf8 Merge branch 'master' into DisplayBorder 2018-07-16 20:00:52 -04:00
Thomas Harte
5a0499e8a7 Merge pull request #499 from TomHarte/EditorConfig
Adds a .editorconfig to aid Github display.
2018-07-16 20:00:27 -04:00
Thomas Harte
258c8b5900 Adds a .editorconfig to aid Github display. 2018-07-16 19:59:03 -04:00
Thomas Harte
24b861f056 Eliminates make_unique as this is presently a C++11 project. 2018-07-15 22:52:36 -04:00
Thomas Harte
29f7f4d432 Adds missing #include. 2018-07-15 22:47:50 -04:00
Thomas Harte
21080a1149 Merge branch 'master' into DisplayBorder 2018-07-15 22:31:33 -04:00
Thomas Harte
1d068fd09b Merge pull request #497 from TomHarte/RobocopSprites
Ensures only the first 8px of sprites is output in 8x8 mode.
2018-07-15 22:30:42 -04:00
Thomas Harte
92065813ef Ensures only the first 8px of sprites is output in 8x8 mode.
Also adds a little extra documentation.
2018-07-15 22:21:29 -04:00
Thomas Harte
3e9ef6b8cb Adds indicator lights for the SDL port.
To complete #426
2018-07-15 20:19:06 -04:00
Thomas Harte
c9451a5382 Introduces an object for drawing OpenGL rectangles. 2018-07-14 17:42:23 -04:00
Thomas Harte
2be3b027db Merge branch 'master' into DisplayBorder 2018-07-14 13:13:29 -04:00
Thomas Harte
e339d169c5 Ensures the joystick doesn't obstruct tape input. 2018-07-12 22:10:05 -04:00
Thomas Harte
87001f86ee Merge pull request #495 from TomHarte/MSXJoysticks
Adds joystick support for the MSX.
2018-07-12 21:44:26 -04:00
Thomas Harte
58484e8f37 Adds joystick support for the MSX. 2018-07-12 21:42:47 -04:00
Thomas Harte
94f68f9d55 Merge pull request #494 from TomHarte/CustomInfoBlock
Corrects TZX custom info block parsing.
2018-07-11 22:22:49 -04:00
Thomas Harte
3f6944de54 Corrects custom info block parsing. 2018-07-11 22:21:35 -04:00
Thomas Harte
00cb4d26b3 Corrects typo. 2018-07-11 19:52:55 -04:00
Thomas Harte
774d8668bf Merge pull request #493 from TomHarte/SpecificROMs
Clarifies startup procedure for machines
2018-07-10 22:15:40 -04:00
Thomas Harte
8503589828 Corrects failure to retain OS. 2018-07-10 22:05:50 -04:00
Thomas Harte
0f95ef2059 Merge branch 'SpecificROMs' of github.com:TomHarte/CLK into SpecificROMs 2018-07-10 21:54:45 -04:00
Thomas Harte
efd812cf22 Ensures no buffer overrun when installing the OS ROM. 2018-07-10 21:54:36 -04:00
Thomas Harte
736e14c83e Ensures no buffer overrun when installing the OS ROM. 2018-07-10 21:49:38 -04:00
Thomas Harte
57f161e64c Corrects documentation of the media target. 2018-07-10 21:42:09 -04:00
Thomas Harte
0897210969 Neither cartridge machine should be a media target; their media can't be changed at runtime. 2018-07-10 21:40:13 -04:00
Thomas Harte
7e58a44771 Renames ConfigurationTarget to MediaTarget as per its newly-reduced interface. 2018-07-10 21:32:28 -04:00
Thomas Harte
e8f847d288 Fixes CRC generator used to verify Acorn programs. 2018-07-10 20:01:31 -04:00
Thomas Harte
a0f817108e Minor style fix. 2018-07-10 20:01:11 -04:00
Thomas Harte
3862fdb44c Simplifies initialisation procedure for all machines.
With the side effect of allowing every machine to try to load only the ROMs that it needs.
2018-07-10 20:00:46 -04:00
Thomas Harte
3e2d271566 Merge pull request #491 from TomHarte/CPCClip
[Re-]recalibrates CRT retrace period and affected view windows.
2018-07-05 22:38:20 -04:00
Thomas Harte
c97c5fa03a [Re-]recalibrates CRT retrace period and affected view windows.
In the hope of moving the CPC closer to the real CTM visible area.
2018-07-05 22:07:18 -04:00
Thomas Harte
fa63f7ffc3 Merge pull request #490 from TomHarte/NIBTails
Ensures NIB tracks aren't truncated
2018-07-03 21:38:31 -04:00
Thomas Harte
bfccadd356 Corrects comment typo. 2018-07-03 21:38:04 -04:00
Thomas Harte
5b3512f1df Attempts to pick an intelligent place to pad out tracks. 2018-07-03 20:10:22 -04:00
Thomas Harte
6e34e60f8a Ensures no data is dropped in transcribing a NIB to real track data. 2018-07-03 20:01:07 -04:00
Thomas Harte
a391d0f4ae Merge pull request #489 from TomHarte/OricDiskII
Simplifies disk track storage and writing implementation
2018-07-02 22:09:58 -04:00
Thomas Harte
abc5c50b2e Added some additional exposition. 2018-07-02 21:51:53 -04:00
Thomas Harte
1fcb461c42 Ensures that segments are written in a properly-circular fashion. 2018-07-02 19:35:49 -04:00
Thomas Harte
abca38a548 Makes an initial removal of PCMPatchedTrack. Farewell, old friend. 2018-07-01 22:49:57 -04:00
Thomas Harte
b4be2cd063 Implements PCMTrack::add_segment. Thereby completes PCMTrack::resampled_clone. 2018-07-01 18:28:25 -04:00
Thomas Harte
2d83eeb9c4 Further minor style improvements. 2018-07-01 17:59:43 -04:00
Thomas Harte
4d9e897cc3 Corrects addressing for deserialisation of bytes. 2018-07-01 15:58:56 -04:00
Thomas Harte
be664b5695 Ensures that start positions are properly related to sectors. 2018-07-01 15:53:48 -04:00
Thomas Harte
c3751066b7 Ensures segments are properly sized. 2018-07-01 15:43:31 -04:00
Thomas Harte
77feee8197 Applies minor style improvements. 2018-07-01 15:38:42 -04:00
Thomas Harte
f75af3b45e Adds some extra exposition. 2018-07-01 14:41:17 -04:00
Thomas Harte
1471a35bb8 Reserves a more appropriate amount of data. 2018-07-01 14:40:48 -04:00
Thomas Harte
555c2a4377 Makes a first sweep at converting the storage underlying PCMSegment to vector<bool>.
This is to remove another pain point, in preparation for the work immediately forthcoming but also work as-yet unknown.
2018-07-01 12:05:41 -04:00
Thomas Harte
16bef0dcd5 Starts the movement towards a world without PCMPatchedTrack. 2018-06-30 20:03:18 -04:00
Thomas Harte
cd464fc7de Corrects status logging. 2018-06-26 20:53:08 -04:00
Thomas Harte
5b88207477 Merge pull request #488 from TomHarte/AYClarification
Removes unused AY state and implements AND output readback.
2018-06-26 19:31:50 -04:00
Thomas Harte
df8c896193 Removes unused state and implements AND output readback. 2018-06-26 19:31:16 -04:00
Thomas Harte
5d3e1f7084 Merge pull request #487 from TomHarte/SpuriousKeyboard
Corrects a misreported value when reading the AY if not in reading mode
2018-06-25 20:49:32 -04:00
Thomas Harte
59f8eeb05a Ensures the AY goes high impedance when not in read mode. 2018-06-25 20:48:24 -04:00
Thomas Harte
0b14850467 Corrects some comments. 2018-06-24 23:02:36 -04:00
Thomas Harte
f72e260915 Merge pull request #486 from TomHarte/AppleIIEqualisation
Ensures the Apple II retains horizontal sync for its entire display
2018-06-24 11:27:57 -04:00
Thomas Harte
640a84d456 Shift the h-within-v pulse to eliminate a curved top line. 2018-06-24 11:27:18 -04:00
Thomas Harte
04f6cb1750 Merge branch 'master' into AppleIIEqualisation 2018-06-23 23:10:29 -04:00
Thomas Harte
87d688b7e3 Merge pull request #485 from TomHarte/FurtherTweaks
Various tweaks: Mac UI and CPC window size
2018-06-23 23:10:07 -04:00
Thomas Harte
26141a59b0 Moves all default Mac window positions up by 50px. 2018-06-23 23:09:34 -04:00
Thomas Harte
a93f8103ad Zooms out the CPC a little more.
To fix the maximum amount of content that I can, at least for now.
2018-06-23 22:15:34 -04:00
Thomas Harte
4a3d7c338a Moves the activity window down to start at approximately the same top as the options window. 2018-06-23 22:14:44 -04:00
Thomas Harte
55ab305dbf Introduces equalisation pulses for the Apple II. 2018-06-23 22:11:39 -04:00
Thomas Harte
e48ba89721 Merge pull request #484 from TomHarte/MachinePickerLocation
Cleans up the Mac UI
2018-06-23 19:45:49 -04:00
Thomas Harte
9bb55b6b61 Ensures that 'Activity' view has minimum acceptable height. 2018-06-23 19:44:35 -04:00
Thomas Harte
c33308bdc5 Attempts to improve relative default window positions. 2018-06-23 18:59:19 -04:00
Thomas Harte
44a33941bf Undoes Xcode's folder renaming. 2018-06-23 18:55:17 -04:00
Thomas Harte
cc34cd2133 Merge pull request #481 from TomHarte/CPCJoysticks
Introduces joystick support for the CPC.
2018-06-23 17:09:32 -04:00
Thomas Harte
52c9f9e89e Merge branch 'master' into CPCJoysticks 2018-06-23 16:43:49 -04:00
Thomas Harte
2363deb19c Merge pull request #483 from TomHarte/BetterClip
Picks more appropriate cropping now that I'm obeying HSYNC-as-blank.
2018-06-23 16:42:44 -04:00
Thomas Harte
1c6af279b2 Picks more appropriate cropping now that I'm obeying HSYNC-as-blank. 2018-06-23 16:40:17 -04:00
Thomas Harte
6e96275e1c Merge pull request #482 from TomHarte/PixelCapture
Ensures the pixel collection test is inline with other decisions.
2018-06-23 16:19:04 -04:00
Thomas Harte
9968342a11 Ensures the pixel collection test is inline with other decisions. 2018-06-23 16:18:33 -04:00
Thomas Harte
c248ecde48 Introduces joystick support for the CPC. 2018-06-21 22:46:10 -04:00
Thomas Harte
370952ab33 Merge pull request #480 from TomHarte/Blank
Corrects left-border handling on the CPC
2018-06-21 20:08:09 -04:00
Thomas Harte
154c89e041 Introduces a missing separator. 2018-06-21 20:01:04 -04:00
Thomas Harte
d45f1a793d Introduces composite/RGB selection for the Amstrad CPC. 2018-06-21 20:00:49 -04:00
Thomas Harte
9800951f18 Merge branch 'master' into Blank 2018-06-21 19:41:04 -04:00
Thomas Harte
17251997c2 Merge pull request #479 from TomHarte/8272Logging
Returns sanity to 8272 logging.
2018-06-21 19:40:42 -04:00
Thomas Harte
5ab4cfee84 Factors out repeated hex-size setting. 2018-06-21 19:27:54 -04:00
Thomas Harte
a9eb0d02c6 Returns sanity to 8272 logging. 2018-06-20 23:02:32 -04:00
Thomas Harte
1f8b69a5b0 Attempts to honour the full CRTC 'sync' period, placing blank and the colour burst. 2018-06-20 22:38:54 -04:00
Thomas Harte
8b83f58d7a Merge pull request #478 from TomHarte/CPCTimingTests
Differentiates reasons for a read to be four cycles.
2018-06-20 21:39:12 -04:00
Thomas Harte
9a91ae38c1 Differentiates reasons for a read to be four cycles.
Specifically, puts the enforced wait either before or after checking the wait line. More research may be required; it feels more likely to me that a forced post wait should complete the read then wait, but would that still count as a single machine cycle?
2018-06-20 21:34:21 -04:00
Thomas Harte
ad57caed5e Merge pull request #476 from TomHarte/LongLines
Increases permissible error in scanline length.
2018-06-19 22:25:37 -04:00
Thomas Harte
283ed8dbae Increases permissible error in scanline length. 2018-06-19 22:24:11 -04:00
Thomas Harte
acb74185d5 Revokes test logging. 2018-06-19 19:39:09 -04:00
Thomas Harte
7a5d16ccf8 Merge pull request #475 from TomHarte/VisibleActivity
Shows activity indicators on the Mac
2018-06-18 22:49:33 -04:00
Thomas Harte
adca862166 Finally makes an initial pass at logging macros. 2018-06-18 22:37:19 -04:00
Thomas Harte
1bdc718527 Ensures the MSX reports the proper number of drives. 2018-06-18 22:15:52 -04:00
Thomas Harte
685a80f95b Ensures the Electron Plus 3 properly announces drives to an activity observer.
Does away with lazy allocation as not all that helpful, and liable to cause complexity.
2018-06-18 21:49:57 -04:00
Thomas Harte
62eef8cb40 Reinstates proper ready behaviour. 2018-06-18 21:35:39 -04:00
Thomas Harte
6ed3a49fe1 Made failed attempt to apply height constraint. 2018-06-18 21:35:22 -04:00
Thomas Harte
17702bfb89 Causes GUI LEDs to reflect their underlying activity. 2018-06-18 21:22:51 -04:00
Thomas Harte
292e02702a Progresses very slightly to being able to show up to four activity indicator names.
Blinking to come.
2018-06-17 22:52:17 -04:00
Thomas Harte
5a56d8a5d0 Exposes a list of machine LEDs to Swift.
Also gets explicit about nullability on the Objective-C side.
2018-06-17 18:53:56 -04:00
Thomas Harte
3da1d5700c Merge pull request #472 from TomHarte/SDLJoystick
Connects SDL joystick input to joystick machines.
2018-06-16 22:26:19 -04:00
Thomas Harte
d437e06e15 Adds support for digital hat input as an alternative to analogue sticks. 2018-06-16 22:25:46 -04:00
Thomas Harte
6a3702a5c7 Reduces space for floating point accuracy errors. 2018-06-16 22:22:40 -04:00
Thomas Harte
83a654540a Fixes threshold for positive movement. 2018-06-16 22:22:14 -04:00
Thomas Harte
678bd93c52 Connects SDL joystick input to joystick machines. 2018-06-14 22:37:44 -04:00
Thomas Harte
1bf0c1891a Merge pull request #471 from TomHarte/FadeAwayNotRadiate
Hides persistent low-part colour channel errors.
2018-06-14 20:45:41 -04:00
Thomas Harte
b899a22c7d Hides persistent low-part colour channel errors. 2018-06-14 20:40:27 -04:00
Thomas Harte
1bd6bbca8d Merge pull request #468 from TomHarte/PALColour
Tweaks blending back to appease interlaced video
2018-06-14 18:28:06 -04:00
Thomas Harte
14a2e470e4 Corrects overbrightness issue with autogeneration of PAL composite from an RGB source. 2018-06-14 18:25:48 -04:00
Thomas Harte
41dcf1de42 Increases blur again just a little more, after consideration of interlaced output. 2018-06-14 18:25:04 -04:00
Thomas Harte
0c65385c82 Undoes older interpretation of alternating phase.
I now understand, hopefully, that it's only the phase of the second colour component that alternates. That has the pointwise effect of reversing the colour signal. Hence the effect of phase errors cancelling themselves out up on successive lines up to a point.
2018-06-14 18:24:32 -04:00
Thomas Harte
4aaf43150a Merge pull request #467 from TomHarte/Sharpness
Decreases inter-frame blur.
2018-06-14 17:43:16 -04:00
Thomas Harte
f05ee525cb Tweaks blurriness downward. 2018-06-14 17:41:17 -04:00
Thomas Harte
1172c4fd97 Merge pull request #466 from TomHarte/CPCKeyboard
Improves key state handling under SDL when switching to/from full screen
2018-06-14 17:26:11 -04:00
Thomas Harte
15deef50c8 Adds a key reset upon screen mode changes in SDL. 2018-06-14 17:24:16 -04:00
Thomas Harte
7728adfc5a Eliminates repetition of the 10 constant. 2018-06-14 17:23:47 -04:00
Thomas Harte
eff67f2250 Merge pull request #465 from TomHarte/SDLSwitch
Changes SDL full screen/window toggle and allows ROM path to be specified
2018-06-13 21:36:36 -04:00
Thomas Harte
64e3cf5de2 Ensured all usage messages reflect latest usage. 2018-06-13 21:31:13 -04:00
Thomas Harte
31a6d620e8 Revokes make_unique; I had forgotten that's a C++14 feature. 2018-06-13 21:24:12 -04:00
Thomas Harte
dfd37e7dec Switches full-screen command and adds user-specifiable ROM paths. 2018-06-13 21:21:52 -04:00
Thomas Harte
8d8f244bf5 Merge pull request #461 from TomHarte/Joystick
Introduces Joystick support for the Apple II
2018-06-13 19:34:26 -04:00
Thomas Harte
037b4802db Eliminates unused usings. 2018-06-13 19:26:59 -04:00
Thomas Harte
51da21b844 Formally introduces keyboard-as-joystick for the Mac, and fixes discovered joystick issues.
Specifically:
* digital to analogue conversion not returning to centre;
* Apple II axes being the wrong way around; and
* Apple II buttons using improper selection logic.
2018-06-13 19:22:34 -04:00
Thomas Harte
0be19d8de7 Ensures analogue channels which are already charging don't abide by c070. 2018-06-13 18:16:02 -04:00
Thomas Harte
f26e4734b3 Adds use of joystick input in the Apple II. 2018-06-12 22:21:43 -04:00
Thomas Harte
f1b430338e Makes the Apple II a joystick machine.
Albeit that the values supplied to its joysticks do not currently make it into the emulated state.
2018-06-11 22:16:32 -04:00
Thomas Harte
2954373115 Introduces an intermediary for digital <-> analogue conversion. 2018-06-11 21:35:03 -04:00
Thomas Harte
42d21ea3a9 Merge branch 'master' into Joystick 2018-06-10 21:08:59 -04:00
Thomas Harte
7d761f145f Corrects typo that mapped Apple II options to the Electron. 2018-06-10 21:05:14 -04:00
Thomas Harte
27657fcde0 Adds necessary header for assert. 2018-06-10 21:02:19 -04:00
Thomas Harte
3ea2a4ccb8 Moves the joystick class towards accepting analogue inputs. 2018-06-10 20:45:52 -04:00
Thomas Harte
a1c60152d4 Merge pull request #460 from TomHarte/RWTSAcceleration
Introduces optional quick loading of Apple DOS 3.3 programs
2018-06-10 18:41:23 -04:00
Thomas Harte
69da00fcfb Modifies test slightly for usual RWTS16 location.
Also eliminates messy print logging.
2018-06-10 18:41:09 -04:00
Thomas Harte
c4108efc5c Adds a more accurate option description for the Apple II. 2018-06-10 18:32:22 -04:00
Thomas Harte
d576ff1172 Exposes DOS 3.3 acceleration as an option.
Albeit with an unhelpful label in the macOS GUI for now.
2018-06-10 18:28:29 -04:00
Thomas Harte
af54666c23 Implements RWTS acceleration. 2018-06-10 17:58:16 -04:00
Thomas Harte
e0b75b6e3d Corrects logic for avoiding overwrite. 2018-06-09 21:47:51 -04:00
Thomas Harte
12c59ede09 Adds writeback of track location. 2018-06-09 20:34:12 -04:00
Thomas Harte
b4d0d4fff6 Starts building out some fast-loading infrastructure for DOS 3.3. 2018-06-09 17:29:14 -04:00
Thomas Harte
a694844190 Moves gap 1 into proper ownership. 2018-06-09 17:28:08 -04:00
Thomas Harte
28f2d331a8 Switches to more realistic gaps. 2018-06-09 13:06:45 -04:00
Thomas Harte
dde9b73a22 Creates the through-path that will be necessary for RWTS acceleration. 2018-06-09 12:51:53 -04:00
Thomas Harte
fb4bb21bf6 Ensures an objective copy of the bus address is kept, and forwarded to cards. 2018-06-08 20:12:15 -04:00
Thomas Harte
744c35b617 Caps the number of sync bytes inserted at five. 2018-06-06 21:52:26 -04:00
Thomas Harte
9ac21a4e71 Switches to ignoring the byte count, trusting the bit count entirely. 2018-06-06 21:51:55 -04:00
Thomas Harte
94359e9c75 Merge pull request #458 from TomHarte/ApplePhase
Corrects NTSC Q phase
2018-06-03 08:11:43 -04:00
Thomas Harte
076fa55651 Corrects: flux set is no-flux incoming.
This restores good sleeping behaviour.
2018-06-03 08:11:17 -04:00
Thomas Harte
d380595ad4 Unrolls the loops for slightly fewer conditionals. 2018-06-03 07:27:03 -04:00
Thomas Harte
d84b8700a3 Switches the Apple II to one byte per pixel.
Just trying to get it right for now; optimisation to come.
2018-06-02 22:03:45 -04:00
Thomas Harte
80b281d9f1 Switches back to whole bytes per pixel, owing to persistent precision problems at 1bpp.
Also fixes the inaccurately-named `cycles_since_update_`.
2018-06-02 18:25:00 -04:00
Thomas Harte
69dc3cc4d8 Switches to using the same varying for byte and subpixel selection. 2018-06-01 22:52:29 -04:00
Thomas Harte
1a9cea050e Minor: ensure AY registers *read* as 0 from reset, as well as being 0. 2018-06-01 19:48:42 -04:00
Thomas Harte
0833412df9 Corrects port for ZON-X reads. 2018-06-01 19:45:37 -04:00
Thomas Harte
35e84ff1a8 Corrects NTSC quadrature phase. 2018-05-31 21:40:46 -04:00
Thomas Harte
8dd7c6ef23 Eliminates 'reversed_c' as I no longer believe low-resolution colour numbers are reversed.
Also gets explicit about phase.
2018-05-29 22:30:45 -04:00
Thomas Harte
a26ab7086d Merge pull request #456 from TomHarte/TristateSleeper
Commutes `Sleeper` to `ClockingHint::Source`
2018-05-28 18:25:21 -04:00
Thomas Harte
b2464598d0 Forces the Apple II bus handler call inline. 2018-05-28 18:21:01 -04:00
Thomas Harte
6812a001d8 Teaches the Oric to apply a lighter Disk II touch when possible. 2018-05-28 18:20:43 -04:00
Thomas Harte
6c16754a6b Strips further improper constexprs. 2018-05-28 17:48:55 -04:00
Thomas Harte
75f9e3caeb Resolves incorrect bracketing. 2018-05-28 17:48:35 -04:00
Thomas Harte
ad5afe21ee Removes constexpr from things which are not const. Duh. 2018-05-28 17:28:57 -04:00
Thomas Harte
8a566cc1dd Experimentally goes to town on constexpr. 2018-05-28 17:20:11 -04:00
Thomas Harte
928aab13dc Introduces more granular clocking announcements to the Disk II.
As well as making it accept the clock rate it'll actually receive, to supply to the drives, so that they spin at the proper speed.
2018-05-28 17:19:29 -04:00
Thomas Harte
f3fe711542 Attempts to reduce FDC costs. 2018-05-27 23:55:04 -04:00
Thomas Harte
db8d8d8404 Commutes Sleeper to ClockingHint::Source, making state more granular. 2018-05-27 23:17:06 -04:00
Thomas Harte
6220ccb5d3 Merge pull request #455 from TomHarte/HumptyDumpty
Relaxes .p validation even further
2018-05-27 17:01:07 -04:00
Thomas Harte
20843305dd Removes unused calculation of vars. 2018-05-27 13:31:30 -04:00
Thomas Harte
8f6c0f6a8d Eliminates vars test.
At least Humpty Dumpty is a working .p that doesn't satisfy the test.
2018-05-26 19:05:35 -04:00
Thomas Harte
ede2df7e70 Merge pull request #452 from TomHarte/NIBWriting
Adds write support for NIBs
2018-05-25 18:40:35 -04:00
Thomas Harte
d45231c1a8 Introduces an additional validation test.
Thereby satisfying the TODO.
2018-05-25 18:40:15 -04:00
Thomas Harte
772812b35f Corrects improper textual reference to interface names. 2018-05-25 18:31:20 -04:00
Thomas Harte
f443fd44b5 Introduces support for writing NIBs. 2018-05-25 18:30:55 -04:00
Thomas Harte
79c60b8984 Adds necessary import for memcpy. 2018-05-24 21:58:50 -04:00
Thomas Harte
2dc2c2ce79 Merge pull request #449 from TomHarte/WOZWriting
Implements write support for WOZ files
2018-05-24 21:48:28 -04:00
Thomas Harte
523ca3264b Implements write support for WOZ files. 2018-05-24 21:44:31 -04:00
Thomas Harte
4036c60b45 Merge branch 'master' into WOZWriting 2018-05-24 19:01:04 -04:00
Thomas Harte
7d652e53e2 Merge pull request #450 from TomHarte/OricMicrodisc
Corrects meaning of the Microdisc's paging control.
2018-05-24 18:58:07 -04:00
Thomas Harte
7c3dd55e5c Corrects typo and improves exposition. 2018-05-24 18:57:35 -04:00
Thomas Harte
1b43381be0 Corrects meaning of the Microdisc's paging control. 2018-05-24 18:53:02 -04:00
Thomas Harte
8f78e5039e Factors out track seeking. 2018-05-24 18:45:00 -04:00
Thomas Harte
57ee6d4e41 Merge branch 'master' into WOZWriting 2018-05-23 22:32:30 -04:00
Thomas Harte
2868b1eca7 Adds missing import for memcpy. 2018-05-23 22:31:35 -04:00
Thomas Harte
a4d7703efd Adds missing #include. 2018-05-23 22:28:00 -04:00
Thomas Harte
ca4bc92c33 Adds WOZ CRC checking. 2018-05-23 22:22:17 -04:00
Thomas Harte
853261364e Generalised CRC generation and created specific subclasses for the CCITT CRC16 and CRC32. 2018-05-23 22:21:57 -04:00
Thomas Harte
d3c5e4267f Merge pull request #447 from TomHarte/DiskIIWriting
Substantially improves Disk II emulation, including write support
2018-05-22 21:54:16 -04:00
Thomas Harte
086b801c29 Mildly rearranges to avoid unnecessary call. 2018-05-22 21:50:07 -04:00
Thomas Harte
f9c25372c2 Ensures cards get messaged regardless of memory area. 2018-05-22 21:49:34 -04:00
Thomas Harte
ea92363e6c Attempts to get the Apple II to honour the AppleII::Card select constraints appropriately. 2018-05-22 20:34:59 -04:00
Thomas Harte
015f692bd3 The Disk II card now commutes Disk II sleep activity to select constraints. 2018-05-22 19:51:39 -04:00
Thomas Harte
80d34f5511 Specs out a new AppleII::Card interface.
Doesn't yet fully implement it on the Apple II side though.
2018-05-21 20:54:53 -04:00
Thomas Harte
e482929da8 Enhances the Disk II's ability to sleep.
Also enables Disk II sleep observation in the Oric.
2018-05-19 23:15:28 -04:00
Thomas Harte
4952657b31 Factors out physical to logical sector conversion. 2018-05-19 22:59:59 -04:00
Thomas Harte
46fae1a761 Corrected: now maps in the proper direction. 2018-05-19 22:50:33 -04:00
Thomas Harte
a09fb01d71 Makes an attempt at write support for Apple DSK files. 2018-05-19 22:30:52 -04:00
Thomas Harte
7cee3b7449 Resolves potential overflow / sign corruption. 2018-05-19 22:28:29 -04:00
Thomas Harte
8263c48a1d Added a guarantee that the TrackSerialiser won't modify tracks it receives. 2018-05-18 23:03:28 -04:00
Thomas Harte
ed06533e60 Implements write support out of the Disk II. 2018-05-18 22:07:58 -04:00
Thomas Harte
7b7beb13a3 Eliminates the fiction of setting and getting registers.
The Disk II seems lower level than that; it will read the data bus whenever it likes, it is the programmer's responsibility to keep up with that. It also reserves the right not to load the bus regardless of whether it receives a read or write access.
2018-05-17 21:39:11 -04:00
Thomas Harte
c46007332a Switches to returning the shift register contents on every even read. 2018-05-17 20:18:34 -04:00
Thomas Harte
908d3b0ee5 Slightly wrong as to the details, but gets the controller trying to output.
At an initial look, I think the shift register should end up on the data bus for all odd accesses. Need to investigate more thoroughly.
2018-05-16 22:37:22 -04:00
Thomas Harte
8a031b1137 Eliminates 'data' register as it doesn't exist; rejigs state machine command set. 2018-05-16 22:09:59 -04:00
Thomas Harte
1aba9f807e Ensures proper upward propagation of sleeping from first start. 2018-05-16 22:07:54 -04:00
Thomas Harte
4c49963988 Switches to proper handling of the motor control and write protection.
Per Understanding the Apple II the drive looks write protected  while phase 1 is enabled.
2018-05-16 21:44:09 -04:00
Thomas Harte
821d40fe74 Reinstitutes the cap on maximum updating time. 2018-05-16 21:42:05 -04:00
Thomas Harte
6ab1cf9325 Merge pull request #446 from TomHarte/MachinePickerLayout
Corrects various placement inconsistencies in the machine picker
2018-05-16 19:21:57 -04:00
Thomas Harte
076c0a48e9 Slightly tweaks initial size that this doesn't resize when switching to the Vic selection page. 2018-05-16 19:19:50 -04:00
Thomas Harte
fde613a5c4 Corrects various placement inconsistencies.
Hopefully to move into line with Apple's HID standards.
2018-05-16 19:15:49 -04:00
Thomas Harte
44ad0970be Merge pull request #445 from TomHarte/ColecoVisionDelay
Imposes a three-cycle penalty for SN76489 access.
2018-05-16 19:06:33 -04:00
Thomas Harte
b3f4d0ed8c Imposes a three-cycle penalty for SN76489 access.
This is my reading of (i) the SN76489 data sheet; plus (ii) the ColecoVision schematic.
2018-05-16 19:06:03 -04:00
Thomas Harte
bfdd3468ea Merge pull request #444 from TomHarte/AppleAudio
Introduces a low-pass filter for the Apple II
2018-05-15 21:33:52 -04:00
Thomas Harte
f7decd80b6 As an initial step, ensured latency doesn't pile up endlessly. 2018-05-15 21:12:43 -04:00
Thomas Harte
7c2721d54d Adjusted number again. But we'll see. 2018-05-15 20:43:13 -04:00
Thomas Harte
8907d0a9a7 Adds a low-pass filter to the Apple II's audio. 2018-05-14 21:56:14 -04:00
Thomas Harte
6c8e6e9303 Merge pull request #443 from TomHarte/DiskGainNoise
Ensures generation of random noise if too many zeroes exist on a disk.
2018-05-14 20:03:52 -04:00
Thomas Harte
85c4e009f3 Undoes reformatting error. 2018-05-14 20:03:32 -04:00
Thomas Harte
76802b5e38 Eliminates arc4random.
It seems not to be as portable as I'd hoped.
2018-05-14 20:01:20 -04:00
Thomas Harte
9f2f388e5a Ensures generation of random noise if too many zeroes exist on a disk surface. 2018-05-14 19:17:34 -04:00
Thomas Harte
729f53d84f Goes explicit with the Apple II. 2018-05-14 09:43:24 -04:00
Thomas Harte
d2d7ab5d04 Merge pull request #441 from TomHarte/AppleDSKFixes
Corrects various Apple DSK handling errors.
2018-05-13 22:42:21 -04:00
Thomas Harte
5107c7c23d Ensures all keypresses are entered as upper case. 2018-05-13 22:40:28 -04:00
Thomas Harte
4dbd1f1358 Corrects Disk II ROM visibility. 2018-05-13 22:36:02 -04:00
Thomas Harte
7996040f35 Rejigs segment conjugation to avoid potential accidental empty byte. 2018-05-13 22:30:44 -04:00
Thomas Harte
0055efb720 Corrects failure of expression in track size expansion. 2018-05-13 22:29:36 -04:00
Thomas Harte
dfa5eef20d Switches the command to issue to capitals; the Pravetz redefines lowercase as non-Latin. 2018-05-13 19:30:44 -04:00
Thomas Harte
3053acb4f3 Merge pull request #440 from TomHarte/VapourLock
Attempts to implement vapour lock bus behaviour.
2018-05-13 18:55:13 -04:00
Thomas Harte
dea9892a85 Attempts to implement vapour lock bus behaviour. 2018-05-13 18:53:32 -04:00
Thomas Harte
b9b6327707 Merge pull request #439 from TomHarte/ASCII
Eliminates all non-ASCII codes from all crossplatform code
2018-05-13 16:06:08 -04:00
Thomas Harte
84ae2964fd Switches to explicit unicode entry points. 2018-05-13 16:02:46 -04:00
Thomas Harte
149b940f84 Commutes the pound sign to a proper unicode value. 2018-05-13 15:50:56 -04:00
Thomas Harte
7226d8d4f7 Eliminates all instances of µ. 2018-05-13 15:46:14 -04:00
Thomas Harte
ad9b0cd4e3 Eliminates all endashes. 2018-05-13 15:43:03 -04:00
Thomas Harte
484e640d43 Removes stray non-ASCII typo. 2018-05-13 15:37:35 -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
72e07d4e83 Merge pull request #438 from TomHarte/OricTyper
Corrects Oric text pasting.
2018-05-13 14:14:13 -04:00
Thomas Harte
2252c29495 Switches the Oric to string insertion at the time of consumption.
To avoid issues around keyboard scanning being decoupled from consumption via IRQ, but not buffered. Keys pressed while BASIC is otherwise busy are just lost.
2018-05-13 14:02:46 -04:00
Thomas Harte
39c0bc6c47 Factors string serialisation with \n\r conversion out of the Apple II and reuses it with the Oric. 2018-05-13 13:57:19 -04:00
Thomas Harte
8f1a516a2c Merge pull request #437 from TomHarte/AppleIIPaste
Implements `type_string` for the Apple II.
2018-05-13 11:32:45 -04:00
Thomas Harte
a6b8e88406 Implements type_string for the Apple II. 2018-05-13 11:30:04 -04:00
Thomas Harte
c19b50619f Merge pull request #436 from TomHarte/MacPaste
Corrects Mac paste pathway.
2018-05-13 11:14:59 -04:00
Thomas Harte
3747d96b22 Corrects Mac paste pathway.
Also updates documentation around CSOpenGLView.
2018-05-13 11:12:03 -04:00
Thomas Harte
8b23a08fc4 Merge pull request #434 from TomHarte/RelaxedParsing
Removes requirement for correct sector epilogues.
2018-05-12 23:39:22 -04:00
Thomas Harte
3fdefb94e4 Removes requirement for correct sector epilogues.
It's now a length test that at present accepts 6-and-2 sectors only.
2018-05-12 23:03:08 -04:00
Thomas Harte
49592ebaf3 Ensures initialisation of scanner and that sectors overlapping the end of track are captured. 2018-05-12 18:42:07 -04:00
Thomas Harte
f410dcb3f3 Ensures proper test: not having a number of sectors that is a multiple of the track count. 2018-05-12 18:05:33 -04:00
Thomas Harte
bd27f61a03 Corrects various impossible-in-real-life compiler warnings. 2018-05-12 18:02:16 -04:00
Thomas Harte
d703328114 Adds missing #include for memcpy. 2018-05-12 17:54:13 -04:00
Thomas Harte
afe222cb16 Merge pull request #433 from TomHarte/ActivityReceiver
Introduces infrastructure for sending and receiving 'activity' notifications
2018-05-12 17:45:06 -04:00
Thomas Harte
d0fd4dd4db The MSX is now an activity source.
Completing the set.
2018-05-12 17:32:53 -04:00
Thomas Harte
3ba6b6f1ee Makes the Oric an event source. 2018-05-11 23:05:36 -04:00
Thomas Harte
bc464e247f The 1540 and, by extension, the Vic-20 are now activity sources. 2018-05-11 22:24:33 -04:00
Thomas Harte
c23f6d8d19 Corrects type for array accesses. 2018-05-11 21:46:30 -04:00
Thomas Harte
39d779edf0 Makes CPC an activity source. 2018-05-11 21:45:46 -04:00
Thomas Harte
0cb5362c6f Disambiguates whether Step will occur in addition to below zero/beyond maximum. 2018-05-11 21:44:08 -04:00
Thomas Harte
a43ca0db35 Makes the Apple II an activity source. 2018-05-10 22:17:13 -04:00
Thomas Harte
9089bf6535 Adds step events. 2018-05-10 21:58:14 -04:00
Thomas Harte
ef19a03efc Drives can now deliver activity events. 2018-05-10 21:54:10 -04:00
Thomas Harte
85e1610627 Merge branch 'master' into ActivityReceiver 2018-05-10 20:49:32 -04:00
Thomas Harte
d16ae84d0b Reduces number of Apple II video flushes, to reduce processing cost. 2018-05-10 20:48:57 -04:00
Thomas Harte
95f859cf5c Merge branch 'master' into ActivityReceiver 2018-05-10 20:26:50 -04:00
Thomas Harte
578a5b3e69 Ensures NDEBUG is set for release builds. 2018-05-09 22:27:57 -04:00
Thomas Harte
25f7e3af31 Removes dead debugging aid. What a klutz! 2018-05-09 22:24:20 -04:00
Thomas Harte
86192b18d1 Merge pull request #431 from TomHarte/DiskIIRemap
Shuffles the Disk II ROM at load time into B.A.P. form.
2018-05-09 22:10:29 -04:00
Thomas Harte
c3144382c5 Shuffles the Disk II ROM at load time into B.A.P. form.
Only if required. In order to support various potential forms of supplied ROM.
2018-05-09 22:03:59 -04:00
Thomas Harte
6bb9b7be04 Merge pull request #430 from TomHarte/PravetzPaging
Corrects Pravetz 8DOS startup.
2018-05-09 20:30:34 -04:00
Thomas Harte
8ee34fafa6 Switches default DSK volume to 254. That seems to resolve Pravetz booting issues. 2018-05-09 20:28:58 -04:00
Thomas Harte
312171fa59 Pulls out a couple of repeating constants. 2018-05-09 20:28:25 -04:00
Thomas Harte
a8dbfb0569 Adds direct link to 'releases' tab.
It has been explained to me that people who do not often come to Github are having difficulty finding the releases. This might help.
2018-05-09 10:32:16 -04:00
Thomas Harte
b09b4b4433 Merge pull request #429 from TomHarte/Pravetz
Makes attempt to implement support for the Pravetz 8D + 8DOS.
2018-05-08 22:53:51 -04:00
Thomas Harte
45bd24ada0 Corrects tags for Oric machine selection. 2018-05-08 22:53:27 -04:00
Thomas Harte
c3a2f7717b Makes attempt to implement support for the Pravetz 8D + 8DOS.
i.e. the Disk II wired up to the Oric, with some ROM swaps.
2018-05-08 22:05:43 -04:00
Thomas Harte
70e6c3b2f6 Introduces the ActivityObserver protocol for LEDs, drive events, etc.
The Electron's caps lock LED is the test case.
2018-05-07 21:57:54 -04:00
Thomas Harte
d1b889aa61 Merge pull request #424 from TomHarte/TrackDivision
Makes disk head position explicitly something with sub-integral precision.
2018-05-06 23:19:56 -04:00
Thomas Harte
f65c65569a Makes disk head position explicitly something with sub-integral precision.
Also as a drive-by fix, corrects accidental assumption of 10 sectors for all MFMSectorDump descendants.
2018-05-06 23:17:36 -04:00
Thomas Harte
1139caa83f Merge pull request #423 from TomHarte/LanguageCard
Implements the Apple II language card
2018-05-06 16:18:15 -04:00
Thomas Harte
d613c3c187 Adds an implementation of the language card. 2018-05-06 16:17:11 -04:00
Thomas Harte
36f8b165cf Makes the epilogue test a bit more thorough. 2018-05-05 20:52:42 -04:00
Thomas Harte
d6e8b34942 Ensures media is passed on from the Disk II analyser. 2018-05-05 20:32:47 -04:00
Thomas Harte
4c4ab25d0e Attempts to rationalise Apple II address decoding. 2018-05-05 20:24:03 -04:00
Thomas Harte
9ff34d90f4 Merge pull request #422 from TomHarte/DiskIIAnalyser
Introduces an analyser for Disk II-esque files.
2018-05-05 19:35:24 -04:00
Thomas Harte
9593e0f7fe Updates SContruct file for Disk II analysis. 2018-05-05 19:34:22 -04:00
Thomas Harte
1293d8b69e Corrects various indentation errors. 2018-05-05 19:32:20 -04:00
Thomas Harte
3e0055737e Adds a genuine attempt to discern Pravetz disks from Apple. 2018-05-05 19:32:08 -04:00
Thomas Harte
ba7fbc4032 Reroutes all Disk II types through the Disk II analyser and returns actual sector from the Apple GCR parser results. 2018-05-05 16:37:33 -04:00
Thomas Harte
c36d7b4972 Makes first attempt at 6 and 2 decoder. 2018-05-04 23:11:12 -04:00
Thomas Harte
1c0b5bb02b Corrects phoney switch of 'run' build to release. 2018-05-04 18:04:23 -04:00
Thomas Harte
0dece80b5d Improves documentation. 2018-05-04 18:02:55 -04:00
Thomas Harte
e3b4aebf1a Introduces the Disk II as a unique media target platform.
As it makes a little more sense to analyse Apple GCR images to determine target platform than it does to have the potential platforms vote over them.

Also starts on the parser that'll be necessary for making a decision.
2018-05-04 18:02:36 -04:00
Thomas Harte
2e20191c01 Relocates and cleans up what is currently written of Apple GCR handling as the encoder.
A decoder will be forthcoming.
2018-05-03 22:40:45 -04:00
Thomas Harte
59718e132b Fixes macOS 10.10 warning. 2018-05-03 22:39:34 -04:00
Thomas Harte
4d070fbfe3 Merge pull request #421 from TomHarte/AppleConfiguration
Introduces configuration options for the Apple II.
2018-05-03 19:38:29 -04:00
Thomas Harte
723ee88043 Introduces configuration options for the Apple II.
Specifically: II or II+? Disk II 13- or 16-sector? Or not at all?
2018-05-03 19:37:32 -04:00
Thomas Harte
65ba9ee6e7 Merge pull request #420 from TomHarte/DSKDos33
Corrects handling of Apple II DSK files.
2018-05-02 21:45:56 -04:00
Thomas Harte
fcc750784a Switches interleaving logic around: having inspected some NIBs sectors are numbered in order, but scatter read from the image. 2018-05-02 21:28:18 -04:00
Thomas Harte
3787d094ec Deals with potential precision pitfall. 2018-05-02 21:26:39 -04:00
Thomas Harte
4b4ea4a103 Corrects final two bytes of Apple GCR low nibble encoding. 2018-05-02 21:06:18 -04:00
Thomas Harte
af0cf0d40a Merge pull request #419 from TomHarte/ZXLineCounter
Simplifies the test for resetting the ZX80/81 line counter.
2018-05-01 22:04:39 -04:00
Thomas Harte
eecea93b3b Simplifies the test for resetting the ZX80/81 line counter. 2018-05-01 21:31:37 -04:00
Thomas Harte
ac4948c4b1 Merge pull request #417 from TomHarte/DiskII
Adds attempt at Disk II emulation.
2018-05-01 20:34:40 -04:00
Thomas Harte
5e34c1b6b8 Switches to producing a single segment for NIBs and DSKs.
I've now seemingly verified that the values read back by the CPU are those I'm intending to produce, so I'm at a loss.
2018-05-01 20:31:42 -04:00
Thomas Harte
05e31d7594 Mutates testComplicatedTrackSeek into an actual test.
Which frustratingly passes.
2018-05-01 19:52:12 -04:00
Thomas Harte
f4097290c2 Made various corrections following a quick for-loop constness audit. 2018-04-30 22:23:57 -04:00
Thomas Harte
9da481b060 Slightly simplifies syntax. 2018-04-30 22:08:51 -04:00
Thomas Harte
79002d6962 Adds an additional assert. 2018-04-30 22:07:54 -04:00
Thomas Harte
dbd9282efc Experimentally switches to doubles for TimedEventLoop time tracking. 2018-04-30 22:07:17 -04:00
Thomas Harte
b32538f3c8 Adds an additional test. 2018-04-30 22:05:44 -04:00
Thomas Harte
e7618bb32e Corrects types (/chickens out). 2018-04-30 22:04:05 -04:00
Thomas Harte
aacf26f05d Removed logged comment. 2018-04-30 22:03:09 -04:00
Thomas Harte
265bc80d44 Attempts to introduce sleeping to the Disk II. 2018-04-29 17:52:29 -04:00
Thomas Harte
10c0e687f5 Attempts to introduce sleeping for the Disk II. 2018-04-29 17:51:10 -04:00
Thomas Harte
a9d4fe0b41 Introduces filetype wiring for DO and PO files.
Also corrects sector numbering logic to ensure there is a sector 15.
2018-04-29 16:34:10 -04:00
Thomas Harte
5cd15147eb Introduces interleaving of sector numbers. 2018-04-29 16:18:14 -04:00
Thomas Harte
c62db6665a Corrects storage of lower two bit pairs.
It turns out the non-integral result of 256/3 is handled differently than my guess.
2018-04-29 11:20:23 -04:00
Thomas Harte
fabcb261dc Corrects data prologue usage and off-by-one error in checksum placement. 2018-04-28 23:17:06 -04:00
Thomas Harte
45cf28e0eb Corrects sync lengths. 2018-04-28 15:48:49 -04:00
Thomas Harte
5b35c88be2 Corrections: data segments now correctly announce their number of bits, and tracks aren't oversized. 2018-04-28 15:47:50 -04:00
Thomas Harte
7f03f5d02f Makes a first attempt at six-and-two encoding for DSKs. 2018-04-28 15:18:48 -04:00
Thomas Harte
b98d5b790a Finally unifies disk image file exceptions, and adds a placeholder for Apple DSK. 2018-04-27 23:18:45 -04:00
Thomas Harte
5c74044e62 Unifies constants. 2018-04-27 21:38:08 -04:00
Thomas Harte
992a99d792 Improves validation of suspected sync regions. 2018-04-27 19:53:35 -04:00
Thomas Harte
41075356e2 Makes a first attempt at NIB support. 2018-04-26 22:49:07 -04:00
Thomas Harte
850a394eb5 Corrects graphics 'carry' — the potential holdover into delayed bytes. 2018-04-26 19:26:43 -04:00
Thomas Harte
244721a6f8 Corrects graphics mode address generation. 2018-04-25 22:26:01 -04:00
Thomas Harte
d59db504a3 Adjusted stepper logic; some disks load now. 2018-04-25 21:59:18 -04:00
Thomas Harte
c90e122eb2 Switches casts around to avoid potential undefined behaviour of left-shifting signed numbers. 2018-04-25 19:59:32 -04:00
Thomas Harte
4c6dc597f4 Converts Time::get into a template, introduces a via-a-double fallback for the timed event loop. 2018-04-25 19:54:39 -04:00
Thomas Harte
b4f6dee954 Ensures the contextually-proper boot and state machine ROMs are requested. 2018-04-24 20:25:02 -07:00
Thomas Harte
2685e9087e Changes the default-assigned Disk II card slot from 7 to 6. 2018-04-24 20:24:44 -07:00
Thomas Harte
376b26c1e4 Simplifies the rotational multiplier upon construction, to mitigate against scale issues later. 2018-04-24 20:16:14 -07:00
Thomas Harte
7061537ff5 Makes joined-up attempt to run data through the Disk II. 2018-04-24 19:44:45 -07:00
Thomas Harte
2f2390b5aa Adds F12 as a reset key, triggers cards upon a flush. 2018-04-24 09:03:30 -07:00
Thomas Harte
99de8f1c5c Inverts the pulse strobe. 2018-04-24 09:03:03 -07:00
Thomas Harte
af61bbc3e2 Attempts actual performance of the state machine. 2018-04-24 08:29:05 -07:00
Thomas Harte
56d88f23ef Teeters closer and closer to trying actually to run the Disk II state machine. 2018-04-23 22:29:36 -07:00
Thomas Harte
4bff44377a Attempts to route Disk II requests to the thing itself. 2018-04-23 22:11:31 -07:00
Thomas Harte
7463edaa1b Attempts to bring card support to the Apple II, and adds a 'has disk' flag. 2018-04-23 21:14:45 -07:00
Thomas Harte
e92e06a5f4 Doubled down on the ROMMachine::ROMFetcher typedef. 2018-04-23 20:20:14 -07:00
Thomas Harte
4cbe5068a9 Works further towards NIB, but still isn't close. 2018-04-23 20:01:12 -07:00
Thomas Harte
38b2302b59 Corrects minor documentation errors. 2018-04-23 19:59:19 -07:00
Thomas Harte
bce0702745 Makes some faulty steps further towards providing Apple GCR assistance. 2018-04-23 19:59:03 -07:00
Thomas Harte
d447e81abd Adds provisional support for WOZ files. 2018-04-23 19:57:45 -07:00
Thomas Harte
6592745e53 Adds the bare minimum to respond to attempts to open NIB files with an Apple II. 2018-04-21 21:21:57 -07:00
Thomas Harte
e87a3cffd4 Merge branch 'master' into DiskII 2018-04-21 15:02:18 -07:00
Thomas Harte
fa0b6e8a08 Merge pull request #416 from TomHarte/AppleAudio
Corrects Apple II output audio.
2018-04-21 18:01:59 -04:00
Thomas Harte
074b4c3500 Eliminates repeating cause of misuse.
Raises the question as to whether an async task queue should be required at construction; let's see how things look as the project develops.
2018-04-21 15:01:18 -07:00
Thomas Harte
5968c9a391 Corrects Apple II output audio. 2018-04-21 14:56:50 -07:00
Thomas Harte
72bc5f8d7b Adds a class to contain the Disk II and begins Apple GCR conversion routines. 2018-04-21 14:33:42 -07:00
Thomas Harte
0a0d81cd5a Merge pull request #415 from TomHarte/SconsOmissions
Updates SConstruct file to include the Apple II.
2018-04-20 11:00:00 -04:00
Thomas Harte
75e9c3678b Adds the missing Apple II static analyser. 2018-04-20 10:58:57 -04:00
Thomas Harte
aebe8a64a2 Removes empty printf. 2018-04-20 10:58:23 -04:00
Thomas Harte
1aacf437b5 Adds omitted paths to SConstruct. 2018-04-20 10:56:59 -04:00
Thomas Harte
7e8e3fdd39 Merge pull request #414 from TomHarte/AppleII
Adds provisional Apple II emulation
2018-04-19 22:31:02 -04:00
Thomas Harte
b8ae283049 Implements correct text inverse/flashing. 2018-04-19 22:14:22 -04:00
Thomas Harte
6621e54952 Shortens the name for the Electron tab, owing to limited space. 2018-04-19 20:54:16 -04:00
Thomas Harte
e03a403a51 Adds exposition. 2018-04-19 20:41:09 -04:00
Thomas Harte
ba43b3e6b8 Reverses bit order of graphics stream; apparently the ROM is backwards. 2018-04-19 20:39:38 -04:00
Thomas Harte
b4a2d1395c Ensures left and right cursor keys work. 2018-04-18 22:23:31 -04:00
Thomas Harte
f5ae8d0f79 Attempts to be more rigorous about clock rates. 2018-04-18 21:52:22 -04:00
Thomas Harte
5f1c210746 Simplifies and corrects low-resolution colour generation.
Possibly disproving the premise for this whole experiment, all colours seem immediately to work correctly. Hmmm.
2018-04-18 21:41:11 -04:00
Thomas Harte
f6c2f6e896 Slightly adjusts colour burst logic to fix transition lines in mixed mode. 2018-04-18 20:39:12 -04:00
Thomas Harte
6547560e52 Gives the CRT the ability to move iCoordinate multiplication outside of the fragment loop.
That resolves precision issues, as were plaguing the Apple II.
2018-04-18 19:29:03 -04:00
Thomas Harte
a167e3849b Allows multiple ROMs to be inserted into the Electron. 2018-04-18 18:13:30 -04:00
Thomas Harte
f22c23cb4c Attempts to bring audio to the Apple II.
By factoring the audio toggle out from the MSX.
2018-04-17 22:28:13 -04:00
Thomas Harte
a07c99d778 Completes first draft of Apple II video hardware. 2018-04-17 22:04:02 -04:00
Thomas Harte
1c605d58e3 Removes the CRT requirement for an integral relationship between cycles and samples. 2018-04-16 20:00:56 -04:00
Thomas Harte
6a79ce9eb1 Adds enough to the Apple II's video that I can see what's going on with soft switches. 2018-04-15 21:55:26 -04:00
Thomas Harte
465c38f03c Extends the keyboard protocol and adds keyboard input to the Apple II. 2018-04-15 21:11:30 -04:00
Thomas Harte
be05d51e07 Now gives something a lot like the proper character output. 2018-04-15 20:31:04 -04:00
Thomas Harte
9bc470027e Put enough in place to get a visual representation of video memory.
Not the correct one, and so as to indicate that the machine isn't booting, surprisingly.
2018-04-15 19:35:08 -04:00
Thomas Harte
335c633884 Retrenches temporarily to full 8bpp output; introduces extra half a colour cycle of pause. 2018-04-15 18:54:05 -04:00
Thomas Harte
cd26f11818 Fixes documentation misstatement. 2018-04-15 18:00:51 -04:00
Thomas Harte
abe47b6ed8 Makes first attempt at a stable display area. Not entirely successful. 2018-04-15 18:00:40 -04:00
Thomas Harte
61659faeaa Adds the necessary call-outs to allow implementation of video generation. 2018-04-15 15:13:07 -04:00
Thomas Harte
71adb964e5 The Apple II now has a functioning processor, ROM and RAM. 2018-04-14 21:41:26 -04:00
Thomas Harte
e599e65087 Switches to use of the TargetList typedef wherever possible. 2018-04-14 19:46:38 -04:00
Thomas Harte
7efee9b52b Does the bare minimum to create a class skeleton for Apple II implementation. 2018-04-14 19:46:15 -04:00
Thomas Harte
079dc671e1 Rationalises per-machine static analyser call pattern, and adds Apple II as an option. 2018-04-14 12:12:12 -04:00
671 changed files with 104100 additions and 10730 deletions

6
.editorconfig Normal file
View File

@@ -0,0 +1,6 @@
[*]
charset = utf-8
indent_style = tab
indent_size = 4
trim_trailing_whitespace = true

22
.github/workflows/ccpp.yml vendored Normal file
View File

@@ -0,0 +1,22 @@
name: SDL/Ubuntu
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Install dependencies
run: sudo apt-get --allow-releaseinfo-change update; sudo apt-get install libsdl2-dev scons
- name: Make
run: cd OSBindings/SDL; scons

View File

@@ -1,13 +0,0 @@
# language: objective-c
# osx_image: xcode8.2
# xcode_project: OSBindings/Mac/Clock Signal.xcodeproj
# xcode_scheme: Clock Signal
# xcode_sdk: macosx10.12
language: cpp
before_install:
- sudo apt-get install libsdl2-dev
script: cd OSBindings/SDL && scons
compiler:
- clang
- gcc

50
Activity/Observer.hpp Normal file
View File

@@ -0,0 +1,50 @@
//
// ActivityObserver.h
// Clock Signal
//
// Created by Thomas Harte on 07/05/2018.
// Copyright 2018 Thomas Harte. All rights reserved.
//
#ifndef ActivityObserver_h
#define ActivityObserver_h
#include <string>
namespace Activity {
/*!
Provides a purely virtual base class for anybody that wants to receive notifications of
'activity': any feedback from an emulated system which a user could perceive other than
through the machine's native audio and video outputs.
So: status LEDs, drive activity, etc. A receiver may choose to make appropriate noises
and/or to show or unshow status indicators.
*/
class Observer {
public:
/// Announces to the receiver that there is an LED of name @c name.
virtual void register_led(const std::string &name) {}
/// Announces to the receiver that there is a drive of name @c name.
virtual void register_drive(const std::string &name) {}
/// Informs the receiver of the new state of the LED with name @c name.
virtual void set_led_status(const std::string &name, bool lit) {}
enum class DriveEvent {
StepNormal,
StepBelowZero,
StepBeyondMaximum
};
/// Informs the receiver that the named event just occurred for the drive with name @c name.
virtual void announce_drive_event(const std::string &name, DriveEvent event) {}
/// Informs the receiver of the motor-on status of the drive with name @c name.
virtual void set_drive_motor_status(const std::string &name, bool is_on) {}
};
}
#endif /* ActivityObserver_h */

24
Activity/Source.hpp Normal file
View File

@@ -0,0 +1,24 @@
//
// ActivitySource.h
// Clock Signal
//
// Created by Thomas Harte on 07/05/2018.
// Copyright 2018 Thomas Harte. All rights reserved.
//
#ifndef ActivitySource_h
#define ActivitySource_h
#include "Observer.hpp"
namespace Activity {
class Source {
public:
virtual void set_activity_observer(Observer *observer) = 0;
};
}
#endif /* ActivitySource_h */

View File

@@ -3,7 +3,7 @@
// Clock Signal // Clock Signal
// //
// Created by Thomas Harte on 21/01/2018. // Created by Thomas Harte on 21/01/2018.
// Copyright © 2018 Thomas Harte. All rights reserved. // Copyright 2018 Thomas Harte. All rights reserved.
// //
#include "ConfidenceCounter.hpp" #include "ConfidenceCounter.hpp"

View File

@@ -3,7 +3,7 @@
// Clock Signal // Clock Signal
// //
// Created by Thomas Harte on 21/01/2018. // Created by Thomas Harte on 21/01/2018.
// Copyright © 2018 Thomas Harte. All rights reserved. // Copyright 2018 Thomas Harte. All rights reserved.
// //
#ifndef ConfidenceCounter_hpp #ifndef ConfidenceCounter_hpp
@@ -24,10 +24,10 @@ class ConfidenceCounter: public ConfidenceSource {
/*! @returns The computed probability, based on the history of events. */ /*! @returns The computed probability, based on the history of events. */
float get_confidence() override; float get_confidence() override;
/*! Records an event that implies this is the appropriate class pushes probability up towards 1.0. */ /*! Records an event that implies this is the appropriate class: pushes probability up towards 1.0. */
void add_hit(); void add_hit();
/*! Records an event that implies this is not the appropriate class pushes probability down towards 0.0. */ /*! Records an event that implies this is not the appropriate class: pushes probability down towards 0.0. */
void add_miss(); void add_miss();
/*! /*!

View File

@@ -3,7 +3,7 @@
// Clock Signal // Clock Signal
// //
// Created by Thomas Harte on 21/01/2018. // Created by Thomas Harte on 21/01/2018.
// Copyright © 2018 Thomas Harte. All rights reserved. // Copyright 2018 Thomas Harte. All rights reserved.
// //
#ifndef ConfidenceSource_hpp #ifndef ConfidenceSource_hpp

View File

@@ -3,7 +3,7 @@
// Clock Signal // Clock Signal
// //
// Created by Thomas Harte on 21/01/2018. // Created by Thomas Harte on 21/01/2018.
// Copyright © 2018 Thomas Harte. All rights reserved. // Copyright 2018 Thomas Harte. All rights reserved.
// //
#include "ConfidenceSummary.hpp" #include "ConfidenceSummary.hpp"

View File

@@ -3,7 +3,7 @@
// Clock Signal // Clock Signal
// //
// Created by Thomas Harte on 21/01/2018. // Created by Thomas Harte on 21/01/2018.
// Copyright © 2018 Thomas Harte. All rights reserved. // Copyright 2018 Thomas Harte. All rights reserved.
// //
#ifndef ConfidenceSummary_hpp #ifndef ConfidenceSummary_hpp

View File

@@ -3,7 +3,7 @@
// Clock Signal // Clock Signal
// //
// Created by Thomas Harte on 29/01/2018. // Created by Thomas Harte on 29/01/2018.
// Copyright © 2018 Thomas Harte. All rights reserved. // Copyright 2018 Thomas Harte. All rights reserved.
// //
#include "MultiCRTMachine.hpp" #include "MultiCRTMachine.hpp"
@@ -13,7 +13,7 @@
using namespace Analyser::Dynamic; using namespace Analyser::Dynamic;
MultiCRTMachine::MultiCRTMachine(const std::vector<std::unique_ptr<::Machine::DynamicMachine>> &machines, std::mutex &machines_mutex) : MultiCRTMachine::MultiCRTMachine(const std::vector<std::unique_ptr<::Machine::DynamicMachine>> &machines, std::recursive_mutex &machines_mutex) :
machines_(machines), machines_mutex_(machines_mutex), queues_(machines.size()) { machines_(machines), machines_mutex_(machines_mutex), queues_(machines.size()) {
speaker_ = MultiSpeaker::create(machines); speaker_ = MultiSpeaker::create(machines);
} }
@@ -25,7 +25,7 @@ void MultiCRTMachine::perform_parallel(const std::function<void(::CRTMachine::Ma
std::condition_variable condition; std::condition_variable condition;
std::mutex mutex; std::mutex mutex;
{ {
std::lock_guard<std::mutex> machines_lock(machines_mutex_); std::lock_guard<decltype(machines_mutex_)> machines_lock(machines_mutex_);
std::lock_guard<std::mutex> lock(mutex); std::lock_guard<std::mutex> lock(mutex);
outstanding_machines = machines_.size(); outstanding_machines = machines_.size();
@@ -46,29 +46,18 @@ void MultiCRTMachine::perform_parallel(const std::function<void(::CRTMachine::Ma
} }
void MultiCRTMachine::perform_serial(const std::function<void (::CRTMachine::Machine *)> &function) { void MultiCRTMachine::perform_serial(const std::function<void (::CRTMachine::Machine *)> &function) {
std::lock_guard<std::mutex> machines_lock(machines_mutex_); std::lock_guard<decltype(machines_mutex_)> machines_lock(machines_mutex_);
for(const auto &machine: machines_) { for(const auto &machine: machines_) {
CRTMachine::Machine *crt_machine = machine->crt_machine(); CRTMachine::Machine *const crt_machine = machine->crt_machine();
if(crt_machine) function(crt_machine); if(crt_machine) function(crt_machine);
} }
} }
void MultiCRTMachine::setup_output(float aspect_ratio) { void MultiCRTMachine::set_scan_target(Outputs::Display::ScanTarget *scan_target) {
perform_serial([=](::CRTMachine::Machine *machine) { scan_target_ = scan_target;
machine->setup_output(aspect_ratio);
});
}
void MultiCRTMachine::close_output() { CRTMachine::Machine *const crt_machine = machines_.front()->crt_machine();
perform_serial([=](::CRTMachine::Machine *machine) { if(crt_machine) crt_machine->set_scan_target(scan_target);
machine->close_output();
});
}
Outputs::CRT::CRT *MultiCRTMachine::get_crt() {
std::lock_guard<std::mutex> machines_lock(machines_mutex_);
CRTMachine::Machine *crt_machine = machines_.front()->crt_machine();
return crt_machine ? crt_machine->get_crt() : nullptr;
} }
Outputs::Speaker::Speaker *MultiCRTMachine::get_speaker() { Outputs::Speaker::Speaker *MultiCRTMachine::get_speaker() {
@@ -84,6 +73,14 @@ void MultiCRTMachine::run_for(Time::Seconds duration) {
} }
void MultiCRTMachine::did_change_machine_order() { void MultiCRTMachine::did_change_machine_order() {
if(scan_target_) scan_target_->will_change_owner();
perform_serial([=](::CRTMachine::Machine *machine) {
machine->set_scan_target(nullptr);
});
CRTMachine::Machine *const crt_machine = machines_.front()->crt_machine();
if(crt_machine) crt_machine->set_scan_target(scan_target_);
if(speaker_) { if(speaker_) {
speaker_->set_new_front_machine(machines_.front().get()); speaker_->set_new_front_machine(machines_.front().get());
} }

View File

@@ -3,7 +3,7 @@
// Clock Signal // Clock Signal
// //
// Created by Thomas Harte on 29/01/2018. // Created by Thomas Harte on 29/01/2018.
// Copyright © 2018 Thomas Harte. All rights reserved. // Copyright 2018 Thomas Harte. All rights reserved.
// //
#ifndef MultiCRTMachine_hpp #ifndef MultiCRTMachine_hpp
@@ -31,7 +31,7 @@ namespace Dynamic {
*/ */
class MultiCRTMachine: public CRTMachine::Machine { class MultiCRTMachine: public CRTMachine::Machine {
public: public:
MultiCRTMachine(const std::vector<std::unique_ptr<::Machine::DynamicMachine>> &machines, std::mutex &machines_mutex); MultiCRTMachine(const std::vector<std::unique_ptr<::Machine::DynamicMachine>> &machines, std::recursive_mutex &machines_mutex);
/*! /*!
Informs the MultiCRTMachine that the order of machines has changed; the MultiCRTMachine Informs the MultiCRTMachine that the order of machines has changed; the MultiCRTMachine
@@ -53,19 +53,18 @@ class MultiCRTMachine: public CRTMachine::Machine {
} }
// Below is the standard CRTMachine::Machine interface; see there for documentation. // Below is the standard CRTMachine::Machine interface; see there for documentation.
void setup_output(float aspect_ratio) override; void set_scan_target(Outputs::Display::ScanTarget *scan_target) override;
void close_output() override;
Outputs::CRT::CRT *get_crt() override;
Outputs::Speaker::Speaker *get_speaker() override; Outputs::Speaker::Speaker *get_speaker() override;
void run_for(Time::Seconds duration) override; void run_for(Time::Seconds duration) override;
private: private:
void run_for(const Cycles cycles) override {} void run_for(const Cycles cycles) override {}
const std::vector<std::unique_ptr<::Machine::DynamicMachine>> &machines_; const std::vector<std::unique_ptr<::Machine::DynamicMachine>> &machines_;
std::mutex &machines_mutex_; std::recursive_mutex &machines_mutex_;
std::vector<Concurrency::AsyncTaskQueue> queues_; std::vector<Concurrency::AsyncTaskQueue> queues_;
MultiSpeaker *speaker_ = nullptr; MultiSpeaker *speaker_ = nullptr;
Delegate *delegate_ = nullptr; Delegate *delegate_ = nullptr;
Outputs::Display::ScanTarget *scan_target_ = nullptr;
/*! /*!
Performs a parallel for operation across all machines, performing the supplied Performs a parallel for operation across all machines, performing the supplied

View File

@@ -3,7 +3,7 @@
// Clock Signal // Clock Signal
// //
// Created by Thomas Harte on 09/02/2018. // Created by Thomas Harte on 09/02/2018.
// Copyright © 2018 Thomas Harte. All rights reserved. // Copyright 2018 Thomas Harte. All rights reserved.
// //
#include "MultiConfigurable.hpp" #include "MultiConfigurable.hpp"
@@ -16,7 +16,7 @@ MultiConfigurable::MultiConfigurable(const std::vector<std::unique_ptr<::Machine
for(const auto &machine: machines) { for(const auto &machine: machines) {
Configurable::Device *device = machine->configurable_device(); Configurable::Device *device = machine->configurable_device();
if(device) devices_.push_back(device); if(device) devices_.push_back(device);
} }
} }
std::vector<std::unique_ptr<Configurable::Option>> MultiConfigurable::get_options() { std::vector<std::unique_ptr<Configurable::Option>> MultiConfigurable::get_options() {

View File

@@ -3,7 +3,7 @@
// Clock Signal // Clock Signal
// //
// Created by Thomas Harte on 09/02/2018. // Created by Thomas Harte on 09/02/2018.
// Copyright © 2018 Thomas Harte. All rights reserved. // Copyright 2018 Thomas Harte. All rights reserved.
// //
#ifndef MultiConfigurable_hpp #ifndef MultiConfigurable_hpp

View File

@@ -1,29 +0,0 @@
//
// MultiConfigurationTarget.cpp
// Clock Signal
//
// Created by Thomas Harte on 29/01/2018.
// Copyright © 2018 Thomas Harte. All rights reserved.
//
#include "MultiConfigurationTarget.hpp"
using namespace Analyser::Dynamic;
MultiConfigurationTarget::MultiConfigurationTarget(const std::vector<std::unique_ptr<::Machine::DynamicMachine>> &machines) {
for(const auto &machine: machines) {
ConfigurationTarget::Machine *configuration_target = machine->configuration_target();
if(configuration_target) targets_.push_back(configuration_target);
}
}
void MultiConfigurationTarget::configure_as_target(const Analyser::Static::Target *target) {
}
bool MultiConfigurationTarget::insert_media(const Analyser::Static::Media &media) {
bool inserted = false;
for(const auto &target : targets_) {
inserted |= target->insert_media(media);
}
return inserted;
}

View File

@@ -1,42 +0,0 @@
//
// MultiConfigurationTarget.hpp
// Clock Signal
//
// Created by Thomas Harte on 29/01/2018.
// Copyright © 2018 Thomas Harte. All rights reserved.
//
#ifndef MultiConfigurationTarget_hpp
#define MultiConfigurationTarget_hpp
#include "../../../../Machines/ConfigurationTarget.hpp"
#include "../../../../Machines/DynamicMachine.hpp"
#include <memory>
#include <vector>
namespace Analyser {
namespace Dynamic {
/*!
Provides a class that multiplexes the configuration target interface to multiple machines.
Makes a static internal copy of the list of machines; makes no guarantees about the
order of delivered messages.
*/
struct MultiConfigurationTarget: public ConfigurationTarget::Machine {
public:
MultiConfigurationTarget(const std::vector<std::unique_ptr<::Machine::DynamicMachine>> &machines);
// Below is the standard ConfigurationTarget::Machine interface; see there for documentation.
void configure_as_target(const Analyser::Static::Target *target) override;
bool insert_media(const Analyser::Static::Media &media) override;
private:
std::vector<ConfigurationTarget::Machine *> targets_;
};
}
}
#endif /* MultiConfigurationTarget_hpp */

View File

@@ -3,7 +3,7 @@
// Clock Signal // Clock Signal
// //
// Created by Thomas Harte on 09/02/2018. // Created by Thomas Harte on 09/02/2018.
// Copyright © 2018 Thomas Harte. All rights reserved. // Copyright 2018 Thomas Harte. All rights reserved.
// //
#include "MultiJoystickMachine.hpp" #include "MultiJoystickMachine.hpp"
@@ -25,14 +25,14 @@ class MultiJoystick: public Inputs::Joystick {
} }
} }
std::vector<DigitalInput> get_inputs() override { std::vector<Input> &get_inputs() override {
std::vector<DigitalInput> inputs; if(inputs.empty()) {
for(const auto &joystick: joysticks_) {
for(const auto &joystick: joysticks_) { std::vector<Input> joystick_inputs = joystick->get_inputs();
std::vector<DigitalInput> joystick_inputs = joystick->get_inputs(); for(const auto &input: joystick_inputs) {
for(const auto &input: joystick_inputs) { if(std::find(inputs.begin(), inputs.end(), input) != inputs.end()) {
if(std::find(inputs.begin(), inputs.end(), input) != inputs.end()) { inputs.push_back(input);
inputs.push_back(input); }
} }
} }
} }
@@ -40,11 +40,18 @@ class MultiJoystick: public Inputs::Joystick {
return inputs; return inputs;
} }
void set_digital_input(const DigitalInput &digital_input, bool is_active) override { void set_input(const Input &digital_input, bool is_active) override {
for(const auto &joystick: joysticks_) { for(const auto &joystick: joysticks_) {
joystick->set_digital_input(digital_input, is_active); joystick->set_input(digital_input, is_active);
} }
} }
void set_input(const Input &digital_input, float value) override {
for(const auto &joystick: joysticks_) {
joystick->set_input(digital_input, value);
}
}
void reset_all_inputs() override { void reset_all_inputs() override {
for(const auto &joystick: joysticks_) { for(const auto &joystick: joysticks_) {
joystick->reset_all_inputs(); joystick->reset_all_inputs();
@@ -52,6 +59,7 @@ class MultiJoystick: public Inputs::Joystick {
} }
private: private:
std::vector<Input> inputs;
std::vector<Inputs::Joystick *> joysticks_; std::vector<Inputs::Joystick *> joysticks_;
}; };
@@ -66,13 +74,13 @@ MultiJoystickMachine::MultiJoystickMachine(const std::vector<std::unique_ptr<::M
joystick_machines.push_back(joystick_machine); joystick_machines.push_back(joystick_machine);
total_joysticks = std::max(total_joysticks, joystick_machine->get_joysticks().size()); total_joysticks = std::max(total_joysticks, joystick_machine->get_joysticks().size());
} }
} }
for(std::size_t index = 0; index < total_joysticks; ++index) { for(std::size_t index = 0; index < total_joysticks; ++index) {
joysticks_.emplace_back(new MultiJoystick(joystick_machines, index)); joysticks_.emplace_back(new MultiJoystick(joystick_machines, index));
} }
} }
std::vector<std::unique_ptr<Inputs::Joystick>> &MultiJoystickMachine::get_joysticks() { const std::vector<std::unique_ptr<Inputs::Joystick>> &MultiJoystickMachine::get_joysticks() {
return joysticks_; return joysticks_;
} }

View File

@@ -3,7 +3,7 @@
// Clock Signal // Clock Signal
// //
// Created by Thomas Harte on 09/02/2018. // Created by Thomas Harte on 09/02/2018.
// Copyright © 2018 Thomas Harte. All rights reserved. // Copyright 2018 Thomas Harte. All rights reserved.
// //
#ifndef MultiJoystickMachine_hpp #ifndef MultiJoystickMachine_hpp
@@ -28,7 +28,7 @@ class MultiJoystickMachine: public JoystickMachine::Machine {
MultiJoystickMachine(const std::vector<std::unique_ptr<::Machine::DynamicMachine>> &machines); MultiJoystickMachine(const std::vector<std::unique_ptr<::Machine::DynamicMachine>> &machines);
// Below is the standard JoystickMachine::Machine interface; see there for documentation. // Below is the standard JoystickMachine::Machine interface; see there for documentation.
std::vector<std::unique_ptr<Inputs::Joystick>> &get_joysticks() override; const std::vector<std::unique_ptr<Inputs::Joystick>> &get_joysticks() override;
private: private:
std::vector<std::unique_ptr<Inputs::Joystick>> joysticks_; std::vector<std::unique_ptr<Inputs::Joystick>> joysticks_;

View File

@@ -3,41 +3,67 @@
// Clock Signal // Clock Signal
// //
// Created by Thomas Harte on 09/02/2018. // Created by Thomas Harte on 09/02/2018.
// Copyright © 2018 Thomas Harte. All rights reserved. // Copyright 2018 Thomas Harte. All rights reserved.
// //
#include "MultiKeyboardMachine.hpp" #include "MultiKeyboardMachine.hpp"
using namespace Analyser::Dynamic; using namespace Analyser::Dynamic;
MultiKeyboardMachine::MultiKeyboardMachine(const std::vector<std::unique_ptr<::Machine::DynamicMachine>> &machines) { MultiKeyboardMachine::MultiKeyboardMachine(const std::vector<std::unique_ptr<::Machine::DynamicMachine>> &machines) :
keyboard_(machines_) {
for(const auto &machine: machines) { for(const auto &machine: machines) {
KeyboardMachine::Machine *keyboard_machine = machine->keyboard_machine(); KeyboardMachine::Machine *keyboard_machine = machine->keyboard_machine();
if(keyboard_machine) machines_.push_back(keyboard_machine); if(keyboard_machine) machines_.push_back(keyboard_machine);
} }
} }
void MultiKeyboardMachine::clear_all_keys() { void MultiKeyboardMachine::clear_all_keys() {
for(const auto &machine: machines_) { for(const auto &machine: machines_) {
machine->clear_all_keys(); machine->clear_all_keys();
} }
} }
void MultiKeyboardMachine::set_key_state(uint16_t key, bool is_pressed) { void MultiKeyboardMachine::set_key_state(uint16_t key, bool is_pressed) {
for(const auto &machine: machines_) { for(const auto &machine: machines_) {
machine->set_key_state(key, is_pressed); machine->set_key_state(key, is_pressed);
} }
} }
void MultiKeyboardMachine::type_string(const std::string &string) { void MultiKeyboardMachine::type_string(const std::string &string) {
for(const auto &machine: machines_) { for(const auto &machine: machines_) {
machine->type_string(string); machine->type_string(string);
} }
} }
void MultiKeyboardMachine::keyboard_did_change_key(Inputs::Keyboard *keyboard, Inputs::Keyboard::Key key, bool is_pressed) { Inputs::Keyboard &MultiKeyboardMachine::get_keyboard() {
for(const auto &machine: machines_) { return keyboard_;
uint16_t mapped_key = machine->get_keyboard_mapper()->mapped_key_for_key(key); }
if(mapped_key != KeyNotMapped) machine->set_key_state(mapped_key, is_pressed);
} MultiKeyboardMachine::MultiKeyboard::MultiKeyboard(const std::vector<::KeyboardMachine::Machine *> &machines)
: machines_(machines) {
for(const auto &machine: machines_) {
observed_keys_.insert(machine->get_keyboard().observed_keys().begin(), machine->get_keyboard().observed_keys().end());
is_exclusive_ |= machine->get_keyboard().is_exclusive();
}
}
void MultiKeyboardMachine::MultiKeyboard::set_key_pressed(Key key, char value, bool is_pressed) {
for(const auto &machine: machines_) {
machine->get_keyboard().set_key_pressed(key, value, is_pressed);
}
}
void MultiKeyboardMachine::MultiKeyboard::reset_all_keys() {
for(const auto &machine: machines_) {
machine->get_keyboard().reset_all_keys();
}
}
const std::set<Inputs::Keyboard::Key> &MultiKeyboardMachine::MultiKeyboard::observed_keys() {
return observed_keys_;
}
bool MultiKeyboardMachine::MultiKeyboard::is_exclusive() {
return is_exclusive_;
} }

View File

@@ -3,7 +3,7 @@
// Clock Signal // Clock Signal
// //
// Created by Thomas Harte on 09/02/2018. // Created by Thomas Harte on 09/02/2018.
// Copyright © 2018 Thomas Harte. All rights reserved. // Copyright 2018 Thomas Harte. All rights reserved.
// //
#ifndef MultiKeyboardMachine_hpp #ifndef MultiKeyboardMachine_hpp
@@ -25,6 +25,25 @@ namespace Dynamic {
order of delivered messages. order of delivered messages.
*/ */
class MultiKeyboardMachine: public KeyboardMachine::Machine { class MultiKeyboardMachine: public KeyboardMachine::Machine {
private:
std::vector<::KeyboardMachine::Machine *> machines_;
class MultiKeyboard: public Inputs::Keyboard {
public:
MultiKeyboard(const std::vector<::KeyboardMachine::Machine *> &machines);
void set_key_pressed(Key key, char value, bool is_pressed) override;
void reset_all_keys() override;
const std::set<Key> &observed_keys() override;
bool is_exclusive() override;
private:
const std::vector<::KeyboardMachine::Machine *> &machines_;
std::set<Key> observed_keys_;
bool is_exclusive_ = false;
};
MultiKeyboard keyboard_;
public: public:
MultiKeyboardMachine(const std::vector<std::unique_ptr<::Machine::DynamicMachine>> &machines); MultiKeyboardMachine(const std::vector<std::unique_ptr<::Machine::DynamicMachine>> &machines);
@@ -32,10 +51,7 @@ class MultiKeyboardMachine: public KeyboardMachine::Machine {
void clear_all_keys() override; void clear_all_keys() override;
void set_key_state(uint16_t key, bool is_pressed) override; void set_key_state(uint16_t key, bool is_pressed) override;
void type_string(const std::string &) override; void type_string(const std::string &) override;
void keyboard_did_change_key(Inputs::Keyboard *keyboard, Inputs::Keyboard::Key key, bool is_pressed) override; Inputs::Keyboard &get_keyboard() override;
private:
std::vector<::KeyboardMachine::Machine *> machines_;
}; };
} }

View File

@@ -0,0 +1,26 @@
//
// MultiMediaTarget.cpp
// Clock Signal
//
// Created by Thomas Harte on 29/01/2018.
// Copyright 2018 Thomas Harte. All rights reserved.
//
#include "MultiMediaTarget.hpp"
using namespace Analyser::Dynamic;
MultiMediaTarget::MultiMediaTarget(const std::vector<std::unique_ptr<::Machine::DynamicMachine>> &machines) {
for(const auto &machine: machines) {
MediaTarget::Machine *media_target = machine->media_target();
if(media_target) targets_.push_back(media_target);
}
}
bool MultiMediaTarget::insert_media(const Analyser::Static::Media &media) {
bool inserted = false;
for(const auto &target : targets_) {
inserted |= target->insert_media(media);
}
return inserted;
}

View File

@@ -0,0 +1,41 @@
//
// MultiMediaTarget.hpp
// Clock Signal
//
// Created by Thomas Harte on 29/01/2018.
// Copyright 2018 Thomas Harte. All rights reserved.
//
#ifndef MultiMediaTarget_hpp
#define MultiMediaTarget_hpp
#include "../../../../Machines/MediaTarget.hpp"
#include "../../../../Machines/DynamicMachine.hpp"
#include <memory>
#include <vector>
namespace Analyser {
namespace Dynamic {
/*!
Provides a class that multiplexes the media target interface to multiple machines.
Makes a static internal copy of the list of machines; makes no guarantees about the
order of delivered messages.
*/
struct MultiMediaTarget: public MediaTarget::Machine {
public:
MultiMediaTarget(const std::vector<std::unique_ptr<::Machine::DynamicMachine>> &machines);
// Below is the standard MediaTarget::Machine interface; see there for documentation.
bool insert_media(const Analyser::Static::Media &media) override;
private:
std::vector<MediaTarget::Machine *> targets_;
};
}
}
#endif /* MultiMediaTarget_hpp */

View File

@@ -3,7 +3,7 @@
// Clock Signal // Clock Signal
// //
// Created by Thomas Harte on 18/02/2018. // Created by Thomas Harte on 18/02/2018.
// Copyright © 2018 Thomas Harte. All rights reserved. // Copyright 2018 Thomas Harte. All rights reserved.
// //
#include "MultiSpeaker.hpp" #include "MultiSpeaker.hpp"

View File

@@ -3,7 +3,7 @@
// Clock Signal // Clock Signal
// //
// Created by Thomas Harte on 18/02/2018. // Created by Thomas Harte on 18/02/2018.
// Copyright © 2018 Thomas Harte. All rights reserved. // Copyright 2018 Thomas Harte. All rights reserved.
// //
#ifndef MultiSpeaker_hpp #ifndef MultiSpeaker_hpp

View File

@@ -3,10 +3,11 @@
// Clock Signal // Clock Signal
// //
// Created by Thomas Harte on 28/01/2018. // Created by Thomas Harte on 28/01/2018.
// Copyright © 2018 Thomas Harte. All rights reserved. // Copyright 2018 Thomas Harte. All rights reserved.
// //
#include "MultiMachine.hpp" #include "MultiMachine.hpp"
#include "../../../Outputs/Log.hpp"
#include <algorithm> #include <algorithm>
@@ -15,18 +16,22 @@ using namespace Analyser::Dynamic;
MultiMachine::MultiMachine(std::vector<std::unique_ptr<DynamicMachine>> &&machines) : MultiMachine::MultiMachine(std::vector<std::unique_ptr<DynamicMachine>> &&machines) :
machines_(std::move(machines)), machines_(std::move(machines)),
configurable_(machines_), configurable_(machines_),
configuration_target_(machines_),
crt_machine_(machines_, machines_mutex_), crt_machine_(machines_, machines_mutex_),
joystick_machine_(machines), joystick_machine_(machines),
keyboard_machine_(machines_) { keyboard_machine_(machines_),
media_target_(machines_) {
crt_machine_.set_delegate(this); crt_machine_.set_delegate(this);
} }
ConfigurationTarget::Machine *MultiMachine::configuration_target() { Activity::Source *MultiMachine::activity_source() {
return nullptr; // TODO
}
MediaTarget::Machine *MultiMachine::media_target() {
if(has_picked_) { if(has_picked_) {
return machines_.front()->configuration_target(); return machines_.front()->media_target();
} else { } else {
return &configuration_target_; return &media_target_;
} }
} }
@@ -54,6 +59,11 @@ KeyboardMachine::Machine *MultiMachine::keyboard_machine() {
} }
} }
MouseMachine::Machine *MultiMachine::mouse_machine() {
// TODO.
return nullptr;
}
Configurable::Device *MultiMachine::configurable_device() { Configurable::Device *MultiMachine::configurable_device() {
if(has_picked_) { if(has_picked_) {
return machines_.front()->configurable_device(); return machines_.front()->configurable_device();
@@ -69,24 +79,22 @@ bool MultiMachine::would_collapse(const std::vector<std::unique_ptr<DynamicMachi
} }
void MultiMachine::multi_crt_did_run_machines() { void MultiMachine::multi_crt_did_run_machines() {
std::lock_guard<std::mutex> machines_lock(machines_mutex_); std::lock_guard<decltype(machines_mutex_)> machines_lock(machines_mutex_);
#ifdef DEBUG #ifndef NDEBUG
for(const auto &machine: machines_) { for(const auto &machine: machines_) {
CRTMachine::Machine *crt = machine->crt_machine(); CRTMachine::Machine *crt = machine->crt_machine();
printf("%0.2f ", crt->get_confidence()); LOGNBR(PADHEX(2) << crt->get_confidence() << " " << crt->debug_type() << "; ");
crt->print_type();
printf("; ");
} }
printf("\n"); LOGNBR(std::endl);
#endif #endif
DynamicMachine *front = machines_.front().get(); DynamicMachine *front = machines_.front().get();
std::stable_sort(machines_.begin(), machines_.end(), std::stable_sort(machines_.begin(), machines_.end(),
[] (const std::unique_ptr<DynamicMachine> &lhs, const std::unique_ptr<DynamicMachine> &rhs){ [] (const std::unique_ptr<DynamicMachine> &lhs, const std::unique_ptr<DynamicMachine> &rhs){
CRTMachine::Machine *lhs_crt = lhs->crt_machine(); CRTMachine::Machine *lhs_crt = lhs->crt_machine();
CRTMachine::Machine *rhs_crt = rhs->crt_machine(); CRTMachine::Machine *rhs_crt = rhs->crt_machine();
return lhs_crt->get_confidence() > rhs_crt->get_confidence(); return lhs_crt->get_confidence() > rhs_crt->get_confidence();
}); });
if(machines_.front().get() != front) { if(machines_.front().get() != front) {
crt_machine_.did_change_machine_order(); crt_machine_.did_change_machine_order();

View File

@@ -3,7 +3,7 @@
// Clock Signal // Clock Signal
// //
// Created by Thomas Harte on 28/01/2018. // Created by Thomas Harte on 28/01/2018.
// Copyright © 2018 Thomas Harte. All rights reserved. // Copyright 2018 Thomas Harte. All rights reserved.
// //
#ifndef MultiMachine_hpp #ifndef MultiMachine_hpp
@@ -12,10 +12,10 @@
#include "../../../Machines/DynamicMachine.hpp" #include "../../../Machines/DynamicMachine.hpp"
#include "Implementation/MultiConfigurable.hpp" #include "Implementation/MultiConfigurable.hpp"
#include "Implementation/MultiConfigurationTarget.hpp"
#include "Implementation/MultiCRTMachine.hpp" #include "Implementation/MultiCRTMachine.hpp"
#include "Implementation/MultiJoystickMachine.hpp" #include "Implementation/MultiJoystickMachine.hpp"
#include "Implementation/MultiKeyboardMachine.hpp" #include "Implementation/MultiKeyboardMachine.hpp"
#include "Implementation/MultiMediaTarget.hpp"
#include <memory> #include <memory>
#include <mutex> #include <mutex>
@@ -50,24 +50,26 @@ class MultiMachine: public ::Machine::DynamicMachine, public MultiCRTMachine::De
static bool would_collapse(const std::vector<std::unique_ptr<DynamicMachine>> &machines); static bool would_collapse(const std::vector<std::unique_ptr<DynamicMachine>> &machines);
MultiMachine(std::vector<std::unique_ptr<DynamicMachine>> &&machines); MultiMachine(std::vector<std::unique_ptr<DynamicMachine>> &&machines);
ConfigurationTarget::Machine *configuration_target() override; Activity::Source *activity_source() override;
Configurable::Device *configurable_device() override;
CRTMachine::Machine *crt_machine() override; CRTMachine::Machine *crt_machine() override;
JoystickMachine::Machine *joystick_machine() override; JoystickMachine::Machine *joystick_machine() override;
MouseMachine::Machine *mouse_machine() override;
KeyboardMachine::Machine *keyboard_machine() override; KeyboardMachine::Machine *keyboard_machine() override;
Configurable::Device *configurable_device() override; MediaTarget::Machine *media_target() override;
void *raw_pointer() override; void *raw_pointer() override;
private: private:
void multi_crt_did_run_machines() override; void multi_crt_did_run_machines() override;
std::vector<std::unique_ptr<DynamicMachine>> machines_; std::vector<std::unique_ptr<DynamicMachine>> machines_;
std::mutex machines_mutex_; std::recursive_mutex machines_mutex_;
MultiConfigurable configurable_; MultiConfigurable configurable_;
MultiConfigurationTarget configuration_target_;
MultiCRTMachine crt_machine_; MultiCRTMachine crt_machine_;
MultiJoystickMachine joystick_machine_; MultiJoystickMachine joystick_machine_;
MultiKeyboardMachine keyboard_machine_; MultiKeyboardMachine keyboard_machine_;
MultiMediaTarget media_target_;
void pick_first(); void pick_first();
bool has_picked_ = false; bool has_picked_ = false;

View File

@@ -3,7 +3,7 @@
// Clock Signal // Clock Signal
// //
// Created by Thomas Harte on 24/01/2018. // Created by Thomas Harte on 24/01/2018.
// Copyright © 2018 Thomas Harte. All rights reserved. // Copyright 2018 Thomas Harte. All rights reserved.
// //
#ifndef Machines_h #ifndef Machines_h
@@ -13,9 +13,13 @@ namespace Analyser {
enum class Machine { enum class Machine {
AmstradCPC, AmstradCPC,
AppleII,
Atari2600, Atari2600,
AtariST,
ColecoVision, ColecoVision,
Electron, Electron,
Macintosh,
MasterSystem,
MSX, MSX,
Oric, Oric,
Vic20, Vic20,

View File

@@ -3,7 +3,7 @@
// Clock Signal // Clock Signal
// //
// Created by Thomas Harte on 18/09/2016. // Created by Thomas Harte on 18/09/2016.
// Copyright © 2016 Thomas Harte. All rights reserved. // Copyright 2016 Thomas Harte. All rights reserved.
// //
#include "Disk.hpp" #include "Disk.hpp"
@@ -18,7 +18,7 @@ using namespace Analyser::Static::Acorn;
std::unique_ptr<Catalogue> Analyser::Static::Acorn::GetDFSCatalogue(const std::shared_ptr<Storage::Disk::Disk> &disk) { std::unique_ptr<Catalogue> Analyser::Static::Acorn::GetDFSCatalogue(const std::shared_ptr<Storage::Disk::Disk> &disk) {
// c.f. http://beebwiki.mdfs.net/Acorn_DFS_disc_format // c.f. http://beebwiki.mdfs.net/Acorn_DFS_disc_format
std::unique_ptr<Catalogue> catalogue(new Catalogue); auto catalogue = std::make_unique<Catalogue>();
Storage::Encodings::MFM::Parser parser(false, disk); Storage::Encodings::MFM::Parser parser(false, disk);
Storage::Encodings::MFM::Sector *names = parser.get_sector(0, 0, 0); Storage::Encodings::MFM::Sector *names = parser.get_sector(0, 0, 0);
@@ -75,7 +75,7 @@ std::unique_ptr<Catalogue> Analyser::Static::Acorn::GetDFSCatalogue(const std::s
return catalogue; return catalogue;
} }
std::unique_ptr<Catalogue> Analyser::Static::Acorn::GetADFSCatalogue(const std::shared_ptr<Storage::Disk::Disk> &disk) { std::unique_ptr<Catalogue> Analyser::Static::Acorn::GetADFSCatalogue(const std::shared_ptr<Storage::Disk::Disk> &disk) {
std::unique_ptr<Catalogue> catalogue(new Catalogue); auto catalogue = std::make_unique<Catalogue>();
Storage::Encodings::MFM::Parser parser(true, disk); Storage::Encodings::MFM::Parser parser(true, disk);
Storage::Encodings::MFM::Sector *free_space_map_second_half = parser.get_sector(0, 0, 1); Storage::Encodings::MFM::Sector *free_space_map_second_half = parser.get_sector(0, 0, 1);

View File

@@ -3,7 +3,7 @@
// Clock Signal // Clock Signal
// //
// Created by Thomas Harte on 18/09/2016. // Created by Thomas Harte on 18/09/2016.
// Copyright © 2016 Thomas Harte. All rights reserved. // Copyright 2016 Thomas Harte. All rights reserved.
// //
#ifndef StaticAnalyser_Acorn_Disk_hpp #ifndef StaticAnalyser_Acorn_Disk_hpp
@@ -16,7 +16,7 @@ namespace Analyser {
namespace Static { namespace Static {
namespace Acorn { namespace Acorn {
/// Describes a DFS- or ADFS-format catalogue(/directory) the list of files available and the catalogue's boot option. /// Describes a DFS- or ADFS-format catalogue(/directory): the list of files available and the catalogue's boot option.
struct Catalogue { struct Catalogue {
std::string name; std::string name;
std::vector<File> files; std::vector<File> files;

View File

@@ -3,7 +3,7 @@
// Clock Signal // Clock Signal
// //
// Created by Thomas Harte on 18/09/2016. // Created by Thomas Harte on 18/09/2016.
// Copyright © 2016 Thomas Harte. All rights reserved. // Copyright 2016 Thomas Harte. All rights reserved.
// //
#ifndef StaticAnalyser_Acorn_File_hpp #ifndef StaticAnalyser_Acorn_File_hpp

View File

@@ -3,7 +3,7 @@
// Clock Signal // Clock Signal
// //
// Created by Thomas Harte on 29/08/2016. // Created by Thomas Harte on 29/08/2016.
// Copyright © 2016 Thomas Harte. All rights reserved. // Copyright 2016 Thomas Harte. All rights reserved.
// //
#include "StaticAnalyser.hpp" #include "StaticAnalyser.hpp"
@@ -50,15 +50,15 @@ static std::vector<std::shared_ptr<Storage::Cartridge::Cartridge>>
// 1/(2^32) * // 1/(2^32) *
// ( ((2^24)-1)/(2^24)*(1/4) + 1/(2^24) ) * // ( ((2^24)-1)/(2^24)*(1/4) + 1/(2^24) ) *
// 1/4 // 1/4
// = something very improbable around 1/16th of 1 in 2^32, but not exactly. // = something very improbable, around 1/16th of 1 in 2^32, but not exactly.
acorn_cartridges.push_back(cartridge); acorn_cartridges.push_back(cartridge);
} }
return acorn_cartridges; return acorn_cartridges;
} }
void Analyser::Static::Acorn::AddTargets(const Media &media, std::vector<std::unique_ptr<::Analyser::Static::Target>> &destination) { Analyser::Static::TargetList Analyser::Static::Acorn::GetTargets(const Media &media, const std::string &file_name, TargetPlatform::IntType potential_platforms) {
std::unique_ptr<Target> target(new Target); auto target = std::make_unique<Target>();
target->machine = Machine::Electron; target->machine = Machine::Electron;
target->confidence = 0.5; // TODO: a proper estimation target->confidence = 0.5; // TODO: a proper estimation
target->has_dfs = false; target->has_dfs = false;
@@ -69,13 +69,13 @@ void Analyser::Static::Acorn::AddTargets(const Media &media, std::vector<std::un
target->media.cartridges = AcornCartridgesFrom(media.cartridges); target->media.cartridges = AcornCartridgesFrom(media.cartridges);
// if there are any tapes, attempt to get data from the first // if there are any tapes, attempt to get data from the first
if(media.tapes.size() > 0) { if(!media.tapes.empty()) {
std::shared_ptr<Storage::Tape::Tape> tape = media.tapes.front(); std::shared_ptr<Storage::Tape::Tape> tape = media.tapes.front();
std::vector<File> files = GetFiles(tape); std::vector<File> files = GetFiles(tape);
tape->reset(); tape->reset();
// continue if there are any files // continue if there are any files
if(files.size()) { if(!files.empty()) {
bool is_basic = true; bool is_basic = true;
// protected files are always for *RUNning only // protected files are always for *RUNning only
@@ -103,7 +103,7 @@ void Analyser::Static::Acorn::AddTargets(const Media &media, std::vector<std::un
} }
} }
if(media.disks.size() > 0) { if(!media.disks.empty()) {
std::shared_ptr<Storage::Disk::Disk> disk = media.disks.front(); std::shared_ptr<Storage::Disk::Disk> disk = media.disks.front();
std::unique_ptr<Catalogue> dfs_catalogue, adfs_catalogue; std::unique_ptr<Catalogue> dfs_catalogue, adfs_catalogue;
dfs_catalogue = GetDFSCatalogue(disk); dfs_catalogue = GetDFSCatalogue(disk);
@@ -121,7 +121,9 @@ void Analyser::Static::Acorn::AddTargets(const Media &media, std::vector<std::un
} }
} }
if(target->media.tapes.size() || target->media.disks.size() || target->media.cartridges.size()) { TargetList targets;
destination.push_back(std::move(target)); if(!target->media.empty()) {
targets.push_back(std::move(target));
} }
return targets;
} }

View File

@@ -3,19 +3,21 @@
// Clock Signal // Clock Signal
// //
// Created by Thomas Harte on 29/08/2016. // Created by Thomas Harte on 29/08/2016.
// Copyright © 2016 Thomas Harte. All rights reserved. // Copyright 2016 Thomas Harte. All rights reserved.
// //
#ifndef StaticAnalyser_Acorn_StaticAnalyser_hpp #ifndef StaticAnalyser_Acorn_StaticAnalyser_hpp
#define StaticAnalyser_Acorn_StaticAnalyser_hpp #define StaticAnalyser_Acorn_StaticAnalyser_hpp
#include "../StaticAnalyser.hpp" #include "../StaticAnalyser.hpp"
#include "../../../Storage/TargetPlatforms.hpp"
#include <string>
namespace Analyser { namespace Analyser {
namespace Static { namespace Static {
namespace Acorn { namespace Acorn {
void AddTargets(const Media &media, std::vector<std::unique_ptr<Target>> &destination); TargetList GetTargets(const Media &media, const std::string &file_name, TargetPlatform::IntType potential_platforms);
} }
} }

View File

@@ -3,7 +3,7 @@
// Clock Signal // Clock Signal
// //
// Created by Thomas Harte on 29/08/2016. // Created by Thomas Harte on 29/08/2016.
// Copyright © 2016 Thomas Harte. All rights reserved. // Copyright 2016 Thomas Harte. All rights reserved.
// //
#include "Tape.hpp" #include "Tape.hpp"
@@ -16,7 +16,7 @@
using namespace Analyser::Static::Acorn; using namespace Analyser::Static::Acorn;
static std::unique_ptr<File::Chunk> GetNextChunk(const std::shared_ptr<Storage::Tape::Tape> &tape, Storage::Tape::Acorn::Parser &parser) { static std::unique_ptr<File::Chunk> GetNextChunk(const std::shared_ptr<Storage::Tape::Tape> &tape, Storage::Tape::Acorn::Parser &parser) {
std::unique_ptr<File::Chunk> new_chunk(new File::Chunk); auto new_chunk = std::make_unique<File::Chunk>();
int shift_register = 0; int shift_register = 0;
// TODO: move this into the parser // TODO: move this into the parser
@@ -90,7 +90,7 @@ static std::unique_ptr<File> GetNextFile(std::deque<File::Chunk> &chunks) {
if(!chunks.size()) return nullptr; if(!chunks.size()) return nullptr;
// accumulate chunks for as long as block number is sequential and the end-of-file bit isn't set // accumulate chunks for as long as block number is sequential and the end-of-file bit isn't set
std::unique_ptr<File> file(new File); auto file = std::make_unique<File>();
uint16_t block_number = 0; uint16_t block_number = 0;

View File

@@ -3,7 +3,7 @@
// Clock Signal // Clock Signal
// //
// Created by Thomas Harte on 29/08/2016. // Created by Thomas Harte on 29/08/2016.
// Copyright © 2016 Thomas Harte. All rights reserved. // Copyright 2016 Thomas Harte. All rights reserved.
// //
#ifndef StaticAnalyser_Acorn_Tape_hpp #ifndef StaticAnalyser_Acorn_Tape_hpp

View File

@@ -3,13 +3,14 @@
// Clock Signal // Clock Signal
// //
// Created by Thomas Harte on 09/03/2018. // Created by Thomas Harte on 09/03/2018.
// Copyright © 2018 Thomas Harte. All rights reserved. // Copyright 2018 Thomas Harte. All rights reserved.
// //
#ifndef Analyser_Static_Acorn_Target_h #ifndef Analyser_Static_Acorn_Target_h
#define Analyser_Static_Acorn_Target_h #define Analyser_Static_Acorn_Target_h
#include "../StaticAnalyser.hpp" #include "../StaticAnalyser.hpp"
#include <string>
namespace Analyser { namespace Analyser {
namespace Static { namespace Static {
@@ -19,6 +20,7 @@ struct Target: public ::Analyser::Static::Target {
bool has_adfs = false; bool has_adfs = false;
bool has_dfs = false; bool has_dfs = false;
bool should_shift_restart = false; bool should_shift_restart = false;
std::string loading_command;
}; };
} }

View File

@@ -3,7 +3,7 @@
// Clock Signal // Clock Signal
// //
// Created by Thomas Harte on 30/07/2017. // Created by Thomas Harte on 30/07/2017.
// Copyright © 2017 Thomas Harte. All rights reserved. // Copyright 2017 Thomas Harte. All rights reserved.
// //
#include "StaticAnalyser.hpp" #include "StaticAnalyser.hpp"
@@ -35,8 +35,8 @@ static bool is_implied_extension(const std::string &extension) {
static void right_trim(std::string &string) { static void right_trim(std::string &string) {
string.erase(std::find_if(string.rbegin(), string.rend(), [](int ch) { string.erase(std::find_if(string.rbegin(), string.rend(), [](int ch) {
return !std::isspace(ch); return !std::isspace(ch);
}).base(), string.end()); }).base(), string.end());
} }
static std::string RunCommandFor(const Storage::Disk::CPM::File &file) { static std::string RunCommandFor(const Storage::Disk::CPM::File &file) {
@@ -64,14 +64,14 @@ static void InspectCatalogue(
std::vector<const Storage::Disk::CPM::File *> candidate_files; std::vector<const Storage::Disk::CPM::File *> candidate_files;
candidate_files.reserve(catalogue.files.size()); candidate_files.reserve(catalogue.files.size());
for(auto &file : catalogue.files) { for(const auto &file : catalogue.files) {
candidate_files.push_back(&file); candidate_files.push_back(&file);
} }
// Remove all files with untypable characters. // Remove all files with untypable characters.
candidate_files.erase( candidate_files.erase(
std::remove_if(candidate_files.begin(), candidate_files.end(), [](const Storage::Disk::CPM::File *file) { std::remove_if(candidate_files.begin(), candidate_files.end(), [](const Storage::Disk::CPM::File *file) {
for(auto c : file->name + file->type) { for(const auto c : file->name + file->type) {
if(c < 32) return true; if(c < 32) return true;
} }
return false; return false;
@@ -80,7 +80,7 @@ static void InspectCatalogue(
// If that leaves a mix of 'system' (i.e. hidden) and non-system files, remove the system files. // If that leaves a mix of 'system' (i.e. hidden) and non-system files, remove the system files.
bool are_all_system = true; bool are_all_system = true;
for(auto file : candidate_files) { for(const auto &file : candidate_files) {
if(!file->system) { if(!file->system) {
are_all_system = false; are_all_system = false;
break; break;
@@ -137,13 +137,13 @@ static void InspectCatalogue(
std::map<std::string, int> name_counts; std::map<std::string, int> name_counts;
std::map<std::string, std::size_t> indices_by_name; std::map<std::string, std::size_t> indices_by_name;
std::size_t index = 0; std::size_t index = 0;
for(auto file : candidate_files) { for(const auto &file : candidate_files) {
name_counts[file->name]++; name_counts[file->name]++;
indices_by_name[file->name] = index; indices_by_name[file->name] = index;
index++; index++;
} }
if(name_counts.size() == 2) { if(name_counts.size() == 2) {
for(auto &pair : name_counts) { for(const auto &pair : name_counts) {
if(pair.second == 1) { if(pair.second == 1) {
target->loading_command = RunCommandFor(*candidate_files[indices_by_name[pair.first]]); target->loading_command = RunCommandFor(*candidate_files[indices_by_name[pair.first]]);
return; return;
@@ -179,8 +179,9 @@ static bool CheckBootSector(const std::shared_ptr<Storage::Disk::Disk> &disk, co
return false; return false;
} }
void Analyser::Static::AmstradCPC::AddTargets(const Media &media, std::vector<std::unique_ptr<Analyser::Static::Target>> &destination) { Analyser::Static::TargetList Analyser::Static::AmstradCPC::GetTargets(const Media &media, const std::string &file_name, TargetPlatform::IntType potential_platforms) {
std::unique_ptr<Target> target(new Target); TargetList destination;
auto target = std::make_unique<Target>();
target->machine = Machine::AmstradCPC; target->machine = Machine::AmstradCPC;
target->confidence = 0.5; target->confidence = 0.5;
@@ -213,7 +214,7 @@ void Analyser::Static::AmstradCPC::AddTargets(const Media &media, std::vector<st
system_format.catalogue_allocation_bitmap = 0xc000; system_format.catalogue_allocation_bitmap = 0xc000;
system_format.reserved_tracks = 2; system_format.reserved_tracks = 2;
for(const auto &disk: media.disks) { for(auto &disk: media.disks) {
// Check for an ordinary catalogue. // Check for an ordinary catalogue.
std::unique_ptr<Storage::Disk::CPM::Catalogue> data_catalogue = Storage::Disk::CPM::GetCatalogue(disk, data_format); std::unique_ptr<Storage::Disk::CPM::Catalogue> data_catalogue = Storage::Disk::CPM::GetCatalogue(disk, data_format);
if(data_catalogue) { if(data_catalogue) {
@@ -241,4 +242,6 @@ void Analyser::Static::AmstradCPC::AddTargets(const Media &media, std::vector<st
// If any media survived, add the target. // If any media survived, add the target.
if(!target->media.empty()) if(!target->media.empty())
destination.push_back(std::move(target)); destination.push_back(std::move(target));
return destination;
} }

View File

@@ -3,22 +3,24 @@
// Clock Signal // Clock Signal
// //
// Created by Thomas Harte on 30/07/2017. // Created by Thomas Harte on 30/07/2017.
// Copyright © 2017 Thomas Harte. All rights reserved. // Copyright 2017 Thomas Harte. All rights reserved.
// //
#ifndef StaticAnalyser_AmstradCPC_StaticAnalyser_hpp #ifndef Analyser_Static_AmstradCPC_StaticAnalyser_hpp
#define StaticAnalyser_AmstradCPC_StaticAnalyser_hpp #define Analyser_Static_AmstradCPC_StaticAnalyser_hpp
#include "../StaticAnalyser.hpp" #include "../StaticAnalyser.hpp"
#include "../../../Storage/TargetPlatforms.hpp"
#include <string>
namespace Analyser { namespace Analyser {
namespace Static { namespace Static {
namespace AmstradCPC { namespace AmstradCPC {
void AddTargets(const Media &media, std::vector<std::unique_ptr<Target>> &destination); TargetList GetTargets(const Media &media, const std::string &file_name, TargetPlatform::IntType potential_platforms);
} }
} }
} }
#endif /* StaticAnalyser_AmstradCPC_StaticAnalyser_hpp */ #endif /* Analyser_Static_AmstradCPC_StaticAnalyser_hpp */

View File

@@ -3,13 +3,14 @@
// Clock Signal // Clock Signal
// //
// Created by Thomas Harte on 09/03/2018. // Created by Thomas Harte on 09/03/2018.
// Copyright © 2018 Thomas Harte. All rights reserved. // Copyright 2018 Thomas Harte. All rights reserved.
// //
#ifndef Analyser_Static_AmstradCPC_Target_h #ifndef Analyser_Static_AmstradCPC_Target_h
#define Analyser_Static_AmstradCPC_Target_h #define Analyser_Static_AmstradCPC_Target_h
#include "../StaticAnalyser.hpp" #include "../StaticAnalyser.hpp"
#include <string>
namespace Analyser { namespace Analyser {
namespace Static { namespace Static {
@@ -23,6 +24,7 @@ struct Target: public ::Analyser::Static::Target {
}; };
Model model = Model::CPC464; Model model = Model::CPC464;
std::string loading_command;
}; };
} }

View File

@@ -0,0 +1,23 @@
//
// StaticAnalyser.cpp
// Clock Signal
//
// Created by Thomas Harte on 14/04/2018.
// Copyright 2018 Thomas Harte. All rights reserved.
//
#include "StaticAnalyser.hpp"
#include "Target.hpp"
Analyser::Static::TargetList Analyser::Static::AppleII::GetTargets(const Media &media, const std::string &file_name, TargetPlatform::IntType potential_platforms) {
auto target = std::make_unique<Target>();
target->machine = Machine::AppleII;
target->media = media;
if(!target->media.disks.empty())
target->disk_controller = Target::DiskController::SixteenSector;
TargetList targets;
targets.push_back(std::move(target));
return targets;
}

View File

@@ -0,0 +1,26 @@
//
// StaticAnalyser.hpp
// Clock Signal
//
// Created by Thomas Harte on 14/04/2018.
// Copyright 2018 Thomas Harte. All rights reserved.
//
#ifndef Analyser_Static_AppleII_StaticAnalyser_hpp
#define Analyser_Static_AppleII_StaticAnalyser_hpp
#include "../StaticAnalyser.hpp"
#include "../../../Storage/TargetPlatforms.hpp"
#include <string>
namespace Analyser {
namespace Static {
namespace AppleII {
TargetList GetTargets(const Media &media, const std::string &file_name, TargetPlatform::IntType potential_platforms);
}
}
}
#endif /* Analyser_Static_AppleII_StaticAnalyser_hpp */

View File

@@ -0,0 +1,39 @@
//
// Target.hpp
// Clock Signal
//
// Created by Thomas Harte on 21/04/2018.
// Copyright 2018 Thomas Harte. All rights reserved.
//
#ifndef Target_h
#define Target_h
#include "../StaticAnalyser.hpp"
namespace Analyser {
namespace Static {
namespace AppleII {
struct Target: public ::Analyser::Static::Target {
enum class Model {
II,
IIplus,
IIe,
EnhancedIIe
};
enum class DiskController {
None,
SixteenSector,
ThirteenSector
};
Model model = Model::IIe;
DiskController disk_controller = DiskController::None;
};
}
}
}
#endif /* Target_h */

View File

@@ -3,7 +3,7 @@
// Clock Signal // Clock Signal
// //
// Created by Thomas Harte on 15/09/2016. // Created by Thomas Harte on 15/09/2016.
// Copyright © 2016 Thomas Harte. All rights reserved. // Copyright 2016 Thomas Harte. All rights reserved.
// //
#include "StaticAnalyser.hpp" #include "StaticAnalyser.hpp"
@@ -12,9 +12,10 @@
#include "../Disassembler/6502.hpp" #include "../Disassembler/6502.hpp"
using namespace Analyser::Static::Atari; using namespace Analyser::Static::Atari2600;
using Target = Analyser::Static::Atari2600::Target;
static void DeterminePagingFor2kCartridge(Analyser::Static::Atari::Target &target, const Storage::Cartridge::Cartridge::Segment &segment) { static void DeterminePagingFor2kCartridge(Target &target, const Storage::Cartridge::Cartridge::Segment &segment) {
// if this is a 2kb cartridge then it's definitely either unpaged or a CommaVid // if this is a 2kb cartridge then it's definitely either unpaged or a CommaVid
uint16_t entry_address, break_address; uint16_t entry_address, break_address;
@@ -48,10 +49,10 @@ static void DeterminePagingFor2kCartridge(Analyser::Static::Atari::Target &targe
// caveat: false positives aren't likely to be problematic; a false positive is a 2KB ROM that always addresses // caveat: false positives aren't likely to be problematic; a false positive is a 2KB ROM that always addresses
// itself so as to land in ROM even if mapped as a CommaVid and this code is on the fence as to whether it // itself so as to land in ROM even if mapped as a CommaVid and this code is on the fence as to whether it
// attempts to modify itself but it probably doesn't // attempts to modify itself but it probably doesn't
if(has_wide_area_store) target.paging_model = Analyser::Static::Atari::Target::PagingModel::CommaVid; if(has_wide_area_store) target.paging_model = Target::PagingModel::CommaVid;
} }
static void DeterminePagingFor8kCartridge(Analyser::Static::Atari::Target &target, const Storage::Cartridge::Cartridge::Segment &segment, const Analyser::Static::MOS6502::Disassembly &disassembly) { static void DeterminePagingFor8kCartridge(Target &target, const Storage::Cartridge::Cartridge::Segment &segment, const Analyser::Static::MOS6502::Disassembly &disassembly) {
// Activision stack titles have their vectors at the top of the low 4k, not the top, and // Activision stack titles have their vectors at the top of the low 4k, not the top, and
// always list 0xf000 as both vectors; they do not repeat them, and, inexplicably, they all // always list 0xf000 as both vectors; they do not repeat them, and, inexplicably, they all
// issue an SEI as their first instruction (maybe some sort of relic of the development environment?) // issue an SEI as their first instruction (maybe some sort of relic of the development environment?)
@@ -60,12 +61,12 @@ static void DeterminePagingFor8kCartridge(Analyser::Static::Atari::Target &targe
(segment.data[8191] != 0xf0 || segment.data[8189] != 0xf0 || segment.data[8190] != 0x00 || segment.data[8188] != 0x00) && (segment.data[8191] != 0xf0 || segment.data[8189] != 0xf0 || segment.data[8190] != 0x00 || segment.data[8188] != 0x00) &&
segment.data[0] == 0x78 segment.data[0] == 0x78
) { ) {
target.paging_model = Analyser::Static::Atari::Target::PagingModel::ActivisionStack; target.paging_model = Target::PagingModel::ActivisionStack;
return; return;
} }
// make an assumption that this is the Atari paging model // make an assumption that this is the Atari paging model
target.paging_model = Analyser::Static::Atari::Target::PagingModel::Atari8k; target.paging_model = Target::PagingModel::Atari8k;
std::set<uint16_t> internal_accesses; std::set<uint16_t> internal_accesses;
internal_accesses.insert(disassembly.internal_stores.begin(), disassembly.internal_stores.end()); internal_accesses.insert(disassembly.internal_stores.begin(), disassembly.internal_stores.end());
@@ -85,13 +86,13 @@ static void DeterminePagingFor8kCartridge(Analyser::Static::Atari::Target &targe
tigervision_access_count += masked_address == 0x3f; tigervision_access_count += masked_address == 0x3f;
} }
if(parker_access_count > atari_access_count) target.paging_model = Analyser::Static::Atari::Target::PagingModel::ParkerBros; if(parker_access_count > atari_access_count) target.paging_model = Target::PagingModel::ParkerBros;
else if(tigervision_access_count > atari_access_count) target.paging_model = Analyser::Static::Atari::Target::PagingModel::Tigervision; else if(tigervision_access_count > atari_access_count) target.paging_model = Target::PagingModel::Tigervision;
} }
static void DeterminePagingFor16kCartridge(Analyser::Static::Atari::Target &target, const Storage::Cartridge::Cartridge::Segment &segment, const Analyser::Static::MOS6502::Disassembly &disassembly) { static void DeterminePagingFor16kCartridge(Target &target, const Storage::Cartridge::Cartridge::Segment &segment, const Analyser::Static::MOS6502::Disassembly &disassembly) {
// make an assumption that this is the Atari paging model // make an assumption that this is the Atari paging model
target.paging_model = Analyser::Static::Atari::Target::PagingModel::Atari16k; target.paging_model = Target::PagingModel::Atari16k;
std::set<uint16_t> internal_accesses; std::set<uint16_t> internal_accesses;
internal_accesses.insert(disassembly.internal_stores.begin(), disassembly.internal_stores.end()); internal_accesses.insert(disassembly.internal_stores.begin(), disassembly.internal_stores.end());
@@ -106,17 +107,17 @@ static void DeterminePagingFor16kCartridge(Analyser::Static::Atari::Target &targ
mnetwork_access_count += masked_address >= 0x1fe0 && masked_address < 0x1ffb; mnetwork_access_count += masked_address >= 0x1fe0 && masked_address < 0x1ffb;
} }
if(mnetwork_access_count > atari_access_count) target.paging_model = Analyser::Static::Atari::Target::PagingModel::MNetwork; if(mnetwork_access_count > atari_access_count) target.paging_model = Target::PagingModel::MNetwork;
} }
static void DeterminePagingFor64kCartridge(Analyser::Static::Atari::Target &target, const Storage::Cartridge::Cartridge::Segment &segment, const Analyser::Static::MOS6502::Disassembly &disassembly) { static void DeterminePagingFor64kCartridge(Target &target, const Storage::Cartridge::Cartridge::Segment &segment, const Analyser::Static::MOS6502::Disassembly &disassembly) {
// make an assumption that this is a Tigervision if there is a write to 3F // make an assumption that this is a Tigervision if there is a write to 3F
target.paging_model = target.paging_model =
(disassembly.external_stores.find(0x3f) != disassembly.external_stores.end()) ? (disassembly.external_stores.find(0x3f) != disassembly.external_stores.end()) ?
Analyser::Static::Atari::Target::PagingModel::Tigervision : Analyser::Static::Atari::Target::PagingModel::MegaBoy; Target::PagingModel::Tigervision : Target::PagingModel::MegaBoy;
} }
static void DeterminePagingForCartridge(Analyser::Static::Atari::Target &target, const Storage::Cartridge::Cartridge::Segment &segment) { static void DeterminePagingForCartridge(Target &target, const Storage::Cartridge::Cartridge::Segment &segment) {
if(segment.data.size() == 2048) { if(segment.data.size() == 2048) {
DeterminePagingFor2kCartridge(target, segment); DeterminePagingFor2kCartridge(target, segment);
return; return;
@@ -140,16 +141,16 @@ static void DeterminePagingForCartridge(Analyser::Static::Atari::Target &target,
DeterminePagingFor8kCartridge(target, segment, disassembly); DeterminePagingFor8kCartridge(target, segment, disassembly);
break; break;
case 10495: case 10495:
target.paging_model = Analyser::Static::Atari::Target::PagingModel::Pitfall2; target.paging_model = Target::PagingModel::Pitfall2;
break; break;
case 12288: case 12288:
target.paging_model = Analyser::Static::Atari::Target::PagingModel::CBSRamPlus; target.paging_model = Target::PagingModel::CBSRamPlus;
break; break;
case 16384: case 16384:
DeterminePagingFor16kCartridge(target, segment, disassembly); DeterminePagingFor16kCartridge(target, segment, disassembly);
break; break;
case 32768: case 32768:
target.paging_model = Analyser::Static::Atari::Target::PagingModel::Atari32k; target.paging_model = Target::PagingModel::Atari32k;
break; break;
case 65536: case 65536:
DeterminePagingFor64kCartridge(target, segment, disassembly); DeterminePagingFor64kCartridge(target, segment, disassembly);
@@ -161,8 +162,8 @@ static void DeterminePagingForCartridge(Analyser::Static::Atari::Target &target,
// check for a Super Chip. Atari ROM images [almost] always have the same value stored over RAM // check for a Super Chip. Atari ROM images [almost] always have the same value stored over RAM
// regions; when they don't they at least seem to have the first 128 bytes be the same as the // regions; when they don't they at least seem to have the first 128 bytes be the same as the
// next 128 bytes. So check for that. // next 128 bytes. So check for that.
if( target.paging_model != Analyser::Static::Atari::Target::PagingModel::CBSRamPlus && if( target.paging_model != Target::PagingModel::CBSRamPlus &&
target.paging_model != Analyser::Static::Atari::Target::PagingModel::MNetwork) { target.paging_model != Target::PagingModel::MNetwork) {
bool has_superchip = true; bool has_superchip = true;
for(std::size_t address = 0; address < 128; address++) { for(std::size_t address = 0; address < 128; address++) {
if(segment.data[address] != segment.data[address+128]) { if(segment.data[address] != segment.data[address+128]) {
@@ -174,19 +175,19 @@ static void DeterminePagingForCartridge(Analyser::Static::Atari::Target &target,
} }
// check for a Tigervision or Tigervision-esque scheme // check for a Tigervision or Tigervision-esque scheme
if(target.paging_model == Analyser::Static::Atari::Target::PagingModel::None && segment.data.size() > 4096) { if(target.paging_model == Target::PagingModel::None && segment.data.size() > 4096) {
bool looks_like_tigervision = disassembly.external_stores.find(0x3f) != disassembly.external_stores.end(); bool looks_like_tigervision = disassembly.external_stores.find(0x3f) != disassembly.external_stores.end();
if(looks_like_tigervision) target.paging_model = Analyser::Static::Atari::Target::PagingModel::Tigervision; if(looks_like_tigervision) target.paging_model = Target::PagingModel::Tigervision;
} }
} }
void Analyser::Static::Atari::AddTargets(const Media &media, std::vector<std::unique_ptr<Analyser::Static::Target>> &destination) { Analyser::Static::TargetList Analyser::Static::Atari2600::GetTargets(const Media &media, const std::string &file_name, TargetPlatform::IntType potential_platforms) {
// TODO: sanity checking; is this image really for an Atari 2600? // TODO: sanity checking; is this image really for an Atari 2600?
std::unique_ptr<Analyser::Static::Atari::Target> target(new Analyser::Static::Atari::Target); auto target = std::make_unique<Target>();
target->machine = Machine::Atari2600; target->machine = Machine::Atari2600;
target->confidence = 0.5; target->confidence = 0.5;
target->media.cartridges = media.cartridges; target->media.cartridges = media.cartridges;
target->paging_model = Analyser::Static::Atari::Target::PagingModel::None; target->paging_model = Target::PagingModel::None;
target->uses_superchip = false; target->uses_superchip = false;
// try to figure out the paging scheme // try to figure out the paging scheme
@@ -198,6 +199,7 @@ void Analyser::Static::Atari::AddTargets(const Media &media, std::vector<std::un
DeterminePagingForCartridge(*target, segment); DeterminePagingForCartridge(*target, segment);
} }
} }
TargetList destinations;
destination.push_back(std::move(target)); destinations.push_back(std::move(target));
return destinations;
} }

View File

@@ -3,19 +3,21 @@
// Clock Signal // Clock Signal
// //
// Created by Thomas Harte on 15/09/2016. // Created by Thomas Harte on 15/09/2016.
// Copyright © 2016 Thomas Harte. All rights reserved. // Copyright 2016 Thomas Harte. All rights reserved.
// //
#ifndef StaticAnalyser_Atari_StaticAnalyser_hpp #ifndef StaticAnalyser_Atari_StaticAnalyser_hpp
#define StaticAnalyser_Atari_StaticAnalyser_hpp #define StaticAnalyser_Atari_StaticAnalyser_hpp
#include "../StaticAnalyser.hpp" #include "../StaticAnalyser.hpp"
#include "../../../Storage/TargetPlatforms.hpp"
#include <string>
namespace Analyser { namespace Analyser {
namespace Static { namespace Static {
namespace Atari { namespace Atari2600 {
void AddTargets(const Media &media, std::vector<std::unique_ptr<Target>> &destination); TargetList GetTargets(const Media &media, const std::string &file_name, TargetPlatform::IntType potential_platforms);
} }
} }

View File

@@ -3,17 +3,17 @@
// Clock Signal // Clock Signal
// //
// Created by Thomas Harte on 09/03/2018. // Created by Thomas Harte on 09/03/2018.
// Copyright © 2018 Thomas Harte. All rights reserved. // Copyright 2018 Thomas Harte. All rights reserved.
// //
#ifndef Analyser_Static_Atari_Target_h #ifndef Analyser_Static_Atari2600_Target_h
#define Analyser_Static_Atari_Target_h #define Analyser_Static_Atari2600_Target_h
#include "../StaticAnalyser.hpp" #include "../StaticAnalyser.hpp"
namespace Analyser { namespace Analyser {
namespace Static { namespace Static {
namespace Atari { namespace Atari2600 {
struct Target: public ::Analyser::Static::Target { struct Target: public ::Analyser::Static::Target {
enum class PagingModel { enum class PagingModel {

View File

@@ -0,0 +1,26 @@
//
// StaticAnalyser.cpp
// Clock Signal
//
// Created by Thomas Harte on 03/10/2019.
// Copyright © 2019 Thomas Harte. All rights reserved.
//
#include "StaticAnalyser.hpp"
#include "Target.hpp"
Analyser::Static::TargetList Analyser::Static::AtariST::GetTargets(const Media &media, const std::string &file_name, TargetPlatform::IntType potential_platforms) {
// This analyser can comprehend disks and mass-storage devices only.
if(media.disks.empty()) return {};
// As there is at least one usable media image, wave it through.
Analyser::Static::TargetList targets;
using Target = Analyser::Static::Target;
auto *target = new Target;
target->machine = Analyser::Machine::AtariST;
target->media = media;
targets.push_back(std::unique_ptr<Analyser::Static::Target>(target));
return targets;
}

View File

@@ -0,0 +1,27 @@
//
// StaticAnalyser.hpp
// Clock Signal
//
// Created by Thomas Harte on 03/10/2019.
// Copyright © 2019 Thomas Harte. All rights reserved.
//
#ifndef Analyser_Static_AtariST_StaticAnalyser_hpp
#define Analyser_Static_AtariST_StaticAnalyser_hpp
#include "../StaticAnalyser.hpp"
#include "../../../Storage/TargetPlatforms.hpp"
#include <string>
namespace Analyser {
namespace Static {
namespace AtariST {
TargetList GetTargets(const Media &media, const std::string &file_name, TargetPlatform::IntType potential_platforms);
}
}
}
#endif /* Analyser_Static_AtariST_StaticAnalyser_hpp */

View File

@@ -0,0 +1,23 @@
//
// Target.hpp
// Clock Signal
//
// Created by Thomas Harte on 03/06/2019.
// Copyright © 2019 Thomas Harte. All rights reserved.
//
#ifndef Analyser_Static_AtariST_Target_h
#define Analyser_Static_AtariST_Target_h
namespace Analyser {
namespace Static {
namespace AtariST {
struct Target: public ::Analyser::Static::Target {
};
}
}
}
#endif /* Analyser_Static_AtariST_Target_h */

View File

@@ -3,7 +3,7 @@
// Clock Signal // Clock Signal
// //
// Created by Thomas Harte on 23/02/2018. // Created by Thomas Harte on 23/02/2018.
// Copyright © 2018 Thomas Harte. All rights reserved. // Copyright 2018 Thomas Harte. All rights reserved.
// //
#include "StaticAnalyser.hpp" #include "StaticAnalyser.hpp"
@@ -17,13 +17,8 @@ static std::vector<std::shared_ptr<Storage::Cartridge::Cartridge>>
// only one mapped item is allowed // only one mapped item is allowed
if(segments.size() != 1) continue; if(segments.size() != 1) continue;
// which must be 8, 12, 16, 24 or 32 kb in size
const Storage::Cartridge::Cartridge::Segment &segment = segments.front(); const Storage::Cartridge::Cartridge::Segment &segment = segments.front();
const std::size_t data_size = segment.data.size(); const std::size_t data_size = segment.data.size();
const std::size_t overflow = data_size&8191;
if(overflow > 8 && overflow != 512 && (data_size != 12*1024)) continue;
if(data_size < 8192) continue;
// the two bytes that will be first must be 0xaa and 0x55, either way around // the two bytes that will be first must be 0xaa and 0x55, either way around
auto *start = &segment.data[0]; auto *start = &segment.data[0];
@@ -34,29 +29,36 @@ static std::vector<std::shared_ptr<Storage::Cartridge::Cartridge>>
if(start[0] == start[1]) continue; if(start[0] == start[1]) continue;
// probability of a random binary blob that isn't a Coleco ROM proceeding to here is 1 - 1/32768. // probability of a random binary blob that isn't a Coleco ROM proceeding to here is 1 - 1/32768.
if(!overflow) {
coleco_cartridges.push_back(cartridge); // Round up to the next multiple of 8kb if this image is less than 32kb. Otherwise round down if
// this image is within a short distance of 32kb.
std::vector<Storage::Cartridge::Cartridge::Segment> output_segments;
size_t target_size;
if(data_size >= 32*1024 && data_size < 32*1024 + 512) {
target_size = 32 * 1024;
} else { } else {
// Size down to a multiple of 8kb and apply the start address. target_size = data_size + ((8192 - (data_size & 8191)) & 8191);
std::vector<Storage::Cartridge::Cartridge::Segment> output_segments;
std::vector<uint8_t> truncated_data;
std::vector<uint8_t>::difference_type truncated_size = static_cast<std::vector<uint8_t>::difference_type>(segment.data.size()) & ~8191;
truncated_data.insert(truncated_data.begin(), segment.data.begin(), segment.data.begin() + truncated_size);
output_segments.emplace_back(0x8000, truncated_data);
coleco_cartridges.emplace_back(new Storage::Cartridge::Cartridge(output_segments));
} }
std::vector<uint8_t> truncated_data;
truncated_data = segment.data;
truncated_data.resize(target_size);
output_segments.emplace_back(0x8000, truncated_data);
coleco_cartridges.emplace_back(new Storage::Cartridge::Cartridge(output_segments));
} }
return coleco_cartridges; return coleco_cartridges;
} }
void Analyser::Static::Coleco::AddTargets(const Media &media, std::vector<std::unique_ptr<Target>> &destination) { Analyser::Static::TargetList Analyser::Static::Coleco::GetTargets(const Media &media, const std::string &file_name, TargetPlatform::IntType potential_platforms) {
std::unique_ptr<Target> target(new Target); TargetList targets;
auto target = std::make_unique<Target>();
target->machine = Machine::ColecoVision; target->machine = Machine::ColecoVision;
target->confidence = 1.0f - 1.0f / 32768.0f; target->confidence = 1.0f - 1.0f / 32768.0f;
target->media.cartridges = ColecoCartridgesFrom(media.cartridges); target->media.cartridges = ColecoCartridgesFrom(media.cartridges);
if(!target->media.empty()) if(!target->media.empty())
destination.push_back(std::move(target)); targets.push_back(std::move(target));
return targets;
} }

View File

@@ -3,23 +3,24 @@
// Clock Signal // Clock Signal
// //
// Created by Thomas Harte on 23/02/2018. // Created by Thomas Harte on 23/02/2018.
// Copyright © 2018 Thomas Harte. All rights reserved. // Copyright 2018 Thomas Harte. All rights reserved.
// //
#ifndef StaticAnalyser_Coleco_StaticAnalyser_hpp #ifndef StaticAnalyser_Coleco_StaticAnalyser_hpp
#define StaticAnalyser_Coleco_StaticAnalyser_hpp #define StaticAnalyser_Coleco_StaticAnalyser_hpp
#include "../StaticAnalyser.hpp" #include "../StaticAnalyser.hpp"
#include "../../../Storage/TargetPlatforms.hpp"
#include <string>
namespace Analyser { namespace Analyser {
namespace Static { namespace Static {
namespace Coleco { namespace Coleco {
void AddTargets(const Media &media, std::vector<std::unique_ptr<Target>> &destination); TargetList GetTargets(const Media &media, const std::string &file_name, TargetPlatform::IntType potential_platforms);
} }
} }
} }
#endif /* StaticAnalyser_hpp */ #endif /* StaticAnalyser_hpp */

View File

@@ -3,7 +3,7 @@
// Clock Signal // Clock Signal
// //
// Created by Thomas Harte on 13/09/2016. // Created by Thomas Harte on 13/09/2016.
// Copyright © 2016 Thomas Harte. All rights reserved. // Copyright 2016 Thomas Harte. All rights reserved.
// //
#include "Disk.hpp" #include "Disk.hpp"
@@ -22,7 +22,7 @@ class CommodoreGCRParser: public Storage::Disk::Controller {
std::shared_ptr<Storage::Disk::Drive> drive; std::shared_ptr<Storage::Disk::Drive> drive;
CommodoreGCRParser() : Storage::Disk::Controller(4000000), shift_register_(0), track_(1) { CommodoreGCRParser() : Storage::Disk::Controller(4000000), shift_register_(0), track_(1) {
drive.reset(new Storage::Disk::Drive(4000000, 300, 2)); drive = std::make_shared<Storage::Disk::Drive>(4000000, 300, 2);
set_drive(drive); set_drive(drive);
drive->set_motor_on(true); drive->set_motor_on(true);
} }
@@ -45,9 +45,11 @@ class CommodoreGCRParser: public Storage::Disk::Controller {
if(difference) { if(difference) {
int direction = difference < 0 ? -1 : 1; int direction = difference < 0 ? -1 : 1;
difference *= 2 * direction; difference *= direction;
for(int c = 0; c < difference; c++) get_drive().step(direction); for(int c = 0; c < difference; c++) {
get_drive().step(Storage::Disk::HeadPosition(direction));
}
unsigned int zone = 3; unsigned int zone = 3;
if(track >= 18) zone = 2; if(track >= 18) zone = 2;
@@ -123,7 +125,7 @@ class CommodoreGCRParser: public Storage::Disk::Controller {
} }
std::shared_ptr<Sector> get_next_sector() { std::shared_ptr<Sector> get_next_sector() {
std::shared_ptr<Sector> sector(new Sector); auto sector = std::make_shared<Sector>();
const int max_index_count = index_count_ + 2; const int max_index_count = index_count_ + 2;
while(index_count_ < max_index_count) { while(index_count_ < max_index_count) {

View File

@@ -3,7 +3,7 @@
// Clock Signal // Clock Signal
// //
// Created by Thomas Harte on 13/09/2016. // Created by Thomas Harte on 13/09/2016.
// Copyright © 2016 Thomas Harte. All rights reserved. // Copyright 2016 Thomas Harte. All rights reserved.
// //
#ifndef StaticAnalyser_Commodore_Disk_hpp #ifndef StaticAnalyser_Commodore_Disk_hpp

View File

@@ -3,7 +3,7 @@
// Clock Signal // Clock Signal
// //
// Created by Thomas Harte on 10/09/2016. // Created by Thomas Harte on 10/09/2016.
// Copyright © 2016 Thomas Harte. All rights reserved. // Copyright 2016 Thomas Harte. All rights reserved.
// //
#include "File.hpp" #include "File.hpp"
@@ -21,7 +21,7 @@ bool Analyser::Static::Commodore::File::is_basic() {
// [4 bytes: address of start of next line] // [4 bytes: address of start of next line]
// [4 bytes: this line number] // [4 bytes: this line number]
// ... null-terminated code ... // ... null-terminated code ...
// (with a next line address of 0000 indicating end of program)ß // (with a next line address of 0000 indicating end of program)
while(1) { while(1) {
if(static_cast<size_t>(line_address - starting_address) >= data.size() + 2) break; if(static_cast<size_t>(line_address - starting_address) >= data.size() + 2) break;

View File

@@ -3,7 +3,7 @@
// Clock Signal // Clock Signal
// //
// Created by Thomas Harte on 10/09/2016. // Created by Thomas Harte on 10/09/2016.
// Copyright © 2016 Thomas Harte. All rights reserved. // Copyright 2016 Thomas Harte. All rights reserved.
// //
#ifndef File_hpp #ifndef File_hpp

View File

@@ -3,7 +3,7 @@
// Clock Signal // Clock Signal
// //
// Created by Thomas Harte on 06/09/2016. // Created by Thomas Harte on 06/09/2016.
// Copyright © 2016 Thomas Harte. All rights reserved. // Copyright 2016 Thomas Harte. All rights reserved.
// //
#include "StaticAnalyser.hpp" #include "StaticAnalyser.hpp"
@@ -13,8 +13,10 @@
#include "Tape.hpp" #include "Tape.hpp"
#include "Target.hpp" #include "Target.hpp"
#include "../../../Storage/Cartridge/Encodings/CommodoreROM.hpp" #include "../../../Storage/Cartridge/Encodings/CommodoreROM.hpp"
#include "../../../Outputs/Log.hpp"
#include <algorithm> #include <algorithm>
#include <cstring>
#include <sstream> #include <sstream>
using namespace Analyser::Static::Commodore; using namespace Analyser::Static::Commodore;
@@ -40,8 +42,10 @@ static std::vector<std::shared_ptr<Storage::Cartridge::Cartridge>>
return vic20_cartridges; return vic20_cartridges;
} }
void Analyser::Static::Commodore::AddTargets(const Media &media, std::vector<std::unique_ptr<Analyser::Static::Target>> &destination, const std::string &file_name) { Analyser::Static::TargetList Analyser::Static::Commodore::GetTargets(const Media &media, const std::string &file_name, TargetPlatform::IntType potential_platforms) {
std::unique_ptr<Target> target(new Target); TargetList destination;
auto target = std::make_unique<Target>();
target->machine = Machine::Vic20; // TODO: machine estimation target->machine = Machine::Vic20; // TODO: machine estimation
target->confidence = 0.5; // TODO: a proper estimation target->confidence = 0.5; // TODO: a proper estimation
@@ -75,10 +79,10 @@ void Analyser::Static::Commodore::AddTargets(const Media &media, std::vector<std
} }
if(!files.empty()) { if(!files.empty()) {
target->memory_model = Target::MemoryModel::Unexpanded; auto memory_model = Target::MemoryModel::Unexpanded;
std::ostringstream string_stream; std::ostringstream string_stream;
string_stream << "LOAD\"" << (is_disk ? "*" : "") << "\"," << device << ","; string_stream << "LOAD\"" << (is_disk ? "*" : "") << "\"," << device << ",";
if(files.front().is_basic()) { if(files.front().is_basic()) {
string_stream << "0"; string_stream << "0";
} else { } else {
string_stream << "1"; string_stream << "1";
@@ -89,18 +93,20 @@ void Analyser::Static::Commodore::AddTargets(const Media &media, std::vector<std
// make a first guess based on loading address // make a first guess based on loading address
switch(files.front().starting_address) { switch(files.front().starting_address) {
default: default:
printf("Starting address %04x?\n", files.front().starting_address); LOG("Unrecognised loading address for Commodore program: " << PADHEX(4) << files.front().starting_address);
case 0x1001: case 0x1001:
target->memory_model = Target::MemoryModel::Unexpanded; memory_model = Target::MemoryModel::Unexpanded;
break; break;
case 0x1201: case 0x1201:
target->memory_model = Target::MemoryModel::ThirtyTwoKB; memory_model = Target::MemoryModel::ThirtyTwoKB;
break; break;
case 0x0401: case 0x0401:
target->memory_model = Target::MemoryModel::EightKB; memory_model = Target::MemoryModel::EightKB;
break; break;
} }
target->set_memory_model(memory_model);
// General approach: increase memory size conservatively such that the largest file found will fit. // General approach: increase memory size conservatively such that the largest file found will fit.
// for(File &file : files) { // for(File &file : files) {
// std::size_t file_size = file.data.size(); // std::size_t file_size = file.data.size();
@@ -142,16 +148,57 @@ void Analyser::Static::Commodore::AddTargets(const Media &media, std::vector<std
} }
if(!target->media.empty()) { if(!target->media.empty()) {
// Inspect filename for a region hint. // Inspect filename for configuration hints.
std::string lowercase_name = file_name; std::string lowercase_name = file_name;
std::transform(lowercase_name.begin(), lowercase_name.end(), lowercase_name.begin(), ::tolower); std::transform(lowercase_name.begin(), lowercase_name.end(), lowercase_name.begin(), ::tolower);
// Hint 1: 'ntsc' anywhere in the name implies America.
if(lowercase_name.find("ntsc") != std::string::npos) { if(lowercase_name.find("ntsc") != std::string::npos) {
target->region = Analyser::Static::Commodore::Target::Region::American; target->region = Analyser::Static::Commodore::Target::Region::American;
} }
// Potential additional hints: check for TheC64 tags.
auto final_underscore = lowercase_name.find_last_of('_');
if(final_underscore != std::string::npos) {
auto iterator = lowercase_name.begin() + ssize_t(final_underscore) + 1;
while(iterator != lowercase_name.end()) {
// Grab the next tag.
char next_tag[3] = {0, 0, 0};
next_tag[0] = *iterator++;
if(iterator == lowercase_name.end()) break;
next_tag[1] = *iterator++;
// Exit early if attempting to read another tag has run over the file extension.
if(next_tag[0] == '.' || next_tag[1] == '.') break;
// Check whether it's anything.
target->enabled_ram.bank0 |= !strcmp(next_tag, "b0");
target->enabled_ram.bank1 |= !strcmp(next_tag, "b1");
target->enabled_ram.bank2 |= !strcmp(next_tag, "b2");
target->enabled_ram.bank3 |= !strcmp(next_tag, "b3");
target->enabled_ram.bank5 |= !strcmp(next_tag, "b5");
if(!strcmp(next_tag, "tn")) { // i.e. NTSC.
target->region = Analyser::Static::Commodore::Target::Region::American;
}
if(!strcmp(next_tag, "tp")) { // i.e. PAL.
target->region = Analyser::Static::Commodore::Target::Region::European;
}
// Unhandled:
//
// M6: this is a C64 file.
// MV: this is a Vic-20 file.
// J1/J2: this C64 file should have the primary joystick in slot 1/2.
// RO: this disk image should be treated as read-only.
}
}
// Attach a 1540 if there are any disks here. // Attach a 1540 if there are any disks here.
target->has_c1540 = !target->media.disks.empty(); target->has_c1540 = !target->media.disks.empty();
destination.push_back(std::move(target)); destination.push_back(std::move(target));
} }
return destination;
} }

View File

@@ -3,20 +3,21 @@
// Clock Signal // Clock Signal
// //
// Created by Thomas Harte on 06/09/2016. // Created by Thomas Harte on 06/09/2016.
// Copyright © 2016 Thomas Harte. All rights reserved. // Copyright 2016 Thomas Harte. All rights reserved.
// //
#ifndef StaticAnalyser_Commodore_StaticAnalyser_hpp #ifndef StaticAnalyser_Commodore_StaticAnalyser_hpp
#define StaticAnalyser_Commodore_StaticAnalyser_hpp #define StaticAnalyser_Commodore_StaticAnalyser_hpp
#include "../StaticAnalyser.hpp" #include "../StaticAnalyser.hpp"
#include "../../../Storage/TargetPlatforms.hpp"
#include <string> #include <string>
namespace Analyser { namespace Analyser {
namespace Static { namespace Static {
namespace Commodore { namespace Commodore {
void AddTargets(const Media &media, std::vector<std::unique_ptr<Target>> &destination, const std::string &file_name); TargetList GetTargets(const Media &media, const std::string &file_name, TargetPlatform::IntType potential_platforms);
} }
} }

View File

@@ -3,7 +3,7 @@
// Clock Signal // Clock Signal
// //
// Created by Thomas Harte on 24/08/2016. // Created by Thomas Harte on 24/08/2016.
// Copyright © 2016 Thomas Harte. All rights reserved. // Copyright 2016 Thomas Harte. All rights reserved.
// //
#include "Tape.hpp" #include "Tape.hpp"

View File

@@ -3,7 +3,7 @@
// Clock Signal // Clock Signal
// //
// Created by Thomas Harte on 24/08/2016. // Created by Thomas Harte on 24/08/2016.
// Copyright © 2016 Thomas Harte. All rights reserved. // Copyright 2016 Thomas Harte. All rights reserved.
// //
#ifndef StaticAnalyser_Commodore_Tape_hpp #ifndef StaticAnalyser_Commodore_Tape_hpp

View File

@@ -3,13 +3,14 @@
// Clock Signal // Clock Signal
// //
// Created by Thomas Harte on 09/03/2018. // Created by Thomas Harte on 09/03/2018.
// Copyright © 2018 Thomas Harte. All rights reserved. // Copyright 2018 Thomas Harte. All rights reserved.
// //
#ifndef Analyser_Static_Commodore_Target_h #ifndef Analyser_Static_Commodore_Target_h
#define Analyser_Static_Commodore_Target_h #define Analyser_Static_Commodore_Target_h
#include "../StaticAnalyser.hpp" #include "../StaticAnalyser.hpp"
#include <string>
namespace Analyser { namespace Analyser {
namespace Static { namespace Static {
@@ -30,9 +31,29 @@ struct Target: public ::Analyser::Static::Target {
Swedish Swedish
}; };
MemoryModel memory_model = MemoryModel::Unexpanded; /// Maps from a named memory model to a bank enabled/disabled set.
void set_memory_model(MemoryModel memory_model) {
// This is correct for unexpanded and 32kb memory models.
enabled_ram.bank0 = enabled_ram.bank1 =
enabled_ram.bank2 = enabled_ram.bank3 =
enabled_ram.bank5 = memory_model == MemoryModel::ThirtyTwoKB;
// Bank 0 will need to be enabled if this is an 8kb machine.
enabled_ram.bank0 |= memory_model == MemoryModel::EightKB;
}
struct {
bool bank0 = false;
bool bank1 = false;
bool bank2 = false;
bool bank3 = false;
bool bank5 = false;
// Sic. There is no bank 4; this is because the area that logically would be
// bank 4 is occupied by the character ROM, colour RAM, hardware registers, etc.
} enabled_ram;
Region region = Region::European; Region region = Region::European;
bool has_c1540 = false; bool has_c1540 = false;
std::string loading_command;
}; };
} }

View File

@@ -3,7 +3,7 @@
// Clock Signal // Clock Signal
// //
// Created by Thomas Harte on 10/11/2016. // Created by Thomas Harte on 10/11/2016.
// Copyright © 2016 Thomas Harte. All rights reserved. // Copyright 2016 Thomas Harte. All rights reserved.
// //
#include "6502.hpp" #include "6502.hpp"

View File

@@ -3,7 +3,7 @@
// Clock Signal // Clock Signal
// //
// Created by Thomas Harte on 10/11/2016. // Created by Thomas Harte on 10/11/2016.
// Copyright © 2016 Thomas Harte. All rights reserved. // Copyright 2016 Thomas Harte. All rights reserved.
// //
#ifndef StaticAnalyser_Disassembler_6502_hpp #ifndef StaticAnalyser_Disassembler_6502_hpp
@@ -21,7 +21,7 @@ namespace Static {
namespace MOS6502 { namespace MOS6502 {
/*! /*!
Describes a 6502 instruciton its address, the operation it performs, its addressing mode Describes a 6502 instruciton: its address, the operation it performs, its addressing mode
and its operand, if any. and its operand, if any.
*/ */
struct Instruction { struct Instruction {

View File

@@ -3,7 +3,7 @@
// Clock Signal // Clock Signal
// //
// Created by Thomas Harte on 30/12/2017. // Created by Thomas Harte on 30/12/2017.
// Copyright © 2017 Thomas Harte. All rights reserved. // Copyright 2017 Thomas Harte. All rights reserved.
// //
#include "AddressMapper.hpp" #include "AddressMapper.hpp"

View File

@@ -3,7 +3,7 @@
// Clock Signal // Clock Signal
// //
// Created by Thomas Harte on 30/12/2017. // Created by Thomas Harte on 30/12/2017.
// Copyright © 2017 Thomas Harte. All rights reserved. // Copyright 2017 Thomas Harte. All rights reserved.
// //
#ifndef AddressMapper_hpp #ifndef AddressMapper_hpp

View File

@@ -3,7 +3,7 @@
// Clock Signal // Clock Signal
// //
// Created by Thomas Harte on 31/12/2017. // Created by Thomas Harte on 31/12/2017.
// Copyright © 2017 Thomas Harte. All rights reserved. // Copyright 2017 Thomas Harte. All rights reserved.
// //
#ifndef Kernel_hpp #ifndef Kernel_hpp

View File

@@ -3,7 +3,7 @@
// Clock Signal // Clock Signal
// //
// Created by Thomas Harte on 30/12/2017. // Created by Thomas Harte on 30/12/2017.
// Copyright © 2017 Thomas Harte. All rights reserved. // Copyright 2017 Thomas Harte. All rights reserved.
// //
#include "Z80.hpp" #include "Z80.hpp"
@@ -63,9 +63,9 @@ class Accessor {
#define z(v) (v & 7) #define z(v) (v & 7)
Instruction::Condition condition_table[] = { Instruction::Condition condition_table[] = {
Instruction::Condition::NZ, Instruction::Condition::Z, Instruction::Condition::NZ, Instruction::Condition::Z,
Instruction::Condition::NC, Instruction::Condition::C, Instruction::Condition::NC, Instruction::Condition::C,
Instruction::Condition::PO, Instruction::Condition::PE, Instruction::Condition::PO, Instruction::Condition::PE,
Instruction::Condition::P, Instruction::Condition::M Instruction::Condition::P, Instruction::Condition::M
}; };

View File

@@ -3,7 +3,7 @@
// Clock Signal // Clock Signal
// //
// Created by Thomas Harte on 30/12/2017. // Created by Thomas Harte on 30/12/2017.
// Copyright © 2017 Thomas Harte. All rights reserved. // Copyright 2017 Thomas Harte. All rights reserved.
// //
#ifndef StaticAnalyser_Disassembler_Z80_hpp #ifndef StaticAnalyser_Disassembler_Z80_hpp

View File

@@ -0,0 +1,125 @@
//
// StaticAnalyser.cpp
// Clock Signal
//
// Created by Thomas Harte on 03/05/2018.
// Copyright 2018 Thomas Harte. All rights reserved.
//
#include "StaticAnalyser.hpp"
#include "../AppleII/Target.hpp"
#include "../Oric/Target.hpp"
#include "../Disassembler/6502.hpp"
#include "../Disassembler/AddressMapper.hpp"
#include "../../../Storage/Disk/Track/TrackSerialiser.hpp"
#include "../../../Storage/Disk/Encodings/AppleGCR/SegmentParser.hpp"
namespace {
Analyser::Static::Target *AppleTarget(const Storage::Encodings::AppleGCR::Sector *sector_zero) {
using Target = Analyser::Static::AppleII::Target;
auto *target = new Target;
target->machine = Analyser::Machine::AppleII;
if(sector_zero && sector_zero->encoding == Storage::Encodings::AppleGCR::Sector::Encoding::FiveAndThree) {
target->disk_controller = Target::DiskController::ThirteenSector;
} else {
target->disk_controller = Target::DiskController::SixteenSector;
}
return target;
}
Analyser::Static::Target *OricTarget(const Storage::Encodings::AppleGCR::Sector *sector_zero) {
using Target = Analyser::Static::Oric::Target;
auto *target = new Target;
target->machine = Analyser::Machine::Oric;
target->rom = Target::ROM::Pravetz;
target->disk_interface = Target::DiskInterface::Pravetz;
target->loading_command = "CALL 800\n";
return target;
}
}
Analyser::Static::TargetList Analyser::Static::DiskII::GetTargets(const Media &media, const std::string &file_name, TargetPlatform::IntType potential_platforms) {
// This analyser can comprehend disks only.
if(media.disks.empty()) return {};
// Grab track 0, sector 0: the boot sector.
auto track_zero = media.disks.front()->get_track_at_position(Storage::Disk::Track::Address(0, Storage::Disk::HeadPosition(0)));
auto sector_map = Storage::Encodings::AppleGCR::sectors_from_segment(
Storage::Disk::track_serialisation(*track_zero, Storage::Time(1, 50000)));
const Storage::Encodings::AppleGCR::Sector *sector_zero = nullptr;
for(const auto &pair: sector_map) {
if(!pair.second.address.sector) {
sector_zero = &pair.second;
break;
}
}
// If there's no boot sector then if there are also no sectors at all,
// decline to nominate a machine. Otherwise go with an Apple as the default.
TargetList targets;
if(!sector_zero) {
if(sector_map.empty()) {
return targets;
} else {
targets.push_back(std::unique_ptr<Analyser::Static::Target>(AppleTarget(nullptr)));
targets.back()->media = media;
return targets;
}
}
// If the boot sector looks like it's intended for the Oric, create an Oric.
// Otherwise go with the Apple II.
auto disassembly = Analyser::Static::MOS6502::Disassemble(sector_zero->data, Analyser::Static::Disassembler::OffsetMapper(0xb800), {0xb800});
bool did_read_shift_register = false;
bool is_oric = false;
// Look for a tight BPL loop reading the Oric's shift register address of 0x31c. The Apple II just has RAM there,
// so the probability of such a loop is infinitesimal.
for(const auto &instruction: disassembly.instructions_by_address) {
// Is this a read of the shift register?
if(
(
(instruction.second.operation == Analyser::Static::MOS6502::Instruction::LDA) ||
(instruction.second.operation == Analyser::Static::MOS6502::Instruction::LDX) ||
(instruction.second.operation == Analyser::Static::MOS6502::Instruction::LDY)
) &&
instruction.second.addressing_mode == Analyser::Static::MOS6502::Instruction::Absolute &&
instruction.second.address == 0x031c) {
did_read_shift_register = true;
continue;
}
if(did_read_shift_register) {
if(
instruction.second.operation == Analyser::Static::MOS6502::Instruction::BPL &&
instruction.second.address == 0xfb) {
is_oric = true;
break;
}
did_read_shift_register = false;
}
}
// Check also for calls into the 0x3xx page above 0x320, as that's where the Oric's boot ROM is.
for(const auto address: disassembly.outward_calls) {
is_oric |= address >= 0x320 && address < 0x400;
}
if(is_oric) {
targets.push_back(std::unique_ptr<Analyser::Static::Target>(OricTarget(sector_zero)));
} else {
targets.push_back(std::unique_ptr<Analyser::Static::Target>(AppleTarget(sector_zero)));
}
targets.back()->media = media;
return targets;
}

View File

@@ -0,0 +1,27 @@
//
// StaticAnalyser.hpp
// Clock Signal
//
// Created by Thomas Harte on 03/05/2018.
// Copyright 2018 Thomas Harte. All rights reserved.
//
#ifndef Analyser_Static_DiskII_StaticAnalyser_hpp
#define Analyser_Static_DiskII_StaticAnalyser_hpp
#include "../StaticAnalyser.hpp"
#include "../../../Storage/TargetPlatforms.hpp"
#include <string>
namespace Analyser {
namespace Static {
namespace DiskII {
TargetList GetTargets(const Media &media, const std::string &file_name, TargetPlatform::IntType potential_platforms);
}
}
}
#endif /* Analyser_Static_DiskII_StaticAnalyser_hpp */

View File

@@ -3,7 +3,7 @@
// Clock Signal // Clock Signal
// //
// Created by Thomas Harte on 25/01/2018. // Created by Thomas Harte on 25/01/2018.
// Copyright © 2018 Thomas Harte. All rights reserved. // Copyright 2018 Thomas Harte. All rights reserved.
// //
#ifndef Cartridge_hpp #ifndef Cartridge_hpp

View File

@@ -3,7 +3,7 @@
// Clock Signal // Clock Signal
// //
// Created by Thomas Harte on 25/11/2017. // Created by Thomas Harte on 25/11/2017.
// Copyright © 2017 Thomas Harte. All rights reserved. // Copyright 2017 Thomas Harte. All rights reserved.
// //
#include "StaticAnalyser.hpp" #include "StaticAnalyser.hpp"
@@ -34,7 +34,7 @@ static std::unique_ptr<Analyser::Static::Target> CartridgeTarget(
output_segments.emplace_back(start_address, segment.data); output_segments.emplace_back(start_address, segment.data);
} }
std::unique_ptr<Analyser::Static::MSX::Target> target(new Analyser::Static::MSX::Target); auto target = std::make_unique<Analyser::Static::MSX::Target>();
target->machine = Analyser::Machine::MSX; target->machine = Analyser::Machine::MSX;
target->confidence = confidence; target->confidence = confidence;
@@ -63,14 +63,14 @@ static std::unique_ptr<Analyser::Static::Target> CartridgeTarget(
(additional audio hardware is also sometimes included, but it's implied by the banking hardware) (additional audio hardware is also sometimes included, but it's implied by the banking hardware)
*/ */
static std::vector<std::unique_ptr<Analyser::Static::Target>> CartridgeTargetsFrom( static Analyser::Static::TargetList CartridgeTargetsFrom(
const std::vector<std::shared_ptr<Storage::Cartridge::Cartridge>> &cartridges) { const std::vector<std::shared_ptr<Storage::Cartridge::Cartridge>> &cartridges) {
// No cartridges implies no targets. // No cartridges implies no targets.
if(cartridges.empty()) { if(cartridges.empty()) {
return {}; return {};
} }
std::vector<std::unique_ptr<Analyser::Static::Target>> targets; Analyser::Static::TargetList targets;
for(const auto &cartridge : cartridges) { for(const auto &cartridge : cartridges) {
const auto &segments = cartridge->get_segments(); const auto &segments = cartridge->get_segments();
@@ -261,16 +261,18 @@ static std::vector<std::unique_ptr<Analyser::Static::Target>> CartridgeTargetsFr
return targets; return targets;
} }
void Analyser::Static::MSX::AddTargets(const Media &media, std::vector<std::unique_ptr<::Analyser::Static::Target>> &destination) { Analyser::Static::TargetList Analyser::Static::MSX::GetTargets(const Media &media, const std::string &file_name, TargetPlatform::IntType potential_platforms) {
TargetList destination;
// Append targets for any cartridges that look correct. // Append targets for any cartridges that look correct.
auto cartridge_targets = CartridgeTargetsFrom(media.cartridges); auto cartridge_targets = CartridgeTargetsFrom(media.cartridges);
std::move(cartridge_targets.begin(), cartridge_targets.end(), std::back_inserter(destination)); std::move(cartridge_targets.begin(), cartridge_targets.end(), std::back_inserter(destination));
// Consider building a target for disks and/or tapes. // Consider building a target for disks and/or tapes.
std::unique_ptr<Target> target(new Target); auto target = std::make_unique<Target>();
// Check tapes for loadable files. // Check tapes for loadable files.
for(const auto &tape : media.tapes) { for(auto &tape : media.tapes) {
std::vector<File> files_on_tape = GetFiles(tape); std::vector<File> files_on_tape = GetFiles(tape);
if(!files_on_tape.empty()) { if(!files_on_tape.empty()) {
switch(files_on_tape.front().type) { switch(files_on_tape.front().type) {
@@ -283,7 +285,12 @@ void Analyser::Static::MSX::AddTargets(const Media &media, std::vector<std::uniq
} }
} }
// Region selection: for now, this as simple as:
// "If a tape is involved, be European. Otherwise be American (i.e. English, but 60Hz)".
target->region = target->media.tapes.empty() ? Target::Region::USA : Target::Region::Europe;
// Blindly accept disks for now. // Blindly accept disks for now.
// TODO: how to spot an MSX disk?
target->media.disks = media.disks; target->media.disks = media.disks;
target->has_disk_drive = !media.disks.empty(); target->has_disk_drive = !media.disks.empty();
@@ -292,4 +299,6 @@ void Analyser::Static::MSX::AddTargets(const Media &media, std::vector<std::uniq
target->confidence = 0.5; target->confidence = 0.5;
destination.push_back(std::move(target)); destination.push_back(std::move(target));
} }
return destination;
} }

View File

@@ -3,19 +3,21 @@
// Clock Signal // Clock Signal
// //
// Created by Thomas Harte on 25/11/2017. // Created by Thomas Harte on 25/11/2017.
// Copyright © 2017 Thomas Harte. All rights reserved. // Copyright 2017 Thomas Harte. All rights reserved.
// //
#ifndef StaticAnalyser_MSX_StaticAnalyser_hpp #ifndef StaticAnalyser_MSX_StaticAnalyser_hpp
#define StaticAnalyser_MSX_StaticAnalyser_hpp #define StaticAnalyser_MSX_StaticAnalyser_hpp
#include "../StaticAnalyser.hpp" #include "../StaticAnalyser.hpp"
#include "../../../Storage/TargetPlatforms.hpp"
#include <string>
namespace Analyser { namespace Analyser {
namespace Static { namespace Static {
namespace MSX { namespace MSX {
void AddTargets(const Media &media, std::vector<std::unique_ptr<Target>> &destination); TargetList GetTargets(const Media &media, const std::string &file_name, TargetPlatform::IntType potential_platforms);
} }
} }

View File

@@ -3,7 +3,7 @@
// Clock Signal // Clock Signal
// //
// Created by Thomas Harte on 25/12/2017. // Created by Thomas Harte on 25/12/2017.
// Copyright © 2017 Thomas Harte. All rights reserved. // Copyright 2017 Thomas Harte. All rights reserved.
// //
#include "Tape.hpp" #include "Tape.hpp"

View File

@@ -3,7 +3,7 @@
// Clock Signal // Clock Signal
// //
// Created by Thomas Harte on 25/12/2017. // Created by Thomas Harte on 25/12/2017.
// Copyright © 2017 Thomas Harte. All rights reserved. // Copyright 2017 Thomas Harte. All rights reserved.
// //
#ifndef StaticAnalyser_MSX_Tape_hpp #ifndef StaticAnalyser_MSX_Tape_hpp

View File

@@ -3,13 +3,14 @@
// Clock Signal // Clock Signal
// //
// Created by Thomas Harte on 02/04/2018. // Created by Thomas Harte on 02/04/2018.
// Copyright © 2018 Thomas Harte. All rights reserved. // Copyright 2018 Thomas Harte. All rights reserved.
// //
#ifndef Analyser_Static_MSX_Target_h #ifndef Analyser_Static_MSX_Target_h
#define Analyser_Static_MSX_Target_h #define Analyser_Static_MSX_Target_h
#include "../StaticAnalyser.hpp" #include "../StaticAnalyser.hpp"
#include <string>
namespace Analyser { namespace Analyser {
namespace Static { namespace Static {
@@ -17,6 +18,13 @@ namespace MSX {
struct Target: public ::Analyser::Static::Target { struct Target: public ::Analyser::Static::Target {
bool has_disk_drive = false; bool has_disk_drive = false;
std::string loading_command;
enum class Region {
Japan,
USA,
Europe
} region = Region::USA;
}; };
} }

View File

@@ -0,0 +1,26 @@
//
// StaticAnalyser.cpp
// Clock Signal
//
// Created by Thomas Harte on 02/06/2019.
// Copyright © 2019 Thomas Harte. All rights reserved.
//
#include "StaticAnalyser.hpp"
#include "Target.hpp"
Analyser::Static::TargetList Analyser::Static::Macintosh::GetTargets(const Media &media, const std::string &file_name, TargetPlatform::IntType potential_platforms) {
// This analyser can comprehend disks and mass-storage devices only.
if(media.disks.empty() && media.mass_storage_devices.empty()) return {};
// As there is at least one usable media image, wave it through.
Analyser::Static::TargetList targets;
using Target = Analyser::Static::Macintosh::Target;
auto *target = new Target;
target->machine = Analyser::Machine::Macintosh;
target->media = media;
targets.push_back(std::unique_ptr<Analyser::Static::Target>(target));
return targets;
}

View File

@@ -0,0 +1,27 @@
//
// StaticAnalyser.hpp
// Clock Signal
//
// Created by Thomas Harte on 02/06/2019.
// Copyright © 2019 Thomas Harte. All rights reserved.
//
#ifndef Analyser_Static_Macintosh_StaticAnalyser_hpp
#define Analyser_Static_Macintosh_StaticAnalyser_hpp
#include "../StaticAnalyser.hpp"
#include "../../../Storage/TargetPlatforms.hpp"
#include <string>
namespace Analyser {
namespace Static {
namespace Macintosh {
TargetList GetTargets(const Media &media, const std::string &file_name, TargetPlatform::IntType potential_platforms);
}
}
}
#endif /* Analyser_Static_Macintosh_StaticAnalyser_hpp */

View File

@@ -0,0 +1,31 @@
//
// Target.hpp
// Clock Signal
//
// Created by Thomas Harte on 03/06/2019.
// Copyright © 2019 Thomas Harte. All rights reserved.
//
#ifndef Analyser_Static_Macintosh_Target_h
#define Analyser_Static_Macintosh_Target_h
namespace Analyser {
namespace Static {
namespace Macintosh {
struct Target: public ::Analyser::Static::Target {
enum class Model {
Mac128k,
Mac512k,
Mac512ke,
MacPlus
};
Model model = Model::MacPlus;
};
}
}
}
#endif /* Analyser_Static_Macintosh_Target_h */

View File

@@ -3,7 +3,7 @@
// Clock Signal // Clock Signal
// //
// Created by Thomas Harte on 11/10/2016. // Created by Thomas Harte on 11/10/2016.
// Copyright © 2016 Thomas Harte. All rights reserved. // Copyright 2016 Thomas Harte. All rights reserved.
// //
#include "StaticAnalyser.hpp" #include "StaticAnalyser.hpp"
@@ -23,15 +23,15 @@ using namespace Analyser::Static::Oric;
static int Score(const Analyser::Static::MOS6502::Disassembly &disassembly, const std::set<uint16_t> &rom_functions, const std::set<uint16_t> &variable_locations) { static int Score(const Analyser::Static::MOS6502::Disassembly &disassembly, const std::set<uint16_t> &rom_functions, const std::set<uint16_t> &variable_locations) {
int score = 0; int score = 0;
for(auto address : disassembly.outward_calls) score += (rom_functions.find(address) != rom_functions.end()) ? 1 : -1; for(const auto address : disassembly.outward_calls) score += (rom_functions.find(address) != rom_functions.end()) ? 1 : -1;
for(auto address : disassembly.external_stores) score += (variable_locations.find(address) != variable_locations.end()) ? 1 : -1; for(const auto address : disassembly.external_stores) score += (variable_locations.find(address) != variable_locations.end()) ? 1 : -1;
for(auto address : disassembly.external_loads) score += (variable_locations.find(address) != variable_locations.end()) ? 1 : -1; for(const auto address : disassembly.external_loads) score += (variable_locations.find(address) != variable_locations.end()) ? 1 : -1;
return score; return score;
} }
static int Basic10Score(const Analyser::Static::MOS6502::Disassembly &disassembly) { static int Basic10Score(const Analyser::Static::MOS6502::Disassembly &disassembly) {
std::set<uint16_t> rom_functions = { const std::set<uint16_t> rom_functions = {
0x0228, 0x022b, 0x0228, 0x022b,
0xc3ca, 0xc3f8, 0xc448, 0xc47c, 0xc4b5, 0xc4e3, 0xc4e0, 0xc524, 0xc56f, 0xc5a2, 0xc5f8, 0xc60a, 0xc6a5, 0xc6de, 0xc719, 0xc738, 0xc3ca, 0xc3f8, 0xc448, 0xc47c, 0xc4b5, 0xc4e3, 0xc4e0, 0xc524, 0xc56f, 0xc5a2, 0xc5f8, 0xc60a, 0xc6a5, 0xc6de, 0xc719, 0xc738,
0xc773, 0xc824, 0xc832, 0xc841, 0xc8c1, 0xc8fe, 0xc91f, 0xc93f, 0xc941, 0xc91e, 0xc98b, 0xc996, 0xc9b3, 0xc9e0, 0xca0a, 0xca1c, 0xc773, 0xc824, 0xc832, 0xc841, 0xc8c1, 0xc8fe, 0xc91f, 0xc93f, 0xc941, 0xc91e, 0xc98b, 0xc996, 0xc9b3, 0xc9e0, 0xca0a, 0xca1c,
@@ -47,7 +47,7 @@ static int Basic10Score(const Analyser::Static::MOS6502::Disassembly &disassembl
0xf43c, 0xf4ef, 0xf523, 0xf561, 0xf535, 0xf57b, 0xf5d3, 0xf71a, 0xf73f, 0xf7e4, 0xf7e0, 0xf82f, 0xf88f, 0xf8af, 0xf8b5, 0xf920, 0xf43c, 0xf4ef, 0xf523, 0xf561, 0xf535, 0xf57b, 0xf5d3, 0xf71a, 0xf73f, 0xf7e4, 0xf7e0, 0xf82f, 0xf88f, 0xf8af, 0xf8b5, 0xf920,
0xf967, 0xf960, 0xf9c9, 0xfa14, 0xfa85, 0xfa9b, 0xfab1, 0xfac7, 0xfafa, 0xfb10, 0xfb26, 0xfbb6, 0xfbfe 0xf967, 0xf960, 0xf9c9, 0xfa14, 0xfa85, 0xfa9b, 0xfab1, 0xfac7, 0xfafa, 0xfb10, 0xfb26, 0xfbb6, 0xfbfe
}; };
std::set<uint16_t> variable_locations = { const std::set<uint16_t> variable_locations = {
0x0228, 0x0229, 0x022a, 0x022b, 0x022c, 0x022d, 0x0230 0x0228, 0x0229, 0x022a, 0x022b, 0x022c, 0x022d, 0x0230
}; };
@@ -55,7 +55,7 @@ static int Basic10Score(const Analyser::Static::MOS6502::Disassembly &disassembl
} }
static int Basic11Score(const Analyser::Static::MOS6502::Disassembly &disassembly) { static int Basic11Score(const Analyser::Static::MOS6502::Disassembly &disassembly) {
std::set<uint16_t> rom_functions = { const std::set<uint16_t> rom_functions = {
0x0238, 0x023b, 0x023e, 0x0241, 0x0244, 0x0247, 0x0238, 0x023b, 0x023e, 0x0241, 0x0244, 0x0247,
0xc3c6, 0xc3f4, 0xc444, 0xc47c, 0xc4a8, 0xc4d3, 0xc4e0, 0xc524, 0xc55f, 0xc592, 0xc5e8, 0xc5fa, 0xc692, 0xc6b3, 0xc6ee, 0xc70d, 0xc3c6, 0xc3f4, 0xc444, 0xc47c, 0xc4a8, 0xc4d3, 0xc4e0, 0xc524, 0xc55f, 0xc592, 0xc5e8, 0xc5fa, 0xc692, 0xc6b3, 0xc6ee, 0xc70d,
0xc748, 0xc7fd, 0xc809, 0xc816, 0xc82f, 0xc855, 0xc8c1, 0xc915, 0xc952, 0xc971, 0xc973, 0xc9a0, 0xc9bd, 0xc9c8, 0xc9e5, 0xca12, 0xc748, 0xc7fd, 0xc809, 0xc816, 0xc82f, 0xc855, 0xc8c1, 0xc915, 0xc952, 0xc971, 0xc973, 0xc9a0, 0xc9bd, 0xc9c8, 0xc9e5, 0xca12,
@@ -72,7 +72,7 @@ static int Basic11Score(const Analyser::Static::MOS6502::Disassembly &disassembl
0xf88f, 0xf8af, 0xf8b5, 0xf920, 0xf967, 0xf9aa, 0xf9c9, 0xfa14, 0xfa9f, 0xfab5, 0xfacb, 0xfae1, 0xfb14, 0xfb2a, 0xfb40, 0xfbd0, 0xf88f, 0xf8af, 0xf8b5, 0xf920, 0xf967, 0xf9aa, 0xf9c9, 0xfa14, 0xfa9f, 0xfab5, 0xfacb, 0xfae1, 0xfb14, 0xfb2a, 0xfb40, 0xfbd0,
0xfc18 0xfc18
}; };
std::set<uint16_t> variable_locations = { const std::set<uint16_t> variable_locations = {
0x0244, 0x0245, 0x0246, 0x0247, 0x0248, 0x0249, 0x024a, 0x024b, 0x024c 0x0244, 0x0245, 0x0246, 0x0247, 0x0248, 0x0249, 0x024a, 0x024b, 0x024c
}; };
@@ -100,8 +100,8 @@ static bool IsMicrodisc(Storage::Encodings::MFM::Parser &parser) {
return !std::memcmp(signature, first_sample.data(), sizeof(signature)); return !std::memcmp(signature, first_sample.data(), sizeof(signature));
} }
void Analyser::Static::Oric::AddTargets(const Media &media, std::vector<std::unique_ptr<Analyser::Static::Target>> &destination) { Analyser::Static::TargetList Analyser::Static::Oric::GetTargets(const Media &media, const std::string &file_name, TargetPlatform::IntType potential_platforms) {
std::unique_ptr<Target> target(new Target); auto target = std::make_unique<Target>();
target->machine = Machine::Oric; target->machine = Machine::Oric;
target->confidence = 0.5; target->confidence = 0.5;
@@ -111,8 +111,8 @@ void Analyser::Static::Oric::AddTargets(const Media &media, std::vector<std::uni
for(auto &tape : media.tapes) { for(auto &tape : media.tapes) {
std::vector<File> tape_files = GetFiles(tape); std::vector<File> tape_files = GetFiles(tape);
tape->reset(); tape->reset();
if(tape_files.size()) { if(!tape_files.empty()) {
for(auto file : tape_files) { for(const auto &file : tape_files) {
if(file.data_type == File::MachineCode) { if(file.data_type == File::MachineCode) {
std::vector<uint16_t> entry_points = {file.starting_address}; std::vector<uint16_t> entry_points = {file.starting_address};
Analyser::Static::MOS6502::Disassembly disassembly = Analyser::Static::MOS6502::Disassembly disassembly =
@@ -131,21 +131,25 @@ void Analyser::Static::Oric::AddTargets(const Media &media, std::vector<std::uni
if(!media.disks.empty()) { if(!media.disks.empty()) {
// Only the Microdisc is emulated right now, so accept only disks that it can boot from. // Only the Microdisc is emulated right now, so accept only disks that it can boot from.
for(const auto &disk: media.disks) { for(auto &disk: media.disks) {
Storage::Encodings::MFM::Parser parser(true, disk); Storage::Encodings::MFM::Parser parser(true, disk);
if(IsMicrodisc(parser)) { if(IsMicrodisc(parser)) {
target->has_microdrive = true; target->disk_interface = Target::DiskInterface::Microdisc;
target->media.disks.push_back(disk); target->media.disks.push_back(disk);
} }
} }
} else {
target->has_microdrive = false;
} }
else
target->disk_interface = Target::DiskInterface::None;
// TODO: really this should add two targets if not all votes agree // TODO: really this should add two targets if not all votes agree
target->use_atmos_rom = basic11_votes >= basic10_votes; if(basic11_votes >= basic10_votes || target->disk_interface == Target::DiskInterface::Microdisc)
if(target->has_microdrive) target->use_atmos_rom = true; target->rom = Target::ROM::BASIC11;
else
target->rom = Target::ROM::BASIC10;
TargetList targets;
if(target->media.tapes.size() || target->media.disks.size() || target->media.cartridges.size()) if(target->media.tapes.size() || target->media.disks.size() || target->media.cartridges.size())
destination.push_back(std::move(target)); targets.push_back(std::move(target));
return targets;
} }

View File

@@ -3,19 +3,21 @@
// Clock Signal // Clock Signal
// //
// Created by Thomas Harte on 11/10/2016. // Created by Thomas Harte on 11/10/2016.
// Copyright © 2016 Thomas Harte. All rights reserved. // Copyright 2016 Thomas Harte. All rights reserved.
// //
#ifndef StaticAnalyser_Oric_StaticAnalyser_hpp #ifndef StaticAnalyser_Oric_StaticAnalyser_hpp
#define StaticAnalyser_Oric_StaticAnalyser_hpp #define StaticAnalyser_Oric_StaticAnalyser_hpp
#include "../StaticAnalyser.hpp" #include "../StaticAnalyser.hpp"
#include "../../../Storage/TargetPlatforms.hpp"
#include <string>
namespace Analyser { namespace Analyser {
namespace Static { namespace Static {
namespace Oric { namespace Oric {
void AddTargets(const Media &media, std::vector<std::unique_ptr<Target>> &destination); TargetList GetTargets(const Media &media, const std::string &file_name, TargetPlatform::IntType potential_platforms);
} }
} }

View File

@@ -3,7 +3,7 @@
// Clock Signal // Clock Signal
// //
// Created by Thomas Harte on 06/11/2016. // Created by Thomas Harte on 06/11/2016.
// Copyright © 2016 Thomas Harte. All rights reserved. // Copyright 2016 Thomas Harte. All rights reserved.
// //
#include "Tape.hpp" #include "Tape.hpp"

View File

@@ -3,7 +3,7 @@
// Clock Signal // Clock Signal
// //
// Created by Thomas Harte on 06/11/2016. // Created by Thomas Harte on 06/11/2016.
// Copyright © 2016 Thomas Harte. All rights reserved. // Copyright 2016 Thomas Harte. All rights reserved.
// //
#ifndef StaticAnalyser_Oric_Tape_hpp #ifndef StaticAnalyser_Oric_Tape_hpp

View File

@@ -3,19 +3,35 @@
// Clock Signal // Clock Signal
// //
// Created by Thomas Harte on 09/03/2018. // Created by Thomas Harte on 09/03/2018.
// Copyright © 2018 Thomas Harte. All rights reserved. // Copyright 2018 Thomas Harte. All rights reserved.
// //
#ifndef Analyser_Static_Oric_Target_h #ifndef Analyser_Static_Oric_Target_h
#define Analyser_Static_Oric_Target_h #define Analyser_Static_Oric_Target_h
#include "../StaticAnalyser.hpp"
#include <string>
namespace Analyser { namespace Analyser {
namespace Static { namespace Static {
namespace Oric { namespace Oric {
struct Target: public ::Analyser::Static::Target { struct Target: public ::Analyser::Static::Target {
bool use_atmos_rom = false; enum class ROM {
bool has_microdrive = false; BASIC10,
BASIC11,
Pravetz
};
enum class DiskInterface {
Microdisc,
Pravetz,
None
};
ROM rom = ROM::BASIC11;
DiskInterface disk_interface = DiskInterface::None;
std::string loading_command;
}; };
} }

View File

@@ -0,0 +1,82 @@
//
// StaticAnalyser.cpp
// Clock Signal
//
// Created by Thomas Harte on 20/09/2018.
// Copyright © 2018 Thomas Harte. All rights reserved.
//
#include "StaticAnalyser.hpp"
#include "Target.hpp"
#include <algorithm>
#include <cstring>
Analyser::Static::TargetList Analyser::Static::Sega::GetTargets(const Media &media, const std::string &file_name, TargetPlatform::IntType potential_platforms) {
if(media.cartridges.empty())
return {};
TargetList targets;
auto target = std::make_unique<Target>();
target->machine = Machine::MasterSystem;
// Files named .sg are treated as for the SG1000; otherwise assume a Master System.
if(file_name.size() >= 2 && *(file_name.end() - 2) == 's' && *(file_name.end() - 1) == 'g') {
target->model = Target::Model::SG1000;
} else {
target->model = Target::Model::MasterSystem;
}
// If this is a Master System title, look for a ROM header.
if(target->model == Target::Model::MasterSystem) {
const auto &data = media.cartridges.front()->get_segments()[0].data;
// First try to locate a header.
size_t header_offset = 0;
size_t potential_offsets[] = {0x1ff0, 0x3ff0, 0x7ff0};
for(auto potential_offset: potential_offsets) {
if(!memcmp(&data[potential_offset], "TMR SEGA", 8)) {
header_offset = potential_offset;
break;
}
}
// If a header was found, use it to crib region.
if(header_offset) {
// Treat export titles as European by default; decline to
// do so only if (US) or (NTSC) is in the file name.
const uint8_t region = data[header_offset + 0x0f] >> 4;
switch(region) {
default: break;
case 4: {
std::string lowercase_name = file_name;
std::transform(lowercase_name.begin(), lowercase_name.end(), lowercase_name.begin(), ::tolower);
if(lowercase_name.find("(jp)") == std::string::npos) {
target->region =
(lowercase_name.find("(us)") == std::string::npos &&
lowercase_name.find("(ntsc)") == std::string::npos) ? Target::Region::Europe : Target::Region::USA;
}
} break;
}
// Also check for a Codemasters header.
// If one is found, set the paging scheme appropriately.
const uint16_t inverse_checksum = uint16_t(0x10000 - (data[0x7fe6] | (data[0x7fe7] << 8)));
if(
data[0x7fe3] >= 0x87 && data[0x7fe3] < 0x96 && // i.e. game is dated between 1987 and 1996
(inverse_checksum&0xff) == data[0x7fe8] &&
(inverse_checksum >> 8) == data[0x7fe9] && // i.e. the standard checksum appears to be present
!data[0x7fea] && !data[0x7feb] && !data[0x7fec] && !data[0x7fed] && !data[0x7fee] && !data[0x7fef]
) {
target->paging_scheme = Target::PagingScheme::Codemasters;
target->model = Target::Model::MasterSystem2;
}
}
}
target->media.cartridges = media.cartridges;
targets.push_back(std::move(target));
return targets;
}

View File

@@ -0,0 +1,26 @@
//
// StaticAnalyser.hpp
// Clock Signal
//
// Created by Thomas Harte on 20/09/2018.
// Copyright © 2018 Thomas Harte. All rights reserved.
//
#ifndef StaticAnalyser_Sega_StaticAnalyser_hpp
#define StaticAnalyser_Sega_StaticAnalyser_hpp
#include "../StaticAnalyser.hpp"
#include "../../../Storage/TargetPlatforms.hpp"
#include <string>
namespace Analyser {
namespace Static {
namespace Sega {
TargetList GetTargets(const Media &media, const std::string &file_name, TargetPlatform::IntType potential_platforms);
}
}
}
#endif /* StaticAnalyser_hpp */

View File

@@ -0,0 +1,46 @@
//
// Target.hpp
// Clock Signal
//
// Created by Thomas Harte on 23/09/2018.
// Copyright © 2018 Thomas Harte. All rights reserved.
//
#ifndef Analyser_Static_Sega_Target_h
#define Analyser_Static_Sega_Target_h
namespace Analyser {
namespace Static {
namespace Sega {
struct Target: public ::Analyser::Static::Target {
enum class Model {
SG1000,
MasterSystem,
MasterSystem2,
};
enum class Region {
Japan,
USA,
Europe,
Brazil
};
enum class PagingScheme {
Sega,
Codemasters
};
Model model = Model::MasterSystem;
Region region = Region::Japan;
PagingScheme paging_scheme = PagingScheme::Sega;
};
#define is_master_system(v) v >= Analyser::Static::Sega::Target::Model::MasterSystem
}
}
}
#endif /* Analyser_Static_Sega_Target_h */

View File

@@ -3,7 +3,7 @@
// Clock Signal // Clock Signal
// //
// Created by Thomas Harte on 23/08/2016. // Created by Thomas Harte on 23/08/2016.
// Copyright © 2016 Thomas Harte. All rights reserved. // Copyright 2016 Thomas Harte. All rights reserved.
// //
#include "StaticAnalyser.hpp" #include "StaticAnalyser.hpp"
@@ -11,15 +11,21 @@
#include <algorithm> #include <algorithm>
#include <cstdlib> #include <cstdlib>
#include <cstring> #include <cstring>
#include <iterator>
// Analysers // Analysers
#include "Acorn/StaticAnalyser.hpp" #include "Acorn/StaticAnalyser.hpp"
#include "AmstradCPC/StaticAnalyser.hpp" #include "AmstradCPC/StaticAnalyser.hpp"
#include "Atari/StaticAnalyser.hpp" #include "AppleII/StaticAnalyser.hpp"
#include "Atari2600/StaticAnalyser.hpp"
#include "AtariST/StaticAnalyser.hpp"
#include "Coleco/StaticAnalyser.hpp" #include "Coleco/StaticAnalyser.hpp"
#include "Commodore/StaticAnalyser.hpp" #include "Commodore/StaticAnalyser.hpp"
#include "DiskII/StaticAnalyser.hpp"
#include "Macintosh/StaticAnalyser.hpp"
#include "MSX/StaticAnalyser.hpp" #include "MSX/StaticAnalyser.hpp"
#include "Oric/StaticAnalyser.hpp" #include "Oric/StaticAnalyser.hpp"
#include "Sega/StaticAnalyser.hpp"
#include "ZX8081/StaticAnalyser.hpp" #include "ZX8081/StaticAnalyser.hpp"
// Cartridges // Cartridges
@@ -28,14 +34,23 @@
// Disks // Disks
#include "../../Storage/Disk/DiskImage/Formats/AcornADF.hpp" #include "../../Storage/Disk/DiskImage/Formats/AcornADF.hpp"
#include "../../Storage/Disk/DiskImage/Formats/AppleDSK.hpp"
#include "../../Storage/Disk/DiskImage/Formats/CPCDSK.hpp" #include "../../Storage/Disk/DiskImage/Formats/CPCDSK.hpp"
#include "../../Storage/Disk/DiskImage/Formats/D64.hpp" #include "../../Storage/Disk/DiskImage/Formats/D64.hpp"
#include "../../Storage/Disk/DiskImage/Formats/MacintoshIMG.hpp"
#include "../../Storage/Disk/DiskImage/Formats/G64.hpp" #include "../../Storage/Disk/DiskImage/Formats/G64.hpp"
#include "../../Storage/Disk/DiskImage/Formats/DMK.hpp" #include "../../Storage/Disk/DiskImage/Formats/DMK.hpp"
#include "../../Storage/Disk/DiskImage/Formats/HFE.hpp" #include "../../Storage/Disk/DiskImage/Formats/HFE.hpp"
#include "../../Storage/Disk/DiskImage/Formats/MSA.hpp"
#include "../../Storage/Disk/DiskImage/Formats/MSXDSK.hpp" #include "../../Storage/Disk/DiskImage/Formats/MSXDSK.hpp"
#include "../../Storage/Disk/DiskImage/Formats/NIB.hpp"
#include "../../Storage/Disk/DiskImage/Formats/OricMFMDSK.hpp" #include "../../Storage/Disk/DiskImage/Formats/OricMFMDSK.hpp"
#include "../../Storage/Disk/DiskImage/Formats/SSD.hpp" #include "../../Storage/Disk/DiskImage/Formats/SSD.hpp"
#include "../../Storage/Disk/DiskImage/Formats/ST.hpp"
#include "../../Storage/Disk/DiskImage/Formats/WOZ.hpp"
// Mass Storage Devices (i.e. usually, hard disks)
#include "../../Storage/MassStorage/Formats/HFV.hpp"
// Tapes // Tapes
#include "../../Storage/Tape/Formats/CAS.hpp" #include "../../Storage/Tape/Formats/CAS.hpp"
@@ -78,30 +93,39 @@ static Media GetMediaAndPlatforms(const std::string &file_name, TargetPlatform::
TryInsert(list, class, platforms) \ TryInsert(list, class, platforms) \
} }
Format("80", result.tapes, Tape::ZX80O81P, TargetPlatform::ZX8081) // 80 Format("80", result.tapes, Tape::ZX80O81P, TargetPlatform::ZX8081) // 80
Format("81", result.tapes, Tape::ZX80O81P, TargetPlatform::ZX8081) // 81 Format("81", result.tapes, Tape::ZX80O81P, TargetPlatform::ZX8081) // 81
Format("a26", result.cartridges, Cartridge::BinaryDump, TargetPlatform::Atari2600) // A26 Format("a26", result.cartridges, Cartridge::BinaryDump, TargetPlatform::Atari2600) // A26
Format("adf", result.disks, Disk::DiskImageHolder<Storage::Disk::AcornADF>, TargetPlatform::Acorn) // ADF Format("adf", result.disks, Disk::DiskImageHolder<Storage::Disk::AcornADF>, TargetPlatform::Acorn) // ADF
Format("bin", result.cartridges, Cartridge::BinaryDump, TargetPlatform::AllCartridge) // BIN Format("bin", result.cartridges, Cartridge::BinaryDump, TargetPlatform::AllCartridge) // BIN (cartridge dump)
Format("cas", result.tapes, Tape::CAS, TargetPlatform::MSX) // CAS Format("cas", result.tapes, Tape::CAS, TargetPlatform::MSX) // CAS
Format("cdt", result.tapes, Tape::TZX, TargetPlatform::AmstradCPC) // CDT Format("cdt", result.tapes, Tape::TZX, TargetPlatform::AmstradCPC) // CDT
Format("col", result.cartridges, Cartridge::BinaryDump, TargetPlatform::ColecoVision) // COL Format("col", result.cartridges, Cartridge::BinaryDump, TargetPlatform::ColecoVision) // COL
Format("csw", result.tapes, Tape::CSW, TargetPlatform::AllTape) // CSW Format("csw", result.tapes, Tape::CSW, TargetPlatform::AllTape) // CSW
Format("d64", result.disks, Disk::DiskImageHolder<Storage::Disk::D64>, TargetPlatform::Commodore) // D64 Format("d64", result.disks, Disk::DiskImageHolder<Storage::Disk::D64>, TargetPlatform::Commodore) // D64
Format("dmk", result.disks, Disk::DiskImageHolder<Storage::Disk::DMK>, TargetPlatform::MSX) // DMK Format("dmk", result.disks, Disk::DiskImageHolder<Storage::Disk::DMK>, TargetPlatform::MSX) // DMK
Format("dsd", result.disks, Disk::DiskImageHolder<Storage::Disk::SSD>, TargetPlatform::Acorn) // DSD Format("do", result.disks, Disk::DiskImageHolder<Storage::Disk::AppleDSK>, TargetPlatform::DiskII) // DO
Format("dsk", result.disks, Disk::DiskImageHolder<Storage::Disk::CPCDSK>, TargetPlatform::AmstradCPC) // DSK (Amstrad CPC) Format("dsd", result.disks, Disk::DiskImageHolder<Storage::Disk::SSD>, TargetPlatform::Acorn) // DSD
Format("dsk", result.disks, Disk::DiskImageHolder<Storage::Disk::MSXDSK>, TargetPlatform::MSX) // DSK (MSX) Format("dsk", result.disks, Disk::DiskImageHolder<Storage::Disk::CPCDSK>, TargetPlatform::AmstradCPC) // DSK (Amstrad CPC)
Format("dsk", result.disks, Disk::DiskImageHolder<Storage::Disk::OricMFMDSK>, TargetPlatform::Oric) // DSK (Oric) Format("dsk", result.disks, Disk::DiskImageHolder<Storage::Disk::AppleDSK>, TargetPlatform::DiskII) // DSK (Apple II)
Format("g64", result.disks, Disk::DiskImageHolder<Storage::Disk::G64>, TargetPlatform::Commodore) // G64 Format("dsk", result.disks, Disk::DiskImageHolder<Storage::Disk::MacintoshIMG>, TargetPlatform::Macintosh) // DSK (Macintosh, floppy disk)
Format("dsk", result.mass_storage_devices, MassStorage::HFV, TargetPlatform::Macintosh) // DSK (Macintosh, hard disk)
Format("dsk", result.disks, Disk::DiskImageHolder<Storage::Disk::MSXDSK>, TargetPlatform::MSX) // DSK (MSX)
Format("dsk", result.disks, Disk::DiskImageHolder<Storage::Disk::OricMFMDSK>, TargetPlatform::Oric) // DSK (Oric)
Format("g64", result.disks, Disk::DiskImageHolder<Storage::Disk::G64>, TargetPlatform::Commodore) // G64
Format( "hfe", Format( "hfe",
result.disks, result.disks,
Disk::DiskImageHolder<Storage::Disk::HFE>, Disk::DiskImageHolder<Storage::Disk::HFE>,
TargetPlatform::Acorn | TargetPlatform::AmstradCPC | TargetPlatform::Commodore | TargetPlatform::Oric) TargetPlatform::Acorn | TargetPlatform::AmstradCPC | TargetPlatform::Commodore | TargetPlatform::Oric)
// HFE (TODO: switch to AllDisk once the MSX stops being so greedy) // HFE (TODO: switch to AllDisk once the MSX stops being so greedy)
Format("o", result.tapes, Tape::ZX80O81P, TargetPlatform::ZX8081) // O Format("img", result.disks, Disk::DiskImageHolder<Storage::Disk::MacintoshIMG>, TargetPlatform::Macintosh) // IMG (DiskCopy 4.2)
Format("p", result.tapes, Tape::ZX80O81P, TargetPlatform::ZX8081) // P Format("image", result.disks, Disk::DiskImageHolder<Storage::Disk::MacintoshIMG>, TargetPlatform::Macintosh) // IMG (DiskCopy 4.2)
Format("p81", result.tapes, Tape::ZX80O81P, TargetPlatform::ZX8081) // P81 Format("msa", result.disks, Disk::DiskImageHolder<Storage::Disk::MSA>, TargetPlatform::AtariST) // MSA
Format("nib", result.disks, Disk::DiskImageHolder<Storage::Disk::NIB>, TargetPlatform::DiskII) // NIB
Format("o", result.tapes, Tape::ZX80O81P, TargetPlatform::ZX8081) // O
Format("p", result.tapes, Tape::ZX80O81P, TargetPlatform::ZX8081) // P
Format("po", result.disks, Disk::DiskImageHolder<Storage::Disk::AppleDSK>, TargetPlatform::DiskII) // PO
Format("p81", result.tapes, Tape::ZX80O81P, TargetPlatform::ZX8081) // P81
// PRG // PRG
if(extension == "prg") { if(extension == "prg") {
@@ -118,13 +142,17 @@ static Media GetMediaAndPlatforms(const std::string &file_name, TargetPlatform::
Format( "rom", Format( "rom",
result.cartridges, result.cartridges,
Cartridge::BinaryDump, Cartridge::BinaryDump,
TargetPlatform::AcornElectron | TargetPlatform::ColecoVision | TargetPlatform::MSX) // ROM TargetPlatform::AcornElectron | TargetPlatform::ColecoVision | TargetPlatform::MSX) // ROM
Format("ssd", result.disks, Disk::DiskImageHolder<Storage::Disk::SSD>, TargetPlatform::Acorn) // SSD Format("sg", result.cartridges, Cartridge::BinaryDump, TargetPlatform::Sega) // SG
Format("tap", result.tapes, Tape::CommodoreTAP, TargetPlatform::Commodore) // TAP (Commodore) Format("sms", result.cartridges, Cartridge::BinaryDump, TargetPlatform::Sega) // SMS
Format("tap", result.tapes, Tape::OricTAP, TargetPlatform::Oric) // TAP (Oric) Format("ssd", result.disks, Disk::DiskImageHolder<Storage::Disk::SSD>, TargetPlatform::Acorn) // SSD
Format("tsx", result.tapes, Tape::TZX, TargetPlatform::MSX) // TSX Format("st", result.disks, Disk::DiskImageHolder<Storage::Disk::ST>, TargetPlatform::AtariST) // ST
Format("tzx", result.tapes, Tape::TZX, TargetPlatform::ZX8081) // TZX Format("tap", result.tapes, Tape::CommodoreTAP, TargetPlatform::Commodore) // TAP (Commodore)
Format("uef", result.tapes, Tape::UEF, TargetPlatform::Acorn) // UEF (tape) Format("tap", result.tapes, Tape::OricTAP, TargetPlatform::Oric) // TAP (Oric)
Format("tsx", result.tapes, Tape::TZX, TargetPlatform::MSX) // TSX
Format("tzx", result.tapes, Tape::TZX, TargetPlatform::ZX8081) // TZX
Format("uef", result.tapes, Tape::UEF, TargetPlatform::Acorn) // UEF (tape)
Format("woz", result.disks, Disk::DiskImageHolder<Storage::Disk::WOZ>, TargetPlatform::DiskII) // WOZ
#undef Format #undef Format
#undef Insert #undef Insert
@@ -138,27 +166,37 @@ Media Analyser::Static::GetMedia(const std::string &file_name) {
return GetMediaAndPlatforms(file_name, throwaway); return GetMediaAndPlatforms(file_name, throwaway);
} }
std::vector<std::unique_ptr<Target>> Analyser::Static::GetTargets(const std::string &file_name) { TargetList Analyser::Static::GetTargets(const std::string &file_name) {
std::vector<std::unique_ptr<Target>> targets; TargetList targets;
// Collect all disks, tapes and ROMs as can be extrapolated from this file, forming the // Collect all disks, tapes ROMs, etc as can be extrapolated from this file, forming the
// union of all platforms this file might be a target for. // union of all platforms this file might be a target for.
TargetPlatform::IntType potential_platforms = 0; TargetPlatform::IntType potential_platforms = 0;
Media media = GetMediaAndPlatforms(file_name, potential_platforms); Media media = GetMediaAndPlatforms(file_name, potential_platforms);
// Hand off to platform-specific determination of whether these things are actually compatible and, // Hand off to platform-specific determination of whether these things are actually compatible and,
// if so, how to load them. // if so, how to load them.
if(potential_platforms & TargetPlatform::Acorn) Acorn::AddTargets(media, targets); #define Append(x) {\
if(potential_platforms & TargetPlatform::AmstradCPC) AmstradCPC::AddTargets(media, targets); auto new_targets = x::GetTargets(media, file_name, potential_platforms);\
if(potential_platforms & TargetPlatform::Atari2600) Atari::AddTargets(media, targets); std::move(new_targets.begin(), new_targets.end(), std::back_inserter(targets));\
if(potential_platforms & TargetPlatform::ColecoVision) Coleco::AddTargets(media, targets); }
if(potential_platforms & TargetPlatform::Commodore) Commodore::AddTargets(media, targets, file_name); if(potential_platforms & TargetPlatform::Acorn) Append(Acorn);
if(potential_platforms & TargetPlatform::MSX) MSX::AddTargets(media, targets); if(potential_platforms & TargetPlatform::AmstradCPC) Append(AmstradCPC);
if(potential_platforms & TargetPlatform::Oric) Oric::AddTargets(media, targets); if(potential_platforms & TargetPlatform::AppleII) Append(AppleII);
if(potential_platforms & TargetPlatform::ZX8081) ZX8081::AddTargets(media, targets, potential_platforms); if(potential_platforms & TargetPlatform::Atari2600) Append(Atari2600);
if(potential_platforms & TargetPlatform::AtariST) Append(AtariST);
if(potential_platforms & TargetPlatform::ColecoVision) Append(Coleco);
if(potential_platforms & TargetPlatform::Commodore) Append(Commodore);
if(potential_platforms & TargetPlatform::DiskII) Append(DiskII);
if(potential_platforms & TargetPlatform::Macintosh) Append(Macintosh);
if(potential_platforms & TargetPlatform::MSX) Append(MSX);
if(potential_platforms & TargetPlatform::Oric) Append(Oric);
if(potential_platforms & TargetPlatform::Sega) Append(Sega);
if(potential_platforms & TargetPlatform::ZX8081) Append(ZX8081);
#undef Append
// Reset any tapes to their initial position // Reset any tapes to their initial position
for(auto &target : targets) { for(const auto &target : targets) {
for(auto &tape : target->media.tapes) { for(auto &tape : target->media.tapes) {
tape->reset(); tape->reset();
} }
@@ -167,9 +205,9 @@ std::vector<std::unique_ptr<Target>> Analyser::Static::GetTargets(const std::str
// Sort by initial confidence. Use a stable sort in case any of the machine-specific analysers // Sort by initial confidence. Use a stable sort in case any of the machine-specific analysers
// picked their insertion order carefully. // picked their insertion order carefully.
std::stable_sort(targets.begin(), targets.end(), std::stable_sort(targets.begin(), targets.end(),
[] (const std::unique_ptr<Target> &a, const std::unique_ptr<Target> &b) { [] (const std::unique_ptr<Target> &a, const std::unique_ptr<Target> &b) {
return a->confidence > b->confidence; return a->confidence > b->confidence;
}); });
return targets; return targets;
} }

View File

@@ -3,7 +3,7 @@
// Clock Signal // Clock Signal
// //
// Created by Thomas Harte on 23/08/2016. // Created by Thomas Harte on 23/08/2016.
// Copyright © 2016 Thomas Harte. All rights reserved. // Copyright 2016 Thomas Harte. All rights reserved.
// //
#ifndef StaticAnalyser_hpp #ifndef StaticAnalyser_hpp
@@ -11,10 +11,12 @@
#include "../Machines.hpp" #include "../Machines.hpp"
#include "../../Storage/Tape/Tape.hpp"
#include "../../Storage/Disk/Disk.hpp"
#include "../../Storage/Cartridge/Cartridge.hpp" #include "../../Storage/Cartridge/Cartridge.hpp"
#include "../../Storage/Disk/Disk.hpp"
#include "../../Storage/MassStorage/MassStorageDevice.hpp"
#include "../../Storage/Tape/Tape.hpp"
#include <memory>
#include <string> #include <string>
#include <vector> #include <vector>
@@ -28,9 +30,10 @@ struct Media {
std::vector<std::shared_ptr<Storage::Disk::Disk>> disks; std::vector<std::shared_ptr<Storage::Disk::Disk>> disks;
std::vector<std::shared_ptr<Storage::Tape::Tape>> tapes; std::vector<std::shared_ptr<Storage::Tape::Tape>> tapes;
std::vector<std::shared_ptr<Storage::Cartridge::Cartridge>> cartridges; std::vector<std::shared_ptr<Storage::Cartridge::Cartridge>> cartridges;
std::vector<std::shared_ptr<Storage::MassStorage::MassStorageDevice>> mass_storage_devices;
bool empty() const { bool empty() const {
return disks.empty() && tapes.empty() && cartridges.empty(); return disks.empty() && tapes.empty() && cartridges.empty() && mass_storage_devices.empty();
} }
}; };
@@ -43,17 +46,16 @@ struct Target {
Machine machine; Machine machine;
Media media; Media media;
float confidence; float confidence;
std::string loading_command;
}; };
typedef std::vector<std::unique_ptr<Target>> TargetList;
/*! /*!
Attempts, through any available means, to return a list of potential targets for the file with the given name. Attempts, through any available means, to return a list of potential targets for the file with the given name.
@returns The list of potential targets, sorted from most to least probable. @returns The list of potential targets, sorted from most to least probable.
*/ */
std::vector<std::unique_ptr<Target>> GetTargets(const std::string &file_name); TargetList GetTargets(const std::string &file_name);
/*! /*!
Inspects the supplied file and determines the media included. Inspects the supplied file and determines the media included.

View File

@@ -3,7 +3,7 @@
// Clock Signal // Clock Signal
// //
// Created by Thomas Harte on 04/06/2017. // Created by Thomas Harte on 04/06/2017.
// Copyright © 2017 Thomas Harte. All rights reserved. // Copyright 2017 Thomas Harte. All rights reserved.
// //
#include "StaticAnalyser.hpp" #include "StaticAnalyser.hpp"
@@ -28,7 +28,8 @@ static std::vector<Storage::Data::ZX8081::File> GetFiles(const std::shared_ptr<S
return files; return files;
} }
void Analyser::Static::ZX8081::AddTargets(const Media &media, std::vector<std::unique_ptr<::Analyser::Static::Target>> &destination, TargetPlatform::IntType potential_platforms) { Analyser::Static::TargetList Analyser::Static::ZX8081::GetTargets(const Media &media, const std::string &file_name, TargetPlatform::IntType potential_platforms) {
TargetList destination;
if(!media.tapes.empty()) { if(!media.tapes.empty()) {
std::vector<Storage::Data::ZX8081::File> files = GetFiles(media.tapes.front()); std::vector<Storage::Data::ZX8081::File> files = GetFiles(media.tapes.front());
media.tapes.front()->reset(); media.tapes.front()->reset();
@@ -65,4 +66,5 @@ void Analyser::Static::ZX8081::AddTargets(const Media &media, std::vector<std::u
} }
} }
return destination;
} }

View File

@@ -3,20 +3,21 @@
// Clock Signal // Clock Signal
// //
// Created by Thomas Harte on 04/06/2017. // Created by Thomas Harte on 04/06/2017.
// Copyright © 2017 Thomas Harte. All rights reserved. // Copyright 2017 Thomas Harte. All rights reserved.
// //
#ifndef StaticAnalyser_ZX8081_StaticAnalyser_hpp #ifndef Analyser_Static_ZX8081_StaticAnalyser_hpp
#define StaticAnalyser_ZX8081_StaticAnalyser_hpp #define Analyser_Static_ZX8081_StaticAnalyser_hpp
#include "../StaticAnalyser.hpp" #include "../StaticAnalyser.hpp"
#include "../../../Storage/TargetPlatforms.hpp" #include "../../../Storage/TargetPlatforms.hpp"
#include <string>
namespace Analyser { namespace Analyser {
namespace Static { namespace Static {
namespace ZX8081 { namespace ZX8081 {
void AddTargets(const Media &media, std::vector<std::unique_ptr<Target>> &destination, TargetPlatform::IntType potential_platforms); TargetList GetTargets(const Media &media, const std::string &file_name, TargetPlatform::IntType potential_platforms);
} }
} }

View File

@@ -3,13 +3,14 @@
// Clock Signal // Clock Signal
// //
// Created by Thomas Harte on 09/03/2018. // Created by Thomas Harte on 09/03/2018.
// Copyright © 2018 Thomas Harte. All rights reserved. // Copyright 2018 Thomas Harte. All rights reserved.
// //
#ifndef Analyser_Static_ZX8081_Target_h #ifndef Analyser_Static_ZX8081_Target_h
#define Analyser_Static_ZX8081_Target_h #define Analyser_Static_ZX8081_Target_h
#include "../StaticAnalyser.hpp" #include "../StaticAnalyser.hpp"
#include <string>
namespace Analyser { namespace Analyser {
namespace Static { namespace Static {
@@ -25,6 +26,7 @@ struct Target: public ::Analyser::Static::Target {
MemoryModel memory_model = MemoryModel::Unexpanded; MemoryModel memory_model = MemoryModel::Unexpanded;
bool is_ZX81 = false; bool is_ZX81 = false;
bool ZX80_uses_ZX81_ROM = false; bool ZX80_uses_ZX81_ROM = false;
std::string loading_command;
}; };
} }

View File

@@ -3,12 +3,15 @@
// Clock Signal // Clock Signal
// //
// Created by Thomas Harte on 22/07/2017. // Created by Thomas Harte on 22/07/2017.
// Copyright © 2017 Thomas Harte. All rights reserved. // Copyright 2017 Thomas Harte. All rights reserved.
// //
#ifndef ClockReceiver_hpp #ifndef ClockReceiver_hpp
#define ClockReceiver_hpp #define ClockReceiver_hpp
#include "ForceInline.hpp"
#include <cstdint>
/* /*
Informal pattern for all classes that run from a clock cycle: Informal pattern for all classes that run from a clock cycle:
@@ -52,149 +55,193 @@
*/ */
template <class T> class WrappedInt { template <class T> class WrappedInt {
public: public:
inline WrappedInt(int l) : length_(l) {} using IntType = int64_t;
inline WrappedInt() : length_(0) {}
inline T &operator =(const T &rhs) { forceinline constexpr WrappedInt(IntType l) noexcept : length_(l) {}
forceinline constexpr WrappedInt() noexcept : length_(0) {}
forceinline T &operator =(const T &rhs) {
length_ = rhs.length_; length_ = rhs.length_;
return *this; return *this;
} }
inline T &operator +=(const T &rhs) { forceinline T &operator +=(const T &rhs) {
length_ += rhs.length_; length_ += rhs.length_;
return *static_cast<T *>(this); return *static_cast<T *>(this);
} }
inline T &operator -=(const T &rhs) { forceinline T &operator -=(const T &rhs) {
length_ -= rhs.length_; length_ -= rhs.length_;
return *static_cast<T *>(this); return *static_cast<T *>(this);
} }
inline T &operator ++() { forceinline T &operator ++() {
++ length_; ++ length_;
return *static_cast<T *>(this); return *static_cast<T *>(this);
} }
inline T &operator ++(int) { forceinline T &operator ++(int) {
length_ ++; length_ ++;
return *static_cast<T *>(this); return *static_cast<T *>(this);
} }
inline T &operator --() { forceinline T &operator --() {
-- length_; -- length_;
return *static_cast<T *>(this); return *static_cast<T *>(this);
} }
inline T &operator --(int) { forceinline T &operator --(int) {
length_ --; length_ --;
return *static_cast<T *>(this); return *static_cast<T *>(this);
} }
inline T &operator %=(const T &rhs) { forceinline T &operator *=(const T &rhs) {
length_ *= rhs.length_;
return *static_cast<T *>(this);
}
forceinline T &operator /=(const T &rhs) {
length_ /= rhs.length_;
return *static_cast<T *>(this);
}
forceinline T &operator %=(const T &rhs) {
length_ %= rhs.length_; length_ %= rhs.length_;
return *static_cast<T *>(this); return *static_cast<T *>(this);
} }
inline T &operator &=(const T &rhs) { forceinline T &operator &=(const T &rhs) {
length_ &= rhs.length_; length_ &= rhs.length_;
return *static_cast<T *>(this); return *static_cast<T *>(this);
} }
inline T operator +(const T &rhs) const { return T(length_ + rhs.length_); } forceinline constexpr T operator +(const T &rhs) const { return T(length_ + rhs.length_); }
inline T operator -(const T &rhs) const { return T(length_ - rhs.length_); } forceinline constexpr T operator -(const T &rhs) const { return T(length_ - rhs.length_); }
inline T operator %(const T &rhs) const { return T(length_ % rhs.length_); } forceinline constexpr T operator *(const T &rhs) const { return T(length_ * rhs.length_); }
inline T operator &(const T &rhs) const { return T(length_ & rhs.length_); } forceinline constexpr T operator /(const T &rhs) const { return T(length_ / rhs.length_); }
inline T operator -() const { return T(- length_); } forceinline constexpr T operator %(const T &rhs) const { return T(length_ % rhs.length_); }
forceinline constexpr T operator &(const T &rhs) const { return T(length_ & rhs.length_); }
inline bool operator <(const T &rhs) const { return length_ < rhs.length_; } forceinline constexpr T operator -() const { return T(- length_); }
inline bool operator >(const T &rhs) const { return length_ > rhs.length_; }
inline bool operator <=(const T &rhs) const { return length_ <= rhs.length_; }
inline bool operator >=(const T &rhs) const { return length_ >= rhs.length_; }
inline bool operator ==(const T &rhs) const { return length_ == rhs.length_; }
inline bool operator !=(const T &rhs) const { return length_ != rhs.length_; }
inline bool operator !() const { return !length_; } forceinline constexpr bool operator <(const T &rhs) const { return length_ < rhs.length_; }
forceinline constexpr bool operator >(const T &rhs) const { return length_ > rhs.length_; }
forceinline constexpr bool operator <=(const T &rhs) const { return length_ <= rhs.length_; }
forceinline constexpr bool operator >=(const T &rhs) const { return length_ >= rhs.length_; }
forceinline constexpr bool operator ==(const T &rhs) const { return length_ == rhs.length_; }
forceinline constexpr bool operator !=(const T &rhs) const { return length_ != rhs.length_; }
forceinline constexpr bool operator !() const { return !length_; }
// bool operator () is not supported because it offers an implicit cast to int, which is prone silently to permit misuse // bool operator () is not supported because it offers an implicit cast to int, which is prone silently to permit misuse
inline int as_int() const { return length_; } /// @returns The underlying int, cast to an integral type of your choosing.
template<typename Type = IntType> forceinline constexpr Type as() const { return Type(length_); }
/// @returns The underlying int, in its native form.
forceinline constexpr IntType as_integral() const { return length_; }
/*! /*!
Severs from @c this the effect of dividing by @c divisor @c this will end up with Severs from @c this the effect of dividing by @c divisor; @c this will end up with
the value of @c this modulo @c divisor and @c divided by @c divisor is returned. the value of @c this modulo @c divisor and @c divided by @c divisor is returned.
*/ */
inline T divide(const T &divisor) { template <typename Result = T> forceinline Result divide(const T &divisor) {
T result(length_ / divisor.length_); Result r;
length_ %= divisor.length_; static_cast<T *>(this)->fill(r, divisor);
return result; return r;
} }
/*! /*!
Flushes the value in @c this. The current value is returned, and the internal value Flushes the value in @c this. The current value is returned, and the internal value
is reset to zero. is reset to zero.
*/ */
inline T flush() { template <typename Result> Result flush() {
T result(length_); // Jiggery pokery here; switching to function overloading avoids
length_ = 0; // the namespace-level requirement for template specialisation.
return result; Result r;
static_cast<T *>(this)->fill(r);
return r;
} }
// operator int() is deliberately not provided, to avoid accidental subtitution of // operator int() is deliberately not provided, to avoid accidental subtitution of
// classes that use this template. // classes that use this template.
protected: protected:
int length_; IntType length_;
}; };
/// Describes an integer number of whole cycles pairs of clock signal transitions. /// Describes an integer number of whole cycles: pairs of clock signal transitions.
class Cycles: public WrappedInt<Cycles> { class Cycles: public WrappedInt<Cycles> {
public: public:
inline Cycles(int l) : WrappedInt<Cycles>(l) {} forceinline constexpr Cycles(IntType l) noexcept : WrappedInt<Cycles>(l) {}
inline Cycles() : WrappedInt<Cycles>() {} forceinline constexpr Cycles() noexcept : WrappedInt<Cycles>() {}
inline Cycles(const Cycles &cycles) : WrappedInt<Cycles>(cycles.length_) {} forceinline constexpr Cycles(const Cycles &cycles) noexcept : WrappedInt<Cycles>(cycles.length_) {}
private:
friend WrappedInt;
void fill(Cycles &result) {
result.length_ = length_;
length_ = 0;
}
void fill(Cycles &result, const Cycles &divisor) {
result.length_ = length_ / divisor.length_;
length_ %= divisor.length_;
}
}; };
/// Describes an integer number of half cycles single clock signal transitions. /// Describes an integer number of half cycles: single clock signal transitions.
class HalfCycles: public WrappedInt<HalfCycles> { class HalfCycles: public WrappedInt<HalfCycles> {
public: public:
inline HalfCycles(int l) : WrappedInt<HalfCycles>(l) {} forceinline constexpr HalfCycles(IntType l) noexcept : WrappedInt<HalfCycles>(l) {}
inline HalfCycles() : WrappedInt<HalfCycles>() {} forceinline constexpr HalfCycles() noexcept : WrappedInt<HalfCycles>() {}
inline HalfCycles(const Cycles cycles) : WrappedInt<HalfCycles>(cycles.as_int() * 2) {} forceinline constexpr HalfCycles(const Cycles &cycles) noexcept : WrappedInt<HalfCycles>(cycles.as_integral() * 2) {}
inline HalfCycles(const HalfCycles &half_cycles) : WrappedInt<HalfCycles>(half_cycles.length_) {} forceinline constexpr HalfCycles(const HalfCycles &half_cycles) noexcept : WrappedInt<HalfCycles>(half_cycles.length_) {}
/// @returns The number of whole cycles completely covered by this span of half cycles. /// @returns The number of whole cycles completely covered by this span of half cycles.
inline Cycles cycles() { forceinline constexpr Cycles cycles() const {
return Cycles(length_ >> 1); return Cycles(length_ >> 1);
} }
/// Flushes the whole cycles in @c this, subtracting that many from the total stored here.
inline Cycles flush_cycles() {
Cycles result(length_ >> 1);
length_ &= 1;
return result;
}
/// Flushes the half cycles in @c this, returning the number stored and setting this total to zero.
inline HalfCycles flush() {
HalfCycles result(length_);
length_ = 0;
return result;
}
/*! /*!
Severs from @c this the effect of dividing by @c divisor @c this will end up with Severs from @c this the effect of dividing by @c divisor; @c this will end up with
the value of @c this modulo @c divisor and @c divided by @c divisor is returned. the value of @c this modulo @c divisor and @c divided by @c divisor is returned.
*/ */
inline Cycles divide_cycles(const Cycles &divisor) { forceinline Cycles divide_cycles(const Cycles &divisor) {
HalfCycles half_divisor = HalfCycles(divisor); const HalfCycles half_divisor = HalfCycles(divisor);
Cycles result(length_ / half_divisor.length_); const Cycles result(length_ / half_divisor.length_);
length_ %= half_divisor.length_; length_ %= half_divisor.length_;
return result; return result;
} }
private:
friend WrappedInt;
void fill(Cycles &result) {
result = Cycles(length_ >> 1);
length_ &= 1;
}
void fill(HalfCycles &result) {
result.length_ = length_;
length_ = 0;
}
void fill(Cycles &result, const HalfCycles &divisor) {
result = Cycles(length_ / (divisor.length_ << 1));
length_ %= (divisor.length_ << 1);
}
void fill(HalfCycles &result, const HalfCycles &divisor) {
result.length_ = length_ / divisor.length_;
length_ %= divisor.length_;
}
}; };
// Create a specialisation of WrappedInt::flush for converting HalfCycles to Cycles
// without losing the fractional part.
/*! /*!
If a component implements only run_for(Cycles), an owner can wrap it in HalfClockReceiver If a component implements only run_for(Cycles), an owner can wrap it in HalfClockReceiver
automatically to gain run_for(HalfCycles). automatically to gain run_for(HalfCycles).
@@ -203,10 +250,9 @@ template <class T> class HalfClockReceiver: public T {
public: public:
using T::T; using T::T;
using T::run_for; forceinline void run_for(const HalfCycles half_cycles) {
inline void run_for(const HalfCycles half_cycles) {
half_cycles_ += half_cycles; half_cycles_ += half_cycles;
T::run_for(half_cycles_.flush_cycles()); T::run_for(half_cycles_.flush<Cycles>());
} }
private: private:

View File

@@ -0,0 +1,88 @@
//
// ClockingHintSource.h
// Clock Signal
//
// Created by Thomas Harte on 20/08/2017.
// Copyright 2017 Thomas Harte. All rights reserved.
//
#ifndef ClockingHintSource_hpp
#define ClockingHintSource_hpp
namespace ClockingHint {
enum class Preference {
/// The component doesn't currently require a clock signal.
None,
/// The component can be clocked only immediate prior to (explicit) accesses.
JustInTime,
/// The component require real-time clocking.
RealTime
};
class Source;
struct Observer {
/// Called to inform an observer that the component @c component has changed its clocking requirements.
virtual void set_component_prefers_clocking(Source *component, Preference clocking) = 0;
};
/*!
An clocking hint source is any component that can provide hints as to the type of
clocking required for accurate emulation. A disk controller is an archetypal example.
Types of clocking are:
- none:
a component that acts and reacts to direct contact but does not have a state that autonomously evolves.
E.g. a ROM, RAM, or some kinds of disk controller when not in the process of performing a command.
- just-in-time:
a component that has an evolving state but can receive clock updates only immediately before a
direct contact. This is possibly the most common kind of component.
- real-time:
a component that needs to be clocked in 'real time' (i.e. in terms of the emulated machine). For example
so that it can announce an interrupt at the proper moment, because it is monitoring some aspect of
the machine rather than waiting to be called upon, or because there's some other non-obvious relationship
at play.
A clocking hint source can signal changes in preferred clocking to an observer.
This is intended to allow for performance improvements to machines with components that can be messaged selectively.
The observer callout is virtual so the intended use case is that a machine holds a component that might go through
periods of different clocking requirements.
Transitions should be sufficiently infrequent that a virtual call to announce them costs little enough that
the saved or deferred ::run_fors add up to a substantial amount.
The hint provided is just that: a hint. Owners may perform ::run_for at a greater frequency.
*/
class Source {
public:
/// Registers @c observer as the new clocking observer.
void set_clocking_hint_observer(Observer *observer) {
observer_ = observer;
update_clocking_observer();
}
/// @returns the current preferred clocking strategy.
virtual Preference preferred_clocking() = 0;
private:
Observer *observer_ = nullptr;
protected:
/*!
Provided for subclasses; call this whenever the clocking preference might have changed.
This will notify the observer if there is one.
*/
void update_clocking_observer() {
if(!observer_) return;
observer_->set_component_prefers_clocking(this, preferred_clocking());
}
};
}
#endif /* ClockingHintSource_h */

View File

@@ -0,0 +1,82 @@
//
// DeferredQueue.hpp
// Clock Signal
//
// Created by Thomas Harte on 23/08/2018.
// Copyright © 2018 Thomas Harte. All rights reserved.
//
#ifndef DeferredQueue_h
#define DeferredQueue_h
#include <functional>
#include <vector>
/*!
A DeferredQueue maintains a list of ordered actions and the times at which
they should happen, and divides a total execution period up into the portions
that occur between those actions, triggering each action when it is reached.
*/
template <typename TimeUnit> class DeferredQueue {
public:
/// Constructs a DeferredQueue that will call target(period) in between deferred actions.
DeferredQueue(std::function<void(TimeUnit)> &&target) : target_(std::move(target)) {}
/*!
Schedules @c action to occur in @c delay units of time.
Actions must be scheduled in the order they will occur. It is undefined behaviour
to schedule them out of order.
*/
void defer(TimeUnit delay, const std::function<void(void)> &action) {
pending_actions_.emplace_back(delay, action);
}
/*!
Runs for @c length units of time.
The constructor-supplied target will be called with one or more periods that add up to @c length;
any scheduled actions will be called between periods.
*/
void run_for(TimeUnit length) {
// If there are no pending actions, just run for the entire length.
// This should be the normal branch.
if(pending_actions_.empty()) {
target_(length);
return;
}
// Divide the time to run according to the pending actions.
while(length > TimeUnit(0)) {
TimeUnit next_period = pending_actions_.empty() ? length : std::min(length, pending_actions_[0].delay);
target_(next_period);
length -= next_period;
off_t performances = 0;
for(auto &action: pending_actions_) {
action.delay -= next_period;
if(!action.delay) {
action.action();
++performances;
}
}
if(performances) {
pending_actions_.erase(pending_actions_.begin(), pending_actions_.begin() + performances);
}
}
}
private:
std::function<void(TimeUnit)> target_;
// The list of deferred actions.
struct DeferredAction {
TimeUnit delay;
std::function<void(void)> action;
DeferredAction(TimeUnit delay, const std::function<void(void)> &action) : delay(delay), action(std::move(action)) {}
};
std::vector<DeferredAction> pending_actions_;
};
#endif /* DeferredQueue_h */

View File

@@ -3,15 +3,15 @@
// Clock Signal // Clock Signal
// //
// Created by Thomas Harte on 01/08/2017. // Created by Thomas Harte on 01/08/2017.
// Copyright © 2017 Thomas Harte. All rights reserved. // Copyright 2017 Thomas Harte. All rights reserved.
// //
#ifndef ForceInline_hpp #ifndef ForceInline_hpp
#define ForceInline_hpp #define ForceInline_hpp
#ifdef DEBUG #ifndef NDEBUG
#define forceinline #define forceinline inline
#else #else

View File

@@ -0,0 +1,123 @@
//
// JustInTime.hpp
// Clock Signal
//
// Created by Thomas Harte on 28/07/2019.
// Copyright © 2019 Thomas Harte. All rights reserved.
//
#ifndef JustInTime_h
#define JustInTime_h
#include "../Concurrency/AsyncTaskQueue.hpp"
#include "ForceInline.hpp"
/*!
A JustInTimeActor holds (i) an embedded object with a run_for method; and (ii) an amount
of time since run_for was last called.
Time can be added using the += operator. The -> operator can be used to access the
embedded object. All time accumulated will be pushed to object before the pointer is returned.
Machines that accumulate HalfCycle time but supply to a Cycle-counted device may supply a
separate @c TargetTimeScale at template declaration.
*/
template <class T, int multiplier = 1, int divider = 1, class LocalTimeScale = HalfCycles, class TargetTimeScale = LocalTimeScale> class JustInTimeActor {
public:
/// Constructs a new JustInTimeActor using the same construction arguments as the included object.
template<typename... Args> JustInTimeActor(Args&&... args) : object_(std::forward<Args>(args)...) {}
/// Adds time to the actor.
forceinline void operator += (const LocalTimeScale &rhs) {
if constexpr (multiplier != 1) {
time_since_update_ += rhs * multiplier;
} else {
time_since_update_ += rhs;
}
is_flushed_ = false;
}
/// Flushes all accumulated time and returns a pointer to the included object.
forceinline T *operator->() {
flush();
return &object_;
}
/// Returns a pointer to the included object without flushing time.
forceinline T *last_valid() {
return &object_;
}
/// Flushes all accumulated time.
forceinline void flush() {
if(!is_flushed_) {
is_flushed_ = true;
if constexpr (divider == 1) {
object_.run_for(time_since_update_.template flush<TargetTimeScale>());
} else {
const auto duration = time_since_update_.template divide<TargetTimeScale>(LocalTimeScale(divider));
if(duration > TargetTimeScale(0))
object_.run_for(duration);
}
}
}
private:
T object_;
LocalTimeScale time_since_update_;
bool is_flushed_ = true;
};
/*!
A AsyncJustInTimeActor acts like a JustInTimeActor but additionally contains an AsyncTaskQueue.
Any time the amount of accumulated time crosses a threshold provided at construction time,
the object will be updated on the AsyncTaskQueue.
*/
template <class T, class LocalTimeScale = HalfCycles, class TargetTimeScale = LocalTimeScale> class AsyncJustInTimeActor {
public:
/// Constructs a new AsyncJustInTimeActor using the same construction arguments as the included object.
template<typename... Args> AsyncJustInTimeActor(TargetTimeScale threshold, Args&&... args) :
object_(std::forward<Args>(args)...),
threshold_(threshold) {}
/// Adds time to the actor.
inline void operator += (const LocalTimeScale &rhs) {
time_since_update_ += rhs;
if(time_since_update_ >= threshold_) {
time_since_update_ -= threshold_;
task_queue_.enqueue([this] () {
object_.run_for(threshold_);
});
}
is_flushed_ = false;
}
/// Flushes all accumulated time and returns a pointer to the included object.
inline T *operator->() {
flush();
return &object_;
}
/// Returns a pointer to the included object without flushing time.
inline T *last_valid() {
return &object_;
}
/// Flushes all accumulated time.
inline void flush() {
if(!is_flushed_) {
task_queue_.flush();
object_.run_for(time_since_update_.template flush<TargetTimeScale>());
is_flushed_ = true;
}
}
private:
T object_;
LocalTimeScale time_since_update_;
TargetTimeScale threshold_;
bool is_flushed_ = true;
Concurrency::AsyncTaskQueue task_queue_;
};
#endif /* JustInTime_h */

View File

@@ -1,60 +0,0 @@
//
// Sleeper.h
// Clock Signal
//
// Created by Thomas Harte on 20/08/2017.
// Copyright © 2017 Thomas Harte. All rights reserved.
//
#ifndef Sleeper_hpp
#define Sleeper_hpp
/*!
A sleeper is any component that sometimes requires a clock but at other times is 'asleep' — i.e. is not doing
any clock-derived work, so needn't receive a clock. A disk controller is an archetypal example.
A sleeper will signal sleeps and wakes to an observer.
This is intended to allow for performance improvements to machines with components that can sleep. The observer
callout is virtual so the intended use case is that a machine holds a component that might sleep. Its transitions
into and out of sleep are sufficiently infrequent that a virtual call to announce them costs sufficiently little that
the saved ::run_fors add up to a substantial amount.
By convention, sleeper components must be willing to accept ::run_for even after announcing sleep. It's a hint,
not a command.
*/
class Sleeper {
public:
Sleeper() : sleep_observer_(nullptr) {}
class SleepObserver {
public:
/// Called to inform an observer that the component @c component has either gone to sleep or become awake.
virtual void set_component_is_sleeping(void *component, bool is_sleeping) = 0;
};
/// Registers @c observer as the new sleep observer;
void set_sleep_observer(SleepObserver *observer) {
sleep_observer_ = observer;
}
/// @returns @c true if the component is currently sleeping; @c false otherwise.
virtual bool is_sleeping() = 0;
protected:
/// Provided for subclasses; send sleep announcements to the sleep_observer_.
SleepObserver *sleep_observer_;
/*!
Provided for subclasses; call this whenever is_sleeping might have changed, and the observer will be notified,
if one exists.
@c is_sleeping will be called only if there is an observer.
*/
void update_sleep_observer() {
if(!sleep_observer_) return;
sleep_observer_->set_component_is_sleeping(this, is_sleeping());
}
};
#endif /* Sleeper_h */

View File

@@ -3,7 +3,7 @@
// Clock Signal // Clock Signal
// //
// Created by Thomas Harte on 21/03/2018. // Created by Thomas Harte on 21/03/2018.
// Copyright © 2018 Thomas Harte. All rights reserved. // Copyright 2018 Thomas Harte. All rights reserved.
// //
#ifndef TimeTypes_h #ifndef TimeTypes_h

View File

@@ -3,39 +3,43 @@
// Clock Signal // Clock Signal
// //
// Created by Thomas Harte on 17/09/2016. // Created by Thomas Harte on 17/09/2016.
// Copyright © 2016 Thomas Harte. All rights reserved. // Copyright 2016 Thomas Harte. All rights reserved.
// //
#include "1770.hpp" #include "1770.hpp"
#include "../../Storage/Disk/Encodings/MFM/Constants.hpp" #include "../../Storage/Disk/Encodings/MFM/Constants.hpp"
#define LOG_PREFIX "[WD FDC] "
#include "../../Outputs/Log.hpp"
using namespace WD; using namespace WD;
WD1770::WD1770(Personality p) : WD1770::WD1770(Personality p) :
Storage::Disk::MFMController(8000000), Storage::Disk::MFMController(8000000),
personality_(p), personality_(p),
interesting_event_mask_(static_cast<int>(Event1770::Command)) { interesting_event_mask_(int(Event1770::Command)) {
set_is_double_density(false); set_is_double_density(false);
posit_event(static_cast<int>(Event1770::Command)); posit_event(int(Event1770::Command));
} }
void WD1770::set_register(int address, uint8_t value) { void WD1770::write(int address, uint8_t value) {
switch(address&3) { switch(address&3) {
case 0: { case 0: {
if((value&0xf0) == 0xd0) { if((value&0xf0) == 0xd0) {
if(value == 0xd0) { if(value == 0xd0) {
// Force interrupt **immediately**. // Force interrupt **immediately**.
printf("Force interrupt immediately\n"); LOG("Force interrupt immediately");
posit_event(static_cast<int>(Event1770::ForceInterrupt)); posit_event(int(Event1770::ForceInterrupt));
} else { } else {
printf("!!!TODO: force interrupt!!!\n"); ERROR("!!!TODO: force interrupt!!!");
update_status([] (Status &status) { update_status([] (Status &status) {
status.type = Status::One; status.type = Status::One;
}); });
} }
} else { } else {
command_ = value; command_ = value;
posit_event(static_cast<int>(Event1770::Command)); posit_event(int(Event1770::Command));
} }
} }
break; break;
@@ -50,27 +54,35 @@ void WD1770::set_register(int address, uint8_t value) {
} }
} }
uint8_t WD1770::get_register(int address) { uint8_t WD1770::read(int address) {
switch(address&3) { switch(address&3) {
default: { default: {
update_status([] (Status &status) { update_status([] (Status &status) {
status.interrupt_request = false; status.interrupt_request = false;
}); });
uint8_t status = uint8_t status =
(status_.write_protect ? Flag::WriteProtect : 0) | (status_.crc_error ? Flag::CRCError : 0) |
(status_.crc_error ? Flag::CRCError : 0) | (status_.busy ? Flag::Busy : 0);
(status_.busy ? Flag::Busy : 0);
// Per Jean Louis-Guérin's documentation:
//
// * the write-protect bit is locked into place by a type 2 or type 3 command, but is
// read live after a type 1.
// * the track 0 bit is captured during a type 1 instruction and lost upon any other type,
// it is not live sampled.
switch(status_.type) { switch(status_.type) {
case Status::One: case Status::One:
status |= status |=
(get_drive().get_is_track_zero() ? Flag::TrackZero : 0) | (status_.track_zero ? Flag::TrackZero : 0) |
(status_.seek_error ? Flag::SeekError : 0); (status_.seek_error ? Flag::SeekError : 0) |
// TODO: index hole (get_drive().get_is_read_only() ? Flag::WriteProtect : 0) |
(get_drive().get_index_pulse() ? Flag::Index : 0);
break; break;
case Status::Two: case Status::Two:
case Status::Three: case Status::Three:
status |= status |=
(status_.write_protect ? Flag::WriteProtect : 0) |
(status_.record_type ? Flag::RecordType : 0) | (status_.record_type ? Flag::RecordType : 0) |
(status_.lost_data ? Flag::LostData : 0) | (status_.lost_data ? Flag::LostData : 0) |
(status_.data_request ? Flag::DataRequest : 0) | (status_.data_request ? Flag::DataRequest : 0) |
@@ -87,10 +99,15 @@ uint8_t WD1770::get_register(int address) {
if(status_.type == Status::One) if(status_.type == Status::One)
status |= (status_.spin_up ? Flag::SpinUp : 0); status |= (status_.spin_up ? Flag::SpinUp : 0);
} }
// LOG("Returned status " << PADHEX(2) << int(status) << " of type " << 1+int(status_.type));
return status; return status;
} }
case 1: return track_; case 1:
case 2: return sector_; LOG("Returned track " << int(track_));
return track_;
case 2:
LOG("Returned sector " << int(sector_));
return sector_;
case 3: case 3:
update_status([] (Status &status) { update_status([] (Status &status) {
status.data_request = false; status.data_request = false;
@@ -103,28 +120,30 @@ void WD1770::run_for(const Cycles cycles) {
Storage::Disk::Controller::run_for(cycles); Storage::Disk::Controller::run_for(cycles);
if(delay_time_) { if(delay_time_) {
unsigned int number_of_cycles = static_cast<unsigned int>(cycles.as_int()); const auto number_of_cycles = cycles.as_integral();
if(delay_time_ <= number_of_cycles) { if(delay_time_ <= number_of_cycles) {
delay_time_ = 0; delay_time_ = 0;
posit_event(static_cast<int>(Event1770::Timer)); posit_event(int(Event1770::Timer));
} else { } else {
delay_time_ -= number_of_cycles; delay_time_ -= number_of_cycles;
} }
} }
} }
#define WAIT_FOR_EVENT(mask) resume_point_ = __LINE__; interesting_event_mask_ = static_cast<int>(mask); return; case __LINE__: #define WAIT_FOR_EVENT(mask) resume_point_ = __LINE__; interesting_event_mask_ = int(mask); return; case __LINE__:
#define WAIT_FOR_TIME(ms) resume_point_ = __LINE__; delay_time_ = ms * 8000; WAIT_FOR_EVENT(Event1770::Timer); #define WAIT_FOR_TIME(ms) resume_point_ = __LINE__; delay_time_ = ms * 8000; WAIT_FOR_EVENT(Event1770::Timer);
#define WAIT_FOR_BYTES(count) resume_point_ = __LINE__; distance_into_section_ = 0; WAIT_FOR_EVENT(Event::Token); if(get_latest_token().type == Token::Byte) distance_into_section_++; if(distance_into_section_ < count) { interesting_event_mask_ = static_cast<int>(Event::Token); return; } #define WAIT_FOR_BYTES(count) resume_point_ = __LINE__; distance_into_section_ = 0; WAIT_FOR_EVENT(Event::Token); if(get_latest_token().type == Token::Byte) distance_into_section_++; if(distance_into_section_ < count) { interesting_event_mask_ = int(Event::Token); return; }
#define BEGIN_SECTION() switch(resume_point_) { default: #define BEGIN_SECTION() switch(resume_point_) { default:
#define END_SECTION() (void)0; } #define END_SECTION() (void)0; }
#define READ_ID() \ #define READ_ID() \
if(new_event_type == static_cast<int>(Event::Token)) { \ if(new_event_type == int(Event::Token)) { \
if(!distance_into_section_ && get_latest_token().type == Token::ID) {set_data_mode(DataMode::Reading); distance_into_section_++; } \ if(!distance_into_section_ && get_latest_token().type == Token::ID) {\
else if(distance_into_section_ && distance_into_section_ < 7 && get_latest_token().type == Token::Byte) { \ set_data_mode(DataMode::Reading); \
++distance_into_section_; \
} else if(distance_into_section_ && distance_into_section_ < 7 && get_latest_token().type == Token::Byte) { \
header_[distance_into_section_ - 1] = get_latest_token().byte_value; \ header_[distance_into_section_ - 1] = get_latest_token().byte_value; \
distance_into_section_++; \ ++distance_into_section_; \
} \ } \
} }
@@ -139,28 +158,28 @@ void WD1770::run_for(const Cycles cycles) {
WAIT_FOR_EVENT(Event1770::IndexHoleTarget); \ WAIT_FOR_EVENT(Event1770::IndexHoleTarget); \
status_.spin_up = true; status_.spin_up = true;
// +--------+----------+-------------------------+ // +--------+----------+-------------------------+
// ! ! ! BITS ! // ! ! ! BITS !
// ! TYPE ! COMMAND ! 7 6 5 4 3 2 1 0 ! // ! TYPE ! COMMAND ! 7 6 5 4 3 2 1 0 !
// +--------+----------+-------------------------+ // +--------+----------+-------------------------+
// ! 1 ! Restore ! 0 0 0 0 h v r1 r0 ! // ! 1 ! Restore ! 0 0 0 0 h v r1 r0 !
// ! 1 ! Seek ! 0 0 0 1 h v r1 r0 ! // ! 1 ! Seek ! 0 0 0 1 h v r1 r0 !
// ! 1 ! Step ! 0 0 1 u h v r1 r0 ! // ! 1 ! Step ! 0 0 1 u h v r1 r0 !
// ! 1 ! Step-in ! 0 1 0 u h v r1 r0 ! // ! 1 ! Step-in ! 0 1 0 u h v r1 r0 !
// ! 1 ! Step-out ! 0 1 1 u h v r1 r0 ! // ! 1 ! Step-out ! 0 1 1 u h v r1 r0 !
// ! 2 ! Rd sectr ! 1 0 0 m h E 0 0 ! // ! 2 ! Rd sectr ! 1 0 0 m h E 0 0 !
// ! 2 ! Wt sectr ! 1 0 1 m h E P a0 ! // ! 2 ! Wt sectr ! 1 0 1 m h E P a0 !
// ! 3 ! Rd addr ! 1 1 0 0 h E 0 0 ! // ! 3 ! Rd addr ! 1 1 0 0 h E 0 0 !
// ! 3 ! Rd track ! 1 1 1 0 h E 0 0 ! // ! 3 ! Rd track ! 1 1 1 0 h E 0 0 !
// ! 3 ! Wt track ! 1 1 1 1 h E P 0 ! // ! 3 ! Wt track ! 1 1 1 1 h E P 0 !
// ! 4 ! Forc int ! 1 1 0 1 i3 i2 i1 i0 ! // ! 4 ! Forc int ! 1 1 0 1 i3 i2 i1 i0 !
// +--------+----------+-------------------------+ // +--------+----------+-------------------------+
void WD1770::posit_event(int new_event_type) { void WD1770::posit_event(int new_event_type) {
if(new_event_type == static_cast<int>(Event::IndexHole)) { if(new_event_type == int(Event::IndexHole)) {
index_hole_count_++; index_hole_count_++;
if(index_hole_count_target_ == index_hole_count_) { if(index_hole_count_target_ == index_hole_count_) {
posit_event(static_cast<int>(Event1770::IndexHoleTarget)); posit_event(int(Event1770::IndexHoleTarget));
index_hole_count_target_ = -1; index_hole_count_target_ = -1;
} }
@@ -175,25 +194,25 @@ void WD1770::posit_event(int new_event_type) {
} }
} }
if(new_event_type == static_cast<int>(Event1770::ForceInterrupt)) { if(new_event_type == int(Event1770::ForceInterrupt)) {
interesting_event_mask_ = 0; interesting_event_mask_ = 0;
resume_point_ = 0; resume_point_ = 0;
update_status([] (Status &status) { update_status([] (Status &status) {
status.type = Status::One; status.type = Status::One;
status.data_request = false; status.data_request = false;
status.spin_up = false;
}); });
} else { } else {
if(!(interesting_event_mask_ & static_cast<int>(new_event_type))) return; if(!(interesting_event_mask_ & int(new_event_type))) return;
interesting_event_mask_ &= ~new_event_type; interesting_event_mask_ &= ~new_event_type;
} }
Status new_status;
BEGIN_SECTION() BEGIN_SECTION()
// Wait for a new command, branch to the appropriate handler. // Wait for a new command, branch to the appropriate handler.
case 0: case 0:
wait_for_command: wait_for_command:
printf("Idle...\n"); LOG("Idle...");
set_data_mode(DataMode::Scanning); set_data_mode(DataMode::Scanning);
index_hole_count_ = 0; index_hole_count_ = 0;
@@ -207,9 +226,10 @@ void WD1770::posit_event(int new_event_type) {
update_status([] (Status &status) { update_status([] (Status &status) {
status.busy = true; status.busy = true;
status.interrupt_request = false; status.interrupt_request = false;
status.track_zero = false; // Always reset by a non-type 1; so reset regardless and set properly later.
}); });
printf("Starting %02x\n", command_); LOG("Starting " << PADHEX(2) << int(command_));
if(!(command_ & 0x80)) goto begin_type_1; if(!(command_ & 0x80)) goto begin_type_1;
if(!(command_ & 0x40)) goto begin_type_2; if(!(command_ & 0x40)) goto begin_type_2;
@@ -219,16 +239,16 @@ void WD1770::posit_event(int new_event_type) {
/* /*
Type 1 entry point. Type 1 entry point.
*/ */
// +--------+----------+-------------------------+ // +--------+----------+-------------------------+
// ! ! ! BITS ! // ! ! ! BITS !
// ! TYPE ! COMMAND ! 7 6 5 4 3 2 1 0 ! // ! TYPE ! COMMAND ! 7 6 5 4 3 2 1 0 !
// +--------+----------+-------------------------+ // +--------+----------+-------------------------+
// ! 1 ! Restore ! 0 0 0 0 h v r1 r0 ! // ! 1 ! Restore ! 0 0 0 0 h v r1 r0 !
// ! 1 ! Seek ! 0 0 0 1 h v r1 r0 ! // ! 1 ! Seek ! 0 0 0 1 h v r1 r0 !
// ! 1 ! Step ! 0 0 1 u h v r1 r0 ! // ! 1 ! Step ! 0 0 1 u h v r1 r0 !
// ! 1 ! Step-in ! 0 1 0 u h v r1 r0 ! // ! 1 ! Step-in ! 0 1 0 u h v r1 r0 !
// ! 1 ! Step-out ! 0 1 1 u h v r1 r0 ! // ! 1 ! Step-out ! 0 1 1 u h v r1 r0 !
// +--------+----------+-------------------------+ // +--------+----------+-------------------------+
begin_type_1: begin_type_1:
// Set initial flags, skip spin-up if possible. // Set initial flags, skip spin-up if possible.
@@ -239,6 +259,7 @@ void WD1770::posit_event(int new_event_type) {
status.data_request = false; status.data_request = false;
}); });
LOG("Step/Seek/Restore with track " << int(track_) << " data " << int(data_));
if(!has_motor_on_line() && !has_head_load_line()) goto test_type1_type; if(!has_motor_on_line() && !has_head_load_line()) goto test_type1_type;
if(has_motor_on_line()) goto begin_type1_spin_up; if(has_motor_on_line()) goto begin_type1_spin_up;
@@ -271,19 +292,19 @@ void WD1770::posit_event(int new_event_type) {
} }
perform_seek_or_restore_command: perform_seek_or_restore_command:
if(track_ == data_) goto verify; if(track_ == data_) goto verify_seek;
step_direction_ = (data_ > track_); step_direction_ = (data_ > track_);
adjust_track: adjust_track:
if(step_direction_) track_++; else track_--; if(step_direction_) ++track_; else --track_;
perform_step: perform_step:
if(!step_direction_ && get_drive().get_is_track_zero()) { if(!step_direction_ && get_drive().get_is_track_zero()) {
track_ = 0; track_ = 0;
goto verify; goto verify_seek;
} }
get_drive().step(step_direction_ ? 1 : -1); get_drive().step(Storage::Disk::HeadPosition(step_direction_ ? 1 : -1));
unsigned int time_to_wait; Cycles::IntType time_to_wait;
switch(command_ & 3) { switch(command_ & 3) {
default: default:
case 0: time_to_wait = 6; break; case 0: time_to_wait = 6; break;
@@ -292,14 +313,17 @@ void WD1770::posit_event(int new_event_type) {
case 3: time_to_wait = (personality_ == P1772) ? 3 : 30; break; case 3: time_to_wait = (personality_ == P1772) ? 3 : 30; break;
} }
WAIT_FOR_TIME(time_to_wait); WAIT_FOR_TIME(time_to_wait);
if(command_ >> 5) goto verify; if(command_ >> 5) goto verify_seek;
goto perform_seek_or_restore_command; goto perform_seek_or_restore_command;
perform_step_command: perform_step_command:
if(command_ & 0x10) goto adjust_track; if(command_ & 0x10) goto adjust_track;
goto perform_step; goto perform_step;
verify: verify_seek:
update_status([this] (Status &status) {
status.track_zero = get_drive().get_is_track_zero();
});
if(!(command_ & 0x04)) { if(!(command_ & 0x04)) {
goto wait_for_command; goto wait_for_command;
} }
@@ -308,7 +332,7 @@ void WD1770::posit_event(int new_event_type) {
distance_into_section_ = 0; distance_into_section_ = 0;
verify_read_data: verify_read_data:
WAIT_FOR_EVENT(static_cast<int>(Event::IndexHole) | static_cast<int>(Event::Token)); WAIT_FOR_EVENT(int(Event::IndexHole) | int(Event::Token));
READ_ID(); READ_ID();
if(index_hole_count_ == 6) { if(index_hole_count_ == 6) {
@@ -318,7 +342,9 @@ void WD1770::posit_event(int new_event_type) {
goto wait_for_command; goto wait_for_command;
} }
if(distance_into_section_ == 7) { if(distance_into_section_ == 7) {
distance_into_section_ = 0;
set_data_mode(DataMode::Scanning); set_data_mode(DataMode::Scanning);
if(get_crc_generator().get_value()) { if(get_crc_generator().get_value()) {
update_status([] (Status &status) { update_status([] (Status &status) {
status.crc_error = true; status.crc_error = true;
@@ -327,14 +353,12 @@ void WD1770::posit_event(int new_event_type) {
} }
if(header_[0] == track_) { if(header_[0] == track_) {
printf("Reached track %d\n", track_); LOG("Reached track " << std::dec << int(track_));
update_status([] (Status &status) { update_status([] (Status &status) {
status.crc_error = false; status.crc_error = false;
}); });
goto wait_for_command; goto wait_for_command;
} }
distance_into_section_ = 0;
} }
goto verify_read_data; goto verify_read_data;
@@ -342,13 +366,13 @@ void WD1770::posit_event(int new_event_type) {
/* /*
Type 2 entry point. Type 2 entry point.
*/ */
// +--------+----------+-------------------------+ // +--------+----------+-------------------------+
// ! ! ! BITS ! // ! ! ! BITS !
// ! TYPE ! COMMAND ! 7 6 5 4 3 2 1 0 ! // ! TYPE ! COMMAND ! 7 6 5 4 3 2 1 0 !
// +--------+----------+-------------------------+ // +--------+----------+-------------------------+
// ! 2 ! Rd sectr ! 1 0 0 m h E 0 0 ! // ! 2 ! Rd sectr ! 1 0 0 m h E 0 0 !
// ! 2 ! Wt sectr ! 1 0 1 m h E P a0 ! // ! 2 ! Wt sectr ! 1 0 1 m h E P a0 !
// +--------+----------+-------------------------+ // +--------+----------+-------------------------+
begin_type_2: begin_type_2:
update_status([] (Status &status) { update_status([] (Status &status) {
@@ -391,25 +415,30 @@ void WD1770::posit_event(int new_event_type) {
goto wait_for_command; goto wait_for_command;
} }
distance_into_section_ = 0;
set_data_mode(DataMode::Scanning);
type2_get_header: type2_get_header:
WAIT_FOR_EVENT(static_cast<int>(Event::IndexHole) | static_cast<int>(Event::Token)); WAIT_FOR_EVENT(int(Event::IndexHole) | int(Event::Token));
READ_ID(); READ_ID();
if(index_hole_count_ == 5) { if(index_hole_count_ == 5) {
printf("Failed to find sector %d\n", sector_); LOG("Failed to find sector " << std::dec << int(sector_));
update_status([] (Status &status) { update_status([] (Status &status) {
status.record_not_found = true; status.record_not_found = true;
}); });
goto wait_for_command; goto wait_for_command;
} }
if(distance_into_section_ == 7) { if(distance_into_section_ == 7) {
printf("Considering %d/%d\n", header_[0], header_[2]); distance_into_section_ = 0;
set_data_mode(DataMode::Scanning); set_data_mode(DataMode::Scanning);
LOG("Considering " << std::dec << int(header_[0]) << "/" << int(header_[2]));
if( header_[0] == track_ && header_[2] == sector_ && if( header_[0] == track_ && header_[2] == sector_ &&
(has_motor_on_line() || !(command_&0x02) || ((command_&0x08) >> 3) == header_[1])) { (has_motor_on_line() || !(command_&0x02) || ((command_&0x08) >> 3) == header_[1])) {
printf("Found %d/%d\n", header_[0], header_[2]); LOG("Found " << std::dec << int(header_[0]) << "/" << int(header_[2]));
if(get_crc_generator().get_value()) { if(get_crc_generator().get_value()) {
printf("CRC error; back to searching\n"); LOG("CRC error; back to searching");
update_status([] (Status &status) { update_status([] (Status &status) {
status.crc_error = true; status.crc_error = true;
}); });
@@ -421,7 +450,6 @@ void WD1770::posit_event(int new_event_type) {
}); });
goto type2_read_or_write_data; goto type2_read_or_write_data;
} }
distance_into_section_ = 0;
} }
goto type2_get_header; goto type2_get_header;
@@ -464,19 +492,24 @@ void WD1770::posit_event(int new_event_type) {
header_[distance_into_section_] = get_latest_token().byte_value; header_[distance_into_section_] = get_latest_token().byte_value;
distance_into_section_++; distance_into_section_++;
if(distance_into_section_ == 2) { if(distance_into_section_ == 2) {
distance_into_section_ = 0;
set_data_mode(DataMode::Scanning);
if(get_crc_generator().get_value()) { if(get_crc_generator().get_value()) {
printf("CRC error; terminating\n"); LOG("CRC error; terminating");
update_status([this] (Status &status) { update_status([this] (Status &status) {
status.crc_error = true; status.crc_error = true;
}); });
goto wait_for_command; goto wait_for_command;
} }
LOG("Finished reading sector " << std::dec << int(sector_));
if(command_ & 0x10) { if(command_ & 0x10) {
sector_++; sector_++;
LOG("Advancing to search for sector " << std::dec << int(sector_));
goto test_type2_write_protection; goto test_type2_write_protection;
} }
printf("Finished reading sector %d\n", sector_);
goto wait_for_command; goto wait_for_command;
} }
goto type2_check_crc; goto type2_check_crc;
@@ -522,7 +555,7 @@ void WD1770::posit_event(int new_event_type) {
type2_write_loop: type2_write_loop:
/* /*
This deviates from the data sheet slightly since that would prima facie request one more byte This deviates from the data sheet slightly since that would prima facie request one more byte
of data than is actually written the last time around the loop it has transferred from the of data than is actually written; the last time around the loop it has transferred from the
data register to the data shift register, set data request, written the byte, checked that data data register to the data shift register, set data request, written the byte, checked that data
request has been satified, then finally considers whether all bytes are done. Based on both request has been satified, then finally considers whether all bytes are done. Based on both
natural expectations and the way that emulated machines responded, I believe that to be a natural expectations and the way that emulated machines responded, I believe that to be a
@@ -558,21 +591,21 @@ void WD1770::posit_event(int new_event_type) {
sector_++; sector_++;
goto test_type2_write_protection; goto test_type2_write_protection;
} }
printf("Wrote sector %d\n", sector_); LOG("Wrote sector " << std::dec << int(sector_));
goto wait_for_command; goto wait_for_command;
/* /*
Type 3 entry point. Type 3 entry point.
*/ */
// +--------+----------+-------------------------+ // +--------+----------+-------------------------+
// ! ! ! BITS ! // ! ! ! BITS !
// ! TYPE ! COMMAND ! 7 6 5 4 3 2 1 0 ! // ! TYPE ! COMMAND ! 7 6 5 4 3 2 1 0 !
// +--------+----------+-------------------------+ // +--------+----------+-------------------------+
// ! 3 ! Rd addr ! 1 1 0 0 h E 0 0 ! // ! 3 ! Rd addr ! 1 1 0 0 h E 0 0 !
// ! 3 ! Rd track ! 1 1 1 0 h E 0 0 ! // ! 3 ! Rd track ! 1 1 1 0 h E 0 0 !
// ! 3 ! Wt track ! 1 1 1 1 h E P 0 ! // ! 3 ! Wt track ! 1 1 1 1 h E P 0 !
// +--------+----------+-------------------------+ // +--------+----------+-------------------------+
begin_type_3: begin_type_3:
update_status([] (Status &status) { update_status([] (Status &status) {
status.type = Status::Three; status.type = Status::Three;
@@ -609,8 +642,8 @@ void WD1770::posit_event(int new_event_type) {
distance_into_section_ = 0; distance_into_section_ = 0;
read_address_get_header: read_address_get_header:
WAIT_FOR_EVENT(static_cast<int>(Event::IndexHole) | static_cast<int>(Event::Token)); WAIT_FOR_EVENT(int(Event::IndexHole) | int(Event::Token));
if(new_event_type == static_cast<int>(Event::Token)) { if(new_event_type == int(Event::Token)) {
if(!distance_into_section_ && get_latest_token().type == Token::ID) {set_data_mode(DataMode::Reading); distance_into_section_++; } if(!distance_into_section_ && get_latest_token().type == Token::ID) {set_data_mode(DataMode::Reading); distance_into_section_++; }
else if(distance_into_section_ && distance_into_section_ < 7 && get_latest_token().type == Token::Byte) { else if(distance_into_section_ && distance_into_section_ < 7 && get_latest_token().type == Token::Byte) {
if(status_.data_request) { if(status_.data_request) {
@@ -624,9 +657,11 @@ void WD1770::posit_event(int new_event_type) {
update_status([] (Status &status) { update_status([] (Status &status) {
status.data_request = true; status.data_request = true;
}); });
distance_into_section_++; ++distance_into_section_;
if(distance_into_section_ == 7) { if(distance_into_section_ == 7) {
distance_into_section_ = 0;
if(get_crc_generator().get_value()) { if(get_crc_generator().get_value()) {
update_status([] (Status &status) { update_status([] (Status &status) {
status.crc_error = true; status.crc_error = true;
@@ -650,7 +685,7 @@ void WD1770::posit_event(int new_event_type) {
index_hole_count_ = 0; index_hole_count_ = 0;
read_track_read_byte: read_track_read_byte:
WAIT_FOR_EVENT(static_cast<int>(Event::Token) | static_cast<int>(Event::IndexHole)); WAIT_FOR_EVENT(int(Event::Token) | int(Event::IndexHole));
if(index_hole_count_) { if(index_hole_count_) {
goto wait_for_command; goto wait_for_command;
} }
@@ -717,7 +752,7 @@ void WD1770::posit_event(int new_event_type) {
case 0xfd: case 0xfe: case 0xfd: case 0xfe:
// clock is 0xc7 = 1010 0000 0010 1010 = 0xa022 // clock is 0xc7 = 1010 0000 0010 1010 = 0xa022
write_raw_short( write_raw_short(
static_cast<uint16_t>( uint16_t(
0xa022 | 0xa022 |
((data_ & 0x80) << 7) | ((data_ & 0x80) << 7) |
((data_ & 0x40) << 6) | ((data_ & 0x40) << 6) |
@@ -766,15 +801,18 @@ void WD1770::posit_event(int new_event_type) {
} }
void WD1770::update_status(std::function<void(Status &)> updater) { void WD1770::update_status(std::function<void(Status &)> updater) {
const Status old_status = status_;
if(delegate_) { if(delegate_) {
Status old_status = status_;
updater(status_); updater(status_);
bool did_change = const bool did_change =
(status_.busy != old_status.busy) || (status_.busy != old_status.busy) ||
(status_.data_request != old_status.data_request); (status_.data_request != old_status.data_request) ||
(status_.interrupt_request != old_status.interrupt_request);
if(did_change) delegate_->wd1770_did_change_output(this); if(did_change) delegate_->wd1770_did_change_output(this);
} } else updater(status_);
else updater(status_);
if(status_.busy != old_status.busy) update_clocking_observer();
} }
void WD1770::set_head_load_request(bool head_load) {} void WD1770::set_head_load_request(bool head_load) {}
@@ -782,5 +820,10 @@ void WD1770::set_motor_on(bool motor_on) {}
void WD1770::set_head_loaded(bool head_loaded) { void WD1770::set_head_loaded(bool head_loaded) {
head_is_loaded_ = head_loaded; head_is_loaded_ = head_loaded;
if(head_loaded) posit_event(static_cast<int>(Event1770::HeadLoad)); if(head_loaded) posit_event(int(Event1770::HeadLoad));
}
ClockingHint::Preference WD1770::preferred_clocking() {
if(status_.busy) return ClockingHint::Preference::RealTime;
return Storage::Disk::MFMController::preferred_clocking();
} }

View File

@@ -3,7 +3,7 @@
// Clock Signal // Clock Signal
// //
// Created by Thomas Harte on 17/09/2016. // Created by Thomas Harte on 17/09/2016.
// Copyright © 2016 Thomas Harte. All rights reserved. // Copyright 2016 Thomas Harte. All rights reserved.
// //
#ifndef _770_hpp #ifndef _770_hpp
@@ -36,14 +36,13 @@ class WD1770: public Storage::Disk::MFMController {
using Storage::Disk::MFMController::set_is_double_density; using Storage::Disk::MFMController::set_is_double_density;
/// Writes @c value to the register at @c address. Only the low two bits of the address are decoded. /// Writes @c value to the register at @c address. Only the low two bits of the address are decoded.
void set_register(int address, uint8_t value); void write(int address, uint8_t value);
/// Fetches the value of the register @c address. Only the low two bits of the address are decoded. /// Fetches the value of the register @c address. Only the low two bits of the address are decoded.
uint8_t get_register(int address); uint8_t read(int address);
/// Runs the controller for @c number_of_cycles cycles. /// Runs the controller for @c number_of_cycles cycles.
void run_for(const Cycles cycles); void run_for(const Cycles cycles);
using Storage::Disk::Controller::run_for;
enum Flag: uint8_t { enum Flag: uint8_t {
NotReady = 0x80, NotReady = 0x80,
@@ -74,6 +73,8 @@ class WD1770: public Storage::Disk::MFMController {
}; };
inline void set_delegate(Delegate *delegate) { delegate_ = delegate; } inline void set_delegate(Delegate *delegate) { delegate_ = delegate; }
ClockingHint::Preference preferred_clocking() final;
protected: protected:
virtual void set_head_load_request(bool head_load); virtual void set_head_load_request(bool head_load);
virtual void set_motor_on(bool motor_on); virtual void set_motor_on(bool motor_on);
@@ -95,6 +96,7 @@ class WD1770: public Storage::Disk::MFMController {
bool data_request = false; bool data_request = false;
bool interrupt_request = false; bool interrupt_request = false;
bool busy = false; bool busy = false;
bool track_zero = false;
enum { enum {
One, Two, Three One, Two, Three
} type = One; } type = One;
@@ -122,7 +124,7 @@ class WD1770: public Storage::Disk::MFMController {
void posit_event(int type); void posit_event(int type);
int interesting_event_mask_; int interesting_event_mask_;
int resume_point_ = 0; int resume_point_ = 0;
unsigned int delay_time_ = 0; Cycles::IntType delay_time_ = 0;
// ID buffer // ID buffer
uint8_t header_[6]; uint8_t header_[6];

312
Components/5380/ncr5380.cpp Normal file
View File

@@ -0,0 +1,312 @@
//
// ncr5380.cpp
// Clock Signal
//
// Created by Thomas Harte on 10/08/2019.
// Copyright © 2019 Thomas Harte. All rights reserved.
//
#include "ncr5380.hpp"
#include "../../Outputs/Log.hpp"
using namespace NCR::NCR5380;
using SCSI::Line;
NCR5380::NCR5380(SCSI::Bus &bus, int clock_rate) :
bus_(bus),
clock_rate_(clock_rate) {
device_id_ = bus_.add_device();
bus_.add_observer(this);
}
void NCR5380::write(int address, uint8_t value, bool dma_acknowledge) {
switch(address & 7) {
case 0:
// LOG("[SCSI 0] Set current SCSI bus state to " << PADHEX(2) << int(value));
data_bus_ = value;
if(dma_request_ && dma_operation_ == DMAOperation::Send) {
// printf("w %02x\n", value);
dma_acknowledge_ = true;
dma_request_ = false;
update_control_output();
bus_.set_device_output(device_id_, bus_output_);
}
break;
case 1: {
// LOG("[SCSI 1] Initiator command register set: " << PADHEX(2) << int(value));
initiator_command_ = value;
bus_output_ &= ~(Line::Reset | Line::Acknowledge | Line::Busy | Line::SelectTarget | Line::Attention);
if(value & 0x80) bus_output_ |= Line::Reset;
if(value & 0x08) bus_output_ |= Line::Busy;
if(value & 0x04) bus_output_ |= Line::SelectTarget;
/* bit 5 = differential enable if this were a 5381 */
test_mode_ = value & 0x40;
assert_data_bus_ = value & 0x01;
update_control_output();
} break;
case 2:
// LOG("[SCSI 2] Set mode: " << PADHEX(2) << int(value));
mode_ = value;
// bit 7: 1 = use block mode DMA mode (if DMA mode is also enabled)
// bit 6: 1 = be a SCSI target; 0 = be an initiator
// bit 5: 1 = check parity
// bit 4: 1 = generate an interrupt if parity checking is enabled and an error is found
// bit 3: 1 = generate an interrupt when an EOP is received from the DMA controller
// bit 2: 1 = generate an interrupt and reset low 6 bits of register 1 if an unexpected loss of Line::Busy occurs
// bit 1: 1 = use DMA mode
// bit 0: 1 = begin arbitration mode (device ID should be in register 0)
arbitration_in_progress_ = false;
switch(mode_ & 0x3) {
case 0x0:
bus_output_ &= ~SCSI::Line::Busy;
dma_request_ = false;
set_execution_state(ExecutionState::None);
break;
case 0x1:
arbitration_in_progress_ = true;
set_execution_state(ExecutionState::WaitingForBusy);
lost_arbitration_ = false;
break;
default:
assert_data_bus_ = false;
set_execution_state(ExecutionState::PerformingDMA);
bus_.update_observers();
break;
}
update_control_output();
break;
case 3: {
// LOG("[SCSI 3] Set target command: " << PADHEX(2) << int(value));
target_command_ = value;
update_control_output();
} break;
case 4:
// LOG("[SCSI 4] Set select enabled: " << PADHEX(2) << int(value));
break;
case 5:
// LOG("[SCSI 5] Start DMA send: " << PADHEX(2) << int(value));
dma_operation_ = DMAOperation::Send;
break;
case 6:
// LOG("[SCSI 6] Start DMA target receive: " << PADHEX(2) << int(value));
dma_operation_ = DMAOperation::TargetReceive;
break;
case 7:
// LOG("[SCSI 7] Start DMA initiator receive: " << PADHEX(2) << int(value));
dma_operation_ = DMAOperation::InitiatorReceive;
break;
}
// Data is output only if the data bus is asserted.
if(assert_data_bus_) {
bus_output_ = (bus_output_ & ~SCSI::Line::Data) | data_bus_;
} else {
bus_output_ &= ~SCSI::Line::Data;
}
// In test mode, still nothing is output. Otherwise throw out
// the current value of bus_output_.
if(test_mode_) {
bus_.set_device_output(device_id_, SCSI::DefaultBusState);
} else {
bus_.set_device_output(device_id_, bus_output_);
}
}
uint8_t NCR5380::read(int address, bool dma_acknowledge) {
switch(address & 7) {
case 0:
// LOG("[SCSI 0] Get current SCSI bus state: " << PADHEX(2) << (bus_.get_state() & 0xff));
if(dma_request_ && dma_operation_ == DMAOperation::InitiatorReceive) {
dma_acknowledge_ = true;
dma_request_ = false;
update_control_output();
bus_.set_device_output(device_id_, bus_output_);
}
return uint8_t(bus_.get_state());
case 1:
// LOG("[SCSI 1] Initiator command register get: " << (arbitration_in_progress_ ? 'p' : '-') << (lost_arbitration_ ? 'l' : '-'));
return
// Bits repeated as they were set.
(initiator_command_ & ~0x60) |
// Arbitration in progress.
(arbitration_in_progress_ ? 0x40 : 0x00) |
// Lost arbitration.
(lost_arbitration_ ? 0x20 : 0x00);
case 2:
// LOG("[SCSI 2] Get mode");
return mode_;
case 3:
// LOG("[SCSI 3] Get target command");
return target_command_;
case 4: {
const auto bus_state = bus_.get_state();
const uint8_t result =
((bus_state & Line::Reset) ? 0x80 : 0x00) |
((bus_state & Line::Busy) ? 0x40 : 0x00) |
((bus_state & Line::Request) ? 0x20 : 0x00) |
((bus_state & Line::Message) ? 0x10 : 0x00) |
((bus_state & Line::Control) ? 0x08 : 0x00) |
((bus_state & Line::Input) ? 0x04 : 0x00) |
((bus_state & Line::SelectTarget) ? 0x02 : 0x00) |
((bus_state & Line::Parity) ? 0x01 : 0x00);
// LOG("[SCSI 4] Get current bus state: " << PADHEX(2) << int(result));
return result;
}
case 5: {
const auto bus_state = bus_.get_state();
const bool phase_matches =
(target_output() & (Line::Message | Line::Control | Line::Input)) ==
(bus_state & (Line::Message | Line::Control | Line::Input));
const uint8_t result =
/* b7 = end of DMA */
((dma_request_ && state_ == ExecutionState::PerformingDMA) ? 0x40 : 0x00) |
/* b5 = parity error */
/* b4 = IRQ active */
(phase_matches ? 0x08 : 0x00) |
/* b2 = busy error */
((bus_state & Line::Attention) ? 0x02 : 0x00) |
((bus_state & Line::Acknowledge) ? 0x01 : 0x00);
// LOG("[SCSI 5] Get bus and status: " << PADHEX(2) << int(result));
return result;
}
case 6:
// LOG("[SCSI 6] Get input data");
return 0xff;
case 7:
// LOG("[SCSI 7] Reset parity/interrupt");
return 0xff;
}
return 0;
}
SCSI::BusState NCR5380::target_output() {
SCSI::BusState output = SCSI::DefaultBusState;
if(target_command_ & 0x08) output |= Line::Request;
if(target_command_ & 0x04) output |= Line::Message;
if(target_command_ & 0x02) output |= Line::Control;
if(target_command_ & 0x01) output |= Line::Input;
return output;
}
void NCR5380::update_control_output() {
bus_output_ &= ~(Line::Request | Line::Message | Line::Control | Line::Input | Line::Acknowledge | Line::Attention);
if(mode_ & 0x40) {
// This is a target; C/D, I/O, /MSG and /REQ are signalled on the bus.
bus_output_ |= target_output();
} else {
// This is an initiator; /ATN and /ACK are signalled on the bus.
if(
(initiator_command_ & 0x10) ||
(state_ == ExecutionState::PerformingDMA && dma_acknowledge_)
) bus_output_ |= Line::Acknowledge;
if(initiator_command_ & 0x02) bus_output_ |= Line::Attention;
}
}
void NCR5380::scsi_bus_did_change(SCSI::Bus *, SCSI::BusState new_state, double time_since_change) {
switch(state_) {
default: break;
/*
Official documentation:
Arbitration is accomplished using a bus-free filter to continuously monitor BSY.
If BSY remains inactive for at least 400 nsec then the SCSI bus is considered free
and arbitration may begin. Arbitration will begin if the bus is free, SEL is inactive
and the ARBITRATION bit (port 2, bit 0) is active. Once arbitration has begun
(BSY asserted), an arbitration delay of 2.2 /Lsec must elapse before the data bus
can be examined to deter- mine if arbitration has been won. This delay must be
implemented in the controlling software driver.
Personal notes:
I'm discounting that "arbitratation is accomplished" opening, and assuming that what needs
to happen is:
(i) wait for BSY to be inactive;
(ii) count 400 nsec;
(iii) check that BSY and SEL are inactive.
*/
case ExecutionState::WaitingForBusy:
if(!(new_state & SCSI::Line::Busy) || time_since_change < SCSI::DeskewDelay) return;
state_ = ExecutionState::WatchingBusy;
case ExecutionState::WatchingBusy:
if(!(new_state & SCSI::Line::Busy)) {
lost_arbitration_ = true;
set_execution_state(ExecutionState::None);
}
// Check for having hit 400ns (more or less) since BSY was inactive.
if(time_since_change >= SCSI::BusSettleDelay) {
// arbitration_in_progress_ = false;
if(new_state & SCSI::Line::SelectTarget) {
lost_arbitration_ = true;
set_execution_state(ExecutionState::None);
} else {
bus_output_ &= ~SCSI::Line::Busy;
set_execution_state(ExecutionState::None);
}
}
/* TODO: there's a bug here, given that the dropping of Busy isn't communicated onward. */
break;
case ExecutionState::PerformingDMA:
if(time_since_change < SCSI::DeskewDelay) return;
// Signal a DMA request if the request line is active, i.e. meaningful data is
// on the bus, and this device hasn't yet acknowledged it.
switch(new_state & (SCSI::Line::Request | SCSI::Line::Acknowledge)) {
case 0:
dma_request_ = false;
break;
case SCSI::Line::Request:
dma_request_ = true;
break;
case SCSI::Line::Request | SCSI::Line::Acknowledge:
dma_request_ = false;
break;
case SCSI::Line::Acknowledge:
dma_acknowledge_ = false;
dma_request_ = false;
update_control_output();
bus_.set_device_output(device_id_, bus_output_);
break;
}
break;
}
}
void NCR5380::set_execution_state(ExecutionState state) {
state_ = state;
if(state != ExecutionState::PerformingDMA) dma_operation_ = DMAOperation::Ready;
}

View File

@@ -0,0 +1,75 @@
//
// ncr5380.hpp
// Clock Signal
//
// Created by Thomas Harte on 10/08/2019.
// Copyright © 2019 Thomas Harte. All rights reserved.
//
#ifndef ncr5380_hpp
#define ncr5380_hpp
#include <cstdint>
#include "../../Storage/MassStorage/SCSI/SCSI.hpp"
namespace NCR {
namespace NCR5380 {
/*!
Models the NCR 5380, a SCSI interface chip.
*/
class NCR5380 final: public SCSI::Bus::Observer {
public:
NCR5380(SCSI::Bus &bus, int clock_rate);
/*! Writes @c value to @c address. */
void write(int address, uint8_t value, bool dma_acknowledge = false);
/*! Reads from @c address. */
uint8_t read(int address, bool dma_acknowledge = false);
private:
SCSI::Bus &bus_;
const int clock_rate_;
size_t device_id_;
SCSI::BusState bus_output_ = SCSI::DefaultBusState;
SCSI::BusState expected_phase_ = SCSI::DefaultBusState;
uint8_t mode_ = 0xff;
uint8_t initiator_command_ = 0xff;
uint8_t data_bus_ = 0xff;
uint8_t target_command_ = 0xff;
bool test_mode_ = false;
bool assert_data_bus_ = false;
bool dma_request_ = false;
bool dma_acknowledge_ = false;
enum class ExecutionState {
None,
WaitingForBusy,
WatchingBusy,
PerformingDMA,
} state_ = ExecutionState::None;
enum class DMAOperation {
Ready,
Send,
TargetReceive,
InitiatorReceive
} dma_operation_ = DMAOperation::Ready;
bool lost_arbitration_ = false, arbitration_in_progress_ = false;
void set_execution_state(ExecutionState state);
SCSI::BusState target_output();
void update_control_output();
void scsi_bus_did_change(SCSI::Bus *, SCSI::BusState new_state, double time_since_change) final;
};
}
}
#endif /* ncr5380_hpp */

Some files were not shown because too many files have changed in this diff Show More