Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
blog:commodore_c65_dtv_programming [2023/01/25 15:28] – [Basic DTV Functions] john | blog:commodore_c65_dtv_programming [2023/01/25 17:21] (current) – [Extended DTV Functions] john | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== DTV (and C64) Programming - Using the CC65 toolchain ====== | ====== DTV (and C64) Programming - Using the CC65 toolchain ====== | ||
+ | ~~TOC_HERE 2-5~~ | ||
+ | |||
+ | From [[https:// | ||
+ | |||
+ | > The C64 Direct-to-TV, | ||
+ | > joystick), with 30 built-in games. The design is similar to the Atari Classics 10-in-1 TV Game. The circuitry of the C64DTV was designed by Jeri Ellsworth, a computer chip designer who | ||
+ | > had previously designed the C-One. | ||
+ | |||
+ | These are my notes on programming for the C64 DTV and making use of some of the extended functionality of the hardware from within C, rather than 6502 assembly. I hope you find these useful - whilst I came to the DTV more than a decade after its popularity peaked, I've found it a very capable little system! | ||
+ | |||
+ | {{: | ||
===== Basic use of CC65 ===== | ===== Basic use of CC65 ===== | ||
Line 205: | Line 216: | ||
---- | ---- | ||
+ | |||
+ | ==== Extended DTV Functions ==== | ||
+ | |||
+ | These functions raise the DTV above a simple C64 clone and add substantially improved functionality to the system: increased colours, digital sound and a dedicated image blitter. | ||
=== Enabling 320x200 Linear Framebuffer === | === Enabling 320x200 Linear Framebuffer === | ||
Line 460: | Line 475: | ||
} | } | ||
</ | </ | ||
+ | |||
+ | == Bugs == | ||
+ | |||
+ | 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, | ||
+ | |||
+ | {{: | ||
+ | |||
+ | 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: | ||
+ | |||
+ | < | ||
+ | screen = FRAMEBUFFER_LOCATION; | ||
+ | for (line = 0; line < SCREEN_HEIGHT; | ||
+ | memset(line_buffer, | ||
+ | dtv_DMA(& | ||
+ | colour++; | ||
+ | screen += SCREEN_WIDTH; | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | If you reduce the transfer size to 181 bytes you do not get the glitching, and if you have a // | ||
---- | ---- | ||
Line 558: | Line 596: | ||
{{: | {{: | ||
+ | |||
+ | Notice that the transparent (aka //black//) pixels in the source region are preserved when copying to the destination, | ||
+ | |||
+ | == Bugs == | ||
However, there is a problem. On the **DTV2** systems (the initial PAL models), the blitter is partially bugged and transparent copies result int a vertical banding effect: | However, there is a problem. On the **DTV2** systems (the initial PAL models), the blitter is partially bugged and transparent copies result int a vertical banding effect: | ||
Line 563: | Line 605: | ||
{{: | {{: | ||
- | Therefore, //without mitigation//, | + | Therefore, //without mitigation//, |