Borland C++ 3.1 for DOS 中directvideo的问题

      directvideo是控制DOS是否直接操纵视频缓冲区的开关,在conio.h中声明,而只有在 DOS环境下才会起作用。而在Borland C++ for window 下是没有作用的。主要在古老的DOS开发中经常的会使用的,这几天在搞Borland C++ for DOS 开发手持设备中,用到感觉有点迷惑了,记录下来,以防备忘.
   Borland C++(包括Turbo C)中,缺省为直接操纵视频缓冲区,这在HT系列掌上电脑上和仿真环境中会引起死机现象,必须在主程序开始时加上“directvideo=0;”来抑制直接写屏操作.
 

/* conio.h

    Direct MSDOS console input/output.

    Copyright (c) 1987, 1992 by Borland International
    All Rights Reserved.
*/


#if !defined(__CONIO_H)
#define __CONIO_H

#if !defined(___DEFS_H)
#include <_defs.h>
#endif

#if !defined(_Windows)

#define _NOCURSOR 0
#define _SOLIDCURSOR 1
#define _NORMALCURSOR 2

struct text_info {
    unsigned char winleft;
    unsigned char wintop;
    unsigned char winright;
    unsigned char winbottom;
    unsigned char attribute;
    unsigned char normattr;
    unsigned char currmode;
    unsigned char screenheight;
    unsigned char screenwidth;
    unsigned char curx;
    unsigned char cury;
};

enum text_modes { LASTMODE=-1, BW40=0, C40, BW80, C80, MONO=7, C4350=64 };

#if !defined(__COLORS)
#define __COLORS

enum COLORS {
    BLACK, /* dark colors */
    BLUE,
    GREEN,
    CYAN,
    RED,
    MAGENTA,
    BROWN,
    LIGHTGRAY,
    DARKGRAY, /* light colors */
    LIGHTBLUE,
    LIGHTGREEN,
    LIGHTCYAN,
    LIGHTRED,
    LIGHTMAGENTA,
    YELLOW,
    WHITE
};
#endif

#define BLINK 128 /* blink bit */
/*_cdecl 是C Declaration的缩写,表示C语言默认的函数调用方法:所有参数从右到左依次入栈,这些参数由调用者清除,称为手动清栈。被调用函数不需要求调用者传递多少参数,调用者传递过多或者过少的参数,甚至完全不同的参数都不会产生编译阶段的错误  C中不加说明默认函数为_cdecl调用方式 */
extern int _Cdecl directvideo; //这里定义了directvideo 其实值只能是0或1而已
extern int _Cdecl _wscroll;

#endif /* !_Windows */

#ifdef __cplusplus
extern "C" {
#endif

void _Cdecl clreol( void );
void _Cdecl clrscr( void );
void _Cdecl gotoxy( int __x, int __y );
int _Cdecl wherex( void );
int _Cdecl wherey( void );
int _Cdecl getch( void );
int _Cdecl getche( void );
int _Cdecl kbhit( void );
int _Cdecl putch( int __c );

#ifndef _PORT_DEFS
unsigned char _Cdecl inportb( unsigned __portid );
unsigned _Cdecl inport ( unsigned __portid );
int _Cdecl inp( unsigned __portid );
unsigned _Cdecl inpw( unsigned __portid );
void _Cdecl outportb( unsigned __portid, unsigned char __value );
void _Cdecl outport ( unsigned __portid, unsigned __value );
int _Cdecl outp( unsigned __portid, int __value );
unsigned _Cdecl outpw( unsigned __portid, unsigned __value );
#endif /* !_PORT_DEFS */

#if !defined(_Windows)

void _Cdecl delline( void );
int _Cdecl gettext( int __left, int __top,
                            int __right, int __bottom,
                            void *__destin);
void _Cdecl gettextinfo (struct text_info *__r );
void _Cdecl highvideo( void );
void _Cdecl insline( void );
void _Cdecl lowvideo( void );
int _Cdecl movetext( int __left, int __top,
                             int __right, int __bottom,
                             int __destleft, int __desttop );
void _Cdecl normvideo( void );
int _Cdecl puttext( int __left, int __top,
                            int __right, int __bottom,
                            void *__source );
void _Cdecl textattr( int __newattr );
void _Cdecl textbackground( int __newcolor );
void _Cdecl textcolor( int __newcolor );
void _Cdecl textmode( int __newmode );
void _Cdecl window( int __left, int __top, int __right, int __bottom);

void _Cdecl _setcursortype( int __cur_t );
char * _Cdecl cgets( char *__str );
int _Cdecl cprintf( const char *__format, ... );
int _Cdecl cputs( const char *__str );
int _Cdecl cscanf( const char *__format, ... );
char * _Cdecl getpass( const char *__prompt );
int _Cdecl ungetch( int __ch );

#endif /* !_Windows */

#ifndef _PORT_DEFS
#define _PORT_DEFS

    /* These are in-line functions. These prototypes just clean up
       some syntax checks and code generation.
     */

unsigned char _Cdecl __inportb__ (unsigned __portid);
unsigned _Cdecl __inportw__ (unsigned __portid);
unsigned char _Cdecl __outportb__(unsigned __portid, unsigned char __value);
unsigned _Cdecl __outportw__(unsigned __portid, unsigned __value);

#define inportb(__portid) __inportb__(__portid)
#define outportb(__portid, __value) ((void) __outportb__(__portid, __value))
#define inport(__portid) __inportw__(__portid)
#define outport(__portid, __value) ((void) __outportw__(__portid, __value))

/* MSC-compatible macros for port I/O */
#define inp(__portid) __inportb__ (__portid)
#define outp(__portid, __value) __outportb__(__portid, (unsigned char)__value)
#define inpw(__portid) __inportw__ (__portid)
#define outpw(__portid, __value) __outportw__(__portid, __value)

#endif /* _PORT_DEFS */

#ifdef __cplusplus
}
#endif


