X-Git-Url: http://cloudbase.mooo.com/gitweb/z180-stamp.git/blobdiff_plain/1e5609bf0dfb390b0d62651cbd979e0ee21184fe..f66d9570ec64ecaa1f879619a0e4fed8d5fa7803:/avr/z80-if.c diff --git a/avr/z80-if.c b/avr/z80-if.c index 6d83172..180a27f 100644 --- a/avr/z80-if.c +++ b/avr/z80-if.c @@ -147,7 +147,7 @@ static volatile uint8_t timer; /* used for bus timeout */ static bool reset_polarity; /*---------------------------------------------------------*/ -/* 10Hz timer interrupt generated by OC4A */ +/* 10Hz timer interrupt generated by OC5A */ /*---------------------------------------------------------*/ ISR(TIMER5_COMPA_vect) @@ -351,6 +351,9 @@ zstate_t z80_bus_cmd(bus_cmd_t cmd) z80_addrbus_set_in(); z80_reset_active(); Z80_O_BUSREQ = 1; + timer = BUS_TO; + while (Z80_I_BUSACK == 0 && timer) + ; zstate = RESET; break; @@ -396,12 +399,18 @@ zstate_t z80_bus_cmd(bus_cmd_t cmd) z80_addrbus_set_in(); z80_reset_active(); Z80_O_BUSREQ = 1; + timer = BUS_TO; + while (Z80_I_BUSACK == 0 && timer) + ; zstate = RESET; break; case RUNNING_AQRD: z80_dbus_set_in(); z80_addrbus_set_in(); Z80_O_BUSREQ = 1; + timer = BUS_TO; + while (Z80_I_BUSACK == 0 && timer) + ; zstate = RUNNING; break; default: @@ -412,6 +421,7 @@ zstate_t z80_bus_cmd(bus_cmd_t cmd) case Run: switch (zstate) { case RESET: + _delay_ms(20); /* TODO: */ z80_reset_inactive(); zstate = RUNNING; break;