Advice needed on SBC
Re: Advice needed on SBC
The port pins are capable of functioning either as inputs or as outputs. The default state (after reset) is for them to be inputs. (And most 6522's have pullups that cause inputs to go high unless driven low.)
Sounds like you want the pins to be outputs, but have neglected to set them as such. To do so you need to write to the Data Direction Register. The data sheet has the details you need. Have fun!
-- Jeff
Sounds like you want the pins to be outputs, but have neglected to set them as such. To do so you need to write to the Data Direction Register. The data sheet has the details you need. Have fun!
-- Jeff
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html
https://laughtonelectronics.com/Arcana/ ... mmary.html
- GARTHWILSON
- Forum Moderator
- Posts: 8775
- Joined: 30 Aug 2002
- Location: Southern California
- Contact:
Re: Advice needed on SBC
A little more detail: You'll need to write to DDRA or DDRB (data-direction register A or B) of the VIA, with a '1' in each bit that you want to be an output, and a '0' in each bit that you want to be an input. You wouldn't want simply writing to port A or B to automatically make it outputs, so they made it so input bits still remain as inputs when you write to the port.
I have only had two problems with the VIA. One is the mode-011 shift-register operation bug (explained in Tip #8 in my "Tip of the Day" column), which is something that won't affect most users but there is a way around it. The other was in getting T1 (timer 1) running in free-run mode, explained in Tip #9, something that was not spelled out in the data sheet and we got it going only after a Rockwell applications engineer faxed us an ap. note in about 1987. Aside from these, the data sheet is very complete. Everything you need is there. It takes time to go through and learn it; but doing things per the data sheet, I have never had any problem with it (with the two exceptions above).
I have only had two problems with the VIA. One is the mode-011 shift-register operation bug (explained in Tip #8 in my "Tip of the Day" column), which is something that won't affect most users but there is a way around it. The other was in getting T1 (timer 1) running in free-run mode, explained in Tip #9, something that was not spelled out in the data sheet and we got it going only after a Rockwell applications engineer faxed us an ap. note in about 1987. Aside from these, the data sheet is very complete. Everything you need is there. It takes time to go through and learn it; but doing things per the data sheet, I have never had any problem with it (with the two exceptions above).
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?
Re: Advice needed on SBC
Well that's what I was missing. I was wondering why the datasheet kept talking about DDRA and DDRB. Also took some time to figure out that you can set whether a port is an input or an output individually.
I made a small routine that turns the output on and off. Although the delay is too short to blink an LED. So no blinky yet.
Anyone have recommendations for writing programs? I've just been writing it on paper, converting it all to hexadecimal, and then typing it up in a hex editor. I make a lot of mistakes especially when typing and converting to hexadecimal. It worked more or less when I was doing this on the VIC-20, but now that the programs are lengthier it's harder to manage.
Thanks for the resources. I wouldn't be here without all of you!
I made a small routine that turns the output on and off. Although the delay is too short to blink an LED. So no blinky yet.
Anyone have recommendations for writing programs? I've just been writing it on paper, converting it all to hexadecimal, and then typing it up in a hex editor. I make a lot of mistakes especially when typing and converting to hexadecimal. It worked more or less when I was doing this on the VIC-20, but now that the programs are lengthier it's harder to manage.
Thanks for the resources. I wouldn't be here without all of you!
-Floopy
Re: Advice needed on SBC
You could use a text editor and an assembler like (most of) the rest of us. I'm using as65, from the cc65 compiler suite. Others have different preferences.
- GARTHWILSON
- Forum Moderator
- Posts: 8775
- Joined: 30 Aug 2002
- Location: Southern California
- Contact:
Re: Advice needed on SBC
Floopy wrote:
Well that's what I was missing. I was wondering why the datasheet kept talking about DDRA and DDRB. Also took some time to figure out that you can set whether a port is an input or an output individually.
Quote:
Anyone have recommendations for writing programs? I've just been writing it on paper, converting it all to hexadecimal, and then typing it up in a hex editor. I make a lot of mistakes especially when typing and converting to hexadecimal. It worked more or less when I was doing this on the VIC-20, but now that the programs are lengthier it's harder to manage.
There's a list of assemblers, mostly free, at http://wilsonminesco.com/links.html#assem, and also on this site at http://6502.org/tools/asm/ . I like, and would recommend, the C32 assembler I use; but if you really need it to be free, one I have not used but looks really good is As65, written by our own Andrew Jacobs (forum name BitWise).
Chromatix wrote:
You could use a text editor and an assembler like (most of) the rest of us. I'm using as65, from the cc65 compiler suite. Others have different preferences.
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?
- BigDumbDinosaur
- Posts: 9428
- Joined: 28 May 2009
- Location: Midwestern USA (JB Pritzker’s dystopia)
- Contact:
Re: Advice needed on SBC
Floopy wrote:
Anyone have recommendations for writing programs?
x86? We ain't got no x86. We don't NEED no stinking x86!
Re: Advice needed on SBC
Well there you see - there's so many options for assemblers, it's easy to get their names mixed up. Just pick one and try it.
Re: Advice needed on SBC
Floopy wrote:
I've just been writing it on paper, converting it all to hexadecimal, and then typing it up in a hex editor.
While you're mucking around down in the basement of how things work, I suggest you make a habit of referring to the cycle by cycle behavior that's documented in Appendix A of the MCS 6500 Family Hardware Manual. Seriously -- spend some time with this! It will shine a light on what else the CPU is doing. Yes it fetches the code -- those bytes you laboriously entered -- but how and when it does so is important. Plus, there's other stuff going on (such as the data reads and data writes for the instructions you coded). Recommended! You can find that manual here.
-- Jeff
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html
https://laughtonelectronics.com/Arcana/ ... mmary.html
Re: Advice needed on SBC
Thanks for all of the resources.
Finally got an LED to blink. I just need to improve the program by using subroutines. It's amazing how much you can do with so little. I had never realized how many instructions there where.
Can you put a subroutine within a subroutine?
Finally got an LED to blink. I just need to improve the program by using subroutines. It's amazing how much you can do with so little. I had never realized how many instructions there where.
Can you put a subroutine within a subroutine?
-Floopy
- GARTHWILSON
- Forum Moderator
- Posts: 8775
- Joined: 30 Aug 2002
- Location: Southern California
- Contact:
Re: Advice needed on SBC
Floopy wrote:
Can you put a subroutine within a subroutine?
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?
Re: Advice needed on SBC
I got tired of burning endless amounts of EPROMs. I also wanted a way of testing my programs without having to carry 10EPROMs + UV eraser. I thought about EEPROMs, but they are expensive. I do have a few 29F010 flash chips. I made an adapter and now it simplifies programming a lot!
I also took the time to build a second board that fixed the issues the first one had (there is a bodge of wires under it, but it's hidden).
I also took the time to build a second board that fixed the issues the first one had (there is a bodge of wires under it, but it's hidden).
-Floopy
- Mike Naberezny
- Site Admin
- Posts: 296
- Joined: 30 Aug 2002
- Location: Northern California
- Contact:
Re: Advice needed on SBC
Floopy wrote:
I got tired of burning endless amounts of EPROMs. I also wanted a way of testing my programs without having to carry 10EPROMs + UV eraser. I thought about EEPROMs, but they are expensive. I do have a few 29F010 flash chips. I made an adapter and now it simplifies programming a lot!
At this point, I've been doing all development on an EPROM emulator for years. Not having to unplug anything is even more convenient; almost like programming a modern microcontroller. Now I only burn real chips every once in a while. I usually use UV EPROMs since I still have a bunch of them.
Floopy wrote:
I also took the time to build a second board that fixed the issues the first one had (there is a bodge of wires under it, but it's hidden).
- Mike Naberezny (mike@naberezny.com) http://6502.org
Re: Advice needed on SBC
The other way of developing is to design the system to have a larger CMOS SRAM. The glue logic allows the SRAM to shadow the EPROM/EEROM area (reads come from EPROM/EEROM, but writes go to SRAM), or to replace the EPROM/EEROM area in the memory map via bank switching.
This then allows a simple program in the EPROM/EEROM to download a development version of your ROM code to the shadow RAM. Then copy a short routine to normal RAM. This short routine switches out the EPROM/EEPROM and switches the shadow RAM to read mode (so the EPROM/EEPROM is disabled). If you want, you can also disable writes to the shadow RAM, so that it has some protection in case a crashed system randomly tries to write to this area of RAM. Once the shadow RAM is switched in, control is passed to the code in this shadow RAM area.
Of course, this does make the glue logic more complex. It also requires that there is a communication link between the system and another computer so that code can be downloaded.
Mark
This then allows a simple program in the EPROM/EEROM to download a development version of your ROM code to the shadow RAM. Then copy a short routine to normal RAM. This short routine switches out the EPROM/EEPROM and switches the shadow RAM to read mode (so the EPROM/EEPROM is disabled). If you want, you can also disable writes to the shadow RAM, so that it has some protection in case a crashed system randomly tries to write to this area of RAM. Once the shadow RAM is switched in, control is passed to the code in this shadow RAM area.
Of course, this does make the glue logic more complex. It also requires that there is a communication link between the system and another computer so that code can be downloaded.
Mark
- BigDumbDinosaur
- Posts: 9428
- Joined: 28 May 2009
- Location: Midwestern USA (JB Pritzker’s dystopia)
- Contact:
Re: Advice needed on SBC
Mike Naberezny wrote:
I had always used UV EPROMs but I tried an EEPROM for the first time when I built the SBC-2.
x86? We ain't got no x86. We don't NEED no stinking x86!
- BigDumbDinosaur
- Posts: 9428
- Joined: 28 May 2009
- Location: Midwestern USA (JB Pritzker’s dystopia)
- Contact:
Re: Advice needed on SBC
1024MAK wrote:
The other way of developing is to design the system to have a larger CMOS SRAM. The glue logic allows the SRAM to shadow the EPROM/EEROM area (reads come from EPROM/EEROM, but writes go to SRAM), or to replace the EPROM/EEROM area in the memory map via bank switching....It also requires that there is a communication link between the system and another computer so that code can be downloaded.
x86? We ain't got no x86. We don't NEED no stinking x86!