6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sun Nov 24, 2024 6:25 am

All times are UTC




Post new topic Reply to topic  [ 11 posts ] 
Author Message
PostPosted: Wed Mar 06, 2019 12:39 pm 
Offline

Joined: Sun Feb 24, 2019 1:18 pm
Posts: 11
I'm just starting out a 6502 processor project in Logisim. I've done a less powerful processor this way before. But with 6502 come new concepts like interruptions. I would like to ask some questions and maybe you could direct me to some useful texts.
P.S. The whole project will be made out of logic gates almost entirely.

1. How are interrupts being implemented into a processor? What hardware should be added to make it work?
2. How is instruction pipeling being implemented into a processor?
3. How big is 6502's ROM that is used to decode binary opcode into instructions? (I don't know how it's called, it's the one used by Processor's Controller and can be done without ROM.)
4. How is OS or assembly language written into a processor? What hardware is required for that?



Edit:
Added the "less powerful" processor file at https://github.com/Senijs/SAP-2 and added a picture of it.
The processor was built with reference to Paul Malvino's Simple As Possible computer-2.
The processor has all the instructions of 6502, except the Set/Clear Interrup instructions since there are is not interrupt logic in the hardware. Push/Pull Stack Pointer instructions are also not here since I didn't make a stack pointer for the processor. Some minor instructions are also dismissed like Set/Clear Overflow Flag and Set/Clear Decimal Mode since I found no use in them.
I can write out the opcodes if you want to test the processor.

I also found this diagram of 6502 architecture. http://www.erich-foltyn.eu/Technique/6502.html How accurate is it?
I would like to know what the interrupt logic hardware does exactly.
And is it possible to write the whole Operating System/Assembler in RAM? I'm pretty sure it's impossible. You'd have to at least build ROM and other hardware that will store ASCII code and know how to transfer it to screen.
I coudn't find any information on 6502's ROM size that stores instructions and then executes it when the opcode is telling it to.


Attachments:
SAP-2 diagram.png
SAP-2 diagram.png [ 77.98 KiB | Viewed 524 times ]


Last edited by Senijs on Sat Mar 09, 2019 6:20 pm, edited 1 time in total.
Top
 Profile  
Reply with quote  
PostPosted: Wed Mar 06, 2019 9:28 pm 
Offline
User avatar

Joined: Wed Mar 01, 2017 8:54 pm
Posts: 660
Location: North-Germany
Hi Senijs,

perhaps you can help yourself by studying the material you find at http://visual6502.org/. Just as a start.


Regards,
Arne


Top
 Profile  
Reply with quote  
PostPosted: Wed Mar 06, 2019 10:02 pm 
Offline
User avatar

Joined: Fri Dec 11, 2009 3:50 pm
Posts: 3367
Location: Ontario, Canada
Senijs wrote:
I've done a less powerful processor this way before.
It might be helpful if you could tell us more about this other processor. Then we can comment on similarities and differences as compared to 6502.

-- Jeff

ps- the C74-6502 was originally a Logisim design.

_________________
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html


Top
 Profile  
Reply with quote  
PostPosted: Sat Mar 09, 2019 6:22 pm 
Offline

Joined: Sun Feb 24, 2019 1:18 pm
Posts: 11
Dr Jefyll wrote:
Senijs wrote:
I've done a less powerful processor this way before.
It might be helpful if you could tell us more about this other processor. Then we can comment on similarities and differences as compared to 6502.

-- Jeff

ps- the C74-6502 was originally a Logisim design.


Jeff, thank you for the reply. I updated the post.


Top
 Profile  
Reply with quote  
PostPosted: Sat Mar 09, 2019 6:29 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10986
Location: England
There are many possible implementations which can run a chosen instruction set - you don't necessarily have to follow exactly what the 6502 does on the inside. Indeed, it will be difficult to be exact. But if you want to follow the 6502's cycle counts, or follow the exact sequence of reads, writes, and dummy accesses for each instruction, that will constrain your implementation.

Erich Foltyn's diagram is not quite accurate enough to match the cycle counts, I think, because it lacks the Special Bus. See Donald Hanson's block diagram, as linked here:
http://visual6502.org/wiki/index.php?ti ... ck_Diagram


Top
 Profile  
Reply with quote  
PostPosted: Sat Mar 09, 2019 6:44 pm 
Offline

Joined: Sun Feb 24, 2019 1:18 pm
Posts: 11
BigEd wrote:
There are many possible implementations which can run a chosen instruction set - you don't necessarily have to follow exactly what the 6502 does on the inside. Indeed, it will be difficult to be exact. But if you want to follow the 6502's cycle counts, or follow the exact sequence of reads, writes, and dummy accesses for each instruction, that will constrain your implementation.

Erich Foltyn's diagram is not quite accurate enough to match the cycle counts, I think, because it lacks the Special Bus. See Donald Hanson's block diagram, as linked here:
http://visual6502.org/wiki/index.php?ti ... ck_Diagram


You know, you might be right. I think I'll just make a 6502 work-alike processor that will have 6502 instructions, but will be done differently on the inside. I'll have some fun with it, try to write an OS for it someway. And when I'm familiar with it I will ask on this forum for help to create an actual replica of 6502 (or something extremely close to 6502).
Thank you!


Top
 Profile  
Reply with quote  
PostPosted: Sat Mar 09, 2019 6:56 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10986
Location: England
One or two people here have found that a microcoded machine is a good choice: simple datapath, complexity in the simple-to-update microcode. Same with the Gigatron.


Top
 Profile  
Reply with quote  
PostPosted: Sat Mar 09, 2019 7:29 pm 
Offline

Joined: Sun Feb 24, 2019 1:18 pm
Posts: 11
BigEd wrote:
One or two people here have found that a microcoded machine is a good choice: simple datapath, complexity in the simple-to-update microcode. Same with the Gigatron.


I never heared of microcoded machines before. If I understood correcty what google said, then microcode is the "code" written in microcontroller, which is basically the sequence in which pins must turn on and off for certain instruction to fetch, decode and execute. If you're suggesting to build a processor that way, I already did with my processor mentioned in description and I will do my new 6502-ish processor the same way.


Top
 Profile  
Reply with quote  
PostPosted: Sat Mar 09, 2019 8:53 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10986
Location: England
Ah, well maybe you have!

If there's a microprogram constantly running which interprets instructions and there's no state machine keeping track of what a multi cycle instruction is doing, sounds likely.


Top
 Profile  
Reply with quote  
PostPosted: Sat Mar 09, 2019 8:54 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10986
Location: England
(BTW I wouldn't use the term microcontroller rather perhaps microsequencer. )


Top
 Profile  
Reply with quote  
PostPosted: Sun Mar 10, 2019 12:46 am 
Offline
User avatar

Joined: Sun Oct 18, 2015 11:02 pm
Posts: 428
Location: Toronto, ON
Dr Jefyll wrote:
ps- the C74-6502 was originally a Logisim design.
Indeed, if it’s of interest, you can download the Logisim model here. It is also a microcode based design.

_________________
C74-6502 Website: https://c74project.com


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 63 guests


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: