User Tools

Site Tools


freedos

FreeDOS

FreeDOS is an MS-DOS compatible OS released under the GNU General Public License.

DOSBox vs FreeDOS

DOSBox is an emulator meant to run on a host operating system, FreeDOS is an actual OS that runs on hardware or a virtual x86 machine.

Installing

Minimal manual installation

Video on installing manually: https://www.youtube.com/watch?v=krbYBZr2ISw

Steps:

  1. Partition the disk with fdisk
  2. Create a file system on the partition with format
  3. Make the disk bootable and copy kernel with sys
  4. Optionally, install any desired packages by unzipping and copying them over
# Partition the disk, create file system, make bootable
# and install the kernel.sys + command.com
fdisk
# Reboot after this doing fdisk!
format c:
sys c:

## Example of how to "install" packages from Base group
C:
cd \PACKAGES\BASE
# ''-x SOURCE/*'' will exclude files in source directories
# ''-d sets the destination directory, where unzipped files go
for %f in (*.ZIP) do unzip %f -x SOURCE/* -d d:\FreeDOS

By performing those steps, you have a minimal bootable system. There will only be two files on the drive:

  • KERNEL.SYS - The FreeDOS kernel itself
  • COMMAND.COM - The command prompt and built-in commands. Akin to Bash or BusyBox. This provides the C:\> prompt.

If you boot up and get a prompt, excellent. Type ? to get a list of built-in commands and features. You should see features like history, tab completion, directory stacks (pushd/popd), last directory (cd -).

Example steps:

  • Boot into the Live mode from the install disk
  • Run fdisk and setup a partition
  • Run format d: to setup a file system on the partition created. Can include /s makes it bootable by copying system files (KERNEL.SYS and COMMAND.COM) or do the next step manually
  • Run sys d: to copy the boot sector to d drive and kernel.
  • At this point the system should be bootable and you will load into the typical C:\> prompt with only two files on the system. Type ? for list of builtin commands.
  • To install additional application, unzip programs from the PACKAGES directory.
    • The BASE package is everything needed to recreate basic DOS environment.
    • To see what is in a zip file, unzip -l like unzip -l tree.zip
    • To install everything in a directory (omit -x if you do not want to exclude sources): cd \PACKAGES\BASE and for %f in (*.ZIP) do unzip %f -x SOURCE/* -d d:\FDOS or d:\FreeDOS in newer version.

Use installer

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

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.

Dealing with JemmEx out of memory error

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

Edit C:\fdconfig.sys to choose different memory option in menu.

or try modifying the -X=TEST to -X=c900-dfff

Setup Sound Blaster emulation

You can get audio working using a sound blaster emulator driver. The one that works well for me is VSBHDA on my ThinkPad X60. The version of VSBHDA that comes with FreeDOS does not work, so I have to go download the latest version from GitHub. As of this writing, the latest v1.8 is the one that works for me.

Download the zip file and unzip the contents to your disk and run start.bat from the folder. For example, if I put all the contents into C:\VSBHDA\ I would set it up like this:

REM Add this to fdauto.bat for example
c:
cd \VSBHDA
REM Call is needed otherwise it permanently hands control over to the .bat and
REM never returns
CALL start.bat
cd \

Then you can test it out with a game like Boom (available in FreeDOS packages).

C:\games\boom\boom.exe

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 - The built-in shell. Akin to BusyBox or Bash.
  • FDCONFIG.SYS - Boot configuration, menu configuration
  • KERNEL.SYS - The kernel binary itself. 48 KB!
  • FDOS\ - In newer versions like 1.3rc5, C:\FreeDOS instead.
  • FDOS\BIN\ - Executables

Getting help

You can always type ? to get a list of the built-in commands. This will be available even if you did the absolute minimal install with fdiskformatsys and you only have KERNEL.SYS and COMMAND.COM as the only two files on disk.

?

- ?, help

Adding /?

dir /?

Built-in commands

Built-in commands that come with COMMAND.COM:

Enter: ? to see.

Built-in commands:

  • echo - Print text to terminal
  • cls - Clear the screen
  • which - Find where an executable is located. E.g. which fdisk
  • vol - Disk volume information. E.g. vol d:

There are also built-in features like:

  • Directory stack (pushd/popd)
  • Last directory (cd -)
  • History (history)
  • Tab completion

- 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

Batch scripting

Even in the most minimal install, you have COMMAND.COM which is the shell that has built-in commands. This shell is scriptable, like Bash. The scripts are called Batch scripts and end with a .BAT extension.

for %f in (*.ZIP) do unzip %f -x SOURCE/* -d d:\FreeDOS

Mounting USB & CD drives

Get software

Using fdimples package manager

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:

  1. Development/DJGPP (C/C+ compiler)
  2. Development/FBC (BASIC compiler)
  3. Development/Lua (Lua interpreter)
  4. Editors/FED
  5. Editors/VIM
  6. Unix-like tools
  7. Desktops
  8. FDNET for networking
  9. curl, links, wget, rsync, sshdos, vncview

curl, links, htget, ping, rsync, sshdos, vncview, wget

  1. DN2 (file navigator)
  2. Dialog
  3. 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/

#include <stdio.h>
int main() { print("Hi\n"); }
#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

0xA000 for graphics 0xB800 for text

Drawing a rectangle:

/* 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

References

freedos.txt · Last modified: by nanodano

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki