Previous 15994 Revisions Next

r9456 Wednesday 27th October, 2010 at 10:10:04 UTC by Robbbert
[MYCOM] Corrected clocks; added cassette motor control; added notes; tidy up
[src/mess/drivers]mycom.c

src/mess/drivers/mycom.c
r9455r9456
1616        a - shiftlock (toggle). You can then enter any lowercase character.
1717        c - clear screen and home cursor
1818        d - insert
19        f - vertical tab (cursor up)
19        f - vertical tab (cursor up) You can scroll backwards with this,
20            and you can reuse old input lines.
2021        u - cursor right
2122    - There are switches on the right-hand side which are connected directly
2223      to one of the PIAs. The switches (not emulated):
r9455r9456
3334      Internally, this turns the Kana bit off/on. On our keyboard, hold down
3435      the ALT key to get Kana; release it to get English.
3536
36    TODO:
37    - SN doesn't seem to work properly, needs to find out what's the WE bit
38      for.
39    - Hook-up FDC (only the basic components have been added)
40    - Hook-up CMT load / save; (save works, load does not)
37    TODO/info:
38    - Sound not working. See the info down the page.
39    - FDC, type 1771, single sided, capacity 143KBytes, not connected up
40    - Cassette doesn't load
4141    - Printer
42    - RTC
42    - RTC, type MSM5832RS, unemulated device
4343    - Keyboard lookup table for Kana and Shifted Kana
4444    - Keyboard autorepeat
4545
r9455r9456
5656#include "devices/flopdrv.h"
5757#include "formats/basicdsk.h"
5858
59static UINT8 mc6845_reg[32];            /* registers */
60static UINT8 mc6845_ind;            /* register index */
61static const UINT8 mc6845_mask[32]={0xff,0xff,0xff,0x0f,0x7f,0x1f,0x7f,0x7f,3,0x1f,0x7f,0x1f,0x3f,0xff,0x3f,0xff,0,0};
6259static running_device *mc6845;
60static running_device *mycom_audio;
6361static running_device *mycom_cassette;
62static running_device *mycom_fdc;
6463static UINT8 *vram;
6564static UINT8 *gfx_rom;
6665static UINT16 vram_addr;
6766static UINT8 keyb_press,keyb_press_flag;
68static UINT8 video_mode,sn_we;
67static UINT8 mycom_0a,sn_we;
6968static UINT32 upper_sw;
7069static UINT8 *RAM;
7170
r9455r9456
8887   UINT16 mem,x;
8988   UINT16 *p = BITMAP_ADDR16(bitmap, y, 0);
9089
91   if(video_mode & 0x40)
90   if (mycom_0a & 0x40)
9291   {
9392      for (x = 0; x < x_count; x++)               // lores pixels
9493      {
r9455r9456
157156   RAM[offset | 0xc000] = data;
158157}
159158
160static READ8_HANDLER( mycom_6845_r )
161{
162   if (!offset)
163      return 0;
164
165   /* need to read the start registers or scroll wont work */
166   if ((mc6845_ind & 0x1e) == 0x0c)
167      return mc6845_reg[mc6845_ind];
168   else
169      return mc6845_register_r(mc6845, 0);
170}
171
172static WRITE8_HANDLER( mycom_6845_w )
173{
174   if(offset == 0)
175   {
176      mc6845_ind = data;
177      mc6845_address_w(mc6845, 0, data);
178   }
179   else
180   {
181      mc6845_reg[mc6845_ind] = data & mc6845_mask[mc6845_ind];
182      mc6845_register_w(mc6845, 0,data);
183   }
184}
185
186159static READ8_HANDLER( vram_data_r )
187160{
188161   return vram[vram_addr];
r9455r9456
204177   ADDRESS_MAP_GLOBAL_MASK(0xff)
205178   AM_RANGE(0x00, 0x00) AM_WRITE(mycom_00_w)
206179   AM_RANGE(0x01, 0x01) AM_READWRITE(vram_data_r,vram_data_w)
207   AM_RANGE(0x02, 0x03) AM_READWRITE(mycom_6845_r,mycom_6845_w)
180   AM_RANGE(0x02, 0x02) AM_DEVREADWRITE("crtc", mc6845_status_r,mc6845_address_w)
181   AM_RANGE(0x03, 0x03) AM_DEVREADWRITE("crtc", mc6845_register_r,mc6845_register_w)
208182   AM_RANGE(0x04, 0x07) AM_DEVREADWRITE("ppi8255_0", i8255a_r, i8255a_w)
209183   AM_RANGE(0x08, 0x0b) AM_DEVREADWRITE("ppi8255_1", i8255a_r, i8255a_w)
210184   AM_RANGE(0x0c, 0x0f) AM_DEVREADWRITE("ppi8255_2", i8255a_r, i8255a_w)
r9455r9456
340314{
341315   vram_addr = (vram_addr & 0x700) | data;
342316
317   sn_we = data;
343318   /* doesn't work? */
344   //printf("%02x %02x\n",data,sn_we);
319   //printf(":%X ",data);
345320   //if(sn_we)
346   //  sn76496_w(device->machine->device("sn1"), 0, data);
321     //sn76496_w(mycom_audio, 0, data);
347322}
348323
349324static WRITE8_DEVICE_HANDLER( mycom_06_w )
r9455r9456
391366    -x-- ---- video mode (0= tile, 1 = bitmap)
392367    --x- ---- PSG Chip Select bit
393368    ---x ---- PSG Write Enable bit
394    ---- x--- cmt remote
369    ---- x--- cmt remote (defaults to on)
395370    ---- -x-- cmt output
396371    ---- --x- printer reset
397372    ---- ---x printer strobe
398373    */
399374
375   if ((mycom_0a & 8) != (data & 8))
376      cassette_change_state(mycom_cassette,
377      (data & 8) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR);
378
400379   if (data & 8) // motor on
401380      cassette_output(mycom_cassette, (data & 4) ? -1.0 : +1.0);
402381
403   video_mode = data & 0xc0;
404   sn_we = data & 0x10;
405//  printf("%02x\n",data & 0x10);
382   if ((data & 0x80) != (mycom_0a & 0x80))
383      mc6845_set_clock(mc6845, (data & 0x80) ? 1008000 : 2016000);
384
385   mycom_0a = data;
386
387   /* Info about sound
388   - uses a SN76489N chip at an unknown clock
389   - each time a key is pressed, 4 lots of data are output to port 4
390   - after each data byte, there is a 4 byte control sequence to port 0a
391   - the control sequence is 9F,8F,AF,BF
392   - the data bytes are 8D,01,9F,9F
393   - the end result is silence  :(  */
394
395   // no sound comes out
396   if ((data & 0x30)==0)
397      sn76496_w(mycom_audio, 0, sn_we);
406398}
407399
408400static I8255A_INTERFACE( ppi8255_intf_0 )
r9455r9456
490482
491483static MACHINE_START(mycom)
492484{
485   mycom_audio = machine->device("sn1");
493486   mycom_cassette = machine->device("cassette");
487   mycom_fdc = machine->device("fdc");
494488   RAM = memory_region(machine, "maincpu");
495489   timer_pulse(machine, ATTOTIME_IN_HZ(20), NULL, 0, mycom_kbd);
496490}
r9455r9456
499493{
500494   memory_set_bank(machine, "boot", 1);
501495   upper_sw = 0x10000;
496   mycom_0a = 0;
502497}
503498
504499static DRIVER_INIT( mycom )
r9455r9456
509504
510505static MACHINE_CONFIG_START( mycom, driver_device )
511506   /* basic machine hardware */
512   MDRV_CPU_ADD("maincpu",Z80, XTAL_4MHz)
507   MDRV_CPU_ADD("maincpu",Z80, XTAL_10MHz / 4)
513508   MDRV_CPU_PROGRAM_MAP(mycom_map)
514509   MDRV_CPU_IO_MAP(mycom_io)
515510
r9455r9456
531526   MDRV_PALETTE_INIT(black_and_white)
532527   MDRV_GFXDECODE(mycom)
533528
534   MDRV_MC6845_ADD("crtc", H46505, XTAL_3_579545MHz/4, mc6845_intf)   /* unknown clock, hand tuned to get ~60 fps */
529   /* Manual states clock is 1.008mhz for 40 cols, and 2.016 mhz for 80 cols.
530   The CRTC is a HD46505S - same as a 6845. The start registers need to be readable. */
531   MDRV_MC6845_ADD("crtc", MC6845, 1008000, mc6845_intf)
535532
536533   MDRV_VIDEO_START(mycom)
537534   MDRV_VIDEO_UPDATE(mycom)
r9455r9456
539536   MDRV_SPEAKER_STANDARD_MONO("mono")
540537   MDRV_SOUND_WAVE_ADD("wave", "cassette")
541538   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
542   MDRV_SOUND_ADD("sn1", SN76489A, 1996800) // unknown clock / divider
539   MDRV_SOUND_ADD("sn1", SN76489, 1996800) // unknown clock / divider
543540   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
544541
545542   /* Devices */

Previous 15994 Revisions Next


© 1998-2018 The MESS Team