Hi Vas,

Your buffered grappler driver is really nice and elegant. I could never do that in a million years 8-) Tribute!

I wanted to see the self test for fun so I added a little bit of code to simulate the reset line controlled by an ioport and discovered another corrupt byte:

This is surely incorrect, but it seems to work ok.


Code
INPUT_PORTS_START(bufgrapplerplus)
        PORT_INCLUDE(grapplerplus)

        PORT_START("CNF")
        PORT_CONFNAME(0xff, 0x00, "RAM Size")
        PORT_CONFSETTING(   0xfc, "16K (2 chips)")
        PORT_CONFSETTING(   0xf0, "32K (4 chips)")
        PORT_CONFSETTING(   0x00, "64K (8 chips)")

        PORT_START("Reset")
        PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Reset") PORT_CODE(KEYCODE_DEL_PAD)
INPUT_PORTS_END



added this in device_add_mconfig:

 m_mcu->p2_in_cb().set(FUNC(a2bus_buf_grapplerplus_device::mcu_p2_r));



u8 a2bus_buf_grapplerplus_device::mcu_p2_r()
{
int   retval = (m_mcu_p2 & 0x7f) | 0x4 |  ((machine().time().as_double() < (2.0/60)) ? 0x0 : (ioport("Reset")->read() ? 0x80 : 0x0));    // bit 2 is always 1 since +5 I think

        printf("retval = %x     time=%f\n",retval,machine().time().as_double());

        return retval;

}


If you want to see the self test every time, make the above test ((machine().time().as_double() < 3.0)


since the input system gets updated every frame it won't see the key down until .0168 of time (1/60th second) so that's why I've got the 2.0/60 in the test

retval = ee time=0.000298
retval = ee time=0.001224
...
retval = ee time=0.013711
retval = ee time=0.015272
retval = 6e time=0.016833 <<< input system picks up key down after 1 frame and ee --> 6e
retval = 6e time=0.017728


Code
0:330: 0a     in   a,p2     get value of p2
0:331: f2 47  jb7  $347      bit 7 = reset    'reset active low so jump to 347 and set the flag if reset isn't pressed
0:333: ff     mov  a,r7     -- I think r6 and r5 are a "countdown timer"        <<<<< this should be  fe instead of ff  mov a,r6 since the jnz responds to the accumulator only
0:334: ce     dec  r6
0:335: 96 38  jnz  $338     test if r6 is nonzero
0:337: cd     dec  r5
0:338: fd     mov  a,r5
0:339: 4e     orl  a,r6
0:33a: 96 00  jnz  $300    if r5/r6 are nonzero then jump to refresh ram
0:33c: 0a     in   a,p2   (once we get here, we keep spinning until the reset button is released)
0:33d: f2 41  jb7  $341
0:33f: 64 3c  jmp  $33C      -- spin again
0:341: 76 4f  jf1  $34F   -- flag1 set, jump to 34f
0:343: c5     sel  rb0
0:344: 34 8e  call $18E     self test
0:346: d5     sel  rb1
0:347: a5     clr  f1
0:348: b5     cpl  f1                   set f1

64k:

[Linked Image from i.imgur.com]

32k:
[Linked Image from i.imgur.com]
16k:
[Linked Image from i.imgur.com]

Sorry about the bad dump, I tried to get a good dump. I dumped it 3 times and they were all identical.


Some fun testing with Zoom Grafix: taking the printer offline and printing 2 x 3 will go completely in the buffer.

3x3 will get most of the way down before it has to wait. If you set the left margin to zero you almost get to the bottom.

(3*280+6) * (3*192/7) = 69614 bytes so a little bigger than 64k.

Start 3x3 printout:
[Linked Image from i.imgur.com]

Buffer full, has to wait about 3/4 way down:
[Linked Image from i.imgur.com]