标签: watcom

Open Watcom的优点和缺点

因为在StackOverflow的一些帖子中,如果可行的话,建议尝试支持多个(在这种情况下是C/C++)编译器,因为这会强制您编写更符合标准的代码并帮助查找错误.

所以我一直在寻找额外的免费C/C++编译器,我可以为我的项目添加支持(它是用C/C++编写的(两种语言相结合)).我发现Open Watcom是一个有趣的候选人.

所以我的问题是:Open Watcom C/C++编译器与其他编译器相比有哪些优点和缺点(例如gcc/g ++,Visual C++等)?

c c++ compiler-construction watcom

9
推荐指数
3
解决办法
8541
查看次数

16 位 x86 MS-DOS 实模式下的分段远指针分配

我正在尝试用 C 语言对实模式 MS-DOS 进行编程。使用一些关于游戏编程的旧书作为起点。书中的源代码是为 Microsoft C 编写的,但我试图让它在 OpenWatcom v2 下编译。当我尝试访问指向 VGA 视频内存开头的指针时,我很早就遇到了问题。

#include <stdio.h>
#include <dos.h>

void Set_Video_Mode(int mode) {
    
    union REGS inregs, outregs;

    inregs.h.ah = 0; 
    inregs.h.al = (unsigned char) mode;

    int86(0x10, &inregs, &outregs);
}


int main(void)
{
    Set_Video_Mode(0x13);

    //the following line throws an error, without it the code compiles and runs
    char far *video_buffer = (char far *)0xA0000000L;

    while (!kbhit()) { };

    Set_Video_Mode(0x03);

    return 0;
} 
Run Code Online (Sandbox Code Playgroud)

这是远指针赋值引发以下错误:

VGA.C(33):错误!E1077:缺少 '}'
VGA.C(33):警告!W107:缺少函数“main”的返回值
VGA.C(36):错误!E1099: 语句必须位于函数内部。可能的原因:缺少{

这有点令人困惑,似乎宏定义出了问题,或者是什么......

当我使用相同的编译器尝试维基百科关于远指针的文章中的代码时:

#include …
Run Code Online (Sandbox Code Playgroud)

c dos real-mode watcom x86-16

9
推荐指数
1
解决办法
867
查看次数

如何组装GAS组件并将其与Open Watcom C库链接?

我正在尝试生成16位DOS可执行文件,但使用gcc编译器.所以我使用古老的gcc-4.3 ia16端口.我制作了我的构建的Docker镜像:https://registry.hub.docker.com/u/ysangkok/ia16-gcc-rask

这是我正在尝试的:

host $ mkdir results
host $ docker run -v $PWD/results:/results -it ysangkok/ia16-gcc-rask
container $ cd results
Run Code Online (Sandbox Code Playgroud)

我没有包含头文件,导致gcc无法使用OpenWatcom的libc头文件.

container $ echo 'main() { printf("lol"); }' > test.c
Run Code Online (Sandbox Code Playgroud)

我没有链接因为我没有16位binutils可用.如果我构建一个目标文件,它没有正确标记为16位.

container $ /trunk/build-ia16-master/prefix/bin/ia16-unknown-elf-gcc -S test.c
Run Code Online (Sandbox Code Playgroud)

现在我有这个汇编文件:

    .arch i8086,jumps
    .code16
    .att_syntax prefix
#NO_APP
    .section    .rodata
.LC0:
    .string "lol"
    .text
    .p2align    1
    .global main
    .type   main, @function
main:
    pushw   %bp
    movw    %sp,    %bp
    subw    $4, %sp
    call    __main
    movw    $.LC0,  %ax
    pushw   %ax
    call    printf
    addw    $2, %sp
    movw …
Run Code Online (Sandbox Code Playgroud)

c assembly coff gnu-assembler watcom

7
推荐指数
1
解决办法
554
查看次数

在Linux下使用OpenWatcom为DOS交叉编译freetype

我正在为旧的MS-DOS计算机编写程序,这比任何事情都有趣。我使用Linux(Fedora 19)作为开发机器,并使用OpenWatcom 1.9编译我的代码。

现在,我想在我的项目中使用FreeType(2.5.2),但是在使用OpenWatcom时遇到了麻烦。make setup watcom像文档建议的那样运行无法正常运行,但仍会自动检测到Unix系统:

$ make setup watcom

FreeType build system -- automatic system detection

The following settings are used:

  platform                    unix
  compiler                    cc
  configuration directory     ./builds/unix
  configuration rules         ./builds/unix/unix.mk

If this does not correspond to your system or settings please remove the file
`config.mk' from this directory then read the INSTALL file for help.

Otherwise, simply type `make' again to build the library,
or `make refdoc' to build the API reference (the latter needs python). …
Run Code Online (Sandbox Code Playgroud)

dos cross-compiling freetype2 watcom

5
推荐指数
0
解决办法
390
查看次数

调试使用 OpenWatcom 编译的崩溃的 32 位 DOS 可执行文件

我有一个使用 OpenWatcom classic(1.9 - 最新稳定版本)为 32 位 DOS/DPMI 目标(带有 DOS32/A 扩展器)编译的应用程序。如果程序因内存访问错误而崩溃,我会得到错误指令的 CS:EIP。如何将其映射到汇编代码/源代码行号?(注:我在 Wine 下使用 Windows 版本的 OpenWatcom(在 Linux 中运行),然后在 DosBox 中运行可执行文件。)

使用 GCC/binutils,我将使用 -ggdb 进行编译,然后在可执行文件上使用 objdump -DS 来获取程序集和源代码视图。有 OpenWatcom 同等产品吗?或者,也许,一个可以做同样事情的交互式调试器?我尝试使用 wdis,但这只适用于目标文件,不适用于可执行文件。由于使用目标文件,我无法知道它将被重新定位到哪里,因此它毫无用处。或者也许至少有一种方法可以为可执行文件生成符号映射?

c windows debugging dos watcom

5
推荐指数
1
解决办法
415
查看次数

c ++遍历字符串向量

所以我最近发现了地图和矢量的使用,但是,我试图想办法循环一个包含字符串的向量.

这是我尝试过的:

#include <string>
#include <vector>
#include <stdio>

using namespace std;

void main() {
    vector<string> data={"Hello World!","Goodbye World!"};

    for (vector<string>::iterator t=data.begin(); t!=data.end(); ++t) {
        cout<<*t<<endl;
    }
}
Run Code Online (Sandbox Code Playgroud)

当我尝试编译它时,我收到此错误:

cd C:\Users\Jason\Desktop\EXB\Win32
wmake -f C:\Users\Jason\Desktop\EXB\Win32\exbint.mk -h -e
wpp386 ..\Source\exbint.cpp -i="C:\WATCOM/h;C:\WATCOM/h/nt" -w4 -e25 -zq -od    -d2 -6r -bt=nt -fo=.obj -mf -xs -xr
..\Source\exbint.cpp(59): Error! E157: col(21) left expression must be integral
..\Source\exbint.cpp(59): Note! N717: col(21) left operand type is 'std::ostream watcall (lvalue)'
..\Source\exbint.cpp(59): Note! N718: col(21) right operand type is 'std::basic_string<char,std::char_traits<char>,std::allocator<char>> (lvalue)'
Error(E42): …
Run Code Online (Sandbox Code Playgroud)

c++ vector watcom

3
推荐指数
1
解决办法
1万
查看次数

如何在DOS扩展器或DPMI环境下进行DMA传输?

程序如何在DOS扩展程序+ DPMI环境下运行时使用DMA传输?

我的意思是我们如何分配和获取分配的dma缓冲区的物理地址,以便将该物理地址提供给DMA控制器或PCI总线主设备.

有两种可能性:

DOS Extender或DPMI服务器/主机支持虚拟内存.例如铜锣湾.

DOS Extender或DPMI服务器/主机不支持虚拟内存,但启用了分页.例如DOS32a.

我正在使用Open Watcom C编译器.

运行时环境是:

FreeDOS + XMS(无EMS/EMM386)+ DOS扩展器(DOS32a)

对于DJGPP,解决方案就在这里

但最后提到的解决方案即通过XMS,也可以使用DOS32a吗?

DOS32a文档说在切换到保护模式之前,它会分配所有可用的扩展内存,然后我们的程序可以通过DPMI函数501h分配该内存.

注意:dma缓冲区可能是1MB左右,所以我不能使用常规内存.

x86 assembly dos watcom

3
推荐指数
1
解决办法
1662
查看次数