diff --git a/blk/753 b/blk/753 index 8c16863..425fda8 100644 --- a/blk/753 +++ b/blk/753 @@ -4,6 +4,7 @@ : INT, 0xcd A, A, ; ( no argument, flow ops are special ) : JMP8, 0xeb A, ; : JMP16, 0xe9 A, ; : JZ, 0x74 A, ; +: JMPr, 0xff A, 7 AND 0xe0 OR A, ; : LODSB, 0xac A, ; : CLI, 0xfa A, ; : HLT, 0xf4 A, ; : STI, 0xfb A, ; : ORrr, 0x08 A, MODRMrr A, ; diff --git a/blk/811 b/blk/811 index 8f55a6d..a2d4b97 100644 --- a/blk/811 +++ b/blk/811 @@ -2,14 +2,9 @@ H@ ORG ! 0x7c00 BIN( ! ( BIOS loads boot bin at 0x7c00 ) JMP8, L1 FWR8 ( start ) ORG @ 0x25 + HERE ! ( bypass BPB ) L1 FSET ( start ) -CLI, CLD, AX AX XORxx, DS AX MOVsx, ES AX MOVsx, STI, +CLI, CLD, AX AX XORxx, DS AX MOVsx, ES AX MOVsx, +SS AX MOVsx, SP 0xffff MOVrI, STI, AH 2 MOVri, DX 0 MOVrI, CH 0 MOVri, CL 2 MOVri, AL 1 MOVri, BX 0x8000 MOVrI, 0x13 INT, ( read 2nd sector of boot floppy ) -SI 0x8000 MOVrI, AH 0x0e MOVri, ( print char ) -L1 BSET ( loop ) LODSB, AL AL ORrr, ( end of str? ) -JZ, L2 FWR8 ( next ) 0x10 INT, ( print char ) -JMP8, L1 ( loop ) BWR -L2 FSET ( next ) AH 0 MOVri, 0x16 INT, ( read kbd ) -AH 0x0e MOVri, 0x10 INT, ( spit read char ) HLT, ( done ) +BX JMPr, ORG @ 0x1fe + HERE ! 0x55 A, 0xaa A, -," Hello from 2nd sector of boot floppy!" 0 A, diff --git a/blk/812 b/blk/812 new file mode 100644 index 0000000..87dac03 --- /dev/null +++ b/blk/812 @@ -0,0 +1,10 @@ +H@ ORG ! 0x8000 BIN( ! +JMP8, L1 FWR8 ( start ) +L2 ( msg ) BSET ," Hello World!" 0 A, +L1 FSET ( start ) +SI L2 @ ( msg ) MOVrI, AH 0x0e MOVri, ( print char ) +L1 BSET ( loop ) LODSB, AL AL ORrr, ( end of str? ) +JZ, L2 FWR8 ( next ) 0x10 INT, ( print char ) +JMP8, L1 ( loop ) BWR +L2 FSET ( next ) AH 0 MOVri, 0x16 INT, ( read kbd ) +AH 0x0e MOVri, 0x10 INT, ( spit read char ) HLT, ( done ) diff --git a/recipes/pcat/Makefile b/recipes/pcat/Makefile index 07e34e3..6c6394c 100644 --- a/recipes/pcat/Makefile +++ b/recipes/pcat/Makefile @@ -1,16 +1,26 @@ -TARGET = boot.bin +TARGET = disk.bin BASEDIR = ../.. EDIR = $(BASEDIR)/emul STAGE = $(EDIR)/stage .PHONY: all all: $(TARGET) -$(TARGET): xcomp.fs $(STAGE) +mbr.bin: mbr.fs $(STAGE) + cat mbr.fs | $(STAGE) > $@ + +os.bin: xcomp.fs $(STAGE) cat xcomp.fs | $(STAGE) > $@ +disk.bin: mbr.bin os.bin + cat mbr.bin os.bin > $@ + $(STAGE): $(MAKE) -C $(EDIR) stage .PHONY: emul emul: $(TARGET) qemu-system-i386 -fda $(TARGET) + +.PHONY: clean +clean: + rm *.bin diff --git a/recipes/pcat/mbr.fs b/recipes/pcat/mbr.fs new file mode 100644 index 0000000..1b856d1 --- /dev/null +++ b/recipes/pcat/mbr.fs @@ -0,0 +1,4 @@ +750 LOAD +811 LOAD +ORG @ 256 /MOD 2 PC! 2 PC! +H@ 256 /MOD 2 PC! 2 PC! diff --git a/recipes/pcat/xcomp.fs b/recipes/pcat/xcomp.fs index 1b856d1..dc2fb4e 100644 --- a/recipes/pcat/xcomp.fs +++ b/recipes/pcat/xcomp.fs @@ -1,4 +1,4 @@ 750 LOAD -811 LOAD +812 LOAD ORG @ 256 /MOD 2 PC! 2 PC! H@ 256 /MOD 2 PC! 2 PC!