davidgiven / ack

The Amsterdam Compiler Kit
http://tack.sf.net
Other
420 stars 59 forks source link

[8086/8088][feature/question] build .com files or plain raw binaries #210

Open Fabrizio-Caruso opened 4 years ago

Fabrizio-Caruso commented 4 years ago

Is it possible to just build plain old .COM binary files for the 8088 target? or other binary formats (possibly executable in DOS)? Some old PC did not use 1.44 floppy. Some did not even have floppies at all (such as the Atari Portfolio). I would like to generate a .COM file (for the Atari Portfolio).

Is it already possible? If not, it would be nice to have this feature.

davidgiven commented 4 years ago

It's currently not supported but would be easy to do: .COM binary files are just a memory dump from 0x0100 onwards in a segment, the same as on CP/M.

The only thing which has prevented anyone doing this is that producing a reasonably useful syscall library is a bit of work: the main one is trying to decide how to map DOS drives and paths. (There is a standard, which I don't know.)

Fabrizio-Caruso commented 4 years ago

Ok, I understand that implement calls to the systems would be a major task. But why not provide a bare metal binary? I suppose the floppy image is sort of a bare metal PC binary that is read by reading a floppy with no proprietary file system.

kernigh commented 4 years ago

Our pc86 platform uses BIOS calls to read the floppy drive, read/write the console, and reboot the system; see plat/pc86/boot.s and plat/pc86/libsys/*.s.

A DOS executable would need at least a different boot.s that doesn't read the floppy drive, and code for _exit() to return to DOS. So far, no one has written the code.

tkchia commented 3 years ago

Hello @Fabrizio-Caruso, hello @kernigh,

In case it is useful to know: I am trying to see if I can get ACK to support MS-DOS .com programs. I have started a separate development branch for this under my ACK fork.

davidgiven commented 3 years ago

Cool --- thanks!

FWIW, I do have DOS support in my cowgol project which might be useful --- look in rt/msdos and src/cowlink/archmsdos.coh. https://github.com/davidgiven/cowgol

Fabrizio-Caruso commented 3 years ago

@tkchia, this is really cool. I hope @davidgiven would one day integrate some DOS support in ACK. Even a minimalist library for input/output would be cool. At least ncurses or conio or anything equivalent would help.

tkchia commented 3 years ago

Hello @davidgiven, hello @Fabrizio-Caruso,

FWIW, I do have DOS support in my cowgol project which might be useful --- look in rt/msdos and src/cowlink/archmsdos.coh. https://github.com/davidgiven/cowgol

Thanks for the pointer! ☺

Here is my reasonably complete first cut attempt at MS-DOS .com program support: https://github.com/davidgiven/ack/compare/default...tkchia:a6c7ac2a280b895a7dfb29cda31510c757b50f77 . I will see if I can test and document the code further.

Thank you!