Subject:
|
docs for pcode
|
Newsgroups:
|
lugnet.robotics.handyboard
|
Date:
|
Mon, 17 Jun 1996 15:40:10 GMT
|
Original-From:
|
Randy Sargent <{rsargent@newtonlabs}AntiSpam{.com}>
|
Viewed:
|
1922 times
|
| |
| |
> Does anyone know where I can get the definitions of the virtual machine
> and bytecodes used by Interactive C?
> I am thinking of creating a smalltalk-like language for the Handyboard.
If you're interested in learning what the various pcodes do, or in making a
new development environment which backends to the pcodes, I'd recommend
looking at "pcodesim.c" in the libs directory of the IC sources. This is a
fairly straightforward implementation of the pcode instruction set in C,
and is useful both as a reference to the pcodes, and also as a good backend
to try first for your development environment (it's much easier to debug).
The code looks sort of like this:
case 2*Padd2 : b=POP2; a=POP2; PUSH2(a + b); break;
case 2*Psub2 : b=POP2; a=POP2; PUSH2( a - b); break;
case 2*Pmult2 : b=POP2; a=POP2; PUSH2( a * b); break;
case 2*Pdiv2 : b=POP2; a=POP2; PUSH2( a / b); break;
...
case 2*Ppush2: PUSH2( FETCH2); break;
case 2*Ppush4: PUSH4( FETCH4); break;
Pretty easy to understand, I hope.
-- Randy
|
|
1 Message in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|