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
|
#include <stdio.h>
#include <conio.h>
#include <string.h>
#include <stdlib.h>
#include "fujichat.h"
#include "common.h"
/* TODO:
- rewrite in asm
*/
void run_prog(char *file) {
static char err[4];
int c;
fputs("\nLoading ", stdout);
fputs(file, stdout);
puts("...");
c = atari_exec(file);
// printf("Error %d!\n\xfd", c);
(void)itoa(c, err, 10);
fputs("Error ", stdout);
fputs(err, stdout);
putchar('!');
putchar(0xfd);
putchar('\n');
}
void main(void) {
int c, have_conf;
disable_break();
puts("\x7d" BANNER "\n\nMain Menu\n");
have_conf = get_config();
if(!have_conf)
set_default_config();
while(1) {
putchar('\n');
putchar(' ');
putchar(' ');
putchar(0xc1);
puts("bout");
// printf("\n %cbout\n", 'A' | 0x80);
putchar(have_conf ? ' ' : '*');
putchar(' ');
putchar(0xd3);
puts("etup");
/*
printf("%s%cetup\n",
(have_conf ? " " : "* "),
'S' | 0x80);
*/
putchar(have_conf ? '*' : ' ');
putchar(' ');
putchar(0xc3);
puts("hat");
/*
printf("%s%chat\n",
(have_conf ? "* " : " "),
'C' | 0x80);
*/
puts(" \xc4OS");
// printf(" %cOS\n", 'D' | 0x80);
putchar('\n');
putchar('>');
cursor(1);
c = cgetc();
if(c == A_EOL || c == ' ')
c = (have_conf ? 'C' : 'S');
putchar(c | 0x80);
switch(c) {
case 'A':
case 'a':
run_prog("D:ABOUT.COM");
break;
case 'S':
case 's':
run_prog(SETUP_FILENAME);
break;
case 'C':
case 'c':
run_prog(IRC_FILENAME);
// run_prog(IRC_LOADER_FILENAME);
break;
/*
if(config_is_valid()) {
// atari_exec(IRC_LOADER_FILENAME);
atari_exec(IRC_FILENAME);
return 0;
} else {
putchar(A_BS);
puts("\nYou must run Setup first");
break;
}
*/
case 'D':
case 'd':
return;
default:
putchar(A_BS);
break;
}
}
}
|