13 year old C source - Thanks to all

Discussion in 'C Programming' started by buck, Jul 29, 2011.

  1. buck

    buck Guest

    I can't ask the original coder what he was thinking because he's dead,
    having fallen off a mountain while attempting to climb it.

    Everyone seems to want to know what this code does. There are 10
    objects that get linked into a TSR executable. As concisely as I can
    describe it, it provides an interface into ISAM low level functions
    (add, delete, read, update, etc), "blasts" templates to the monitor,
    keeps track of how many users, allows only one instance per user,
    beeps the speaker...

    Yes I can compile it using the DeSmet development tools. It has been
    working error-free since 1989 - and before, prior to a few small
    changes for much longer than that (though I don't know just how long.
    I started working for the company January 1987.

    > 'static char v[]={-20,-124,-180,-93,-88,-73,-27,-146,9,-38,-179 ...'


    I've examined the object code to see what values are present there but
    haven't found this array yet.

    It seems that the concensus is that this project is fesable, but not
    by me. I need more time to think about it, but will take all advice
    strongly into consideration.

    THANKS
    --
    buck
    buck, Jul 29, 2011
    #1
    1. Advertising

  2. buck wrote:
    >Everyone seems to want to know what this code does. There are 10
    >objects that get linked into a TSR executable. As concisely as I can
    >describe it, it provides an interface into ISAM low level functions
    >(add, delete, read, update, etc), "blasts" templates to the monitor,
    >keeps track of how many users, allows only one instance per user,
    >beeps the speaker...
    >
    >Yes I can compile it using the DeSmet development tools. It has been
    >working error-free since 1989 - and before, prior to a few small
    >changes for much longer than that (though I don't know just how long.
    >I started working for the company January 1987.
    >
    >> 'static char v[]={-20,-124,-180,-93,-88,-73,-27,-146,9,-38,-179 ...'

    >
    >I've examined the object code to see what values are present there but
    >haven't found this array yet.
    >
    >It seems that the concensus is that this project is fesable, but not
    >by me. I need more time to think about it, but will take all advice
    >strongly into consideration.
    >
    >THANKS


    Buck, the information you provided "between the lines" in this post
    suggests to me that porting that application would be the wrong
    approach.

    You mention TSRs. TSRs were a used to provide limited multitasking
    capabilities to an otherwise single-task OS. In a contemporary OS (any
    version of Windows, Linux, Mac's xxxBSD, etc) multitasking is a given.
    Therefore, all the code used to setup and manage the TSRs can be
    discarded.

    You mention ISAM. So, this is a database related application.
    It is likely that the whole application could be implemented within a
    modern database (FoxBASE, MS Access, FileMaker, DB2, etc. See
    http://en.wikipedia.org/wiki/Comparison_of_relational_database_management_systems
    )

    "blasts templates to the monitor, keeps track of how many users,
    allows only one instance per user"...
    All covered by the two points above.

    My "new and improved" recommendation: Forget the code, understand what
    the application does as a whole, then ask around to find the best way
    to implement that functionality with modern tools. It will probably
    requier a much smaller effort than what you expect.
    --
    Roberto Waltman

    [ Please reply to the group,
    return address is invalid ]
    Roberto Waltman, Jul 29, 2011
    #2
    1. Advertising

  3. buck <> writes:
    [...]
    >> 'static char v[]={-20,-124,-180,-93,-88,-73,-27,-146,9,-38,-179 ...'

    >
    > I've examined the object code to see what values are present there but
    > haven't found this array yet.


    This might help:

    ec 84 4c a3 a8 b7 e5 6e 09 da 4d

    That's the hex representation of the array (assuming typical overflow
    behavior). Given the right tools, you might be able to search for it in
    the binaries.

    --
    Keith Thompson (The_Other_Keith) <http://www.ghoti.net/~kst>
    Nokia
    "We must do something. This is something. Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"
    Keith Thompson, Jul 29, 2011
    #3
  4. On 28-Jul-11 23:38, buck wrote:
    > I can't ask the original coder what he was thinking because he's dead,
    > having fallen off a mountain while attempting to climb it.


    Hopefully, he commented his code. Novice programmers, take note.

    > Everyone seems to want to know what this code does. There are 10
    > objects that get linked into a TSR executable.


    There's your first problem. While you don't say what the new target
    platform is, a "TSR" is a purely DOS concept and there is no 64-bit DOS.
    I assume your "64-bit" OS is either Windows or Unix, so you're already
    looking at a fairly significant rewrite.

    > As concisely as I can describe it, it provides an interface into
    > ISAM low level functions (add, delete, read, update, etc), "blasts"
    > templates to the monitor, keeps track of how many users, allows only
    > one instance per user, beeps the speaker...


    Aside from "beeping the speaker", those are all functions I suspect you
    would want in a "service" (Windows) or "daemon" (Unix).

    However, I wonder if the "correct" solution would be rewriting the
    entire application set to use a COTS database such as MySQL or SQLite.
    That approach might have been "too slow" on PC hardware in the 1980s,
    but it's not today, and would probably require less total effort
    considering how much open-source code you could leverage.

    > Yes I can compile it using the DeSmet development tools. It has been
    > working error-free since 1989 - and before, prior to a few small
    > changes for much longer than that (though I don't know just how long.
    > I started working for the company January 1987.


    Well, that's something at least. Many times, when folks arrive with
    questions like this, they don't even have the original tool chain. I'm
    not sure how much it will help in this case, though.

    > It seems that the concensus is that this project is fesable, but not
    > by me. I need more time to think about it, but will take all advice
    > strongly into consideration.


    Please don't take that as an insult; we're just reacting to the skill
    level implied by your original questions, which might not be correct
    based on this follow-up. However, what you seem to be asking for will
    require significant skill in two different languages and two different
    platforms, and probably databases as well.

    S

    --
    Stephen Sprunk "God does not play dice." --Albert Einstein
    CCIE #3723 "God is an inveterate gambler, and He throws the
    K5SSS dice at every possible opportunity." --Stephen Hawking
    Stephen Sprunk, Jul 29, 2011
    #4
  5. buck

    Ben Pfaff Guest

    Keith Thompson <> writes:

    > buck <> writes:
    > [...]
    >>> 'static char v[]={-20,-124,-180,-93,-88,-73,-27,-146,9,-38,-179 ...'

    >>
    >> I've examined the object code to see what values are present there but
    >> haven't found this array yet.

    >
    > This might help:
    >
    > ec 84 4c a3 a8 b7 e5 6e 09 da 4d


    Out of curiosity, I fed this into an 8086 disassembler, but the
    results don't make much sense so I doubt that this is 8086
    machine code:

    0: ec in (%dx),%al
    1: 84 4c a3 test %cl,-0x5d(%si)
    4: a8 b7 test $0xb7,%al
    6: e5 6e in $0x6e,%ax
    8: 09 da or %bx,%dx
    a: 4d dec %bp

    --
    char a[]="\n .CJacehknorstu";int putchar(int);int main(void){unsigned long b[]
    ={0x67dffdff,0x9aa9aa6a,0xa77ffda9,0x7da6aa6a,0xa67f6aaa,0xaa9aa9f6,0x11f6},*p
    =b,i=24;for(;p+=!*p;*p/=4)switch(0[p]&3)case 0:{return 0;for(p--;i--;i--)case+
    2:{i++;if(i)break;else default:continue;if(0)case 1:putchar(a[i&15]);break;}}}
    Ben Pfaff, Jul 29, 2011
    #5
  6. Ben Pfaff wrote:
    >Keith Thompson <> writes:
    >> buck <> writes:
    >>>> 'static char v[]={-20,-124,-180,-93,-88,-73,-27,-146,9,-38,-179 ...'

    >>...
    >> This might help:
    >>
    >> ec 84 4c a3 a8 b7 e5 6e 09 da 4d

    >
    >Out of curiosity, I fed this into an 8086 disassembler, but the
    >results don't make much sense so I doubt that this is 8086
    >machine code:


    Wild guess: A key/password for the database?
    --
    Roberto Waltman

    [ Please reply to the group.
    Return address is invalid ]
    Roberto Waltman, Jul 29, 2011
    #6
  7. Roberto Waltman <> writes:
    > Ben Pfaff wrote:
    >>Keith Thompson <> writes:
    >>> buck <> writes:
    >>>>> 'static char v[]={-20,-124,-180,-93,-88,-73,-27,-146,9,-38,-179 ...'
    >>>...
    >>> This might help:
    >>>
    >>> ec 84 4c a3 a8 b7 e5 6e 09 da 4d

    >>
    >>Out of curiosity, I fed this into an 8086 disassembler, but the
    >>results don't make much sense so I doubt that this is 8086
    >>machine code:

    >
    > Wild guess: A key/password for the database?


    Wild guess: the late original programmer was really bad at choosing
    variable names.

    I'd search the source code for occurrences of "v" (full word only) to
    see how it's used. (And if nothing ever modifies it, I'd add "const" to
    the declaration.)

    --
    Keith Thompson (The_Other_Keith) <http://www.ghoti.net/~kst>
    Nokia
    "We must do something. This is something. Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"
    Keith Thompson, Jul 29, 2011
    #7
  8. buck

    BartC Guest

    "Ben Pfaff" <> wrote in message
    news:...
    > Keith Thompson <> writes:
    >
    >> buck <> writes:
    >> [...]
    >>>> 'static char v[]={-20,-124,-180,-93,-88,-73,-27,-146,9,-38,-179 ...'
    >>>
    >>> I've examined the object code to see what values are present there but
    >>> haven't found this array yet.

    >>
    >> This might help:
    >>
    >> ec 84 4c a3 a8 b7 e5 6e 09 da 4d

    >
    > Out of curiosity, I fed this into an 8086 disassembler, but the
    > results don't make much sense so I doubt that this is 8086
    > machine code:
    >
    > 0: ec in (%dx),%al
    > 1: 84 4c a3 test %cl,-0x5d(%si)
    > 4: a8 b7 test $0xb7,%al
    > 6: e5 6e in $0x6e,%ax
    > 8: 09 da or %bx,%dx
    > a: 4d dec %bp


    Start disassembling at the 4C byte, it makes slightly more sense.

    But even it it was machine code, why would it be expressed with an extra 9th
    bit? And why not use the assembler that apparently is available?

    --
    Bartc
    BartC, Jul 29, 2011
    #8
  9. buck

    Joe Pfeiffer Guest

    buck <> writes:

    > I can't ask the original coder what he was thinking because he's dead,
    > having fallen off a mountain while attempting to climb it.
    >
    > Everyone seems to want to know what this code does. There are 10
    > objects that get linked into a TSR executable. As concisely as I can
    > describe it, it provides an interface into ISAM low level functions
    > (add, delete, read, update, etc), "blasts" templates to the monitor,
    > keeps track of how many users, allows only one instance per user,
    > beeps the speaker...
    >
    > Yes I can compile it using the DeSmet development tools. It has been
    > working error-free since 1989 - and before, prior to a few small
    > changes for much longer than that (though I don't know just how long.
    > I started working for the company January 1987.


    I can't resist pointing out that 1989 was 22 years ago. For it to have
    been working for an equal time before then would require it to have been
    written in 1967 :)
    Joe Pfeiffer, Jul 29, 2011
    #9
  10. buck

    Joe Pfeiffer Guest

    (Ben Pfaff) writes:

    > Keith Thompson <> writes:
    >
    >> buck <> writes:
    >> [...]
    >>>> 'static char v[]={-20,-124,-180,-93,-88,-73,-27,-146,9,-38,-179 ...'
    >>>
    >>> I've examined the object code to see what values are present there but
    >>> haven't found this array yet.

    >>
    >> This might help:
    >>
    >> ec 84 4c a3 a8 b7 e5 6e 09 da 4d

    >
    > Out of curiosity, I fed this into an 8086 disassembler, but the
    > results don't make much sense so I doubt that this is 8086
    > machine code:
    >
    > 0: ec in (%dx),%al
    > 1: 84 4c a3 test %cl,-0x5d(%si)
    > 4: a8 b7 test $0xb7,%al
    > 6: e5 6e in $0x6e,%ax
    > 8: 09 da or %bx,%dx
    > a: 4d dec %bp


    I'm trying to guess why the original programmer initialized an array of
    char with some values that can't be expressed in 8 bits... whatever the
    motivation, expressing the values as positive and negative decimals
    instead of as hex values makes it seem unlikely (to me, anyway) that
    it's assembly code.
    Joe Pfeiffer, Jul 30, 2011
    #10
  11. buck

    Gene Guest

    On Jul 29, 12:38 am, buck <> wrote:
    > I can't ask the original coder what he was thinking because he's dead,
    > having fallen off a mountain while attempting to climb it.
    >
    > Everyone seems to want to know what this code does.  There are 10
    > objects that get linked into a TSR executable.  As concisely as I can
    > describe it, it provides an interface into ISAM low level functions
    > (add, delete, read, update, etc), "blasts" templates to the monitor,
    > keeps track of how many users, allows only one instance per user,
    > beeps the speaker...
    >
    > Yes I can compile it using the DeSmet development tools.  It has been
    > working error-free since 1989 - and before, prior to a few small
    > changes for much longer than that (though I don't know just how long.  
    > I started working for the company January 1987.
    >
    > > 'static char v[]={-20,-124,-180,-93,-88,-73,-27,-146,9,-38,-179 ...'

    >
    > I've examined the object code to see what values are present there but
    > haven't found this array yet.
    >
    > It seems that the concensus is that this project is fesable, but not
    > by me.  I need more time to think about it, but will take all advice
    > strongly into consideration.


    You probably know this, but TSR (terminate and stay resident for all
    the youngsters) adds a new dimension to what you're trying to
    achieve. It's likely to mean there are fair-sized chunks of code that
    are meaningless in a modern OS. Examples include saving and restoring
    chunks of screen buffer around TSR pop-up sessions, monitoring
    keystrokes and perhaps timer and communication interrupts, and probing
    DOS data structures to determine if it's safe to run. Equivalent
    functions can come for free in modern environments, such as the screen
    buffer management. In other cases, like device I/O, things can be
    significantly harder to implement. All in all as others have said you
    are looking at a major porting effort that could take nearly as much
    time as the original program.

    I have heard people with problems like this were successful continuing
    to use old code and tools with ExDOS http://www.exdos.com/ExDOS/ .

    FWIW, I agree with those who speculate your array of chars might be
    machine code. Little chunks of "canned" position-independent code
    written as arrays like this were common in TSR code. I can't explain
    the values outside the normal -128 to 127 range, however.
    Gene, Jul 31, 2011
    #11
  12. buck

    buck Guest

    Joe Pfeiffer <> wrote in
    news::

    > I can't resist pointing out that 1989 was 22 years ago. For it to

    have
    > been working for an equal time before then would require it to have

    been
    > written in 1967 :)



    The code was WRITTEN 10/27/1986. LAST MODIFIED 13 years ago.

    There is a difference...
    --
    buck
    buck, Aug 2, 2011
    #12
  13. buck

    Joe Pfeiffer Guest

    buck <> writes:

    > Joe Pfeiffer <> wrote in
    > news::
    >
    >> I can't resist pointing out that 1989 was 22 years ago. For it to

    > have
    >> been working for an equal time before then would require it to have

    > been
    >> written in 1967 :)

    >
    >
    > The code was WRITTEN 10/27/1986. LAST MODIFIED 13 years ago.
    >
    > There is a difference...


    A significant difference! And what you said was:

    > Yes I can compile it using the DeSmet development tools. It has been
    > working error-free since 1989 - and before, prior to a few small
    > changes for much longer than that (though I don't know just how long.
    > I started working for the company January 1987.


    I read this as a few small changes in 1989. The few small changes were
    13 years ago?
    Joe Pfeiffer, Aug 2, 2011
    #13
  14. buck

    Gene Guest

    On Jul 29, 7:01 pm, Joe Pfeiffer <> wrote:
    > (Ben Pfaff) writes:
    > > Keith Thompson <> writes:

    >
    > >> buck <> writes:
    > >> [...]
    > >>>> 'static char v[]={-20,-124,-180,-93,-88,-73,-27,-146,9,-38,-179 ....'

    >
    > >>> I've examined the object code to see what values are present there but
    > >>> haven't found this array yet.

    >
    > >> This might help:

    >
    > >> ec 84 4c a3 a8 b7 e5 6e 09 da 4d

    >
    > > Out of curiosity, I fed this into an 8086 disassembler, but the
    > > results don't make much sense so I doubt that this is 8086
    > > machine code:

    >
    > >    0:   ec                      in     (%dx),%al
    > >    1:   84 4c a3                test   %cl,-0x5d(%si)
    > >    4:   a8 b7                   test   $0xb7,%al
    > >    6:   e5 6e                   in     $0x6e,%ax
    > >    8:   09 da                   or     %bx,%dx
    > >    a:   4d                      dec    %bp

    >
    > I'm trying to guess why the original programmer initialized an array of
    > char with some values that can't be expressed in 8 bits...  whatever the
    > motivation, expressing the values as positive and negative decimals
    > instead of as hex values makes it seem unlikely (to me, anyway) that
    > it's assembly code.


    This is logical and I agree it's probably not assembly in this case
    (because the disassembly is nonsense), but people often grew up in
    this era poking bytes in BASIC and storing machine code in Pascal
    character arrays, where decimal could be all you had. So this could
    reasonably have been a fragment ported from code in one of these
    languages.
    Gene, Aug 3, 2011
    #14
  15. In article <>, buck <>
    wrote:

    > I can't ask the original coder what he was thinking because he's dead,
    > having fallen off a mountain while attempting to climb it.


    Douglas Kenney?

    --
    Michael Press
    Michael Press, Aug 4, 2011
    #15
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?iso-8859-1?B?bW9vcJk=?=
    Replies:
    7
    Views:
    796
    Roedy Green
    Jan 2, 2006
  2. Otuatail

    Week of year to full Year

    Otuatail, Dec 8, 2003, in forum: HTML
    Replies:
    4
    Views:
    948
    Toby A Inkster
    Dec 8, 2003
  3. *Prot3anThr3ad*

    old repository for old C++ source code

    *Prot3anThr3ad*, Sep 29, 2006, in forum: C++
    Replies:
    6
    Views:
    360
    *Prot3anThr3ad*
    Oct 2, 2006
  4. buck

    13 year old C source code

    buck, Jul 28, 2011, in forum: C Programming
    Replies:
    14
    Views:
    959
    Jorgen Grahn
    Aug 3, 2011
  5. Veerle
    Replies:
    2
    Views:
    393
    niceguy
    Aug 20, 2003
Loading...

Share This Page