Work on the Minimig core?

https://github.com/mist-devel/mist-board/wiki

Moderators: Mug UK, Zorro 2, Greenious, spiny, Moderator Team

User avatar
MasterOfGizmo
Atari God
Atari God
Posts: 1310
Joined: Fri Feb 08, 2013 12:15 pm
Contact:

Re: Work on the Minimig core?

Postby MasterOfGizmo » Sat Nov 09, 2019 9:12 pm

fpgaarcade wrote:I thought the plan was to treat TB's repos as master
https://github.com/TobiFlex/TG68K.C


Yes, that was my understanding as well. And use this as a submodule in the cores depending on it.
MIST board, FPGA based Atari STE and more: https://github.com/mist-devel/mist-board/wiki

fpgaarcade
Obsessive compulsive Atari behavior
Obsessive compulsive Atari behavior
Posts: 104
Joined: Thu Sep 20, 2007 10:06 pm
Location: Sweden

Re: Work on the Minimig core?

Postby fpgaarcade » Sat Nov 09, 2019 9:21 pm

I think it's the only way to go.
IMO If people copy code into cores (and lets face it submodule is a pain) we should make it clear it's a copy and point at the master.

slingshot
Atari God
Atari God
Posts: 1345
Joined: Mon Aug 06, 2018 3:05 pm

Re: Work on the Minimig core?

Postby slingshot » Sat Nov 09, 2019 9:30 pm

I think submodules are still better than copying files back and forth, loosing all the history. And updating your main repo for a submodule is only issuing some git commands, no need to copy a single file. Also forces better code for a component, since no local hacks allowed.
If agreed then, I'll merge the "tobiflex" branch soon into master (it has https://github.com/TobiFlex/TG68K.C as a submodule for the CPU) for minimig-mist.

User avatar
MasterOfGizmo
Atari God
Atari God
Posts: 1310
Joined: Fri Feb 08, 2013 12:15 pm
Contact:

Re: Work on the Minimig core?

Postby MasterOfGizmo » Sun Nov 10, 2019 4:59 pm

I also vote for submodules. We are already doing this in a few cores e.g. with jategos audio cores.
MIST board, FPGA based Atari STE and more: https://github.com/mist-devel/mist-board/wiki

tobiflex
Atariator
Atariator
Posts: 29
Joined: Thu Oct 17, 2019 7:00 am

Re: Work on the Minimig core?

Postby tobiflex » Sun Nov 10, 2019 7:00 pm

tobiflex wrote:
apolkosnik wrote:
slingshot wrote:I see you commented this:
https://github.com/TobiFlex/TG68K.C/blo ... l.vhd#L708
That fixed Pinball Illusions (not sure in what instruction).

Yeah, it looks like the fix is not in, as Pinball Illusions crashes when you load the table with the latest TG68K.C from git (tested on MiSTer)

OK, i put it in. Can you test then Pinball again, please?


This fix destory the pack and unpack opcodes.

I has inserted the TRAPcc opcode in the Core. Now works the NEXUS7 DEMO. Jippi!!!

slingshot
Atari God
Atari God
Posts: 1345
Joined: Mon Aug 06, 2018 3:05 pm

Re: Work on the Minimig core?

Postby slingshot » Sun Nov 10, 2019 8:41 pm

tobiflex wrote:This fix destory the pack and unpack opcodes.


Actually I got it when I compared TG68K with M68K:
https://github.com/FPGAArcade/replay_co ... k.vhd#L722
And it fixed Pinball Illusions magically.
Maybe Mike knows what it supposed to do?

Something throws a Trace exception without that "fix" (even in your latest version with TRAPcc).

tobiflex
Atariator
Atariator
Posts: 29
Joined: Thu Oct 17, 2019 7:00 am

Re: Work on the Minimig core?

Postby tobiflex » Sun Nov 10, 2019 9:10 pm

slingshot wrote:
Something throws a Trace exception without that "fix" (even in your latest version with TRAPcc).

In Pinball?

