1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-06-10 10:29:36 +00:00

Work in progress on MEGA65 DevKit support.

This commit is contained in:
jespergravgaard 2021-03-07 10:27:22 +01:00
parent 09bb98b319
commit 5b10b2de05
5 changed files with 104 additions and 8 deletions

3
.gitignore vendored
View File

@ -5,9 +5,8 @@
*/*.sym
*/.tmpdirs
*/bin/
/target/
*/workspace.xml
./target/
target/
**/.DS_Store
.project
.tmpdirs

View File

@ -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
}
}

View File

@ -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
}
}

View File

@ -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

View File

@ -0,0 +1,72 @@
// Test Full-Colour Graphics
#pragma target(mega65_remote)
#include <mega65.h>
#include <mega65-dma.h>
#include <6502.h>
#include <string.h>
// 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 = <SCREEN;
VICIV->SCRNPTR_LOHI = >SCREEN;
VICIV->SCRNPTR_HILO = 0;
VICIV->SCRNPTR_HIHI = 0;
// Set exact charset address
//VICIV->CHARPTR_LOLO = <CHARSET;
//VICIV->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;
}
}