关于OpenWatcom

前几天突然想到要用C程序访问32位指令,比如本来用汇编可以很方便实现的访问eax,esi等等,简单的用TC、BC写了一个小程式,一试,居然无法识别EAX,ESI!这下头大了,要访问PCI配置空间,不用EAX怎么行呢?在网上搜了一下,再经高手指点,用如下文章做个小小总结,呵呵,提醒一下自己(如下一段是在其它网站上找到的,借用一下):


写flash tool访问BIOS ROM的时候一定要把A20#打开~进入的big real mode。
不过有一个软件工具可以帮你实现这个麻烦的步骤~ 你只要用它的命令编译就行
软件名称:open-watcom, 你还需要DOS4G.EXE这个工具

To compile and link our example program which is stored in the file hello.c, enter the following command:
      
     C>wcl386 /l=dos4g hello.c
The typical messages that appear on the screen are shown in the following illustration.
      
     C>wcl386 /l=dos4g  hello.c
     Open Watcom C/C++32 Compile and Link Utility
     Copyright (c) 2006 the Open Watcom Contributors. All Rights Reserved.
     Portions Copyright (c) 1988, 2002 Sybase, Inc. All Rights Reserved.
     Source code is available under the Sybase Open Watcom Public License.
     See [url=http://www.openwatcom.org/]http://www.openwatcom.org/[/url] for details.
             wcc386 hello.c  
     Open Watcom C32 Optimizing Compiler
     Copyright (c) 2006 the Open Watcom Contributors. All Rights Reserved.
     Portions Copyright (c) 1984, 2002 Sybase, Inc. All Rights Reserved.
     Source code is available under the Sybase Open Watcom Public License.
     See [url=http://www.openwatcom.org/]http://www.openwatcom.org/[/url] for details.
     hello.c: 6 lines, included 174, 0 warnings, 0 errors
     Code size: 24
     Open Watcom Linker
     Copyright (c) 2006 the Open Watcom Contributors. All Rights Reserved.
     Portions Copyright (c) 1985, 2002 Sybase, Inc. All Rights Reserved.
     Source code is available under the Sybase Open Watcom Public License.
     See [url=http://www.openwatcom.org/]http://www.openwatcom.org/[/url] for details.
     loading object files
     searching libraries
     creating a DOS/4G executable
Provided that no errors were encountered during the compile or link phases, the "hello" program may now be run.
      
     C>hello
     Hello world
If you examine the current directory, you will find that two files have been created.  These are hello.obj (the result of compiling hello.c) and hello.exe (the result of linking hello.obj with the appropriate Open Watcom C/C++ libraries).  It is hello.exe that is run by DOS when you enter the "hello" command.

 

总的来说,安装完OW之后(全安装)后,运行它设置自身环境变量的批处理后,即可以执行编译C程序了,小结以下几点:

1.可以随意嵌套汇编,好用吧!

2.不用include什么C的头文件,里面可用的库函数超多的;

3.正题:编译指令,就是上面写的:wcl386 /l=dos4g  hello.c,如果在安装目录的文件夹BINW下放入源程序,其实可以使用wcl386 hello.c编译,因为这个目录下生成的EXE,默认就是在DOS下支持4GB的。就是说,/l=XXX,这个XXX是编译外加一个属性说明;

 

执行编译后,即生成EXE,hello.exe,大功告成了!

 

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值