@@ -1503,8 +1503,9 @@ void microdisc_write( struct microdisc *md, unsigned short addr, unsigned char d
15031503// the BD interface but it is safer to switch it
15041504// on in the boot sector (page 4) code.
15051505//
1506- // 0x312 DSTATS R on read (BIT instruction) to obtain the
1507- // FDC's DRQ in bit 7 and IRQ in bit 6.
1506+ // 0x312 DSTATS R bit 7 - DRQ
1507+ // bit 6 - IRQ
1508+ // bit 0 - motor status (): b0=0 ON, b0=1 OFF (NOTE: DOS7 only).
15081509//
15091510// 0x313 MAPOFF R/W enables the ORIC ROM and disables the overlay RAM.
15101511//
@@ -1525,6 +1526,11 @@ void microdisc_write( struct microdisc *md, unsigned short addr, unsigned char d
15251526// and therefore enables the overlay RAM when MAPON
15261527// has been accessed.
15271528//
1529+ // 0x31a DRVSEL R bit 7,6 - current drive
1530+ // bit 5 - current side
1531+ // W bit 7,6 - select drive
1532+ // bit 1 - select side
1533+ //
15281534// 0x0380 R/W disables the BD interface ROM which covers addresses
15291535// 0xE000 to 0xFFFF but before that is done, it takes
15301536// precedence over the above for that memory space.
@@ -1569,6 +1575,7 @@ void bd500_init( struct bd500 *bd, struct wd17xx *wd, struct machine *oric )
15691575 bd -> wd = wd ;
15701576 bd -> oric = oric ;
15711577 bd -> diskrom = SDL_TRUE ;
1578+ bd -> motor = SDL_FALSE ;
15721579}
15731580
15741581void bd500_free ( struct bd500 * bd )
@@ -1580,6 +1587,8 @@ void bd500_free( struct bd500 *bd )
15801587
15811588unsigned char bd500_read ( struct bd500 * bd , unsigned short addr )
15821589{
1590+ unsigned char ret = 0xff ;
1591+
15831592// dbg_printf( "DISK: (%04X) Read from %04X", bd->oric->cpu.pc-1, addr );
15841593
15851594 if ( ( addr >= 0x320 ) && ( addr < 0x324 ) )
@@ -1588,7 +1597,8 @@ unsigned char bd500_read( struct bd500 *bd, unsigned short addr )
15881597 switch ( addr )
15891598 {
15901599 case 0x312 :
1591- return (bd -> drq | bd -> intrq );
1600+ ret = bd -> drq | bd -> intrq ;
1601+ if ( bd -> oric -> dos70 ) ret |= bd -> motor ? 0 :1 ;
15921602 break ;
15931603
15941604 case 0x313 :
@@ -1600,10 +1610,12 @@ unsigned char bd500_read( struct bd500 *bd, unsigned short addr )
16001610 break ;
16011611
16021612 case 0x310 :
1603- case 0x311 :
16041613 // MOTOFF = 0
1614+ bd -> motor = SDL_FALSE ;
1615+ break ;
1616+ case 0x311 :
16051617 // MOTON = 1
1606- // or MOTOR = addr & 1 ;
1618+ bd -> motor = SDL_TRUE ;
16071619 break ;
16081620
16091621 case 0x315 :
@@ -1621,6 +1633,12 @@ unsigned char bd500_read( struct bd500 *bd, unsigned short addr )
16211633 bd -> diskrom = bd -> oric -> rom16 ? SDL_FALSE : SDL_TRUE ;
16221634 break ;
16231635
1636+ case 0x31a :
1637+ // bits 7,6 current drive
1638+ // bit 5 current side
1639+ ret = ((bd -> wd -> c_drive & 3 )<<6 ) | ((bd -> wd -> c_side & 1 )<<5 );
1640+ break ;
1641+
16241642 case 0x0380 :
16251643 bd -> diskrom = SDL_FALSE ;
16261644 break ;
@@ -1629,7 +1647,7 @@ unsigned char bd500_read( struct bd500 *bd, unsigned short addr )
16291647 break ;
16301648 }
16311649
1632- return 0xff ;
1650+ return ret ;
16331651}
16341652
16351653void bd500_write ( struct bd500 * bd , unsigned short addr , unsigned char data )
0 commit comments