home *** CD-ROM | disk | FTP | other *** search
/ Power Programming / powerprogramming1994.iso / progtool / microcrn / issue_45.arc / TECHTP45.ARC / TECHTIPS.2 < prev    next >
Text File  |  1988-03-23  |  2KB  |  50 lines

  1. ; Micro Cornucopia Magazine Issue #45  TECHTIPS Figure 2
  2. ; Set Up COM Ports
  3.  
  4. seg_c           segment para public
  5.         assume  cs:seg_c, ds:seg_c
  6.  
  7. start:
  8.         mov     ax,0
  9.         mov     es,ax
  10.         mov     bx,0            ; initialize port count
  11.         mov     dx,3FAh
  12.         in      al,dx           ; read port 3FAh
  13.         test    al,0F8h
  14.         jnz     port_2          ; port not there
  15.         inc     bx              ; it's there, count it
  16.         mov     word ptr es:400h,3F8h   ; base address to memory
  17. port_2:
  18.         mov     dx,2FAh
  19.         in      al,dx           ; read port 2FAh
  20.         test    al,0F8h
  21.         jnz     port_3          ; port not there
  22.         inc     bx              ; it's there, count it
  23.         mov     word ptr es:402h,2F8h   ; base address to memory
  24. port_3:
  25.         mov     dx,3EAh
  26.         in      al,dx           ; read port 3EAh
  27.         test    al,0F8h
  28.         jnz     port_4          ; port not there
  29.         inc     bx              ; it's there, count it
  30.         mov     word ptr es:404h,3E8h   ; base address to memory
  31. port_4:
  32.         mov     dx,2EAh
  33.         in      al,dx           ; port 2EAh
  34.         test    al,0F8h
  35.         jnz     done            ; port not there
  36.         inc     bx              ; it's there, count it
  37.         mov     word ptr es:406h,2E8h   ; base address to memory
  38. done:
  39.         mov     cl,1
  40.         shl     bx,cl           ; shift w/zeros fill
  41.         mov     al,es:411h      ; get the equipment flag MSB
  42.         and     al,0F1h         ; zero out bits 9-11
  43.         or      al,bl           ; insert port count in bits 9-11
  44.         mov     es:411h,al      ; write data to equipment flag MSB
  45.         int     21h
  46. seg_c   ends
  47.  
  48.         end  start
  49.  
  50.