6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sat Nov 16, 2024 4:12 pm

All times are UTC




Post new topic Reply to topic  [ 213 posts ]  Go to page Previous  1 ... 5, 6, 7, 8, 9, 10, 11 ... 15  Next
Author Message
 Post subject: Re: Breaking 6502 apart
PostPosted: Thu Oct 04, 2012 7:28 pm 
Offline
User avatar

Joined: Fri Jun 22, 2012 7:39 am
Posts: 201
I try to explain my simulation of whole /NMI pin logic.

Overview:
Image

So I simulate output as follow:

Code:
        b = NOR ( NAND(NOT(NMI_PAD), PHI2), NMI_LATCH);
        NMI_LATCH = NOR ( NAND(NMI_PAD, PHI2), b );
        OUTPUT_LINE = NOT(NMI_LATCH);

(b is temporary value)

I drawn NAND/NOR counterpart of trigger on picture. So I think we need those "~".

As output I'm getting following data:

Code:
L N Ф  L*O
0 0 0 | 0 1
0 0 1 | 0 1
0 1 0 | 0 1
0 1 1 | 1 0
1 0 0 | 0 1
1 0 1 | 0 1
1 1 0 | 0 1
1 1 1 | 1 0

Where :
L - latch value before iteration
N - NMI pin level
Ф - PHI2
L* - latch value after iteration
O - output line

And it even worse, if you try to simulate /IRQ. It has additional PHI1 transfer gate + latch as output. In that case I'm getting only '1's on out.


Attachments:
MISC_trans.png
MISC_trans.png [ 260.64 KiB | Viewed 1762 times ]

_________________
6502 addict


Last edited by org on Fri Oct 05, 2012 6:35 am, edited 1 time in total.
Top
 Profile  
Reply with quote  
 Post subject: Re: Breaking 6502 apart
PostPosted: Thu Oct 04, 2012 7:52 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10980
Location: England
It's not a nor of a NAND: it's a nor of an and.


Top
 Profile  
Reply with quote  
 Post subject: Re: Breaking 6502 apart
PostPosted: Fri Oct 05, 2012 6:17 am 
Offline
User avatar

Joined: Fri Jun 22, 2012 7:39 am
Posts: 201
Indeed, this is NOR of ANDs, I just checked truth table, thanks ))) Now everything works good )

Transition states of /NMI output line:
Code:
L I Ф |L* O
0 0 0 | 0 1
0 0 1 | 1 0
0 1 0 | 0 1
0 1 1 | 0 1
1 0 0 | 1 0
1 0 1 | 1 0
1 1 0 | 1 0
1 1 1 | 0 1


Transition stated of /IRQ and RES lines (both have additional output static latch):
Code:
L I P |L* O
0 0 0 | 0 1
0 0 1 | 0 1
0 1 0 | 0 1
0 1 1 | 1 1
1 0 0 | 1 0
1 0 1 | 0 0
1 1 0 | 1 0
1 1 1 | 1 0


Simulation can be found here:
http://code.google.com/p/breaks/source/ ... SRC/MISC.c

(I added some convenient macros like NAND / NOR, to increase source code readability)

Also I started my 6502 debugger:
Image
It may look more complicated, than other 6502 debuggers you've seen before :)

_________________
6502 addict


Top
 Profile  
Reply with quote  
 Post subject: Re: Breaking 6502 apart
PostPosted: Fri Oct 05, 2012 6:31 am 
Offline
User avatar

Joined: Fri Jun 22, 2012 7:39 am
Posts: 201
And another thing I want to show you:

http://ogamespec.com/6502/PLA.htm

This is tracing of PLA lines for every opcode on each cycle.

_________________
6502 addict


Top
 Profile  
Reply with quote  
 Post subject: Re: Breaking 6502 apart
PostPosted: Fri Oct 05, 2012 6:35 am 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10980
Location: England
Great stuff!
Have you tried to run your Breaks6502.exe on Linux using WINE? I'm willing to try it if you make the exe available (maybe in a zip file)
Cheers
Ed


Top
 Profile  
Reply with quote  
 Post subject: Re: Breaking 6502 apart
PostPosted: Fri Oct 05, 2012 6:39 am 
Offline
User avatar

Joined: Fri Jun 22, 2012 7:39 am
Posts: 201
It should run under WINE without any trouble. I'm using plain winapi.

Here:
http://code.google.com/p/breaks/source/ ... runk/Build

_________________
6502 addict


Top
 Profile  
Reply with quote  
 Post subject: Re: Breaking 6502 apart
PostPosted: Fri Oct 05, 2012 7:00 am 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10980
Location: England
Thanks - it does open the front panel and another window! Some but not all checkboxes work, and the Step button causes the clocks to toggle and produces some output on the console. (I don't see anything in the second window)
Code:
$ ./Breaks.exe
Debug console opened
IR unchanged: PHI1=0 / fetch=0

IR unchanged: PHI1=1 / fetch=0

IR unchanged: PHI1=0 / fetch=0

IR unchanged: PHI1=1 / fetch=0

This is a good sign, I think, for Linux users.
Cheers
Ed


Top
 Profile  
Reply with quote  
 Post subject: Re: Breaking 6502 apart
PostPosted: Fri Oct 05, 2012 7:08 am 
Offline
User avatar

Joined: Fri Jun 22, 2012 7:39 am
Posts: 201
Quote:
Some but not all checkboxes work

Its not ready yet :) I'm going to start simulate random logic soon. Most interesting part of my research )

_________________
6502 addict


Top
 Profile  
Reply with quote  
 Post subject: Re: Breaking 6502 apart
PostPosted: Fri Oct 05, 2012 7:21 am 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10980
Location: England
org wrote:
Its not ready yet :) I'm going to start simulate random logic soon. Most interesting part of my research )

Understood - look forward to more updates!


Top
 Profile  
Reply with quote  
 Post subject: Re: Breaking 6502 apart
PostPosted: Thu Oct 11, 2012 10:20 am 
Offline
User avatar

Joined: Fri Jun 22, 2012 7:39 am
Posts: 201
Fixed some errors in PCL circuit and completed Program Counter increment logic.

I do not know why PCHS/PCLS registers are get inverted after every PC increment.

For example when PCHS/PCLS=0x1234 incremented, it become 0xEDCA (inverted 0x1235). So if you try to increment it again, without altering PCHS/PCLS it become again 0x1234 (inverted 0xEDCB) :mrgreen:

I guess PCHS/PCLS is additionally inverted somewhere through ADH/ADL bus for example (since PC is connected to ADx bus via some drivers)

PC get incremented when IPC driver become low.

_________________
6502 addict


Top
 Profile  
Reply with quote  
 Post subject: Re: Breaking 6502 apart
PostPosted: Fri Oct 12, 2012 12:29 pm 
Offline
User avatar

Joined: Fri Jun 22, 2012 7:39 am
Posts: 201
Completed Predecode logic simulation.

Predecode has two outputs : /TWOCYCLE and /IMPLIED.

Predecode determine whenever instruction takes 2 cycles to execute or it has no operands (implied).

Two-cycles instructions are actually all implied (except push/pull) + ALU operations with immediate operand.

I attached screenshots with list of 2-cycle and implied 6502 instructions.


Attachments:
PD_TWOCYCLE.jpg
PD_TWOCYCLE.jpg [ 247.79 KiB | Viewed 1704 times ]
PD_IMPLIED.jpg
PD_IMPLIED.jpg [ 250.38 KiB | Viewed 1704 times ]

_________________
6502 addict
Top
 Profile  
Reply with quote  
 Post subject: Re: Breaking 6502 apart
PostPosted: Fri Oct 12, 2012 12:43 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10980
Location: England
Do you still have the inverting PC problem? I think it must be a bug - I'm pretty sure I've never seen it on visual6502.


Top
 Profile  
Reply with quote  
 Post subject: Re: Breaking 6502 apart
PostPosted: Fri Oct 12, 2012 12:55 pm 
Offline
User avatar

Joined: Fri Jun 22, 2012 7:39 am
Posts: 201
I'm going to research reset sequence, to know more details on PC updating, so it must be fixed.

I cannot detect bug, by looking from inside of PC logic.

_________________
6502 addict


Top
 Profile  
Reply with quote  
 Post subject: Re: Breaking 6502 apart
PostPosted: Wed Nov 14, 2012 11:21 pm 
Offline
User avatar

Joined: Fri Jun 22, 2012 7:39 am
Posts: 201
In case you guys remember me, I started my own site for Breaks project:

http://breaknes.com/

And I'm gonna return to 6502 soon, I have some progress to show you )

_________________
6502 addict


Top
 Profile  
Reply with quote  
 Post subject: Re: Breaking 6502 apart
PostPosted: Thu Nov 15, 2012 7:05 am 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10980
Location: England
Very nice - I'm surprised that Icc isn't the best compiler for Intel.

How much 6502 simulation is working now? Can you run short instruction sequences?

Cheers
Ed


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 213 posts ]  Go to page Previous  1 ... 5, 6, 7, 8, 9, 10, 11 ... 15  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: