[Coco] os version check

Wayne Campbell asa.rand at yahoo.com
Wed Sep 30 23:12:05 EDT 2009


Thanks for this information, Robert. The only difficulty I see in the information you provided is that I won't be able to determine if the OS is NitrOS-9 pre-v1.22f and OS-9 Level 2 without having to read a second file. In either case, I have to read and compare data to make the determination. Using the -n option is much less code, and easier to process. I'm going to keep this info anyway, because I may find it useful later.

Update on DCom. I have added the OS option flag (-n) and added the boolean flag, plus condition code to determine which form of TMode to use. I have corrected the tpyo in the parameter being passed to DData2. The 211 error in DVars turned out to be a simple fix.

My memory was jogged by it. I remember having that bug before. It was because I wasn't checking for EOF in the loop that read through the variables file seeking a match to the currently identified variable. I added EOF(#DC5path) to the exit condition, and the error disappeared.

DCom now makes it to the DInstr routine before another problem occurs. Testing with a small procedure named 'elapsed', once DInstr is called, it prints out 2 of 3 print statements containing comment lines. Since there is nothing in the statements except PRINT and the string containing the comment, it made no sense. I used another procedure named 'ribbsmain' as the test, and DTypes reported a 211 error. I'm reasonable sure it's another case of needing the EOF(#datapath) in the exit condition. However, it doesn't end there.

DTypes builds, and prints out, the TYPE, DIM and PARAM statements. Before those statements are output, a series of comment lines are generated that contain specifics of the data accumulated by DCom as it concerns the variables and line references. DCom reported 1 variable, -512 complex variables, and a total of 13 program variables. Obviously, that data cannot be correct. I believe I know what is the culprit. In decoding the I-Code manually (I did that a few weeks ago), I discovered there is a unused record in the DSAT for elapsed. I think it may be the same problem I always had with type statements in DCom.

Packed I-Code does not contain everything related to variables. There are references to the variables as they relate to the data memory allocation in the DSAT. If the variable was not used in the instruction statements, any and all pointers to that data are lost in packing. I can pretty much figure out where the gaps in the allocation are, and their size, but when it comes to records (your TYPE statements), there is no direct memory allocation. The data in the DSAT is shape data concerning the structure of the size of the allocation. Different variables, DIMed to the same TYPE, only have an integer that is the relative offset from the beginning of the data memory and the size of the memory allocated to it.

In the case of a record that was never used, that means no variable was DIMed to that type, or the variable was never referenced in the instruction code. While the offset and size integers are still in the DSAT, and the shape data for that record is still there, there's no real way to reference it. DCom attempts to create a TYPE statement based on the shape data, and invent a variable to be DIMed to that TYPE, but I never got it to work quite right. I think this is why I'm having trouble with decoding elapsed.

Anyway, I'll be working on trying to figure it out, but I'd rather work on the unpack version than the DCom version.

Wayne




________________________________
From: Robert Gault <robert.gault at worldnet.att.net>
To: CoCoList for Color Computer Enthusiasts <coco at maltedmedia.com>
Sent: Wednesday, September 30, 2009 7:16:39 PM
Subject: Re: [Coco] os version check

Wayne Campbell wrote:
> I haven't been able to locate any system call that I can use to return the version of the OS. It may be that this info is not available through the system. For the meantime, I'm going to add a parameter to DCom that will be used to identify the OS. The option will be 'n'. By default, n will be TRUE (meaning NitrOS09). If you pass the option '-n', DCom will use the TMode Pause/-Pause form. No option, or 'n' as the option, will cause DCom to use the TMode -pau=1/-pau=0 form.
> 
> If someone knows of a system call that allows you to determine different systems, please let me know.
> 
> Wayne
> 

There is no command that I know of which will distinguish OS-9 versions. However, you could try reading the sys/motd file.

OS-9 Level1 version 1
WELCOME TO COLOR COMPUTER OS-9

OS-9 Level1 version 2
Same as above

OS-9 Level2
No sys/motd file. However, the startup file contains
Welcome to OS-9 Level2

NitrOS-9 GaleForce
NitrOS-9 v1.22f                   and much more info. Earlier versions
                                  don't have motd.

NitrOS-9 current both Level1 and Level2
Welcome to NitrOS-9 Level #!              Where # is 1 or 2.

--
Coco mailing list
Coco at maltedmedia.com
http://five.pairlist.net/mailman/listinfo/coco



      



More information about the Coco mailing list