Category : Files from Magazines
Archive   : DDJSEP91.ZIP
Filename : ADD_EXT.LST
by Neville Franks
Figurå 2:
(a) sp = bp - size of stack frame;
bp = sp[ stack frame link ];
es = sp[ expression stack ];
ip = sp[ return address ];
sp = sp - sp[ argument count ];
(b) sp[ return address ] = ip;
sp[ stack frame link ] = bp;
sp[ expression stack ] = es;
sp[ argument count ] = arg_count;
sp = sp + size of stack frame;
bp = es = sp;
ip = function address;
Figurå 4:
switch( ip->instruction )
{
case LODI : /* load immediate -> ++sp */
*++sp = ip->immed_val;
++ip;
break;
case STOR : /* store sp -> local variable */
*(bp + ip->addr) = *sp;
++ip;
break;
case OPR_ADD : /* add values on stack */
--sp;
*sp += *( sp + 1 );
++ip;
break;
case JPT : /* conditional jump - true */
if ( *sp == 0 )
{
++ip; /* next instr */
break;
} /* note: fall through */
case JMP : /* unconditional jump */
ip = ip->addr;
break;
case ....
}
Figurå 6:
(a)
add_up_numbers()
{
void *parms[4];
int result;
parms[0] = &result; /* result passed by reference */
/* numbers passed by value */
parms[1] = 23; parms[2] = 69; parms[3] = -78;
pgm_run( "add_num", 4, parms );
printf( "Result = %d", result );
}
(b)
main( result, num1, num2, num3 )
int *result, num1, num2, num3;
{
*result = num1 + num2 + num3;
}
Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!
This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.
But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/