#ifndef COMPILE_H
#include "COMPILE.H"
#endif
#ifdef MEDIA701_I34E
extern unsigned char G8001_;

int16_t G8012_LPTPorts[3] = { 0x3BC, 0x378, 0x278 };
int16_t G8013_ = -1;


BOOLEAN F8023_0746_IsEMSPresent(
)
{
        int16_t L3072_i_FileHandle;


        asm     jmp     loc_240F1
        asm     V8023000_filename db 'EMMXXXX0',0
        loc_240F1:
        asm     push    ds
        asm     mov     dx, seg V8023000_filename
        asm     mov     ds, dx
        asm     mov     dx, offset V8023000_filename
        asm     mov     ax, 3D00h
                                /* DOS - 2+ - OPEN DISK FILE WITH HANDLE */
        asm     int     21h     /* DS:DX -> ASCIZ V8023000_filename, AL = access mode, 0 - read */
        asm     pop     ds
        asm     jb      loc_2412F
        asm     mov     L3072_i_FileHandle, ax
        asm     mov     bx, ax
        asm     mov     ax, 4400h
                                /* DOS - 2+ - IOCTL - GET DEVICE INFORMATION */
        asm     int     21h     /* BX = file or device handle */
        asm     jb      loc_24122
        asm     and     dx, 80h
        asm     jz      loc_24122
        asm     mov     ax, 4407h
                                /* DOS - 2+ - IOCTL - */
        asm     int     21h
        asm     jb      loc_24122
        asm     or      al, al
        asm     jz      loc_24122
        asm     mov     si, 1
        loc_24122:
        asm     mov     bx, L3072_i_FileHandle
        asm     mov     ah, 3Eh
                                /* DOS - 2+ - CLOSE A FILE WITH HANDLE */
        asm     int     21h     /* BX = file handle */
        asm     jb      loc_2412F
        asm     mov     ax, si
        asm     jmp     loc_24131
        loc_2412F:
        asm     xor     ax, ax
        loc_24131: ;
}

unsigned int16_t F8024_GetEMSDriverVersion(
)
{
        unsigned char L3073_uc_;


        asm     mov     ah, 46h
        asm     int     67h            /*  - LIM EMS - GET EMM VERSION */
                                       /* Return: AH = status */
        asm     mov     L3073_uc_, al
        return L3073_uc_;
}

long F8025_GetEMSMemorySize(
)
{
        unsigned int16_t L3074_ui_;


        asm     mov     ah, 42h
        asm     int     67h            /*  - LIM EMS - GET NUMBER OF PAGES */
                                       /* Return: AH = 00h function successful, BX = number of unallocated pages */
                                       /* DX = total number of pages */
                                       /* AH = error code */
        asm     mov     L3074_ui_, bx
        return (long)L3074_ui_ << 14;
}

int16_t F8026_GetEMSPageFrameSegment(
)
{
        asm     mov     ah, 41h
        asm     int     67h            /*  - LIM EMS - GET PAGE FRAME SEGMENT */
                                       /* Return: AH = 00h function successful, BX = segment of page frame */
                                       /* AH = error code */
        asm     mov     ax, bx
}

BOOLEAN F8027_HasLPTInitializationFailed(int16_t P3109_i_LPTPort)
{
/* P3109_i_LPTPort+0: LPT data register
   P3109_i_LPTPort+1: LPT status register
   P3109_i_LPTPort+2: LPT control register */
        asm     cmp     P3109_i_LPTPort, 0
        asm     jz      loc_12A89
        asm     mov     dx, P3109_i_LPTPort
        asm     add     dx, 2
        asm     mov     al, 4
        asm     out     dx, al
        asm     mov     cx, 0C8h        /* Set 'Init' bit in control register */
        loc_12A73:
        asm     loop    loc_12A73
        asm     mov     dx, P3109_i_LPTPort
        asm     add     dx, 1
        asm     in      al, dx
        asm     and     al, 18h         /* Get 'Device Selected' and 'Device Error' bits in status register */
        asm     cmp     al, 0
        asm     jnz     loc_12A89
        loc_12A84:
        asm     mov     ax, 1
        asm     jmp     loc_12A8B
        loc_12A89:
        asm     xor     ax, ax
        loc_12A8B: ;
}

