Commit Graph

245 Commits

Author SHA1 Message Date
Mihai Parparita
ae0bb838bf Add basic support for the extended ADB mouse protocol.
We now respond to the switch to device handler ID 4 and the register 1
read (as described by https://developer.apple.com/library/archive/technotes/hw/hw_01.html#Extended).

We don't yet use the extra precision bits in the register 0.
2023-12-15 16:04:27 -08:00
Maxim Poliakovski
fd92d86954 mesh: add MESH TNT variant. 2023-12-11 08:05:39 +01:00
Mihai Parparita
ea9de4feaf Fix uninitialized value read in the ScsiHardDisk constructor
The call to the ScsiDevice superclass was using the name field (which
was not initialized yet) instead of the name constructor argument
2023-12-10 08:58:12 -08:00
Maxim Poliakovski
114737db41 scsicdrom: use CdromDrive as base class. 2023-12-10 00:19:44 +01:00
Maxim Poliakovski
bf278af950 scsidevice: add get_more_data() method.
It is required for supporting large data transfers split
into multiple chunks.
2023-12-10 00:19:44 +01:00
Maxim Poliakovski
a1ad0a3e07 machineid: implement BoardRegister class. 2023-12-10 00:19:44 +01:00
Maxim Poliakovski
65a343ce5c Clean up names for SCSI devices. 2023-12-04 22:41:01 +01:00
Maxim Poliakovski
8841c3e7f9 scsihd: more commands. 2023-12-04 21:41:55 +01:00
Maxim Poliakovski
1e4579a076 Improve SCSI state machine. 2023-12-04 21:41:55 +01:00
Maxim Poliakovski
be2721cd67 scsihd: cleanup, fixes and more commands. 2023-12-04 21:41:55 +01:00
Maxim Poliakovski
58281520d3 Implement writes to SCSI Pseudo-DMA register. 2023-12-04 21:41:55 +01:00
Maxim Poliakovski
ae903082d8 amic: implement SCSI DRQ callback. 2023-12-04 21:41:55 +01:00
Mihai Parparita
1a859669eb Remove obsolete ADB_Bus class
Superseded by e9d91175c4 and subsequent
changes.
2023-12-03 23:15:25 -08:00
dingusdev
07030378c8 Non-US keyboard support started
This is quite unfinished, but should get some of the major targets started.
2023-12-01 10:23:41 -07:00
Maxim Poliakovski
94872b3ebb Store SCSI bus object pointer during registration. 2023-11-24 19:48:07 +01:00
Maxim Poliakovski
9ae863d7c4 sc53c94: add is_dma_cmd member variable. 2023-11-24 19:48:07 +01:00
Maxim Poliakovski
457accf329 scsi: define READ_BUFFER and WRITE_BUFFER commands. 2023-11-24 19:48:07 +01:00
Mihai Parparita
d08b486db0 Fix keyboard events occasionally being dropped
AdbKeyboard would copy the event into its own fields and set the
changed field, so that we could return the event when register was 0.
However, if a subsequent event was received before ADB polling, the
previous event would be overwritten and lost.

Fix this by maintaining a queue of events, so that we can return
everything since the last poll.
2023-11-24 10:08:16 -08:00
Maxim Poliakovski
d37d83c5b6
Merge pull request #64 from mihaip/upstream-a-key
Fix "a" key always being as as a keyup
2023-11-24 11:35:18 +01:00
Mihai Parparita
d45bba924d Fix "a" key always being as as a keyup
We were using an empty value on the second byte of the ADB keyboard
register 0, but that maps to the "a" key. This manifested itself
as the Key Caps DA never showing the "a" key as being down.

Switch to a non-existent key for the second byte.
2023-11-23 22:39:06 -08:00
Maxim Poliakovski
446b1b8d99 atahd: various improvements implementing basic commands. 2023-11-22 17:35:14 +01:00
Maxim Poliakovski
27ff05607c atadefs: bit definitions for the device/head register. 2023-11-22 17:35:14 +01:00
Maxim Poliakovski
f2558cd379 atabasedevice: data transfers to host. 2023-11-22 17:35:14 +01:00
Maxim Poliakovski
4f76a4ead2 Move signal_data_ready() to atabasedevice. 2023-11-22 17:35:14 +01: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
Maxim Poliakovski
04956c19d5
Fix tiny tipo in adbdevice.h 2023-11-09 11:51:33 +01:00
Mihai Parparita
73272b28dd Implement the ADB keyboard
Besides generating KeyboardEvents in the SDL event handler and
returning the key state in the register 0 reads of the AdbKeyboard
device, we also needed to generalize the ADB bus polling a bit. We now
check all devices that have the service request bit set, instead of
hardcoding the mouse.

The SDL key event -> ADB raw key code mapping is based on BasiliskII/
SheepShaver's, but cleaned up a bit.
2023-10-11 23:43:20 -07: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
ea0eae467d Add assertion for valid SCSI IDs when updating control lines
Would have flagged the out-of-bounds write fixed by
dingusdev/dingusppc@36cb84eaaa sooner.
2023-10-19 07:49:23 -07:00
Maxim Poliakovski
36cb84eaaa mesh: fix write-out-of-bounds to BusStatus1. 2023-10-18 11:21:38 +02:00
Maxim Poliakovski
63b10175bf mesh: stubs for BusFree and EnaReselect commands. 2023-10-02 15:01:27 +02:00
Maxim Poliakovski
f754f63f8f dbdma: fix LOAD_QUAD and STORE_QUAD to work with MMIO. 2023-10-02 14:46:52 +02:00
Maxim Poliakovski
b408a02ef9 dbdma: implement LOAD_QUAD, STORE_QUAD and NOP. 2023-09-30 17:09:45 +02:00
joevt
637844269f atapicdrom: Implement sector areas for Read CD.
The disk cache is unchanged. data_ptr continues to be only used for the user data sector area for each block. The other sector areas (synch, header, etc.) are filled in while reading.

has_data and get_data exist as a way to bypass data_ptr for parts of the transfer outside the user data sector area of each block. The default behaviour is defined in atabasedevice and is overridden by atapicdrom for the Read CD command. atapicdrom has a flag doing_sector_areas to control the behavior of the get_data method. When the flag is true, the sector_areas, current_block, and current_block_byte are used for selecting the correct data from one of the sector areas. The Read CD command initializes those variables. xfer_cnt remains the total number of bytes to be transferred and is now not necessarily the same as the number of disk image blocks read into the disk cache.

lba_to_msf is used to fill in the header. The values was not verified using a real CD.

Mac OS X just cares about the Mode in the header. For now, only the synch and header and user data areas are filled in. The other areas read as all zeros.
2023-09-25 12:22:17 +02:00
joevt
ec5bf8e985 atapicdrom: Implement READ(6) and READ(10). 2023-09-25 12:22:17 +02:00
Maxim Poliakovski
4cdb81e822 mesh: fix Arbitrate command for OS X. 2023-09-24 22:36:44 +02:00
Maxim Poliakovski
9db3076a48 dbdma: support INT_SELECT & WAIT_SELECT registers. 2023-09-20 00:45:39 +02:00
Maxim Poliakovski
04acf120d6 dbdma: support optinal CommandPtrHi register.
It's written with zero in OS X. This dummy implementation
is meant to reduce log warnings.
2023-09-19 14:16:13 +02:00
Maxim Poliakovski
a69763c6de dbdma: noop incomplete LOAD_QUAD & STORE_QUAD. 2023-09-18 20:20:25 +02:00
dingusdev
5e32b599d6 Merge branch 'master' of https://github.com/dingusdev/dingusppc 2023-09-04 07:22:27 -07:00
Maxim Poliakovski
c690049246
Merge pull request #47 from joevt/ofnvram-branch
ofnvram changes
2023-08-22 08:24:57 +02:00
dingusdev
a7ef177164 Preliminary DBDMA expansion 2023-08-13 16:38:15 -07:00
Maxim Poliakovski
ee9c692115 mesh: implement more register reads. 2023-08-09 01:40:09 +02:00
Maxim Poliakovski
cd9ccb66ed adbkeyboard: fix compiler warning. 2023-08-07 12:51:09 +02:00
joevt
439509b408 Fix New World NVRAM limits calculations.
It was possible to corrupt New World nvram using dingusppc setenv command.

- setenv must call get_config_vars to set data_length so that it can calculate free space.
- data_length represents the number of bytes taken by nvram variables including the terminating null for the value (name, '=', value, '\0'). Previously, it did not include the terminating null.
- The list of variables and values ends at a '\0' or at pos == 4096 bytes. Previously, data_length wouldn't get set if pos >= 4096.
- Allow setenv to create new nvram variables.
- Since data_length now represents the total number of used bytes, free_space now represents the actual free space, so use > free_space (instead of >= free_space) to determine insufficient space.
- While parsing nvram variable name, do not read beyond 4096 bytes.
- Use a different error message for each problem that can occur while parsing nvram variable name.
2023-08-04 20:11:59 -07:00
joevt
07f57a1e9b Remove extra semi-colons. 2023-08-04 20:11:59 -07:00
joevt
0c9ddaccf7 Fix dppc debugger printenv of multiline variables.
If a nvram variable has CRLF or CR, replace them with LF so each line appears on a new line in the console output.
Also, add indent to each line so that each line appears only in the value column and not in the name column.
2023-08-04 20:11:59 -07:00
dingusdev
b23bb04dac Start fix for SCSI Hard Drive 2023-08-02 07:53:19 -07:00
dingusdev
a7601c36bd Started work on keyboard input 2023-08-01 22:43:11 -07:00
Maxim Poliakovski
1a883ba73e viacuda: implement basic autopolling. 2023-08-02 00:07:17 +02:00