mirror of
https://github.com/hsoft/collapseos.git
synced 2024-11-26 10:18:05 +11:00
Compare commits
5 Commits
b037c86598
...
507c2c12e7
Author | SHA1 | Date | |
---|---|---|---|
|
507c2c12e7 | ||
|
5033f17be2 | ||
|
374932fa4d | ||
|
07e50313c7 | ||
|
e17f2e6907 |
16
blk/730
16
blk/730
@ -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.
|
||||
|
||||
|
4
blk/751
4
blk/751
@ -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 8 ; : CX 9 ; : DX 10 ; : BX 11 ;
|
||||
: SP 12 ; : BP 13 ; : SI 14 ; : DI 15 ;
|
||||
: AX 0 ; : CX 1 ; : DX 2 ; : BX 3 ;
|
||||
: SP 4 ; : BP 5 ; : SI 6 ; : DI 7 ;
|
||||
: ES 0 ; : CS 1 ; : SS 2 ; : DS 3 ;
|
||||
|
2
blk/752
2
blk/752
@ -4,5 +4,3 @@
|
||||
;
|
||||
: PC H@ ORG @ - BIN( @ + ;
|
||||
: A, C, ;
|
||||
( dst8 src8 -- modrm )
|
||||
: MODRMrr 0x7 AND 3 LSHIFT SWAP 0x7 AND OR 0xc0 OR ;
|
||||
|
19
blk/753
19
blk/753
@ -1,11 +1,12 @@
|
||||
: 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, ;
|
||||
: MOVrI, SWAP 0xb0 OR A, SPLITB A, A, ;
|
||||
: MOVsx, 0x8e A, SWAP MODRMrr A, ;
|
||||
: MOVxi, SWAP 0xb8 OR A, SPLITB A, A, ;
|
||||
: MOVsx, 0x8e A, SWAP 3 LSHIFT OR 0xc0 OR A, ;
|
||||
: INT, 0xcd A, A, ;
|
||||
( 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, ;
|
||||
: 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,
|
||||
|
2
blk/755
2
blk/755
@ -1,4 +1,4 @@
|
||||
: FWR8 BSET 0 A, ;
|
||||
: FWRs BSET 0 A, ;
|
||||
: FSET @ THEN, ;
|
||||
( : BREAK, FJR, 0x8000 OR ;
|
||||
: BREAK?, DUP 0x8000 AND IF
|
||||
|
16
blk/811
16
blk/811
@ -1,14 +1,10 @@
|
||||
H@ ORG ! 0x7c00 BIN( ! ( BIOS loads boot bin at 0x7c00 )
|
||||
JMP8, L1 FWR8 ( start )
|
||||
JMPs, L1 FWRs ( start )
|
||||
ORG @ 0x25 + HERE ! ( bypass BPB )
|
||||
L2 BSET ( msg ) ," Hello, World!" 0 A,
|
||||
L1 FSET ( start )
|
||||
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 )
|
||||
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,
|
||||
ORG @ 0x1fe + HERE ! 0x55 A, 0xaa A,
|
||||
|
10
blk/812
Normal file
10
blk/812
Normal file
@ -0,0 +1,10 @@
|
||||
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 )
|
@ -44,4 +44,4 @@ unpack:
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm -f $(TARGETS) emul.o *-bin.h blkfs
|
||||
rm -f $(TARGETS) emul.o *-bin.h blkfs libz80/libz80.o
|
||||
|
@ -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