Skip to content

this interrupt to have the same segment as the PSP #187

Description

@joshudson

Comment in source code:

    /*
     * some tools expect this interrupt to  have the same segment as the
     * command.com PSP, but FreeCOM is an exe...
     */

I don't know if your build tools can handle this yet; but I've come across an ingenious way to construct the EXE headers so this works.

  1. Adjust link order so the interrupt handler is fairly early in the file.
  2. Set the start address to have a segment of FFE0h.

This works because of the 16 bit arithmetic in the DOS kernel. The segment offset overflows and you end up entering the program with CS=DS=ES. I tried this with the DOS 5 kernel. It does in fact work, it's not just a FreeDOS thing.

In theory even if your tools can't do this, you have all the fixup addresses in the EXE header so it should be possible edit all the code fixups that refer to the code segment at startup. But that won't work if you have any global variables initialized with function pointers.

[I came across this comment looking for documentation on CMDLINE environment variable. It's shockingly poorly documented.]

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions