-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathselect.c
59 lines (51 loc) · 1.23 KB
/
select.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
/* select.c
*/
#include <stdio.h>
#include "select.h"
#include "tokenize.h"
/* selectbasic
* - Selects a BASIC dialect with regard to the starting address
* in: adr - starting address
* out: BASIC dialect
*/
basic_t selectbasic(int adr)
{
/* With regard to the starting address, select a probable
* BASIC version
* 0401 => BASIC 2.0 (VIC20, +3K RAM) or Graphics52 (C64)
* Graphics52 is the super-set, select it
* 0801 => BASIC 2.0 (C64) or TFC3 BASIC (C64)
* TFC3 is the super-set, select it
* 1001 => BASIC 2.0 (VIC20 unexpanded)
* 1201 => BASIC 2.0 (VIC20 +8K RAM)
* 132D => BASIC 7.1 (C128) with bound extension file
* 1C01 => BASIC 7.0 (C128) or BASIC 7.1 (C128)
* BASIC 7.1 is the super-set, select it
* 4001 => BASIC 7.0 (C128)
* other=> select BASIC 7.1 (includes BASIC 2.0 and 7.0)
*/
switch (adr) {
case 0x0401:
return Graphics52;
break;
case 0x0801:
return TFC3;
break;
case 0x1001:
case 0x1201:
return Basic2;
break;
case 0x132D:
case 0x1C01:
return Basic71;
break;
case 0x4001:
return Basic7;
break;
default:
fprintf(stderr, "* Unrecognized start address of BASIC: %04x\n",
adr);
return Basic71;
break;
}
}