All pastes #50840 Raw Edit

Unnamed

public text v1 · immutable
#50840 ·published 2006-04-24 03:03 UTC
rendered paste body

.intel_syntax noprefix

.global _start

.code16
.org 0x0
.text

_start:
	# Update the segment registers
	mov ax, cs
	mov ds, ax
	mov es, ax


reset:				# Reset the floppy drive
	mov ax, 0		#
	mov dl, 0		# Drive=0 (=A)
	int 0x3			#
	jc reset		# ERROR => reset again

	mov ax, 0x100		# ES:BX = 1000:0000
	mov es, ax		#
	mov bx, 0		#

read:
	mov ah, 2		# Load disk data to ES:BX
	mov al, 1		# Load 1 sectors
	mov ch, 0		# Cylinder=0
	mov cl, 2		# Sector=2
	mov dh, 0		# Head=0
	mov dl, 0		# Drive=0
	int 0x13		# Read!

	jc read			# ERROR => Try again

hang:
	mov ah, 0x0e
	mov bx, [0x100]
	mov al, [bx]
	int 0x10

	jmp hang		# hang the program

.org 509
.byte 'h'
.word 0xAA55

.byte 'h'
.byte 'i'

.org 1024