Freezing 6502
- GARTHWILSON
- Forum Moderator
- Posts: 8773
- Joined: 30 Aug 2002
- Location: Southern California
- Contact:
Make sure the RAM can only be written to when phase 2 is high. You must gate either the R/W\ or the select with phase 2. Make sure also that the ROM and anything else on the bus is disabled when RAM is being accessed.
RDY can be pulled up to Vcc if you're not using it. The same goes for NMI and IRQ. Don't let them float. It's much more likely that you'll want the interrupts though, so if they're not connected to anything yet and you don't want to exclude the possibility of using them in the future, pull them up with a 3.3K or so.
RDY can be pulled up to Vcc if you're not using it. The same goes for NMI and IRQ. Don't let them float. It's much more likely that you'll want the interrupts though, so if they're not connected to anything yet and you don't want to exclude the possibility of using them in the future, pull them up with a 3.3K or so.
- GARTHWILSON
- Forum Moderator
- Posts: 8773
- Joined: 30 Aug 2002
- Location: Southern California
- Contact:
Quote:
So, I could use an 74LS08 to gate the R/W and PH2.
Quote:
What is the reason for this? Why does my ROM chip not require gating with PH2?
I think, to keep it simple, I might stick whith a 7408. I'll gate the R/W with the PH2, as this won't require adding gates to my 74LS138 for memory decoding, so I shouldn't run in to speed issues. I'm only running at 2Mhz anyway, so I should be safe.
.... On second thought... I guess I should use 2 NAND's because the PH2 is high, but the R/W will be reading low, and the RAM WE will be expecting Low as well, so I would have to inver the R/W before NANDing with the PH2. Am I thinking straight?
IYO, am I better off using the HC family of logic chips, or stick with the LS?
.... On second thought... I guess I should use 2 NAND's because the PH2 is high, but the R/W will be reading low, and the RAM WE will be expecting Low as well, so I would have to inver the R/W before NANDing with the PH2. Am I thinking straight?
IYO, am I better off using the HC family of logic chips, or stick with the LS?
- GARTHWILSON
- Forum Moderator
- Posts: 8773
- Joined: 30 Aug 2002
- Location: Southern California
- Contact:
Quote:
I think, to keep it simple, I might stick whith...
Quote:
am I better off using the HC family of logic chips, or stick with the LS?
With some 65xx parts you might need HCT instead of HC. HCT should always work with the thresholds involved, although I've never had any trouble with HC either.
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
Well, my RAM is working now. I used a 74LS00 to combine the PH2 and R/W. I have confirmed the RAM is working properly, but my system still freezes after the first setting of the 6522 ports.
I know the RAM is working, because I modified my program to store the value I want to send to Port A and Port B to address $400, clear A, and then $400 back into A before I STA to Port A and Port B, and I can get the LED's to make any pattern, based on the value. This confirms that the RAM is working. But nothing after that works.
Any other suggestions as to why my whole program will not run after turning the 6522 port bits on.
Thanks
I know the RAM is working, because I modified my program to store the value I want to send to Port A and Port B to address $400, clear A, and then $400 back into A before I STA to Port A and Port B, and I can get the LED's to make any pattern, based on the value. This confirms that the RAM is working. But nothing after that works.
Any other suggestions as to why my whole program will not run after turning the 6522 port bits on.
Thanks
Here's my current code:
My memory map has the 2864 ROM from E000 to FFFF, my 6522 is mapped at $8000, and my 2KB RAM is mapped at $0000.
Let me know what else you would like to know.
Thanks
Code: Select all
; Program NCS ROM2 $0000 to $1FFF 01/24/2007
; Flashes alternating LED's connected to 6522 Port 'A' & 'B'
.ORG $0000
Out_B = $8000 ;Output Port B 6522
Out_A = $8001 ;Output Port A 6522
DDR_B = $8002 ;Data Direction Register Port B 6522
DDR_A = $8003 ;Data Direction Register Port A 6522
LDA #$FF ;Set Data Direction to Output for port A
STA DDR_A
LDA #$FF ;Store 255 in memory address 1024
STA $400
LDA #0
main LDA $400
INC $400
STA Out_A
JSR delay
JMP main ;repeat
delay LDA #$00
LDX #$C4 ;2 cycles $C4x$FF=49980 Cycles apprx 1/10 second
loopB LDY #$FF
loopA DEY
BNE loopA
DEX
BNE loopB
RTS
.ENDLet me know what else you would like to know.
Thanks
- GARTHWILSON
- Forum Moderator
- Posts: 8773
- Joined: 30 Aug 2002
- Location: Southern California
- Contact:
You start the code at address 0000, but you have RAM there now (as you should have). What method are you using to get the assembled program into RAM?
Otherwise, the source code looks ok, although you have a few unnecessary instructions there, and your delay will run longer than you wrote down, because DEY BNE loopA takes 5 clocks not 1. DEY takes 2, and BNE takes 3 when the branch is taken, unless it has to branch past a page boundary, which takes 4 instead of 3, but is very unlikely.
Otherwise, the source code looks ok, although you have a few unnecessary instructions there, and your delay will run longer than you wrote down, because DEY BNE loopA takes 5 clocks not 1. DEY takes 2, and BNE takes 3 when the branch is taken, unless it has to branch past a page boundary, which takes 4 instead of 3, but is very unlikely.
I see something, don't know if it's "it".....
You use the directive .ORG $0000. From the point of view of the ROM, the code then starts from the very start, while from the point of view from the 6502, the code is at $E000. Both the JSR and the JMP will point into the wild. Try using position independent code, like this, to see if thats it...
Also, the inner loop of the delay uses 5 cycles, not 2, so it last longer than intended, but that shouldnt be the problem here.....
You use the directive .ORG $0000. From the point of view of the ROM, the code then starts from the very start, while from the point of view from the 6502, the code is at $E000. Both the JSR and the JMP will point into the wild. Try using position independent code, like this, to see if thats it...
Code: Select all
; Program NCS ROM2 $0000 to $1FFF 01/24/2007
; Flashes alternating LED's connected to 6522 Port 'A' & 'B'
.ORG $0000
Out_B = $8000 ;Output Port B 6522
Out_A = $8001 ;Output Port A 6522
DDR_B = $8002 ;Data Direction Register Port B 6522
DDR_A = $8003 ;Data Direction Register Port A 6522
LDA #$FF
STA DDR_A ;Set Data Direction to Output for port A
STA $400 ;Store 255 in memory address 1024
main LDA $400
INC $400
STA Out_A
delay LDX #$C4 ;2 cycles $C4x$FF=49980 Cycles apprx 1/10 second
loopB LDY #$FF
loopA DEY
BNE loopA
DEX
BNE loopB
BEQ main
.ENDHi,
I don't think the .ORG $0000 is it, as once assembled, I am burning it to the beginning of my ROM according to my ROM, but once I insert it, It becomes $E000, and my Reset Vector points to $E000 as well.
Also, it does execute the beginning of the code... enough to initially turn on the LED's... and then halts.
I don't think the .ORG $0000 is it, as once assembled, I am burning it to the beginning of my ROM according to my ROM, but once I insert it, It becomes $E000, and my Reset Vector points to $E000 as well.
Also, it does execute the beginning of the code... enough to initially turn on the LED's... and then halts.
kernal34 wrote:
Hi,
I don't think the .ORG $0000 is it, as once assembled, I am burning it to the beginning of my ROM according to my ROM, but once I insert it, It becomes $E000, and my Reset Vector points to $E000 as well.
I don't think the .ORG $0000 is it, as once assembled, I am burning it to the beginning of my ROM according to my ROM, but once I insert it, It becomes $E000, and my Reset Vector points to $E000 as well.
edit: yes, it will turn on the leds just fine, the problem is the jsr and jump following immediately after that...
Re: Freezing 6502
kernal34 wrote:
It appears my breadboard 6502 computer is freezing. It will only execute the first few lines of code on my 2864 ROM chip, and then appears to freeze.
I once had an Elektor Junior (a kind of KIM-1 clone) doing the same. But running the Junior at 500 KHz, it worked fine again. Replacing the EPROM worked out fine as well. IMHO in one or another way the EPROM had become slower. So my advice: try another EPROM.
Code: Select all
___
/ __|__
/ / |_/ Groetjes, Ruud
\ \__|_\
\___| URL: www.baltissen.org