]> git.sur5r.net Git - c128-kasse/blob - src/print_charmap.c
patch charset to include umlauts
[c128-kasse] / src / print_charmap.c
1 #include <stdlib.h>
2 #include <conio.h>
3 #include <string.h>
4 #include <stdio.h>
5 #include <stdbool.h>
6
7 #include <c128.h>
8 #include <6502.h>
9
10 #include "vdc_util.h"
11 #include "vdc_patch_charset.h"
12
13 int main(void) {
14   int i = 80;
15   unsigned char c[2] = {0x00, 0x20};
16   unsigned char pos[5];
17
18   /* char attribute, alternate char set, white, full intensity.
19    * set to 0x0f for normal char set
20    */
21   unsigned char blank = 0x8f;
22
23   videomode(0x80);
24   fast();
25   clrscr();
26
27   cputsxy(4, 0, "0 1 2 3 4 5 6 7 8 9 A B C D E F");
28
29   /* Manipulate the VDC with IRQs turned off.
30    * KERNALs default IRQ handler will also try to read the VDC status
31    * register, which could interfere with our code trying to read it.
32    */
33   SEI();
34
35   // vdc_load_thinfont();
36   vdc_patch_charset();
37
38   /* write 16 chars per line */
39   do {
40     if ((*c % 16) == 0) {
41       sprintf(pos, "%02x  ", *c);
42       vdc_write_mem(i, pos, 4);
43       i = i + 4;
44     }
45
46     vdc_write_mem(i, c, 2);
47     ++(*c);
48     i = i + 2;
49
50     if ((*c % 16) == 0) {
51       i = i + 44;
52     }
53   } while (*c);
54
55   /* clear attribute mem */
56   i = 0;
57   while (++i <= 2000)
58     vdc_write_mem(i + 0x800, &blank, 1);
59
60   CLI();
61
62   /* set cursor, so basic's prompt won't overwrite our output */
63   gotoxy(0, 18);
64   cputs(EURSYM aUML oUML uUML AUML OUML UUML szLIG);
65   return 0;
66 }