From 1a467efae1f8adbbfa51425d5399bb8ae18b8222 Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Sat, 13 Jun 2020 20:06:51 -0400 Subject: [PATCH] pcat: use a far jump to boot into the OS Unless I misunderstood, this is supposed to set CS. This would make all SREG have the same value. This allows us to remove BIN( offset from os.bin. I've tried booting to offset 0, but it didn't seem to work. Let's settle for 0x8000. 512kb of system RAM is way more than we need anyways. --- blk/753 | 3 ++- blk/811 | 6 +++--- blk/812 | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/blk/753 b/blk/753 index 3d94270..69ac38b 100644 --- a/blk/753 +++ b/blk/753 @@ -1,12 +1,13 @@ : 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 ) +( no argument, jumps with relative 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, ; : INT, 0xcd A, A, ; : JMPr, 0xff A, 7 AND 0xe0 OR A, ; +: JMPf, ( seg off ) 0xea A, SPLITB A, A, SPLITB A, A, ; : OPrr CREATE C, DOES> C@ A, 3 LSHIFT OR 0xc0 OR A, ; 0x31 OPrr XORxx, 0x08 OPrr ORrr, diff --git a/blk/811 b/blk/811 index 9007b24..d6a1af9 100644 --- a/blk/811 +++ b/blk/811 @@ -2,9 +2,9 @@ H@ ORG ! 0x7c00 BIN( ! ( BIOS loads boot bin at 0x7c00 ) JMPs, L1 FWRs ( start ) ORG @ 0x25 + HERE ! ( bypass BPB ) L1 FSET ( start ) -CLI, CLD, AX AX XORxx, DS AX MOVsx, ES AX MOVsx, +CLI, CLD, AX 0x800 MOVxi, 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, +BX 0 MOVxi, 0x13 INT, ( read 2nd sector of boot floppy ) +0x800 0 JMPf, ORG @ 0x1fe + HERE ! 0x55 A, 0xaa A, diff --git a/blk/812 b/blk/812 index a109fef..6c028e2 100644 --- a/blk/812 +++ b/blk/812 @@ -1,4 +1,4 @@ -H@ ORG ! 0x8000 BIN( ! +H@ ORG ! JMPs, L1 FWRs ( start ) L2 ( msg ) BSET ," Hello World!" 0 A, L1 FSET ( start )