Update docs

This commit is contained in:
2015-01-27 18:56:12 -08:00
parent 5b0fe6f880
commit 6642358073
6 changed files with 21 additions and 35 deletions

View File

@@ -11,11 +11,11 @@ Because it's fun. Don't you like to have fun? Ogre.
What does it do?
=====
Right now, not much of anything at all. It boots from a 1.44mB floppy disk, throws some text to the screen, and enters a primitive REPL (where you can do nothing but display a help message, HALT the machine, or RESET the machine).
Right now, not much of anything at all. It boots from a 1.44mB floppy disk, and enters into a BASIC interpreter, just like your favorite home computers of the 70s/80s!
![Image of Piquant v0.1](media/screenshot.png)
I think I'm going to expand the basic REPL into a BASIC interpreter, just like the classic machines of the 80s. "Operating System? Oh, you mean the BASIC ROM, right?" :)
Currently the BASIC only understands simple, 1-digit arithmetic expressions. But this will soon change; I intend to implement at least as many features as uBASIC, maybe QuickBASIC eventually.
How can I run it?
=====

View File

@@ -1,2 +1,2 @@
_extern_c_main:
jmp 0x1000:0x0db4
jmp 0x1000:0x0cc8

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

@@ -197,7 +197,21 @@ struct basic_expr *basic_parse_expr(char *expbuf)
return ret;
}
void basic_run(void)
void basic_print_var(struct basic_variable *var)
{
char decimal[2];
decimal[0] = 0;
decimal[1] = 0;
if ( ( (var->flags & BASIC_VARFLAG_INIT) == BASIC_VARFLAG_INIT ) &&
( (var->flags & BASIC_VARFLAG_TINT) == BASIC_VARFLAG_TINT ) ) {
decimal[0] = dtoa((int)var->value);
_cputs(&decimal);
_cputs("\n");
}
}
void basic_repl(void)
{
char keybuff[512];
char outbuff[128];
@@ -224,9 +238,6 @@ void basic_run(void)
memset((void *)&outbuff, 0x00, 128);
if ( _cgets((char *)&keybuff) != NULL ) {
_cputs("\n");
_cputs("Analyzing ");
_cputs((char *)&keybuff);
_cputs("\n");
expr = basic_parse_expr((char *)&keybuff);
if ( expr == NULL ) {
@@ -238,26 +249,6 @@ void basic_run(void)
continue;
}
/* Debug */
decimal[0] = dtoa(expr->type);
memcpy(&outbuff, "Expression type: \0", strlen("Expression type: \0"));
strncat(&outbuff, &decimal, 1);
_cputs(&outbuff);
_cputs("\n");
decimal[0] = dtoa(expr->lval);
memcpy(&outbuff, "Expression lval: \0", strlen("Expression lval: \0"));
strncat(&outbuff, &decimal, 1);
_cputs(&outbuff);
_cputs("\n");
decimal[0] = dtoa(expr->rval);
memcpy(&outbuff, "Expression rval: \0", strlen("Expression rval: \0"));
strncat(&outbuff, &decimal, 1);
_cputs(&outbuff);
_cputs("\n");
/* Evaluate */
basic_solve_expr(expr, &result);
if ( basic_errno != 0 ) {
@@ -266,12 +257,7 @@ void basic_run(void)
_cputs(&decimal);
_cputs("\n");
} else {
if ( ( (result.flags & BASIC_VARFLAG_INIT) == BASIC_VARFLAG_INIT ) &&
( (result.flags & BASIC_VARFLAG_TINT) == BASIC_VARFLAG_TINT ) ) {
decimal[0] = dtoa((int)result.value);
_cputs(&decimal);
_cputs("\n");
}
basic_print_var(&result);
}
}
}

View File

@@ -58,6 +58,6 @@ struct basic_variable {
extern int basic_errno;
void run_basic(void);
void basic_repl(void);
#endif /* _BASIC_H_ */

View File

@@ -4,5 +4,5 @@
void main(void)
{
basic_run();
basic_repl();
}