apolkosnik
Atari freak
Atari freak
Posts: 69
Joined: Sat May 18, 2019 3:20 pm

Re: Work on the Minimig core?

Postby apolkosnik » Sun Nov 10, 2019 9:16 pm

tobiflex wrote:
tobiflex wrote:
apolkosnik wrote:Yeah, it looks like the fix is not in, as Pinball Illusions crashes when you load the table with the latest TG68K.C from git (tested on MiSTer)

OK, i put it in. Can you test then Pinball again, please?


This fix destory the pack and unpack opcodes.

I has inserted the TRAPcc opcode in the Core. Now works the NEXUS7 DEMO. Jippi!!!

Sounds good, but Nexus7 demo was fully functional on the MiSTer core.
It looks like Pinball Illusions crashes in the middle of scrolling of the table that just loaded.
I just built MiSTer with your latest commit, and I ran 68020 tests with Tony's cputester, results attached. It looks like there's still some instructions that throw wrong exceptions, even CHK and RTE.
You do not have the required permissions to view the files attached to this post.

slingshot
Atari God
Atari God
Posts: 1345
Joined: Mon Aug 06, 2018 3:05 pm

Re: Work on the Minimig core?

Postby slingshot » Sun Nov 10, 2019 9:17 pm

tobiflex wrote:
slingshot wrote:
Something throws a Trace exception without that "fix" (even in your latest version with TRAPcc).

In Pinball?

Yepp. When it aborts, it does with a trace exception. But it might be only a symptom, the code probably went to a wrong branch before that.
Last edited by slingshot on Sun Nov 10, 2019 9:24 pm, edited 1 time in total.

slingshot
Atari God
Atari God
Posts: 1345
Joined: Mon Aug 06, 2018 3:05 pm

Re: Work on the Minimig core?

Postby slingshot » Sun Nov 10, 2019 9:20 pm

apolkosnik wrote:I just built MiSTer with your latest commit, and I ran 68020 tests with Tony's cputester, results attached. It looks like there's still some instructions that throw wrong exceptions, even CHK and RTE.

RTE just "complains" because the Format Error exception is not implemented.

tobiflex
Atariator
Atariator
Posts: 29
Joined: Thu Oct 17, 2019 7:00 am

Re: Work on the Minimig core?

Postby tobiflex » Sun Nov 10, 2019 9:32 pm

apolkosnik wrote:Sounds good, but Nexus7 demo was fully functional on the MiSTer core.
It looks like Pinball Illusions crashes in the middle of scrolling of the table that just loaded.
I just built MiSTer with your latest commit, and I ran 68020 tests with Tony's cputester, results attached. It looks like there's still some instructions that throw wrong exceptions, even CHK and RTE.


CHK: "Exception ID: expected 0 but got 6" - is here the stackframe wrong?
RTE cputester test all exceptions. But the TG68 create at the moment only exceptions with stackframe #0 and stackframe #2. The RTE in TG68 can handle SF#0 and SF#2 but no others.
Last edited by tobiflex on Sun Nov 10, 2019 9:39 pm, edited 1 time in total.

tobiflex
Atariator
Atariator
Posts: 29
Joined: Thu Oct 17, 2019 7:00 am

Re: Work on the Minimig core?

Postby tobiflex » Sun Nov 10, 2019 9:35 pm

apolkosnik wrote:Sounds good, but Nexus7 demo was fully functional on the MiSTer core.

really?

slingshot
Atari God
Atari God
Posts: 1345
Joined: Mon Aug 06, 2018 3:05 pm

Re: Work on the Minimig core?

Postby slingshot » Sun Nov 10, 2019 9:40 pm

tobiflex wrote:CHK: "Exception ID: expected 0 but got 6" - is here the stackframe wrong?

On MiST, CHK only complains about a flag (e.g. SR expected 000b, but got 0009)
In this MiSTer log, something must be wrong with the test setup, since even Address registers have a difference.
A7: modified 4107fbc0 -> 41040004 but expected no modifications <= this doesn't happen for me

slingshot
Atari God
Atari God
Posts: 1345
Joined: Mon Aug 06, 2018 3:05 pm

Re: Work on the Minimig core?

Postby slingshot » Sun Nov 10, 2019 9:41 pm

tobiflex wrote:
apolkosnik wrote:Sounds good, but Nexus7 demo was fully functional on the MiSTer core.

really?

Actually it worked on MiST for me if I turned on Turbochipram :)

slingshot
Atari God
Atari God
Posts: 1345
Joined: Mon Aug 06, 2018 3:05 pm

Re: Work on the Minimig core?

Postby slingshot » Sun Nov 10, 2019 10:59 pm

tobiflex wrote:This fix destory the pack and unpack opcodes.

This one also enough for pinball:

Code: Select all

ELSIF setstate = "10" AND write_back = '1' AND (opcode(15 downto 12)/="0100" or next_micro_state = idle) THEN

Will do some more test later to find out the exact instruction, at least we know it's from the "rts group"

User avatar
retrofun
Atari freak
Atari freak
Posts: 52
Joined: Sat Jan 12, 2019 3:12 pm

Re: Work on the Minimig core?

Postby retrofun » Sun Nov 10, 2019 11:05 pm

Yep, Nexus7 demo requires Turbochipram or it will wait forever(?) after the intro credits, https://github.com/rkrajnc/minimig-mist/issues/67
Worked fine for me too.

Tried minimig-mist with the TG68K.C submodule. Short summary:
  • some more WHDLoad games now work. Most likely due to the exception handling fixes.
  • great improvements concerning the cputests for 68020
  • CHK.W cputest worked for 68000, it is broken now:

    Code: Select all

    @@ -319,10 +319,20 @@
     Test: 00300000-00380000 Safe: ffffffff-ffffffff
     CHK.W:
     data/68000/CHK.W/0000.dat. 0...
    -data/68000/CHK.W/0001.dat. 3478...
    -data/68000/CHK.W/0002.dat. 5902...
    -data/68000/CHK.W/0003.dat. 7964...
    -All tests complete (total 7964).
    +
    +2:     4181    chk.w    d1,d0
    +SR: modified 0400 -> 0401 but expected no modifications
    +Registers before:
    +D0: 00000010 D1: 00000000 D2: ffffffff D3: ffffff00
    +D4: ffff0000 D5: 80008080 D6: 7fff7fff D7: aaaaaaaa
    +A0: 00000000 A1: 00000080 A2: 00008000 A3: 00007fff
    +A4: fffffffe A5: ffffff00 A6: 0033ff00 A7: 0037fbc0
    +SR: 0400   PC: 00340000 ISP: 0037ff80
    +T1=0 T0=0 S=0 M=0 X=0 N=0 Z=0 V=0 C!0
    +Registers after:
    +SR: 0401   PC: 00340002 ISP: 0037ff80
    +T1=0 T0=0 S=0 M=0 X=0 N=0 Z=0 V=0 C!1
    +OK: Generated exception 6
  • some fixes still missing. SR fix for 68000/68010 -> https://github.com/TobiFlex/TG68K.C/pull/2

apolkosnik
Atari freak
Atari freak
Posts: 69
Joined: Sat May 18, 2019 3:20 pm

Re: Work on the Minimig core?

Postby apolkosnik » Mon Nov 11, 2019 2:31 am

slingshot wrote:
tobiflex wrote:This fix destory the pack and unpack opcodes.

This one also enough for pinball:

Code: Select all

ELSIF setstate = "10" AND write_back = '1' AND (opcode(15 downto 12)/="0100" or next_micro_state = idle) THEN

Will do some more test later to find out the exact instruction, at least we know it's from the "rts group"

This worked nicely, and Pinball Illusions worked well. No issues with pack/unpack, passes the cputest on 020.

slingshot
Atari God
Atari God
Posts: 1345
Joined: Mon Aug 06, 2018 3:05 pm

Re: Work on the Minimig core?

Postby slingshot » Mon Nov 11, 2019 9:45 am

