PET user port programming

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

PET user port programming

Chris Wareham
Hi,

I've just signed up to the list as I'm currently writing a simple MIDI sequencer for my PET 4032. I'm using the cc65 compiler suite, but having difficulties finding information on user port programming and timing.

At the moment I have a home made circuit on a breadboard with an LED for each of the data pins on the user port. When I write a byte to the data register for port A the corresponding LEDs light up. The missing pieces of the jigsaw are how to do the timing so that bytes get written at the correct intervals and the handshaking so I know when each byte has been read. I'm guessing I do the timing by setting a timer and handling interrupts, but neither of my two PET programming books cover this.

MIDI messages consist of three bytes, but I've got my pseudo MIDI messages down to two bytes:

mnnnnnnn ccccvvvv

Where:

m is 1 for note on or 0 for note off
nnnnnnn is the note number 0-127
cccc is channel 0-15
vvvv is velocity 0-15

MIDI supports velocity values of 0-127, so I plan on shifting my 4 bit value to get a reasonable spread of velocities. I plan on using an Arduino to convert my pseudo MIDI messages into real ones. Hopefully I can then make an interface with a suitably programmed Atmega chip rather than a complete Arduino board.

Any advice will be most gratefully appreciated!

Regards,

Chris

       Message was sent through the cbm-hackers mailing list
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: PET user port programming

Didier Derny
roughly you have a half 6520 on the user port check the 6520 datasheet

http://archive.6502.org/datasheets/mos_6520.pdf

you have the timers in the 6522
http://archive.6502.org/datasheets/mos_6522_preliminary_nov_1977.pdf

you can also check this book
https://archive.org/details/The_Pet_Revealed



On 10/05/2017 12:25, Chris Wareham wrote:

> Hi,
>
> I've just signed up to the list as I'm currently writing a simple MIDI sequencer for my PET 4032. I'm using the cc65 compiler suite, but having difficulties finding information on user port programming and timing.
>
> At the moment I have a home made circuit on a breadboard with an LED for each of the data pins on the user port. When I write a byte to the data register for port A the corresponding LEDs light up. The missing pieces of the jigsaw are how to do the timing so that bytes get written at the correct intervals and the handshaking so I know when each byte has been read. I'm guessing I do the timing by setting a timer and handling interrupts, but neither of my two PET programming books cover this.
>
> MIDI messages consist of three bytes, but I've got my pseudo MIDI messages down to two bytes:
>
> mnnnnnnn ccccvvvv
>
> Where:
>
> m is 1 for note on or 0 for note off
> nnnnnnn is the note number 0-127
> cccc is channel 0-15
> vvvv is velocity 0-15
>
> MIDI supports velocity values of 0-127, so I plan on shifting my 4 bit value to get a reasonable spread of velocities. I plan on using an Arduino to convert my pseudo MIDI messages into real ones. Hopefully I can then make an interface with a suitably programmed Atmega chip rather than a complete Arduino board.
>
> Any advice will be most gratefully appreciated!
>
> Regards,
>
> Chris
>
>         Message was sent through the cbm-hackers mailing list


       Message was sent through the cbm-hackers mailing list
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: PET user port programming

Leif Bloomquist
In reply to this post by Chris Wareham
MIDI on the PET, cool!

You should check out PetSynth, I believe the source code is available:

https://en.wikipedia.org/wiki/PetSynth
http://www.petsynth.org/

While it's a player not a sequencer, it also uses an Arduino on the
user port and creative use of timers from what I recall.  Anyway,
worth looking at.


