Work on the Minimig core?

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

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

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

Re: Work on the Minimig core?

Post by MasterOfGizmo »

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?

Post by fpgaarcade »

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: 1873
Joined: Mon Aug 06, 2018 3:05 pm

Re: Work on the Minimig core?

Post by slingshot »

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: 1343
Joined: Fri Feb 08, 2013 12:15 pm
Contact:

Re: Work on the Minimig core?

Post by MasterOfGizmo »

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
Atari User
Atari User
Posts: 33
Joined: Thu Oct 17, 2019 7:00 am

Re: Work on the Minimig core?

Post by tobiflex »

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: 1873
Joined: Mon Aug 06, 2018 3:05 pm

Re: Work on the Minimig core?

Post by slingshot »

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
Atari User
Atari User
Posts: 33
Joined: Thu Oct 17, 2019 7:00 am

Re: Work on the Minimig core?

Post by tobiflex »

slingshot wrote:
Something throws a Trace exception without that "fix" (even in your latest version with TRAPcc).
In Pinball?
apolkosnik
Atari maniac
Atari maniac
Posts: 90
Joined: Sat May 18, 2019 3:20 pm

Re: Work on the Minimig core?

Post by apolkosnik »

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: 1873
Joined: Mon Aug 06, 2018 3:05 pm

Re: Work on the Minimig core?

Post by slingshot »

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: 1873
Joined: Mon Aug 06, 2018 3:05 pm

Re: Work on the Minimig core?

Post by slingshot »

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
Atari User
Atari User
Posts: 33
Joined: Thu Oct 17, 2019 7:00 am

Re: Work on the Minimig core?

Post by tobiflex »

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
Atari User
Atari User
Posts: 33
Joined: Thu Oct 17, 2019 7:00 am

Re: Work on the Minimig core?

Post by tobiflex »

apolkosnik wrote: Sounds good, but Nexus7 demo was fully functional on the MiSTer core.
really?
slingshot
Atari God
Atari God
Posts: 1873
Joined: Mon Aug 06, 2018 3:05 pm

Re: Work on the Minimig core?

Post by slingshot »

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: 1873
Joined: Mon Aug 06, 2018 3:05 pm

Re: Work on the Minimig core?

Post by slingshot »

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: 1873
Joined: Mon Aug 06, 2018 3:05 pm

Re: Work on the Minimig core?

Post by slingshot »

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
Obsessive compulsive Atari behavior
Obsessive compulsive Atari behavior
Posts: 116
Joined: Sat Jan 12, 2019 3:12 pm

Re: Work on the Minimig core?

Post by retrofun »

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 maniac
Atari maniac
Posts: 90
Joined: Sat May 18, 2019 3:20 pm

Re: Work on the Minimig core?

Post by apolkosnik »

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: 1873
Joined: Mon Aug 06, 2018 3:05 pm

Re: Work on the Minimig core?

Post by slingshot »

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: 1873
Joined: Mon Aug 06, 2018 3:05 pm

Re: Work on the Minimig core?

Post by slingshot »

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
Atari User
Atari User
Posts: 33
Joined: Thu Oct 17, 2019 7:00 am

Re: Work on the Minimig core?

Post by tobiflex »

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
Atari User
Atari User
Posts: 33
Joined: Thu Oct 17, 2019 7:00 am

Re: Work on the Minimig core?

Post by tobiflex »

it could be another write back instruction with a different operand size
slingshot
Atari God
Atari God
Posts: 1873
Joined: Mon Aug 06, 2018 3:05 pm

Re: Work on the Minimig core?

Post by slingshot »

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
Atari User
Atari User
Posts: 33
Joined: Thu Oct 17, 2019 7:00 am

Re: Work on the Minimig core?

Post by tobiflex »

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: 1873
Joined: Mon Aug 06, 2018 3:05 pm

Re: Work on the Minimig core?

Post by slingshot »

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
Atari User
Atari User
Posts: 33
Joined: Thu Oct 17, 2019 7:00 am

Re: Work on the Minimig core?

Post by tobiflex »

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.
Post Reply

Return to “MiST”