src/mess/machine/coco.c
| r3951 | r3952 | |
| 135 | 135 | static void d_pia0_irq_b(running_machine *machine, int state); |
| 136 | 136 | static void d_pia1_firq_a(running_machine *machine, int state); |
| 137 | 137 | static void d_pia1_firq_b(running_machine *machine, int state); |
| 138 | | static void d_sam_set_pageonemode(running_machine *machine,int val); |
| 139 | | static void d_sam_set_mpurate(running_machine *machine,int val); |
| 140 | | static void d_sam_set_memorysize(running_machine *machine,int val); |
| 141 | | static void d_sam_set_maptype(running_machine *machine,int val); |
| 138 | static SAM6883_SET_PAGE_ONE_MODE( d_sam_set_pageonemode ); |
| 139 | static SAM6883_SET_MPU_RATE( d_sam_set_mpurate ); |
| 140 | static SAM6883_SET_MEMORY_SIZE( d_sam_set_memorysize); |
| 141 | static SAM6883_SET_MAP_TYPE( d_sam_set_maptype ); |
| 142 | 142 | static void coco_setcartline(running_machine *machine, coco_cartridge *cartridge, cococart_line line, cococart_line_value value); |
| 143 | 143 | static void twiddle_cart_line_if_q(running_machine *machine); |
| 144 | 144 | |
| r3951 | r3952 | |
| 159 | 159 | static void coco3_pia0_irq_b(running_machine *machine, int state); |
| 160 | 160 | static void coco3_pia1_firq_a(running_machine *machine, int state); |
| 161 | 161 | static void coco3_pia1_firq_b(running_machine *machine, int state); |
| 162 | | static void coco3_sam_set_maptype(running_machine *machine, int val); |
| 163 | | static const UINT8 *coco3_sam_get_rambase(running_machine *machine); |
| 164 | 162 | |
| 163 | static SAM6883_SET_MAP_TYPE( coco3_sam_set_maptype ); |
| 164 | static SAM6883_GET_RAMBASE( coco3_sam_get_rambase ); |
| 165 | |
| 165 | 166 | /* Dragon 32 specific */ |
| 166 | 167 | static READ8_HANDLER ( d_pia1_pb_r_dragon32 ); |
| 167 | 168 | |
| r3951 | r3952 | |
| 372 | 373 | |
| 373 | 374 | }; |
| 374 | 375 | |
| 375 | | static const sam6883_interface coco_sam_intf = |
| 376 | const sam6883_interface coco_sam_intf = |
| 376 | 377 | { |
| 377 | | SAM6883_ORIGINAL, |
| 378 | 378 | NULL, |
| 379 | 379 | d_sam_set_pageonemode, |
| 380 | 380 | d_sam_set_mpurate, |
| r3951 | r3952 | |
| 382 | 382 | d_sam_set_maptype |
| 383 | 383 | }; |
| 384 | 384 | |
| 385 | | static const sam6883_interface coco3_sam_intf = |
| 385 | const sam6883_interface coco3_sam_intf = |
| 386 | 386 | { |
| 387 | | SAM6883_GIME, |
| 388 | 387 | coco3_sam_get_rambase, |
| 389 | 388 | NULL, |
| 390 | 389 | d_sam_set_mpurate, |
| r3951 | r3952 | |
| 456 | 455 | |
| 457 | 456 | static void pak_load_trailer(running_machine *machine, const pak_decodedtrailer *trailer) |
| 458 | 457 | { |
| 458 | device_config *sam = (device_config*)device_list_find_by_tag( machine->config->devicelist, SAM6883, "sam"); |
| 459 | 459 | cpu_set_reg(machine->cpu[0], M6809_PC, trailer->reg_pc); |
| 460 | 460 | cpu_set_reg(machine->cpu[0], M6809_X, trailer->reg_x); |
| 461 | 461 | cpu_set_reg(machine->cpu[0], M6809_Y, trailer->reg_y); |
| r3951 | r3952 | |
| 496 | 496 | * access that bit or or whether it is something else. So that is why |
| 497 | 497 | * I am specifying 0x7fff instead of 0xffff here |
| 498 | 498 | */ |
| 499 | | sam_set_state(machine, trailer->sam, 0x7fff); |
| 499 | sam_set_state(sam, trailer->sam, 0x7fff); |
| 500 | 500 | } |
| 501 | 501 | |
| 502 | 502 | static int generic_pak_load(const device_config *image, int rambase_index, int rombase_index, int pakbase_index) |
| r3951 | r3952 | |
| 1867 | 1867 | Misc |
| 1868 | 1868 | ***************************************************************************/ |
| 1869 | 1869 | |
| 1870 | | static void d_sam_set_mpurate(running_machine *machine, int val) |
| 1870 | static SAM6883_SET_MPU_RATE( d_sam_set_mpurate ) |
| 1871 | 1871 | { |
| 1872 | 1872 | /* The infamous speed up poke. |
| 1873 | 1873 | * |
| r3951 | r3952 | |
| 1891 | 1891 | * TODO: Make the overclock more accurate. In dual speed, ROM was a fast |
| 1892 | 1892 | * access but RAM was not. I don't know how to simulate this. |
| 1893 | 1893 | */ |
| 1894 | | cpu_set_clockscale(machine->cpu[0], val ? 2 : 1); |
| 1894 | cpu_set_clockscale(device->machine->cpu[0], val ? 2 : 1); |
| 1895 | 1895 | } |
| 1896 | 1896 | |
| 1897 | 1897 | READ8_HANDLER(dragon_alpha_mapped_irq_r) |
| r3951 | r3952 | |
| 1952 | 1952 | |
| 1953 | 1953 | /* We need to init these vars from the sam, as this may be called from outside the sam callbacks */ |
| 1954 | 1954 | const address_space *space = cpu_get_address_space( machine->cpu[0], ADDRESS_SPACE_PROGRAM ); |
| 1955 | | UINT8 memsize = get_sam_memorysize(machine); |
| 1956 | | UINT8 maptype = get_sam_maptype(machine); |
| 1955 | device_config *sam = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, SAM6883, "sam"); |
| 1956 | UINT8 memsize = get_sam_memorysize(sam); |
| 1957 | UINT8 maptype = get_sam_maptype(sam); |
| 1957 | 1958 | // UINT8 pagemode = get_sam_pagemode(machine); |
| 1958 | 1959 | int last_ram_block; /* Last block that will be RAM, dependent on maptype */ |
| 1959 | 1960 | int block_index; /* Index of block being processed */ |
| r3951 | r3952 | |
| 2020 | 2021 | } |
| 2021 | 2022 | |
| 2022 | 2023 | |
| 2023 | | static void d_sam_set_pageonemode(running_machine *machine, int val) |
| 2024 | static SAM6883_SET_PAGE_ONE_MODE( d_sam_set_pageonemode ) |
| 2024 | 2025 | { |
| 2025 | 2026 | /* Page mode - allowed switching between the low 32k and the high 32k, |
| 2026 | 2027 | * assuming that 64k wasn't enabled |
| r3951 | r3952 | |
| 2029 | 2030 | * this (it probably ignored it) |
| 2030 | 2031 | */ |
| 2031 | 2032 | |
| 2032 | | if (!get_sam_maptype(machine)) // Ignored in maptype 1 |
| 2033 | if (!get_sam_maptype(device)) // Ignored in maptype 1 |
| 2033 | 2034 | { |
| 2034 | 2035 | if((mess_ram_size>0x8000) && val) |
| 2035 | 2036 | bottom_32k=&mess_ram[0x8000]; |
| 2036 | 2037 | else |
| 2037 | 2038 | bottom_32k=mess_ram; |
| 2038 | 2039 | |
| 2039 | | setup_memory_map(machine); |
| 2040 | setup_memory_map(device->machine); |
| 2040 | 2041 | } |
| 2041 | 2042 | } |
| 2042 | 2043 | |
| 2043 | | static void d_sam_set_memorysize(running_machine *machine, int val) |
| 2044 | static SAM6883_SET_MEMORY_SIZE( d_sam_set_memorysize ) |
| 2044 | 2045 | { |
| 2045 | 2046 | /* Memory size - allowed restricting memory accesses to something less than |
| 2046 | 2047 | * 32k |
| r3951 | r3952 | |
| 2066 | 2067 | * TODO: Verify that the CoCo 3 ignored this |
| 2067 | 2068 | */ |
| 2068 | 2069 | |
| 2069 | | setup_memory_map(machine); |
| 2070 | setup_memory_map(device->machine); |
| 2070 | 2071 | } |
| 2071 | 2072 | |
| 2072 | 2073 | |
| r3951 | r3952 | |
| 2162 | 2163 | /* way as the CoCo 1/2 and Dragon 32, this now has been reduced to a call to */ |
| 2163 | 2164 | /* setup_memory_map() - 2007-01-02 phs. */ |
| 2164 | 2165 | |
| 2165 | | static void d_sam_set_maptype(running_machine *machine,int val) |
| 2166 | static SAM6883_SET_MAP_TYPE( d_sam_set_maptype ) |
| 2166 | 2167 | { |
| 2167 | 2168 | if(val) |
| 2168 | 2169 | bottom_32k=mess_ram; // Always reset, when in maptype 1 |
| 2169 | 2170 | |
| 2170 | | setup_memory_map(machine); |
| 2171 | setup_memory_map(device->machine); |
| 2171 | 2172 | } |
| 2172 | 2173 | |
| 2173 | 2174 | /************************************* |
| r3951 | r3952 | |
| 2569 | 2570 | |
| 2570 | 2571 | |
| 2571 | 2572 | |
| 2572 | | static const UINT8 *coco3_sam_get_rambase(running_machine *machine) |
| 2573 | static SAM6883_GET_RAMBASE( coco3_sam_get_rambase ) |
| 2573 | 2574 | { |
| 2574 | 2575 | UINT32 video_base; |
| 2575 | 2576 | video_base = coco3_get_video_base(0xE0, 0x3F); |
| r3951 | r3952 | |
| 2579 | 2580 | |
| 2580 | 2581 | |
| 2581 | 2582 | |
| 2582 | | static void coco3_sam_set_maptype(running_machine *machine,int val) |
| 2583 | static SAM6883_SET_MAP_TYPE( coco3_sam_set_maptype ) |
| 2583 | 2584 | { |
| 2584 | 2585 | coco3_enable_64k = val; |
| 2585 | | coco3_mmu_update(machine, 4, 8); |
| 2586 | coco3_mmu_update(device->machine, 4, 8); |
| 2586 | 2587 | } |
| 2587 | 2588 | |
| 2588 | 2589 | |
| r3951 | r3952 | |
| 2924 | 2925 | |
| 2925 | 2926 | /* Do generic Inits */ |
| 2926 | 2927 | generic_init_machine(machine, init); |
| 2927 | | |
| 2928 | | /* Init SAM */ |
| 2929 | | sam_init(machine, &coco_sam_intf); |
| 2930 | 2928 | } |
| 2931 | 2929 | |
| 2932 | 2930 | /******* Machine Setups Dragons **********/ |
| r3951 | r3952 | |
| 3096 | 3094 | |
| 3097 | 3095 | generic_init_machine(machine, &init); |
| 3098 | 3096 | |
| 3099 | | /* Init SAM */ |
| 3100 | | sam_init(machine, &coco3_sam_intf); |
| 3101 | | |
| 3102 | 3097 | /* CoCo 3 specific function pointers */ |
| 3103 | 3098 | update_keyboard = coco3_update_keyboard; |
| 3104 | 3099 | |
src/mess/machine/6883sam.c
| r3951 | r3952 | |
| 55 | 55 | |
| 56 | 56 | #define LOG_VIDEO_POSITION 0 |
| 57 | 57 | |
| 58 | | typedef struct _sam6883 sam6883; |
| 59 | | struct _sam6883 |
| 58 | typedef enum |
| 60 | 59 | { |
| 60 | TYPE_SAM6883 = 0, |
| 61 | TYPE_SAM6883_GIME = 1, |
| 62 | } SAM6883_VERSION; |
| 63 | |
| 64 | |
| 65 | /***************************************************************************** |
| 66 | Type definitions |
| 67 | *****************************************************************************/ |
| 68 | |
| 69 | typedef struct _sam6883_t sam6883_t; |
| 70 | struct _sam6883_t |
| 71 | { |
| 72 | SAM6883_VERSION type; |
| 61 | 73 | const sam6883_interface *intf; |
| 62 | 74 | UINT16 state; |
| 63 | 75 | UINT16 old_state; |
| r3951 | r3952 | |
| 65 | 77 | int last_scanline; |
| 66 | 78 | }; |
| 67 | 79 | |
| 68 | | static sam6883 sam; |
| 69 | | |
| 70 | 80 | static const UINT8 sam_video_mode_row_heights[] = |
| 71 | 81 | { |
| 72 | 82 | 12, /* 0 - Text */ |
| r3951 | r3952 | |
| 91 | 101 | 32 /* 7 - Reserved/Invalid */ |
| 92 | 102 | }; |
| 93 | 103 | |
| 94 | | static void sam_reset(running_machine *machine); |
| 95 | 104 | |
| 96 | | static void update_sam(running_machine *machine) |
| 105 | /***************************************************************************** |
| 106 | Implementation |
| 107 | *****************************************************************************/ |
| 108 | |
| 109 | INLINE sam6883_t *get_safe_token(const device_config *device) |
| 97 | 110 | { |
| 98 | | UINT16 xorval; |
| 111 | assert(device != NULL); |
| 112 | assert(device->token != NULL); |
| 99 | 113 | |
| 100 | | xorval = sam.old_state ^ sam.state; |
| 101 | | sam.old_state = sam.state; |
| 114 | return (sam6883_t *)device->token; |
| 115 | } |
| 102 | 116 | |
| 117 | static void update_sam(const device_config *device) |
| 118 | { |
| 119 | sam6883_t *sam = get_safe_token(device); |
| 120 | UINT16 xorval; |
| 121 | |
| 122 | xorval = sam->old_state ^ sam->state; |
| 123 | sam->old_state = sam->state; |
| 124 | |
| 103 | 125 | /* Check changes in Page #1 */ |
| 104 | | if ((xorval & 0x0400) && sam.intf->set_pageonemode) |
| 105 | | sam.intf->set_pageonemode(machine,(sam.state & 0x0400) / 0x0400); |
| 126 | if ((xorval & 0x0400) && sam->intf->set_pageonemode) |
| 127 | sam->intf->set_pageonemode(device,(sam->state & 0x0400) / 0x0400); |
| 106 | 128 | |
| 107 | 129 | /* Check changes in MPU Rate */ |
| 108 | | if ((xorval & 0x1800) && sam.intf->set_mpurate) |
| 109 | | sam.intf->set_mpurate(machine,(sam.state & 0x1800) / 0x0800); |
| 130 | if ((xorval & 0x1800) && sam->intf->set_mpurate) |
| 131 | sam->intf->set_mpurate(device,(sam->state & 0x1800) / 0x0800); |
| 110 | 132 | |
| 111 | 133 | /* Check changes in Memory Size */ |
| 112 | | if ((xorval & 0x6000) && sam.intf->set_memorysize) |
| 113 | | sam.intf->set_memorysize(machine,(sam.state & 0x6000) / 0x2000); |
| 134 | if ((xorval & 0x6000) && sam->intf->set_memorysize) |
| 135 | sam->intf->set_memorysize(device,(sam->state & 0x6000) / 0x2000); |
| 114 | 136 | |
| 115 | 137 | /* Check changes in Map Type */ |
| 116 | | if ((xorval & 0x8000) && sam.intf->set_maptype) |
| 117 | | sam.intf->set_maptype(machine,(sam.state & 0x8000) / 0x8000); |
| 138 | if ((xorval & 0x8000) && sam->intf->set_maptype) |
| 139 | sam->intf->set_maptype(device,(sam->state & 0x8000) / 0x8000); |
| 118 | 140 | } |
| 119 | 141 | |
| 120 | 142 | |
| 121 | 143 | |
| 122 | 144 | static STATE_POSTLOAD( update_sam_postload ) |
| 123 | 145 | { |
| 124 | | update_sam(machine); |
| 146 | const device_config *device = (const device_config *)param; |
| 147 | update_sam(device); |
| 125 | 148 | } |
| 126 | 149 | |
| 127 | | |
| 128 | | |
| 129 | | void sam_init(running_machine *machine, const sam6883_interface *intf) |
| 150 | void sam_set_state(const device_config *device, UINT16 state, UINT16 mask) |
| 130 | 151 | { |
| 131 | | sam.state = 0; |
| 132 | | sam.old_state = ~0; |
| 133 | | sam.intf = intf; |
| 134 | | |
| 135 | | add_reset_callback(machine, sam_reset); |
| 136 | | |
| 137 | | /* save state registration */ |
| 138 | | state_save_register_item(machine, "6883sam", NULL, 0, sam.state); |
| 139 | | state_save_register_item(machine, "6883sam", NULL, 0, sam.video_position); |
| 140 | | state_save_register_postload(machine, update_sam_postload, NULL); |
| 152 | sam6883_t *sam = get_safe_token(device); |
| 153 | sam->state &= ~mask; |
| 154 | sam->state |= (state & mask); |
| 155 | update_sam(device); |
| 141 | 156 | } |
| 142 | 157 | |
| 143 | | |
| 144 | | |
| 145 | | static void sam_reset(running_machine *machine) |
| 158 | WRITE8_DEVICE_HANDLER(sam6883_w) |
| 146 | 159 | { |
| 147 | | sam.state = 0; |
| 148 | | sam.old_state = ~0; |
| 149 | | update_sam(machine); |
| 150 | | } |
| 151 | | |
| 152 | | |
| 153 | | |
| 154 | | void sam_set_state(running_machine *machine, UINT16 state, UINT16 mask) |
| 155 | | { |
| 156 | | sam.state &= ~mask; |
| 157 | | sam.state |= (state & mask); |
| 158 | | update_sam(machine); |
| 159 | | } |
| 160 | | |
| 161 | | |
| 162 | | |
| 163 | | WRITE8_HANDLER(sam_w) |
| 164 | | { |
| 165 | 160 | UINT16 mask; |
| 166 | | |
| 161 | sam6883_t *sam = get_safe_token(device); |
| 162 | |
| 167 | 163 | if (offset < 32) |
| 168 | 164 | { |
| 169 | 165 | mask = 1 << (offset / 2); |
| 170 | 166 | if (offset & 1) |
| 171 | | sam.state |= mask; |
| 167 | sam->state |= mask; |
| 172 | 168 | else |
| 173 | | sam.state &= ~mask; |
| 174 | | update_sam(space->machine); |
| 169 | sam->state &= ~mask; |
| 170 | update_sam(device); |
| 175 | 171 | } |
| 176 | 172 | } |
| 177 | 173 | |
| 178 | | |
| 179 | | |
| 180 | | const UINT8 *sam_m6847_get_video_ram(running_machine *machine,int scanline) |
| 174 | const UINT8 *sam_m6847_get_video_ram(const device_config *device,int scanline) |
| 181 | 175 | { |
| 176 | sam6883_t *sam = get_safe_token(device); |
| 182 | 177 | const UINT8 *ram_base; |
| 183 | 178 | UINT16 video_position; |
| 184 | 179 | |
| 185 | | if (scanline != sam.last_scanline) |
| 180 | if (scanline != sam->last_scanline) |
| 186 | 181 | { |
| 187 | 182 | /* first scanline? */ |
| 188 | 183 | if (scanline == 0) |
| 189 | 184 | { |
| 190 | 185 | /* reset video position */ |
| 191 | | sam.video_position = (sam.state & 0x03F8) << 6; |
| 186 | sam->video_position = (sam->state & 0x03F8) << 6; |
| 192 | 187 | } |
| 193 | 188 | else |
| 194 | 189 | { |
| 195 | 190 | /* time to advance a row? */ |
| 196 | | if ((scanline % sam_video_mode_row_heights[sam.state & 0x0007]) == 0) |
| 197 | | sam.video_position += sam_video_mode_row_pitches[sam.state & 0x0007]; |
| 191 | if ((scanline % sam_video_mode_row_heights[sam->state & 0x0007]) == 0) |
| 192 | sam->video_position += sam_video_mode_row_pitches[sam->state & 0x0007]; |
| 198 | 193 | } |
| 199 | | sam.last_scanline = scanline; |
| 194 | sam->last_scanline = scanline; |
| 200 | 195 | } |
| 201 | 196 | |
| 202 | | video_position = sam.video_position; |
| 197 | video_position = sam->video_position; |
| 203 | 198 | |
| 204 | | if (sam.intf->type != SAM6883_GIME) |
| 199 | if (sam->type != TYPE_SAM6883_GIME) |
| 205 | 200 | { |
| 206 | 201 | /* mask the video position according to the SAM's settings */ |
| 207 | | switch(sam.state & 0x6000) |
| 202 | switch(sam->state & 0x6000) |
| 208 | 203 | { |
| 209 | 204 | case 0x0000: video_position &= 0x0FFF; break; /* 4k */ |
| 210 | 205 | case 0x2000: video_position &= 0x3FFF; break; /* 16k */ |
| r3951 | r3952 | |
| 216 | 211 | logerror("sam_m6847_get_video_ram(): scanline=%d video_position=0x%04X\n", scanline, video_position); |
| 217 | 212 | |
| 218 | 213 | /* return actual position */ |
| 219 | | ram_base = sam.intf->get_rambase ? sam.intf->get_rambase(machine) : mess_ram; |
| 214 | ram_base = sam->intf->get_rambase ? sam->intf->get_rambase(device) : mess_ram; |
| 220 | 215 | return &ram_base[video_position]; |
| 221 | 216 | } |
| 222 | 217 | |
| 223 | | UINT8 get_sam_memorysize(running_machine *machine) |
| 218 | UINT8 get_sam_memorysize(const device_config *device) |
| 224 | 219 | { |
| 225 | | return (sam.state & 0x6000) / 0x2000; |
| 220 | sam6883_t *sam = get_safe_token(device); |
| 221 | return (sam->state & 0x6000) / 0x2000; |
| 226 | 222 | } |
| 227 | 223 | |
| 228 | | UINT8 get_sam_pagemode(running_machine *machine) |
| 224 | UINT8 get_sam_pagemode(const device_config *device) |
| 229 | 225 | { |
| 230 | | return (sam.state & 0x0400) / 0x0400; |
| 226 | sam6883_t *sam = get_safe_token(device); |
| 227 | return (sam->state & 0x0400) / 0x0400; |
| 231 | 228 | } |
| 232 | 229 | |
| 233 | | UINT8 get_sam_maptype(running_machine *machine) |
| 230 | UINT8 get_sam_maptype(const device_config *device) |
| 234 | 231 | { |
| 235 | | return (sam.state & 0x8000) / 0x8000; |
| 232 | sam6883_t *sam = get_safe_token(device); |
| 233 | return (sam->state & 0x8000) / 0x8000; |
| 236 | 234 | } |
| 235 | |
| 236 | /* Device Interface */ |
| 237 | static device_start_err common_start(const device_config *device, SAM6883_VERSION device_type) |
| 238 | { |
| 239 | sam6883_t *sam = get_safe_token(device); |
| 240 | // validate arguments |
| 241 | assert(device != NULL); |
| 242 | assert(device->tag != NULL); |
| 243 | assert(strlen(device->tag) < 20); |
| 244 | assert(device->static_config != NULL); |
| 245 | |
| 246 | sam->intf = device->static_config; |
| 247 | |
| 248 | sam->type = device_type; |
| 249 | |
| 250 | sam->state = 0; |
| 251 | sam->old_state = ~0; |
| 252 | |
| 253 | /* save state registration */ |
| 254 | state_save_register_item(device->machine, "6883sam", NULL, 0, sam->state); |
| 255 | state_save_register_item(device->machine, "6883sam", NULL, 0, sam->video_position); |
| 256 | state_save_register_postload(device->machine, update_sam_postload, (void*)device); |
| 257 | return DEVICE_START_OK; |
| 258 | } |
| 259 | |
| 260 | static DEVICE_START( sam6883 ) |
| 261 | { |
| 262 | return common_start(device, TYPE_SAM6883); |
| 263 | } |
| 264 | |
| 265 | static DEVICE_START( sam6883_gime ) |
| 266 | { |
| 267 | return common_start(device, TYPE_SAM6883_GIME); |
| 268 | } |
| 269 | |
| 270 | static DEVICE_RESET( sam6883 ) |
| 271 | { |
| 272 | sam6883_t *sam = get_safe_token(device); |
| 273 | sam->state = 0; |
| 274 | sam->old_state = ~0; |
| 275 | update_sam(device); |
| 276 | } |
| 277 | |
| 278 | static DEVICE_SET_INFO( sam6883 ) |
| 279 | { |
| 280 | switch (state) |
| 281 | { |
| 282 | /* no parameters to set */ |
| 283 | } |
| 284 | } |
| 285 | |
| 286 | DEVICE_GET_INFO( sam6883 ) |
| 287 | { |
| 288 | switch (state) |
| 289 | { |
| 290 | /* --- the following bits of info are returned as 64-bit signed integers --- */ |
| 291 | case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(sam6883_t); break; |
| 292 | case DEVINFO_INT_INLINE_CONFIG_BYTES: info->i = 0; break; |
| 293 | case DEVINFO_INT_CLASS: info->i = DEVICE_CLASS_PERIPHERAL; break; |
| 294 | |
| 295 | /* --- the following bits of info are returned as pointers to data or functions --- */ |
| 296 | case DEVINFO_FCT_SET_INFO: info->set_info = DEVICE_SET_INFO_NAME(sam6883); break; |
| 297 | case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(sam6883); break; |
| 298 | case DEVINFO_FCT_STOP: /* Nothing */ break; |
| 299 | case DEVINFO_FCT_RESET: info->reset = DEVICE_RESET_NAME(sam6883); break; |
| 300 | |
| 301 | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 302 | case DEVINFO_STR_NAME: info->s = "6883 SAM"; break; |
| 303 | case DEVINFO_STR_FAMILY: info->s = "6883 SAM"; break; |
| 304 | case DEVINFO_STR_VERSION: info->s = "1.0"; break; |
| 305 | case DEVINFO_STR_SOURCE_FILE: info->s = __FILE__; break; |
| 306 | case DEVINFO_STR_CREDITS: info->s = "Copyright MESS Team"; break; |
| 307 | } |
| 308 | } |
| 309 | |
| 310 | DEVICE_GET_INFO( sam6883_gime ) |
| 311 | { |
| 312 | switch (state) |
| 313 | { |
| 314 | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 315 | case DEVINFO_STR_NAME: info->s = "6883 SAM GIME"; break; |
| 316 | |
| 317 | /* --- the following bits of info are returned as pointers to data or functions --- */ |
| 318 | case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(sam6883_gime); break; |
| 319 | |
| 320 | default: DEVICE_GET_INFO_CALL(sam6883); break; |
| 321 | } |
| 322 | } |
src/mess/machine/6883sam.h
| r3951 | r3952 | |
| 19 | 19 | |
| 20 | 20 | #include "driver.h" |
| 21 | 21 | |
| 22 | | typedef enum |
| 23 | | { |
| 24 | | SAM6883_ORIGINAL, |
| 25 | | SAM6883_GIME |
| 26 | | } sam6883_type; |
| 27 | 22 | |
| 23 | /*************************************************************************** |
| 24 | MACROS |
| 25 | ***************************************************************************/ |
| 26 | |
| 27 | #define SAM6883 DEVICE_GET_INFO_NAME(sam6883) |
| 28 | #define SAM6883_GIME DEVICE_GET_INFO_NAME(sam6883_gime) |
| 29 | |
| 30 | /*************************************************************************** |
| 31 | TYPE DEFINITIONS |
| 32 | ***************************************************************************/ |
| 33 | typedef UINT8 *(*sam6883_get_rambase_func)(const device_config *device); |
| 34 | #define SAM6883_GET_RAMBASE(name) UINT8 *name(const device_config *device ) |
| 35 | |
| 36 | typedef void (*sam6883_set_pageonemode_func)(const device_config *device, int val); |
| 37 | #define SAM6883_SET_PAGE_ONE_MODE(name) void name(const device_config *device, int val ) |
| 38 | |
| 39 | typedef void (*sam6883_set_mpurate_func)(const device_config *device, int val); |
| 40 | #define SAM6883_SET_MPU_RATE(name) void name(const device_config *device, int val ) |
| 41 | |
| 42 | typedef void (*sam6883_set_memorysize_func)(const device_config *device, int val); |
| 43 | #define SAM6883_SET_MEMORY_SIZE(name) void name(const device_config *device, int val ) |
| 44 | |
| 45 | typedef void (*sam6883_set_map_type_func)(const device_config *device, int val); |
| 46 | #define SAM6883_SET_MAP_TYPE(name) void name(const device_config *device, int val ) |
| 47 | |
| 48 | |
| 28 | 49 | typedef struct _sam6883_interface sam6883_interface; |
| 29 | 50 | struct _sam6883_interface |
| 30 | 51 | { |
| 31 | | sam6883_type type; |
| 32 | | const UINT8 *(*get_rambase)(running_machine *machine); |
| 33 | | void (*set_pageonemode)(running_machine *machine, int val); |
| 34 | | void (*set_mpurate)(running_machine *machine, int val); |
| 35 | | void (*set_memorysize)(running_machine *machine, int val); |
| 36 | | void (*set_maptype)(running_machine *machine, int val); |
| 52 | sam6883_get_rambase_func get_rambase; |
| 53 | sam6883_set_pageonemode_func set_pageonemode; |
| 54 | sam6883_set_mpurate_func set_mpurate; |
| 55 | sam6883_set_memorysize_func set_memorysize; |
| 56 | sam6883_set_map_type_func set_maptype; |
| 37 | 57 | }; |
| 38 | 58 | |
| 39 | | /* initialize the SAM */ |
| 40 | | void sam_init(running_machine *machine, const sam6883_interface *intf); |
| 59 | /*************************************************************************** |
| 60 | FUNCTION PROTOTYPES |
| 61 | ***************************************************************************/ |
| 41 | 62 | |
| 63 | /* device interface */ |
| 64 | DEVICE_GET_INFO( sam6883 ); |
| 65 | DEVICE_GET_INFO( sam6883_gime ); |
| 66 | |
| 67 | /* Standard handlers */ |
| 68 | |
| 69 | /* write to the SAM */ |
| 70 | WRITE8_DEVICE_HANDLER(sam6883_w); |
| 71 | |
| 42 | 72 | /* set the state of the SAM */ |
| 43 | | void sam_set_state(running_machine *machine,UINT16 state, UINT16 mask); |
| 73 | void sam_set_state(const device_config *device,UINT16 state, UINT16 mask); |
| 44 | 74 | |
| 45 | 75 | /* used by video/m6847.c to read the position of the SAM */ |
| 46 | | const UINT8 *sam_m6847_get_video_ram(running_machine *machine,int scanline); |
| 76 | const UINT8 *sam_m6847_get_video_ram(const device_config *device,int scanline); |
| 47 | 77 | |
| 48 | | /* write to the SAM */ |
| 49 | | WRITE8_HANDLER(sam_w); |
| 50 | | |
| 51 | 78 | /* used to get memory size and pagemode independent of callbacks */ |
| 52 | | UINT8 get_sam_memorysize(running_machine *machine); |
| 53 | | UINT8 get_sam_pagemode(running_machine *machine); |
| 54 | | UINT8 get_sam_maptype(running_machine *machine); |
| 79 | UINT8 get_sam_memorysize(const device_config *device); |
| 80 | UINT8 get_sam_pagemode(const device_config *device); |
| 81 | UINT8 get_sam_maptype(const device_config *device); |
| 55 | 82 | |
| 83 | |
| 84 | /*************************************************************************** |
| 85 | DEVICE CONFIGURATION MACROS |
| 86 | ***************************************************************************/ |
| 87 | |
| 88 | #define MDRV_SAM6883_ADD(_tag, _intrf) \ |
| 89 | MDRV_DEVICE_ADD(_tag, SAM6883) \ |
| 90 | MDRV_DEVICE_CONFIG(_intrf) |
| 91 | |
| 92 | #define MDRV_SAM6883_GIME_ADD(_tag, _intrf) \ |
| 93 | MDRV_DEVICE_ADD(_tag, SAM6883_GIME) \ |
| 94 | MDRV_DEVICE_CONFIG(_intrf) |
| 95 | |
| 96 | |
| 56 | 97 | #endif /* __6833SAM_H__ */ |
src/mess/drivers/coco.c
| r3951 | r3952 | |
| 58 | 58 | AM_RANGE(0xff20, 0xff3f) AM_READWRITE(pia_1_r, coco_pia_1_w) |
| 59 | 59 | AM_RANGE(0xff40, 0xff8f) AM_READWRITE(coco_cartridge_r, coco_cartridge_w) |
| 60 | 60 | AM_RANGE(0xff90, 0xffbf) AM_NOP |
| 61 | | AM_RANGE(0xffc0, 0xffdf) AM_WRITE(sam_w) |
| 61 | AM_RANGE(0xffc0, 0xffdf) AM_DEVWRITE(SAM6883, "sam", sam6883_w) |
| 62 | 62 | AM_RANGE(0xffe0, 0xffef) AM_NOP |
| 63 | 63 | AM_RANGE(0xfff0, 0xffff) AM_ROM AM_REGION("main", 0x3ff0) |
| 64 | 64 | ADDRESS_MAP_END |
| r3951 | r3952 | |
| 89 | 89 | AM_RANGE(0xff90, 0xff9f) AM_READWRITE(coco3_gime_r, coco3_gime_w) |
| 90 | 90 | AM_RANGE(0xffa0, 0xffaf) AM_READWRITE(coco3_mmu_r, coco3_mmu_w) |
| 91 | 91 | AM_RANGE(0xffb0, 0xffbf) AM_READWRITE(SMH_BANK10, coco3_palette_w) |
| 92 | | AM_RANGE(0xffc0, 0xffdf) AM_WRITE(sam_w) |
| 92 | AM_RANGE(0xffc0, 0xffdf) AM_DEVWRITE(SAM6883_GIME, "sam", sam6883_w) |
| 93 | 93 | AM_RANGE(0xffe0, 0xffef) AM_NOP |
| 94 | 94 | AM_RANGE(0xfff0, 0xffff) AM_ROM AM_REGION("main", 0x7ff0) |
| 95 | 95 | ADDRESS_MAP_END |
| r3951 | r3952 | |
| 118 | 118 | AM_RANGE(0xff20, 0xff3f) AM_READWRITE(pia_1_r, coco_pia_1_w) |
| 119 | 119 | AM_RANGE(0xff40, 0xff8f) AM_READWRITE(coco_cartridge_r, coco_cartridge_w) |
| 120 | 120 | AM_RANGE(0xff90, 0xffbf) AM_NOP |
| 121 | | AM_RANGE(0xffc0, 0xffdf) AM_WRITE(sam_w) |
| 121 | AM_RANGE(0xffc0, 0xffdf) AM_DEVWRITE(SAM6883, "sam", sam6883_w) |
| 122 | 122 | AM_RANGE(0xffe0, 0xffef) AM_NOP |
| 123 | 123 | AM_RANGE(0xfff0, 0xffff) AM_ROM AM_REGION("main", 0x3ff0) |
| 124 | 124 | ADDRESS_MAP_END |
| r3951 | r3952 | |
| 152 | 152 | AM_RANGE(0xff20, 0xff3f) AM_READWRITE(pia_1_r,coco_pia_1_w) |
| 153 | 153 | AM_RANGE(0xff40, 0xff8f) AM_READWRITE(coco_cartridge_r, coco_cartridge_w) |
| 154 | 154 | AM_RANGE(0xff90, 0xffbf) AM_NOP |
| 155 | | AM_RANGE(0xffc0, 0xffdf) AM_WRITE(sam_w) |
| 155 | AM_RANGE(0xffc0, 0xffdf) AM_DEVWRITE(SAM6883, "sam", sam6883_w) |
| 156 | 156 | AM_RANGE(0xffe0, 0xffe1) AM_NOP |
| 157 | 157 | AM_RANGE(0xffe2, 0xffe2) AM_READWRITE(plus_reg_r,plus_reg_w) /* Dragon plus control / status reg */ |
| 158 | 158 | AM_RANGE(0xffe3, 0xffef) AM_NOP |
| r3951 | r3952 | |
| 233 | 233 | AM_RANGE(0xff2c, 0xff2f) AM_READWRITE(wd2797_r, wd2797_w) /* Alpha onboard disk interface */ |
| 234 | 234 | AM_RANGE(0xff40, 0xff8f) AM_READWRITE(coco_cartridge_r, coco_cartridge_w) |
| 235 | 235 | AM_RANGE(0xff90, 0xffbf) AM_NOP |
| 236 | | AM_RANGE(0xffc0, 0xffdf) AM_WRITE(sam_w) |
| 236 | AM_RANGE(0xffc0, 0xffdf) AM_DEVWRITE(SAM6883, "sam", sam6883_w) |
| 237 | 237 | AM_RANGE(0xffe0, 0xffef) AM_NOP |
| 238 | 238 | AM_RANGE(0xfff0, 0xffff) AM_READ(dragon_alpha_mapped_irq_r) |
| 239 | 239 | ADDRESS_MAP_END |
| r3951 | r3952 | |
| 667 | 667 | MDRV_CASSETTE_ADD( "cassette", coco_cassette_config ) |
| 668 | 668 | |
| 669 | 669 | MDRV_WD179X_ADD("wd179x", dragon_wd17xx_interface ) |
| 670 | |
| 671 | MDRV_SAM6883_ADD("sam", coco_sam_intf) |
| 670 | 672 | MACHINE_DRIVER_END |
| 671 | 673 | |
| 672 | 674 | static MACHINE_DRIVER_START( dragon64 ) |
| r3951 | r3952 | |
| 701 | 703 | MDRV_ACIA6551_ADD("acia") |
| 702 | 704 | |
| 703 | 705 | MDRV_WD179X_ADD("wd179x", dragon_wd17xx_interface ) |
| 706 | |
| 707 | MDRV_SAM6883_ADD("sam", coco_sam_intf) |
| 704 | 708 | MACHINE_DRIVER_END |
| 705 | 709 | |
| 706 | 710 | static MACHINE_DRIVER_START( d64plus ) |
| r3951 | r3952 | |
| 735 | 739 | MDRV_DEVICE_ADD("acia", ACIA6551) |
| 736 | 740 | |
| 737 | 741 | MDRV_WD179X_ADD("wd179x", dragon_wd17xx_interface ) |
| 742 | |
| 743 | MDRV_SAM6883_ADD("sam", coco_sam_intf) |
| 738 | 744 | MACHINE_DRIVER_END |
| 739 | 745 | |
| 740 | 746 | static MACHINE_DRIVER_START( dgnalpha ) |
| r3951 | r3952 | |
| 772 | 778 | MDRV_DEVICE_ADD("acia", ACIA6551) |
| 773 | 779 | |
| 774 | 780 | MDRV_WD179X_ADD("wd179x", dgnalpha_wd17xx_interface ) |
| 781 | |
| 782 | MDRV_SAM6883_ADD("sam", coco_sam_intf) |
| 775 | 783 | MACHINE_DRIVER_END |
| 776 | 784 | |
| 777 | 785 | static MACHINE_DRIVER_START( tanodr64 ) |
| r3951 | r3952 | |
| 806 | 814 | MDRV_DEVICE_ADD("acia", ACIA6551) |
| 807 | 815 | |
| 808 | 816 | MDRV_WD1773_ADD("wd1773", coco_wd17xx_interface ) |
| 817 | |
| 818 | MDRV_SAM6883_ADD("sam", coco_sam_intf) |
| 809 | 819 | MACHINE_DRIVER_END |
| 810 | 820 | |
| 811 | 821 | static MACHINE_DRIVER_START( coco ) |
| r3951 | r3952 | |
| 841 | 851 | MDRV_CASSETTE_ADD( "cassette", coco_cassette_config ) |
| 842 | 852 | |
| 843 | 853 | MDRV_WD1773_ADD("wd1773", coco_wd17xx_interface ) |
| 854 | |
| 855 | MDRV_SAM6883_ADD("sam", coco_sam_intf) |
| 844 | 856 | MACHINE_DRIVER_END |
| 845 | 857 | |
| 846 | 858 | static MACHINE_DRIVER_START( coco2 ) |
| r3951 | r3952 | |
| 876 | 888 | MDRV_CASSETTE_ADD( "cassette", coco_cassette_config ) |
| 877 | 889 | |
| 878 | 890 | MDRV_WD1773_ADD("wd1773", coco_wd17xx_interface ) |
| 891 | |
| 892 | MDRV_SAM6883_ADD("sam", coco_sam_intf) |
| 879 | 893 | MACHINE_DRIVER_END |
| 880 | 894 | |
| 881 | 895 | static MACHINE_DRIVER_START( coco2b ) |
| r3951 | r3952 | |
| 911 | 925 | MDRV_CASSETTE_ADD( "cassette", coco_cassette_config ) |
| 912 | 926 | |
| 913 | 927 | MDRV_WD1773_ADD("wd1773", coco_wd17xx_interface ) |
| 928 | |
| 929 | MDRV_SAM6883_ADD("sam", coco_sam_intf) |
| 914 | 930 | MACHINE_DRIVER_END |
| 915 | 931 | |
| 916 | 932 | static MACHINE_DRIVER_START( coco3 ) |
| r3951 | r3952 | |
| 956 | 972 | MDRV_CASSETTE_ADD( "cassette", coco_cassette_config ) |
| 957 | 973 | |
| 958 | 974 | MDRV_WD1773_ADD("wd1773", coco_wd17xx_interface ) |
| 975 | |
| 976 | MDRV_SAM6883_GIME_ADD("sam", coco3_sam_intf) |
| 959 | 977 | MACHINE_DRIVER_END |
| 960 | 978 | |
| 961 | 979 | static MACHINE_DRIVER_START( coco3p ) |