6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sat Nov 23, 2024 11:32 am

All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Sat Jan 19, 2013 8:16 pm 
Offline

Joined: Tue Nov 18, 2003 8:41 pm
Posts: 250
Just playing

This is meant to be the standard parabolic pseudo sine wave generator.
in the absolute minimum of code.

Code:
 clc
 ldy #$10
 lda #$7F
LOOP1
 dey
LOOP2
 sty temp
 adc temp
 bmi LOOP1
 iny
 jmp LOOP2


Top
 Profile  
Reply with quote  
PostPosted: Sat Jan 19, 2013 9:13 pm 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8545
Location: Southern California
Good job! Here's what I got on the oscilloscope, having added only STA VIA2PA afer the ADC instruction to send the result to the D/A converter:

Attachment:
PseudoSine.jpg
PseudoSine.jpg [ 28.86 KiB | Viewed 1443 times ]


It would be even slightly better if I were to sync it to a timer interrupt, since as it is it's a couple more clocks for one half of the cycle than it is for the other (19 versus 17 with the variable not in ZP).

_________________
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?


Top
 Profile  
Reply with quote  
PostPosted: Sat Jan 19, 2013 10:05 pm 
Offline

Joined: Tue Nov 18, 2003 8:41 pm
Posts: 250
GARTHWILSON wrote:
It would be even slightly better if I were to sync it to a timer interrupt, since as it is it's a couple more clocks for one half of the cycle than it is for the other (19 versus 17 with the variable not in ZP).


hmm

I get 15 and 13 cycles.

I guess if you were going to time it with code you'd have to add
a nop to the dey side.

Code:
 clc
 ldy #$10
 lda #$7F
LOOP1
 nop
 dey
LOOP2
 sty temp
 adc temp
 bmi LOOP1
 iny
 jmp LOOP2


I wasn't really thinking of it as having any practical use :)


Top
 Profile  
Reply with quote  
PostPosted: Sat Jan 19, 2013 10:06 pm 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8545
Location: Southern California
Add 4 clocks for the STA VIA2PA (for the D/A converter).

About the NOP-- of course. I was in too big of a hurry. :oops:

Quote:
I wasn't really thinking of it as having any practical use :)

I have recently been watching videos of home-computer history (or should I say "listening," since I had them going while working and didn't keep my eyes glued) and it was interesting that Jobs and Woz were going to these meetings of hobbyists who were trying to build their own computers that did absolutely nothing useful, and even that first huge Altair was pretty useless, apparently having only toggle switches for inputs and LED for outputs. My workbench computer gets used only for real-life control and data collection on the workbench though, and I might do an FFT on this method to get some harmonic-distortion numbers. It may come in handy someday. In the past I've done it with look-up tables which works well too of course.

_________________
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?


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

All times are UTC


Who is online

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