I thought I'd start a new week with something completely different from my usual Windows-based exploits, so I've had a go at making a boot sector program. Naturally this can't be done in C, so I also had a crash course in Assembly Language (Hugs his copy of "Assembly Language for Intel-Based Computers"), which lasted about ten minutes.
Anywho, after ressurecting the Turbo C compiler I used to use, I proceded to write the following:-
I pushed the code through TASM, then tried TLINK /t for a .COM file, but it wasn't to be ("Invalid entry point"), so I had to settle for an .EXE. I ripped the last 512 bytes from the executable, wrote it to the boot sector of a floppy disk, and rebooted.Code:.model tiny .code org 0 jmp start welcome db 'Hello non-OS World!',0 start: mov ax, 07C0h mov ds, ax mov es, ax mov si, offset welcome print: lodsb cmp al, 0 je finish mov ah, 0Eh mov bx, 7 int 10h jmp print finish: jmp finish org 510 dw 0AA55h end
It didn't quite seem to go to plan, as all that happened was that 3 non-alphanumeric characters were displayed and that was it.
Now obviously, as a result of writing that boot sector, the disk ceased to work as a storage medium and was completely unreadable before I formatted it. This leads me to believe that:-
1. I overwrote the FAT information. Whoops...
2. There must be certain mandatory fields of data required on every disk regardless of file system.
Am I right?