Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7969379
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T07:13:42+00:00 2026-06-04T07:13:42+00:00

I want to generate a 16-bit executable BINARY RAW format by Watcom C compiler

  • 0

I want to generate a 16-bit executable BINARY RAW format by Watcom C compiler. Something like an EXE file without any header that runs in Real Mode.

I use Large memory model, Thus code segment and data segment may be different and can increase more than 64K bytes.

I do like this:

// kernel.c
void kernel(void)
{
    /* Print Hello! */
    __asm
    {
        mov ah, 0x0E;
        mov bl, 7

        mov al, 'H'
        int 0x10

        mov al, 'e'
        int 0x10

        mov al, 'l'
        int 0x10

        mov al, 'l'
        int 0x10

        mov al, 'o'
        int 0x10

        mov al, '!'
        int 0x10
    }
    return;
}

For compiling above code I run below batch file:

@rem build.bat

@rem Cleaning.
del *.obj
del *.bin

cls

@rem Compiling.
@rem 0:     8088 and 8086 instructions.
@rem d0:    No debugging information.
@rem ml:    The "large" memory model (big code, big data) is selected.
@rem s:     Remove stack overflow checks.
@rem wx:    Set the warning level to its maximum setting.
@rem zl:    Suppress generation of library file names and references in object file.
wcc -0 -d0 -ml -s -wx -zl kernel.c

@rem Linking.
@rem FILE:      Specify the object files.
@rem FORMAT:    Specify the format of the executable file.
@rem NAME:      Name for the executable file.
@rem OPTION:    Specify options.
@rem Note startup function (kernel_) implemented in kernel.c.
wlink FILE kernel.obj FORMAT RAW BIN NAME kernel.bin OPTION NODEFAULTLIBS, START=kernel_

del *.obj

After running build.bat the following message generated by Watcom compiler and linker:

D:\Amir-OS\ckernel>wcc -0 -d0 -ml -s -wx -zl kernel.c
Open Watcom C16 Optimizing Compiler Version 1.9
Portions Copyright (c) 1984-2002 Sybase, Inc. All Rights Reserved.
Source code is available under the Sybase Open Watcom Public License.
See http://www.openwatcom.org/ for details.
kernel.c: 28 lines, included 35, 0 warnings, 0 errors
Code size: 39

D:\Amir-OS\ckernel>wlink FILE kernel.obj FORMAT RAW BIN NAME kernel.bin OPTION N
ODEFAULTLIBS, START=kernel_
Open Watcom Linker Version 1.9
Portions Copyright (c) 1985-2002 Sybase, Inc. All Rights Reserved.
Source code is available under the Sybase Open Watcom Public License.
See http://www.openwatcom.org/ for details.
loading object files
Warning! W1014: stack segment not found
creating a RAW Binary Image executable

Output files successfully generated.

But my question is:

How can I resolve W1014 warning?

And is there any way to specify initial CS value?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T07:13:43+00:00Added an answer on June 4, 2026 at 7:13 am

    The stack segment information is usually initialized in the cstartup module which eventually calls main. The linker will sum stack requirements for the modules included in the link and this will be reflected in the value cstartup places in sp. The stack segment will be part of the ds and es grouping unless you have the multi-threading flag (when ss will be separate). You can also experiment with setting the stack size in the linker command file.

    I suggest you write a .asm module which defines the segments and groups required by the large memory model before it calls kernel. A lot of trial and error but what you learn will be applicable to the startup code for most environments.

    Check out the (disassembly) .lst file that Watcom can generate and you should get enough guidance on how the .asm module should be written.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to generate a PDF file on server side, and then in response
I'm using Ubuntu 10.04 and Qt4.6, and I've created an executable binary file on
This is what I want to do: Generate a 512 bit RSA keypair in
I want to generate eight bit (uint8_t) random numbers so that I exclude a
I'm trying to generate some 8-bit random numbers with C++ and don't want to
I want to use PBKDF2 with some cryptographic hash function to generate 128-bit AES
Given a positive integer n, I want to generate all possible n bit combinations
I want to generate a 24-bit-length hash from strings. After some googling, I found
I have a 56 bit binary string that i want to use as the
I want to generate any limited std::string size unique id (i.e of size 6)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.