Previous 199869 Revisions Next

r18937 Tuesday 13th November, 2012 at 01:15:32 UTC by Angelo Salese
Worked around irq triggering in NEC PC-100 driver, and improved video timings. Now the BIOS moans about 'reading DOS' [Angelo Salese, Carl]
[src/mess/drivers]pc100.c pc9801.c

trunk/src/mess/drivers/pc9801.c
r18936r18937
22412241READ8_MEMBER(pc9801_state::get_slave_ack)
22422242{
22432243   if (offset==7) { // IRQ = 7
2244      return   pic8259_acknowledge( machine().device( "pic8259_slave" ));
2244      return pic8259_acknowledge( machine().device( "pic8259_slave" ));
22452245   }
22462246   return 0x00;
22472247}
trunk/src/mess/drivers/pc100.c
r18936r18937
22
33    NEC PC-100
44
5   preliminary driver by Angelo Salese
6   Thanks to Carl for the i8259 tip;
7
58    TODO:
6    - there's a regression with i8259, check this code:
9    - floppy support (no images available right now);
10    - i8259 works in edge triggering mode, kludged to work somehow.
11
12    Notes:
13    - First two POST checks are for the irqs, first one checks the timer irq:
714    F8209: B8 FB 00                  mov     ax,0FBh
815    F820C: E6 02                     out     2h,al
916    F820E: B9 00 00                  mov     cx,0h
1017    F8211: FB                        sti
11    F8212: 0A E4                     or      ah,ah <- it's supposed to trigger an irq there!
18    F8212: 0A E4                     or      ah,ah <- irq fires here
1219    F8214: E1 FC                     loopz   0F8212h
1320    F8216: FA                        cli
1421    F8217: 0A E9                     or      ch,cl
1522    F8219: 74 15                     je      0F8230h
23   - Second one is for the vblank irq timing:
24      F8238: 8B D3                     mov     dx,bx
25      F823A: 8B D9                     mov     bx,cx
26      F823C: CF                        iret
27   F824D: E4 02                     in      al,2h
28   F824F: 8A E0                     mov     ah,al
29   F8251: B0 EF                     mov     al,0EFh
30   F8253: E6 02                     out     2h,al
31   F8255: BB 00 00                  mov     bx,0h
32   F8258: BA 00 00                  mov     dx,0h
33   F825B: B9 20 4E                  mov     cx,4E20h
34   F825E: FB                        sti
35   F825F: E2 FE                     loop    0F825Fh ;calculates the vblank here
36   F8261: FA                        cli
37   F8262: 8A C4                     mov     al,ah
38   F8264: E6 02                     out     2h,al
39   F8266: 2B D3                     sub     dx,bx
40   F8268: 81 FA 58 1B               cmp     dx,1B58h
41   F826C: 78 06                     js      0F8274h ;error if DX is smaller than 0x1b58
42   F826E: 81 FA 40 1F               cmp     dx,1F40h
43   F8272: 78 0A                     js      0F827Eh ;error if DX is greater than 0x1f40
44   F8274: B1 05                     mov     cl,5h
45   F8276: E8 CB 03                  call    0F8644h
46   F8279: E8 79 FF                  call    0F81F5h
47   F827C: EB FE                     jmp     0F827Ch
48   F827E: B0 FF                     mov     al,0FFh
49   fwiw with current timings, we get DX=0x1f09, enough for passing the test;
1650
1751****************************************************************************/
1852
r18936r18937
221255WRITE8_MEMBER( pc100_state::pc100_crtc_data_w )
222256{
223257   m_crtc.reg[m_crtc.addr] = data;
258   printf("%02x %02x\n",m_crtc.addr,data);
224259}
225260
226261
r18936r18937
349384
350385INTERRUPT_GEN_MEMBER(pc100_state::pc100_vblank_irq)
351386{
387   pic8259_ir4_w(machine().device("pic8259"), 0);
352388   pic8259_ir4_w(machine().device("pic8259"), 1);
353389}
354390
355391TIMER_DEVICE_CALLBACK_MEMBER(pc100_state::pc100_600hz_irq)
356392{
357
358393   if(m_timer_mode == 0)
394   {
395      pic8259_ir2_w(machine().device("pic8259"), 0);
359396      pic8259_ir2_w(machine().device("pic8259"), 1);
397   }
360398}
361399
362400TIMER_DEVICE_CALLBACK_MEMBER(pc100_state::pc100_100hz_irq)
363401{
364
365402   if(m_timer_mode == 1)
403   {
404      pic8259_ir2_w(machine().device("pic8259"), 0);
366405      pic8259_ir2_w(machine().device("pic8259"), 1);
406   }
367407}
368408
369409TIMER_DEVICE_CALLBACK_MEMBER(pc100_state::pc100_50hz_irq)
370410{
371
372411   if(m_timer_mode == 2)
412   {
413      pic8259_ir2_w(machine().device("pic8259"), 0);
373414      pic8259_ir2_w(machine().device("pic8259"), 1);
415   }
374416}
375417
376418TIMER_DEVICE_CALLBACK_MEMBER(pc100_state::pc100_10hz_irq)
377419{
378
379420   if(m_timer_mode == 3)
421   {
422      pic8259_ir2_w(machine().device("pic8259"), 0);
380423      pic8259_ir2_w(machine().device("pic8259"), 1);
424   }
381425}
382426
383427#define MASTER_CLOCK 6988800
r18936r18937
392436
393437   /* video hardware */
394438   MCFG_SCREEN_ADD("screen", RASTER)
395   MCFG_SCREEN_REFRESH_RATE(60)
396   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */
397   MCFG_SCREEN_SIZE(1024, 1024)
398   MCFG_SCREEN_VISIBLE_AREA(0, 768-1, 0, 512-1)
439//   MCFG_SCREEN_REFRESH_RATE(60)
440//   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */
441//   MCFG_SCREEN_SIZE(1024, 264*2)
442//   MCFG_SCREEN_VISIBLE_AREA(0, 768-1, 0, 512-1)
443   /* TODO: Unknown Pixel Clock and CRTC is dynamic */
444   MCFG_SCREEN_RAW_PARAMS(MASTER_CLOCK*4, 1024, 0, 768, 264*2, 0, 512)
399445   MCFG_SCREEN_UPDATE_DRIVER(pc100_state, screen_update_pc100)
400446   MCFG_GFXDECODE(pc100)
401447   MCFG_PALETTE_LENGTH(16)

Previous 199869 Revisions Next


© 1997-2024 The MAME Team