Subversion Repositories Shiroi

Rev

Rev 28 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 28 Rev 29
Line 1... Line 1...
1
/* $Id: basic.c 28 2024-08-31 12:49:20Z nishi $ */
1
/* $Id: basic.c 29 2024-08-31 17:41:43Z nishi $ */
2
 
2
 
3
#include "dri/text.h"
3
#include "dri/text.h"
4
 
4
 
-
 
5
#include "char.h"
-
 
6
 
-
 
7
#define BUFFER_SIZE (1024 * 16)
-
 
8
 
5
unsigned char basicbuffer[1024 * 30];
9
unsigned char basicbuffer[BUFFER_SIZE];
-
 
10
char linebuf[1024];
6
 
11
 
7
void basic(void){
12
void basic(void){
8
	clear();
13
	clear();
9
 
14
 
10
	putstr("Shiroi Microcomputer BASIC\r\n");
15
	putstr("Shiroi Microcomputer BASIC\r\n");
11
	putstr("Copyright 2024 by Nishi\r\n");
16
	putstr("Copyright 2024 by Nishi\r\n");
-
 
17
	putnum(BUFFER_SIZE);
-
 
18
	putstr(" bytes free\r\n");
12
	cursor();
19
	cursor();
-
 
20
	linebuf[0] = 0;
13
	int lineind = 0;
21
	int lineind = 0;
14
	while(1){
22
	while(1){
15
		char c = agetch();
23
		char c = agetch();
16
		if(c != 0) killcursor();
24
		if(c != 0) killcursor();
17
		if(c == 1){
25
		if(c == 1){
18
			putstr("Break\r\n");
26
			putstr("Break\r\n");
19
			lineind = 0;
27
			lineind = 0;
20
		}else if(c == '\n'){
28
		}else if(c == '\n'){
-
 
29
			linebuf[lineind] = 0;
21
			putstr("\r\n");
30
			putstr("\r\n");
22
			lineind = 0;
31
			lineind = 0;
23
		}else if(c == 0x8){
32
		}else if(c == 0x8){
24
			if(lineind > 0){
33
			if(lineind > 0){
25
				putstr("\x08 \x08");
34
				putstr("\x08 \x08");
26
				lineind--;
35
				lineind--;
27
			}
36
			}
28
		}else if(c != 0){
37
		}else if(c != 0){
29
			putchar(c);
38
			putchar(c);
30
			lineind++;
39
			linebuf[lineind++] = c;
31
		}
40
		}
32
		cursor();
41
		cursor();
33
	}
42
	}
34
}
43
}