1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-11-26 14:38:05 +11:00

Compare commits

..

No commits in common. "507c2c12e7c6850c04305a2b1d55975cb65041ad" and "b037c8659867eaf49d9bc130632f5624226660a1" have entirely different histories.

11 changed files with 36 additions and 55 deletions

16
blk/730
View File

@ -2,15 +2,15 @@
Work in progress. Load with "750 LOAD".
Mnemonics are followed by argument types. For example, MOVri,
moves 8-bit immediate to 8-bit register.
'r' = 8-bit register 'x' = 16-bit register
'i' = immediate, size depends on other operand.
's' = SREG register
Mnemonics that only have one signature (for example INT,) don't
have operands letters.
For jumps, it's special. 's' is SHORT, 'n' is NEAR, 'f' is FAR.

View File

@ -3,6 +3,6 @@ CREATE BIN( 0 , : BIN(+ BIN( @ + ;
VARIABLE L1 VARIABLE L2 VARIABLE L3 VARIABLE L4
: AL 0 ; : CL 1 ; : DL 2 ; : BL 3 ;
: AH 4 ; : CH 5 ; : DH 6 ; : BH 7 ;
: AX 0 ; : CX 1 ; : DX 2 ; : BX 3 ;
: SP 4 ; : BP 5 ; : SI 6 ; : DI 7 ;
: AX 8 ; : CX 9 ; : DX 10 ; : BX 11 ;
: SP 12 ; : BP 13 ; : SI 14 ; : DI 15 ;
: ES 0 ; : CS 1 ; : SS 2 ; : DS 3 ;

View File

@ -4,3 +4,5 @@
;
: PC H@ ORG @ - BIN( @ + ;
: A, C, ;
( dst8 src8 -- modrm )
: MODRMrr 0x7 AND 3 LSHIFT SWAP 0x7 AND OR 0xc0 OR ;

19
blk/753
View File

@ -1,12 +1,11 @@
: OP1 CREATE C, DOES> C@ A, ;
0xac OP1 LODSB, 0xfa OP1 CLI, 0xfb OP1 STI,
0xf4 OP1 HLT, 0xfc OP1 CLD, 0xfd OP1 STD,
( no argument, jumps with abs addrs are special )
0xeb OP1 JMPs, 0xe9 OP1 JMPn, 0x74 OP1 JZ,
: MOVri, SWAP 0xb0 OR A, A, ;
: MOVxi, SWAP 0xb8 OR A, SPLITB A, A, ;
: MOVsx, 0x8e A, SWAP 3 LSHIFT OR 0xc0 OR A, ;
: MOVrI, SWAP 0xb0 OR A, SPLITB A, A, ;
: MOVsx, 0x8e A, SWAP MODRMrr A, ;
: INT, 0xcd A, A, ;
: JMPr, 0xff A, 7 AND 0xe0 OR A, ;
: OPrr CREATE C, DOES> C@ A, 3 LSHIFT OR 0xc0 OR A, ;
0x31 OPrr XORxx, 0x08 OPrr ORrr,
( no argument, flow ops are special )
: JMP8, 0xeb A, ; : JMP16, 0xe9 A, ; : JZ, 0x74 A, ;
: LODSB, 0xac A, ; : CLI, 0xfa A, ; : HLT, 0xf4 A, ;
: STI, 0xfb A, ;
: ORrr, 0x08 A, MODRMrr A, ;
: XORxx, 0x31 A, MODRMrr A, ;
: CLD, 0xfc A, ; : STD, 0xfd A, ;

View File

@ -1,4 +1,4 @@
: FWRs BSET 0 A, ;
: FWR8 BSET 0 A, ;
: FSET @ THEN, ;
( : BREAK, FJR, 0x8000 OR ;
: BREAK?, DUP 0x8000 AND IF

16
blk/811
View File

@ -1,10 +1,14 @@
H@ ORG ! 0x7c00 BIN( ! ( BIOS loads boot bin at 0x7c00 )
JMPs, L1 FWRs ( start )
JMP8, L1 FWR8 ( start )
ORG @ 0x25 + HERE ! ( bypass BPB )
L2 BSET ( msg ) ," Hello, World!" 0 A,
L1 FSET ( start )
CLI, CLD, AX AX XORxx, DS AX MOVsx, ES AX MOVsx,
SS AX MOVsx, SP 0xffff MOVxi, STI,
AH 2 MOVri, DX 0 MOVxi, CH 0 MOVri, CL 2 MOVri, AL 1 MOVri,
BX 0x8000 MOVxi, 0x13 INT, ( read 2nd sector of boot floppy )
BX JMPr,
CLI, CLD, AX AX XORxx, DS AX MOVsx, STI,
AH 0 MOVri, AL 2 MOVri, ( 80x25 BW video mode ) 0x10 INT,
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 )
ORG @ 0x1fe + HERE ! 0x55 A, 0xaa A,

10
blk/812
View File

@ -1,10 +0,0 @@
H@ ORG ! 0x8000 BIN( !
JMPs, L1 FWRs ( start )
L2 ( msg ) BSET ," Hello World!" 0 A,
L1 FSET ( start )
SI L2 @ ( msg ) MOVxi, AH 0x0e MOVri, ( print char )
L1 BSET ( loop ) LODSB, AL AL ORrr, ( end of str? )
JZ, L2 FWRs ( next ) 0x10 INT, ( print char )
JMPs, L1 ( loop ) BWR
L2 FSET ( next ) AH 0 MOVri, 0x16 INT, ( read kbd )
AH 0x0e MOVri, 0x10 INT, ( spit read char ) HLT, ( done )

View File

@ -44,4 +44,4 @@ unpack:
.PHONY: clean
clean:
rm -f $(TARGETS) emul.o *-bin.h blkfs libz80/libz80.o
rm -f $(TARGETS) emul.o *-bin.h blkfs

View File

@ -1,26 +1,16 @@
TARGET = disk.bin
TARGET = boot.bin
BASEDIR = ../..
EDIR = $(BASEDIR)/emul
STAGE = $(EDIR)/stage
.PHONY: all
all: $(TARGET)
mbr.bin: mbr.fs $(STAGE)
cat mbr.fs | $(STAGE) > $@
os.bin: xcomp.fs $(STAGE)
$(TARGET): 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

View File

@ -1,4 +0,0 @@
750 LOAD
811 LOAD
ORG @ 256 /MOD 2 PC! 2 PC!
H@ 256 /MOD 2 PC! 2 PC!

View File

@ -1,4 +1,4 @@
750 LOAD
812 LOAD
811 LOAD
ORG @ 256 /MOD 2 PC! 2 PC!
H@ 256 /MOD 2 PC! 2 PC!