-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.c
158 lines (156 loc) · 4.38 KB
/
main.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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
#include <conio.h>
#include <em.h>
#include <peekpoke.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "main.h"
void main() {
char cpu[10];
char cpuResult;
char dev8[36];
char dev9[36];
char dev10[36];
char dev11[36];
char divLength;
char i;
char kernal[16];
char kernalResult;
char key;
char model[17];
char prev289 = PEEK(0x289);
char prev28A = PEEK(0x28A);
char prev291 = PEEK(0x291);
char prevborder = PEEK(0xD020);
char prevbg = PEEK(0xD021);
char prevcolor = PEEK(0x286);
char region[9];
char regionResult;
char sid[9];
char sidResult;
char speed[10];
POKE(0x289,1);
POKE(0x28A,0x7F);
POKE(0x291,0xFF);
clrscr();
POKE(0xD020,1);
POKE(0xD021,0);
printf("\5Detecting SID...");
sidResult = detect_sid();
switch (sidResult) {
case 1:
strcpy(sid, "MOS 6581");
break;
case 2:
strcpy(sid, "MOS 8580");
break;
default:
strcpy(sid, "Unknown");
}
printf(" Done.\nDetecting region...");
regionResult = detect_region();
switch (regionResult) {
case 1:
strcpy(region, "Old NTSC");
break;
case 2:
strcpy(region, "NTSC");
break;
case 3:
strcpy(region, "PAL");
break;
case 4:
strcpy(region, "PAL-N");
break;
default:
strcpy(region, "Unknown");
}
printf(" Done.\nDetecting kernal revision...");
kernalResult = detect_kernal();
switch (kernalResult) {
case 1:
strcpy(kernal, "901227-01");
break;
case 2:
strcpy(kernal, "901227-02");
break;
case 3:
strcpy(kernal, "901227-03");
break;
case 4:
strcpy(kernal, "251104-04");
break;
case 5:
strcpy(kernal, "251104-01");
break;
case 6:
strcpy(kernal, "901246-01");
break;
case 10:
strcpy(kernal, "JiffyDOS (C64)");
break;
case 11:
strcpy(kernal, "JiffyDOS (SX-64)");
break;
default:
strcpy(kernal, "Unknown");
}
printf(" Done.\nDetecting CPU...");
cpuResult = detect_cpu(sidResult);
switch (cpuResult) {
case 0:
strcpy(cpu, "MOS 6502");
break;
case 2:
strcpy(cpu, "WDC 65816");
break;
case 9:
strcpy(cpu, "MOS 8502");
break;
case 10:
strcpy(cpu, "MOS 8500");
break;
case 11:
strcpy(cpu, "MOS 6510");
break;
default:
strcpy(cpu, "Unknown");
}
detect_speed(1, cpuResult, regionResult, speed);
printf(" Done.\nDetecting Drives");
clrstr(dev8);
detect_drive(8, dev8);
printf(".");
clrstr(dev9);
detect_drive(9, dev9);
printf(".");
clrstr(dev10);
detect_drive(10, dev10);
printf(".");
clrstr(dev11);
detect_drive(11, dev11);
printf(" Done.\nDetecting Model...");
divLength = detect_model(regionResult, sidResult, kernalResult, cpuResult, model);
printf(" Done.");
clrscr();
printf("\n \x1F \xAC\x12\xBE \xBC\x92\x05 %s\n", model);
printf(" \x1F \x12\xBE \x92\x05 ");
for (i = 0; i < divLength; i++) {printf("\xC0");}
printf("\n \x1F \x12\xBE \x92\x05 KERNAL: %s\n", kernal);
printf(" \x1F\xAC\x12 \xA2\x92 \xBC\xA2\xA2\xA2\xA2\xA2\x05 CPU: %s %s*\n", cpu, speed);
printf(" \x1F\x12\xBE \x92\xA1 \x12 \x92\xBE\x05 VIC: %s\n", region);
printf(" \x1F\x12 \x92 \x12 \x92\xBE\x05 SID: %s\n", sid);
printf(" \x1F\x12 \x92 \x81\xA2\xA2\xA2\x05 %s\n", dev8);
printf(" \x1F\x12 \x92\xBB \x81\x12 \xBC\x92\x05 %s\n", dev9);
printf(" \x1F\x12\xE1 \xBC\x92 \x81\x12 \xBC\x92\x05 %s\n", dev10);
printf(" \x1F \x12 \x92\xA2\xA2\x12\xBE\x92\x05 %s\n", dev11);
printf(" \x1F \xBC\x12 \x92\n");
printf(" \x1F \xBC\x12\xBB \x92\n");
printf(" \x1F \xBC\x12\xA2\xA2\x92\xBE\n");
printf("\n\x05 *CPU MHz is only an approximation.\n");
printf("\n Press RETURN to exit.");
while(key != 0x0D) {
key = cgetc();
}
__asm__ ("jsr $FCE2"); // cold reset
}