r7263 Thursday 4th February, 2010 at 22:39:51 UTC by Phill Harvey-Smith
Added multi-sector write to wd17xx.c to get RM Nimbus floppy writes working.
[src/mess/machine]rmnimbus.c wd17xx.c
[src/mess/video]rmnimbus.c

src/mess/video/rmnimbus.c
r7262r7263
7676UINT16  vidregs[NO_VIDREGS];
7777
7878UINT8   bpp;            // Bits / pixel
79UINT8   ppb;            // Pixels / byte
8079UINT16  pixel_mask;
81UINT8   border_colour;
80UINT8   hs_count;
8281
8382int debug_on;
8483
r7262r7263
9392static void write_reg_01A(void);
9493static void write_reg_01C(void);
9594static void write_reg_026(void);
96static void change_palette(running_machine *machine, UINT8 first, UINT16 colours);
95static void change_palette(running_machine *machine, UINT8 bank, UINT16 colours, UINT8 regno);
9796
9897static void video_debug(running_machine *machine, int ref, int params, const char *param[]);
9998static void video_regdump(running_machine *machine, int ref, int params, const char *param[]);
r7262r7263
132131        case    reg022  : result=vidregs[reg022]; break;
133132        case    reg024  : result=vidregs[reg024]; break;
134133        case    reg026  : result=vidregs[reg026]; break;
135        case    reg028  : result=vidregs[reg028]; break;
134        case    reg028  : result=hs_count; break; //result=vidregs[reg028]; break;
136135        case    reg02A  : result=vidregs[reg02A]; break;
137136        case    reg02C  : result=vidregs[reg02C]; break;
138137        case    reg02E  : result=vidregs[reg02E]; break;
r7262r7263
190189        case    reg022  : vidregs[reg022]=data; break;
191190        case    reg024  : vidregs[reg024]=data; break;
192191        case    reg026  : vidregs[reg026]=data; write_reg_026(); break;
193        case    reg028  : vidregs[reg028]=data; change_palette(space->machine,(IS_80COL ? 0 : 0),data); break;
194        case    reg02A  : vidregs[reg02A]=data; change_palette(space->machine,(IS_80COL ? 1 : 4),data); break;
195        case    reg02C  : vidregs[reg02C]=data; change_palette(space->machine,(IS_80COL ? 2 : 8),data); break;
196        case    reg02E  : vidregs[reg02E]=data; change_palette(space->machine,(IS_80COL ? 3 : 12),data); break;
192        case    reg028  : change_palette(space->machine,0,data,reg028); break;
193        case    reg02A  : change_palette(space->machine,1,data,reg02A); break;
194        case    reg02C  : change_palette(space->machine,2,data,reg02C); break;
195        case    reg02E  : change_palette(space->machine,3,data,reg02E); break;
197196       
198197        default         : break;
199198    }
r7262r7263
282281    011
283282    100 4bpp, must be a 16 bit word, of which the upper byte is a mask anded with the lower byte
284283              containing the pixel data for two pixels.
285    101
284    101 Move pixel data at x,reg020 to x,y, used for scrolling.
286285    110 4bpp, 16 bit word containing the pixel data for 4 pixels.
287286    111
288287   
r7262r7263
419418
420419static void write_reg_026(void)
421420{
422    border_colour=vidregs[reg026] & 0x0F;
423
424421    if(debug_on & DEBUG_TEXT)
425        logerror("reg 026 write, border_colour=%02X\n",border_colour);
422        logerror("reg 026 write, border_colour=%02X\n",vidregs[reg026] & 0x0F);
426423}
427424
428static void change_palette(running_machine *machine, UINT8 first, UINT16 colours)
425static void change_palette(running_machine *machine, UINT8 bank, UINT16 colours, UINT8 regno)
429426{
430427    UINT8   colourno;
431428    UINT16  mask;
432429    UINT8   shifts;
433430    UINT8   paletteidx;
434431    UINT8   colourmax;
432    UINT8   first;
435433   
434    // for the register's data has changed update it, and then update the pallette, else do nothing.
435    if(vidregs[regno]!=colours)
436        vidregs[regno]=colours;
437    else
438        return;
439   
440    // Setup parameters for pallette change
441    colourmax=IS_80COL ? 1 : 4;
442    first=IS_80COL ? bank : bank*4;
443
436444    shifts=0;
437445    mask=0x000F;
438446   
439    colourmax=IS_80COL ? 1 : 4;
440   
441    for(colourno=first; colourno<(first+4); colourno++)
447    // loop over changing colours
448    for(colourno=first; colourno<(first+colourmax); colourno++)
442449    {
443450        paletteidx=(colours & mask) >> shifts;
444451        palette_set_color_rgb(machine, colourno, nimbus_palette[paletteidx][RED], nimbus_palette[paletteidx][GREEN], nimbus_palette[paletteidx][BLUE]);
r7262r7263
520527        *BITMAP_ADDR16(bitmap, YCoord, XCoord)=video_mem[XCoord][YCoord];
521528    }
522529
523    vidregs[reg028]++;
524    if((vidregs[reg028] & 0x000F)>0x0A)
525        vidregs[reg028]&=0xFFF0;
530    hs_count++;
531    if((hs_count & 0x000F)>0x0A)
532        hs_count&=0xFFF0;
526533
527534    return 0;
528535}
src/mess/machine/wd17xx.c
r7262r7263
119119     
120120      This should probably be considdered a minor hack but it does seem to work !
121121
122    2009-02-04 Phill Harvey-Smith
123    - Added multiple sector write as the RM Nimbus needs it.
124
122125    TODO:
123126        - Multiple record write
124127        - What happens if a track is read that doesn't have any id's on it?
r7262r7263
14641467      if ((data & ~FDC_MASK_TYPE_II) == FDC_READ_SEC)
14651468      {
14661469         if (VERBOSE)
1470            {
14671471            logerror("wd17xx_command_w $%02X READ_SEC\n", data);
1468
1472                logerror("cmd=%02X, trk=%02X, sec=%02X, dat=%02X\n",w->command,w->track,w->sector,w->data);
1473            }
14691474         w->read_cmd = data;
14701475         w->command = data & ~FDC_MASK_TYPE_II;
14711476         w->command_type = TYPE_II;
r7262r7263
14811486      if ((data & ~FDC_MASK_TYPE_II) == FDC_WRITE_SEC)
14821487      {
14831488         if (VERBOSE)
1489            {
14841490            logerror("wd17xx_command_w $%02X WRITE_SEC\n", data);
1491                logerror("cmd=%02X, trk=%02X, sec=%02X, dat=%02X\n",w->command,w->track,w->sector,w->data);
1492            }
14851493
14861494         w->write_cmd = data;
14871495         w->command = data & ~FDC_MASK_TYPE_II;
r7262r7263
17711779
17721780         w->data_offset = 0;
17731781
1774         wd17xx_complete_command(device, DELAY_DATADONE);
1775      }
1782           
1783         /* Check we should handle the next sector for a multi record write */
1784         if ( w->command_type == TYPE_II && w->command == FDC_WRITE_SEC && ( w->write_cmd & 0x10 ) )
1785            {
1786            w->sector++;
1787            if (wd17xx_locate_sector(device))
1788            {
1789               w->data_count = w->sector_length;
1790
1791               w->status |= STA_2_BUSY;
1792               w->busy_count = 0;
1793
1794               wd17xx_timed_data_request(device);
1795            }
1796            }
1797            else
1798            {
1799                wd17xx_complete_command(device, DELAY_DATADONE);
1800                if (VERBOSE)
1801               logerror("wd17xx_data_w(): multi data write completed\n");
1802            }
1803        }
17761804      else
17771805      {
17781806         /* yes... setup a timed data request */
src/mess/machine/rmnimbus.c
r7262r7263
1313
1414#include "emu.h"
1515#include "memory.h"
16#include "debugger.h"
1617#include "cpu/i86/i86.h"
1718#include "debug/debugcpu.h"
1819#include "debug/debugcon.h"
r7262r7263
5354#define LOG_IOU             1
5455#define LOG_SOUND           0
5556
57/* Debugging */
58
59UINT32  debug_flags;
60
61#define DMA_BREAK           0x0000001
62
5663/* 80186 internal stuff */
5764struct mem_state
5865{
r7262r7263
195202
196203static void execute_debug_irq(running_machine *machine, int ref, int params, const char *param[]);
197204static void execute_debug_intmasks(running_machine *machine, int ref, int params, const char *param[]);
205static void nimbus_debug(running_machine *machine, int ref, int params, const char *param[]);
198206
199207static int instruction_hook(running_device *device, offs_t curpc);
200208static void decode_subbios(running_device *device,offs_t pc);
r7262r7263
202210static void decode_dssi_f_plot_character_string(running_device *device,UINT16  ds, UINT16 si);
203211static void decode_dssi_f_set_new_clt(running_device *device,UINT16  ds, UINT16 si);
204212static void decode_dssi_f_plonk_char(running_device *device,UINT16  ds, UINT16 si);
213static void decode_dssi_f_rw_sectors(running_device *device,UINT16  ds, UINT16 si);
205214
206215static void fdc_reset(void);
207216static void generate_disk_int(running_machine *machine);
r7262r7263
685694   /* check for interrupt generation */
686695   if (d->control & 0x0100)
687696   {
688      if (LOG_DMA) logerror("DMA%d timer callback - requesting interrupt: count = %04X, source = %04X\n", which, d->count, d->source);
697      if (LOG_DMA>1) logerror("DMA%d timer callback - requesting interrupt: count = %04X, source = %04X\n", which, d->count, d->source);
689698      i186.intr.request |= 0x04 << which;
690699      update_interrupt_state(machine);
691700   }
r7262r7263
733742   }
734743
735744    if (LOG_DMA) logerror("Initiated DMA %d - count = %04X, source = %04X, dest = %04X\n", which, d->count, d->source, d->dest);
745    if (debug_flags & DMA_BREAK)
746        debugger_break(machine);
736747
737748   /* set the new control register */
738749   d->control = new_control;
r7262r7263
751762    UINT8   dma_byte;
752763    UINT8   incdec_size;
753764
754    if (LOG_DMA)
765    if (LOG_DMA>1)
755766        logerror("Control=%04X, src=%05X, dest=%05X, count=%04X\n",dma->control,dma->source,dma->dest,dma->count);
756767
757768    if(!(dma->control & ST_STOP))
r7262r7263
812823    // Interrupt if count is zero, and interrupt flag set
813824    if((dma->control & INTERRUPT_ON_ZERO) && (dma->count==0))
814825    {
815      if (LOG_DMA) logerror("DMA%d - requesting interrupt: count = %04X, source = %04X\n", which, dma->count, dma->source);
826      if (LOG_DMA>1) logerror("DMA%d - requesting interrupt: count = %04X, source = %04X\n", which, dma->count, dma->source);
816827      i186.intr.request |= 0x04 << which;
817828      update_interrupt_state(machine);     
818829    }
r7262r7263
12881299   {
12891300      debug_console_register_command(machine, "nimbus_irq", CMDFLAG_NONE, 0, 0, 2, execute_debug_irq);
12901301        debug_console_register_command(machine, "nimbus_intmasks", CMDFLAG_NONE, 0, 0, 0, execute_debug_intmasks);
1302        debug_console_register_command(machine, "nimbus_debug", CMDFLAG_NONE, 0, 0, 1, nimbus_debug);
12911303
12921304        /* set up the instruction hook */
12931305        debug_cpu_set_instruction_hook(devtag_get_device(machine, MAINCPU_TAG), instruction_hook);
12941306     
12951307    }
1308   
1309    debug_flags=0;
12961310}
12971311
12981312static void execute_debug_irq(running_machine *machine, int ref, int params, const char *param[])
r7262r7263
13331347    debug_console_printf(machine,"i186.intr.in_service= %04X\n",i186.intr.in_service);
13341348}
13351349
1350static void nimbus_debug(running_machine *machine, int ref, int params, const char *param[])
1351{
1352    if(params>0)
1353    {   
1354        sscanf(param[0],"%d",&debug_flags);       
1355    }
1356    else
1357    {
1358        debug_console_printf(machine,"Error usage : nimbus_debug <debuglevel>\n");
1359        debug_console_printf(machine,"Current debuglevel=%02X\n",debug_flags);
1360    }
1361}
1362
13361363/*-----------------------------------------------
13371364    instruction_hook - per-instruction hook
13381365-----------------------------------------------*/
r7262r7263
14361463                case 1  : set_func("f_initialise_unit"); break;
14371464                case 2  : set_func("f_pseudo_init_unit"); break;
14381465                case 3  : set_func("f_get_device_status"); break;
1439                case 4  : set_func("f_read_n_sectors"); break;
1440                case 5  : set_func("f_write_n_sectors"); break;
1466                case 4  : set_func("f_read_n_sectors"); dump_dssi=&decode_dssi_f_rw_sectors; break;
1467                case 5  : set_func("f_write_n_sectors"); dump_dssi=&decode_dssi_f_rw_sectors;  break;
14411468                case 6  : set_func("f_verify_n_sectors"); break;
14421469                case 7  : set_func("f_media_check"); break;
14431470                case 8  : set_func("f_recalibrate"); break;
r7262r7263
17701797    logerror("plonked_char=%c\n",params[0]);
17711798}
17721799
1800static void decode_dssi_f_rw_sectors(running_device *device,UINT16  ds, UINT16 si)
1801{
1802    const address_space *space = cputag_get_address_space(device->machine,MAINCPU_TAG, ADDRESS_SPACE_PROGRAM);
1803    UINT16  *params;
1804    int     param_no;
1805   
1806    params=(UINT16  *)get_dssi_ptr(space,ds,si);
1807   
1808    for(param_no=0;param_no<16;param_no++)
1809        logerror("%04X ",params[param_no]);
1810       
1811    logerror("\n");
1812}
17731813
17741814READ16_HANDLER( nimbus_io_r )
17751815{
r7262r7263
20542094         break;
20552095   }
20562096
2057    if(LOG_DISK_FDD)
2097    if(LOG_DISK_FDD && ((offset*2)<=0x10))
20582098        logerror("Nimbus FDCR at pc=%08X from %04X data=%02X\n",pc,(offset*2)+0x400,result);
20592099
20602100    if((LOG_DISK_HDD) && ((offset*2)>=0x10))
r7262r7263
20902130    int                 pc=cpu_get_pc(space->cpu);
20912131    UINT8               reg400_old = nimbus_drives.reg400;
20922132   
2093    if(LOG_DISK_FDD)
2133    if(LOG_DISK_FDD && ((offset*2)<=0x10))
20942134        logerror("Nimbus FDCW at %05X write of %02X to %04X\n",pc,data,(offset*2)+0x400);
20952135
20962136    if((LOG_DISK_HDD) && (((offset*2)>=0x10) || (offset==0)))

Previous 509077 RevisionsNext 50


© 1998-2010 The MESS Team