13 year old C source - Thanks to all

B

buck

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
 
R

Roberto Waltman

buck said:
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.
 
K

Keith Thompson

buck said:
'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.
 
S

Stephen Sprunk

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
 
B

Ben Pfaff

Keith Thompson said:
buck said:
'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
 
R

Roberto Waltman

Ben said:
Keith Thompson said:
buck said:
'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?
 
K

Keith Thompson

Roberto Waltman said:
Ben said:
Keith Thompson said:
'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.)
 
B

BartC

Ben Pfaff said:
Keith Thompson said:
buck said:
'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?
 
J

Joe Pfeiffer

buck said:
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 :)
 
J

Joe Pfeiffer

Keith Thompson said:
buck said:
'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.
 
G

Gene

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.
 
B

buck

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...
 
J

Joe Pfeiffer

buck said:
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?
 
G

Gene

[email protected] (Ben Pfaff) said:
[...]
'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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,480
Members
44,900
Latest member
Nell636132

Latest Threads

Top