Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!linus!decvax!harpo!seismo!hao!hplabs!sri-unix!Mfarber@UDel-Relay From: Mfarber@UDel-Relay@sri-unix.UUCP Newsgroups: net.micro.pc Subject: SWITCHAR Message-ID: <4624@sri-arpa.UUCP> Date: Thu, 1-Sep-83 01:19:43 EDT Article-I.D.: sri-arpa.4624 Posted: Thu Sep 1 01:19:43 1983 Date-Received: Tue, 30-Aug-83 22:36:13 EDT Lines: 92 In a previous message to Info-IBMPC, someone mentioned putting "SWITCHAR = -" in the CONFIG.SYS file (in DOS 2.00). I have written a program that will either report or set the SWITCHAR from the DOS command level. By the way, does anyone know how to set a DOS 2.00 PATH from Assembly Language? Or how to read the directory character (\ normally, changes to / if SWITCHAR is changed to -). -Manny I found out the data under "explanation" by disassembling some DOS 2.00 utilities. ***** Requires DOS 2.00 ; ---------- Explanation ; This program uses the SWITCHAR function of the DOS function request ; interrupt. ; This DOS function, 37H is listed by IBM as "used internally by DOS". ; It is passed either 1 or 2 parameters, depending on usage. ; To get the current SWITCHAR, put 37H in the AH register, 00H in the ; AL register, and generate an INT 21H. The current SWTICHAR will be ; returned in the DL register. ; To change the current SWITCHAR, put 37H in the AH register, 01H in ; the AL register, the new SWITCHAR in the DL register and generate an ; INT 21H. ; ---------- Program Usage ; Syntax is SWITCHAR [n[n]] where "n" is a hex digit. If one ; if n[n] is supplied, the SWITCHAR is changed to the ASCII character ; that n[n] represents. For example, the command "SWITCHAR 21" would ; change the SWITCHAR to "!". ; Remember: EXE2BIN SWITCHAR.EXE SWITCHAR.COM after linking sc segment assume cs:sc,ds:sc mov bx,5dh ; point to parameter 1 cmp byte ptr [bx],20h ; no parameters passed? jne set ; no-set SWITCHAR mov ax,3700h ; (yes)-read SWITCHAR int 21h mov byte ptr report+100h+12,dl ; prepare report string mov ah,9 ; print report string mov dx,offset report+100h int 21h int 20h ; return to DOS set: cmp byte ptr [bx+2],20h ; parameter too long? jne error ; yes mov ax,[bx] ; (no)-get parameter cmp ah,20h ; is it a 1-digit hex number? jne s_1 ; no mov ah,30h ; (yes)-make that digit a '0' s_1: xchg al,ah ; order L/H order bytes correctly sub ax,3030h ; convert AL & AH cmp al,22 ; error? ja error ; yes cmp ah,22 ; error? ja error ; yes mov bx,offset hex+100h ; table xlat ; translate AL cmp al,'E' ; error? je error ; yes mov dl,al ; (no) mov al,ah ; prepare H order digit for XLAT xlat ; translate it cmp al,'E' ; error? je error ; yes shl al,1 ; (no)-store this nibble in the DL reg shl al,1 shl al,1 shl al,1 add dl,al mov ax,3701h ; change the SWITCHAR int 21h int 20h ; return to DOS error: mov ah,9 ; print ERRMSG mov dx,offset errmsg+100h int 21h int 20h ; return to DOS report db 'SWITCHAR is _',13,10,'$' errmsg db 'SWITCHAR must be a 1- or 2-digit hexadecimal number',13,10,'$' hex db 0,1,2,3,4,5,6,7,8,9,7 dup('E'),0ah,0bh,0ch,0dh,0eh,0fh sc ends end [SWITCHAR.ASM has been added to the Info-IBMPC library. -Ed.]