; boot1.asm   stand alone program for floppy boot sector
; Compiled using            nasm -f bin boot1.asm
; Written to floppy with    dd if=boot1 of=/dev/fd0
	
; Boot record is loaded at 0000:7C00,
	ORG 7C00h
; load message address into SI register:
	LEA SI,[msg]
; screen function:
	MOV AH,0Eh
print:  MOV AL,[SI]         
	CMP AL,0         
	JZ done		; zero byte at end of string
	INT 10h		; write character to screen.    
     	INC SI         
	JMP print

; wait for 'any key':
done:   MOV AH,0       
    	INT 16h		; waits for key press
			; AL is ASCII code or zero
			; AH is keyboard code

; store magic value at 0040h:0072h to reboot:
;		0000h - cold boot.
;		1234h - warm boot.
	MOV  AX,0040h
	MOV  DS,AX
	MOV  word[0072h],0000h   ; cold boot.
	JMP  0FFFFh:0000h	 ; reboot!

msg 	DB  'Welcome, I have control of the computer.',13,10
	DB  'Press any key to reboot.',13,10
	DB  '(after removing the floppy)',13,10,0
; end boot1