Let's say I have built an assembly program (a basic print), so I have got a .BIN file.
Now I want to make it a bootable floppy disc image (a virtual one), so that when I start an OS (in the vm), it will first execute the assembly instructions from my program which is located on that virtual floppy disc.
How to do that correctly?
How to make a bootable floppy disc image?
768 Views Asked by Radu Aramă At
1
There are 1 best solutions below
Related Questions in ASSEMBLY
- Is there some way to use printf to print a horizontal list of decrementing hex digits in NASM assembly on Linux
- How to call a C language function from x86 assembly code?
- Binary Bomb Phase 2 - Decoding Assembly
- AVR Assembly Clock Cycle
- Understanding the differences between mov and lea instructions in x86 assembly
- ARM Assembly code is not executing in Vitis IDE
- Which version of ARM does the M1 chip run on?
- Why would %rbp not be equal to the value of %rsp, which is 0x28?
- Move immediate 8-bit value into RSI, RDI, RSP or RBP
- Unable to run get .exe file from assembly NASM
- DOSbox automatically freezes and crashes without any prompt warnings
- Load function written in amd64 assembly into memory and call it
- link.exe unresolved external symbol _mainCRTStartup
- x86 Wrote a boot loader that prints a message to the screen but the characters are completely different to what I expected
- running an imf file using dosbox in parallel to a game
Related Questions in VIRTUAL-MACHINE
- My server TCP doesn't receive messages from the client in C
- How do I fix VERR_INVALID_HANDLE (0X80004005) Error in VirtualBox?
- Why when I want to open a folder from Visual Studio Code does the screen go crazy?
- net.show command only shows my own ip not other devices
- Azure VM RDP doesn't require 'Virtual Machine Admin/User Login' roles despite what documentation says
- How to create a VM with proxmox API?
- Broken Windows Server, after crash of VM - CBS_E_SOURCE_MISSING
- Trouble Connecting USB Wireless Adapter via Bridged Adapter in VirtualBox for Kali Linux
- Using Maven to feed minikube on a VM
- New to llvm - trying to make the files but getting collect2: fatal error
- virStorageFileBackendFileRead Failed to open file '/dev/...': Permission denied
- How to run kubernetes on a virtual windows server 2019?
- Is it possible to connect to a Google Cloud VM using IPv6?
- Provide access to Azure Storage Account for all VMs in resource group
- In a Managed Application Azure Marketplace deployment template, if one of the resources is a VM, how can the vendor access the vm?
Related Questions in BOOT
- Can't upgrade to newest version of linux-image-6.5.0-26-generic
- Direct boot from USB without changing BIOS setting or selecting from boot manager
- How can I implement a android app which is developed with kotlin in Android studio with my back end in spring boot?
- Android boot animation change in source code
- Pi Pico C++ code doesn't autorun after reset
- fsck error on boot: dev/mapper/ubuntu--vg-ubuntu--lv: UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY
- Enabling Lazy Initialization Breaks Kafka Listeners Using Spring Cloud Kafka Binder
- Spring Boot App in Docker container - SQL Server Integrated Security
- Rails bootsnap/eventmachine in boot.rb NoMethodError get_hosts_path for module Win32::Resolv
- Bootstrap for a variable after group by (getting confidence intervals for each group)
- Could not determine recommended JdbcType for `com.test.dd.entity.ConsumerRequest
- How to migrate fragment syntax in Thymeleaf 3.x from version 2.x
- Tibco ems service unavailable exception in jdk 17
- Memory Aliasing to a specific Flash Sector
- Spring Boot Integration MQTT DSL - Channel not Autowired
Related Questions in OSDEV
- Seeking for the the method for adding the DL (data register) value to DX register
- "Config.guess failed to determine the host type" when trying build binutils-2.7 with Cygwin
- LLVM code generation causes problems with pointer arithmetic
- Maximum CPU Voltage reading
- Purpose of stack register(s) in holding 0x7c00
- Behavior of the adress 0x7e00 in different sectors and their alternatives
- General Protection Fault encountered when executing SYSRET
- Bootloader are really in sector 0?
- Is heap memory in Linux contiguous?
- How to define different [global_allocator]s for a monolithic os kernel and its applications
- QEMU: address of grub module has zeros if not referenced directly in the code
- Assembly draw line function
- "Cannot find bounds of current function" error in GDB while debugging bootloader code
- Confusion regarding CS and DS segment registers during bootloading process
- Rust tell the compiler to not trust the registers?
Related Questions in FLOPPY
- How to limit printing contents of ASCII file to once while using recursion?
- Finding the formula using Head, Track, Sector
- Memory Read Error in the default BOCHS BIOS
- FAT12 file starts at 0x4200 or 0x4400?
- Formatting floppy disk for Apple llc
- How to make a bootable floppy disc image?
- How do I mount a travan tape drive in Linux
- List contents of floppy image file without mounting in Linux
- Why is my bootloader not loading the second sector to memory?
- Running BootSector on VirtualBox
- Why is my floppy disk reading code failing?
- Bochs: INT13_diskette: ctrl not ready
- bash create a floppy file with mbr and mount
- Strcmp doesn't work and I don't seem to understand why - transformation to ASCII code makes the program work as expected though
- Creating a multi-part archive to fit on floppy on Solaris 5.8
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
You can use my boot sector loaders (ldosboot
boot.asmfor FAT12 / FAT16 FS) and my boot image creation script to make a 1440 KiB file system image preloaded with your kernel executable and a loader in the first sector. You'll also need my macro collection. Here's an example shell session to clone the repos and build an image. This is using hg (Mercurial) to load the repos, wget to get a release of my debugger as an example program, Info-ZIP's unzip to unpack it, NASM to assemble the loader and image, and qemu to run everything once assembled.The documentation for bootimg is in a comment at the top of the main source file. I used the
_BOOTFILEdefine (set to a twice quoted string so NASM receives a quoted string) to indicate a boot sector file, and the main_PAYLOADFILEdefine to specify inclusion of the debugger executable, renaming it toKERNEL.SYSso that the default name used by the_COMPAT_FREEDOSloader will find our executable.Aside from the FreeDOS compatibility selection,
boot.asmneeds some additional switches to disable features not needed to boot a 1440 KiB diskette image. This is because the FreeDOS compatible loader needs more space than my (lDOS) default.Finally, the file that you specify to be loaded (either a default like
KERNEL.SYSor one in a filename specified using theboot.asmdefines_LOAD_NAMEand_LOAD_EXT) needs to be in the correct format. The FreeDOS load protocol is fairly simple: Your entire file is loaded to address 600h, addressable using the segmented address 60h:0, andcs:ipare set up exactly as 60h:0. The registerblreceives the ROM-BIOS unit you were booted from andss:bppoints to a copy of the FS's boot sector somewhere in memory. All other registers, particularly the segment registers, are indeterminate and must be initialised by your code if you want to use them.Note that the FreeDOS load protocol differs from most other load protocols at this level in that
blis set to the load unit. Depending on which loader is useddlmay differ fromblin which caseblis correct, anddlincorrect. The load unit can also be found in the boot sector copy pointed to byss:bp, either inbyte [ss:bp + 40h]for FAT32 orbyte [ss:bp + 24h]for FAT12 and FAT16.Reviewing this answer several years later, a few things should be noted:
The new option
-D_BOOTPATCHFILE=can be used instead of-D_BOOTFILE=. This has the advantage that a different file system layout than the default 1440 KiB FAT12 for a 90mm diskette image can be used. (Even for such images, the boot patch file need not contain the pre-initialised default BPB, which for example the FreeDOS loaders do not.)The bootimg script will cut the particular bits of the boot patch file that are needed. (In the bdiff this shows up as the default volume label changing to "NO NAME".) You do have to provide the correct loader for the file system type, that is FAT12 (
nasm ldosboot/boot.asm), FAT16 (nasm ldosboot/boot.asm -D_FAT16), or FAT32 (nasm ldosboot/boot32.asm). For the FAT32 loader that ships with ldosboot, you also have to specify-D_BOOTINFOFILE='"::bootpatchfile"'to the bootimg.asm script.The other bit to consider is if you want to use a bootimg output image as a hard disk partition then you may have to set the media ID byte to 0F8h in order to pass checks in some drivers, eg here in EDR-DOS.
Here's the original and changed bootimg.asm assembly commands, and the bdiff output showing the resulting differences.