Sunday, July 12, 2015

Random linking woes

I don't have a whole lot to report.  I started to build a simple guess-the-number game, just as an instructive exercise, and this opened up a bit of a can of worms.  It started with random numbers.  Since you have to guess what number the computer is thinking of, the computer has to generate a random number.  But as far as I can tell, this version of Fortran doesn't have a random number generator.  This makes sense, since I don't think the language designers envisioned games being developed on the PDP-8, but it means I have to develop a random number generator.  I've never done this before, and math is definitely not my strong suit, but I figured it wouldn't be too much of a problem.  I'm not looking for a perfect random generator, so I figured I could just find a relatively simple algorithm that I could translate to Fortran IV.

But that wasn't what actually proved to be my big obstacle for today.  It was calling an external function.  I built a simple shell of a function in a separate Fortran file, with the understanding that I could link them together, but I haven't gotten it to work yet.  This will be a problem for me, because even with my relatively small game, I had envisioned breaking it up into several modules.  I think EDIT and TECO will get too cumbersome with large source files, so I really want to keep the files relatively small.

So that's my immediate task, to figure out how to link modules together so that I can call subroutines and functions from one module in another.  The OS/8 Handbook seems to indicate that I can, but I don't see how to actually do it.  So I've downloaded the OS/8 Fortran Software Support Manual (I know, why didn't I download this before) and hope it will provide me with some answers.

No comments: