/*************************************************************************
 Online Commander v0.3.Test                          2:5045/37.18@Fidonet
 Copyright (c)1998-99 by Alex Carcass                     carcass@chat.ru
 ------------------------------------------------------------------------
 void FSL_WR_ANSCHR      ((byte) char)
 void FSL_WR_ANSSTR      (#str)
 void FSL_WR_ANSSTR_FAR  (seg, #str)
 void FSL_OUT_ANSSTR_FAR (seg, #str, ,ComPort-1)
 *************************************************************************/

// Fossil functions:
?  define fslOutChr   0x0100            // v+char, , ,Port-1
?  define fslInChr    0x0200            // v, , ,Port-1       out: al=char
?  define fslStatus   0x0300            // v+char, , ,Port-1
?  define fslPresent  0x0400            // v, , , Port-1;     err: ax!=0x1974
?  define fslPeekChr  0x0C00            // v, , , Port-1;     out: al=char
                                        //                    err: ax=0xFFFF
?  define fslKeyPress 0x0D00            // v;                 err: ax=0xFFFF
?  define fslReadKey  0x0E00            // v
?  define fslWriteChr 0x1300            // v+char

// Fossil status (0x0300) masks:
?  define fs_RDA      0x0100            // Read data available (in buffer)
?  define fs_OVRN     0x0200            // Input buffer overrun (~cleared)
?  define fs_THRE     0x2000            // Transfer hold room empty
?  define fs_TSRE     0x4000            // Transfer send room empty
?  define fs_DCD      0x0080            // Data carrier detect

// Fossil variables:
?  define FossilOk    0x1954

: word _14H() { $ INT 0x14 }

: void FSL_WR_ANSCHR()                  // al = char
{ AH = 0x13; $ INT 0x14 }

: void FSL_WR_ANSSTR()                  // ax = sz_str.ofs;
{ SI><AX;
M1:
$ LODSB
$ OR   AL,AL
$ JZ   QUIT
$ MOV  AH,0x13
$ INT  0x14
$ JMP  M1
QUIT:
}

: void FSL_WR_ANSSTR_FAR()              // ax = seg; bx = sz_str.ofs
{
$ PUSH DS
$ MOV  DS,AX
$ XCHG SI,BX
M1:
$ LODSB
$ OR   AL,AL
$ JZ   QUIT
$ MOV  AH,0x13
$ INT  0x14
$ JMP  M1
QUIT:
$ POP  DS
}

: void FSL_OUT_ANSSTR_FAR()             // ax = seg; bx = #str; dx = ComPort
{
$ PUSH DS
$ MOV  DS,AX
$ XCHG SI,BX
M1:
$ LODSB
$ OR   AL,AL
$ JZ   QUIT
$ MOV  AH,01
$ INT  0x14
$ JMP  M1
QUIT:
$ POP  DS
}