#########################      assembly-state preparations
			#  compembler-state only stuff, no binary output

. global/memory       	# IDT, BDA (BIOS data area) ring buffers...


#############################################################
		   # _start/main()-equivalent

. rmode/floppyboot
nosurprises

. boot/pmode
. boot/a20

= $((0xeff0)) to SP	# very small. Lets not recurse in ring0, eh?

. event/IDTinit
. event/IRQ/PICinit


zero A
= A to CR0

= 0x18193444 to A
L fmodeloop
	= A to @ $((0xb8800))
	1+ A
jump fmodeloop  


halt


halt


#############################################################
				# outside main(). data and subroutines.
. boot/selectormaker
. boot/iGDT
. event/IDTroutines		# install, makegate, unprepared, twitch


#############################################################
# Cat's tail. No actual compembly below here. Just pre-compembled binary 
#  data cat'ted on for the ride. 
	clump tail keycoordinates  608  font13 3328 mir 256 fuz 256
L Cat


echo "

Demo of Forreal Mode, 386 flat 32-bit unprotected mode. Set up a pmode
with big flat segment descriptors in effect, and turn off protection.

As I write this I haven't actually characterized what the 386 does with an
interrupt in such a configuration. What is quite clear at this point is
that the PE bit does not immediately effect the state of the segments
defined when the bit flips. If you flip it with a USE32 CS in effect the
following instructions USE 32.

Loading a segment register in rmode causes the segment to be used as an
8086-style 20-bit address base. That does not explain what happens to the
existing "invisible portion" of the segment register, the pmode segment
specifications. This becomes an issue for far transfers including
interrupts, which clobber CS. There is probably some combination of
effects of pmode segment specs and rmode segment shift. INTeL does imply
that the pmode segment limit remains in force, for example. The INTeL docs
are so concerned with how to run straight 8086 code that these details are
very ambiguous.

The GDT becomes irrelevant in rmode. How it left things does not. Rmode
events still use the IDT, but apparently do an 8086-style 2-bit shift of
the index/event number. 

" > /dev/null
