From: qballlives AT aol DOT com (QBallLives) Newsgroups: comp.os.msdos.djgpp Subject: Modem to modem - what's wrong w/ my ISR Lines: 126 Message-ID: <1998052200481600.UAA20955@ladder03.news.aol.com> NNTP-Posting-Host: ladder03.news.aol.com Date: 22 May 1998 00:48:16 GMT Organization: AOL http://www.aol.com To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk I've been working on porting some code from Chapter 9 of the Black Art of 3D game programming to djgpp... I've managed to make calls and wait for calls... but I'm getting Sigsev after a few seconds.... I'm thinking my ISR or it's installation might be at fault.... Here's the ISR code, and the installation of it: void Serial_ISR(void) { // this is the serial ISR that is installed. It is called whenever a character // is received. The received character is then placed into the next position // in the input ring buffer //asm("cli; pusha"); asm("sti"); serial_ch = inportb(open_port + SERIAL_RBF); // wrap buffer index around if (!serial_ch) { // restore PIC outportb(PIC_ICR,0x20); return; } // end if no character if (++serial_end > SERIAL_BUFF_SIZE-1) serial_end = 0; // move character into buffer serial_buffer[serial_end] = serial_ch; ++char_ready; // restore PIC outportb(PIC_ICR,0x20); //asm("popa; sti"); } // end Serial_ISR int Serial_Open(int port_base, int baud, int configuration) { // this function will open up the serial port, set it's configuration, turn // on all the little flags and bits to make interrupts happen and load the // ISR unsigned char data; // save the port I/O address for other functions open_port = port_base; // first set the baud rate // turn on divisor latch registers outportb(port_base + SERIAL_LCR, SERIAL_DIV_LATCH_ON); // send low and high bytes to divsor latches outportb(port_base + SERIAL_DLL, baud); outportb(port_base + SERIAL_DLH, 0); // set the configuration for the port outportb(port_base + SERIAL_LCR, configuration); // enable the interrupts data = inportb(port_base + SERIAL_MCR); data = SET_BITS(data,SERIAL_GP02); outportb(port_base + SERIAL_MCR, data); outportb(port_base + SERIAL_IER, 1); // hold off on enabling PIC until we have the ISR installed if (port_base == COM_1) { New_Serial_ISR.pm_offset = (int)Serial_ISR; New_Serial_ISR.pm_selector = _go32_my_cs(); _go32_dpmi_get_protected_mode_interrupt_vector(INT_SERIAL_PORT_0, &Old_Serial_ISR); _go32_dpmi_allocate_iret_wrapper(&New_Serial_ISR); _go32_dpmi_set_protected_mode_interrupt_vector(INT_SERIAL_PORT_0,&New_ Serial_ISR); } else { New_Serial_ISR.pm_offset = (int)Serial_ISR; New_Serial_ISR.pm_selector = _go32_my_cs(); _go32_dpmi_get_protected_mode_interrupt_vector(INT_SERIAL_PORT_1, &Old_Serial_ISR); _go32_dpmi_allocate_iret_wrapper(&New_Serial_ISR); _go32_dpmi_set_protected_mode_interrupt_vector(INT_SERIAL_PORT_1,&New_ Serial_ISR); } // enable the recieve character interrupt on PIC for selected comm port old_int_mask = inportw(PIC_IMR); outportb(PIC_IMR, (port_base==COM_1) ? (old_int_mask & 0xEF) : (old_int_mask & 0xF7 )); return(1); } // Serial_Open Any help would be appreciated.... Jim the loiterer aloiterer AT juno DOT com http://members.xoom.com/JimMcCue/index.htm (Jim the loiterer's PC games, programming, & stuff...)