home *** CD-ROM | disk | FTP | other *** search
/ Jason Aller Floppy Collection / 419.img / DOSMODEM.ZIP / DTR.ASM < prev    next >
Assembly Source File  |  1986-10-28  |  2KB  |  151 lines

  1. upcase    macro    char
  2.     local    nocvt
  3.  
  4.     ifb    <char>
  5.  
  6.     upcase    al
  7.  
  8.     else
  9.  
  10.     cmp    char,'a'
  11.     jb    nocvt
  12.     cmp    char,'z'
  13.     ja    nocvt
  14.     sub    char,32
  15. nocvt:
  16.     endif
  17.     endm
  18.  
  19.     page    66,132
  20.  
  21. cseg    segment    byte public 'CODE'
  22.     assume    cs:cseg,ds:cseg,es:cseg
  23.     org    100h
  24.  
  25. start    proc    near
  26.     jmp    start1
  27.  
  28.     db    13,'DTR (c)1985 by Donavon Kuhn and Jon Niedfeldt',13,10,26
  29.  
  30. start1:
  31.     mov    bl,0            ;default com port (COM1:)
  32.     mov    si,80h
  33. start2:
  34.     inc    si
  35.     mov    al,[si]            ;space off leading spaces
  36.     cmp    al,' '
  37.     jz    start2
  38.  
  39.     cmp    al,'?'
  40.     jz    errexit
  41.  
  42.     upcase                ;using UPCASE without a parameter
  43.     cmp    al,'C'            ;(defaults to AL)
  44.     jnz    nocom
  45.  
  46.     mov    cl,[si][1]
  47.     upcase    cl            ;using UPCASE using another register
  48.     cmp    cl,'O'
  49.     jnz    nocom
  50.                 
  51.  
  52.     mov    al,[si][2]
  53.     upcase    al            ;using UPCASE with AL as the parm
  54.     cmp    al,'M'
  55.     jnz    nocom
  56.  
  57.     cmp    byte ptr [si][4],':'
  58.     jz    check_port
  59.  
  60. errexit:
  61.     lea    dx,errmsg
  62. errexit1:
  63.     mov    ah,9
  64.     int    21h
  65.  
  66.     mov    ax,4c01h        ;return ERRORLEVEL of 1
  67.     int    21h
  68.  
  69. check_port:
  70.     mov    al,[si][3]        ;get the com number
  71.     sub    al,'1'            ;convert to binary
  72.     cmp    al,3            ;greater than com4?
  73.     ja    errexit
  74.  
  75.     add    si,5
  76.  
  77.     mov    bl,al
  78. nocom:
  79.     xor    bh,bh    
  80.     shl    bl,1
  81.     mov    ax,40h
  82.     mov    ds,ax
  83.     mov    ax,ds:[bx]
  84.     push    cs
  85.     pop    ds
  86.  
  87.     cmp    ax,0
  88.     jnz    comok
  89.  
  90.     lea    dx,ncstr
  91.     jmp    errexit1
  92.  
  93.  
  94. comok:
  95.     mov    dx,ax
  96.     add    dx,4
  97.     in    al,dx
  98.  
  99.     dec    si
  100. start3:
  101.     inc    si
  102.     mov    al,[si]            ;space off leading spaces
  103.     cmp    al,' '            ;after COMx:
  104.     jz    start3
  105.  
  106.     mov    al,[si]
  107.     upcase
  108.     cmp    al,'O'
  109.     jnz    errexit
  110.  
  111.     mov    al,[si][1]
  112.     upcase
  113.  
  114.     cmp    al,'N'
  115.     jnz    noton
  116.  
  117.     or    al,3            ;set dtr bit
  118.     out    dx,al
  119.  
  120.     lea    dx,onstr
  121.  
  122. exitok:
  123.     mov    ah,9
  124.     int    21h
  125.  
  126.     mov    ax,4c00h
  127.     int    21h
  128.  
  129. noton:
  130.     cmp    al,'F'
  131.     jnz    notoff
  132.  
  133.     and    al,0fch
  134.     out    dx,al
  135.  
  136.     lea    dx,offstr
  137.     jmp    exitok
  138.  
  139. notoff:
  140.     jmp    errexit
  141.  
  142. errmsg    db    'Usage:  DTR [COM1:|COM2:|COM3:|COM4:] ON|OFF',13,10,'$'
  143. onstr    db    'DTR is now ON',13,10,'$'
  144. offstr    db    'DTR is now OFF',13,10,'$'
  145. ncstr    db    'COM port not found',13,10,'$'
  146.  
  147. start    endp
  148.  
  149. cseg    ends
  150.         end    start
  151.