So we're about half-way through the Retrochallenge and I've still gotten nowhere on my actual project. I've written a Hello World and struggled with doing a guessing game, but haven't actually written any code for the game I am supposed to be working on, my Hammurabi clone.
I don't feel too bad about this though because I have learned a lot. I knew coming in to this project that the code wasn't really my obstacle, it was getting to the point where I could write the code. The issue for me at the moment is that while I could just knock out the program in Fortran, I want to do it in a maintainable, structured fashion. Since I want to actually extend the program beyond just the simple model of Hammurabi, I want to have a code base that will be easily modifiable. But neither Fortran nor developing in a line editor is conducive to this. OS/8's Fortran IV does have support for subroutines and functions, but as far as I can tell these have to be in separate files and used as overlays. Or you can build a library. I spent quite a bit of time getting the overlays to work, with no success, and I didn't even want to try building a library yet. So I guess I'll be using GO TO's instead of subroutines and functions.
Well, you can still do good structured programming using GO TO's as long as your careful and disciplined, which is where TECO, a line editor, becomes an issue. Line editors are good enough git stfor making quick changes in small files, but really horrendous for making big changes in big files. So I had hoped to make my program out of bunch of small files, which is what led me down the overlay rabbit hole I mentioned above.
But it turns out there's an even easier solution, which I had read about but I guess just wasn't clear to me. You can execute the following command:
.COMPILE FILE1.FT,FILE2.FT,FILE3.FT
This appears to actually just merge all the files into one big one and then compile that into a program. Now this does present the limitation that my program can't be larger than, I believe, 30k, but I really don't see Prince (the name of my Hammurabi clone) exceeding that. But being able to break the code up into multiple files will make a editing the code though, so this is a pretty big deal for me.
Another little thing I discovered is also the @ notation for command line parameters. Basically you can specify your parameters in a file and then have the Command Decoder read the parameters from the file. That way you're not typing the file list in over and over.
So you could just create a file, say FILES.CM, with the text:
FILE1.FT,FILE2.FT,FILE3.FT
And then you just call the COMPILE command like so:
.COMPILE @FILES.CM
This is equivalent to the first command and should make building the multi-file project a lot easier.
So now I think I can finally get to writing my game, starting with the random number generator first.
No comments:
Post a Comment