int16_t F8028_GetFTLSoundAdapterPort(
)
{
        int16_t L3075_i_;
        unsigned int16_t L3076_ui_;


        for (L3076_ui_ = 8; L3076_ui_ < 14; L3076_ui_ += 2) {
        /*  08h WORD Base I/O address of 1st parallel I/O port, zero if none
            0Ah WORD Base I/O address of 2nd parallel I/O port, zero if none
            0Ch WORD Base I/O address of 3rd parallel I/O port, zero if none */
                asm     mov     ax, 40h
                asm     mov     es, ax
                asm     mov     bx, L3076_ui_
                asm     mov     ax, es:[bx]
                asm     mov     L3075_i_, ax
                if (L3075_i_) {
                        asm     mov     dx, L3075_i_
                        asm     add     dx, 2
                        asm     mov     al, 0Ch
                        asm     out     dx, al
                        asm     mov     cx, 0C8h
                        loc_12ABB:
                        asm     loop    loc_12ABB
                        asm     mov     dx, L3075_i_
                        asm     add     dx, 1
                        asm     in      al, dx
                        asm     test    al, 20h
                        asm     jnz     loc_12AE6
                        asm     mov     dx, L3075_i_
                        asm     add     dx, 2
                        asm     mov     al, 4
                        asm     out     dx, al
                        asm     mov     cx, 0C8h
                        loc_12AD4:
                        asm     loop    loc_12AD4
                        asm     mov     dx, L3075_i_
                        asm     add     dx, 1
                        asm     in      al, dx
                        asm     test    al, 20h
                        asm     jz     loc_12AE6
                        return L3075_i_;
                        loc_12AE6: ;
                }
        }
        return 0;
}

void F8029_ReplaceInterrupt8Vector(
)
{
        asm     jmp     loc_113FC
        asm     V8029000_OriginalInterrupt8Vector     dd 0
        asm     V8029001_     db 0
        loc_113FC:
        asm     mov     ax, 3508h
        asm     int     21h            /* DOS - 2+ - GET INTERRUPT VECTOR */
                                       /* AL = interrupt number */
                                       /* Return: ES:BX = value of interrupt vector */
        asm     mov     word ptr cs:V8029000_OriginalInterrupt8Vector, bx
        asm     mov     word ptr cs:V8029000_OriginalInterrupt8Vector+2, es
        asm     push    ds
        asm     mov     dx, seg interrupt
        asm     mov     ds, dx
        asm     mov     dx, offset interrupt
        asm     mov     ax, 2508h
        asm     int     21h            /* DOS - SET INTERRUPT VECTOR */
                                       /* AL = interrupt number */
                                       /* DS:DX = new vector to be used for specified interrupt */
        asm     pop     ds
        asm     jmp     loc_11427
        asm     interrupt:
        asm     mov     cs:V8029001_, 1
        asm     jmp     cs:V8029000_OriginalInterrupt8Vector
        loc_11427: ;
}

void F8030_RestoreInterrupt8Vector(
)
{
        asm     push    ds
        asm     mov     dx, word ptr cs:V8029000_OriginalInterrupt8Vector+2
        asm     mov     ds, dx
        asm     mov     dx, word ptr cs:V8029000_OriginalInterrupt8Vector
        asm     mov     ax, 2508h
        asm     int     21h            /* DOS - SET INTERRUPT VECTOR */
                                       /* AL = interrupt number */
                                       /* DS:DX = new vector to be used for specified interrupt */
        asm     pop     ds
}

BOOLEAN F8031_(char P3110_c_)
{
        asm     jmp     loc_11448
        asm     V8031000_      dw 0
        loc_11448:
        asm     mov     dx, 201h
        asm     mov     bx, 0FA0h
        loc_1144E:
        asm     add     cs:V8031000_, 5
        asm     in      al, dx         /* Game I/O port */
                                       /* bits 0-3: Coordinates (resistive, time-dependent inputs) */
                                       /* bits 4-7: Buttons/Triggers (digital inputs) */
        asm     and     al, 0F0h
        asm     cmp     al, 0F0h
        asm     jnz     loc_11481
        asm     dec     bx
        asm     jnz     loc_1144E
        asm     int     11h            /* EQUIPMENT DETERMINATION */
                                       /* Return: AX = equipment flag bits */
        asm     and     ax, 1000h
        asm     jnz     loc_11481
        asm     mov     dx, 201h
        asm     out     dx, al         /* Game I/O port */
                                       /* bits 0-3: Coordinates (resistive, time-dependent inputs) */
                                       /* bits 4-7: Buttons/Triggers (digital inputs) */
        asm     mov     bx, 3E8h
        loc_1146C:
        asm     mov     cx, 64h
        loc_1146F:
        asm     loop    loc_1146F
        asm     in      al, dx         /* Game I/O port */
                                       /* bits 0-3: Coordinates (resistive, time-dependent inputs) */
                                       /* bits 4-7: Buttons/Triggers (digital inputs) */
        asm     mov     ah, P3110_c_
        asm     and     ah, 0Fh
        asm     and     al, ah
        asm     cmp     al, ah
        asm     jnz     loc_11485
        asm     dec     bx
        asm     jnz     loc_1146C
        loc_11481:
        asm     xor     ax, ax
        asm     jmp     loc_11488
        loc_11485:
        asm     mov     ax, 1
        loc_11488: ;
}

int16_t F8032_GetCPUType(
)
{
        asm     pushf
        asm     xor     ax, ax
        asm     push    ax
        asm     popf
        asm     pushf
        asm     pop     ax
        asm     and     ax, 8000h
        asm     cmp     ax, 8000h
        asm     jz      loc_114B2
        asm     mov     ax, 7000h
        asm     push    ax
        asm     popf
        asm     pushf
        asm     pop     ax
        asm     and     ax, 7000h
        asm     jz      loc_114AD
        _AX = 386;
        asm     jmp     loc_114C3
        loc_114AD:
        _AX = 286;
        asm     jmp     loc_114C3
        loc_114B2:
        asm     mov     ax, 0FFFFh
        asm     mov     cl, 21h
        asm     shl     ax, cl
        asm     jnz     loc_114C0
        _AX = 86;
        asm     jmp     loc_114C3
        loc_114C0:
        _AX = 186;
        loc_114C3:
        asm     popf
}

BOOLEAN F8033_IsNECTProcessorPresent(
)
{
        asm     sti
        asm     mov     si, 0
        asm     mov     cx, 0FFFFh
        asm     rep lodsb
        asm     or      cx, cx
        asm     mov     ax, 0
        asm     jnz     loc_114DD
        asm     mov     ax, 1
        loc_114DD: ;
}

BOOLEAN F8034_IsMousePresent(
)
{
        asm     mov     ax, 0
        asm     int     33h            /* - MS MOUSE - RESET DRIVER AND READ STATUS */
                                       /* Return: AX = status */
                                       /* BX = number of buttons */
        asm     and     ax, 1
}

void F8035_GetMouseVersionAndType(int16_t* P3111_pi_MajorVersion, int16_t* P3112_pi_MinorVersion, int16_t* P3113_pi_Type, int16_t* P3114_pi_Interrupt)
{
        unsigned int16_t L3077_ui_;
        unsigned int16_t L3078_ui_;


        asm     mov     ax, 24h
        asm     int     33h            /* - MS MOUSE - GET SOFTWARE VERSION AND MOUSE TYPE */
                                       /* Return: AX = FFFFh on error */
                                       /* otherwise, BH = major version, BL = minor version */
                                       /* CH = type (1=bus, 2=serial, 3=InPort, 4=PS/2, 5=HP) */
                                       /* CL = interrupt (0=PS/2, 2=IRQ2, 3=IRQ3,...,7=IRQ7) */
        asm     mov     L3077_ui_, bx
        asm     mov     L3078_ui_, cx
        *P3111_pi_MajorVersion = L3077_ui_ >> 8;
        *P3112_pi_MinorVersion = L3077_ui_ & 0xFF;
        *P3113_pi_Type = L3078_ui_ >> 8;
        *P3114_pi_Interrupt = L3078_ui_ & 0xFF;
}

int16_t F8036_Tandy_WritableMemory(
)
{ /* Test memory is writable */
        unsigned int16_t L3079_ui_;
        long L3080_l_;
        long L3081_l_;
        long* L3082_pl_;
        unsigned int16_t L3083_ui_;
        BOOLEAN L3084_B_;


        L3084_B_ = C0_FALSE;
        asm     mov     ax, 40h
        asm     mov     es, ax
        asm     mov     ax, es:13h
        asm     mov     L3079_ui_, ax
        if (L3079_ui_ >= 640) {
                return 0;
        }
        for (L3083_ui_ = L3079_ui_; L3083_ui_ < 640; L3083_ui_++) {
                L3082_pl_ = MK_FP((L3083_ui_ << 6), 0);
                L3080_l_ = *L3082_pl_;
                L3081_l_ = *(L3082_pl_ + 1);
                *L3082_pl_ = 0x12345678;
                *(L3082_pl_ + 1) = 0x87654321;
                if ((*L3082_pl_ != 0x12345678) || (*(L3082_pl_ + 1) != 0x87654321)) {
                        L3084_B_ = C1_TRUE;
                }
                *L3082_pl_ = L3080_l_;
                *(L3082_pl_ + 1) = L3081_l_;
                if (L3084_B_) {
                        break;
                }
        }
        return L3083_ui_ - L3079_ui_;
}

BOOLEAN F8037_IsTandyVideoPresent(
)
{
        unsigned char* L3085_puc_;
        unsigned char* L3086_puc_;


        L3086_puc_ = (char*)0xFC000000;
        L3085_puc_ = (char*)0xFFFF000E;
        return (*L3086_puc_ == 0x21) && (*L3085_puc_ == 0xFF);
}

int16_t F8038_GetTandy1000MachineID(
)
{
        if (F8037_IsTandyVideoPresent()) {
                asm     mov     ah, 0C0h
                asm     int     15h            /* SYSTEM - GET CONFIGURATION (XT after 1/10/86,AT mdl 3x9,CONV,XT286,PS) */
                asm     jb      loc_1164D
                asm     cmp     byte ptr es:[bx+2], 0FFh
                asm     jnz     loc_1164D
                asm     mov     al, es:[bx+3]
                asm     mov     ah, 0
                asm     jmp     loc_11650
        }
        loc_1164D:
        return -1;
        loc_11650: ;
}

int16_t F8039_IsTandySoundPresent(
)
{
        if (G8013_ > 0) {
                return G8013_;
        } else {
                if (F8037_IsTandyVideoPresent()) {
                        G8013_ = 0;
                        asm     mov     ah, 83h
                        asm     mov     cx, 1
                        asm     mov     dx, 0Ah
                        asm     int     1Ah
                        asm     cmp     ah, 0
                        asm     jnz     loc_11684
                        asm     mov     G8013_, 1
                        loc_11684:
                        return G8013_;
                } else {
                        return 0;
                }
        }
}

BOOLEAN F8040_IsVGAVideoPresent(
)
{
        asm     mov     ax, 1A00h
        asm     int     10h            /* - VIDEO - DISPLAY COMBINATION (PS,VGA/MCGA): read display combination code */
        asm     cmp     al, 1Ah
        asm     jnz     loc_1169E
        asm     mov     ax, 1
        asm     jmp     loc_116A0
        loc_1169E:
        asm     xor     ax, ax
        loc_116A0: ;
}

BOOLEAN F8041_IsEGAVideoPresent(
)
{
        char L3087_c_;
        char L3088_c_;


        asm     mov     bl, 10h
        asm     mov     ah, 12h
        asm     int     10h            /* - VIDEO - ALTERNATE FUNCTION SELECT (PS, EGA, VGA, MCGA) - GET EGA INFO */
                                       /* Return: BH = 00h color mode in effect CH = feature bits, CL = switch settings */
        asm     mov     L3087_c_, bl
        asm     mov     L3088_c_, cl
        asm     cmp     byte ptr L3087_c_, 10h
        asm     jnz     loc_116BD
        asm     xor     ax, ax
        asm     jmp     loc_116C0
        loc_116BD:
        asm     mov     ax, 1
        loc_116C0: ;
}

BOOLEAN F8042_IsHerculesVideoPresent(
)
{
        char L3089_c_;


        asm     mov     dx, 3B4h
        asm     mov     al, 0Fh
        asm     out     dx, al         /* Video: CRT cntrlr addr */
                                       /* Cursor location (low) */
        asm     inc     dx
        asm     in      al, dx         /* Video: CRT controller internal registers */
        asm     mov     ah, al
        asm     mov     al, 66h
        asm     out     dx, al         /* Video: CRT controller internal registers */
        asm     mov     cx, 100h
        loc_116D9:
        asm     loop    loc_116D9
        asm     in      al, dx         /* Video: CRT controller internal registers */
        asm     mov     L3089_c_, al
        asm     xchg    ah, al
        asm     out     dx, al         /* Video: CRT controller internal registers */
        asm     cmp     byte ptr L3089_c_, 66h
        asm     jz      loc_116EC
        asm     xor     ax, ax
        asm     jmp     loc_11707
        loc_116EC:
        asm     mov     dx, 3BAh
        asm     in      al, dx         /* Video status bits: */
                                       /* 0: retrace.  1=display is in vert or horiz retrace. */
                                       /* 1: 1=light pen is triggered; 0=armed */
                                       /* 2: 1=light pen switch is open; 0=closed */
                                       /* 3: 1=vertical sync pulse is occurring. */
        asm     and     al, 80h
        asm     mov     ah, al
        asm     mov     cx, 8000h
        loc_116F7:
        asm     in      al, dx         /* Video status bits: */
                                       /* 0: retrace.  1=display is in vert or horiz retrace. */
                                       /* 1: 1=light pen is triggered; 0=armed */
                                       /* 2: 1=light pen switch is open; 0=closed */
                                       /* 3: 1=vertical sync pulse is occurring. */
        asm     and     al, 80h
        asm     cmp     ah, al
        asm     jnz     loc_11704
        asm     loop    loc_116F7
        asm     xor     ax, ax
        asm     jmp     loc_11707
        loc_11704:
        asm     mov     ax, 1
        loc_11707: ;
}

int16_t F8043_GetVGAMonitorType(
)
{
        asm     mov     ah, 1Ah
        asm     mov     al, 0
        asm     int     10h            /* - VIDEO - DISPLAY COMBINATION (PS,VGA/MCGA): read display combination code */
        asm     cmp     al, 1Ah
        asm     jz      loc_1171D
        asm     mov     ax, 0FFFFh
        asm     jmp     loc_11721
        loc_1171D:
        asm     xor     bh, bh
        asm     mov     ax, bx
        loc_11721: ;
}

int16_t F8044_GetEGAMonitorType(
)
{
        asm     mov     bl, 10h
        asm     mov     ah, 12h
        asm     int     10h            /* - VIDEO - ALTERNATE FUNCTION SELECT (PS, EGA, VGA, MCGA) - GET EGA INFO */
                                       /* Return: BH = 00h color mode in effect CH = feature bits, CL = switch settings */
        asm     cmp     bl, 10h         /* If BL is intact, then there is no EGA adapter */
        asm     jnz     loc_11736
        asm     mov     ax, 0FFFFh
        asm     jmp     loc_1173C
        loc_11736:
        asm     xor     ch, ch
        asm     shr     cx, 1
        asm     mov     ax, cx
        loc_1173C: ;
}

BOOLEAN F8045_(
)
{
        asm     mov     ax, 40h
        asm     mov     es, ax
        asm     test    byte ptr es:96h, 10h
        asm     jz      loc_11753
        asm     mov     ax, 1
        asm     jmp     loc_11755
        loc_11753:
        asm     xor     ax, ax
        loc_11755: ;
}

BOOLEAN F8046_(
)
{
        asm     mov     ah, 12h
        asm     mov     al, 0
        asm     int     16h            /* KEYBOARD - GET ENHANCED SHIFT FLAGS (AT model 339,XT2,XT286,PS) */
                                       /* Return: AL = shift flags (same as for AH=02h) */
        asm     mov     ax, 40h
        asm     mov     es, ax
        asm     cmp     al, es:17h
        asm     jnz     loc_11770
        asm     xor     ax, ax
        asm     jmp     loc_11795
        loc_11770:
        asm     xor     byte ptr es:17h, 80h
        asm     mov     ah, 12h
        asm     mov     al, 0
        asm     int     16h            /* KEYBOARD - GET ENHANCED SHIFT FLAGS (AT model 339,XT2,XT286,PS) */
                                       /* Return: AL = shift flags (same as for AH=02h) */
        asm     mov     ax, 40h
        asm     mov     es, ax
        asm     cmp     al, es:17h
        asm     jnz     loc_1178C
        asm     xor     ax, ax
        asm     jmp     loc_11795
        loc_1178C:
        asm     xor     byte ptr es:17h, 80h
        asm     mov     ax, 1
        loc_11795: ;
}

