HP3000-L Archives

September 1998, Week 4

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Wirt Atmar <[log in to unmask]>
Reply To:
Date:
Fri, 25 Sep 1998 13:04:35 EDT
Content-Type:
text/plain
Parts/Attachments:
text/plain (83 lines)
John Zoltak writes:

> Learning SPL aside, I don't think this is the easiest task to learn on.
>  This one would involve load library for the real CALENDAR intrinsic,
>  call by plabel and retrieving the returned value from the stack. This
>  isn't a task that I would like to learn SPL on.

John is right about having to call the LOADPROC routine, but it's not all that
difficult either. The easiest way to learn anything is to perform the
operation by imitation. I've included a bit of our own SPL code that does
almost exactly what's necessary:

  828     <<>>
  829     <<********************************************>>
  830     <<  CPU TYPE DETERMINATION >>
  831     <<                         >>
  832     <<  Returned Value =       >>
  833     <<                         >>
  834     <<      -1 -> I,CX         >>
  835     <<       0 -> I(?)         >>
  836     <<       1 -> II           >>
  837     <<       2 -> 30,33        >>
  838     <<       3 -> III          >>
  839     <<       4 -> 39,4x,5x     >>
  840     <<       5 -> 6x,70        >>
  841     <<       6 -> 37           >>
  842     <<       7 -> micro        >>
  843     <<       8 -> XE/LX/GX     >>
  844     <<      16 -> 9xx          >>
  845     <<                         >>
  846     <<>>
  847       PROCEDURE AUTHORS(CPUNUM);
  848       INTEGER CPUNUM;
  849       BEGIN
  850         INTEGER ID,PLABEL;
  851         INTRINSIC QUIT,LOADPROC,UNLOADPROC;
  852         BYTE ARRAY PNAME(0:7);
  853         BYTE ARRAY TEXT(0:41);
  854         MOVE TEXT:="PRODUCED BY WIRT ATMAR AND DAWSON SCHAFFER";
  855         PNAME(3):=TEXT(30);
  856         PNAME(7):=TEXT(8);
  857         PNAME(0):=TEXT(15);
  858         PNAME(1):=TEXT(36);
  859         PNAME(2):=TEXT(13);
  860         PNAME(6):=TEXT(4);
  861         PNAME(4):=TEXT(5);
  862         PNAME(5):=TEXT(0);
  863         CPUNUM:=0;
  864         ID:=LOADPROC(PNAME,0,PLABEL);
  865         IF <> THEN GOTO DEFAULT;
  866         TOS:=0;
  867         TOS:=PLABEL;
  868         ASSEMBLE(PCAL 0);
  869         CPUNUM:=TOS;
  870         UNLOADPROC(ID);
  871     DEFAULT:
  872       END;
  873     <<>>
  874     <<>>

As a bit of explanation, this routine calls an undocumented intrinsic named
THISCPU. In this case, the intrinsic could have easily been called directly,
but the intention behind this routine was to make the resulting object code
complicated enough so that a decompiler (in this presumed instance, a person
who might be wanting to get around his user license), who would take the time
to find and intercept the THISCPU routine and substitute in his own, smaller
value, give up.

Because we have very few Classic customers left -- and they all seem like
extraordinarily honest folk -- I don't mind sharing this routine now. To call
the CALENDAR routine, you would basically only have to change the value in the
PNAME variable (and you don't have to make its loading procedure so cryptic
:-). THISCPU and CALENDAR both return only one variable, a 16-bit integer.

The choice that Rob faces is either to do this -- or to write his own calendar
routine from scratch (and I'm not even sure how he would do that without
calling HP's CALENDAR intrinsic somewhere in the process).

Steve Cooper and Stan Sieler showed me how to do the above 15 years ago and
it's a pleasure to return the favor now.

Wirt Atmar

ATOM RSS1 RSS2