mirror of
https://github.com/hsoft/collapseos.git
synced 2024-11-27 14:58:06 +11:00
pcat: separate MBR code and OS code
MBR code now strictly loads OS code into memory and jumps into it. Now, I've got to consolidate my assembler code, modrm logic is messed up.
This commit is contained in:
parent
e17f2e6907
commit
07e50313c7
1
blk/753
1
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, ;
|
||||
|
11
blk/811
11
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,
|
||||
|
10
blk/812
Normal file
10
blk/812
Normal file
@ -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 )
|
@ -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
|
||||
|
4
recipes/pcat/mbr.fs
Normal file
4
recipes/pcat/mbr.fs
Normal file
@ -0,0 +1,4 @@
|
||||
750 LOAD
|
||||
811 LOAD
|
||||
ORG @ 256 /MOD 2 PC! 2 PC!
|
||||
H@ 256 /MOD 2 PC! 2 PC!
|
@ -1,4 +1,4 @@
|
||||
750 LOAD
|
||||
811 LOAD
|
||||
812 LOAD
|
||||
ORG @ 256 /MOD 2 PC! 2 PC!
|
||||
H@ 256 /MOD 2 PC! 2 PC!
|
||||
|
Loading…
Reference in New Issue
Block a user