1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-08-02 09:29:35 +00:00

Made modes 1-3 compatible with stock C64

This commit is contained in:
jespergravgaard 2018-03-29 09:19:36 +02:00
parent 626329ddaa
commit 6e9503a14d
5 changed files with 329 additions and 329 deletions

View File

@ -125,12 +125,12 @@ void menu() {
void mode_stdchar() {
const byte* SCREEN = $8000;
const byte* CHARSET = $9000; // Charset ROM
const byte* COLORS = $8400;
const byte* COLORS = $d800;
// DTV Graphics Bank
*DTV_GRAPHICS_VIC_BANK = (byte)((dword)CHARSET/$10000);
// DTV Color Bank
*DTV_COLOR_BANK_LO = <((word)(COLORS/$400));
*DTV_COLOR_BANK_HI = >((word)(COLORS/$400));
*DTV_COLOR_BANK_LO = <((word)(DTV_COLOR_BANK_DEFAULT/$400));
*DTV_COLOR_BANK_HI = >((word)(DTV_COLOR_BANK_DEFAULT/$400));
// DTV Graphics Mode
*DTV_CONTROL = 0;
// VIC Graphics Bank
@ -177,24 +177,24 @@ void mode_stdchar() {
// - CharData[7:6] 11: 4bpp BgColor3[3:0]
// - 1: 4bpp ColorData[3:0]
void mode_ecmchar() {
const byte* ECMCHAR_SCREEN = $8000;
const byte* ECMCHAR_CHARSET = $9000; // Charset ROM
const byte* ECMCHAR_COLORS = $8400;
const byte* SCREEN = $8000;
const byte* CHARSET = $9000; // Charset ROM
const byte* COLORS = $d800;
// DTV Graphics Bank
*DTV_GRAPHICS_VIC_BANK = (byte)((dword)ECMCHAR_CHARSET/$10000);
*DTV_GRAPHICS_VIC_BANK = (byte)((dword)CHARSET/$10000);
// DTV Color Bank
*DTV_COLOR_BANK_LO = <((word)(ECMCHAR_COLORS/$400));
*DTV_COLOR_BANK_HI = >((word)(ECMCHAR_COLORS/$400));
*DTV_COLOR_BANK_LO = <((word)(DTV_COLOR_BANK_DEFAULT/$400));
*DTV_COLOR_BANK_HI = >((word)(DTV_COLOR_BANK_DEFAULT/$400));
// DTV Graphics Mode
*DTV_CONTROL = 0;
// VIC Graphics Bank
*CIA2_PORT_A_DDR = %00000011; // Set VIC Bank bits to output - all others to input
*CIA2_PORT_A = %00000011 ^ (byte)((word)ECMCHAR_CHARSET/$4000); // Set VIC Bank
*CIA2_PORT_A = %00000011 ^ (byte)((word)CHARSET/$4000); // Set VIC Bank
// VIC Graphics Mode
*VIC_CONTROL = VIC_DEN|VIC_RSEL|VIC_ECM|3;
*VIC_CONTROL2 = VIC_CSEL;
// VIC Memory Pointers
*VIC_MEMORY = (byte)((((word)ECMCHAR_SCREEN&$3fff)/$40)|(((word)ECMCHAR_CHARSET&$3fff)/$400));
*VIC_MEMORY = (byte)((((word)SCREEN&$3fff)/$40)|(((word)CHARSET&$3fff)/$400));
// DTV Palette - default
for(byte i : 0..$f) {
DTV_PALETTE[i] = DTV_PALETTE_DEFAULT[i];
@ -206,8 +206,8 @@ void mode_ecmchar() {
*BGCOL3 = 5;
*BGCOL4 = 6;
// Char Colors and screen chars
byte* col=ECMCHAR_COLORS;
byte* ch=ECMCHAR_SCREEN;
byte* col=COLORS;
byte* ch=SCREEN;
for(byte cy: 0..24 ) {
for(byte cx: 0..39) {
*col++ = (cx+cy)&$f;
@ -237,12 +237,12 @@ void mode_ecmchar() {
void mode_mcchar() {
const byte* SCREEN = $8000;
const byte* CHARSET = $9000; // Charset ROM
const byte* COLORS = $8400;
const byte* COLORS = $d800;
// DTV Graphics Bank
*DTV_GRAPHICS_VIC_BANK = (byte)((dword)CHARSET/$10000);
// DTV Color Bank
*DTV_COLOR_BANK_LO = <((word)(COLORS/$400));
*DTV_COLOR_BANK_HI = >((word)(COLORS/$400));
*DTV_COLOR_BANK_LO = <((word)(DTV_COLOR_BANK_DEFAULT/$400));
*DTV_COLOR_BANK_HI = >((word)(DTV_COLOR_BANK_DEFAULT/$400));
// DTV Graphics Mode
*DTV_CONTROL = 0;
// VIC Graphics Bank

View File

@ -1198,14 +1198,14 @@ mode_hicolstdchar: {
mode_mcchar: {
.label SCREEN = $8000
.label CHARSET = $9000
.label COLORS = $8400
.label COLORS = $d800
.label _28 = 7
.label col = 2
.label ch = 5
.label cy = 4
lda #($ffffffff&CHARSET)/$10000
sta DTV_GRAPHICS_VIC_BANK
lda #COLORS/$400
lda #DTV_COLOR_BANK_DEFAULT/$400
sta DTV_COLOR_BANK_LO
lda #0
sta DTV_COLOR_BANK_HI
@ -1292,29 +1292,29 @@ mode_mcchar: {
jmp breturn
}
mode_ecmchar: {
.label ECMCHAR_SCREEN = $8000
.label ECMCHAR_CHARSET = $9000
.label ECMCHAR_COLORS = $8400
.label SCREEN = $8000
.label CHARSET = $9000
.label COLORS = $d800
.label _28 = 7
.label col = 2
.label ch = 5
.label cy = 4
lda #($ffffffff&ECMCHAR_CHARSET)/$10000
lda #($ffffffff&CHARSET)/$10000
sta DTV_GRAPHICS_VIC_BANK
lda #ECMCHAR_COLORS/$400
lda #DTV_COLOR_BANK_DEFAULT/$400
sta DTV_COLOR_BANK_LO
lda #0
sta DTV_COLOR_BANK_HI
sta DTV_CONTROL
lda #3
sta CIA2_PORT_A_DDR
lda #3^ECMCHAR_CHARSET/$4000
lda #3^CHARSET/$4000
sta CIA2_PORT_A
lda #VIC_DEN|VIC_RSEL|VIC_ECM|3
sta VIC_CONTROL
lda #VIC_CSEL
sta VIC_CONTROL2
lda #(ECMCHAR_SCREEN&$3fff)/$40|(ECMCHAR_CHARSET&$3fff)/$400
lda #(SCREEN&$3fff)/$40|(CHARSET&$3fff)/$400
sta VIC_MEMORY
ldx #0
b1:
@ -1332,13 +1332,13 @@ mode_ecmchar: {
sta BGCOL3
lda #6
sta BGCOL4
lda #<ECMCHAR_SCREEN
lda #<SCREEN
sta ch
lda #>ECMCHAR_SCREEN
lda #>SCREEN
sta ch+1
lda #<ECMCHAR_COLORS
lda #<COLORS
sta col
lda #>ECMCHAR_COLORS
lda #>COLORS
sta col+1
lda #0
sta cy
@ -1391,14 +1391,14 @@ mode_ecmchar: {
mode_stdchar: {
.label SCREEN = $8000
.label CHARSET = $9000
.label COLORS = $8400
.label COLORS = $d800
.label _27 = 7
.label col = 2
.label ch = 5
.label cy = 4
lda #($ffffffff&CHARSET)/$10000
sta DTV_GRAPHICS_VIC_BANK
lda #COLORS/$400
lda #DTV_COLOR_BANK_DEFAULT/$400
sta DTV_COLOR_BANK_LO
lda #0
sta DTV_COLOR_BANK_HI

View File

@ -903,8 +903,8 @@ mode_hicolstdchar::@16: scope:[mode_hicolstdchar] from mode_hicolstdchar::@5
to:mode_hicolstdchar::@return
mode_mcchar: scope:[mode_mcchar] from menu::@25
[522] *((const byte*) DTV_GRAPHICS_VIC_BANK#0) ← ((byte))((dword))(const byte*) mode_mcchar::CHARSET#0/(dword/signed dword) 65536 [ ] ( main:2::menu:9::mode_mcchar:56 [ ] )
[523] *((const byte*) DTV_COLOR_BANK_LO#0) ← <((word))(const byte*) mode_mcchar::COLORS#0/(word/signed word/dword/signed dword) 1024 [ ] ( main:2::menu:9::mode_mcchar:56 [ ] )
[524] *((const byte*) DTV_COLOR_BANK_HI#0) ← >((word))(const byte*) mode_mcchar::COLORS#0/(word/signed word/dword/signed dword) 1024 [ ] ( main:2::menu:9::mode_mcchar:56 [ ] )
[523] *((const byte*) DTV_COLOR_BANK_LO#0) ← <((word))(const dword) DTV_COLOR_BANK_DEFAULT#0/(word/signed word/dword/signed dword) 1024 [ ] ( main:2::menu:9::mode_mcchar:56 [ ] )
[524] *((const byte*) DTV_COLOR_BANK_HI#0) ← >((word))(const dword) DTV_COLOR_BANK_DEFAULT#0/(word/signed word/dword/signed dword) 1024 [ ] ( main:2::menu:9::mode_mcchar:56 [ ] )
[525] *((const byte*) DTV_CONTROL#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ ] ( main:2::menu:9::mode_mcchar:56 [ ] )
[526] *((const byte*) CIA2_PORT_A_DDR#0) ← (byte/signed byte/word/signed word/dword/signed dword) 3 [ ] ( main:2::menu:9::mode_mcchar:56 [ ] )
[527] *((const byte*) CIA2_PORT_A#0) ← (byte/signed byte/word/signed word/dword/signed dword) 3^((byte))((word))(const byte*) mode_mcchar::CHARSET#0/(word/signed word/dword/signed dword) 16384 [ ] ( main:2::menu:9::mode_mcchar:56 [ ] )
@ -966,15 +966,15 @@ mode_mcchar::@16: scope:[mode_mcchar] from mode_mcchar::@5
[561] if((byte~) mode_mcchar::$33==(byte/signed byte/word/signed word/dword/signed dword) 0) goto mode_mcchar::@4 [ ] ( main:2::menu:9::mode_mcchar:56 [ ] )
to:mode_mcchar::@return
mode_ecmchar: scope:[mode_ecmchar] from menu::@23
[562] *((const byte*) DTV_GRAPHICS_VIC_BANK#0) ← ((byte))((dword))(const byte*) mode_ecmchar::ECMCHAR_CHARSET#0/(dword/signed dword) 65536 [ ] ( main:2::menu:9::mode_ecmchar:49 [ ] )
[563] *((const byte*) DTV_COLOR_BANK_LO#0) ← <((word))(const byte*) mode_ecmchar::ECMCHAR_COLORS#0/(word/signed word/dword/signed dword) 1024 [ ] ( main:2::menu:9::mode_ecmchar:49 [ ] )
[564] *((const byte*) DTV_COLOR_BANK_HI#0) ← >((word))(const byte*) mode_ecmchar::ECMCHAR_COLORS#0/(word/signed word/dword/signed dword) 1024 [ ] ( main:2::menu:9::mode_ecmchar:49 [ ] )
[562] *((const byte*) DTV_GRAPHICS_VIC_BANK#0) ← ((byte))((dword))(const byte*) mode_ecmchar::CHARSET#0/(dword/signed dword) 65536 [ ] ( main:2::menu:9::mode_ecmchar:49 [ ] )
[563] *((const byte*) DTV_COLOR_BANK_LO#0) ← <((word))(const dword) DTV_COLOR_BANK_DEFAULT#0/(word/signed word/dword/signed dword) 1024 [ ] ( main:2::menu:9::mode_ecmchar:49 [ ] )
[564] *((const byte*) DTV_COLOR_BANK_HI#0) ← >((word))(const dword) DTV_COLOR_BANK_DEFAULT#0/(word/signed word/dword/signed dword) 1024 [ ] ( main:2::menu:9::mode_ecmchar:49 [ ] )
[565] *((const byte*) DTV_CONTROL#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ ] ( main:2::menu:9::mode_ecmchar:49 [ ] )
[566] *((const byte*) CIA2_PORT_A_DDR#0) ← (byte/signed byte/word/signed word/dword/signed dword) 3 [ ] ( main:2::menu:9::mode_ecmchar:49 [ ] )
[567] *((const byte*) CIA2_PORT_A#0) ← (byte/signed byte/word/signed word/dword/signed dword) 3^((byte))((word))(const byte*) mode_ecmchar::ECMCHAR_CHARSET#0/(word/signed word/dword/signed dword) 16384 [ ] ( main:2::menu:9::mode_ecmchar:49 [ ] )
[567] *((const byte*) CIA2_PORT_A#0) ← (byte/signed byte/word/signed word/dword/signed dword) 3^((byte))((word))(const byte*) mode_ecmchar::CHARSET#0/(word/signed word/dword/signed dword) 16384 [ ] ( main:2::menu:9::mode_ecmchar:49 [ ] )
[568] *((const byte*) VIC_CONTROL#0) ← (const byte) VIC_DEN#0|(const byte) VIC_RSEL#0|(const byte) VIC_ECM#0|(byte/signed byte/word/signed word/dword/signed dword) 3 [ ] ( main:2::menu:9::mode_ecmchar:49 [ ] )
[569] *((const byte*) VIC_CONTROL2#0) ← (const byte) VIC_CSEL#0 [ ] ( main:2::menu:9::mode_ecmchar:49 [ ] )
[570] *((const byte*) VIC_MEMORY#0) ← ((byte))((word))(const byte*) mode_ecmchar::ECMCHAR_SCREEN#0&(word/signed word/dword/signed dword) 16383/(byte/signed byte/word/signed word/dword/signed dword) 64|((word))(const byte*) mode_ecmchar::ECMCHAR_CHARSET#0&(word/signed word/dword/signed dword) 16383/(word/signed word/dword/signed dword) 1024 [ ] ( main:2::menu:9::mode_ecmchar:49 [ ] )
[570] *((const byte*) VIC_MEMORY#0) ← ((byte))((word))(const byte*) mode_ecmchar::SCREEN#0&(word/signed word/dword/signed dword) 16383/(byte/signed byte/word/signed word/dword/signed dword) 64|((word))(const byte*) mode_ecmchar::CHARSET#0&(word/signed word/dword/signed dword) 16383/(word/signed word/dword/signed dword) 1024 [ ] ( main:2::menu:9::mode_ecmchar:49 [ ] )
to:mode_ecmchar::@1
mode_ecmchar::@1: scope:[mode_ecmchar] from mode_ecmchar mode_ecmchar::@1
[571] (byte) mode_ecmchar::i#2 ← phi( mode_ecmchar/(byte/signed byte/word/signed word/dword/signed dword) 0 mode_ecmchar::@1/(byte) mode_ecmchar::i#1 ) [ mode_ecmchar::i#2 ] ( main:2::menu:9::mode_ecmchar:49 [ mode_ecmchar::i#2 ] )
@ -990,8 +990,8 @@ mode_ecmchar::@8: scope:[mode_ecmchar] from mode_ecmchar::@1
[579] *((const byte*) BGCOL4#0) ← (byte/signed byte/word/signed word/dword/signed dword) 6 [ ] ( main:2::menu:9::mode_ecmchar:49 [ ] )
to:mode_ecmchar::@2
mode_ecmchar::@2: scope:[mode_ecmchar] from mode_ecmchar::@8 mode_ecmchar::@9
[580] (byte*) mode_ecmchar::ch#3 ← phi( mode_ecmchar::@8/(const byte*) mode_ecmchar::ECMCHAR_SCREEN#0 mode_ecmchar::@9/(byte*) mode_ecmchar::ch#1 ) [ mode_ecmchar::cy#4 mode_ecmchar::col#3 mode_ecmchar::ch#3 ] ( main:2::menu:9::mode_ecmchar:49 [ mode_ecmchar::cy#4 mode_ecmchar::col#3 mode_ecmchar::ch#3 ] )
[580] (byte*) mode_ecmchar::col#3 ← phi( mode_ecmchar::@8/(const byte*) mode_ecmchar::ECMCHAR_COLORS#0 mode_ecmchar::@9/(byte*) mode_ecmchar::col#1 ) [ mode_ecmchar::cy#4 mode_ecmchar::col#3 mode_ecmchar::ch#3 ] ( main:2::menu:9::mode_ecmchar:49 [ mode_ecmchar::cy#4 mode_ecmchar::col#3 mode_ecmchar::ch#3 ] )
[580] (byte*) mode_ecmchar::ch#3 ← phi( mode_ecmchar::@8/(const byte*) mode_ecmchar::SCREEN#0 mode_ecmchar::@9/(byte*) mode_ecmchar::ch#1 ) [ mode_ecmchar::cy#4 mode_ecmchar::col#3 mode_ecmchar::ch#3 ] ( main:2::menu:9::mode_ecmchar:49 [ mode_ecmchar::cy#4 mode_ecmchar::col#3 mode_ecmchar::ch#3 ] )
[580] (byte*) mode_ecmchar::col#3 ← phi( mode_ecmchar::@8/(const byte*) mode_ecmchar::COLORS#0 mode_ecmchar::@9/(byte*) mode_ecmchar::col#1 ) [ mode_ecmchar::cy#4 mode_ecmchar::col#3 mode_ecmchar::ch#3 ] ( main:2::menu:9::mode_ecmchar:49 [ mode_ecmchar::cy#4 mode_ecmchar::col#3 mode_ecmchar::ch#3 ] )
[580] (byte) mode_ecmchar::cy#4 ← phi( mode_ecmchar::@8/(byte/signed byte/word/signed word/dword/signed dword) 0 mode_ecmchar::@9/(byte) mode_ecmchar::cy#1 ) [ mode_ecmchar::cy#4 mode_ecmchar::col#3 mode_ecmchar::ch#3 ] ( main:2::menu:9::mode_ecmchar:49 [ mode_ecmchar::cy#4 mode_ecmchar::col#3 mode_ecmchar::ch#3 ] )
to:mode_ecmchar::@3
mode_ecmchar::@3: scope:[mode_ecmchar] from mode_ecmchar::@2 mode_ecmchar::@3
@ -1032,8 +1032,8 @@ mode_ecmchar::@16: scope:[mode_ecmchar] from mode_ecmchar::@5
to:mode_ecmchar::@return
mode_stdchar: scope:[mode_stdchar] from menu::@21
[603] *((const byte*) DTV_GRAPHICS_VIC_BANK#0) ← ((byte))((dword))(const byte*) mode_stdchar::CHARSET#0/(dword/signed dword) 65536 [ ] ( main:2::menu:9::mode_stdchar:42 [ ] )
[604] *((const byte*) DTV_COLOR_BANK_LO#0) ← <((word))(const byte*) mode_stdchar::COLORS#0/(word/signed word/dword/signed dword) 1024 [ ] ( main:2::menu:9::mode_stdchar:42 [ ] )
[605] *((const byte*) DTV_COLOR_BANK_HI#0) ← >((word))(const byte*) mode_stdchar::COLORS#0/(word/signed word/dword/signed dword) 1024 [ ] ( main:2::menu:9::mode_stdchar:42 [ ] )
[604] *((const byte*) DTV_COLOR_BANK_LO#0) ← <((word))(const dword) DTV_COLOR_BANK_DEFAULT#0/(word/signed word/dword/signed dword) 1024 [ ] ( main:2::menu:9::mode_stdchar:42 [ ] )
[605] *((const byte*) DTV_COLOR_BANK_HI#0) ← >((word))(const dword) DTV_COLOR_BANK_DEFAULT#0/(word/signed word/dword/signed dword) 1024 [ ] ( main:2::menu:9::mode_stdchar:42 [ ] )
[606] *((const byte*) DTV_CONTROL#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ ] ( main:2::menu:9::mode_stdchar:42 [ ] )
[607] *((const byte*) CIA2_PORT_A_DDR#0) ← (byte/signed byte/word/signed word/dword/signed dword) 3 [ ] ( main:2::menu:9::mode_stdchar:42 [ ] )
[608] *((const byte*) CIA2_PORT_A#0) ← (byte/signed byte/word/signed word/dword/signed dword) 3^((byte))((word))(const byte*) mode_stdchar::CHARSET#0/(word/signed word/dword/signed dword) 16384 [ ] ( main:2::menu:9::mode_stdchar:42 [ ] )

File diff suppressed because it is too large Load Diff

View File

@ -374,12 +374,12 @@
(label) mode_ecmchar::@8
(label) mode_ecmchar::@9
(label) mode_ecmchar::@return
(byte*) mode_ecmchar::ECMCHAR_CHARSET
(const byte*) mode_ecmchar::ECMCHAR_CHARSET#0 ECMCHAR_CHARSET = ((byte*))(word/dword/signed dword) 36864
(byte*) mode_ecmchar::ECMCHAR_COLORS
(const byte*) mode_ecmchar::ECMCHAR_COLORS#0 ECMCHAR_COLORS = ((byte*))(word/dword/signed dword) 33792
(byte*) mode_ecmchar::ECMCHAR_SCREEN
(const byte*) mode_ecmchar::ECMCHAR_SCREEN#0 ECMCHAR_SCREEN = ((byte*))(word/dword/signed dword) 32768
(byte*) mode_ecmchar::CHARSET
(const byte*) mode_ecmchar::CHARSET#0 CHARSET = ((byte*))(word/dword/signed dword) 36864
(byte*) mode_ecmchar::COLORS
(const byte*) mode_ecmchar::COLORS#0 COLORS = ((byte*))(word/dword/signed dword) 55296
(byte*) mode_ecmchar::SCREEN
(const byte*) mode_ecmchar::SCREEN#0 SCREEN = ((byte*))(word/dword/signed dword) 32768
(byte*) mode_ecmchar::ch
(byte*) mode_ecmchar::ch#1 ch zp ZP_WORD:5 420.59999999999997
(byte*) mode_ecmchar::ch#2 ch zp ZP_WORD:5 310.4
@ -534,7 +534,7 @@
(byte*) mode_mcchar::CHARSET
(const byte*) mode_mcchar::CHARSET#0 CHARSET = ((byte*))(word/dword/signed dword) 36864
(byte*) mode_mcchar::COLORS
(const byte*) mode_mcchar::COLORS#0 COLORS = ((byte*))(word/dword/signed dword) 33792
(const byte*) mode_mcchar::COLORS#0 COLORS = ((byte*))(word/dword/signed dword) 55296
(byte*) mode_mcchar::SCREEN
(const byte*) mode_mcchar::SCREEN#0 SCREEN = ((byte*))(word/dword/signed dword) 32768
(byte*) mode_mcchar::ch
@ -702,7 +702,7 @@
(byte*) mode_stdchar::CHARSET
(const byte*) mode_stdchar::CHARSET#0 CHARSET = ((byte*))(word/dword/signed dword) 36864
(byte*) mode_stdchar::COLORS
(const byte*) mode_stdchar::COLORS#0 COLORS = ((byte*))(word/dword/signed dword) 33792
(const byte*) mode_stdchar::COLORS#0 COLORS = ((byte*))(word/dword/signed dword) 55296
(byte*) mode_stdchar::SCREEN
(const byte*) mode_stdchar::SCREEN#0 SCREEN = ((byte*))(word/dword/signed dword) 32768
(byte*) mode_stdchar::ch