Commit Graph

64 Commits

Author SHA1 Message Date
dingusdev 213dd4c16e Update copyright info further 2026-01-30 08:12:04 -07:00
Maxim Poliakovski e75ee8d32a Update copyright year. 2026-01-30 12:15:00 +01:00
Paper 03ec9d9589 devices/floppy/floppyimg: use lambda function for HFS/MFS signature check
this is more obvious to read at a glance.
2025-12-06 08:51:35 -05:00
joevt 8db57534d3 Fix spelling of "constants". 2025-11-10 07:48:15 -07:00
Maxim Poliakovski 4d1765dd9a superdrive: remove superfluous track_zero. 2025-09-22 21:35:03 +02:00
Maxim Poliakovski ddd8c21c6d swim3.h: add definition for the INT_ERROR bit.
This bit isn't mentioned in the SWIM3 ERS.
But that's used in the MkLinux and BeOS drivers.
2025-09-22 21:35:03 +02:00
joevt 5412fbc198 Remove superfluous semicolons. 2025-06-27 19:01:14 -07:00
joevt 723e84930b superdrive: Add logging. 2025-05-31 14:53:47 -07:00
joevt b7a4e14ee9 floppyimg: Include the path in log messages.
Because there can be more than one floppy.
2025-05-31 14:53:34 -07:00
joevt bd9d7ea275 swim3: Clear timer id to 0 only when cancelling.
Maybe cancel_timer should take a reference and set it to zero for us?
2025-05-31 14:49:24 -07:00
joevt 35f2ce14f1 Add type and description to device descriptors.
Add supports_types to device descriptors so that we can determine
supported types without having to create the hardware device.
Add description so that each device can have an optional description.
2025-05-28 17:58:08 +02:00
joevt d300a31fa7 swim3: Ensure 32-bit multiply result. 2025-03-15 16:26:31 -07:00
joevt 98925a39b9 Code clean-up part 2. 2025-03-13 06:14:35 -07:00
dingusdev 77503df677 Code clean-up 2025-03-12 07:58:32 -07:00
dingusdev 0146e1a1cc Revert "swim3: Rename int_drive and fix mode change."
This reverts commit de4580d07c.
2025-03-10 20:07:17 -07:00
joevt de4580d07c swim3: Rename int_drive and fix mode change.
Rename int_drive to drive_1 or selected_drive which is selected by a new mode_change method.

mode_change fixes some logic issues with the original code with regards to changes to SWIM3_GO and SWIM3_GO_STEP bits.
2025-03-10 19:57:21 -07:00
joevt 434ceab25a Use explicit typecast of float to int. 2025-02-16 07:00:15 -07:00
joevt 101bb826f1 Make irq_id 64 bits.
- So that DMA and other interrupts can fit without overlap.
- To simplify conversion to interrupt mask.
- To reduce variables, defines, and code.
2025-02-10 06:49:39 -07:00
joevt 2f30395d00 Break long lines.
Make them 130 characters or less.
2025-01-30 06:30:51 -07:00
joevt ee45291533 superdrive: Make sure track remains in range. 2024-12-17 07:16:13 -07:00
joevt f813aed1ce superdrive: One exit path for status. 2024-12-17 07:11:01 -07:00
joevt a62954d1a7 superdrive: Separate function for set_motor_stat. 2024-12-17 07:10:22 -07:00
joevt 818f982c75 swim3: Create separate reset method.
And set defaults for some class fields.
2024-12-03 18:20:13 -07:00
joevt e72b571069 swim3: Add enums and use them. 2024-12-03 18:19:23 -07:00
Maxim Poliakovski 6d2872a07f superdrive: add missing break. 2024-11-30 11:55:16 +01:00
joevt 3c2887f8c3 floppyimg: Add null floppy image converter check. 2024-09-03 06:19:07 -07:00
joevt 900e58f0ad swim3: Set write protect by default.
Until write support is added.
2024-05-01 06:52:11 -07:00
joevt 62e80c0c2f superdrive: Add name. 2024-05-01 06:52:01 -07:00
Mihai Parparita d4c9db7fcf Move disk image reading to be behind an ImgFile class
Allows different implementations for different platforms (the JS
build relies on browser APIs to stream disk images over the network).

Setting aside the JS build, this also reduces some code duplication.
2023-11-09 21:49:28 -08:00
Mihai Parparita 35c86ad6bf Clean up #includes
Result of running IWYU (https://include-what-you-use.org/) and
applying most of the suggestions about unncessary includes and
forward declarations.

Was motivated by observing that <thread> was being included in
ppcopcodes.cpp even though it was unused (found while researching
the use of threads), but seems generally good to help with build
times and correctness.
2023-11-03 00:33:47 -07:00
Mihai Parparita 1f7edfdb3b Make Emscripten build not depend on SDL2 or cubeb
While Emscripten has an SDL compabtility layer, it assumes that the
code is executing in the main browser process (and thus has access to
them DOM). The Infinite Mac project runs emulators in a worker thread
(for better performance) and has a custom API for the display, sound,
input, etc. Similarly, it does not need the cross-platform sound support
from cubeb, there there is a sound API as well.

This commit makes SDL (*_sdl.cpp) and cubeb-based (*_cubeb.cpp) code be
skipped when targeting Emscripten, and instead *_js.cpp files are used
instead (this is the cross-platform convention used by Chromium[^1], and
could be extended for other targets).

For hostevents.cpp and soundserver.cpp the entire file was replaced,
whereas for videoctrl.cpp there was enough shared logic that it was
kept, and the platform-specific bits were moved behind a Display class
that can have per-platform implementations. For cases where we need
additional private fields in the platform-specific classes, we use
a PIMPL pattern.

The *_js.cpp files with implementations are not included in this
commit, since they are closely tied to the Infinite Mac project, and
will live in its fork of DingusPPC.

[^1]: https://www.chromium.org/developers/design-documents/conventions-and-patterns-for-multi-platform-development/
2023-10-25 22:25:53 -07:00
joevt 5294a8b71c Fix compiler warnings: unused variables. 2023-01-11 01:17:12 -08:00
joevt 64fec88436 Fix compiler warnings: cast loses precision.
Use explicit cast when converting large integer types to smaller integer types when it is known that the most significant bytes are not required.
For pcidevice, check the ROM file size before casting to int. We'll allow expansion ROM sizes up to 4MB but usually they are 64K, sometimes 128K, rarely 256K.
for machinefactory, change the type to size_t so that it can correctly get the size of files that are larger than 4GB; it already checks the file size is 4MB before we need to cast to uint32_t.
For floppyimg, check the image size before casting to int. For raw images, only allow files up to 2MB. For DiskCopy42 images, it already checks the file size, so do the cast after that.
2023-01-11 01:17:12 -08:00
Maxim Poliakovski 78528a1a16 floppyimg: correct format for MFM DC42 images. 2022-12-12 02:27:42 +01:00
Maxim Poliakovski df02f5053b floppyimg: initial support for Disk Copy 4.2 images. 2022-12-11 23:00:52 +01:00
Maxim Poliakovski 4f05d3dae6 swim3: implement reading the Step register. 2022-11-18 18:06:46 +01:00
Maxim Poliakovski d96351763f swim3: emulate on-chip 1 us timer. 2022-11-17 18:03:18 +01:00
Maxim Poliakovski a4ff58e9ee New floppy access logic with improved timing. 2022-11-17 18:03:18 +01:00
Maxim Poliakovski 9835b96e87 floppyimg: assume raw image by default. 2022-11-17 18:03:18 +01:00
Maxim Poliakovski 76e0fab33a superdrive: implement eject disk command. 2022-11-17 18:03:18 +01:00
Maxim Poliakovski 585c5fd4ca Guess low-level floppy disk format based on image size.
Also add fdd_fmt property for manually specifying disk
format.
2022-11-17 18:03:18 +01:00
Maxim Poliakovski 3a5c61797c Revert "PCI fixes" 2022-09-02 23:24:06 +00:00
joevt 24ecdbe75b Allow non-HFS/MFS raw floppies
Such as FAT formatted floppies which should be readable in Open Firmware (when floppy support is updated to work in Open Firmware).
2022-09-02 03:39:50 -07:00
joevt b76bfedf4b Remove unnecessary linefeeds from log
To remove blank lines in the dingusppc.log file or in the console output when -d is used.
2022-08-14 05:26:56 -07:00
Maxim Poliakovski b9fb0b9c5f Switch fdd_wr_prot to BinProperty. 2022-07-19 23:48:17 +02:00
Maxim Poliakovski 439029cafe swim3: self-registration with the device registry. 2022-07-18 20:27:34 +02:00
dingusdev 80a4864a92 Floppy disk write protection 2022-02-24 07:33:30 -07:00
Maxim Poliakovski 689fe51d80 Add required includes for gcc. 2022-02-17 00:50:37 +01:00
Maxim Poliakovski 2ce2cae48c SWIM3: implement disk reading. 2022-02-15 15:55:16 +01:00
Maxim Poliakovski 2525398b6e SWIM3: add support for floppy DMA. 2022-02-15 15:53:18 +01:00