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

Quark Catalyst V3 & BeagleWrite crash #400

Closed
tomcw opened this Issue Apr 5, 2017 · 13 comments

Comments

Projects
None yet
4 participants
@tomcw
Contributor

tomcw commented Apr 5, 2017

Reported by Marco Verpelli, on cea2 "Quark Catalyst V3 crash with AppleWin 1.26.2.0 & 1.26.2.1":

I am using the LoGo version available at
http://www.brutaldeluxe.fr/crack/quark_catalyst_v3_logo.po

Add to the list: Beaglewrite.
Perhaps something to do with interrupt and mouse

NB. These versions are both experimental.

I know, and continue to use 1.26.1.1.
If you turn off mouse interface in slot 4, both program starts.
No problems with: Mouse Paint, Geos, DazzleDraw, Mouse Desktop Toolkit, Mouse Calc, Instant Pascal and Apple II Desktop.

@tomcw tomcw self-assigned this Apr 5, 2017

@tomcw

This comment has been minimized.

Show comment
Hide comment
@tomcw

tomcw Apr 5, 2017

Contributor

I can repro with both quark_catalyst_v3_logo.po & BeagleWriteP8.po (800KB file).

I have isolated the change to the MemSetPaging() change at 87862bc.

Contributor

tomcw commented Apr 5, 2017

I can repro with both quark_catalyst_v3_logo.po & BeagleWriteP8.po (800KB file).

I have isolated the change to the MemSetPaging() change at 87862bc.

@tomcw

This comment has been minimized.

Show comment
Hide comment
@tomcw

tomcw Apr 5, 2017

Contributor

In MemSetPaging(), if I ignore the write flag (so do the same for a write as I'm already doing for a read) then Quark Catalyst works (but a2audit v1.04 fails the LC test).

Contributor

tomcw commented Apr 5, 2017

In MemSetPaging(), if I ignore the write flag (so do the same for a write as I'm already doing for a read) then Quark Catalyst works (but a2audit v1.04 fails the LC test).

@tomcw

This comment has been minimized.

Show comment
Hide comment
@tomcw

tomcw Apr 5, 2017

Contributor

This seems to fix it (but only tested Quark Catalyst, BeagleWrite & a2audit):

Changed from:

		if (!write)	// GH#392
		{
			SetMemMode(memmode & ~(MF_WRITERAM));
			BOOL bWriteRam = (address & 1);
			if (g_bLastWriteRam && bWriteRam)
				SetMemMode(memmode | MF_WRITERAM);
			g_bLastWriteRam = bWriteRam;
		}
		else
		{
			g_bLastWriteRam = 0;
		}

to:

		SetMemMode(memmode & ~(MF_WRITERAM));
		BOOL bWriteRam = (address & 1);
		if (g_bLastWriteRam && bWriteRam)
			SetMemMode(memmode | MF_WRITERAM);

		if (!write)	// GH#392
			g_bLastWriteRam = bWriteRam;
		else
			g_bLastWriteRam = 0;
Contributor

tomcw commented Apr 5, 2017

This seems to fix it (but only tested Quark Catalyst, BeagleWrite & a2audit):

Changed from:

		if (!write)	// GH#392
		{
			SetMemMode(memmode & ~(MF_WRITERAM));
			BOOL bWriteRam = (address & 1);
			if (g_bLastWriteRam && bWriteRam)
				SetMemMode(memmode | MF_WRITERAM);
			g_bLastWriteRam = bWriteRam;
		}
		else
		{
			g_bLastWriteRam = 0;
		}

to:

		SetMemMode(memmode & ~(MF_WRITERAM));
		BOOL bWriteRam = (address & 1);
		if (g_bLastWriteRam && bWriteRam)
			SetMemMode(memmode | MF_WRITERAM);

		if (!write)	// GH#392
			g_bLastWriteRam = bWriteRam;
		else
			g_bLastWriteRam = 0;
@tomcw

This comment has been minimized.

Show comment
Hide comment
@tomcw

tomcw Apr 5, 2017

Contributor

Hmm... but the above patch doesn't allow Gemstone Warrior to boot (#395).

EDIT (14/4/2017): The above code will write-protect LC on the 2nd write to (eg) $C081, as g_bLastWriteRam gets set to zero at the end of this code block. I've raised a new request for a2audit here.

Contributor

tomcw commented Apr 5, 2017

Hmm... but the above patch doesn't allow Gemstone Warrior to boot (#395).

EDIT (14/4/2017): The above code will write-protect LC on the 2nd write to (eg) $C081, as g_bLastWriteRam gets set to zero at the end of this code block. I've raised a new request for a2audit here.

@sicklittlemonkey

This comment has been minimized.

Show comment
Hide comment
@sicklittlemonkey

sicklittlemonkey Apr 5, 2017

Contributor

Yes, was the bug I saw - some of that behaviour occurs on a read. Will have a look tonight.

Contributor

sicklittlemonkey commented Apr 5, 2017

Yes, was the bug I saw - some of that behaviour occurs on a read. Will have a look tonight.

@sicklittlemonkey

This comment has been minimized.

Show comment
Hide comment
@sicklittlemonkey

sicklittlemonkey Apr 7, 2017

Contributor

I don't have time to check it in, but the following should be right.
Note: there are some errors in Sather's book, but he restates things enough to find them.

		if (address & 1)	// GH#392
		{
			if (!write && g_bLastWriteRam)
			{
				SetMemMode(memmode | MF_WRITERAM); // UTAIIe:5-23
			}
		}
		else
		{
			SetMemMode(memmode & ~(MF_WRITERAM)); // UTAIIe:5-23
		}
		g_bLastWriteRam = (address & 1) && (!write); // UTAIIe:5-23

Contributor

sicklittlemonkey commented Apr 7, 2017

I don't have time to check it in, but the following should be right.
Note: there are some errors in Sather's book, but he restates things enough to find them.

		if (address & 1)	// GH#392
		{
			if (!write && g_bLastWriteRam)
			{
				SetMemMode(memmode | MF_WRITERAM); // UTAIIe:5-23
			}
		}
		else
		{
			SetMemMode(memmode & ~(MF_WRITERAM)); // UTAIIe:5-23
		}
		g_bLastWriteRam = (address & 1) && (!write); // UTAIIe:5-23

@tomcw

This comment has been minimized.

Show comment
Hide comment
@tomcw

tomcw Apr 7, 2017

Contributor

Thanks for digging into this.
I won't have time to check this until next week.

Contributor

tomcw commented Apr 7, 2017

Thanks for digging into this.
I won't have time to check this until next week.

@sicklittlemonkey

This comment has been minimized.

Show comment
Hide comment
@sicklittlemonkey

sicklittlemonkey Apr 7, 2017

Contributor

Tested Quark Catalyst, BeagleWrite and Gemstone Warrior.

Contributor

sicklittlemonkey commented Apr 7, 2017

Tested Quark Catalyst, BeagleWrite and Gemstone Warrior.

@peterferrie

This comment has been minimized.

Show comment
Hide comment
@peterferrie

peterferrie Apr 8, 2017

It's not clear to me that this is completely correct, but I didn't find anything wrong with Sather.
You might check src\devices\bus\a2bus\ramcard16k.cpp in MAME to see if the implementation matches.

peterferrie commented Apr 8, 2017

It's not clear to me that this is completely correct, but I didn't find anything wrong with Sather.
You might check src\devices\bus\a2bus\ramcard16k.cpp in MAME to see if the implementation matches.

@sicklittlemonkey

This comment has been minimized.

Show comment
Hide comment
@sicklittlemonkey

sicklittlemonkey Apr 8, 2017

Contributor
Contributor

sicklittlemonkey commented Apr 8, 2017

@sicklittlemonkey

This comment has been minimized.

Show comment
Hide comment
@sicklittlemonkey

sicklittlemonkey Apr 8, 2017

Contributor

Here's the language card logic spreadsheet as ODS and XSLX created by LibreOffice.

(I did attach it to my previous email, but GitHub discarded it. In fact it doesn't support attaching ODS, and doesn't recognize the LibreOffice created XSLX to allow it. So ZIP it is.)

LanguageCardSpreadsheet.zip

Contributor

sicklittlemonkey commented Apr 8, 2017

Here's the language card logic spreadsheet as ODS and XSLX created by LibreOffice.

(I did attach it to my previous email, but GitHub discarded it. In fact it doesn't support attaching ODS, and doesn't recognize the LibreOffice created XSLX to allow it. So ZIP it is.)

LanguageCardSpreadsheet.zip

@Michaelangel007

This comment has been minimized.

Show comment
Hide comment
@Michaelangel007

Michaelangel007 Apr 12, 2017

Contributor

Nick, I appreciate you including both the LibreOffice and Excel file! Thanks!

Here it is in plain text -- well markup ;-) -- for future reference:
I also took the liberty of cleanup the row headers

Address Bits R/W Bank HRamR PreWrite HRamW
C080 0000 R 2 1 0 0
C080 0000 W 2 1 0 0
C081 0001 R 2 0 1 1*
C081 0001 W 2 0 0 -
C082 0010 R 2 0 0 0
C082 0010 W 2 0 0 0
C083 0011 R 2 1 1 1*
C083 0011 W 2 1 0 -
C084 0100 R 2 1 0 0
C084 0100 W 2 1 0 0
C085 0101 R 2 0 1 1*
C085 0101 W 2 0 0 -
C086 0110 R 2 0 0 0
C086 0110 W 2 0 0 0
C087 0111 R 2 1 1 1*
C087 0111 W 2 1 0 -
C088 1000 R 1 1 0 0
C088 1000 W 1 1 0 0
C089 1001 R 1 0 1 1*
C089 1001 W 1 0 0 -
C08A 1010 R 1 0 0 0
C08A 1010 W 1 0 0 0
C08B 1011 R 1 1 1 1*
C08B 1011 W 1 1 0 -
C08C 1100 R 1 1 0 0
C08C 1100 W 1 1 0 0
C08D 1101 R 1 0 1 1*
C08D 1101 W 1 0 0 -
C08E 1110 R 1 0 0 0
C08E 1110 W 1 0 0 0
C08F 1111 R 1 1 1 1*
C08F 1111 W 1 1 0 -

Edit: to remove TABS

Contributor

Michaelangel007 commented Apr 12, 2017

Nick, I appreciate you including both the LibreOffice and Excel file! Thanks!

Here it is in plain text -- well markup ;-) -- for future reference:
I also took the liberty of cleanup the row headers

Address Bits R/W Bank HRamR PreWrite HRamW
C080 0000 R 2 1 0 0
C080 0000 W 2 1 0 0
C081 0001 R 2 0 1 1*
C081 0001 W 2 0 0 -
C082 0010 R 2 0 0 0
C082 0010 W 2 0 0 0
C083 0011 R 2 1 1 1*
C083 0011 W 2 1 0 -
C084 0100 R 2 1 0 0
C084 0100 W 2 1 0 0
C085 0101 R 2 0 1 1*
C085 0101 W 2 0 0 -
C086 0110 R 2 0 0 0
C086 0110 W 2 0 0 0
C087 0111 R 2 1 1 1*
C087 0111 W 2 1 0 -
C088 1000 R 1 1 0 0
C088 1000 W 1 1 0 0
C089 1001 R 1 0 1 1*
C089 1001 W 1 0 0 -
C08A 1010 R 1 0 0 0
C08A 1010 W 1 0 0 0
C08B 1011 R 1 1 1 1*
C08B 1011 W 1 1 0 -
C08C 1100 R 1 1 0 0
C08C 1100 W 1 1 0 0
C08D 1101 R 1 0 1 1*
C08D 1101 W 1 0 0 -
C08E 1110 R 1 0 0 0
C08E 1110 W 1 0 0 0
C08F 1111 R 1 1 1 1*
C08F 1111 W 1 1 0 -

Edit: to remove TABS

@tomcw

This comment has been minimized.

Show comment
Hide comment
@tomcw

tomcw Apr 15, 2017

Contributor

Thanks Nick for reworking & fixing the LC code.
I've built, tested and pre-released a new AppleWin 1.26.2.2 version here.

Contributor

tomcw commented Apr 15, 2017

Thanks Nick for reworking & fixing the LC code.
I've built, tested and pre-released a new AppleWin 1.26.2.2 version here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment