boot.s

as86:

! boot.s -- basic structure of bootsect.s

.globl begtext, begdata, begbss, endtext, enddata, endbss
.text
begtext:
.data
begdata:
.bss
begbss:
.text
BOOTSEG = 0x07c0

entry start
start:
	jmpi	go, BOOTSEG
go:	mov	ax, cs
	mov	ds, ax
	mov	es, ax
	mov	[msg1+17], ah
	mov	cx, #20
	mov	dx, #0x1004
	mov	bx, #0x000c
	mov	bp, #msg1
	mov	ax, #0x1301
	int	0x10
loop1:	jmp	loop1
msg1:	.ascii	"Loading system ..."
	.byte	13, 10

.org 510
	.word	0xAA55

.text
endtext:
.data
enddata:
.bss
endbss:

 Makefile:

all: boot.img


boot.o: boot.s
        as86 -0 -a -o $@ $^

boot: boot.o
        ld86 -0 -s -o $@ $^

boot.img: boot
        dd bs=32 if=$^ of=$@ skip=1

 bochs config:

megs: 32

romimage: file=../BIOS-bochs-latest
vgaromimage: file=../VGABIOS-lgpl-latest

ata0: enabled=1, ioaddr1=0x1f0, ioaddr2=0x3f0, irq=14
ata0-master: type=disk, path="boot.img", cylinders=1, heads=1, spt=1

boot: c

log: bochsout.txt

mouse: enabled=0

 

 

猜你喜欢

转载自accuya.iteye.com/blog/1100120