2017-05-04 18:34:57 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <unistd.h>
|
2023-07-31 18:16:49 +00:00
|
|
|
#include <string.h>
|
2017-05-04 18:34:57 +00:00
|
|
|
|
|
|
|
#include "gr-sim.h"
|
|
|
|
|
|
|
|
int main(int argc, char **argv) {
|
|
|
|
|
2017-05-18 17:09:51 +00:00
|
|
|
int ch,i;
|
2017-05-18 03:25:07 +00:00
|
|
|
char output[BUFSIZ];
|
2023-07-31 18:16:49 +00:00
|
|
|
unsigned char data[1024];
|
|
|
|
FILE *fff;
|
2017-05-04 18:34:57 +00:00
|
|
|
|
|
|
|
grsim_init();
|
|
|
|
|
|
|
|
home();
|
|
|
|
|
2017-05-17 21:14:47 +00:00
|
|
|
gr();
|
|
|
|
|
2017-05-17 19:47:20 +00:00
|
|
|
text();
|
|
|
|
|
|
|
|
|
2023-07-31 18:16:49 +00:00
|
|
|
if (argc<2) {
|
2017-05-17 19:47:20 +00:00
|
|
|
|
2023-07-31 18:16:49 +00:00
|
|
|
basic_htab(10);
|
2017-05-18 03:25:07 +00:00
|
|
|
|
2023-07-31 18:16:49 +00:00
|
|
|
basic_vtab(10);
|
|
|
|
|
|
|
|
basic_print("HELLO WORLD!\r\r");
|
|
|
|
|
|
|
|
|
|
|
|
for(i=0;i<128;i++) {
|
|
|
|
sprintf(output,"%c",i);
|
|
|
|
basic_print(output);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
fff=fopen(argv[1],"r");
|
|
|
|
if (fff==NULL) {
|
|
|
|
fprintf(stderr,"Error opening %s\n",argv[1]);
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
fread(data,1024,1,fff);
|
|
|
|
memcpy(ram+1024,data,1024);
|
2017-05-18 03:25:07 +00:00
|
|
|
}
|
2017-05-17 19:47:20 +00:00
|
|
|
|
2017-05-04 18:34:57 +00:00
|
|
|
while(1) {
|
|
|
|
grsim_update();
|
|
|
|
|
|
|
|
ch=grsim_input();
|
|
|
|
|
|
|
|
if (ch=='q') break;
|
|
|
|
|
|
|
|
usleep(100000);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|