View Single Post
  #5  
Old 09-27-2007, 07:49 PM
unix unix is offline
Junior Member
 
Join Date: Sep 2009
Posts: 0
Default Re: p-code based C compilers

HansO wrote:
[...]
> It has indeed been done before.And it worked, a full system in very limited
> computers. The system is called the UCSD p-System, an operating system and
> several compilers and more based upon a virtual machine executing p-code. It was
> well-known as Apple Pascal on the Apple II. Z80 (CP/M based) versions also exist
> and many other platforms.


Yes, I know of p-System, but I was really thinking of something considerably
more lightweight. p-System is designed to be a complete platform running in a
VM. What I want is a simple inner interpreter, which coexists with routines
written in native machine code to do the heavy lifting, which is shipped as
part of the target executables.

The design I'm currently playing with is a dead simple accumulator machine
with eight 16-bit registers (and a separate accumulator), using single-byte
opcodes. Each opcode contains a four bit parameter specifier that allows
several addressing modes; unlike SWEET16, it's important for me to be able to
easily access values relative to the frame pointer.

Currently I'm thinking about opcode maps, and the best way of making dense code...

--
┌── dg*cowlark.com ─── http://www.cowlark.com ──────────────── ──

│ "The god of the Old Testament was actually a TRIBE OF RENEGADE SPACE
│ CANNIBALS." --- Robert McElwaine
Reply With Quote