• Please review our updated Terms and Rules here

Have any code to determine DOS type and version?

gp2000

Experienced Member
Joined
Jun 8, 2010
Messages
470
Location
Vancouver, BC, Canada
I'm working on a program for the TRS-80 Model I/III/4 machines and I'd like it to run under all the major DOSes: TRS-DOS, LDOS, LSDOS, NEWDOS, MULTIDOS, DOSPLUS and so on. So far I'm not having any problems with file I/O, but there is considerable variation in how to find the highest available memory location. Some of the DOSes have a call for it, others store it in a memory location which varies depending on the DOS and machine type.

While all I really need is code to get the HIGH memory location, generic code to get the type of DOS and its version may be ultimately necessary.

Any code or pointers for this would be much appreciated.

One promising avenue is OSVER$ which I think is $403e on Model I DOSes and $441F on Model III. Am currently treating Model 4 machines as LSDOS/TRSDOS but MULTIDOS will likely change that.
 
The variation in determining the highest available memory location wasn't as bad as it seemed. Based on checking in a bunch of DOSes and looking at sample code you can pretty much get away with looking at $4049 on a Model I and $4411 on a Model III. On a model 4 I assume LSDOS/TRSDOS and use the system call to get it. In particular, this works for TRSDOS 2.3, NEWDOS 2.1, LDOS 5.3.1 and DOSPLUS 3.5 on the Model I, TRSDOS 1.3, NEWDOS-80 2.0, LDOS 5.3.1, MULTIDOS 1.6 and DOSPLUS 3.5 on the Model III and LSDOS/TRSDOS on the Model 4. Pretty sure MULTIDOS on the Model I will be fine but didn't get that to boot. MULTIDOS on the Model 4 looks like it uses $4411 so extending support to non-LSDOS on the Model 4 could be tricky. But I figure there's isn't too much variation on Model 4 DOS usage compared to the Model III and Model I so it won't be too bad.

Here's essentially the code I'm using. It loads DE with the highest available memory location:

Code:
    ld    a,(10)
    cp    $40
    jr    z,not4    ; not a Model 4 or at least not LSDOS/TRSDOS
    ld    hl,0
    ld    b,0
    ld    a,100
    rst   $28          ; get $HIGH from standard LSDOS/TRSDOS system call
    ex    de,hl
    jr    not1
not4:
    ld    de,($4049)   ; could be the Model I location
    ld    a,($125)
    cp    'I'
    jr    nz,not1       ; not a Model I
    ld    de,($4411)    ; use the Model III location
not1:
    ; and we're done
 
Back
Top