-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDemo.c
140 lines (125 loc) · 2.46 KB
/
Demo.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
#include "xinaga.h"
#include "System_MessageWindow.h"
//Tests
void DrawCharset()
{
byte x, y;
byte i = 0;
DrawBorder("Character Set@", 0, 0, 18, 18, false);
for (y= 0; y < 16; ++y)
for (x = 0; x < 16; ++x)
{
SetChar(i, x+1, y+1);
++i;
}
i += 16;
}
void DrawTiles()
{
byte x, y, z;
DrawBorder("Tiles@", 18, 0, 18, 18, false);
SetTileOrigin(19, 1);
StoreBuffer();
for (y = 0; y < 8; ++y)
for (x = 0; x < 8; ++x)
{
DrawTileFast(/*x*y - */z, x, y);
++z;
}
SwapBuffer();
}
void DrawMap()
{
#if defined(__APPLE2__)
#define sizeX 8
#define sizeY 8
#endif
#if defined(__C64__)
#define sizeX 9
#define sizeY 9
#endif
byte MapData[sizeX * sizeY];
byte MapTemp[sizeX * sizeY];
byte charX, charY, charI;
byte x, y, z, i = 0;
DrawBorder("Map@", 0, 0, sizeX * 2 + 2, sizeY * 2 + 2, false);
for (x = 0; x < (sizeX * sizeY); ++x)
MapData[x] = 36;
MapData[36] = 47;
MapData[26] = 44;
//MapData[10] = 2;
SetTileOrigin(1, 1);
charX = 2;
charY = 0;
charI = 2;
while(1)
{
memcpy(&MapTemp[0], &MapData[0], sizeX * sizeY);
MapTemp[charY*sizeX + charX] = charI;
if (i & 1)
charX++;
else
charY++;
++i;
if (charX > sizeX - 1)
charX -= sizeX;
if (charY > sizeY - 1)
charY -= sizeY;
z = 0;
StoreBuffer();
for (y = 0; y < sizeY; ++y)
for (x = 0; x < sizeX; ++x)
{
DrawTileFast(MapTemp[z], x, y);
++z;
}
SwapBuffer();
z = 2;
for (y = 0; y < sizeY; ++y)
for (x = 0; x < sizeX; ++x)
{
//MapData[z - 1] = MapData[z];
++z;
}
}
}
/*void ScrollScreen()
{
Scroll(right);
Scroll(right);
Scroll(down);
Scroll(down);
Scroll(left);
Scroll(left);
Scroll(up);
Scroll(up);
}*/
void Demo()
{
InitializeInput();
InitializeGraphics();
ClearScreen();
#if defined(__APPLE2__)
DrawBorder("Hello Apple!@", 0, ROWS - 3, COLS, 3, false);
#endif
#if defined(__C64__)
DrawBorder("Hello C64!@", 0, ROWS - 3, COLS, 3, false);
#endif
//DrawCharset();
//DrawTiles();
//SetTileOrigin(3, 2);
LoadMap();
BlankMessageWindow();
DrawMessageWindow();
MapUpdate();
while(1)
{
WriteLineMessageWindow("Hello@", 0);
WriteLineMessageWindow("Hello@", 1);
//DiskSave("data1", 0x2001, 0x2000);
//DiskLoad("data1", 0x2000);
//DrawCharset();
//SwapBuffer();
//ClearScreen();
}
}