Talk About Network



Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Basic Misc > Re: Interpreter...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 56 of 63 Topic 1431 of 1467
Post > Topic >>

Re: Interpreter for old basic programs from the line number era

by Eric <englere_geo@[EMAIL PROTECTED] > Mar 18, 2008 at 09:11 AM

On Mar 6, 5:26=A0pm, Guy Macon <http://www.guymacon.com/>
wrote:

> >There's Cheesecake BASIC V 3 that does.
>
> >http://noktosoft.megafolio.com/
>
> Now that is cool! "Cheesecake BASIC is written in BASIC, and
> can be compiled with the PowerBasic Console Compiler (2.0 or
> above), with QuickBASIC 4.5, or with Cheesecake BASIC V3"

I did some research on this compiler but I never published my
findings. Too busy, I guess.

V1 and V2 were interpreters that were similar to QBasic and they can
even run the gorilla program (as least V2 could run gorilla.bas - I
never tried V1).

He shifted gears in version 3 because he wanted to try writing a
compiler that generates a p-code type of pseudo language that he then
interprets at runtime. This came in a DOS and Windows flavor. The DOS
flavor still supported DOS graphics, but the Windows one did not
support graphics. The Windows flavor had to be compiled with Power
Basic for Windows, or by itself. The DOS flavor could be compiled by
Microsoft PDS, or Quickbasic 4.5, or Power Basic for DOS.

His runtime interpreter was written in Basic and compiled, and was
glued together with the p-code generated by compiling user programs.
This made stand-alone .exe programs. At runtime the interpreter would
fire up and then start executing the p-code by reading from the same
file that it was running from. To make things more confusing he called
this interpreter an "RTL", which most people assume is just a runtime
code library. Many people mistakenly thought user programs were
compiled to machine language because they saw the .exe stand-alone
outputs (of course, Quickbasic did this also).

However, despite the cool design, there was a problem with version 3
and that's why it died shortly thereafter. The runtime performance of
compiled programs was horrible! His version 2 interpreter was much
faster at running programs.

It turns out that he selected his p-code instruction set based on
making the compiler easier to write. He wasn't really thinking about
runtime efficiency. And the Basic code for the runtime intepreter was
elegant but quite inefficient.

He made an effort to fix the problem by writing a new runtime
interpreter in C. By getting closer to the metal and using pointers
instead of arrays, he figured he could make that part of it much
faster. But he never really finished the C interpreter.

Remember that the term Virtual Machine is just a fancy term that means
the runtime interpreter that executes the p-code instructions. "cvm"
is the Cheesecake virtual machine. Once this is compiled it is called
the "RTL".

The main parts are:

  ccbasic.exe  (32 bit windows compiler, comes from PB compiled
               code, only has a 32 bit version)

  ccwinrun.exe (32 bit windows interpreter/VM, comes only from
                PB compiled code)

  ccdosrun.exe (16 bit DOS interpreter/VM, comes only from
                QB or PDS compiled code)

  dos.rtl      (embeddable 16 bit DOS interpreter/VM, comes only
                from QB or PDS compiled code)

  windows.rtl  (embeddable 32 bit windows interpreter/VM, comes
                only from PB compiled code)

These C compiled programs are in the SRC\C\LCC subdir:

ccrun.exe - a CC basic VM for Win32. This can run foo.exe, but
            only in debug mode - this is not a finished program.
            It only outputs status info and doesn't run anything.

foo.exe - a compiled CC basic program that prints 3 when run. This
          has an embedded CVM interpreter. He got this by executing
          "make foo.bas" inside CCBASIC.

Although the compiler can theoretically compile itself, none of
the .exe's he released were compiled by itself. Maybe he wasn't
completely confident that it was bug free. I never tried the self-
compiling thing to see if it worked.

Why did I study this compiler? I wanted a cross-compiler than can
generate code for a microcontroller, such as the AVR. My plan was to
finish his C runtime interpreter, but have it compiled by a cross-
compiler (gcc for the AVR) so it can be embedded in a chip's flash
memory. A p-code type of compiler is much easier to work with and I
would hopefully be able to leverage most of the work he's already
done. I never got around to finishing this.

Freebasic is a much better compiler but is x86 specific and would be
extremely difficult to port. The Freebasic code generator and
optimizer are tightly bound to the compiler and there are no p-code
files anywhere.

Eric




 63 Posts in Topic:
Interpreter for old basic programs from the line number era
thomas.mertes@[EMAIL PROT  2008-03-03 11:12:00 
Re: Interpreter for old basic programs from the line number era
Paul Bartlett <bartlet  2008-03-03 20:07:01 
Re: Interpreter for old basic programs from the line number era
rebel <me@[EMAIL PROTE  2008-03-04 10:16:31 
Re: Interpreter for old basic programs from the line number era
"R.Nicholson" &  2008-03-03 18:23:10 
Re: Interpreter for old basic programs from the line number era
rebel <me@[EMAIL PROTE  2008-03-05 10:44:45 
Re: Interpreter for old basic programs from the line number era
thomas.mertes@[EMAIL PROT  2008-03-08 01:56:45 
Re: Interpreter for old basic programs from the line number era
ArarghMail803NOSPAM@[EMAI  2008-03-08 15:47:56 
Re: Interpreter for old basic programs from the line number era
thomas.mertes@[EMAIL PROT  2008-03-04 00:05:17 
Re: Interpreter for old basic programs from the line number era
"R.Nicholson" &  2008-03-04 19:09:26 
Re: Interpreter for old basic programs from the line number era
Happy Trails <nomail@[  2008-03-04 22:46:12 
Re: Interpreter for old basic programs from the line number era
"R.Nicholson" &  2008-03-04 21:06:46 
Re: Interpreter for old basic programs from the line number era
Happy Trails <nomail@[  2008-03-05 11:07:24 
Re: Interpreter for old basic programs from the line number era
thomas.mertes@[EMAIL PROT  2008-03-05 00:04:10 
Re: Interpreter for old basic programs from the line number era
"Auric__" <n  2008-03-06 17:12:03 
Re: Interpreter for old basic programs from the line number era
thomas.mertes@[EMAIL PROT  2008-03-06 12:05:46 
Re: Interpreter for old basic programs from the line number era
"Auric__" <n  2008-03-07 17:12:49 
Re: Interpreter for old basic programs from the line number era
ArarghMail803NOSPAM@[EMAI  2008-03-07 13:38:51 
Re: Interpreter for old basic programs from the line number era
"Auric__" <n  2008-03-07 23:58:56 
Re: Interpreter for old basic programs from the line number era
ArarghMail803NOSPAM@[EMAI  2008-03-07 18:53:19 
Re: Interpreter for old basic programs from the line number era
"Auric__" <n  2008-03-10 17:46:12 
Re: Interpreter for old basic programs from the line number era
ArarghMail803NOSPAM@[EMAI  2008-03-10 18:17:41 
Re: Interpreter for old basic programs from the line number era
"Auric__" <n  2008-03-11 17:01:43 
Re: Interpreter for old basic programs from the line number era
ArarghMail803NOSPAM@[EMAI  2008-03-11 17:43:05 
Re: Interpreter for old basic programs from the line number era
"Auric__" <n  2008-03-12 17:35:00 
Re: Interpreter for old basic programs from the line number era
ArarghMail803NOSPAM@[EMAI  2008-03-12 14:22:49 
Re: Interpreter for old basic programs from the line number era
"Auric__" <n  2008-03-13 15:10:08 
Re: Interpreter for old basic programs from the line number era
ArarghMail803NOSPAM@[EMAI  2008-03-13 19:36:55 
Re: Interpreter for old basic programs from the line number era
"Auric__" <n  2008-03-14 17:26:15 
Re: Interpreter for old basic programs from the line number era
ArarghMail803NOSPAM@[EMAI  2008-03-14 18:01:00 
Re: Interpreter for old basic programs from the line number era
Guy Macon <http://www.  2008-03-06 20:58:28 
Re: Interpreter for old basic programs from the line number era
"Tom Lake" <  2008-03-06 16:02:16 
Re: Interpreter for old basic programs from the line number era
Guy Macon <http://www.  2008-03-06 21:26:33 
Re: Interpreter for old basic programs from the line number era
"Judson McClendon&qu  2008-03-06 15:25:02 
Re: Interpreter for old basic programs from the line number era
ArarghMail803NOSPAM@[EMAI  2008-03-06 16:58:58 
Re: Interpreter for old basic programs from the line number era
Vic Drastik <user@[EMA  2008-03-08 23:33:53 
Re: Interpreter for old basic programs from the line number era
Vic Drastik <user@[EMA  2008-03-08 23:51:54 
Re: Interpreter for old basic programs from the line number era
thomas.mertes@[EMAIL PROT  2008-03-06 15:16:17 
Re: Interpreter for old basic programs from the line number era
thomas.mertes@[EMAIL PROT  2008-03-08 01:20:26 
Re: Interpreter for old basic programs from the line number era
"Auric__" <n  2008-03-10 17:51:46 
Re: Interpreter for old basic programs from the line number era
"Auric__" <n  2008-03-11 17:21:41 
Re: Interpreter for old basic programs from the line number era
"Auric__" <n  2008-03-11 17:23:33 
Re: Interpreter for old basic programs from the line number era
thomas.mertes@[EMAIL PROT  2008-03-08 01:38:33 
Re: Interpreter for old basic programs from the line number era
thomas.mertes@[EMAIL PROT  2008-03-11 12:57:35 
Re: Interpreter for old basic programs from the line number era
"Auric__" <n  2008-03-12 18:06:43 
Re: Interpreter for old basic programs from the line number era
Warren Gay <snark@[EMA  2008-03-13 15:19:22 
Re: Interpreter for old basic programs from the line number era
thomas.mertes@[EMAIL PROT  2008-03-13 03:41:59 
Re: Interpreter for old basic programs from the line number era
Warren Gay <snark@[EMA  2008-03-13 15:36:05 
Re: Interpreter for old basic programs from the line number era
Thomas Dickey <dickey@  2008-03-14 11:11:41 
Re: Interpreter for old basic programs from the line number era
Charmed Snark <snark@[  2008-03-14 15:28:29 
Re: Interpreter for old basic programs from the line number era
Thomas Dickey <dickey@  2008-03-14 22:37:27 
Re: Interpreter for old basic programs from the line number era
Charmed Snark <snark@[  2008-03-15 04:15:36 
Re: Interpreter for old basic programs from the line number era
Thomas Dickey <dickey@  2008-03-16 13:10:27 
Re: Interpreter for old basic programs from the line number era
Thomas Dickey <dickey@  2008-03-14 16:03:56 
Re: Interpreter for old basic programs from the line number era
thomas.mertes@[EMAIL PROT  2008-03-14 08:41:36 
Re: Interpreter for old basic programs from the line number era
Charmed Snark <snark@[  2008-03-14 15:57:50 
Re: Interpreter for old basic programs from the line number era
Eric <englere_geo@[EMA  2008-03-18 09:11:26 
Re: Interpreter for old basic programs from the line number era
Charmed Snark <snark@[  2008-03-18 19:52:03 
Re: Interpreter for old basic programs from the line number era
winston19842005 <bjjly  2008-03-18 18:18:44 
Re: Interpreter for old basic programs from the line number era
Eric <englere_geo@[EMA  2008-03-18 20:41:12 
Re: Interpreter for old basic programs from the line number era
"winston19842005@[EM  2008-03-18 22:13:40 
Re: Interpreter for old basic programs from the line number era
Charmed Snark <snark@[  2008-03-19 15:32:27 
Re: Interpreter for old basic programs from the line number era
thomas.mertes@[EMAIL PROT  2008-03-19 12:35:28 
Re: Interpreter for old basic programs from the line number era
Derek <derekrss@[EMAIL  2008-03-19 22:37:05 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Thu May 22 14:16:23 CDT 2008.