6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sat Apr 27, 2024 8:23 pm

All times are UTC




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Sun Apr 02, 2023 2:20 pm 
Offline

Joined: Wed Apr 27, 2016 2:15 pm
Posts: 141
Location: South Africa
I used the original 6502 core from Arlet Ottens in a number of projects and had great fun with this core.

Recently I was working on a project where I was implementing some DMA where I needed to pause the 6502 CPU core (via the RDY signal) while transfer took place from DMA to memory, in which I discovered an edge case.

The code in question is as follows:

Code:
       LDA #$04
       STA $FD0B
DONE
       JMP DONE


This register FD0B is something I implemented to initiate a DMA transfer when bit 2 is set. When the 6502 core from Arlet Ottens assert the WE signal for the write to register FD0B for the code above, I have some logic that assert the RDY signal of the 6502 after two clock cycles.

Now, when I eventually de-assert the RDY signal the Arlet Ottens core seems to have skipped the JMP opcode (aka code 4c) and tries to interpret the first byte from the JMP instruction as the instruction opcode.

This is not major issue and I can get pass this by just adding one or more NOP's before the JMP instruction.

Is this a known issue with using RDY signals on this 6502 core?

btw, I think overall the core from Arlet Ottens is overall a great core.


Top
 Profile  
Reply with quote  
PostPosted: Tue Apr 04, 2023 6:41 pm 
Offline
User avatar

Joined: Tue Nov 16, 2010 8:00 am
Posts: 2353
Location: Gouda, The Netherlands
Can you attach some screenshots of waveforms?


Top
 Profile  
Reply with quote  
PostPosted: Wed Apr 05, 2023 5:17 pm 
Offline

Joined: Wed Apr 27, 2016 2:15 pm
Posts: 141
Location: South Africa
Here are the simulation waveforms.

As can be seen when RDY becomes zero, it is as if the a9 (which is an LDA) is discarded. When RDY becomes one again in the other waveform, the system assumes 20 is the opcode (which is an actual fact the operand of the LDA), being a JSR. One can also see resemblance of this with the writes that happens to the stack.


Attachments:
File comment: When RDY becomes one again
afterrdy.png
afterrdy.png [ 91.81 KiB | Viewed 4778 times ]
File comment: Moment RDY becomes zero
beforerdy.png
beforerdy.png [ 92.66 KiB | Viewed 4778 times ]
Top
 Profile  
Reply with quote  
PostPosted: Wed Apr 05, 2023 5:30 pm 
Offline
User avatar

Joined: Tue Nov 16, 2010 8:00 am
Posts: 2353
Location: Gouda, The Netherlands
Yes, the A9 is discarded, because the RDY is deasserted. This is as designed. A normal use of RDY is to add wait states to interface slow memory. This means that the CPU core should wait to grab DI until RDY is asserted again, giving the memory system some extra time to produce the correct data.

In this case, you should also feed the RDY signal into the memory system, so it will either hold the FE50 value of the address bus, or the A9 value of the data bus while RDY=0.


Top
 Profile  
Reply with quote  
PostPosted: Thu Apr 06, 2023 6:03 am 
Offline

Joined: Wed Apr 27, 2016 2:15 pm
Posts: 141
Location: South Africa
@Arlet Thanks for the explanation. Everything make sense now :D


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 11 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: