diff --git a/.gitignore b/.gitignore index 582aefa19..3665c34eb 100644 --- a/.gitignore +++ b/.gitignore @@ -5,9 +5,8 @@ */*.sym */.tmpdirs */bin/ +/target/ */workspace.xml -./target/ -target/ **/.DS_Store .project .tmpdirs diff --git a/src/main/kc/target/mega65_c64_remote.tgt b/src/main/kc/target/mega65_c64_remote.tgt new file mode 100644 index 000000000..3d6e2f4b0 --- /dev/null +++ b/src/main/kc/target/mega65_c64_remote.tgt @@ -0,0 +1,13 @@ +{ + "description": "MEGA65 platform executable starting in C64 mode.", + "extension": "prg", + "link": "mega65_c64.ld", + "start_address": "0x080d", + "cpu": "MEGA45GS02", + "interrupt": "rom_min_c64", + "emulator": "m65 -l /dev/cu.usbserial-251633005A061 -F -r -4", + "defines": { + "__MEGA65__": 1, + "__MEGA65_C64__": 1 + } +} \ No newline at end of file diff --git a/src/main/kc/target/mega65_remote.tgt b/src/main/kc/target/mega65_remote.tgt new file mode 100644 index 000000000..4f5dabb91 --- /dev/null +++ b/src/main/kc/target/mega65_remote.tgt @@ -0,0 +1,12 @@ +{ + "description": "MEGA65 platform PRG executable starting in MEGA65 mode.", + "extension": "prg", + "link": "mega65.ld", + "start_address": "0x2017", + "cpu": "MEGA45GS02", + "interrupt": "rom_min_mega65", + "emulator": "m65 -l /dev/cu.usbserial-251633005A061 -F -r", + "defines": { + "__MEGA65__": 1 + } +} \ No newline at end of file diff --git a/src/test/kc/examples/mega65/dypp65.c b/src/test/kc/examples/mega65/dypp65.c index f753ae61a..4085824e9 100644 --- a/src/test/kc/examples/mega65/dypp65.c +++ b/src/test/kc/examples/mega65/dypp65.c @@ -25,6 +25,12 @@ void main() { SEI(); // Map memory to BANK 0 : 0x00XXXX - giving access to I/O memoryRemap(0,0,0); + // Enable 48MHz fast mode + VICIV->CONTROLB |= 0x40; + VICIV->CONTROLC |= 0x40; + // Enable the VIC 4 + VICIV->KEY = 0x47; + VICIV->KEY = 0x53; // Set sideborder width=0, disable raster delay and hot registers VICIV->SIDBDRWD_LO = 0; VICIV->SIDBDRWD_HI = 0; @@ -33,12 +39,6 @@ void main() { VICIV->TBDRPOS_HI = 0; VICIV->BBDRPOS_LO = 0; VICIV->BBDRPOS_HI = 2; - // Enable 48MHz fast mode - VICIV->CONTROLB |= 0x40; - VICIV->CONTROLC |= 0x40; - // Enable the VIC 4 - VICIV->KEY = 0x47; - VICIV->KEY = 0x53; // Enable Super Extended Attribute Mode VICIV->CONTROLC |= 1; // Mode 40x25 chars - will be 45*25 when utilizing the borders diff --git a/src/test/kc/examples/mega65/test-fullcolour.c b/src/test/kc/examples/mega65/test-fullcolour.c new file mode 100644 index 000000000..39261db53 --- /dev/null +++ b/src/test/kc/examples/mega65/test-fullcolour.c @@ -0,0 +1,72 @@ +// Test Full-Colour Graphics + +#pragma target(mega65_remote) +#include +#include +#include <6502.h> +#include + +// The screen address (40*25=0x03e8 bytes) +char * const SCREEN = 0x0400; +// The charset address (45*32*8=0x2d00 bytes) +char * const CHARSET = 0x2000; + +void main() { + // Avoid interrupts + SEI(); + // Map memory to BANK 0 : 0x00XXXX - giving access to I/O + memoryRemap(0,0,0); + // Enable 48MHz fast mode + VICIV->CONTROLB |= 0x40; + VICIV->CONTROLC |= 0x40; + // Enable the VIC 4 + VICIV->KEY = 0x47; + VICIV->KEY = 0x53; + // Enable Full-Colour Mode + VICIV->CONTROLC |= 2; + // Mode 40x25 chars + VICIV->CONTROLB &= 0x7f; + VICIV->CHARSTEP_LO = 40; + VICIV->CHARSTEP_HI = 0; + // Set number of characters to display per row + VICIV->CHRCOUNT = 40; + // Set exact screen address + VICIV->SCRNPTR_LOLO = SCRNPTR_LOHI = >SCREEN; + VICIV->SCRNPTR_HILO = 0; + VICIV->SCRNPTR_HIHI = 0; + // Set exact charset address + //VICIV->CHARPTR_LOLO = CHARPTR_LOHI = >CHARSET; + //VICIV->CHARPTR_HILO = 0; + // Backgound color black + VICIV->BG_COLOR = BLACK; + + // Put some colours into the palettes + char c=0; do { + PALETTE_RED[c] = c & 0x0f; + PALETTE_GREEN[c] = 0x00; + PALETTE_BLUE[c] = c / 0x10; + + } while (++c); + + // Fill the screen with 0x80 (char at 64*0x80 = 0x2000) + memset_dma(SCREEN, 0x80, 40*25); + // Fill the colours with WHITE - directly into $ff80000 + memset_dma256(0xff,0x08,0x0000, WHITE, 40*25); + // Fill the charset with 0x55 + //memset_dma(CHARSET, 0x55, 256*64); + + for(char i=0, c=0;i<64;i++) { + CHARSET[i] = i; + //CHARSET[i] = c?0:i; + //c ^= 1; + //if((i&7)==7) c ^= 1; + } + + + // Loop forever + for(;;) { + VICIV->BORDER_COLOR = VICII->RASTER; + } +} \ No newline at end of file