FreeDos with QBASIC From a Single Floppy

I remember that FreeDOS had a floppy boot disk. What if I could hack it for an embedded DOS OS and even fit QuickBASIC in? Finally run it on the EeePC in a true Cyberpunk style?
It turns out it is possible and cooler than I thought!
Customizing DOS is super easy and intuitive. There are some small things that needs to be done to fit just enough stuff onto the floppy and still end up with working system.
I will guide you with few easy steps.
Project Goals
You will create an boot disk with OS that boots straight to the BASIC environment. With a nice boot screen.
High level goals
- working DOS OS
- text editor included
- QuickBASIC IDE included
- compiling .EXE files
- ram disk
- initialization program
- fits on 1.44MB floppy
Software Included
Latest FreeDOS stripped to basic functionality. Only have two advanced programs.


FreeDOS EDIT 0.9a
This is a very nice word processor. It takes 67KB but it's very useful for editing configuration or README files. That's why I keep it.
Microsoft (R) QuickBasic 4.50
I don't know the license for this files but they are available on many sites. To fit it on the floppy I removed all examples and help files. In the end there is only this IDE, linker and compiler. Enough to make .EXE programs. It takes 666KB of space.

Initialization Program

I really wanted to have this modern boot feeling. I created simple BASIC program for that. Additionally it copies the intro/example basic file to the ram disk and then starts QBASIC environment for it.
You will be able to customize this after first boot. Just edit source files and compile new INIT.EXE.
Building FreeDOSxQBASIC
Now the fun parts begins. Grab your terminal and let's start.
Download and extract those:
- FreeDOS Floppy boot image - FD13-Floppy.zip
- Go to https://www.qbasic.net/ and get QuickBasic 4.5 EN
- Initialization program init.zip with sources
When you got all the needed files it's time to customizing FreeDOS. Go to the directory where you extracted the image and mount it.
cd FD13-Floppy
sudo mount -o loop FD13FLOP.img /mnt
cd /mnt
Now it's time to remove everything non essential to our project.
sudo rm setup.bat
sudo rm -rf freedos/nls
sudo rm -rf freedos/setup/
cd freedos/bin/
sudo rm fdramdrv.bat mbrzap.bat udvd2.sys cdrom.bat fdimples.exe format.exe fdinst.exe fdisk.ini fdiskpt.ini gcdrom.sys more.exe fdisk.exe grep.exe shsucdx.com srdisk.exe welcome.bat zip.exe jemmex.exe jemm386.exe fc.exe xcopy.exe
cd ../..
Now replace fdauto.bat with this:
@echo off
SET PATH=A:\FREEDOS\BIN
SET DIRCMD=/P /OGN /Y
FDAPM APMDOS
DOSLFN
LBACACHE.COM buf 20 flop
SHSURDRV /D:512K,D
SET OS_NAME=FreeDOSxQBASIC
SET OS_VERSION=1.3-RC4
SET AUTOFILE=%0
SET CFGFILE=\FDCONFIG.SYS
alias reboot=fdapm warmboot
alias reset=fdisk /reboot
alias halt=fdapm poweroff
alias shutdown=fdapm poweroff
CLS
INIT
Easiest way is to run:
sudo nano fdauto.bat
Remove everything and paste the code above.
In the middle of that code the SHSURDRV /D:512K,D creates ram disk. Change 512K to anything bigger if you need to. And have enough RAM.
Last lines clears the screen and run Initialization Program. Copy INIT.EXE and INIT.BAS to the floppy.
cd ~/Downloads/init/
sudo cp INIT.EXE INIT.BAS INTRO.BAS /mnt
Lastly you need the minimal QBASIC.
cd ~/Downloads/qb45/QB45/
sudo cp QB.EXE LINK.EXE BC.EXE LIB/BCOM45.LIB /mnt
If you want quick help (not full manual) and you want sacrefice 172KB of space then copy /HLP/QB45ENER.HLP and /HLP/QB45QCK.HLP to /mnt also
For mouse support copy MOUSE.EXE to /mnt/freedos/bin/
And that's it! Detach and rename the image and you can do the first boot with it.
sudo umount /mnt
cd ~/Downloads/FD13-Floppy
mv FD13FLOP.img FreeDOSxQBASIC.img
Run FreeDOSxQBASIC
Emulate it using QEMU. The -m parameter is for RAM size. 2MB in this example.
qemu-system-i386 -fda FreeDOSxQBASIC.img -m 2

Burn
Insert floppy into the (external) drive and run dd command.
sudo dd if=FDQB.img of=/dev/sdb bs=1MB
In my computer the FDD is /dev/sdb. It can be different on your machine. Check it first!

Download
Don't bother doing all of this? Download the final image.
- FreeDOSxQBASIC.img 301KB free space
- FreeDOSxQBASIC-plus.img + help + mouse support 157KB free space
Cyber Netbook
Especially for this project I attached the floppy drive to my EeePC 701D for that Cyberpunk aesthetics! Now I can hack BASIC programs on the go :)


