Hello all
-
thomasparlette
- Posts: 7
- Joined: 13 Nov 2015
Hello all
Hello all I am new to the 6502 world. I just started building my own SY6502 system. So far I have the SY6502 running at 2MHz with an SY6522 wired up on a bread board. I also wired up an 28HC64 EEPROM. Still working on the RAM (waiting on another breadboard to show up. I have also started to wire up the 6551 and some 7-segment displays.
I already tested the 6522 with producing a frequency at PB7 and some basic on off stuff on port B.
One issue I am running into is with the BNE instruction. I am trying to make a simple delay program to display 1-9 on a single 7-segment display attached to port B but it seems like it's getting stuck at the first point.
I already tested the 6522 with producing a frequency at PB7 and some basic on off stuff on port B.
One issue I am running into is with the BNE instruction. I am trying to make a simple delay program to display 1-9 on a single 7-segment display attached to port B but it seems like it's getting stuck at the first point.
- barrym95838
- Posts: 2056
- Joined: 30 Jun 2013
- Location: Sacramento, CA, USA
Re: Hello all
Maybe that LDA $50 at Next: should be LDX $50 ??
Mike B.
Mike B.
-
thomasparlette
- Posts: 7
- Joined: 13 Nov 2015
Re: Hello all
Lol wow yea I just saw that. Thanks I will try that and let you know.
-
thomasparlette
- Posts: 7
- Joined: 13 Nov 2015
Re: Hello all
I looked at my code again and I am just loading A with data from location 50 then checking to see if the data at that point is 10 or more. Then displaying the number. I tried changing to to LDX and it still didn't work. I scaled down the program a lot just to check the function of the Delay task. Listed below is the new code I am using to test out the Delay program.
From what I can figure out its is getting to LDA #$66 and just stopping at that point. I am using SB-Assembler to assemble the code. I also Tried a few other assemblers but they all produce the same thing. I even tried just put in the code byte by byte into my programmer and still same results.
From what I can figure out its is getting to LDA #$66 and just stopping at that point. I am using SB-Assembler to assemble the code. I also Tried a few other assemblers but they all produce the same thing. I even tried just put in the code byte by byte into my programmer and still same results.
Code: Select all
MSCNT .EQ 199
.OR $E000
LDA #0
STA PCR
LDA #$FF
STA DDRB
LDA #$66
JSR Delay
STA PORTB
LDA #$6D
STA PORTB
BRK
Delay:
LDX #MSCNT
DLY1:
DEX
BNE DLY1
DEY
BNE Delay
RTS-
thomasparlette
- Posts: 7
- Joined: 13 Nov 2015
Re: Hello all
Update I programmed the ROM with a lot of NOP codes in place of the jumps commands to just retest to make sure it is not an hardware issue and I got it to change the display. So I think it may be something todo with my jump code that is causing the issue but just can't figure out what it is.
Thanks again for the help
Thanks again for the help
Re: Hello all
Welcome, Thomas! I notice you use a DEY as an outer loop, but you don't initialise Y beforehand - that means we don't quite know how often it will go around.
-
thomasparlette
- Posts: 7
- Joined: 13 Nov 2015
Re: Hello all
ok I see that issue Here is the updated code. I am still having the same issue.
Code: Select all
.CR 6502
.TF c:\sbasm3\Projects\Bin\test.bin,BIN
.IN c:\sbasm3\Projects\Include\VIA_Setup.65s
MSCNT .EQ 199
YCNT .EQ 1
.OR $0000
LDA #0
STA PCR
LDA #$FF
STA DDRB
Start: LDA #$66
STA PORTB
LDY YCNT
JSR Delay
LDA #$6D
STA PORTB
LDY YCNT
JSR Delay
JMP Start
Delay:
LDX #MSCNT
DLY1:
DEX
BNE DLY1
DEY
BNE Delay
RTS Re: Hello all
You might want to double-check that the addresses are right. You have
.OR $E000
in one version and
.OR $0000
in another. Do you know what address the ROM is actually mapped to in the hardware? The JSR takes an absolute address, so that has to match the actual memory map of the machine when it's running. On the other hand, when you're programming the EEPROM your image starts at the beginning of the ROM. You need to be sure you've prepared an image which starts at the appropriate address: the 24th byte of the ROM might be address $E018 for example.
.OR $E000
in one version and
.OR $0000
in another. Do you know what address the ROM is actually mapped to in the hardware? The JSR takes an absolute address, so that has to match the actual memory map of the machine when it's running. On the other hand, when you're programming the EEPROM your image starts at the beginning of the ROM. You need to be sure you've prepared an image which starts at the appropriate address: the 24th byte of the ROM might be address $E018 for example.
- barrym95838
- Posts: 2056
- Joined: 30 Jun 2013
- Location: Sacramento, CA, USA
Re: Hello all
Maybe those LDY YCNTs should be LDY #YCNT ??
Mike B.
Mike B.
-
thomasparlette
- Posts: 7
- Joined: 13 Nov 2015
Re: Hello all
Yea they are I made a small mistake retypeing in on my other computer I don't have internet (network card failed) on my programming machine so I retypeing in the code when I made that post here sorry about that.
-
leepivonka
- Posts: 167
- Joined: 15 Apr 2016
Re: Hello all
Remember that JSR & RTS use the 6502 stack. If you don't have RAM at $0100..$01FF, the stack won't work & RTS will jump to some strange address.
Instead of using JSR to call the delay routine, you could inline a copy of the routine at both places where it is used.
Instead of using JSR to call the delay routine, you could inline a copy of the routine at both places where it is used.
-
thomasparlette
- Posts: 7
- Joined: 13 Nov 2015
Re: Hello all
I was rereading GARTHWILSON Primer again this morning and realized the same thing. Tonight I am hopping to wire up the RAM but until then I made the following changes to test before adding more I/C's.
Code: Select all
; Assembler Setup & Configure
.CR 6502
.TF C:\Software\sbasm3\Projects\Bin\test_2.bin,BIN
.IN C:\Software\sbasm3\Projects\Include\VIA_Setup.65s
; Variables
MSCNT .EQ 199
YCNT .EQ 1
; Start of Program
.OR $E000
LDA #0
STA PCR
LDA #$FF
STA DDRB
Start LDA #$66
STA PORTB
LDY YCNT
JMP Delay1
Return1 LDA #$6D
STA PORTB
LDY YCNT
JMP Delay2
; Delay's
Delay1 LDX #MSCNT
DLY1 DEX
BNE DLY1
DEY
BNE Delay1
JMP Return1
Delay2 LDX #MSCNT
DLY2 DEX
BNE DLY2
DEY
BNE Delay2
JMP Start
; 6502 Hardware Vectors
.NO $FFFA
.DB $00, $00 ; NMI Vector
.DB $00, $E0 ; Reset Vector
.DB $00, $00 ; IRQ Vector