Commit Graph

60 Commits

Author SHA1 Message Date
tomcw
6282790c3d Add comments to both Harddisk.cpp & the firmware code about 'sta abs16,x' false-reads, etc.
Harddisk.cpp: Fix typos and update the notes on the r/w commands' operation.
2021-11-11 21:20:54 +00:00
TomCh
5ed901f720
Slot-independent HDD firmware (#996, PR #998)
. Move the 'read block' command into the emulator - to mirror the write command
. With emulated time to do the DMA for the r/w block command
2021-11-09 21:04:57 +00:00
tomcw
d96ed5b8c5 Refactor: move m_slot into Card class 2021-11-01 21:01:28 +00:00
tomcw
67b3c28833 Refactor: remove slot from InitializeIO() calls for card objects 2021-11-01 20:39:26 +00:00
TomCh
ff7c9dc185
Make harddisk a class (#995)
. Add user-protection when unchecking HDD controller (as images aren't restored on a 'cancel')
. Fix possible crash when removing (via Config->Disk) either Disk2 card(s5) or HDD card(s7), then cancelling during emulation
. Fix m_buf[] size
2021-11-01 20:12:42 +00:00
TomCh
ed298b4fd9
Improve save-state card management (PR #983)
Initially all cards are removed before loading save-state.

Use new Registry "Configuration/Slot 2" location to save SSC's port name.
Use new Registry "Configuration/Slot 7" location to save HDV's image names.
Use new Registry "Configuration/Slot n" (and "Configuration/Slot Auxiliary") locations to save all other card types.

Command line: -s<slot> (eg. -s7 empty) now get persisted to the Registry.

Only update 'HDV Starting Directory' for slot7 & drive1.
2021-09-17 20:43:10 +01:00
Andrea
4375418506
Move some "char *"to "const char *", and avoid unnecessary c_str(). (PR #973) 2021-07-25 11:55:25 +01:00
tomcw
71bea52419 Disk/Harddisk: Insert() - fix comment and rename var 2021-07-15 19:23:01 +01:00
Andrea
4f45202baf
Save full pathname to registry. (#960 PR #959)
This was already happening for Hard Disks (although in a convoluted way).
Extend to Floppy Disks.
2021-07-13 21:24:29 +01:00
tomcw
05b9668f72 Use enum SLOTS and remove pre-processor SLOTn defines 2021-05-19 21:26:23 +01:00
Andrea
de7f35e6bd
Make path separator OS-dependent (PR #954) 2021-05-19 21:10:22 +01:00
Andrea
cdf1cb9106
Remove usages of g_hFrameWindow and g_hInstance from core emulator files. And Resource related Win32 functions. (PR #915)
. Win32Frame: remove WM_USER_RESTART.
2021-01-19 20:37:43 +00:00
Andrea
6cffb30330
FrameBase: some changes to ease implementations (PR #910)
. simplify the interface FrameBase to make it easier to implement it for different cases (remove HDC and make parameters more explicit)
. remove functions which are only called on a Win32Frame (in which case a cast is guaranteed to succeed)
. otherwise there is the risk that every FrameBase implementation wants to add its own variants.
. FrameBase::FrameRefreshStatus() simplify implementation: pass all flags explicitly
2021-01-10 16:33:06 +00:00
TomCh
3aa5750dcf
Make Video.cpp and WinVideo.cpp into a dependent class hierarchy (PR #898)
. class hierarchy: WinVideo IS_A Video (ie. WinVideo is a subclass of Video)
. GetVideo() singleton instance of WinVideo in AppleWin.cpp, exposed via Interface.h
2020-12-28 16:25:29 +00:00
Andrea
e27879ac99
Move interface into a class FrameBase. (PR #893)
. Move the Win32  implementation into Win32Frame.
2020-12-24 15:08:50 +00:00
Andrea
30d3269fbf
Remove a few more Win32 memory functions. (PR #888)
CopyMemory, MoveMemory, FillMemory.
2020-12-12 11:09:14 +00:00
Andrea
d2a34e1f91
Remove VirtualAlloc, VirtualFree & ZeroMemory. (PR #884)
. Allocation in Memory.cpp: keep VirtualAlloc of size=64KiB (alignment=64KiB) to ease debugging.
2020-12-10 21:08:15 +00:00
Andrea
7ca547479b
Move Windows related functions to Interface.h (PR #882)
This is not complete as header files from Windows/.. are still included in:

Keyboard.cpp
SerialComms.cpp
Joystick.cpp

But probably these are arch specific and will have to be completely reimplemented elsewhere.
2020-11-29 17:30:06 +00:00
Andrea
bbe88da787
AppleWin.cpp split (PR #875)
. Split AppleWin -> Core with the functionality really needed by the emulator.
. Split AppleWin -> Utilities for generic code not called by other emulator components.
. Split AppleWin -> CmdLine for the command line option parsing.
2020-11-26 21:50:06 +00:00
Andrea
c455488b50
Split Frame.cpp to WinFrame.cpp (PR #874) 2020-11-23 19:21:20 +00:00
tomcw
bd1d65ce4f Renamed Applewin.h to AppleWin.h across entire project 2020-11-11 22:12:39 +00:00
Andrea
01ad5d1882
Ensure all header files can be included (in any order) after stdafx.h. (PR #866) 2020-11-11 21:15:27 +00:00
ThorstenB
4543117f81
More clean-up, portability and another debugger fix (PR #847)
Fixed debugger main "data" window behaviour:
. When activating the main data display ("data" command) the cursor keys wouldn't work until the minidump ("md1") was also enabled. NB. The cursor keys should work in the main data window, independently of whether the minidump is active.
2020-10-25 17:27:59 +00:00
TomCh
43455eb4fe
Improved determining path & filename when saving/loading a save-state (#691) (PR #849)
Whenever harddisks/disks are inserted (or removed) and *if path has changed* then:
. Then the internal save-state's path & filename will be updated to reflect the new defaults.
. LoadConfiguration(): Read the save-state pathname from Registry before harddisks/disks.

Also:
. CiderPress: only save pathname on OK.
. Refactored CPropertySheetHelper::BrowseToFile().
. Extended support for -d1,-d2,-h1, etc such that if the param is "", then it will eject/unplug the disk/harddisk.
2020-10-25 17:14:23 +00:00
tomcw
1a11c65d37 Replaced global g_CardMgr with a singleton object & GetCardMgr() call. (Fixes #843) 2020-10-11 17:34:44 +01:00
Andrea
af720f7352 Correct way to clear a std::string. (PR #723) 2020-01-09 22:12:51 +00:00
TomCh
769d4c6927
Support 2nd Disk][ card and improved card management (#726) (PR #741)
Support 2nd Disk][ in slot-5, via command line:
- -s5 diskii
- -s5d1 \<imagefile\>
- -s5d2 \<imagefile\>

NB. there's currently no Configuration UI support, except the Drive icons' tooltips show what's in slot-5 & slot-6 (for drive-n). So there's no way to eject the disks or insert new disks. The use-case I'm supporting it Wasteland which just has the 4 disks in the 4 drives.

Improved card management:
- Added `class Card` (in Card.h) which all other cards (that exist as classes) derive from (eg. LC,SSC,Mouse,Disk2).
- Added `class CardManager` (in CardManager.cpp\h) which now manages the 8 slots (and aux slot).
- Added `class Disk2CardManager` (in Disk2CardManager.cpp\h) which provides methods for operations that act on all Disk2 instances at the same time.
- Currently limited to just 1x SSC and 1x Mouse card (why would you need more?). This simplifies things, meaning there's no need to have dedicated SSCManager / MouseCardManager objects.
- Currently the 2nd Disk2 card can only be put into slot-5. This limitation is just due to the complexity of the Configuration UI. Having a more general drop-down per slot UI would remove this limitation.
2019-12-19 19:42:30 +00:00
tomcw
3cd4ead90d Disk: minor refactor 2019-10-13 16:01:00 +01:00
tomcw
1472f25bad Save-state: show an error MsgBox if old HDD v1 save-state and PC is in $Cnss HDD firmware 2019-10-13 15:48:07 +01:00
tomcw
31b78aa09a HDD: Fixed not being able to enable HDDs - regression introduced at 506a52f359 2019-10-05 16:56:38 +01:00
Andrea Odetti
bd201202cd Some more std::string changes.
Signed-off-by: Andrea Odetti <mariofutire@gmail.com>
2019-09-07 19:37:19 +01:00
Andrea Odetti
f5f60310c1 More std::strings.
Signed-off-by: Andrea Odetti <mariofutire@gmail.com>
2019-09-07 09:02:39 +01:00
tomcw
05f86f3e59 Changed _snprintf() to StringCbPrintf() (#268) 2019-08-25 19:21:33 +01:00
Brett Vickers
9e5e21b8c9 Prevent uninitialized value bugs and improve string safety.
This change does two things:

1. Updates the registry APIs to reduce the likelihood of uninitialized
variables.

The code wasn't always checking the return value of registry load operations.
In some cases, this led to uninitialized memory being used, and crashes could
result. For example, LoadConfiguration in Applewin.cpp was using an
uninitialized value for the computer type if no registry variable for the
"Apple 2 type" was set.

New registry reading methods and macros have also been introduced, allowing
default value fallbacks for the cases where a registry variable is not found.
This makes registry access simpler and safer when a default value is known in
advance.

The registry code's style has also been updated to conform with the rest of
the code base (tabs instead of spaces, naming conventions, etc.)

2. Introduces string safety improvements.

A number of code paths have been modified to use safe-string functions instead
of their unsafe counterparts (e.g., strcpy, sprintf).  In the process, some
strings were converted from "char" to "TCHAR". This was done mostly for
consistency with the rest of the code-base.
2019-08-09 13:38:50 -07:00
tomcw
1f846fa26f Rename Disk_t to FloppyDisk; and prefix members 2019-04-14 16:58:49 +01:00
tomcw
b17f880e6d HDD: Added a swap HDD function to the Config->Disk UI (#585) 2018-12-09 11:48:22 +00:00
tomcw
9be3864f32 Added cmd-line options -h1,-h2 for specifying HDDs - #398 2018-04-02 12:38:05 +01:00
tomcw
8dcc5d50ca Added a comment about HD_Insert() - #541 2018-03-10 14:30:18 +00:00
tomcw
d9accc82c5 Refactor codebase by renaming nCyclesLeft to uExecutedCycles (#540) 2018-03-03 21:27:50 +00:00
Andrea
6051bc55d0 Changes to ease code compilation in gcc. (#541)
Changes to ease code compilation in GCC.

Disk_t and HDD contain a std::string and for this reason they need a proper constructor, ZeroMemory is not guaranteed to work.
2018-02-24 15:12:40 +00:00
tomcw
5505ff696f HDD error wasn't cleared on a reset or power-cycle - fixes #515 2017-12-03 21:05:05 +00:00
Nick Westgate
f1b4dea990 Return ProDOS errors from Harddisk emulation. Fixes #452
Replace Basic System error codes with ProDOS ones.
2017-08-04 21:54:18 +12:00
tomcw
13aee80bd5 Disk Config dialog: minor bugs fixes (fixes #334) 2017-06-03 18:12:40 +01:00
tomcw
3edb78203e Refactor: polymorphically call CImageHelperBase Open() & Close() 2016-10-25 22:26:28 +01:00
tomcw
31483b33b9 Refactor: Get rid of HIMAGE handle for disk images 2016-10-25 21:09:48 +01:00
tomcw
0a7a0e9e5c Fixed #348 (>800KiB HDD images not mountable) 2016-09-19 22:14:57 +01:00
tomcw
d0243c71d7 Save-state: rename SaveHex{4|8|12|16...64} to SaveHexUint{4|8|12|16...64} 2016-03-04 21:26:14 +00:00
tomcw
33ee34b96c Save-state: SaveBool() / LoadBool() persists true,false values 2016-03-01 22:31:17 +00:00
tomcw
18feddceef Save-state: renamed SaveMapValueMemory() to SaveMemory() 2016-02-24 22:54:53 +00:00
tomcw
11789c9023 Save-state: Renamed YamlLoadHelper load-type functions to be more consistent with YamlSaveHelper functions 2016-02-24 22:38:59 +00:00