home *** CD-ROM | disk | FTP | other *** search
- ; Micro Cornucopia Magazine Issue #45 TECHTIPS Figure 2
- ; Set Up COM Ports
-
- seg_c segment para public
- assume cs:seg_c, ds:seg_c
-
- start:
- mov ax,0
- mov es,ax
- mov bx,0 ; initialize port count
- mov dx,3FAh
- in al,dx ; read port 3FAh
- test al,0F8h
- jnz port_2 ; port not there
- inc bx ; it's there, count it
- mov word ptr es:400h,3F8h ; base address to memory
- port_2:
- mov dx,2FAh
- in al,dx ; read port 2FAh
- test al,0F8h
- jnz port_3 ; port not there
- inc bx ; it's there, count it
- mov word ptr es:402h,2F8h ; base address to memory
- port_3:
- mov dx,3EAh
- in al,dx ; read port 3EAh
- test al,0F8h
- jnz port_4 ; port not there
- inc bx ; it's there, count it
- mov word ptr es:404h,3E8h ; base address to memory
- port_4:
- mov dx,2EAh
- in al,dx ; port 2EAh
- test al,0F8h
- jnz done ; port not there
- inc bx ; it's there, count it
- mov word ptr es:406h,2E8h ; base address to memory
- done:
- mov cl,1
- shl bx,cl ; shift w/zeros fill
- mov al,es:411h ; get the equipment flag MSB
- and al,0F1h ; zero out bits 9-11
- or al,bl ; insert port count in bits 9-11
- mov es:411h,al ; write data to equipment flag MSB
- int 21h
- seg_c ends
-
- end start
-