void F8047_(int16_t P3115_i_)
{
        unsigned char L3090_auc_[64];
        unsigned char* L3091_puc_ = L3090_auc_;
        int16_t L3092_i_;


        L3090_auc_[0] = '\0';
        asm     mov     ax, 440Dh
        asm     mov     bx, P3115_i_
        asm     mov     cx, 860h
        asm     push    ds
        asm     lds     dx, L3091_puc_
        asm     int     21h            /* DOS - 2+ - IOCTL - */
        asm     pop     ds
        L3092_i_ = L3090_auc_[1];
        switch (L3092_i_) {
                case 0:
                        printf("360K, 5.25 inch\n");
                        break;
                case 1:
                        printf("1.2 Meg, 5.25 inch\n");
                        break;
                case 2:
                        printf("720K, 3.5 inch\n");
                        break;
                case 7:
                        printf("1.44 Meg, 3.5 inch\n");
                        break;
                default:
                        printf("Unknown (type %d)\n");
        }
}

void F8048_(int16_t P3116_i_)
{
        if (P3116_i_) {
                printf("YES\n");
        } else {
                printf("NO\n");
        }
}

void main(
)
{
        unsigned int16_t L3093_;
        int16_t L3094_i_;
        unsigned long L3095_ul_;
        unsigned int16_t L3096_ui_;
        unsigned int16_t L3097_ui_;
        long L3098_l_;
        char L3099_ac_[9];
        int16_t L3100_i_MouseMajorVersion;
        int16_t L3101_i_MouseMinorVersion;
        int16_t L3102_i_MouseType;
        int16_t L3103_i_MouseInterrupt;
        unsigned char L3104_uc_;
        unsigned char L3105_uc_;
        BOOLEAN L3106_B_VGAVideoPresent;
        BOOLEAN L3107_B_EGAVideoPresent;
        BOOLEAN L3108_B_TandyVideoPresent;
        BOOLEAN L3109_B_HerculesVideoPresent;
        int16_t L3110_i_;


        L3110_i_ = 0;
        L3098_l_ = 0;
        L3106_B_VGAVideoPresent = C0_FALSE;
        L3107_B_EGAVideoPresent = C0_FALSE;
        L3108_B_TandyVideoPresent = C0_FALSE;
        L3109_B_HerculesVideoPresent = C0_FALSE;
        printf("\nFTL - PC System Configuration Reporter, version 1.0\n\n");
        printf("CPU type                   : ");
        if ((L3094_i_ = F8032_GetCPUType()) != 86) {
                printf("80%d\n", L3094_i_);
        } else {
                if (F8033_IsNECTProcessorPresent()) {
                        printf("NEC V20 or V30\n");
                } else {
                        printf("8088 or 8086\n");
                }
        }
        F8029_ReplaceInterrupt8Vector();
        loc_118A7:
        asm     cmp     cs:V8029001_, 0
        asm     jz      loc_118A7
        asm     mov     cs:V8029001_, 0
        loc_118B5:
        asm     cmp     cs:V8029001_, 0
        asm     jz      loc_118B5
        asm     mov     cs:V8029001_, 0
        loc_118C3:
        L3098_l_++;
        asm     cmp     cs:V8029001_, 0
        asm     jz      loc_118C3
        F8030_RestoreInterrupt8Vector();
        printf("CPU Speed                  : %ld counts/tick\n", L3098_l_);
        asm     mov     ax, 40h
        asm     mov     es, ax
        asm     mov     ax, es:13h
        asm     mov     L3093_, ax
        L3095_ul_ = ((long)L3093_ << 10) - ((long)_psp << 4);
        printf("Total / Available RAM      : %uK / %uK\n", L3093_, (unsigned int16_t)(L3095_ul_ >> 10));
        if (F8023_0746_IsEMSPresent()) {
                L3097_ui_ = F8024_GetEMSDriverVersion();
                printf("Expanded Memory            : EMM driver %1d.%1d, %lu bytes, %04X\n", L3097_ui_ >> 4, L3097_ui_ & 0x0F, F8025_GetEMSMemorySize(), F8026_GetEMSPageFrameSegment());

        }
        printf("Video cards installed      : ");
        L3097_ui_ = 0;
        if ((L3106_B_VGAVideoPresent = F8040_IsVGAVideoPresent()) != 0) {
                printf("VGA");
                L3097_ui_++;
        } else {
                if ((L3107_B_EGAVideoPresent = F8041_IsEGAVideoPresent()) != 0) {
                        printf("EGA");
                        L3097_ui_++;
                } else {
                        if ((L3108_B_TandyVideoPresent = F8037_IsTandyVideoPresent()) != 0) {
                                printf("Tandy 320x200x16 color");
                                L3097_ui_++;
                        }
                }
        }
        if ((L3109_B_HerculesVideoPresent = F8042_IsHerculesVideoPresent()) != 0) {
                if (L3097_ui_ == 0) {
                        printf("Hercules");
                } else {
                        printf(" and Hercules");
                }
        }
        printf("\n");
        printf("Video Monitor              : ");
        if (L3106_B_VGAVideoPresent) {
                switch (L3097_ui_ = F8043_GetVGAMonitorType()) {
                        case 10:
                        case 4:
                                printf("EGA Color\n");
                                break;
                        case 5:
                                printf("TTL Monochrome\n");
                                break;
                        case 11:
                        case 7:
                                printf("Analog Monochrome\n");
                                break;
                        case 12:
                        case 8:
                                printf("Analog Color\n");
                                break;
                        case 0xFFFF:
                                printf("Cannot determine\n");
                                break;
                        default:
                                printf("Unknown (type %d)\n", L3097_ui_);
                }
        } else {
                if (L3107_B_EGAVideoPresent) {
                        switch (L3097_ui_ = F8044_GetEGAMonitorType()) {
                                case 3:
                                case 0:
                                        printf("CGA Color\n");
                                        break;
                                case 2:
                                case 5:
                                        printf("TTL Monochrome\n");
                                        break;
                                case 1:
                                case 4:
                                        printf("EGA Color\n");
                                        break;
                                case 0xFFFF:
                                        printf("Cannot determine\n");
                                        break;
                                default:
                                        printf("Unknown (type %d)\n", L3097_ui_);
                        }
                } else {
                        printf("Cannot Determine\n");
                }
        }
        if (L3108_B_TandyVideoPresent) {
                printf("Ram used by Tandy Video    : ");
                if ((L3093_ = F8036_Tandy_WritableMemory()) == 0) {
                        printf("NONE\n", F8036_Tandy_WritableMemory());
                } else {
                        printf("%dK bytes \n", F8036_Tandy_WritableMemory());
                }
                printf("Tandy 1000 machine ID      : %d\n", F8038_GetTandy1000MachineID());
        }
        printf("Serial ports available     :");
        for (L3097_ui_ = 0; L3097_ui_ < 8; L3097_ui_ += 2) {
                asm     mov     ax, 40h
                asm     mov     es, ax
                asm     mov     bx, L3097_ui_
                asm     mov     ax, es:[bx]
                asm     mov     L3096_ui_, ax
                switch (L3096_ui_) {
                        case 0:
                                break;
                        case 0x3F8:
                                printf(" COM1");
                                break;
                        case 0x2F8:
                                printf(" COM2");
                                break;
                        default:
                                printf(" (0x%04X)", L3096_ui_);
                }
        }
        printf("\n");
        printf("Printer ports available    :");
        for (L3097_ui_ = 8; L3097_ui_ < 14; L3097_ui_ += 2) {
                asm     mov     ax, 40h
                asm     mov     es, ax
                asm     mov     bx, L3097_ui_
                asm     mov     ax, es:[bx]
                asm     mov     L3096_ui_, ax
                switch (L3096_ui_) {
                        case 0:
                                break;
                        case 0x3BC:
                                printf(" LPT1");
                                L3110_i_++;
                                break;
                        case 0x378:
                                printf(" LPT2");
                                L3110_i_++;
                                break;
                        case 0x278:
                                printf(" LPT3");
                                L3110_i_++;
                                break;
                        default:
                                printf(" (0x%04X)", L3096_ui_);
                                L3096_ui_ = 0;
                }
        }
        if (L3110_i_ == 0) {
                printf(" NONE\n");
        } else {
                printf("\n");
        }
        printf("Sound Options Installed    :");
        L3096_ui_ = F8028_GetFTLSoundAdapterPort();
        L3110_i_ = 0;
        if (L3096_ui_) {
                printf(" FTL");
                switch (L3096_ui_) {
                        case 0x3BC:
                                printf(" (LPT1)");
                                break;
                        case 0x378:
                                printf(" (LPT2)");
                                break;
                        case 0x278:
                                printf(" (LPT3)");
                }
                if (F8027_HasLPTInitializationFailed(L3096_ui_)) {
                        printf(" CD");
                }
                L3110_i_++;
        }
        if (F8039_IsTandySoundPresent()) {
                printf(" TANDY");
                L3110_i_++;
        }
        if (F8022_IsSoundBlasterPresent()) {
                F8017_();
                if (G8001_) {
                        printf(" SBLASTER (IRQ%d)", G8001_);
                } else {
                        printf(" SBLASTER (IRQ not connected)");
                }
                F8021_();
                L3110_i_++;
        }
        if (L3110_i_ == 0) {
                printf(" NONE\n");
        } else {
                printf("\n");
        }
        L3097_ui_ = 0;
        printf("Analog Joystick connected  : ");
        if (F8031_(3)) {
                printf("JOYSTICK1 ");
                L3097_ui_++;
        }
        if (F8031_(12)) {
                printf("JOYSTICK2 ");
                L3097_ui_++;
        }
        if (L3097_ui_ == 0) {
                printf("NONE");
        }
        printf("\n");
        printf("Mouse/Driver Version/IRQ   : ");
        if (F8034_IsMousePresent()) {
                F8035_GetMouseVersionAndType(&L3100_i_MouseMajorVersion, &L3101_i_MouseMinorVersion, &L3102_i_MouseType, &L3103_i_MouseInterrupt);
                switch (L3102_i_MouseType) {
                        case 1:
                                printf("BUS");
                                break;
                        case 2:
                                printf("SERIAL");
                                break;
                        case 3:
                                printf("InPort");
                                break;
                        case 4:
                                printf("PS/2");
                                break;
                        case 5:
                                printf("HP");
                                break;
                        default:
                                printf("Unknown (type %d)");
                                break;
                }
                printf(" / %0d.%02X / IRQ%d\n", L3100_i_MouseMajorVersion, L3101_i_MouseMinorVersion, L3103_i_MouseInterrupt);
        } else {
                printf("NONE\n");
        }
        printf("Extended keyboard          : ");
        F8048_(F8045_());
        printf("Extended key BIOS support  : ");
        F8048_(F8046_());
        asm     xor     ax, ax
        asm     mov     es, ax
        asm     mov     al, es:410h
        asm     mov     ah, 0
        asm     mov     cl, 6
        asm     sar     ax, cl
        asm     inc     ax
        asm     mov     di, ax
        for (L3097_ui_ = 0; L3097_ui_ < 2; L3097_ui_++) {
                printf("Floppy Drive %c type        : ", 'A' + L3097_ui_);
                if (L3097_ui_ <= _DI) {
                        F8047_(L3097_ui_ + 1);
                } else {
                        printf("Not Installed\n");
                }
        }
        asm     mov     ah, 30h
        asm     int     21h            /* DOS - GET DOS VERSION */
                                       /* Return: AL = major version number (00h for DOS 1.x) */
        asm     mov     L3104_uc_, al
        asm     mov     L3105_uc_, ah
        printf("DOS Version                : ");
        if (L3104_uc_) {
                printf("%d.%d\n", L3104_uc_, L3105_uc_);
        } else {
                printf("DOS 1.0 or earlier\n");
        }
        for (L3097_ui_ = 0; L3097_ui_ < 8; L3097_ui_++) {
                asm     mov     ax, L3097_ui_
                asm     add     ax, 5
                asm     mov     dx, 0FFFFh
                asm     xor     bx, bx
                asm     or      bx, ax
                asm     mov     es, dx
                asm     mov     al, es:[bx]
                asm     lea     dx, L3099_ac_
                asm     mov     bx, L3097_ui_
                asm     add     bx, dx
                asm     mov     ss:[bx], al
        }
        L3099_ac_[8] = '\0';
        printf("BIOS Date                  : %s\n", &L3099_ac_);
}
#endif
