| Previous | 15994 Revisions | Next |
| r1462 Sunday 30th December, 2007 at 23:56:29 UTC by Nathan Woods |
|---|
| Removed whitespace [Atari Ace] |
| [src/mess] | artworkx.c device.c device.h filemngr.c hashfile.c image.c image.h infomess.c inputx.c inputx.h messdriv.c mesvalid.c mscommon.c osdmess.h pile.c tapectrl.c |
| [src/mess/audio] | arcadia.c dave.c dave.h lynx.c mea8000.c odyssey2.c sblaster.c svision.c vc4000.c |
| [src/mess/devices] | appldriv.c appldriv.h basicdsk.c cassette.c coco_fdc.c coco_vhd.c cococart.c cococart.h flopdrv.c mflopimg.c printer.h snapquik.c sonydriv.c sonydriv.h thomflop.c |
| [src/mess/drivers] | 3do.c a310.c abc80.c abc80x.c acrnsys1.c apple2gs.c at.c atari.c atarist.c avigo.c bbcbc.c c16.c c64.c cgenie.c coco.c coleco.c compis.c coupe.c crvision.c dai.c dgn_beta.c einstein.c ex800.c exidy.c gamecom.c gb.c genesis.c geneve.c glasgow.c hp48.c intv.c ip22.c jaguar.c kc.c lviv.c mac.c mbee.c mephisto.c microtan.c mk2.c mpf1.c msx.c mtx.c nascom1.c odyssey2.c oric.c osi.c pc.c pc8801.c pcw.c pcw16.c pmd85.c pocketc.c ql.c saturn.c sg1000.c sms.c snes.c sord.c spectrum.c ssystem3.c studio2.c super80.c svi318.c svision.c sym1.c thomson.c ti85.c tm990189.c tmc1800.c tmc600.c trs80.c vectrex.c vip.c wswan.c x68k.c z88.c zx.c |
| [src/mess/formats] | ap_dsk35.c apf_apt.c basicdsk.c cassimg.c coco_cas.c coco_dsk.c flopimg.c fmsx_cas.c lviv_lvt.c oric_tap.c pc_dsk.c pmd_pmd.c primoptp.c thom_cas.c thom_cas.h thom_dsk.c thom_dsk.h ti85_ser.c trs_dsk.c vt_dsk.c wavfile.c zx81_p.c |
| [src/mess/includes] | at.h cbmdrive.h centroni.h compis.h crtc6845.h dgn_beta.h europc.h hd6402.h hp48.h i8271.h jupiter.h kc.h mac.h msm8251.h msx_slot.h odyssey2.h pc_ide.h pclpt.h pcw16.h sblaster.h serial.h sym1.h ted7360.h ti85.h z88.h |
| [src/mess/machine] | 3do.c 6551.c 68901mfp.c 74145.c 99_dsk.c 99_usbsm.c abcbus.h adam.c amigacd.c amigacrt.c amigafdc.c amigakbd.c amstr_pc.c apple1.c apple2.c apple2gs.c apple3.c applefdc.c applefdc.h at.c atarifdc.c ay3600.c bebox.c c128.c c16.c c64.c cbm.c centroni.c coco.c coleco.c compis.c concept.c corvushd.c dgn_beta.c ds1315.c ds1315.h electron.c europc.c galaxy.c geneve.c hd63450.c hd63450.h hd6402.c hp48.c i8271.c ibmpc.c kc.c lisa.h lviv.c lynx.c mac.c matsucd.c mbee.c mc6843.c mc6846.c mc6846.h mc6854.c mc6854.h mm58274c.c mpc105.c msm8251.c msx.c msx_slot.c ncr5380.c nec765.c nes.c nes_mmc.c odyssey2.c oric.c osi.c pc.c pc1251.c pc1350.c pc1403.c pc_fdc.c pc_hdc.c pc_ide.c pc_joy.c pc_mouse.c pc_turbo.c pclpt.c pdp1.c pet.c pmd85.c primo.c rp5c15.c rriot.c rriot.h smc92x4.c sms.c svi318.c sym1.c tandy1t.c tc8521.c thomson.c ti85.c ti99_4x.c tms5501.c tx0.c vectrex.c wd17xx.c wswan.c z80dart.c |
| [src/mess/osd/sdl] | glob.c sdlmess.c |
| [src/mess/osd/windows] | dialog.c glob.c menu.c messres.h opcntrl.c winutils.c |
| [src/mess/osd/winui] | devview.c messui.c propertiesms.c softwarepicker.c |
| [src/mess/tools/dat2html] | dat2html.c |
| [src/mess/tools/imgtool] | charconv.c filtbas.c iflopimg.c imghd.c imgterrs.h imgtool.c library.h stream.c |
| [src/mess/tools/imgtool/modules] | cococas.c concept.c crt.c d64.c fat.c imgwave.c lynx.c mac.c macbin.c msx_dsk.c nccard.c os9.c prodos.c svi_cas.c t64.c thomson.c ti85.c ti99.c ti990hd.c vmsx_tap.c vzdos.c xsa.c |
| [src/mess/tools/imgtool/windows] | assoc.c assocdlg.c attrdlg.c hexview.c secview.c wimgres.h wimgtool.c wmain.c |
| [src/mess/tools/messtest] | core.c main.c testimgt.c testmess.c |
| [src/mess/video] | abc80.c abc80x.c amstrad.c apple1.c apple2.c apple2gs.c atarist.c avigo.c cdp1861.c cdp1864.c cgapal.c cirrus.c coco.c coco3.c crtc6845.c dai.c dgn_beta.c epnick.h exidy.c galaxy.c gb.c hp48.c i82720.c i82720.h i82720cm.h intv.c kc.c lviv.c m6845.c m6847.c mac.c microtan.c nc.c odyssey2.c oric.c pc1251.c pc1350.c pc1401.c pc1403.c pc8801.c pc_aga.c pc_cga.c pc_mda.c pc_t1t.c pc_vga.c pc_vga.h pc_video.c pcw.c pmd85.c primo.c smsvdp.c ssystem3.c thomson.c thomson.h ti85.c vc4000.c vdc.c vectrex.c x68k.c z88.c zx.c |
| r1461 | r1462 | |
|---|---|---|
| 20 | 20 | { |
| 21 | 21 | COCOCART_LINE_CART, /* connects to PIA1 CB1 */ |
| 22 | 22 | COCOCART_LINE_NMI, /* connects to NMI line on CPU */ |
| 23 | COCOCART_LINE_HALT /* connects to HALT line on CPU */ | |
| 23 | COCOCART_LINE_HALT /* connects to HALT line on CPU */ | |
| 24 | 24 | } cococart_line; |
| 25 | 25 | |
| 26 | 26 | typedef enum _cococart_line_value |
| r1461 | r1462 | |
|---|---|---|
| 274 | 274 | /* opening an image */ |
| 275 | 275 | do |
| 276 | 276 | { |
| 277 | is_writable = image_is_writable(image); | |
| 277 | is_writable = image_is_writable(image); | |
| 278 | 278 | cassette_flags = is_writable ? (CASSETTE_FLAG_READWRITE|CASSETTE_FLAG_SAVEONEXIT) : CASSETTE_FLAG_READONLY; |
| 279 | 279 | extension = image_filetype(image); |
| 280 | 280 | err = cassette_open_choices(image, &mess_ioprocs, extension, formats, cassette_flags, &tag->cassette); |
| r1461 | r1462 | |
| 307 | 307 | static void device_unload_cassette(mess_image *image) |
| 308 | 308 | { |
| 309 | 309 | struct mess_cassetteimg *tag; |
| 310 | ||
| 310 | ||
| 311 | 311 | tag = get_cassimg(image); |
| 312 | 312 | |
| 313 | 313 | /* if we are recording, write the value to the image */ |
| r1461 | r1462 | |
|---|---|---|
| 372 | 372 | /* inform disk image of step operation so it can cache information */ |
| 373 | 373 | if (image_exists(img) && pDrive->interface_.seek_callback) |
| 374 | 374 | pDrive->interface_.seek_callback(img, pDrive->current_track); |
| 375 | ||
| 375 | ||
| 376 | 376 | pDrive->id_index = 0; |
| 377 | 377 | } |
| 378 | 378 |
| r1461 | r1462 | |
|---|---|---|
| 494 | 494 | { |
| 495 | 495 | int id; |
| 496 | 496 | device_unload_handler parent_unload; |
| 497 | ||
| 497 | ||
| 498 | 498 | id = image_index_in_device(image); |
| 499 | 499 | save_track_data(id); |
| 500 | 500 | memset(&sony_floppy[id], 0, sizeof(sony_floppy[id])); |
| r1461 | r1462 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | 3 | sonydriv.h |
| 4 | ||
| 4 | ||
| 5 | 5 | Apple/Sony 3.5" floppy drive emulation (to be interfaced with applefdc.c) |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| r1461 | r1462 | |
|---|---|---|
| 11 | 11 | uses the WD2797, however as this is a built in interface and not an external |
| 12 | 12 | cartrige, it is dealt with in the main coco.c file. |
| 13 | 13 | |
| 14 | The wd's variables are mapped to $FF48-$FF4B on the CoCo and on $FF40-$FF43 | |
| 14 | The wd's variables are mapped to $FF48-$FF4B on the CoCo and on $FF40-$FF43 | |
| 15 | 15 | on the Dragon. In addition, there is another register |
| 16 | 16 | called DSKREG that controls the interface with the wd1793. DSKREG is |
| 17 | 17 | detailed below: But they appear to be |
| r1461 | r1462 | |
| 41 | 41 | |
| 42 | 42 | --------------------------------------------------------------------------- |
| 43 | 43 | |
| 44 | 2007-02-22, P.Harvey-Smith | |
| 44 | 2007-02-22, P.Harvey-Smith | |
| 45 | 45 | |
| 46 | 46 | Began implementing the Dragon Delta Dos controler, this was actually the first |
| 47 | 47 | Dragon disk controler to market, beating Dragon Data's by a couple of months, |
| 48 | 48 | it is based around the WD2791 FDC, which is compatible with the WD1793/WD2797 used |
| 49 | 49 | by the standard CoCo and Dragon disk controlers except that it used an inverted |
| 50 | data bus, which is the reason the read/write handlers invert the data. This | |
| 50 | data bus, which is the reason the read/write handlers invert the data. This | |
| 51 | 51 | controler like, the DragonDos WD2797 is mapped at $FF40-$FF43, in the normal |
| 52 | 52 | register order. |
| 53 | ||
| 54 | The Delta cart also has a register (74LS174 hex flipflop) at $FF44 encoded as | |
| 53 | ||
| 54 | The Delta cart also has a register (74LS174 hex flipflop) at $FF44 encoded as | |
| 55 | 55 | follows :- |
| 56 | 56 | |
| 57 | 57 | Bit |
| 58 | 58 | 7 not used |
| 59 | 59 | 6 not used |
| 60 | 5 not used | |
| 61 | 4 Single (0) / Double (1) density select | |
| 60 | 5 not used | |
| 61 | 4 Single (0) / Double (1) density select | |
| 62 | 62 | 3 5.25"(0) / 8"(1) Clock select |
| 63 | 63 | 2 Side select |
| 64 | 64 | 1 Drive select ms bit |
| r1461 | r1462 | |
|---|---|---|
| 122 | 122 | mess_flopimg *flopimg; |
| 123 | 123 | int cylinder, sector, N; |
| 124 | 124 | UINT32 sector_length; |
| 125 | ||
| 125 | ||
| 126 | 126 | flopimg = get_flopimg(image); |
| 127 | 127 | if (!flopimg || !flopimg->floppy) |
| 128 | 128 | return; |
| r1461 | r1462 | |
| 161 | 161 | return; |
| 162 | 162 | |
| 163 | 163 | floppy_read_indexed_sector(flopimg->floppy, side, flopimg->track, index1, 0, ptr, length); |
| 164 | ||
| 164 | ||
| 165 | 165 | if (LOG_FLOPPY) |
| 166 | 166 | log_readwrite("sector_read", side, flopimg->track, index1, ptr, length); |
| 167 | 167 | } |
| r1461 | r1462 | |
| 306 | 306 | } |
| 307 | 307 | |
| 308 | 308 | /* if we can get head and track counts, then set the geometry accordingly */ |
| 309 | if (!flopimg_keep_geometry | |
| 309 | if (!flopimg_keep_geometry | |
| 310 | 310 | && floppy_callbacks(flopimg->floppy)->get_heads_per_disk |
| 311 | 311 | && floppy_callbacks(flopimg->floppy)->get_tracks_per_disk) |
| 312 | 312 | { |
| 313 | 313 | floppy_drive_set_geometry_absolute(image, |
| 314 | floppy_get_tracks_per_disk(flopimg->floppy), | |
| 314 | floppy_get_tracks_per_disk(flopimg->floppy), | |
| 315 | 315 | floppy_get_heads_per_disk(flopimg->floppy)); |
| 316 | 316 | } |
| 317 | 317 | return INIT_PASS; |
| r1461 | r1462 | |
| 382 | 382 | /************ |
| 383 | 383 | * Another hack for ti99: Drive track count may differ from medium track count. |
| 384 | 384 | * It is possible to insert a 40 track medium in an 80 track drive; the TI |
| 385 | * controllers read the track count from sector 0 and automatically | |
| 385 | * controllers read the track count from sector 0 and automatically | |
| 386 | 386 | * apply double steps. Setting the track count of the drive to the medium |
| 387 | 387 | * track count will lead to unreachable tracks. |
| 388 | * This function is called from 99_dsk.c to switch off the lines in | |
| 388 | * This function is called from 99_dsk.c to switch off the lines in | |
| 389 | 389 | * internal_floppy_device_load which set the drive geometry to the medium |
| 390 | 390 | * geometry. |
| 391 | 391 | *************/ |
| r1461 | r1462 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | 3 | appldriv.c |
| 4 | ||
| 4 | ||
| 5 | 5 | Apple 5.25" floppy drive emulation (to be interfaced with applefdc.c) |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| r1461 | r1462 | |
| 78 | 78 | int pseudo_track; |
| 79 | 79 | |
| 80 | 80 | apple525_save_current_track(img, FALSE); |
| 81 | ||
| 81 | ||
| 82 | 82 | track = floppy_drive_get_current_track(img); |
| 83 | 83 | pseudo_track = (track * 2) + disk->tween_tracks; |
| 84 | ||
| 84 | ||
| 85 | 85 | pseudo_track += step; |
| 86 | 86 | if (pseudo_track < 0) |
| 87 | 87 | pseudo_track = 0; |
| r1461 | r1462 | |
|---|---|---|
| 203 | 203 | pDisk->track_divider = track_skipping ? 2 : 1; |
| 204 | 204 | |
| 205 | 205 | floppy_drive_set_geometry_absolute(img, tracks * pDisk->track_divider, heads ); |
| 206 | ||
| 206 | ||
| 207 | 207 | pDisk->image_size = pDisk->tracks * pDisk->heads * pDisk->sec_per_track * pDisk->sector_length; |
| 208 | 208 | |
| 209 | 209 | /* setup a new ddam map */ |
| r1461 | r1462 | |
|---|---|---|
| 196 | 196 | WRITE8_HANDLER(coco_vhd_io_w) |
| 197 | 197 | { |
| 198 | 198 | int pos; |
| 199 | ||
| 199 | ||
| 200 | 200 | switch(offset) |
| 201 | 201 | { |
| 202 | 202 | case 0xff80 - 0xff40: |
| r1461 | r1462 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | 3 | appldriv.h |
| 4 | ||
| 4 | ||
| 5 | 5 | Apple 5.25" floppy drive emulation (to be interfaced with applefdc.c) |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| r1461 | r1462 | |
|---|---|---|
| 11 | 11 | |
| 12 | 12 | /* |
| 13 | 13 | * functions for the IODevice entry IO_PRINTER |
| 14 | * | |
| 15 | * Currently only a simple port which only supports status | |
| 14 | * | |
| 15 | * Currently only a simple port which only supports status | |
| 16 | 16 | * ("online/offline") and output of bytes is supported. |
| 17 | 17 | */ |
| 18 | 18 |
| r1461 | r1462 | |
|---|---|---|
| 83 | 83 | => at most 392 bytes / sector |
| 84 | 84 | => at most 6272 bytes / track |
| 85 | 85 | |
| 86 | Notes: | |
| 86 | Notes: | |
| 87 | 87 | - the BIOS puts 4E bytes as spaces after id and data fields |
| 88 | 88 | - some protected games expect F7 bytes (instead of 4E) after id fields |
| 89 | 89 | */ |
| r1461 | r1462 | |
| 97 | 97 | /* build an identifier, with header & space */ |
| 98 | 98 | static int thom_floppy_make_addr( chrn_id id, UINT8* dst, int sector_size ) |
| 99 | 99 | { |
| 100 | if ( sector_size == 128 ) | |
| 100 | if ( sector_size == 128 ) | |
| 101 | 101 | { |
| 102 | 102 | /* single density */ |
| 103 | 103 | memset( dst, 0x00, 6 ); /* synchro bytes */ |
| r1461 | r1462 | |
| 111 | 111 | memset( dst + 14, 0xff, 12 ); /* end mark */ |
| 112 | 112 | return 36; |
| 113 | 113 | } |
| 114 | else | |
| 114 | else | |
| 115 | 115 | { |
| 116 | 116 | /* double density */ |
| 117 | 117 | memset( dst, 0xa1, 3 ); /* synchro bytes */ |
| r1461 | r1462 | |
| 132 | 132 | /* build a sector, with header & space */ |
| 133 | 133 | static int thom_floppy_make_sector( mess_image* img, chrn_id id, UINT8* dst, int sector_size ) |
| 134 | 134 | { |
| 135 | if ( sector_size == 128 ) | |
| 135 | if ( sector_size == 128 ) | |
| 136 | 136 | { |
| 137 | 137 | /* single density */ |
| 138 | 138 | memset( dst, 0x00, 6 ); /* synchro bytes */ |
| r1461 | r1462 | |
| 144 | 144 | memset( dst + sector_size + 9, 0xff, 22 ); /* end mark */ |
| 145 | 145 | return sector_size + 31; |
| 146 | 146 | } |
| 147 | else | |
| 147 | else | |
| 148 | 148 | { |
| 149 | 149 | /* double density */ |
| 150 | 150 | memset( dst, 0xa1, 3 ); /* synchro bytes */ |
| r1461 | r1462 | |
| 169 | 169 | int nb; |
| 170 | 170 | |
| 171 | 171 | /* go to start of track */ |
| 172 | while ( ! floppy_drive_get_flag_state( img, FLOPPY_DRIVE_INDEX ) ) | |
| 172 | while ( ! floppy_drive_get_flag_state( img, FLOPPY_DRIVE_INDEX ) ) | |
| 173 | 173 | { |
| 174 | if ( ! floppy_drive_get_next_id( img, side, &id ) ) | |
| 174 | if ( ! floppy_drive_get_next_id( img, side, &id ) ) | |
| 175 | 175 | return 0; |
| 176 | 176 | } |
| 177 | 177 | |
| 178 | 178 | /* for each sector... */ |
| 179 | for ( nb = 0; nb < 16; nb++ ) | |
| 179 | for ( nb = 0; nb < 16; nb++ ) | |
| 180 | 180 | { |
| 181 | if ( ! floppy_drive_get_next_id( img, side, &id ) ) | |
| 181 | if ( ! floppy_drive_get_next_id( img, side, &id ) ) | |
| 182 | 182 | break; |
| 183 | 183 | |
| 184 | 184 | memset( dst, space, THOM_SIZE_SYNCHRO ); dst += THOM_SIZE_SYNCHRO; |
| r1461 | r1462 | |
| 186 | 186 | memset( dst, space, THOM_SIZE_SYNCHRO ); dst += THOM_SIZE_SYNCHRO; |
| 187 | 187 | dst += thom_floppy_make_sector( img, id, dst, sector_size ); |
| 188 | 188 | |
| 189 | if ( floppy_drive_get_flag_state( img, FLOPPY_DRIVE_INDEX ) ) | |
| 189 | if ( floppy_drive_get_flag_state( img, FLOPPY_DRIVE_INDEX ) ) | |
| 190 | 190 | break; |
| 191 | 191 | } |
| 192 | 192 | return dst - org; |
| r1461 | r1462 | |
| 258 | 258 | |
| 259 | 259 | memset( dst, 0x16, THOM_QDD_SYNCH_DISK ); dst += THOM_QDD_SYNCH_DISK; |
| 260 | 260 | |
| 261 | for ( i = 1; i <= 400; i++ ) | |
| 261 | for ( i = 1; i <= 400; i++ ) | |
| 262 | 262 | { |
| 263 | 263 | memset( dst, 0x16, THOM_QDD_SYNCH_ADDR ); dst += THOM_QDD_SYNCH_ADDR; |
| 264 | 264 | dst += thom_qdd_make_addr( i, dst ); |
| r1461 | r1462 | |
| 288 | 288 | |
| 289 | 289 | static READ8_HANDLER ( to7_5p14_r ) |
| 290 | 290 | { |
| 291 | if ( offset < 4 ) | |
| 291 | if ( offset < 4 ) | |
| 292 | 292 | return wd17xx_r( offset ); |
| 293 | else if ( offset == 8 ) | |
| 293 | else if ( offset == 8 ) | |
| 294 | 294 | return to7_5p14_select; |
| 295 | 295 | else |
| 296 | 296 | logerror ( "%f $%04x to7_5p14_r: invalid read offset %i\n", attotime_to_double(timer_get_time()), activecpu_get_previouspc(), offset ); |
| r1461 | r1462 | |
| 301 | 301 | |
| 302 | 302 | static WRITE8_HANDLER( to7_5p14_w ) |
| 303 | 303 | { |
| 304 | if ( offset < 4 ) | |
| 304 | if ( offset < 4 ) | |
| 305 | 305 | wd17xx_w( offset, data ); |
| 306 | else if ( offset == 8 ) | |
| 306 | else if ( offset == 8 ) | |
| 307 | 307 | { |
| 308 | 308 | /* drive select */ |
| 309 | 309 | int drive = -1, side = 0; |
| 310 | 310 | DENSITY dens; |
| 311 | ||
| 312 | switch ( data & 7 ) | |
| 311 | ||
| 312 | switch ( data & 7 ) | |
| 313 | 313 | { |
| 314 | 314 | case 0: break; |
| 315 | 315 | case 2: drive = 0; side = 0; break; |
| r1461 | r1462 | |
| 319 | 319 | default: |
| 320 | 320 | logerror( "%f $%04x to7_5p14_w: invalid drive select pattern $%02X\n", attotime_to_double(timer_get_time()), activecpu_get_previouspc(), data ); |
| 321 | 321 | } |
| 322 | ||
| 322 | ||
| 323 | 323 | dens = (data & 0x80) ? DEN_FM_LO : DEN_MFM_LO; |
| 324 | 324 | thom_floppy_set_density( dens ); |
| 325 | 325 | wd17xx_set_density( dens ); |
| 326 | ||
| 326 | ||
| 327 | 327 | to7_5p14_select = data; |
| 328 | 328 | |
| 329 | if ( drive != -1 ) | |
| 329 | if ( drive != -1 ) | |
| 330 | 330 | { |
| 331 | 331 | thom_floppy_active( 0 ); |
| 332 | 332 | wd17xx_set_drive( drive ); |
| 333 | 333 | wd17xx_set_side( side ); |
| 334 | LOG(( "%f $%04x to7_5p14_w: $%02X set drive=%i side=%i density=%s\n", | |
| 334 | LOG(( "%f $%04x to7_5p14_w: $%02X set drive=%i side=%i density=%s\n", | |
| 335 | 335 | attotime_to_double(timer_get_time()), activecpu_get_previouspc(), |
| 336 | 336 | data, drive, side, (dens == DEN_FM_LO) ? "FM" : "MFM" )); |
| 337 | 337 | } |
| 338 | 338 | } |
| 339 | 339 | else |
| 340 | logerror ( "%f $%04x to7_5p14_w: invalid write offset %i (data=$%02X)\n", | |
| 340 | logerror ( "%f $%04x to7_5p14_w: invalid write offset %i (data=$%02X)\n", | |
| 341 | 341 | attotime_to_double(timer_get_time()), activecpu_get_previouspc(), offset, data ); |
| 342 | 342 | } |
| 343 | 343 | |
| r1461 | r1462 | |
| 349 | 349 | LOG(( "to7_5p14_reset: CD 90-640 controller\n" )); |
| 350 | 350 | thom_floppy_set_density( DEN_MFM_LO ); |
| 351 | 351 | wd17xx_reset(); |
| 352 | for ( i = 0; i < device_count( IO_FLOPPY ); i++ ) | |
| 352 | for ( i = 0; i < device_count( IO_FLOPPY ); i++ ) | |
| 353 | 353 | { |
| 354 | 354 | mess_image * img = image_from_devtype_and_index( IO_FLOPPY, i ); |
| 355 | 355 | floppy_drive_set_ready_state( img, FLOPPY_DRIVE_READY, 0 ); |
| r1461 | r1462 | |
| 385 | 385 | |
| 386 | 386 | static READ8_HANDLER ( to7_5p14sd_r ) |
| 387 | 387 | { |
| 388 | if ( offset < 8 ) | |
| 388 | if ( offset < 8 ) | |
| 389 | 389 | return mc6843_r( offset ); |
| 390 | else if ( offset >= 8 && offset <= 9 ) | |
| 390 | else if ( offset >= 8 && offset <= 9 ) | |
| 391 | 391 | return to7_5p14sd_select; |
| 392 | 392 | else |
| 393 | 393 | logerror ( "%f $%04x to7_5p14sd_r: invalid read offset %i\n", attotime_to_double(timer_get_time()), activecpu_get_previouspc(), offset ); |
| r1461 | r1462 | |
| 398 | 398 | |
| 399 | 399 | static WRITE8_HANDLER( to7_5p14sd_w ) |
| 400 | 400 | { |
| 401 | if ( offset < 8 ) | |
| 401 | if ( offset < 8 ) | |
| 402 | 402 | mc6843_w( offset, data ); |
| 403 | else if ( offset >= 8 && offset <= 9 ) | |
| 403 | else if ( offset >= 8 && offset <= 9 ) | |
| 404 | 404 | { |
| 405 | 405 | /* drive select */ |
| 406 | 406 | int drive = -1, side = 0; |
| 407 | ||
| 408 | if ( data & 1 ) | |
| 409 | { | |
| 410 | drive = 0; | |
| 411 | side = 0; | |
| 407 | ||
| 408 | if ( data & 1 ) | |
| 409 | { | |
| 410 | drive = 0; | |
| 411 | side = 0; | |
| 412 | 412 | } |
| 413 | else if ( data & 2 ) | |
| 414 | { | |
| 415 | drive = 1; | |
| 416 | side = 1; | |
| 413 | else if ( data & 2 ) | |
| 414 | { | |
| 415 | drive = 1; | |
| 416 | side = 1; | |
| 417 | 417 | } |
| 418 | else if ( data & 4 ) | |
| 419 | { | |
| 420 | drive = 2; | |
| 421 | side = 0; | |
| 418 | else if ( data & 4 ) | |
| 419 | { | |
| 420 | drive = 2; | |
| 421 | side = 0; | |
| 422 | 422 | } |
| 423 | else if ( data & 8 ) | |
| 424 | { | |
| 425 | drive = 3; | |
| 426 | side = 1; | |
| 423 | else if ( data & 8 ) | |
| 424 | { | |
| 425 | drive = 3; | |
| 426 | side = 1; | |
| 427 | 427 | } |
| 428 | 428 | |
| 429 | 429 | to7_5p14sd_select = data; |
| 430 | 430 | |
| 431 | if ( drive != -1 ) | |
| 431 | if ( drive != -1 ) | |
| 432 | 432 | { |
| 433 | 433 | thom_floppy_active( 0 ); |
| 434 | 434 | mc6843_set_drive( drive ); |
| 435 | 435 | mc6843_set_side( side ); |
| 436 | LOG(( "%f $%04x to7_5p14sd_w: $%02X set drive=%i side=%i\n", | |
| 436 | LOG(( "%f $%04x to7_5p14sd_w: $%02X set drive=%i side=%i\n", | |
| 437 | 437 | attotime_to_double(timer_get_time()), activecpu_get_previouspc(), data, drive, side )); |
| 438 | 438 | } |
| 439 | 439 | } |
| 440 | 440 | else |
| 441 | logerror ( "%f $%04x to7_5p14sd_w: invalid write offset %i (data=$%02X)\n", | |
| 441 | logerror ( "%f $%04x to7_5p14sd_w: invalid write offset %i (data=$%02X)\n", | |
| 442 | 442 | attotime_to_double(timer_get_time()), activecpu_get_previouspc(), offset, data ); |
| 443 | 443 | } |
| 444 | 444 | |
| r1461 | r1462 | |
| 450 | 450 | LOG(( "to7_5p14sd_reset: CD 90-015 controller\n" )); |
| 451 | 451 | thom_floppy_set_density( DEN_FM_LO ); |
| 452 | 452 | mc6843_reset(); |
| 453 | for ( i = 0; i < device_count( IO_FLOPPY ); i++ ) | |
| 453 | for ( i = 0; i < device_count( IO_FLOPPY ); i++ ) | |
| 454 | 454 | { |
| 455 | 455 | mess_image * img = image_from_devtype_and_index( IO_FLOPPY, i ); |
| 456 | 456 | floppy_drive_set_ready_state( img, FLOPPY_DRIVE_READY, 0 ); |
| r1461 | r1462 | |
| 479 | 479 | used in TO7, TO7/70, MO5 computers |
| 480 | 480 | it is based on a MC6852 SSDA |
| 481 | 481 | |
| 482 | Note: the MC6852 is only partially emulated, most features are not used in | |
| 482 | Note: the MC6852 is only partially emulated, most features are not used in | |
| 483 | 483 | the controller and are ignored. |
| 484 | 484 | */ |
| 485 | 485 | |
| r1461 | r1462 | |
| 517 | 517 | #define QDD_MAXBUF ( THOM_QDD_SIZE_ID + THOM_QDD_SIZE_DATA ) * 512 |
| 518 | 518 | |
| 519 | 519 | |
| 520 | static struct | |
| 520 | static struct | |
| 521 | 521 | { |
| 522 | 522 | /* MC6852 registers */ |
| 523 | 523 | UINT8 status; |
| r1461 | r1462 | |
| 544 | 544 | { |
| 545 | 545 | to7qdd->index_pulse = state; |
| 546 | 546 | |
| 547 | if ( state ) | |
| 547 | if ( state ) | |
| 548 | 548 | { |
| 549 | 549 | /* rewind to disk start */ |
| 550 | 550 | to7qdd->data_idx = 0; |
| r1461 | r1462 | |
| 571 | 571 | |
| 572 | 572 | /* byte-ready */ |
| 573 | 573 | to7qdd->status |= QDD_S_RDA | QDD_S_TDRA; |
| 574 | if ( ! to7qdd->drive ) | |
| 574 | if ( ! to7qdd->drive ) | |
| 575 | 575 | to7qdd->status |= QDD_S_PE; |
| 576 | 576 | |
| 577 | 577 | /* write-protect */ |
| 578 | if ( flags & FLOPPY_DRIVE_DISK_WRITE_PROTECTED ) | |
| 578 | if ( flags & FLOPPY_DRIVE_DISK_WRITE_PROTECTED ) | |
| 579 | 579 | to7qdd->status |= QDD_S_NCTS; |
| 580 | 580 | |
| 581 | 581 | /* sticky reset conditions */ |
| 582 | if ( to7qdd->ctrl1 & QDD_C1_RRESET ) | |
| 582 | if ( to7qdd->ctrl1 & QDD_C1_RRESET ) | |
| 583 | 583 | to7qdd->status &= ~(QDD_S_PE | QDD_S_RDA | QDD_S_OVR); |
| 584 | if ( to7qdd->ctrl1 & QDD_C1_TRESET ) | |
| 584 | if ( to7qdd->ctrl1 & QDD_C1_TRESET ) | |
| 585 | 585 | to7qdd->status &= ~(QDD_S_TDRA | QDD_S_TUF); |
| 586 | ||
| 586 | ||
| 587 | 587 | /* irq update */ |
| 588 | 588 | |
| 589 | 589 | if ( ( (to7qdd->ctrl1 & QDD_C1_RIE) && !(to7qdd->status & QDD_S_RDA ) ) || |
| r1461 | r1462 | |
| 602 | 602 | static UINT8 to7_qdd_read_byte( void ) |
| 603 | 603 | { |
| 604 | 604 | UINT8 data; |
| 605 | ||
| 605 | ||
| 606 | 606 | /* rebuild disk if needed */ |
| 607 | if ( !to7qdd->data_size ) | |
| 607 | if ( !to7qdd->data_size ) | |
| 608 | 608 | { |
| 609 | 609 | to7qdd->data_size = thom_qdd_make_disk( to7_qdd_image(), to7qdd->data ); |
| 610 | 610 | assert( to7qdd->data_idx < sizeof( to7qdd->data ) ); |
| 611 | 611 | } |
| 612 | ||
| 613 | if ( to7qdd->data_idx >= to7qdd->data_size ) | |
| 612 | ||
| 613 | if ( to7qdd->data_idx >= to7qdd->data_size ) | |
| 614 | 614 | data = 0; |
| 615 | else | |
| 615 | else | |
| 616 | 616 | data = to7qdd->data[ to7qdd->data_idx ]; |
| 617 | ||
| 618 | VLOG(( "%f $%04x to7_qdd_read_byte: RDATA off=%i/%i data=$%02X\n", | |
| 619 | attotime_to_double(timer_get_time()), activecpu_get_previouspc(), | |
| 617 | ||
| 618 | VLOG(( "%f $%04x to7_qdd_read_byte: RDATA off=%i/%i data=$%02X\n", | |
| 619 | attotime_to_double(timer_get_time()), activecpu_get_previouspc(), | |
| 620 | 620 | to7qdd->data_idx, to7qdd->data_size, data )); |
| 621 | ||
| 621 | ||
| 622 | 622 | to7qdd->data_idx++; |
| 623 | 623 | to7qdd->start_idx = to7qdd->data_idx; |
| 624 | ||
| 624 | ||
| 625 | 625 | return data; |
| 626 | 626 | } |
| 627 | 627 | |
| r1461 | r1462 | |
| 637 | 637 | int i; |
| 638 | 638 | |
| 639 | 639 | /* rebuild disk if needed */ |
| 640 | if ( !to7qdd->data_size ) | |
| 640 | if ( !to7qdd->data_size ) | |
| 641 | 641 | { |
| 642 | 642 | to7qdd->data_size = thom_qdd_make_disk( to7_qdd_image(), to7qdd->data ); |
| 643 | 643 | assert( to7qdd->data_idx < sizeof( to7qdd->data ) ); |
| r1461 | r1462 | |
| 647 | 647 | data==0xA5 || data==0x5A ) && /* first byte of tentative field */ |
| 648 | 648 | to7qdd->data_idx <to7qdd->data_size ) |
| 649 | 649 | { |
| 650 | ||
| 650 | ||
| 651 | 651 | /* this is the first byte of the field */ |
| 652 | if ( to7qdd->start_idx == to7qdd->data_idx ) | |
| 652 | if ( to7qdd->start_idx == to7qdd->data_idx ) | |
| 653 | 653 | to7qdd->data_crc = 0; |
| 654 | ||
| 654 | ||
| 655 | 655 | /* accumulate bytes */ |
| 656 | 656 | to7qdd->data[ to7qdd->data_idx ] = data; |
| 657 | 657 | to7qdd->data_idx++; |
| 658 | ||
| 659 | VLOG (( "%f $%04x to7_qdd_write_byte: got $%02X offs=%i-%i\n", | |
| 658 | ||
| 659 | VLOG (( "%f $%04x to7_qdd_write_byte: got $%02X offs=%i-%i\n", | |
| 660 | 660 | attotime_to_double(timer_get_time()), activecpu_get_previouspc(), data, |
| 661 | 661 | to7qdd->start_idx, to7qdd->data_idx )); |
| 662 | ||
| 662 | ||
| 663 | 663 | /* end of tentative id field */ |
| 664 | 664 | if ( to7qdd->data_idx == to7qdd->start_idx + 4 && |
| 665 | to7qdd->data[ to7qdd->start_idx ] == 0xA5 && | |
| 666 | to7qdd->data[ to7qdd->start_idx + 3 ] == to7qdd->data_crc ) | |
| 665 | to7qdd->data[ to7qdd->start_idx ] == 0xA5 && | |
| 666 | to7qdd->data[ to7qdd->start_idx + 3 ] == to7qdd->data_crc ) | |
| 667 | 667 | { |
| 668 | ||
| 668 | ||
| 669 | 669 | /* got an id field => format */ |
| 670 | 670 | int sector = (int) to7qdd->data[ to7qdd->start_idx + 1 ] * 256 + (int) to7qdd->data[ to7qdd->start_idx + 2 ]; |
| 671 | 671 | UINT8 filler = 0xff; |
| 672 | ||
| 673 | LOG(( "%f $%04x to7_qdd_write_byte: got id field for sector=%i\n", | |
| 672 | ||
| 673 | LOG(( "%f $%04x to7_qdd_write_byte: got id field for sector=%i\n", | |
| 674 | 674 | attotime_to_double(timer_get_time()), activecpu_get_previouspc(), sector )); |
| 675 | ||
| 675 | ||
| 676 | 676 | floppy_drive_format_sector( to7_qdd_image(), |
| 677 | 677 | 0, sector, 0, 0, sector, 128, filler ); |
| 678 | 678 | to7qdd->start_idx = to7qdd->data_idx; |
| 679 | 679 | } |
| 680 | ||
| 680 | ||
| 681 | 681 | /* end of tentative data field */ |
| 682 | 682 | else if ( to7qdd->data_idx == to7qdd->start_idx + 130 && |
| 683 | to7qdd->data[ to7qdd->start_idx ] == 0x5A && | |
| 684 | to7qdd->data[ to7qdd->start_idx + 129 ] == to7qdd->data_crc ) | |
| 683 | to7qdd->data[ to7qdd->start_idx ] == 0x5A && | |
| 684 | to7qdd->data[ to7qdd->start_idx + 129 ] == to7qdd->data_crc ) | |
| 685 | 685 | { |
| 686 | ||
| 686 | ||
| 687 | 687 | /* look backwards for previous id field */ |
| 688 | 688 | for ( i = to7qdd->start_idx - 3; i >= 0; i-- ) |
| 689 | 689 | { |
| 690 | 690 | if ( to7qdd->data[ i ] == 0xA5 && |
| 691 | ( ( to7qdd->data[ i ] + to7qdd->data[ i + 1 ] + | |
| 692 | to7qdd->data[ i + 2 ] ) & 0xff | |
| 691 | ( ( to7qdd->data[ i ] + to7qdd->data[ i + 1 ] + | |
| 692 | to7qdd->data[ i + 2 ] ) & 0xff | |
| 693 | 693 | ) == to7qdd->data[ i + 3 ] ) |
| 694 | 694 | break; |
| 695 | 695 | } |
| 696 | ||
| 697 | if ( i >= 0 ) | |
| 696 | ||
| 697 | if ( i >= 0 ) | |
| 698 | 698 | { |
| 699 | 699 | /* got an id & a data field => write */ |
| 700 | 700 | int sector = (int) to7qdd->data[ i + 1 ] * 256 + (int) to7qdd->data[ i + 2 ]; |
| 701 | ||
| 702 | LOG(( "%f $%04x to7_qdd_write_byte: goto data field for sector=%i\n", | |
| 701 | ||
| 702 | LOG(( "%f $%04x to7_qdd_write_byte: goto data field for sector=%i\n", | |
| 703 | 703 | attotime_to_double(timer_get_time()), activecpu_get_previouspc(), sector )); |
| 704 | ||
| 704 | ||
| 705 | 705 | floppy_drive_write_sector_data( to7_qdd_image(), 0, sector, to7qdd->data + to7qdd->start_idx + 1, 128, 0 ); |
| 706 | 706 | } |
| 707 | ||
| 707 | ||
| 708 | 708 | to7qdd->start_idx = to7qdd->data_idx; |
| 709 | 709 | } |
| 710 | ||
| 710 | ||
| 711 | 711 | else to7qdd->data_crc += data; |
| 712 | 712 | } |
| 713 | 713 | } |
| r1461 | r1462 | |
| 716 | 716 | |
| 717 | 717 | static READ8_HANDLER ( to7_qdd_r ) |
| 718 | 718 | { |
| 719 | switch ( offset ) | |
| 719 | switch ( offset ) | |
| 720 | 720 | { |
| 721 | 721 | |
| 722 | 722 | case 0: /* MC6852 status */ |
| r1461 | r1462 | |
| 738 | 738 | return to7_qdd_read_byte(); |
| 739 | 739 | |
| 740 | 740 | case 8: /* floppy status */ |
| 741 | { | |
| 741 | { | |
| 742 | 742 | UINT8 data = 0; |
| 743 | 743 | mess_image* img = to7_qdd_image(); |
| 744 | if ( ! image_exists( img ) ) | |
| 744 | if ( ! image_exists( img ) ) | |
| 745 | 745 | data |= 0x40; /* disk present */ |
| 746 | if ( to7qdd->index_pulse ) | |
| 746 | if ( to7qdd->index_pulse ) | |
| 747 | 747 | data |= 0x80; /* disk start */ |
| 748 | 748 | VLOG(( "%f $%04x to7_qdd_r: STATUS8 $%02X\n", attotime_to_double(timer_get_time()), activecpu_get_previouspc(), data )); |
| 749 | 749 | return data; |
| 750 | 750 | } |
| 751 | ||
| 751 | ||
| 752 | 752 | default: |
| 753 | 753 | logerror ( "%f $%04x to7_qdd_r: invalid read offset %i\n", attotime_to_double(timer_get_time()), activecpu_get_previouspc(), offset ); |
| 754 | 754 | return 0; |
| r1461 | r1462 | |
| 759 | 759 | |
| 760 | 760 | static WRITE8_HANDLER( to7_qdd_w ) |
| 761 | 761 | { |
| 762 | switch ( offset ) | |
| 762 | switch ( offset ) | |
| 763 | 763 | { |
| 764 | ||
| 764 | ||
| 765 | 765 | case 0: /* MC6852 control 1 */ |
| 766 | 766 | /* reset */ |
| 767 | if ( data & QDD_C1_RRESET ) | |
| 767 | if ( data & QDD_C1_RRESET ) | |
| 768 | 768 | to7qdd->status &= ~(QDD_S_PE | QDD_S_RDA | QDD_S_OVR); |
| 769 | if ( data & QDD_C1_TRESET ) | |
| 769 | if ( data & QDD_C1_TRESET ) | |
| 770 | 770 | to7qdd->status &= ~(QDD_S_TDRA | QDD_S_TUF); |
| 771 | 771 | |
| 772 | 772 | to7qdd->ctrl1 = ( data & ~(QDD_C1_RRESET | QDD_C1_TRESET) ) |( data & (QDD_C1_RRESET | QDD_C1_TRESET) & to7qdd->ctrl1 ); |
| r1461 | r1462 | |
| 776 | 776 | data & QDD_C1_RRESET ? 'r' : '-', data & QDD_C1_TRESET ? 't' : '-', |
| 777 | 777 | data & QDD_C1_STRIPSYNC ? "strip-sync " : "", |
| 778 | 778 | data & QDD_C1_CLRSYNC ? "clear-sync " : "", |
| 779 | data & QDD_C1_RIE ? 'r' : '-', | |
| 779 | data & QDD_C1_RIE ? 'r' : '-', | |
| 780 | 780 | data & QDD_C1_TIE ? 't' : '-' )); |
| 781 | 781 | break; |
| 782 | ||
| 782 | ||
| 783 | 783 | case 1: |
| 784 | switch ( to7qdd->ctrl1 >> 6 ) | |
| 784 | switch ( to7qdd->ctrl1 >> 6 ) | |
| 785 | 785 | { |
| 786 | ||
| 786 | ||
| 787 | 787 | case 0: /* MC6852 control 2 */ |
| 788 | { | |
| 788 | { | |
| 789 | 789 | #if 0 |
| 790 | 790 | /* most of these are unused now */ |
| 791 | 791 | static const int bit[8] = { 6, 6, 7, 8, 7, 7, 8, 8 }; |
| r1461 | r1462 | |
| 804 | 804 | to7qdd->ctrl2 = data; |
| 805 | 805 | break; |
| 806 | 806 | } |
| 807 | ||
| 807 | ||
| 808 | 808 | case 1: /* MC6852 control 3 */ |
| 809 | 809 | to7qdd->ctrl3 = data; |
| 810 | 810 | /* reset just once each write, not sticky */ |
| 811 | if ( data & QDD_C3_CLRTUF ) | |
| 811 | if ( data & QDD_C3_CLRTUF ) | |
| 812 | 812 | to7qdd->status &= ~QDD_S_TUF; |
| 813 | if ( data & QDD_C3_CLRCTS ) | |
| 813 | if ( data & QDD_C3_CLRCTS ) | |
| 814 | 814 | to7qdd->status &= ~QDD_S_NCTS; |
| 815 | 815 | to7_qdd_stat_update(); |
| 816 | 816 | VLOG(( "%f $%04x to7_qdd_w: CTRL3=$%02X %s%ssync-len=%i sync-mode=%s\n", |
| r1461 | r1462 | |
| 856 | 856 | |
| 857 | 857 | thom_floppy_set_density( DEN_MFM_LO ); |
| 858 | 858 | |
| 859 | for ( i = 0; i < device_count( IO_FLOPPY ); i++ ) | |
| 859 | for ( i = 0; i < device_count( IO_FLOPPY ); i++ ) | |
| 860 | 860 | { |
| 861 | 861 | mess_image * img = image_from_devtype_and_index( IO_FLOPPY, i ); |
| 862 | 862 | floppy_drive_set_index_pulse_callback( img, to7_qdd_index_pulse_cb ); |
| r1461 | r1462 | |
| 925 | 925 | #define THOM_MAXBUF ( THOM_QDD_SIZE_ID + THOM_QDD_SIZE_DATA ) * 512 |
| 926 | 926 | |
| 927 | 927 | |
| 928 | static struct | |
| 928 | static struct | |
| 929 | 929 | { |
| 930 | 930 | |
| 931 | 931 | UINT8 op; |
| r1461 | r1462 | |
| 971 | 971 | |
| 972 | 972 | static void thmfc_floppy_index_pulse_cb ( mess_image *img, int state ) |
| 973 | 973 | { |
| 974 | if ( img != thmfc_floppy_image() ) | |
| 974 | if ( img != thmfc_floppy_image() ) | |
| 975 | 975 | return; |
| 976 | 976 | |
| 977 | if ( thmfc_floppy_is_qdd() ) | |
| 977 | if ( thmfc_floppy_is_qdd() ) | |
| 978 | 978 | { |
| 979 | 979 | /* pulse each time the whole-disk spiraling track ends */ |
| 980 | 980 | floppy_drive_set_rpm( img, 423. / 25. ); |
| 981 | 981 | thmfc1->ipl = state; |
| 982 | if ( state ) | |
| 982 | if ( state ) | |
| 983 | 983 | { |
| 984 | 984 | thmfc1->data_raw_size = 0; |
| 985 | 985 | thmfc1->data_raw_idx = 0; |
| 986 | 986 | thmfc1->data_idx = 0; |
| 987 | 987 | } |
| 988 | 988 | } |
| 989 | else | |
| 989 | else | |
| 990 | 990 | { |
| 991 | 991 | floppy_drive_set_rpm( img, 300. ); |
| 992 | 992 | thmfc1->ipl = state; |
| 993 | if ( state ) | |
| 993 | if ( state ) | |
| 994 | 994 | thmfc1->data_raw_idx = 0; |
| 995 | 995 | } |
| 996 | 996 | |
| r1461 | r1462 | |
| 1006 | 1006 | int r = 0; |
| 1007 | 1007 | |
| 1008 | 1008 | /* scan track, try 4 revolutions */ |
| 1009 | while ( r < 4 ) | |
| 1009 | while ( r < 4 ) | |
| 1010 | 1010 | { |
| 1011 | 1011 | |
| 1012 | if ( floppy_drive_get_next_id( img, thmfc1->side, &id ) ) | |
| 1012 | if ( floppy_drive_get_next_id( img, thmfc1->side, &id ) ) | |
| 1013 | 1013 | { |
| 1014 | 1014 | if ( id.C == thmfc1->track && |
| 1015 | 1015 | id.R == thmfc1->sector && |
| 1016 | 1016 | (128 << id.N) == thmfc1->sector_size |
| 1017 | /* check side ? id.H == thmfc1->side */ ) | |
| 1017 | /* check side ? id.H == thmfc1->side */ ) | |
| 1018 | 1018 | { |
| 1019 | if ( dst ) | |
| 1019 | if ( dst ) | |
| 1020 | 1020 | memcpy( dst, &id, sizeof( chrn_id ) ); |
| 1021 | 1021 | thmfc1->stat0 = THMFC1_STAT0_BYTE_READY_POL; |
| 1022 | 1022 | LOG (( "thmfc_floppy_find_sector: sector found C=%i H=%i R=%i N=%i\n", id.C, id.H, id.R, id.N )); |
| r1461 | r1462 | |
| 1024 | 1024 | } |
| 1025 | 1025 | } |
| 1026 | 1026 | |
| 1027 | if ( floppy_drive_get_flag_state( img, FLOPPY_DRIVE_INDEX ) ) | |
| 1027 | if ( floppy_drive_get_flag_state( img, FLOPPY_DRIVE_INDEX ) ) | |
| 1028 | 1028 | r++; |
| 1029 | 1029 | } |
| 1030 | 1030 | |
| r1461 | r1462 | |
| 1038 | 1038 | /* complete command (by read, write, or timeout) */ |
| 1039 | 1039 | static void thmfc_floppy_cmd_complete(void) |
| 1040 | 1040 | { |
| 1041 | LOG (( "%f thmfc_floppy_cmd_complete_cb: cmd=%i off=%i/%i/%i\n", | |
| 1042 | attotime_to_double(timer_get_time()), thmfc1->op, thmfc1->data_idx, | |
| 1041 | LOG (( "%f thmfc_floppy_cmd_complete_cb: cmd=%i off=%i/%i/%i\n", | |
| 1042 | attotime_to_double(timer_get_time()), thmfc1->op, thmfc1->data_idx, | |
| 1043 | 1043 | thmfc1->data_finish - 1, thmfc1->data_size - 1 )); |
| 1044 | 1044 | |
| 1045 | if ( thmfc1->op == THMFC1_OP_WRITE_SECT ) | |
| 1045 | if ( thmfc1->op == THMFC1_OP_WRITE_SECT ) | |
| 1046 | 1046 | { |
| 1047 | 1047 | /* TODO: detect ddam (?) */ |
| 1048 | 1048 | mess_image * img = thmfc_floppy_image(); |
| r1461 | r1462 | |
| 1068 | 1068 | static UINT8 thmfc_floppy_read_byte ( void ) |
| 1069 | 1069 | { |
| 1070 | 1070 | UINT8 data = thmfc1->data[ thmfc1->data_idx ]; |
| 1071 | ||
| 1072 | VLOG(( "%f $%04x thmfc_floppy_read_byte: off=%i/%i/%i data=$%02X\n", | |
| 1073 | attotime_to_double(timer_get_time()), activecpu_get_previouspc(), | |
| 1074 | thmfc1->data_idx, thmfc1->data_finish - 1, thmfc1->data_size - 1, | |
| 1071 | ||
| 1072 | VLOG(( "%f $%04x thmfc_floppy_read_byte: off=%i/%i/%i data=$%02X\n", | |
| 1073 | attotime_to_double(timer_get_time()), activecpu_get_previouspc(), | |
| 1074 | thmfc1->data_idx, thmfc1->data_finish - 1, thmfc1->data_size - 1, | |
| 1075 | 1075 | data )); |
| 1076 | ||
| 1076 | ||
| 1077 | 1077 | if ( thmfc1->data_idx >= thmfc1->data_size - 1 ) |
| 1078 | 1078 | thmfc_floppy_cmd_complete(); |
| 1079 | else | |
| 1079 | else | |
| 1080 | 1080 | thmfc1->data_idx++; |
| 1081 | 1081 | |
| 1082 | 1082 | if ( thmfc1->data_idx >= thmfc1->data_finish ) |
| 1083 | 1083 | thmfc1->stat0 |= THMFC1_STAT0_FINISHED; |
| 1084 | ||
| 1084 | ||
| 1085 | 1085 | return data; |
| 1086 | 1086 | } |
| 1087 | 1087 | |
| r1461 | r1462 | |
| 1091 | 1091 | static UINT8 thmfc_floppy_raw_read_byte ( void ) |
| 1092 | 1092 | { |
| 1093 | 1093 | UINT8 data; |
| 1094 | ||
| 1094 | ||
| 1095 | 1095 | /* rebuild track if needed */ |
| 1096 | 1096 | if ( ! thmfc1->data_raw_size ) |
| 1097 | 1097 | { |
| 1098 | 1098 | if ( thmfc_floppy_is_qdd() ) |
| 1099 | 1099 | /* QDD: track = whole disk */ |
| 1100 | 1100 | thmfc1->data_raw_size = thom_qdd_make_disk ( thmfc_floppy_image(), thmfc1->data ); |
| 1101 | else | |
| 1101 | else | |
| 1102 | 1102 | { |
| 1103 | 1103 | thmfc1->data_raw_idx = 0; |
| 1104 | thmfc1->data_raw_size = thom_floppy_make_track( thmfc_floppy_image(), thmfc1->data, | |
| 1104 | thmfc1->data_raw_size = thom_floppy_make_track( thmfc_floppy_image(), thmfc1->data, | |
| 1105 | 1105 | thmfc1->sector_size, thmfc1->side ); |
| 1106 | 1106 | } |
| 1107 | 1107 | assert( thmfc1->data_raw_size < sizeof( thmfc1->data ) ); |
| 1108 | 1108 | } |
| 1109 | ||
| 1110 | if ( thmfc1->data_raw_idx >= thmfc1->data_raw_size ) | |
| 1109 | ||
| 1110 | if ( thmfc1->data_raw_idx >= thmfc1->data_raw_size ) | |
| 1111 | 1111 | data = 0; |
| 1112 | else | |
| 1112 | else | |
| 1113 | 1113 | data = thmfc1->data[ thmfc1->data_raw_idx ]; |
| 1114 | 1114 | |
| 1115 | VLOG(( "%f $%04x thmfc_floppy_raw_read_byte: off=%i/%i data=$%02X\n", | |
| 1116 | attotime_to_double(timer_get_time()), activecpu_get_previouspc(), | |
| 1115 | VLOG(( "%f $%04x thmfc_floppy_raw_read_byte: off=%i/%i data=$%02X\n", | |
| 1116 | attotime_to_double(timer_get_time()), activecpu_get_previouspc(), | |
| 1117 | 1117 | thmfc1->data_raw_idx, thmfc1->data_raw_size, data )); |
| 1118 | ||
| 1118 | ||
| 1119 | 1119 | thmfc1->data_raw_idx++; |
| 1120 | ||
| 1120 | ||
| 1121 | 1121 | return data; |
| 1122 | } | |
| 1122 | } | |
| 1123 | 1123 | |
| 1124 | 1124 | |
| 1125 | 1125 | |
| r1461 | r1462 | |
| 1128 | 1128 | { |
| 1129 | 1129 | int i; |
| 1130 | 1130 | |
| 1131 | if ( thmfc1->formatting && | |
| 1132 | ( thmfc1->data_idx || data==0xA5 || data==0x5A ) && | |
| 1133 | thmfc1->data_raw_idx < THOM_MAXBUF ) | |
| 1131 | if ( thmfc1->formatting && | |
| 1132 | ( thmfc1->data_idx || data==0xA5 || data==0x5A ) && | |
| 1133 | thmfc1->data_raw_idx < THOM_MAXBUF ) | |
| 1134 | 1134 | { |
| 1135 | ||
| 1136 | if ( ! thmfc1->data_raw_size ) | |
| 1135 | ||
| 1136 | if ( ! thmfc1->data_raw_size ) | |
| 1137 | 1137 | { |
| 1138 | 1138 | thmfc1->data_raw_size = thom_qdd_make_disk ( thmfc_floppy_image(), thmfc1->data ); |
| 1139 | 1139 | assert( thmfc1->data_raw_size < sizeof( thmfc1->data ) ); |
| 1140 | 1140 | } |
| 1141 | ||
| 1141 | ||
| 1142 | 1142 | /* accumulate bytes to form a field */ |
| 1143 | 1143 | thmfc1->data[ thmfc1->data_raw_idx ] = data; |
| 1144 | 1144 | thmfc1->data_raw_idx++; |
| 1145 | ||
| 1146 | if ( ! thmfc1->data_idx ) | |
| 1147 | { | |
| 1145 | ||
| 1146 | if ( ! thmfc1->data_idx ) | |
| 1147 | { | |
| 1148 | 1148 | /* start */ |
| 1149 | 1149 | thmfc1->data_crc = 0; |
| 1150 | 1150 | thmfc1->data_idx = thmfc1->data_raw_idx; |
| 1151 | 1151 | } |
| 1152 | ||
| 1153 | VLOG (( "%f $%04x thmfc_floppy_qdd_write_byte: $%02X offs=%i-%i\n", | |
| 1152 | ||
| 1153 | VLOG (( "%f $%04x thmfc_floppy_qdd_write_byte: $%02X offs=%i-%i\n", | |
| 1154 | 1154 | attotime_to_double(timer_get_time()), activecpu_get_previouspc(), data, |
| 1155 | 1155 | thmfc1->data_idx,thmfc1->data_raw_idx )); |
| 1156 | ||
| 1156 | ||
| 1157 | 1157 | if ( thmfc1->data_raw_idx == thmfc1->data_idx + 3 && |
| 1158 | thmfc1->data[ thmfc1->data_idx - 1 ] == 0xA5 && | |
| 1159 | thmfc1->data[ thmfc1->data_idx + 2 ] == thmfc1->data_crc ) | |
| 1158 | thmfc1->data[ thmfc1->data_idx - 1 ] == 0xA5 && | |
| 1159 | thmfc1->data[ thmfc1->data_idx + 2 ] == thmfc1->data_crc ) | |
| 1160 | 1160 | { |
| 1161 | ||
| 1161 | ||
| 1162 | 1162 | /* got an id field => format */ |
| 1163 | 1163 | int sector = (int) thmfc1->data[ thmfc1->data_idx ] * 256 + (int) thmfc1->data[ thmfc1->data_idx + 1 ]; |
| 1164 | 1164 | UINT8 filler = 0xff; |
| 1165 | ||
| 1165 | ||
| 1166 | 1166 | LOG(( "%f $%04x thmfc_floppy_qdd_write_byte: id field, sector=%i\n", attotime_to_double(timer_get_time()), activecpu_get_previouspc(), sector )); |
| 1167 | ||
| 1167 | ||
| 1168 | 1168 | floppy_drive_format_sector( thmfc_floppy_image(), 0, sector, 0, 0, sector, 128, filler ); |
| 1169 | 1169 | thmfc1->data_idx = 0; |
| 1170 | 1170 | } |
| 1171 | ||
| 1171 | ||
| 1172 | 1172 | else if ( thmfc1->data_raw_idx == thmfc1->data_idx + 129 && |
| 1173 | thmfc1->data[ thmfc1->data_idx - 1 ] == 0x5A && | |
| 1174 | thmfc1->data[ thmfc1->data_idx + 128 ] == thmfc1->data_crc ) | |
| 1173 | thmfc1->data[ thmfc1->data_idx - 1 ] == 0x5A && | |
| 1174 | thmfc1->data[ thmfc1->data_idx + 128 ] == thmfc1->data_crc ) | |
| 1175 | 1175 | { |
| 1176 | ||
| 1176 | ||
| 1177 | 1177 | /* look backwards for previous id field */ |
| 1178 | 1178 | for ( i = thmfc1->data_idx - 4; i >= 0; i-- ) |
| 1179 | 1179 | { |
| 1180 | 1180 | if ( thmfc1->data[ i ] == 0xA5 && |
| 1181 | ( ( thmfc1->data[ i ] + thmfc1->data[ i + 1 ] + | |
| 1182 | thmfc1->data[ i + 2 ] ) & 0xff | |
| 1181 | ( ( thmfc1->data[ i ] + thmfc1->data[ i + 1 ] + | |
| 1182 | thmfc1->data[ i + 2 ] ) & 0xff | |
| 1183 | 1183 | ) == thmfc1->data[ i + 3 ] ) |
| 1184 | 1184 | break; |
| 1185 | 1185 | } |
| 1186 | ||
| 1187 | if ( i >= 0 ) | |
| 1186 | ||
| 1187 | if ( i >= 0 ) | |
| 1188 | 1188 | { |
| 1189 | 1189 | /* got an id & a data field => write */ |
| 1190 | 1190 | mess_image * img = thmfc_floppy_image(); |
| 1191 | int sector = (int) thmfc1->data[ i + 1 ] * 256 + | |
| 1191 | int sector = (int) thmfc1->data[ i + 1 ] * 256 + | |
| 1192 | 1192 | (int) thmfc1->data[ i + 2 ]; |
| 1193 | ||
| 1194 | LOG(( "%f $%04x thmfc_floppy_qdd_write_byte: data field, sector=%i\n", | |
| 1193 | ||
| 1194 | LOG(( "%f $%04x thmfc_floppy_qdd_write_byte: data field, sector=%i\n", | |
| 1195 | 1195 | attotime_to_double(timer_get_time()), activecpu_get_previouspc(), sector )); |
| 1196 | ||
| 1196 | ||
| 1197 | 1197 | floppy_drive_write_sector_data( img, 0, sector, thmfc1->data + thmfc1->data_idx, 128, 0 ); |
| 1198 | 1198 | } |
| 1199 | ||
| 1199 | ||
| 1200 | 1200 | thmfc1->data_idx = 0; |
| 1201 | ||
| 1201 | ||
| 1202 | 1202 | } |
| 1203 | else | |
| 1203 | else | |
| 1204 | 1204 | thmfc1->data_crc += data; |
| 1205 | 1205 | } |
| 1206 | 1206 | else |
| r1461 | r1462 | |
| 1208 | 1208 | thmfc1->data_raw_idx++; |
| 1209 | 1209 | VLOG (( "%f $%04x thmfc_floppy_qdd_write_byte: ignored $%02X\n", attotime_to_double(timer_get_time()), activecpu_get_previouspc(), data )); |
| 1210 | 1210 | } |
| 1211 | ||
| 1211 | ||
| 1212 | 1212 | } |
| 1213 | 1213 | |
| 1214 | 1214 | |
| r1461 | r1462 | |
| 1216 | 1216 | /* intelligent writing */ |
| 1217 | 1217 | static void thmfc_floppy_write_byte ( UINT8 data ) |
| 1218 | 1218 | { |
| 1219 | VLOG (( "%f $%04x thmfc_floppy_write_byte: off=%i/%i data=$%02X\n", | |
| 1220 | attotime_to_double(timer_get_time()), activecpu_get_previouspc(), | |
| 1219 | VLOG (( "%f $%04x thmfc_floppy_write_byte: off=%i/%i data=$%02X\n", | |
| 1220 | attotime_to_double(timer_get_time()), activecpu_get_previouspc(), | |
| 1221 | 1221 | thmfc1->data_idx, thmfc1->data_size - 1, data )); |
| 1222 | ||
| 1222 | ||
| 1223 | 1223 | thmfc1->data_raw_size = 0; |
| 1224 | 1224 | thmfc1->data[ thmfc1->data_idx ] = data; |
| 1225 | 1225 | if ( thmfc1->data_idx >= thmfc1->data_size - 1 ) |
| 1226 | 1226 | thmfc_floppy_cmd_complete(); |
| 1227 | else | |
| 1227 | else | |
| 1228 | 1228 | thmfc1->data_idx++; |
| 1229 | 1229 | } |
| 1230 | 1230 | |
| r1461 | r1462 | |
| 1232 | 1232 | static void thmfc_floppy_format_byte ( UINT8 data ) |
| 1233 | 1233 | { |
| 1234 | 1234 | VLOG (( "%f $%04x thmfc_floppy_format_byte: $%02X\n", attotime_to_double(timer_get_time()), activecpu_get_previouspc(), data )); |
| 1235 | ||
| 1235 | ||
| 1236 | 1236 | thmfc1->data_raw_size = 0; |
| 1237 | ||
| 1237 | ||
| 1238 | 1238 | /* accumulate bytes to form an id field */ |
| 1239 | if ( thmfc1->data_idx || data==0xA1 ) | |
| 1239 | if ( thmfc1->data_idx || data==0xA1 ) | |
| 1240 | 1240 | { |
| 1241 | 1241 | UINT8 header[] = { 0xa1, 0xa1, 0xa1, 0xfe }; |
| 1242 | 1242 | thmfc1->data[ thmfc1->data_idx ] = data; |
| 1243 | 1243 | thmfc1->data_idx++; |
| 1244 | if ( thmfc1->data_idx > 11 ) | |
| 1244 | if ( thmfc1->data_idx > 11 ) | |
| 1245 | 1245 | { |
| 1246 | ||
| 1247 | if ( !memcmp ( thmfc1->data, header, sizeof( header ) ) ) | |
| 1246 | ||
| 1247 | if ( !memcmp ( thmfc1->data, header, sizeof( header ) ) ) | |
| 1248 | 1248 | { |
| 1249 | 1249 | /* got id field => format */ |
| 1250 | 1250 | mess_image * img = thmfc_floppy_image(); |
| r1461 | r1462 | |
| 1255 | 1255 | UINT8 filler = 0xe5; /* standard Thomson filler */ |
| 1256 | 1256 | floppy_drive_format_sector( img, side, sector, track, thmfc1->side, sector, length, filler ); |
| 1257 | 1257 | } |
| 1258 | ||
| 1258 | ||
| 1259 | 1259 | thmfc1->data_idx = 0; |
| 1260 | 1260 | } |
| 1261 | ||
| 1261 | ||
| 1262 | 1262 | } |
| 1263 | 1263 | } |
| 1264 | 1264 | |
| r1461 | r1462 | |
| 1266 | 1266 | |
| 1267 | 1267 | READ8_HANDLER ( thmfc_floppy_r ) |
| 1268 | 1268 | { |
| 1269 | switch ( offset ) | |
| 1269 | switch ( offset ) | |
| 1270 | 1270 | { |
| 1271 | ||
| 1271 | ||
| 1272 | 1272 | case 0: /* STAT0 */ |
| 1273 | 1273 | thmfc1->stat0 ^= THMFC1_STAT0_SYNCHRO | THMFC1_STAT0_BYTE_READY_POL; |
| 1274 | 1274 | VLOG(( "%f $%04x thmfc_floppy_r: STAT0=$%02X\n", attotime_to_double(timer_get_time()), activecpu_get_previouspc(), thmfc1->stat0 )); |
| 1275 | 1275 | return thmfc1->stat0; |
| 1276 | ||
| 1276 | ||
| 1277 | 1277 | case 1: /* STAT1 */ |
| 1278 | 1278 | { |
| 1279 | 1279 | UINT8 data = 0; |
| 1280 | 1280 | mess_image * img = thmfc_floppy_image(); |
| 1281 | 1281 | int flags = floppy_drive_get_flag_state( img, -1 ); |
| 1282 | if ( thmfc_floppy_is_qdd() ) | |
| 1282 | if ( thmfc_floppy_is_qdd() ) | |
| 1283 | 1283 | { |
| 1284 | if ( ! image_exists(img) ) | |
| 1284 | if ( ! image_exists(img) ) | |
| 1285 | 1285 | data |= 0x40; /* disk present */ |
| 1286 | if ( ! thmfc1->ipl ) | |
| 1286 | if ( ! thmfc1->ipl ) | |
| 1287 | 1287 | data |= 0x02; /* disk start */ |
| 1288 | 1288 | data |= 0x08; /* connected */ |
| 1289 | 1289 | } |
| 1290 | else | |
| 1290 | else | |
| 1291 | 1291 | { |
| 1292 | if ( thmfc1->ipl ) | |
| 1292 | if ( thmfc1->ipl ) | |
| 1293 | 1293 | data |= 0x40; |
| 1294 | if ( image_exists(img) ) | |
| 1294 | if ( image_exists(img) ) | |
| 1295 | 1295 | data |= 0x20; /* disk change (?) */ |
| 1296 | if ( flags & FLOPPY_DRIVE_HEAD_AT_TRACK_0 ) | |
| 1296 | if ( flags & FLOPPY_DRIVE_HEAD_AT_TRACK_0 ) | |
| 1297 | 1297 | data |= 0x08; |
| 1298 | if ( flags & FLOPPY_DRIVE_READY ) | |
| 1298 | if ( flags & FLOPPY_DRIVE_READY ) | |
| 1299 | 1299 | data |= 0x02; |
| 1300 | 1300 | } |
| 1301 | if ( ! (flags & FLOPPY_DRIVE_MOTOR_ON ) ) | |
| 1301 | if ( ! (flags & FLOPPY_DRIVE_MOTOR_ON ) ) | |
| 1302 | 1302 | data |= 0x10; |
| 1303 | if ( flags & FLOPPY_DRIVE_DISK_WRITE_PROTECTED ) | |
| 1303 | if ( flags & FLOPPY_DRIVE_DISK_WRITE_PROTECTED ) | |
| 1304 | 1304 | data |= 0x04; |
| 1305 | 1305 | VLOG(( "%f $%04x thmfc_floppy_r: STAT1=$%02X\n", attotime_to_double(timer_get_time()), activecpu_get_previouspc(), data )); |
| 1306 | 1306 | return data; |
| 1307 | 1307 | } |
| 1308 | ||
| 1308 | ||
| 1309 | 1309 | case 3: /* RDATA */ |
| 1310 | ||
| 1311 | if ( thmfc1->op == THMFC1_OP_READ_SECT || thmfc1->op == THMFC1_OP_READ_ADDR ) | |
| 1310 | ||
| 1311 | if ( thmfc1->op == THMFC1_OP_READ_SECT || thmfc1->op == THMFC1_OP_READ_ADDR ) | |
| 1312 | 1312 | return thmfc_floppy_read_byte(); |
| 1313 | 1313 | else |
| 1314 | 1314 | return thmfc_floppy_raw_read_byte(); |
| 1315 | 1315 | |
| 1316 | 1316 | case 6: |
| 1317 | 1317 | return 0; |
| 1318 | ||
| 1319 | case 8: | |
| 1320 | { | |
| 1318 | ||
| 1319 | case 8: | |
| 1320 | { | |
| 1321 | 1321 | /* undocumented => emulate TO7 QDD controller ? */ |
| 1322 | 1322 | UINT8 data = thmfc1->ipl << 7; |
| 1323 | 1323 | VLOG(( "%f $%04x thmfc_floppy_r: STAT8=$%02X\n", attotime_to_double(timer_get_time()), activecpu_get_previouspc(), data )); |
| r1461 | r1462 | |
| 1345 | 1345 | thom_floppy_set_density( dens ); |
| 1346 | 1346 | thmfc1->formatting = (data >> 2) & 1; |
| 1347 | 1347 | LOG (( "%f $%04x thmfc_floppy_w: CMD0=$%02X dens=%s wsync=%i dsync=%i fmt=%i op=%i\n", |
| 1348 | attotime_to_double(timer_get_time()), activecpu_get_previouspc(), data, | |
| 1348 | attotime_to_double(timer_get_time()), activecpu_get_previouspc(), data, | |
| 1349 | 1349 | (dens == DEN_FM_LO) ? "MF" : "MFM", |
| 1350 | 1350 | wsync, (data >> 3) & 1, |
| 1351 | 1351 | thmfc1->formatting, data & 3 )); |
| 1352 | ||
| 1352 | ||
| 1353 | 1353 | /* abort previous command, if any */ |
| 1354 | 1354 | thmfc1->op = THMFC1_OP_RESET; |
| 1355 | 1355 | timer_adjust( thmfc_floppy_cmd, attotime_never, 0, attotime_never ); |
| 1356 | ||
| 1357 | switch ( data & 3 ) | |
| 1356 | ||
| 1357 | switch ( data & 3 ) | |
| 1358 | 1358 | { |
| 1359 | 1359 | |
| 1360 | 1360 | case THMFC1_OP_RESET: |
| 1361 | 1361 | thmfc1->stat0 = THMFC1_STAT0_FINISHED; |
| 1362 | 1362 | break; |
| 1363 | ||
| 1363 | ||
| 1364 | 1364 | case THMFC1_OP_WRITE_SECT: |
| 1365 | if ( qdd ) | |
| 1365 | if ( qdd ) | |
| 1366 | 1366 | logerror( "thmfc_floppy_w: smart operation 1 not supported for QDD\n" ); |
| 1367 | else if ( thmfc_floppy_find_sector( NULL ) ) | |
| 1367 | else if ( thmfc_floppy_find_sector( NULL ) ) | |
| 1368 | 1368 | { |
| 1369 | 1369 | thmfc1->data_idx = 0; |
| 1370 | 1370 | thmfc1->data_size = thmfc1->sector_size + 3; /* A1 A1 FB <data> */ |
| r1461 | r1462 | |
| 1374 | 1374 | timer_adjust( thmfc_floppy_cmd, ATTOTIME_IN_MSEC( 10 ), 0, attotime_never ); |
| 1375 | 1375 | } |
| 1376 | 1376 | break; |
| 1377 | ||
| 1377 | ||
| 1378 | 1378 | case THMFC1_OP_READ_ADDR: |
| 1379 | if ( qdd ) | |
| 1379 | if ( qdd ) | |
| 1380 | 1380 | logerror( "thmfc_floppy_w: smart operation 2 not supported for QDD\n" ); |
| 1381 | else if ( thmfc_floppy_find_sector( &id ) ) | |
| 1381 | else if ( thmfc_floppy_find_sector( &id ) ) | |
| 1382 | 1382 | { |
| 1383 | thmfc1->data_size = | |
| 1383 | thmfc1->data_size = | |
| 1384 | 1384 | thom_floppy_make_addr( id, thmfc1->data, thmfc1->sector_size ); |
| 1385 | 1385 | assert( thmfc1->data_size < sizeof( thmfc1->data ) ); |
| 1386 | 1386 | thmfc1->data_finish = 10; |
| r1461 | r1462 | |
| 1390 | 1390 | timer_adjust( thmfc_floppy_cmd, ATTOTIME_IN_MSEC( 1 ), 0, attotime_never ); |
| 1391 | 1391 | } |
| 1392 | 1392 | break; |
| 1393 | ||
| 1393 | ||
| 1394 | 1394 | case THMFC1_OP_READ_SECT: |
| 1395 | if ( qdd ) | |
| 1395 | if ( qdd ) | |
| 1396 | 1396 | logerror( "thmfc_floppy_w: smart operation 3 not supported for QDD\n" ); |
| 1397 | else if ( thmfc_floppy_find_sector( &id ) ) | |
| 1397 | else if ( thmfc_floppy_find_sector( &id ) ) | |
| 1398 | 1398 | { |
| 1399 | 1399 | thmfc1->data_size = thom_floppy_make_sector |
| 1400 | 1400 | ( thmfc_floppy_image(), id, thmfc1->data, thmfc1->sector_size ); |
| r1461 | r1462 | |
| 1421 | 1421 | } |
| 1422 | 1422 | |
| 1423 | 1423 | break; |
| 1424 | ||
| 1425 | ||
| 1424 | ||
| 1425 | ||
| 1426 | 1426 | case 1: /* CMD1 */ |
| 1427 | 1427 | thmfc1->data_raw_size = 0; |
| 1428 | 1428 | thmfc1->sector_size = 128 << ( (data >> 5) & 3); |
| 1429 | 1429 | thmfc1->side = (data >> 4) & 1; |
| 1430 | if ( thmfc1->sector_size > 256 ) | |
| 1430 | if ( thmfc1->sector_size > 256 ) | |
| 1431 | 1431 | { |
| 1432 | 1432 | logerror( "$%04x thmfc_floppy_w: sector size %i > 256 not handled\n", |
| 1433 | 1433 | activecpu_get_previouspc(), thmfc1->sector_size ); |
| 1434 | 1434 | thmfc1->sector_size = 256; |
| 1435 | 1435 | } |
| 1436 | ||
| 1436 | ||
| 1437 | 1437 | LOG (( "%f $%04x thmfc_floppy_w: CMD1=$%02X sect-size=%i comp=%i head=%i\n", |
| 1438 | 1438 | attotime_to_double(timer_get_time()), activecpu_get_previouspc(), data, |
| 1439 | 1439 | thmfc1->sector_size, (data >> 1) & 7, thmfc1->side )); |
| r1461 | r1462 | |
| 1446 | 1446 | int seek = 0, motor; |
| 1447 | 1447 | thmfc1->drive = data & 2; |
| 1448 | 1448 | |
| 1449 | if ( thmfc_floppy_is_qdd() ) | |
| 1449 | if ( thmfc_floppy_is_qdd() ) | |
| 1450 | 1450 | { |
| 1451 | 1451 | motor = !(data & 0x40); |
| 1452 | 1452 | /* no side select & no seek for QDD */ |
| 1453 | 1453 | } |
| 1454 | else | |
| 1454 | else | |
| 1455 | 1455 | { |
| 1456 | if ( data & 0x10 ) | |
| 1456 | if ( data & 0x10 ) | |
| 1457 | 1457 | seek = (data & 0x20) ? 1 : -1; |
| 1458 | 1458 | motor = (data >> 2) & 1; |
| 1459 | 1459 | thmfc1->drive |= 1 ^ ((data >> 6) & 1); |
| r1461 | r1462 | |
| 1461 | 1461 | |
| 1462 | 1462 | img = thmfc_floppy_image(); |
| 1463 | 1463 | thom_floppy_active( 0 ); |
| 1464 | ||
| 1464 | ||
| 1465 | 1465 | LOG (( "%f $%04x thmfc_floppy_w: CMD2=$%02X drv=%i step=%i motor=%i\n", |
| 1466 | attotime_to_double(timer_get_time()), activecpu_get_previouspc(), data, | |
| 1466 | attotime_to_double(timer_get_time()), activecpu_get_previouspc(), data, | |
| 1467 | 1467 | thmfc1->drive, seek, motor )); |
| 1468 | ||
| 1469 | if ( seek ) | |
| 1470 | { | |
| 1468 | ||
| 1469 | if ( seek ) | |
| 1470 | { | |
| 1471 | 1471 | thmfc1->data_raw_size = 0; |
| 1472 | 1472 | floppy_drive_seek( img, seek ); |
| 1473 | 1473 | } |
| r1461 | r1462 | |
| 1483 | 1483 | |
| 1484 | 1484 | case 3: /* WDATA */ |
| 1485 | 1485 | thmfc1->wsync = data; |
| 1486 | if ( thmfc_floppy_is_qdd() ) | |
| 1486 | if ( thmfc_floppy_is_qdd() ) | |
| 1487 | 1487 | thmfc_floppy_qdd_write_byte( data ); |
| 1488 | else if ( thmfc1->op==THMFC1_OP_WRITE_SECT ) | |
| 1488 | else if ( thmfc1->op==THMFC1_OP_WRITE_SECT ) | |
| 1489 | 1489 | thmfc_floppy_write_byte( data ); |
| 1490 | else if ( thmfc1->formatting ) | |
| 1490 | else if ( thmfc1->formatting ) | |
| 1491 | 1491 | thmfc_floppy_format_byte( data ); |
| 1492 | else | |
| 1492 | else | |
| 1493 | 1493 | { |
| 1494 | 1494 | /* TODO: implement other forms of raw track writing */ |
| 1495 | LOG (( "%f $%04x thmfc_floppy_w: ignored raw WDATA $%02X\n", | |
| 1495 | LOG (( "%f $%04x thmfc_floppy_w: ignored raw WDATA $%02X\n", | |
| 1496 | 1496 | attotime_to_double(timer_get_time()), activecpu_get_previouspc(), data )); |
| 1497 | 1497 | } |
| 1498 | 1498 | break; |
| 1499 | ||
| 1500 | 1499 | |
| 1500 | ||
| 1501 | 1501 | case 4: /* WCLK (unemulated) */ |
| 1502 | 1502 | /* clock configuration: FF for data, 0A for synchro */ |
| 1503 | LOG (( "%f $%04x thmfc_floppy_w: WCLK=$%02X (%s)\n", | |
| 1503 | LOG (( "%f $%04x thmfc_floppy_w: WCLK=$%02X (%s)\n", | |
| 1504 | 1504 | attotime_to_double(timer_get_time()), activecpu_get_previouspc(), data, |
| 1505 | 1505 | (data == 0xff) ? "data" : (data == 0x0A) ? "synchro" : "?" )); |
| 1506 | 1506 | break; |
| 1507 | 1507 | |
| 1508 | 1508 | case 5: /* WSECT */ |
| 1509 | 1509 | thmfc1->sector = data; |
| 1510 | LOG (( "%f $%04x thmfc_floppy_w: WSECT=%i\n", | |
| 1510 | LOG (( "%f $%04x thmfc_floppy_w: WSECT=%i\n", | |
| 1511 | 1511 | attotime_to_double(timer_get_time()), activecpu_get_previouspc(), data )); |
| 1512 | 1512 | break; |
| 1513 | 1513 | |
| 1514 | 1514 | case 6: /* WTRCK */ |
| 1515 | 1515 | thmfc1->track = data; |
| 1516 | LOG (( "%f $%04x thmfc_floppy_w: WTRCK=%i (real=%i)\n", | |
| 1516 | LOG (( "%f $%04x thmfc_floppy_w: WTRCK=%i (real=%i)\n", | |
| 1517 | 1517 | attotime_to_double(timer_get_time()), activecpu_get_previouspc(), data, |
| 1518 | 1518 | floppy_drive_get_current_track( thmfc_floppy_image() ) )); |
| 1519 | 1519 | break; |
| 1520 | 1520 | |
| 1521 | 1521 | case 7: /* WCELL */ |
| 1522 | 1522 | /* precompensation (unemulated) */ |
| 1523 | LOG (( "%f $%04x thmfc_floppy_w: WCELL=$%02X\n", | |
| 1523 | LOG (( "%f $%04x thmfc_floppy_w: WCELL=$%02X\n", | |
| 1524 | 1524 | attotime_to_double(timer_get_time()), activecpu_get_previouspc(), data )); |
| 1525 | 1525 | break; |
| 1526 | ||
| 1526 | ||
| 1527 | 1527 | default: |
| 1528 | logerror ( "%f $%04x thmfc_floppy_w: invalid write offset %i (data=$%02X)\n", | |
| 1528 | logerror ( "%f $%04x thmfc_floppy_w: invalid write offset %i (data=$%02X)\n", | |
| 1529 | 1529 | attotime_to_double(timer_get_time()), activecpu_get_previouspc(), offset, data ); |
| 1530 | 1530 | } |
| 1531 | 1531 | } |
| r1461 | r1462 | |
| 1536 | 1536 | { |
| 1537 | 1537 | int i; |
| 1538 | 1538 | LOG(( "thmfc_floppy_reset: THMFC1 controller\n" )); |
| 1539 | ||
| 1540 | for ( i = 0; i < device_count( IO_FLOPPY ); i++ ) | |
| 1539 | ||
| 1540 | for ( i = 0; i < device_count( IO_FLOPPY ); i++ ) | |
| 1541 | 1541 | { |
| 1542 | 1542 | mess_image * img = image_from_devtype_and_index( IO_FLOPPY, i ); |
| 1543 | 1543 | floppy_drive_set_index_pulse_callback( img, thmfc_floppy_index_pulse_cb ); |
| r1461 | r1462 | |
| 1602 | 1602 | toplevel network emulation here! |
| 1603 | 1603 | */ |
| 1604 | 1604 | |
| 1605 | /* NOTE: This is work in progress! | |
| 1605 | /* NOTE: This is work in progress! | |
| 1606 | 1606 | For the moment, only hand-checks works: the TO7 can take the line, then |
| 1607 | 1607 | perform a DKBOOT request. We do not have the server emulated yet, so, |
| 1608 | 1608 | no way to answer the request. |
| r1461 | r1462 | |
| 1637 | 1637 | /* consigne DKBOOT |
| 1638 | 1638 | |
| 1639 | 1639 | MO5 BASIC |
| 1640 | $00 $00 $01 $00 $00 $00 $00 $00 $00 $00 $01 $00<$41 $00 $FF $20 | |
| 1640 | $00 $00 $01 $00 $00 $00 $00 $00 $00 $00 $01 $00<$41 $00 $FF $20 | |
| 1641 | 1641 | $3D $4C $01 $60 $20 $3C $4F $01 $05 $20 $3F $9C $19 $25 $03 $11 |
| 1642 | $93 $15 $10 $25 $32 $8A $7E $FF $E1 $FD $E9 $41>$00 $00 $00 $00 | |
| 1642 | $93 $15 $10 $25 $32 $8A $7E $FF $E1 $FD $E9 $41>$00 $00 $00 $00 | |
| 1643 | 1643 | $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 |
| 1644 | 1644 | |
| 1645 | 1645 | TO7/70 BASIC |
| 1646 | $00 $00 $01 $00 $00 $00 $00 $00 $00 $00 $02 $00<$20 $42 $41 $53 | |
| 1646 | $00 $00 $01 $00 $00 $00 $00 $00 $00 $00 $02 $00<$20 $42 $41 $53 | |
| 1647 | 1647 | $49 $43 $20 $4D $49 $43 $52 $4F $53 $4F $46 $54 $20 $31 $2E $30 |
| 1648 | $04 $00 $00 $00 $00 $00 $60 $FF $37 $9B $37 $9C>$00 $00 $00 $00 | |
| 1648 | $04 $00 $00 $00 $00 $00 $60 $FF $37 $9B $37 $9C>$00 $00 $00 $00 | |
| 1649 | 1649 | $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 |
| 1650 | 1650 | |
| 1651 | 1651 | TO7 BASIC |
| 1652 | $00 $00 $01 $00 $00 $00 $00 $00 $00 $00 $00 $00<$20 $42 $41 $53 | |
| 1652 | $00 $00 $01 $00 $00 $00 $00 $00 $00 $00 $00 $00<$20 $42 $41 $53 | |
| 1653 | 1653 | $49 $43 $20 $4D $49 $43 $52 $4F $53 $4F $46 $54 $20 $31 $2E $30 |
| 1654 | $04 $00 $00 $00 $00 $00 $60 $FF $37 $9B $37 $9C>$00 $00 $00 $00 | |
| 1654 | $04 $00 $00 $00 $00 $00 $60 $FF $37 $9B $37 $9C>$00 $00 $00 $00 | |
| 1655 | 1655 | $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 |
| 1656 | 1656 | |
| 1657 | 1657 | TO7 LOGO |
| 1658 | $00 $00 $01 $00 $00 $00 $00 $00 $00 $00 $00 $00<$00 $00 $00 $00 | |
| 1658 | $00 $00 $01 $00 $00 $00 $00 $00 $00 $00 $00 $00<$00 $00 $00 $00 | |
| 1659 | 1659 | $00 $20 $4C $4F $47 $4F $04 $00 $00 $00 $00 $00 $00 $00 $00 $00 |
| 1660 | $00 $00 $00 $00 $00 $00 $AA $FF $01 $16 $00 $C8>$00 $00 $00 $00 | |
| 1660 | $00 $00 $00 $00 $00 $00 $AA $FF $01 $16 $00 $C8>$00 $00 $00 $00 | |
| 1661 | 1661 | $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 |
| 1662 | 1662 | |
| 1663 | 1663 | |
| r1461 | r1462 | |
| 1671 | 1671 | LOG(( " $%02X", data[i] )); |
| 1672 | 1672 | LOG(( "\n" )); |
| 1673 | 1673 | |
| 1674 | if ( data[1] == 0xff ) | |
| 1674 | if ( data[1] == 0xff ) | |
| 1675 | 1675 | { |
| 1676 | 1676 | LOG(( "to7_network_got_frame: %i phones %i\n", data[2], data[0] )); |
| 1677 | 1677 | timer_set( ATTOTIME_IN_USEC( 100 ), NULL, 0, ans ); |
| 1678 | 1678 | mc6854_set_cts( 0 ); |
| 1679 | 1679 | } |
| 1680 | else if ( ! data[1] ) | |
| 1680 | else if ( ! data[1] ) | |
| 1681 | 1681 | { |
| 1682 | 1682 | char name[33]; |
| 1683 | 1683 | int i; |
| 1684 | memcpy( name, data + 12, 32 ); | |
| 1684 | memcpy( name, data + 12, 32 ); | |
| 1685 | 1685 | name[32] = 0; |
| 1686 | for (i=0;i<32;i++) | |
| 1686 | for (i=0;i<32;i++) | |
| 1687 | 1687 | { |
| 1688 | if ( name[i]<32 || name[i]>=127 ) | |
| 1688 | if ( name[i]<32 || name[i]>=127 ) | |
| 1689 | 1689 | name[i]=' '; |
| 1690 | 1690 | } |
| 1691 | 1691 | LOG(( "to7_network_got_frame: DKBOOT system=%s appli=\"%s\"\n", |
| 1692 | 1692 | (data[10] == 0) ? "TO7" : (data[10] == 1) ? "MO5" : |
| 1693 | 1693 | (data[10] == 2) ? "TO7/70" : "?", name )); |
| 1694 | 1694 | } |
| 1695 | ||
| 1695 | ||
| 1696 | 1696 | } |
| 1697 | 1697 | |
| 1698 | 1698 | |
| r1461 | r1462 | |
| 1721 | 1721 | |
| 1722 | 1722 | static READ8_HANDLER ( to7_network_r ) |
| 1723 | 1723 | { |
| 1724 | if ( offset >= 0 && offset < 4 ) | |
| 1724 | if ( offset >= 0 && offset < 4 ) | |
| 1725 | 1725 | return mc6854_r( offset ); |
| 1726 | 1726 | |
| 1727 | if ( offset == 8 ) | |
| 1727 | if ( offset == 8 ) | |
| 1728 | 1728 | { |
| 1729 | 1729 | /* network ID of the computer */ |
| 1730 | 1730 | UINT8 id = readinputport( THOM_INPUT_FCONFIG ) >> 3; |
| r1461 | r1462 | |
| 1759 | 1759 | |
| 1760 | 1760 | NOTE: you need to reset the computer after changing the floppy controller! |
| 1761 | 1761 | |
| 1762 | The CD 90-351 controller seems similar to the THMFC1 gate-array | |
| 1762 | The CD 90-351 controller seems similar to the THMFC1 gate-array | |
| 1763 | 1763 | => we reuse the THMFC code! |
| 1764 | 1764 | */ |
| 1765 | 1765 | |
| r1461 | r1462 | |
| 1787 | 1787 | { |
| 1788 | 1788 | to7_controller_type = (readinputport( THOM_INPUT_FCONFIG ) ) & 7; |
| 1789 | 1789 | |
| 1790 | switch ( to7_controller_type ) | |
| 1790 | switch ( to7_controller_type ) | |
| 1791 | 1791 | { |
| 1792 | 1792 | |
| 1793 | 1793 | case 1: |
| r1461 | r1462 | |
| 1797 | 1797 | |
| 1798 | 1798 | case 2: |
| 1799 | 1799 | to7_floppy_bank = 2; |
| 1800 | to7_5p14_reset(); | |
| 1800 | to7_5p14_reset(); | |
| 1801 | 1801 | break; |
| 1802 | 1802 | |
| 1803 | 1803 | case 3: |
| r1461 | r1462 | |
| 1805 | 1805 | thmfc_floppy_reset(); |
| 1806 | 1806 | break; |
| 1807 | 1807 | |
| 1808 | case 4: | |
| 1808 | case 4: | |
| 1809 | 1809 | to7_floppy_bank = 7; |
| 1810 | to7_qdd_reset(); | |
| 1810 | to7_qdd_reset(); | |
| 1811 | 1811 | break; |
| 1812 | 1812 | |
| 1813 | case 5: | |
| 1813 | case 5: | |
| 1814 | 1814 | to7_floppy_bank = 8; |
| 1815 | to7_network_reset(); | |
| 1815 | to7_network_reset(); | |
| 1816 | 1816 | break; |
| 1817 | 1817 | |
| 1818 | 1818 | default: |
| r1461 | r1462 | |
| 1827 | 1827 | |
| 1828 | 1828 | READ8_HANDLER ( to7_floppy_r ) |
| 1829 | 1829 | { |
| 1830 | switch ( to7_controller_type ) | |
| 1830 | switch ( to7_controller_type ) | |
| 1831 | 1831 | { |
| 1832 | 1832 | |
| 1833 | case 1: | |
| 1833 | case 1: | |
| 1834 | 1834 | return to7_5p14sd_r( offset ); |
| 1835 | 1835 | |
| 1836 | case 2: | |
| 1836 | case 2: | |
| 1837 | 1837 | return to7_5p14_r( offset ); |
| 1838 | ||
| 1839 | case 3: | |
| 1838 | ||
| 1839 | case 3: | |
| 1840 | 1840 | return thmfc_floppy_r( offset ); |
| 1841 | ||
| 1842 | case 4: | |
| 1841 | ||
| 1842 | case 4: | |
| 1843 | 1843 | return to7_qdd_r( offset ); |
| 1844 | 1844 | |
| 1845 | case 5: | |
| 1845 | case 5: | |
| 1846 | 1846 | return to7_network_r( offset ); |
| 1847 | 1847 | } |
| 1848 | 1848 | |
| r1461 | r1462 | |
| 1853 | 1853 | |
| 1854 | 1854 | WRITE8_HANDLER ( to7_floppy_w ) |
| 1855 | 1855 | { |
| 1856 | switch ( to7_controller_type ) | |
| 1856 | switch ( to7_controller_type ) | |
| 1857 | 1857 | { |
| 1858 | ||
| 1858 | ||
| 1859 | 1859 | case 1: |
| 1860 | 1860 | to7_5p14sd_w( offset, data ); |
| 1861 | 1861 | return; |
| 1862 | 1862 | |
| 1863 | 1863 | case 2: |
| 1864 | to7_5p14_w( offset, data ); | |
| 1864 | to7_5p14_w( offset, data ); | |
| 1865 | 1865 | break; |
| 1866 | ||
| 1866 | ||
| 1867 | 1867 | case 3: |
| 1868 | if ( offset == 8 ) | |
| 1868 | if ( offset == 8 ) | |
| 1869 | 1869 | { |
| 1870 | 1870 | to7_floppy_bank = 3 + (data & 3); |
| 1871 | 1871 | memory_set_bank( THOM_FLOP_BANK, to7_floppy_bank ); |
| 1872 | 1872 | VLOG (( "to7_floppy_w: set CD 90-351 ROM bank to %i\n", data & 3 )); |
| 1873 | 1873 | } |
| 1874 | else | |
| 1875 | thmfc_floppy_w( offset, data ); | |
| 1874 | else | |
| 1875 | thmfc_floppy_w( offset, data ); | |
| 1876 | 1876 | break; |
| 1877 | 1877 | |
| 1878 | 1878 | case 4: |
| 1879 | to7_qdd_w( offset, data ); | |
| 1879 | to7_qdd_w( offset, data ); | |
| 1880 | 1880 | break; |
| 1881 | 1881 | |
| 1882 | case 5: | |
| 1883 | to7_network_w( offset, data ); | |
| 1882 | case 5: | |
| 1883 | to7_network_w( offset, data ); | |
| 1884 | 1884 | break; |
| 1885 | 1885 | } |
| 1886 | 1886 | } |
| r1461 | r1462 | |
| 1889 | 1889 | |
| 1890 | 1890 | /*********************** TO9 ************************/ |
| 1891 | 1891 | |
| 1892 | /* the internal controller is WD2793-based (so, similar to to7_5p14) | |
| 1892 | /* the internal controller is WD2793-based (so, similar to to7_5p14) | |
| 1893 | 1893 | we also emulate external controllers |
| 1894 | 1894 | */ |
| 1895 | 1895 | |
| r1461 | r1462 | |
| 1906 | 1906 | void to9_floppy_reset( void ) |
| 1907 | 1907 | { |
| 1908 | 1908 | to7_floppy_reset(); |
| 1909 | if ( THOM_FLOPPY_EXT ) | |
| 1909 | if ( THOM_FLOPPY_EXT ) | |
| 1910 | 1910 | { |
| 1911 | 1911 | LOG(( "to9_floppy_reset: external controller\n" )); |
| 1912 | 1912 | } |
| r1461 | r1462 | |
| 1922 | 1922 | |
| 1923 | 1923 | READ8_HANDLER ( to9_floppy_r ) |
| 1924 | 1924 | { |
| 1925 | if ( THOM_FLOPPY_EXT ) | |
| 1925 | if ( THOM_FLOPPY_EXT ) | |
| 1926 | 1926 | return to7_floppy_r( offset ); |
| 1927 | else | |
| 1927 | else | |
| 1928 | 1928 | return to7_5p14_r( offset ); |
| 1929 | 1929 | } |
| 1930 | 1930 | |
| 1931 | 1931 | WRITE8_HANDLER ( to9_floppy_w ) |
| 1932 | 1932 | { |
| 1933 | if ( THOM_FLOPPY_EXT ) | |
| 1933 | if ( THOM_FLOPPY_EXT ) | |
| 1934 | 1934 | to7_floppy_w( offset, data ); |
| 1935 | else | |
| 1935 | else | |
| 1936 | 1936 | to7_5p14_w( offset, data ); |
| 1937 | 1937 | } |
| r1461 | r1462 | |
|---|---|---|
| 28 | 28 | struct snapquick_info *si = (struct snapquick_info *) ptr; |
| 29 | 29 | snapquick_loadproc loadproc; |
| 30 | 30 | const char *file_type; |
| 31 | ||
| 31 | ||
| 32 | 32 | loadproc = (snapquick_loadproc) device_get_info_fct(&si->dev->devclass, DEVINFO_PTR_SNAPSHOT_LOAD); |
| 33 | 33 | file_type = image_filetype(si->img); |
| 34 | 34 | loadproc(si->img, file_type, si->file_size); |
| r1461 | r1462 | |
|---|---|---|
| 70 | 70 | |
| 71 | 71 | /* identify the cartridge type */ |
| 72 | 72 | cart_proc = find_cart(carttype); |
| 73 | assert_always(cart_proc != NULL, "Invalid cartridge hardware type"); | |
| 73 | assert_always(cart_proc != NULL, "Invalid cartridge hardware type"); | |
| 74 | 74 | |
| 75 | 75 | /* allocate the cartridge structure */ |
| 76 | 76 | extra_data_size = (size_t) cococart_get_info_int(cart_proc, COCOCARTINFO_INT_DATASIZE); |
| r1461 | r1462 | |
|---|---|---|
| 57 | 57 | strcat(name, " "); |
| 58 | 58 | strcat(name, ui_getstring(UI_righthilight)); |
| 59 | 59 | ui_draw_message_window(name); |
| 60 | ||
| 60 | ||
| 61 | 61 | if (input_ui_pressed(IPT_UI_SELECT) || input_ui_pressed(IPT_UI_CANCEL)) |
| 62 | 62 | sel = -1; |
| 63 | 63 | if (input_ui_pressed(IPT_UI_CONFIGURE)) |
| r1461 | r1462 | |
|---|---|---|
| 143 | 143 | { |
| 144 | 144 | char *eq = strchr(line, '='); |
| 145 | 145 | strcpy(system_name, eq + 1); |
| 146 | ||
| 146 | ||
| 147 | 147 | sprintf(system_filename, "%s/%s.htm", html_directory, system_name); |
| 148 | 148 | fprintf(html, "• <a href=\"%s\">%s</a>\n", system_filename, system_name); |
| 149 | ||
| 149 | ||
| 150 | 150 | systemcount++; |
| 151 | 151 | |
| 152 | 152 | html_system = fopen(system_filename, "w"); |
| 153 | ||
| 153 | ||
| 154 | 154 | if( !html_system ) |
| 155 | 155 | { |
| 156 | 156 | fprintf(stderr, "cannot create system_name file '%s'.\n", system_filename); |
| r1461 | r1462 | |
|---|---|---|
| 64 | 64 | return; |
| 65 | 65 | } |
| 66 | 66 | driver = attr_node->value; |
| 67 | ||
| 67 | ||
| 68 | 68 | /* does image creation support options? */ |
| 69 | 69 | module = imgtool_find_module(attr_node->value); |
| 70 | 70 | if (module && module->createimage_optguide && module->createimage_optspec) |
| r1461 | r1462 | |
| 677 | 677 | |
| 678 | 678 | attr_node = xml_get_attribute(node, "name"); |
| 679 | 679 | report_testcase_begin(attr_node ? attr_node->value : NULL); |
| 680 | ||
| 680 | ||
| 681 | 681 | memset(&state, 0, sizeof(state)); |
| 682 | 682 | |
| 683 | 683 | for (child_node = node->child; child_node; child_node = child_node->next) |
| r1461 | r1462 | |
|---|---|---|
| 79 | 79 | |
| 80 | 80 | /* test case for memory allocation system */ |
| 81 | 81 | test_memory_pools(); |
| 82 | ||
| 82 | ||
| 83 | 83 | /* expand wildcards so '*' can be used */ |
| 84 | 84 | expand_wildcards(&argc, &argv); |
| 85 | 85 | |
| r1461 | r1462 | |
| 91 | 91 | * have to init first */ |
| 92 | 92 | cpuintrf_init(NULL); |
| 93 | 93 | sndintrf_init(NULL); |
| 94 | ||
| 94 | ||
| 95 | 95 | /* register options */ |
| 96 | 96 | messtest_options = options_create(messtest_fail); |
| 97 | 97 | options_add_entries(messtest_options, messtest_option_entries); |
| r1461 | r1462 | |
|---|---|---|
| 247 | 247 | int pos, nextpos; |
| 248 | 248 | |
| 249 | 249 | vsnprintf(buffer, sizeof(buffer) / sizeof(buffer[0]), format, argptr); |
| 250 | ||
| 250 | ||
| 251 | 251 | pos = 0; |
| 252 | 252 | while(buffer[pos] != '\0') |
| 253 | 253 | { |
| r1461 | r1462 | |
| 619 | 619 | break; |
| 620 | 620 | view_index++; |
| 621 | 621 | } |
| 622 | ||
| 622 | ||
| 623 | 623 | if (view_name) |
| 624 | 624 | { |
| 625 | 625 | render_target_set_view(target, view_index); |
| r1461 | r1462 | |
| 752 | 752 | case MESSTEST_COMMAND_IMAGE_CREATE: |
| 753 | 753 | success = (image_create(image, astring_c(filepath), format_index, NULL) == INIT_PASS); |
| 754 | 754 | break; |
| 755 | ||
| 755 | ||
| 756 | 756 | case MESSTEST_COMMAND_IMAGE_LOAD: |
| 757 | 757 | success = (image_load(image, astring_c(filepath)) == INIT_PASS); |
| 758 | 758 | break; |
| r1461 | r1462 | |
| 1300 | 1300 | return; |
| 1301 | 1301 | } |
| 1302 | 1302 | new_command.u.image_args.device_type = device_type; |
| 1303 | ||
| 1303 | ||
| 1304 | 1304 | /* 'slot' attribute */ |
| 1305 | 1305 | attr_node = xml_get_attribute(node, "slot"); |
| 1306 | 1306 | new_command.u.image_args.device_slot = attr_node ? atoi(attr_node->value) : 0; |
| r1461 | r1462 | |
|---|---|---|
| 609 | 609 | state = STATE_ABORTED; |
| 610 | 610 | final_time = timer_get_time(); |
| 611 | 611 | if (final_time > 0.0) |
| 612 | dump_screenshot(); | |
| 612 | dump_screenshot(); | |
| 613 | 613 | } |
| 614 | 614 | */ |
| 615 | 615 | } |
| r1461 | r1462 | |
|---|---|---|
| 10 | 10 | #define IMGTERRS_H |
| 11 | 11 | |
| 12 | 12 | /* Error codes */ |
| 13 | typedef enum | |
| 13 | typedef enum | |
| 14 | 14 | { |
| 15 | 15 | IMGTOOLERR_SUCCESS, |
| 16 | 16 | IMGTOOLERR_OUTOFMEMORY, |
| r1461 | r1462 | |
|---|---|---|
| 19 | 19 | static char *utf8_from_latin1(const char *src) |
| 20 | 20 | { |
| 21 | 21 | char *buffer, *bufptr; |
| 22 | ||
| 22 | ||
| 23 | 23 | /* validate input */ |
| 24 | 24 | if (!src) |
| 25 | 25 | { |
| 26 | 26 | return NULL; |
| 27 | 27 | } |
| 28 | ||
| 28 | ||
| 29 | 29 | /* allocate space for result, twice the source len to be safe */ |
| 30 | 30 | buffer = (char *) malloc(strlen(src) * 2 + 1); |
| 31 | ||
| 31 | ||
| 32 | 32 | /* point to the start */ |
| 33 | 33 | bufptr = buffer; |
| 34 | ||
| 34 | ||
| 35 | 35 | do |
| 36 | 36 | { |
| 37 | 37 | unsigned char c = *src; |
| 38 | ||
| 38 | ||
| 39 | 39 | if (c < 0x80) |
| 40 | 40 | { |
| 41 | 41 | *bufptr++ = c; |
| r1461 | r1462 | |
| 48 | 48 | else |
| 49 | 49 | { |
| 50 | 50 | *bufptr++ = '\xc3'; |
| 51 | *bufptr++ = c - 0x40; | |
| 51 | *bufptr++ = c - 0x40; | |
| 52 | 52 | } |
| 53 | 53 | } while (*src++); |
| 54 | 54 | |
| r1461 | r1462 | |
| 70 | 70 | { |
| 71 | 71 | return NULL; |
| 72 | 72 | } |
| 73 | ||
| 73 | ||
| 74 | 74 | /* allocate space for result */ |
| 75 | 75 | buffer = (char *) malloc(strlen(src) + 1); |
| 76 | ||
| 76 | ||
| 77 | 77 | /* point to the start */ |
| 78 | 78 | bufptr = buffer; |
| 79 | ||
| 79 | ||
| 80 | 80 | do |
| 81 | 81 | { |
| 82 | 82 | unsigned char c = *src; |
| 83 | ||
| 83 | ||
| 84 | 84 | if (c < 0x80) |
| 85 | 85 | { |
| 86 | 86 | *bufptr++ = c; |
| r1461 | r1462 | |
| 102 | 102 | break; |
| 103 | 103 | } |
| 104 | 104 | } while(*src++); |
| 105 | ||
| 105 | ||
| 106 | 106 | return buffer; |
| 107 | 107 | } |
| 108 | 108 |
| r1461 | r1462 | |
|---|---|---|
| 29 | 29 | |
| 30 | 30 | case FLOPPY_ERROR_UNSUPPORTED: |
| 31 | 31 | return IMGTOOLERR_UNIMPLEMENTED; |
| 32 | ||
| 32 | ||
| 33 | 33 | default: |
| 34 | 34 | return IMGTOOLERR_UNEXPECTED; |
| 35 | 35 | } |
| r1461 | r1462 | |
| 340 | 340 | if (err) |
| 341 | 341 | goto done; |
| 342 | 342 | } |
| 343 | ||
| 343 | ||
| 344 | 344 | err = FLOPPY_ERROR_SUCCESS; |
| 345 | 345 | |
| 346 | 346 | done: |
| r1461 | r1462 | |
|---|---|---|
| 150 | 150 | IMGTOOLINFO_INT_DIRECTORY_EXTRA_BYTES, |
| 151 | 151 | IMGTOOLINFO_INT_PATH_SEPARATOR, |
| 152 | 152 | IMGTOOLINFO_INT_ALTERNATE_PATH_SEPARATOR, |
| 153 | IMGTOOLINFO_INT_PREFER_UCASE, | |
| 153 | IMGTOOLINFO_INT_PREFER_UCASE, | |
| 154 | 154 | IMGTOOLINFO_INT_INITIAL_PATH_SEPARATOR, |
| 155 | 155 | IMGTOOLINFO_INT_OPEN_IS_STRICT, |
| 156 | 156 | IMGTOOLINFO_INT_SUPPORTS_CREATION_TIME, |
| r1461 | r1462 | |
| 341 | 341 | const char *eoln; |
| 342 | 342 | |
| 343 | 343 | size_t image_extra_bytes; |
| 344 | ||
| 344 | ||
| 345 | 345 | /* flags */ |
| 346 | 346 | unsigned int initial_path_separator : 1; |
| 347 | 347 | unsigned int open_is_strict : 1; |
| r1461 | r1462 | |
|---|---|---|
| 99 | 99 | _sntprintf(buf, sizeof(buf) / sizeof(buf[0]), TEXT(".%s"), t_extension); |
| 100 | 100 | free(t_extension); |
| 101 | 101 | |
| 102 | control = CreateWindow(TEXT("BUTTON"), buf, style, | |
| 102 | control = CreateWindow(TEXT("BUTTON"), buf, style, | |
| 103 | 103 | xmargin, y, width, height, dialog, NULL, NULL, NULL); |
| 104 | 104 | if (!control) |
| 105 | 105 | return -1; |
| r1461 | r1462 | |
|---|---|---|
| 92 | 92 | struct foreach_entry *first_entry = NULL; |
| 93 | 93 | struct foreach_entry *last_entry = NULL; |
| 94 | 94 | struct foreach_entry *entry; |
| 95 | ||
| 95 | ||
| 96 | 96 | info = get_wimgtool_info(window); |
| 97 | 97 | |
| 98 | 98 | if (info->image) |
| r1461 | r1462 | |
| 126 | 126 | if (err) |
| 127 | 127 | return err; |
| 128 | 128 | |
| 129 | // if we have a path, prepend the path | |
| 129 | // if we have a path, prepend the path | |
| 130 | 130 | if (info->current_directory && info->current_directory[0]) |
| 131 | 131 | { |
| 132 | 132 | char path_separator = (char) imgtool_partition_get_info_int(info->partition, IMGTOOLINFO_INT_PATH_SEPARATOR); |
| r1461 | r1462 | |
| 669 | 669 | } |
| 670 | 670 | |
| 671 | 671 | win_set_window_text_utf8(window, buf); |
| 672 | ||
| 672 | ||
| 673 | 673 | for (i = 0; i < sizeof(statusbar_text) / sizeof(statusbar_text[0]); i++) |
| 674 | 674 | { |
| 675 | 675 | TCHAR *tempstr = statusbar_text[i] ? tstring_from_utf8(statusbar_text[i]) : NULL; |
| r1461 | r1462 | |
| 899 | 899 | snprintf(local_subpath, sizeof(local_subpath) / sizeof(local_subpath[0]), |
| 900 | 900 | "%s\\%s", local_path, entry.filename); |
| 901 | 901 | subpath = imgtool_partition_path_concatenate(partition, path, entry.filename); |
| 902 | ||
| 902 | ||
| 903 | 903 | if (entry.directory) |
| 904 | 904 | err = get_recursive_directory(partition, subpath, local_subpath); |
| 905 | 905 | else |
| r1461 | r1462 | |
| 1008 | 1008 | err = IMGTOOLERR_OUTOFMEMORY; |
| 1009 | 1009 | goto done; |
| 1010 | 1010 | } |
| 1011 | ||
| 1011 | ||
| 1012 | 1012 | // try to open the image |
| 1013 | 1013 | err = imgtool_image_open(module, filename, read_or_write, &image); |
| 1014 | 1014 | if ((ERRORCODE(err) == IMGTOOLERR_READONLY) && read_or_write) |
| r1461 | r1462 | |
| 1053 | 1053 | |
| 1054 | 1054 | // refresh the window |
| 1055 | 1055 | full_refresh_image(window); |
| 1056 | ||
| 1056 | ||
| 1057 | 1057 | done: |
| 1058 | 1058 | return err; |
| 1059 | 1059 | } |
| r1461 | r1462 | |
| 1083 | 1083 | goto done; |
| 1084 | 1084 | |
| 1085 | 1085 | module = find_filter_module(ofn.filter_index, TRUE); |
| 1086 | ||
| 1086 | ||
| 1087 | 1087 | err = imgtool_image_create(module, ofn.filename, resolution, NULL); |
| 1088 | 1088 | if (err) |
| 1089 | 1089 | goto done; |
| r1461 | r1462 | |
| 1264 | 1264 | ofi = (OPENFILENAME *) lparam; |
| 1265 | 1265 | info = (struct transfer_suggestion_info *) ofi->lCustData; |
| 1266 | 1266 | SetWindowLongPtr(dlgwnd, GWLP_USERDATA, (LONG_PTR) info); |
| 1267 | ||
| 1267 | ||
| 1268 | 1268 | for (i = 0; info->suggestions[i].viability; i++) |
| 1269 | 1269 | { |
| 1270 | 1270 | SendMessage(filter_combo, CB_ADDSTRING, 0, (LPARAM) info->suggestions[i].description); |
| r1461 | r1462 | |
| 1697 | 1697 | htinfo.pt.x = pt.x - r.left; |
| 1698 | 1698 | htinfo.pt.y = pt.y - r.top; |
| 1699 | 1699 | ListView_HitTest(info->listview, &htinfo); |
| 1700 | ||
| 1700 | ||
| 1701 | 1701 | if (htinfo.flags & LVHT_ONITEM) |
| 1702 | 1702 | { |
| 1703 | 1703 | memset(&entry, 0, sizeof(entry)); |
| r1461 | r1462 | |
| 1707 | 1707 | ListView_GetItem(info->listview, &item); |
| 1708 | 1708 | |
| 1709 | 1709 | selected_item = item.lParam; |
| 1710 | ||
| 1710 | ||
| 1711 | 1711 | if (selected_item < 0) |
| 1712 | 1712 | { |
| 1713 | 1713 | strcpy(entry.filename, ".."); |
| r1461 | r1462 | |
|---|---|---|
| 388 | 388 | HWND ok_button, cancel_button; |
| 389 | 389 | RECT r1, r2; |
| 390 | 390 | LONG_PTR l; |
| 391 | ||
| 391 | ||
| 392 | 392 | switch(message) |
| 393 | 393 | { |
| 394 | 394 | case WM_INITDIALOG: |
| r1461 | r1462 | |
|---|---|---|
| 369 | 369 | void win_sectorview_dialog(HWND parent, imgtool_image *image) |
| 370 | 370 | { |
| 371 | 371 | struct sectorview_info info; |
| 372 | ||
| 372 | ||
| 373 | 373 | memset(&info, 0, sizeof(info)); |
| 374 | 374 | info.image = image; |
| 375 | 375 |
| r1461 | r1462 | |
|---|---|---|
| 28 | 28 | int i; |
| 29 | 29 | |
| 30 | 30 | GetModuleFileName(GetModuleHandle(NULL), buf, buflen); |
| 31 | ||
| 31 | ||
| 32 | 32 | for (i = 0; buf[i]; i++) |
| 33 | 33 | buf[i] = toupper(buf[i]); |
| 34 | 34 | buf[i++] = ' '; |
| r1461 | r1462 | |
|---|---|---|
| 22 | 22 | int pos, rc = -1; |
| 23 | 23 | imgtoolerr_t err; |
| 24 | 24 | HACCEL accel = NULL; |
| 25 | ||
| 25 | ||
| 26 | 26 | // initialize Windows classes |
| 27 | 27 | InitCommonControls(); |
| 28 | 28 | if (!wimgtool_registerclass()) |
| r1461 | r1462 | |
| 61 | 61 | command_line[strlen(command_line)-1] = '\0'; |
| 62 | 62 | pos++; |
| 63 | 63 | } |
| 64 | ||
| 64 | ||
| 65 | 65 | err = wimgtool_open_image(window, NULL, command_line + pos, OSD_FOPEN_RW); |
| 66 | 66 | if (err) |
| 67 | 67 | wimgtool_report_error(window, err, command_line + pos, NULL); |
| r1461 | r1462 | |
|---|---|---|
| 199 | 199 | struct hexview_info *info; |
| 200 | 200 | |
| 201 | 201 | info = get_hexview_info(hexview); |
| 202 | ||
| 202 | ||
| 203 | 203 | switch(message) |
| 204 | 204 | { |
| 205 | 205 | case WM_CREATE: |
| r1461 | r1462 | |
|---|---|---|
| 43 | 43 | #define IDC_STATIC -1 |
| 44 | 44 | |
| 45 | 45 | // Next default values for new objects |
| 46 | // | |
| 46 | // | |
| 47 | 47 | #ifdef APSTUDIO_INVOKED |
| 48 | 48 | #ifndef APSTUDIO_READONLY_SYMBOLS |
| 49 | 49 | #define _APS_NEXT_RESOURCE_VALUE 126 |
| r1461 | r1462 | |
|---|---|---|
| 146 | 146 | static char *normalize_filename(imgtool_partition *partition, const char *src) |
| 147 | 147 | { |
| 148 | 148 | imgtool_charset charset; |
| 149 | ||
| 149 | ||
| 150 | 150 | /* get charset from module */ |
| 151 | charset = (imgtool_charset) (int) imgtool_partition_get_info_int(partition, IMGTOOLINFO_INT_CHARSET); | |
| 151 | charset = (imgtool_charset) (int) imgtool_partition_get_info_int(partition, IMGTOOLINFO_INT_CHARSET); | |
| 152 | 152 | |
| 153 | 153 | /* and dupe it */ |
| 154 | 154 | return native_from_utf8(charset, src); |
| r1461 | r1462 | |
| 1077 | 1077 | memset(image, '\0', size); |
| 1078 | 1078 | image->pool = pool; |
| 1079 | 1079 | image->module = module; |
| 1080 | ||
| 1080 | ||
| 1081 | 1081 | /* actually call create or open */ |
| 1082 | 1082 | if (read_or_write == OSD_FOPEN_RW_CREATE) |
| 1083 | 1083 | err = module->create(image, f, createopts); |
| r1461 | r1462 | |
| 1239 | 1239 | char path_separator, alt_path_separator; |
| 1240 | 1240 | const char *s; |
| 1241 | 1241 | int in_path_separator, i, j; |
| 1242 | ||
| 1242 | ||
| 1243 | 1243 | path_separator = partition->path_separator; |
| 1244 | 1244 | alt_path_separator = partition->alternate_path_separator; |
| 1245 | 1245 | |
| r1461 | r1462 | |
| 1256 | 1256 | err = IMGTOOLERR_FILENOTFOUND; |
| 1257 | 1257 | goto done; |
| 1258 | 1258 | } |
| 1259 | ||
| 1259 | ||
| 1260 | 1260 | if (path_separator == '\0') |
| 1261 | 1261 | { |
| 1262 | 1262 | if (flags & PATH_MUSTBEDIR) |
| r1461 | r1462 | |
| 1445 | 1445 | err = IMGTOOLERR_BADFILENAME | IMGTOOLERR_SRC_FUNCTIONALITY; |
| 1446 | 1446 | goto done; |
| 1447 | 1447 | } |
| 1448 | ||
| 1449 | path = new_fname; | |
| 1450 | 1448 | |
| 1449 | path = new_fname; | |
| 1450 | ||
| 1451 | 1451 | /* cannonicalize path */ |
| 1452 | 1452 | err = cannonicalize_path(partition, PATH_LEAVENULLALONE, &path, &alloc_path); |
| 1453 | 1453 | if (err) |
| r1461 | r1462 | |
| 1490 | 1490 | err = IMGTOOLERR_BADFILENAME | IMGTOOLERR_SRC_FUNCTIONALITY; |
| 1491 | 1491 | goto done; |
| 1492 | 1492 | } |
| 1493 | ||
| 1493 | ||
| 1494 | 1494 | path = new_fname; |
| 1495 | ||
| 1495 | ||
| 1496 | 1496 | /* cannonicalize path */ |
| 1497 | 1497 | err = cannonicalize_path(partition, PATH_LEAVENULLALONE, &path, &alloc_path); |
| 1498 | 1498 | if (err) |
| r1461 | r1462 | |
| 1598 | 1598 | err = IMGTOOLERR_BADFILENAME | IMGTOOLERR_SRC_FUNCTIONALITY; |
| 1599 | 1599 | goto done; |
| 1600 | 1600 | } |
| 1601 | ||
| 1601 | ||
| 1602 | 1602 | path = new_fname; |
| 1603 | ||
| 1603 | ||
| 1604 | 1604 | /* cannonicalize path */ |
| 1605 | 1605 | err = cannonicalize_path(partition, 0, &path, &alloc_path); |
| 1606 | 1606 | if (err) |
| r1461 | r1462 | |
| 2064 | 2064 | err = IMGTOOLERR_BADFILENAME | IMGTOOLERR_SRC_FUNCTIONALITY; |
| 2065 | 2065 | goto done; |
| 2066 | 2066 | } |
| 2067 | ||
| 2067 | ||
| 2068 | 2068 | filename = new_fname; |
| 2069 | ||
| 2069 | ||
| 2070 | 2070 | err = imgtool_partition_read_file(partition, filename, fork, f, filter); |
| 2071 | 2071 | if (err) |
| 2072 | 2072 | goto done; |
| r1461 | r1462 | |
| 2095 | 2095 | imgtool_stream *f = NULL; |
| 2096 | 2096 | imgtool_charset charset; |
| 2097 | 2097 | char *alloc_newfname = NULL; |
| 2098 | ||
| 2098 | ||
| 2099 | 2099 | if (!newfname) |
| 2100 | 2100 | newfname = (const char *) osd_basename((char *) source); |
| 2101 | 2101 | |
| 2102 | charset = (imgtool_charset) (int) imgtool_partition_get_info_int(partition, IMGTOOLINFO_INT_CHARSET); | |
| 2102 | charset = (imgtool_charset) (int) imgtool_partition_get_info_int(partition, IMGTOOLINFO_INT_CHARSET); | |
| 2103 | 2103 | if (charset != IMGTOOL_CHARSET_UTF8) |
| 2104 | 2104 | { |
| 2105 | /* convert to native format */ | |
| 2105 | /* convert to native format */ | |
| 2106 | 2106 | alloc_newfname = native_from_utf8(charset, newfname); |
| 2107 | 2107 | if (alloc_newfname == NULL) |
| 2108 | 2108 | { |
| r1461 | r1462 | |
| 2140 | 2140 | imgtoolerr_t err; |
| 2141 | 2141 | char *alloc_path = NULL; |
| 2142 | 2142 | char *new_fname = NULL; |
| 2143 | ||
| 2143 | ||
| 2144 | 2144 | if (!partition->delete_file) |
| 2145 | 2145 | { |
| 2146 | 2146 | err = IMGTOOLERR_UNIMPLEMENTED | IMGTOOLERR_SRC_FUNCTIONALITY; |
| r1461 | r1462 | |
| 2153 | 2153 | err = IMGTOOLERR_BADFILENAME | IMGTOOLERR_SRC_FUNCTIONALITY; |
| 2154 | 2154 | goto done; |
| 2155 | 2155 | } |
| 2156 | ||
| 2156 | ||
| 2157 | 2157 | fname = new_fname; |
| 2158 | ||
| 2158 | ||
| 2159 | 2159 | /* cannonicalize path */ |
| 2160 | 2160 | err = cannonicalize_path(partition, 0, &fname, &alloc_path); |
| 2161 | 2161 | if (err) |
| r1461 | r1462 | |
| 2201 | 2201 | err = IMGTOOLERR_BADFILENAME | IMGTOOLERR_SRC_FUNCTIONALITY; |
| 2202 | 2202 | goto done; |
| 2203 | 2203 | } |
| 2204 | ||
| 2204 | ||
| 2205 | 2205 | path = new_fname; |
| 2206 | ||
| 2206 | ||
| 2207 | 2207 | /* cannonicalize path */ |
| 2208 | 2208 | err = cannonicalize_path(partition, 0, &path, &alloc_path); |
| 2209 | 2209 | if (err) |
| r1461 | r1462 | |
| 2233 | 2233 | imgtoolerr_t err; |
| 2234 | 2234 | char *alloc_path = NULL; |
| 2235 | 2235 | char *new_path = NULL; |
| 2236 | ||
| 2236 | ||
| 2237 | 2237 | /* implemented? */ |
| 2238 | 2238 | if (!partition->create_dir) |
| 2239 | 2239 | { |
| r1461 | r1462 | |
| 2247 | 2247 | err = IMGTOOLERR_BADFILENAME | IMGTOOLERR_SRC_FUNCTIONALITY; |
| 2248 | 2248 | goto done; |
| 2249 | 2249 | } |
| 2250 | ||
| 2250 | ||
| 2251 | 2251 | path = new_path; |
| 2252 | ||
| 2252 | ||
| 2253 | 2253 | /* cannonicalize path */ |
| 2254 | 2254 | err = cannonicalize_path(partition, PATH_MUSTBEDIR, &path, &alloc_path); |
| 2255 | 2255 | if (err) |
| r1461 | r1462 | |
| 2279 | 2279 | imgtoolerr_t err; |
| 2280 | 2280 | char *alloc_path = NULL; |
| 2281 | 2281 | char *new_path = NULL; |
| 2282 | ||
| 2282 | ||
| 2283 | 2283 | /* implemented? */ |
| 2284 | 2284 | if (!partition->delete_dir) |
| 2285 | 2285 | { |
| 2286 | 2286 | err = IMGTOOLERR_UNIMPLEMENTED | IMGTOOLERR_SRC_FUNCTIONALITY; |
| 2287 | 2287 | goto done; |
| 2288 | 2288 | } |
| 2289 | ||
| 2289 | ||
| 2290 | 2290 | new_path = normalize_filename(partition, path); |
| 2291 | 2291 | if (new_path == NULL) |
| 2292 | 2292 | { |
| r1461 | r1462 | |
| 2295 | 2295 | } |
| 2296 | 2296 | |
| 2297 | 2297 | path = new_path; |
| 2298 | ||
| 2298 | ||
| 2299 | 2299 | /* cannonicalize path */ |
| 2300 | 2300 | err = cannonicalize_path(partition, PATH_MUSTBEDIR, &path, &alloc_path); |
| 2301 | 2301 | if (err) |
| r1461 | r1462 | |
| 2589 | 2589 | |
| 2590 | 2590 | new_path = normalize_filename(partition, path); |
| 2591 | 2591 | path = new_path; |
| 2592 | ||
| 2592 | ||
| 2593 | 2593 | err = cannonicalize_path(partition, PATH_MUSTBEDIR, &path, &alloc_path); |
| 2594 | 2594 | if (err) |
| 2595 | 2595 | goto done; |
| r1461 | r1462 | |
| 2667 | 2667 | if (err) |
| 2668 | 2668 | return markerrorsource(err); |
| 2669 | 2669 | |
| 2670 | charset = imgtool_partition_get_info_int(partition, IMGTOOLINFO_INT_CHARSET); | |
| 2671 | ||
| 2670 | charset = imgtool_partition_get_info_int(partition, IMGTOOLINFO_INT_CHARSET); | |
| 2671 | ||
| 2672 | 2672 | if (charset) |
| 2673 | 2673 | { |
| 2674 | 2674 | char *new_fname = utf8_from_native(charset, ent->filename); |
| 2675 | ||
| 2675 | ||
| 2676 | 2676 | if (!new_fname) |
| 2677 | 2677 | return IMGTOOLERR_BADFILENAME; |
| 2678 | ||
| 2678 | ||
| 2679 | 2679 | strcpy(ent->filename, new_fname); |
| 2680 | 2680 | free(new_fname); |
| 2681 | 2681 | } |
| 2682 | ||
| 2682 | ||
| 2683 | 2683 | /* don't trust the module! */ |
| 2684 | 2684 | if (!partition->supports_creation_time && (ent->creation_time != 0)) |
| 2685 | 2685 | { |
| r1461 | r1462 | |
|---|---|---|
| 74 | 74 | else |
| 75 | 75 | { |
| 76 | 76 | address = (UINT16) pick_integer_le(line_header, 0, 2); |
| 77 | line_number = (UINT16) pick_integer_le(line_header, 2, 2); | |
| 77 | line_number = (UINT16) pick_integer_le(line_header, 2, 2); | |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | stream_printf(destf, "%u ", (unsigned) line_number); |
| r1461 | r1462 | |
| 84 | 84 | { |
| 85 | 85 | if (b == 0x22) |
| 86 | 86 | in_string = in_string ? FALSE : TRUE; |
| 87 | ||
| 87 | ||
| 88 | 88 | if ((b & 0x80) && (!in_string)) |
| 89 | 89 | { |
| 90 | 90 | token = NULL; |
| r1461 | r1462 | |
|---|---|---|
| 974 | 974 | |
| 975 | 975 | if (img_format == if_harddisk) |
| 976 | 976 | { |
| 977 | const hard_disk_info *info; | |
| 977 | const hard_disk_info *info; | |
| 978 | 978 | |
| 979 | 979 | err = imghd_open(file_handle, &l1_img->harddisk_handle); |
| 980 | 980 | if (err) |
| r1461 | r1462 | |
| 1650 | 1650 | } win_fdr; |
| 1651 | 1651 | |
| 1652 | 1652 | /* |
| 1653 | tifile header: stand-alone file | |
| 1653 | tifile header: stand-alone file | |
| 1654 | 1654 | */ |
| 1655 | 1655 | typedef struct tifile_header |
| 1656 | 1656 | { |
| r1461 | r1462 | |
| 4187 | 4187 | } |
| 4188 | 4188 | |
| 4189 | 4189 | /* |
| 4190 | Open the disk catalog for enumeration | |
| 4190 | Open the disk catalog for enumeration | |
| 4191 | 4191 | */ |
| 4192 | 4192 | static imgtoolerr_t dsk_image_beginenum(imgtool_directory *enumeration, const char *path) |
| 4193 | 4193 | { |
| r1461 | r1462 | |
| 4308 | 4308 | } |
| 4309 | 4309 | |
| 4310 | 4310 | /* |
| 4311 | Open the disk catalog for enumeration | |
| 4311 | Open the disk catalog for enumeration | |
| 4312 | 4312 | */ |
| 4313 | 4313 | static imgtoolerr_t win_image_beginenum(imgtool_directory *enumeration, const char *path) |
| 4314 | 4314 | { |
| r1461 | r1462 | |
|---|---|---|
| 425 | 425 | } |
| 426 | 426 | } |
| 427 | 427 | while(strcmp(ent.fname, fname)); |
| 428 | ||
| 428 | ||
| 429 | 429 | imgwave_closeenum(enumeration); |
| 430 | 430 | enumeration = NULL; |
| 431 | 431 |
| r1461 | r1462 | |
|---|---|---|
| 348 | 348 | return free_lsns; |
| 349 | 349 | } |
| 350 | 350 | |
| 351 | ||
| 352 | 351 | |
| 352 | ||
| 353 | 353 | static imgtoolerr_t os9_corrupt_file_error(const struct os9_fileinfo *file_info) |
| 354 | 354 | { |
| 355 | 355 | imgtoolerr_t err; |
| r1461 | r1462 | |
| 527 | 527 | { |
| 528 | 528 | entry_index = index; |
| 529 | 529 | entry_lsn = os9_lookup_lsn(img, &dir_info, &entry_index); |
| 530 | ||
| 530 | ||
| 531 | 531 | err = os9_read_lsn(img, entry_lsn, entry_index, entry, sizeof(entry)); |
| 532 | 532 | if (err) |
| 533 | 533 | goto done; |
| r1461 | r1462 | |
| 544 | 544 | if (!strcmp(path, filename)) |
| 545 | 545 | break; |
| 546 | 546 | } |
| 547 | ||
| 547 | ||
| 548 | 548 | } |
| 549 | 549 | |
| 550 | 550 | /* at the end of the file? */ |
| r1461 | r1462 | |
| 562 | 562 | err = os9_allocate_lsn(img, &allocated_lsn); |
| 563 | 563 | if (err) |
| 564 | 564 | goto done; |
| 565 | ||
| 565 | ||
| 566 | 566 | /* write the file */ |
| 567 | 567 | memset(block, 0, sizeof(block)); |
| 568 | 568 | place_integer_be(block, 0, 1, 0x1B | ((create == CREATE_DIR) ? 0x80 : 0x00)); |
| 569 | 569 | err = os9_write_lsn(img, allocated_lsn, 0, block, sizeof(block)); |
| 570 | 570 | if (err) |
| 571 | 571 | goto done; |
| 572 | ||
| 572 | ||
| 573 | 573 | if( free_entry_index == 0xffffffff ) |
| 574 | 574 | { |
| 575 | 575 | /* expand the directory to hold the new entry */ |
| r1461 | r1462 | |
| 761 | 761 | place_integer_be(header, 17, 2, sectors); |
| 762 | 762 | place_string(header, 31, 32, title); |
| 763 | 763 | place_integer_be(header, 103, 2, sector_bytes / 256); |
| 764 | ||
| 764 | ||
| 765 | 765 | /* path descriptor options */ |
| 766 | 766 | place_integer_be(header, 0x3f+0x00, 1, 1); /* device class */ |
| 767 | 767 | place_integer_be(header, 0x3f+0x01, 1, 1); /* drive number */ |
| r1461 | r1462 | |
| 773 | 773 | place_integer_be(header, 0x3f+0x0b, 2, sectors); /* sectors on track zero */ |
| 774 | 774 | place_integer_be(header, 0x3f+0x0d, 1, 3); /* sector interleave factor */ |
| 775 | 775 | place_integer_be(header, 0x3f+0x0e, 1, 8); /* default sectors per allocation */ |
| 776 | ||
| 776 | ||
| 777 | 777 | err = floppy_write_sector(imgtool_floppy(img), 0, 0, first_sector_id, 0, header, sector_bytes); |
| 778 | 778 | if (err) |
| 779 | 779 | goto done; |
| r1461 | r1462 | |
| 783 | 783 | for (i = 0; i < allocation_bitmap_lsns; i++) |
| 784 | 784 | { |
| 785 | 785 | memset(header, 0x00, sector_bytes); |
| 786 | ||
| 786 | ||
| 787 | 787 | if (total_allocated_sectors > (8 * 256)) |
| 788 | 788 | { |
| 789 | 789 | memset(header, 0xff, sector_bytes); |
| r1461 | r1462 | |
| 793 | 793 | { |
| 794 | 794 | int offset; |
| 795 | 795 | UINT8 mask; |
| 796 | ||
| 796 | ||
| 797 | 797 | while( total_allocated_sectors >= 0 ) |
| 798 | 798 | { |
| 799 | 799 | offset = total_allocated_sectors / 8; |
| r1461 | r1462 | |
| 803 | 803 | total_allocated_sectors--; |
| 804 | 804 | } |
| 805 | 805 | } |
| 806 | ||
| 806 | ||
| 807 | 807 | err = floppy_write_sector(imgtool_floppy(img), 0, 0, first_sector_id + 1 + i, 0, header, sector_bytes); |
| 808 | 808 | if (err) |
| 809 | 809 | goto done; |
| r1461 | r1462 | |
| 959 | 959 | |
| 960 | 960 | /* fill out imgtool_dirent structure */ |
| 961 | 961 | snprintf(ent->filename, sizeof(ent->filename) / sizeof(ent->filename[0]), "%s", filename); |
| 962 | snprintf(ent->attr, sizeof(ent->attr) / sizeof(ent->attr[0]), "%c%c%c%c%c%c%c%c", | |
| 962 | snprintf(ent->attr, sizeof(ent->attr) / sizeof(ent->attr[0]), "%c%c%c%c%c%c%c%c", | |
| 963 | 963 | file_info.directory ? 'd' : '-', |
| 964 | 964 | file_info.non_sharable ? 's' : '-', |
| 965 | 965 | file_info.public_execute ? 'x' : '-', |
| r1461 | r1462 | |
|---|---|---|
| 98 | 98 | } |
| 99 | 99 | if (err) |
| 100 | 100 | return err; |
| 101 | ||
| 101 | ||
| 102 | 102 | /* If block is not a filename block, fail */ |
| 103 | 103 | if (blk.type != COCOCAS_BLOCKTYPE_FILENAME) |
| 104 | 104 | return IMGTOOLERR_CORRUPTIMAGE; |
| r1461 | r1462 | |
| 126 | 126 | |
| 127 | 127 | if (blk.type != COCOCAS_BLOCKTYPE_EOF) |
| 128 | 128 | return IMGTOOLERR_CORRUPTIMAGE; |
| 129 | ||
| 129 | ||
| 130 | 130 | ent->filesize = filesize; |
| 131 | 131 | |
| 132 | 132 | return 0; |
| r1461 | r1462 | |
| 141 | 141 | err = readblock(img, &blk); |
| 142 | 142 | if (err) |
| 143 | 143 | return err; |
| 144 | ||
| 144 | ||
| 145 | 145 | /* If block is not a filename block, fail */ |
| 146 | 146 | if (blk.type != COCOCAS_BLOCKTYPE_FILENAME) |
| 147 | 147 | return IMGTOOLERR_CORRUPTIMAGE; |
| r1461 | r1462 | |
| 158 | 158 | |
| 159 | 159 | if (blk.type != COCOCAS_BLOCKTYPE_EOF) |
| 160 | 160 | return IMGTOOLERR_CORRUPTIMAGE; |
| 161 | ||
| 161 | ||
| 162 | 162 | return 0; |
| 163 | 163 | } |
| 164 | 164 |
| r1461 | r1462 | |
|---|---|---|
| 25 | 25 | |
| 26 | 26 | Notes: |
| 27 | 27 | |
| 28 | - 2"8 QDD actually contain a single spiraling track, with 400 128-byte | |
| 28 | - 2"8 QDD actually contain a single spiraling track, with 400 128-byte | |
| 29 | 29 | sectors; however, the filesystem considers it has 25 virtual tracks of |
| 30 | 16 sectors => we do the same in imgtool (but thomflop.c uses a 400-sector | |
| 30 | 16 sectors => we do the same in imgtool (but thomflop.c uses a 400-sector | |
| 31 | 31 | addressing to emulate the device hardware) |
| 32 | 32 | |
| 33 | 33 | - tracks always have 16 sectors, this is requred by the filesystem |
| 34 | 34 | |
| 35 | 35 | - two-sided floppies are handled as two one-sided floppies in two |
| 36 | 36 | logical floppy drives on the original Thomsons; each has its own |
| 37 | independent FAT and directory. | |
| 37 | independent FAT and directory. | |
| 38 | 38 | In imgtool, we handle two-sided images as two partitions. |
| 39 | 39 | For now, only 3"1/2 .fd and QDD .qd files can be two-sided. |
| 40 | 40 | |
| r1461 | r1462 | |
| 53 | 53 | Depending on the number of tracks, there can be 50, 80 or 160 blocks. |
| 54 | 54 | |
| 55 | 55 | Filesystem data always occupy track 20, whatever the floppy geometry. |
| 56 | ||
| 57 | * sector 1: | |
| 56 | ||
| 57 | * sector 1: | |
| 58 | 58 | - bytes 0-7: floppy name |
| 59 | 59 | - remaining bytes: undocumented, seem unused |
| 60 | 60 | |
| r1461 | r1462 | |
| 77 | 77 | Note: in single density, we can reference only 127 blocks. This is not |
| 78 | 78 | a problem because single density floppies can only have 50 or 80 blocks, |
| 79 | 79 | never 160. |
| 80 | ||
| 80 | ||
| 81 | 81 | * sector 3-16: directory |
| 82 | 82 | |
| 83 | 83 | no subdirectories |
| r1461 | r1462 | |
| 162 | 162 | } thom_dirent; |
| 163 | 163 | |
| 164 | 164 | |
| 165 | static void thom_basic_get_info(const imgtool_class *clas, UINT32 param, | |
| 165 | static void thom_basic_get_info(const imgtool_class *clas, UINT32 param, | |
| 166 | 166 | union imgtoolinfo *info); |
| 167 | 167 | |
| 168 | static UINT8* thom_get_sector(thom_floppy* f, unsigned head, | |
| 168 | static UINT8* thom_get_sector(thom_floppy* f, unsigned head, | |
| 169 | 169 | unsigned track, unsigned sector); |
| 170 | 170 | |
| 171 | 171 | |
| r1461 | r1462 | |
| 183 | 183 | { |
| 184 | 184 | thom_floppy* f = (thom_floppy*) imgtool_image_extra_bytes( img ); |
| 185 | 185 | int size = stream_size( stream ); |
| 186 | ||
| 186 | ||
| 187 | 187 | f->stream = stream; |
| 188 | 188 | f->modified = 0; |
| 189 | 189 | |
| r1461 | r1462 | |
| 197 | 197 | f->heads = 1; |
| 198 | 198 | break; |
| 199 | 199 | |
| 200 | case 163840: | |
| 200 | case 163840: | |
| 201 | 201 | f->tracks = 40; |
| 202 | 202 | f->sector_size = 256; |
| 203 | 203 | f->sectuse_size = 255; |
| r1461 | r1462 | |
| 238 | 238 | default: |
| 239 | 239 | return IMGTOOLERR_CORRUPTIMAGE; |
| 240 | 240 | } |
| 241 | ||
| 241 | ||
| 242 | 242 | assert( size == f->heads * f->tracks * 16 * f->sector_size ); |
| 243 | 243 | |
| 244 | 244 | stream_seek( stream, 0, SEEK_SET ); |
| r1461 | r1462 | |
| 266 | 266 | |
| 267 | 267 | /*********************** .sap format ************************/ |
| 268 | 268 | |
| 269 | /* SAP format, Copyright 1998 by Alexandre Pukall | |
| 269 | /* SAP format, Copyright 1998 by Alexandre Pukall | |
| 270 | 270 | |
| 271 | 271 | image is composed of: |
| 272 | 272 | - byte 0: version (0 or 1) |
| 273 | 273 | - bytes 1..65: signature |
| 274 | 274 | - bytes 66..end: sectors |
| 275 | ||
| 275 | ||
| 276 | 276 | each sector is composed of |
| 277 | 277 | - a 4-byte header: |
| 278 | 278 | . byte 0: format |
| r1461 | r1462 | |
| 313 | 313 | { |
| 314 | 314 | thom_floppy* f = (thom_floppy*) imgtool_image_extra_bytes( img ); |
| 315 | 315 | UINT8 buf[262]; |
| 316 | ||
| 316 | ||
| 317 | 317 | f->stream = stream; |
| 318 | 318 | f->modified = 0; |
| 319 | 319 | |
| r1461 | r1462 | |
| 342 | 342 | break; |
| 343 | 343 | default: return IMGTOOLERR_CORRUPTIMAGE; |
| 344 | 344 | } |
| 345 | ||
| 345 | ||
| 346 | 346 | stream_seek( stream, 66, SEEK_SET ); |
| 347 | 347 | while ( 1) { |
| 348 | 348 | int i, sector, track; |
| 349 | 349 | UINT16 crc; |
| 350 | 350 | |
| 351 | 351 | /* load sector */ |
| 352 | if ( stream_read( stream, buf, 6 + f->sector_size ) < 6 + f->sector_size ) | |
| 352 | if ( stream_read( stream, buf, 6 + f->sector_size ) < 6 + f->sector_size ) | |
| 353 | 353 | break; |
| 354 | 354 | |
| 355 | 355 | /* parse sector header */ |
| r1461 | r1462 | |
| 389 | 389 | logerror( "thom_diskimage_close_sap: write error\n" ); |
| 390 | 390 | return; |
| 391 | 391 | } |
| 392 | ||
| 392 | ||
| 393 | 393 | for ( track = 0; track < f->tracks; track++ ) |
| 394 | 394 | for ( sector = 1; sector <= 16; sector++ ) { |
| 395 | 395 | |
| r1461 | r1462 | |
| 398 | 398 | buf[1] = 0; |
| 399 | 399 | buf[2] = track; |
| 400 | 400 | buf[3] = sector; |
| 401 | memcpy( buf + 4, | |
| 401 | memcpy( buf + 4, | |
| 402 | 402 | thom_get_sector( f, 0, track, sector), f->sector_size ); |
| 403 | 403 | |
| 404 | 404 | /* compute crc */ |
| r1461 | r1462 | |
| 410 | 410 | for ( i = 0; i < f->sector_size; i++ ) buf[ i + 4 ] ^= sap_magic_num; |
| 411 | 411 | |
| 412 | 412 | /* save */ |
| 413 | if ( stream_write( f->stream, buf, f->sector_size + 6 ) < | |
| 413 | if ( stream_write( f->stream, buf, f->sector_size + 6 ) < | |
| 414 | 414 | f->sector_size + 6 ) { |
| 415 | 415 | logerror( "thom_diskimage_close_sap: write error\n" ); |
| 416 | 416 | return; |
| 417 | 417 | } |
| 418 | 418 | } |
| 419 | 419 | } |
| 420 | ||
| 420 | ||
| 421 | 421 | stream_close( f->stream ); |
| 422 | 422 | } |
| 423 | 423 | |
| 424 | 424 | |
| 425 | 425 | /*********************** low-level functions *********************/ |
| 426 | 426 | |
| 427 | static UINT8* thom_get_sector(thom_floppy* f, unsigned head, | |
| 427 | static UINT8* thom_get_sector(thom_floppy* f, unsigned head, | |
| 428 | 428 | unsigned track, unsigned sector) |
| 429 | 429 | { |
| 430 | 430 | assert( head < f->heads); |
| 431 | 431 | assert( track < f->tracks ); |
| 432 | 432 | assert( sector > 0 && sector <= 16 ); |
| 433 | return & f->data[ ( (head * f->tracks + track) * 16 + (sector-1) ) * | |
| 433 | return & f->data[ ( (head * f->tracks + track) * 16 + (sector-1) ) * | |
| 434 | 434 | f->sector_size ]; |
| 435 | 435 | } |
| 436 | 436 | |
| r1461 | r1462 | |
| 553 | 553 | } |
| 554 | 554 | } |
| 555 | 555 | |
| 556 | static void thom_set_dirent(thom_floppy* f, unsigned head, | |
| 556 | static void thom_set_dirent(thom_floppy* f, unsigned head, | |
| 557 | 557 | unsigned n, thom_dirent* d) |
| 558 | 558 | { |
| 559 | 559 | UINT8* base = thom_get_sector( f, head, 20, 3 ) + n * 32; |
| r1461 | r1462 | |
| 774 | 774 | d->lastsectsize = size; |
| 775 | 775 | break; |
| 776 | 776 | } |
| 777 | ||
| 777 | ||
| 778 | 778 | /* find next free block & update fat */ |
| 779 | 779 | i = block; |
| 780 | 780 | for ( block++; block < nbblocks && fat[ block + 1 ] != 0xff; block++ ); |
| r1461 | r1462 | |
| 795 | 795 | |
| 796 | 796 | /********************** module functions ***********************/ |
| 797 | 797 | |
| 798 | static imgtoolerr_t thom_get_sector_size(imgtool_image* img, UINT32 track, | |
| 799 | UINT32 head, UINT32 sector, | |
| 798 | static imgtoolerr_t thom_get_sector_size(imgtool_image* img, UINT32 track, | |
| 799 | UINT32 head, UINT32 sector, | |
| 800 | 800 | UINT32 *sector_size) |
| 801 | 801 | { |
| 802 | 802 | thom_floppy* f = (thom_floppy*) imgtool_image_extra_bytes( img ); |
| 803 | ||
| 803 | ||
| 804 | 804 | if ( head >= f->heads || sector < 1 || sector > 16 || track >= f->tracks ) { |
| 805 | 805 | if ( sector_size ) *sector_size = 0; |
| 806 | 806 | return IMGTOOLERR_SEEKERROR; |
| r1461 | r1462 | |
| 809 | 809 | return IMGTOOLERR_SUCCESS; |
| 810 | 810 | } |
| 811 | 811 | |
| 812 | static imgtoolerr_t thom_get_geometry(imgtool_image* img, UINT32* tracks, | |
| 812 | static imgtoolerr_t thom_get_geometry(imgtool_image* img, UINT32* tracks, | |
| 813 | 813 | UINT32* heads, UINT32* sectors) |
| 814 | 814 | { |
| 815 | 815 | thom_floppy* f = (thom_floppy*) imgtool_image_extra_bytes( img ); |
| r1461 | r1462 | |
| 819 | 819 | return IMGTOOLERR_SUCCESS; |
| 820 | 820 | } |
| 821 | 821 | |
| 822 | static imgtoolerr_t thom_read_sector(imgtool_image* img, UINT32 track, | |
| 823 | UINT32 head, UINT32 sector, void *buf, | |
| 822 | static imgtoolerr_t thom_read_sector(imgtool_image* img, UINT32 track, | |
| 823 | UINT32 head, UINT32 sector, void *buf, | |
| 824 | 824 | size_t len) |
| 825 | 825 | { |
| 826 | 826 | thom_floppy* f = (thom_floppy*) imgtool_image_extra_bytes( img ); |
| r1461 | r1462 | |
| 831 | 831 | return IMGTOOLERR_SUCCESS; |
| 832 | 832 | } |
| 833 | 833 | |
| 834 | static imgtoolerr_t thom_write_sector(imgtool_image *img, UINT32 track, | |
| 835 | UINT32 head, UINT32 sector, | |
| 834 | static imgtoolerr_t thom_write_sector(imgtool_image *img, UINT32 track, | |
| 835 | UINT32 head, UINT32 sector, | |
| 836 | 836 | const void *buf, size_t len) |
| 837 | 837 | { |
| 838 | 838 | thom_floppy* f = (thom_floppy*) imgtool_image_extra_bytes( img ); |
| r1461 | r1462 | |
| 861 | 861 | |
| 862 | 862 | /* each side of a floppy has its own filesystem, we treat them as'partitions' |
| 863 | 863 | */ |
| 864 | static imgtoolerr_t thom_list_partitions(imgtool_image *img, | |
| 865 | imgtool_partition_info *partitions, | |
| 864 | static imgtoolerr_t thom_list_partitions(imgtool_image *img, | |
| 865 | imgtool_partition_info *partitions, | |
| 866 | 866 | size_t len) |
| 867 | 867 | { |
| 868 | 868 | thom_floppy* f = (thom_floppy*) imgtool_image_extra_bytes( img ); |
| r1461 | r1462 | |
| 879 | 879 | return IMGTOOLERR_SUCCESS; |
| 880 | 880 | } |
| 881 | 881 | |
| 882 | static imgtoolerr_t thom_open_partition(imgtool_partition *part, | |
| 882 | static imgtoolerr_t thom_open_partition(imgtool_partition *part, | |
| 883 | 883 | UINT64 first_block, UINT64 block_count) |
| 884 | 884 | { |
| 885 | 885 | imgtool_image* img = imgtool_partition_image( part ); |
| r1461 | r1462 | |
| 891 | 891 | } |
| 892 | 892 | |
| 893 | 893 | |
| 894 | static imgtoolerr_t thom_begin_enum(imgtool_directory *enumeration, | |
| 894 | static imgtoolerr_t thom_begin_enum(imgtool_directory *enumeration, | |
| 895 | 895 | const char *path) |
| 896 | 896 | { |
| 897 | 897 | int* n = (int*) imgtool_directory_extrabytes( enumeration ); |
| r1461 | r1462 | |
| 899 | 899 | return IMGTOOLERR_SUCCESS; |
| 900 | 900 | } |
| 901 | 901 | |
| 902 | static imgtoolerr_t thom_next_enum(imgtool_directory *enumeration, | |
| 902 | static imgtoolerr_t thom_next_enum(imgtool_directory *enumeration, | |
| 903 | 903 | imgtool_dirent *ent) |
| 904 | 904 | { |
| 905 | 905 | imgtool_partition *part = imgtool_directory_partition( enumeration); |
| r1461 | r1462 | |
| 909 | 909 | int* n = (int*) imgtool_directory_extrabytes( enumeration ); |
| 910 | 910 | thom_dirent d; |
| 911 | 911 | |
| 912 | do { | |
| 912 | do { | |
| 913 | 913 | thom_get_dirent( f, head, *n, &d ); |
| 914 | 914 | (*n) ++; |
| 915 | } | |
| 915 | } | |
| 916 | 916 | while ( d.type == THOM_DIRENT_FREE ); |
| 917 | 917 | if ( d.type == THOM_DIRENT_END ) ent->eof = 1; |
| 918 | 918 | else if ( d.type == THOM_DIRENT_INVALID ) { |
| r1461 | r1462 | |
| 922 | 922 | int size; |
| 923 | 923 | snprintf( ent->filename, sizeof(ent->filename), "%s.%s", d.name, d.ext ); |
| 924 | 924 | snprintf( ent->attr, sizeof(ent->attr), "%c %c %s", |
| 925 | (d.ftype == 0) ? 'B' : (d.ftype == 1) ? 'D' : | |
| 925 | (d.ftype == 0) ? 'B' : (d.ftype == 1) ? 'D' : | |
| 926 | 926 | (d.ftype == 2) ? 'M' : (d.ftype == 3) ? 'A' : '?', |
| 927 | 927 | (d.format == 0) ? 'B' : (d.format == 0xff) ? 'A' : '?', |
| 928 | 928 | d.comment ); |
| r1461 | r1462 | |
| 947 | 947 | return IMGTOOLERR_SUCCESS; |
| 948 | 948 | } |
| 949 | 949 | |
| 950 | static imgtoolerr_t thom_read_file(imgtool_partition *part, | |
| 951 | const char *filename, | |
| 952 | const char *fork, | |
| 950 | static imgtoolerr_t thom_read_file(imgtool_partition *part, | |
| 951 | const char *filename, | |
| 952 | const char *fork, | |
| 953 | 953 | imgtool_stream *destf) |
| 954 | 954 | { |
| 955 | 955 | int head = *( (int*) imgtool_partition_extra_bytes( part ) ); |
| r1461 | r1462 | |
| 963 | 963 | thom_conv_filename( filename, name, ext ); |
| 964 | 964 | sprintf( fname, "%s.%s", name, ext ); |
| 965 | 965 | |
| 966 | if ( ! thom_find_dirent( f, head, fname, &d ) ) | |
| 966 | if ( ! thom_find_dirent( f, head, fname, &d ) ) | |
| 967 | 967 | return IMGTOOLERR_FILENOTFOUND; |
| 968 | 968 | size = thom_get_file_size( f, head, &d ); |
| 969 | 969 | if ( size < 0 ) return IMGTOOLERR_CORRUPTFILE; |
| r1461 | r1462 | |
| 971 | 971 | return IMGTOOLERR_SUCCESS; |
| 972 | 972 | } |
| 973 | 973 | |
| 974 | static imgtoolerr_t thom_delete_file(imgtool_partition *part, | |
| 974 | static imgtoolerr_t thom_delete_file(imgtool_partition *part, | |
| 975 | 975 | const char *filename) |
| 976 | 976 | { |
| 977 | 977 | int head = *( (int*) imgtool_partition_extra_bytes( part ) ); |
| r1461 | r1462 | |
| 983 | 983 | /* convert filename */ |
| 984 | 984 | thom_conv_filename( filename, name, ext ); |
| 985 | 985 | sprintf( fname, "%s.%s", name, ext ); |
| 986 | ||
| 987 | if ( ! thom_find_dirent( f, head, fname, &d ) ) | |
| 986 | ||
| 987 | if ( ! thom_find_dirent( f, head, fname, &d ) ) | |
| 988 | 988 | return IMGTOOLERR_FILENOTFOUND; |
| 989 | 989 | /*if ( thom_get_file_size( f, head, &d ) < 0 ) return IMGTOOLERR_CORRUPTFILE;*/ |
| 990 | 990 | if ( stream_isreadonly( f->stream ) ) return IMGTOOLERR_WRITEERROR; |
| r1461 | r1462 | |
| 992 | 992 | return IMGTOOLERR_SUCCESS; |
| 993 | 993 | } |
| 994 | 994 | |
| 995 | static imgtoolerr_t thom_write_file(imgtool_partition *part, | |
| 996 | const char *filename, | |
| 997 | const char *fork, | |
| 998 | imgtool_stream *sourcef, | |
| 995 | static imgtoolerr_t thom_write_file(imgtool_partition *part, | |
| 996 | const char *filename, | |
| 997 | const char *fork, | |
| 998 | imgtool_stream *sourcef, | |
| 999 | 999 | option_resolution *opts) |
| 1000 | 1000 | { |
| 1001 | 1001 | int head = *( (int*) imgtool_partition_extra_bytes( part ) ); |
| r1461 | r1462 | |
| 1036 | 1036 | |
| 1037 | 1037 | /* file type */ |
| 1038 | 1038 | switch ( option_resolution_lookup_int( opts, 'T' ) ) { |
| 1039 | case 0: | |
| 1039 | case 0: | |
| 1040 | 1040 | if ( ! is_new ) break; |
| 1041 | 1041 | if ( ! mame_stricmp( ext, "BAS" ) ) d.ftype = 0; |
| 1042 | 1042 | else if ( ! mame_stricmp( ext, "BAT" ) ) d.ftype = 0; |
| r1461 | r1462 | |
| 1056 | 1056 | |
| 1057 | 1057 | /* format flag */ |
| 1058 | 1058 | switch ( option_resolution_lookup_int( opts, 'F' ) ) { |
| 1059 | case 0: | |
| 1059 | case 0: | |
| 1060 | 1060 | if ( ! is_new ) break; |
| 1061 | 1061 | if ( ! mame_stricmp( ext, "DAT" ) ) d.format = 0xff; |
| 1062 | 1062 | else if ( ! mame_stricmp( ext, "ASC" ) ) d.format = 0xff; |
| r1461 | r1462 | |
| 1066 | 1066 | case 1: d.format = 0; break; |
| 1067 | 1067 | case 2: d.format = 0xff; break; |
| 1068 | 1068 | } |
| 1069 | ||
| 1069 | ||
| 1070 | 1070 | /* comment */ |
| 1071 | 1071 | comment = option_resolution_lookup_string( opts, 'C' ); |
| 1072 | 1072 | if ( comment && *comment ) |
| r1461 | r1462 | |
| 1077 | 1077 | return IMGTOOLERR_SUCCESS; |
| 1078 | 1078 | } |
| 1079 | 1079 | |
| 1080 | static imgtoolerr_t thom_suggest_transfer(imgtool_partition *part, | |
| 1081 | const char *fname, | |
| 1080 | static imgtoolerr_t thom_suggest_transfer(imgtool_partition *part, | |
| 1081 | const char *fname, | |
| 1082 | 1082 | imgtool_transfer_suggestion *suggestions, |
| 1083 | 1083 | size_t suggestions_length) |
| 1084 | 1084 | { |
| r1461 | r1462 | |
| 1091 | 1091 | if ( suggestions_length < 1 ) return IMGTOOLERR_SUCCESS; |
| 1092 | 1092 | |
| 1093 | 1093 | if ( fname ) { |
| 1094 | if ( ! thom_find_dirent( f, head, fname, &d ) ) | |
| 1094 | if ( ! thom_find_dirent( f, head, fname, &d ) ) | |
| 1095 | 1095 | return IMGTOOLERR_FILENOTFOUND; |
| 1096 | 1096 | if ( d.ftype == 0 && d.format == 0 ) is_basic = 1; |
| 1097 | 1097 | } |
| r1461 | r1462 | |
| 1121 | 1121 | } |
| 1122 | 1122 | |
| 1123 | 1123 | static imgtoolerr_t thom_create(imgtool_image* img, |
| 1124 | imgtool_stream *stream, | |
| 1124 | imgtool_stream *stream, | |
| 1125 | 1125 | option_resolution *opts) |
| 1126 | 1126 | { |
| 1127 | 1127 | thom_floppy* f = (thom_floppy*) imgtool_image_extra_bytes( img ); |
| r1461 | r1462 | |
| 1162 | 1162 | thom_unstringity( (char*)buf, 8 ); |
| 1163 | 1163 | } |
| 1164 | 1164 | else memset( buf, ' ', 8 ); |
| 1165 | ||
| 1165 | ||
| 1166 | 1166 | /* FAT */ |
| 1167 | 1167 | buf = thom_get_sector( f, i, 20, 2 ); |
| 1168 | 1168 | memset( buf, 0, f->sector_size ); |
| 1169 | 1169 | memset( buf + 1, 0xff, thom_nb_blocks( f ) ); |
| 1170 | 1170 | buf[ 41 ] = buf[ 42 ] = 0xfe; /* reserved for FAT */ |
| 1171 | ||
| 1171 | ||
| 1172 | 1172 | /* (empty) directory */ |
| 1173 | 1173 | buf = thom_get_sector( f, i, 20, 3 ); |
| 1174 | 1174 | memset( buf, 0xff, 14 * f->sector_size ); |
| r1461 | r1462 | |
| 1184 | 1184 | |
| 1185 | 1185 | /* character codes >= 128 are reserved for BASIC keywords */ |
| 1186 | 1186 | |
| 1187 | static const char *const thombas7[2][128] = { | |
| 1187 | static const char *const thombas7[2][128] = { | |
| 1188 | 1188 | { /* statements */ |
| 1189 | 1189 | "END", "FOR", "NEXT", "DATA", "DIM", "READ", "LET", "GO", "RUN", "IF", |
| 1190 | 1190 | "RESTORE", "RETURN", "REM", "'", "STOP", "ELSE", "TRON", "TROFF", "DEFSTR", |
| 1191 | "DEFINT", "DEFSNG", "DEFDBL", "ON", "WAIT", "ERROR", "RESUME", "AUTO", | |
| 1191 | "DEFINT", "DEFSNG", "DEFDBL", "ON", "WAIT", "ERROR", "RESUME", "AUTO", | |
| 1192 | 1192 | "DELETE", "LOCATE", "CLS", "CONSOLE", "PSET", "MOTOR", "SKIP", "EXEC", |
| 1193 | 1193 | "BEEP", "COLOR", "LINE", "BOX", "UNMASK", "ATTRB", "DEF", "POKE", "PRINT", |
| 1194 | 1194 | "CONT", "LIST", "CLEAR", "WHILE", "WHEN", "NEW", "SAVE", "LOAD", "MERGE", |
| 1195 | 1195 | "OPEN", "CLOSE", "INPEN", "PEN", "PLAY", "TAB(", "TO", "SUB", "FN", |
| 1196 | "SPC(", "USING", "USR", "ERL", "ERR", "OFF", "THEN", "NOT", "STEP", | |
| 1196 | "SPC(", "USING", "USR", "ERL", "ERR", "OFF", "THEN", "NOT", "STEP", | |
| 1197 | 1197 | "+", "-", "*", "/", "^", "AND", "OR", "XOR", "EQV", "IMP", "MOD", "@", |
| 1198 | 1198 | ">", "=", "<", |
| 1199 | 1199 | /* DOS specific */ |
| 1200 | 1200 | "DSKINI", "DSKO$", "KILL", "NAME", "FIELD", "LSET", "RSET", |
| 1201 | "PUT", "GET", "VERIFY", "DEVICE", "DIR", "FILES", "WRITE", "UNLOAD", | |
| 1201 | "PUT", "GET", "VERIFY", "DEVICE", "DIR", "FILES", "WRITE", "UNLOAD", | |
| 1202 | 1202 | "BACKUP", "COPY", "CIRCLE", "PAINT", "DRAW", "RENUM", "SWAP", "DENSITY", |
| 1203 | 1203 | }, |
| 1204 | 1204 | { /* functions: 0xff prefix */ |
| r1461 | r1462 | |
| 1218 | 1218 | { /* statements */ |
| 1219 | 1219 | "END", "FOR", "NEXT", "DATA", "DIM", "READ", NULL, "GO", "RUN", "IF", |
| 1220 | 1220 | "RESTORE", "RETURN", "REM", "'", "STOP", "ELSE", "TRON", "TROFF", "DEFSTR", |
| 1221 | "DEFINT", "DEFSNG", NULL, "ON", "TUNE", "ERROR", "RESUME", "AUTO", | |
| 1221 | "DEFINT", "DEFSNG", NULL, "ON", "TUNE", "ERROR", "RESUME", "AUTO", | |
| 1222 | 1222 | "DELETE", "LOCATE", "CLS", "CONSOLE", "PSET", "MOTOR", "SKIP", "EXEC", |
| 1223 | 1223 | "BEEP", "COLOR", "LINE", "BOX", NULL, "ATTRB", "DEF", "POKE", "PRINT", |
| 1224 | 1224 | "CONT", "LIST", "CLEAR", "DOS", NULL, "NEW", "SAVE", "LOAD", "MERGE", |
| 1225 | 1225 | "OPEN", "CLOSE", "INPEN", "PEN", "PLAY", "TAB(", "TO", "SUB", "FN", |
| 1226 | "SPC(", "USING", "USR", "ERL", "ERR", "OFF", "THEN", "NOT", "STEP", | |
| 1226 | "SPC(", "USING", "USR", "ERL", "ERR", "OFF", "THEN", "NOT", "STEP", | |
| 1227 | 1227 | "+", "-", "*", "/", "^", "AND", "OR", "XOR", "EQV", "IMP", "MOD", "@", |
| 1228 | 1228 | ">", "=", "<", |
| 1229 | 1229 | /* DOS specific */ |
| 1230 | 1230 | "DSKINI", "DSKO$", "KILL", "NAME", "FIELD", "LSET", "RSET", |
| 1231 | 1231 | "PUT", "GET", "VERIFY", "DEVICE", "DIR", "FILES", "WRITE", "UNLOAD", |
| 1232 | "BACKUP","COPY", "CIRCLE", "PAINT", "DRAW", "RENUM", "SWAP", "SEARCH", | |
| 1232 | "BACKUP","COPY", "CIRCLE", "PAINT", "DRAW", "RENUM", "SWAP", "SEARCH", | |
| 1233 | 1233 | "DENSITY", |
| 1234 | 1234 | }, |
| 1235 | 1235 | { /* functions: 0xff prefix */ |
| r1461 | r1462 | |
| 1240 | 1240 | "SCREEN", "POS", "PTRIG", |
| 1241 | 1241 | /* DOS specific */ |
| 1242 | 1242 | "DSKL", "CVI", "CVS", "CVD", "MKI$", "MKS$", "MKD$", "LOC", "LOF", |
| 1243 | "SPACE$", "STRING$", "DSKI$", | |
| 1243 | "SPACE$", "STRING$", "DSKI$", | |
| 1244 | 1244 | } |
| 1245 | 1245 | }; |
| 1246 | 1246 | |
| r1461 | r1462 | |
| 1252 | 1252 | { /* statements */ |
| 1253 | 1253 | "END", "FOR", "NEXT", "DATA", "DIM", "READ", "LET", "GO", "RUN", "IF", |
| 1254 | 1254 | "RESTORE", "RETURN", "REM", "'", "STOP", "ELSE", "TRON", "TROFF", "DEFSTR", |
| 1255 | "DEFINT", "DEFSNG", "DEFDBL", "ON", "WAIT", "ERROR", "RESUME", "AUTO", | |
| 1255 | "DEFINT", "DEFSNG", "DEFDBL", "ON", "WAIT", "ERROR", "RESUME", "AUTO", | |
| 1256 | 1256 | "DELETE", "LOCATE", "CLS", "CONSOLE", "PSET", "MOTOR", "SKIP", "EXEC", |
| 1257 | 1257 | "BEEP", "COLOR", "LINE", "BOX", "UNMASK", "ATTRB", "DEF", "POKE", "PRINT", |
| 1258 | 1258 | "CONT", "LIST", "CLEAR", "INTERVAL", "KEY", "NEW", "SAVE", "LOAD", "MERGE", |
| 1259 | 1259 | "OPEN", "CLOSE", "INPEN", "PEN", "PLAY", "TAB(", "TO", "SUB", "FN", |
| 1260 | "SPC(", "USING", "USR", "ERL", "ERR", "OFF", "THEN", "NOT", "STEP", | |
| 1260 | "SPC(", "USING", "USR", "ERL", "ERR", "OFF", "THEN", "NOT", "STEP", | |
| 1261 | 1261 | "+", "-", "*", "/", "^", "AND", "OR", "XOR", "EQV", "IMP", "MOD", "@", |
| 1262 | ">", "=", "<", | |
| 1262 | ">", "=", "<", | |
| 1263 | 1263 | "DSKINI", "DSKO$", "KILL", "NAME", "FIELD", "LSET", "RSET", |
| 1264 | "PUT", "GET", "VERIFY", "DEVICE", "DIR", "FILES", "WRITE", "UNLOAD", | |
| 1264 | "PUT", "GET", "VERIFY", "DEVICE", "DIR", "FILES", "WRITE", "UNLOAD", | |
| 1265 | 1265 | "BACKUP", "COPY", "CIRCLE", "PAINT", "RESET", "RENUM", "SWAP", "DENSITY", |
| 1266 | "WINDOW", "PATTERN", "DO", "LOOP", "EXIT", "INMOUSE", "MOUSE", "CHAINE", | |
| 1266 | "WINDOW", "PATTERN", "DO", "LOOP", "EXIT", "INMOUSE", "MOUSE", "CHAINE", | |
| 1267 | 1267 | "COMMON", "SEARCH", "FWD", "TURTLE", |
| 1268 | 1268 | }, |
| 1269 | 1269 | { /* functions: 0xff prefix */ |
| r1461 | r1462 | |
| 1273 | 1273 | "MID$", "INSTR", "VARPTR", "RND", "INKEY$", "INPUT", "CSRLIN", "POINT", |
| 1274 | 1274 | "SCREEN", "POS", "PTRIG", |
| 1275 | 1275 | "DSKL", "CVI", "CVS", "CVD", "MKI$", "MKS$", "MKD$", "LOC", "LOF", |
| 1276 | "SPACE$", "STRING$", "DSKI$", | |
| 1277 | "FKEY$", "MIN(", "MAX(", "ATN", "CRUNCH$", "MTRIG", "EVAL", "PALETTE", | |
| 1276 | "SPACE$", "STRING$", "DSKI$", | |
| 1277 | "FKEY$", "MIN(", "MAX(", "ATN", "CRUNCH$", "MTRIG", "EVAL", "PALETTE", | |
| 1278 | 1278 | "BANK", "HEAD", "ROT", "SHOW", "ZOOM", "TRACE", |
| 1279 | 1279 | } |
| 1280 | 1280 | }; |
| 1281 | 1281 | |
| 1282 | 1282 | /* tables for simple XOR encryption sieve */ |
| 1283 | static const UINT8 crypt1[11] = { | |
| 1284 | 0x80, 0x19, 0x56, 0xAA, 0x80, 0x76, 0x22, 0xF1, 0x82, 0x38, 0xAA | |
| 1283 | static const UINT8 crypt1[11] = { | |
| 1284 | 0x80, 0x19, 0x56, 0xAA, 0x80, 0x76, 0x22, 0xF1, 0x82, 0x38, 0xAA | |
| 1285 | 1285 | }; |
| 1286 | 1286 | |
| 1287 | 1287 | static const UINT8 crypt2[13] = { |
| r1461 | r1462 | |
| 1318 | 1318 | } |
| 1319 | 1319 | } |
| 1320 | 1320 | |
| 1321 | static imgtoolerr_t thomcrypt_read_file(imgtool_partition *part, | |
| 1321 | static imgtoolerr_t thomcrypt_read_file(imgtool_partition *part, | |
| 1322 | 1322 | const char *name, |
| 1323 | 1323 | const char *fork, imgtool_stream *dst) |
| 1324 | 1324 | { |
| r1461 | r1462 | |
| 1351 | 1351 | return IMGTOOLERR_SUCCESS; |
| 1352 | 1352 | } |
| 1353 | 1353 | |
| 1354 | static imgtoolerr_t thomcrypt_write_file(imgtool_partition *part, | |
| 1354 | static imgtoolerr_t thomcrypt_write_file(imgtool_partition *part, | |
| 1355 | 1355 | const char *name, |
| 1356 | 1356 | const char *fork, imgtool_stream *src, |
| 1357 | 1357 | option_resolution *opts) |
| 1358 | 1358 | { |
| 1359 | 1359 | UINT8 buf[3]; |
| 1360 | ||
| 1360 | ||
| 1361 | 1361 | if ( stream_read( src, buf, 3 ) < 3 || buf[0] == 0xfe ) { |
| 1362 | 1362 | /* too short or already encrypted file */ |
| 1363 | 1363 | stream_seek( src, 0, SEEK_SET ); |
| r1461 | r1462 | |
| 1397 | 1397 | } |
| 1398 | 1398 | |
| 1399 | 1399 | /* untokenization automatically decrypt protected files */ |
| 1400 | static imgtoolerr_t thom_basic_read_file(imgtool_partition *part, | |
| 1401 | const char *name, | |
| 1402 | const char *fork, | |
| 1400 | static imgtoolerr_t thom_basic_read_file(imgtool_partition *part, | |
| 1401 | const char *name, | |
| 1402 | const char *fork, | |
| 1403 | 1403 | imgtool_stream *dst, |
| 1404 | 1404 | const char *const table[2][128]) |
| 1405 | 1405 | { |
| r1461 | r1462 | |
| 1420 | 1420 | while ( 1 ) { |
| 1421 | 1421 | int in_str = 0, in_fun = 0; |
| 1422 | 1422 | int linelength, linenum; |
| 1423 | ||
| 1423 | ||
| 1424 | 1424 | /* line header: line length and line number */ |
| 1425 | 1425 | /* I am not sure this is 100% correct but it works in many cases */ |
| 1426 | 1426 | if ( stream_read( org, buf, 2 ) < 2 ) goto end; |
| r1461 | r1462 | |
| 1468 | 1468 | } |
| 1469 | 1469 | |
| 1470 | 1470 | static imgtoolerr_t thom_basic_write_file(imgtool_partition *part, |
| 1471 | const char *name, | |
| 1472 | const char *fork, | |
| 1473 | imgtool_stream *src, | |
| 1471 | const char *name, | |
| 1472 | const char *fork, | |
| 1473 | imgtool_stream *src, | |
| 1474 | 1474 | option_resolution *opts, |
| 1475 | 1475 | const char *const table[2][128]) |
| 1476 | 1476 | { |
| r1461 | r1462 | |
| 1513 | 1513 | } \ |
| 1514 | 1514 | } |
| 1515 | 1515 | |
| 1516 | FILTER( thombas5, | |
| 1516 | FILTER( thombas5, | |
| 1517 | 1517 | "Thomson MO5 w/ BASIC 1.0, Tokenized Files (read-only, auto-decrypt)" ) |
| 1518 | FILTER( thombas7, | |
| 1518 | FILTER( thombas7, | |
| 1519 | 1519 | "Thomson TO7 w/ BASIC 1.0, Tokenized Files (read-only, auto-decrypt)" ) |
| 1520 | FILTER( thombas128, | |
| 1520 | FILTER( thombas128, | |
| 1521 | 1521 | "Thomson w/ BASIC 128/512, Tokenized Files (read-only, auto-decrypt)" ) |
| 1522 | 1522 | |
| 1523 | 1523 | |
| r1461 | r1462 | |
| 1549 | 1549 | OPTION_STRING( 'C', "comment", "Comment" ) |
| 1550 | 1550 | OPTION_GUIDE_END |
| 1551 | 1551 | |
| 1552 | static void thom_basic_get_info(const imgtool_class *clas, | |
| 1553 | UINT32 param, | |
| 1552 | static void thom_basic_get_info(const imgtool_class *clas, | |
| 1553 | UINT32 param, | |
| 1554 | 1554 | union imgtoolinfo *info) |
| 1555 | 1555 | { |
| 1556 | 1556 | switch ( param ) { |
| r1461 | r1462 | |
| 1612 | 1612 | } |
| 1613 | 1613 | } |
| 1614 | 1614 | |
| 1615 | void thom_fd_basic_get_info(const imgtool_class *clas, | |
| 1616 | UINT32 param, | |
| 1615 | void thom_fd_basic_get_info(const imgtool_class *clas, | |
| 1616 | UINT32 param, | |
| 1617 | 1617 | union imgtoolinfo *info) |
| 1618 | 1618 | { |
| 1619 | 1619 | switch ( param ) { |
| 1620 | 1620 | case IMGTOOLINFO_STR_NAME: |
| 1621 | 1621 | strcpy( info->s = imgtool_temp_str(), "thom_fd" ); break; |
| 1622 | 1622 | case IMGTOOLINFO_STR_DESCRIPTION: |
| 1623 | strcpy( info->s = imgtool_temp_str(), | |
| 1623 | strcpy( info->s = imgtool_temp_str(), | |
| 1624 | 1624 | "Thomson .fd disk image, BASIC format" ); |
| 1625 | 1625 | break; |
| 1626 | 1626 | case IMGTOOLINFO_STR_FILE_EXTENSIONS: |
| r1461 | r1462 | |
| 1636 | 1636 | } |
| 1637 | 1637 | } |
| 1638 | 1638 | |
| 1639 | void thom_qd_basic_get_info(const imgtool_class *clas, | |
| 1640 | UINT32 param, | |
| 1639 | void thom_qd_basic_get_info(const imgtool_class *clas, | |
| 1640 | UINT32 param, | |
| 1641 | 1641 | union imgtoolinfo *info) |
| 1642 | 1642 | { |
| 1643 | 1643 | switch ( param ) { |
| r1461 | r1462 | |
| 1660 | 1660 | } |
| 1661 | 1661 | } |
| 1662 | 1662 | |
| 1663 | void thom_sap_basic_get_info(const imgtool_class *clas, | |
| 1664 | UINT32 param, | |
| 1663 | void thom_sap_basic_get_info(const imgtool_class *clas, | |
| 1664 | UINT32 param, | |
| 1665 | 1665 | union imgtoolinfo *info) |
| 1666 | 1666 | { |
| 1667 | 1667 | switch ( param ) { |
| 1668 | 1668 | case IMGTOOLINFO_STR_NAME: |
| 1669 | 1669 | strcpy( info->s = imgtool_temp_str(), "thom_sap" ); break; |
| 1670 | 1670 | case IMGTOOLINFO_STR_DESCRIPTION: |
| 1671 | strcpy( info->s = imgtool_temp_str(), | |
| 1671 | strcpy( info->s = imgtool_temp_str(), | |
| 1672 | 1672 | "Thomson .sap disk image, BASIC format" ); |
| 1673 | 1673 | break; |
| 1674 | 1674 | case IMGTOOLINFO_STR_FILE_EXTENSIONS: |
| r1461 | r1462 | |
|---|---|---|
| 6 | 6 | #include "imgtoolx.h" |
| 7 | 7 | |
| 8 | 8 | #ifdef LSB_FIRST |
| 9 | typedef struct { | |
| 9 | typedef struct { | |
| 10 | 10 | unsigned char high, low; |
| 11 | 11 | } biguword; |
| 12 | 12 | typedef struct { |
| r1461 | r1462 | |
| 37 | 37 | 0019 UBYTE Game line |
| 38 | 38 | 001A UBYTE[6] For future use... |
| 39 | 39 | 0020 UBYTE[20] Name (null-terminated string) |
| 40 | 0040 Chip Packets | |
| 40 | 0040 Chip Packets | |
| 41 | 41 | ... |
| 42 | 42 | |
| 43 | 43 | Chip Packets: |
| r1461 | r1462 | |
| 100 | 100 | |
| 101 | 101 | $8080: |
| 102 | 102 | |
| 103 | ||
| 104 | 103 | |
| 104 | ||
| 105 | 105 | EXAMPLE FOR KCS POWER CARTRIDGE |
| 106 | 106 | |
| 107 | 107 | $0000: 'C64 CARTRIDGE ' |
| r1461 | r1462 | |
| 119 | 119 | |
| 120 | 120 | $4060: |
| 121 | 121 | |
| 122 | ||
| 123 | 122 | |
| 123 | ||
| 124 | 124 | EXAMPLE FOR FINAL CARTRIDGE III |
| 125 | 125 | |
| 126 | 126 | $0000: 'C64 CARTRIDGE ' |
| r1461 | r1462 | |
| 146 | 146 | |
| 147 | 147 | $10080: |
| 148 | 148 | |
| 149 | ||
| 150 | 149 | |
| 150 | ||
| 151 | 151 | EXAMPLE FOR SIMONS BASIC |
| 152 | 152 | |
| 153 | 153 | $0000: 'C64 CARTRIDGE ' |
| r1461 | r1462 | |
| 165 | 165 | |
| 166 | 166 | $4060: |
| 167 | 167 | |
| 168 | ||
| 169 | 168 | |
| 169 | ||
| 170 | 170 | EXAMPLE FOR OCEAN TYPE1 |
| 171 | 171 | |
| 172 | 172 | $0000: 'C64 CARTRIDGE ' |
| r1461 | r1462 | |
| 192 | 192 | ... |
| 193 | 193 | $40240: |
| 194 | 194 | |
| 195 | ||
| 196 | 195 | |
| 196 | ||
| 197 | 197 | EXAMPLE FOR FUN PLAY TYPE |
| 198 | 198 | |
| 199 | 199 | $0000: 'C64 CARTRIDGE ' |
| r1461 | r1462 | |
| 220 | 220 | |
| 221 | 221 | $20140: |
| 222 | 222 | |
| 223 | ||
| 224 | 223 | |
| 224 | ||
| 225 | 225 | EXAMPLE FOR SUPER GAMES TYPE |
| 226 | 226 | |
| 227 | 227 | $0000: 'C64 CARTRIDGE ' |
| r1461 | r1462 | |
| 247 | 247 | |
| 248 | 248 | $10080: |
| 249 | 249 | |
| 250 | ||
| 251 | 250 | |
| 251 | ||
| 252 | 252 | EXAMPLE FOR ATOMIC POWER CARTRIDGE |
| 253 | 253 | |
| 254 | 254 | $0000: 'C64 CARTRIDGE ' |
| r1461 | r1462 | |
| 274 | 274 | |
| 275 | 275 | $8080: |
| 276 | 276 | |
| 277 | ||
| 278 | 277 | |
| 278 | ||
| 279 | 279 | EXAMPLE FOR EPYX FASTLOAD TYPE |
| 280 | 280 | |
| 281 | 281 | $0000: 'C64 CARTRIDGE ' |
| r1461 | r1462 | |
| 289 | 289 | |
| 290 | 290 | $2050: |
| 291 | 291 | |
| 292 | ||
| 293 | 292 | |
| 293 | ||
| 294 | 294 | EXAMPLE FOR WESTERMANN TYPE |
| 295 | 295 | |
| 296 | 296 | $0000: 'C64 CARTRIDGE ' |
| r1461 | r1462 | |
| 304 | 304 | |
| 305 | 305 | $4050: |
| 306 | 306 | */ |
| 307 | ||
| 307 | ||
| 308 | 308 | static const char *const hardware_types[]={ |
| 309 | 309 | "Normal cartridge", |
| 310 | 310 | "Action Replay", |
| r1461 | r1462 | |
| 327 | 327 | unsigned char exrom_line; |
| 328 | 328 | unsigned char game_line; |
| 329 | 329 | unsigned char reserved[6]; |
| 330 | char name[0x20]; | |
| 330 | char name[0x20]; | |
| 331 | 331 | } crt_header; |
| 332 | ||
| 332 | ||
| 333 | 333 | static const char *const chip_types[]={ "ROM", "RAM", "FLASH" }; |
| 334 | 334 | typedef struct { |
| 335 | 335 | char id[4]; // CHIP |
| r1461 | r1462 | |
| 495 | 495 | crt_iterator *iter=(crt_iterator*)enumeration; |
| 496 | 496 | |
| 497 | 497 | ent->corrupt=0; |
| 498 | ||
| 498 | ||
| 499 | 499 | if (!(ent->eof=(iter->pos>=iter->image->size))) { |
| 500 | 500 | sprintf(ent->fname,"%d", iter->number); |
| 501 | 501 | ent->filesize=GET_UWORD( PACKET(iter->image, iter->pos)->length ); |
| r1461 | r1462 | |
| 555 | 555 | int size; |
| 556 | 556 | int pos; |
| 557 | 557 | |
| 558 | if (!(pos=crt_image_findfile(image, fname)) ) | |
| 558 | if (!(pos=crt_image_findfile(image, fname)) ) | |
| 559 | 559 | return IMGTOOLERR_MODULENOTFOUND; |
| 560 | 560 | |
| 561 | 561 | size=GET_UWORD( PACKET(image, pos)->length ); |
| r1461 | r1462 | |
| 566 | 566 | return 0; |
| 567 | 567 | } |
| 568 | 568 | |
| 569 | static int crt_image_writefile(imgtool_image *img, const char *fname, imgtool_stream *sourcef, | |
| 569 | static int crt_image_writefile(imgtool_image *img, const char *fname, imgtool_stream *sourcef, | |
| 570 | 570 | const ResolvedOption *_options) |
| 571 | 571 | { |
| 572 | 572 | crt_image *image=(crt_image*)img; |
| r1461 | r1462 | |
| 586 | 586 | if (!(image->data=realloc(image->data, image->size+size+sizeof(crt_packet)-oldsize) ) ) |
| 587 | 587 | return IMGTOOLERR_OUTOFMEMORY; |
| 588 | 588 | if (image->size-pos-oldsize!=0) { |
| 589 | memmove(image->data+pos+size+sizeof(crt_packet), image->data+pos+oldsize, | |
| 589 | memmove(image->data+pos+size+sizeof(crt_packet), image->data+pos+oldsize, | |
| 590 | 590 | image->size-pos-oldsize); |
| 591 | 591 | } |
| 592 | 592 | image->size+=size+sizeof(crt_packet)-oldsize; |
| r1461 | r1462 | |
| 634 | 634 | header.game_line=_options[C64CRT_CREATEOPTION_GAMELINE].i; |
| 635 | 635 | header.exrom_line=_options[C64CRT_CREATEOPTION_EXROMLINE].i; |
| 636 | 636 | if (_options[C64CRT_CREATEOPTION_LABEL].s) strcpy(header.name, _options[C64CRT_CREATEOPTION_LABEL].s); |
| 637 | return (stream_write(f, &header, sizeof(crt_header)) == sizeof(crt_header)) | |
| 637 | return (stream_write(f, &header, sizeof(crt_header)) == sizeof(crt_header)) | |
| 638 | 638 | ? 0 : IMGTOOLERR_WRITEERROR; |
| 639 | 639 | } |
| 640 | 640 |
| r1461 | r1462 | |
|---|---|---|
| 319 | 319 | |
| 320 | 320 | for (i = 0; i < file->number_of_entries; i++) |
| 321 | 321 | if (!strnicmp(fname, (char *) file->data+file->entries[i].offset+0x06, file->entries[i].name_size) ) |
| 322 | return i; | |
| 322 | return i; | |
| 323 | 323 | |
| 324 | 324 | return -1; |
| 325 | 325 | } |
| r1461 | r1462 | |
| 386 | 386 | |
| 387 | 387 | if (stream_read(sourcef, file->data+offset+head_size+0x04, data_size)!=data_size) |
| 388 | 388 | return IMGTOOLERR_READERROR; |
| 389 | ||
| 389 | ||
| 390 | 390 | file->data[file->size-2] = ti85_calculate_checksum(file->data+TI85_HEADER_SIZE, file->size-2-TI85_HEADER_SIZE)&0x00ff; |
| 391 | 391 | file->data[file->size-1] = (ti85_calculate_checksum(file->data+TI85_HEADER_SIZE, file->size-2-TI85_HEADER_SIZE)&0xff00)>>8; |
| 392 | 392 | |
| r1461 | r1462 | |
| 434 | 434 | char checksum[] = {0x00, 0x00}; |
| 435 | 435 | |
| 436 | 436 | strncpy(header.comment, options_[TI85_OPTION_COMMENT].s,0x2a); |
| 437 | if (stream_write(f, &header, sizeof(ti85_header)) != sizeof(ti85_header)) | |
| 437 | if (stream_write(f, &header, sizeof(ti85_header)) != sizeof(ti85_header)) | |
| 438 | 438 | return IMGTOOLERR_WRITEERROR; |
| 439 | if (stream_write(f, &checksum, 2) != 2) | |
| 439 | if (stream_write(f, &checksum, 2) != 2) | |
| 440 | 440 | return IMGTOOLERR_WRITEERROR; |
| 441 | 441 | |
| 442 | 442 | return 0; |
| r1461 | r1462 | |
| 545 | 545 | break; |
| 546 | 546 | } |
| 547 | 547 | |
| 548 | ||
| 548 | ||
| 549 | 549 | ent->corrupt=0; |
| 550 | 550 | iter->index++; |
| 551 | 551 | } |
| r1461 | r1462 | |
|---|---|---|
| 34 | 34 | 120 2 [II] Secondary Header Length |
| 35 | 35 | 122 1 [II] MacBinary II Version Number (II: 0x81, III: 0x82) |
| 36 | 36 | 123 1 [II] Minimum Compatible MacBinary II Version Number (0x81) |
| 37 | 124 2 [II] CRC of previous 124 bytes | |
| 38 | ||
| 37 | 124 2 [II] CRC of previous 124 bytes | |
| 38 | ||
| 39 | 39 | For more information, consult http://www.lazerware.com/formats/macbinary.html |
| 40 | 40 | |
| 41 | 41 | TODO: I believe that the script code is some sort of identifier identifying |
| r1461 | r1462 | |
| 154 | 154 | place_integer_be(header, 124, 2, ccitt_crc16(0, header, 124)); |
| 155 | 155 | |
| 156 | 156 | stream_write(destf, header, sizeof(header)); |
| 157 | ||
| 157 | ||
| 158 | 158 | if (data_fork) |
| 159 | 159 | { |
| 160 | 160 | err = imgtool_partition_read_file(partition, filename, "", destf, NULL); |
| r1461 | r1462 | |
| 163 | 163 | |
| 164 | 164 | stream_fill(destf, 0, pad128(data_fork->size)); |
| 165 | 165 | } |
| 166 | ||
| 166 | ||
| 167 | 167 | if (resource_fork) |
| 168 | 168 | { |
| 169 | 169 | err = imgtool_partition_read_file(partition, filename, "RESOURCE_FORK", destf, NULL); |
| r1461 | r1462 | |
|---|---|---|
| 35 | 35 | #define MAX_SAFE_PATH_LEN 39 |
| 36 | 36 | |
| 37 | 37 | #define MAX_DIR_LEVEL 25 /* We need to put a recursion limit to avoid endless recursion hazard */ |
| 38 | ||
| 39 | 38 | |
| 39 | ||
| 40 | 40 | typedef struct UINT16BE |
| 41 | 41 | { |
| 42 | 42 | UINT8 bytes[2]; |
| r1461 | r1462 | |
| 317 | 317 | #if 0 |
| 318 | 318 | |
| 319 | 319 | /* |
| 320 | tifile header: stand-alone file | |
| 320 | tifile header: stand-alone file | |
| 321 | 321 | */ |
| 322 | 322 | typedef struct tifile_header |
| 323 | 323 | { |
| r1461 | r1462 | |
| 1184 | 1184 | } |
| 1185 | 1185 | |
| 1186 | 1186 | /* |
| 1187 | Open the disk catalog for enumeration | |
| 1187 | Open the disk catalog for enumeration | |
| 1188 | 1188 | */ |
| 1189 | 1189 | static imgtoolerr_t ti990_image_beginenum(imgtool_directory *enumeration, const char *path) |
| 1190 | 1190 | { |
| r1461 | r1462 | |
|---|---|---|
| 191 | 191 | strncpy(name_with_null, HEADER(image)->description, 24); |
| 192 | 192 | sprintf(string,"%s\n%s\nversion:%.4x max entries:%d", |
| 193 | 193 | dostext_with_null, |
| 194 | name_with_null, | |
| 194 | name_with_null, | |
| 195 | 195 | GET_UWORD(HEADER(image)->version), |
| 196 | 196 | HEADER(image)->max_entries); |
| 197 | 197 | } |
| r1461 | r1462 | |
| 216 | 216 | { |
| 217 | 217 | lynx_iterator *iter=(lynx_iterator*)enumeration; |
| 218 | 218 | ent->corrupt=0; |
| 219 | ||
| 219 | ||
| 220 | 220 | ent->eof=iter->index>=iter->image->count; |
| 221 | 221 | if (!ent->eof) { |
| 222 | 222 | strcpy(ent->fname, iter->image->entries[iter->index].name); |
| r1461 | r1462 | |
| 226 | 226 | case 'S': strcpy(ent->attr,"SEQ");break; |
| 227 | 227 | case 'R': strcpy(ent->attr,"REL");break; |
| 228 | 228 | case 'U': strcpy(ent->attr,"USR");break; |
| 229 | default: | |
| 229 | default: | |
| 230 | 230 | sprintf(ent->attr,"type:%c", |
| 231 | 231 | iter->image->entries[iter->index].filetype ); |
| 232 | 232 | } |
| r1461 | r1462 | |
|---|---|---|
| 44 | 44 | ) |
| 45 | 45 | |
| 46 | 46 | /* |
| 47 | NC PCMCIA RAM Card uses a FAT-like filesystem | |
| 47 | NC PCMCIA RAM Card uses a FAT-like filesystem | |
| 48 | 48 | |
| 49 | Blocks are fixed at 256 bytes in size. | |
| 50 | ||
| 49 | Blocks are fixed at 256 bytes in size. | |
| 50 | ||
| 51 | 51 | Block 0 and Block 1 are reserved for a boot program. |
| 52 | 52 | |
| 53 | 53 | Block 2 is reserved for root directory. |
| r1461 | r1462 | |
| 66 | 66 | another number (other than 0x0ffff and 0x0fffe), this is the next |
| 67 | 67 | block used by the file. If the number is 0x0ffff this means this |
| 68 | 68 | block is the last used by the file. |
| 69 | ||
| 69 | ||
| 70 | 70 | 0x0fffe indicates a reserved block. |
| 71 | 71 | |
| 72 | 72 | The maximum supported PCMCIA Ram card size is 1mb, and there are |
| 73 | 73 | 4096 256-byte blocks on each card. Therefore a FAT entry uses 12-bits |
| 74 | 74 | to store the block index, leaving the top 4-bits as a status?? |
| 75 | ||
| 75 | ||
| 76 | 76 | Maximum size of a file on the PCMCIA Ram card is 65536 bytes. |
| 77 | 77 | */ |
| 78 | 78 | struct nc_card_dir_entry |
| r1461 | r1462 | |
| 218 | 218 | { |
| 219 | 219 | return offset; |
| 220 | 220 | } |
| 221 | ||
| 221 | ||
| 222 | 222 | offset+=32; |
| 223 | 223 | } |
| 224 | 224 | |
| 225 | 225 | previous_block = current_block; |
| 226 | 226 | current_block = memcard_fat_get_next_block(memcard,current_block); |
| 227 | ||
| 227 | ||
| 228 | 228 | if (current_block!=NC_FAT_END_OF_LIST) |
| 229 | 229 | { |
| 230 | 230 | current_block &= 0x0fff; |
| r1461 | r1462 | |
| 353 | 353 | return offset; |
| 354 | 354 | } |
| 355 | 355 | } |
| 356 | ||
| 356 | ||
| 357 | 357 | offset+=32; |
| 358 | 358 | } |
| 359 | 359 | |
| 360 | 360 | current_block = memcard_fat_get_next_block(memcard,current_block); |
| 361 | ||
| 361 | ||
| 362 | 362 | if (current_block!=NC_FAT_END_OF_LIST) |
| 363 | 363 | { |
| 364 | 364 | current_block = current_block & 0x0fff; |
| r1461 | r1462 | |
| 386 | 386 | while (current_block!=0) |
| 387 | 387 | { |
| 388 | 388 | int next_block; |
| 389 | ||
| 389 | ||
| 390 | 390 | /* get next block in list */ |
| 391 | 391 | next_block = memcard_fat_get_next_block(memcard,current_block); |
| 392 | 392 | /* zero out this block */ |
| 393 | 393 | memcard_fat_write(memcard,current_block,0); |
| 394 | ||
| 394 | ||
| 395 | 395 | /* go to next block */ |
| 396 | 396 | current_block = next_block; |
| 397 | 397 | |
| r1461 | r1462 | |
| 488 | 488 | int code; |
| 489 | 489 | |
| 490 | 490 | struct nc_memcard memcard; |
| 491 | ||
| 491 | ||
| 492 | 492 | /* allocate a big chunk of memory for memcard data - max size will be 1mb! */ |
| 493 | 493 | if (!memcard_init(&memcard, 1024*1024)) |
| 494 | 494 | { |
| r1461 | r1462 | |
| 546 | 546 | |
| 547 | 547 | if (memcard_del(&nc_card->memcard,nc_filename)) |
| 548 | 548 | { |
| 549 | return IMGTOOLERR_MODULENOTFOUND; | |
| 549 | return IMGTOOLERR_MODULENOTFOUND; | |
| 550 | 550 | } |
| 551 | 551 | |
| 552 | 552 | return 0; |
| r1461 | r1462 | |
| 560 | 560 | struct nc_card_image *nc_card = (struct nc_card_image *)img; |
| 561 | 561 | char nc_filename[12]; |
| 562 | 562 | unsigned long dir_entry_offset; |
| 563 | ||
| 563 | ||
| 564 | 564 | setup_nc_filename(nc_filename, fname); |
| 565 | 565 | |
| 566 | 566 | dir_entry_offset = memcard_locate_dir_entry(&nc_card->memcard,(char *)nc_filename); |
| r1461 | r1462 | |
| 575 | 575 | |
| 576 | 576 | /* get size of file from directory entry */ |
| 577 | 577 | length_remaining = ((dir_entry->size_high_byte & 0x0ff)<<8) | (dir_entry->size_low_byte & 0x0ff); |
| 578 | ||
| 578 | ||
| 579 | 579 | /* get first block index from directory entry */ |
| 580 | 580 | current_block = ((dir_entry->first_block_high & 0x0f)<<8) | dir_entry->first_block_low; |
| 581 | 581 | |
| r1461 | r1462 | |
| 587 | 587 | |
| 588 | 588 | /* get offset of block data in memcard data */ |
| 589 | 589 | block_offset = memcard_block_to_offset(current_block); |
| 590 | ||
| 590 | ||
| 591 | 591 | /* calc amount of data to copy from block */ |
| 592 | 592 | if (length_remaining<NC_BLOCK_SIZE) |
| 593 | 593 | { |
| r1461 | r1462 | |
| 601 | 601 | /* output to file */ |
| 602 | 602 | if (stream_write(destf, &nc_card->memcard.memcard_data[block_offset], copy_length)!=copy_length) |
| 603 | 603 | return IMGTOOLERR_WRITEERROR; |
| 604 | ||
| 604 | ||
| 605 | 605 | /* update length of data remaining to write */ |
| 606 | length_remaining -=copy_length; | |
| 606 | length_remaining -=copy_length; | |
| 607 | 607 | |
| 608 | 608 | /* get next block in list */ |
| 609 | 609 | current_block = memcard_fat_get_next_block(&nc_card->memcard,current_block); |
| 610 | ||
| 610 | ||
| 611 | 611 | if (current_block!=NC_FAT_END_OF_LIST) |
| 612 | 612 | { |
| 613 | 613 | current_block &= 0x0fff; |
| r1461 | r1462 | |
| 671 | 671 | dir_entry->first_block_low = (current_block & 0x0ff); |
| 672 | 672 | /* setup filename */ |
| 673 | 673 | strncpy((char *)dir_entry->filename,(char *)nc_filename, 12); |
| 674 | ||
| 674 | ||
| 675 | 675 | while (length_remaining!=0) |
| 676 | 676 | { |
| 677 | 677 | /* get offset of block data */ |
| 678 | 678 | block_offset = memcard_block_to_offset(current_block); |
| 679 | ||
| 679 | ||
| 680 | 680 | /* calc amount of data to copy to block */ |
| 681 | 681 | if (length_remaining<NC_BLOCK_SIZE) |
| 682 | 682 | { |
| r1461 | r1462 | |
| 691 | 691 | if (stream_read(sourcef, &nc_card->memcard.memcard_data[block_offset], copy_length)!=copy_length) |
| 692 | 692 | return IMGTOOLERR_WRITEERROR; |
| 693 | 693 | |
| 694 | length_remaining -=copy_length; | |
| 694 | length_remaining -=copy_length; | |
| 695 | 695 | file_offset+=copy_length; |
| 696 | 696 | |
| 697 | 697 | /* mark block as used */ |
| r1461 | r1462 | |
| 699 | 699 | |
| 700 | 700 | previous_block = current_block; |
| 701 | 701 | current_block = memcard_fat_get_free_block(&nc_card->memcard); |
| 702 | ||
| 702 | ||
| 703 | 703 | if (current_block==-1) |
| 704 | 704 | break; |
| 705 | ||
| 705 | ||
| 706 | 706 | /* link up block chain */ |
| 707 | 707 | memcard_fat_write(&nc_card->memcard,previous_block, current_block|0x02000); |
| 708 | 708 | } |
| 709 | ||
| 709 | ||
| 710 | 710 | /* end block chain */ |
| 711 | 711 | memcard_fat_write(&nc_card->memcard,current_block, NC_FAT_END_OF_LIST); |
| 712 | 712 | } |
| r1461 | r1462 | |
| 716 | 716 | return 0; |
| 717 | 717 | } |
| 718 | 718 | |
| 719 | /* directory fills 1 or more blocks. | |
| 719 | /* directory fills 1 or more blocks. | |
| 720 | 720 | current_block holds index of current block we are accessing, |
| 721 | 721 | offset_in_block holds offset within block referenced by current_block. |
| 722 | 722 | eod is 1 if end of directory (no more blocks) or 0 if not end of directory */ |
| 723 | 723 | |
| 724 | struct nc_card_direnum | |
| 724 | struct nc_card_direnum | |
| 725 | 725 | { |
| 726 | 726 | imgtool_directory base; |
| 727 | 727 | /* card image */ |
| r1461 | r1462 | |
| 743 | 743 | if (memcard_is_executable(&nc_card->memcard)) |
| 744 | 744 | { |
| 745 | 745 | return IMGTOOLERR_MODULENOTFOUND; |
| 746 | } | |
| 746 | } | |
| 747 | 747 | |
| 748 | 748 | card_enum = (struct nc_card_direnum *) malloc(sizeof(struct nc_card_direnum)); |
| 749 | 749 | if (!card_enum) |
| r1461 | r1462 | |
| 792 | 792 | |
| 793 | 793 | /* no more directory blocks, end of directory reached */ |
| 794 | 794 | card_enum->eod = 1; |
| 795 | ||
| 795 | ||
| 796 | 796 | /* no more blocks - so quit */ |
| 797 | 797 | quit = 1; |
| 798 | 798 | } |
| r1461 | r1462 | |
| 810 | 810 | dir_entry = (struct nc_card_dir_entry *)&card_enum->img->memcard.memcard_data[dir_block_offset + card_enum->offset_in_block]; |
| 811 | 811 | |
| 812 | 812 | if (dir_entry->filename[0]!=0) |
| 813 | { | |
| 813 | { | |
| 814 | 814 | /* got a used directory entry */ |
| 815 | 815 | |
| 816 | 816 | if (ent->fname_len<13) |
| r1461 | r1462 | |
| 828 | 828 | ent->corrupt = 0; |
| 829 | 829 | |
| 830 | 830 | if (ent->attr_len) |
| 831 | { | |
| 831 | { | |
| 832 | 832 | switch (dir_entry->type) |
| 833 | 833 | { |
| 834 | 834 | case 0: |
| r1461 | r1462 | |
|---|---|---|
| 11 | 11 | #define GET_UWORD(a) a |
| 12 | 12 | #define SET_UWORD(a,v) a=v |
| 13 | 13 | #else |
| 14 | typedef struct { | |
| 14 | typedef struct { | |
| 15 | 15 | unsigned char low, high; |
| 16 | 16 | } littleuword; |
| 17 | 17 | #define GET_UWORD(a) (a.low|(a.high<<8)) |
| r1461 | r1462 | |
| 78 | 78 | unsigned char unused2[0x2d]; // zer0 |
| 79 | 79 | } D71_HEADER; |
| 80 | 80 | |
| 81 | static const D64_HEADER d64_header={ | |
| 82 | 18,1,'A', | |
| 81 | static const D64_HEADER d64_header={ | |
| 82 | 18,1,'A', | |
| 83 | 83 | 0, // 1571 0x80 |
| 84 | 84 | { { 0 } }, |
| 85 | 85 | { '\xa0','\xa0','\xa0','\xa0','\xa0','\xa0','\xa0','\xa0', |
| 86 | '\xa0','\xa0','\xa0','\xa0','\xa0','\xa0','\xa0','\xa0' }, | |
| 86 | '\xa0','\xa0','\xa0','\xa0','\xa0','\xa0','\xa0','\xa0' }, | |
| 87 | 87 | { 0xa0, 0xa0 }, { 0xa0, 0xa0 } , 0xa0, { '2', 'A' } , { '\xa0','\xa0','\xa0','\xa0' }, |
| 88 | 88 | }; |
| 89 | 89 | |
| r1461 | r1462 | |
| 117 | 117 | unsigned char unused1[227]; // zero |
| 118 | 118 | } D81_HEADER; |
| 119 | 119 | |
| 120 | static const D81_HEADER d81_header={ | |
| 121 | 40,3,'D', | |
| 120 | static const D81_HEADER d81_header={ | |
| 121 | 40,3,'D', | |
| 122 | 122 | 0, |
| 123 | 123 | { '\xa0','\xa0','\xa0','\xa0','\xa0','\xa0','\xa0','\xa0', |
| 124 | '\xa0','\xa0','\xa0','\xa0','\xa0','\xa0','\xa0','\xa0', 0xa0, 0xa0 }, | |
| 124 | '\xa0','\xa0','\xa0','\xa0','\xa0','\xa0','\xa0','\xa0', 0xa0, 0xa0 }, | |
| 125 | 125 | { 0xa0, 0xa0 } , 0xa0, { '3', 'D' } , { '\xa0','\xa0' }, |
| 126 | 126 | }; |
| 127 | 127 | |
| r1461 | r1462 | |
| 352 | 352 | D81_BAM *bam[2]; |
| 353 | 353 | bam[0] = (D81_BAM*) (image->data + image->get_offset(image->directory.track, image->directory.sector+1)), |
| 354 | 354 | bam[1] = (D81_BAM*) (image->data + image->get_offset(image->directory.track, image->directory.sector+1)); |
| 355 | ||
| 355 | ||
| 356 | 356 | /* this contains the tracks for the search strategy for free sectors */ |
| 357 | 357 | for (i=0,j=image->directory.track-1; j>0; i++,j--) tracks[i]=j; |
| 358 | 358 | for (j=image->directory.track+1;j<80;i++,j++) tracks[i]=j; |
| r1461 | r1462 | |
| 396 | 396 | +image->get_offset(image->directory.track, |
| 397 | 397 | image->directory.sector+2)); |
| 398 | 398 | } |
| 399 | ||
| 399 | ||
| 400 | 400 | bam->bam[track-1].free++; |
| 401 | 401 | bam->bam[track-1].map[i]|=mask; |
| 402 | 402 | } |
| r1461 | r1462 | |
| 479 | 479 | { |
| 480 | 480 | int size = 0; |
| 481 | 481 | int i=image->get_offset(entry->track, entry->sector); |
| 482 | ||
| 482 | ||
| 483 | 483 | while (image->data[i] != 0) |
| 484 | 484 | { |
| 485 | 485 | size += 254; |
| r1461 | r1462 | |
| 848 | 848 | |
| 849 | 849 | ent->corrupt=0; |
| 850 | 850 | ent->eof=0; |
| 851 | ||
| 851 | ||
| 852 | 852 | while ((iter->track >= 1) && (iter->track <= iter->image->tracks)) //safer |
| 853 | 853 | // while (iter->track != 0) |
| 854 | 854 | { |
| r1461 | r1462 | |
| 959 | 959 | while (image->data[pos]!=0) { |
| 960 | 960 | if (stream_write(destf, image->data+pos+2, 254)!=254) |
| 961 | 961 | return IMGTOOLERR_WRITEERROR; |
| 962 | ||
| 962 | ||
| 963 | 963 | pos = image->get_offset (image->data[pos + 0], image->data[pos + 1]); |
| 964 | 964 | } |
| 965 | 965 | if (image->data[pos+1]-1>0) { |
| r1461 | r1462 | |
| 983 | 983 | |
| 984 | 984 | if ((entry=d64_image_findfile(image, (const unsigned char *)fname))!=NULL ) { |
| 985 | 985 | /* overriding */ |
| 986 | if ((freespace + GET_UWORD(entry->blocks))*254<fsize) | |
| 986 | if ((freespace + GET_UWORD(entry->blocks))*254<fsize) | |
| 987 | 987 | return IMGTOOLERR_NOSPACE; |
| 988 | 988 | track=entry->track; |
| 989 | 989 | sector=entry->sector; |
| 990 | ||
| 990 | ||
| 991 | 991 | while (track!=0) { |
| 992 | 992 | image->free_sector(image, track, sector); |
| 993 | 993 | pos = image->get_offset(track, sector); |
| r1461 | r1462 | |
| 1005 | 1005 | memcpy(entry->name, fname, strlen(fname)); |
| 1006 | 1006 | |
| 1007 | 1007 | image->alloc_sector(image, &track, §or); |
| 1008 | entry->track=track; | |
| 1008 | entry->track=track; | |
| 1009 | 1009 | entry->sector=sector; |
| 1010 | 1010 | pos = image->get_offset(track, sector); |
| 1011 | 1011 | |
| r1461 | r1462 | |
| 1013 | 1013 | { |
| 1014 | 1014 | if (stream_read(sourcef, image->data+pos+2, 254)!=254) |
| 1015 | 1015 | return IMGTOOLERR_READERROR; |
| 1016 | ||
| 1016 | ||
| 1017 | 1017 | image->alloc_sector(image, &track, §or); |
| 1018 | image->data[pos]=track; | |
| 1018 | image->data[pos]=track; | |
| 1019 | 1019 | image->data[pos+1]=sector; |
| 1020 | 1020 | pos = image->get_offset (track, sector); |
| 1021 | 1021 | } |
| r1461 | r1462 | |
| 1027 | 1027 | return IMGTOOLERR_READERROR; |
| 1028 | 1028 | } |
| 1029 | 1029 | image->data[pos+2+fsize-i]=0; |
| 1030 | ||
| 1030 | ||
| 1031 | 1031 | SET_UWORD(entry->blocks, b); |
| 1032 | 1032 | image->modified=1; |
| 1033 | 1033 | |
| r1461 | r1462 | |
| 1099 | 1099 | } |
| 1100 | 1100 | //d64_header.name=0xa0; |
| 1101 | 1101 | //d64_header.id=0xa0; |
| 1102 | if (stream_write(f, &d64_header, sizeof(d64_header)) != sizeof(d64_header)) | |
| 1102 | if (stream_write(f, &d64_header, sizeof(d64_header)) != sizeof(d64_header)) | |
| 1103 | 1103 | return IMGTOOLERR_WRITEERROR; |
| 1104 | 1104 | } else { |
| 1105 | if (stream_write(f, §or, sizeof(sector)) != sizeof(sector)) | |
| 1105 | if (stream_write(f, §or, sizeof(sector)) != sizeof(sector)) | |
| 1106 | 1106 | return IMGTOOLERR_WRITEERROR; |
| 1107 | 1107 | } |
| 1108 | 1108 | } |
| 1109 | 1109 | } |
| 1110 | 1110 | if (crc) { |
| 1111 | 1111 | for (t=1; t<=tracks; t++) { |
| 1112 | if (stream_write(f, &d64_header, d64_sectors_per_track[t-1]) | |
| 1113 | != d64_sectors_per_track[t-1]) | |
| 1112 | if (stream_write(f, &d64_header, d64_sectors_per_track[t-1]) | |
| 1113 | != d64_sectors_per_track[t-1]) | |
| 1114 | 1114 | return IMGTOOLERR_WRITEERROR; |
| 1115 | 1115 | } |
| 1116 | 1116 | } |
| r1461 | r1462 | |
| 1119 | 1119 | |
| 1120 | 1120 | static int x64_image_create(const imgtool_module *mod, imgtool_stream *f, const ResolvedOption *options_) |
| 1121 | 1121 | { |
| 1122 | struct { | |
| 1122 | struct { | |
| 1123 | 1123 | unsigned char data[0x40]; |
| 1124 | } x64_header={ | |
| 1124 | } x64_header={ | |
| 1125 | 1125 | { 0x43, 0x15, 0x41, 0x64, |
| 1126 | 0x01, 0x02, 0x01, 0x23, | |
| 1126 | 0x01, 0x02, 0x01, 0x23, | |
| 1127 | 1127 | 0x01 |
| 1128 | 1128 | } |
| 1129 | 1129 | }; |
| 1130 | if (stream_write(f, &x64_header, sizeof(x64_header)) != sizeof(x64_header)) | |
| 1130 | if (stream_write(f, &x64_header, sizeof(x64_header)) != sizeof(x64_header)) | |
| 1131 | 1131 | return IMGTOOLERR_WRITEERROR; |
| 1132 | 1132 | |
| 1133 | 1133 | d64_image_create(mod, f, options_); |
| r1461 | r1462 | |
| 1167 | 1167 | } |
| 1168 | 1168 | //d64_header.name=0xa0; |
| 1169 | 1169 | //d64_header.id=0xa0; |
| 1170 | if (stream_write(f, &d64_header, sizeof(d64_header)) != sizeof(d64_header)) | |
| 1170 | if (stream_write(f, &d64_header, sizeof(d64_header)) != sizeof(d64_header)) | |
| 1171 | 1171 | return IMGTOOLERR_WRITEERROR; |
| 1172 | 1172 | } else if ((t==35+18)&&(s==0)) { |
| 1173 | 1173 | for (i=36;i<=70;i++) { |
| r1461 | r1462 | |
| 1186 | 1186 | d71_header.bam2[i-36].map2[2]=0; |
| 1187 | 1187 | } |
| 1188 | 1188 | } |
| 1189 | if (stream_write(f, &d71_header, sizeof(d71_header)) | |
| 1190 | != sizeof(d71_header)) | |
| 1189 | if (stream_write(f, &d71_header, sizeof(d71_header)) | |
| 1190 | != sizeof(d71_header)) | |
| 1191 | 1191 | return IMGTOOLERR_WRITEERROR; |
| 1192 | 1192 | } else { |
| 1193 | if (stream_write(f, §or, sizeof(sector)) != sizeof(sector)) | |
| 1193 | if (stream_write(f, §or, sizeof(sector)) != sizeof(sector)) | |
| 1194 | 1194 | return IMGTOOLERR_WRITEERROR; |
| 1195 | 1195 | } |
| 1196 | 1196 | } |
| r1461 | r1462 | |
| 1210 | 1210 | //d81_header.name=0xa0; |
| 1211 | 1211 | d81_header.id[0]=id[0]; |
| 1212 | 1212 | d81_header.id[0]=id[1]; |
| 1213 | if (stream_write(f, &d81_header, sizeof(d81_header)) != sizeof(d81_header)) | |
| 1213 | if (stream_write(f, &d81_header, sizeof(d81_header)) != sizeof(d81_header)) | |
| 1214 | 1214 | return IMGTOOLERR_WRITEERROR; |
| 1215 | 1215 | } else if ((t==40)&&(s==1)){ |
| 1216 | 1216 | d81_bam.id[0]=id[0]; |
| r1461 | r1462 | |
| 1225 | 1225 | } |
| 1226 | 1226 | d81_bam.bam[40-1].free=36; |
| 1227 | 1227 | d81_bam.bam[40-1].map[0]=0xf0; |
| 1228 | if (stream_write(f, &d81_bam, sizeof(d81_bam)) != sizeof(d81_bam)) | |
| 1228 | if (stream_write(f, &d81_bam, sizeof(d81_bam)) != sizeof(d81_bam)) | |
| 1229 | 1229 | return IMGTOOLERR_WRITEERROR; |
| 1230 | 1230 | d81_bam.bam[40-1].free=40; |
| 1231 | 1231 | d81_bam.bam[40-1].map[0]=0xff; |
| 1232 | 1232 | } else if ((t==40)&&(s==2)){ |
| 1233 | 1233 | d81_bam.track=0; |
| 1234 | if (stream_write(f, &d81_bam, sizeof(d81_bam)) != sizeof(d81_bam)) | |
| 1234 | if (stream_write(f, &d81_bam, sizeof(d81_bam)) != sizeof(d81_bam)) | |
| 1235 | 1235 | return IMGTOOLERR_WRITEERROR; |
| 1236 | 1236 | } else { |
| 1237 | if (stream_write(f, §or, sizeof(sector)) != sizeof(sector)) | |
| 1237 | if (stream_write(f, §or, sizeof(sector)) != sizeof(sector)) | |
| 1238 | 1238 | return IMGTOOLERR_WRITEERROR; |
| 1239 | 1239 | } |
| 1240 | 1240 | } |
| r1461 | r1462 | |
|---|---|---|
| 5313 | 5313 | } mac_iterator; |
| 5314 | 5314 | |
| 5315 | 5315 | /* |
| 5316 | Open the disk catalog for enumeration | |
| 5316 | Open the disk catalog for enumeration | |
| 5317 | 5317 | */ |
| 5318 | 5318 | static imgtoolerr_t mac_image_beginenum(imgtool_directory *enumeration, const char *path) |
| 5319 | 5319 | { |
| r1461 | r1462 | |
|---|---|---|
| 1 | /* | |
| 1 | /* | |
| 2 | 2 | vMSX tap format |
| 3 | 3 | |
| 4 | 4 | Virtual MSX 1.x (being replaced by the MSX driver in mess) had |
| 5 | 5 | it's on format for cassette recordings. The format is similar |
| 6 | 6 | to .cas files; however several recordings could be stored in |
| 7 | one file. | |
| 7 | one file. | |
| 8 | 8 | |
| 9 | 9 | Virtual MSX was never really popular; I haven't seen any of these |
| 10 | 10 | files on the internet. However for completeness sake I've added |
| 11 | 11 | this converter. It's read only; the MSX driver cannot read |
| 12 | 12 | these files, but can read the .cas files (like most other MSX |
| 13 | emulators). Further use and specially distribution of the .tap files | |
| 13 | emulators). Further use and specially distribution of the .tap files | |
| 14 | 14 | is discouraged as Virtual MSX is obsolete (along with its private |
| 15 | 15 | file formats). |
| 16 | 16 | |
| r1461 | r1462 | |
| 21 | 21 | Original code in Virtual MSX: |
| 22 | 22 | |
| 23 | 23 | ftp://ftp.komkon.org/pub/EMUL8/MSX/Emulators/VMSX1SRC.zip |
| 24 | ||
| 24 | ||
| 25 | 25 | It's in the file TAPE.C. |
| 26 | 26 | |
| 27 | 27 | RIFF format specs: |
| r1461 | r1462 | |
| 34 | 34 | dir - list all the files in the archive as "%title%-%type%.cas" |
| 35 | 35 | getall - writes all the files to disk |
| 36 | 36 | get - gets one file. If "getall" fails, due to characters in the |
| 37 | filename your FS/OS doesn't support, use: | |
| 37 | filename your FS/OS doesn't support, use: | |
| 38 | 38 | |
| 39 | 39 | imgtool get vmsx_tap monmsx.tap monmsx-binary.cas monmsx.cas |
| 40 | 40 | |
| 41 | 41 | for example. |
| 42 | 42 | |
| 43 | Sean Young | |
| 43 | Sean Young | |
| 44 | 44 | */ |
| 45 | 45 | |
| 46 | 46 | #include "osdepend.h" |
| r1461 | r1462 | |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | return 0; |
| 157 | } | |
| 157 | } | |
| 158 | 158 | |
| 159 | 159 | return IMGTOOLERR_MODULENOTFOUND; |
| 160 | 160 | } |
| r1461 | r1462 | |
| 198 | 198 | |
| 199 | 199 | /* OK we've got the right data chunk. Now we can start looking for |
| 200 | 200 | the blocks */ |
| 201 | pos = 0; | |
| 201 | pos = 0; | |
| 202 | 202 | while ( (pos + 8) < size) |
| 203 | 203 | { |
| 204 | 204 | offset = *((UINT32*)(pmem + pos + 4)); |
| r1461 | r1462 | |
| 221 | 221 | tappos += 4; |
| 222 | 222 | tapblock = LITTLE_ENDIANIZE_INT32 (tapblock); |
| 223 | 223 | if (tapblock == 0xffffffff) break; |
| 224 | memcpy (p + caspos, CasHeader, 8); | |
| 224 | memcpy (p + caspos, CasHeader, 8); | |
| 225 | 225 | caspos += 8; |
| 226 | memcpy (p + caspos, pmem + pos + tappos, tapblock); | |
| 226 | memcpy (p + caspos, pmem + pos + tappos, tapblock); | |
| 227 | 227 | caspos += tapblock; |
| 228 | 228 | tappos += tapblock; |
| 229 | 229 | } |
| r1461 | r1462 | |
| 231 | 231 | |
| 232 | 232 | *psize = caspos; |
| 233 | 233 | *pcas = p; |
| 234 | ||
| 234 | ||
| 235 | 235 | return 0; |
| 236 | 236 | } |
| 237 | 237 | |
| r1461 | r1462 | |
| 261 | 261 | return IMGTOOLERR_OUTOFMEMORY; |
| 262 | 262 | } |
| 263 | 263 | |
| 264 | if (stream_read(f, image->data, image->size)!=image->size) | |
| 264 | if (stream_read(f, image->data, image->size)!=image->size) | |
| 265 | 265 | { |
| 266 | 266 | free(image); |
| 267 | 267 | *outimg=NULL; |
| 268 | 268 | return IMGTOOLERR_READERROR; |
| 269 | 269 | } |
| 270 | 270 | |
| 271 | if ( (rc=vmsx_tap_read_image(image)) ) | |
| 271 | if ( (rc=vmsx_tap_read_image(image)) ) | |
| 272 | 272 | { |
| 273 | 273 | if (image->entries) free(image->entries); |
| 274 | 274 | free(image); |
| r1461 | r1462 | |
| 309 | 309 | TAP_ITERATOR *iter=(TAP_ITERATOR*)enumeration; |
| 310 | 310 | unsigned char *p; |
| 311 | 311 | int size, rc; |
| 312 | ||
| 312 | ||
| 313 | 313 | ent->eof=iter->index>=iter->image->count; |
| 314 | if (!ent->eof) | |
| 314 | if (!ent->eof) | |
| 315 | 315 | { |
| 316 | sprintf (ent->fname, "%s-%s.cas", | |
| 316 | sprintf (ent->fname, "%s-%s.cas", | |
| 317 | 317 | iter->image->entries[iter->index].title, |
| 318 | 318 | iter->image->entries[iter->index].type); |
| 319 | 319 | size = 0; |
| 320 | 320 | p = NULL; |
| 321 | rc = vmsx_tap_image_read_data (iter->image, | |
| 322 | iter->image->entries[iter->index].chunk, &p, &size); | |
| 321 | rc = vmsx_tap_image_read_data (iter->image, | |
| 322 | iter->image->entries[iter->index].chunk, &p, &size); | |
| 323 | 323 | |
| 324 | 324 | ent->corrupt=rc; |
| 325 | 325 | if (!rc) ent->filesize = size; |
| r1461 | r1462 | |
| 343 | 343 | |
| 344 | 344 | for (i=0; i<image->count; i++) |
| 345 | 345 | { |
| 346 | sprintf (filename, "%s-%s.cas", | |
| 346 | sprintf (filename, "%s-%s.cas", | |
| 347 | 347 | image->entries[i].title, image->entries[i].type); |
| 348 | 348 | if (!strcmp(fname, filename) ) return image->entries+i; |
| 349 | 349 | } |
| r1461 | r1462 | |
| 357 | 357 | unsigned char* p; |
| 358 | 358 | int size, rc; |
| 359 | 359 | |
| 360 | if ((entry=vmsx_tap_image_findfile(image, fname))==NULL ) | |
| 360 | if ((entry=vmsx_tap_image_findfile(image, fname))==NULL ) | |
| 361 | 361 | return IMGTOOLERR_MODULENOTFOUND; |
| 362 | 362 | |
| 363 | 363 | rc = vmsx_tap_image_read_data (image, entry->chunk, &p, &size); |
| r1461 | r1462 | |
|---|---|---|
| 73 | 73 | { |
| 74 | 74 | int len; |
| 75 | 75 | |
| 76 | for (len = 7; len > 0; len--) | |
| 76 | for (len = 7; len > 0; len--) | |
| 77 | 77 | if (fname[len] != 0x20) |
| 78 | 78 | break; |
| 79 | ||
| 80 | return len; | |
| 79 | ||
| 80 | return len; | |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | /* calculate checksum-16 of buffer */ |
| r1461 | r1462 | |
| 85 | 85 | { |
| 86 | 86 | int i; |
| 87 | 87 | UINT16 sum = 0; |
| 88 | ||
| 88 | ||
| 89 | 89 | for (i = 0; i < len; i++) |
| 90 | sum += buffer[i]; | |
| 91 | ||
| 90 | sum += buffer[i]; | |
| 91 | ||
| 92 | 92 | return sum; |
| 93 | 93 | } |
| 94 | 94 | |
| r1461 | r1462 | |
| 100 | 100 | |
| 101 | 101 | ret = floppy_read_sector(imgtool_floppy(img), 0, track, sector_order[sector], 0, &buffer, sizeof(buffer)); |
| 102 | 102 | if (ret) return ret; |
| 103 | ||
| 103 | ||
| 104 | 104 | /* search for start of data */ |
| 105 | 105 | if (memcmp(buffer + 19, "\xC3\x18\xE7\xFE", 4) == 0) |
| 106 | 106 | *start = 23; |
| r1461 | r1462 | |
| 131 | 131 | return IMGTOOLERR_CORRUPTFILE; |
| 132 | 132 | |
| 133 | 133 | memcpy(data, &buffer, DATA_SIZE + 2); |
| 134 | ||
| 134 | ||
| 135 | 135 | return IMGTOOLERR_SUCCESS; |
| 136 | 136 | } |
| 137 | 137 | |
| r1461 | r1462 | |
| 146 | 146 | |
| 147 | 147 | memcpy(buffer, data, DATA_SIZE + 2); |
| 148 | 148 | place_integer_le(buffer, DATA_SIZE + 2, 2, chksum16(data, DATA_SIZE + 2)); |
| 149 | ||
| 149 | ||
| 150 | 150 | ret = floppy_write_sector(imgtool_floppy(img), 0, track, sector_order[sector], data_start, buffer, sizeof(buffer)); |
| 151 | 151 | if (ret) return ret; |
| 152 | ||
| 152 | ||
| 153 | 153 | return IMGTOOLERR_SUCCESS; |
| 154 | 154 | } |
| 155 | 155 | |
| r1461 | r1462 | |
| 157 | 157 | static imgtoolerr_t vzdos_clear_sector(imgtool_image *img, int track, int sector) |
| 158 | 158 | { |
| 159 | 159 | UINT8 data[DATA_SIZE + 2]; |
| 160 | ||
| 160 | ||
| 161 | 161 | memset(data, 0x00, sizeof(data)); |
| 162 | ||
| 163 | return vzdos_write_sector_data(img, track, sector, data); | |
| 162 | ||
| 163 | return vzdos_write_sector_data(img, track, sector, data); | |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | /* return a directory entry for an index */ |
| r1461 | r1462 | |
| 171 | 171 | |
| 172 | 172 | ret = vzdos_read_sector_data(img, 0, (int) index / 8, buffer); |
| 173 | 173 | if (ret) return ret; |
| 174 | ||
| 174 | ||
| 175 | 175 | entry = ((index % 8) * sizeof(vzdos_dirent)); |
| 176 | 176 | |
| 177 | 177 | memcpy(ent, &buffer[entry], 10); |
| r1461 | r1462 | |
| 186 | 186 | /* check values */ |
| 187 | 187 | if (ent->start_track > 39) |
| 188 | 188 | return IMGTOOLERR_CORRUPTIMAGE; |
| 189 | ||
| 189 | ||
| 190 | 190 | if (ent->start_sector > 15) |
| 191 | 191 | return IMGTOOLERR_CORRUPTIMAGE; |
| 192 | 192 | |
| r1461 | r1462 | |
| 210 | 210 | place_integer_le(buffer, entry + 11, 1, ent.start_sector); |
| 211 | 211 | place_integer_le(buffer, entry + 12, 2, ent.start_address); |
| 212 | 212 | place_integer_le(buffer, entry + 14, 2, ent.end_address); |
| 213 | ||
| 213 | ||
| 214 | 214 | /* save new sector */ |
| 215 | 215 | ret = vzdos_write_sector_data(img, 0, (int) index / 8, buffer); |
| 216 | 216 | if (ret) return ret; |
| 217 | ||
| 218 | return IMGTOOLERR_SUCCESS; | |
| 217 | ||
| 218 | return IMGTOOLERR_SUCCESS; | |
| 219 | 219 | } |
| 220 | 220 | |
| 221 | 221 | /* clear a directory entry */ |
| r1461 | r1462 | |
| 228 | 228 | |
| 229 | 229 | ret = vzdos_set_dirent(img, index, entry); |
| 230 | 230 | if (ret) return ret; |
| 231 | ||
| 231 | ||
| 232 | 232 | return IMGTOOLERR_SUCCESS; |
| 233 | 233 | } |
| 234 | 234 | |
| r1461 | r1462 | |
| 241 | 241 | /* check for invalid filenames */ |
| 242 | 242 | if (strlen(fname) > 8) |
| 243 | 243 | return IMGTOOLERR_BADFILENAME; |
| 244 | ||
| 244 | ||
| 245 | 245 | /* TODO: check for invalid characters */ |
| 246 | ||
| 246 | ||
| 247 | 247 | *entry = -1; |
| 248 | ||
| 248 | ||
| 249 | 249 | for (i = 0; i < MAX_DIRENTS; i++) { |
| 250 | 250 | |
| 251 | 251 | ret = vzdos_get_dirent(image, i, &ent); |
| 252 | 252 | if (ret) return ret; |
| 253 | ||
| 253 | ||
| 254 | 254 | len = vzdos_get_fname_len(ent.fname) + 1; |
| 255 | 255 | |
| 256 | 256 | if (strlen(fname) != len) |
| 257 | 257 | continue; |
| 258 | ||
| 258 | ||
| 259 | 259 | memset(filename, 0x00, sizeof(filename)); |
| 260 | 260 | memcpy(filename, ent.fname, len); |
| 261 | 261 | |
| r1461 | r1462 | |
| 263 | 263 | *entry = i; |
| 264 | 264 | break; |
| 265 | 265 | } |
| 266 | ||
| 266 | ||
| 267 | 267 | } |
| 268 | ||
| 268 | ||
| 269 | 269 | if (*entry == -1) |
| 270 | 270 | return IMGTOOLERR_FILENOTFOUND; |
| 271 | 271 | |
| 272 | 272 | return IMGTOOLERR_SUCCESS; |
| 273 | } | |
| 273 | } | |
| 274 | 274 | |
| 275 | 275 | /* return a directory entry for a filename */ |
| 276 | 276 | static imgtoolerr_t vzdos_get_dirent_fname(imgtool_image *img, const char *fname, vzdos_dirent *ent) |
| r1461 | r1462 | |
| 279 | 279 | |
| 280 | 280 | ret = vzdos_searchentry(img, fname, &index); |
| 281 | 281 | if (ret) return ret; |
| 282 | ||
| 282 | ||
| 283 | 283 | ret = vzdos_get_dirent(img, index, ent); |
| 284 | if (ret) return ret; | |
| 285 | ||
| 284 | if (ret) return ret; | |
| 285 | ||
| 286 | 286 | return IMGTOOLERR_SUCCESS; |
| 287 | 287 | } |
| 288 | 288 | |
| r1461 | r1462 | |
| 305 | 305 | |
| 306 | 306 | ret = vzdos_write_sector_data(img, 0, 15, buffer); |
| 307 | 307 | if (ret) return ret; |
| 308 | ||
| 308 | ||
| 309 | 309 | return IMGTOOLERR_SUCCESS; |
| 310 | 310 | } |
| 311 | 311 | |
| r1461 | r1462 | |
| 339 | 339 | else |
| 340 | 340 | *used = 0; |
| 341 | 341 | |
| 342 | return IMGTOOLERR_SUCCESS; | |
| 342 | return IMGTOOLERR_SUCCESS; | |
| 343 | 343 | } |
| 344 | 344 | |
| 345 | 345 | /* return the next free sector */ |
| 346 | 346 | static imgtoolerr_t vzdos_free_trackmap(imgtool_image *img, int *track, int *sector) |
| 347 | 347 | { |
| 348 | 348 | int ret, used = 0; |
| 349 | ||
| 349 | ||
| 350 | 350 | for (*track = 1; *track < 40; (*track)++) { |
| 351 | 351 | for (*sector = 0; *sector < 16; (*sector)++) { |
| 352 | 352 | ret = vzdos_get_trackmap(img, *track, *sector, &used); |
| 353 | 353 | if (ret) return ret; |
| 354 | 354 | if (!used) return IMGTOOLERR_SUCCESS; |
| 355 | } | |
| 355 | } | |
| 356 | 356 | } |
| 357 | ||
| 357 | ||
| 358 | 358 | return IMGTOOLERR_NOSPACE; |
| 359 | 359 | } |
| 360 | 360 | |
| r1461 | r1462 | |
| 368 | 368 | 0x18, 0xC3, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, |
| 369 | 369 | 0x80, 0x80, 0x80, 0x00, 0xC3, 0x18, 0xE7, 0xFE |
| 370 | 370 | }; |
| 371 | ||
| 371 | ||
| 372 | 372 | memset(sector_data, 0x00, sizeof(sector_data)); |
| 373 | 373 | |
| 374 | 374 | sector_header[10] = (UINT8) track; /* current track */ |
| r1461 | r1462 | |
| 406 | 406 | vz_iterator *iter = (vz_iterator *) imgtool_directory_extrabytes(enumeration); |
| 407 | 407 | |
| 408 | 408 | if (iter->eof == 1 || iter->index > MAX_DIRENTS) { |
| 409 | ||
| 409 | ||
| 410 | 410 | ent->eof = 1; |
| 411 | ||
| 411 | ||
| 412 | 412 | } else { |
| 413 | ||
| 413 | ||
| 414 | 414 | const char *type; |
| 415 | 415 | int ret, len; |
| 416 | 416 | vzdos_dirent dirent; |
| 417 | 417 | |
| 418 | 418 | ret = vzdos_get_dirent(imgtool_directory_image(enumeration), iter->index - 1, &dirent); |
| 419 | ||
| 419 | ||
| 420 | 420 | if (dirent.ftype == 0x00) { |
| 421 | 421 | iter->eof = 1; |
| 422 | 422 | ent->eof = 1; |
| 423 | 423 | return IMGTOOLERR_SUCCESS; |
| 424 | 424 | } |
| 425 | ||
| 425 | ||
| 426 | 426 | /* kill trailing spaces */ |
| 427 | for (len = 7; len > 0; len--) { | |
| 427 | for (len = 7; len > 0; len--) { | |
| 428 | 428 | if (dirent.fname[len] != 0x20) { |
| 429 | 429 | break; |
| 430 | 430 | } |
| 431 | 431 | } |
| 432 | ||
| 432 | ||
| 433 | 433 | memcpy(ent->filename, &dirent.fname, len + 1); |
| 434 | 434 | ent->filesize = dirent.end_address - dirent.start_address; |
| 435 | ||
| 435 | ||
| 436 | 436 | switch (dirent.ftype) { |
| 437 | 437 | case 'T': type = "Basic"; break; |
| 438 | 438 | case 'B': type = "Binary"; break; |
| r1461 | r1462 | |
| 444 | 444 | default: type = "Unknown"; |
| 445 | 445 | } |
| 446 | 446 | snprintf(ent->attr, sizeof(ent->attr) / sizeof(ent->attr[0]), "%s", type); |
| 447 | ||
| 448 | iter->index++; | |
| 447 | ||
| 448 | iter->index++; | |
| 449 | 449 | } |
| 450 | ||
| 450 | ||
| 451 | 451 | return IMGTOOLERR_SUCCESS; |
| 452 | 452 | } |
| 453 | 453 | |
| r1461 | r1462 | |
| 483 | 483 | int filesize, track, sector; |
| 484 | 484 | vzdos_dirent ent; |
| 485 | 485 | UINT8 buffer[DATA_SIZE + 2]; |
| 486 | ||
| 486 | ||
| 487 | 487 | ret = vzdos_get_dirent_fname(image, filename, &ent); |
| 488 | 488 | if (ret) return ret; |
| 489 | ||
| 489 | ||
| 490 | 490 | filesize = ent.end_address - ent.start_address; |
| 491 | 491 | track = ent.start_track; |
| 492 | 492 | sector = ent.start_sector; |
| r1461 | r1462 | |
| 501 | 501 | if ((track == pick_integer_le(buffer, DATA_SIZE, 1)) && (sector == pick_integer_le(buffer, DATA_SIZE + 1, 1))) |
| 502 | 502 | return IMGTOOLERR_CORRUPTIMAGE; |
| 503 | 503 | |
| 504 | /* load next track and sector values */ | |
| 504 | /* load next track and sector values */ | |
| 505 | 505 | track = pick_integer_le(buffer, DATA_SIZE, 1); |
| 506 | 506 | sector = pick_integer_le(buffer, DATA_SIZE + 1, 1); |
| 507 | ||
| 507 | ||
| 508 | 508 | /* track 0 is invalid */ |
| 509 | 509 | if ((track == 0) && (filesize > DATA_SIZE)) |
| 510 | 510 | return IMGTOOLERR_CORRUPTIMAGE; |
| 511 | ||
| 511 | ||
| 512 | 512 | /* write either DATA_SIZE or the remaining bytes */ |
| 513 | 513 | towrite = filesize > DATA_SIZE ? DATA_SIZE : filesize; |
| 514 | ||
| 514 | ||
| 515 | 515 | if (stream_write(destf, buffer, towrite) != towrite) |
| 516 | 516 | return IMGTOOLERR_WRITEERROR; |
| 517 | 517 | |
| 518 | 518 | filesize -= DATA_SIZE; |
| 519 | 519 | } |
| 520 | ||
| 520 | ||
| 521 | 521 | return IMGTOOLERR_SUCCESS; |
| 522 | 522 | } |
| 523 | 523 | |
| r1461 | r1462 | |
| 565 | 565 | while ((ret = vzdos_get_dirent(img, index + 1, &next_entry)) != IMGTOOLERR_FILENOTFOUND) { |
| 566 | 566 | if (ret) return ret; |
| 567 | 567 | ret = vzdos_set_dirent(img, index++, next_entry); |
| 568 | if (ret) return ret; | |
| 568 | if (ret) return ret; | |
| 569 | 569 | } |
| 570 | 570 | |
| 571 | 571 | ret = vzdos_clear_dirent(img, index); |
| 572 | 572 | if (ret) return ret; |
| 573 | ||
| 573 | ||
| 574 | 574 | } |
| 575 | ||
| 575 | ||
| 576 | 576 | /* clear sectors and trackmap entries */ |
| 577 | 577 | while (filesize > 0) { |
| 578 | ||
| 578 | ||
| 579 | 579 | filesize -= DATA_SIZE; |
| 580 | ||
| 580 | ||
| 581 | 581 | /* clear trackmap entry */ |
| 582 | 582 | ret = vzdos_clear_trackmap(img, track, sector); |
| 583 | 583 | if (ret) return ret; |
| 584 | 584 | |
| 585 | /* load next track and sector values */ | |
| 585 | /* load next track and sector values */ | |
| 586 | 586 | next_track = pick_integer_le(buffer, DATA_SIZE, 1); |
| 587 | 587 | next_sector = pick_integer_le(buffer, DATA_SIZE + 1, 1); |
| 588 | ||
| 588 | ||
| 589 | 589 | /* overwrite sector with default values */ |
| 590 | 590 | ret = vzdos_clear_sector(img, track, sector); |
| 591 | 591 | if (ret) return ret; |
| r1461 | r1462 | |
| 597 | 597 | if (filesize > 0) { |
| 598 | 598 | ret = floppy_read_sector(imgtool_floppy(img), 0, track, sector_order[sector], 24, &buffer, DATA_SIZE + 2); |
| 599 | 599 | if (ret) return ret; |
| 600 | } | |
| 601 | ||
| 600 | } | |
| 601 | ||
| 602 | 602 | } |
| 603 | ||
| 603 | ||
| 604 | 604 | return IMGTOOLERR_SUCCESS; |
| 605 | 605 | } |
| 606 | 606 | |
| r1461 | r1462 | |
| 630 | 630 | /* another error occured, return it */ |
| 631 | 631 | return ret; |
| 632 | 632 | } |
| 633 | ||
| 633 | ||
| 634 | 634 | ret = stream_seek(sourcef, offset, SEEK_SET); |
| 635 | 635 | if (ret) return ret; |
| 636 | 636 | |
| r1461 | r1462 | |
| 642 | 642 | |
| 643 | 643 | if (filesize > freespace) |
| 644 | 644 | return IMGTOOLERR_NOSPACE; |
| 645 | ||
| 645 | ||
| 646 | 646 | /* get next free track and sector */ |
| 647 | 647 | ret = vzdos_free_trackmap(img, &track, §or); |
| 648 | 648 | if (ret) return ret; |
| r1461 | r1462 | |
| 666 | 666 | |
| 667 | 667 | next_track = 0; |
| 668 | 668 | next_sector = 0; |
| 669 | ||
| 669 | ||
| 670 | 670 | /* write data to disk */ |
| 671 | 671 | while (filesize > 0) { |
| 672 | ||
| 672 | ||
| 673 | 673 | toread = filesize > DATA_SIZE ? DATA_SIZE : filesize; |
| 674 | 674 | stream_read(sourcef, buffer, toread); |
| 675 | 675 | |
| 676 | filesize -= toread; | |
| 676 | filesize -= toread; | |
| 677 | 677 | |
| 678 | 678 | /* mark sector as used */ |
| 679 | 679 | ret = vzdos_set_trackmap(img, track, sector); |
| 680 | 680 | if (ret) return ret; |
| 681 | 681 | |
| 682 | 682 | /* get track and sector for next sector */ |
| 683 | if (filesize > 0) { | |
| 683 | if (filesize > 0) { | |
| 684 | 684 | ret = vzdos_free_trackmap(img, &next_track, &next_sector); |
| 685 | 685 | if (ret) return ret; |
| 686 | 686 | } else { |
| r1461 | r1462 | |
| 697 | 697 | track = next_track; |
| 698 | 698 | sector = next_sector; |
| 699 | 699 | } |
| 700 | ||
| 700 | ||
| 701 | 701 | return IMGTOOLERR_SUCCESS; |
| 702 | ||
| 702 | ||
| 703 | 703 | } |
| 704 | 704 | |
| 705 | 705 | /* create a new file or overwrite a file */ |
| r1461 | r1462 | |
| 712 | 712 | /* TODO: check for leading spaces and strip */ |
| 713 | 713 | if (strlen(filename) > 8 || strlen(filename) < 1) |
| 714 | 714 | return IMGTOOLERR_BADFILENAME; |
| 715 | ||
| 715 | ||
| 716 | 716 | /* prepare directory entry */ |
| 717 | 717 | ftype = option_resolution_lookup_int(opts, 'T'); |
| 718 | 718 | |
| r1461 | r1462 | |
| 732 | 732 | default: |
| 733 | 733 | break; |
| 734 | 734 | } |
| 735 | ||
| 735 | ||
| 736 | 736 | entry.delimitor = ':'; |
| 737 | 737 | memset(&entry.fname, 0x20, 8); /* pad with spaces */ |
| 738 | memcpy(&entry.fname, filename, strlen(filename)); | |
| 738 | memcpy(&entry.fname, filename, strlen(filename)); | |
| 739 | 739 | |
| 740 | 740 | /* write file to disk */ |
| 741 | 741 | ret = vzdos_writefile(partition, 0, sourcef, &entry); |
| 742 | 742 | if (ret) return ret; |
| 743 | ||
| 743 | ||
| 744 | 744 | return IMGTOOLERR_SUCCESS; |
| 745 | 745 | } |
| 746 | 746 | |
| r1461 | r1462 | |
| 749 | 749 | imgtoolerr_t ret; |
| 750 | 750 | imgtool_image *image = imgtool_partition_image(partition); |
| 751 | 751 | vzdos_dirent entry; |
| 752 | ||
| 752 | ||
| 753 | 753 | if (fname) { |
| 754 | 754 | |
| 755 | 755 | ret = vzdos_get_dirent_fname(image, fname, &entry); |
| 756 | 756 | if (ret) return ret; |
| 757 | ||
| 757 | ||
| 758 | 758 | switch (entry.ftype) { |
| 759 | 759 | case 'B': |
| 760 | 760 | suggestions[0].viability = SUGGESTION_RECOMMENDED; |
| r1461 | r1462 | |
| 770 | 770 | suggestions[0].description = "VZ Snapshot"; |
| 771 | 771 | suggestions[1].viability = SUGGESTION_POSSIBLE; |
| 772 | 772 | suggestions[1].filter = NULL; |
| 773 | suggestions[1].description = "Raw"; | |
| 773 | suggestions[1].description = "Raw"; | |
| 774 | 774 | suggestions[2].viability = SUGGESTION_POSSIBLE; |
| 775 | 775 | suggestions[2].filter = filter_vzbas_getinfo; |
| 776 | 776 | suggestions[2].description = "Tokenized Basic"; |
| r1461 | r1462 | |
| 778 | 778 | default: |
| 779 | 779 | suggestions[0].viability = SUGGESTION_RECOMMENDED; |
| 780 | 780 | suggestions[0].filter = NULL; |
| 781 | suggestions[0].description = "Raw"; | |
| 781 | suggestions[0].description = "Raw"; | |
| 782 | 782 | } |
| 783 | ||
| 784 | } else { | |
| 783 | ||
| 784 | } else { | |
| 785 | 785 | suggestions[0].viability = SUGGESTION_RECOMMENDED; |
| 786 | 786 | suggestions[0].filter = NULL; |
| 787 | 787 | suggestions[0].description = "Raw"; |
| r1461 | r1462 | |
| 789 | 789 | suggestions[1].filter = filter_vzsnapshot_getinfo; |
| 790 | 790 | suggestions[1].description = "VZ Snapshot"; |
| 791 | 791 | } |
| 792 | ||
| 792 | ||
| 793 | 793 | return IMGTOOLERR_SUCCESS; |
| 794 | 794 | } |
| 795 | 795 | |
| r1461 | r1462 | |
| 804 | 804 | if (ret) return ret; |
| 805 | 805 | } |
| 806 | 806 | } |
| 807 | ||
| 807 | ||
| 808 | 808 | return IMGTOOLERR_SUCCESS; |
| 809 | 809 | } |
| 810 | 810 | |
| r1461 | r1462 | |
| 818 | 818 | imgtool_image *image = imgtool_partition_image(partition); |
| 819 | 819 | vzdos_dirent entry; |
| 820 | 820 | UINT8 header[24]; |
| 821 | ||
| 822 | /* get directory entry from disk */ | |
| 821 | ||
| 822 | /* get directory entry from disk */ | |
| 823 | 823 | ret = vzdos_get_dirent_fname(image, filename, &entry); |
| 824 | 824 | if (ret) return ret; |
| 825 | 825 | |
| r1461 | r1462 | |
| 827 | 827 | header[0] = 'V'; |
| 828 | 828 | header[1] = 'Z'; |
| 829 | 829 | header[2] = 'F'; |
| 830 | ||
| 830 | ||
| 831 | 831 | switch (entry.ftype) { |
| 832 | 832 | case 'B': |
| 833 | 833 | header[3] = '1'; |
| r1461 | r1462 | |
| 835 | 835 | break; |
| 836 | 836 | case 'T': |
| 837 | 837 | header[3] = '0'; |
| 838 | header[21] = 0xF0; | |
| 838 | header[21] = 0xF0; | |
| 839 | 839 | break; |
| 840 | 840 | default: |
| 841 | 841 | memset(header, 0x00, 4); |
| 842 | 842 | header[21] = 0x00; |
| 843 | 843 | } |
| 844 | ||
| 844 | ||
| 845 | 845 | memset(header + 4, 0x00, 17); |
| 846 | 846 | memcpy(header + 4, entry.fname, vzdos_get_fname_len(entry.fname) + 1); |
| 847 | 847 | place_integer_le(header, 22, 2, entry.start_address); |
| r1461 | r1462 | |
| 865 | 865 | |
| 866 | 866 | /* get header infos from file */ |
| 867 | 867 | stream_read(sourcef, header, sizeof(header)); |
| 868 | ||
| 869 | /* prepare directory entry */ | |
| 868 | ||
| 869 | /* prepare directory entry */ | |
| 870 | 870 | entry.ftype = header[21] == 0xF1 ? 'B' : 'T'; |
| 871 | 871 | entry.delimitor = ':'; |
| 872 | 872 | entry.start_address = pick_integer_le(header, 22, 2); |
| 873 | ||
| 873 | ||
| 874 | 874 | /* filename from header or directly? */ |
| 875 | 875 | fnameopt = option_resolution_lookup_int(opts, 'F'); |
| 876 | ||
| 876 | ||
| 877 | 877 | if (fnameopt == 0) { |
| 878 | memcpy(&entry.fname, &header[4], 8); | |
| 878 | memcpy(&entry.fname, &header[4], 8); | |
| 879 | 879 | } else { |
| 880 | 880 | /* TODO: check for leading spaces and strip */ |
| 881 | 881 | if (strlen(filename) > 8 || strlen(filename) < 1) |
| 882 | 882 | return IMGTOOLERR_BADFILENAME; |
| 883 | ||
| 883 | ||
| 884 | 884 | memcpy(&entry.fname, filename, strlen(filename) - 3); |
| 885 | 885 | } |
| 886 | ||
| 886 | ||
| 887 | 887 | /* write file to disk */ |
| 888 | 888 | ret = vzdos_writefile(partition, 24, sourcef, &entry); |
| 889 | 889 | if (ret) return ret; |
| r1461 | r1462 | |
| 920 | 920 | OPTION_GUIDE_END |
| 921 | 921 | |
| 922 | 922 | /* |
| 923 | T Basic Editor File | |
| 924 | B Binary File | |
| 925 | D Sequential Access Program Data File | |
| 926 | F Quickwrite Document | |
| 927 | A Russell Harrison's Edit Ass. File | |
| 928 | S Dave Mitchell/Mark Hardwood Edit Ass. File Start Addr A280H | |
| 929 | S Quickwrite/Diskops System File/Label Except Above | |
| 930 | W Edit Ass. with Diskops File Start Addr A813H | |
| 931 | W E & F Word Pro with Patch 3.3 File End Addr D000H | |
| 932 | W Russell Harrison Word Pro File Except above two | |
| 923 | T Basic Editor File | |
| 924 | B Binary File | |
| 925 | D Sequential Access Program Data File | |
| 926 | F Quickwrite Document | |
| 927 | A Russell Harrison's Edit Ass. File | |
| 928 | S Dave Mitchell/Mark Hardwood Edit Ass. File Start Addr A280H | |
| 929 | S Quickwrite/Diskops System File/Label Except Above | |
| 930 | W Edit Ass. with Diskops File Start Addr A813H | |
| 931 | W E & F Word Pro with Patch 3.3 File End Addr D000H | |
| 932 | W Russell Harrison Word Pro File Except above two | |
| 933 | 933 | */ |
| 934 | 934 | |
| 935 | 935 | void vzdos_get_info(const imgtool_class *imgclass, UINT32 state, union imgtoolinfo *info) |
| r1461 | r1462 | |
|---|---|---|
| 304 | 304 | prodos_find_block_525(image, block, &track, &head, §or1, §or2); |
| 305 | 305 | |
| 306 | 306 | /* read first sector */ |
| 307 | ferr = floppy_read_sector(imgtool_floppy(image), head, track, | |
| 307 | ferr = floppy_read_sector(imgtool_floppy(image), head, track, | |
| 308 | 308 | sector1, 0, ((UINT8 *) buffer) + 0, 256); |
| 309 | 309 | if (ferr) |
| 310 | 310 | return imgtool_floppy_error(ferr); |
| r1461 | r1462 | |
| 329 | 329 | prodos_find_block_525(image, block, &track, &head, §or1, §or2); |
| 330 | 330 | |
| 331 | 331 | /* read first sector */ |
| 332 | ferr = floppy_write_sector(imgtool_floppy(image), head, track, | |
| 332 | ferr = floppy_write_sector(imgtool_floppy(image), head, track, | |
| 333 | 333 | sector1, 0, ((const UINT8 *) buffer) + 0, 256); |
| 334 | 334 | if (ferr) |
| 335 | 335 | return imgtool_floppy_error(ferr); |
| r1461 | r1462 | |
| 760 | 760 | { |
| 761 | 761 | if (side) |
| 762 | 762 | return NULL; |
| 763 | ||
| 763 | ||
| 764 | 764 | side = 0x100; |
| 765 | 765 | subpos = 8; |
| 766 | 766 | } |
| r1461 | r1462 | |
| 1111 | 1111 | !is_dir_storagetype(ent->storage_type)))); |
| 1112 | 1112 | |
| 1113 | 1113 | old_path = path; |
| 1114 | path += strlen(path) + 1; | |
| 1114 | path += strlen(path) + 1; | |
| 1115 | 1115 | if (*path) |
| 1116 | 1116 | { |
| 1117 | 1117 | /* we have found part of the path; we are not finished yet */ |
| r1461 | r1462 | |
| 1243 | 1243 | } |
| 1244 | 1244 | |
| 1245 | 1245 | for (i = 0; i < 256; i++) |
| 1246 | { | |
| 1246 | { | |
| 1247 | 1247 | sub_block_allocated = FALSE; |
| 1248 | 1248 | |
| 1249 | 1249 | sub_block = buffer[i + 256]; |
| r1461 | r1462 | |
| 1391 | 1391 | block <<= 8; |
| 1392 | 1392 | block |= buffer[0]; |
| 1393 | 1393 | key_pointer = block; |
| 1394 | ||
| 1394 | ||
| 1395 | 1395 | depth--; |
| 1396 | 1396 | } |
| 1397 | 1397 | |
| r1461 | r1462 | |
| 1729 | 1729 | |
| 1730 | 1730 | if (key_pointer != 0) |
| 1731 | 1731 | { |
| 1732 | err = prodos_read_file_tree(image, &ent.filesize[fork_num], key_pointer, | |
| 1732 | err = prodos_read_file_tree(image, &ent.filesize[fork_num], key_pointer, | |
| 1733 | 1733 | nest_level, destf); |
| 1734 | 1734 | if (err) |
| 1735 | 1735 | return err; |
| r1461 | r1462 | |
| 2175 | 2175 | if (err) |
| 2176 | 2176 | return err; |
| 2177 | 2177 | break; |
| 2178 | ||
| 2178 | ||
| 2179 | 2179 | case 0x50: |
| 2180 | 2180 | /* extended ProDOS file */ |
| 2181 | 2181 | chain[chain_pos].level = 0; |
| r1461 | r1462 | |
|---|---|---|
| 35 | 35 | */ |
| 36 | 36 | |
| 37 | 37 | /* |
| 38 | * .dsk multidisks are used by fmsx-dos 1.6. These files are always double | |
| 38 | * .dsk multidisks are used by fmsx-dos 1.6. These files are always double | |
| 39 | 39 | * sided 3.5" disks (720kB), simply appended to one another. |
| 40 | 40 | */ |
| 41 | 41 | |
| r1461 | r1462 | |
| 46 | 46 | |
| 47 | 47 | |
| 48 | 48 | typedef struct { |
| 49 | imgtool_image base; | |
| 49 | imgtool_image base; | |
| 50 | 50 | char *file_name; |
| 51 | 51 | imgtool_stream *file_handle; |
| 52 | 52 | int size, format, disks; |
| r1461 | r1462 | |
| 178 | 178 | UINT8 header; |
| 179 | 179 | |
| 180 | 180 | size = stream_size (f); |
| 181 | if (size < (360*1024) ) | |
| 181 | if (size < (360*1024) ) | |
| 182 | 182 | return IMGTOOLERR_MODULENOTFOUND; |
| 183 | ||
| 183 | ||
| 184 | 184 | disks = 1; |
| 185 | 185 | |
| 186 | 186 | correct = 0; |
| r1461 | r1462 | |
| 188 | 188 | if (!strcmp(mod->name, "msx_img")) |
| 189 | 189 | { |
| 190 | 190 | format = FORMAT_IMG; |
| 191 | if (1 != stream_read (f, &header, 1) ) | |
| 191 | if (1 != stream_read (f, &header, 1) ) | |
| 192 | 192 | return IMGTOOLERR_READERROR; |
| 193 | 193 | |
| 194 | 194 | if ( (size == (720*1024+1) ) && (header == 2) ) |
| r1461 | r1462 | |
| 232 | 232 | assert(0); |
| 233 | 233 | return IMGTOOLERR_UNEXPECTED; |
| 234 | 234 | } |
| 235 | ||
| 235 | ||
| 236 | 236 | if (!correct) return IMGTOOLERR_MODULENOTFOUND; |
| 237 | 237 | |
| 238 | 238 | image = (DSK_IMAGE*)malloc (sizeof (DSK_IMAGE) ); |
| r1461 | r1462 | |
| 267 | 267 | iter=*(DSK_ITERATOR**)outenum = (DSK_ITERATOR*) malloc(sizeof(DSK_ITERATOR)); |
| 268 | 268 | if (!iter) return IMGTOOLERR_OUTOFMEMORY; |
| 269 | 269 | |
| 270 | iter->base.module = image->base.module; | |
| 270 | iter->base.module = image->base.module; | |
| 271 | 271 | iter->image=image; |
| 272 | 272 | iter->index = 1; |
| 273 | 273 | |
| r1461 | r1462 | |
| 314 | 314 | /* check file name */ |
| 315 | 315 | switch (image->format) |
| 316 | 316 | { |
| 317 | case FORMAT_IMG: | |
| 318 | case FORMAT_DDI: | |
| 319 | case FORMAT_MSX: | |
| 320 | if (strcmpi (fname, "msx.dsk") ) | |
| 317 | case FORMAT_IMG: | |
| 318 | case FORMAT_DDI: | |
| 319 | case FORMAT_MSX: | |
| 320 | if (strcmpi (fname, "msx.dsk") ) | |
| 321 | 321 | return IMGTOOLERR_MODULENOTFOUND; |
| 322 | 322 | break; |
| 323 | 323 | case FORMAT_MULTI: |
| r1461 | r1462 | |
| 359 | 359 | } |
| 360 | 360 | |
| 361 | 361 | return 0; |
| 362 | case FORMAT_IMG: | |
| 363 | offset = 1; i = (image->size / 0x1200); | |
| 362 | case FORMAT_IMG: | |
| 363 | offset = 1; i = (image->size / 0x1200); | |
| 364 | 364 | break; |
| 365 | case FORMAT_DDI: | |
| 366 | offset = 0x1200; i = 160; | |
| 365 | case FORMAT_DDI: | |
| 366 | offset = 0x1200; i = 160; | |
| 367 | 367 | break; |
| 368 | 368 | case FORMAT_MULTI: /* multi disk */ |
| 369 | 369 | i = 160; offset = 720*1024 * (disks - 1); |
| r1461 | r1462 | |
|---|---|---|
| 70 | 70 | 38 1 Signature |
| 71 | 71 | 39 4 ID |
| 72 | 72 | 43 11 Volume Label |
| 73 | 54 8 FAT file system type | |
| 73 | 54 8 FAT file system type | |
| 74 | 74 | 62 448 Boot machine code |
| 75 | 75 | 510 2 Magic bytes (0x55 0xAA) |
| 76 | 76 | |
| r1461 | r1462 | |
| 119 | 119 | 14 12 Name characters (six UTF-16LE chars) |
| 120 | 120 | 26 2 Entry Cluster (always 0x00) |
| 121 | 121 | 28 4 Name characters (two UTF-16LE chars) |
| 122 | ||
| 122 | ||
| 123 | 123 | Valid characters in DOS file names: |
| 124 | 124 | - Upper case letters A-Z |
| 125 | 125 | - Numbers 0-9 |
| 126 | 126 | - Space (though there is no way to identify a trailing space) |
| 127 | - ! # $ % & ( ) - @ ^ _ ` { } ~ | |
| 127 | - ! # $ % & ( ) - @ ^ _ ` { } ~ | |
| 128 | 128 | - Characters 128-255 (though the code page is indeterminate) |
| 129 | 129 | |
| 130 | 130 | For more information: |
| r1461 | r1462 | |
| 230 | 230 | /* boot sector code taken from FreeDOS */ |
| 231 | 231 | static const UINT8 boot_sector_code[] = |
| 232 | 232 | { |
| 233 | 0xfa, 0xfc, 0x31, 0xc0, 0x8e, 0xd8, 0xbd, 0x00, 0x7c, 0xb8, 0xe0, 0x1f, | |
| 234 | 0x8e, 0xc0, 0x89, 0xee, 0x89, 0xef, 0xb9, 0x00, 0x01, 0xf3, 0xa5, 0xea, | |
| 235 | 0x5e, 0x7c, 0xe0, 0x1f, 0x00, 0x00, 0x60, 0x00, 0x8e, 0xd8, 0x8e, 0xd0, | |
| 236 | 0x8d, 0x66, 0xa0, 0xfb, 0x80, 0x7e, 0x24, 0xff, 0x75, 0x03, 0x88, 0x56, | |
| 237 | 0x24, 0xc7, 0x46, 0xc0, 0x10, 0x00, 0xc7, 0x46, 0xc2, 0x01, 0x00, 0x8b, | |
| 238 | 0x76, 0x1c, 0x8b, 0x7e, 0x1e, 0x03, 0x76, 0x0e, 0x83, 0xd7, 0x00, 0x89, | |
| 239 | 0x76, 0xd2, 0x89, 0x7e, 0xd4, 0x8a, 0x46, 0x10, 0x98, 0xf7, 0x66, 0x16, | |
| 240 | 0x01, 0xc6, 0x11, 0xd7, 0x89, 0x76, 0xd6, 0x89, 0x7e, 0xd8, 0x8b, 0x5e, | |
| 241 | 0x0b, 0xb1, 0x05, 0xd3, 0xeb, 0x8b, 0x46, 0x11, 0x31, 0xd2, 0xf7, 0xf3, | |
| 242 | 0x89, 0x46, 0xd0, 0x01, 0xc6, 0x83, 0xd7, 0x00, 0x89, 0x76, 0xda, 0x89, | |
| 243 | 0x7e, 0xdc, 0x8b, 0x46, 0xd6, 0x8b, 0x56, 0xd8, 0x8b, 0x7e, 0xd0, 0xc4, | |
| 244 | 0x5e, 0x5a, 0xe8, 0xac, 0x00, 0xc4, 0x7e, 0x5a, 0xb9, 0x0b, 0x00, 0xbe, | |
| 245 | 0xf1, 0x7d, 0x57, 0xf3, 0xa6, 0x5f, 0x26, 0x8b, 0x45, 0x1a, 0x74, 0x0b, | |
| 246 | 0x83, 0xc7, 0x20, 0x26, 0x80, 0x3d, 0x00, 0x75, 0xe7, 0x72, 0x68, 0x50, | |
| 247 | 0xc4, 0x5e, 0x5a, 0x8b, 0x7e, 0x16, 0x8b, 0x46, 0xd2, 0x8b, 0x56, 0xd4, | |
| 248 | 0xe8, 0x7e, 0x00, 0x58, 0x1e, 0x07, 0x8e, 0x5e, 0x5c, 0xbf, 0x00, 0x20, | |
| 249 | 0xab, 0x89, 0xc6, 0x01, 0xf6, 0x01, 0xc6, 0xd1, 0xee, 0xad, 0x73, 0x04, | |
| 250 | 0xb1, 0x04, 0xd3, 0xe8, 0x80, 0xe4, 0x0f, 0x3d, 0xf8, 0x0f, 0x72, 0xe8, | |
| 251 | 0x31, 0xc0, 0xab, 0x0e, 0x1f, 0xc4, 0x5e, 0x5a, 0xbe, 0x00, 0x20, 0xad, | |
| 252 | 0x09, 0xc0, 0x75, 0x05, 0x88, 0xd3, 0xff, 0x6e, 0x5a, 0x48, 0x48, 0x8b, | |
| 253 | 0x7e, 0x0d, 0x81, 0xe7, 0xff, 0x00, 0xf7, 0xe7, 0x03, 0x46, 0xda, 0x13, | |
| 254 | 0x56, 0xdc, 0xe8, 0x34, 0x00, 0xeb, 0xe0, 0x5e, 0xac, 0x56, 0xb4, 0x0e, | |
| 255 | 0xcd, 0x10, 0x3c, 0x2e, 0x75, 0xf5, 0xc3, 0xe8, 0xf1, 0xff, 0x45, 0x72, | |
| 256 | 0x72, 0x6f, 0x72, 0x21, 0x20, 0x48, 0x69, 0x74, 0x20, 0x61, 0x20, 0x6b, | |
| 257 | 0x65, 0x79, 0x20, 0x74, 0x6f, 0x20, 0x72, 0x65, 0x62, 0x6f, 0x6f, 0x74, | |
| 258 | 0x2e, 0x30, 0xe4, 0xcd, 0x13, 0xcd, 0x16, 0xcd, 0x19, 0x56, 0x89, 0x46, | |
| 259 | 0xc8, 0x89, 0x56, 0xca, 0x8c, 0x46, 0xc6, 0x89, 0x5e, 0xc4, 0xe8, 0xbe, | |
| 260 | 0xff, 0x2e, 0xb4, 0x41, 0xbb, 0xaa, 0x55, 0x8a, 0x56, 0x24, 0x84, 0xd2, | |
| 261 | 0x74, 0x19, 0xcd, 0x13, 0x72, 0x15, 0xd1, 0xe9, 0x81, 0xdb, 0x54, 0xaa, | |
| 262 | 0x75, 0x0d, 0x8d, 0x76, 0xc0, 0x89, 0x5e, 0xcc, 0x89, 0x5e, 0xce, 0xb4, | |
| 263 | 0x42, 0xeb, 0x26, 0x8b, 0x4e, 0xc8, 0x8b, 0x56, 0xca, 0x8a, 0x46, 0x18, | |
| 264 | 0xf6, 0x66, 0x1a, 0x91, 0xf7, 0xf1, 0x92, 0xf6, 0x76, 0x18, 0x89, 0xd1, | |
| 265 | 0x88, 0xc6, 0x86, 0xe9, 0xd0, 0xc9, 0xd0, 0xc9, 0x08, 0xe1, 0x41, 0xc4, | |
| 266 | 0x5e, 0xc4, 0xb8, 0x01, 0x02, 0x8a, 0x56, 0x24, 0xcd, 0x13, 0x0f, 0x82, | |
| 267 | 0x75, 0xff, 0x8b, 0x46, 0x0b, 0xf6, 0x76, 0xc0, 0x01, 0x46, 0xc6, 0x83, | |
| 268 | 0x46, 0xc8, 0x01, 0x83, 0x56, 0xca, 0x00, 0x4f, 0x75, 0x98, 0x8e, 0x46, | |
| 269 | 0xc6, 0x5e, 0xc3, 0x4d, 0x45, 0x54, 0x41, 0x4b, 0x45, 0x52, 0x4e, 0x53, | |
| 233 | 0xfa, 0xfc, 0x31, 0xc0, 0x8e, 0xd8, 0xbd, 0x00, 0x7c, 0xb8, 0xe0, 0x1f, | |
| 234 | 0x8e, 0xc0, 0x89, 0xee, 0x89, 0xef, 0xb9, 0x00, 0x01, 0xf3, 0xa5, 0xea, | |
| 235 | 0x5e, 0x7c, 0xe0, 0x1f, 0x00, 0x00, 0x60, 0x00, 0x8e, 0xd8, 0x8e, 0xd0, | |
| 236 | 0x8d, 0x66, 0xa0, 0xfb, 0x80, 0x7e, 0x24, 0xff, 0x75, 0x03, 0x88, 0x56, | |
| 237 | 0x24, 0xc7, 0x46, 0xc0, 0x10, 0x00, 0xc7, 0x46, 0xc2, 0x01, 0x00, 0x8b, | |
| 238 | 0x76, 0x1c, 0x8b, 0x7e, 0x1e, 0x03, 0x76, 0x0e, 0x83, 0xd7, 0x00, 0x89, | |
| 239 | 0x76, 0xd2, 0x89, 0x7e, 0xd4, 0x8a, 0x46, 0x10, 0x98, 0xf7, 0x66, 0x16, | |
| 240 | 0x01, 0xc6, 0x11, 0xd7, 0x89, 0x76, 0xd6, 0x89, 0x7e, 0xd8, 0x8b, 0x5e, | |
| 241 | 0x0b, 0xb1, 0x05, 0xd3, 0xeb, 0x8b, 0x46, 0x11, 0x31, 0xd2, 0xf7, 0xf3, | |
| 242 | 0x89, 0x46, 0xd0, 0x01, 0xc6, 0x83, 0xd7, 0x00, 0x89, 0x76, 0xda, 0x89, | |
| 243 | 0x7e, 0xdc, 0x8b, 0x46, 0xd6, 0x8b, 0x56, 0xd8, 0x8b, 0x7e, 0xd0, 0xc4, | |
| 244 | 0x5e, 0x5a, 0xe8, 0xac, 0x00, 0xc4, 0x7e, 0x5a, 0xb9, 0x0b, 0x00, 0xbe, | |
| 245 | 0xf1, 0x7d, 0x57, 0xf3, 0xa6, 0x5f, 0x26, 0x8b, 0x45, 0x1a, 0x74, 0x0b, | |
| 246 | 0x83, 0xc7, 0x20, 0x26, 0x80, 0x3d, 0x00, 0x75, 0xe7, 0x72, 0x68, 0x50, | |
| 247 | 0xc4, 0x5e, 0x5a, 0x8b, 0x7e, 0x16, 0x8b, 0x46, 0xd2, 0x8b, 0x56, 0xd4, | |
| 248 | 0xe8, 0x7e, 0x00, 0x58, 0x1e, 0x07, 0x8e, 0x5e, 0x5c, 0xbf, 0x00, 0x20, | |
| 249 | 0xab, 0x89, 0xc6, 0x01, 0xf6, 0x01, 0xc6, 0xd1, 0xee, 0xad, 0x73, 0x04, | |
| 250 | 0xb1, 0x04, 0xd3, 0xe8, 0x80, 0xe4, 0x0f, 0x3d, 0xf8, 0x0f, 0x72, 0xe8, | |
| 251 | 0x31, 0xc0, 0xab, 0x0e, 0x1f, 0xc4, 0x5e, 0x5a, 0xbe, 0x00, 0x20, 0xad, | |
| 252 | 0x09, 0xc0, 0x75, 0x05, 0x88, 0xd3, 0xff, 0x6e, 0x5a, 0x48, 0x48, 0x8b, | |
| 253 | 0x7e, 0x0d, 0x81, 0xe7, 0xff, 0x00, 0xf7, 0xe7, 0x03, 0x46, 0xda, 0x13, | |
| 254 | 0x56, 0xdc, 0xe8, 0x34, 0x00, 0xeb, 0xe0, 0x5e, 0xac, 0x56, 0xb4, 0x0e, | |
| 255 | 0xcd, 0x10, 0x3c, 0x2e, 0x75, 0xf5, 0xc3, 0xe8, 0xf1, 0xff, 0x45, 0x72, | |
| 256 | 0x72, 0x6f, 0x72, 0x21, 0x20, 0x48, 0x69, 0x74, 0x20, 0x61, 0x20, 0x6b, | |
| 257 | 0x65, 0x79, 0x20, 0x74, 0x6f, 0x20, 0x72, 0x65, 0x62, 0x6f, 0x6f, 0x74, | |
| 258 | 0x2e, 0x30, 0xe4, 0xcd, 0x13, 0xcd, 0x16, 0xcd, 0x19, 0x56, 0x89, 0x46, | |
| 259 | 0xc8, 0x89, 0x56, 0xca, 0x8c, 0x46, 0xc6, 0x89, 0x5e, 0xc4, 0xe8, 0xbe, | |
| 260 | 0xff, 0x2e, 0xb4, 0x41, 0xbb, 0xaa, 0x55, 0x8a, 0x56, 0x24, 0x84, 0xd2, | |
| 261 | 0x74, 0x19, 0xcd, 0x13, 0x72, 0x15, 0xd1, 0xe9, 0x81, 0xdb, 0x54, 0xaa, | |
| 262 | 0x75, 0x0d, 0x8d, 0x76, 0xc0, 0x89, 0x5e, 0xcc, 0x89, 0x5e, 0xce, 0xb4, | |
| 263 | 0x42, 0xeb, 0x26, 0x8b, 0x4e, 0xc8, 0x8b, 0x56, 0xca, 0x8a, 0x46, 0x18, | |
| 264 | 0xf6, 0x66, 0x1a, 0x91, 0xf7, 0xf1, 0x92, 0xf6, 0x76, 0x18, 0x89, 0xd1, | |
| 265 | 0x88, 0xc6, 0x86, 0xe9, 0xd0, 0xc9, 0xd0, 0xc9, 0x08, 0xe1, 0x41, 0xc4, | |
| 266 | 0x5e, 0xc4, 0xb8, 0x01, 0x02, 0x8a, 0x56, 0x24, 0xcd, 0x13, 0x0f, 0x82, | |
| 267 | 0x75, 0xff, 0x8b, 0x46, 0x0b, 0xf6, 0x76, 0xc0, 0x01, 0x46, 0xc6, 0x83, | |
| 268 | 0x46, 0xc8, 0x01, 0x83, 0x56, 0xca, 0x00, 0x4f, 0x75, 0x98, 0x8e, 0x46, | |
| 269 | 0xc6, 0x5e, 0xc3, 0x4d, 0x45, 0x54, 0x41, 0x4b, 0x45, 0x52, 0x4e, 0x53, | |
| 270 | 270 | 0x59, 0x53, 0x00, 0x00, 0x55, 0xaa |
| 271 | 271 | }; |
| 272 | 272 | |
| r1461 | r1462 | |
| 410 | 410 | fat_bits = 8; |
| 411 | 411 | has_extended_bios_param_block = FALSE; |
| 412 | 412 | } |
| 413 | ||
| 413 | ||
| 414 | 414 | info->fat_bits = fat_bits; |
| 415 | 415 | sector_size = pick_integer_le(header, 11, 2); |
| 416 | 416 | info->sectors_per_cluster = pick_integer_le(header, 13, 1); |
| r1461 | r1462 | |
| 704 | 704 | else if (last_entry != (UINT32) entry) |
| 705 | 705 | return 1; /* if the FATs disagree; mark this as reserved */ |
| 706 | 706 | } |
| 707 | ||
| 707 | ||
| 708 | 708 | /* normalize special clusters */ |
| 709 | 709 | if (last_entry >= (0xFFFFFFF0 & bit_mask)) |
| 710 | 710 | { |
| r1461 | r1462 | |
| 980 | 980 | delete_file = TRUE; |
| 981 | 981 | new_size = 0; |
| 982 | 982 | } |
| 983 | ||
| 983 | ||
| 984 | 984 | /* if this is the trivial case (not changing the size), succeed */ |
| 985 | 985 | if (!delete_file && (file->filesize == new_size)) |
| 986 | 986 | { |
| r1461 | r1462 | |
| 1041 | 1041 | err = IMGTOOLERR_NOSPACE; |
| 1042 | 1042 | goto done; |
| 1043 | 1043 | } |
| 1044 | ||
| 1044 | ||
| 1045 | 1045 | write_cluster = cluster; |
| 1046 | 1046 | } |
| 1047 | 1047 | else if (i >= new_cluster_count) |
| r1461 | r1462 | |
| 1438 | 1438 | memset(created_entry + 0, ' ', 11); |
| 1439 | 1439 | memset(created_entry + 12, '\0', FAT_DIRENT_SIZE - 12); |
| 1440 | 1440 | created_entry[11] = (create == CREATE_DIR) ? 0x10 : 0x00; |
| 1441 | ||
| 1441 | ||
| 1442 | 1442 | /* set up file dates in the new dirent */ |
| 1443 | 1443 | now = fat_setup_time(time(NULL)); |
| 1444 | 1444 | place_integer_le(created_entry, 14, 4, now); |
| r1461 | r1462 | |
| 1541 | 1541 | break; |
| 1542 | 1542 | } |
| 1543 | 1543 | |
| 1544 | memcpy(&created_entry[created_entry_pos], &buf[i], 2); | |
| 1544 | memcpy(&created_entry[created_entry_pos], &buf[i], 2); | |
| 1545 | 1545 | created_entry_pos += 2; |
| 1546 | 1546 | } |
| 1547 | 1547 | } |
| r1461 | r1462 | |
| 1599 | 1599 | UINT8 *sfn_entry; |
| 1600 | 1600 | int pos, digit_count, i; |
| 1601 | 1601 | UINT32 digit_place, val = 0; |
| 1602 | ||
| 1602 | ||
| 1603 | 1603 | sfn_entry = &entry[entry_len - FAT_DIRENT_SIZE]; |
| 1604 | 1604 | |
| 1605 | 1605 | digit_place = 1; |
| r1461 | r1462 | |
| 1759 | 1759 | err = fat_seek_file(partition, file, freeent.position); |
| 1760 | 1760 | if (err) |
| 1761 | 1761 | goto done; |
| 1762 | ||
| 1762 | ||
| 1763 | 1763 | err = fat_write_file(partition, file, created_entry, created_entry_len, NULL); |
| 1764 | 1764 | if (err) |
| 1765 | 1765 | goto done; |
| r1461 | r1462 | |
|---|---|---|
| 12 | 12 | #define SET_UWORD(a,v) a=v |
| 13 | 13 | #define SET_ULONG(a,v) a=v |
| 14 | 14 | #else |
| 15 | typedef struct { | |
| 15 | typedef struct { | |
| 16 | 16 | unsigned char low, high; |
| 17 | 17 | } littleuword; |
| 18 | typedef struct { | |
| 18 | typedef struct { | |
| 19 | 19 | unsigned char low, mid, high, highest; |
| 20 | 20 | } littleulong; |
| 21 | 21 | #define GET_UWORD(a) (a.low|(a.high<<8)) |
| r1461 | r1462 | |
| 65 | 65 | 16, 16 C64 file name |
| 66 | 66 | |
| 67 | 67 | */ |
| 68 | ||
| 68 | ||
| 69 | 69 | typedef struct{ |
| 70 | 70 | char dostext[0x20]; // dos text |
| 71 | 71 | littleuword version; // packed bcd |
| r1461 | r1462 | |
| 74 | 74 | littleuword reserved; |
| 75 | 75 | char description[24]; |
| 76 | 76 | } t64_header; |
| 77 | ||
| 77 | ||
| 78 | 78 | typedef struct { |
| 79 | 79 | unsigned char type; |
| 80 | 80 | unsigned char file_type; |
| r1461 | r1462 | |
| 194 | 194 | strncpy(name_with_null, HEADER(image)->description, 24); |
| 195 | 195 | sprintf(string,"%s\n%s\nversion:%.4x max entries:%d", |
| 196 | 196 | dostext_with_null, |
| 197 | name_with_null, | |
| 197 | name_with_null, | |
| 198 | 198 | GET_UWORD(HEADER(image)->version), |
| 199 | 199 | HEADER(image)->max_entries); |
| 200 | 200 | } |
| r1461 | r1462 | |
| 218 | 218 | { |
| 219 | 219 | t64_iterator *iter=(t64_iterator*)enumeration; |
| 220 | 220 | ent->corrupt=0; |
| 221 | ||
| 221 | ||
| 222 | 222 | for (;!(ent->eof=(iter->index>=GET_UWORD(HEADER(iter->image)->max_entries)));iter->index++ ){ |
| 223 | 223 | if (ENTRY(iter->image, iter->index)->type==0) continue; |
| 224 | 224 | memset(ent->fname,0,17); |
| r1461 | r1462 | |
| 318 | 318 | if (GET_ULONG(ENTRY(image,i)->offset)-pos>=size) continue; |
| 319 | 319 | size=GET_ULONG(ENTRY(image, i)->offset)-pos; |
| 320 | 320 | } |
| 321 | if ((size!=0)&&(image->size-pos-size!=0)) | |
| 321 | if ((size!=0)&&(image->size-pos-size!=0)) | |
| 322 | 322 | memmove(image->data+pos, image->data+pos+size, image->size-pos-size); |
| 323 | 323 | // correct offset positions in other entries |
| 324 | 324 | for (i=0;i<GET_UWORD(HEADER(image)->max_entries); i++) { |
| r1461 | r1462 | |
| 369 | 369 | if (GET_ULONG(ENTRY(image,i)->offset)-pos>=size) continue; |
| 370 | 370 | size=GET_ULONG(ENTRY(image, i)->offset)-pos; |
| 371 | 371 | } |
| 372 | if ((size!=0)&&(image->size-pos-size!=0)) | |
| 372 | if ((size!=0)&&(image->size-pos-size!=0)) | |
| 373 | 373 | memmove(image->data+pos, image->data+pos+size, image->size-pos-size); |
| 374 | 374 | // correct offset positions in other entries |
| 375 | 375 | for (i=0;i<GET_UWORD(HEADER(image)->max_entries); i++) { |
| r1461 | r1462 | |
| 403 | 403 | SET_UWORD(header.version, 0x0101); |
| 404 | 404 | SET_UWORD(header.max_entries, entries); |
| 405 | 405 | if (_options[T64_OPTION_LABEL].s) strcpy(header.description, _options[T64_OPTION_LABEL].s); |
| 406 | if (stream_write(f, &header, sizeof(t64_header)) != sizeof(t64_header)) | |
| 406 | if (stream_write(f, &header, sizeof(t64_header)) != sizeof(t64_header)) | |
| 407 | 407 | return IMGTOOLERR_WRITEERROR; |
| 408 | 408 | for (i=0; i<entries; i++) { |
| 409 | if (stream_write(f, &entry, sizeof(t64_entry)) != sizeof(t64_entry)) | |
| 409 | if (stream_write(f, &entry, sizeof(t64_entry)) != sizeof(t64_entry)) | |
| 410 | 410 | return IMGTOOLERR_WRITEERROR; |
| 411 | 411 | } |
| 412 | 412 |
| r1461 | r1462 | |
|---|---|---|
| 9 | 9 | /* |
| 10 | 10 | SVI module |
| 11 | 11 | |
| 12 | SVI style .cas for the svi-318 and svi-328. Converts them to .wav files. | |
| 12 | SVI style .cas for the svi-318 and svi-328. Converts them to .wav files. | |
| 13 | 13 | Uses the mess/formats/svi_cas.[ch] files, for the actual conversion. |
| 14 | 14 | */ |
| 15 | 15 |
| r1461 | r1462 | |
|---|---|---|
| 66 | 66 | size = stream_size (f); |
| 67 | 67 | if (size < 5) return IMGTOOLERR_MODULENOTFOUND; |
| 68 | 68 | if (4 != stream_read (f, header, 4) ) return IMGTOOLERR_READERROR; |
| 69 | ||
| 69 | ||
| 70 | 70 | if (memcmp (header, "PCK\010", 4) ) |
| 71 | 71 | return IMGTOOLERR_MODULENOTFOUND; |
| 72 | ||
| 72 | ||
| 73 | 73 | if (4 != stream_read (f, &size, 4) ) return IMGTOOLERR_READERROR; |
| 74 | 74 | size = LITTLE_ENDIANIZE_INT32 (size); |
| 75 | 75 | if (4 != stream_read (f, header, 4) ) return IMGTOOLERR_READERROR; |
| 76 | ||
| 76 | ||
| 77 | 77 | /* get name from XSA header, can't be longer than 8.3 really */ |
| 78 | 78 | /* but could be, it's zero-terminated */ |
| 79 | 79 | file_name = NULL; |
| r1461 | r1462 | |
| 166 | 166 | XSA_IMAGE *image=(XSA_IMAGE*)img; |
| 167 | 167 | |
| 168 | 168 | /* check file name */ |
| 169 | if (mame_stricmp (fname, image->file_name) ) | |
| 169 | if (mame_stricmp (fname, image->file_name) ) | |
| 170 | 170 | return IMGTOOLERR_MODULENOTFOUND; |
| 171 | 171 | |
| 172 | 172 | return xsa_extract (image->file_handle, destf); |
| r1461 | r1462 | |
|---|---|---|
| 313 | 313 | } |
| 314 | 314 | |
| 315 | 315 | /* |
| 316 | Open the disk catalog for enumeration | |
| 316 | Open the disk catalog for enumeration | |
| 317 | 317 | */ |
| 318 | 318 | static imgtoolerr_t concept_image_beginenum(imgtool_directory *enumeration, const char *path) |
| 319 | 319 | { |
| r1461 | r1462 | |
|---|---|---|
| 121 | 121 | } |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | ||
| 124 | ||
| 125 | 125 | done: |
| 126 | 126 | if (cache) |
| 127 | 127 | free(cache); |
| r1461 | r1462 | |
|---|---|---|
| 329 | 329 | assert(0); |
| 330 | 330 | break; |
| 331 | 331 | } |
| 332 | ||
| 332 | ||
| 333 | 333 | /* advance the file pointer */ |
| 334 | 334 | s->position += result; |
| 335 | 335 |
| r1461 | r1462 | |
|---|---|---|
| 7 | 7 | The MEA 8000 is a speech synthesis chip. |
| 8 | 8 | The French company TMPI (Techni-musique & parole informatique) provided |
| 9 | 9 | speech extensions for several 8-bit computers (Thomson, Amstrad, Oric). |
| 10 | It was quite popular in France because of its ability to spell 'u' | |
| 10 | It was quite popular in France because of its ability to spell 'u' | |
| 11 | 11 | (unlike the more widespread SPO 296 chip). |
| 12 | 12 | |
| 13 | 13 | The synthesis is based on a 4-formant model. |
| r1461 | r1462 | |
| 63 | 63 | |
| 64 | 64 | |
| 65 | 65 | |
| 66 | typedef struct | |
| 66 | typedef struct | |
| 67 | 67 | { |
| 68 | 68 | #ifdef FLOAT_MODE |
| 69 | 69 | double fm, last_fm; /* frequency, in Hz */ |
| r1461 | r1462 | |
| 78 | 78 | |
| 79 | 79 | |
| 80 | 80 | |
| 81 | static struct | |
| 81 | static struct | |
| 82 | 82 | { |
| 83 | 83 | |
| 84 | 84 | /* configuration parameters */ |
| r1461 | r1462 | |
| 111 | 111 | UINT8 noise; |
| 112 | 112 | |
| 113 | 113 | emu_timer *timer; |
| 114 | ||
| 114 | ||
| 115 | 115 | } mea8000; |
| 116 | 116 | |
| 117 | 117 | |
| r1461 | r1462 | |
| 143 | 143 | |
| 144 | 144 | /* frequency, in Hz */ |
| 145 | 145 | |
| 146 | static const int fm1_table[32] = | |
| 146 | static const int fm1_table[32] = | |
| 147 | 147 | { |
| 148 | 150, 162, 174, 188, 202, 217, 233, 250, | |
| 149 | 267, 286, 305, 325, 346, 368, 391, 415, | |
| 150 | 440, 466, 494, 523, 554, 587, 622, 659, | |
| 148 | 150, 162, 174, 188, 202, 217, 233, 250, | |
| 149 | 267, 286, 305, 325, 346, 368, 391, 415, | |
| 150 | 440, 466, 494, 523, 554, 587, 622, 659, | |
| 151 | 151 | 698, 740, 784, 830, 880, 932, 988, 1047 |
| 152 | 152 | }; |
| 153 | 153 | |
| 154 | static const int fm2_table[32] = | |
| 154 | static const int fm2_table[32] = | |
| 155 | 155 | { |
| 156 | 440, 466, 494, 523, 554, 587, 622, 659, | |
| 156 | 440, 466, 494, 523, 554, 587, 622, 659, | |
| 157 | 157 | 698, 740, 784, 830, 880, 932, 988, 1047, |
| 158 | 158 | 1100, 1179, 1254, 1337, 1428, 1528, 1639, 1761, |
| 159 | 159 | 1897, 2047, 2214, 2400, 2609, 2842, 3105, 3400 |
| 160 | 160 | }; |
| 161 | 161 | |
| 162 | static const int fm3_table[8] = | |
| 162 | static const int fm3_table[8] = | |
| 163 | 163 | { |
| 164 | 164 | 1179, 1337, 1528, 1761, 2047, 2400, 2842, 3400 |
| 165 | 165 | }; |
| r1461 | r1462 | |
| 174 | 174 | |
| 175 | 175 | |
| 176 | 176 | /* amplitude * 1000 */ |
| 177 | static const int ampl_table[16] = | |
| 177 | static const int ampl_table[16] = | |
| 178 | 178 | { |
| 179 | 179 | 0, 8, 11, 16, 22, 31, 44, 62, |
| 180 | 180 | 88, 125, 177, 250, 354, 500, 707, 1000 |
| r1461 | r1462 | |
| 183 | 183 | |
| 184 | 184 | |
| 185 | 185 | /* pitch increment, in Hz / 8 ms */ |
| 186 | static const int pi_table[32] = | |
| 186 | static const int pi_table[32] = | |
| 187 | 187 | { |
| 188 | 0, 1, 2, 3, 4, 5, 6, 7, | |
| 188 | 0, 1, 2, 3, 4, 5, 6, 7, | |
| 189 | 189 | 8, 9, 10, 11, 12, 13, 14, 15, |
| 190 | 0 /* noise */, -15, -14, -13, -12, -11, -10, -9, | |
| 190 | 0 /* noise */, -15, -14, -13, -12, -11, -10, -9, | |
| 191 | 191 | -8, -7, -6, -5, -4, -3, -2, -1 |
| 192 | 192 | }; |
| 193 | 193 | |
| r1461 | r1462 | |
| 199 | 199 | |
| 200 | 200 | static int mea8000_accept_byte( void ) |
| 201 | 201 | { |
| 202 | return | |
| 202 | return | |
| 203 | 203 | mea8000.state == MEA8000_STOPPED || |
| 204 | 204 | mea8000.state == MEA8000_WAIT_FIRST || |
| 205 | 205 | (mea8000.state == MEA8000_STARTED && mea8000.bufpos < 4); |
| r1461 | r1462 | |
| 212 | 212 | buffer contains a complete frame and the CPU nees to wait for the next |
| 213 | 213 | frame end to compose a new frame. |
| 214 | 214 | */ |
| 215 | if (mea8000.req_out_func) | |
| 215 | if (mea8000.req_out_func) | |
| 216 | 216 | mea8000.req_out_func(0, mea8000_accept_byte()); |
| 217 | 217 | } |
| 218 | 218 | |
| r1461 | r1462 | |
| 241 | 241 | static void mea8000_init_tables( void ) |
| 242 | 242 | { |
| 243 | 243 | int i; |
| 244 | for (i=0; i<TABLE_LEN; i++) | |
| 244 | for (i=0; i<TABLE_LEN; i++) | |
| 245 | 245 | { |
| 246 | 246 | double f = (double)i / F0; |
| 247 | 247 | cos_table[i] = 2. * cos(2.*M_PI*f) * QUANT; |
| r1461 | r1462 | |
| 319 | 319 | int in, out; |
| 320 | 320 | int ampl = mea8000_interp_i(mea8000.last_ampl, mea8000.ampl); |
| 321 | 321 | |
| 322 | if (mea8000.noise) | |
| 322 | if (mea8000.noise) | |
| 323 | 323 | in = mea8000_noise_gen(); |
| 324 | else | |
| 324 | else | |
| 325 | 325 | in = mea8000_freq_gen(); |
| 326 | 326 | in = (in * ampl) / 1024; |
| 327 | 327 | |
| r1461 | r1462 | |
| 329 | 329 | in = mea8000_filter_step(i, in); |
| 330 | 330 | out = in; |
| 331 | 331 | return out; |
| 332 | } | |
| 332 | } | |
| 333 | 333 | |
| 334 | 334 | |
| 335 | 335 | |
| r1461 | r1462 | |
| 378 | 378 | double in, out; |
| 379 | 379 | double ampl = mea8000_interp_f(mea8000.last_ampl, mea8000.ampl); |
| 380 | 380 | |
| 381 | if (mea8000.noise) | |
| 381 | if (mea8000.noise) | |
| 382 | 382 | in = mea8000_noise_gen(); |
| 383 | else | |
| 383 | else | |
| 384 | 384 | in = mea8000_freq_gen(); |
| 385 | 385 | in *= ampl / 1000.; |
| 386 | 386 | |
| 387 | for (i=0; i<4; i++) | |
| 387 | for (i=0; i<4; i++) | |
| 388 | 388 | { |
| 389 | 389 | in = mea8000_filter_step(i, in); |
| 390 | 390 | out += in; |
| 391 | 391 | } |
| 392 | 392 | return out; |
| 393 | } | |
| 393 | } | |
| 394 | 394 | |
| 395 | 395 | |
| 396 | 396 | |
| r1461 | r1462 | |
| 407 | 407 | { |
| 408 | 408 | int i; |
| 409 | 409 | mea8000.last_pitch = mea8000.pitch; |
| 410 | for (i=0; i<4; i++) | |
| 410 | for (i=0; i<4; i++) | |
| 411 | 411 | { |
| 412 | 412 | mea8000.f[i].last_bw = mea8000.f[i].bw; |
| 413 | 413 | mea8000.f[i].last_fm = mea8000.f[i].fm; |
| r1461 | r1462 | |
| 432 | 432 | mea8000.f[2].fm = fm3_table[ mea8000.buf[1] >> 5 ]; |
| 433 | 433 | mea8000.f[1].fm = fm2_table[ mea8000.buf[1] & 0x1f ]; |
| 434 | 434 | mea8000.f[0].fm = fm1_table[ mea8000.buf[2] >> 3 ]; |
| 435 | mea8000.ampl = ampl_table[ ((mea8000.buf[2] & 7) << 1) | | |
| 435 | mea8000.ampl = ampl_table[ ((mea8000.buf[2] & 7) << 1) | | |
| 436 | 436 | (mea8000.buf[3] >> 7) ]; |
| 437 | 437 | mea8000.framelog = fd + 6 /* 64 samples / ms */ + 3; |
| 438 | 438 | mea8000.framelength = 1 << mea8000.framelog; |
| 439 | 439 | mea8000.bufpos = 0; |
| 440 | 440 | #ifdef FLOAT_MODE |
| 441 | 441 | LOG(( "mea800_decode_frame: pitch=%i noise=%i fm1=%gHz bw1=%gHz fm2=%gHz bw2=%gHz fm3=%gHz bw3=%gHz fm4=%gHz bw4=%gHz ampl=%g fd=%ims\n", |
| 442 | mea8000.pitch, mea8000.noise, | |
| 442 | mea8000.pitch, mea8000.noise, | |
| 443 | 443 | mea8000.f[0].fm, mea8000.f[0].bw, mea8000.f[1].fm, mea8000.f[1].bw, |
| 444 | 444 | mea8000.f[2].fm, mea8000.f[2].bw, mea8000.f[3].fm, mea8000.f[3].bw, |
| 445 | 445 | mea8000.ampl/1000., 8 << fd )); |
| 446 | 446 | #else |
| 447 | 447 | LOG(( "mea800_decode_frame: pitch=%i noise=%i fm1=%iHz bw1=%iHz fm2=%iHz bw2=%iHz fm3=%iHz bw3=%iHz fm4=%iHz bw4=%iHz ampl=%g fd=%ims\n", |
| 448 | mea8000.pitch, mea8000.noise, | |
| 448 | mea8000.pitch, mea8000.noise, | |
| 449 | 449 | mea8000.f[0].fm, mea8000.f[0].bw, mea8000.f[1].fm, mea8000.f[1].bw, |
| 450 | 450 | mea8000.f[2].fm, mea8000.f[2].bw, mea8000.f[3].fm, mea8000.f[3].bw, |
| 451 | 451 | mea8000.ampl/1000., 8 << fd )); |
| r1461 | r1462 | |
| 478 | 478 | { |
| 479 | 479 | int pos = mea8000.framepos % SUPERSAMPLING; |
| 480 | 480 | |
| 481 | if (!pos) | |
| 481 | if (!pos) | |
| 482 | 482 | { |
| 483 | 483 | /* sample is really computed only every 8-th time */ |
| 484 | 484 | mea8000.lastsample = mea8000.sample; |
| 485 | 485 | mea8000.sample = mea8000_compute_sample(); |
| 486 | 486 | DAC_signed_data_16_w(mea8000.channel, mea8000.lastsample); |
| 487 | 487 | } |
| 488 | else | |
| 488 | else | |
| 489 | 489 | { |
| 490 | 490 | /* other samples are simply interpolated */ |
| 491 | int sample = | |
| 492 | mea8000.lastsample + | |
| 491 | int sample = | |
| 492 | mea8000.lastsample + | |
| 493 | 493 | ((pos*(mea8000.sample-mea8000.lastsample)) / SUPERSAMPLING); |
| 494 | 494 | DAC_signed_data_16_w(mea8000.channel, sample); |
| 495 | 495 | } |
| 496 | 496 | |
| 497 | 497 | mea8000.framepos++; |
| 498 | if (mea8000.framepos == mea8000.framelength) | |
| 498 | if (mea8000.framepos == mea8000.framelength) | |
| 499 | 499 | { |
| 500 | 500 | mea8000_shift_frame(); |
| 501 | 501 | /* end of frame */ |
| 502 | if (mea8000.bufpos == 4) | |
| 502 | if (mea8000.bufpos == 4) | |
| 503 | 503 | { |
| 504 | 504 | /* we have a successor */ |
| 505 | 505 | LOG(( "%f mea8000_timer_expire: new frame\n", attotime_to_double(timer_get_time()) )); |
| 506 | 506 | mea8000_decode_frame(); |
| 507 | 507 | mea8000_start_frame(); |
| 508 | 508 | } |
| 509 | else if (mea8000.cont) | |
| 509 | else if (mea8000.cont) | |
| 510 | 510 | { |
| 511 | 511 | /* repeat mode */ |
| 512 | 512 | LOG(( "%f mea8000_timer_expire: repeat frame\n", attotime_to_double(timer_get_time()) )); |
| 513 | 513 | mea8000_start_frame(); |
| 514 | 514 | } |
| 515 | 515 | /* slow stop */ |
| 516 | else if (mea8000.state == MEA8000_STARTED) | |
| 516 | else if (mea8000.state == MEA8000_STARTED) | |
| 517 | 517 | { |
| 518 | 518 | mea8000.ampl = 0; |
| 519 | 519 | LOG(( "%f mea8000_timer_expire: fade frame\n", attotime_to_double(timer_get_time()) )); |
| 520 | 520 | mea8000_start_frame(); |
| 521 | 521 | mea8000.state = MEA8000_SLOWING; |
| 522 | 522 | } |
| 523 | else if (mea8000.state == MEA8000_SLOWING) | |
| 523 | else if (mea8000.state == MEA8000_SLOWING) | |
| 524 | 524 | { |
| 525 | 525 | LOG(( "%f mea8000_timer_expire: stop frame\n", attotime_to_double(timer_get_time()) )); |
| 526 | 526 | mea8000_stop_frame(); |
| 527 | 527 | } |
| 528 | 528 | mea8000_update_req(); |
| 529 | 529 | } |
| 530 | else | |
| 530 | else | |
| 531 | 531 | { |
| 532 | 532 | /* continue frame */ |
| 533 | 533 | timer_reset( mea8000.timer, SAMPLING ); |
| r1461 | r1462 | |
| 542 | 542 | |
| 543 | 543 | READ8_HANDLER ( mea8000_r ) |
| 544 | 544 | { |
| 545 | switch ( offset ) | |
| 545 | switch ( offset ) | |
| 546 | 546 | { |
| 547 | 547 | |
| 548 | 548 | case 0: /* status register */ |
| r1461 | r1462 | |
| 561 | 561 | |
| 562 | 562 | WRITE8_HANDLER ( mea8000_w ) |
| 563 | 563 | { |
| 564 | switch ( offset ) | |
| 564 | switch ( offset ) | |
| 565 | 565 | { |
| 566 | 566 | |
| 567 | 567 | case 0: /* data register */ |
| 568 | if (mea8000.state == MEA8000_STOPPED) | |
| 568 | if (mea8000.state == MEA8000_STOPPED) | |
| 569 | 569 | { |
| 570 | 570 | /* got pitch byte before first frame */ |
| 571 | 571 | mea8000.pitch = 2 * data; |
| r1461 | r1462 | |
| 573 | 573 | mea8000.state = MEA8000_WAIT_FIRST; |
| 574 | 574 | mea8000.bufpos = 0; |
| 575 | 575 | } |
| 576 | else if (mea8000.bufpos == 4) | |
| 576 | else if (mea8000.bufpos == 4) | |
| 577 | 577 | { |
| 578 | 578 | /* overflow */ |
| 579 | 579 | LOG(( "$%04x %f: mea8000_w data overflow %02X\n", activecpu_get_previouspc(), attotime_to_double(timer_get_time()), data )); |
| 580 | 580 | } |
| 581 | else | |
| 581 | else | |
| 582 | 582 | { |
| 583 | 583 | /* enqueue frame byte */ |
| 584 | LOG(( "$%04x %f: mea8000_w data %02X in frame pos %i\n", activecpu_get_previouspc(), attotime_to_double(timer_get_time()), | |
| 584 | LOG(( "$%04x %f: mea8000_w data %02X in frame pos %i\n", activecpu_get_previouspc(), attotime_to_double(timer_get_time()), | |
| 585 | 585 | data, mea8000.bufpos )); |
| 586 | 586 | mea8000.buf[mea8000.bufpos] = data; |
| 587 | 587 | mea8000.bufpos++; |
| r1461 | r1462 | |
| 605 | 605 | { |
| 606 | 606 | int stop = (data >> 4) & 1; |
| 607 | 607 | |
| 608 | if (data & 8) | |
| 608 | if (data & 8) | |
| 609 | 609 | mea8000.cont = (data >> 2) & 1; |
| 610 | 610 | |
| 611 | if (data & 2) | |
| 611 | if (data & 2) | |
| 612 | 612 | mea8000.roe = data & 1; |
| 613 | 613 | |
| 614 | if (stop) | |
| 614 | if (stop) | |
| 615 | 615 | mea8000_stop_frame(); |
| 616 | 616 | |
| 617 | LOG(( "$%04x %f: mea8000_w command %02X stop=%i cont=%i roe=%i\n", | |
| 618 | activecpu_get_previouspc(), attotime_to_double(timer_get_time()), data, | |
| 619 | stop, mea8000.cont, mea8000.roe )); | |
| 617 | LOG(( "$%04x %f: mea8000_w command %02X stop=%i cont=%i roe=%i\n", | |
| 618 | activecpu_get_previouspc(), attotime_to_double(timer_get_time()), data, | |
| 619 | stop, mea8000.cont, mea8000.roe )); | |
| 620 | 620 | |
| 621 | 621 | mea8000_update_req(); |
| 622 | 622 | break; |
| r1461 | r1462 | |
| 643 | 643 | mea8000.roe = 0; |
| 644 | 644 | mea8000.state = MEA8000_STOPPED; |
| 645 | 645 | mea8000_update_req(); |
| 646 | for (i=0; i<4; i++) | |
| 646 | for (i=0; i<4; i++) | |
| 647 | 647 | { |
| 648 | 648 | mea8000.f[i].last_output = 0; |
| 649 | 649 | mea8000.f[i].output = 0; |
| r1461 | r1462 | |
| 676 | 676 | state_save_register_item( "mea8000", 0, mea8000.lastsample ); |
| 677 | 677 | state_save_register_item( "mea8000", 0, mea8000.sample ); |
| 678 | 678 | state_save_register_item( "mea8000", 0, mea8000.phi ); |
| 679 | for (i=0; i<4; i++) | |
| 679 | for (i=0; i<4; i++) | |
| 680 | 680 | { |
| 681 | 681 | state_save_register_item( "mea8000", i, mea8000.f[i].fm ); |
| 682 | 682 | state_save_register_item( "mea8000", i, mea8000.f[i].last_fm ); |
| r1461 | r1462 | |
|---|---|---|
| 48 | 48 | stream_sample_t *buffer = _buffer[0]; |
| 49 | 49 | |
| 50 | 50 | for (i = 0; i < length; i++, buffer++) |
| 51 | { | |
| 51 | { | |
| 52 | 52 | *buffer = 0; |
| 53 | 53 | if (vc4000_sound.reg[0] && vc4000_sound.pos <= vc4000_sound.size/2) |
| 54 | 54 | { |
| r1461 | r1462 | |
|---|---|---|
| 44 | 44 | int int_wanted; |
| 45 | 45 | |
| 46 | 46 | logerror("int latch: %02x enable: %02x input: %02x\n", (int) dave.int_latch, (int) dave.int_enable, (int) dave.int_input); |
| 47 | ||
| 47 | ||
| 48 | 48 | int_wanted = (((dave.int_enable<<1) & dave.int_latch)!=0); |
| 49 | 49 | |
| 50 | 50 | if (dave_iface->int_callback) |
| r1461 | r1462 | |
| 82 | 82 | dave.int_input |= (dave.fifty_hz_state & 0x01)<<0; |
| 83 | 83 | } |
| 84 | 84 | break; |
| 85 | ||
| 86 | 85 | |
| 86 | ||
| 87 | 87 | default: |
| 88 | 88 | break; |
| 89 | 89 | } |
| r1461 | r1462 | |
| 117 | 117 | |
| 118 | 118 | dave.fifty_hz_count = DAVE_FIFTY_HZ_COUNTER_RELOAD; |
| 119 | 119 | dave.fifty_hz_state^=0x0ffffffff; |
| 120 | ||
| 120 | ||
| 121 | 121 | if (dave.fifty_hz_state!=0) |
| 122 | 122 | { |
| 123 | 123 | dave.int_irq |= (1<<1); |
| r1461 | r1462 | |
| 130 | 130 | { |
| 131 | 131 | /* reload counter */ |
| 132 | 132 | dave.one_hz_count = DAVE_ONE_HZ_COUNTER_RELOAD; |
| 133 | ||
| 133 | ||
| 134 | 134 | /* change state */ |
| 135 | 135 | dave.int_input ^= (1<<2); |
| 136 | 136 | |
| r1461 | r1462 | |
| 168 | 168 | dave.fifty_hz_count = DAVE_FIFTY_HZ_COUNTER_RELOAD; |
| 169 | 169 | dave.one_hz_count = DAVE_ONE_HZ_COUNTER_RELOAD; |
| 170 | 170 | timer_pulse(ATTOTIME_IN_HZ(1000), NULL, 0, dave_1khz_callback); |
| 171 | ||
| 171 | ||
| 172 | 172 | for (i=0; i<3; i++) |
| 173 | 173 | { |
| 174 | 174 | dave.Period[i] = ((STEP * Machine->sample_rate)/125000); |
| r1461 | r1462 | |
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | static void dave_update_sound(void *param,stream_sample_t **inputs, stream_sample_t **_buffer,int length) |
| 181 | { | |
| 181 | { | |
| 182 | 182 | stream_sample_t *buffer1, *buffer2; |
| 183 | 183 | /* 0 = channel 0 left volume, 1 = channel 0 right volume, |
| 184 | 184 | 2 = channel 1 left volume, 3 = channel 1 right volume, |
| 185 | 4 = channel 2 left volume, 5 = channel 2 right volume | |
| 185 | 4 = channel 2 left volume, 5 = channel 2 right volume | |
| 186 | 186 | 6 = noise channel left volume, 7 = noise channel right volume */ |
| 187 | 187 | int output_volumes[8]; |
| 188 | 188 | int left_volume; |
| r1461 | r1462 | |
| 295 | 295 | case 5: |
| 296 | 296 | { |
| 297 | 297 | int count = 0; |
| 298 | int channel_index = offset>>1; | |
| 298 | int channel_index = offset>>1; | |
| 299 | 299 | |
| 300 | 300 | /* Fout = 125,000 / (n+1) hz */ |
| 301 | 301 | |
| 302 | 302 | /* sample rate/clock */ |
| 303 | ||
| 304 | 303 | |
| 304 | ||
| 305 | 305 | /* get down-count */ |
| 306 | 306 | switch (offset & 0x01) |
| 307 | 307 | { |
| r1461 | r1462 | |
| 318 | 318 | } |
| 319 | 319 | break; |
| 320 | 320 | } |
| 321 | ||
| 321 | ||
| 322 | 322 | count++; |
| 323 | 323 | |
| 324 | ||
| 324 | ||
| 325 | 325 | dave.Period[channel_index] = ((STEP * Machine->sample_rate)/125000) * count; |
| 326 | 326 | |
| 327 | 327 | } |
| r1461 | r1462 | |
| 356 | 356 | /* force => the value of this register is forced regardless of the wave |
| 357 | 357 | state, |
| 358 | 358 | remove => this value is force to zero so that it has no influence over |
| 359 | the final volume calculation, regardless of wave state | |
| 359 | the final volume calculation, regardless of wave state | |
| 360 | 360 | use => the volume value is dependant on the wave state and is included |
| 361 | 361 | in the final volume calculation */ |
| 362 | 362 | |
| r1461 | r1462 | |
| 368 | 368 | logerror("1khz\n"); |
| 369 | 369 | } |
| 370 | 370 | break; |
| 371 | ||
| 371 | ||
| 372 | 372 | case 1: |
| 373 | 373 | { |
| 374 | 374 | logerror("50hz\n"); |
| r1461 | r1462 | |
| 396 | 396 | /* force r8 value */ |
| 397 | 397 | dave.level_or[0] = 0x0ffff; |
| 398 | 398 | dave.level_and[0] = 0x00; |
| 399 | ||
| 399 | ||
| 400 | 400 | /* remove r9 value */ |
| 401 | 401 | dave.level_or[2] = 0x000; |
| 402 | 402 | dave.level_and[2] = 0x00; |
| r1461 | r1462 | |
| 414 | 414 | /* use r8 value */ |
| 415 | 415 | dave.level_or[0] = 0x000; |
| 416 | 416 | dave.level_and[0] = 0xffff; |
| 417 | ||
| 417 | ||
| 418 | 418 | /* use r9 value */ |
| 419 | 419 | dave.level_or[2] = 0x000; |
| 420 | 420 | dave.level_and[2] = 0xffff; |
| r1461 | r1462 | |
| 434 | 434 | /* force r12 value */ |
| 435 | 435 | dave.level_or[1] = 0x0ffff; |
| 436 | 436 | dave.level_and[1] = 0x00; |
| 437 | ||
| 437 | ||
| 438 | 438 | /* remove r13 value */ |
| 439 | 439 | dave.level_or[3] = 0x000; |
| 440 | 440 | dave.level_and[3] = 0x00; |
| r1461 | r1462 | |
| 452 | 452 | /* use r12 value */ |
| 453 | 453 | dave.level_or[1] = 0x000; |
| 454 | 454 | dave.level_and[1] = 0xffff; |
| 455 | ||
| 455 | ||
| 456 | 456 | /* use r13 value */ |
| 457 | 457 | dave.level_or[3] = 0x000; |
| 458 | 458 | dave.level_and[3] = 0xffff; |
| r1461 | r1462 | |
| 568 | 568 | |
| 569 | 569 | case 0x014: |
| 570 | 570 | return (dave.int_latch & 0x0aa) | (dave.int_input & 0x055); |
| 571 | ||
| 572 | 571 | |
| 572 | ||
| 573 | 573 | default: |
| 574 | 574 | break; |
| 575 | 575 | } |
| r1461 | r1462 | |
| 611 | 611 | |
| 612 | 612 | } |
| 613 | 613 | break; |
| 614 | ||
| 614 | ||
| 615 | 615 | case DAVE_INT2_ID: |
| 616 | 616 | { |
| 617 | 617 | int previous_state; |
| r1461 | r1462 | |
|---|---|---|
| 21 | 21 | |
| 22 | 22 | 0x20 input 8 bit direct |
| 23 | 23 | 0x24 input 8 bit with dma |
| 24 | ||
| 24 | ||
| 25 | 25 | 0xd1 speaker on |
| 26 | 26 | 0xd3 speaker off |
| 27 | 27 | 0xd8 read speaker |
| 28 | ||
| 28 | ||
| 29 | 29 | 0x40 samplerate adjust |
| 30 | 30 | |
| 31 | 31 | 0x48 blockgroesse einstellen |
| r1461 | r1462 | |
| 141 | 141 | } |
| 142 | 142 | return 0; |
| 143 | 143 | } |
| 144 | ||
| 144 | ||
| 145 | 145 | WRITE8_HANDLER( soundblaster_w ) |
| 146 | 146 | { |
| 147 | 147 | switch (offset) { |
| 148 | case 6: | |
| 148 | case 6: | |
| 149 | 149 | if (data!=0) { //reset |
| 150 | 150 | } else { // reset off |
| 151 | 151 | } |
| r1461 | r1462 | |
|---|---|---|
| 11 | 11 | |
| 12 | 12 | sound_stream *odyssey2_sh_channel; |
| 13 | 13 | |
| 14 | const struct CustomSound_interface odyssey2_sound_interface = | |
| 14 | const struct CustomSound_interface odyssey2_sound_interface = | |
| 15 | 15 | { |
| 16 | 16 | odyssey2_sh_start |
| 17 | 17 | }; |
| r1461 | r1462 | |
|---|---|---|
| 68 | 68 | the volume will be forced on,else it is dependant on |
| 69 | 69 | the state of the wave */ |
| 70 | 70 | int level_or[8]; |
| 71 | /* if one of the values is 0x00, this means the | |
| 71 | /* if one of the values is 0x00, this means the | |
| 72 | 72 | volume is forced off, else it is dependant on the wave */ |
| 73 | 73 | int level_and[8]; |
| 74 | 74 | |
| 75 | 75 | /* these are the current channel volumes in MAME form */ |
| 76 | 76 | int mame_volumes[8]; |
| 77 | ||
| 77 | ||
| 78 | 78 | /* update step */ |
| 79 | 79 | int UpdateStep; |
| 80 | 80 |
| r1461 | r1462 | |
|---|---|---|
| 52 | 52 | stream_sample_t *buffer = _buffer[0]; |
| 53 | 53 | |
| 54 | 54 | for (i = 0; i < length; i++, buffer++) |
| 55 | { | |
| 55 | { | |
| 56 | 56 | *buffer = 0; |
| 57 | 57 | if (arcadia_sound.reg[1] && arcadia_sound.pos <= arcadia_sound.size/2) |
| 58 | 58 | { |
| r1461 | r1462 | |
|---|---|---|
| 42 | 42 | AUD_INTEGRATE EQU %00100000 |
| 43 | 43 | AUD_RELOAD EQU %00010000 |
| 44 | 44 | AUD_CNTEN EQU %00001000 |
| 45 | AUD_LINK EQU %00000111 | |
| 45 | AUD_LINK EQU %00000111 | |
| 46 | 46 | ; link timers (0->2->4 / 1->3->5->7->Aud0->Aud1->Aud2->Aud3->1 |
| 47 | 47 | AUD_64us EQU %00000110 |
| 48 | 48 | AUD_32us EQU %00000101 |
| r1461 | r1462 | |
| 110 | 110 | int ticks; |
| 111 | 111 | int count; |
| 112 | 112 | } LYNX_AUDIO; |
| 113 | static LYNX_AUDIO lynx_audio[4]= { | |
| 113 | static LYNX_AUDIO lynx_audio[4]= { | |
| 114 | 114 | { 0 }, |
| 115 | 115 | { 1 }, |
| 116 | 116 | { 2 }, |
| 117 | { 3 } | |
| 117 | { 3 } | |
| 118 | 118 | }; |
| 119 | 119 | |
| 120 | 120 | static void lynx_audio_reset_channel(LYNX_AUDIO *This) |
| r1461 | r1462 | |
| 134 | 134 | { |
| 135 | 135 | channel->shifter=((channel->shifter<<1)&0x3ff) |
| 136 | 136 | |shift_xor[channel->shifter&channel->mask]; |
| 137 | ||
| 137 | ||
| 138 | 138 | if (channel->reg.n.control1&0x20) { |
| 139 | 139 | if (channel->shifter&1) { |
| 140 | 140 | channel->reg.n.output+=channel->reg.n.volume; |
| r1461 | r1462 | |
| 189 | 189 | stream_update(mixer_channel); |
| 190 | 190 | switch (offset) { |
| 191 | 191 | case 0x20: case 0x21: case 0x22: case 0x24: case 0x25: |
| 192 | case 0x28: case 0x29: case 0x2a: case 0x2c: case 0x2d: | |
| 193 | case 0x30: case 0x31: case 0x32: case 0x34: case 0x35: | |
| 194 | case 0x38: case 0x39: case 0x3a: case 0x3c: case 0x3d: | |
| 192 | case 0x28: case 0x29: case 0x2a: case 0x2c: case 0x2d: | |
| 193 | case 0x30: case 0x31: case 0x32: case 0x34: case 0x35: | |
| 194 | case 0x38: case 0x39: case 0x3a: case 0x3c: case 0x3d: | |
| 195 | 195 | data=lynx_audio[(offset>>3)&3].reg.data[offset&7]; |
| 196 | 196 | break; |
| 197 | case 0x23: case 0x2b: case 0x33: case 0x3b: | |
| 197 | case 0x23: case 0x2b: case 0x33: case 0x3b: | |
| 198 | 198 | data=lynx_audio[(offset>>3)&3].shifter&0xff; |
| 199 | 199 | break; |
| 200 | 200 | case 0x26:case 0x2e:case 0x36:case 0x3e: |
| r1461 | r1462 | |
| 204 | 204 | data=(lynx_audio[(offset>>3)&3].shifter>>4)&0xf0; |
| 205 | 205 | data|=lynx_audio[(offset>>3)&3].reg.data[offset&7]&0x0f; |
| 206 | 206 | break; |
| 207 | case 0x40: case 0x41: case 0x42: case 0x43: | |
| 207 | case 0x40: case 0x41: case 0x42: case 0x43: | |
| 208 | 208 | data=lynx_audio[offset&3].attenuation; |
| 209 | 209 | break; |
| 210 | case 0x44: | |
| 210 | case 0x44: | |
| 211 | 211 | data=attenuation_enable; |
| 212 | 212 | break; |
| 213 | 213 | case 0x50: |
| r1461 | r1462 | |
| 229 | 229 | case 0x38: case 0x3a: case 0x3c: case 0x3e: |
| 230 | 230 | lynx_audio[(offset>>3)&3].reg.data[offset&7]=data; |
| 231 | 231 | break; |
| 232 | case 0x23: case 0x2b: case 0x33: case 0x3b: | |
| 232 | case 0x23: case 0x2b: case 0x33: case 0x3b: | |
| 233 | 233 | lynx_audio[(offset>>3)&3].reg.data[offset&7]=data; |
| 234 | 234 | lynx_audio[(offset>>3)&3].shifter&=~0xff; |
| 235 | 235 | lynx_audio[(offset>>3)&3].shifter|=data; |
| r1461 | r1462 | |
| 250 | 250 | case 0x40: case 0x41: case 0x42: case 0x43: // lynx2 only, howard extension board |
| 251 | 251 | lynx_audio[offset&3].attenuation=data; |
| 252 | 252 | break; |
| 253 | case 0x44: | |
| 253 | case 0x44: | |
| 254 | 254 | attenuation_enable=data; //lynx2 only, howard extension board |
| 255 | 255 | break; |
| 256 | 256 | case 0x50: |
| r1461 | r1462 | |
| 297 | 297 | lynx_audio_execute(channel); |
| 298 | 298 | v=channel->reg.n.output; |
| 299 | 299 | if (!(master_enable&(0x10<<j))) |
| 300 | { | |
| 300 | { | |
| 301 | 301 | if (attenuation_enable&(0x10<<j)) { |
| 302 | 302 | *left+=v*(channel->attenuation>>4); |
| 303 | 303 | } else { |
| r1461 | r1462 | |
| 382 | 382 | mixer_channel = stream_create(0, 2, Machine->sample_rate, 0, lynx2_update); |
| 383 | 383 | |
| 384 | 384 | usec_per_sample = 1000000 / Machine->sample_rate; |
| 385 | ||
| 385 | ||
| 386 | 386 | lynx_audio_init(); |
| 387 | 387 | return (void *) ~0; |
| 388 | 388 | } |
| r1461 | r1462 | |
|---|---|---|
| 42 | 42 | case 4: |
| 43 | 43 | svision_dma.on = data & 0x80; |
| 44 | 44 | if (svision_dma.on) |
| 45 | { | |
| 46 | svision_dma.pos = 0.0; | |
| 45 | { | |
| 46 | svision_dma.pos = 0.0; | |
| 47 | 47 | } |
| 48 | 48 | break; |
| 49 | 49 | } |
| r1461 | r1462 | |
|---|---|---|
| 45 | 45 | char *dir; |
| 46 | 46 | char *hash; |
| 47 | 47 | char *basename_noext; |
| 48 | ||
| 48 | ||
| 49 | 49 | /* flags */ |
| 50 | 50 | unsigned int writeable : 1; |
| 51 | 51 | unsigned int created : 1; |
| r1461 | r1462 | |
| 841 | 841 | |
| 842 | 842 | /**************************************************************************** |
| 843 | 843 | Tag management functions. |
| 844 | ||
| 844 | ||
| 845 | 845 | When devices have private data structures that need to be associated with a |
| 846 | 846 | device, it is recommended that image_alloctag() be called in the device |
| 847 | 847 | init function. If the allocation succeeds, then a pointer will be returned |
| r1461 | r1462 | |
| 1154 | 1154 | { |
| 1155 | 1155 | const char *hash_string; |
| 1156 | 1156 | UINT32 crc = 0; |
| 1157 | ||
| 1157 | ||
| 1158 | 1158 | hash_string = image_hash(img); |
| 1159 | 1159 | if (hash_string) |
| 1160 | 1160 | crc = hash_data_extract_crc32(hash_string); |
| r1461 | r1462 | |
| 1355 | 1355 | /* first set up the working directory to be the MESS directory */ |
| 1356 | 1356 | osd_get_emulator_directory(mess_directory, ARRAY_LENGTH(mess_directory)); |
| 1357 | 1357 | image->working_directory = mame_strdup(mess_directory); |
| 1358 | ||
| 1358 | ||
| 1359 | 1359 | /* now try browsing down to "software" */ |
| 1360 | 1360 | if (try_change_working_directory(image, "software")) |
| 1361 | 1361 | { |
| r1461 | r1462 | |
|---|---|---|
| 83 | 83 | int i, count; |
| 84 | 84 | UINT32 ram; |
| 85 | 85 | UINT32 default_ram; |
| 86 | ||
| 86 | ||
| 87 | 87 | count = ram_option_count(game); |
| 88 | 88 | default_ram = ram_default(game); |
| 89 | 89 |
| r1461 | r1462 | |
|---|---|---|
| 5 | 5 | |
| 6 | 6 | Per Ola Ingvarsson |
| 7 | 7 | Tomas Karlsson |
| 8 | ||
| 8 | ||
| 9 | 9 | ******************************************************************************/ |
| 10 | 10 | |
| 11 | 11 | /*----------- defined in machine/compis.c -----------*/ |
| r1461 | r1462 | |
|---|---|---|
| 56 | 56 | READ8_HANDLER(kc85_ctc_r); |
| 57 | 57 | WRITE8_HANDLER(kc85_ctc_w); |
| 58 | 58 | |
| 59 | /* this is a fake keyboard layout. | |
| 59 | /* this is a fake keyboard layout. | |
| 60 | 60 | The keys are converted into codes which are transmitted by the keyboard to the base-unit */ |
| 61 | 61 | /* key code can be calculated as (line*8)+bit_index */ |
| 62 | 62 |
| r1461 | r1462 | |
|---|---|---|
| 42 | 42 | |
| 43 | 43 | /***** Video Modes *****/ |
| 44 | 44 | |
| 45 | typedef enum | |
| 45 | typedef enum | |
| 46 | 46 | { |
| 47 | 47 | TEXT_40x25, /* Text mode 40x25 */ |
| 48 | 48 | TEXT_80x25, /* Text mode 80x25 */ |
| r1461 | r1462 | |
| 50 | 50 | GRAPH_320x256x16, /* Graphics 320x256x16 */ |
| 51 | 51 | GRAPH_640x512x2 /* Graphics 640X512X2 */ |
| 52 | 52 | } BETA_VID_MODES; |
| 53 | ||
| 53 | ||
| 54 | 54 | /*----------- defined in machine/dgn_beta.c -----------*/ |
| 55 | 55 | |
| 56 | 56 | MACHINE_START( dgnbeta ); |
| r1461 | r1462 | |
|---|---|---|
| 50 | 50 | |
| 51 | 51 | /*----------- defined in machine/hp48.c -----------*/ |
| 52 | 52 | |
| 53 | typedef struct { | |
| 54 | int data[0x40]; | |
| 53 | typedef struct { | |
| 54 | int data[0x40]; | |
| 55 | 55 | UINT16 crc; |
| 56 | 56 | UINT32 timer2; |
| 57 | 57 | } HP48_HARDWARE; |
| r1461 | r1462 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | 3 | mac.h |
| 4 | ||
| 4 | ||
| 5 | 5 | MESS Macintosh driver declarations |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| r1461 | r1462 | |
|---|---|---|
| 7 | 7 | |
| 8 | 8 | to set an input to a specified state. |
| 9 | 9 | |
| 10 | The outputs can also be wired in any order to a I/O port, so | |
| 11 | a callback is executed with the updated output state. | |
| 10 | The outputs can also be wired in any order to a I/O port, so | |
| 11 | a callback is executed with the updated output state. | |
| 12 | 12 | Use |
| 13 | 13 | |
| 14 | 14 | hd6402_set_callback |
| r1461 | r1462 | |
|---|---|---|
| 14 | 14 | } msx_slot_layout; |
| 15 | 15 | |
| 16 | 16 | #define MSX_LAYOUT_INIT(msx) \ |
| 17 | static const msx_slot_layout msx_slot_layout_##msx[] = { | |
| 17 | static const msx_slot_layout msx_slot_layout_##msx[] = { | |
| 18 | 18 | |
| 19 | 19 | #define MSX_LAYOUT_SLOT(prim, sec, page, extend, type, size, option) \ |
| 20 | 20 | { \ |
| r1461 | r1462 | |
|---|---|---|
| 51 | 51 | /* mode special register */ |
| 52 | 52 | unsigned long Mode; |
| 53 | 53 | |
| 54 | ||
| 54 | ||
| 55 | 55 | /* drive outputs */ |
| 56 | 56 | int drive; |
| 57 | 57 | int side; |
| r1461 | r1462 | |
| 81 | 81 | |
| 82 | 82 | /* sector counter and id counter */ |
| 83 | 83 | int Counter; |
| 84 | ||
| 84 | ||
| 85 | 85 | /* ==0, to cpu, !=0 =from cpu */ |
| 86 | 86 | int data_direction; |
| 87 | 87 | i8271_interface fdc_interface; |
| r1461 | r1462 | |
|---|---|---|
| 35 | 35 | int sta; |
| 36 | 36 | int ack; |
| 37 | 37 | int mem[4]; |
| 38 | ||
| 38 | ||
| 39 | 39 | /* rtc acknowledge */ |
| 40 | 40 | /* bit 2 = min */ |
| 41 | 41 | /* bit 1 = sec */ |
| r1461 | r1462 | |
|---|---|---|
| 4 | 4 | #define PCW16_DISPLAY_WIDTH 640 |
| 5 | 5 | #define PCW16_DISPLAY_HEIGHT 480 |
| 6 | 6 | |
| 7 | #define PCW16_SCREEN_WIDTH (PCW16_DISPLAY_WIDTH + (PCW16_BORDER_WIDTH<<1)) | |
| 7 | #define PCW16_SCREEN_WIDTH (PCW16_DISPLAY_WIDTH + (PCW16_BORDER_WIDTH<<1)) | |
| 8 | 8 | #define PCW16_SCREEN_HEIGHT (PCW16_DISPLAY_HEIGHT + (PCW16_BORDER_HEIGHT<<1)) |
| 9 | 9 | |
| 10 | 10 | /*----------- defined in video/pcw16.c -----------*/ |
| r1461 | r1462 | |
|---|---|---|
| 3 | 3 | |
| 4 | 4 | /* internal serial transmission */ |
| 5 | 5 | |
| 6 | /* | |
| 6 | /* | |
| 7 | 7 | |
| 8 | 8 | This code is used to transmit a file stored on the host filesystem |
| 9 | 9 | (e.g. PC harddrive) to an emulated system. |
| 10 | ||
| 10 | ||
| 11 | 11 | The file is converted into a serial bit-stream which can be received |
| 12 | 12 | by the emulated serial chip in the emulated system. |
| 13 | 13 | |
| 14 | 14 | The file can be transmitted using different protocols |
| 15 | 15 | */ |
| 16 | 16 | |
| 17 | /* | |
| 18 | A and B are two computers linked with a serial connection | |
| 19 | ||
| 17 | /* | |
| 18 | A and B are two computers linked with a serial connection | |
| 19 | ||
| 20 | 20 | A and B can transmit and receive data, through the same connection |
| 21 | 21 | */ |
| 22 | 22 | |
| 23 | /* | |
| 23 | /* | |
| 24 | 24 | these flags apply to A and B, and give the state of the input & output |
| 25 | 25 | signals at each side. |
| 26 | 26 | */ |
| 27 | 27 | |
| 28 | 28 | |
| 29 | /* | |
| 29 | /* | |
| 30 | 30 | CTS = Clear to Send. (INPUT) |
| 31 | 31 | Other end of connection is ready to accept data |
| 32 | ||
| 33 | ||
| 34 | NOTE: | |
| 35 | ||
| 36 | This output is active low on serial chips (e.g. 0 is CTS is set), | |
| 32 | ||
| 33 | ||
| 34 | NOTE: | |
| 35 | ||
| 36 | This output is active low on serial chips (e.g. 0 is CTS is set), | |
| 37 | 37 | but here it is active high! |
| 38 | 38 | */ |
| 39 | ||
| 39 | ||
| 40 | 40 | #define SERIAL_STATE_CTS 0x0001 |
| 41 | /* | |
| 41 | /* | |
| 42 | 42 | RTS = Request to Send. (OUTPUT) |
| 43 | 43 | This end is ready to send data, and requests if the other |
| 44 | 44 | end is ready to accept it |
| 45 | 45 | |
| 46 | NOTE: | |
| 47 | ||
| 48 | This output is active low on serial chips (e.g. 0 is RTS is set), | |
| 46 | NOTE: | |
| 47 | ||
| 48 | This output is active low on serial chips (e.g. 0 is RTS is set), | |
| 49 | 49 | but here it is active high! |
| 50 | 50 | */ |
| 51 | 51 | #define SERIAL_STATE_RTS 0x0002 |
| 52 | 52 | |
| 53 | /* | |
| 53 | /* | |
| 54 | 54 | DSR = Data Set ready. (INPUT) |
| 55 | Other end of connection has data | |
| 55 | Other end of connection has data | |
| 56 | 56 | |
| 57 | 57 | |
| 58 | NOTE: | |
| 59 | ||
| 60 | This output is active low on serial chips (e.g. 0 is DSR is set), | |
| 58 | NOTE: | |
| 59 | ||
| 60 | This output is active low on serial chips (e.g. 0 is DSR is set), | |
| 61 | 61 | but here it is active high! |
| 62 | 62 | */ |
| 63 | 63 | #define SERIAL_STATE_DSR 0x0004 |
| 64 | 64 | |
| 65 | /* | |
| 65 | /* | |
| 66 | 66 | DTR = Data terminal Ready. (OUTPUT) |
| 67 | 67 | TX contains new data. |
| 68 | 68 | |
| 69 | NOTE: | |
| 70 | ||
| 71 | This output is active low on serial chips (e.g. 0 is DTR is set), | |
| 69 | NOTE: | |
| 70 | ||
| 71 | This output is active low on serial chips (e.g. 0 is DTR is set), | |
| 72 | 72 | but here it is active high! |
| 73 | 73 | */ |
| 74 | 74 | #define SERIAL_STATE_DTR 0x0008 |
| 75 | /* RX = Recieve data. (INPUT) */ | |
| 75 | /* RX = Recieve data. (INPUT) */ | |
| 76 | 76 | #define SERIAL_STATE_RX_DATA 0x00010 |
| 77 | 77 | /* TX = Transmit data. (OUTPUT) */ |
| 78 | 78 | #define SERIAL_STATE_TX_DATA 0x00020 |
| r1461 | r1462 | |
| 83 | 83 | and stop bits. These are programmable. */ |
| 84 | 84 | enum |
| 85 | 85 | { |
| 86 | SERIAL_PROTOCOL_NONE, /* no protocol applied */ | |
| 86 | SERIAL_PROTOCOL_NONE, /* no protocol applied */ | |
| 87 | 87 | SERIAL_PROTOCOL_XMODEM /* transfer data using xmodem protocol */ |
| 88 | 88 | }; |
| 89 | 89 | |
| r1461 | r1462 | |
| 122 | 122 | |
| 123 | 123 | /* state of other side - store here */ |
| 124 | 124 | unsigned long input_state; |
| 125 | ||
| 125 | ||
| 126 | 126 | /* this callback is executed when this side has refreshed it's state, |
| 127 | 127 | to let the other end know */ |
| 128 | 128 | void (*out_callback)(int id, unsigned long state); |
| r1461 | r1462 | |
| 167 | 167 | /*******************************************************************************/ |
| 168 | 168 | /**** RECEIVE AND TRANSMIT GENERIC CODE ****/ |
| 169 | 169 | |
| 170 | /* this can be used by most of the serial chip implementations, | |
| 170 | /* this can be used by most of the serial chip implementations, | |
| 171 | 171 | because they all work in roughly the same way. |
| 172 | 172 | There is generic code to send and receive data in the specified form */ |
| 173 | 173 |
| r1461 | r1462 | |
|---|---|---|
| 10 | 10 | |
| 11 | 11 | /*----------- defined in machine/pclpt.c -----------*/ |
| 12 | 12 | |
| 13 | typedef enum { | |
| 13 | typedef enum { | |
| 14 | 14 | LPT_UNIDIRECTIONAL |
| 15 | 15 | // , LPT_BIDIRECTIONAL |
| 16 | 16 | // epp, ecp |
| r1461 | r1462 | |
|---|---|---|
| 1 | 1 | /****************************************************************************** |
| 2 | 2 | Synertek Systems Corp. SYM-1 |
| 3 | ||
| 3 | ||
| 4 | 4 | Early driver by PeT mess@utanet.at May 2000 |
| 5 | 5 | Rewritten by Dirk Best October 2007 |
| 6 | ||
| 6 | ||
| 7 | 7 | ******************************************************************************/ |
| 8 | 8 | |
| 9 | 9 |
| r1461 | r1462 | |
|---|---|---|
| 88 | 88 | |
| 89 | 89 | int mscrtc6845_get_personality(struct mscrtc6845 *crtc); |
| 90 | 90 | |
| 91 | /* cursor off, cursor on, cursor 16 frames on/off, cursor 32 frames on/off | |
| 91 | /* cursor off, cursor on, cursor 16 frames on/off, cursor 32 frames on/off | |
| 92 | 92 | start line, end line */ |
| 93 | 93 | void mscrtc6845_get_cursor(struct mscrtc6845 *crtc, struct mscrtc6845_cursor *cursor); |
| 94 | 94 | |
| r1461 | r1462 | |
| 100 | 100 | |
| 101 | 101 | /* to be called when reading from port */ |
| 102 | 102 | READ8_HANDLER ( mscrtc6845_0_port_r ); |
| 103 | ||
| 103 | ||
| 104 | 104 | /*************************************************************************** |
| 105 | 105 | |
| 106 | 106 | 6845 variant macros |
| r1461 | r1462 | |
|---|---|---|
| 19 | 19 | |
| 20 | 20 | ESC, [SPACE], F1,F2,F3,F4,[SPACE],F5,F6,F7,F8,[SPACE],F9,F0,F11,F12 |
| 21 | 21 | [SPACE] |
| 22 | \|, 1,2,3,4,5,6,7,8,9,0 -,+, BACKSPACE,[SPACE], NUM LOCK, SCROLL LOCK, PRINT SCREEN, KEYPAD - | |
| 23 | TAB,Q,W,E,R,T,Y,U,I,O,P,[,], RETURN, [SPACE], KEYPAD 7, KEYPAD 8, KEYPAD 9, KEYPAD + | |
| 22 | \|, 1,2,3,4,5,6,7,8,9,0 -,+, BACKSPACE,[SPACE], NUM LOCK, SCROLL LOCK, PRINT SCREEN, KEYPAD - | |
| 23 | TAB,Q,W,E,R,T,Y,U,I,O,P,[,], RETURN, [SPACE], KEYPAD 7, KEYPAD 8, KEYPAD 9, KEYPAD + | |
| 24 | 24 | CTRL, A,S,D,F,G,H,J,K,L,;,@,~, RETURN, [SPACE],KEYPAD 4,KEYPAD 5,KEYPAD 6, KEYPAD + |
| 25 | 25 | LEFT SHIFT, Z,X,C,V,B,N,M,<,>,?,RIGHT SHIFT,[SPACE],KEYPAD 1, KEYPAD 2, KEYPAD 3, KEYPAD ENTER |
| 26 | 26 | ALT,[SPACE], SPACE BAR,[SPACE],CAPS LOCK,[SPACE], KEYPAD 0, KEYPAD ., KEYPAD ENTER |
| r1461 | r1462 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | ||
| 2 | ||
| 3 | 3 | IBM AT Compatibles |
| 4 | 4 | |
| 5 | 5 | ***************************************************************************/ |
| r1461 | r1462 | |
|---|---|---|
| 21 | 21 | |
| 22 | 22 | typedef struct { |
| 23 | 23 | int dma; |
| 24 | int irq; | |
| 24 | int irq; | |
| 25 | 25 | struct { UINT8 major, minor; } version; |
| 26 | 26 | } SOUNDBLASTER_CONFIG; |
| 27 | 27 |
| r1461 | r1462 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | defines centronics/parallel port printer interface | |
| 2 | defines centronics/parallel port printer interface | |
| 3 | 3 | |
| 4 | 4 | provides a centronics printer simulation (sends output to IO_PRINTER) |
| 5 | 5 | */ |
| r1461 | r1462 | |
| 13 | 13 | extern "C" { |
| 14 | 14 | #endif |
| 15 | 15 | |
| 16 | typedef enum { | |
| 17 | PRINTER_CENTRONICS, | |
| 16 | typedef enum { | |
| 17 | PRINTER_CENTRONICS, | |
| 18 | 18 | PRINTER_IBM // select line not important |
| 19 | 19 | } PRINTER_TYPE; |
| 20 | 20 |
| r1461 | r1462 | |
|---|---|---|
| 1 | /* | |
| 2 | ibm at mfm hard disk | |
| 1 | /* | |
| 2 | ibm at mfm hard disk | |
| 3 | 3 | interface still used in ide devices! |
| 4 | 4 | */ |
| 5 | 5 |
| r1461 | r1462 | |
|---|---|---|
| 1 | /* | |
| 1 | /* | |
| 2 | 2 | * private area for the |
| 3 | 3 | * commodore cbm floppy drives vc1541 c1551 |
| 4 | 4 | * synthetic simulation |
| 5 | * | |
| 5 | * | |
| 6 | 6 | * contains state machines and file system accesses |
| 7 | * | |
| 7 | * | |
| 8 | 8 | */ |
| 9 | 9 | #ifndef __CBMDRIVE_H_ |
| 10 | 10 | #define __CBMDRIVE_H_ |
| r1461 | r1462 | |
| 51 | 51 | attotime time; |
| 52 | 52 | } |
| 53 | 53 | serial; |
| 54 | struct | |
| 54 | struct | |
| 55 | 55 | { |
| 56 | 56 | int device; |
| 57 | 57 | int state; |
| r1461 | r1462 | |
|---|---|---|
| 28 | 28 | /*----------- defined in drivers/jupiter.c -----------*/ |
| 29 | 29 | |
| 30 | 30 | extern const gfx_layout jupiter_charlayout; |
| 31 | ||
| 31 |
| r1461 | r1462 | |
|---|---|---|
| 7 | 7 | #define P1_VDC_ENABLE (0x08) /* active low */ |
| 8 | 8 | #define P1_EXT_RAM_ENABLE (0x10) /* active low */ |
| 9 | 9 | #define P1_VDC_COPY_MODE_ENABLE (0x40) |
| 10 | ||
| 10 | ||
| 11 | 11 | #define P2_KEYBOARD_SELECT_MASK (0x07) /* select row to scan */ |
| 12 | 12 | |
| 13 | 13 | #define VDC_CONTROL_REG_STROBE_XY (0x02) |
| r1461 | r1462 | |
|---|---|---|
| 50 | 50 | PALETTE_INIT( ti85 ); |
| 51 | 51 | extern const unsigned char ti85_palette[32*7][3]; |
| 52 | 52 | extern const unsigned short ti85_colortable[32][7]; |
| 53 | ||
| 53 |
| r1461 | r1462 | |
|---|---|---|
| 16 | 16 | /* pal version */ |
| 17 | 17 | /* dma_read: videochip fetched 1 byte data from system bus */ |
| 18 | 18 | extern void ted7360_init (int pal); |
| 19 | extern void ted7360_set_dma (read8_handler dma_read, | |
| 19 | extern void ted7360_set_dma (read8_handler dma_read, | |
| 20 | 20 | read8_handler dma_read_rom); |
| 21 | 21 | |
| 22 | 22 | #define TED7360NTSC_VRETRACERATE 60 |
| r1461 | r1462 | |
|---|---|---|
| 42 | 42 | UINT8 mode_byte; |
| 43 | 43 | |
| 44 | 44 | /* data being received */ |
| 45 | UINT8 data; | |
| 45 | UINT8 data; | |
| 46 | 46 | |
| 47 | 47 | /* receive reg */ |
| 48 | 48 | struct serial_receive_register receive_reg; |
| r1461 | r1462 | |
|---|---|---|
| 11 | 11 | |
| 12 | 12 | The video chip draws the scanline until a HALT instruction (0x76) is |
| 13 | 13 | reached, which indicates no further video RAM for this scanline. Any |
| 14 | other video byte is used to generate a tile and at the same time, | |
| 14 | other video byte is used to generate a tile and at the same time, | |
| 15 | 15 | appears to the CPU as a NOP (0x00) instruction. |
| 16 | 16 | |
| 17 | 17 | ****************************************************************************/ |
| r1461 | r1462 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | 2 | video/dgn_beta.c |
| 3 | 3 | |
| 4 | The Dragon Beta uses a 68B45 for it's display generation, this is used in the | |
| 4 | The Dragon Beta uses a 68B45 for it's display generation, this is used in the | |
| 5 | 5 | conventional wat with a character generator ROM in the two text modes, which are |
| 6 | 6 | standard 40x25 and 80x25. In adition to the 6845 there is some TTL logic which |
| 7 | provides colour and attributes. In text modes the video ram is organised as pairs | |
| 7 | provides colour and attributes. In text modes the video ram is organised as pairs | |
| 8 | 8 | of character and attribute, in alternate bytes. |
| 9 | 9 | |
| 10 | 10 | The attributes decode as follows :- |
| 11 | 11 | |
| 12 | 12 | 7-6-5-4-3-2-1-0 |
| 13 | 13 | f-u-F-F-F-B-B-B |
| 14 | ||
| 14 | ||
| 15 | 15 | f=flash |
| 16 | 16 | u=underline |
| 17 | ||
| 17 | ||
| 18 | 18 | FFF = foreground colour |
| 19 | 19 | BBB = bakcground colour |
| 20 | ||
| 20 | ||
| 21 | 21 | 000 black |
| 22 | 22 | 001 red |
| 23 | 23 | 010 green |
| r1461 | r1462 | |
| 29 | 29 | |
| 30 | 30 | If flash is true, foreground and background colours will be exchanged. |
| 31 | 31 | |
| 32 | It is interesting to note that the 6845 uses 16 bit wide access to the ram, in contrast | |
| 33 | to the 8 bit accesses from the CPUs, this allows each increment of the MA lines to move | |
| 34 | 2 bytes at a time, and therefore feed both the character rom and the attribute decode | |
| 32 | It is interesting to note that the 6845 uses 16 bit wide access to the ram, in contrast | |
| 33 | to the 8 bit accesses from the CPUs, this allows each increment of the MA lines to move | |
| 34 | 2 bytes at a time, and therefore feed both the character rom and the attribute decode | |
| 35 | 35 | circuit simultaniously. |
| 36 | 36 | |
| 37 | 37 | The RAM addresses are made up of two parts, the MA0..13 from the 6845, plus two output |
| 38 | lines from the 6821 PIA, I28, the lines are BP6 and PB7, with PB7 being the most | |
| 38 | lines from the 6821 PIA, I28, the lines are BP6 and PB7, with PB7 being the most | |
| 39 | 39 | significant. This effectivly allows the 6845 access to the first 128K of memory, as there |
| 40 | 40 | are 16 address lines, accessing a 16 bit wide memory. |
| 41 | 41 | |
| 42 | 42 | The relationship between how the cpu sees the RAM, and the way the 6845 sees it is simply |
| 43 | CPU addr=2x6845 addr. So for the default video address of $1F000, the CPU sees this as | |
| 44 | being at $1F000 (after DAT trasnlation). The 6845 is programmed to start it's MA lines | |
| 43 | CPU addr=2x6845 addr. So for the default video address of $1F000, the CPU sees this as | |
| 44 | being at $1F000 (after DAT trasnlation). The 6845 is programmed to start it's MA lines | |
| 45 | 45 | counting at $3800, plus A14 and A15 being supplied by PB6 and PB7 from I28, gives an address |
| 46 | 46 | of $F800, which is the same as $1F000 / 2. |
| 47 | 47 | |
| r1461 | r1462 | |
| 60 | 60 | 640 512 4 |
| 61 | 61 | 640 256 4** |
| 62 | 62 | 640 512 2 |
| 63 | ||
| 63 | ||
| 64 | 64 | Looking at the parts of the circuit sheet that I have seen it looks like the graphics modes |
| 65 | 65 | are driven using a combination of the 6845 MA and RA lines to address more than 64K or memory |
| 66 | 66 | which is needed for some of the modes above (specifically, 640x512x4, which needs 80K). |
| 67 | 67 | |
| 68 | 68 | 2006-11-30, Text mode is almost completely implemented, in both 40 and 80 column modes. |
| 69 | 69 | I have made a start on implementing the graphics modes of the beta, drawing from technical |
| 70 | documents, from the project, this is still a work in progress. I have however managed to get | |
| 70 | documents, from the project, this is still a work in progress. I have however managed to get | |
| 71 | 71 | it to display a distorted graphical image, so I know I am going in the correct direction ! |
| 72 | 72 | |
| 73 | ** 2006-12-05, this mode is not documented in any of the printed documentation, however it | |
| 74 | is supported and displayed by the graphics test rom, it is basically the 640x512x4 mode with | |
| 73 | ** 2006-12-05, this mode is not documented in any of the printed documentation, however it | |
| 74 | is supported and displayed by the graphics test rom, it is basically the 640x512x4 mode with | |
| 75 | 75 | half the number of vertical lines, and in non-interlaced mode. |
| 76 | 76 | |
| 77 | It seems that the 640x512 modes operate the 6845 in interlaced mode, just how this affects | |
| 77 | It seems that the 640x512 modes operate the 6845 in interlaced mode, just how this affects | |
| 78 | 78 | the access to the video memory is unclear to me at the moment. |
| 79 | 79 | |
| 80 | 80 | */ |
| r1461 | r1462 | |
| 105 | 105 | V_TOTAL_ADJ, // Vertical total adjust |
| 106 | 106 | V_DISPLAYED, // Vertical displayed |
| 107 | 107 | V_SYNC_POS, // Vertical sync pos |
| 108 | INTERLACE, // Interlace | |
| 108 | INTERLACE, // Interlace | |
| 109 | 109 | MAX_SCAN, // Maximum scan line |
| 110 | 110 | CURS_START, // Cursor start pos |
| 111 | 111 | CURS_END, // Cursor end pos |
| r1461 | r1462 | |
| 207 | 207 | |
| 208 | 208 | #define IsTextMode (GCtrl & GCtrlChrGfx) ? 1 : 0 // Is this text mode ? |
| 209 | 209 | #define IsGfx16 ((~GCtrl & GCtrlChrGfx) && (~GCtrl & GCtrlControl)) ? 1 : 0 // is this 320x256x16bpp mode |
| 210 | #define IsGfx2 ((GCtrl & GCtrlHiLo) && (~GCtrl & GCtrlFS)) ? 1 : 0 // Is this a 2 colour mode | |
| 210 | #define IsGfx2 ((GCtrl & GCtrlHiLo) && (~GCtrl & GCtrlFS)) ? 1 : 0 // Is this a 2 colour mode | |
| 211 | 211 | #define SWChar (GCtrl & GCtrlSWChar)>>1 // Swchar bit |
| 212 | 212 | |
| 213 | 213 | //static int beta_state; |
| r1461 | r1462 | |
| 231 | 231 | { |
| 232 | 232 | GCtrl=data; |
| 233 | 233 | #ifdef MAME_DEBUG |
| 234 | if (LogRegWrites) | |
| 234 | if (LogRegWrites) | |
| 235 | 235 | debug_console_printf("I28-PB=$%2X, %2X-%s-%s-%s-%s-%s-%s PC=%4X\n", |
| 236 | 236 | data, |
| 237 | 237 | data & GCtrlAddrLines, |
| r1461 | r1462 | |
| 242 | 242 | data & GCtrlSWChar ? "C0" : "C1", |
| 243 | 243 | data & GCtrlWI ? "Wi" : " ", |
| 244 | 244 | activecpu_get_pc()); |
| 245 | ||
| 246 | 245 | |
| 247 | #endif | |
| 246 | ||
| 247 | #endif | |
| 248 | 248 | } |
| 249 | 249 | |
| 250 | 250 | // called when the 6845 changes the character row |
| r1461 | r1462 | |
| 257 | 257 | static void beta_Set_HSync(int offset, int data) |
| 258 | 258 | { |
| 259 | 259 | int Dots; /* Pixels per 16 bits */ |
| 260 | ||
| 260 | ||
| 261 | 261 | beta_HSync=data; |
| 262 | ||
| 262 | ||
| 263 | 263 | if(IsGfx16) |
| 264 | 264 | Dots=2; |
| 265 | 265 | else |
| 266 | 266 | Dots=8; |
| 267 | ||
| 267 | ||
| 268 | 268 | if(!beta_HSync) |
| 269 | 269 | { |
| 270 | 270 | int HT=m6845_get_register(H_TOTAL); // Get H total |
| 271 | 271 | int HS=m6845_get_register(H_SYNC_POS); // Get Hsync pos |
| 272 | 272 | int HW=m6845_get_register(H_SYNC_WIDTH)&0xF; // Hsync width (in chars) |
| 273 | ||
| 273 | ||
| 274 | 274 | beta_scr_y++; |
| 275 | 275 | // beta_scr_x=0-(((HT-HS)-HW)*8); // Number of dots after HS to wait before start of next line |
| 276 | 276 | beta_scr_x=0-((HT-(HS+HW))*Dots); |
| 277 | ||
| 277 | ||
| 278 | 278 | //debug_console_printf("HT=%d, HS=%d, HW=%d, (HS+HW)=%d, HT-(HS+HW)=%d\n",HT,HS,HW,(HS+HW),(HT-(HS+HW))); |
| 279 | //debug_console_printf("Scanline=%d, row=%d\n",m6845_get_scanline_counter(),m6845_get_row_counter()); | |
| 279 | //debug_console_printf("Scanline=%d, row=%d\n",m6845_get_scanline_counter(),m6845_get_row_counter()); | |
| 280 | 280 | #ifdef MAME_DEBUG |
| 281 | 281 | HSyncMin=beta_scr_x; |
| 282 | 282 | #endif |
| r1461 | r1462 | |
| 296 | 296 | FlashCount=0; // Reset counter |
| 297 | 297 | FlashBit=(!FlashBit) & 0x01; // Invert flash bit. |
| 298 | 298 | } |
| 299 | ||
| 299 | ||
| 300 | 300 | if (DrawInterlace==INTERLACE_AT_VS) |
| 301 | 301 | { |
| 302 | 302 | DrawInterlace=INTERLACE_ON; |
| r1461 | r1462 | |
| 311 | 311 | VSyncMin=beta_scr_y; |
| 312 | 312 | #endif |
| 313 | 313 | } |
| 314 | ||
| 314 | ||
| 315 | 315 | dgn_beta_frame_interrupt(data); |
| 316 | 316 | } |
| 317 | 317 | |
| r1461 | r1462 | |
| 319 | 319 | { |
| 320 | 320 | beta_DE = data; |
| 321 | 321 | |
| 322 | #ifdef MAME_DEBUG | |
| 322 | #ifdef MAME_DEBUG | |
| 323 | 323 | if(beta_DE) |
| 324 | 324 | DEPos=beta_scr_x; |
| 325 | #endif | |
| 325 | #endif | |
| 326 | 326 | } |
| 327 | 327 | |
| 328 | 328 | /* Video init */ |
| r1461 | r1462 | |
| 331 | 331 | /* initialise 6845 */ |
| 332 | 332 | m6845_config(&beta_m6845_interface); |
| 333 | 333 | m6845_set_personality(M6845_PERSONALITY_HD6845S); |
| 334 | ||
| 334 | ||
| 335 | 335 | GCtrl=0; |
| 336 | ||
| 336 | ||
| 337 | 337 | videoram=mess_ram; |
| 338 | 338 | |
| 339 | 339 | ClkMax=65000; |
| r1461 | r1462 | |
| 342 | 342 | DoubleHL=1; /* Default to normal height */ |
| 343 | 343 | DoubleY=1; |
| 344 | 344 | DrawInterlace=INTERLACE_OFF; /* No interlace by default */ |
| 345 | ||
| 345 | ||
| 346 | 346 | #ifdef MAME_DEBUG |
| 347 | 347 | /* setup debug commands */ |
| 348 | 348 | if (Machine->debug_mode) |
| r1461 | r1462 | |
| 380 | 380 | } |
| 381 | 381 | |
| 382 | 382 | PlotY=y*2; |
| 383 | ||
| 383 | ||
| 384 | 384 | /* Error check, make sure we're drawing onm the actual bitmap ! */ |
| 385 | 385 | if (((PlotX+1)<bitmap->width) && ((PlotY+1)<bitmap->height)) |
| 386 | 386 | { |
| r1461 | r1462 | |
| 390 | 390 | /* Plot characters twice as wide in 40 col mode */ |
| 391 | 391 | if(Double) |
| 392 | 392 | { |
| 393 | *BITMAP_ADDR16(bitmap, (PlotY+0), (PlotX+0)) = Colour; | |
| 393 | *BITMAP_ADDR16(bitmap, (PlotY+0), (PlotX+0)) = Colour; | |
| 394 | 394 | *BITMAP_ADDR16(bitmap, (PlotY+0), (PlotX+1)) = Colour; |
| 395 | ||
| 396 | *BITMAP_ADDR16(bitmap, (PlotY+1), (PlotX+0)) = Colour; | |
| 395 | ||
| 396 | *BITMAP_ADDR16(bitmap, (PlotY+1), (PlotX+0)) = Colour; | |
| 397 | 397 | *BITMAP_ADDR16(bitmap, (PlotY+1), (PlotX+1)) = Colour; |
| 398 | 398 | } |
| 399 | 399 | else |
| 400 | 400 | { |
| 401 | *BITMAP_ADDR16(bitmap, (PlotY+0), PlotX) = Colour; | |
| 402 | *BITMAP_ADDR16(bitmap, (PlotY+1), PlotX) = Colour; | |
| 401 | *BITMAP_ADDR16(bitmap, (PlotY+0), PlotX) = Colour; | |
| 402 | *BITMAP_ADDR16(bitmap, (PlotY+1), PlotX) = Colour; | |
| 403 | 403 | } |
| 404 | 404 | } |
| 405 | 405 | } |
| r1461 | r1462 | |
| 420 | 420 | int UnderLine; // Underline |
| 421 | 421 | int FlashChar; // Flashing char |
| 422 | 422 | int ULActive; // Underline active |
| 423 | ||
| 423 | ||
| 424 | 424 | bit=bitmap; |
| 425 | ||
| 425 | ||
| 426 | 426 | if (beta_DE) |
| 427 | { | |
| 427 | { | |
| 428 | 428 | /* The beta text RAM contains alternate character and attribute bytes */ |
| 429 | 429 | /* Top two address lines from PIA, IC28 PB6,7 */ |
| 430 | 430 | crtcAddr=m6845_memory_address_r(0)-1; |
| 431 | 431 | Offset=(crtcAddr | ((GCtrl & GCtrlAddrLines)<<8))*2; |
| 432 | if (Offset<0) | |
| 432 | if (Offset<0) | |
| 433 | 433 | Offset=0; |
| 434 | ||
| 434 | ||
| 435 | 435 | /* Get the character to display */ |
| 436 | 436 | char_code = videoram[Offset]; |
| 437 | 437 | |
| r1461 | r1462 | |
| 440 | 440 | /* to indicate a double height character */ |
| 441 | 441 | UnderLine=(videoram[Offset+1] & 0x40) >> 6; |
| 442 | 442 | FlashChar=(videoram[Offset+1] & 0x80) >> 7; |
| 443 | ||
| 443 | ||
| 444 | 444 | // underline is active for character set 0, on character row 9 |
| 445 | 445 | ULActive=(UnderLine && (beta_6845_RA==9) && ~SWChar); |
| 446 | ||
| 446 | ||
| 447 | 447 | /* If Character set one, and undeline set, latch double height */ |
| 448 | DoubleY=(UnderLine & SWChar & DoubleHL) | | |
| 448 | DoubleY=(UnderLine & SWChar & DoubleHL) | | |
| 449 | 449 | (SWChar & ~DoubleY & DoubleHL) | |
| 450 | 450 | (SWChar & ~DoubleY & (beta_6845_RA==9)); |
| 451 | ||
| 451 | ||
| 452 | 452 | /* Invert forground and background if flashing char and flash acive */ |
| 453 | 453 | Invert=(FlashChar & FlashBit); |
| 454 | ||
| 454 | ||
| 455 | 455 | /* Underline inverts flash */ |
| 456 | if (ULActive) | |
| 456 | if (ULActive) | |
| 457 | 457 | Invert=~Invert; |
| 458 | 458 | |
| 459 | 459 | /* Cursor on also inverts */ |
| 460 | 460 | if (CursorOn) |
| 461 | 461 | Invert=~Invert; |
| 462 | ||
| 462 | ||
| 463 | 463 | /* Invert colours if invert is true */ |
| 464 | 464 | if(!Invert) |
| 465 | 465 | { |
| r1461 | r1462 | |
| 471 | 471 | BgColour = (videoram[Offset+1] & 0x38) >> 3; |
| 472 | 472 | FgColour = (videoram[Offset+1] & 0x07); |
| 473 | 473 | } |
| 474 | ||
| 474 | ||
| 475 | 475 | /* The beta Character ROM has characters of 8x10, each aligned to a 16 byte boundry */ |
| 476 | 476 | data_byte = data[(char_code*16) + beta_6845_RA]; |
| 477 | 477 | |
| r1461 | r1462 | |
| 480 | 480 | if (data_byte & 0x080) |
| 481 | 481 | plot_text_pixel(x,y,Dot,FgColour,CharsPerLine,bitmap); |
| 482 | 482 | else |
| 483 | plot_text_pixel(x,y,Dot,BgColour,CharsPerLine,bitmap); | |
| 484 | ||
| 483 | plot_text_pixel(x,y,Dot,BgColour,CharsPerLine,bitmap); | |
| 484 | ||
| 485 | 485 | data_byte = data_byte<<1; |
| 486 | 486 | } |
| 487 | 487 | } |
| r1461 | r1462 | |
| 489 | 489 | { |
| 490 | 490 | for (Dot=0; Dot<8; Dot++) |
| 491 | 491 | plot_text_pixel(x,y,Dot,Background,CharsPerLine,bitmap); |
| 492 | ||
| 492 | ||
| 493 | 493 | } |
| 494 | 494 | |
| 495 | 495 | } |
| r1461 | r1462 | |
| 506 | 506 | int DoubleY = (~m6845_get_register(INTERLACE) & 0x03) ? 1 : 0; |
| 507 | 507 | int PlotX; |
| 508 | 508 | int PlotY; |
| 509 | ||
| 510 | if (DoubleX) | |
| 509 | ||
| 510 | if (DoubleX) | |
| 511 | 511 | PlotX=(x+Dot)*2; |
| 512 | 512 | else |
| 513 | 513 | PlotX=x+Dot; |
| 514 | ||
| 514 | ||
| 515 | 515 | if(DoubleY) |
| 516 | 516 | PlotY=(y)*2; |
| 517 | 517 | else |
| 518 | 518 | PlotY=y; |
| 519 | ||
| 519 | ||
| 520 | 520 | if(DrawInterlace==INTERLACE_ON) |
| 521 | 521 | { |
| 522 | 522 | PlotY=(y*2);//+Field; |
| r1461 | r1462 | |
| 534 | 534 | *BITMAP_ADDR16(bitmap, (PlotY+0), (PlotX+0)) = Colour; |
| 535 | 535 | *BITMAP_ADDR16(bitmap, (PlotY+0), (PlotX+1)) = Colour; |
| 536 | 536 | } |
| 537 | ||
| 537 | ||
| 538 | 538 | /* Plot pixels twice as high if in x256 modes */ |
| 539 | 539 | if (DoubleY) |
| 540 | 540 | { |
| 541 | *BITMAP_ADDR16(bitmap, (PlotY+1), (PlotX+0)) = Colour; | |
| 541 | *BITMAP_ADDR16(bitmap, (PlotY+1), (PlotX+0)) = Colour; | |
| 542 | 542 | *BITMAP_ADDR16(bitmap, (PlotY+1), (PlotX+1)) = Colour; |
| 543 | 543 | } |
| 544 | ||
| 544 | ||
| 545 | 545 | if (~(DoubleX | DoubleY)) |
| 546 | 546 | { |
| 547 | *BITMAP_ADDR16(bitmap, PlotY, PlotX) = Colour; | |
| 547 | *BITMAP_ADDR16(bitmap, PlotY, PlotX) = Colour; | |
| 548 | 548 | } |
| 549 | 549 | } |
| 550 | 550 | } |
| r1461 | r1462 | |
| 565 | 565 | int Lo; |
| 566 | 566 | int Word; |
| 567 | 567 | int Dots; /* pixesls per byte */ |
| 568 | ||
| 568 | ||
| 569 | 569 | /* We have to do this here so that it is correct for border and drawing area ! */ |
| 570 | 570 | if (IsGfx16) |
| 571 | 571 | Dots=4; |
| 572 | 572 | else if (IsGfx2) |
| 573 | 573 | Dots=16; |
| 574 | else | |
| 574 | else | |
| 575 | 575 | Dots=8; |
| 576 | ||
| 576 | ||
| 577 | 577 | if (beta_DE) |
| 578 | { | |
| 578 | { | |
| 579 | 579 | /* Calculate address of graphics pixels */ |
| 580 | 580 | crtcAddr=(m6845_memory_address_r(0) & 0x1FFF); |
| 581 | 581 | Addr=((crtcAddr<<3) | (beta_6845_RA & 0x07))*2; |
| 582 | ||
| 583 | if(Addr<MinAddr) | |
| 582 | ||
| 583 | if(Addr<MinAddr) | |
| 584 | 584 | MinAddr=Addr; |
| 585 | 585 | |
| 586 | if(Addr>MaxAddr) | |
| 586 | if(Addr>MaxAddr) | |
| 587 | 587 | MaxAddr=Addr; |
| 588 | 588 | |
| 589 | 589 | if(x>MaxX) MaxX=x; |
| r1461 | r1462 | |
| 610 | 610 | for (Dot=0;Dot<Dots;Dot++) |
| 611 | 611 | { |
| 612 | 612 | plot_gfx_pixel(x,y,Dot,Colour,bitmap); |
| 613 | ||
| 613 | ||
| 614 | 614 | Intense =Intense<<1; |
| 615 | 615 | Red =Red<<1; |
| 616 | 616 | Green =Green<<1; |
| r1461 | r1462 | |
| 637 | 637 | { |
| 638 | 638 | Colour=ColourRAM[((Word&0x8000)>>14) | ((Word&0x80)>>7)]; |
| 639 | 639 | plot_gfx_pixel(x,y,Dot,Colour,bitmap); |
| 640 | ||
| 640 | ||
| 641 | 641 | Hi=Word&0x8000; |
| 642 | 642 | Word=((Word<<1)&0xFFFE) | (Hi>>15); |
| 643 | 643 | } |
| 644 | 644 | } |
| 645 | ||
| 645 | ||
| 646 | 646 | } |
| 647 | 647 | else |
| 648 | 648 | { |
| r1461 | r1462 | |
| 655 | 655 | |
| 656 | 656 | /* Update video screen, calls either text or graphics update routine as needed */ |
| 657 | 657 | VIDEO_UPDATE( dgnbeta ) |
| 658 | { | |
| 658 | { | |
| 659 | 659 | long c=0; // this is used to time out the screen redraw, in the case that the 6845 is in some way out state. |
| 660 | ||
| 660 | ||
| 661 | 661 | bit=bitmap; |
| 662 | 662 | |
| 663 | 663 | c=0; |
| r1461 | r1462 | |
| 685 | 685 | // check that we are on the emulated screen area. |
| 686 | 686 | if ((beta_scr_x>=0) && (beta_scr_x<699) && (beta_scr_y>=0) && (beta_scr_y<549)) |
| 687 | 687 | { |
| 688 | if(IsTextMode) | |
| 688 | if(IsTextMode) | |
| 689 | 689 | beta_plot_char_line(beta_scr_x, beta_scr_y, bitmap); |
| 690 | 690 | else |
| 691 | 691 | beta_plot_gfx_line(beta_scr_x, beta_scr_y, bitmap); |
| r1461 | r1462 | |
| 716 | 716 | } |
| 717 | 717 | |
| 718 | 718 | WRITE8_HANDLER(dgnbeta_6845_w) |
| 719 | { | |
| 719 | { | |
| 720 | 720 | if(offset&0x1) |
| 721 | 721 | { |
| 722 | 722 | m6845_register_w(offset,data); |
| 723 | ||
| 723 | ||
| 724 | 724 | if(VidAddr==INTERLACE) |
| 725 | 725 | { |
| 726 | 726 | DrawInterlace=(data & 0x03) ? INTERLACE_AT_VS : INTERLACE_OFF; |
| r1461 | r1462 | |
| 732 | 732 | VidAddr=data; /* Record reg being written to */ |
| 733 | 733 | } |
| 734 | 734 | #ifdef MAME_DEBUG |
| 735 | if (LogRegWrites) | |
| 735 | if (LogRegWrites) | |
| 736 | 736 | RegLog(offset,data); |
| 737 | 737 | #endif |
| 738 | 738 | } |
| r1461 | r1462 | |
| 762 | 762 | { |
| 763 | 763 | char RegName[16]; |
| 764 | 764 | |
| 765 | switch (VidAddr) | |
| 765 | switch (VidAddr) | |
| 766 | 766 | { |
| 767 | 767 | case H_TOTAL : sprintf(RegName,"H Total "); break; |
| 768 | 768 | case H_DISPLAYED : sprintf(RegName,"H Displayed "); break; |
| r1461 | r1462 | |
| 780 | 780 | case START_ADDR_L : sprintf(RegName,"Start Addr L "); break; |
| 781 | 781 | case CURS_H : sprintf(RegName,"Cursor H "); break; |
| 782 | 782 | case CURS_L : sprintf(RegName,"Cursor L "); break; |
| 783 | } | |
| 784 | ||
| 783 | } | |
| 784 | ||
| 785 | 785 | if(offset&0x1) |
| 786 | 786 | debug_console_printf("6845 write Reg %s Addr=%3d Data=%3d ($%2.2X) \n",RegName,VidAddr,data,data); |
| 787 | 787 | } |
| r1461 | r1462 | |
| 789 | 789 | static void FillScreen(int ref, int params, const char *param[]) |
| 790 | 790 | { |
| 791 | 791 | int x; |
| 792 | ||
| 792 | ||
| 793 | 793 | for(x=1;x<899;x++) |
| 794 | 794 | { |
| 795 | 795 | plot_box(bit, x, 1, 1, 698, x & 0x07); |
| r1461 | r1462 | |
| 800 | 800 | static void ScreenBox(int ref, int params, const char *param[]) |
| 801 | 801 | { |
| 802 | 802 | int x,y; |
| 803 | ||
| 803 | ||
| 804 | 804 | if(params>0) sscanf(param[0],"%d",&BoxMinX); |
| 805 | 805 | if(params>1) sscanf(param[1],"%d",&BoxMinY); |
| 806 | 806 | if(params>2) sscanf(param[2],"%d",&BoxMaxX); |
| 807 | 807 | if(params>3) sscanf(param[3],"%d",&BoxMaxY); |
| 808 | 808 | if(params>4) sscanf(param[4],"%d",&BoxColour); |
| 809 | ||
| 809 | ||
| 810 | 810 | for(x=BoxMinX;x<BoxMaxX;x++) |
| 811 | 811 | { |
| 812 | 812 | *BITMAP_ADDR16(bit, BoxMinY, x) = BoxColour; |
| r1461 | r1462 | |
| 844 | 844 | } |
| 845 | 845 | |
| 846 | 846 | static void SetClkMax(int ref, int params, const char *param[]) |
| 847 | { | |
| 847 | { | |
| 848 | 848 | if(params>0) sscanf(param[0],"%d",&ClkMax); |
| 849 | 849 | } |
| 850 | 850 |
| r1461 | r1462 | |
|---|---|---|
| 37 | 37 | static const POCKETC_FIGURE line={ /* simple line */ |
| 38 | 38 | "11111", |
| 39 | 39 | "11111", |
| 40 | "11111e" | |
| 40 | "11111e" | |
| 41 | 41 | }; |
| 42 | static const POCKETC_FIGURE busy={ | |
| 42 | static const POCKETC_FIGURE busy={ | |
| 43 | 43 | "11 1 1 11 1 1", |
| 44 | 44 | "1 1 1 1 1 1 1", |
| 45 | 45 | "11 1 1 1 1 1", |
| 46 | 46 | "1 1 1 1 1 1", |
| 47 | 47 | "11 1 11 1e" |
| 48 | }, def={ | |
| 48 | }, def={ | |
| 49 | 49 | "11 111 111", |
| 50 | 50 | "1 1 1 1", |
| 51 | 51 | "1 1 111 11", |
| 52 | 52 | "1 1 1 1", |
| 53 | "11 111 1e" | |
| 53 | "11 111 1e" | |
| 54 | 54 | }, shift={ |
| 55 | 55 | " 11 1 1 1 111 111", |
| 56 | 56 | "1 1 1 1 1 1", |
| 57 | 57 | " 1 111 1 11 1", |
| 58 | 58 | " 1 1 1 1 1 1", |
| 59 | "11 1 1 1 1 1e" | |
| 59 | "11 1 1 1 1 1e" | |
| 60 | 60 | }, hyp={ |
| 61 | 61 | "1 1 1 1 11", |
| 62 | 62 | "1 1 1 1 1 1", |
| 63 | 63 | "111 1 1 11", |
| 64 | 64 | "1 1 1 1", |
| 65 | "1 1 1 1e" | |
| 65 | "1 1 1 1e" | |
| 66 | 66 | }, de={ |
| 67 | 67 | "11 111", |
| 68 | 68 | "1 1 1", |
| r1461 | r1462 | |
| 74 | 74 | "1", |
| 75 | 75 | "1 1", |
| 76 | 76 | "1 1", |
| 77 | " 11e" | |
| 77 | " 11e" | |
| 78 | 78 | }, rad={ |
| 79 | 79 | "11 1 11", |
| 80 | 80 | "1 1 1 1 1 1", |
| r1461 | r1462 | |
| 98 | 98 | "1", |
| 99 | 99 | "111", |
| 100 | 100 | "1", |
| 101 | "111e" | |
| 102 | }, run={ | |
| 101 | "111e" | |
| 102 | }, run={ | |
| 103 | 103 | "11 1 1 1 1", |
| 104 | 104 | "1 1 1 1 11 1", |
| 105 | 105 | "11 1 1 1 11", |
| 106 | 106 | "1 1 1 1 1 1", |
| 107 | "1 1 1 1 1e" | |
| 108 | }, pro={ | |
| 107 | "1 1 1 1 1e" | |
| 108 | }, pro={ | |
| 109 | 109 | "11 11 1 ", |
| 110 | 110 | "1 1 1 1 1 1", |
| 111 | 111 | "11 11 1 1", |
| 112 | 112 | "1 1 1 1 1", |
| 113 | "1 1 1 1e" | |
| 114 | }, japan={ | |
| 113 | "1 1 1 1e" | |
| 114 | }, japan={ | |
| 115 | 115 | " 1 1 11 1 1 1", |
| 116 | 116 | " 1 1 1 1 1 1 1 11 1", |
| 117 | 117 | " 1 111 11 111 1 11", |
| 118 | 118 | "1 1 1 1 1 1 1 1 1", |
| 119 | " 1 1 1 1 1 1 1 1e" | |
| 120 | }, sml={ | |
| 119 | " 1 1 1 1 1 1 1 1e" | |
| 120 | }, sml={ | |
| 121 | 121 | " 11 1 1 1", |
| 122 | 122 | "1 111 1", |
| 123 | 123 | " 1 1 1 1", |
| 124 | 124 | " 1 1 1 1", |
| 125 | "11 1 1 111e" | |
| 126 | }, rsv={ | |
| 125 | "11 1 1 111e" | |
| 126 | }, rsv={ | |
| 127 | 127 | "11 11 1 1", |
| 128 | 128 | "1 1 1 1 1", |
| 129 | 129 | "11 1 1 1", |
| 130 | 130 | "1 1 1 1 1", |
| 131 | "1 1 11 1e" | |
| 131 | "1 1 11 1e" | |
| 132 | 132 | }; |
| 133 | 133 | |
| 134 | 134 | #define DOWN 57 |
| r1461 | r1462 | |
| 144 | 144 | /* HJB: we cannot initialize array with values from other arrays, thus... */ |
| 145 | 145 | color[0] = machine->pens[pocketc_colortable[CONTRAST][0]]; |
| 146 | 146 | color[1] = machine->pens[pocketc_colortable[CONTRAST][1]]; |
| 147 | ||
| 147 | ||
| 148 | 148 | if (pc1401_portc&1) { |
| 149 | 149 | for (x=RIGHT,y=DOWN,i=0; i<0x28;x+=2) { |
| 150 | 150 | for (j=0; j<5;j++,i++,x+=2) |
| r1461 | r1462 | |
|---|---|---|
| 52 | 52 | if ((beamy < BORDER_TOP) || (beamy >= 200+BORDER_TOP)) |
| 53 | 53 | { |
| 54 | 54 | // don't draw past the bottom border |
| 55 | if (beamy >= 231+BORDER_TOP) | |
| 55 | if (beamy >= 231+BORDER_TOP) | |
| 56 | 56 | { |
| 57 | 57 | return 0; |
| 58 | 58 | } |
| r1461 | r1462 | |
| 118 | 118 | scanline[col * 4 + 3 + BORDER_LEFT] = pixel; |
| 119 | 119 | } |
| 120 | 120 | } |
| 121 | } | |
| 121 | } | |
| 122 | 122 | } |
| 123 | 123 | else |
| 124 | 124 | { |
| r1461 | r1462 | |
|---|---|---|
| 79 | 79 | int j, xi=0; |
| 80 | 80 | for (j=0; figure[j]; j++) { |
| 81 | 81 | switch (figure[j]) { |
| 82 | case '1': | |
| 82 | case '1': | |
| 83 | 83 | *BITMAP_ADDR16(bitmap, y, x+xi) = color; |
| 84 | 84 | xi++; |
| 85 | 85 | break; |
| 86 | case ' ': | |
| 86 | case ' ': | |
| 87 | 87 | xi++; |
| 88 | 88 | break; |
| 89 | 89 | case '\r': |
| 90 | 90 | xi=0; |
| 91 | 91 | y++; |
| 92 | break; | |
| 92 | break; | |
| 93 | 93 | }; |
| 94 | 94 | } |
| 95 | 95 | } |
| r1461 | r1462 | |
| 97 | 97 | |
| 98 | 98 | #define LCD_LINES (hp48_hardware.data[0x28]|((hp48_hardware.data[0x29]&3)<<4) |
| 99 | 99 | |
| 100 | static const char *hp48_orange={ | |
| 100 | static const char *hp48_orange={ | |
| 101 | 101 | "11111111111\r" |
| 102 | 102 | "111 1111111\r" |
| 103 | 103 | "11 1111111\r" |
| r1461 | r1462 | |
| 172 | 172 | |
| 173 | 173 | for (y=0,i=LCD_BASE_ADDRESS; y<64; y+=8, i+=LCD_LINE_OFFSET) { |
| 174 | 174 | for (x=0; x<131; x++) { |
| 175 | drawgfx(bitmap, machine->gfx[0], | |
| 175 | drawgfx(bitmap, machine->gfx[0], | |
| 176 | 176 | program_read_byte(i+x), |
| 177 | 177 | contrast,0,0, |
| 178 | 178 | x*2+RIGHT,y*2+DOWN, |
| r1461 | r1462 | |
|---|---|---|
| 5 | 5 | |
| 6 | 6 | Per Ola Ingvarsson |
| 7 | 7 | Tomas Karlsson |
| 8 | ||
| 8 | ||
| 9 | 9 | ******************************************************************************/ |
| 10 | 10 | |
| 11 | 11 | /*-------------------------------------------------------------------------*/ |
| r1461 | r1462 | |
| 36 | 36 | #define GDC_LOG_CMD_3(x,y,z) (logerror(x,y,z)) |
| 37 | 37 | #define GDC_LOG_CMD_4(x,y,z,a) (logerror(x,y,z,a)) |
| 38 | 38 | #else |
| 39 | #define GDC_LOG_CMD_1(x) | |
| 40 | #define GDC_LOG_CMD_2(x,y) | |
| 39 | #define GDC_LOG_CMD_1(x) | |
| 40 | #define GDC_LOG_CMD_2(x,y) | |
| 41 | 41 | #define GDC_LOG_CMD_3(x,y,z) |
| 42 | #define GDC_LOG_CMD_4(x,y,z,a) | |
| 42 | #define GDC_LOG_CMD_4(x,y,z,a) | |
| 43 | 43 | #endif |
| 44 | 44 | |
| 45 | 45 | /* FIFO */ |
| r1461 | r1462 | |
| 48 | 48 | UINT8 data[16]; /* The data of the fifo */ |
| 49 | 49 | UINT8 cmd_flags[16]; /* 0 for params 1 for commands */ |
| 50 | 50 | UINT8 direction; /* Direction flag (R=1/W=0) */ |
| 51 | UINT8 write_pos; /* Position for next write operation */ | |
| 51 | UINT8 write_pos; /* Position for next write operation */ | |
| 52 | 52 | UINT8 read_pos; /* Position for next read operation */ |
| 53 | 53 | UINT8 count; /* The number of entries in the fifo */ |
| 54 | 54 | UINT8 nbr_cmds; /* The number of commands in the fifo */ |
| r1461 | r1462 | |
| 235 | 235 | gdcp->fifo.direction = GDC_FIFO_DIR_WRITE; |
| 236 | 236 | } |
| 237 | 237 | gdc_fifo_enqueue(gdcp, data, cmdflag); |
| 238 | ||
| 238 | ||
| 239 | 239 | } |
| 240 | 240 | |
| 241 | 241 | /*-------------------------------------------------------------------------*/ |
| r1461 | r1462 | |
| 334 | 334 | } |
| 335 | 335 | |
| 336 | 336 | static UINT32 gdc_get_base_addr(TYP_GDC* gdcp) |
| 337 | { | |
| 337 | { | |
| 338 | 338 | int i; |
| 339 | 339 | UINT32 ret_val = 0; |
| 340 | 340 | int shift_amount = 0; |
| r1461 | r1462 | |
| 350 | 350 | |
| 351 | 351 | |
| 352 | 352 | static UINT32 gdc_partition_length(TYP_GDC* gdcp) |
| 353 | { | |
| 353 | { | |
| 354 | 354 | /* Get a byte and put it into a temp */ |
| 355 | 355 | UINT32 pram_byte_low = gdcp->pram[2] >> 4; |
| 356 | 356 | UINT32 pram_byte_high = gdcp->pram[3] & 0x3f; |
| r1461 | r1462 | |
| 379 | 379 | |
| 380 | 380 | INLINE void gdc_write(UINT32 address, |
| 381 | 381 | UINT16 data) |
| 382 | { | |
| 382 | { | |
| 383 | 383 | gdc_mess.vram[address % gdc_mess.vramsize] = data; |
| 384 | 384 | } |
| 385 | 385 | |
| r1461 | r1462 | |
| 455 | 455 | UINT8 operation) |
| 456 | 456 | { |
| 457 | 457 | gdc_write_data(data, gdc.registers.display.mask, operation); |
| 458 | ||
| 458 | ||
| 459 | 459 | gdc_mess.dirty = 1; |
| 460 | 460 | gdc_update_ead_and_mask(); |
| 461 | 461 | } |
| r1461 | r1462 | |
| 464 | 464 | { |
| 465 | 465 | /* Save address */ |
| 466 | 466 | UINT32 address = gdc.registers.display.ead; |
| 467 | ||
| 467 | ||
| 468 | 468 | return gdc_mess.vram[address & gdc_mess.vramsize] & mask; |
| 469 | 469 | } |
| 470 | 470 | |
| 471 | 471 | static UINT16 gdc_auto_read_data(void) |
| 472 | 472 | { |
| 473 | UINT16 ret_val = gdc_read_data(gdc.registers.display.mask); | |
| 473 | UINT16 ret_val = gdc_read_data(gdc.registers.display.mask); | |
| 474 | 474 | /* Update the ead and mask */ |
| 475 | 475 | gdc_update_ead_and_mask(); |
| 476 | 476 | return ret_val; |
| r1461 | r1462 | |
| 532 | 532 | |
| 533 | 533 | if ( i == 0 ) |
| 534 | 534 | return; |
| 535 | ||
| 536 | /* Update display mode */ | |
| 535 | ||
| 536 | /* Update display mode */ | |
| 537 | 537 | reg = (gdc.registers.command.sync[0] & 0x20) ? 0x02 : 0; |
| 538 | 538 | reg += (gdc.registers.command.sync[0] & 0x02) ? 0x01 : 0; |
| 539 | 539 | gdc.registers.display.display_mode = reg; |
| 540 | ||
| 540 | ||
| 541 | 541 | GDC_LOG_CMD_2("gdc_cmd_sync: mode byte = %02X\n", |
| 542 | 542 | gdc.registers.command.sync[0]); |
| 543 | 543 | GDC_LOG_CMD_2("gdc_cmd_sync: mode is %s\n", gdc_disp_mode_to_str(reg)); |
| 544 | ||
| 545 | 544 | |
| 545 | ||
| 546 | 546 | if ( i == 1 ) |
| 547 | 547 | return; |
| 548 | ||
| 548 | ||
| 549 | 549 | /* Update words per line */ |
| 550 | 550 | reg = gdc.registers.command.sync[1] & 0xfe; |
| 551 | 551 | /* The register contains the number of lines - 2 */ |
| 552 | 552 | gdc.registers.display.words_per_line = reg + 2; |
| 553 | 553 | gdc.registers.display.display_width = reg + 2; |
| 554 | ||
| 554 | ||
| 555 | 555 | GDC_LOG_CMD_2("gdc_cmd_sync: words_per_line set to %d\n", |
| 556 | 556 | gdc.registers.display.words_per_line); |
| 557 | 557 | GDC_LOG_CMD_2("gdc_cmd_sync: display_width set to %d\n", |
| r1461 | r1462 | |
| 594 | 594 | |
| 595 | 595 | if ( i == 6 ) |
| 596 | 596 | return; |
| 597 | ||
| 597 | ||
| 598 | 598 | /* Low bits of active display lines per video field */ |
| 599 | 599 | reg16 = gdc.registers.command.sync[6]; |
| 600 | 600 | |
| r1461 | r1462 | |
| 607 | 607 | |
| 608 | 608 | gdc.registers.display.vert_back_porch = |
| 609 | 609 | gdc.registers.command.sync[7] >> 2; |
| 610 | ||
| 610 | ||
| 611 | 611 | gdc_dump_disp_regs(); |
| 612 | 612 | } |
| 613 | 613 | |
| r1461 | r1462 | |
| 665 | 665 | int i,k,x; |
| 666 | 666 | char tmp_str[9]; |
| 667 | 667 | UINT8 tmpParam[16]; |
| 668 | UINT32 base_addr_before = gdc_get_base_addr(&gdc); | |
| 669 | /* Upside down */ | |
| 668 | UINT32 base_addr_before = gdc_get_base_addr(&gdc); | |
| 669 | /* Upside down */ | |
| 670 | 670 | k = 0; |
| 671 | 671 | while ( (param_p = gdc_fifo_dequeue_param(&gdc)) != NULL ) { |
| 672 | 672 | /* This is for printing */ |
| r1461 | r1462 | |
| 706 | 706 | UINT8 temp_reg; |
| 707 | 707 | UINT8* param_p; |
| 708 | 708 | TYP_GDC_REGS_DISPLAY* dispregs = &gdc.registers.display; |
| 709 | ||
| 709 | ||
| 710 | 710 | if ( ( param_p = gdc_fifo_dequeue_param(&gdc)) == NULL ) return; |
| 711 | 711 | /* Cursor on or off */ |
| 712 | 712 | dispregs->disp_cursor = (*param_p & 0x80) != 0; |
| r1461 | r1462 | |
| 736 | 736 | dispregs->cursor_blink_rate); |
| 737 | 737 | GDC_LOG_CMD_2("gdc_cmd_cchar: Cursor bottom line = %d\n", |
| 738 | 738 | dispregs->cursor_bottom_line); |
| 739 | ||
| 740 | ||
| 739 | ||
| 740 | ||
| 741 | 741 | } |
| 742 | 742 | |
| 743 | 743 | /*-------------------------------------------------------------------------*/ |
| r1461 | r1462 | |
| 758 | 758 | dispregs->figs_d1_param = 0xff; |
| 759 | 759 | dispregs->figs_dm_param = 0xff; |
| 760 | 760 | |
| 761 | ||
| 761 | ||
| 762 | 762 | if ( ( param_p = gdc_fifo_dequeue_param(&gdc)) == NULL ) return; |
| 763 | 763 | /* What will be done next time? */ |
| 764 | 764 | dispregs->figs_operation = (*param_p & 0xf1) >> 3; |
| r1461 | r1462 | |
| 770 | 770 | if ( ( param_p = gdc_fifo_dequeue_param(&gdc)) == NULL ) return; |
| 771 | 771 | temp_reg = *param_p; |
| 772 | 772 | if ( ( param_p = gdc_fifo_dequeue_param(&gdc)) != NULL ) { |
| 773 | temp_reg |= (*param_p & 0x3f) << 8; | |
| 773 | temp_reg |= (*param_p & 0x3f) << 8; | |
| 774 | 774 | } else { |
| 775 | 775 | quit = 1; |
| 776 | 776 | } |
| r1461 | r1462 | |
| 787 | 787 | case 3: |
| 788 | 788 | dispregs->figs_d1_param = temp_reg; |
| 789 | 789 | break; |
| 790 | case 4: | |
| 790 | case 4: | |
| 791 | 791 | dispregs->figs_dm_param = temp_reg; |
| 792 | 792 | break; |
| 793 | 793 | } |
| r1461 | r1462 | |
| 807 | 807 | UINT8* param_p; |
| 808 | 808 | UINT16 temp_reg; |
| 809 | 809 | TYP_GDC_REGS_DISPLAY* dispregs = &gdc.registers.display; |
| 810 | ||
| 810 | ||
| 811 | 811 | if ( ( param_p = gdc_fifo_dequeue_param(&gdc)) == NULL ) return; |
| 812 | 812 | temp_reg = *param_p; |
| 813 | 813 | if ( ( param_p = gdc_fifo_dequeue_param(&gdc)) == NULL ) return; |
| r1461 | r1462 | |
| 825 | 825 | UINT8* param_p; |
| 826 | 826 | UINT32 temp_reg; |
| 827 | 827 | TYP_GDC_REGS_DISPLAY* dispregs = &gdc.registers.display; |
| 828 | ||
| 828 | ||
| 829 | 829 | if ( ( param_p = gdc_fifo_dequeue_param(&gdc)) == NULL ) return; |
| 830 | 830 | temp_reg = *param_p; |
| 831 | 831 | dispregs->ead = temp_reg; |
| r1461 | r1462 | |
| 860 | 860 | TYP_GDC_REGS_DISPLAY* dispregs = &gdc.registers.display; |
| 861 | 861 | |
| 862 | 862 | dispregs->cur_mod = command & 0x03; |
| 863 | ||
| 863 | ||
| 864 | 864 | /* Seems like there can be many parameters to the WDAT and that |
| 865 | 865 | dc is only used for the first set */ |
| 866 | 866 | for ( ;; ) { /* Use up all parameters */ |
| 867 | 867 | UINT16 orig_mask = gdc.registers.display.mask; |
| 868 | 868 | /* Low byte */ |
| 869 | 869 | if ( ( param_p = gdc_fifo_dequeue_param(&gdc)) == NULL ) return; |
| 870 | ||
| 870 | ||
| 871 | 871 | temp_reg = *param_p; |
| 872 | ||
| 872 | ||
| 873 | 873 | /* FIXME: Check type of transfer. There can be bytes or words */ |
| 874 | 874 | /* One optional high byte */ |
| 875 | 875 | switch(command & 0x18) { |
| r1461 | r1462 | |
| 895 | 895 | case 0x18: |
| 896 | 896 | /* FIXME: Bor bara anvanda en byte i detta fallet */ |
| 897 | 897 | /* FIXME: Save the mask */ |
| 898 | gdc.registers.display.mask &= 0xff00; | |
| 898 | gdc.registers.display.mask &= 0xff00; | |
| 899 | 899 | temp_reg = ( (temp_reg & 0xff ) << 8); |
| 900 | 900 | break; |
| 901 | 901 | default: |
| 902 | 902 | return; |
| 903 | 903 | } |
| 904 | ||
| 904 | ||
| 905 | 905 | GDC_LOG_CMD_4("gdc_cmd_wdat: data = %04X, dc = %02X, mod = %x", |
| 906 | 906 | temp_reg, dispregs->figs_dc_param, dispregs->cur_mod); |
| 907 | 907 | GDC_LOG_CMD_3(" mask = %04X, transfer = %02X\n", dispregs->mask, |
| r1461 | r1462 | |
| 914 | 914 | /* temp_reg = 0x0000; */ |
| 915 | 915 | /* } */ |
| 916 | 916 | /* } */ |
| 917 | ||
| 917 | ||
| 918 | 918 | for ( i=0; i < dispregs->figs_dc_param + 1; ++i ) { |
| 919 | gdc_auto_write_data(temp_reg, | |
| 919 | gdc_auto_write_data(temp_reg, | |
| 920 | 920 | dispregs->cur_mod); |
| 921 | 921 | } |
| 922 | 922 | gdc.registers.display.mask = orig_mask; |
| 923 | 923 | /* Now dc should be zero for the other parameters */ |
| 924 | 924 | dispregs->figs_dc_param = 0; |
| 925 | 925 | } |
| 926 | ||
| 926 | ||
| 927 | 927 | } |
| 928 | 928 | |
| 929 | 929 | /*-------------------------------------------------------------------------*/ |
| r1461 | r1462 | |
| 936 | 936 | /* FIXME: Check in-parameter too */ |
| 937 | 937 | int i; |
| 938 | 938 | for ( i=0; i < (dispregs->figs_dc_param); ++i ) { |
| 939 | UINT16 data = gdc_auto_read_data(); | |
| 939 | UINT16 data = gdc_auto_read_data(); | |
| 940 | 940 | gdc_fifo_add_from_inside(&gdc, data & 0xff, 0); |
| 941 | 941 | gdc_fifo_add_from_inside(&gdc, (data >> 8) & 0xff, 0); |
| 942 | 942 | } |
| r1461 | r1462 | |
| 966 | 966 | int row; |
| 967 | 967 | int bitnbr; |
| 968 | 968 | UINT16 writeWord; |
| 969 | ||
| 969 | ||
| 970 | 970 | TYP_GDC_REGS_DISPLAY* dispregs = &gdc.registers.display; |
| 971 | 971 | /* This will only work if the character is 8 by 8 and direction is |
| 972 | 972 | 2 and it may not even work then */ |
| 973 | 973 | UINT16 saved_mask = dispregs->mask; |
| 974 | UINT32 saved_ead = dispregs->ead; | |
| 974 | UINT32 saved_ead = dispregs->ead; | |
| 975 | 975 | for ( row = 0; row < 8; ++row ) { |
| 976 | 976 | int zy; |
| 977 | 977 | for ( zy = 0; zy < dispregs->zoom_gchr; ++zy ) { |
| r1461 | r1462 | |
| 979 | 979 | dispregs->ead = saved_ead - |
| 980 | 980 | (dispregs->zoom_gchr*row+zy) * dispregs->words_per_line; |
| 981 | 981 | GDC_LOG_CMD_2("gdc_cmd_gchrd: pram : %1x\n", gdc.pram[15-row]); |
| 982 | /* Reset pixel mask (x) */ | |
| 982 | /* Reset pixel mask (x) */ | |
| 983 | 983 | dispregs->mask = saved_mask; |
| 984 | 984 | for ( bitnbr = 0; bitnbr < 8; ++bitnbr ) { |
| 985 | int zx; | |
| 985 | int zx; | |
| 986 | 986 | for ( zx = 0; zx < dispregs->zoom_gchr; ++zx ) { |
| 987 | 987 | UINT16 bit = (gdc.pram[15-row] >> bitnbr) & 0x01; |
| 988 | 988 | writeWord = bit ? 0xffff : 0x0000; |
| r1461 | r1462 | |
| 990 | 990 | ((~dispregs->mask) & gdc_mess.vram[dispregs->ead]); |
| 991 | 991 | /* The mode is set by wdat */ |
| 992 | 992 | gdc_write_data(writeWord, 0xffff, dispregs->cur_mod); |
| 993 | ||
| 993 | ||
| 994 | 994 | if ( dispregs->mask & 0x8000 ) { |
| 995 | 995 | dispregs->ead++; |
| 996 | 996 | } |
| r1461 | r1462 | |
| 1004 | 1004 | } |
| 1005 | 1005 | // Back up 8 lines |
| 1006 | 1006 | dispregs->ead = saved_ead - |
| 1007 | dispregs->words_per_line * 8 * dispregs->zoom_gchr; | |
| 1008 | dispregs->mask = saved_mask; | |
| 1007 | dispregs->words_per_line * 8 * dispregs->zoom_gchr; | |
| 1008 | dispregs->mask = saved_mask; | |
| 1009 | 1009 | gdc_mess.dirty = 1; |
| 1010 | 1010 | } |
| 1011 | 1011 | |
| r1461 | r1462 | |
| 1051 | 1051 | GDC_LOG_CMD_1("gdc_command: CCHAR\n"); |
| 1052 | 1052 | gdc_cmd_cchar(); |
| 1053 | 1053 | break; |
| 1054 | ||
| 1054 | ||
| 1055 | 1055 | /* Display control commands */ |
| 1056 | 1056 | case CMD_START: /* Ends idle mode and unblanks the display */ |
| 1057 | 1057 | GDC_LOG_CMD_1("gdc_command: START\n"); |
| r1461 | r1462 | |
| 1061 | 1061 | case CMD_BCTRL_OFF: /* Controls the blanking and unblanking of the display */ |
| 1062 | 1062 | GDC_LOG_CMD_1("gdc_command: BCTRL_OFF\n"); |
| 1063 | 1063 | break; |
| 1064 | ||
| 1064 | ||
| 1065 | 1065 | case CMD_BCTRL_ON: /* Controls the blanking and unblanking of the display */ |
| 1066 | 1066 | GDC_LOG_CMD_1("gdc_command: BCTRL_ON\n"); |
| 1067 | 1067 | break; |
| 1068 | ||
| 1068 | ||
| 1069 | 1069 | /* Specifies zoom factors for the display and graphics characters writing */ |
| 1070 | 1070 | case CMD_ZOOM: |
| 1071 | 1071 | GDC_LOG_CMD_1("gdc_command: ZOOM\n"); |
| 1072 | 1072 | gdc_cmd_zoom(); |
| 1073 | 1073 | break; |
| 1074 | ||
| 1075 | ||
| 1074 | ||
| 1075 | ||
| 1076 | 1076 | case CMD_CURS: |
| 1077 | 1077 | /* Sets the position of the cursor in display memory */ |
| 1078 | 1078 | GDC_LOG_CMD_1("gdc_command: CURS\n"); |
| 1079 | 1079 | gdc_cmd_curs(); |
| 1080 | 1080 | break; |
| 1081 | 1081 | |
| 1082 | case CMD_PITCH: | |
| 1082 | case CMD_PITCH: | |
| 1083 | 1083 | /* Specifies the width of the X dimension of the display memory */ |
| 1084 | 1084 | GDC_LOG_CMD_1("gdc_command: PITCH\n"); |
| 1085 | 1085 | gdc_cmd_pitch(); |
| 1086 | 1086 | break; |
| 1087 | ||
| 1087 | ||
| 1088 | 1088 | /* Drawing control commands */ |
| 1089 | 1089 | |
| 1090 | 1090 | case CMD_MASK: /* Sets the MASK register contents */ |
| 1091 | 1091 | GDC_LOG_CMD_1("gdc_command: MASK\n"); |
| 1092 | 1092 | gdc_cmd_mask(); |
| 1093 | 1093 | break; |
| 1094 | ||
| 1094 | ||
| 1095 | 1095 | case CMD_FIGS: /* Specifies the parameters for the drawing processor */ |
| 1096 | 1096 | GDC_LOG_CMD_1("gdc_command: FIGS\n"); |
| 1097 | 1097 | gdc_cmd_figs(); |
| r1461 | r1462 | |
| 1116 | 1116 | GDC_LOG_CMD_1("gdc_command: LPRD\n"); |
| 1117 | 1117 | gdc_cmd_lprd(); |
| 1118 | 1118 | break; |
| 1119 | ||
| 1119 | ||
| 1120 | 1120 | default: |
| 1121 | ||
| 1121 | ||
| 1122 | 1122 | /* Display control commands */ |
| 1123 | 1123 | if ((command & CMD_PRAM_BITMASK) == CMD_PRAM_BITMASK) |
| 1124 | 1124 | { |
| r1461 | r1462 | |
| 1132 | 1132 | switch(command & 0xe4) |
| 1133 | 1133 | { |
| 1134 | 1134 | /* Drawing control commands */ |
| 1135 | ||
| 1135 | ||
| 1136 | 1136 | case CMD_WDAT_BITMASK: |
| 1137 | 1137 | /* Writes data words or bytes into display memory */ |
| 1138 | 1138 | GDC_LOG_CMD_1("gdc_command: WDAT\n"); |
| 1139 | 1139 | gdc_cmd_wdat(command); |
| 1140 | 1140 | break; |
| 1141 | ||
| 1141 | ||
| 1142 | 1142 | /* Memory data read commands */ |
| 1143 | ||
| 1143 | ||
| 1144 | 1144 | case CMD_RDAT_BITMASK: /* Reads data words or bytes from display */ |
| 1145 | 1145 | GDC_LOG_CMD_1("gdc_command: RDAT\n"); |
| 1146 | 1146 | gdc_cmd_rdat(command); |
| 1147 | 1147 | break; |
| 1148 | ||
| 1148 | ||
| 1149 | 1149 | /* Data control commands */ |
| 1150 | ||
| 1150 | ||
| 1151 | 1151 | case CMD_DMAR_BITMASK: /* Requests a DMA read transfer */ |
| 1152 | 1152 | GDC_LOG_CMD_1("gdc_command: DMAR\n"); |
| 1153 | 1153 | break; |
| 1154 | ||
| 1154 | ||
| 1155 | 1155 | case CMD_DMAW_BITMASK: /* Requests a DMA write transfer */ |
| 1156 | 1156 | GDC_LOG_CMD_1("gdc_command: DMAW\n"); |
| 1157 | 1157 | break; |
| 1158 | ||
| 1158 | ||
| 1159 | 1159 | default: |
| 1160 | 1160 | logerror("GDC Unknown Command %04X\n", command); |
| 1161 | ||
| 1161 | ||
| 1162 | 1162 | break; |
| 1163 | 1163 | } |
| 1164 | 1164 | } |
| r1461 | r1462 | |
| 1205 | 1205 | case CMD_CCHAR: |
| 1206 | 1206 | case CMD_CURS: |
| 1207 | 1207 | return 3; |
| 1208 | case CMD_RESET: | |
| 1209 | case CMD_SYNC_OFF: | |
| 1210 | case CMD_SYNC_ON: | |
| 1208 | case CMD_RESET: | |
| 1209 | case CMD_SYNC_OFF: | |
| 1210 | case CMD_SYNC_ON: | |
| 1211 | 1211 | return 8; |
| 1212 | 1212 | case CMD_FIGS: |
| 1213 | 1213 | return 11; |
| 1214 | default: | |
| 1214 | default: | |
| 1215 | 1215 | if ((command & CMD_PRAM_BITMASK) == CMD_PRAM_BITMASK) { |
| 1216 | 1216 | return 16; /* XXX */ |
| 1217 | 1217 | } else { |
| r1461 | r1462 | |
| 1239 | 1239 | /*-------------------------------------------------------------------------*/ |
| 1240 | 1240 | WRITE16_HANDLER ( compis_gdc_w ) |
| 1241 | 1241 | { |
| 1242 | /* FIXME: Move to better place. Must be signed and larger than 8 bits */ | |
| 1242 | /* FIXME: Move to better place. Must be signed and larger than 8 bits */ | |
| 1243 | 1243 | static INT16 last_command = -1; |
| 1244 | 1244 | /* FIXME: Move to better place */ |
| 1245 | 1245 | static int nbr_expected_params = 17; |
| 1246 | ||
| 1246 | ||
| 1247 | 1247 | switch (offset) |
| 1248 | 1248 | { |
| 1249 | 1249 | case 0x00: /* Parameter into FIFO */ |
| r1461 | r1462 | |
| 1266 | 1266 | case 0x01: /* Command into FIFO */ |
| 1267 | 1267 | if (LOG_PORTS) |
| 1268 | 1268 | logerror("GDC Port %04X (CMD) Write %02X\n", offset, data); |
| 1269 | ||
| 1269 | ||
| 1270 | 1270 | if ( last_command >= 0 ) { |
| 1271 | 1271 | /* If there is a command in the fifo we can process that one now */ |
| 1272 | /* Later we should add a counter for the params too */ | |
| 1272 | /* Later we should add a counter for the params too */ | |
| 1273 | 1273 | gdc_command_processor(last_command & 0xff); |
| 1274 | 1274 | } |
| 1275 | ||
| 1275 | ||
| 1276 | 1276 | /* Check if it is a command without parameters, if so process it now */ |
| 1277 | 1277 | if ( gdc_nbr_expected_params(data) == 0 ) { |
| 1278 | 1278 | GDC_LOG_CMD_1("GDC: Command takes zero parameters\n"); |
| r1461 | r1462 | |
| 1282 | 1282 | /* Save the command */ |
| 1283 | 1283 | last_command = data; |
| 1284 | 1284 | nbr_expected_params = gdc_nbr_expected_params(data); |
| 1285 | } | |
| 1285 | } | |
| 1286 | 1286 | break; |
| 1287 | 1287 | |
| 1288 | 1288 | default: |
| r1461 | r1462 | |
| 1300 | 1300 | READ16_HANDLER (compis_gdc_r) |
| 1301 | 1301 | { |
| 1302 | 1302 | UINT16 data; |
| 1303 | ||
| 1303 | ||
| 1304 | 1304 | data = 0xff; |
| 1305 | ||
| 1305 | ||
| 1306 | 1306 | switch(offset & 0x07) { |
| 1307 | 1307 | case 0x00: /* Status register */ |
| 1308 | ||
| 1308 | ||
| 1309 | 1309 | GDC_LOG_CMD_3("%04X: GDC Port %04X (Status) Read", |
| 1310 | 1310 | activecpu_get_pc(), offset); |
| 1311 | 1311 | /* Optimize this later, i.e. when we know what to return */ |
| r1461 | r1462 | |
| 1319 | 1319 | break; |
| 1320 | 1320 | |
| 1321 | 1321 | case 0x01: /* FIFO Read */ |
| 1322 | ||
| 1322 | ||
| 1323 | 1323 | GDC_LOG_CMD_3("%04X: GDC Port %04X (Fifo) Read", |
| 1324 | 1324 | activecpu_get_pc(), |
| 1325 | 1325 | offset); |
| r1461 | r1462 | |
| 1443 | 1443 | /* TODO - copy only the dirty parts of the memory to the bitmap */ |
| 1444 | 1444 | /* Or plot stuff in write-functions until scrolling occurs */ |
| 1445 | 1445 | dirty = gdc_mess.dirty; |
| 1446 | if (dirty) | |
| 1446 | if (dirty) | |
| 1447 | 1447 | { |
| 1448 | 1448 | /* TYP_GDC_REGS_DISPLAY* dispregs = &gdc.registers.display; */ |
| 1449 | 1449 | UINT32 base_addr = gdc_get_base_addr(&gdc); |
| r1461 | r1462 | |
|---|---|---|
| 101 | 101 | 10 - sixteen colour graphics |
| 102 | 102 | 11 - sixteen colour characters */ |
| 103 | 103 | UINT8 unit_mode; |
| 104 | ||
| 104 | ||
| 105 | 105 | UINT8 current_data_1, current_data_2; |
| 106 | 106 | |
| 107 | 107 | UINT8 current_colour; |
| r1461 | r1462 | |
| 766 | 766 | break; |
| 767 | 767 | } |
| 768 | 768 | break; |
| 769 | } | |
| 769 | } | |
| 770 | 770 | current_scan_line += line_repeat_count*2+2; |
| 771 | 771 | LOG_DAI_VIDEO_LINE(display_mode, unit_mode, horizontal_resolution, line_repeat_count, current_scan_line); |
| 772 | 772 | } |
| r1461 | r1462 | |
|---|---|---|
| 86 | 86 | height = NC_SCREEN_HEIGHT; |
| 87 | 87 | width = NC_SCREEN_WIDTH; |
| 88 | 88 | pens[0] = machine->pens[2]; |
| 89 | pens[1] = machine->pens[3]; | |
| 89 | pens[1] = machine->pens[3]; | |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | |
| r1461 | r1462 | |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | x = px; |
| 116 | ||
| 116 | ||
| 117 | 117 | line_ptr = line_ptr+1; |
| 118 | 118 | } |
| 119 | 119 | } |
| r1461 | r1462 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | 3 | video/mac.c |
| 4 | ||
| 4 | ||
| 5 | 5 | Macintosh video hardware |
| 6 | 6 | |
| 7 | 7 | Emulates the video hardware for compact Macintosh series (original |
| r1461 | r1462 | |
|---|---|---|
| 5 | 5 | Video driver for the Intel 82720 and NEC uPD7220 GDC. |
| 6 | 6 | Per Ola Ingvarsson |
| 7 | 7 | Tomas Karlsson |
| 8 | ||
| 8 | ||
| 9 | 9 | ******************************************************************************/ |
| 10 | ||
| 10 | ||
| 11 | 11 | #include "driver.h" |
| 12 | 12 | |
| 13 | 13 | #define COMPIS_PALETTE_SIZE 16 |
| r1461 | r1462 | |
| 35 | 35 | */ |
| 36 | 36 | typedef enum |
| 37 | 37 | { |
| 38 | GDC_MODE_HRG, | |
| 38 | GDC_MODE_HRG, | |
| 39 | 39 | GDC_MODE_UHRG |
| 40 | 40 | } compis_gdc_modes; |
| 41 | 41 |
| r1461 | r1462 | |
|---|---|---|
| 28 | 28 | |
| 29 | 29 | |
| 30 | 30 | |
| 31 | ||
| 31 | ||
| 32 | 32 | GC 09h: Set 64k bank (bits 3-0 only) |
| 33 | 33 | GC 20h: Blit Width (bits 7-0) |
| 34 | 34 | GC 21h: Blit Width (bits 12-8) |
| r1461 | r1462 | |
|---|---|---|
| 4 | 4 | #include "includes/pocketc.h" |
| 5 | 5 | #include "includes/pc1350.h" |
| 6 | 6 | |
| 7 | static const POCKETC_FIGURE busy={ | |
| 7 | static const POCKETC_FIGURE busy={ | |
| 8 | 8 | "11 1 1 11 1 1", |
| 9 | 9 | "1 1 1 1 1 1 1", |
| 10 | 10 | "11 1 1 1 1 1", |
| 11 | 11 | "1 1 1 1 1 1", |
| 12 | 12 | "11 1 11 1e" |
| 13 | }, def={ | |
| 13 | }, def={ | |
| 14 | 14 | "11 111 111", |
| 15 | 15 | "1 1 1 1", |
| 16 | 16 | "1 1 111 11", |
| 17 | 17 | "1 1 1 1", |
| 18 | "11 111 1e" | |
| 18 | "11 111 1e" | |
| 19 | 19 | }, shift={ |
| 20 | 20 | " 11 1 1 1 111 111", |
| 21 | 21 | "1 1 1 1 1 1", |
| 22 | 22 | " 1 111 1 11 1", |
| 23 | 23 | " 1 1 1 1 1 1", |
| 24 | "11 1 1 1 1 1e" | |
| 24 | "11 1 1 1 1 1e" | |
| 25 | 25 | }, hyp={ |
| 26 | 26 | "1 1 1 1 11", |
| 27 | 27 | "1 1 1 1 1 1", |
| 28 | 28 | "111 1 1 11", |
| 29 | 29 | "1 1 1 1", |
| 30 | "1 1 1 1e" | |
| 30 | "1 1 1 1e" | |
| 31 | 31 | }, de={ |
| 32 | 32 | "11 111", |
| 33 | 33 | "1 1 1", |
| r1461 | r1462 | |
| 39 | 39 | "1", |
| 40 | 40 | "1 1", |
| 41 | 41 | "1 1", |
| 42 | " 11e" | |
| 42 | " 11e" | |
| 43 | 43 | }, rad={ |
| 44 | 44 | "11 1 11", |
| 45 | 45 | "1 1 1 1 1 1", |
| r1461 | r1462 | |
| 63 | 63 | "1", |
| 64 | 64 | "111", |
| 65 | 65 | "1", |
| 66 | "111e" | |
| 67 | }, run={ | |
| 66 | "111e" | |
| 67 | }, run={ | |
| 68 | 68 | "11 1 1 1 1", |
| 69 | 69 | "1 1 1 1 11 1", |
| 70 | 70 | "11 1 1 1 11", |
| 71 | 71 | "1 1 1 1 1 1", |
| 72 | "1 1 1 1 1e" | |
| 73 | }, pro={ | |
| 72 | "1 1 1 1 1e" | |
| 73 | }, pro={ | |
| 74 | 74 | "11 11 1 ", |
| 75 | 75 | "1 1 1 1 1 1", |
| 76 | 76 | "11 11 1 1", |
| 77 | 77 | "1 1 1 1 1", |
| 78 | "1 1 1 1e" | |
| 79 | }, japan={ | |
| 78 | "1 1 1 1e" | |
| 79 | }, japan={ | |
| 80 | 80 | " 1 1 11 1 1 1", |
| 81 | 81 | " 1 1 1 1 1 1 1 11 1", |
| 82 | 82 | " 1 111 11 111 1 11", |
| 83 | 83 | "1 1 1 1 1 1 1 1 1", |
| 84 | " 1 1 1 1 1 1 1 1e" | |
| 85 | }, sml={ | |
| 84 | " 1 1 1 1 1 1 1 1e" | |
| 85 | }, sml={ | |
| 86 | 86 | " 11 1 1 1", |
| 87 | 87 | "1 111 1", |
| 88 | 88 | " 1 1 1 1", |
| 89 | 89 | " 1 1 1 1", |
| 90 | "11 1 1 111e" | |
| 91 | }, rsv={ | |
| 90 | "11 1 1 111e" | |
| 91 | }, rsv={ | |
| 92 | 92 | "11 11 1 1", |
| 93 | 93 | "1 1 1 1 1", |
| 94 | 94 | "11 1 1 1", |
| 95 | 95 | "1 1 1 1 1", |
| 96 | "1 1 11 1e" | |
| 96 | "1 1 11 1e" | |
| 97 | 97 | }; |
| 98 | 98 | |
| 99 | 99 | static struct { |
| r1461 | r1462 | |
| 135 | 135 | { |
| 136 | 136 | int x, y, i, j, k, b; |
| 137 | 137 | int color[2]; |
| 138 | ||
| 138 | ||
| 139 | 139 | bitmap_fill(bitmap, cliprect, 5); |
| 140 | ||
| 140 | ||
| 141 | 141 | /* HJB: we cannot initialize array with values from other arrays, thus... */ |
| 142 | 142 | color[0] = machine->pens[pocketc_colortable[PC1350_CONTRAST][0]]; |
| 143 | 143 | color[1] = machine->pens[pocketc_colortable[PC1350_CONTRAST][1]]; |
| r1461 | r1462 | |
|---|---|---|
| 5 | 5 | driver by Nathan Woods |
| 6 | 6 | |
| 7 | 7 | See mess/machine/coco.c for references |
| 8 | ||
| 8 | ||
| 9 | 9 | TODO: Determine how the CoCo 2B (which used the M6847T1 was hooked up |
| 10 | 10 | to the M6847T1 chip to generate its text video modes. My best guess is as |
| 11 | 11 | follows: |
| r1461 | r1462 | |
| 70 | 70 | |
| 71 | 71 | memset(&cfg, 0, sizeof(cfg)); |
| 72 | 72 | cfg.type = type; |
| 73 | ||
| 73 | ||
| 74 | 74 | /* NPW 14-May-2006 - Ugly hack; using CPU timing factor seems to break some |
| 75 | 75 | * Dragon games */ |
| 76 | 76 | if (Machine->gamedrv->name[0] == 'c') |
| r1461 | r1462 | |
|---|---|---|
| 1070 | 1070 | }; |
| 1071 | 1071 | |
| 1072 | 1072 | static const UINT8 cgb_oam_fingerprint[0x100] = { |
| 1073 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 1074 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 1075 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 1076 | 1073 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 1077 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 1078 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 1079 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 1080 | 1074 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 1081 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 1082 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 1075 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 1076 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 1077 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 1078 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 1079 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 1080 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 1081 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 1082 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 1083 | 1083 | 0x74, 0xFF, 0x09, 0x00, 0x9D, 0x61, 0xA8, 0x28, 0x36, 0x1E, 0x58, 0xAA, 0x75, 0x74, 0xA1, 0x42, |
| 1084 | 1084 | 0x05, 0x96, 0x40, 0x09, 0x41, 0x02, 0x60, 0x00, 0x1F, 0x11, 0x22, 0xBC, 0x31, 0x52, 0x22, 0x54, |
| 1085 | 1085 | 0x22, 0xA9, 0xC4, 0x00, 0x1D, 0xAD, 0x80, 0x0C, 0x5D, 0xFA, 0x51, 0x92, 0x93, 0x98, 0xA4, 0x04, |
| r1461 | r1462 | |
| 1091 | 1091 | /* |
| 1092 | 1092 | For an AGS in CGB mode this data is: |
| 1093 | 1093 | static const UINT8 abs_oam_fingerprint[0x100] = { |
| 1094 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 1095 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 1096 | 1094 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 1097 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 1098 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 1099 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 1100 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 1101 | 1095 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 1102 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 1103 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 1096 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 1097 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 1098 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 1099 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 1100 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 1101 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 1102 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 1103 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 1104 | 1104 | 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, |
| 1105 | 1105 | 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, |
| 1106 | 1106 | 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, |
| r1461 | r1462 | |
| 1140 | 1140 | gb_vram = new_memory_region( Machine, REGION_GFX1, vram_size, 0 ); |
| 1141 | 1141 | gb_oam = new_memory_region( Machine, REGION_GFX2, 0x100, 0 ); |
| 1142 | 1142 | memset( gb_vram, 0, vram_size ); |
| 1143 | ||
| 1143 | ||
| 1144 | 1144 | gb_vram_ptr = gb_vram; |
| 1145 | 1145 | gb_chrgen = gb_vram; |
| 1146 | 1146 | gb_bgdtab = gb_vram + 0x1C00; |
| r1461 | r1462 | |
| 1356 | 1356 | /* Internally switch to mode 2 */ |
| 1357 | 1357 | gb_lcd.mode = 2; |
| 1358 | 1358 | /* Generate lcd interrupt if requested */ |
| 1359 | if ( ! gb_lcd.mode_irq && ( LCDSTAT & 0x20 ) && | |
| 1359 | if ( ! gb_lcd.mode_irq && ( LCDSTAT & 0x20 ) && | |
| 1360 | 1360 | ( ( ! gb_lcd.triggering_line_irq && ! gb_lcd.delayed_line_irq ) || ! ( LCDSTAT & 0x40 ) ) ) { |
| 1361 | 1361 | gb_lcd.mode_irq = 1; |
| 1362 | 1362 | cpunum_set_input_line( 0, LCD_INT, HOLD_LINE ); |
| r1461 | r1462 | |
|---|---|---|
| 3 | 3 | z88.c |
| 4 | 4 | |
| 5 | 5 | Functions to emulate the video hardware of the Acorn Z88 |
| 6 | ||
| 6 | ||
| 7 | 7 | ***************************************************************************/ |
| 8 | 8 | |
| 9 | 9 | #include "driver.h" |
| r1461 | r1462 | |
| 182 | 182 | if (byte1 & Z88_SCR_HW_REV) |
| 183 | 183 | { |
| 184 | 184 | pen1 = machine->pens[0]; |
| 185 | ||
| 185 | ||
| 186 | 186 | if (byte1 & Z88_SCR_HW_GRY) |
| 187 | 187 | { |
| 188 | 188 | pen0 = machine->pens[2]; |
| r1461 | r1462 | |
| 193 | 193 | } |
| 194 | 194 | } |
| 195 | 195 | else |
| 196 | { | |
| 196 | { | |
| 197 | 197 | pen0 = machine->pens[0]; |
| 198 | 198 | if (byte1 & Z88_SCR_HW_GRY) |
| 199 | 199 | { |
| r1461 | r1462 | |
| 273 | 273 | } |
| 274 | 274 | |
| 275 | 275 | stored_ptr+=256; |
| 276 | } | |
| 276 | } | |
| 277 | 277 | return 0; |
| 278 | 278 | } |
| r1461 | r1462 | |
|---|---|---|
| 22 | 22 | (oti 037 chip) |
| 23 | 23 | ROM_LOAD("oakvga.bin", 0xc0000, 0x8000, 0x318c5f43) |
| 24 | 24 | (tseng labs famous et4000 isa vga card (oem)) |
| 25 | ROM_LOAD("et4000b.bin", 0xc0000, 0x8000, 0xa903540d) | |
| 25 | ROM_LOAD("et4000b.bin", 0xc0000, 0x8000, 0xa903540d) | |
| 26 | 26 | (tseng labs famous et4000 isa vga card) |
| 27 | 27 | ROM_LOAD("et4000.bin", 0xc0000, 0x8000, 0xf01e4be0) |
| 28 | 28 | |
| r1461 | r1462 | |
| 643 | 643 | memory_install_write64_handler(0, ADDRESS_SPACE_PROGRAM, 0xa0000, 0xbffff, 0, 0, MWA64_BANK1 ); |
| 644 | 644 | } |
| 645 | 645 | break; |
| 646 | ||
| 646 | ||
| 647 | 647 | default: |
| 648 | 648 | fatalerror("VGA: Bus width %d not supported\n", buswidth); |
| 649 | 649 | break; |
| r1461 | r1462 | |
| 677 | 677 | if (diff%columns<vga.monitor.get_sync_columns()) data|=1; |
| 678 | 678 | } |
| 679 | 679 | #elif 1 |
| 680 | if (vga.monitor.retrace) | |
| 680 | if (vga.monitor.retrace) | |
| 681 | 681 | { |
| 682 | 682 | data |= 1; |
| 683 | 683 | if (attotime_compare(attotime_sub(timer_get_time(), vga.monitor.start_time), ATTOTIME_IN_USEC(300)) > 0) |
| r1461 | r1462 | |
| 685 | 685 | data |= 8; |
| 686 | 686 | vga.monitor.retrace=0; |
| 687 | 687 | } |
| 688 | } | |
| 689 | else | |
| 688 | } | |
| 689 | else | |
| 690 | 690 | { |
| 691 | 691 | if (attotime_compare(attotime_sub(timer_get_time(), vga.monitor.start_time), ATTOTIME_IN_MSEC(15)) > 0) |
| 692 | 692 | vga.monitor.retrace=1; |
| r1461 | r1462 | |
| 943 | 943 | { |
| 944 | 944 | vga.sequencer.data[vga.sequencer.index] = data; |
| 945 | 945 | vga_cpu_interface(); |
| 946 | ||
| 946 | ||
| 947 | 947 | if (vga.sequencer.index == 0) |
| 948 | 948 | vga.monitor.start_time = timer_get_time(); |
| 949 | 949 | } |
| r1461 | r1462 | |
| 1163 | 1163 | memory_install_write64_handler(0, vga.vga_intf.port_addressspace, vga.vga_intf.port_offset + 0x3c0, vga.vga_intf.port_offset + 0x3cf, 0, 0, vga_port64be_03c0_w ); |
| 1164 | 1164 | memory_install_write64_handler(0, vga.vga_intf.port_addressspace, vga.vga_intf.port_offset + 0x3d0, vga.vga_intf.port_offset + 0x3df, 0, 0, vga_port64be_03d0_w ); |
| 1165 | 1165 | break; |
| 1166 | } | |
| 1166 | } | |
| 1167 | 1167 | |
| 1168 | 1168 | pc_vga_reset(); |
| 1169 | 1169 | } |
| r1461 | r1462 | |
| 1320 | 1320 | { |
| 1321 | 1321 | int pos, line, column, c, addr, curr_addr; |
| 1322 | 1322 | UINT16 *bitmapline; |
| 1323 | ||
| 1323 | ||
| 1324 | 1324 | curr_addr = 0; |
| 1325 | 1325 | if(vga.sequencer.data[4] & 0x08) |
| 1326 | 1326 | { |
| r1461 | r1462 | |
|---|---|---|
| 102 | 102 | ROM_LOAD("oakvga.bin", 0xc0000, 0x8000, CRC(318c5f43)) |
| 103 | 103 | */ |
| 104 | 104 | #if 0 |
| 105 | int i; | |
| 105 | int i; | |
| 106 | 106 | UINT8 *memory=memory_region(REGION_CPU1)+0xc0000; |
| 107 | 107 | UINT8 chksum; |
| 108 | 108 |
| r1461 | r1462 | |
|---|---|---|
| 26 | 26 | ( ( (x & (1<<4)) >>4) <<1) | \ |
| 27 | 27 | ( ( (x & (1<<7)) >>7) <<0) \ |
| 28 | 28 | )<<5) |
| 29 | ||
| 29 | ||
| 30 | 30 | /* given a colour index in range 0..255 gives the Red component */ |
| 31 | 31 | #define NICK_GET_BLUE8(x) \ |
| 32 | 32 | (( \ |
| r1461 | r1462 | |
| 78 | 78 | #define NICK_2_COLOUR_MODE 0 |
| 79 | 79 | #define NICK_4_COLOUR_MODE 1 |
| 80 | 80 | #define NICK_16_COLOUR_MODE 2 |
| 81 | #define NICK_256_COLOUR_MODE 3 | |
| 81 | #define NICK_256_COLOUR_MODE 3 | |
| 82 | 82 | |
| 83 | 83 | /* Display mode types */ |
| 84 | 84 | #define NICK_VSYNC_MODE 0 |
| r1461 | r1462 | |
|---|---|---|
| 5 | 5 | |
| 6 | 6 | Per Ola Ingvarsson |
| 7 | 7 | Tomas Karlsson |
| 8 | ||
| 8 | ||
| 9 | 9 | ******************************************************************************/ |
| 10 | 10 | |
| 11 | 11 | enum I82720_GDC_COMMANDS |
| r1461 | r1462 | |
| 17 | 17 | CMD_VSYNC_SLAVE = 0x6e, /* Selects slave video synchronization mode */ |
| 18 | 18 | CMD_VSYNC_MASTER = 0x6f, /* Selects master video synchronization mode */ |
| 19 | 19 | CMD_CCHAR = 0x4b, /* Specifies the cursor and character row heights */ |
| 20 | ||
| 20 | ||
| 21 | 21 | /* Display control commands */ |
| 22 | 22 | CMD_START = 0x6b, /* Ends idle mode and unblanks the display */ |
| 23 | 23 | CMD_BCTRL_OFF = 0x0c, /* Controls the blanking and unblanking of the display */ |
| r1461 | r1462 | |
| 26 | 26 | CMD_CURS = 0x49, /* Sets the position of the cursor in display memory */ |
| 27 | 27 | CMD_PRAM_BITMASK = 0x70, /* Defines starting addresses and lengths of the display areas and specifies the eight bytes for the graphics character */ |
| 28 | 28 | CMD_PITCH = 0x47, /* Specifies the width of the X dimension of the display memory */ |
| 29 | ||
| 29 | ||
| 30 | 30 | /* Drawing control commands */ |
| 31 | 31 | CMD_WDAT_BITMASK = 0x20, /* Writes data words or bytes into display memory */ |
| 32 | 32 | CMD_MASK = 0x4a, /* Sets the MASK register contents */ |
| r1461 | r1462 | |
| 38 | 38 | CMD_RDAT_BITMASK = 0xa0, /* Reads data words or bytes from display */ |
| 39 | 39 | CMD_CURD = 0xe0, /* Reads the cursor position */ |
| 40 | 40 | CMD_LPRD = 0xc0, /* Reads the light pen address */ |
| 41 | ||
| 41 | ||
| 42 | 42 | /* Data control commands */ |
| 43 | 43 | CMD_DMAR_BITMASK = 0xa4, /* Requests a DMA read transfer */ |
| 44 | 44 | CMD_DMAW_BITMASK = 0x24 /* Requests a DMA write transfer */ |
| r1461 | r1462 | |
|---|---|---|
| 36 | 36 | { |
| 37 | 37 | v_via_pa_r, v_via_pb_r, /* read PA/B */ |
| 38 | 38 | 0, 0, 0, 0, /* read ca1, cb1, ca2, cb2 */ |
| 39 | v_via_pa_w, v_via_pb_w, /* write PA/B */ | |
| 39 | v_via_pa_w, v_via_pb_w, /* write PA/B */ | |
| 40 | 40 | 0, 0, v_via_ca2_w, v_via_cb2_w, /* write ca1, cb1, ca2, cb2 */ |
| 41 | 41 | v_via_irq, /* IRQ */ |
| 42 | 42 | }; |
| r1461 | r1462 | |
| 147 | 147 | lightpen_down=0; |
| 148 | 148 | color=0x00ffffff; |
| 149 | 149 | } |
| 150 | ||
| 150 | ||
| 151 | 151 | pen_x = readinputport(8)*(x_max/0xff); |
| 152 | 152 | pen_y = readinputport(7)*(y_max/0xff); |
| 153 | 153 | |
| r1461 | r1462 | |
| 157 | 157 | vector_add_point(pen_x-250000,pen_y+250000,color,0xff); |
| 158 | 158 | } |
| 159 | 159 | else |
| 160 | lightpen_down=0; | |
| 160 | lightpen_down=0; | |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | /********************************************************************* |
| r1461 | r1462 | |
| 311 | 311 | * off when the beam reaches the pen. Exact |
| 312 | 312 | * timing is important here. |
| 313 | 313 | * |
| 314 | * lightpen | |
| 314 | * lightpen | |
| 315 | 315 | * ^ |
| 316 | 316 | * _ /| |
| 317 | 317 | * b / | |
| r1461 | r1462 | |
| 418 | 418 | { |
| 419 | 419 | /* RAMP inactive */ |
| 420 | 420 | /* This generates a dot (here we take the dwell time into account) */ |
| 421 | ||
| 421 | ||
| 422 | 422 | if (data) |
| 423 | 423 | vectrex_dot(); |
| 424 | 424 | } |
| 425 | 425 | else |
| 426 | 426 | { |
| 427 | /* RAMP active | |
| 427 | /* RAMP active | |
| 428 | 428 | * Take MAX because RAMP is slower than BLANK |
| 429 | 429 | */ |
| 430 | 430 | time_now = MAX(attotime_to_double(timer_get_time()),start_time); |
| r1461 | r1462 | |
|---|---|---|
| 10 | 10 | |
| 11 | 11 | |
| 12 | 12 | AG AS INTEXT INV GM2 GM1 GM0 |
| 13 | -- -- ------ --- --- --- --- | |
| 13 | -- -- ------ --- --- --- --- | |
| 14 | 14 | 0 0 0 0 X X X Internal Alphanumerics |
| 15 | 15 | 0 0 0 1 X X X Internal Alphanumerics Inverted |
| 16 | 16 | 0 0 1 0 X X X External Alphanumerics |
| r1461 | r1462 | |
| 164 | 164 | |
| 165 | 165 | static const UINT8 pal_round_fontdata8x12[] = |
| 166 | 166 | { |
| 167 | 0x00, 0x00, 0x38, 0x44, 0x04, 0x34, 0x4C, 0x4C, 0x38, 0x00, 0x00, 0x00, | |
| 168 | 0x00, 0x00, 0x10, 0x28, 0x44, 0x44, 0x7C, 0x44, 0x44, 0x00, 0x00, 0x00, | |
| 169 | 0x00, 0x00, 0x78, 0x24, 0x24, 0x38, 0x24, 0x24, 0x78, 0x00, 0x00, 0x00, | |
| 170 | 0x00, 0x00, 0x38, 0x44, 0x40, 0x40, 0x40, 0x44, 0x38, 0x00, 0x00, 0x00, | |
| 171 | 0x00, 0x00, 0x78, 0x24, 0x24, 0x24, 0x24, 0x24, 0x78, 0x00, 0x00, 0x00, | |
| 172 | 0x00, 0x00, 0x7C, 0x40, 0x40, 0x70, 0x40, 0x40, 0x7C, 0x00, 0x00, 0x00, | |
| 173 | 0x00, 0x00, 0x7C, 0x40, 0x40, 0x70, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, | |
| 174 | 0x00, 0x00, 0x38, 0x44, 0x40, 0x40, 0x4C, 0x44, 0x38, 0x00, 0x00, 0x00, | |
| 175 | 0x00, 0x00, 0x44, 0x44, 0x44, 0x7C, 0x44, 0x44, 0x44, 0x00, 0x00, 0x00, | |
| 176 | 0x00, 0x00, 0x38, 0x10, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00, 0x00, | |
| 177 | 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x44, 0x38, 0x00, 0x00, 0x00, | |
| 178 | 0x00, 0x00, 0x44, 0x48, 0x50, 0x60, 0x50, 0x48, 0x44, 0x00, 0x00, 0x00, | |
| 179 | 0x00, 0x00, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x7C, 0x00, 0x00, 0x00, | |
| 180 | 0x00, 0x00, 0x44, 0x6C, 0x54, 0x54, 0x44, 0x44, 0x44, 0x00, 0x00, 0x00, | |
| 181 | 0x00, 0x00, 0x44, 0x44, 0x64, 0x54, 0x4C, 0x44, 0x44, 0x00, 0x00, 0x00, | |
| 182 | 0x00, 0x00, 0x38, 0x44, 0x44, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00, | |
| 183 | 0x00, 0x00, 0x78, 0x44, 0x44, 0x78, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, | |
| 184 | 0x00, 0x00, 0x38, 0x44, 0x44, 0x44, 0x54, 0x48, 0x34, 0x00, 0x00, 0x00, | |
| 185 | 0x00, 0x00, 0x78, 0x44, 0x44, 0x78, 0x50, 0x48, 0x44, 0x00, 0x00, 0x00, | |
| 186 | 0x00, 0x00, 0x38, 0x44, 0x40, 0x38, 0x04, 0x44, 0x38, 0x00, 0x00, 0x00, | |
| 187 | 0x00, 0x00, 0x7C, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, | |
| 188 | 0x00, 0x00, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00, | |
| 189 | 0x00, 0x00, 0x44, 0x44, 0x44, 0x28, 0x28, 0x10, 0x10, 0x00, 0x00, 0x00, | |
| 190 | 0x00, 0x00, 0x44, 0x44, 0x44, 0x44, 0x54, 0x6C, 0x44, 0x00, 0x00, 0x00, | |
| 191 | 0x00, 0x00, 0x44, 0x44, 0x28, 0x10, 0x28, 0x44, 0x44, 0x00, 0x00, 0x00, | |
| 192 | 0x00, 0x00, 0x44, 0x44, 0x28, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, | |
| 193 | 0x00, 0x00, 0x7C, 0x04, 0x08, 0x10, 0x20, 0x40, 0x7C, 0x00, 0x00, 0x00, | |
| 194 | 0x00, 0x00, 0x38, 0x20, 0x20, 0x20, 0x20, 0x20, 0x38, 0x00, 0x00, 0x00, | |
| 195 | 0x00, 0x00, 0x00, 0x40, 0x20, 0x10, 0x08, 0x04, 0x00, 0x00, 0x00, 0x00, | |
| 196 | 0x00, 0x00, 0x38, 0x08, 0x08, 0x08, 0x08, 0x08, 0x38, 0x00, 0x00, 0x00, | |
| 197 | 0x00, 0x00, 0x10, 0x38, 0x54, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, | |
| 198 | 0x00, 0x00, 0x00, 0x10, 0x20, 0x7C, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, | |
| 199 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 200 | 0x00, 0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x10, 0x00, 0x00, 0x00, | |
| 201 | 0x00, 0x00, 0x28, 0x28, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 202 | 0x00, 0x00, 0x28, 0x28, 0x7C, 0x28, 0x7C, 0x28, 0x28, 0x00, 0x00, 0x00, | |
| 203 | 0x00, 0x00, 0x10, 0x3C, 0x50, 0x38, 0x14, 0x78, 0x10, 0x00, 0x00, 0x00, | |
| 204 | 0x00, 0x00, 0x60, 0x64, 0x08, 0x10, 0x20, 0x4C, 0x0C, 0x00, 0x00, 0x00, | |
| 205 | 0x00, 0x00, 0x20, 0x50, 0x50, 0x20, 0x54, 0x48, 0x34, 0x00, 0x00, 0x00, | |
| 206 | 0x00, 0x00, 0x10, 0x10, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 207 | 0x00, 0x00, 0x08, 0x10, 0x20, 0x20, 0x20, 0x10, 0x08, 0x00, 0x00, 0x00, | |
| 208 | 0x00, 0x00, 0x20, 0x10, 0x08, 0x08, 0x08, 0x10, 0x20, 0x00, 0x00, 0x00, | |
| 209 | 0x00, 0x00, 0x00, 0x10, 0x54, 0x38, 0x38, 0x54, 0x10, 0x00, 0x00, 0x00, | |
| 210 | 0x00, 0x00, 0x00, 0x10, 0x10, 0x7C, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, | |
| 211 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, 0x40, 0x00, 0x00, | |
| 212 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 213 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, | |
| 214 | 0x00, 0x00, 0x00, 0x04, 0x08, 0x10, 0x20, 0x40, 0x00, 0x00, 0x00, 0x00, | |
| 215 | 0x00, 0x00, 0x38, 0x44, 0x4C, 0x54, 0x64, 0x44, 0x38, 0x00, 0x00, 0x00, | |
| 216 | 0x00, 0x00, 0x10, 0x30, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00, 0x00, | |
| 217 | 0x00, 0x00, 0x38, 0x44, 0x04, 0x38, 0x40, 0x40, 0x7C, 0x00, 0x00, 0x00, | |
| 218 | 0x00, 0x00, 0x38, 0x44, 0x04, 0x08, 0x04, 0x44, 0x38, 0x00, 0x00, 0x00, | |
| 219 | 0x00, 0x00, 0x08, 0x18, 0x28, 0x48, 0x7C, 0x08, 0x08, 0x00, 0x00, 0x00, | |
| 220 | 0x00, 0x00, 0x7C, 0x40, 0x78, 0x04, 0x04, 0x44, 0x38, 0x00, 0x00, 0x00, | |
| 221 | 0x00, 0x00, 0x38, 0x40, 0x40, 0x78, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00, | |
| 222 | 0x00, 0x00, 0x7C, 0x04, 0x08, 0x10, 0x20, 0x40, 0x40, 0x00, 0x00, 0x00, | |
| 223 | 0x00, 0x00, 0x38, 0x44, 0x44, 0x38, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00, | |
| 224 | 0x00, 0x00, 0x38, 0x44, 0x44, 0x3C, 0x04, 0x04, 0x38, 0x00, 0x00, 0x00, | |
| 225 | 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, | |
| 226 | 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x10, 0x10, 0x20, 0x00, 0x00, | |
| 227 | 0x00, 0x00, 0x08, 0x10, 0x20, 0x40, 0x20, 0x10, 0x08, 0x00, 0x00, 0x00, | |
| 228 | 0x00, 0x00, 0x00, 0x00, 0x7C, 0x00, 0x7C, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 229 | 0x00, 0x00, 0x20, 0x10, 0x08, 0x04, 0x08, 0x10, 0x20, 0x00, 0x00, 0x00, | |
| 230 | 0x00, 0x00, 0x38, 0x44, 0x04, 0x08, 0x10, 0x00, 0x10, 0x00, 0x00, 0x00, | |
| 167 | 0x00, 0x00, 0x38, 0x44, 0x04, 0x34, 0x4C, 0x4C, 0x38, 0x00, 0x00, 0x00, | |
| 168 | 0x00, 0x00, 0x10, 0x28, 0x44, 0x44, 0x7C, 0x44, 0x44, 0x00, 0x00, 0x00, | |
| 169 | 0x00, 0x00, 0x78, 0x24, 0x24, 0x38, 0x24, 0x24, 0x78, 0x00, 0x00, 0x00, | |
| 170 | 0x00, 0x00, 0x38, 0x44, 0x40, 0x40, 0x40, 0x44, 0x38, 0x00, 0x00, 0x00, | |
| 171 | 0x00, 0x00, 0x78, 0x24, 0x24, 0x24, 0x24, 0x24, 0x78, 0x00, 0x00, 0x00, | |
| 172 | 0x00, 0x00, 0x7C, 0x40, 0x40, 0x70, 0x40, 0x40, 0x7C, 0x00, 0x00, 0x00, | |
| 173 | 0x00, 0x00, 0x7C, 0x40, 0x40, 0x70, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, | |
| 174 | 0x00, 0x00, 0x38, 0x44, 0x40, 0x40, 0x4C, 0x44, 0x38, 0x00, 0x00, 0x00, | |
| 175 | 0x00, 0x00, 0x44, 0x44, 0x44, 0x7C, 0x44, 0x44, 0x44, 0x00, 0x00, 0x00, | |
| 176 | 0x00, 0x00, 0x38, 0x10, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00, 0x00, | |
| 177 | 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x44, 0x38, 0x00, 0x00, 0x00, | |
| 178 | 0x00, 0x00, 0x44, 0x48, 0x50, 0x60, 0x50, 0x48, 0x44, 0x00, 0x00, 0x00, | |
| 179 | 0x00, 0x00, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x7C, 0x00, 0x00, 0x00, | |
| 180 | 0x00, 0x00, 0x44, 0x6C, 0x54, 0x54, 0x44, 0x44, 0x44, 0x00, 0x00, 0x00, | |
| 181 | 0x00, 0x00, 0x44, 0x44, 0x64, 0x54, 0x4C, 0x44, 0x44, 0x00, 0x00, 0x00, | |
| 182 | 0x00, 0x00, 0x38, 0x44, 0x44, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00, | |
| 183 | 0x00, 0x00, 0x78, 0x44, 0x44, 0x78, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, | |
| 184 | 0x00, 0x00, 0x38, 0x44, 0x44, 0x44, 0x54, 0x48, 0x34, 0x00, 0x00, 0x00, | |
| 185 | 0x00, 0x00, 0x78, 0x44, 0x44, 0x78, 0x50, 0x48, 0x44, 0x00, 0x00, 0x00, | |
| 186 | 0x00, 0x00, 0x38, 0x44, 0x40, 0x38, 0x04, 0x44, 0x38, 0x00, 0x00, 0x00, | |
| 187 | 0x00, 0x00, 0x7C, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, | |
| 188 | 0x00, 0x00, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00, | |
| 189 | 0x00, 0x00, 0x44, 0x44, 0x44, 0x28, 0x28, 0x10, 0x10, 0x00, 0x00, 0x00, | |
| 190 | 0x00, 0x00, 0x44, 0x44, 0x44, 0x44, 0x54, 0x6C, 0x44, 0x00, 0x00, 0x00, | |
| 191 | 0x00, 0x00, 0x44, 0x44, 0x28, 0x10, 0x28, 0x44, 0x44, 0x00, 0x00, 0x00, | |
| 192 | 0x00, 0x00, 0x44, 0x44, 0x28, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, | |
| 193 | 0x00, 0x00, 0x7C, 0x04, 0x08, 0x10, 0x20, 0x40, 0x7C, 0x00, 0x00, 0x00, | |
| 194 | 0x00, 0x00, 0x38, 0x20, 0x20, 0x20, 0x20, 0x20, 0x38, 0x00, 0x00, 0x00, | |
| 195 | 0x00, 0x00, 0x00, 0x40, 0x20, 0x10, 0x08, 0x04, 0x00, 0x00, 0x00, 0x00, | |
| 196 | 0x00, 0x00, 0x38, 0x08, 0x08, 0x08, 0x08, 0x08, 0x38, 0x00, 0x00, 0x00, | |
| 197 | 0x00, 0x00, 0x10, 0x38, 0x54, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, | |
| 198 | 0x00, 0x00, 0x00, 0x10, 0x20, 0x7C, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, | |
| 199 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 200 | 0x00, 0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x10, 0x00, 0x00, 0x00, | |
| 201 | 0x00, 0x00, 0x28, 0x28, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 202 | 0x00, 0x00, 0x28, 0x28, 0x7C, 0x28, 0x7C, 0x28, 0x28, 0x00, 0x00, 0x00, | |
| 203 | 0x00, 0x00, 0x10, 0x3C, 0x50, 0x38, 0x14, 0x78, 0x10, 0x00, 0x00, 0x00, | |
| 204 | 0x00, 0x00, 0x60, 0x64, 0x08, 0x10, 0x20, 0x4C, 0x0C, 0x00, 0x00, 0x00, | |
| 205 | 0x00, 0x00, 0x20, 0x50, 0x50, 0x20, 0x54, 0x48, 0x34, 0x00, 0x00, 0x00, | |
| 206 | 0x00, 0x00, 0x10, 0x10, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 207 | 0x00, 0x00, 0x08, 0x10, 0x20, 0x20, 0x20, 0x10, 0x08, 0x00, 0x00, 0x00, | |
| 208 | 0x00, 0x00, 0x20, 0x10, 0x08, 0x08, 0x08, 0x10, 0x20, 0x00, 0x00, 0x00, | |
| 209 | 0x00, 0x00, 0x00, 0x10, 0x54, 0x38, 0x38, 0x54, 0x10, 0x00, 0x00, 0x00, | |
| 210 | 0x00, 0x00, 0x00, 0x10, 0x10, 0x7C, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, | |
| 211 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, 0x40, 0x00, 0x00, | |
| 212 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 213 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, | |
| 214 | 0x00, 0x00, 0x00, 0x04, 0x08, 0x10, 0x20, 0x40, 0x00, 0x00, 0x00, 0x00, | |
| 215 | 0x00, 0x00, 0x38, 0x44, 0x4C, 0x54, 0x64, 0x44, 0x38, 0x00, 0x00, 0x00, | |
| 216 | 0x00, 0x00, 0x10, 0x30, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00, 0x00, | |
| 217 | 0x00, 0x00, 0x38, 0x44, 0x04, 0x38, 0x40, 0x40, 0x7C, 0x00, 0x00, 0x00, | |
| 218 | 0x00, 0x00, 0x38, 0x44, 0x04, 0x08, 0x04, 0x44, 0x38, 0x00, 0x00, 0x00, | |
| 219 | 0x00, 0x00, 0x08, 0x18, 0x28, 0x48, 0x7C, 0x08, 0x08, 0x00, 0x00, 0x00, | |
| 220 | 0x00, 0x00, 0x7C, 0x40, 0x78, 0x04, 0x04, 0x44, 0x38, 0x00, 0x00, 0x00, | |
| 221 | 0x00, 0x00, 0x38, 0x40, 0x40, 0x78, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00, | |
| 222 | 0x00, 0x00, 0x7C, 0x04, 0x08, 0x10, 0x20, 0x40, 0x40, 0x00, 0x00, 0x00, | |
| 223 | 0x00, 0x00, 0x38, 0x44, 0x44, 0x38, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00, | |
| 224 | 0x00, 0x00, 0x38, 0x44, 0x44, 0x3C, 0x04, 0x04, 0x38, 0x00, 0x00, 0x00, | |
| 225 | 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, | |
| 226 | 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x10, 0x10, 0x20, 0x00, 0x00, | |
| 227 | 0x00, 0x00, 0x08, 0x10, 0x20, 0x40, 0x20, 0x10, 0x08, 0x00, 0x00, 0x00, | |
| 228 | 0x00, 0x00, 0x00, 0x00, 0x7C, 0x00, 0x7C, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 229 | 0x00, 0x00, 0x20, 0x10, 0x08, 0x04, 0x08, 0x10, 0x20, 0x00, 0x00, 0x00, | |
| 230 | 0x00, 0x00, 0x38, 0x44, 0x04, 0x08, 0x10, 0x00, 0x10, 0x00, 0x00, 0x00, | |
| 231 | 231 | |
| 232 | 232 | /* Lower case */ |
| 233 | 0x00, 0x00, 0x18, 0x24, 0x20, 0x70, 0x20, 0x24, 0x78, 0x00, 0x00, 0x00, | |
| 234 | 0x00, 0x00, 0x00, 0x00, 0x38, 0x04, 0x3C, 0x44, 0x3C, 0x00, 0x00, 0x00, | |
| 235 | 0x00, 0x00, 0x40, 0x40, 0x58, 0x64, 0x44, 0x64, 0x58, 0x00, 0x00, 0x00, | |
| 236 | 0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0x40, 0x44, 0x38, 0x00, 0x00, 0x00, | |
| 237 | 0x00, 0x00, 0x04, 0x04, 0x34, 0x4C, 0x44, 0x4C, 0x34, 0x00, 0x00, 0x00, | |
| 238 | 0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0x7C, 0x40, 0x38, 0x00, 0x00, 0x00, | |
| 239 | 0x00, 0x00, 0x08, 0x14, 0x10, 0x38, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, | |
| 240 | 0x00, 0x00, 0x00, 0x00, 0x34, 0x4C, 0x44, 0x4C, 0x34, 0x04, 0x38, 0x00, | |
| 241 | 0x00, 0x00, 0x40, 0x40, 0x58, 0x64, 0x44, 0x44, 0x44, 0x00, 0x00, 0x00, | |
| 242 | 0x00, 0x00, 0x10, 0x00, 0x30, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00, 0x00, | |
| 243 | 0x00, 0x00, 0x04, 0x00, 0x04, 0x04, 0x04, 0x04, 0x44, 0x38, 0x00, 0x00, | |
| 244 | 0x00, 0x00, 0x40, 0x40, 0x48, 0x50, 0x60, 0x50, 0x48, 0x00, 0x00, 0x00, | |
| 245 | 0x00, 0x00, 0x30, 0x10, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00, 0x00, | |
| 246 | 0x00, 0x00, 0x00, 0x00, 0x78, 0x54, 0x54, 0x54, 0x54, 0x00, 0x00, 0x00, | |
| 247 | 0x00, 0x00, 0x00, 0x00, 0x58, 0x64, 0x44, 0x44, 0x44, 0x00, 0x00, 0x00, | |
| 248 | 0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00, | |
| 249 | 0x00, 0x00, 0x00, 0x00, 0x78, 0x44, 0x44, 0x44, 0x78, 0x40, 0x40, 0x00, | |
| 250 | 0x00, 0x00, 0x00, 0x00, 0x3C, 0x44, 0x44, 0x44, 0x3C, 0x04, 0x04, 0x00, | |
| 251 | 0x00, 0x00, 0x00, 0x00, 0x58, 0x64, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, | |
| 252 | 0x00, 0x00, 0x00, 0x00, 0x3C, 0x40, 0x38, 0x04, 0x78, 0x00, 0x00, 0x00, | |
| 253 | 0x00, 0x00, 0x20, 0x20, 0x70, 0x20, 0x20, 0x24, 0x18, 0x00, 0x00, 0x00, | |
| 254 | 0x00, 0x00, 0x00, 0x00, 0x44, 0x44, 0x44, 0x4C, 0x34, 0x00, 0x00, 0x00, | |
| 255 | 0x00, 0x00, 0x00, 0x00, 0x44, 0x44, 0x44, 0x28, 0x10, 0x00, 0x00, 0x00, | |
| 256 | 0x00, 0x00, 0x00, 0x00, 0x44, 0x54, 0x54, 0x28, 0x28, 0x00, 0x00, 0x00, | |
| 257 | 0x00, 0x00, 0x00, 0x00, 0x44, 0x28, 0x10, 0x28, 0x44, 0x00, 0x00, 0x00, | |
| 258 | 0x00, 0x00, 0x00, 0x00, 0x44, 0x44, 0x44, 0x3C, 0x04, 0x38, 0x00, 0x00, | |
| 259 | 0x00, 0x00, 0x00, 0x00, 0x7C, 0x08, 0x10, 0x20, 0x7C, 0x00, 0x00, 0x00, | |
| 260 | 0x00, 0x00, 0x08, 0x10, 0x10, 0x20, 0x10, 0x10, 0x08, 0x00, 0x00, 0x00, | |
| 261 | 0x00, 0x00, 0x10, 0x10, 0x10, 0x00, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, | |
| 262 | 0x00, 0x00, 0x20, 0x10, 0x10, 0x08, 0x10, 0x10, 0x20, 0x00, 0x00, 0x00, | |
| 263 | 0x00, 0x00, 0x20, 0x54, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 264 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0x00, 0x00, 0x00, | |
| 233 | 0x00, 0x00, 0x18, 0x24, 0x20, 0x70, 0x20, 0x24, 0x78, 0x00, 0x00, 0x00, | |
| 234 | 0x00, 0x00, 0x00, 0x00, 0x38, 0x04, 0x3C, 0x44, 0x3C, 0x00, 0x00, 0x00, | |
| 235 | 0x00, 0x00, 0x40, 0x40, 0x58, 0x64, 0x44, 0x64, 0x58, 0x00, 0x00, 0x00, | |
| 236 | 0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0x40, 0x44, 0x38, 0x00, 0x00, 0x00, | |
| 237 | 0x00, 0x00, 0x04, 0x04, 0x34, 0x4C, 0x44, 0x4C, 0x34, 0x00, 0x00, 0x00, | |
| 238 | 0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0x7C, 0x40, 0x38, 0x00, 0x00, 0x00, | |
| 239 | 0x00, 0x00, 0x08, 0x14, 0x10, 0x38, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, | |
| 240 | 0x00, 0x00, 0x00, 0x00, 0x34, 0x4C, 0x44, 0x4C, 0x34, 0x04, 0x38, 0x00, | |
| 241 | 0x00, 0x00, 0x40, 0x40, 0x58, 0x64, 0x44, 0x44, 0x44, 0x00, 0x00, 0x00, | |
| 242 | 0x00, 0x00, 0x10, 0x00, 0x30, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00, 0x00, | |
| 243 | 0x00, 0x00, 0x04, 0x00, 0x04, 0x04, 0x04, 0x04, 0x44, 0x38, 0x00, 0x00, | |
| 244 | 0x00, 0x00, 0x40, 0x40, 0x48, 0x50, 0x60, 0x50, 0x48, 0x00, 0x00, 0x00, | |
| 245 | 0x00, 0x00, 0x30, 0x10, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00, 0x00, | |
| 246 | 0x00, 0x00, 0x00, 0x00, 0x78, 0x54, 0x54, 0x54, 0x54, 0x00, 0x00, 0x00, | |
| 247 | 0x00, 0x00, 0x00, 0x00, 0x58, 0x64, 0x44, 0x44, 0x44, 0x00, 0x00, 0x00, | |
| 248 | 0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00, | |
| 249 | 0x00, 0x00, 0x00, 0x00, 0x78, 0x44, 0x44, 0x44, 0x78, 0x40, 0x40, 0x00, | |
| 250 | 0x00, 0x00, 0x00, 0x00, 0x3C, 0x44, 0x44, 0x44, 0x3C, 0x04, 0x04, 0x00, | |
| 251 | 0x00, 0x00, 0x00, 0x00, 0x58, 0x64, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, | |
| 252 | 0x00, 0x00, 0x00, 0x00, 0x3C, 0x40, 0x38, 0x04, 0x78, 0x00, 0x00, 0x00, | |
| 253 | 0x00, 0x00, 0x20, 0x20, 0x70, 0x20, 0x20, 0x24, 0x18, 0x00, 0x00, 0x00, | |
| 254 | 0x00, 0x00, 0x00, 0x00, 0x44, 0x44, 0x44, 0x4C, 0x34, 0x00, 0x00, 0x00, | |
| 255 | 0x00, 0x00, 0x00, 0x00, 0x44, 0x44, 0x44, 0x28, 0x10, 0x00, 0x00, 0x00, | |
| 256 | 0x00, 0x00, 0x00, 0x00, 0x44, 0x54, 0x54, 0x28, 0x28, 0x00, 0x00, 0x00, | |
| 257 | 0x00, 0x00, 0x00, 0x00, 0x44, 0x28, 0x10, 0x28, 0x44, 0x00, 0x00, 0x00, | |
| 258 | 0x00, 0x00, 0x00, 0x00, 0x44, 0x44, 0x44, 0x3C, 0x04, 0x38, 0x00, 0x00, | |
| 259 | 0x00, 0x00, 0x00, 0x00, 0x7C, 0x08, 0x10, 0x20, 0x7C, 0x00, 0x00, 0x00, | |
| 260 | 0x00, 0x00, 0x08, 0x10, 0x10, 0x20, 0x10, 0x10, 0x08, 0x00, 0x00, 0x00, | |
| 261 | 0x00, 0x00, 0x10, 0x10, 0x10, 0x00, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, | |
| 262 | 0x00, 0x00, 0x20, 0x10, 0x10, 0x08, 0x10, 0x10, 0x20, 0x00, 0x00, 0x00, | |
| 263 | 0x00, 0x00, 0x20, 0x54, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 264 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0x00, 0x00, 0x00, | |
| 265 | 265 | |
| 266 | 266 | /* Semigraphics 6 */ |
| 267 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 268 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x0F, 0x0F, | |
| 269 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0xF0, 0xF0, | |
| 270 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 271 | 0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, | |
| 272 | 0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, | |
| 273 | 0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x0F, 0x0F, 0xF0, 0xF0, 0xF0, 0xF0, | |
| 274 | 0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x0F, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 275 | 0x00, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00, | |
| 276 | 0x00, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0xF0, 0xF0, 0x0F, 0x0F, 0x0F, 0x0F, | |
| 277 | 0x00, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, | |
| 278 | 0x00, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 279 | 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, | |
| 280 | 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x0F, 0x0F, 0x0F, | |
| 281 | 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0, | |
| 282 | 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 283 | 0x0F, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 284 | 0x0F, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x0F, 0x0F, | |
| 285 | 0x0F, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0xF0, 0xF0, | |
| 286 | 0x0F, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 287 | 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, | |
| 288 | 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, | |
| 289 | 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0xF0, 0xF0, 0xF0, 0xF0, | |
| 290 | 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 291 | 0x0F, 0x0F, 0x0F, 0x0F, 0xF0, 0xF0, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00, | |
| 292 | 0x0F, 0x0F, 0x0F, 0x0F, 0xF0, 0xF0, 0xF0, 0xF0, 0x0F, 0x0F, 0x0F, 0x0F, | |
| 293 | 0x0F, 0x0F, 0x0F, 0x0F, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, | |
| 294 | 0x0F, 0x0F, 0x0F, 0x0F, 0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 295 | 0x0F, 0x0F, 0x0F, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, | |
| 296 | 0x0F, 0x0F, 0x0F, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x0F, 0x0F, 0x0F, | |
| 297 | 0x0F, 0x0F, 0x0F, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0, | |
| 298 | 0x0F, 0x0F, 0x0F, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 299 | 0xF0, 0xF0, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 300 | 0xF0, 0xF0, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x0F, 0x0F, | |
| 301 | 0xF0, 0xF0, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0xF0, 0xF0, | |
| 302 | 0xF0, 0xF0, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 303 | 0xF0, 0xF0, 0xF0, 0xF0, 0x0F, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, | |
| 304 | 0xF0, 0xF0, 0xF0, 0xF0, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, | |
| 305 | 0xF0, 0xF0, 0xF0, 0xF0, 0x0F, 0x0F, 0x0F, 0x0F, 0xF0, 0xF0, 0xF0, 0xF0, | |
| 306 | 0xF0, 0xF0, 0xF0, 0xF0, 0x0F, 0x0F, 0x0F, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 307 | 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00, | |
| 308 | 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0x0F, 0x0F, 0x0F, 0x0F, | |
| 309 | 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, | |
| 310 | 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 311 | 0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, | |
| 312 | 0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x0F, 0x0F, 0x0F, | |
| 313 | 0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0, | |
| 314 | 0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 315 | 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 316 | 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x0F, 0x0F, | |
| 317 | 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0xF0, 0xF0, | |
| 318 | 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 319 | 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, | |
| 320 | 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, | |
| 321 | 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x0F, 0x0F, 0x0F, 0xF0, 0xF0, 0xF0, 0xF0, | |
| 322 | 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x0F, 0x0F, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 323 | 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00, | |
| 324 | 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0, 0x0F, 0x0F, 0x0F, 0x0F, | |
| 325 | 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, | |
| 326 | 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 327 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, | |
| 328 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x0F, 0x0F, 0x0F, | |
| 329 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0, | |
| 330 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 267 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 268 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x0F, 0x0F, | |
| 269 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0xF0, 0xF0, | |
| 270 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 271 | 0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, | |
| 272 | 0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, | |
| 273 | 0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x0F, 0x0F, 0xF0, 0xF0, 0xF0, 0xF0, | |
| 274 | 0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x0F, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 275 | 0x00, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00, | |
| 276 | 0x00, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0xF0, 0xF0, 0x0F, 0x0F, 0x0F, 0x0F, | |
| 277 | 0x00, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, | |
| 278 | 0x00, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 279 | 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, | |
| 280 | 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x0F, 0x0F, 0x0F, | |
| 281 | 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0, | |
| 282 | 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 283 | 0x0F, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 284 | 0x0F, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x0F, 0x0F, | |
| 285 | 0x0F, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0xF0, 0xF0, | |
| 286 | 0x0F, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 287 | 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, | |
| 288 | 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, | |
| 289 | 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0xF0, 0xF0, 0xF0, 0xF0, | |
| 290 | 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 291 | 0x0F, 0x0F, 0x0F, 0x0F, 0xF0, 0xF0, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00, | |
| 292 | 0x0F, 0x0F, 0x0F, 0x0F, 0xF0, 0xF0, 0xF0, 0xF0, 0x0F, 0x0F, 0x0F, 0x0F, | |
| 293 | 0x0F, 0x0F, 0x0F, 0x0F, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, | |
| 294 | 0x0F, 0x0F, 0x0F, 0x0F, 0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 295 | 0x0F, 0x0F, 0x0F, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, | |
| 296 | 0x0F, 0x0F, 0x0F, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x0F, 0x0F, 0x0F, | |
| 297 | 0x0F, 0x0F, 0x0F, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0, | |
| 298 | 0x0F, 0x0F, 0x0F, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 299 | 0xF0, 0xF0, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 300 | 0xF0, 0xF0, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x0F, 0x0F, | |
| 301 | 0xF0, 0xF0, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0xF0, 0xF0, | |
| 302 | 0xF0, 0xF0, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 303 | 0xF0, 0xF0, 0xF0, 0xF0, 0x0F, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, | |
| 304 | 0xF0, 0xF0, 0xF0, 0xF0, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, | |
| 305 | 0xF0, 0xF0, 0xF0, 0xF0, 0x0F, 0x0F, 0x0F, 0x0F, 0xF0, 0xF0, 0xF0, 0xF0, | |
| 306 | 0xF0, 0xF0, 0xF0, 0xF0, 0x0F, 0x0F, 0x0F, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 307 | 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00, | |
| 308 | 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0x0F, 0x0F, 0x0F, 0x0F, | |
| 309 | 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, | |
| 310 | 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 311 | 0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, | |
| 312 | 0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x0F, 0x0F, 0x0F, | |
| 313 | 0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0, | |
| 314 | 0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 315 | 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 316 | 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x0F, 0x0F, | |
| 317 | 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0xF0, 0xF0, | |
| 318 | 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 319 | 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, | |
| 320 | 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, | |
| 321 | 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x0F, 0x0F, 0x0F, 0xF0, 0xF0, 0xF0, 0xF0, | |
| 322 | 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x0F, 0x0F, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 323 | 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00, | |
| 324 | 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0, 0x0F, 0x0F, 0x0F, 0x0F, | |
| 325 | 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, | |
| 326 | 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 327 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, | |
| 328 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x0F, 0x0F, 0x0F, | |
| 329 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0, | |
| 330 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 331 | 331 | |
| 332 | 332 | /* Block Graphics (Semigraphics 4 Graphics ) */ |
| 333 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 334 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, | |
| 335 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, | |
| 336 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 337 | 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 338 | 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, | |
| 339 | 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, | |
| 340 | 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 341 | 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 342 | 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, | |
| 343 | 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, | |
| 344 | 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 345 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 346 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, | |
| 347 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, | |
| 348 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 333 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 334 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, | |
| 335 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, | |
| 336 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 337 | 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 338 | 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, | |
| 339 | 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, | |
| 340 | 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 341 | 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 342 | 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, | |
| 343 | 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, | |
| 344 | 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 345 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 346 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, | |
| 347 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, | |
| 348 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 349 | 349 | }; |
| 350 | 350 | |
| 351 | 351 | |
| 352 | 352 | |
| 353 | 353 | static const UINT8 pal_square_fontdata8x12[] = |
| 354 | 354 | { |
| 355 | 0x00, 0x00, 0x00, 0x1C, 0x22, 0x02, 0x1A, 0x2A, 0x2A, 0x1C, 0x00, 0x00, | |
| 356 | 0x00, 0x00, 0x00, 0x08, 0x14, 0x22, 0x22, 0x3E, 0x22, 0x22, 0x00, 0x00, | |
| 357 | 0x00, 0x00, 0x00, 0x3C, 0x12, 0x12, 0x1C, 0x12, 0x12, 0x3C, 0x00, 0x00, | |
| 358 | 0x00, 0x00, 0x00, 0x1C, 0x22, 0x20, 0x20, 0x20, 0x22, 0x1C, 0x00, 0x00, | |
| 359 | 0x00, 0x00, 0x00, 0x3C, 0x12, 0x12, 0x12, 0x12, 0x12, 0x3C, 0x00, 0x00, | |
| 360 | 0x00, 0x00, 0x00, 0x3E, 0x20, 0x20, 0x3C, 0x20, 0x20, 0x3E, 0x00, 0x00, | |
| 361 | 0x00, 0x00, 0x00, 0x3E, 0x20, 0x20, 0x3C, 0x20, 0x20, 0x20, 0x00, 0x00, | |
| 362 | 0x00, 0x00, 0x00, 0x1E, 0x20, 0x20, 0x26, 0x22, 0x22, 0x1E, 0x00, 0x00, | |
| 363 | 0x00, 0x00, 0x00, 0x22, 0x22, 0x22, 0x3E, 0x22, 0x22, 0x22, 0x00, 0x00, | |
| 364 | 0x00, 0x00, 0x00, 0x1C, 0x08, 0x08, 0x08, 0x08, 0x08, 0x1C, 0x00, 0x00, | |
| 365 | 0x00, 0x00, 0x00, 0x02, 0x02, 0x02, 0x02, 0x22, 0x22, 0x1C, 0x00, 0x00, | |
| 366 | 0x00, 0x00, 0x00, 0x22, 0x24, 0x28, 0x30, 0x28, 0x24, 0x22, 0x00, 0x00, | |
| 367 | 0x00, 0x00, 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x3E, 0x00, 0x00, | |
| 368 | 0x00, 0x00, 0x00, 0x22, 0x36, 0x2A, 0x2A, 0x22, 0x22, 0x22, 0x00, 0x00, | |
| 369 | 0x00, 0x00, 0x00, 0x22, 0x32, 0x2A, 0x26, 0x22, 0x22, 0x22, 0x00, 0x00, | |
| 370 | 0x00, 0x00, 0x00, 0x3E, 0x22, 0x22, 0x22, 0x22, 0x22, 0x3E, 0x00, 0x00, | |
| 371 | 0x00, 0x00, 0x00, 0x3C, 0x22, 0x22, 0x3C, 0x20, 0x20, 0x20, 0x00, 0x00, | |
| 372 | 0x00, 0x00, 0x00, 0x1C, 0x22, 0x22, 0x22, 0x2A, 0x24, 0x1A, 0x00, 0x00, | |
| 373 | 0x00, 0x00, 0x00, 0x3C, 0x22, 0x22, 0x3C, 0x28, 0x24, 0x22, 0x00, 0x00, | |
| 374 | 0x00, 0x00, 0x00, 0x1C, 0x22, 0x10, 0x08, 0x04, 0x22, 0x1C, 0x00, 0x00, | |
| 375 | 0x00, 0x00, 0x00, 0x3E, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, | |
| 376 | 0x00, 0x00, 0x00, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x1C, 0x00, 0x00, | |
| 377 | 0x00, 0x00, 0x00, 0x22, 0x22, 0x22, 0x14, 0x14, 0x08, 0x08, 0x00, 0x00, | |
| 378 | 0x00, 0x00, 0x00, 0x22, 0x22, 0x22, 0x2A, 0x2A, 0x36, 0x22, 0x00, 0x00, | |
| 379 | 0x00, 0x00, 0x00, 0x22, 0x22, 0x14, 0x08, 0x14, 0x22, 0x22, 0x00, 0x00, | |
| 380 | 0x00, 0x00, 0x00, 0x22, 0x22, 0x14, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, | |
| 381 | 0x00, 0x00, 0x00, 0x3E, 0x02, 0x04, 0x08, 0x10, 0x20, 0x3E, 0x00, 0x00, | |
| 382 | 0x00, 0x00, 0x00, 0x38, 0x20, 0x20, 0x20, 0x20, 0x20, 0x38, 0x00, 0x00, | |
| 383 | 0x00, 0x00, 0x00, 0x20, 0x20, 0x10, 0x08, 0x04, 0x02, 0x02, 0x00, 0x00, | |
| 384 | 0x00, 0x00, 0x00, 0x0E, 0x02, 0x02, 0x02, 0x02, 0x02, 0x0E, 0x00, 0x00, | |
| 385 | 0x00, 0x00, 0x00, 0x08, 0x1C, 0x2A, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, | |
| 386 | 0x00, 0x00, 0x00, 0x00, 0x08, 0x10, 0x3E, 0x10, 0x08, 0x00, 0x00, 0x00, | |
| 387 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 388 | 0x00, 0x00, 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x08, 0x00, 0x00, | |
| 389 | 0x00, 0x00, 0x00, 0x14, 0x14, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 390 | 0x00, 0x00, 0x00, 0x14, 0x14, 0x36, 0x00, 0x36, 0x14, 0x14, 0x00, 0x00, | |
| 391 | 0x00, 0x00, 0x00, 0x08, 0x1E, 0x20, 0x1C, 0x02, 0x3C, 0x08, 0x00, 0x00, | |
| 392 | 0x00, 0x00, 0x00, 0x32, 0x32, 0x04, 0x08, 0x10, 0x26, 0x26, 0x00, 0x00, | |
| 393 | 0x00, 0x00, 0x00, 0x10, 0x28, 0x28, 0x10, 0x2A, 0x24, 0x1A, 0x00, 0x00, | |
| 394 | 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 395 | 0x00, 0x00, 0x00, 0x08, 0x10, 0x20, 0x20, 0x20, 0x10, 0x08, 0x00, 0x00, | |
| 396 | 0x00, 0x00, 0x00, 0x08, 0x04, 0x02, 0x02, 0x02, 0x04, 0x08, 0x00, 0x00, | |
| 397 | 0x00, 0x00, 0x00, 0x00, 0x08, 0x1C, 0x3E, 0x1C, 0x08, 0x00, 0x00, 0x00, | |
| 398 | 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x3E, 0x08, 0x08, 0x00, 0x00, 0x00, | |
| 399 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x10, 0x20, 0x00, 0x00, | |
| 400 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 401 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, | |
| 402 | 0x00, 0x00, 0x00, 0x02, 0x02, 0x04, 0x08, 0x10, 0x20, 0x20, 0x00, 0x00, | |
| 403 | 0x00, 0x00, 0x00, 0x18, 0x24, 0x24, 0x24, 0x24, 0x24, 0x18, 0x00, 0x00, | |
| 404 | 0x00, 0x00, 0x00, 0x08, 0x18, 0x08, 0x08, 0x08, 0x08, 0x1C, 0x00, 0x00, | |
| 405 | 0x00, 0x00, 0x00, 0x1C, 0x22, 0x02, 0x1C, 0x20, 0x20, 0x3E, 0x00, 0x00, | |
| 406 | 0x00, 0x00, 0x00, 0x1C, 0x22, 0x02, 0x0C, 0x02, 0x22, 0x1C, 0x00, 0x00, | |
| 407 | 0x00, 0x00, 0x00, 0x04, 0x0C, 0x14, 0x3E, 0x04, 0x04, 0x04, 0x00, 0x00, | |
| 408 | 0x00, 0x00, 0x00, 0x3E, 0x20, 0x3C, 0x02, 0x02, 0x22, 0x1C, 0x00, 0x00, | |
| 409 | 0x00, 0x00, 0x00, 0x1C, 0x20, 0x20, 0x3C, 0x22, 0x22, 0x1C, 0x00, 0x00, | |
| 410 | 0x00, 0x00, 0x00, 0x3E, 0x02, 0x04, 0x08, 0x10, 0x20, 0x20, 0x00, 0x00, | |
| 411 | 0x00, 0x00, 0x00, 0x1C, 0x22, 0x22, 0x1C, 0x22, 0x22, 0x1C, 0x00, 0x00, | |
| 412 | 0x00, 0x00, 0x00, 0x1C, 0x22, 0x22, 0x1E, 0x02, 0x02, 0x1C, 0x00, 0x00, | |
| 413 | 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, | |
| 414 | 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x08, 0x10, 0x00, 0x00, | |
| 415 | 0x00, 0x00, 0x00, 0x04, 0x08, 0x10, 0x20, 0x10, 0x08, 0x04, 0x00, 0x00, | |
| 416 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x00, | |
| 417 | 0x00, 0x00, 0x00, 0x10, 0x08, 0x04, 0x02, 0x04, 0x08, 0x10, 0x00, 0x00, | |
| 418 | 0x00, 0x00, 0x00, 0x18, 0x24, 0x04, 0x08, 0x08, 0x00, 0x08, 0x00, 0x00, | |
| 355 | 0x00, 0x00, 0x00, 0x1C, 0x22, 0x02, 0x1A, 0x2A, 0x2A, 0x1C, 0x00, 0x00, | |
| 356 | 0x00, 0x00, 0x00, 0x08, 0x14, 0x22, 0x22, 0x3E, 0x22, 0x22, 0x00, 0x00, | |
| 357 | 0x00, 0x00, 0x00, 0x3C, 0x12, 0x12, 0x1C, 0x12, 0x12, 0x3C, 0x00, 0x00, | |
| 358 | 0x00, 0x00, 0x00, 0x1C, 0x22, 0x20, 0x20, 0x20, 0x22, 0x1C, 0x00, 0x00, | |
| 359 | 0x00, 0x00, 0x00, 0x3C, 0x12, 0x12, 0x12, 0x12, 0x12, 0x3C, 0x00, 0x00, | |
| 360 | 0x00, 0x00, 0x00, 0x3E, 0x20, 0x20, 0x3C, 0x20, 0x20, 0x3E, 0x00, 0x00, | |
| 361 | 0x00, 0x00, 0x00, 0x3E, 0x20, 0x20, 0x3C, 0x20, 0x20, 0x20, 0x00, 0x00, | |
| 362 | 0x00, 0x00, 0x00, 0x1E, 0x20, 0x20, 0x26, 0x22, 0x22, 0x1E, 0x00, 0x00, | |
| 363 | 0x00, 0x00, 0x00, 0x22, 0x22, 0x22, 0x3E, 0x22, 0x22, 0x22, 0x00, 0x00, | |
| 364 | 0x00, 0x00, 0x00, 0x1C, 0x08, 0x08, 0x08, 0x08, 0x08, 0x1C, 0x00, 0x00, | |
| 365 | 0x00, 0x00, 0x00, 0x02, 0x02, 0x02, 0x02, 0x22, 0x22, 0x1C, 0x00, 0x00, | |
| 366 | 0x00, 0x00, 0x00, 0x22, 0x24, 0x28, 0x30, 0x28, 0x24, 0x22, 0x00, 0x00, | |
| 367 | 0x00, 0x00, 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x3E, 0x00, 0x00, | |
| 368 | 0x00, 0x00, 0x00, 0x22, 0x36, 0x2A, 0x2A, 0x22, 0x22, 0x22, 0x00, 0x00, | |
| 369 | 0x00, 0x00, 0x00, 0x22, 0x32, 0x2A, 0x26, 0x22, 0x22, 0x22, 0x00, 0x00, | |
| 370 | 0x00, 0x00, 0x00, 0x3E, 0x22, 0x22, 0x22, 0x22, 0x22, 0x3E, 0x00, 0x00, | |
| 371 | 0x00, 0x00, 0x00, 0x3C, 0x22, 0x22, 0x3C, 0x20, 0x20, 0x20, 0x00, 0x00, | |
| 372 | 0x00, 0x00, 0x00, 0x1C, 0x22, 0x22, 0x22, 0x2A, 0x24, 0x1A, 0x00, 0x00, | |
| 373 | 0x00, 0x00, 0x00, 0x3C, 0x22, 0x22, 0x3C, 0x28, 0x24, 0x22, 0x00, 0x00, | |
| 374 | 0x00, 0x00, 0x00, 0x1C, 0x22, 0x10, 0x08, 0x04, 0x22, 0x1C, 0x00, 0x00, | |
| 375 | 0x00, 0x00, 0x00, 0x3E, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, | |
| 376 | 0x00, 0x00, 0x00, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x1C, 0x00, 0x00, | |
| 377 | 0x00, 0x00, 0x00, 0x22, 0x22, 0x22, 0x14, 0x14, 0x08, 0x08, 0x00, 0x00, | |
| 378 | 0x00, 0x00, 0x00, 0x22, 0x22, 0x22, 0x2A, 0x2A, 0x36, 0x22, 0x00, 0x00, | |
| 379 | 0x00, 0x00, 0x00, 0x22, 0x22, 0x14, 0x08, 0x14, 0x22, 0x22, 0x00, 0x00, | |
| 380 | 0x00, 0x00, 0x00, 0x22, 0x22, 0x14, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, | |
| 381 | 0x00, 0x00, 0x00, 0x3E, 0x02, 0x04, 0x08, 0x10, 0x20, 0x3E, 0x00, 0x00, | |
| 382 | 0x00, 0x00, 0x00, 0x38, 0x20, 0x20, 0x20, 0x20, 0x20, 0x38, 0x00, 0x00, | |
| 383 | 0x00, 0x00, 0x00, 0x20, 0x20, 0x10, 0x08, 0x04, 0x02, 0x02, 0x00, 0x00, | |
| 384 | 0x00, 0x00, 0x00, 0x0E, 0x02, 0x02, 0x02, 0x02, 0x02, 0x0E, 0x00, 0x00, | |
| 385 | 0x00, 0x00, 0x00, 0x08, 0x1C, 0x2A, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, | |
| 386 | 0x00, 0x00, 0x00, 0x00, 0x08, 0x10, 0x3E, 0x10, 0x08, 0x00, 0x00, 0x00, | |
| 387 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 388 | 0x00, 0x00, 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x08, 0x00, 0x00, | |
| 389 | 0x00, 0x00, 0x00, 0x14, 0x14, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 390 | 0x00, 0x00, 0x00, 0x14, 0x14, 0x36, 0x00, 0x36, 0x14, 0x14, 0x00, 0x00, | |
| 391 | 0x00, 0x00, 0x00, 0x08, 0x1E, 0x20, 0x1C, 0x02, 0x3C, 0x08, 0x00, 0x00, | |
| 392 | 0x00, 0x00, 0x00, 0x32, 0x32, 0x04, 0x08, 0x10, 0x26, 0x26, 0x00, 0x00, | |
| 393 | 0x00, 0x00, 0x00, 0x10, 0x28, 0x28, 0x10, 0x2A, 0x24, 0x1A, 0x00, 0x00, | |
| 394 | 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 395 | 0x00, 0x00, 0x00, 0x08, 0x10, 0x20, 0x20, 0x20, 0x10, 0x08, 0x00, 0x00, | |
| 396 | 0x00, 0x00, 0x00, 0x08, 0x04, 0x02, 0x02, 0x02, 0x04, 0x08, 0x00, 0x00, | |
| 397 | 0x00, 0x00, 0x00, 0x00, 0x08, 0x1C, 0x3E, 0x1C, 0x08, 0x00, 0x00, 0x00, | |
| 398 | 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x3E, 0x08, 0x08, 0x00, 0x00, 0x00, | |
| 399 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x10, 0x20, 0x00, 0x00, | |
| 400 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 401 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, | |
| 402 | 0x00, 0x00, 0x00, 0x02, 0x02, 0x04, 0x08, 0x10, 0x20, 0x20, 0x00, 0x00, | |
| 403 | 0x00, 0x00, 0x00, 0x18, 0x24, 0x24, 0x24, 0x24, 0x24, 0x18, 0x00, 0x00, | |
| 404 | 0x00, 0x00, 0x00, 0x08, 0x18, 0x08, 0x08, 0x08, 0x08, 0x1C, 0x00, 0x00, | |
| 405 | 0x00, 0x00, 0x00, 0x1C, 0x22, 0x02, 0x1C, 0x20, 0x20, 0x3E, 0x00, 0x00, | |
| 406 | 0x00, 0x00, 0x00, 0x1C, 0x22, 0x02, 0x0C, 0x02, 0x22, 0x1C, 0x00, 0x00, | |
| 407 | 0x00, 0x00, 0x00, 0x04, 0x0C, 0x14, 0x3E, 0x04, 0x04, 0x04, 0x00, 0x00, | |
| 408 | 0x00, 0x00, 0x00, 0x3E, 0x20, 0x3C, 0x02, 0x02, 0x22, 0x1C, 0x00, 0x00, | |
| 409 | 0x00, 0x00, 0x00, 0x1C, 0x20, 0x20, 0x3C, 0x22, 0x22, 0x1C, 0x00, 0x00, | |
| 410 | 0x00, 0x00, 0x00, 0x3E, 0x02, 0x04, 0x08, 0x10, 0x20, 0x20, 0x00, 0x00, | |
| 411 | 0x00, 0x00, 0x00, 0x1C, 0x22, 0x22, 0x1C, 0x22, 0x22, 0x1C, 0x00, 0x00, | |
| 412 | 0x00, 0x00, 0x00, 0x1C, 0x22, 0x22, 0x1E, 0x02, 0x02, 0x1C, 0x00, 0x00, | |
| 413 | 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, | |
| 414 | 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x08, 0x10, 0x00, 0x00, | |
| 415 | 0x00, 0x00, 0x00, 0x04, 0x08, 0x10, 0x20, 0x10, 0x08, 0x04, 0x00, 0x00, | |
| 416 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x00, | |
| 417 | 0x00, 0x00, 0x00, 0x10, 0x08, 0x04, 0x02, 0x04, 0x08, 0x10, 0x00, 0x00, | |
| 418 | 0x00, 0x00, 0x00, 0x18, 0x24, 0x04, 0x08, 0x08, 0x00, 0x08, 0x00, 0x00, | |
| 419 | 419 | |
| 420 | 420 | /* Lower case */ |
| 421 | 0x00, 0x00, 0x00, 0x0C, 0x12, 0x10, 0x38, 0x10, 0x12, 0x3C, 0x00, 0x00, | |
| 422 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x02, 0x1E, 0x22, 0x1E, 0x00, 0x00, | |
| 421 | 0x00, 0x00, 0x00, 0x0C, 0x12, 0x10, 0x38, 0x10, 0x12, 0x3C, 0x00, 0x00, | |
| 422 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x02, 0x1E, 0x22, 0x1E, 0x00, 0x00, | |
| 423 | 423 | 0x00, 0x00, 0x00, 0x20, 0x20, 0x3C, 0x22, 0x22, 0x22, 0x3C, 0x00, 0x00, |
| 424 | 424 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x20, 0x20, 0x20, 0x1C, 0x00, 0x00, |
| 425 | 425 | 0x00, 0x00, 0x00, 0x02, 0x02, 0x1E, 0x22, 0x22, 0x22, 0x1E, 0x00, 0x00, |
| r1461 | r1462 | |
| 540 | 540 | |
| 541 | 541 | static const UINT8 ntsc_round_fontdata8x12[] = |
| 542 | 542 | { |
| 543 | 0x00, 0x00, 0x38, 0x44, 0x04, 0x34, 0x4C, 0x4C, 0x38, 0x00, 0x00, 0x00, | |
| 544 | 0x00, 0x00, 0x10, 0x28, 0x44, 0x44, 0x7C, 0x44, 0x44, 0x00, 0x00, 0x00, | |
| 545 | 0x00, 0x00, 0x78, 0x24, 0x24, 0x38, 0x24, 0x24, 0x78, 0x00, 0x00, 0x00, | |
| 546 | 0x00, 0x00, 0x38, 0x44, 0x40, 0x40, 0x40, 0x44, 0x38, 0x00, 0x00, 0x00, | |
| 547 | 0x00, 0x00, 0x78, 0x24, 0x24, 0x24, 0x24, 0x24, 0x78, 0x00, 0x00, 0x00, | |
| 548 | 0x00, 0x00, 0x7C, 0x40, 0x40, 0x70, 0x40, 0x40, 0x7C, 0x00, 0x00, 0x00, | |
| 549 | 0x00, 0x00, 0x7C, 0x40, 0x40, 0x70, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, | |
| 550 | 0x00, 0x00, 0x38, 0x44, 0x40, 0x40, 0x4C, 0x44, 0x38, 0x00, 0x00, 0x00, | |
| 551 | 0x00, 0x00, 0x44, 0x44, 0x44, 0x7C, 0x44, 0x44, 0x44, 0x00, 0x00, 0x00, | |
| 552 | 0x00, 0x00, 0x38, 0x10, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00, 0x00, | |
| 553 | 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x44, 0x38, 0x00, 0x00, 0x00, | |
| 554 | 0x00, 0x00, 0x44, 0x48, 0x50, 0x60, 0x50, 0x48, 0x44, 0x00, 0x00, 0x00, | |
| 555 | 0x00, 0x00, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x7C, 0x00, 0x00, 0x00, | |
| 556 | 0x00, 0x00, 0x44, 0x6C, 0x54, 0x54, 0x44, 0x44, 0x44, 0x00, 0x00, 0x00, | |
| 557 | 0x00, 0x00, 0x44, 0x44, 0x64, 0x54, 0x4C, 0x44, 0x44, 0x00, 0x00, 0x00, | |
| 558 | 0x00, 0x00, 0x38, 0x44, 0x44, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00, | |
| 559 | 0x00, 0x00, 0x78, 0x44, 0x44, 0x78, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, | |
| 560 | 0x00, 0x00, 0x38, 0x44, 0x44, 0x44, 0x54, 0x48, 0x34, 0x00, 0x00, 0x00, | |
| 561 | 0x00, 0x00, 0x78, 0x44, 0x44, 0x78, 0x50, 0x48, 0x44, 0x00, 0x00, 0x00, | |
| 562 | 0x00, 0x00, 0x38, 0x44, 0x40, 0x38, 0x04, 0x44, 0x38, 0x00, 0x00, 0x00, | |
| 563 | 0x00, 0x00, 0x7C, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, | |
| 564 | 0x00, 0x00, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00, | |
| 565 | 0x00, 0x00, 0x44, 0x44, 0x44, 0x28, 0x28, 0x10, 0x10, 0x00, 0x00, 0x00, | |
| 566 | 0x00, 0x00, 0x44, 0x44, 0x44, 0x44, 0x54, 0x6C, 0x44, 0x00, 0x00, 0x00, | |
| 567 | 0x00, 0x00, 0x44, 0x44, 0x28, 0x10, 0x28, 0x44, 0x44, 0x00, 0x00, 0x00, | |
| 568 | 0x00, 0x00, 0x44, 0x44, 0x28, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, | |
| 569 | 0x00, 0x00, 0x7C, 0x04, 0x08, 0x10, 0x20, 0x40, 0x7C, 0x00, 0x00, 0x00, | |
| 570 | 0x00, 0x00, 0x38, 0x20, 0x20, 0x20, 0x20, 0x20, 0x38, 0x00, 0x00, 0x00, | |
| 571 | 0x00, 0x00, 0x00, 0x40, 0x20, 0x10, 0x08, 0x04, 0x00, 0x00, 0x00, 0x00, | |
| 572 | 0x00, 0x00, 0x38, 0x08, 0x08, 0x08, 0x08, 0x08, 0x38, 0x00, 0x00, 0x00, | |
| 573 | 0x00, 0x00, 0x10, 0x38, 0x54, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, | |
| 574 | 0x00, 0x00, 0x00, 0x10, 0x20, 0x7C, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, | |
| 575 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 576 | 0x00, 0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x10, 0x00, 0x00, 0x00, | |
| 577 | 0x00, 0x00, 0x28, 0x28, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 578 | 0x00, 0x00, 0x28, 0x28, 0x7C, 0x28, 0x7C, 0x28, 0x28, 0x00, 0x00, 0x00, | |
| 579 | 0x00, 0x00, 0x10, 0x3C, 0x50, 0x38, 0x14, 0x78, 0x10, 0x00, 0x00, 0x00, | |
| 580 | 0x00, 0x00, 0x60, 0x64, 0x08, 0x10, 0x20, 0x4C, 0x0C, 0x00, 0x00, 0x00, | |
| 581 | 0x00, 0x00, 0x20, 0x50, 0x50, 0x20, 0x54, 0x48, 0x34, 0x00, 0x00, 0x00, | |
| 582 | 0x00, 0x00, 0x10, 0x10, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 583 | 0x00, 0x00, 0x08, 0x10, 0x20, 0x20, 0x20, 0x10, 0x08, 0x00, 0x00, 0x00, | |
| 584 | 0x00, 0x00, 0x20, 0x10, 0x08, 0x08, 0x08, 0x10, 0x20, 0x00, 0x00, 0x00, | |
| 585 | 0x00, 0x00, 0x00, 0x10, 0x54, 0x38, 0x38, 0x54, 0x10, 0x00, 0x00, 0x00, | |
| 586 | 0x00, 0x00, 0x00, 0x10, 0x10, 0x7C, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, | |
| 587 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, 0x40, 0x00, 0x00, | |
| 588 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 589 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, | |
| 590 | 0x00, 0x00, 0x00, 0x04, 0x08, 0x10, 0x20, 0x40, 0x00, 0x00, 0x00, 0x00, | |
| 591 | 0x00, 0x00, 0x38, 0x44, 0x4C, 0x54, 0x64, 0x44, 0x38, 0x00, 0x00, 0x00, | |
| 592 | 0x00, 0x00, 0x10, 0x30, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00, 0x00, | |
| 593 | 0x00, 0x00, 0x38, 0x44, 0x04, 0x38, 0x40, 0x40, 0x7C, 0x00, 0x00, 0x00, | |
| 594 | 0x00, 0x00, 0x38, 0x44, 0x04, 0x08, 0x04, 0x44, 0x38, 0x00, 0x00, 0x00, | |
| 595 | 0x00, 0x00, 0x08, 0x18, 0x28, 0x48, 0x7C, 0x08, 0x08, 0x00, 0x00, 0x00, | |
| 596 | 0x00, 0x00, 0x7C, 0x40, 0x78, 0x04, 0x04, 0x44, 0x38, 0x00, 0x00, 0x00, | |
| 597 | 0x00, 0x00, 0x38, 0x40, 0x40, 0x78, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00, | |
| 598 | 0x00, 0x00, 0x7C, 0x04, 0x08, 0x10, 0x20, 0x40, 0x40, 0x00, 0x00, 0x00, | |
| 599 | 0x00, 0x00, 0x38, 0x44, 0x44, 0x38, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00, | |
| 600 | 0x00, 0x00, 0x38, 0x44, 0x44, 0x3C, 0x04, 0x04, 0x38, 0x00, 0x00, 0x00, | |
| 601 | 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, | |
| 602 | 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x10, 0x10, 0x20, 0x00, 0x00, | |
| 603 | 0x00, 0x00, 0x08, 0x10, 0x20, 0x40, 0x20, 0x10, 0x08, 0x00, 0x00, 0x00, | |
| 604 | 0x00, 0x00, 0x00, 0x00, 0x7C, 0x00, 0x7C, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 605 | 0x00, 0x00, 0x20, 0x10, 0x08, 0x04, 0x08, 0x10, 0x20, 0x00, 0x00, 0x00, | |
| 606 | 0x00, 0x00, 0x38, 0x44, 0x04, 0x08, 0x10, 0x00, 0x10, 0x00, 0x00, 0x00, | |
| 543 | 0x00, 0x00, 0x38, 0x44, 0x04, 0x34, 0x4C, 0x4C, 0x38, 0x00, 0x00, 0x00, | |
| 544 | 0x00, 0x00, 0x10, 0x28, 0x44, 0x44, 0x7C, 0x44, 0x44, 0x00, 0x00, 0x00, | |
| 545 | 0x00, 0x00, 0x78, 0x24, 0x24, 0x38, 0x24, 0x24, 0x78, 0x00, 0x00, 0x00, | |
| 546 | 0x00, 0x00, 0x38, 0x44, 0x40, 0x40, 0x40, 0x44, 0x38, 0x00, 0x00, 0x00, | |
| 547 | 0x00, 0x00, 0x78, 0x24, 0x24, 0x24, 0x24, 0x24, 0x78, 0x00, 0x00, 0x00, | |
| 548 | 0x00, 0x00, 0x7C, 0x40, 0x40, 0x70, 0x40, 0x40, 0x7C, 0x00, 0x00, 0x00, | |
| 549 | 0x00, 0x00, 0x7C, 0x40, 0x40, 0x70, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, | |
| 550 | 0x00, 0x00, 0x38, 0x44, 0x40, 0x40, 0x4C, 0x44, 0x38, 0x00, 0x00, 0x00, | |
| 551 | 0x00, 0x00, 0x44, 0x44, 0x44, 0x7C, 0x44, 0x44, 0x44, 0x00, 0x00, 0x00, | |
| 552 | 0x00, 0x00, 0x38, 0x10, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00, 0x00, | |
| 553 | 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x44, 0x38, 0x00, 0x00, 0x00, | |
| 554 | 0x00, 0x00, 0x44, 0x48, 0x50, 0x60, 0x50, 0x48, 0x44, 0x00, 0x00, 0x00, | |
| 555 | 0x00, 0x00, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x7C, 0x00, 0x00, 0x00, | |
| 556 | 0x00, 0x00, 0x44, 0x6C, 0x54, 0x54, 0x44, 0x44, 0x44, 0x00, 0x00, 0x00, | |
| 557 | 0x00, 0x00, 0x44, 0x44, 0x64, 0x54, 0x4C, 0x44, 0x44, 0x00, 0x00, 0x00, | |
| 558 | 0x00, 0x00, 0x38, 0x44, 0x44, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00, | |
| 559 | 0x00, 0x00, 0x78, 0x44, 0x44, 0x78, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, | |
| 560 | 0x00, 0x00, 0x38, 0x44, 0x44, 0x44, 0x54, 0x48, 0x34, 0x00, 0x00, 0x00, | |
| 561 | 0x00, 0x00, 0x78, 0x44, 0x44, 0x78, 0x50, 0x48, 0x44, 0x00, 0x00, 0x00, | |
| 562 | 0x00, 0x00, 0x38, 0x44, 0x40, 0x38, 0x04, 0x44, 0x38, 0x00, 0x00, 0x00, | |
| 563 | 0x00, 0x00, 0x7C, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, | |
| 564 | 0x00, 0x00, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00, | |
| 565 | 0x00, 0x00, 0x44, 0x44, 0x44, 0x28, 0x28, 0x10, 0x10, 0x00, 0x00, 0x00, | |
| 566 | 0x00, 0x00, 0x44, 0x44, 0x44, 0x44, 0x54, 0x6C, 0x44, 0x00, 0x00, 0x00, | |
| 567 | 0x00, 0x00, 0x44, 0x44, 0x28, 0x10, 0x28, 0x44, 0x44, 0x00, 0x00, 0x00, | |
| 568 | 0x00, 0x00, 0x44, 0x44, 0x28, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, | |
| 569 | 0x00, 0x00, 0x7C, 0x04, 0x08, 0x10, 0x20, 0x40, 0x7C, 0x00, 0x00, 0x00, | |
| 570 | 0x00, 0x00, 0x38, 0x20, 0x20, 0x20, 0x20, 0x20, 0x38, 0x00, 0x00, 0x00, | |
| 571 | 0x00, 0x00, 0x00, 0x40, 0x20, 0x10, 0x08, 0x04, 0x00, 0x00, 0x00, 0x00, | |
| 572 | 0x00, 0x00, 0x38, 0x08, 0x08, 0x08, 0x08, 0x08, 0x38, 0x00, 0x00, 0x00, | |
| 573 | 0x00, 0x00, 0x10, 0x38, 0x54, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, | |
| 574 | 0x00, 0x00, 0x00, 0x10, 0x20, 0x7C, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, | |
| 575 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 576 | 0x00, 0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x10, 0x00, 0x00, 0x00, | |
| 577 | 0x00, 0x00, 0x28, 0x28, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 578 | 0x00, 0x00, 0x28, 0x28, 0x7C, 0x28, 0x7C, 0x28, 0x28, 0x00, 0x00, 0x00, | |
| 579 | 0x00, 0x00, 0x10, 0x3C, 0x50, 0x38, 0x14, 0x78, 0x10, 0x00, 0x00, 0x00, | |
| 580 | 0x00, 0x00, 0x60, 0x64, 0x08, 0x10, 0x20, 0x4C, 0x0C, 0x00, 0x00, 0x00, | |
| 581 | 0x00, 0x00, 0x20, 0x50, 0x50, 0x20, 0x54, 0x48, 0x34, 0x00, 0x00, 0x00, | |
| 582 | 0x00, 0x00, 0x10, 0x10, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 583 | 0x00, 0x00, 0x08, 0x10, 0x20, 0x20, 0x20, 0x10, 0x08, 0x00, 0x00, 0x00, | |
| 584 | 0x00, 0x00, 0x20, 0x10, 0x08, 0x08, 0x08, 0x10, 0x20, 0x00, 0x00, 0x00, | |
| 585 | 0x00, 0x00, 0x00, 0x10, 0x54, 0x38, 0x38, 0x54, 0x10, 0x00, 0x00, 0x00, | |
| 586 | 0x00, 0x00, 0x00, 0x10, 0x10, 0x7C, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, | |
| 587 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, 0x40, 0x00, 0x00, | |
| 588 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 589 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, | |
| 590 | 0x00, 0x00, 0x00, 0x04, 0x08, 0x10, 0x20, 0x40, 0x00, 0x00, 0x00, 0x00, | |
| 591 | 0x00, 0x00, 0x38, 0x44, 0x4C, 0x54, 0x64, 0x44, 0x38, 0x00, 0x00, 0x00, | |
| 592 | 0x00, 0x00, 0x10, 0x30, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00, 0x00, | |
| 593 | 0x00, 0x00, 0x38, 0x44, 0x04, 0x38, 0x40, 0x40, 0x7C, 0x00, 0x00, 0x00, | |
| 594 | 0x00, 0x00, 0x38, 0x44, 0x04, 0x08, 0x04, 0x44, 0x38, 0x00, 0x00, 0x00, | |
| 595 | 0x00, 0x00, 0x08, 0x18, 0x28, 0x48, 0x7C, 0x08, 0x08, 0x00, 0x00, 0x00, | |
| 596 | 0x00, 0x00, 0x7C, 0x40, 0x78, 0x04, 0x04, 0x44, 0x38, 0x00, 0x00, 0x00, | |
| 597 | 0x00, 0x00, 0x38, 0x40, 0x40, 0x78, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00, | |
| 598 | 0x00, 0x00, 0x7C, 0x04, 0x08, 0x10, 0x20, 0x40, 0x40, 0x00, 0x00, 0x00, | |
| 599 | 0x00, 0x00, 0x38, 0x44, 0x44, 0x38, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00, | |
| 600 | 0x00, 0x00, 0x38, 0x44, 0x44, 0x3C, 0x04, 0x04, 0x38, 0x00, 0x00, 0x00, | |
| 601 | 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, | |
| 602 | 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x10, 0x10, 0x20, 0x00, 0x00, | |
| 603 | 0x00, 0x00, 0x08, 0x10, 0x20, 0x40, 0x20, 0x10, 0x08, 0x00, 0x00, 0x00, | |
| 604 | 0x00, 0x00, 0x00, 0x00, 0x7C, 0x00, 0x7C, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 605 | 0x00, 0x00, 0x20, 0x10, 0x08, 0x04, 0x08, 0x10, 0x20, 0x00, 0x00, 0x00, | |
| 606 | 0x00, 0x00, 0x38, 0x44, 0x04, 0x08, 0x10, 0x00, 0x10, 0x00, 0x00, 0x00, | |
| 607 | 607 | |
| 608 | 608 | /* Lower case */ |
| 609 | 0x00, 0x00, 0x10, 0x28, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 610 | 0x00, 0x00, 0x00, 0x00, 0x38, 0x04, 0x3C, 0x44, 0x3C, 0x00, 0x00, 0x00, | |
| 611 | 0x00, 0x00, 0x40, 0x40, 0x58, 0x64, 0x44, 0x64, 0x58, 0x00, 0x00, 0x00, | |
| 612 | 0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0x40, 0x44, 0x38, 0x00, 0x00, 0x00, | |
| 613 | 0x00, 0x00, 0x04, 0x04, 0x34, 0x4C, 0x44, 0x4C, 0x34, 0x00, 0x00, 0x00, | |
| 614 | 0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0x7C, 0x40, 0x38, 0x00, 0x00, 0x00, | |
| 615 | 0x00, 0x00, 0x08, 0x14, 0x10, 0x38, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, | |
| 616 | 0x00, 0x00, 0x00, 0x00, 0x34, 0x4C, 0x44, 0x4C, 0x34, 0x04, 0x38, 0x00, | |
| 617 | 0x00, 0x00, 0x40, 0x40, 0x58, 0x64, 0x44, 0x44, 0x44, 0x00, 0x00, 0x00, | |
| 618 | 0x00, 0x00, 0x10, 0x00, 0x30, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00, 0x00, | |
| 619 | 0x00, 0x00, 0x04, 0x00, 0x04, 0x04, 0x04, 0x04, 0x44, 0x38, 0x00, 0x00, | |
| 620 | 0x00, 0x00, 0x40, 0x40, 0x48, 0x50, 0x60, 0x50, 0x48, 0x00, 0x00, 0x00, | |
| 621 | 0x00, 0x00, 0x30, 0x10, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00, 0x00, | |
| 622 | 0x00, 0x00, 0x00, 0x00, 0x78, 0x54, 0x54, 0x54, 0x54, 0x00, 0x00, 0x00, | |
| 623 | 0x00, 0x00, 0x00, 0x00, 0x58, 0x64, 0x44, 0x44, 0x44, 0x00, 0x00, 0x00, | |
| 624 | 0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00, | |
| 625 | 0x00, 0x00, 0x00, 0x00, 0x78, 0x44, 0x44, 0x44, 0x78, 0x40, 0x40, 0x00, | |
| 626 | 0x00, 0x00, 0x00, 0x00, 0x3C, 0x44, 0x44, 0x44, 0x3C, 0x04, 0x04, 0x00, | |
| 627 | 0x00, 0x00, 0x00, 0x00, 0x58, 0x64, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, | |
| 628 | 0x00, 0x00, 0x00, 0x00, 0x3C, 0x40, 0x38, 0x04, 0x78, 0x00, 0x00, 0x00, | |
| 629 | 0x00, 0x00, 0x20, 0x20, 0x70, 0x20, 0x20, 0x24, 0x18, 0x00, 0x00, 0x00, | |
| 630 | 0x00, 0x00, 0x00, 0x00, 0x44, 0x44, 0x44, 0x4C, 0x34, 0x00, 0x00, 0x00, | |
| 631 | 0x00, 0x00, 0x00, 0x00, 0x44, 0x44, 0x44, 0x28, 0x10, 0x00, 0x00, 0x00, | |
| 632 | 0x00, 0x00, 0x00, 0x00, 0x44, 0x54, 0x54, 0x28, 0x28, 0x00, 0x00, 0x00, | |
| 633 | 0x00, 0x00, 0x00, 0x00, 0x44, 0x28, 0x10, 0x28, 0x44, 0x00, 0x00, 0x00, | |
| 634 | 0x00, 0x00, 0x00, 0x00, 0x44, 0x44, 0x44, 0x3C, 0x04, 0x38, 0x00, 0x00, | |
| 635 | 0x00, 0x00, 0x00, 0x00, 0x7C, 0x08, 0x10, 0x20, 0x7C, 0x00, 0x00, 0x00, | |
| 636 | 0x00, 0x00, 0x08, 0x10, 0x10, 0x20, 0x10, 0x10, 0x08, 0x00, 0x00, 0x00, | |
| 637 | 0x00, 0x00, 0x10, 0x10, 0x10, 0x00, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, | |
| 638 | 0x00, 0x00, 0x20, 0x10, 0x10, 0x08, 0x10, 0x10, 0x20, 0x00, 0x00, 0x00, | |
| 639 | 0x00, 0x00, 0x20, 0x54, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 640 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0x00, 0x00, 0x00, | |
| 609 | 0x00, 0x00, 0x10, 0x28, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 610 | 0x00, 0x00, 0x00, 0x00, 0x38, 0x04, 0x3C, 0x44, 0x3C, 0x00, 0x00, 0x00, | |
| 611 | 0x00, 0x00, 0x40, 0x40, 0x58, 0x64, 0x44, 0x64, 0x58, 0x00, 0x00, 0x00, | |
| 612 | 0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0x40, 0x44, 0x38, 0x00, 0x00, 0x00, | |
| 613 | 0x00, 0x00, 0x04, 0x04, 0x34, 0x4C, 0x44, 0x4C, 0x34, 0x00, 0x00, 0x00, | |
| 614 | 0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0x7C, 0x40, 0x38, 0x00, 0x00, 0x00, | |
| 615 | 0x00, 0x00, 0x08, 0x14, 0x10, 0x38, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, | |
| 616 | 0x00, 0x00, 0x00, 0x00, 0x34, 0x4C, 0x44, 0x4C, 0x34, 0x04, 0x38, 0x00, | |
| 617 | 0x00, 0x00, 0x40, 0x40, 0x58, 0x64, 0x44, 0x44, 0x44, 0x00, 0x00, 0x00, | |
| 618 | 0x00, 0x00, 0x10, 0x00, 0x30, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00, 0x00, | |
| 619 | 0x00, 0x00, 0x04, 0x00, 0x04, 0x04, 0x04, 0x04, 0x44, 0x38, 0x00, 0x00, | |
| 620 | 0x00, 0x00, 0x40, 0x40, 0x48, 0x50, 0x60, 0x50, 0x48, 0x00, 0x00, 0x00, | |
| 621 | 0x00, 0x00, 0x30, 0x10, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00, 0x00, | |
| 622 | 0x00, 0x00, 0x00, 0x00, 0x78, 0x54, 0x54, 0x54, 0x54, 0x00, 0x00, 0x00, | |
| 623 | 0x00, 0x00, 0x00, 0x00, 0x58, 0x64, 0x44, 0x44, 0x44, 0x00, 0x00, 0x00, | |
| 624 | 0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00, | |
| 625 | 0x00, 0x00, 0x00, 0x00, 0x78, 0x44, 0x44, 0x44, 0x78, 0x40, 0x40, 0x00, | |
| 626 | 0x00, 0x00, 0x00, 0x00, 0x3C, 0x44, 0x44, 0x44, 0x3C, 0x04, 0x04, 0x00, | |
| 627 | 0x00, 0x00, 0x00, 0x00, 0x58, 0x64, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, | |
| 628 | 0x00, 0x00, 0x00, 0x00, 0x3C, 0x40, 0x38, 0x04, 0x78, 0x00, 0x00, 0x00, | |
| 629 | 0x00, 0x00, 0x20, 0x20, 0x70, 0x20, 0x20, 0x24, 0x18, 0x00, 0x00, 0x00, | |
| 630 | 0x00, 0x00, 0x00, 0x00, 0x44, 0x44, 0x44, 0x4C, 0x34, 0x00, 0x00, 0x00, | |
| 631 | 0x00, 0x00, 0x00, 0x00, 0x44, 0x44, 0x44, 0x28, 0x10, 0x00, 0x00, 0x00, | |
| 632 | 0x00, 0x00, 0x00, 0x00, 0x44, 0x54, 0x54, 0x28, 0x28, 0x00, 0x00, 0x00, | |
| 633 | 0x00, 0x00, 0x00, 0x00, 0x44, 0x28, 0x10, 0x28, 0x44, 0x00, 0x00, 0x00, | |
| 634 | 0x00, 0x00, 0x00, 0x00, 0x44, 0x44, 0x44, 0x3C, 0x04, 0x38, 0x00, 0x00, | |
| 635 | 0x00, 0x00, 0x00, 0x00, 0x7C, 0x08, 0x10, 0x20, 0x7C, 0x00, 0x00, 0x00, | |
| 636 | 0x00, 0x00, 0x08, 0x10, 0x10, 0x20, 0x10, 0x10, 0x08, 0x00, 0x00, 0x00, | |
| 637 | 0x00, 0x00, 0x10, 0x10, 0x10, 0x00, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, | |
| 638 | 0x00, 0x00, 0x20, 0x10, 0x10, 0x08, 0x10, 0x10, 0x20, 0x00, 0x00, 0x00, | |
| 639 | 0x00, 0x00, 0x20, 0x54, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 640 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0x00, 0x00, 0x00, | |
| 641 | 641 | |
| 642 | 642 | /* Semigraphics 6 */ |
| 643 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 644 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x0F, 0x0F, | |
| 645 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0xF0, 0xF0, | |
| 646 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 647 | 0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, | |
| 648 | 0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, | |
| 649 | 0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x0F, 0x0F, 0xF0, 0xF0, 0xF0, 0xF0, | |
| 650 | 0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x0F, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 651 | 0x00, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00, | |
| 652 | 0x00, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0xF0, 0xF0, 0x0F, 0x0F, 0x0F, 0x0F, | |
| 653 | 0x00, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, | |
| 654 | 0x00, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 655 | 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, | |
| 656 | 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x0F, 0x0F, 0x0F, | |
| 657 | 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0, | |
| 658 | 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 659 | 0x0F, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 660 | 0x0F, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x0F, 0x0F, | |
| 661 | 0x0F, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0xF0, 0xF0, | |
| 662 | 0x0F, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 663 | 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, | |
| 664 | 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, | |
| 665 | 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0xF0, 0xF0, 0xF0, 0xF0, | |
| 666 | 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 667 | 0x0F, 0x0F, 0x0F, 0x0F, 0xF0, 0xF0, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00, | |
| 668 | 0x0F, 0x0F, 0x0F, 0x0F, 0xF0, 0xF0, 0xF0, 0xF0, 0x0F, 0x0F, 0x0F, 0x0F, | |
| 669 | 0x0F, 0x0F, 0x0F, 0x0F, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, | |
| 670 | 0x0F, 0x0F, 0x0F, 0x0F, 0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 671 | 0x0F, 0x0F, 0x0F, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, | |
| 672 | 0x0F, 0x0F, 0x0F, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x0F, 0x0F, 0x0F, | |
| 673 | 0x0F, 0x0F, 0x0F, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0, | |
| 674 | 0x0F, 0x0F, 0x0F, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 675 | 0xF0, 0xF0, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 676 | 0xF0, 0xF0, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x0F, 0x0F, | |
| 677 | 0xF0, 0xF0, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0xF0, 0xF0, | |
| 678 | 0xF0, 0xF0, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 679 | 0xF0, 0xF0, 0xF0, 0xF0, 0x0F, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, | |
| 680 | 0xF0, 0xF0, 0xF0, 0xF0, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, | |
| 681 | 0xF0, 0xF0, 0xF0, 0xF0, 0x0F, 0x0F, 0x0F, 0x0F, 0xF0, 0xF0, 0xF0, 0xF0, | |
| 682 | 0xF0, 0xF0, 0xF0, 0xF0, 0x0F, 0x0F, 0x0F, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 683 | 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00, | |
| 684 | 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0x0F, 0x0F, 0x0F, 0x0F, | |
| 685 | 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, | |
| 686 | 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 687 | 0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, | |
| 688 | 0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x0F, 0x0F, 0x0F, | |
| 689 | 0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0, | |
| 690 | 0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 691 | 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 692 | 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x0F, 0x0F, | |
| 693 | 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0xF0, 0xF0, | |
| 694 | 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 695 | 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, | |
| 696 | 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, | |
| 697 | 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x0F, 0x0F, 0x0F, 0xF0, 0xF0, 0xF0, 0xF0, | |
| 698 | 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x0F, 0x0F, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 699 | 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00, | |
| 700 | 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0, 0x0F, 0x0F, 0x0F, 0x0F, | |
| 701 | 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, | |
| 702 | 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 703 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, | |
| 704 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x0F, 0x0F, 0x0F, | |
| 705 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0, | |
| 706 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 643 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 644 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x0F, 0x0F, | |
| 645 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0xF0, 0xF0, | |
| 646 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 647 | 0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, | |
| 648 | 0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, | |
| 649 | 0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x0F, 0x0F, 0xF0, 0xF0, 0xF0, 0xF0, | |
| 650 | 0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x0F, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 651 | 0x00, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00, | |
| 652 | 0x00, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0xF0, 0xF0, 0x0F, 0x0F, 0x0F, 0x0F, | |
| 653 | 0x00, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, | |
| 654 | 0x00, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 655 | 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, | |
| 656 | 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x0F, 0x0F, 0x0F, | |
| 657 | 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0, | |
| 658 | 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 659 | 0x0F, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 660 | 0x0F, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x0F, 0x0F, | |
| 661 | 0x0F, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0xF0, 0xF0, | |
| 662 | 0x0F, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 663 | 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, | |
| 664 | 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, | |
| 665 | 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0xF0, 0xF0, 0xF0, 0xF0, | |
| 666 | 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 667 | 0x0F, 0x0F, 0x0F, 0x0F, 0xF0, 0xF0, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00, | |
| 668 | 0x0F, 0x0F, 0x0F, 0x0F, 0xF0, 0xF0, 0xF0, 0xF0, 0x0F, 0x0F, 0x0F, 0x0F, | |
| 669 | 0x0F, 0x0F, 0x0F, 0x0F, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, | |
| 670 | 0x0F, 0x0F, 0x0F, 0x0F, 0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 671 | 0x0F, 0x0F, 0x0F, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, | |
| 672 | 0x0F, 0x0F, 0x0F, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x0F, 0x0F, 0x0F, | |
| 673 | 0x0F, 0x0F, 0x0F, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0, | |
| 674 | 0x0F, 0x0F, 0x0F, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 675 | 0xF0, 0xF0, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 676 | 0xF0, 0xF0, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x0F, 0x0F, | |
| 677 | 0xF0, 0xF0, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0xF0, 0xF0, | |
| 678 | 0xF0, 0xF0, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 679 | 0xF0, 0xF0, 0xF0, 0xF0, 0x0F, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, | |
| 680 | 0xF0, 0xF0, 0xF0, 0xF0, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, | |
| 681 | 0xF0, 0xF0, 0xF0, 0xF0, 0x0F, 0x0F, 0x0F, 0x0F, 0xF0, 0xF0, 0xF0, 0xF0, | |
| 682 | 0xF0, 0xF0, 0xF0, 0xF0, 0x0F, 0x0F, 0x0F, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 683 | 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00, | |
| 684 | 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0x0F, 0x0F, 0x0F, 0x0F, | |
| 685 | 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, | |
| 686 | 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 687 | 0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, | |
| 688 | 0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x0F, 0x0F, 0x0F, | |
| 689 | 0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0, | |
| 690 | 0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 691 | 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 692 | 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x0F, 0x0F, | |
| 693 | 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0xF0, 0xF0, | |
| 694 | 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 695 | 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, | |
| 696 | 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, | |
| 697 | 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x0F, 0x0F, 0x0F, 0xF0, 0xF0, 0xF0, 0xF0, | |
| 698 | 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x0F, 0x0F, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 699 | 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00, | |
| 700 | 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0, 0x0F, 0x0F, 0x0F, 0x0F, | |
| 701 | 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, | |
| 702 | 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 703 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, | |
| 704 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x0F, 0x0F, 0x0F, | |
| 705 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0, | |
| 706 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 707 | 707 | |
| 708 | 708 | /* Block Graphics (Semigraphics 4 Graphics ) */ |
| 709 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 710 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, | |
| 711 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, | |
| 712 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 713 | 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 714 | 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, | |
| 715 | 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, | |
| 716 | 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 717 | 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 718 | 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, | |
| 719 | 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, | |
| 720 | 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 721 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 722 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, | |
| 723 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, | |
| 724 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 709 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 710 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, | |
| 711 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, | |
| 712 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 713 | 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 714 | 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, | |
| 715 | 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, | |
| 716 | 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 717 | 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 718 | 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, | |
| 719 | 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, | |
| 720 | 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 721 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 722 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, | |
| 723 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, | |
| 724 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 725 | 725 | }; |
| 726 | 726 | |
| 727 | 727 | |
| 728 | 728 | |
| 729 | 729 | static const UINT8 ntsc_square_fontdata8x12[] = |
| 730 | 730 | { |
| 731 | 0x00, 0x00, 0x00, 0x1C, 0x22, 0x02, 0x1A, 0x2A, 0x2A, 0x1C, 0x00, 0x00, | |
| 732 | 0x00, 0x00, 0x00, 0x08, 0x14, 0x22, 0x22, 0x3E, 0x22, 0x22, 0x00, 0x00, | |
| 733 | 0x00, 0x00, 0x00, 0x3C, 0x12, 0x12, 0x1C, 0x12, 0x12, 0x3C, 0x00, 0x00, | |
| 734 | 0x00, 0x00, 0x00, 0x1C, 0x22, 0x20, 0x20, 0x20, 0x22, 0x1C, 0x00, 0x00, | |
| 735 | 0x00, 0x00, 0x00, 0x3C, 0x12, 0x12, 0x12, 0x12, 0x12, 0x3C, 0x00, 0x00, | |
| 736 | 0x00, 0x00, 0x00, 0x3E, 0x20, 0x20, 0x38, 0x20, 0x20, 0x3E, 0x00, 0x00, | |
| 737 | 0x00, 0x00, 0x00, 0x3E, 0x20, 0x20, 0x38, 0x20, 0x20, 0x20, 0x00, 0x00, | |
| 738 | 0x00, 0x00, 0x00, 0x1E, 0x20, 0x20, 0x26, 0x22, 0x22, 0x1E, 0x00, 0x00, | |
| 739 | 0x00, 0x00, 0x00, 0x22, 0x22, 0x22, 0x3E, 0x22, 0x22, 0x22, 0x00, 0x00, | |
| 740 | 0x00, 0x00, 0x00, 0x1C, 0x08, 0x08, 0x08, 0x08, 0x08, 0x1C, 0x00, 0x00, | |
| 741 | 0x00, 0x00, 0x00, 0x02, 0x02, 0x02, 0x02, 0x22, 0x22, 0x1C, 0x00, 0x00, | |
| 742 | 0x00, 0x00, 0x00, 0x22, 0x24, 0x28, 0x30, 0x28, 0x24, 0x22, 0x00, 0x00, | |
| 743 | 0x00, 0x00, 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x3E, 0x00, 0x00, | |
| 744 | 0x00, 0x00, 0x00, 0x22, 0x36, 0x2A, 0x2A, 0x22, 0x22, 0x22, 0x00, 0x00, | |
| 745 | 0x00, 0x00, 0x00, 0x22, 0x32, 0x2A, 0x26, 0x22, 0x22, 0x22, 0x00, 0x00, | |
| 746 | 0x00, 0x00, 0x00, 0x3E, 0x22, 0x22, 0x22, 0x22, 0x22, 0x3E, 0x00, 0x00, | |
| 747 | 0x00, 0x00, 0x00, 0x3C, 0x22, 0x22, 0x3C, 0x20, 0x20, 0x20, 0x00, 0x00, | |
| 748 | 0x00, 0x00, 0x00, 0x1C, 0x22, 0x22, 0x22, 0x2A, 0x24, 0x1A, 0x00, 0x00, | |
| 749 | 0x00, 0x00, 0x00, 0x3C, 0x22, 0x22, 0x3C, 0x28, 0x24, 0x22, 0x00, 0x00, | |
| 750 | 0x00, 0x00, 0x00, 0x1C, 0x22, 0x10, 0x08, 0x04, 0x22, 0x1C, 0x00, 0x00, | |
| 751 | 0x00, 0x00, 0x00, 0x3E, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, | |
| 752 | 0x00, 0x00, 0x00, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x1C, 0x00, 0x00, | |
| 753 | 0x00, 0x00, 0x00, 0x22, 0x22, 0x22, 0x14, 0x14, 0x08, 0x08, 0x00, 0x00, | |
| 754 | 0x00, 0x00, 0x00, 0x22, 0x22, 0x22, 0x2A, 0x2A, 0x36, 0x22, 0x00, 0x00, | |
| 755 | 0x00, 0x00, 0x00, 0x22, 0x22, 0x14, 0x08, 0x14, 0x22, 0x22, 0x00, 0x00, | |
| 756 | 0x00, 0x00, 0x00, 0x22, 0x22, 0x14, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, | |
| 757 | 0x00, 0x00, 0x00, 0x3E, 0x02, 0x04, 0x08, 0x10, 0x20, 0x3E, 0x00, 0x00, | |
| 758 | 0x00, 0x00, 0x00, 0x38, 0x20, 0x20, 0x20, 0x20, 0x20, 0x38, 0x00, 0x00, | |
| 759 | 0x00, 0x00, 0x00, 0x20, 0x20, 0x10, 0x08, 0x04, 0x02, 0x02, 0x00, 0x00, | |
| 760 | 0x00, 0x00, 0x00, 0x0E, 0x02, 0x02, 0x02, 0x02, 0x02, 0x0E, 0x00, 0x00, | |
| 761 | 0x00, 0x00, 0x00, 0x08, 0x1C, 0x2A, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, | |
| 762 | 0x00, 0x00, 0x00, 0x00, 0x08, 0x10, 0x3E, 0x10, 0x08, 0x00, 0x00, 0x00, | |
| 763 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 764 | 0x00, 0x00, 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x08, 0x00, 0x00, | |
| 765 | 0x00, 0x00, 0x00, 0x14, 0x14, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 766 | 0x00, 0x00, 0x00, 0x14, 0x14, 0x36, 0x00, 0x36, 0x14, 0x14, 0x00, 0x00, | |
| 767 | 0x00, 0x00, 0x00, 0x08, 0x1E, 0x20, 0x1C, 0x02, 0x3C, 0x08, 0x00, 0x00, | |
| 768 | 0x00, 0x00, 0x00, 0x32, 0x32, 0x04, 0x08, 0x10, 0x26, 0x26, 0x00, 0x00, | |
| 769 | 0x00, 0x00, 0x00, 0x10, 0x28, 0x28, 0x10, 0x2A, 0x24, 0x1A, 0x00, 0x00, | |
| 770 | 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 771 | 0x00, 0x00, 0x00, 0x08, 0x10, 0x20, 0x20, 0x20, 0x10, 0x08, 0x00, 0x00, | |
| 772 | 0x00, 0x00, 0x00, 0x08, 0x04, 0x02, 0x02, 0x02, 0x04, 0x08, 0x00, 0x00, | |
| 773 | 0x00, 0x00, 0x00, 0x00, 0x08, 0x1C, 0x3E, 0x1C, 0x08, 0x00, 0x00, 0x00, | |
| 774 | 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x3E, 0x08, 0x08, 0x00, 0x00, 0x00, | |
| 775 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x10, 0x20, 0x00, 0x00, | |
| 776 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 777 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, | |
| 778 | 0x00, 0x00, 0x00, 0x02, 0x02, 0x04, 0x08, 0x10, 0x20, 0x20, 0x00, 0x00, | |
| 779 | 0x00, 0x00, 0x00, 0x18, 0x24, 0x24, 0x24, 0x24, 0x24, 0x18, 0x00, 0x00, | |
| 780 | 0x00, 0x00, 0x00, 0x08, 0x18, 0x08, 0x08, 0x08, 0x08, 0x1C, 0x00, 0x00, | |
| 781 | 0x00, 0x00, 0x00, 0x1C, 0x22, 0x02, 0x1C, 0x20, 0x20, 0x3E, 0x00, 0x00, | |
| 782 | 0x00, 0x00, 0x00, 0x1C, 0x22, 0x02, 0x04, 0x02, 0x22, 0x1C, 0x00, 0x00, | |
| 783 | 0x00, 0x00, 0x00, 0x04, 0x0C, 0x14, 0x3E, 0x04, 0x04, 0x04, 0x00, 0x00, | |
| 784 | 0x00, 0x00, 0x00, 0x3E, 0x20, 0x3C, 0x02, 0x02, 0x22, 0x1C, 0x00, 0x00, | |
| 785 | 0x00, 0x00, 0x00, 0x1C, 0x20, 0x20, 0x3C, 0x22, 0x22, 0x1C, 0x00, 0x00, | |
| 786 | 0x00, 0x00, 0x00, 0x3E, 0x02, 0x04, 0x08, 0x10, 0x20, 0x20, 0x00, 0x00, | |
| 787 | 0x00, 0x00, 0x00, 0x1C, 0x22, 0x22, 0x1C, 0x22, 0x22, 0x1C, 0x00, 0x00, | |
| 788 | 0x00, 0x00, 0x00, 0x1C, 0x22, 0x22, 0x1E, 0x02, 0x02, 0x1C, 0x00, 0x00, | |
| 789 | 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, | |
| 790 | 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x08, 0x10, 0x00, 0x00, | |
| 791 | 0x00, 0x00, 0x00, 0x04, 0x08, 0x10, 0x20, 0x10, 0x08, 0x04, 0x00, 0x00, | |
| 792 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x00, | |
| 793 | 0x00, 0x00, 0x00, 0x10, 0x08, 0x04, 0x02, 0x04, 0x08, 0x10, 0x00, 0x00, | |
| 794 | 0x00, 0x00, 0x00, 0x18, 0x24, 0x04, 0x08, 0x08, 0x00, 0x08, 0x00, 0x00, | |
| 731 | 0x00, 0x00, 0x00, 0x1C, 0x22, 0x02, 0x1A, 0x2A, 0x2A, 0x1C, 0x00, 0x00, | |
| 732 | 0x00, 0x00, 0x00, 0x08, 0x14, 0x22, 0x22, 0x3E, 0x22, 0x22, 0x00, 0x00, | |
| 733 | 0x00, 0x00, 0x00, 0x3C, 0x12, 0x12, 0x1C, 0x12, 0x12, 0x3C, 0x00, 0x00, | |
| 734 | 0x00, 0x00, 0x00, 0x1C, 0x22, 0x20, 0x20, 0x20, 0x22, 0x1C, 0x00, 0x00, | |
| 735 | 0x00, 0x00, 0x00, 0x3C, 0x12, 0x12, 0x12, 0x12, 0x12, 0x3C, 0x00, 0x00, | |
| 736 | 0x00, 0x00, 0x00, 0x3E, 0x20, 0x20, 0x38, 0x20, 0x20, 0x3E, 0x00, 0x00, | |
| 737 | 0x00, 0x00, 0x00, 0x3E, 0x20, 0x20, 0x38, 0x20, 0x20, 0x20, 0x00, 0x00, | |
| 738 | 0x00, 0x00, 0x00, 0x1E, 0x20, 0x20, 0x26, 0x22, 0x22, 0x1E, 0x00, 0x00, | |
| 739 | 0x00, 0x00, 0x00, 0x22, 0x22, 0x22, 0x3E, 0x22, 0x22, 0x22, 0x00, 0x00, | |
| 740 | 0x00, 0x00, 0x00, 0x1C, 0x08, 0x08, 0x08, 0x08, 0x08, 0x1C, 0x00, 0x00, | |
| 741 | 0x00, 0x00, 0x00, 0x02, 0x02, 0x02, 0x02, 0x22, 0x22, 0x1C, 0x00, 0x00, | |
| 742 | 0x00, 0x00, 0x00, 0x22, 0x24, 0x28, 0x30, 0x28, 0x24, 0x22, 0x00, 0x00, | |
| 743 | 0x00, 0x00, 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x3E, 0x00, 0x00, | |
| 744 | 0x00, 0x00, 0x00, 0x22, 0x36, 0x2A, 0x2A, 0x22, 0x22, 0x22, 0x00, 0x00, | |
| 745 | 0x00, 0x00, 0x00, 0x22, 0x32, 0x2A, 0x26, 0x22, 0x22, 0x22, 0x00, 0x00, | |
| 746 | 0x00, 0x00, 0x00, 0x3E, 0x22, 0x22, 0x22, 0x22, 0x22, 0x3E, 0x00, 0x00, | |
| 747 | 0x00, 0x00, 0x00, 0x3C, 0x22, 0x22, 0x3C, 0x20, 0x20, 0x20, 0x00, 0x00, | |
| 748 | 0x00, 0x00, 0x00, 0x1C, 0x22, 0x22, 0x22, 0x2A, 0x24, 0x1A, 0x00, 0x00, | |
| 749 | 0x00, 0x00, 0x00, 0x3C, 0x22, 0x22, 0x3C, 0x28, 0x24, 0x22, 0x00, 0x00, | |
| 750 | 0x00, 0x00, 0x00, 0x1C, 0x22, 0x10, 0x08, 0x04, 0x22, 0x1C, 0x00, 0x00, | |
| 751 | 0x00, 0x00, 0x00, 0x3E, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, | |
| 752 | 0x00, 0x00, 0x00, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x1C, 0x00, 0x00, | |
| 753 | 0x00, 0x00, 0x00, 0x22, 0x22, 0x22, 0x14, 0x14, 0x08, 0x08, 0x00, 0x00, | |
| 754 | 0x00, 0x00, 0x00, 0x22, 0x22, 0x22, 0x2A, 0x2A, 0x36, 0x22, 0x00, 0x00, | |
| 755 | 0x00, 0x00, 0x00, 0x22, 0x22, 0x14, 0x08, 0x14, 0x22, 0x22, 0x00, 0x00, | |
| 756 | 0x00, 0x00, 0x00, 0x22, 0x22, 0x14, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, | |
| 757 | 0x00, 0x00, 0x00, 0x3E, 0x02, 0x04, 0x08, 0x10, 0x20, 0x3E, 0x00, 0x00, | |
| 758 | 0x00, 0x00, 0x00, 0x38, 0x20, 0x20, 0x20, 0x20, 0x20, 0x38, 0x00, 0x00, | |
| 759 | 0x00, 0x00, 0x00, 0x20, 0x20, 0x10, 0x08, 0x04, 0x02, 0x02, 0x00, 0x00, | |
| 760 | 0x00, 0x00, 0x00, 0x0E, 0x02, 0x02, 0x02, 0x02, 0x02, 0x0E, 0x00, 0x00, | |
| 761 | 0x00, 0x00, 0x00, 0x08, 0x1C, 0x2A, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, | |
| 762 | 0x00, 0x00, 0x00, 0x00, 0x08, 0x10, 0x3E, 0x10, 0x08, 0x00, 0x00, 0x00, | |
| 763 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 764 | 0x00, 0x00, 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x08, 0x00, 0x00, | |
| 765 | 0x00, 0x00, 0x00, 0x14, 0x14, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 766 | 0x00, 0x00, 0x00, 0x14, 0x14, 0x36, 0x00, 0x36, 0x14, 0x14, 0x00, 0x00, | |
| 767 | 0x00, 0x00, 0x00, 0x08, 0x1E, 0x20, 0x1C, 0x02, 0x3C, 0x08, 0x00, 0x00, | |
| 768 | 0x00, 0x00, 0x00, 0x32, 0x32, 0x04, 0x08, 0x10, 0x26, 0x26, 0x00, 0x00, | |
| 769 | 0x00, 0x00, 0x00, 0x10, 0x28, 0x28, 0x10, 0x2A, 0x24, 0x1A, 0x00, 0x00, | |
| 770 | 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 771 | 0x00, 0x00, 0x00, 0x08, 0x10, 0x20, 0x20, 0x20, 0x10, 0x08, 0x00, 0x00, | |
| 772 | 0x00, 0x00, 0x00, 0x08, 0x04, 0x02, 0x02, 0x02, 0x04, 0x08, 0x00, 0x00, | |
| 773 | 0x00, 0x00, 0x00, 0x00, 0x08, 0x1C, 0x3E, 0x1C, 0x08, 0x00, 0x00, 0x00, | |
| 774 | 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x3E, 0x08, 0x08, 0x00, 0x00, 0x00, | |
| 775 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x10, 0x20, 0x00, 0x00, | |
| 776 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 777 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, | |
| 778 | 0x00, 0x00, 0x00, 0x02, 0x02, 0x04, 0x08, 0x10, 0x20, 0x20, 0x00, 0x00, | |
| 779 | 0x00, 0x00, 0x00, 0x18, 0x24, 0x24, 0x24, 0x24, 0x24, 0x18, 0x00, 0x00, | |
| 780 | 0x00, 0x00, 0x00, 0x08, 0x18, 0x08, 0x08, 0x08, 0x08, 0x1C, 0x00, 0x00, | |
| 781 | 0x00, 0x00, 0x00, 0x1C, 0x22, 0x02, 0x1C, 0x20, 0x20, 0x3E, 0x00, 0x00, | |
| 782 | 0x00, 0x00, 0x00, 0x1C, 0x22, 0x02, 0x04, 0x02, 0x22, 0x1C, 0x00, 0x00, | |
| 783 | 0x00, 0x00, 0x00, 0x04, 0x0C, 0x14, 0x3E, 0x04, 0x04, 0x04, 0x00, 0x00, | |
| 784 | 0x00, 0x00, 0x00, 0x3E, 0x20, 0x3C, 0x02, 0x02, 0x22, 0x1C, 0x00, 0x00, | |
| 785 | 0x00, 0x00, 0x00, 0x1C, 0x20, 0x20, 0x3C, 0x22, 0x22, 0x1C, 0x00, 0x00, | |
| 786 | 0x00, 0x00, 0x00, 0x3E, 0x02, 0x04, 0x08, 0x10, 0x20, 0x20, 0x00, 0x00, | |
| 787 | 0x00, 0x00, 0x00, 0x1C, 0x22, 0x22, 0x1C, 0x22, 0x22, 0x1C, 0x00, 0x00, | |
| 788 | 0x00, 0x00, 0x00, 0x1C, 0x22, 0x22, 0x1E, 0x02, 0x02, 0x1C, 0x00, 0x00, | |
| 789 | 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, | |
| 790 | 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x08, 0x10, 0x00, 0x00, | |
| 791 | 0x00, 0x00, 0x00, 0x04, 0x08, 0x10, 0x20, 0x10, 0x08, 0x04, 0x00, 0x00, | |
| 792 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x00, | |
| 793 | 0x00, 0x00, 0x00, 0x10, 0x08, 0x04, 0x02, 0x04, 0x08, 0x10, 0x00, 0x00, | |
| 794 | 0x00, 0x00, 0x00, 0x18, 0x24, 0x04, 0x08, 0x08, 0x00, 0x08, 0x00, 0x00, | |
| 795 | 795 | |
| 796 | 796 | /* Lower case */ |
| 797 | 0x00, 0x00, 0x00, 0x0C, 0x12, 0x10, 0x38, 0x10, 0x12, 0x3C, 0x00, 0x00, | |
| 798 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x02, 0x1E, 0x22, 0x1E, 0x00, 0x00, | |
| 797 | 0x00, 0x00, 0x00, 0x0C, 0x12, 0x10, 0x38, 0x10, 0x12, 0x3C, 0x00, 0x00, | |
| 798 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x02, 0x1E, 0x22, 0x1E, 0x00, 0x00, | |
| 799 | 799 | 0x00, 0x00, 0x00, 0x20, 0x20, 0x3C, 0x22, 0x22, 0x22, 0x3C, 0x00, 0x00, |
| 800 | 800 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x20, 0x20, 0x20, 0x1C, 0x00, 0x00, |
| 801 | 801 | 0x00, 0x00, 0x00, 0x02, 0x02, 0x1E, 0x22, 0x22, 0x22, 0x1E, 0x00, 0x00, |
| r1461 | r1462 | |
| 948 | 948 | M6847_RGB(0x00, 0xff, 0x00), /* GREEN */ |
| 949 | 949 | M6847_RGB(0x00, 0x00, 0x00), /* BLACK */ |
| 950 | 950 | M6847_RGB(0xff, 0xff, 0xff), /* BUFF */ |
| 951 | ||
| 951 | ||
| 952 | 952 | M6847_RGB(0x00, 0x40, 0x00), /* ALPHANUMERIC DARK GREEN */ |
| 953 | 953 | M6847_RGB(0x00, 0xff, 0x00), /* ALPHANUMERIC BRIGHT GREEN */ |
| 954 | 954 | M6847_RGB(0x40, 0x10, 0x00), /* ALPHANUMERIC DARK ORANGE */ |
| r1461 | r1462 | |
| 1048 | 1048 | static int attr_index_from_attribute(UINT8 attr) |
| 1049 | 1049 | { |
| 1050 | 1050 | int result; |
| 1051 | ||
| 1051 | ||
| 1052 | 1052 | result = ((attr & (M6847_AG | M6847_AS | M6847_INTEXT | M6847_INV | M6847_CSS)) >> 3) |
| 1053 | 1053 | | ((attr & (M6847_GM1 | M6847_GM0)) << 5); |
| 1054 | 1054 | |
| r1461 | r1462 | |
| 1832 | 1832 | m6847->new_frame_callback = cfg->new_frame_callback; |
| 1833 | 1833 | m6847->custom_prepare_scanline = cfg->custom_prepare_scanline; |
| 1834 | 1834 | m6847->has_lowercase = v->has_lowercase; |
| 1835 | ||
| 1835 | ||
| 1836 | 1836 | /* assert our assumptions */ |
| 1837 | 1837 | assert((v->scanlines_per_frame * FACTOR_SCANLINES_PER_FRAME) |
| 1838 | 1838 | == (UINT32) (v->scanlines_per_frame * FACTOR_SCANLINES_PER_FRAME)); |
| r1461 | r1462 | |
|---|---|---|
| 70 | 70 | UINT8 p = readinputport( THOM_INPUT_VCONFIG ); |
| 71 | 71 | int new_w, new_h, changed = 0; |
| 72 | 72 | |
| 73 | switch ( p & 3 ) | |
| 73 | switch ( p & 3 ) | |
| 74 | 74 | { |
| 75 | 75 | case 0: thom_bwidth = 56; thom_bheight = 47; break; /* as in original (?) */ |
| 76 | 76 | case 1: thom_bwidth = 16; thom_bheight = 16; break; /* small */ |
| 77 | 77 | default: thom_bwidth = 0; thom_bheight = 0; break; /* none */ |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | switch ( p & 0xc ) | |
| 80 | switch ( p & 0xc ) | |
| 81 | 81 | { |
| 82 | 82 | case 0: thom_hires = 0; break; /* low */ |
| 83 | 83 | case 4: thom_hires = 1; break; /* high */ |
| r1461 | r1462 | |
| 86 | 86 | |
| 87 | 87 | new_w = ( 320 + thom_bwidth * 2 ) * ( thom_hires + 1 ) - 1; |
| 88 | 88 | new_h = ( 200 + thom_bheight * 2 ) /** (thom_hires + 1 )*/ - 1; |
| 89 | if ( ( Machine->screen[0].visarea.max_x != new_w ) || ( Machine->screen[0].visarea.max_y != new_h ) ) | |
| 89 | if ( ( Machine->screen[0].visarea.max_x != new_w ) || ( Machine->screen[0].visarea.max_y != new_h ) ) | |
| 90 | 90 | { |
| 91 | 91 | changed = 1; |
| 92 | 92 | video_screen_set_visarea( 0, 0, new_w, 0, new_h ); |
| r1461 | r1462 | |
| 113 | 113 | unsigned u; |
| 114 | 114 | attotime elapsed = timer_timeelapsed( thom_video_timer ); |
| 115 | 115 | u = attotime_mul( elapsed, 1000000 ).seconds; |
| 116 | if ( u >= 19968 ) | |
| 116 | if ( u >= 19968 ) | |
| 117 | 117 | u = 19968; |
| 118 | 118 | return u; |
| 119 | 119 | } |
| r1461 | r1462 | |
| 124 | 124 | { |
| 125 | 125 | struct thom_vsignal v; |
| 126 | 126 | int gpl = thom_video_elapsed() - 64 * THOM_BORDER_HEIGHT - 7; |
| 127 | if ( gpl < 0 ) | |
| 127 | if ( gpl < 0 ) | |
| 128 | 128 | gpl += 19968; |
| 129 | 129 | |
| 130 | 130 | v.inil = ( gpl & 63 ) <= 40; |
| r1461 | r1462 | |
| 151 | 151 | *x = readinputport( THOM_INPUT_LIGHTPEN ); |
| 152 | 152 | *y = readinputport( THOM_INPUT_LIGHTPEN + 1 ); |
| 153 | 153 | |
| 154 | if ( *x < 0 ) | |
| 154 | if ( *x < 0 ) | |
| 155 | 155 | *x = 0; |
| 156 | 156 | |
| 157 | if ( *y < 0 ) | |
| 157 | if ( *y < 0 ) | |
| 158 | 158 | *y = 0; |
| 159 | 159 | |
| 160 | if ( *x > 2 * thom_bwidth + 319 ) | |
| 160 | if ( *x > 2 * thom_bwidth + 319 ) | |
| 161 | 161 | *x = 2 * thom_bwidth + 319; |
| 162 | 162 | |
| 163 | if ( *y > 2 * thom_bheight + 199 ) | |
| 163 | if ( *y > 2 * thom_bheight + 199 ) | |
| 164 | 164 | *y = 2 * thom_bheight + 199; |
| 165 | 165 | } |
| 166 | 166 | |
| r1461 | r1462 | |
| 177 | 177 | y += ydec - thom_bheight; |
| 178 | 178 | |
| 179 | 179 | gpl = (x >> 3) + y * 64; |
| 180 | if ( gpl < 0 ) | |
| 180 | if ( gpl < 0 ) | |
| 181 | 181 | gpl += 19968; |
| 182 | ||
| 182 | ||
| 183 | 183 | v.inil = (gpl & 63) <= 41; |
| 184 | 184 | |
| 185 | 185 | v.init = (gpl <= 64 * THOM_ACTIVE_HEIGHT - 24); |
| 186 | 186 | |
| 187 | v.lt3 = ( gpl & 8 ) ? 1 : 0; | |
| 187 | v.lt3 = ( gpl & 8 ) ? 1 : 0; | |
| 188 | 188 | |
| 189 | 189 | v.line = y; |
| 190 | 190 | |
| 191 | 191 | if ( v.inil && v.init ) |
| 192 | v.count = | |
| 192 | v.count = | |
| 193 | 193 | ( gpl >> 6 ) * 320 + /* line */ |
| 194 | 194 | ( gpl & 63 ) * 8 + /* gpl inside line */ |
| 195 | 195 | ( (x + xdec2) & 7 ); /* pixel inside gpl */ |
| 196 | else | |
| 196 | else | |
| 197 | 197 | v.count = 0; |
| 198 | 198 | |
| 199 | 199 | return v; |
| r1461 | r1462 | |
| 225 | 225 | { |
| 226 | 226 | int step = param; |
| 227 | 227 | |
| 228 | if ( thom_lightpen_cb ) | |
| 228 | if ( thom_lightpen_cb ) | |
| 229 | 229 | thom_lightpen_cb( step ); |
| 230 | 230 | |
| 231 | 231 | if ( step < thom_lightpen_nb ) |
| r1461 | r1462 | |
| 239 | 239 | /* This code, common for all Thomson machines, emulates the TO8 |
| 240 | 240 | video hardware, with its 16-colors chosen among 4096, 9 video modes, |
| 241 | 241 | and 4 video pages. Moreover, it emulates changing the palette several times |
| 242 | per frame to simulate more than 16 colors per frame (and the same for mode | |
| 242 | per frame to simulate more than 16 colors per frame (and the same for mode | |
| 243 | 243 | and page switchs) and cooper effects (distinguishing the left and right |
| 244 | 244 | border color of each row). |
| 245 | 245 | |
| r1461 | r1462 | |
| 265 | 265 | static UINT8 thom_pal_changed; /* whether pal != old_pal */ |
| 266 | 266 | static UINT8 thom_border_index; /* current border color index */ |
| 267 | 267 | |
| 268 | /* the left and right border color for each row (including top and bottom | |
| 268 | /* the left and right border color for each row (including top and bottom | |
| 269 | 269 | border rows); -1 means unchanged wrt last scanline |
| 270 | 270 | */ |
| 271 | 271 | static INT16 thom_border_l[THOM_TOTAL_HEIGHT+1]; |
| r1461 | r1462 | |
| 289 | 289 | /* one dirty flag for each video memory line */ |
| 290 | 290 | static UINT8 thom_vmem_dirty[205]; |
| 291 | 291 | |
| 292 | /* set to 1 if undirty scanlines need to be redrawn due to other video state | |
| 292 | /* set to 1 if undirty scanlines need to be redrawn due to other video state | |
| 293 | 293 | changes */ |
| 294 | 294 | static UINT8 thom_vstate_dirty; |
| 295 | 295 | static UINT8 thom_vstate_last_dirty; |
| r1461 | r1462 | |
| 312 | 312 | unsigned x = l & 63; |
| 313 | 313 | unsigned color = thom_pal[ thom_border_index ]; |
| 314 | 314 | |
| 315 | if ( y >= THOM_TOTAL_HEIGHT ) | |
| 315 | if ( y >= THOM_TOTAL_HEIGHT ) | |
| 316 | 316 | { |
| 317 | 317 | /* end of page */ |
| 318 | 318 | thom_border_r[ THOM_TOTAL_HEIGHT ] = color; |
| 319 | 319 | } |
| 320 | else if ( ! x ) | |
| 320 | else if ( ! x ) | |
| 321 | 321 | { |
| 322 | 322 | /* start of line */ |
| 323 | 323 | thom_border_l[ y ] = color; |
| 324 | 324 | thom_border_r[ y ] = color; |
| 325 | 325 | } |
| 326 | else if ( x <= 19 ) | |
| 326 | else if ( x <= 19 ) | |
| 327 | 327 | { |
| 328 | 328 | /* between left and right border */ |
| 329 | 329 | /* NOTE: this makes the lower right part of the color picker blink |
| r1461 | r1462 | |
| 332 | 332 | thom_border_r[ y ] = color; |
| 333 | 333 | thom_border_l[ y + 1 ] = color; |
| 334 | 334 | } |
| 335 | else | |
| 335 | else | |
| 336 | 336 | { |
| 337 | 337 | /* end of line */ |
| 338 | 338 | thom_border_l[ y + 1 ] = color; |
| r1461 | r1462 | |
| 350 | 350 | unsigned y = l >> 6; |
| 351 | 351 | unsigned x = l & 63; |
| 352 | 352 | int modepage = ((int)thom_vmode << 8) | thom_vpage; |
| 353 | if ( y >= 200 || x>= 40 ) | |
| 353 | if ( y >= 200 || x>= 40 ) | |
| 354 | 354 | thom_vmodepage[ 40 ] = modepage; |
| 355 | else | |
| 355 | else | |
| 356 | 356 | thom_vmodepage[ x ] = modepage; |
| 357 | 357 | thom_vmodepage_changed = 1; |
| 358 | 358 | } |
| r1461 | r1462 | |
| 362 | 362 | void thom_set_border_color ( unsigned index ) |
| 363 | 363 | { |
| 364 | 364 | assert( index < 16 ); |
| 365 | if ( index != thom_border_index ) | |
| 365 | if ( index != thom_border_index ) | |
| 366 | 366 | { |
| 367 | 367 | LOG (( "thom_set_border_color: %i at line %i col %i\n", index, thom_video_elapsed() / 64, thom_video_elapsed() % 64 )); |
| 368 | 368 | thom_border_index = index; |
| r1461 | r1462 | |
| 376 | 376 | { |
| 377 | 377 | assert( index < 16 ); |
| 378 | 378 | |
| 379 | if ( color != 0x1000 ) | |
| 379 | if ( color != 0x1000 ) | |
| 380 | 380 | color &= 0xfff; |
| 381 | 381 | |
| 382 | if ( thom_pal[ index ] == color ) | |
| 382 | if ( thom_pal[ index ] == color ) | |
| 383 | 383 | return; |
| 384 | 384 | |
| 385 | 385 | LOG (( "thom_set_palette: %i to %03x at line %i col %i\n", index, color, thom_video_elapsed() / 64, thom_video_elapsed() % 64 )); |
| 386 | 386 | |
| 387 | 387 | thom_pal[ index ] = color; |
| 388 | if ( index == thom_border_index ) | |
| 388 | if ( index == thom_border_index ) | |
| 389 | 389 | thom_border_changed(); |
| 390 | 390 | thom_pal_changed = 1; |
| 391 | 391 | thom_vstate_dirty = 1; |
| r1461 | r1462 | |
| 397 | 397 | { |
| 398 | 398 | assert( mode < THOM_VMODE_NB ); |
| 399 | 399 | |
| 400 | if ( mode != thom_vmode ) | |
| 400 | if ( mode != thom_vmode ) | |
| 401 | 401 | { |
| 402 | 402 | LOG (( "thom_set_video_mode: %i at line %i, col %i\n", mode, thom_video_elapsed() / 64, thom_video_elapsed() % 64 )); |
| 403 | 403 | thom_vmode = mode; |
| r1461 | r1462 | |
| 425 | 425 | |
| 426 | 426 | |
| 427 | 427 | |
| 428 | typedef void ( *thom_scandraw ) ( UINT8* vram, UINT16* dst, UINT16* pal, | |
| 428 | typedef void ( *thom_scandraw ) ( UINT8* vram, UINT16* dst, UINT16* pal, | |
| 429 | 429 | int org, int len ); |
| 430 | 430 | |
| 431 | 431 | |
| r1461 | r1462 | |
| 439 | 439 | dst += org * res; \ |
| 440 | 440 | for ( gpl = 0; gpl < len; gpl++, dst += res, vram++ ) { \ |
| 441 | 441 | UINT8 rama = vram[ 0 ]; \ |
| 442 | UINT8 ramb = vram[ 0x2000 ]; | |
| 442 | UINT8 ramb = vram[ 0x2000 ]; | |
| 443 | 443 | |
| 444 | 444 | #define UPDATE_HI( name ) UPDATE( name, 16 ) |
| 445 | 445 | #define UPDATE_LOW( name ) UPDATE( name, 8 ) |
| r1461 | r1462 | |
| 477 | 477 | |
| 478 | 478 | /* as above, different (more logical but TO7-incompatible) color encoding */ |
| 479 | 479 | |
| 480 | UPDATE_HI( mo5 ) | |
| 480 | UPDATE_HI( mo5 ) | |
| 481 | 481 | { |
| 482 | 482 | int i; |
| 483 | 483 | pen_t c[2]; |
| r1461 | r1462 | |
| 488 | 488 | } |
| 489 | 489 | END_UPDATE |
| 490 | 490 | |
| 491 | UPDATE_LOW( mo5 ) | |
| 491 | UPDATE_LOW( mo5 ) | |
| 492 | 492 | { |
| 493 | 493 | int i; |
| 494 | 494 | pen_t c[2]; |
| r1461 | r1462 | |
| 529 | 529 | |
| 530 | 530 | /* 320x200, 4-colors, no constraint */ |
| 531 | 531 | |
| 532 | UPDATE_HI( bitmap4 ) | |
| 532 | UPDATE_HI( bitmap4 ) | |
| 533 | 533 | { |
| 534 | 534 | int i; |
| 535 | 535 | pen_t c[2][2]; |
| r1461 | r1462 | |
| 542 | 542 | } |
| 543 | 543 | END_UPDATE |
| 544 | 544 | |
| 545 | UPDATE_LOW( bitmap4 ) | |
| 545 | UPDATE_LOW( bitmap4 ) | |
| 546 | 546 | { |
| 547 | 547 | int i; |
| 548 | 548 | pen_t c[2][2]; |
| r1461 | r1462 | |
| 559 | 559 | |
| 560 | 560 | /* as above, but using 2-bit pixels instead of 2 planes of 1-bit pixels */ |
| 561 | 561 | |
| 562 | UPDATE_HI( bitmap4alt ) | |
| 562 | UPDATE_HI( bitmap4alt ) | |
| 563 | 563 | { |
| 564 | 564 | int i; |
| 565 | 565 | pen_t c[4]; |
| r1461 | r1462 | |
| 574 | 574 | } |
| 575 | 575 | END_UPDATE |
| 576 | 576 | |
| 577 | UPDATE_LOW( bitmap4alt ) | |
| 577 | UPDATE_LOW( bitmap4alt ) | |
| 578 | 578 | { |
| 579 | 579 | int i; |
| 580 | 580 | pen_t c[4]; |
| r1461 | r1462 | |
| 593 | 593 | |
| 594 | 594 | /* 160x200, 16-colors, no constraint */ |
| 595 | 595 | |
| 596 | UPDATE_HI( bitmap16 ) | |
| 596 | UPDATE_HI( bitmap16 ) | |
| 597 | 597 | { |
| 598 | 598 | dst[ 0] = dst[ 1] = dst[ 2] = dst[ 3] = Machine->pens[ pal[ rama >> 4 ] ]; |
| 599 | 599 | dst[ 4] = dst[ 5] = dst[ 6] = dst[ 7] = Machine->pens[ pal[ rama & 15 ] ]; |
| r1461 | r1462 | |
| 602 | 602 | } |
| 603 | 603 | END_UPDATE |
| 604 | 604 | |
| 605 | UPDATE_LOW( bitmap16 ) | |
| 605 | UPDATE_LOW( bitmap16 ) | |
| 606 | 606 | { |
| 607 | 607 | dst[0] = dst[1] = Machine->pens[ pal[ rama >> 4 ] ]; |
| 608 | 608 | dst[2] = dst[3] = Machine->pens[ pal[ rama & 15 ] ]; |
| r1461 | r1462 | |
| 615 | 615 | |
| 616 | 616 | /* 640x200 (80 text column), 2-colors, no constraint */ |
| 617 | 617 | |
| 618 | UPDATE_HI( mode80 ) | |
| 618 | UPDATE_HI( mode80 ) | |
| 619 | 619 | { |
| 620 | 620 | int i; |
| 621 | 621 | pen_t c[2]; |
| r1461 | r1462 | |
| 628 | 628 | } |
| 629 | 629 | END_UPDATE |
| 630 | 630 | |
| 631 | UPDATE_LOW( mode80 ) | |
| 631 | UPDATE_LOW( mode80 ) | |
| 632 | 632 | { |
| 633 | 633 | /* 640-pixel mode but 320 pixels emulated => we merge pixels */ |
| 634 | 634 | int i; |
| r1461 | r1462 | |
| 646 | 646 | |
| 647 | 647 | /* as above, but TO9 flavor */ |
| 648 | 648 | |
| 649 | UPDATE_HI( mode80_to9 ) | |
| 649 | UPDATE_HI( mode80_to9 ) | |
| 650 | 650 | { |
| 651 | 651 | int i; |
| 652 | 652 | pen_t c[2]; |
| r1461 | r1462 | |
| 659 | 659 | } |
| 660 | 660 | END_UPDATE |
| 661 | 661 | |
| 662 | UPDATE_LOW( mode80_to9 ) | |
| 662 | UPDATE_LOW( mode80_to9 ) | |
| 663 | 663 | { |
| 664 | 664 | int i; |
| 665 | 665 | pen_t c[4]; |
| r1461 | r1462 | |
| 676 | 676 | |
| 677 | 677 | /* 320x200, 2-colors, two pages (untested) */ |
| 678 | 678 | |
| 679 | UPDATE_HI( page1 ) | |
| 679 | UPDATE_HI( page1 ) | |
| 680 | 680 | { |
| 681 | 681 | int i; |
| 682 | 682 | pen_t c[2]; |
| r1461 | r1462 | |
| 688 | 688 | } |
| 689 | 689 | END_UPDATE |
| 690 | 690 | |
| 691 | UPDATE_LOW( page1 ) | |
| 691 | UPDATE_LOW( page1 ) | |
| 692 | 692 | { |
| 693 | 693 | int i; |
| 694 | 694 | pen_t c[2]; |
| r1461 | r1462 | |
| 700 | 700 | } |
| 701 | 701 | END_UPDATE |
| 702 | 702 | |
| 703 | UPDATE_HI( page2 ) | |
| 703 | UPDATE_HI( page2 ) | |
| 704 | 704 | { |
| 705 | 705 | int i; |
| 706 | 706 | pen_t c[2]; |
| r1461 | r1462 | |
| 728 | 728 | |
| 729 | 729 | /* 320x200, 2-colors, two overlaid pages (untested) */ |
| 730 | 730 | |
| 731 | UPDATE_HI( overlay ) | |
| 731 | UPDATE_HI( overlay ) | |
| 732 | 732 | { |
| 733 | 733 | int i; |
| 734 | 734 | pen_t c[2][2]; |
| r1461 | r1462 | |
| 740 | 740 | } |
| 741 | 741 | END_UPDATE |
| 742 | 742 | |
| 743 | UPDATE_LOW( overlay ) | |
| 743 | UPDATE_LOW( overlay ) | |
| 744 | 744 | { |
| 745 | 745 | int i; |
| 746 | 746 | pen_t c[2][2]; |
| r1461 | r1462 | |
| 756 | 756 | |
| 757 | 757 | /* 160x200, 4-colors, four overlaid pages (untested) */ |
| 758 | 758 | |
| 759 | UPDATE_HI( overlay3 ) | |
| 759 | UPDATE_HI( overlay3 ) | |
| 760 | 760 | { |
| 761 | static const int p[2][2][2][2] = | |
| 762 | { { { { 0, 1 }, { 2, 1 }, }, { { 4, 1 }, { 2, 1 } } }, | |
| 761 | static const int p[2][2][2][2] = | |
| 762 | { { { { 0, 1 }, { 2, 1 }, }, { { 4, 1 }, { 2, 1 } } }, | |
| 763 | 763 | { { { 8, 1 }, { 2, 1 }, }, { { 4, 1 }, { 2, 1 } } } }; |
| 764 | 764 | int i; |
| 765 | 765 | for ( i = 0; i < 16; i += 4, rama >>= 1, ramb >>= 1 ) |
| 766 | dst[ 15 - i ] = dst[ 14 - i ] = dst[ 13 - i ] = dst[ 12 - i ] = | |
| 767 | Machine->pens[ pal[ p[ ramb & 1 ] [ (ramb >> 4) & 1 ] | |
| 766 | dst[ 15 - i ] = dst[ 14 - i ] = dst[ 13 - i ] = dst[ 12 - i ] = | |
| 767 | Machine->pens[ pal[ p[ ramb & 1 ] [ (ramb >> 4) & 1 ] | |
| 768 | 768 | [ rama & 1 ] [ (rama >> 4) & 1 ] ] ]; |
| 769 | 769 | } |
| 770 | 770 | END_UPDATE |
| 771 | 771 | |
| 772 | UPDATE_LOW( overlay3 ) | |
| 772 | UPDATE_LOW( overlay3 ) | |
| 773 | 773 | { |
| 774 | static const int p[2][2][2][2] = | |
| 775 | { { { { 0, 1 }, { 2, 1 }, }, { { 4, 1 }, { 2, 1 } } }, | |
| 774 | static const int p[2][2][2][2] = | |
| 775 | { { { { 0, 1 }, { 2, 1 }, }, { { 4, 1 }, { 2, 1 } } }, | |
| 776 | 776 | { { { 8, 1 }, { 2, 1 }, }, { { 4, 1 }, { 2, 1 } } } }; |
| 777 | 777 | int i; |
| 778 | 778 | for ( i = 0; i < 8; i += 2, rama >>= 1, ramb >>= 1 ) |
| 779 | 779 | dst[ 7 - i ] = dst[ 6 - i ] = |
| 780 | Machine->pens[ pal[ p[ ramb & 1 ] [ (ramb >> 4) & 1 ] | |
| 780 | Machine->pens[ pal[ p[ ramb & 1 ] [ (ramb >> 4) & 1 ] | |
| 781 | 781 | [ rama & 1 ] [ (rama >> 4) & 1 ] ] ]; |
| 782 | 782 | } |
| 783 | 783 | END_UPDATE |
| r1461 | r1462 | |
| 787 | 787 | #define FUN(x) { x##_scandraw_8, x##_scandraw_16 } |
| 788 | 788 | |
| 789 | 789 | |
| 790 | static const thom_scandraw thom_scandraw_funcs[THOM_VMODE_NB][2] = | |
| 790 | static const thom_scandraw thom_scandraw_funcs[THOM_VMODE_NB][2] = | |
| 791 | 791 | { |
| 792 | FUN(to770), FUN(mo5), FUN(bitmap4), FUN(bitmap4alt), FUN(mode80), | |
| 792 | FUN(to770), FUN(mo5), FUN(bitmap4), FUN(bitmap4alt), FUN(mode80), | |
| 793 | 793 | FUN(bitmap16), FUN(page1), FUN(page2), FUN(overlay), FUN(overlay3), |
| 794 | FUN(to9), FUN(mode80_to9), | |
| 794 | FUN(to9), FUN(mode80_to9), | |
| 795 | 795 | }; |
| 796 | 796 | |
| 797 | 797 | |
| r1461 | r1462 | |
| 804 | 804 | int y = param; |
| 805 | 805 | |
| 806 | 806 | /* update active-area */ |
| 807 | if ( y >= 0 && (thom_vstate_dirty || thom_vstate_last_dirty || thom_vmem_dirty[y]) ) | |
| 807 | if ( y >= 0 && (thom_vstate_dirty || thom_vstate_last_dirty || thom_vmem_dirty[y]) ) | |
| 808 | 808 | { |
| 809 | int x = 0; | |
| 810 | while ( x < 40 ) | |
| 809 | int x = 0; | |
| 810 | while ( x < 40 ) | |
| 811 | 811 | { |
| 812 | 812 | int xx = x; |
| 813 | 813 | unsigned mode = thom_vmodepage[x] >> 8; |
| 814 | 814 | unsigned page = thom_vmodepage[x] & 0xff; |
| 815 | 815 | assert( mode < THOM_VMODE_NB ); |
| 816 | 816 | assert( page < 4 ); |
| 817 | do | |
| 818 | { | |
| 819 | xx++; | |
| 817 | do | |
| 818 | { | |
| 819 | xx++; | |
| 820 | 820 | } while ( xx < 40 && thom_vmodepage[xx] == -1 ); |
| 821 | 821 | thom_scandraw_funcs[ mode ][ thom_hires ] |
| 822 | 822 | ( thom_vram + y * 40 + page * 0x4000, |
| r1461 | r1462 | |
| 828 | 828 | } |
| 829 | 829 | |
| 830 | 830 | /* prepare for next scanline */ |
| 831 | if ( y == 199 ) | |
| 831 | if ( y == 199 ) | |
| 832 | 832 | timer_adjust( thom_scanline_timer, attotime_never, 0, attotime_zero); |
| 833 | else | |
| 834 | { | |
| 833 | else | |
| 834 | { | |
| 835 | 835 | |
| 836 | if ( thom_vmodepage_changed ) | |
| 836 | if ( thom_vmodepage_changed ) | |
| 837 | 837 | { |
| 838 | 838 | int x, m = 0; |
| 839 | 839 | for ( x = 0; x <= 40; x++ ) |
| 840 | 840 | { |
| 841 | if ( thom_vmodepage[x] !=-1 ) | |
| 841 | if ( thom_vmodepage[x] !=-1 ) | |
| 842 | 842 | { |
| 843 | 843 | m = thom_vmodepage[x]; |
| 844 | 844 | thom_vmodepage[x] = -1; |
| r1461 | r1462 | |
| 847 | 847 | thom_vmodepage[0] = m; |
| 848 | 848 | thom_vmodepage_changed = 0; |
| 849 | 849 | } |
| 850 | ||
| 851 | if ( thom_pal_changed ) | |
| 850 | ||
| 851 | if ( thom_pal_changed ) | |
| 852 | 852 | { |
| 853 | 853 | memcpy( thom_last_pal, thom_pal, 32 ); |
| 854 | 854 | thom_pal_changed = 0; |
| r1461 | r1462 | |
| 887 | 887 | int fold = FLOP_STATE, fnew; |
| 888 | 888 | |
| 889 | 889 | /* stays up for a few frames */ |
| 890 | if ( write ) | |
| 891 | thom_floppy_wcount = 25; | |
| 892 | else | |
| 890 | if ( write ) | |
| 891 | thom_floppy_wcount = 25; | |
| 892 | else | |
| 893 | 893 | thom_floppy_rcount = 25; |
| 894 | 894 | |
| 895 | 895 | /* update icon */ |
| 896 | 896 | fnew = FLOP_STATE; |
| 897 | if ( fold != fnew ) | |
| 897 | if ( fold != fnew ) | |
| 898 | 898 | output_set_value( "floppy", fnew ); |
| 899 | 899 | } |
| 900 | 900 | |
| r1461 | r1462 | |
| 925 | 925 | /* upper border */ |
| 926 | 926 | for ( y = 0; y < THOM_BORDER_HEIGHT - thom_bheight; y++ ) |
| 927 | 927 | { |
| 928 | if ( thom_border_l[ y ] != -1 ) | |
| 928 | if ( thom_border_l[ y ] != -1 ) | |
| 929 | 929 | border = machine->pens[ thom_border_l[ y ] ]; |
| 930 | 930 | } |
| 931 | 931 | ypos = 0; |
| 932 | while ( y < THOM_BORDER_HEIGHT ) | |
| 932 | while ( y < THOM_BORDER_HEIGHT ) | |
| 933 | 933 | { |
| 934 | if ( thom_border_l[ y ] != -1 ) | |
| 934 | if ( thom_border_l[ y ] != -1 ) | |
| 935 | 935 | border = machine->pens[ thom_border_l[ y ] ]; |
| 936 | 936 | wrect.min_y = ypos; |
| 937 | do | |
| 938 | { | |
| 939 | y++; | |
| 940 | ypos ++ /* += scale */; | |
| 937 | do | |
| 938 | { | |
| 939 | y++; | |
| 940 | ypos ++ /* += scale */; | |
| 941 | 941 | } |
| 942 | 942 | while ( y < THOM_BORDER_HEIGHT && thom_border_l[ y ] == -1 ); |
| 943 | 943 | wrect.max_y = ypos - 1; |
| r1461 | r1462 | |
| 945 | 945 | } |
| 946 | 946 | |
| 947 | 947 | /* left border */ |
| 948 | while ( y < yup ) | |
| 948 | while ( y < yup ) | |
| 949 | 949 | { |
| 950 | if ( thom_border_l[ y ] != -1 ) | |
| 950 | if ( thom_border_l[ y ] != -1 ) | |
| 951 | 951 | border = machine->pens[ thom_border_l[ y ] ]; |
| 952 | 952 | lrect.min_y = ypos; |
| 953 | do | |
| 954 | { | |
| 955 | y++; | |
| 956 | ypos ++ /* += scale */; | |
| 953 | do | |
| 954 | { | |
| 955 | y++; | |
| 956 | ypos ++ /* += scale */; | |
| 957 | 957 | } |
| 958 | 958 | while ( y < yup && thom_border_l[ y ] == -1 ); |
| 959 | 959 | lrect.max_y = ypos - 1; |
| r1461 | r1462 | |
| 961 | 961 | } |
| 962 | 962 | |
| 963 | 963 | /* lower border */ |
| 964 | while (y < ybot ) | |
| 964 | while (y < ybot ) | |
| 965 | 965 | { |
| 966 | if ( thom_border_l[ y ] != -1 ) | |
| 966 | if ( thom_border_l[ y ] != -1 ) | |
| 967 | 967 | border = machine->pens[ thom_border_l[ y ] ]; |
| 968 | 968 | wrect.min_y = ypos; |
| 969 | do | |
| 970 | { | |
| 971 | y++; | |
| 969 | do | |
| 970 | { | |
| 971 | y++; | |
| 972 | 972 | ypos ++ /* += scale */; } |
| 973 | 973 | while ( y < ybot && thom_border_l[ y ] == -1 ); |
| 974 | 974 | wrect.max_y = ypos - 1; |
| r1461 | r1462 | |
| 977 | 977 | |
| 978 | 978 | /* right border */ |
| 979 | 979 | for ( y = 0; y < THOM_BORDER_HEIGHT; y++ ) { |
| 980 | if ( thom_border_r[ y ] != -1 ) | |
| 980 | if ( thom_border_r[ y ] != -1 ) | |
| 981 | 981 | border = machine->pens[ thom_border_r[ y ] ]; |
| 982 | 982 | } |
| 983 | 983 | ypos = thom_bheight /* * scale */; |
| 984 | while ( y < yup ) | |
| 984 | while ( y < yup ) | |
| 985 | 985 | { |
| 986 | if ( thom_border_r[ y ] != -1 ) | |
| 986 | if ( thom_border_r[ y ] != -1 ) | |
| 987 | 987 | border = machine->pens[ thom_border_r[ y ] ]; |
| 988 | 988 | rrect.min_y = ypos; |
| 989 | do | |
| 990 | { | |
| 991 | y++; | |
| 992 | ypos ++ /* += scale */; | |
| 989 | do | |
| 990 | { | |
| 991 | y++; | |
| 992 | ypos ++ /* += scale */; | |
| 993 | 993 | } |
| 994 | 994 | while ( y < yup && thom_border_r[ y ] == -1 ); |
| 995 | 995 | rrect.max_y = ypos - 1; |
| r1461 | r1462 | |
| 998 | 998 | |
| 999 | 999 | /* active area */ |
| 1000 | 1000 | ypos = thom_bheight /* * scale */; |
| 1001 | for ( y = 0; y < 200; v += xwidth, y++ , ypos ++ /* += scale */ ) | |
| 1001 | for ( y = 0; y < 200; v += xwidth, y++ , ypos ++ /* += scale */ ) | |
| 1002 | 1002 | { |
| 1003 | 1003 | draw_scanline16( bitmap, xbleft, ypos, xwidth, v, NULL, -1 ); |
| 1004 | 1004 | #if 0 |
| r1461 | r1462 | |
| 1034 | 1034 | int init = param; |
| 1035 | 1035 | LOG (( "%f thom_set_init: %i, at line %i col %i\n", attotime_to_double(timer_get_time()), init, thom_video_elapsed() / 64, thom_video_elapsed() % 64 )); |
| 1036 | 1036 | |
| 1037 | if ( thom_init_cb ) | |
| 1037 | if ( thom_init_cb ) | |
| 1038 | 1038 | thom_init_cb( init ); |
| 1039 | 1039 | if ( ! init ) |
| 1040 | 1040 | timer_adjust( thom_init_timer, ATTOTIME_IN_USEC( 64 * THOM_ACTIVE_HEIGHT - 24 ), 1-init, attotime_zero ); |
| r1461 | r1462 | |
| 1047 | 1047 | int i; |
| 1048 | 1048 | UINT16 b = 0; |
| 1049 | 1049 | struct thom_vsignal l = thom_get_lightpen_vsignal( 0, -1, 0 ); |
| 1050 | ||
| 1050 | ||
| 1051 | 1051 | LOG (( "%f thom: video eof called\n", attotime_to_double(timer_get_time()) )); |
| 1052 | 1052 | |
| 1053 | 1053 | /* floppy indicator count */ |
| 1054 | if ( thom_floppy_wcount ) | |
| 1054 | if ( thom_floppy_wcount ) | |
| 1055 | 1055 | thom_floppy_wcount--; |
| 1056 | if ( thom_floppy_rcount ) | |
| 1056 | if ( thom_floppy_rcount ) | |
| 1057 | 1057 | thom_floppy_rcount--; |
| 1058 | 1058 | fnew = FLOP_STATE; |
| 1059 | if ( fnew != fold ) | |
| 1059 | if ( fnew != fold ) | |
| 1060 | 1060 | output_set_value( "floppy", fnew ); |
| 1061 | 1061 | |
| 1062 | 1062 | /* prepare state for next frame */ |
| 1063 | for ( i = 0; i <= THOM_TOTAL_HEIGHT; i++ ) | |
| 1063 | for ( i = 0; i <= THOM_TOTAL_HEIGHT; i++ ) | |
| 1064 | 1064 | { |
| 1065 | if ( thom_border_l[ i ] != -1 ) | |
| 1065 | if ( thom_border_l[ i ] != -1 ) | |
| 1066 | 1066 | b = thom_border_l[ i ]; |
| 1067 | if ( thom_border_r[ i ] != -1 ) | |
| 1067 | if ( thom_border_r[ i ] != -1 ) | |
| 1068 | 1068 | b = thom_border_r[ i ]; |
| 1069 | 1069 | } |
| 1070 | 1070 | memset( thom_border_l, 0xff, sizeof( thom_border_l ) ); |
| r1461 | r1462 | |
| 1073 | 1073 | thom_border_r[ 0 ] = b; |
| 1074 | 1074 | thom_vstate_last_dirty = thom_vstate_dirty; |
| 1075 | 1075 | thom_vstate_dirty = 0; |
| 1076 | ||
| 1076 | ||
| 1077 | 1077 | /* schedule first init signal */ |
| 1078 | 1078 | timer_adjust( thom_init_timer, ATTOTIME_IN_USEC( 64 * THOM_BORDER_HEIGHT + 7 ), 0, attotime_zero ); |
| 1079 | 1079 | |
| r1461 | r1462 | |
| 1104 | 1104 | |
| 1105 | 1105 | |
| 1106 | 1106 | |
| 1107 | static const UINT16 thom_pal_init[16] = | |
| 1108 | { | |
| 1107 | static const UINT16 thom_pal_init[16] = | |
| 1108 | { | |
| 1109 | 1109 | 0x1000, /* 0: black */ 0x000f, /* 1: red */ |
| 1110 | 1110 | 0x00f0, /* 2: geen */ 0x00ff, /* 3: yellow */ |
| 1111 | 1111 | 0x0f00, /* 4: blue */ 0x0f0f, /* 5: purple */ |
| r1461 | r1462 | |
| 1173 | 1173 | |
| 1174 | 1174 | thom_init_cb = NULL; |
| 1175 | 1175 | thom_init_timer = timer_alloc( thom_set_init , NULL); |
| 1176 | ||
| 1176 | ||
| 1177 | 1177 | video_eof_thom(machine); |
| 1178 | 1178 | |
| 1179 | 1179 | state_save_register_global( thom_bwidth ); |
| r1461 | r1462 | |
| 1191 | 1191 | |
| 1192 | 1192 | LOG (( "thom: palette init called\n" )); |
| 1193 | 1193 | |
| 1194 | for ( i = 0; i < 4097; i++ ) | |
| 1194 | for ( i = 0; i < 4097; i++ ) | |
| 1195 | 1195 | { |
| 1196 | 1196 | UINT8 r = 255. * pow( (i & 15) / 15., gamma ); |
| 1197 | 1197 | UINT8 g = 255. * pow( ((i>> 4) & 15) / 15., gamma ); |
| r1461 | r1462 | |
| 1212 | 1212 | { |
| 1213 | 1213 | assert( offset >= 0 && offset < 0x2000 ); |
| 1214 | 1214 | /* force two topmost color bits to 1 */ |
| 1215 | if ( thom_mode_point ) | |
| 1215 | if ( thom_mode_point ) | |
| 1216 | 1216 | data |= 0xc0; |
| 1217 | if ( thom_vram[ offset + thom_mode_point ] == data ) | |
| 1217 | if ( thom_vram[ offset + thom_mode_point ] == data ) | |
| 1218 | 1218 | return; |
| 1219 | 1219 | thom_vram[ offset + thom_mode_point ] = data; |
| 1220 | 1220 | /* dirty whole scanline */ |
| r1461 | r1462 | |
| 1232 | 1232 | thom_get_lightpen_pos( &x, &y ); |
| 1233 | 1233 | x -= thom_bwidth; |
| 1234 | 1234 | y -= thom_bheight; |
| 1235 | if ( x < 0 || y < 0 || x >= 320 || y >= 200 ) | |
| 1235 | if ( x < 0 || y < 0 || x >= 320 || y >= 200 ) | |
| 1236 | 1236 | return 0; |
| 1237 | 1237 | x += decx; |
| 1238 | 1238 | y += decy; |
| r1461 | r1462 | |
| 1245 | 1245 | |
| 1246 | 1246 | |
| 1247 | 1247 | |
| 1248 | /* write to video memory through addresses 0x4000-0x5fff (TO) | |
| 1248 | /* write to video memory through addresses 0x4000-0x5fff (TO) | |
| 1249 | 1249 | or 0x0000-0x1fff (MO) */ |
| 1250 | 1250 | WRITE8_HANDLER ( to770_vram_w ) |
| 1251 | 1251 | { |
| 1252 | 1252 | assert( offset >= 0 && offset < 0x2000 ); |
| 1253 | if ( thom_vram[ offset + thom_mode_point ] == data ) | |
| 1253 | if ( thom_vram[ offset + thom_mode_point ] == data ) | |
| 1254 | 1254 | return; |
| 1255 | 1255 | thom_vram[ offset + thom_mode_point ] = data; |
| 1256 | 1256 | /* dirty whole scanline */ |
| r1461 | r1462 | |
| 1270 | 1270 | { |
| 1271 | 1271 | UINT8* dst = thom_vram + offset + 0x6000; |
| 1272 | 1272 | assert( offset >= 0 && offset < 0x2000 ); |
| 1273 | if ( *dst == data ) | |
| 1273 | if ( *dst == data ) | |
| 1274 | 1274 | return; |
| 1275 | 1275 | *dst = data; |
| 1276 | 1276 | /* dirty whole scanline */ |
| r1461 | r1462 | |
| 1297 | 1297 | { |
| 1298 | 1298 | UINT8* dst = thom_vram + offset + 0x4000 * to8_data_vpage + 0x2000; |
| 1299 | 1299 | assert( offset >= 0 && offset < 0x2000 ); |
| 1300 | if ( *dst == data ) | |
| 1300 | if ( *dst == data ) | |
| 1301 | 1301 | return; |
| 1302 | 1302 | *dst = data; |
| 1303 | 1303 | /* dirty whole scanline */ |
| 1304 | if ( to8_data_vpage >= 4 ) | |
| 1304 | if ( to8_data_vpage >= 4 ) | |
| 1305 | 1305 | return; |
| 1306 | 1306 | thom_vmem_dirty[ offset / 40 ] = 1; |
| 1307 | 1307 | } |
| r1461 | r1462 | |
| 1312 | 1312 | { |
| 1313 | 1313 | UINT8* dst = thom_vram + offset + 0x4000 * to8_data_vpage; |
| 1314 | 1314 | assert( offset >= 0 && offset < 0x2000 ); |
| 1315 | if ( *dst == data ) | |
| 1315 | if ( *dst == data ) | |
| 1316 | 1316 | return; |
| 1317 | 1317 | *dst = data; |
| 1318 | 1318 | /* dirty whole scanline */ |
| 1319 | if ( to8_data_vpage >= 4 ) | |
| 1319 | if ( to8_data_vpage >= 4 ) | |
| 1320 | 1320 | return; |
| 1321 | 1321 | thom_vmem_dirty[ offset / 40 ] = 1; |
| 1322 | 1322 | } |
| r1461 | r1462 | |
| 1328 | 1328 | { |
| 1329 | 1329 | UINT8* dst = thom_vram + offset + 0x4000 * to8_cart_vpage; |
| 1330 | 1330 | assert( offset>=0 && offset < 0x4000 ); |
| 1331 | if ( *dst == data ) | |
| 1331 | if ( *dst == data ) | |
| 1332 | 1332 | return; |
| 1333 | 1333 | *dst = data; |
| 1334 | 1334 | /* dirty whole scanline */ |
| 1335 | if ( to8_cart_vpage >= 4 ) | |
| 1335 | if ( to8_cart_vpage >= 4 ) | |
| 1336 | 1336 | return; |
| 1337 | 1337 | thom_vmem_dirty[ (offset & 0x1fff) / 40 ] = 1; |
| 1338 | 1338 | } |
| r1461 | r1462 | |
|---|---|---|
| 6 | 6 | |
| 7 | 7 | **********************************************************************/ |
| 8 | 8 | |
| 9 | /* | |
| 9 | /* | |
| 10 | 10 | TO7 video: |
| 11 | 11 | one line (64 us) = |
| 12 | 12 | 56 left border pixels ( 7 us) |
| r1461 | r1462 | |
| 72 | 72 | extern unsigned to7_lightpen_gpl ( int decx, int decy ); |
| 73 | 73 | |
| 74 | 74 | /* video position corresponding to lightpen (with some offset) */ |
| 75 | extern struct thom_vsignal thom_get_lightpen_vsignal ( int xdec, int ydec, | |
| 75 | extern struct thom_vsignal thom_get_lightpen_vsignal ( int xdec, int ydec, | |
| 76 | 76 | int xdec2 ); |
| 77 | 77 | |
| 78 | 78 | /* specify a lightpencall-back function, called nb times per frame */ |
| r1461 | r1462 | |
|---|---|---|
| 62 | 62 | { |
| 63 | 63 | int pmd85_scanline; |
| 64 | 64 | |
| 65 | for (pmd85_scanline=0; pmd85_scanline<256; pmd85_scanline++) | |
| 65 | for (pmd85_scanline=0; pmd85_scanline<256; pmd85_scanline++) | |
| 66 | 66 | pmd85_draw_scanline (bitmap, pmd85_scanline); |
| 67 | 67 | return 0; |
| 68 | 68 | } |
| r1461 | r1462 | |
|---|---|---|
| 34 | 34 | abc80_bank = 0; |
| 35 | 35 | abc80_row = row; |
| 36 | 36 | } |
| 37 | ||
| 37 | ||
| 38 | 38 | if (code == ABC80_MODE_TEXT) |
| 39 | 39 | { |
| 40 | 40 | abc80_bank = 0; |
| r1461 | r1462 | |
| 64 | 64 | abc80_blink_timer = timer_alloc(abc80_blink_tick, NULL); |
| 65 | 65 | timer_adjust(abc80_blink_timer, attotime_zero, 0, ATTOTIME_IN_HZ(ABC80_XTAL/2/6/64/312/16)); |
| 66 | 66 | |
| 67 | tx_tilemap = tilemap_create(abc80_get_tile_info, abc80_tilemap_scan, | |
| 67 | tx_tilemap = tilemap_create(abc80_get_tile_info, abc80_tilemap_scan, | |
| 68 | 68 | TILEMAP_TYPE_PEN, 6, 10, 40, 24); |
| 69 | 69 | |
| 70 | 70 | tilemap_set_scrolldx(tx_tilemap, ABC80_HDSTART, ABC80_HDSTART); |
| r1461 | r1462 | |
|---|---|---|
| 44 | 44 | |
| 45 | 45 | static mame_bitmap* x68k_text_bitmap; // 1024x1024 4x1bpp planes text |
| 46 | 46 | static mame_bitmap* x68k_gfx_0_bitmap_16; // 16 colour, 512x512, 4 pages |
| 47 | static mame_bitmap* x68k_gfx_1_bitmap_16; | |
| 48 | static mame_bitmap* x68k_gfx_2_bitmap_16; | |
| 49 | static mame_bitmap* x68k_gfx_3_bitmap_16; | |
| 47 | static mame_bitmap* x68k_gfx_1_bitmap_16; | |
| 48 | static mame_bitmap* x68k_gfx_2_bitmap_16; | |
| 49 | static mame_bitmap* x68k_gfx_3_bitmap_16; | |
| 50 | 50 | static mame_bitmap* x68k_gfx_0_bitmap_256; // 256 colour, 512x512, 2 pages |
| 51 | static mame_bitmap* x68k_gfx_1_bitmap_256; | |
| 51 | static mame_bitmap* x68k_gfx_1_bitmap_256; | |
| 52 | 52 | static mame_bitmap* x68k_gfx_0_bitmap_65536; // 65536 colour, 512x512, 1 page |
| 53 | 53 | |
| 54 | 54 | static tilemap* x68k_bg0_8; // two 64x64 tilemaps, 8x8 characters |
| r1461 | r1462 | |
| 172 | 172 | visiblescr.max_x = sys.crtc.hend; |
| 173 | 173 | visiblescr.min_y = sys.crtc.vbegin; |
| 174 | 174 | visiblescr.max_y = sys.crtc.vend; |
| 175 | ||
| 175 | ||
| 176 | 176 | // expand visible area to the size indicated by CRTC reg 20 |
| 177 | 177 | length = sys.crtc.hend - sys.crtc.hbegin; |
| 178 | 178 | if (length < sys.crtc.width) |
| r1461 | r1462 | |
| 195 | 195 | visiblescr.max_x = scr.max_x - 1; |
| 196 | 196 | if(visiblescr.max_y >= scr.max_y) |
| 197 | 197 | visiblescr.max_y = scr.max_y - 1; |
| 198 | ||
| 198 | ||
| 199 | 199 | logerror("video_screen_configure(0,%i,%i,[%i,%i,%i,%i],55.45)\n",scr.max_x,scr.max_y,visiblescr.min_x,visiblescr.min_y,visiblescr.max_x,visiblescr.max_y); |
| 200 | 200 | video_screen_configure(0,scr.max_x,scr.max_y,&visiblescr,HZ_TO_ATTOSECONDS(55.45)); |
| 201 | /* | |
| 201 | /* | |
| 202 | 202 | rect.min_x = rect.min_y = 0; |
| 203 | 203 | sys.crtc.visible_width = (sys.crtc.reg[3] - sys.crtc.reg[2]) * 8; |
| 204 | 204 | if(sys.crtc.height == 256) |
| r1461 | r1462 | |
| 241 | 241 | { |
| 242 | 242 | int state = param; |
| 243 | 243 | attotime hsync_time; |
| 244 | ||
| 245 | sys.crtc.hblank = state; | |
| 244 | ||
| 245 | sys.crtc.hblank = state; | |
| 246 | 246 | if(state == 1) |
| 247 | 247 | { |
| 248 | 248 | int scan = video_screen_get_vpos(0); |
| r1461 | r1462 | |
| 356 | 356 | * bits 15-8 - Source Line |
| 357 | 357 | * bits 7-0 - Destination Line |
| 358 | 358 | * 23 - Text Screen Mask Pattern |
| 359 | * | |
| 359 | * | |
| 360 | 360 | * 0xe80481 - Operation Port (8-bit): |
| 361 | 361 | * bit 3 - Text Screen Line Copy Begin |
| 362 | 362 | * bit 1 - Graphic Screen High-speed Clear Begin |
| 363 | 363 | * bit 0 - Image Taking Begin (?) |
| 364 | 364 | * Operation Port bits are cleared automatically when the requested |
| 365 | * operation is completed. | |
| 365 | * operation is completed. | |
| 366 | 366 | */ |
| 367 | 367 | WRITE16_HANDLER( x68k_crtc_w ) |
| 368 | 368 | { |
| r1461 | r1462 | |
| 387 | 387 | { |
| 388 | 388 | attotime irq_time; |
| 389 | 389 | irq_time = video_screen_get_time_until_pos(0,(data - 1) / sys.crtc.vmultiple,2); |
| 390 | ||
| 390 | ||
| 391 | 391 | if(attotime_to_double(irq_time) > 0) |
| 392 | 392 | timer_adjust(raster_irq,irq_time,(data - 1) / sys.crtc.vmultiple,attotime_never); |
| 393 | 393 | logerror("CRTC: Time until next raster IRQ = %f\n",attotime_to_double(irq_time)); |
| r1461 | r1462 | |
| 433 | 433 | { |
| 434 | 434 | sys.crtc.interlace = 0; |
| 435 | 435 | if(data & 0x0400) // real size 1024x1024 |
| 436 | sys.crtc.interlace = 1; | |
| 436 | sys.crtc.interlace = 1; | |
| 437 | 437 | } |
| 438 | 438 | x68k_crtc_refresh_mode(); |
| 439 | 439 | break; |
| r1461 | r1462 | |
| 552 | 552 | int xloc,yloc,pageoffset; |
| 553 | 553 | /* |
| 554 | 554 | G-VRAM usage is determined by colour depth and "real" screen size. |
| 555 | ||
| 555 | ||
| 556 | 556 | For screen size of 1024x1024, all G-VRAM space is used, in one big page. |
| 557 | 557 | At 1024x1024 real screen size, colour depth is always 4bpp, and ranges from |
| 558 | 558 | 0xc00000-0xdfffff. |
| 559 | ||
| 559 | ||
| 560 | 560 | For screen size of 512x512, the colour depth determines the page usage. |
| 561 | 561 | 16 colours = 4 pages |
| 562 | 562 | 256 colours = 2 pages |
| r1461 | r1462 | |
| 565 | 565 | Page 3 - 0xd00000-0xd7ffff Page 4 - 0xd80000-0xdfffff |
| 566 | 566 | */ |
| 567 | 567 | COMBINE_DATA(gvram+offset); |
| 568 | ||
| 568 | ||
| 569 | 569 | pageoffset = offset & 0x3ffff; |
| 570 | 570 | xloc = pageoffset % 512; |
| 571 | 571 | yloc = pageoffset / 512; |
| r1461 | r1462 | |
| 719 | 719 | { |
| 720 | 720 | xscr = sys.crtc.hbegin-(sys.crtc.reg[12] & 0x1ff); |
| 721 | 721 | yscr = sys.crtc.vbegin-(sys.crtc.reg[13] & 0x1ff); |
| 722 | copyscrollbitmap(bitmap, x68k_gfx_0_bitmap_16, 1, &xscr, 1, &yscr ,&cliprect, TRANSPARENCY_PEN,0); | |
| 722 | copyscrollbitmap(bitmap, x68k_gfx_0_bitmap_16, 1, &xscr, 1, &yscr ,&cliprect, TRANSPARENCY_PEN,0); | |
| 723 | 723 | xscr+=512; |
| 724 | copyscrollbitmap(bitmap, x68k_gfx_1_bitmap_16, 1, &xscr, 1, &yscr ,&cliprect, TRANSPARENCY_PEN,0); | |
| 724 | copyscrollbitmap(bitmap, x68k_gfx_1_bitmap_16, 1, &xscr, 1, &yscr ,&cliprect, TRANSPARENCY_PEN,0); | |
| 725 | 725 | yscr+=512; |
| 726 | copyscrollbitmap(bitmap, x68k_gfx_2_bitmap_16, 1, &xscr, 1, &yscr ,&cliprect, TRANSPARENCY_PEN,0); | |
| 726 | copyscrollbitmap(bitmap, x68k_gfx_2_bitmap_16, 1, &xscr, 1, &yscr ,&cliprect, TRANSPARENCY_PEN,0); | |
| 727 | 727 | xscr-=512; |
| 728 | copyscrollbitmap(bitmap, x68k_gfx_3_bitmap_16, 1, &xscr, 1, &yscr ,&cliprect, TRANSPARENCY_PEN,0); | |
| 728 | copyscrollbitmap(bitmap, x68k_gfx_3_bitmap_16, 1, &xscr, 1, &yscr ,&cliprect, TRANSPARENCY_PEN,0); | |
| 729 | 729 | } |
| 730 | 730 | } |
| 731 | 731 | else // 512x512 "real" screen size |
| r1461 | r1462 | |
| 742 | 742 | rect.max_y=rect.min_y + sys.crtc.visible_height-1; |
| 743 | 743 | xscr = sys.crtc.hbegin-(sys.crtc.reg[12] & 0x1ff); |
| 744 | 744 | yscr = sys.crtc.vbegin-(sys.crtc.reg[13] & 0x1ff); |
| 745 | copyscrollbitmap(bitmap, x68k_gfx_0_bitmap_65536, 1, &xscr, 1, &yscr,&cliprect, TRANSPARENCY_PEN,0); | |
| 745 | copyscrollbitmap(bitmap, x68k_gfx_0_bitmap_65536, 1, &xscr, 1, &yscr,&cliprect, TRANSPARENCY_PEN,0); | |
| 746 | 746 | } |
| 747 | 747 | break; |
| 748 | 748 | case 0x01: |
| r1461 | r1462 | |
| 755 | 755 | { |
| 756 | 756 | xscr = sys.crtc.hbegin-(sys.crtc.reg[16] & 0x1ff); |
| 757 | 757 | yscr = sys.crtc.vbegin-(sys.crtc.reg[17] & 0x1ff); |
| 758 | copyscrollbitmap(bitmap, x68k_gfx_1_bitmap_256, 1, &xscr, 1, &yscr, &cliprect, TRANSPARENCY_PEN,0); | |
| 758 | copyscrollbitmap(bitmap, x68k_gfx_1_bitmap_256, 1, &xscr, 1, &yscr, &cliprect, TRANSPARENCY_PEN,0); | |
| 759 | 759 | } |
| 760 | 760 | if(sys.video.reg[2] & 0x0001 && sys.video.reg[2] & 0x0002 && priority == sys.video.gfxlayer_pri[0]) |
| 761 | 761 | { |
| 762 | 762 | xscr = sys.crtc.hbegin-(sys.crtc.reg[12] & 0x1ff); |
| 763 | 763 | yscr = sys.crtc.vbegin-(sys.crtc.reg[13] & 0x1ff); |
| 764 | copyscrollbitmap(bitmap, x68k_gfx_0_bitmap_256, 1, &xscr, 1, &yscr, &cliprect, TRANSPARENCY_PEN,0); | |
| 764 | copyscrollbitmap(bitmap, x68k_gfx_0_bitmap_256, 1, &xscr, 1, &yscr, &cliprect, TRANSPARENCY_PEN,0); | |
| 765 | 765 | } |
| 766 | 766 | break; |
| 767 | 767 | case 0x00: |
| r1461 | r1462 | |
| 774 | 774 | { |
| 775 | 775 | xscr = sys.crtc.hbegin-(sys.crtc.reg[18] & 0x1ff); |
| 776 | 776 | yscr = sys.crtc.vbegin-(sys.crtc.reg[19] & 0x1ff); |
| 777 | copyscrollbitmap(bitmap, x68k_get_gfx_pri(3,GFX16), 1, &xscr, 1, &yscr ,&cliprect, TRANSPARENCY_PEN,0); | |
| 777 | copyscrollbitmap(bitmap, x68k_get_gfx_pri(3,GFX16), 1, &xscr, 1, &yscr ,&cliprect, TRANSPARENCY_PEN,0); | |
| 778 | 778 | } |
| 779 | 779 | if(sys.video.reg[2] & 0x0004) // Pri2 |
| 780 | 780 | { |
| 781 | 781 | xscr = sys.crtc.hbegin-(sys.crtc.reg[16] & 0x1ff); |
| 782 | 782 | yscr = sys.crtc.vbegin-(sys.crtc.reg[17] & 0x1ff); |
| 783 | copyscrollbitmap(bitmap, x68k_get_gfx_pri(2,GFX16), 1, &xscr, 1, &yscr ,&cliprect, TRANSPARENCY_PEN,0); | |
| 783 | copyscrollbitmap(bitmap, x68k_get_gfx_pri(2,GFX16), 1, &xscr, 1, &yscr ,&cliprect, TRANSPARENCY_PEN,0); | |
| 784 | 784 | } |
| 785 | 785 | if(sys.video.reg[2] & 0x0002) // Pri1 |
| 786 | 786 | { |
| 787 | 787 | xscr = sys.crtc.hbegin-(sys.crtc.reg[14] & 0x1ff); |
| 788 | 788 | yscr = sys.crtc.vbegin-(sys.crtc.reg[15] & 0x1ff); |
| 789 | copyscrollbitmap(bitmap, x68k_get_gfx_pri(1,GFX16), 1, &xscr, 1, &yscr ,&cliprect, TRANSPARENCY_PEN,0); | |
| 789 | copyscrollbitmap(bitmap, x68k_get_gfx_pri(1,GFX16), 1, &xscr, 1, &yscr ,&cliprect, TRANSPARENCY_PEN,0); | |
| 790 | 790 | } |
| 791 | 791 | if(sys.video.reg[2] & 0x0001) // Pri0 |
| 792 | 792 | { |
| 793 | 793 | xscr = sys.crtc.hbegin-(sys.crtc.reg[12] & 0x1ff); |
| 794 | 794 | yscr = sys.crtc.vbegin-(sys.crtc.reg[13] & 0x1ff); |
| 795 | copyscrollbitmap(bitmap, x68k_get_gfx_pri(0,GFX16), 1, &xscr, 1, &yscr ,&cliprect, TRANSPARENCY_PEN,0); | |
| 795 | copyscrollbitmap(bitmap, x68k_get_gfx_pri(0,GFX16), 1, &xscr, 1, &yscr ,&cliprect, TRANSPARENCY_PEN,0); | |
| 796 | 796 | } |
| 797 | 797 | break; |
| 798 | 798 | } |
| r1461 | r1462 | |
| 1082 | 1082 | #ifdef MAME_DEBUG |
| 1083 | 1083 | if(!input_code_pressed(KEYCODE_Q)) |
| 1084 | 1084 | #endif |
| 1085 | copyscrollbitmap(bitmap, x68k_text_bitmap, 1, &xscr, 1, &yscr, &rect, TRANSPARENCY_PEN,0x100); | |
| 1085 | copyscrollbitmap(bitmap, x68k_text_bitmap, 1, &xscr, 1, &yscr, &rect, TRANSPARENCY_PEN,0x100); | |
| 1086 | 1086 | } |
| 1087 | 1087 | } |
| 1088 | 1088 |
| r1461 | r1462 | |
|---|---|---|
| 136 | 136 | shifter.ir[shifter.bitplane] = (RAM[1] << 8) | RAM[0]; |
| 137 | 137 | shifter.bitplane++; |
| 138 | 138 | shifter.ofs += 2; |
| 139 | ||
| 139 | ||
| 140 | 140 | if (shifter.bitplane == 4) |
| 141 | 141 | { |
| 142 | 142 | shifter.bitplane = 0; |
| 143 | ||
| 143 | ||
| 144 | 144 | shifter.rr[0] = shifter.ir[0]; |
| 145 | 145 | shifter.rr[1] = shifter.ir[1]; |
| 146 | 146 | shifter.rr[2] = shifter.ir[2]; |
| r1461 | r1462 | |
| 215 | 215 | case 0x01: |
| 216 | 216 | return (shifter.base >> 8) & 0xff; |
| 217 | 217 | } |
| 218 | ||
| 218 | ||
| 219 | 219 | return 0; |
| 220 | 220 | } |
| 221 | 221 | |
| r1461 | r1462 | |
| 276 | 276 | { |
| 277 | 277 | return shifter.palette[offset]; |
| 278 | 278 | } |
| 279 | ||
| 279 | ||
| 280 | 280 | WRITE16_HANDLER( atarist_shifter_palette_w ) |
| 281 | 281 | { |
| 282 | 282 | shifter.palette[offset] = data; |
| r1461 | r1462 | |
| 368 | 368 | |
| 369 | 369 | /* Atari ST Blitter */ |
| 370 | 370 | |
| 371 | static const int BLITTER_NOPS[16][4] = | |
| 371 | static const int BLITTER_NOPS[16][4] = | |
| 372 | 372 | { |
| 373 | 373 | { 1, 1, 1, 1 }, |
| 374 | 374 | { 2, 2, 3, 3 }, |
| r1461 | r1462 | |
| 471 | 471 | { |
| 472 | 472 | blitter.src += blitter.src_inc_x; |
| 473 | 473 | blitter.dst += blitter.dst_inc_x; |
| 474 | ||
| 474 | ||
| 475 | 475 | if (blitter.xcount == 1) |
| 476 | 476 | { |
| 477 | 477 | if (!(blitter.skew & ATARIST_BLITTER_SKEW_NFSR)) |
| r1461 | r1462 | |
|---|---|---|
| 71 | 71 | int pen; |
| 72 | 72 | UINT8 data; |
| 73 | 73 | |
| 74 | for (y=0; y<256; y++) | |
| 74 | for (y=0; y<256; y++) | |
| 75 | 75 | for (x=0; x<256; x+=4) |
| 76 | 76 | { |
| 77 | 77 | data = lviv_video_ram[y*64+x/4]; |
| r1461 | r1462 | |
|---|---|---|
| 113 | 113 | * had these hardwired values: */ |
| 114 | 114 | static UINT8 pc1512_defaults[] = |
| 115 | 115 | { |
| 116 | 113, 80, 90, 10, 127, 6, 100, 112, 2 | |
| 116 | 113, 80, 90, 10, 127, 6, 100, 112, 2 | |
| 117 | 117 | }; |
| 118 | 118 | |
| 119 | 119 | /*************************************************************************** |
| r1461 | r1462 | |
| 201 | 201 | } |
| 202 | 202 | } |
| 203 | 203 | |
| 204 | int mscrtc6845_get_char_columns(struct mscrtc6845 *crtc) | |
| 205 | { | |
| 204 | int mscrtc6845_get_char_columns(struct mscrtc6845 *crtc) | |
| 205 | { | |
| 206 | 206 | return CRTC6845_CHAR_COLUMNS; |
| 207 | 207 | } |
| 208 | 208 | |
| 209 | int mscrtc6845_get_char_height(struct mscrtc6845 *crtc) | |
| 209 | int mscrtc6845_get_char_height(struct mscrtc6845 *crtc) | |
| 210 | 210 | { |
| 211 | 211 | return CRTC6845_CHAR_HEIGHT; |
| 212 | 212 | } |
| 213 | 213 | |
| 214 | int mscrtc6845_get_char_lines(struct mscrtc6845 *crtc) | |
| 215 | { | |
| 214 | int mscrtc6845_get_char_lines(struct mscrtc6845 *crtc) | |
| 215 | { | |
| 216 | 216 | return CRTC6845_CHAR_LINES; |
| 217 | 217 | } |
| 218 | 218 | |
| 219 | int mscrtc6845_get_start(struct mscrtc6845 *crtc) | |
| 219 | int mscrtc6845_get_start(struct mscrtc6845 *crtc) | |
| 220 | 220 | { |
| 221 | 221 | return CRTC6845_VIDEO_START; |
| 222 | 222 | } |
| 223 | 223 | |
| 224 | 224 | |
| 225 | 225 | void mscrtc6845_set_char_columns(struct mscrtc6845 *crtc, UINT8 columns) |
| 226 | { | |
| 226 | { | |
| 227 | 227 | crtc->reg[1] = columns; |
| 228 | 228 | } |
| 229 | 229 | |
| 230 | 230 | |
| 231 | 231 | void mscrtc6845_set_char_lines(struct mscrtc6845 *crtc, UINT8 lines) |
| 232 | { | |
| 232 | { | |
| 233 | 233 | crtc->reg[6] = lines; |
| 234 | 234 | } |
| 235 | 235 | |
| r1461 | r1462 | |
| 308 | 308 | break; |
| 309 | 309 | } |
| 310 | 310 | |
| 311 | /* since the PC1512 does not support the number of lines register directly, | |
| 311 | /* since the PC1512 does not support the number of lines register directly, | |
| 312 | 312 | * this value is keyed off of register 9 |
| 313 | 313 | */ |
| 314 | 314 | if ((crtc->config.personality == M6845_PERSONALITY_PC1512) && (idx == 9)) |
| r1461 | r1462 | |
|---|---|---|
| 66 | 66 | |
| 67 | 67 | /* prom at 0x0f800, user chars from 0x0fc00 */ |
| 68 | 68 | char_addr = 0x0f800 + (ch<<3); |
| 69 | ||
| 69 | ||
| 70 | 70 | for (cheight=0; cheight<8; cheight++) |
| 71 | 71 | { |
| 72 | 72 | int byte; |
| r1461 | r1462 | |
|---|---|---|
| 129 | 129 | case GRAPH_200_BW: |
| 130 | 130 | x=(offset&0x3fff)%80; |
| 131 | 131 | y=(offset&0x3fff)/80/2; |
| 132 | break; | |
| 132 | break; | |
| 133 | 133 | case GRAPH_400_BW: |
| 134 | 134 | x=(offset&0x3fff)%80; |
| 135 | 135 | y=(offset&0x3fff)/80/4+(offset/0x4000)*50; |
| r1461 | r1462 | |
| 289 | 289 | } |
| 290 | 290 | } |
| 291 | 291 | |
| 292 | ||
| 292 | ||
| 293 | 293 | if (rh5) memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0xc000, 0xefff, 0, 0, rh5); |
| 294 | 294 | if (wh5) memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0xc000, 0xefff, 0, 0, wh5); |
| 295 | 295 | if (rh6) memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0xf000, 0xffff, 0, 0, rh6); |
| r1461 | r1462 | |
| 677 | 677 | case 0xc0: |
| 678 | 678 | blink_period=32; |
| 679 | 679 | break; |
| 680 | } | |
| 680 | } | |
| 681 | 681 | if((data&0x3f)==0x13) { |
| 682 | 682 | text_height=20; |
| 683 | 683 | return; |
| r1461 | r1462 | |
|---|---|---|
| 86 | 86 | |
| 87 | 87 | if (video_update) |
| 88 | 88 | { |
| 89 | if ((pc_current_width != w) || (pc_current_height != h)) | |
| 89 | if ((pc_current_width != w) || (pc_current_height != h)) | |
| 90 | 90 | { |
| 91 | 91 | pc_current_width = w; |
| 92 | 92 | pc_current_height = h; |
| r1461 | r1462 | |
|---|---|---|
| 70 | 70 | pen1^=1; |
| 71 | 71 | pen0^=1; |
| 72 | 72 | } |
| 73 | ||
| 73 | ||
| 74 | 74 | pen0 = machine->pens[pen0]; |
| 75 | 75 | pen1 = machine->pens[pen1]; |
| 76 | 76 |
| r1461 | r1462 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | 3 | video/oric.c |
| 4 | ||
| 4 | ||
| 5 | 5 | All graphic effects are supported including mid-line changes. |
| 6 | 6 | There may be some small bugs. |
| 7 | 7 | |
| 8 | 8 | TODO: |
| 9 | 9 | - speed up this code a bit? |
| 10 | ||
| 10 | ||
| 11 | 11 | ***************************************************************************/ |
| 12 | 12 | |
| 13 | 13 | #include "driver.h" |
| r1461 | r1462 | |
| 41 | 41 | unsigned char *char_data; |
| 42 | 42 | /* base of char data */ |
| 43 | 43 | unsigned char *char_base; |
| 44 | ||
| 44 | ||
| 45 | 45 | /* if (1<<3), display graphics, if 0, hide graphics */ |
| 46 | 46 | int flash_state; |
| 47 | 47 | /* current count */ |
| r1461 | r1462 | |
| 56 | 56 | /* update flash count */ |
| 57 | 57 | vh_state.flash_count++; |
| 58 | 58 | if (vh_state.flash_count == 30) |
| 59 | { | |
| 59 | { | |
| 60 | 60 | vh_state.flash_count = 0; |
| 61 | 61 | vh_state.flash_state ^=(1<<3); |
| 62 | 62 | oric_vh_update_flash(); |
| r1461 | r1462 | |
| 91 | 91 | return; |
| 92 | 92 | } |
| 93 | 93 | } |
| 94 | ||
| 95 | 94 | |
| 95 | ||
| 96 | 96 | /* show */ |
| 97 | 97 | vh_state.active_foreground_colour = vh_state.foreground_colour; |
| 98 | 98 | vh_state.active_background_colour = vh_state.background_colour; |
| r1461 | r1462 | |
| 166 | 166 | /* set screen memory base and standard charset location for this mode */ |
| 167 | 167 | vh_state.read_addr = 0x0a000; |
| 168 | 168 | if (oric_ram) |
| 169 | vh_state.char_base = oric_ram + (unsigned long)0x09800; | |
| 169 | vh_state.char_base = oric_ram + (unsigned long)0x09800; | |
| 170 | 170 | else |
| 171 | 171 | vh_state.char_base = memory_get_read_ptr(0, ADDRESS_SPACE_PROGRAM, 0x09800); |
| 172 | ||
| 172 | ||
| 173 | 173 | /* changing the mode also changes the position of the standard charset |
| 174 | 174 | and alternative charset */ |
| 175 | 175 | oric_refresh_charset(); |
| r1461 | r1462 | |
| 182 | 182 | vh_state.char_base = oric_ram + (unsigned long)0x0b400; |
| 183 | 183 | else |
| 184 | 184 | vh_state.char_base = memory_get_read_ptr(0, ADDRESS_SPACE_PROGRAM, 0x0b400); |
| 185 | ||
| 185 | ||
| 186 | 186 | /* changing the mode also changes the position of the standard charset |
| 187 | 187 | and alternative charset */ |
| 188 | 188 | oric_refresh_charset(); |
| r1461 | r1462 | |
| 203 | 203 | int i; |
| 204 | 204 | int pens[2]; |
| 205 | 205 | int px; |
| 206 | ||
| 206 | ||
| 207 | 207 | /* invert? */ |
| 208 | 208 | if (invert_flag) |
| 209 | 209 | { |
| r1461 | r1462 | |
| 213 | 213 | |
| 214 | 214 | pens[1] = Machine->pens[fg]; |
| 215 | 215 | pens[0] = Machine->pens[bg]; |
| 216 | ||
| 216 | ||
| 217 | 217 | px = x; |
| 218 | 218 | for (i=0; i<6; i++) |
| 219 | 219 | { |
| r1461 | r1462 | |
| 226 | 226 | } |
| 227 | 227 | } |
| 228 | 228 | |
| 229 | ||
| 230 | 229 | |
| 231 | 230 | |
| 232 | 231 | |
| 232 | ||
| 233 | 233 | /*************************************************************************** |
| 234 | 234 | oric_vh_screenrefresh |
| 235 | 235 | ***************************************************************************/ |
| r1461 | r1462 | |
| 254 | 254 | else |
| 255 | 255 | { |
| 256 | 256 | hires_active = 0; |
| 257 | } | |
| 257 | } | |
| 258 | 258 | |
| 259 | 259 | |
| 260 | 260 | for (y = 0; y < 224; y++) |
| r1461 | r1462 | |
| 267 | 267 | oric_vh_update_attribute((1<<3)); |
| 268 | 268 | |
| 269 | 269 | oric_vh_update_attribute((1<<4)); |
| 270 | ||
| 270 | ||
| 271 | 271 | for (byte_offset=0; byte_offset<40; byte_offset++) |
| 272 | 272 | { |
| 273 | 273 | int c; |
| r1461 | r1462 | |
| 287 | 287 | int char_line; |
| 288 | 288 | |
| 289 | 289 | char_line = (y>>3); |
| 290 | read_addr = (unsigned long)read_addr_base + (unsigned long)byte_offset + (unsigned long)(char_line*40); | |
| 290 | read_addr = (unsigned long)read_addr_base + (unsigned long)byte_offset + (unsigned long)(char_line*40); | |
| 291 | 291 | } |
| 292 | 292 | } |
| 293 | 293 | else |
| r1461 | r1462 | |
| 295 | 295 | int char_line; |
| 296 | 296 | |
| 297 | 297 | char_line = ((y-200)>>3); |
| 298 | read_addr = (unsigned long)read_addr_base + (unsigned long)byte_offset + (unsigned long)(char_line*40); | |
| 298 | read_addr = (unsigned long)read_addr_base + (unsigned long)byte_offset + (unsigned long)(char_line*40); | |
| 299 | 299 | } |
| 300 | 300 | |
| 301 | 301 | /* fetch data */ |
| r1461 | r1462 | |
| 310 | 310 | oric_vh_render_6pixels(bitmap,x,y,vh_state.active_foreground_colour, vh_state.active_background_colour, 0,(c & 0x080)); |
| 311 | 311 | |
| 312 | 312 | if (y<200) |
| 313 | { | |
| 313 | { | |
| 314 | 314 | /* is hires active? */ |
| 315 | 315 | if (vh_state.mode & (1<<2)) |
| 316 | 316 | { |
| r1461 | r1462 | |
| 320 | 320 | { |
| 321 | 321 | hires_active = 0; |
| 322 | 322 | } |
| 323 | ||
| 323 | ||
| 324 | 324 | read_addr_base = vh_state.read_addr; |
| 325 | 325 | } |
| 326 | 326 | } |
| r1461 | r1462 | |
| 345 | 345 | |
| 346 | 346 | /* is double height set? */ |
| 347 | 347 | if (vh_state.text_attributes & (1<<1)) |
| 348 | { | |
| 348 | { | |
| 349 | 349 | /* if char line is even, top half of character is displayed, |
| 350 | 350 | if char line is odd, bottom half of character is displayed */ |
| 351 | 351 | int double_height_flag = ((y>>3) & 0x01); |
| r1461 | r1462 | |
| 353 | 353 | /* calculate line to fetch */ |
| 354 | 354 | ch_line = (ch_line>>1) + (double_height_flag<<2); |
| 355 | 355 | } |
| 356 | ||
| 356 | ||
| 357 | 357 | /* fetch pixel data for this char line */ |
| 358 | 358 | char_data = vh_state.char_data[(char_index<<3) | ch_line] & 0x03f; |
| 359 | 359 | |
| 360 | 360 | /* draw! */ |
| 361 | 361 | oric_vh_render_6pixels(bitmap,x,y, |
| 362 | vh_state.active_foreground_colour, | |
| 362 | vh_state.active_foreground_colour, | |
| 363 | 363 | vh_state.active_background_colour, char_data, (c & 0x080)); |
| 364 | 364 | } |
| 365 | 365 | |
| 366 | 366 | } |
| 367 | ||
| 368 | x=x+6; | |
| 367 | ||
| 368 | x=x+6; | |
| 369 | 369 | } |
| 370 | ||
| 370 | ||
| 371 | 371 | /* after 200 lines have been drawn, force a change of the read address */ |
| 372 | 372 | /* there are 200 lines of hires/text mode, then 24 lines of text mode */ |
| 373 | 373 | /* the mode can't be changed in the last 24 lines. */ |
| r1461 | r1462 | |
|---|---|---|
| 70 | 70 | static const POCKETC_FIGURE line={ /* simple line */ |
| 71 | 71 | "11111", |
| 72 | 72 | "11111", |
| 73 | "11111e" | |
| 73 | "11111e" | |
| 74 | 74 | }; |
| 75 | static const POCKETC_FIGURE busy={ | |
| 75 | static const POCKETC_FIGURE busy={ | |
| 76 | 76 | "11 1 1 11 1 1", |
| 77 | 77 | "1 1 1 1 1 1 1", |
| 78 | 78 | "11 1 1 1 1 1", |
| 79 | 79 | "1 1 1 1 1 1", |
| 80 | 80 | "11 1 11 1e" |
| 81 | }, def={ | |
| 81 | }, def={ | |
| 82 | 82 | "11 111 111", |
| 83 | 83 | "1 1 1 1", |
| 84 | 84 | "1 1 111 11", |
| 85 | 85 | "1 1 1 1", |
| 86 | "11 111 1e" | |
| 86 | "11 111 1e" | |
| 87 | 87 | }, shift={ |
| 88 | 88 | " 11 1 1 1 111 111", |
| 89 | 89 | "1 1 1 1 1 1", |
| 90 | 90 | " 1 111 1 11 1", |
| 91 | 91 | " 1 1 1 1 1 1", |
| 92 | "11 1 1 1 1 1e" | |
| 92 | "11 1 1 1 1 1e" | |
| 93 | 93 | }, hyp={ |
| 94 | 94 | "1 1 1 1 11", |
| 95 | 95 | "1 1 1 1 1 1", |
| 96 | 96 | "111 1 1 11", |
| 97 | 97 | "1 1 1 1", |
| 98 | "1 1 1 1e" | |
| 98 | "1 1 1 1e" | |
| 99 | 99 | }, de={ |
| 100 | 100 | "11 111", |
| 101 | 101 | "1 1 1", |
| r1461 | r1462 | |
| 107 | 107 | "1", |
| 108 | 108 | "1 1", |
| 109 | 109 | "1 1", |
| 110 | " 11e" | |
| 110 | " 11e" | |
| 111 | 111 | }, rad={ |
| 112 | 112 | "11 1 11", |
| 113 | 113 | "1 1 1 1 1 1", |
| r1461 | r1462 | |
| 131 | 131 | "1", |
| 132 | 132 | "111", |
| 133 | 133 | "1", |
| 134 | "111e" | |
| 134 | "111e" | |
| 135 | 135 | }, kana={ // katakana charset |
| 136 | 136 | " 1 1 ", |
| 137 | 137 | " 11111 111", |
| 138 | 138 | " 1 1 1 ", |
| 139 | 139 | " 1 1 1 ", |
| 140 | "1 1 1e" | |
| 140 | "1 1 1e" | |
| 141 | 141 | }, shoo={ // minor |
| 142 | 142 | " 1 ", |
| 143 | 143 | " 1 1 1 ", |
| 144 | 144 | "1 1 1", |
| 145 | 145 | " 1 ", |
| 146 | 146 | " 1e" |
| 147 | }, sml={ | |
| 147 | }, sml={ | |
| 148 | 148 | " 11 1 1 1", |
| 149 | 149 | "1 111 1", |
| 150 | 150 | " 1 1 1 1", |
| 151 | 151 | " 1 1 1 1", |
| 152 | "11 1 1 111e" | |
| 152 | "11 1 1 111e" | |
| 153 | 153 | }; |
| 154 | 154 | |
| 155 | 155 | VIDEO_UPDATE( pc1403 ) |
| 156 | 156 | { |
| 157 | 157 | int x, y, i, j; |
| 158 | 158 | int color[3]; |
| 159 | ||
| 159 | ||
| 160 | 160 | bitmap_fill(bitmap, cliprect, 5); |
| 161 | ||
| 161 | ||
| 162 | 162 | /* HJB: we cannot initialize array with values from other arrays, thus... */ |
| 163 | 163 | color[0] = machine->pens[pocketc_colortable[CONTRAST][0]]; |
| 164 | 164 | color[2] = machine->pens[pocketc_colortable[CONTRAST][1]]; |
| r1461 | r1462 | |
| 202 | 202 | 0, TRANSPARENCY_NONE,0); |
| 203 | 203 | } |
| 204 | 204 | } |
| 205 | /* if display is off, busy is always visible? it seems to behave like | |
| 205 | /* if display is off, busy is always visible? it seems to behave like | |
| 206 | 206 | that. */ |
| 207 | 207 | /* But if computer is off, busy is hidden. */ |
| 208 | 208 | if(!(pc1403_portc&8)) |
| r1461 | r1462 | |
| 211 | 211 | else pocketc_draw_special(bitmap,RIGHT,DOWN-13,busy,color[2]); |
| 212 | 212 | } |
| 213 | 213 | else pocketc_draw_special(bitmap,RIGHT,DOWN-13,busy,color[0]); |
| 214 | ||
| 214 | ||
| 215 | 215 | pocketc_draw_special(bitmap,RIGHT+18,DOWN-13,def, |
| 216 | 216 | pc1403_lcd.reg[0x3d]&2?color[1]:color[0]); |
| 217 | 217 | pocketc_draw_special(bitmap,RIGHT+43,DOWN-13,shift, |
| r1461 | r1462 | |
| 239 | 239 | pc1403_lcd.reg[0x7c]&2?color[1]:color[0]); |
| 240 | 240 | pocketc_draw_special(bitmap,RIGHT+281,DOWN-13,e, |
| 241 | 241 | pc1403_lcd.reg[0x7c]&1?color[1]:color[0]); |
| 242 | ||
| 242 | ||
| 243 | 243 | pocketc_draw_special(bitmap, RIGHT+10,DOWN+27,line /* empty */, |
| 244 | 244 | (pc1403_lcd.reg[0x3c]&0x40) ?color[1]:color[0]); |
| 245 | 245 | pocketc_draw_special(bitmap,RIGHT+31,DOWN+27,line /*calc*/, |
| r1461 | r1462 | |
| 250 | 250 | (pc1403_lcd.reg[0x3d]&0x10) ? color[1]:color[0]); |
| 251 | 251 | pocketc_draw_special(bitmap, RIGHT+94,DOWN+27,line /* empty */, |
| 252 | 252 | (pc1403_lcd.reg[0x3c]&0x20) ? color[1]:color[0]); |
| 253 | ||
| 254 | pocketc_draw_special(bitmap,RIGHT+232,DOWN+27,line/*matrix*/, | |
| 253 | ||
| 254 | pocketc_draw_special(bitmap,RIGHT+232,DOWN+27,line/*matrix*/, | |
| 255 | 255 | pc1403_lcd.reg[0x3c]&0x10?color[1]:color[0]); |
| 256 | 256 | pocketc_draw_special(bitmap,RIGHT+253,DOWN+27,line/*stat*/, |
| 257 | 257 | pc1403_lcd.reg[0x3c]&8?color[1]:color[0]); |
| 258 | 258 | pocketc_draw_special(bitmap,RIGHT+274,DOWN+27,line/*print*/, |
| 259 | 259 | pc1403_lcd.reg[0x7c]&0x40?color[1]:color[0]); |
| 260 | ||
| 260 | ||
| 261 | 261 | return 0; |
| 262 | 262 | } |
| 263 | 263 |
| r1461 | r1462 | |
|---|---|---|
| 212 | 212 | } |
| 213 | 213 | |
| 214 | 214 | return double_to_attotime( |
| 215 | attotime_to_double(video_screen_get_time_until_pos(0, cursor_scanline, 0)) + | |
| 215 | attotime_to_double(video_screen_get_time_until_pos(0, cursor_scanline, 0)) + | |
| 216 | 216 | scanline_period * cursor_hfrac); |
| 217 | 217 | } |
| 218 | 218 |
| r1461 | r1462 | |
|---|---|---|
| 23 | 23 | |
| 24 | 24 | const unsigned char mda_palette[4][3] = { |
| 25 | 25 | { 0x00,0x00,0x00 }, |
| 26 | { 0x00,0x55,0x00 }, | |
| 27 | { 0x00,0xaa,0x00 }, | |
| 26 | { 0x00,0x55,0x00 }, | |
| 27 | { 0x00,0xaa,0x00 }, | |
| 28 | 28 | { 0x00,0xff,0x00 } |
| 29 | 29 | }; |
| 30 | 30 | |
| r1461 | r1462 | |
| 52 | 52 | |
| 53 | 53 | /* to be done: |
| 54 | 54 | only 2 digital color lines to mda/hercules monitor |
| 55 | (maximal 4 colors) | |
| 55 | (maximal 4 colors) | |
| 56 | 56 | PC200 uses different attributes from IBM. |
| 57 | 57 | */ |
| 58 | 58 | const unsigned short mda_colortable[] = |
| r1461 | r1462 | |
| 68 | 68 | /* nb: This---------------------------------------------^ should refer to a "dim" colour which |
| 69 | 69 | * we don't do yet */ |
| 70 | 70 | |
| 71 | /* flashing is done by dirtying the videoram buffer positions with attr bit #7 set | |
| 71 | /* flashing is done by dirtying the videoram buffer positions with attr bit #7 set | |
| 72 | 72 | * These attributes are used for the flashing characters when they're visible. */ |
| 73 | 73 | 0, 0, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 0, 0,10, 0,10, 0,10, 0,10, 0,10, 0,10, 0,10, |
| 74 | 74 | 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0,10, 0,10, 0,10, 0,10, 0,10, 0,10, 0,10, 0,10, |
| r1461 | r1462 | |
| 158 | 158 | int i, y; |
| 159 | 159 | |
| 160 | 160 | /* Support up to 4 fonts for PC200 */ |
| 161 | for (i = 0; i < 4; i++) | |
| 161 | for (i = 0; i < 4; i++) | |
| 162 | 162 | { |
| 163 | 163 | mda.gfx_char[i] = Machine->gfx[gfx_char + (i & gfx_char_mask)]; |
| 164 | 164 | } |
| r1461 | r1462 | |
| 314 | 314 | |
| 315 | 315 | for (sy=0, r.min_y=0, r.max_y=height-1; sy<lines; sy++, r.min_y+=height,r.max_y+=height) { |
| 316 | 316 | |
| 317 | for (sx=0, r.min_x=0, r.max_x = char_width-1; sx<columns; | |
| 317 | for (sx=0, r.min_x=0, r.max_x = char_width-1; sx<columns; | |
| 318 | 318 | sx++, offs=(offs+2)&0x3fff, r.min_x += char_width, r.max_x += char_width) { |
| 319 | 319 | if (!dirtybuffer || dirtybuffer[offs] || dirtybuffer[offs+1]) { |
| 320 | ||
| 321 | attr = videoram[offs+1]; | |
| 320 | ||
| 321 | attr = videoram[offs+1]; | |
| 322 | 322 | drawgfx(bitmap, mda.gfx_char[CGA_FONT], videoram[offs], attr, |
| 323 | 323 | 0,0,r.min_x,r.min_y,&r,TRANSPARENCY_NONE,0); |
| 324 | /* Underlining */ | |
| 325 | if ((attr & 7) == 1) | |
| 326 | plot_box(bitmap, r.min_x, r.min_y + 12, char_width, | |
| 324 | /* Underlining */ | |
| 325 | if ((attr & 7) == 1) | |
| 326 | plot_box(bitmap, r.min_x, r.min_y + 12, char_width, | |
| 327 | 327 | 1, Machine->pens[2 + (attr & 8)]); |
| 328 | 328 | |
| 329 | 329 | if (cursor.on&&(mda.pc_framecnt&32)&&(offs==cursor.pos*2)) { |
| 330 | 330 | int k=height-cursor.top; |
| 331 | 331 | rectangle rect2=r; |
| 332 | rect2.min_y+=cursor.top; | |
| 332 | rect2.min_y+=cursor.top; | |
| 333 | 333 | if (cursor.bottom<height) k=cursor.bottom-cursor.top+1; |
| 334 | 334 | |
| 335 | 335 | if (k>0) |
| 336 | plot_box(bitmap, r.min_x, | |
| 337 | r.min_y+cursor.top, | |
| 336 | plot_box(bitmap, r.min_x, | |
| 337 | r.min_y+cursor.top, | |
| 338 | 338 | char_width, k, Machine->pens[2/*?*/]); |
| 339 | 339 | } |
| 340 | 340 | |
| r1461 | r1462 | |
| 369 | 369 | |
| 370 | 370 | for (sy=0, r.min_y=0, r.max_y=height-1; sy<lines; sy++, r.min_y+=height,r.max_y+=height) { |
| 371 | 371 | |
| 372 | for (sx=0, r.min_x=0, r.max_x = char_width-1; sx<columns; | |
| 372 | for (sx=0, r.min_x=0, r.max_x = char_width-1; sx<columns; | |
| 373 | 373 | sx++, offs=(offs+2)&0x3fff, r.min_x += char_width, r.max_x += char_width) { |
| 374 | 374 | |
| 375 | 375 | if (!dirtybuffer || dirtybuffer[offs] || dirtybuffer[offs+1]) { |
| 376 | ||
| 376 | ||
| 377 | 377 | int attr = videoram[offs+1]; |
| 378 | 378 | if (attr & 0x80) /* blinking ? */ |
| 379 | 379 | { |
| r1461 | r1462 | |
| 382 | 382 | |
| 383 | 383 | drawgfx(bitmap, mda.gfx_char[CGA_FONT], videoram[offs], attr, |
| 384 | 384 | 0,0,r.min_x,r.min_y,&r,TRANSPARENCY_NONE,0); |
| 385 | /* Underlining */ | |
| 386 | if ((attr & 7) == 1) | |
| 387 | plot_box(bitmap, r.min_x, r.min_y + 12, char_width, | |
| 385 | /* Underlining */ | |
| 386 | if ((attr & 7) == 1) | |
| 387 | plot_box(bitmap, r.min_x, r.min_y + 12, char_width, | |
| 388 | 388 | 1, Machine->pens[2 + (attr & 8)]); |
| 389 | 389 | |
| 390 | 390 | // if ((cursor.on)&&(offs==cursor.pos*2)) { |
| 391 | 391 | if (cursor.on&&(mda.pc_framecnt&32)&&(offs==cursor.pos*2)) { |
| 392 | 392 | int k=height-cursor.top; |
| 393 | 393 | rectangle rect2=r; |
| 394 | rect2.min_y+=cursor.top; | |
| 394 | rect2.min_y+=cursor.top; | |
| 395 | 395 | if (cursor.bottom<height) k=cursor.bottom-cursor.top+1; |
| 396 | 396 | |
| 397 | 397 | if (k>0) |
| 398 | plot_box(bitmap, r.min_x, | |
| 399 | r.min_y+cursor.top, | |
| 398 | plot_box(bitmap, r.min_x, | |
| 399 | r.min_y+cursor.top, | |
| 400 | 400 | char_width, k, Machine->pens[2/*?*/]); |
| 401 | 401 | } |
| 402 | 402 |
| r1461 | r1462 | |
|---|---|---|
| 51 | 51 | |
| 52 | 52 | VIDEO_START( abc800m ) |
| 53 | 53 | { |
| 54 | tx_tilemap = tilemap_create(abc800_get_tile_info, tilemap_scan_rows, | |
| 54 | tx_tilemap = tilemap_create(abc800_get_tile_info, tilemap_scan_rows, | |
| 55 | 55 | TILEMAP_TYPE_PEN, 6, 10, 80, 24); |
| 56 | 56 | } |
| 57 | 57 | |
| r1461 | r1462 | |
| 99 | 99 | |
| 100 | 100 | VIDEO_START( abc802 ) |
| 101 | 101 | { |
| 102 | tx_tilemap_40 = tilemap_create(abc802_get_tile_info_40, tilemap_scan_rows, | |
| 102 | tx_tilemap_40 = tilemap_create(abc802_get_tile_info_40, tilemap_scan_rows, | |
| 103 | 103 | TILEMAP_TYPE_PEN, 12, 10, 40, 24); |
| 104 | 104 | |
| 105 | tx_tilemap = tilemap_create(abc802_get_tile_info_80, tilemap_scan_rows, | |
| 105 | tx_tilemap = tilemap_create(abc802_get_tile_info_80, tilemap_scan_rows, | |
| 106 | 106 | TILEMAP_TYPE_PEN, 6, 10, 80, 24); |
| 107 | 107 | |
| 108 | 108 | abc802_columns = 80; |
| r1461 | r1462 | |
|---|---|---|
| 1 | 1 | |
| 2 | /* CGA palettes | |
| 2 | /* CGA palettes | |
| 3 | 3 | * |
| 4 | 4 | * The first 16 are for RGB monitors |
| 5 | 5 | * The next 16 are for greyscale modes |
| 6 | 6 | * The next 16 are for text modes on colour composite |
| 7 | 7 | * The next 16*16 are Mode 6 (colour composite) } |
| 8 | 8 | * The next 64*16 are Mode 4 (colour composite) } both indexed by the CGA colour select register 0x3D9 |
| 9 | * | |
| 10 | */ | |
| 9 | * | |
| 10 | */ | |
| 11 | 11 | |
| 12 | 12 | const unsigned char cga_palette[1328][3] = |
| 13 | 13 | { |
| r1461 | r1462 | |
| 22 | 22 | { 0x88, 0x88, 0x88 }, { 0x99, 0x99, 0x99 }, { 0xCC, 0xCC, 0xCC }, { 0xDD, 0xDD, 0xDD }, |
| 23 | 23 | { 0xAA, 0xAA, 0xAA }, { 0xBB, 0xBB, 0xBB }, { 0xEE, 0xEE, 0xEE }, { 0xFF, 0xFF, 0xFF }, |
| 24 | 24 | /* Text mode, composite monitor */ |
| 25 | { 0x00, 0x00, 0x00 }, { 0x0E, 0x00, 0x7A }, { 0x07, 0x55, 0x00 }, { 0x02, 0x65, 0x39 }, | |
| 25 | { 0x00, 0x00, 0x00 }, { 0x0E, 0x00, 0x7A }, { 0x07, 0x55, 0x00 }, { 0x02, 0x65, 0x39 }, | |
| 26 | 26 | { 0x51, 0x00, 0x1A }, { 0x54, 0x00, 0x76 }, { 0x48, 0x63, 0x00 }, { 0x8c, 0x8c, 0x8c }, |
| 27 | 27 | { 0x38, 0x38, 0x38 }, { 0x58, 0x49, 0xD5 }, { 0x5F, 0xAD, 0x26 }, { 0x5B, 0xB9, 0xAC }, |
| 28 | 28 | { 0xAA, 0x4A, 0x5E }, { 0xA7, 0x55, 0xD2 }, { 0xA2, 0xB9, 0x31 }, { 0xE2, 0xE2, 0xE2 }, |
| r1461 | r1462 | |
| 67 | 67 | { 0x20, 0x33, 0x00 }, { 0x00, 0x85, 0x00 }, { 0x2E, 0x25, 0x28 }, { 0x00, 0x98, 0x3B }, |
| 68 | 68 | { 0xb1, 0x11, 0x00 }, { 0x6A, 0x75, 0x00 }, { 0xcc, 0x16, 0x81 }, { 0x91, 0x8e, 0x91 }, |
| 69 | 69 | /* Composite hi-res, colour reg = 8 */ |
| 70 | { 0x00, 0x00, 0x00 }, { 0x00, 0x12, 0x0F }, { 0x04, 0x00, 0x5F }, { 0x00, 0x02, 0x67 }, | |
| 70 | { 0x00, 0x00, 0x00 }, { 0x00, 0x12, 0x0F }, { 0x04, 0x00, 0x5F }, { 0x00, 0x02, 0x67 }, | |
| 71 | 71 | { 0x31, 0x00, 0x01 }, { 0x04, 0x01, 0x04 }, { 0x37, 0x00, 0x52 }, { 0x17, 0x00, 0x6d }, |
| 72 | 72 | { 0x00, 0x10, 0x00 }, { 0x00, 0x29, 0x00 }, { 0x04, 0x03, 0x04 }, { 0x00, 0x24, 0x16 }, |
| 73 | 73 | { 0x2f, 0x00, 0x00 }, { 0x07, 0x23, 0x00 }, { 0x43, 0x00, 0x08 }, { 0x25, 0x23, 0x24 }, |
| r1461 | r1462 | |
| 127 | 127 | { 0x26, 0x46, 0x73 }, { 0x2f, 0x34, 0x27 }, { 0x50, 0x00, 0x0b }, { 0x48, 0x31, 0x47 }, |
| 128 | 128 | { 0x3e, 0x70, 0x1e }, { 0x40, 0x5f, 0x00 }, { 0x57, 0x1d, 0x00 }, { 0x4a, 0x62, 0x00 }, |
| 129 | 129 | /* Composite lo-res, colour reg = 4 */ |
| 130 | { 0x52, 0x00, 0x14 }, { 0x2e, 0x32, 0x25 }, { 0x52, 0x00, 0x14 }, { 0x46, 0x2f, 0x47 }, | |
| 131 | { 0x1f, 0x09, 0x00 }, { 0x04, 0x55, 0x00 }, { 0x21, 0x0e, 0x00 }, { 0x11, 0x50, 0x02 }, | |
| 130 | { 0x52, 0x00, 0x14 }, { 0x2e, 0x32, 0x25 }, { 0x52, 0x00, 0x14 }, { 0x46, 0x2f, 0x47 }, | |
| 131 | { 0x1f, 0x09, 0x00 }, { 0x04, 0x55, 0x00 }, { 0x21, 0x0e, 0x00 }, { 0x11, 0x50, 0x02 }, | |
| 132 | 132 | { 0x52, 0x00, 0x14 }, { 0x2d, 0x33, 0x25 }, { 0x52, 0x00, 0x14 }, { 0x40, 0x36, 0x3f }, |
| 133 | 133 | { 0x5c, 0x18, 0x00 }, { 0x40, 0x5f, 0x00 }, { 0x5e, 0x19, 0x00 }, { 0x4b, 0x62, 0x00 }, |
| 134 | 134 | /* Composite lo-res, colour reg = 5 */ |
| r1461 | r1462 | |
| 152 | 152 | { 0x4d, 0x10, 0x5f }, { 0x2c, 0x33, 0x26 }, { 0x51, 0x00, 0x0f }, { 0x41, 0x35, 0x47 }, |
| 153 | 153 | { 0x5a, 0x35, 0x00 }, { 0x43, 0x5f, 0x00 }, { 0x5f, 0x15, 0x00 }, { 0x4d, 0x62, 0x00 }, |
| 154 | 154 | /* Composite lo-res, colour reg = 9 */ |
| 155 | { 0x92, 0x47, 0xd3 }, { 0x47, 0x47, 0x1b }, { 0x66, 0x00, 0x09 }, { 0x54, 0x44, 0x37 }, | |
| 155 | { 0x92, 0x47, 0xd3 }, { 0x47, 0x47, 0x1b }, { 0x66, 0x00, 0x09 }, { 0x54, 0x44, 0x37 }, | |
| 156 | 156 | { 0x15, 0x4b, 0x8a }, { 0x05, 0x55, 0x00 }, { 0x00, 0x10, 0x00 }, { 0x10, 0x52, 0x02 }, |
| 157 | 157 | { 0x40, 0x33, 0xd4 }, { 0x2f, 0x33, 0x26 }, { 0x51, 0x00, 0x0d }, { 0x3e, 0x37, 0x3e }, |
| 158 | 158 | { 0x51, 0x59, 0x75 }, { 0x3b, 0x63, 0x00 }, { 0x5b, 0x1a, 0x00 }, { 0x49, 0x64, 0x00 }, |
| r1461 | r1462 | |
| 274 | 274 | /* Composite lo-res, colour reg = 21 */ |
| 275 | 275 | { 0x06, 0x00, 0x7C }, { 0x00, 0x3B, 0xA0 }, { 0x14, 0x00, 0x93 }, { 0x00, 0x49, 0xF7 }, |
| 276 | 276 | { 0x19, 0x12, 0x13 }, { 0x02, 0x63, 0x3f }, { 0x25, 0x16, 0x2b }, { 0x09, 0x71, 0x93 }, |
| 277 | { 0x46, 0x00, 0x65 }, { 0x28, 0x45, 0x93 }, { 0x50, 0x00, 0x80 }, { 0x32, 0x55, 0xe6 }, | |
| 277 | { 0x46, 0x00, 0x65 }, { 0x28, 0x45, 0x93 }, { 0x50, 0x00, 0x80 }, { 0x32, 0x55, 0xe6 }, | |
| 278 | 278 | { 0x9c, 0x2d, 0x0c }, { 0x86, 0x78, 0x44 }, { 0xaa, 0x29, 0x33 }, { 0x92, 0x84, 0x84 }, |
| 279 | 279 | /* Composite lo-res, colour reg = 22 */ |
| 280 | 280 | { 0x05, 0x56, 0x00 }, { 0x04, 0x69, 0x32 }, { 0x21, 0x1d, 0x13 }, { 0x07, 0x76, 0x7e }, |
| r1461 | r1462 | |
| 285 | 285 | { 0x02, 0x61, 0x49 }, { 0x02, 0x61, 0x49 }, { 0x24, 0x15, 0x27 }, { 0x05, 0x73, 0x84 }, |
| 286 | 286 | { 0x02, 0x61, 0x49 }, { 0x02, 0x61, 0x49 }, { 0x24, 0x15, 0x27 }, { 0x05, 0x73, 0x84 }, |
| 287 | 287 | { 0x2a, 0x43, 0x96 }, { 0x2a, 0x43, 0x96 }, { 0x51, 0x00, 0x7d }, { 0x31, 0x5a, 0xdc }, |
| 288 | { 0x86, 0x79, 0x3d }, { 0x86, 0x79, 0x3d }, { 0xa8, 0x2a, 0x21 }, { 0x8a, 0x8a, 0x8a }, | |
| 288 | { 0x86, 0x79, 0x3d }, { 0x86, 0x79, 0x3d }, { 0xa8, 0x2a, 0x21 }, { 0x8a, 0x8a, 0x8a }, | |
| 289 | 289 | /* Composite lo-res, colour reg = 24 */ |
| 290 | 290 | { 0x51, 0x00, 0x0e }, { 0x2b, 0x49, 0x76 }, { 0x4c, 0x04, 0x53 }, { 0x23, 0x5a, 0xf5 }, |
| 291 | 291 | { 0x22, 0x05, 0x00 }, { 0x04, 0x06, 0x4b }, { 0x22, 0x13, 0x22 }, { 0x03, 0x74, 0x82 }, |
| r1461 | r1462 | |
| 390 | 390 | { 0x24, 0x24, 0x24 }, { 0x06, 0x91, 0xd8 }, { 0x2a, 0x44, 0xb9 }, { 0x0f, 0x9e, 0xfe }, |
| 391 | 391 | { 0x7a, 0x49, 0x00 }, { 0x58, 0xbc, 0x98 }, { 0x7a, 0x6d, 0x7f }, { 0x5e, 0xc8, 0xeb }, |
| 392 | 392 | { 0xa3, 0x36, 0x3a }, { 0x7f, 0x9c, 0xec }, { 0xa8, 0x54, 0xd7 }, { 0x8a, 0xad, 0xff }, |
| 393 | { 0xf7, 0x64, 0x00 }, { 0xe1, 0xd1, 0x9c }, { 0xfd, 0x7f, 0x8b }, { 0xe4, 0xe4, 0xe4 }, | |
| 393 | { 0xf7, 0x64, 0x00 }, { 0xe1, 0xd1, 0x9c }, { 0xfd, 0x7f, 0x8b }, { 0xe4, 0xe4, 0xe4 }, | |
| 394 | 394 | /* Composite lo-res, colour reg = 39 */ |
| 395 | 395 | { 0x62, 0x46, 0xd3 }, { 0x3d, 0x93, 0xf2 }, { 0x6b, 0x46, 0xeb }, { 0x4f, 0xa0, 0xff }, |
| 396 | 396 | { 0x6f, 0x69, 0x6b }, { 0x58, 0xbb, 0x9b }, { 0x7b, 0x6e, 0x80 }, { 0x5e, 0xc8, 0xec }, |
| r1461 | r1462 | |
|---|---|---|
| 135 | 135 | memcpy(colortable, pcjr_colortable, sizeof(pcjr_colortable)); |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | static struct { | |
| 138 | static struct { | |
| 139 | 139 | UINT8 mode_control, color_select; |
| 140 | 140 | UINT8 status; |
| 141 | 141 | |
| 142 | 142 | int full_refresh; |
| 143 | ||
| 143 | ||
| 144 | 144 | // used in tandy1000hx; used in pcjr??? |
| 145 | 145 | struct { |
| 146 | 146 | UINT8 index; |
| r1461 | r1462 | |
| 151 | 151 | 2 border color |
| 152 | 152 | 3 mode control 2 |
| 153 | 153 | 4 reset |
| 154 | 0x10-0x1f palette registers | |
| 154 | 0x10-0x1f palette registers | |
| 155 | 155 | */ |
| 156 | 156 | } reg; |
| 157 | 157 | |
| r1461 | r1462 | |
| 324 | 324 | case 0x14: case 0x15: case 0x16: case 0x17: |
| 325 | 325 | case 0x18: case 0x19: case 0x1a: case 0x1b: |
| 326 | 326 | case 0x1c: case 0x1d: case 0x1e: case 0x1f: |
| 327 | palette_set_color_rgb(Machine, pcjr.reg.index-0x10, | |
| 327 | palette_set_color_rgb(Machine, pcjr.reg.index-0x10, | |
| 328 | 328 | cga_palette[data&0xf][0], |
| 329 | 329 | cga_palette[data&0xf][1], |
| 330 | 330 | cga_palette[data&0xf][2]); |
| r1461 | r1462 | |
| 498 | 498 | gfx_element *gfx; |
| 499 | 499 | |
| 500 | 500 | gfx = Machine->gfx[ch & 0x80 ? 1 : 0]; |
| 501 | drawgfx(bitmap, gfx, ch & 0x7f, attr, | |
| 501 | drawgfx(bitmap, gfx, ch & 0x7f, attr, | |
| 502 | 502 | 0, 0, r->min_x, r->min_y, r, TRANSPARENCY_NONE, 0); |
| 503 | 503 | |
| 504 | 504 | height = r->max_y - r->min_y + 1; |
| r1461 | r1462 | |
| 532 | 532 | |
| 533 | 533 | for (sy=0, r.min_y=0, r.max_y=height-1; sy<lines; sy++, r.min_y+=height,r.max_y+=height) { |
| 534 | 534 | |
| 535 | for (sx=0, r.min_x=0, r.max_x=7; sx<columns; | |
| 535 | for (sx=0, r.min_x=0, r.max_x=7; sx<columns; | |
| 536 | 536 | sx++, offs=(offs+2)&0x3fff, r.min_x+=8, r.max_x+=8) |
| 537 | 537 | { |
| 538 | 538 | if (!dirtybuffer || dirtybuffer[offs] || dirtybuffer[offs+1]) |
| 539 | 539 | { |
| 540 | 540 | UINT8 ch = pcjr.displayram[offs]; |
| 541 | 541 | UINT8 attr = pcjr.displayram[offs + 1]; |
| 542 | ||
| 542 | ||
| 543 | 543 | t1t_plot_char(bitmap, &r, ch, attr); |
| 544 | 544 | |
| 545 | 545 | if (cursor.on && (pcjr.pc_framecnt & 32) && (offs == cursor.pos * 2)) |
| 546 | 546 | { |
| 547 | 547 | int k = height - cursor.top; |
| 548 | 548 | rectangle rect2 = r; |
| 549 | rect2.min_y += cursor.top; | |
| 549 | rect2.min_y += cursor.top; | |
| 550 | 550 | if (cursor.bottom<height) |
| 551 | 551 | k=cursor.bottom-cursor.top+1; |
| 552 | 552 | |
| 553 | 553 | if (k>0) |
| 554 | plot_box(bitmap, r.min_x, | |
| 555 | r.min_y+cursor.top, | |
| 554 | plot_box(bitmap, r.min_x, | |
| 555 | r.min_y+cursor.top, | |
| 556 | 556 | 8, k, Machine->pens[7]); |
| 557 | 557 | } |
| 558 | 558 | |
| r1461 | r1462 | |
| 584 | 584 | |
| 585 | 585 | for (sy=0, r.min_y=0, r.max_y=height-1; sy<lines; sy++, r.min_y+=height,r.max_y+=height) |
| 586 | 586 | { |
| 587 | for (sx=0, r.min_x=0, r.max_x=7; sx<columns; | |
| 587 | for (sx=0, r.min_x=0, r.max_x=7; sx<columns; | |
| 588 | 588 | sx++, offs=(offs+2)&0x3fff, r.min_x+=8, r.max_x+=8) |
| 589 | 589 | { |
| 590 | 590 | if (!dirtybuffer || dirtybuffer[offs] || dirtybuffer[offs+1]) |
| 591 | 591 | { |
| 592 | 592 | UINT8 ch = pcjr.displayram[offs + 0]; |
| 593 | 593 | UINT8 attr = pcjr.displayram[offs + 1]; |
| 594 | ||
| 594 | ||
| 595 | 595 | if (attr & 0x80) /* blinking ? */ |
| 596 | 596 | { |
| 597 | 597 | if (pcjr.pc_blink) |
| r1461 | r1462 | |
| 612 | 612 | k = cursor.bottom - cursor.top + 1; |
| 613 | 613 | |
| 614 | 614 | if (k>0) |
| 615 | plot_box(bitmap, r.min_x, | |
| 616 | r.min_y+cursor.top, | |
| 615 | plot_box(bitmap, r.min_x, | |
| 616 | r.min_y+cursor.top, | |
| 617 | 617 | 8, k, Machine->pens[7]); |
| 618 | 618 | } |
| 619 | 619 |
| r1461 | r1462 | |
|---|---|---|
| 132 | 132 | for (i = 0; i < count; i++) |
| 133 | 133 | { |
| 134 | 134 | c = current_palette[indexes[i] & 0x3F]; |
| 135 | ||
| 135 | ||
| 136 | 136 | if (is_black_white) |
| 137 | 137 | { |
| 138 | 138 | /* We are on a composite monitor/TV and the monochrome phase invert |
| r1461 | r1462 | |
| 144 | 144 | UINT32 blue = ((c & 0x0000FF) >> 0); |
| 145 | 145 | c = (red + green + blue) / 3; |
| 146 | 146 | } |
| 147 | ||
| 147 | ||
| 148 | 148 | results[i] = c; |
| 149 | 149 | } |
| 150 | 150 | } |
| r1461 | r1462 | |
| 422 | 422 | { |
| 423 | 423 | line = BITMAP_ADDR32(bitmap, row, 0); |
| 424 | 424 | for (i = 319; i >= 0; i--) |
| 425 | line[i * 2 + 0] = line[i * 2 + 1] = line[i]; | |
| 425 | line[i * 2 + 0] = line[i * 2 + 1] = line[i]; | |
| 426 | 426 | } |
| 427 | 427 | } |
| 428 | 428 | } |
| r1461 | r1462 | |
| 463 | 463 | static int coco3_new_frame(void) |
| 464 | 464 | { |
| 465 | 465 | int gime_field_sync = 0; |
| 466 | ||
| 466 | ||
| 467 | 467 | /* changing from non-legacy to legacy video? */ |
| 468 | 468 | if (!video->legacy_video && (coco3_gimereg[0] & 0x80)) |
| 469 | 469 | coco3_set_dirty(); |
| r1461 | r1462 | |
| 671 | 671 | * The code below is based on an algorithm specified in the following |
| 672 | 672 | * CoCo BASIC program was used to approximate composite colors. |
| 673 | 673 | * (Program by SockMaster): |
| 674 | * | |
| 674 | * | |
| 675 | 675 | * 10 POKE65497,0:DIMR(63),G(63),B(63):WIDTH80:PALETTE0,0:PALETTE8,54:CLS1 |
| 676 | 676 | * 20 SAT=92:CON=70:BRI=-50:L(0)=0:L(1)=47:L(2)=120:L(3)=255 |
| 677 | 677 | * 30 W=.4195456981879*1.01:A=W*9.2:S=A+W*5:D=S+W*5:P=0:FORH=0TO3:P=P+1 |
| r1461 | r1462 | |
| 802 | 802 | for (i = 0; i < 32; i++) |
| 803 | 803 | { |
| 804 | 804 | /* characters 0-31 are at $FA10 - $FB0F */ |
| 805 | memcpy(video->fontdata[i], &rom[0xFA10 - 0x8000 + (i * 8)], 8); | |
| 805 | memcpy(video->fontdata[i], &rom[0xFA10 - 0x8000 + (i * 8)], 8); | |
| 806 | 806 | } |
| 807 | 807 | for (i = 32; i < 128; i++) |
| 808 | 808 | { |
| 809 | 809 | /* characters 32-127 are at $F09D - $F39C */ |
| 810 | memcpy(video->fontdata[i], &rom[0xF09D - 0x8000 + ((i - 32) * 8)], 8); | |
| 810 | memcpy(video->fontdata[i], &rom[0xF09D - 0x8000 + ((i - 32) * 8)], 8); | |
| 811 | 811 | } |
| 812 | 812 | |
| 813 | 813 | /* GIME field sync timer */ |
| r1461 | r1462 | |
|---|---|---|
| 297 | 297 | READ8_HANDLER( pc_aga_videoram_r ) |
| 298 | 298 | { |
| 299 | 299 | switch (aga.mode) { |
| 300 | case AGA_COLOR: | |
| 300 | case AGA_COLOR: | |
| 301 | 301 | if (offset>=0x8000) return videoram[offset-0x8000]; |
| 302 | 302 | return 0; |
| 303 | 303 | case AGA_MONO: |
| r1461 | r1462 | |
| 311 | 311 | { |
| 312 | 312 | switch (aga.mode) |
| 313 | 313 | { |
| 314 | default: | |
| 314 | default: | |
| 315 | 315 | if (offset>=0x8000) return videoram[offset-0x8000]; |
| 316 | 316 | return 0; |
| 317 | 317 | case AGA_MONO: |
| r1461 | r1462 | |
| 363 | 363 | |
| 364 | 364 | /* The bottom 3 bits of this port are: |
| 365 | 365 | * Bit 2: Disable AGA |
| 366 | * Bit 1: Select MDA | |
| 366 | * Bit 1: Select MDA | |
| 367 | 367 | * Bit 0: Select external display (monitor) rather than internal display |
| 368 | 368 | * (TV for PC200; LCD for PPC512) */ |
| 369 | 369 | if ((pc200.porte & 7) != (data & 7)) |
| r1461 | r1462 | |
|---|---|---|
| 795 | 795 | } |
| 796 | 796 | } |
| 797 | 797 | } |
| 798 | ||
| 798 | ||
| 799 | 799 | if ( smsvdp.reg[0x01] & 0x02 ) { |
| 800 | 800 | spriteTileSelected += 2; |
| 801 | 801 | pattern = spritePatternTable[ spriteTileSelected * 8 + spriteLine ]; |
| r1461 | r1462 | |
| 863 | 863 | penSelected = colors >> 4; |
| 864 | 864 | } else { |
| 865 | 865 | penSelected = colors & 0x0F; |
| 866 | } | |
| 866 | } | |
| 867 | 867 | if ( ! penSelected ) { |
| 868 | 868 | penSelected = BACKDROP_COLOR; |
| 869 | 869 | } |
| r1461 | r1462 | |
| 881 | 881 | |
| 882 | 882 | static void sms_refresh_line_mode0(int *lineBuffer, int line) { |
| 883 | 883 | int tileColumn; |
| 884 | int pixelX, pixelPlotX; | |
| 884 | int pixelX, pixelPlotX; | |
| 885 | 885 | UINT8 *nameTable, *colorTable, *patternTable; |
| 886 | 886 | |
| 887 | 887 | /* Draw background layer */ |
| 888 | 888 | nameTable = smsvdp.VRAM + ( ( smsvdp.reg[0x02] & 0x0F ) << 10 ) + ( ( line >> 3 ) * 32 ); |
| 889 | 889 | colorTable = smsvdp.VRAM + ( ( smsvdp.reg[0x03] << 6 ) & ( VRAM_SIZE - 1 ) ); |
| 890 | patternTable = smsvdp.VRAM + ( ( smsvdp.reg[0x04] << 11 ) & ( VRAM_SIZE - 1 ) ); | |
| 890 | patternTable = smsvdp.VRAM + ( ( smsvdp.reg[0x04] << 11 ) & ( VRAM_SIZE - 1 ) ); | |
| 891 | 891 | for ( tileColumn = 0; tileColumn < 32; tileColumn++ ) { |
| 892 | 892 | UINT8 pattern; |
| 893 | 893 | UINT8 colors; |
| r1461 | r1462 | |
|---|---|---|
| 120 | 120 | /* the color sets for 2bpp graphics mode. There are 32*3 = 96 of these, |
| 121 | 121 | * though only the first 64 are documented. */ |
| 122 | 122 | /* Red/Green/Yellow set */ |
| 123 | 0, 2, 4, 6, 1, 2, 4, 6, 2, 2, 4, 6, 3, 2, 4, 6, | |
| 124 | 4, 2, 4, 6, 5, 2, 4, 6, 6, 2, 4, 6, 7, 2, 4, 6, | |
| 125 | 8, 2, 4, 6, 9, 2, 4, 6, 10, 2, 4, 6, 11, 2, 4, 6, | |
| 126 | 12, 2, 4, 6, 13, 2, 4, 6, 14, 2, 4, 6, 15, 2, 4, 6, | |
| 123 | 0, 2, 4, 6, 1, 2, 4, 6, 2, 2, 4, 6, 3, 2, 4, 6, | |
| 124 | 4, 2, 4, 6, 5, 2, 4, 6, 6, 2, 4, 6, 7, 2, 4, 6, | |
| 125 | 8, 2, 4, 6, 9, 2, 4, 6, 10, 2, 4, 6, 11, 2, 4, 6, | |
| 126 | 12, 2, 4, 6, 13, 2, 4, 6, 14, 2, 4, 6, 15, 2, 4, 6, | |
| 127 | 127 | 0,10,12,14, 1,10,12,14, 2,10,12,14, 3,10,12,14, |
| 128 | 128 | 4,10,12,14, 5,10,12,14, 6,10,12,14, 7,10,12,14, |
| 129 | 129 | 8,10,12,14, 9,10,12,14, 10,10,12,14, 11,10,12,14, |
| 130 | 130 | 12,10,12,14, 13,10,12,14, 14,10,12,14, 15,10,12,14, |
| 131 | 131 | /* Magenta/Cyan/White set */ |
| 132 | 0, 3, 5, 7, 1, 3, 5, 7, 2, 3, 5, 7, 3, 3, 5, 7, | |
| 133 | 4, 3, 5, 7, 5, 3, 5, 7, 6, 3, 5, 7, 7, 3, 5, 7, | |
| 134 | 8, 3, 5, 7, 9, 3, 5, 7, 10, 3, 5, 7, 11, 3, 5, 7, | |
| 135 | 12, 3, 5, 7, 13, 3, 5, 7, 14, 3, 5, 7, 15, 3, 5, 7, | |
| 132 | 0, 3, 5, 7, 1, 3, 5, 7, 2, 3, 5, 7, 3, 3, 5, 7, | |
| 133 | 4, 3, 5, 7, 5, 3, 5, 7, 6, 3, 5, 7, 7, 3, 5, 7, | |
| 134 | 8, 3, 5, 7, 9, 3, 5, 7, 10, 3, 5, 7, 11, 3, 5, 7, | |
| 135 | 12, 3, 5, 7, 13, 3, 5, 7, 14, 3, 5, 7, 15, 3, 5, 7, | |
| 136 | 136 | 0,11,13,15, 1,11,13,15, 2,11,13,15, 3,11,13,15, |
| 137 | 137 | 4,11,13,15, 5,11,13,15, 6,11,13,15, 7,11,13,15, |
| 138 | 138 | 8,11,13,15, 9,11,13,15, 10,11,13,15, 11,11,13,15, |
| 139 | 139 | 12,11,13,15, 13,11,13,15, 14,11,13,15, 15,11,13,15, |
| 140 | 140 | /* Red/Cyan/White set (undocumented) */ |
| 141 | 0, 3, 4, 7, 1, 3, 4, 7, 2, 3, 4, 7, 3, 3, 4, 7, | |
| 142 | 4, 3, 4, 7, 5, 3, 4, 7, 6, 3, 4, 7, 7, 3, 4, 7, | |
| 143 | 8, 3, 4, 7, 9, 3, 4, 7, 10, 3, 4, 7, 11, 3, 4, 7, | |
| 144 | 12, 3, 4, 7, 13, 3, 4, 7, 14, 3, 4, 7, 15, 3, 4, 7, | |
| 141 | 0, 3, 4, 7, 1, 3, 4, 7, 2, 3, 4, 7, 3, 3, 4, 7, | |
| 142 | 4, 3, 4, 7, 5, 3, 4, 7, 6, 3, 4, 7, 7, 3, 4, 7, | |
| 143 | 8, 3, 4, 7, 9, 3, 4, 7, 10, 3, 4, 7, 11, 3, 4, 7, | |
| 144 | 12, 3, 4, 7, 13, 3, 4, 7, 14, 3, 4, 7, 15, 3, 4, 7, | |
| 145 | 145 | 0,11,12,15, 1,11,12,15, 2,11,12,15, 3,11,12,15, |
| 146 | 146 | 4,11,12,15, 5,11,12,15, 6,11,12,15, 7,11,12,15, |
| 147 | 147 | 8,11,12,15, 9,11,12,15, 10,11,12,15, 11,11,12,15, |
| r1461 | r1462 | |
| 219 | 219 | #define CGA_CHIPSET_PC1512 0x20 /* PC1512 CGA subset */ |
| 220 | 220 | #define CGA_CHIPSET_PC200 0x40 /* PC200 in CGA mode */ |
| 221 | 221 | #define CGA_CHIPSET_ATI 0x60 /* ATI (supports Plantronics) */ |
| 222 | #define CGA_CHIPSET_PARADISE 0x80 /* Paradise (used in PC1640) */ | |
| 222 | #define CGA_CHIPSET_PARADISE 0x80 /* Paradise (used in PC1640) */ | |
| 223 | 223 | |
| 224 | 224 | static struct |
| 225 | { | |
| 225 | { | |
| 226 | 226 | UINT8 mode_control; /* wo 0x3d8 */ |
| 227 | 227 | UINT8 color_select; /* wo 0x3d9 */ |
| 228 | 228 | UINT8 status; /* ro 0x3da */ |
| 229 | 229 | UINT8 plantronics; /* wo 0x3dd, ATI chipset only */ |
| 230 | ||
| 230 | ||
| 231 | 231 | int pc_blink; |
| 232 | 232 | int frame; |
| 233 | 233 | int palette; |
| r1461 | r1462 | |
| 287 | 287 | int buswidth; |
| 288 | 288 | |
| 289 | 289 | /* Changed video RAM size to full 32k, for cards which support the |
| 290 | * Plantronics chipset. | |
| 291 | * TODO: Cards which don't support Plantronics should repeat at | |
| 290 | * Plantronics chipset. | |
| 291 | * TODO: Cards which don't support Plantronics should repeat at | |
| 292 | 292 | * BC000h */ |
| 293 | 293 | buswidth = cputype_databus_width(machine->drv->cpu[0].type, ADDRESS_SPACE_PROGRAM); |
| 294 | 294 | switch(buswidth) |
| r1461 | r1462 | |
| 336 | 336 | |
| 337 | 337 | switch(CGA_MONITOR) |
| 338 | 338 | { |
| 339 | case CGA_MONITOR_COMPOSITE: | |
| 339 | case CGA_MONITOR_COMPOSITE: | |
| 340 | 340 | if (cga.mode_control & 4) |
| 341 | 341 | { |
| 342 | 342 | p = 1; /* Greyscale palette */ |
| r1461 | r1462 | |
| 368 | 368 | if (p != cga.palette) |
| 369 | 369 | { |
| 370 | 370 | for(i = 0; i < (sizeof(cga_palette) / (3 * CGA_PALETTE_SETS)); i++) |
| 371 | palette_set_color_rgb(Machine, i, cga_palette[i + p][0], | |
| 371 | palette_set_color_rgb(Machine, i, cga_palette[i + p][0], | |
| 372 | 372 | cga_palette[i + p][1], |
| 373 | 373 | cga_palette[i + p][2]); |
| 374 | 374 | cga.palette = p; |
| r1461 | r1462 | |
| 388 | 388 | CGA_LOG(1,"CGA_mode_control_w",(errorlog, "$%02x: columns %d, gfx %d, hires %d, blink %d\n", |
| 389 | 389 | data, (data&1)?80:40, (data>>1)&1, (data>>4)&1, (data>>5)&1)); |
| 390 | 390 | |
| 391 | /* CGA composite: Switching between mono & colour behaves like a | |
| 391 | /* CGA composite: Switching between mono & colour behaves like a | |
| 392 | 392 | * mode change */ |
| 393 | 393 | if(CGA_MONITOR == CGA_MONITOR_COMPOSITE) mask = 0x3F; |
| 394 | 394 | |
| r1461 | r1462 | |
| 415 | 415 | |
| 416 | 416 | |
| 417 | 417 | |
| 418 | /* | |
| 419 | * Select Plantronics modes | |
| 418 | /* | |
| 419 | * Select Plantronics modes | |
| 420 | 420 | */ |
| 421 | 421 | static void pc_cga_plantronics_w(int data) |
| 422 | 422 | { |
| r1461 | r1462 | |
| 537 | 537 | { |
| 538 | 538 | if (r.min_y >= Machine->screen[0].height) |
| 539 | 539 | break; |
| 540 | for (sx=0, r.min_x=0, r.max_x=7; sx<columns; | |
| 540 | for (sx=0, r.min_x=0, r.max_x=7; sx<columns; | |
| 541 | 541 | sx++, offs=(offs+2)&0x3fff, r.min_x+=8, r.max_x+=8) |
| 542 | 542 | { |
| 543 | 543 | if (!dirtybuffer || dirtybuffer[offs] || dirtybuffer[offs+1]) |
| 544 | 544 | { |
| 545 | drawgfx(bitmap, Machine->gfx[CGA_FONT], videoram[offs], videoram[offs+1], | |
| 545 | drawgfx(bitmap, Machine->gfx[CGA_FONT], videoram[offs], videoram[offs+1], | |
| 546 | 546 | 0,0,r.min_x,r.min_y,&r,TRANSPARENCY_NONE,0); |
| 547 | 547 | if (height > 16) |
| 548 | 548 | { |
| r1461 | r1462 | |
| 559 | 559 | |
| 560 | 560 | if (k>0) |
| 561 | 561 | { |
| 562 | plot_box(bitmap, r.min_x, | |
| 563 | r.min_y+cursor.top, | |
| 562 | plot_box(bitmap, r.min_x, | |
| 563 | r.min_y+cursor.top, | |
| 564 | 564 | 8, k, Machine->pens[7]); |
| 565 | 565 | } |
| 566 | 566 | } |
| r1461 | r1462 | |
| 589 | 589 | rectangle r; |
| 590 | 590 | struct mscrtc6845_cursor cursor; |
| 591 | 591 | |
| 592 | if (CGA_CHIPSET != CGA_CHIPSET_PC200) | |
| 592 | if (CGA_CHIPSET != CGA_CHIPSET_PC200) | |
| 593 | 593 | { |
| 594 | 594 | cga_text_inten(bitmap, crtc); |
| 595 | 595 | return; |
| r1461 | r1462 | |
| 601 | 601 | |
| 602 | 602 | for (sy=0, r.min_y=0, r.max_y=height-1; sy<lines; sy++, r.min_y+=height,r.max_y+=height) |
| 603 | 603 | { |
| 604 | for (sx=0, r.min_x=0, r.max_x=7; sx<columns; | |
| 604 | for (sx=0, r.min_x=0, r.max_x=7; sx<columns; | |
| 605 | 605 | sx++, offs=(offs+2)&0x3fff, r.min_x+=8, r.max_x+=8) |
| 606 | 606 | { |
| 607 | 607 | if (!dirtybuffer || dirtybuffer[offs] || dirtybuffer[offs+1]) |
| 608 | 608 | { |
| 609 | drawgfx(bitmap, Machine->gfx[CGA_FONT], videoram[offs], (videoram[offs+1] & 15), | |
| 609 | drawgfx(bitmap, Machine->gfx[CGA_FONT], videoram[offs], (videoram[offs+1] & 15), | |
| 610 | 610 | 0,0,r.min_x,r.min_y,&r,TRANSPARENCY_NONE,0); |
| 611 | 611 | if (cursor.on && cga_blinkthisframe() && (offs==cursor.pos*2)) |
| 612 | 612 | { |
| r1461 | r1462 | |
| 615 | 615 | |
| 616 | 616 | if (k>0) |
| 617 | 617 | { |
| 618 | plot_box(bitmap, r.min_x, | |
| 619 | r.min_y+cursor.top, | |
| 618 | plot_box(bitmap, r.min_x, | |
| 619 | r.min_y+cursor.top, | |
| 620 | 620 | 8, k, Machine->pens[7]); |
| 621 | 621 | } |
| 622 | 622 | } |
| r1461 | r1462 | |
| 653 | 653 | if (r.min_y >= Machine->screen[0].height) |
| 654 | 654 | break; |
| 655 | 655 | |
| 656 | for (sx=0, r.min_x=0, r.max_x=7; sx<columns; | |
| 656 | for (sx=0, r.min_x=0, r.max_x=7; sx<columns; | |
| 657 | 657 | sx++, offs=(offs+2)&0x3fff, r.min_x+=8, r.max_x+=8) |
| 658 | 658 | { |
| 659 | 659 | if (!dirtybuffer || dirtybuffer[offs] || dirtybuffer[offs+1]) |
| 660 | 660 | { |
| 661 | ||
| 661 | ||
| 662 | 662 | int attr = videoram[offs+1]; |
| 663 | ||
| 663 | ||
| 664 | 664 | if (attr & 0x80) /* blinking ? */ |
| 665 | 665 | { |
| 666 | 666 | if (cga.pc_blink) |
| r1461 | r1462 | |
| 669 | 669 | attr = attr & 0x7f; |
| 670 | 670 | } |
| 671 | 671 | |
| 672 | drawgfx(bitmap, Machine->gfx[CGA_FONT], videoram[offs], attr, | |
| 672 | drawgfx(bitmap, Machine->gfx[CGA_FONT], videoram[offs], attr, | |
| 673 | 673 | 0,0,r.min_x,r.min_y,&r,TRANSPARENCY_NONE,0); |
| 674 | 674 | if (height>16) |
| 675 | 675 | { |
| r1461 | r1462 | |
| 686 | 686 | |
| 687 | 687 | if (k > 0) |
| 688 | 688 | { |
| 689 | plot_box(bitmap, r.min_x, | |
| 690 | r.min_y+cursor.top, | |
| 689 | plot_box(bitmap, r.min_x, | |
| 690 | r.min_y+cursor.top, | |
| 691 | 691 | 8, k, Machine->pens[7]); |
| 692 | 692 | } |
| 693 | 693 | } |
| r1461 | r1462 | |
| 715 | 715 | int columns = mscrtc6845_get_char_columns(crtc); |
| 716 | 716 | rectangle r; |
| 717 | 717 | struct mscrtc6845_cursor cursor; |
| 718 | ||
| 719 | if (CGA_CHIPSET != CGA_CHIPSET_PC200) | |
| 718 | ||
| 719 | if (CGA_CHIPSET != CGA_CHIPSET_PC200) | |
| 720 | 720 | { |
| 721 | 721 | cga_text_blink(bitmap, crtc); |
| 722 | 722 | return; |
| r1461 | r1462 | |
| 731 | 731 | if (r.min_y >= Machine->screen[0].height) |
| 732 | 732 | break; |
| 733 | 733 | |
| 734 | for (sx=0, r.min_x=0, r.max_x=7; sx<columns; | |
| 734 | for (sx=0, r.min_x=0, r.max_x=7; sx<columns; | |
| 735 | 735 | sx++, offs=(offs+2)&0x3fff, r.min_x+=8, r.max_x+=8) |
| 736 | 736 | { |
| 737 | 737 | if (!dirtybuffer || dirtybuffer[offs] || dirtybuffer[offs+1]) |
| 738 | 738 | { |
| 739 | ||
| 739 | ||
| 740 | 740 | int attr = videoram[offs+1]; |
| 741 | ||
| 741 | ||
| 742 | 742 | if ((attr & 0x80) && cga.pc_blink) /* blinking ? */ |
| 743 | 743 | attr = (attr & 0x70) >> 4; |
| 744 | 744 | else |
| 745 | 745 | attr = attr & 0x0F; |
| 746 | 746 | |
| 747 | drawgfx(bitmap, Machine->gfx[CGA_FONT], videoram[offs], attr, | |
| 747 | drawgfx(bitmap, Machine->gfx[CGA_FONT], videoram[offs], attr, | |
| 748 | 748 | 0,0,r.min_x,r.min_y,&r,TRANSPARENCY_NONE,0); |
| 749 | 749 | |
| 750 | 750 | if (cga_blinkthisframe() && (offs==cursor.pos*2)) |
| r1461 | r1462 | |
| 754 | 754 | |
| 755 | 755 | if (k > 0) |
| 756 | 756 | { |
| 757 | plot_box(bitmap, r.min_x, | |
| 758 | r.min_y+cursor.top, | |
| 757 | plot_box(bitmap, r.min_x, | |
| 758 | r.min_y+cursor.top, | |
| 759 | 759 | 8, k, Machine->pens[7]); |
| 760 | 760 | } |
| 761 | 761 | } |
| r1461 | r1462 | |
| 780 | 780 | const UINT16 *palette; |
| 781 | 781 | int colorset = cga.color_select & 0x3F; |
| 782 | 782 | |
| 783 | /* Most chipsets use bit 2 of the mode control register to | |
| 783 | /* Most chipsets use bit 2 of the mode control register to | |
| 784 | 784 | * access a third palette. But not consistently. */ |
| 785 | 785 | pc_cga_check_palette(); |
| 786 | 786 | switch(CGA_CHIPSET) |
| r1461 | r1462 | |
| 797 | 797 | case CGA_CHIPSET_PARADISE: |
| 798 | 798 | if (cga.mode_control & 4) colorset = (colorset & 0x1F) + 64; |
| 799 | 799 | break; |
| 800 | } | |
| 800 | } | |
| 801 | 801 | |
| 802 | 802 | /* The fact that our palette is located in cga_colortable is a vestigial |
| 803 | 803 | * aspect from when we were doing that ugly trick where drawgfx() would |
| r1461 | r1462 | |
| 833 | 833 | |
| 834 | 834 | |
| 835 | 835 | |
| 836 | INLINE void cga_plot_unit_4bpp(mame_bitmap *bitmap, | |
| 836 | INLINE void cga_plot_unit_4bpp(mame_bitmap *bitmap, | |
| 837 | 837 | int x, int y, int offs, int scale) |
| 838 | 838 | { |
| 839 | 839 | int color; |
| r1461 | r1462 | |
| 856 | 856 | |
| 857 | 857 | pc_cga_check_palette(); |
| 858 | 858 | |
| 859 | for (sy=0; sy<lines; sy++,offs=(offs+columns)&0x1fff) | |
| 859 | for (sy=0; sy<lines; sy++,offs=(offs+columns)&0x1fff) | |
| 860 | 860 | { |
| 861 | for (sh=0; sh<height; sh++, offs|=0x2000) | |
| 862 | { | |
| 861 | for (sh=0; sh<height; sh++, offs|=0x2000) | |
| 862 | { | |
| 863 | 863 | // char line 0 used as a12 line in graphic mode |
| 864 | 864 | if (!(sh & 1)) |
| 865 | 865 | { |
| 866 | for (i=offs, sx=0; sx<columns; sx++, i=(i+1)&0x1fff) | |
| 866 | for (i=offs, sx=0; sx<columns; sx++, i=(i+1)&0x1fff) | |
| 867 | 867 | { |
| 868 | if (!dirtybuffer || dirtybuffer[i]) | |
| 868 | if (!dirtybuffer || dirtybuffer[i]) | |
| 869 | 869 | { |
| 870 | 870 | cga_plot_unit_4bpp(bitmap, sx*scale, sy*height+sh, i, scale/2); |
| 871 | 871 | if (dirtybuffer) |
| r1461 | r1462 | |
| 875 | 875 | } |
| 876 | 876 | else |
| 877 | 877 | { |
| 878 | for (i=offs|0x2000, sx=0; sx<columns; sx++, i=((i+1)&0x1fff)|0x2000) | |
| 878 | for (i=offs|0x2000, sx=0; sx<columns; sx++, i=((i+1)&0x1fff)|0x2000) | |
| 879 | 879 | { |
| 880 | if (!dirtybuffer || dirtybuffer[i]) | |
| 880 | if (!dirtybuffer || dirtybuffer[i]) | |
| 881 | 881 | { |
| 882 | 882 | cga_plot_unit_4bpp(bitmap, sx*scale, sy*height+sh, i, scale/2); |
| 883 | 883 | if (dirtybuffer) |
| r1461 | r1462 | |
| 890 | 890 | } |
| 891 | 891 | |
| 892 | 892 | |
| 893 | /* The hi-res graphics mode on a colour composite monitor | |
| 893 | /* The hi-res graphics mode on a colour composite monitor | |
| 894 | 894 | * |
| 895 | 895 | * The different scaling factors mean that the '160x200' versions of screens |
| 896 | 896 | * are the same size as the normal colour ones. |
| 897 | */ | |
| 897 | */ | |
| 898 | 898 | static void cga_gfx_4bpph(mame_bitmap *bitmap, struct mscrtc6845 *crtc) |
| 899 | 899 | { |
| 900 | 900 | pc_cga_check_palette(); |
| 901 | 901 | cga_gfx_4bpp(bitmap, crtc, 8); |
| 902 | 902 | } |
| 903 | 903 | |
| 904 | ||
| 904 | ||
| 905 | 905 | /* The lo-res graphics mode on a colour composite monitor */ |
| 906 | 906 | static void cga_gfx_4bppl(mame_bitmap *bitmap, struct mscrtc6845 *crtc) |
| 907 | 907 | { |
| 908 | 908 | pc_cga_check_palette(); |
| 909 | 909 | cga_gfx_4bpp(bitmap, crtc, 4); |
| 910 | 910 | } |
| 911 | ||
| 912 | 911 | |
| 913 | 912 | |
| 914 | 913 | |
| 915 | INLINE void pgfx_plot_unit_4bpp(mame_bitmap *bitmap, | |
| 914 | ||
| 915 | INLINE void pgfx_plot_unit_4bpp(mame_bitmap *bitmap, | |
| 916 | 916 | int x, int y, int offs) |
| 917 | 917 | { |
| 918 | 918 | int color, values[2]; |
| 919 | 919 | int i; |
| 920 | 920 | |
| 921 | if (cga.plantronics & 0x40) | |
| 921 | if (cga.plantronics & 0x40) | |
| 922 | 922 | { |
| 923 | 923 | values[0] = videoram[offs | 0x4000]; |
| 924 | 924 | values[1] = videoram[offs]; |
| r1461 | r1462 | |
| 930 | 930 | } |
| 931 | 931 | for (i=3; i>=0; i--) |
| 932 | 932 | { |
| 933 | color = ((values[0] & 0x3) << 1) | | |
| 933 | color = ((values[0] & 0x3) << 1) | | |
| 934 | 934 | ((values[1] & 2) >> 1) | |
| 935 | 935 | ((values[1] & 1) << 3); |
| 936 | 936 | *BITMAP_ADDR16(bitmap, y, x+i) = Machine->pens[color]; |
| r1461 | r1462 | |
| 944 | 944 | /*************************************************************************** |
| 945 | 945 | Draw graphics mode with 640x200 pixels (default) with 2 bits/pixel. |
| 946 | 946 | Even scanlines are from CGA_base + 0x0000, odd from CGA_base + 0x2000 |
| 947 | Second plane at CGA_base + 0x4000 / 0x6000 | |
| 947 | Second plane at CGA_base + 0x4000 / 0x6000 | |
| 948 | 948 | ***************************************************************************/ |
| 949 | 949 | |
| 950 | 950 | static void cga_pgfx_4bpp(mame_bitmap *bitmap, struct mscrtc6845 *crtc) |
| r1461 | r1462 | |
| 955 | 955 | int height = mscrtc6845_get_char_height(crtc); |
| 956 | 956 | int columns = mscrtc6845_get_char_columns(crtc)*2; |
| 957 | 957 | |
| 958 | for (sy=0; sy<lines; sy++,offs=(offs+columns)&0x1fff) | |
| 958 | for (sy=0; sy<lines; sy++,offs=(offs+columns)&0x1fff) | |
| 959 | 959 | { |
| 960 | for (sh=0; sh<height; sh++, offs|=0x2000) | |
| 961 | { | |
| 960 | for (sh=0; sh<height; sh++, offs|=0x2000) | |
| 961 | { | |
| 962 | 962 | // char line 0 used as a12 line in graphic mode |
| 963 | 963 | if (!(sh & 1)) |
| 964 | 964 | { |
| 965 | for (i=offs, sx=0; sx<columns; sx++, i=(i+1)&0x1fff) | |
| 965 | for (i=offs, sx=0; sx<columns; sx++, i=(i+1)&0x1fff) | |
| 966 | 966 | { |
| 967 | if (!dirtybuffer || dirtybuffer[i]) | |
| 967 | if (!dirtybuffer || dirtybuffer[i]) | |
| 968 | 968 | { |
| 969 | 969 | pgfx_plot_unit_4bpp(bitmap, sx*4, sy*height+sh, i); |
| 970 | 970 | if (dirtybuffer) |
| r1461 | r1462 | |
| 974 | 974 | } |
| 975 | 975 | else |
| 976 | 976 | { |
| 977 | for (i=offs|0x2000, sx=0; sx<columns; sx++, i=((i+1)&0x1fff)|0x2000) | |
| 977 | for (i=offs|0x2000, sx=0; sx<columns; sx++, i=((i+1)&0x1fff)|0x2000) | |
| 978 | 978 | { |
| 979 | if (!dirtybuffer || dirtybuffer[i]) | |
| 979 | if (!dirtybuffer || dirtybuffer[i]) | |
| 980 | 980 | { |
| 981 | 981 | pgfx_plot_unit_4bpp(bitmap, sx*4, sy*height+sh, i); |
| 982 | 982 | if (dirtybuffer) |
| r1461 | r1462 | |
| 990 | 990 | |
| 991 | 991 | |
| 992 | 992 | |
| 993 | INLINE void pgfx_plot_unit_2bpp(mame_bitmap *bitmap, | |
| 993 | INLINE void pgfx_plot_unit_2bpp(mame_bitmap *bitmap, | |
| 994 | 994 | int x, int y, const UINT16 *palette, int offs) |
| 995 | 995 | { |
| 996 | 996 | int i; |
| 997 | 997 | UINT8 bmap[2], values[2]; |
| 998 | 998 | UINT16 *dest; |
| 999 | 999 | |
| 1000 | if (cga.plantronics & 0x40) | |
| 1000 | if (cga.plantronics & 0x40) | |
| 1001 | 1001 | { |
| 1002 | 1002 | values[0] = videoram[offs]; |
| 1003 | 1003 | values[1] = videoram[offs | 0x4000]; |
| r1461 | r1462 | |
| 1010 | 1010 | bmap[0] = bmap[1] = 0; |
| 1011 | 1011 | for (i=3; i>=0; i--) |
| 1012 | 1012 | { |
| 1013 | bmap[0] = bmap[0] << 1; if (values[0] & 0x80) bmap[0] |= 1; | |
| 1014 | bmap[0] = bmap[0] << 1; if (values[1] & 0x80) bmap[0] |= 1; | |
| 1015 | bmap[1] = bmap[1] << 1; if (values[0] & 0x08) bmap[1] |= 1; | |
| 1016 | bmap[1] = bmap[1] << 1; if (values[1] & 0x08) bmap[1] |= 1; | |
| 1017 | values[0] = values[0] << 1; | |
| 1018 | values[1] = values[1] << 1; | |
| 1013 | bmap[0] = bmap[0] << 1; if (values[0] & 0x80) bmap[0] |= 1; | |
| 1014 | bmap[0] = bmap[0] << 1; if (values[1] & 0x80) bmap[0] |= 1; | |
| 1015 | bmap[1] = bmap[1] << 1; if (values[0] & 0x08) bmap[1] |= 1; | |
| 1016 | bmap[1] = bmap[1] << 1; if (values[1] & 0x08) bmap[1] |= 1; | |
| 1017 | values[0] = values[0] << 1; | |
| 1018 | values[1] = values[1] << 1; | |
| 1019 | 1019 | } |
| 1020 | 1020 | |
| 1021 | 1021 | dest = BITMAP_ADDR16(bitmap, y, x); |
| r1461 | r1462 | |
| 1047 | 1047 | int colorset = cga.color_select & 0x3F; |
| 1048 | 1048 | const UINT16 *palette; |
| 1049 | 1049 | |
| 1050 | /* Most chipsets use bit 2 of the mode control register to | |
| 1050 | /* Most chipsets use bit 2 of the mode control register to | |
| 1051 | 1051 | * access a third palette. But not consistently. */ |
| 1052 | 1052 | pc_cga_check_palette(); |
| 1053 | 1053 | switch(CGA_CHIPSET) |
| r1461 | r1462 | |
| 1064 | 1064 | case CGA_CHIPSET_PARADISE: |
| 1065 | 1065 | if (cga.mode_control & 4) colorset = (colorset & 0x1F) + 64; |
| 1066 | 1066 | break; |
| 1067 | } | |
| 1067 | } | |
| 1068 | 1068 | |
| 1069 | 1069 | |
| 1070 | 1070 | /* The fact that our palette is located in cga_colortable is a vestigial |
| r1461 | r1462 | |
| 1111 | 1111 | // mapping of the 4 planes into videoram |
| 1112 | 1112 | // (text data should be readable at videoram+0) |
| 1113 | 1113 | static const int videoram_offset[4]= { 0xc000, 0x8000, 0x4000, 0 }; |
| 1114 | INLINE void pc1512_plot_unit(mame_bitmap *bitmap, | |
| 1114 | INLINE void pc1512_plot_unit(mame_bitmap *bitmap, | |
| 1115 | 1115 | int x, int y, int offs) |
| 1116 | 1116 | { |
| 1117 | 1117 | int color, values[4]; |
| r1461 | r1462 | |
| 1151 | 1151 | int height = mscrtc6845_get_char_height(crtc); |
| 1152 | 1152 | int columns = mscrtc6845_get_char_columns(crtc)*2; |
| 1153 | 1153 | |
| 1154 | for (sy=0; sy<lines; sy++,offs=(offs+columns)&0x1fff) | |
| 1154 | for (sy=0; sy<lines; sy++,offs=(offs+columns)&0x1fff) | |
| 1155 | 1155 | { |
| 1156 | 1156 | for (sh=0; sh<height; sh++) |
| 1157 | { | |
| 1157 | { | |
| 1158 | 1158 | if (sy*height+sh >= bitmap->height) |
| 1159 | 1159 | break; |
| 1160 | 1160 | // char line 0 used as a12 line in graphic mode |
| 1161 | 1161 | if (!(sh & 1)) |
| 1162 | 1162 | { |
| 1163 | for (i=offs, sx=0; sx<columns; sx++, i=(i+1)&0x1fff) | |
| 1163 | for (i=offs, sx=0; sx<columns; sx++, i=(i+1)&0x1fff) | |
| 1164 | 1164 | { |
| 1165 | if (!dirtybuffer || dirtybuffer[i]) | |
| 1165 | if (!dirtybuffer || dirtybuffer[i]) | |
| 1166 | 1166 | { |
| 1167 | 1167 | pc1512_plot_unit(bitmap, sx*8, sy*height+sh, i); |
| 1168 | 1168 | } |
| r1461 | r1462 | |
| 1170 | 1170 | } |
| 1171 | 1171 | else |
| 1172 | 1172 | { |
| 1173 | for (i=offs|0x2000, sx=0; sx<columns; sx++, i=((i+1)&0x1fff)|0x2000) | |
| 1173 | for (i=offs|0x2000, sx=0; sx<columns; sx++, i=((i+1)&0x1fff)|0x2000) | |
| 1174 | 1174 | { |
| 1175 | if (!dirtybuffer || dirtybuffer[i]) | |
| 1175 | if (!dirtybuffer || dirtybuffer[i]) | |
| 1176 | 1176 | { |
| 1177 | 1177 | pc1512_plot_unit(bitmap, sx*8, sy*height+sh, i); |
| 1178 | 1178 | } |
| r1461 | r1462 | |
| 1227 | 1227 | { |
| 1228 | 1228 | return cga.frame & 1; |
| 1229 | 1229 | } |
| 1230 | ||
| 1231 | 1230 | |
| 1232 | 1231 | |
| 1232 | ||
| 1233 | 1233 | /*************************************************************************** |
| 1234 | 1234 | Choose the appropriate video mode |
| 1235 | 1235 | ***************************************************************************/ |
| r1461 | r1462 | |
| 1298 | 1298 | if ((cga.mode_control & 2) && (cga.plantronics & 0x10)) |
| 1299 | 1299 | proc = cga_pgfx_4bpp; |
| 1300 | 1300 | |
| 1301 | /* The 160x200 modes are only available on a composite | |
| 1302 | * monitor */ | |
| 1303 | if (proc == cga_gfx_4bppl && | |
| 1301 | /* The 160x200 modes are only available on a composite | |
| 1302 | * monitor */ | |
| 1303 | if (proc == cga_gfx_4bppl && | |
| 1304 | 1304 | CGA_MONITOR != CGA_MONITOR_COMPOSITE) proc = cga_gfx_2bpp; |
| 1305 | if (proc == cga_gfx_4bpph && | |
| 1305 | if (proc == cga_gfx_4bpph && | |
| 1306 | 1306 | CGA_MONITOR != CGA_MONITOR_COMPOSITE) proc = cga_gfx_1bpp; |
| 1307 | 1307 | |
| 1308 | 1308 | /* Modes that are 640 pixels wide */ |
| 1309 | if (proc == cga_gfx_1bpp || | |
| 1309 | if (proc == cga_gfx_1bpp || | |
| 1310 | 1310 | proc == cga_gfx_4bpph || |
| 1311 | proc == pc1512_gfx_4bpp || | |
| 1311 | proc == pc1512_gfx_4bpp || | |
| 1312 | 1312 | proc == cga_pgfx_2bpp) |
| 1313 | 1313 | { |
| 1314 | 1314 | *width *= 16; |
| r1461 | r1462 | |
| 1424 | 1424 | memory_set_bankptr(1,videoram + videoram_offset[0]); |
| 1425 | 1425 | pc1512.write = 0xf; |
| 1426 | 1426 | pc1512.read = 0; |
| 1427 | ||
| 1427 | ||
| 1428 | 1428 | /* PC1512 cut-down 6845 */ |
| 1429 | 1429 | internal_pc_cga_video_start(M6845_PERSONALITY_PC1512); |
| 1430 | 1430 | } |
| r1461 | r1462 | |
|---|---|---|
| 39 | 39 | |
| 40 | 40 | VIDEO_START( microtan ) |
| 41 | 41 | { |
| 42 | bg_tilemap = tilemap_create(get_bg_tile_info, tilemap_scan_rows, | |
| 42 | bg_tilemap = tilemap_create(get_bg_tile_info, tilemap_scan_rows, | |
| 43 | 43 | TILEMAP_TYPE_PEN, 8, 16, 32, 16); |
| 44 | 44 | |
| 45 | 45 | microtan_chunky_buffer = auto_malloc(videoram_size); |
| r1461 | r1462 | |
|---|---|---|
| 96 | 96 | (s1->doubleyres ? 2 : 1); |
| 97 | 97 | h2 = 8 * (s2->quady ? 4 : 1) * (s2->doubley ? 2 : 1) * |
| 98 | 98 | (s2->doubleyres ? 2 : 1); |
| 99 | ||
| 99 | ||
| 100 | 100 | if ((x1 + w1 <= x2) || (y1 + h1 <= y2) || |
| 101 | 101 | (x1 >= x2 + w2) || (y1 >= y2 + h2)) |
| 102 | 102 | return FALSE; |
| r1461 | r1462 | |
| 609 | 609 | } |
| 610 | 610 | offs++; |
| 611 | 611 | } // next col |
| 612 | } // next row | |
| 612 | } // next row | |
| 613 | 613 | } |
| 614 | 614 | } |
| 615 | 615 | */ |
| r1461 | r1462 | |
|---|---|---|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | timer_adjust(cdp1864_dma_timer, ATTOTIME_IN_CYCLES(CDP1864_CYCLES_DMA_WAIT, 0), 0, attotime_zero); |
| 97 | ||
| 97 | ||
| 98 | 98 | cdp1864.dmaout = 0; |
| 99 | 99 | } |
| 100 | 100 | else |
| r1461 | r1462 | |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | timer_adjust(cdp1864_dma_timer, ATTOTIME_IN_CYCLES(CDP1864_CYCLES_DMA_ACTIVE, 0), 0, attotime_zero); |
| 111 | ||
| 111 | ||
| 112 | 112 | cdp1864.dmaout = 1; |
| 113 | 113 | } |
| 114 | 114 | } |
| r1461 | r1462 | |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | *BITMAP_ADDR16(cdptmpbitmap, y, sx + x) = Machine->pens[color]; |
| 132 | ||
| 132 | ||
| 133 | 133 | data <<= 1; |
| 134 | 134 | } |
| 135 | 135 | |
| r1461 | r1462 | |
| 154 | 154 | { |
| 155 | 155 | cdp1864.latch = CDP1864_DEFAULT_LATCH; |
| 156 | 156 | } |
| 157 | ||
| 157 | ||
| 158 | 158 | cdp1864.audio = value; |
| 159 | 159 | |
| 160 | 160 | beep_set_state(0, value); |
| r1461 | r1462 | |
| 205 | 205 | |
| 206 | 206 | /* ensure the contents of the bitmap are saved */ |
| 207 | 207 | state_save_register_bitmap("video", 0, "cdptmpbitmap", cdptmpbitmap); |
| 208 | ||
| 208 | ||
| 209 | 209 | state_save_register_global(cdp1864.disp); |
| 210 | 210 | state_save_register_global(cdp1864.dmaout); |
| 211 | 211 | state_save_register_global(cdp1864.dmaptr); |
| r1461 | r1462 | |
|---|---|---|
| 88 | 88 | case 'e': mask=0x10; break; |
| 89 | 89 | case 'f': mask=0x20; break; |
| 90 | 90 | case 'g': mask=0x40; break; |
| 91 | case 'h': | |
| 91 | case 'h': | |
| 92 | 92 | // this is more likely wired to the separate leds |
| 93 | mask=0x80; | |
| 93 | mask=0x80; | |
| 94 | 94 | break; |
| 95 | 95 | } |
| 96 | ||
| 96 | ||
| 97 | 97 | if (mask!=0) { |
| 98 | 98 | color=Machine->pens[(value&mask)?1:0]; |
| 99 | 99 | *BITMAP_ADDR16(bitmap, y+yi, x+xi) = color; |
| r1461 | r1462 | |
| 164 | 164 | } |
| 165 | 165 | xi++; |
| 166 | 166 | break; |
| 167 | case ' ': | |
| 167 | case ' ': | |
| 168 | 168 | xi++; |
| 169 | 169 | break; |
| 170 | 170 | case '\r': |
| 171 | 171 | xi=0; |
| 172 | 172 | y++; |
| 173 | break; | |
| 173 | break; | |
| 174 | 174 | }; |
| 175 | 175 | } |
| 176 | 176 | } |
| r1461 | r1462 | |
| 180 | 180 | int i; |
| 181 | 181 | |
| 182 | 182 | for (i=0; i<4; i++) { |
| 183 | ssystem3_draw_7segment(bitmap, ssystem3_led[i]&0x7f, ssystem3_led_pos[i].x, | |
| 183 | ssystem3_draw_7segment(bitmap, ssystem3_led[i]&0x7f, ssystem3_led_pos[i].x, | |
| 184 | 184 | ssystem3_led_pos[i].y); |
| 185 | 185 | } |
| 186 | 186 | |
| 187 | ssystem3_draw_led(bitmap, machine->pens[ssystem3_led[4]&8?1:0], | |
| 187 | ssystem3_draw_led(bitmap, machine->pens[ssystem3_led[4]&8?1:0], | |
| 188 | 188 | ssystem3_led_pos[4].x, ssystem3_led_pos[4].y, '0'); |
| 189 | ssystem3_draw_led(bitmap, machine->pens[ssystem3_led[4]&8?1:0], | |
| 189 | ssystem3_draw_led(bitmap, machine->pens[ssystem3_led[4]&8?1:0], | |
| 190 | 190 | ssystem3_led_pos[4].x, ssystem3_led_pos[4].y, '1'); |
| 191 | ssystem3_draw_led(bitmap, machine->pens[ssystem3_led[4]&8?1:0], | |
| 191 | ssystem3_draw_led(bitmap, machine->pens[ssystem3_led[4]&8?1:0], | |
| 192 | 192 | ssystem3_led_pos[4].x, ssystem3_led_pos[4].y, '2'); |
| 193 | ssystem3_draw_led(bitmap, machine->pens[ssystem3_led[4]&8?1:0], | |
| 193 | ssystem3_draw_led(bitmap, machine->pens[ssystem3_led[4]&8?1:0], | |
| 194 | 194 | ssystem3_led_pos[4].x, ssystem3_led_pos[4].y, '3'); |
| 195 | ssystem3_draw_led(bitmap, machine->pens[ssystem3_led[4]&8?1:0], | |
| 195 | ssystem3_draw_led(bitmap, machine->pens[ssystem3_led[4]&8?1:0], | |
| 196 | 196 | ssystem3_led_pos[4].x, ssystem3_led_pos[4].y, '4'); |
| 197 | ssystem3_draw_led(bitmap, machine->pens[ssystem3_led[4]&8?1:0], | |
| 197 | ssystem3_draw_led(bitmap, machine->pens[ssystem3_led[4]&8?1:0], | |
| 198 | 198 | ssystem3_led_pos[4].x, ssystem3_led_pos[4].y, '5'); |
| 199 | ssystem3_draw_led(bitmap, machine->pens[ssystem3_led[4]&8?1:0], | |
| 199 | ssystem3_draw_led(bitmap, machine->pens[ssystem3_led[4]&8?1:0], | |
| 200 | 200 | ssystem3_led_pos[4].x, ssystem3_led_pos[4].y, '6'); |
| 201 | 201 | return 0; |
| 202 | 202 | } |
| r1461 | r1462 | |
|---|---|---|
| 23 | 23 | extern int amstrad_plus_pri; |
| 24 | 24 | extern int amstrad_system_type; |
| 25 | 25 | extern int amstrad_plus_irq_cause; |
| 26 | extern int amstrad_plus_scroll_x; | |
| 27 | extern int amstrad_plus_scroll_y; | |
| 28 | extern int amstrad_plus_scroll_border; | |
| 26 | extern int amstrad_plus_scroll_x; | |
| 27 | extern int amstrad_plus_scroll_y; | |
| 28 | extern int amstrad_plus_scroll_border; | |
| 29 | 29 | |
| 30 | 30 | extern int amstrad_plus_dma_status; |
| 31 | 31 | extern int amstrad_plus_dma_0_addr; // DMA channel address |
| 32 | extern int amstrad_plus_dma_1_addr; | |
| 33 | extern int amstrad_plus_dma_2_addr; | |
| 32 | extern int amstrad_plus_dma_1_addr; | |
| 33 | extern int amstrad_plus_dma_2_addr; | |
| 34 | 34 | extern int amstrad_plus_dma_prescaler[3]; // DMA channel prescaler |
| 35 | 35 | |
| 36 | 36 | static int amstrad_plus_dma_repeat[3]; // marks the location of the channels' last repeat |
| r1461 | r1462 | |
| 39 | 39 | |
| 40 | 40 | extern unsigned char *amstrad_plus_asic_ram; |
| 41 | 41 | |
| 42 | static int amstrad_plus_split_scanline; // ASIC split screen | |
| 42 | static int amstrad_plus_split_scanline; // ASIC split screen | |
| 43 | 43 | static int amstrad_plus_split_address; |
| 44 | 44 | static int amstrad_screen_width; // width in bytes |
| 45 | 45 | |
| r1461 | r1462 | |
| 95 | 95 | static void (*draw_function)(void); |
| 96 | 96 | /* current programmed mode */ |
| 97 | 97 | static int amstrad_current_mode; |
| 98 | ||
| 98 | ||
| 99 | 99 | static unsigned long Mode0Lookup[256]; |
| 100 | 100 | static unsigned long Mode1Lookup[256]; |
| 101 | 101 | static unsigned long Mode3Lookup[256]; |
| 102 | 102 | |
| 103 | 103 | /* The Amstrad CPC has a fixed palette of 27 colours generated from 3 levels of Red, Green and Blue. |
| 104 | The hardware allows selection of 32 colours, but these extra colours are copies of existing colours.*/ | |
| 104 | The hardware allows selection of 32 colours, but these extra colours are copies of existing colours.*/ | |
| 105 | 105 | |
| 106 | 106 | static const rgb_t amstrad_palette[32] = |
| 107 | 107 | { |
| r1461 | r1462 | |
| 190 | 190 | The palette is defined by a colour rom. The only rom dump that exists (from the KC-Club webpage) |
| 191 | 191 | is 2K, which seems correct. In this rom the same 32 bytes of data is repeated throughout the rom. |
| 192 | 192 | |
| 193 | When a I/O write is made to "Gate Array" to select the colour, Bit 7 and 6 are used by the | |
| 194 | "Gate Array" to define the function, bit 7 = 0, bit 6 = 1. In the Amstrad CPC, bits 4..0 | |
| 195 | define the hardware colour number, but in the KC Compact, it seems bits 5..0 | |
| 193 | When a I/O write is made to "Gate Array" to select the colour, Bit 7 and 6 are used by the | |
| 194 | "Gate Array" to define the function, bit 7 = 0, bit 6 = 1. In the Amstrad CPC, bits 4..0 | |
| 195 | define the hardware colour number, but in the KC Compact, it seems bits 5..0 | |
| 196 | 196 | define the hardware colour number allowing 64 colours to be chosen. |
| 197 | 197 | |
| 198 | 198 | It is possible therefore that the colour rom could be reprogrammed, so that other colour |
| r1461 | r1462 | |
| 201 | 201 | |
| 202 | 202 | colour rom byte: |
| 203 | 203 | |
| 204 | Bit Function | |
| 205 | 7 not used | |
| 206 | 6 not used | |
| 204 | Bit Function | |
| 205 | 7 not used | |
| 206 | 6 not used | |
| 207 | 207 | 5,4 Green value |
| 208 | 208 | 3,2 Red value |
| 209 | 209 | 1,0 Blue value |
| 210 | 210 | |
| 211 | 211 | Green value, Red value, Blue value: 0 = 0%, 01/10 = 50%, 11 = 100%. |
| 212 | 212 | The 01 case is not used, it is unknown if this produces a different amount of colour. |
| 213 | */ | |
| 213 | */ | |
| 214 | 214 | |
| 215 | 215 | static unsigned char kccomp_get_colour_element(int colour_value) |
| 216 | 216 | { |
| r1461 | r1462 | |
| 261 | 261 | int i; |
| 262 | 262 | |
| 263 | 263 | palette_set_colors(machine, 0, amstrad_palette, sizeof(amstrad_palette) / 3); |
| 264 | for ( i = 0; i < 0x1000; i++ ) | |
| 264 | for ( i = 0; i < 0x1000; i++ ) | |
| 265 | 265 | { |
| 266 | 266 | int r, g, b; |
| 267 | 267 | |
| r1461 | r1462 | |
| 336 | 336 | void amstrad_vh_update_mode(int new_mode) |
| 337 | 337 | { |
| 338 | 338 | amstrad_current_mode = new_mode; |
| 339 | ||
| 339 | ||
| 340 | 340 | } |
| 341 | 341 | |
| 342 | 342 | static void amstrad_draw_screen_disabled(void) |
| r1461 | r1462 | |
| 426 | 426 | int x = x_screen_pos; |
| 427 | 427 | int y = y_screen_pos; |
| 428 | 428 | |
| 429 | int i, cpcpen, messpen; | |
| 429 | int i, cpcpen, messpen; | |
| 430 | 430 | unsigned char data1; |
| 431 | 431 | unsigned char data2; |
| 432 | 432 | |
| r1461 | r1462 | |
| 497 | 497 | messpen = 48 + (amstrad_plus_asic_ram[0x2400+cpcpen*2]);//amstrad_GateArray_render_colours[cpcpen]; |
| 498 | 498 | messpen += (amstrad_plus_asic_ram[0x2401+cpcpen*2]) << 8; |
| 499 | 499 | *BITMAP_ADDR16(bitmap, y, x) = messpen; |
| 500 | x++; | |
| 500 | x++; | |
| 501 | 501 | data = data<<1; |
| 502 | 502 | } |
| 503 | 503 | } |
| r1461 | r1462 | |
| 622 | 622 | int x = x_screen_pos; |
| 623 | 623 | int y = y_screen_pos; |
| 624 | 624 | |
| 625 | int i, cpcpen, messpen; | |
| 625 | int i, cpcpen, messpen; | |
| 626 | 626 | unsigned char data1 = mess_ram[addr]; |
| 627 | 627 | unsigned char data2 = mess_ram[addr+1]; |
| 628 | 628 | |
| r1461 | r1462 | |
| 676 | 676 | messpen = amstrad_GateArray_render_colours[cpcpen]; |
| 677 | 677 | if ((x >= 0) && (x < bitmap->width) && (y >= 0) && (y < bitmap->height)) |
| 678 | 678 | *BITMAP_ADDR16(bitmap, y, x) = messpen; |
| 679 | x++; | |
| 679 | x++; | |
| 680 | 680 | data = data<<1; |
| 681 | 681 | } |
| 682 | 682 | } |
| r1461 | r1462 | |
| 804 | 804 | amstrad_plus_split_address = address; |
| 805 | 805 | } |
| 806 | 806 | |
| 807 | /* | |
| 807 | /* | |
| 808 | 808 | DMA commands |
| 809 | 809 | |
| 810 | 810 | 0RDDh LOAD R,D Load 8 bit data D to PSG register R (0<=R<=15) |
| r1461 | r1462 | |
| 813 | 813 | 3xxxh (reserved) Do not use |
| 814 | 814 | 4000h NOP No operation (64us idle) |
| 815 | 815 | 4001h LOOP If loop counter non zero, loop back to the first instruction after REPEAT instruction and decrement loop counter. |
| 816 | 4010h INT Interrupt the CPU | |
| 816 | 4010h INT Interrupt the CPU | |
| 817 | 817 | 4020h STOP Stop processing the sound list. |
| 818 | 818 | */ |
| 819 | 819 | |
| r1461 | r1462 | |
| 966 | 966 | y_screen_pos++; |
| 967 | 967 | } |
| 968 | 968 | // The GA has a counter that increments on every falling edge of the CRTC generated HSYNC signal. |
| 969 | ||
| 969 | ||
| 970 | 970 | amstrad_CRTC_HS_Counter++; |
| 971 | 971 | amstrad_scanline++; |
| 972 | 972 | |
| 973 | 973 | if (amstrad_CRTC_HS_After_VS_Counter != 0) // counters still operate regardless of PRI state |
| 974 | 974 | { |
| 975 | 975 | amstrad_CRTC_HS_After_VS_Counter--; |
| 976 | ||
| 976 | ||
| 977 | 977 | if (amstrad_CRTC_HS_After_VS_Counter == 0) |
| 978 | 978 | { |
| 979 | 979 | if (amstrad_CRTC_HS_Counter >= 32) |
| r1461 | r1462 | |
| 986 | 986 | amstrad_CRTC_HS_Counter = 0; |
| 987 | 987 | } |
| 988 | 988 | } |
| 989 | ||
| 989 | ||
| 990 | 990 | if (amstrad_CRTC_HS_Counter == 52) |
| 991 | 991 | { |
| 992 | 992 | amstrad_CRTC_HS_Counter = 0; |
| r1461 | r1462 | |
| 997 | 997 | } |
| 998 | 998 | if(amstrad_plus_asic_enabled != 0) |
| 999 | 999 | { |
| 1000 | // CPC+/GX4000 Programmable Raster Interrupt (disabled if &6800 in ASIC RAM is 0) | |
| 1000 | // CPC+/GX4000 Programmable Raster Interrupt (disabled if &6800 in ASIC RAM is 0) | |
| 1001 | 1001 | if(amstrad_plus_pri != 0) |
| 1002 | 1002 | { |
| 1003 | if(m6845_get_row_counter() == ((amstrad_plus_pri >> 3) & 0x1f) && m6845_get_scanline_counter() == (amstrad_plus_pri & 0x07)) | |
| 1003 | if(m6845_get_row_counter() == ((amstrad_plus_pri >> 3) & 0x1f) && m6845_get_scanline_counter() == (amstrad_plus_pri & 0x07)) | |
| 1004 | 1004 | { |
| 1005 | 1005 | // logerror("PRI: triggered, scanline %i, VSync width = %i\n",amstrad_scanline,vid.vertical_sync_width); |
| 1006 | 1006 | cpunum_set_input_line(0,0,ASSERT_LINE); |
| r1461 | r1462 | |
| 1033 | 1033 | amstrad_CRTC_HS = data; |
| 1034 | 1034 | if(amstrad_scanline > 311) // 312 scanlines by default |
| 1035 | 1035 | amstrad_scanline = 0; |
| 1036 | } | |
| 1036 | } | |
| 1037 | 1037 | |
| 1038 | 1038 | /* CRTC - Set new Vertical Sync Status*/ |
| 1039 | 1039 | static void amstrad_Set_VS(int offset, int data) |
| r1461 | r1462 | |
| 1063 | 1063 | amstrad_Set_HS, // Horizontal status |
| 1064 | 1064 | amstrad_Set_VS, // Vertical status |
| 1065 | 1065 | amstrad_Set_DE, // Display Enabled status |
| 1066 | amstrad_Set_CR, // Cursor status | |
| 1066 | amstrad_Set_CR, // Cursor status | |
| 1067 | 1067 | }; |
| 1068 | 1068 | |
| 1069 | 1069 | /************************************************************************ |
| r1461 | r1462 | |
| 1091 | 1091 | } |
| 1092 | 1092 | } |
| 1093 | 1093 | #endif |
| 1094 | copybitmap(bitmap, amstrad_bitmap, 0,0,0,0,&rect, TRANSPARENCY_NONE,0); | |
| 1094 | copybitmap(bitmap, amstrad_bitmap, 0,0,0,0,&rect, TRANSPARENCY_NONE,0); | |
| 1095 | 1095 | if(amstrad_plus_asic_enabled != 0) |
| 1096 | 1096 | amstrad_plus_sprite_draw(bitmap); |
| 1097 | 1097 | amstrad_scanline = y_screen_pos - 32; |
| r1461 | r1462 | |
| 1113 | 1113 | m6845_config(&amstrad6845); |
| 1114 | 1114 | m6845_reset(0); |
| 1115 | 1115 | m6845_get_state(0, &amstrad_vidhrdw_6845_state); |
| 1116 | ||
| 1116 | ||
| 1117 | 1117 | draw_function = amstrad_draw_screen_disabled; |
| 1118 | ||
| 1118 | ||
| 1119 | 1119 | amstrad_CRTC_HS_After_VS_Counter = 2; |
| 1120 | 1120 | x_screen_pos = x_screen_offset; |
| 1121 | 1121 | y_screen_pos = y_screen_offset; |
| r1461 | r1462 | |
|---|---|---|
| 135 | 135 | /*stylus_pointer->colortable = stylus_color_table;*/ |
| 136 | 136 | stylus_pointer->total_colors = 3; |
| 137 | 137 | stylus_color_table[1] = machine->pens[0]; |
| 138 | stylus_color_table[2] = machine->pens[1]; | |
| 138 | stylus_color_table[2] = machine->pens[1]; | |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | /* two colours */ |
| r1461 | r1462 | |
| 178 | 178 | #ifdef AVIGO_VIDEO_DEBUG |
| 179 | 179 | logerror("backdrop %s successfully loaded\n", backdrop_name); |
| 180 | 180 | #endif |
| 181 | memcpy (&sys_palette[used * 3], avigo_backdrop->orig_palette, | |
| 181 | memcpy (&sys_palette[used * 3], avigo_backdrop->orig_palette, | |
| 182 | 182 | avigo_backdrop->num_pens_used * 3 * sizeof (unsigned char)); |
| 183 | 183 | } |
| 184 | 184 | else |
| r1461 | r1462 | |
| 218 | 218 | int by; |
| 219 | 219 | |
| 220 | 220 | unsigned char *line_ptr = avigo_video_memory + (y*(AVIGO_SCREEN_WIDTH>>3)); |
| 221 | ||
| 221 | ||
| 222 | 222 | x = 0; |
| 223 | 223 | for (by=((AVIGO_SCREEN_WIDTH>>3)-1); by>=0; by--) |
| 224 | 224 | { |
| r1461 | r1462 | |
| 236 | 236 | } |
| 237 | 237 | |
| 238 | 238 | x = px; |
| 239 | ||
| 239 | ||
| 240 | 240 | line_ptr = line_ptr+1; |
| 241 | 241 | } |
| 242 | 242 | } |
| r1461 | r1462 | |
|---|---|---|
| 380 | 380 | { |
| 381 | 381 | int i; |
| 382 | 382 | |
| 383 | /* our line buffer */ | |
| 383 | /* our line buffer */ | |
| 384 | 384 | UINT16 *line_buffer = BITMAP_ADDR16( vce.bmp, line, 0 ); |
| 385 | ||
| 385 | ||
| 386 | 386 | for( i=0; i< VDC_WPF; i++ ) |
| 387 | 387 | line_buffer[i] = get_black_pen( Machine ); |
| 388 | 388 | } |
| r1461 | r1462 | |
| 394 | 394 | /* Are we in greyscale mode or in color mode? */ |
| 395 | 395 | int color_base = vce.vce_control & 0x80 ? 512 : 0; |
| 396 | 396 | |
| 397 | /* our line buffer */ | |
| 397 | /* our line buffer */ | |
| 398 | 398 | UINT16 *line_buffer = BITMAP_ADDR16( vce.bmp, line, 0 ); |
| 399 | ||
| 399 | ||
| 400 | 400 | for ( i = 0; i < VDC_WPF; i++ ) |
| 401 | 401 | line_buffer[i] = Machine->pens[color_base + vce.vce_data[0x100].w]; |
| 402 | 402 | } |
| r1461 | r1462 | |
| 409 | 409 | |
| 410 | 410 | /* our line buffer */ |
| 411 | 411 | UINT16 *line_buffer = BITMAP_ADDR16( vce.bmp, line, 0 ); |
| 412 | ||
| 412 | ||
| 413 | 413 | for ( i = 0; i < VDC_WPF; i++ ) |
| 414 | 414 | line_buffer[i] = Machine->pens[color_base + vce.vce_data[0].w]; |
| 415 | 415 | } |
| r1461 | r1462 | |
| 762 | 762 | /* Are we in greyscale mode or in color mode? */ |
| 763 | 763 | int color_base = vce.vce_control & 0x80 ? 512 : 0; |
| 764 | 764 | |
| 765 | /* count up: Highest priority is Sprite 0 */ | |
| 765 | /* count up: Highest priority is Sprite 0 */ | |
| 766 | 766 | for(i=0; i<64; i++) |
| 767 | 767 | { |
| 768 | 768 | static const int cgy_table[] = {16, 32, 64, 64}; |
| r1461 | r1462 | |
| 807 | 807 | vdc[which].status |= VDC_OR; |
| 808 | 808 | if(vdc[which].vdc_data[CR].w&CR_OV) |
| 809 | 809 | cpunum_set_input_line(0, 0, ASSERT_LINE); |
| 810 | continue; /* Should cause an interrupt */ | |
| 810 | continue; /* Should cause an interrupt */ | |
| 811 | 811 | } |
| 812 | 812 | |
| 813 | 813 | cgypos = (obj_l >> 4); |
| r1461 | r1462 | |
| 828 | 828 | if( drawn[pixel_x] < 2 ) { |
| 829 | 829 | if( priority || drawn[pixel_x] == 0 ) { |
| 830 | 830 | line_buffer[pixel_x] = Machine->pens[color_base + vce.vce_data[0x100 + (palette << 4) + buf[x]].w]; |
| 831 | if ( vdc[which].physical_width != 512 ) { | |
| 831 | if ( vdc[which].physical_width != 512 ) { | |
| 832 | 832 | int dp = 1; |
| 833 | while ( pixel_x + dp < ( ( ( obj_x + x + 1 ) * 512 ) / vdc[which].physical_width ) ) { | |
| 833 | while ( pixel_x + dp < ( ( ( obj_x + x + 1 ) * 512 ) / vdc[which].physical_width ) ) { | |
| 834 | 834 | drawn[pixel_x + dp] = i + 2; |
| 835 | 835 | line_buffer[pixel_x + dp] = Machine->pens[color_base + vce.vce_data[0x100 + (palette << 4) + buf[x]].w]; |
| 836 | 836 | dp++; |
| r1461 | r1462 | |
| 921 | 921 | line_buffer[pixel_x + dp] = Machine->pens[color_base + vce.vce_data[0x100 + (palette << 4) + buf[x]].w]; |
| 922 | 922 | dp++; |
| 923 | 923 | } |
| 924 | } | |
| 924 | } | |
| 925 | 925 | } |
| 926 | 926 | drawn[pixel_x] = i + 2; |
| 927 | 927 | } |
| r1461 | r1462 | |
| 950 | 950 | int src = vdc[which].vdc_data[SOUR].w; |
| 951 | 951 | int dst = vdc[which].vdc_data[DESR].w; |
| 952 | 952 | int len = vdc[which].vdc_data[LENR].w; |
| 953 | ||
| 953 | ||
| 954 | 954 | int did = (vdc[which].vdc_data[DCR].w >> 3) & 1; |
| 955 | 955 | int sid = (vdc[which].vdc_data[DCR].w >> 2) & 1; |
| 956 | 956 | int dvc = (vdc[which].vdc_data[DCR].w >> 1) & 1; |
| 957 | ||
| 957 | ||
| 958 | 958 | do { |
| 959 | 959 | UINT8 l, h; |
| 960 | 960 | |
| r1461 | r1462 | |
| 966 | 966 | |
| 967 | 967 | if(sid) src = (src - 1) & 0xFFFF; |
| 968 | 968 | else src = (src + 1) & 0xFFFF; |
| 969 | ||
| 969 | ||
| 970 | 970 | if(did) dst = (dst - 1) & 0xFFFF; |
| 971 | 971 | else dst = (dst + 1) & 0xFFFF; |
| 972 | ||
| 972 | ||
| 973 | 973 | len = (len - 1) & 0xFFFF; |
| 974 | ||
| 974 | ||
| 975 | 975 | } while (len != 0xFFFF); |
| 976 | ||
| 976 | ||
| 977 | 977 | vdc[which].status |= VDC_DV; |
| 978 | 978 | vdc[which].vdc_data[SOUR].w = src; |
| 979 | 979 | vdc[which].vdc_data[DESR].w = dst; |
| r1461 | r1462 | |
| 982 | 982 | { |
| 983 | 983 | cpunum_set_input_line(0, 0, ASSERT_LINE); |
| 984 | 984 | } |
| 985 | ||
| 985 | ||
| 986 | 986 | } |
| 987 | 987 | |
| 988 | 988 | static void vpc_update_prio_map( void ) { |
| r1461 | r1462 | |
|---|---|---|
| 220 | 220 | UINT8 data = 0; |
| 221 | 221 | int bit, i; |
| 222 | 222 | |
| 223 | switch (offset) | |
| 223 | switch (offset) | |
| 224 | 224 | { |
| 225 | case 0xa1: | |
| 225 | case 0xa1: | |
| 226 | 226 | |
| 227 | 227 | if (horiz_scan_active()) |
| 228 | 228 | data |= 1; |
| r1461 | r1462 | |
| 232 | 232 | |
| 233 | 233 | break; |
| 234 | 234 | |
| 235 | case 0xa2: | |
| 235 | case 0xa2: | |
| 236 | 236 | |
| 237 | 237 | bit = 0x01; |
| 238 | 238 | |
| r1461 | r1462 | |
| 240 | 240 | { |
| 241 | 241 | /* o2_vdc.s.collision at this point has the requested bit(s) |
| 242 | 242 | * to test the current collisions against. TODO: Sometimes |
| 243 | * $A2 has more than one bit set. What are the correct semantics | |
| 243 | * $A2 has more than one bit set. What are the correct semantics | |
| 244 | 244 | * of that when reading back? For now having an entire byte |
| 245 | 245 | * for each graphics object that can collide is working. |
| 246 | 246 | */ |
| 247 | 247 | |
| 248 | if (bit & o2_vdc.s.collision) | |
| 248 | if (bit & o2_vdc.s.collision) | |
| 249 | 249 | data |= (collision[i] & ~bit); |
| 250 | 250 | |
| 251 | 251 | bit <<= 1; |
| r1461 | r1462 | |
| 253 | 253 | |
| 254 | 254 | break; |
| 255 | 255 | |
| 256 | case 0xa4: | |
| 256 | case 0xa4: | |
| 257 | 257 | |
| 258 | 258 | if ((o2_vdc.s.control & VDC_CONTROL_REG_STROBE_XY)) |
| 259 | 259 | y_beam_pos = line; |
| r1461 | r1462 | |
| 287 | 287 | |
| 288 | 288 | if (offset == 0xa0) |
| 289 | 289 | { |
| 290 | if ( o2_vdc.s.control & VDC_CONTROL_REG_STROBE_XY | |
| 290 | if ( o2_vdc.s.control & VDC_CONTROL_REG_STROBE_XY | |
| 291 | 291 | && !(data & VDC_CONTROL_REG_STROBE_XY)) |
| 292 | 292 | { |
| 293 | 293 | /* Toggling strobe bit, tuck away values */ |
| 294 | x_beam_pos = get_horiz_clock_beam_pos(); | |
| 294 | x_beam_pos = get_horiz_clock_beam_pos(); | |
| 295 | 295 | y_beam_pos = line; |
| 296 | 296 | |
| 297 | 297 | /* This is wrong but more games work with it, TODO: Figure |
| 298 | 298 | * out correct change. Maybe update the screen here?? |
| 299 | * It seems what happens is 0x0 is written to $A0 just before | |
| 299 | * It seems what happens is 0x0 is written to $A0 just before | |
| 300 | 300 | * VLBANK (video update) so no screen updates happen. |
| 301 | 301 | */ |
| 302 | 302 | |
| r1461 | r1462 | |
| 320 | 320 | line_time = timer_get_time(); |
| 321 | 321 | line = (line + 1) % 262; |
| 322 | 322 | |
| 323 | switch (line) | |
| 323 | switch (line) | |
| 324 | 324 | { |
| 325 | 325 | case 252: |
| 326 | 326 | cpunum_set_input_line(0, 0, ASSERT_LINE); /* vsync?? */ |
| r1461 | r1462 | |
| 388 | 388 | color = o2_vdc.s.color & 7; |
| 389 | 389 | color |= (o2_vdc.s.color >> 3) & 8; |
| 390 | 390 | |
| 391 | for (i=0, x=0; x<9; x++, i++) | |
| 391 | for (i=0, x=0; x<9; x++, i++) | |
| 392 | 392 | { |
| 393 | for (j=1, y=0; y<9; y++, j<<=1) | |
| 393 | for (j=1, y=0; y<9; y++, j<<=1) | |
| 394 | 394 | { |
| 395 | 395 | if ( ((j<=0x80)&&(o2_vdc.s.hgrid[0][i]&j)) |
| 396 | 396 | ||((j>0x80)&&(o2_vdc.s.hgrid[1][i]&1)) ) |
| r1461 | r1462 | |
| 404 | 404 | if (o2_vdc.s.control & 0x80) /* fill solid to end of next vert line */ |
| 405 | 405 | w=width; |
| 406 | 406 | |
| 407 | for (i=0, x=0; x<10; x++, i++) | |
| 407 | for (i=0, x=0; x<10; x++, i++) | |
| 408 | 408 | { |
| 409 | 409 | for (j=1, y=0; y<8; y++, j<<=1) |
| 410 | 410 | { |
| 411 | if (o2_vdc.s.vgrid[i] & j) | |
| 411 | if (o2_vdc.s.vgrid[i] & j) | |
| 412 | 412 | { |
| 413 | 413 | odyssey2_draw_box(bg, x_grid_offset + x * width, y_grid_offset + y * height, w, height, COLLISION_VERTICAL_GRID); |
| 414 | 414 | plot_box(bitmap, x_grid_offset + x * width, y_grid_offset + y * height, w, height, Machine->pens[color]); |
| r1461 | r1462 | |
| 432 | 432 | // invaders aliens (!) and shoot (-) |
| 433 | 433 | n = 8 - (ptr & 7) - ((y >> 1) & 7); |
| 434 | 434 | |
| 435 | if (n < 3) | |
| 435 | if (n < 3) | |
| 436 | 436 | n += 7; |
| 437 | 437 | |
| 438 | for (i=0; i<n; i++) | |
| 438 | for (i=0; i<n; i++) | |
| 439 | 439 | { |
| 440 | 440 | if (y + i * 2 >= bitmap->height ) |
| 441 | break; | |
| 441 | break; | |
| 442 | 442 | |
| 443 | 443 | odyssey2_draw(bg, ((char*)o2_shape)[offset], x, y+i*2, 1, 2, COLLISION_CHARACTERS); |
| 444 | 444 | drawgfxzoom(bitmap, Machine->gfx[0], ((char*)o2_shape)[offset],0, |
| 445 | 445 | 0,0,x,y+i*2, |
| 446 | 0, TRANSPARENCY_PEN,0, 0x10000, 0x20000); | |
| 446 | 0, TRANSPARENCY_PEN,0, 0x10000, 0x20000); | |
| 447 | 447 | offset=(offset+1) & 0x1ff; |
| 448 | 448 | } |
| 449 | 449 | } |
| r1461 | r1462 | |
| 468 | 468 | |
| 469 | 469 | if (o2_vdc.s.control & 0x20) /* show foreground objects */ |
| 470 | 470 | { |
| 471 | for (i=0; i<ARRAY_LENGTH(o2_vdc.s.foreground); i++) | |
| 471 | for (i=0; i<ARRAY_LENGTH(o2_vdc.s.foreground); i++) | |
| 472 | 472 | { |
| 473 | 473 | odyssey2_draw_char(bitmap, bg, |
| 474 | 474 | o2_vdc.s.foreground[i].x, o2_vdc.s.foreground[i].y, |
| r1461 | r1462 | |
| 500 | 500 | { |
| 501 | 501 | if (o2_vdc.s.sprites[i].color & 4) |
| 502 | 502 | { |
| 503 | if (y+4*j>=bitmap->height) | |
| 503 | if (y+4*j>=bitmap->height) | |
| 504 | 504 | break; |
| 505 | 505 | odyssey2_draw_sprite(bg, o2_vdc.s.shape[i][j], x, y+j*4, 2, 4, 1<<i); /* 1 << i is sprite collision index */ |
| 506 | 506 | drawgfxzoom(bitmap, machine->gfx[1], o2_vdc.s.shape[i][j],0, |
| r1461 | r1462 | |
| 510 | 510 | |
| 511 | 511 | else |
| 512 | 512 | { |
| 513 | if (y+j*2>=bitmap->height) | |
| 513 | if (y+j*2>=bitmap->height) | |
| 514 | 514 | break; |
| 515 | 515 | odyssey2_draw_sprite(bg, o2_vdc.s.shape[i][j], x, y+j*2, 1, 2, 1<<i); /* 1 << i is sprite collision index */ |
| 516 | 516 | drawgfxzoom(bitmap, machine->gfx[1], o2_vdc.s.shape[i][j],0, |
| r1461 | r1462 | |
| 527 | 527 | { |
| 528 | 528 | for (x=0; x<320; x++) |
| 529 | 529 | { |
| 530 | switch (bg[y][x]) | |
| 530 | switch (bg[y][x]) | |
| 531 | 531 | { |
| 532 | 532 | case 0: case 1: case 2: case 4: case 8: |
| 533 | 533 | case 0x10: case 0x20: case 0x80: |
| r1461 | r1462 | |
|---|---|---|
| 271 | 271 | /* not sure about M6845_PERSONALITY_PREASIC */ |
| 272 | 272 | retval=R12_screen_start_address_H; |
| 273 | 273 | break; |
| 274 | ||
| 274 | ||
| 275 | 275 | default: |
| 276 | 276 | retval = 0; |
| 277 | 277 | break; |
| r1461 | r1462 | |
| 287 | 287 | /* not sure about M6845_PERSONALITY_PREASIC */ |
| 288 | 288 | retval=R13_screen_start_address_L; |
| 289 | 289 | break; |
| 290 | ||
| 290 | ||
| 291 | 291 | default: |
| 292 | 292 | retval = 0; |
| 293 | 293 | break; |
| r1461 | r1462 | |
|---|---|---|
| 280 | 280 | w = (((UINT32) vram_row[col+0] & 0x7f) << 0) |
| 281 | 281 | | (((UINT32) vram_row[col+1] & 0x7f) << 7) |
| 282 | 282 | | (((UINT32) vram_row[col+2] & 0x7f) << 14); |
| 283 | ||
| 283 | ||
| 284 | 284 | switch(columns) |
| 285 | 285 | { |
| 286 | 286 | case 40: |
| r1461 | r1462 | |
|---|---|---|
| 61 | 61 | { |
| 62 | 62 | int primo_scanline; |
| 63 | 63 | |
| 64 | for (primo_scanline=0; primo_scanline<192; primo_scanline++) | |
| 64 | for (primo_scanline=0; primo_scanline<192; primo_scanline++) | |
| 65 | 65 | primo_draw_scanline(bitmap, primo_scanline); |
| 66 | 66 | return 0; |
| 67 | 67 | } |
| r1461 | r1462 | |
|---|---|---|
| 102 | 102 | { 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8 }, |
| 103 | 103 | { 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf } |
| 104 | 104 | }; |
| 105 | ||
| 105 | ||
| 106 | 106 | PALETTE_INIT( ti85 ) |
| 107 | 107 | { |
| 108 | 108 | int used = sizeof (ti85_palette) / 3; |
| r1461 | r1462 | |
| 160 | 160 | lcdmem = ((ti85_LCD_memory_base & 0x3F) + 0xc0) << 0x08; |
| 161 | 161 | |
| 162 | 162 | memcpy (ti85_frames, ti85_frames+ti_video_memory_size, sizeof (UINT8) * (ti_number_of_frames-1) * ti_video_memory_size); |
| 163 | ||
| 164 | for (y=0; y<ti_screen_y_size; y++) | |
| 163 | ||
| 164 | for (y=0; y<ti_screen_y_size; y++) | |
| 165 | 165 | for (x=0; x<ti_screen_x_size; x++) |
| 166 | 166 | *(ti85_frames+(ti_number_of_frames-1)*ti_video_memory_size+y*ti_screen_x_size+x) = program_read_byte(lcdmem+y*ti_screen_x_size+x); |
| 167 | 167 | |
| 168 | for (y=0; y<ti_screen_y_size; y++) | |
| 168 | for (y=0; y<ti_screen_y_size; y++) | |
| 169 | 169 | for (x=0; x<ti_screen_x_size; x++) |
| 170 | 170 | for (b=0; b<8; b++) |
| 171 | 171 | { |
| r1461 | r1462 | |
|---|---|---|
| 4 | 4 | #include "includes/pocketc.h" |
| 5 | 5 | #include "includes/pc1251.h" |
| 6 | 6 | |
| 7 | static const POCKETC_FIGURE busy={ | |
| 7 | static const POCKETC_FIGURE busy={ | |
| 8 | 8 | "11 1 1 11 1 1", |
| 9 | 9 | "1 1 1 1 1 1 1", |
| 10 | 10 | "11 1 1 1 1 1", |
| 11 | 11 | "1 1 1 1 1 1", |
| 12 | 12 | "11 1 11 1e" |
| 13 | }, def={ | |
| 13 | }, def={ | |
| 14 | 14 | "11 111 111", |
| 15 | 15 | "1 1 1 1", |
| 16 | 16 | "1 1 111 11", |
| 17 | 17 | "1 1 1 1", |
| 18 | "11 111 1e" | |
| 18 | "11 111 1e" | |
| 19 | 19 | }, shift={ |
| 20 | 20 | " 11 1 1 1 111 111", |
| 21 | 21 | "1 1 1 1 1 1", |
| 22 | 22 | " 1 111 1 11 1", |
| 23 | 23 | " 1 1 1 1 1 1", |
| 24 | "11 1 1 1 1 1e" | |
| 24 | "11 1 1 1 1 1e" | |
| 25 | 25 | }, hyp={ |
| 26 | 26 | "1 1 1 1 11", |
| 27 | 27 | "1 1 1 1 1 1", |
| 28 | 28 | "111 1 1 11", |
| 29 | 29 | "1 1 1 1", |
| 30 | "1 1 1 1e" | |
| 30 | "1 1 1 1e" | |
| 31 | 31 | }, de={ |
| 32 | 32 | "11 111", |
| 33 | 33 | "1 1 1", |
| r1461 | r1462 | |
| 39 | 39 | "1", |
| 40 | 40 | "1 1", |
| 41 | 41 | "1 1", |
| 42 | " 11e" | |
| 42 | " 11e" | |
| 43 | 43 | }, rad={ |
| 44 | 44 | "11 1 11", |
| 45 | 45 | "1 1 1 1 1 1", |
| r1461 | r1462 | |
| 63 | 63 | "1", |
| 64 | 64 | "111", |
| 65 | 65 | "1", |
| 66 | "111e" | |
| 67 | }, run={ | |
| 66 | "111e" | |
| 67 | }, run={ | |
| 68 | 68 | "11 1 1 1 1", |
| 69 | 69 | "1 1 1 1 11 1", |
| 70 | 70 | "11 1 1 1 11", |
| 71 | 71 | "1 1 1 1 1 1", |
| 72 | "1 1 1 1 1e" | |
| 73 | }, pro={ | |
| 72 | "1 1 1 1 1e" | |
| 73 | }, pro={ | |
| 74 | 74 | "11 11 1 ", |
| 75 | 75 | "1 1 1 1 1 1", |
| 76 | 76 | "11 11 1 1", |
| 77 | 77 | "1 1 1 1 1", |
| 78 | "1 1 1 1e" | |
| 79 | }, japan={ | |
| 78 | "1 1 1 1e" | |
| 79 | }, japan={ | |
| 80 | 80 | " 1 1 11 1 1 1", |
| 81 | 81 | " 1 1 1 1 1 1 1 11 1", |
| 82 | 82 | " 1 111 11 111 1 11", |
| 83 | 83 | "1 1 1 1 1 1 1 1 1", |
| 84 | " 1 1 1 1 1 1 1 1e" | |
| 85 | }, sml={ | |
| 84 | " 1 1 1 1 1 1 1 1e" | |
| 85 | }, sml={ | |
| 86 | 86 | " 11 1 1 1", |
| 87 | 87 | "1 111 1", |
| 88 | 88 | " 1 1 1 1", |
| 89 | 89 | " 1 1 1 1", |
| 90 | "11 1 1 111e" | |
| 91 | }, rsv={ | |
| 90 | "11 1 1 111e" | |
| 91 | }, rsv={ | |
| 92 | 92 | "11 11 1 1", |
| 93 | 93 | "1 1 1 1 1", |
| 94 | 94 | "11 1 1 1", |
| 95 | 95 | "1 1 1 1 1", |
| 96 | "1 1 11 1e" | |
| 96 | "1 1 11 1e" | |
| 97 | 97 | }; |
| 98 | 98 | |
| 99 | 99 | static struct { |
| r1461 | r1462 | |
| 121 | 121 | { |
| 122 | 122 | int x, y, i, j; |
| 123 | 123 | int color[2]; |
| 124 | ||
| 124 | ||
| 125 | 125 | bitmap_fill(bitmap, cliprect, 5); |
| 126 | ||
| 126 | ||
| 127 | 127 | /* HJB: we cannot initialize array with values from other arrays, thus... */ |
| 128 | 128 | color[0] = machine->pens[pocketc_colortable[PC1251_CONTRAST][0]]; |
| 129 | 129 | color[1] = machine->pens[pocketc_colortable[PC1251_CONTRAST][1]]; |
| r1461 | r1462 | |
|---|---|---|
| 67 | 67 | mame_bitmap *bitmap; |
| 68 | 68 | } vc4000_video = |
| 69 | 69 | { |
| 70 | { | |
| 70 | { | |
| 71 | 71 | { &vc4000_video.reg.d.sprites[0],1 }, |
| 72 | { &vc4000_video.reg.d.sprites[1],2 }, | |
| 72 | { &vc4000_video.reg.d.sprites[1],2 }, | |
| 73 | 73 | { &vc4000_video.reg.d.sprites[2],4 }, |
| 74 | 74 | { &vc4000_video.reg.d.sprite4,8 } |
| 75 | } | |
| 75 | } | |
| 76 | 76 | }; |
| 77 | 77 | |
| 78 | 78 | VIDEO_START(vc4000) |
| 79 | 79 | { |
| 80 | 80 | int i; |
| 81 | ||
| 81 | ||
| 82 | 82 | for (i=0;i<0x20; i++) |
| 83 | 83 | { |
| 84 | 84 | sprite_collision[i]=0; |
| r1461 | r1462 | |
| 111 | 111 | data |= 1; |
| 112 | 112 | vc4000_video.sprites[3].finished = FALSE; |
| 113 | 113 | } |
| 114 | ||
| 114 | ||
| 115 | 115 | if (vc4000_video.sprites[2].finished) |
| 116 | 116 | { |
| 117 | 117 | data |= 2; |
| r1461 | r1462 | |
| 151 | 151 | // between 20 and 225 |
| 152 | 152 | if (!activecpu_get_reg(S2650_FO)) |
| 153 | 153 | { |
| 154 | if (input_port_7_r(0)&0x1) data=20; | |
| 154 | if (input_port_7_r(0)&0x1) data=20; | |
| 155 | 155 | if (input_port_7_r(0)&0x2) data=225; |
| 156 | 156 | } |
| 157 | 157 | else |
| r1461 | r1462 | |
| 245 | 245 | |
| 246 | 246 | static void vc4000_draw_digit(mame_bitmap *bitmap, int x, int y, int d, int line) |
| 247 | 247 | { |
| 248 | static const int digit_to_segment[0x10]={ | |
| 248 | static const int digit_to_segment[0x10]={ | |
| 249 | 249 | 0x0fff, 0x007c, 0x17df, 0x15ff, 0x1c7d, 0x1df7, 0x1ff7, 0x007f, 0x1fff, 0x1dff |
| 250 | 250 | }; |
| 251 | 251 | int i,j; |
| r1461 | r1462 | |
| 324 | 324 | } |
| 325 | 325 | |
| 326 | 326 | if (This->y>252) break; |
| 327 | ||
| 327 | ||
| 328 | 328 | This->delay=0; |
| 329 | 329 | This->state++; |
| 330 | 330 | |
| r1461 | r1462 | |
| 382 | 382 | case 3: w=4;break; |
| 383 | 383 | } |
| 384 | 384 | switch (i&3) { |
| 385 | case 0: | |
| 385 | case 0: | |
| 386 | 386 | if (k&1) w=8;break; |
| 387 | 387 | case 1: |
| 388 | 388 | if ((line%40)<=10) { |
| r1461 | r1462 | |
| 472 | 472 | (vc4000_video.sprites[2].finished_now) | |
| 473 | 473 | (vc4000_video.sprites[1].finished_now) | |
| 474 | 474 | (vc4000_video.sprites[0].finished_now)) |
| 475 | { | |
| 475 | { | |
| 476 | 476 | cpunum_set_input_line_vector(0, 0, 3); |
| 477 | 477 | cpunum_set_input_line(0, 0, PULSE_LINE); |
| 478 | 478 | } |
| r1461 | r1462 | |
|---|---|---|
| 74 | 74 | horizontal_pos = program_read_byte(0x2ba8); |
| 75 | 75 | if (horizontal_pos > 0x0b) |
| 76 | 76 | { |
| 77 | black_area.min_x = 0; | |
| 77 | black_area.min_x = 0; | |
| 78 | 78 | black_area.max_x = 8*(horizontal_pos-0x0b)-1; |
| 79 | 79 | } |
| 80 | 80 | if (horizontal_pos < 0x0b) |
| 81 | 81 | { |
| 82 | black_area.min_x = 8*(21+horizontal_pos); | |
| 82 | black_area.min_x = 8*(21+horizontal_pos); | |
| 83 | 83 | black_area.max_x = 32*8-1; |
| 84 | 84 | } |
| 85 | 85 | if (horizontal_pos == 0x0b) |
| 86 | black_area.min_x = black_area.max_x = 0; | |
| 86 | black_area.min_x = black_area.max_x = 0; | |
| 87 | 87 | fillbitmap(bitmap, machine->pens[1], &black_area); |
| 88 | } | |
| 88 | } | |
| 89 | 89 | |
| 90 | 90 | for( offs = 0; offs < 512; offs++ ) |
| 91 | 91 | { |
| r1461 | r1462 | |
| 93 | 93 | int code = videoram[offs]; |
| 94 | 94 | |
| 95 | 95 | sx = (offs % 32) * 8 + horizontal_pos*8-88; |
| 96 | ||
| 96 | ||
| 97 | 97 | if (sx>=0 && sx<32*8) |
| 98 | 98 | { |
| 99 | 99 | if ((code>63 && code<96) || (code>127 && code<192)) |
| r1461 | r1462 | |
|---|---|---|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | timer_adjust(cdp1861_dma_timer, ATTOTIME_IN_CYCLES(CDP1861_CYCLES_DMA_WAIT, 0), 0, attotime_zero); |
| 89 | ||
| 89 | ||
| 90 | 90 | cdp1861.dmaout = 0; |
| 91 | 91 | } |
| 92 | 92 | else |
| r1461 | r1462 | |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | timer_adjust(cdp1861_dma_timer, ATTOTIME_IN_CYCLES(CDP1861_CYCLES_DMA_ACTIVE, 0), 0, attotime_zero); |
| 103 | ||
| 103 | ||
| 104 | 104 | cdp1861.dmaout = 1; |
| 105 | 105 | } |
| 106 | 106 | } |
| r1461 | r1462 | |
|---|---|---|
| 22 | 22 | |
| 23 | 23 | /* |
| 24 | 24 | foreground: |
| 25 | ||
| 25 | ||
| 26 | 26 | "full" of each component |
| 27 | 27 | |
| 28 | black, | |
| 29 | blue, | |
| 30 | red, | |
| 31 | magenta, | |
| 32 | green, | |
| 28 | black, | |
| 29 | blue, | |
| 30 | red, | |
| 31 | magenta, | |
| 32 | green, | |
| 33 | 33 | cyan |
| 34 | 34 | yellow |
| 35 | 35 | white |
| 36 | 36 | |
| 37 | 37 | "full of each component + half of another component" |
| 38 | 38 | black |
| 39 | violet | |
| 39 | violet | |
| 40 | 40 | red/purple |
| 41 | 41 | pastel green |
| 42 | 42 | sky blue |
| r1461 | r1462 | |
| 60 | 60 | static const unsigned char kc85_palette[KC85_PALETTE_SIZE * 3] = |
| 61 | 61 | { |
| 62 | 62 | /* 3 bit colour value. bit 2->green, bit 1->red, bit 0->blue */ |
| 63 | ||
| 63 | ||
| 64 | 64 | /* foreground colours */ |
| 65 | 65 | 0x00, 0x00, 0x00, |
| 66 | 66 | 0x00, 0x00, 0xd0, |
| r1461 | r1462 | |
| 130 | 130 | /* bit 5,4,3 = foreground colour */ |
| 131 | 131 | /* bit 5: background colour -> Green */ |
| 132 | 132 | /* bit 4: background colour -> Red */ |
| 133 | /* bit 3: background colour -> Blue */ | |
| 133 | /* bit 3: background colour -> Blue */ | |
| 134 | 134 | /* bit 2,1,0 = background colour */ |
| 135 | 135 | /* bit 2: background colour -> Green */ |
| 136 | 136 | /* bit 1: background colour -> Red */ |
| 137 | 137 | /* bit 0: background colour -> Blue */ |
| 138 | background_pen = (colour_byte&7) + 16; | |
| 139 | foreground_pen = ((colour_byte>>3) & 0x0f); | |
| 138 | background_pen = (colour_byte&7) + 16; | |
| 139 | foreground_pen = ((colour_byte>>3) & 0x0f); | |
| 140 | 140 | |
| 141 | 141 | if (colour_byte & kc85_blink_state) |
| 142 | 142 | { |
| r1461 | r1462 | |
| 151 | 151 | for (a=0; a<8; a++) |
| 152 | 152 | { |
| 153 | 153 | int pen; |
| 154 | ||
| 154 | ||
| 155 | 155 | pen = pens[(gfx_byte>>7) & 0x01]; |
| 156 | 156 | |
| 157 | 157 | if ((px >= 0) && (px < bitmap->width) |
| r1461 | r1462 | |
| 195 | 195 | #define KC85_CYCLES_PER_LINE (KC85_CYCLES_PER_FRAME/KC85_FRAME_NUM_LINES) |
| 196 | 196 | #define KC85_CYCLES_PER_PIXEL (KC85_CYCLES_PER_LINE/KC85_LINE_SIZE) |
| 197 | 197 | |
| 198 | /* | |
| 198 | /* | |
| 199 | 199 | |
| 200 | 200 | - 1750000 cpu cycles per second |
| 201 | 201 | - 35000 cpu cycles per frame |
| r1461 | r1462 | |
| 205 | 205 | |
| 206 | 206 | /* Operation: |
| 207 | 207 | |
| 208 | - Vertical and horizontal dimensions are split into states. | |
| 208 | - Vertical and horizontal dimensions are split into states. | |
| 209 | 209 | - Horizontal states take a multiple of horizontal cycles, and vertical states take a multiple of lines. |
| 210 | 210 | - The horizontal states comprise left border, main display, right border and horizontal retrace timing. |
| 211 | 211 | - The vertical states comprise top border, main display, bottom border and vertical retrace timing. |
| 212 | 212 | |
| 213 | 213 | |
| 214 | 214 | - if frame rate is 50hz, and there are 312 lines, then the line rate is 15600hz. |
| 215 | - Each frame takes 0.02 seconds, and each line takes 0.0000064 seconds - approx 64microseconds per line | |
| 215 | - Each frame takes 0.02 seconds, and each line takes 0.0000064 seconds - approx 64microseconds per line | |
| 216 | 216 | |
| 217 | 217 | - the event list is based on cpu time |
| 218 | ||
| 218 | ||
| 219 | 219 | */ |
| 220 | 220 | |
| 221 | 221 | static int horizontal_next_state_table[]= |
| r1461 | r1462 | |
| 308 | 308 | /* border */ |
| 309 | 309 | case 0: |
| 310 | 310 | { |
| 311 | // video_update->render_x+=(cycles_to_do)*8; | |
| 311 | // video_update->render_x+=(cycles_to_do)*8; | |
| 312 | 312 | } |
| 313 | 313 | break; |
| 314 | 314 | |
| 315 | 315 | /* pixels */ |
| 316 | 316 | case 1: |
| 317 | { | |
| 317 | { | |
| 318 | 318 | int i; |
| 319 | ||
| 319 | ||
| 320 | 320 | for (i=0; i<cycles_to_do; i++) |
| 321 | 321 | { |
| 322 | 322 | unsigned char colour_byte; |
| r1461 | r1462 | |
| 360 | 360 | } |
| 361 | 361 | break; |
| 362 | 362 | } |
| 363 | ||
| 363 | ||
| 364 | 364 | video_update->horizontal.cycles_remaining_in_state -=cycles_to_do; |
| 365 | 365 | |
| 366 | 366 | /* is state over? */ |
| r1461 | r1462 | |
| 385 | 385 | { |
| 386 | 386 | /* do as many cycles as will fit onto the line */ |
| 387 | 387 | cycles_to_do = MIN(cycles,video_update->horizontal.cycles_remaining); |
| 388 | ||
| 388 | ||
| 389 | 389 | //logerror("process line: cycles_to_do: %d\n",cycles_to_do); |
| 390 | ||
| 390 | ||
| 391 | 391 | /* do the cycles - draw them */ |
| 392 | 392 | kc85_common_process_cycles(video_update, cycles_to_do); |
| 393 | 393 | |
| r1461 | r1462 | |
| 404 | 404 | /* update x,y fetch pos */ |
| 405 | 405 | video_update->x = 0; |
| 406 | 406 | video_update->y++; |
| 407 | ||
| 407 | ||
| 408 | 408 | /* update x,y render pos */ |
| 409 | 409 | video_update->render_x = 0; |
| 410 | 410 | video_update->render_y++; |
| r1461 | r1462 | |
| 432 | 432 | { |
| 433 | 433 | int cycles_to_do; |
| 434 | 434 | int cycles_done; |
| 435 | ||
| 435 | ||
| 436 | 436 | cycles_to_do = MIN(cycles, KC85_CYCLES_PER_LINE); |
| 437 | 437 | cycles_done = cycles_to_do; |
| 438 | 438 | |
| r1461 | r1462 | |
| 476 | 476 | break; |
| 477 | 477 | } |
| 478 | 478 | |
| 479 | ||
| 479 | ||
| 480 | 480 | //logerror("cycles done: %d\n",cycles_done); |
| 481 | 481 | video_update->vertical.cycles_remaining_in_state -=cycles_done; |
| 482 | 482 | |
| r1461 | r1462 | |
| 527 | 527 | while (NumItems) |
| 528 | 528 | { |
| 529 | 529 | int delta_cycles; |
| 530 | ||
| 530 | ||
| 531 | 531 | /* number of cycles until event will trigger */ |
| 532 | 532 | delta_cycles = pItem->Event_Time - cycles_offset; |
| 533 | 533 | |
| r1461 | r1462 | |
| 670 | 670 | { |
| 671 | 671 | unsigned char colour_byte, gfx_byte; |
| 672 | 672 | int offset; |
| 673 | ||
| 673 | ||
| 674 | 674 | offset = y | (x<<8); |
| 675 | 675 | |
| 676 | 676 | colour_byte = colour_ram[offset]; |
| 677 | 677 | gfx_byte = pixel_ram[offset]; |
| 678 | 678 | |
| 679 | 679 | kc85_draw_8_pixels(bitmap,(x<<3),y, colour_byte, gfx_byte); |
| 680 | ||
| 680 | ||
| 681 | 681 | } |
| 682 | 682 | } |
| 683 | 683 | #endif |
| r1461 | r1462 | |
| 739 | 739 | { |
| 740 | 740 | #if 0 |
| 741 | 741 | /* colour ram takes up 0x02800 bytes */ |
| 742 | unsigned char *pixel_ram = mess_ram+0x08000; | |
| 742 | unsigned char *pixel_ram = mess_ram+0x08000; | |
| 743 | 743 | unsigned char *colour_ram = pixel_ram + 0x02800; |
| 744 | 744 | |
| 745 | 745 | int x,y; |
| r1461 | r1462 | |
| 750 | 750 | { |
| 751 | 751 | unsigned char colour_byte, gfx_byte; |
| 752 | 752 | int pixel_offset,colour_offset; |
| 753 | ||
| 753 | ||
| 754 | 754 | if ((x & 0x020)==0) |
| 755 | 755 | { |
| 756 | 756 | pixel_offset = (x & 0x01f) | (((y>>2) & 0x03)<<5) | |
| 757 | 757 | ((y & 0x03)<<7) | (((y>>4) & 0x0f)<<9); |
| 758 | ||
| 758 | ||
| 759 | 759 | colour_offset = (x & 0x01f) | (((y>>2) & 0x03f)<<5); |
| 760 | 760 | } |
| 761 | 761 | else |
| r1461 | r1462 | |
| 765 | 765 | |
| 766 | 766 | pixel_offset = 0x02000+((x & 0x07) | (((y>>4) & 0x03)<<3) | |
| 767 | 767 | (((y>>2) & 0x03)<<5) | ((y & 0x03)<<7) | ((y>>6) & 0x03)<<9); |
| 768 | ||
| 768 | ||
| 769 | 769 | colour_offset = 0x0800+((x & 0x07) | (((y>>4) & 0x03)<<3) | |
| 770 | 770 | (((y>>2) & 0x03)<<5) | ((y>>6) & 0x03)<<7); |
| 771 | 771 | } |
| 772 | ||
| 772 | ||
| 773 | 773 | colour_byte = colour_ram[colour_offset]; |
| 774 | 774 | gfx_byte = pixel_ram[pixel_offset]; |
| 775 | 775 |
| r1461 | r1462 | |
|---|---|---|
| 49 | 49 | |
| 50 | 50 | static const char_info charinfo[] = |
| 51 | 51 | { |
| 52 | { 0x0008, "Backspace", NULL }, /* Backspace */ | |
| 52 | { 0x0008, "Backspace", NULL }, /* Backspace */ | |
| 53 | 53 | { 0x0009, "Tab", " " }, /* Tab */ |
| 54 | 54 | { 0x000c, "Clear", NULL }, /* Clear */ |
| 55 | 55 | { 0x000d, "Enter", NULL }, /* Enter */ |
| r1461 | r1462 | |
| 278 | 278 | { 0xffeb, NULL, "\xE2\x86\x92" }, /* fullwidth right arrow */ |
| 279 | 279 | { 0xffec, NULL, "\xE2\x86\x93" }, /* fullwidth down arrow */ |
| 280 | 280 | { 0xffed, NULL, "\xE2\x96\xAA" }, /* fullwidth solid box */ |
| 281 | { 0xffee, NULL, "\xE2\x97\xA6" }, /* fullwidth open circle */ | |
| 281 | { 0xffee, NULL, "\xE2\x97\xA6" }, /* fullwidth open circle */ | |
| 282 | 282 | { UCHAR_MAMEKEY(F1), "F1", NULL }, /* F1 function key */ |
| 283 | 283 | { UCHAR_MAMEKEY(F2), "F2", NULL }, /* F2 function key */ |
| 284 | 284 | { UCHAR_MAMEKEY(F3), "F3", NULL }, /* F3 function key */ |
| r1461 | r1462 | |
|---|---|---|
| 77 | 77 | |
| 78 | 78 | /**************************************************************************** |
| 79 | 79 | Tag management functions. |
| 80 | ||
| 80 | ||
| 81 | 81 | When devices have private data structures that need to be associated with a |
| 82 | 82 | device, it is recommended that image_alloctag() be called in the device |
| 83 | 83 | init function. If the allocation succeeds, then a pointer will be returned |
| r1461 | r1462 | |
|---|---|---|
| 60 | 60 | |
| 61 | 61 | #define PORT_CONFSETTING(default,name) \ |
| 62 | 62 | INPUT_PORT_UINT32_PAIR(INPUT_TOKEN_CONFSETTING, default), INPUT_PORT_PTR(name), |
| 63 | ||
| 63 | ||
| 64 | 64 | /* categories */ |
| 65 | 65 | #define PORT_CATEGORY(category) \ |
| 66 | 66 | INPUT_PORT_UINT32_PAIR(INPUT_TOKEN_CATEGORY, category), |
| r1461 | r1462 | |
|---|---|---|
| 172 | 172 | /* WATARA */ |
| 173 | 173 | DRIVER( svision ) /* Supervision Handheld */ |
| 174 | 174 | TESTDRIVER( svisions ) |
| 175 | ||
| 175 | ||
| 176 | 176 | TESTDRIVER( svisionp ) |
| 177 | 177 | TESTDRIVER( svisionn ) |
| 178 | 178 | TESTDRIVER( tvlinkp ) |
| r1461 | r1462 | |
| 432 | 432 | DRIVER( specp3sp ) /* 1987 ZX Spectrum +3 (Spain) */ |
| 433 | 433 | DRIVER( specpl3e ) /* 2000 ZX Spectrum +3e */ |
| 434 | 434 | DRIVER( specp3es ) /* 2000 ZX Spectrum +3e (Spain) */ |
| 435 | ||
| 435 | ||
| 436 | 436 | TESTDRIVER( scorpion ) |
| 437 | 437 | TESTDRIVER( pentagon ) |
| 438 | 438 | |
| r1461 | r1462 | |
| 564 | 564 | DRIVER( cp400 ) /* Prologica CP400 */ |
| 565 | 565 | DRIVER( mc10 ) /* MC-10 */ |
| 566 | 566 | DRIVER( alice ) /* Matra & Hachette Ordinateur Alice */ |
| 567 | ||
| 567 | ||
| 568 | 568 | /* EACA */ |
| 569 | 569 | DRIVER( cgenie ) /* Colour Genie EG2000 */ |
| 570 | 570 | /* system 80 trs80 compatible */ |
| r1461 | r1462 | |
|---|---|---|
| 248 | 248 | { |
| 249 | 249 | devices[i].devclass.get_info = handlers[i]; |
| 250 | 250 | devices[i].devclass.gamedrv = gamedrv; |
| 251 | ||
| 251 | ||
| 252 | 252 | /* convert file extensions from comma delimited to null delimited */ |
| 253 | 253 | converted_file_extensions = NULL; |
| 254 | 254 | file_extensions = device_get_info_string(&devices[i].devclass, DEVINFO_STR_FILE_EXTENSIONS); |
| r1461 | r1462 | |
| 263 | 263 | converted_file_extensions[j + 0] = '\0'; |
| 264 | 264 | converted_file_extensions[j + 1] = '\0'; |
| 265 | 265 | } |
| 266 | ||
| 266 | ||
| 267 | 267 | info_string = device_get_info_string(&devices[i].devclass, DEVINFO_STR_DEV_TAG); |
| 268 | 268 | devices[i].tag = info_string ? pool_strdup(pool, info_string) : NULL; |
| 269 | 269 | devices[i].type = device_get_info_int(&devices[i].devclass, DEVINFO_INT_TYPE); |
| r1461 | r1462 | |
| 292 | 292 | devices[i].name = default_device_name; |
| 293 | 293 | |
| 294 | 294 | devices[i].createimage_optguide = (const struct OptionGuide *) device_get_info_ptr(&devices[i].devclass, DEVINFO_PTR_CREATE_OPTGUIDE); |
| 295 | ||
| 295 | ||
| 296 | 296 | createimage_optcount = (int) device_get_info_int(&devices[i].devclass, DEVINFO_INT_CREATE_OPTCOUNT); |
| 297 | 297 | if (createimage_optcount > 0) |
| 298 | 298 | { |
| r1461 | r1462 | |
|---|---|---|
| 268 | 268 | exit(-1); |
| 269 | 269 | } |
| 270 | 270 | } |
| 271 | ||
| 271 | ||
| 272 | 272 | memset(&fs_item[fs_total], 0, sizeof(fs_item[fs_total])); |
| 273 | 273 | fs_order[fs_total] = fs_total; |
| 274 | 274 | return fs_total++; |
| r1461 | r1462 | |
| 291 | 291 | osd_directory *dir; |
| 292 | 292 | int qsort_start, count, i, n; |
| 293 | 293 | ui_menu_item *tmp_menu_item; |
| 294 | int *tmp_types; | |
| 294 | int *tmp_types; | |
| 295 | 295 | |
| 296 | 296 | /* just to be safe */ |
| 297 | 297 | fs_free(); |
| r1461 | r1462 | |
|---|---|---|
| 268 | 268 | |
| 269 | 269 | /* image creation options */ |
| 270 | 270 | const struct OptionGuide *createimage_optguide; |
| 271 | struct CreateImageOptions *createimage_options; | |
| 271 | struct CreateImageOptions *createimage_options; | |
| 272 | 272 | }; |
| 273 | 273 | |
| 274 | 274 |
| r1461 | r1462 | |
|---|---|---|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | /* File Extensions Checks |
| 54 | * | |
| 54 | * | |
| 55 | 55 | * Checks the following |
| 56 | 56 | * |
| 57 | 57 | * 1. Tests the integrity of the string list |
| r1461 | r1462 | |
| 134 | 134 | error = 1; |
| 135 | 135 | } |
| 136 | 136 | break; |
| 137 | ||
| 137 | ||
| 138 | 138 | default: |
| 139 | 139 | break; |
| 140 | 140 | } |
| r1461 | r1462 | |
|---|---|---|
| 372 | 372 | if (*pattern != TILDE || !(pglob->gl_flags & GLOB_TILDE)) |
| 373 | 373 | return pattern; |
| 374 | 374 | |
| 375 | /* | |
| 376 | * Copy up to the end of the string or / | |
| 375 | /* | |
| 376 | * Copy up to the end of the string or / | |
| 377 | 377 | */ |
| 378 | 378 | eb = &patbuf[patbuf_len - 1]; |
| 379 | 379 | for (p = pattern + 1, h = (char *) patbuf; |
| r1461 | r1462 | |
| 437 | 437 | int c, err, oldpathc; |
| 438 | 438 | Char *bufnext, patbuf[_MAX_PATH+1]; |
| 439 | 439 | |
| 440 | qpatnext = globtilde(pattern, patbuf, sizeof(patbuf) / sizeof(Char), | |
| 440 | qpatnext = globtilde(pattern, patbuf, sizeof(patbuf) / sizeof(Char), | |
| 441 | 441 | pglob); |
| 442 | 442 | oldpathc = pglob->gl_pathc; |
| 443 | 443 | bufnext = patbuf; |
| r1461 | r1462 | |
|---|---|---|
| 5 | 5 | #include <sys/types.h> |
| 6 | 6 | #include <ctype.h> |
| 7 | 7 | #include <errno.h> |
| 8 | ||
| 8 | ||
| 9 | 9 | #include "osdmess.h" |
| 10 | 10 | #include "utils.h" |
| 11 | 11 | |
| r1461 | r1462 | |
| 127 | 127 | basename = "tempfile"; |
| 128 | 128 | |
| 129 | 129 | sprintf(tempbuf, "/tmp/%s", basename); |
| 130 | unlink(tempbuf); | |
| 130 | unlink(tempbuf); | |
| 131 | 131 | |
| 132 | strncpy(buffer, tempbuf, buffer_len); | |
| 132 | strncpy(buffer, tempbuf, buffer_len); | |
| 133 | 133 | |
| 134 | 134 | return FILERR_NONE; |
| 135 | 135 | } |
| r1461 | r1462 | |
|---|---|---|
| 862 | 862 | HWND dlgwnd, editwnd; |
| 863 | 863 | int value, id; |
| 864 | 864 | LONG_PTR l; |
| 865 | ||
| 865 | ||
| 866 | 866 | l = GetWindowLongPtr(sbwnd, GWLP_USERDATA); |
| 867 | 867 | stuff = (struct adjuster_sb_stuff *) l; |
| 868 | 868 | |
| r1461 | r1462 | |
| 1075 | 1075 | if (strcmp(buffer, astring_c(seqstring))) |
| 1076 | 1076 | win_set_window_text_utf8(editwnd, astring_c(seqstring)); |
| 1077 | 1077 | |
| 1078 | // reset the selection | |
| 1078 | // reset the selection | |
| 1079 | 1079 | if (GetFocus() == editwnd) |
| 1080 | 1080 | SendMessage(editwnd, EM_SETSEL, 0, -1); |
| 1081 | 1081 | |
| r1461 | r1462 | |
| 1158 | 1158 | // get the basics |
| 1159 | 1159 | editwnd = (HWND) param; |
| 1160 | 1160 | stuff = get_seqselect_info(editwnd); |
| 1161 | ||
| 1161 | ||
| 1162 | 1162 | // stop the read |
| 1163 | 1163 | if (stuff->poll_state == SEQSELECT_STATE_POLLING) |
| 1164 | 1164 | stuff->poll_state = SEQSELECT_STATE_POLLING_COMPLETE; |
| r1461 | r1462 | |
| 1349 | 1349 | |
| 1350 | 1350 | port_name = input_port_name(port); |
| 1351 | 1351 | assert(port_name); |
| 1352 | ||
| 1352 | ||
| 1353 | 1353 | if (port_type_is_analog(port->type)) |
| 1354 | 1354 | { |
| 1355 | 1355 | seq_types[seq_count] = SEQ_TYPE_STANDARD; |
| r1461 | r1462 | |
| 1393 | 1393 | // no positions specified |
| 1394 | 1394 | dialog_new_control(di, &x, &y); |
| 1395 | 1395 | |
| 1396 | if (dialog_write_item(di, WS_CHILD | WS_VISIBLE | SS_LEFT | SS_NOPREFIX, x, y, | |
| 1396 | if (dialog_write_item(di, WS_CHILD | WS_VISIBLE | SS_LEFT | SS_NOPREFIX, x, y, | |
| 1397 | 1397 | dialog->layout->label_width, DIM_NORMAL_ROW_HEIGHT, this_port_name, DLGITEM_STATIC, NULL)) |
| 1398 | 1398 | return 1; |
| 1399 | 1399 | x += dialog->layout->label_width + DIM_HORIZONTAL_SPACING; |
| r1461 | r1462 | |
| 1420 | 1420 | width /= pixels_to_xdlgunits; |
| 1421 | 1421 | height /= pixels_to_ydlgunits; |
| 1422 | 1422 | |
| 1423 | if (dialog_add_single_seqselect(di, x, y, width, height, | |
| 1423 | if (dialog_add_single_seqselect(di, x, y, width, height, | |
| 1424 | 1424 | port, is_analog[seq], seq_types[seq])) |
| 1425 | 1425 | return 1; |
| 1426 | 1426 | } |
| r1461 | r1462 | |
|---|---|---|
| 292 | 292 | input_port_entry *in; |
| 293 | 293 | const char *switch_name = NULL; |
| 294 | 294 | UINT32 type; |
| 295 | ||
| 295 | ||
| 296 | 296 | dlg = win_dialog_init(ui_getstring(title_string_num), NULL); |
| 297 | 297 | if (!dlg) |
| 298 | 298 | goto done; |
| r1461 | r1462 | |
| 397 | 397 | const char *name; |
| 398 | 398 | char buf[255]; |
| 399 | 399 | static const struct dialog_layout layout = { 120, 52 }; |
| 400 | ||
| 400 | ||
| 401 | 401 | dlg = win_dialog_init(ui_getstring(UI_analogcontrols), &layout); |
| 402 | 402 | if (!dlg) |
| 403 | 403 | goto done; |
| r1461 | r1462 | |
| 555 | 555 | |
| 556 | 556 | // compute our parameters |
| 557 | 557 | dev = params->dev; |
| 558 | guide = dev->createimage_optguide; | |
| 558 | guide = dev->createimage_optguide; | |
| 559 | 559 | optspec = dev->createimage_options[format_combo_val].optspec; |
| 560 | 560 | |
| 561 | 561 | // set the default extension |
| r1461 | r1462 | |
| 611 | 611 | struct storeval_optres_params *params; |
| 612 | 612 | const struct IODevice *dev; |
| 613 | 613 | char buf[16]; |
| 614 | ||
| 614 | ||
| 615 | 615 | params = (struct storeval_optres_params *) storeval_param; |
| 616 | 616 | dev = params->fdparams->dev; |
| 617 | 617 | |
| r1461 | r1462 | |
| 764 | 764 | |
| 765 | 765 | // add the description |
| 766 | 766 | pos += snprintf(&dest[pos], dest_len - pos, "%s (", description); |
| 767 | ||
| 767 | ||
| 768 | 768 | // add the extensions to the description |
| 769 | 769 | pos += copy_extension_list(&dest[pos], dest_len - pos, extensions); |
| 770 | 770 | |
| r1461 | r1462 | |
| 903 | 903 | |
| 904 | 904 | if (!OpenClipboard(NULL)) |
| 905 | 905 | return; |
| 906 | ||
| 906 | ||
| 907 | 907 | h = GetClipboardData(CF_TEXT); |
| 908 | 908 | if (h) |
| 909 | 909 | { |
| r1461 | r1462 | |
| 1347 | 1347 | img = image_from_device_and_index(dev, i); |
| 1348 | 1348 | |
| 1349 | 1349 | if (!dev->not_working) |
| 1350 | { | |
| 1350 | { | |
| 1351 | 1351 | new_item = ID_DEVICE_0 + (image_absolute_index(img) * DEVOPTION_MAX); |
| 1352 | 1352 | flags_for_exists = MF_STRING; |
| 1353 | ||
| 1353 | ||
| 1354 | 1354 | if (!image_exists(img)) |
| 1355 | 1355 | flags_for_exists |= MF_GRAYED; |
| 1356 | ||
| 1356 | ||
| 1357 | 1357 | flags_for_writing = flags_for_exists; |
| 1358 | 1358 | if (!image_is_writable(img)) |
| 1359 | 1359 | flags_for_writing |= MF_GRAYED; |
| 1360 | ||
| 1360 | ||
| 1361 | 1361 | sub_menu = CreateMenu(); |
| 1362 | 1362 | append_menu_uistring(sub_menu, MF_STRING, new_item + DEVOPTION_OPEN, UI_mount); |
| 1363 | ||
| 1363 | ||
| 1364 | 1364 | if (dev->creatable) |
| 1365 | 1365 | append_menu_uistring(sub_menu, MF_STRING, new_item + DEVOPTION_CREATE, UI_create); |
| 1366 | ||
| 1366 | ||
| 1367 | 1367 | append_menu_uistring(sub_menu, flags_for_exists, new_item + DEVOPTION_CLOSE, UI_unmount); |
| 1368 | 1368 | |
| 1369 | 1369 | #if HAS_WAVE |
| r1461 | r1462 | |
| 1606 | 1606 | static mess_image *decode_deviceoption(int command, int *devoption) |
| 1607 | 1607 | { |
| 1608 | 1608 | int absolute_index; |
| 1609 | ||
| 1609 | ||
| 1610 | 1610 | command -= ID_DEVICE_0; |
| 1611 | 1611 | absolute_index = command / DEVOPTION_MAX; |
| 1612 | 1612 | |
| r1461 | r1462 | |
| 1915 | 1915 | mii.cbSize = sizeof(mii); |
| 1916 | 1916 | mii.fMask = MIIM_TYPE; |
| 1917 | 1917 | mii.dwTypeData = t_text; |
| 1918 | SetMenuItemInfo(menu_bar, command, FALSE, &mii); | |
| 1918 | SetMenuItemInfo(menu_bar, command, FALSE, &mii); | |
| 1919 | 1919 | |
| 1920 | 1920 | // cleanup |
| 1921 | 1921 | free(t_text); |
| r1461 | r1462 | |
|---|---|---|
| 170 | 170 | scroll_pos = si.nPos; |
| 171 | 171 | |
| 172 | 172 | // change scroll_pos in accordance with this message |
| 173 | switch(LOWORD(wparam)) | |
| 173 | switch(LOWORD(wparam)) | |
| 174 | 174 | { |
| 175 | 175 | case SB_BOTTOM: |
| 176 | 176 | scroll_pos = si.nMax; |
| r1461 | r1462 | |
|---|---|---|
| 103 | 103 | option_count++; |
| 104 | 104 | } |
| 105 | 105 | } |
| 106 | ||
| 106 | ||
| 107 | 107 | // if there is only one option, it is effectively disabled |
| 108 | 108 | if (option_count <= 1) |
| 109 | 109 | has_option = FALSE; |
| r1461 | r1462 | |
|---|---|---|
| 378 | 378 | if (*pattern != TILDE || !(pglob->gl_flags & GLOB_TILDE)) |
| 379 | 379 | return pattern; |
| 380 | 380 | |
| 381 | /* | |
| 382 | * Copy up to the end of the string or / | |
| 381 | /* | |
| 382 | * Copy up to the end of the string or / | |
| 383 | 383 | */ |
| 384 | 384 | eb = &patbuf[patbuf_len - 1]; |
| 385 | 385 | for (p = pattern + 1, h = (char *) patbuf; |
| r1461 | r1462 | |
| 443 | 443 | int c, err, oldpathc; |
| 444 | 444 | Char *bufnext, patbuf[_MAX_PATH+1]; |
| 445 | 445 | |
| 446 | qpatnext = globtilde(pattern, patbuf, sizeof(patbuf) / sizeof(Char), | |
| 446 | qpatnext = globtilde(pattern, patbuf, sizeof(patbuf) / sizeof(Char), | |
| 447 | 447 | pglob); |
| 448 | 448 | oldpathc = pglob->gl_pathc; |
| 449 | 449 | bufnext = patbuf; |
| r1461 | r1462 | |
|---|---|---|
| 59 | 59 | #define IDC_STATUS 6005 |
| 60 | 60 | |
| 61 | 61 | // Next default values for new objects |
| 62 | // | |
| 62 | // | |
| 63 | 63 | #ifdef APSTUDIO_INVOKED |
| 64 | 64 | #ifndef APSTUDIO_READONLY_SYMBOLS |
| 65 | 65 | #define _APS_NEXT_RESOURCE_VALUE 129 |
| r1461 | r1462 | |
|---|---|---|
| 118 | 118 | NULL, // pfnFindItemParent |
| 119 | 119 | SoftwarePicker_Idle, // pfnIdle |
| 120 | 120 | SoftwarePicker_OnHeaderContextMenu, // pfnOnHeaderContextMenu |
| 121 | NULL // pfnOnBodyContextMenu | |
| 121 | NULL // pfnOnBodyContextMenu | |
| 122 | 122 | }; |
| 123 | 123 | |
| 124 | 124 | |
| r1461 | r1462 | |
| 128 | 128 | NULL, // pfnGetShowTabCtrl |
| 129 | 129 | SetCurrentSoftwareTab, // pfnSetCurrentTab |
| 130 | 130 | GetCurrentSoftwareTab, // pfnGetCurrentTab |
| 131 | NULL, // pfnSetShowTab | |
| 132 | NULL, // pfnGetShowTab | |
| 131 | NULL, // pfnSetShowTab | |
| 132 | NULL, // pfnGetShowTab | |
| 133 | 133 | |
| 134 | 134 | SoftwareTabView_GetTabShortName, // pfnGetTabShortName |
| 135 | 135 | SoftwareTabView_GetTabLongName, // pfnGetTabLongName |
| 136 | 136 | |
| 137 | 137 | SoftwareTabView_OnSelectionChanged, // pfnOnSelectionChanged |
| 138 | SoftwareTabView_OnMoveSize // pfnOnMoveSize | |
| 138 | SoftwareTabView_OnMoveSize // pfnOnMoveSize | |
| 139 | 139 | }; |
| 140 | 140 | |
| 141 | 141 | |
| r1461 | r1462 | |
| 158 | 158 | { IO_CARTSLOT, "roms", "Cartridge images" }, |
| 159 | 159 | { IO_FLOPPY, "floppy", "Floppy disk images" }, |
| 160 | 160 | { IO_HARDDISK, "hard", "Hard disk images" }, |
| 161 | { IO_CYLINDER, NULL, "Cylinders" }, | |
| 161 | { IO_CYLINDER, NULL, "Cylinders" }, | |
| 162 | 162 | { IO_CASSETTE, NULL, "Cassette images" }, |
| 163 | 163 | { IO_PUNCHCARD, NULL, "Punchcard images" }, |
| 164 | 164 | { IO_PUNCHTAPE, NULL, "Punchtape images" }, |
| r1461 | r1462 | |
| 341 | 341 | const game_driver *drv; |
| 342 | 342 | HWND hwndSoftwarePicker; |
| 343 | 343 | HWND hwndSoftwareDevView; |
| 344 | ||
| 344 | ||
| 345 | 345 | hwndSoftwarePicker = GetDlgItem(GetMainWindow(), IDC_SWLIST); |
| 346 | 346 | hwndSoftwareDevView = GetDlgItem(GetMainWindow(), IDC_SWDEVVIEW); |
| 347 | 347 | |
| r1461 | r1462 | |
| 702 | 702 | *(s++) = '|'; |
| 703 | 703 | } |
| 704 | 704 | *(s++) = '|'; |
| 705 | ||
| 705 | ||
| 706 | 706 | t_buffer = tstring_from_utf8(szFilter); |
| 707 | 707 | if( !t_buffer ) |
| 708 | 708 | return FALSE; |
| r1461 | r1462 | |
| 741 | 741 | { |
| 742 | 742 | //GetDirectory(filename,last_directory,sizeof(last_directory)); |
| 743 | 743 | } |
| 744 | ||
| 744 | ||
| 745 | 745 | return success; |
| 746 | 746 | } |
| 747 | 747 | |
| r1461 | r1462 | |
| 900 | 900 | LPCTSTR t_buffer = NULL; |
| 901 | 901 | TCHAR* t_s; |
| 902 | 902 | LPCSTR s = GetSelectedSoftware(nDriverIndex, &dev->devclass, nID); |
| 903 | ||
| 903 | ||
| 904 | 904 | t_s = tstring_from_utf8(s); |
| 905 | 905 | if( !t_s ) |
| 906 | 906 | return t_buffer; |
| 907 | ||
| 907 | ||
| 908 | 908 | _sntprintf(pszBuffer, nBufferLength, TEXT("%s"), t_s); |
| 909 | free(t_s); | |
| 909 | free(t_s); | |
| 910 | 910 | t_buffer = pszBuffer; |
| 911 | ||
| 911 | ||
| 912 | 912 | return t_buffer; |
| 913 | 913 | } |
| 914 | 914 | |
| r1461 | r1462 | |
| 939 | 939 | switch(nType) |
| 940 | 940 | { |
| 941 | 941 | case IO_UNKNOWN: |
| 942 | // Unknowns | |
| 942 | // Unknowns | |
| 943 | 943 | nIcon = FindIconIndex(IDI_WIN_UNKNOWN); |
| 944 | 944 | break; |
| 945 | 945 | |
| r1461 | r1462 | |
| 1065 | 1065 | INT_PTR result = 0; |
| 1066 | 1066 | int nColumnCount = Picker_GetColumnCount(MyColumnDialogProc_hwndPicker); |
| 1067 | 1067 | const LPCTSTR *ppszColumnNames = Picker_GetColumnNames(MyColumnDialogProc_hwndPicker); |
| 1068 | ||
| 1068 | ||
| 1069 | 1069 | result = InternalColumnDialogProc(hDlg, Msg, wParam, lParam, nColumnCount, |
| 1070 | 1070 | MyColumnDialogProc_shown, MyColumnDialogProc_order, ppszColumnNames, |
| 1071 | 1071 | MyGetRealColumnOrder, MyGetColumnInfo, MySetColumnInfo); |
| 1072 | ||
| 1072 | ||
| 1073 | 1073 | return result; |
| 1074 | 1074 | } |
| 1075 | 1075 | |
| r1461 | r1462 | |
| 1162 | 1162 | |
| 1163 | 1163 | |
| 1164 | 1164 | // ------------------------------------------------------------------------ |
| 1165 | // Software Tab View | |
| 1165 | // Software Tab View | |
| 1166 | 1166 | // ------------------------------------------------------------------------ |
| 1167 | 1167 | |
| 1168 | 1168 | static LPCSTR s_tabs[] = |
| r1461 | r1462 | |
|---|---|---|
| 1 | 1 | // ------------------------------------------------------------------------ |
| 2 | // Software Device View class | |
| 2 | // Software Device View class | |
| 3 | 3 | // ------------------------------------------------------------------------ |
| 4 | 4 | |
| 5 | 5 | #define WIN32_LEAN_AND_MEAN |
| r1461 | r1462 | |
| 145 | 145 | static void DevView_TextChanged(HWND hwndDevView, int nChangedEntry, LPCTSTR pszFilename) |
| 146 | 146 | { |
| 147 | 147 | struct DevViewInfo *pDevViewInfo; |
| 148 | ||
| 148 | ||
| 149 | 149 | pDevViewInfo = GetDevViewInfo(hwndDevView); |
| 150 | 150 | if (!pDevViewInfo->bSurpressFilenameChanged && pDevViewInfo->pCallbacks->pfnSetSelectedSoftware) |
| 151 | 151 | { |
| r1461 | r1462 | |
| 427 | 427 | l = GetWindowLongPtr(hwndButton, GWLP_USERDATA); |
| 428 | 428 | pEnt = (struct DevViewEntry *) l; |
| 429 | 429 | DevView_ButtonClick(hwndDevView, pEnt, hwndButton); |
| 430 | break; | |
| 430 | break; | |
| 431 | 431 | } |
| 432 | 432 | break; |
| 433 | 433 | } |
| r1461 | r1462 | |
|---|---|---|
| 204 | 204 | } |
| 205 | 205 | pPickerInfo->nHashesRealized = 0; |
| 206 | 206 | } |
| 207 | ||
| 208 | 207 | |
| 208 | ||
| 209 | 209 | pPickerInfo->pDriver = pDriver; |
| 210 | ||
| 210 | ||
| 211 | 211 | if (pDriver) |
| 212 | 212 | { |
| 213 | 213 | while(pDriver && !pPickerInfo->pHashFile) |
| r1461 | r1462 | |
| 444 | 444 | |
| 445 | 445 | // copy the filename |
| 446 | 446 | strcpy(pInfo->szFilename, pszFilename); |
| 447 | ||
| 447 | ||
| 448 | 448 | // set up device and CRC, if specified |
| 449 | 449 | pInfo->devclass = devclass; |
| 450 | 450 | if (devclass.gamedrv && device_get_info_fct(&devclass, DEVINFO_PTR_PARTIAL_HASH)) |
| r1461 | r1462 | |
| 506 | 506 | s = (LPSTR) alloca(nLength); |
| 507 | 507 | snprintf(s, nLength, "%s\\%s", pszZipPath, pZipEnt->filename); |
| 508 | 508 | |
| 509 | return SoftwarePicker_AddFileEntry(hwndPicker, s, | |
| 509 | return SoftwarePicker_AddFileEntry(hwndPicker, s, | |
| 510 | 510 | nZipEntryNameLength, pZipEnt->crc, bForce); |
| 511 | 511 | } |
| 512 | 512 | |
| r1461 | r1462 | |
| 643 | 643 | char* utf8_FileName; |
| 644 | 644 | |
| 645 | 645 | pPickerInfo = GetSoftwarePickerInfo(hwndPicker); |
| 646 | ||
| 646 | ||
| 647 | 647 | utf8_FileName = utf8_from_tstring(pSearchInfo->fd.cFileName); |
| 648 | 648 | if( !utf8_FileName ) |
| 649 | 649 | return FALSE; |
| r1461 | r1462 | |
| 662 | 662 | rc = SoftwarePicker_AddDirectory(hwndPicker, pszFilename); |
| 663 | 663 | else |
| 664 | 664 | rc = SoftwarePicker_InternalAddFile(hwndPicker, pszFilename, FALSE); |
| 665 | ||
| 665 | ||
| 666 | 666 | free(utf8_FileName); |
| 667 | 667 | return rc; |
| 668 | 668 | } |
| r1461 | r1462 | |
| 768 | 768 | unsigned int nHashFunction = 0; |
| 769 | 769 | char szBuffer[256]; |
| 770 | 770 | TCHAR* t_buf; |
| 771 | ||
| 771 | ||
| 772 | 772 | pPickerInfo = GetSoftwarePickerInfo(hwndPicker); |
| 773 | 773 | if ((nRow < 0) || (nRow >= pPickerInfo->nIndexLength)) |
| 774 | 774 | return NULL; |
| r1461 | r1462 | |
| 781 | 781 | t_buf = tstring_from_utf8(pFileInfo->pszSubName); |
| 782 | 782 | if( !t_buf ) |
| 783 | 783 | return s; |
| 784 | _sntprintf(pszBuffer, nBufferLength, TEXT("%s"), t_buf); | |
| 784 | _sntprintf(pszBuffer, nBufferLength, TEXT("%s"), t_buf); | |
| 785 | 785 | s = pszBuffer; |
| 786 | 786 | free(t_buf); |
| 787 | 787 | break; |
| r1461 | r1462 | |
| 812 | 812 | t_buf = tstring_from_utf8(pszUtf8); |
| 813 | 813 | if( !t_buf ) |
| 814 | 814 | return s; |
| 815 | _sntprintf(pszBuffer, nBufferLength, TEXT("%s"), t_buf); | |
| 815 | _sntprintf(pszBuffer, nBufferLength, TEXT("%s"), t_buf); | |
| 816 | 816 | s = pszBuffer; |
| 817 | 817 | free(t_buf); |
| 818 | 818 | } |
| r1461 | r1462 | |
| 832 | 832 | { |
| 833 | 833 | t_buf = tstring_from_utf8(szBuffer); |
| 834 | 834 | if( !t_buf ) |
| 835 | return s; | |
| 835 | return s; | |
| 836 | 836 | _sntprintf(pszBuffer, nBufferLength, TEXT("%s"), t_buf); |
| 837 | 837 | s = pszBuffer; |
| 838 | 838 | free(t_buf); |
| r1461 | r1462 | |
| 849 | 849 | { |
| 850 | 850 | struct SoftwarePickerInfo *pPickerInfo; |
| 851 | 851 | LRESULT rc; |
| 852 | ||
| 852 | ||
| 853 | 853 | pPickerInfo = GetSoftwarePickerInfo(hwndPicker); |
| 854 | 854 | rc = CallWindowProc(pPickerInfo->pfnOldWndProc, hwndPicker, nMessage, wParam, lParam); |
| 855 | 855 | |
| r1461 | r1462 | |
| 880 | 880 | |
| 881 | 881 | if (!SetProp(hwndPicker, s_szSoftwarePickerProp, (HANDLE) pPickerInfo)) |
| 882 | 882 | goto error; |
| 883 | ||
| 883 | ||
| 884 | 884 | l = (LONG_PTR) SoftwarePicker_WndProc; |
| 885 | 885 | l = SetWindowLongPtr(hwndPicker, GWLP_WNDPROC, l); |
| 886 | 886 | pPickerInfo->pfnOldWndProc = (WNDPROC) l; |
| r1461 | r1462 | |
|---|---|---|
| 426 | 426 | // add this option to the combo box |
| 427 | 427 | (void)ComboBox_InsertString(control, i, win_tstring_strdup(t_ramstring)); |
| 428 | 428 | (void)ComboBox_SetItemData(control, i, ram); |
| 429 | ||
| 429 | ||
| 430 | 430 | free(t_ramstring); |
| 431 | 431 | |
| 432 | 432 | // is this the current option? record the index if so |
| r1461 | r1462 | |
|---|---|---|
| 166 | 166 | customizations->y = y1; |
| 167 | 167 | customizations->width = x2 - x1; |
| 168 | 168 | customizations->height = y2 - y1; |
| 169 | customizations++; | |
| 169 | customizations++; | |
| 170 | 170 | customizations_length--; |
| 171 | 171 | item_count++; |
| 172 | 172 | } |
| r1461 | r1462 | |
|---|---|---|
| 49 | 49 | |
| 50 | 50 | buffer_len - length of buffer |
| 51 | 51 | |
| 52 | basename - basename of file to create | |
| 52 | basename - basename of file to create | |
| 53 | 53 | |
| 54 | 54 | Return value: |
| 55 | 55 |
| r1461 | r1462 | |
|---|---|---|
| 299 | 299 | { |
| 300 | 300 | UINT8 value = ws_portram[offset]; |
| 301 | 301 | |
| 302 | if ( offset != 2 ) | |
| 302 | if ( offset != 2 ) | |
| 303 | 303 | logerror( "PC=%X: port read %02X\n", activecpu_get_pc(), offset ); |
| 304 | 304 | switch( offset ) |
| 305 | 305 | { |
| r1461 | r1462 | |
| 572 | 572 | Bit 4-7 - Palette 0 index 3 */ |
| 573 | 573 | case 0x22: /* Bit 0-3 - Palette 1 index 0 |
| 574 | 574 | Bit 4-7 - Palette 1 index 1 */ |
| 575 | case 0x23: /* Bit 0-3 - Palette 1 index 2 | |
| 575 | case 0x23: /* Bit 0-3 - Palette 1 index 2 | |
| 576 | 576 | Bit 4-7 - Palette 1 index 3 */ |
| 577 | 577 | case 0x24: /* Bit 0-3 - Palette 2 index 0 |
| 578 | 578 | Bit 4-7 - Palette 2 index 1 */ |
| r1461 | r1462 | |
| 1405 | 1405 | } |
| 1406 | 1406 | } |
| 1407 | 1407 | |
| 1408 | // vdp.current_line = (vdp.current_line + 1) % 159; | |
| 1408 | // vdp.current_line = (vdp.current_line + 1) % 159; | |
| 1409 | 1409 | |
| 1410 | 1410 | if ( vdp.current_line == vdp.line_compare ) { |
| 1411 | 1411 | wswan_set_irq_line( WSWAN_IFLAG_LCMP ); |
| r1461 | r1462 | |
|---|---|---|
| 31 | 31 | image_fseek(image, 26, SEEK_SET); |
| 32 | 32 | snapshot_size -= 26; |
| 33 | 33 | } |
| 34 | else if (!mame_stricmp(file_type, "t64")) | |
| 34 | else if (!mame_stricmp(file_type, "t64")) | |
| 35 | 35 | { |
| 36 | 36 | /* t64 files - for GB64 Single T64s loading to x0801 - header is always the same size */ |
| 37 | 37 | if (image_fread(image, buffer, sizeof(buffer)) != sizeof(buffer)) |
| r1461 | r1462 | |
| 48 | 48 | |
| 49 | 49 | image_fread(image, &address, 2); |
| 50 | 50 | address = LITTLE_ENDIANIZE_INT16(address); |
| 51 | if (!mame_stricmp(file_type, "t64")) | |
| 51 | if (!mame_stricmp(file_type, "t64")) | |
| 52 | 52 | address = 2049; |
| 53 | 53 | snapshot_size -= 2; |
| 54 | 54 |
| r1461 | r1462 | |
|---|---|---|
| 3 | 3 | machine\dgn_beta.c (machine.c) |
| 4 | 4 | |
| 5 | 5 | Moved out of dragon.c, 2005-05-05, P.Harvey-Smith. |
| 6 | ||
| 7 | I decided to move this out of the main Dragon/CoCo source files, as | |
| 8 | the Beta is so radically different from the other Dragon machines that | |
| 6 | ||
| 7 | I decided to move this out of the main Dragon/CoCo source files, as | |
| 8 | the Beta is so radically different from the other Dragon machines that | |
| 9 | 9 | this made more sense (to me at least). |
| 10 | 10 | |
| 11 | 11 | Functions to emulate general aspects of the machine (RAM, ROM, interrupts, |
| r1461 | r1462 | |
| 13 | 13 | |
| 14 | 14 | References: |
| 15 | 15 | Disassembly of Dragon Beta ROM, examination of only (known) surviving board. |
| 16 | ||
| 16 | ||
| 17 | 17 | TODO: |
| 18 | 18 | Pretty much everything ! |
| 19 | ||
| 19 | ||
| 20 | 20 | Display working with 6845 taking data from rom. |
| 21 | ||
| 21 | ||
| 22 | 22 | 2005-05-10 |
| 23 | 23 | Memory banking seems to be working, as documented in code comments below. |
| 24 | 24 | |
| r1461 | r1462 | |
| 26 | 26 | CPU#2 now executes code correctly to do transfers from WD2797. |
| 27 | 27 | |
| 28 | 28 | 2005-06-03 |
| 29 | ||
| 29 | ||
| 30 | 30 | When fed a standard OS-9 boot disk it reads in the boot file and attempts |
| 31 | 31 | to start it, not being able to find init, it fails. Hopefully I will |
| 32 | 32 | soon have an image of a Beta boot disk. |
| 33 | ||
| 33 | ||
| 34 | 34 | 2005-11-29 |
| 35 | ||
| 36 | Major track tracing excersise on scans of bare beta board, reveal where a | |
| 35 | ||
| 36 | Major track tracing excersise on scans of bare beta board, reveal where a | |
| 37 | 37 | whole bunch of the PIA lines go, especially the IRQs, most of them go back |
| 38 | 38 | to the IRQ line on the main CPU. |
| 39 | 39 | |
| 40 | 40 | 2005-12-07 |
| 41 | ||
| 41 | ||
| 42 | 42 | First booted to OS9 prompt, did not execute startup scripts. |
| 43 | 43 | |
| 44 | 44 | 2005-12-08 |
| 45 | ||
| 45 | ||
| 46 | 46 | Fixed density setting on WD2797, so density of read data is now |
| 47 | correctlty set as required by OS-9. This was the reason startup | |
| 48 | script was not being executed as Beta disks have a single denisty | |
| 47 | correctlty set as required by OS-9. This was the reason startup | |
| 48 | script was not being executed as Beta disks have a single denisty | |
| 49 | 49 | boot track, however the rest of the disk is double density. |
| 50 | 50 | Booted completely to OS-9, including running startup script. |
| 51 | ||
| 51 | ||
| 52 | 52 | 2006-09-27 |
| 53 | ||
| 53 | ||
| 54 | 54 | Clean up of IRQ/FIRQ handling code allows correct booting again. |
| 55 | ||
| 55 | ||
| 56 | 56 | ***************************************************************************/ |
| 57 | 57 | |
| 58 | 58 | #include <math.h> |
| r1461 | r1462 | |
| 197 | 197 | { dgnbeta_ram_bG_w, 0xFF00, 0xFfff } |
| 198 | 198 | }; |
| 199 | 199 | |
| 200 | struct PageReg | |
| 200 | struct PageReg | |
| 201 | 201 | { |
| 202 | 202 | int value; /* Value of the page register */ |
| 203 | 203 | UINT8 *memory; /* The memory it actually points to */ |
| r1461 | r1462 | |
| 219 | 219 | |
| 220 | 220 | // |
| 221 | 221 | // Memory pager, maps machine's 1Mb total address space into the 64K addressable by the 6809. |
| 222 | // This is in some way similar to the system used on the CoCo 3, except the beta uses 4K | |
| 222 | // This is in some way similar to the system used on the CoCo 3, except the beta uses 4K | |
| 223 | 223 | // pages (instead of 8K on the CoCo), and has 16 task registers instead of the 2 on the CoCo. |
| 224 | 224 | // |
| 225 | // Each block of 16 page registers (1 for each task), is paged in at $FE00-$FE0F, the bottom | |
| 225 | // Each block of 16 page registers (1 for each task), is paged in at $FE00-$FE0F, the bottom | |
| 226 | 226 | // 4 bits of the PIA register at $FCC0 seem to contain which task is active. |
| 227 | 227 | // bit 6 of the same port seems to enable the memory paging |
| 228 | 228 | // |
| 229 | 229 | // For the purpose of this driver any block that is not ram, and is not a known ROM block, |
| 230 | 230 | // is mapped to the first page of the boot rom, I do not know what happens in the real |
| 231 | // hardware, however this does allow the boot rom to correctly size the RAM. | |
| 231 | // hardware, however this does allow the boot rom to correctly size the RAM. | |
| 232 | 232 | // this should probably be considdered a hack ! |
| 233 | 233 | // |
| 234 | 234 | |
| r1461 | r1462 | |
| 247 | 247 | { |
| 248 | 248 | bank_start = bank_info[Page].start; |
| 249 | 249 | bank_end = bank_info[Page].end; |
| 250 | ||
| 250 | ||
| 251 | 251 | if (!IsIOPage(Page)) |
| 252 | 252 | MapPage = PageRegs[TaskReg][Page].value; |
| 253 | 253 | else |
| r1461 | r1462 | |
| 258 | 258 | // |
| 259 | 259 | if ((MapPage*4) < ((mess_ram_size / 1024)-1)) // Block is ram |
| 260 | 260 | { |
| 261 | if (!IsIOPage(Page)) | |
| 261 | if (!IsIOPage(Page)) | |
| 262 | 262 | { |
| 263 | 263 | readbank = &mess_ram[MapPage*RamPageSize]; |
| 264 | 264 | #ifdef MAME_DEBUG |
| r1461 | r1462 | |
| 278 | 278 | if (MapPage>0xfB) |
| 279 | 279 | { |
| 280 | 280 | if (Page!=IOPage+1) |
| 281 | readbank=&system_rom[(MapPage-0xFC)*0x1000]; | |
| 281 | readbank=&system_rom[(MapPage-0xFC)*0x1000]; | |
| 282 | 282 | else |
| 283 | 283 | readbank=&system_rom[0x3F00]; |
| 284 | 284 | } |
| 285 | 285 | else |
| 286 | 286 | readbank=system_rom; |
| 287 | ||
| 287 | ||
| 288 | 288 | writebank=MWA8_ROM; |
| 289 | 289 | } |
| 290 | 290 | |
| r1461 | r1462 | |
| 308 | 308 | { |
| 309 | 309 | int Idx; |
| 310 | 310 | |
| 311 | #ifdef LOG_DEFAULT_TASK | |
| 311 | #ifdef LOG_DEFAULT_TASK | |
| 312 | 312 | logerror("SetDefaultTask()\n"); |
| 313 | 313 | debug_console_printf("Set Default task\n"); |
| 314 | 314 | #endif |
| 315 | 315 | |
| 316 | 316 | TaskReg=NoPagingTask; |
| 317 | ||
| 317 | ||
| 318 | 318 | /* Reset ram pages */ |
| 319 | 319 | for(Idx=0;Idx<ROMPage-1;Idx++) |
| 320 | 320 | { |
| 321 | 321 | PageRegs[TaskReg][Idx].value=NoMemPageValue; |
| 322 | } | |
| 322 | } | |
| 323 | 323 | |
| 324 | 324 | /* Reset RAM Page */ |
| 325 | 325 | PageRegs[TaskReg][RAMPage].value=RAMPageValue; |
| 326 | ||
| 326 | ||
| 327 | 327 | /* Reset Video mem page */ |
| 328 | 328 | PageRegs[TaskReg][VideoPage].value=VideoPageValue; |
| 329 | 329 | |
| 330 | 330 | /* Reset rom page */ |
| 331 | 331 | PageRegs[TaskReg][ROMPage].value=ROMPageValue; |
| 332 | ||
| 332 | ||
| 333 | 333 | /* Reset IO Page */ |
| 334 | 334 | PageRegs[TaskReg][IOPage].value=IOPageValue; |
| 335 | 335 | PageRegs[TaskReg][IOPage+1].value=IOPageValue; |
| r1461 | r1462 | |
| 352 | 352 | // setup the mappings. |
| 353 | 353 | |
| 354 | 354 | WRITE8_HANDLER( dgn_beta_page_w ) |
| 355 | { | |
| 355 | { | |
| 356 | 356 | PageRegs[PIATaskReg][offset].value=data; |
| 357 | 357 | |
| 358 | 358 | #ifdef LOG_PAGE_WRITE |
| 359 | 359 | logerror("PageRegWrite : task=$%X offset=$%X value=$%X\n",PIATaskReg,offset,data); |
| 360 | 360 | #endif |
| 361 | 361 | |
| 362 | if (EnableMapRegs) | |
| 363 | { | |
| 362 | if (EnableMapRegs) | |
| 363 | { | |
| 364 | 364 | UpdateBanks(offset,offset); |
| 365 | 365 | if (offset==15) |
| 366 | 366 | UpdateBanks(offset+1,offset+1); |
| r1461 | r1462 | |
| 459 | 459 | dgn_beta_bank_memory(offset,data,16); |
| 460 | 460 | } |
| 461 | 461 | |
| 462 | /* | |
| 463 | The keyrow being scanned for any key is the lest significant bit | |
| 464 | of the output shift register that is zero, most of the time there should | |
| 462 | /* | |
| 463 | The keyrow being scanned for any key is the lest significant bit | |
| 464 | of the output shift register that is zero, most of the time there should | |
| 465 | 465 | only be one row active e.g. |
| 466 | 466 | |
| 467 | 467 | Shifter Row being scanned |
| r1461 | r1462 | |
| 473 | 473 | |
| 474 | 474 | Returns row number or -1 if none selected. |
| 475 | 475 | |
| 476 | 2006-12-03, P.Harvey-Smith, modified to scan from msb to lsb, and stop at | |
| 477 | first row with zero, as the beta_test fills the shifter with zeros, rather | |
| 476 | 2006-12-03, P.Harvey-Smith, modified to scan from msb to lsb, and stop at | |
| 477 | first row with zero, as the beta_test fills the shifter with zeros, rather | |
| 478 | 478 | than using a walking zero as the OS-9 driver does. This meant that SelectKeyrow |
| 479 | 479 | never moved past the first row, by scanning for the last active row |
| 480 | 480 | the beta_test rom works, and it does not break the OS-9 driver :) |
| r1461 | r1462 | |
| 485 | 485 | int Row; /* Row selected */ |
| 486 | 486 | int Mask; /* Mask to test row */ |
| 487 | 487 | int Found; /* Set true when found */ |
| 488 | ||
| 488 | ||
| 489 | 489 | Row=INVALID_KEYROW; /* Pretend no rows selected */ |
| 490 | 490 | Mask=0x200; /* Start with row 9 */ |
| 491 | 491 | Found=0; /* Start with not found */ |
| 492 | 492 | Idx=9; |
| 493 | ||
| 493 | ||
| 494 | 494 | while ((Mask>0) && !Found) |
| 495 | 495 | { |
| 496 | 496 | if((~Rows & Mask) && !Found) |
| r1461 | r1462 | |
| 501 | 501 | Idx=Idx-1; /* Decrement row count */ |
| 502 | 502 | Mask=Mask>>1; /* Select next bit */ |
| 503 | 503 | } |
| 504 | ||
| 504 | ||
| 505 | 505 | return Row; |
| 506 | 506 | } |
| 507 | 507 | |
| r1461 | r1462 | |
| 549 | 549 | int RetVal; |
| 550 | 550 | int Idx; |
| 551 | 551 | int Selected; |
| 552 | ||
| 552 | ||
| 553 | 553 | #ifdef LOG_KEYBOARD |
| 554 | 554 | logerror("PB Read\n"); |
| 555 | 555 | #endif |
| 556 | 556 | |
| 557 | 557 | KAny_next=0; |
| 558 | ||
| 558 | ||
| 559 | 559 | Selected=SelectedKeyrow(RowShifter); |
| 560 | ||
| 560 | ||
| 561 | 561 | /* Scan the whole keyboard, if output shifter is all low */ |
| 562 | 562 | /* This actually scans in the keyboard */ |
| 563 | 563 | if(RowShifter==0x00) |
| r1461 | r1462 | |
| 577 | 577 | case 8 : Keyboard[Idx]=input_port_8_r(0); break; |
| 578 | 578 | case 9 : Keyboard[Idx]=input_port_9_r(0); break; |
| 579 | 579 | } |
| 580 | ||
| 580 | ||
| 581 | 581 | if(Keyboard[Idx]!=0x7F) |
| 582 | 582 | { |
| 583 | 583 | KAny_next=1; |
| r1461 | r1462 | |
| 591 | 591 | KAny_next=1; |
| 592 | 592 | } |
| 593 | 593 | } |
| 594 | ||
| 594 | ||
| 595 | 595 | RetVal = (KInDat_next<<5) | (KAny_next<<2); |
| 596 | ||
| 596 | ||
| 597 | 597 | #ifdef LOG_KEYBOARD |
| 598 | 598 | logerror("FC22=$%02X KAny=%d\n",RetVal,KAny_next); |
| 599 | 599 | #endif |
| 600 | ||
| 600 | ||
| 601 | 601 | return RetVal; |
| 602 | 602 | } |
| 603 | 603 | |
| r1461 | r1462 | |
| 605 | 605 | { |
| 606 | 606 | int InClkState; |
| 607 | 607 | int OutClkState; |
| 608 | ||
| 608 | ||
| 609 | 609 | #ifdef LOG_KEYBOARD |
| 610 | 610 | logerror("PB Write\n"); |
| 611 | 611 | #endif |
| 612 | ||
| 612 | ||
| 613 | 613 | InClkState = data & KInClk; |
| 614 | 614 | OutClkState = data & KOutClk; |
| 615 | ||
| 615 | ||
| 616 | 616 | #ifdef LOG_KEYBOARD |
| 617 | 617 | logerror("InClkState=$%02X OldInClkState=$%02X Keyrow=$%02X ",InClkState,(d_pia0_pb_last & KInClk),Keyrow); |
| 618 | 618 | #endif |
| r1461 | r1462 | |
| 630 | 630 | #endif |
| 631 | 631 | } |
| 632 | 632 | } |
| 633 | ||
| 633 | ||
| 634 | 634 | d_pia0_pb_last=data; |
| 635 | 635 | } |
| 636 | 636 | |
| r1461 | r1462 | |
| 642 | 642 | #endif |
| 643 | 643 | /* load keyrow on rising edge of CB2 */ |
| 644 | 644 | if((data==1) && (d_pia0_cb2_last==0)) |
| 645 | { | |
| 645 | { | |
| 646 | 646 | RowNo=SelectedKeyrow(RowShifter); |
| 647 | 647 | Keyrow=GetKeyRow(RowNo); |
| 648 | 648 | |
| r1461 | r1462 | |
| 655 | 655 | debug_console_printf("rowshifter clocked, value=%3X, RowNo=%d, Keyrow=%2X\n",RowShifter,RowNo,Keyrow); |
| 656 | 656 | #endif |
| 657 | 657 | } |
| 658 | ||
| 658 | ||
| 659 | 659 | d_pia0_cb2_last=data; |
| 660 | 660 | } |
| 661 | 661 | |
| r1461 | r1462 | |
| 670 | 670 | cpu0_recalc_firq(state); |
| 671 | 671 | } |
| 672 | 672 | |
| 673 | /* PIA #1 at $FC24-$FC27 I63 | |
| 673 | /* PIA #1 at $FC24-$FC27 I63 | |
| 674 | 674 | This handles :- |
| 675 | 675 | Mouse + Disk Select on side A |
| 676 | 676 | Halt on DMA CPU PA7 |
| r1461 | r1462 | |
| 706 | 706 | /* CPU un-halted let it run ! */ |
| 707 | 707 | if (HALT_DMA==CLEAR_LINE) |
| 708 | 708 | cpu_yield(); |
| 709 | ||
| 709 | ||
| 710 | 710 | d_pia1_pa_last=data & 0x80; |
| 711 | 711 | } |
| 712 | ||
| 712 | ||
| 713 | 713 | /* Drive selects are binary encoded on PA0 & PA1 */ |
| 714 | 714 | wd17xx_set_drive(~data & DSMask); |
| 715 | ||
| 715 | ||
| 716 | 716 | /* Set density of WD2797 */ |
| 717 | if (data & DDenCtrl) | |
| 717 | if (data & DDenCtrl) | |
| 718 | 718 | { |
| 719 | 719 | wd17xx_set_density(DEN_FM_LO); |
| 720 | 720 | #ifdef MAME_DEBUG |
| r1461 | r1462 | |
| 759 | 759 | /* CPU un-halted let it run ! */ |
| 760 | 760 | if (HALT_CPU==CLEAR_LINE) |
| 761 | 761 | cpu_yield(); |
| 762 | } | |
| 762 | } | |
| 763 | 763 | } |
| 764 | 764 | |
| 765 | 765 | static void d_pia1_irq_a(int state) |
| r1461 | r1462 | |
| 772 | 772 | cpu0_recalc_irq(state); |
| 773 | 773 | } |
| 774 | 774 | |
| 775 | /* PIA #2 at FCC0-FCC3 I28 | |
| 775 | /* PIA #2 at FCC0-FCC3 I28 | |
| 776 | 776 | This handles :- |
| 777 | 777 | DAT task select PA0..PA3 |
| 778 | ||
| 778 | ||
| 779 | 779 | DMA CPU NMI PA7 |
| 780 | ||
| 780 | ||
| 781 | 781 | Graphics control PB0..PB7 ??? |
| 782 | 782 | VSYNC intutrupt CB2 |
| 783 | 783 | */ |
| r1461 | r1462 | |
| 798 | 798 | |
| 799 | 799 | /* Bit 7 of $FFC0, seems to control NMI on second CPU */ |
| 800 | 800 | NMI=(data & 0x80); |
| 801 | ||
| 801 | ||
| 802 | 802 | /* only take action if NMI changed */ |
| 803 | if(NMI!=DMA_NMI_LAST) | |
| 803 | if(NMI!=DMA_NMI_LAST) | |
| 804 | 804 | { |
| 805 | 805 | #ifdef LOG_INTS |
| 806 | 806 | logerror("cpu1 NMI : %d\n",NMI); |
| r1461 | r1462 | |
| 826 | 826 | EnableMapRegs=0; |
| 827 | 827 | else |
| 828 | 828 | EnableMapRegs=1; |
| 829 | ||
| 829 | ||
| 830 | 830 | /* Bits 0..3 seem to control which task register is selected */ |
| 831 | 831 | OldTask=PIATaskReg; |
| 832 | 832 | PIATaskReg=data & 0x0F; |
| r1461 | r1462 | |
| 852 | 852 | else |
| 853 | 853 | { |
| 854 | 854 | // Update ram banks only if task reg changed and mapping enabled |
| 855 | if ((PIATaskReg!=OldTask) && (EnableMapRegs)) | |
| 855 | if ((PIATaskReg!=OldTask) && (EnableMapRegs)) | |
| 856 | 856 | { |
| 857 | 857 | TaskReg=PIATaskReg; |
| 858 | 858 | UpdateBanks(0,IOPage+1); |
| 859 | 859 | } |
| 860 | 860 | } |
| 861 | #ifdef LOG_TASK | |
| 861 | #ifdef LOG_TASK | |
| 862 | 862 | logerror("TaskReg=$%02X PIATaskReg=$%02X\n",TaskReg,PIATaskReg); |
| 863 | 863 | #endif |
| 864 | 864 | } |
| r1461 | r1462 | |
| 896 | 896 | UINT8 pia2_irq_a = pia_get_irq_a(2); |
| 897 | 897 | UINT8 pia2_irq_b = pia_get_irq_b(2); |
| 898 | 898 | UINT8 IRQ; |
| 899 | ||
| 899 | ||
| 900 | 900 | if (pia0_irq_a || pia1_irq_a || pia1_irq_b || pia2_irq_a || pia2_irq_b) |
| 901 | 901 | IRQ = ASSERT_LINE; |
| 902 | 902 | else |
| r1461 | r1462 | |
| 912 | 912 | { |
| 913 | 913 | UINT8 pia0_irq_b = pia_get_irq_b(0); |
| 914 | 914 | UINT8 FIRQ; |
| 915 | ||
| 915 | ||
| 916 | 916 | if (pia0_irq_b) |
| 917 | 917 | FIRQ = ASSERT_LINE; |
| 918 | 918 | else |
| 919 | 919 | FIRQ = CLEAR_LINE; |
| 920 | ||
| 920 | ||
| 921 | 921 | cpunum_set_input_line(0, M6809_FIRQ_LINE, FIRQ); |
| 922 | ||
| 922 | ||
| 923 | 923 | #ifdef LOG_INTS |
| 924 | 924 | logerror("cpu0 FIRQ : %d\n",FIRQ); |
| 925 | 925 | #endif |
| r1461 | r1462 | |
| 943 | 943 | { |
| 944 | 944 | /* The INTRQ line goes through pia2 ca1, in exactly the same way as DRQ from DragonDos does */ |
| 945 | 945 | /* DRQ is routed through various logic to the FIRQ inturrupt line on *BOTH* CPUs */ |
| 946 | ||
| 947 | switch(event) | |
| 946 | ||
| 947 | switch(event) | |
| 948 | 948 | { |
| 949 | 949 | case WD17XX_IRQ_CLR: |
| 950 | 950 | pia_2_ca1_w(0,CLEAR_LINE); |
| r1461 | r1462 | |
| 959 | 959 | case WD17XX_DRQ_SET: |
| 960 | 960 | /*wd2797_drq=ASSERT_LINE;*/ |
| 961 | 961 | cpu1_recalc_firq(ASSERT_LINE); |
| 962 | break; | |
| 962 | break; | |
| 963 | 963 | } |
| 964 | 964 | |
| 965 | 965 | #ifdef MAME_DEBUG |
| r1461 | r1462 | |
| 972 | 972 | { |
| 973 | 973 | int result = 0; |
| 974 | 974 | |
| 975 | switch(offset & 0x03) | |
| 975 | switch(offset & 0x03) | |
| 976 | 976 | { |
| 977 | 977 | case 0: |
| 978 | 978 | result = wd17xx_status_r(0); |
| r1461 | r1462 | |
| 993 | 993 | default: |
| 994 | 994 | break; |
| 995 | 995 | } |
| 996 | ||
| 996 | ||
| 997 | 997 | return result; |
| 998 | 998 | } |
| 999 | 999 | |
| 1000 | 1000 | WRITE8_HANDLER(dgnbeta_wd2797_w) |
| 1001 | 1001 | { |
| 1002 | switch(offset & 0x3) | |
| 1002 | switch(offset & 0x3) | |
| 1003 | 1003 | { |
| 1004 | 1004 | case 0: |
| 1005 | 1005 | /* disk head is encoded in the command byte */ |
| r1461 | r1462 | |
| 1065 | 1065 | void dgn_beta_frame_interrupt (int data) |
| 1066 | 1066 | { |
| 1067 | 1067 | /* Set PIA line, so it recognises inturrupt */ |
| 1068 | if (!data) | |
| 1068 | if (!data) | |
| 1069 | 1069 | { |
| 1070 | 1070 | pia_2_cb2_w(0,ASSERT_LINE); |
| 1071 | 1071 | } |
| r1461 | r1462 | |
| 1077 | 1077 | logerror("Vblank\n"); |
| 1078 | 1078 | #endif |
| 1079 | 1079 | ScanInKeyboard(); |
| 1080 | } | |
| 1080 | } | |
| 1081 | 1081 | |
| 1082 | 1082 | void dgn_beta_line_interrupt (int data) |
| 1083 | 1083 | { |
| 1084 | 1084 | // /* Set PIA line, so it recognises inturrupt */ |
| 1085 | // if (data) | |
| 1085 | // if (data) | |
| 1086 | 1086 | // { |
| 1087 | 1087 | // pia_0_cb1_w(0,ASSERT_LINE); |
| 1088 | 1088 | // } |
| r1461 | r1462 | |
| 1101 | 1101 | |
| 1102 | 1102 | /* Make sure CPU 1 is started out halted ! */ |
| 1103 | 1103 | cpunum_set_input_line(1, INPUT_LINE_HALT, ASSERT_LINE); |
| 1104 | ||
| 1104 | ||
| 1105 | 1105 | /* Reset to task 0, and map banks disabled, so standard memory map */ |
| 1106 | 1106 | /* with ram at $0000-$BFFF, ROM at $C000-FBFF, IO at $FC00-$FEFF */ |
| 1107 | 1107 | /* and ROM at $FF00-$FFFF */ |
| r1461 | r1462 | |
| 1127 | 1127 | |
| 1128 | 1128 | KInDat_next=0x00; /* Next data bit to input */ |
| 1129 | 1129 | KAny_next=0x00; /* Next value for KAny */ |
| 1130 | ||
| 1130 | ||
| 1131 | 1131 | DMA_NMI_LAST=0x80; /* start with DMA NMI inactive, as pulled up */ |
| 1132 | 1132 | // DMA_NMI=CLEAR_LINE; /* start with DMA NMI inactive */ |
| 1133 | ||
| 1133 | ||
| 1134 | 1134 | wd17xx_reset(); |
| 1135 | 1135 | wd17xx_set_density(DEN_MFM_LO); |
| 1136 | 1136 | wd17xx_set_drive(0); |
| r1461 | r1462 | |
| 1143 | 1143 | { |
| 1144 | 1144 | pia_config(0, &dgnbeta_pia_intf[0]); |
| 1145 | 1145 | pia_config(1, &dgnbeta_pia_intf[1]); |
| 1146 | pia_config(2, &dgnbeta_pia_intf[2]); | |
| 1146 | pia_config(2, &dgnbeta_pia_intf[2]); | |
| 1147 | 1147 | |
| 1148 | 1148 | init_video(); |
| 1149 | ||
| 1149 | ||
| 1150 | 1150 | wd17xx_init(WD_TYPE_179X,dgnbeta_fdc_callback, NULL); |
| 1151 | 1151 | #ifdef MAME_DEBUG |
| 1152 | 1152 | cpuintrf_set_dasm_override(0,dgnbeta_dasm_override); |
| r1461 | r1462 | |
| 1351 | 1351 | static void DumpKeys(int ref, int params, const char *param[]) |
| 1352 | 1352 | { |
| 1353 | 1353 | int Idx; |
| 1354 | ||
| 1354 | ||
| 1355 | 1355 | for(Idx=0;Idx<NoKeyrows;Idx++) |
| 1356 | 1356 | { |
| 1357 | 1357 | debug_console_printf("KeyRow[%d]=%2X\n",Idx,Keyboard[Idx]); |
| r1461 | r1462 | |
|---|---|---|
| 246 | 246 | 0x00,0x00,0xf8,0x10,0x20,0x40,0xf8,0x00,0x08,0x10,0x10,0x20,0x10,0x10,0x08,0x00, |
| 247 | 247 | 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x40,0x20,0x20,0x10,0x20,0x20,0x40,0x00, |
| 248 | 248 | 0x00,0x68,0xb0,0x00,0x00,0x00,0x00,0x00,0x20,0x50,0x20,0x50,0xa8,0x50,0x00,0x00, |
| 249 | ||
| 249 | ||
| 250 | 250 | /* non-spacing middle dot */ |
| 251 | 251 | 0x00, |
| 252 | 252 | 0x00, |
| r1461 | r1462 | |
| 622 | 622 | * Reader Buffer 100 010 101 001 011 111 |
| 623 | 623 | * |
| 624 | 624 | * (Vertical dashed line indicates sprocket holes and the symbols "X" indicate holes |
| 625 | * punched in tape). | |
| 625 | * punched in tape). | |
| 626 | 626 | * |
| 627 | 627 | * If bits 5 and 6 of the rpb instruction are both zero (720002), the contents of |
| 628 | 628 | * the Reader Buffer must be transferred to the IO Register by executing |
| 629 | 629 | * a rrb instruction. When the Reader Buffer has information ready to be transferred |
| 630 | 630 | * to the IO Register, Status Register Bit 1 is set to one. If bits 5 and 6 are |
| 631 | 631 | * different (730002 or 724002) the 18-bit word read from tape is automatically |
| 632 | * transferred to the IO Register via the Reader Buffer. | |
| 632 | * transferred to the IO Register via the Reader Buffer. | |
| 633 | 633 | */ |
| 634 | 634 | void iot_rpb(int op2, int nac, int mb, int *io, int ac) |
| 635 | 635 | { |
| r1461 | r1462 | |
| 687 | 687 | */ |
| 688 | 688 | /* |
| 689 | 689 | * Punch Perforated Tape, Binary |
| 690 | * ppb Addres 0006 | |
| 690 | * ppb Addres 0006 | |
| 691 | 691 | * |
| 692 | 692 | * For each In-Out Transfer instruction one line of tape is punched. In-Out Register |
| 693 | 693 | * Bit 5 conditions Hole 1. Bit 4 conditions Hole 2, etc. Bit 0 conditions Hole 6. |
| 694 | * Hole 7 is left blank. Hole 8 is always punched in this mode. | |
| 694 | * Hole 7 is left blank. Hole 8 is always punched in this mode. | |
| 695 | 695 | */ |
| 696 | 696 | void iot_ppb(int op2, int nac, int mb, int *io, int ac) |
| 697 | 697 | { |
| r1461 | r1462 | |
|---|---|---|
| 88 | 88 | unsigned int nec765_status[4]; |
| 89 | 89 | /* present cylinder number per drive */ |
| 90 | 90 | unsigned int pcn[4]; |
| 91 | ||
| 91 | ||
| 92 | 92 | /* drive being accessed. drive outputs from fdc */ |
| 93 | 93 | unsigned int drive; |
| 94 | 94 | /* side being accessed: side output from fdc */ |
| 95 | 95 | unsigned int side; |
| 96 | 96 | |
| 97 | ||
| 97 | ||
| 98 | 98 | /* step rate time in us */ |
| 99 | 99 | unsigned long srt_in_ms; |
| 100 | 100 | |
| r1461 | r1462 | |
| 207 | 207 | |
| 208 | 208 | /* if a seek is done without drive connected: */ |
| 209 | 209 | /* abnormal termination of command, |
| 210 | seek complete, | |
| 210 | seek complete, | |
| 211 | 211 | not ready |
| 212 | 212 | */ |
| 213 | 213 | |
| r1461 | r1462 | |
| 242 | 242 | |
| 243 | 243 | /* if a seek is done with drive connected, but disc missing: */ |
| 244 | 244 | /* seek complete */ |
| 245 | ||
| 245 | ||
| 246 | 246 | /* if a seek is done with drive connected and disc in drive: */ |
| 247 | 247 | /* seek complete */ |
| 248 | 248 | |
| 249 | 249 | /* On Amstrad CPC: |
| 250 | If drive not connected, or drive connected but disc not in drive, not ready! | |
| 250 | If drive not connected, or drive connected but disc not in drive, not ready! | |
| 251 | 251 | If drive connected and drive motor on, ready! |
| 252 | 252 | On PC: |
| 253 | 253 | Drive is always ready! |
| r1461 | r1462 | |
| 296 | 296 | else |
| 297 | 297 | { |
| 298 | 298 | /* abnormal termination, not ready */ |
| 299 | fdc.nec765_status[0] = 0x040 | 0x020 | 0x08; | |
| 299 | fdc.nec765_status[0] = 0x040 | 0x020 | 0x08; | |
| 300 | 300 | } |
| 301 | 301 | |
| 302 | 302 | /* set drive and side */ |
| r1461 | r1462 | |
| 325 | 325 | nec765_set_data_request(); |
| 326 | 326 | |
| 327 | 327 | fdc.timer_type = 4; |
| 328 | ||
| 328 | ||
| 329 | 329 | if (!(fdc.nec765_flags & NEC765_DMA_MODE)) |
| 330 | 330 | { |
| 331 | 331 | /* for pcw */ |
| r1461 | r1462 | |
| 346 | 346 | case 5: /* write data */ |
| 347 | 347 | case 6: /* read data */ |
| 348 | 348 | case 9: /* write deleted data */ |
| 349 | case 10: /* read id */ | |
| 350 | case 12: /* read deleted data */ | |
| 349 | case 10: /* read id */ | |
| 350 | case 12: /* read deleted data */ | |
| 351 | 351 | case 13: /* format at track */ |
| 352 | 352 | case 17: /* scan equal */ |
| 353 | 353 | case 19: /* scan low or equal */ |
| r1461 | r1462 | |
| 401 | 401 | |
| 402 | 402 | if (!(fdc.nec765_flags & NEC765_DMA_MODE)) |
| 403 | 403 | { |
| 404 | timer_adjust(fdc.timer, duration, 0, attotime_zero); | |
| 404 | timer_adjust(fdc.timer, duration, 0, attotime_zero); | |
| 405 | 405 | } |
| 406 | 406 | else |
| 407 | 407 | { |
| r1461 | r1462 | |
| 414 | 414 | static void nec765_setup_timed_data_request(int bytes) |
| 415 | 415 | { |
| 416 | 416 | /* setup timer to trigger in NEC765_DATA_RATE us */ |
| 417 | nec765_setup_timed_generic(0, ATTOTIME_IN_USEC(32-27) /*NEC765_DATA_RATE)*bytes*/); | |
| 417 | nec765_setup_timed_generic(0, ATTOTIME_IN_USEC(32-27) /*NEC765_DATA_RATE)*bytes*/); | |
| 418 | 418 | } |
| 419 | 419 | |
| 420 | 420 | /* setup result data request */ |
| r1461 | r1462 | |
| 459 | 459 | |
| 460 | 460 | /* if drive is already at track 0, or drive is not ready */ |
| 461 | 461 | if ( |
| 462 | floppy_drive_get_flag_state(img, FLOPPY_DRIVE_HEAD_AT_TRACK_0) || | |
| 462 | floppy_drive_get_flag_state(img, FLOPPY_DRIVE_HEAD_AT_TRACK_0) || | |
| 463 | 463 | (!floppy_drive_get_flag_state(img, FLOPPY_DRIVE_READY)) |
| 464 | 464 | ) |
| 465 | 465 | { |
| r1461 | r1462 | |
| 474 | 474 | /* yes - calculate real number of tracks to seek */ |
| 475 | 475 | |
| 476 | 476 | int current_track; |
| 477 | ||
| 477 | ||
| 478 | 478 | /* get current track */ |
| 479 | 479 | current_track = floppy_drive_get_current_track(img); |
| 480 | 480 | |
| r1461 | r1462 | |
| 492 | 492 | { |
| 493 | 493 | /* perform seek - if drive isn't present it will not do anything */ |
| 494 | 494 | floppy_drive_seek(img, signed_tracks); |
| 495 | ||
| 495 | ||
| 496 | 496 | nec765_setup_timed_int(signed_tracks); |
| 497 | 497 | } |
| 498 | 498 | else |
| r1461 | r1462 | |
| 627 | 627 | |
| 628 | 628 | /* Drive ready */ |
| 629 | 629 | |
| 630 | /* | |
| 630 | /* | |
| 631 | 631 | |
| 632 | 632 | A drive will report ready if: |
| 633 | 633 | - drive is selected |
| r1461 | r1462 | |
| 635 | 635 | - disk is rotating at a constant speed (normally 300rpm) |
| 636 | 636 | |
| 637 | 637 | On more modern PCs, a ready signal is not provided by the drive. |
| 638 | This signal is not used in the PC design and was eliminated to save costs | |
| 638 | This signal is not used in the PC design and was eliminated to save costs | |
| 639 | 639 | If you look at the datasheets for the modern NEC765 variants, you will see the Ready |
| 640 | 640 | signal is not mentioned. |
| 641 | 641 | |
| r1461 | r1462 | |
| 770 | 770 | } |
| 771 | 771 | } |
| 772 | 772 | /* deleted data? */ |
| 773 | else | |
| 773 | else | |
| 774 | 774 | if (fdc.command == 0x0c) |
| 775 | 775 | { |
| 776 | 776 | /* did we just find a sector with data mark ? */ |
| r1461 | r1462 | |
| 878 | 878 | { |
| 879 | 879 | index_count++; |
| 880 | 880 | } |
| 881 | ||
| 881 | ||
| 882 | 882 | } |
| 883 | 883 | while (index_count!=2); |
| 884 | 884 | |
| 885 | 885 | /* no data - specified sector ID was not found */ |
| 886 | 886 | fdc.nec765_status[1] |= NEC765_ST1_NO_DATA; |
| 887 | ||
| 887 | ||
| 888 | 888 | return 0; |
| 889 | 889 | } |
| 890 | 890 | |
| r1461 | r1462 | |
| 993 | 993 | } |
| 994 | 994 | } |
| 995 | 995 | while (found_sector_to_read==0); |
| 996 | } | |
| 997 | ||
| 996 | } | |
| 997 | ||
| 998 | 998 | { |
| 999 | 999 | int data_size; |
| 1000 | 1000 | |
| r1461 | r1462 | |
| 1064 | 1064 | |
| 1065 | 1065 | |
| 1066 | 1066 | data_size = nec765_n_to_bytes(id.N); |
| 1067 | ||
| 1067 | ||
| 1068 | 1068 | floppy_drive_read_sector_data(current_image(), fdc.side, fdc.sector_id,nec765_data_buffer,data_size); |
| 1069 | 1069 | |
| 1070 | 1070 | nec765_setup_execution_phase_read(nec765_data_buffer, data_size); |
| r1461 | r1462 | |
| 1092 | 1092 | - terminal count input is not set |
| 1093 | 1093 | - AND the the sector specified by EOT was read |
| 1094 | 1094 | */ |
| 1095 | ||
| 1095 | ||
| 1096 | 1096 | /* if end of cylinder is set, and we did receive a terminal count, then clear it */ |
| 1097 | 1097 | if ((fdc.nec765_flags & NEC765_TC)!=0) |
| 1098 | 1098 | { |
| r1461 | r1462 | |
| 1171 | 1171 | } |
| 1172 | 1172 | |
| 1173 | 1173 | |
| 1174 | ||
| 1174 | ||
| 1175 | 1175 | /* multi-track? */ |
| 1176 | 1176 | if (fdc.nec765_command_bytes[0] & 0x080) |
| 1177 | 1177 | { |
| r1461 | r1462 | |
| 1180 | 1180 | or is it ignored the first time and not the next, so that |
| 1181 | 1181 | if it is started on side 0, it will end at EOT on side 1, |
| 1182 | 1182 | but if started on side 1 it will end at end of track???? |
| 1183 | ||
| 1183 | ||
| 1184 | 1184 | PC driver requires this to end at last sector on side 1, and |
| 1185 | 1185 | ignore EOT parameter. |
| 1186 | ||
| 1186 | ||
| 1187 | 1187 | To be checked!!!! |
| 1188 | 1188 | */ |
| 1189 | 1189 | |
| r1461 | r1462 | |
| 1219 | 1219 | /* completed */ |
| 1220 | 1220 | return 1; |
| 1221 | 1221 | } |
| 1222 | ||
| 1222 | ||
| 1223 | 1223 | /* Multi-Track operation: |
| 1224 | 1224 | |
| 1225 | 1225 | Verified on Amstrad CPC. |
| r1461 | r1462 | |
| 1229 | 1229 | 2 sides |
| 1230 | 1230 | Sector IDs: &01, &02, &03, &04, &05, &06, &07, &08, &09 |
| 1231 | 1231 | |
| 1232 | Command specified: | |
| 1232 | Command specified: | |
| 1233 | 1233 | SIDE = 0, |
| 1234 | 1234 | C = 0,H = 0,R = 1, N = 2, EOT = 1 |
| 1235 | 1235 | Sectors read: |
| 1236 | 1236 | Sector 1 side 0 |
| 1237 | 1237 | Sector 1 side 1 |
| 1238 | 1238 | |
| 1239 | Command specified: | |
| 1239 | Command specified: | |
| 1240 | 1240 | SIDE = 0, |
| 1241 | 1241 | C = 0,H = 0,R = 1, N = 2, EOT = 3 |
| 1242 | 1242 | Sectors read: |
| r1461 | r1462 | |
| 1247 | 1247 | Sector 2 side 1 |
| 1248 | 1248 | Sector 3 side 1 |
| 1249 | 1249 | |
| 1250 | ||
| 1250 | ||
| 1251 | 1251 | Command specified: |
| 1252 | 1252 | SIDE = 0, |
| 1253 | 1253 | C = 0, H = 0, R = 7, N = 2, EOT = 3 |
| r1461 | r1462 | |
| 1278 | 1278 | /* multi-track? */ |
| 1279 | 1279 | if (fdc.nec765_command_bytes[0] & 0x080) |
| 1280 | 1280 | { |
| 1281 | /* if we have reached EOT (fdc.nec765_command_bytes[6]) | |
| 1281 | /* if we have reached EOT (fdc.nec765_command_bytes[6]) | |
| 1282 | 1282 | on side 1, then read is complete */ |
| 1283 | 1283 | if (fdc.side==1) |
| 1284 | 1284 | return 1; |
| r1461 | r1462 | |
| 1352 | 1352 | } |
| 1353 | 1353 | } |
| 1354 | 1354 | /* deleted data? */ |
| 1355 | else | |
| 1355 | else | |
| 1356 | 1356 | if (fdc.command == 0x0c) |
| 1357 | 1357 | { |
| 1358 | 1358 | /* did we just read a sector with data? */ |
| r1461 | r1462 | |
| 1481 | 1481 | nec765_read_complete(); |
| 1482 | 1482 | } |
| 1483 | 1483 | else |
| 1484 | { | |
| 1484 | { | |
| 1485 | 1485 | nec765_increment_sector(); |
| 1486 | 1486 | nec765_read_data(); |
| 1487 | 1487 | } |
| r1461 | r1462 | |
| 1512 | 1512 | /* version */ |
| 1513 | 1513 | case 0x010: |
| 1514 | 1514 | return 1; |
| 1515 | ||
| 1515 | ||
| 1516 | 1516 | /* verify */ |
| 1517 | 1517 | case 0x016: |
| 1518 | 1518 | return 9; |
| r1461 | r1462 | |
| 1524 | 1524 | /* dumpreg */ |
| 1525 | 1525 | case 0x0e: |
| 1526 | 1526 | return 1; |
| 1527 | ||
| 1527 | ||
| 1528 | 1528 | /* perpendicular mode */ |
| 1529 | 1529 | case 0x012: |
| 1530 | 1530 | return 1; |
| r1461 | r1462 | |
| 1532 | 1532 | /* lock */ |
| 1533 | 1533 | case 0x014: |
| 1534 | 1534 | return 1; |
| 1535 | ||
| 1535 | ||
| 1536 | 1536 | /* seek/relative seek are together! */ |
| 1537 | 1537 | |
| 1538 | 1538 | default: |
| r1461 | r1462 | |
| 1825 | 1825 | } |
| 1826 | 1826 | |
| 1827 | 1827 | fdc.nec765_status[3] |= 0x08; |
| 1828 | ||
| 1828 | ||
| 1829 | 1829 | /* two side and fault not set but should be? */ |
| 1830 | 1830 | fdc.nec765_result_bytes[0] = fdc.nec765_status[3]; |
| 1831 | 1831 | nec765_setup_result_phase(1); |
| r1461 | r1462 | |
| 1880 | 1880 | } |
| 1881 | 1881 | } |
| 1882 | 1882 | while (index_count!=2); |
| 1883 | ||
| 1883 | ||
| 1884 | 1884 | /* at this point, we have seen a id or two index pulses have occured! */ |
| 1885 | 1885 | fdc.nec765_result_bytes[0] = fdc.nec765_status[0]; |
| 1886 | 1886 | fdc.nec765_result_bytes[1] = fdc.nec765_status[1]; |
| r1461 | r1462 | |
| 2065 | 2065 | case 0x13: /* configure */ |
| 2066 | 2066 | nec765_idle(); |
| 2067 | 2067 | break; |
| 2068 | ||
| 2068 | ||
| 2069 | 2069 | case 0x0e: /* dump reg */ |
| 2070 | 2070 | fdc.nec765_result_bytes[0] = fdc.pcn[0]; |
| 2071 | 2071 | fdc.nec765_result_bytes[1] = fdc.pcn[1]; |
| 2072 | 2072 | fdc.nec765_result_bytes[2] = fdc.pcn[2]; |
| 2073 | 2073 | fdc.nec765_result_bytes[3] = fdc.pcn[3]; |
| 2074 | ||
| 2074 | ||
| 2075 | 2075 | nec765_setup_result_phase(10); |
| 2076 | 2076 | break; |
| 2077 | 2077 | |
| r1461 | r1462 | |
| 2103 | 2103 | { |
| 2104 | 2104 | /* clear data request */ |
| 2105 | 2105 | nec765_set_dma_drq(CLEAR_LINE); |
| 2106 | ||
| 2106 | ||
| 2107 | 2107 | /* read data */ |
| 2108 | return nec765_data_r(offset); | |
| 2108 | return nec765_data_r(offset); | |
| 2109 | 2109 | } |
| 2110 | 2110 | |
| 2111 | 2111 | |
| r1461 | r1462 | |
| 2129 | 2129 | int a_drive_is_ready; |
| 2130 | 2130 | |
| 2131 | 2131 | fdc.nec765_status[0] = 0x080 | 0x040; |
| 2132 | ||
| 2132 | ||
| 2133 | 2133 | /* for the purpose of pc-xt. If any of the drives have a disk inserted, |
| 2134 | 2134 | do not set not-ready - need to check with pc_fdc.c whether all drives |
| 2135 | 2135 | are checked or only the drive selected with the drive select bits?? */ |
| r1461 | r1462 | |
| 2150 | 2150 | fdc.nec765_status[0] |= 0x08; |
| 2151 | 2151 | } |
| 2152 | 2152 | |
| 2153 | nec765_set_int(1); | |
| 2153 | nec765_set_int(1); | |
| 2154 | 2154 | } |
| 2155 | 2155 | } |
| 2156 | 2156 |
| r1461 | r1462 | |
|---|---|---|
| 6 | 6 | |
| 7 | 7 | |
| 8 | 8 | Apple IIgs specific softswitches: |
| 9 | ||
| 9 | ||
| 10 | 10 | C019 - RDVBLBAR |
| 11 | 11 | bits 7 - set during vblank (when at scanline 192 or higher) |
| 12 | 12 | |
| r1461 | r1462 | |
| 16 | 16 | |
| 17 | 17 | C023 - VGCINT |
| 18 | 18 | bit 7 - set for interrupt generated by VGC |
| 19 | ||
| 19 | ||
| 20 | 20 | bit 6 - set during one second interrupt |
| 21 | 21 | bit 5 - set during scanline interrupt |
| 22 | ||
| 22 | ||
| 23 | 23 | bit 4 - set during external interrupt |
| 24 | 24 | bit 3 - ??? |
| 25 | 25 | bit 2 - set for interrupt every second |
| 26 | ||
| 26 | ||
| 27 | 27 | bit 1 - set for scanline interrupt |
| 28 | 28 | bit 0 - set for external interrupt |
| 29 | 29 | |
| r1461 | r1462 | |
| 48 | 48 | bit 0 - command register full |
| 49 | 49 | |
| 50 | 50 | C02D - SLTROMSEL |
| 51 | ||
| 51 | ||
| 52 | 52 | C031 - DISKREG |
| 53 | 53 | bit 7 - set to select head on 3.5" drive |
| 54 | 54 | bit 6 - set to enable 3.5" drive, clear to enable 5.25" drive |
| r1461 | r1462 | |
| 350 | 350 | * ADB |
| 351 | 351 | * ----------------------------------------------------------------------- */ |
| 352 | 352 | |
| 353 | typedef enum | |
| 353 | typedef enum | |
| 354 | 354 | { |
| 355 | 355 | ADBSTATE_IDLE, |
| 356 | 356 | ADBSTATE_INCOMMAND, |
| r1461 | r1462 | |
| 774 | 774 | |
| 775 | 775 | // make sure we're in the 65816's context |
| 776 | 776 | cpuintrf_push_context(0); |
| 777 | ||
| 777 | ||
| 778 | 778 | scanline = video_screen_get_vpos(0); |
| 779 | 779 | |
| 780 | 780 | video_screen_update_partial(0, scanline); |
| 781 | ||
| 781 | ||
| 782 | 782 | /* scanline interrupt */ |
| 783 | 783 | if ((apple2gs_newvideo & 0x80) && (apple2gs_vgcint & 0x02) && (scanline >= (BORDER_TOP-1)) && (scanline < (200+BORDER_TOP-1))) |
| 784 | 784 | { |
| r1461 | r1462 | |
| 948 | 948 | { |
| 949 | 949 | result = scan - BORDER_TOP + 0x100 + 1; |
| 950 | 950 | } |
| 951 | ||
| 951 | ||
| 952 | 952 | return result; |
| 953 | 953 | } |
| 954 | 954 | |
| r1461 | r1462 | |
| 963 | 963 | case 0x19: /* C019 - RDVBLBAR */ |
| 964 | 964 | result = (video_screen_get_vpos(0) >= (192+BORDER_TOP)) ? 0x80 : 0x00; |
| 965 | 965 | break; |
| 966 | ||
| 966 | ||
| 967 | 967 | case 0x22: /* C022 - TBCOLOR */ |
| 968 | 968 | result = (apple2_get_fgcolor() << 4) |
| 969 | 969 | | apple2_get_bgcolor(); |
| r1461 | r1462 | |
| 1387 | 1387 | { |
| 1388 | 1388 | meminfo->read_mem = 0x03D000 | APPLE2_MEM_ROM; |
| 1389 | 1389 | } |
| 1390 | ||
| 1390 | ||
| 1391 | 1391 | if (a2 & VAR_LCWRITE) |
| 1392 | 1392 | { |
| 1393 | 1393 | if (a2 & VAR_LCRAM2) |
| r1461 | r1462 | |
| 1580 | 1580 | { |
| 1581 | 1581 | UINT8 *opptr = NULL; |
| 1582 | 1582 | int slot; |
| 1583 | ||
| 1583 | ||
| 1584 | 1584 | if (((address & 0xFEF000) == 0x00C000) || ((address & 0xFEF000) == 0xE0C000)) |
| 1585 | 1585 | { |
| 1586 | 1586 | if ((apple2gs_shadow & 0x40) && ((address & 0xF00000) == 0x000000)) |
| r1461 | r1462 | |
| 1728 | 1728 | MACHINE_START( apple2gs ) |
| 1729 | 1729 | { |
| 1730 | 1730 | apple2_config cfg; |
| 1731 | ||
| 1731 | ||
| 1732 | 1732 | memset(&cfg, 0, sizeof(cfg)); |
| 1733 | 1733 | cfg.slots[0] = &apple2_slot_langcard; |
| 1734 | 1734 | cfg.slots[4] = &apple2_slot_mockingboard; |
| 1735 | 1735 | cfg.slots[6] = &apple2_slot_iwm; |
| 1736 | ||
| 1736 | ||
| 1737 | 1737 | apple2_init_common(machine, &cfg); |
| 1738 | 1738 | |
| 1739 | 1739 | /* set up Apple IIgs vectoring */ |
| r1461 | r1462 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | 3 | applefdc.c |
| 4 | ||
| 4 | ||
| 5 | 5 | Implementation of various Apple Floppy Disk Controllers, including |
| 6 | 6 | the classic Apple controller and the IWM (Integrated Woz Machine) |
| 7 | 7 | chip |
| r1461 | r1462 | |
| 16 | 16 | XGS and KEGS emulators which also contain IWM emulations. |
| 17 | 17 | |
| 18 | 18 | TODO |
| 19 | - Implement the unimplemented IWM modes | |
| 19 | - Implement the unimplemented IWM modes | |
| 20 | 20 | - IWM_MODE_CLOCKSPEED |
| 21 | 21 | - IWM_MODE_BITCELLTIME |
| 22 | 22 | - IWM_MODE_HANDSHAKEPROTOCOL |
| r1461 | r1462 | |
| 360 | 360 | } |
| 361 | 361 | else |
| 362 | 362 | result = applefdc_read_reg(0); |
| 363 | ||
| 363 | ||
| 364 | 364 | break; |
| 365 | 365 | case 0x0D: |
| 366 | 366 | result = applefdc_read_reg(IWM_Q6); |
| r1461 | r1462 | |
|---|---|---|
| 37 | 37 | static struct { |
| 38 | 38 | int state; |
| 39 | 39 | struct { |
| 40 | int realsize, | |
| 40 | int realsize, | |
| 41 | 41 | adr,/* a11..a0 ignored */ |
| 42 | 42 | size;/* a19..a12 comparator select, 1 means address line must match adr */ |
| 43 | 43 | } mem[5]; |
| r1461 | r1462 | |
| 91 | 91 | } |
| 92 | 92 | if (hp48s.mem[HDW].adr!=-1) |
| 93 | 93 | { |
| 94 | memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, hp48s.mem[HDW].adr&~0x3f, | |
| 94 | memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, hp48s.mem[HDW].adr&~0x3f, | |
| 95 | 95 | hp48s.mem[HDW].adr|0x3f, 0, 0, hp48_read); |
| 96 | 96 | memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, hp48s.mem[HDW].adr&~0x3f, |
| 97 | 97 | hp48s.mem[HDW].adr|0x3f, 0, 0, hp48_write); |
| r1461 | r1462 | |
| 187 | 187 | } |
| 188 | 188 | |
| 189 | 189 | #define TIMER1_VALUE hp48_hardware.data[0x37] |
| 190 | HP48_HARDWARE hp48_hardware={ | |
| 191 | {0} | |
| 190 | HP48_HARDWARE hp48_hardware={ | |
| 191 | {0} | |
| 192 | 192 | }; |
| 193 | 193 | |
| 194 | 194 | void hp48_crc(int adr, int data) |
| r1461 | r1462 | |
| 196 | 196 | if ((hp48s.mem[HDW].adr==-1) |
| 197 | 197 | ||(adr<(hp48s.mem[HDW].adr&~0x3f)) |
| 198 | 198 | ||(adr>(hp48s.mem[HDW].adr|0x3f)) ) |
| 199 | hp48_hardware.crc=(hp48_hardware.crc >> 4) | |
| 199 | hp48_hardware.crc=(hp48_hardware.crc >> 4) | |
| 200 | 200 | ^ (((hp48_hardware.crc ^ data) & 0xf) * 0x1081); |
| 201 | else | |
| 202 | hp48_hardware.crc=(hp48_hardware.crc >> 4) | |
| 201 | else | |
| 202 | hp48_hardware.crc=(hp48_hardware.crc >> 4) | |
| 203 | 203 | ^ ((hp48_hardware.crc& 0xf) * 0x1081); |
| 204 | 204 | } |
| 205 | 205 | |
| r1461 | r1462 | |
| 210 | 210 | case 0: case 1: case 2: case 3: |
| 211 | 211 | case 0xb: case 0xc: |
| 212 | 212 | hp48_hardware.data[offset]=data; |
| 213 | break; | |
| 213 | break; | |
| 214 | 214 | case 0x20: case 0x21: case 0x22: case 0x23: case 0x24: |
| 215 | 215 | case 0x25: case 0x26: case 0x27: |
| 216 | 216 | case 0x28: case 0x29: //wo |
| 217 | 217 | case 0x30: case 0x31: case 0x32: case 0x33: case 0x34: |
| 218 | 218 | hp48_hardware.data[offset]=data; |
| 219 | break; | |
| 219 | break; | |
| 220 | 220 | // uart |
| 221 | case 0xd: case 0x10: case 0x11: case 0x12: | |
| 221 | case 0xd: case 0x10: case 0x11: case 0x12: | |
| 222 | 222 | case 0x13: //w0 |
| 223 | 223 | case 0x14: case 0x15: //r0 |
| 224 | 224 | case 0x16: case 0x17: //w0 |
| r1461 | r1462 | |
| 276 | 276 | break; |
| 277 | 277 | case 0x18: case 0x19: //lsb of service request |
| 278 | 278 | hp48_hardware.data[offset]=data; |
| 279 | break; | |
| 279 | break; | |
| 280 | 280 | case 0x1b: // base nibble offset |
| 281 | 281 | hp48_hardware.data[offset]=data; |
| 282 | 282 | break; |
| r1461 | r1462 | |
| 295 | 295 | { |
| 296 | 296 | int data=0; |
| 297 | 297 | switch (offset) { |
| 298 | // lcd | |
| 298 | // lcd | |
| 299 | 299 | case 0: case 1: case 2: case 3: |
| 300 | 300 | case 9: |
| 301 | 301 | data=1; //reset |
| r1461 | r1462 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | 3 | applefdc.h |
| 4 | ||
| 4 | ||
| 5 | 5 | Implementation of various Apple Floppy Disk Controllers, including |
| 6 | 6 | the classic Apple controller and the IWM (Integrated Woz Machine) |
| 7 | 7 | chip |
| r1461 | r1462 | |
|---|---|---|
| 378 | 378 | memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0xC000, 0xC0FF, 0, 0, apple3_c0xx_r); |
| 379 | 379 | memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0xC000, 0xC0FF, 0, 0, apple3_c0xx_w); |
| 380 | 380 | } |
| 381 | else | |
| 381 | else | |
| 382 | 382 | { |
| 383 | 383 | memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0xC000, 0xC0FF, 0, 0, MRA8_BANK8); |
| 384 | 384 | if (via_0_a & 0x08) |
| r1461 | r1462 | |
|---|---|---|
| 154 | 154 | READ32_HANDLER( clio_r ) |
| 155 | 155 | { |
| 156 | 156 | logerror( "%08X: CLIO read offset = %08X\n", activecpu_get_pc(), offset ); |
| 157 | ||
| 157 | ||
| 158 | 158 | switch( offset ) |
| 159 | 159 | { |
| 160 | 160 | case 0x0a: return 0x40; break; |
| r1461 | r1462 | |
| 162 | 162 | { |
| 163 | 163 | static UINT32 irq_sequence[3] = { 0, 4, 12 }; |
| 164 | 164 | static int counter = 0; |
| 165 | ||
| 165 | ||
| 166 | 166 | return irq_sequence[(counter++)%3]; |
| 167 | 167 | } |
| 168 | 168 | break; |
| r1461 | r1462 | |
| 173 | 173 | WRITE32_HANDLER( clio_w ) |
| 174 | 174 | { |
| 175 | 175 | logerror( "%08X: CLIO write offset = %08X, data = %08X, mask = %08X\n", activecpu_get_pc(), offset, data, mem_mask ); |
| 176 | ||
| 176 | ||
| 177 | 177 | switch( offset ) |
| 178 | 178 | { |
| 179 | 179 | case 0x0A: /* 03400028 - bits 0,1, and 6 are tested (irq sources?) */ |
| 180 | 180 | break; |
| 181 | ||
| 181 | ||
| 182 | 182 | case 0x0B: /* 0340002C - ?? during boot 0000000B is written here counter reload related?? */ |
| 183 | 183 | break; |
| 184 | ||
| 184 | ||
| 185 | 185 | case 0x88: /* set timer frequency */ |
| 186 | ||
| 186 | ||
| 187 | 187 | break; |
| 188 | 188 | } |
| 189 | 189 | } |
| r1461 | r1462 | |
|---|---|---|
| 1 | 1 | /**************************************************************************** |
| 2 | 2 | Mac hardware |
| 3 | ||
| 3 | ||
| 4 | 4 | The hardware for Mac 128k, 512k, 512ke, Plus (SCSI, SCC, etc). |
| 5 | 5 | |
| 6 | 6 | Nate Woods |
| r1461 | r1462 | |
| 8 | 8 | Raphael Nabet |
| 9 | 9 | |
| 10 | 10 | Mac Model Feature Summary: |
| 11 | ||
| 11 | ||
| 12 | 12 | CPU FDC Keyb PRAM ROMMir |
| 13 | 13 | - Mac 128k 68k IWM orig orig ??? |
| 14 | 14 | - Mac 512k 68k IWM orig orig ??? |
| r1461 | r1462 | |
| 434 | 434 | } |
| 435 | 435 | else |
| 436 | 436 | { |
| 437 | /* Communication is over */ | |
| 437 | /* Communication is over */ | |
| 438 | 438 | kbd_comm = FALSE; |
| 439 | 439 | } |
| 440 | 440 | } |
| r1461 | r1462 | |
| 489 | 489 | |
| 490 | 490 | keyboard_reply = scan_keyboard(); |
| 491 | 491 | if (keyboard_reply == 0x7B) |
| 492 | { | |
| 492 | { | |
| 493 | 493 | /* if NULL, wait until key pressed or timeout */ |
| 494 | 494 | timer_adjust(inquiry_timeout, |
| 495 | 495 | attotime_make(0, DOUBLE_TO_ATTOSECONDS(0.25)), |
| r1461 | r1462 | |
| 903 | 903 | if (rtc_state == RTC_STATE_XPCOMMAND) |
| 904 | 904 | { |
| 905 | 905 | rtc_xpaddr = ((rtc_cmd & 7)<<5) | ((data&0x7c)>>2); |
| 906 | if ((rtc_cmd & 0x80) != 0) | |
| 906 | if ((rtc_cmd & 0x80) != 0) | |
| 907 | 907 | { |
| 908 | 908 | // read command |
| 909 | 909 | if (LOG_RTC) |
| r1461 | r1462 | |
|---|---|---|
| 165 | 165 | else {KbRepeatTable[0x0E]=0;} |
| 166 | 166 | if (controlKey && !shiftKey && !(keyboard[1] & 0x80)) addToKeyboardBuffer(0x0F); /* controlKey + O */ |
| 167 | 167 | else {KbRepeatTable[0x0F]=0;} |
| 168 | ||
| 168 | ||
| 169 | 169 | if (controlKey && !shiftKey && !(keyboard[2] & 0x01)) addToKeyboardBuffer(0x10); /* controlKey + P */ |
| 170 | 170 | else {KbRepeatTable[0x10]=0;} |
| 171 | 171 | if (controlKey && !shiftKey && !(keyboard[2] & 0x02)) addToKeyboardBuffer(0x11); /* controlKey + Q */ |
| r1461 | r1462 | |
| 557 | 557 | buffer=(memory_region(REGION_CPU1)[statusDCB+0x01])+(memory_region(REGION_CPU1)[statusDCB+0x02]<<8); |
| 558 | 558 | byteCount=(memory_region(REGION_CPU1)[statusDCB+0x03])+(memory_region(REGION_CPU1)[statusDCB+0x04]<<8); |
| 559 | 559 | |
| 560 | if (deviceNum>=4 && deviceNum<=7) | |
| 560 | if (deviceNum>=4 && deviceNum<=7) | |
| 561 | 561 | { |
| 562 | 562 | image = image_from_devtype_and_index(IO_FLOPPY, deviceNum - 4); |
| 563 | 563 | if (image_exists(image)) |
| r1461 | r1462 | |
| 618 | 618 | case 4: /* Read Data */ |
| 619 | 619 | /* |
| 620 | 620 | AdamNet Error codes on low nibble for tape1,disk1,disk2 and on high nibble for tape2 (share DCB with tape1): |
| 621 | ||
| 621 | ||
| 622 | 622 | 0x00 No Error (everything is OK) |
| 623 | 623 | 0x01 CRC Error (block corrupt; data failed cyclic redundancy check) |
| 624 | 624 | 0x02 Missing Block (attempt to access past physical end of medium) |
| r1461 | r1462 | |
| 700 | 700 | } |
| 701 | 701 | |
| 702 | 702 | READ8_HANDLER( adamnet_r ) |
| 703 | { | |
| 703 | { | |
| 704 | 704 | //logerror("adam_net_data Read %2xh\n",adam_net_data); |
| 705 | 705 | return adam_net_data; |
| 706 | 706 | } |
| r1461 | r1462 | |
| 708 | 708 | WRITE8_HANDLER( adamnet_w ) |
| 709 | 709 | { |
| 710 | 710 | /* |
| 711 | If SmartWriter ROM is selected on lower Z80 memory | |
| 711 | If SmartWriter ROM is selected on lower Z80 memory | |
| 712 | 712 | if data bit1 is 1 -> Lower 32k = EOS otherwise Lower 32k = SmartWriter |
| 713 | 713 | */ |
| 714 | 714 | UINT8 *BankBase; |
| r1461 | r1462 | |
| 735 | 735 | memory_set_bankptr(2, BankBase+0x22000); |
| 736 | 736 | memory_set_bankptr(3, BankBase+0x24000); |
| 737 | 737 | memory_set_bankptr(4, BankBase+0x26000); |
| 738 | ||
| 738 | ||
| 739 | 739 | memory_set_bankptr(6, BankBase+0x3A000); /* Write protecting ROM */ |
| 740 | 740 | memory_set_bankptr(7, BankBase+0x3A000); /* Write protecting ROM */ |
| 741 | 741 | memory_set_bankptr(8, BankBase+0x3A000); /* Write protecting ROM */ |
| r1461 | r1462 | |
| 754 | 754 | { |
| 755 | 755 | /* |
| 756 | 756 | Writes to ports 0x60 to 0x7F set memory map: |
| 757 | ||
| 757 | ||
| 758 | 758 | - D1,D0 -> Lower Memory configuration (0x0000, 0x7FFF) |
| 759 | 759 | 0 0 SmartWriter Rom |
| 760 | 760 | 0 1 Internal RAM (32k) |
| 761 | 761 | 1 0 RAM Expansion (32k) |
| 762 | 762 | 1 1 OS7 ROM (8k) + Internal RAM (24k) (for partial ColecoVision compatibility) |
| 763 | ||
| 763 | ||
| 764 | 764 | - D3,D2 -> Upper Memory configuration (0x8000, 0xFFFF) |
| 765 | 765 | 0 0 Internal RAM (32k) |
| 766 | 766 | 0 1 ROM Expansion (32k). The first expansion ROM byte must be 0x66, and the second 0x99. |
| 767 | 767 | 1 0 RAM Expansion (32k) |
| 768 | 768 | 1 1 Cartridge ROM (32k) |
| 769 | ||
| 769 | ||
| 770 | 770 | - D7,D4 -> Reserved for future expansions, must be 0. |
| 771 | 771 | |
| 772 | 772 | */ |
| 773 | ||
| 773 | ||
| 774 | 774 | adam_lower_memory = (data & 0x03); |
| 775 | 775 | adam_upper_memory = (data & 0x0C)>>2; |
| 776 | 776 | set_memory_banks(); |
| r1461 | r1462 | |
| 778 | 778 | } |
| 779 | 779 | |
| 780 | 780 | READ8_HANDLER(adam_video_r) |
| 781 | { | |
| 781 | { | |
| 782 | 782 | return ((offset&0x01) ? TMS9928A_register_r(1) : TMS9928A_vram_r(0)); |
| 783 | 783 | } |
| 784 | 784 | |
| r1461 | r1462 | |
| 788 | 788 | } |
| 789 | 789 | |
| 790 | 790 | READ8_HANDLER( master6801_ram_r ) |
| 791 | { | |
| 791 | { | |
| 792 | 792 | /*logerror("Offset %04Xh = %02Xh\n",offset ,memory_region(REGION_CPU1)[offset]);*/ |
| 793 | 793 | return memory_region(REGION_CPU1)[offset+0x4000]; |
| 794 | 794 | } |
| r1461 | r1462 | |
| 813 | 813 | inport0 = readinputportbytag("controller1_keypad1"); |
| 814 | 814 | inport1 = readinputportbytag("controller1_keypad2"); |
| 815 | 815 | inport6 = readinputportbytag("controllers"); |
| 816 | ||
| 817 | /* Numeric pad buttons are not independent on a real ColecoVision, if you push more | |
| 816 | ||
| 817 | /* Numeric pad buttons are not independent on a real ColecoVision, if you push more | |
| 818 | 818 | than one, a real ColecoVision think that it is a third button, so we are going to emulate |
| 819 | 819 | the right behaviour */ |
| 820 | ||
| 820 | ||
| 821 | 821 | data = 0x0F; /* No key pressed by default */ |
| 822 | 822 | if (!(inport6&0x01)) /* If Driving Controller enabled -> no keypad 1 */ |
| 823 | 823 | { |
| r1461 | r1462 | |
| 841 | 841 | { |
| 842 | 842 | int data = readinputportbytag("controller1_joystick") & 0xCF; |
| 843 | 843 | int inport6 = readinputportbytag("controllers"); |
| 844 | ||
| 844 | ||
| 845 | 845 | if (inport6&0x07) /* If Extra Contollers enabled */ |
| 846 | 846 | { |
| 847 | 847 | if (adam_joy_stat[0]==0) |
| 848 | 848 | data |= 0x30; /* Spinner Move Left */ |
| 849 | 849 | else if (adam_joy_stat[0]==1) |
| 850 | 850 | data |= 0x20; /* Spinner Move Right */ |
| 851 | } | |
| 851 | } | |
| 852 | 852 | return data | 0x80; |
| 853 | 853 | } |
| 854 | 854 | } |
| r1461 | r1462 | |
| 863 | 863 | inport3 = readinputportbytag("controller2_keypad1"); |
| 864 | 864 | inport4 = readinputportbytag("controller2_keypad2"); |
| 865 | 865 | |
| 866 | /* Numeric pad buttons are not independent on a real ColecoVision, if you push more | |
| 866 | /* Numeric pad buttons are not independent on a real ColecoVision, if you push more | |
| 867 | 867 | than one, a real ColecoVision think that it is a third button, so we are going to emulate |
| 868 | 868 | the right behaviour */ |
| 869 | ||
| 869 | ||
| 870 | 870 | data = 0x0F; /* No key pressed by default */ |
| 871 | 871 | if (!(inport3 & 0x01)) data &= 0x0A; /* 0 */ |
| 872 | 872 | if (!(inport3 & 0x02)) data &= 0x0D; /* 1 */ |
| r1461 | r1462 | |
| 888 | 888 | { |
| 889 | 889 | int data = readinputportbytag("controller2_joystick") & 0xCF; |
| 890 | 890 | int inport6 = readinputportbytag("controllers"); |
| 891 | ||
| 891 | ||
| 892 | 892 | if (inport6&0x02) /* If Roller Controller enabled */ |
| 893 | 893 | { |
| 894 | 894 | if (adam_joy_stat[1]==0) data|=0x30; |
| 895 | 895 | else if (adam_joy_stat[1]==1) data|=0x20; |
| 896 | } | |
| 896 | } | |
| 897 | 897 | |
| 898 | 898 | return data | 0x80; |
| 899 | 899 | } |
| r1461 | r1462 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | 2 | * ncr5380.c |
| 3 | 3 | * |
| 4 | * NCR 5380 SCSI controller, as seen in many 680x0 Macs, | |
| 4 | * NCR 5380 SCSI controller, as seen in many 680x0 Macs, | |
| 5 | 5 | * official Apple add-on cards for the Apple II series, |
| 6 | 6 | * and probably some PC cards as well. |
| 7 | 7 | * |
| r1461 | r1462 | |
| 13 | 13 | * |
| 14 | 14 | * NOTES: |
| 15 | 15 | * This implementation is tied closely to the drivers found in the Mac Plus ROM and the routines in Mac |
| 16 | * System 6.0.3 that it patches out the ROM traps with. While attempts have been made to | |
| 16 | * System 6.0.3 that it patches out the ROM traps with. While attempts have been made to | |
| 17 | 17 | * have the behavior work according to the manual and not the specific Apple driver code, |
| 18 | 18 | * there are almost certainly areas where that is true. In particular, IRQs are not implemented |
| 19 | 19 | * as they are unused on the Mac Plus. |
| r1461 | r1462 | |
| 53 | 53 | typedef struct |
| 54 | 54 | { |
| 55 | 55 | void *data; // device's "this" pointer |
| 56 | pSCSIDispatch handler; // device's handler routine | |
| 56 | pSCSIDispatch handler; // device's handler routine | |
| 57 | 57 | } SCSIDev; |
| 58 | 58 | |
| 59 | 59 | static SCSIDev devices[8]; // SCSI IDs 0-7 |
| r1461 | r1462 | |
| 178 | 178 | d_limit = devices[last_id].handler(SCSIOP_EXEC_COMMAND, devices[last_id].data, 0, &n5380_Command[0]); |
| 179 | 179 | |
| 180 | 180 | d_ptr = 0; |
| 181 | ||
| 181 | ||
| 182 | 182 | // is data available? |
| 183 | 183 | if (d_limit > 0) |
| 184 | 184 | { |
| r1461 | r1462 | |
| 187 | 187 | { |
| 188 | 188 | n5380_Data[d_limit] = 0; |
| 189 | 189 | } |
| 190 | ||
| 190 | ||
| 191 | 191 | // read back the amount available, or 512 bytes, whichever is smaller |
| 192 | 192 | ncr5380_read_data((d_limit < 512) ? d_limit : 512, n5380_Data); |
| 193 | 193 | |
| r1461 | r1462 | |
| 240 | 240 | n5380_Registers[R5380_INICOMMAND] &= ~0x20; // clear "lost arbitration" |
| 241 | 241 | } |
| 242 | 242 | |
| 243 | if (data == 0) | |
| 243 | if (data == 0) | |
| 244 | 244 | { |
| 245 | 245 | // drop DMA mode |
| 246 | 246 | n5380_Registers[R5380_BUSANDSTAT] &= ~0x40; |
| r1461 | r1462 | |
| 287 | 287 | { |
| 288 | 288 | case R5380_CURDATA: |
| 289 | 289 | rv = n5380_Registers[reg]; |
| 290 | ||
| 290 | ||
| 291 | 291 | // if we're in the data transfer phase, readback device data instead |
| 292 | 292 | if ((n5380_Registers[R5380_BUSSTATUS] & 0x1c) == 0x04) |
| 293 | 293 | { |
| r1461 | r1462 | |
| 306 | 306 | if (d_ptr < 511) |
| 307 | 307 | { |
| 308 | 308 | d_ptr++; |
| 309 | } | |
| 309 | } | |
| 310 | 310 | else |
| 311 | 311 | { |
| 312 | 312 | d_limit -= 512; |
| r1461 | r1462 | |
| 350 | 350 | /* compilation error */ |
| 351 | 351 | /* devices[interface->scsidevs->devices[i].scsiID].handler = interface->scsidevs->devices[i].handler; */ |
| 352 | 352 | /* interface->scsidevs->devices[i].handler(SCSIOP_ALLOC_INSTANCE, &devices[interface->scsidevs->devices[i].scsiID].data, interface->scsidevs->devices[i].diskID, (UINT8 *)NULL); */ |
| 353 | } | |
| 353 | } | |
| 354 | 354 | |
| 355 | 355 | state_save_register_item_array("ncr5380", 0, n5380_Registers); |
| 356 | 356 | state_save_register_item_array("ncr5380", 0, n5380_Command); |
| r1461 | r1462 | |
|---|---|---|
| 119 | 119 | case 1: |
| 120 | 120 | result = 0xFF008010; |
| 121 | 121 | break; |
| 122 | ||
| 122 | ||
| 123 | 123 | default: |
| 124 | 124 | fatalerror("Unknown CPU"); |
| 125 | 125 | break; |
| r1461 | r1462 | |
|---|---|---|
| 17 | 17 | uart.callback = NULL; |
| 18 | 18 | serial_connection_init(&uart.connection); |
| 19 | 19 | serial_connection_set_in_callback(&uart.connection, hd6402_in_callback); |
| 20 | uart.connection.input_state = 0; | |
| 20 | uart.connection.input_state = 0; | |
| 21 | 21 | receive_register_reset(&uart.receive_reg); |
| 22 | 22 | transmit_register_reset(&uart.transmit_reg); |
| 23 | 23 | } |
| r1461 | r1462 | |
| 38 | 38 | /* set it up */ |
| 39 | 39 | transmit_register_setup(&uart.transmit_reg, &uart.data_form, uart.data); |
| 40 | 40 | } |
| 41 | ||
| 41 | ||
| 42 | 42 | /* if transmit is not empty... transmit data */ |
| 43 | 43 | if ((uart.transmit_reg.flags & TRANSMIT_REGISTER_EMPTY)==0) |
| 44 | 44 | { |
| r1461 | r1462 | |
| 70 | 70 | { |
| 71 | 71 | /* get bit received from other side and update receive register */ |
| 72 | 72 | receive_register_update_bit(&uart.receive_reg, get_in_data_bit(uart.connection.input_state)); |
| 73 | ||
| 73 | ||
| 74 | 74 | if (uart.receive_reg.flags & RECEIVE_REGISTER_FULL) |
| 75 | 75 | { |
| 76 | 76 | receive_register_extract(&uart.receive_reg, &uart.data_form); |
| r1461 | r1462 | |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | uart.data_form.stop_bit_count = stop_bits; |
| 157 | ||
| 157 | ||
| 158 | 158 | logerror("hd6402: stop bits: %d\n",stop_bits); |
| 159 | 159 | } |
| 160 | 160 | |
| r1461 | r1462 | |
| 188 | 188 | if ((data & HD6402_INPUT_DRR)==0) |
| 189 | 189 | { |
| 190 | 190 | uart.state &=~HD6402_OUTPUT_DR; |
| 191 | ||
| 191 | ||
| 192 | 192 | /* refresh outputs */ |
| 193 | 193 | if (uart.callback) |
| 194 | 194 | uart.callback(HD6402_OUTPUT_PE|HD6402_OUTPUT_FE|HD6402_OUTPUT_OE|HD6402_OUTPUT_DR|HD6402_OUTPUT_TRE, uart.state); |
| r1461 | r1462 | |
| 210 | 210 | uart.state |=(data & mask); |
| 211 | 211 | hd6402_update_parity(); |
| 212 | 212 | } |
| 213 | ||
| 213 | ||
| 214 | 214 | /* character length set */ |
| 215 | 215 | if (mask & (HD6402_INPUT_CLS1|HD6402_INPUT_CLS2)) |
| 216 | 216 | { |
| r1461 | r1462 | |
|---|---|---|
| 11 | 11 | until A15 is asserted. The Z80 NOP instruction is 0x00, so the effect is |
| 12 | 12 | to cause reset to skip all memory up to 0x8000, where the actual handling |
| 13 | 13 | code resides. |
| 14 | ||
| 14 | ||
| 15 | 15 | ****************************************************************************/ |
| 16 | 16 | |
| 17 | 17 | #include "driver.h" |
| r1461 | r1462 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | * msx_slot.c : definitions of the different slots | |
| 2 | * msx_slot.c : definitions of the different slots | |
| 3 | 3 | * |
| 4 | 4 | * Copyright (C) 2004 Sean Young |
| 5 | 5 | * |
| r1461 | r1462 | |
| 96 | 96 | MSX_SLOT_MAP(rom) |
| 97 | 97 | { |
| 98 | 98 | UINT8 *mem = state->mem + (page - state->start_page) * 0x4000; |
| 99 | ||
| 99 | ||
| 100 | 100 | msx_cpu_setbank (page * 2 + 1, mem); |
| 101 | 101 | msx_cpu_setbank (page * 2 + 2, mem + 0x2000); |
| 102 | 102 | } |
| r1461 | r1462 | |
| 111 | 111 | |
| 112 | 112 | return 0; |
| 113 | 113 | } |
| 114 | ||
| 114 | ||
| 115 | 115 | MSX_SLOT_MAP(ram) |
| 116 | 116 | { |
| 117 | 117 | UINT8 *mem = state->mem + (page - state->start_page) * 0x4000; |
| r1461 | r1462 | |
| 131 | 131 | #ifdef MONMSX |
| 132 | 132 | FILE *f; |
| 133 | 133 | #endif |
| 134 | ||
| 134 | ||
| 135 | 135 | nsize = 0x10000; /* 64 kb */ |
| 136 | 136 | mask = 3; |
| 137 | 137 | for (i=0; i<6; i++) { |
| r1461 | r1462 | |
| 177 | 177 | |
| 178 | 178 | MSX_SLOT_MAP(rammm) |
| 179 | 179 | { |
| 180 | UINT8 *mem = state->mem + | |
| 180 | UINT8 *mem = state->mem + | |
| 181 | 181 | 0x4000 * (msx1.ram_mapper[page] & state->bank_mask); |
| 182 | ||
| 182 | ||
| 183 | 183 | msx1.ram_pages[page] = mem; |
| 184 | 184 | msx_cpu_setbank (page * 2 + 1, mem); |
| 185 | 185 | msx_cpu_setbank (page * 2 + 2, mem + 0x2000); |
| r1461 | r1462 | |
| 358 | 358 | case 2: |
| 359 | 359 | msx_cpu_setbank (5, state->mem + state->banks[2] * 0x2000); |
| 360 | 360 | msx_cpu_setbank (6, state->mem + state->banks[3] * 0x2000); |
| 361 | memory_install_read8_handler (0, ADDRESS_SPACE_PROGRAM, 0x9800, 0x9fff, 0, 0, | |
| 361 | memory_install_read8_handler (0, ADDRESS_SPACE_PROGRAM, 0x9800, 0x9fff, 0, 0, | |
| 362 | 362 | state->cart.scc.active ? konami_scc_bank5 : MRA8_BANK7); |
| 363 | 363 | break; |
| 364 | 364 | case 3: |
| r1461 | r1462 | |
| 375 | 375 | if (msx1.state[3] == state) { |
| 376 | 376 | slot_konami_scc_map (state, 3); |
| 377 | 377 | } |
| 378 | } | |
| 378 | } | |
| 379 | 379 | else if (addr >= 0x7000 && addr < 0x7800) { |
| 380 | 380 | state->banks[1] = val & state->bank_mask; |
| 381 | 381 | slot_konami_scc_map (state, 1); |
| 382 | 382 | if (msx1.state[3] == state) { |
| 383 | 383 | slot_konami_scc_map (state, 3); |
| 384 | 384 | } |
| 385 | } | |
| 385 | } | |
| 386 | 386 | else if (addr >= 0x9000 && addr < 0x9800) { |
| 387 | 387 | state->banks[2] = val & state->bank_mask; |
| 388 | 388 | state->cart.scc.active = ((val & 0x3f) == 0x3f); |
| r1461 | r1462 | |
| 390 | 390 | if (msx1.state[0] == state) { |
| 391 | 391 | slot_konami_scc_map (state, 0); |
| 392 | 392 | } |
| 393 | } | |
| 393 | } | |
| 394 | 394 | else if (state->cart.scc.active && addr >= 0x9800 && addr < 0xa000) { |
| 395 | 395 | int offset = addr & 0xff; |
| 396 | 396 | |
| r1461 | r1462 | |
| 414 | 414 | /* deformation register */ |
| 415 | 415 | } |
| 416 | 416 | #endif |
| 417 | } | |
| 417 | } | |
| 418 | 418 | else if (addr >= 0xb000 && addr < 0xb800) { |
| 419 | 419 | state->banks[3] = val & state->bank_mask; |
| 420 | 420 | slot_konami_scc_map (state, 2); |
| r1461 | r1462 | |
| 649 | 649 | } |
| 650 | 650 | if (addr >= 0x8000 && addr < 0xc000) { |
| 651 | 651 | bank = addr < 0xa000 ? 2 : 3; |
| 652 | if (!(state->banks[bank] & state->cart.sram.empty_mask) && | |
| 652 | if (!(state->banks[bank] & state->cart.sram.empty_mask) && | |
| 653 | 653 | (state->banks[bank] & state->cart.sram.sram_mask)) { |
| 654 | 654 | state->cart.sram.mem[addr & 0x1fff] = val; |
| 655 | 655 | } |
| r1461 | r1462 | |
| 800 | 800 | } |
| 801 | 801 | } |
| 802 | 802 | else if (addr >= 0x8000 && addr < 0xc000) { |
| 803 | if (!(state->banks[1] & state->cart.sram.empty_mask) && | |
| 803 | if (!(state->banks[1] & state->cart.sram.empty_mask) && | |
| 804 | 804 | (state->banks[1] & state->cart.sram.sram_mask)) { |
| 805 | 805 | int offset, i; |
| 806 | 806 | |
| r1461 | r1462 | |
| 831 | 831 | |
| 832 | 832 | if (mame_fread (f, state->cart.sram.mem, 0x200) == 0x200) { |
| 833 | 833 | int offset, i; |
| 834 | ||
| 834 | ||
| 835 | 835 | mame_fclose (f); |
| 836 | 836 | |
| 837 | 837 | offset = 0; |
| r1461 | r1462 | |
| 979 | 979 | case 1: |
| 980 | 980 | msx_cpu_setbank (1 + page * 2, state->mem); /* bank 0 is hardwired */ |
| 981 | 981 | if (state->banks[1] > 15) { |
| 982 | msx_cpu_setbank (2 + page * 2, state->cart.sram.mem + | |
| 982 | msx_cpu_setbank (2 + page * 2, state->cart.sram.mem + | |
| 983 | 983 | (state->banks[1] - 16) * 0x2000); |
| 984 | 984 | } |
| 985 | 985 | else { |
| r1461 | r1462 | |
| 1137 | 1137 | case 2: return wd17xx_sector_r (0); |
| 1138 | 1138 | case 3: return wd17xx_data_r (0); |
| 1139 | 1139 | case 7: return msx1.dsk_stat; |
| 1140 | default: | |
| 1140 | default: | |
| 1141 | 1141 | return msx1.state[1]->mem[offset + 0x3ff8]; |
| 1142 | 1142 | } |
| 1143 | 1143 | } |
| 1144 | ||
| 1144 | ||
| 1145 | 1145 | static READ8_HANDLER (msx_diskrom_page2_r) |
| 1146 | 1146 | { |
| 1147 | 1147 | if (offset >= 0x7f8) { |
| 1148 | 1148 | switch (offset) { |
| 1149 | case 0x7f8: | |
| 1149 | case 0x7f8: | |
| 1150 | 1150 | return wd17xx_status_r (0); |
| 1151 | case 0x7f9: | |
| 1151 | case 0x7f9: | |
| 1152 | 1152 | return wd17xx_track_r (0); |
| 1153 | case 0x7fa: | |
| 1153 | case 0x7fa: | |
| 1154 | 1154 | return wd17xx_sector_r (0); |
| 1155 | case 0x7fb: | |
| 1155 | case 0x7fb: | |
| 1156 | 1156 | return wd17xx_data_r (0); |
| 1157 | case 0x7ff: | |
| 1157 | case 0x7ff: | |
| 1158 | 1158 | return msx1.dsk_stat; |
| 1159 | default: | |
| 1159 | default: | |
| 1160 | 1160 | return msx1.state[2]->mem[offset + 0x3800]; |
| 1161 | 1161 | } |
| 1162 | 1162 | } |
| r1461 | r1462 | |
| 1247 | 1247 | case 2: return wd17xx_sector_r (0); |
| 1248 | 1248 | case 3: return wd17xx_data_r (0); |
| 1249 | 1249 | case 4: return msx1.dsk_stat; |
| 1250 | default: | |
| 1250 | default: | |
| 1251 | 1251 | return msx1.state[1]->mem[offset + 0x3ff8]; |
| 1252 | 1252 | } |
| 1253 | 1253 | } |
| 1254 | ||
| 1254 | ||
| 1255 | 1255 | static READ8_HANDLER (msx_diskrom2_page2_r) |
| 1256 | 1256 | { |
| 1257 | 1257 | if (offset >= 0x7b8) { |
| 1258 | 1258 | switch (offset) { |
| 1259 | case 0x7b8: | |
| 1259 | case 0x7b8: | |
| 1260 | 1260 | return wd17xx_status_r (0); |
| 1261 | case 0x7b9: | |
| 1261 | case 0x7b9: | |
| 1262 | 1262 | return wd17xx_track_r (0); |
| 1263 | case 0x7ba: | |
| 1263 | case 0x7ba: | |
| 1264 | 1264 | return wd17xx_sector_r (0); |
| 1265 | case 0x7bb: | |
| 1265 | case 0x7bb: | |
| 1266 | 1266 | return wd17xx_data_r (0); |
| 1267 | case 0x7bc: | |
| 1267 | case 0x7bc: | |
| 1268 | 1268 | return msx1.dsk_stat; |
| 1269 | default: | |
| 1269 | default: | |
| 1270 | 1270 | return msx1.state[2]->mem[offset + 0x3800]; |
| 1271 | 1271 | } |
| 1272 | 1272 | } |
| r1461 | r1462 | |
| 1395 | 1395 | for (i=0; i<4; i++) { |
| 1396 | 1396 | state->banks[i] = i; |
| 1397 | 1397 | } |
| 1398 | } | |
| 1398 | } | |
| 1399 | 1399 | |
| 1400 | 1400 | MSX_SLOT_MAP(majutsushi) |
| 1401 | 1401 | { |
| r1461 | r1462 | |
| 1528 | 1528 | state->cart.fmpac.mem[addr & 0x1fff] = val; |
| 1529 | 1529 | } |
| 1530 | 1530 | |
| 1531 | state->cart.fmpac.sram_active = | |
| 1531 | state->cart.fmpac.sram_active = | |
| 1532 | 1532 | (state->cart.fmpac.mem[0x1ffe] == 0x4d && |
| 1533 | 1533 | state->cart.fmpac.mem[0x1fff] == 0x69); |
| 1534 | 1534 | } |
| 1535 | 1535 | |
| 1536 | 1536 | switch (addr) { |
| 1537 | case 0x7ff4: | |
| 1537 | case 0x7ff4: | |
| 1538 | 1538 | if (state->cart.fmpac.opll_active) { |
| 1539 | 1539 | YM2413_register_port_0_w (0, val); |
| 1540 | 1540 | } |
| r1461 | r1462 | |
| 1544 | 1544 | YM2413_data_port_0_w (0, val); |
| 1545 | 1545 | } |
| 1546 | 1546 | break; |
| 1547 | case 0x7ff6: | |
| 1547 | case 0x7ff6: | |
| 1548 | 1548 | data = val & 0x11; |
| 1549 | 1549 | for (i=0; i<=state->bank_mask; i++) { |
| 1550 | 1550 | state->mem[0x3ff6 + i * 0x4000] = data; |
| r1461 | r1462 | |
| 1630 | 1630 | } |
| 1631 | 1631 | |
| 1632 | 1632 | logerror ("fmpac: warning: could not open sram file for writing\n"); |
| 1633 | ||
| 1633 | ||
| 1634 | 1634 | return 1; |
| 1635 | 1635 | } |
| 1636 | 1636 | |
| r1461 | r1462 | |
| 1658 | 1658 | MSX_SLOT_MAP(superloadrunner) |
| 1659 | 1659 | { |
| 1660 | 1660 | if (page == 2) { |
| 1661 | UINT8 *mem = state->mem + | |
| 1661 | UINT8 *mem = state->mem + | |
| 1662 | 1662 | (msx1.superloadrunner_bank & state->bank_mask) * 0x4000; |
| 1663 | 1663 | |
| 1664 | 1664 | msx_cpu_setbank (5, mem); |
| r1461 | r1462 | |
| 1842 | 1842 | { |
| 1843 | 1843 | UINT8 *mem; |
| 1844 | 1844 | UINT8 mask = (msx1.korean90in1_bank & 0xc0) == 0x80 ? 0x3e : 0x3f; |
| 1845 | mem = state->mem + | |
| 1845 | mem = state->mem + | |
| 1846 | 1846 | ((msx1.korean90in1_bank & mask) & state->bank_mask) * 0x4000; |
| 1847 | 1847 | |
| 1848 | 1848 | switch (page) { |
| r1461 | r1462 | |
| 2039 | 2039 | case 2: |
| 2040 | 2040 | msx_cpu_setbank (5, state->mem + state->banks[2] * 0x2000); |
| 2041 | 2041 | msx_cpu_setbank (6, state->mem + state->banks[3] * 0x2000); |
| 2042 | memory_install_read8_handler (0, ADDRESS_SPACE_PROGRAM, 0x9800, 0x9fff, 0, 0, | |
| 2042 | memory_install_read8_handler (0, ADDRESS_SPACE_PROGRAM, 0x9800, 0x9fff, 0, 0, | |
| 2043 | 2043 | state->cart.sccp.scc_active ? soundcartridge_scc : MRA8_BANK7); |
| 2044 | memory_install_read8_handler (0, ADDRESS_SPACE_PROGRAM, 0xb800, 0xbfff, 0, 0, | |
| 2045 | state->cart.sccp.sccp_active ? soundcartridge_sccp : MRA8_BANK9); | |
| 2044 | memory_install_read8_handler (0, ADDRESS_SPACE_PROGRAM, 0xb800, 0xbfff, 0, 0, | |
| 2045 | state->cart.sccp.sccp_active ? soundcartridge_sccp : MRA8_BANK9); | |
| 2046 | 2046 | break; |
| 2047 | 2047 | case 3: |
| 2048 | 2048 | msx_cpu_setbank (7, state->mem + state->banks[0] * 0x2000); |
| r1461 | r1462 | |
| 2091 | 2091 | else if (addr >= 0x9000 && addr < 0x9800) { |
| 2092 | 2092 | state->banks[2] = val & state->bank_mask; |
| 2093 | 2093 | state->cart.sccp.banks_saved[2] = val; |
| 2094 | state->cart.sccp.scc_active = | |
| 2094 | state->cart.sccp.scc_active = | |
| 2095 | 2095 | (((val & 0x3f) == 0x3f) && !(state->cart.sccp.mode & 0x20)); |
| 2096 | 2096 | |
| 2097 | 2097 | slot_soundcartridge_map (state, 2); |
| r1461 | r1462 | |
| 2132 | 2132 | else if (addr >= 0xb000 && addr < 0xb800) { |
| 2133 | 2133 | state->cart.sccp.banks_saved[3] = val; |
| 2134 | 2134 | state->banks[3] = val & state->bank_mask; |
| 2135 | state->cart.sccp.sccp_active = | |
| 2135 | state->cart.sccp.sccp_active = | |
| 2136 | 2136 | (val & 0x80) && (state->cart.sccp.mode & 0x20); |
| 2137 | 2137 | slot_soundcartridge_map (state, 2); |
| 2138 | 2138 | if (msx1.state[0] == state) { |
| r1461 | r1462 | |
| 2186 | 2186 | |
| 2187 | 2187 | } |
| 2188 | 2188 | |
| 2189 | state->cart.sccp.scc_active = | |
| 2190 | (((state->cart.sccp.banks_saved[2] & 0x3f) == 0x3f) && | |
| 2189 | state->cart.sccp.scc_active = | |
| 2190 | (((state->cart.sccp.banks_saved[2] & 0x3f) == 0x3f) && | |
| 2191 | 2191 | !(val & 0x20)); |
| 2192 | 2192 | |
| 2193 | state->cart.sccp.sccp_active = | |
| 2193 | state->cart.sccp.sccp_active = | |
| 2194 | 2194 | ((state->cart.sccp.banks_saved[3] & 0x80) && (val & 0x20)); |
| 2195 | 2195 | |
| 2196 | 2196 | slot_soundcartridge_map (state, 2); |
| r1461 | r1462 | |
| 2206 | 2206 | MSX_SLOT (SLOT_ASCII16, ascii16) |
| 2207 | 2207 | MSX_SLOT_SRAM (SLOT_GAMEMASTER2, gmaster2) |
| 2208 | 2208 | MSX_SLOT_SRAM (SLOT_ASCII8_SRAM, ascii8_sram) |
| 2209 | MSX_SLOT_SRAM (SLOT_ASCII16_SRAM, ascii16_sram) | |
| 2209 | MSX_SLOT_SRAM (SLOT_ASCII16_SRAM, ascii16_sram) | |
| 2210 | 2210 | MSX_SLOT (SLOT_RTYPE, rtype) |
| 2211 | 2211 | MSX_SLOT (SLOT_MAJUTSUSHI, majutsushi) |
| 2212 | 2212 | MSX_SLOT_SRAM (SLOT_FMPAC, fmpac) |
| r1461 | r1462 | |
|---|---|---|
| 5 | 5 | /* TODO: |
| 6 | 6 | |
| 7 | 7 | - Scan commands |
| 8 | - Check the commands work properly using a BBC disc copier program | |
| 8 | - Check the commands work properly using a BBC disc copier program | |
| 9 | 9 | - check if 0 is specified as number of sectors, how many sectors |
| 10 | 10 | is actually transfered |
| 11 | 11 | - deleted data functions (error if data finds deleted data?) |
| r1461 | r1462 | |
| 69 | 69 | i8271_reset(); |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | ||
| 72 | ||
| 73 | 73 | static void i8271_seek_to_track(int track) |
| 74 | 74 | { |
| 75 | 75 | mess_image *img = current_image(); |
| r1461 | r1462 | |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | i8271.CurrentTrack[i8271.drive] = 0; |
| 97 | ||
| 97 | ||
| 98 | 98 | /* failed to find track 0? */ |
| 99 | 99 | if (StepCount==0) |
| 100 | 100 | { |
| r1461 | r1462 | |
| 116 | 116 | |
| 117 | 117 | /* step towards 0 */ |
| 118 | 118 | i8271.drive_control_output &= ~(1<<2); |
| 119 | ||
| 119 | ||
| 120 | 120 | if (SignedTracks>0) |
| 121 | 121 | { |
| 122 | 122 | /* step away from 0 */ |
| r1461 | r1462 | |
| 130 | 130 | i8271.CurrentTrack[i8271.drive] = track; |
| 131 | 131 | } |
| 132 | 132 | } |
| 133 | ||
| 134 | 133 | |
| 134 | ||
| 135 | 135 | static TIMER_CALLBACK(i8271_data_timer_callback) |
| 136 | 136 | { |
| 137 | 137 | /* ok, trigger data request now */ |
| 138 | 138 | i8271_data_request(); |
| 139 | 139 | |
| 140 | 140 | /* stop it */ |
| 141 | timer_reset(i8271.data_timer, attotime_never); | |
| 141 | timer_reset(i8271.data_timer, attotime_never); | |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | /* setup a timed data request - data request will be triggered in a few usecs time */ |
| r1461 | r1462 | |
| 160 | 160 | i8271_command_complete(1,1); |
| 161 | 161 | |
| 162 | 162 | /* stop it, but don't allow it to be free'd */ |
| 163 | timer_reset(i8271.command_complete_timer, attotime_never); | |
| 163 | timer_reset(i8271.command_complete_timer, attotime_never); | |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | /* setup a irq to occur 128us later - in reality this would be much later, because the int would |
| r1461 | r1462 | |
| 250 | 250 | /* &80 = drive 1 side 0 */ |
| 251 | 251 | |
| 252 | 252 | |
| 253 | ||
| 253 | ||
| 254 | 254 | if (i8271.CommandRegister & (1<<6)) |
| 255 | 255 | { |
| 256 | 256 | i8271.drive = 0; |
| r1461 | r1462 | |
| 286 | 286 | { |
| 287 | 287 | /* setup data with byte */ |
| 288 | 288 | i8271.data = i8271.pExecutionPhaseData[i8271.ExecutionPhaseCount]; |
| 289 | ||
| 289 | ||
| 290 | 290 | /* logerror("read data %02x\n", i8271.data); */ |
| 291 | 291 | |
| 292 | 292 | /* update counters */ |
| r1461 | r1462 | |
| 353 | 353 | /* read */ |
| 354 | 354 | i8271.flags |= I8271_FLAGS_DATA_DIRECTION; |
| 355 | 355 | i8271.ExecutionPhaseCount = 0; |
| 356 | i8271.ExecutionPhaseTransferCount = transfer_size; | |
| 356 | i8271.ExecutionPhaseTransferCount = transfer_size; | |
| 357 | 357 | i8271.state = I8271_STATE_EXECUTION_READ; |
| 358 | 358 | } |
| 359 | 359 | |
| r1461 | r1462 | |
| 392 | 392 | { |
| 393 | 393 | /* not busy, and not a execution phase data request in non-dma mode */ |
| 394 | 394 | i8271.StatusRegister &= ~(I8271_STATUS_COMMAND_BUSY | I8271_STATUS_NON_DMA_REQUEST); |
| 395 | ||
| 395 | ||
| 396 | 396 | if (result) |
| 397 | 397 | { |
| 398 | 398 | i8271.StatusRegister |= I8271_STATUS_RESULT_FULL; |
| r1461 | r1462 | |
| 403 | 403 | /* trigger an int */ |
| 404 | 404 | i8271_set_irq_state(1); |
| 405 | 405 | } |
| 406 | ||
| 406 | ||
| 407 | 407 | /* correct?? */ |
| 408 | 408 | i8271.drive_control_output &=~1; |
| 409 | 409 | } |
| r1461 | r1462 | |
| 444 | 444 | /* end command? */ |
| 445 | 445 | if (i8271.Counter==0) |
| 446 | 446 | { |
| 447 | ||
| 447 | ||
| 448 | 448 | i8271_timed_command_complete(); |
| 449 | 449 | return; |
| 450 | 450 | } |
| 451 | ||
| 451 | ||
| 452 | 452 | i8271_do_read(); |
| 453 | 453 | } |
| 454 | 454 | break; |
| r1461 | r1462 | |
| 467 | 467 | /* end command? */ |
| 468 | 468 | if (i8271.Counter==0) |
| 469 | 469 | { |
| 470 | ||
| 470 | ||
| 471 | 471 | i8271_timed_command_complete(); |
| 472 | 472 | return; |
| 473 | 473 | } |
| 474 | ||
| 474 | ||
| 475 | 475 | i8271_do_write(); |
| 476 | 476 | } |
| 477 | 477 | break; |
| r1461 | r1462 | |
| 502 | 502 | { |
| 503 | 503 | /* get the sector into the buffer */ |
| 504 | 504 | floppy_drive_read_sector_data(current_image(), i8271.side, i8271.data_id, i8271.pExecutionPhaseData, 1<<(i8271.ID_N+7)); |
| 505 | ||
| 505 | ||
| 506 | 506 | /* initialise for reading */ |
| 507 | 507 | i8271_initialise_execution_phase_read(1<<(i8271.ID_N+7)); |
| 508 | ||
| 508 | ||
| 509 | 509 | /* update state - gets first byte and triggers a data request */ |
| 510 | 510 | i8271_timed_data_request(); |
| 511 | 511 | return; |
| r1461 | r1462 | |
| 540 | 540 | { |
| 541 | 541 | /* initialise for reading */ |
| 542 | 542 | i8271_initialise_execution_phase_write(1<<(i8271.ID_N+7)); |
| 543 | ||
| 543 | ||
| 544 | 544 | /* update state - gets first byte and triggers a data request */ |
| 545 | 545 | i8271_timed_data_request(); |
| 546 | 546 | return; |
| r1461 | r1462 | |
| 598 | 598 | { |
| 599 | 599 | index_count++; |
| 600 | 600 | } |
| 601 | ||
| 601 | ||
| 602 | 602 | } |
| 603 | 603 | while (index_count!=2); |
| 604 | 604 | |
| 605 | 605 | /* completion type: command/drive error */ |
| 606 | 606 | /* completion code: sector not found */ |
| 607 | 607 | i8271.ResultRegister |= (3<<3); |
| 608 | ||
| 608 | ||
| 609 | 609 | return 0; |
| 610 | 610 | } |
| 611 | 611 | |
| r1461 | r1462 | |
| 754 | 754 | i8271.drive_control_input |= (1<<1); |
| 755 | 755 | } |
| 756 | 756 | |
| 757 | ||
| 757 | ||
| 758 | 758 | /* need to setup this register based on drive selected */ |
| 759 | 759 | data = i8271.drive_control_input; |
| 760 | 760 | |
| 761 | 761 | |
| 762 | ||
| 763 | 762 | |
| 763 | ||
| 764 | 764 | } |
| 765 | 765 | break; |
| 766 | 766 | |
| r1461 | r1462 | |
| 960 | 960 | |
| 961 | 961 | /* no write fault */ |
| 962 | 962 | status = 0; |
| 963 | ||
| 963 | ||
| 964 | 964 | status |= (1<<2) | (1<<6); |
| 965 | 965 | |
| 966 | 966 | /* these two do not appear to be set at all! ?? */ |
| r1461 | r1462 | |
| 973 | 973 | { |
| 974 | 974 | status |= (1<<6); |
| 975 | 975 | } |
| 976 | ||
| 976 | ||
| 977 | 977 | /* bit 3 = 1 if write protected */ |
| 978 | 978 | if (floppy_drive_get_flag_state(img, FLOPPY_DRIVE_DISK_WRITE_PROTECTED)) |
| 979 | 979 | { |
| r1461 | r1462 | |
| 1102 | 1102 | i8271_get_drive(); |
| 1103 | 1103 | |
| 1104 | 1104 | i8271.drive_control_output &=~1; |
| 1105 | ||
| 1105 | ||
| 1106 | 1106 | if (!floppy_drive_get_flag_state(img, FLOPPY_DRIVE_READY)) |
| 1107 | 1107 | { |
| 1108 | 1108 | /* Completion type: operation intervention probably required for recovery */ |
| r1461 | r1462 | |
| 1191 | 1191 | #endif |
| 1192 | 1192 | |
| 1193 | 1193 | i8271_get_drive(); |
| 1194 | ||
| 1194 | ||
| 1195 | 1195 | if (!floppy_drive_get_flag_state(img, FLOPPY_DRIVE_READY)) |
| 1196 | 1196 | { |
| 1197 | 1197 | /* Completion type: operation intervention probably required for recovery */ |
| r1461 | r1462 | |
| 1357 | 1357 | if (((data ^ i8271.ResetRegister) & 0x01)!=0) |
| 1358 | 1358 | { |
| 1359 | 1359 | if ((data & 0x01)==0) |
| 1360 | { | |
| 1360 | { | |
| 1361 | 1361 | i8271_reset(); |
| 1362 | 1362 | } |
| 1363 | 1363 | } |
| 1364 | ||
| 1364 | ||
| 1365 | 1365 | i8271.ResetRegister = data; |
| 1366 | 1366 | |
| 1367 | ||
| 1367 | ||
| 1368 | 1368 | } |
| 1369 | 1369 | break; |
| 1370 | 1370 |
| r1461 | r1462 | |
|---|---|---|
| 76 | 76 | if (t&0x20) { |
| 77 | 77 | if (PC1350_KEY_UP) data|=1; |
| 78 | 78 | if (PC1350_KEY_DOWN) data|=2; |
| 79 | if (PC1350_KEY_LEFT) data|=4; | |
| 79 | if (PC1350_KEY_LEFT) data|=4; | |
| 80 | 80 | if (PC1350_KEY_RIGHT) data|=8; |
| 81 | 81 | if (PC1350_KEY_B) data|=0x10; |
| 82 | 82 | if (PC1350_KEY_G) data|=0x20; |
| r1461 | r1462 | |
| 115 | 115 | if (PC1350_KEY_OFF&&(outa&0xc0) ) data|=0xc0; |
| 116 | 116 | |
| 117 | 117 | // missing lshift |
| 118 | ||
| 118 | ||
| 119 | 119 | return data; |
| 120 | 120 | } |
| 121 | 121 |
| r1461 | r1462 | |
|---|---|---|
| 6 | 6 | |
| 7 | 7 | Registers are separated into two banks, switchable through |
| 8 | 8 | the LSB of the MODE register. |
| 9 | ||
| 9 | ||
| 10 | 10 | Date and time are stored in BCD, one digit to each register |
| 11 | ||
| 11 | ||
| 12 | 12 | Register BANK 0 BANK 1 |
| 13 | 13 | 0 Timer seconds CLKOUT |
| 14 | 14 | 1 Timer seconds (10s) RTC Adjustment |
| r1461 | r1462 | |
| 26 | 26 | 13 MODE register MODE register |
| 27 | 27 | 14 TEST register TEST register |
| 28 | 28 | 15 RESET register RESET register |
| 29 | ||
| 30 | ||
| 29 | ||
| 30 | ||
| 31 | 31 | CLKOUT (W/O) - on the X68000, this is connected to the Timer LED |
| 32 | 32 | xxxxx000 = always high (on) |
| 33 | 33 | xxxxx001 = 16384Hz |
| r1461 | r1462 | |
| 37 | 37 | xxxxx101 = 1Hz |
| 38 | 38 | xxxxx110 = 1/60Hz |
| 39 | 39 | xxxxx111 = always low (off) |
| 40 | ||
| 40 | ||
| 41 | 41 | Adjustment register (R/W) |
| 42 | 42 | bit 0 = if set, will reset the seconds to zero, and if the |
| 43 | 43 | seconds were > 30, increment the minutes by 1. |
| 44 | 44 | Always returns 0. |
| 45 | ||
| 45 | ||
| 46 | 46 | 12/24 hour clock register (R/W) (not implemented yet) |
| 47 | 47 | bit 0 = selects 12 or 24 hour clock |
| 48 | 48 | presumably, on reading, returns AM/PM status. |
| 49 | ||
| 49 | ||
| 50 | 50 | Leap year register |
| 51 | 51 | bit 0,1 = returns number of years until next leap year. |
| 52 | 52 | Is simply year % 4. |
| 53 | ||
| 53 | ||
| 54 | 54 | MODE register (R/W) |
| 55 | 55 | bit 0 = if set, selects BANK 1, if reset, selects BANK 0 |
| 56 | 56 | bit 2 = Alarm enable |
| 57 | 57 | bit 3 = Timer enable |
| 58 | ||
| 58 | ||
| 59 | 59 | TEST register (not implemented yet) |
| 60 | 60 | bits 0-3 = generally all set to 0, use is unknown. |
| 61 | ||
| 61 | ||
| 62 | 62 | RESET register (not implemented yet) |
| 63 | 63 | bit 0 = Alarm reset |
| 64 | 64 | bit 1 = Timer reset |
| r1461 | r1462 | |
| 84 | 84 | { |
| 85 | 85 | rtc.pulse16_state = 0; // make low |
| 86 | 86 | } |
| 87 | ||
| 87 | ||
| 88 | 88 | if(rtc.pulse_count == 8) |
| 89 | 89 | { |
| 90 | 90 | rtc.pulse1_state = 0; |
| r1461 | r1462 | |
| 101 | 101 | { |
| 102 | 102 | mame_system_time systm; |
| 103 | 103 | mame_system_tm time; |
| 104 | ||
| 104 | ||
| 105 | 105 | rtc.alarm_callback = intf->alarm_irq_callback; |
| 106 | ||
| 106 | ||
| 107 | 107 | mame_get_base_datetime(Machine,&systm); |
| 108 | 108 | time = systm.local_time; |
| 109 | ||
| 109 | ||
| 110 | 110 | // date/time is stored as BCD |
| 111 | 111 | rtc.systime.sec_1 = time.second % 10; |
| 112 | 112 | rtc.systime.sec_10 = time.second / 10; |
| r1461 | r1462 | |
| 134 | 134 | rtc.reset = 0x00; // enable both 1Hz and 16Hz alarm counters by default |
| 135 | 135 | rtc.test = 0x00; |
| 136 | 136 | rtc.pulse_count = 0; |
| 137 | ||
| 137 | ||
| 138 | 138 | rtc_timer = timer_alloc(rtc_alarm_pulse, NULL); |
| 139 | 139 | timer_adjust(rtc_timer, attotime_zero, 0, ATTOTIME_IN_HZ(32)); |
| 140 | 140 | } |
| r1461 | r1462 | |
| 172 | 172 | case 12: |
| 173 | 173 | return rtc.systime.year_10; |
| 174 | 174 | case 13: |
| 175 | return rtc.mode & 0x0f; | |
| 175 | return rtc.mode & 0x0f; | |
| 176 | 176 | } |
| 177 | 177 | } |
| 178 | 178 | else // BANK 1 selected |
| 179 | 179 | { |
| 180 | 180 | switch(offset) |
| 181 | 181 | { |
| 182 | case 0: // CLKOUT | |
| 182 | case 0: // CLKOUT | |
| 183 | 183 | return rtc.clkout & 0x07; |
| 184 | 184 | case 1: // Adjustment (always returns 0) |
| 185 | 185 | return 0; |
| r1461 | r1462 | |
| 299 | 299 | case 10: // 12/24 hour clock selection |
| 300 | 300 | rtc.hour24 = data; |
| 301 | 301 | break; |
| 302 | ||
| 302 | ||
| 303 | 303 | } |
| 304 | 304 | } |
| 305 | 305 | } |
| r1461 | r1462 | |
| 345 | 345 | void rtc_add_day() |
| 346 | 346 | { |
| 347 | 347 | int d,m; |
| 348 | ||
| 348 | ||
| 349 | 349 | rtc.systime.dayofweek++; |
| 350 | 350 | if(rtc.systime.dayofweek >= 7) |
| 351 | 351 | rtc.systime.dayofweek = 0; |
| r1461 | r1462 | |
|---|---|---|
| 48 | 48 | research that for you if you want an exact number for scanlines before the |
| 49 | 49 | screen starts and the scanline that the v-interrupt triggers..etc. |
| 50 | 50 | |
| 51 | Dragon Alpha code added 21-Oct-2004, | |
| 51 | Dragon Alpha code added 21-Oct-2004, | |
| 52 | 52 | Phill Harvey-Smith (afra@aurigae.demon.co.uk) |
| 53 | 53 | |
| 54 | 54 | Added AY-8912 and FDC code 30-Oct-2004. |
| r1461 | r1462 | |
| 59 | 59 | Re-implemented Alpha NMI enable/disable, using direct PIA reads, rather than |
| 60 | 60 | keeping track of it in a variable in the driver. |
| 61 | 61 | P.Harvey-Smith, 25-Sep-2006. |
| 62 | ||
| 63 | Radically re-wrote memory emulation code for CoCo 1/2 & Dragon machines, the | |
| 64 | new code emulates the memory mapping of the SAM, dependent on what size of | |
| 62 | ||
| 63 | Radically re-wrote memory emulation code for CoCo 1/2 & Dragon machines, the | |
| 64 | new code emulates the memory mapping of the SAM, dependent on what size of | |
| 65 | 65 | RAM chips it is programed to use, including proper mirroring of the RAM. |
| 66 | 66 | |
| 67 | Replaced the kludged emulation of the cart line, with a timer based trigger | |
| 68 | this is set to toggle at 1Hz, this seems to be good enough to trigger the | |
| 69 | cartline, but is so slow in real terms that it should have very little | |
| 67 | Replaced the kludged emulation of the cart line, with a timer based trigger | |
| 68 | this is set to toggle at 1Hz, this seems to be good enough to trigger the | |
| 69 | cartline, but is so slow in real terms that it should have very little | |
| 70 | 70 | impact on the emulation speed. |
| 71 | 71 | |
| 72 | 72 | Re-factored the code common to all machines, and seperated the code different, |
| 73 | into callbacks/functions unique to the machines, in preperation for splitting | |
| 73 | into callbacks/functions unique to the machines, in preperation for splitting | |
| 74 | 74 | the code for individual machine types into seperate files, I have preposed, that |
| 75 | 75 | the CoCo 1/2 should stay in coco.c, and that the coco3 and dragon specifc code |
| 76 | should go into coco3.c and dragon.c which should (hopefully) make the code | |
| 76 | should go into coco3.c and dragon.c which should (hopefully) make the code | |
| 77 | 77 | easier to manage. |
| 78 | 78 | P.Harvey-Smith, Dec 2006-Feb 2007 |
| 79 | 79 | ***************************************************************************/ |
| r1461 | r1462 | |
| 616 | 616 | { |
| 617 | 617 | romsize = destlength; |
| 618 | 618 | } |
| 619 | ||
| 619 | ||
| 620 | 620 | image_fread(image, dest, romsize); |
| 621 | 621 | |
| 622 | 622 | /* Now we need to repeat the mirror the ROM throughout the ROM memory */ |
| r1461 | r1462 | |
| 1144 | 1144 | } |
| 1145 | 1145 | } |
| 1146 | 1146 | |
| 1147 | /* | |
| 1148 | Dragon Alpha AY-3-8912 | |
| 1147 | /* | |
| 1148 | Dragon Alpha AY-3-8912 | |
| 1149 | 1149 | */ |
| 1150 | 1150 | |
| 1151 | 1151 | READ8_HANDLER ( dgnalpha_psg_porta_read ) |
| 1152 | { | |
| 1152 | { | |
| 1153 | 1153 | return 0; |
| 1154 | 1154 | } |
| 1155 | 1155 | |
| r1461 | r1462 | |
| 1157 | 1157 | { |
| 1158 | 1158 | /* Bits 0..3 are the drive select lines for the internal floppy interface */ |
| 1159 | 1159 | /* Bit 4 is the motor on, in the real hardware these are inverted on their way to the drive */ |
| 1160 | /* Bits 5,6,7 are connected to /DDEN, ENP and 5/8 on the WD2797 */ | |
| 1160 | /* Bits 5,6,7 are connected to /DDEN, ENP and 5/8 on the WD2797 */ | |
| 1161 | 1161 | switch (data & 0xF) |
| 1162 | 1162 | { |
| 1163 | 1163 | case(0x01) : |
| r1461 | r1462 | |
| 1255 | 1255 | if ((input_port_4_r(0) | pia_get_port_b_z_mask(0)) != 0xff) port_za &= ~0x10; |
| 1256 | 1256 | if ((input_port_5_r(0) | pia_get_port_b_z_mask(0)) != 0xff) port_za &= ~0x20; |
| 1257 | 1257 | if ((input_port_6_r(0) | pia_get_port_b_z_mask(0)) != 0xff) port_za &= ~0x40; |
| 1258 | ||
| 1258 | ||
| 1259 | 1259 | switch(get_input_device(joystick ? INPUTPORT_LEFT_JOYSTICK : INPUTPORT_RIGHT_JOYSTICK)) |
| 1260 | 1260 | { |
| 1261 | 1261 | case INPUTDEVICE_RIGHT_JOYSTICK: |
| r1461 | r1462 | |
| 1298 | 1298 | /* While in state 7, prepare to chech next video frame for a hit */ |
| 1299 | 1299 | dclg_time = video_screen_get_time_until_pos(0, readinputportbytag_safe("dclg_y", 0), 0); |
| 1300 | 1300 | } |
| 1301 | ||
| 1301 | ||
| 1302 | 1302 | break; |
| 1303 | 1303 | |
| 1304 | 1304 | default: |
| 1305 | 1305 | fatalerror("Invalid value returned by get_input_device"); |
| 1306 | 1306 | break; |
| 1307 | 1307 | } |
| 1308 | ||
| 1308 | ||
| 1309 | 1309 | if( attotime_compare(dclg_time, attotime_zero) ) |
| 1310 | 1310 | { |
| 1311 | 1311 | /* schedule lightgun events */ |
| r1461 | r1462 | |
| 1324 | 1324 | /* sample joystick buttons */ |
| 1325 | 1325 | porta &= ~readinputportbytag_safe("joystick_buttons", 0); |
| 1326 | 1326 | port_za &= ~readinputportbytag_safe("joystick_buttons", 0); |
| 1327 | ||
| 1327 | ||
| 1328 | 1328 | pia_set_input_a(0, porta, port_za); |
| 1329 | 1329 | return porta; |
| 1330 | 1330 | } |
| r1461 | r1462 | |
| 1410 | 1410 | */ |
| 1411 | 1411 | UINT8 dac = pia_get_output_a(1) & 0xFC; |
| 1412 | 1412 | static int dclg_previous_bit; |
| 1413 | ||
| 1413 | ||
| 1414 | 1414 | coco_sound_update(); |
| 1415 | 1415 | |
| 1416 | 1416 | if (get_input_device(INPUTPORT_SERIAL) == INPUTDEVICE_DIECOM_LIGHTGUN) |
| 1417 | 1417 | { |
| 1418 | 1418 | int dclg_this_bit = ((data & 2) >> 1); |
| 1419 | ||
| 1419 | ||
| 1420 | 1420 | if( dclg_previous_bit == 1 ) |
| 1421 | 1421 | { |
| 1422 | 1422 | if( dclg_this_bit == 0 ) |
| r1461 | r1462 | |
| 1424 | 1424 | /* Clock Diecom Light gun interface on a high to low transistion */ |
| 1425 | 1425 | dclg_state++; |
| 1426 | 1426 | dclg_state &= 0x0f; |
| 1427 | ||
| 1427 | ||
| 1428 | 1428 | /* Clear hit bit for every transistion */ |
| 1429 | dclg_output_h &= ~0x02; | |
| 1429 | dclg_output_h &= ~0x02; | |
| 1430 | 1430 | |
| 1431 | 1431 | if( dclg_state > 7 ) |
| 1432 | 1432 | { |
| r1461 | r1462 | |
| 1435 | 1435 | dclg_output_v |= 0x01; |
| 1436 | 1436 | else |
| 1437 | 1437 | dclg_output_v &= ~0x01; |
| 1438 | ||
| 1438 | ||
| 1439 | 1439 | /* Bit 9 of timer is only avaiable if state == 8*/ |
| 1440 | 1440 | if (dclg_state == 8 && (((dclg_timer >> 9) & 0x01) == 1) ) |
| 1441 | 1441 | dclg_output_v |= 0x02; |
| 1442 | 1442 | else |
| 1443 | 1443 | dclg_output_v &= ~0x02; |
| 1444 | 1444 | } |
| 1445 | ||
| 1445 | ||
| 1446 | 1446 | /* During state 15, this bit is high. */ |
| 1447 | 1447 | if( dclg_state == 15 ) |
| 1448 | 1448 | dclg_output_h |= 0x01; |
| r1461 | r1462 | |
| 1465 | 1465 | coco_hiresjoy_w(dac >= 0x80); |
| 1466 | 1466 | |
| 1467 | 1467 | /* Handle printer output, serial for CoCos, Paralell for Dragons */ |
| 1468 | ||
| 1468 | ||
| 1469 | 1469 | printer_out(data); |
| 1470 | 1470 | } |
| 1471 | 1471 | |
| r1461 | r1462 | |
| 1493 | 1493 | static WRITE8_HANDLER( dragon64_pia1_pb_w ) |
| 1494 | 1494 | { |
| 1495 | 1495 | int ddr; |
| 1496 | ||
| 1496 | ||
| 1497 | 1497 | d_pia1_pb_w(0, data); |
| 1498 | 1498 | |
| 1499 | 1499 | ddr = ~pia_get_port_b_z_mask(1); |
| 1500 | ||
| 1500 | ||
| 1501 | 1501 | /* If bit 2 of the pia1 ddrb is 1 then this pin is an output so use it */ |
| 1502 | 1502 | /* to control the paging of the 32k and 64k basic roms */ |
| 1503 | 1503 | /* Otherwise it set as an input, with an EXTERNAL pull-up so it should */ |
| r1461 | r1462 | |
| 1505 | 1505 | if (ddr & 0x04) |
| 1506 | 1506 | { |
| 1507 | 1507 | dragon_page_rom(data & 0x04); |
| 1508 | } | |
| 1508 | } | |
| 1509 | 1509 | } |
| 1510 | 1510 | |
| 1511 | 1511 | /*************************************************************************** |
| r1461 | r1462 | |
| 1518 | 1518 | PIA2 PB0-PB7 connected to D0..7 of the AY8912. |
| 1519 | 1519 | CB1 DRQ from WD2797 disk controler. |
| 1520 | 1520 | ***************************************************************************/ |
| 1521 | ||
| 1521 | ||
| 1522 | 1522 | static WRITE8_HANDLER( dgnalpha_pia2_pa_w ) |
| 1523 | 1523 | { |
| 1524 | 1524 | int bc_flags; /* BCDDIR/BC1, as connected to PIA2 port a bits 0 and 1 */ |
| r1461 | r1462 | |
| 1531 | 1531 | { |
| 1532 | 1532 | dragon_page_rom(data & 0x04); /* bit 2 controls boot or basic rom */ |
| 1533 | 1533 | } |
| 1534 | ||
| 1534 | ||
| 1535 | 1535 | /* Bits 0 and 1 for pia2 port a control the BCDIR and BC1 lines of the */ |
| 1536 | 1536 | /* AY-8912 */ |
| 1537 | 1537 | bc_flags = data & 0x03; /* mask out bits */ |
| 1538 | ||
| 1538 | ||
| 1539 | 1539 | switch (bc_flags) |
| 1540 | 1540 | { |
| 1541 | 1541 | case 0x00 : /* Inactive, do nothing */ |
| 1542 | break; | |
| 1542 | break; | |
| 1543 | 1543 | case 0x01 : /* Write to selected port */ |
| 1544 | 1544 | AY8910_write_port_0_w(0, pia_get_output_b(2)); |
| 1545 | 1545 | break; |
| r1461 | r1462 | |
| 1558 | 1558 | static void dragon_page_rom(int romswitch) |
| 1559 | 1559 | { |
| 1560 | 1560 | UINT8 *bank; |
| 1561 | ||
| 1562 | if (romswitch) | |
| 1561 | ||
| 1562 | if (romswitch) | |
| 1563 | 1563 | bank = coco_rom; /* This is the 32k mode basic(64)/boot rom(alpha) */ |
| 1564 | 1564 | else |
| 1565 | 1565 | bank = coco_rom + 0x8000; /* This is the 64k mode basic(64)/basic rom(alpha) */ |
| 1566 | ||
| 1566 | ||
| 1567 | 1567 | bas_rom_bank = bank; /* Record which rom we are using so that the irq routine */ |
| 1568 | 1568 | /* uses the vectors from the correct rom ! (alpha) */ |
| 1569 | 1569 | |
| r1461 | r1462 | |
| 1579 | 1579 | /* The NMI line on the alphaAlpha is gated through IC16 (early PLD), and is gated by pia2 CA2 */ |
| 1580 | 1580 | /* The DRQ line goes through pia2 cb1, in exactly the same way as DRQ from DragonDos does */ |
| 1581 | 1581 | /* for pia1 cb1 */ |
| 1582 | switch(event) | |
| 1582 | switch(event) | |
| 1583 | 1583 | { |
| 1584 | 1584 | case WD17XX_IRQ_CLR: |
| 1585 | 1585 | cpunum_set_input_line(0, INPUT_LINE_NMI, CLEAR_LINE); |
| r1461 | r1462 | |
| 1591 | 1591 | } |
| 1592 | 1592 | else |
| 1593 | 1593 | { |
| 1594 | if (pia_get_output_ca2(2)) | |
| 1594 | if (pia_get_output_ca2(2)) | |
| 1595 | 1595 | cpunum_set_input_line(0, INPUT_LINE_NMI, ASSERT_LINE); |
| 1596 | 1596 | } |
| 1597 | 1597 | break; |
| r1461 | r1462 | |
| 1609 | 1609 | { |
| 1610 | 1610 | int result = 0; |
| 1611 | 1611 | |
| 1612 | switch(offset & 0x03) | |
| 1612 | switch(offset & 0x03) | |
| 1613 | 1613 | { |
| 1614 | 1614 | case 0: |
| 1615 | 1615 | result = wd17xx_data_r(0); |
| r1461 | r1462 | |
| 1626 | 1626 | default: |
| 1627 | 1627 | break; |
| 1628 | 1628 | } |
| 1629 | ||
| 1629 | ||
| 1630 | 1630 | return result; |
| 1631 | 1631 | } |
| 1632 | 1632 | |
| 1633 | 1633 | WRITE8_HANDLER(wd2797_w) |
| 1634 | 1634 | { |
| 1635 | switch(offset & 0x3) | |
| 1635 | switch(offset & 0x3) | |
| 1636 | 1636 | { |
| 1637 | 1637 | case 0: |
| 1638 | 1638 | wd17xx_data_w(0, data); |
| r1461 | r1462 | |
| 1677 | 1677 | * and serial-in (pb0). Serial-in not yet implemented. */ |
| 1678 | 1678 | int result; |
| 1679 | 1679 | |
| 1680 | /* For the CoCo 1, the logic has been changed to only select 64K rams | |
| 1681 | if there is more than 16K of memory, as the Color Basic 1.0 rom | |
| 1682 | can only configure 4K or 16K ram banks (as documented in "Color | |
| 1683 | Basic Unreveled"), doing this allows this allows the coco driver | |
| 1684 | to access 32K of ram, and also allows the cocoe driver to access | |
| 1685 | the full 64K, as this uses Color Basic 1.2, which can configure 64K rams */ | |
| 1680 | /* For the CoCo 1, the logic has been changed to only select 64K rams | |
| 1681 | if there is more than 16K of memory, as the Color Basic 1.0 rom | |
| 1682 | can only configure 4K or 16K ram banks (as documented in "Color | |
| 1683 | Basic Unreveled"), doing this allows this allows the coco driver | |
| 1684 | to access 32K of ram, and also allows the cocoe driver to access | |
| 1685 | the full 64K, as this uses Color Basic 1.2, which can configure 64K rams */ | |
| 1686 | 1686 | |
| 1687 | 1687 | if (mess_ram_size > 0x8000) /* 1 bank of 64K rams */ |
| 1688 | 1688 | result = (pia_get_output_b(0) & 0x80) >> 5; |
| r1461 | r1462 | |
| 1696 | 1696 | |
| 1697 | 1697 | static READ8_HANDLER ( d_pia1_pb_r_dragon32 ) |
| 1698 | 1698 | { |
| 1699 | /* This handles the reading of the memory sense switch (pb2) for the Dragon 32, | |
| 1699 | /* This handles the reading of the memory sense switch (pb2) for the Dragon 32, | |
| 1700 | 1700 | * and pb0, is the printer /busy line. */ |
| 1701 | ||
| 1701 | ||
| 1702 | 1702 | int result; |
| 1703 | 1703 | |
| 1704 | /* Of the Dragon machines, Only the Dragon 32 needs the ram select bit | |
| 1705 | as both the 64 and Alpha, always have 64K rams, also the meaning of | |
| 1704 | /* Of the Dragon machines, Only the Dragon 32 needs the ram select bit | |
| 1705 | as both the 64 and Alpha, always have 64K rams, also the meaning of | |
| 1706 | 1706 | the bit is different with respect to the CoCo 1 */ |
| 1707 | ||
| 1707 | ||
| 1708 | 1708 | if (mess_ram_size > 0x8000) |
| 1709 | 1709 | result = 0x00; /* 1 bank of 64K, rams */ |
| 1710 | 1710 | else |
| 1711 | 1711 | result = 0x04; /* 2 banks of 16K rams */ |
| 1712 | ||
| 1712 | ||
| 1713 | 1713 | return result; |
| 1714 | 1714 | } |
| 1715 | 1715 | |
| r1461 | r1462 | |
| 1740 | 1740 | return 0; |
| 1741 | 1741 | } |
| 1742 | 1742 | |
| 1743 | /* | |
| 1743 | /* | |
| 1744 | 1744 | When writing the bits have the following meanings : |
| 1745 | 1745 | |
| 1746 | 1746 | bit value purpose |
| 1747 | 0 0 First 2k of memory map determined by bits 1 & 2 | |
| 1748 | 1 6845 display RAM mapped into first 2K of map, | |
| 1749 | ||
| 1747 | 0 0 First 2k of memory map determined by bits 1 & 2 | |
| 1748 | 1 6845 display RAM mapped into first 2K of map, | |
| 1749 | ||
| 1750 | 1750 | 2,1 0,0 Normal bottom 32K or ram mapped (from mainboard). |
| 1751 | 1751 | 0,1 First 32K of plus RAM mapped into $0000-$7FFF |
| 1752 | 1752 | 1,0 Second 32K of plus RAM mapped into $0000-$7FFF |
| r1461 | r1462 | |
| 1756 | 1756 | WRITE8_HANDLER ( plus_reg_w ) |
| 1757 | 1757 | { |
| 1758 | 1758 | int map; |
| 1759 | ||
| 1759 | ||
| 1760 | 1760 | dragon_plus_reg = data; |
| 1761 | ||
| 1761 | ||
| 1762 | 1762 | map = (data & 0x06)>>1; |
| 1763 | ||
| 1763 | ||
| 1764 | 1764 | switch (map) |
| 1765 | 1765 | { |
| 1766 | 1766 | case 0x00 : bottom_32k=&mess_ram[0x00000]; break; |
| 1767 | 1767 | case 0x01 : bottom_32k=&mess_ram[0x10000]; break; |
| 1768 | 1768 | case 0x02 : bottom_32k=&mess_ram[0x18000]; break; |
| 1769 | 1769 | case 0x03 : bottom_32k=&mess_ram[0x00000]; break; |
| 1770 | default : bottom_32k=&mess_ram[0x00000]; break; // Just to shut the compiler up ! | |
| 1771 | } | |
| 1772 | ||
| 1770 | default : bottom_32k=&mess_ram[0x00000]; break; // Just to shut the compiler up ! | |
| 1771 | } | |
| 1772 | ||
| 1773 | 1773 | setup_memory_map(); |
| 1774 | 1774 | } |
| 1775 | 1775 | |
| r1461 | r1462 | |
| 1813 | 1813 | |
| 1814 | 1814 | static void setup_memory_map(void) |
| 1815 | 1815 | { |
| 1816 | /* | |
| 1817 | The following table contains the RAM block mappings for the CoCo 1/2 and Dragon computers | |
| 1818 | This replicates the behavior of the SAM ram size programming bits which in ther real hardware | |
| 1816 | /* | |
| 1817 | The following table contains the RAM block mappings for the CoCo 1/2 and Dragon computers | |
| 1818 | This replicates the behavior of the SAM ram size programming bits which in ther real hardware | |
| 1819 | 1819 | allowed the use of various sizes of RAM chips, as follows :- |
| 1820 | 1820 | |
| 1821 | 1821 | 1 or 2 banks of 4K |
| r1461 | r1462 | |
| 1825 | 1825 | |
| 1826 | 1826 | For the 4K and 16K chip sizes, if the second bank was empty it would be mapped to nothing. |
| 1827 | 1827 | For the 4K and 16K chip sizes, the banks would be mirrored at chip size*2 intervals. |
| 1828 | ||
| 1828 | ||
| 1829 | 1829 | The following table holds the data required to implement this. |
| 1830 | 1830 | |
| 1831 | Note though it is technically possible to have 2 banks of 4K rams, for a total of 8K, I | |
| 1831 | Note though it is technically possible to have 2 banks of 4K rams, for a total of 8K, I | |
| 1832 | 1832 | have never seen a machine with this configuration, so I have not implemented it. |
| 1833 | 1833 | */ |
| 1834 | ||
| 1835 | struct coco_meminfo | |
| 1834 | ||
| 1835 | struct coco_meminfo | |
| 1836 | 1836 | { |
| 1837 | 1837 | offs_t start; /* start address of bank */ |
| 1838 | 1838 | offs_t end; /* End address of bank */ |
| r1461 | r1462 | |
| 1876 | 1876 | last_ram_block=15; |
| 1877 | 1877 | else |
| 1878 | 1878 | last_ram_block=7; |
| 1879 | ||
| 1879 | ||
| 1880 | 1880 | /* Map RAM blocks */ |
| 1881 | 1881 | for(block_index=0;block_index<=last_ram_block;block_index++) |
| 1882 | 1882 | { |
| r1461 | r1462 | |
| 1887 | 1887 | wbank=memmap[block_index].wbank16_1; |
| 1888 | 1888 | else if ((memsize==1) && (mess_ram_size == 0x8000)) /* two banks of 16K rams */ |
| 1889 | 1889 | wbank=memmap[block_index].wbank16_2; |
| 1890 | else | |
| 1890 | else | |
| 1891 | 1891 | wbank=memmap[block_index].wbank64; |
| 1892 | 1892 | |
| 1893 | 1893 | /* If wbank is 0 then there is no ram here so set it up to return 0, note this may change in the future */ |
| r1461 | r1462 | |
| 1900 | 1900 | memory_set_bankptr(block_index+1,&bottom_32k[memmap[wbank-1].start]); |
| 1901 | 1901 | else |
| 1902 | 1902 | memory_set_bankptr(block_index+1,&mess_ram[memmap[wbank-1].start]); |
| 1903 | ||
| 1904 | memory_install_read_handler(0, ADDRESS_SPACE_PROGRAM, memmap[block_index].start, memmap[block_index].end, 0, 0, block_index+1); | |
| 1903 | ||
| 1904 | memory_install_read_handler(0, ADDRESS_SPACE_PROGRAM, memmap[block_index].start, memmap[block_index].end, 0, 0, block_index+1); | |
| 1905 | 1905 | memory_install_write_handler(0, ADDRESS_SPACE_PROGRAM, memmap[block_index].start, memmap[block_index].end, 0, 0, block_index+1); |
| 1906 | 1906 | } |
| 1907 | 1907 | else |
| 1908 | { | |
| 1909 | memory_install_read_handler(0, ADDRESS_SPACE_PROGRAM, memmap[block_index].start, memmap[block_index].end, 0, 0, STATIC_NOP); | |
| 1910 | memory_install_write_handler(0, ADDRESS_SPACE_PROGRAM, memmap[block_index].start, memmap[block_index].end, 0, 0, STATIC_NOP); | |
| 1908 | { | |
| 1909 | memory_install_read_handler(0, ADDRESS_SPACE_PROGRAM, memmap[block_index].start, memmap[block_index].end, 0, 0, STATIC_NOP); | |
| 1910 | memory_install_write_handler(0, ADDRESS_SPACE_PROGRAM, memmap[block_index].start, memmap[block_index].end, 0, 0, STATIC_NOP); | |
| 1911 | 1911 | } |
| 1912 | 1912 | } |
| 1913 | 1913 | |
| r1461 | r1462 | |
| 1923 | 1923 | offset=&bas_rom_bank[0x1000*block_index]; |
| 1924 | 1924 | else |
| 1925 | 1925 | offset=&coco_rom[0x4000+(0x1000*(block_index-4))]; |
| 1926 | ||
| 1926 | ||
| 1927 | 1927 | memory_set_bankptr(block_index+9,offset); |
| 1928 | 1928 | memory_install_write_handler(0, ADDRESS_SPACE_PROGRAM, memmap[block_index+8].start, memmap[block_index+8].end, 0, 0, STATIC_ROM); |
| 1929 | 1929 | } |
| r1461 | r1462 | |
| 1939 | 1939 | * TODO: Actually implement this. Also find out what the CoCo 3 did with |
| 1940 | 1940 | * this (it probably ignored it) |
| 1941 | 1941 | */ |
| 1942 | ||
| 1942 | ||
| 1943 | 1943 | if (!get_sam_maptype()) // Ignored in maptype 1 |
| 1944 | 1944 | { |
| 1945 | 1945 | if((mess_ram_size>0x8000) && val) |
| r1461 | r1462 | |
| 1976 | 1976 | * TODO: This should affect _all_ memory accesses, not just video ram |
| 1977 | 1977 | * TODO: Verify that the CoCo 3 ignored this |
| 1978 | 1978 | */ |
| 1979 | ||
| 1979 | ||
| 1980 | 1980 | setup_memory_map(); |
| 1981 | 1981 | } |
| 1982 | 1982 | |
| r1461 | r1462 | |
| 2726 | 2726 | |
| 2727 | 2727 | /***************************************************************************/ |
| 2728 | 2728 | |
| 2729 | /* struct to hold callbacks and initializers to pass to generic_init_machine */ | |
| 2729 | /* struct to hold callbacks and initializers to pass to generic_init_machine */ | |
| 2730 | 2730 | typedef struct _machine_init_interface machine_init_interface; |
| 2731 | 2731 | struct _machine_init_interface |
| 2732 | 2732 | { |
| r1461 | r1462 | |
| 2764 | 2764 | |
| 2765 | 2765 | /* this timer is used to schedule keyboard updating */ |
| 2766 | 2766 | update_keyboard_timer = timer_alloc(coco_update_keyboard_timerproc, NULL); |
| 2767 | ||
| 2767 | ||
| 2768 | 2768 | /* these are the timers to delay the MUX switching */ |
| 2769 | 2769 | mux_sel1_timer = timer_alloc(coco_update_sel1_timerproc, NULL); |
| 2770 | 2770 | mux_sel2_timer = timer_alloc(coco_update_sel2_timerproc, NULL); |
| r1461 | r1462 | |
| 2780 | 2780 | |
| 2781 | 2781 | /* setup printer output callback */ |
| 2782 | 2782 | printer_out = init->printer_out_; |
| 2783 | ||
| 2783 | ||
| 2784 | 2784 | pia_config(0, &init->piaintf[0]); |
| 2785 | 2785 | pia_config(1, &init->piaintf[1]); |
| 2786 | 2786 | pia_config(2, &init->piaintf[2]); /* Dragon Alpha 3rd pia */ |
| r1461 | r1462 | |
| 2829 | 2829 | /* Setup for hardware common to CoCo 1/2 & Dragon machines, calls genertic_init_machine, to process */ |
| 2830 | 2830 | /* the setup common with the CoCo3, and then does the init that is not common ! */ |
| 2831 | 2831 | static void generic_coco12_dragon_init(running_machine *machine, const machine_init_interface *init) |
| 2832 | { | |
| 2832 | { | |
| 2833 | 2833 | /* Set default RAM mapping */ |
| 2834 | 2834 | memory_set_bankptr(1, &mess_ram[0]); |
| 2835 | ||
| 2835 | ||
| 2836 | 2836 | /* Do generic Inits */ |
| 2837 | 2837 | generic_init_machine(machine, init); |
| 2838 | ||
| 2838 | ||
| 2839 | 2839 | /* Init SAM */ |
| 2840 | 2840 | sam_init(machine, &coco_sam_intf); |
| 2841 | 2841 | } |
| r1461 | r1462 | |
| 2845 | 2845 | MACHINE_START( dragon32 ) |
| 2846 | 2846 | { |
| 2847 | 2847 | machine_init_interface init; |
| 2848 | ||
| 2848 | ||
| 2849 | 2849 | /* Setup machine initialization */ |
| 2850 | 2850 | memset(&init, 0, sizeof(init)); |
| 2851 | 2851 | init.piaintf = dragon32_pia_intf; |
| r1461 | r1462 | |
| 2854 | 2854 | init.cart_timer_proc = coco_cart_timer_proc; |
| 2855 | 2855 | init.map_memory = coco_mapmemory; |
| 2856 | 2856 | init.fdc_cart_hardware = "dragon_fdc"; |
| 2857 | ||
| 2857 | ||
| 2858 | 2858 | generic_coco12_dragon_init(machine, &init); |
| 2859 | 2859 | } |
| 2860 | 2860 | |
| 2861 | 2861 | MACHINE_START( dragon64 ) |
| 2862 | 2862 | { |
| 2863 | 2863 | machine_init_interface init; |
| 2864 | ||
| 2864 | ||
| 2865 | 2865 | /* Setup machine initialization */ |
| 2866 | 2866 | memset(&init, 0, sizeof(init)); |
| 2867 | 2867 | init.piaintf = dragon64_pia_intf; |
| r1461 | r1462 | |
| 2870 | 2870 | init.cart_timer_proc = coco_cart_timer_proc; |
| 2871 | 2871 | init.map_memory = coco_mapmemory; |
| 2872 | 2872 | init.fdc_cart_hardware = "dragon_fdc"; |
| 2873 | ||
| 2873 | ||
| 2874 | 2874 | generic_coco12_dragon_init(machine, &init); |
| 2875 | 2875 | |
| 2876 | 2876 | /* Init Serial port */ |
| r1461 | r1462 | |
| 2881 | 2881 | MACHINE_START( d64plus ) |
| 2882 | 2882 | { |
| 2883 | 2883 | machine_init_interface init; |
| 2884 | ||
| 2884 | ||
| 2885 | 2885 | /* Setup machine initialization */ |
| 2886 | 2886 | memset(&init, 0, sizeof(init)); |
| 2887 | 2887 | init.piaintf = dragon64_pia_intf; |
| r1461 | r1462 | |
| 2890 | 2890 | init.cart_timer_proc = coco_cart_timer_proc; |
| 2891 | 2891 | init.map_memory = coco_mapmemory; |
| 2892 | 2892 | init.fdc_cart_hardware = "dragon_fdc"; |
| 2893 | ||
| 2893 | ||
| 2894 | 2894 | generic_coco12_dragon_init(machine, &init); |
| 2895 | ||
| 2895 | ||
| 2896 | 2896 | /* Init Serial port */ |
| 2897 | 2897 | acia_6551_init(); |
| 2898 | ||
| 2898 | ||
| 2899 | 2899 | /* Init Dragon plus registers */ |
| 2900 | 2900 | dragon_plus_reg = 0; |
| 2901 | 2901 | plus_reg_w(0,0); |
| r1461 | r1462 | |
| 2905 | 2905 | MACHINE_START( tanodr64 ) |
| 2906 | 2906 | { |
| 2907 | 2907 | machine_init_interface init; |
| 2908 | ||
| 2908 | ||
| 2909 | 2909 | /* Setup machine initialization */ |
| 2910 | 2910 | memset(&init, 0, sizeof(init)); |
| 2911 | 2911 | init.piaintf = dragon64_pia_intf; |
| r1461 | r1462 | |
| 2914 | 2914 | init.cart_timer_proc = coco_cart_timer_proc; |
| 2915 | 2915 | init.map_memory = coco_mapmemory; |
| 2916 | 2916 | init.fdc_cart_hardware = "coco_fdc"; |
| 2917 | ||
| 2917 | ||
| 2918 | 2918 | generic_coco12_dragon_init(machine, &init); |
| 2919 | ||
| 2919 | ||
| 2920 | 2920 | /* Init Serial port */ |
| 2921 | 2921 | acia_6551_init(); |
| 2922 | 2922 | } |
| r1461 | r1462 | |
| 2924 | 2924 | MACHINE_START( dgnalpha ) |
| 2925 | 2925 | { |
| 2926 | 2926 | machine_init_interface init; |
| 2927 | ||
| 2927 | ||
| 2928 | 2928 | /* Setup machine initialization */ |
| 2929 | 2929 | memset(&init, 0, sizeof(init)); |
| 2930 | 2930 | init.piaintf = dgnalpha_pia_intf; |
| r1461 | r1462 | |
| 2933 | 2933 | init.cart_timer_proc = coco_cart_timer_proc; |
| 2934 | 2934 | init.map_memory = coco_mapmemory; |
| 2935 | 2935 | init.fdc_cart_hardware = "dragon_fdc"; |
| 2936 | ||
| 2936 | ||
| 2937 | 2937 | generic_coco12_dragon_init(machine, &init); |
| 2938 | ||
| 2938 | ||
| 2939 | 2939 | /* Init Serial port */ |
| 2940 | 2940 | acia_6551_init(); |
| 2941 | ||
| 2941 | ||
| 2942 | 2942 | /* dgnalpha_just_reset, is here to flag that we should ignore the first irq generated */ |
| 2943 | 2943 | /* by the WD2797, it is reset to 0 after the first inurrupt */ |
| 2944 | 2944 | dgnalpha_just_reset=1; |
| 2945 | ||
| 2945 | ||
| 2946 | 2946 | wd17xx_init(WD_TYPE_179X, dgnalpha_fdc_callback, NULL); |
| 2947 | 2947 | } |
| 2948 | 2948 | |
| r1461 | r1462 | |
| 2951 | 2951 | MACHINE_START( coco ) |
| 2952 | 2952 | { |
| 2953 | 2953 | machine_init_interface init; |
| 2954 | ||
| 2954 | ||
| 2955 | 2955 | /* Setup machine initialization */ |
| 2956 | 2956 | memset(&init, 0, sizeof(init)); |
| 2957 | 2957 | init.piaintf = coco_pia_intf; |
| r1461 | r1462 | |
| 2960 | 2960 | init.cart_timer_proc = coco_cart_timer_proc; |
| 2961 | 2961 | init.map_memory = coco_mapmemory; |
| 2962 | 2962 | init.fdc_cart_hardware = "coco_fdc"; |
| 2963 | ||
| 2963 | ||
| 2964 | 2964 | generic_coco12_dragon_init(machine, &init); |
| 2965 | 2965 | } |
| 2966 | 2966 | |
| 2967 | 2967 | MACHINE_START( coco2 ) |
| 2968 | 2968 | { |
| 2969 | 2969 | machine_init_interface init; |
| 2970 | ||
| 2970 | ||
| 2971 | 2971 | /* Setup machine initialization */ |
| 2972 | 2972 | memset(&init, 0, sizeof(init)); |
| 2973 | 2973 | init.piaintf = coco2_pia_intf; |
| r1461 | r1462 | |
| 2976 | 2976 | init.cart_timer_proc = coco_cart_timer_proc; |
| 2977 | 2977 | init.map_memory = coco_mapmemory; |
| 2978 | 2978 | init.fdc_cart_hardware = "coco_fdc"; |
| 2979 | ||
| 2979 | ||
| 2980 | 2980 | generic_coco12_dragon_init(machine, &init); |
| 2981 | 2981 | } |
| 2982 | 2982 | |
| r1461 | r1462 | |
| 3009 | 3009 | MACHINE_START( coco3 ) |
| 3010 | 3010 | { |
| 3011 | 3011 | machine_init_interface init; |
| 3012 | ||
| 3012 | ||
| 3013 | 3013 | /* Setup machine initialization */ |
| 3014 | 3014 | memset(&init, 0, sizeof(init)); |
| 3015 | 3015 | init.piaintf = coco3_pia_intf; |
| r1461 | r1462 | |
| 3018 | 3018 | init.cart_timer_proc = coco3_cart_timer_proc; |
| 3019 | 3019 | init.map_memory = coco3_mapmemory; |
| 3020 | 3020 | init.fdc_cart_hardware = "coco3_plus_fdc"; |
| 3021 | ||
| 3021 | ||
| 3022 | 3022 | generic_init_machine(machine, &init); |
| 3023 | ||
| 3023 | ||
| 3024 | 3024 | /* Init SAM */ |
| 3025 | 3025 | sam_init(machine, &coco3_sam_intf); |
| 3026 | ||
| 3026 | ||
| 3027 | 3027 | /* CoCo 3 specific function pointers */ |
| 3028 | 3028 | update_keyboard = coco3_update_keyboard; |
| 3029 | 3029 | |
| 3030 | 3030 | coco3_timer_init(); |
| 3031 | 3031 | |
| 3032 | 3032 | coco3_interupt_line = 0; |
| 3033 | ||
| 3033 | ||
| 3034 | 3034 | /* set up state save variables */ |
| 3035 | 3035 | state_save_register_global_array(coco3_mmu); |
| 3036 | 3036 | state_save_register_global_array(coco3_gimereg); |
| r1461 | r1462 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | 3 | Amiga cdrom controller emulation |
| 4 | ||
| 4 | ||
| 5 | 5 | Notes: |
| 6 | 6 | Many thanks to Toni Willem for all the help and information about the |
| 7 | 7 | DMAC controller. |
| r1461 | r1462 | |
| 32 | 32 | /*************************************************************************** |
| 33 | 33 | |
| 34 | 34 | DMAC |
| 35 | ||
| 35 | ||
| 36 | 36 | ***************************************************************************/ |
| 37 | 37 | |
| 38 | 38 | /* |
| r1461 | r1462 | |
| 79 | 79 | /* if interrupts are disabled, bail */ |
| 80 | 80 | if ( (dmac_data.cntr & CNTR_INTEN) == 0 ) |
| 81 | 81 | return; |
| 82 | ||
| 82 | ||
| 83 | 83 | /* if no interrupts are pending, bail */ |
| 84 | 84 | if ( (dmac_data.istr & ISTR_INT_P) == 0 ) |
| 85 | 85 | return; |
| 86 | ||
| 86 | ||
| 87 | 87 | /* otherwise, generate the IRQ */ |
| 88 | 88 | amiga_custom_w(REG_INTREQ, 0x8000 | INTENA_PORTS, 0); |
| 89 | 89 | } |
| r1461 | r1462 | |
| 94 | 94 | { |
| 95 | 95 | UINT16 dat16; |
| 96 | 96 | UINT8 dat8; |
| 97 | ||
| 97 | ||
| 98 | 98 | if ( matsucd_get_next_byte( &dat8 ) < 0 ) |
| 99 | 99 | break; |
| 100 | ||
| 100 | ||
| 101 | 101 | dat16 = dat8; |
| 102 | ||
| 102 | ||
| 103 | 103 | if ( matsucd_get_next_byte( &dat8 ) < 0 ) |
| 104 | 104 | break; |
| 105 | ||
| 105 | ||
| 106 | 106 | dat16 <<= 8; |
| 107 | 107 | dat16 |= dat8; |
| 108 | ||
| 108 | ||
| 109 | 109 | amiga_chip_ram_w(dmac_data.acr, dat16); |
| 110 | ||
| 110 | ||
| 111 | 111 | dmac_data.acr += 2; |
| 112 | 112 | dmac_data.wtc--; |
| 113 | 113 | } |
| 114 | ||
| 114 | ||
| 115 | 115 | if ( dmac_data.wtc > 0 ) |
| 116 | 116 | { |
| 117 | 117 | matsucd_read_next_block(); |
| r1461 | r1462 | |
| 134 | 134 | { |
| 135 | 135 | UINT8 v = dmac_data.istr; |
| 136 | 136 | LOG( "DMAC: PC=%08x - ISTR Read(%04x)\n", activecpu_get_pc(), dmac_data.istr ); |
| 137 | ||
| 137 | ||
| 138 | 138 | dmac_data.istr &= ~0x0f; |
| 139 | 139 | return v; |
| 140 | 140 | } |
| 141 | 141 | break; |
| 142 | ||
| 142 | ||
| 143 | 143 | case 0x21: |
| 144 | 144 | { |
| 145 | 145 | LOG( "DMAC: PC=%08x - CNTR Read(%04x)\n", activecpu_get_pc(), dmac_data.cntr ); |
| 146 | 146 | return dmac_data.cntr; |
| 147 | 147 | } |
| 148 | 148 | break; |
| 149 | ||
| 149 | ||
| 150 | 150 | case 0x40: /* wtc hi */ |
| 151 | 151 | { |
| 152 | 152 | LOG( "DMAC: PC=%08x - WTC HI Read\n", activecpu_get_pc() ); |
| 153 | 153 | return (dmac_data.wtc >> 16); |
| 154 | 154 | } |
| 155 | 155 | break; |
| 156 | ||
| 156 | ||
| 157 | 157 | case 0x41: /* wtc lo */ |
| 158 | 158 | { |
| 159 | 159 | LOG( "DMAC: PC=%08x - WTC LO Read\n", activecpu_get_pc() ); |
| 160 | 160 | return dmac_data.wtc; |
| 161 | 161 | } |
| 162 | 162 | break; |
| 163 | ||
| 163 | ||
| 164 | 164 | case 0x42: /* acr hi */ |
| 165 | 165 | { |
| 166 | 166 | LOG( "DMAC: PC=%08x - ACR HI Read\n", activecpu_get_pc() ); |
| 167 | 167 | return (dmac_data.acr >> 16); |
| 168 | 168 | } |
| 169 | 169 | break; |
| 170 | ||
| 170 | ||
| 171 | 171 | case 0x43: /* acr lo */ |
| 172 | 172 | { |
| 173 | 173 | LOG( "DMAC: PC=%08x - ACR LO Read\n", activecpu_get_pc() ); |
| r1461 | r1462 | |
| 182 | 182 | return 0x00; /* Not available without SCSI expansion */ |
| 183 | 183 | } |
| 184 | 184 | break; |
| 185 | ||
| 185 | ||
| 186 | 186 | case 0x50: |
| 187 | 187 | { |
| 188 | 188 | LOG( "DMAC: PC=%08x - CDROM RESP Read\n", activecpu_get_pc() ); |
| 189 | 189 | return matsucd_response_r(); |
| 190 | 190 | } |
| 191 | 191 | break; |
| 192 | ||
| 192 | ||
| 193 | 193 | case 0x51: /* XT IO */ |
| 194 | 194 | case 0x52: |
| 195 | 195 | case 0x53: |
| r1461 | r1462 | |
| 198 | 198 | return 0xff; |
| 199 | 199 | } |
| 200 | 200 | break; |
| 201 | ||
| 201 | ||
| 202 | 202 | case 0x58: /* TPI6525 */ |
| 203 | 203 | case 0x59: |
| 204 | 204 | case 0x5A: |
| r1461 | r1462 | |
| 220 | 220 | return tpi6525_0_port_r(offset - 0x58); |
| 221 | 221 | } |
| 222 | 222 | break; |
| 223 | ||
| 223 | ||
| 224 | 224 | case 0x70: /* DMA start strobe */ |
| 225 | 225 | { |
| 226 | 226 | LOG( "DMAC: PC=%08x - DMA Start Strobe\n", activecpu_get_pc() ); |
| 227 | 227 | timer_adjust( dmac_data.dma_timer, ATTOTIME_IN_MSEC( CD_SECTOR_TIME ), 0, attotime_zero ); |
| 228 | 228 | } |
| 229 | 229 | break; |
| 230 | ||
| 230 | ||
| 231 | 231 | case 0x71: /* DMA stop strobe */ |
| 232 | 232 | { |
| 233 | 233 | LOG( "DMAC: PC=%08x - DMA Stop Strobe\n", activecpu_get_pc() ); |
| 234 | 234 | timer_reset( dmac_data.dma_timer, attotime_never ); |
| 235 | 235 | } |
| 236 | 236 | break; |
| 237 | ||
| 237 | ||
| 238 | 238 | case 0x72: /* Clear IRQ strobe */ |
| 239 | 239 | { |
| 240 | 240 | LOG( "DMAC: PC=%08x - IRQ Clear Strobe\n", activecpu_get_pc() ); |
| 241 | 241 | dmac_data.istr &= ~ISTR_INT_P; |
| 242 | 242 | } |
| 243 | 243 | break; |
| 244 | ||
| 244 | ||
| 245 | 245 | case 0x74: /* Flush strobe */ |
| 246 | 246 | { |
| 247 | 247 | LOG( "DMAC: PC=%08x - Flush Strobe\n", activecpu_get_pc() ); |
| 248 | 248 | dmac_data.istr |= ISTR_FE_FLG; |
| 249 | 249 | } |
| 250 | 250 | break; |
| 251 | ||
| 251 | ||
| 252 | 252 | default: |
| 253 | 253 | logerror( "DMAC-READ: PC=%08x, offset = %02x\n", activecpu_get_pc(), offset ); |
| 254 | 254 | break; |
| 255 | 255 | } |
| 256 | ||
| 256 | ||
| 257 | 257 | return 0; |
| 258 | 258 | } |
| 259 | 259 | |
| r1461 | r1462 | |
| 270 | 270 | check_interrupts(); |
| 271 | 271 | } |
| 272 | 272 | break; |
| 273 | ||
| 273 | ||
| 274 | 274 | case 0x40: /* wtc hi */ |
| 275 | 275 | { |
| 276 | 276 | LOG( "DMAC: PC=%08x - WTC HI Write - data = %04x\n", activecpu_get_pc(), data ); |
| r1461 | r1462 | |
| 278 | 278 | dmac_data.wtc |= ((UINT32)data) << 16; |
| 279 | 279 | } |
| 280 | 280 | break; |
| 281 | ||
| 281 | ||
| 282 | 282 | case 0x41: /* wtc lo */ |
| 283 | 283 | { |
| 284 | 284 | LOG( "DMAC: PC=%08x - WTC LO Write - data = %04x\n", activecpu_get_pc(), data ); |
| r1461 | r1462 | |
| 286 | 286 | dmac_data.wtc |= data; |
| 287 | 287 | } |
| 288 | 288 | break; |
| 289 | ||
| 289 | ||
| 290 | 290 | case 0x42: /* acr hi */ |
| 291 | 291 | { |
| 292 | 292 | LOG( "DMAC: PC=%08x - ACR HI Write - data = %04x\n", activecpu_get_pc(), data ); |
| r1461 | r1462 | |
| 294 | 294 | dmac_data.acr |= ((UINT32)data) << 16; |
| 295 | 295 | } |
| 296 | 296 | break; |
| 297 | ||
| 297 | ||
| 298 | 298 | case 0x43: /* acr lo */ |
| 299 | 299 | { |
| 300 | 300 | LOG( "DMAC: PC=%08x - ACR LO Write - data = %04x\n", activecpu_get_pc(), data ); |
| r1461 | r1462 | |
| 302 | 302 | dmac_data.acr |= data; |
| 303 | 303 | } |
| 304 | 304 | break; |
| 305 | ||
| 305 | ||
| 306 | 306 | case 0x47: /* dawr */ |
| 307 | 307 | { |
| 308 | 308 | LOG( "DMAC: PC=%08x - DAWR Write - data = %04x\n", activecpu_get_pc(), data ); |
| 309 | 309 | dmac_data.dawr = data; |
| 310 | 310 | } |
| 311 | 311 | break; |
| 312 | ||
| 312 | ||
| 313 | 313 | case 0x48: /* wd33c93 SCSI expansion */ |
| 314 | 314 | case 0x49: |
| 315 | 315 | { |
| r1461 | r1462 | |
| 317 | 317 | /* Not available without SCSI expansion */ |
| 318 | 318 | } |
| 319 | 319 | break; |
| 320 | ||
| 320 | ||
| 321 | 321 | case 0x50: |
| 322 | 322 | { |
| 323 | 323 | LOG( "DMAC: PC=%08x - CDROM CMD Write - data = %04x\n", activecpu_get_pc(), data ); |
| 324 | 324 | matsucd_command_w( data ); |
| 325 | 325 | } |
| 326 | 326 | break; |
| 327 | ||
| 327 | ||
| 328 | 328 | case 0x58: /* TPI6525 */ |
| 329 | 329 | case 0x59: |
| 330 | 330 | case 0x5A: |
| r1461 | r1462 | |
| 346 | 346 | tpi6525_0_port_w(offset - 0x58, data); |
| 347 | 347 | } |
| 348 | 348 | break; |
| 349 | ||
| 349 | ||
| 350 | 350 | case 0x70: /* DMA start strobe */ |
| 351 | 351 | { |
| 352 | 352 | LOG( "DMAC: PC=%08x - DMA Start Strobe\n", activecpu_get_pc() ); |
| 353 | 353 | timer_adjust( dmac_data.dma_timer, ATTOTIME_IN_MSEC( CD_SECTOR_TIME ), 0, attotime_zero ); |
| 354 | 354 | } |
| 355 | 355 | break; |
| 356 | ||
| 356 | ||
| 357 | 357 | case 0x71: /* DMA stop strobe */ |
| 358 | 358 | { |
| 359 | 359 | LOG( "DMAC: PC=%08x - DMA Stop Strobe\n", activecpu_get_pc() ); |
| 360 | 360 | timer_reset( dmac_data.dma_timer, attotime_never ); |
| 361 | 361 | } |
| 362 | 362 | break; |
| 363 | ||
| 363 | ||
| 364 | 364 | case 0x72: /* Clear IRQ strobe */ |
| 365 | 365 | { |
| 366 | 366 | LOG( "DMAC: PC=%08x - IRQ Clear Strobe\n", activecpu_get_pc() ); |
| 367 | 367 | dmac_data.istr &= ~ISTR_INT_P; |
| 368 | 368 | } |
| 369 | 369 | break; |
| 370 | ||
| 370 | ||
| 371 | 371 | case 0x74: /* Flush Strobe */ |
| 372 | 372 | { |
| 373 | 373 | LOG( "DMAC: PC=%08x - Flush Strobe\n", activecpu_get_pc() ); |
| 374 | 374 | dmac_data.istr |= ISTR_FE_FLG; |
| 375 | 375 | } |
| 376 | 376 | break; |
| 377 | ||
| 377 | ||
| 378 | 378 | default: |
| 379 | 379 | logerror( "DMAC-WRITE: PC=%08x, offset = %02x, data = %04x\n", activecpu_get_pc(), offset, data ); |
| 380 | 380 | break; |
| r1461 | r1462 | |
| 384 | 384 | /*************************************************************************** |
| 385 | 385 | |
| 386 | 386 | Autoconfig |
| 387 | ||
| 387 | ||
| 388 | 388 | ***************************************************************************/ |
| 389 | 389 | |
| 390 | 390 | static void dmac_install(offs_t base) |
| r1461 | r1462 | |
| 420 | 420 | /*************************************************************************** |
| 421 | 421 | |
| 422 | 422 | TPI6525 |
| 423 | ||
| 423 | ||
| 424 | 424 | ***************************************************************************/ |
| 425 | 425 | |
| 426 | 426 | static int tp6525_portc_r( void ) |
| 427 | 427 | { |
| 428 | 428 | int ret = 0; |
| 429 | ||
| 429 | ||
| 430 | 430 | if ( (tpi6525[0].c.ddr & 0x04) == 0 ) /* if pin 2 is set to input */ |
| 431 | 431 | { |
| 432 | 432 | ret |= matsucd_stch_r() ? 0x00 : 0x04; /* read status change signal */ |
| 433 | 433 | } |
| 434 | ||
| 434 | ||
| 435 | 435 | if ( (tpi6525[0].c.ddr & 0x08) == 0 ) /* if pin 3 is set to input */ |
| 436 | 436 | ret |= matsucd_sten_r() ? 0x08 : 0x00; /* read enable signal */ |
| 437 | ||
| 437 | ||
| 438 | 438 | return ret; |
| 439 | 439 | } |
| 440 | 440 | |
| r1461 | r1462 | |
| 442 | 442 | { |
| 443 | 443 | if ( tpi6525[0].b.ddr & 0x01 ) /* if pin 0 is set to output */ |
| 444 | 444 | matsucd_cmd_w( data & 1 ); /* write to the /CMD signal */ |
| 445 | ||
| 445 | ||
| 446 | 446 | if ( tpi6525[0].b.ddr & 0x02 ) /* if pin 1 is set to output */ |
| 447 | 447 | matsucd_enable_w( data & 2 ); /* write to the /ENABLE signal */ |
| 448 | 448 | } |
| r1461 | r1462 | |
| 452 | 452 | static TIMER_CALLBACK(tp6525_delayed_irq) |
| 453 | 453 | { |
| 454 | 454 | (void)param; |
| 455 | ||
| 455 | ||
| 456 | 456 | if ( (CUSTOM_REG(REG_INTREQ) & INTENA_PORTS) == 0 ) |
| 457 | 457 | { |
| 458 | 458 | amiga_custom_w(REG_INTREQ, 0x8000 | INTENA_PORTS, 0); |
| r1461 | r1462 | |
| 466 | 466 | static void tp6525_irq( int level ) |
| 467 | 467 | { |
| 468 | 468 | LOG( "TPI6525 Interrupt: level = %d\n", level); |
| 469 | ||
| 469 | ||
| 470 | 470 | if ( level ) |
| 471 | 471 | { |
| 472 | 472 | if ( (CUSTOM_REG(REG_INTREQ) & INTENA_PORTS) == 0 ) |
| r1461 | r1462 | |
| 491 | 491 | { |
| 492 | 492 | /* invert */ |
| 493 | 493 | level = level ? 0 : 1; |
| 494 | ||
| 494 | ||
| 495 | 495 | /* PC2 on the 6525 */ |
| 496 | 496 | tpi6525_0_irq2_level( level ); |
| 497 | 497 | } |
| r1461 | r1462 | |
| 506 | 506 | { |
| 507 | 507 | /* initialize the dmac */ |
| 508 | 508 | memset( &dmac_data, 0, sizeof( dmac_data ) ); |
| 509 | ||
| 509 | ||
| 510 | 510 | dmac_data.dma_timer = timer_alloc(dmac_dma_proc, NULL); |
| 511 | 511 | tp6525_delayed_timer = timer_alloc(tp6525_delayed_irq, NULL); |
| 512 | ||
| 512 | ||
| 513 | 513 | /* initialize the 6525 TPI */ |
| 514 | 514 | tpi6525_0_reset(); |
| 515 | ||
| 515 | ||
| 516 | 516 | tpi6525[0].a.read = NULL; |
| 517 | 517 | tpi6525[0].b.read = NULL; |
| 518 | 518 | tpi6525[0].c.read = tp6525_portc_r; |
| 519 | ||
| 519 | ||
| 520 | 520 | tpi6525[0].a.output = NULL; |
| 521 | 521 | tpi6525[0].b.output = tp6525_portb_w; |
| 522 | 522 | tpi6525[0].c.output = NULL; |
| 523 | ||
| 523 | ||
| 524 | 524 | tpi6525[0].interrupt.output = tp6525_irq; |
| 525 | 525 | tpi6525[0].ca.output = NULL; |
| 526 | 526 | tpi6525[0].cb.output = NULL; |
| 527 | ||
| 527 | ||
| 528 | 528 | /* initialize the cdrom */ |
| 529 | 529 | matsucd_init(); |
| 530 | 530 | matsucd_set_status_enabled_callback( cdrom_status_enabled ); |
| 531 | 531 | matsucd_set_status_changed_callback( cdrom_status_change ); |
| 532 | 532 | matsucd_set_subcode_ready_callback( cdrom_subcode_ready ); |
| 533 | ||
| 533 | ||
| 534 | 534 | /* set up DMAC with autoconfig */ |
| 535 | 535 | amiga_add_autoconfig( &dmac_device ); |
| 536 | 536 | } |
| r1461 | r1462 | |
|---|---|---|
| 314 | 314 | vals->i0 = 0; |
| 315 | 315 | vals->i1 = 0; |
| 316 | 316 | vals->i2 = 0; |
| 317 | ||
| 317 | ||
| 318 | 318 | switch(cfg & 0x0f) |
| 319 | 319 | { |
| 320 | 320 | case 0x01: /* gamepad */ |
| r1461 | r1462 | |
|---|---|---|
| 6 | 6 | |
| 7 | 7 | The MC6854 chip is an Advanced Data-Link Controller (ADLC). |
| 8 | 8 | It provides a high-level network interface that can transimit frames with |
| 9 | arbitrary data and address length, and is compatible with the following | |
| 9 | arbitrary data and address length, and is compatible with the following | |
| 10 | 10 | standards: |
| 11 | 11 | - ADCCP (Advanced Data Communication Control Procedure) |
| 12 | 12 | - HDLC (High-Level Data-Link Control) |
| 13 | 13 | - SDLC (Synchronous Data-Link Control) |
| 14 | 14 | It is designed to be interfaced with a M6800-family CPU. |
| 15 | 15 | |
| 16 | It is used in the "Nano-network" extension of the Thomson computers to | |
| 16 | It is used in the "Nano-network" extension of the Thomson computers to | |
| 17 | 17 | link up to 32 computers at 500 Kbps. |
| 18 | 18 | Many networks involving one PC server and several MO5 or TO7/70 computers |
| 19 | 19 | were build in French schools in the 1980's to teach computer science. |
| r1461 | r1462 | |
| 46 | 46 | #define MAX_FRAME_LENGTH 65536 |
| 47 | 47 | /* arbitrary value, you may need to enlarge it if you get truncated frames */ |
| 48 | 48 | |
| 49 | #define FIFO_SIZE 3 | |
| 49 | #define FIFO_SIZE 3 | |
| 50 | 50 | /* hardcoded size of the 6854 FIFO (this is a hardware limit) */ |
| 51 | 51 | |
| 52 | 52 | #define FLAG 0x7e |
| r1461 | r1462 | |
| 59 | 59 | /******************* internal chip data structure ******************/ |
| 60 | 60 | |
| 61 | 61 | |
| 62 | static struct | |
| 62 | static struct | |
| 63 | 63 | { |
| 64 | 64 | |
| 65 | 65 | /* interface */ |
| r1461 | r1462 | |
| 231 | 231 | { |
| 232 | 232 | attotime expire; |
| 233 | 233 | int i; |
| 234 | if ( zi ) | |
| 234 | if ( zi ) | |
| 235 | 235 | { |
| 236 | 236 | /* zero-insertion mode */ |
| 237 | 237 | UINT32 d = 0; |
| 238 | 238 | int l = 0; |
| 239 | 239 | for ( i = 0; i < len; i++, data >>= 1, l++ ) |
| 240 | 240 | { |
| 241 | if ( data & 1 ) | |
| 241 | if ( data & 1 ) | |
| 242 | 242 | { |
| 243 | 243 | d |= 1 << l; |
| 244 | 244 | mc6854->tones++; |
| 245 | if ( mc6854->tones == 5 ) | |
| 245 | if ( mc6854->tones == 5 ) | |
| 246 | 246 | { |
| 247 | 247 | /* insert a '0' after 5 consecutive '1" */ |
| 248 | 248 | mc6854->tones = 0; |
| 249 | l++; | |
| 249 | l++; | |
| 250 | 250 | } |
| 251 | 251 | } |
| 252 | else | |
| 252 | else | |
| 253 | 253 | mc6854->tones = 0; |
| 254 | 254 | } |
| 255 | 255 | data = d; |
| 256 | 256 | len = l; |
| 257 | 257 | } |
| 258 | else | |
| 258 | else | |
| 259 | 259 | mc6854->tones = 0; |
| 260 | 260 | |
| 261 | 261 | /* send bits */ |
| 262 | if ( mc6854->iface->out_tx ) | |
| 262 | if ( mc6854->iface->out_tx ) | |
| 263 | 263 | { |
| 264 | 264 | for ( i = 0; i < len; i++, data >>= 1 ) |
| 265 | 265 | mc6854->iface->out_tx( data & 1 ); |
| r1461 | r1462 | |
| 267 | 267 | |
| 268 | 268 | /* schedule when to ask the MC6854 for more bits */ |
| 269 | 269 | expire = timer_timeleft( mc6854->ttimer ); |
| 270 | if ( ! attotime_compare( expire, attotime_never ) ) | |
| 270 | if ( ! attotime_compare( expire, attotime_never ) ) | |
| 271 | 271 | expire = attotime_zero; |
| 272 | 272 | timer_reset( mc6854->ttimer, attotime_add(expire, attotime_mul(BIT_LENGTH, len)) ); |
| 273 | 273 | } |
| r1461 | r1462 | |
| 279 | 279 | { |
| 280 | 280 | int i; |
| 281 | 281 | |
| 282 | if ( TRESET ) | |
| 282 | if ( TRESET ) | |
| 283 | 283 | return; |
| 284 | 284 | |
| 285 | 285 | /* push towards the rightmost free entry */ |
| r1461 | r1462 | |
| 289 | 289 | break; |
| 290 | 290 | } |
| 291 | 291 | |
| 292 | if ( i >= 0 ) | |
| 292 | if ( i >= 0 ) | |
| 293 | 293 | mc6854->tfifo[ i ] = data | 0x100; |
| 294 | else | |
| 294 | else | |
| 295 | 295 | logerror( "%f mc6854_tfifo_push: FIFO overrun\n", attotime_to_double(timer_get_time()) ); |
| 296 | 296 | |
| 297 | 297 | /* start frame, if needed */ |
| 298 | if ( ! mc6854->tstate ) | |
| 298 | if ( ! mc6854->tstate ) | |
| 299 | 299 | { |
| 300 | 300 | LOG(( "%f mc6854_tfifo_push: start frame\n", attotime_to_double(timer_get_time()) )); |
| 301 | 301 | mc6854->tstate = 2; |
| r1461 | r1462 | |
| 312 | 312 | int i; |
| 313 | 313 | for ( i = 0; i < FIFO_SIZE; i++ ) |
| 314 | 314 | { |
| 315 | if ( mc6854->tfifo[ i ] & 0x100 ) | |
| 315 | if ( mc6854->tfifo[ i ] & 0x100 ) | |
| 316 | 316 | { |
| 317 | 317 | mc6854->tfifo[ i ] |= 0x200; |
| 318 | 318 | break; |
| r1461 | r1462 | |
| 327 | 327 | { |
| 328 | 328 | int i, data = mc6854->tfifo[ FIFO_SIZE - 1 ]; |
| 329 | 329 | |
| 330 | if ( ! mc6854->tstate ) | |
| 330 | if ( ! mc6854->tstate ) | |
| 331 | 331 | return; |
| 332 | 332 | |
| 333 | 333 | /* shift FIFO to the right */ |
| r1461 | r1462 | |
| 335 | 335 | mc6854->tfifo[ i ] = mc6854->tfifo[ i - 1 ]; |
| 336 | 336 | mc6854->tfifo[ 0 ] = 0; |
| 337 | 337 | |
| 338 | if ( data & 0x100 ) | |
| 338 | if ( data & 0x100 ) | |
| 339 | 339 | { |
| 340 | 340 | /* got data */ |
| 341 | 341 | |
| 342 | 342 | int blen = 8; |
| 343 | 343 | |
| 344 | switch ( mc6854->tstate ) | |
| 344 | switch ( mc6854->tstate ) | |
| 345 | 345 | { |
| 346 | 346 | |
| 347 | 347 | case 2: /* 8-bit address field */ |
| 348 | if ( ( data & 1 ) || ( ! AEX ) ) | |
| 348 | if ( ( data & 1 ) || ( ! AEX ) ) | |
| 349 | 349 | mc6854->tstate = 3; |
| 350 | 350 | LOG(( "%f mc6854_tfifo_cb: address field $%02X\n", attotime_to_double(timer_get_time()), data & 0xff )); |
| 351 | 351 | break; |
| 352 | 352 | |
| 353 | 353 | case 3: /* 8-bit control field */ |
| 354 | if ( CEX ) | |
| 355 | mc6854->tstate = 4; | |
| 356 | else if ( LCF ) | |
| 357 | mc6854->tstate = 5; | |
| 358 | else | |
| 354 | if ( CEX ) | |
| 355 | mc6854->tstate = 4; | |
| 356 | else if ( LCF ) | |
| 357 | mc6854->tstate = 5; | |
| 358 | else | |
| 359 | 359 | mc6854->tstate = 6; |
| 360 | 360 | LOG(( "%f mc6854_tfifo_cb: control field $%02X\n", attotime_to_double(timer_get_time()), data & 0xff )); |
| 361 | 361 | break; |
| 362 | ||
| 362 | ||
| 363 | 363 | case 4: /* 8-bit extended control field (optional) */ |
| 364 | if ( LCF ) | |
| 365 | mc6854->tstate = 5; | |
| 366 | else | |
| 364 | if ( LCF ) | |
| 365 | mc6854->tstate = 5; | |
| 366 | else | |
| 367 | 367 | mc6854->tstate = 6; |
| 368 | 368 | LOG(( "%f mc6854_tfifo_cb: control field $%02X\n", attotime_to_double(timer_get_time()), data & 0xff )); |
| 369 | 369 | break; |
| 370 | ||
| 370 | ||
| 371 | 371 | case 5: /* 8-bit logical control (optional) */ |
| 372 | if ( ! ( data & 0x80 ) ) | |
| 372 | if ( ! ( data & 0x80 ) ) | |
| 373 | 373 | mc6854->tstate = 6; |
| 374 | 374 | LOG(( "%f mc6854_tfifo_cb: logical control field $%02X\n", attotime_to_double(timer_get_time()), data & 0xff )); |
| 375 | 375 | break; |
| 376 | ||
| 376 | ||
| 377 | 377 | case 6: /* variable-length data */ |
| 378 | blen = TWL; | |
| 378 | blen = TWL; | |
| 379 | 379 | LOG(( "%f mc6854_tfifo_cb: data field $%02X, %i bits\n", attotime_to_double(timer_get_time()), data & 0xff, blen )); |
| 380 | 380 | break; |
| 381 | 381 | |
| r1461 | r1462 | |
| 385 | 385 | |
| 386 | 386 | if ( mc6854->flen < MAX_FRAME_LENGTH ) |
| 387 | 387 | mc6854->frame[ mc6854->flen++ ] = data; |
| 388 | else | |
| 388 | else | |
| 389 | 389 | logerror( "mc6854_tfifo_cb: truncated frame, max=%i\n", MAX_FRAME_LENGTH ); |
| 390 | 390 | |
| 391 | 391 | mc6854_send_bits( data, blen, 1 ); |
| 392 | 392 | } |
| 393 | else | |
| 393 | else | |
| 394 | 394 | { |
| 395 | 395 | /* data underrun => abort */ |
| 396 | 396 | logerror( "%f mc6854_tfifo_cb: FIFO underrun\n", attotime_to_double(timer_get_time()) ); |
| r1461 | r1462 | |
| 401 | 401 | } |
| 402 | 402 | |
| 403 | 403 | /* close frame, if needed */ |
| 404 | if ( data & 0x200 ) | |
| 404 | if ( data & 0x200 ) | |
| 405 | 405 | { |
| 406 | 406 | int len = mc6854->flen; |
| 407 | 407 | |
| 408 | 408 | LOG(( "%f mc6854_tfifo_cb: end frame\n", attotime_to_double(timer_get_time()) )); |
| 409 | 409 | mc6854_send_bits( 0xdeadbeef, 16, 1 ); /* send check-sum: TODO */ |
| 410 | 410 | mc6854_send_bits( FLAG, 8, 0 ); /* send closing flag */ |
| 411 | ||
| 412 | if ( mc6854->tfifo[ FIFO_SIZE - 1 ] & 0x100 ) | |
| 411 | ||
| 412 | if ( mc6854->tfifo[ FIFO_SIZE - 1 ] & 0x100 ) | |
| 413 | 413 | { |
| 414 | 414 | /* re-open frame asap */ |
| 415 | 415 | LOG(( "%f mc6854_tfifo_cb: start frame\n", attotime_to_double(timer_get_time()) )); |
| 416 | if ( TWOINTER ) | |
| 416 | if ( TWOINTER ) | |
| 417 | 417 | mc6854_send_bits( FLAG, 8, 0 ); |
| 418 | 418 | } |
| 419 | else | |
| 419 | else | |
| 420 | 420 | mc6854->tstate = 0; |
| 421 | 421 | |
| 422 | 422 | mc6854->flen = 0; |
| r1461 | r1462 | |
| 447 | 447 | int i, blen = 8; |
| 448 | 448 | unsigned data = d; |
| 449 | 449 | |
| 450 | switch ( mc6854->rstate ) | |
| 450 | switch ( mc6854->rstate ) | |
| 451 | 451 | { |
| 452 | 452 | |
| 453 | 453 | case 0: |
| 454 | 454 | case 1: |
| 455 | 455 | case 2: /* 8-bit address field */ |
| 456 | if ( ( data & 1 ) || ( ! AEX ) ) | |
| 456 | if ( ( data & 1 ) || ( ! AEX ) ) | |
| 457 | 457 | mc6854->rstate = 3; |
| 458 | else | |
| 458 | else | |
| 459 | 459 | mc6854->rstate = 2; |
| 460 | 460 | LOG(( "%f mc6854_rfifo_push: address field $%02X\n", attotime_to_double(timer_get_time()), data )); |
| 461 | 461 | data |= 0x400; /* address marker */ |
| 462 | 462 | break; |
| 463 | 463 | |
| 464 | 464 | case 3: /* 8-bit control field */ |
| 465 | if ( CEX ) | |
| 466 | mc6854->rstate = 4; | |
| 467 | else if ( LCF ) | |
| 468 | mc6854->rstate = 5; | |
| 469 | else | |
| 465 | if ( CEX ) | |
| 466 | mc6854->rstate = 4; | |
| 467 | else if ( LCF ) | |
| 468 | mc6854->rstate = 5; | |
| 469 | else | |
| 470 | 470 | mc6854->rstate = 6; |
| 471 | 471 | LOG(( "%f mc6854_rfifo_push: control field $%02X\n", attotime_to_double(timer_get_time()), data )); |
| 472 | 472 | break; |
| 473 | ||
| 473 | ||
| 474 | 474 | case 4: /* 8-bit extended control field (optional) */ |
| 475 | if ( LCF ) | |
| 476 | mc6854->rstate = 5; | |
| 477 | else | |
| 475 | if ( LCF ) | |
| 476 | mc6854->rstate = 5; | |
| 477 | else | |
| 478 | 478 | mc6854->rstate = 6; |
| 479 | 479 | LOG(( "%f mc6854_rfifo_push: control field $%02X\n", attotime_to_double(timer_get_time()), data )); |
| 480 | 480 | break; |
| 481 | ||
| 481 | ||
| 482 | 482 | case 5: /* 8-bit logical control (optional) */ |
| 483 | if ( ! ( data & 0x80 ) ) | |
| 483 | if ( ! ( data & 0x80 ) ) | |
| 484 | 484 | mc6854->rstate = 6; |
| 485 | 485 | LOG(( "%f mc6854_rfifo_push: logical control field $%02X\n", attotime_to_double(timer_get_time()), data )); |
| 486 | 486 | break; |
| 487 | ||
| 487 | ||
| 488 | 488 | case 6: /* variable-length data */ |
| 489 | blen = RWL; | |
| 489 | blen = RWL; | |
| 490 | 490 | data >>= 8 - blen; |
| 491 | 491 | LOG(( "%f mc6854_rfifo_push: data field $%02X, %i bits\n", attotime_to_double(timer_get_time()), data, blen )); |
| 492 | 492 | break; |
| 493 | 493 | } |
| 494 | 494 | |
| 495 | 495 | /* no further FIFO fill until FV is cleared! */ |
| 496 | if ( mc6854->sr2 & FV ) | |
| 496 | if ( mc6854->sr2 & FV ) | |
| 497 | 497 | { |
| 498 | 498 | LOG(( "%f mc6854_rfifo_push: field not pushed\n", attotime_to_double(timer_get_time()) )); |
| 499 | 499 | return; |
| 500 | 500 | } |
| 501 | 501 | |
| 502 | 502 | data |= 0x100; /* entry full marker */ |
| 503 | ||
| 503 | ||
| 504 | 504 | /* push towards the rightmost free entry */ |
| 505 | 505 | for ( i = FIFO_SIZE - 1; i >= 0; i-- ) |
| 506 | 506 | { |
| 507 | if ( ! ( mc6854->rfifo[ i ] & 0x100 ) ) | |
| 507 | if ( ! ( mc6854->rfifo[ i ] & 0x100 ) ) | |
| 508 | 508 | break; |
| 509 | 509 | } |
| 510 | 510 | |
| 511 | if ( i >= 0 ) | |
| 511 | if ( i >= 0 ) | |
| 512 | 512 | mc6854->rfifo[ i ] = data | 0x100; |
| 513 | else | |
| 513 | else | |
| 514 | 514 | { |
| 515 | 515 | /* FIFO full */ |
| 516 | 516 | mc6854->sr2 |= OVRN; |
| r1461 | r1462 | |
| 529 | 529 | int i; |
| 530 | 530 | for ( i = 0; i < FIFO_SIZE; i++ ) |
| 531 | 531 | { |
| 532 | if ( mc6854->rfifo[ i ] & 0x100 ) | |
| 532 | if ( mc6854->rfifo[ i ] & 0x100 ) | |
| 533 | 533 | { |
| 534 | 534 | mc6854->tfifo[ i ] |= 0x200; |
| 535 | 535 | break; |
| r1461 | r1462 | |
| 553 | 553 | mc6854->rfifo[ i ] = mc6854->rfifo[ i - 1 ]; |
| 554 | 554 | mc6854->rfifo[ 0 ] = 0; |
| 555 | 555 | |
| 556 | if ( mc6854->rfifo[ FIFO_SIZE - 1 ] & 0x200 ) | |
| 556 | if ( mc6854->rfifo[ FIFO_SIZE - 1 ] & 0x200 ) | |
| 557 | 557 | { |
| 558 | 558 | /* last byte in frame */ |
| 559 | 559 | mc6854->sr2 |= FV; /* TODO: check CRC & set ERR instead of FV if error*/ |
| 560 | 560 | } |
| 561 | 561 | |
| 562 | 562 | /* auto-refill in frame mode */ |
| 563 | if ( mc6854->flen > 0 ) | |
| 563 | if ( mc6854->flen > 0 ) | |
| 564 | 564 | { |
| 565 | 565 | mc6854_rfifo_push( mc6854->frame[ mc6854->fpos++ ] ); |
| 566 | if ( mc6854->fpos == mc6854->flen ) | |
| 566 | if ( mc6854->fpos == mc6854->flen ) | |
| 567 | 567 | mc6854_rfifo_terminate(); |
| 568 | 568 | } |
| 569 | 569 | |
| r1461 | r1462 | |
| 576 | 576 | { |
| 577 | 577 | int fieldlen = ( mc6854->rstate < 6 ) ? 8 : RWL; |
| 578 | 578 | |
| 579 | if ( RRESET || DCD ) | |
| 579 | if ( RRESET || DCD ) | |
| 580 | 580 | return; |
| 581 | 581 | |
| 582 | if ( bit ) | |
| 582 | if ( bit ) | |
| 583 | 583 | { |
| 584 | 584 | mc6854->rones++; |
| 585 | 585 | mc6854->rreg = (mc6854->rreg >> 1) | 0x80000000; |
| 586 | if ( mc6854->rones >= 8 ) | |
| 586 | if ( mc6854->rones >= 8 ) | |
| 587 | 587 | { |
| 588 | 588 | /* abort */ |
| 589 | 589 | mc6854->rstate = 0; |
| 590 | mc6854->rsize = 0; | |
| 591 | if ( mc6854->rstate > 1 ) | |
| 592 | { | |
| 590 | mc6854->rsize = 0; | |
| 591 | if ( mc6854->rstate > 1 ) | |
| 592 | { | |
| 593 | 593 | /* only in-frame abort */ |
| 594 | 594 | mc6854->sr2 |= RABT; |
| 595 | 595 | LOG(( "%f mc6854_receive_bit: abort\n", attotime_to_double(timer_get_time()) )); |
| 596 | 596 | } |
| 597 | 597 | } |
| 598 | else | |
| 598 | else | |
| 599 | 599 | { |
| 600 | 600 | mc6854->rsize++; |
| 601 | 601 | if ( mc6854->rstate && mc6854->rsize >= fieldlen + 24 ) |
| r1461 | r1462 | |
| 608 | 608 | mc6854->rones = 0; |
| 609 | 609 | return; |
| 610 | 610 | } |
| 611 | else if ( mc6854->rones == 6 ) | |
| 611 | else if ( mc6854->rones == 6 ) | |
| 612 | 612 | { |
| 613 | 613 | /* flag */ |
| 614 | if ( FDSE ) | |
| 614 | if ( FDSE ) | |
| 615 | 615 | mc6854->sr1 |= FD; |
| 616 | 616 | |
| 617 | if ( mc6854->rstate > 1 ) | |
| 617 | if ( mc6854->rstate > 1 ) | |
| 618 | 618 | { |
| 619 | 619 | /* end of frame */ |
| 620 | 620 | mc6854->rreg >>= 1; |
| r1461 | r1462 | |
| 627 | 627 | mc6854->rones = 0; |
| 628 | 628 | mc6854->rstate = 1; |
| 629 | 629 | mc6854->rsize = 0; |
| 630 | } else | |
| 630 | } else | |
| 631 | 631 | { |
| 632 | 632 | mc6854->rones = 0; |
| 633 | 633 | mc6854->rreg >>= 1; |
| r1461 | r1462 | |
| 656 | 656 | if ( mc6854->rstate > 1 || mc6854->tstate > 1 || RTS ) |
| 657 | 657 | return -1; /* busy */ |
| 658 | 658 | |
| 659 | if ( len > MAX_FRAME_LENGTH ) | |
| 659 | if ( len > MAX_FRAME_LENGTH ) | |
| 660 | 660 | { |
| 661 | 661 | logerror( "mc6854_send_frame: truncated frame, size=%i, max=%i\n", len, MAX_FRAME_LENGTH ); |
| 662 | 662 | len = MAX_FRAME_LENGTH; |
| 663 | 663 | } |
| 664 | else if ( len < 2 ) | |
| 664 | else if ( len < 2 ) | |
| 665 | 665 | { |
| 666 | 666 | logerror( "mc6854_send_frame: frame too short, size=%i, min=2\n", len ); |
| 667 | 667 | len = 2; |
| 668 | 668 | } |
| 669 | 669 | memcpy( mc6854->frame, data, len ); |
| 670 | if ( FDSE ) | |
| 670 | if ( FDSE ) | |
| 671 | 671 | mc6854->sr1 |= FD; |
| 672 | 672 | mc6854->flen = len; |
| 673 | 673 | mc6854->fpos = 0; |
| 674 | 674 | mc6854_rfifo_push( mc6854->frame[ mc6854->fpos++ ] ); |
| 675 | 675 | mc6854_rfifo_push( mc6854->frame[ mc6854->fpos++ ] ); |
| 676 | if ( mc6854->fpos == mc6854->flen ) | |
| 676 | if ( mc6854->fpos == mc6854->flen ) | |
| 677 | 677 | mc6854_rfifo_terminate(); |
| 678 | 678 | return 0; |
| 679 | 679 | } |
| r1461 | r1462 | |
| 686 | 686 | |
| 687 | 687 | void mc6854_set_cts( int data ) |
| 688 | 688 | { |
| 689 | if ( ! mc6854->cts && data ) | |
| 689 | if ( ! mc6854->cts && data ) | |
| 690 | 690 | mc6854->sr1 |= CTS; |
| 691 | 691 | mc6854->cts = data; |
| 692 | 692 | |
| 693 | if ( mc6854->cts ) | |
| 693 | if ( mc6854->cts ) | |
| 694 | 694 | mc6854->sr1 |= CTS; |
| 695 | else | |
| 695 | else | |
| 696 | 696 | mc6854->sr1 &= ~CTS; |
| 697 | 697 | } |
| 698 | 698 | |
| r1461 | r1462 | |
| 700 | 700 | |
| 701 | 701 | void mc6854_set_dcd( int data ) |
| 702 | 702 | { |
| 703 | if ( ! mc6854->dcd && data ) | |
| 703 | if ( ! mc6854->dcd && data ) | |
| 704 | 704 | { |
| 705 | 705 | mc6854->sr2 |= DCD; |
| 706 | 706 | /* partial reset */ |
| r1461 | r1462 | |
| 718 | 718 | { |
| 719 | 719 | /* update RDA */ |
| 720 | 720 | mc6854->sr2 |= RDA2; |
| 721 | if ( ! (mc6854->rfifo[ FIFO_SIZE - 1 ] & 0x100) ) | |
| 722 | mc6854->sr2 &= ~RDA2; | |
| 723 | else if ( TWOBYTES && ! (mc6854->tfifo[ FIFO_SIZE - 2 ] & 0x100) ) | |
| 721 | if ( ! (mc6854->rfifo[ FIFO_SIZE - 1 ] & 0x100) ) | |
| 724 | 722 | mc6854->sr2 &= ~RDA2; |
| 725 | ||
| 723 | else if ( TWOBYTES && ! (mc6854->tfifo[ FIFO_SIZE - 2 ] & 0x100) ) | |
| 724 | mc6854->sr2 &= ~RDA2; | |
| 725 | ||
| 726 | 726 | /* update AP */ |
| 727 | if ( mc6854->rfifo[ FIFO_SIZE - 1 ] & 0x400 ) | |
| 728 | mc6854->sr2 |= AP; | |
| 729 | else | |
| 727 | if ( mc6854->rfifo[ FIFO_SIZE - 1 ] & 0x400 ) | |
| 728 | mc6854->sr2 |= AP; | |
| 729 | else | |
| 730 | 730 | mc6854->sr2 &= ~AP; |
| 731 | 731 | } |
| 732 | 732 | |
| r1461 | r1462 | |
| 737 | 737 | mc6854_update_sr2(); |
| 738 | 738 | |
| 739 | 739 | /* update S2RQ */ |
| 740 | if ( mc6854->sr2 & 0x7f ) | |
| 741 | mc6854->sr1 |= S2RQ; | |
| 742 | else | |
| 743 | mc6854->sr1 &= ~S2RQ; | |
| 744 | ||
| 740 | if ( mc6854->sr2 & 0x7f ) | |
| 741 | mc6854->sr1 |= S2RQ; | |
| 742 | else | |
| 743 | mc6854->sr1 &= ~S2RQ; | |
| 744 | ||
| 745 | 745 | /* update TRDA (always prioritized by CTS) */ |
| 746 | if ( TRESET || ( mc6854->sr1 & CTS ) ) | |
| 746 | if ( TRESET || ( mc6854->sr1 & CTS ) ) | |
| 747 | 747 | mc6854->sr1 &= ~TDRA; |
| 748 | else | |
| 748 | else | |
| 749 | 749 | { |
| 750 | 750 | mc6854->sr1 |= TDRA; |
| 751 | if ( mc6854->tfifo[ 0 ] & 0x100 ) | |
| 752 | mc6854->sr1 &= ~TDRA; | |
| 753 | else if ( TWOBYTES && (mc6854->tfifo[ 1 ] & 0x100) ) | |
| 751 | if ( mc6854->tfifo[ 0 ] & 0x100 ) | |
| 754 | 752 | mc6854->sr1 &= ~TDRA; |
| 753 | else if ( TWOBYTES && (mc6854->tfifo[ 1 ] & 0x100) ) | |
| 754 | mc6854->sr1 &= ~TDRA; | |
| 755 | 755 | } |
| 756 | 756 | |
| 757 | 757 | /* update RDA */ |
| 758 | if ( mc6854->sr2 & RDA2 ) | |
| 759 | mc6854->sr1 |= RDA; | |
| 760 | else | |
| 761 | mc6854->sr1 &= ~RDA; | |
| 762 | ||
| 758 | if ( mc6854->sr2 & RDA2 ) | |
| 759 | mc6854->sr1 |= RDA; | |
| 760 | else | |
| 761 | mc6854->sr1 &= ~RDA; | |
| 762 | ||
| 763 | 763 | /* update IRQ */ |
| 764 | 764 | mc6854->sr1 &= ~IRQ; |
| 765 | if ( RIE && (mc6854->sr1 & (TU | TDRA) ) ) | |
| 765 | if ( RIE && (mc6854->sr1 & (TU | TDRA) ) ) | |
| 766 | 766 | mc6854->sr1 |= IRQ; |
| 767 | if ( TIE ) | |
| 767 | if ( TIE ) | |
| 768 | 768 | { |
| 769 | if ( mc6854->sr1 & (S2RQ | RDA | CTS) ) | |
| 769 | if ( mc6854->sr1 & (S2RQ | RDA | CTS) ) | |
| 770 | 770 | mc6854->sr1 |= IRQ; |
| 771 | if ( mc6854->sr2 & (ERR | FV | DCD | OVRN | RABT | RIDLE | AP) ) | |
| 771 | if ( mc6854->sr2 & (ERR | FV | DCD | OVRN | RABT | RIDLE | AP) ) | |
| 772 | 772 | mc6854->sr1 |= IRQ; |
| 773 | 773 | } |
| 774 | 774 | } |
| r1461 | r1462 | |
| 777 | 777 | |
| 778 | 778 | READ8_HANDLER ( mc6854_r ) |
| 779 | 779 | { |
| 780 | switch ( offset ) | |
| 780 | switch ( offset ) | |
| 781 | 781 | { |
| 782 | 782 | |
| 783 | 783 | case 0: /* status register 1 */ |
| 784 | 784 | mc6854_update_sr1(); |
| 785 | LOG(( "%f $%04x mc6854_r: get SR1=$%02X (rda=%i,s2rq=%i,fd=%i,cts=%i,tu=%i,tdra=%i,irq=%i)\n", | |
| 785 | LOG(( "%f $%04x mc6854_r: get SR1=$%02X (rda=%i,s2rq=%i,fd=%i,cts=%i,tu=%i,tdra=%i,irq=%i)\n", | |
| 786 | 786 | attotime_to_double(timer_get_time()), activecpu_get_previouspc(), mc6854->sr1, |
| 787 | ( mc6854->sr1 & RDA) ? 1 : 0, ( mc6854->sr1 & S2RQ) ? 1 : 0, | |
| 787 | ( mc6854->sr1 & RDA) ? 1 : 0, ( mc6854->sr1 & S2RQ) ? 1 : 0, | |
| 788 | 788 | ( mc6854->sr1 & FD ) ? 1 : 0, ( mc6854->sr1 & CTS ) ? 1 : 0, |
| 789 | 789 | ( mc6854->sr1 & TU ) ? 1 : 0, ( mc6854->sr1 & TDRA) ? 1 : 0, |
| 790 | 790 | ( mc6854->sr1 & IRQ) ? 1 : 0 )); |
| r1461 | r1462 | |
| 792 | 792 | |
| 793 | 793 | case 1: /* status register 2 */ |
| 794 | 794 | mc6854_update_sr2(); |
| 795 | LOG(( "%f $%04x mc6854_r: get SR2=$%02X (ap=%i,fv=%i,ridle=%i,rabt=%i,err=%i,dcd=%i,ovrn=%i,rda2=%i)\n", | |
| 795 | LOG(( "%f $%04x mc6854_r: get SR2=$%02X (ap=%i,fv=%i,ridle=%i,rabt=%i,err=%i,dcd=%i,ovrn=%i,rda2=%i)\n", | |
| 796 | 796 | attotime_to_double(timer_get_time()), activecpu_get_previouspc(), mc6854->sr2, |
| 797 | ( mc6854->sr2 & AP ) ? 1 : 0, ( mc6854->sr2 & FV ) ? 1 : 0, | |
| 798 | ( mc6854->sr2 & RIDLE) ? 1 : 0, ( mc6854->sr2 & RABT) ? 1 : 0, | |
| 799 | ( mc6854->sr2 & ERR ) ? 1 : 0, ( mc6854->sr2 & DCD ) ? 1 : 0, | |
| 797 | ( mc6854->sr2 & AP ) ? 1 : 0, ( mc6854->sr2 & FV ) ? 1 : 0, | |
| 798 | ( mc6854->sr2 & RIDLE) ? 1 : 0, ( mc6854->sr2 & RABT) ? 1 : 0, | |
| 799 | ( mc6854->sr2 & ERR ) ? 1 : 0, ( mc6854->sr2 & DCD ) ? 1 : 0, | |
| 800 | 800 | ( mc6854->sr2 & OVRN ) ? 1 : 0, ( mc6854->sr2 & RDA2) ? 1 : 0 )); |
| 801 | 801 | return mc6854->sr2; |
| 802 | 802 | |
| r1461 | r1462 | |
| 804 | 804 | case 3: |
| 805 | 805 | { |
| 806 | 806 | UINT8 data = mc6854_rfifo_pop(); |
| 807 | LOG(( "%f $%04x mc6854_r: get data $%02X\n", | |
| 807 | LOG(( "%f $%04x mc6854_r: get data $%02X\n", | |
| 808 | 808 | attotime_to_double(timer_get_time()), activecpu_get_previouspc(), data )); |
| 809 | 809 | return data; |
| 810 | 810 | } |
| r1461 | r1462 | |
| 819 | 819 | |
| 820 | 820 | WRITE8_HANDLER ( mc6854_w ) |
| 821 | 821 | { |
| 822 | switch ( offset ) | |
| 822 | switch ( offset ) | |
| 823 | 823 | { |
| 824 | 824 | |
| 825 | 825 | case 0: /* control register 1 */ |
| 826 | 826 | mc6854->cr1 = data; |
| 827 | LOG(( "%f $%04x mc6854_w: set CR1=$%02X (ac=%i,irq=%c%c,%sreset=%c%c)\n", | |
| 827 | LOG(( "%f $%04x mc6854_w: set CR1=$%02X (ac=%i,irq=%c%c,%sreset=%c%c)\n", | |
| 828 | 828 | attotime_to_double(timer_get_time()), activecpu_get_previouspc(), mc6854->cr1, |
| 829 | AC ? 1 : 0, | |
| 829 | AC ? 1 : 0, | |
| 830 | 830 | RIE ? 'r' : '-', TIE ? 't' : '-', |
| 831 | 831 | DISCONTINUE ? "discontinue," : "", |
| 832 | 832 | RRESET ? 'r' : '-', TRESET ? 't' : '-' |
| 833 | 833 | )); |
| 834 | if ( mc6854->cr1 & 0xc ) | |
| 835 | logerror( "$%04x mc6854 DMA not handled (CR1=$%02X)\n", | |
| 834 | if ( mc6854->cr1 & 0xc ) | |
| 835 | logerror( "$%04x mc6854 DMA not handled (CR1=$%02X)\n", | |
| 836 | 836 | activecpu_get_previouspc(), mc6854->cr1 ); |
| 837 | if ( DISCONTINUE ) | |
| 837 | if ( DISCONTINUE ) | |
| 838 | 838 | { |
| 839 | 839 | /* abort receive FIFO but keeps shift register & synchro */ |
| 840 | 840 | mc6854->rstate = 0; |
| 841 | 841 | memset( mc6854->rfifo, 0, sizeof( mc6854->rfifo ) ); |
| 842 | 842 | } |
| 843 | if ( RRESET ) | |
| 843 | if ( RRESET ) | |
| 844 | 844 | { |
| 845 | 845 | /* abort FIFO & synchro */ |
| 846 | 846 | mc6854_rfifo_clear(); |
| r1461 | r1462 | |
| 848 | 848 | mc6854->sr2 &= ~(AP | FV | RIDLE | RABT | ERR | OVRN | DCD); |
| 849 | 849 | if ( mc6854->dcd ) mc6854->sr2 |= DCD; |
| 850 | 850 | } |
| 851 | if ( TRESET ) | |
| 851 | if ( TRESET ) | |
| 852 | 852 | { |
| 853 | 853 | mc6854_tfifo_clear(); |
| 854 | 854 | mc6854->sr1 &= ~(TU | TDRA | CTS); |
| r1461 | r1462 | |
| 857 | 857 | break; |
| 858 | 858 | |
| 859 | 859 | case 1: |
| 860 | if ( AC ) | |
| 860 | if ( AC ) | |
| 861 | 861 | { |
| 862 | 862 | /* control register 3 */ |
| 863 | 863 | mc6854->cr3 = data; |
| 864 | LOG(( "%f $%04x mc6854_w: set CR3=$%02X (lcf=%i,aex=%i,idl=%i,fdse=%i,loop=%i,tst=%i,dtr=%i)\n", | |
| 864 | LOG(( "%f $%04x mc6854_w: set CR3=$%02X (lcf=%i,aex=%i,idl=%i,fdse=%i,loop=%i,tst=%i,dtr=%i)\n", | |
| 865 | 865 | attotime_to_double(timer_get_time()), activecpu_get_previouspc(), mc6854->cr3, |
| 866 | 866 | LCF ? (CEX ? 16 : 8) : 0, AEX ? 1 : 0, |
| 867 | 867 | IDL0 ? 0 : 1, FDSE ? 1 : 0, LOOP ? 1 : 0, |
| r1461 | r1462 | |
| 876 | 876 | mc6854->iface->out_dtr( DTR ? 1 : 0 ); |
| 877 | 877 | |
| 878 | 878 | } |
| 879 | else | |
| 879 | else | |
| 880 | 880 | { |
| 881 | 881 | /* control register 2 */ |
| 882 | 882 | mc6854->cr2 = data; |
| 883 | LOG(( "%f $%04x mc6854_w: set CR2=$%02X (pse=%i,bytes=%i,fmidle=%i,%s,tlast=%i,clr=%c%c,rts=%i)\n", | |
| 883 | LOG(( "%f $%04x mc6854_w: set CR2=$%02X (pse=%i,bytes=%i,fmidle=%i,%s,tlast=%i,clr=%c%c,rts=%i)\n", | |
| 884 | 884 | attotime_to_double(timer_get_time()), activecpu_get_previouspc(), mc6854->cr2, |
| 885 | PSE ? 1 : 0, TWOBYTES ? 2 : 1, FMIDLE ? 1 : 0, | |
| 885 | PSE ? 1 : 0, TWOBYTES ? 2 : 1, FMIDLE ? 1 : 0, | |
| 886 | 886 | FCTDRA ? "fc" : "tdra", TLAST ? 1 : 0, |
| 887 | 887 | data & 0x20 ? 'r' : '-', data & 0x40 ? 't' : '-', |
| 888 | 888 | RTS ? 1 : 0 )); |
| 889 | 889 | if ( PSE ) |
| 890 | 890 | logerror( "$%04x mc6854 status prioritization not handled (CR2=$%02X)\n", activecpu_get_previouspc(), mc6854->cr2 ); |
| 891 | if ( TLAST ) | |
| 891 | if ( TLAST ) | |
| 892 | 892 | mc6854_tfifo_terminate(); |
| 893 | if ( data & 0x20 ) | |
| 893 | if ( data & 0x20 ) | |
| 894 | 894 | { |
| 895 | 895 | /* clear receiver status */ |
| 896 | 896 | mc6854->sr1 &= ~FD; |
| 897 | 897 | mc6854->sr2 &= ~(AP | FV | RIDLE | RABT | ERR | OVRN | DCD); |
| 898 | if ( mc6854->dcd ) | |
| 898 | if ( mc6854->dcd ) | |
| 899 | 899 | mc6854->sr2 |= DCD; |
| 900 | 900 | } |
| 901 | if ( data & 0x40 ) | |
| 901 | if ( data & 0x40 ) | |
| 902 | 902 | { |
| 903 | 903 | /* clear transmitter status */ |
| 904 | 904 | mc6854->sr1 &= ~(TU | TDRA | CTS); |
| 905 | if ( mc6854->cts ) | |
| 905 | if ( mc6854->cts ) | |
| 906 | 906 | mc6854->sr1 |= CTS; |
| 907 | 907 | } |
| 908 | 908 | |
| 909 | if ( mc6854->iface->out_rts ) | |
| 909 | if ( mc6854->iface->out_rts ) | |
| 910 | 910 | mc6854->iface->out_rts( RTS ? 1 : 0 ); |
| 911 | 911 | } |
| 912 | 912 | break; |
| r1461 | r1462 | |
| 917 | 917 | break; |
| 918 | 918 | |
| 919 | 919 | case 3: |
| 920 | if ( AC ) | |
| 920 | if ( AC ) | |
| 921 | 921 | { |
| 922 | 922 | /* control register 4 */ |
| 923 | 923 | mc6854->cr4 = data; |
| 924 | 924 | LOG(( "%f $%04x mc6854_w: set CR4=$%02X (interframe=%i,tlen=%i,rlen=%i,%s%s)\n", attotime_to_double(timer_get_time()), activecpu_get_previouspc(), mc6854->cr4, |
| 925 | TWOINTER ? 2 : 1, | |
| 926 | TWL, RWL, | |
| 925 | TWOINTER ? 2 : 1, | |
| 926 | TWL, RWL, | |
| 927 | 927 | ABT ? ( ABTEX ? "abort-ext," : "abort,") : "", |
| 928 | 928 | NRZ ? "nrz" : "nrzi" )); |
| 929 | if ( ABT ) | |
| 930 | { | |
| 929 | if ( ABT ) | |
| 930 | { | |
| 931 | 931 | mc6854->tstate = 0; |
| 932 | 932 | mc6854_send_bits( 0xffff, ABTEX ? 16 : 8, 0 ); |
| 933 | 933 | mc6854->flen = 0; |
| 934 | 934 | } |
| 935 | 935 | } |
| 936 | else | |
| 936 | else | |
| 937 | 937 | { |
| 938 | 938 | /* transmitter data: last data */ |
| 939 | 939 | LOG(( "%f $%04x mc6854_w: push last-data=$%02X\n", attotime_to_double(timer_get_time()), activecpu_get_previouspc(), data )); |
| r1461 | r1462 | |
| 941 | 941 | mc6854_tfifo_terminate(); |
| 942 | 942 | } |
| 943 | 943 | break; |
| 944 | ||
| 944 | ||
| 945 | 945 | default: |
| 946 | 946 | logerror( "$%04x mc6854 invalid write offset %i (data=$%02X)\n", activecpu_get_previouspc(), offset, data ); |
| 947 | 947 | } |
| r1461 | r1462 | |
|---|---|---|
| 152 | 152 | static void tc8521_set_alarm_output(void) |
| 153 | 153 | { |
| 154 | 154 | unsigned char alarm_output; |
| 155 | ||
| 155 | ||
| 156 | 156 | alarm_output = 0; |
| 157 | 157 | |
| 158 | 158 | /* what happens when all are enabled? I assume they are all or'd together */ |
| r1461 | r1462 | |
| 181 | 181 | /* alarm output enabled? */ |
| 182 | 182 | alarm_output &= ~1; |
| 183 | 183 | } |
| 184 | ||
| 184 | ||
| 185 | 185 | if (rtc.interface.alarm_output_callback!=NULL) |
| 186 | 186 | { |
| 187 | 187 | rtc.interface.alarm_output_callback(alarm_output); |
| r1461 | r1462 | |
| 314 | 314 | logerror("8521 RTC R: %04x %02x\n", offset, rtc.registers[offset]); |
| 315 | 315 | #endif |
| 316 | 316 | return rtc.registers[offset]; |
| 317 | ||
| 317 | ||
| 318 | 318 | default: |
| 319 | 319 | break; |
| 320 | 320 | } |
| r1461 | r1462 | |
|---|---|---|
| 15 | 15 | |
| 16 | 16 | The bit-based interface is low-level and slow. |
| 17 | 17 | Use it to simulate the actual bits sent into the wires, e.g., to connect |
| 18 | the emulator to another bit-based emulated network device, or an actual | |
| 18 | the emulator to another bit-based emulated network device, or an actual | |
| 19 | 19 | device. |
| 20 | 20 | |
| 21 | 21 | The frame-based interface is higher-level and faster. |
| 22 | 22 | It passes bytes directly from one end to the other without bothering with |
| 23 | 23 | the actual bit-encoding, synchronization, and CRC. |
| 24 | Once completed, a frame is sent through out_frame. Aborted frames are not | |
| 24 | Once completed, a frame is sent through out_frame. Aborted frames are not | |
| 25 | 25 | transmitted at all. No start flag, stop flag, or crc bits are trasmitted. |
| 26 | 26 | send_frame makes a frame available to the CPU through the 6854 (it may |
| 27 | 27 | fail and return -1 if the 6854 is not ready to accept the frame; even |
| 28 | if the frame is accepted and 0 is returned, the CPU may abort it). Ony | |
| 28 | if the frame is accepted and 0 is returned, the CPU may abort it). Ony | |
| 29 | 29 | full frames are accepted. |
| 30 | 30 | */ |
| 31 | 31 |
| r1461 | r1462 | |
|---|---|---|
| 457 | 457 | { |
| 458 | 458 | int slot = ((offset >> 4) & 7) - 1; |
| 459 | 459 | #if VERBOSE |
| 460 | logerror("concept_io_w: Slot I/O register written for slot %d at address 0x03%4.4x, data: 0x%4.4x\n", | |
| 460 | logerror("concept_io_w: Slot I/O register written for slot %d at address 0x03%4.4x, data: 0x%4.4x\n", | |
| 461 | 461 | slot, offset << 1, data); |
| 462 | 462 | #endif |
| 463 | 463 | if (expansion_slots[slot].reg_write) |
| r1461 | r1462 | |
|---|---|---|
| 270 | 270 | /* Prevents internal_floppy_device_load (mflopimg) to set the drive |
| 271 | 271 | geometry to the medium geometry. TI disk controllers determine the |
| 272 | 272 | number of tracks from a field in sector 0, and if the medium has |
| 273 | 40 tracks but the drive has 80, the DSR ROM automatically | |
| 274 | double-steps the tracks. | |
| 273 | 40 tracks but the drive has 80, the DSR ROM automatically | |
| 274 | double-steps the tracks. | |
| 275 | 275 | */ |
| 276 | 276 | floppy_keep_drive_geometry(); |
| 277 | 277 |
| r1461 | r1462 | |
|---|---|---|
| 111 | 111 | } |
| 112 | 112 | mem = image_malloc (image, size_aligned); |
| 113 | 113 | if (!mem) { |
| 114 | logerror ("cart #%d: error: failed to allocate memory for cartridge\n", | |
| 114 | logerror ("cart #%d: error: failed to allocate memory for cartridge\n", | |
| 115 | 115 | id); |
| 116 | 116 | return INIT_FAIL; |
| 117 | 117 | } |
| r1461 | r1462 | |
| 119 | 119 | memset (mem, 0xff, size_aligned); |
| 120 | 120 | } |
| 121 | 121 | if (image_fread(image, mem, size) != size) { |
| 122 | logerror ("cart #%d: %s: can't read full %d bytes\n", | |
| 122 | logerror ("cart #%d: %s: can't read full %d bytes\n", | |
| 123 | 123 | id, image_filename (image), size); |
| 124 | 124 | return INIT_FAIL; |
| 125 | 125 | } |
| r1461 | r1462 | |
| 130 | 130 | logerror("cart #%d: warning: no information in crc file\n", id); |
| 131 | 131 | type = -1; |
| 132 | 132 | } |
| 133 | else if ((1 != sscanf (extra, "%d", &type) ) || | |
| 133 | else if ((1 != sscanf (extra, "%d", &type) ) || | |
| 134 | 134 | type < 0 || type > SLOT_LAST_CARTRIDGE_TYPE) { |
| 135 | 135 | logerror("cart #%d: warning: information in crc file not valid\n", id); |
| 136 | 136 | type = -1; |
| r1461 | r1462 | |
| 162 | 162 | logerror ("cart #%d: error: cannot allocate memory\n", id); |
| 163 | 163 | return INIT_FAIL; |
| 164 | 164 | } |
| 165 | ||
| 165 | ||
| 166 | 166 | if (size < 0x10000) { |
| 167 | 167 | memset (mem + size, 0xff, 0x10000 - size); |
| 168 | 168 | } |
| r1461 | r1462 | |
| 177 | 177 | /* mapper type 0 (ROM) might need moving around a bit */ |
| 178 | 178 | if (!type) { |
| 179 | 179 | int i, page = 1; |
| 180 | ||
| 180 | ||
| 181 | 181 | /* find the correct page */ |
| 182 | 182 | if (mem[0] == 'A' && mem[1] == 'B') { |
| 183 | 183 | for (i=2; i<=8; i += 2) { |
| r1461 | r1462 | |
| 193 | 193 | /* copy to the respective page */ |
| 194 | 194 | memcpy (mem + (page * 0x4000), mem, 0x4000); |
| 195 | 195 | memset (mem, 0xff, 0x4000); |
| 196 | } | |
| 196 | } | |
| 197 | 197 | else { |
| 198 | 198 | /* memory is repeated 4 times */ |
| 199 | 199 | page = -1; |
| r1461 | r1462 | |
| 210 | 210 | |
| 211 | 211 | page = 1; |
| 212 | 212 | i = 0xc000; m = mem + 0xffff; |
| 213 | while (i--) { | |
| 214 | *m = *(m - 0x4000); m--; | |
| 213 | while (i--) { | |
| 214 | *m = *(m - 0x4000); m--; | |
| 215 | 215 | } |
| 216 | 216 | memset (mem, 0xff, 0x4000); |
| 217 | 217 | } |
| r1461 | r1462 | |
| 270 | 270 | DEVICE_UNLOAD (msx_cart) |
| 271 | 271 | { |
| 272 | 272 | int id; |
| 273 | ||
| 273 | ||
| 274 | 274 | id = image_index_in_device (image); |
| 275 | 275 | if (msx_slot_list[msx1.cart_state[id]->type].savesram) |
| 276 | 276 | { |
| r1461 | r1462 | |
| 323 | 323 | static const ppi8255_interface msx_ppi8255_interface = |
| 324 | 324 | { |
| 325 | 325 | 1, |
| 326 | {NULL}, | |
| 326 | {NULL}, | |
| 327 | 327 | {msx_ppi_port_b_r}, |
| 328 | 328 | {NULL}, |
| 329 | 329 | {msx_ppi_port_a_w}, |
| 330 | {NULL}, | |
| 330 | {NULL}, | |
| 331 | 331 | {msx_ppi_port_c_w} |
| 332 | 332 | }; |
| 333 | 333 | |
| r1461 | r1462 | |
| 712 | 712 | |
| 713 | 713 | /* cassette motor on/off */ |
| 714 | 714 | if ( (old_val ^ data) & 0x10) |
| 715 | cassette_change_state(cassette_device_image(), | |
| 716 | (data & 0x10) ? CASSETTE_MOTOR_DISABLED : | |
| 717 | CASSETTE_MOTOR_ENABLED, | |
| 715 | cassette_change_state(cassette_device_image(), | |
| 716 | (data & 0x10) ? CASSETTE_MOTOR_DISABLED : | |
| 717 | CASSETTE_MOTOR_ENABLED, | |
| 718 | 718 | CASSETTE_MASK_MOTOR); |
| 719 | 719 | |
| 720 | 720 | /* cassette signal write */ |
| r1461 | r1462 | |
| 780 | 780 | } |
| 781 | 781 | |
| 782 | 782 | for (; layout->entry != MSX_LAYOUT_LAST; layout++) { |
| 783 | ||
| 783 | ||
| 784 | 784 | switch (layout->entry) { |
| 785 | 785 | case MSX_LAYOUT_SLOT_ENTRY: |
| 786 | 786 | prim = layout->slot_primary; |
| r1461 | r1462 | |
| 899 | 899 | if (!msx1.layout) { |
| 900 | 900 | return; |
| 901 | 901 | } |
| 902 | ||
| 903 | for (layout = msx1.layout; layout->entry != MSX_LAYOUT_LAST; | |
| 902 | ||
| 903 | for (layout = msx1.layout; layout->entry != MSX_LAYOUT_LAST; | |
| 904 | 904 | layout++) { |
| 905 | 905 | |
| 906 | 906 | if (layout->entry == MSX_LAYOUT_SLOT_ENTRY) { |
| r1461 | r1462 | |
| 942 | 942 | |
| 943 | 943 | if (VERBOSE) |
| 944 | 944 | { |
| 945 | logerror ("mapping %s in %d/%d/%d\n", slot->name, slot_primary, | |
| 945 | logerror ("mapping %s in %d/%d/%d\n", slot->name, slot_primary, | |
| 946 | 946 | slot_secondary, page); |
| 947 | 947 | } |
| 948 | 948 | slot->map (state, page); |
| r1461 | r1462 | |
| 1075 | 1075 | { |
| 1076 | 1076 | int latch; |
| 1077 | 1077 | UINT8 ret; |
| 1078 | ||
| 1078 | ||
| 1079 | 1079 | latch = msx1.kanji_latch; |
| 1080 | 1080 | ret = msx1.kanji_mem[latch++]; |
| 1081 | 1081 | |
| r1461 | r1462 | |
| 1091 | 1091 | { |
| 1092 | 1092 | if (offset) |
| 1093 | 1093 | { |
| 1094 | msx1.kanji_latch = | |
| 1094 | msx1.kanji_latch = | |
| 1095 | 1095 | (msx1.kanji_latch & 0x007E0) | ((data & 0x3f) << 11); |
| 1096 | 1096 | } |
| 1097 | 1097 | else |
| 1098 | 1098 | { |
| 1099 | msx1.kanji_latch = | |
| 1099 | msx1.kanji_latch = | |
| 1100 | 1100 | (msx1.kanji_latch & 0x1f800) | ((data & 0x3f) << 5); |
| 1101 | 1101 | } |
| 1102 | 1102 | } |
| r1461 | r1462 | |
|---|---|---|
| 314 | 314 | } |
| 315 | 315 | |
| 316 | 316 | artwork_use_device_art(image_from_devtype_and_index(IO_CARTSLOT, 0), "mine"); |
| 317 | ||
| 317 | ||
| 318 | 318 | for (i = 0; i < vectrex_ram_size; i++) |
| 319 | 319 | vectrex_ram_base[i] = mame_rand(machine); |
| 320 | 320 | } |
| r1461 | r1462 | |
|---|---|---|
| 2100 | 2100 | ret = 1; |
| 2101 | 2101 | else if (last_side != nes_fds.current_side) |
| 2102 | 2102 | { |
| 2103 | /* If we've switched disks, report "no disk" for a few reads */ | |
| 2103 | /* If we've switched disks, report "no disk" for a few reads */ | |
| 2104 | 2104 | ret = 1; |
| 2105 | 2105 | count ++; |
| 2106 | 2106 | if (count == 50) |
| r1461 | r1462 | |
| 4212 | 4212 | |
| 4213 | 4213 | /* Set the vram bank-switch values to the default */ |
| 4214 | 4214 | ppu2c0x_set_videorom_bank(0, 0, 8, 0, 64); |
| 4215 | ||
| 4215 | ||
| 4216 | 4216 | /* Set the mapper irq callback */ |
| 4217 | 4217 | mapper = nes_mapper_lookup(mapperNum); |
| 4218 | 4218 | ppu2c0x_set_scanline_callback (0, mapper ? mapper->mmc_scanline : NULL); |
| r1461 | r1462 | |
| 4220 | 4220 | |
| 4221 | 4221 | if (!nes_irq_timer) |
| 4222 | 4222 | nes_irq_timer = timer_alloc(nes_irq_callback, NULL); |
| 4223 | ||
| 4223 | ||
| 4224 | 4224 | mapper_warning = 0; |
| 4225 | 4225 | /* 8k mask */ |
| 4226 | 4226 | prg_mask = ((nes.prg_chunks << 1) - 1); |
| r1461 | r1462 | |
|---|---|---|
| 121 | 121 | #if 0 |
| 122 | 122 | /* set status 'out of paper', '*no* error', 'IRQ has *not* occured' */ |
| 123 | 123 | LPT[n].status = 0x09c; //0x2c; |
| 124 | ||
| 124 | ||
| 125 | 125 | #endif |
| 126 | 126 | } |
| 127 | 127 | data|=0x4; //? |
| r1461 | r1462 | |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | void pc_lpt_handshake_in(int nr, int data, int mask) |
| 141 | { | |
| 141 | { | |
| 142 | 142 | PC_LPT *This=LPT+nr; |
| 143 | 143 | int neu=(data&mask)|(This->status&~mask); |
| 144 | 144 |
| r1461 | r1462 | |
|---|---|---|
| 71 | 71 | |
| 72 | 72 | INPUT_PORTS_START( pc_joystick ) |
| 73 | 73 | PORT_START_TAG("pc_joy") |
| 74 | PORT_BIT ( 0xf, 0xf, IPT_UNUSED ) | |
| 74 | PORT_BIT ( 0xf, 0xf, IPT_UNUSED ) | |
| 75 | 75 | PORT_BIT( 0x0010, 0x0000, IPT_BUTTON1) PORT_NAME("Joystick 1 Button 1") |
| 76 | 76 | PORT_BIT( 0x0020, 0x0000, IPT_BUTTON2) PORT_NAME("Joystick 1 Button 2") |
| 77 | 77 | PORT_BIT( 0x0040, 0x0000, IPT_BUTTON1) PORT_NAME("Joystick 2 Button 1") PORT_CODE(JOYCODE_BUTTON1) PORT_PLAYER(2) |
| 78 | 78 | PORT_BIT( 0x0080, 0x0000, IPT_BUTTON2) PORT_NAME("Joystick 2 Button 2") PORT_CODE(JOYCODE_BUTTON2) PORT_PLAYER(2) |
| 79 | ||
| 79 | ||
| 80 | 80 | PORT_START |
| 81 | 81 | PORT_BIT(0xff,0x80,IPT_AD_STICK_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(1) PORT_MINMAX(1,0xff) PORT_CODE_DEC(KEYCODE_LEFT) PORT_CODE_INC(KEYCODE_RIGHT) PORT_CODE_DEC(JOYCODE_X_LEFT_SWITCH) PORT_CODE_INC(JOYCODE_X_RIGHT_SWITCH) PORT_REVERSE |
| 82 | ||
| 82 | ||
| 83 | 83 | PORT_START |
| 84 | 84 | PORT_BIT(0xff,0x80,IPT_AD_STICK_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(1) PORT_MINMAX(1,0xff) PORT_CODE_DEC(KEYCODE_UP) PORT_CODE_INC(KEYCODE_DOWN) PORT_CODE_DEC(JOYCODE_Y_UP_SWITCH) PORT_CODE_INC(JOYCODE_Y_DOWN_SWITCH) PORT_REVERSE |
| 85 | ||
| 85 | ||
| 86 | 86 | PORT_START |
| 87 | 87 | PORT_BIT(0xff,0x80,IPT_AD_STICK_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(1) PORT_MINMAX(1,0xff) PORT_CODE_DEC(JOYCODE_X_LEFT_SWITCH) PORT_CODE_INC(JOYCODE_X_RIGHT_SWITCH) PORT_PLAYER(2) PORT_REVERSE |
| 88 | ||
| 88 | ||
| 89 | 89 | PORT_START |
| 90 | 90 | PORT_BIT(0xff,0x80,IPT_AD_STICK_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(1) PORT_MINMAX(1,0xff) PORT_CODE_DEC(JOYCODE_Y_UP_SWITCH) PORT_CODE_INC(JOYCODE_Y_DOWN_SWITCH) PORT_PLAYER(2) PORT_REVERSE |
| 91 | 91 | INPUT_PORTS_END |
| r1461 | r1462 | |
|---|---|---|
| 3 | 3 | * machine/74145.h |
| 4 | 4 | * |
| 5 | 5 | * BCD-to-Decimal decoder |
| 6 | * | |
| 6 | * | |
| 7 | 7 | * __ __ |
| 8 | 8 | * 0-| v |-VCC |
| 9 | 9 | * 1-| |-A |
| r1461 | r1462 | |
| 14 | 14 | * 6-| |-8 |
| 15 | 15 | * GND-|_____|-7 |
| 16 | 16 | * |
| 17 | * | |
| 17 | * | |
| 18 | 18 | * Truth table |
| 19 | 19 | * _______________________________ |
| 20 | 20 | * | Inputs | Outputs | |
| r1461 | r1462 | |
| 39 | 39 | * | H H H L | H H H H H H H H H H | |
| 40 | 40 | * | H H H H | H H H H H H H H H H | |
| 41 | 41 | * ------------------------------- |
| 42 | * | |
| 42 | * | |
| 43 | 43 | ****************************************************************************/ |
| 44 | 44 | |
| 45 | 45 | #include "74145.h" |
| r1461 | r1462 | |
| 65 | 65 | { |
| 66 | 66 | /* Pointer to our interface */ |
| 67 | 67 | const ttl74145_interface *intf; |
| 68 | ||
| 68 | ||
| 69 | 69 | /* Decoded number */ |
| 70 | 70 | UINT16 number; |
| 71 | 71 | }; |
| r1461 | r1462 | |
| 96 | 96 | |
| 97 | 97 | /* Assign interface */ |
| 98 | 98 | ttl74145[which].intf = intf; |
| 99 | ||
| 99 | ||
| 100 | 100 | /* Initialize */ |
| 101 | 101 | ttl74145_reset(which); |
| 102 | 102 | } |
| r1461 | r1462 | |
| 114 | 114 | { |
| 115 | 115 | /* Decode number */ |
| 116 | 116 | UINT16 new_number = bcd_2_dec(data & 0x0f); |
| 117 | ||
| 117 | ||
| 118 | 118 | /* Call output callbacks if the number changed */ |
| 119 | 119 | if (new_number != ttl74145[which].number) |
| 120 | 120 | { |
| 121 | 121 | const ttl74145_interface *i = ttl74145[which].intf; |
| 122 | ||
| 122 | ||
| 123 | 123 | if (i->output_line_0) i->output_line_0(new_number == 0); |
| 124 | 124 | if (i->output_line_1) i->output_line_1(new_number == 1); |
| 125 | 125 | if (i->output_line_2) i->output_line_2(new_number == 2); |
| r1461 | r1462 | |
| 129 | 129 | if (i->output_line_6) i->output_line_6(new_number == 6); |
| 130 | 130 | if (i->output_line_7) i->output_line_7(new_number == 7); |
| 131 | 131 | if (i->output_line_8) i->output_line_8(new_number == 8); |
| 132 | if (i->output_line_9) i->output_line_9(new_number == 9); | |
| 132 | if (i->output_line_9) i->output_line_9(new_number == 9); | |
| 133 | 133 | } |
| 134 | ||
| 134 | ||
| 135 | 135 | /* Update state */ |
| 136 | 136 | ttl74145[which].number = new_number; |
| 137 | 137 | } |
| r1461 | r1462 | |
|---|---|---|
| 30 | 30 | /******************* internal chip data structure ******************/ |
| 31 | 31 | |
| 32 | 32 | |
| 33 | static struct | |
| 33 | static struct | |
| 34 | 34 | { |
| 35 | ||
| 35 | ||
| 36 | 36 | const mc6846_interface* iface; |
| 37 | ||
| 37 | ||
| 38 | 38 | /* registers */ |
| 39 | 39 | UINT8 csr; /* 0,4: combination status register */ |
| 40 | 40 | UINT8 pcr; /* 1: peripheral control register */ |
| r1461 | r1462 | |
| 90 | 90 | |
| 91 | 91 | INLINE UINT16 mc6846_counter ( void ) |
| 92 | 92 | { |
| 93 | if ( mc6846.timer_started ) | |
| 93 | if ( mc6846.timer_started ) | |
| 94 | 94 | { |
| 95 | 95 | attotime delay = timer_timeleft( mc6846.interval ); |
| 96 | 96 | return ATTOTIME_TO_CYCLES( mc6846.iface->cpunum, delay ) / FACTOR; |
| 97 | 97 | } |
| 98 | else | |
| 98 | else | |
| 99 | 99 | return mc6846.preset; |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | |
| 103 | 103 | |
| 104 | INLINE void mc6846_update_irq( void ) | |
| 104 | INLINE void mc6846_update_irq( void ) | |
| 105 | 105 | { |
| 106 | 106 | static int old_cif; |
| 107 | 107 | int cif = 0; |
| r1461 | r1462 | |
| 110 | 110 | ( (mc6846.csr & 2) && (mc6846.pcr & 1) ) || |
| 111 | 111 | ( (mc6846.csr & 4) && (mc6846.pcr & 8) && ! (mc6846.pcr & 0x20) ) ) |
| 112 | 112 | cif = 1; |
| 113 | if ( old_cif != cif ) | |
| 114 | { | |
| 115 | LOG (( "%f: mc6846 interrupt %i (time=%i cp1=%i cp2=%i)\n", | |
| 116 | attotime_to_double(timer_get_time()), cif, | |
| 113 | if ( old_cif != cif ) | |
| 114 | { | |
| 115 | LOG (( "%f: mc6846 interrupt %i (time=%i cp1=%i cp2=%i)\n", | |
| 116 | attotime_to_double(timer_get_time()), cif, | |
| 117 | 117 | mc6846.csr & 1, (mc6846.csr >> 1 ) & 1, (mc6846.csr >> 2 ) & 1 )); |
| 118 | 118 | old_cif = cif; |
| 119 | 119 | } |
| 120 | if ( cif ) | |
| 120 | if ( cif ) | |
| 121 | 121 | { |
| 122 | 122 | mc6846.csr |= 0x80; |
| 123 | 123 | if ( mc6846.iface->irq_func ) |
| 124 | 124 | mc6846.iface->irq_func( 1 ); |
| 125 | 125 | } |
| 126 | else | |
| 126 | else | |
| 127 | 127 | { |
| 128 | 128 | mc6846.csr &= ~0x80; |
| 129 | 129 | if ( mc6846.iface->irq_func ) |
| r1461 | r1462 | |
| 137 | 137 | { |
| 138 | 138 | int cto = CTO; |
| 139 | 139 | static int old_cto; |
| 140 | if ( cto != old_cto ) | |
| 140 | if ( cto != old_cto ) | |
| 141 | 141 | { |
| 142 | 142 | LOG (( "%f: mc6846 CTO set to %i\n", attotime_to_double(timer_get_time()), cto )); |
| 143 | 143 | old_cto = cto; |
| 144 | 144 | } |
| 145 | if ( mc6846.iface->out_cto_func ) | |
| 145 | if ( mc6846.iface->out_cto_func ) | |
| 146 | 146 | mc6846.iface->out_cto_func( 0, cto ); |
| 147 | 147 | } |
| 148 | 148 | |
| r1461 | r1462 | |
| 153 | 153 | int delay = FACTOR * (mc6846.preset+1); |
| 154 | 154 | LOG (( "%f: mc6846 timer launch called, mode=%i, preset=%i (x%i)\n", attotime_to_double(timer_get_time()), MODE, mc6846.preset, FACTOR )); |
| 155 | 155 | |
| 156 | if ( ! (mc6846.tcr & 2) ) | |
| 156 | if ( ! (mc6846.tcr & 2) ) | |
| 157 | 157 | { |
| 158 | 158 | logerror( "mc6846 external clock CTC not implemented\n" ); |
| 159 | 159 | } |
| 160 | ||
| 161 | switch( MODE ) | |
| 160 | ||
| 161 | switch( MODE ) | |
| 162 | 162 | { |
| 163 | ||
| 163 | ||
| 164 | 164 | case 0x00: |
| 165 | 165 | case 0x10: /* continuous */ |
| 166 | 166 | mc6846.cto = 0; |
| 167 | 167 | break; |
| 168 | ||
| 168 | ||
| 169 | 169 | case 0x20: /* single-shot */ |
| 170 | 170 | mc6846.cto = 0; |
| 171 | 171 | timer_reset( mc6846.one_shot, ATTOTIME_IN_CYCLES( FACTOR, mc6846.iface->cpunum ) ); |
| 172 | 172 | break; |
| 173 | ||
| 173 | ||
| 174 | 174 | case 0x30: /* cascaded single-shot */ |
| 175 | 175 | break; |
| 176 | ||
| 176 | ||
| 177 | 177 | default: |
| 178 | 178 | logerror( "mc6846 timer mode %i not implemented\n", MODE ); |
| 179 | 179 | timer_reset( mc6846.interval, attotime_never ); |
| 180 | 180 | mc6846.timer_started = 0; |
| 181 | 181 | return; |
| 182 | 182 | } |
| 183 | ||
| 183 | ||
| 184 | 184 | timer_reset( mc6846.interval, ATTOTIME_IN_CYCLES( delay, mc6846.iface->cpunum ) ); |
| 185 | 185 | mc6846.timer_started = 1; |
| 186 | ||
| 186 | ||
| 187 | 187 | mc6846.csr &= ~1; |
| 188 | 188 | mc6846_update_cto(); |
| 189 | 189 | mc6846_update_irq(); |
| r1461 | r1462 | |
| 205 | 205 | if ( ! (mc6846.tcr & 2) ) |
| 206 | 206 | logerror( "mc6846 external clock CTC not implemented\n" ); |
| 207 | 207 | |
| 208 | switch ( MODE ) | |
| 208 | switch ( MODE ) | |
| 209 | 209 | { |
| 210 | 210 | case 0x00: |
| 211 | 211 | case 0x10: /* continuous */ |
| r1461 | r1462 | |
| 215 | 215 | case 0x20: /* single-shot */ |
| 216 | 216 | mc6846.cto = 0; |
| 217 | 217 | break; |
| 218 | ||
| 218 | ||
| 219 | 219 | case 0x30: /* cascaded single-shot */ |
| 220 | 220 | mc6846.cto = ( mc6846.tcr & 0x80 ) ? 1 : 0; |
| 221 | 221 | break; |
| r1461 | r1462 | |
| 253 | 253 | |
| 254 | 254 | READ8_HANDLER ( mc6846_r ) |
| 255 | 255 | { |
| 256 | switch ( offset ) | |
| 256 | switch ( offset ) | |
| 257 | 257 | { |
| 258 | 258 | case 0: |
| 259 | 259 | case 4: |
| 260 | 260 | LOG (( "$%04x %f: mc6846 CSR read $%02X intr=%i (timer=%i, cp1=%i, cp2=%i)\n", |
| 261 | activecpu_get_previouspc(), attotime_to_double(timer_get_time()), | |
| 262 | mc6846.csr, (mc6846.csr >> 7) & 1, | |
| 261 | activecpu_get_previouspc(), attotime_to_double(timer_get_time()), | |
| 262 | mc6846.csr, (mc6846.csr >> 7) & 1, | |
| 263 | 263 | mc6846.csr & 1, (mc6846.csr >> 1) & 1, (mc6846.csr >> 2) & 1 )); |
| 264 | 264 | mc6846.csr0_to_be_cleared = mc6846.csr & 1; |
| 265 | 265 | mc6846.csr1_to_be_cleared = mc6846.csr & 2; |
| 266 | 266 | mc6846.csr2_to_be_cleared = mc6846.csr & 4; |
| 267 | 267 | return mc6846.csr; |
| 268 | ||
| 269 | case 1: | |
| 268 | ||
| 269 | case 1: | |
| 270 | 270 | LOG (( "$%04x %f: mc6846 PCR read $%02X\n", activecpu_get_previouspc(), attotime_to_double(timer_get_time()), mc6846.pcr )); |
| 271 | 271 | return mc6846.pcr; |
| 272 | 272 | |
| 273 | case 2: | |
| 273 | case 2: | |
| 274 | 274 | LOG (( "$%04x %f: mc6846 DDR read $%02X\n", activecpu_get_previouspc(), attotime_to_double(timer_get_time()), mc6846.ddr )); |
| 275 | 275 | return mc6846.ddr; |
| 276 | 276 | |
| 277 | 277 | case 3: |
| 278 | 278 | LOG (( "$%04x %f: mc6846 PORT read $%02X\n", activecpu_get_previouspc(), attotime_to_double(timer_get_time()), PORT )); |
| 279 | if ( ! (mc6846.pcr & 0x80) ) | |
| 279 | if ( ! (mc6846.pcr & 0x80) ) | |
| 280 | 280 | { |
| 281 | if ( mc6846.csr1_to_be_cleared ) | |
| 281 | if ( mc6846.csr1_to_be_cleared ) | |
| 282 | 282 | mc6846.csr &= ~2; |
| 283 | if ( mc6846.csr2_to_be_cleared ) | |
| 283 | if ( mc6846.csr2_to_be_cleared ) | |
| 284 | 284 | mc6846.csr &= ~4; |
| 285 | 285 | mc6846_update_irq(); |
| 286 | 286 | mc6846.csr1_to_be_cleared = 0; |
| r1461 | r1462 | |
| 294 | 294 | |
| 295 | 295 | case 6: |
| 296 | 296 | LOG (( "$%04x %f: mc6846 COUNTER hi read $%02X\n", activecpu_get_previouspc(), attotime_to_double(timer_get_time()), mc6846_counter() >> 8 )); |
| 297 | if ( mc6846.csr0_to_be_cleared ) | |
| 297 | if ( mc6846.csr0_to_be_cleared ) | |
| 298 | 298 | { |
| 299 | 299 | mc6846.csr &= ~1; |
| 300 | 300 | mc6846_update_irq(); |
| r1461 | r1462 | |
| 304 | 304 | |
| 305 | 305 | case 7: |
| 306 | 306 | LOG (( "$%04x %f: mc6846 COUNTER low read $%02X\n", activecpu_get_previouspc(), attotime_to_double(timer_get_time()), mc6846_counter() & 0xff )); |
| 307 | if ( mc6846.csr0_to_be_cleared ) | |
| 307 | if ( mc6846.csr0_to_be_cleared ) | |
| 308 | 308 | { |
| 309 | 309 | mc6846.csr &= ~1; |
| 310 | 310 | mc6846_update_irq(); |
| r1461 | r1462 | |
| 322 | 322 | |
| 323 | 323 | WRITE8_HANDLER ( mc6846_w ) |
| 324 | 324 | { |
| 325 | switch ( offset ) | |
| 325 | switch ( offset ) | |
| 326 | 326 | { |
| 327 | 327 | case 0: |
| 328 | 328 | case 4: |
| r1461 | r1462 | |
| 332 | 332 | case 1: |
| 333 | 333 | { |
| 334 | 334 | #if VERBOSE |
| 335 | const char* cp2[8] = | |
| 336 | { | |
| 337 | "in,neg-edge", "in,neg-edge,intr", "in,pos-edge", "in,pos-edge,intr", | |
| 338 | "out,intr-ack", "out,i/o-ack", "out,0", "out,1" | |
| 335 | const char* cp2[8] = | |
| 336 | { | |
| 337 | "in,neg-edge", "in,neg-edge,intr", "in,pos-edge", "in,pos-edge,intr", | |
| 338 | "out,intr-ack", "out,i/o-ack", "out,0", "out,1" | |
| 339 | 339 | }; |
| 340 | 340 | const char* cp1[8] = { |
| 341 | 341 | "neg-edge", "neg-edge,intr", "pos-edge", "pos-edge,intr", |
| 342 | "latched,neg-edge", "latched,neg-edge,intr", | |
| 343 | "latcged,pos-edge", "latcged,pos-edge,intr" | |
| 342 | "latched,neg-edge", "latched,neg-edge,intr", | |
| 343 | "latcged,pos-edge", "latcged,pos-edge,intr" | |
| 344 | 344 | }; |
| 345 | LOG (( "$%04x %f: mc6846 PCR write $%02X reset=%i cp2=%s cp1=%s\n", | |
| 345 | LOG (( "$%04x %f: mc6846 PCR write $%02X reset=%i cp2=%s cp1=%s\n", | |
| 346 | 346 | activecpu_get_previouspc(), attotime_to_double(timer_get_time()), data, |
| 347 | 347 | (data >> 7) & 1, cp2[ (data >> 3) & 7 ], cp1[ data & 7 ] )); |
| 348 | 348 | #endif |
| r1461 | r1462 | |
| 357 | 357 | } |
| 358 | 358 | if ( data & 4 ) |
| 359 | 359 | logerror( "$%04x mc6846 CP1 latching not implemented\n", activecpu_get_previouspc() ); |
| 360 | if (data & 0x20) | |
| 360 | if (data & 0x20) | |
| 361 | 361 | { |
| 362 | if (data & 0x10) | |
| 362 | if (data & 0x10) | |
| 363 | 363 | { |
| 364 | 364 | mc6846.cp2_cpu = (data >> 3) & 1; |
| 365 | 365 | if ( mc6846.iface->out_cp2_func ) |
| r1461 | r1462 | |
| 372 | 372 | |
| 373 | 373 | case 2: |
| 374 | 374 | LOG (( "$%04x %f: mc6846 DDR write $%02X\n", activecpu_get_previouspc(), attotime_to_double(timer_get_time()), data )); |
| 375 | if ( ! (mc6846.pcr & 0x80) ) | |
| 375 | if ( ! (mc6846.pcr & 0x80) ) | |
| 376 | 376 | { |
| 377 | 377 | mc6846.ddr = data; |
| 378 | if ( mc6846.iface->out_port_func ) | |
| 378 | if ( mc6846.iface->out_port_func ) | |
| 379 | 379 | mc6846.iface->out_port_func( 0, mc6846.pdr & mc6846.ddr ); |
| 380 | 380 | } |
| 381 | 381 | break; |
| 382 | ||
| 382 | ||
| 383 | 383 | case 3: |
| 384 | 384 | LOG (( "$%04x %f: mc6846 PORT write $%02X (mask=$%02X)\n", activecpu_get_previouspc(), attotime_to_double(timer_get_time()), data,mc6846.ddr )); |
| 385 | if ( ! (mc6846.pcr & 0x80) ) | |
| 385 | if ( ! (mc6846.pcr & 0x80) ) | |
| 386 | 386 | { |
| 387 | 387 | mc6846.pdr = data; |
| 388 | if ( mc6846.iface->out_port_func ) | |
| 388 | if ( mc6846.iface->out_port_func ) | |
| 389 | 389 | mc6846.iface->out_port_func( 0, mc6846.pdr & mc6846.ddr ); |
| 390 | if ( mc6846.csr1_to_be_cleared && (mc6846.csr & 2) ) | |
| 390 | if ( mc6846.csr1_to_be_cleared && (mc6846.csr & 2) ) | |
| 391 | 391 | { |
| 392 | 392 | mc6846.csr &= ~2; |
| 393 | 393 | LOG (( "$%04x %f: mc6846 CP1 intr reset\n", activecpu_get_previouspc(), attotime_to_double(timer_get_time()) )); |
| r1461 | r1462 | |
| 406 | 406 | case 5: |
| 407 | 407 | { |
| 408 | 408 | #if VERBOSE |
| 409 | const char* mode[8] = | |
| 410 | { | |
| 411 | "continuous", "cascaded", "continuous", "one-shot", | |
| 409 | const char* mode[8] = | |
| 410 | { | |
| 411 | "continuous", "cascaded", "continuous", "one-shot", | |
| 412 | 412 | "freq-cmp", "freq-cmp", "pulse-cmp", "pulse-cmp" |
| 413 | 413 | }; |
| 414 | LOG (( "$%04x %f: mc6846 TCR write $%02X reset=%i clock=%s scale=%i mode=%s out=%s\n", | |
| 414 | LOG (( "$%04x %f: mc6846 TCR write $%02X reset=%i clock=%s scale=%i mode=%s out=%s\n", | |
| 415 | 415 | activecpu_get_previouspc(), attotime_to_double(timer_get_time()), data, |
| 416 | 416 | (data >> 7) & 1, (data & 0x40) ? "extern" : "sys", |
| 417 | 417 | (data & 0x40) ? 1 : 8, mode[ (data >> 1) & 7 ], |
| 418 | 418 | (data & 1) ? "enabled" : "0" )); |
| 419 | 419 | #endif |
| 420 | 420 | mc6846.tcr = data; |
| 421 | if ( mc6846.tcr & 1 ) | |
| 421 | if ( mc6846.tcr & 1 ) | |
| 422 | 422 | { |
| 423 | 423 | /* timer preset = initialization without launch */ |
| 424 | 424 | mc6846.preset = mc6846.latch; |
| 425 | 425 | mc6846.csr &= ~1; |
| 426 | if ( MODE != 0x30 ) | |
| 426 | if ( MODE != 0x30 ) | |
| 427 | 427 | mc6846.cto = 0; |
| 428 | 428 | mc6846_update_cto(); |
| 429 | 429 | timer_reset( mc6846.interval, attotime_never ); |
| 430 | 430 | timer_reset( mc6846.one_shot, attotime_never ); |
| 431 | 431 | mc6846.timer_started = 0; |
| 432 | 432 | } |
| 433 | else | |
| 433 | else | |
| 434 | 434 | { |
| 435 | 435 | /* timer launch */ |
| 436 | if ( ! mc6846.timer_started ) | |
| 436 | if ( ! mc6846.timer_started ) | |
| 437 | 437 | mc6846_timer_launch(); |
| 438 | 438 | } |
| 439 | 439 | mc6846_update_irq(); |
| 440 | 440 | } |
| 441 | 441 | break; |
| 442 | ||
| 442 | ||
| 443 | 443 | case 6: |
| 444 | 444 | mc6846.time_MSB = data; |
| 445 | 445 | break; |
| r1461 | r1462 | |
| 447 | 447 | case 7: |
| 448 | 448 | mc6846.latch = ( ((UINT16) mc6846.time_MSB) << 8 ) + data; |
| 449 | 449 | LOG (( "$%04x %f: mc6846 COUNT write %i\n", activecpu_get_previouspc(), attotime_to_double(timer_get_time()), mc6846.latch )); |
| 450 | if (!(mc6846.tcr & 0x38)) | |
| 450 | if (!(mc6846.tcr & 0x38)) | |
| 451 | 451 | { |
| 452 | 452 | /* timer initialization */ |
| 453 | 453 | mc6846.preset = mc6846.latch; |
| r1461 | r1462 | |
| 456 | 456 | mc6846.cto = 0; |
| 457 | 457 | mc6846_update_cto(); |
| 458 | 458 | /* launch only if started */ |
| 459 | if (!(mc6846.tcr & 1)) | |
| 459 | if (!(mc6846.tcr & 1)) | |
| 460 | 460 | mc6846_timer_launch(); |
| 461 | 461 | } |
| 462 | 462 | break; |
| 463 | ||
| 463 | ||
| 464 | 464 | default: |
| 465 | 465 | logerror( "$%04x mc6846 invalid write offset %i\n", activecpu_get_previouspc(), offset ); |
| 466 | 466 | } |
| r1461 | r1462 | |
| 475 | 475 | void mc6846_set_input_cp1 ( int data ) |
| 476 | 476 | { |
| 477 | 477 | data = (data != 0 ); |
| 478 | if ( data == mc6846.cp1 ) | |
| 478 | if ( data == mc6846.cp1 ) | |
| 479 | 479 | return; |
| 480 | 480 | mc6846.cp1 = data; |
| 481 | 481 | LOG (( "%f: mc6846 input CP1 set to %i\n", attotime_to_double(timer_get_time()), data )); |
| 482 | if (( data && (mc6846.pcr & 2)) || (!data && !(mc6846.pcr & 2))) | |
| 482 | if (( data && (mc6846.pcr & 2)) || (!data && !(mc6846.pcr & 2))) | |
| 483 | 483 | { |
| 484 | 484 | mc6846.csr |= 2; |
| 485 | 485 | mc6846_update_irq(); |
| r1461 | r1462 | |
| 489 | 489 | void mc6846_set_input_cp2 ( int data ) |
| 490 | 490 | { |
| 491 | 491 | data = (data != 0 ); |
| 492 | if ( data == mc6846.cp2 ) | |
| 492 | if ( data == mc6846.cp2 ) | |
| 493 | 493 | return; |
| 494 | 494 | mc6846.cp2 = data; |
| 495 | 495 | LOG (( "%f: mc6846 input CP2 set to %i\n", attotime_to_double(timer_get_time()), data )); |
| 496 | if (mc6846.pcr & 0x20) | |
| 496 | if (mc6846.pcr & 0x20) | |
| 497 | 497 | { |
| 498 | if (( data && (mc6846.pcr & 0x10)) || (!data && !(mc6846.pcr & 0x10))) | |
| 498 | if (( data && (mc6846.pcr & 0x10)) || (!data && !(mc6846.pcr & 0x10))) | |
| 499 | 499 | { |
| 500 | 500 | mc6846.csr |= 4; |
| 501 | 501 | mc6846_update_irq(); |
| 502 | } | |
| 502 | } | |
| 503 | 503 | } |
| 504 | 504 | } |
| 505 | 505 | |
| r1461 | r1462 | |
| 573 | 573 | mc6846.iface = iface; |
| 574 | 574 | mc6846.interval = timer_alloc( mc6846_timer_expire , NULL); |
| 575 | 575 | mc6846.one_shot = timer_alloc( mc6846_timer_one_shot , NULL); |
| 576 | ||
| 576 | ||
| 577 | 577 | state_save_register_item( "mc6846", 0, mc6846.csr ); |
| 578 | 578 | state_save_register_item( "mc6846", 0, mc6846.pcr ); |
| 579 | 579 | state_save_register_item( "mc6846", 0, mc6846.ddr ); |
| r1461 | r1462 | |
|---|---|---|
| 68 | 68 | |
| 69 | 69 | if ( state ) |
| 70 | 70 | thom_irq |= 1 << line; |
| 71 | else | |
| 71 | else | |
| 72 | 72 | thom_irq &= ~(1 << line); |
| 73 | 73 | |
| 74 | 74 | #if VERBOSE_IRQ |
| r1461 | r1462 | |
| 85 | 85 | |
| 86 | 86 | static void thom_set_firq ( int line, int state ) |
| 87 | 87 | { |
| 88 | ||
| 88 | ||
| 89 | 89 | #if VERBOSE_IRQ |
| 90 | 90 | int old = thom_irq; |
| 91 | 91 | #endif |
| 92 | ||
| 93 | if ( state ) | |
| 92 | ||
| 93 | if ( state ) | |
| 94 | 94 | thom_firq |= 1 << line; |
| 95 | else | |
| 95 | else | |
| 96 | 96 | thom_firq &= ~(1 << line); |
| 97 | ||
| 97 | ||
| 98 | 98 | #if VERBOSE_IRQ |
| 99 | 99 | if ( !old && thom_firq ) |
| 100 | 100 | logerror( "%f thom_set_firq: firq line up %i\n", attotime_to_double(timer_get_time()), line ); |
| 101 | 101 | if ( old && !thom_firq ) |
| 102 | 102 | logerror( "%f thom_set_firq: firq line down %i\n", attotime_to_double(timer_get_time()), line ); |
| 103 | 103 | #endif |
| 104 | ||
| 104 | ||
| 105 | 105 | cpunum_set_input_line( 0, M6809_FIRQ_LINE, thom_firq ? ASSERT_LINE : CLEAR_LINE ); |
| 106 | 106 | } |
| 107 | 107 | |
| r1461 | r1462 | |
| 125 | 125 | |
| 126 | 126 | |
| 127 | 127 | |
| 128 | static void thom_irq_0 ( int state ) | |
| 128 | static void thom_irq_0 ( int state ) | |
| 129 | 129 | { |
| 130 | thom_set_irq ( 0, state ); | |
| 130 | thom_set_irq ( 0, state ); | |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | static void thom_irq_1 ( int state ) | |
| 134 | { | |
| 135 | thom_set_irq ( 1, state ); | |
| 133 | static void thom_irq_1 ( int state ) | |
| 134 | { | |
| 135 | thom_set_irq ( 1, state ); | |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | static void thom_irq_3 ( int state ) | |
| 139 | { | |
| 140 | thom_set_irq ( 3, state ); | |
| 138 | static void thom_irq_3 ( int state ) | |
| 139 | { | |
| 140 | thom_set_irq ( 3, state ); | |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | static void thom_firq_1 ( int state ) | |
| 144 | { | |
| 145 | thom_set_firq ( 1, state ); | |
| 143 | static void thom_firq_1 ( int state ) | |
| 144 | { | |
| 145 | thom_set_firq ( 1, state ); | |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | static void thom_firq_2 ( int state ) | |
| 149 | { | |
| 150 | thom_set_firq ( 2, state ); | |
| 148 | static void thom_firq_2 ( int state ) | |
| 149 | { | |
| 150 | thom_set_firq ( 2, state ); | |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | #ifdef CHARDEV |
| 154 | static void thom_irq_4 ( int state ) | |
| 155 | { | |
| 156 | thom_set_irq ( 4, state ); | |
| 154 | static void thom_irq_4 ( int state ) | |
| 155 | { | |
| 156 | thom_set_irq ( 4, state ); | |
| 157 | 157 | } |
| 158 | 158 | #endif |
| 159 | 159 | |
| 160 | 160 | |
| 161 | /* | |
| 161 | /* | |
| 162 | 162 | current IRQ usage: |
| 163 | 163 | |
| 164 | 164 | line 0 => 6846 interrupt |
| r1461 | r1462 | |
| 192 | 192 | int thom_serial_init ( mess_image *image ) |
| 193 | 193 | { |
| 194 | 194 | int idx = image_index_in_device(image); |
| 195 | ||
| 196 | if ( serial_device_init( image ) != INIT_PASS ) | |
| 195 | ||
| 196 | if ( serial_device_init( image ) != INIT_PASS ) | |
| 197 | 197 | return INIT_FAIL; |
| 198 | ||
| 198 | ||
| 199 | 199 | switch ( idx ) { |
| 200 | ||
| 200 | ||
| 201 | 201 | case THOM_SERIAL_CC90323: |
| 202 | 202 | LOG(( "thom_serial_init: init CD 90-320 RS232 device\n" )); |
| 203 | 203 | serial_device_connect( image , &to7_io_line ); |
| 204 | 204 | break; |
| 205 | ||
| 205 | ||
| 206 | 206 | case THOM_SERIAL_RF57232: |
| 207 | 207 | LOG(( "thom_serial_init: init RF 57-232 RS232 device\n" )); |
| 208 | 208 | acia_6551_connect_to_serial_device( image ); |
| 209 | 209 | break; |
| 210 | ||
| 210 | ||
| 211 | 211 | case THOM_SERIAL_MODEM: |
| 212 | 212 | LOG(( "thom_serial_init: init MODEM (MD 90-120) device\n" )); |
| 213 | 213 | break; |
| 214 | ||
| 214 | ||
| 215 | 215 | default: |
| 216 | 216 | logerror( "thom_serial_init: unknown serial device index %i\n", idx ); |
| 217 | 217 | return INIT_FAIL; |
| 218 | 218 | } |
| 219 | ||
| 219 | ||
| 220 | 220 | serial_device_setup( image, 2400, 7, 2, SERIAL_PARITY_NONE ); /* default */ |
| 221 | 221 | serial_device_set_protocol( image, SERIAL_PROTOCOL_NONE ); |
| 222 | 222 | serial_device_set_transmit_state( image, 1 ); |
| 223 | ||
| 223 | ||
| 224 | 224 | return INIT_PASS; |
| 225 | 225 | } |
| 226 | 226 | |
| r1461 | r1462 | |
| 236 | 236 | int thom_serial_load ( mess_image* image ) |
| 237 | 237 | { |
| 238 | 238 | int idx = image_index_in_device( image ); |
| 239 | ||
| 240 | if ( serial_device_load( image ) != INIT_PASS ) | |
| 239 | ||
| 240 | if ( serial_device_load( image ) != INIT_PASS ) | |
| 241 | 241 | { |
| 242 | 242 | logerror( "thom_serial_load: could not load serial image in device %i\n", idx ); |
| 243 | 243 | return INIT_FAIL; |
| 244 | 244 | } |
| 245 | ||
| 245 | ||
| 246 | 246 | return INIT_PASS; |
| 247 | 247 | } |
| 248 | 248 | |
| r1461 | r1462 | |
| 280 | 280 | char name[129]; |
| 281 | 281 | |
| 282 | 282 | /* get size & number of 16-KB banks */ |
| 283 | if ( size <= 0x04000 ) | |
| 283 | if ( size <= 0x04000 ) | |
| 284 | 284 | thom_cart_nb_banks = 1; |
| 285 | else if ( size == 0x08000 ) | |
| 285 | else if ( size == 0x08000 ) | |
| 286 | 286 | thom_cart_nb_banks = 2; |
| 287 | else if ( size == 0x10000 ) | |
| 287 | else if ( size == 0x10000 ) | |
| 288 | 288 | thom_cart_nb_banks = 4; |
| 289 | else | |
| 289 | else | |
| 290 | 290 | { |
| 291 | 291 | logerror( "to7_cartridge_load: invalid cartridge size %i\n", size ); |
| 292 | 292 | return INIT_FAIL; |
| 293 | 293 | } |
| 294 | 294 | |
| 295 | if ( image_fread( image, pos, size ) != size ) | |
| 295 | if ( image_fread( image, pos, size ) != size ) | |
| 296 | 296 | { |
| 297 | 297 | logerror( "to7_cartridge_load: read error\n" ); |
| 298 | 298 | return INIT_FAIL; |
| r1461 | r1462 | |
| 307 | 307 | /* sanitize name */ |
| 308 | 308 | for ( i = 0; name[i]; i++) |
| 309 | 309 | { |
| 310 | if ( name[i] < ' ' || name[i] >= 127 ) | |
| 310 | if ( name[i] < ' ' || name[i] >= 127 ) | |
| 311 | 311 | name[i] = '?'; |
| 312 | 312 | } |
| 313 | ||
| 313 | ||
| 314 | 314 | PRINT (( "to7_cartridge_load: cartridge \"%s\" banks=%i, size=%i\n", name, thom_cart_nb_banks, size )); |
| 315 | 315 | |
| 316 | 316 | return INIT_PASS; |
| r1461 | r1462 | |
| 322 | 322 | { |
| 323 | 323 | static int old_bank = -1; |
| 324 | 324 | int bank = 0; |
| 325 | if ( thom_cart_nb_banks ) | |
| 325 | if ( thom_cart_nb_banks ) | |
| 326 | 326 | { |
| 327 | 327 | bank = thom_cart_bank % thom_cart_nb_banks; |
| 328 | 328 | memory_install_read8_handler( 0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x0003, 0, 0, to7_cartridge_r ); |
| r1461 | r1462 | |
| 342 | 342 | /* write signal to 0000-1fff generates a bank switch */ |
| 343 | 343 | WRITE8_HANDLER ( to7_cartridge_w ) |
| 344 | 344 | { |
| 345 | if ( offset >= 0x2000 ) | |
| 345 | if ( offset >= 0x2000 ) | |
| 346 | 346 | return; |
| 347 | 347 | |
| 348 | 348 | thom_cart_bank = offset & 3; |
| r1461 | r1462 | |
| 372 | 372 | thom_set_mode_point( data & 1 ); /* bit 0: video bank switch */ |
| 373 | 373 | thom_set_caps_led( (data & 8) ? 1 : 0 ) ; /* bit 3: keyboard led */ |
| 374 | 374 | thom_set_border_color( ((data & 0x10) ? 1 : 0) | /* bits 4-6: border color */ |
| 375 | ((data & 0x20) ? 2 : 0) | | |
| 375 | ((data & 0x20) ? 2 : 0) | | |
| 376 | 376 | ((data & 0x40) ? 4 : 0) ); |
| 377 | 377 | } |
| 378 | 378 | |
| r1461 | r1462 | |
| 402 | 402 | |
| 403 | 403 | |
| 404 | 404 | |
| 405 | static const mc6846_interface to7_timer = | |
| 406 | { | |
| 407 | to7_timer_port_out, NULL, to7_timer_cp2_out, | |
| 408 | to7_timer_port_in, to7_timer_tco_out, | |
| 409 | thom_irq_0 | |
| 405 | static const mc6846_interface to7_timer = | |
| 406 | { | |
| 407 | to7_timer_port_out, NULL, to7_timer_cp2_out, | |
| 408 | to7_timer_port_in, to7_timer_tco_out, | |
| 409 | thom_irq_0 | |
| 410 | 410 | }; |
| 411 | 411 | |
| 412 | 412 | |
| r1461 | r1462 | |
| 423 | 423 | |
| 424 | 424 | static void to7_lightpen_cb ( int step ) |
| 425 | 425 | { |
| 426 | if ( ! to7_lightpen ) | |
| 426 | if ( ! to7_lightpen ) | |
| 427 | 427 | return; |
| 428 | 428 | |
| 429 | 429 | #if VERBOSE_VIDEO |
| 430 | 430 | logerror( "%f to7_lightpen_cb: step=%i\n", attotime_to_double(timer_get_time()), step ); |
| 431 | 431 | #endif |
| 432 | ||
| 432 | ||
| 433 | 433 | pia_set_input_cb1( THOM_PIA_SYS, 1 ); |
| 434 | 434 | pia_set_input_cb1( THOM_PIA_SYS, 0 ); |
| 435 | 435 | to7_lightpen_step = step; |
| r1461 | r1462 | |
| 459 | 459 | |
| 460 | 460 | |
| 461 | 461 | static WRITE8_HANDLER ( to7_sys_cb2_out ) |
| 462 | { | |
| 462 | { | |
| 463 | 463 | to7_lightpen = !data; |
| 464 | 464 | } |
| 465 | 465 | |
| 466 | 466 | |
| 467 | 467 | |
| 468 | 468 | static WRITE8_HANDLER ( to7_sys_portb_out ) |
| 469 | { | |
| 469 | { | |
| 470 | 470 | /* value fetched in to7_sys_porta_in */ |
| 471 | 471 | } |
| 472 | 472 | |
| r1461 | r1462 | |
| 478 | 478 | |
| 479 | 479 | static READ8_HANDLER ( to7_sys_porta_in ) |
| 480 | 480 | { |
| 481 | if ( to7_lightpen ) | |
| 481 | if ( to7_lightpen ) | |
| 482 | 482 | { |
| 483 | 483 | /* lightpen hi */ |
| 484 | 484 | return to7_lightpen_gpl( TO7_LIGHTPEN_DECAL, to7_lightpen_step ) >> 8; |
| 485 | 485 | } |
| 486 | else | |
| 486 | else | |
| 487 | 487 | { |
| 488 | 488 | /* keyboard */ |
| 489 | 489 | int keyline = pia_get_output_b( THOM_PIA_SYS ); |
| r1461 | r1462 | |
| 495 | 495 | val &= readinputport( THOM_INPUT_KEYBOARD + i ); |
| 496 | 496 | } |
| 497 | 497 | return val; |
| 498 | } | |
| 498 | } | |
| 499 | 499 | } |
| 500 | 500 | |
| 501 | 501 | |
| r1461 | r1462 | |
| 508 | 508 | |
| 509 | 509 | |
| 510 | 510 | |
| 511 | static const pia6821_interface to7_sys = | |
| 511 | static const pia6821_interface to7_sys = | |
| 512 | 512 | { |
| 513 | to7_sys_porta_in, to7_sys_portb_in, | |
| 513 | to7_sys_porta_in, to7_sys_portb_in, | |
| 514 | 514 | NULL, NULL, NULL, NULL, |
| 515 | 515 | NULL, to7_sys_portb_out, to7_set_cassette_motor, to7_sys_cb2_out, |
| 516 | 516 | thom_firq_1, thom_firq_1 |
| r1461 | r1462 | |
| 532 | 532 | |
| 533 | 533 | |
| 534 | 534 | |
| 535 | typedef enum | |
| 535 | typedef enum | |
| 536 | 536 | { |
| 537 | 537 | TO7_IO_NONE, |
| 538 | 538 | TO7_IO_CENTRONICS, |
| r1461 | r1462 | |
| 569 | 569 | { |
| 570 | 570 | int tx = data & 1; |
| 571 | 571 | int dtr = ( data & 2 ) ? 1 : 0; |
| 572 | ||
| 572 | ||
| 573 | 573 | #if VERBOSE_IO |
| 574 | 574 | logerror( "$%04x %f to7_io_porta_out: tx=%i, dtr=%i\n", activecpu_get_previouspc(), attotime_to_double(timer_get_time()), tx, dtr ); |
| 575 | 575 | #endif |
| 576 | 576 | |
| 577 | if ( dtr ) | |
| 577 | if ( dtr ) | |
| 578 | 578 | to7_io_line.State |= SERIAL_STATE_DTR; |
| 579 | else | |
| 579 | else | |
| 580 | 580 | to7_io_line.State &= ~SERIAL_STATE_DTR; |
| 581 | 581 | |
| 582 | 582 | set_out_data_bit( to7_io_line.State, tx ); |
| r1461 | r1462 | |
| 590 | 590 | int cts = 1; |
| 591 | 591 | int dsr = ( to7_io_line.input_state & SERIAL_STATE_DSR ) ? 0 : 1; |
| 592 | 592 | int rd = get_in_data_bit( to7_io_line.input_state ); |
| 593 | ||
| 593 | ||
| 594 | 594 | if ( to7_io_mode() == TO7_IO_RS232 ) |
| 595 | 595 | cts = to7_io_line.input_state & SERIAL_STATE_CTS ? 0 : 1; |
| 596 | 596 | else |
| 597 | 597 | cts = ( centronics_read_handshake( 0 ) & CENTRONICS_NOT_BUSY ) ? 1 : 0; |
| 598 | ||
| 598 | ||
| 599 | 599 | #if VERBOSE_IO |
| 600 | 600 | logerror( "$%04x %f to7_io_porta_in: mode=%i cts=%i, dsr=%i, rd=%i\n", activecpu_get_previouspc(), attotime_to_double(timer_get_time()), to7_io_mode(), cts, dsr, rd ); |
| 601 | 601 | #endif |
| 602 | ||
| 602 | ||
| 603 | 603 | return (dsr ? 0x20 : 0) | (cts ? 0x40 : 0) | (rd ? 0x80: 0); |
| 604 | 604 | } |
| 605 | 605 | |
| r1461 | r1462 | |
| 609 | 609 | { |
| 610 | 610 | /* set 8-bit data */ |
| 611 | 611 | |
| 612 | #if VERBOSE_IO | |
| 612 | #if VERBOSE_IO | |
| 613 | 613 | logerror( "$%04x %f to7_io_portb_out: CENTRONICS set data=$%02X\n", activecpu_get_previouspc(), attotime_to_double(timer_get_time()), data ); |
| 614 | 614 | #endif |
| 615 | 615 | |
| r1461 | r1462 | |
| 622 | 622 | { |
| 623 | 623 | /* send STROBE to printer */ |
| 624 | 624 | |
| 625 | #if VERBOSE_IO | |
| 625 | #if VERBOSE_IO | |
| 626 | 626 | logerror( "$%04x %f to7_io_cb2_out: CENTRONICS set strobe=%i\n", activecpu_get_previouspc(), attotime_to_double(timer_get_time()), data ); |
| 627 | 627 | #endif |
| 628 | 628 | |
| r1461 | r1462 | |
| 644 | 644 | |
| 645 | 645 | |
| 646 | 646 | |
| 647 | static const pia6821_interface to7_io = | |
| 647 | static const pia6821_interface to7_io = | |
| 648 | 648 | { |
| 649 | 649 | to7_io_porta_in, NULL, NULL, NULL, NULL, NULL, |
| 650 | 650 | to7_io_porta_out, to7_io_portb_out, NULL, to7_io_cb2_out, |
| r1461 | r1462 | |
| 659 | 659 | |
| 660 | 660 | static void thom_centronics_reset( void ) |
| 661 | 661 | { |
| 662 | centronics_write_handshake | |
| 663 | ( 0, | |
| 662 | centronics_write_handshake | |
| 663 | ( 0, | |
| 664 | 664 | CENTRONICS_SELECT | CENTRONICS_NOT_BUSY | CENTRONICS_STROBE, |
| 665 | 665 | CENTRONICS_SELECT | CENTRONICS_NO_RESET | CENTRONICS_NOT_BUSY | |
| 666 | 666 | CENTRONICS_STROBE | CENTRONICS_ACKNOWLEDGE ); |
| r1461 | r1462 | |
| 748 | 748 | |
| 749 | 749 | |
| 750 | 750 | |
| 751 | static const pia6821_interface to7_pia_modem = | |
| 751 | static const pia6821_interface to7_pia_modem = | |
| 752 | 752 | { |
| 753 | 753 | NULL, NULL, NULL, NULL, NULL, NULL, |
| 754 | NULL, NULL, NULL, NULL, | |
| 754 | NULL, NULL, NULL, NULL, | |
| 755 | 755 | NULL, NULL |
| 756 | 756 | }; |
| 757 | 757 | |
| 758 | 758 | |
| 759 | 759 | |
| 760 | static const struct acia6850_interface to7_acia_modem = | |
| 760 | static const struct acia6850_interface to7_acia_modem = | |
| 761 | 761 | { |
| 762 | 762 | 1200, 1200, /* 1200 bauds, might be divided by 16 */ |
| 763 | 763 | &to7_modem_rx, &to7_modem_tx, |
| r1461 | r1462 | |
| 797 | 797 | { |
| 798 | 798 | if ( readinputport( THOM_INPUT_MCONFIG ) & 1 ) |
| 799 | 799 | return mea8000_r( offset ); |
| 800 | else | |
| 800 | else | |
| 801 | 801 | { |
| 802 | 802 | switch ( offset ) { |
| 803 | 803 | case 0: return acia6850_0_stat_r( 0 ); |
| r1461 | r1462 | |
| 813 | 813 | { |
| 814 | 814 | if ( readinputport( THOM_INPUT_MCONFIG ) & 1 ) |
| 815 | 815 | mea8000_w( offset, data ); |
| 816 | else | |
| 816 | else | |
| 817 | 817 | { |
| 818 | 818 | switch ( offset ) { |
| 819 | 819 | case 0: acia6850_0_ctrl_w( 0, data ); break; |
| r1461 | r1462 | |
| 827 | 827 | /* ------------ SX 90-018 (model 2) music & game extension ------------ */ |
| 828 | 828 | |
| 829 | 829 | /* features: |
| 830 | - 6821 PIA | |
| 830 | - 6821 PIA | |
| 831 | 831 | - two 8-position, 2-button game pads |
| 832 | 832 | - 2-button mouse (exclusive with pads) |
| 833 | 833 | do not confuse with the TO9-specific mouse |
| r1461 | r1462 | |
| 854 | 854 | axis rotation. The two signals are not in phase, so that whether A is |
| 855 | 855 | toggled before B or B before A gives the direction of rotation. |
| 856 | 856 | This is similar Atari & Amiga mouses. |
| 857 | Returns: 0 0 0 0 0 0 YB XB YA XA | |
| 857 | Returns: 0 0 0 0 0 0 YB XB YA XA | |
| 858 | 858 | */ |
| 859 | 859 | static UINT8 to7_get_mouse_signal( void ) |
| 860 | 860 | { |
| r1461 | r1462 | |
| 880 | 880 | static READ8_HANDLER ( to7_game_porta_in ) |
| 881 | 881 | { |
| 882 | 882 | UINT8 data; |
| 883 | if ( readinputport( THOM_INPUT_CONFIG ) & 1 ) | |
| 883 | if ( readinputport( THOM_INPUT_CONFIG ) & 1 ) | |
| 884 | 884 | { |
| 885 | 885 | /* mouse */ |
| 886 | 886 | data = to7_get_mouse_signal() & 0x0c; /* XB, YB */ |
| 887 | 887 | data |= readinputport( THOM_INPUT_GAME + 4 ) & 3; /* buttons */ |
| 888 | 888 | } |
| 889 | else | |
| 889 | else | |
| 890 | 890 | { |
| 891 | 891 | /* joystick */ |
| 892 | 892 | data = readinputport( THOM_INPUT_GAME ); |
| r1461 | r1462 | |
| 896 | 896 | bit 3=0 => P1 right bit 7=0 => P2 right |
| 897 | 897 | */ |
| 898 | 898 | /* remove impossible combinations: up+down, left+right */ |
| 899 | if ( ! ( data & 0x03 ) ) | |
| 899 | if ( ! ( data & 0x03 ) ) | |
| 900 | 900 | data |= 0x03; |
| 901 | if ( ! ( data & 0x0c ) ) | |
| 901 | if ( ! ( data & 0x0c ) ) | |
| 902 | 902 | data |= 0x0c; |
| 903 | if ( ! ( data & 0x30 ) ) | |
| 903 | if ( ! ( data & 0x30 ) ) | |
| 904 | 904 | data |= 0x30; |
| 905 | if ( ! ( data & 0xc0 ) ) | |
| 905 | if ( ! ( data & 0xc0 ) ) | |
| 906 | 906 | data |= 0xc0; |
| 907 | if ( ! ( data & 0x03 ) ) | |
| 907 | if ( ! ( data & 0x03 ) ) | |
| 908 | 908 | data |= 0x03; |
| 909 | if ( ! ( data & 0x0c ) ) | |
| 909 | if ( ! ( data & 0x0c ) ) | |
| 910 | 910 | data |= 0x0c; |
| 911 | if ( ! ( data & 0x30 ) ) | |
| 911 | if ( ! ( data & 0x30 ) ) | |
| 912 | 912 | data |= 0x30; |
| 913 | 913 | if ( ! ( data & 0xc0 ) ) |
| 914 | 914 | data |= 0xc0; |
| r1461 | r1462 | |
| 921 | 921 | static READ8_HANDLER ( to7_game_portb_in ) |
| 922 | 922 | { |
| 923 | 923 | UINT8 data; |
| 924 | if ( readinputport( THOM_INPUT_CONFIG ) & 1 ) | |
| 924 | if ( readinputport( THOM_INPUT_CONFIG ) & 1 ) | |
| 925 | 925 | { |
| 926 | 926 | /* mouse */ |
| 927 | 927 | UINT8 mouse = to7_get_mouse_signal(); |
| 928 | 928 | data = 0; |
| 929 | if ( mouse & 1 ) | |
| 929 | if ( mouse & 1 ) | |
| 930 | 930 | data |= 0x04; /* XA */ |
| 931 | if ( mouse & 2 ) | |
| 931 | if ( mouse & 2 ) | |
| 932 | 932 | data |= 0x40; /* YA */ |
| 933 | 933 | } |
| 934 | else | |
| 934 | else | |
| 935 | 935 | { |
| 936 | 936 | /* joystick */ |
| 937 | 937 | /* bits 6-7: action buttons A (0=pressed) */ |
| r1461 | r1462 | |
| 955 | 955 | |
| 956 | 956 | |
| 957 | 957 | static WRITE8_HANDLER ( to7_game_cb2_out ) |
| 958 | { | |
| 958 | { | |
| 959 | 959 | /* undocumented */ |
| 960 | 960 | /* some TO8 games (e.g.: F15) seem to write here a lot */ |
| 961 | 961 | } |
| 962 | 962 | |
| 963 | 963 | |
| 964 | 964 | |
| 965 | static const pia6821_interface to7_game = | |
| 965 | static const pia6821_interface to7_game = | |
| 966 | 966 | { |
| 967 | 967 | to7_game_porta_in, to7_game_portb_in, |
| 968 | 968 | NULL, NULL, NULL, NULL, |
| r1461 | r1462 | |
| 975 | 975 | /* this should be called periodically */ |
| 976 | 976 | static TIMER_CALLBACK(to7_game_update_cb) |
| 977 | 977 | { |
| 978 | if ( readinputport( THOM_INPUT_CONFIG ) & 1 ) | |
| 978 | if ( readinputport( THOM_INPUT_CONFIG ) & 1 ) | |
| 979 | 979 | { |
| 980 | 980 | /* mouse */ |
| 981 | 981 | UINT8 mouse = to7_get_mouse_signal(); |
| 982 | 982 | pia_set_input_ca1( THOM_PIA_GAME, (mouse & 1) ? 1 : 0 ); /* XA */ |
| 983 | 983 | pia_set_input_ca2( THOM_PIA_GAME, (mouse & 2) ? 1 : 0 ); /* YA */ |
| 984 | 984 | } |
| 985 | else | |
| 985 | else | |
| 986 | 986 | { |
| 987 | 987 | /* joystick */ |
| 988 | 988 | UINT8 in = readinputport( THOM_INPUT_GAME ); |
| r1461 | r1462 | |
| 1051 | 1051 | |
| 1052 | 1052 | Emulation is based on the Motorola 6850 documentation, not EF 6850. |
| 1053 | 1053 | |
| 1054 | We do not emulate the seral line but pass bytes directly between the | |
| 1054 | We do not emulate the seral line but pass bytes directly between the | |
| 1055 | 1055 | 6850 registers and the MIDI device. |
| 1056 | 1056 | */ |
| 1057 | 1057 | |
| r1461 | r1462 | |
| 1068 | 1068 | { |
| 1069 | 1069 | if ( (to7_midi_intr & 4) && (to7_midi_status & ACIA_6850_RDRF) ) |
| 1070 | 1070 | to7_midi_status |= ACIA_6850_irq; /* byte received interrupt */ |
| 1071 | ||
| 1071 | ||
| 1072 | 1072 | if ( (to7_midi_intr & 4) && (to7_midi_status & ACIA_6850_OVRN) ) |
| 1073 | 1073 | to7_midi_status |= ACIA_6850_irq; /* overrun interrupt */ |
| 1074 | ||
| 1074 | ||
| 1075 | 1075 | if ( (to7_midi_intr & 3) == 1 && (to7_midi_status & ACIA_6850_TDRE) ) |
| 1076 | 1076 | to7_midi_status |= ACIA_6850_irq; /* ready to transmit interrupt */ |
| 1077 | ||
| 1077 | ||
| 1078 | 1078 | thom_irq_4( to7_midi_status & ACIA_6850_irq ); |
| 1079 | 1079 | } |
| 1080 | 1080 | |
| r1461 | r1462 | |
| 1083 | 1083 | static void to7_midi_byte_received_cb( chardev_err s ) |
| 1084 | 1084 | { |
| 1085 | 1085 | to7_midi_status |= ACIA_6850_RDRF; |
| 1086 | if ( s == CHARDEV_OVERFLOW ) | |
| 1086 | if ( s == CHARDEV_OVERFLOW ) | |
| 1087 | 1087 | to7_midi_overrun = 1; |
| 1088 | 1088 | to7_midi_update_irq(); |
| 1089 | 1089 | } |
| r1461 | r1462 | |
| 1093 | 1093 | static void to7_midi_ready_to_send_cb( void ) |
| 1094 | 1094 | { |
| 1095 | 1095 | to7_midi_status |= ACIA_6850_TDRE; |
| 1096 | to7_midi_update_irq(); | |
| 1096 | to7_midi_update_irq(); | |
| 1097 | 1097 | } |
| 1098 | 1098 | |
| 1099 | 1099 | |
| r1461 | r1462 | |
| 1101 | 1101 | READ8_HANDLER ( to7_midi_r ) |
| 1102 | 1102 | { |
| 1103 | 1103 | /* ACIA 6850 registers */ |
| 1104 | ||
| 1105 | switch ( offset ) | |
| 1104 | ||
| 1105 | switch ( offset ) | |
| 1106 | 1106 | { |
| 1107 | ||
| 1107 | ||
| 1108 | 1108 | case 0: /* get status */ |
| 1109 | 1109 | /* bit 0: data received */ |
| 1110 | 1110 | /* bit 1: ready to transmit data */ |
| r1461 | r1462 | |
| 1115 | 1115 | /* bit 6: parity error (ignored) */ |
| 1116 | 1116 | /* bit 7: interrupt */ |
| 1117 | 1117 | #if VERBOSE_MIDI |
| 1118 | logerror( "$%04x %f to7_midi_r: status $%02X (rdrf=%i, tdre=%i, ovrn=%i, irq=%i)\n", | |
| 1118 | logerror( "$%04x %f to7_midi_r: status $%02X (rdrf=%i, tdre=%i, ovrn=%i, irq=%i)\n", | |
| 1119 | 1119 | activecpu_get_previouspc(), attotime_to_double(timer_get_time()), to7_midi_status, |
| 1120 | (to7_midi_status & ACIA_6850_RDRF) ? 1 : 0, | |
| 1120 | (to7_midi_status & ACIA_6850_RDRF) ? 1 : 0, | |
| 1121 | 1121 | (to7_midi_status & ACIA_6850_TDRE) ? 1 : 0, |
| 1122 | (to7_midi_status & ACIA_6850_OVRN) ? 1 : 0, | |
| 1122 | (to7_midi_status & ACIA_6850_OVRN) ? 1 : 0, | |
| 1123 | 1123 | (to7_midi_status & ACIA_6850_irq) ? 1 : 0 ); |
| 1124 | 1124 | #endif |
| 1125 | 1125 | return to7_midi_status; |
| 1126 | ||
| 1127 | 1126 | |
| 1127 | ||
| 1128 | 1128 | case 1: /* get input data */ |
| 1129 | 1129 | { |
| 1130 | 1130 | UINT8 data = chardev_in( to7_midi_chardev ); |
| 1131 | 1131 | to7_midi_status &= ~(ACIA_6850_irq | ACIA_6850_RDRF); |
| 1132 | if ( to7_midi_overrun ) | |
| 1132 | if ( to7_midi_overrun ) | |
| 1133 | 1133 | to7_midi_status |= ACIA_6850_OVRN; |
| 1134 | else | |
| 1134 | else | |
| 1135 | 1135 | to7_midi_status &= ~ACIA_6850_OVRN; |
| 1136 | 1136 | to7_midi_overrun = 0; |
| 1137 | 1137 | #if VERBOSE_MIDI |
| 1138 | logerror( "$%04x %f to7_midi_r: read data $%02X\n", | |
| 1138 | logerror( "$%04x %f to7_midi_r: read data $%02X\n", | |
| 1139 | 1139 | activecpu_get_previouspc(), attotime_to_double(timer_get_time()), data ); |
| 1140 | 1140 | #endif |
| 1141 | 1141 | to7_midi_update_irq(); |
| 1142 | 1142 | return data; |
| 1143 | 1143 | } |
| 1144 | ||
| 1145 | 1144 | |
| 1146 | default: | |
| 1145 | ||
| 1146 | default: | |
| 1147 | 1147 | logerror( "$%04x to7_midi_r: invalid offset %i\n", |
| 1148 | 1148 | activecpu_get_previouspc(), offset ); |
| 1149 | 1149 | return 0; |
| r1461 | r1462 | |
| 1155 | 1155 | WRITE8_HANDLER ( to7_midi_w ) |
| 1156 | 1156 | { |
| 1157 | 1157 | /* ACIA 6850 registers */ |
| 1158 | ||
| 1159 | switch ( offset ) | |
| 1158 | ||
| 1159 | switch ( offset ) | |
| 1160 | 1160 | { |
| 1161 | ||
| 1161 | ||
| 1162 | 1162 | case 0: /* set control */ |
| 1163 | 1163 | /* bits 0-1: clock divide (ignored) or reset */ |
| 1164 | if ( (data & 3) == 3 ) | |
| 1164 | if ( (data & 3) == 3 ) | |
| 1165 | 1165 | { |
| 1166 | 1166 | /* reset */ |
| 1167 | 1167 | #if VERBOSE_MIDI |
| r1461 | r1462 | |
| 1172 | 1172 | to7_midi_intr = 0; |
| 1173 | 1173 | chardev_reset( to7_midi_chardev ); |
| 1174 | 1174 | } |
| 1175 | else | |
| 1175 | else | |
| 1176 | 1176 | { |
| 1177 | 1177 | /* bits 2-4: parity */ |
| 1178 | 1178 | /* bits 5-6: interrupt on transmit */ |
| r1461 | r1462 | |
| 1183 | 1183 | static const int bits[8] = { 7,7,7,7,8,8,8,8 }; |
| 1184 | 1184 | static const int stop[8] = { 2,2,1,1,2,1,1,1 }; |
| 1185 | 1185 | static const char parity[8] = { 'e','o','e','o','-','-','e','o' }; |
| 1186 | logerror( "$%04x %f to7_midi_w: set control to $%02X (bits=%i, stop=%i, parity=%c, intr in=%i out=%i)\n", | |
| 1186 | logerror( "$%04x %f to7_midi_w: set control to $%02X (bits=%i, stop=%i, parity=%c, intr in=%i out=%i)\n", | |
| 1187 | 1187 | activecpu_get_previouspc(), attotime_to_double(timer_get_time()), |
| 1188 | data, | |
| 1188 | data, | |
| 1189 | 1189 | bits[ (data >> 2) & 7 ], |
| 1190 | 1190 | stop[ (data >> 2) & 7 ], |
| 1191 | 1191 | parity[ (data >> 2) & 7 ], |
| 1192 | to7_midi_intr >> 2, | |
| 1192 | to7_midi_intr >> 2, | |
| 1193 | 1193 | (to7_midi_intr & 3) ? 1 : 0); |
| 1194 | 1194 | } |
| 1195 | 1195 | #endif |
| 1196 | 1196 | } |
| 1197 | 1197 | to7_midi_update_irq(); |
| 1198 | 1198 | break; |
| 1199 | ||
| 1200 | 1199 | |
| 1200 | ||
| 1201 | 1201 | case 1: /* output data */ |
| 1202 | 1202 | #if VERBOSE_MIDI |
| 1203 | 1203 | logerror( "$%04x %f to7_midi_w: write data $%02X\n", activecpu_get_previouspc(), attotime_to_double(timer_get_time()), data ); |
| 1204 | 1204 | #endif |
| 1205 | if ( data == 0x55 ) | |
| 1205 | if ( data == 0x55 ) | |
| 1206 | 1206 | /* cable-detect: shortcut */ |
| 1207 | 1207 | chardev_fake_in( to7_midi_chardev, 0x55 ); |
| 1208 | else | |
| 1208 | else | |
| 1209 | 1209 | { |
| 1210 | 1210 | /* send to MIDI */ |
| 1211 | 1211 | to7_midi_status &= ~(ACIA_6850_irq | ACIA_6850_TDRE); |
| 1212 | chardev_out( to7_midi_chardev, data ); | |
| 1212 | chardev_out( to7_midi_chardev, data ); | |
| 1213 | 1213 | } |
| 1214 | 1214 | break; |
| 1215 | ||
| 1216 | ||
| 1217 | default: | |
| 1215 | ||
| 1216 | ||
| 1217 | default: | |
| 1218 | 1218 | logerror( "$%04x to7_midi_w: invalid offset %i (data=$%02X) \n", activecpu_get_previouspc(), offset, data ); |
| 1219 | 1219 | } |
| 1220 | 1220 | } |
| 1221 | 1221 | |
| 1222 | 1222 | |
| 1223 | 1223 | |
| 1224 | static chardev_interface to7_midi_interface = | |
| 1224 | static chardev_interface to7_midi_interface = | |
| 1225 | 1225 | { |
| 1226 | 1226 | to7_midi_byte_received_cb, |
| 1227 | 1227 | to7_midi_ready_to_send_cb, |
| r1461 | r1462 | |
| 1295 | 1295 | MACHINE_RESET ( to7 ) |
| 1296 | 1296 | { |
| 1297 | 1297 | LOG (( "to7: machine reset called\n" )); |
| 1298 | ||
| 1298 | ||
| 1299 | 1299 | /* subsystems */ |
| 1300 | 1300 | thom_irq_reset(); |
| 1301 | 1301 | pia_reset(); |
| r1461 | r1462 | |
| 1307 | 1307 | to7_midi_reset(); |
| 1308 | 1308 | to7_rf57932_reset(); |
| 1309 | 1309 | mea8000_reset(); |
| 1310 | ||
| 1310 | ||
| 1311 | 1311 | /* video */ |
| 1312 | 1312 | thom_set_video_mode( THOM_VMODE_TO770 ); |
| 1313 | 1313 | thom_set_init_callback( to7_set_init ); |
| r1461 | r1462 | |
| 1315 | 1315 | thom_set_mode_point( 0 ); |
| 1316 | 1316 | thom_set_border_color( 0 ); |
| 1317 | 1317 | pia_set_input_cb1( THOM_PIA_SYS, 0 ); |
| 1318 | ||
| 1318 | ||
| 1319 | 1319 | /* memory */ |
| 1320 | 1320 | to7_update_cart_bank(); |
| 1321 | 1321 | /* thom_cart_bank not reset */ |
| 1322 | ||
| 1322 | ||
| 1323 | 1323 | /* lightpen */ |
| 1324 | 1324 | to7_lightpen = 0; |
| 1325 | 1325 | } |
| r1461 | r1462 | |
| 1329 | 1329 | MACHINE_START ( to7 ) |
| 1330 | 1330 | { |
| 1331 | 1331 | UINT8* mem = memory_region(REGION_CPU1); |
| 1332 | ||
| 1332 | ||
| 1333 | 1333 | LOG (( "to7: machine start called\n" )); |
| 1334 | ||
| 1334 | ||
| 1335 | 1335 | /* subsystems */ |
| 1336 | 1336 | thom_irq_init(); |
| 1337 | 1337 | pia_config( THOM_PIA_SYS, &to7_sys ); |
| r1461 | r1462 | |
| 1343 | 1343 | to7_midi_init(); |
| 1344 | 1344 | to7_rf57932_init(); |
| 1345 | 1345 | mea8000_config( THOM_SOUND_SPEECH, NULL ); |
| 1346 | ||
| 1346 | ||
| 1347 | 1347 | /* memory */ |
| 1348 | 1348 | thom_cart_bank = 0; |
| 1349 | 1349 | thom_vram = mess_ram; |
| r1461 | r1462 | |
| 1351 | 1351 | memory_configure_bank( THOM_VRAM_BANK, 0, 2, thom_vram, 0x2000 ); |
| 1352 | 1352 | memory_configure_bank( THOM_CART_BANK, 0, 4, mem + 0x10000, 0x4000 ); |
| 1353 | 1353 | memory_set_bank( THOM_BASE_BANK, 0 ); |
| 1354 | ||
| 1355 | if ( mess_ram_size > 24*1024 ) | |
| 1354 | ||
| 1355 | if ( mess_ram_size > 24*1024 ) | |
| 1356 | 1356 | { |
| 1357 | 1357 | /* install 16 KB or 16 KB + 8 KB memory extensions */ |
| 1358 | 1358 | /* BASIC instruction to see free memory: ?FRE(0) */ |
| 1359 | 1359 | int extram = mess_ram_size - 24*1024; |
| 1360 | memory_install_write8_handler( 0, ADDRESS_SPACE_PROGRAM, 0x8000, 0x8000 + extram - 1, 0, 0, | |
| 1360 | memory_install_write8_handler( 0, ADDRESS_SPACE_PROGRAM, 0x8000, 0x8000 + extram - 1, 0, 0, | |
| 1361 | 1361 | (write8_handler)(STATIC_BANK1 + THOM_RAM_BANK - 1) ); |
| 1362 | memory_install_read8_handler( 0, ADDRESS_SPACE_PROGRAM, 0x8000, 0x8000 + extram - 1, 0, 0, | |
| 1362 | memory_install_read8_handler( 0, ADDRESS_SPACE_PROGRAM, 0x8000, 0x8000 + extram - 1, 0, 0, | |
| 1363 | 1363 | (read8_handler)(STATIC_BANK1 + THOM_RAM_BANK - 1) ); |
| 1364 | 1364 | memory_configure_bank( THOM_RAM_BANK, 0, 1, mess_ram + 0x6000, extram ); |
| 1365 | 1365 | memory_set_bank( THOM_RAM_BANK, 0 ); |
| 1366 | 1366 | } |
| 1367 | ||
| 1367 | ||
| 1368 | 1368 | /* force 2 topmost color bits to 1 */ |
| 1369 | 1369 | memset( thom_vram + 0x2000, 0xc0, 0x2000 ); |
| 1370 | 1370 | |
| r1461 | r1462 | |
| 1388 | 1388 | |
| 1389 | 1389 | |
| 1390 | 1390 | static WRITE8_HANDLER ( to770_sys_cb2_out ) |
| 1391 | { | |
| 1391 | { | |
| 1392 | 1392 | /* video overlay: black pixels are transparent and show TV image underneath */ |
| 1393 | 1393 | LOG(( "$%04x to770_sys_cb2_out: video overlay %i\n", activecpu_get_previouspc(), data )); |
| 1394 | 1394 | } |
| r1461 | r1462 | |
| 1397 | 1397 | |
| 1398 | 1398 | static READ8_HANDLER ( to770_sys_porta_in ) |
| 1399 | 1399 | { |
| 1400 | /* keyboard */ | |
| 1400 | /* keyboard */ | |
| 1401 | 1401 | int keyline = pia_get_output_b( THOM_PIA_SYS ) & 7; |
| 1402 | 1402 | return readinputport( THOM_INPUT_KEYBOARD + 7 - keyline ); |
| 1403 | 1403 | } |
| r1461 | r1462 | |
| 1410 | 1410 | static int old_bank = -1; |
| 1411 | 1411 | int bank; |
| 1412 | 1412 | |
| 1413 | switch (portb & 0xf8) | |
| 1413 | switch (portb & 0xf8) | |
| 1414 | 1414 | { |
| 1415 | 1415 | /* 2 * 16 KB internal RAM */ |
| 1416 | 1416 | case 0xf0: bank = 0; break; |
| r1461 | r1462 | |
| 1425 | 1425 | /* none selected */ |
| 1426 | 1426 | case 0xf8: return; |
| 1427 | 1427 | |
| 1428 | default: | |
| 1429 | logerror( "to770_update_ram_bank unknown bank $%02X\n", portb & 0xf8 ); | |
| 1428 | default: | |
| 1429 | logerror( "to770_update_ram_bank unknown bank $%02X\n", portb & 0xf8 ); | |
| 1430 | 1430 | return; |
| 1431 | 1431 | } |
| 1432 | 1432 | |
| r1461 | r1462 | |
| 1436 | 1436 | #endif |
| 1437 | 1437 | |
| 1438 | 1438 | memory_set_bank( THOM_RAM_BANK, bank ); |
| 1439 | memory_install_write8_handler( 0, ADDRESS_SPACE_PROGRAM, 0xa000, 0xdfff, 0, 0, | |
| 1439 | memory_install_write8_handler( 0, ADDRESS_SPACE_PROGRAM, 0xa000, 0xdfff, 0, 0, | |
| 1440 | 1440 | (mess_ram_size == 128*1024 || bank < 2) ? |
| 1441 | 1441 | (write8_handler)(STATIC_BANK1 + THOM_RAM_BANK - 1) : MWA8_UNMAP ); |
| 1442 | 1442 | old_bank = bank; |
| r1461 | r1462 | |
| 1445 | 1445 | |
| 1446 | 1446 | |
| 1447 | 1447 | static WRITE8_HANDLER ( to770_sys_portb_out ) |
| 1448 | { | |
| 1448 | { | |
| 1449 | 1449 | to770_update_ram_bank(); |
| 1450 | 1450 | } |
| 1451 | 1451 | |
| 1452 | 1452 | |
| 1453 | 1453 | |
| 1454 | static const pia6821_interface to770_sys = | |
| 1454 | static const pia6821_interface to770_sys = | |
| 1455 | 1455 | { |
| 1456 | 1456 | to770_sys_porta_in, NULL, |
| 1457 | 1457 | NULL, NULL, NULL, NULL, |
| r1461 | r1462 | |
| 1470 | 1470 | thom_set_mode_point( data & 1 ); /* bit 0: video bank switch */ |
| 1471 | 1471 | thom_set_caps_led( (data & 8) ? 1 : 0 ) ; /* bit 3: keyboard led */ |
| 1472 | 1472 | thom_set_border_color( ((data & 0x10) ? 1 : 0) | /* 4-bit border color */ |
| 1473 | ((data & 0x20) ? 2 : 0) | | |
| 1473 | ((data & 0x20) ? 2 : 0) | | |
| 1474 | 1474 | ((data & 0x40) ? 4 : 0) | |
| 1475 | 1475 | ((data & 0x04) ? 0 : 8) ); |
| 1476 | 1476 | } |
| 1477 | 1477 | |
| 1478 | 1478 | |
| 1479 | 1479 | |
| 1480 | static const mc6846_interface to770_timer = | |
| 1481 | { | |
| 1482 | to770_timer_port_out, NULL, to7_timer_cp2_out, | |
| 1483 | to7_timer_port_in, to7_timer_tco_out, | |
| 1480 | static const mc6846_interface to770_timer = | |
| 1481 | { | |
| 1482 | to770_timer_port_out, NULL, to7_timer_cp2_out, | |
| 1483 | to7_timer_port_in, to7_timer_tco_out, | |
| 1484 | 1484 | thom_irq_0 |
| 1485 | 1485 | }; |
| 1486 | 1486 | |
| r1461 | r1462 | |
| 1499 | 1499 | inil = to7_lightpen ? l.inil : v.inil; |
| 1500 | 1500 | init = to7_lightpen ? l.init : v.init; |
| 1501 | 1501 | lt3 = to7_lightpen ? l.lt3 : v.lt3; |
| 1502 | ||
| 1503 | switch ( offset ) | |
| 1502 | ||
| 1503 | switch ( offset ) | |
| 1504 | 1504 | { |
| 1505 | 1505 | case 0: return (count >> 8) & 0xff; |
| 1506 | 1506 | case 1: return count & 0xff; |
| r1461 | r1462 | |
| 1516 | 1516 | |
| 1517 | 1517 | WRITE8_HANDLER ( to770_gatearray_w ) |
| 1518 | 1518 | { |
| 1519 | if ( ! offset ) | |
| 1519 | if ( ! offset ) | |
| 1520 | 1520 | to7_lightpen = data & 1; |
| 1521 | 1521 | } |
| 1522 | 1522 | |
| r1461 | r1462 | |
| 1554 | 1554 | to7_update_cart_bank(); |
| 1555 | 1555 | to770_update_ram_bank(); |
| 1556 | 1556 | /* thom_cart_bank not reset */ |
| 1557 | ||
| 1557 | ||
| 1558 | 1558 | /* lightpen */ |
| 1559 | 1559 | to7_lightpen = 0; |
| 1560 | 1560 | } |
| r1461 | r1462 | |
| 1611 | 1611 | static void mo5_lightpen_cb ( int step ) |
| 1612 | 1612 | { |
| 1613 | 1613 | /* MO5 signals ca1 (TO7 signals cb1) */ |
| 1614 | if ( ! to7_lightpen ) | |
| 1614 | if ( ! to7_lightpen ) | |
| 1615 | 1615 | return; |
| 1616 | 1616 | |
| 1617 | 1617 | pia_set_input_ca1( THOM_PIA_SYS, 1 ); |
| r1461 | r1462 | |
| 1622 | 1622 | |
| 1623 | 1623 | /* ------------ periodic interrupt ------------ */ |
| 1624 | 1624 | |
| 1625 | /* the MO5 & MO6 do not have a MC 6846 timer, | |
| 1625 | /* the MO5 & MO6 do not have a MC 6846 timer, | |
| 1626 | 1626 | they have a fixed 50 Hz timer instead |
| 1627 | 1627 | */ |
| 1628 | 1628 | |
| r1461 | r1462 | |
| 1654 | 1654 | |
| 1655 | 1655 | |
| 1656 | 1656 | static WRITE8_HANDLER ( mo5_sys_porta_out ) |
| 1657 | { | |
| 1657 | { | |
| 1658 | 1658 | thom_set_mode_point( data & 1 ); /* bit 0: video bank switch */ |
| 1659 | 1659 | thom_set_border_color( (data >> 1) & 15 ); /* bit 1-4: border color */ |
| 1660 | 1660 | mo5_set_cassette( (data & 0x40) ? 1 : 0 ); /* bit 6: cassette output */ |
| r1461 | r1462 | |
| 1664 | 1664 | |
| 1665 | 1665 | static READ8_HANDLER ( mo5_sys_porta_in ) |
| 1666 | 1666 | { |
| 1667 | return | |
| 1667 | return | |
| 1668 | 1668 | (mo5_get_cassette() ? 0x80 : 0) | /* bit 7: cassette input */ |
| 1669 | ((readinputport( THOM_INPUT_LIGHTPEN + 2 ) & 1) ? 0x20 : 0) | |
| 1669 | ((readinputport( THOM_INPUT_LIGHTPEN + 2 ) & 1) ? 0x20 : 0) | |
| 1670 | 1670 | /* bit 5: lightpen button */; |
| 1671 | 1671 | } |
| 1672 | 1672 | |
| 1673 | 1673 | |
| 1674 | 1674 | |
| 1675 | 1675 | static WRITE8_HANDLER ( mo5_sys_portb_out ) |
| 1676 | { | |
| 1676 | { | |
| 1677 | 1677 | DAC_data_w( THOM_SOUND_BUZ, (data & 1) ? 0x80 : 0); /* 1-bit buzzer */ |
| 1678 | 1678 | } |
| 1679 | 1679 | |
| r1461 | r1462 | |
| 1689 | 1689 | |
| 1690 | 1690 | |
| 1691 | 1691 | |
| 1692 | static const pia6821_interface mo5_sys = | |
| 1692 | static const pia6821_interface mo5_sys = | |
| 1693 | 1693 | { |
| 1694 | 1694 | mo5_sys_porta_in, mo5_sys_portb_in, |
| 1695 | 1695 | NULL, NULL, NULL, NULL, |
| r1461 | r1462 | |
| 1732 | 1732 | |
| 1733 | 1733 | WRITE8_HANDLER ( mo5_gatearray_w ) |
| 1734 | 1734 | { |
| 1735 | if ( ! offset ) | |
| 1735 | if ( ! offset ) | |
| 1736 | 1736 | to7_lightpen = data & 1; |
| 1737 | 1737 | } |
| 1738 | 1738 | |
| r1461 | r1462 | |
| 1754 | 1754 | char name[129]; |
| 1755 | 1755 | |
| 1756 | 1756 | /* get size & number of 16-KB banks */ |
| 1757 | if ( size > 32 && size <= 0x04000 ) | |
| 1757 | if ( size > 32 && size <= 0x04000 ) | |
| 1758 | 1758 | thom_cart_nb_banks = 1; |
| 1759 | else if ( size == 0x08000 ) | |
| 1759 | else if ( size == 0x08000 ) | |
| 1760 | 1760 | thom_cart_nb_banks = 2; |
| 1761 | else if ( size == 0x10000 ) | |
| 1761 | else if ( size == 0x10000 ) | |
| 1762 | 1762 | thom_cart_nb_banks = 4; |
| 1763 | else | |
| 1763 | else | |
| 1764 | 1764 | { |
| 1765 | 1765 | logerror( "mo5_cartridge_load: invalid cartridge size %u\n", (unsigned) size ); |
| 1766 | 1766 | return INIT_FAIL; |
| 1767 | 1767 | } |
| 1768 | 1768 | |
| 1769 | if ( image_fread( image, pos, size ) != size ) | |
| 1769 | if ( image_fread( image, pos, size ) != size ) | |
| 1770 | 1770 | { |
| 1771 | 1771 | logerror( "mo5_cartridge_load: read error\n" ); |
| 1772 | 1772 | return INIT_FAIL; |
| r1461 | r1462 | |
| 1775 | 1775 | /* extract name */ |
| 1776 | 1776 | i = size - 32; |
| 1777 | 1777 | while ( i < size && !pos[i] ) i++; |
| 1778 | for ( j = 0; i < size && pos[i] >= 0x20; j++, i++) | |
| 1778 | for ( j = 0; i < size && pos[i] >= 0x20; j++, i++) | |
| 1779 | 1779 | name[j] = pos[i]; |
| 1780 | 1780 | name[j] = 0; |
| 1781 | 1781 | |
| r1461 | r1462 | |
| 1801 | 1801 | memory_install_read8_handler( 0, ADDRESS_SPACE_PROGRAM, 0xb000, 0xefff, 0, 0, |
| 1802 | 1802 | (read8_handler)(STATIC_BANK1 + THOM_CART_BANK - 1) ); |
| 1803 | 1803 | |
| 1804 | if ( rom_is_ram && thom_cart_nb_banks == 4 ) | |
| 1804 | if ( rom_is_ram && thom_cart_nb_banks == 4 ) | |
| 1805 | 1805 | { |
| 1806 | 1806 | /* 64 KB ROM from "JANE" cartridge */ |
| 1807 | 1807 | memory_install_write8_handler( 0, ADDRESS_SPACE_PROGRAM, 0xb000, 0xefff, 0, 0, MWA8_NOP ); |
| r1461 | r1462 | |
| 1811 | 1811 | logerror( "mo5_update_cart_bank: CART is cartridge bank %i (A7CB style)\n", bank ); |
| 1812 | 1812 | #endif |
| 1813 | 1813 | } |
| 1814 | else if ( rom_is_ram ) | |
| 1814 | else if ( rom_is_ram ) | |
| 1815 | 1815 | { |
| 1816 | 1816 | /* 64 KB RAM from network extension */ |
| 1817 | 1817 | int write_enable = mo5_reg_cart & 8; |
| 1818 | 1818 | bank = 4 + ( mo5_reg_cart & 3 ); |
| 1819 | memory_install_write8_handler( 0, ADDRESS_SPACE_PROGRAM, 0xb000, 0xefff, 0, 0, write_enable ? | |
| 1819 | memory_install_write8_handler( 0, ADDRESS_SPACE_PROGRAM, 0xb000, 0xefff, 0, 0, write_enable ? | |
| 1820 | 1820 | (write8_handler)(STATIC_BANK1 + THOM_CART_BANK - 1) : MWA8_NOP ); |
| 1821 | 1821 | #if VERBOSE_BANK |
| 1822 | 1822 | if ( bank != old_bank ) |
| 1823 | 1823 | logerror( "mo5_update_cart_bank: CART is nanonetwork RAM bank %i (write-enable=%i)\n", mo5_reg_cart & 3, write_enable ? 1 : 0 ); |
| 1824 | 1824 | #endif |
| 1825 | 1825 | } |
| 1826 | else | |
| 1826 | else | |
| 1827 | 1827 | { |
| 1828 | 1828 | /* regular cartridge bank switch */ |
| 1829 | 1829 | memory_install_write8_handler( 0, ADDRESS_SPACE_PROGRAM, 0xb000, 0xefff, 0, 0, mo5_cartridge_w ); |
| 1830 | if ( thom_cart_nb_banks ) | |
| 1830 | if ( thom_cart_nb_banks ) | |
| 1831 | 1831 | { |
| 1832 | 1832 | bank = thom_cart_bank % thom_cart_nb_banks; |
| 1833 | 1833 | memory_install_read8_handler( 0, ADDRESS_SPACE_PROGRAM, 0xbffc, 0xbfff, 0, 0, mo5_cartridge_r ); |
| r1461 | r1462 | |
| 1846 | 1846 | /* write signal to b000-cfff generates a bank switch */ |
| 1847 | 1847 | WRITE8_HANDLER ( mo5_cartridge_w ) |
| 1848 | 1848 | { |
| 1849 | if ( offset >= 0x2000 ) | |
| 1849 | if ( offset >= 0x2000 ) | |
| 1850 | 1850 | return; |
| 1851 | 1851 | |
| 1852 | 1852 | thom_cart_bank = offset & 3; |
| r1461 | r1462 | |
| 1905 | 1905 | pia_set_input_ca1( THOM_PIA_SYS, 0 ); |
| 1906 | 1906 | |
| 1907 | 1907 | /* memory */ |
| 1908 | mo5_update_cart_bank(); | |
| 1908 | mo5_update_cart_bank(); | |
| 1909 | 1909 | /* mo5_reg_cart not reset */ |
| 1910 | 1910 | /* thom_cart_bank not reset */ |
| 1911 | 1911 | |
| r1461 | r1462 | |
| 1918 | 1918 | MACHINE_START ( mo5 ) |
| 1919 | 1919 | { |
| 1920 | 1920 | UINT8* mem = memory_region(REGION_CPU1); |
| 1921 | ||
| 1921 | ||
| 1922 | 1922 | LOG (( "mo5: machine start called\n" )); |
| 1923 | 1923 | |
| 1924 | 1924 | /* subsystems */ |
| r1461 | r1462 | |
| 2000 | 2000 | init = to7_lightpen ? l.init : v.init; |
| 2001 | 2001 | lt3 = to7_lightpen ? l.lt3 : v.lt3; |
| 2002 | 2002 | |
| 2003 | switch ( offset ) | |
| 2003 | switch ( offset ) | |
| 2004 | 2004 | { |
| 2005 | 2005 | case 0: return (count >> 8) & 0xff; |
| 2006 | 2006 | case 1: return count & 0xff; |
| r1461 | r1462 | |
| 2016 | 2016 | |
| 2017 | 2017 | WRITE8_HANDLER ( to9_gatearray_w ) |
| 2018 | 2018 | { |
| 2019 | if ( ! offset ) | |
| 2019 | if ( ! offset ) | |
| 2020 | 2020 | to7_lightpen = data & 1; |
| 2021 | 2021 | } |
| 2022 | 2022 | |
| r1461 | r1462 | |
| 2034 | 2034 | /* style: 0 => TO9, 1 => TO8/TO9, 2 => MO6 */ |
| 2035 | 2035 | static void to9_set_video_mode( UINT8 data, int style ) |
| 2036 | 2036 | { |
| 2037 | switch ( data & 0x7f ) | |
| 2037 | switch ( data & 0x7f ) | |
| 2038 | 2038 | { |
| 2039 | case 0x00: | |
| 2040 | if ( style == 2 ) | |
| 2039 | case 0x00: | |
| 2040 | if ( style == 2 ) | |
| 2041 | 2041 | thom_set_video_mode( THOM_VMODE_MO5 ); |
| 2042 | 2042 | else if ( style == 1 ) |
| 2043 | 2043 | thom_set_video_mode( THOM_VMODE_TO770 ); |
| 2044 | else | |
| 2044 | else | |
| 2045 | 2045 | thom_set_video_mode( THOM_VMODE_TO9 ); |
| 2046 | 2046 | break; |
| 2047 | 2047 | |
| 2048 | 2048 | case 0x21: thom_set_video_mode( THOM_VMODE_BITMAP4 ); break; |
| 2049 | 2049 | |
| 2050 | case 0x41: thom_set_video_mode( THOM_VMODE_BITMAP4_ALT ); break; | |
| 2050 | case 0x41: thom_set_video_mode( THOM_VMODE_BITMAP4_ALT ); break; | |
| 2051 | 2051 | |
| 2052 | 2052 | case 0x2a: |
| 2053 | if ( style==0 ) | |
| 2053 | if ( style==0 ) | |
| 2054 | 2054 | thom_set_video_mode( THOM_VMODE_80_TO9 ); |
| 2055 | else | |
| 2055 | else | |
| 2056 | 2056 | thom_set_video_mode( THOM_VMODE_80 ); |
| 2057 | 2057 | break; |
| 2058 | 2058 | |
| r1461 | r1462 | |
| 2075 | 2075 | |
| 2076 | 2076 | READ8_HANDLER ( to9_vreg_r ) |
| 2077 | 2077 | { |
| 2078 | switch ( offset ) | |
| 2078 | switch ( offset ) | |
| 2079 | 2079 | { |
| 2080 | 2080 | |
| 2081 | 2081 | case 0: /* palette data */ |
| r1461 | r1462 | |
| 2106 | 2106 | logerror( "$%04x %f to9_vreg_w: off=%i ($%04X) data=$%02X\n", activecpu_get_previouspc(), attotime_to_double(timer_get_time()), offset, 0xe7da + offset, data ); |
| 2107 | 2107 | #endif |
| 2108 | 2108 | |
| 2109 | switch ( offset ) | |
| 2109 | switch ( offset ) | |
| 2110 | 2110 | { |
| 2111 | 2111 | |
| 2112 | 2112 | case 0: /* palette data */ |
| r1461 | r1462 | |
| 2122 | 2122 | } |
| 2123 | 2123 | break; |
| 2124 | 2124 | |
| 2125 | case 1: /* palette address */ | |
| 2125 | case 1: /* palette address */ | |
| 2126 | 2126 | to9_palette_idx = data & 31; |
| 2127 | 2127 | break; |
| 2128 | 2128 | |
| r1461 | r1462 | |
| 2166 | 2166 | /* reset cartridge read handler */ |
| 2167 | 2167 | memory_install_read8_handler( 0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x0003, 0, 0, (read8_handler)(STATIC_BANK1 + THOM_CART_BANK - 1) ); |
| 2168 | 2168 | |
| 2169 | switch ( slot ) | |
| 2169 | switch ( slot ) | |
| 2170 | 2170 | { |
| 2171 | 2171 | case 0: |
| 2172 | 2172 | /* BASIC (64 KB) */ |
| r1461 | r1462 | |
| 2194 | 2194 | break; |
| 2195 | 2195 | case 3: |
| 2196 | 2196 | /* external cartridge */ |
| 2197 | if ( thom_cart_nb_banks ) | |
| 2197 | if ( thom_cart_nb_banks ) | |
| 2198 | 2198 | { |
| 2199 | 2199 | bank = thom_cart_bank % thom_cart_nb_banks; |
| 2200 | 2200 | memory_install_read8_handler( 0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x0003, 0, 0, to7_cartridge_r ); |
| r1461 | r1462 | |
| 2217 | 2217 | { |
| 2218 | 2218 | int slot = ( mc6846_get_output_port() >> 4 ) & 3; /* bits 4-5: ROM bank */ |
| 2219 | 2219 | |
| 2220 | if ( offset >= 0x2000 ) | |
| 2220 | if ( offset >= 0x2000 ) | |
| 2221 | 2221 | return; |
| 2222 | 2222 | |
| 2223 | if ( slot == 3 ) | |
| 2223 | if ( slot == 3 ) | |
| 2224 | 2224 | thom_cart_bank = offset & 3; |
| 2225 | else | |
| 2225 | else | |
| 2226 | 2226 | to9_soft_bank = offset & 3; |
| 2227 | 2227 | to9_update_cart_bank(); |
| 2228 | 2228 | } |
| r1461 | r1462 | |
| 2249 | 2249 | UINT8 disk = ((port >> 2) & 1) | ((port >> 5) & 2); /* bits 6,2: RAM bank */ |
| 2250 | 2250 | int bank; |
| 2251 | 2251 | |
| 2252 | switch ( portb & 0xf8 ) | |
| 2252 | switch ( portb & 0xf8 ) | |
| 2253 | 2253 | { |
| 2254 | 2254 | /* TO7/70 compatible */ |
| 2255 | 2255 | case 0xf0: bank = 0; break; |
| r1461 | r1462 | |
| 2275 | 2275 | logerror( "to9_update_ram_bank: bank %i selected (pia=$%02X disk=%i)\n", bank, portb & 0xf8, disk ); |
| 2276 | 2276 | #endif |
| 2277 | 2277 | |
| 2278 | memory_set_bank( THOM_RAM_BANK, bank ); | |
| 2279 | memory_install_write8_handler( 0, ADDRESS_SPACE_PROGRAM, 0xa000, 0xdfff, 0, 0, | |
| 2280 | (mess_ram_size == 192*1024 || bank < 6) ? | |
| 2278 | memory_set_bank( THOM_RAM_BANK, bank ); | |
| 2279 | memory_install_write8_handler( 0, ADDRESS_SPACE_PROGRAM, 0xa000, 0xdfff, 0, 0, | |
| 2280 | (mess_ram_size == 192*1024 || bank < 6) ? | |
| 2281 | 2281 | (write8_handler)(STATIC_BANK1 + THOM_RAM_BANK - 1) : MWA8_NOP ); |
| 2282 | 2282 | old_bank = bank; |
| 2283 | 2283 | } |
| r1461 | r1462 | |
| 2289 | 2289 | /* The 6805 chip scans the keyboard and sends ASCII codes to the 6909. |
| 2290 | 2290 | Data between the 6809 and 6805 is serialized at 9600 bauds. |
| 2291 | 2291 | On the 6809 side, a 6850 ACIA is used. |
| 2292 | We do not emulate the seral line but pass bytes directly between the | |
| 2292 | We do not emulate the seral line but pass bytes directly between the | |
| 2293 | 2293 | keyboard and the 6850 registers. |
| 2294 | 2294 | Note that the keyboard protocol uses the parity bit as an extra data bit. |
| 2295 | 2295 | */ |
| r1461 | r1462 | |
| 2320 | 2320 | static UINT16 to9_mouse_x, to9_mouse_y; |
| 2321 | 2321 | |
| 2322 | 2322 | static UINT8 to9_kbd_last_key; /* for key repetition */ |
| 2323 | static UINT16 to9_kbd_key_count; | |
| 2323 | static UINT16 to9_kbd_key_count; | |
| 2324 | 2324 | |
| 2325 | 2325 | static UINT8 to9_kbd_caps; /* caps-lock */ |
| 2326 | 2326 | static UINT8 to9_kbd_pad; /* keypad outputs special codes */ |
| 2327 | 2327 | |
| 2328 | static emu_timer* to9_kbd_timer; | |
| 2328 | static emu_timer* to9_kbd_timer; | |
| 2329 | 2329 | |
| 2330 | 2330 | |
| 2331 | 2331 | |
| r1461 | r1462 | |
| 2334 | 2334 | { |
| 2335 | 2335 | int line, bit; |
| 2336 | 2336 | |
| 2337 | for ( line = 0; line < 10; line++ ) | |
| 2337 | for ( line = 0; line < 10; line++ ) | |
| 2338 | 2338 | { |
| 2339 | 2339 | UINT8 port = readinputport( THOM_INPUT_KEYBOARD + line ); |
| 2340 | 2340 | |
| 2341 | if ( line == 7 || line == 9 ) | |
| 2341 | if ( line == 7 || line == 9 ) | |
| 2342 | 2342 | port |= 1; /* shift & control */ |
| 2343 | 2343 | |
| 2344 | 2344 | for ( bit = 0; bit < 8; bit++ ) |
| 2345 | 2345 | { |
| 2346 | if ( ! (port & (1 << bit)) ) | |
| 2346 | if ( ! (port & (1 << bit)) ) | |
| 2347 | 2347 | return 1; |
| 2348 | 2348 | } |
| 2349 | 2349 | } |
| r1461 | r1462 | |
| 2372 | 2372 | { |
| 2373 | 2373 | /* ACIA 6850 registers */ |
| 2374 | 2374 | |
| 2375 | switch ( offset ) | |
| 2375 | switch ( offset ) | |
| 2376 | 2376 | { |
| 2377 | 2377 | |
| 2378 | 2378 | case 0: /* get status */ |
| r1461 | r1462 | |
| 2385 | 2385 | /* bit 6: parity error */ |
| 2386 | 2386 | /* bit 7: interrupt */ |
| 2387 | 2387 | #if VERBOSE_KBD |
| 2388 | logerror( "$%04x %f to9_kbd_r: status $%02X (rdrf=%i, tdre=%i, ovrn=%i, pe=%i, irq=%i)\n", | |
| 2388 | logerror( "$%04x %f to9_kbd_r: status $%02X (rdrf=%i, tdre=%i, ovrn=%i, pe=%i, irq=%i)\n", | |
| 2389 | 2389 | activecpu_get_previouspc(), attotime_to_double(timer_get_time()), to9_kbd_status, |
| 2390 | (to9_kbd_status & ACIA_6850_RDRF) ? 1 : 0, | |
| 2390 | (to9_kbd_status & ACIA_6850_RDRF) ? 1 : 0, | |
| 2391 | 2391 | (to9_kbd_status & ACIA_6850_TDRE) ? 1 : 0, |
| 2392 | (to9_kbd_status & ACIA_6850_OVRN) ? 1 : 0, | |
| 2392 | (to9_kbd_status & ACIA_6850_OVRN) ? 1 : 0, | |
| 2393 | 2393 | (to9_kbd_status & ACIA_6850_PE) ? 1 : 0, |
| 2394 | 2394 | (to9_kbd_status & ACIA_6850_irq) ? 1 : 0 ); |
| 2395 | 2395 | #endif |
| r1461 | r1462 | |
| 2397 | 2397 | |
| 2398 | 2398 | case 1: /* get input data */ |
| 2399 | 2399 | to9_kbd_status &= ~(ACIA_6850_irq | ACIA_6850_PE); |
| 2400 | if ( to9_kbd_overrun ) | |
| 2400 | if ( to9_kbd_overrun ) | |
| 2401 | 2401 | to9_kbd_status |= ACIA_6850_OVRN; |
| 2402 | else | |
| 2402 | else | |
| 2403 | 2403 | to9_kbd_status &= ~(ACIA_6850_OVRN | ACIA_6850_RDRF); |
| 2404 | 2404 | to9_kbd_overrun = 0; |
| 2405 | 2405 | #if VERBOSE_KBD |
| r1461 | r1462 | |
| 2408 | 2408 | to9_kbd_update_irq(); |
| 2409 | 2409 | return to9_kbd_in; |
| 2410 | 2410 | |
| 2411 | default: | |
| 2411 | default: | |
| 2412 | 2412 | logerror( "$%04x to9_kbd_r: invalid offset %i\n", activecpu_get_previouspc(), offset ); |
| 2413 | 2413 | return 0; |
| 2414 | 2414 | } |
| r1461 | r1462 | |
| 2420 | 2420 | { |
| 2421 | 2421 | /* ACIA 6850 registers */ |
| 2422 | 2422 | |
| 2423 | switch ( offset ) | |
| 2423 | switch ( offset ) | |
| 2424 | 2424 | { |
| 2425 | 2425 | |
| 2426 | 2426 | case 0: /* set control */ |
| 2427 | 2427 | /* bits 0-1: clock divide (ignored) or reset */ |
| 2428 | if ( (data & 3) == 3 ) | |
| 2428 | if ( (data & 3) == 3 ) | |
| 2429 | 2429 | { |
| 2430 | 2430 | /* reset */ |
| 2431 | 2431 | to9_kbd_overrun = 0; |
| r1461 | r1462 | |
| 2435 | 2435 | logerror( "$%04x %f to9_kbd_w: reset (data=$%02X)\n", activecpu_get_previouspc(), attotime_to_double(timer_get_time()), data ); |
| 2436 | 2436 | #endif |
| 2437 | 2437 | } |
| 2438 | else | |
| 2438 | else | |
| 2439 | 2439 | { |
| 2440 | 2440 | /* bits 2-4: parity */ |
| 2441 | if ( (data & 0x18) == 0x10 ) | |
| 2441 | if ( (data & 0x18) == 0x10 ) | |
| 2442 | 2442 | to9_kbd_parity = 2; |
| 2443 | else | |
| 2443 | else | |
| 2444 | 2444 | to9_kbd_parity = (data >> 2) & 1; |
| 2445 | 2445 | /* bits 5-6: interrupt on transmit */ |
| 2446 | 2446 | /* bit 7: interrupt on receive */ |
| 2447 | 2447 | to9_kbd_intr = data >> 5; |
| 2448 | 2448 | #if VERBOSE_KBD |
| 2449 | logerror( "$%04x %f to9_kbd_w: set control to $%02X (parity=%i, intr in=%i out=%i)\n", | |
| 2450 | activecpu_get_previouspc(), attotime_to_double(timer_get_time()), | |
| 2451 | data, to9_kbd_parity, to9_kbd_intr >> 2, | |
| 2449 | logerror( "$%04x %f to9_kbd_w: set control to $%02X (parity=%i, intr in=%i out=%i)\n", | |
| 2450 | activecpu_get_previouspc(), attotime_to_double(timer_get_time()), | |
| 2451 | data, to9_kbd_parity, to9_kbd_intr >> 2, | |
| 2452 | 2452 | (to9_kbd_intr & 3) ? 1 : 0 ); |
| 2453 | 2453 | #endif |
| 2454 | 2454 | } |
| r1461 | r1462 | |
| 2461 | 2461 | /* TODO: 1 ms delay here ? */ |
| 2462 | 2462 | to9_kbd_status |= ACIA_6850_TDRE; /* data transmit ready again */ |
| 2463 | 2463 | to9_kbd_update_irq(); |
| 2464 | ||
| 2465 | switch ( data ) | |
| 2464 | ||
| 2465 | switch ( data ) | |
| 2466 | 2466 | { |
| 2467 | 2467 | case 0xF8: |
| 2468 | 2468 | /* reset */ |
| r1461 | r1462 | |
| 2484 | 2484 | |
| 2485 | 2485 | thom_set_caps_led( ! to9_kbd_caps ); |
| 2486 | 2486 | |
| 2487 | LOG(( "$%04x %f to9_kbd_w: kbd command %02X (caps=%i, pad=%i, periph=%i)\n", | |
| 2487 | LOG(( "$%04x %f to9_kbd_w: kbd command %02X (caps=%i, pad=%i, periph=%i)\n", | |
| 2488 | 2488 | activecpu_get_previouspc(), attotime_to_double(timer_get_time()), data, |
| 2489 | 2489 | to9_kbd_caps, to9_kbd_pad, to9_kbd_periph )); |
| 2490 | 2490 | |
| 2491 | 2491 | break; |
| 2492 | 2492 | |
| 2493 | default: | |
| 2493 | default: | |
| 2494 | 2494 | logerror( "$%04x to9_kbd_w: invalid offset %i (data=$%02X) \n", activecpu_get_previouspc(), offset, data ); |
| 2495 | 2495 | } |
| 2496 | 2496 | } |
| r1461 | r1462 | |
| 2503 | 2503 | */ |
| 2504 | 2504 | static void to9_kbd_send ( UINT8 data, int parity ) |
| 2505 | 2505 | { |
| 2506 | if ( to9_kbd_status & ACIA_6850_RDRF ) | |
| 2506 | if ( to9_kbd_status & ACIA_6850_RDRF ) | |
| 2507 | 2507 | { |
| 2508 | 2508 | /* overrun will be set when the current valid byte is read */ |
| 2509 | 2509 | to9_kbd_overrun = 1; |
| r1461 | r1462 | |
| 2511 | 2511 | logerror( "%f to9_kbd_send: overrun => drop data=$%02X, parity=%i\n", attotime_to_double(timer_get_time()), data, parity ); |
| 2512 | 2512 | #endif |
| 2513 | 2513 | } |
| 2514 | else | |
| 2514 | else | |
| 2515 | 2515 | { |
| 2516 | 2516 | /* valid byte */ |
| 2517 | 2517 | to9_kbd_in = data; |
| r1461 | r1462 | |
| 2530 | 2530 | |
| 2531 | 2531 | |
| 2532 | 2532 | /* keycode => TO9 code (extended ASCII), shifted and un-shifted */ |
| 2533 | static const int to9_kbd_code[80][2] = | |
| 2533 | static const int to9_kbd_code[80][2] = | |
| 2534 | 2534 | { |
| 2535 | 2535 | { 145, 150 }, { '_', '6' }, { 'Y', 'Y' }, { 'H', 'H' }, |
| 2536 | { 11, 11 }, { 9, 9 }, { 30, 12 }, { 'N', 'N' }, | |
| 2536 | { 11, 11 }, { 9, 9 }, { 30, 12 }, { 'N', 'N' }, | |
| 2537 | 2537 | |
| 2538 | 2538 | { 146, 151 }, { '(', '5' }, { 'T', 'T' }, { 'G', 'G' }, |
| 2539 | 2539 | { '=', '+' }, { 8, 8 }, { 28, 28 }, { 'B', 'B' }, |
| r1461 | r1462 | |
| 2543 | 2543 | |
| 2544 | 2544 | { 148, 153 }, { '"', '3' }, { 'E', 'E' }, { 'D', 'D' }, |
| 2545 | 2545 | { 161, 161 }, { 158, 158 }, |
| 2546 | { 154, 154 }, { 'C', 'C' }, | |
| 2546 | { 154, 154 }, { 'C', 'C' }, | |
| 2547 | 2547 | |
| 2548 | 2548 | { 144, 149 }, { 128, '2' }, { 'Z', 'Z' }, { 'S', 'S' }, |
| 2549 | 2549 | { 162, 162 }, { 156, 156 }, |
| 2550 | { 164, 164 }, { 'X', 'X' }, | |
| 2550 | { 164, 164 }, { 'X', 'X' }, | |
| 2551 | 2551 | |
| 2552 | 2552 | { '#', '@' }, { '*', '1' }, { 'A', 'A' }, { 'Q', 'Q' }, |
| 2553 | 2553 | { '[', '{' }, { 159, 159 }, { 160, 160 }, { 'W', 'W' }, |
| 2554 | 2554 | |
| 2555 | 2555 | { 2, 2 }, { 129, '7' }, { 'U', 'U' }, { 'J', 'J' }, |
| 2556 | 2556 | { ' ', ' ' }, { 163, 163 }, { 165, 165 }, |
| 2557 | { ',', '?' }, | |
| 2557 | { ',', '?' }, | |
| 2558 | 2558 | |
| 2559 | 2559 | { 0, 0 }, { '!', '8' }, { 'I', 'I' }, { 'K', 'K' }, |
| 2560 | { '$', '&' }, { 10, 10 }, { ']', '}' }, { ';', '.' }, | |
| 2560 | { '$', '&' }, { 10, 10 }, { ']', '}' }, { ';', '.' }, | |
| 2561 | 2561 | |
| 2562 | 2562 | { 0, 0 }, { 130, '9' }, { 'O', 'O' }, { 'L', 'L' }, |
| 2563 | { '-', '\\' }, { 132, '%' }, { 13, 13 }, { ':', '/' }, | |
| 2563 | { '-', '\\' }, { 132, '%' }, { 13, 13 }, { ':', '/' }, | |
| 2564 | 2564 | |
| 2565 | 2565 | { 0, 0 }, { 131, '0' }, { 'P', 'P' }, { 'M', 'M' }, |
| 2566 | 2566 | { ')', 134 }, { '^', 133 }, { 157, 157 }, { '>', '<' } |
| r1461 | r1462 | |
| 2575 | 2575 | int shift = ! (readinputport( THOM_INPUT_KEYBOARD + 9 ) & 1); |
| 2576 | 2576 | int key = -1, line, bit; |
| 2577 | 2577 | |
| 2578 | for ( line = 0; line < 10; line++ ) | |
| 2578 | for ( line = 0; line < 10; line++ ) | |
| 2579 | 2579 | { |
| 2580 | 2580 | UINT8 port = readinputport( THOM_INPUT_KEYBOARD + line ); |
| 2581 | 2581 | |
| 2582 | if ( line == 7 || line == 9 ) | |
| 2582 | if ( line == 7 || line == 9 ) | |
| 2583 | 2583 | port |= 1; /* shift & control */ |
| 2584 | 2584 | |
| 2585 | 2585 | /* TODO: correct handling of simultaneous keystokes: |
| r1461 | r1462 | |
| 2592 | 2592 | } |
| 2593 | 2593 | } |
| 2594 | 2594 | |
| 2595 | if ( key == -1 ) | |
| 2595 | if ( key == -1 ) | |
| 2596 | 2596 | { |
| 2597 | 2597 | to9_kbd_last_key = 0xff; |
| 2598 | 2598 | to9_kbd_key_count = 0; |
| 2599 | 2599 | return 0; |
| 2600 | 2600 | } |
| 2601 | else if ( key == 64 ) | |
| 2601 | else if ( key == 64 ) | |
| 2602 | 2602 | { |
| 2603 | 2603 | /* caps lock */ |
| 2604 | if ( to9_kbd_last_key == key ) | |
| 2604 | if ( to9_kbd_last_key == key ) | |
| 2605 | 2605 | return 0; /* no repeat */ |
| 2606 | 2606 | |
| 2607 | 2607 | to9_kbd_last_key = key; |
| r1461 | r1462 | |
| 2609 | 2609 | thom_set_caps_led( ! to9_kbd_caps ); |
| 2610 | 2610 | return 0; |
| 2611 | 2611 | } |
| 2612 | else | |
| 2612 | else | |
| 2613 | 2613 | { |
| 2614 | 2614 | int asc; |
| 2615 | 2615 | asc = to9_kbd_code[key][shift]; |
| r1461 | r1462 | |
| 2617 | 2617 | |
| 2618 | 2618 | /* keypad */ |
| 2619 | 2619 | if ( ! to9_kbd_pad ) { |
| 2620 | if ( asc >= 154 && asc <= 163 ) | |
| 2620 | if ( asc >= 154 && asc <= 163 ) | |
| 2621 | 2621 | asc += '0' - 154; |
| 2622 | else if ( asc == 164 ) | |
| 2622 | else if ( asc == 164 ) | |
| 2623 | 2623 | asc = '.'; |
| 2624 | else if ( asc == 165 ) | |
| 2624 | else if ( asc == 165 ) | |
| 2625 | 2625 | asc = 13; |
| 2626 | 2626 | } |
| 2627 | 2627 | |
| 2628 | 2628 | /* shifted letter */ |
| 2629 | if ( asc >= 'A' && asc <= 'Z' && ( ! to9_kbd_caps ) && ( ! shift ) ) | |
| 2629 | if ( asc >= 'A' && asc <= 'Z' && ( ! to9_kbd_caps ) && ( ! shift ) ) | |
| 2630 | 2630 | asc += 'a' - 'A'; |
| 2631 | 2631 | |
| 2632 | 2632 | /* control */ |
| 2633 | if ( control ) | |
| 2633 | if ( control ) | |
| 2634 | 2634 | asc &= ~0x40; |
| 2635 | 2635 | |
| 2636 | if ( key == to9_kbd_last_key ) | |
| 2636 | if ( key == to9_kbd_last_key ) | |
| 2637 | 2637 | { |
| 2638 | 2638 | /* repeat */ |
| 2639 | 2639 | to9_kbd_key_count++; |
| r1461 | r1462 | |
| 2659 | 2659 | |
| 2660 | 2660 | static TIMER_CALLBACK(to9_kbd_timer_cb) |
| 2661 | 2661 | { |
| 2662 | if ( to9_kbd_periph ) | |
| 2662 | if ( to9_kbd_periph ) | |
| 2663 | 2663 | { |
| 2664 | 2664 | /* peripherial mode: every 10 ms we send 4 bytes */ |
| 2665 | 2665 | |
| 2666 | switch ( to9_kbd_byte_count ) | |
| 2666 | switch ( to9_kbd_byte_count ) | |
| 2667 | 2667 | { |
| 2668 | 2668 | |
| 2669 | 2669 | case 0: /* key */ |
| r1461 | r1462 | |
| 2694 | 2694 | UINT8 data = 0; |
| 2695 | 2695 | if ( b & 1 ) data |= 1; |
| 2696 | 2696 | if ( b & 2 ) data |= 4; |
| 2697 | to9_kbd_send( data, 1 ); | |
| 2697 | to9_kbd_send( data, 1 ); | |
| 2698 | 2698 | break; |
| 2699 | 2699 | } |
| 2700 | 2700 | |
| r1461 | r1462 | |
| 2703 | 2703 | to9_kbd_byte_count = ( to9_kbd_byte_count + 1 ) & 3; |
| 2704 | 2704 | timer_adjust( to9_kbd_timer, to9_kbd_byte_count ? TO9_KBD_BYTE_SPACE : TO9_KBD_END_SPACE, 0, attotime_never ); |
| 2705 | 2705 | } |
| 2706 | else | |
| 2706 | else | |
| 2707 | 2707 | { |
| 2708 | 2708 | int key = to9_kbd_get_key(); |
| 2709 | 2709 | /* keyboard mode: send a byte only if a key is down */ |
| 2710 | if ( key ) | |
| 2710 | if ( key ) | |
| 2711 | 2711 | to9_kbd_send( key, 0 ); |
| 2712 | 2712 | timer_adjust( to9_kbd_timer, TO9_KBD_POLL_PERIOD, 0, attotime_never ); |
| 2713 | 2713 | } |
| r1461 | r1462 | |
| 2768 | 2768 | centronics_write_data( 0, data ); |
| 2769 | 2769 | centronics_write_handshake( 0, (b & 2) ? CENTRONICS_STROBE : 0, CENTRONICS_STROBE ); |
| 2770 | 2770 | |
| 2771 | #if VERBOSE_IO | |
| 2771 | #if VERBOSE_IO | |
| 2772 | 2772 | logerror( "$%04x %f to9_update_centronics: data=$%02X strobe=%i\n", |
| 2773 | 2773 | activecpu_get_previouspc(), attotime_to_double(timer_get_time()), data, |
| 2774 | 2774 | (b & 2) ? 1 : 0 ); |
| r1461 | r1462 | |
| 2798 | 2798 | |
| 2799 | 2799 | |
| 2800 | 2800 | static WRITE8_HANDLER ( to9_sys_portb_out ) |
| 2801 | { | |
| 2801 | { | |
| 2802 | 2802 | to9_update_centronics(); /* bits 0-1: printer */ |
| 2803 | 2803 | to9_update_ram_bank(); |
| 2804 | 2804 | |
| r1461 | r1462 | |
| 2810 | 2810 | |
| 2811 | 2811 | |
| 2812 | 2812 | |
| 2813 | static const pia6821_interface to9_sys = | |
| 2813 | static const pia6821_interface to9_sys = | |
| 2814 | 2814 | { |
| 2815 | 2815 | to9_sys_porta_in, NULL, |
| 2816 | 2816 | NULL, NULL, NULL, NULL, |
| r1461 | r1462 | |
| 2836 | 2836 | |
| 2837 | 2837 | |
| 2838 | 2838 | |
| 2839 | static const mc6846_interface to9_timer = | |
| 2840 | { | |
| 2841 | to9_timer_port_out, NULL, to7_timer_cp2_out, | |
| 2842 | to7_timer_port_in, to7_timer_tco_out, | |
| 2843 | thom_irq_0 | |
| 2839 | static const mc6846_interface to9_timer = | |
| 2840 | { | |
| 2841 | to9_timer_port_out, NULL, to7_timer_cp2_out, | |
| 2842 | to7_timer_port_in, to7_timer_tco_out, | |
| 2843 | thom_irq_0 | |
| 2844 | 2844 | }; |
| 2845 | 2845 | |
| 2846 | 2846 | |
| r1461 | r1462 | |
| 2873 | 2873 | thom_set_border_color( 8 ); |
| 2874 | 2874 | thom_set_mode_point( 0 ); |
| 2875 | 2875 | pia_set_input_cb1( THOM_PIA_SYS, 0 ); |
| 2876 | ||
| 2876 | ||
| 2877 | 2877 | /* memory */ |
| 2878 | 2878 | to9_soft_bank = 0; |
| 2879 | 2879 | to9_update_cart_bank(); |
| r1461 | r1462 | |
| 2947 | 2947 | We do not emulate the 6804 but pass serialized data directly through the |
| 2948 | 2948 | PIA ports. |
| 2949 | 2949 | |
| 2950 | Note: if we conform to the (scarce) documentation the CPU tend to lock | |
| 2950 | Note: if we conform to the (scarce) documentation the CPU tend to lock | |
| 2951 | 2951 | waitting for keyboard input. |
| 2952 | The protocol documentation is pretty scarce and does not account for these | |
| 2952 | The protocol documentation is pretty scarce and does not account for these | |
| 2953 | 2953 | behaviors! |
| 2954 | 2954 | The emulation code contains many hacks (delays, timeouts, spurious |
| 2955 | 2955 | pulses) to improve the stability. |
| r1461 | r1462 | |
| 2988 | 2988 | { |
| 2989 | 2989 | int line, bit; |
| 2990 | 2990 | |
| 2991 | if ( readinputport( THOM_INPUT_CONFIG ) & 2 ) | |
| 2991 | if ( readinputport( THOM_INPUT_CONFIG ) & 2 ) | |
| 2992 | 2992 | return 0; /* disabled */ |
| 2993 | 2993 | |
| 2994 | for ( line = 0; line < 10; line++ ) | |
| 2994 | for ( line = 0; line < 10; line++ ) | |
| 2995 | 2995 | { |
| 2996 | 2996 | UINT8 port = readinputport( THOM_INPUT_KEYBOARD + line ); |
| 2997 | 2997 | |
| 2998 | if ( line == 7 || line == 9 ) | |
| 2998 | if ( line == 7 || line == 9 ) | |
| 2999 | 2999 | port |= 1; /* shift & control */ |
| 3000 | 3000 | |
| 3001 | 3001 | for ( bit = 0; bit < 8; bit++ ) |
| 3002 | 3002 | { |
| 3003 | if ( ! (port & (1 << bit)) ) | |
| 3003 | if ( ! (port & (1 << bit)) ) | |
| 3004 | 3004 | return 1; |
| 3005 | 3005 | } |
| 3006 | 3006 | } |
| r1461 | r1462 | |
| 3017 | 3017 | int shift = (readinputport( THOM_INPUT_KEYBOARD + 9 ) & 1) ? 0 : 0x080; |
| 3018 | 3018 | int key = -1, line, bit; |
| 3019 | 3019 | |
| 3020 | if ( readinputport( THOM_INPUT_CONFIG ) & 2 ) | |
| 3020 | if ( readinputport( THOM_INPUT_CONFIG ) & 2 ) | |
| 3021 | 3021 | return -1; /* disabled */ |
| 3022 | 3022 | |
| 3023 | for ( line = 0; line < 10; line++ ) | |
| 3023 | for ( line = 0; line < 10; line++ ) | |
| 3024 | 3024 | { |
| 3025 | 3025 | UINT8 port = readinputport( THOM_INPUT_KEYBOARD + line ); |
| 3026 | 3026 | |
| 3027 | if ( line == 7 || line == 9 ) | |
| 3027 | if ( line == 7 || line == 9 ) | |
| 3028 | 3028 | port |= 1; /* shift & control */ |
| 3029 | 3029 | |
| 3030 | 3030 | /* TODO: correct handling of simultaneous keystokes: |
| r1461 | r1462 | |
| 3037 | 3037 | } |
| 3038 | 3038 | } |
| 3039 | 3039 | |
| 3040 | if ( key == -1 ) | |
| 3040 | if ( key == -1 ) | |
| 3041 | 3041 | { |
| 3042 | 3042 | to8_kbd_last_key = 0xff; |
| 3043 | 3043 | to8_kbd_key_count = 0; |
| 3044 | 3044 | return -1; |
| 3045 | 3045 | } |
| 3046 | else if ( key == 64 ) | |
| 3046 | else if ( key == 64 ) | |
| 3047 | 3047 | { |
| 3048 | 3048 | /* caps lock */ |
| 3049 | if ( to8_kbd_last_key == key ) | |
| 3049 | if ( to8_kbd_last_key == key ) | |
| 3050 | 3050 | return -1; /* no repeat */ |
| 3051 | 3051 | to8_kbd_last_key = key; |
| 3052 | 3052 | to8_kbd_caps = !to8_kbd_caps; |
| 3053 | if ( to8_kbd_caps ) | |
| 3053 | if ( to8_kbd_caps ) | |
| 3054 | 3054 | key |= 0x080; /* auto-shift */ |
| 3055 | 3055 | thom_set_caps_led( ! to8_kbd_caps ); |
| 3056 | 3056 | return key; |
| 3057 | 3057 | } |
| 3058 | else if ( key == to8_kbd_last_key ) | |
| 3058 | else if ( key == to8_kbd_last_key ) | |
| 3059 | 3059 | { |
| 3060 | 3060 | /* repeat */ |
| 3061 | 3061 | to8_kbd_key_count++; |
| r1461 | r1462 | |
| 3063 | 3063 | return -1; |
| 3064 | 3064 | return key | shift | control; |
| 3065 | 3065 | } |
| 3066 | else | |
| 3066 | else | |
| 3067 | 3067 | { |
| 3068 | 3068 | to8_kbd_last_key = key; |
| 3069 | 3069 | to8_kbd_key_count = 0; |
| r1461 | r1462 | |
| 3076 | 3076 | 0 = idle, key polling |
| 3077 | 3077 | 1 = wait for ack to go down (key to send) |
| 3078 | 3078 | 99-117 = key data transmit |
| 3079 | 91-117 = signal | |
| 3079 | 91-117 = signal | |
| 3080 | 3080 | 255 = timeout |
| 3081 | 3081 | */ |
| 3082 | 3082 | |
| r1461 | r1462 | |
| 3089 | 3089 | logerror( "%f to8_kbd_timer_cb: step=%i ack=%i data=$%03X\n", attotime_to_double(timer_get_time()), to8_kbd_step, to8_kbd_ack, to8_kbd_data ); |
| 3090 | 3090 | #endif |
| 3091 | 3091 | |
| 3092 | if( ! to8_kbd_step ) | |
| 3092 | if( ! to8_kbd_step ) | |
| 3093 | 3093 | { |
| 3094 | 3094 | /* key polling */ |
| 3095 | 3095 | int k = to8_kbd_get_key(); |
| 3096 | 3096 | /* if not in transfer, send pulse from time to time |
| 3097 | 3097 | (helps avoiding CPU lock) |
| 3098 | 3098 | */ |
| 3099 | if ( ! to8_kbd_ack ) | |
| 3099 | if ( ! to8_kbd_ack ) | |
| 3100 | 3100 | mc6846_set_input_cp1( 0 ); |
| 3101 | 3101 | mc6846_set_input_cp1( 1 ); |
| 3102 | 3102 | |
| 3103 | if ( k == -1 ) | |
| 3103 | if ( k == -1 ) | |
| 3104 | 3104 | d = TO8_KBD_POLL_PERIOD; |
| 3105 | else | |
| 3105 | else | |
| 3106 | 3106 | { |
| 3107 | 3107 | /* got key! */ |
| 3108 | 3108 | #if VERBOSE_KBD |
| r1461 | r1462 | |
| 3113 | 3113 | d = ATTOTIME_IN_USEC( 100 ); |
| 3114 | 3114 | } |
| 3115 | 3115 | } |
| 3116 | else if ( to8_kbd_step == 255 ) | |
| 3116 | else if ( to8_kbd_step == 255 ) | |
| 3117 | 3117 | { |
| 3118 | 3118 | /* timeout */ |
| 3119 | 3119 | to8_kbd_last_key = 0xff; |
| r1461 | r1462 | |
| 3122 | 3122 | mc6846_set_input_cp1( 1 ); |
| 3123 | 3123 | d = TO8_KBD_POLL_PERIOD; |
| 3124 | 3124 | } |
| 3125 | else if ( to8_kbd_step == 1 ) | |
| 3125 | else if ( to8_kbd_step == 1 ) | |
| 3126 | 3126 | { |
| 3127 | 3127 | /* schedule timeout waiting for ack to go down */ |
| 3128 | 3128 | mc6846_set_input_cp1( 0 ); |
| 3129 | 3129 | to8_kbd_step = 255; |
| 3130 | 3130 | d = TO8_KBD_TIMEOUT; |
| 3131 | 3131 | } |
| 3132 | else if ( to8_kbd_step == 117 ) | |
| 3132 | else if ( to8_kbd_step == 117 ) | |
| 3133 | 3133 | { |
| 3134 | 3134 | /* schedule timeout waiting for ack to go up */ |
| 3135 | 3135 | mc6846_set_input_cp1( 0 ); |
| 3136 | 3136 | to8_kbd_step = 255; |
| 3137 | 3137 | d = TO8_KBD_TIMEOUT; |
| 3138 | 3138 | } |
| 3139 | else if ( to8_kbd_step & 1 ) | |
| 3139 | else if ( to8_kbd_step & 1 ) | |
| 3140 | 3140 | { |
| 3141 | 3141 | /* send silence between bits */ |
| 3142 | 3142 | mc6846_set_input_cp1( 0 ); |
| 3143 | 3143 | d = ATTOTIME_IN_USEC( 100 ); |
| 3144 | 3144 | to8_kbd_step++; |
| 3145 | 3145 | } |
| 3146 | else | |
| 3146 | else | |
| 3147 | 3147 | { |
| 3148 | 3148 | /* send bit */ |
| 3149 | 3149 | int bpos = 8 - ( (to8_kbd_step - 100) / 2); |
| r1461 | r1462 | |
| 3167 | 3167 | /* cpu <-> keyboard hand-check */ |
| 3168 | 3168 | static void to8_kbd_set_ack ( int data ) |
| 3169 | 3169 | { |
| 3170 | if ( data == to8_kbd_ack ) | |
| 3170 | if ( data == to8_kbd_ack ) | |
| 3171 | 3171 | return; |
| 3172 | 3172 | to8_kbd_ack = data; |
| 3173 | ||
| 3174 | if ( data ) | |
| 3173 | ||
| 3174 | if ( data ) | |
| 3175 | 3175 | { |
| 3176 | 3176 | double len = attotime_to_double(timer_timeelapsed( to8_kbd_signal )) * 1000. - 2.; |
| 3177 | 3177 | #if VERBOSE_KBD |
| 3178 | 3178 | logerror( "%f to8_kbd_set_ack: CPU end ack, len=%f\n", attotime_to_double(timer_get_time()), len ); |
| 3179 | 3179 | #endif |
| 3180 | if ( to8_kbd_data == 0xfff ) | |
| 3180 | if ( to8_kbd_data == 0xfff ) | |
| 3181 | 3181 | { |
| 3182 | 3182 | /* end signal from CPU */ |
| 3183 | if ( len >= 0.6 && len <= 0.8 ) | |
| 3183 | if ( len >= 0.6 && len <= 0.8 ) | |
| 3184 | 3184 | { |
| 3185 | 3185 | LOG (( "%f to8_kbd_set_ack: INIT signal\n", attotime_to_double(timer_get_time()) )); |
| 3186 | 3186 | to8_kbd_last_key = 0xff; |
| r1461 | r1462 | |
| 3191 | 3191 | to8_kbd_step = 0; |
| 3192 | 3192 | timer_adjust( to8_kbd_timer, ATTOTIME_IN_MSEC( 1 ), 0, attotime_never ); |
| 3193 | 3193 | } |
| 3194 | else | |
| 3194 | else | |
| 3195 | 3195 | { |
| 3196 | 3196 | to8_kbd_step = 0; |
| 3197 | 3197 | timer_adjust( to8_kbd_timer, TO8_KBD_POLL_PERIOD, 0, attotime_never ); |
| 3198 | if ( len >= 1.2 && len <= 1.4 ) | |
| 3198 | if ( len >= 1.2 && len <= 1.4 ) | |
| 3199 | 3199 | { |
| 3200 | 3200 | LOG (( "%f to8_kbd_set_ack: CAPS on signal\n", attotime_to_double(timer_get_time()) )); |
| 3201 | 3201 | to8_kbd_caps = 1; |
| 3202 | 3202 | } |
| 3203 | else if ( len >= 1.8 && len <= 2.0 ) | |
| 3203 | else if ( len >= 1.8 && len <= 2.0 ) | |
| 3204 | 3204 | { |
| 3205 | 3205 | LOG (( "%f to8_kbd_set_ack: CAPS off signal\n", attotime_to_double(timer_get_time()) )); |
| 3206 | 3206 | to8_kbd_caps = 0; |
| r1461 | r1462 | |
| 3208 | 3208 | } |
| 3209 | 3209 | thom_set_caps_led( ! to8_kbd_caps ); |
| 3210 | 3210 | } |
| 3211 | else | |
| 3211 | else | |
| 3212 | 3212 | { |
| 3213 | 3213 | /* end key transmission */ |
| 3214 | 3214 | to8_kbd_step = 0; |
| r1461 | r1462 | |
| 3216 | 3216 | } |
| 3217 | 3217 | } |
| 3218 | 3218 | |
| 3219 | else | |
| 3219 | else | |
| 3220 | 3220 | { |
| 3221 | if ( to8_kbd_step == 255 ) | |
| 3221 | if ( to8_kbd_step == 255 ) | |
| 3222 | 3222 | { |
| 3223 | 3223 | /* CPU accepts key */ |
| 3224 | 3224 | to8_kbd_step = 99; |
| 3225 | 3225 | timer_adjust( to8_kbd_timer, ATTOTIME_IN_USEC( 400 ), 0, attotime_never ); |
| 3226 | 3226 | } |
| 3227 | else | |
| 3227 | else | |
| 3228 | 3228 | { |
| 3229 | 3229 | /* start signal from CPU */ |
| 3230 | 3230 | to8_kbd_data = 0xfff; |
| r1461 | r1462 | |
| 3246 | 3246 | to8_kbd_key_count = 0; |
| 3247 | 3247 | to8_kbd_step = 0; |
| 3248 | 3248 | to8_kbd_data = 0; |
| 3249 | to8_kbd_ack = 1; | |
| 3249 | to8_kbd_ack = 1; | |
| 3250 | 3250 | to8_kbd_caps = 1; |
| 3251 | 3251 | thom_set_caps_led( ! to8_kbd_caps ); |
| 3252 | 3252 | to8_kbd_timer_func(); |
| r1461 | r1462 | |
| 3286 | 3286 | static int old_bank = -1; |
| 3287 | 3287 | int bank = (to8_reg_sys1 & 0x80) ? to7_floppy_bank : (to8_bios_bank + TO7_NB_FLOP_BANK); |
| 3288 | 3288 | #if VERBOSE_BANK |
| 3289 | if ( bank != old_bank ) | |
| 3289 | if ( bank != old_bank ) | |
| 3290 | 3290 | logerror( "to8_update_floppy_bank: floppy ROM is %s bank %i\n", |
| 3291 | 3291 | (to8_reg_sys1 & 0x80) ? "external" : "internal", |
| 3292 | 3292 | bank % TO7_NB_FLOP_BANK ); |
| r1461 | r1462 | |
| 3301 | 3301 | { |
| 3302 | 3302 | UINT8 bank = 0; |
| 3303 | 3303 | |
| 3304 | if ( to8_reg_sys1 & 0x10 ) | |
| 3304 | if ( to8_reg_sys1 & 0x10 ) | |
| 3305 | 3305 | { |
| 3306 | 3306 | bank = to8_reg_ram & 31; |
| 3307 | 3307 | #if VERBOSE_BANK |
| 3308 | if ( bank != to8_data_vpage ) | |
| 3308 | if ( bank != to8_data_vpage ) | |
| 3309 | 3309 | logerror( "to8_update_ram_bank: select bank %i (new style)\n", bank ); |
| 3310 | 3310 | #endif |
| 3311 | 3311 | } |
| 3312 | else | |
| 3312 | else | |
| 3313 | 3313 | { |
| 3314 | 3314 | UINT8 portb = pia_get_port_b_z_mask( THOM_PIA_SYS ); |
| 3315 | 3315 | |
| 3316 | switch ( portb & 0xf8 ) | |
| 3316 | switch ( portb & 0xf8 ) | |
| 3317 | 3317 | { |
| 3318 | 3318 | /* in compatibility mode, banks 5 and 6 are reversed wrt TO7/70 */ |
| 3319 | 3319 | case 0xf0: bank = 2; break; |
| r1461 | r1462 | |
| 3336 | 3336 | /* due to adressing distortion, the 16 KB banked memory space is |
| 3337 | 3337 | split into two 8 KB spaces: |
| 3338 | 3338 | - 0xa000-0xbfff maps to 0x2000-0x3fff in 16 KB bank |
| 3339 | - 0xc000-0xdfff maps to 0x0000-0x1fff in 16 KB bank | |
| 3339 | - 0xc000-0xdfff maps to 0x0000-0x1fff in 16 KB bank | |
| 3340 | 3340 | this is important if we map a bank that is also reachable by another, |
| 3341 | 3341 | undistorted space, such as cartridge, page 0 (video), or page 1 |
| 3342 | 3342 | */ |
| 3343 | 3343 | to8_data_vpage = bank; |
| 3344 | 3344 | memory_set_bank( TO8_DATA_LO, to8_data_vpage ); |
| 3345 | 3345 | memory_set_bank( TO8_DATA_HI, to8_data_vpage ); |
| 3346 | memory_install_write8_handler( 0, ADDRESS_SPACE_PROGRAM, 0xa000, 0xbfff, 0, 0, | |
| 3347 | (mess_ram_size == 512*1024 || to8_data_vpage < 16) ? | |
| 3346 | memory_install_write8_handler( 0, ADDRESS_SPACE_PROGRAM, 0xa000, 0xbfff, 0, 0, | |
| 3347 | (mess_ram_size == 512*1024 || to8_data_vpage < 16) ? | |
| 3348 | 3348 | to8_data_vpage <= 4 ? to8_data_lo_w : |
| 3349 | 3349 | (write8_handler)(STATIC_BANK1 + TO8_DATA_LO - 1) : |
| 3350 | 3350 | MWA8_NOP ); |
| 3351 | memory_install_write8_handler( 0, ADDRESS_SPACE_PROGRAM, 0xc000, 0xdfff, 0, 0, | |
| 3351 | memory_install_write8_handler( 0, ADDRESS_SPACE_PROGRAM, 0xc000, 0xdfff, 0, 0, | |
| 3352 | 3352 | (mess_ram_size == 512*1024 || to8_data_vpage < 16) ? |
| 3353 | 3353 | to8_data_vpage <= 4 ? to8_data_hi_w : |
| 3354 | (write8_handler)(STATIC_BANK1 + TO8_DATA_HI - 1) : | |
| 3354 | (write8_handler)(STATIC_BANK1 + TO8_DATA_HI - 1) : | |
| 3355 | 3355 | MWA8_NOP ); |
| 3356 | 3356 | } |
| 3357 | 3357 | |
| r1461 | r1462 | |
| 3365 | 3365 | /* reset bank switch */ |
| 3366 | 3366 | memory_install_read8_handler( 0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x0003, 0, 0, (read8_handler)(STATIC_BANK1 + THOM_CART_BANK - 1) ); |
| 3367 | 3367 | |
| 3368 | if ( to8_reg_cart & 0x20 ) | |
| 3368 | if ( to8_reg_cart & 0x20 ) | |
| 3369 | 3369 | { |
| 3370 | 3370 | /* RAM space */ |
| 3371 | 3371 | to8_cart_vpage = to8_reg_cart & 31; |
| r1461 | r1462 | |
| 3373 | 3373 | memory_install_write8_handler( 0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x3fff, 0, 0, |
| 3374 | 3374 | ((to8_cart_vpage < 8 || mess_ram_size == 512*1024) && (to8_reg_cart & 0x40)) ? |
| 3375 | 3375 | (to8_cart_vpage <= 4) ? to8_vcart_w : |
| 3376 | (write8_handler)(STATIC_BANK1 + THOM_CART_BANK - 1) : | |
| 3376 | (write8_handler)(STATIC_BANK1 + THOM_CART_BANK - 1) : | |
| 3377 | 3377 | MWA8_NOP ); |
| 3378 | 3378 | #if VERBOSE_BANK |
| 3379 | 3379 | if ( bank != old_bank ) |
| 3380 | 3380 | logerror( "to8_update_cart_bank: CART is RAM bank %i (write-enable=%i)\n", to8_cart_vpage, (to8_reg_cart & 0x40) ? 1 : 0 ); |
| 3381 | 3381 | #endif |
| 3382 | 3382 | } |
| 3383 | else | |
| 3383 | else | |
| 3384 | 3384 | { |
| 3385 | 3385 | memory_install_write8_handler( 0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x3fff, 0, 0, to8_cartridge_w ); |
| 3386 | if ( to8_soft_select ) | |
| 3387 | { | |
| 3386 | if ( to8_soft_select ) | |
| 3387 | { | |
| 3388 | 3388 | /* internal software ROM space */ |
| 3389 | 3389 | bank = 4 + to8_soft_bank; |
| 3390 | 3390 | #if VERBOSE_BANK |
| 3391 | 3391 | if ( bank != old_bank ) |
| 3392 | logerror( "to8_update_cart_bank: CART is internal bank %i\n", | |
| 3392 | logerror( "to8_update_cart_bank: CART is internal bank %i\n", | |
| 3393 | 3393 | to8_soft_bank ); |
| 3394 | 3394 | #endif |
| 3395 | 3395 | } |
| 3396 | else | |
| 3396 | else | |
| 3397 | 3397 | { |
| 3398 | 3398 | /* external cartridge ROM space */ |
| 3399 | 3399 | if ( thom_cart_nb_banks ) |
| r1461 | r1462 | |
| 3418 | 3418 | /* ROM bank switch */ |
| 3419 | 3419 | WRITE8_HANDLER ( to8_cartridge_w ) |
| 3420 | 3420 | { |
| 3421 | if ( offset >= 0x2000 ) | |
| 3421 | if ( offset >= 0x2000 ) | |
| 3422 | 3422 | return; |
| 3423 | 3423 | |
| 3424 | if ( to8_soft_select ) | |
| 3424 | if ( to8_soft_select ) | |
| 3425 | 3425 | to8_soft_bank = offset & 3; |
| 3426 | else | |
| 3426 | else | |
| 3427 | 3427 | thom_cart_bank = offset & 3; |
| 3428 | 3428 | |
| 3429 | 3429 | to8_update_cart_bank(); |
| r1461 | r1462 | |
| 3458 | 3458 | { |
| 3459 | 3459 | UINT8* mem = memory_region(REGION_CPU1); |
| 3460 | 3460 | to7_floppy_reset(); |
| 3461 | if ( THOM_FLOPPY_INT ) | |
| 3461 | if ( THOM_FLOPPY_INT ) | |
| 3462 | 3462 | thmfc_floppy_reset(); |
| 3463 | 3463 | memory_configure_bank( THOM_FLOP_BANK, TO7_NB_FLOP_BANK, 2, mem + 0x30000, 0x2000 ); |
| 3464 | 3464 | } |
| r1461 | r1462 | |
| 3467 | 3467 | |
| 3468 | 3468 | READ8_HANDLER ( to8_floppy_r ) |
| 3469 | 3469 | { |
| 3470 | if ( (to8_reg_sys1 & 0x80) && THOM_FLOPPY_EXT ) | |
| 3470 | if ( (to8_reg_sys1 & 0x80) && THOM_FLOPPY_EXT ) | |
| 3471 | 3471 | /* external controller */ |
| 3472 | 3472 | return to7_floppy_r( offset ); |
| 3473 | else if ( ! (to8_reg_sys1 & 0x80) && THOM_FLOPPY_INT ) | |
| 3473 | else if ( ! (to8_reg_sys1 & 0x80) && THOM_FLOPPY_INT ) | |
| 3474 | 3474 | /* internal controller */ |
| 3475 | 3475 | return thmfc_floppy_r( offset ); |
| 3476 | else | |
| 3476 | else | |
| 3477 | 3477 | /* no controller */ |
| 3478 | 3478 | return 0; |
| 3479 | 3479 | } |
| r1461 | r1462 | |
| 3482 | 3482 | |
| 3483 | 3483 | WRITE8_HANDLER ( to8_floppy_w ) |
| 3484 | 3484 | { |
| 3485 | if ( (to8_reg_sys1 & 0x80) && THOM_FLOPPY_EXT ) | |
| 3485 | if ( (to8_reg_sys1 & 0x80) && THOM_FLOPPY_EXT ) | |
| 3486 | 3486 | /* external controller */ |
| 3487 | 3487 | to7_floppy_w( offset, data ); |
| 3488 | else if ( ! (to8_reg_sys1 & 0x80) && THOM_FLOPPY_INT ) | |
| 3488 | else if ( ! (to8_reg_sys1 & 0x80) && THOM_FLOPPY_INT ) | |
| 3489 | 3489 | /* internal controller */ |
| 3490 | 3490 | thmfc_floppy_w( offset, data ); |
| 3491 | 3491 | } |
| r1461 | r1462 | |
| 3511 | 3511 | init = to7_lightpen ? l.init : v.init; |
| 3512 | 3512 | lt3 = to7_lightpen ? l.lt3 : v.lt3; |
| 3513 | 3513 | |
| 3514 | switch ( offset ) | |
| 3514 | switch ( offset ) | |
| 3515 | 3515 | { |
| 3516 | 3516 | |
| 3517 | 3517 | case 0: /* system 2 / lightpen register 1 */ |
| 3518 | if ( to7_lightpen ) | |
| 3518 | if ( to7_lightpen ) | |
| 3519 | 3519 | res = (count >> 8) & 0xff; |
| 3520 | else | |
| 3520 | else | |
| 3521 | 3521 | res = to8_reg_sys2 & 0xf0; |
| 3522 | 3522 | break; |
| 3523 | 3523 | |
| 3524 | 3524 | case 1: /* ram register / lightpen register 2 */ |
| 3525 | if ( to7_lightpen ) | |
| 3525 | if ( to7_lightpen ) | |
| 3526 | 3526 | { |
| 3527 | 3527 | thom_firq_2( 0 ); |
| 3528 | to8_lightpen_intr = 0; | |
| 3528 | to8_lightpen_intr = 0; | |
| 3529 | 3529 | res = count & 0xff; |
| 3530 | 3530 | } |
| 3531 | else | |
| 3531 | else | |
| 3532 | 3532 | res = to8_reg_ram & 0x1f; |
| 3533 | 3533 | break; |
| 3534 | 3534 | |
| 3535 | 3535 | case 2: /* cartrige register / lightpen register 3 */ |
| 3536 | if ( to7_lightpen ) | |
| 3536 | if ( to7_lightpen ) | |
| 3537 | 3537 | res = (lt3 << 7) | (inil << 6); |
| 3538 | else | |
| 3538 | else | |
| 3539 | 3539 | res = to8_reg_cart; |
| 3540 | 3540 | break; |
| 3541 | 3541 | |
| r1461 | r1462 | |
| 3562 | 3562 | WRITE8_HANDLER ( to8_gatearray_w ) |
| 3563 | 3563 | { |
| 3564 | 3564 | #if VERBOSE_VIDEO |
| 3565 | logerror( "$%04x %f to8_gatearray_w: off=%i ($%04X) data=$%02X\n", | |
| 3565 | logerror( "$%04x %f to8_gatearray_w: off=%i ($%04X) data=$%02X\n", | |
| 3566 | 3566 | activecpu_get_previouspc(), attotime_to_double(timer_get_time()), |
| 3567 | 3567 | offset, 0xe7e4 + offset, data ); |
| 3568 | 3568 | #endif |
| 3569 | 3569 | |
| 3570 | switch ( offset ) | |
| 3570 | switch ( offset ) | |
| 3571 | 3571 | { |
| 3572 | 3572 | |
| 3573 | 3573 | case 0: /* switch */ |
| r1461 | r1462 | |
| 3575 | 3575 | break; |
| 3576 | 3576 | |
| 3577 | 3577 | case 1: /* ram register */ |
| 3578 | if ( to8_reg_sys1 & 0x10 ) | |
| 3578 | if ( to8_reg_sys1 & 0x10 ) | |
| 3579 | 3579 | { |
| 3580 | 3580 | to8_reg_ram = data; |
| 3581 | 3581 | to8_update_ram_bank(); |
| r1461 | r1462 | |
| 3595 | 3595 | break; |
| 3596 | 3596 | |
| 3597 | 3597 | default: |
| 3598 | logerror( "$%04x to8_gatearray_w: invalid offset %i (data=$%02X)\n", | |
| 3598 | logerror( "$%04x to8_gatearray_w: invalid offset %i (data=$%02X)\n", | |
| 3599 | 3599 | activecpu_get_previouspc(), offset, data ); |
| 3600 | 3600 | } |
| 3601 | 3601 | } |
| r1461 | r1462 | |
| 3609 | 3609 | READ8_HANDLER ( to8_vreg_r ) |
| 3610 | 3610 | { |
| 3611 | 3611 | /* 0xe7dc from external floppy drive aliases the video gate-array */ |
| 3612 | if ( ( offset == 3 ) && ( to8_reg_ram & 0x80 ) && ( to8_reg_sys1 & 0x80 ) ) | |
| 3612 | if ( ( offset == 3 ) && ( to8_reg_ram & 0x80 ) && ( to8_reg_sys1 & 0x80 ) ) | |
| 3613 | 3613 | { |
| 3614 | if ( THOM_FLOPPY_EXT ) | |
| 3614 | if ( THOM_FLOPPY_EXT ) | |
| 3615 | 3615 | return to7_floppy_r( 0xc ); |
| 3616 | else | |
| 3616 | else | |
| 3617 | 3617 | return 0; |
| 3618 | 3618 | } |
| 3619 | 3619 | |
| 3620 | switch ( offset ) | |
| 3620 | switch ( offset ) | |
| 3621 | 3621 | { |
| 3622 | 3622 | |
| 3623 | 3623 | case 0: /* palette data */ |
| r1461 | r1462 | |
| 3645 | 3645 | WRITE8_HANDLER ( to8_vreg_w ) |
| 3646 | 3646 | { |
| 3647 | 3647 | #if VERBOSE_VIDEO |
| 3648 | logerror( "$%04x %f to8_vreg_w: off=%i ($%04X) data=$%02X\n", | |
| 3648 | logerror( "$%04x %f to8_vreg_w: off=%i ($%04X) data=$%02X\n", | |
| 3649 | 3649 | activecpu_get_previouspc(), attotime_to_double(timer_get_time()), |
| 3650 | 3650 | offset, 0xe7da + offset, data ); |
| 3651 | 3651 | #endif |
| 3652 | 3652 | |
| 3653 | switch ( offset ) | |
| 3653 | switch ( offset ) | |
| 3654 | 3654 | { |
| 3655 | 3655 | |
| 3656 | 3656 | case 0: /* palette data */ |
| r1461 | r1462 | |
| 3665 | 3665 | } |
| 3666 | 3666 | break; |
| 3667 | 3667 | |
| 3668 | case 1: /* palette address */ | |
| 3668 | case 1: /* palette address */ | |
| 3669 | 3669 | to9_palette_idx = data & 31; |
| 3670 | 3670 | break; |
| 3671 | 3671 | |
| r1461 | r1462 | |
| 3673 | 3673 | to9_set_video_mode( data, 1 ); |
| 3674 | 3674 | break; |
| 3675 | 3675 | |
| 3676 | case 3: /* system register 2 */ | |
| 3676 | case 3: /* system register 2 */ | |
| 3677 | 3677 | /* 0xe7dc from external floppy drive aliases the video gate-array */ |
| 3678 | if ( ( offset == 3 ) && ( to8_reg_ram & 0x80 ) && ( to8_reg_sys1 & 0x80 ) ) | |
| 3678 | if ( ( offset == 3 ) && ( to8_reg_ram & 0x80 ) && ( to8_reg_sys1 & 0x80 ) ) | |
| 3679 | 3679 | { |
| 3680 | if ( THOM_FLOPPY_EXT ) | |
| 3680 | if ( THOM_FLOPPY_EXT ) | |
| 3681 | 3681 | to7_floppy_w( 0xc, data ); |
| 3682 | 3682 | } |
| 3683 | else | |
| 3683 | else | |
| 3684 | 3684 | { |
| 3685 | 3685 | to8_reg_sys2 = data; |
| 3686 | 3686 | thom_set_video_page( data >> 6 ); |
| r1461 | r1462 | |
| 3713 | 3713 | |
| 3714 | 3714 | |
| 3715 | 3715 | static WRITE8_HANDLER ( to8_sys_portb_out ) |
| 3716 | { | |
| 3716 | { | |
| 3717 | 3717 | to9_update_centronics(); /* bits 0-1: printer */ |
| 3718 | 3718 | to8_update_ram_bank(); |
| 3719 | 3719 | #if VERBOSE |
| r1461 | r1462 | |
| 3724 | 3724 | |
| 3725 | 3725 | |
| 3726 | 3726 | |
| 3727 | static const pia6821_interface to8_sys = | |
| 3727 | static const pia6821_interface to8_sys = | |
| 3728 | 3728 | { |
| 3729 | 3729 | to8_sys_porta_in, NULL, |
| 3730 | 3730 | NULL, NULL, NULL, NULL, |
| 3731 | 3731 | to9_sys_porta_out, to8_sys_portb_out, to7_set_cassette_motor, NULL, |
| 3732 | NULL, thom_firq_1 | |
| 3732 | NULL, thom_firq_1 | |
| 3733 | 3733 | }; |
| 3734 | 3734 | |
| 3735 | 3735 | |
| r1461 | r1462 | |
| 3772 | 3772 | |
| 3773 | 3773 | |
| 3774 | 3774 | |
| 3775 | static const mc6846_interface to8_timer = | |
| 3776 | { | |
| 3777 | to8_timer_port_out, NULL, to8_timer_cp2_out, | |
| 3778 | to8_timer_port_in, to7_timer_tco_out, | |
| 3779 | thom_irq_0 | |
| 3775 | static const mc6846_interface to8_timer = | |
| 3776 | { | |
| 3777 | to8_timer_port_out, NULL, to8_timer_cp2_out, | |
| 3778 | to8_timer_port_in, to7_timer_tco_out, | |
| 3779 | thom_irq_0 | |
| 3780 | 3780 | }; |
| 3781 | 3781 | |
| 3782 | 3782 | |
| r1461 | r1462 | |
| 3788 | 3788 | /* direct connection to interrupt line instead of through a PIA */ |
| 3789 | 3789 | static void to8_lightpen_cb ( int step ) |
| 3790 | 3790 | { |
| 3791 | if ( ! to7_lightpen ) | |
| 3791 | if ( ! to7_lightpen ) | |
| 3792 | 3792 | return; |
| 3793 | ||
| 3793 | ||
| 3794 | 3794 | thom_firq_2( 1 ); |
| 3795 | 3795 | to7_lightpen_step = step; |
| 3796 | 3796 | to8_lightpen_intr = 1; |
| r1461 | r1462 | |
| 3869 | 3869 | to7_midi_init(); |
| 3870 | 3870 | to7_rf57932_init(); |
| 3871 | 3871 | mea8000_config( THOM_SOUND_SPEECH, NULL ); |
| 3872 | ||
| 3872 | ||
| 3873 | 3873 | /* memory */ |
| 3874 | 3874 | thom_cart_bank = 0; |
| 3875 | 3875 | thom_vram = mess_ram; |
| r1461 | r1462 | |
| 3883 | 3883 | memory_configure_bank( TO8_BIOS_BANK, 0, 2, mem + 0x30800, 0x2000 ); |
| 3884 | 3884 | memory_set_bank( TO8_SYS_LO, 0 ); |
| 3885 | 3885 | memory_set_bank( TO8_SYS_HI, 0 ); |
| 3886 | ||
| 3886 | ||
| 3887 | 3887 | /* save-state */ |
| 3888 | 3888 | state_save_register_global( thom_cart_nb_banks ); |
| 3889 | 3889 | state_save_register_global( thom_cart_bank ); |
| r1461 | r1462 | |
| 3915 | 3915 | |
| 3916 | 3916 | |
| 3917 | 3917 | |
| 3918 | static const pia6821_interface to9p_sys = | |
| 3918 | static const pia6821_interface to9p_sys = | |
| 3919 | 3919 | { |
| 3920 | 3920 | to9_sys_porta_in, NULL, |
| 3921 | 3921 | NULL, NULL, NULL, NULL, |
| r1461 | r1462 | |
| 3951 | 3951 | |
| 3952 | 3952 | |
| 3953 | 3953 | |
| 3954 | static const mc6846_interface to9p_timer = | |
| 3955 | { | |
| 3956 | to9p_timer_port_out, NULL, to8_timer_cp2_out, | |
| 3957 | to9p_timer_port_in, to7_timer_tco_out, | |
| 3958 | thom_irq_0 | |
| 3954 | static const mc6846_interface to9p_timer = | |
| 3955 | { | |
| 3956 | to9p_timer_port_out, NULL, to8_timer_cp2_out, | |
| 3957 | to9p_timer_port_in, to7_timer_tco_out, | |
| 3958 | thom_irq_0 | |
| 3959 | 3959 | }; |
| 3960 | 3960 | |
| 3961 | 3961 | |
| r1461 | r1462 | |
| 4031 | 4031 | to7_midi_init(); |
| 4032 | 4032 | to7_rf57932_init(); |
| 4033 | 4033 | mea8000_config( THOM_SOUND_SPEECH, NULL ); |
| 4034 | ||
| 4034 | ||
| 4035 | 4035 | /* memory */ |
| 4036 | 4036 | thom_cart_bank = 0; |
| 4037 | 4037 | thom_vram = mess_ram; |
| r1461 | r1462 | |
| 4045 | 4045 | memory_configure_bank( TO8_BIOS_BANK, 0, 2, mem + 0x30800, 0x2000 ); |
| 4046 | 4046 | memory_set_bank( TO8_SYS_LO, 0 ); |
| 4047 | 4047 | memory_set_bank( TO8_SYS_HI, 0 ); |
| 4048 | ||
| 4048 | ||
| 4049 | 4049 | /* save-state */ |
| 4050 | 4050 | state_save_register_global( thom_cart_nb_banks ); |
| 4051 | 4051 | state_save_register_global( thom_cart_bank ); |
| r1461 | r1462 | |
| 4081 | 4081 | { |
| 4082 | 4082 | UINT8 bank = 0; |
| 4083 | 4083 | |
| 4084 | if ( to8_reg_sys1 & 0x10 ) | |
| 4084 | if ( to8_reg_sys1 & 0x10 ) | |
| 4085 | 4085 | { |
| 4086 | 4086 | bank = to8_reg_ram & 7; /* 128 KB RAM only = 8 pages */ |
| 4087 | 4087 | #if VERBOSE_BANK |
| 4088 | if ( bank != to8_data_vpage ) | |
| 4088 | if ( bank != to8_data_vpage ) | |
| 4089 | 4089 | logerror( "mo6_update_ram_bank: select bank %i (new style)\n", bank ); |
| 4090 | 4090 | #endif |
| 4091 | 4091 | } |
| r1461 | r1462 | |
| 4103 | 4103 | int bank = 0; |
| 4104 | 4104 | |
| 4105 | 4105 | memory_install_read8_handler( 0, ADDRESS_SPACE_PROGRAM, 0xb000, 0xefff, 0, 0, (read8_handler)(STATIC_BANK1 + THOM_CART_BANK - 1) ); |
| 4106 | ||
| 4107 | if ( ( ( to8_reg_sys1 & 0x40 ) && ( to8_reg_cart & 0x20 ) ) || ( ! ( to8_reg_sys1 & 0x40 ) && ( mo5_reg_cart & 4 ) ) ) | |
| 4106 | ||
| 4107 | if ( ( ( to8_reg_sys1 & 0x40 ) && ( to8_reg_cart & 0x20 ) ) || ( ! ( to8_reg_sys1 & 0x40 ) && ( mo5_reg_cart & 4 ) ) ) | |
| 4108 | 4108 | { |
| 4109 | 4109 | /* RAM space */ |
| 4110 | if ( to8_reg_sys1 & 0x40 ) | |
| 4110 | if ( to8_reg_sys1 & 0x40 ) | |
| 4111 | 4111 | { |
| 4112 | 4112 | /* use a7e6 */ |
| 4113 | 4113 | to8_cart_vpage = to8_reg_cart & 7; /* 128 KB RAM only = 8 pages */ |
| r1461 | r1462 | |
| 4120 | 4120 | logerror( "mo6_update_cart_bank: CART is RAM bank %i (write-enable=%i)\n", to8_cart_vpage, (to8_reg_cart & 0x40) ? 1 : 0 ); |
| 4121 | 4121 | #endif |
| 4122 | 4122 | } |
| 4123 | else if ( thom_cart_nb_banks == 4 ) | |
| 4123 | else if ( thom_cart_nb_banks == 4 ) | |
| 4124 | 4124 | { |
| 4125 | 4125 | /* "JANE"-style cartridge bank switching */ |
| 4126 | 4126 | memory_install_write8_handler( 0, ADDRESS_SPACE_PROGRAM, 0xb000, 0xefff, 0, 0, MWA8_NOP ); |
| r1461 | r1462 | |
| 4130 | 4130 | logerror( "mo6_update_cart_bank: CART is external cartridge bank %i (A7CB style)\n", bank ); |
| 4131 | 4131 | #endif |
| 4132 | 4132 | } |
| 4133 | else | |
| 4133 | else | |
| 4134 | 4134 | { |
| 4135 | 4135 | /* RAM from MO5 network extension */ |
| 4136 | 4136 | int write_enable = mo5_reg_cart & 8; |
| 4137 | 4137 | to8_cart_vpage = (mo5_reg_cart & 3) | 4; |
| 4138 | 4138 | bank = 8 + to8_cart_vpage; |
| 4139 | memory_install_write8_handler( 0, ADDRESS_SPACE_PROGRAM, 0xb000, 0xefff, 0, 0, write_enable ? | |
| 4139 | memory_install_write8_handler( 0, ADDRESS_SPACE_PROGRAM, 0xb000, 0xefff, 0, 0, write_enable ? | |
| 4140 | 4140 | (write8_handler)(STATIC_BANK1 + THOM_CART_BANK - 1) : MWA8_NOP ); |
| 4141 | 4141 | #if VERBOSE_BANK |
| 4142 | 4142 | if ( bank != old_bank ) |
| r1461 | r1462 | |
| 4144 | 4144 | #endif |
| 4145 | 4145 | } |
| 4146 | 4146 | } |
| 4147 | else | |
| 4147 | else | |
| 4148 | 4148 | { |
| 4149 | 4149 | /* ROM space */ |
| 4150 | 4150 | memory_install_write8_handler( 0, ADDRESS_SPACE_PROGRAM, 0xb000, 0xefff, 0, 0, MWA8_NOP ); |
| 4151 | if ( to8_reg_sys2 & 0x20 ) | |
| 4151 | if ( to8_reg_sys2 & 0x20 ) | |
| 4152 | 4152 | { |
| 4153 | 4153 | /* internal ROM */ |
| 4154 | if ( to8_reg_sys2 & 0x10) | |
| 4154 | if ( to8_reg_sys2 & 0x10) | |
| 4155 | 4155 | bank = b + 6; /* BASIC 128 */ |
| 4156 | else | |
| 4156 | else | |
| 4157 | 4157 | bank = b + 4; /* BASIC 1 */ |
| 4158 | 4158 | #if VERBOSE_BANK |
| 4159 | 4159 | if ( bank != old_bank ) |
| 4160 | 4160 | logerror( "mo6_update_cart_bank: CART is internal ROM bank %i\n", b ); |
| 4161 | 4161 | #endif |
| 4162 | 4162 | } |
| 4163 | else | |
| 4163 | else | |
| 4164 | 4164 | { |
| 4165 | 4165 | /* cartridge */ |
| 4166 | 4166 | memory_install_write8_handler( 0, ADDRESS_SPACE_PROGRAM, 0xb000, 0xefff, 0, 0, mo6_cartridge_w ); |
| 4167 | if ( thom_cart_nb_banks ) | |
| 4167 | if ( thom_cart_nb_banks ) | |
| 4168 | 4168 | { |
| 4169 | 4169 | bank = thom_cart_bank % thom_cart_nb_banks; |
| 4170 | 4170 | memory_install_read8_handler( 0, ADDRESS_SPACE_PROGRAM, 0xbffc, 0xbfff, 0, 0, mo6_cartridge_r ); |
| r1461 | r1462 | |
| 4186 | 4186 | /* write signal generates a bank switch */ |
| 4187 | 4187 | WRITE8_HANDLER ( mo6_cartridge_w ) |
| 4188 | 4188 | { |
| 4189 | if ( offset >= 0x2000 ) | |
| 4189 | if ( offset >= 0x2000 ) | |
| 4190 | 4190 | return; |
| 4191 | 4191 | |
| 4192 | 4192 | thom_cart_bank = offset & 3; |
| r1461 | r1462 | |
| 4245 | 4245 | { |
| 4246 | 4246 | /* centronics strobe */ |
| 4247 | 4247 | LOG (( "$%04x %f mo6_game_cb2_out: CENTRONICS set strobe=%i\n", activecpu_get_previouspc(), attotime_to_double(timer_get_time()), data )); |
| 4248 | centronics_write_handshake( 0, data ? CENTRONICS_STROBE : 0, | |
| 4248 | centronics_write_handshake( 0, data ? CENTRONICS_STROBE : 0, | |
| 4249 | 4249 | CENTRONICS_STROBE ); |
| 4250 | 4250 | } |
| 4251 | ||
| 4252 | 4251 | |
| 4253 | 4252 | |
| 4254 | static const pia6821_interface mo6_game = | |
| 4253 | ||
| 4254 | static const pia6821_interface mo6_game = | |
| 4255 | 4255 | { |
| 4256 | 4256 | to7_game_porta_in, to7_game_portb_in, |
| 4257 | 4257 | NULL, mo6_game_cb1_in, NULL, NULL, |
| r1461 | r1462 | |
| 4264 | 4264 | static TIMER_CALLBACK(mo6_game_update_cb) |
| 4265 | 4265 | { |
| 4266 | 4266 | /* unlike the TO8, CB1 & CB2 are not connected to buttons */ |
| 4267 | if ( readinputport( THOM_INPUT_CONFIG ) & 1 ) | |
| 4267 | if ( readinputport( THOM_INPUT_CONFIG ) & 1 ) | |
| 4268 | 4268 | { |
| 4269 | 4269 | UINT8 mouse = to7_get_mouse_signal(); |
| 4270 | 4270 | pia_set_input_ca1( THOM_PIA_GAME, mouse & 1 ); /* XA */ |
| 4271 | 4271 | pia_set_input_ca2( THOM_PIA_GAME, mouse & 2 ); /* YA */ |
| 4272 | 4272 | } |
| 4273 | else | |
| 4273 | else | |
| 4274 | 4274 | { |
| 4275 | 4275 | /* joystick */ |
| 4276 | 4276 | UINT8 in = readinputport( THOM_INPUT_GAME ); |
| r1461 | r1462 | |
| 4310 | 4310 | |
| 4311 | 4311 | static READ8_HANDLER ( mo6_sys_porta_in ) |
| 4312 | 4312 | { |
| 4313 | return | |
| 4313 | return | |
| 4314 | 4314 | (mo5_get_cassette() ? 0x80 : 0) | /* bit 7: cassette input */ |
| 4315 | 4315 | 8 | /* bit 3: kbd-line float up to 1 */ |
| 4316 | 4316 | ((readinputport( THOM_INPUT_LIGHTPEN + 2 ) & 1) ? 2 : 0); |
| r1461 | r1462 | |
| 4327 | 4327 | int col = (portb >> 4) & 7; /* B bits 4-6: kbd column */ |
| 4328 | 4328 | int lin = (portb >> 1) & 7; /* B bits 1-3: kbd line */ |
| 4329 | 4329 | |
| 4330 | if ( ! (porta & 8) ) | |
| 4330 | if ( ! (porta & 8) ) | |
| 4331 | 4331 | lin = 8; /* A bit 3: 9-th kbd line select */ |
| 4332 | 4332 | |
| 4333 | return | |
| 4334 | ( readinputport( THOM_INPUT_KEYBOARD + lin ) & (1 << col) ) | |
| 4333 | return | |
| 4334 | ( readinputport( THOM_INPUT_KEYBOARD + lin ) & (1 << col) ) | |
| 4335 | 4335 | ? 0x80 : 0; /* bit 7: key up */ |
| 4336 | 4336 | } |
| 4337 | 4337 | |
| 4338 | 4338 | |
| 4339 | 4339 | |
| 4340 | 4340 | static WRITE8_HANDLER ( mo6_sys_porta_out ) |
| 4341 | { | |
| 4341 | { | |
| 4342 | 4342 | thom_set_mode_point( data & 1 ); /* bit 0: video bank switch */ |
| 4343 | 4343 | to7_game_mute = data & 4; /* bit 2: sound mute */ |
| 4344 | 4344 | thom_set_caps_led( (data & 16) ? 0 : 1 ) ; /* bit 4: keyboard led */ |
| r1461 | r1462 | |
| 4350 | 4350 | |
| 4351 | 4351 | |
| 4352 | 4352 | static WRITE8_HANDLER ( mo6_sys_portb_out ) |
| 4353 | { | |
| 4353 | { | |
| 4354 | 4354 | DAC_data_w( THOM_SOUND_BUZ, (data & 1) ? 0x80 : 0); /* bit 0: buzzer */ |
| 4355 | 4355 | } |
| 4356 | 4356 | |
| r1461 | r1462 | |
| 4364 | 4364 | |
| 4365 | 4365 | |
| 4366 | 4366 | |
| 4367 | static const pia6821_interface mo6_sys = | |
| 4367 | static const pia6821_interface mo6_sys = | |
| 4368 | 4368 | { |
| 4369 | 4369 | mo6_sys_porta_in, mo6_sys_portb_in, |
| 4370 | 4370 | NULL, NULL, NULL, NULL, |
| r1461 | r1462 | |
| 4391 | 4391 | init = to7_lightpen ? l.init : v.init; |
| 4392 | 4392 | lt3 = to7_lightpen ? l.lt3 : v.lt3; |
| 4393 | 4393 | |
| 4394 | switch ( offset ) | |
| 4394 | switch ( offset ) | |
| 4395 | 4395 | { |
| 4396 | 4396 | |
| 4397 | 4397 | case 0: /* system 2 / lightpen register 1 */ |
| 4398 | if ( to7_lightpen ) | |
| 4398 | if ( to7_lightpen ) | |
| 4399 | 4399 | res = (count >> 8) & 0xff; |
| 4400 | else | |
| 4400 | else | |
| 4401 | 4401 | res = to8_reg_sys2 & 0xf0; |
| 4402 | 4402 | break; |
| 4403 | 4403 | |
| 4404 | 4404 | case 1: /* ram register / lightpen register 2 */ |
| 4405 | if ( to7_lightpen ) | |
| 4405 | if ( to7_lightpen ) | |
| 4406 | 4406 | { |
| 4407 | 4407 | thom_firq_2( 0 ); |
| 4408 | to8_lightpen_intr = 0; | |
| 4408 | to8_lightpen_intr = 0; | |
| 4409 | 4409 | res = count & 0xff; |
| 4410 | 4410 | } |
| 4411 | else | |
| 4411 | else | |
| 4412 | 4412 | res = to8_reg_ram & 0x1f; |
| 4413 | 4413 | break; |
| 4414 | 4414 | |
| 4415 | 4415 | case 2: /* cartrige register / lightpen register 3 */ |
| 4416 | if ( to7_lightpen ) | |
| 4416 | if ( to7_lightpen ) | |
| 4417 | 4417 | res = (lt3 << 7) | (inil << 6); |
| 4418 | else | |
| 4418 | else | |
| 4419 | 4419 | res = 0; |
| 4420 | 4420 | break; |
| 4421 | 4421 | |
| r1461 | r1462 | |
| 4442 | 4442 | WRITE8_HANDLER ( mo6_gatearray_w ) |
| 4443 | 4443 | { |
| 4444 | 4444 | #if VERBOSE_VIDEO |
| 4445 | logerror( "$%04x %f mo6_gatearray_w: off=%i ($%04X) data=$%02X\n", | |
| 4445 | logerror( "$%04x %f mo6_gatearray_w: off=%i ($%04X) data=$%02X\n", | |
| 4446 | 4446 | activecpu_get_previouspc(), attotime_to_double(timer_get_time()), |
| 4447 | 4447 | offset, 0xa7e4 + offset, data ); |
| 4448 | 4448 | #endif |
| 4449 | 4449 | |
| 4450 | switch ( offset ) | |
| 4450 | switch ( offset ) | |
| 4451 | 4451 | { |
| 4452 | 4452 | |
| 4453 | 4453 | case 0: /* switch */ |
| r1461 | r1462 | |
| 4455 | 4455 | break; |
| 4456 | 4456 | |
| 4457 | 4457 | case 1: /* ram register */ |
| 4458 | if ( to8_reg_sys1 & 0x10 ) | |
| 4458 | if ( to8_reg_sys1 & 0x10 ) | |
| 4459 | 4459 | { |
| 4460 | 4460 | to8_reg_ram = data; |
| 4461 | 4461 | mo6_update_ram_bank(); |
| r1461 | r1462 | |
| 4489 | 4489 | if ( ( offset == 3 ) && ( to8_reg_ram & 0x80 ) ) |
| 4490 | 4490 | return to7_floppy_r( 0xc ); |
| 4491 | 4491 | |
| 4492 | switch ( offset ) | |
| 4492 | switch ( offset ) | |
| 4493 | 4493 | { |
| 4494 | 4494 | |
| 4495 | 4495 | case 0: /* palette data */ |
| r1461 | r1462 | |
| 4511 | 4511 | WRITE8_HANDLER ( mo6_vreg_w ) |
| 4512 | 4512 | { |
| 4513 | 4513 | #if VERBOSE_VIDEO |
| 4514 | logerror( "$%04x %f mo6_vreg_w: off=%i ($%04X) data=$%02X\n", | |
| 4514 | logerror( "$%04x %f mo6_vreg_w: off=%i ($%04X) data=$%02X\n", | |
| 4515 | 4515 | activecpu_get_previouspc(), attotime_to_double(timer_get_time()), |
| 4516 | 4516 | offset, 0xa7da + offset, data ); |
| 4517 | 4517 | #endif |
| 4518 | 4518 | |
| 4519 | switch ( offset ) | |
| 4519 | switch ( offset ) | |
| 4520 | 4520 | { |
| 4521 | 4521 | |
| 4522 | 4522 | case 0: /* palette data */ |
| r1461 | r1462 | |
| 4527 | 4527 | case 2: /* display / external floppy register */ |
| 4528 | 4528 | if ( ( to8_reg_sys1 & 0x80 ) && ( to8_reg_ram & 0x80 ) ) |
| 4529 | 4529 | to7_floppy_w( 0xc, data ); |
| 4530 | else | |
| 4530 | else | |
| 4531 | 4531 | to9_set_video_mode( data, 2 ); |
| 4532 | 4532 | break; |
| 4533 | 4533 | |
| 4534 | 4534 | case 3: /* system register 2 */ |
| 4535 | 4535 | /* 0xa7dc from external floppy drive aliases the video gate-array */ |
| 4536 | if ( ( offset == 3 ) && ( to8_reg_ram & 0x80 ) ) | |
| 4536 | if ( ( offset == 3 ) && ( to8_reg_ram & 0x80 ) ) | |
| 4537 | 4537 | to7_floppy_w( 0xc, data ); |
| 4538 | else | |
| 4538 | else | |
| 4539 | 4539 | { |
| 4540 | 4540 | to8_reg_sys2 = data; |
| 4541 | 4541 | thom_set_video_page( data >> 6 ); |
| r1461 | r1462 | |
| 4616 | 4616 | to7_rf57932_init(); |
| 4617 | 4617 | mo5_periodic_timer = timer_alloc( mo5_periodic_cb , NULL); |
| 4618 | 4618 | mea8000_config( THOM_SOUND_SPEECH, NULL ); |
| 4619 | ||
| 4619 | ||
| 4620 | 4620 | /* memory */ |
| 4621 | 4621 | thom_cart_bank = 0; |
| 4622 | 4622 | mo5_reg_cart = 0; |
| r1461 | r1462 | |
| 4633 | 4633 | memory_configure_bank( TO8_BIOS_BANK, 0, 2, mem + 0x23000, 0x4000 ); |
| 4634 | 4634 | memory_set_bank( TO8_SYS_LO, 0 ); |
| 4635 | 4635 | memory_set_bank( TO8_SYS_HI, 0 ); |
| 4636 | ||
| 4636 | ||
| 4637 | 4637 | /* save-state */ |
| 4638 | 4638 | state_save_register_global( thom_cart_nb_banks ); |
| 4639 | 4639 | state_save_register_global( thom_cart_bank ); |
| r1461 | r1462 | |
| 4664 | 4664 | |
| 4665 | 4665 | READ8_HANDLER ( mo5nr_net_r ) |
| 4666 | 4666 | { |
| 4667 | if ( to7_controller_type ) | |
| 4667 | if ( to7_controller_type ) | |
| 4668 | 4668 | return to7_floppy_r ( offset ); |
| 4669 | 4669 | |
| 4670 | 4670 | logerror( "$%04x %f mo5nr_net_r: read from reg %i\n", activecpu_get_previouspc(), attotime_to_double(timer_get_time()), offset ); |
| 4671 | 4671 | |
| 4672 | if ( to7_controller_type ) | |
| 4672 | if ( to7_controller_type ) | |
| 4673 | 4673 | return to7_floppy_r ( offset ); |
| 4674 | 4674 | |
| 4675 | 4675 | return 0; |
| r1461 | r1462 | |
| 4679 | 4679 | |
| 4680 | 4680 | WRITE8_HANDLER ( mo5nr_net_w ) |
| 4681 | 4681 | { |
| 4682 | if ( to7_controller_type ) | |
| 4682 | if ( to7_controller_type ) | |
| 4683 | 4683 | to7_floppy_w ( offset, data ); |
| 4684 | 4684 | else |
| 4685 | 4685 | logerror( "$%04x %f mo5nr_net_w: write $%02X to reg %i\n", |
| r1461 | r1462 | |
| 4697 | 4697 | |
| 4698 | 4698 | READ8_HANDLER ( mo5nr_prn_r ) |
| 4699 | 4699 | { |
| 4700 | switch ( offset ) | |
| 4700 | switch ( offset ) | |
| 4701 | 4701 | { |
| 4702 | 4702 | |
| 4703 | 4703 | case 1: |
| r1461 | r1462 | |
| 4705 | 4705 | |
| 4706 | 4706 | case 3: |
| 4707 | 4707 | /* TODO: understand other bits */ |
| 4708 | if ( centronics_read_handshake( 0 ) & CENTRONICS_NOT_BUSY ) | |
| 4708 | if ( centronics_read_handshake( 0 ) & CENTRONICS_NOT_BUSY ) | |
| 4709 | 4709 | return 0; |
| 4710 | 4710 | else |
| 4711 | 4711 | return 0x80; |
| 4712 | 4712 | |
| 4713 | 4713 | default: |
| 4714 | logerror( "$%04x %f mo5nr_prn_r: unhandled read from reg %i\n", activecpu_get_previouspc(), attotime_to_double(timer_get_time()), offset ); | |
| 4714 | logerror( "$%04x %f mo5nr_prn_r: unhandled read from reg %i\n", activecpu_get_previouspc(), attotime_to_double(timer_get_time()), offset ); | |
| 4715 | 4715 | return 0; |
| 4716 | 4716 | } |
| 4717 | 4717 | } |
| r1461 | r1462 | |
| 4720 | 4720 | |
| 4721 | 4721 | WRITE8_HANDLER ( mo5nr_prn_w ) |
| 4722 | 4722 | { |
| 4723 | switch ( offset ) | |
| 4723 | switch ( offset ) | |
| 4724 | 4724 | { |
| 4725 | 4725 | |
| 4726 | 4726 | case 1: |
| r1461 | r1462 | |
| 4749 | 4749 | UINT8 portb = pia_get_output_b( THOM_PIA_SYS ); |
| 4750 | 4750 | int col = (portb >> 4) & 7; /* B bits 4-6: kbd column */ |
| 4751 | 4751 | int lin = (portb >> 1) & 7; /* B bits 1-3: kbd line */ |
| 4752 | return | |
| 4753 | ( readinputport( THOM_INPUT_KEYBOARD + lin ) & (1 << col) ) | |
| 4752 | return | |
| 4753 | ( readinputport( THOM_INPUT_KEYBOARD + lin ) & (1 << col) ) | |
| 4754 | 4754 | ? 0x80 : 0; /* bit 7: key up */ |
| 4755 | 4755 | } |
| 4756 | 4756 | |
| 4757 | 4757 | |
| 4758 | 4758 | |
| 4759 | 4759 | static WRITE8_HANDLER ( mo5nr_sys_porta_out ) |
| 4760 | { | |
| 4760 | { | |
| 4761 | 4761 | /* no keyboard LED */ |
| 4762 | 4762 | thom_set_mode_point( data & 1 ); /* bit 0: video bank switch */ |
| 4763 | 4763 | to7_game_mute = data & 4; /* bit 2: sound mute */ |
| r1461 | r1462 | |
| 4768 | 4768 | |
| 4769 | 4769 | |
| 4770 | 4770 | |
| 4771 | static const pia6821_interface mo5nr_sys = | |
| 4771 | static const pia6821_interface mo5nr_sys = | |
| 4772 | 4772 | { |
| 4773 | 4773 | mo6_sys_porta_in, mo5nr_sys_portb_in, |
| 4774 | 4774 | NULL, NULL, NULL, NULL, |
| r1461 | r1462 | |
| 4785 | 4785 | |
| 4786 | 4786 | |
| 4787 | 4787 | |
| 4788 | static const pia6821_interface mo5nr_game = | |
| 4788 | static const pia6821_interface mo5nr_game = | |
| 4789 | 4789 | { |
| 4790 | 4790 | to7_game_porta_in, to7_game_portb_in, |
| 4791 | 4791 | NULL, NULL, NULL, NULL, |
| r1461 | r1462 | |
| 4883 | 4883 | to7_rf57932_init(); |
| 4884 | 4884 | mo5_periodic_timer = timer_alloc( mo5_periodic_cb , NULL); |
| 4885 | 4885 | mea8000_config( THOM_SOUND_SPEECH, NULL ); |
| 4886 | ||
| 4886 | ||
| 4887 | 4887 | /* memory */ |
| 4888 | 4888 | thom_cart_bank = 0; |
| 4889 | 4889 | mo5_reg_cart = 0; |
| r1461 | r1462 | |
| 4900 | 4900 | memory_configure_bank( TO8_BIOS_BANK, 0, 2, mem + 0x23000, 0x4000 ); |
| 4901 | 4901 | memory_set_bank( TO8_SYS_LO, 0 ); |
| 4902 | 4902 | memory_set_bank( TO8_SYS_HI, 0 ); |
| 4903 | ||
| 4903 | ||
| 4904 | 4904 | /* save-state */ |
| 4905 | 4905 | state_save_register_global( thom_cart_nb_banks ); |
| 4906 | 4906 | state_save_register_global( thom_cart_bank ); |
| r1461 | r1462 | |
|---|---|---|
| 78 | 78 | /* The speaker is connected to output 6 of the 74145 */ |
| 79 | 79 | static void sym1_74145_output_6_w(int state) |
| 80 | 80 | { |
| 81 | speaker_level_w(0, state); | |
| 81 | speaker_level_w(0, state); | |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | |
| r1461 | r1462 | |
| 197 | 197 | { |
| 198 | 198 | logerror("SYM1 VIA2 W 0x%02x\n", data); |
| 199 | 199 | |
| 200 | memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0xa600, 0xa67f, 0, 0, | |
| 200 | memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0xa600, 0xa67f, 0, 0, | |
| 201 | 201 | ((readinputportbytag("WP") & 0x01) && !(data & 0x01)) ? MWA8_NOP : MWA8_BANK5); |
| 202 | 202 | |
| 203 | memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0x0400, 0x07ff, 0, 0, | |
| 203 | memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0x0400, 0x07ff, 0, 0, | |
| 204 | 204 | ((readinputportbytag("WP") & 0x02) && !(data & 0x02)) ? MWA8_NOP : MWA8_BANK2); |
| 205 | 205 | |
| 206 | memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0x0800, 0x0bff, 0, 0, | |
| 206 | memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0x0800, 0x0bff, 0, 0, | |
| 207 | 207 | ((readinputportbytag("WP") & 0x04) && !(data & 0x04)) ? MWA8_NOP : MWA8_BANK3); |
| 208 | 208 | |
| 209 | memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0x0c00, 0x0fff, 0, 0, | |
| 209 | memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0x0c00, 0x0fff, 0, 0, | |
| 210 | 210 | ((readinputportbytag("WP") & 0x08) && !(data & 0x08)) ? MWA8_NOP : MWA8_BANK4); |
| 211 | 211 | } |
| 212 | 212 | |
| r1461 | r1462 | |
| 287 | 287 | r6532_config(0, &r6532_interface); |
| 288 | 288 | r6532_set_clock(0, OSC_Y1); |
| 289 | 289 | r6532_reset(0); |
| 290 | ||
| 290 | ||
| 291 | 291 | /* configure 74145 */ |
| 292 | 292 | ttl74145_config(0, &ttl74145_intf); |
| 293 | ||
| 293 | ||
| 294 | 294 | /* allocate a timer to refresh the led display */ |
| 295 | 295 | led_update = timer_alloc(led_refresh, NULL); |
| 296 | 296 | } |
| r1461 | r1462 | |
|---|---|---|
| 18 | 18 | UINT8 data[0x100]; |
| 19 | 19 | struct |
| 20 | 20 | { |
| 21 | struct { UINT8 l, h; } | |
| 21 | struct { UINT8 l, h; } | |
| 22 | 22 | // eng used by the blitter engine |
| 23 | 23 | // scb written by the blitter scb blocks to engine expander |
| 24 | 24 | // used by the engine |
| 25 | 25 | // might be used directly by software! |
| 26 | eng1, eng2, | |
| 26 | eng1, eng2, | |
| 27 | 27 | h_offset, v_offset, vidbas, colbas, |
| 28 | eng3, eng4, | |
| 28 | eng3, eng4, | |
| 29 | 29 | scb1, scb2, scb3, scb4, scb5, scb6, |
| 30 | 30 | eng5, eng6, eng7, eng8, |
| 31 | 31 | colloff, |
| r1461 | r1462 | |
| 44 | 44 | UINT8 SPRSYS; |
| 45 | 45 | } s; |
| 46 | 46 | } u; |
| 47 | int accumulate_overflow; | |
| 47 | int accumulate_overflow; | |
| 48 | 48 | UINT8 high; |
| 49 | 49 | int low; |
| 50 | 50 | } SUZY; |
| r1461 | r1462 | |
| 87 | 87 | #define GET_WORD(mem, index) ((mem)[(index)]|((mem)[(index)+1]<<8)) |
| 88 | 88 | |
| 89 | 89 | /* |
| 90 | mode from blitter command | |
| 90 | mode from blitter command | |
| 91 | 91 | #define SHADOW (0x07) |
| 92 | 92 | #define XORSHADOW (0x06) |
| 93 | 93 | #define NONCOLLIDABLE (0x05) |
| r1461 | r1462 | |
| 103 | 103 | int back; |
| 104 | 104 | UINT8 *screen; |
| 105 | 105 | UINT8 *colbuf; |
| 106 | ||
| 106 | ||
| 107 | 107 | blitter.everon=TRUE; |
| 108 | 108 | screen=blitter.mem+blitter.screen+y*80+x/2; |
| 109 | 109 | colbuf=blitter.mem+blitter.colbuf+y*80+x/2; |
| r1461 | r1462 | |
| 201 | 201 | } |
| 202 | 202 | blitter.memory_accesses+=2; |
| 203 | 203 | break; |
| 204 | case 0x04: // pen 0 transparent, | |
| 204 | case 0x04: // pen 0 transparent, | |
| 205 | 205 | case 0x07: // shadow: pen e doesn't collide |
| 206 | 206 | case 0x05: // non collidable sprite |
| 207 | 207 | case 0x15: |
| r1461 | r1462 | |
| 289 | 289 | #define INCLUDE_LYNX_LINE_FUNCTION |
| 290 | 290 | static void lynx_blit_2color_line(const int y, const int xdir) |
| 291 | 291 | { |
| 292 | const int bits=1; | |
| 292 | const int bits=1; | |
| 293 | 293 | const int mask=0x1; |
| 294 | 294 | #include "includes/lynx.h" |
| 295 | 295 | } |
| 296 | 296 | static void lynx_blit_4color_line(const int y, const int xdir) |
| 297 | 297 | { |
| 298 | const int bits=2; | |
| 298 | const int bits=2; | |
| 299 | 299 | const int mask=0x3; |
| 300 | 300 | #include "includes/lynx.h" |
| 301 | 301 | } |
| 302 | 302 | static void lynx_blit_8color_line(const int y, const int xdir) |
| 303 | 303 | { |
| 304 | const int bits=3; | |
| 304 | const int bits=3; | |
| 305 | 305 | const int mask=0x7; |
| 306 | 306 | #include "includes/lynx.h" |
| 307 | 307 | } |
| 308 | 308 | static void lynx_blit_16color_line(const int y, const int xdir) |
| 309 | 309 | { |
| 310 | const int bits=4; | |
| 310 | const int bits=4; | |
| 311 | 311 | const int mask=0xf; |
| 312 | 312 | #include "includes/lynx.h" |
| 313 | 313 | } |
| r1461 | r1462 | |
| 330 | 330 | 0, 4 bit repeat count-1, 3 bit color |
| 331 | 331 | 1, 4 bit count of values-1, 3 bit color, .... |
| 332 | 332 | */ |
| 333 | ||
| 333 | ||
| 334 | 334 | /* |
| 335 | 335 | 16 color rle: |
| 336 | 336 | 0, 4 bit repeat count-1, 4 bit color |
| r1461 | r1462 | |
| 339 | 339 | #define INCLUDE_LYNX_LINE_RLE_FUNCTION |
| 340 | 340 | static void lynx_blit_2color_rle_line(const int y, const int xdir) |
| 341 | 341 | { |
| 342 | const int bits=1; | |
| 342 | const int bits=1; | |
| 343 | 343 | const int mask=0x1; |
| 344 | 344 | #include "includes/lynx.h" |
| 345 | 345 | } |
| 346 | 346 | static void lynx_blit_4color_rle_line(const int y, const int xdir) |
| 347 | 347 | { |
| 348 | const int bits=2; | |
| 348 | const int bits=2; | |
| 349 | 349 | const int mask=0x3; |
| 350 | 350 | #include "includes/lynx.h" |
| 351 | 351 | } |
| 352 | 352 | static void lynx_blit_8color_rle_line(const int y, const int xdir) |
| 353 | 353 | { |
| 354 | const int bits=3; | |
| 354 | const int bits=3; | |
| 355 | 355 | const int mask=0x7; |
| 356 | 356 | #include "includes/lynx.h" |
| 357 | 357 | } |
| 358 | 358 | static void lynx_blit_16color_rle_line(const int y, const int xdir) |
| 359 | 359 | { |
| 360 | const int bits=4; | |
| 360 | const int bits=4; | |
| 361 | 361 | const int mask=0xf; |
| 362 | 362 | #include "includes/lynx.h" |
| 363 | 363 | } |
| r1461 | r1462 | |
| 380 | 380 | ydir=1; |
| 381 | 381 | if (blitter.mem[blitter.cmd]&0x10) { ydir=-1;blitter.y--;/*?*/ } |
| 382 | 382 | switch (blitter.mem[blitter.cmd+1]&3) { |
| 383 | case 0: | |
| 383 | case 0: | |
| 384 | 384 | flip =0; |
| 385 | 385 | break; |
| 386 | 386 | case 1: // blockout |
| r1461 | r1462 | |
| 515 | 515 | static void lynx_blitter(void) |
| 516 | 516 | { |
| 517 | 517 | static const int lynx_colors[4]={2,4,8,16}; |
| 518 | ||
| 518 | ||
| 519 | 519 | static void (* const blit_line[4])(const int y, const int xdir)= { |
| 520 | 520 | lynx_blit_2color_line, |
| 521 | 521 | lynx_blit_4color_line, |
| 522 | 522 | lynx_blit_8color_line, |
| 523 | 523 | lynx_blit_16color_line |
| 524 | 524 | }; |
| 525 | ||
| 525 | ||
| 526 | 526 | static void (* const blit_rle_line[4])(const int y, const int xdir)= { |
| 527 | 527 | lynx_blit_2color_rle_line, |
| 528 | 528 | lynx_blit_4color_rle_line, |
| r1461 | r1462 | |
| 530 | 530 | lynx_blit_16color_rle_line |
| 531 | 531 | }; |
| 532 | 532 | int i; int o;int colors; |
| 533 | ||
| 533 | ||
| 534 | 534 | blitter.memory_accesses=0; |
| 535 | 535 | blitter.mem = memory_get_read_ptr(0, ADDRESS_SPACE_PROGRAM, 0x0000); |
| 536 | 536 | blitter.colbuf=GET_WORD(suzy.u.data, 0xa); |
| r1461 | r1462 | |
| 545 | 545 | blitter.height=0x100; |
| 546 | 546 | blitter.stretch=0; |
| 547 | 547 | blitter.tilt=0; |
| 548 | ||
| 548 | ||
| 549 | 549 | blitter.memory_accesses+=2; |
| 550 | 550 | for (blitter.cmd=GET_WORD(suzy.u.data, 0x10); blitter.cmd; ) { |
| 551 | ||
| 551 | ||
| 552 | 552 | blitter.memory_accesses+=1; |
| 553 | 553 | if (!(blitter.mem[blitter.cmd+1]&4)) { |
| 554 | ||
| 554 | ||
| 555 | 555 | blitter.colpos=GET_WORD(suzy.u.data, 0x24)+blitter.cmd; |
| 556 | ||
| 556 | ||
| 557 | 557 | blitter.bitmap=GET_WORD(blitter.mem,blitter.cmd+5); |
| 558 | 558 | blitter.x=(INT16)GET_WORD(blitter.mem, blitter.cmd+7)-blitter.xoff; |
| 559 | 559 | blitter.y=(INT16)GET_WORD(blitter.mem, blitter.cmd+9)-blitter.yoff; |
| 560 | 560 | blitter.memory_accesses+=6; |
| 561 | ||
| 561 | ||
| 562 | 562 | blitter.mode=blitter.mem[blitter.cmd]&07; |
| 563 | 563 | if (blitter.mem[blitter.cmd+1]&0x80) { |
| 564 | 564 | blitter.line_function=blit_line[blitter.mem[blitter.cmd]>>6]; |
| 565 | 565 | } else { |
| 566 | 566 | blitter.line_function=blit_rle_line[blitter.mem[blitter.cmd]>>6]; |
| 567 | 567 | } |
| 568 | ||
| 568 | ||
| 569 | 569 | if (!(blitter.mem[blitter.cmd+2]&0x20) && !( suzy.u.s.SPRSYS&0x20) ) { |
| 570 | 570 | switch (blitter.mode) { |
| 571 | 571 | case 0: case 2: case 3: case 4: case 6: case 7: |
| r1461 | r1462 | |
| 574 | 574 | blitter.spritenr=blitter.mem[blitter.cmd+2]&0xf; |
| 575 | 575 | } |
| 576 | 576 | } |
| 577 | ||
| 577 | ||
| 578 | 578 | o=0xb; |
| 579 | 579 | if (blitter.mem[blitter.cmd+1]&0x30) { |
| 580 | 580 | blitter.width=GET_WORD(blitter.mem, blitter.cmd+11); |
| r1461 | r1462 | |
| 582 | 582 | blitter.memory_accesses+=4; |
| 583 | 583 | o+=4; |
| 584 | 584 | } |
| 585 | ||
| 585 | ||
| 586 | 586 | if (blitter.mem[blitter.cmd+1]&0x20) { |
| 587 | 587 | blitter.stretch=GET_WORD(blitter.mem, blitter.cmd+o); |
| 588 | 588 | blitter.memory_accesses+=2; |
| r1461 | r1462 | |
| 594 | 594 | } |
| 595 | 595 | } |
| 596 | 596 | colors=lynx_colors[blitter.mem[blitter.cmd]>>6]; |
| 597 | ||
| 597 | ||
| 598 | 598 | if (!(blitter.mem[blitter.cmd+1]&8)) { |
| 599 | 599 | for (i=0; i<colors/2; i++) { |
| 600 | 600 | blitter.color[i*2]=blitter.mem[blitter.cmd+o+i]>>4; |
| r1461 | r1462 | |
| 713 | 713 | if (input&PAD_RIGHT) data|=PAD_LEFT; |
| 714 | 714 | } else { |
| 715 | 715 | data=input; |
| 716 | } | |
| 716 | } | |
| 717 | 717 | break; |
| 718 | 718 | case 0xb1: data=readinputport(1);break; |
| 719 | 719 | case 0xb2: |
| r1461 | r1462 | |
| 784 | 784 | TIM_MAGMODE EQU %00100000 ; nonsense in Lynx !! |
| 785 | 785 | TIM_RELOAD EQU %00010000 ; enable reload |
| 786 | 786 | TIM_COUNT EQU %00001000 ; enable counter |
| 787 | TIM_LINK EQU %00000111 | |
| 787 | TIM_LINK EQU %00000111 | |
| 788 | 788 | ; link timers (0->2->4 / 1->3->5->7->Aud0->Aud1->Aud2->Aud3->1 |
| 789 | 789 | TIM_64us EQU %00000110 |
| 790 | 790 | TIM_32us EQU %00000101 |
| r1461 | r1462 | |
| 835 | 835 | lynx_timer_count_down( 2 ); |
| 836 | 836 | lynx_line++; |
| 837 | 837 | break; |
| 838 | case 2: | |
| 839 | lynx_timer_count_down( 4 ); | |
| 838 | case 2: | |
| 839 | lynx_timer_count_down( 4 ); | |
| 840 | 840 | lynx_draw_lines( -1 ); |
| 841 | 841 | lynx_line=0; |
| 842 | 842 | break; |
| r1461 | r1462 | |
| 983 | 983 | if (uart.buffer_loaded) { |
| 984 | 984 | uart.data_to_send=uart.buffer; |
| 985 | 985 | uart.buffer_loaded=FALSE; |
| 986 | timer_set(ATTOTIME_IN_USEC(11), NULL, 0, lynx_uart_timer); | |
| 986 | timer_set(ATTOTIME_IN_USEC(11), NULL, 0, lynx_uart_timer); | |
| 987 | 987 | } else { |
| 988 | 988 | uart.sending=FALSE; |
| 989 | 989 | } |
| r1461 | r1462 | |
| 1096 | 1096 | mikey.data[0x81]&=~data; // clear interrupt source |
| 1097 | 1097 | logerror("mikey write %.2x %.2x\n",offset,data); |
| 1098 | 1098 | if (!mikey.data[0x81]) |
| 1099 | cpunum_set_input_line(0, M65SC02_IRQ_LINE, CLEAR_LINE); | |
| 1099 | cpunum_set_input_line(0, M65SC02_IRQ_LINE, CLEAR_LINE); | |
| 1100 | 1100 | break; |
| 1101 | 1101 | |
| 1102 | 1102 | case 0x87: |
| r1461 | r1462 | |
| 1180 | 1180 | int i; |
| 1181 | 1181 | lynx_memory_config_w(0, 0); |
| 1182 | 1182 | |
| 1183 | cpunum_set_input_line(0, M65SC02_IRQ_LINE, CLEAR_LINE); | |
| 1183 | cpunum_set_input_line(0, M65SC02_IRQ_LINE, CLEAR_LINE); | |
| 1184 | 1184 | |
| 1185 | 1185 | memset(&suzy, 0, sizeof(suzy)); |
| 1186 | 1186 | memset(&mikey, 0, sizeof(mikey)); |
| r1461 | r1462 | |
|---|---|---|
| 19 | 19 | write8_handler out_port_func; /* 8-bit output */ |
| 20 | 20 | write8_handler out_cp1_func; /* 1-bit output */ |
| 21 | 21 | write8_handler out_cp2_func; /* 1-bit output */ |
| 22 | ||
| 22 | ||
| 23 | 23 | /* CPU read from the outside through chip */ |
| 24 | 24 | read8_handler in_port_func; /* 8-bit input */ |
| 25 | ||
| 25 | ||
| 26 | 26 | /* asynchronous timer output to outside world */ |
| 27 | 27 | write8_handler out_cto_func; /* 1-bit output */ |
| 28 | ||
| 28 | ||
| 29 | 29 | /* timer interrupt */ |
| 30 | 30 | void ( * irq_func ) ( int state ); |
| 31 | 31 |
| r1461 | r1462 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | 3 | lisa.h |
| 4 | ||
| 4 | ||
| 5 | 5 | MESS Lisa driver declarations |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| r1461 | r1462 | |
|---|---|---|
| 441 | 441 | |
| 442 | 442 | I/O board |
| 443 | 443 | 1xxx11aa external interfaces connector (K2) |
| 444 | ||
| 444 | ||
| 445 | 445 | 0xxx11aa I/O board interfaces |
| 446 | 446 | 000111aa 8251 (casette recorder, V24) |
| 447 | 447 | 010011aa 8255 (GPIO/0, GPIO/1) |
| r1461 | r1462 | |
| 714 | 714 | else |
| 715 | 715 | { |
| 716 | 716 | current_level = (cassette_input(image_from_devtype_and_index(IO_CASSETTE, 0)) > 0.038) ? 1 : 0; |
| 717 | ||
| 717 | ||
| 718 | 718 | if (previous_level!=current_level) |
| 719 | { | |
| 719 | { | |
| 720 | 720 | data = (!previous_level && current_level) ? 1 : 0; |
| 721 | ||
| 721 | ||
| 722 | 722 | set_out_data_bit(pmd85_cassette_serial_connection.State, data); |
| 723 | 723 | serial_connection_out(&pmd85_cassette_serial_connection); |
| 724 | 724 | msm8251_receive_clock(); |
| r1461 | r1462 | |
| 733 | 733 | case ALFA: |
| 734 | 734 | /* not hardware data decoding */ |
| 735 | 735 | return; |
| 736 | } | |
| 736 | } | |
| 737 | 737 | } |
| 738 | 738 | |
| 739 | 739 | /* tape writing */ |
| r1461 | r1462 | |
|---|---|---|
| 92 | 92 | rriot[nr].port_b.ddr=0; |
| 93 | 93 | if (rriot[nr].config->port_b.output) |
| 94 | 94 | rriot[nr].config->port_b.output(nr,0xff); |
| 95 | ||
| 95 | ||
| 96 | 96 | rriot[nr].irq=0;rriot[nr].irqen=0; |
| 97 | if (rriot[nr].config->irq_callback) | |
| 98 | rriot[nr].config->irq_callback(nr, 0); | |
| 97 | if (rriot[nr].config->irq_callback) | |
| 98 | rriot[nr].config->irq_callback(nr, 0); | |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | int rriot_r(int chip, int offset) |
| r1461 | r1462 | |
| 217 | 217 | } |
| 218 | 218 | rriot[chip].irqen = (offset & 8) ? 1 : 0; |
| 219 | 219 | rriot[chip].irq =0; |
| 220 | ||
| 220 | ||
| 221 | 221 | switch (offset&3) { |
| 222 | 222 | case 0: /* Timer 1 start */ |
| 223 | 223 | LOG(("rriot(%d) TMR1 write: $%02x%s\n", chip, data, (char*)((offset & 8) ? " (IRQ)":" "))); |
| r1461 | r1462 | |
| 247 | 247 | static int rriot_a_r(int chip) |
| 248 | 248 | { |
| 249 | 249 | int data; |
| 250 | if (rriot[chip].config->port_a.input) | |
| 250 | if (rriot[chip].config->port_a.input) | |
| 251 | 251 | data = rriot[chip].config->port_a.input(chip); |
| 252 | 252 | else |
| 253 | 253 | data = 0xff; |
| r1461 | r1462 | |
| 259 | 259 | static int rriot_b_r(int chip) |
| 260 | 260 | { |
| 261 | 261 | int data; |
| 262 | if (rriot[chip].config->port_b.input) | |
| 262 | if (rriot[chip].config->port_b.input) | |
| 263 | 263 | data = rriot[chip].config->port_b.input(chip); |
| 264 | 264 | else |
| 265 | 265 | data = 0xff; |
| r1461 | r1462 | |
| 277 | 277 | |
| 278 | 278 | static void rriot_b_w(int chip, int data) |
| 279 | 279 | { |
| 280 | ||
| 280 | ||
| 281 | 281 | } |
| 282 | 282 | |
| 283 | 283 | READ8_HANDLER ( rriot_0_r ) { return rriot_r(0,offset); } |
| r1461 | r1462 | |
|---|---|---|
| 5 | 5 | |
| 6 | 6 | /* ram and rom areas are not handled in this rriot compoment */ |
| 7 | 7 | |
| 8 | /* | |
| 8 | /* | |
| 9 | 9 | internal 64 byte ram |
| 10 | 10 | internal 1024 byte rom |
| 11 | 11 | inputs and output |
| r1461 | r1462 | |
| 13 | 13 | interrupt logic |
| 14 | 14 | logic to connect up to 7 6530 without additional address decoding logic |
| 15 | 15 | |
| 16 | 1kb rom selection | |
| 17 | a0..a9, | |
| 16 | 1kb rom selection | |
| 17 | a0..a9, | |
| 18 | 18 | rs0, cs1, cs2 mask programmed! |
| 19 | 19 | |
| 20 | 20 | 64byte ram selection |
| r1461 | r1462 | |
| 78 | 78 | */ |
| 79 | 79 | |
| 80 | 80 | |
| 81 | /* | |
| 81 | /* | |
| 82 | 82 | mos 6532 |
| 83 | 83 | chip also contains 128 bytes ram (own chip select line) |
| 84 | 84 | no rom |
| 85 | 85 | separate irq output |
| 86 | 86 | some significant differences, so unique component |
| 87 | 87 | */ |
| 88 | ||
| 88 | ||
| 89 | 89 | #ifdef __cplusplus |
| 90 | 90 | extern "C" { |
| 91 | 91 | #endif |
| r1461 | r1462 | |
| 103 | 103 | |
| 104 | 104 | /* This has to be called from a driver at startup */ |
| 105 | 105 | void rriot_init(int nr, const RRIOT_CONFIG *riot); |
| 106 | ||
| 106 | ||
| 107 | 107 | int rriot_r(int chip, int offs); |
| 108 | 108 | void rriot_w(int chip, int offs, int data); |
| 109 | 109 |
| r1461 | r1462 | |
|---|---|---|
| 205 | 205 | tms9901_init(0, & tms9901reset_param_ti99); |
| 206 | 206 | |
| 207 | 207 | /* Initialize all. Actually, at this point, we don't know |
| 208 | how the switches are set. Later we use the configuration switches to | |
| 208 | how the switches are set. Later we use the configuration switches to | |
| 209 | 209 | determine which one to use. */ |
| 210 | 210 | ti99_peb_init(); |
| 211 | 211 | ti99_fdc_init(); |
| r1461 | r1462 | |
| 851 | 851 | else |
| 852 | 852 | { |
| 853 | 853 | GPL_port.addr = ((int) data << 8) | (GPL_port.addr & 0xFF); |
| 854 | ||
| 854 | ||
| 855 | 855 | GPL_port.waddr_LSB = TRUE; |
| 856 | 856 | } |
| 857 | 857 | } |
| r1461 | r1462 | |
|---|---|---|
| 509 | 509 | |
| 510 | 510 | 7-track tape, 6-bit data, 1-bit parity |
| 511 | 511 | |
| 512 | ||
| 512 | ||
| 513 | 513 | */ |
| 514 | 514 | |
| 515 | 515 | static void schedule_select(void) |
| r1461 | r1462 | |
|---|---|---|
| 529 | 529 | * (presumably set up by CPU #1.) This always worked, but when I |
| 530 | 530 | * changed the m8502 CPU core to use an internal memory map, it |
| 531 | 531 | * started BRK-ing forever when trying to execute 0x0000. |
| 532 | * | |
| 532 | * | |
| 533 | 533 | * I am not sure whether the C128 actually executes this invalid |
| 534 | 534 | * memory or if this is a bug in the C128 driver. In any case, the |
| 535 | 535 | * driver used to work with this behavior, so I am doing this hack |
| r1461 | r1462 | |
|---|---|---|
| 26 | 26 | { |
| 27 | 27 | struct pc_turbo_info *ti = (struct pc_turbo_info *) ptr; |
| 28 | 28 | int val; |
| 29 | ||
| 29 | ||
| 30 | 30 | val = readinputport(ti->port) & ti->mask; |
| 31 | 31 | |
| 32 | 32 | if (val != ti->cur_val) |
| r1461 | r1462 | |
|---|---|---|
| 334 | 334 | |
| 335 | 335 | lviv_setup_snapshot (lviv_snapshot_data); |
| 336 | 336 | |
| 337 | dump_registers(); | |
| 337 | dump_registers(); | |
| 338 | 338 | |
| 339 | 339 | free(lviv_snapshot_data); |
| 340 | 340 |
| r1461 | r1462 | |
|---|---|---|
| 4 | 4 | |
| 5 | 5 | /* This is an emulation of Dallas Semiconductor's Phantom Time Chip. |
| 6 | 6 | DS1315. |
| 7 | ||
| 7 | ||
| 8 | 8 | by tim lindner, November 2001. |
| 9 | 9 | */ |
| 10 | 10 | |
| r1461 | r1462 | |
| 18 | 18 | static void ds1315_input_raw_data( void ); |
| 19 | 19 | |
| 20 | 20 | static int ds1315_count; |
| 21 | static int ds1315_mode; | |
| 21 | static int ds1315_mode; | |
| 22 | 22 | static int ds1315_raw_data[8*8]; |
| 23 | 23 | static int ds1315_pattern[] = { 1, 0, 1, 0, 0, 0, 1, 1, |
| 24 | 24 | 0, 1, 0, 1, 1, 1, 0, 0, |
| r1461 | r1462 | |
| 55 | 55 | |
| 56 | 56 | return 0; |
| 57 | 57 | } |
| 58 | ||
| 58 | ||
| 59 | 59 | READ8_HANDLER ( ds1315_r_1 ) |
| 60 | 60 | { |
| 61 | 61 | if( ds1315_pattern[ ds1315_count++ ] == 1 ) |
| 62 | 62 | return 0; |
| 63 | ||
| 63 | ||
| 64 | 64 | ds1315_count = 0; |
| 65 | 65 | ds1315_mode = ds_seek_matching; |
| 66 | 66 | return 0; |
| 67 | 67 | } |
| 68 | ||
| 68 | ||
| 69 | 69 | READ8_HANDLER ( ds1315_r_data ) |
| 70 | 70 | { |
| 71 | 71 | UINT8 result; |
| 72 | ||
| 72 | ||
| 73 | 73 | if( ds1315_mode == ds_calendar_io ) |
| 74 | 74 | { |
| 75 | 75 | result = ds1315_raw_data[ ds1315_count++ ]; |
| 76 | ||
| 76 | ||
| 77 | 77 | if( ds1315_count == 64 ) |
| 78 | 78 | { |
| 79 | 79 | ds1315_mode = ds_seek_matching; |
| 80 | 80 | ds1315_count = 0; |
| 81 | 81 | } |
| 82 | ||
| 82 | ||
| 83 | 83 | return result; |
| 84 | 84 | } |
| 85 | ||
| 85 | ||
| 86 | 86 | ds1315_count = 0; |
| 87 | 87 | return 0; |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | WRITE8_HANDLER ( ds1315_w_data ) |
| 91 | 91 | { |
| 92 | ||
| 92 | ||
| 93 | 93 | if( ds1315_mode == ds_calendar_io ) |
| 94 | 94 | { |
| 95 | 95 | ds1315_raw_data[ ds1315_count++ ] = data & 0x01; |
| 96 | ||
| 96 | ||
| 97 | 97 | if( ds1315_count == 64 ) |
| 98 | 98 | { |
| 99 | 99 | ds1315_mode = ds_seek_matching; |
| 100 | 100 | ds1315_count = 0; |
| 101 | 101 | ds1315_input_raw_data(); |
| 102 | 102 | } |
| 103 | ||
| 103 | ||
| 104 | 104 | return; |
| 105 | 105 | } |
| 106 | ||
| 106 | ||
| 107 | 107 | ds1315_count = 0; |
| 108 | 108 | return; |
| 109 | 109 | } |
| r1461 | r1462 | |
| 116 | 116 | |
| 117 | 117 | mame_system_time systime; |
| 118 | 118 | int raw[8], i, j; |
| 119 | ||
| 119 | ||
| 120 | 120 | /* get the current date/time from the core */ |
| 121 | 121 | mame_get_current_datetime(Machine, &systime); |
| 122 | ||
| 122 | ||
| 123 | 123 | raw[0] = 0; /* tenths and hundreths of seconds are always zero */ |
| 124 | 124 | raw[1] = dec_2_bcd(systime.local_time.second); |
| 125 | 125 | raw[2] = dec_2_bcd(systime.local_time.minute); |
| r1461 | r1462 | |
| 131 | 131 | raw[7] = dec_2_bcd(systime.local_time.year - 1900); /* Epoch is 1900 */ |
| 132 | 132 | |
| 133 | 133 | /* Ok now we have the raw bcd bytes. Now we need to push them into our bit array */ |
| 134 | ||
| 134 | ||
| 135 | 135 | for( i=0; i<64; i++ ) |
| 136 | 136 | { |
| 137 | 137 | j = i / 8; |
| r1461 | r1462 | |
| 149 | 149 | /* This routine is called when new date and time has been written to the |
| 150 | 150 | clock chip. Currently we ignore setting the date and time in the clock |
| 151 | 151 | chip. |
| 152 | ||
| 152 | ||
| 153 | 153 | We always return the host's time when asked. |
| 154 | 154 | */ |
| 155 | 155 | } |
| r1461 | r1462 | |
|---|---|---|
| 361 | 361 | /* only repeat keys on a 2/2+ if special REPT key is pressed */ |
| 362 | 362 | if (a2_has_repeat()) |
| 363 | 363 | time_until_repeat = readinputportbytag("keyb_repeat") & 0x01 ? 0 : ~0; |
| 364 | ||
| 364 | ||
| 365 | 365 | /* check caps lock and set LED here */ |
| 366 | 366 | if (pressed_specialkey(SPECIALKEY_CAPSLOCK)) |
| 367 | 367 | { |
| r1461 | r1462 | |
|---|---|---|
| 1 | 1 | /* This is an emulation of Dallas Semiconductor's Phantom Time Chip. |
| 2 | 2 | DS1315. |
| 3 | ||
| 3 | ||
| 4 | 4 | by tim lindner, November 2001. |
| 5 | 5 | */ |
| 6 | 6 |
| r1461 | r1462 | |
|---|---|---|
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | |
| 228 | static const struct via6522_interface pet_via = | |
| 228 | static const struct via6522_interface pet_via = | |
| 229 | 229 | { |
| 230 | 230 | NULL, /* in_a_func */ |
| 231 | 231 | pet_via_port_b_r, /* in_b_func */ |
| r1461 | r1462 | |
|---|---|---|
| 501 | 501 | |
| 502 | 502 | memory_install_write8_handler (0, ADDRESS_SPACE_PROGRAM, 0xff20, 0xff3d, 0, 0, MWA8_BANK10); |
| 503 | 503 | memory_install_write8_handler (0, ADDRESS_SPACE_PROGRAM, 0xff40, 0xffff, 0, 0, MWA8_BANK11); |
| 504 | memory_set_bankptr(10, mess_ram + (0xff20 % mess_ram_size)); | |
| 505 | memory_set_bankptr(11, mess_ram + (0xff40 % mess_ram_size)); | |
| 504 | memory_set_bankptr(10, mess_ram + (0xff20 % mess_ram_size)); | |
| 505 | memory_set_bankptr(11, mess_ram + (0xff40 % mess_ram_size)); | |
| 506 | 506 | |
| 507 | 507 | if (SIDCARD_HACK) |
| 508 | 508 | memory_install_write8_handler (0, ADDRESS_SPACE_PROGRAM, 0xd400, 0xd41f, 0, 0, c16_sidcart_16k); |
| r1461 | r1462 | |
| 613 | 613 | |
| 614 | 614 | size = image_length (image); |
| 615 | 615 | |
| 616 | filetype = image_filetype(image); | |
| 616 | filetype = image_filetype(image); | |
| 617 | 617 | if (filetype && !mame_stricmp (filetype, "prg")) |
| 618 | 618 | { |
| 619 | 619 | unsigned short in; |
| r1461 | r1462 | |
|---|---|---|
| 21 | 21 | { |
| 22 | 22 | if (sb2m600_tape_image && (sb2m600_tape_index < sb2m600_tape_size)) |
| 23 | 23 | return ACIA_6850_RDRF; |
| 24 | ||
| 24 | ||
| 25 | 25 | return 0; |
| 26 | 26 | } |
| 27 | 27 |
| r1461 | r1462 | |
|---|---|---|
| 253 | 253 | PB6 |
| 254 | 254 | tape connector motor control 0 |
| 255 | 255 | |
| 256 | PB7 | |
| 256 | PB7 | |
| 257 | 257 | tape connector output high 1 |
| 258 | 258 | |
| 259 | 259 | */ |
| r1461 | r1462 | |
| 1116 | 1116 | MACHINE_START( oric ) |
| 1117 | 1117 | { |
| 1118 | 1118 | oric_common_init_machine(); |
| 1119 | ||
| 1119 | ||
| 1120 | 1120 | oric_is_telestrat = 0; |
| 1121 | 1121 | |
| 1122 | 1122 | oric_ram_0x0c000 = auto_malloc(16384); |
| r1461 | r1462 | |
| 1216 | 1216 | { |
| 1217 | 1217 | if ((offset & 0x0f)!=0x0d) |
| 1218 | 1218 | { |
| 1219 | logerror("via 0 r: %04x %04x\n",offset, (unsigned) cpunum_get_reg(0, REG_PC)); | |
| 1219 | logerror("via 0 r: %04x %04x\n",offset, (unsigned) cpunum_get_reg(0, REG_PC)); | |
| 1220 | 1220 | } |
| 1221 | 1221 | } |
| 1222 | 1222 | /* it is repeated */ |
| r1461 | r1462 | |
| 1256 | 1256 | #endif |
| 1257 | 1257 | if (enable_logging) |
| 1258 | 1258 | { |
| 1259 | logerror("via 0 w: %04x %02x %04x\n",offset,data,(unsigned) cpunum_get_reg(0, REG_PC)); | |
| 1259 | logerror("via 0 w: %04x %02x %04x\n",offset,data,(unsigned) cpunum_get_reg(0, REG_PC)); | |
| 1260 | 1260 | } |
| 1261 | 1261 | |
| 1262 | 1262 | via_0_w(offset & 0x0f,data); |
| r1461 | r1462 | |
|---|---|---|
| 25 | 25 | fdb3e 0x8..0xc |
| 26 | 26 | fd7f8 |
| 27 | 27 | fdb5f |
| 28 | fe172 | |
| 28 | fe172 | |
| 29 | 29 | fecc5 // 801a video setup error |
| 30 | 30 | fd6c9 |
| 31 | 31 | copyright output |
| r1461 | r1462 | |
| 63 | 63 | read low 4 nibble at jim 0xa |
| 64 | 64 | read low 4 nibble at jim 0xa |
| 65 | 65 | return first nibble<<4|second nibble in ah |
| 66 | ff046 seldom compares ret | |
| 66 | ff046 seldom compares ret | |
| 67 | 67 | ffe87 0 -> ds |
| 68 | 68 | |
| 69 | 69 | 469: |
| r1461 | r1462 | |
| 145 | 145 | switch (europc_jim.state) { |
| 146 | 146 | case 0: europc_jim.state++; return 0; |
| 147 | 147 | case 1: europc_jim.state++; return 0x80; |
| 148 | case 2: | |
| 148 | case 2: | |
| 149 | 149 | europc_jim.state=0; |
| 150 | 150 | switch (europc_jim.mode) { |
| 151 | 151 | case AGA_COLOR: return 0x87; // for color; |
| r1461 | r1462 | |
|---|---|---|
| 51 | 51 | { |
| 52 | 52 | /* get bit received from other side and update receive register */ |
| 53 | 53 | receive_register_update_bit(&acia.receive_reg, get_in_data_bit(acia.connection.input_state)); |
| 54 | ||
| 54 | ||
| 55 | 55 | if (acia.receive_reg.flags & RECEIVE_REGISTER_FULL) |
| 56 | 56 | { |
| 57 | 57 | receive_register_extract(&acia.receive_reg, &acia.data_form); |
| r1461 | r1462 | |
| 72 | 72 | acia_6551_refresh_ints(); |
| 73 | 73 | } |
| 74 | 74 | } |
| 75 | ||
| 75 | ||
| 76 | 76 | /* if transmit is not empty... transmit data */ |
| 77 | 77 | if ((acia.transmit_reg.flags & TRANSMIT_REGISTER_EMPTY)==0) |
| 78 | 78 | { |
| r1461 | r1462 | |
| 111 | 111 | |
| 112 | 112 | /* receive interrupts */ |
| 113 | 113 | |
| 114 | /* receive data register full? */ | |
| 114 | /* receive data register full? */ | |
| 115 | 115 | if (acia.status_register & (1<<3)) |
| 116 | 116 | { |
| 117 | 117 | /* receiver interrupt enable? */ |
| r1461 | r1462 | |
| 244 | 244 | |
| 245 | 245 | case 1: |
| 246 | 246 | { |
| 247 | /* telstrat writes 0x07f! */ | |
| 247 | /* telstrat writes 0x07f! */ | |
| 248 | 248 | } |
| 249 | 249 | break; |
| 250 | 250 | |
| 251 | 251 | |
| 252 | /* | |
| 252 | /* | |
| 253 | 253 | Command Register: |
| 254 | 254 | |
| 255 | 255 | b0 Data Terminal Ready |
| r1461 | r1462 | |
| 296 | 296 | acia.connection.State &=~SERIAL_STATE_RTS; |
| 297 | 297 | } |
| 298 | 298 | break; |
| 299 | ||
| 299 | ||
| 300 | 300 | case 1: |
| 301 | 301 | case 2: |
| 302 | 302 | case 3: |
| r1461 | r1462 | |
| 351 | 351 | unsigned char previous_control_register; |
| 352 | 352 | |
| 353 | 353 | previous_control_register = acia.control_register; |
| 354 | ||
| 354 | ||
| 355 | 355 | if (((previous_control_register^data) & 0x07)!=0) |
| 356 | 356 | { |
| 357 | 357 | int rate; |
| r1461 | r1462 | |
| 372 | 372 | |
| 373 | 373 | switch (rate) |
| 374 | 374 | { |
| 375 | ||
| 375 | ||
| 376 | 376 | default: |
| 377 | 377 | case 1: |
| 378 | 378 | { |
| 379 | 379 | baud_rate = 50; |
| 380 | 380 | } |
| 381 | 381 | break; |
| 382 | ||
| 382 | ||
| 383 | 383 | case 2: |
| 384 | 384 | { |
| 385 | 385 | baud_rate = 75; |
| r1461 | r1462 | |
| 397 | 397 | baud_rate = 135; |
| 398 | 398 | } |
| 399 | 399 | break; |
| 400 | ||
| 400 | ||
| 401 | 401 | case 5: |
| 402 | 402 | { |
| 403 | 403 | baud_rate = 150; |
| 404 | 404 | } |
| 405 | break; | |
| 406 | ||
| 405 | break; | |
| 406 | ||
| 407 | 407 | case 6: |
| 408 | 408 | { |
| 409 | 409 | baud_rate = 300; |
| r1461 | r1462 | |
| 414 | 414 | { |
| 415 | 415 | baud_rate = 600; |
| 416 | 416 | } |
| 417 | break; | |
| 418 | ||
| 417 | break; | |
| 418 | ||
| 419 | 419 | case 8: |
| 420 | 420 | { |
| 421 | 421 | baud_rate = 1200; |
| 422 | 422 | } |
| 423 | break; | |
| 424 | ||
| 423 | break; | |
| 424 | ||
| 425 | 425 | case 9: |
| 426 | 426 | { |
| 427 | 427 | baud_rate = 1800; |
| 428 | 428 | } |
| 429 | break; | |
| 430 | ||
| 429 | break; | |
| 430 | ||
| 431 | 431 | case 10: |
| 432 | 432 | { |
| 433 | 433 | baud_rate = 2400; |
| r1461 | r1462 | |
| 439 | 439 | baud_rate = 3600; |
| 440 | 440 | } |
| 441 | 441 | break; |
| 442 | ||
| 442 | ||
| 443 | 443 | case 12: |
| 444 | 444 | { |
| 445 | 445 | baud_rate = 4800; |
| 446 | 446 | } |
| 447 | 447 | break; |
| 448 | ||
| 448 | ||
| 449 | 449 | case 13: |
| 450 | 450 | { |
| 451 | 451 | baud_rate = 7200; |
| 452 | 452 | } |
| 453 | 453 | break; |
| 454 | ||
| 454 | ||
| 455 | 455 | case 14: |
| 456 | 456 | { |
| 457 | 457 | baud_rate = 9600; |
| 458 | 458 | } |
| 459 | 459 | break; |
| 460 | ||
| 460 | ||
| 461 | 461 | case 15: |
| 462 | 462 | { |
| 463 | 463 | baud_rate = 19200; |
| r1461 | r1462 | |
|---|---|---|
| 43 | 43 | inport0 = input_port_0_r(0); |
| 44 | 44 | inport1 = input_port_1_r(0); |
| 45 | 45 | inport6 = input_port_6_r(0); |
| 46 | ||
| 47 | /* Numeric pad buttons are not independent on a real ColecoVision, if you push more | |
| 46 | ||
| 47 | /* Numeric pad buttons are not independent on a real ColecoVision, if you push more | |
| 48 | 48 | than one, a real ColecoVision think that it is a third button, so we are going to emulate |
| 49 | 49 | the right behaviour */ |
| 50 | ||
| 50 | ||
| 51 | 51 | data = 0x0F; /* No key pressed by default */ |
| 52 | 52 | if (!(inport6&0x01)) /* If Driving Controller enabled -> no keypad 1*/ |
| 53 | 53 | { |
| r1461 | r1462 | |
| 71 | 71 | { |
| 72 | 72 | int data = input_port_2_r(0) & 0xCF; |
| 73 | 73 | int inport6 = input_port_6_r(0); |
| 74 | ||
| 74 | ||
| 75 | 75 | if (inport6&0x07) /* If Extra Contollers enabled */ |
| 76 | 76 | { |
| 77 | 77 | if (JoyStat[0]==0) data|=0x30; /* Spinner Move Left*/ |
| 78 | 78 | else if (JoyStat[0]==1) data|=0x20; /* Spinner Move Right */ |
| 79 | } | |
| 79 | } | |
| 80 | 80 | return data | 0x80; |
| 81 | 81 | } |
| 82 | 82 | } |
| r1461 | r1462 | |
| 91 | 91 | inport3 = input_port_3_r(0); |
| 92 | 92 | inport4 = input_port_4_r(0); |
| 93 | 93 | |
| 94 | /* Numeric pad buttons are not independent on a real ColecoVision, if you push more | |
| 94 | /* Numeric pad buttons are not independent on a real ColecoVision, if you push more | |
| 95 | 95 | than one, a real ColecoVision think that it is a third button, so we are going to emulate |
| 96 | 96 | the right behaviour */ |
| 97 | ||
| 97 | ||
| 98 | 98 | data = 0x0F; /* No key pressed by default */ |
| 99 | 99 | if (!(inport3 & 0x01)) data &= 0x0A; /* 0 */ |
| 100 | 100 | if (!(inport3 & 0x02)) data &= 0x0D; /* 1 */ |
| r1461 | r1462 | |
| 116 | 116 | { |
| 117 | 117 | int data = input_port_5_r(0) & 0xCF; |
| 118 | 118 | int inport6 = input_port_6_r(0); |
| 119 | ||
| 119 | ||
| 120 | 120 | if (inport6&0x02) /* If Roller Controller enabled */ |
| 121 | 121 | { |
| 122 | 122 | if (JoyStat[1]==0) data|=0x30; |
| 123 | 123 | else if (JoyStat[1]==1) data|=0x20; |
| 124 | } | |
| 124 | } | |
| 125 | 125 | |
| 126 | 126 | return data | 0x80; |
| 127 | 127 | } |
| r1461 | r1462 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | ||
| 2 | ||
| 3 | 3 | IBM AT Compatibles |
| 4 | 4 | |
| 5 | 5 | ***************************************************************************/ |
| r1461 | r1462 | |
|---|---|---|
| 112 | 112 | /* |
| 113 | 113 | bit |
| 114 | 114 | 0 >1x00 0: USB Host controller requests interrupt. |
| 115 | 1 >1x02 0: USB Device controller requests interrupt. | |
| 115 | 1 >1x02 0: USB Device controller requests interrupt. | |
| 116 | 116 | 2 >1x04 1: USB Host controller suspended. |
| 117 | 117 | 3 >1x06 1: USB Device controller suspended. |
| 118 | 118 | 4 >1x08 0: Strata FEEPROM is busy. |
| r1461 | r1462 | |
|---|---|---|
| 13 | 13 | static int power=1; /* simulates pressed cce when mess is started */ |
| 14 | 14 | |
| 15 | 15 | |
| 16 | /* | |
| 16 | /* | |
| 17 | 17 | port 2: |
| 18 | 18 | bits 0,1: external rom a14,a15 lines |
| 19 | port 3: | |
| 19 | port 3: | |
| 20 | 20 | bits 0..6 keyboard output select matrix line |
| 21 | 21 | */ |
| 22 | 22 | static UINT8 asic[4]; |
| r1461 | r1462 | |
| 145 | 145 | if (KEY_UP) data|=0x10; |
| 146 | 146 | if (KEY_U) data|=0x20; |
| 147 | 147 | if (KEY_J) data|=0x40; |
| 148 | if (KEY_M) data|=0x80; | |
| 148 | if (KEY_M) data|=0x80; | |
| 149 | 149 | } |
| 150 | 150 | if (outa&4) { |
| 151 | 151 | if (KEY_BRACE_LEFT) data|=8; |
| r1461 | r1462 | |
|---|---|---|
| 236 | 236 | // video_update |
| 237 | 237 | ula.current_pal[i+10] = (ula.current_pal[i+10] & 0x06) | ((data & 0x08) >> 3); |
| 238 | 238 | ula.current_pal[i+8] = (ula.current_pal[i+8] & 0x06) | ((data & 0x04) >> 2); |
| 239 | ula.current_pal[i+2] = (ula.current_pal[i+2] & 0x04) | (((data & 0x20) >> 4) | ((data & 0x02) >> 1)); | |
| 239 | ula.current_pal[i+2] = (ula.current_pal[i+2] & 0x04) | (((data & 0x20) >> 4) | ((data & 0x02) >> 1)); | |
| 240 | 240 | ula.current_pal[i] = (ula.current_pal[i] & 0x04) | (((data & 0x10) >> 3) | ((data & 0x01))); |
| 241 | 241 | break; |
| 242 | 242 | } |
| r1461 | r1462 | |
| 289 | 289 | MACHINE_START( electron ) |
| 290 | 290 | { |
| 291 | 291 | memory_configure_bank(2, 0, 16, memory_region(REGION_USER1), 0x4000); |
| 292 | ||
| 292 | ||
| 293 | 293 | ula.interrupt_status = 0x82; |
| 294 | 294 | ula.interrupt_control = 0x00; |
| 295 | 295 | timer_set( attotime_zero, NULL, 0, setup_beep ); |
| r1461 | r1462 | |
|---|---|---|
| 4 | 4 | |
| 5 | 5 | TODO: |
| 6 | 6 | - check how the drive select from DOR register, and the drive select |
| 7 | from the fdc are related !!!! | |
| 7 | from the fdc are related !!!! | |
| 8 | 8 | - if all drives do not have a disk in them, and the fdc is reset, is a int generated? |
| 9 | 9 | (if yes, indicates drives are ready without discs, if no indicates no drives are ready) |
| 10 | 10 | - status register a, status register b |
| r1461 | r1462 | |
| 52 | 52 | static void pc_fdc_hw_dma_drq(int,int); |
| 53 | 53 | static mess_image *pc_fdc_get_image(int floppy_index); |
| 54 | 54 | |
| 55 | static const nec765_interface pc_fdc_nec765_interface = | |
| 55 | static const nec765_interface pc_fdc_nec765_interface = | |
| 56 | 56 | { |
| 57 | 57 | pc_fdc_hw_interrupt, |
| 58 | 58 | pc_fdc_hw_dma_drq, |
| r1461 | r1462 | |
| 205 | 205 | /* toggle reset state */ |
| 206 | 206 | nec765_set_reset_state(1); |
| 207 | 207 | nec765_set_reset_state(0); |
| 208 | ||
| 208 | ||
| 209 | 209 | /* bit is self-clearing */ |
| 210 | 210 | data &= ~0x080; |
| 211 | 211 | } |
| r1461 | r1462 | |
| 281 | 281 | when the fdc is reset. |
| 282 | 282 | In the FDC docs, it states that a INT will |
| 283 | 283 | be generated if READY input is true when the |
| 284 | fdc is reset. | |
| 285 | ||
| 284 | fdc is reset. | |
| 285 | ||
| 286 | 286 | It also states, that outputs to drive are set to 0. |
| 287 | 287 | Maybe this causes the drive motor to go on, and therefore |
| 288 | the ready line is set. | |
| 288 | the ready line is set. | |
| 289 | 289 | |
| 290 | 290 | This in return causes a int?? --- |
| 291 | ||
| 292 | ||
| 291 | ||
| 292 | ||
| 293 | 293 | what is not yet clear is if this is a result of the drives ready state |
| 294 | 294 | changing... |
| 295 | 295 | */ |
| r1461 | r1462 | |
|---|---|---|
| 120 | 120 | "CMD_WRITESBUFF", /* 0x0F */ |
| 121 | 121 | |
| 122 | 122 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0x10-0x17 */ |
| 123 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0x18-0x1F */ | |
| 123 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0x18-0x1F */ | |
| 124 | 124 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0x20-0x27 */ |
| 125 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0x28-0x2F */ | |
| 125 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0x28-0x2F */ | |
| 126 | 126 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0x30-0x37 */ |
| 127 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0x38-0x3F */ | |
| 127 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0x38-0x3F */ | |
| 128 | 128 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0x40-0x47 */ |
| 129 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0x48-0x4F */ | |
| 129 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0x48-0x4F */ | |
| 130 | 130 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0x50-0x57 */ |
| 131 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0x58-0x5F */ | |
| 131 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0x58-0x5F */ | |
| 132 | 132 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0x60-0x67 */ |
| 133 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0x68-0x6F */ | |
| 133 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0x68-0x6F */ | |
| 134 | 134 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0x70-0x77 */ |
| 135 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0x78-0x7F */ | |
| 135 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0x78-0x7F */ | |
| 136 | 136 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0x80-0x87 */ |
| 137 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0x88-0x8F */ | |
| 137 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0x88-0x8F */ | |
| 138 | 138 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0x90-0x97 */ |
| 139 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0x98-0x9F */ | |
| 139 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0x98-0x9F */ | |
| 140 | 140 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0xA0-0xA7 */ |
| 141 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0xA8-0xAF */ | |
| 141 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0xA8-0xAF */ | |
| 142 | 142 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0xB0-0xB7 */ |
| 143 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0xB8-0xBF */ | |
| 143 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0xB8-0xBF */ | |
| 144 | 144 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0xC0-0xC7 */ |
| 145 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0xC8-0xCF */ | |
| 145 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0xC8-0xCF */ | |
| 146 | 146 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0xD0-0xD7 */ |
| 147 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0xD8-0xDF */ | |
| 147 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0xD8-0xDF */ | |
| 148 | 148 | |
| 149 | 149 | "CMD_RAMDIAG", /* 0xE0 */ |
| 150 | 150 | NULL, /* 0xE1 */ |
| r1461 | r1462 | |
| 155 | 155 | "CMD_WRITELONG", /* 0xE6 */ |
| 156 | 156 | NULL, /* 0xE7 */ |
| 157 | 157 | |
| 158 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0xE8-0xEF */ | |
| 158 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0xE8-0xEF */ | |
| 159 | 159 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0xF0-0xF7 */ |
| 160 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL /* 0xF8-0xFF */ | |
| 160 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL /* 0xF8-0xFF */ | |
| 161 | 161 | }; |
| 162 | 162 | |
| 163 | 163 | |
| r1461 | r1462 | |
| 188 | 188 | static hard_disk_file *pc_hdc_file(int id) |
| 189 | 189 | { |
| 190 | 190 | mess_image *img; |
| 191 | ||
| 191 | ||
| 192 | 192 | img = image_from_devtype_and_index(IO_HARDDISK, id); |
| 193 | 193 | if (!image_exists(img)) |
| 194 | 194 | return NULL; |
| r1461 | r1462 | |
| 252 | 252 | |
| 253 | 253 | file = pc_hdc_file(idx); |
| 254 | 254 | info = hard_disk_get_info(file); |
| 255 | ||
| 255 | ||
| 256 | 256 | lbasector = cylinder[idx]; |
| 257 | 257 | lbasector *= info->heads; |
| 258 | 258 | lbasector += head[idx]; |
| r1461 | r1462 | |
| 284 | 284 | UINT8 result; |
| 285 | 285 | hard_disk_info *info; |
| 286 | 286 | hard_disk_file *file; |
| 287 | ||
| 287 | ||
| 288 | 288 | file = pc_hdc_file(idx); |
| 289 | 289 | if (!file) |
| 290 | 290 | return 0; |
| r1461 | r1462 | |
| 324 | 324 | { |
| 325 | 325 | hard_disk_info *info; |
| 326 | 326 | hard_disk_file *file; |
| 327 | ||
| 327 | ||
| 328 | 328 | file = pc_hdc_file(idx); |
| 329 | 329 | if (!file) |
| 330 | 330 | return; |
| 331 | info = hard_disk_get_info(file); | |
| 331 | info = hard_disk_get_info(file); | |
| 332 | 332 | |
| 333 | 333 | *(hdcdma_dst++) = data; |
| 334 | 334 | |
| r1461 | r1462 | |
| 631 | 631 | status[n] &= ~STA_REQUEST; |
| 632 | 632 | status[n] &= ~STA_READY; |
| 633 | 633 | status[n] |= STA_INPUT; |
| 634 | ||
| 634 | ||
| 635 | 635 | assert(timer[n]); |
| 636 | 636 | timer_adjust(timer[n], ATTOTIME_IN_MSEC(1), n, attotime_zero); |
| 637 | 637 | } |
| r1461 | r1462 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | defines centronics/parallel port printer interface | |
| 2 | defines centronics/parallel port printer interface | |
| 3 | 3 | |
| 4 | 4 | provides a centronics printer simulation (sends output to IO_PRINTER) |
| 5 | 5 | */ |
| r1461 | r1462 | |
| 16 | 16 | /* These bytes are used in the timer callback. When the timer callback |
| 17 | 17 | is executed, the control value is updated with the new data. The mask |
| 18 | 18 | defines the bits that are changing, and the data is the new data */ |
| 19 | /* The user defined callback in CENTRONICS_CONFIG is called with the | |
| 19 | /* The user defined callback in CENTRONICS_CONFIG is called with the | |
| 20 | 20 | change. This allows systems that have interrupts triggered from the centronics |
| 21 | 21 | interface to function correctly. e.g. Amstrad NC100 */ |
| 22 | 22 | /* mask of data to set in timer callback */ |
| r1461 | r1462 | |
| 91 | 91 | void centronics_write_handshake(int nr, int data, int mask) |
| 92 | 92 | { |
| 93 | 93 | CENTRONICS *This=cent+nr; |
| 94 | ||
| 94 | ||
| 95 | 95 | int neu=(data&mask)|(This->control&(~mask)); |
| 96 | ||
| 96 | ||
| 97 | 97 | if (neu & CENTRONICS_NO_RESET) |
| 98 | 98 | { |
| 99 | 99 | /* strobe down */ |
| r1461 | r1462 | |
| 126 | 126 | } |
| 127 | 127 | else |
| 128 | 128 | { |
| 129 | if (This->control & CENTRONICS_SELECT) | |
| 129 | if (This->control & CENTRONICS_SELECT) | |
| 130 | 130 | data|=CENTRONICS_ONLINE; |
| 131 | 131 | } |
| 132 | 132 | data |= CENTRONICS_NO_ERROR; |
| r1461 | r1462 | |
|---|---|---|
| 473 | 473 | ** through repeated accesses, rather than by writing to an address. |
| 474 | 474 | ** Data was read by reading an odd input address and comparing the |
| 475 | 475 | ** ROM byte returned to detect signal changes. |
| 476 | ** | |
| 476 | ** | |
| 477 | 477 | ** The standard tape signal was a simple square wave, although this |
| 478 | 478 | ** was often greatly distorted by the cassette recorder. A single |
| 479 | 479 | ** tape record consisted of a 10-second 800-Hz leader, followed by a |
| r1461 | r1462 | |
|---|---|---|
| 17 | 17 | int sector_cnt; /* sector count */ |
| 18 | 18 | int error; /* error code */ |
| 19 | 19 | int status; /* drive status */ |
| 20 | ||
| 20 | ||
| 21 | 21 | int data_cnt; /* data count */ |
| 22 | 22 | UINT8 *buffer; /* data buffer */ |
| 23 | 23 | UINT8 *ptr; /* data pointer */ |
| r1461 | r1462 | |
|---|---|---|
| 49 | 49 | |
| 50 | 50 | /* interface */ |
| 51 | 51 | const mc6843_interface* iface; |
| 52 | ||
| 52 | ||
| 53 | 53 | /* registers */ |
| 54 | 54 | UINT8 CTAR; /* current track */ |
| 55 | 55 | UINT8 CMR; /* command */ |
| r1461 | r1462 | |
| 73 | 73 | |
| 74 | 74 | /* trigger delayed actions (bottom halves) */ |
| 75 | 75 | emu_timer* timer_cont; |
| 76 | ||
| 76 | ||
| 77 | 77 | } * mc6843; |
| 78 | 78 | |
| 79 | 79 | |
| r1461 | r1462 | |
| 96 | 96 | |
| 97 | 97 | |
| 98 | 98 | #if VERBOSE |
| 99 | static const char* mc6843_cmd[16] = | |
| 100 | { | |
| 99 | static const char* mc6843_cmd[16] = | |
| 100 | { | |
| 101 | 101 | "---", "---", "STZ", "SEK", "SSR", "SSW", "RCR", "SWD", |
| 102 | 102 | "---", "---", "FFR", "FFW", "MSR", "MSW", "---", "---", |
| 103 | 103 | }; |
| r1461 | r1462 | |
| 145 | 145 | int irq = 0; |
| 146 | 146 | |
| 147 | 147 | /* ISR3 */ |
| 148 | if ( (mc6843->CMR & 0x40) || ! mc6843->STRB ) | |
| 148 | if ( (mc6843->CMR & 0x40) || ! mc6843->STRB ) | |
| 149 | 149 | mc6843->ISR &= ~8; |
| 150 | 150 | else |
| 151 | 151 | mc6843->ISR |= 8; |
| 152 | 152 | |
| 153 | 153 | /* interrupts */ |
| 154 | if ( mc6843->ISR & 4 ) | |
| 154 | if ( mc6843->ISR & 4 ) | |
| 155 | 155 | irq = 1; /* unmaskable */ |
| 156 | if ( ! (mc6843->CMR & 0x80) ) | |
| 156 | if ( ! (mc6843->CMR & 0x80) ) | |
| 157 | 157 | { |
| 158 | 158 | /* maskable */ |
| 159 | if ( mc6843->ISR & ~4 ) | |
| 159 | if ( mc6843->ISR & ~4 ) | |
| 160 | 160 | irq = 1; |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | if ( mc6843->iface->irq_func ) | |
| 163 | if ( mc6843->iface->irq_func ) | |
| 164 | 164 | { |
| 165 | 165 | mc6843->iface->irq_func( irq ); |
| 166 | 166 | LOG(( "mc6843_status_update: irq=%i (CMR=%02X, ISR=%02X)\n", irq, mc6843->CMR, mc6843->ISR )); |
| r1461 | r1462 | |
| 204 | 204 | /* seek to track zero */ |
| 205 | 205 | for ( i=0; i<83; i++ ) |
| 206 | 206 | { |
| 207 | if ( floppy_drive_get_flag_state( img, FLOPPY_DRIVE_HEAD_AT_TRACK_0) ) | |
| 207 | if ( floppy_drive_get_flag_state( img, FLOPPY_DRIVE_HEAD_AT_TRACK_0) ) | |
| 208 | 208 | break; |
| 209 | 209 | floppy_drive_seek( img, -1 ); |
| 210 | 210 | } |
| 211 | 211 | |
| 212 | 212 | LOG(( "%f mc6843_finish_STZ: actual=%i\n", attotime_to_double(timer_get_time()), floppy_drive_get_current_track( img ) )); |
| 213 | ||
| 213 | ||
| 214 | 214 | /* update state */ |
| 215 | 215 | mc6843->CTAR = 0; |
| 216 | 216 | mc6843->GCR = 0; |
| r1461 | r1462 | |
| 248 | 248 | mess_image* img = mc6843_floppy_image(); |
| 249 | 249 | int r = 0; |
| 250 | 250 | |
| 251 | while ( 1 ) | |
| 251 | while ( 1 ) | |
| 252 | 252 | { |
| 253 | ||
| 253 | ||
| 254 | 254 | if ( ( ! floppy_drive_get_next_id( img, mc6843->side, id ) ) || ( id->flags & ID_FLAG_CRC_ERROR_IN_ID_FIELD ) || ( id->N != 0 ) ) |
| 255 | 255 | { |
| 256 | 256 | /* read address error */ |
| r1461 | r1462 | |
| 274 | 274 | { |
| 275 | 275 | /* found! */ |
| 276 | 276 | LOG(( "%f mc6843_address_search: sector %i found on track %i\n", attotime_to_double(timer_get_time()), id->R, id->C )); |
| 277 | if ( ! (mc6843->CMR & 0x20) ) | |
| 277 | if ( ! (mc6843->CMR & 0x20) ) | |
| 278 | 278 | { |
| 279 | 279 | mc6843->ISR |= 0x04; /* if no DMA, set Status Sense */ |
| 280 | 280 | } |
| 281 | 281 | return 1; |
| 282 | 282 | } |
| 283 | 283 | |
| 284 | if ( floppy_drive_get_flag_state( img, FLOPPY_DRIVE_INDEX ) ) | |
| 284 | if ( floppy_drive_get_flag_state( img, FLOPPY_DRIVE_INDEX ) ) | |
| 285 | 285 | { |
| 286 | 286 | r++; |
| 287 | 287 | if ( r >= 4 ) |
| r1461 | r1462 | |
| 303 | 303 | /* preamble specific to read commands (adds extra checks) */ |
| 304 | 304 | static int mc6843_address_search_read( chrn_id* id ) |
| 305 | 305 | { |
| 306 | if ( ! mc6843_address_search( id ) ) | |
| 307 | return 0; | |
| 306 | if ( ! mc6843_address_search( id ) ) | |
| 307 | return 0; | |
| 308 | 308 | |
| 309 | 309 | if ( id->flags & ID_FLAG_CRC_ERROR_IN_DATA_FIELD ) |
| 310 | 310 | { |
| r1461 | r1462 | |
| 330 | 330 | static void mc6843_finish_RCR( void ) |
| 331 | 331 | { |
| 332 | 332 | chrn_id id; |
| 333 | if ( ! mc6843_address_search_read( &id ) ) | |
| 333 | if ( ! mc6843_address_search_read( &id ) ) | |
| 334 | 334 | return; |
| 335 | 335 | mc6843_cmd_end(); |
| 336 | 336 | } |
| r1461 | r1462 | |
| 344 | 344 | mess_image* img = mc6843_floppy_image(); |
| 345 | 345 | |
| 346 | 346 | /* sector seek */ |
| 347 | if ( ! mc6843_address_search_read( &id ) ) | |
| 347 | if ( ! mc6843_address_search_read( &id ) ) | |
| 348 | 348 | return; |
| 349 | 349 | |
| 350 | 350 | /* sector read */ |
| r1461 | r1462 | |
| 363 | 363 | chrn_id id; |
| 364 | 364 | |
| 365 | 365 | /* sector seek */ |
| 366 | if ( ! mc6843_address_search( &id ) ) | |
| 366 | if ( ! mc6843_address_search( &id ) ) | |
| 367 | 367 | return; |
| 368 | 368 | |
| 369 | 369 | /* setup sector write buffer */ |
| r1461 | r1462 | |
| 409 | 409 | UINT8 data = 0; |
| 410 | 410 | |
| 411 | 411 | switch ( offset ) { |
| 412 | ||
| 412 | ||
| 413 | 413 | case 0: /* Data Input Register (DIR) */ |
| 414 | 414 | { |
| 415 | 415 | int cmd = mc6843->CMR & 0x0f; |
| 416 | 416 | |
| 417 | 417 | LOG(( "%f $%04x mc6843_r: data input cmd=%s(%i), pos=%i/%i, GCR=%i, ", |
| 418 | attotime_to_double(timer_get_time()), activecpu_get_previouspc(), | |
| 419 | mc6843_cmd[cmd], cmd, mc6843->data_idx, | |
| 418 | attotime_to_double(timer_get_time()), activecpu_get_previouspc(), | |
| 419 | mc6843_cmd[cmd], cmd, mc6843->data_idx, | |
| 420 | 420 | mc6843->data_size, mc6843->GCR )); |
| 421 | 421 | |
| 422 | 422 | if ( cmd == CMD_SSR || cmd == CMD_MSR ) |
| 423 | { | |
| 423 | { | |
| 424 | 424 | /* sector read */ |
| 425 | 425 | assert( mc6843->data_size > 0 ); |
| 426 | 426 | assert( mc6843->data_idx < mc6843->data_size ); |
| r1461 | r1462 | |
| 439 | 439 | /* schedule next sector in multiple sector read */ |
| 440 | 440 | mc6843->GCR--; |
| 441 | 441 | mc6843->SAR++; |
| 442 | if ( mc6843->GCR == 0xff ) | |
| 442 | if ( mc6843->GCR == 0xff ) | |
| 443 | 443 | { |
| 444 | 444 | mc6843_cmd_end(); |
| 445 | 445 | } |
| 446 | else if ( mc6843->SAR > 26 ) | |
| 447 | ||
| 446 | else if ( mc6843->SAR > 26 ) | |
| 447 | ||
| 448 | 448 | { |
| 449 | 449 | mc6843->STRB |= 0x08; /* set Sector Address Undetected */ |
| 450 | 450 | mc6843_cmd_end(); |
| r1461 | r1462 | |
| 464 | 464 | { |
| 465 | 465 | data = mc6843->data[0]; |
| 466 | 466 | } |
| 467 | else | |
| 467 | else | |
| 468 | 468 | { |
| 469 | 469 | /* XXX TODO: other read modes */ |
| 470 | 470 | data = mc6843->data[0]; |
| r1461 | r1462 | |
| 501 | 501 | mess_image* img = mc6843_floppy_image(); |
| 502 | 502 | int flag = floppy_drive_get_flag_state( img, FLOPPY_DRIVE_READY | FLOPPY_DRIVE_HEAD_AT_TRACK_0 | FLOPPY_DRIVE_DISK_WRITE_PROTECTED ); |
| 503 | 503 | mc6843->STRA &= 0xa3; |
| 504 | if ( flag & FLOPPY_DRIVE_READY ) | |
| 504 | if ( flag & FLOPPY_DRIVE_READY ) | |
| 505 | 505 | mc6843->STRA |= 0x04; |
| 506 | if ( flag & FLOPPY_DRIVE_HEAD_AT_TRACK_0 ) | |
| 506 | if ( flag & FLOPPY_DRIVE_HEAD_AT_TRACK_0 ) | |
| 507 | 507 | mc6843->STRA |= 0x08; |
| 508 | if ( flag & FLOPPY_DRIVE_DISK_WRITE_PROTECTED ) | |
| 508 | if ( flag & FLOPPY_DRIVE_DISK_WRITE_PROTECTED ) | |
| 509 | 509 | mc6843->STRA |= 0x10; |
| 510 | if ( mc6843->index_pulse ) | |
| 510 | if ( mc6843->index_pulse ) | |
| 511 | 511 | mc6843->STRA |= 0x40; |
| 512 | 512 | |
| 513 | 513 | data = mc6843->STRA; |
| r1461 | r1462 | |
| 529 | 529 | mc6843->STRB &= ~0xfb; |
| 530 | 530 | mc6843_status_update(); |
| 531 | 531 | break; |
| 532 | ||
| 532 | ||
| 533 | 533 | case 7: /* Logical-Track Address Register (LTAR) */ |
| 534 | 534 | data = mc6843->LTAR; |
| 535 | 535 | LOG(( "%f $%04x mc6843_r: read LTAR %i (actual=%i)\n", |
| r1461 | r1462 | |
| 547 | 547 | WRITE8_HANDLER ( mc6843_w ) |
| 548 | 548 | { |
| 549 | 549 | switch ( offset ) { |
| 550 | ||
| 550 | ||
| 551 | 551 | case 0: /* Data Output Register (DOR) */ |
| 552 | 552 | { |
| 553 | 553 | int cmd = mc6843->CMR & 0x0f; |
| 554 | 554 | int FWF = (mc6843->CMR >> 4) & 1; |
| 555 | 555 | |
| 556 | 556 | LOG(( "%f $%04x mc6843_w: data output cmd=%s(%i), pos=%i/%i, GCR=%i, data=%02X\n", |
| 557 | attotime_to_double(timer_get_time()), activecpu_get_previouspc(), | |
| 558 | mc6843_cmd[cmd], cmd, mc6843->data_idx, | |
| 557 | attotime_to_double(timer_get_time()), activecpu_get_previouspc(), | |
| 558 | mc6843_cmd[cmd], cmd, mc6843->data_idx, | |
| 559 | 559 | mc6843->data_size, mc6843->GCR, data )); |
| 560 | 560 | |
| 561 | 561 | if ( cmd == CMD_SSW || cmd == CMD_MSW || cmd == CMD_SWD ) |
| r1461 | r1462 | |
| 573 | 573 | |
| 574 | 574 | LOG(( "%f $%04x mc6843_w: write sector %i\n", attotime_to_double(timer_get_time()), activecpu_get_previouspc(), mc6843->data_id )); |
| 575 | 575 | |
| 576 | floppy_drive_write_sector_data( | |
| 576 | floppy_drive_write_sector_data( | |
| 577 | 577 | img, mc6843->side, mc6843->data_id, |
| 578 | 578 | mc6843->data, mc6843->data_size, |
| 579 | 579 | (cmd == CMD_SWD) ? ID_FLAG_DELETED_DATA : 0 ); |
| r1461 | r1462 | |
| 584 | 584 | { |
| 585 | 585 | mc6843->GCR--; |
| 586 | 586 | mc6843->SAR++; |
| 587 | if ( mc6843->GCR == 0xff ) | |
| 587 | if ( mc6843->GCR == 0xff ) | |
| 588 | 588 | { |
| 589 | 589 | mc6843_cmd_end(); |
| 590 | 590 | } |
| 591 | else if ( mc6843->SAR > 26 ) | |
| 592 | ||
| 591 | else if ( mc6843->SAR > 26 ) | |
| 592 | ||
| 593 | 593 | { |
| 594 | 594 | mc6843->STRB |= 0x08; /* set Sector Address Undetected */ |
| 595 | 595 | mc6843_cmd_end(); |
| r1461 | r1462 | |
| 609 | 609 | { |
| 610 | 610 | /* assume we are formatting */ |
| 611 | 611 | UINT8 nibble; |
| 612 | nibble = | |
| 612 | nibble = | |
| 613 | 613 | (data & 0x01) | |
| 614 | 614 | ((data & 0x04) >> 1 )| |
| 615 | 615 | ((data & 0x10) >> 2 )| |
| r1461 | r1462 | |
| 617 | 617 | |
| 618 | 618 | assert( mc6843->data_idx < sizeof(mc6843->data) ); |
| 619 | 619 | |
| 620 | mc6843->data[mc6843->data_idx / 2] = | |
| 620 | mc6843->data[mc6843->data_idx / 2] = | |
| 621 | 621 | (mc6843->data[mc6843->data_idx / 2] << 4) | nibble; |
| 622 | 622 | |
| 623 | 623 | if ( (mc6843->data_idx == 0) && (mc6843->data[0] == 0xfe ) ) |
| r1461 | r1462 | |
| 748 | 748 | attotime_to_double(timer_get_time()), activecpu_get_previouspc(), mc6843->LTAR, data, |
| 749 | 749 | floppy_drive_get_current_track( mc6843_floppy_image() ) )); |
| 750 | 750 | break; |
| 751 | ||
| 751 | ||
| 752 | 752 | default: |
| 753 | 753 | logerror( "$%04x mc6843 invalid write offset %i (data=$%02X)\n", activecpu_get_previouspc(), offset, data ); |
| 754 | 754 | } |
| r1461 | r1462 | |
| 766 | 766 | LOG (( "mc6843 reset\n" )); |
| 767 | 767 | |
| 768 | 768 | /* setup/reset floppy drive */ |
| 769 | for ( i = 0; i < device_count( IO_FLOPPY ); i++ ) | |
| 769 | for ( i = 0; i < device_count( IO_FLOPPY ); i++ ) | |
| 770 | 770 | { |
| 771 | 771 | mess_image * img = image_from_devtype_and_index( IO_FLOPPY, i ); |
| 772 | 772 | floppy_drive_set_index_pulse_callback( img, mc6843_index_pulse_callback ); |
| r1461 | r1462 | |
| 796 | 796 | |
| 797 | 797 | void mc6843_config ( const mc6843_interface* iface ) |
| 798 | 798 | { |
| 799 | assert( iface ); | |
| 799 | assert( iface ); | |
| 800 | 800 | mc6843 = auto_malloc( sizeof( * mc6843 ) ); |
| 801 | 801 | assert( mc6843 ); |
| 802 | 802 | memset( mc6843, 0, sizeof( * mc6843 ) ); |
| r1461 | r1462 | |
|---|---|---|
| 97 | 97 | |
| 98 | 98 | { |
| 99 | 99 | mame_system_time systime; |
| 100 | ||
| 100 | ||
| 101 | 101 | /* get the current date/time from the core */ |
| 102 | 102 | mame_get_current_datetime(Machine, &systime); |
| 103 | 103 |
| r1461 | r1462 | |
|---|---|---|
| 118 | 118 | /* KB port A */ |
| 119 | 119 | if (pc_ppi.keyboard_disabled) |
| 120 | 120 | { |
| 121 | /* 0 0 - no floppy drives | |
| 122 | * 1 Not used | |
| 123 | * 2-3 The number of memory banks on the system board | |
| 121 | /* 0 0 - no floppy drives | |
| 122 | * 1 Not used | |
| 123 | * 2-3 The number of memory banks on the system board | |
| 124 | 124 | * 4-5 Display mode |
| 125 | 125 | * 11 = monochrome |
| 126 | 126 | * 10 - color 80x25 |
| 127 | * 01 - color 40x25 | |
| 128 | * 6-7 The number of floppy disk drives | |
| 127 | * 01 - color 40x25 | |
| 128 | * 6-7 The number of floppy disk drives | |
| 129 | 129 | */ |
| 130 | 130 | data = readinputport(1); |
| 131 | 131 | } |
| r1461 | r1462 | |
|---|---|---|
| 8 | 8 | - disable GPIO3/4 interrupts when timer A/B in pulse mode |
| 9 | 9 | - spurious interrupt |
| 10 | 10 | |
| 11 | If you look at the MFP datasheet it is obvious that it can generate the conditions for a spurious interrupt. | |
| 11 | If you look at the MFP datasheet it is obvious that it can generate the conditions for a spurious interrupt. | |
| 12 | 12 | However the fact that they indeed happen in the ST is quite interesting. |
| 13 | 13 | |
| 14 | The MFP will generate a spurious interrupt if interrupts are disabled (by changing the IERA/IERB registers) | |
| 15 | at the “precise point”. The precise point would be after the system (but not necessarily the CPU, see below) | |
| 14 | The MFP will generate a spurious interrupt if interrupts are disabled (by changing the IERA/IERB registers) | |
| 15 | at the “precise point”. The precise point would be after the system (but not necessarily the CPU, see below) | |
| 16 | 16 | triggered an MFP interrupt, and before the CPU drives the interrupt acknowledge cycle. |
| 17 | 17 | |
| 18 | If the MFP was connected directly to the CPU, spurious interrupts probably couldn’t happen. However in the | |
| 19 | ST, GLUE seats in the middle and handles all the interrupt timing. It is possible that GLUE introduces a | |
| 18 | If the MFP was connected directly to the CPU, spurious interrupts probably couldn’t happen. However in the | |
| 19 | ST, GLUE seats in the middle and handles all the interrupt timing. It is possible that GLUE introduces a | |
| 20 | 20 | delay between detecting a change in the MFP interrupt request signal and actually propagating the change to |
| 21 | the CPU IPL signals (it is even possible that GLUE make some kind of latching). This would create a window | |
| 22 | long enough for the “precise point” described above. | |
| 21 | the CPU IPL signals (it is even possible that GLUE make some kind of latching). This would create a window | |
| 22 | long enough for the “precise point” described above. | |
| 23 | 23 | |
| 24 | 24 | "yes, the spurious interrupt occurs when i mask a timer. i did not notice an occurance of the SPI when changing data and control registers. |
| 25 | 25 | if i kill interrupts with the status reg before masking the timer interrupt, then the SPI occurs as soon as the status register is set to re-enable interrupts." |
| 26 | ||
| 26 | ||
| 27 | 27 | - divide serial clock by 16 |
| 28 | 28 | - synchronous mode |
| 29 | 29 | - 1.5/2 stop bits |
| r1461 | r1462 | |
| 68 | 68 | static mfp_68901 mfp[MAX_MFP]; |
| 69 | 69 | |
| 70 | 70 | static const int MFP68901_INT_MASK_GPIO[] = |
| 71 | { | |
| 72 | MFP68901_IR_GPIP_0, MFP68901_IR_GPIP_1, MFP68901_IR_GPIP_2, MFP68901_IR_GPIP_3, | |
| 73 | MFP68901_IR_GPIP_4, MFP68901_IR_GPIP_5, MFP68901_IR_GPIP_6, MFP68901_IR_GPIP_7 | |
| 71 | { | |
| 72 | MFP68901_IR_GPIP_0, MFP68901_IR_GPIP_1, MFP68901_IR_GPIP_2, MFP68901_IR_GPIP_3, | |
| 73 | MFP68901_IR_GPIP_4, MFP68901_IR_GPIP_5, MFP68901_IR_GPIP_6, MFP68901_IR_GPIP_7 | |
| 74 | 74 | }; |
| 75 | 75 | |
| 76 | 76 | static const int MFP68901_INT_MASK_TIMER[] = |
| r1461 | r1462 | |
| 752 | 752 | } |
| 753 | 753 | break; |
| 754 | 754 | |
| 755 | case MFP68901_REGISTER_TCDCR: | |
| 755 | case MFP68901_REGISTER_TCDCR: | |
| 756 | 756 | mfp_p->tcdcr = data & 0x6f; |
| 757 | 757 | |
| 758 | 758 | switch (mfp_p->tcdcr & 0x07) |
| r1461 | r1462 | |
| 1173 | 1173 | { |
| 1174 | 1174 | timer_pulse(ATTOTIME_IN_HZ(mfp_p->intf->rx_clock), NULL, which, rx_tick); |
| 1175 | 1175 | } |
| 1176 | ||
| 1176 | ||
| 1177 | 1177 | // serial transmit timer |
| 1178 | 1178 | |
| 1179 | 1179 | if (mfp_p->intf->tx_clock > 0) |
| r1461 | r1462 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | 3 | Amiga floppy disk controller emulation |
| 4 | ||
| 4 | ||
| 5 | 5 | - The drive spins at 300 RPM = 1 Rev every 200ms |
| 6 | 6 | - At 2usec per bit, that's 12500 bytes per track, or 6250 words per track |
| 7 | 7 | - At 4usec per bit, that's 6250 bytes per track, or 3125 words per track |
| r1461 | r1462 | |
| 88 | 88 | fdc_status[id].disk_changed = DISK_DETECT_DELAY; |
| 89 | 89 | |
| 90 | 90 | memset( fdc_status[id].mfm, 0xaa, MAX_MFM_TRACK_LEN ); |
| 91 | ||
| 91 | ||
| 92 | 92 | fdc_sel = 0x0f; |
| 93 | 93 | fdc_dir = 0; |
| 94 | 94 | fdc_side = 1; |
| 95 | 95 | fdc_step = 1; |
| 96 | 96 | fdc_rdy = 0; |
| 97 | ||
| 97 | ||
| 98 | 98 | return INIT_PASS; |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | static void check_extended_image( int id ) |
| 102 | 102 | { |
| 103 | 103 | UINT8 header[8], data[4]; |
| 104 | ||
| 104 | ||
| 105 | 105 | fdc_status[id].is_ext_image = 0; |
| 106 | ||
| 106 | ||
| 107 | 107 | if ( image_fseek( fdc_status[id].f, 0, SEEK_SET ) ) |
| 108 | 108 | { |
| 109 | 109 | logerror("FDC: image_fseek failed!\n" ); |
| r1461 | r1462 | |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | image_fread( fdc_status[id].f, &header, sizeof( header ) ); |
| 114 | ||
| 114 | ||
| 115 | 115 | if ( memcmp( header, "UAE--ADF", sizeof( header ) ) == 0 ) |
| 116 | 116 | { |
| 117 | 117 | int i; |
| 118 | ||
| 118 | ||
| 119 | 119 | for( i = 0; i < MAX_TRACKS; i++ ) |
| 120 | 120 | { |
| 121 | 121 | image_fread( fdc_status[id].f, &data, sizeof( data ) ); |
| 122 | ||
| 122 | ||
| 123 | 123 | /* data[0,1] = SYNC - data[2,3] = LEN */ |
| 124 | ||
| 124 | ||
| 125 | 125 | fdc_status[id].extinfo[i] = data[0]; |
| 126 | 126 | fdc_status[id].extinfo[i] <<= 8; |
| 127 | 127 | fdc_status[id].extinfo[i] |= data[1]; |
| r1461 | r1462 | |
| 129 | 129 | fdc_status[id].extinfo[i] |= data[2]; |
| 130 | 130 | fdc_status[id].extinfo[i] <<= 8; |
| 131 | 131 | fdc_status[id].extinfo[i] |= data[3]; |
| 132 | ||
| 132 | ||
| 133 | 133 | if ( i == 0 ) |
| 134 | 134 | fdc_status[id].extoffs[i] = sizeof( header ) + ( MAX_TRACKS * sizeof( data ) ); |
| 135 | 135 | else |
| 136 | 136 | fdc_status[id].extoffs[i] = fdc_status[id].extoffs[i-1] + ( fdc_status[id].extinfo[i-1] & 0xffff ); |
| 137 | 137 | } |
| 138 | ||
| 138 | ||
| 139 | 139 | fdc_status[id].is_ext_image = 1; |
| 140 | 140 | } |
| 141 | 141 | } |
| r1461 | r1462 | |
| 153 | 153 | timer_reset( fdc_status[id].sync_timer, attotime_never ); |
| 154 | 154 | timer_reset( fdc_status[id].dma_timer, attotime_never ); |
| 155 | 155 | fdc_rdy = 0; |
| 156 | ||
| 156 | ||
| 157 | 157 | check_extended_image( id ); |
| 158 | 158 | |
| 159 | 159 | return INIT_PASS; |
| r1461 | r1462 | |
| 162 | 162 | static DEVICE_UNLOAD(amiga_fdc) |
| 163 | 163 | { |
| 164 | 164 | int id = image_index_in_device(image); |
| 165 | ||
| 165 | ||
| 166 | 166 | fdc_status[id].disk_changed = DISK_DETECT_DELAY; |
| 167 | 167 | fdc_status[id].f = NULL; |
| 168 | 168 | fdc_status[id].cached = -1; |
| r1461 | r1462 | |
| 233 | 233 | } |
| 234 | 234 | |
| 235 | 235 | static TIMER_CALLBACK(fdc_sync_proc) |
| 236 | { | |
| 236 | { | |
| 237 | 237 | int drive = param; |
| 238 | 238 | UINT16 sync = CUSTOM_REG(REG_DSRSYNC); |
| 239 | 239 | int cur_pos; |
| 240 | 240 | int sector; |
| 241 | 241 | int time; |
| 242 | ||
| 242 | ||
| 243 | 243 | /* if floppy got ejected, stop */ |
| 244 | 244 | if ( fdc_status[drive].disk_changed ) |
| 245 | 245 | goto bail; |
| 246 | ||
| 246 | ||
| 247 | 247 | if ( fdc_status[drive].motor_on == 0 ) |
| 248 | 248 | goto bail; |
| 249 | ||
| 249 | ||
| 250 | 250 | cur_pos = fdc_get_curpos( drive ); |
| 251 | ||
| 251 | ||
| 252 | 252 | if ( cur_pos <= ( GAP_TRACK_BYTES + 6 ) ) |
| 253 | 253 | { |
| 254 | 254 | sector = 0; |
| r1461 | r1462 | |
| 257 | 257 | { |
| 258 | 258 | sector = ( cur_pos - ( GAP_TRACK_BYTES + 6 ) ) / ONE_SECTOR_BYTES; |
| 259 | 259 | } |
| 260 | ||
| 260 | ||
| 261 | 261 | setup_fdc_buffer( drive ); |
| 262 | ||
| 262 | ||
| 263 | 263 | if ( cur_pos < 2 ) |
| 264 | 264 | cur_pos = 2; |
| 265 | ||
| 265 | ||
| 266 | 266 | if ( fdc_status[drive].mfm[cur_pos-2] == ( ( sync >> 8 ) & 0xff ) && |
| 267 | 267 | fdc_status[drive].mfm[cur_pos-1] == ( sync & 0xff ) ) |
| 268 | 268 | { |
| 269 | 269 | amiga_custom_w(REG_INTREQ, 0x8000 | INTENA_DSKSYN, 0); |
| 270 | 270 | } |
| 271 | ||
| 271 | ||
| 272 | 272 | if ( sector < 10 ) |
| 273 | 273 | { |
| 274 | 274 | /* start the sync timer */ |
| r1461 | r1462 | |
| 278 | 278 | timer_adjust( fdc_status[drive].sync_timer, ATTOTIME_IN_USEC( time ), drive, attotime_zero ); |
| 279 | 279 | return; |
| 280 | 280 | } |
| 281 | ||
| 281 | ||
| 282 | 282 | bail: |
| 283 | 283 | timer_reset( fdc_status[drive].sync_timer, attotime_never ); |
| 284 | 284 | } |
| r1461 | r1462 | |
| 296 | 296 | /* if floppy got ejected, also stop */ |
| 297 | 297 | if ( fdc_status[drive].disk_changed ) |
| 298 | 298 | goto bail; |
| 299 | ||
| 299 | ||
| 300 | 300 | if ( fdc_status[drive].motor_on == 0 ) |
| 301 | 301 | goto bail; |
| 302 | 302 | |
| r1461 | r1462 | |
| 307 | 307 | if ( fdc_status[drive].len > 0 ) |
| 308 | 308 | { |
| 309 | 309 | logerror("Write to disk unsupported yet\n" ); |
| 310 | ||
| 310 | ||
| 311 | 311 | amiga_custom_w(REG_INTREQ, 0x8000 | INTENA_DSKBLK, 0); |
| 312 | 312 | } |
| 313 | 313 | } |
| r1461 | r1462 | |
| 316 | 316 | offs_t offset = fdc_status[drive].ptr; |
| 317 | 317 | int cur_pos = fdc_status[drive].pos; |
| 318 | 318 | int len = fdc_status[drive].len; |
| 319 | ||
| 319 | ||
| 320 | 320 | if ( len > MAX_WORDS_PER_DMA_CYCLE ) len = MAX_WORDS_PER_DMA_CYCLE; |
| 321 | ||
| 321 | ||
| 322 | 322 | fdc_status[drive].len -= len; |
| 323 | ||
| 323 | ||
| 324 | 324 | while ( len-- ) |
| 325 | 325 | { |
| 326 | 326 | int dat = ( fdc_status[drive].mfm[cur_pos++] ) << 8; |
| r1461 | r1462 | |
| 335 | 335 | |
| 336 | 336 | offset += 2; |
| 337 | 337 | } |
| 338 | ||
| 338 | ||
| 339 | 339 | fdc_status[drive].ptr = offset; |
| 340 | 340 | fdc_status[drive].pos = cur_pos; |
| 341 | ||
| 341 | ||
| 342 | 342 | if ( fdc_status[drive].len <= 0 ) |
| 343 | 343 | { |
| 344 | 344 | amiga_custom_w(REG_INTREQ, 0x8000 | INTENA_DSKBLK, 0); |
| r1461 | r1462 | |
| 348 | 348 | int time; |
| 349 | 349 | double len_words = fdc_status[drive].len; |
| 350 | 350 | if ( len_words > MAX_WORDS_PER_DMA_CYCLE ) len_words = MAX_WORDS_PER_DMA_CYCLE; |
| 351 | ||
| 351 | ||
| 352 | 352 | time = len_words * 2; |
| 353 | 353 | time *= ( CUSTOM_REG(REG_ADKCON) & 0x0100 ) ? 2 : 4; |
| 354 | 354 | time *= 8; |
| r1461 | r1462 | |
| 356 | 356 | return; |
| 357 | 357 | } |
| 358 | 358 | } |
| 359 | ||
| 359 | ||
| 360 | 360 | bail: |
| 361 | 361 | timer_reset( fdc_status[drive].dma_timer, attotime_never ); |
| 362 | 362 | } |
| r1461 | r1462 | |
| 375 | 375 | amiga_custom_w(REG_INTREQ, 0x8000 | INTENA_DSKBLK, 0); |
| 376 | 376 | return; |
| 377 | 377 | } |
| 378 | ||
| 378 | ||
| 379 | 379 | if ( ( CUSTOM_REG(REG_DSKLEN) & 0x8000 ) == 0 ) |
| 380 | 380 | goto bail; |
| 381 | 381 | |
| r1461 | r1462 | |
| 384 | 384 | |
| 385 | 385 | if ( fdc_status[drive].disk_changed ) |
| 386 | 386 | goto bail; |
| 387 | ||
| 387 | ||
| 388 | 388 | setup_fdc_buffer( drive ); |
| 389 | 389 | |
| 390 | 390 | fdc_status[drive].len = CUSTOM_REG(REG_DSKLEN) & 0x3fff; |
| 391 | 391 | fdc_status[drive].ptr = CUSTOM_REG_LONG(REG_DSKPTH); |
| 392 | 392 | fdc_status[drive].pos = cur_pos = fdc_get_curpos( drive ); |
| 393 | ||
| 393 | ||
| 394 | 394 | /* we'll do a set amount at a time */ |
| 395 | 395 | len_words = fdc_status[drive].len; |
| 396 | 396 | if ( len_words > MAX_WORDS_PER_DMA_CYCLE ) len_words = MAX_WORDS_PER_DMA_CYCLE; |
| r1461 | r1462 | |
| 419 | 419 | time += 2; |
| 420 | 420 | } |
| 421 | 421 | } |
| 422 | ||
| 422 | ||
| 423 | 423 | time += len_words * 2; |
| 424 | 424 | time *= ( CUSTOM_REG(REG_ADKCON) & 0x0100 ) ? 2 : 4; |
| 425 | 425 | time *= 8; |
| 426 | 426 | timer_adjust( fdc_status[drive].dma_timer, ATTOTIME_IN_USEC( time ), drive, attotime_zero ); |
| 427 | ||
| 427 | ||
| 428 | 428 | return; |
| 429 | ||
| 429 | ||
| 430 | 430 | bail: |
| 431 | 431 | timer_reset( fdc_status[drive].dma_timer, attotime_never ); |
| 432 | 432 | } |
| r1461 | r1462 | |
| 453 | 453 | #if 0 |
| 454 | 454 | popmessage("T:%d S:%d", fdc_status[drive].cyl, fdc_side ); |
| 455 | 455 | #endif |
| 456 | ||
| 456 | ||
| 457 | 457 | if ( fdc_status[drive].is_ext_image ) |
| 458 | 458 | { |
| 459 | 459 | len = fdc_status[drive].extinfo[offset] & 0xffff; |
| 460 | ||
| 460 | ||
| 461 | 461 | if ( len > ( MAX_MFM_TRACK_LEN - 2 ) ) |
| 462 | 462 | len = MAX_MFM_TRACK_LEN - 2; |
| 463 | ||
| 463 | ||
| 464 | 464 | if ( image_fseek( fdc_status[drive].f, fdc_status[drive].extoffs[offset], SEEK_SET ) ) |
| 465 | 465 | { |
| 466 | 466 | logerror("FDC: image_fseek failed!\n" ); |
| r1461 | r1462 | |
| 468 | 468 | fdc_status[drive].disk_changed = DISK_DETECT_DELAY; |
| 469 | 469 | return; |
| 470 | 470 | } |
| 471 | ||
| 471 | ||
| 472 | 472 | /* if SYNC is 0000, then its a regular amiga dos track image */ |
| 473 | 473 | if ( ( fdc_status[drive].extinfo[offset] >> 16 ) == 0x0000 ) |
| 474 | 474 | { |
| r1461 | r1462 | |
| 494 | 494 | fdc_status[drive].disk_changed = DISK_DETECT_DELAY; |
| 495 | 495 | return; |
| 496 | 496 | } |
| 497 | ||
| 497 | ||
| 498 | 498 | image_fread( fdc_status[drive].f, temp_cyl, len ); |
| 499 | 499 | } |
| 500 | 500 | |
| r1461 | r1462 | |
| 508 | 508 | UINT32 tmp; |
| 509 | 509 | UINT32 even, odd; |
| 510 | 510 | UINT32 hck = 0, dck = 0; |
| 511 | ||
| 511 | ||
| 512 | 512 | /* Preamble and sync */ |
| 513 | 513 | *(dest + 0) = 0xaa; |
| 514 | 514 | *(dest + 1) = 0xaa; |
| r1461 | r1462 | |
| 520 | 520 | *(dest + 7) = 0x89; |
| 521 | 521 | |
| 522 | 522 | /* Track and sector info */ |
| 523 | ||
| 523 | ||
| 524 | 524 | tmp = 0xff000000 | (offset<<16) | (sector<<8) | (11 - sector); |
| 525 | 525 | odd = (tmp & 0x55555555) | 0xaaaaaaaa; |
| 526 | 526 | even = ( ( tmp >> 1 ) & 0x55555555 ) | 0xaaaaaaaa; |
| r1461 | r1462 | |
| 555 | 555 | hck ^= (((UINT32) *(dest + x))<<24) | (((UINT32) *(dest + x + 1))<<16) | |
| 556 | 556 | (((UINT32) *(dest + x + 2))<<8) | ((UINT32) *(dest + x + 3)); |
| 557 | 557 | |
| 558 | even = odd = hck; | |
| 558 | even = odd = hck; | |
| 559 | 559 | odd >>= 1; |
| 560 | 560 | even |= 0xaaaaaaaa; |
| 561 | 561 | odd |= 0xaaaaaaaa; |
| 562 | ||
| 562 | ||
| 563 | 563 | *(dest + 48) = (UINT8) ((odd & 0xff000000)>>24); |
| 564 | 564 | *(dest + 49) = (UINT8) ((odd & 0xff0000)>>16); |
| 565 | 565 | *(dest + 50) = (UINT8) ((odd & 0xff00)>>8); |
| r1461 | r1462 | |
| 601 | 601 | |
| 602 | 602 | timer_adjust(fdc_status[drive].rev_timer, ATTOTIME_IN_MSEC( ONE_REV_TIME ), drive, attotime_zero); |
| 603 | 603 | fdc_status[drive].rev_timer_started = 1; |
| 604 | ||
| 604 | ||
| 605 | 605 | if ( fdc_status[drive].is_ext_image == 0 ) |
| 606 | 606 | { |
| 607 | 607 | /* also start the sync timer */ |
| r1461 | r1462 | |
| 637 | 637 | } |
| 638 | 638 | |
| 639 | 639 | static void fdc_setup_leds( int drive ) { |
| 640 | ||
| 640 | ||
| 641 | 641 | char portname[12]; |
| 642 | 642 | sprintf(portname, "drive_%d_led", drive); |
| 643 | 643 | output_set_value(portname, fdc_status[drive].motor_on == 0 ? 0 : 1); |
| 644 | ||
| 644 | ||
| 645 | 645 | if ( drive == 0 ) |
| 646 | 646 | set_led_status( 1, fdc_status[drive].motor_on ); /* update internal drive led */ |
| 647 | 647 | |
| r1461 | r1462 | |
| 657 | 657 | if ( fdc_status[drive].cyl < 79 ) |
| 658 | 658 | fdc_status[drive].cyl++; |
| 659 | 659 | } |
| 660 | ||
| 660 | ||
| 661 | 661 | /* Update disk detection if applicable */ |
| 662 | 662 | if ( fdc_status[drive].f != NULL ) |
| 663 | 663 | { |
| r1461 | r1462 | |
| 685 | 685 | void amiga_fdc_control_w( UINT8 data ) { |
| 686 | 686 | int step_pulse; |
| 687 | 687 | int drive; |
| 688 | ||
| 688 | ||
| 689 | 689 | if ( fdc_sel != ( ( data >> 3 ) & 15 ) ) |
| 690 | 690 | fdc_rdy = 0; |
| 691 | 691 | |
| r1461 | r1462 | |
| 719 | 719 | |
| 720 | 720 | for ( drive = 0; drive < NUM_DRIVES; drive++ ) { |
| 721 | 721 | if ( !( fdc_sel & ( 1 << drive ) ) ) { |
| 722 | ||
| 722 | ||
| 723 | 723 | if ( fdc_status[drive].motor_on ) { |
| 724 | 724 | if ( fdc_rdy ) ret &= ~0x20; |
| 725 | 725 | fdc_rdy = 1; |
| r1461 | r1462 | |
|---|---|---|
| 539 | 539 | int ch = param & 1; |
| 540 | 540 | UINT8 old; |
| 541 | 541 | char linename[4]; |
| 542 | ||
| 542 | ||
| 543 | 543 | switch (line) |
| 544 | 544 | { |
| 545 | 545 | case DART_RR0_CTS: |
| r1461 | r1462 | |
|---|---|---|
| 21 | 21 | static void kbd_sendscancode( UINT8 scancode ) |
| 22 | 22 | { |
| 23 | 23 | int j; |
| 24 | ||
| 24 | ||
| 25 | 25 | /* send over to the cia A */ |
| 26 | 26 | for( j = 0; j < 8; j++ ) |
| 27 | 27 | { |
| r1461 | r1462 | |
| 34 | 34 | static TIMER_CALLBACK( kbd_update_callback ) |
| 35 | 35 | { |
| 36 | 36 | UINT8 scancode; |
| 37 | ||
| 37 | ||
| 38 | 38 | (void)param; |
| 39 | ||
| 39 | ||
| 40 | 40 | /* if we don't have pending data, bail */ |
| 41 | 41 | if ( key_buf_pos == key_cur_pos ) |
| 42 | 42 | return; |
| 43 | ||
| 43 | ||
| 44 | 44 | /* fetch the next scan code and send it to the Amiga */ |
| 45 | 45 | scancode = key_buf[key_cur_pos++]; |
| 46 | 46 | key_cur_pos %= KEYBOARD_BUFFER_SIZE; |
| 47 | 47 | kbd_sendscancode( scancode ); |
| 48 | ||
| 48 | ||
| 49 | 49 | /* if we still have more data, schedule another update */ |
| 50 | 50 | if ( key_buf_pos != key_cur_pos ) |
| 51 | 51 | { |
| r1461 | r1462 | |
| 62 | 62 | if ( (index == 3) && ( delta & 0x80000000 ) && ( newvalue & 0x80000000 ) ) |
| 63 | 63 | { |
| 64 | 64 | const amiga_machine_interface *amiga_intf = amiga_get_interface(); |
| 65 | ||
| 65 | ||
| 66 | 66 | if ( amiga_intf != NULL && amiga_intf->nmi_callback ) |
| 67 | 67 | { |
| 68 | 68 | (*amiga_intf->nmi_callback)(); |
| r1461 | r1462 | |
| 71 | 71 | else |
| 72 | 72 | { |
| 73 | 73 | int key_buf_was_empty = ( key_buf_pos == key_cur_pos ) ? 1 : 0; |
| 74 | ||
| 74 | ||
| 75 | 75 | for( i = 0; i < 32; i++ ) |
| 76 | 76 | { |
| 77 | 77 | if ( delta & ( 1 << i ) ) |
| r1461 | r1462 | |
| 79 | 79 | int down = ( newvalue & ( 1 << i ) ) ? 0 : 1; |
| 80 | 80 | int scancode = ( ( (index*32)+i ) << 1 ) | down; |
| 81 | 81 | int amigacode = ~scancode; |
| 82 | ||
| 83 | /* add the keycode to the buffer */ | |
| 82 | ||
| 83 | /* add the keycode to the buffer */ | |
| 84 | 84 | key_buf[key_buf_pos++] = amigacode & 0xff; |
| 85 | 85 | key_buf_pos %= KEYBOARD_BUFFER_SIZE; |
| 86 | 86 | } |
| 87 | 87 | } |
| 88 | ||
| 88 | ||
| 89 | 89 | /* if the buffer was empty and we have new data, start a timer to send the keystrokes */ |
| 90 | 90 | if ( key_buf_was_empty && ( key_buf_pos != key_cur_pos ) ) |
| 91 | 91 | { |
| r1461 | r1462 | |
| 107 | 107 | |
| 108 | 108 | input_port_set_changed_callback( port_tag_to_index( buf ), 0xFFFFFFFF, kbd_update, &kbd_index[i] ); |
| 109 | 109 | } |
| 110 | ||
| 110 | ||
| 111 | 111 | /* allocate a keyboard buffer */ |
| 112 | 112 | key_buf = auto_malloc( KEYBOARD_BUFFER_SIZE ); |
| 113 | 113 | key_buf_pos = 0; |
| r1461 | r1462 | |
| 254 | 254 | PORT_BIT( 0x20000000, 0x0000, IPT_UNUSED) // 7D |
| 255 | 255 | PORT_BIT( 0x40000000, 0x0000, IPT_UNUSED) // 7E |
| 256 | 256 | PORT_BIT( 0x80000000, 0x0000, IPT_KEYBOARD) PORT_CODE(KEYCODE_PGUP) // 7F NMI button |
| 257 | ||
| 257 | ||
| 258 | 258 | INPUT_PORTS_END |
| r1461 | r1462 | |
|---|---|---|
| 249 | 249 | for (cpunum = 0; cpunum < 2; cpunum++) |
| 250 | 250 | { |
| 251 | 251 | interrupt = bebox_interrupts & bebox_cpu_imask[cpunum]; |
| 252 | ||
| 252 | ||
| 253 | 253 | if (LOG_INTERRUPTS) |
| 254 | 254 | { |
| 255 | 255 | logerror("\tbebox_update_interrupts(): CPU #%d [%08X|%08X] IRQ %s\n", cpunum, |
| r1461 | r1462 | |
| 450 | 450 | result &= ~(0xFF << 8); |
| 451 | 451 | result |= ide_controller_0_r(0x3F6) << 8; |
| 452 | 452 | } |
| 453 | ||
| 453 | ||
| 454 | 454 | if (((mem_mask >> 0) & 0xFF) == 0) |
| 455 | 455 | { |
| 456 | 456 | result &= ~(0xFF << 0); |
| r1461 | r1462 | |
| 466 | 466 | |
| 467 | 467 | if (((mem_mask >> 8) & 0xFF) == 0) |
| 468 | 468 | ide_controller_0_w(0x3F6, (data >> 8) & 0xFF); |
| 469 | ||
| 469 | ||
| 470 | 470 | if (((mem_mask >> 0) & 0xFF) == 0) |
| 471 | 471 | ide_controller_0_w(0x3F7, (data >> 0) & 0xFF); |
| 472 | 472 | } |
| r1461 | r1462 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | 3 | Matsushita/Panasonic CDR521/522 type CDROM drive emulation |
| 4 | ||
| 4 | ||
| 5 | 5 | Notes: |
| 6 | 6 | This version implements the drive found in Amiga CDTV. There are |
| 7 | 7 | different drives supporting this command-set (look in the sbpcd driver |
| r1461 | r1462 | |
| 64 | 64 | void matsucd_init( void ) |
| 65 | 65 | { |
| 66 | 66 | memset(&cd, 0, sizeof( matsucd ) ); |
| 67 | ||
| 67 | ||
| 68 | 68 | cd.cdrom = mess_cd_get_cdrom_file_by_number(0); |
| 69 | ||
| 69 | ||
| 70 | 70 | cd.frame_timer = timer_alloc(matsu_subcode_proc, NULL); |
| 71 | ||
| 71 | ||
| 72 | 72 | cd.stch_signal = 1; |
| 73 | 73 | } |
| 74 | 74 | |
| r1461 | r1462 | |
| 98 | 98 | case 2324: return CD_TRACK_MODE2_FORM2; break; |
| 99 | 99 | case 2336: return CD_TRACK_MODE2; break; |
| 100 | 100 | case 2352: return CD_TRACK_MODE2_RAW; break; |
| 101 | ||
| 101 | ||
| 102 | 102 | default: logerror( "MATSUCD: Sector size %d unsupported!\n", cd.sector_size ); break; |
| 103 | 103 | } |
| 104 | ||
| 104 | ||
| 105 | 105 | return CD_TRACK_RAW_DONTCARE; |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | void matsucd_read_next_block( void ) |
| 109 | 109 | { |
| 110 | 110 | cd.xfer_offset = 0; |
| 111 | ||
| 111 | ||
| 112 | 112 | if ( cd.num_blocks ) |
| 113 | 113 | { |
| 114 | 114 | cd.lba++; |
| 115 | 115 | cd.num_blocks--; |
| 116 | ||
| 116 | ||
| 117 | 117 | if (!cdrom_read_data(cd.cdrom, cd.lba, cd.sector_buffer, matsucd_getsector_type())) |
| 118 | 118 | { |
| 119 | 119 | logerror( "MATSUCD - Warning: Read error on CD!\n" ); |
| r1461 | r1462 | |
| 126 | 126 | /* no more data to read on this sector */ |
| 127 | 127 | if ( cd.xfer_offset >= cd.sector_size ) |
| 128 | 128 | return -1; |
| 129 | ||
| 129 | ||
| 130 | 130 | if ( data ) |
| 131 | 131 | *data = cd.sector_buffer[cd.xfer_offset++]; |
| 132 | ||
| 133 | return 0; | |
| 132 | ||
| 133 | return 0; | |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | static void matsucd_cdda_stop( void ) |
| 137 | 137 | { |
| 138 | 138 | int cddanum = cdda_num_from_cdrom(cd.cdrom); |
| 139 | ||
| 139 | ||
| 140 | 140 | if (cddanum != -1) |
| 141 | 141 | { |
| 142 | 142 | cdda_stop_audio(cddanum); |
| r1461 | r1462 | |
| 160 | 160 | if (cddanum != -1) |
| 161 | 161 | { |
| 162 | 162 | cdda_pause_audio(cddanum, pause); |
| 163 | ||
| 163 | ||
| 164 | 164 | if ( pause ) |
| 165 | 165 | { |
| 166 | 166 | timer_reset( cd.frame_timer, attotime_never ); |
| r1461 | r1462 | |
| 175 | 175 | static UINT8 matsucd_cdda_getstatus( UINT32 *lba ) |
| 176 | 176 | { |
| 177 | 177 | int cddanum = cdda_num_from_cdrom(cd.cdrom); |
| 178 | ||
| 178 | ||
| 179 | 179 | if ( lba ) *lba = 0; |
| 180 | ||
| 180 | ||
| 181 | 181 | if (cddanum != -1) |
| 182 | 182 | { |
| 183 | 183 | if (cdda_audio_active(cddanum)) |
| 184 | 184 | { |
| 185 | 185 | if ( lba ) *lba = cdda_get_audio_lba(cddanum); |
| 186 | ||
| 186 | ||
| 187 | 187 | if (cdda_audio_paused(cddanum)) |
| 188 | 188 | { |
| 189 | 189 | return 0x12; /* audio paused */ |
| r1461 | r1462 | |
| 198 | 198 | return 0x13; /* audio ended */ |
| 199 | 199 | } |
| 200 | 200 | } |
| 201 | ||
| 201 | ||
| 202 | 202 | return 0x15; /* no audio status */ |
| 203 | 203 | } |
| 204 | 204 | |
| r1461 | r1462 | |
| 230 | 230 | static void update_status_enable( int level ) |
| 231 | 231 | { |
| 232 | 232 | cd.sten_signal = level; |
| 233 | ||
| 233 | ||
| 234 | 234 | if ( cd.sten_cb ) |
| 235 | 235 | { |
| 236 | 236 | (*cd.sten_cb)(cd.sten_signal); |
| r1461 | r1462 | |
| 240 | 240 | static void update_status_changed( int level ) |
| 241 | 241 | { |
| 242 | 242 | cd.stch_signal = level; |
| 243 | ||
| 243 | ||
| 244 | 244 | if ( cd.stch_cb ) |
| 245 | 245 | { |
| 246 | 246 | (*cd.stch_cb)(cd.stch_signal); |
| r1461 | r1462 | |
| 250 | 250 | static void update_subcode_ready( int level ) |
| 251 | 251 | { |
| 252 | 252 | cd.scor_signal = level; |
| 253 | ||
| 253 | ||
| 254 | 254 | if ( cd.scor_cb ) |
| 255 | 255 | { |
| 256 | 256 | (*cd.scor_cb)(cd.scor_signal); |
| r1461 | r1462 | |
| 267 | 267 | if ( status != cd.status ) |
| 268 | 268 | { |
| 269 | 269 | cd.status = status; |
| 270 | ||
| 270 | ||
| 271 | 271 | if ( cd.stch_signal != 0 ) |
| 272 | 272 | { |
| 273 | 273 | update_status_changed( 0 ); |
| r1461 | r1462 | |
| 279 | 279 | static TIMER_CALLBACK(matsu_subcode_proc) |
| 280 | 280 | { |
| 281 | 281 | int cddanum = cdda_num_from_cdrom(cd.cdrom); |
| 282 | ||
| 282 | ||
| 283 | 283 | (void)param; |
| 284 | ||
| 284 | ||
| 285 | 285 | if (cddanum != -1) |
| 286 | 286 | { |
| 287 | 287 | UINT8 s = matsucd_cdda_getstatus(NULL); |
| 288 | 288 | UINT8 newstatus = cd.status; |
| 289 | ||
| 289 | ||
| 290 | 290 | if ( s == 0x11 || s == 0x12 ) |
| 291 | 291 | { |
| 292 | 292 | if ( s == 0x11 ) |
| r1461 | r1462 | |
| 294 | 294 | update_subcode_ready( 1 ); |
| 295 | 295 | update_subcode_ready( 0 ); |
| 296 | 296 | } |
| 297 | ||
| 297 | ||
| 298 | 298 | newstatus |= MATSU_STATUS_PLAYING; |
| 299 | ||
| 299 | ||
| 300 | 300 | timer_adjust( cd.frame_timer, ATTOTIME_IN_HZ( 75 ), 0, attotime_zero ); |
| 301 | 301 | } |
| 302 | 302 | else |
| 303 | 303 | { |
| 304 | 304 | newstatus &= ~MATSU_STATUS_PLAYING; |
| 305 | 305 | } |
| 306 | ||
| 306 | ||
| 307 | 307 | matsucd_set_status( newstatus ); |
| 308 | 308 | } |
| 309 | 309 | } |
| r1461 | r1462 | |
| 311 | 311 | static void matsucd_command_error( void ) |
| 312 | 312 | { |
| 313 | 313 | UINT8 newstatus = cd.status; |
| 314 | ||
| 314 | ||
| 315 | 315 | newstatus &= ~MATSU_STATUS_SUCCESS; |
| 316 | 316 | newstatus |= MATSU_STATUS_ERROR; |
| 317 | ||
| 317 | ||
| 318 | 318 | matsucd_set_status( newstatus ); |
| 319 | 319 | } |
| 320 | 320 | |
| 321 | 321 | static void matsucd_complete_cmd( UINT8 len ) |
| 322 | 322 | { |
| 323 | 323 | UINT8 newstatus = cd.status; |
| 324 | ||
| 324 | ||
| 325 | 325 | cd.input_pos = 0; |
| 326 | 326 | cd.output_pos = 0; |
| 327 | 327 | cd.output_len = len; |
| 328 | ||
| 328 | ||
| 329 | 329 | newstatus &= ~MATSU_STATUS_ERROR; |
| 330 | 330 | newstatus |= MATSU_STATUS_SUCCESS; |
| 331 | ||
| 331 | ||
| 332 | 332 | matsucd_set_status( newstatus ); |
| 333 | ||
| 333 | ||
| 334 | 334 | update_status_enable( 1 ); |
| 335 | 335 | update_status_enable( 0 ); |
| 336 | 336 | } |
| r1461 | r1462 | |
| 338 | 338 | UINT8 matsucd_response_r( void ) |
| 339 | 339 | { |
| 340 | 340 | UINT8 v = cd.output[cd.output_pos++]; |
| 341 | ||
| 341 | ||
| 342 | 342 | if ( cd.output_pos < cd.output_len ) |
| 343 | 343 | { |
| 344 | 344 | update_status_enable( 1 ); |
| 345 | 345 | update_status_enable( 0 ); |
| 346 | 346 | } |
| 347 | ||
| 347 | ||
| 348 | 348 | return v; |
| 349 | 349 | } |
| 350 | 350 | |
| 351 | 351 | void matsucd_command_w( UINT8 data ) |
| 352 | 352 | { |
| 353 | 353 | UINT8 cmd; |
| 354 | ||
| 354 | ||
| 355 | 355 | /* make sure we're enabled */ |
| 356 | 356 | if ( cd.enabled == 0 ) |
| 357 | 357 | return; |
| 358 | ||
| 358 | ||
| 359 | 359 | /* make sure /CMD is asserted */ |
| 360 | 360 | if ( cd.cmd_signal == 0 ) |
| 361 | 361 | return; |
| 362 | ||
| 362 | ||
| 363 | 363 | if ( cd.cdda_set == 0 ) |
| 364 | 364 | { |
| 365 | 365 | if ( cd.cdrom ) |
| 366 | 366 | cdda_set_cdrom(0, cd.cdrom); |
| 367 | ||
| 367 | ||
| 368 | 368 | cd.cdda_set = 1; |
| 369 | 369 | } |
| 370 | ||
| 370 | ||
| 371 | 371 | cd.input[cd.input_pos++] = data; |
| 372 | 372 | |
| 373 | 373 | cmd = cd.input[0]; |
| 374 | ||
| 374 | ||
| 375 | 375 | switch( cmd ) |
| 376 | 376 | { |
| 377 | 377 | case 0x01: /* seek */ |
| 378 | 378 | { |
| 379 | 379 | if ( cd.input_pos < 7 ) |
| 380 | 380 | return; |
| 381 | ||
| 381 | ||
| 382 | 382 | /* stop CDDA audio if necessary */ |
| 383 | 383 | matsucd_cdda_stop(); |
| 384 | ||
| 384 | ||
| 385 | 385 | cd.motor = 1; |
| 386 | ||
| 386 | ||
| 387 | 387 | memset( cd.output, 0, 6 ); |
| 388 | 388 | matsucd_complete_cmd( 0 ); |
| 389 | 389 | } |
| 390 | 390 | break; |
| 391 | ||
| 391 | ||
| 392 | 392 | case 0x02: /* read sectors */ |
| 393 | 393 | { |
| 394 | 394 | if ( cd.input_pos < 7 ) |
| 395 | 395 | return; |
| 396 | ||
| 396 | ||
| 397 | 397 | /* stop CDDA audio if necessary */ |
| 398 | 398 | matsucd_cdda_stop(); |
| 399 | ||
| 399 | ||
| 400 | 400 | /* LBA */ |
| 401 | 401 | cd.lba = cd.input[1]; |
| 402 | 402 | cd.lba <<= 8; |
| 403 | 403 | cd.lba |= cd.input[2]; |
| 404 | 404 | cd.lba <<= 8; |
| 405 | 405 | cd.lba |= cd.input[3]; |
| 406 | ||
| 406 | ||
| 407 | 407 | /* Number of blocks */ |
| 408 | 408 | cd.num_blocks = cd.input[4]; |
| 409 | 409 | cd.num_blocks <<= 8; |
| 410 | 410 | cd.num_blocks |= cd.input[5]; |
| 411 | ||
| 411 | ||
| 412 | 412 | /* Reset transfer count */ |
| 413 | 413 | cd.xfer_offset = 0; |
| 414 | ||
| 414 | ||
| 415 | 415 | /* go ahead and cache the first block */ |
| 416 | 416 | if (!cdrom_read_data(cd.cdrom, cd.lba, cd.sector_buffer, matsucd_getsector_type())) |
| 417 | 417 | { |
| r1461 | r1462 | |
| 419 | 419 | matsucd_command_error(); |
| 420 | 420 | return; |
| 421 | 421 | } |
| 422 | ||
| 422 | ||
| 423 | 423 | cd.motor = 1; |
| 424 | ||
| 424 | ||
| 425 | 425 | memset( cd.output, 0, 6 ); |
| 426 | 426 | matsucd_complete_cmd( 0 ); |
| 427 | 427 | } |
| 428 | 428 | break; |
| 429 | ||
| 429 | ||
| 430 | 430 | case 0x04: /* motor on */ |
| 431 | 431 | { |
| 432 | 432 | if ( cd.input_pos < 7 ) |
| 433 | 433 | return; |
| 434 | ||
| 434 | ||
| 435 | 435 | cd.motor = 1; |
| 436 | ||
| 436 | ||
| 437 | 437 | memset( cd.output, 0, 6 ); |
| 438 | 438 | matsucd_complete_cmd( 0 ); |
| 439 | 439 | } |
| 440 | 440 | break; |
| 441 | ||
| 441 | ||
| 442 | 442 | case 0x05: /* motor off */ |
| 443 | 443 | { |
| 444 | 444 | if ( cd.input_pos < 7 ) |
| 445 | 445 | return; |
| 446 | ||
| 446 | ||
| 447 | 447 | /* stop CDDA audio if necessary */ |
| 448 | 448 | matsucd_cdda_stop(); |
| 449 | ||
| 449 | ||
| 450 | 450 | cd.motor = 0; |
| 451 | ||
| 451 | ||
| 452 | 452 | memset( cd.output, 0, 6 ); |
| 453 | 453 | matsucd_complete_cmd( 0 ); |
| 454 | 454 | } |
| 455 | 455 | break; |
| 456 | ||
| 456 | ||
| 457 | 457 | case 0x09: /* play audio cd, LBA mode */ |
| 458 | 458 | { |
| 459 | 459 | UINT32 lba, numblocks; |
| 460 | ||
| 460 | ||
| 461 | 461 | if ( cd.input_pos < 7 ) |
| 462 | 462 | return; |
| 463 | ||
| 463 | ||
| 464 | 464 | lba = cd.input[1]; |
| 465 | 465 | lba <<= 8; |
| 466 | 466 | lba |= cd.input[2]; |
| 467 | 467 | lba <<= 8; |
| 468 | 468 | lba |= cd.input[3]; |
| 469 | ||
| 469 | ||
| 470 | 470 | numblocks = cd.input[4]; |
| 471 | 471 | numblocks <<= 8; |
| 472 | 472 | numblocks |= cd.input[5]; |
| 473 | 473 | numblocks <<= 8; |
| 474 | 474 | numblocks |= cd.input[6]; |
| 475 | ||
| 475 | ||
| 476 | 476 | matsucd_cdda_play( lba, numblocks ); |
| 477 | ||
| 477 | ||
| 478 | 478 | cd.motor = 1; |
| 479 | ||
| 479 | ||
| 480 | 480 | memset( cd.output, 0, 6 ); |
| 481 | 481 | matsucd_complete_cmd( 0 ); |
| 482 | 482 | } |
| 483 | 483 | break; |
| 484 | ||
| 484 | ||
| 485 | 485 | case 0x0a: /* play audio cd, MSF mode */ |
| 486 | 486 | { |
| 487 | 487 | UINT32 start, end, lba_start, lba_end; |
| 488 | ||
| 488 | ||
| 489 | 489 | if ( cd.input_pos < 7 ) |
| 490 | 490 | return; |
| 491 | ||
| 491 | ||
| 492 | 492 | start = cd.input[1]; |
| 493 | 493 | start <<= 8; |
| 494 | 494 | start |= cd.input[2]; |
| 495 | 495 | start <<= 8; |
| 496 | 496 | start |= cd.input[3]; |
| 497 | ||
| 497 | ||
| 498 | 498 | end = cd.input[4]; |
| 499 | 499 | end <<= 8; |
| 500 | 500 | end |= cd.input[5]; |
| 501 | 501 | end <<= 8; |
| 502 | 502 | end |= cd.input[6]; |
| 503 | ||
| 503 | ||
| 504 | 504 | lba_start = MSF2LBA( start ); |
| 505 | 505 | lba_end = MSF2LBA( end ); |
| 506 | ||
| 506 | ||
| 507 | 507 | if ( end == 0xffffff ) |
| 508 | 508 | { |
| 509 | 509 | lba_end = cdrom_get_track_start(cd.cdrom,cdrom_get_last_track(cd.cdrom)-1); |
| 510 | 510 | lba_end += cdrom_get_toc(cd.cdrom)->tracks[cdrom_get_last_track(cd.cdrom)-1].frames; |
| 511 | 511 | } |
| 512 | ||
| 512 | ||
| 513 | 513 | if ( lba_end <= lba_start ) |
| 514 | 514 | { |
| 515 | 515 | matsucd_cdda_stop(); |
| r1461 | r1462 | |
| 519 | 519 | matsucd_cdda_play( lba_start, lba_end - lba_start ); |
| 520 | 520 | cd.motor = 1; |
| 521 | 521 | } |
| 522 | ||
| 522 | ||
| 523 | 523 | memset( cd.output, 0, 6 ); |
| 524 | 524 | matsucd_complete_cmd( 0 ); |
| 525 | 525 | } |
| 526 | 526 | break; |
| 527 | ||
| 527 | ||
| 528 | 528 | case 0x0b: /* play audio track and index */ |
| 529 | 529 | { |
| 530 | 530 | UINT8 track_start = cd.input[1]; |
| r1461 | r1462 | |
| 532 | 532 | UINT8 track_end = cd.input[3]; |
| 533 | 533 | UINT8 index_end = cd.input[4]; |
| 534 | 534 | UINT32 lba_start, lba_end; |
| 535 | ||
| 535 | ||
| 536 | 536 | /* TODO: Add index support once the CDDA engine supports it */ |
| 537 | 537 | (void)index_start; |
| 538 | 538 | (void)index_end; |
| 539 | ||
| 539 | ||
| 540 | 540 | /* sanitize values */ |
| 541 | 541 | if ( track_start == 0 ) track_start++; |
| 542 | 542 | if ( track_end > cdrom_get_last_track(cd.cdrom) ) |
| r1461 | r1462 | |
| 545 | 545 | /* find the start and stop positions */ |
| 546 | 546 | lba_start = cdrom_get_track_start(cd.cdrom,track_start-1); |
| 547 | 547 | lba_end = cdrom_get_track_start(cd.cdrom,track_end-1); |
| 548 | ||
| 548 | ||
| 549 | 549 | lba_end += cdrom_get_toc(cd.cdrom)->tracks[track_end-1].frames; |
| 550 | ||
| 550 | ||
| 551 | 551 | if ( lba_end <= lba_start ) |
| 552 | 552 | { |
| 553 | 553 | matsucd_cdda_stop(); |
| r1461 | r1462 | |
| 557 | 557 | matsucd_cdda_play( lba_start, lba_end - lba_start ); |
| 558 | 558 | cd.motor = 1; |
| 559 | 559 | } |
| 560 | ||
| 560 | ||
| 561 | 561 | memset( cd.output, 0, 6 ); |
| 562 | 562 | matsucd_complete_cmd( 0 ); |
| 563 | 563 | } |
| 564 | 564 | break; |
| 565 | ||
| 565 | ||
| 566 | 566 | case 0x81: /* status read */ |
| 567 | 567 | { |
| 568 | 568 | UINT8 newstatus = cd.status; |
| 569 | ||
| 569 | ||
| 570 | 570 | newstatus &= MATSU_STATUS_SUCCESS | MATSU_STATUS_ERROR | MATSU_STATUS_PLAYING; |
| 571 | 571 | newstatus |= MATSU_STATUS_READY; |
| 572 | ||
| 572 | ||
| 573 | 573 | if (cd.cdrom) |
| 574 | 574 | { |
| 575 | 575 | newstatus |= MATSU_STATUS_MEDIA; |
| 576 | 576 | } |
| 577 | ||
| 577 | ||
| 578 | 578 | if (cd.motor) |
| 579 | 579 | newstatus |= MATSU_STATUS_MOTOR; |
| 580 | ||
| 580 | ||
| 581 | 581 | cd.output[0] = newstatus; |
| 582 | ||
| 582 | ||
| 583 | 583 | matsucd_set_status( newstatus ); |
| 584 | ||
| 584 | ||
| 585 | 585 | matsucd_complete_cmd( 1 ); |
| 586 | 586 | } |
| 587 | 587 | break; |
| 588 | ||
| 588 | ||
| 589 | 589 | case 0x82: /* error read */ |
| 590 | 590 | { |
| 591 | 591 | if ( cd.input_pos < 7 ) |
| 592 | 592 | return; |
| 593 | ||
| 593 | ||
| 594 | 594 | memset( cd.output, 0, 6 ); |
| 595 | 595 | matsucd_complete_cmd( 6 ); |
| 596 | 596 | } |
| 597 | 597 | break; |
| 598 | ||
| 598 | ||
| 599 | 599 | case 0x84: /* set mode */ |
| 600 | 600 | { |
| 601 | 601 | if ( cd.input_pos < 7 ) |
| 602 | 602 | return; |
| 603 | ||
| 603 | ||
| 604 | 604 | cd.sector_size = cd.input[2]; |
| 605 | 605 | cd.sector_size <<= 8; |
| 606 | 606 | cd.sector_size |= cd.input[3]; |
| 607 | ||
| 607 | ||
| 608 | 608 | memset( cd.output, 0, 6 ); |
| 609 | 609 | matsucd_complete_cmd( 0 ); |
| 610 | 610 | } |
| 611 | 611 | break; |
| 612 | ||
| 612 | ||
| 613 | 613 | case 0x87: /* read SUBQ */ |
| 614 | 614 | { |
| 615 | 615 | int msfmode; |
| 616 | 616 | UINT32 lba; |
| 617 | 617 | UINT8 track; |
| 618 | ||
| 618 | ||
| 619 | 619 | if ( cd.input_pos < 7 ) |
| 620 | 620 | return; |
| 621 | ||
| 621 | ||
| 622 | 622 | msfmode = (cd.input[1] & 0x02) ? 1 : 0; |
| 623 | ||
| 623 | ||
| 624 | 624 | memset( cd.output, 0, 13 ); |
| 625 | ||
| 625 | ||
| 626 | 626 | cd.output[0] = matsucd_cdda_getstatus( &lba ); |
| 627 | ||
| 627 | ||
| 628 | 628 | if ( lba > 0 ) |
| 629 | 629 | { |
| 630 | 630 | UINT32 disk_pos; |
| 631 | 631 | UINT32 track_pos; |
| 632 | ||
| 632 | ||
| 633 | 633 | track = cdrom_get_track(cd.cdrom, lba); |
| 634 | ||
| 634 | ||
| 635 | 635 | cd.output[1] = cdrom_get_adr_control(cd.cdrom, track); |
| 636 | 636 | cd.output[2] = track+1; |
| 637 | 637 | cd.output[3] = 0; /* index */ |
| 638 | ||
| 638 | ||
| 639 | 639 | disk_pos = lba; |
| 640 | 640 | if ( msfmode ) disk_pos = LBA2MSF(disk_pos); |
| 641 | ||
| 641 | ||
| 642 | 642 | cd.output[4] = (disk_pos >> 24) & 0xff; |
| 643 | 643 | cd.output[5] = (disk_pos >> 16) & 0xff; |
| 644 | 644 | cd.output[6] = (disk_pos >> 8) & 0xff; |
| 645 | 645 | cd.output[7] = (disk_pos) & 0xff; |
| 646 | ||
| 646 | ||
| 647 | 647 | track_pos = lba - cdrom_get_track_start(cd.cdrom, track); |
| 648 | 648 | if ( msfmode ) track_pos = LBA2MSF(track_pos); |
| 649 | ||
| 649 | ||
| 650 | 650 | cd.output[8] = (track_pos >> 24) & 0xff; |
| 651 | 651 | cd.output[9] = (track_pos >> 16) & 0xff; |
| 652 | 652 | cd.output[10] = (track_pos >> 8) & 0xff; |
| 653 | 653 | cd.output[11] = (track_pos) & 0xff; |
| 654 | ||
| 654 | ||
| 655 | 655 | /* TODO: UPC flag at offset 12 */ |
| 656 | 656 | cd.output[12] = 0; |
| 657 | 657 | } |
| 658 | ||
| 658 | ||
| 659 | 659 | matsucd_complete_cmd( 13 ); |
| 660 | 660 | } |
| 661 | 661 | break; |
| 662 | ||
| 662 | ||
| 663 | 663 | case 0x89: /* read disk info */ |
| 664 | 664 | { |
| 665 | 665 | UINT32 end; |
| 666 | ||
| 666 | ||
| 667 | 667 | if ( cd.input_pos < 7 ) |
| 668 | 668 | return; |
| 669 | ||
| 669 | ||
| 670 | 670 | memset( cd.output, 0, 5 ); |
| 671 | ||
| 671 | ||
| 672 | 672 | cd.output[0] = cdrom_get_last_track(cd.cdrom) ? 1 : 0; |
| 673 | 673 | cd.output[1] = cdrom_get_last_track(cd.cdrom); |
| 674 | 674 | end = cdrom_get_track_start(cd.cdrom,cd.output[1]-1); |
| r1461 | r1462 | |
| 677 | 677 | cd.output[2] = (end >> 16) & 0xff; |
| 678 | 678 | cd.output[3] = (end >> 8) & 0xff; |
| 679 | 679 | cd.output[4] = (end) & 0xff; |
| 680 | ||
| 680 | ||
| 681 | 681 | matsucd_complete_cmd( 5 ); |
| 682 | 682 | } |
| 683 | 683 | break; |
| 684 | ||
| 684 | ||
| 685 | 685 | case 0x8a: /* read toc */ |
| 686 | 686 | { |
| 687 | 687 | UINT8 track; |
| 688 | 688 | int msfmode; |
| 689 | 689 | UINT32 track_start; |
| 690 | ||
| 690 | ||
| 691 | 691 | if ( cd.input_pos < 7 ) |
| 692 | 692 | return; |
| 693 | ||
| 693 | ||
| 694 | 694 | /* stop CDDA audio if necessary */ |
| 695 | 695 | matsucd_cdda_stop(); |
| 696 | ||
| 696 | ||
| 697 | 697 | track = cd.input[2]; |
| 698 | 698 | msfmode = (cd.input[1] & 0x02) ? 1 : 0; |
| 699 | ||
| 699 | ||
| 700 | 700 | if ( cd.cdrom == NULL ) |
| 701 | 701 | { |
| 702 | 702 | logerror( "MATSUCD - Warning: Reading TOC without a CD!\n" ); |
| 703 | 703 | matsucd_command_error(); |
| 704 | 704 | return; |
| 705 | 705 | } |
| 706 | ||
| 706 | ||
| 707 | 707 | if ( track > cdrom_get_last_track(cd.cdrom) ) |
| 708 | 708 | { |
| 709 | 709 | logerror( "MATSUCD - Warning: Reading invalid track entry from TOC!\n" ); |
| 710 | 710 | matsucd_command_error(); |
| 711 | 711 | return; |
| 712 | 712 | } |
| 713 | ||
| 713 | ||
| 714 | 714 | memset( cd.output, 0, 7 ); |
| 715 | ||
| 715 | ||
| 716 | 716 | track_start = cdrom_get_track_start(cd.cdrom, track > 0 ? (track-1) : track ); |
| 717 | 717 | if ( msfmode ) track_start = LBA2MSF( track_start ); |
| 718 | 718 | |
| r1461 | r1462 | |
| 723 | 723 | cd.output[5] = (track_start >> 16) & 0xff; |
| 724 | 724 | cd.output[6] = (track_start >> 8) & 0xff; |
| 725 | 725 | cd.output[7] = (track_start) & 0xff; |
| 726 | ||
| 726 | ||
| 727 | 727 | cd.motor = 1; |
| 728 | ||
| 728 | ||
| 729 | 729 | matsucd_complete_cmd( 8 ); |
| 730 | 730 | } |
| 731 | 731 | break; |
| 732 | ||
| 732 | ||
| 733 | 733 | case 0x8b: /* pause audio */ |
| 734 | 734 | { |
| 735 | 735 | if ( cd.input_pos < 7 ) |
| 736 | 736 | return; |
| 737 | ||
| 737 | ||
| 738 | 738 | matsucd_cdda_pause( (cd.input[1] == 0) ? 1 : 0 ); |
| 739 | 739 | memset( cd.output, 0, 7 ); |
| 740 | 740 | matsucd_complete_cmd( 0 ); |
| 741 | 741 | } |
| 742 | 742 | break; |
| 743 | ||
| 743 | ||
| 744 | 744 | case 0xa3: /* front panel */ |
| 745 | 745 | { |
| 746 | 746 | if ( cd.input_pos < 7 ) |
| 747 | 747 | return; |
| 748 | ||
| 748 | ||
| 749 | 749 | /* TODO: ??? */ |
| 750 | ||
| 750 | ||
| 751 | 751 | memset( cd.output, 0, 7 ); |
| 752 | 752 | matsucd_complete_cmd( 0 ); |
| 753 | 753 | } |
| 754 | 754 | break; |
| 755 | ||
| 755 | ||
| 756 | 756 | default: |
| 757 | 757 | logerror( "MATSUCD: Unknown/inimplemented command %08x\n", cmd ); |
| 758 | 758 | break; |
| r1461 | r1462 | |
|---|---|---|
| 41 | 41 | Type Size Tracks Sides Sectors/track Sectors Speed Drives |
| 42 | 42 | |
| 43 | 43 | ABC-830 Floppy 160 KB 40 1 16 640 250 Kbps MPI 51, BASF 6106 |
| 44 | Floppy 80 KB 40 1 8 320 250 Kbps Scandia Metric FD2 | |
| 44 | Floppy 80 KB 40 1 8 320 250 Kbps Scandia Metric FD2 | |
| 45 | 45 | ABC-832 Floppy 640 KB 80 2 16 2560 250 Kbps Micropolis 1015, Micropolis 1115, BASF 6118 |
| 46 | 46 | ABC-834 Floppy 640 KB 80 2 16 2560 250 Kbps Teac FD 55 F |
| 47 | 47 | ABC-838 Floppy 1 MB 77 2 25 3978 500 Kbps BASF 6104, BASF 6115 |
| r1461 | r1462 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | 3 | Amiga cartridge emulation |
| 4 | ||
| 4 | ||
| 5 | 5 | TODO: |
| 6 | 6 | - Investigate why the AR2/3 sometimes garble the video on exit from the cart |
| 7 | 7 | - Add Nordic Power and similar carts |
| r1461 | r1462 | |
| 35 | 35 | static int check_kickstart_12_13( const char *cart_name ) |
| 36 | 36 | { |
| 37 | 37 | UINT16 * ksmem = (UINT16 *)memory_region( REGION_USER1 ); |
| 38 | ||
| 38 | ||
| 39 | 39 | if ( ksmem[2] == 0x00FC ) |
| 40 | 40 | return 1; |
| 41 | ||
| 41 | ||
| 42 | 42 | logerror( "%s requires Kickstart version 1.2 or 1.3 - Cart not installed\n", cart_name ); |
| 43 | ||
| 44 | return 0; | |
| 43 | ||
| 44 | return 0; | |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | /*************************************************************************** |
| 48 | 48 | |
| 49 | 49 | Amiga Action Replay 1 |
| 50 | ||
| 50 | ||
| 51 | 51 | Whenever you push the button, an NMI interrupt is generated. |
| 52 | ||
| 52 | ||
| 53 | 53 | The cartridge protects itself from being removed from memory by |
| 54 | 54 | generating an interrupt whenever either the spurious interrupt |
| 55 | 55 | vector is written at $60, or the nmi interrupt vector is written at |
| r1461 | r1462 | |
| 57 | 57 | a NMI is generated, and the spurious irq vector is restored. If the |
| 58 | 58 | NMI vector at $7c is written, then a spurious interrupt is generated, |
| 59 | 59 | and the NMI vector is restored. |
| 60 | ||
| 60 | ||
| 61 | 61 | When breakpoints are set, the target address is replaced by a trap |
| 62 | 62 | instruction, and the original contents of the address are kept in |
| 63 | 63 | the cartridge's RAM. A trap handler is installed pointing to $40 |
| r1461 | r1462 | |
| 76 | 76 | { |
| 77 | 77 | return M68K_INT_ACK_SPURIOUS; |
| 78 | 78 | } |
| 79 | ||
| 79 | ||
| 80 | 80 | return (24+level); |
| 81 | 81 | } |
| 82 | 82 | |
| r1461 | r1462 | |
| 90 | 90 | { |
| 91 | 91 | /* get the cart's built-in ram */ |
| 92 | 92 | UINT16 *ar_ram = (UINT16 *)memory_get_write_ptr(0, ADDRESS_SPACE_PROGRAM, 0x9fc000); |
| 93 | ||
| 93 | ||
| 94 | 94 | if ( ar_ram != NULL ) |
| 95 | 95 | { |
| 96 | 96 | int i; |
| 97 | ||
| 97 | ||
| 98 | 98 | /* copy custom register values */ |
| 99 | 99 | for( i = 0; i < 256; i++ ) |
| 100 | 100 | ar_ram[0x1800+i] = CUSTOM_REG(i); |
| 101 | ||
| 101 | ||
| 102 | 102 | /* trigger NMI irq */ |
| 103 | 103 | amiga_ar1_spurious = 0; |
| 104 | 104 | timer_set( ATTOTIME_IN_CYCLES(28,0), NULL, 0, amiga_ar1_delayed_nmi ); |
| r1461 | r1462 | |
| 108 | 108 | static WRITE16_HANDLER( amiga_ar1_chipmem_w ) |
| 109 | 109 | { |
| 110 | 110 | int pc = safe_activecpu_get_pc(); |
| 111 | ||
| 111 | ||
| 112 | 112 | /* see if we're inside the AR1 rom */ |
| 113 | 113 | if ( ((pc >> 16) & 0xff ) != 0xf0 ) |
| 114 | 114 | { |
| r1461 | r1462 | |
| 121 | 121 | timer_set( ATTOTIME_IN_CYCLES(28,0), NULL, 0, amiga_ar1_delayed_nmi ); |
| 122 | 122 | } |
| 123 | 123 | } |
| 124 | ||
| 124 | ||
| 125 | 125 | amiga_chip_ram_w( offset * 2, data ); |
| 126 | 126 | } |
| 127 | 127 | |
| r1461 | r1462 | |
| 133 | 133 | static void amiga_ar1_init( void ) |
| 134 | 134 | { |
| 135 | 135 | void *ar_ram; |
| 136 | ||
| 136 | ||
| 137 | 137 | /* check kickstart version */ |
| 138 | 138 | if ( !check_kickstart_12_13( "Amiga Action Replay" ) ) |
| 139 | 139 | { |
| 140 | 140 | amiga_cart_type = -1; |
| 141 | 141 | return; |
| 142 | 142 | } |
| 143 | ||
| 143 | ||
| 144 | 144 | /* setup the cart ram */ |
| 145 | 145 | ar_ram = auto_malloc(0x4000); |
| 146 | 146 | memset(ar_ram, 0, 0x4000); |
| 147 | ||
| 147 | ||
| 148 | 148 | /* Install ROM */ |
| 149 | 149 | memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0xf00000, 0xf7ffff, 0, 0, MRA16_BANK2); |
| 150 | 150 | memory_install_write16_handler(0, ADDRESS_SPACE_PROGRAM, 0xf00000, 0xf7ffff, 0, 0, MWA16_ROM); |
| r1461 | r1462 | |
| 156 | 156 | /* Configure Banks */ |
| 157 | 157 | memory_set_bankptr(2, memory_region(REGION_USER2)); |
| 158 | 158 | memory_set_bankptr(3, ar_ram); |
| 159 | ||
| 159 | ||
| 160 | 160 | amiga_ar1_spurious = 0; |
| 161 | ||
| 161 | ||
| 162 | 162 | /* Install IRQ ACK callback */ |
| 163 | 163 | cpunum_set_irq_callback(0,amiga_ar1_irqack); |
| 164 | 164 | } |
| r1461 | r1462 | |
| 166 | 166 | /*************************************************************************** |
| 167 | 167 | |
| 168 | 168 | Amiga Action Replay MKII/MKIII |
| 169 | ||
| 169 | ||
| 170 | 170 | Whenever you push the button, an overlay of the cartridge appears |
| 171 | 171 | in RAM and an NMI interrupt is generated. Only reads are overlayed. |
| 172 | 172 | Writes go directly to chipmem (so that the CPU can write the stack |
| 173 | 173 | information for the NMI). Once the interrupt is taken, the cart |
| 174 | 174 | disables the ROM overlay and checks it's internal mode register |
| 175 | 175 | to see why it was invoked. |
| 176 | ||
| 176 | ||
| 177 | 177 | When a breakpoint is set the cart replaces the target instruction |
| 178 | 178 | with a trap, and adds a trap handler that it locates in the $100-$120 |
| 179 | 179 | area. The handler simply has one instruction: TST.B $BFE001. This cia |
| 180 | 180 | access is monitored, and the conditions match (PC < 120 and a previous |
| 181 | 181 | command requested the monitoring of the cia) then the cart is invoked. |
| 182 | ||
| 182 | ||
| 183 | 183 | ***************************************************************************/ |
| 184 | 184 | |
| 185 | 185 | static UINT16 amiga_ar23_mode; |
| r1461 | r1462 | |
| 189 | 189 | static READ16_HANDLER( amiga_ar23_cia_r ) |
| 190 | 190 | { |
| 191 | 191 | int pc = safe_activecpu_get_pc(); |
| 192 | ||
| 192 | ||
| 193 | 193 | if ( ACCESSING_LSB && offset == 2048 && pc >= 0x40 && pc < 0x120 ) |
| 194 | 194 | { |
| 195 | 195 | amiga_ar23_freeze(); |
| 196 | 196 | } |
| 197 | ||
| 197 | ||
| 198 | 198 | return amiga_cia_r( offset, mem_mask ); |
| 199 | 199 | } |
| 200 | 200 | |
| r1461 | r1462 | |
| 208 | 208 | { |
| 209 | 209 | memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0xbfd000, 0xbfefff, 0, 0, amiga_cia_r); |
| 210 | 210 | } |
| 211 | ||
| 211 | ||
| 212 | 212 | amiga_ar23_mode = (data&0x3); |
| 213 | 213 | if ( amiga_ar23_mode == 0 ) |
| 214 | 214 | amiga_ar23_mode = 1; |
| 215 | ||
| 215 | ||
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 | static READ16_HANDLER( amiga_ar23_mode_r ) |
| 219 | 219 | { |
| 220 | 220 | UINT16 *mem = (UINT16 *)memory_region( REGION_USER2 ); |
| 221 | ||
| 221 | ||
| 222 | 222 | if ( ACCESSING_LSB ) |
| 223 | 223 | { |
| 224 | 224 | if ( offset < 2 ) |
| r1461 | r1462 | |
| 227 | 227 | if ( offset == 0x03 ) /* disable cart oberlay on chip mem */ |
| 228 | 228 | { |
| 229 | 229 | UINT32 mirror_mask = amiga_chip_ram_size; |
| 230 | ||
| 230 | ||
| 231 | 231 | memory_set_bank(1, 0); |
| 232 | ||
| 232 | ||
| 233 | 233 | while( (mirror_mask<<1) < 0x100000 ) |
| 234 | 234 | { |
| 235 | 235 | mirror_mask |= ( mirror_mask << 1 ); |
| 236 | 236 | } |
| 237 | ||
| 237 | ||
| 238 | 238 | /* overlay disabled, map RAM on 0x000000 */ |
| 239 | 239 | memory_install_write16_handler(0, ADDRESS_SPACE_PROGRAM, 0x000000, amiga_chip_ram_size - 1, 0, mirror_mask, MWA16_BANK1); |
| 240 | 240 | } |
| 241 | 241 | } |
| 242 | ||
| 242 | ||
| 243 | 243 | return mem[offset]; |
| 244 | 244 | } |
| 245 | 245 | |
| r1461 | r1462 | |
| 250 | 250 | if ( amiga_ar23_mode & 1 ) |
| 251 | 251 | amiga_ar23_freeze(); |
| 252 | 252 | } |
| 253 | ||
| 253 | ||
| 254 | 254 | amiga_chip_ram_w( offset * 2, data ); |
| 255 | 255 | } |
| 256 | 256 | |
| 257 | 257 | static void amiga_ar23_freeze( void ) |
| 258 | 258 | { |
| 259 | 259 | int pc = safe_activecpu_get_pc(); |
| 260 | ||
| 260 | ||
| 261 | 261 | /* only freeze if we're not inside the cart's ROM */ |
| 262 | 262 | if ( ((pc >> 16) & 0xfe ) != 0x40 ) |
| 263 | 263 | { |
| 264 | 264 | /* get the cart's built-in ram */ |
| 265 | 265 | UINT16 *ar_ram = (UINT16 *)memory_get_write_ptr(0, ADDRESS_SPACE_PROGRAM, 0x440000); |
| 266 | ||
| 266 | ||
| 267 | 267 | if ( ar_ram != NULL ) |
| 268 | 268 | { |
| 269 | 269 | int i; |
| 270 | ||
| 270 | ||
| 271 | 271 | for( i = 0; i < 0x100; i++ ) |
| 272 | 272 | ar_ram[0x7800+i] = CUSTOM_REG(i); |
| 273 | 273 | } |
| 274 | ||
| 274 | ||
| 275 | 275 | /* overlay the cart rom's in chipram */ |
| 276 | 276 | memory_set_bank(1, 2); |
| 277 | ||
| 277 | ||
| 278 | 278 | /* writes go to chipram */ |
| 279 | 279 | memory_install_write16_handler(0, ADDRESS_SPACE_PROGRAM, 0x000000, amiga_chip_ram_size - 1, 0, 0, amiga_ar23_chipmem_w); |
| 280 | ||
| 280 | ||
| 281 | 281 | /* trigger NMI irq */ |
| 282 | 282 | cpunum_set_input_line(0, 7, PULSE_LINE); |
| 283 | 283 | } |
| r1461 | r1462 | |
| 293 | 293 | static WRITE16_HANDLER( amiga_ar23_custom_w ) |
| 294 | 294 | { |
| 295 | 295 | int pc = safe_activecpu_get_pc(); |
| 296 | ||
| 296 | ||
| 297 | 297 | /* see if we're inside the AR2 rom */ |
| 298 | 298 | if ( ((pc >> 16) & 0xfe ) != 0x40 ) |
| 299 | 299 | { |
| 300 | 300 | /* get the cart's built-in ram */ |
| 301 | 301 | UINT16 *ar_ram = (UINT16 *)memory_get_write_ptr(0, ADDRESS_SPACE_PROGRAM, 0x440000); |
| 302 | ||
| 302 | ||
| 303 | 303 | if ( ar_ram != NULL ) |
| 304 | 304 | { |
| 305 | 305 | ar_ram[0x7800+offset] = data; |
| 306 | 306 | } |
| 307 | 307 | } |
| 308 | ||
| 309 | amiga_custom_w( offset, data, mem_mask ); | |
| 308 | ||
| 309 | amiga_custom_w( offset, data, mem_mask ); | |
| 310 | 310 | } |
| 311 | 311 | |
| 312 | 312 | static READ16_HANDLER( amiga_ar23_custom_r ) |
| 313 | 313 | { |
| 314 | UINT16 data = amiga_custom_r( offset, mem_mask ); | |
| 315 | ||
| 314 | UINT16 data = amiga_custom_r( offset, mem_mask ); | |
| 315 | ||
| 316 | 316 | int pc = safe_activecpu_get_pc(); |
| 317 | ||
| 317 | ||
| 318 | 318 | /* see if we're inside the AR2 rom */ |
| 319 | 319 | if ( ((pc >> 16) & 0xfe ) != 0x40 ) |
| 320 | 320 | { |
| 321 | 321 | /* get the cart's built-in ram */ |
| 322 | 322 | UINT16 *ar_ram = (UINT16 *)memory_get_write_ptr(0, ADDRESS_SPACE_PROGRAM, 0x440000); |
| 323 | ||
| 323 | ||
| 324 | 324 | if ( ar_ram != NULL ) |
| 325 | 325 | { |
| 326 | 326 | ar_ram[0x7800+offset] = data; |
| r1461 | r1462 | |
| 341 | 341 | { |
| 342 | 342 | UINT32 mirror = 0x20000, size = 0x1ffff; |
| 343 | 343 | void *ar_ram; |
| 344 | ||
| 344 | ||
| 345 | 345 | /* check kickstart version */ |
| 346 | 346 | if ( !check_kickstart_12_13( "Action Replay MKII or MKIII" ) ) |
| 347 | 347 | { |
| 348 | 348 | amiga_cart_type = -1; |
| 349 | 349 | return; |
| 350 | 350 | } |
| 351 | ||
| 351 | ||
| 352 | 352 | /* setup the cart ram */ |
| 353 | 353 | ar_ram = auto_malloc(0x10000); |
| 354 | ||
| 354 | ||
| 355 | 355 | memset(ar_ram, 0, 0x10000); |
| 356 | ||
| 356 | ||
| 357 | 357 | if ( ar3 ) |
| 358 | 358 | { |
| 359 | 359 | mirror = 0; |
| 360 | 360 | size = 0x3ffff; |
| 361 | 361 | } |
| 362 | ||
| 362 | ||
| 363 | 363 | /* Install ROM */ |
| 364 | 364 | memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0x400000, 0x400000+size, 0, mirror, MRA16_BANK2); |
| 365 | 365 | memory_install_write16_handler(0, ADDRESS_SPACE_PROGRAM, 0x400000, 0x400000+size, 0, mirror, MWA16_ROM); |
| r1461 | r1462 | |
| 367 | 367 | /* Install RAM */ |
| 368 | 368 | memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0x440000, 0x44ffff, 0, 0, MRA16_BANK3); |
| 369 | 369 | memory_install_write16_handler(0, ADDRESS_SPACE_PROGRAM, 0x440000, 0x44ffff, 0, 0, MWA16_BANK3); |
| 370 | ||
| 370 | ||
| 371 | 371 | /* Install Custom chip monitor */ |
| 372 | 372 | // memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0xdff000, 0xdff1ff, 0, 0, amiga_ar23_custom_r); |
| 373 | 373 | // memory_install_write16_handler(0, ADDRESS_SPACE_PROGRAM, 0xdff000, 0xdff1ff, 0, 0, amiga_ar23_custom_w); |
| 374 | ||
| 374 | ||
| 375 | 375 | /* Install status/mode handlers */ |
| 376 | 376 | memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0x400000, 0x400007, 0, mirror, amiga_ar23_mode_r); |
| 377 | 377 | memory_install_write16_handler(0, ADDRESS_SPACE_PROGRAM, 0x400000, 0x400003, 0, mirror, amiga_ar23_mode_w); |
| r1461 | r1462 | |
| 379 | 379 | /* Configure Banks */ |
| 380 | 380 | memory_set_bankptr(2, memory_region(REGION_USER2)); |
| 381 | 381 | memory_set_bankptr(3, ar_ram); |
| 382 | ||
| 382 | ||
| 383 | 383 | memory_configure_bank(1, 0, 2, amiga_chip_ram, 0); |
| 384 | 384 | memory_configure_bank(1, 1, 2, memory_region(REGION_USER1), 0); |
| 385 | 385 | memory_configure_bank(1, 2, 2, memory_region(REGION_USER2), 0); |
| 386 | ||
| 386 | ||
| 387 | 387 | amiga_ar23_mode = 3; |
| 388 | 388 | } |
| 389 | 389 | |
| r1461 | r1462 | |
| 397 | 397 | { |
| 398 | 398 | /* see what is there */ |
| 399 | 399 | UINT16 *mem = (UINT16 *)memory_region( REGION_USER2 ); |
| 400 | ||
| 400 | ||
| 401 | 401 | amiga_cart_type = -1; |
| 402 | ||
| 402 | ||
| 403 | 403 | if ( mem != NULL ) |
| 404 | 404 | { |
| 405 | 405 | if ( mem[0x00] == 0x1111 ) |
| r1461 | r1462 | |
| 424 | 424 | { |
| 425 | 425 | if ( amiga_cart_type < 0 ) |
| 426 | 426 | return; |
| 427 | ||
| 427 | ||
| 428 | 428 | switch( amiga_cart_type ) |
| 429 | 429 | { |
| 430 | 430 | case ACTION_REPLAY: |
| 431 | 431 | amiga_ar1_check_overlay(); |
| 432 | 432 | break; |
| 433 | ||
| 433 | ||
| 434 | 434 | case ACTION_REPLAY_MKII: |
| 435 | 435 | case ACTION_REPLAY_MKIII: |
| 436 | 436 | amiga_ar23_check_overlay(); |
| r1461 | r1462 | |
| 442 | 442 | { |
| 443 | 443 | if ( amiga_cart_type < 0 ) |
| 444 | 444 | return; |
| 445 | ||
| 445 | ||
| 446 | 446 | switch( amiga_cart_type ) |
| 447 | 447 | { |
| 448 | 448 | case ACTION_REPLAY: |
| 449 | 449 | amiga_ar1_nmi(); |
| 450 | 450 | break; |
| 451 | ||
| 451 | ||
| 452 | 452 | case ACTION_REPLAY_MKII: |
| 453 | 453 | case ACTION_REPLAY_MKIII: |
| 454 | 454 | amiga_ar23_nmi(); |
| r1461 | r1462 | |
|---|---|---|
| 745 | 745 | if ( !memcmp( &rom[0x7ff0], signatures[i], 16 ) ) { |
| 746 | 746 | return 1; |
| 747 | 747 | } |
| 748 | } | |
| 748 | } | |
| 749 | 749 | return 0; |
| 750 | 750 | } |
| 751 | 751 |
| r1461 | r1462 | |
|---|---|---|
| 10 | 10 | - Removed disk image code and replaced it with floppy drive functions. |
| 11 | 11 | Any disc image is now useable with this code. |
| 12 | 12 | - Fixed write protect |
| 13 | ||
| 13 | ||
| 14 | 14 | 2005-Apr-16 P.Harvey-Smith: |
| 15 | 15 | - Increased the delay in wd17xx_timed_read_sector_request and |
| 16 | 16 | wd17xx_timed_write_sector_request, to 40us to more closely match |
| 17 | 17 | what happens on the real hardware, this has fixed the NitrOS9 boot |
| 18 | 18 | problems. |
| 19 | ||
| 19 | ||
| 20 | 20 | 2007-Nov-01 Wilbert Pol: |
| 21 | 21 | Needed these changes to get the MB8877 for Osborne-1 to work: |
| 22 | 22 | - Added support for multiple record read |
| r1461 | r1462 | |
| 303 | 303 | static TIMER_CALLBACK(wd17xx_busy_callback) |
| 304 | 304 | { |
| 305 | 305 | wd17xx_info *info = (wd17xx_info *) ptr; |
| 306 | wd17xx_set_irq(info); | |
| 306 | wd17xx_set_irq(info); | |
| 307 | 307 | timer_reset(busy_timer, attotime_never); |
| 308 | 308 | } |
| 309 | 309 | |
| r1461 | r1462 | |
| 322 | 322 | static void wd17xx_restore(wd17xx_info *w) |
| 323 | 323 | { |
| 324 | 324 | UINT8 step_counter; |
| 325 | ||
| 325 | ||
| 326 | 326 | if (current_drive >= device_count(IO_FLOPPY)) |
| 327 | 327 | return; |
| 328 | 328 | |
| 329 | 329 | step_counter = 255; |
| 330 | ||
| 330 | ||
| 331 | 331 | #if 0 |
| 332 | 332 | w->status |= STA_1_BUSY; |
| 333 | 333 | #endif |
| r1461 | r1462 | |
| 357 | 357 | #if 0 |
| 358 | 358 | /* simulate seek time busy signal */ |
| 359 | 359 | w->busy_count = 0; //w->busy_count * ((w->data & FDC_STEP_RATE) + 1); |
| 360 | ||
| 360 | ||
| 361 | 361 | /* when command completes set irq */ |
| 362 | 362 | wd17xx_set_irq(w); |
| 363 | 363 | #endif |
| r1461 | r1462 | |
| 377 | 377 | for (i = 0; i < device_count(IO_FLOPPY); i++) |
| 378 | 378 | { |
| 379 | 379 | mess_image *img = image_from_devtype_and_index(IO_FLOPPY, i); |
| 380 | floppy_drive_set_index_pulse_callback(img, wd17xx_index_pulse_callback); | |
| 380 | floppy_drive_set_index_pulse_callback(img, wd17xx_index_pulse_callback); | |
| 381 | 381 | floppy_drive_set_rpm( img, 300.); |
| 382 | 382 | } |
| 383 | 383 | |
| r1461 | r1462 | |
| 419 | 419 | int track = w->buffer[i+1]; |
| 420 | 420 | int side = w->buffer[i+2]; |
| 421 | 421 | int sector = w->buffer[i+3]; |
| 422 | int len = w->buffer[i+4]; | |
| 422 | int len = w->buffer[i+4]; | |
| 423 | 423 | int filler = 0xe5; /* IBM and Thomson */ |
| 424 | 424 | int density = w->density; |
| 425 | 425 | floppy_drive_format_sector(wd17xx_current_image(),side,sector,track, |
| r1461 | r1462 | |
| 559 | 559 | w->data_count = (w->density) ? TRKSIZE_DD : TRKSIZE_SD; |
| 560 | 560 | |
| 561 | 561 | floppy_drive_read_track_data_info_buffer( wd17xx_current_image(), hd, (char *)w->buffer, &(w->data_count) ); |
| 562 | ||
| 562 | ||
| 563 | 563 | w->data_offset = 0; |
| 564 | 564 | |
| 565 | 565 | wd17xx_set_data_request(); |
| r1461 | r1462 | |
| 627 | 627 | /* crc is stored hi-byte followed by lo-byte */ |
| 628 | 628 | w->buffer[4] = crc>>8; |
| 629 | 629 | w->buffer[5] = crc & 255; |
| 630 | ||
| 630 | ||
| 631 | 631 | w->sector = id.C; |
| 632 | 632 | |
| 633 | 633 | w->status |= STA_2_BUSY; |
| r1461 | r1462 | |
| 805 | 805 | } |
| 806 | 806 | |
| 807 | 807 | /* stop it, but don't allow it to be free'd */ |
| 808 | timer_reset(w->timer, attotime_never); | |
| 808 | timer_reset(w->timer, attotime_never); | |
| 809 | 809 | } |
| 810 | 810 | |
| 811 | 811 | |
| r1461 | r1462 | |
| 947 | 947 | wd17xx_read_sector(w); |
| 948 | 948 | |
| 949 | 949 | /* stop it, but don't allow it to be free'd */ |
| 950 | timer_reset(w->timer_rs, attotime_never); | |
| 950 | timer_reset(w->timer_rs, attotime_never); | |
| 951 | 951 | } |
| 952 | 952 | |
| 953 | 953 | |
| r1461 | r1462 | |
| 998 | 998 | } |
| 999 | 999 | |
| 1000 | 1000 | /* stop it, but don't allow it to be free'd */ |
| 1001 | timer_reset(w->timer_ws, attotime_never); | |
| 1001 | timer_reset(w->timer_ws, attotime_never); | |
| 1002 | 1002 | } |
| 1003 | 1003 | |
| 1004 | 1004 | |
| r1461 | r1462 | |
| 1072 | 1072 | |
| 1073 | 1073 | // floppy_drive_set_ready_state(wd17xx_current_image(), 1,1); |
| 1074 | 1074 | w->status &= ~STA_1_NOT_READY; |
| 1075 | ||
| 1075 | ||
| 1076 | 1076 | /* TODO: What is this? We need some more info on this */ |
| 1077 | 1077 | if ((w->type == WD_TYPE_179X) || (w->type == WD_TYPE_1773)) |
| 1078 | 1078 | { |
| r1461 | r1462 | |
| 1085 | 1085 | w->status |= STA_1_NOT_READY; |
| 1086 | 1086 | } |
| 1087 | 1087 | } |
| 1088 | ||
| 1088 | ||
| 1089 | 1089 | /* eventually set data request bit */ |
| 1090 | 1090 | // w->status |= w->status_drq; |
| 1091 | 1091 | |
| r1461 | r1462 | |
| 1189 | 1189 | else |
| 1190 | 1190 | { |
| 1191 | 1191 | /* issue a timed data request */ |
| 1192 | wd17xx_timed_data_request(); | |
| 1192 | wd17xx_timed_data_request(); | |
| 1193 | 1193 | } |
| 1194 | 1194 | } |
| 1195 | 1195 | else |
| r1461 | r1462 | |
| 1205 | 1205 | WRITE8_HANDLER ( wd17xx_command_w ) |
| 1206 | 1206 | { |
| 1207 | 1207 | wd17xx_info *w = &wd; |
| 1208 | ||
| 1208 | ||
| 1209 | 1209 | floppy_drive_set_motor_state(wd17xx_current_image(), 1); |
| 1210 | 1210 | floppy_drive_set_ready_state(wd17xx_current_image(), 1,0); |
| 1211 | 1211 | /* also cleared by writing command */ |
| r1461 | r1462 | |
| 1222 | 1222 | w->data_count = 0; |
| 1223 | 1223 | w->data_offset = 0; |
| 1224 | 1224 | w->status &= ~(STA_2_BUSY); |
| 1225 | ||
| 1225 | ||
| 1226 | 1226 | wd17xx_clear_data_request(); |
| 1227 | 1227 | |
| 1228 | 1228 | if (data & 0x0f) |
| r1461 | r1462 | |
| 1235 | 1235 | |
| 1236 | 1236 | // w->status_ipl = STA_1_IPL; |
| 1237 | 1237 | /* w->status_ipl = 0; */ |
| 1238 | ||
| 1238 | ||
| 1239 | 1239 | w->busy_count = 0; |
| 1240 | 1240 | w->command_type = TYPE_IV; |
| 1241 | 1241 | return; |
| r1461 | r1462 | |
| 1309 | 1309 | } |
| 1310 | 1310 | else |
| 1311 | 1311 | { |
| 1312 | ||
| 1312 | ||
| 1313 | 1313 | /* drive write protected? */ |
| 1314 | 1314 | if (floppy_drive_get_flag_state(wd17xx_current_image(),FLOPPY_DRIVE_DISK_WRITE_PROTECTED)) |
| 1315 | 1315 | { |
| r1461 | r1462 | |
| 1359 | 1359 | } |
| 1360 | 1360 | |
| 1361 | 1361 | w->status |= STA_1_BUSY; |
| 1362 | ||
| 1362 | ||
| 1363 | 1363 | /* clear CRC error */ |
| 1364 | 1364 | w->status &=~STA_1_CRC_ERR; |
| 1365 | 1365 | |
| r1461 | r1462 | |
| 1544 | 1544 | /* put byte into buffer */ |
| 1545 | 1545 | if (VERBOSE_DATA) |
| 1546 | 1546 | logerror("wd17xx_info buffered data: $%02X at offset %d.\n", data, w->data_offset); |
| 1547 | ||
| 1547 | ||
| 1548 | 1548 | w->buffer[w->data_offset++] = data; |
| 1549 | ||
| 1549 | ||
| 1550 | 1550 | if (--w->data_count < 1) |
| 1551 | 1551 | { |
| 1552 | 1552 | if (w->command == FDC_WRITE_TRK) |
| r1461 | r1462 | |
| 1580 | 1580 | UINT8 result = 0; |
| 1581 | 1581 | |
| 1582 | 1582 | switch(offset % 4) { |
| 1583 | case 0: | |
| 1583 | case 0: | |
| 1584 | 1584 | result = wd17xx_status_r(0); |
| 1585 | 1585 | break; |
| 1586 | case 1: | |
| 1586 | case 1: | |
| 1587 | 1587 | result = wd17xx_track_r(0); |
| 1588 | 1588 | break; |
| 1589 | case 2: | |
| 1589 | case 2: | |
| 1590 | 1590 | result = wd17xx_sector_r(0); |
| 1591 | 1591 | break; |
| 1592 | case 3: | |
| 1592 | case 3: | |
| 1593 | 1593 | result = wd17xx_data_r(0); |
| 1594 | 1594 | break; |
| 1595 | 1595 | } |
| r1461 | r1462 | |
|---|---|---|
| 60 | 60 | int mbc; |
| 61 | 61 | |
| 62 | 62 | /* Do not get deltas or send packets if queue is not empty (Prevents drifting) */ |
| 63 | if (pc_mouse.head==pc_mouse.tail) | |
| 63 | if (pc_mouse.head==pc_mouse.tail) | |
| 64 | 64 | { |
| 65 | 65 | nx = readinputportbytag("pc_mouse_x"); |
| 66 | ||
| 66 | ||
| 67 | 67 | dx = nx - ox; |
| 68 | 68 | if (dx<=-0x800) dx = nx + 0x1000 - ox; /* Prevent jumping */ |
| 69 | 69 | if (dx>=0x800) dx = nx - 0x1000 - ox; |
| 70 | 70 | ox = nx; |
| 71 | ||
| 71 | ||
| 72 | 72 | ny = readinputportbytag("pc_mouse_y"); |
| 73 | ||
| 73 | ||
| 74 | 74 | dy = ny - oy; |
| 75 | 75 | if (dy<=-0x800) dy = ny + 0x1000 - oy; |
| 76 | 76 | if (dy>=0x800) dy = ny - 0x1000 - oy; |
| 77 | 77 | oy = ny; |
| 78 | ||
| 78 | ||
| 79 | 79 | nb = readinputportbytag("pc_mouse_misc"); |
| 80 | if ((nb & 0x80) != 0) | |
| 80 | if ((nb & 0x80) != 0) | |
| 81 | 81 | { |
| 82 | 82 | pc_mouse.protocol=TYPE_MOUSE_SYSTEMS; |
| 83 | 83 | } |
| 84 | 84 | else |
| 85 | { | |
| 85 | { | |
| 86 | 86 | pc_mouse.protocol=TYPE_MICROSOFT_MOUSE; |
| 87 | 87 | } |
| 88 | mbc = nb^pc_mouse.mb; | |
| 88 | mbc = nb^pc_mouse.mb; | |
| 89 | 89 | pc_mouse.mb = nb; |
| 90 | ||
| 90 | ||
| 91 | 91 | /* check if there is any delta or mouse buttons changed */ |
| 92 | 92 | if ( (dx!=0) || (dy!=0) || (mbc!=0) ) |
| 93 | 93 | { |
| 94 | 94 | switch (pc_mouse.protocol) |
| 95 | 95 | { |
| 96 | ||
| 96 | ||
| 97 | 97 | default: |
| 98 | 98 | case TYPE_MICROSOFT_MOUSE: |
| 99 | 99 | { |
| r1461 | r1462 | |
| 106 | 106 | m0 = 0x40 | ((nb << 4) & 0x30) | ((ddx >> 6) & 0x03) | ((ddy >> 4) & 0x0c); |
| 107 | 107 | m1 = ddx & 0x3f; |
| 108 | 108 | m2 = ddy & 0x3f; |
| 109 | ||
| 109 | ||
| 110 | 110 | /* KT - changed to use a function */ |
| 111 | 111 | pc_mouse_queue_data(m0 | 0x40); |
| 112 | 112 | pc_mouse_queue_data(m1 & 0x03f); |
| r1461 | r1462 | |
| 115 | 115 | { |
| 116 | 116 | pc_mouse_queue_data( (nb & 0x04) << 3); |
| 117 | 117 | } |
| 118 | ||
| 118 | ||
| 119 | 119 | dx -= ddx; |
| 120 | 120 | dy -= ddy; |
| 121 | 121 | } while( dx || dy ); |
| 122 | 122 | } |
| 123 | 123 | break; |
| 124 | ||
| 124 | ||
| 125 | 125 | /* mouse systems mouse |
| 126 | 126 | from "PC Mouse information" by Tomi Engdahl */ |
| 127 | ||
| 127 | ||
| 128 | 128 | /* |
| 129 | 129 | The data is sent in 5 byte packets in following format: |
| 130 | 130 | D7 D6 D5 D4 D3 D2 D1 D0 |
| 131 | ||
| 131 | ||
| 132 | 132 | 1. 1 0 0 0 0 LB CB RB |
| 133 | 133 | 2. X7 X6 X5 X4 X3 X2 X1 X0 |
| 134 | 134 | 3. Y7 Y6 Y5 Y4 Y3 Y4 Y1 Y0 |
| 135 | 135 | 4. X7' X6' X5' X4' X3' X2' X1' X0' |
| 136 | 136 | 5. Y7' Y6' Y5' Y4' Y3' Y4' Y1' Y0' |
| 137 | ||
| 137 | ||
| 138 | 138 | LB is left button state (0=pressed, 1=released) |
| 139 | 139 | CB is center button state (0=pressed, 1=released) |
| 140 | 140 | RB is right button state (0=pressed, 1=released) |
| r1461 | r1462 | |
| 146 | 146 | format (-128..+127), positive direction right |
| 147 | 147 | Y7'-Y0' movement in Y direction since sending of Y7-Y0 in signed byte |
| 148 | 148 | format (-128..+127), positive direction up |
| 149 | ||
| 149 | ||
| 150 | 150 | The last two bytes in the packet (bytes 4 and 5) contains information about movement data changes which have occured after data butes 2 and 3 have been sent. */ |
| 151 | ||
| 151 | ||
| 152 | 152 | case TYPE_MOUSE_SYSTEMS: |
| 153 | 153 | { |
| 154 | ||
| 154 | ||
| 155 | 155 | dy =-dy; |
| 156 | ||
| 156 | ||
| 157 | 157 | do |
| 158 | 158 | { |
| 159 | 159 | int ddx = (dx < -128) ? -128 : (dx > 127) ? 127 : dx; |
| 160 | 160 | int ddy = (dy < -128) ? -128 : (dy > 127) ? 127 : dy; |
| 161 | ||
| 161 | ||
| 162 | 162 | /* KT - changed to use a function */ |
| 163 | 163 | pc_mouse_queue_data(0x080 | ((((nb & 0x04) >> 1) + ((nb & 0x02) << 1) + (nb & 0x01)) ^ 0x07)); |
| 164 | 164 | pc_mouse_queue_data(ddx); |
| r1461 | r1462 | |
| 169 | 169 | dx -= ddx; |
| 170 | 170 | dy -= ddy; |
| 171 | 171 | } while( dx || dy ); |
| 172 | ||
| 172 | ||
| 173 | 173 | } |
| 174 | 174 | break; |
| 175 | 175 | } |
| 176 | 176 | } |
| 177 | } | |
| 177 | } | |
| 178 | 178 | |
| 179 | 179 | /* Send any data from this scan or any pending data from a previous scan */ |
| 180 | 180 | |
| r1461 | r1462 | |
| 219 | 219 | /* reset mouse */ |
| 220 | 220 | pc_mouse.head = pc_mouse.tail = pc_mouse.mb = 0; |
| 221 | 221 | |
| 222 | if ((readinputportbytag("pc_mouse_misc") & 0x80) == 0 ) | |
| 222 | if ((readinputportbytag("pc_mouse_misc") & 0x80) == 0 ) | |
| 223 | 223 | { |
| 224 | 224 | /* Identify as Microsoft 3 Button Mouse */ |
| 225 | pc_mouse.queue[pc_mouse.head] = 'M'; | |
| 225 | pc_mouse.queue[pc_mouse.head] = 'M'; | |
| 226 | 226 | pc_mouse.head = ++pc_mouse.head % 256; |
| 227 | pc_mouse.queue[pc_mouse.head] = '3'; | |
| 228 | pc_mouse.head = ++pc_mouse.head % 256; | |
| 227 | pc_mouse.queue[pc_mouse.head] = '3'; | |
| 228 | pc_mouse.head = ++pc_mouse.head % 256; | |
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | /* start a timer to scan the mouse input */ |
| r1461 | r1462 | |
| 235 | 235 | { |
| 236 | 236 | /* CTS just went to 0 */ |
| 237 | 237 | timer_adjust(pc_mouse.timer, attotime_zero, pc_mouse.serial_port, attotime_zero); |
| 238 | pc_mouse.head = pc_mouse.tail = 0; | |
| 238 | pc_mouse.head = pc_mouse.tail = 0; | |
| 239 | 239 | } |
| 240 | 240 | } |
| 241 | 241 | |
| r1461 | r1462 | |
| 251 | 251 | |
| 252 | 252 | INPUT_PORTS_START( pc_mouse_mousesystems ) |
| 253 | 253 | PORT_START_TAG( "pc_mouse_misc" ) |
| 254 | PORT_CONFNAME( 0x80, 0x80, "Mouse Protocol" ) | |
| 254 | PORT_CONFNAME( 0x80, 0x80, "Mouse Protocol" ) | |
| 255 | 255 | PORT_CONFSETTING( 0x80, "Mouse Systems" ) |
| 256 | 256 | PORT_CONFSETTING( 0x00, "Microsoft" ) |
| 257 | 257 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Mouse Left Button") PORT_CODE(MOUSECODE_BUTTON1) |
| 258 | 258 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_NAME("Mouse Middle Button") PORT_CODE(MOUSECODE_BUTTON3) |
| 259 | 259 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON3) PORT_NAME("Mouse Right Button") PORT_CODE(MOUSECODE_BUTTON2) |
| 260 | 260 | |
| 261 | PORT_START_TAG( "pc_mouse_x" ) /* Mouse - X AXIS */ | |
| 261 | PORT_START_TAG( "pc_mouse_x" ) /* Mouse - X AXIS */ | |
| 262 | 262 | PORT_BIT( 0xfff, 0x00, IPT_MOUSE_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(1) |
| 263 | 263 | |
| 264 | 264 | PORT_START_TAG( "pc_mouse_y" ) /* Mouse - Y AXIS */ |
| r1461 | r1462 | |
| 269 | 269 | |
| 270 | 270 | INPUT_PORTS_START( pc_mouse_microsoft ) |
| 271 | 271 | PORT_START_TAG( "pc_mouse_misc" ) |
| 272 | PORT_CONFNAME( 0x80, 0x00, "Mouse Protocol" ) | |
| 273 | PORT_CONFSETTING( 0x00, "Microsoft" ) | |
| 272 | PORT_CONFNAME( 0x80, 0x00, "Mouse Protocol" ) | |
| 273 | PORT_CONFSETTING( 0x00, "Microsoft" ) | |
| 274 | 274 | PORT_CONFSETTING( 0x80, "Mouse Systems" ) |
| 275 | 275 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Mouse Left Button") PORT_CODE(MOUSECODE_BUTTON1) |
| 276 | 276 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_NAME("Mouse Middle Button") PORT_CODE(MOUSECODE_BUTTON3) |
| 277 | 277 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON3) PORT_NAME("Mouse Right Button") PORT_CODE(MOUSECODE_BUTTON2) |
| 278 | 278 | |
| 279 | PORT_START_TAG( "pc_mouse_x" ) /* Mouse - X AXIS */ | |
| 279 | PORT_START_TAG( "pc_mouse_x" ) /* Mouse - X AXIS */ | |
| 280 | 280 | PORT_BIT( 0xfff, 0x00, IPT_MOUSE_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(1) |
| 281 | 281 | |
| 282 | 282 | PORT_START_TAG( "pc_mouse_y" ) /* Mouse - Y AXIS */ |
| r1461 | r1462 | |
|---|---|---|
| 108 | 108 | |
| 109 | 109 | else |
| 110 | 110 | p2 = p2 | 0xF0; |
| 111 | ||
| 111 | ||
| 112 | 112 | logerror("%.6f p2 read %.2x\n", attotime_to_double(timer_get_time()), p2); |
| 113 | 113 | return p2; |
| 114 | 114 | } |
| r1461 | r1462 | |
|---|---|---|
| 344 | 344 | apple2_c07x_w |
| 345 | 345 | }; |
| 346 | 346 | int slot; |
| 347 | ||
| 347 | ||
| 348 | 348 | offset &= 0xFF; |
| 349 | ||
| 349 | ||
| 350 | 350 | if (offset < 0x80) |
| 351 | 351 | { |
| 352 | 352 | if (handlers[offset / 0x10]) |
| r1461 | r1462 | |
| 486 | 486 | meminfo->read_mem = (a2 & VAR_ROMSWITCH) ? 0x005000 : 0x001000; |
| 487 | 487 | meminfo->read_mem |= APPLE2_MEM_ROM; |
| 488 | 488 | } |
| 489 | ||
| 489 | ||
| 490 | 490 | if (a2 & VAR_LCWRITE) |
| 491 | 491 | { |
| 492 | 492 | if (a2 & VAR_LCRAM2) |
| r1461 | r1462 | |
| 566 | 566 | |
| 567 | 567 | /* ----------------------------------------------------------------------- |
| 568 | 568 | * Floating bus code |
| 569 | * | |
| 569 | * | |
| 570 | 570 | * preliminary floating bus video scanner code - look for comments |
| 571 | 571 | * with FIX: |
| 572 | 572 | * ----------------------------------------------------------------------- */ |
| r1461 | r1462 | |
| 576 | 576 | enum |
| 577 | 577 | { |
| 578 | 578 | // scanner types |
| 579 | kScannerNone = 0, kScannerApple2, kScannerApple2e, | |
| 579 | kScannerNone = 0, kScannerApple2, kScannerApple2e, | |
| 580 | 580 | |
| 581 | 581 | // scanner constants |
| 582 | 582 | kHBurstClock = 53, // clock when Color Burst starts |
| r1461 | r1462 | |
| 1044 | 1044 | result = attotime_to_double(timer_get_time()) < joystick_y2_time; |
| 1045 | 1045 | break; |
| 1046 | 1046 | default: |
| 1047 | /* c060 Empty Cassette head read | |
| 1047 | /* c060 Empty Cassette head read | |
| 1048 | 1048 | * and any other non joystick c06 port returns this according to applewin |
| 1049 | 1049 | */ |
| 1050 | 1050 | return apple2_getfloatingbusvalue(); |
| r1461 | r1462 | |
| 1546 | 1546 | token = a2_config->slots[i]->init(i); |
| 1547 | 1547 | else |
| 1548 | 1548 | token = (void *) ~0; |
| 1549 | ||
| 1549 | ||
| 1550 | 1550 | a2_slot_tokens[i] = token; |
| 1551 | 1551 | } |
| 1552 | 1552 | } |
| 1553 | ||
| 1553 | ||
| 1554 | 1554 | /* --------------------------------------------- * |
| 1555 | 1555 | * set up the softswitch mask/set * |
| 1556 | 1556 | * --------------------------------------------- */ |
| 1557 | 1557 | a2_mask = ~0; |
| 1558 | 1558 | a2_set = 0; |
| 1559 | ||
| 1559 | ||
| 1560 | 1560 | /* disable VAR_ROMSWITCH if the ROM is only 16k */ |
| 1561 | 1561 | if (memory_region_length(REGION_CPU1) < 0x8000) |
| 1562 | 1562 | a2_mask &= ~VAR_ROMSWITCH; |
| r1461 | r1462 | |
| 1572 | 1572 | apple2_memmap_config mem_cfg; |
| 1573 | 1573 | apple2_config a2_cfg; |
| 1574 | 1574 | void *apple2cp_ce00_ram = NULL; |
| 1575 | ||
| 1575 | ||
| 1576 | 1576 | memset(&a2_cfg, 0, sizeof(a2_cfg)); |
| 1577 | 1577 | |
| 1578 | 1578 | /* specify slots */ |
| r1461 | r1462 | |
|---|---|---|
| 28 | 28 | NVRAM_HANDLER( tandy1000 ) |
| 29 | 29 | { |
| 30 | 30 | if (file==NULL) { |
| 31 | // init only | |
| 31 | // init only | |
| 32 | 32 | } else if (read_or_write) { |
| 33 | 33 | mame_fwrite(file, eeprom.ee, sizeof(eeprom.ee)); |
| 34 | 34 | } else { |
| r1461 | r1462 | |
| 82 | 82 | eeprom.state=200; |
| 83 | 83 | } else eeprom.state=0; |
| 84 | 84 | break; |
| 85 | ||
| 85 | ||
| 86 | 86 | /* read 16 bit */ |
| 87 | 87 | case 100: |
| 88 | 88 | eeprom.state++; |
| r1461 | r1462 | |
| 109 | 109 | eeprom.data<<=1; |
| 110 | 110 | eeprom.state=0; |
| 111 | 111 | break; |
| 112 | ||
| 112 | ||
| 113 | 113 | /* write 16 bit */ |
| 114 | 114 | case 200: |
| 115 | 115 | case 201: |
| r1461 | r1462 | |
| 234 | 234 | PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("= +") PORT_CODE(KEYCODE_EQUALS) /* = 0D 8D */ |
| 235 | 235 | PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("<--") PORT_CODE(KEYCODE_BACKSPACE) /* Backspace 0E 8E */ |
| 236 | 236 | PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) /* Tab 0F 8F */ |
| 237 | ||
| 237 | ||
| 238 | 238 | PORT_START /* IN5 */ |
| 239 | 239 | PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) /* Q 10 90 */ |
| 240 | 240 | PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) /* W 11 91 */ |
| r1461 | r1462 | |
| 252 | 252 | PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("L-Ctrl") PORT_CODE(KEYCODE_LCONTROL) /* Left Ctrl 1D 9D */ |
| 253 | 253 | PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) /* A 1E 9E */ |
| 254 | 254 | PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) /* S 1F 9F */ |
| 255 | ||
| 255 | ||
| 256 | 256 | PORT_START /* IN6 */ |
| 257 | 257 | PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) /* D 20 A0 */ |
| 258 | 258 | PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) /* F 21 A1 */ |
| r1461 | r1462 | |
| 270 | 270 | PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) /* X 2D AD */ |
| 271 | 271 | PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) /* C 2E AE */ |
| 272 | 272 | PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) /* V 2F AF */ |
| 273 | ||
| 273 | ||
| 274 | 274 | PORT_START /* IN7 */ |
| 275 | 275 | PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) /* B 30 B0 */ |
| 276 | 276 | PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) /* N 31 B1 */ |
| r1461 | r1462 | |
| 288 | 288 | PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) /* F3 3D BD */ |
| 289 | 289 | PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) /* F4 3E BE */ |
| 290 | 290 | PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) /* F5 3F BF */ |
| 291 | ||
| 291 | ||
| 292 | 292 | PORT_START /* IN8 */ |
| 293 | 293 | PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F6") PORT_CODE(KEYCODE_F6) /* F6 40 C0 */ |
| 294 | 294 | PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F7") PORT_CODE(KEYCODE_F7) /* F7 41 C1 */ |
| r1461 | r1462 | |
| 306 | 306 | PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("KP 6") PORT_CODE(KEYCODE_6_PAD) /* Keypad 6 4D CD */ |
| 307 | 307 | PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Cursor Right") PORT_CODE(KEYCODE_RIGHT) /* 4E CE */ |
| 308 | 308 | PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("KP 1 (End)") PORT_CODE(KEYCODE_1_PAD) /* Keypad 1 (End) 4F CF */ |
| 309 | ||
| 309 | ||
| 310 | 310 | PORT_START /* IN9 */ |
| 311 | 311 | PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("KP 2 `") PORT_CODE(KEYCODE_2_PAD) /* Keypad 2 50 D0 */ |
| 312 | 312 | PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("KP 3 (PgDn)") PORT_CODE(KEYCODE_3_PAD) /* Keypad 3 (PgDn) 51 D1 */ |
| r1461 | r1462 | |
| 319 | 319 | PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Home") PORT_CODE(KEYCODE_HOME) /* HOME 58 D8 */ |
| 320 | 320 | PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F11") PORT_CODE(KEYCODE_F11) /* F11 59 D9 */ |
| 321 | 321 | PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F12") PORT_CODE(KEYCODE_F12) /* F12 5a Da */ |
| 322 | ||
| 322 | ||
| 323 | 323 | PORT_START /* IN10 */ |
| 324 | 324 | PORT_BIT ( 0xffff, 0x0000, IPT_UNUSED ) |
| 325 | ||
| 325 | ||
| 326 | 326 | PORT_START /* IN11 */ |
| 327 | 327 | PORT_BIT ( 0xffff, 0x0000, IPT_UNUSED ) |
| 328 | 328 | INPUT_PORTS_END |
| r1461 | r1462 | |
|---|---|---|
| 104 | 104 | |
| 105 | 105 | // bit 5 - SCLK |
| 106 | 106 | if (!serial_clock || !cbm_serial_clock_read ()) |
| 107 | data &= ~0x20; | |
| 107 | data &= ~0x20; | |
| 108 | 108 | |
| 109 | 109 | // bit 4 - SDATA |
| 110 | 110 | if (!serial_data || !cbm_serial_data_read ()) |
| r1461 | r1462 | |
| 136 | 136 | |
| 137 | 137 | // bit 4 - speaker |
| 138 | 138 | speaker_level_w(0, (data&0x10)>>4); |
| 139 | ||
| 139 | ||
| 140 | 140 | // bit 3 - display buffer |
| 141 | 141 | if (data & 0x08) |
| 142 | 142 | primo_video_memory_base |= 0x2000; |
| r1461 | r1462 | |
| 281 | 281 | cpunum_set_reg(0, Z80_R, snapshot_data[25]); |
| 282 | 282 | cpunum_set_reg(0, Z80_IX, snapshot_data[26] + snapshot_data[27]*256); |
| 283 | 283 | cpunum_set_reg(0, Z80_IY, snapshot_data[28] + snapshot_data[29]*256); |
| 284 | ||
| 285 | 284 | |
| 285 | ||
| 286 | 286 | /* IO ports */ |
| 287 | 287 | |
| 288 | 288 | // KI-1 bit 7 - NMI generator enable/disable |
| r1461 | r1462 | |
| 310 | 310 | free(snapshot_data); |
| 311 | 311 | return INIT_FAIL; |
| 312 | 312 | } |
| 313 | ||
| 313 | ||
| 314 | 314 | if (strncmp((char *)snapshot_data, "PS01", 4)) |
| 315 | 315 | { |
| 316 | 316 | free(snapshot_data); |
| 317 | 317 | return INIT_FAIL; |
| 318 | 318 | } |
| 319 | ||
| 319 | ||
| 320 | 320 | primo_setup_pss(snapshot_data, snapshot_size); |
| 321 | 321 | |
| 322 | 322 | free(snapshot_data); |
| r1461 | r1462 | |
| 360 | 360 | free(quickload_data); |
| 361 | 361 | return INIT_FAIL; |
| 362 | 362 | } |
| 363 | ||
| 363 | ||
| 364 | 364 | primo_setup_pp(quickload_data, quickload_size); |
| 365 | 365 | |
| 366 | 366 | free(quickload_data); |
| r1461 | r1462 | |
|---|---|---|
| 620 | 620 | { |
| 621 | 621 | case TI_85: expected_snapshot_size = TI85_SNAPSHOT_SIZE; break; |
| 622 | 622 | case TI_86: expected_snapshot_size = TI86_SNAPSHOT_SIZE; break; |
| 623 | } | |
| 623 | } | |
| 624 | 624 | |
| 625 | 625 | logerror("Snapshot loading\n"); |
| 626 | 626 | |
| r1461 | r1462 | |
| 674 | 674 | ti85_free_serial_stream (&ti85_serial_stream); |
| 675 | 675 | return INIT_FAIL; |
| 676 | 676 | } |
| 677 | ||
| 677 | ||
| 678 | 678 | ti85_serial_status = TI85_SEND_HEADER; |
| 679 | 679 | } |
| 680 | else | |
| 680 | else | |
| 681 | 681 | { |
| 682 | 682 | return INIT_FAIL; |
| 683 | 683 | } |
| r1461 | r1462 | |
|---|---|---|
| 99 | 99 | { |
| 100 | 100 | if (is_c128()) |
| 101 | 101 | { |
| 102 | if (cpu_getactivecpu()==0) | |
| 102 | if (cpu_getactivecpu()==0) | |
| 103 | 103 | { |
| 104 | 104 | /* z80 */ |
| 105 | 105 | cpunum_set_input_line(0, INPUT_LINE_NMI, KEY_RESTORE||cia1irq); |
| r1461 | r1462 | |
|---|---|---|
| 36 | 36 | |
| 37 | 37 | switch(reg) |
| 38 | 38 | { |
| 39 | case 0x00: // CSR / CER | |
| 39 | case 0x00: // CSR / CER | |
| 40 | 40 | return (dmac.reg[channel].csr << 8) | dmac.reg[channel].cer; |
| 41 | 41 | case 0x02: // DCR / OCR |
| 42 | 42 | return (dmac.reg[channel].dcr << 8) | dmac.reg[channel].ocr; |
| r1461 | r1462 | |
| 84 | 84 | reg = offset & 0x1f; |
| 85 | 85 | switch(reg) |
| 86 | 86 | { |
| 87 | case 0x00: // CSR / CER | |
| 88 | if(ACCESSING_MSB) | |
| 87 | case 0x00: // CSR / CER | |
| 88 | if(ACCESSING_MSB) | |
| 89 | 89 | { |
| 90 | 90 | // dmac.reg[channel].csr = (data & 0xff00) >> 8; |
| 91 | 91 | // logerror("DMA#%i: Channel status write : %02x\n",channel,dmac.reg[channel].csr); |
| r1461 | r1462 | |
| 93 | 93 | // CER is read-only, so no action needed there. |
| 94 | 94 | break; |
| 95 | 95 | case 0x02: // DCR / OCR |
| 96 | if(ACCESSING_MSB) | |
| 96 | if(ACCESSING_MSB) | |
| 97 | 97 | { |
| 98 | 98 | dmac.reg[channel].dcr = (data & 0xff00) >> 8; |
| 99 | 99 | logerror("DMA#%i: Device Control write : %02x\n",channel,dmac.reg[channel].dcr); |
| 100 | 100 | } |
| 101 | if(ACCESSING_LSB) | |
| 101 | if(ACCESSING_LSB) | |
| 102 | 102 | { |
| 103 | 103 | dmac.reg[channel].ocr = data & 0x00ff; |
| 104 | 104 | logerror("DMA#%i: Operation Control write : %02x\n",channel,dmac.reg[channel].ocr); |
| 105 | 105 | } |
| 106 | 106 | break; |
| 107 | 107 | case 0x03: // SCR / CCR |
| 108 | if(ACCESSING_MSB) | |
| 108 | if(ACCESSING_MSB) | |
| 109 | 109 | { |
| 110 | 110 | dmac.reg[channel].scr = (data & 0xff00) >> 8; |
| 111 | 111 | logerror("DMA#%i: Sequence Control write : %02x\n",channel,dmac.reg[channel].scr); |
| 112 | 112 | } |
| 113 | if(ACCESSING_LSB) | |
| 113 | if(ACCESSING_LSB) | |
| 114 | 114 | { |
| 115 | 115 | dmac.reg[channel].ccr = data & 0x00ff; |
| 116 | 116 | if((data & 0x0080))// && !dmac.intf->dma_read[channel] && !dmac.intf->dma_write[channel]) |
| r1461 | r1462 | |
| 266 | 266 | else |
| 267 | 267 | { |
| 268 | 268 | switch(dmac.reg[x].ocr & 0x30) // operation size |
| 269 | { | |
| 269 | { | |
| 270 | 270 | case 0x00: // 8 bit |
| 271 | 271 | data = program_read_byte(dmac.reg[x].dar); // read from device address |
| 272 | 272 | program_write_byte(dmac.reg[x].mar, data); // write to memory address |
| r1461 | r1462 | |
| 304 | 304 | else |
| 305 | 305 | { |
| 306 | 306 | switch(dmac.reg[x].ocr & 0x30) // operation size |
| 307 | { | |
| 307 | { | |
| 308 | 308 | case 0x00: // 8 bit |
| 309 | 309 | data = program_read_byte(dmac.reg[x].mar); // read from memory address |
| 310 | program_write_byte(dmac.reg[x].dar, data); // write to device address | |
| 310 | program_write_byte(dmac.reg[x].dar, data); // write to device address | |
| 311 | 311 | datasize = 1; |
| 312 | 312 | break; |
| 313 | 313 | case 0x10: // 16 bit |
| r1461 | r1462 | |
|---|---|---|
| 365 | 365 | wd17xx_set_density(data & 0x01 ? DEN_FM_LO:DEN_MFM_LO); |
| 366 | 366 | |
| 367 | 367 | wd17xx_set_side(data & 0x02 ? 1:0); |
| 368 | ||
| 368 | ||
| 369 | 369 | image = image_from_devtype_and_index(IO_FLOPPY, svi318_fdc.driveselect); |
| 370 | 370 | if (image_exists(image)) |
| 371 | 371 | { |
| r1461 | r1462 | |
| 387 | 387 | { |
| 388 | 388 | unsigned long o; |
| 389 | 389 | |
| 390 | if ((t==0) && (h==0)) | |
| 391 | o = (s-first_sector_id)*128; | |
| 390 | if ((t==0) && (h==0)) | |
| 391 | o = (s-first_sector_id)*128; | |
| 392 | 392 | else |
| 393 | 393 | o = ((t*heads+h)*17+s-first_sector_id)*256-2048; /* (17*256)-(18*128)=2048 */ |
| 394 | 394 |
| r1461 | r1462 | |
|---|---|---|
| 12 | 12 | void (*dma_end)(int channel,int irq); // called when the DMA transfer ends |
| 13 | 13 | void (*dma_error)(int channel, int irq); // called when a DMA transfer error occurs |
| 14 | 14 | int (*dma_read[4])(int addr); // special read / write handlers for each channel |
| 15 | void (*dma_write[4])(int addr,int data); | |
| 15 | void (*dma_write[4])(int addr,int data); | |
| 16 | 16 | }; |
| 17 | 17 | |
| 18 | 18 | struct hd63450 |
| r1461 | r1462 | |
| 43 | 43 | int transfer_size[4]; |
| 44 | 44 | int halted[4]; // non-zero if a channel has been halted, and can be continued later. |
| 45 | 45 | const struct hd63450_interface* intf; |
| 46 | }; | |
| 46 | }; | |
| 47 | 47 | |
| 48 | 48 | void hd63450_init(const struct hd63450_interface* intf); |
| 49 | 49 | int hd63450_read(int offset, UINT16 mem_mask); |
| r1461 | r1462 | |
|---|---|---|
| 69 | 69 | pc_turbo_setup(0, 3, 0x02, 4.77/12, 1); |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | DRIVER_INIT( europc ) | |
| 72 | DRIVER_INIT( europc ) | |
| 73 | 73 | { |
| 74 | 74 | UINT8 *gfx = &memory_region(REGION_GFX1)[0x8000]; |
| 75 | 75 | UINT8 *rom = &memory_region(REGION_CPU1)[0]; |
| r1461 | r1462 | |
|---|---|---|
| 52 | 52 | fca69 |
| 53 | 53 | fd680 |
| 54 | 54 | fd7f9 |
| 55 | fca7b !keyboard interrupt routine for this check | |
| 55 | fca7b !keyboard interrupt routine for this check | |
| 56 | 56 | */ |
| 57 | 57 | |
| 58 | 58 | |
| r1461 | r1462 | |
| 116 | 116 | /* test sequence in bios |
| 117 | 117 | write 00 to 65 |
| 118 | 118 | write 30 to 61 |
| 119 | read 62 and (0x10) | |
| 119 | read 62 and (0x10) | |
| 120 | 120 | write 34 to 61 |
| 121 | 121 | read 62 and (0x0f) |
| 122 | return or of the 2 62 reads | |
| 122 | return or of the 2 62 reads | |
| 123 | 123 | |
| 124 | 124 | allows set of the original ibm pc "dipswitches"!!!! |
| 125 | 125 | |
| r1461 | r1462 | |
| 127 | 127 | */ |
| 128 | 128 | |
| 129 | 129 | /* mouse x counter at 0x78 (read- writable) |
| 130 | mouse y counter at 0x7a (read- writable) | |
| 130 | mouse y counter at 0x7a (read- writable) | |
| 131 | 131 | |
| 132 | 132 | mouse button 1,2 keys |
| 133 | 133 | joystick (4 directions, 2 buttons) keys |
| r1461 | r1462 | |
| 164 | 164 | pc1640.port60=data; |
| 165 | 165 | } |
| 166 | 166 | break; |
| 167 | case 5: | |
| 167 | case 5: | |
| 168 | 168 | // stores the configuration data for port 62 configuration dipswitch emulation |
| 169 | pc1640.port65=data; | |
| 169 | pc1640.port65=data; | |
| 170 | 170 | break; |
| 171 | 171 | } |
| 172 | ||
| 172 | ||
| 173 | 173 | logerror("pc1640 write %.2x %.2x\n",offset,data); |
| 174 | 174 | } |
| 175 | 175 | |
| r1461 | r1462 | |
| 181 | 181 | case 0: |
| 182 | 182 | if (pc1640.port61&0x80) |
| 183 | 183 | data=pc1640.port60; |
| 184 | else | |
| 184 | else | |
| 185 | 185 | data = pc_keyb_read(); |
| 186 | 186 | break; |
| 187 | 187 | |
| r1461 | r1462 | |
| 189 | 189 | data = pc1640.port61; |
| 190 | 190 | break; |
| 191 | 191 | |
| 192 | case 2: | |
| 192 | case 2: | |
| 193 | 193 | data = pc1640.port62; |
| 194 | 194 | if (pit8253_get_output(0, 2)) |
| 195 | 195 | data |= 0x20; |
| r1461 | r1462 | |
| 393 | 393 | PORT_START_TAG("pc_mouse_misc") |
| 394 | 394 | PORT_BIT ( 0xffff, 0x0000, IPT_UNUSED ) |
| 395 | 395 | |
| 396 | PORT_START_TAG( "pc_mouse_x" ) /* Mouse - X AXIS */ | |
| 396 | PORT_START_TAG( "pc_mouse_x" ) /* Mouse - X AXIS */ | |
| 397 | 397 | PORT_BIT( 0xff, 0x00, IPT_MOUSE_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(1) PORT_REVERSE |
| 398 | 398 | |
| 399 | 399 | PORT_START_TAG( "pc_mouse_y" ) /* Mouse - Y AXIS */ |
| r1461 | r1462 | |
|---|---|---|
| 313 | 313 | return INIT_FAIL; |
| 314 | 314 | } |
| 315 | 315 | return INIT_PASS; |
| 316 | } | |
| 316 | } | |
| 317 | 317 | |
| 318 | 318 | return INIT_FAIL; |
| 319 | 319 | } |
| r1461 | r1462 | |
| 502 | 502 | } |
| 503 | 503 | |
| 504 | 504 | /* |
| 505 | Select currently selected drive | |
| 505 | Select currently selected drive | |
| 506 | 506 | */ |
| 507 | 507 | static int get_selected_drive(int which, select_mode_t *select_mode, int *disk_unit) |
| 508 | 508 | { |
| r1461 | r1462 | |
|---|---|---|
| 732 | 732 | tms9901_init(0, & tms9901reset_param_ti99_4x); |
| 733 | 733 | |
| 734 | 734 | TMS9928A_configure(gfxparm); |
| 735 | ||
| 735 | ||
| 736 | 736 | /* Initialize all. Actually, at this point, we don't know |
| 737 | how the switches are set. Later we use the configuration switches to | |
| 737 | how the switches are set. Later we use the configuration switches to | |
| 738 | 738 | determine which one to use. */ |
| 739 | 739 | ti99_peb_init(); |
| 740 | 740 | ti99_fdc_init(); |
| r1461 | r1462 | |
| 786 | 786 | |
| 787 | 787 | /* init tms9901 */ |
| 788 | 788 | tms9901_reset(0); |
| 789 | ||
| 789 | ||
| 790 | 790 | if (!has_evpc) TMS9928A_reset(); |
| 791 | 791 | else v9938_reset(); |
| 792 | 792 | |
| r1461 | r1462 | |
| 1019 | 1019 | |
| 1020 | 1020 | /* |
| 1021 | 1021 | TI-99 cartridge port: attached to the 8-bit bus. |
| 1022 | ||
| 1022 | ||
| 1023 | 1023 | Cartridges are usually made of ROM, through a few cartridges include some |
| 1024 | 1024 | RAM as well. Bank switching is common: I know three banking schemes, |
| 1025 | 1025 | namely TI, MBX and Supercart. The TI scheme writes a dummy value in |
| r1461 | r1462 | |
| 1866 | 1866 | |
| 1867 | 1867 | return TRUE; |
| 1868 | 1868 | } |
| 1869 | ||
| 1869 | ||
| 1870 | 1870 | } |
| 1871 | 1871 | |
| 1872 | 1872 | current_key = 0; /* default value if no key is down */ |
| r1461 | r1462 | |
| 1895 | 1895 | |
| 1896 | 1896 | return TRUE; |
| 1897 | 1897 | } |
| 1898 | ||
| 1898 | ||
| 1899 | 1899 | return FALSE; |
| 1900 | 1900 | } |
| 1901 | 1901 |
| r1461 | r1462 | |
|---|---|---|
| 158 | 158 | |
| 159 | 159 | timer_set(ATTOTIME_IN_SEC(1), NULL, 0, pc1251_power_up); |
| 160 | 160 | |
| 161 | // c600 b800 b000 a000 8000 tested | |
| 161 | // c600 b800 b000 a000 8000 tested | |
| 162 | 162 | // 4 kb memory feedback 512 bytes too few??? |
| 163 | 163 | // 11 kb ram: program stored at 8000 |
| 164 | 164 | #if 1 |
| r1461 | r1462 | |
|---|---|---|
| 50 | 50 | /* setup this side of the serial connection */ |
| 51 | 51 | serial_connection_init(&uart.connection); |
| 52 | 52 | serial_connection_set_in_callback(&uart.connection, msm8251_in_callback); |
| 53 | uart.connection.input_state = 0; | |
| 53 | uart.connection.input_state = 0; | |
| 54 | 54 | /* reset chip */ |
| 55 | 55 | msm8251_reset(); |
| 56 | 56 | |
| r1461 | r1462 | |
| 70 | 70 | |
| 71 | 71 | if (uart.interface.rx_ready_callback) |
| 72 | 72 | uart.interface.rx_ready_callback((state!=0)); |
| 73 | ||
| 73 | ||
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | void msm8251_receive_clock(void) |
| r1461 | r1462 | |
| 81 | 81 | //logerror("MSM8251\n"); |
| 82 | 82 | /* get bit received from other side and update receive register */ |
| 83 | 83 | receive_register_update_bit(&uart.receive_reg, get_in_data_bit(uart.connection.input_state)); |
| 84 | ||
| 84 | ||
| 85 | 85 | if (uart.receive_reg.flags & RECEIVE_REGISTER_FULL) |
| 86 | 86 | { |
| 87 | 87 | receive_register_extract(&uart.receive_reg, &uart.data_form); |
| r1461 | r1462 | |
| 108 | 108 | uart.status |=MSM8251_STATUS_TX_EMPTY; |
| 109 | 109 | /* ready for next transmit */ |
| 110 | 110 | uart.status |=MSM8251_STATUS_TX_READY; |
| 111 | ||
| 111 | ||
| 112 | 112 | msm8251_update_tx_empty(); |
| 113 | 113 | msm8251_update_tx_ready(); |
| 114 | 114 | } |
| 115 | 115 | } |
| 116 | ||
| 116 | ||
| 117 | 117 | /* if transmit is not empty... transmit data */ |
| 118 | 118 | if ((uart.transmit_reg.flags & TRANSMIT_REGISTER_EMPTY)==0) |
| 119 | 119 | { |
| r1461 | r1462 | |
| 155 | 155 | { |
| 156 | 156 | /* clear tx ready state */ |
| 157 | 157 | int tx_ready; |
| 158 | ||
| 158 | ||
| 159 | 159 | /* tx ready output is set if: |
| 160 | 160 | DB Buffer Empty & |
| 161 | 161 | CTS is set & |
| 162 | Transmit enable is 1 | |
| 162 | Transmit enable is 1 | |
| 163 | 163 | */ |
| 164 | 164 | |
| 165 | 165 | |
| r1461 | r1462 | |
| 193 | 193 | } |
| 194 | 194 | if (uart.interface.tx_empty_callback) |
| 195 | 195 | uart.interface.tx_empty_callback(((uart.status & MSM8251_STATUS_TX_EMPTY)!=0)); |
| 196 | ||
| 196 | ||
| 197 | 197 | } |
| 198 | 198 | |
| 199 | 199 | void msm8251_reset(void) |
| r1461 | r1462 | |
| 266 | 266 | if ((data & 0x03)!=0) |
| 267 | 267 | { |
| 268 | 268 | /* Asynchronous |
| 269 | ||
| 269 | ||
| 270 | 270 | bit 7,6: stop bit length |
| 271 | 271 | 0 = inhibit |
| 272 | 272 | 1 = 1 bit |
| r1461 | r1462 | |
| 283 | 283 | 1 = 6 bits |
| 284 | 284 | 2 = 7 bits |
| 285 | 285 | 3 = 8 bits |
| 286 | bit 1,0: baud rate factor | |
| 286 | bit 1,0: baud rate factor | |
| 287 | 287 | 0 = defines command byte for synchronous or asynchronous |
| 288 | 288 | 1 = x1 |
| 289 | 289 | 2 = x16 |
| r1461 | r1462 | |
| 354 | 354 | uart.data_form.word_length = ((data>>2) & 0x03)+5; |
| 355 | 355 | uart.data_form.parity = SERIAL_PARITY_NONE; |
| 356 | 356 | switch ((data>>6) & 0x03) |
| 357 | { | |
| 357 | { | |
| 358 | 358 | case 0: |
| 359 | 359 | case 1: |
| 360 | 360 | uart.data_form.stop_bit_count = 1; |
| r1461 | r1462 | |
| 365 | 365 | break; |
| 366 | 366 | } |
| 367 | 367 | receive_register_setup(&uart.receive_reg, &uart.data_form); |
| 368 | ||
| 369 | 368 | |
| 369 | ||
| 370 | 370 | #if 0 |
| 371 | 371 | /* data bits */ |
| 372 | 372 | uart.receive_char_length = (((data>>2) & 0x03)+5); |
| 373 | ||
| 373 | ||
| 374 | 374 | if (data & (1<<4)) |
| 375 | 375 | { |
| 376 | 376 | /* parity */ |
| r1461 | r1462 | |
| 389 | 389 | } |
| 390 | 390 | else |
| 391 | 391 | { |
| 392 | /* bit 7: Number of sync characters | |
| 392 | /* bit 7: Number of sync characters | |
| 393 | 393 | 0 = 1 character |
| 394 | 394 | 1 = 2 character |
| 395 | 395 | bit 6: Synchronous mode |
| r1461 | r1462 | |
| 477 | 477 | |
| 478 | 478 | |
| 479 | 479 | #endif |
| 480 | ||
| 481 | 480 | |
| 482 | /* bit 7: | |
| 481 | ||
| 482 | /* bit 7: | |
| 483 | 483 | 0 = normal operation |
| 484 | 484 | 1 = hunt mode |
| 485 | bit 6: | |
| 485 | bit 6: | |
| 486 | 486 | 0 = normal operation |
| 487 | 487 | 1 = internal reset |
| 488 | 488 | bit 5: |
| r1461 | r1462 | |
| 502 | 502 | 1 = /DTR set to 0 |
| 503 | 503 | bit 0: |
| 504 | 504 | 0 = transmit disable |
| 505 | 1 = transmit enable | |
| 505 | 1 = transmit enable | |
| 506 | 506 | */ |
| 507 | ||
| 507 | ||
| 508 | 508 | uart.connection.State &=~SERIAL_STATE_RTS; |
| 509 | 509 | if (data & (1<<5)) |
| 510 | 510 | { |
| r1461 | r1462 | |
| 575 | 575 | logerror("msm8251 receive char: %02x\n",ch); |
| 576 | 576 | |
| 577 | 577 | uart.data = ch; |
| 578 | ||
| 578 | ||
| 579 | 579 | /* char has not been read and another has arrived! */ |
| 580 | 580 | if (uart.status & MSM8251_STATUS_RX_READY) |
| 581 | 581 | { |
| r1461 | r1462 | |
| 592 | 592 | logerror("read data: %02x\n",uart.data); |
| 593 | 593 | /* reading clears */ |
| 594 | 594 | uart.status &= ~MSM8251_STATUS_RX_READY; |
| 595 | ||
| 595 | ||
| 596 | 596 | msm8251_update_rx_ready(); |
| 597 | 597 | return uart.data; |
| 598 | 598 | } |
| r1461 | r1462 | |
|---|---|---|
| 445 | 445 | case 'S': /* status */ |
| 446 | 446 | sprintf(atari_frame_message, "DRIVE #%d STATUS", drive+1); |
| 447 | 447 | atari_frame_counter = Machine->screen[0].refresh/2; |
| 448 | ||
| 448 | ||
| 449 | 449 | if (VERBOSE_SERIAL) |
| 450 | 450 | logerror("atari status\n"); |
| 451 | 451 | |
| r1461 | r1462 | |
| 629 | 629 | if (sector < 4) /* sector 1 .. 3 might be different length */ |
| 630 | 630 | { |
| 631 | 631 | offset = (sector - 1) * drv[drive].bseclen + drv[drive].header_skip; |
| 632 | ||
| 632 | ||
| 633 | 633 | if (VERBOSE_SERIAL) |
| 634 | 634 | logerror("atari storing 128 byte sector %d at offset 0x%08X", sector, offset ); |
| 635 | 635 |
| r1461 | r1462 | |
|---|---|---|
| 56 | 56 | #define TMS5501_TIMER_3_INT 0x40 |
| 57 | 57 | #define TMS5501_TIMER_4_INT 0x80 |
| 58 | 58 | #define TMS5501_INT_7_INT 0x80 |
| 59 | ||
| 59 | ||
| 60 | 60 | #define TMS5501_PIO_INT_7 0x80 |
| 61 | 61 | |
| 62 | 62 | typedef struct tms5501_t |
| r1461 | r1462 | |
| 125 | 125 | if (current_ints) |
| 126 | 126 | { |
| 127 | 127 | /* selecting interrupt with highest priority */ |
| 128 | int level = find_first_bit(current_ints); | |
| 128 | int level = find_first_bit(current_ints); | |
| 129 | 129 | LOG_TMS5501(which, "Interrupt level", level); |
| 130 | 130 | |
| 131 | 131 | /* reseting proper bit in pending interrupts register */ |
| r1461 | r1462 | |
| 349 | 349 | break; |
| 350 | 350 | case 0x04: /* Command register */ |
| 351 | 351 | data = tms5501[which].command; |
| 352 | LOG_TMS5501(which, "Command register read", data); | |
| 352 | LOG_TMS5501(which, "Command register read", data); | |
| 353 | 353 | break; |
| 354 | 354 | case 0x05: /* Serial rate register */ |
| 355 | 355 | data = tms5501[which].sio_rate; |
| r1461 | r1462 | |
| 360 | 360 | break; |
| 361 | 361 | case 0x08: /* Interrupt mask register */ |
| 362 | 362 | data = tms5501[which].interrupt_mask; |
| 363 | LOG_TMS5501(which, "Interrupt mask read", data); | |
| 363 | LOG_TMS5501(which, "Interrupt mask read", data); | |
| 364 | 364 | break; |
| 365 | 365 | case 0x09: /* Timer 0 address */ |
| 366 | 366 | case 0x0a: /* Timer 1 address */ |
| r1461 | r1462 | |
|---|---|---|
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | image_fread(image, snapshot_data, snapshot_size); |
| 145 | ||
| 145 | ||
| 146 | 146 | galaxy_setup_snapshot(snapshot_data, snapshot_size); |
| 147 | 147 | |
| 148 | 148 | return INIT_PASS; |
| r1461 | r1462 | |
|---|---|---|
| 5 | 5 | |
| 6 | 6 | Per Ola Ingvarsson |
| 7 | 7 | Tomas Karlsson |
| 8 | ||
| 8 | ||
| 9 | 9 | ******************************************************************************/ |
| 10 | 10 | |
| 11 | 11 | /*-------------------------------------------------------------------------*/ |
| r1461 | r1462 | |
| 222 | 222 | UINT8 icol; |
| 223 | 223 | UINT16 data; |
| 224 | 224 | UINT16 ibit; |
| 225 | ||
| 225 | ||
| 226 | 226 | key_code = 0; |
| 227 | 227 | key_status = 0x80; |
| 228 | 228 | |
| r1461 | r1462 | |
| 314 | 314 | } |
| 315 | 315 | } |
| 316 | 316 | |
| 317 | static const nec765_interface compis_fdc_interface = | |
| 317 | static const nec765_interface compis_fdc_interface = | |
| 318 | 318 | { |
| 319 | 319 | compis_fdc_int, |
| 320 | 320 | compis_fdc_dma_drq |
| r1461 | r1462 | |
| 329 | 329 | { |
| 330 | 330 | data = nec765_dack_r(0); |
| 331 | 331 | } |
| 332 | ||
| 332 | ||
| 333 | 333 | return data; |
| 334 | 334 | } |
| 335 | 335 | |
| r1461 | r1462 | |
| 429 | 429 | /* FDC Reset */ |
| 430 | 430 | if (data & 0x40) |
| 431 | 431 | compis_fdc_reset(); |
| 432 | ||
| 432 | ||
| 433 | 433 | /* FDC Terminal count */ |
| 434 | 434 | compis_fdc_tc((data & 0x80)?1:0); |
| 435 | 435 | } |
| r1461 | r1462 | |
| 852 | 852 | internal_timer_sync(which); |
| 853 | 853 | update_int_timer = 1; |
| 854 | 854 | } |
| 855 | ||
| 855 | ||
| 856 | 856 | t->maxB = new_maxB; |
| 857 | ||
| 857 | ||
| 858 | 858 | if (new_maxB == 0) |
| 859 | 859 | { |
| 860 | 860 | new_maxB = 0x10000; |
| 861 | 861 | } |
| 862 | 862 | } |
| 863 | ||
| 864 | 863 | |
| 864 | ||
| 865 | 865 | /* handle control changes */ |
| 866 | 866 | if (new_control != -1) |
| 867 | 867 | { |
| r1461 | r1462 | |
| 980 | 980 | /* check for control bits we don't handle */ |
| 981 | 981 | diff = new_control ^ d->control; |
| 982 | 982 | if (diff & 0x6811) |
| 983 | logerror("%05X:ERROR! - unsupported DMA mode %04X\n", | |
| 983 | logerror("%05X:ERROR! - unsupported DMA mode %04X\n", | |
| 984 | 984 | activecpu_get_pc(), |
| 985 | 985 | new_control); |
| 986 | 986 | |
| r1461 | r1462 | |
| 1582 | 1582 | |
| 1583 | 1583 | /* OSP PIT 8254 */ |
| 1584 | 1584 | pit8253_init(2, compis_pit_config); |
| 1585 | ||
| 1585 | ||
| 1586 | 1586 | /* PPI */ |
| 1587 | 1587 | ppi8255_init(&compis_ppi_interface); |
| 1588 | ||
| 1588 | ||
| 1589 | 1589 | /* FDC */ |
| 1590 | 1590 | nec765_init(&compis_fdc_interface, NEC765A); |
| 1591 | 1591 | compis_fdc_reset(); |
| r1461 | r1462 | |
|---|---|---|
| 236 | 236 | nec765_init(&kc_fdc_interface,NEC765A); |
| 237 | 237 | |
| 238 | 238 | /* reset ctc */ |
| 239 | z80ctc_reset(1); | |
| 239 | z80ctc_reset(1); | |
| 240 | 240 | |
| 241 | 241 | /* hold cpu at reset */ |
| 242 | 242 | cpunum_set_input_line(1, INPUT_LINE_RESET, ASSERT_LINE); |
| r1461 | r1462 | |
| 1719 | 1719 | static OPBASE_HANDLER( kc85_4_opbaseoverride ) |
| 1720 | 1720 | { |
| 1721 | 1721 | memory_set_opbase_handler(0,0); |
| 1722 | ||
| 1722 | ||
| 1723 | 1723 | kc85_4_update_0x00000(); |
| 1724 | 1724 | |
| 1725 | 1725 | return (cpunum_get_reg(0, REG_PC) & 0x0ffff); |
| r1461 | r1462 | |
|---|---|---|
| 1 | // | |
| 1 | // | |
| 2 | 2 | // corvus_hd |
| 3 | // | |
| 3 | // | |
| 4 | 4 | // Implementation of a Corvus Hard Drive / Host Bus Adapter pair. The drive |
| 5 | 5 | // being emulated is a Rev B drive, functionally speaking, rather than an Omnidrive. |
| 6 | // | |
| 6 | // | |
| 7 | 7 | // The Corvus Flat Cable HBA is a very simplistic device due to the fact that most |
| 8 | // of the smarts are in the Hard Drive itself. What's in the hard drive includes a | |
| 8 | // of the smarts are in the Hard Drive itself. What's in the hard drive includes a | |
| 9 | 9 | // Z80 processor, 4K of EPROM and 5KB of RAM. Ultimately, a true emulation would include |
| 10 | 10 | // the on-boad controller; however, that is outside the current scope of this code. Maybe |
| 11 | 11 | // if I could get a Rev. B/H drive, it could be reverse-engineered to do this. |
| r1461 | r1462 | |
| 54 | 54 | // Brett Wyer |
| 55 | 55 | // |
| 56 | 56 | // |
| 57 | // TODO: | |
| 57 | // TODO: | |
| 58 | 58 | // Implement READY line glitch after last byte of command (Disk System Tech Ref pp. 3) |
| 59 | 59 | // Implement Read-after-Write (always happens on Rev B/H drives per Mass Storage GTI pp. 12) |
| 60 | 60 | // Implement Multiple physical drive support - Up to four |
| r1461 | r1462 | |
| 405 | 405 | |
| 406 | 406 | for(offset=0; offset < length; offset++) { |
| 407 | 407 | if(offset % 16 == 0) { // WHY IS 0 % 16 == 0??? |
| 408 | if(offset > 0 && offset % 16 == 0) | |
| 408 | if(offset > 0 && offset % 16 == 0) | |
| 409 | 409 | logerror("%16.16s", ascii_dump); |
| 410 | 410 | logerror("\n%4.4x: %2.2x ", offset, *(buffer + offset)); |
| 411 | 411 | } else { |
| r1461 | r1462 | |
| 471 | 471 | c->recv_bytes = corvus_cmd[data][0].recv_bytes; |
| 472 | 472 | c->xmit_bytes = corvus_cmd[data][0].xmit_bytes; |
| 473 | 473 | #if VERBOSE |
| 474 | logerror("parse_hdc_command: Single byte command recoginized: 0x%2.2x, to recv: %d, to xmit: %d\n", data, | |
| 474 | logerror("parse_hdc_command: Single byte command recoginized: 0x%2.2x, to recv: %d, to xmit: %d\n", data, | |
| 475 | 475 | c->recv_bytes, c->xmit_bytes); |
| 476 | 476 | #endif |
| 477 | 477 | break; |
| r1461 | r1462 | |
| 523 | 523 | c->recv_bytes = corvus_prep_cmd[data].recv_bytes; |
| 524 | 524 | c->xmit_bytes = corvus_prep_cmd[data].xmit_bytes; |
| 525 | 525 | #if VERBOSE |
| 526 | logerror("parse_hdc_command: Prep command recognized: 0x%2.2x, to recv: %d, to xmit: %d\n", data, | |
| 526 | logerror("parse_hdc_command: Prep command recognized: 0x%2.2x, to recv: %d, to xmit: %d\n", data, | |
| 527 | 527 | c->recv_bytes, c->xmit_bytes); |
| 528 | 528 | #endif |
| 529 | 529 | break; |
| r1461 | r1462 | |
| 647 | 647 | sector = (dadr->address_msn_and_drive & 0xf0 << 12) | (dadr->address_mid << 8) | dadr->address_lsb; |
| 648 | 648 | |
| 649 | 649 | #if VERBOSE |
| 650 | logerror("corvus_write_logical_sector: Writing based on DADR: 0x%6.6x, logical sector: 0x%5.5x, drive: %d\n", | |
| 650 | logerror("corvus_write_logical_sector: Writing based on DADR: 0x%6.6x, logical sector: 0x%5.5x, drive: %d\n", | |
| 651 | 651 | dadr->address_msn_and_drive << 16 | dadr->address_lsb << 8 | dadr->address_mid, sector, drv); |
| 652 | 652 | #endif |
| 653 | 653 | |
| r1461 | r1462 | |
| 758 | 758 | sector = (dadr->address_msn_and_drive & 0xf0 << 12) | (dadr->address_mid << 8) | dadr->address_lsb; |
| 759 | 759 | |
| 760 | 760 | #if VERBOSE |
| 761 | logerror("corvus_read_logical_sector: Reading based on DADR: 0x%6.6x, logical sector: 0x%5.5x, drive: %d\n", | |
| 761 | logerror("corvus_read_logical_sector: Reading based on DADR: 0x%6.6x, logical sector: 0x%5.5x, drive: %d\n", | |
| 762 | 762 | dadr->address_msn_and_drive << 16 | dadr->address_lsb << 8 | dadr->address_mid, sector, drv); |
| 763 | 763 | #endif |
| 764 | 764 | |
| r1461 | r1462 | |
| 1070 | 1070 | // Corvus_Read_Boot_Block |
| 1071 | 1071 | // |
| 1072 | 1072 | // Old-style Boot (0x14) command boot block reader |
| 1073 | // | |
| 1073 | // | |
| 1074 | 1074 | // Pass: |
| 1075 | 1075 | // block: Boot block number to read (0-7) |
| 1076 | 1076 | // |
| r1461 | r1462 | |
| 1086 | 1086 | #endif |
| 1087 | 1087 | |
| 1088 | 1088 | return corvus_read_sector(0, 25 + block, c->buffer.read_512_response.data, 512); |
| 1089 | ||
| 1089 | ||
| 1090 | 1090 | } |
| 1091 | 1091 | |
| 1092 | 1092 | |
| r1461 | r1462 | |
| 1220 | 1220 | static hard_disk_file *corvus_hdc_file(int id) { |
| 1221 | 1221 | |
| 1222 | 1222 | mess_image *img; |
| 1223 | ||
| 1223 | ||
| 1224 | 1224 | img = image_from_devtype_and_index(IO_HARDDISK, id); |
| 1225 | 1225 | if (!image_exists(img)) |
| 1226 | 1226 | return NULL; |
| r1461 | r1462 | |
| 1301 | 1301 | c->buffer.single_byte_response.status = corvus_init_semaphore_table(); |
| 1302 | 1302 | break; |
| 1303 | 1303 | case SEMAPHORE_STATUS_MOD: |
| 1304 | c->buffer.semaphore_status_response.status = | |
| 1304 | c->buffer.semaphore_status_response.status = | |
| 1305 | 1305 | corvus_read_sector(0, 7, c->buffer.semaphore_status_response.table, 256); |
| 1306 | 1306 | break; |
| 1307 | 1307 | default: |
| r1461 | r1462 | |
| 1374 | 1374 | // |
| 1375 | 1375 | // An Illegal command was detected (Truly invalid, not just unimplemented) |
| 1376 | 1376 | // |
| 1377 | c->buffer.single_byte_response.status = | |
| 1377 | c->buffer.single_byte_response.status = | |
| 1378 | 1378 | STAT_FATAL_ERR | STAT_ILL_CMD_OP_CODE; // Respond with an Illegal Op Code |
| 1379 | 1379 | |
| 1380 | 1380 | logerror("corvus_hdc_data_w: Illegal Command, status: 0x%2.2x\n", c->buffer.single_byte_response.status); |
| r1461 | r1462 | |
| 1669 | 1669 | c->offset = 0; // We've reached the end of valid data |
| 1670 | 1670 | c->xmit_bytes = 0; // We don't have anything more to say |
| 1671 | 1671 | c->recv_bytes = 0; // No active commands |
| 1672 | ||
| 1672 | ||
| 1673 | 1673 | timer_set((ATTOTIME_IN_USEC(INTERBYTE_DELAY)), NULL, CALLBACK_HTC_MODE, corvus_hdc_callback); |
| 1674 | 1674 | |
| 1675 | 1675 | // c->status &= ~(CONTROLLER_DIRECTION | CONTROLLER_BUSY); // Put us in Idle, Host-to-Controller mode |
| r1461 | r1462 | |
| 1677 | 1677 | // |
| 1678 | 1678 | // Not finished with this packet. Insert an interbyte delay and then let the host continue |
| 1679 | 1679 | // |
| 1680 | timer_set((ATTOTIME_IN_USEC(INTERBYTE_DELAY)), NULL, CALLBACK_SAME_MODE, corvus_hdc_callback); | |
| 1680 | timer_set((ATTOTIME_IN_USEC(INTERBYTE_DELAY)), NULL, CALLBACK_SAME_MODE, corvus_hdc_callback); | |
| 1681 | 1681 | } |
| 1682 | 1682 | |
| 1683 | 1683 | return result; |
| r1461 | r1462 | |
|---|---|---|
| 45 | 45 | XML_Parser parser; |
| 46 | 46 | hash_file *hashfile; |
| 47 | 47 | int done; |
| 48 | ||
| 48 | ||
| 49 | 49 | int (*selector_proc)(hash_file *hashfile, void *param, const char *name, const char *hash); |
| 50 | 50 | void (*use_proc)(hash_file *hashfile, void *param, struct hash_info *hi); |
| 51 | 51 | void (*error_proc)(const char *message); |
| r1461 | r1462 | |
| 317 | 317 | while(!state.done) |
| 318 | 318 | { |
| 319 | 319 | len = mame_fread(hashfile->file, buf, sizeof(buf)); |
| 320 | state.done = mame_feof(hashfile->file); | |
| 320 | state.done = mame_feof(hashfile->file); | |
| 321 | 321 | if (XML_Parse(state.parser, buf, len, state.done) == XML_STATUS_ERROR) |
| 322 | 322 | { |
| 323 | 323 | parse_error(&state, "[%d:%d]: %s\n", |
| r1461 | r1462 | |
| 365 | 365 | if (!pool) |
| 366 | 366 | goto error; |
| 367 | 367 | |
| 368 | /* allocate space for this hash file */ | |
| 368 | /* allocate space for this hash file */ | |
| 369 | 369 | hashfile = (hash_file *) pool_malloc(pool, sizeof(*hashfile)); |
| 370 | 370 | if (!hashfile) |
| 371 | 371 | goto error; |
| r1461 | r1462 | |
| 471 | 471 | int hashfile_verify(const char *sysname, void (*my_error_proc)(const char *message)) |
| 472 | 472 | { |
| 473 | 473 | hash_file *hashfile; |
| 474 | ||
| 474 | ||
| 475 | 475 | hashfile = hashfile_open(sysname, FALSE, my_error_proc); |
| 476 | 476 | if (!hashfile) |
| 477 | 477 | return -1; |
| r1461 | r1462 | |
|---|---|---|
| 36 | 36 | static TILE_GET_INFO(terminal_gettileinfo) |
| 37 | 37 | { |
| 38 | 38 | int ch, gfxfont, code, color; |
| 39 | ||
| 39 | ||
| 40 | 40 | ch = current_terminal->mem[tile_index]; |
| 41 | 41 | code = ch & ((1 << current_terminal->char_bits) - 1); |
| 42 | 42 | color = ch >> current_terminal->char_bits; |
| r1461 | r1462 | |
|---|---|---|
| 99 | 99 | { |
| 100 | 100 | int count; |
| 101 | 101 | char buf[1024]; |
| 102 | ||
| 102 | ||
| 103 | 103 | count = vsnprintf(buf, sizeof(buf) / sizeof(buf[0]), fmt, args); |
| 104 | 104 | if (pile_write(pile, buf, count * sizeof(*buf))) |
| 105 | 105 | return 0; |
| r1461 | r1462 | |
|---|---|---|
| 24 | 24 | |
| 25 | 25 | CASSETTE_FORMATLIST_EXTERN( to7_cassette_formats ); |
| 26 | 26 | |
| 27 | extern void to7_cassette_getinfo( const device_class *devclass, | |
| 27 | extern void to7_cassette_getinfo( const device_class *devclass, | |
| 28 | 28 | UINT32 state, union devinfo *info ); |
| 29 | 29 | |
| 30 | 30 | |
| r1461 | r1462 | |
| 40 | 40 | |
| 41 | 41 | CASSETTE_FORMATLIST_EXTERN( mo5_cassette_formats ); |
| 42 | 42 | |
| 43 | extern void mo5_cassette_getinfo( const device_class *devclass, | |
| 43 | extern void mo5_cassette_getinfo( const device_class *devclass, | |
| 44 | 44 | UINT32 state, union devinfo *info ); |
| 45 | 45 | |
| 46 | 46 | #endif |
| r1461 | r1462 | |
|---|---|---|
| 16 | 16 | if (memcmp (casdata, CasHeader, sizeof (CasHeader) ) ) return -1; |
| 17 | 17 | |
| 18 | 18 | pos = size = 0; |
| 19 | ||
| 19 | ||
| 20 | 20 | while (pos < caslen) |
| 21 | 21 | { |
| 22 | 22 | if ( (pos + 8) < caslen) |
| 23 | if (!memcmp (casdata + pos, CasHeader, 8) ) | |
| 23 | if (!memcmp (casdata + pos, CasHeader, 8) ) | |
| 24 | 24 | { |
| 25 | 25 | size += (CAS_EMPTY_PERIODS + CAS_HEADER_PERIODS) * CAS_PERIOD; |
| 26 | 26 | pos += 8; |
| r1461 | r1462 | |
|---|---|---|
| 3 | 3 | #include "formats/basicdsk.h" |
| 4 | 4 | #include "formats/coco_dsk.h" |
| 5 | 5 | |
| 6 | /* ----------------------------------------------------------------------- | |
| 7 | * JV1 (Jeff Vavasour 1) format | |
| 8 | * | |
| 9 | * Used by Jeff Vavasour's TRS-80 Emulators | |
| 6 | /* ----------------------------------------------------------------------- | |
| 7 | * JV1 (Jeff Vavasour 1) format | |
| 10 | 8 | * |
| 9 | * Used by Jeff Vavasour's TRS-80 Emulators | |
| 10 | * | |
| 11 | 11 | * Very straight basic disk; 1 head, 10 sectors, 256 sector length |
| 12 | 12 | * ----------------------------------------------------------------------- */ |
| 13 | 13 |
| r1461 | r1462 | |
|---|---|---|
| 18 | 18 | /* 500 microsecond of bit 0 and 1000 microsecond of bit 1 */ |
| 19 | 19 | |
| 20 | 20 | static INT16 *apf_emit_level(INT16 *p, int count) |
| 21 | { | |
| 21 | { | |
| 22 | 22 | int i; |
| 23 | 23 | |
| 24 | 24 | for (i=0; i<count; i++) |
| r1461 | r1462 | |
| 29 | 29 | return p; |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | /* 4 periods at 1200hz */ | |
| 32 | /* 4 periods at 1200hz */ | |
| 33 | 33 | static INT16* apf_output_bit(INT16 *p, UINT8 b) |
| 34 | 34 | { |
| 35 | 35 | if (b) |
| r1461 | r1462 | |
|---|---|---|
| 15 | 15 | #include "formats/basicdsk.h" |
| 16 | 16 | #include "utils.h" |
| 17 | 17 | |
| 18 | /* ----------------------------------------------------------------------- | |
| 19 | * JVC (Jeff Vavasour CoCo) format | |
| 20 | * | |
| 21 | * Used by Jeff Vavasour's CoCo Emulators | |
| 22 | * | |
| 18 | /* ----------------------------------------------------------------------- | |
| 19 | * JVC (Jeff Vavasour CoCo) format | |
| 20 | * | |
| 21 | * Used by Jeff Vavasour's CoCo Emulators | |
| 22 | * | |
| 23 | 23 | * Documentation taken from Tim Linder's web site: |
| 24 | * http://home.netcom.com/~tlindner/JVC.html | |
| 24 | * http://home.netcom.com/~tlindner/JVC.html | |
| 25 | 25 | * |
| 26 | * A. Header length | |
| 27 | * The header length is determined by the file length modulo 256: | |
| 28 | * headerSize = fileLength % 256; | |
| 29 | * This means that the header is variable length and the minimum size | |
| 30 | * is zero bytes, and the maximum size of 255 bytes. | |
| 26 | * A. Header length | |
| 27 | * The header length is determined by the file length modulo 256: | |
| 28 | * headerSize = fileLength % 256; | |
| 29 | * This means that the header is variable length and the minimum size | |
| 30 | * is zero bytes, and the maximum size of 255 bytes. | |
| 31 | 31 | * |
| 32 | 32 | * B. Header |
| 33 | 33 | * Here is a description of the header bytes: |
| 34 | * Byte Offset Description Default | |
| 34 | * Byte Offset Description Default | |
| 35 | 35 | * ----------- ----------------- ------- |
| 36 | * 0 Sectors per track 18 | |
| 37 | * 1 Side count 1 | |
| 38 | * 2 Sector size code 1 | |
| 39 | * 3 First sector ID 1 | |
| 40 | * 4 Sector attribute flag 0 | |
| 36 | * 0 Sectors per track 18 | |
| 37 | * 1 Side count 1 | |
| 38 | * 2 Sector size code 1 | |
| 39 | * 3 First sector ID 1 | |
| 40 | * 4 Sector attribute flag 0 | |
| 41 | 41 | * |
| 42 | 42 | * If the sector attribute flag is zero then the track count is determined |
| 43 | 43 | * by the formula: |
| r1461 | r1462 | |
| 74 | 74 | * The is the same value that is stored in the wd179x ID field to |
| 75 | 75 | * determine sector size: |
| 76 | 76 | * |
| 77 | * 0x00 128 bytes | |
| 78 | * 0x01 256 bytes | |
| 79 | * 0x02 512 bytes | |
| 80 | * 0x03 1024 bytes | |
| 77 | * 0x00 128 bytes | |
| 78 | * 0x01 256 bytes | |
| 79 | * 0x02 512 bytes | |
| 80 | * 0x03 1024 bytes | |
| 81 | 81 | * |
| 82 | 82 | * Other values are undefined. Every sector in the disk image must be the |
| 83 | 83 | * same size. |
| r1461 | r1462 | |
| 90 | 90 | * G. Sector Attribute Flag |
| 91 | 91 | * If this byte is non zero, then each sector contains an additional |
| 92 | 92 | * byte prepended to the sector data. If the attribute flag is zero then |
| 93 | * there are no extra bytes in front of the sector data. | |
| 93 | * there are no extra bytes in front of the sector data. | |
| 94 | 94 | * |
| 95 | 95 | * H. Sector attribute byte |
| 96 | 96 | * This byte is put at the begining of every sector if the header flag |
| r1461 | r1462 | |
| 187 | 187 | } |
| 188 | 188 | |
| 189 | 189 | |
| 190 | ||
| 190 | ||
| 191 | 191 | static FLOPPY_CONSTRUCT(coco_jvc_construct) |
| 192 | 192 | { |
| 193 | 193 | struct basicdsk_geometry geometry; |
| r1461 | r1462 | |
| 222 | 222 | header_size = 4; |
| 223 | 223 | if (header[4] != 0) |
| 224 | 224 | header_size = 5; |
| 225 | ||
| 225 | ||
| 226 | 226 | geometry.offset = header_size; |
| 227 | ||
| 227 | ||
| 228 | 228 | floppy_image_write(floppy, header, 0, header_size); |
| 229 | 229 | } |
| 230 | 230 | else |
| r1461 | r1462 | |
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | |
| 240 | /* ----------------------------------------------------------------------- | |
| 240 | /* ----------------------------------------------------------------------- | |
| 241 | 241 | * OS-9 file format |
| 242 | 242 | * |
| 243 | 243 | * This file format is largely a hack because there are a large amount of |
| r1461 | r1462 | |
| 269 | 269 | * $1A 5 date of creation Y:M:D:H:M |
| 270 | 270 | * $1F 32 ASCII name of disk, last letter has $80 added to it, |
| 271 | 271 | * the full 32 bytes do not need to be used. |
| 272 | * | |
| 272 | * | |
| 273 | 273 | * Allocation bit map, fill with zeros and set bits from low to high as |
| 274 | 274 | * sectors are used. So, for a fresh disk sectors LSN0,LSN1,LSN2, and LSN3 |
| 275 | 275 | * will be in use so the first byte will be $FF $C0 and all others |
| 276 | 276 | * in the map are $00 |
| 277 | * | |
| 277 | * | |
| 278 | 278 | * Root directory LSN2 |
| 279 | 279 | * Byte size use |
| 280 | 280 | * $00 1 attributes will be $BF |
| r1461 | r1462 | |
| 459 | 459 | |
| 460 | 460 | |
| 461 | 461 | |
| 462 | /* ----------------------------------------------------------------------- | |
| 462 | /* ----------------------------------------------------------------------- | |
| 463 | 463 | * VDK file format |
| 464 | 464 | * |
| 465 | 465 | * Used by Paul Burgin's PC-Dragon emulator |
| r1461 | r1462 | |
| 576 | 576 | |
| 577 | 577 | |
| 578 | 578 | |
| 579 | /* ----------------------------------------------------------------------- | |
| 579 | /* ----------------------------------------------------------------------- | |
| 580 | 580 | * DMK file format |
| 581 | 581 | * |
| 582 | 582 | * David M. Keil's disk image format is aptly called an 'on disk' image |
| r1461 | r1462 | |
| 644 | 644 | static floperr_t coco_dmk_get_offset(floppy_image *floppy, int head, int track, UINT64 *offset) |
| 645 | 645 | { |
| 646 | 646 | struct dmk_tag *tag = get_dmk_tag(floppy); |
| 647 | ||
| 647 | ||
| 648 | 648 | if ((head < 0) || (head >= tag->heads) || (track < 0) || (track >= tag->tracks)) |
| 649 | 649 | return FLOPPY_ERROR_SEEKERROR; |
| 650 | 650 | |
| r1461 | r1462 | |
| 655 | 655 | *offset += DMK_HEADER_LEN; |
| 656 | 656 | return FLOPPY_ERROR_SUCCESS; |
| 657 | 657 | } |
| 658 | ||
| 659 | ||
| 660 | 658 | |
| 659 | ||
| 660 | ||
| 661 | 661 | static UINT32 coco_dmk_min_track_size(int sectors, int sector_length) |
| 662 | 662 | { |
| 663 | 663 | int sector_physical_length; |
| r1461 | r1462 | |
| 665 | 665 | return DMK_TOC_LEN * 2 + DMK_LEAD_IN + (sectors * sector_physical_length); |
| 666 | 666 | } |
| 667 | 667 | |
| 668 | ||
| 669 | ||
| 668 | ||
| 669 | ||
| 670 | 670 | static floperr_t coco_dmk_read_track(floppy_image *floppy, int head, int track, UINT64 offset, void *buffer, size_t buflen) |
| 671 | 671 | { |
| 672 | 672 | floperr_t err; |
| 673 | 673 | UINT64 track_offset; |
| 674 | ||
| 674 | ||
| 675 | 675 | err = coco_dmk_get_offset(floppy, head, track, &track_offset); |
| 676 | 676 | if (err) |
| 677 | 677 | return err; |
| r1461 | r1462 | |
| 679 | 679 | floppy_image_read(floppy, buffer, offset + track_offset, buflen); |
| 680 | 680 | return FLOPPY_ERROR_SUCCESS; |
| 681 | 681 | } |
| 682 | ||
| 683 | ||
| 684 | 682 | |
| 683 | ||
| 684 | ||
| 685 | 685 | static floperr_t coco_dmk_write_track(floppy_image *floppy, int head, int track, UINT64 offset, const void *buffer, size_t buflen) |
| 686 | 686 | { |
| 687 | 687 | floperr_t err; |
| r1461 | r1462 | |
| 690 | 690 | err = coco_dmk_get_offset(floppy, head, track, &track_offset); |
| 691 | 691 | if (err) |
| 692 | 692 | return err; |
| 693 | ||
| 693 | ||
| 694 | 694 | floppy_image_write(floppy, buffer, offset + track_offset, buflen); |
| 695 | 695 | return FLOPPY_ERROR_SUCCESS; |
| 696 | 696 | } |
| r1461 | r1462 | |
| 704 | 704 | } |
| 705 | 705 | |
| 706 | 706 | |
| 707 | ||
| 707 | ||
| 708 | 708 | static floperr_t coco_dmk_format_track(floppy_image *floppy, int head, int track, option_resolution *params) |
| 709 | 709 | { |
| 710 | 710 | int sectors; |
| r1461 | r1462 | |
| 721 | 721 | void *track_data_v; |
| 722 | 722 | UINT32 max_track_size; |
| 723 | 723 | int *sector_map = NULL; |
| 724 | ||
| 724 | ||
| 725 | 725 | sectors = option_resolution_lookup_int(params, PARAM_SECTORS); |
| 726 | 726 | sector_length = option_resolution_lookup_int(params, PARAM_SECTOR_LENGTH); |
| 727 | 727 | interleave = option_resolution_lookup_int(params, PARAM_INTERLEAVE); |
| r1461 | r1462 | |
| 740 | 740 | err = FLOPPY_ERROR_NOSPACE; |
| 741 | 741 | goto done; |
| 742 | 742 | } |
| 743 | ||
| 743 | ||
| 744 | 744 | err = floppy_load_track(floppy, head, track, TRUE, &track_data_v, NULL); |
| 745 | 745 | if (err) |
| 746 | 746 | goto done; |
| r1461 | r1462 | |
| 768 | 768 | physical_sector += interleave + 1; |
| 769 | 769 | physical_sector %= sectors; |
| 770 | 770 | } |
| 771 | ||
| 771 | ||
| 772 | 772 | /* set up track table of contents */ |
| 773 | 773 | physical_sector = 0; |
| 774 | 774 | track_position = DMK_TOC_LEN * 2 + DMK_LEAD_IN; |
| r1461 | r1462 | |
| 783 | 783 | { |
| 784 | 784 | /* this is a sector */ |
| 785 | 785 | logical_sector = sector_map[physical_sector]; |
| 786 | ||
| 786 | ||
| 787 | 787 | /* write the sector */ |
| 788 | 788 | memset(&track_data[track_position], 0x00, 8); |
| 789 | 789 | track_position += 8; |
| 790 | ||
| 790 | ||
| 791 | 791 | memset(&track_data[track_position], 0xA1, 3); |
| 792 | 792 | track_position += 3; |
| 793 | 793 | |
| r1461 | r1462 | |
| 800 | 800 | crc = ccitt_crc16(0xcdb4, &track_data[track_position], DMK_IDAM_LENGTH - 2); |
| 801 | 801 | dmk_idam_set_crc( &track_data[track_position], crc); |
| 802 | 802 | track_position += DMK_IDAM_LENGTH; |
| 803 | ||
| 803 | ||
| 804 | 804 | memset(&track_data[track_position], 0x4E, 22); |
| 805 | 805 | track_position += 22; |
| 806 | 806 | |
| r1461 | r1462 | |
| 809 | 809 | |
| 810 | 810 | memset(&track_data[track_position], 0xA1, 3); |
| 811 | 811 | track_position += 3; |
| 812 | ||
| 812 | ||
| 813 | 813 | /* write sector body */ |
| 814 | 814 | track_data[track_position] = 0xFB; |
| 815 | 815 | memset(&track_data[track_position + 1], floppy_get_filler(floppy), sector_length); |
| r1461 | r1462 | |
| 817 | 817 | track_data[track_position + sector_length + 1] = (UINT8) (crc >> 8); |
| 818 | 818 | track_data[track_position + sector_length + 2] = (UINT8) (crc >> 0); |
| 819 | 819 | track_position += sector_length + 3; |
| 820 | ||
| 820 | ||
| 821 | 821 | /* write sector footer */ |
| 822 | 822 | memset(&track_data[track_position], 0x4E, 24); |
| 823 | 823 | track_position += 24; |
| 824 | 824 | } |
| 825 | ||
| 825 | ||
| 826 | 826 | /* write the TOC entry */ |
| 827 | 827 | track_data[physical_sector * 2 + 0] = (UINT8) (idam_offset >> 0); |
| 828 | 828 | track_data[physical_sector * 2 + 1] = (UINT8) (idam_offset >> 8); |
| 829 | ||
| 829 | ||
| 830 | 830 | physical_sector++; |
| 831 | 831 | } |
| 832 | 832 | |
| 833 | 833 | /* write track lead in */ |
| 834 | 834 | memset(&track_data[physical_sector * 2], 0x4e, DMK_LEAD_IN); |
| 835 | ||
| 835 | ||
| 836 | 836 | /* write track footer */ |
| 837 | 837 | assert(max_track_size >= (UINT32)track_position); |
| 838 | 838 | memset(&track_data[track_position], 0x4e, max_track_size - track_position); |
| r1461 | r1462 | |
| 843 | 843 | return FLOPPY_ERROR_SUCCESS; |
| 844 | 844 | } |
| 845 | 845 | |
| 846 | ||
| 847 | ||
| 846 | ||
| 847 | ||
| 848 | 848 | static int coco_dmk_get_heads_per_disk(floppy_image *floppy) |
| 849 | 849 | { |
| 850 | 850 | return get_dmk_tag(floppy)->heads; |
| 851 | 851 | } |
| 852 | ||
| 853 | 852 | |
| 854 | 853 | |
| 854 | ||
| 855 | 855 | static int coco_dmk_get_tracks_per_disk(floppy_image *floppy) |
| 856 | 856 | { |
| 857 | 857 | return get_dmk_tag(floppy)->tracks; |
| 858 | 858 | } |
| 859 | 859 | |
| 860 | 860 | |
| 861 | ||
| 861 | ||
| 862 | 862 | static UINT32 coco_dmk_get_track_size(floppy_image *floppy, int head, int track) |
| 863 | 863 | { |
| 864 | 864 | return get_dmk_tag(floppy)->track_size; |
| 865 | 865 | } |
| 866 | ||
| 867 | ||
| 868 | 866 | |
| 867 | ||
| 868 | ||
| 869 | 869 | static floperr_t coco_dmk_seek_sector_in_track(floppy_image *floppy, int head, int track, int sector, int sector_is_index, int dirtify, UINT8 **sector_data, UINT32 *sector_length) |
| 870 | 870 | { |
| 871 | 871 | struct dmk_tag *tag = get_dmk_tag(floppy); |
| r1461 | r1462 | |
| 884 | 884 | if (err) |
| 885 | 885 | return err; |
| 886 | 886 | track_data = (UINT8 *) track_data_v; |
| 887 | ||
| 887 | ||
| 888 | 888 | /* search for matching IDAM */ |
| 889 | 889 | for (i = 0; i < DMK_TOC_LEN; i++) |
| 890 | 890 | { |
| r1461 | r1462 | |
| 892 | 892 | idam_offset <<= 8; |
| 893 | 893 | idam_offset |= track_data[i * 2 + 0]; |
| 894 | 894 | idam_offset &= 0x3FFF; |
| 895 | ||
| 895 | ||
| 896 | 896 | if (idam_offset == 0) |
| 897 | 897 | { |
| 898 | 898 | /* we've reached the end of the road */ |
| r1461 | r1462 | |
| 948 | 948 | } |
| 949 | 949 | if (i >= DMK_DATA_GAP) |
| 950 | 950 | return FLOPPY_ERROR_SEEKERROR; |
| 951 | ||
| 951 | ||
| 952 | 952 | offs += i + 1; |
| 953 | 953 | sec_len = 128 << dmk_idam_sectorlength(&track_data[idam_offset]); |
| 954 | 954 | |
| r1461 | r1462 | |
| 961 | 961 | *sector_length = sec_len; |
| 962 | 962 | return FLOPPY_ERROR_SUCCESS; |
| 963 | 963 | } |
| 964 | ||
| 965 | ||
| 966 | 964 | |
| 965 | ||
| 966 | ||
| 967 | 967 | static floperr_t coco_dmk_get_sector_length(floppy_image *floppy, int head, int track, int sector, UINT32 *sector_length) |
| 968 | 968 | { |
| 969 | 969 | return coco_dmk_seek_sector_in_track(floppy, head, track, sector, FALSE, FALSE, NULL, sector_length); |
| r1461 | r1462 | |
| 1014 | 1014 | UINT16 crc_on_disk; |
| 1015 | 1015 | UINT16 calculated_crc; |
| 1016 | 1016 | UINT8 *sector_data; |
| 1017 | ||
| 1017 | ||
| 1018 | 1018 | err = coco_dmk_seek_sector_in_track(floppy, head, track, sector, sector_is_index, FALSE, §or_data, §or_length); |
| 1019 | 1019 | if (err) |
| 1020 | 1020 | return err; |
| r1461 | r1462 | |
| 1026 | 1026 | calculated_crc = ccitt_crc16(0xE295, sector_data, sector_length); |
| 1027 | 1027 | if (calculated_crc != crc_on_disk) |
| 1028 | 1028 | return FLOPPY_ERROR_INVALIDIMAGE; |
| 1029 | ||
| 1029 | ||
| 1030 | 1030 | memcpy(buffer, sector_data, MIN(sector_length, buflen)); |
| 1031 | 1031 | |
| 1032 | 1032 | return FLOPPY_ERROR_SUCCESS; |
| r1461 | r1462 | |
| 1040 | 1040 | UINT32 sector_length; |
| 1041 | 1041 | UINT8 *sector_data; |
| 1042 | 1042 | UINT16 crc; |
| 1043 | ||
| 1043 | ||
| 1044 | 1044 | err = coco_dmk_seek_sector_in_track(floppy, head, track, sector, sector_is_index, TRUE, §or_data, §or_length); |
| 1045 | 1045 | if (err) |
| 1046 | 1046 | return err; |
| 1047 | ||
| 1047 | ||
| 1048 | 1048 | if (buflen > sector_length) |
| 1049 | 1049 | return FLOPPY_ERROR_INTERNAL; |
| 1050 | ||
| 1050 | ||
| 1051 | 1051 | memcpy(sector_data, buffer, buflen); |
| 1052 | ||
| 1052 | ||
| 1053 | 1053 | crc = ccitt_crc16(0xE295, sector_data, sector_length); |
| 1054 | 1054 | sector_data[sector_length + 0] = crc >> 8; |
| 1055 | 1055 | sector_data[sector_length + 1] = crc >> 0; |
| 1056 | 1056 | return FLOPPY_ERROR_SUCCESS; |
| 1057 | 1057 | } |
| 1058 | 1058 | |
| 1059 | ||
| 1060 | 1059 | |
| 1060 | ||
| 1061 | 1061 | static floperr_t coco_dmk_read_sector(floppy_image *floppy, int head, int track, int sector, void *buffer, size_t buflen) |
| 1062 | 1062 | { |
| 1063 | 1063 | return internal_coco_dmk_read_sector(floppy, head, track, sector, FALSE, buffer, buflen); |
| r1461 | r1462 | |
| 1085 | 1085 | UINT8 header[DMK_HEADER_LEN]; |
| 1086 | 1086 | |
| 1087 | 1087 | floppy_image_read(floppy, header, 0, DMK_HEADER_LEN); |
| 1088 | ||
| 1088 | ||
| 1089 | 1089 | if (tracks) |
| 1090 | 1090 | *tracks = header[1]; |
| 1091 | 1091 | if (heads) |
| r1461 | r1462 | |
| 1093 | 1093 | if (track_size) |
| 1094 | 1094 | *track_size = ((int) header[3]) * 0x100 + header[2]; |
| 1095 | 1095 | } |
| 1096 | ||
| 1097 | ||
| 1098 | ||
| 1096 | ||
| 1097 | ||
| 1098 | ||
| 1099 | 1099 | FLOPPY_CONSTRUCT(coco_dmk_construct) |
| 1100 | 1100 | { |
| 1101 | 1101 | struct FloppyCallbacks *callbacks; |
| r1461 | r1462 | |
| 1124 | 1124 | { |
| 1125 | 1125 | coco_dmk_interpret_header(floppy, &heads, &tracks, &track_size); |
| 1126 | 1126 | } |
| 1127 | ||
| 1127 | ||
| 1128 | 1128 | tag = floppy_create_tag(floppy, DMK_TAG, sizeof(struct dmk_tag)); |
| 1129 | 1129 | if (!tag) |
| 1130 | 1130 | return FLOPPY_ERROR_OUTOFMEMORY; |
| 1131 | 1131 | tag->heads = heads; |
| 1132 | 1132 | tag->track_size = track_size; |
| 1133 | 1133 | tag->tracks = tracks; |
| 1134 | ||
| 1134 | ||
| 1135 | 1135 | callbacks = floppy_callbacks(floppy); |
| 1136 | 1136 | callbacks->read_track = coco_dmk_read_track; |
| 1137 | 1137 | callbacks->write_track = coco_dmk_write_track; |
| r1461 | r1462 | |
| 1150 | 1150 | return FLOPPY_ERROR_SUCCESS; |
| 1151 | 1151 | } |
| 1152 | 1152 | |
| 1153 | ||
| 1154 | ||
| 1153 | ||
| 1154 | ||
| 1155 | 1155 | FLOPPY_IDENTIFY(coco_dmk_identify) |
| 1156 | 1156 | { |
| 1157 | 1157 | int heads, tracks, track_size; |
| 1158 | 1158 | UINT64 size, expected_size; |
| 1159 | ||
| 1159 | ||
| 1160 | 1160 | size = floppy_image_size(floppy); |
| 1161 | 1161 | coco_dmk_interpret_header(floppy, &heads, &tracks, &track_size); |
| 1162 | 1162 | expected_size = DMK_HEADER_LEN + (heads * tracks * track_size); |
| 1163 | 1163 | *vote = (size == expected_size) ? 100 : 0; |
| 1164 | 1164 | return FLOPPY_ERROR_SUCCESS; |
| 1165 | 1165 | } |
| 1166 | ||
| 1167 | 1166 | |
| 1168 | 1167 | |
| 1168 | ||
| 1169 | 1169 | /* ----------------------------------------------------------------------- */ |
| 1170 | 1170 | |
| 1171 | 1171 | FLOPPY_OPTIONS_START( coco ) |
| r1461 | r1462 | |
|---|---|---|
| 82 | 82 | return CASSETTE_ERROR_INVALIDIMAGE; |
| 83 | 83 | if (memcmp(&file_header[8], magic2, 4)) |
| 84 | 84 | return CASSETTE_ERROR_INVALIDIMAGE; |
| 85 | ||
| 85 | ||
| 86 | 86 | /* read and sanity check size */ |
| 87 | 87 | stated_size = get_leuint32(&file_header[4]) + 8; |
| 88 | 88 | file_size = cassette_image_size(cassette); |
| r1461 | r1462 | |
| 139 | 139 | |
| 140 | 140 | if (read_waveform) |
| 141 | 141 | { |
| 142 | tag_samples = tag_size / (opts->bits_per_sample / 8) / opts->channels; | |
| 142 | tag_samples = tag_size / (opts->bits_per_sample / 8) / opts->channels; | |
| 143 | 143 | cassette_read_samples(cassette, opts->channels, 0.0, tag_samples / ((double) opts->sample_frequency), |
| 144 | 144 | tag_samples, offset, waveform_flags); |
| 145 | 145 | } |
| r1461 | r1462 | |
| 257 | 257 | int freq, samples, i; |
| 258 | 258 | INT32 cassamp; |
| 259 | 259 | INT16 wavsamp; |
| 260 | ||
| 260 | ||
| 261 | 261 | f = fopen(fname, "rb"); |
| 262 | 262 | if (!f) |
| 263 | 263 | return; |
| r1461 | r1462 | |
|---|---|---|
| 587 | 587 | |
| 588 | 588 | memset(buffer, data, length); |
| 589 | 589 | |
| 590 | err = floppy_write_sector(floppy, head, track, sector, 0, buffer, length); | |
| 590 | err = floppy_write_sector(floppy, head, track, sector, 0, buffer, length); | |
| 591 | 591 | if (err) |
| 592 | 592 | goto done; |
| 593 | 593 |
| r1461 | r1462 | |
|---|---|---|
| 8 | 8 | and the Apple IIgs. |
| 9 | 9 | |
| 10 | 10 | These disks have the following properties: |
| 11 | ||
| 11 | ||
| 12 | 12 | 400k: 80 tracks, 1 head |
| 13 | 13 | 800k: 80 tracks, 2 heads |
| 14 | 14 | |
| r1461 | r1462 | |
| 732 | 732 | if ((found_sectors & (1 << sector)) == 0) |
| 733 | 733 | { |
| 734 | 734 | sony_denibblize35(sector_data, nibble_data, checksum); |
| 735 | ||
| 735 | ||
| 736 | 736 | /* write the sector */ |
| 737 | 737 | err = apple35_write_sector_td(floppy, head, track, sector, sector_data, sizeof(sector_data) / sizeof(sector_data[0])); |
| 738 | 738 | if (err) |
| r1461 | r1462 | |
| 831 | 831 | sides = 1; |
| 832 | 832 | is_1440k = FALSE; |
| 833 | 833 | } |
| 834 | else if ((size == 80*2*10*512) || (size == 80*2*18*512)) | |
| 834 | else if ((size == 80*2*10*512) || (size == 80*2*18*512)) | |
| 835 | 835 | { |
| 836 | 836 | sides = 2; |
| 837 | 837 | is_1440k = (size == 80*2*18*512); |
| r1461 | r1462 | |
| 963 | 963 | header.magic = BIG_ENDIANIZE_INT16(0x100); |
| 964 | 964 | |
| 965 | 965 | floppy_image_write(floppy, &header, 0, sizeof(header)); |
| 966 | floppy_image_write_filler(floppy, 0, sizeof(header), data_size + tag_size); | |
| 966 | floppy_image_write_filler(floppy, 0, sizeof(header), data_size + tag_size); | |
| 967 | 967 | } |
| 968 | 968 | |
| 969 | 969 | /* load */ |
| r1461 | r1462 | |
| 1137 | 1137 | TRACKS([80]) |
| 1138 | 1138 | SECTOR_LENGTH([512]) |
| 1139 | 1139 | FIRST_SECTOR_ID([0])) |
| 1140 | FLOPPY_OPTION( apple35_dc, "dc,dsk,img,image", "Apple DiskCopy disk image", apple35_diskcopy_identify, apple35_diskcopy_construct, | |
| 1140 | FLOPPY_OPTION( apple35_dc, "dc,dsk,img,image", "Apple DiskCopy disk image", apple35_diskcopy_identify, apple35_diskcopy_construct, | |
| 1141 | 1141 | HEADS([1]-2) |
| 1142 | 1142 | TRACKS([80]) |
| 1143 | 1143 | SECTOR_LENGTH([512]) |
| r1461 | r1462 | |
|---|---|---|
| 21 | 21 | { |
| 22 | 22 | UINT16 checksum = 0; |
| 23 | 23 | unsigned int i; |
| 24 | ||
| 24 | ||
| 25 | 25 | for (i = 0; i<size; i++) |
| 26 | 26 | checksum += data[i]; |
| 27 | 27 | return checksum; |
| r1461 | r1462 | |
| 45 | 45 | static void ti85_backup_read (const UINT8 * ti85_data, unsigned int ti85_data_size, ti85_entry * ti85_entries) |
| 46 | 46 | { |
| 47 | 47 | unsigned int pos = 0x42+2; |
| 48 | ||
| 48 | ||
| 49 | 49 | ti85_entries[0].head_size = 0x09; |
| 50 | 50 | ti85_entries[0].data_size = ti85_data[0x39] + ti85_data[0x3a]*256; |
| 51 | 51 | ti85_entries[0].offset = pos; |
| r1461 | r1462 | |
| 284 | 284 | serial_data->end_size = TI85_PC_END_PACKET_SIZE*8; |
| 285 | 285 | |
| 286 | 286 | free (ti85_entries); |
| 287 | ||
| 287 | ||
| 288 | 288 | return 1; |
| 289 | 289 | } |
| 290 | 290 |
| r1461 | r1462 | |
|---|---|---|
| 67 | 67 | floppy_image_read(floppy, &scl, 0x0c, 1); |
| 68 | 68 | floppy_image_read(floppy, &spt, 0x18, 1); |
| 69 | 69 | floppy_image_read(floppy, &heads, 0x1A, 1); |
| 70 | ||
| 70 | ||
| 71 | 71 | if (size == ((UINT64) scl) * spt * heads * 0x200) |
| 72 | 72 | { |
| 73 | 73 | geometry->sectors = spt; |
| r1461 | r1462 | |
|---|---|---|
| 14 | 14 | #define LVIV_LVT_BLOCK_PILOT_LENGTH 1298 |
| 15 | 15 | |
| 16 | 16 | static INT16 *lviv_emit_level(INT16 *p, int count, int level) |
| 17 | { | |
| 17 | { | |
| 18 | 18 | int i; |
| 19 | 19 | |
| 20 | 20 | for (i=0; i<count; i++) |
| r1461 | r1462 | |
| 82 | 82 | for (i=0; i<LVIV_LVT_HEADER_PILOT_LENGTH; i++) |
| 83 | 83 | p = lviv_output_bit (p, 1); |
| 84 | 84 | |
| 85 | for (i=0; i<10; i++) | |
| 85 | for (i=0; i<10; i++) | |
| 86 | 86 | p = lviv_output_byte (p, bytes[0x09]); |
| 87 | 87 | |
| 88 | 88 | for (i=0; i<6; i++) |
| r1461 | r1462 | |
| 90 | 90 | |
| 91 | 91 | p = lviv_emit_level (p, LVIV_LVT_PAUSE_SAMPLES, WAVEENTRY_HIGH); |
| 92 | 92 | |
| 93 | for (i=0; i<LVIV_LVT_BLOCK_PILOT_LENGTH; i++) | |
| 93 | for (i=0; i<LVIV_LVT_BLOCK_PILOT_LENGTH; i++) | |
| 94 | 94 | p = lviv_output_bit (p, 1); |
| 95 | 95 | |
| 96 | 96 | data_size = length - ( LVIV_LVT_HEADER_PILOT_SAMPLES + |
| r1461 | r1462 | |
| 99 | 99 | LVIV_LVT_BLOCK_PILOT_SAMPLES ); |
| 100 | 100 | data_size/=660; |
| 101 | 101 | |
| 102 | for (i=0; i<data_size; i++) | |
| 102 | for (i=0; i<data_size; i++) | |
| 103 | 103 | p = lviv_output_byte (p, bytes[0x10+i]); |
| 104 | 104 | |
| 105 | 105 | return p - buffer; |
| r1461 | r1462 | |
|---|---|---|
| 37 | 37 | #define THOM_SECT_INVALID 1 /* invalid header */ |
| 38 | 38 | |
| 39 | 39 | |
| 40 | typedef struct | |
| 40 | typedef struct | |
| 41 | 41 | { |
| 42 | 42 | |
| 43 | 43 | /* disk info */ |
| r1461 | r1462 | |
| 81 | 81 | { |
| 82 | 82 | { 20, 2, 14, 8 }, { 21, 19, 13, 7 }, |
| 83 | 83 | { 22, 18, 12, 6 }, { 23, 17, 11, 5 }, |
| 84 | { 24, 16, 10, 4 }, { 1, 15, 9, 3 } | |
| 84 | { 24, 16, 10, 4 }, { 1, 15, 9, 3 } | |
| 85 | 85 | }; |
| 86 | 86 | static const int q[4] = { 0, 8, 4, 12 }; |
| 87 | 87 | int t, s; |
| r1461 | r1462 | |
| 97 | 97 | thom_qdd_map[ 24*16 + s ] = q[ s%4 ] + (s/4); |
| 98 | 98 | } |
| 99 | 99 | LOG(( "thom_qdd_compute_map: QDD sector map\n" )); |
| 100 | for ( s = 0; s < 25; s++ ) | |
| 100 | for ( s = 0; s < 25; s++ ) | |
| 101 | 101 | { |
| 102 | 102 | for ( t = 0; t < 16; t++ ) |
| 103 | 103 | { |
| r1461 | r1462 | |
| 111 | 111 | |
| 112 | 112 | static UINT8* thom_floppy_sector_ptr ( thom_floppy_drive* d, int sector, int track, int side ) |
| 113 | 113 | { |
| 114 | if ( track >= d->tracks ) | |
| 114 | if ( track >= d->tracks ) | |
| 115 | 115 | track = d->tracks - 1; |
| 116 | if ( track < 0 ) | |
| 116 | if ( track < 0 ) | |
| 117 | 117 | track = 0; |
| 118 | 118 | |
| 119 | if ( d->data && sector >= 1 && sector <= d->sectors && side >= 0 && side < d->sides ) | |
| 119 | if ( d->data && sector >= 1 && sector <= d->sectors && side >= 0 && side < d->sides ) | |
| 120 | 120 | { |
| 121 | 121 | int s = track * d->sectors + sector - 1; |
| 122 | if ( d -> type == THOM_FLOPPY_QDD ) | |
| 122 | if ( d -> type == THOM_FLOPPY_QDD ) | |
| 123 | 123 | { |
| 124 | if ( s >= 0 && s < 400 ) | |
| 124 | if ( s >= 0 && s < 400 ) | |
| 125 | 125 | s = thom_qdd_map[ s ]; |
| 126 | else | |
| 126 | else | |
| 127 | 127 | return NULL; |
| 128 | 128 | } |
| 129 | 129 | return d->data + ( side * d->tracks * d->sectors + s ) * d->sector_size; |
| r1461 | r1462 | |
| 134 | 134 | |
| 135 | 135 | |
| 136 | 136 | |
| 137 | static UINT8* thom_floppy_sector_flag ( thom_floppy_drive* d, | |
| 137 | static UINT8* thom_floppy_sector_flag ( thom_floppy_drive* d, | |
| 138 | 138 | int sector, int track, int side ) |
| 139 | 139 | { |
| 140 | 140 | int s = track * d->sectors + sector - 1; |
| 141 | if ( d -> type == THOM_FLOPPY_QDD ) | |
| 141 | if ( d -> type == THOM_FLOPPY_QDD ) | |
| 142 | 142 | s = thom_qdd_map[ s ]; |
| 143 | return | |
| 143 | return | |
| 144 | 144 | d->sect_flag + side * d->tracks * d->sectors + s; |
| 145 | 145 | } |
| 146 | 146 | |
| r1461 | r1462 | |
| 152 | 152 | /* format */ |
| 153 | 153 | PRINT (( "thom_floppy: drive %li, %s floppy, %s-sided, %i-byte sectors, %s, %i track(s), %i sectors, %i KB\n", |
| 154 | 154 | (long) (d - thom_floppy_drives), |
| 155 | (d->type == THOM_FLOPPY_5_1_4) ? "5\"1/4" : | |
| 156 | (d->type == THOM_FLOPPY_3_1_2) ? "3\"1/2" : | |
| 155 | (d->type == THOM_FLOPPY_5_1_4) ? "5\"1/4" : | |
| 156 | (d->type == THOM_FLOPPY_3_1_2) ? "3\"1/2" : | |
| 157 | 157 | (d->type == THOM_FLOPPY_QDD) ? "QDD" : "unknown type", |
| 158 | 158 | (d->sides == 1) ? "one" : "two", |
| 159 | 159 | d->sector_size, |
| r1461 | r1462 | |
| 162 | 162 | (d->sides * d->tracks * d->sectors * d->sector_size) / 1024 )); |
| 163 | 163 | LOG (( "thom_floppy: drive %li loaded\n", d - thom_floppy_drives )); |
| 164 | 164 | |
| 165 | if ( d->data ) | |
| 165 | if ( d->data ) | |
| 166 | 166 | { |
| 167 | 167 | UINT8* dir = d->data + 20 * 16 * d->sector_size; |
| 168 | 168 | char name[] = "01234567"; |
| r1461 | r1462 | |
| 172 | 172 | memcpy( name, dir, 8 ); |
| 173 | 173 | for ( i = 0; name[i]; i++ ) |
| 174 | 174 | { |
| 175 | if ( name[i] < ' ' || name[i] >= 127 ) | |
| 175 | if ( name[i] < ' ' || name[i] >= 127 ) | |
| 176 | 176 | name[i] = '?'; |
| 177 | 177 | } |
| 178 | 178 | PRINT (( "thom_floppy: floppy name \"%s\"\n", name )); |
| 179 | 179 | |
| 180 | 180 | /* BASIC directory */ |
| 181 | 181 | dir += d->sector_size*2; |
| 182 | for ( j = 0; j < d->sector_size * 14 / 32; j++, dir += 32 ) | |
| 182 | for ( j = 0; j < d->sector_size * 14 / 32; j++, dir += 32 ) | |
| 183 | 183 | { |
| 184 | 184 | char name[] = "01234567.ABC"; |
| 185 | 185 | char comment[] = "01234567"; |
| 186 | if ( *dir == 255 ) | |
| 186 | if ( *dir == 255 ) | |
| 187 | 187 | break; /* end of directory */ |
| 188 | if ( *dir < ' ' || *dir > 127 ) | |
| 188 | if ( *dir < ' ' || *dir > 127 ) | |
| 189 | 189 | continue; /* empty entry */ |
| 190 | 190 | memcpy( name, dir, 8 ); |
| 191 | 191 | memcpy( name+9, dir+8, 3 ); |
| 192 | 192 | for ( i = 0; name[i]; i++) |
| 193 | 193 | { |
| 194 | if ( name[i] < ' ' || name[i] >= 127 ) | |
| 194 | if ( name[i] < ' ' || name[i] >= 127 ) | |
| 195 | 195 | name[i] = '?'; |
| 196 | 196 | } |
| 197 | 197 | memcpy( comment, dir + 16, 8 ); |
| r1461 | r1462 | |
| 201 | 201 | comment[i] = '?'; |
| 202 | 202 | } |
| 203 | 203 | PRINT (( "thom_floppy: file \"%s\" type=%s,%s comment=\"%s\"\n", name, |
| 204 | (dir[11] == 0) ? "bas" : (dir[11] == 1) ? "dat" : | |
| 204 | (dir[11] == 0) ? "bas" : (dir[11] == 1) ? "dat" : | |
| 205 | 205 | (dir[11] == 2) ? "bin" : (dir[11] == 3) ? "asm" : "???", |
| 206 | 206 | (dir[12] == 0) ? "a" : (dir[12] == 0xff) ? "b" : "?", comment )); |
| 207 | 207 | } |
| r1461 | r1462 | |
| 221 | 221 | { |
| 222 | 222 | thom_floppy_drive* d = thom_floppy_drive_of_image( image ); |
| 223 | 223 | thom_floppy_active( 0 ); |
| 224 | if ( physical_track < 0 ) | |
| 224 | if ( physical_track < 0 ) | |
| 225 | 225 | physical_track = 0; |
| 226 | if ( physical_track >= 80 ) | |
| 226 | if ( physical_track >= 80 ) | |
| 227 | 227 | physical_track = 79; |
| 228 | 228 | LOG(( "%f thom_floppy_seek: dev=%li track=%i\n", attotime_to_double(timer_get_time()), d - thom_floppy_drives, physical_track )); |
| 229 | 229 | d->cur_track = physical_track; |
| r1461 | r1462 | |
| 234 | 234 | static int thom_floppy_get_sectors_per_track( mess_image *image, int side ) |
| 235 | 235 | { |
| 236 | 236 | thom_floppy_drive* d = thom_floppy_drive_of_image( image ); |
| 237 | VLOG(( "thom_floppy_get_sectors_per_track: track=%i/%i dens=%s/%s\n", d->cur_track, d->tracks, | |
| 238 | (thom_density == DEN_FM_LO) ? "FM" : "MFM", | |
| 237 | VLOG(( "thom_floppy_get_sectors_per_track: track=%i/%i dens=%s/%s\n", d->cur_track, d->tracks, | |
| 238 | (thom_density == DEN_FM_LO) ? "FM" : "MFM", | |
| 239 | 239 | (d->density == DEN_FM_LO) ? "FM" : "MFM" )); |
| 240 | 240 | return d->sectors; |
| 241 | 241 | } |
| 242 | 242 | |
| 243 | 243 | |
| 244 | 244 | |
| 245 | static void thom_floppy_get_id ( mess_image* image, chrn_id* id, | |
| 245 | static void thom_floppy_get_id ( mess_image* image, chrn_id* id, | |
| 246 | 246 | int id_index, int physical_side ) |
| 247 | 247 | { |
| 248 | 248 | thom_floppy_drive* d = thom_floppy_drive_of_image( image ); |
| 249 | 249 | int trk = d->cur_track; |
| 250 | if ( trk >= d->tracks ) | |
| 250 | if ( trk >= d->tracks ) | |
| 251 | 251 | trk = d->tracks - 1; |
| 252 | VLOG(( "thom_floppy_get_id: dev=%li track=%i idx=%i phy-side=%i dens=%s/%s\n", | |
| 252 | VLOG(( "thom_floppy_get_id: dev=%li track=%i idx=%i phy-side=%i dens=%s/%s\n", | |
| 253 | 253 | d - thom_floppy_drives, trk, id_index, physical_side, |
| 254 | (thom_density == DEN_FM_LO) ? "FM" : "MFM", | |
| 254 | (thom_density == DEN_FM_LO) ? "FM" : "MFM", | |
| 255 | 255 | (d->density == DEN_FM_LO) ? "FM" : "MFM" )); |
| 256 | 256 | thom_floppy_active( 0 ); |
| 257 | if ( thom_floppy_sector_ptr( d, id_index+1, trk, 0 ) && | |
| 257 | if ( thom_floppy_sector_ptr( d, id_index+1, trk, 0 ) && | |
| 258 | 258 | #if 0 |
| 259 | 259 | /* fails with bobwinter */ |
| 260 | * thom_floppy_sector_flag( d, id_index+1, trk, 0 ) == | |
| 261 | THOM_SECT_OK && | |
| 260 | * thom_floppy_sector_flag( d, id_index+1, trk, 0 ) == | |
| 261 | THOM_SECT_OK && | |
| 262 | 262 | #endif |
| 263 | thom_density == d->density ) | |
| 263 | thom_density == d->density ) | |
| 264 | 264 | { |
| 265 | 265 | int index = ( id_index * thom_floppy_interlace ) % d->sectors; |
| 266 | 266 | id->C = d->cur_track; |
| r1461 | r1462 | |
| 270 | 270 | id->data_id = 1 + index; |
| 271 | 271 | id->flags = 0; |
| 272 | 272 | } |
| 273 | else | |
| 273 | else | |
| 274 | 274 | { |
| 275 | 275 | /* error */ |
| 276 | 276 | id->C = 0; |
| r1461 | r1462 | |
| 279 | 279 | id->N = 0; |
| 280 | 280 | id->data_id = 0; |
| 281 | 281 | id->flags = 0; |
| 282 | logerror( "thom_floppy_get_id: invalid operation dev=%li track=%i idx=%i phy-side=%i dens=%s/%s\n", | |
| 283 | (long) (d - thom_floppy_drives), d->cur_track, id_index, physical_side, | |
| 284 | (thom_density == DEN_FM_LO) ? "FM" : "MFM", | |
| 282 | logerror( "thom_floppy_get_id: invalid operation dev=%li track=%i idx=%i phy-side=%i dens=%s/%s\n", | |
| 283 | (long) (d - thom_floppy_drives), d->cur_track, id_index, physical_side, | |
| 284 | (thom_density == DEN_FM_LO) ? "FM" : "MFM", | |
| 285 | 285 | (d->density == DEN_FM_LO) ? "FM" : "MFM" ); |
| 286 | 286 | } |
| 287 | 287 | } |
| r1461 | r1462 | |
| 294 | 294 | UINT8* src = thom_floppy_sector_ptr( d, index1, d->cur_track, 0 ); |
| 295 | 295 | thom_floppy_active( 0 ); |
| 296 | 296 | LOG(( "thom_floppy_read_sector_data_into_buffer: dev=%li track=%i idx=%i side=%i len=%i\n", d - thom_floppy_drives, d->cur_track, index1, side, length )); |
| 297 | if ( length > d->sector_size ) | |
| 297 | if ( length > d->sector_size ) | |
| 298 | 298 | { |
| 299 | 299 | logerror( "thom_floppy_read_sector_data_into_buffer: sector size %i truncated to %i\n", length, d->sector_size ); |
| 300 | 300 | length = d->sector_size; |
| r1461 | r1462 | |
| 311 | 311 | UINT8* dst = thom_floppy_sector_ptr( d, data_id, d->cur_track, 0 ); |
| 312 | 312 | thom_floppy_active( 1 ); |
| 313 | 313 | LOG(( "thom_floppy_write_sector_data_into_buffer: dev=%li track=%i idx=%i side=%i ddam=%i len=%i\n", d - thom_floppy_drives, d->cur_track, data_id, side, ddam, length )); |
| 314 | if ( length > d->sector_size ) | |
| 314 | if ( length > d->sector_size ) | |
| 315 | 315 | { |
| 316 | 316 | logerror( "thom_floppy_write_sector_data_from_buffer: sector size %i truncated to %i\n", length, d->sector_size ); |
| 317 | 317 | length = d->sector_size; |
| r1461 | r1462 | |
| 332 | 332 | UINT8* dst; |
| 333 | 333 | thom_floppy_active( 1 ); |
| 334 | 334 | LOG(( "thom_floppy_format_sector: dev=%li track=%i/%i side=%i/%i idx=%i/%i c=%i h=%i r=%i n=%i filler=$%02X\n", |
| 335 | d - thom_floppy_drives, | |
| 335 | d - thom_floppy_drives, | |
| 336 | 336 | d->cur_track, d->tracks, side, d->sides, sector_index, d->sectors, |
| 337 | 337 | c, h, r, n, filler )); |
| 338 | 338 | |
| 339 | if ( d -> type != THOM_FLOPPY_QDD ) | |
| 339 | if ( d -> type != THOM_FLOPPY_QDD ) | |
| 340 | 340 | { |
| 341 | if ( sector_size != d->sector_size || ( d->cur_track >= d->tracks && d->tracks == 40 ) ) | |
| 341 | if ( sector_size != d->sector_size || ( d->cur_track >= d->tracks && d->tracks == 40 ) ) | |
| 342 | 342 | { |
| 343 | 343 | /* need to change image params */ |
| 344 | if ( d->cur_track >= 40 ) | |
| 344 | if ( d->cur_track >= 40 ) | |
| 345 | 345 | d->tracks = 80; |
| 346 | d->sector_size = sector_size; | |
| 346 | d->sector_size = sector_size; | |
| 347 | 347 | d->density = thom_density; |
| 348 | 348 | d->data = realloc( d->data, d->sides * d->tracks * d->sectors * d->sector_size ); |
| 349 | 349 | LOG (( "thom_floppy_format_sector: image enlarged to sides=%i tracks=%i sectors=%i sector_size=%i\n",d->sides, d->tracks, d->sectors, d->sector_size )); |
| 350 | 350 | assert( d->data ); |
| 351 | 351 | } |
| 352 | 352 | } |
| 353 | ||
| 353 | ||
| 354 | 354 | dst = thom_floppy_sector_ptr( d, r, d->cur_track, 0 ); |
| 355 | 355 | if ( dst ) |
| 356 | 356 | { |
| r1461 | r1462 | |
| 358 | 358 | * thom_floppy_sector_flag( d, r, d->cur_track, 0 ) = THOM_SECT_OK; |
| 359 | 359 | d->has_changed = 1; |
| 360 | 360 | } |
| 361 | else | |
| 361 | else | |
| 362 | 362 | logerror( "thom_floppy_format_sector: invalid operation\n" ); |
| 363 | 363 | } |
| 364 | 364 | |
| 365 | 365 | |
| 366 | 366 | |
| 367 | static const floppy_interface thom_floppy_interface = | |
| 367 | static const floppy_interface thom_floppy_interface = | |
| 368 | 368 | { |
| 369 | 369 | thom_floppy_seek, |
| 370 | 370 | thom_floppy_get_sectors_per_track, |
| r1461 | r1462 | |
| 387 | 387 | int size = image_length( image ); |
| 388 | 388 | |
| 389 | 389 | /* O-sized => create */ |
| 390 | if ( !size ) | |
| 390 | if ( !size ) | |
| 391 | 391 | { |
| 392 | 392 | PRINT(( "new image created in drive %i\n", image_index_in_device( image ) )); |
| 393 | 393 | d->sides = 1; |
| r1461 | r1462 | |
| 401 | 401 | memset( d->data, 0xff, d->sector_size * d->sectors * d->tracks * d->sides ); |
| 402 | 402 | return INIT_PASS; |
| 403 | 403 | } |
| 404 | ||
| 404 | ||
| 405 | 405 | /* load */ |
| 406 | 406 | d->data = malloc( size ); |
| 407 | 407 | assert( d->data ); |
| 408 | if ( image_fread( image, d->data, size ) != size ) | |
| 408 | if ( image_fread( image, d->data, size ) != size ) | |
| 409 | 409 | { |
| 410 | 410 | logerror( "thom_floppy_fd_load: read error\n" ); |
| 411 | 411 | goto error; |
| 412 | 412 | } |
| 413 | 413 | |
| 414 | 414 | /* guess format: TODO two-sided images */ |
| 415 | if ( size == 81920 ) | |
| 415 | if ( size == 81920 ) | |
| 416 | 416 | { |
| 417 | 417 | d->type = THOM_FLOPPY_5_1_4; |
| 418 | 418 | d->tracks = 40; |
| r1461 | r1462 | |
| 421 | 421 | d->density = DEN_FM_LO; |
| 422 | 422 | d->sector_size = 128; |
| 423 | 423 | } |
| 424 | else if ( size == 163840 ) | |
| 424 | else if ( size == 163840 ) | |
| 425 | 425 | { |
| 426 | 426 | #if 0 |
| 427 | 427 | /* this undocumented case can actually be built by the TO9 */ |
| r1461 | r1462 | |
| 439 | 439 | d->density = DEN_MFM_LO; |
| 440 | 440 | d->sector_size = 256; |
| 441 | 441 | } |
| 442 | else if ( size == 327680 ) | |
| 442 | else if ( size == 327680 ) | |
| 443 | 443 | { |
| 444 | 444 | d->type = THOM_FLOPPY_3_1_2; |
| 445 | 445 | d->tracks = 80; |
| r1461 | r1462 | |
| 453 | 453 | logerror( "thom_floppy_fd_load: disk format not recognized\n" ); |
| 454 | 454 | goto error; |
| 455 | 455 | } |
| 456 | ||
| 456 | ||
| 457 | 457 | memset( d->sect_flag, THOM_SECT_OK, sizeof( d->sect_flag ) ); |
| 458 | 458 | |
| 459 | 459 | thom_floppy_show( d ); |
| r1461 | r1462 | |
| 463 | 463 | |
| 464 | 464 | error: |
| 465 | 465 | PRINT(( "could not load floppy image in drive %i\n", image_index_in_device( image ) )); |
| 466 | if ( d->data ) | |
| 467 | free( d->data ); | |
| 466 | if ( d->data ) | |
| 467 | free( d->data ); | |
| 468 | 468 | d->data = NULL; |
| 469 | 469 | d->type = THOM_FLOPPY_NONE; |
| 470 | 470 | return INIT_FAIL; |
| r1461 | r1462 | |
| 476 | 476 | { |
| 477 | 477 | thom_floppy_drive* d = thom_floppy_drives + image_index_in_device( image ); |
| 478 | 478 | unsigned size = d->sides * d->tracks * d->sectors * d->sector_size; |
| 479 | if ( !d->data ) | |
| 479 | if ( !d->data ) | |
| 480 | 480 | return; |
| 481 | if ( !d->has_changed ) | |
| 481 | if ( !d->has_changed ) | |
| 482 | 482 | return; |
| 483 | 483 | PRINT (( "thom_floppy_fd_save: saving floppy %li, %i KB\n", (long) (d - thom_floppy_drives), size / 1024 )); |
| 484 | 484 | |
| r1461 | r1462 | |
| 503 | 503 | { |
| 504 | 504 | thom_floppy_drive* d = thom_floppy_drives + image_index_in_device( image ); |
| 505 | 505 | int size = image_length( image ); |
| 506 | ||
| 506 | ||
| 507 | 507 | /* only one format, TODO two-sided images */ |
| 508 | if ( size == 51200 || size == 0 ) | |
| 508 | if ( size == 51200 || size == 0 ) | |
| 509 | 509 | { |
| 510 | 510 | d->type = THOM_FLOPPY_QDD; |
| 511 | 511 | d->tracks = 1; |
| r1461 | r1462 | |
| 514 | 514 | d->density = DEN_MFM_LO; |
| 515 | 515 | d->sector_size = 128; |
| 516 | 516 | } |
| 517 | else | |
| 517 | else | |
| 518 | 518 | { |
| 519 | 519 | logerror( "thom_floppy_qd_load: disk format not recognized\n" ); |
| 520 | 520 | return INIT_FAIL; |
| r1461 | r1462 | |
| 525 | 525 | memset( d->data, 0xff, d->sector_size * d->sectors * d->tracks * d->sides ); |
| 526 | 526 | memset( d->sect_flag, THOM_SECT_OK, sizeof( d->sect_flag ) ); |
| 527 | 527 | |
| 528 | if ( !size ) | |
| 528 | if ( !size ) | |
| 529 | 529 | { |
| 530 | 530 | PRINT(( "new image created in drive %i\n", image_index_in_device( image ) )); |
| 531 | 531 | return INIT_PASS; |
| 532 | 532 | } |
| 533 | 533 | |
| 534 | if ( image_fread( image, d->data, size ) != size ) | |
| 534 | if ( image_fread( image, d->data, size ) != size ) | |
| 535 | 535 | { |
| 536 | 536 | logerror( "thom_floppy_qd_load: read error\n" ); |
| 537 | 537 | goto error; |
| r1461 | r1462 | |
| 543 | 543 | |
| 544 | 544 | error: |
| 545 | 545 | PRINT(( "could not load floppy image in drive %i\n", image_index_in_device( image ) )); |
| 546 | if ( d->data ) | |
| 547 | free( d->data ); | |
| 546 | if ( d->data ) | |
| 547 | free( d->data ); | |
| 548 | 548 | d->data = NULL; |
| 549 | 549 | d->type = THOM_FLOPPY_NONE; |
| 550 | 550 | return INIT_FAIL; |
| r1461 | r1462 | |
| 558 | 558 | unsigned size = d->sides * d->tracks * d->sectors * d->sector_size; |
| 559 | 559 | if ( !d->data ) |
| 560 | 560 | return; |
| 561 | if ( !d->has_changed ) | |
| 561 | if ( !d->has_changed ) | |
| 562 | 562 | return; |
| 563 | 563 | PRINT (( "thom_floppy_qd_save: saving floppy %li, %i KB\n", (long) (d - thom_floppy_drives), size / 1024 )); |
| 564 | 564 | /* TODO: truncation */ |
| r1461 | r1462 | |
| 580 | 580 | "(c) Alexandre PUKALL Avril 1998"; |
| 581 | 581 | |
| 582 | 582 | |
| 583 | static const UINT16 sap_crc[] = | |
| 583 | static const UINT16 sap_crc[] = | |
| 584 | 584 | { |
| 585 | 585 | 0x0000, 0x1081, 0x2102, 0x3183, 0x4204, 0x5285, 0x6306, 0x7387, |
| 586 | 586 | 0x8408, 0x9489, 0xa50a, 0xb58b, 0xc60c, 0xd68d, 0xe70e, 0xf78f, |
| r1461 | r1462 | |
| 589 | 589 | |
| 590 | 590 | |
| 591 | 591 | static UINT16 thom_sap_crc( UINT8* data, int size ) |
| 592 | { | |
| 592 | { | |
| 593 | 593 | int i; |
| 594 | 594 | UINT16 crc = 0xffff, crc2; |
| 595 | for ( i = 0; i < size; i++ ) | |
| 595 | for ( i = 0; i < size; i++ ) | |
| 596 | 596 | { |
| 597 | 597 | crc2 = ( crc >> 4 ) ^ sap_crc[ ( crc ^ data[i] ) & 15 ]; |
| 598 | 598 | crc = ( crc2 >> 4 ) ^ sap_crc[ ( crc2 ^ (data[i] >> 4) ) & 15 ]; |
| r1461 | r1462 | |
| 612 | 612 | int i, format; |
| 613 | 613 | |
| 614 | 614 | /* O-sized => create */ |
| 615 | if ( !size ) | |
| 615 | if ( !size ) | |
| 616 | 616 | { |
| 617 | 617 | PRINT(( "new image created in drive %i\n", image_index_in_device( image ) )); |
| 618 | 618 | d->sides = 1; |
| r1461 | r1462 | |
| 629 | 629 | |
| 630 | 630 | /* check header */ |
| 631 | 631 | image_fread( image, buf, 66 ); |
| 632 | if ( memcmp( buf+1, sap_header+1, 65 ) ) | |
| 632 | if ( memcmp( buf+1, sap_header+1, 65 ) ) | |
| 633 | 633 | { |
| 634 | 634 | logerror( "thom_floppy_sap_load: invalid sap header\n" ); |
| 635 | 635 | return INIT_FAIL; |
| r1461 | r1462 | |
| 643 | 643 | d->sector_size = (format==1) ? 128 : 256; |
| 644 | 644 | d->tracks = 0; |
| 645 | 645 | d->sectors = 16; |
| 646 | for ( i = 66; i+4 < size; i += d->sector_size + 6 ) | |
| 646 | for ( i = 66; i+4 < size; i += d->sector_size + 6 ) | |
| 647 | 647 | { |
| 648 | 648 | int fmt, prot, track, sector; |
| 649 | 649 | image_fseek( image, i, SEEK_SET ); |
| r1461 | r1462 | |
| 653 | 653 | track = buf[2]; |
| 654 | 654 | sector = buf[3]; |
| 655 | 655 | LOG(( "thom_floppy_sap_load: drive %i found sector %i on track %i, fmt=%i, prot=%i\n", drive, sector, track, fmt, prot )); |
| 656 | if ( sector < 1 || sector > d->sectors ) | |
| 656 | if ( sector < 1 || sector > d->sectors ) | |
| 657 | 657 | { |
| 658 | 658 | logerror( "thom_floppy_sap_load: invalid sector %i (must be in 1..16)\n", sector ); |
| 659 | 659 | goto error; |
| 660 | 660 | } |
| 661 | if ( track >= d->tracks ) | |
| 661 | if ( track >= d->tracks ) | |
| 662 | 662 | d->tracks = track+1; |
| 663 | 663 | } |
| 664 | ||
| 665 | switch ( d->tracks ) | |
| 664 | ||
| 665 | switch ( d->tracks ) | |
| 666 | 666 | { |
| 667 | 667 | case 40: d->type = THOM_FLOPPY_5_1_4; break; |
| 668 | 668 | case 80: d->type = THOM_FLOPPY_3_1_2; break; |
| 669 | default: | |
| 670 | logerror( "thom_floppy_sap_load: invalid track number %i\n", d->tracks ); | |
| 669 | default: | |
| 670 | logerror( "thom_floppy_sap_load: invalid track number %i\n", d->tracks ); | |
| 671 | 671 | goto error; |
| 672 | 672 | } |
| 673 | 673 | |
| 674 | 674 | /* load */ |
| 675 | 675 | d->data = malloc( d->tracks * d->sectors * d->sector_size ); |
| 676 | 676 | assert( d->data ); |
| 677 | for ( i = 0; i < d->tracks * d->sectors; i++ ) | |
| 677 | for ( i = 0; i < d->tracks * d->sectors; i++ ) | |
| 678 | 678 | { |
| 679 | 679 | UINT16 crc; |
| 680 | 680 | int j, fmt, prot, track, sector; |
| r1461 | r1462 | |
| 700 | 700 | /* check CRC */ |
| 701 | 701 | crc = thom_sap_crc( buf, d->sector_size + 4 ); |
| 702 | 702 | if ( ( (crc >> 8) != buf[ d->sector_size + 4 ] ) || |
| 703 | ( (crc & 0xff) != buf[ d->sector_size + 5 ] ) ) | |
| 703 | ( (crc & 0xff) != buf[ d->sector_size + 5 ] ) ) | |
| 704 | 704 | { |
| 705 | 705 | logerror( "thom_floppy_sap_load: CRC error for track %i, sector %i\n", track, sector ); |
| 706 | 706 | } |
| 707 | 707 | |
| 708 | ||
| 708 | ||
| 709 | 709 | } |
| 710 | ||
| 710 | ||
| 711 | 711 | thom_floppy_show( d ); |
| 712 | ||
| 712 | ||
| 713 | 713 | return INIT_PASS; |
| 714 | 714 | |
| 715 | 715 | error: |
| 716 | 716 | PRINT(( "could not load floppy image in drive %i\n", image_index_in_device( image ) )); |
| 717 | if ( d->data ) free( d->data ); | |
| 717 | if ( d->data ) free( d->data ); | |
| 718 | 718 | d->data = NULL; |
| 719 | 719 | d->type = THOM_FLOPPY_NONE; |
| 720 | 720 | return INIT_FAIL; |
| r1461 | r1462 | |
| 730 | 730 | UINT8 buf[262]; |
| 731 | 731 | if ( !d->data ) |
| 732 | 732 | return; |
| 733 | if ( !d->has_changed ) | |
| 733 | if ( !d->has_changed ) | |
| 734 | 734 | return; |
| 735 | 735 | PRINT (( "thom_floppy_sap_save: saving floppy %li, %i KB\n", (long) (d - thom_floppy_drives), size / 1024 )); |
| 736 | 736 | |
| r1461 | r1462 | |
| 746 | 746 | /* write sectors */ |
| 747 | 747 | for ( track = 0; track < d->tracks; track++ ) |
| 748 | 748 | { |
| 749 | for ( sector = 1; sector <= d->sectors; sector++ ) | |
| 749 | for ( sector = 1; sector <= d->sectors; sector++ ) | |
| 750 | 750 | { |
| 751 | 751 | UINT8 *p = thom_floppy_sector_ptr( d, sector, track, 0 ); |
| 752 | 752 | UINT16 crc; |
| r1461 | r1462 | |
| 765 | 765 | buf[ d->sector_size + 5 ] = crc & 0xff; |
| 766 | 766 | |
| 767 | 767 | /* crypt data */ |
| 768 | for ( i = 0; i < d->sector_size; i++ ) | |
| 768 | for ( i = 0; i < d->sector_size; i++ ) | |
| 769 | 769 | buf[ i + 4 ] ^= sap_magic_num; |
| 770 | 770 | |
| 771 | 771 | image_fwrite( image, buf, d->sector_size + 6 ); |
| r1461 | r1462 | |
| 781 | 781 | |
| 782 | 782 | static void thom_floppy_reset ( thom_floppy_drive* d ) |
| 783 | 783 | { |
| 784 | if ( d->data ) | |
| 784 | if ( d->data ) | |
| 785 | 785 | free( d->data ); |
| 786 | 786 | d->data = NULL; |
| 787 | 787 | d->cur_track = 0; |
| r1461 | r1462 | |
| 812 | 812 | d->cur_track = 0; |
| 813 | 813 | |
| 814 | 814 | /* dispatch according to extension */ |
| 815 | if ( typ ) | |
| 815 | if ( typ ) | |
| 816 | 816 | { |
| 817 | if ( !mame_stricmp( typ, "sap" ) ) | |
| 817 | if ( !mame_stricmp( typ, "sap" ) ) | |
| 818 | 818 | return thom_floppy_sap_load( image ); |
| 819 | else if ( !mame_stricmp( typ, "fd" ) ) | |
| 819 | else if ( !mame_stricmp( typ, "fd" ) ) | |
| 820 | 820 | return thom_floppy_fd_load( image ); |
| 821 | else if ( !mame_stricmp( typ, "qd" ) ) | |
| 821 | else if ( !mame_stricmp( typ, "qd" ) ) | |
| 822 | 822 | return thom_floppy_qd_load( image ); |
| 823 | 823 | } |
| 824 | ||
| 824 | ||
| 825 | 825 | return INIT_FAIL; |
| 826 | 826 | } |
| 827 | 827 | |
| r1461 | r1462 | |
| 831 | 831 | { |
| 832 | 832 | thom_floppy_drive* d = thom_floppy_drive_of_image( image ); |
| 833 | 833 | const char* typ = image_filetype( image ); |
| 834 | if ( typ ) | |
| 834 | if ( typ ) | |
| 835 | 835 | { |
| 836 | if ( !mame_stricmp( typ, "sap" ) ) | |
| 836 | if ( !mame_stricmp( typ, "sap" ) ) | |
| 837 | 837 | thom_floppy_sap_save( image ); |
| 838 | else if ( !mame_stricmp( typ, "fd" ) ) | |
| 838 | else if ( !mame_stricmp( typ, "fd" ) ) | |
| 839 | 839 | thom_floppy_fd_save( image ); |
| 840 | else if ( !mame_stricmp( typ, "qd" ) ) | |
| 840 | else if ( !mame_stricmp( typ, "qd" ) ) | |
| 841 | 841 | thom_floppy_qd_save( image ); |
| 842 | 842 | } |
| 843 | 843 | thom_floppy_reset( d ); |
| r1461 | r1462 | |
| 853 | 853 | |
| 854 | 854 | d->image = image; |
| 855 | 855 | d->cur_track = 0; |
| 856 | if ( typ && !mame_stricmp( typ, "qd" ) ) | |
| 856 | if ( typ && !mame_stricmp( typ, "qd" ) ) | |
| 857 | 857 | { |
| 858 | 858 | d->sides = 1; |
| 859 | 859 | d->sectors = 400; |
| r1461 | r1462 | |
| 862 | 862 | d->density = DEN_MFM_LO; |
| 863 | 863 | d->type = THOM_FLOPPY_QDD; |
| 864 | 864 | } |
| 865 | else if ( typ && !mame_stricmp( typ, "fd" ) ) | |
| 865 | else if ( typ && !mame_stricmp( typ, "fd" ) ) | |
| 866 | 866 | { |
| 867 | 867 | d->sides = 1; |
| 868 | 868 | d->sectors = 16; |
| r1461 | r1462 | |
| 871 | 871 | d->density = DEN_FM_LO; |
| 872 | 872 | d->type = THOM_FLOPPY_5_1_4; |
| 873 | 873 | } |
| 874 | else | |
| 874 | else | |
| 875 | 875 | { |
| 876 | 876 | d->sides = 1; |
| 877 | 877 | d->sectors = 16; |
| r1461 | r1462 | |
| 913 | 913 | |
| 914 | 914 | thom_floppy_type thom_floppy_get_type ( int drive ) |
| 915 | 915 | { |
| 916 | if ( drive < 0 || drive >= 4 ) | |
| 916 | if ( drive < 0 || drive >= 4 ) | |
| 917 | 917 | return THOM_FLOPPY_NONE; |
| 918 | 918 | else |
| 919 | 919 | return thom_floppy_drives[ drive ].type; |
| r1461 | r1462 | |
| 923 | 923 | |
| 924 | 924 | void thom_floppy_getinfo( const device_class *devclass, UINT32 state, union devinfo *info ) |
| 925 | 925 | { |
| 926 | switch ( state ) | |
| 926 | switch ( state ) | |
| 927 | 927 | { |
| 928 | 928 | case DEVINFO_INT_TYPE: |
| 929 | info->i = IO_FLOPPY; | |
| 929 | info->i = IO_FLOPPY; | |
| 930 | 930 | break; |
| 931 | 931 | case DEVINFO_INT_READABLE: |
| 932 | info->i = 1; | |
| 932 | info->i = 1; | |
| 933 | 933 | break; |
| 934 | 934 | case DEVINFO_INT_WRITEABLE: |
| 935 | 935 | info->i = 1; |
| r1461 | r1462 | |
| 977 | 977 | strcpy( info->s = device_temp_str(), __FILE__ ); |
| 978 | 978 | break; |
| 979 | 979 | case DEVINFO_STR_FILE_EXTENSIONS: |
| 980 | strcpy( info->s = device_temp_str(), "fd,qd,sap" ); | |
| 980 | strcpy( info->s = device_temp_str(), "fd,qd,sap" ); | |
| 981 | 981 | break; |
| 982 | 982 | } |
| 983 | 983 | } |
| r1461 | r1462 | |
|---|---|---|
| 9 | 9 | of these emulators patch the system as a shortcut. Thus, the ones and |
| 10 | 10 | zeroes in the file do not truly represent modulated pulses in the |
| 11 | 11 | waveform, but what the BIOS reads and writes. |
| 12 | ||
| 12 | ||
| 13 | 13 | In doing so, they make the CoCo more tolerant of short headers and lack |
| 14 | 14 | of delays between blocks. This legacy is reflected in most CAS files in |
| 15 | 15 | use, and thus presents a problem for a pure hardware emulation like MESS. |
| r1461 | r1462 | |
| 80 | 80 | for (i = 0; i < 8; i++) |
| 81 | 81 | { |
| 82 | 82 | p.w.l >>= 1; |
| 83 | ||
| 83 | ||
| 84 | 84 | if (state == 0) |
| 85 | 85 | { |
| 86 | 86 | /* searching for a block */ |
| r1461 | r1462 | |
| 161 | 161 | { |
| 162 | 162 | static const UINT8 dummy_bytes[] = |
| 163 | 163 | { |
| 164 | 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, | |
| 165 | 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, | |
| 166 | 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, | |
| 167 | 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, | |
| 168 | 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, | |
| 169 | 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, | |
| 170 | 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, | |
| 171 | 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, | |
| 172 | 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, | |
| 173 | 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, | |
| 174 | 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, | |
| 175 | 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, | |
| 176 | 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, | |
| 177 | 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, | |
| 178 | 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, | |
| 179 | 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, | |
| 180 | 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, | |
| 181 | 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, | |
| 182 | 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, | |
| 183 | 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, | |
| 184 | 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, | |
| 164 | 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, | |
| 165 | 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, | |
| 166 | 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, | |
| 167 | 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, | |
| 168 | 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, | |
| 169 | 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, | |
| 170 | 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, | |
| 171 | 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, | |
| 172 | 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, | |
| 173 | 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, | |
| 174 | 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, | |
| 175 | 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, | |
| 176 | 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, | |
| 177 | 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, | |
| 178 | 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, | |
| 179 | 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, | |
| 180 | 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, | |
| 181 | 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, | |
| 182 | 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, | |
| 183 | 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, | |
| 184 | 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, | |
| 185 | 185 | 0x3C, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A |
| 186 | 186 | }; |
| 187 | 187 | time_index = 10.0; |
| r1461 | r1462 | |
|---|---|---|
| 26 | 26 | static UINT32 primo_tape_image_length; |
| 27 | 27 | |
| 28 | 28 | static INT16 *primo_emit_level(INT16 *p, int count, int level) |
| 29 | { | |
| 29 | { | |
| 30 | 30 | int i; |
| 31 | 31 | |
| 32 | 32 | for (i=0; i<count; i++) *(p++) = level; |
| r1461 | r1462 | |
| 115 | 115 | |
| 116 | 116 | /* b is set on the first byte of block data */ |
| 117 | 117 | b += 3; |
| 118 | ||
| 118 | ||
| 119 | 119 | number_of_1 = primo_cassette_calculate_number_of_1(b, block_size); |
| 120 | 120 | number_of_0 = (block_size)*8-number_of_1; |
| 121 | 121 | |
| r1461 | r1462 | |
| 191 | 191 | block_size = *(b+1) + *(b+2)*256; |
| 192 | 192 | b += 3; |
| 193 | 193 | |
| 194 | for (k=0; k<block_size; k++) | |
| 194 | for (k=0; k<block_size; k++) | |
| 195 | 195 | p = primo_output_byte (p, *(b+k)); |
| 196 | 196 | |
| 197 | 197 | logerror ("Samples (block data): %ld\n", (long int)(p-buffer)); |
| r1461 | r1462 | |
|---|---|---|
| 28 | 28 | extern int thom_floppy_init ( mess_image *image ); |
| 29 | 29 | extern int thom_floppy_load ( mess_image* image ); |
| 30 | 30 | extern void thom_floppy_unload ( mess_image *image); |
| 31 | extern int thom_floppy_create ( mess_image *image, | |
| 31 | extern int thom_floppy_create ( mess_image *image, | |
| 32 | 32 | int create_format, option_resolution *args ); |
| 33 | 33 | |
| 34 | 34 | extern void thom_floppy_set_density( DENSITY density ); |
| r1461 | r1462 | |
| 36 | 36 | |
| 37 | 37 | extern thom_floppy_type thom_floppy_get_type( int drive ); |
| 38 | 38 | |
| 39 | extern void thom_floppy_getinfo( const device_class *devclass, | |
| 39 | extern void thom_floppy_getinfo( const device_class *devclass, | |
| 40 | 40 | UINT32 state, union devinfo *info ); |
| 41 | 41 | |
| 42 | 42 | #endif |
| r1461 | r1462 | |
|---|---|---|
| 13 | 13 | #define PMD85_BITS_PER_BYTE 11 |
| 14 | 14 | |
| 15 | 15 | static INT16 *pmd85_emit_level(INT16 *p, int count, int level) |
| 16 | { | |
| 16 | { | |
| 17 | 17 | int i; |
| 18 | 18 | |
| 19 | 19 | for (i=0; i<count; i++) *(p++) = level; |
| r1461 | r1462 | |
| 71 | 71 | p = pmd85_output_bit(p, 1); |
| 72 | 72 | |
| 73 | 73 | /* header */ |
| 74 | for (i=0; i<PMD85_HEADER_BYTES; i++) | |
| 74 | for (i=0; i<PMD85_HEADER_BYTES; i++) | |
| 75 | 75 | p = pmd85_output_byte(p, bytes[i]); |
| 76 | 76 | |
| 77 | 77 | /* pause */ |
| r1461 | r1462 | |
| 79 | 79 | p = pmd85_output_bit(p, 1); |
| 80 | 80 | |
| 81 | 81 | /* data */ |
| 82 | for (i=0; i<data_size; i++) | |
| 82 | for (i=0; i<data_size; i++) | |
| 83 | 83 | p = pmd85_output_byte(p, bytes[i+PMD85_HEADER_BYTES]); |
| 84 | 84 | |
| 85 | 85 | return p - buffer; |
| r1461 | r1462 | |
|---|---|---|
| 762 | 762 | pulse_period = 1 / pulse_frequency; |
| 763 | 763 | err = cassette_put_samples(cassette, 0, time_index, pulse_period, wave_bytes_length, 1, wave_bytes, CASSETTE_WAVEFORM_8BIT); |
| 764 | 764 | if (err) |
| 765 | goto done; | |
| 765 | goto done; | |
| 766 | 766 | time_index += pulse_period; |
| 767 | 767 | total_displacement += pulse_period; |
| 768 | 768 | } |
| r1461 | r1462 | |
| 873 | 873 | pulse_period = 1 / pulse_frequency; |
| 874 | 874 | err = cassette_put_samples(cassette, 0, time_index, pulse_period, wave_bytes_length, 1, wave_bytes, CASSETTE_WAVEFORM_8BIT); |
| 875 | 875 | if (err) |
| 876 | goto done; | |
| 876 | goto done; | |
| 877 | 877 | time_index += pulse_period; |
| 878 | 878 | total_displacement += pulse_period; |
| 879 | 879 |
| r1461 | r1462 | |
|---|---|---|
| 58 | 58 | /* common functions */ |
| 59 | 59 | |
| 60 | 60 | static INT16 *zx81_emit_level(INT16 *p, int count, int level) |
| 61 | { | |
| 61 | { | |
| 62 | 62 | int i; |
| 63 | 63 | |
| 64 | 64 | for (i=0; i<count; i++) *(p++) = level; |
| r1461 | r1462 | |
| 179 | 179 | p = zx81_emit_level (p, ZX81_PILOT_LENGTH, WAVEENTRY_ZERO); |
| 180 | 180 | |
| 181 | 181 | /* name */ |
| 182 | for (i=0; i<zx_file_name_length; i++) | |
| 182 | for (i=0; i<zx_file_name_length; i++) | |
| 183 | 183 | p = zx81_output_byte(p, zx_file_name[i]); |
| 184 | 184 | |
| 185 | 185 | /* data */ |
| 186 | for (i=0; i<real_data_length; i++) | |
| 186 | for (i=0; i<real_data_length; i++) | |
| 187 | 187 | p = zx81_output_byte(p, bytes[i]); |
| 188 | 188 | |
| 189 | 189 | return p - buffer; |
| r1461 | r1462 | |
| 247 | 247 | p = zx81_emit_level (p, ZX81_PILOT_LENGTH, WAVEENTRY_ZERO); |
| 248 | 248 | |
| 249 | 249 | /* data */ |
| 250 | for (i=0; i<real_data_length; i++) | |
| 250 | for (i=0; i<real_data_length; i++) | |
| 251 | 251 | p = zx81_output_byte(p, bytes[i]); |
| 252 | 252 | |
| 253 | 253 | return p - buffer; |
| r1461 | r1462 | |
|---|---|---|
| 12 | 12 | #include "formats/basicdsk.h" |
| 13 | 13 | |
| 14 | 14 | static FLOPPY_IDENTIFY(vz_identify) |
| 15 | { | |
| 15 | { | |
| 16 | 16 | UINT64 size = floppy_image_size(floppy); |
| 17 | 17 | *vote = ((size == 98560) || (size == 99200)) ? 100 : 0; |
| 18 | 18 | return FLOPPY_ERROR_SUCCESS; |
| r1461 | r1462 | |
| 29 | 29 | geometry.tracks = option_resolution_lookup_int(params, PARAM_TRACKS); |
| 30 | 30 | geometry.sectors = option_resolution_lookup_int(params, PARAM_SECTORS); |
| 31 | 31 | geometry.first_sector_id = option_resolution_lookup_int(params, PARAM_FIRST_SECTOR_ID); |
| 32 | geometry.sector_length = option_resolution_lookup_int(params, PARAM_SECTOR_LENGTH); | |
| 32 | geometry.sector_length = option_resolution_lookup_int(params, PARAM_SECTOR_LENGTH); | |
| 33 | 33 | } |
| 34 | 34 | else |
| 35 | 35 | { |
| r1461 | r1462 | |
| 38 | 38 | geometry.sectors = 16; |
| 39 | 39 | geometry.first_sector_id = 0; |
| 40 | 40 | geometry.sector_length = floppy_image_size(floppy)/geometry.tracks/geometry.sectors; |
| 41 | } | |
| 41 | } | |
| 42 | 42 | |
| 43 | 43 | return basicdsk_construct(floppy, &geometry); |
| 44 | 44 | } |
| r1461 | r1462 | |
|---|---|---|
| 38 | 38 | static INT16 xor_wave_state = WAVEENTRY_HIGH^WAVEENTRY_LOW; |
| 39 | 39 | |
| 40 | 40 | static INT16 *oric_emit_level(INT16 *p, int count) |
| 41 | { | |
| 41 | { | |
| 42 | 42 | int i; |
| 43 | 43 | |
| 44 | 44 | for (i=0; i<count; i++) |
| r1461 | r1462 | |
| 49 | 49 | return p; |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | /* 4 periods at 1200hz */ | |
| 52 | /* 4 periods at 1200hz */ | |
| 53 | 53 | static INT16* oric_output_bit(INT16 *p, UINT8 b) |
| 54 | 54 | { |
| 55 | 55 | p = oric_emit_level(p,1); |
| r1461 | r1462 | |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | |
| 88 | /* each byte on cassette is stored as: | |
| 89 | ||
| 88 | /* each byte on cassette is stored as: | |
| 89 | ||
| 90 | 90 | start bit 0 * 1 |
| 91 | 91 | data bits 8 * x (x is 0 or 1, and depends on data-bit value) |
| 92 | 92 | parity bit 1 * x (x is 0 or 1, and depends on the parity of the data bits) |
| r1461 | r1462 | |
| 127 | 127 | /* start bit */ |
| 128 | 128 | count+=oric_get_bit_size_in_samples(0); |
| 129 | 129 | |
| 130 | /* set initial parity */ | |
| 130 | /* set initial parity */ | |
| 131 | 131 | parity = 1; |
| 132 | ||
| 132 | ||
| 133 | 133 | /* data bits, written bit 0, bit 1...bit 7 */ |
| 134 | 134 | data = byte; |
| 135 | 135 | for (i=0; i<8; i++) |
| r1461 | r1462 | |
| 165 | 165 | |
| 166 | 166 | /* start bit */ |
| 167 | 167 | p = oric_output_bit(p, 0); |
| 168 | ||
| 169 | /* set initial parity */ | |
| 168 | ||
| 169 | /* set initial parity */ | |
| 170 | 170 | parity = 1; |
| 171 | ||
| 171 | ||
| 172 | 172 | /* data bits, written bit 0, bit 1...bit 7 */ |
| 173 | 173 | data = byte; |
| 174 | 174 | for (i=0; i<8; i++) |
| r1461 | r1462 | |
| 261 | 261 | count += oric_seconds_to_samples(0.25); |
| 262 | 262 | |
| 263 | 263 | logerror("found end of sync bytes!\n"); |
| 264 | ||
| 264 | ||
| 265 | 265 | /* oric writes approx 512 bytes */ |
| 266 | 266 | /* found end of sync bytes */ |
| 267 | 267 | for (i=0; i<ORIC_LEADER_LENGTH; i++) |
| r1461 | r1462 | |
| 273 | 273 | { |
| 274 | 274 | //logerror("reading header!\n"); |
| 275 | 275 | count+=oric_calculate_byte_size_in_samples(0x024); |
| 276 | ||
| 276 | ||
| 277 | 277 | oric_cassette_state = ORIC_CASSETTE_READ_HEADER; |
| 278 | 278 | oric_data_count = 0; |
| 279 | 279 | oric_data_length = 9; |
| r1461 | r1462 | |
| 286 | 286 | { |
| 287 | 287 | header[oric_data_count] = data; |
| 288 | 288 | count+=oric_calculate_byte_size_in_samples(data); |
| 289 | ||
| 289 | ||
| 290 | 290 | oric_data_count++; |
| 291 | 291 | |
| 292 | 292 | if (oric_data_count==oric_data_length) |
| r1461 | r1462 | |
| 315 | 315 | |
| 316 | 316 | oric_cassette_state = ORIC_CASSETTE_WRITE_DATA; |
| 317 | 317 | oric_data_count = 0; |
| 318 | ||
| 318 | ||
| 319 | 319 | end = (((header[4] & 0x0ff)<<8) | (header[5] & 0x0ff)); |
| 320 | 320 | start = (((header[6] & 0x0ff)<<8) | (header[7] & 0x0ff)); |
| 321 | //#ifdef ORIC_WAV_DEBUG | |
| 321 | //#ifdef ORIC_WAV_DEBUG | |
| 322 | 322 | logerror("start (from header): %02x\n",start); |
| 323 | 323 | logerror("end (from header): %02x\n",end); |
| 324 | 324 | //#endif |
| r1461 | r1462 | |
| 359 | 359 | |
| 360 | 360 | |
| 361 | 361 | /* header and trailer act as pauses */ |
| 362 | /* the trailer is required so that the via sees the last bit of the last | |
| 362 | /* the trailer is required so that the via sees the last bit of the last | |
| 363 | 363 | byte */ |
| 364 | 364 | if (bytes == CODE_HEADER) { |
| 365 | 365 | for (i = 0; i < ORIC_WAVESAMPLES_HEADER; i++) |
| r1461 | r1462 | |
| 453 | 453 | { |
| 454 | 454 | p = oric_output_bit(p,1); |
| 455 | 455 | } |
| 456 | ||
| 456 | ||
| 457 | 457 | oric_cassette_state = ORIC_CASSETTE_WRITE_DATA; |
| 458 | 458 | oric_data_count = 0; |
| 459 | ||
| 459 | ||
| 460 | 460 | end = (((header[4] & 0x0ff)<<8) | (header[5] & 0x0ff)); |
| 461 | 461 | start = (((header[6] & 0x0ff)<<8) | (header[7] & 0x0ff)); |
| 462 | //#ifdef ORIC_WAV_DEBUG | |
| 462 | //#ifdef ORIC_WAV_DEBUG | |
| 463 | 463 | logerror("start (from header): %02x\n",start); |
| 464 | 464 | logerror("end (from header): %02x\n",end); |
| 465 | 465 | //#endif |
| r1461 | r1462 | |
|---|---|---|
| 108 | 108 | } |
| 109 | 109 | offs *= geom->sector_length; |
| 110 | 110 | offs += geom->offset; |
| 111 | ||
| 111 | ||
| 112 | 112 | if (offset) |
| 113 | 113 | *offset = offs; |
| 114 | 114 | return FLOPPY_ERROR_SUCCESS; |
| r1461 | r1462 | |
| 199 | 199 | } |
| 200 | 200 | |
| 201 | 201 | memset(buffer, floppy_get_filler(floppy), sector_length); |
| 202 | ||
| 202 | ||
| 203 | 203 | for (sector = 0; sector < geometry->sectors; sector++) |
| 204 | 204 | { |
| 205 | 205 | err = basicdsk_write_sector(floppy, head, track, sector + geometry->first_sector_id, buffer, sector_length); |
| r1461 | r1462 | |
|---|---|---|
| 64 | 64 | in FM format with a 1.1 ms period (900 bauds): |
| 65 | 65 | - 0 is 5 periods at 4.5 KHz |
| 66 | 66 | - 1 is 7 periods at 6.3 KHz |
| 67 | ||
| 67 | ||
| 68 | 68 | Moreover, a byte is represented using 11 bits: |
| 69 | 69 | - one 0 start bit |
| 70 | 70 | - eight data bits (low bit first) |
| 71 | 71 | - two 1 stop bits |
| 72 | 72 | |
| 73 | 73 | There are also long (1 s) sequences of 1 bits to re-synchronize the |
| 74 | cassette at places the motor can be cut off and back on (e.g., between | |
| 74 | cassette at places the motor can be cut off and back on (e.g., between | |
| 75 | 75 | files). |
| 76 | 76 | |
| 77 | 77 | The computer outputs a modulated wave that is directly put on the cassette. |
| 78 | 78 | However, the input is demodulated by the cassette-reader before being |
| 79 | sent to the computer: we got 0 when the signal is around 4.5 KHz and | |
| 79 | sent to the computer: we got 0 when the signal is around 4.5 KHz and | |
| 80 | 80 | 1 when the signal is around 6.3 KHz. |
| 81 | 81 | */ |
| 82 | 82 | |
| r1461 | r1462 | |
| 93 | 93 | static UINT8* to7_k7_bits; |
| 94 | 94 | |
| 95 | 95 | |
| 96 | /* 1-bit cassette input to the computer | |
| 97 | inside the controller, two frequency filters (adjusted to 6.3 and 4.5 KHz) | |
| 96 | /* 1-bit cassette input to the computer | |
| 97 | inside the controller, two frequency filters (adjusted to 6.3 and 4.5 KHz) | |
| 98 | 98 | and a comparator demodulate the raw signal into 0s and 1s. |
| 99 | 99 | */ |
| 100 | 100 | int to7_get_cassette ( void ) |
| r1461 | r1462 | |
| 107 | 107 | cassette_state state = cassette_get_state( img ); |
| 108 | 108 | double pos = cassette_get_position( img ); |
| 109 | 109 | int bitpos = pos / TO7_BIT_LENGTH; |
| 110 | ||
| 111 | if ( (state & CASSETTE_MASK_MOTOR) == CASSETTE_MOTOR_DISABLED ) | |
| 110 | ||
| 111 | if ( (state & CASSETTE_MASK_MOTOR) == CASSETTE_MOTOR_DISABLED ) | |
| 112 | 112 | return 1; |
| 113 | 113 | |
| 114 | if ( K7_SPEED_HACK && to7_k7_bits ) | |
| 114 | if ( K7_SPEED_HACK && to7_k7_bits ) | |
| 115 | 115 | { |
| 116 | 116 | /* hack, feed existing bits */ |
| 117 | if ( bitpos >= to7_k7_bitsize ) | |
| 117 | if ( bitpos >= to7_k7_bitsize ) | |
| 118 | 118 | bitpos = to7_k7_bitsize -1; |
| 119 | VLOG (( "$%04x %f to7_get_cassette: state=$%X pos=%f samppos=%i bit=%i\n", | |
| 120 | activecpu_get_previouspc(), attotime_to_double(timer_get_time()), state, pos, bitpos, | |
| 119 | VLOG (( "$%04x %f to7_get_cassette: state=$%X pos=%f samppos=%i bit=%i\n", | |
| 120 | activecpu_get_previouspc(), attotime_to_double(timer_get_time()), state, pos, bitpos, | |
| 121 | 121 | to7_k7_bits[ bitpos ] )); |
| 122 | 122 | return to7_k7_bits[ bitpos ]; |
| 123 | 123 | } |
| 124 | else | |
| 124 | else | |
| 125 | 125 | { |
| 126 | 126 | /* demodulate wave signal on-the-fly */ |
| 127 | 127 | /* we simply count sign changes... */ |
| r1461 | r1462 | |
| 129 | 129 | INT8 data[40]; |
| 130 | 130 | cassette_get_samples( cass, 0, pos, TO7_BIT_LENGTH * 15. / 14., 40, 1, data, 0 ); |
| 131 | 131 | |
| 132 | for ( k = 1, chg = 0; k < 40; k++ ) | |
| 132 | for ( k = 1, chg = 0; k < 40; k++ ) | |
| 133 | 133 | { |
| 134 | if ( data[ k - 1 ] >= 0 && data[ k ] < 0 ) | |
| 134 | if ( data[ k - 1 ] >= 0 && data[ k ] < 0 ) | |
| 135 | 135 | chg++; |
| 136 | if ( data[ k - 1 ] <= 0 && data[ k ] > 0 ) | |
| 136 | if ( data[ k - 1 ] <= 0 && data[ k ] > 0 ) | |
| 137 | 137 | chg++; |
| 138 | 138 | } |
| 139 | 139 | k = ( chg >= 13 ) ? 1 : 0; |
| 140 | VLOG (( "$%04x %f to7_get_cassette: state=$%X pos=%f samppos=%i bit=%i (%i)\n", | |
| 141 | activecpu_get_previouspc(), attotime_to_double(timer_get_time()), state, pos, bitpos, | |
| 140 | VLOG (( "$%04x %f to7_get_cassette: state=$%X pos=%f samppos=%i bit=%i (%i)\n", | |
| 141 | activecpu_get_previouspc(), attotime_to_double(timer_get_time()), state, pos, bitpos, | |
| 142 | 142 | k, chg )); |
| 143 | 143 | return k; |
| 144 | 144 | } |
| 145 | ||
| 145 | ||
| 146 | 146 | } |
| 147 | else | |
| 147 | else | |
| 148 | 148 | return 0; |
| 149 | 149 | } |
| 150 | 150 | |
| r1461 | r1462 | |
| 169 | 169 | activecpu_get_previouspc(), attotime_to_double(timer_get_time()), data ? "off" : "on", |
| 170 | 170 | (int) (pos / TO7_BIT_LENGTH) )); |
| 171 | 171 | |
| 172 | if ( (state & CASSETTE_MASK_MOTOR) == CASSETTE_MOTOR_DISABLED && !data && pos > 0.3 ) | |
| 172 | if ( (state & CASSETTE_MASK_MOTOR) == CASSETTE_MOTOR_DISABLED && !data && pos > 0.3 ) | |
| 173 | 173 | { |
| 174 | 174 | /* rewind a little before starting the motor */ |
| 175 | 175 | cassette_seek( img, -0.3, SEEK_CUR ); |
| r1461 | r1462 | |
| 188 | 188 | computer which has to decode it in software (unlike TO7). |
| 189 | 189 | A 1 bit is one period at 1200 Hz; a 0 bit is one half-period at 600 Hz. |
| 190 | 190 | Bit-order is most significant bit first (unlike TO7). |
| 191 | ||
| 191 | ||
| 192 | 192 | Double-density MO6 cassettes follow the exact same mechanism, but with |
| 193 | 193 | at double frequency (perdiods at 2400 Hz, and half-perdios at 1200 Hz). |
| 194 | 194 | */ |
| r1461 | r1462 | |
| 202 | 202 | { |
| 203 | 203 | mess_image* img = thom_cassette_img(); |
| 204 | 204 | |
| 205 | if ( image_exists( img ) ) | |
| 205 | if ( image_exists( img ) ) | |
| 206 | 206 | { |
| 207 | 207 | cassette_image* cass = cassette_get_image( img ); |
| 208 | 208 | cassette_state state = cassette_get_state( img ); |
| 209 | 209 | double pos = cassette_get_position( img ); |
| 210 | 210 | INT32 hbit; |
| 211 | 211 | |
| 212 | if ( (state & CASSETTE_MASK_MOTOR) == CASSETTE_MOTOR_DISABLED ) | |
| 212 | if ( (state & CASSETTE_MASK_MOTOR) == CASSETTE_MOTOR_DISABLED ) | |
| 213 | 213 | return 1; |
| 214 | 214 | |
| 215 | 215 | cassette_get_sample( cass, 0, pos, 0, &hbit ); |
| 216 | 216 | hbit = hbit >= 0; |
| 217 | ||
| 218 | VLOG (( "$%04x %f mo5_get_cassette: state=$%X pos=%f hbitpos=%i hbit=%i\n", | |
| 219 | activecpu_get_previouspc(), attotime_to_double(timer_get_time()), state, pos, | |
| 217 | ||
| 218 | VLOG (( "$%04x %f mo5_get_cassette: state=$%X pos=%f hbitpos=%i hbit=%i\n", | |
| 219 | activecpu_get_previouspc(), attotime_to_double(timer_get_time()), state, pos, | |
| 220 | 220 | (int) (pos / MO5_HBIT_LENGTH), hbit )); |
| 221 | 221 | return hbit; |
| 222 | 222 | } |
| 223 | else | |
| 223 | else | |
| 224 | 224 | return 0; |
| 225 | 225 | } |
| 226 | 226 | |
| r1461 | r1462 | |
| 244 | 244 | activecpu_get_previouspc(), attotime_to_double(timer_get_time()), data ? "off" : "on", |
| 245 | 245 | (int) (pos / MO5_HBIT_LENGTH) )); |
| 246 | 246 | |
| 247 | if ( (state & CASSETTE_MASK_MOTOR) == CASSETTE_MOTOR_DISABLED && !data && pos > 0.3 ) | |
| 247 | if ( (state & CASSETTE_MASK_MOTOR) == CASSETTE_MOTOR_DISABLED && !data && pos > 0.3 ) | |
| 248 | 248 | { |
| 249 | 249 | /* rewind a little before starting the motor */ |
| 250 | 250 | cassette_seek( img, -0.3, SEEK_CUR ); |
| r1461 | r1462 | |
| 289 | 289 | |
| 290 | 290 | |
| 291 | 291 | |
| 292 | static const struct CassetteModulation to7_k7_modulation = | |
| 292 | static const struct CassetteModulation to7_k7_modulation = | |
| 293 | 293 | { |
| 294 | 294 | CASSETTE_MODULATION_SQUAREWAVE, |
| 295 | 295 | 4000.0, 4500.0, 5000.0, |
| r1461 | r1462 | |
| 298 | 298 | |
| 299 | 299 | |
| 300 | 300 | |
| 301 | static casserr_t to7_k7_identify ( cassette_image *cass, struct CassetteOptions *opts ) | |
| 301 | static casserr_t to7_k7_identify ( cassette_image *cass, struct CassetteOptions *opts ) | |
| 302 | 302 | { |
| 303 | 303 | casserr_t e = cassette_modulation_identify( cass, &to7_k7_modulation, opts ); |
| 304 | 304 | return e; |
| r1461 | r1462 | |
| 306 | 306 | |
| 307 | 307 | |
| 308 | 308 | |
| 309 | static casserr_t to7_k7_load( cassette_image *cass ) | |
| 309 | static casserr_t to7_k7_load( cassette_image *cass ) | |
| 310 | 310 | { |
| 311 | 311 | #if ! K7_SPEED_HACK |
| 312 | 312 | static const INT8 square_wave[] = { -128, 127 }; |
| r1461 | r1462 | |
| 319 | 319 | LOG (( "to7_k7_load: start conversion, size=%li\n", (long)size )); |
| 320 | 320 | PRINT (( "to7_k7_load: open cassette, length: %li bytes\n", (long) size )); |
| 321 | 321 | |
| 322 | if ( to7_k7_bits ) | |
| 323 | { | |
| 324 | free( to7_k7_bits ); | |
| 325 | to7_k7_bits = NULL; | |
| 322 | if ( to7_k7_bits ) | |
| 323 | { | |
| 324 | free( to7_k7_bits ); | |
| 325 | to7_k7_bits = NULL; | |
| 326 | 326 | } |
| 327 | ||
| 327 | ||
| 328 | 328 | to7_k7_bitsize = 0; |
| 329 | 329 | to7_k7_bits = auto_malloc( bitmax ); |
| 330 | 330 | |
| r1461 | r1462 | |
| 380 | 380 | K7_PUT_BIT( 1 ); \ |
| 381 | 381 | K7_PUT_BIT( 1 ); \ |
| 382 | 382 | } while (0) |
| 383 | ||
| 383 | ||
| 384 | 384 | #define K7_FILL_1( SIZE ) \ |
| 385 | 385 | do \ |
| 386 | 386 | { \ |
| r1461 | r1462 | |
| 391 | 391 | for ( ii = 0; ii < (SIZE); ii++ ) K7_PUT_BIT( 1 ); \ |
| 392 | 392 | } \ |
| 393 | 393 | } while (0) |
| 394 | ||
| 394 | ||
| 395 | 395 | #define K7_FILL_ff( SIZE ) \ |
| 396 | 396 | do \ |
| 397 | 397 | { \ |
| r1461 | r1462 | |
| 406 | 406 | |
| 407 | 407 | /* check format */ |
| 408 | 408 | cassette_image_read( cass, block, 0, 64 ); |
| 409 | for ( i = 3; ; i++ ) | |
| 409 | for ( i = 3; ; i++ ) | |
| 410 | 410 | { |
| 411 | if ( ( i >= size ) || ( i >= 64 ) ) | |
| 411 | if ( ( i >= size ) || ( i >= 64 ) ) | |
| 412 | 412 | { |
| 413 | 413 | /* ? */ |
| 414 | 414 | PRINT (( "to7_k7_load: WARNING: this does not look like a MO or TO cassette.\n" )); |
| r1461 | r1462 | |
| 420 | 420 | PRINT (( "to7_k7_load: WARNING: this looks like a MO cassette, not a TO one.\n" )); |
| 421 | 421 | break; |
| 422 | 422 | } |
| 423 | else if ( ( block[i-3] == 0xff ) && ( block[i-2] == 0x01 ) && ( block[i-1] == 0x3c ) && ! block[i] ) | |
| 423 | else if ( ( block[i-3] == 0xff ) && ( block[i-2] == 0x01 ) && ( block[i-1] == 0x3c ) && ! block[i] ) | |
| 424 | 424 | { |
| 425 | 425 | /* TO */ |
| 426 | 426 | break; |
| r1461 | r1462 | |
| 428 | 428 | } |
| 429 | 429 | |
| 430 | 430 | /* skip to first 0xff filler */ |
| 431 | for ( sz = 0; pos < size; pos++, sz++ ) | |
| 431 | for ( sz = 0; pos < size; pos++, sz++ ) | |
| 432 | 432 | { |
| 433 | 433 | cassette_image_read( cass, &in, pos, 1 ); |
| 434 | if ( in == 0xff ) | |
| 434 | if ( in == 0xff ) | |
| 435 | 435 | break; |
| 436 | 436 | } |
| 437 | if ( sz > 0 ) | |
| 437 | if ( sz > 0 ) | |
| 438 | 438 | LOG (( "to7_k7_load: skip %i trash bytes\n", sz )); |
| 439 | 439 | |
| 440 | 440 | /* loop over regular blocks */ |
| 441 | while ( pos < size ) | |
| 441 | while ( pos < size ) | |
| 442 | 442 | { |
| 443 | ||
| 443 | ||
| 444 | 444 | rebounce: |
| 445 | 445 | /* skip 0xff filler */ |
| 446 | for ( sz = 0; pos < size; pos++, sz++ ) | |
| 446 | for ( sz = 0; pos < size; pos++, sz++ ) | |
| 447 | 447 | { |
| 448 | 448 | cassette_image_read( cass, &in, pos, 1 ); |
| 449 | 449 | /* actually, we are bit laxist and treat as 0xff bytes with at least |
| 450 | 450 | 5 bits out of 8 set to 1 |
| 451 | 451 | */ |
| 452 | for ( i = 0; in; in >>= 1 ) | |
| 452 | for ( i = 0; in; in >>= 1 ) | |
| 453 | 453 | i += (in & 1); |
| 454 | if ( i < 5 ) | |
| 454 | if ( i < 5 ) | |
| 455 | 455 | break; |
| 456 | 456 | } |
| 457 | 457 | |
| 458 | 458 | /* get block header */ |
| 459 | if ( pos + 4 > size ) | |
| 459 | if ( pos + 4 > size ) | |
| 460 | 460 | { |
| 461 | pos -= sz; | |
| 462 | break; | |
| 461 | pos -= sz; | |
| 462 | break; | |
| 463 | 463 | } |
| 464 | 464 | cassette_image_read( cass, block, pos, 4 ); |
| 465 | 465 | typ = block[2]; |
| 466 | 466 | sz2 = block[3]+1; |
| 467 | if ( block[0] != 0x01 || block[1] != 0x3c || ( typ != 0x00 && typ != 0x01 && typ != 0xff ) ) | |
| 467 | if ( block[0] != 0x01 || block[1] != 0x3c || ( typ != 0x00 && typ != 0x01 && typ != 0xff ) ) | |
| 468 | 468 | { |
| 469 | 469 | pos -= sz; |
| 470 | break; | |
| 470 | break; | |
| 471 | 471 | } |
| 472 | 472 | pos += 4; |
| 473 | 473 | |
| r1461 | r1462 | |
| 476 | 476 | pos += sz2; |
| 477 | 477 | |
| 478 | 478 | /* 1-filler and 0xff-filler */ |
| 479 | if ( typ == 0 || typ == 0xff ) | |
| 479 | if ( typ == 0 || typ == 0xff ) | |
| 480 | 480 | K7_FILL_1( 1000 ); |
| 481 | 481 | K7_FILL_ff( sz ); |
| 482 | 482 | |
| 483 | 483 | /* put block */ |
| 484 | 484 | LOG (( "to7_k7_load: block off=$%x type=$%02X size=%i bitstart=%i\n", (int) pos-sz2-4, typ, sz2, to7_k7_bitsize )); |
| 485 | 485 | VLOG (( "to7_k7_load: data:" )); |
| 486 | for ( i = 0; i < sz2 + 4; i ++) | |
| 486 | for ( i = 0; i < sz2 + 4; i ++) | |
| 487 | 487 | { |
| 488 | 488 | VLOG (( " $%02X", block[i] )); |
| 489 | 489 | K7_PUT_BYTE( block[i] ); |
| r1461 | r1462 | |
| 501 | 501 | memcpy( name+9, block+12, 3 ); |
| 502 | 502 | for ( i = 0; name[i]; i++) |
| 503 | 503 | { |
| 504 | if ( name[i] < ' ' || name[i] >= 127 ) | |
| 504 | if ( name[i] < ' ' || name[i] >= 127 ) | |
| 505 | 505 | name[i] = '?'; |
| 506 | 506 | } |
| 507 | PRINT (( "to7_k7_load: file \"%s\" type=%s,%s at %imn %is\n", | |
| 508 | name, | |
| 507 | PRINT (( "to7_k7_load: file \"%s\" type=%s,%s at %imn %is\n", | |
| 508 | name, | |
| 509 | 509 | (t==0) ? "bas" : (t==1) ? "dat" : (t==2) ? "bin" : "???", |
| 510 | 510 | (u == 0) ? "a" : (u == 0xff) ? "b" : "?", |
| 511 | 511 | p / 60, p % 60 )); |
| 512 | 512 | } |
| 513 | ||
| 513 | ||
| 514 | 514 | /* extra 1-fillers */ |
| 515 | if ( typ == 0 || typ == 0xff ) | |
| 515 | if ( typ == 0 || typ == 0xff ) | |
| 516 | 516 | K7_FILL_1( 1000 ); |
| 517 | 517 | } |
| 518 | 518 | |
| 519 | 519 | /* trailing data with invalid block structure |
| 520 | 520 | => dump it in a raw form, but stay alert for hidden block starts |
| 521 | 521 | */ |
| 522 | if ( pos < size ) | |
| 522 | if ( pos < size ) | |
| 523 | 523 | { |
| 524 | 524 | invalid++; |
| 525 | 525 | LOG (( "to7_k7_load: trailing raw bytes off=$%x bitstart=%i\n", (int) pos, to7_k7_bitsize )); |
| 526 | ||
| 526 | ||
| 527 | 527 | /* put block */ |
| 528 | for (; pos < size; pos++ ) | |
| 528 | for (; pos < size; pos++ ) | |
| 529 | 529 | { |
| 530 | 530 | cassette_image_read( cass, &in, pos, 1 ); |
| 531 | for ( sz = 0; pos < size && in == 0xff; sz++ ) | |
| 531 | for ( sz = 0; pos < size && in == 0xff; sz++ ) | |
| 532 | 532 | { |
| 533 | 533 | pos++; |
| 534 | cassette_image_read( cass, &in, pos, 1 ); | |
| 534 | cassette_image_read( cass, &in, pos, 1 ); | |
| 535 | 535 | } |
| 536 | if ( invalid < 10 && sz > 4 && in == 0x01 && pos + 4 <= size ) | |
| 536 | if ( invalid < 10 && sz > 4 && in == 0x01 && pos + 4 <= size ) | |
| 537 | 537 | { |
| 538 | 538 | UINT8 in1,in2; |
| 539 | 539 | cassette_image_read( cass, &in1, pos+1, 1 ); |
| 540 | 540 | cassette_image_read( cass, &in2, pos+2, 1 ); |
| 541 | if ( (in1 == 0x3c) && ((in2 == 0x00) || (in2 == 0x01) ) ) | |
| 541 | if ( (in1 == 0x3c) && ((in2 == 0x00) || (in2 == 0x01) ) ) | |
| 542 | 542 | { |
| 543 | 543 | /* seems we have a regular block hidden in raw data => rebounce */ |
| 544 | 544 | LOG (( "to7_k7_load: hidden regular block found\n" )); |
| 545 | 545 | pos -= sz; |
| 546 | 546 | goto rebounce; |
| 547 | 547 | } |
| 548 | if ( ( ( in1 == 0x3d ) && ( in2 == 0 ) ) || ( ( in1 == 0x57 ) && ( in2 == 0x49 ) ) ) | |
| 548 | if ( ( ( in1 == 0x3d ) && ( in2 == 0 ) ) || ( ( in1 == 0x57 ) && ( in2 == 0x49 ) ) ) | |
| 549 | 549 | { |
| 550 | 550 | /* special block (Infogrames) => just prepend filler */ |
| 551 | 551 | K7_FILL_1 ( 500 ); |
| r1461 | r1462 | |
| 560 | 560 | |
| 561 | 561 | if ( invalid ) |
| 562 | 562 | PRINT (( "to7_k7_load: WARNING: the k7 has an unknown structure and may not work\n" )); |
| 563 | ||
| 563 | ||
| 564 | 564 | sz = to7_k7_bitsize * TO7_BIT_LENGTH; |
| 565 | 565 | PRINT (( "to7_k7_load: cassette length: %imn %is (%i samples)\n", sz / 60, sz % 60, to7_k7_bitsize )); |
| 566 | 566 | |
| 567 | 567 | return CASSETTE_ERROR_SUCCESS; |
| 568 | } | |
| 568 | } | |
| 569 | 569 | |
| 570 | 570 | |
| 571 | 571 | |
| 572 | static const struct CassetteFormat to7_k7 = | |
| 572 | static const struct CassetteFormat to7_k7 = | |
| 573 | 573 | { "k7", to7_k7_identify, to7_k7_load, NULL /* no save */ }; |
| 574 | 574 | |
| 575 | 575 | |
| r1461 | r1462 | |
| 578 | 578 | |
| 579 | 579 | |
| 580 | 580 | |
| 581 | static casserr_t to7_wav_identify ( cassette_image *cass, | |
| 582 | struct CassetteOptions *opts ) | |
| 581 | static casserr_t to7_wav_identify ( cassette_image *cass, | |
| 582 | struct CassetteOptions *opts ) | |
| 583 | 583 | { |
| 584 | 584 | casserr_t e = wavfile_format.identify( cass, opts ); |
| 585 | 585 | return e; |
| r1461 | r1462 | |
| 593 | 593 | struct CassetteInfo info; |
| 594 | 594 | double len; |
| 595 | 595 | |
| 596 | if ( to7_k7_bits ) | |
| 597 | { | |
| 598 | free( to7_k7_bits ); | |
| 599 | to7_k7_bits = NULL; | |
| 596 | if ( to7_k7_bits ) | |
| 597 | { | |
| 598 | free( to7_k7_bits ); | |
| 599 | to7_k7_bits = NULL; | |
| 600 | 600 | } |
| 601 | 601 | |
| 602 | if ( e != CASSETTE_ERROR_SUCCESS ) | |
| 602 | if ( e != CASSETTE_ERROR_SUCCESS ) | |
| 603 | 603 | return e; |
| 604 | 604 | |
| 605 | 605 | cassette_get_info( cass, &info ); |
| 606 | 606 | |
| 607 | 607 | len = (double) info.sample_count / info.sample_frequency; |
| 608 | ||
| 608 | ||
| 609 | 609 | PRINT (( "to7_wav_load: loading cassette, length %imn %is, %i Hz, %i bps, %i bits\n", |
| 610 | (int) len / 60, (int) len % 60, | |
| 611 | info.sample_frequency, info.bits_per_sample, | |
| 610 | (int) len / 60, (int) len % 60, | |
| 611 | info.sample_frequency, info.bits_per_sample, | |
| 612 | 612 | (int) (len / TO7_BIT_LENGTH) )); |
| 613 | 613 | |
| 614 | 614 | return CASSETTE_ERROR_SUCCESS; |
| r1461 | r1462 | |
| 626 | 626 | |
| 627 | 627 | |
| 628 | 628 | /* overloaded wav: dump info */ |
| 629 | const static struct CassetteFormat to7_wav = | |
| 629 | const static struct CassetteFormat to7_wav = | |
| 630 | 630 | { "wav", to7_wav_identify, to7_wav_load, to7_wav_save }; |
| 631 | 631 | |
| 632 | 632 | |
| r1461 | r1462 | |
| 635 | 635 | |
| 636 | 636 | |
| 637 | 637 | |
| 638 | static casserr_t mo5_k5_identify ( cassette_image *cass, | |
| 639 | struct CassetteOptions *opts ) | |
| 638 | static casserr_t mo5_k5_identify ( cassette_image *cass, | |
| 639 | struct CassetteOptions *opts ) | |
| 640 | 640 | { |
| 641 | 641 | opts -> bits_per_sample = 8; |
| 642 | 642 | opts -> channels = 1; |
| r1461 | r1462 | |
| 646 | 646 | |
| 647 | 647 | |
| 648 | 648 | |
| 649 | /* As the k7 format, the k5 format represents the stream of bytes returned by | |
| 649 | /* As the k7 format, the k5 format represents the stream of bytes returned by | |
| 650 | 650 | the BIOS cassette routine and need to be hacked back into the original |
| 651 | 651 | cassette wave. |
| 652 | 652 | |
| r1461 | r1462 | |
| 658 | 658 | FF = end of file |
| 659 | 659 | - 1-byte size |
| 660 | 660 | - size - 1 bytes of data (255 bytes of data if size = 0) |
| 661 | - one byte of CRC: sum from (and including) header up to (and including) | |
| 661 | - one byte of CRC: sum from (and including) header up to (and including) | |
| 662 | 662 | CRC byte should be 0 modulo 256 |
| 663 | 663 | |
| 664 | They are separated by 0x01 filler bytes (generally 10 of them), | |
| 665 | for synchronisation. There are also extra 0 filler bits between certain | |
| 664 | They are separated by 0x01 filler bytes (generally 10 of them), | |
| 665 | for synchronisation. There are also extra 0 filler bits between certain | |
| 666 | 666 | kinds of blocks, when the motor is supposed to go off and back on. |
| 667 | 667 | */ |
| 668 | 668 | |
| 669 | static casserr_t mo5_k5_load( cassette_image *cass ) | |
| 669 | static casserr_t mo5_k5_load( cassette_image *cass ) | |
| 670 | 670 | { |
| 671 | 671 | size_t size = cassette_image_size( cass ), pos = 0; |
| 672 | 672 | int i, sz, sz2, hbit = 0; |
| r1461 | r1462 | |
| 675 | 675 | |
| 676 | 676 | LOG (( "mo5_k5_load: start conversion, size=%li\n", (long)size )); |
| 677 | 677 | PRINT (( "mo5_k5_load: open cassette, length: %li bytes\n", (long) size )); |
| 678 | ||
| 678 | ||
| 679 | 679 | /* store a half-bit */ |
| 680 | 680 | #define K5_PUT_HBIT \ |
| 681 | 681 | do \ |
| r1461 | r1462 | |
| 683 | 683 | cassette_put_sample ( cass, 0, hbitsize * MO5_HBIT_LENGTH, MO5_HBIT_LENGTH, (hbit ? 1 : -1) << 30 ); \ |
| 684 | 684 | hbitsize++; \ |
| 685 | 685 | } while ( 0 ) |
| 686 | ||
| 686 | ||
| 687 | 687 | /* store one bit */ |
| 688 | 688 | #define K5_PUT_BIT( BIT ) \ |
| 689 | 689 | do \ |
| r1461 | r1462 | |
| 701 | 701 | } \ |
| 702 | 702 | hbit = !hbit; \ |
| 703 | 703 | } while (0) |
| 704 | ||
| 704 | ||
| 705 | 705 | /* store one byte, no start / stop bit, converse order from TO7 */ |
| 706 | 706 | #define K5_PUT_BYTE( BYTE ) \ |
| 707 | 707 | do \ |
| r1461 | r1462 | |
| 711 | 711 | for ( x = 0; x < 8; x++ ) \ |
| 712 | 712 | K5_PUT_BIT( (b >> (7 - x)) & 1 ); \ |
| 713 | 713 | } while (0) |
| 714 | ||
| 714 | ||
| 715 | 715 | /* store filler */ |
| 716 | 716 | #define K5_FILL_0( SIZE ) \ |
| 717 | 717 | do \ |
| r1461 | r1462 | |
| 724 | 724 | K5_PUT_BIT( 0 ); \ |
| 725 | 725 | } \ |
| 726 | 726 | } while (0) |
| 727 | ||
| 727 | ||
| 728 | 728 | #define K5_FILL_01( SIZE ) \ |
| 729 | 729 | do \ |
| 730 | 730 | { \ |
| r1461 | r1462 | |
| 739 | 739 | |
| 740 | 740 | /* check format */ |
| 741 | 741 | cassette_image_read( cass, block, 0, 64 ); |
| 742 | for ( i = 3; ; i++ ) | |
| 742 | for ( i = 3; ; i++ ) | |
| 743 | 743 | { |
| 744 | if ( ( i >= size ) || ( i >= 64 ) ) | |
| 744 | if ( ( i >= size ) || ( i >= 64 ) ) | |
| 745 | 745 | { |
| 746 | 746 | /* ? */ |
| 747 | 747 | PRINT (( "to5_k5_load: WARNING: this does not look like a MO or TO cassette.\n" )); |
| 748 | 748 | break; |
| 749 | 749 | } |
| 750 | else if ( ( block[i-3] == 0x01 ) && ( block[i-2] == 0x3c ) && ( block[i-1] == 0x5a ) && ! block[i] ) | |
| 750 | else if ( ( block[i-3] == 0x01 ) && ( block[i-2] == 0x3c ) && ( block[i-1] == 0x5a ) && ! block[i] ) | |
| 751 | 751 | { |
| 752 | 752 | /* MO */ |
| 753 | 753 | break; |
| 754 | 754 | } |
| 755 | else if ( ( block[i-3] == 0xff ) && ( block[i-2] == 0x01 ) && ( block[i-1] == 0x3c ) && ! block[i] ) | |
| 755 | else if ( ( block[i-3] == 0xff ) && ( block[i-2] == 0x01 ) && ( block[i-1] == 0x3c ) && ! block[i] ) | |
| 756 | 756 | { |
| 757 | 757 | /* TO */ |
| 758 | 758 | PRINT (( "to5_k5_load: WARNING: this looks like a TO cassette, not a MO one.\n" )); |
| r1461 | r1462 | |
| 761 | 761 | } |
| 762 | 762 | |
| 763 | 763 | cassette_image_read( cass, block, pos, 6 ); |
| 764 | if ( ! memcmp( block, "DCMOTO", 6 ) || ! memcmp( block, "DCMO5", 5 ) || ! memcmp( block, "DCMO6", 5 ) ) | |
| 764 | if ( ! memcmp( block, "DCMOTO", 6 ) || ! memcmp( block, "DCMO5", 5 ) || ! memcmp( block, "DCMO6", 5 ) ) | |
| 765 | 765 | dcmoto = 1; |
| 766 | ||
| 766 | ||
| 767 | 767 | /* loop over regular blocks */ |
| 768 | while ( pos < size ) | |
| 768 | while ( pos < size ) | |
| 769 | 769 | { |
| 770 | 770 | |
| 771 | 771 | rebounce: |
| 772 | 772 | /* skip DCMOTO header*/ |
| 773 | if ( dcmoto ) | |
| 773 | if ( dcmoto ) | |
| 774 | 774 | { |
| 775 | 775 | cassette_image_read( cass, block, pos, 6 ); |
| 776 | if ( ! memcmp( block, "DCMOTO", 6 ) ) | |
| 776 | if ( ! memcmp( block, "DCMOTO", 6 ) ) | |
| 777 | 777 | { |
| 778 | 778 | LOG (( "mo5_k5_load: DCMOTO signature found at off=$%x\n", pos )); |
| 779 | 779 | pos += 6; |
| 780 | 780 | } |
| 781 | else if ( ! memcmp( block, "DCMO", 4 ) ) | |
| 781 | else if ( ! memcmp( block, "DCMO", 4 ) ) | |
| 782 | 782 | { |
| 783 | 783 | LOG (( "mo5_k5_load: DCMO* signature found at off=$%x\n", pos )); |
| 784 | 784 | pos += 5; |
| 785 | 785 | } |
| 786 | 786 | } |
| 787 | ||
| 787 | ||
| 788 | 788 | /* skip 0x01 filler */ |
| 789 | for ( sz = 0; pos < size; pos++, sz++ ) | |
| 789 | for ( sz = 0; pos < size; pos++, sz++ ) | |
| 790 | 790 | { |
| 791 | 791 | cassette_image_read( cass, &in, pos, 1 ); |
| 792 | 792 | if ( in != 0x01 ) |
| r1461 | r1462 | |
| 794 | 794 | } |
| 795 | 795 | |
| 796 | 796 | /* get block header */ |
| 797 | if ( pos + 4 > size ) | |
| 797 | if ( pos + 4 > size ) | |
| 798 | 798 | { |
| 799 | 799 | pos -= sz; |
| 800 | break; | |
| 800 | break; | |
| 801 | 801 | } |
| 802 | 802 | cassette_image_read( cass, block, pos, 4 ); |
| 803 | 803 | typ = block[2]; |
| 804 | 804 | sz2 = (UINT8) (block[3]-1); |
| 805 | if ( block[0] != 0x3c || block[1] != 0x5a || ( typ != 0x00 && typ != 0x01 && typ != 0xff ) || pos+sz2 > size ) | |
| 806 | { | |
| 805 | if ( block[0] != 0x3c || block[1] != 0x5a || ( typ != 0x00 && typ != 0x01 && typ != 0xff ) || pos+sz2 > size ) | |
| 806 | { | |
| 807 | 807 | pos -= sz; |
| 808 | break; | |
| 808 | break; | |
| 809 | 809 | } |
| 810 | 810 | pos += 4; |
| 811 | 811 | |
| r1461 | r1462 | |
| 814 | 814 | pos += sz2; |
| 815 | 815 | |
| 816 | 816 | /* 0-fillers and 0x01-fillers */ |
| 817 | if ( typ == 0 || typ == 0xff ) | |
| 817 | if ( typ == 0 || typ == 0xff ) | |
| 818 | 818 | K5_FILL_0( 1200 ); |
| 819 | else | |
| 819 | else | |
| 820 | 820 | K5_FILL_0( 300 ); /* for MO6 */ |
| 821 | 821 | K5_FILL_01( sz < 10 ? 10 : sz ); |
| 822 | 822 | |
| 823 | 823 | /* put block */ |
| 824 | 824 | LOG (( "mo5_k5_load: block off=$%x type=$%02X size=%i hbitstart=%i\n", (int) pos-sz2-4, typ, sz2, hbitsize )); |
| 825 | 825 | VLOG (( "mo5_k5_load: data:" )); |
| 826 | for ( i = 0; i < sz2 + 4; i ++) | |
| 826 | for ( i = 0; i < sz2 + 4; i ++) | |
| 827 | 827 | { |
| 828 | 828 | VLOG (( " $%02X", block[i] )); |
| 829 | 829 | K5_PUT_BYTE( block[i] ); |
| r1461 | r1462 | |
| 831 | 831 | VLOG (( "\n" )); |
| 832 | 832 | |
| 833 | 833 | /* checksum */ |
| 834 | for ( i = 0, sum = 0; i < sz2; i++ ) | |
| 834 | for ( i = 0, sum = 0; i < sz2; i++ ) | |
| 835 | 835 | sum += block[i+4]; |
| 836 | 836 | if ( sum ) |
| 837 | 837 | LOG(( "mo5_k5_load: invalid checksum $%02X (should be 0)\n", sum )); |
| r1461 | r1462 | |
| 847 | 847 | memcpy( name+9, block+12, 3 ); |
| 848 | 848 | for ( i = 0; name[i]; i++) |
| 849 | 849 | { |
| 850 | if ( name[i] < ' ' || name[i] >= 127 ) | |
| 850 | if ( name[i] < ' ' || name[i] >= 127 ) | |
| 851 | 851 | name[i] = '?'; |
| 852 | 852 | } |
| 853 | PRINT (( "mo5_k5_load: file \"%s\" type=%s,%s at %imn %is\n", | |
| 854 | name, | |
| 853 | PRINT (( "mo5_k5_load: file \"%s\" type=%s,%s at %imn %is\n", | |
| 854 | name, | |
| 855 | 855 | (t==0) ? "bas" : (t==1) ? "dat" : (t==2) ? "bin" : "???", |
| 856 | 856 | (u == 0) ? "a" : (u == 0xff) ? "b" : "?", |
| 857 | 857 | p / 60, p % 60 )); |
| 858 | 858 | } |
| 859 | 859 | |
| 860 | 860 | /* 0-fillers */ |
| 861 | if ( typ == 0xff || typ == 0x00 ) | |
| 861 | if ( typ == 0xff || typ == 0x00 ) | |
| 862 | 862 | K5_FILL_0( 1800 ); |
| 863 | 863 | } |
| 864 | 864 | |
| 865 | 865 | /* dump trailing bytes, but also look for beginings of blocks */ |
| 866 | if ( pos < size ) | |
| 866 | if ( pos < size ) | |
| 867 | 867 | { |
| 868 | 868 | invalid++; |
| 869 | 869 | K5_FILL_0( 1200 ); |
| 870 | 870 | LOG (( "mo5_k5_load: trailing trash off=$%x size=%i hbitstart=%i\n", (int) pos, (int) size-pos, hbitsize )); |
| 871 | for ( ; pos < size; pos++ ) | |
| 871 | for ( ; pos < size; pos++ ) | |
| 872 | 872 | { |
| 873 | cassette_image_read( cass, &in, pos, 1 ); | |
| 874 | if ( dcmoto && in=='D' ) | |
| 873 | cassette_image_read( cass, &in, pos, 1 ); | |
| 874 | if ( dcmoto && in=='D' ) | |
| 875 | 875 | { |
| 876 | 876 | /* skip DCMOTO header*/ |
| 877 | 877 | cassette_image_read( cass, block, pos, 6 ); |
| 878 | 878 | if ( ! memcmp( block, "DCMOTO", 6 ) ) |
| 879 | 879 | { |
| 880 | 880 | LOG (( "mo5_k5_load: DCMOTO signature found at off=$%x\n", pos )); |
| 881 | pos += 6; | |
| 882 | cassette_image_read( cass, &in, pos, 1 ); | |
| 881 | pos += 6; | |
| 882 | cassette_image_read( cass, &in, pos, 1 ); | |
| 883 | 883 | } |
| 884 | else if ( ! memcmp( block, "DCMO", 4 ) ) | |
| 884 | else if ( ! memcmp( block, "DCMO", 4 ) ) | |
| 885 | 885 | { |
| 886 | 886 | LOG (( "mo5_k5_load: DCMO* signature found at off=$%x\n", pos )); |
| 887 | pos += 5; | |
| 888 | cassette_image_read( cass, &in, pos, 1 ); | |
| 887 | pos += 5; | |
| 888 | cassette_image_read( cass, &in, pos, 1 ); | |
| 889 | 889 | } |
| 890 | 890 | } |
| 891 | for ( sz = 0; pos < size && in == 0x01; sz++ ) | |
| 891 | for ( sz = 0; pos < size && in == 0x01; sz++ ) | |
| 892 | 892 | { |
| 893 | 893 | pos++; |
| 894 | cassette_image_read( cass, &in, pos, 1 ); | |
| 894 | cassette_image_read( cass, &in, pos, 1 ); | |
| 895 | 895 | } |
| 896 | if ( sz > 6 ) | |
| 896 | if ( sz > 6 ) | |
| 897 | 897 | { |
| 898 | 898 | cassette_image_read( cass, &in2, pos+1, 1 ); |
| 899 | 899 | cassette_image_read( cass, &in3, pos+2, 1 ); |
| 900 | if ( invalid < 10 && in == 0x3c && in2 == 0x5a && (in3 == 0x00 || in3 == 0x01 || in3 == 0xff ) ) | |
| 900 | if ( invalid < 10 && in == 0x3c && in2 == 0x5a && (in3 == 0x00 || in3 == 0x01 || in3 == 0xff ) ) | |
| 901 | 901 | { |
| 902 | 902 | /* regular block found */ |
| 903 | 903 | LOG (( "mo5_k5_load: hidden regular block found\n" )); |
| 904 | 904 | pos -= sz; |
| 905 | 905 | goto rebounce; |
| 906 | 906 | } |
| 907 | if ( invalid < 10 && sz > 6 && ( (in == 0x3c && in2 == 0x5a) || (in == 0xc3 && in2 == 0x5a) || (in == 0xc3 && in2 == 0x3c) || (in == 0x87 && in2 == 0x4a) ) ) | |
| 907 | if ( invalid < 10 && sz > 6 && ( (in == 0x3c && in2 == 0x5a) || (in == 0xc3 && in2 == 0x5a) || (in == 0xc3 && in2 == 0x3c) || (in == 0x87 && in2 == 0x4a) ) ) | |
| 908 | 908 | { |
| 909 | 909 | /* special block found */ |
| 910 | 910 | K5_FILL_0( 1200 ); |
| 911 | 911 | LOG (( "mo5_k5_load: special block $%02X $%02X found off=$%x hbitstart=%i\n", in, in2, (int) pos-sz, hbitsize )); |
| 912 | 912 | } |
| 913 | 913 | } |
| 914 | ||
| 914 | ||
| 915 | 915 | VLOG (( "mo5_k5_load: special data:" )); |
| 916 | for ( i = 0; i < sz; i++ ) | |
| 916 | for ( i = 0; i < sz; i++ ) | |
| 917 | 917 | { |
| 918 | 918 | K5_PUT_BYTE( 0x01 ); |
| 919 | 919 | VLOG (( " $01" )); |
| r1461 | r1462 | |
| 923 | 923 | } |
| 924 | 924 | } |
| 925 | 925 | |
| 926 | if ( invalid ) | |
| 926 | if ( invalid ) | |
| 927 | 927 | PRINT (( "mo5_k5_load: WARNING: the k5 has an unknown structure and may not work\n" )); |
| 928 | 928 | |
| 929 | 929 | sz = hbitsize * MO5_HBIT_LENGTH; |
| 930 | 930 | PRINT (( "mo5_k5_load: cassette length: %imn %is (%i half-bits)\n", sz / 60, sz % 60, hbitsize )); |
| 931 | ||
| 931 | ||
| 932 | 932 | return CASSETTE_ERROR_SUCCESS; |
| 933 | 933 | } |
| 934 | 934 | |
| 935 | 935 | |
| 936 | 936 | |
| 937 | static const struct CassetteFormat mo5_k5 = | |
| 937 | static const struct CassetteFormat mo5_k5 = | |
| 938 | 938 | { "k5,k7", mo5_k5_identify, mo5_k5_load, NULL /* no save */ }; |
| 939 | 939 | |
| 940 | 940 | |
| r1461 | r1462 | |
| 942 | 942 | |
| 943 | 943 | |
| 944 | 944 | |
| 945 | static casserr_t mo5_wav_identify ( cassette_image *cass, | |
| 946 | struct CassetteOptions *opts ) | |
| 945 | static casserr_t mo5_wav_identify ( cassette_image *cass, | |
| 946 | struct CassetteOptions *opts ) | |
| 947 | 947 | { |
| 948 | 948 | casserr_t e = wavfile_format.identify( cass, opts ); |
| 949 | 949 | return e; |
| r1461 | r1462 | |
| 956 | 956 | casserr_t e = wavfile_format.load( cass ); |
| 957 | 957 | struct CassetteInfo info; |
| 958 | 958 | int len; |
| 959 | if ( e == CASSETTE_ERROR_SUCCESS ) | |
| 959 | if ( e == CASSETTE_ERROR_SUCCESS ) | |
| 960 | 960 | { |
| 961 | 961 | cassette_get_info( cass, &info ); |
| 962 | 962 | len = info.sample_count / info.sample_frequency; |
| r1461 | r1462 | |
| 977 | 977 | |
| 978 | 978 | |
| 979 | 979 | /* overloaded wav: dump info */ |
| 980 | const static struct CassetteFormat mo5_wav = | |
| 980 | const static struct CassetteFormat mo5_wav = | |
| 981 | 981 | { "wav", mo5_wav_identify, mo5_wav_load, mo5_wav_save }; |
| 982 | 982 | |
| 983 | 983 | |
| r1461 | r1462 | |
| 985 | 985 | /********************* formats ************************/ |
| 986 | 986 | |
| 987 | 987 | |
| 988 | const struct CassetteFormat *const to7_cassette_formats[] = | |
| 988 | const struct CassetteFormat *const to7_cassette_formats[] = | |
| 989 | 989 | { &to7_wav, &to7_k7, NULL }; |
| 990 | 990 | |
| 991 | 991 | |
| 992 | const struct CassetteFormat *const mo5_cassette_formats[] = | |
| 992 | const struct CassetteFormat *const mo5_cassette_formats[] = | |
| 993 | 993 | { &mo5_wav, &mo5_k5, NULL }; |
| 994 | 994 | |
| 995 | 995 | |
| r1461 | r1462 | |
| 998 | 998 | |
| 999 | 999 | void to7_cassette_getinfo( const device_class *devclass, UINT32 state, union devinfo *info ) |
| 1000 | 1000 | { |
| 1001 | switch ( state ) | |
| 1001 | switch ( state ) | |
| 1002 | 1002 | { |
| 1003 | case DEVINFO_INT_COUNT: | |
| 1003 | case DEVINFO_INT_COUNT: | |
| 1004 | 1004 | info->i = 1; |
| 1005 | 1005 | break; |
| 1006 | 1006 | case DEVINFO_PTR_CASSETTE_FORMATS: |
| 1007 | info->p = (void *) to7_cassette_formats; | |
| 1007 | info->p = (void *) to7_cassette_formats; | |
| 1008 | 1008 | break; |
| 1009 | case DEVINFO_INT_CASSETTE_DEFAULT_STATE: | |
| 1010 | info->i = | |
| 1011 | CASSETTE_PLAY | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED; | |
| 1009 | case DEVINFO_INT_CASSETTE_DEFAULT_STATE: | |
| 1010 | info->i = | |
| 1011 | CASSETTE_PLAY | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED; | |
| 1012 | 1012 | break; |
| 1013 | 1013 | case DEVINFO_STR_DEV_FILE: |
| 1014 | 1014 | strcpy( info->s = device_temp_str(), __FILE__ ); |
| 1015 | 1015 | break; |
| 1016 | default: | |
| 1016 | default: | |
| 1017 | 1017 | cassette_device_getinfo( devclass, state, info ); |
| 1018 | 1018 | } |
| 1019 | 1019 | } |
| r1461 | r1462 | |
| 1021 | 1021 | |
| 1022 | 1022 | void mo5_cassette_getinfo( const device_class *devclass, UINT32 state, union devinfo *info ) |
| 1023 | 1023 | { |
| 1024 | switch ( state ) | |
| 1024 | switch ( state ) | |
| 1025 | 1025 | { |
| 1026 | case DEVINFO_INT_COUNT: | |
| 1026 | case DEVINFO_INT_COUNT: | |
| 1027 | 1027 | info->i = 1; |
| 1028 | 1028 | break; |
| 1029 | 1029 | case DEVINFO_PTR_CASSETTE_FORMATS: |
| 1030 | info->p = (void *) mo5_cassette_formats; | |
| 1030 | info->p = (void *) mo5_cassette_formats; | |
| 1031 | 1031 | break; |
| 1032 | case DEVINFO_INT_CASSETTE_DEFAULT_STATE: | |
| 1033 | info->i = | |
| 1034 | CASSETTE_PLAY | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED; | |
| 1032 | case DEVINFO_INT_CASSETTE_DEFAULT_STATE: | |
| 1033 | info->i = | |
| 1034 | CASSETTE_PLAY | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED; | |
| 1035 | 1035 | break; |
| 1036 | 1036 | case DEVINFO_STR_DEV_FILE: |
| 1037 | 1037 | strcpy( info->s = device_temp_str(), __FILE__ ); |
| 1038 | 1038 | break; |
| 1039 | default: | |
| 1039 | default: | |
| 1040 | 1040 | cassette_device_getinfo( devclass, state, info ); |
| 1041 | 1041 | } |
| 1042 | 1042 | } |
| r1461 | r1462 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | 2 | |
| 3 | 3 | TODO: |
| 4 | ||
| 4 | ||
| 5 | 5 | - pcb layout guru-style readme |
| 6 | 6 | - tape interface |
| 7 | 7 | - discrete sound from NE555 |
| r1461 | r1462 | |
| 130 | 130 | set_led_status(1, level); |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | static const CDP1802_CONFIG vip_config = | |
| 133 | static const CDP1802_CONFIG vip_config = | |
| 134 | 134 | { |
| 135 | 135 | vip_mode_r, |
| 136 | 136 | vip_ef_r, |
| r1461 | r1462 | |
|---|---|---|
| 81 | 81 | |
| 82 | 82 | static INPUT_PORTS_START( wswan ) |
| 83 | 83 | PORT_START /* IN 0 : cursors (X1-X4) */ |
| 84 | PORT_BIT( 0x1, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP) PORT_NAME("X1 - Up") | |
| 85 | PORT_BIT( 0x4, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) PORT_NAME("X3 - Down") | |
| 86 | PORT_BIT( 0x8, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_NAME("X4 - Left") | |
| 87 | PORT_BIT( 0x2, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_NAME("X2 - Right") | |
| 84 | PORT_BIT( 0x1, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP) PORT_NAME("X1 - Up") | |
| 85 | PORT_BIT( 0x4, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) PORT_NAME("X3 - Down") | |
| 86 | PORT_BIT( 0x8, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_NAME("X4 - Left") | |
| 87 | PORT_BIT( 0x2, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_NAME("X2 - Right") | |
| 88 | 88 | PORT_START /* IN 1 : Buttons */ |
| 89 | PORT_BIT( 0x2, IP_ACTIVE_HIGH, IPT_START1) PORT_NAME("Start") | |
| 90 | PORT_BIT( 0x4, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Button A") | |
| 91 | PORT_BIT( 0x8, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_NAME("Button B") | |
| 89 | PORT_BIT( 0x2, IP_ACTIVE_HIGH, IPT_START1) PORT_NAME("Start") | |
| 90 | PORT_BIT( 0x4, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Button A") | |
| 91 | PORT_BIT( 0x8, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_NAME("Button B") | |
| 92 | 92 | PORT_START /* IN 2 : cursors (Y1-Y4) */ |
| 93 | 93 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Y1 - Left") PORT_CODE(KEYCODE_A) |
| 94 | 94 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Y3 - Right") PORT_CODE(KEYCODE_D) |
| r1461 | r1462 | |
|---|---|---|
| 123 | 123 | |
| 124 | 124 | PORT_START_TAG("IN9") // special keys 1 |
| 125 | 125 | PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 126 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x90") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) | |
| 126 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x90") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) | |
| 127 | 127 | PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 128 | 128 | |
| 129 | 129 | PORT_START_TAG("IN10") // special keys 2 |
| 130 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BACKSPACE") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) | |
| 130 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BACKSPACE") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) | |
| 131 | 131 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("GRAPHICS") PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_SHIFT_2) |
| 132 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x92") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) | |
| 133 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x91") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) | |
| 134 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x93") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) | |
| 132 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x92") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) | |
| 133 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x91") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) | |
| 134 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x93") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) | |
| 135 | 135 | PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 136 | 136 | INPUT_PORTS_END |
| 137 | 137 | |
| r1461 | r1462 | |
| 208 | 208 | |
| 209 | 209 | PORT_START_TAG("IN9") // special keys 1 |
| 210 | 210 | PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 211 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x90") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) | |
| 211 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x90") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) | |
| 212 | 212 | PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 213 | 213 | |
| 214 | 214 | PORT_START_TAG("IN10") // special keys 2 |
| 215 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BACKSPACE") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) | |
| 215 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BACKSPACE") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) | |
| 216 | 216 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("GRAPHICS") PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_SHIFT_2) |
| 217 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x92") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) | |
| 218 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x91") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) | |
| 219 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x93") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) | |
| 217 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x92") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) | |
| 218 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x91") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) | |
| 219 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x93") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) | |
| 220 | 220 | PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 221 | 221 | INPUT_PORTS_END |
| 222 | 222 | |
| r1461 | r1462 | |
| 290 | 290 | |
| 291 | 291 | PORT_START_TAG("IN9") // special keys 1 |
| 292 | 292 | PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 293 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x90") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) | |
| 293 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x90") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) | |
| 294 | 294 | PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 295 | 295 | |
| 296 | 296 | PORT_START_TAG("IN10") // special keys 2 |
| 297 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x91") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) | |
| 298 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x93") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) | |
| 299 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x92") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) | |
| 300 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BACKSPACE") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) | |
| 297 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x91") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) | |
| 298 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x93") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) | |
| 299 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x92") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) | |
| 300 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BACKSPACE") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) | |
| 301 | 301 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("GRAPHICS") PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_SHIFT_2) |
| 302 | 302 | PORT_BIT(0xe0, IP_ACTIVE_LOW, IPT_UNUSED) |
| 303 | 303 | INPUT_PORTS_END |
| r1461 | r1462 | |
| 490 | 490 | ROMX_LOAD( "zx81.rom", 0x0000, 0x2000, CRC(fcbbd617) SHA1(a0ade36540561cc1691bb6f0c42ceae12484a102), ROM_BIOS(2) ) |
| 491 | 491 | ROM_SYSTEM_BIOS(2, "2nd", "2nd rev.") |
| 492 | 492 | ROMX_LOAD( "zx81a.rom", 0x0000, 0x2000, CRC(4b1dd6eb) SHA1(7b143ee964e9ada89d1f9e88f0bd48d919184cfc), ROM_BIOS(3) ) |
| 493 | ROM_END | |
| 493 | ROM_END | |
| 494 | 494 | |
| 495 | 495 | ROM_START(h4th) |
| 496 | 496 | ROM_REGION( 0x10000, REGION_CPU1,0 ) |
| 497 | 497 | ROM_LOAD( "h4th.rom", 0x0000, 0x2000, CRC(257d5a32) SHA1(03809a6b464609ff924f7e55a85eef875cd47ae8) ) |
| 498 | ROM_END | |
| 498 | ROM_END | |
| 499 | 499 | |
| 500 | 500 | ROM_START(tree4th) |
| 501 | 501 | ROM_REGION( 0x10000, REGION_CPU1,0 ) |
| 502 | 502 | ROM_LOAD( "tree4th.rom", 0x0000, 0x2000, CRC(71616238) SHA1(3ee15779e03482b10fc59eb4df2446376c56b00d) ) |
| 503 | ROM_END | |
| 503 | ROM_END | |
| 504 | 504 | |
| 505 | 505 | ROM_START(ts1000) |
| 506 | 506 | ROM_REGION( 0x10000, REGION_CPU1,0 ) |
| r1461 | r1462 | |
| 529 | 529 | |
| 530 | 530 | ROM_REGION( 0x200, REGION_GFX1, 0 ) |
| 531 | 531 | ROM_LOAD( "8300_fnt.bin", 0x0000, 0x0200, CRC(6bd0408c) SHA1(34a7a5afee511dc8bba28eccf305c873d80a557a) ) |
| 532 | ROM_END | |
| 532 | ROM_END | |
| 533 | 533 | |
| 534 | 534 | /* System Configuration */ |
| 535 | 535 |
| r1461 | r1462 | |
|---|---|---|
| 4 | 4 | |
| 5 | 5 | Dragon Beta prototype, based on two 68B09E processors, WD2797, 6845. |
| 6 | 6 | |
| 7 | Project Beta was the second machine that Dragon Data had in development at | |
| 8 | the time they ceased trading, the first being Project Alpha (also know as the | |
| 9 | Dragon Professional). | |
| 7 | Project Beta was the second machine that Dragon Data had in development at | |
| 8 | the time they ceased trading, the first being Project Alpha (also know as the | |
| 9 | Dragon Professional). | |
| 10 | 10 | |
| 11 | The machine uses dual 68B09 cpus which both sit on the same bus and access | |
| 12 | the same memory and IO chips ! The first is the main processor, used to run | |
| 13 | user code, the second is uses as a DMA controler, to amongst other things | |
| 14 | disk data transfers. The first processor controled the second by having the | |
| 15 | halt and nmi lines from the second cpu connected to PIA output lines so | |
| 16 | that the could be changed under OS control. The first CPU just passed | |
| 17 | instructions for the block to be transfered in 5 low ram addresses and | |
| 11 | The machine uses dual 68B09 cpus which both sit on the same bus and access | |
| 12 | the same memory and IO chips ! The first is the main processor, used to run | |
| 13 | user code, the second is uses as a DMA controler, to amongst other things | |
| 14 | disk data transfers. The first processor controled the second by having the | |
| 15 | halt and nmi lines from the second cpu connected to PIA output lines so | |
| 16 | that the could be changed under OS control. The first CPU just passed | |
| 17 | instructions for the block to be transfered in 5 low ram addresses and | |
| 18 | 18 | generated an NMI on the second CPU. |
| 19 | 19 | |
| 20 | 20 | Project Beta like the other Dragons used a WD2797 floppy disk controler |
| 21 | 21 | which is memory mapped, and controled by the second CPU. |
| 22 | 22 | |
| 23 | Unlike the other Dragon machines, project Beta used a 68b45 to generate video, | |
| 24 | and totally did away with the SAM. | |
| 23 | Unlike the other Dragon machines, project Beta used a 68b45 to generate video, | |
| 24 | and totally did away with the SAM. | |
| 25 | 25 | |
| 26 | The machine has a 6551 ACIA chip, but I have not yet found where this is | |
| 26 | The machine has a 6551 ACIA chip, but I have not yet found where this is | |
| 27 | 27 | memory mapped. |
| 28 | 28 | |
| 29 | Project Beta, had a custom MMU bilt from a combination of LSTTL logic, and | |
| 30 | PAL programable logic. This MMU could address 256 blocks of 4K, giving a | |
| 29 | Project Beta, had a custom MMU bilt from a combination of LSTTL logic, and | |
| 30 | PAL programable logic. This MMU could address 256 blocks of 4K, giving a | |
| 31 | 31 | total addressable range of 1 megabyte, of this the first 768KB could be RAM, |
| 32 | 32 | however tha machine by default, came with 256K or ram, and a 16K boot rom, |
| 33 | 33 | which contained an OS-9 Level 2 bootstrap. |
| 34 | 34 | |
| 35 | 35 | A lot of the infomrmation required to start work on this driver has been |
| 36 | infered from disassembly of the boot rom, and from what little hardware | |
| 37 | documentation still exists. | |
| 36 | infered from disassembly of the boot rom, and from what little hardware | |
| 37 | documentation still exists. | |
| 38 | 38 | |
| 39 | 39 | ***************************************************************************/ |
| 40 | 40 | |
| r1461 | r1462 | |
| 52 | 52 | #include "mslegacy.h" |
| 53 | 53 | |
| 54 | 54 | /* |
| 55 | Colour codes are as below acording to os-9 headers, however the presise values | |
| 56 | may not be quite correct, also this will need changing as the pallate seems to | |
| 57 | be controled by a 4x4bit register file in the video hardware | |
| 58 | The text video ram seems to be aranged of words of character, attribute | |
| 59 | The colour codes are stored in the attribute byte along with : | |
| 60 | Underline bit $40 | |
| 55 | Colour codes are as below acording to os-9 headers, however the presise values | |
| 56 | may not be quite correct, also this will need changing as the pallate seems to | |
| 57 | be controled by a 4x4bit register file in the video hardware | |
| 58 | The text video ram seems to be aranged of words of character, attribute | |
| 59 | The colour codes are stored in the attribute byte along with : | |
| 60 | Underline bit $40 | |
| 61 | 61 | Flash bit $80 |
| 62 | 62 | |
| 63 | 63 | These are yet to be implemented. |
| r1461 | r1462 | |
| 89 | 89 | |
| 90 | 90 | /* |
| 91 | 91 | 2005-05-10 |
| 92 | ||
| 92 | ||
| 93 | 93 | I *THINK* I know how the memory paging works, the 64K memory map is devided |
| 94 | 94 | into 16x 4K pages, what is mapped into each page is controled by the IO at |
| 95 | 95 | FE00-FE0F like so :- |
| 96 | 96 | |
| 97 | Location Memory page Initialised to | |
| 97 | Location Memory page Initialised to | |
| 98 | 98 | $FE00 $0000-$0FFF $00 |
| 99 | 99 | $FE01 $1000-$1FFF $00 (used as ram test page, when sizing memory) |
| 100 | 100 | $FE02 $2000-$2FFF $00 |
| r1461 | r1462 | |
| 102 | 102 | $FE04 $4000-$4FFF $00 |
| 103 | 103 | $FE05 $5000-$5FFF $00 |
| 104 | 104 | $FE06 $6000-$6FFF $1F ($1F000) |
| 105 | $FE07 $7000-$7FFF $00 | |
| 105 | $FE07 $7000-$7FFF $00 | |
| 106 | 106 | $FE08 $8000-$8FFF $00 |
| 107 | 107 | $FE09 $9000-$9FFF $00 |
| 108 | 108 | $FE0A $A000-$AFFF $00 |
| r1461 | r1462 | |
| 112 | 112 | $FE0E $E000-$EFFF $FE |
| 113 | 113 | $FE0F $F000-$FFFF $FF |
| 114 | 114 | |
| 115 | The value stored at each location maps it's page to a 4K page within a 1M address | |
| 116 | space. Acording to the Beta product descriptions released by Dragon Data, the | |
| 117 | machine could have up to 768K of RAM, if this where true then pages $00-$BF could | |
| 115 | The value stored at each location maps it's page to a 4K page within a 1M address | |
| 116 | space. Acording to the Beta product descriptions released by Dragon Data, the | |
| 117 | machine could have up to 768K of RAM, if this where true then pages $00-$BF could | |
| 118 | 118 | potentially be RAM, and pages $C0-$FF would be ROM. The initialisation code maps in |
| 119 | 119 | the memory as described above. |
| 120 | 120 | |
| 121 | At reset time the Paging would of course be disabled, as the boot rom needs to be | |
| 121 | At reset time the Paging would of course be disabled, as the boot rom needs to be | |
| 122 | 122 | mapped in at $C000, the initalisation code would set up the mappings above and then |
| 123 | 123 | enable the paging hardware. |
| 124 | 124 | |
| 125 | It appears to be more complicated than this, whilst the above is true, there appear to | |
| 125 | It appears to be more complicated than this, whilst the above is true, there appear to | |
| 126 | 126 | be 16 sets of banking registers, the active set is controled by the bottom 4 bits of |
| 127 | 127 | FCC0, bit 6 has something to do with enabling and disabling banking. |
| 128 | ||
| 128 | ||
| 129 | 129 | 2005-11-28 |
| 130 | ||
| 130 | ||
| 131 | 131 | The value $C0 is garanteed not to have any memory in it acording to the os9 headers, |
| 132 | 132 | quite how the MMU deals with this is still unknown to me. |
| 133 | ||
| 133 | ||
| 134 | 134 | Bit 7 of $FCC0, sets maps in the system task which has fixed values for some pages, |
| 135 | 135 | the presise nature of this is yet to be descovered. |
| 136 | 136 | |
| r1461 | r1462 | |
| 143 | 143 | AM_RANGE(0x3000, 0x3FFF) AM_READWRITE(MRA8_BANK4 ,MWA8_BANK4) |
| 144 | 144 | AM_RANGE(0x4000, 0x4FFF) AM_READWRITE(MRA8_BANK5 ,MWA8_BANK5) |
| 145 | 145 | AM_RANGE(0x5000, 0x5FFF) AM_READWRITE(MRA8_BANK6 ,MWA8_BANK6) |
| 146 | AM_RANGE(0x6000, 0x6FFF) AM_READWRITE(MRA8_BANK7 ,MWA8_BANK7) AM_BASE(&videoram) AM_SIZE(&videoram_size) | |
| 146 | AM_RANGE(0x6000, 0x6FFF) AM_READWRITE(MRA8_BANK7 ,MWA8_BANK7) AM_BASE(&videoram) AM_SIZE(&videoram_size) | |
| 147 | 147 | AM_RANGE(0x7000, 0x7FFF) AM_READWRITE(MRA8_BANK8 ,MWA8_BANK8) |
| 148 | 148 | AM_RANGE(0x8000, 0x8FFF) AM_READWRITE(MRA8_BANK9 ,MWA8_BANK9) |
| 149 | 149 | AM_RANGE(0x9000, 0x9FFF) AM_READWRITE(MRA8_BANK10 ,MWA8_BANK10) |
| r1461 | r1462 | |
| 153 | 153 | AM_RANGE(0xD000, 0xDFFF) AM_READWRITE(MRA8_BANK14 ,MWA8_BANK14) |
| 154 | 154 | AM_RANGE(0xE000, 0xEFFF) AM_READWRITE(MRA8_BANK15 ,MWA8_BANK15) |
| 155 | 155 | AM_RANGE(0xF000, 0xFBFF) AM_READWRITE(MRA8_BANK16 ,MWA8_BANK16) |
| 156 | AM_RANGE(0xfC00, 0xfC1F) AM_READWRITE(MRA8_NOP ,MWA8_NOP) | |
| 156 | AM_RANGE(0xfC00, 0xfC1F) AM_READWRITE(MRA8_NOP ,MWA8_NOP) | |
| 157 | 157 | AM_RANGE(0xFC20, 0xFC23) AM_READWRITE(pia_0_r ,pia_0_w) |
| 158 | 158 | AM_RANGE(0xFC24, 0xFC27) AM_READWRITE(pia_1_r ,pia_1_w) |
| 159 | AM_RANGE(0xFC28, 0xfC7F) AM_READWRITE(MRA8_NOP ,MWA8_NOP) | |
| 160 | AM_RANGE(0xfc80, 0xfc81) AM_READWRITE(dgnbeta_6845_r ,dgnbeta_6845_w) | |
| 159 | AM_RANGE(0xFC28, 0xfC7F) AM_READWRITE(MRA8_NOP ,MWA8_NOP) | |
| 160 | AM_RANGE(0xfc80, 0xfc81) AM_READWRITE(dgnbeta_6845_r ,dgnbeta_6845_w) | |
| 161 | 161 | AM_RANGE(0xfc82, 0xfC9F) AM_READWRITE(MRA8_NOP ,MWA8_NOP) |
| 162 | 162 | AM_RANGE(0xFCA0, 0xFCA3) AM_READWRITE(MRA8_NOP ,colour_ram_w) /* 4x4bit colour ram for graphics modes */ |
| 163 | 163 | AM_RANGE(0xFCC0, 0xFCC3) AM_READWRITE(pia_2_r ,pia_2_w) |
| r1461 | r1462 | |
| 177 | 177 | /* Return shift if either shift key pressed */ |
| 178 | 178 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L-SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) |
| 179 | 179 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R-SHIFT") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) |
| 180 | ||
| 180 | ||
| 181 | 181 | /* Return FuNction key, if either ALT key pressed */ |
| 182 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L-ALT") PORT_CODE(KEYCODE_LALT) | |
| 182 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L-ALT") PORT_CODE(KEYCODE_LALT) | |
| 183 | 183 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R-ALT") PORT_CODE(KEYCODE_RALT) |
| 184 | 184 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CLEAR") PORT_CODE(KEYCODE_HOME) PORT_CHAR(12) |
| 185 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 (") PORT_CODE(KEYCODE_8) PORT_CHAR('8') | |
| 185 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 (") PORT_CODE(KEYCODE_8) PORT_CHAR('8') | |
| 186 | 186 | |
| 187 | 187 | |
| 188 | 188 | /* Set control on either CTRL key */ |
| 189 | 189 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L-Ctrl") PORT_CODE(KEYCODE_LCONTROL) |
| 190 | 190 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R-Ctrl") PORT_CODE(KEYCODE_RCONTROL) |
| 191 | ||
| 191 | ||
| 192 | 192 | PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CapsLock") PORT_CODE(KEYCODE_CAPSLOCK) |
| 193 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(0x1B) | |
| 193 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(0x1B) | |
| 194 | 194 | |
| 195 | 195 | /* PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CLEAR") PORT_CODE(KEYCODE_HOME) PORT_CHAR(12) |
| 196 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 (") PORT_CODE(KEYCODE_8) PORT_CHAR('8') | |
| 197 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(0x1B) | |
| 196 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 (") PORT_CODE(KEYCODE_8) PORT_CHAR('8') | |
| 197 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(0x1B) | |
| 198 | 198 | */ |
| 199 | 199 | |
| 200 | 200 | PORT_START /* Key row 2 */ |
| 201 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("b") PORT_CODE(KEYCODE_B) PORT_CHAR('b') | |
| 202 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("j") PORT_CODE(KEYCODE_J) PORT_CHAR('j') | |
| 203 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("i") PORT_CODE(KEYCODE_I) PORT_CHAR('i') | |
| 204 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') | |
| 205 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("u") PORT_CODE(KEYCODE_U) PORT_CHAR('u') | |
| 206 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("h") PORT_CODE(KEYCODE_H) PORT_CHAR('h') | |
| 207 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') | |
| 201 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("b") PORT_CODE(KEYCODE_B) PORT_CHAR('b') | |
| 202 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("j") PORT_CODE(KEYCODE_J) PORT_CHAR('j') | |
| 203 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("i") PORT_CODE(KEYCODE_I) PORT_CHAR('i') | |
| 204 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') | |
| 205 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("u") PORT_CODE(KEYCODE_U) PORT_CHAR('u') | |
| 206 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("h") PORT_CODE(KEYCODE_H) PORT_CHAR('h') | |
| 207 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') | |
| 208 | 208 | |
| 209 | 209 | PORT_START /* Key row 3 */ |
| 210 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("n") PORT_CODE(KEYCODE_N) PORT_CHAR('n') | |
| 211 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("k") PORT_CODE(KEYCODE_K) PORT_CHAR('k') | |
| 212 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("o") PORT_CODE(KEYCODE_O) PORT_CHAR('o') | |
| 213 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') | |
| 214 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("y") PORT_CODE(KEYCODE_Y) PORT_CHAR('y') | |
| 215 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("g") PORT_CODE(KEYCODE_G) PORT_CHAR('g') | |
| 216 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') | |
| 217 | ||
| 210 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("n") PORT_CODE(KEYCODE_N) PORT_CHAR('n') | |
| 211 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("k") PORT_CODE(KEYCODE_K) PORT_CHAR('k') | |
| 212 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("o") PORT_CODE(KEYCODE_O) PORT_CHAR('o') | |
| 213 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') | |
| 214 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("y") PORT_CODE(KEYCODE_Y) PORT_CHAR('y') | |
| 215 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("g") PORT_CODE(KEYCODE_G) PORT_CHAR('g') | |
| 216 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') | |
| 217 | ||
| 218 | 218 | PORT_START /* Key row 4 */ |
| 219 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("m") PORT_CODE(KEYCODE_M) PORT_CHAR('m') | |
| 220 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("l") PORT_CODE(KEYCODE_L) PORT_CHAR('l') | |
| 221 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("p") PORT_CODE(KEYCODE_P) PORT_CHAR('p') | |
| 222 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') | |
| 223 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("t") PORT_CODE(KEYCODE_T) PORT_CHAR('t') | |
| 224 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("f") PORT_CODE(KEYCODE_F) PORT_CHAR('f') | |
| 225 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') | |
| 226 | ||
| 219 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("m") PORT_CODE(KEYCODE_M) PORT_CHAR('m') | |
| 220 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("l") PORT_CODE(KEYCODE_L) PORT_CHAR('l') | |
| 221 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("p") PORT_CODE(KEYCODE_P) PORT_CHAR('p') | |
| 222 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') | |
| 223 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("t") PORT_CODE(KEYCODE_T) PORT_CHAR('t') | |
| 224 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("f") PORT_CODE(KEYCODE_F) PORT_CHAR('f') | |
| 225 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') | |
| 226 | ||
| 227 | 227 | PORT_START /* Key row 5 */ |
| 228 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') | |
| 229 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(';') | |
| 230 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("@") PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR('@') | |
| 231 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("^") PORT_CODE(KEYCODE_UP) PORT_CHAR('^') | |
| 232 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("v") PORT_CODE(KEYCODE_V) PORT_CHAR('v') | |
| 233 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("d") PORT_CODE(KEYCODE_D) PORT_CHAR('d') | |
| 234 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') | |
| 235 | ||
| 228 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') | |
| 229 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(';') | |
| 230 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("@") PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR('@') | |
| 231 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("^") PORT_CODE(KEYCODE_UP) PORT_CHAR('^') | |
| 232 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("v") PORT_CODE(KEYCODE_V) PORT_CHAR('v') | |
| 233 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("d") PORT_CODE(KEYCODE_D) PORT_CHAR('d') | |
| 234 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') | |
| 235 | ||
| 236 | 236 | PORT_START /* Key row 6 */ |
| 237 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') | |
| 238 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(":") PORT_CODE(KEYCODE_COLON) PORT_CHAR(':') | |
| 239 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\\") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') | |
| 240 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') | |
| 241 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("r") PORT_CODE(KEYCODE_R) PORT_CHAR('r') | |
| 242 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("s") PORT_CODE(KEYCODE_S) PORT_CHAR('s') | |
| 243 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') | |
| 244 | ||
| 237 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') | |
| 238 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(":") PORT_CODE(KEYCODE_COLON) PORT_CHAR(':') | |
| 239 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\\") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') | |
| 240 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') | |
| 241 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("r") PORT_CODE(KEYCODE_R) PORT_CHAR('r') | |
| 242 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("s") PORT_CODE(KEYCODE_S) PORT_CHAR('s') | |
| 243 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') | |
| 244 | ||
| 245 | 245 | PORT_START /* Key row 7 */ |
| 246 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') | |
| 247 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) | |
| 248 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DELETE") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) | |
| 249 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') | |
| 250 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("c") PORT_CODE(KEYCODE_C) PORT_CHAR('c') | |
| 251 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("x") PORT_CODE(KEYCODE_X) PORT_CHAR('x') | |
| 252 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') | |
| 253 | ||
| 246 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') | |
| 247 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) | |
| 248 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DELETE") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) | |
| 249 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') | |
| 250 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("c") PORT_CODE(KEYCODE_C) PORT_CHAR('c') | |
| 251 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("x") PORT_CODE(KEYCODE_X) PORT_CHAR('x') | |
| 252 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') | |
| 253 | ||
| 254 | 254 | PORT_START /* Key row 8 */ |
| 255 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ASTERISK") PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR('*') | |
| 256 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PAD_7") PORT_CODE(KEYCODE_7_PAD) PORT_CHAR('7') | |
| 257 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PAD_4") PORT_CODE(KEYCODE_4_PAD) PORT_CHAR('4') | |
| 258 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PAD_1") PORT_CODE(KEYCODE_1_PAD) PORT_CHAR('1') | |
| 259 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("e") PORT_CODE(KEYCODE_E) PORT_CHAR('e') | |
| 260 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("z") PORT_CODE(KEYCODE_Z) PORT_CHAR('z') | |
| 261 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') | |
| 262 | ||
| 255 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ASTERISK") PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR('*') | |
| 256 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PAD_7") PORT_CODE(KEYCODE_7_PAD) PORT_CHAR('7') | |
| 257 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PAD_4") PORT_CODE(KEYCODE_4_PAD) PORT_CHAR('4') | |
| 258 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PAD_1") PORT_CODE(KEYCODE_1_PAD) PORT_CHAR('1') | |
| 259 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("e") PORT_CODE(KEYCODE_E) PORT_CHAR('e') | |
| 260 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("z") PORT_CODE(KEYCODE_Z) PORT_CHAR('z') | |
| 261 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') | |
| 262 | ||
| 263 | 263 | PORT_START /* Key row 9 */ |
| 264 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PAD_0") PORT_CODE(KEYCODE_0_PAD) PORT_CHAR('0') | |
| 265 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PAD_8") PORT_CODE(KEYCODE_8_PAD) PORT_CHAR('8') | |
| 266 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PAD_5") PORT_CODE(KEYCODE_5_PAD) PORT_CHAR('5') | |
| 267 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PAD_2") PORT_CODE(KEYCODE_2_PAD) PORT_CHAR('2') | |
| 268 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("w") PORT_CODE(KEYCODE_W) PORT_CHAR('w') | |
| 269 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("a") PORT_CODE(KEYCODE_A) PORT_CHAR('a') | |
| 270 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') | |
| 271 | ||
| 264 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PAD_0") PORT_CODE(KEYCODE_0_PAD) PORT_CHAR('0') | |
| 265 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PAD_8") PORT_CODE(KEYCODE_8_PAD) PORT_CHAR('8') | |
| 266 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PAD_5") PORT_CODE(KEYCODE_5_PAD) PORT_CHAR('5') | |
| 267 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PAD_2") PORT_CODE(KEYCODE_2_PAD) PORT_CHAR('2') | |
| 268 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("w") PORT_CODE(KEYCODE_W) PORT_CHAR('w') | |
| 269 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("a") PORT_CODE(KEYCODE_A) PORT_CHAR('a') | |
| 270 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') | |
| 271 | ||
| 272 | 272 | PORT_START /* Key row 10 */ |
| 273 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PAD_HASH") PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR('#') | |
| 274 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PAD_9") PORT_CODE(KEYCODE_9_PAD) PORT_CHAR('9') | |
| 275 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PAD_6") PORT_CODE(KEYCODE_6_PAD) PORT_CHAR('6') | |
| 276 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PAD_3") PORT_CODE(KEYCODE_3_PAD) PORT_CHAR('3') | |
| 277 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("q") PORT_CODE(KEYCODE_Q) PORT_CHAR('q') | |
| 278 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) | |
| 279 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DOT_PAD") PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR('.') | |
| 280 | ||
| 273 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PAD_HASH") PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR('#') | |
| 274 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PAD_9") PORT_CODE(KEYCODE_9_PAD) PORT_CHAR('9') | |
| 275 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PAD_6") PORT_CODE(KEYCODE_6_PAD) PORT_CHAR('6') | |
| 276 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PAD_3") PORT_CODE(KEYCODE_3_PAD) PORT_CHAR('3') | |
| 277 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("q") PORT_CODE(KEYCODE_Q) PORT_CHAR('q') | |
| 278 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) | |
| 279 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DOT_PAD") PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR('.') | |
| 280 | ||
| 281 | 281 | PORT_START |
| 282 | 282 | INPUT_PORTS_END |
| 283 | 283 | |
| r1461 | r1462 | |
| 327 | 327 | /* basic machine hardware */ |
| 328 | 328 | MDRV_CPU_ADD_TAG("main", M6809E, DGNBETA_CPU_SPEED_HZ) /* 2 Mhz */ |
| 329 | 329 | MDRV_CPU_PROGRAM_MAP(dgnbeta_map,0) |
| 330 | ||
| 330 | ||
| 331 | 331 | /* both cpus in the beta share the same address/data busses */ |
| 332 | 332 | MDRV_CPU_ADD_TAG("dma", M6809E, DGNBETA_CPU_SPEED_HZ) /* 2 Mhz */ |
| 333 | 333 | MDRV_CPU_PROGRAM_MAP(dgnbeta_map,0) |
| 334 | 334 | |
| 335 | 335 | MDRV_SCREEN_REFRESH_RATE(DGNBETA_FRAMES_PER_SECOND) |
| 336 | 336 | MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(100)) |
| 337 | ||
| 337 | ||
| 338 | 338 | MDRV_MACHINE_START( dgnbeta ) |
| 339 | 339 | |
| 340 | 340 | /* video hardware */ |
| 341 | ||
| 341 | ||
| 342 | 342 | MDRV_SCREEN_SIZE(700,550) |
| 343 | 343 | MDRV_SCREEN_VISIBLE_AREA(0, 699, 0, 549) |
| 344 | 344 | MDRV_PALETTE_LENGTH(sizeof (dgnbeta_palette) / sizeof (dgnbeta_palette[0]) / 3) |
| r1461 | r1462 | |
| 351 | 351 | |
| 352 | 352 | ROM_START(dgnbeta) |
| 353 | 353 | ROM_REGION(0x4000,REGION_CPU1,0) |
| 354 | ROM_SYSTEM_BIOS( 0, "bootrom", "Dragon beta OS9 boot rom (1984)" ) | |
| 354 | ROM_SYSTEM_BIOS( 0, "bootrom", "Dragon beta OS9 boot rom (1984)" ) | |
| 355 | 355 | ROMX_LOAD("beta_bt.rom" ,0x0000 ,0x4000 ,CRC(4c54c1de) SHA1(141d9fcd2d187c305dff83fce2902a30072aed76), ROM_BIOS(1)) |
| 356 | ROM_SYSTEM_BIOS( 1, "testrom", "Dragon beta test rom (1984?)" ) | |
| 356 | ROM_SYSTEM_BIOS( 1, "testrom", "Dragon beta test rom (1984?)" ) | |
| 357 | 357 | ROMX_LOAD("beta_tst.rom" ,0x2000 ,0x2000 ,CRC(01d79d00) SHA1(343e08cf7656b5e8970514868df37ea0af1e2362), ROM_BIOS(2)) |
| 358 | ROM_SYSTEM_BIOS( 2, "cfiles", "cfiles rom" ) | |
| 358 | ROM_SYSTEM_BIOS( 2, "cfiles", "cfiles rom" ) | |
| 359 | 359 | ROMX_LOAD("beta_cfi.rom" ,0x2000 ,0x2000 ,CRC(d312e4c0) SHA1(5c00daac488eaf8d36d66de6ec6c746ab7b78ecf), ROM_BIOS(3)) |
| 360 | ROM_SYSTEM_BIOS( 3, "dfiles", "dfiles rom" ) | |
| 360 | ROM_SYSTEM_BIOS( 3, "dfiles", "dfiles rom" ) | |
| 361 | 361 | ROMX_LOAD("beta_dfi.rom" ,0x2000 ,0x2000 ,CRC(c4ad7f64) SHA1(50aa92a1c383321485d5a1aa41dfe4f90b3beaed), ROM_BIOS(4)) |
| 362 | 362 | |
| 363 | 363 | ROM_REGION (0x2000, REGION_GFX1, 0) |
| 364 | ROM_LOAD("betachar.rom" ,0x0000 ,0x2000 ,CRC(ca79d66c) SHA1(8e2090d471dd97a53785a7f44a49d3c8c85b41f2)) | |
| 364 | ROM_LOAD("betachar.rom" ,0x0000 ,0x2000 ,CRC(ca79d66c) SHA1(8e2090d471dd97a53785a7f44a49d3c8c85b41f2)) | |
| 365 | 365 | ROM_END |
| 366 | 366 | |
| 367 | 367 | /* Ram size can now be configured, since the machine was known as either the Dragon Beta or */ |
| r1461 | r1462 | |
| 371 | 371 | /* in blocks of 128K up to this maximum. */ |
| 372 | 372 | SYSTEM_CONFIG_START(dgnbeta) |
| 373 | 373 | CONFIG_RAM(128 * 1024) |
| 374 | CONFIG_RAM_DEFAULT(RamSize * 1024) | |
| 374 | CONFIG_RAM_DEFAULT(RamSize * 1024) | |
| 375 | 375 | CONFIG_RAM(384 * 1024) |
| 376 | 376 | CONFIG_RAM(512 * 1024) |
| 377 | 377 | CONFIG_RAM(640 * 1024) |
| r1461 | r1462 | |
|---|---|---|
| 198 | 198 | * |
| 199 | 199 | * Reading this register gives you the output of the selected columns |
| 200 | 200 | * of the pads. |
| 201 | * The buttons pressed will appear as cleared bits. | |
| 202 | * See the description of the column addressing to map the bits | |
| 201 | * The buttons pressed will appear as cleared bits. | |
| 202 | * See the description of the column addressing to map the bits | |
| 203 | 203 | * to the buttons. |
| 204 | 204 | */ |
| 205 | 205 | |
| r1461 | r1462 | |
| 223 | 223 | /* |
| 224 | 224 | * 16 12 8 4 0 |
| 225 | 225 | * +-+-------^------+--+---------+---------+ |
| 226 | * |r| unused |mu| col 1 | col 0 | | |
| 226 | * |r| unused |mu| col 1 | col 0 | | |
| 227 | 227 | * +-+--------------+--+---------+---------+ |
| 228 | 228 | * 15 8 7...4 3...0 |
| 229 | 229 | * |
| 230 | * col 0: column control of joypad 0 | |
| 230 | * col 0: column control of joypad 0 | |
| 231 | 231 | * |
| 232 | * Here you select which column of the joypad to poll. | |
| 232 | * Here you select which column of the joypad to poll. | |
| 233 | 233 | * The columns are: |
| 234 | 234 | * |
| 235 | * Joystick Joybut | |
| 236 | * col_bit|11 10 9 8 1 0 | |
| 235 | * Joystick Joybut | |
| 236 | * col_bit|11 10 9 8 1 0 | |
| 237 | 237 | * -------+--+--+--+-- ---+------ |
| 238 | 238 | * 0 | R L D U A PAUSE (RLDU = Joypad directions) |
| 239 | * 1 | * 7 4 1 B | |
| 240 | * 2 | 2 5 8 0 C | |
| 239 | * 1 | * 7 4 1 B | |
| 240 | * 2 | 2 5 8 0 C | |
| 241 | 241 | * 3 | 3 6 9 # OPTION |
| 242 | 242 | * |
| 243 | 243 | * You select a column my clearing the appropriate bit and setting |
| 244 | * all the other "column" bits. | |
| 244 | * all the other "column" bits. | |
| 245 | 245 | * |
| 246 | 246 | * |
| 247 | 247 | * col1: column control of joypad 1 |
| 248 | 248 | * |
| 249 | 249 | * This is pretty much the same as for joypad EXCEPT that the |
| 250 | 250 | * column addressing is reversed (strange!!) |
| 251 | * | |
| 252 | * Joystick Joybut | |
| 251 | * | |
| 252 | * Joystick Joybut | |
| 253 | 253 | * col_bit|15 14 13 12 3 2 |
| 254 | 254 | * -------+--+--+--+-- ---+------ |
| 255 | 255 | * 4 | 3 6 9 # OPTION |
| r1461 | r1462 | |
| 261 | 261 | * |
| 262 | 262 | * You can turn off the sound by clearing this bit. |
| 263 | 263 | * |
| 264 | * read enable (r): | |
| 264 | * read enable (r): | |
| 265 | 265 | * |
| 266 | 266 | * Set this bit to read from the joysticks, clear it to write |
| 267 | 267 | * to them. |
| r1461 | r1462 | |
|---|---|---|
| 3 | 3 | drivers/apple2gs.c |
| 4 | 4 | Apple IIgs |
| 5 | 5 | Driver by Nathan Woods and R. Belmont |
| 6 | ||
| 6 | ||
| 7 | 7 | TODO: |
| 8 | 8 | - Fix spurious interrupt problem |
| 9 | 9 | - Fix 5.25" disks |
| r1461 | r1462 | |
| 27 | 27 | | | |
| 28 | 28 | | | |
| 29 | 29 | | | |
| 30 | | | 0x1c0 (first line of Vblank, c019 and heartbeat trigger here, only true VBL if in A2 classic modes) | |
| 30 | | | 0x1c0 (first line of Vblank, c019 and heartbeat trigger here, only true VBL if in A2 classic modes) | |
| 31 | 31 | | | |
| 32 | 32 | ____________________________________ 0x1c8 (actual start of vblank in IIgs modes) |
| 33 | ||
| 33 | ||
| 34 | 34 | 0x1ff (end of frame, in vblank) |
| 35 | ||
| 35 | ||
| 36 | 36 | There are 64 HCounts total, and 704 pixels total, so HCounts do not map to the pixel clock. |
| 37 | 37 | VCounts do map directly to scanlines however, and count 262 of them. |
| 38 | 38 | |
| r1461 | r1462 | |
| 124 | 124 | { |
| 125 | 125 | extern PALETTE_INIT( apple2 ); |
| 126 | 126 | int i; |
| 127 | ||
| 127 | ||
| 128 | 128 | palette_init_apple2(machine, colortable, color_prom); |
| 129 | 129 | |
| 130 | 130 | for (i = 0; i < 16; i++) |
| 131 | 131 | { |
| 132 | palette_set_color_rgb(machine, i, | |
| 132 | palette_set_color_rgb(machine, i, | |
| 133 | 133 | apple2gs_palette[(3*i)]*17, |
| 134 | 134 | apple2gs_palette[(3*i)+1]*17, |
| 135 | 135 | apple2gs_palette[(3*i)+2]*17); |
| r1461 | r1462 | |
| 141 | 141 | return 0x80; |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | static const struct ES5503interface es5503_interface = | |
| 144 | static const struct ES5503interface es5503_interface = | |
| 145 | 145 | { |
| 146 | 146 | apple2gs_doc_irq, |
| 147 | 147 | apple2gs_adc_read, |
| r1461 | r1462 | |
|---|---|---|
| 9 | 9 | |
| 10 | 10 | #include "includes/hp48.h" |
| 11 | 11 | |
| 12 | /* hp28s | |
| 12 | /* hp28s | |
| 13 | 13 | 0-0x3ffff rom |
| 14 | 14 | 0xc0000- 0xcffff ram also mapped at 0xd0000-0xdffff */ |
| 15 | 15 | |
| r1461 | r1462 | |
| 112 | 112 | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("+/-") PORT_CODE(KEYCODE_MINUS) |
| 113 | 113 | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("EEX") PORT_CODE(KEYCODE_LEFT) |
| 114 | 114 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("DEL") PORT_CODE(KEYCODE_BACKSPACE) |
| 115 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("<==") PORT_CODE(KEYCODE_ENTER_PAD) | |
| 115 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("<==") PORT_CODE(KEYCODE_ENTER_PAD) | |
| 116 | 116 | PORT_START |
| 117 | 117 | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("alp") PORT_CODE(KEYCODE_LALT) |
| 118 | 118 | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("SIN") PORT_CODE(KEYCODE_J) |
| r1461 | r1462 | |
| 164 | 164 | GFXDECODE_ENTRY( REGION_GFX1, 0x0000, hp48_charlayout, 0, 8 ) |
| 165 | 165 | GFXDECODE_END |
| 166 | 166 | |
| 167 | static const SATURN_CONFIG config={ | |
| 168 | hp48_out, hp48_in, | |
| 167 | static const SATURN_CONFIG config={ | |
| 168 | hp48_out, hp48_in, | |
| 169 | 169 | hp48_mem_reset, hp48_mem_config, hp48_mem_unconfig, hp48_mem_id, |
| 170 | 170 | hp48_crc |
| 171 | 171 | }; |
| r1461 | r1462 | |
|---|---|---|
| 126 | 126 | static MACHINE_RESET( 3do ) |
| 127 | 127 | { |
| 128 | 128 | memory_set_bankptr(2,memory_region(REGION_USER1)); |
| 129 | ||
| 129 | ||
| 130 | 130 | /* configure overlay */ |
| 131 | 131 | memory_configure_bank(1, 0, 1, dram, 0); |
| 132 | 132 | memory_configure_bank(1, 1, 1, memory_region(REGION_USER1), 0); |
| 133 | ||
| 133 | ||
| 134 | 134 | /* start with overlay enabled */ |
| 135 | 135 | memory_set_bank(1, 1); |
| 136 | 136 |
| r1461 | r1462 | |
|---|---|---|
| 34 | 34 | fc00-fcff 8253 programmable interval timer |
| 35 | 35 | fd00-fdff discrete devices |
| 36 | 36 | fe00-feff 8255 PIO (DCE bus) |
| 37 | ff00-ffff timer + 5501 interrupt controller | |
| 37 | ff00-ffff timer + 5501 interrupt controller | |
| 38 | 38 | |
| 39 | 39 | Interrupts: |
| 40 | 40 | ----------- |
| r1461 | r1462 | |
|---|---|---|
| 186 | 186 | PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("`") PORT_CODE(KEYCODE_TILDE) PORT_CHAR('`') PORT_CHAR('~') |
| 187 | 187 | PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR('\010') |
| 188 | 188 | PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_UNUSED) /* keyboard Enter : */ |
| 189 | PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_UNUSED) /* escape: */ | |
| 189 | PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_UNUSED) /* escape: */ | |
| 190 | 190 | PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_UNUSED) /* ??? */ |
| 191 | 191 | PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Command") PORT_CODE(KEYCODE_LCONTROL) |
| 192 | 192 | PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) |
| r1461 | r1462 | |
|---|---|---|
| 26 | 26 | C000-CFFF ROM unused or monitor ROM |
| 27 | 27 | |
| 28 | 28 | ********* GTIA ******************************** |
| 29 | ||
| 29 | ||
| 30 | 30 | D000 m0pf missile 0 playfield collisions |
| 31 | 31 | D001 m1pf missile 1 playfield collisions |
| 32 | 32 | D002 m2pf missile 2 playfield collisions |
| r1461 | r1462 | |
|---|---|---|
| 1 | 1 | /****************************************************************************** |
| 2 | 2 | |
| 3 | 3 | drivers/sorc.c |
| 4 | ||
| 4 | ||
| 5 | 5 | Sord m5 system driver |
| 6 | 6 | |
| 7 | 7 | Thankyou to Roman Stec and Jan P. Naidr for the documentation and much |
| r1461 | r1462 | |
| 81 | 81 | |
| 82 | 82 | cpu_yield(); |
| 83 | 83 | |
| 84 | data = (obfa<<3)|(ibfa<<2)|2; | |
| 84 | data = (obfa<<3)|(ibfa<<2)|2; | |
| 85 | 85 | #ifdef SORD_DEBUG |
| 86 | 86 | logerror("fd5 0x030: %02x %04x\n",data, activecpu_get_pc()); |
| 87 | 87 | #endif |
| r1461 | r1462 | |
| 96 | 96 | #ifdef SORD_DEBUG |
| 97 | 97 | logerror("fd5 0x010 r: %02x %04x\n",fd5_databus,activecpu_get_pc()); |
| 98 | 98 | #endif |
| 99 | ||
| 99 | ||
| 100 | 100 | ppi8255_set_portC(0, 0x50); |
| 101 | 101 | ppi8255_set_portC(0, 0x10); |
| 102 | 102 | ppi8255_set_portC(0, 0x50); |
| r1461 | r1462 | |
| 123 | 123 | static WRITE8_HANDLER(fd5_drive_control_w) |
| 124 | 124 | { |
| 125 | 125 | int state; |
| 126 | ||
| 126 | ||
| 127 | 127 | if (data==0) |
| 128 | 128 | state = 0; |
| 129 | 129 | else |
| r1461 | r1462 | |
| 132 | 132 | #ifdef SORD_DEBUG |
| 133 | 133 | logerror("fd5 drive state w: %02x\n",state); |
| 134 | 134 | #endif |
| 135 | ||
| 135 | ||
| 136 | 136 | floppy_drive_set_motor_state(image_from_devtype_and_index(IO_FLOPPY, 0), state); |
| 137 | 137 | floppy_drive_set_motor_state(image_from_devtype_and_index(IO_FLOPPY, 0), state); |
| 138 | 138 | floppy_drive_set_ready_state(image_from_devtype_and_index(IO_FLOPPY, 1), 1,1); |
| r1461 | r1462 | |
| 159 | 159 | |
| 160 | 160 | static ADDRESS_MAP_START( writeport_sord_fd5 , ADDRESS_SPACE_IO, 8) |
| 161 | 161 | AM_RANGE( 0x001, 0x001) AM_WRITE( nec765_data_w) |
| 162 | AM_RANGE( 0x010, 0x010) AM_WRITE( fd5_data_w) | |
| 162 | AM_RANGE( 0x010, 0x010) AM_WRITE( fd5_data_w) | |
| 163 | 163 | AM_RANGE( 0x020, 0x020) AM_WRITE( fd5_communication_w) |
| 164 | 164 | AM_RANGE( 0x040, 0x040) AM_WRITE( fd5_drive_control_w) |
| 165 | 165 | AM_RANGE( 0x050, 0x050) AM_WRITE( fd5_tc_w) |
| r1461 | r1462 | |
| 210 | 210 | |
| 211 | 211 | static READ8_HANDLER(sord_ppi_porta_r) |
| 212 | 212 | { |
| 213 | cpu_yield(); | |
| 213 | cpu_yield(); | |
| 214 | 214 | |
| 215 | 215 | return fd5_databus; |
| 216 | 216 | } |
| r1461 | r1462 | |
| 261 | 261 | |
| 262 | 262 | static WRITE8_HANDLER(sord_ppi_porta_w) |
| 263 | 263 | { |
| 264 | cpu_yield(); | |
| 264 | cpu_yield(); | |
| 265 | 265 | |
| 266 | 266 | fd5_databus = data; |
| 267 | 267 | } |
| r1461 | r1462 | |
| 509 | 509 | PORT_START |
| 510 | 510 | PORT_BIT (0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) |
| 511 | 511 | PORT_BIT (0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("FUNC") PORT_CODE(KEYCODE_LALT) |
| 512 | PORT_BIT (0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LSHIFT") PORT_CODE(KEYCODE_LSHIFT) | |
| 513 | PORT_BIT (0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RSHIFT") PORT_CODE(KEYCODE_RSHIFT) | |
| 514 | PORT_BIT (0x10, 0x00, IPT_UNUSED) | |
| 515 | PORT_BIT (0x20, 0x00, IPT_UNUSED) | |
| 512 | PORT_BIT (0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LSHIFT") PORT_CODE(KEYCODE_LSHIFT) | |
| 513 | PORT_BIT (0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RSHIFT") PORT_CODE(KEYCODE_RSHIFT) | |
| 514 | PORT_BIT (0x10, 0x00, IPT_UNUSED) | |
| 515 | PORT_BIT (0x20, 0x00, IPT_UNUSED) | |
| 516 | 516 | PORT_BIT (0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) |
| 517 | 517 | PORT_BIT (0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) |
| 518 | 518 | /* line 1 */ |
| 519 | 519 | PORT_START |
| 520 | PORT_BIT (0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) | |
| 521 | PORT_BIT (0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) | |
| 522 | PORT_BIT (0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) | |
| 523 | PORT_BIT (0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) | |
| 524 | PORT_BIT (0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) | |
| 525 | PORT_BIT (0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) | |
| 526 | PORT_BIT (0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) | |
| 527 | PORT_BIT (0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) | |
| 520 | PORT_BIT (0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) | |
| 521 | PORT_BIT (0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) | |
| 522 | PORT_BIT (0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) | |
| 523 | PORT_BIT (0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) | |
| 524 | PORT_BIT (0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) | |
| 525 | PORT_BIT (0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) | |
| 526 | PORT_BIT (0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) | |
| 527 | PORT_BIT (0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) | |
| 528 | 528 | /* line 2 */ |
| 529 | 529 | PORT_START |
| 530 | PORT_BIT (0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) | |
| 531 | PORT_BIT (0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) | |
| 532 | PORT_BIT (0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) | |
| 533 | PORT_BIT (0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) | |
| 534 | PORT_BIT (0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) | |
| 535 | PORT_BIT (0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) | |
| 536 | PORT_BIT (0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) | |
| 537 | PORT_BIT (0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) | |
| 530 | PORT_BIT (0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) | |
| 531 | PORT_BIT (0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) | |
| 532 | PORT_BIT (0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) | |
| 533 | PORT_BIT (0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) | |
| 534 | PORT_BIT (0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) | |
| 535 | PORT_BIT (0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) | |
| 536 | PORT_BIT (0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) | |
| 537 | PORT_BIT (0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) | |
| 538 | 538 | /* line 3 */ |
| 539 | 539 | PORT_START |
| 540 | PORT_BIT (0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) | |
| 541 | PORT_BIT (0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) | |
| 542 | PORT_BIT (0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) | |
| 543 | PORT_BIT (0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) | |
| 544 | PORT_BIT (0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) | |
| 545 | PORT_BIT (0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) | |
| 546 | PORT_BIT (0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) | |
| 547 | PORT_BIT (0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) | |
| 540 | PORT_BIT (0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) | |
| 541 | PORT_BIT (0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) | |
| 542 | PORT_BIT (0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) | |
| 543 | PORT_BIT (0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) | |
| 544 | PORT_BIT (0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) | |
| 545 | PORT_BIT (0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) | |
| 546 | PORT_BIT (0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) | |
| 547 | PORT_BIT (0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) | |
| 548 | 548 | /* line 4 */ |
| 549 | 549 | PORT_START |
| 550 | PORT_BIT (0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) | |
| 551 | PORT_BIT (0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) | |
| 552 | PORT_BIT (0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) | |
| 553 | PORT_BIT (0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) | |
| 554 | PORT_BIT (0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) | |
| 555 | PORT_BIT (0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) | |
| 556 | PORT_BIT (0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) | |
| 557 | PORT_BIT (0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) | |
| 550 | PORT_BIT (0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) | |
| 551 | PORT_BIT (0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) | |
| 552 | PORT_BIT (0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) | |
| 553 | PORT_BIT (0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) | |
| 554 | PORT_BIT (0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) | |
| 555 | PORT_BIT (0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) | |
| 556 | PORT_BIT (0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) | |
| 557 | PORT_BIT (0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) | |
| 558 | 558 | /* line 5 */ |
| 559 | 559 | PORT_START |
| 560 | PORT_BIT (0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) | |
| 561 | PORT_BIT (0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) | |
| 562 | PORT_BIT (0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) | |
| 563 | PORT_BIT (0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("^") PORT_CODE(KEYCODE_EQUALS) | |
| 564 | PORT_BIT (0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) | |
| 565 | PORT_BIT (0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) | |
| 566 | PORT_BIT (0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("_") PORT_CODE(KEYCODE_MINUS_PAD) | |
| 567 | PORT_BIT (0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("\\") PORT_CODE(KEYCODE_BACKSLASH) | |
| 560 | PORT_BIT (0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) | |
| 561 | PORT_BIT (0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) | |
| 562 | PORT_BIT (0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) | |
| 563 | PORT_BIT (0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("^") PORT_CODE(KEYCODE_EQUALS) | |
| 564 | PORT_BIT (0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) | |
| 565 | PORT_BIT (0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) | |
| 566 | PORT_BIT (0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("_") PORT_CODE(KEYCODE_MINUS_PAD) | |
| 567 | PORT_BIT (0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("\\") PORT_CODE(KEYCODE_BACKSLASH) | |
| 568 | 568 | /* line 6 */ |
| 569 | 569 | PORT_START |
| 570 | PORT_BIT (0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) | |
| 571 | PORT_BIT (0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) | |
| 572 | PORT_BIT (0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("@") PORT_CODE(KEYCODE_QUOTE) | |
| 573 | PORT_BIT (0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_OPENBRACE) | |
| 574 | PORT_BIT (0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) | |
| 575 | PORT_BIT (0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_PLUS_PAD) | |
| 576 | PORT_BIT (0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(":") PORT_CODE(KEYCODE_COLON) | |
| 577 | PORT_BIT (0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_CLOSEBRACE) | |
| 570 | PORT_BIT (0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) | |
| 571 | PORT_BIT (0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) | |
| 572 | PORT_BIT (0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("@") PORT_CODE(KEYCODE_QUOTE) | |
| 573 | PORT_BIT (0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_OPENBRACE) | |
| 574 | PORT_BIT (0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) | |
| 575 | PORT_BIT (0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_PLUS_PAD) | |
| 576 | PORT_BIT (0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(":") PORT_CODE(KEYCODE_COLON) | |
| 577 | PORT_BIT (0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_CLOSEBRACE) | |
| 578 | 578 | /* line 7 */ |
| 579 | 579 | PORT_START |
| 580 | PORT_BIT (0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("JOY 1 RIGHT") PORT_CODE(JOYCODE_X_RIGHT_SWITCH) | |
| 581 | PORT_BIT (0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("JOY 1 UP") PORT_CODE(JOYCODE_Y_UP_SWITCH) | |
| 582 | PORT_BIT (0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("JOY 1 LEFT") PORT_CODE(JOYCODE_X_LEFT_SWITCH) | |
| 583 | PORT_BIT (0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("JOY 1 DOWN") PORT_CODE(JOYCODE_Y_DOWN_SWITCH) | |
| 584 | PORT_BIT (0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("JOY 2 RIGHT") PORT_CODE(JOYCODE_X_RIGHT_SWITCH) | |
| 585 | PORT_BIT (0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("JOY 2 UP") PORT_CODE(JOYCODE_Y_UP_SWITCH) | |
| 586 | PORT_BIT (0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("JOY 2 LEFT") PORT_CODE(JOYCODE_X_LEFT_SWITCH) | |
| 587 | PORT_BIT (0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("JOY 2 DOWN") PORT_CODE(JOYCODE_Y_DOWN_SWITCH) | |
| 580 | PORT_BIT (0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("JOY 1 RIGHT") PORT_CODE(JOYCODE_X_RIGHT_SWITCH) | |
| 581 | PORT_BIT (0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("JOY 1 UP") PORT_CODE(JOYCODE_Y_UP_SWITCH) | |
| 582 | PORT_BIT (0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("JOY 1 LEFT") PORT_CODE(JOYCODE_X_LEFT_SWITCH) | |
| 583 | PORT_BIT (0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("JOY 1 DOWN") PORT_CODE(JOYCODE_Y_DOWN_SWITCH) | |
| 584 | PORT_BIT (0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("JOY 2 RIGHT") PORT_CODE(JOYCODE_X_RIGHT_SWITCH) | |
| 585 | PORT_BIT (0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("JOY 2 UP") PORT_CODE(JOYCODE_Y_UP_SWITCH) | |
| 586 | PORT_BIT (0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("JOY 2 LEFT") PORT_CODE(JOYCODE_X_LEFT_SWITCH) | |
| 587 | PORT_BIT (0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("JOY 2 DOWN") PORT_CODE(JOYCODE_Y_DOWN_SWITCH) | |
| 588 | 588 | /* line 8 */ |
| 589 | 589 | PORT_START |
| 590 | PORT_BIT (0x0ff, 0x000, IPT_UNUSED) | |
| 590 | PORT_BIT (0x0ff, 0x000, IPT_UNUSED) | |
| 591 | 591 | /* line 9 */ |
| 592 | 592 | PORT_START |
| 593 | PORT_BIT (0x0ff, 0x000, IPT_UNUSED) | |
| 593 | PORT_BIT (0x0ff, 0x000, IPT_UNUSED) | |
| 594 | 594 | /* line 10 */ |
| 595 | 595 | PORT_START |
| 596 | PORT_BIT (0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RSHIFT") PORT_CODE(KEYCODE_2_PAD) | |
| 597 | PORT_BIT (0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RSHIFT") PORT_CODE(KEYCODE_3_PAD) | |
| 598 | PORT_BIT (0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RSHIFT") PORT_CODE(KEYCODE_4_PAD) | |
| 599 | PORT_BIT (0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RSHIFT") PORT_CODE(KEYCODE_5_PAD) | |
| 600 | PORT_BIT (0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RSHIFT") PORT_CODE(KEYCODE_6_PAD) | |
| 601 | PORT_BIT (0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RSHIFT") PORT_CODE(KEYCODE_7_PAD) | |
| 602 | PORT_BIT (0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RSHIFT") PORT_CODE(KEYCODE_8_PAD) | |
| 603 | PORT_BIT (0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RSHIFT") PORT_CODE(KEYCODE_9_PAD) | |
| 596 | PORT_BIT (0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RSHIFT") PORT_CODE(KEYCODE_2_PAD) | |
| 597 | PORT_BIT (0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RSHIFT") PORT_CODE(KEYCODE_3_PAD) | |
| 598 | PORT_BIT (0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RSHIFT") PORT_CODE(KEYCODE_4_PAD) | |
| 599 | PORT_BIT (0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RSHIFT") PORT_CODE(KEYCODE_5_PAD) | |
| 600 | PORT_BIT (0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RSHIFT") PORT_CODE(KEYCODE_6_PAD) | |
| 601 | PORT_BIT (0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RSHIFT") PORT_CODE(KEYCODE_7_PAD) | |
| 602 | PORT_BIT (0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RSHIFT") PORT_CODE(KEYCODE_8_PAD) | |
| 603 | PORT_BIT (0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RSHIFT") PORT_CODE(KEYCODE_9_PAD) | |
| 604 | 604 | /* PORT_BIT (0x0ff, 0x000, IPT_UNUSED) */ |
| 605 | 605 | /* line 11 */ |
| 606 | 606 | PORT_START |
| r1461 | r1462 | |
| 618 | 618 | PORT_START |
| 619 | 619 | PORT_BIT (0x0ff, 0x000, IPT_UNUSED) |
| 620 | 620 | PORT_START |
| 621 | PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RESET") PORT_CODE(KEYCODE_ESC) | |
| 621 | PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RESET") PORT_CODE(KEYCODE_ESC) | |
| 622 | 622 | |
| 623 | 623 | INPUT_PORTS_END |
| 624 | 624 |
| r1461 | r1462 | |
|---|---|---|
| 76 | 76 | |
| 77 | 77 | |
| 78 | 78 | static ADDRESS_MAP_START(mbee_ports, ADDRESS_SPACE_IO, 8) |
| 79 | ADDRESS_MAP_FLAGS( AMEF_ABITS(8) ) | |
| 79 | ADDRESS_MAP_FLAGS( AMEF_ABITS(8) ) | |
| 80 | 80 | AM_RANGE(0x00, 0x03) AM_READWRITE(mbee_pio_r, mbee_pio_w) |
| 81 | 81 | AM_RANGE(0x08, 0x08) AM_READWRITE(mbee_pcg_color_latch_r, mbee_pcg_color_latch_w) |
| 82 | 82 | AM_RANGE(0x0a, 0x0a) AM_READWRITE(mbee_color_bank_r, mbee_color_bank_w) |
| r1461 | r1462 | |
|---|---|---|
| 120 | 120 | AM_RANGE(0xfff0, 0xffff) AM_ROM AM_REGION(REGION_CPU1, 0x3ff0) |
| 121 | 121 | ADDRESS_MAP_END |
| 122 | 122 | |
| 123 | /* | |
| 123 | /* | |
| 124 | 124 | Dragon 64 with compusense Plus addon, this provided an extra 64K of memory |
| 125 | 125 | and an 80x25 column text display, provided by a motorola 6845. |
| 126 | ||
| 127 | Currently only the memory is emulated. | |
| 126 | ||
| 127 | Currently only the memory is emulated. | |
| 128 | 128 | */ |
| 129 | 129 | |
| 130 | 130 | static ADDRESS_MAP_START( d64_plus_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| r1461 | r1462 | |
| 156 | 156 | AM_RANGE(0xfff0, 0xffff) AM_ROM AM_REGION(REGION_CPU1,0x3ff0) |
| 157 | 157 | ADDRESS_MAP_END |
| 158 | 158 | |
| 159 | /* | |
| 160 | The Dragon Alpha was a prototype in development when Dragon Data went bust, | |
| 161 | it is basically an enhanced Dragon 64, with built in modem, disk system, and | |
| 159 | /* | |
| 160 | The Dragon Alpha was a prototype in development when Dragon Data went bust, | |
| 161 | it is basically an enhanced Dragon 64, with built in modem, disk system, and | |
| 162 | 162 | graphical boot rom. |
| 163 | 163 | |
| 164 | 164 | It has the following extra hardware :- |
| 165 | 165 | A third 6821 PIA mapped between FF24 and FF27 |
| 166 | 166 | An AY-8912, connected to the PIA. |
| 167 | ||
| 167 | ||
| 168 | 168 | Port A of the PIA is connected as follows :- |
| 169 | ||
| 169 | ||
| 170 | 170 | b0 BDIR of AY8912 |
| 171 | 171 | b1 BC1 of AY8912 |
| 172 | 172 | b2 Rom select, High= boot rom, low=BASIC rom |
| 173 | 173 | b3..7 not used. |
| 174 | ||
| 174 | ||
| 175 | 175 | Port B |
| 176 | 176 | b0..7 connected to D0..7 of the AY8912. |
| 177 | ||
| 177 | ||
| 178 | 178 | CB1 DRQ of WD2797. |
| 179 | 179 | |
| 180 | 180 | /irqa |
| 181 | 181 | /irqb both connected to 6809 FIRQ. |
| 182 | ||
| 183 | ||
| 182 | ||
| 183 | ||
| 184 | 184 | The analog outputs of the AY-8912 are connected to the standard sound multiplexer. |
| 185 | 185 | The AY8912 output port is used as follows :- |
| 186 | ||
| 186 | ||
| 187 | 187 | b0..b3 /DS0../DS3 for the drive interface (through an inverter first). |
| 188 | 188 | b4 /motor for the drive interface (through an inverter first). |
| 189 | 189 | b5..b7 not used as far as I can tell. |
| 190 | ||
| 190 | ||
| 191 | 191 | A 6850 for the modem. |
| 192 | ||
| 192 | ||
| 193 | 193 | A WD2797, used as an internal disk interface, this is however connected in a slightly strange |
| 194 | 194 | way that I am yet to completely determine. |
| 195 | 195 | 19/10/2004, WD2797 is mapped between FF2C and FF2F, however the order of the registers is |
| 196 | reversed so the command Register is at the highest address instead of the lowest. The Data | |
| 196 | reversed so the command Register is at the highest address instead of the lowest. The Data | |
| 197 | 197 | request pin is connected to CB1(pin 18) of PIA2, to cause an firq, the INTRQ, is connected via |
| 198 | 198 | an inverter to the 6809's NMI. |
| 199 | ||
| 199 | ||
| 200 | 200 | All these are as yet un-emulated. |
| 201 | 201 | |
| 202 | 202 | 29-Oct-2004, AY-8912 is now emulated. |
| 203 | 203 | 30-Oct-2004, Internal disk interface now emulated, Normal DragonDos rom replaced with a re-assembled |
| 204 | version, that talks to the alpha hardware (verified on a clone of the real machine). | |
| 204 | version, that talks to the alpha hardware (verified on a clone of the real machine). | |
| 205 | 205 | */ |
| 206 | 206 | |
| 207 | 207 | |
| r1461 | r1462 | |
| 222 | 222 | AM_RANGE(0xD000, 0xDFFF) AM_RAMBANK(14) |
| 223 | 223 | AM_RANGE(0xE000, 0xEFFF) AM_RAMBANK(15) |
| 224 | 224 | AM_RANGE(0xF000, 0xFEFF) AM_RAMBANK(16) |
| 225 | AM_RANGE(0xff00, 0xff03) AM_READWRITE(pia_0_r, pia_0_w) | |
| 226 | AM_RANGE(0xff04, 0xff07) AM_READWRITE(acia_6551_r, acia_6551_w) | |
| 225 | AM_RANGE(0xff00, 0xff03) AM_READWRITE(pia_0_r, pia_0_w) | |
| 226 | AM_RANGE(0xff04, 0xff07) AM_READWRITE(acia_6551_r, acia_6551_w) | |
| 227 | 227 | AM_RANGE(0xff20, 0xff23) AM_READWRITE(pia_1_r, coco_pia_1_w) |
| 228 | 228 | AM_RANGE(0xff24, 0xff27) AM_READWRITE(pia_2_r, pia_2_w) /* Third PIA on Dragon Alpha */ |
| 229 | 229 | AM_RANGE(0xff2c, 0xff2f) AM_READWRITE(wd2797_r, wd2797_w) /* Alpha onboard disk interface */ |
| r1461 | r1462 | |
| 441 | 441 | PORT_INCLUDE( coco_joystick ) |
| 442 | 442 | PORT_INCLUDE( coco_joystick_buttons ) |
| 443 | 443 | PORT_INCLUDE( m6847_artifacting ) |
| 444 | ||
| 444 | ||
| 445 | 445 | PORT_START /* 13 */ |
| 446 | 446 | PORT_CONFNAME( 0x03, 0x00, "Real Time Clock" ) |
| 447 | 447 | PORT_CONFSETTING( 0x00, "Disto" ) |
| 448 | 448 | PORT_CONFSETTING( 0x01, "Cloud-9" ) |
| 449 | ||
| 449 | ||
| 450 | 450 | PORT_INCLUDE( cart_autostart ) |
| 451 | 451 | INPUT_PORTS_END |
| 452 | 452 | |
| r1461 | r1462 | |
| 536 | 536 | PORT_INCLUDE( coco_joystick ) |
| 537 | 537 | PORT_INCLUDE( coco3_joystick_buttons ) |
| 538 | 538 | PORT_INCLUDE( m6847_artifacting ) |
| 539 | ||
| 539 | ||
| 540 | 540 | PORT_START_TAG("joystick_mode") |
| 541 | 541 | PORT_CONFNAME( 0x70, 0x00, "Joystick Type" ) |
| 542 | 542 | PORT_CONFSETTING( 0x00, DEF_STR( Normal ) ) |
| r1461 | r1462 | |
| 1071 | 1071 | |
| 1072 | 1072 | /************************************* |
| 1073 | 1073 | * |
| 1074 | * Dragon only devices | |
| 1074 | * Dragon only devices | |
| 1075 | 1075 | * |
| 1076 | 1076 | **************************************/ |
| 1077 | 1077 |
| r1461 | r1462 | |
|---|---|---|
| 105 | 105 | |
| 106 | 106 | static ADDRESS_MAP_START( pc1403_mem , ADDRESS_SPACE_PROGRAM, 8) |
| 107 | 107 | AM_RANGE( 0x0000, 0x1fff) AM_ROM |
| 108 | AM_RANGE( 0x3000, 0x30bf) AM_READWRITE( pc1403_lcd_read, pc1403_lcd_write ) | |
| 109 | AM_RANGE( 0x3800, 0x3fff) AM_READWRITE( pc1403_asic_read, pc1403_asic_write ) | |
| 108 | AM_RANGE( 0x3000, 0x30bf) AM_READWRITE( pc1403_lcd_read, pc1403_lcd_write ) | |
| 109 | AM_RANGE( 0x3800, 0x3fff) AM_READWRITE( pc1403_asic_read, pc1403_asic_write ) | |
| 110 | 110 | AM_RANGE( 0x4000, 0x7fff) AM_ROMBANK(1) |
| 111 | 111 | AM_RANGE( 0xe000, 0xffff) AM_RAM |
| 112 | 112 | ADDRESS_MAP_END |
| r1461 | r1462 | |
| 698 | 698 | */ |
| 699 | 699 | |
| 700 | 700 | /* cpu lh5801 |
| 701 | pc1500 | |
| 702 | clone tandy pc2 look into drivers/pc1500.c | |
| 701 | pc1500 | |
| 702 | clone tandy pc2 look into drivers/pc1500.c | |
| 703 | 703 | pc1600 |
| 704 | 704 | */ |
| 705 | 705 |
| r1461 | r1462 | |
|---|---|---|
| 75 | 75 | |
| 76 | 76 | |
| 77 | 77 | For lines 1 - 143 when stat changes to 2 the line counter is incremented. |
| 78 | ||
| 78 | ||
| 79 | 79 | Line 153 is little odd timing wise. The line counter stays 153 for ~4 clock cycles |
| 80 | 80 | and is then rolls over to 0. |
| 81 | 81 | |
| r1461 | r1462 | |
| 533 | 533 | |
| 534 | 534 | static INPUT_PORTS_START( gameboy ) |
| 535 | 535 | PORT_START /* IN0 */ |
| 536 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_NAME("Left") | |
| 537 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_NAME("Right") | |
| 538 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_NAME("Up") | |
| 539 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_NAME("Down") | |
| 540 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_NAME("Button A") | |
| 541 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_NAME("Button B") | |
| 542 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START) PORT_NAME("Start") | |
| 543 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SELECT) PORT_NAME("Select") | |
| 536 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_NAME("Left") | |
| 537 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_NAME("Right") | |
| 538 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_NAME("Up") | |
| 539 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_NAME("Down") | |
| 540 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_NAME("Button A") | |
| 541 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_NAME("Button B") | |
| 542 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START) PORT_NAME("Start") | |
| 543 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SELECT) PORT_NAME("Select") | |
| 544 | 544 | INPUT_PORTS_END |
| 545 | 545 | |
| 546 | 546 | static const struct CustomSound_interface gameboy_sound_interface = |
| r1461 | r1462 | |
|---|---|---|
| 48 | 48 | return; |
| 49 | 49 | } |
| 50 | 50 | } |
| 51 | ||
| 51 | ||
| 52 | 52 | logerror("clear int\n"); |
| 53 | 53 | cpunum_set_input_line(0,0,CLEAR_LINE); |
| 54 | 54 | } |
| r1461 | r1462 | |
| 100 | 100 | blink.sta |= STA_KEY; |
| 101 | 101 | |
| 102 | 102 | cpu_trigger(Z88_SNOOZE_TRIGGER); |
| 103 | ||
| 103 | ||
| 104 | 104 | z88_interrupt_refresh(); |
| 105 | 105 | } |
| 106 | 106 | } |
| r1461 | r1462 | |
| 136 | 136 | /* set minutes int has occured */ |
| 137 | 137 | blink.tsta |=RTC_MIN_INT; |
| 138 | 138 | refresh_ints = 1; |
| 139 | ||
| 139 | ||
| 140 | 140 | blink.tim[1]=0; |
| 141 | 141 | |
| 142 | 142 | blink.tim[2]++; |
| r1461 | r1462 | |
| 199 | 199 | the lower 8k is replaced with the rom. Bank 0 has been split |
| 200 | 200 | into 2 8k chunks, and all other banks into 16k chunks. |
| 201 | 201 | I wanted to handle all banks in the code below, and this |
| 202 | explains why the extra checks are done | |
| 202 | explains why the extra checks are done | |
| 203 | 203 | |
| 204 | 204 | |
| 205 | 205 | bank 0 0x0000-0x3FFF |
| r1461 | r1462 | |
| 223 | 223 | block = blink.mem[bank]-0x020; |
| 224 | 224 | |
| 225 | 225 | if (block >= 128) |
| 226 | { | |
| 226 | { | |
| 227 | 227 | read_addr = NULL; |
| 228 | 228 | write_addr = NULL; |
| 229 | 229 | } |
| r1461 | r1462 | |
| 304 | 304 | |
| 305 | 305 | switch (reg_index) |
| 306 | 306 | { |
| 307 | ||
| 307 | ||
| 308 | 308 | /* 1c000 */ |
| 309 | ||
| 309 | ||
| 310 | 310 | case 0x00: |
| 311 | 311 | { |
| 312 | 312 | /**/ blink.pb[0] = addr_written; |
| r1461 | r1462 | |
| 602 | 602 | |
| 603 | 603 | |
| 604 | 604 | static ADDRESS_MAP_START( z88_io, ADDRESS_SPACE_IO, 8) |
| 605 | ADDRESS_MAP_FLAGS( AMEF_ABITS(16) ) | |
| 605 | ADDRESS_MAP_FLAGS( AMEF_ABITS(16) ) | |
| 606 | 606 | AM_RANGE(0x0000, 0x0ffff) AM_READWRITE(z88_port_r, z88_port_w) |
| 607 | 607 | ADDRESS_MAP_END |
| 608 | 608 | |
| r1461 | r1462 | |
| 693 | 693 | PORT_BIT(0x008, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("MENU") PORT_CODE(KEYCODE_3_PAD) |
| 694 | 694 | PORT_BIT(0x004, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) |
| 695 | 695 | PORT_BIT(0x002, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_COLON) |
| 696 | PORT_BIT(0x001, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("'") PORT_CODE(KEYCODE_4_PAD) | |
| 696 | PORT_BIT(0x001, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("'") PORT_CODE(KEYCODE_4_PAD) | |
| 697 | 697 | /* 7 */ |
| 698 | 698 | PORT_START |
| 699 | 699 | PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RIGHT SHIFT") PORT_CODE(KEYCODE_RSHIFT) |
| r1461 | r1462 | |
|---|---|---|
| 1332 | 1332 | } |
| 1333 | 1333 | |
| 1334 | 1334 | |
| 1335 | static const PC_LPT_CONFIG lpt_config = | |
| 1335 | static const PC_LPT_CONFIG lpt_config = | |
| 1336 | 1336 | { |
| 1337 | 1337 | 1, |
| 1338 | 1338 | LPT_UNIDIRECTIONAL, // more one of these epp/ecp aware ports |
| r1461 | r1462 | |
|---|---|---|
| 233 | 233 | lcd_flag=data>>8; |
| 234 | 234 | //beep_set_state(0,lcd_flag&1?1:0); |
| 235 | 235 | if (lcd_flag == 0) key_selector=1; |
| 236 | // The key function in the rom expects after writing to | |
| 236 | // The key function in the rom expects after writing to | |
| 237 | 237 | // the a value from the second key row; |
| 238 | 238 | if (lcd_flag!=0) led7=255;else led7=0; |
| 239 | 239 | logerror("LCD Flag 16 = %x \n ",data); |
| r1461 | r1462 | |
| 270 | 270 | UINT8 board; |
| 271 | 271 | board=data>>8; |
| 272 | 272 | board_value=board; |
| 273 | if (board==0xff) key_selector=0; | |
| 274 | // The key function in the rom expects after writing to | |
| 273 | if (board==0xff) key_selector=0; | |
| 274 | // The key function in the rom expects after writing to | |
| 275 | 275 | // the chess board a value from the first key row; |
| 276 | 276 | logerror("Write Board = %x \n ",data>>8); |
| 277 | 277 | } |
| r1461 | r1462 | |
| 806 | 806 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("H8") PORT_CODE(KEYCODE_H ) |
| 807 | 807 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("G7") PORT_CODE(KEYCODE_7 ) |
| 808 | 808 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("H8") PORT_CODE(KEYCODE_8 ) |
| 809 | ||
| 809 | ||
| 810 | 810 | PORT_START |
| 811 | 811 | PORT_BIT( 0xffff, 0x00, IPT_MOUSE_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(1) PORT_MINMAX(0, 65535) PORT_PLAYER(1) |
| 812 | 812 |
| r1461 | r1462 | |
|---|---|---|
| 748 | 748 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) |
| 749 | 749 | MDRV_SOUND_ADD(AY8910, 1789773) |
| 750 | 750 | MDRV_SOUND_CONFIG(ay8910_interface) |
| 751 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.10) | |
| 751 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.10) | |
| 752 | 752 | MDRV_SOUND_ADD(K051649, 1789773) |
| 753 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) | |
| 753 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) | |
| 754 | 754 | MDRV_SOUND_ADD(YM2413, 3579545) |
| 755 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.40) | |
| 755 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.40) | |
| 756 | 756 | MACHINE_DRIVER_END |
| 757 | 757 | |
| 758 | 758 | |
| r1461 | r1462 | |
| 800 | 800 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) |
| 801 | 801 | MDRV_SOUND_ADD(AY8910, 1789773) |
| 802 | 802 | MDRV_SOUND_CONFIG(ay8910_interface) |
| 803 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.10) | |
| 803 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.10) | |
| 804 | 804 | MDRV_SOUND_ADD(K051649, 1789773) |
| 805 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) | |
| 805 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) | |
| 806 | 806 | MDRV_SOUND_ADD(YM2413, 3579545) |
| 807 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.40) | |
| 807 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.40) | |
| 808 | 808 | |
| 809 | 809 | MDRV_NVRAM_HANDLER( msx2 ) |
| 810 | 810 | MACHINE_DRIVER_END |
| r1461 | r1462 | |
| 830 | 830 | MSX_LAYOUT_INIT (msx) |
| 831 | 831 | MSX_LAYOUT_SLOT (0, 0, 0, 2, ROM, 0x8000, 0x0000) |
| 832 | 832 | MSX_LAYOUT_SLOT (1, 0, 0, 4, CARTRIDGE1, 0x0000, 0x0000) |
| 833 | MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000) | |
| 833 | MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000) | |
| 834 | 834 | MSX_LAYOUT_SLOT (3, 0, 0, 4, RAM, 0x10000, 0x0000) /* 64KB RAM */ |
| 835 | 835 | MSX_LAYOUT_END |
| 836 | 836 | |
| r1461 | r1462 | |
| 845 | 845 | MSX_LAYOUT_SLOT (0, 0, 2, 1, ROM, 0x4000, 0x8000) |
| 846 | 846 | MSX_LAYOUT_SLOT (1, 0, 0, 4, CARTRIDGE1, 0x0000, 0x0000) |
| 847 | 847 | MSX_LAYOUT_SLOT (2, 0, 0, 4, RAM, 0x10000, 0x0000) /* 64KB RAM */ |
| 848 | MSX_LAYOUT_SLOT (3, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000) | |
| 848 | MSX_LAYOUT_SLOT (3, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000) | |
| 849 | 849 | MSX_LAYOUT_END |
| 850 | 850 | |
| 851 | 851 | ROM_START (hb75p) |
| r1461 | r1462 | |
| 859 | 859 | MSX_LAYOUT_SLOT (0, 0, 2, 1, ROM, 0x4000, 0x8000) |
| 860 | 860 | MSX_LAYOUT_SLOT (1, 0, 0, 4, CARTRIDGE1, 0x0000, 0x0000) |
| 861 | 861 | MSX_LAYOUT_SLOT (2, 0, 0, 4, RAM, 0x10000, 0x0000) /* 64KB RAM */ |
| 862 | MSX_LAYOUT_SLOT (3, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000) | |
| 862 | MSX_LAYOUT_SLOT (3, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000) | |
| 863 | 863 | MSX_LAYOUT_END |
| 864 | 864 | |
| 865 | 865 | ROM_START (hb501p) |
| r1461 | r1462 | |
| 870 | 870 | MSX_LAYOUT_INIT (hb501p) |
| 871 | 871 | MSX_LAYOUT_SLOT (0, 0, 0, 2, ROM, 0x8000, 0x0000) |
| 872 | 872 | MSX_LAYOUT_SLOT (1, 0, 0, 4, CARTRIDGE1, 0x0000, 0x0000) |
| 873 | MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000) | |
| 873 | MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000) | |
| 874 | 874 | MSX_LAYOUT_SLOT (3, 0, 0, 4, RAM, 0x10000, 0x0000) /* 64KB RAM */ |
| 875 | 875 | MSX_LAYOUT_END |
| 876 | 876 | |
| r1461 | r1462 | |
| 884 | 884 | MSX_LAYOUT_SLOT (0, 0, 0, 2, ROM, 0x8000, 0x0000) |
| 885 | 885 | MSX_LAYOUT_SLOT (0, 0, 2, 1, ROM, 0x4000, 0x8000) |
| 886 | 886 | MSX_LAYOUT_SLOT (1, 0, 0, 4, CARTRIDGE1, 0x0000, 0x0000) |
| 887 | MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000) | |
| 887 | MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000) | |
| 888 | 888 | MSX_LAYOUT_SLOT (3, 0, 0, 4, RAM, 0x10000, 0x0000) /* 64KB RAM */ |
| 889 | 889 | MSX_LAYOUT_END |
| 890 | 890 | |
| r1461 | r1462 | |
| 898 | 898 | MSX_LAYOUT_INIT (svi738) |
| 899 | 899 | MSX_LAYOUT_SLOT (0, 0, 0, 2, ROM, 0x8000, 0x0000) |
| 900 | 900 | MSX_LAYOUT_SLOT (1, 0, 0, 4, RAM, 0x10000, 0x0000) /* 64KB RAM */ |
| 901 | MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE1, 0x0000, 0x0000) | |
| 901 | MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE1, 0x0000, 0x0000) | |
| 902 | 902 | MSX_LAYOUT_SLOT (3, 0, 1, 1, ROM, 0x4000, 0xc000) |
| 903 | 903 | MSX_LAYOUT_SLOT (3, 1, 1, 2, DISK_ROM2, 0x4000, 0x8000) |
| 904 | 904 | MSX_LAYOUT_END |
| r1461 | r1462 | |
| 936 | 936 | MSX_LAYOUT_SLOT (0, 0, 0, 2, ROM, 0x8000, 0x0000) |
| 937 | 937 | MSX_LAYOUT_SLOT (0, 0, 2, 2, RAM, 0x8000, 0x8000) /* 32KB RAM */ |
| 938 | 938 | MSX_LAYOUT_SLOT (1, 0, 0, 4, CARTRIDGE1, 0x0000, 0x0000) |
| 939 | MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000) | |
| 939 | MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000) | |
| 940 | 940 | MSX_LAYOUT_END |
| 941 | 941 | |
| 942 | 942 | ROM_START (cf3000) |
| r1461 | r1462 | |
| 948 | 948 | MSX_LAYOUT_SLOT (0, 0, 0, 2, ROM, 0x8000, 0x0000) |
| 949 | 949 | MSX_LAYOUT_SLOT (1, 0, 0, 4, RAM, 0x10000, 0x0000) /* 64KB RAM */ |
| 950 | 950 | MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE1, 0x0000, 0x0000) |
| 951 | MSX_LAYOUT_SLOT (3, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000) | |
| 951 | MSX_LAYOUT_SLOT (3, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000) | |
| 952 | 952 | MSX_LAYOUT_END |
| 953 | 953 | |
| 954 | 954 | ROM_START (cf3300) |
| r1461 | r1462 | |
| 960 | 960 | MSX_LAYOUT_INIT (cf3300) |
| 961 | 961 | MSX_LAYOUT_SLOT (0, 0, 0, 2, ROM, 0x8000, 0x0000) |
| 962 | 962 | MSX_LAYOUT_SLOT (1, 0, 0, 4, CARTRIDGE1, 0x0000, 0x0000) |
| 963 | MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000) | |
| 963 | MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000) | |
| 964 | 964 | MSX_LAYOUT_SLOT (3, 0, 0, 4, RAM, 0x10000, 0x0000) /* 64KB RAM */ |
| 965 | 965 | MSX_LAYOUT_SLOT (3, 1, 1, 2, DISK_ROM2, 0x4000, 0x8000) |
| 966 | 966 | MSX_LAYOUT_END |
| r1461 | r1462 | |
| 976 | 976 | MSX_LAYOUT_INIT (fs4000) |
| 977 | 977 | MSX_LAYOUT_SLOT (0, 0, 0, 2, ROM, 0x8000, 0x0000) |
| 978 | 978 | MSX_LAYOUT_SLOT (1, 0, 0, 4, CARTRIDGE1, 0x0000, 0x0000) |
| 979 | MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000) | |
| 980 | MSX_LAYOUT_SLOT (3, 0, 0, 2, ROM, 0x8000, 0x8000) | |
| 981 | MSX_LAYOUT_SLOT (3, 1, 1, 2, ROM, 0x8000, 0x10000) | |
| 979 | MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000) | |
| 980 | MSX_LAYOUT_SLOT (3, 0, 0, 2, ROM, 0x8000, 0x8000) | |
| 981 | MSX_LAYOUT_SLOT (3, 1, 1, 2, ROM, 0x8000, 0x10000) | |
| 982 | 982 | MSX_LAYOUT_SLOT (3, 2, 0, 4, RAM, 0x10000, 0x0000) /* 64KB RAM */ |
| 983 | 983 | MSX_LAYOUT_KANJI (0x18000) |
| 984 | 984 | MSX_LAYOUT_END |
| r1461 | r1462 | |
| 991 | 991 | MSX_LAYOUT_INIT (fs1300) |
| 992 | 992 | MSX_LAYOUT_SLOT (0, 0, 0, 2, ROM, 0x8000, 0x0000) |
| 993 | 993 | MSX_LAYOUT_SLOT (1, 0, 0, 4, CARTRIDGE1, 0x0000, 0x0000) |
| 994 | MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000) | |
| 994 | MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000) | |
| 995 | 995 | MSX_LAYOUT_SLOT (3, 0, 0, 4, RAM, 0x10000, 0x0000) /* 64KB RAM */ |
| 996 | 996 | MSX_LAYOUT_END |
| 997 | 997 | |
| r1461 | r1462 | |
| 1005 | 1005 | MSX_LAYOUT_SLOT (0, 0, 0, 2, ROM, 0x8000, 0x0000) |
| 1006 | 1006 | MSX_LAYOUT_SLOT (0, 0, 2, 2, ROM, 0x8000, 0x8000) |
| 1007 | 1007 | MSX_LAYOUT_SLOT (1, 0, 0, 4, CARTRIDGE1, 0x0000, 0x0000) |
| 1008 | MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000) | |
| 1008 | MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000) | |
| 1009 | 1009 | MSX_LAYOUT_SLOT (3, 0, 0, 4, RAM, 0x10000, 0x0000) /* 64KB RAM */ |
| 1010 | 1010 | MSX_LAYOUT_END |
| 1011 | 1011 | |
| r1461 | r1462 | |
| 1020 | 1020 | MSX_LAYOUT_SLOT (0, 0, 2, 1, ROM, 0x4000, 0x8000) |
| 1021 | 1021 | MSX_LAYOUT_SLOT (1, 0, 0, 4, CARTRIDGE1, 0x0000, 0x0000) |
| 1022 | 1022 | MSX_LAYOUT_SLOT (2, 0, 3, 1, RAM, 0x4000, 0xC000) /* 16KB RAM */ |
| 1023 | MSX_LAYOUT_SLOT (3, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000) | |
| 1023 | MSX_LAYOUT_SLOT (3, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000) | |
| 1024 | 1024 | MSX_LAYOUT_END |
| 1025 | 1025 | |
| 1026 | 1026 | ROM_START (dpc180) |
| r1461 | r1462 | |
| 1034 | 1034 | MSX_LAYOUT_SLOT (0, 0, 2, 1, ROM, 0x4000, 0x8000) |
| 1035 | 1035 | MSX_LAYOUT_SLOT (1, 0, 0, 4, CARTRIDGE1, 0x0000, 0x0000) |
| 1036 | 1036 | MSX_LAYOUT_SLOT (2, 0, 2, 2, RAM, 0x8000, 0x8000) /* 32KB RAM */ |
| 1037 | MSX_LAYOUT_SLOT (3, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000) | |
| 1037 | MSX_LAYOUT_SLOT (3, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000) | |
| 1038 | 1038 | MSX_LAYOUT_END |
| 1039 | 1039 | |
| 1040 | 1040 | |
| r1461 | r1462 | |
| 1049 | 1049 | MSX_LAYOUT_SLOT (0, 0, 2, 1, ROM, 0x4000, 0x8000) |
| 1050 | 1050 | MSX_LAYOUT_SLOT (1, 0, 0, 4, CARTRIDGE1, 0x0000, 0x0000) |
| 1051 | 1051 | MSX_LAYOUT_SLOT (2, 0, 0, 4, RAM, 0x10000, 0x0000) /* 64KB RAM */ |
| 1052 | MSX_LAYOUT_SLOT (3, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000) | |
| 1052 | MSX_LAYOUT_SLOT (3, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000) | |
| 1053 | 1053 | MSX_LAYOUT_END |
| 1054 | 1054 | |
| 1055 | 1055 | ROM_START (hotbit11) |
| r1461 | r1462 | |
| 1060 | 1060 | MSX_LAYOUT_INIT (hotbit11) |
| 1061 | 1061 | MSX_LAYOUT_SLOT (0, 0, 0, 2, ROM, 0x8000, 0x0000) |
| 1062 | 1062 | MSX_LAYOUT_SLOT (1, 0, 0, 4, CARTRIDGE1, 0x0000, 0x0000) |
| 1063 | MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000) | |
| 1063 | MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000) | |
| 1064 | 1064 | MSX_LAYOUT_SLOT (3, 0, 0, 4, RAM, 0x10000, 0x0000) /* 64KB RAM */ |
| 1065 | 1065 | MSX_LAYOUT_END |
| 1066 | 1066 | |
| r1461 | r1462 | |
| 1072 | 1072 | MSX_LAYOUT_INIT (hotbit12) |
| 1073 | 1073 | MSX_LAYOUT_SLOT (0, 0, 0, 2, ROM, 0x8000, 0x0000) |
| 1074 | 1074 | MSX_LAYOUT_SLOT (1, 0, 0, 4, CARTRIDGE1, 0x0000, 0x0000) |
| 1075 | MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000) | |
| 1075 | MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000) | |
| 1076 | 1076 | MSX_LAYOUT_SLOT (3, 0, 0, 4, RAM, 0x10000, 0x0000) /* 64KB RAM */ |
| 1077 | 1077 | MSX_LAYOUT_END |
| 1078 | 1078 | |
| r1461 | r1462 | |
| 1084 | 1084 | MSX_LAYOUT_INIT (expert10) |
| 1085 | 1085 | MSX_LAYOUT_SLOT (0, 0, 0, 2, ROM, 0x8000, 0x0000) |
| 1086 | 1086 | MSX_LAYOUT_SLOT (1, 0, 0, 4, CARTRIDGE1, 0x0000, 0x0000) |
| 1087 | MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000) | |
| 1087 | MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000) | |
| 1088 | 1088 | MSX_LAYOUT_SLOT (3, 0, 0, 4, RAM, 0x10000, 0x0000) /* 64KB RAM */ |
| 1089 | 1089 | MSX_LAYOUT_END |
| 1090 | 1090 | |
| r1461 | r1462 | |
| 1098 | 1098 | MSX_LAYOUT_SLOT (0, 0, 0, 2, ROM, 0x8000, 0x0000) |
| 1099 | 1099 | MSX_LAYOUT_SLOT (0, 0, 2, 1, ROM, 0x4000, 0x8000) |
| 1100 | 1100 | MSX_LAYOUT_SLOT (1, 0, 0, 4, CARTRIDGE1, 0x0000, 0x0000) |
| 1101 | MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000) | |
| 1101 | MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000) | |
| 1102 | 1102 | MSX_LAYOUT_SLOT (3, 0, 0, 4, RAM, 0x10000, 0x0000) /* 64KB RAM */ |
| 1103 | 1103 | MSX_LAYOUT_END |
| 1104 | 1104 | |
| r1461 | r1462 | |
| 1111 | 1111 | MSX_LAYOUT_INIT (expertdp) |
| 1112 | 1112 | MSX_LAYOUT_SLOT (0, 0, 0, 2, ROM, 0x8000, 0x0000) |
| 1113 | 1113 | MSX_LAYOUT_SLOT (1, 0, 0, 4, CARTRIDGE1, 0x0000, 0x0000) |
| 1114 | MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000) | |
| 1114 | MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000) | |
| 1115 | 1115 | MSX_LAYOUT_SLOT (3, 0, 0, 4, RAM, 0x10000, 0x0000) /* 64KB RAM */ |
| 1116 | 1116 | MSX_LAYOUT_SLOT (3, 3, 1, 2, DISK_ROM2, 0x4000, 0x8000) |
| 1117 | 1117 | MSX_LAYOUT_END |
| r1461 | r1462 | |
| 1127 | 1127 | MSX_LAYOUT_INIT (msx2) |
| 1128 | 1128 | MSX_LAYOUT_SLOT (0, 0, 0, 2, ROM, 0x8000, 0x0000) |
| 1129 | 1129 | MSX_LAYOUT_SLOT (1, 0, 0, 4, CARTRIDGE1, 0x0000, 0x0000) |
| 1130 | MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000) | |
| 1130 | MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000) | |
| 1131 | 1131 | MSX_LAYOUT_SLOT (3, 0, 0, 1, ROM, 0x4000, 0x8000) |
| 1132 | MSX_LAYOUT_SLOT (3, 0, 1, 2, DISK_ROM, 0x4000, 0xc000) | |
| 1132 | MSX_LAYOUT_SLOT (3, 0, 1, 2, DISK_ROM, 0x4000, 0xc000) | |
| 1133 | 1133 | MSX_LAYOUT_SLOT (3, 3, 0, 4, RAM_MM, 0x20000, 0x0000) /* 128KB Mapper RAM */ |
| 1134 | 1134 | MSX_LAYOUT_RAMIO_SET_BITS (0xf8) |
| 1135 | 1135 | MSX_LAYOUT_END |
| r1461 | r1462 | |
| 1145 | 1145 | MSX_LAYOUT_INIT (nms8220) |
| 1146 | 1146 | MSX_LAYOUT_SLOT (0, 0, 0, 2, ROM, 0x8000, 0x0000) |
| 1147 | 1147 | MSX_LAYOUT_SLOT (1, 0, 0, 4, CARTRIDGE1, 0x0000, 0x0000) |
| 1148 | MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000) | |
| 1148 | MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000) | |
| 1149 | 1149 | MSX_LAYOUT_SLOT (3, 0, 0, 1, ROM, 0x4000, 0x8000) |
| 1150 | 1150 | MSX_LAYOUT_SLOT (3, 2, 0, 4, RAM_MM, 0x10000, 0x0000) /* 64KB Mapper RAM */ |
| 1151 | MSX_LAYOUT_SLOT (3, 3, 1, 1, ROM, 0x4000, 0xc000) | |
| 1151 | MSX_LAYOUT_SLOT (3, 3, 1, 1, ROM, 0x4000, 0xc000) | |
| 1152 | 1152 | MSX_LAYOUT_RAMIO_SET_BITS (0xf8) |
| 1153 | 1153 | MSX_LAYOUT_END |
| 1154 | 1154 | |
| r1461 | r1462 | |
| 1163 | 1163 | MSX_LAYOUT_INIT (nms8220a) |
| 1164 | 1164 | MSX_LAYOUT_SLOT (0, 0, 0, 2, ROM, 0x8000, 0x0000) |
| 1165 | 1165 | MSX_LAYOUT_SLOT (1, 0, 0, 4, CARTRIDGE1, 0x0000, 0x0000) |
| 1166 | MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000) | |
| 1166 | MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000) | |
| 1167 | 1167 | MSX_LAYOUT_SLOT (3, 0, 0, 1, ROM, 0x4000, 0x8000) |
| 1168 | 1168 | MSX_LAYOUT_SLOT (3, 2, 0, 4, RAM_MM, 0x10000, 0x0000) /* 64KB Mapper RAM */ |
| 1169 | MSX_LAYOUT_SLOT (3, 3, 1, 1, ROM, 0x4000, 0xc000) | |
| 1169 | MSX_LAYOUT_SLOT (3, 3, 1, 1, ROM, 0x4000, 0xc000) | |
| 1170 | 1170 | MSX_LAYOUT_RAMIO_SET_BITS (0xf8) |
| 1171 | 1171 | MSX_LAYOUT_END |
| 1172 | 1172 | |
| r1461 | r1462 | |
| 1181 | 1181 | MSX_LAYOUT_INIT (vg8235) |
| 1182 | 1182 | MSX_LAYOUT_SLOT (0, 0, 0, 2, ROM, 0x8000, 0x0000) |
| 1183 | 1183 | MSX_LAYOUT_SLOT (1, 0, 0, 4, CARTRIDGE1, 0x0000, 0x0000) |
| 1184 | MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000) | |
| 1184 | MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000) | |
| 1185 | 1185 | MSX_LAYOUT_SLOT (3, 0, 0, 1, ROM, 0x4000, 0x8000) |
| 1186 | 1186 | MSX_LAYOUT_SLOT (3, 2, 0, 4, RAM_MM, 0x20000, 0x0000) /* 128KB Mapper RAM */ |
| 1187 | MSX_LAYOUT_SLOT (3, 3, 1, 2, DISK_ROM, 0x4000, 0xc000) | |
| 1187 | MSX_LAYOUT_SLOT (3, 3, 1, 2, DISK_ROM, 0x4000, 0xc000) | |
| 1188 | 1188 | MSX_LAYOUT_RAMIO_SET_BITS (0xf8) |
| 1189 | 1189 | MSX_LAYOUT_END |
| 1190 | 1190 | |
| r1461 | r1462 | |
| 1199 | 1199 | MSX_LAYOUT_INIT (nms8245) |
| 1200 | 1200 | MSX_LAYOUT_SLOT (0, 0, 0, 2, ROM, 0x8000, 0x0000) |
| 1201 | 1201 | MSX_LAYOUT_SLOT (1, 0, 0, 4, CARTRIDGE1, 0x0000, 0x0000) |
| 1202 | MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000) | |
| 1202 | MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000) | |
| 1203 | 1203 | MSX_LAYOUT_SLOT (3, 0, 0, 1, ROM, 0x4000, 0x8000) |
| 1204 | 1204 | MSX_LAYOUT_SLOT (3, 2, 0, 4, RAM_MM, 0x20000, 0x0000) /* 128KB Mapper RAM */ |
| 1205 | MSX_LAYOUT_SLOT (3, 3, 1, 2, DISK_ROM, 0x4000, 0xc000) | |
| 1205 | MSX_LAYOUT_SLOT (3, 3, 1, 2, DISK_ROM, 0x4000, 0xc000) | |
| 1206 | 1206 | MSX_LAYOUT_RAMIO_SET_BITS (0xf8) |
| 1207 | 1207 | MSX_LAYOUT_END |
| 1208 | 1208 | |
| r1461 | r1462 | |
| 1217 | 1217 | MSX_LAYOUT_INIT (nms8250) |
| 1218 | 1218 | MSX_LAYOUT_SLOT (0, 0, 0, 2, ROM, 0x8000, 0x0000) |
| 1219 | 1219 | MSX_LAYOUT_SLOT (1, 0, 0, 4, CARTRIDGE1, 0x0000, 0x0000) |
| 1220 | MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000) | |
| 1220 | MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000) | |
| 1221 | 1221 | MSX_LAYOUT_SLOT (3, 0, 0, 1, ROM, 0x4000, 0x8000) |
| 1222 | 1222 | MSX_LAYOUT_SLOT (3, 2, 0, 4, RAM_MM, 0x20000, 0x0000) /* 128KB Mapper RAM */ |
| 1223 | MSX_LAYOUT_SLOT (3, 3, 1, 2, DISK_ROM, 0x4000, 0xc000) | |
| 1223 | MSX_LAYOUT_SLOT (3, 3, 1, 2, DISK_ROM, 0x4000, 0xc000) | |
| 1224 | 1224 | MSX_LAYOUT_RAMIO_SET_BITS (0xf8) |
| 1225 | 1225 | MSX_LAYOUT_END |
| 1226 | 1226 | |
| r1461 | r1462 | |
| 1235 | 1235 | MSX_LAYOUT_INIT (nms8255) |
| 1236 | 1236 | MSX_LAYOUT_SLOT (0, 0, 0, 2, ROM, 0x8000, 0x0000) |
| 1237 | 1237 | MSX_LAYOUT_SLOT (1, 0, 0, 4, CARTRIDGE1, 0x0000, 0x0000) |
| 1238 | MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000) | |
| 1238 | MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000) | |
| 1239 | 1239 | MSX_LAYOUT_SLOT (3, 0, 0, 1, ROM, 0x4000, 0x8000) |
| 1240 | 1240 | MSX_LAYOUT_SLOT (3, 2, 0, 4, RAM_MM, 0x20000, 0x0000) /* 128KB Mapper RAM */ |
| 1241 | MSX_LAYOUT_SLOT (3, 3, 1, 2, DISK_ROM, 0x4000, 0xc000) | |
| 1241 | MSX_LAYOUT_SLOT (3, 3, 1, 2, DISK_ROM, 0x4000, 0xc000) | |
| 1242 | 1242 | MSX_LAYOUT_RAMIO_SET_BITS (0xf8) |
| 1243 | 1243 | MSX_LAYOUT_END |
| 1244 | 1244 | |
| r1461 | r1462 | |
| 1253 | 1253 | MSX_LAYOUT_INIT (nms8280) |
| 1254 | 1254 | MSX_LAYOUT_SLOT (0, 0, 0, 2, ROM, 0x8000, 0x0000) |
| 1255 | 1255 | MSX_LAYOUT_SLOT (1, 0, 0, 4, CARTRIDGE1, 0x0000, 0x0000) |
| 1256 | MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000) | |
| 1256 | MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000) | |
| 1257 | 1257 | MSX_LAYOUT_SLOT (3, 0, 0, 1, ROM, 0x4000, 0x8000) |
| 1258 | 1258 | MSX_LAYOUT_SLOT (3, 2, 0, 4, RAM_MM, 0x20000, 0x0000) /* 128KB Mapper RAM */ |
| 1259 | MSX_LAYOUT_SLOT (3, 3, 1, 2, DISK_ROM, 0x4000, 0xc000) | |
| 1259 | MSX_LAYOUT_SLOT (3, 3, 1, 2, DISK_ROM, 0x4000, 0xc000) | |
| 1260 | 1260 | MSX_LAYOUT_RAMIO_SET_BITS (0xf8) |
| 1261 | 1261 | MSX_LAYOUT_END |
| 1262 | 1262 | |
| r1461 | r1462 | |
| 1532 | 1532 | MSX_LAYOUT_SLOT (0, 0, 0, 2, ROM, 0x8000, 0x0000) |
| 1533 | 1533 | MSX_LAYOUT_SLOT (0, 0, 2, 2, RAM, 0x8000, 0x8000) /* 32KB RAM */ |
| 1534 | 1534 | MSX_LAYOUT_SLOT (0, 1, 0, 1, ROM, 0x4000, 0x8000) |
| 1535 | MSX_LAYOUT_SLOT (0, 1, 1, 2, DISK_ROM, 0x4000, 0xc000) | |
| 1535 | MSX_LAYOUT_SLOT (0, 1, 1, 2, DISK_ROM, 0x4000, 0xc000) | |
| 1536 | 1536 | MSX_LAYOUT_SLOT (0, 2, 0, 2, RAM, 0x8000, 0x0000) /* 32KB RAM */ |
| 1537 | 1537 | MSX_LAYOUT_SLOT (1, 0, 0, 4, CARTRIDGE1, 0x0000, 0x0000) |
| 1538 | 1538 | MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000) |
| r1461 | r1462 | |
| 1552 | 1552 | MSX_LAYOUT_INIT (hbf900) |
| 1553 | 1553 | MSX_LAYOUT_SLOT (0, 0, 0, 2, ROM, 0x8000, 0x0000) |
| 1554 | 1554 | MSX_LAYOUT_SLOT (1, 0, 0, 4, CARTRIDGE1, 0x0000, 0x0000) |
| 1555 | MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000) | |
| 1555 | MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000) | |
| 1556 | 1556 | MSX_LAYOUT_SLOT (3, 0, 0, 1, ROM, 0x4000, 0x8000) |
| 1557 | MSX_LAYOUT_SLOT (3, 0, 1, 2, DISK_ROM, 0x4000, 0xc000) | |
| 1557 | MSX_LAYOUT_SLOT (3, 0, 1, 2, DISK_ROM, 0x4000, 0xc000) | |
| 1558 | 1558 | MSX_LAYOUT_SLOT (3, 1, 0, 4, RAM_MM, 0x40000, 0x0000) /* 256KB Mapper RAM */ |
| 1559 | MSX_LAYOUT_SLOT (3, 3, 1, 1, ROM, 0x4000, 0x10000) | |
| 1559 | MSX_LAYOUT_SLOT (3, 3, 1, 1, ROM, 0x4000, 0x10000) | |
| 1560 | 1560 | MSX_LAYOUT_KANJI (0x24000) |
| 1561 | 1561 | MSX_LAYOUT_RAMIO_SET_BITS (0x80) |
| 1562 | 1562 | MSX_LAYOUT_END |
| r1461 | r1462 | |
| 1574 | 1574 | MSX_LAYOUT_INIT (hbf900a) |
| 1575 | 1575 | MSX_LAYOUT_SLOT (0, 0, 0, 2, ROM, 0x8000, 0x0000) |
| 1576 | 1576 | MSX_LAYOUT_SLOT (1, 0, 0, 4, CARTRIDGE1, 0x0000, 0x0000) |
| 1577 | MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000) | |
| 1577 | MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000) | |
| 1578 | 1578 | MSX_LAYOUT_SLOT (3, 0, 0, 1, ROM, 0x4000, 0x8000) |
| 1579 | MSX_LAYOUT_SLOT (3, 0, 1, 2, DISK_ROM, 0x4000, 0xc000) | |
| 1579 | MSX_LAYOUT_SLOT (3, 0, 1, 2, DISK_ROM, 0x4000, 0xc000) | |
| 1580 | 1580 | MSX_LAYOUT_SLOT (3, 1, 0, 4, RAM_MM, 0x40000, 0x0000) /* 256KB Mapper RAM */ |
| 1581 | MSX_LAYOUT_SLOT (3, 3, 1, 1, ROM, 0x4000, 0x10000) | |
| 1581 | MSX_LAYOUT_SLOT (3, 3, 1, 1, ROM, 0x4000, 0x10000) | |
| 1582 | 1582 | MSX_LAYOUT_KANJI (0x24000) |
| 1583 | 1583 | MSX_LAYOUT_RAMIO_SET_BITS (0x80) |
| 1584 | 1584 | MSX_LAYOUT_END |
| r1461 | r1462 | |
| 1751 | 1751 | MSX_LAYOUT_INIT (hbf9p) |
| 1752 | 1752 | MSX_LAYOUT_SLOT (0, 0, 0, 2, ROM, 0x8000, 0x0000) |
| 1753 | 1753 | MSX_LAYOUT_SLOT (1, 0, 0, 4, CARTRIDGE1, 0x0000, 0x0000) |
| 1754 | MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000) | |
| 1754 | MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000) | |
| 1755 | 1755 | MSX_LAYOUT_SLOT (3, 0, 0, 1, ROM, 0x4000, 0x8000) |
| 1756 | 1756 | MSX_LAYOUT_SLOT (3, 0, 1, 1, ROM, 0x4000, 0xc000) |
| 1757 | MSX_LAYOUT_SLOT (3, 1, 1, 2, ROM, 0x8000, 0x20000) | |
| 1757 | MSX_LAYOUT_SLOT (3, 1, 1, 2, ROM, 0x8000, 0x20000) | |
| 1758 | 1758 | MSX_LAYOUT_SLOT (3, 2, 0, 4, RAM_MM, 0x20000, 0x0000) /* 128KB Mapper RAM */ |
| 1759 | 1759 | MSX_LAYOUT_RAMIO_SET_BITS (0x80) |
| 1760 | 1760 | MSX_LAYOUT_END |
| r1461 | r1462 | |
| 1771 | 1771 | MSX_LAYOUT_SLOT (0, 0, 0, 2, ROM, 0x8000, 0x0000) |
| 1772 | 1772 | MSX_LAYOUT_SLOT (0, 0, 2, 2, RAM, 0x8000, 0x8000) /* 32KB RAM */ |
| 1773 | 1773 | MSX_LAYOUT_SLOT (0, 1, 0, 1, ROM, 0x4000, 0x8000) |
| 1774 | MSX_LAYOUT_SLOT (0, 1, 1, 2, DISK_ROM, 0x4000, 0xc000) | |
| 1774 | MSX_LAYOUT_SLOT (0, 1, 1, 2, DISK_ROM, 0x4000, 0xc000) | |
| 1775 | 1775 | MSX_LAYOUT_SLOT (0, 2, 0, 2, RAM, 0x8000, 0x0000) /* 32KB RAM */ |
| 1776 | 1776 | MSX_LAYOUT_SLOT (1, 0, 0, 4, CARTRIDGE1, 0x0000, 0x0000) |
| 1777 | MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000) | |
| 1777 | MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000) | |
| 1778 | 1778 | MSX_LAYOUT_SLOT (3, 0, 0, 4, ROM, 0x10000, 0x10000) |
| 1779 | 1779 | MSX_LAYOUT_END |
| 1780 | 1780 | |
| r1461 | r1462 | |
| 1789 | 1789 | MSX_LAYOUT_INIT (hbf700d) |
| 1790 | 1790 | MSX_LAYOUT_SLOT (0, 0, 0, 2, ROM, 0x8000, 0x0000) |
| 1791 | 1791 | MSX_LAYOUT_SLOT (1, 0, 0, 4, CARTRIDGE1, 0x0000, 0x0000) |
| 1792 | MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000) | |
| 1792 | MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000) | |
| 1793 | 1793 | MSX_LAYOUT_SLOT (3, 0, 0, 1, ROM, 0x4000, 0x8000) |
| 1794 | MSX_LAYOUT_SLOT (3, 0, 1, 2, DISK_ROM, 0x4000, 0xc000) | |
| 1794 | MSX_LAYOUT_SLOT (3, 0, 1, 2, DISK_ROM, 0x4000, 0xc000) | |
| 1795 | 1795 | MSX_LAYOUT_SLOT (3, 3, 0, 4, RAM_MM, 0x40000, 0x0000) /* 256KB Mapper RAM */ |
| 1796 | 1796 | MSX_LAYOUT_RAMIO_SET_BITS (0x80) |
| 1797 | 1797 | MSX_LAYOUT_END |
| r1461 | r1462 | |
| 1807 | 1807 | MSX_LAYOUT_INIT (hbf700p) |
| 1808 | 1808 | MSX_LAYOUT_SLOT (0, 0, 0, 2, ROM, 0x8000, 0x0000) |
| 1809 | 1809 | MSX_LAYOUT_SLOT (1, 0, 0, 4, CARTRIDGE1, 0x0000, 0x0000) |
| 1810 | MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000) | |
| 1810 | MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000) | |
| 1811 | 1811 | MSX_LAYOUT_SLOT (3, 0, 0, 1, ROM, 0x4000, 0x8000) |
| 1812 | MSX_LAYOUT_SLOT (3, 0, 1, 2, DISK_ROM, 0x4000, 0xc000) | |
| 1812 | MSX_LAYOUT_SLOT (3, 0, 1, 2, DISK_ROM, 0x4000, 0xc000) | |
| 1813 | 1813 | MSX_LAYOUT_SLOT (3, 3, 0, 4, RAM_MM, 0x40000, 0x0000) /* 256KB Mapper RAM */ |
| 1814 | 1814 | MSX_LAYOUT_RAMIO_SET_BITS (0x80) |
| 1815 | 1815 | MSX_LAYOUT_END |
| r1461 | r1462 | |
| 1825 | 1825 | MSX_LAYOUT_INIT (hbf700s) |
| 1826 | 1826 | MSX_LAYOUT_SLOT (0, 0, 0, 2, ROM, 0x8000, 0x0000) |
| 1827 | 1827 | MSX_LAYOUT_SLOT (1, 0, 0, 4, CARTRIDGE1, 0x0000, 0x0000) |
| 1828 | MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000) | |
| 1828 | MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000) | |
| 1829 | 1829 | MSX_LAYOUT_SLOT (3, 0, 0, 1, ROM, 0x4000, 0x8000) |
| 1830 | MSX_LAYOUT_SLOT (3, 0, 1, 2, DISK_ROM, 0x4000, 0xc000) | |
| 1830 | MSX_LAYOUT_SLOT (3, 0, 1, 2, DISK_ROM, 0x4000, 0xc000) | |
| 1831 | 1831 | MSX_LAYOUT_SLOT (3, 3, 0, 4, RAM_MM, 0x40000, 0x0000) /* 256KB Mapper RAM */ |
| 1832 | 1832 | MSX_LAYOUT_RAMIO_SET_BITS (0x80) |
| 1833 | 1833 | MSX_LAYOUT_END |
| r1461 | r1462 | |
| 1845 | 1845 | MSX_LAYOUT_INIT (hbg900p) |
| 1846 | 1846 | MSX_LAYOUT_SLOT (0, 0, 0, 2, ROM, 0x8000, 0x0000) |
| 1847 | 1847 | MSX_LAYOUT_SLOT (0, 1, 0, 1, ROM, 0x4000, 0x8000) |
| 1848 | MSX_LAYOUT_SLOT (0, 1, 1, 2, DISK_ROM, 0x4000, 0xc000) | |
| 1848 | MSX_LAYOUT_SLOT (0, 1, 1, 2, DISK_ROM, 0x4000, 0xc000) | |
| 1849 | 1849 | /* MSX_LAYOUT_SLOT (0, 2, 1, 1, ROM, 0x4000, 0x20000) */ /* RS232C must be emulated */ |
| 1850 | 1850 | MSX_LAYOUT_SLOT (0, 3, 1, 1, ROM, 0x4000, 0x24000) |
| 1851 | 1851 | MSX_LAYOUT_SLOT (1, 0, 0, 4, CARTRIDGE1, 0x0000, 0x0000) |
| 1852 | MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000) | |
| 1852 | MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000) | |
| 1853 | 1853 | MSX_LAYOUT_SLOT (3, 0, 0, 4, RAM_MM, 0x10000, 0x0000) /* 64KB Mapper RAM */ |
| 1854 | 1854 | MSX_LAYOUT_RAMIO_SET_BITS (0x80) |
| 1855 | 1855 | MSX_LAYOUT_END |
| r1461 | r1462 | |
| 1871 | 1871 | MSX_LAYOUT_SLOT (3, 0, 0, 4, RAM_MM, 0x20000, 0x0000) /* 128KB Mapper RAM */ |
| 1872 | 1872 | MSX_LAYOUT_SLOT (3, 1, 0, 1, ROM, 0x4000, 0x8000) |
| 1873 | 1873 | MSX_LAYOUT_SLOT (3, 1, 1, 2, ROM, 0x8000, 0x20000) |
| 1874 | MSX_LAYOUT_SLOT (3, 2, 1, 2, DISK_ROM, 0x4000, 0xc000) | |
| 1874 | MSX_LAYOUT_SLOT (3, 2, 1, 2, DISK_ROM, 0x4000, 0xc000) | |
| 1875 | 1875 | MSX_LAYOUT_KANJI (0x28000) |
| 1876 | 1876 | MSX_LAYOUT_RAMIO_SET_BITS (0x80) |
| 1877 | 1877 | MSX_LAYOUT_END |
| r1461 | r1462 | |
| 2002 | 2002 | MSX_LAYOUT_SLOT (3, 0, 0, 4, RAM_MM, 0x10000, 0x0000) /* 64KB Mapper RAM */ |
| 2003 | 2003 | MSX_LAYOUT_SLOT (3, 1, 0, 1, ROM, 0x4000, 0x8000) |
| 2004 | 2004 | MSX_LAYOUT_SLOT (3, 1, 1, 2, ROM, 0x8000, 0x20000) |
| 2005 | MSX_LAYOUT_SLOT (3, 2, 1, 2, DISK_ROM, 0x4000, 0xc000) | |
| 2005 | MSX_LAYOUT_SLOT (3, 2, 1, 2, DISK_ROM, 0x4000, 0xc000) | |
| 2006 | 2006 | MSX_LAYOUT_SLOT (3, 3, 1, 1, ROM, 0x4000, 0x28000) |
| 2007 | 2007 | MSX_LAYOUT_KANJI (0x30000) |
| 2008 | 2008 | MSX_LAYOUT_RAMIO_SET_BITS (0x80) |
| r1461 | r1462 | |
| 2029 | 2029 | MSX_LAYOUT_SLOT (3, 0, 0, 4, RAM_MM, 0x10000, 0x0000) /* 64KB Mapper RAM */ |
| 2030 | 2030 | MSX_LAYOUT_SLOT (3, 1, 0, 1, ROM, 0x4000, 0x8000) |
| 2031 | 2031 | MSX_LAYOUT_SLOT (3, 1, 1, 2, ROM, 0x8000, 0x20000) |
| 2032 | MSX_LAYOUT_SLOT (3, 2, 1, 2, DISK_ROM, 0x4000, 0xc000) | |
| 2032 | MSX_LAYOUT_SLOT (3, 2, 1, 2, DISK_ROM, 0x4000, 0xc000) | |
| 2033 | 2033 | MSX_LAYOUT_SLOT (3, 3, 1, 1, ROM, 0x4000, 0x28000) |
| 2034 | 2034 | MSX_LAYOUT_KANJI (0x30000) |
| 2035 | 2035 | MSX_LAYOUT_RAMIO_SET_BITS (0x80) |
| r1461 | r1462 | |
| 2128 | 2128 | MSX_LAYOUT_INIT (vg8020) |
| 2129 | 2129 | MSX_LAYOUT_SLOT (0, 0, 0, 2, ROM, 0x8000, 0x0000) |
| 2130 | 2130 | MSX_LAYOUT_SLOT (1, 0, 0, 4, CARTRIDGE1, 0x0000, 0x0000) |
| 2131 | MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000) | |
| 2131 | MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000) | |
| 2132 | 2132 | MSX_LAYOUT_SLOT (3, 0, 0, 4, RAM, 0x10000, 0x0000) /* 64KB RAM */ |
| 2133 | 2133 | MSX_LAYOUT_END |
| 2134 | 2134 | |
| r1461 | r1462 | |
| 2204 | 2204 | SYSTEM_CONFIG_END |
| 2205 | 2205 | |
| 2206 | 2206 | MSX_DRIVER_LIST |
| 2207 | MSX_DRIVER (msx) | |
| 2207 | MSX_DRIVER (msx) | |
| 2208 | 2208 | MSX_DRIVER (hb75d) |
| 2209 | 2209 | MSX_DRIVER (hb75p) |
| 2210 | 2210 | MSX_DRIVER (hb501p) |
| r1461 | r1462 | |
| 2218 | 2218 | MSX_DRIVER (fs4000) |
| 2219 | 2219 | MSX_DRIVER (fs1300) |
| 2220 | 2220 | MSX_DRIVER (hb201) |
| 2221 | MSX_DRIVER (dpc100) | |
| 2222 | MSX_DRIVER (dpc180) | |
| 2223 | MSX_DRIVER (dpc200) | |
| 2224 | MSX_DRIVER (hotbit11) | |
| 2225 | MSX_DRIVER (hotbit12) | |
| 2226 | MSX_DRIVER (expert10) | |
| 2227 | MSX_DRIVER (expert11) | |
| 2228 | MSX_DRIVER (expertdp) | |
| 2229 | MSX_DRIVER (msx2) | |
| 2221 | MSX_DRIVER (dpc100) | |
| 2222 | MSX_DRIVER (dpc180) | |
| 2223 | MSX_DRIVER (dpc200) | |
| 2224 | MSX_DRIVER (hotbit11) | |
| 2225 | MSX_DRIVER (hotbit12) | |
| 2226 | MSX_DRIVER (expert10) | |
| 2227 | MSX_DRIVER (expert11) | |
| 2228 | MSX_DRIVER (expertdp) | |
| 2229 | MSX_DRIVER (msx2) | |
| 2230 | 2230 | MSX_DRIVER (nms8220) |
| 2231 | 2231 | MSX_DRIVER (nms8220a) |
| 2232 | 2232 | MSX_DRIVER (vg8235) |
| r1461 | r1462 | |
| 2238 | 2238 | MSX_DRIVER (hbf500p) |
| 2239 | 2239 | MSX_DRIVER (hbf700d) |
| 2240 | 2240 | MSX_DRIVER (hbf700p) |
| 2241 | MSX_DRIVER (hbf700s) | |
| 2241 | MSX_DRIVER (hbf700s) | |
| 2242 | 2242 | MSX_DRIVER (hbg900p) |
| 2243 | 2243 | MSX_DRIVER (fs5500) |
| 2244 | 2244 | MSX_DRIVER (fs4500) |
| r1461 | r1462 | |
|---|---|---|
| 68 | 68 | PORT_BIT( 0xff, 80, IPT_LIGHTGUN_Y ) PORT_MINMAX(0,159) PORT_SENSITIVITY(50) PORT_KEYDELTA(8) |
| 69 | 69 | INPUT_PORTS_END |
| 70 | 70 | |
| 71 | #define GAMECOM_PALETTE_LENGTH 5 | |
| 71 | #define GAMECOM_PALETTE_LENGTH 5 | |
| 72 | 72 | |
| 73 | 73 | static const unsigned char palette[] = |
| 74 | 74 | { |
| r1461 | r1462 | |
|---|---|---|
| 112 | 112 | // set character color |
| 113 | 113 | vismac_color_latch = data; |
| 114 | 114 | break; |
| 115 | ||
| 115 | ||
| 116 | 116 | case 0x30: |
| 117 | 117 | // write cdp1869 command on the data bus |
| 118 | 118 | vismac_bkg_latch = data & 0x07; |
| 119 | 119 | cdp1869_out3_w(0, data); |
| 120 | 120 | break; |
| 121 | ||
| 121 | ||
| 122 | 122 | case 0x40: |
| 123 | 123 | cdp1869_out4_w(0, data); |
| 124 | 124 | break; |
| 125 | ||
| 125 | ||
| 126 | 126 | case 0x50: |
| 127 | 127 | cdp1869_out5_w(0, data); |
| 128 | 128 | break; |
| 129 | ||
| 129 | ||
| 130 | 130 | case 0x60: |
| 131 | 131 | cdp1869_out6_w(0, data); |
| 132 | 132 | break; |
| 133 | ||
| 133 | ||
| 134 | 134 | case 0x70: |
| 135 | 135 | cdp1869_out7_w(0, data); |
| 136 | 136 | break; |
| r1461 | r1462 | |
| 336 | 336 | /* Machine Drivers */ |
| 337 | 337 | |
| 338 | 338 | static MACHINE_DRIVER_START( tmc600 ) |
| 339 | ||
| 339 | ||
| 340 | 340 | // basic system hardware |
| 341 | 341 | |
| 342 | 342 | MDRV_CPU_ADD(CDP1802, 3579545) // ??? |
| r1461 | r1462 | |
|---|---|---|
| 108 | 108 | MDRV_PALETTE_LENGTH(256 + 32768) |
| 109 | 109 | /*MDRV_ASPECT_RATIO(3, 4)*/ |
| 110 | 110 | |
| 111 | MDRV_VIDEO_START( vectrex ) | |
| 111 | MDRV_VIDEO_START( vectrex ) | |
| 112 | 112 | MDRV_VIDEO_UPDATE( vectrex ) |
| 113 | 113 | |
| 114 | 114 | /* sound hardware */ |
| r1461 | r1462 | |
| 117 | 117 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) |
| 118 | 118 | MDRV_SOUND_ADD(AY8910, 1500000) |
| 119 | 119 | MDRV_SOUND_CONFIG(ay8910_interface) |
| 120 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20) | |
| 120 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20) | |
| 121 | 121 | MACHINE_DRIVER_END |
| 122 | 122 | |
| 123 | 123 | static void vectrex_cartslot_getinfo(const device_class *devclass, UINT32 state, union devinfo *info) |
| r1461 | r1462 | |
| 163 | 163 | after that 2 and 3. You can leave the screen where you enter |
| 164 | 164 | ads by pressing 8 several times. |
| 165 | 165 | |
| 166 | Character matrix is: | |
| 166 | Character matrix is: | |
| 167 | 167 | |
| 168 | 168 | btn| 1 2 3 4 5 6 7 8 |
| 169 | 169 | ---+------------------------ |
| 170 | 1 | 0 1 2 3 4 5 6 7 | |
| 170 | 1 | 0 1 2 3 4 5 6 7 | |
| 171 | 171 | 2 | 8 9 A B C D E F |
| 172 | 172 | 3 | G H I J K L M N |
| 173 | 173 | 4 | O P Q R S T U V |
| r1461 | r1462 | |
|---|---|---|
| 319 | 319 | |
| 320 | 320 | static VIDEO_START( tm990_189_v ) |
| 321 | 321 | { |
| 322 | /* NPW 27-Feb-2006 - ewwww gross!!! maybe this can be fixed when | |
| 322 | /* NPW 27-Feb-2006 - ewwww gross!!! maybe this can be fixed when | |
| 323 | 323 | * multimonitor support is added?*/ |
| 324 | 324 | LED_display_window_left = machine->screen[0].visarea.min_x; |
| 325 | 325 | LED_display_window_top = machine->screen[0].visarea.max_y - 32; |
| r1461 | r1462 | |
| 918 | 918 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("@ /") PORT_CODE(KEYCODE_MINUS) |
| 919 | 919 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("> %") PORT_CODE(KEYCODE_EQUALS) |
| 920 | 920 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0 ^") PORT_CODE(KEYCODE_0) |
| 921 | ||
| 921 | ||
| 922 | 922 | PORT_START /* row 2 */ |
| 923 | 923 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1 .") PORT_CODE(KEYCODE_1) |
| 924 | 924 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2 ;") PORT_CODE(KEYCODE_2) |
| 925 | 925 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 :") PORT_CODE(KEYCODE_3) |
| 926 | 926 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4 ?") PORT_CODE(KEYCODE_4) |
| 927 | 927 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 !") PORT_CODE(KEYCODE_5) |
| 928 | ||
| 928 | ||
| 929 | 929 | PORT_START /* row 3 */ |
| 930 | 930 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6 _") PORT_CODE(KEYCODE_6) |
| 931 | 931 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7 \"") PORT_CODE(KEYCODE_7) |
| r1461 | r1462 | |
|---|---|---|
| 5 | 5 | Thomson 8-bit micro-computers. |
| 6 | 6 | |
| 7 | 7 | A 6809E-based French family of personal computers developed in the 80's. |
| 8 | Despite their rather high price and poor design , they were quite popular | |
| 9 | in France, probably due to the government plan "Informatique pour tous" | |
| 10 | (Computer Science for Everyone) to put a network of MO5 computers in every | |
| 8 | Despite their rather high price and poor design , they were quite popular | |
| 9 | in France, probably due to the government plan "Informatique pour tous" | |
| 10 | (Computer Science for Everyone) to put a network of MO5 computers in every | |
| 11 | 11 | school during 1984-1986. And maybe their very popular light-pen. |
| 12 | 12 | |
| 13 | 13 | Drivers |
| r1461 | r1462 | |
| 24 | 24 | - to8d Thomson TO8D (TO8 with integrated floppy, dec 1987) |
| 25 | 25 | - pro128 Olivetti Prodest PC 128 (Italian MO6, built by Thomson, 1986) |
| 26 | 26 | |
| 27 | We do not consider here the few 16-bit computers built by Thomson | |
| 27 | We do not consider here the few 16-bit computers built by Thomson | |
| 28 | 28 | (68000-based Micromega 32, 8088-based Micromega 16 or the TO16: Thomson's own |
| 29 | 29 | 8088-based PC). |
| 30 | 30 | |
| r1461 | r1462 | |
| 40 | 40 | similar technologies, but with different cost/feature trade-offs and |
| 41 | 41 | different compatibility (MO6 is MO5-compatible, TO9+ is TO9-compatible and |
| 42 | 42 | TO8 and TO9+ are TO7-compatible). |
| 43 | Also note that the MO5NR is actually based on MO6 design, not MO5 | |
| 43 | Also note that the MO5NR is actually based on MO6 design, not MO5 | |
| 44 | 44 | (although both MO5NR and MO6 are MO5-compatible) |
| 45 | 45 | |
| 46 | 46 | Also of interest are the Platini and Hinault versions of the MO5 |
| r1461 | r1462 | |
| 48 | 48 | There were several versions of TO7/70 and MO5 with alternate keyboards. |
| 49 | 49 | |
| 50 | 50 | Thomson stopped producing micro-computers in jan 1990. |
| 51 | ||
| 51 | ||
| 52 | 52 | **********************************************************************/ |
| 53 | 53 | |
| 54 | 54 | /* TODO (roughly in decreasing priority order): |
| r1461 | r1462 | |
| 119 | 119 | connect either two 8-position 2-button game pads |
| 120 | 120 | or a 2-button mouse (not both at the same time!) |
| 121 | 121 | |
| 122 | We emulate the SX 90-018 as it is fully compatible with the CM 90-112. | |
| 122 | We emulate the SX 90-018 as it is fully compatible with the CM 90-112. | |
| 123 | 123 | |
| 124 | 124 | Notes: |
| 125 | 125 | * all extensions are compatible with all Thomson computers. |
| r1461 | r1462 | |
| 127 | 127 | * the TO9 has its own, different mouse port |
| 128 | 128 | * all extensions are based on a Motorola 6821 PIA |
| 129 | 129 | * all extensions include a 6-bit sound DAC |
| 130 | * most pre-TO8 software (including TO9) do not recognise the mouse nor the | |
| 130 | * most pre-TO8 software (including TO9) do not recognise the mouse nor the | |
| 131 | 131 | second button of each pad |
| 132 | 132 | * the mouse cannot be used at the same time as the pads: they use the same |
| 133 | 6821 input ports & physical port; we use a config switch to tell MESS | |
| 133 | 6821 input ports & physical port; we use a config switch to tell MESS | |
| 134 | 134 | whether pads or a mouse is connected |
| 135 | 135 | * the mouse should not be used at the same time as the sound DAC: they use |
| 136 | 136 | the same 6821 ports, either as input or output; starting from the TO8, |
| 137 | 137 | there is a 'mute' signal to cut the DAC output and avoid producing an |
| 138 | audible buzz whenever the mouse is moved; unfortunately, mute is not | |
| 138 | audible buzz whenever the mouse is moved; unfortunately, mute is not | |
| 139 | 139 | available on the TO7(/70), TO9 and MO5. |
| 140 | 140 | */ |
| 141 | 141 | |
| r1461 | r1462 | |
| 155 | 155 | PORT_START_TAG ( "game_port_buttons" ) |
| 156 | 156 | PAD ( 0x40, 1, "Action A", BUTTON1, BUTTON1, LCONTROL ) |
| 157 | 157 | PAD ( 0x80, 2, "Action A", BUTTON1, BUTTON1, RCONTROL ) |
| 158 | ||
| 158 | ||
| 159 | 159 | /* joysticks, SX 90-018 specific */ |
| 160 | 160 | PAD ( 0x04, 1, "Action B", BUTTON2, BUTTON2, LALT ) |
| 161 | 161 | PAD ( 0x08, 2, "Action B", BUTTON2, BUTTON2, RALT ) |
| r1461 | r1462 | |
| 164 | 164 | |
| 165 | 165 | /* mouse, SX 90-018 specific */ |
| 166 | 166 | PORT_START_TAG ( "mouse_x" ) |
| 167 | PORT_BIT ( 0xffff, 0x00, IPT_MOUSE_X ) | |
| 167 | PORT_BIT ( 0xffff, 0x00, IPT_MOUSE_X ) | |
| 168 | 168 | PORT_NAME ( "Mouse X" ) |
| 169 | 169 | PORT_SENSITIVITY ( 150 ) |
| 170 | 170 | PORT_PLAYER (1) |
| 171 | ||
| 171 | ||
| 172 | 172 | PORT_START_TAG ( "mouse_y" ) |
| 173 | 173 | PORT_BIT ( 0xffff, 0x00, IPT_MOUSE_Y ) |
| 174 | 174 | PORT_NAME ( "Mouse Y" ) |
| 175 | PORT_SENSITIVITY ( 150 ) | |
| 175 | PORT_SENSITIVITY ( 150 ) | |
| 176 | 176 | PORT_PLAYER (1) |
| 177 | 177 | |
| 178 | 178 | PORT_START_TAG ( "mouse_button" ) |
| r1461 | r1462 | |
| 225 | 225 | case DEVINFO_STR_FILE_EXTENSIONS: |
| 226 | 226 | strcpy( info->s = device_temp_str(), "m7,rom" ); |
| 227 | 227 | break; |
| 228 | default: | |
| 228 | default: | |
| 229 | 229 | cartslot_device_getinfo( devclass, state, info ); |
| 230 | } | |
| 230 | } | |
| 231 | 231 | } |
| 232 | 232 | |
| 233 | 233 | static void mo5_cartridge_getinfo( const device_class *devclass, UINT32 state, union devinfo *info ) |
| r1461 | r1462 | |
| 242 | 242 | case DEVINFO_STR_FILE_EXTENSIONS: |
| 243 | 243 | strcpy( info->s = device_temp_str(), "m5,rom" ); |
| 244 | 244 | break; |
| 245 | default: | |
| 245 | default: | |
| 246 | 246 | cartslot_device_getinfo( devclass, state, info ); |
| 247 | } | |
| 247 | } | |
| 248 | 248 | } |
| 249 | 249 | |
| 250 | 250 | |
| r1461 | r1462 | |
| 254 | 254 | { |
| 255 | 255 | switch ( state ) { |
| 256 | 256 | case DEVINFO_INT_COUNT: |
| 257 | info->i = 1; | |
| 257 | info->i = 1; | |
| 258 | 258 | break; |
| 259 | 259 | default: |
| 260 | 260 | printer_device_getinfo( devclass, state, info ); |
| r1461 | r1462 | |
| 265 | 265 | /* ------------ serial ------------ */ |
| 266 | 266 | |
| 267 | 267 | static const char *const thom_serial_names[3][3]= |
| 268 | { | |
| 268 | { | |
| 269 | 269 | { "cc90232", "c232", "RS232 (older, CC 90-232)" }, |
| 270 | 270 | { "rf57932", "r232", "RS232 (newer, RF 57-932)" }, |
| 271 | { "modem", "modm", "Modem" } | |
| 272 | }; | |
| 271 | { "modem", "modm", "Modem" } | |
| 272 | }; | |
| 273 | 273 | |
| 274 | 274 | static void thom_serial_getinfo ( const device_class *devclass, UINT32 state, union devinfo *info ) |
| 275 | 275 | { |
| 276 | 276 | switch ( state ) { |
| 277 | 277 | case DEVINFO_INT_COUNT: |
| 278 | info->i = 3; | |
| 278 | info->i = 3; | |
| 279 | 279 | break; |
| 280 | 280 | case DEVINFO_INT_TYPE: |
| 281 | info->i = IO_SERIAL; | |
| 281 | info->i = IO_SERIAL; | |
| 282 | 282 | break; |
| 283 | 283 | case DEVINFO_INT_READABLE: |
| 284 | info->i = 1; | |
| 284 | info->i = 1; | |
| 285 | 285 | break; |
| 286 | 286 | case DEVINFO_INT_WRITEABLE: |
| 287 | info->i = 1; | |
| 287 | info->i = 1; | |
| 288 | 288 | break; |
| 289 | 289 | case DEVINFO_INT_CREATABLE: |
| 290 | info->i = 1; | |
| 290 | info->i = 1; | |
| 291 | 291 | break; |
| 292 | ||
| 292 | ||
| 293 | 293 | case DEVINFO_PTR_INIT: |
| 294 | 294 | info->init = thom_serial_init; |
| 295 | 295 | break; |
| 296 | 296 | case DEVINFO_PTR_LOAD: |
| 297 | info->load = thom_serial_load; | |
| 297 | info->load = thom_serial_load; | |
| 298 | 298 | break; |
| 299 | 299 | case DEVINFO_PTR_UNLOAD: |
| 300 | 300 | info->unload = thom_serial_unload; |
| 301 | 301 | break; |
| 302 | ||
| 302 | ||
| 303 | 303 | case DEVINFO_STR_NAME+0: |
| 304 | 304 | case DEVINFO_STR_NAME+1: |
| 305 | 305 | case DEVINFO_STR_NAME+2: |
| 306 | strcpy( info->s = device_temp_str(), | |
| 306 | strcpy( info->s = device_temp_str(), | |
| 307 | 307 | thom_serial_names[ state - DEVINFO_STR_NAME ][ 0 ] ); |
| 308 | 308 | break; |
| 309 | 309 | case DEVINFO_STR_SHORT_NAME+0: |
| 310 | 310 | case DEVINFO_STR_SHORT_NAME+1: |
| 311 | 311 | case DEVINFO_STR_SHORT_NAME+2: |
| 312 | strcpy( info->s = device_temp_str(), | |
| 312 | strcpy( info->s = device_temp_str(), | |
| 313 | 313 | thom_serial_names[ state - DEVINFO_STR_SHORT_NAME ][ 1 ] ); |
| 314 | 314 | break; |
| 315 | 315 | case DEVINFO_STR_DESCRIPTION+0: |
| 316 | 316 | case DEVINFO_STR_DESCRIPTION+1: |
| 317 | 317 | case DEVINFO_STR_DESCRIPTION+2: |
| 318 | strcpy( info->s = device_temp_str(), | |
| 318 | strcpy( info->s = device_temp_str(), | |
| 319 | 319 | thom_serial_names[ state - DEVINFO_STR_DESCRIPTION ][ 2 ] ); |
| 320 | 320 | break; |
| 321 | ||
| 321 | ||
| 322 | 322 | case DEVINFO_STR_DEV_FILE: |
| 323 | 323 | strcpy( info->s = device_temp_str(), "serial" ); |
| 324 | 324 | break; |
| 325 | 325 | case DEVINFO_STR_FILE_EXTENSIONS: |
| 326 | strcpy( info->s = device_temp_str(), "txt" ); | |
| 326 | strcpy( info->s = device_temp_str(), "txt" ); | |
| 327 | 327 | break; |
| 328 | 328 | |
| 329 | 329 | } |
| r1461 | r1462 | |
| 340 | 340 | Note that the computer comes with only a minimal BIOS and requires an |
| 341 | 341 | external cartridge to be usable. |
| 342 | 342 | Most software are distributed on cassette and require the BASIC 1.0 cartridge |
| 343 | to be present (-cart basic.m7), as only it provides the necessary OS | |
| 343 | to be present (-cart basic.m7), as only it provides the necessary OS | |
| 344 | 344 | capabilities (e.g., a cassette loader). |
| 345 | To use disks, you will need both a BASIC 1.0 cartridge and a BASIC DOS | |
| 345 | To use disks, you will need both a BASIC 1.0 cartridge and a BASIC DOS | |
| 346 | 346 | boot floppy. |
| 347 | 347 | |
| 348 | 348 | * chips: |
| r1461 | r1462 | |
| 376 | 376 | . two 8-position 2-button game pads |
| 377 | 377 | . 2-button mouse |
| 378 | 378 | . based on a Motorola 6821 PIA |
| 379 | - CC 90-232 I/O extension: | |
| 380 | . CENTRONICS (printer) | |
| 379 | - CC 90-232 I/O extension: | |
| 380 | . CENTRONICS (printer) | |
| 381 | 381 | . RS232 (unemulated) |
| 382 | 382 | . based on a Motorola 6821 PIA |
| 383 | 383 | . NOTE: you cannot use the CENTRONICS and RS232 at the same time |
| r1461 | r1462 | |
| 391 | 391 | - 5"1/2 floppy drive extension |
| 392 | 392 | . CD 90-640 floppy controller, based on a Western Digital 2793 |
| 393 | 393 | . DD 90-320 double-density double-sided 5"1/4 floppy |
| 394 | (2 drives considered as 4 simple-face drives: 0/1 for the first drive, | |
| 395 | 2/3 for the second drive, 1 and 3 for upper sides, 0 and 2 for lower | |
| 394 | (2 drives considered as 4 simple-face drives: 0/1 for the first drive, | |
| 395 | 2/3 for the second drive, 1 and 3 for upper sides, 0 and 2 for lower | |
| 396 | 396 | sides) |
| 397 | 397 | . floppies are 40 tracks/side, 16 sectors/track, 128 or 256 bytes/sector |
| 398 | 398 | = from 80 KB one-sided single-density, to 320 KB two-sided double-density |
| r1461 | r1462 | |
| 417 | 417 | ----- |
| 418 | 418 | |
| 419 | 419 | Early TO7 prototype. |
| 420 | The hardware seems to be the exactly same. Only the BIOS is different. | |
| 420 | The hardware seems to be the exactly same. Only the BIOS is different. | |
| 421 | 421 | It has some bug that were corrected later for the TO7. |
| 422 | 422 | Actually, the two computers are undistinguishable, except for the different |
| 423 | 423 | startup screen, and a couple BIOS addresses. |
| r1461 | r1462 | |
| 434 | 434 | AM_RANGE ( 0x0000, 0x3fff ) AM_ROMBANK ( THOM_CART_BANK ) /* 4 * 16 KB */ |
| 435 | 435 | AM_WRITE ( to7_cartridge_w ) |
| 436 | 436 | AM_RANGE ( 0x4000, 0x5fff ) AM_RAMBANK ( THOM_VRAM_BANK ) |
| 437 | AM_WRITE ( to7_vram_w ) | |
| 437 | AM_WRITE ( to7_vram_w ) | |
| 438 | 438 | AM_RANGE ( 0x6000, 0x7fff ) AM_RAMBANK ( THOM_BASE_BANK ) /* 1 * 8 KB */ |
| 439 | 439 | AM_RANGE ( 0x8000, 0xbfff ) AM_NOP /* 16 KB (for extension) */ |
| 440 | 440 | AM_RANGE ( 0xc000, 0xdfff ) AM_NOP /* 8 KB (for extension) */ |
| r1461 | r1462 | |
| 447 | 447 | AM_RANGE ( 0xe7e8, 0xe7eb ) AM_READWRITE ( acia_6551_r, acia_6551_w ) |
| 448 | 448 | AM_RANGE ( 0xe7f2, 0xe7f3 ) AM_READWRITE ( to7_midi_r, to7_midi_w ) |
| 449 | 449 | AM_RANGE ( 0xe7f8, 0xe7fb ) AM_READWRITE ( pia_3_alt_r, pia_3_alt_w ) |
| 450 | AM_RANGE ( 0xe7fe, 0xe7ff ) AM_READWRITE ( to7_modem_mea8000_r, | |
| 450 | AM_RANGE ( 0xe7fe, 0xe7ff ) AM_READWRITE ( to7_modem_mea8000_r, | |
| 451 | 451 | to7_modem_mea8000_w ) |
| 452 | 452 | AM_RANGE ( 0xe800, 0xffff ) AM_ROM /* system bios */ |
| 453 | 453 | |
| 454 | 454 | /* 0x10000 - 0x1ffff: 64 KB external ROM cartridge */ |
| 455 | 455 | /* 0x20000 - 0x247ff: 18 KB floppy / network ROM controllers */ |
| 456 | ||
| 456 | ||
| 457 | 457 | /* mess_ram mapping: |
| 458 | 458 | 0x0000 - 0x3fff: 16 KB video RAM (actually 8 K x 8 bits + 8 K x 6 bits) |
| 459 | 459 | 0x4000 - 0x5fff: 8 KB base RAM |
| r1461 | r1462 | |
| 501 | 501 | ROM_LOAD ( "cq90-028.rom", base+0x3800, 0x7c0, \ |
| 502 | 502 | CRC(ca4dba3d) \ |
| 503 | 503 | MD5(0f58e167bf6ebcd2cbba946be2084fbe) \ |
| 504 | SHA1(949c1f777c892da62c242215d79757d61e71e62b) ) | |
| 505 | ||
| 506 | /* external floppy / network controller: 9 banks */ | |
| 504 | SHA1(949c1f777c892da62c242215d79757d61e71e62b) ) | |
| 505 | ||
| 506 | /* external floppy / network controller: 9 banks */ | |
| 507 | 507 | #define ROM_FLOPPY5( base ) \ |
| 508 | 508 | ROM_FLOPPY( base ) \ |
| 509 | 509 | ROM_LOAD ( "nano5.rom", base+0x4000, 0x7c0, \ |
| r1461 | r1462 | |
| 517 | 517 | CRC(42a1d1a6) \ |
| 518 | 518 | MD5(77da8cfc9e0a14ef2ed7034f5941b542) \ |
| 519 | 519 | SHA1(973209f4baa5e81bf7885c0602949e064bac7862) ) |
| 520 | ||
| 521 | 520 | |
| 521 | ||
| 522 | 522 | ROM_START ( to7 ) |
| 523 | 523 | ROM_REGION ( 0x24800, REGION_CPU1, 0 ) |
| 524 | 524 | ROM_LOAD ( "to7.rom", 0xe800, 0x1800, |
| 525 | 525 | CRC(0e7826da) |
| 526 | MD5(5bf18521bf35293de942645f690b2845) | |
| 526 | MD5(5bf18521bf35293de942645f690b2845) | |
| 527 | 527 | SHA1(23a2f84b03c01d385cc1923c8ece95c43756297a) ) |
| 528 | 528 | ROM_FILL ( 0x10000, 0x10000, 0x39 ) |
| 529 | 529 | ROM_FLOPPY7 ( 0x20000 ) |
| r1461 | r1462 | |
| 533 | 533 | ROM_REGION ( 0x24800, REGION_CPU1, 0 ) |
| 534 | 534 | ROM_LOAD ( "t9000.rom", 0xe800, 0x1800, |
| 535 | 535 | CRC(daa8cfbf) |
| 536 | MD5(b3007f26e7b621c1a4f0fd2c287f80b9) | |
| 536 | MD5(b3007f26e7b621c1a4f0fd2c287f80b9) | |
| 537 | 537 | SHA1(a5735db1ad4e529804fc46603f838d3f4ccaf5cf) ) |
| 538 | 538 | ROM_FILL ( 0x10000, 0x10000, 0x39 ) |
| 539 | 539 | ROM_FLOPPY7 ( 0x20000 ) |
| r1461 | r1462 | |
| 558 | 558 | PORT_CONFSETTING ( 0x00, "Normal (56x47)" ) |
| 559 | 559 | PORT_CONFSETTING ( 0x01, "Small (16x16)" ) |
| 560 | 560 | PORT_CONFSETTING ( 0x02, DEF_STR ( None ) ) |
| 561 | ||
| 561 | ||
| 562 | 562 | PORT_CONFNAME ( 0x0c, 0x08, "Resolution" ) |
| 563 | 563 | PORT_CONFSETTING ( 0x00, DEF_STR ( Low ) ) |
| 564 | 564 | PORT_CONFSETTING ( 0x04, DEF_STR ( High ) ) |
| r1461 | r1462 | |
| 738 | 738 | |
| 739 | 739 | static MACHINE_DRIVER_START ( to7 ) |
| 740 | 740 | |
| 741 | MDRV_MACHINE_START ( to7 ) | |
| 742 | MDRV_MACHINE_RESET ( to7 ) | |
| 743 | ||
| 741 | MDRV_MACHINE_START ( to7 ) | |
| 742 | MDRV_MACHINE_RESET ( to7 ) | |
| 743 | ||
| 744 | 744 | /* cpu */ |
| 745 | 745 | MDRV_CPU_ADD_TAG ( "main", M6809, 1000000 ) |
| 746 | 746 | MDRV_CPU_PROGRAM_MAP ( to7, 0 ) |
| 747 | ||
| 747 | ||
| 748 | 748 | /* video */ |
| 749 | /* Finally, I figured it out. The video hardware overclocks the SECAM | |
| 749 | /* Finally, I figured it out. The video hardware overclocks the SECAM | |
| 750 | 750 | framerate from 50 Hz to 1/0.019968 Hz to get 312 64us lines per frame, |
| 751 | 751 | i.e., 19.968 ms per frame, not 20 ms |
| 752 | 752 | */ |
| r1461 | r1462 | |
| 755 | 755 | MDRV_VIDEO_ATTRIBUTES ( VIDEO_TYPE_RASTER ) |
| 756 | 756 | MDRV_SCREEN_FORMAT( BITMAP_FORMAT_INDEXED16 ) |
| 757 | 757 | MDRV_SCREEN_SIZE ( THOM_TOTAL_WIDTH * 2, THOM_TOTAL_HEIGHT ) |
| 758 | MDRV_SCREEN_VISIBLE_AREA ( 0, THOM_TOTAL_WIDTH * 2 - 1, | |
| 758 | MDRV_SCREEN_VISIBLE_AREA ( 0, THOM_TOTAL_WIDTH * 2 - 1, | |
| 759 | 759 | 0, THOM_TOTAL_HEIGHT - 1 ) |
| 760 | 760 | MDRV_PALETTE_LENGTH ( 4097 ) /* 12-bit color + transparency */ |
| 761 | 761 | MDRV_PALETTE_INIT ( thom ) |
| r1461 | r1462 | |
| 795 | 795 | extensions (floppy, game, communucation, etc.). |
| 796 | 796 | As the TO7, it is only usable with a cartridge, and most software require |
| 797 | 797 | the BASIC 1.0 cartridge to be present. |
| 798 | Though, you may also use the more advanced BASIC 128 (-cart basic128.m7): | |
| 799 | it allows BASIC programs to access all the memory and the video capabilities, | |
| 800 | includes its own DOS (no need for a boot disk), but may not be compatible | |
| 798 | Though, you may also use the more advanced BASIC 128 (-cart basic128.m7): | |
| 799 | it allows BASIC programs to access all the memory and the video capabilities, | |
| 800 | includes its own DOS (no need for a boot disk), but may not be compatible | |
| 801 | 801 | with all games. |
| 802 | 802 | |
| 803 | 803 | It has the following modifications: |
| 804 | 804 | |
| 805 | 805 | * chips: |
| 806 | - custom logics for video, lightpen, address map has been replaced with an | |
| 806 | - custom logics for video, lightpen, address map has been replaced with an | |
| 807 | 807 | integrated Gate-Array (Motorola MC 1300 ALS) |
| 808 | 808 | |
| 809 | 809 | * memory: |
| 810 | 810 | - 48 KB user base RAM (16 KB unswitchable + 2 switchable banks of 16 KB) |
| 811 | + 64 KB user extended RAM (EM 97-064, as 4 extra 16 KB banks) | |
| 811 | + 64 KB user extended RAM (EM 97-064, as 4 extra 16 KB banks) | |
| 812 | 812 | = 112 KB total user RAM emulated |
| 813 | 813 | - now 8-bit x 8 K color RAM (instead of 6-bit x 8 K) |
| 814 | 814 | |
| r1461 | r1462 | |
| 839 | 839 | AM_RANGE ( 0x0000, 0x3fff ) AM_ROMBANK ( THOM_CART_BANK ) /* 4 * 16 KB */ |
| 840 | 840 | AM_WRITE ( to7_cartridge_w ) |
| 841 | 841 | AM_RANGE ( 0x4000, 0x5fff ) AM_RAMBANK ( THOM_VRAM_BANK ) |
| 842 | AM_WRITE ( to770_vram_w ) | |
| 842 | AM_WRITE ( to770_vram_w ) | |
| 843 | 843 | AM_RANGE ( 0x6000, 0x9fff ) AM_RAMBANK ( THOM_BASE_BANK ) /* 16 KB */ |
| 844 | 844 | AM_RANGE ( 0xa000, 0xdfff ) AM_RAMBANK ( THOM_RAM_BANK ) /* 6 * 16 KB */ |
| 845 | 845 | AM_RANGE ( 0xe000, 0xe7bf ) AM_ROMBANK ( THOM_FLOP_BANK ) |
| r1461 | r1462 | |
| 848 | 848 | AM_RANGE ( 0xe7cc, 0xe7cf ) AM_READWRITE ( pia_1_alt_r, pia_1_alt_w ) |
| 849 | 849 | AM_RANGE ( 0xe7d0, 0xe7df ) AM_READWRITE ( to7_floppy_r, to7_floppy_w ) |
| 850 | 850 | AM_RANGE ( 0xe7e0, 0xe7e3 ) AM_READWRITE ( pia_2_alt_r, pia_2_alt_w ) |
| 851 | AM_RANGE ( 0xe7e4, 0xe7e7 ) AM_READWRITE ( to770_gatearray_r, | |
| 851 | AM_RANGE ( 0xe7e4, 0xe7e7 ) AM_READWRITE ( to770_gatearray_r, | |
| 852 | 852 | to770_gatearray_w ) |
| 853 | 853 | AM_RANGE ( 0xe7e8, 0xe7eb ) AM_READWRITE ( acia_6551_r, acia_6551_w ) |
| 854 | 854 | AM_RANGE ( 0xe7f2, 0xe7f3 ) AM_READWRITE ( to7_midi_r, to7_midi_w ) |
| 855 | 855 | AM_RANGE ( 0xe7f8, 0xe7fb ) AM_READWRITE ( pia_3_alt_r, pia_3_alt_w ) |
| 856 | AM_RANGE ( 0xe7fe, 0xe7ff ) AM_READWRITE ( to7_modem_mea8000_r, | |
| 856 | AM_RANGE ( 0xe7fe, 0xe7ff ) AM_READWRITE ( to7_modem_mea8000_r, | |
| 857 | 857 | to7_modem_mea8000_w ) |
| 858 | 858 | AM_RANGE ( 0xe800, 0xffff ) AM_ROM /* system bios */ |
| 859 | 859 | |
| 860 | 860 | /* 0x10000 - 0x1ffff: 64 KB external ROM cartridge */ |
| 861 | 861 | /* 0x20000 - 0x247ff: 18 KB floppy / network ROM controllers */ |
| 862 | ||
| 862 | ||
| 863 | 863 | /* mess_ram mapping: |
| 864 | 864 | 0x00000 - 0x03fff: 16 KB video RAM |
| 865 | 865 | 0x04000 - 0x07fff: 16 KB unbanked base RAM |
| r1461 | r1462 | |
| 876 | 876 | ROM_REGION ( 0x24800, REGION_CPU1, 0 ) |
| 877 | 877 | ROM_LOAD ( "to770.rom", 0xe800, 0x1800, /* BIOS */ |
| 878 | 878 | CRC(89518862) |
| 879 | MD5(61402c35b75faeb4b74b815f323fff3d) | |
| 879 | MD5(61402c35b75faeb4b74b815f323fff3d) | |
| 880 | 880 | SHA1(cd34474c0bcc758f6d71c90fbd40cef379d61374) ) |
| 881 | 881 | ROM_FLOPPY7 ( 0x20000 ) |
| 882 | 882 | ROM_FILL ( 0x10000, 0x10000, 0x39 ) |
| r1461 | r1462 | |
| 886 | 886 | ROM_REGION ( 0x24800, REGION_CPU1, 0 ) |
| 887 | 887 | ROM_LOAD ( "to770a.rom", 0xe800, 0x1800, |
| 888 | 888 | CRC(378ea808) |
| 889 | MD5(6b63aa135107beee243967a2da0e5453) | |
| 889 | MD5(6b63aa135107beee243967a2da0e5453) | |
| 890 | 890 | SHA1(f4575b537dfdb46ff2a0e7cbe8dfe4ba63161b8e) ) |
| 891 | 891 | ROM_FLOPPY7 ( 0x20000 ) |
| 892 | 892 | ROM_FILL ( 0x10000, 0x10000, 0x39 ) |
| r1461 | r1462 | |
| 984 | 984 | It has less memory and is less expandable. The MC6846 timer has disapeared. |
| 985 | 985 | The BIOS has been throughly rewritten and uses a more compact call scheme. |
| 986 | 986 | This, and the fact that the address map has changed, makes the MO5 completely |
| 987 | TO7 software incompatible (except for pure BASIC programs). | |
| 987 | TO7 software incompatible (except for pure BASIC programs). | |
| 988 | 988 | Moreover, the MO5 has incompatible cassette and cartridge formats. |
| 989 | 989 | Unlike the TO7, the BASIC 1.0 is integrated and the MO5 can be used "as-is". |
| 990 | 990 | |
| r1461 | r1462 | |
| 1001 | 1001 | - 8 KB color RAM + 8 KB point RAM, bank switched |
| 1002 | 1002 | - 2 to 8 KB floppy ROM comes with the floppy drive / network extension |
| 1003 | 1003 | |
| 1004 | * video: | |
| 1004 | * video: | |
| 1005 | 1005 | - as the TO7/70 but with different color encoding, |
| 1006 | 1006 | 320x200 pixels with color constraints, 16-color fixed palette |
| 1007 | 1007 | - IN 57-001: TV overlay extension (not implemented) |
| r1461 | r1462 | |
| 1036 | 1036 | static ADDRESS_MAP_START ( mo5, ADDRESS_SPACE_PROGRAM, 8 ) |
| 1037 | 1037 | |
| 1038 | 1038 | AM_RANGE ( 0x0000, 0x1fff ) AM_RAMBANK ( THOM_VRAM_BANK ) |
| 1039 | AM_WRITE ( to770_vram_w ) | |
| 1039 | AM_WRITE ( to770_vram_w ) | |
| 1040 | 1040 | AM_RANGE ( 0x2000, 0x9fff ) AM_RAMBANK ( THOM_BASE_BANK ) |
| 1041 | 1041 | AM_RANGE ( 0xa000, 0xa7bf ) AM_ROMBANK ( THOM_FLOP_BANK ) |
| 1042 | 1042 | AM_RANGE ( 0xa7c0, 0xa7c3 ) AM_READWRITE ( pia_0_alt_r, pia_0_alt_w ) |
| r1461 | r1462 | |
| 1072 | 1072 | ROM_REGION ( 0x24800, REGION_CPU1, 0 ) |
| 1073 | 1073 | ROM_LOAD ( "mo5.rom", 0xf000, 0x1000, |
| 1074 | 1074 | CRC(f0ea9140) |
| 1075 | MD5(ab3533a7132f90933acce80e256ae459) | |
| 1075 | MD5(ab3533a7132f90933acce80e256ae459) | |
| 1076 | 1076 | SHA1(36ce2d3df1866ec2fe368c1c28757e2f5401cf44) ) |
| 1077 | 1077 | ROM_LOAD ( "basic5.rom", 0x11000, 0x3000, |
| 1078 | 1078 | CRC(c2c11b9d) |
| 1079 | MD5(f992a912093d3e8f165f225f74345b57) | |
| 1079 | MD5(f992a912093d3e8f165f225f74345b57) | |
| 1080 | 1080 | SHA1(512dd40fb45bc2b51a24c84b3723a32bc8e80c06) ) |
| 1081 | 1081 | ROM_FLOPPY5 ( 0x20000 ) |
| 1082 | 1082 | ROM_END |
| r1461 | r1462 | |
| 1085 | 1085 | ROM_REGION ( 0x24800, REGION_CPU1, 0 ) |
| 1086 | 1086 | ROM_LOAD ( "mo5e.rom", 0xf000, 0x1000, |
| 1087 | 1087 | CRC(6520213a) |
| 1088 | MD5(434c42b96c31a341e13085048cdc8eae) | |
| 1088 | MD5(434c42b96c31a341e13085048cdc8eae) | |
| 1089 | 1089 | SHA1(f17a7a59baf2819ec80991b34b204795536a5e01) ) |
| 1090 | 1090 | ROM_LOAD ( "basic5e.rom", 0x11000, 0x3000, |
| 1091 | 1091 | CRC(934a72b2) |
| 1092 | MD5(6404a7f49ec28937decd905d2a3cbb28) | |
| 1092 | MD5(6404a7f49ec28937decd905d2a3cbb28) | |
| 1093 | 1093 | SHA1(b37e2b1afbfba368c19be87b3bf61dfe6ad8b0bb) ) |
| 1094 | 1094 | ROM_FLOPPY5 ( 0x20000 ) |
| 1095 | 1095 | ROM_END |
| r1461 | r1462 | |
| 1189 | 1189 | optional mouse. |
| 1190 | 1190 | It is also quite compatible with the TO7 and TO7/70 (but not the MO5). |
| 1191 | 1191 | However, it also has many problems. The integrated BASIC 128 can only access |
| 1192 | 128 KB of memory, which forces the 64 KB extension to be managed as a virtual | |
| 1193 | disk. The early versions of the software ROM has many bugs. The integrated | |
| 1192 | 128 KB of memory, which forces the 64 KB extension to be managed as a virtual | |
| 1193 | disk. The early versions of the software ROM has many bugs. The integrated | |
| 1194 | 1194 | floppy drive is one-sided. |
| 1195 | 1195 | It was replaced quickly with the improved TO9+. |
| 1196 | 1196 | |
| r1461 | r1462 | |
| 1206 | 1206 | - 112 KB base RAM |
| 1207 | 1207 | - 64 KB extension RAM (as virtual disk) |
| 1208 | 1208 | - 6 KB BIOS ROM + 2 KB floppy BIOS |
| 1209 | - 128 KB software ROM (BASIC 1, BASIC 128, extended BIOS, | |
| 1209 | - 128 KB software ROM (BASIC 1, BASIC 128, extended BIOS, | |
| 1210 | 1210 | DOS and configuration GUI, two software: "Paragraphe" and |
| 1211 | 1211 | "Fiches et dossiers") |
| 1212 | 1212 | - 16 KB video RAM |
| r1461 | r1462 | |
| 1251 | 1251 | AM_RANGE ( 0x0000, 0x3fff ) AM_ROMBANK ( THOM_CART_BANK )/* 12 * 16 KB */ |
| 1252 | 1252 | AM_WRITE ( to9_cartridge_w ) |
| 1253 | 1253 | AM_RANGE ( 0x4000, 0x5fff ) AM_RAMBANK ( THOM_VRAM_BANK ) |
| 1254 | AM_WRITE ( to770_vram_w ) | |
| 1254 | AM_WRITE ( to770_vram_w ) | |
| 1255 | 1255 | AM_RANGE ( 0x6000, 0x9fff ) AM_RAMBANK ( THOM_BASE_BANK ) /* 16 KB */ |
| 1256 | 1256 | AM_RANGE ( 0xa000, 0xdfff ) AM_RAMBANK ( THOM_RAM_BANK ) /* 10 * 16 KB */ |
| 1257 | 1257 | AM_RANGE ( 0xe000, 0xe7bf ) AM_ROMBANK ( THOM_FLOP_BANK ) |
| r1461 | r1462 | |
| 1261 | 1261 | AM_RANGE ( 0xe7d0, 0xe7d9 ) AM_READWRITE ( to9_floppy_r, to9_floppy_w ) |
| 1262 | 1262 | AM_RANGE ( 0xe7da, 0xe7dd ) AM_READWRITE ( to9_vreg_r, to9_vreg_w ) |
| 1263 | 1263 | AM_RANGE ( 0xe7de, 0xe7df ) AM_READWRITE ( to9_kbd_r, to9_kbd_w ) |
| 1264 | AM_RANGE ( 0xe7e4, 0xe7e7 ) AM_READWRITE ( to9_gatearray_r, | |
| 1264 | AM_RANGE ( 0xe7e4, 0xe7e7 ) AM_READWRITE ( to9_gatearray_r, | |
| 1265 | 1265 | to9_gatearray_w ) |
| 1266 | 1266 | AM_RANGE ( 0xe7e8, 0xe7eb ) AM_READWRITE ( acia_6551_r, acia_6551_w ) |
| 1267 | 1267 | /* AM_RANGE ( 0xe7f0, 0xe7f7 ) AM_READWRITE ( to9_ieee_r, to9_ieee_w ) */ |
| 1268 | 1268 | AM_RANGE ( 0xe7f2, 0xe7f3 ) AM_READWRITE ( to7_midi_r, to7_midi_w ) |
| 1269 | 1269 | AM_RANGE ( 0xe7f8, 0xe7fb ) AM_READWRITE ( pia_3_alt_r, pia_3_alt_w ) |
| 1270 | AM_RANGE ( 0xe7fe, 0xe7ff ) AM_READWRITE ( to7_modem_mea8000_r, | |
| 1270 | AM_RANGE ( 0xe7fe, 0xe7ff ) AM_READWRITE ( to7_modem_mea8000_r, | |
| 1271 | 1271 | to7_modem_mea8000_w ) |
| 1272 | 1272 | AM_RANGE ( 0xe800, 0xffff ) AM_ROM /* system bios */ |
| 1273 | 1273 | |
| r1461 | r1462 | |
| 1288 | 1288 | /* ------------ ROMS ------------ */ |
| 1289 | 1289 | |
| 1290 | 1290 | /* NOT WORKING |
| 1291 | these bios seem heavily patched (probably to work with specific emulators | |
| 1291 | these bios seem heavily patched (probably to work with specific emulators | |
| 1292 | 1292 | that trap some bios calls) |
| 1293 | 1293 | */ |
| 1294 | 1294 | |
| r1461 | r1462 | |
| 1296 | 1296 | ROM_REGION ( 0x44800, REGION_CPU1, 0 ) |
| 1297 | 1297 | ROM_LOAD ( "to9.rom", 0xe000, 0x2000, /* BIOS & floppy controller */ |
| 1298 | 1298 | CRC(f9278bf7) |
| 1299 | MD5(507f0c482462b70b816fd23cf6791179) | |
| 1299 | MD5(507f0c482462b70b816fd23cf6791179) | |
| 1300 | 1300 | SHA1(9e99e6ae0285950f007b19161de642a4031fe46e) ) |
| 1301 | 1301 | |
| 1302 | 1302 | /* BASIC & software */ |
| 1303 | 1303 | ROM_LOAD ( "basic9-0.rom", 0x20000, 0x4000, |
| 1304 | 1304 | CRC(c7bac620) |
| 1305 | MD5(095d0f94ab506ab5da1e73ae550ee2bc) | |
| 1305 | MD5(095d0f94ab506ab5da1e73ae550ee2bc) | |
| 1306 | 1306 | SHA1(4b2a8b30cf437858ce978ba7b0dfa2bbd57eb38a) ) |
| 1307 | 1307 | ROM_LOAD ( "basic9-1.rom", 0x24000, 0x4000, |
| 1308 | 1308 | CRC(ea5f3e43) |
| 1309 | MD5(ce29a894c31db083acf6bdf015a02b5e) | |
| 1309 | MD5(ce29a894c31db083acf6bdf015a02b5e) | |
| 1310 | 1310 | SHA1(5e58a29c2d117fcdb1f5e7ca31dbfffa0f9218f2) ) |
| 1311 | 1311 | ROM_LOAD ( "basic9-2.rom", 0x28000, 0x4000, |
| 1312 | 1312 | CRC(0f5581b3) |
| 1313 | MD5(02279e22b8bfe29e750fb62671e3951d) | |
| 1313 | MD5(02279e22b8bfe29e750fb62671e3951d) | |
| 1314 | 1314 | SHA1(93815ca78d3532192aaa56cbf65b68b0f10f1b8a) ) |
| 1315 | 1315 | ROM_LOAD ( "basic9-3.rom", 0x2c000, 0x4000, |
| 1316 | 1316 | CRC(6b5b19e3) |
| 1317 | MD5(dac4b33a8cbebf64916b35515e0693c8) | |
| 1317 | MD5(dac4b33a8cbebf64916b35515e0693c8) | |
| 1318 | 1318 | SHA1(0e832670c185694d9abbcebcc3ad90e94eed585d) ) |
| 1319 | 1319 | ROM_LOAD ( "soft9-0a.rom", 0x30000, 0x4000, |
| 1320 | 1320 | CRC(8cee157e) |
| 1321 | MD5(3dab712e800351b4f639790595b12101) | |
| 1321 | MD5(3dab712e800351b4f639790595b12101) | |
| 1322 | 1322 | SHA1(f32fc39b95890c00571e9f3fbcc2d8e0596fc4a1) ) |
| 1323 | 1323 | ROM_LOAD ( "soft9-1a.rom", 0x34000, 0x4000, |
| 1324 | 1324 | CRC(cf39ac93) |
| 1325 | MD5(bcd744cdbd022cd9e2651e87792cd742) | |
| 1325 | MD5(bcd744cdbd022cd9e2651e87792cd742) | |
| 1326 | 1326 | SHA1(b97e6b7389398e5706624973c11ee7ddba323ce1) ) |
| 1327 | 1327 | ROM_LOAD ( "soft9-0b.rom", 0x38000, 0x4000, |
| 1328 | 1328 | CRC(033aee3f) |
| 1329 | MD5(1a4d3549c78328479361e867d240f285) | |
| 1329 | MD5(1a4d3549c78328479361e867d240f285) | |
| 1330 | 1330 | SHA1(f3604e500329ec0489b05dbab05530322e9463c5) ) |
| 1331 | 1331 | ROM_LOAD ( "soft9-1b.rom", 0x3c000, 0x4000, |
| 1332 | 1332 | CRC(214fe527) |
| 1333 | MD5(3dc2820fbe7b81a3936f731b44f23cbe) | |
| 1333 | MD5(3dc2820fbe7b81a3936f731b44f23cbe) | |
| 1334 | 1334 | SHA1(0d8e3f1ca347026e906c3d00a0371e8238c44a60) ) |
| 1335 | 1335 | |
| 1336 | 1336 | ROM_FLOPPY7( 0x40000 ) |
| r1461 | r1462 | |
| 1344 | 1344 | static INPUT_PORTS_START ( to9_keyboard ) |
| 1345 | 1345 | PORT_START_TAG ( "keyboard_0" ) |
| 1346 | 1346 | KEY ( 0, "F2 F7", F2 ) PORT_CHAR(UCHAR_MAMEKEY(F2)) PORT_CHAR(UCHAR_MAMEKEY(F7)) |
| 1347 | KEY ( 1, "_ 6", 6 ) PORT_CHAR('_') PORT_CHAR('6') | |
| 1348 | KEY ( 2, "Y", Y ) PORT_CHAR('Y') | |
| 1349 | KEY ( 3, "H \302\250", H ) PORT_CHAR('H') | |
| 1347 | KEY ( 1, "_ 6", 6 ) PORT_CHAR('_') PORT_CHAR('6') | |
| 1348 | KEY ( 2, "Y", Y ) PORT_CHAR('Y') | |
| 1349 | KEY ( 3, "H \302\250", H ) PORT_CHAR('H') | |
| 1350 | 1350 | KEY ( 4, "\xE2\x86\x91", UP ) PORT_CHAR(UCHAR_MAMEKEY(UP)) |
| 1351 | 1351 | KEY ( 5, "\xE2\x86\x92", RIGHT ) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) |
| 1352 | 1352 | KEY ( 6, "Home Clear", HOME ) PORT_CHAR(UCHAR_MAMEKEY(HOME)) PORT_CHAR(UCHAR_MAMEKEY(ESC)) |
| 1353 | 1353 | KEY ( 7, "N", N ) PORT_CHAR('N') |
| 1354 | 1354 | PORT_START_TAG ( "keyboard_1" ) |
| 1355 | 1355 | KEY ( 0, "F3 F8", F3 ) PORT_CHAR(UCHAR_MAMEKEY(F3)) PORT_CHAR(UCHAR_MAMEKEY(F8)) |
| 1356 | KEY ( 1, "( 5", 5 ) PORT_CHAR('(') PORT_CHAR('5') | |
| 1356 | KEY ( 1, "( 5", 5 ) PORT_CHAR('(') PORT_CHAR('5') | |
| 1357 | 1357 | KEY ( 2, "T", T ) PORT_CHAR('T') |
| 1358 | 1358 | KEY ( 3, "G", G ) PORT_CHAR('G') |
| 1359 | KEY ( 4, "= +", EQUALS ) PORT_CHAR('=') PORT_CHAR('+') | |
| 1359 | KEY ( 4, "= +", EQUALS ) PORT_CHAR('=') PORT_CHAR('+') | |
| 1360 | 1360 | KEY ( 5, "\xE2\x86\x90", LEFT ) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) |
| 1361 | 1361 | KEY ( 6, "Insert", INSERT ) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) |
| 1362 | 1362 | KEY ( 7, "B \302\264", B ) PORT_CHAR('B') |
| 1363 | 1363 | PORT_START_TAG ( "keyboard_2" ) |
| 1364 | 1364 | KEY ( 0, "F4 F9", F4 ) PORT_CHAR(UCHAR_MAMEKEY(F4)) PORT_CHAR(UCHAR_MAMEKEY(F9)) |
| 1365 | KEY ( 1, "' 4", 4 ) PORT_CHAR('\'') PORT_CHAR('4') | |
| 1365 | KEY ( 1, "' 4", 4 ) PORT_CHAR('\'') PORT_CHAR('4') | |
| 1366 | 1366 | KEY ( 2, "R", R ) PORT_CHAR('R') |
| 1367 | 1367 | KEY ( 3, "F", F ) PORT_CHAR('F') |
| 1368 | 1368 | KEY ( 4, "Accent", END ) PORT_CHAR(UCHAR_MAMEKEY(END)) |
| r1461 | r1462 | |
| 1371 | 1371 | KEY ( 7, "V", V ) PORT_CHAR('V') |
| 1372 | 1372 | PORT_START_TAG ( "keyboard_3" ) |
| 1373 | 1373 | KEY ( 0, "F5 F10", F5 ) PORT_CHAR(UCHAR_MAMEKEY(F5)) PORT_CHAR(UCHAR_MAMEKEY(F10)) |
| 1374 | KEY ( 1, "\" 3", 3 ) PORT_CHAR('"') PORT_CHAR('3') | |
| 1374 | KEY ( 1, "\" 3", 3 ) PORT_CHAR('"') PORT_CHAR('3') | |
| 1375 | 1375 | KEY ( 2, "E", E ) PORT_CHAR('E') |
| 1376 | 1376 | KEY ( 3, "D", D ) PORT_CHAR('D') |
| 1377 | 1377 | KEY ( 4, "Keypad 7", 7_PAD ) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) |
| r1461 | r1462 | |
| 1380 | 1380 | KEY ( 7, "C \136", C ) PORT_CHAR('C') |
| 1381 | 1381 | PORT_START_TAG ( "keyboard_4" ) |
| 1382 | 1382 | KEY ( 0, "F1 F6", F1 ) PORT_CHAR(UCHAR_MAMEKEY(F1)) PORT_CHAR(UCHAR_MAMEKEY(F6)) |
| 1383 | KEY ( 1, "\303\251 2", 2 ) PORT_CHAR( 0xe9 ) PORT_CHAR('2') | |
| 1383 | KEY ( 1, "\303\251 2", 2 ) PORT_CHAR( 0xe9 ) PORT_CHAR('2') | |
| 1384 | 1384 | KEY ( 2, "Z", Z ) PORT_CHAR('Z') |
| 1385 | 1385 | KEY ( 3, "S", S ) PORT_CHAR('S') |
| 1386 | 1386 | KEY ( 4, "Keypad 8", 8_PAD ) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) |
| r1461 | r1462 | |
| 1388 | 1388 | KEY ( 6, "Keypad .", DEL_PAD ) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) |
| 1389 | 1389 | KEY ( 7, "X", X ) PORT_CHAR('X') |
| 1390 | 1390 | PORT_START_TAG ( "keyboard_5" ) |
| 1391 | KEY ( 0, "# @", TILDE ) PORT_CHAR('#') PORT_CHAR('@') | |
| 1392 | KEY ( 1, "* 1", 1 ) PORT_CHAR('*') PORT_CHAR('1') | |
| 1391 | KEY ( 0, "# @", TILDE ) PORT_CHAR('#') PORT_CHAR('@') | |
| 1392 | KEY ( 1, "* 1", 1 ) PORT_CHAR('*') PORT_CHAR('1') | |
| 1393 | 1393 | KEY ( 2, "A \140", A ) PORT_CHAR('A') |
| 1394 | 1394 | KEY ( 3, "Q", Q ) PORT_CHAR('Q') |
| 1395 | KEY ( 4, "[ {", QUOTE ) PORT_CHAR('[') PORT_CHAR('{') | |
| 1395 | KEY ( 4, "[ {", QUOTE ) PORT_CHAR('[') PORT_CHAR('{') | |
| 1396 | 1396 | KEY ( 5, "Keypad 5", 5_PAD ) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) |
| 1397 | 1397 | KEY ( 6, "Keypad 6", 6_PAD ) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) |
| 1398 | 1398 | KEY ( 7, "W", W ) PORT_CHAR('W') |
| r1461 | r1462 | |
| 1404 | 1404 | KEY ( 4, "Space", SPACE ) PORT_CHAR(' ') |
| 1405 | 1405 | KEY ( 5, "Keypad 9", 9_PAD ) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) |
| 1406 | 1406 | KEY ( 6, "Keypad Enter", ENTER_PAD ) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) |
| 1407 | KEY ( 7, ", ?", COMMA ) PORT_CHAR(',') PORT_CHAR('?') | |
| 1407 | KEY ( 7, ", ?", COMMA ) PORT_CHAR(',') PORT_CHAR('?') | |
| 1408 | 1408 | PORT_START_TAG ( "keyboard_7" ) |
| 1409 | 1409 | KEY ( 0, "Control", LCONTROL ) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) |
| 1410 | KEY ( 1, "! 8", 8 ) PORT_CHAR('!') PORT_CHAR('8') | |
| 1410 | KEY ( 1, "! 8", 8 ) PORT_CHAR('!') PORT_CHAR('8') | |
| 1411 | 1411 | KEY ( 2, "I", I ) PORT_CHAR('I') |
| 1412 | 1412 | KEY ( 3, "K", K ) PORT_CHAR('K') |
| 1413 | KEY ( 4, "$ &", CLOSEBRACE ) PORT_CHAR('$') PORT_CHAR('&') | |
| 1413 | KEY ( 4, "$ &", CLOSEBRACE ) PORT_CHAR('$') PORT_CHAR('&') | |
| 1414 | 1414 | KEY ( 5, "\xE2\x86\x93", DOWN ) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) |
| 1415 | KEY ( 6, "] }", BACKSLASH ) PORT_CHAR(']') PORT_CHAR('}') | |
| 1416 | KEY ( 7, "; .", STOP ) PORT_CHAR(';') PORT_CHAR('.') | |
| 1415 | KEY ( 6, "] }", BACKSLASH ) PORT_CHAR(']') PORT_CHAR('}') | |
| 1416 | KEY ( 7, "; .", STOP ) PORT_CHAR(';') PORT_CHAR('.') | |
| 1417 | 1417 | PORT_START_TAG ( "keyboard_8" ) |
| 1418 | 1418 | KEY ( 0, "Caps-Lock", CAPSLOCK ) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) |
| 1419 | 1419 | KEY ( 1, "\303\247 9", 9 ) PORT_CHAR( 0xe7 ) PORT_CHAR('9') |
| 1420 | 1420 | KEY ( 2, "O", O ) PORT_CHAR('O') |
| 1421 | 1421 | KEY ( 3, "L", L ) PORT_CHAR('L') |
| 1422 | KEY ( 4, "- \\", BACKSPACE ) PORT_CHAR('-') PORT_CHAR('\\') | |
| 1422 | KEY ( 4, "- \\", BACKSPACE ) PORT_CHAR('-') PORT_CHAR('\\') | |
| 1423 | 1423 | KEY ( 5, "\303\271 %", COLON ) PORT_CHAR( 0xf9 ) PORT_CHAR('%') |
| 1424 | 1424 | KEY ( 6, "Enter", ENTER ) PORT_CHAR(13) |
| 1425 | KEY ( 7, ": /", SLASH ) PORT_CHAR(':') PORT_CHAR('/') | |
| 1425 | KEY ( 7, ": /", SLASH ) PORT_CHAR(':') PORT_CHAR('/') | |
| 1426 | 1426 | PORT_START_TAG ( "keyboard_9" ) |
| 1427 | 1427 | KEY ( 0, "Shift", LSHIFT ) PORT_CODE ( KEYCODE_RSHIFT ) PORT_CHAR(UCHAR_SHIFT_1) |
| 1428 | 1428 | KEY ( 1, "\303\240 0", 0 ) PORT_CHAR( 0xe0 ) PORT_CHAR('0') |
| r1461 | r1462 | |
| 1431 | 1431 | KEY ( 4, ") \302\260", MINUS ) PORT_CHAR(')') PORT_CHAR( 0xb0 ) |
| 1432 | 1432 | KEY ( 5, "\342\206\221 \302\250", OPENBRACE ) PORT_CHAR('^') PORT_CHAR( 0xa8 ) |
| 1433 | 1433 | KEY ( 6, "Keypad 3", 3_PAD ) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) |
| 1434 | KEY ( 7, "> <", BACKSLASH2 ) PORT_CHAR('>') PORT_CHAR('<') | |
| 1434 | KEY ( 7, "> <", BACKSLASH2 ) PORT_CHAR('>') PORT_CHAR('<') | |
| 1435 | 1435 | INPUT_PORTS_END |
| 1436 | 1436 | |
| 1437 | 1437 | static INPUT_PORTS_START ( to9_fconfig ) |
| r1461 | r1462 | |
| 1523 | 1523 | The TO8 was meant to replace the TO7/70 as a home-computer. |
| 1524 | 1524 | It includes and improves on the technology from the TO9 (improved video, |
| 1525 | 1525 | 256 KB of RAM fully managed by the new BASIC 512, more integrated gate-array). |
| 1526 | It has a more compact Amiga-like look, no separate keyboard, no integrated | |
| 1526 | It has a more compact Amiga-like look, no separate keyboard, no integrated | |
| 1527 | 1527 | floppy drive (although the controller is integrated), no software in ROM, |
| 1528 | 1528 | less extension slots. Also, the game & music extension is now integrated. |
| 1529 | 1529 | It is quite compatible with the TO7 and TO7/70, and with the TO9 to some |
| r1461 | r1462 | |
| 1539 | 1539 | - 2 gate-arrays (system & video, floppy controller) |
| 1540 | 1540 | |
| 1541 | 1541 | * memory: |
| 1542 | - 256 KB base RAM | |
| 1542 | - 256 KB base RAM | |
| 1543 | 1543 | + 256 KB extended RAM (EM 88-256) = 512 KB total RAM emulated |
| 1544 | 1544 | - 16 KB BIOS ROM |
| 1545 | 1545 | - 64 KB software ROM (BASIC 1, BASIC 512, extended BIOS) |
| r1461 | r1462 | |
| 1550 | 1550 | border color has its 4-th index bit inverted |
| 1551 | 1551 | |
| 1552 | 1552 | * devices: |
| 1553 | - same keyboard as T09: AZERTY 81-keys | |
| 1553 | - same keyboard as T09: AZERTY 81-keys | |
| 1554 | 1554 | (but no 6850 controller, the 6804 is directly connected to the 6821 & 6846) |
| 1555 | 1555 | - cartridge, up to 64 KB, TO7 compatible |
| 1556 | 1556 | - two-button serial mouse (TO9-incompatible) |
| r1461 | r1462 | |
| 1583 | 1583 | AM_RANGE ( 0x0000, 0x3fff ) AM_RAMBANK ( THOM_CART_BANK ) /* 8 * 16 KB */ |
| 1584 | 1584 | AM_WRITE ( to8_cartridge_w ) |
| 1585 | 1585 | AM_RANGE ( 0x4000, 0x5fff ) AM_RAMBANK ( THOM_VRAM_BANK ) |
| 1586 | AM_WRITE ( to770_vram_w ) | |
| 1586 | AM_WRITE ( to770_vram_w ) | |
| 1587 | 1587 | AM_RANGE ( 0x6000, 0x7fff ) AM_RAMBANK ( TO8_SYS_LO ) |
| 1588 | 1588 | AM_WRITE ( to8_sys_lo_w ) |
| 1589 | 1589 | AM_RANGE ( 0x8000, 0x9fff ) AM_RAMBANK ( TO8_SYS_HI ) |
| r1461 | r1462 | |
| 1598 | 1598 | AM_RANGE ( 0xe7cc, 0xe7cf ) AM_READWRITE ( pia_1_alt_r, pia_1_alt_w ) |
| 1599 | 1599 | AM_RANGE ( 0xe7d0, 0xe7d9 ) AM_READWRITE ( to8_floppy_r, to8_floppy_w ) |
| 1600 | 1600 | AM_RANGE ( 0xe7da, 0xe7dd ) AM_READWRITE ( to8_vreg_r, to8_vreg_w ) |
| 1601 | AM_RANGE ( 0xe7e4, 0xe7e7 ) AM_READWRITE ( to8_gatearray_r, | |
| 1601 | AM_RANGE ( 0xe7e4, 0xe7e7 ) AM_READWRITE ( to8_gatearray_r, | |
| 1602 | 1602 | to8_gatearray_w ) |
| 1603 | 1603 | AM_RANGE ( 0xe7e8, 0xe7eb ) AM_READWRITE ( acia_6551_r, acia_6551_w ) |
| 1604 | 1604 | /* AM_RANGE ( 0xe7f0, 0xe7f7 ) AM_READWRITE ( to9_ieee_r, to9_ieee_w ) */ |
| 1605 | 1605 | AM_RANGE ( 0xe7f2, 0xe7f3 ) AM_READWRITE ( to7_midi_r, to7_midi_w ) |
| 1606 | 1606 | AM_RANGE ( 0xe7f8, 0xe7fb ) AM_READWRITE ( pia_3_alt_r, pia_3_alt_w ) |
| 1607 | AM_RANGE ( 0xe7fe, 0xe7ff ) AM_READWRITE ( to7_modem_mea8000_r, | |
| 1607 | AM_RANGE ( 0xe7fe, 0xe7ff ) AM_READWRITE ( to7_modem_mea8000_r, | |
| 1608 | 1608 | to7_modem_mea8000_w ) |
| 1609 | 1609 | AM_RANGE ( 0xe800, 0xffff ) AM_ROMBANK ( TO8_BIOS_BANK ) /* 2 * 6 KB */ |
| 1610 | 1610 | |
| r1461 | r1462 | |
| 1626 | 1626 | /* BIOS & floppy */ |
| 1627 | 1627 | ROM_LOAD ( "to8-0.rom", 0x30000, 0x2000, |
| 1628 | 1628 | CRC(3c4a640a) |
| 1629 | MD5(97c9b803305031daf6bffa671f7667c2) | |
| 1629 | MD5(97c9b803305031daf6bffa671f7667c2) | |
| 1630 | 1630 | SHA1(0a4952f0ca002d82ac83755e1f694d56399413b2) ) |
| 1631 | 1631 | ROM_LOAD ( "to8-1.rom", 0x32000, 0x2000, |
| 1632 | 1632 | CRC(cb9bae2d) |
| 1633 | MD5(6ca0ebe022f9c433373eaed403aaf0ce) | |
| 1633 | MD5(6ca0ebe022f9c433373eaed403aaf0ce) | |
| 1634 | 1634 | SHA1(a4a55a6e2c74bca15951158c5164970e922fc1c1) ) |
| 1635 | 1635 | |
| 1636 | 1636 | /* BASIC */ |
| 1637 | 1637 | ROM_LOAD ( "basic8-0.rom", 0x20000, 0x4000, |
| 1638 | 1638 | CRC(e5a00fb3) |
| 1639 | MD5(6c33e3cd79bd6c675634b172594bbfec) | |
| 1639 | MD5(6c33e3cd79bd6c675634b172594bbfec) | |
| 1640 | 1640 | SHA1(281e535ed9b0f76e620253e9103292b8ff623d02) ) |
| 1641 | 1641 | ROM_LOAD ( "basic8-1.rom", 0x24000, 0x4000, |
| 1642 | 1642 | CRC(4b241e63) |
| 1643 | MD5(360cbf42078bf8c80a283828bf6ee4e6) | |
| 1643 | MD5(360cbf42078bf8c80a283828bf6ee4e6) | |
| 1644 | 1644 | SHA1(ca8941a10db6cc069bf84c773f5e7d7d2c18449e) ) |
| 1645 | 1645 | ROM_LOAD ( "basic8-2.rom", 0x28000, 0x4000, |
| 1646 | 1646 | CRC(0f5581b3) |
| 1647 | MD5(02279e22b8bfe29e750fb62671e3951d) | |
| 1647 | MD5(02279e22b8bfe29e750fb62671e3951d) | |
| 1648 | 1648 | SHA1(93815ca78d3532192aaa56cbf65b68b0f10f1b8a) ) |
| 1649 | 1649 | ROM_LOAD ( "basic8-3.rom", 0x2c000, 0x4000, |
| 1650 | 1650 | CRC(f552e7e3) |
| 1651 | MD5(56c1e929ef4be6771cac7157d169132f) | |
| 1651 | MD5(56c1e929ef4be6771cac7157d169132f) | |
| 1652 | 1652 | SHA1(3208e0d7d90241a327ed24e4921303f16e167bd5) ) |
| 1653 | 1653 | |
| 1654 | 1654 | ROM_FLOPPY7( 0x34000 ) |
| r1461 | r1462 | |
| 1662 | 1662 | /* BIOS & floppy */ |
| 1663 | 1663 | ROM_LOAD ( "to8d-0.rom", 0x30000, 0x2000, |
| 1664 | 1664 | CRC(30ea4950) |
| 1665 | MD5(7704c1148b8761e9ce650ef1aa7ded69) | |
| 1665 | MD5(7704c1148b8761e9ce650ef1aa7ded69) | |
| 1666 | 1666 | SHA1(6705100cd337fffb26ce999302b55fb71557b128) ) |
| 1667 | 1667 | ROM_LOAD ( "to8d-1.rom", 0x32000, 0x2000, |
| 1668 | 1668 | CRC(926cf0ca) |
| r1461 | r1462 | |
| 1765 | 1765 | |
| 1766 | 1766 | The TO9+ is the direct successor of the T09 as Thomson's high-end |
| 1767 | 1767 | product: desktop look, 512 KB of RAM, integrated floppy drive and |
| 1768 | modem. Some software integrated in ROM on the TO9 are now supplied on | |
| 1768 | modem. Some software integrated in ROM on the TO9 are now supplied on | |
| 1769 | 1769 | floppies. |
| 1770 | Internally, the TO9+ is based more on TO8 technology than T09 | |
| 1770 | Internally, the TO9+ is based more on TO8 technology than T09 | |
| 1771 | 1771 | (same gate-arrays). |
| 1772 | It has enhanced communication capabilities by integrating either the | |
| 1772 | It has enhanced communication capabilities by integrating either the | |
| 1773 | 1773 | MODEM or the RS232 extension. |
| 1774 | 1774 | It should be compatible with the TO9 and, to some extent, with the TO7, TO7/70 |
| 1775 | 1775 | and TO8. |
| r1461 | r1462 | |
| 1800 | 1800 | AM_RANGE ( 0x0000, 0x3fff ) AM_RAMBANK ( THOM_CART_BANK ) /* 8 * 16 KB */ |
| 1801 | 1801 | AM_WRITE ( to8_cartridge_w ) |
| 1802 | 1802 | AM_RANGE ( 0x4000, 0x5fff ) AM_RAMBANK ( THOM_VRAM_BANK ) |
| 1803 | AM_WRITE ( to770_vram_w ) | |
| 1803 | AM_WRITE ( to770_vram_w ) | |
| 1804 | 1804 | AM_RANGE ( 0x6000, 0x7fff ) AM_RAMBANK ( TO8_SYS_LO ) |
| 1805 | 1805 | AM_WRITE ( to8_sys_lo_w ) |
| 1806 | 1806 | AM_RANGE ( 0x8000, 0x9fff ) AM_RAMBANK ( TO8_SYS_HI ) |
| r1461 | r1462 | |
| 1816 | 1816 | AM_RANGE ( 0xe7d0, 0xe7d9 ) AM_READWRITE ( to8_floppy_r, to8_floppy_w ) |
| 1817 | 1817 | AM_RANGE ( 0xe7da, 0xe7dd ) AM_READWRITE ( to8_vreg_r, to8_vreg_w ) |
| 1818 | 1818 | AM_RANGE ( 0xe7de, 0xe7df ) AM_READWRITE ( to9_kbd_r, to9_kbd_w ) |
| 1819 | AM_RANGE ( 0xe7e4, 0xe7e7 ) AM_READWRITE ( to8_gatearray_r, | |
| 1819 | AM_RANGE ( 0xe7e4, 0xe7e7 ) AM_READWRITE ( to8_gatearray_r, | |
| 1820 | 1820 | to8_gatearray_w ) |
| 1821 | 1821 | AM_RANGE ( 0xe7e8, 0xe7eb ) AM_READWRITE ( acia_6551_r, acia_6551_w ) |
| 1822 | 1822 | /* AM_RANGE ( 0xe7f0, 0xe7f7 ) AM_READWRITE ( to9_ieee_r, to9_ieee_w ) */ |
| 1823 | 1823 | AM_RANGE ( 0xe7f2, 0xe7f3 ) AM_READWRITE ( to7_midi_r, to7_midi_w ) |
| 1824 | 1824 | AM_RANGE ( 0xe7f8, 0xe7fb ) AM_READWRITE ( pia_3_alt_r, pia_3_alt_w ) |
| 1825 | AM_RANGE ( 0xe7fe, 0xe7ff ) AM_READWRITE ( to7_modem_mea8000_r, | |
| 1825 | AM_RANGE ( 0xe7fe, 0xe7ff ) AM_READWRITE ( to7_modem_mea8000_r, | |
| 1826 | 1826 | to7_modem_mea8000_w ) |
| 1827 | 1827 | AM_RANGE ( 0xe800, 0xffff ) AM_ROMBANK ( TO8_BIOS_BANK ) /* 2 * 6 KB */ |
| 1828 | 1828 | |
| r1461 | r1462 | |
| 1854 | 1854 | /* BASIC */ |
| 1855 | 1855 | ROM_LOAD ( "basicp-0.rom", 0x20000, 0x4000, |
| 1856 | 1856 | CRC(e5a00fb3) |
| 1857 | MD5(6c33e3cd79bd6c675634b172594bbfec) | |
| 1857 | MD5(6c33e3cd79bd6c675634b172594bbfec) | |
| 1858 | 1858 | SHA1(281e535ed9b0f76e620253e9103292b8ff623d02) ) |
| 1859 | 1859 | ROM_LOAD ( "basicp-1.rom", 0x24000, 0x4000, |
| 1860 | 1860 | CRC(4b241e63) |
| r1461 | r1462 | |
| 1937 | 1937 | an MO5-compatible one |
| 1938 | 1938 | |
| 1939 | 1939 | * devices: |
| 1940 | - AZERTY keyboard, 69 keys, no keyboard controller (scanning is done | |
| 1940 | - AZERTY keyboard, 69 keys, no keyboard controller (scanning is done | |
| 1941 | 1941 | periodically by the 6809) |
| 1942 | 1942 | - MO5-compatible cartridge |
| 1943 | 1943 | - two-button mouse (TO8-like) |
| r1461 | r1462 | |
| 1961 | 1961 | |
| 1962 | 1962 | Italian version of the MO6, built by Thomson and sold by Olivetti. |
| 1963 | 1963 | Except from the ROM, it is very similar to the MO6. |
| 1964 | Do not confuse with the Olivetti Prodest PC 128 Systema (or 128s) which is | |
| 1964 | Do not confuse with the Olivetti Prodest PC 128 Systema (or 128s) which is | |
| 1965 | 1965 | based on the Acorn BBC Master Compact. Or with the Olivetti PC 1, which is |
| 1966 | 1966 | a PC XT. |
| 1967 | 1967 | |
| r1461 | r1462 | |
| 1971 | 1971 | static ADDRESS_MAP_START ( mo6, ADDRESS_SPACE_PROGRAM, 8 ) |
| 1972 | 1972 | |
| 1973 | 1973 | AM_RANGE ( 0x0000, 0x1fff ) AM_RAMBANK ( THOM_VRAM_BANK ) |
| 1974 | AM_WRITE ( to770_vram_w ) | |
| 1974 | AM_WRITE ( to770_vram_w ) | |
| 1975 | 1975 | AM_RANGE ( 0x2000, 0x3fff ) AM_RAMBANK ( TO8_SYS_LO ) |
| 1976 | 1976 | AM_WRITE ( to8_sys_lo_w ) |
| 1977 | 1977 | AM_RANGE ( 0x4000, 0x5fff ) AM_RAMBANK ( TO8_SYS_HI ) |
| r1461 | r1462 | |
| 1986 | 1986 | AM_RANGE ( 0xa7cc, 0xa7cf ) AM_READWRITE ( pia_1_alt_r, pia_1_alt_w ) |
| 1987 | 1987 | AM_RANGE ( 0xa7d0, 0xa7d9 ) AM_READWRITE ( to7_floppy_r, to7_floppy_w ) |
| 1988 | 1988 | AM_RANGE ( 0xa7da, 0xa7dd ) AM_READWRITE ( mo6_vreg_r, mo6_vreg_w ) |
| 1989 | AM_RANGE ( 0xa7e4, 0xa7e7 ) AM_READWRITE ( mo6_gatearray_r, | |
| 1989 | AM_RANGE ( 0xa7e4, 0xa7e7 ) AM_READWRITE ( mo6_gatearray_r, | |
| 1990 | 1990 | mo6_gatearray_w ) |
| 1991 | 1991 | AM_RANGE ( 0xa7e8, 0xa7eb ) AM_READWRITE ( acia_6551_r, acia_6551_w ) |
| 1992 | 1992 | /* AM_RANGE ( 0xa7f0, 0xa7f7 ) AM_READWRITE ( to9_ieee_r, to9_ieee_w )*/ |
| r1461 | r1462 | |
| 2094 | 2094 | PORT_START_TAG ( "keyboard_1" ) |
| 2095 | 2095 | KEY ( 0, "Delete Backspace", DEL ) PORT_CHAR(8) PORT_CHAR(UCHAR_MAMEKEY(BACKSPACE)) |
| 2096 | 2096 | KEY ( 1, "Insert", INSERT ) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) |
| 2097 | KEY ( 2, "> <", BACKSLASH2 ) PORT_CHAR('>') PORT_CHAR('<') | |
| 2097 | KEY ( 2, "> <", BACKSLASH2 ) PORT_CHAR('>') PORT_CHAR('<') | |
| 2098 | 2098 | KEY ( 3, "\xE2\x86\x92", RIGHT ) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) |
| 2099 | 2099 | KEY ( 4, "\xE2\x86\x93", DOWN ) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) |
| 2100 | 2100 | KEY ( 5, "\xE2\x86\x90", LEFT ) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) |
| r1461 | r1462 | |
| 2141 | 2141 | KEY ( 1, "8 !", 8 ) PORT_CHAR('8') PORT_CHAR('!') |
| 2142 | 2142 | KEY ( 2, "9 \303\247", 9 ) PORT_CHAR('9') PORT_CHAR( 0xe7 ) |
| 2143 | 2143 | KEY ( 3, "0 \303\240", 0 ) PORT_CHAR('0') PORT_CHAR( 0xe0 ) |
| 2144 | KEY ( 4, "- \\", BACKSPACE ) PORT_CHAR('-') PORT_CHAR('\\') | |
| 2145 | KEY ( 5, "= +", EQUALS ) PORT_CHAR('=') PORT_CHAR('+') | |
| 2144 | KEY ( 4, "- \\", BACKSPACE ) PORT_CHAR('-') PORT_CHAR('\\') | |
| 2145 | KEY ( 5, "= +", EQUALS ) PORT_CHAR('=') PORT_CHAR('+') | |
| 2146 | 2146 | KEY ( 6, "Accent", END ) PORT_CHAR(UCHAR_MAMEKEY(END)) |
| 2147 | 2147 | KEY ( 7, "F4 F9", F4 ) PORT_CHAR(UCHAR_MAMEKEY(F4)) PORT_CHAR(UCHAR_MAMEKEY(F9)) |
| 2148 | 2148 | PORT_START_TAG ( "keyboard_7" ) |
| r1461 | r1462 | |
| 2279 | 2279 | * chips: |
| 2280 | 2280 | - integrated MC 6854 network controller |
| 2281 | 2281 | |
| 2282 | * memory: | |
| 2282 | * memory: | |
| 2283 | 2283 | - extra 2 KB ROM for the integrated network controller, |
| 2284 | 2284 | can be masked by the ROM from the external floppy controller |
| 2285 | 2285 | |
| r1461 | r1462 | |
| 2296 | 2296 | static ADDRESS_MAP_START ( mo5nr, ADDRESS_SPACE_PROGRAM, 8 ) |
| 2297 | 2297 | |
| 2298 | 2298 | AM_RANGE ( 0x0000, 0x1fff ) AM_RAMBANK ( THOM_VRAM_BANK ) |
| 2299 | AM_WRITE ( to770_vram_w ) | |
| 2299 | AM_WRITE ( to770_vram_w ) | |
| 2300 | 2300 | AM_RANGE ( 0x2000, 0x3fff ) AM_RAMBANK ( TO8_SYS_LO ) |
| 2301 | 2301 | AM_WRITE ( to8_sys_lo_w ) |
| 2302 | 2302 | AM_RANGE ( 0x4000, 0x5fff ) AM_RAMBANK ( TO8_SYS_HI ) |
| r1461 | r1462 | |
| 2312 | 2312 | AM_RANGE ( 0xa7d0, 0xa7d9 ) AM_READWRITE ( mo5nr_net_r, mo5nr_net_w ) |
| 2313 | 2313 | AM_RANGE ( 0xa7da, 0xa7dd ) AM_READWRITE ( mo6_vreg_r, mo6_vreg_w ) |
| 2314 | 2314 | AM_RANGE ( 0xa7e0, 0xa7e3 ) AM_READWRITE ( mo5nr_prn_r, mo5nr_prn_w ) |
| 2315 | AM_RANGE ( 0xa7e4, 0xa7e7 ) AM_READWRITE ( mo6_gatearray_r, | |
| 2315 | AM_RANGE ( 0xa7e4, 0xa7e7 ) AM_READWRITE ( mo6_gatearray_r, | |
| 2316 | 2316 | mo6_gatearray_w ) |
| 2317 | 2317 | AM_RANGE ( 0xa7e8, 0xa7eb ) AM_READWRITE ( acia_6551_r, acia_6551_w ) |
| 2318 | 2318 | /* AM_RANGE ( 0xa7f0, 0xa7f7 ) AM_READWRITE ( to9_ieee_r, to9_ieee_w ) */ |
| r1461 | r1462 | |
|---|---|---|
| 95 | 95 | PORT_START /* IN4 */ |
| 96 | 96 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DEBUG OFF") PORT_CODE(KEYCODE_F6) |
| 97 | 97 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DEBUG ON") PORT_CODE(KEYCODE_F7) |
| 98 | ||
| 98 | ||
| 99 | 99 | PORT_START_TAG("WP") |
| 100 | 100 | PORT_DIPNAME(0x01, 0x01, "6532 RAM WP") |
| 101 | 101 | PORT_DIPSETTING(0x00, DEF_STR(Off)) |
| r1461 | r1462 | |
|---|---|---|
| 55 | 55 | ADDRESS_MAP_END |
| 56 | 56 | |
| 57 | 57 | static ADDRESS_MAP_START (cgenie_io, ADDRESS_SPACE_IO, 8) |
| 58 | ADDRESS_MAP_FLAGS( AMEF_ABITS(8) ) | |
| 58 | ADDRESS_MAP_FLAGS( AMEF_ABITS(8) ) | |
| 59 | 59 | AM_RANGE(0xf8, 0xf8) AM_READWRITE( cgenie_sh_control_port_r, cgenie_sh_control_port_w ) |
| 60 | 60 | AM_RANGE(0xf9, 0xf9) AM_READWRITE( cgenie_sh_data_port_r, cgenie_sh_data_port_w ) |
| 61 | 61 | AM_RANGE(0xfa, 0xfa) AM_READWRITE( cgenie_index_r, cgenie_index_w ) |
| r1461 | r1462 | |
| 220 | 220 | PORT_BIT(0x08, 0x00, IPT_BUTTON2) PORT_NAME("Joy 1 [#]") PORT_CODE(KEYCODE_SLASH_PAD) PORT_CODE(JOYCODE_BUTTON1) |
| 221 | 221 | PORT_BIT(0x10, 0x00, IPT_UNKNOWN) PORT_NAME("Joy 1 [2]") PORT_CODE(KEYCODE_2_PAD) PORT_CODE(JOYCODE_BUTTON2) |
| 222 | 222 | PORT_BIT(0x20, 0x00, IPT_UNKNOWN) PORT_NAME("Joy 1 [5]") PORT_CODE(KEYCODE_5_PAD) PORT_CODE(JOYCODE_BUTTON5) |
| 223 | PORT_BIT(0x40, 0x00, IPT_UNKNOWN) PORT_NAME("Joy 1 [8]") PORT_CODE(KEYCODE_8_PAD) | |
| 224 | PORT_BIT(0x80, 0x00, IPT_UNKNOWN) PORT_NAME("Joy 1 [0]") PORT_CODE(KEYCODE_0_PAD) | |
| 223 | PORT_BIT(0x40, 0x00, IPT_UNKNOWN) PORT_NAME("Joy 1 [8]") PORT_CODE(KEYCODE_8_PAD) | |
| 224 | PORT_BIT(0x80, 0x00, IPT_UNKNOWN) PORT_NAME("Joy 1 [0]") PORT_CODE(KEYCODE_0_PAD) | |
| 225 | 225 | PORT_START /* IN14 */ |
| 226 | 226 | PORT_BIT(0x01, 0x00, IPT_UNKNOWN) PORT_NAME("Joy 1 [1]") PORT_CODE(KEYCODE_1_PAD) PORT_CODE(JOYCODE_BUTTON3) |
| 227 | 227 | PORT_BIT(0x02, 0x00, IPT_UNKNOWN) PORT_NAME("Joy 1 [4]") PORT_CODE(KEYCODE_4_PAD) PORT_CODE(JOYCODE_BUTTON6) |
| r1461 | r1462 | |
| 229 | 229 | PORT_BIT(0x08, 0x00, IPT_BUTTON1) PORT_NAME("Joy 1 [*]") PORT_CODE(KEYCODE_ASTERISK) PORT_CODE(JOYCODE_BUTTON1) |
| 230 | 230 | PORT_BIT(0x10, 0x00, IPT_UNKNOWN) PORT_NAME("Joy 2 [3]") PORT_CODE(JOYCODE_BUTTON2) |
| 231 | 231 | PORT_BIT(0x20, 0x00, IPT_UNKNOWN) PORT_NAME("Joy 2 [6]") PORT_CODE(JOYCODE_BUTTON5) |
| 232 | PORT_BIT(0x40, 0x00, IPT_UNKNOWN) PORT_NAME("Joy 2 [9]") | |
| 232 | PORT_BIT(0x40, 0x00, IPT_UNKNOWN) PORT_NAME("Joy 2 [9]") | |
| 233 | 233 | PORT_BIT(0x80, 0x00, IPT_UNKNOWN) PORT_NAME("Joy 2 [#]") PORT_CODE(JOYCODE_BUTTON1) |
| 234 | 234 | |
| 235 | 235 | PORT_START /* IN15 */ |
| r1461 | r1462 | |
| 381 | 381 | MDRV_INTERLEAVE(4) |
| 382 | 382 | |
| 383 | 383 | MDRV_MACHINE_START( cgenie ) |
| 384 | ||
| 384 | ||
| 385 | 385 | /* video hardware */ |
| 386 | 386 | MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER) |
| 387 | 387 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| r1461 | r1462 | |
| 401 | 401 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) |
| 402 | 402 | MDRV_SOUND_ADD(AY8910, 2000000) |
| 403 | 403 | MDRV_SOUND_CONFIG(ay8910_interface) |
| 404 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75) | |
| 404 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75) | |
| 405 | 405 | MACHINE_DRIVER_END |
| 406 | 406 | |
| 407 | 407 | /*************************************************************************** |
| r1461 | r1462 | |
|---|---|---|
| 147 | 147 | I/O board |
| 148 | 148 | --------- |
| 149 | 149 | 1xxx11aa external interfaces connector (K2) |
| 150 | ||
| 150 | ||
| 151 | 151 | 0xxx11aa I/O board interfaces |
| 152 | 152 | 000111aa 8251 (casette recorder, V24) |
| 153 | 153 | 010011aa 8255 (GPIO/0, GPIO/1) |
| r1461 | r1462 | |
|---|---|---|
| 38 | 38 | PROM0-2 - Philips Semiconductors N82S129 256x4 TTL Bipolar PROM |
| 39 | 39 | PROM3-4 - Philips Semiconductors N82S131 512x4 TTL Bipolar PROM |
| 40 | 40 | 4116 - Texas Instruments TMS4116-25 16Kx1 Dynamic RAM |
| 41 | 4045 - Texas Instruments TMS4045-15 1Kx4 General Purpose Static RAM with Multiplexed I/O | |
| 42 | Z80A - | |
| 43 | Z80APIO - | |
| 41 | 4045 - Texas Instruments TMS4045-15 1Kx4 General Purpose Static RAM with Multiplexed I/O | |
| 42 | Z80A - | |
| 43 | Z80APIO - | |
| 44 | 44 | SN76477 - Texas Instruments SN76477N Complex Sound Generator |
| 45 | 45 | 74S263 - Texas Instruments SN74S263N Row Output Character Generator |
| 46 | 46 | MC1488 - Texas Instruments MC1488 Quadruple Line Driver |
| r1461 | r1462 | |
| 52 | 52 | CN5 - cassette connector |
| 53 | 53 | CN6 - keyboard connector |
| 54 | 54 | SW1 - reset switch |
| 55 | DIPSW1 - | |
| 56 | DIPSW2 - | |
| 57 | ||
| 55 | DIPSW1 - | |
| 56 | DIPSW2 - | |
| 57 | ||
| 58 | 58 | */ |
| 59 | 59 | |
| 60 | 60 | /* |
| r1461 | r1462 | |
| 122 | 122 | static const UINT8 abc80_keycodes[7*4][8] = |
| 123 | 123 | { |
| 124 | 124 | // unshift |
| 125 | { 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38 }, | |
| 126 | { 0x39, 0x30, 0x2B, 0x60, 0x3C, 0x71, 0x77, 0x65 }, | |
| 127 | { 0x72, 0x74, 0x79, 0x75, 0x69, 0x6F, 0x70, 0x7D }, | |
| 128 | { 0x7E, 0x0D, 0x61, 0x73, 0x64, 0x66, 0x67, 0x68 }, | |
| 129 | { 0x6A, 0x6B, 0x6C, 0x7C, 0x7B, 0x27, 0x08, 0x7A }, | |
| 130 | { 0x78, 0x63, 0x76, 0x62, 0x6E, 0x6D, 0x2C, 0x2E }, | |
| 125 | { 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38 }, | |
| 126 | { 0x39, 0x30, 0x2B, 0x60, 0x3C, 0x71, 0x77, 0x65 }, | |
| 127 | { 0x72, 0x74, 0x79, 0x75, 0x69, 0x6F, 0x70, 0x7D }, | |
| 128 | { 0x7E, 0x0D, 0x61, 0x73, 0x64, 0x66, 0x67, 0x68 }, | |
| 129 | { 0x6A, 0x6B, 0x6C, 0x7C, 0x7B, 0x27, 0x08, 0x7A }, | |
| 130 | { 0x78, 0x63, 0x76, 0x62, 0x6E, 0x6D, 0x2C, 0x2E }, | |
| 131 | 131 | { 0x2D, 0x09, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00 }, |
| 132 | 132 | |
| 133 | 133 | // shift |
| 134 | { 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x2f, 0x28 }, | |
| 135 | { 0x29, 0x3d, 0x3f, 0x40, 0x3e, 0x51, 0x57, 0x45 }, | |
| 136 | { 0x52, 0x54, 0x59, 0x55, 0x49, 0x4f, 0x50, 0x5d }, | |
| 137 | { 0x5e, 0x0d, 0x41, 0x53, 0x44, 0x46, 0x47, 0x48 }, | |
| 138 | { 0x4a, 0x4b, 0x4c, 0x5c, 0x5b, 0x2a, 0x08, 0x5a }, | |
| 139 | { 0x58, 0x43, 0x56, 0x42, 0x4e, 0x4d, 0x3b, 0x3a }, | |
| 140 | { 0x5f, 0x09, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00 }, | |
| 134 | { 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x2f, 0x28 }, | |
| 135 | { 0x29, 0x3d, 0x3f, 0x40, 0x3e, 0x51, 0x57, 0x45 }, | |
| 136 | { 0x52, 0x54, 0x59, 0x55, 0x49, 0x4f, 0x50, 0x5d }, | |
| 137 | { 0x5e, 0x0d, 0x41, 0x53, 0x44, 0x46, 0x47, 0x48 }, | |
| 138 | { 0x4a, 0x4b, 0x4c, 0x5c, 0x5b, 0x2a, 0x08, 0x5a }, | |
| 139 | { 0x58, 0x43, 0x56, 0x42, 0x4e, 0x4d, 0x3b, 0x3a }, | |
| 140 | { 0x5f, 0x09, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00 }, | |
| 141 | 141 | |
| 142 | 142 | // control |
| 143 | { 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38 }, | |
| 144 | { 0x39, 0x30, 0x2b, 0x00, 0x7f, 0x11, 0x17, 0x05 }, | |
| 145 | { 0x12, 0x14, 0x19, 0x15, 0x09, 0x0f, 0x10, 0x1d }, | |
| 146 | { 0x1e, 0x0d, 0x01, 0x13, 0x04, 0x06, 0x07, 0x08 }, | |
| 147 | { 0x0a, 0x0b, 0x0c, 0x1c, 0x1b, 0x27, 0x08, 0x1a }, | |
| 148 | { 0x18, 0x03, 0x16, 0x02, 0x0e, 0x0d, 0x2c, 0x2e }, | |
| 149 | { 0x2d, 0x09, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00 }, | |
| 143 | { 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38 }, | |
| 144 | { 0x39, 0x30, 0x2b, 0x00, 0x7f, 0x11, 0x17, 0x05 }, | |
| 145 | { 0x12, 0x14, 0x19, 0x15, 0x09, 0x0f, 0x10, 0x1d }, | |
| 146 | { 0x1e, 0x0d, 0x01, 0x13, 0x04, 0x06, 0x07, 0x08 }, | |
| 147 | { 0x0a, 0x0b, 0x0c, 0x1c, 0x1b, 0x27, 0x08, 0x1a }, | |
| 148 | { 0x18, 0x03, 0x16, 0x02, 0x0e, 0x0d, 0x2c, 0x2e }, | |
| 149 | { 0x2d, 0x09, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00 }, | |
| 150 | 150 | |
| 151 | 151 | // control-shift |
| 152 | { 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x2f, 0x28 }, | |
| 153 | { 0x29, 0x3d, 0x3f, 0x00, 0x7f, 0x11, 0x17, 0x05 }, | |
| 154 | { 0x12, 0x14, 0x19, 0x15, 0x09, 0x1f, 0x00, 0x1d }, | |
| 155 | { 0x1e, 0x0d, 0x01, 0x13, 0x04, 0x06, 0x07, 0x08 }, | |
| 156 | { 0x0a, 0x1b, 0x1c, 0x1c, 0x1b, 0x2a, 0x08, 0x1a }, | |
| 157 | { 0x18, 0x03, 0x16, 0x02, 0x1e, 0x1d, 0x3b, 0x3a }, | |
| 152 | { 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x2f, 0x28 }, | |
| 153 | { 0x29, 0x3d, 0x3f, 0x00, 0x7f, 0x11, 0x17, 0x05 }, | |
| 154 | { 0x12, 0x14, 0x19, 0x15, 0x09, 0x1f, 0x00, 0x1d }, | |
| 155 | { 0x1e, 0x0d, 0x01, 0x13, 0x04, 0x06, 0x07, 0x08 }, | |
| 156 | { 0x0a, 0x1b, 0x1c, 0x1c, 0x1b, 0x2a, 0x08, 0x1a }, | |
| 157 | { 0x18, 0x03, 0x16, 0x02, 0x1e, 0x1d, 0x3b, 0x3a }, | |
| 158 | 158 | { 0x5f, 0x09, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00 } |
| 159 | 159 | }; |
| 160 | 160 | |
| r1461 | r1462 | |
| 169 | 169 | { |
| 170 | 170 | table |= 0x01; |
| 171 | 171 | } |
| 172 | ||
| 172 | ||
| 173 | 173 | // ctrl |
| 174 | 174 | if (readinputport(7) & 0x08) |
| 175 | 175 | { |
| 176 | 176 | table |= 0x02; |
| 177 | 177 | } |
| 178 | ||
| 178 | ||
| 179 | 179 | for (row = 0; row < 7; row++) |
| 180 | 180 | { |
| 181 | 181 | data = readinputport(row); |
| r1461 | r1462 | |
| 191 | 191 | keycode = abc80_keycodes[row + (table * 7)][col]; |
| 192 | 192 | } |
| 193 | 193 | ibit <<= 1; |
| 194 | } | |
| 194 | } | |
| 195 | 195 | } |
| 196 | 196 | } |
| 197 | ||
| 197 | ||
| 198 | 198 | if (keycode != 0) |
| 199 | 199 | { |
| 200 | 200 | keylatch = keycode; |
| r1461 | r1462 | |
| 345 | 345 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("RIGHT SHIFT") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) |
| 346 | 346 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("UPPER CASE") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) |
| 347 | 347 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) |
| 348 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) | |
| 349 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED ) | |
| 350 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED ) | |
| 351 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED ) | |
| 348 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) | |
| 349 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED ) | |
| 350 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED ) | |
| 351 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED ) | |
| 352 | 352 | INPUT_PORTS_END |
| 353 | 353 | |
| 354 | 354 | /* Graphics Layout */ |
| r1461 | r1462 | |
| 415 | 415 | 7 R Keyboard Strobe |
| 416 | 416 | |
| 417 | 417 | PIO Channel B |
| 418 | ||
| 418 | ||
| 419 | 419 | 0 R RS-232C RxD |
| 420 | 420 | 1 R RS-232C _CTS |
| 421 | 421 | 2 R RS-232C _DCD |
| r1461 | r1462 | |
| 448 | 448 | /* Machine Drivers */ |
| 449 | 449 | |
| 450 | 450 | static MACHINE_DRIVER_START( abc80 ) |
| 451 | ||
| 451 | ||
| 452 | 452 | // basic machine hardware |
| 453 | 453 | |
| 454 | 454 | MDRV_CPU_ADD(Z80, ABC80_XTAL/2/2) // 2.9952 MHz |
| r1461 | r1462 | |
|---|---|---|
| 88 | 88 | |
| 89 | 89 | RTC : Seems to work. (Tested using SX-Windows' Timer application) |
| 90 | 90 | |
| 91 | DMA : FDD reading mostly works, other channels should work for effective memory copying (channel 2, often | |
| 91 | DMA : FDD reading mostly works, other channels should work for effective memory copying (channel 2, often | |
| 92 | 92 | used to copy data to video RAM or the palette in the background). |
| 93 | 93 | |
| 94 | 94 | Sound : FM works, ADPCM is unimplemented as yet. |
| r1461 | r1462 | |
| 100 | 100 | BG tiles and sprites work, but many games have the sprites offset by a small amount (some by a lot :)) |
| 101 | 101 | |
| 102 | 102 | Other issues: |
| 103 | Bus error exceptions are a bit late at times. Currently using a fake bus error for MIDI expansion checks. These | |
| 103 | Bus error exceptions are a bit late at times. Currently using a fake bus error for MIDI expansion checks. These | |
| 104 | 104 | are used determine if a piece of expansion hardware is present. |
| 105 | 105 | Partial updates don't work at all well, and can be excruciatingly slow. |
| 106 | 106 | Keyboard doesn't work well for games. |
| r1461 | r1462 | |
| 155 | 155 | |
| 156 | 156 | extern mame_bitmap* x68k_text_bitmap; // 1024x1024 4x1bpp planes text |
| 157 | 157 | extern mame_bitmap* x68k_gfx_0_bitmap_16; // 16 colour, 512x512, 4 pages |
| 158 | extern mame_bitmap* x68k_gfx_1_bitmap_16; | |
| 159 | extern mame_bitmap* x68k_gfx_2_bitmap_16; | |
| 160 | extern mame_bitmap* x68k_gfx_3_bitmap_16; | |
| 158 | extern mame_bitmap* x68k_gfx_1_bitmap_16; | |
| 159 | extern mame_bitmap* x68k_gfx_2_bitmap_16; | |
| 160 | extern mame_bitmap* x68k_gfx_3_bitmap_16; | |
| 161 | 161 | extern mame_bitmap* x68k_gfx_0_bitmap_256; // 256 colour, 512x512, 2 pages |
| 162 | extern mame_bitmap* x68k_gfx_1_bitmap_256; | |
| 162 | extern mame_bitmap* x68k_gfx_1_bitmap_256; | |
| 163 | 163 | extern mame_bitmap* x68k_gfx_0_bitmap_65536; // 65536 colour, 512x512, 1 page |
| 164 | 164 | |
| 165 | 165 | extern tilemap* x68k_bg0_8; // two 64x64 tilemaps, 8x8 characters |
| r1461 | r1462 | |
| 357 | 357 | /* Keyboard control commands: |
| 358 | 358 | 00xxxxxx - TV Control |
| 359 | 359 | Not of much use as yet |
| 360 | ||
| 360 | ||
| 361 | 361 | 01000xxy - y = Mouse control signal |
| 362 | ||
| 362 | ||
| 363 | 363 | 01001xxy - y = Keyboard enable |
| 364 | ||
| 364 | ||
| 365 | 365 | 010100xy - y = Sharp X1 display compatibility mode |
| 366 | ||
| 366 | ||
| 367 | 367 | 010101xx - xx = LED brightness (00 = bright, 11 = dark) |
| 368 | ||
| 368 | ||
| 369 | 369 | 010110xy - y = Display control enable |
| 370 | ||
| 371 | 010111xy - y = Display control via the Opt. 2 key enable | |
| 372 | ||
| 370 | ||
| 371 | 010111xy - y = Display control via the Opt. 2 key enable | |
| 372 | ||
| 373 | 373 | 0110xxxx - xxxx = Key delay (default 500ms) |
| 374 | 374 | 100 * (delay time) + 200ms |
| 375 | ||
| 375 | ||
| 376 | 376 | 0111xxxx - xxxx = Key repeat rate (default 110ms) |
| 377 | 377 | (repeat rate)^2*5 + 30ms |
| 378 | ||
| 378 | ||
| 379 | 379 | 1xxxxxxx - xxxxxxx = keyboard LED status |
| 380 | 380 | b6 = "full size" |
| 381 | 381 | b5 = hiragana |
| r1461 | r1462 | |
| 428 | 428 | ret = sys.keyboard.buffer[sys.keyboard.tailpos++]; |
| 429 | 429 | if(sys.keyboard.tailpos > 15) |
| 430 | 430 | sys.keyboard.tailpos = 0; |
| 431 | ||
| 431 | ||
| 432 | 432 | logerror("MFP: Keyboard buffer pop 0x%02x\n",ret); |
| 433 | 433 | return ret; |
| 434 | 434 | } |
| r1461 | r1462 | |
| 459 | 459 | int x; |
| 460 | 460 | int port = port_tag_to_index("key1"); |
| 461 | 461 | |
| 462 | for(x=0;x<0x80;x++) | |
| 463 | { | |
| 462 | for(x=0;x<0x80;x++) | |
| 463 | { | |
| 464 | 464 | // adjust delay/repeat timers |
| 465 | 465 | if(sys.keyboard.keytime[x] > 0) |
| 466 | 466 | { |
| r1461 | r1462 | |
| 521 | 521 | { |
| 522 | 522 | char val = 0; |
| 523 | 523 | char ipt = 0; |
| 524 | ||
| 524 | ||
| 525 | 525 | switch(sys.mouse.inputtype) |
| 526 | 526 | { |
| 527 | 527 | case 0: |
| r1461 | r1462 | |
| 937 | 937 | READ16_HANDLER( x68k_mfp_r ) |
| 938 | 938 | { |
| 939 | 939 | int ret; |
| 940 | // Initial settings indicate that IRQs are generated for FM (YM2151), Receive buffer error or full, | |
| 940 | // Initial settings indicate that IRQs are generated for FM (YM2151), Receive buffer error or full, | |
| 941 | 941 | // MFP Timer C, and the power switch |
| 942 | 942 | // logerror("MFP: [%08x] Reading offset %i\n",activecpu_get_pc(),offset); |
| 943 | 943 | switch(offset) |
| r1461 | r1462 | |
| 988 | 988 | return sys.mfp.rsr; |
| 989 | 989 | case 22: // TSR |
| 990 | 990 | return sys.mfp.tsr | 0x80; // buffer is typically empty? |
| 991 | case 23: | |
| 991 | case 23: | |
| 992 | 992 | return x68k_keyboard_pop_scancode(); |
| 993 | 993 | default: |
| 994 | 994 | // logerror("MFP: [%08x] Offset %i read\n",activecpu_get_pc(),offset); |
| r1461 | r1462 | |
| 1170 | 1170 | } |
| 1171 | 1171 | |
| 1172 | 1172 | static READ16_HANDLER( x68k_sram_r ) |
| 1173 | { | |
| 1173 | { | |
| 1174 | 1174 | // HACKS! |
| 1175 | 1175 | if(offset == 0x5a/2) // 0x5a should be 0 if no SASI HDs are present. |
| 1176 | 1176 | return 0x0000; |
| r1461 | r1462 | |
| 1282 | 1282 | int val = param; |
| 1283 | 1283 | |
| 1284 | 1284 | // rather hacky, but this generally works for programs that check for MIDI hardware |
| 1285 | if(mess_ram[0x09] != 0x02) // normal vector for bus errors points to 02FF0540 | |
| 1285 | if(mess_ram[0x09] != 0x02) // normal vector for bus errors points to 02FF0540 | |
| 1286 | 1286 | { |
| 1287 | 1287 | int addr = (mess_ram[0x09] << 24) | (mess_ram[0x08] << 16) |(mess_ram[0x0b] << 8) | mess_ram[0x0a]; |
| 1288 | 1288 | int sp = cpunum_get_reg(0,REG_SP); |
| r1461 | r1462 | |
| 1307 | 1307 | |
| 1308 | 1308 | static READ16_HANDLER( x68k_rom0_r ) |
| 1309 | 1309 | { |
| 1310 | /* this location contains the address of some expansion device ROM, if no ROM exists, | |
| 1310 | /* this location contains the address of some expansion device ROM, if no ROM exists, | |
| 1311 | 1311 | then access causes a bus error */ |
| 1312 | 1312 | current_vector[2] = 0x02; // bus error |
| 1313 | 1313 | current_irq_line = 2; |
| r1461 | r1462 | |
| 1317 | 1317 | |
| 1318 | 1318 | static WRITE16_HANDLER( x68k_rom0_w ) |
| 1319 | 1319 | { |
| 1320 | /* this location contains the address of some expansion device ROM, if no ROM exists, | |
| 1320 | /* this location contains the address of some expansion device ROM, if no ROM exists, | |
| 1321 | 1321 | then access causes a bus error */ |
| 1322 | 1322 | current_vector[2] = 0x02; // bus error |
| 1323 | 1323 | current_irq_line = 2; |
| r1461 | r1462 | |
| 1391 | 1391 | { |
| 1392 | 1392 | sys.mfp.gpio &= ~0x08; |
| 1393 | 1393 | } |
| 1394 | ||
| 1394 | ||
| 1395 | 1395 | } |
| 1396 | 1396 | |
| 1397 | 1397 | static READ8_HANDLER(mfp_gpio_r) |
| 1398 | 1398 | { |
| 1399 | 1399 | UINT8 data = sys.mfp.gpio; |
| 1400 | ||
| 1400 | ||
| 1401 | 1401 | data &= ~(sys.crtc.hblank << 7); |
| 1402 | 1402 | data &= ~(sys.crtc.vblank << 4); |
| 1403 | 1403 | data |= 0x23; // GPIP5 is unused, always 1 |
| r1461 | r1462 | |
| 1564 | 1564 | NULL//x68k_scc_ack |
| 1565 | 1565 | }; |
| 1566 | 1566 | |
| 1567 | static const struct rp5c15_interface rtc_intf = | |
| 1567 | static const struct rp5c15_interface rtc_intf = | |
| 1568 | 1568 | { |
| 1569 | 1569 | x68k_rtc_alarm_irq |
| 1570 | 1570 | }; |
| r1461 | r1462 | |
| 1731 | 1731 | INPUT_PORTS_END |
| 1732 | 1732 | |
| 1733 | 1733 | static void dimdsk_set_geometry(mess_image* image) |
| 1734 | { | |
| 1734 | { | |
| 1735 | 1735 | // DIM disk image header, most of this is guesswork |
| 1736 | 1736 | int tracks = 77; |
| 1737 | 1737 | int heads = 2; |
| r1461 | r1462 | |
| 1751 | 1751 | * 17 = N88-BASIC (26 sector/track, 256 bytes/sector, GAP#3 = 0x33) |
| 1752 | 1752 | * or (26 sector/track, 128 bytes/sector, GAP#3 = 0x1a) |
| 1753 | 1753 | */ |
| 1754 | image_fread(image,&format,1); | |
| 1754 | image_fread(image,&format,1); | |
| 1755 | 1755 | |
| 1756 | 1756 | switch(format) |
| 1757 | 1757 | { |
| r1461 | r1462 | |
| 1778 | 1778 | break; |
| 1779 | 1779 | } |
| 1780 | 1780 | tracks = 0; |
| 1781 | for (x=0;x<86;x++) | |
| 1781 | for (x=0;x<86;x++) | |
| 1782 | 1782 | { |
| 1783 | 1783 | image_fread(image,&temp,2); |
| 1784 | 1784 | if(temp == 0x0101) |
| r1461 | r1462 | |
| 1834 | 1834 | case DEVINFO_INT_COUNT: |
| 1835 | 1835 | info->i = 4; |
| 1836 | 1836 | break; |
| 1837 | case DEVINFO_PTR_LOAD: | |
| 1838 | info->load = device_load_x68k_floppy; | |
| 1837 | case DEVINFO_PTR_LOAD: | |
| 1838 | info->load = device_load_x68k_floppy; | |
| 1839 | 1839 | break; |
| 1840 | 1840 | case DEVINFO_PTR_UNLOAD: |
| 1841 | 1841 | info->unload = device_unload_x68k_floppy; |
| 1842 | 1842 | break; |
| 1843 | case DEVINFO_STR_FILE_EXTENSIONS: | |
| 1844 | strcpy(info->s = device_temp_str(), "xdf,hdm,2hd,dim"); | |
| 1843 | case DEVINFO_STR_FILE_EXTENSIONS: | |
| 1844 | strcpy(info->s = device_temp_str(), "xdf,hdm,2hd,dim"); | |
| 1845 | 1845 | break; |
| 1846 | 1846 | default: |
| 1847 | legacybasicdsk_device_getinfo(devclass, state, info); | |
| 1847 | legacybasicdsk_device_getinfo(devclass, state, info); | |
| 1848 | 1848 | break; |
| 1849 | 1849 | } |
| 1850 | 1850 | } |
| r1461 | r1462 | |
| 1863 | 1863 | memcpy(mess_ram,romdata,8); |
| 1864 | 1864 | |
| 1865 | 1865 | // init keyboard |
| 1866 | sys.keyboard.delay = 500; // 3*100+200 | |
| 1866 | sys.keyboard.delay = 500; // 3*100+200 | |
| 1867 | 1867 | sys.keyboard.repeat = 110; // 4^2*5+30 |
| 1868 | 1868 | |
| 1869 | 1869 | // check for disks |
| r1461 | r1462 | |
| 1895 | 1895 | sys.crtc.vblank = 1; |
| 1896 | 1896 | irq_time = video_screen_get_time_until_pos(0,sys.crtc.reg[6],2); |
| 1897 | 1897 | timer_adjust(vblank_irq,irq_time,0,attotime_never); |
| 1898 | ||
| 1898 | ||
| 1899 | 1899 | // start HBlank timer |
| 1900 | 1900 | timer_adjust(scanline_timer,video_screen_get_scan_period(0),1,attotime_never); |
| 1901 | 1901 | |
| r1461 | r1462 | |
| 1965 | 1965 | cpunum_set_irq_callback(0, x68k_int_ack); |
| 1966 | 1966 | |
| 1967 | 1967 | // init keyboard |
| 1968 | sys.keyboard.delay = 500; // 3*100+200 | |
| 1968 | sys.keyboard.delay = 500; // 3*100+200 | |
| 1969 | 1969 | sys.keyboard.repeat = 110; // 4^2*5+30 |
| 1970 | 1970 | kb_timer = timer_alloc(x68k_keyboard_poll,NULL); |
| 1971 | 1971 | scanline_timer = timer_alloc(x68k_hsync,NULL); |
| r1461 | r1462 | |
| 2035 | 2035 | ROM_SYSTEM_BIOS(0, "ipl10", "IPL-ROM V1.0") |
| 2036 | 2036 | ROMX_LOAD( "iplrom.dat", 0xfe0000, 0x20000, CRC(72bdf532) SHA1(0ed038ed2133b9f78c6e37256807424e0d927560), ROM_BIOS(1) ) |
| 2037 | 2037 | ROM_SYSTEM_BIOS(1, "ipl11", "IPL-ROM V1.1") |
| 2038 | ROMX_LOAD( "iplromxv.dat", 0xfe0000, 0x020000, CRC(00eeb408) SHA1(e33cdcdb69cd257b0b211ef46e7a8b144637db57), ROM_BIOS(2) ) | |
| 2038 | ROMX_LOAD( "iplromxv.dat", 0xfe0000, 0x020000, CRC(00eeb408) SHA1(e33cdcdb69cd257b0b211ef46e7a8b144637db57), ROM_BIOS(2) ) | |
| 2039 | 2039 | ROM_SYSTEM_BIOS(2, "ipl12", "IPL-ROM V1.2") |
| 2040 | 2040 | ROMX_LOAD( "iplromco.dat", 0xfe0000, 0x020000, CRC(6c7ef608) SHA1(77511fc58798404701f66b6bbc9cbde06596eba7), ROM_BIOS(3) ) |
| 2041 | 2041 | ROM_SYSTEM_BIOS(3, "ipl13", "IPL-ROM V1.3 (92/11/27)") |
| r1461 | r1462 | |
| 2043 | 2043 | ROM_REGION(0x8000, REGION_USER1,0) // For Background/Sprite decoding |
| 2044 | 2044 | ROM_FILL(0x0000,0x8000,0x00) |
| 2045 | 2045 | ROM_REGION(0x20000, REGION_USER2, 0) |
| 2046 | ROM_FILL(0x000,0x20000,0x00) | |
| 2046 | ROM_FILL(0x000,0x20000,0x00) | |
| 2047 | 2047 | ROM_END |
| 2048 | 2048 | |
| 2049 | 2049 |
| r1461 | r1462 | |
|---|---|---|
| 82 | 82 | Fixed problem with interrupt vector set to 0xffff (much |
| 83 | 83 | more 128k games works now). |
| 84 | 84 | A useful used trick on the Spectrum is to set |
| 85 | interrupt vector to 0xffff (using the table | |
| 85 | interrupt vector to 0xffff (using the table | |
| 86 | 86 | which contain 0xff's) and put a byte 0x18 hex, |
| 87 | 87 | the opcode for JR, at this address. The first |
| 88 | 88 | byte of the ROM is a 0xf3 (DI), so the JR will |
| r1461 | r1462 | |
| 96 | 96 | There are 50.08 frames per second for Spectrum |
| 97 | 97 | 48k what gives 69888 cycles for each frame and |
| 98 | 98 | 50.021 for Spectrum 128/+2/+2A/+3 what gives |
| 99 | 70908 cycles for each frame. | |
| 99 | 70908 cycles for each frame. | |
| 100 | 100 | Remaped some Spectrum+ keys. |
| 101 | 101 | Presing F3 to reset was seting 0xf7 on keyboard |
| 102 | 102 | input port. Problem occured for snapshots of |
| r1461 | r1462 | |
| 772 | 772 | |
| 773 | 773 | /* the following is not decoded exactly, need to check |
| 774 | 774 | what is correct! */ |
| 775 | ||
| 775 | ||
| 776 | 776 | if ((offset & 2)==0) |
| 777 | 777 | { |
| 778 | 778 | switch ((offset>>14) & 0x03) |
| r1461 | r1462 | |
| 794 | 794 | case 1: |
| 795 | 795 | spectrum_plus3_port_1ffd_w(offset, data); |
| 796 | 796 | break; |
| 797 | ||
| 797 | ||
| 798 | 798 | /* +3 fdc data */ |
| 799 | 799 | case 3: |
| 800 | 800 | spectrum_plus3_port_3ffd_w(offset,data); |
| r1461 | r1462 | |
| 819 | 819 | /* 128K AY register */ |
| 820 | 820 | case 3: |
| 821 | 821 | spectrum_128_port_fffd_w(offset, data); |
| 822 | ||
| 822 | ||
| 823 | 823 | default: |
| 824 | 824 | break; |
| 825 | 825 | } |
| r1461 | r1462 | |
| 2011 | 2011 | /* sound hardware */ |
| 2012 | 2012 | MDRV_SOUND_ADD(AY8910, 1773400) |
| 2013 | 2013 | MDRV_SOUND_CONFIG(spectrum_ay_interface) |
| 2014 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) | |
| 2014 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) | |
| 2015 | 2015 | MACHINE_DRIVER_END |
| 2016 | 2016 | |
| 2017 | 2017 |
| r1461 | r1462 | |
|---|---|---|
| 173 | 173 | (contains possible typing/printing errors so I've cited it litteraly) |
| 174 | 174 | |
| 175 | 175 | * D. Input/Output port addressing |
| 176 | * | |
| 176 | * | |
| 177 | 177 | * U96 (74LS139) is an I/O port decoder. |
| 178 | * | |
| 178 | * | |
| 179 | 179 | * IORQ A7 A6 Selected I/O Port Address |
| 180 | * | |
| 180 | * | |
| 181 | 181 | * 0 0 0 8255 00 - 03 |
| 182 | * | |
| 182 | * | |
| 183 | 183 | * 0 0 1 CTC 40 - 43 |
| 184 | * | |
| 184 | * | |
| 185 | 185 | * 0 1 0 PIO 80 - 83 |
| 186 | * | |
| 186 | * | |
| 187 | 187 | * Note; I/O port is not fully decoded, e.g. the 16 combinations |
| 188 | 188 | * 00 - 03, 04 - 07, 08 - 0B,.....3C - 3F, all select the s |
| 189 | 189 | * 8255. The CTC & PIO are also selected by 16 different |
| 190 | 190 | * combinations. |
| 191 | ||
| 191 | ||
| 192 | 192 | Where the text states ".... , all select the s ...." it probably means |
| 193 | 193 | "... ., all select the same ....". |
| 194 | ||
| 194 | ||
| 195 | 195 | So to asure that this "incompleteness" of the hardware does also exist in |
| 196 | 196 | this simulator I've expanded the port assignments accordingly. I've also |
| 197 | 197 | tested wether this is true for the actual hardware, and it is. |
| 198 | 198 | */ |
| 199 | 199 | ADDRESS_MAP_FLAGS( AMEF_ABITS(8) ) |
| 200 | ||
| 200 | ||
| 201 | 201 | // The 16 I/O port combinations for the 8255 (P8255A-5, 8628LLP, (c) 1981 AMD) |
| 202 | 202 | AM_RANGE(0x00, 0x03) AM_READWRITE(ppi8255_0_r, ppi8255_0_w) AM_MIRROR(0x3C) |
| 203 | 203 | |
| r1461 | r1462 | |
| 374 | 374 | logerror("pio irq state: %02x\n",state); |
| 375 | 375 | } |
| 376 | 376 | |
| 377 | static const z80pio_interface pio_intf = | |
| 377 | static const z80pio_interface pio_intf = | |
| 378 | 378 | { |
| 379 | 379 | mpf1_pio_interrupt, |
| 380 | 380 | NULL, |
| r1461 | r1462 | |
| 445 | 445 | F 0x04 |
| 446 | 446 | G 0x02 |
| 447 | 447 | H 0x40 (represented by P in original schematics) */ |
| 448 | ||
| 448 | ||
| 449 | 449 | /* Original bit to leddisplay-segment assignment: |
| 450 | 450 | (and as such what is written as output to this port) |
| 451 | 451 | bit 7 6 5 4 3 2 1 0 |
| r1461 | r1462 | |
| 494 | 494 | // TONE led & speaker |
| 495 | 495 | led_tone = (~data & 0x80) >> 7; |
| 496 | 496 | set_led_status(0, led_tone); |
| 497 | ||
| 497 | ||
| 498 | 498 | // speaker |
| 499 | 499 | DAC_data_w(0, 0xFF * led_tone); |
| 500 | 500 |
| r1461 | r1462 | |
|---|---|---|
| 177 | 177 | |
| 178 | 178 | static INPUT_PORTS_START( super80 ) |
| 179 | 179 | PORT_START /* line 0 */ |
| 180 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("@") PORT_CODE(KEYCODE_TILDE) | |
| 181 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) | |
| 182 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) | |
| 183 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) | |
| 184 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) | |
| 185 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) | |
| 186 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) | |
| 187 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("REPT") PORT_CODE(KEYCODE_LALT) | |
| 180 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("@") PORT_CODE(KEYCODE_TILDE) | |
| 181 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) | |
| 182 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) | |
| 183 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) | |
| 184 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) | |
| 185 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) | |
| 186 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) | |
| 187 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("REPT") PORT_CODE(KEYCODE_LALT) | |
| 188 | 188 | PORT_START /* line 1 */ |
| 189 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) | |
| 190 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) | |
| 191 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) | |
| 192 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) | |
| 193 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) | |
| 194 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(":") PORT_CODE(KEYCODE_QUOTE) | |
| 195 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BACKSPACE") PORT_CODE(KEYCODE_BACKSPACE) | |
| 196 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) | |
| 189 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) | |
| 190 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) | |
| 191 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) | |
| 192 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) | |
| 193 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) | |
| 194 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(":") PORT_CODE(KEYCODE_QUOTE) | |
| 195 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BACKSPACE") PORT_CODE(KEYCODE_BACKSPACE) | |
| 196 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) | |
| 197 | 197 | PORT_START /* line 2 */ |
| 198 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) | |
| 199 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) | |
| 200 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) | |
| 201 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) | |
| 202 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) | |
| 203 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_COLON) | |
| 204 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) | |
| 198 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) | |
| 199 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) | |
| 200 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) | |
| 201 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) | |
| 202 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) | |
| 203 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_COLON) | |
| 204 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) | |
| 205 | 205 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) |
| 206 | 206 | PORT_START /* line 3 */ |
| 207 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) | |
| 208 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) | |
| 209 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) | |
| 210 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_OPENBRACE) | |
| 211 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) | |
| 212 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) | |
| 213 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LINEFEED") PORT_CODE(KEYCODE_ENTER_PAD) | |
| 214 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) | |
| 207 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) | |
| 208 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) | |
| 209 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) | |
| 210 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_OPENBRACE) | |
| 211 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) | |
| 212 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) | |
| 213 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LINEFEED") PORT_CODE(KEYCODE_ENTER_PAD) | |
| 214 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) | |
| 215 | 215 | PORT_START /* line 4 */ |
| 216 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) | |
| 217 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) | |
| 218 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) | |
| 219 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\\")PORT_CODE(KEYCODE_BACKSLASH) | |
| 220 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) | |
| 221 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BRK") PORT_CODE(KEYCODE_NUMLOCK) | |
| 222 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) | |
| 216 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) | |
| 217 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) | |
| 218 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) | |
| 219 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\\")PORT_CODE(KEYCODE_BACKSLASH) | |
| 220 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) | |
| 221 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BRK") PORT_CODE(KEYCODE_NUMLOCK) | |
| 222 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) | |
| 223 | 223 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) |
| 224 | 224 | PORT_START /* line 5 */ |
| 225 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) | |
| 226 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) | |
| 227 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) | |
| 228 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_CLOSEBRACE) | |
| 229 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) | |
| 230 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) | |
| 231 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) | |
| 225 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) | |
| 226 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) | |
| 227 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) | |
| 228 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_CLOSEBRACE) | |
| 229 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) | |
| 230 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) | |
| 231 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) | |
| 232 | 232 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) |
| 233 | 233 | PORT_START /* line 6 */ |
| 234 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) | |
| 235 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) | |
| 236 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) | |
| 237 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("^") PORT_CODE(KEYCODE_EQUALS) | |
| 238 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) | |
| 239 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) | |
| 240 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DEL") PORT_CODE(KEYCODE_DEL) | |
| 234 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) | |
| 235 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) | |
| 236 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) | |
| 237 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("^") PORT_CODE(KEYCODE_EQUALS) | |
| 238 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) | |
| 239 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) | |
| 240 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DEL") PORT_CODE(KEYCODE_DEL) | |
| 241 | 241 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) |
| 242 | 242 | PORT_START /* line 7 */ |
| 243 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) | |
| 244 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) | |
| 245 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) | |
| 246 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) | |
| 247 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) | |
| 248 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) | |
| 249 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LOCK") PORT_CODE(KEYCODE_CAPSLOCK) | |
| 243 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) | |
| 244 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) | |
| 245 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) | |
| 246 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) | |
| 247 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) | |
| 248 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) | |
| 249 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LOCK") PORT_CODE(KEYCODE_CAPSLOCK) | |
| 250 | 250 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) |
| 251 | 251 | INPUT_PORTS_END |
| 252 | 252 |
| r1461 | r1462 | |
|---|---|---|
| 227 | 227 | fdc.dmabase = data & 0xff; |
| 228 | 228 | break; |
| 229 | 229 | } |
| 230 | ||
| 230 | ||
| 231 | 231 | fdc.dmabytes = ATARIST_FLOPPY_BYTES_PER_SECTOR; |
| 232 | 232 | } |
| 233 | 233 | |
| r1461 | r1462 | |
| 268 | 268 | static READ8_HANDLER( ikbd_port1_r ) |
| 269 | 269 | { |
| 270 | 270 | /* |
| 271 | ||
| 271 | ||
| 272 | 272 | bit description |
| 273 | ||
| 273 | ||
| 274 | 274 | 0 Keyboard column input |
| 275 | 275 | 1 Keyboard column input |
| 276 | 276 | 2 Keyboard column input |
| r1461 | r1462 | |
| 288 | 288 | static READ8_HANDLER( ikbd_port2_r ) |
| 289 | 289 | { |
| 290 | 290 | /* |
| 291 | ||
| 291 | ||
| 292 | 292 | bit description |
| 293 | ||
| 293 | ||
| 294 | 294 | 0 JOY 1-5 |
| 295 | 295 | 1 JOY 0-6 |
| 296 | 296 | 2 JOY 1-6 |
| r1461 | r1462 | |
| 305 | 305 | static WRITE8_HANDLER( ikbd_port2_w ) |
| 306 | 306 | { |
| 307 | 307 | /* |
| 308 | ||
| 308 | ||
| 309 | 309 | bit description |
| 310 | ||
| 310 | ||
| 311 | 311 | 0 JOY 1-5 |
| 312 | 312 | 1 JOY 0-6 |
| 313 | 313 | 2 JOY 1-6 |
| r1461 | r1462 | |
| 322 | 322 | static WRITE8_HANDLER( ikbd_port3_w ) |
| 323 | 323 | { |
| 324 | 324 | /* |
| 325 | ||
| 325 | ||
| 326 | 326 | bit description |
| 327 | ||
| 327 | ||
| 328 | 328 | 0 CAPS LOCK LED |
| 329 | 329 | 1 Keyboard row select |
| 330 | 330 | 2 Keyboard row select |
| r1461 | r1462 | |
| 350 | 350 | static READ8_HANDLER( ikbd_port4_r ) |
| 351 | 351 | { |
| 352 | 352 | /* |
| 353 | ||
| 353 | ||
| 354 | 354 | bit description |
| 355 | ||
| 355 | ||
| 356 | 356 | 0 JOY 0-1 or mouse XB |
| 357 | 357 | 1 JOY 0-2 or mouse XA |
| 358 | 358 | 2 JOY 0-3 or mouse YA |
| r1461 | r1462 | |
| 391 | 391 | { |
| 392 | 392 | ikbd.mouse_px = IKBD_MOUSE_PHASE_NEGATIVE; |
| 393 | 393 | } |
| 394 | ||
| 394 | ||
| 395 | 395 | if (y == ikbd.mouse_y) |
| 396 | 396 | { |
| 397 | 397 | ikbd.mouse_py = IKBD_MOUSE_PHASE_STATIC; |
| r1461 | r1462 | |
| 431 | 431 | static WRITE8_HANDLER( ikbd_port4_w ) |
| 432 | 432 | { |
| 433 | 433 | /* |
| 434 | ||
| 434 | ||
| 435 | 435 | bit description |
| 436 | ||
| 436 | ||
| 437 | 437 | 0 Keyboard row select |
| 438 | 438 | 1 Keyboard row select |
| 439 | 439 | 2 Keyboard row select |
| r1461 | r1462 | |
| 506 | 506 | } |
| 507 | 507 | } |
| 508 | 508 | } |
| 509 | ||
| 509 | ||
| 510 | 510 | if (dmasound.ctrl & 0x80) |
| 511 | 511 | { |
| 512 | 512 | // logerror("DMA sound left %i\n", dmasound.fifo[7 - dmasound.samples]); |
| r1461 | r1462 | |
| 772 | 772 | static READ16_HANDLER( stbook_config_r ) |
| 773 | 773 | { |
| 774 | 774 | /* |
| 775 | ||
| 775 | ||
| 776 | 776 | bit description |
| 777 | ||
| 777 | ||
| 778 | 778 | 0 _POWER_SWITCH |
| 779 | 779 | 1 _TOP_CLOSED |
| 780 | 780 | 2 _RTC_ALARM |
| r1461 | r1462 | |
| 800 | 800 | static WRITE16_HANDLER( stbook_lcd_control_w ) |
| 801 | 801 | { |
| 802 | 802 | /* |
| 803 | ||
| 803 | ||
| 804 | 804 | bit description |
| 805 | ||
| 805 | ||
| 806 | 806 | 0 Shadow Chip OFF |
| 807 | 807 | 1 _SHIFTER OFF |
| 808 | 808 | 2 POWEROFF |
| r1461 | r1462 | |
| 1064 | 1064 | PORT_START_TAG("P32") |
| 1065 | 1065 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F1) PORT_NAME("F1") |
| 1066 | 1066 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Left Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) |
| 1067 | PORT_BIT( 0xde, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 1067 | PORT_BIT( 0xde, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 1068 | 1068 | |
| 1069 | 1069 | PORT_START_TAG("P33") |
| 1070 | 1070 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F2) PORT_NAME("F2") |
| r1461 | r1462 | |
| 1083 | 1083 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') |
| 1084 | 1084 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') |
| 1085 | 1085 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') |
| 1086 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) | |
| 1086 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) | |
| 1087 | 1087 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') |
| 1088 | 1088 | |
| 1089 | 1089 | PORT_START_TAG("P36") |
| r1461 | r1462 | |
| 1129 | 1129 | PORT_START_TAG("P42") |
| 1130 | 1130 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F9) PORT_NAME("F9") |
| 1131 | 1131 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('=') |
| 1132 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) | |
| 1132 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) | |
| 1133 | 1133 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') |
| 1134 | 1134 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') |
| 1135 | 1135 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') |
| 1136 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) | |
| 1136 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) | |
| 1137 | 1137 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') |
| 1138 | 1138 | |
| 1139 | 1139 | PORT_START_TAG("P43") |
| 1140 | 1140 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F10) PORT_NAME("F10") |
| 1141 | 1141 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(0x00B4) PORT_CHAR('`') |
| 1142 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) | |
| 1143 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) | |
| 1144 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) | |
| 1145 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) | |
| 1146 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) | |
| 1142 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) | |
| 1143 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) | |
| 1144 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) | |
| 1145 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) | |
| 1146 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) | |
| 1147 | 1147 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Caps Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) |
| 1148 | 1148 | |
| 1149 | 1149 | PORT_START_TAG("P44") |
| r1461 | r1462 | |
| 1151 | 1151 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) |
| 1152 | 1152 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Delete") PORT_CODE(KEYCODE_DEL) |
| 1153 | 1153 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Insert") PORT_CODE(KEYCODE_INSERT) |
| 1154 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) | |
| 1154 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) | |
| 1155 | 1155 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) |
| 1156 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) | |
| 1156 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) | |
| 1157 | 1157 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('-') PORT_CHAR('_') |
| 1158 | 1158 | |
| 1159 | 1159 | PORT_START_TAG("P45") |
| r1461 | r1462 | |
| 1214 | 1214 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) |
| 1215 | 1215 | |
| 1216 | 1216 | PORT_START_TAG("IKBD_MOUSEX") |
| 1217 | PORT_BIT( 0xff, 0x00, IPT_MOUSE_X ) PORT_SENSITIVITY(100) PORT_KEYDELTA(5) PORT_MINMAX(0, 255) PORT_PLAYER(1) | |
| 1217 | PORT_BIT( 0xff, 0x00, IPT_MOUSE_X ) PORT_SENSITIVITY(100) PORT_KEYDELTA(5) PORT_MINMAX(0, 255) PORT_PLAYER(1) | |
| 1218 | 1218 | |
| 1219 | 1219 | PORT_START_TAG("IKBD_MOUSEY") |
| 1220 | PORT_BIT( 0xff, 0x00, IPT_MOUSE_Y ) PORT_SENSITIVITY(100) PORT_KEYDELTA(5) PORT_MINMAX(0, 255) PORT_PLAYER(1) | |
| 1220 | PORT_BIT( 0xff, 0x00, IPT_MOUSE_Y ) PORT_SENSITIVITY(100) PORT_KEYDELTA(5) PORT_MINMAX(0, 255) PORT_PLAYER(1) | |
| 1221 | 1221 | INPUT_PORTS_END |
| 1222 | 1222 | |
| 1223 | 1223 | static INPUT_PORTS_START( atariste ) |
| r1461 | r1462 | |
| 1299 | 1299 | { |
| 1300 | 1300 | wd17xx_set_drive(0); |
| 1301 | 1301 | } |
| 1302 | ||
| 1302 | ||
| 1303 | 1303 | if (!(data & 0x04)) |
| 1304 | 1304 | { |
| 1305 | 1305 | wd17xx_set_drive(1); |
| r1461 | r1462 | |
| 1366 | 1366 | /* |
| 1367 | 1367 | |
| 1368 | 1368 | bit description |
| 1369 | ||
| 1369 | ||
| 1370 | 1370 | 0 Centronics BUSY |
| 1371 | 1371 | 1 RS232 DCD |
| 1372 | 1372 | 2 RS232 CTS |
| r1461 | r1462 | |
| 1510 | 1510 | cpunum_set_irq_callback(0, atarist_int_ack); |
| 1511 | 1511 | } |
| 1512 | 1512 | |
| 1513 | static const struct rp5c15_interface rtc_intf = | |
| 1513 | static const struct rp5c15_interface rtc_intf = | |
| 1514 | 1514 | { |
| 1515 | 1515 | NULL |
| 1516 | 1516 | }; |
| r1461 | r1462 | |
| 1526 | 1526 | /* |
| 1527 | 1527 | |
| 1528 | 1528 | bit description |
| 1529 | ||
| 1529 | ||
| 1530 | 1530 | 0 Centronics BUSY |
| 1531 | 1531 | 1 RS232 DCD |
| 1532 | 1532 | 2 RS232 CTS |
| r1461 | r1462 | |
| 1642 | 1642 | { |
| 1643 | 1643 | wd17xx_set_drive(0); |
| 1644 | 1644 | } |
| 1645 | ||
| 1645 | ||
| 1646 | 1646 | if (!(data & 0x04)) |
| 1647 | 1647 | { |
| 1648 | 1648 | wd17xx_set_drive(1); |
| r1461 | r1462 | |
| 1684 | 1684 | /* |
| 1685 | 1685 | |
| 1686 | 1686 | bit description |
| 1687 | ||
| 1687 | ||
| 1688 | 1688 | 0 Centronics BUSY |
| 1689 | 1689 | 1 RS232 DCD |
| 1690 | 1690 | 2 RS232 CTS |
| r1461 | r1462 | |
| 1761 | 1761 | MDRV_SPEAKER_STANDARD_MONO("mono") |
| 1762 | 1762 | MDRV_SOUND_ADD(YM2149, Y2/16) |
| 1763 | 1763 | MDRV_SOUND_CONFIG(ym2149_interface) |
| 1764 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) | |
| 1764 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) | |
| 1765 | 1765 | MACHINE_DRIVER_END |
| 1766 | 1766 | |
| 1767 | 1767 | static MACHINE_DRIVER_START( megast ) |
| r1461 | r1462 | |
| 1841 | 1841 | MDRV_SPEAKER_STANDARD_MONO("mono") |
| 1842 | 1842 | MDRV_SOUND_ADD(YM3439, U517/8) |
| 1843 | 1843 | MDRV_SOUND_CONFIG(stbook_ym2149_interface) |
| 1844 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) | |
| 1844 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) | |
| 1845 | 1845 | MACHINE_DRIVER_END |
| 1846 | 1846 | |
| 1847 | 1847 | /* ROMs */ |
| r1461 | r1462 | |
| 1998 | 1998 | int sectors = bootsector[0x18]; |
| 1999 | 1999 | int heads = bootsector[0x1a]; |
| 2000 | 2000 | int tracks = (bootsector[0x13] | (bootsector[0x14] << 8)) / sectors / heads; |
| 2001 | ||
| 2001 | ||
| 2002 | 2002 | /* drive, tracks, heads, sectors per track, sector length, first sector id, offset track zero, track skipping */ |
| 2003 | 2003 | basicdsk_set_geometry(image, tracks, heads, sectors, 512, 1, 0, FALSE); |
| 2004 | 2004 | |
| r1461 | r1462 | |
| 2185 | 2185 | CONFIG_DEVICE(megaste_serial_getinfo) |
| 2186 | 2186 | CONFIG_DEVICE(atarist_cartslot_getinfo) |
| 2187 | 2187 | // MIDI |
| 2188 | // IDE Hard Disk | |
| 2188 | // IDE Hard Disk | |
| 2189 | 2189 | SYSTEM_CONFIG_END |
| 2190 | 2190 | |
| 2191 | 2191 | /* System Drivers */ |
| r1461 | r1462 | |
|---|---|---|
| 98 | 98 | address pointer is incremented when the read data and write data ports |
| 99 | 99 | are accessed, and when the second byte of the GPL address is written. A |
| 100 | 100 | weird consequence of this is the fact that GPL data is always off by one |
| 101 | byte, i.e. GPL bytes 0, 1, 2... are stored in bytes 1, 2, 3... of pages | |
| 101 | byte, i.e. GPL bytes 0, 1, 2... are stored in bytes 1, 2, 3... of pages | |
| 102 | 102 | >38->3f (byte 0 of page >38 corresponds to GPL address >ffff). |
| 103 | 103 | |
| 104 | 104 | I think that I have once read that the geneve GROM emulator does not |
| r1461 | r1462 | |
| 464 | 464 | |
| 465 | 465 | MDRV_MACHINE_START( geneve ) |
| 466 | 466 | MDRV_MACHINE_RESET( geneve ) |
| 467 | ||
| 467 | ||
| 468 | 468 | /* video hardware */ |
| 469 | 469 | MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER) |
| 470 | 470 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| r1461 | r1462 | |
|---|---|---|
| 154 | 154 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) |
| 155 | 155 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) |
| 156 | 156 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) |
| 157 | ||
| 157 | ||
| 158 | 158 | PORT_START_TAG("PB7") |
| 159 | 159 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) |
| 160 | 160 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) |
| r1461 | r1462 | |
| 423 | 423 | PA0 INT from FDC |
| 424 | 424 | PA1 BUSY from Centronics printer |
| 425 | 425 | PA2 INDEX from FDD |
| 426 | PA3 | |
| 427 | PA4 | |
| 428 | PA5 | |
| 429 | PA6 | |
| 430 | PA7 | |
| 426 | PA3 | |
| 427 | PA4 | |
| 428 | PA5 | |
| 429 | PA6 | |
| 430 | PA7 | |
| 431 | 431 | */ |
| 432 | 432 | |
| 433 | 433 | int centronics_handshake = centronics_read_handshake(1); |
| 434 | 434 | int busy = 0; |
| 435 | ||
| 435 | ||
| 436 | 436 | if ((centronics_handshake & CENTRONICS_NOT_BUSY) == 0) |
| 437 | 437 | { |
| 438 | 438 | busy = 0x02; |
| r1461 | r1462 | |
| 476 | 476 | |
| 477 | 477 | floppy_drive_set_motor_state(image_from_devtype_and_index(IO_FLOPPY, 0), (data & 0x02) ? 0 : 1); |
| 478 | 478 | floppy_drive_set_ready_state(image_from_devtype_and_index(IO_FLOPPY, 0), 1, 0); |
| 479 | ||
| 479 | ||
| 480 | 480 | nec765_set_tc_state(data & 0x04); |
| 481 | 481 | |
| 482 | 482 | if (data & 0x08) |
| r1461 | r1462 | |
| 801 | 801 | { |
| 802 | 802 | /* image, tracks, sides, sectors per track, sector length, first sector id, offset of track 0, track skipping */ |
| 803 | 803 | basicdsk_set_geometry(image, 40, 1, 16, 256, 1, 0, FALSE); |
| 804 | ||
| 804 | ||
| 805 | 805 | return INIT_PASS; |
| 806 | 806 | } |
| 807 | 807 | } |
| r1461 | r1462 | |
|---|---|---|
| 29 | 29 | * linux-2.6.6/include/asm-mips/sgi/hpc3.h |
| 30 | 30 | * NetBSD: http://www.netbsd.org/ |
| 31 | 31 | * gxemul: http://gavare.se/gxemul/ |
| 32 | * | |
| 32 | * | |
| 33 | 33 | * Gentoo LiveCD r5 boot instructions: |
| 34 | 34 | * mess -cdrom gentoor5.chd ip225015 |
| 35 | * enter the command interpreter and type "sashARCS". press enter and | |
| 35 | * enter the command interpreter and type "sashARCS". press enter and | |
| 36 | 36 | * it'll autoboot. |
| 37 | 37 | * |
| 38 | 38 | * IRIX boot instructions: |
| r1461 | r1462 | |
| 1344 | 1344 | { |
| 1345 | 1345 | UINT32 wptr, tmpword; |
| 1346 | 1346 | int words, sptr, twords; |
| 1347 | ||
| 1347 | ||
| 1348 | 1348 | words = wd33c93_get_dma_count(); |
| 1349 | 1349 | words /= 4; |
| 1350 | 1350 | |
| r1461 | r1462 | |
| 1370 | 1370 | { |
| 1371 | 1371 | tmpword = dma_buffer[sptr]<<24 | dma_buffer[sptr+1]<<16 | dma_buffer[sptr+2]<<8 | dma_buffer[sptr+3]; |
| 1372 | 1372 | } |
| 1373 | ||
| 1373 | ||
| 1374 | 1374 | program_write_dword(wptr, tmpword); |
| 1375 | 1375 | wptr += 4; |
| 1376 | 1376 | sptr += 4; |
| r1461 | r1462 | |
| 1426 | 1426 | static const SCSIConfigTable dev_table = |
| 1427 | 1427 | { |
| 1428 | 1428 | 1, /* 1 SCSI device */ |
| 1429 | { { SCSI_ID_4, 0, SCSI_DEVICE_CDROM }, /* SCSI ID 4, using CD 0, and it's a CD-ROM */ | |
| 1430 | { SCSI_ID_2, 0, SCSI_DEVICE_CDROM } } /* SCSI ID 2, using HD 0, and it's a CD-ROM */ | |
| 1429 | { { SCSI_ID_4, 0, SCSI_DEVICE_CDROM }, /* SCSI ID 4, using CD 0, and it's a CD-ROM */ | |
| 1430 | { SCSI_ID_2, 0, SCSI_DEVICE_CDROM } } /* SCSI ID 2, using HD 0, and it's a CD-ROM */ | |
| 1431 | 1431 | }; |
| 1432 | 1432 | |
| 1433 | 1433 | static const struct WD33C93interface scsi_intf = |
| r1461 | r1462 | |
|---|---|---|
| 30 | 30 | |
| 31 | 31 | Notes on emulation status and to do list: |
| 32 | 32 | ----------------------------------------- |
| 33 | 1. LIMITATION: Printer is not emulated. | |
| 33 | 1. LIMITATION: Printer is not emulated. | |
| 34 | 34 | 2. LIMITATION: Timings are not implemented, due to it emulated machine runs |
| 35 | 35 | twice fast as orginal. |
| 36 | 36 | 3. LIMITATION: .RSS files are not supported. |
| r1461 | r1462 | |
| 104 | 104 | --------- |
| 105 | 105 | Reset - connected to CPU reset line |
| 106 | 106 | |
| 107 | Port D0 | |
| 108 | --------T-------T-------T-------T-------T-------T-------T-------¬ | |
| 109 | | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | | |
| 107 | Port D0 | |
| 108 | --------T-------T-------T-------T-------T-------T-------T-------¬ | |
| 109 | | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | | |
| 110 | 110 | +-------+-------+-------+-------+-------+-------+-------+-------+---¬ |
| 111 | 111 | | Shift | ; | | CLS | Space | R | G | 6 | 0 | |
| 112 | 112 | +-------+-------+-------+-------+-------+-------+-------+-------+---+ |
| r1461 | r1462 | |
|---|---|---|
| 9 | 9 | ======== |
| 10 | 10 | input/output: |
| 11 | 11 | hd6402 uart data |
| 12 | ||
| 12 | ||
| 13 | 13 | port fd: |
| 14 | 14 | ======== |
| 15 | input: hd6402 uart status | |
| 15 | input: hd6402 uart status | |
| 16 | 16 | bit 4: parity error (RPE) |
| 17 | 17 | bit 3: framing error (RFE) |
| 18 | 18 | bit 2: over-run (RDP) |
| 19 | 19 | bit 1: data available (RDA) |
| 20 | 20 | bit 0: transmit buffer empty (TPMT) |
| 21 | 21 | |
| 22 | output: | |
| 22 | output: | |
| 23 | 23 | bit 4: no parity (NPB) |
| 24 | 24 | bit 3: parity type (POE) |
| 25 | 25 | bit 2: number of stop bits (NSB) |
| r1461 | r1462 | |
| 35 | 35 | bit 6: baud rate (1=1200, 0=300) |
| 36 | 36 | bit 5: cassette motor 2 |
| 37 | 37 | bit 4: cassette motor 1 |
| 38 | bit 3..0: keyboard line select | |
| 38 | bit 3..0: keyboard line select | |
| 39 | 39 | |
| 40 | 40 | input: |
| 41 | 41 | bit 7..6: parallel control (not emulated) |
| r1461 | r1462 | |
| 54 | 54 | interface hardware. |
| 55 | 55 | |
| 56 | 56 | The cassette interface hardware converts square-wave pulses into bits which the uart receives. |
| 57 | ||
| 58 | ||
| 57 | ||
| 58 | ||
| 59 | 59 | Sound: |
| 60 | ||
| 60 | ||
| 61 | 61 | external speaker connected to the parallel port |
| 62 | 62 | speaker is connected to all pins. All pins need to be toggled at the same time. |
| 63 | 63 | |
| 64 | ||
| 64 | ||
| 65 | 65 | Kevin Thacker [MESS driver] |
| 66 | 66 | |
| 67 | 67 | ****************************************************************************** |
| r1461 | r1462 | |
| 156 | 156 | static int cassette_clock_counter; |
| 157 | 157 | |
| 158 | 158 | /* 1. the cassette format: "frequency shift" is converted |
| 159 | into the uart data format "non-return to zero" | |
| 160 | ||
| 159 | into the uart data format "non-return to zero" | |
| 160 | ||
| 161 | 161 | 2. on cassette a 1 data bit is stored as a high frequency |
| 162 | and a 0 data bit as a low frequency | |
| 162 | and a 0 data bit as a low frequency | |
| 163 | 163 | - At 1200 baud, a logic 1 is 1 cycle of 1200hz and a logic 0 is 1/2 cycle of 600hz. |
| 164 | 164 | - At 300 baud, a logic 1 is 8 cycles of 2400hz and a logic 0 is 4 cycles of 1200hz. |
| 165 | 165 | |
| r1461 | r1462 | |
| 189 | 189 | /* previously was 0, now gone 1 */ |
| 190 | 190 | /* +ve edge detected */ |
| 191 | 191 | if (cassette_clock_state) |
| 192 | { | |
| 192 | { | |
| 193 | 193 | int bit; |
| 194 | 194 | |
| 195 | 195 | /* clock bits into cassette flip flops */ |
| r1461 | r1462 | |
| 275 | 275 | |
| 276 | 276 | serial_connection_init(&cassette_serial_connection); |
| 277 | 277 | serial_connection_set_in_callback(&cassette_serial_connection, cassette_serial_in); |
| 278 | ||
| 278 | ||
| 279 | 279 | exidy_fe_port_w(0,0); |
| 280 | 280 | |
| 281 | 281 | timer_set(attotime_zero, NULL, 0, exidy_reset_timer_callback); |
| 282 | ||
| 282 | ||
| 283 | 283 | floppy_drive_set_geometry(image_from_devtype_and_index(IO_FLOPPY, 0), FLOPPY_DRIVE_DS_80); |
| 284 | 284 | |
| 285 | 285 | /* this is temporary. Normally when a Z80 is reset, it will |
| 286 | 286 | execute address 0. The exidy starts executing from 0x0e000 */ |
| 287 | 287 | // memory_set_opbase_handler(0, exidy_opbaseoverride); |
| 288 | ||
| 288 | ||
| 289 | 289 | // cpunum_write_byte(0,0,0x0c3); |
| 290 | 290 | // cpunum_write_byte(0,1,0x000); |
| 291 | 291 | // cpunum_write_byte(0,2,0x0e0); |
| r1461 | r1462 | |
| 304 | 304 | |
| 305 | 305 | serial_connection_init(&cassette_serial_connection); |
| 306 | 306 | serial_connection_set_in_callback(&cassette_serial_connection, cassette_serial_in); |
| 307 | ||
| 307 | ||
| 308 | 308 | exidy_fe_port_w(0,0); |
| 309 | 309 | |
| 310 | 310 | timer_set(attotime_zero, NULL, 0, exidy_reset_timer_callback); |
| 311 | ||
| 311 | ||
| 312 | 312 | floppy_drive_set_geometry(image_from_devtype_and_index(IO_FLOPPY, 0), FLOPPY_DRIVE_DS_80); |
| 313 | 313 | } |
| 314 | 314 | |
| r1461 | r1462 | |
| 360 | 360 | AM_RANGE(0xbe00, 0xbe03) AM_READWRITE(exidy_wd179x_r, exidy_wd179x_w) |
| 361 | 361 | |
| 362 | 362 | AM_RANGE(0xc000, 0xefff) AM_ROM /* rom pac */ |
| 363 | AM_RANGE(0xf000, 0xf7ff) AM_RAM /* screen ram */ | |
| 363 | AM_RANGE(0xf000, 0xf7ff) AM_RAM /* screen ram */ | |
| 364 | 364 | AM_RANGE(0xf800, 0xfbff) AM_ROM /* char rom */ |
| 365 | 365 | AM_RANGE(0xfc00, 0xffff) AM_RAM /* programmable chars */ |
| 366 | 366 | ADDRESS_MAP_END |
| r1461 | r1462 | |
| 369 | 369 | ADDRESS_MAP_FLAGS( AMEF_UNMAP(1) ) |
| 370 | 370 | AM_RANGE(0x0000, 0xbfff) AM_RAM /* ram 48k diskless machine */ |
| 371 | 371 | AM_RANGE(0xc000, 0xefff) AM_ROM /* rom pac */ |
| 372 | AM_RANGE(0xf000, 0xf7ff) AM_RAM /* screen ram */ | |
| 372 | AM_RANGE(0xf000, 0xf7ff) AM_RAM /* screen ram */ | |
| 373 | 373 | AM_RANGE(0xf800, 0xfbff) AM_ROM /* char rom */ |
| 374 | 374 | AM_RANGE(0xfc00, 0xffff) AM_RAM /* programmable chars */ |
| 375 | 375 | ADDRESS_MAP_END |
| r1461 | r1462 | |
| 493 | 493 | instead of mark (-9v). Fixed in Sorcerer II. |
| 494 | 494 | 2. When you select a different baud for rs232, it was "remembered" but not |
| 495 | 495 | sent to port fe. It only gets sent when motor on was requested. Motor on is |
| 496 | only meaningful in a cassette operation. | |
| 496 | only meaningful in a cassette operation. | |
| 497 | 497 | 3. The monitor software always resets the device to cassette whenever the |
| 498 | 498 | keyboard is scanned, motors altered, or an error occurred. |
| 499 | 499 | 4. The above problems make rs232 communication impractical unless you write |
| r1461 | r1462 | |
| 638 | 638 | This fixes those games that use a joystick. */ |
| 639 | 639 | |
| 640 | 640 | UINT8 data=0x7f; |
| 641 | ||
| 641 | ||
| 642 | 642 | /* bit 7 = printer busy |
| 643 | 643 | 0 = printer is not busy */ |
| 644 | 644 | |
| r1461 | r1462 | |
| 652 | 652 | |
| 653 | 653 | |
| 654 | 654 | static ADDRESS_MAP_START( exidy_io , ADDRESS_SPACE_IO, 8) |
| 655 | ADDRESS_MAP_FLAGS( AMEF_ABITS(8) ) | |
| 655 | ADDRESS_MAP_FLAGS( AMEF_ABITS(8) ) | |
| 656 | 656 | ADDRESS_MAP_FLAGS( AMEF_UNMAP(1) ) |
| 657 | 657 | AM_RANGE(0xfc, 0xfc) AM_READWRITE( exidy_fc_port_r, exidy_fc_port_w ) |
| 658 | 658 | AM_RANGE(0xfd, 0xfd) AM_READWRITE( exidy_fd_port_r, exidy_fd_port_w ) |
| r1461 | r1462 | |
| 851 | 851 | // ROM_LOAD_OPTIONAL("exsb1-1.dat", 0x0c000, 0x0800, CRC(1dd20d80) SHA1(dd34364ca1a35caa7255b18e6c953f6df664cc74)) |
| 852 | 852 | // ROM_LOAD_OPTIONAL("exsb1-2.dat", 0x0c800, 0x0800, CRC(1068a3f8) SHA1(6395f2c9829d537d68b75a750acbf27145f1bbad)) |
| 853 | 853 | // ROM_LOAD_OPTIONAL("exsb1-3.dat", 0x0d000, 0x0800, CRC(e6332518) SHA1(fe27fccc82f86b90453c4fae55371f3a050dd6dc)) |
| 854 | // ROM_LOAD_OPTIONAL("exsb1-4.dat", 0x0d800, 0x0800, CRC(a370cb19) SHA1(75fffd897aec8c3dbe1a918f5a29485e603004cb)) | |
| 854 | // ROM_LOAD_OPTIONAL("exsb1-4.dat", 0x0d800, 0x0800, CRC(a370cb19) SHA1(75fffd897aec8c3dbe1a918f5a29485e603004cb)) | |
| 855 | 855 | ROM_END |
| 856 | 856 | |
| 857 | 857 | ROM_START(exidyd) |
| r1461 | r1462 | |
|---|---|---|
| 383 | 383 | ADDRESS_MAP_END |
| 384 | 384 | |
| 385 | 385 | static ADDRESS_MAP_START( pc88sr_io, ADDRESS_SPACE_IO, 8) |
| 386 | ADDRESS_MAP_FLAGS( AMEF_ABITS(8) ) | |
| 386 | ADDRESS_MAP_FLAGS( AMEF_ABITS(8) ) | |
| 387 | 387 | ADDRESS_MAP_FLAGS( AMEF_UNMAP(1) ) |
| 388 | 388 | AM_RANGE(0x00, 0x00) AM_READ( input_port_0_r ) /* keyboard */ |
| 389 | 389 | AM_RANGE(0x01, 0x01) AM_READ( input_port_1_r ) /* keyboard */ |
| r1461 | r1462 | |
| 453 | 453 | ADDRESS_MAP_END |
| 454 | 454 | |
| 455 | 455 | static ADDRESS_MAP_START( pc8801fd_io , ADDRESS_SPACE_IO, 8) |
| 456 | ADDRESS_MAP_FLAGS( AMEF_ABITS(8) ) | |
| 456 | ADDRESS_MAP_FLAGS( AMEF_ABITS(8) ) | |
| 457 | 457 | AM_RANGE(0xf8, 0xf8) AM_READ( pc8801fd_nec765_tc ) |
| 458 | 458 | AM_RANGE(0xfa, 0xfa) AM_READ( nec765_status_r ) |
| 459 | 459 | AM_RANGE(0xfb, 0xfb) AM_READWRITE( nec765_data_r, nec765_data_w ) |
| r1461 | r1462 | |
|---|---|---|
| 201 | 201 | beep_set_state(0, level); |
| 202 | 202 | } |
| 203 | 203 | |
| 204 | static const CDP1802_CONFIG studio2_config = | |
| 204 | static const CDP1802_CONFIG studio2_config = | |
| 205 | 205 | { |
| 206 | 206 | studio2_mode_r, |
| 207 | 207 | studio2_ef_r, |
| r1461 | r1462 | |
| 223 | 223 | return ef; |
| 224 | 224 | } |
| 225 | 225 | |
| 226 | static const CDP1802_CONFIG mpt02_config = | |
| 226 | static const CDP1802_CONFIG mpt02_config = | |
| 227 | 227 | { |
| 228 | 228 | studio2_mode_r, |
| 229 | 229 | mpt02_ef_r, |
| r1461 | r1462 | |
|---|---|---|
| 712 | 712 | AM_RANGE(0x000, 0x07f) AM_READWRITE(pcw_fdc_r, pcw_fdc_w) |
| 713 | 713 | AM_RANGE(0x080, 0x0ef) AM_READWRITE(pcw_expansion_r, pcw_expansion_w) |
| 714 | 714 | AM_RANGE(0x0f0, 0x0f3) AM_WRITE( pcw_bank_select_w) |
| 715 | AM_RANGE(0x0f4, 0x0f4) AM_READWRITE(pcw_interrupt_counter_r, pcw_bank_force_selection_w) | |
| 715 | AM_RANGE(0x0f4, 0x0f4) AM_READWRITE(pcw_interrupt_counter_r, pcw_bank_force_selection_w) | |
| 716 | 716 | AM_RANGE(0x0f5, 0x0f5) AM_WRITE( pcw_roller_ram_addr_w) |
| 717 | 717 | AM_RANGE(0x0f6, 0x0f6) AM_WRITE( pcw_pointer_table_top_scan_w) |
| 718 | 718 | AM_RANGE(0x0f7, 0x0f7) AM_WRITE( pcw_vdu_video_control_register_w) |
| r1461 | r1462 | |
| 727 | 727 | AM_RANGE(0x000, 0x07f) AM_READWRITE(pcw_fdc_r, pcw_fdc_w) |
| 728 | 728 | AM_RANGE(0x080, 0x0ef) AM_READWRITE(pcw_expansion_r, pcw_expansion_w) |
| 729 | 729 | AM_RANGE(0x0f0, 0x0f3) AM_WRITE( pcw_bank_select_w) |
| 730 | AM_RANGE(0x0f4, 0x0f4) AM_READWRITE(pcw_interrupt_counter_r, pcw_bank_force_selection_w) | |
| 730 | AM_RANGE(0x0f4, 0x0f4) AM_READWRITE(pcw_interrupt_counter_r, pcw_bank_force_selection_w) | |
| 731 | 731 | AM_RANGE(0x0f5, 0x0f5) AM_WRITE( pcw_roller_ram_addr_w) |
| 732 | 732 | AM_RANGE(0x0f6, 0x0f6) AM_WRITE( pcw_pointer_table_top_scan_w) |
| 733 | 733 | AM_RANGE(0x0f7, 0x0f7) AM_WRITE( pcw_vdu_video_control_register_w) |
| r1461 | r1462 | |
|---|---|---|
| 88 | 88 | output_set_led_value(1, mk2_led[4]&0x20?1:0); |
| 89 | 89 | output_set_led_value(2, mk2_led[4]&0x10?1:0); |
| 90 | 90 | output_set_led_value(3, mk2_led[4]&0x10?0:1); |
| 91 | ||
| 91 | ||
| 92 | 92 | mk2_led[0]= mk2_led[1]= mk2_led[2]= mk2_led[3]= mk2_led[4]= 0; |
| 93 | 93 | } |
| 94 | 94 |
| r1461 | r1462 | |
|---|---|---|
| 349 | 349 | PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_TILDE) |
| 350 | 350 | PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("1 ! BLK ORNG") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') |
| 351 | 351 | PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2 \" WHT BRN") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') |
| 352 | PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("3 # RED L GRN") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') | |
| 352 | PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("3 # RED L GRN") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') | |
| 353 | 353 | PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("4 $ CYN PINK") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') |
| 354 | 354 | PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("5 % PUR BL GRN") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') |
| 355 | 355 | PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("6 & GRN L BLU") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') |
| r1461 | r1462 | |
| 416 | 416 | PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') |
| 417 | 417 | PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("f1 f4") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) PORT_CHAR(UCHAR_MAMEKEY(F4)) |
| 418 | 418 | PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("f2 f5") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) PORT_CHAR(UCHAR_MAMEKEY(F5)) |
| 419 | PORT_START | |
| 419 | PORT_START | |
| 420 | 420 | PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("f3 f6") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) PORT_CHAR(UCHAR_MAMEKEY(F6)) |
| 421 | 421 | PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("HELP f7") PORT_CODE(KEYCODE_F4) |
| 422 | 422 | PORT_DIPNAME ( 0x2000, 0, "Swap Gameport 1 and 2") PORT_CODE(KEYCODE_NUMLOCK) |
| r1461 | r1462 | |
| 427 | 427 | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Tape Drive Play") PORT_CODE(KEYCODE_F5) |
| 428 | 428 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Tape Drive Record") PORT_CODE(KEYCODE_F6) |
| 429 | 429 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Tape Drive Stop") PORT_CODE(KEYCODE_F7) |
| 430 | PORT_START | |
| 430 | PORT_START | |
| 431 | 431 | PORT_DIPNAME ( 0x80, 0x80, "Joystick 1") |
| 432 | 432 | PORT_DIPSETTING( 0, DEF_STR( Off ) ) |
| 433 | 433 | PORT_DIPSETTING( 0x80, DEF_STR( On ) ) |
| r1461 | r1462 | |
|---|---|---|
| 55 | 55 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_TAB) PORT_CHAR(27) |
| 56 | 56 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CTRL") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_SHIFT_2) |
| 57 | 57 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("REPEAT") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') |
| 58 | ||
| 58 | ||
| 59 | 59 | PORT_START_TAG("ROW1") |
| 60 | 60 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 61 | 61 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') |
| r1461 | r1462 | |
| 65 | 65 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') |
| 66 | 66 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') |
| 67 | 67 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') |
| 68 | ||
| 68 | ||
| 69 | 69 | PORT_START_TAG("ROW2") |
| 70 | 70 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 71 | 71 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') |
| r1461 | r1462 | |
| 75 | 75 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') |
| 76 | 76 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') |
| 77 | 77 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X') |
| 78 | ||
| 78 | ||
| 79 | 79 | PORT_START_TAG("ROW3") |
| 80 | 80 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 81 | 81 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') |
| r1461 | r1462 | |
| 85 | 85 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') |
| 86 | 86 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') |
| 87 | 87 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') |
| 88 | ||
| 88 | ||
| 89 | 89 | PORT_START_TAG("ROW4") |
| 90 | 90 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 91 | 91 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') |
| r1461 | r1462 | |
| 105 | 105 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') |
| 106 | 106 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') |
| 107 | 107 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') |
| 108 | ||
| 108 | ||
| 109 | 109 | PORT_START_TAG("ROW6") |
| 110 | 110 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 111 | 111 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) |
| r1461 | r1462 | |
| 115 | 115 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') |
| 116 | 116 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') |
| 117 | 117 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') |
| 118 | ||
| 118 | ||
| 119 | 119 | PORT_START_TAG("ROW7") |
| 120 | 120 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 121 | 121 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') |
| r1461 | r1462 | |
| 236 | 236 | ROM_LOAD( "basus03.u11", 0xb000, 0x0800, CRC(ca25f8c1) SHA1(f5e8ee93a5e0656657d0cc60ef44e8a24b8b0a80) ) |
| 237 | 237 | ROM_LOAD( "basus04.u12", 0xb800, 0x0800, CRC(8ee6030e) SHA1(71f210163e4268cba2dd78a97c4d8f5dcebf980e) ) |
| 238 | 238 | ROM_LOAD( "monde01.u13", 0xf800, 0x0800, CRC(95a44d2e) SHA1(4a0241c4015b94c436d0f0f58b3dd9d5207cd847) ) |
| 239 | ||
| 239 | ||
| 240 | 240 | ROM_REGION( 0x800, REGION_GFX1,0) |
| 241 | 241 | ROM_LOAD( "chgsup2.u41", 0x0000, 0x0800, CRC(735f5e0a) SHA1(87c6271497c5b00a974d905766e91bb965180594) ) |
| 242 | 242 | ROM_END |
| r1461 | r1462 | |
|---|---|---|
| 387 | 387 | static INPUT_PORTS_START(telstrat) |
| 388 | 388 | INPUT_PORT_ORICA |
| 389 | 389 | |
| 390 | PORT_START_TAG("oric_floppy_interface") | |
| 390 | PORT_START_TAG("oric_floppy_interface") | |
| 391 | 391 | /* vsync cable hardware. This is a simple cable connected to the video output |
| 392 | 392 | to the monitor/television. The sync signal is connected to the cassette input |
| 393 | 393 | allowing interrupts to be generated from the vsync signal. */ |
| r1461 | r1462 | |
| 453 | 453 | |
| 454 | 454 | MDRV_MACHINE_START( oric ) |
| 455 | 455 | MDRV_MACHINE_RESET( oric ) |
| 456 | ||
| 456 | ||
| 457 | 457 | /* video hardware */ |
| 458 | 458 | MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER) |
| 459 | 459 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| r1461 | r1462 | |
| 472 | 472 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) |
| 473 | 473 | MDRV_SOUND_ADD(AY8910, 1000000) |
| 474 | 474 | MDRV_SOUND_CONFIG(oric_ay_interface) |
| 475 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) | |
| 475 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) | |
| 476 | 476 | MACHINE_DRIVER_END |
| 477 | 477 | |
| 478 | 478 |
| r1461 | r1462 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | ||
| 2 | ||
| 3 | 3 | IBM AT Compatibles |
| 4 | 4 | |
| 5 | 5 | ***************************************************************************/ |
| r1461 | r1462 | |
| 52 | 52 | adlib (YM3812/OPL2 chip), part of many many soundcards (soundblaster) |
| 53 | 53 | soundblaster: YM3812 also accessible at 0x228/9 (address jumperable) |
| 54 | 54 | soundblaster pro version 1: 2 YM3812 chips |
| 55 | at 0x388 both accessed, | |
| 55 | at 0x388 both accessed, | |
| 56 | 56 | at 0x220/1 left?, 0x222/3 right? (jumperable) |
| 57 | 57 | soundblaster pro version 2: 1 OPL3 chip |
| 58 | 58 | |
| r1461 | r1462 | |
| 318 | 318 | PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) |
| 319 | 319 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 320 | 320 | PORT_DIPNAME( 0x01, 0x00, "VGA 4") |
| 321 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) | |
| 321 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) | |
| 322 | 322 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 323 | 323 | |
| 324 | 324 | PORT_START /* IN1 */ |
| r1461 | r1462 | |
| 667 | 667 | ROM_REGION32_LE(0x40000, REGION_USER1, 0) |
| 668 | 668 | ROM_LOAD("wdbios.rom", 0x08000, 0x02000, CRC(8e9e2bd4) SHA1(601d7ceab282394ebab50763c267e915a6a2166a)) |
| 669 | 669 | ROM_LOAD("at586.bin", 0x20000, 0x20000, CRC(717037f5) SHA1(1d49d1b7a4a40d07d1a897b7f8c827754d76f824)) |
| 670 | ||
| 670 | ||
| 671 | 671 | ROM_REGION(0x08100, REGION_GFX1, 0) |
| 672 | 672 | ROM_LOAD("cga.chr", 0x00000, 0x01000, CRC(42009069) SHA1(ed08559ce2d7f97f68b9f540bddad5b6295294dd)) |
| 673 | 673 | ROM_END |
| r1461 | r1462 | |
|---|---|---|
| 20 | 20 | A0-BF (W) = Video Chip (TMS9928A), A0=0 -> Write Register 0 , A0=1 -> Write Register 1 |
| 21 | 21 | A0-BF (R) = Video Chip (TMS9928A), A0=0 -> Read Register 0 , A0=1 -> Read Register 1 |
| 22 | 22 | |
| 23 | C0-DF (W) = Set both controllers to joystick mode | |
| 23 | C0-DF (W) = Set both controllers to joystick mode | |
| 24 | 24 | C0-DF (R) = Not Connected |
| 25 | 25 | |
| 26 | 26 | E0-FF (W) = Sound Chip (SN76489A) |
| r1461 | r1462 | |
| 35 | 35 | |
| 36 | 36 | -Driving Controller (Expansion Module #2). It consist of a steering wheel and a gas pedal. Only one |
| 37 | 37 | can be used on a real ColecoVision. The gas pedal is not analog, internally it is just a switch. |
| 38 | On a real ColecoVision, when the Driving Controller is enabled, the controller 1 do not work because | |
| 39 | have been replaced by the Driving Controller, and controller 2 have to be used to start game, gear | |
| 38 | On a real ColecoVision, when the Driving Controller is enabled, the controller 1 do not work because | |
| 39 | have been replaced by the Driving Controller, and controller 2 have to be used to start game, gear | |
| 40 | 40 | shift, etc. |
| 41 | 41 | Driving Controller is just a spinner on controller 1 socket similar to the one on Roller Controller |
| 42 | and Super Action Controllers so you can use Roller Controller or Super Action Controllers to play | |
| 42 | and Super Action Controllers so you can use Roller Controller or Super Action Controllers to play | |
| 43 | 43 | games requiring Driving Controller. |
| 44 | ||
| 44 | ||
| 45 | 45 | -Roller Controller. Basically a trackball with four buttons (the two fire buttons from player 1 and |
| 46 | 46 | the two fire buttons from player 2). Only one Roller Controller can be used on a real ColecoVision. |
| 47 | 47 | Roller Controller is connected to both controller sockets and both controllers are conected to the Roller |
| 48 | Controller, it uses the spinner pins of both sockets to generate the X and Y signals (X from controller 1 | |
| 48 | Controller, it uses the spinner pins of both sockets to generate the X and Y signals (X from controller 1 | |
| 49 | 49 | and the Y from controller 2) |
| 50 | 50 | |
| 51 | 51 | -Super Action Controllers. It is a hand controller with a keypad, four buttons (the two from |
| r1461 | r1462 | |
| 61 | 61 | #include "devices/cartslot.h" |
| 62 | 62 | |
| 63 | 63 | READ8_HANDLER(coleco_video_r) |
| 64 | { | |
| 64 | { | |
| 65 | 65 | return ((offset & 0x01) ? TMS9928A_register_r(1) : TMS9928A_vram_r(0)); |
| 66 | 66 | } |
| 67 | 67 | |
| r1461 | r1462 | |
| 207 | 207 | else |
| 208 | 208 | JoyStat[1] = 1; |
| 209 | 209 | |
| 210 | if (JoyStat[0] || JoyStat[1]) | |
| 210 | if (JoyStat[0] || JoyStat[1]) | |
| 211 | 211 | cpunum_set_input_line(0, 0, HOLD_LINE); |
| 212 | 212 | } |
| 213 | 213 |
| r1461 | r1462 | |
|---|---|---|
| 1 | 1 | /****************************************************************************** |
| 2 | 2 | Epson EX-800 Dot Matrix printer |
| 3 | ||
| 3 | ||
| 4 | 4 | Written by Dirk Best, October 2007 |
| 5 | ||
| 5 | ||
| 6 | 6 | -- |
| 7 | ||
| 7 | ||
| 8 | 8 | Main CPU is a UPD7810H6 running at 12 MHz. |
| 9 | ||
| 9 | ||
| 10 | 10 | -- |
| 11 | ||
| 11 | ||
| 12 | 12 | On startup, the ports are initialized as follows: |
| 13 | ||
| 13 | ||
| 14 | 14 | Port A lines PA0-PA7 are configured as output |
| 15 | 15 | Port B lines PB0-PB7 are configured as output |
| 16 | 16 | Port C lines PC2, PC4 and PC5 are configured as output |
| r1461 | r1462 | |
| 20 | 20 | PC3: TI input |
| 21 | 21 | PC6: CO0 output |
| 22 | 22 | PC7: CO1 output |
| 23 | ||
| 24 | The I/O lines are connected as follows: | |
| 25 | 23 | |
| 24 | The I/O lines are connected as follows: | |
| 25 | ||
| 26 | 26 | PA0: \ |
| 27 | 27 | PA1: Carriage motor |
| 28 | 28 | PA2: driving pulses |
| r1461 | r1462 | |
| 62 | 62 | AN5: Scanner Unit, Color Home sensor |
| 63 | 63 | AN6: |
| 64 | 64 | AN7: Color Home sensor adjust |
| 65 | ||
| 66 | INT: Online switch | |
| 67 | 65 | |
| 66 | INT: Online switch | |
| 68 | 67 | |
| 68 | ||
| 69 | 69 | Gate array 5a (parallel port, printer head) |
| 70 | 70 | |
| 71 | 71 | IN0-IN7: DATA1 to DATA8 from parallel port |
| r1461 | r1462 | |
| 200 | 200 | { |
| 201 | 201 | /* Setup beep */ |
| 202 | 202 | beep_set_state(0, 0); |
| 203 | beep_set_frequency(0, 4000); /* measured at 4000 hz */ | |
| 203 | beep_set_frequency(0, 4000); /* measured at 4000 hz */ | |
| 204 | 204 | } |
| 205 | 205 | |
| 206 | 206 | |
| r1461 | r1462 | |
| 239 | 239 | { |
| 240 | 240 | if (PA6) logerror("BNK0 selected.\n"); |
| 241 | 241 | if (PA7) logerror("BNK1 selected.\n"); |
| 242 | ||
| 242 | ||
| 243 | 243 | logerror("PA W %x @%x\n", data, activecpu_get_pc()); |
| 244 | 244 | } |
| 245 | 245 | |
| r1461 | r1462 | |
| 263 | 263 | logerror("PB3 Paper empty LED on @%x\n", activecpu_get_pc()); |
| 264 | 264 | else |
| 265 | 265 | logerror("PB3 Paper empty LED off @%x\n", activecpu_get_pc()); |
| 266 | ||
| 266 | ||
| 267 | 267 | // logerror("PB W %x @%x\n", data, activecpu_get_pc()); |
| 268 | 268 | } |
| 269 | 269 | |
| r1461 | r1462 | |
| 273 | 273 | beep_set_state(0, 0); |
| 274 | 274 | else |
| 275 | 275 | beep_set_state(0, 1); |
| 276 | ||
| 276 | ||
| 277 | 277 | logerror("PC W %x @%x\n", data, activecpu_get_pc()); |
| 278 | 278 | } |
| 279 | 279 | |
| r1461 | r1462 | |
| 366 | 366 | PORT_BIT(0xfc, IP_ACTIVE_LOW, IPT_UNUSED) |
| 367 | 367 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("FORM FEED") PORT_CODE(KEYCODE_F10) |
| 368 | 368 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LINE FEED") PORT_CODE(KEYCODE_F11) |
| 369 | ||
| 369 | ||
| 370 | 370 | PORT_START_TAG("SelecType") |
| 371 | 371 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Draft") PORT_CODE(KEYCODE_F8) |
| 372 | 372 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("NLQ Roman") PORT_CODE(KEYCODE_F7) |
| r1461 | r1462 | |
| 376 | 376 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Proportional") PORT_CODE(KEYCODE_F3) |
| 377 | 377 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(DEF_STR(Normal)) PORT_CODE(KEYCODE_F2) |
| 378 | 378 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Condensed") PORT_CODE(KEYCODE_F1) |
| 379 | ||
| 379 | ||
| 380 | 380 | PORT_START_TAG("DSW_1") |
| 381 | 381 | PORT_DIPNAME(0x01, 0x00, "Condensed characters") |
| 382 | 382 | PORT_DIPSETTING( 0x00, DEF_STR(Off)) |
| r1461 | r1462 | |
| 425 | 425 | PORT_DIPSETTING( 0x00, "9600") |
| 426 | 426 | PORT_DIPSETTING( 0x40, "4800") |
| 427 | 427 | PORT_DIPSETTING( 0x80, "1200") |
| 428 | PORT_DIPSETTING( 0xc0, "300") | |
| 428 | PORT_DIPSETTING( 0xc0, "300") | |
| 429 | 429 | INPUT_PORTS_END |
| 430 | 430 | |
| 431 | 431 | |
| r1461 | r1462 | |
| 456 | 456 | MDRV_CPU_IO_MAP(ex800_io, 0) |
| 457 | 457 | |
| 458 | 458 | MDRV_MACHINE_START(ex800) |
| 459 | ||
| 459 | ||
| 460 | 460 | /* "video" hardware */ |
| 461 | 461 | MDRV_SCREEN_REFRESH_RATE(60) |
| 462 | 462 | MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION) |
| 463 | 463 | // MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER) |
| 464 | 464 | // MDRV_SCREEN_FORMAT(BITMAP_FORMAT_RGB32) |
| 465 | 465 | // MDRV_SCREEN_SIZE(480, 640) |
| 466 | // MDRV_SCREEN_VISIBLE_AREA(0, 479, 0, 639) | |
| 466 | // MDRV_SCREEN_VISIBLE_AREA(0, 479, 0, 639) | |
| 467 | 467 | // MDRV_PALETTE_LENGTH(4) |
| 468 | 468 | |
| 469 | 469 | // MDRV_VIDEO_START(ex800) |
| r1461 | r1462 | |
|---|---|---|
| 150 | 150 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON10) PORT_NAME("Toggle Windows") PORT_PLAYER(3) |
| 151 | 151 | |
| 152 | 152 | PORT_START /* IN 11 : debug input */ |
| 153 | PORT_BIT( 0x1, IP_ACTIVE_HIGH, IPT_BUTTON9) PORT_NAME("Pal prev") | |
| 154 | PORT_BIT( 0x2, IP_ACTIVE_HIGH, IPT_BUTTON10) PORT_NAME("Pal next") | |
| 153 | PORT_BIT( 0x1, IP_ACTIVE_HIGH, IPT_BUTTON9) PORT_NAME("Pal prev") | |
| 154 | PORT_BIT( 0x2, IP_ACTIVE_HIGH, IPT_BUTTON10) PORT_NAME("Pal next") | |
| 155 | 155 | PORT_BIT( 0x4, IP_ACTIVE_HIGH, IPT_BUTTON7) PORT_NAME("Toggle Transparency") PORT_PLAYER(4) |
| 156 | 156 | #endif |
| 157 | 157 | INPUT_PORTS_END |
| r1461 | r1462 | |
| 502 | 502 | MDRV_IMPORT_FROM(snes) |
| 503 | 503 | MDRV_CPU_REPLACE("main", G65816, MCLK_PAL/6) |
| 504 | 504 | |
| 505 | MDRV_SCREEN_MODIFY("main") | |
| 505 | MDRV_SCREEN_MODIFY("main") | |
| 506 | 506 | MDRV_SCREEN_RAW_PARAMS(DOTCLK_PAL, SNES_HTOTAL, 0, SNES_SCR_WIDTH, SNES_VTOTAL_PAL, 0, SNES_SCR_HEIGHT_PAL) |
| 507 | 507 | MACHINE_DRIVER_END |
| 508 | 508 |
| r1461 | r1462 | |
|---|---|---|
| 432 | 432 | { |
| 433 | 433 | int i, cnt = 0, tmp, res = 0; |
| 434 | 434 | |
| 435 | while (num > 0) | |
| 435 | while (num > 0) | |
| 436 | 436 | { |
| 437 | 437 | tmp = num; |
| 438 | 438 | while (tmp >= 10) tmp %= 10; |
| r1461 | r1462 | |
| 507 | 507 | if (offset == 0x77)//PDR2 read |
| 508 | 508 | return_data= 0xff; // | EEPROM_read_bit()); |
| 509 | 509 | |
| 510 | if (offset == 0x33) return_data = saturn_region; | |
| 510 | if (offset == 0x33) return_data = saturn_region; | |
| 511 | 511 | |
| 512 | 512 | // if (LOG_SMPC) logerror ("cpu #%d (PC=%08X) SMPC: Read from Byte Offset %02x (%d) Returns %02x\n", cpu_getactivecpu(), activecpu_get_pc(), offset, offset>>1, return_data); |
| 513 | 513 | |
| r1461 | r1462 | |
| 532 | 532 | if ((intback_stage > 0) && (offset == 1) && (((data ^ 0x80)&0x80) == (last&0x80))) |
| 533 | 533 | { |
| 534 | 534 | // if (LOG_SMPC) logerror("SMPC: CONTINUE request, stage %d\n", intback_stage); |
| 535 | if (intback_stage != 3) | |
| 535 | if (intback_stage != 3) | |
| 536 | 536 | { |
| 537 | 537 | intback_stage = 2; |
| 538 | 538 | } |
| r1461 | r1462 | |
| 1911 | 1911 | |
| 1912 | 1912 | static NVRAM_HANDLER(saturn) |
| 1913 | 1913 | { |
| 1914 | static UINT32 init[8] = | |
| 1914 | static UINT32 init[8] = | |
| 1915 | 1915 | { |
| 1916 | 1916 | 0x420061, 0x63006b, 0x550070, 0x520061, 0x6d0020, 0x46006f, 0x72006d, 0x610074, |
| 1917 | 1917 | }; |
| r1461 | r1462 | |
|---|---|---|
| 270 | 270 | static READ8_HANDLER( zx8302_status_r ) |
| 271 | 271 | { |
| 272 | 272 | /* |
| 273 | ||
| 273 | ||
| 274 | 274 | bit description |
| 275 | ||
| 275 | ||
| 276 | 276 | 0 Network port |
| 277 | 277 | 1 Transmit buffer full |
| 278 | 278 | 2 Receive buffer full |
| r1461 | r1462 | |
| 283 | 283 | 7 Latched COMDATA |
| 284 | 284 | |
| 285 | 285 | */ |
| 286 | ||
| 287 | UINT8 data = 0; | |
| 288 | 286 | |
| 287 | UINT8 data = 0; | |
| 288 | ||
| 289 | 289 | data |= zx8302.comdata_l << 7; |
| 290 | 290 | data |= zx8302.comctl << 6; |
| 291 | 291 | data |= zx8302.ser1_cts << 5; |
| r1461 | r1462 | |
| 326 | 326 | static WRITE8_HANDLER( zx8302_mdv_control_w ) |
| 327 | 327 | { |
| 328 | 328 | /* |
| 329 | ||
| 329 | ||
| 330 | 330 | bit description |
| 331 | ||
| 331 | ||
| 332 | 332 | 0 MDSELDH |
| 333 | 333 | 1 MDSELCKH |
| 334 | 334 | 2 MDRDWL |
| 335 | 335 | 3 ERASE |
| 336 | 4 | |
| 337 | 5 | |
| 338 | 6 | |
| 339 | 7 | |
| 336 | 4 | |
| 337 | 5 | |
| 338 | 6 | |
| 339 | 7 | |
| 340 | 340 | |
| 341 | 341 | */ |
| 342 | 342 | |
| r1461 | r1462 | |
| 444 | 444 | static WRITE8_HANDLER( ipc_port1_w ) |
| 445 | 445 | { |
| 446 | 446 | /* |
| 447 | ||
| 447 | ||
| 448 | 448 | bit description |
| 449 | ||
| 449 | ||
| 450 | 450 | 0 Keyboard column output (KBO0) |
| 451 | 451 | 1 Keyboard column output (KBO1) |
| 452 | 452 | 2 Keyboard column output (KBO2) |
| r1461 | r1462 | |
| 464 | 464 | static WRITE8_HANDLER( ipc_port2_w ) |
| 465 | 465 | { |
| 466 | 466 | /* |
| 467 | ||
| 467 | ||
| 468 | 468 | bit description |
| 469 | ||
| 469 | ||
| 470 | 470 | 0 Serial data input (SER2 RxD, SER1 TxD) |
| 471 | 471 | 1 Speaker output |
| 472 | 472 | 2 Interrupt output (IPL0-2) |
| r1461 | r1462 | |
| 520 | 520 | static READ8_HANDLER( ipc_port2_r ) |
| 521 | 521 | { |
| 522 | 522 | /* |
| 523 | ||
| 523 | ||
| 524 | 524 | bit description |
| 525 | ||
| 525 | ||
| 526 | 526 | 0 Serial data input (SER2 RxD, SER1 TxD) |
| 527 | 527 | 1 Speaker output |
| 528 | 528 | 2 Interrupt output (IPL0-2) |
| r1461 | r1462 | |
| 549 | 549 | static READ8_HANDLER( ipc_bus_r ) |
| 550 | 550 | { |
| 551 | 551 | /* |
| 552 | ||
| 552 | ||
| 553 | 553 | bit description |
| 554 | ||
| 554 | ||
| 555 | 555 | 0 Keyboard row input (KBI0) |
| 556 | 556 | 1 Keyboard row input (KBI1) |
| 557 | 557 | 2 Keyboard row input (KBI2) |
| r1461 | r1462 | |
| 631 | 631 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) PORT_NAME("ESC @") PORT_CHAR('\x1b') PORT_CHAR('@') |
| 632 | 632 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) PORT_NAME("\xe2\x86\x92") |
| 633 | 633 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') |
| 634 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') PORT_NAME("SPACE") | |
| 634 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') PORT_NAME("SPACE") | |
| 635 | 635 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) PORT_NAME("\xe2\x86\x93") |
| 636 | 636 | |
| 637 | 637 | PORT_START_TAG("ROW2") |
| r1461 | r1462 | |
| 766 | 766 | |
| 767 | 767 | PORT_MODIFY("ROW4") |
| 768 | 768 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_NAME("3 \xc2\xa3") PORT_CHAR('3') PORT_CHAR(0xa7) // 3 £ |
| 769 | ||
| 769 | ||
| 770 | 770 | PORT_MODIFY("ROW5") |
| 771 | 771 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') |
| 772 | 772 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_NAME("\xc3\x9f ?") PORT_CHAR(0xdf) PORT_CHAR('?') // ß ? |
| r1461 | r1462 | |
| 808 | 808 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') |
| 809 | 809 | |
| 810 | 810 | PORT_MODIFY("ROW4") |
| 811 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('"') PORT_CHAR('3') | |
| 811 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('"') PORT_CHAR('3') | |
| 812 | 812 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('#') PORT_CHAR('1') |
| 813 | 813 | |
| 814 | 814 | PORT_MODIFY("ROW5") |
| r1461 | r1462 | |
|---|---|---|
| 668 | 668 | static MACHINE_START( abc802 ) |
| 669 | 669 | { |
| 670 | 670 | machine_start_abc800(machine); |
| 671 | ||
| 671 | ||
| 672 | 672 | z80dart_init(0, &abc802_dart_intf); |
| 673 | 673 | |
| 674 | 674 | memory_configure_bank(1, 0, 1, memory_region(REGION_CPU1), 0); |
| r1461 | r1462 | |
| 683 | 683 | static MACHINE_START( abc806 ) |
| 684 | 684 | { |
| 685 | 685 | machine_start_abc800(machine); |
| 686 | ||
| 686 | ||
| 687 | 687 | memory_configure_bank(1, 0, 1, memory_region(REGION_CPU1), 0); |
| 688 | 688 | memory_configure_bank(1, 1, 1, mess_ram, 0); |
| 689 | 689 | } |
| r1461 | r1462 | |
| 726 | 726 | |
| 727 | 727 | static MACHINE_DRIVER_START( abc800c ) |
| 728 | 728 | MDRV_IMPORT_FROM(abc800m) |
| 729 | ||
| 729 | ||
| 730 | 730 | MDRV_SCREEN_SIZE(40*6, 24*10) |
| 731 | 731 | MDRV_SCREEN_VISIBLE_AREA(0, 40*6-1, 0, 24*10-1) |
| 732 | 732 | MDRV_PALETTE_LENGTH(8) |
| r1461 | r1462 | |
| 741 | 741 | MDRV_CPU_PROGRAM_MAP(abc802_map, 0) |
| 742 | 742 | MDRV_CPU_IO_MAP(abc802_io_map, 0) |
| 743 | 743 | MDRV_CPU_VBLANK_INT(abc802_vblank_interrupt, 1) |
| 744 | ||
| 744 | ||
| 745 | 745 | MDRV_MACHINE_START(abc802) |
| 746 | 746 | MDRV_MACHINE_RESET(abc802) |
| 747 | 747 | |
| r1461 | r1462 | |
| 756 | 756 | MDRV_CPU_MODIFY("main") |
| 757 | 757 | MDRV_CPU_PROGRAM_MAP(abc806_map, 0) |
| 758 | 758 | MDRV_CPU_IO_MAP(abc806_io_map, 0) |
| 759 | ||
| 759 | ||
| 760 | 760 | MDRV_MACHINE_START(abc806) |
| 761 | 761 | MDRV_MACHINE_RESET(abc806) |
| 762 | 762 | MACHINE_DRIVER_END |
| r1461 | r1462 | |
|---|---|---|
| 284 | 284 | /* Machine Drivers */ |
| 285 | 285 | |
| 286 | 286 | static MACHINE_DRIVER_START( tmc1800 ) |
| 287 | ||
| 287 | ||
| 288 | 288 | // basic system hardware |
| 289 | 289 | |
| 290 | 290 | MDRV_CPU_ADD(CDP1802, 1750000) // 1.75 MHz |
| r1461 | r1462 | |
| 308 | 308 | MACHINE_DRIVER_END |
| 309 | 309 | |
| 310 | 310 | static MACHINE_DRIVER_START( tmc2000 ) |
| 311 | ||
| 311 | ||
| 312 | 312 | // basic system hardware |
| 313 | 313 | |
| 314 | 314 | MDRV_CPU_ADD(CDP1802, CDP1864_CLK_FREQ) // 1.75 MHz |
| r1461 | r1462 | |
|---|---|---|
| 31 | 31 | /* Input Ports */ |
| 32 | 32 | |
| 33 | 33 | static INPUT_PORTS_START( crvision ) |
| 34 | ||
| 34 | ||
| 35 | 35 | // Player 1 Joystick |
| 36 | 36 | |
| 37 | 37 | PORT_START_TAG("PA0-0") |
| r1461 | r1462 | |
| 246 | 246 | int i; |
| 247 | 247 | UINT8 value; |
| 248 | 248 | char portname[10]; |
| 249 | ||
| 249 | ||
| 250 | 250 | for (i = 0; i < 8; i++) |
| 251 | 251 | { |
| 252 | 252 | sprintf(portname, "PA%u-%u", pa, i); |
| 253 | 253 | value = readinputportbytag(portname); |
| 254 | ||
| 254 | ||
| 255 | 255 | if (value != 0xff) |
| 256 | 256 | { |
| 257 | 257 | if (value == 0xff - (1 << i)) |
| r1461 | r1462 | |
| 353 | 353 | */ |
| 354 | 354 | |
| 355 | 355 | SN76496_0_w(0, data); |
| 356 | ||
| 356 | ||
| 357 | 357 | sn76489_ready = 0; |
| 358 | 358 | |
| 359 | 359 | // wait 32 cycles of 2 MHz to synchronize CPU and SN76489 |
| 360 | timer_set(ATTOTIME_IN_USEC(16), NULL, 0, sn76489_set_ready); | |
| 360 | timer_set(ATTOTIME_IN_USEC(16), NULL, 0, sn76489_set_ready); | |
| 361 | 361 | } |
| 362 | 362 | |
| 363 | 363 | static WRITE8_HANDLER( pia_cb2_w ) |
| r1461 | r1462 | |
|---|---|---|
| 69 | 69 | |
| 70 | 70 | /* port i/o functions */ |
| 71 | 71 | static ADDRESS_MAP_START( nascom1_io , ADDRESS_SPACE_IO, 8) |
| 72 | ADDRESS_MAP_FLAGS( AMEF_ABITS(8) ) | |
| 72 | ADDRESS_MAP_FLAGS( AMEF_ABITS(8) ) | |
| 73 | 73 | AM_RANGE(0x00, 0x00) AM_READWRITE( nascom1_port_00_r, nascom1_port_00_w ) |
| 74 | 74 | AM_RANGE(0x01, 0x01) AM_READWRITE( nascom1_port_01_r, nascom1_port_01_w ) |
| 75 | 75 | AM_RANGE(0x02, 0x02) AM_READ( nascom1_port_02_r ) |
| r1461 | r1462 | |
|---|---|---|
| 1 | 1 | /****************************************************************************** |
| 2 | 2 | Acorn System 1 (Microcomputer Kit) |
| 3 | ||
| 3 | ||
| 4 | 4 | Skeleton driver |
| 5 | 5 | |
| 6 | 6 | Written by Dirk Best October 2007 |
| r1461 | r1462 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | 2 | ** mtx.c : driver for Memotech MTX512 |
| 3 | ** | |
| 3 | ** | |
| 4 | 4 | ** The memory address space of the MTX512 is divided into 8 banks, |
| 5 | 5 | ** with a size of 8KB each. These banks are mapped differently based |
| 6 | 6 | ** upon the memory model, selected ROM and RAM page, and the amount |
| r1461 | r1462 | |
| 225 | 225 | z80ctc_0_trg0_w (0, data ? 0 : 1); |
| 226 | 226 | } |
| 227 | 227 | |
| 228 | static void mtx_set_bank_offsets (unsigned int bank1, unsigned int bank2, | |
| 228 | static void mtx_set_bank_offsets (unsigned int bank1, unsigned int bank2, | |
| 229 | 229 | unsigned int bank3, unsigned int bank4, |
| 230 | 230 | unsigned int bank5, unsigned int bank6, |
| 231 | 231 | unsigned int bank7, unsigned int bank8) |
| r1461 | r1462 | |
| 385 | 385 | |
| 386 | 386 | if (ramspace) |
| 387 | 387 | return mess_ram[paddress]; |
| 388 | else | |
| 388 | else | |
| 389 | 389 | return romimage[paddress]; |
| 390 | 390 | } |
| 391 | 391 | |
| r1461 | r1462 | |
| 452 | 452 | mtx_rampage, start, mtx_tape_filename, mtx_tape_index); |
| 453 | 453 | if (length > bytes_saved) |
| 454 | 454 | logerror("wrote too few bytes from '%s'\n", mtx_tape_filename); |
| 455 | ||
| 455 | ||
| 456 | 456 | mame_fclose(tape_file); |
| 457 | 457 | mtx_tape_index += length; |
| 458 | 458 | } |
| r1461 | r1462 | |
| 499 | 499 | mtx_tape_filename, mtx_tape_index, mtx_rampage, start); |
| 500 | 500 | if (length > bytes_loaded) |
| 501 | 501 | logerror("read too few bytes from '%s'\n", mtx_tape_filename); |
| 502 | ||
| 502 | ||
| 503 | 503 | for (i = 0; i < length; i++) |
| 504 | 504 | mtx_poke(start + i, mtx_tape_buf[i]); |
| 505 | ||
| 505 | ||
| 506 | 506 | mame_fclose(tape_file); |
| 507 | 507 | mtx_tape_index += length; |
| 508 | 508 | } |
| r1461 | r1462 | |
| 612 | 612 | ADDRESS_MAP_END |
| 613 | 613 | |
| 614 | 614 | static ADDRESS_MAP_START( mtx_io, ADDRESS_SPACE_IO, 8) |
| 615 | ADDRESS_MAP_FLAGS( AMEF_ABITS(8) ) | |
| 615 | ADDRESS_MAP_FLAGS( AMEF_ABITS(8) ) | |
| 616 | 616 | AM_RANGE( 0x00, 0x00) AM_READWRITE( mtx_strobe_r, mtx_bankswitch_w ) |
| 617 | 617 | AM_RANGE( 0x01, 0x02) AM_READWRITE( mtx_vdp_r, mtx_vdp_w ) |
| 618 | 618 | AM_RANGE( 0x03, 0x03) AM_READWRITE( mtx_psg_r, mtx_cst_w ) |
| r1461 | r1462 | |
|---|---|---|
| 230 | 230 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) |
| 231 | 231 | MDRV_SOUND_ADD(AY8910, 1000000) |
| 232 | 232 | MDRV_SOUND_CONFIG(ay8910_interface) |
| 233 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) | |
| 233 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) | |
| 234 | 234 | MDRV_SOUND_ADD(AY8910, 1000000) |
| 235 | 235 | MDRV_SOUND_CONFIG(ay8910_interface) |
| 236 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) | |
| 236 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) | |
| 237 | 237 | MACHINE_DRIVER_END |
| 238 | 238 | |
| 239 | 239 | ROM_START( microtan ) |
| r1461 | r1462 | |
|---|---|---|
| 16 | 16 | trigger for channel 3 is the terminal count of channel 2 |
| 17 | 17 | |
| 18 | 18 | Intel 8251 Serial (2Mhz clock?) |
| 19 | ||
| 19 | ||
| 20 | 20 | WD1770 Floppy Disc controller |
| 21 | 21 | density is fixed, 4 drives and double sided supported |
| 22 | 22 | |
| 23 | 23 | AY-3-8910 PSG (2Mhz) |
| 24 | port A and port B are connected to the keyboard. Port A is keyboard | |
| 24 | port A and port B are connected to the keyboard. Port A is keyboard | |
| 25 | 25 | line select, Port B is data. |
| 26 | 26 | |
| 27 | 27 | printer connected to port A of PIO. /ACK from printer is connected to /ASTB. |
| r1461 | r1462 | |
| 61 | 61 | /* MISC */ |
| 62 | 62 | /* 0x20 - bit 0 is keyboard int mask; read to get state of some keys and /fire button states; |
| 63 | 63 | set to 0 to ENABLE interrupt; 1 to DISABLE interrupt; write to set mask. */ |
| 64 | /* 0x21 - bit 0 is adc int mask; set to 0 to ENABLE interrupt; 1 to DISABLE interrupt; | |
| 64 | /* 0x21 - bit 0 is adc int mask; set to 0 to ENABLE interrupt; 1 to DISABLE interrupt; | |
| 65 | 65 | write to set mask; read has no effect */ |
| 66 | 66 | /* 0x22 - alph */ |
| 67 | 67 | /* 0x23 - drive select and side select */ |
| r1461 | r1462 | |
| 123 | 123 | #endif |
| 124 | 124 | |
| 125 | 125 | /**********************************************************/ |
| 126 | /* | |
| 126 | /* | |
| 127 | 127 | 80 column board has a UM6845,2K ram and a char rom: |
| 128 | 128 | |
| 129 | 0x040-0x047 used to access 2K ram. (bits 3-0 define a 256 byte row, bits 15-8 define | |
| 129 | 0x040-0x047 used to access 2K ram. (bits 3-0 define a 256 byte row, bits 15-8 define | |
| 130 | 130 | the offset in the row) |
| 131 | 0x048 = crtc register index (w), | |
| 131 | 0x048 = crtc register index (w), | |
| 132 | 132 | 0x049 = crtc data register (w) |
| 133 | 133 | |
| 134 | 0x04c | |
| 134 | 0x04c | |
| 135 | 135 | bit 2 = 50/60hz mode? |
| 136 | 136 | bit 1 = 1 |
| 137 | 137 | bit 0 = vsync state? |
| r1461 | r1462 | |
| 235 | 235 | unsigned char data_byte; |
| 236 | 236 | int char_code; |
| 237 | 237 | int i, x; |
| 238 | ||
| 238 | ||
| 239 | 239 | for ( i = 0, x = 0; i < x_count; i++, x+=8 ) { |
| 240 | 240 | int w; |
| 241 | 241 | char_code = einstein_80col_ram[(ma + i)&0x07ff]; |
| r1461 | r1462 | |
| 447 | 447 | centronics_write_handshake(0, handshake, CENTRONICS_STROBE); |
| 448 | 448 | } |
| 449 | 449 | |
| 450 | static const z80pio_interface einstein_pio_intf = | |
| 450 | static const z80pio_interface einstein_pio_intf = | |
| 451 | 451 | { |
| 452 | 452 | einstein_pio_interrupt, |
| 453 | 453 | einstein_pio_ardy, |
| r1461 | r1462 | |
| 561 | 561 | { |
| 562 | 562 | int reg = offset & 0x03; |
| 563 | 563 | |
| 564 | logerror("fdc w: PC: %04x %04x %02x\n",activecpu_get_pc(),offset,data); | |
| 564 | logerror("fdc w: PC: %04x %04x %02x\n",activecpu_get_pc(),offset,data); | |
| 565 | 565 | |
| 566 | 566 | switch (reg) |
| 567 | 567 | { |
| r1461 | r1462 | |
| 570 | 570 | wd17xx_command_w(reg, data); |
| 571 | 571 | } |
| 572 | 572 | break; |
| 573 | ||
| 573 | ||
| 574 | 574 | case 1: |
| 575 | 575 | { |
| 576 | 576 | wd17xx_track_w(reg, data); |
| 577 | 577 | } |
| 578 | 578 | break; |
| 579 | ||
| 579 | ||
| 580 | 580 | case 2: |
| 581 | 581 | { |
| 582 | 582 | wd17xx_sector_w(reg, data); |
| r1461 | r1462 | |
| 596 | 596 | { |
| 597 | 597 | int reg = offset & 0x03; |
| 598 | 598 | |
| 599 | logerror("fdc r: PC: %04x %04x\n",activecpu_get_pc(),offset); | |
| 599 | logerror("fdc r: PC: %04x %04x\n",activecpu_get_pc(),offset); | |
| 600 | 600 | |
| 601 | 601 | switch (reg) |
| 602 | 602 | { |
| r1461 | r1462 | |
| 605 | 605 | return wd17xx_status_r(reg); |
| 606 | 606 | } |
| 607 | 607 | break; |
| 608 | ||
| 608 | ||
| 609 | 609 | case 1: |
| 610 | 610 | { |
| 611 | 611 | return wd17xx_track_r(reg); |
| 612 | 612 | } |
| 613 | 613 | break; |
| 614 | ||
| 614 | ||
| 615 | 615 | case 2: |
| 616 | 616 | { |
| 617 | 617 | return wd17xx_sector_r(reg); |
| r1461 | r1462 | |
| 669 | 669 | |
| 670 | 670 | static READ8_HANDLER(einstein_ctc_r) |
| 671 | 671 | { |
| 672 | logerror("ctc r: %04x\n",offset); | |
| 673 | ||
| 672 | logerror("ctc r: %04x\n",offset); | |
| 673 | ||
| 674 | 674 | return z80ctc_0_r(offset & 0x03); |
| 675 | 675 | } |
| 676 | 676 | |
| 677 | 677 | static WRITE8_HANDLER(einstein_ctc_w) |
| 678 | 678 | { |
| 679 | logerror("ctc w: %04x %02x\n",offset,data); | |
| 679 | logerror("ctc w: %04x %02x\n",offset,data); | |
| 680 | 680 | |
| 681 | 681 | z80ctc_0_w(offset & 0x03,data); |
| 682 | 682 | } |
| r1461 | r1462 | |
| 692 | 692 | msm8251_data_w(reg,data); |
| 693 | 693 | return; |
| 694 | 694 | } |
| 695 | ||
| 695 | ||
| 696 | 696 | msm8251_control_w(reg,data); |
| 697 | 697 | } |
| 698 | 698 | |
| r1461 | r1462 | |
| 707 | 707 | { |
| 708 | 708 | return msm8251_data_r(reg); |
| 709 | 709 | } |
| 710 | ||
| 710 | ||
| 711 | 711 | return msm8251_status_r(reg); |
| 712 | 712 | } |
| 713 | 713 | |
| 714 | /* | |
| 714 | /* | |
| 715 | 715 | |
| 716 | 716 | AY-3-8912 PSG: |
| 717 | 717 | |
| r1461 | r1462 | |
| 771 | 771 | /* case 0 and 1 are not handled */ |
| 772 | 772 | case 2: |
| 773 | 773 | return AY8910_read_port_0_r(0); |
| 774 | ||
| 774 | ||
| 775 | 775 | default: |
| 776 | 776 | break; |
| 777 | 777 | } |
| 778 | 778 | |
| 779 | 779 | return 0x0ff; |
| 780 | 780 | } |
| 781 | ||
| 782 | 781 | |
| 782 | ||
| 783 | 783 | /* int priority */ |
| 784 | 784 | /* keyboard int->ctc/adc->pio */ |
| 785 | 785 | |
| r1461 | r1462 | |
| 814 | 814 | /* bit 1: select drive 1 */ |
| 815 | 815 | /* bit 0: select drive 0 */ |
| 816 | 816 | |
| 817 | logerror("drive w: PC: %04x %04x %02x\n",activecpu_get_pc(),offset,data); | |
| 817 | logerror("drive w: PC: %04x %04x %02x\n",activecpu_get_pc(),offset,data); | |
| 818 | 818 | |
| 819 | 819 | wd17xx_set_side((data>>4) & 0x01); |
| 820 | ||
| 820 | ||
| 821 | 821 | if (data & 0x01) |
| 822 | 822 | { |
| 823 | 823 | wd17xx_set_drive(0); |
| r1461 | r1462 | |
| 889 | 889 | if ((centronics_handshake & CENTRONICS_NOT_BUSY)==0) |
| 890 | 890 | { |
| 891 | 891 | /* if CENTRONICS_NOT_BUSY flag set then not busy */ |
| 892 | ||
| 892 | ||
| 893 | 893 | /* busy */ |
| 894 | 894 | data |= (1<<2); |
| 895 | 895 | } |
| r1461 | r1462 | |
| 1325 | 1325 | AM_RANGE(0x008, 0x00f) AM_READ( einstein_vdp_r) |
| 1326 | 1326 | AM_RANGE(0x010, 0x017) AM_READ( einstein_serial_r) |
| 1327 | 1327 | AM_RANGE(0x018, 0x01f) AM_READ( einstein_fdc_r) |
| 1328 | AM_RANGE(0x020, 0x020) AM_READ( einstein_key_int_r) | |
| 1328 | AM_RANGE(0x020, 0x020) AM_READ( einstein_key_int_r) | |
| 1329 | 1329 | AM_RANGE(0x028, 0x02f) AM_READ( einstein_ctc_r) |
| 1330 | 1330 | AM_RANGE(0x030, 0x037) AM_READ( einstein_pio_r) |
| 1331 | 1331 | // {0x040, 0x0ff, einstein_unmapped_r}, |
| r1461 | r1462 | |
| 1474 | 1474 | static INPUT_PORTS_START(einstein) |
| 1475 | 1475 | /* line 0 */ |
| 1476 | 1476 | PORT_START |
| 1477 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BREAK") PORT_CODE(KEYCODE_LALT) | |
| 1478 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("?") PORT_CODE(KEYCODE_1_PAD) | |
| 1479 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F0") PORT_CODE(KEYCODE_F1) | |
| 1480 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("?") PORT_CODE(KEYCODE_3_PAD) | |
| 1481 | PORT_BIT(0x010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CAPS LOCK") PORT_CODE(KEYCODE_CAPSLOCK) | |
| 1482 | PORT_BIT(0x020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) | |
| 1483 | PORT_BIT(0x040, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) | |
| 1484 | PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) | |
| 1477 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BREAK") PORT_CODE(KEYCODE_LALT) | |
| 1478 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("?") PORT_CODE(KEYCODE_1_PAD) | |
| 1479 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F0") PORT_CODE(KEYCODE_F1) | |
| 1480 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("?") PORT_CODE(KEYCODE_3_PAD) | |
| 1481 | PORT_BIT(0x010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CAPS LOCK") PORT_CODE(KEYCODE_CAPSLOCK) | |
| 1482 | PORT_BIT(0x020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) | |
| 1483 | PORT_BIT(0x040, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) | |
| 1484 | PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) | |
| 1485 | 1485 | /* line 1 */ |
| 1486 | 1486 | PORT_START |
| 1487 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) | |
| 1488 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) | |
| 1489 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) | |
| 1490 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LEFT") PORT_CODE(KEYCODE_LEFT) | |
| 1491 | PORT_BIT(0x010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("_") PORT_CODE(KEYCODE_MINUS) | |
| 1492 | PORT_BIT(0x020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DOWN") PORT_CODE(KEYCODE_DOWN) | |
| 1493 | PORT_BIT(0x040, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("||") PORT_CODE(KEYCODE_BACKSLASH) | |
| 1494 | PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) | |
| 1487 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) | |
| 1488 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) | |
| 1489 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) | |
| 1490 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LEFT") PORT_CODE(KEYCODE_LEFT) | |
| 1491 | PORT_BIT(0x010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("_") PORT_CODE(KEYCODE_MINUS) | |
| 1492 | PORT_BIT(0x020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DOWN") PORT_CODE(KEYCODE_DOWN) | |
| 1493 | PORT_BIT(0x040, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("||") PORT_CODE(KEYCODE_BACKSLASH) | |
| 1494 | PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) | |
| 1495 | 1495 | /* line 2 */ |
| 1496 | 1496 | PORT_START |
| 1497 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) | |
| 1498 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) | |
| 1499 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_COLON) | |
| 1500 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(":") PORT_CODE(KEYCODE_QUOTE) | |
| 1501 | PORT_BIT(0x010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RIGHT") PORT_CODE(KEYCODE_RIGHT) | |
| 1502 | PORT_BIT(0x020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) | |
| 1503 | PORT_BIT(0x040, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) | |
| 1504 | PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F5") PORT_CODE(KEYCODE_F6) | |
| 1497 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) | |
| 1498 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) | |
| 1499 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_COLON) | |
| 1500 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(":") PORT_CODE(KEYCODE_QUOTE) | |
| 1501 | PORT_BIT(0x010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RIGHT") PORT_CODE(KEYCODE_RIGHT) | |
| 1502 | PORT_BIT(0x020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) | |
| 1503 | PORT_BIT(0x040, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) | |
| 1504 | PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F5") PORT_CODE(KEYCODE_F6) | |
| 1505 | 1505 | /* line 3 */ |
| 1506 | 1506 | PORT_START |
| 1507 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) | |
| 1508 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) | |
| 1509 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) | |
| 1510 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) | |
| 1511 | PORT_BIT(0x010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DELETE") PORT_CODE(KEYCODE_BACKSPACE) | |
| 1512 | PORT_BIT(0x020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("=") PORT_CODE(KEYCODE_EQUALS) | |
| 1513 | PORT_BIT(0x040, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("UP") PORT_CODE(KEYCODE_UP) | |
| 1514 | PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F5) | |
| 1507 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) | |
| 1508 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) | |
| 1509 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) | |
| 1510 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) | |
| 1511 | PORT_BIT(0x010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DELETE") PORT_CODE(KEYCODE_BACKSPACE) | |
| 1512 | PORT_BIT(0x020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("=") PORT_CODE(KEYCODE_EQUALS) | |
| 1513 | PORT_BIT(0x040, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("UP") PORT_CODE(KEYCODE_UP) | |
| 1514 | PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F5) | |
| 1515 | 1515 | /* line 4 */ |
| 1516 | 1516 | PORT_START |
| 1517 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) | |
| 1518 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) | |
| 1519 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) | |
| 1520 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) | |
| 1521 | PORT_BIT(0x010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) | |
| 1522 | PORT_BIT(0x020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) | |
| 1523 | PORT_BIT(0x040, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) | |
| 1524 | PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F4) | |
| 1517 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) | |
| 1518 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) | |
| 1519 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) | |
| 1520 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) | |
| 1521 | PORT_BIT(0x010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) | |
| 1522 | PORT_BIT(0x020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) | |
| 1523 | PORT_BIT(0x040, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) | |
| 1524 | PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F4) | |
| 1525 | 1525 | /* line 5 */ |
| 1526 | 1526 | PORT_START |
| 1527 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) | |
| 1528 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) | |
| 1529 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) | |
| 1530 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) | |
| 1531 | PORT_BIT(0x010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) | |
| 1532 | PORT_BIT(0x020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) | |
| 1533 | PORT_BIT(0x040, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) | |
| 1534 | PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F3) | |
| 1527 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) | |
| 1528 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) | |
| 1529 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) | |
| 1530 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) | |
| 1531 | PORT_BIT(0x010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) | |
| 1532 | PORT_BIT(0x020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) | |
| 1533 | PORT_BIT(0x040, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) | |
| 1534 | PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F3) | |
| 1535 | 1535 | /* line 6 */ |
| 1536 | 1536 | PORT_START |
| 1537 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) | |
| 1538 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) | |
| 1539 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) | |
| 1540 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) | |
| 1541 | PORT_BIT(0x010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) | |
| 1542 | PORT_BIT(0x020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) | |
| 1543 | PORT_BIT(0x040, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) | |
| 1544 | PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F2) | |
| 1537 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) | |
| 1538 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) | |
| 1539 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) | |
| 1540 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) | |
| 1541 | PORT_BIT(0x010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) | |
| 1542 | PORT_BIT(0x020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) | |
| 1543 | PORT_BIT(0x040, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) | |
| 1544 | PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F2) | |
| 1545 | 1545 | /* line 7 */ |
| 1546 | 1546 | PORT_START |
| 1547 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) | |
| 1548 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) | |
| 1549 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) | |
| 1550 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) | |
| 1551 | PORT_BIT(0x010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) | |
| 1552 | PORT_BIT(0x020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) | |
| 1553 | PORT_BIT(0x040, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) | |
| 1554 | PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F6") PORT_CODE(KEYCODE_F7) | |
| 1547 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) | |
| 1548 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) | |
| 1549 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) | |
| 1550 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) | |
| 1551 | PORT_BIT(0x010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) | |
| 1552 | PORT_BIT(0x020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) | |
| 1553 | PORT_BIT(0x040, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) | |
| 1554 | PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F6") PORT_CODE(KEYCODE_F7) | |
| 1555 | 1555 | /* extra */ |
| 1556 | 1556 | PORT_START |
| 1557 | 1557 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("GRPH") PORT_CODE(KEYCODE_F1) |
| r1461 | r1462 | |
| 1559 | 1559 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CONTROL") PORT_CODE(KEYCODE_RCONTROL) |
| 1560 | 1560 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) |
| 1561 | 1561 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_RSHIFT) |
| 1562 | ||
| 1562 | ||
| 1563 | 1563 | /* fire buttons for analogue joysticks */ |
| 1564 | 1564 | PORT_START |
| 1565 | 1565 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_NAME("Joystick 1 Button 1") |
| r1461 | r1462 | |
| 1570 | 1570 | PORT_BIT(0xff,0x80,IPT_AD_STICK_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(1) PORT_MINMAX(1,0xff) PORT_CODE_DEC(JOYCODE_X_LEFT_SWITCH) PORT_CODE_INC(JOYCODE_X_RIGHT_SWITCH) PORT_REVERSE |
| 1571 | 1571 | |
| 1572 | 1572 | /* analog joystick 1 y axis */ |
| 1573 | PORT_START | |
| 1573 | PORT_START | |
| 1574 | 1574 | PORT_BIT(0xff,0x80,IPT_AD_STICK_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(1) PORT_MINMAX(1,0xff) PORT_CODE_DEC(JOYCODE_Y_UP_SWITCH) PORT_CODE_INC(JOYCODE_Y_DOWN_SWITCH) PORT_REVERSE |
| 1575 | 1575 | |
| 1576 | 1576 | /* analog joystick 2 x axis */ |
| r1461 | r1462 | |
| 1599 | 1599 | |
| 1600 | 1600 | // logerror("key: %02x\n",einstein_keyboard_data); |
| 1601 | 1601 | |
| 1602 | return einstein_keyboard_data; | |
| 1602 | return einstein_keyboard_data; | |
| 1603 | 1603 | } |
| 1604 | 1604 | |
| 1605 | 1605 | static const struct AY8910interface einstein_ay_interface = |
| r1461 | r1462 | |
| 1639 | 1639 | // int char_code; |
| 1640 | 1640 | // |
| 1641 | 1641 | // char_code = einstein_80col_ram[m6845_memory_address_r(0)&0x07ff]; |
| 1642 | // | |
| 1642 | // | |
| 1643 | 1643 | // data_byte = data[(char_code<<3) + Einstein_6845_RA]; |
| 1644 | 1644 | // |
| 1645 | 1645 | // for (w=0; w<8;w++) |
| r1461 | r1462 | |
| 1729 | 1729 | MDRV_SPEAKER_STANDARD_MONO("mono") |
| 1730 | 1730 | MDRV_SOUND_ADD(AY8910, 2000000) |
| 1731 | 1731 | MDRV_SOUND_CONFIG(einstein_ay_interface) |
| 1732 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20) | |
| 1732 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20) | |
| 1733 | 1733 | MACHINE_DRIVER_END |
| 1734 | 1734 | |
| 1735 | 1735 |
| r1461 | r1462 | |
|---|---|---|
| 370 | 370 | MDRV_SPEAKER_STANDARD_MONO("mono") |
| 371 | 371 | MDRV_SOUND_ADD(AY8910, 3579545/2) |
| 372 | 372 | MDRV_SOUND_CONFIG(ay8910_interface) |
| 373 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) | |
| 373 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) | |
| 374 | 374 | MACHINE_DRIVER_END |
| 375 | 375 | |
| 376 | 376 |
| r1461 | r1462 | |
|---|---|---|
| 1 | 1 | /****************************************************************************** |
| 2 | 2 | Mephisto 4 + 5 Chess Computer |
| 3 | 3 | 2007 Dirk V. |
| 4 | ||
| 4 | ||
| 5 | 5 | ******************************************************************************/ |
| 6 | 6 | |
| 7 | 7 | /* |
| r1461 | r1462 | |
| 45 | 45 | |
| 46 | 46 | $2400 // Chess Board |
| 47 | 47 | $2800 // Chess Board |
| 48 | $3000 // Chess Board | |
| 48 | $3000 // Chess Board | |
| 49 | 49 | |
| 50 | 50 | $4000-7FFF Opening Modul HG550 |
| 51 | 51 | $8000-$FFF ROM |
| r1461 | r1462 | |
| 65 | 65 | static UINT8 *mephisto_ram; |
| 66 | 66 | static UINT8 led7; |
| 67 | 67 | |
| 68 | static WRITE8_HANDLER ( write_lcd ) | |
| 69 | { | |
| 68 | static WRITE8_HANDLER ( write_lcd ) | |
| 69 | { | |
| 70 | 70 | if (led7==0)output_set_digit_value(lcd_shift_counter,data); // 0x109 MM IV // 0x040 MM V |
| 71 | ||
| 71 | ||
| 72 | 72 | //output_set_digit_value(lcd_shift_counter,data ^ mephisto_ram[0x165]); // 0x109 MM IV // 0x040 MM V |
| 73 | 73 | lcd_shift_counter--; |
| 74 | lcd_shift_counter&=3; | |
| 74 | lcd_shift_counter&=3; | |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | static READ8_HANDLER(read_keys) |
| r1461 | r1462 | |
| 88 | 88 | return 0xff; // Mephisto needs it for working |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | static WRITE8_HANDLER ( write_led ) | |
| 91 | static WRITE8_HANDLER ( write_led ) | |
| 92 | 92 | { |
| 93 | 93 | |
| 94 | 94 | data &= 0x80; |
| r1461 | r1462 | |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | static ADDRESS_MAP_START(rebel5_mem , ADDRESS_SPACE_PROGRAM, 8) |
| 102 | AM_RANGE( 0x0000, 0x1fff) AM_RAM // AM_BASE(&mephisto_ram)// | |
| 102 | AM_RANGE( 0x0000, 0x1fff) AM_RAM // AM_BASE(&mephisto_ram)// | |
| 103 | 103 | AM_RANGE( 0x5000, 0x5000) AM_WRITE( write_lcd) |
| 104 | 104 | AM_RANGE( 0x3000, 0x3007) AM_READ( read_keys) // Rebel 5.0 |
| 105 | 105 | AM_RANGE( 0x2000, 0x2007) AM_WRITE( write_led) // Status LEDs+ buzzer |
| r1461 | r1462 | |
| 111 | 111 | |
| 112 | 112 | |
| 113 | 113 | static ADDRESS_MAP_START(mephisto_mem , ADDRESS_SPACE_PROGRAM, 8) |
| 114 | AM_RANGE( 0x0000, 0x1fff) AM_RAM AM_BASE(&mephisto_ram)// | |
| 114 | AM_RANGE( 0x0000, 0x1fff) AM_RAM AM_BASE(&mephisto_ram)// | |
| 115 | 115 | AM_RANGE( 0x2000, 0x2000) AM_WRITE( write_lcd) |
| 116 | 116 | AM_RANGE( 0x2c00, 0x2c07) AM_READ( read_keys) |
| 117 | 117 | AM_RANGE( 0x3400, 0x3407) AM_WRITE( write_led) // Status LEDs+ buzzer |
| r1461 | r1462 | |
| 132 | 132 | PORT_START //Port $2c01 |
| 133 | 133 | PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("POS") PORT_CODE(KEYCODE_F2) |
| 134 | 134 | PORT_START //Port $2c02 |
| 135 | PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("MEM") PORT_CODE(KEYCODE_F3) | |
| 135 | PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("MEM") PORT_CODE(KEYCODE_F3) | |
| 136 | 136 | PORT_START //Port $2c03 |
| 137 | 137 | PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("INFO") PORT_CODE(KEYCODE_F4) |
| 138 | 138 | PORT_START //Port $2c04 |
| r1461 | r1462 | |
| 140 | 140 | PORT_START //Port $2c05 |
| 141 | 141 | PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ENT") PORT_CODE(KEYCODE_ENTER) |
| 142 | 142 | PORT_START //Port $2c06 |
| 143 | PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) | |
| 143 | PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) | |
| 144 | 144 | PORT_START //Port $2c07 |
| 145 | 145 | PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) |
| 146 | 146 | // PORT_START_TAG("keyboard_2") |
| r1461 | r1462 | |
| 151 | 151 | PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) |
| 152 | 152 | PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) |
| 153 | 153 | PORT_START //Port $2c0a |
| 154 | PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) | |
| 155 | PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) | |
| 154 | PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) | |
| 155 | PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) | |
| 156 | 156 | PORT_START //Port $2c0b |
| 157 | 157 | PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) |
| 158 | 158 | PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) |
| r1461 | r1462 | |
| 164 | 164 | PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) |
| 165 | 165 | PORT_START //Port $2c0e |
| 166 | 166 | PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) |
| 167 | PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) | |
| 167 | PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) | |
| 168 | 168 | PORT_START //Port $2c0f |
| 169 | 169 | PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) |
| 170 | 170 | PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) |
| r1461 | r1462 | |
| 175 | 175 | { |
| 176 | 176 | |
| 177 | 177 | cpunum_set_input_line(0, INPUT_LINE_NMI,PULSE_LINE); |
| 178 | // DAC_data_w(0,led_status&64?128:0); | |
| 178 | // DAC_data_w(0,led_status&64?128:0); | |
| 179 | 179 | beep_set_state(0,led_status&64?1:0); |
| 180 | 180 | |
| 181 | 181 | } |
| r1461 | r1462 | |
| 211 | 211 | MDRV_SPEAKER_STANDARD_MONO("mono") |
| 212 | 212 | MDRV_SOUND_ADD(BEEP, 0) |
| 213 | 213 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) |
| 214 | ||
| 214 | ||
| 215 | 215 | MACHINE_DRIVER_END |
| 216 | 216 | |
| 217 | 217 | static MACHINE_DRIVER_START( rebel5 ) |
| r1461 | r1462 | |
| 231 | 231 | ROM_REGION(0x10000,REGION_CPU1,0) |
| 232 | 232 | ROM_LOAD("mephisto4.rom", 0x8000, 0x8000, CRC(f68a4124) SHA1(d1d03a9aacc291d5cb720d2ee2a209eeba13a36c)) |
| 233 | 233 | ROM_SYSTEM_BIOS( 0, "none", "No Opening Library" ) |
| 234 | ROM_SYSTEM_BIOS( 1, "hg440", "HG440 Opening Library" ) | |
| 235 | ROMX_LOAD( "hg440.rom", 0x4000, 0x4000, CRC(81ffcdfd) SHA1(b0f7bcc11d1e821daf92cde31e3446c8be0bbe19), ROM_BIOS(2)) | |
| 234 | ROM_SYSTEM_BIOS( 1, "hg440", "HG440 Opening Library" ) | |
| 235 | ROMX_LOAD( "hg440.rom", 0x4000, 0x4000, CRC(81ffcdfd) SHA1(b0f7bcc11d1e821daf92cde31e3446c8be0bbe19), ROM_BIOS(2)) | |
| 236 | 236 | ROM_END |
| 237 | 237 | |
| 238 | 238 | ROM_START(mm5) |
| 239 | 239 | ROM_REGION(0x10000,REGION_CPU1,0) |
| 240 | 240 | ROM_LOAD("mephisto5.rom", 0x8000, 0x8000, CRC(89c3d9d2) SHA1(77cd6f8eeb03c713249db140d2541e3264328048)) |
| 241 | 241 | ROM_SYSTEM_BIOS( 0, "none", "No Opening Library" ) |
| 242 | ROM_SYSTEM_BIOS( 1, "hg550", "HG550 Opening Library" ) | |
| 243 | ROMX_LOAD("hg550.rom", 0x4000, 0x4000, CRC(0359f13d) SHA1(833cef8302ad8d283d3f95b1d325353c7e3b8614),ROM_BIOS(2)) | |
| 242 | ROM_SYSTEM_BIOS( 1, "hg550", "HG550 Opening Library" ) | |
| 243 | ROMX_LOAD("hg550.rom", 0x4000, 0x4000, CRC(0359f13d) SHA1(833cef8302ad8d283d3f95b1d325353c7e3b8614),ROM_BIOS(2)) | |
| 244 | 244 | ROM_END |
| 245 | 245 | |
| 246 | 246 | ROM_START(mm50) |
| 247 | 247 | ROM_REGION(0x10000,REGION_CPU1,0) |
| 248 | 248 | ROM_LOAD("mm50.rom", 0x8000, 0x8000, CRC(fcfa7e6e) SHA1(afeac3a8c957ba58cefaa27b11df974f6f2066da)) |
| 249 | 249 | ROM_SYSTEM_BIOS( 0, "none", "No Opening Library" ) |
| 250 | ROM_SYSTEM_BIOS( 1, "hg550", "HG550 Opening Library" ) | |
| 251 | ROMX_LOAD("hg550.rom", 0x4000, 0x4000, CRC(0359f13d) SHA1(833cef8302ad8d283d3f95b1d325353c7e3b8614),ROM_BIOS(2)) | |
| 250 | ROM_SYSTEM_BIOS( 1, "hg550", "HG550 Opening Library" ) | |
| 251 | ROMX_LOAD("hg550.rom", 0x4000, 0x4000, CRC(0359f13d) SHA1(833cef8302ad8d283d3f95b1d325353c7e3b8614),ROM_BIOS(2)) | |
| 252 | 252 | ROM_END |
| 253 | 253 | |
| 254 | 254 | |
| r1461 | r1462 | |
| 256 | 256 | |
| 257 | 257 | static DRIVER_INIT( mephisto ) |
| 258 | 258 | { |
| 259 | lcd_shift_counter=3; | |
| 259 | lcd_shift_counter=3; | |
| 260 | 260 | } |
| 261 | 261 | |
| 262 | 262 | /*************************************************************************** |
| r1461 | r1462 | |
|---|---|---|
| 33 | 33 | port b |
| 34 | 34 | bit 0: ?? |
| 35 | 35 | |
| 36 | hi speed serial 1 | |
| 36 | hi speed serial 1 | |
| 37 | 37 | bit 1: output data |
| 38 | 38 | bit 2: output clock (hi data is taken) |
| 39 | 39 | |
| r1461 | r1462 | |
| 167 | 167 | ***************************************************************************/ |
| 168 | 168 | |
| 169 | 169 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME */ |
| 170 | CONS( 1979, ssystem3, 0, 0, ssystem3, ssystem3, ssystem3, NULL, "NOVAG Industries Ltd.", "Chess Champion Super System III", 0) | |
| 170 | CONS( 1979, ssystem3, 0, 0, ssystem3, ssystem3, ssystem3, NULL, "NOVAG Industries Ltd.", "Chess Champion Super System III", 0) | |
| 171 | 171 | //chess champion MK III in germany |
| r1461 | r1462 | |
|---|---|---|
| 95 | 95 | static ADDRESS_MAP_START( sms_io, ADDRESS_SPACE_IO, 8 ) |
| 96 | 96 | ADDRESS_MAP_FLAGS( AMEF_ABITS(8) ) |
| 97 | 97 | ADDRESS_MAP_FLAGS( AMEF_UNMAP(1) ) |
| 98 | AM_RANGE(0x00, 0x00) AM_MIRROR(0x3e) AM_WRITE(sms_bios_w) | |
| 98 | AM_RANGE(0x00, 0x00) AM_MIRROR(0x3e) AM_WRITE(sms_bios_w) | |
| 99 | 99 | AM_RANGE(0x01, 0x01) AM_MIRROR(0x3e) AM_WRITE(sms_version_w) |
| 100 | 100 | AM_RANGE(0x40, 0x7F) AM_READWRITE(sms_count_r, SN76496_0_w) |
| 101 | 101 | AM_RANGE(0x80, 0x80) AM_MIRROR(0x3e) AM_READWRITE(sms_vdp_data_r, sms_vdp_data_w) |
| r1461 | r1462 | |
| 121 | 121 | AM_RANGE(0x01, 0x05) AM_READWRITE(gg_sio_r, gg_sio_w) |
| 122 | 122 | AM_RANGE(0x06, 0x06) AM_READWRITE(gg_psg_r, gg_psg_w) |
| 123 | 123 | AM_RANGE(0x07, 0x07) AM_WRITE(sms_version_w) |
| 124 | AM_RANGE(0x08, 0x08) AM_MIRROR(0x06) AM_WRITE(sms_bios_w) | |
| 124 | AM_RANGE(0x08, 0x08) AM_MIRROR(0x06) AM_WRITE(sms_bios_w) | |
| 125 | 125 | AM_RANGE(0x09, 0x09) AM_MIRROR(0x06) AM_WRITE(sms_version_w) |
| 126 | AM_RANGE(0x10, 0x10) AM_MIRROR(0x0e) AM_WRITE(sms_bios_w) | |
| 126 | AM_RANGE(0x10, 0x10) AM_MIRROR(0x0e) AM_WRITE(sms_bios_w) | |
| 127 | 127 | AM_RANGE(0x11, 0x11) AM_MIRROR(0x0e) AM_WRITE(sms_version_w) |
| 128 | AM_RANGE(0x20, 0x20) AM_MIRROR(0x1e) AM_WRITE(sms_bios_w) | |
| 128 | AM_RANGE(0x20, 0x20) AM_MIRROR(0x1e) AM_WRITE(sms_bios_w) | |
| 129 | 129 | AM_RANGE(0x21, 0x21) AM_MIRROR(0x1e) AM_WRITE(sms_version_w) |
| 130 | 130 | AM_RANGE(0x40, 0x7F) AM_READWRITE(sms_count_r, SN76496_0_w) |
| 131 | 131 | AM_RANGE(0x80, 0x80) AM_MIRROR(0x3e) AM_READWRITE(sms_vdp_data_r, sms_vdp_data_w) |
| r1461 | r1462 | |
| 347 | 347 | MDRV_CPU_IO_MAP(sms_io, 0) |
| 348 | 348 | |
| 349 | 349 | MDRV_INTERLEAVE(1) |
| 350 | ||
| 350 | ||
| 351 | 351 | MDRV_MACHINE_START(sms) |
| 352 | 352 | MDRV_MACHINE_RESET(sms) |
| 353 | 353 | |
| r1461 | r1462 | |
| 360 | 360 | MDRV_PALETTE_LENGTH(64+16) |
| 361 | 361 | MDRV_COLORTABLE_LENGTH(0) |
| 362 | 362 | MDRV_PALETTE_INIT(sms) |
| 363 | ||
| 363 | ||
| 364 | 364 | MDRV_VIDEO_START(sega_315_5124) |
| 365 | 365 | MDRV_VIDEO_UPDATE(sms) |
| 366 | ||
| 366 | ||
| 367 | 367 | /* sound hardware */ |
| 368 | 368 | MDRV_SPEAKER_STANDARD_MONO("mono") |
| 369 | 369 | MDRV_SOUND_ADD(SMSIII, MASTER_CLOCK_PAL/15) |
| r1461 | r1462 | |
|---|---|---|
| 1 | 1 | /****************************************************************************** |
| 2 | * | |
| 2 | * | |
| 3 | 3 | * Acorn Archimedes 310 |
| 4 | 4 | * |
| 5 | 5 | * Skeleton: Juergen Buchmueller <pullmoll@t-online.de>, Jul 2000 |
| r1461 | r1462 | |
| 131 | 131 | if (a310_sndcur >= a310_sndend) |
| 132 | 132 | { |
| 133 | 133 | a310_request_irq_b(A310_IRQB_SOUND_EMPTY); |
| 134 | } | |
| 134 | } | |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | static TIMER_CALLBACK( a310_vblank ) |
| r1461 | r1462 | |
| 157 | 157 | // all timers always run |
| 158 | 158 | a310_set_timer(param); |
| 159 | 159 | |
| 160 | // but only timers 0 and 1 generate IRQs | |
| 160 | // but only timers 0 and 1 generate IRQs | |
| 161 | 161 | switch (param) |
| 162 | 162 | { |
| 163 | 163 | case 0: |
| r1461 | r1462 | |
| 167 | 167 | case 1: |
| 168 | 168 | a310_request_irq_a(A310_IRQA_TIMER1); |
| 169 | 169 | break; |
| 170 | } | |
| 170 | } | |
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | static void a310_memc_reset(void) |
| r1461 | r1462 | |
| 199 | 199 | case WD17XX_IRQ_SET: |
| 200 | 200 | a310_request_fiq(A310_FIQ_FLOPPY); |
| 201 | 201 | break; |
| 202 | ||
| 202 | ||
| 203 | 203 | case WD17XX_DRQ_CLR: |
| 204 | 204 | a310_iocregs[12] &= ~A310_FIQ_FLOPPY_DRQ; |
| 205 | 205 | break; |
| r1461 | r1462 | |
| 238 | 238 | static READ32_HANDLER(logical_r) |
| 239 | 239 | { |
| 240 | 240 | UINT32 page, poffs; |
| 241 | ||
| 241 | ||
| 242 | 242 | // are we mapping in the boot ROM? |
| 243 | 243 | if (a310_latchrom) |
| 244 | 244 | { |
| 245 | 245 | UINT32 *rom; |
| 246 | ||
| 246 | ||
| 247 | 247 | rom = (UINT32 *)memory_region(REGION_CPU1); |
| 248 | ||
| 249 | return rom[offset & 0x1fffff]; | |
| 248 | ||
| 249 | return rom[offset & 0x1fffff]; | |
| 250 | 250 | } |
| 251 | 251 | else |
| 252 | 252 | { |
| 253 | 253 | // figure out the page number and offset in the page |
| 254 | page = (offset<<2) / page_sizes[a310_pagesize]; | |
| 254 | page = (offset<<2) / page_sizes[a310_pagesize]; | |
| 255 | 255 | poffs = (offset<<2) % page_sizes[a310_pagesize]; |
| 256 | 256 | |
| 257 | 257 | // printf("Reading offset %x (addr %x): page %x (size %d %d) offset %x ==> %x %x\n", offset, offset<<2, page, a310_pagesize, page_sizes[a310_pagesize], poffs, a310_pages[page], a310_pages[page]*page_sizes[a310_pagesize]); |
| r1461 | r1462 | |
| 281 | 281 | else |
| 282 | 282 | { |
| 283 | 283 | // figure out the page number and offset in the page |
| 284 | page = (offset<<2) / page_sizes[a310_pagesize]; | |
| 284 | page = (offset<<2) / page_sizes[a310_pagesize]; | |
| 285 | 285 | poffs = (offset<<2) % page_sizes[a310_pagesize]; |
| 286 | 286 | |
| 287 | 287 | // printf("Writing offset %x (addr %x): page %x (size %d %d) offset %x ==> %x %x\n", offset, offset<<2, page, a310_pagesize, page_sizes[a310_pagesize], poffs, a310_pages[page], a310_pages[page]*page_sizes[a310_pagesize]); |
| r1461 | r1462 | |
| 311 | 311 | opcode_mask = 0x1fffff; |
| 312 | 312 | opcode_memory_min = 0; |
| 313 | 313 | opcode_memory_max = 0x1fffff; |
| 314 | opcode_base = opcode_arg_base = memory_region(REGION_CPU1); | |
| 314 | opcode_base = opcode_arg_base = memory_region(REGION_CPU1); | |
| 315 | 315 | } |
| 316 | 316 | else // executing from logical memory |
| 317 | { | |
| 318 | UINT32 page = address / page_sizes[a310_pagesize]; | |
| 317 | { | |
| 318 | UINT32 page = address / page_sizes[a310_pagesize]; | |
| 319 | 319 | |
| 320 | 320 | opcode_mask = page_sizes[a310_pagesize]-1; |
| 321 | 321 | opcode_memory_min = page * page_sizes[a310_pagesize]; |
| r1461 | r1462 | |
| 331 | 331 | memory_set_opbase_handler(0, a310_setopbase); |
| 332 | 332 | } |
| 333 | 333 | |
| 334 | static const char *const ioc_regnames[] = | |
| 334 | static const char *const ioc_regnames[] = | |
| 335 | 335 | { |
| 336 | 336 | "(rw) Control", // 0 |
| 337 | 337 | "(read) Keyboard receive (write) keyboard send", // 1 |
| r1461 | r1462 | |
| 373 | 373 | |
| 374 | 374 | time = attotime_to_double(timer_timeelapsed(timer[tmr])); |
| 375 | 375 | time *= 2000000.0; // find out how many 2 MHz ticks have gone by |
| 376 | a310_timerout[tmr] = a310_timercnt[tmr] - (UINT32)time; | |
| 376 | a310_timerout[tmr] = a310_timercnt[tmr] - (UINT32)time; | |
| 377 | 377 | } |
| 378 | 378 | |
| 379 | 379 | static READ32_HANDLER(ioc_r) |
| r1461 | r1462 | |
| 560 | 560 | { |
| 561 | 561 | UINT32 reg = data>>24; |
| 562 | 562 | UINT32 val = data & 0xffffff; |
| 563 | static const char *vrnames[] = | |
| 563 | static const char *vrnames[] = | |
| 564 | 564 | { |
| 565 | 565 | "horizontal total", |
| 566 | 566 | "horizontal sync width", |
| r1461 | r1462 | |
| 602 | 602 | // slightly hacky: fire off a VBL right now. the BIOS doesn't wait long enough otherwise. |
| 603 | 603 | timer_adjust(vbl_timer, attotime_zero, 0, attotime_never); |
| 604 | 604 | } |
| 605 | ||
| 605 | ||
| 606 | 606 | a310_vidregs[reg] = val>>12; |
| 607 | 607 | } |
| 608 | 608 | else |
| r1461 | r1462 | |
| 664 | 664 | else |
| 665 | 665 | { |
| 666 | 666 | logerror("MEMC non-reg: W %x @ %x (mask %08x)\n", data, offset, mem_mask); |
| 667 | } | |
| 667 | } | |
| 668 | 668 | } |
| 669 | 669 | |
| 670 | 670 | /* |
| r1461 | r1462 | |
| 711 | 711 | break; |
| 712 | 712 | |
| 713 | 713 | case 1: |
| 714 | phys = ((data & 0x7f) >> 1) | (data & 1) ? 0x40 : 0; | |
| 714 | phys = ((data & 0x7f) >> 1) | (data & 1) ? 0x40 : 0; | |
| 715 | 715 | log = (data & 0xc00)>>10; |
| 716 | 716 | log <<= 23; |
| 717 | 717 | log |= (data & 0x7fe000); |
| r1461 | r1462 | |
|---|---|---|
| 45 | 45 | #include "sound/speaker.h" |
| 46 | 46 | |
| 47 | 47 | static UINT8 avigo_key_line; |
| 48 | /* | |
| 48 | /* | |
| 49 | 49 | bit 7: ?? high priority. When it occurs, clear this bit. |
| 50 | bit 6: pen int | |
| 50 | bit 6: pen int | |
| 51 | 51 | An interrupt when pen is pressed against screen. |
| 52 | 52 | |
| 53 | 53 | bit 5: real time clock |
| 54 | ||
| 55 | 54 | |
| 56 | bit 4: | |
| 57 | ||
| 58 | ||
| 59 | bit 3: uart int | |
| 60 | ||
| 61 | ||
| 55 | ||
| 56 | bit 4: | |
| 57 | ||
| 58 | ||
| 59 | bit 3: uart int | |
| 60 | ||
| 61 | ||
| 62 | 62 | bit 2: synchronisation link interrupt???keyboard int ;; check bit 5 of port 1, |
| 63 | ||
| 63 | ||
| 64 | 64 | bit 1: ??? (cleared in nmi, and then set again) |
| 65 | 65 | |
| 66 | 66 | */ |
| r1461 | r1462 | |
| 189 | 189 | if ((current_input_port_data[3] & 0x01)!=0) |
| 190 | 190 | { |
| 191 | 191 | /* pen pressed to screen */ |
| 192 | ||
| 192 | ||
| 193 | 193 | logerror("pen pressed interrupt\n"); |
| 194 | 194 | stylus_press_x = stylus_marker_x; |
| 195 | 195 | stylus_press_y = stylus_marker_y; |
| r1461 | r1462 | |
| 271 | 271 | { |
| 272 | 272 | //#if 0 |
| 273 | 273 | avigo_irq &=~(1<<5); |
| 274 | ||
| 274 | ||
| 275 | 275 | if (state) |
| 276 | 276 | { |
| 277 | 277 | avigo_irq |= (1<<5); |
| r1461 | r1462 | |
| 386 | 386 | static OPBASE_HANDLER( avigo_opbase_handler ) |
| 387 | 387 | { |
| 388 | 388 | void *opbase; |
| 389 | ||
| 389 | ||
| 390 | 390 | opbase = avigo_banked_opbase[address / 0x4000]; |
| 391 | 391 | if (opbase) |
| 392 | 392 | { |
| r1461 | r1462 | |
| 632 | 632 | /* in the avigo rom, the y coordinate is inverted! */ |
| 633 | 633 | /* therefore a low value would be near the bottom of the display, |
| 634 | 634 | and a high value at the top */ |
| 635 | ||
| 635 | ||
| 636 | 636 | /* total valid range 0x044->0x036a */ |
| 637 | 637 | /* 0x0350 is also checked */ |
| 638 | ||
| 638 | ||
| 639 | 639 | /* assumption 0x044->0x0350 is screen area and |
| 640 | 640 | 0x0350->0x036a is panel at bottom */ |
| 641 | ||
| 641 | ||
| 642 | 642 | /* 780 is therefore on-screen range */ |
| 643 | 643 | /* 3.25 a/d units per pixel */ |
| 644 | 644 | /* a/d unit * a/d range = total height */ |
| 645 | 645 | /* 3.25 * 1024.00 = 315.07 */ |
| 646 | ||
| 646 | ||
| 647 | 647 | logerror("a/d select y coordinate\n"); |
| 648 | 648 | logerror("y coord: %d\n",stylus_press_y); |
| 649 | 649 | |
| r1461 | r1462 | |
| 672 | 672 | data = 0; |
| 673 | 673 | |
| 674 | 674 | /* original */ |
| 675 | ||
| 675 | ||
| 676 | 676 | /* status AND 11110111 */ |
| 677 | 677 | /* status OR 01110000 -> C20F */ |
| 678 | ||
| 678 | ||
| 679 | 679 | switch (avigo_ad_control_status & 0x078) |
| 680 | 680 | { |
| 681 | 681 | /* x1110xxx */ |
| 682 | 682 | /* read upper 4 bits of 10 bit A/D number */ |
| 683 | 683 | case 0x070: |
| 684 | 684 | case 0x078: |
| 685 | { | |
| 685 | { | |
| 686 | 686 | /* upper 4 bits of 10 bit A/D number in bits 7-4 of data */ |
| 687 | 687 | /* bit 0 must be 0, bit 1 must be 0 */ |
| 688 | 688 | /* bit 3 must be 1. bit 2 can have any value */ |
| 689 | ||
| 689 | ||
| 690 | 690 | logerror("a/d read upper 4 bits\n"); |
| 691 | 691 | data = ((avigo_ad_value>>6) & 0x0f)<<4; |
| 692 | 692 | data |= 8; |
| r1461 | r1462 | |
| 713 | 713 | /* wait for bit 0 of status to become 1 */ |
| 714 | 714 | /* read data -> d */ |
| 715 | 715 | |
| 716 | ||
| 716 | ||
| 717 | 717 | /* C20f AND 10111111 */ |
| 718 | 718 | /* C20f OR 00001000 */ |
| 719 | 719 | /* x0111xxx */ |
| r1461 | r1462 | |
| 763 | 763 | |
| 764 | 764 | logerror("avigo ad read %02x\n",data); |
| 765 | 765 | |
| 766 | return data; | |
| 766 | return data; | |
| 767 | 767 | } |
| 768 | 768 | |
| 769 | 769 | |
| r1461 | r1462 | |
| 844 | 844 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("MEMO") PORT_CODE(KEYCODE_M) |
| 845 | 845 | PORT_BIT (0x0fe, 0xfe, IPT_UNUSED) |
| 846 | 846 | |
| 847 | PORT_START | |
| 848 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Pen/Stylus pressed") PORT_CODE(KEYCODE_Q) PORT_CODE(JOYCODE_BUTTON1) | |
| 849 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("?? Causes a NMI") PORT_CODE(KEYCODE_W) PORT_CODE(JOYCODE_BUTTON2) | |
| 847 | PORT_START | |
| 848 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Pen/Stylus pressed") PORT_CODE(KEYCODE_Q) PORT_CODE(JOYCODE_BUTTON1) | |
| 849 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("?? Causes a NMI") PORT_CODE(KEYCODE_W) PORT_CODE(JOYCODE_BUTTON2) | |
| 850 | 850 | |
| 851 | 851 | /* these two ports are used to emulate the position of the pen/stylus on the screen */ |
| 852 | 852 | /* a cursor is drawn to indicate the position, so when a click is done, it will occur in the correct place */ |
| 853 | PORT_START /* Mouse - X AXIS */ | |
| 853 | PORT_START /* Mouse - X AXIS */ | |
| 854 | 854 | PORT_BIT( 0xfff, 0x00, IPT_MOUSE_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(1) |
| 855 | 855 | |
| 856 | 856 | PORT_START /* Mouse - Y AXIS */ |
| 857 | 857 | PORT_BIT( 0xfff, 0x00, IPT_MOUSE_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(1) |
| 858 | ||
| 858 | ||
| 859 | 859 | INPUT_PORTS_END |
| 860 | 860 | |
| 861 | 861 |
| r1461 | r1462 | |
|---|---|---|
| 262 | 262 | } |
| 263 | 263 | } |
| 264 | 264 | |
| 265 | static ADDRESS_MAP_START( coupe_io , ADDRESS_SPACE_IO, 8) | |
| 265 | static ADDRESS_MAP_START( coupe_io , ADDRESS_SPACE_IO, 8) | |
| 266 | 266 | AM_RANGE( 0x0000, 0x0ffff) AM_READWRITE( coupe_port_r, coupe_port_w ) |
| 267 | 267 | ADDRESS_MAP_END |
| 268 | 268 |
| r1461 | r1462 | |
|---|---|---|
| 45 | 45 | - bit 4 selects internal cassette player (low) or external unit (high) on a system-80 |
| 46 | 46 | FD: |
| 47 | 47 | - bit 7 for reading the printer status on a system-80 |
| 48 | - all bits for writing to a printer on a system-80 | |
| 48 | - all bits for writing to a printer on a system-80 | |
| 49 | 49 | F9: |
| 50 | 50 | - UART data (write) status (read) on a system-80 |
| 51 | 51 | F8: |
| r1461 | r1462 | |
| 541 | 541 | COMP( 1981, lnw80, trs80, 0, model1, trs80, trs80, trs8012, "LNW Research","LNW-80", GAME_NOT_WORKING ) |
| 542 | 542 | COMP( 1980, trs80m3, trs80, 0, model3, trs80, trs80, trs8012, "Tandy Radio Shack", "TRS-80 Model III", GAME_NOT_WORKING ) |
| 543 | 543 | COMP( 1980, trs80m4, trs80, 0, model3, trs80, trs80, trs8012, "Tandy Radio Shack", "TRS-80 Model 4", GAME_NOT_WORKING ) |
| 544 | ||
| 544 |
| r1461 | r1462 | |
|---|---|---|
| 105 | 105 | 1, /* 1 bits per pixel */ |
| 106 | 106 | { 0 }, /* no bitplanes; 1 bit per pixel */ |
| 107 | 107 | /* x offsets */ |
| 108 | { | |
| 108 | { | |
| 109 | 109 | 0, |
| 110 | 110 | 1, |
| 111 | 111 | 2, |
| r1461 | r1462 | |
| 128 | 128 | 1, /* 1 bits per pixel */ |
| 129 | 129 | { 0 }, /* no bitplanes; 1 bit per pixel */ |
| 130 | 130 | /* x offsets */ |
| 131 | { | |
| 131 | { | |
| 132 | 132 | 7,6,5,4,3,2,1,0 |
| 133 | 133 | }, |
| 134 | 134 | /* y offsets */ |
| r1461 | r1462 | |
|---|---|---|
| 94 | 94 | 4000-7fff ROM 0-15 or RAM 0-7 (switched) |
| 95 | 95 | 7000-bfff ROM 0-15 or RAM 0-7 (switched) |
| 96 | 96 | c000-ffff RAM 0 |
| 97 | ||
| 97 | ||
| 98 | 98 | Interrupts: |
| 99 | 99 | |
| 100 | 100 | IRQ: 200Hz timer |
| 101 | ON key | |
| 101 | ON key | |
| 102 | 102 | |
| 103 | 103 | TI-81 ports: |
| 104 | 104 | 0: Video buffer offset (write only) |
| r1461 | r1462 | |
| 107 | 107 | 3: ON status, LCD power |
| 108 | 108 | 4: Video buffer width, interrupt control (write only) |
| 109 | 109 | 5: ? |
| 110 | 6: | |
| 110 | 6: | |
| 111 | 111 | 7: ? |
| 112 | 112 | |
| 113 | 113 | TI-85 ports: |
| r1461 | r1462 | |
| 195 | 195 | AM_RANGE(0x8000, 0xbfff) AM_READWRITE( MRA8_BANK3, MWA8_BANK7 ) |
| 196 | 196 | AM_RANGE(0xc000, 0xffff) AM_READWRITE( MRA8_BANK4, MWA8_BANK8 ) |
| 197 | 197 | ADDRESS_MAP_END |
| 198 | ||
| 198 | ||
| 199 | 199 | /* keyboard input */ |
| 200 | 200 | static INPUT_PORTS_START (ti81) |
| 201 | 201 | PORT_START /* bit 0 */ |
| r1461 | r1462 | |
| 236 | 236 | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("EE") PORT_CODE(KEYCODE_END) |
| 237 | 237 | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("x^2") PORT_CODE(KEYCODE_COLON) |
| 238 | 238 | PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Y=") PORT_CODE(KEYCODE_F1) |
| 239 | PORT_START /* bit 5 */ | |
| 239 | PORT_START /* bit 5 */ | |
| 240 | 240 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("^") PORT_CODE(KEYCODE_P) |
| 241 | 241 | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("TAN") PORT_CODE(KEYCODE_PGUP) |
| 242 | 242 | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("COS") PORT_CODE(KEYCODE_HOME) |
| r1461 | r1462 | |
| 298 | 298 | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("EE") PORT_CODE(KEYCODE_END) |
| 299 | 299 | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LN") PORT_CODE(KEYCODE_BACKSLASH) |
| 300 | 300 | PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) |
| 301 | PORT_START /* bit 5 */ | |
| 301 | PORT_START /* bit 5 */ | |
| 302 | 302 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("^") PORT_CODE(KEYCODE_P) |
| 303 | 303 | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("TAN") PORT_CODE(KEYCODE_PGUP) |
| 304 | 304 | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("COS") PORT_CODE(KEYCODE_HOME) |
| r1461 | r1462 | |
|---|---|---|
| 271 | 271 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) |
| 272 | 272 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) |
| 273 | 273 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) |
| 274 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_NAME("B") | |
| 275 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_NAME("A") | |
| 276 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SELECT) PORT_NAME("Select") | |
| 277 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START) PORT_NAME("Start/Pause") | |
| 274 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_NAME("B") | |
| 275 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_NAME("A") | |
| 276 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SELECT) PORT_NAME("Select") | |
| 277 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START) PORT_NAME("Start/Pause") | |
| 278 | 278 | INPUT_PORTS_END |
| 279 | 279 | |
| 280 | 280 | static INPUT_PORTS_START( svisions ) |
| r1461 | r1462 | |
| 292 | 292 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) |
| 293 | 293 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) |
| 294 | 294 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) |
| 295 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_NAME("2nd B") PORT_PLAYER(2) | |
| 296 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_NAME("2nd A") PORT_PLAYER(2) | |
| 297 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SELECT) PORT_NAME("2nd Select") PORT_PLAYER(2) | |
| 298 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START) PORT_NAME("2nd Start/Pause") PORT_PLAYER(2) | |
| 295 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_NAME("2nd B") PORT_PLAYER(2) | |
| 296 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_NAME("2nd A") PORT_PLAYER(2) | |
| 297 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SELECT) PORT_NAME("2nd Select") PORT_PLAYER(2) | |
| 298 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START) PORT_NAME("2nd Start/Pause") PORT_PLAYER(2) | |
| 299 | 299 | INPUT_PORTS_END |
| 300 | 300 | |
| 301 | 301 | /* most games contain their graphics in roms, and have hardware to |
| r1461 | r1462 | |
| 425 | 425 | if (svision_channel->count) |
| 426 | 426 | svision_channel->count--; |
| 427 | 427 | if (svision_channel[1].count) |
| 428 | svision_channel[1].count--; | |
| 428 | svision_channel[1].count--; | |
| 429 | 429 | if (svision_noise.count) |
| 430 | 430 | svision_noise.count--; |
| 431 | 431 | } |
| r1461 | r1462 | |
| 444 | 444 | svision.timer1 = timer_alloc(svision_timer, NULL); |
| 445 | 445 | svision_pet.on = TRUE; |
| 446 | 446 | svision_pet.timer = timer_alloc(svision_pet_timer, NULL); |
| 447 | timer_pulse(attotime_mul(ATTOTIME_IN_SEC(8), 256/machine->drv->cpu[0].clock), NULL, 0, svision_pet_timer); | |
| 447 | timer_pulse(attotime_mul(ATTOTIME_IN_SEC(8), 256/machine->drv->cpu[0].clock), NULL, 0, svision_pet_timer); | |
| 448 | 448 | } |
| 449 | 449 | |
| 450 | 450 | static MACHINE_RESET( svision ) |
| r1461 | r1462 | |
|---|---|---|
| 152 | 152 | Discs |
| 153 | 153 | ----- |
| 154 | 154 | only file load from drive 8 and 9 implemented |
| 155 | loads file from rom directory (*.prg,*.p00,*.t64) (must NOT be specified on | |
| 155 | loads file from rom directory (*.prg,*.p00,*.t64) (must NOT be specified on | |
| 156 | 156 | commandline) |
| 157 | 157 | or file from d64 image (here also directory LOAD"$",8 supported) |
| 158 | 158 | use LOAD"filename",8 |
| r1461 | r1462 | |
| 271 | 271 | PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Arrow-Up Pi") PORT_CODE(KEYCODE_CLOSEBRACE) |
| 272 | 272 | PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RESTORE") PORT_CODE(KEYCODE_PRTSCR) |
| 273 | 273 | PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("STOP RUN") PORT_CODE(KEYCODE_TAB) |
| 274 | PORT_START | |
| 274 | PORT_START | |
| 275 | 275 | PORT_DIPNAME( 0x8000, IP_ACTIVE_HIGH, "SHIFT-LOCK (switch)") PORT_CODE(KEYCODE_CAPSLOCK) |
| 276 | PORT_DIPSETTING( 0x0000, DEF_STR( Off ) ) | |
| 277 | PORT_DIPSETTING( 0x8000, DEF_STR( On ) ) | |
| 276 | PORT_DIPSETTING( 0x0000, DEF_STR( Off ) ) | |
| 277 | PORT_DIPSETTING( 0x8000, DEF_STR( On ) ) | |
| 278 | 278 | PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') |
| 279 | 279 | PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('S') |
| 280 | 280 | PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') |
| r1461 | r1462 | |
| 349 | 349 | PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Arrow-Up Pi") PORT_CODE(KEYCODE_CLOSEBRACE) |
| 350 | 350 | PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RESTORE") PORT_CODE(KEYCODE_PRTSCR) |
| 351 | 351 | PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("STOP RUN") PORT_CODE(KEYCODE_TAB) |
| 352 | PORT_START | |
| 352 | PORT_START | |
| 353 | 353 | PORT_DIPNAME( 0x8000, IP_ACTIVE_HIGH, "SHIFT-LOCK (switch)") PORT_CODE(KEYCODE_CAPSLOCK) |
| 354 | 354 | PORT_DIPSETTING( 0, DEF_STR( Off ) ) |
| 355 | 355 | PORT_DIPSETTING( 0x8000, DEF_STR( On ) ) |
| r1461 | r1462 | |
|---|---|---|
| 87 | 87 | |
| 88 | 88 | /* |
| 89 | 89 | Keyboard status table |
| 90 | ||
| 90 | ||
| 91 | 91 | Bit#:| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | |
| 92 | 92 | | | | | | | | | | |
| 93 | 93 | Line: | | | | | | | | | |
| r1461 | r1462 | |
| 206 | 206 | PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CAPS") PORT_CODE(KEYCODE_CAPSLOCK) |
| 207 | 207 | PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SELECT") PORT_CODE(KEYCODE_PAUSE) |
| 208 | 208 | PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PRINT") PORT_CODE(KEYCODE_PRTSCR) |
| 209 | PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_UNUSED) | |
| 209 | PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_UNUSED) | |
| 210 | 210 | PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RIGHT") PORT_CODE(KEYCODE_RIGHT) |
| 211 | 211 | INPUT_PORTS_END |
| 212 | 212 | |
| r1461 | r1462 | |
| 339 | 339 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) |
| 340 | 340 | MDRV_SOUND_ADD(AY8910, 1789773) |
| 341 | 341 | MDRV_SOUND_CONFIG(ay8910_interface) |
| 342 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75) | |
| 342 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75) | |
| 343 | 343 | MACHINE_DRIVER_END |
| 344 | 344 | |
| 345 | 345 | static MACHINE_DRIVER_START( svi318n ) |
| r1461 | r1462 | |
|---|---|---|
| 199 | 199 | if (!strncmp((char *)&ROM[0x2120], "SUPER STREET FIGHTER2", 20)) |
| 200 | 200 | { |
| 201 | 201 | is_ssf2 = 1; |
| 202 | } | |
| 202 | } | |
| 203 | 203 | } |
| 204 | 204 | |
| 205 | 205 | ROM = memory_region(REGION_CPU1); /* 68000 ROM region */ |
| r1461 | r1462 | |
|---|---|---|
| 1418 | 1418 | |
| 1419 | 1419 | #if 0 |
| 1420 | 1420 | //pcjr roms? (incomplete dump, most likely 64 kbyte) |
| 1421 | // basic c1.20 | |
| 1421 | // basic c1.20 | |
| 1422 | 1422 | ROM_LOAD("basic.rom", 0xf6000, 0x8000, CRC(0c19c1a8)) |
| 1423 | 1423 | // ??? |
| 1424 | 1424 | ROM_LOAD("bios.rom", 0x??000, 0x2000, CRC(98463f95)) |
| r1461 | r1462 | |
|---|---|---|
| 10 | 10 | - Intel 80186 CPU 8MHz, integrated DMA(8237?), PIC(8259?), PIT(8253?) |
| 11 | 11 | - Intel 80130 OSP Operating system processor (PIC 8259, PIT 8254) |
| 12 | 12 | - Intel 8274 MPSC Multi-protocol serial communications controller (NEC 7201) |
| 13 | - Intel 8255 PPI Programmable peripheral interface | |
| 13 | - Intel 8255 PPI Programmable peripheral interface | |
| 14 | 14 | - Intel 8253 PIT Programmable interval timer |
| 15 | 15 | - Intel 8251 USART Universal synchronous asynchronous receiver transmitter |
| 16 | 16 | - National 58174 Real-time clock (compatible with 58274) |
| r1461 | r1462 | |
|---|---|---|
| 49 | 49 | }; |
| 50 | 50 | |
| 51 | 51 | /* TODO */ |
| 52 | static const z80pio_interface pio_intf = | |
| 52 | static const z80pio_interface pio_intf = | |
| 53 | 53 | { |
| 54 | 54 | NULL, |
| 55 | 55 | NULL, |
| r1461 | r1462 | |
|---|---|---|
| 113 | 113 | |
| 114 | 114 | |
| 115 | 115 | static ADDRESS_MAP_START(kc85_4_io, ADDRESS_SPACE_IO, 8) |
| 116 | ADDRESS_MAP_FLAGS( AMEF_ABITS(8) ) | |
| 116 | ADDRESS_MAP_FLAGS( AMEF_ABITS(8) ) | |
| 117 | 117 | AM_RANGE(0x0000, 0x0ffff) AM_READWRITE( kc85_4_port_r, kc85_4_port_w ) |
| 118 | 118 | ADDRESS_MAP_END |
| 119 | 119 | |
| r1461 | r1462 | |
| 298 | 298 | |
| 299 | 299 | |
| 300 | 300 | static ADDRESS_MAP_START(kc85_3_io, ADDRESS_SPACE_IO, 8) |
| 301 | ADDRESS_MAP_FLAGS( AMEF_ABITS(8) ) | |
| 301 | ADDRESS_MAP_FLAGS( AMEF_ABITS(8) ) | |
| 302 | 302 | AM_RANGE(0x0000, 0x0ffff) AM_READWRITE(kc85_3_port_r, kc85_3_port_w) |
| 303 | 303 | ADDRESS_MAP_END |
| 304 | 304 |
| Previous | 15994 Revisions | Next |