Skip to content

Commit ee8fcb1

Browse files
C128 80col with udgs in text mode with colors
1 parent af2ffc3 commit ee8fcb1

File tree

16 files changed

+164
-13
lines changed

16 files changed

+164
-13
lines changed

src/Makefile_common

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -971,6 +971,17 @@ aquarius_exp_4k:
971971

972972
c128: c128_40col
973973

974+
c128_8502_80col: $(ASSETS_PATH)/8x8_chars.h
975+
$(CC65_PATH)$(MYCC65) $(INCLUDE_OPTS) -O -t c128 \
976+
-DXSize=80 \
977+
-D__CONIO_GRAPHICS -D__80COL_UDG -D_XL_NO_SMALL_LETTERS \
978+
-D_XL_SLOW_DOWN_FACTOR=$(_COMMON_SLOWDOWN_FACTOR)*$(_C128_8502_80COL_SLOWDOWN) \
979+
$(CROSS_LIB_PATH)/display/init_graphics/cc65/c128/c128_80col_init_graphics.c \
980+
$(CROSS_LIB_PATH)/sound/cc65/sid/sid_sounds.c \
981+
$(FULL_FILES) \
982+
-o $(BUILD_PATH)/X$(GAME_NAME)_$@.prg
983+
984+
974985
c128_zsdcc: c128_z80_40col_zsdcc
975986
c128_40col_zsdcc: c128_z80_40col_zsdcc
976987

@@ -1002,7 +1013,7 @@ endif
10021013
rm a40.ldr
10031014
rm a40
10041015

1005-
c128_80col: c128_z80_80col
1016+
c128_80col: c128_8502_80col
10061017

10071018
c128_z80_80col: $(ASSETS_PATH)/z88dk_sprites_definitions.h
10081019
$(Z88DK_PATH)$(MYZ88DK) +c128 $(SCCZ80_OPTS) -lgfx128hr \

src/cross_lib/display/display_macros.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,6 @@
312312
#if defined(__Z88DK_SPRITES_GRAPHICS) || defined(__MO5__)||defined(__TO7__) || defined(__COCO3__) || defined(__COCO__) || defined(__DRAGON__)
313313
#define _Z88DK_SPRITE_OFFSET (0x20)
314314
#else
315-
316315
#define _Z88DK_SPRITE_OFFSET 0x00
317316
#endif
318317

@@ -350,6 +349,8 @@
350349
// CLEAR SCREEN
351350
# if defined(__DEFAULT_CLEAR_SCREEN)
352351
void _XL_CLEAR_SCREEN(void);
352+
#elif defined(__NO_CLEAR_SCREEN)
353+
#define _XL_CLEAR_SCREEN()
353354
#elif defined(__TI99__)
354355
#include <vdp.h>
355356
#define _XL_CLEAR_SCREEN() vdpmemset(gImage, 32, 768)

src/cross_lib/display/graphics_mode/conio_graphics.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
gotoxy((X_OFFSET+(x)),(Y_OFFSET+(y))); \
1313
_XL_SET_TEXT_COLOR(color); \
1414
cputc(tile); \
15-
gotoxy((X_OFFSET+((XSize)-1)),(Y_OFFSET+((YSize)-1))); \
15+
gotoxy((X_OFFSET+((XSize)-1)),(Y_OFFSET+((YSize)))); \
1616
cputc(' '); \
1717
} \
1818
while(0)
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,81 @@
11
#include <c128.h>
22
#include "display_macros.h"
3+
#include <peekpoke.h>
34

5+
#include "8x8_chars.h"
6+
7+
#include "udg_map.h"
8+
9+
#define ADDRESS_PORT 0xD600
10+
#define DATA_PORT 0xD601
11+
12+
#define HIGH_ADDRESS_REGISTER 0x12
13+
#define LOW_ADDRESS_REGISTER 0x13
14+
#define VDC_DATA_REGISTER 0x1F
15+
16+
#define CHAR_BASE 0x3000
17+
18+
void vdc_write(uint8_t vdc_register, uint8_t value)
19+
{
20+
POKE(ADDRESS_PORT,vdc_register);
21+
while(!(PEEK(ADDRESS_PORT)&(0x80))){};
22+
POKE(DATA_PORT,value);
23+
}
24+
25+
void redefine(uint8_t tile, const uint8_t definition[])
26+
{
27+
uint8_t i;
28+
uint16_t address = CHAR_BASE + (((uint16_t)tile)<<4U);
29+
vdc_write(HIGH_ADDRESS_REGISTER,(uint8_t)(address>>8));
30+
vdc_write(LOW_ADDRESS_REGISTER,(uint8_t)(address&0x00FF));
31+
for(i=0;i<8;++i)
32+
{
33+
vdc_write(VDC_DATA_REGISTER,definition[i]);
34+
}
35+
}
36+
37+
void set_udg(void)
38+
{
39+
uint8_t i;
40+
41+
for (i = 0; i < (sizeof(redefine_map)/sizeof(*redefine_map)); ++i)
42+
{
43+
redefine(redefine_map[i].ascii,redefine_map[i].bitmap);
44+
}
45+
}
46+
47+
48+
// #define DEBUG
449

550
void _XL_INIT_GRAPHICS(void)
651
{
752
fast();
853
videomode(80);
54+
55+
#if !defined(DEBUG)
56+
57+
set_udg();
58+
59+
_setScreenColors();
60+
61+
#else
62+
63+
vdc_write(HIGH_ADDRESS_REGISTER,0x00);
64+
vdc_write(LOW_ADDRESS_REGISTER,0x00);
65+
{
66+
uint8_t i;
67+
68+
for(i=0;i<255;++i)
69+
{
70+
vdc_write(VDC_DATA_REGISTER,i);
71+
};
72+
}
73+
// sleep(2);
74+
set_udg();
75+
// sleep(2);
76+
while(1){};
77+
978
_setScreenColors();
79+
#endif
1080
}
1181

src/cross_lib/display/tiles.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
#include "pv1000_settings.h"
1010
#elif defined(__C64__) && defined(__CONIO_GRAPHICS)
1111
#include "c64_conio_settings.h"
12+
#elif defined(__C128__) && defined(__80COL_UDG)
13+
// #include "c264_redefined_chars_settings.h" 23 24
14+
#include "c128_settings.h"
1215
#elif defined(__ATARI7800_COLOR_GRAPHICS)
1316
#include "atari7800_settings.h"
1417
#elif defined(__BBC_GRAPHICS) && !defined(_XL_NO_UDG)
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
2+
#ifndef _C264_REDEFINED_CHARS_H
3+
#define _C264_REDEFINED_CHARS_H
4+
5+
// Still available:
6+
// 0x80-.... ?
7+
8+
// BLUE
9+
#define _TILE_0 0x3B
10+
#define _TILE_1 0x3C
11+
#define _TILE_2 0x3D
12+
#define _TILE_3 0x3E
13+
14+
#define _TILE_9 0x3F
15+
16+
// YELLOW
17+
#define _TILE_7 0x27
18+
#define _TILE_12 0x26
19+
#define _TILE_13 0x2B
20+
#define _TILE_25 0x24
21+
22+
// GREEN
23+
#define _TILE_8 0x2C
24+
25+
// RED
26+
#define _TILE_5 0x29
27+
28+
// CYAN
29+
#define _TILE_10 0x21
30+
#define _TILE_11 0x23
31+
32+
// WHITE
33+
#define _TILE_4 0x1F
34+
35+
#define _TILE_6 0x28
36+
37+
#define _TILE_14 0x22
38+
39+
#define _TILE_15 0x2E
40+
41+
#define _TILE_16 0x2F
42+
43+
#define _TILE_17 0x3A
44+
#define _TILE_18 0x25
45+
46+
// OK
47+
#define _TILE_19 0
48+
49+
// OK
50+
#define _TILE_20 28
51+
52+
// OK
53+
#define _TILE_21 30
54+
55+
// ok
56+
#define _TILE_22 0x2A
57+
58+
// KO:
59+
#define _TILE_23 ('b'-65)
60+
61+
// KO:
62+
#define _TILE_24 ('c'-65)
63+
64+
#define _TILE_26 0x2D
65+
66+
#endif // _C264_REDEFINED_CHARS_H
67+

src/games/bomber/config/project_config.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ _ATARI_LYNX_SLOWDOWN=1400
2020
_C16_SLOWDOWN=350
2121
_C16_CONIO_SLOWDOWN=450
2222
_C64_SLOWDOWN=350
23+
_C128_8502_80COL_SLOWDOWN=250
2324
_CBM610_SLOWDOWN=400
2425
_CBM510_SLOWDOWN=400
2526
_CREATIVISION_SLOWDOWN=100

src/games/chase/config/project_config.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ _ATARI5200_SLOWDOWN=70
1818
_ATARI7800_SLOWDOWN=210
1919
_ATARI7800_NO_COLOR_SLOWDOWN=150
2020
_ATARI_LYNX_SLOWDOWN=1000
21+
_C128_8502_80COL_SLOWDOWN=90
2122
_C16_SLOWDOWN=55
2223
_C16_CONIO_SLOWDOWN=85
2324
_C64_SLOWDOWN=45

src/games/horde/config/project_config.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ _ATARI_SLOWDOWN=60
2222
_ATARI5200_SLOWDOWN=60
2323
_ATARI7800_SLOWDOWN=130
2424
_ATARI_LYNX_SLOWDOWN=400
25+
_C128_8502_80COL_SLOWDOWN=50
2526
_C16_SLOWDOWN=55
2627
_C16_CONIO_SLOWDOWN=85
2728
_C64_SLOWDOWN=45

src/games/shoot/config/project_config.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ _ATARI_LYNX_SLOWDOWN=290
2121
_C16_SLOWDOWN=40
2222
_C16_CONIO_SLOWDOWN=60
2323
_C64_SLOWDOWN=40
24+
_C128_8502_80COL_SLOWDOWN=10
2425
_CBM610_SLOWDOWN=80
2526
_CBM510_SLOWDOWN=80
2627
_CREATIVISION_SLOWDOWN=100

0 commit comments

Comments
 (0)