home *** CD-ROM | disk | FTP | other *** search
/ Jason Aller Floppy Collection / 419.img / DOSMODEM.ZIP / AT.ASM next >
Assembly Source File  |  1986-10-28  |  2KB  |  143 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.  
  20.  
  21.     page    66,132
  22.  
  23. cseg    segment    byte public 'CODE'
  24.     assume    cs:cseg,ds:cseg,es:cseg
  25.     org    100h
  26.  
  27. start    proc    near
  28.     jmp    start1
  29.  
  30.     db    13,'AT (c)1985 by Donavon Kuhn and Jon Niedfeldt',13,10,26
  31.  
  32. base    dw    0
  33.  
  34. start1:
  35.     mov    bl,0            ;default com port (COM1:)
  36.     mov    si,80h
  37. start2:
  38.     inc    si
  39.     mov    al,[si]            ;space off leading spaces
  40.     cmp    al,' '
  41.     jz    start2
  42.  
  43.     cmp    al,'?'
  44.     jz    errexit
  45.  
  46.     upcase                ;using UPCASE without a parameter
  47.     cmp    al,'C'            ;(defaults to AL)
  48.     jnz    nocom
  49.  
  50.     mov    cl,[si][1]
  51.     upcase    cl            ;using UPCASE using another register
  52.     cmp    cl,'O'
  53.     jnz    nocom
  54.                 
  55.  
  56.     mov    al,[si][2]
  57.     upcase    al            ;using UPCASE with AL as the parm
  58.     cmp    al,'M'
  59.     jnz    nocom
  60.  
  61.     cmp    byte ptr [si][4],':'
  62.     jz    check_port
  63.  
  64. errexit:
  65.     lea    dx,errmsg
  66. errexit1:
  67.     mov    ah,9
  68.     int    21h
  69.  
  70.     mov    ax,4c01h        ;return ERRORLEVEL of 1
  71.     int    21h
  72.  
  73. check_port:
  74.     mov    al,[si][3]        ;get the com number
  75.     sub    al,'1'            ;convert to binary
  76.     cmp    al,3            ;greater than com4?
  77.     ja    errexit
  78.  
  79.     add    si,5
  80.  
  81.     mov    bl,al
  82. nocom:
  83.     xor    bh,bh    
  84.     shl    bl,1
  85.     mov    ax,40h
  86.     mov    ds,ax
  87.     mov    ax,ds:[bx]
  88.     push    cs
  89.     pop    ds
  90.  
  91.     cmp    ax,0
  92.     jnz    comok
  93.  
  94.     lea    dx,ncstr
  95.     jmp    errexit1
  96.  
  97.  
  98. comok:
  99.     mov    base,ax
  100.  
  101.     mov    al,'A'
  102.     call    auxout
  103.     mov    al,'T'
  104.     call    auxout
  105.  
  106. outlp:
  107.     mov    al,[si]
  108.     inc    si
  109.     call    auxout
  110.     cmp    al,13
  111.     jnz    outlp
  112.  
  113.     mov    ax,4c00h
  114.     int    21h
  115.  
  116. errmsg    db    'Usage:  AT [COM1:|COM2:|COM3:|COM4:] command string',13,10,'$'
  117. ncstr    db    'COM port not found',13,10,'$'
  118.  
  119.  
  120. auxout    proc    near
  121.     push    ax
  122.     mov    dx,base
  123.     add    dx,5
  124.  
  125. txlp:
  126.     in    al,dx
  127.     and    al,20h
  128.     jz    txlp
  129.  
  130.     pop    ax
  131.     sub    dx,5
  132.     out    dx,al    
  133.     ret
  134. auxout    endp
  135. ;
  136. ;---------------
  137. ;
  138. start    endp
  139.  
  140. cseg    ends
  141.         end    start
  142. 
  143.