• Please review our updated Terms and Rules here

NABU PC Emulation under MAME

I can probably add support for to the emulator for DSDD floppies, i'll need to figure out what the proper DPB for the DS disks is though as that is encoded as we've discovered in the out of band mfm data of track 0 and is going to be different for DS disks then it is for SS disks.
@LeoBinkowski Brijohn and I will get together and sort out the DSDD disk images so they can work with NABU MAME.

I have also been communicating with @RandomVariations to sort out a physical hard drive (CF card) option. His works as posted above but you don't have the floppy support. I am working on that.
 
I have also been communicating with @RandomVariations to sort out a physical hard drive (CF card) option. His works as posted above but you don't have the floppy support. I am working on that.

I have updated the schematics on the github site to include an alternate version intended to connect to the connector on the floppy disk card. Based on my testing with MAME, this should allow for the IDE/compact flash drive to operate together with the floppy drive. I also linked to a (currently untested) project shared at OSH Park for this version.
 
Would it be possible to add Yamaha V9938 or V9958 video processor support to add 80 columns to the NABU emulation? Would take some re-write of the CP/M BIOS to make it use the additional video modes...
 
Would it be possible to add Yamaha V9938 or V9958 video processor support to add 80 columns to the NABU emulation? Would take some re-write of the CP/M BIOS to make it use the additional video modes...
It'd be pretty easy to swap the VDP in the emulation, the v9938 and v9958 are already written. Take a look at src/devices/bus/a2bus/ezcgi.cpp and you can see that they just use a couple more i/o addresses.
 
I was hacking up the serial terminal to handle Kaypro codes so it could run the TE_KP.COM editor and if I make it ignore ESC B and ESC C kaypro attributes, then WordStar will run.

I kept trying to copy TE_KP.COM from a floppy disk image and PIP hates underscores in file names. After renaming the _ away, then PIP would work.

Lf0f1kW.png


It isn't pretty, but it does seem to work ok.


Code:
void generic_terminal_device::adm_term_write(uint8_t data)
{


//    printf("data = %x  %c\n",data,data < 127 && data > 32 ? data : '_');

/*
from https://retrocmp.de/kaypro/kay-p7_terminal.htm

Kaypro Terminal Emulation

The Kaypro's emulate the Lear-Seigler ADM-3A terminal.


CURSOR CONTROL
  ring bell    -     7 dec - 07H
  cursor left  -     8 dec - 08H
  cursor right -    12 dec - 0CH
  cursor down  -    10 dec - 0AH
  cursor up    -    11 dec - 0BH
  home cursor  -    30 dec - 1EH
  clear scr & home  26 dec - 1AH
  carriage return   13 dec - 0DH

CURSOR POSITIONING
  rows              = 0 - 23 dec
  columns           = 0 - 79 dec
  escape sequence   = 27, 61 dec - 1BH, 3DH
  constant offset   = 20     dec - 14H

  So in Mbasic to position the cursor at row 12, col 40
  print chr$(27)chr$(61)chr$(20+12)chr$(20+40)
                ESC = row col

LINE INSERT / DELETE
  insert line  - 27, 69 dec - 1BH, 45H { scroll down }
  delete line  - 27, 82 dec - 1BH, 52H { scroll up   }

CLEAR TO END OF LINE / SCREEN
  clear to EOL - 24 dec - 18H
  clear to EOS - 23 dec - 17H

CHANGE CHARACTER SETS
  set ASCII    - 27,65 dec - 1BH,41H
  set greek    - 27,71 dec - 1BH,47H


*/

    // check for ESC
//    if (m_esc_counter) printf("esc_counter = %x\n",m_esc_counter);
    if ((m_esc_counter == 0) && (data == 0x1b))
    {
        m_esc_buffer[m_esc_counter++] = data;
        return;
    }
    else if ((m_esc_counter >= 1))
    {
        m_esc_buffer[m_esc_counter++] = data;

        if (m_esc_buffer[1] == '=')
        {
            if (m_esc_counter > 3)  // 3 characters for ESC =
            {
                if (m_esc_buffer[2] >= 32) m_y_pos = m_esc_buffer[2] - 32;
                if (m_esc_buffer[3] >= 32) m_x_pos = m_esc_buffer[3] - 32;
                if (m_y_pos > 23) m_y_pos = 23;
                if (m_x_pos > 79) m_x_pos = 79;
                m_esc_counter = 0;
                return;
            }
        }
        else if (m_esc_buffer[1] == 'B' || m_esc_buffer[1] == 'C')  // attribute on/off
        {
            if (m_esc_counter > 2)  // 2 characters for ESC B, ESC C
            {
                // just gobble the ESC B 0 or 1
                m_esc_counter = 0;
                return;
            }
        }
        else
        {
            m_esc_counter = 0;  // gobble the next character after ESC for undefined.
        }
        return;
    }


    if (data > 0x1f)
    {
        // printable char
        if (data != 0x7f) write_char(data);
    }
    else
    {
        const uint16_t options = m_io_term_conf->read();
        switch(data)
        {
        case 0x07: // bell
            m_beeper->set_state(1);
            m_bell_timer->reset(attotime::from_msec(250));
            break;

        case 0x08: // backspace CTRL+H = cursor move left
            if (m_x_pos) m_x_pos--;
            break;

        case 0x09: // horizontal tab
            m_x_pos = (std::min<uint8_t>)((m_x_pos & 0xf8) + 8, m_width - 1);
            break;

        case 0x0d: // carriage return
            m_x_pos = 0;
            if (!(options & 0x080)) break;
            [[fallthrough]];
        case 0x0a: // linefeed CTRL+J = cursor move down
            m_y_pos++;
            if (m_y_pos >= m_height)
            {
                scroll_line();
                m_y_pos = m_height - 1;
            }
            if (options & 0x040) m_x_pos = 0;
            break;

        case 0x0b: // vertical tab CTRL+K = cursor move up
            if (m_y_pos) m_y_pos--;
            break;

        case 0x0c: // form feed - CTRL+L = cursor move right
            m_x_pos++;
            if (m_x_pos >= m_width)
            {
                m_x_pos = 0;
                m_y_pos++;
                if (m_y_pos >= m_height)
                {
                    scroll_line();
                    m_y_pos = m_height-1;
                }
            }
            break;

        //  clear to EOL - 24 dec - 18H
        //  clear to EOS - 23 dec - 17H

        case 0x17: // clear to eos
            memset(m_buffer.get() + m_width * m_y_pos + m_x_pos, 0x20, (m_width  * m_height) - (m_x_pos + m_width * m_y_pos));
            break;

        case 0x18: // clear to eol
            memset(m_buffer.get() + m_width * m_y_pos + m_x_pos, 0x20, m_width - m_x_pos);
            break;

        case 0x1a: // CTRL+Z = clear screen
            clear();
            break;

        case 0x1e: // record separator
            m_x_pos = 0;
            m_y_pos = 0;
            break;
        }
    }
}
 
It'd be pretty easy to swap the VDP in the emulation, the v9938 and v9958 are already written. Take a look at src/devices/bus/a2bus/ezcgi.cpp and you can see that they just use a couple more i/o addresses.
Was going to point exactly to that. In fact, I think I was the one who inspired adding the V9938 and V9958 to the EZCGI support. (I might have even been the reason the EZCGI was added in the first place.)

I used MAME's support for the Arcade Board (another TMS9918/AY8910 card for the Apple ][) to write some code to "exercise" the TMS9918. I then used that later to help me figure out how the Nabu worked (the thing about using two OUT commands in MBASIC to set the color, for example).
 
So I seem to recall being able to format a disk image using the cycle v1 disk utilities->format utility. I may be mistaken, or I may have forgotten something related to the process of doing so, but it always fails with sector read errors during verification. I'm simply creating a 200k binary using:

Code:
dd if=/dev/zero of=./test.dsk bs=128 count=1600

Using the default bios (v2) (also tried ver29). Is this supposed to work?
 
So I seem to recall being able to format a disk image using the cycle v1 disk utilities->format utility. I may be mistaken, or I may have forgotten something related to the process of doing so, but it always fails with sector read errors during verification. I'm simply creating a 200k binary using:

Code:
dd if=/dev/zero of=./test.dsk bs=128 count=1600

Using the default bios (v2) (also tried ver29). Is this supposed to work?
So the verification does not work with the format command. I'm not sure exactly what the reason is, but the disk does get formatted regardless, it just fails to verify. If you run the check command on the disk verification does work though.

If you just want a newly formatted disk you can use the following which will create a disk image filled with the value 0xe5, which is what the format command will do.
dd if=/dev/zero bs=128 count=1600 | tr "\000" "\345" > test.dsk
 
So the verification does not work with the format command. I'm not sure exactly what the reason is, but the disk does get formatted regardless, it just fails to verify. If you run the check command on the disk verification does work though.

Thanks. I could see that it was indeed formatted, I just thought that it used to verify as well, but it's been a while since I tried. :)
 
So, using the nabu on mame debugger to debug my NABUmon debugger. Say that 3 times fast :).

Screenshot 2023-01-26 165651.jpg Screenshot 2023-01-23 214213.jpg
 
Hmm yeah that is a possibility, I wasn't able to tell from the posted images if the int line was connected to anything on the option bus, but yeah that could be the issue. I'll test connecting it up in emulation for the card and see if that makes CONIN work correctly.
I was just reading through the thread, the interrupt line is connected. here is the schematic as best as can can tell , but might not be 100% accurate , it is not working with my preliminary tests .
serial revised.png
 
I was just reading through the thread, the interrupt line is connected. here is the schematic as best as can can tell , but might not be 100% accurate , it is not working with my preliminary tests .

Are your preliminary tests using cp/m and attempting to reassign conout/conin? Curious, what terminal and/or term emu is connected to the card?

While I'm not clear on the specifics as to what @brijohn did relative to the interrupt update, I can confirm that not only does the mame support for the rs-232 options work fine with cp/m, but also with my code (no cp/m) using both interrupts and a traditional polled approach, with one small exception (the option doesn't appear to function in one specific slot, but I'm attributing that to the Windows build of mame for the time being... at any rate, you may wish to move to another slot just in case if you haven't done so already).
 
Yes using cp/m contin conout I shifted the option card over a slot so fdc in 1 and serial in 2. I've got it hooked up to real term to monitor any activity. The one thing I have found is the fdc works in slot 0 and 1
 
Yes using cp/m contin conout I shifted the option card over a slot so fdc in 1 and serial in 2. I've got it hooked up to real term to monitor any activity. The one thing I have found is the fdc works in slot 0 and 1
Typically, I assume the terminal is the issue first, before tackling the host hardware. I'd start with the obvious... set 8N1 no handshaking, try 7E2, add x-on/x-off to both configs, etc... I know that the nabu cp/m 3 bios inits the rs-232 8251 in a pretty standard way... 8N1 and 9600 baud. It does use interrupts (int mode 2) for input from the rs-232 options, but appears to just use a polled approach for sending data out.

Also, because cp/m is configured to use interrupts on input, if your 8253 PIT has any issues that will certainly cause a problem as well.
 
Last edited:
From initial probing I don't see a clock coming from the pit. The master clock is there

It appears that 2 of the 3 counters are initialized/used in the bios, so 2 of the 3 outputs should be clocking.
 
It appears that 2 of the 3 counters are initialized/used in the bios, so 2 of the 3 outputs should be clocking.
im going to need to dig into the select logic as i am not 100% on the reverse engineering of the serial card. also the nabu that i received has the -12 power rail for the serial card neutered at the board, although the ones that i have seen with serial cards have been modified to to get the -12 to the connector
 
Back
Top