#endif /* __CONIO_H */


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Borland C++3.1 神话般的经典开发工具 带有传奇色彩的BORLAND公司,见证了美国软件技术市场上波澜壮阔、激动人心的技术大战和产品大战,最为经典的成功范例就是Borland C++3.1! Borland是国程序员最为景仰的公司之一,特别是对于资格老一点的程序员而言,他们学习编程的起步就是Borland. 以下是Borland c++入门指南摘录的一些信息 Borlandc++适用于需要一个专业化、优化的编译器的C++和C程序员,它同时适用于A&T公司的C++2.1版和ANSIC的程序员。它快速而有效,据此用户可以创建包括Microsoft Windows应用程序在内的任何应用程序。 Borland C++3.0可以在DOS的环境下运行,更可以在Windows下运行,在Windows之下的Borland C工作环境更亲切,将使您开发程序更得心应手。 C++是一个面向对象(OOP)的程序设计语言.使用户能充分利用OOP的先进设计方法和省时效率高的特点,它是C语言的进一步发展,它是可移植的,所以用户可以很容易地将一个由C++编写的应用程序从—个系统移植到另一个系统。在任何地方,都可以用C++从事任何编程工作。 Borland C++特色 1. Borland C++3.0及3.1可供程序设计人员开发C++及c程序。其c++是依照AT&T2.1标准设计的,而C则是ANSI C。因此让您开发的程序兼容性高.移植性(Portable)也更强。 2.全局的优化(Global Optimization):为程序编译出最优的目的码,使执行时间减少,使目的码变小。 3.缩短编译时间:由于编译器及工具的使用,大大减少了编译时间。 4.集成开发可境:(即IDE,Integrated Development Environment),本产品提供一完整的工作平台(Platform),使程序的编写编译、调试、分析、运行相当完整且方便。 5.窗口程序开发:本产品可以开发出Microsoft Windows程序,还包括完整的工具程序:窗口资源编译器(Resource Compiler),在线帮助编译器(Help Compiler)及窗口资源工作程序(Resource Workshop)。 6. DPMI编译器:DPMI (DOS Protected Mode Interface)使编译器可以在DOS或Windows386的保护模式下运行,因此开发大型的程序不用担心内存不足。 7. Easywin:或将DOS程序直接转成Window。程序的功能,不需要改半行令。 8. WinSight:窗口信息跟踪程序,使我们看到程序与Windows之间的联系息。 9.在线帮助,在IDE环境下,任何错误都可由在线帮助得到说明或者想要任何时间查询函数或其他说明,都可使用此项功能。 10.虚拟Run - time面向对象存储管理功能(VROOMM,Virtual Run-time Object-Oriented Memory Manager)。当程序设计人员选定目的码的覆盖功能后,VRAOOMM会处理一切事情,即使程序超过640K。 11.丰富的类库,本产品提供常用的数据结构,例如List, Queue, Qegue, Stack, Array. . 等。 12.丰富的函数库:本产品提供4, 5百个函数,可以说无所不包了。 1.2.1. Borland C++3.1新功能 1. 3.1版将Turbo C++ for Window。改名为Borland C++for Windows, 2. 3.1版配合Windows 3.1版,增加多媒体(Multi-Media)、笔(Pen)和MCI (Media Control Interface)之控制接口。 3. 新增Win Spector I具程序,此工具程序是当Windows程序发生General Protection Faults时,提供发生此错误的地方,及当时机器的状态。 4. 在Borland C++ for Window,提供最优化的选项。 5. 彩色语法高亮显示(Color Syntax Highlighting),在源程序设置不同的显示的颜 色。可在DOS IDE内的Options I Environment I Colors I Edit及Windows IDE内的Options Environment I Highlight内设置。 6. 可利用参数(-3)或IDC内的Options I Compiler I Advanced Coded Generation 80368设置产生386的目的码。 7. 可在程序内控制最大打开文件数,在_NFILE. H内#DEFINE_NFILE_n
Borland C++3.1 神话般的经典开发工具 带有传奇色彩的BORLAND公司,见证了美国软件技术市场上波澜壮阔、激动人心的技术大战和产品大战,最为经典的成功范例就是Borland C++3.1! Borland是国程序员最为景仰的公司之一,特别是对于资格老一点的程序员而言,他们学习编程的起步就是Borland. 以下是Borland c++入门指南摘录的一些信息 Borlandc++适用于需要一个专业化、优化的编译器的C++和C程序员,它同时适用于A&T公司的C++2.1版和ANSIC的程序员。它快速而有效,据此用户可以创建包括Microsoft Windows应用程序在内的任何应用程序。 Borland C++3.0可以在DOS的环境下运行,更可以在Windows下运行,在Windows之下的Borland C工作环境更亲切,将使您开发程序更得心应手。 C++是一个面向对象(OOP)的程序设计语言.使用户能充分利用OOP的先进设计方法和省时效率高的特点,它是C语言的进一步发展,它是可移植的,所以用户可以很容易地将一个由C++编写的应用程序从—个系统移植到另一个系统。在任何地方,都可以用C++从事任何编程工作。 Borland C++特色 1. Borland C++3.0及3.1可供程序设计人员开发C++及c程序。其c++是依照AT&T2.1标准设计的,而C则是ANSI C。因此让您开发的程序兼容性高.移植性(Portable)也更强。 2.全局的优化(Global Optimization):为程序编译出最优的目的码,使执行时间减少,使目的码变小。 3.缩短编译时间:由于编译器及工具的使用,大大减少了编译时间。 4.集成开发可境:(即IDE,Integrated Development Environment),本产品提供一完整的工作平台(Platform),使程序的编写编译、调试、分析、运行相当完整且方便。 5.窗口程序开发:本产品可以开发出Microsoft Windows程序,还包括完整的工具程序:窗口资源编译器(Resource Compiler),在线帮助编译器(Help Compiler)及窗口资源工作程序(Resource Workshop)。 6. DPMI编译器:DPMI (DOS Protected Mode Interface)使编译器可以在DOS或Windows386的保护模式下运行,因此开发大型的程序不用担心内存不足。 7. Easywin:或将DOS程序直接转成Window。程序的功能,不需要改半行令。 8. WinSight:窗口信息跟踪程序,使我们看到程序与Windows之间的联系息。 9.在线帮助,在IDE环境下,任何错误都可由在线帮助得到说明或者想要任何时间查询函数或其他说明,都可使用此项功能。 10.虚拟Run - time面向对象存储管理功能(VROOMM,Virtual Run-time Object-Oriented Memory Manager)。当程序设计人员选定目的码的覆盖功能后,VRAOOMM会处理一切事情,即使程序超过640K。 11.丰富的类库,本产品提供常用的数据结构,例如List, Queue, Qegue, Stack, Array. . 等。 12.丰富的函数库:本产品提供4, 5百个函数,可以说无所不包了。 1.2.1. Borland C++3.1新功能 1. 3.1版将Turbo C++ for Window。改名为Borland C++for Windows, 2. 3.1版配合Windows 3.1版,增加多媒体(Multi-Media)、笔(Pen)和MCI (Media Control Interface)之控制接口。 3. 新增Win Spector I具程序,此工具程序是当Windows程序发生General Protection Faults时,提供发生此错误的地方,及当时机器的状态。 4. 在Borland C++ for Window,提供最优化的选项。 5. 彩色语法高亮显示(Color Syntax Highlighting),在源程序设置不同的显示的颜 色。可在DOS IDE内的Options I Environment I Colors I Edit及Windows IDE内的Options Environment I Highlight内设置。 6. 可利用参数(-3)或IDC内的Options I Compiler I Advanced Coded Generation 80368设置产生386的目的码。 7. 可在程序内控制最大打开文件数,在_NFILE. H内#DEFINE_NFILE_n改变n的数值,要注意的是n必须小于等于Config.sys内的files数。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值