1 ; boot1.asm stand alone program for floppy boot sector 2 ; Compiled using nasm -f bin boot1.asm 3 ; Written to floppy with dd if=boot1 of=/dev/fd0 4 5 ; Boot record is loaded at 0000:7C00, 6 ORG 7C00h 7 ; load message address into SI register: 8 00000000 8D36[2500] LEA SI,[msg] 9 ; screen function: 10 00000004 B40E MOV AH,0Eh 11 00000006 8A04 print: MOV AL,[SI] 12 00000008 3C00 CMP AL,0 13 0000000A 7405 JZ done ; zero byte at end of string 14 0000000C CD10 INT 10h ; write character to screen. 15 0000000E 46 INC SI 16 0000000F EBF5 JMP print 17 18 ; wait for 'any key': 19 00000011 B400 done: MOV AH,0 20 00000013 CD16 INT 16h ; waits for key press 21 ; AL is ASCII code or zero 22 ; AH is keyboard code 23 24 ; store magic value at 0040h:0072h to reboot: 25 ; 0000h - cold boot. 26 ; 1234h - warm boot. 27 00000015 B84000 MOV AX,0040h 28 00000018 8ED8 MOV DS,AX 29 0000001A C70672000000 MOV word[0072h],0000h ; cold boot. 30 00000020 EA0000FFFF JMP 0FFFFh:0000h ; reboot! 31 32 00000025 57656C636F6D652C20- msg DB 'Welcome, I have control of the computer.',13,10 33 0000002E 49206861766520636F- 34 00000037 6E74726F6C206F6620- 35 00000040 74686520636F6D7075- 36 00000049 7465722E0D0A 37 0000004F 507265737320616E79- DB 'Press any key to reboot.',13,10 38 00000058 206B657920746F2072- 39 00000061 65626F6F742E0D0A 40 00000069 286166746572207265- DB '(after removing the floppy)',13,10,0 41 00000072 6D6F76696E67207468- 42 0000007B 6520666C6F70707929- 43 00000084 0D0A00 44 ; end boot1