Previous 15994 Revisions Next

r7875 Tuesday 20th April, 2010 at 08:14:23 UTC by Curt Coder
Cleanup.
[src/mess/formats]atarist_dsk.c atom_atm.c comx35_comx.c comx35_dsk.c studio2_st2.c

src/mess/formats/comx35_dsk.c
r7874r7875
66
77*********************************************************************/
88
9#include <string.h>
10
119#include "formats/comx35_dsk.h"
1210#include "formats/basicdsk.h"
1311
14static FLOPPY_IDENTIFY(comx35_dsk_identify)
12/***************************************************************************
13    IMPLEMENTATION
14***************************************************************************/
15
16/*-------------------------------------------------
17    FLOPPY_IDENTIFY( comx35_dsk_identify )
18-------------------------------------------------*/
19
20static FLOPPY_IDENTIFY( comx35_dsk_identify )
1521{
1622   *vote = ((floppy_image_size(floppy) == (35*1*16*128)) || (floppy_image_size(floppy) == (35*2*16*128))) ? 100 : 0;
23
1724   return FLOPPY_ERROR_SUCCESS;
1825}
1926
20static FLOPPY_CONSTRUCT(comx35_dsk_construct)
27/*-------------------------------------------------
28    FLOPPY_CONSTRUCT( comx35_dsk_construct )
29-------------------------------------------------*/
30
31static FLOPPY_CONSTRUCT( comx35_dsk_construct )
2132{
22   struct basicdsk_geometry geometry;
2333   UINT8 header[1];
24   int heads =1;
25   int cylinders =35;
34   int heads = 1;
35   int cylinders = 35;
2636
27   switch(floppy_image_size(floppy)) {
28      case 35*1*16*128:
37   switch (floppy_image_size(floppy))
38   {
39   case 35*1*16*128:
40      heads = 1;
41      cylinders = 35;
42      break;
43
44   case 35*2*16*128:
45      floppy_image_read(floppy, header, 0x12, 1);
46
47      if (header[0] == 0x01)
48      {
2949         heads = 1;
50         cylinders = 70;
51      }
52      else
53      {
54         heads = 2;
3055         cylinders = 35;
31         break;
32
33      case 35*2*16*128:
34         floppy_image_read( floppy, header, 0x12 , 1 );
35         if (header[0] == 0x01)
36         {
37            heads = 1;
38            cylinders = 70;
39         }
40         else
41         {
42            heads = 2;
43            cylinders = 35;
44         }
45         break;
56      }
57      break;
4658   }
4759
60   struct basicdsk_geometry geometry;
4861   memset(&geometry, 0, sizeof(geometry));
62
4963   geometry.heads = heads;
5064   geometry.first_sector_id = 0;
5165   geometry.sector_length = 128;
5266   geometry.tracks = cylinders;
5367   geometry.sectors = 16;
68
5469   return basicdsk_construct(floppy, &geometry);
5570}
5671
57/* ----------------------------------------------------------------------- */
72/*-------------------------------------------------
73    FLOPPY_OPTIONS( comx35 )
74-------------------------------------------------*/
5875
5976FLOPPY_OPTIONS_START( comx35 )
60   FLOPPY_OPTION( comx35, "img",      "COMX35 floppy disk image",   comx35_dsk_identify, comx35_dsk_construct, NULL)
77   FLOPPY_OPTION( comx35, "img", "COMX35 floppy disk image", comx35_dsk_identify, comx35_dsk_construct, NULL )
6178FLOPPY_OPTIONS_END
62
src/mess/formats/atom_atm.c
r7874r7875
88
99#include "emu.h"
1010#include "formats/atom_atm.h"
11#include "cpu/cdp1802/cdp1802.h"
12#include "devices/messram.h"
1311
1412/***************************************************************************
1513    PARAMETERS
r7874r7875
2119    IMPLEMENTATION
2220***************************************************************************/
2321
24/*
22/*-------------------------------------------------
23    image_fread_memory - read image to memory
24-------------------------------------------------*/
2525
26   The format for the .ATM files is as follows:
27
28   Offset Size     Description
29   ------ -------- -----------------------------------------------------------
30   0000h  16 BYTEs ATOM filename (if less than 16 BYTEs, rest is 00h bytes)
31   0010h  WORD     Start address for load
32   0012h  WORD     Execution address
33   0014h  WORD     Size of data in BYTEs
34   0016h  Size     Data
35
36*/
37
3826static void image_fread_memory(running_device *image, UINT16 addr, UINT32 count)
3927{
4028   void *ptr = memory_get_write_ptr(cpu_get_address_space(image->machine->firstcpu, ADDRESS_SPACE_PROGRAM), addr);
r7874r7875
4230   image_fread(image, ptr, count);
4331}
4432
33/*-------------------------------------------------
34    QUICKLOAD_LOAD( atom_atm )
35-------------------------------------------------*/
36
4537QUICKLOAD_LOAD( atom_atm )
4638{
39   /*
40
41      The format for the .ATM files is as follows:
42
43      Offset Size     Description
44      ------ -------- -----------------------------------------------------------
45      0000h  16 BYTEs ATOM filename (if less than 16 BYTEs, rest is 00h bytes)
46      0010h  WORD     Start address for load
47      0012h  WORD     Execution address
48      0014h  WORD     Size of data in BYTEs
49      0016h  Size     Data
50
51   */
52   
4753   UINT8 header[0x16] = { 0 };
4854
4955   image_fread(image, header, 0x16);
src/mess/formats/atarist_dsk.c
r7874r7875
66
77*********************************************************************/
88
9#include <string.h>
10
119#include "formats/atarist_dsk.h"
1210#include "formats/basicdsk.h"
1311
14static FLOPPY_IDENTIFY(atarist_dsk_identify)
12/*
13
14   TODO:
15
16   - MSA format
17   - STT format
18   - DIM format
19
20*/
21
22/***************************************************************************
23    IMPLEMENTATION
24***************************************************************************/
25
26/*-------------------------------------------------
27    FLOPPY_IDENTIFY( atarist_st_identify )
28-------------------------------------------------*/
29
30static FLOPPY_IDENTIFY( atarist_st_identify )
1531{
1632   *vote = 100;
33
1734   return FLOPPY_ERROR_SUCCESS;
1835}
1936
20static FLOPPY_CONSTRUCT(atarist_dsk_construct)
37/*-------------------------------------------------
38    FLOPPY_CONSTRUCT( atarist_st_construct )
39-------------------------------------------------*/
40
41static FLOPPY_CONSTRUCT( atarist_st_construct )
2142{
22   struct basicdsk_geometry geometry;
2343   int heads = 0;
2444   int tracks = 0;
2545   int sectors = 0;
r7874r7875
3050   heads = bootsector[0x1a];
3151   tracks = (bootsector[0x13] | (bootsector[0x14] << 8)) / sectors / heads;
3252
53   struct basicdsk_geometry geometry;
3354   memset(&geometry, 0, sizeof(geometry));
55
3456   geometry.heads = heads;
3557   geometry.first_sector_id = 1;
3658   geometry.sector_length = 512;
3759   geometry.tracks = tracks;
3860   geometry.sectors = sectors;
61
3962   return basicdsk_construct(floppy, &geometry);
4063}
4164
42/* ----------------------------------------------------------------------- */
65/*-------------------------------------------------
66    FLOPPY_CONSTRUCT(atarist_dsk_construct)
67-------------------------------------------------*/
4368
4469FLOPPY_OPTIONS_START( atarist )
45   FLOPPY_OPTION( atarist, "st",      "Atari ST floppy disk image",   atarist_dsk_identify, atarist_dsk_construct, NULL)
70   FLOPPY_OPTION( atarist, "st", "Atari ST floppy disk image", atarist_st_identify, atarist_st_construct, NULL )
71/*   FLOPPY_OPTION( atarist, "stt", "Atari ST floppy disk image", atarist_stt_identify, atarist_stt_construct, NULL )
72   FLOPPY_OPTION( atarist, "msa", "Atari ST floppy disk image", atarist_msa_identify, atarist_msa_construct, NULL )
73   FLOPPY_OPTION( atarist, "dim", "Atari ST floppy disk image", atarist_dim_identify, atarist_dim_construct, NULL )*/
4674FLOPPY_OPTIONS_END
47
src/mess/formats/comx35_comx.c
r7874r7875
3030    IMPLEMENTATION
3131***************************************************************************/
3232
33/*-------------------------------------------------
34    image_fread_memory - read image to memory
35-------------------------------------------------*/
36
3337static void image_fread_memory(running_device *image, UINT16 addr, UINT32 count)
3438{
3539   void *ptr = memory_get_write_ptr(cpu_get_address_space(image->machine->firstcpu, ADDRESS_SPACE_PROGRAM), addr);
r7874r7875
3741   image_fread(image, ptr, count);
3842}
3943
44/*-------------------------------------------------
45    QUICKLOAD_LOAD( comx35_comx )
46-------------------------------------------------*/
47
4048QUICKLOAD_LOAD( comx35_comx )
4149{
4250   const address_space *program = cpu_get_address_space(image->machine->firstcpu, ADDRESS_SPACE_PROGRAM);
src/mess/formats/studio2_st2.c
r7874r7875
4343    IMPLEMENTATION
4444***************************************************************************/
4545
46/*-------------------------------------------------
47    DEVICE_IMAGE_LOAD( st2_cartslot_load )
48-------------------------------------------------*/
49
4650DEVICE_IMAGE_LOAD( st2_cartslot_load )
4751{
4852   st2_header header;

Previous 15994 Revisions Next


© 1998-2018 The MESS Team