6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sat Jun 29, 2024 7:01 am

All times are UTC




Post new topic Reply to topic  [ 12 posts ] 
Author Message
 Post subject: Hello all
PostPosted: Wed Apr 13, 2016 1:27 am 
Offline

Joined: Fri Nov 13, 2015 6:57 pm
Posts: 7
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.


Attachments:
File comment: Code
image.jpeg
image.jpeg [ 6.06 MiB | Viewed 1130 times ]
File comment: Pic of the board
image.jpeg
image.jpeg [ 2.59 MiB | Viewed 1130 times ]
Top
 Profile  
Reply with quote  
 Post subject: Re: Hello all
PostPosted: Wed Apr 13, 2016 1:49 am 
Offline
User avatar

Joined: Sun Jun 30, 2013 10:26 pm
Posts: 1938
Location: Sacramento, CA, USA
Maybe that LDA $50 at Next: should be LDX $50 ??

Mike B.


Top
 Profile  
Reply with quote  
 Post subject: Re: Hello all
PostPosted: Wed Apr 13, 2016 2:22 am 
Offline

Joined: Fri Nov 13, 2015 6:57 pm
Posts: 7
Lol wow yea I just saw that. Thanks I will try that and let you know.


Top
 Profile  
Reply with quote  
 Post subject: Re: Hello all
PostPosted: Wed Apr 13, 2016 2:42 am 
Offline

Joined: Fri Nov 13, 2015 6:57 pm
Posts: 7
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.

Code:
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


Top
 Profile  
Reply with quote  
 Post subject: Re: Hello all
PostPosted: Wed Apr 13, 2016 2:48 am 
Offline

Joined: Fri Nov 13, 2015 6:57 pm
Posts: 7
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


Top
 Profile  
Reply with quote  
 Post subject: Re: Hello all
PostPosted: Wed Apr 13, 2016 3:05 am 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10837
Location: England
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.


Top
 Profile  
Reply with quote  
 Post subject: Re: Hello all
PostPosted: Wed Apr 13, 2016 3:19 am 
Offline

Joined: Fri Nov 13, 2015 6:57 pm
Posts: 7
ok I see that issue Here is the updated code. I am still having the same issue.

Code:
   .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      


Top
 Profile  
Reply with quote  
 Post subject: Re: Hello all
PostPosted: Wed Apr 13, 2016 3:27 am 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10837
Location: England
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.


Top
 Profile  
Reply with quote  
 Post subject: Re: Hello all
PostPosted: Wed Apr 13, 2016 3:28 am 
Offline
User avatar

Joined: Sun Jun 30, 2013 10:26 pm
Posts: 1938
Location: Sacramento, CA, USA
Maybe those LDY YCNTs should be LDY #YCNT ??

Mike B.


Top
 Profile  
Reply with quote  
 Post subject: Re: Hello all
PostPosted: Wed Apr 13, 2016 3:34 am 
Offline

Joined: Fri Nov 13, 2015 6:57 pm
Posts: 7
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.


Top
 Profile  
Reply with quote  
 Post subject: Re: Hello all
PostPosted: Fri Apr 15, 2016 1:32 am 
Offline

Joined: Fri Apr 15, 2016 1:03 am
Posts: 136
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.


Top
 Profile  
Reply with quote  
 Post subject: Re: Hello all
PostPosted: Fri Apr 15, 2016 11:23 am 
Offline

Joined: Fri Nov 13, 2015 6:57 pm
Posts: 7
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:
; 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


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

All times are UTC


Who is online

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