6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Mon Sep 23, 2024 5:17 am

All times are UTC




Post new topic Reply to topic  [ 20 posts ]  Go to page Previous  1, 2
Author Message
PostPosted: Thu Apr 23, 2020 8:39 am 
Offline

Joined: Sat Nov 11, 2017 1:08 pm
Posts: 33
Yes it does add jitter, it does save a few cycles .


Top
 Profile  
Reply with quote  
PostPosted: Wed Jun 03, 2020 5:51 pm 
Offline

Joined: Wed Jul 18, 2018 12:12 pm
Posts: 96
I wanted to thank everyone for their help. I got a bit distracted form this project for a few weeks but implemented the changes suggest by Chromatix and it works quite well. The number of cycles though each path is also very close. I started producing a video about playing DIGIs on the C64 which I hope to finish up this weekend.

Yesterday I had an idea of how to implement an interpolating scheme. Hopefully resulting in a playback quality very similar to the 8kz sample rate but with half the memory footprint. I'll start a new thread on that subject though.


Top
 Profile  
Reply with quote  
PostPosted: Wed Jun 10, 2020 4:56 am 
Offline

Joined: Wed Mar 02, 2016 12:00 pm
Posts: 343
Sorry, I haven't been so active here lately.

I had the same problem some time ago, and the fastest approach is always selfmodifying code. At least if you want to shift between two instances with a flag. If you can allow things to be in ZP, then you get it down to 7.5 cycles (8.5 cycles if not in ZP):

Code:
*=$a3
BCC   next   ;2.5c
LDX   #$90   ;2c
STX   $a3   ;3c   set to BCC

(your code here)

next
LDX   #$B0   ;2c
STX   $a3   ;3c   set to BCS


Just remember to modify LDX# so that it is according to what you expect the carry flag to be (or you can use BNE/BEQ or something else to suit your code). The actual flag here resides in the instruction, e.g. at $A3 in the code above.


Top
 Profile  
Reply with quote  
PostPosted: Tue Jul 28, 2020 9:45 pm 
Offline

Joined: Tue Jul 19, 2016 12:24 am
Posts: 8
This relies on V being clear and Y is clobbered so maybe not so good when it comes to debugging.
I think it's 7.5 or 8.5 depending on zp or not.

Code:

......
.flag BVC next
LSR flag
.......
Code 1 here
.......
RTS
.next ASL flag
.......
Code 2 here
........
RTS


Top
 Profile  
Reply with quote  
PostPosted: Wed Jul 29, 2020 4:47 am 
Offline

Joined: Sun Apr 26, 2020 3:08 am
Posts: 357
Personally, I prefer using "LSR flag" instead of "ASL flag".

The reason being is that in the initialization routine, there is almost always some register set to zero and it will save 2 bytes as an extra instruction to load the $55 or $AA is unneeded. For me, it is not only just about saving bytes but also saving bits as only the 0-bit and 1-bit ever comes into play.

LSR flag
BCS next:
INC flag
...
RTS

next:

will work just well.

Also note that if the carry needs to be preserved when entering a routine, the

LDA flag
EOR #$80
STA flag
BMI routine2

might also be the better option


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 20 posts ]  Go to page Previous  1, 2

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 7 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: