User Tools

Site Tools


operating_systems:freedos

This is an old revision of the document!


FreeDOS

FreeDOS is a trademark of Jim Hall. FreeDOS is released under the GNU General Public License.

What is it? MS-DOS compatible! An operating system you can understand. `FreeDOS is an open source DOS-compatible operating system that you can use to play classic DOS games, run legacy business software, or develop embedded systems. Any program that works on MS-DOS should also run on FreeDOS.` from their website.

Why use it? https://arstechnica.com/information-technology/2014/07/it-may-be-barely-an-operating-system-but-dos-still-matters-to-some-people/ - Run old DOS applications and games - Programming apps and graphics is simpler. It's a much smaller operating system so you can actually understand it better. - To learn more about operating systems, history, programming, graphics - For fun of retro computing - Portable - anyone can run it, low system requirements. Run it on a 40 year old computer up to a modern 2021 computer. The x86 chips we have in all of our desktops are backwards compatible to the 16-bit 8086. They will mimic it. It will run on anything running current era hardware with x86 instructions! Really cool! People with powerful hardware can run the DosBox emulator in a host operating system.

DosBox vs FreeDOS (One is an emulator, one is a true OS)

DOS is single user/no user. Always root access to everything.

Installing

Download and installed. Run it https://www.dosbox.com `mount c ~` will mount your home directory to C:\ ## Installing FreeDOS

Video on installing manually: https://www.youtube.com/watch?v=krbYBZr2ISw (Load live environment, use `fdisk` to partition disk, `format C: /s` to wipe drive and make bootable by copying system files, then get packages from \PACKAGES\BASE with `for %f in (*.ZIP) do unzip %f -x SOURCE/* -d C:\FDOS`)

Recommended FULL install with source. The FULL install will give you the package manage `fdimples`.

Download ISO from:

- On physical machine - In virtual machine - in VirtualBox, use the regular CD, not the Legacy one, but before you press “Install to hard disk” press `Tab` to edit the entry and add the word `raw` to the end. E.g. `.linux /isolinux/memdisk initrd=/isolinux/fdboot.img raw` otherwise you will get `Invalid Opcode at 0FAE 1068` messages. Set CPU max to 40% or it might go wild at some points. - Formatting hard disk

  1. From within FreeDOS: `format C:` or `format C: /s` for bootable.
  2. or: `fdisk`
  3. If you re-install it won't wipe the existing data.

## How kernel boot works and fdconfig.sys

https://www.youtube.com/watch?v=KQvJGoc-KfU

Add a custom launcher, menu option 5:

`MENU 5 - do nothing` (Won't load anything from autoexec) `5?SHELL=C:\FDOS\BIN\COMMAND.COM`

How to setup a single dedicated program to run: https://www.youtube.com/watch?v=Nn8_9ABgrb4 Put it in `AUTOEXEC.BAT` or in `COMMAND.COM` with `SHELL=C:\myapp.exe`

## Explanation of files

Here are the files. That's it. That's the whole operating system.

- `AUTOEXEC.BAT` - Put all your stuff here. Like your init scripts and bash profile in one - `COMMAND.COM` - `FDCONFIG.SYS` - Boot configuration, menu configuration - `KERNEL.SYS` - The kernel binary itself. 48 KB! - `FDOS\` - `FDOS\BIN\` - Executables

Basic commands

- `?`, `help`, Adding ` /?` - `ver`, `vol`, `mem`, `cls`, `which`, `path` - `cd`, `dir`, `dir /w`, `tree`, `| more`, `mkdir`, `echo hi > test.txt`, `rmdir`, `deltree` - `type`, `edit`, `set`, `edit` - `fdconfig.sys` - Update PATH `PATH %PATH%;C:\MY\BIN`

- How to mount a floppy or CD-ROM? - How to check free disk space? (du?) - How to check what devices are connected (Is there a CD ROM?)

Editors

There is a built-in editor called `EDIT`. Another editor can be installed: Folding Editor `FED` from the FreeDOS CD using `fdimples`. Vim can be installed in 1.3!

``` EDIT C:\FED\FED.EXE C:\VIM\VIM.EXE ```

Get software

Using fdimples on FreeDOS

Insert the FreeDOS CD-ROM, then run `fdimples` to get the software repository screen. Use `TAB`, `SHIFT-TAB`, the arrow keys, `SPACE`, and `RETURN` to move around and select things. Then hit OK to install.

Recommended fdimples packages:

- Development/DJGPP (C/C+ compiler) - Development/FBC (BASIC compiler) - Development/Lua (Lua interpreter) - Editors/FED - Editors/VIM - Unix-like tools - Desktops - FDNET for networking

  1. curl, links, wget, rsync, sshdos, vncview

curl, links, htget, ping, rsync, sshdos, vncview, wget - DN2 (file navigator) - Dialog - sqlite

Installing manually in FreeDOS

Video on installing software without `fdimples`: https://www.youtube.com/watch?v=WBgGUndr8I0 Download other software from: https://www.freedos.org/software/ Download the zip using `wget` or `curl` or `htget` or `links`.

List the files in a zip

``` unzip -l FILE.ZIP # unzip -j FILE.ZIP SPECIFIC\SUBDIR\*.* -d C:\DEST unzip -j FILE.ZIP PROGS\XYZ\*.* -d C:\XYZ ```

Updating fdimples packages

Update packages with the following command. It will require `FDNET` package installed to enable networking.

``` fdnpkg update ```

Many packages seem broken on the FreeDOS 1.2 CD, like Perl. But, after running `fdnpkg update` and then `fdimples` to uninstall and re-install Perl, it worked. Same with packages like curl (SSL seemed broken and wonky), and

Networking

Once you have `curl`, `wget` and ethtools, you can start fetching programs from internet. If you restart after installing the network tools, it will use DHCP to obtain an IP address. It will print your IP on startup.

<!– There is a browser called `lynx` and `links` too. (On website?) –> <!– SSH tool? –> - FDNET (base requirement to get networking working) - links - Text-based web browser - curl - Make network requests. Use `curl -k` for SSL since there are no CA certs on the system. - gopherus - I can't get SSH to work yet. FreeDOS 1.3 comes with SSH2.

### Web browsing

Text Browser: Links C:\Links\links.exe GUI Browser: Dillo C:\DILLO\DILLO.exe

Programming

Languages

- Lua: `C:\DEVEL\LUA\LUA.EXE` - Assembly: `fasm`, `jwasm`, `nasm` - BASIC: `FBC` (FreeBasic 32-bit compiler) - C: `bcc` (Bruce's C compiler), `gcc` (djgpp C/C++ compiler), `ow` Open Watcom C/C++ Compiler - Pascal: `FPC`

NASM

Similar to the Linux hello world program except `int 80h` won't work because that's a Linux interrupt. In DOS its `int 21`

Lua
Perl
BASIC

https://www.youtube.com/watch?v=tIGokkohQho https://www.youtube.com/watch?v=OyPUn74nj-s

Install `FreeBASIC` compiler from FreeDOS CD using `fdimples`. Then, use the compiler `C:\DEVEL\FBC\FBC.EXE`. Compile `.BAS` files to `.EXE` with it. There are examples in `C:\DEVEL\FBC\EXAMPLES\EXAMPLES.ZIP` and documention in `C:\DEVEL\FBC\`.

``` cd C:\DEVEL\FBC\EXAMPLES unzip EXAMPLES.ZIP ..\FBC.EXE HELLO.BAS HELLO.EXE ```

C

Make sure DJGPP is installed from the FreeDOS CD-ROM using `fdimples`. Install DJGPP, DJGPP_BN (binutils) DJGPP_GC (gcc), and DJGPP_GP (g++), GJGPP_DB (gdb) and DJGPP_MK (make).

<!– ``` SET DJGPP=C:\DEVEL\DJGPP\DJGPP.ENV PATH %PATH%;C:\DEVEL\DJGPP\BIN ``` –>

http://www.freedos.org/books/cprogramming/ http://www.freedos.org/ebook/cprogramming/part1/

Use `djgpp` C:\devel\djgpp\

32-bit C/C++ toolchain http://www.delorie.com/djgpp/

Console programming: http://www.freedos.org/ebook/cprogramming/part8/

```c #include <stdio.h> int main() { print(“Hi\n”); } ```

```c #include <conio.h> #include <graph.h>

int main() {

_setvideomode(_TEXTC80); // Color text mode
_settextposition(10, 60);
_outtext("hi");
getch();
_setvideomode(_DEFAULTMODE);
return 0;

} ```

Graphics programming

VGA memory segment?

Drawing a rectangle:

```c /* https://www.youtube.com/watch?v=t63FVSEnycE */ #include <conio.h> #include <graph.h>

int main() {

/* _VRES16COLOR, _SVRES16COLOR, _SVRES256COLOR, _XRES16COLOR, _XRES256COLOR */
_setvideomode(_VRES16COLOR);
int color;
for (color = 0; color < 16; color++) {
	_setcolor(color);
	_rectangle(_GBORDER, 5, 50, 20, 200); /* or _GFILLINTERIOR */
}

} ```

https://www.youtube.com/watch?v=oCrqiVQ7jdo

Emulators on FreeDOS

In 1.3 there are lots of emulators!!

Desktop on FreeDOS

In 1.3, there are 3 desktops you can install: OpenGEM, OzoneGUI, Seal

OpenGEM is another desktop C:\FDOS\OpenGem\gem.bat

Install `OZONEGUI` under `fdimples` → Utilities. Then run: `cd C:\OZONEGUI; main`. Go to the Control Panel and modify the display settings to higher resolution and color depth. <!– How to modify the settings in terminal if you mess up the resolution? –>

How to get into a GUI desktop to run apps like `DILLO` and `BWBASIC` ? Using oZone: https://www.youtube.com/watch?v=nw-Fx5k7Smg

## Other

- How to dual boot on a physical machine with Linux - Can I use pthreads? https://www.freebasic.net/forum/viewtopic.php?t=21274 - How to get sound/audio players working? How to play a .WAV - How to mount a network drive (looks like there are ntfs/nfs packages) - Can I compile with curses?

- Can I get vifm to compile? PDCurses? - Cookbook stuff!

  1. DOS
    1. Setup, Batch scripts, CLI basics
  2. Perl 5 stuff

- Can I compile Python or Ruby or Node.JS? - Mirror their whole program library - Java on DOS? Cross-compiling stuff for DOS binaries in 16-bit 8086 format. https://nullprogram.com/blog/2014/12/09/ https://hackaday.com/2018/05/14/msdos-development-with-gcc/ DosBox web interface like interne archive

References

operating_systems/freedos.1616367502.txt.gz · Last modified: 2021/03/21 22:58 by nanodano