Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Booting Venix for Rainbow under MAME #5

Open
RenaissanceDork opened this issue Mar 2, 2024 · 6 comments
Open

Booting Venix for Rainbow under MAME #5

RenaissanceDork opened this issue Mar 2, 2024 · 6 comments

Comments

@RenaissanceDork
Copy link

RenaissanceDork commented Mar 2, 2024

Hello,

First of all, I am very grateful for this project. It was really great to get Venix running on my old Rainbow! I'd love to get it running under MAME so I can minimize the amount of time I need to fire up the old hardware. According to the MAME driver for Rainbow [1], this is possible. And the readme in this project [2] also makes the same claim. I have gone through the entire setup procedure without any issue. However I am unclear on how to actually boot my new Venix for Rainbow installation under MAME. There is a known bug in the Rainbow driver for MAME, preventing booting from the virtual hard disk. For CP/M and DOS, I can just use a boot floppy and then use the hard drive. I thought perhaps the vboot.flp would be useful for this, but it seems to behave just like the XFER disk and the shell that is executed only seems to give me access to the contents of the floppy. I had a look at the setting up and system managers documentation for Venix, but couldn't find anything about booting from a floppy asides from when a system restore is needed.

Can anyone give me some tips on how to get this booted using the Rainbow driver for MAME? I'll be happy to create a PR to update the instructions if I get this working.

Thanks!

Bones

[1] https://github.com/mamedev/mame/blob/master/src/mame/dec/rainbow.cpp
[2] https://github.com/bsdimp/venix/blob/master/doc/MESS-RB-INSTALL.md

@Bavarese
Copy link

Bavarese commented Mar 5, 2024

Sounds as if your harddisk is not mounted. It definitely worked back then in 2019

Note that i needed VENIX with 'BSW enhancements' and only select few hard disk sizes were supported (Rainbow.cpp contains a list of 'official' RD drives).

Prepare a hard disk image with CHDTOOL (= the appropriate MAME/MESS tool), then

You should see a popup as soon as you attach the physical hard disk (search the source for 'popup').

Note that no hot swapping is allowed, except for floppies.

Do you know my introduction text from 2019...?
https://www.dropbox.com/scl/fi/2hf8wwkn6qz44lxwgukui/First_steps_Rainbow-100-B_January_2019_edition.pdf?rlkey=8szqmhuananq5ukzv5c1j2p5d&dl=0

I'd try to boot DOS 3.1 from hard disk first (and get WUTIL 3.2 running)...

Bsdimp might have more info about UNIX or VENIX specific details.

@RenaissanceDork
Copy link
Author

Thanks a lot for the document! That pulls together a lot of information that I have pieced together so far and adds some really valuable examples of using the C and D drives. I really appreciate it!

I am pretty sure that the drive is mounted properly.

  1. I created a disk image as specified here [1].
  2. The switch is set in MAME to activate the Rainbow's HDD controller.
  3. I mounted it and booted with WUTIL using mame rainbow -flop1 WUTIL.IMD -hard1 venix3.chd -ramsize 640K -window
  4. I initialized, partitioned, and formatted for DOS using WUTIL 3.2.
  5. I rebooted with the XFER disk for BSW Venix and installed it with no problem.

The problem is that I don't know how to boot the system once installed. According to the Rainbow driver for MAME [2], it isn't possible to boot from the hard drive at all. I have found this true for both CP/M and DOS so far. I can boot from floppy and then use the hard drive no problem.

So the question is how can I boot from the floppy and still use Venix. I have tried the supplied boot floppy, but it seems to be a copy of the XFER disk. If I boot from it and abort the install procedure it dumps me at a prompt, but there is no sign in. I have tried mounting the hard disk, but I am given an error that it isn't a block device.

The Venix documentation doesn't seem to handle booting from a floppy other than to restore a damaged system. Any pointers would be welcome.

Thanks!

[1]

chdman createhd -o venix-rd32.chd -chd 820,6,16

[2] https://github.com/mamedev/mame/blob/86aae267863c73ab71092f742666fa7a6bbfc332/src/mame/dec/rainbow.cpp#L43

@Bavarese
Copy link

Bavarese commented Mar 12, 2024

Try the unofficial patch -
mamedev/mame@cdac74d#diff-0ac303c9e425d3f8fbfc936626f35bb9

Note that it targets the state of the driver as of Dec 11, 2019 - and i haven't tested it since.

Basically it

  • removes the CRC check in the BOOT ROM
  • tests for the 5.01 ROM and cures side effects of ERROR 40 and ERROR 60 (no autoboot, hard disk disabled)

It should also work with the 5.05 ROM. You'd have to alter the check, so that it tests for 0x35.

There once was a patch to re-enable the AUTOBOOT feature. I'd have to dig in my old sources...

If you want to help, i'd suggest you improve the hard disk emulation in wd2010.cpp. It was only tested with one drive (and the Rainbow-100-B driver, which uses the very similar WD1010... our use case).

EDIT: Unblock auto-boot feature

Auto boot from drive A to E is now possible (despite error 40). Setting is available via SET UP screen.
In case hard disk is not properly partitioned (x) and you run into a boot loop, please delete the NVRAM file and start over.
mamedev/mame@93a59b6


Commented disassembly of the BOOT ROM -
https://github.com/shattered/retro-bios/blob/master/dec-rainbow100b/8086_DISASSEMBLY_23-022e5-00

Others
https://github.com/shattered/retro-bios/tree/master/dec-rainbow100b

@RenaissanceDork
Copy link
Author

Thank you very much for the additional pointers, @Bavarese. I'm excited to try the workaround for the auto-boot problem and will report back.

As for the unofficial patch you mentioned that removes the CRC check etc., it looks to me as though that is already merged to main, or am I mistaken? I.e. is it not already part of mame?

@Bavarese
Copy link

Bavarese commented Mar 16, 2024

Some (if not all) patches have been removed. This had political reasons and is unfortunate for people who want to actually do something with the driver.

Check that all lines (below) are present at the end of "machine_start". Also add a

#define WORKAROUND_RAINBOW_B

to activate the section.

Enable Autoboot in BIOS. Save and soft restart. Check NVRAM values for persistence (as NVRAM corruption is possible).

Reroute F3 as shown in the PDF, as it does a hard restart of Mame (which is often not what you want).

Note that the driver is unmaintained since 2019, so it is possible functionality worsened. It will likely compile without errors, though.

I promise to check the current status if time permits.

void rainbow_state::machine_start()
{
...code here not given/ subject to change

#ifdef WORKAROUND_RAINBOW_B
	uint8_t *rom = memregion("maincpu")->base();
	if (rom[0xf4000 + 0x3ffc] == 0x31) // 100-B (5.01)    0x35 would test for V5.05
	{
		rom[0xf4000 + 0x0303] = 0x00; // disable CRC check
		rom[0xf4000 + 0x135e] = 0x00; // in case of Z80 RESPONSE FAILURE ($80 bit set in AL), do not block floppy access.

		rom[0xf4000 + 0x198F] = 0xeb; // cond.JMP to uncond.JMP (disables error message 60...)

		rom[0xf4000 + 0x315D] = 0x00; // AND DL,0 (make sure DL is zero before ROM_Initialize7201)
		rom[0xf4000 + 0x315E] = 0xe2;
		rom[0xf4000 + 0x315F] = 0x02;

		rom[0xf4000 + 0x8aa] = 0x01;  // VENIX BOOT FIX  [15/01/20]  Please use WUTIL 3.2.
		rom[0xf4000 + 0x03d8] = 0x00; // AUTO-BOOT patch
	}
#endif
}

EDIT: the auto boot feature is actually quite error prone in emulation. That's why i have added a popup message in the (rejected) patch above. You might want to add the NVRAM location query to 0xdb and the popmessage.

NVRAM_LOCATION = m_p_nvram[0xdb];
...

printf("\n **** COMM HANDLER INSTALLED **** ");
if(m_p_nvram[0xab]!= 0x00)
popmessage("Autoboot from drive %c", 64 + m_p_nvram[0xab]);
}

@RenaissanceDork
Copy link
Author

Sorry for the delay, @Bavarese. But thank you so much for your patience and detailed suggestions. With your help, I was able to get autoboot working on the latest release of Mame and have successfully booted my Venix installation! I haven't had much time lately (hence how long it took me to test this) to get beyond booting and basic testing, so I will report back more later. But I wanted to give you a positive sign of life and express my appreciation. More to follow!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants