blog:commodore_c65_dtv_programming

Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
blog:commodore_c65_dtv_programming [2023/01/25 16:18] johnblog:commodore_c65_dtv_programming [2023/01/25 17:21] (current) – [Extended DTV Functions] john
Line 479: Line 479:
  
 I've seemingly found a bug which manifests when making sequential DMA calls in a tight loop and the transfer length is 182 bytes or greater.  I've seemingly found a bug which manifests when making sequential DMA calls in a tight loop and the transfer length is 182 bytes or greater. 
 +
 +You can successfully DMA copy quite a large region in a single operation and there are no side-effects, however in my testing I have found that if you have a tight loop where you are DMA transferring line by line, I get corrupted transfers with any size over 181 bytes. See the example below:
 +
 +{{:blog:c64:vice_dtv_256_speed2x.png?400|}}
 +
 +The colour bars in the image should be continuous for the entire screen width, but they glitch at two points.
 +The above example was generated by the following pseudocode:
 +
 +<code>
 +screen = FRAMEBUFFER_LOCATION;
 +for (line = 0; line < SCREEN_HEIGHT; line++){
 +    memset(line_buffer, colour, SCREEN_WIDTH);
 +    dtv_DMA(&line_buffer, screen, SCREEN_WIDTH);
 +    colour++;
 +    screen += SCREEN_WIDTH;
 +}
 +</code>
 +
 +If you reduce the transfer size to 181 bytes you do not get the glitching, and if you have a //reasonable-number-of-cycles// between DMA operations you also don't get the glitching... but I don't know what that //reasonable-number-of-cycles// value is. It's clearly a timing issue between DMA operations - due to the time it takes for transfers over a centre number of bytes, but all I know is that the documentation says that checking bit 0 of 0xD31F should indicate whether the transfer has finished or not. It's possible (though unlikely) that this is an emulation bug - until I have a working, physical DTV, I won't be able to confirm.
  
 ---- ----
Line 577: Line 596:
  
 {{:blog:c64:c64_dtv_blitter_example_dtv3.png?400|}} {{:blog:c64:c64_dtv_blitter_example_dtv3.png?400|}}
 +
 +Notice that the transparent (aka //black//) pixels in the source region are preserved when copying to the destination, and that the original content of the destination is preserved for those areas. Where the source is not transparent, those pixels then overwrite the destination. The mode of operation can be customised - see the [[https://www.c64-wiki.com/wiki/C64DTV_Programming_Guide#BLITTER_DATAPATH|DTV Programming Guide]] for more details; specifically the ALU mode set for register **0xD33E**.
  
 == Bugs == == Bugs ==
  • blog/commodore_c65_dtv_programming.1674663499.txt.gz
  • Last modified: 2023/01/25 16:18
  • by john