Ignore:
Timestamp:
Jul 28, 2011, 11:16:56 AM (14 years ago)
Author:
rudi
Message:

SBLliveOS2: Adapt to newer OpenWatcom versions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sbliveos2/trunk/drv16/commdbg.c

    r152 r561  
    5353
    5454char hextab[]="0123456789ABCDEF";
     55
     56#ifdef DEBUG
     57//#define       MAGIC_COMM_PORT 0x3f8           // pulled from word ptr 40:0
     58#define         MAGIC_COMM_PORT 0x2f8           // pulled from word ptr 40:0
     59
     60
     61#define UART_DATA               0x00            // UART Data port
     62#define UART_INT_ENAB           0x01            // UART Interrupt enable
     63#define UART_INT_ID             0x02            // interrupt ID
     64#define UART_LINE_CTRL          0x03            // line control registers
     65#define UART_MODEM_CTRL         0x04            // modem control register
     66#define UART_LINE_STAT          0x05            // line status register
     67#define UART_MODEM_STAT         0x06            // modem status regiser
     68#define UART_DIVISOR_LO         0x00            // divisor latch least sig
     69#define UART_DIVISOR_HI         0x01h           // divisor latch most sig
     70
     71#define DELAY   nop
     72#endif
     73
     74#ifdef DEBUG                            //--------------------------- CharOut -
     75void CharOut(char c)
     76{
     77        _asm    {
     78
     79        mov     dx, MAGIC_COMM_PORT     // address of PS/2's first COM port
     80        add     dx, UART_LINE_STAT
     81
     82ReadyCheck:
     83        in      al, dx                                                          // wait for comm port ready signal
     84
     85        DELAY
     86        DELAY
     87        DELAY
     88
     89        test    al, 020h
     90        jz      ReadyCheck
     91
     92        // Send the character
     93
     94        add     dx, UART_DATA - UART_LINE_STAT
     95        mov     al,c
     96        out     dx, al
     97
     98        DELAY
     99        DELAY
     100        DELAY
     101        }
     102}
     103#endif
     104
     105#ifdef DEBUG                            //------------------------- StringOut -
     106void StringOut(char far *DbgStr)
     107{
     108   while (*DbgStr)
     109      CharOut(*DbgStr++);
     110
     111   if (fLineTerminate)
     112   {
     113      CharOut(CR);                              // append carriage return,
     114      CharOut(LF);                              // linefeed
     115   }
     116}
     117#endif
    55118
    56119                                        //-------------------- DecWordToASCII -
     
    330393#endif                            //DEBUG
    331394
    332 
    333 #ifdef DEBUG                            //------------------------- StringOut -
    334 void StringOut(char far *DbgStr)
    335 {
    336    while (*DbgStr)
    337       CharOut(*DbgStr++);
    338 
    339    if (fLineTerminate)
    340    {
    341       CharOut(CR);                              // append carriage return,
    342       CharOut(LF);                              // linefeed
    343    }
    344 }
    345 #endif
    346 
    347 #ifdef DEBUG
    348 //#define       MAGIC_COMM_PORT 0x3f8           // pulled from word ptr 40:0
    349 #define         MAGIC_COMM_PORT 0x2f8           // pulled from word ptr 40:0
    350 
    351 
    352 #define UART_DATA               0x00            // UART Data port
    353 #define UART_INT_ENAB           0x01            // UART Interrupt enable
    354 #define UART_INT_ID             0x02            // interrupt ID
    355 #define UART_LINE_CTRL          0x03            // line control registers
    356 #define UART_MODEM_CTRL         0x04            // modem control register
    357 #define UART_LINE_STAT          0x05            // line status register
    358 #define UART_MODEM_STAT         0x06            // modem status regiser
    359 #define UART_DIVISOR_LO         0x00            // divisor latch least sig
    360 #define UART_DIVISOR_HI         0x01h           // divisor latch most sig
    361 
    362 #define DELAY   nop
    363 #endif
    364 
    365 #ifdef DEBUG                            //--------------------------- CharOut -
    366 void CharOut(char c)
    367 {
    368         _asm    {
    369 
    370         mov     dx, MAGIC_COMM_PORT     // address of PS/2's first COM port
    371         add     dx, UART_LINE_STAT
    372 
    373 ReadyCheck:
    374         in      al, dx                                                          // wait for comm port ready signal
    375 
    376         DELAY
    377         DELAY
    378         DELAY
    379 
    380         test    al, 020h
    381         jz      ReadyCheck
    382 
    383         // Send the character
    384 
    385         add     dx, UART_DATA - UART_LINE_STAT
    386         mov     al,c
    387         out     dx, al
    388 
    389         DELAY
    390         DELAY
    391         DELAY
    392         }
    393 }
    394 #endif
Note: See TracChangeset for help on using the changeset viewer.