apolkosnik wrote:This worked nicely, and Pinball Illusions worked well. No issues with pack/unpack, passes the cputest on 020.

Yes, but still hacky, however if I can narrow the condition to one instruction, then it can be fixed there.

slingshot
Atari God
Atari God
Posts: 1345
Joined: Mon Aug 06, 2018 3:05 pm

Re: Work on the Minimig core?

Postby slingshot » Mon Nov 11, 2019 6:32 pm

tobiflex wrote:
This fix destory the pack and unpack opcodes.

Narrowed down to the CLR instruction:

Code: Select all

ELSIF setstate = "10" AND write_back = '1' AND (opcode(15 downto 8)/=x"42" or next_micro_state = idle) THEN

Maybe you have an idea what's wrong with that without the hack? Something is zeroed out what shouldn't I think.

tobiflex
Atariator
Atariator
Posts: 29
Joined: Thu Oct 17, 2019 7:00 am

Re: Work on the Minimig core?

Postby tobiflex » Mon Nov 11, 2019 10:06 pm

slingshot wrote:
tobiflex wrote:
This fix destory the pack and unpack opcodes.

Narrowed down to the CLR instruction:

Code: Select all

ELSIF setstate = "10" AND write_back = '1' AND (opcode(15 downto 8)/=x"42" or next_micro_state = idle) THEN

Maybe you have an idea what's wrong with that without the hack? Something is zeroed out what shouldn't I think.


It looks like a runtime error. The opcode after the CLR is important. Which instruction follows CLR?

tobiflex
Atariator
Atariator
Posts: 29
Joined: Thu Oct 17, 2019 7:00 am

Re: Work on the Minimig core?

Postby tobiflex » Mon Nov 11, 2019 10:08 pm

it could be another write back instruction with a different operand size

slingshot
Atari God
Atari God
Posts: 1345
Joined: Mon Aug 06, 2018 3:05 pm

Re: Work on the Minimig core?

Postby slingshot » Tue Nov 12, 2019 7:49 am

tobiflex wrote:
It looks like a runtime error. The opcode after the CLR is important. Which instruction follows CLR?

Not sure, because the exception happens way after the CLR. And there are multiple CLRs are executed until the issue happens.

tobiflex
Atariator
Atariator
Posts: 29
Joined: Thu Oct 17, 2019 7:00 am

Re: Work on the Minimig core?

Postby tobiflex » Mon Nov 18, 2019 8:30 am

I have found the pinballbug.
Line 905: ELSIF state="01" AND exec_write_back='1' THEN
This falsifies the calculation of the addresses for the extended 68020 addressing types.
Line 905: ELSIF execOPC='1' AND exec_write_back='1' THEN
should be right.

Anyway i have change something in the Core.
The CAS and CAS2 instructions are implemented now.
Next i will implement chk2 and cmp2

slingshot
Atari God
Atari God
Posts: 1345
Joined: Mon Aug 06, 2018 3:05 pm

Re: Work on the Minimig core?

Postby slingshot » Mon Nov 18, 2019 5:11 pm

tobiflex wrote:I have found the pinballbug.
Line 905: ELSIF state="01" AND exec_write_back='1' THEN
This falsifies the calculation of the addresses for the extended 68020 addressing types.
Line 905: ELSIF execOPC='1' AND exec_write_back='1' THEN
should be right.


It works, thanks! No more ugly hacks.

Upd.: For some reason it fixed Diggers AGA - but AFAIK it needs CHK2, not CAS2, strange.

tobiflex
Atariator
Atariator
Posts: 29
Joined: Thu Oct 17, 2019 7:00 am

Re: Work on the Minimig core?

Postby tobiflex » Mon Nov 18, 2019 10:58 pm

I have implement my first try of the CHK2 and CMP2 Instructions here: https://github.com/TobiFlex/TG68K.C

But I need help here. Do these instructions do what they should? Who can write examples or test code?
cputester stop with false N- or V- Flag. But this is undefined behavior.


Return to “MiST”

Who is online

Users browsing this forum: No registered users and 9 guests