# top source file of Ha3sm. 

.	global/memory       	# IDT, BDA (BIOS data area) ...
.	global/event		# firstIRQ
.	global/macro		# wiperegs dismisso othersize


#    system init flow of control

# Canonical Wake-up Real Mode

			cell=2
. 16/PE0/floppyboot
IRQsoff

wiperegs

zero A                          # setGDT is DS-sensitive. GET ME OUTTA HERE!
= A to DS
setGDT IGDTRpointer		# in IPL, dual address of use16 far pointer
= 0xb800 to A
= A to DS

= 3476 to A
= A to @ 304			# happens

otheroperandsize		# Needs this. 
#				# There's junk in the high side of A?

zero A				# 1 to CR0, PE
1+  A
= A to CR0
jump 		hvfnvkfv
L 	hvfnvkfv

# Veal Mode

HL 
	ab 0xea
        ad use32CS
        ad 0x10	
L use32CS
			cell=4


. 32/init/kernelsegments
. 32/init/a20
. 32/init/megs
. global/PIC/init
. global/init/legvex



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

. 32/PE0/IDTinit				#	Forreal Mode

setIDT IDT32unPpointer


. global/flipPE		# Welcome to Forreal Mode
			# cell still 4
= 4 to A		# 32-bit schmegmented addressing demo
= A to ES		# proving we got PE = to 0.
= 9348539 to A
= A to @ $((0xb8a00))
ES
= A to @ $((0xb8a00))	



#call surprises
IRQson

L theloop
	= @ $((0xb8888)) to A
	1+ A
	= A to @ $((0xb8888))
	  submit 35
	nop
	nop
	nop
	nop
jump theloop

halt

#############################################################
	# outside main/init flow-of-control. Data and subroutines.

. global/init/makedescriptor
. global/init/IGDT		# initial, small, in IPL, pre-processes GDT
. global/NMI/routine		# nosurprises NMIoff/on  EISAsoftNMIenable

. global/soft/patternmove	#  patternfill spreadcopy
. global/soft/schmegment

. 32/init/installunP		
. 32/keypointer/routine		# sendHID HIDblinkenlightzen  enableaux
				# setscanset HIDmakebreakonly resetbox
				# auxscale2 auxresolution HICIRQSon

. 32/PE0/demoreflexes		# twitch32unP...
. 32/PE0/NMI/reflex		# ticksincrement32unP
. 32/PE0/keypointer/auxreflex	# auxreflex32unP
. 32/PE0/keypointer/reflex	# keyreflex32unP

. global/soft/text		# digit  spewage


L Cat
