Previous 15994 Revisions Next

r8511 Thursday 15th July, 2010 at 01:50:08 UTC by R. Belmont
[MAC] Support 2 more Egret MCU commands.
[src/mess/machine]mac.c

src/mess/machine/mac.c
r8510r8511
19561956   timer_adjust_oneshot(mac_adb_timer, attotime_make(0, ATTOSECONDS_IN_USEC(100)), 0);
19571957}
19581958
1959static void mac_egret_response_read_pram(mac_state *mac, int addr)
1959static void mac_egret_response_read_pram(mac_state *mac, int cmd, int addr)
19601960{
19611961   mac->adb_datasize = 4;
19621962
19631963   mac->adb_send = 0xaa;
19641964   mac->adb_buffer[4] = 1;   // type
19651965   mac->adb_buffer[3] = 0;   // flag
1966   mac->adb_buffer[2] = 7;   // command
1966   mac->adb_buffer[2] = cmd; // command
19671967   mac->adb_buffer[1] = mac->rtc_ram[addr];
19681968
19691969   mac->adb_state |= 1;
r8510r8511
19751975   mac->adb_stream_ptr = addr+1;
19761976}
19771977
1978static void mac_egret_response_read_rtc(mac_state *mac)
1979{
1980   mac->adb_datasize = 7;
1981
1982   mac->adb_send = 0xaa;
1983   mac->adb_buffer[7] = 1;   // type
1984   mac->adb_buffer[6] = 0;   // flag
1985   mac->adb_buffer[5] = 7;   // command
1986   mac->adb_buffer[4] = mac->rtc_seconds[3];
1987   mac->adb_buffer[3] = mac->rtc_seconds[2];
1988   mac->adb_buffer[2] = mac->rtc_seconds[1];
1989   mac->adb_buffer[1] = mac->rtc_seconds[0];
1990
1991   mac->adb_state |= 1;
1992   mac->adb_timer_ticks = 8;
1993   timer_adjust_oneshot(mac_adb_timer, attotime_make(0, ATTOSECONDS_IN_USEC(100)), 0);
1994}
1995
19781996static void mac_egret_mcu_exec(mac_state *mac)
19791997{
19801998   mac->adb_streaming = MCU_STREAMING_NONE;
r8510r8511
19952013         mac_egret_response_std(mac, 1, 0, 1);
19962014         break;
19972015
2016      case 0x02: // read 6805 address
2017         {
2018            int addr = mac->adb_buffer[2]<<8 | mac->adb_buffer[3];
2019
2020            #if LOG_ADB
2021            printf("ADB: Egret read 6805 address %x\n", addr);
2022            #endif
2023
2024            // check if this is a sneaky PRAM read (PRAM is at 6805 address 0x100)
2025            if ((addr >= 0x100) && (addr <= 0x200))
2026            {
2027               mac_egret_response_read_pram(mac, 2, addr&0xff);
2028            }
2029            #if LOG_ADB
2030            else
2031            {
2032               printf("ADB: Egret unhandled direct read @ %x\n", addr);
2033            }
2034            #endif
2035         }
2036         break;
2037
2038      case 0x03: // read RTC
2039         #if LOG_ADB
2040         printf("ADB: Egret read RTC = %08x\n", mac->rtc_seconds[3]<<24|mac->rtc_seconds[2]<<16|mac->rtc_seconds[1]<<8|mac->rtc_seconds[0]);
2041         #endif
2042
2043         mac_egret_response_read_rtc(mac);
2044         break;
2045
19982046      case 0x07: // read PRAM
19992047         #if LOG_ADB
20002048         printf("ADB: Egret read PRAM from %x\n", mac->adb_buffer[2]<<8 | mac->adb_buffer[3]);
20012049         #endif
20022050
2003         mac_egret_response_read_pram(mac, mac->adb_buffer[2]<<8 | mac->adb_buffer[3]);
2051         mac_egret_response_read_pram(mac, 7, mac->adb_buffer[2]<<8 | mac->adb_buffer[3]);
20042052         break;
20052053
20062054      case 0x08: // write 6805 address
r8510r8511
20232071            #if LOG_ADB
20242072            else
20252073            {
2026               printf("ADB: Egret unhandled direct write\n");
2074               printf("ADB: Egret unhandled direct write @ %x\n", addr);
20272075            }
20282076            #endif
20292077

Previous 15994 Revisions Next


© 1998-2018 The MESS Team