home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.asm.x86      Ahh, the lost art of x86 assembly      4,675 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 4,627 of 4,675   
   Robert Pengelly to All   
   Help with COM1 serial port interrupt in    
   10 Nov 23 22:22:17   
   
   From: robertapengelly@gmail.com   
      
   Do anyone know how I get the COM1 serial port interrupt to work in a 16-bit   
   operating system?  I have the following:   
      
           ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;   
           ;; Disable all interrupts.   
           ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;   
           mov     dx,     HEX (03F9)   
           xor     al,     al   
           out     dx,     al   
      
           ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;   
           ;; Enable DLAB (set baud rate divisor).   
           ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;   
           mov     dx,     HEX (03FB)   
           mov     al,     HEX (80)   
           out     dx,     al   
      
           ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;   
           ;; Set divisor.   
           ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;   
           mov     dx,     HEX (03F8)   
           mov     al,     HEX (03   
                                                   ; 3 (lo byte) 38400 baud.   
           out     dx,     al   
      
           mov     dx,     HEX (03F9)   
           xor     al,     a   
                                                         ;   (hi byte)   
           out     dx,     al   
      
           ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;   
           ;; 8 bits, no parity, one stop bit.   
           ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;   
           mov     dx,     HEX (03FB)   
           mov     al,     HEX (03)   
           out     dx,     al   
      
           ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;   
           ;; Enable FIF0, clear them, with 14-byte threshold.   
           ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;   
           mov     dx,     HEX (03FA)   
           mov     al,     HEX (C7)   
           out     dx,     al   
      
           ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;   
           ;; IRQs enabled, RTS/DSR set.   
           ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;   
           mov     dx,     HEX (03FC)   
           mov     al,     HEX (0B)   
           out     dx,     al   
      
           ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;   
           ;; Set in loopback mode, test the serial chip.   
           ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;   
           mov     dx,     HEX (03FC)   
           mov     al,     HEX (1E)   
           out     dx,     al   
      
           ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;   
           ;; Test serial chip (send byte 0xAE and check if serial   
           ;; returns same byte).   
           ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;   
           mov     dx,     HEX (03F8)   
           mov     al,     HEX (AE)   
           out     dx,     al   
      
           ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;   
           ;; Check if serial is faulty (i.e. not same byte as sent).   
           ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;   
           mov     dx,     HEX (03F8)   
           xor     ax,     ax   
           in      al,     dx   
      
           cmp     al,     HEX (AE)   
           jne     .bad   
      
           ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;   
           ;; If serial is not faulty set it in normal operation mode   
           ;; (not-loopback with IRQs enabled and OUT#1 and OUT#2 bits enabled).   
           ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;   
           mov     dx,     HEX (03FC)   
           mov     al,     HEX (0F)   
           out     dx,     al   
      
   which as far as I can tell is the assembly equivalent of the example shown   
   towards the bottom of https://wiki.osdev.org/Serial_Ports but I can't figure   
   out how to get an interrupt working.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca