base:delay
no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
— | base:delay [2015-04-17 04:31] (current) – created - external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Delay ====== | ||
+ | by Zed Yago | ||
+ | |||
+ | When stabilizing a IRQ, you often need a subroutine or macro which can delay a given amount of cycles. | ||
+ | |||
+ | < | ||
+ | delay: | ||
+ | lsr ;2 cycles akku=akku/2 carry=1 if accu was odd, 0 otherwise | ||
+ | bcc waste1cycle ;2/3 cycles, depending on lowest bit, same operation for both | ||
+ | waste1cycle: | ||
+ | sta smod+1 | ||
+ | clc ;2 cycles | ||
+ | ;now we have burned 10/11 cycles.. and jumping into a nopfield | ||
+ | smod: | ||
+ | bcc *+10 ;3 cycles | ||
+ | .buf 32 $EA ;just type 32x nop if your assembler doesnt support this command | ||
+ | ; or type "!fill 32, $ea" if you are using ACME | ||
+ | rts ;6 cycles | ||
+ | </ | ||
base/delay.txt · Last modified: 2015-04-17 04:31 by 127.0.0.1