User Tools

Site Tools


base:improved_clockslide

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Last revision Both sides next revision
base:improved_clockslide [2017-02-28 08:14]
lft
base:improved_clockslide [2017-02-28 08:16]
lft Consistent use of 'clock slide'.
Line 19: Line 19:
 Every additional byte we skip corresponds to one less cycle of delay. Notice that the operands are reinterpreted as opcodes depending on where we land on the slide. For instance, the final ''lda $eaa5'' is encoded as ''ad a5 ea'' and takes 4 cycles. Skipping the first byte, we get ''a5 ea'' (''lda $ea'', 3 cycles). Skipping also the second byte, we get ''ea'' (''nop'', 2 cycles). Every additional byte we skip corresponds to one less cycle of delay. Notice that the operands are reinterpreted as opcodes depending on where we land on the slide. For instance, the final ''lda $eaa5'' is encoded as ''ad a5 ea'' and takes 4 cycles. Skipping the first byte, we get ''a5 ea'' (''lda $ea'', 3 cycles). Skipping also the second byte, we get ''ea'' (''nop'', 2 cycles).
  
-The length of the clockslide depends on the maximum jitter we have to support, and we pay a corresponding penalty in the form of useless waiting cycles. In the example, the maximum supported jitter is 10 cycles (41-31), and the minimum overhead cost is 9 cycles (50-41).+The length of the clock slide depends on the maximum jitter we have to support, and we pay a corresponding penalty in the form of useless waiting cycles. In the example, the maximum supported jitter is 10 cycles (41-31), and the minimum overhead cost is 9 cycles (50-41).
  
 Now here comes the improvement: Now here comes the improvement:
  
-Notice that in the latest case (starting at cycle 41), we still execute a single ''nop'' instruction in the clockslide. This is because there is no single-cycle instruction on the 6502. Jumping one byte further would reduce the number of cycles by two. That is, jumping directly to the ''at cycle 50'' comment would actually get us there one cycle too early.+Notice that in the latest case (starting at cycle 41), we still execute a single ''nop'' instruction in the clock slide. This is because there is no single-cycle instruction on the 6502. Jumping one byte further would reduce the number of cycles by two. That is, jumping directly to the ''at cycle 50'' comment would actually get us there one cycle too early.
  
 But we can use the page-crossing penalty of the branch instruction to add an extra cycle in this particular case! Consider: But we can use the page-crossing penalty of the branch instruction to add an extra cycle in this particular case! Consider:
Line 38: Line 38:
            ; at cycle 49            ; at cycle 49
  
-The clockslide is now one byte shorter, and the minimum overhead cost has been reduced to 8 cycles.+The clock slide is now one byte shorter, and the minimum overhead cost has been reduced to 8 cycles.
  
 The downside is that we now have an alignment requirement. Sometimes it may not be possible to adjust the starting address of the delay code. But note that we can insert dummy bytes just after the branch instruction, as long as we update the computation of A accordingly. The downside is that we now have an alignment requirement. Sometimes it may not be possible to adjust the starting address of the delay code. But note that we can insert dummy bytes just after the branch instruction, as long as we update the computation of A accordingly.
base/improved_clockslide.txt ยท Last modified: 2017-04-27 01:17 by copyfault