From 177750c9287c72474e0ced2d2fe46d1ca94d44ec Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Fri, 12 Jun 2020 14:01:24 -0400 Subject: [PATCH] recipes/pcat: first steps into 8086! --- blk/001 | 2 +- blk/730 | 2 +- blk/731 | 12 ------------ blk/751 | 1 + blk/752 | 2 +- blk/754 | 2 +- blk/810 | 5 +++++ blk/811 | 14 ++++++++++++++ recipes/pcat/Makefile | 16 ++++++++++++++++ recipes/pcat/README.md | 3 +++ recipes/pcat/xcomp.fs | 4 ++++ 11 files changed, 47 insertions(+), 16 deletions(-) delete mode 100644 blk/731 create mode 100644 blk/810 create mode 100644 blk/811 create mode 100644 recipes/pcat/Makefile create mode 100644 recipes/pcat/README.md create mode 100644 recipes/pcat/xcomp.fs diff --git a/blk/001 b/blk/001 index 3fef1e6..6d79455 100644 --- a/blk/001 +++ b/blk/001 @@ -10,7 +10,7 @@ MASTER INDEX 550 TI-84+ Recipe 580 RC2014 Recipe 620 Sega Master System Recipe 650 AVR assembler 730 8086 assembler - +810 PC/AT Recipe diff --git a/blk/730 b/blk/730 index efa9c2b..903d983 100644 --- a/blk/730 +++ b/blk/730 @@ -2,7 +2,7 @@ Work in progress. Load with "750 LOAD". -Test code at B731 + diff --git a/blk/731 b/blk/731 deleted file mode 100644 index ce7982a..0000000 --- a/blk/731 +++ /dev/null @@ -1,12 +0,0 @@ -H@ ORG ! -JMP8, L1 FWR8 ( start ) -L2 BSET ( msg ) ," Hello, World!" 0 A, -L1 FSET ( start ) -CLI, AH 0 MOVri, AL 2 MOVri, 0x10 INT, -SI L2 @ ( msg ) MOVrI, AH 0x0e MOVri, -L1 BSET ( loop ) LODSB, AL AL ORrr, -JZ, L2 FWR8 ( next ) 0x10 INT, -JMP8, L1 ( loop ) BWR -L2 FSET ( next ) AH 0 MOVri, 0x16 INT, -AH 0x0e MOVri, 0x16 INT, HLT, -PC ORG @ DUMP diff --git a/blk/751 b/blk/751 index a2abf5e..937007f 100644 --- a/blk/751 +++ b/blk/751 @@ -1,4 +1,5 @@ VARIABLE ORG +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 ; diff --git a/blk/752 b/blk/752 index 7bf1c28..ba65af0 100644 --- a/blk/752 +++ b/blk/752 @@ -2,7 +2,7 @@ : SPLITB 256 /MOD SWAP ; -: PC H@ ORG @ - ; +: PC H@ ORG @ - BIN( @ + ; : A, C, ; ( dst8 src8 -- modrm ) : MODRMrr 0x7 AND 3 LSHIFT SWAP 0x7 AND OR 0xc0 OR ; diff --git a/blk/754 b/blk/754 index bbfd6b3..2b55b99 100644 --- a/blk/754 +++ b/blk/754 @@ -12,5 +12,5 @@ DUP PC ( l l pc ) -^ 1- ( l off ) ( warning: l is a PC offset, not a mem addr! ) - SWAP ORG @ + ( BIN( @ - ) ( off addr ) + SWAP ORG @ + BIN( @ - ( off addr ) C! ; diff --git a/blk/810 b/blk/810 new file mode 100644 index 0000000..fca6302 --- /dev/null +++ b/blk/810 @@ -0,0 +1,5 @@ +PC/AT Recipe + +Work in progress. + +811 Hello World boot diff --git a/blk/811 b/blk/811 new file mode 100644 index 0000000..47a9a19 --- /dev/null +++ b/blk/811 @@ -0,0 +1,14 @@ +: _filler 510 H@ ORG @ - DO 0 A, LOOP 0x55 A, 0xaa A, ; +H@ ORG ! 0x7c00 BIN( ! ( BIOS loads boot bin at 0x7c00 ) +JMP8, L1 FWR8 ( start ) +L2 BSET ( msg ) ," Hello, World!" 0 A, +L1 FSET ( start ) +CLI, +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 ) +_filler diff --git a/recipes/pcat/Makefile b/recipes/pcat/Makefile new file mode 100644 index 0000000..07e34e3 --- /dev/null +++ b/recipes/pcat/Makefile @@ -0,0 +1,16 @@ +TARGET = boot.bin +BASEDIR = ../.. +EDIR = $(BASEDIR)/emul +STAGE = $(EDIR)/stage + +.PHONY: all +all: $(TARGET) +$(TARGET): xcomp.fs $(STAGE) + cat xcomp.fs | $(STAGE) > $@ + +$(STAGE): + $(MAKE) -C $(EDIR) stage + +.PHONY: emul +emul: $(TARGET) + qemu-system-i386 -fda $(TARGET) diff --git a/recipes/pcat/README.md b/recipes/pcat/README.md new file mode 100644 index 0000000..9a7f992 --- /dev/null +++ b/recipes/pcat/README.md @@ -0,0 +1,3 @@ +# PC/AT recipe + +Work in progress. diff --git a/recipes/pcat/xcomp.fs b/recipes/pcat/xcomp.fs new file mode 100644 index 0000000..1b856d1 --- /dev/null +++ b/recipes/pcat/xcomp.fs @@ -0,0 +1,4 @@ +750 LOAD +811 LOAD +ORG @ 256 /MOD 2 PC! 2 PC! +H@ 256 /MOD 2 PC! 2 PC!