(I'd love to see a PET duet, your sequencer code on PET #1 and
PetSynth on PET #2)  ;-)

Cheers,
-Leif





--
Leif Bloomquist | [hidden email] | +1 416-737-2328 | Check out
my blog! http://www.jammingsignal.com

"Every choice, no matter how small, begins a new story." - xkcd


On Wed, May 10, 2017 at 6:25 AM, Chris Wareham <[hidden email]> wrote:

> Hi,
>
> I've just signed up to the list as I'm currently writing a simple MIDI sequencer for my PET 4032. I'm using the cc65 compiler suite, but having difficulties finding information on user port programming and timing.
>
> At the moment I have a home made circuit on a breadboard with an LED for each of the data pins on the user port. When I write a byte to the data register for port A the corresponding LEDs light up. The missing pieces of the jigsaw are how to do the timing so that bytes get written at the correct intervals and the handshaking so I know when each byte has been read. I'm guessing I do the timing by setting a timer and handling interrupts, but neither of my two PET programming books cover this.
>
> MIDI messages consist of three bytes, but I've got my pseudo MIDI messages down to two bytes:
>
> mnnnnnnn ccccvvvv
>
> Where:
>
> m is 1 for note on or 0 for note off
> nnnnnnn is the note number 0-127
> cccc is channel 0-15
> vvvv is velocity 0-15
>
> MIDI supports velocity values of 0-127, so I plan on shifting my 4 bit value to get a reasonable spread of velocities. I plan on using an Arduino to convert my pseudo MIDI messages into real ones. Hopefully I can then make an interface with a suitably programmed Atmega chip rather than a complete Arduino board.
>
> Any advice will be most gratefully appreciated!
>
> Regards,
>
> Chris
>
>        Message was sent through the cbm-hackers mailing list

       Message was sent through the cbm-hackers mailing list
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: PET user port programming

Mike Stein
Looks like he's let the site expire; any other links to PetSynth anywhere?

m

----- Original Message -----
From: "Leif Bloomquist" <[hidden email]>
To: <[hidden email]>
Sent: Wednesday, May 10, 2017 9:01 AM
Subject: Re: PET user port programming


MIDI on the PET, cool!

You should check out PetSynth, I believe the source code is available:

https://en.wikipedia.org/wiki/PetSynth
http://www.petsynth.org/

While it's a player not a sequencer, it also uses an Arduino on the
user port and creative use of timers from what I recall.  Anyway,
worth looking at.


(I'd love to see a PET duet, your sequencer code on PET #1 and
PetSynth on PET #2)  ;-)

Cheers,
-Leif





--
Leif Bloomquist | [hidden email] | +1 416-737-2328 | Check out
my blog! http://www.jammingsignal.com

"Every choice, no matter how small, begins a new story." - xkcd


On Wed, May 10, 2017 at 6:25 AM, Chris Wareham <[hidden email]> wrote:

> Hi,
>
> I've just signed up to the list as I'm currently writing a simple MIDI sequencer for my PET 4032. I'm using the cc65 compiler suite, but having difficulties finding information on user port programming and timing.
>
> At the moment I have a home made circuit on a breadboard with an LED for each of the data pins on the user port. When I write a byte to the data register for port A the corresponding LEDs light up. The missing pieces of the jigsaw are how to do the timing so that bytes get written at the correct intervals and the handshaking so I know when each byte has been read. I'm guessing I do the timing by setting a timer and handling interrupts, but neither of my two PET programming books cover this.
>
> MIDI messages consist of three bytes, but I've got my pseudo MIDI messages down to two bytes:
>
> mnnnnnnn ccccvvvv
>
> Where:
>
> m is 1 for note on or 0 for note off
> nnnnnnn is the note number 0-127
> cccc is channel 0-15
> vvvv is velocity 0-15
>
> MIDI supports velocity values of 0-127, so I plan on shifting my 4 bit value to get a reasonable spread of velocities. I plan on using an Arduino to convert my pseudo MIDI messages into real ones. Hopefully I can then make an interface with a suitably programmed Atmega chip rather than a complete Arduino board.
>
> Any advice will be most gratefully appreciated!
>
> Regards,
>
> Chris
>
>        Message was sent through the cbm-hackers mailing list

       Message was sent through the cbm-hackers mailing list


       Message was sent through the cbm-hackers mailing list
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: PET user port programming

Nick Vivid
The wayback machine archived it over the years.


On May 10, 2017 10:02 AM, "Mike Stein" <[hidden email]> wrote:
Looks like he's let the site expire; any other links to PetSynth anywhere?

m

----- Original Message -----
From: "Leif Bloomquist" <[hidden email]>
To: <[hidden email]>
Sent: Wednesday, May 10, 2017 9:01 AM
Subject: Re: PET user port programming


MIDI on the PET, cool!

You should check out PetSynth, I believe the source code is available:

https://en.wikipedia.org/wiki/PetSynth
http://www.petsynth.org/

While it's a player not a sequencer, it also uses an Arduino on the
user port and creative use of timers from what I recall.  Anyway,
worth looking at.


(I'd love to see a PET duet, your sequencer code on PET #1 and
PetSynth on PET #2)  ;-)

Cheers,
-Leif





--
Leif Bloomquist | [hidden email] | <a href="tel:%2B1%20416-737-2328" value="+14167372328">+1 416-737-2328 | Check out
my blog! http://www.jammingsignal.com

"Every choice, no matter how small, begins a new story." - xkcd


On Wed, May 10, 2017 at 6:25 AM, Chris Wareham <[hidden email]> wrote:
> Hi,
>
> I've just signed up to the list as I'm currently writing a simple MIDI sequencer for my PET 4032. I'm using the cc65 compiler suite, but having difficulties finding information on user port programming and timing.
>
> At the moment I have a home made circuit on a breadboard with an LED for each of the data pins on the user port. When I write a byte to the data register for port A the corresponding LEDs light up. The missing pieces of the jigsaw are how to do the timing so that bytes get written at the correct intervals and the handshaking so I know when each byte has been read. I'm guessing I do the timing by setting a timer and handling interrupts, but neither of my two PET programming books cover this.
>
> MIDI messages consist of three bytes, but I've got my pseudo MIDI messages down to two bytes:
>
> mnnnnnnn ccccvvvv
>
> Where:
>
> m is 1 for note on or 0 for note off
> nnnnnnn is the note number 0-127
> cccc is channel 0-15
> vvvv is velocity 0-15
>
> MIDI supports velocity values of 0-127, so I plan on shifting my 4 bit value to get a reasonable spread of velocities. I plan on using an Arduino to convert my pseudo MIDI messages into real ones. Hopefully I can then make an interface with a suitably programmed Atmega chip rather than a complete Arduino board.
>
> Any advice will be most gratefully appreciated!
>
> Regards,
>
> Chris
>
>        Message was sent through the cbm-hackers mailing list

       Message was sent through the cbm-hackers mailing list


       Message was sent through the cbm-hackers mailing list
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: PET user port programming

Mike Stein

Thanks!
 
Chiron used to come to TPUG meetings once in a while; will have to talk to him next time.
 
m
----- Original Message -----
Sent: Wednesday, May 10, 2017 10:29 AM
Subject: Re: PET user port programming

The wayback machine archived it over the years.


On May 10, 2017 10:02 AM, "Mike Stein" <[hidden email]> wrote:
Looks like he's let the site expire; any other links to PetSynth anywhere?

m

----- Original Message -----
From: "Leif Bloomquist" <[hidden email]>
To: <[hidden email]>
Sent: Wednesday, May 10, 2017 9:01 AM
Subject: Re: PET user port programming


MIDI on the PET, cool!

You should check out PetSynth, I believe the source code is available:

https://en.wikipedia.org/wiki/PetSynth
http://www.petsynth.org/

While it's a player not a sequencer, it also uses an Arduino on the
user port and creative use of timers from what I recall.  Anyway,
worth looking at.


(I'd love to see a PET duet, your sequencer code on PET #1 and
PetSynth on PET #2)  ;-)

Cheers,
-Leif





--
Leif Bloomquist | [hidden email] | <A href="tel:%2B1%20416-737-2328" value="+14167372328">+1 416-737-2328 | Check out
my blog! http://www.jammingsignal.com

"Every choice, no matter how small, begins a new story." - xkcd


On Wed, May 10, 2017 at 6:25 AM, Chris Wareham <[hidden email]> wrote:

> Hi,
>
> I've just signed up to the list as I'm currently writing a simple MIDI sequencer for my PET 4032. I'm using the cc65 compiler suite, but having difficulties finding information on user port programming and timing.
>
> At the moment I have a home made circuit on a breadboard with an LED for each of the data pins on the user port. When I write a byte to the data register for port A the corresponding LEDs light up. The missing pieces of the jigsaw are how to do the timing so that bytes get written at the correct intervals and the handshaking so I know when each byte has been read. I'm guessing I do the timing by setting a timer and handling interrupts, but neither of my two PET programming books cover this.
>
> MIDI messages consist of three bytes, but I've got my pseudo MIDI messages down to two bytes:
>
> mnnnnnnn ccccvvvv
>
> Where:
>
> m is 1 for note on or 0 for note off
> nnnnnnn is the note number 0-127
> cccc is channel 0-15
> vvvv is velocity 0-15
>
> MIDI supports velocity values of 0-127, so I plan on shifting my 4 bit value to get a reasonable spread of velocities. I plan on using an Arduino to convert my pseudo MIDI messages into real ones. Hopefully I can then make an interface with a suitably programmed Atmega chip rather than a complete Arduino board.
>
> Any advice will be most gratefully appreciated!
>
> Regards,
>
> Chris
>
>        Message was sent through the cbm-hackers mailing list

       Message was sent through the cbm-hackers mailing list


       Message was sent through the cbm-hackers mailing list
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: PET user port programming

Chris Wareham
In reply to this post by Leif Bloomquist
Hi Leif,

I have the sources to PetSynth version 0.7 or 007, which just loops continuously waiting for a key press and then plays the note for a maximum of 250 loop iterations. I saw a YouTube video that mentions a "version 2", so perhaps more sophisticated timing was added later. I actually tried to contact the author by email and Facebook message for details of his MIDI interface but didn't receive an answer. And as someone else has noted, his both the PetSynth site and his own homepage are currently offline.

Regards,

Chris

On 10 May 2017 at 14:01 Leif Bloomquist <[hidden email]> wrote:

>
> MIDI on the PET, cool!
>
> You should check out PetSynth, I believe the source code is available:
>
> https://en.wikipedia.org/wiki/PetSynth
> http://www.petsynth.org/
>
> While it's a player not a sequencer, it also uses an Arduino on the
> user port and creative use of timers from what I recall.  Anyway,
> worth looking at.
>
>
> (I'd love to see a PET duet, your sequencer code on PET #1 and
> PetSynth on PET #2)  ;-)
>
> Cheers,
> -Leif
>
>
>
>
>
> --
> Leif Bloomquist | [hidden email] | +1 416-737-2328 | Check out
> my blog! http://www.jammingsignal.com
>
> "Every choice, no matter how small, begins a new story." - xkcd
>
>
> On Wed, May 10, 2017 at 6:25 AM, Chris Wareham <[hidden email]> wrote:
> > Hi,
> >
> > I've just signed up to the list as I'm currently writing a simple MIDI sequencer for my PET 4032. I'm using the cc65 compiler suite, but having difficulties finding information on user port programming and timing.
> >
> > At the moment I have a home made circuit on a breadboard with an LED for each of the data pins on the user port. When I write a byte to the data register for port A the corresponding LEDs light up. The missing pieces of the jigsaw are how to do the timing so that bytes get written at the correct intervals and the handshaking so I know when each byte has been read. I'm guessing I do the timing by setting a timer and handling interrupts, but neither of my two PET programming books cover this.
> >
> > MIDI messages consist of three bytes, but I've got my pseudo MIDI messages down to two bytes:
> >
> > mnnnnnnn ccccvvvv
> >
> > Where:
> >
> > m is 1 for note on or 0 for note off
> > nnnnnnn is the note number 0-127
> > cccc is channel 0-15
> > vvvv is velocity 0-15
> >
> > MIDI supports velocity values of 0-127, so I plan on shifting my 4 bit value to get a reasonable spread of velocities. I plan on using an Arduino to convert my pseudo MIDI messages into real ones. Hopefully I can then make an interface with a suitably programmed Atmega chip rather than a complete Arduino board.
> >
> > Any advice will be most gratefully appreciated!
> >
> > Regards,
> >
> > Chris
> >
> >        Message was sent through the cbm-hackers mailing list
>
>        Message was sent through the cbm-hackers mailing list

       Message was sent through the cbm-hackers mailing list
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: PET user port programming

Chris Wareham
In reply to this post by Didier Derny
Hi Didier,

Pages 101 onwards in "The Pet Revealed" look very interesting - thanks for the link.

Regards,

Chris

> On 10 May 2017 at 12:49 didier derny <[hidden email]> wrote:
>
>
> roughly you have a half 6520 on the user port check the 6520 datasheet
>
> http://archive.6502.org/datasheets/mos_6520.pdf
>
> you have the timers in the 6522
> http://archive.6502.org/datasheets/mos_6522_preliminary_nov_1977.pdf
>
> you can also check this book
> https://archive.org/details/The_Pet_Revealed
>
>
>
> On 10/05/2017 12:25, Chris Wareham wrote:
> > Hi,
> >
> > I've just signed up to the list as I'm currently writing a simple MIDI sequencer for my PET 4032. I'm using the cc65 compiler suite, but having difficulties finding information on user port programming and timing.
> >
> > At the moment I have a home made circuit on a breadboard with an LED for each of the data pins on the user port. When I write a byte to the data register for port A the corresponding LEDs light up. The missing pieces of the jigsaw are how to do the timing so that bytes get written at the correct intervals and the handshaking so I know when each byte has been read. I'm guessing I do the timing by setting a timer and handling interrupts, but neither of my two PET programming books cover this.
> >
> > MIDI messages consist of three bytes, but I've got my pseudo MIDI messages down to two bytes:
> >
> > mnnnnnnn ccccvvvv
> >
> > Where:
> >
> > m is 1 for note on or 0 for note off
> > nnnnnnn is the note number 0-127
> > cccc is channel 0-15
> > vvvv is velocity 0-15
> >
> > MIDI supports velocity values of 0-127, so I plan on shifting my 4 bit value to get a reasonable spread of velocities. I plan on using an Arduino to convert my pseudo MIDI messages into real ones. Hopefully I can then make an interface with a suitably programmed Atmega chip rather than a complete Arduino board.
> >
> > Any advice will be most gratefully appreciated!
> >
> > Regards,
> >
> > Chris
> >
> >         Message was sent through the cbm-hackers mailing list
>
>
>        Message was sent through the cbm-hackers mailing list

       Message was sent through the cbm-hackers mailing list
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: PET user port programming

Chris Wareham
In reply to this post by Mike Stein
Hi Mike,

If you do see Chiron, could you ask him if he would be happy passing on details of his MIDI interface?

Regards,

Chris

On 10 May 2017 at 15:56 Mike Stein <[hidden email]> wrote:

>
> Thanks!
>
> Chiron used to come to TPUG meetings once in a while; will have to talk to him next time.
>
> m
>   ----- Original Message -----
>   From: Nick Vivid
>   To: [hidden email]
>   Sent: Wednesday, May 10, 2017 10:29 AM
>   Subject: Re: PET user port programming
>
>
>   The wayback machine archived it over the years.
>
>
>   https://web.archive.org/web/*/http://petsynth.org/
>
>
>
>   On May 10, 2017 10:02 AM, "Mike Stein" <[hidden email]> wrote:
>
>     Looks like he's let the site expire; any other links to PetSynth anywhere?
>
>     m
>
>     ----- Original Message -----
>     From: "Leif Bloomquist" <[hidden email]>
>     To: <[hidden email]>
>     Sent: Wednesday, May 10, 2017 9:01 AM
>     Subject: Re: PET user port programming
>
>
>     MIDI on the PET, cool!
>
>     You should check out PetSynth, I believe the source code is available:
>
>     https://en.wikipedia.org/wiki/PetSynth
>     http://www.petsynth.org/
>
>     While it's a player not a sequencer, it also uses an Arduino on the
>     user port and creative use of timers from what I recall.  Anyway,
>     worth looking at.
>
>
>     (I'd love to see a PET duet, your sequencer code on PET #1 and
>     PetSynth on PET #2)  ;-)
>
>     Cheers,
>     -Leif
>
>
>
>
>
>     --
>     Leif Bloomquist | [hidden email] | +1 416-737-2328 | Check out
>     my blog! http://www.jammingsignal.com
>
>     "Every choice, no matter how small, begins a new story." - xkcd
>
>
>     On Wed, May 10, 2017 at 6:25 AM, Chris Wareham <[hidden email]> wrote:
>     > Hi,
>     >
>     > I've just signed up to the list as I'm currently writing a simple MIDI sequencer for my PET 4032. I'm using the cc65 compiler suite, but having difficulties finding information on user port programming and timing.
>     >
>     > At the moment I have a home made circuit on a breadboard with an LED for each of the data pins on the user port. When I write a byte to the data register for port A the corresponding LEDs light up. The missing pieces of the jigsaw are how to do the timing so that bytes get written at the correct intervals and the handshaking so I know when each byte has been read. I'm guessing I do the timing by setting a timer and handling interrupts, but neither of my two PET programming books cover this.
>     >
>     > MIDI messages consist of three bytes, but I've got my pseudo MIDI messages down to two bytes:
>     >
>     > mnnnnnnn ccccvvvv
>     >
>     > Where:
>     >
>     > m is 1 for note on or 0 for note off
>     > nnnnnnn is the note number 0-127
>     > cccc is channel 0-15
>     > vvvv is velocity 0-15
>     >
>     > MIDI supports velocity values of 0-127, so I plan on shifting my 4 bit value to get a reasonable spread of velocities. I plan on using an Arduino to convert my pseudo MIDI messages into real ones. Hopefully I can then make an interface with a suitably programmed Atmega chip rather than a complete Arduino board.
>     >
>     > Any advice will be most gratefully appreciated!
>     >
>     > Regards,
>     >
>     > Chris
>     >
>     >        Message was sent through the cbm-hackers mailing list
>
>            Message was sent through the cbm-hackers mailing list
>
>
>            Message was sent through the cbm-hackers mailing list

       Message was sent through the cbm-hackers mailing list
Loading...