🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

2 total messages Started by t.rosenfeld Wed, 29 Oct 1986 16:20
DOS funtion 37H
#8605
Author: t.rosenfeld
Date: Wed, 29 Oct 1986 16:20
14 lines
803 bytes
Can anyone tell me what DOS function 37H does? I saw it used in the
SWITCHAR.COM patch, but I don't see it in any of my manuals?

Thanks in advance

-- 
----------------
Thomas Rosenfeld 
		@ AT&T Information Systems Labs, Middletown, NJ
		(201) 957-5867
		
		UUCP:		{harpo,ihnp4,burl,akgua}!mtgzz!rosen

Disclaimer: I don't claim anything.
Re: DOS funtion 37H
#8641
Author: [alan i. vymetalik]
Date: Fri, 31 Oct 1986 08:12
117 lines
3949 bytes
In article <2234@mtgzz.UUCP> rosen@mtgzz.UUCP (t.rosenfeld) writes:
>Can anyone tell me what DOS function 37H does? I saw it used in the
>SWITCHAR.COM patch, but I don't see it in any of my manuals?
>
>Thanks in advance
>Thomas Rosenfeld 
>@ AT&T Information Systems Labs, Middletown, NJ


   Ok net-land, here's another demo of the (in)famous 37h function ...

   The DOS 37h function has circulated around for a while.  I dug this
   out of a program I wrote a while back. I added a quick main program
   to demo the functions.  Should work fine with DOS 2.05 and up.

   The program segments demonstrate the use of MS/PC-DOS function 37h
   which can be used to view or alter the "switch character" (the Un*x-
   like parameter indicator) used by various DOS functions and programs
   that receive data from the command line when invoked.

   Be careful in using the function since many DOS functions and programs
   may become 'confused' or may error when the switch character is not
   what is expected.   There is a reason that it is undocumented ....

   enjoy,

   Alan

   "I can't claim anything...The d*mn*d IRS would find a way to tax it!"
   =================================================
                                   alan i. vymetalik
   uucp:    {allegra,seismo}!rochester!ritcv!iav1917
   =================================================

   ---- SOURCE FOLLOWS ---------------------------------------------


{
    DOS 37h routines.  These routines utilize the 'MsDos' function
    of Turbo to pass data to the DOS functions and 'ParamStr(1)' which
    retrieves the first parameter from the command line when the
    compiled program is executed.  Please note values set in the
    AL register before calling DOS.
}

type

   { required DOS interrupt record - See Turbo Pascal manual }
   DOSRegPack = record
                   case integer of
                      1 : (AX,BX,CX,DX,BP,SI,DI,DS,ES,FLAGS: integer);
                      2 : (AL,AH,BL,BH,CL,CH,DL,DH : byte);
                   end;

var
   regpack  : DOSRegPack;       { used for interrupts to DOS }


{
   -----------------------------------------------------
   Function  - CurrentSwitchCharacter

   Arguments -
       Input : none
      Output : single character, the "switch character"
   -----------------------------------------------------
}

function CurrentSwitchCharacter : char;

begin

   regpack.AH := $37;
   regpack.AL := $00;
   msdos(regpack);

   CurrentSwitchCharacter := chr(regpack.DL)

end;


{
   -----------------------------------------------------
   Procedure  - SetSwitchCharacter

   Arguments  -
       Input  : any single ASCII character
      Output  : none
   -----------------------------------------------------
}

procedure SetSwitchCharacter ( new_switch : char );

begin

   regpack.AH := $37;
   regpack.AL := $01;
   regpack.DX := ord(new_switch);

   msdos(regpack)

end;


begin { main program }

   writeln('The switchar is "',CurrentSwitchCharacter,'"');

   if length(paramstr(1)) <> 1 then
      writeln('Switch character can only be a single character')
   else
      begin
         SetSwitchCharacter(paramstr(1));
         writeln('Switchar is now "',paramstr(1),'"');
      end

end. { main program }
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads