NEW
  AUTO 3,1
*--------------------------------------
GP.START		.PH GP

GP.START1		jmp	GP.MLIENTRY			MLI Entry point
				jmp *					GP.DISPATCH : will be changed to point to dispatcher.
				rts						GP.CLOCK : changed to jmp ($4C) if clock present.
				.DA CLK						clock routine entry address.
				jmp XDOS.SysErr			GP.SYSERR : error reporting hook.
				jmp XDOS.SysDeath		GP.SYSDEATH : system failure hook.
				.DA #0					GP.ERROR
				.DA XDOS.NoDevice		GP.DEVPTRS
				.DA XDOS.NoDevice
				.DA XDOS.NoDevice
				.DA XDOS.NoDevice
				.DA XDOS.NoDevice
				.DA XDOS.NoDevice
				.DA XDOS.NoDevice
				.DA XDOS.NoDevice
				.DA XDOS.NoDevice
				.DA XDOS.NoDevice
				.DA XDOS.NoDevice
				.DA XDOS.NoDevice
				.DA XDOS.NoDevice
				.DA XDOS.NoDevice
				.DA XDOS.NoDevice
				.DA XDOS.NoDevice
				.DA #0					GP.DEVNUM
				.DA #$ff				GP.DEVCNT : count (-1) active devices
				.HS 00000000000000		GP.DEVLST : up to 14 units may be active
				.HS 00000000000000
				.DA #0
*--------------------------------------
				.AS "(C)APPLE  "		10 bytes, used for VEDRIVE/VSDRIVE
*--------------------------------------
				php						GP.MLIENTRY
				sei
				bra GP.MLICONT
*--------------------------------------
GP.TOOLBOX		bit	IO.RRAMWRAMBNK1
				
				.DO AUXLC=1
				
				sta IO.SETALTZP
				
				.FIN
				
				jmp XDOS.TBX
*--------------------------------------
				.LIST ON
GP.FREE1		.EQ $BF58-*
				.LIST OFF
				.BS GP.FREE1
*--------------------------------------
* memory map of lower 48k. each bit represents 1 page.
* protected pages = 1, unprotected = 0
*--------------------------------------
				.HS C000000000000000	GP.MEMTABL
				.HS 0000000000000000
				.HS 0000000000000001
*--------------------------------------
* table of buffer addresses for currently open files.
* these can only be changed thru the mli call setbuf.
*--------------------------------------
				.HS 0000				GP.BUFTABL
				.HS 0000
				.HS 0000
				.HS 0000
				.HS 0000
				.HS 0000
				.HS 0000
				.HS 0000
*--------------------------------------
* table of interrupt vectors. these can only be changed
* by the mli call allocate_interrupt. values of the registers
* at the time of the most recent interrupt are stored here along
* with the address interrupted.
*--------------------------------------
GP.IRQVs		.HS 0000				int #1
				.HS 0000				int #2
				.HS 0000				int #3
				.HS 0000				int #4
*--------------------------------------
				.DO AUXLC=1

GP.TBXEXIT		sta IO.CLRALTZP
				sta IO.RROMBNK2
				rts
				
				.FIN

				.LIST ON
GP.FREE2		.EQ $BF90-*
				.LIST OFF
				.BS GP.FREE2
*--------------------------------------
				.HS 0000				GP.DATE
				.HS 0000				GP.TIME
				.DA #0					GP.FLEVEL : current file level
				.DA #0					GP.BUBIT : backup bit disable, setfileinfo only
				.DA #0					spare1: ProDOS 203 used to save acc
				.DA #0					GP.NEWPFXPTR : appletalk alternate prefix ptr
				.DA #0					GP.MACHID : machine ID byte
				.DA #0					GP.SLTBYT : slot ROM bit map
				.DA #0					GP.PFXPTR : prefix active flag
				.DA #0					GP.MLIACTV : MLI active flag
				.DO AUXLC=0
GP.MLIRTN  		.DA 0					MLI call return address
GP.MLIX			.DA #0					MLI X register savearea
GP.MLIY			.DA #0					MLI Y register savearea
				.ELSE
GP.MLIEXITX2	pha						MLI error
				lda GP.BNKBYT1
				.FIN
*--------------------------------------
* language card bank switching routines which must reside at $BFA0 because
* workstation software patches this area
*--------------------------------------
GP.MLIEXIT		eor $E000				test for rom enable
				beq .1	  				taken if ram enabled

				sta IO.RROMBNK2			read ROM
				bne .2	 				always

.1			  	lda GP.BNKBYT2			for alternate ram
				eor $D000				test
				beq .2					branch if not alternate ram

				lda IO.RRAMWRAMBNK2		else enable alt $D000

.2  			pla		 			 	return code

				rti		  				re-enable interrupts and return
*--------------------------------------
GP.MLICONT		.DO AUXLC=0
				
				sec
				ror GP.MLIACTV 			notify interrupt routines MLI active.
				lda $E000				preserve language card/rom orientation
				sta GP.BNKBYT1 			for proper restoration when mli exits.
				lda $D000
				sta GP.BNKBYT2
				lda IO.RRAMWRAMBNK1		force ram card on
				lda IO.RRAMWRAMBNK1		with write allowed
				jmp XDOS.MAIN
				
				.ELSE

				sty GP.MLIEXIT.Y+1

				pla						A = Status register

				ply
				sty GP.MLIEXIT.PCL+1
				ply
				sty GP.MLIEXIT.PCH+1

				ldy $E000		
				sty GP.BNKBYT1 	
				ldy $D000				Y = BNKBYT2

				sta IO.SETALTZP

				bit IO.RRAMWRAMBNK1
				jmp XDOS.AUX
*--------------------------------------
* A = Status register
* Y = MLI Error code
*--------------------------------------
GP.MLIEXITX		sta IO.CLRALTZP
				
GP.MLIEXIT.PCH	ldx #$FF				SELF MODIFIED
				phx
GP.MLIEXIT.PCL	ldx #$FF				SELF MODIFIED
				phx

				phy						S reg for RTI
				
GP.MLIEXIT.X	ldx #$FF				SELF MODIFIED
GP.MLIEXIT.Y	ldy #$FF				SELF MODIFIED
				bra GP.MLIEXITX2

GP.SELJMP		sta IO.CLRALTZP
				jmp $1000

				.FIN
*--------------------------------------
				.LIST ON
GP.FREE3		.EQ $BFEB-*
				.LIST OFF
				.BS GP.FREE3
*--------------------------------------
GP.IRQV			bit	IO.RRAMWRAMBNK1	   	***NEW ROM ONLY IRQ $fffe > $Cxxx space***
				bit	IO.RRAMWRAMBNK1		Entry used when rom/mainLC/auxLC
				jmp	IRQ
*--------------------------------------
GP.BNKBYT1		.DA #0
GP.BNKBYT2		.DA #0
				.HS 00000000			pad to before $BFFA
				.DA #4					gsos compatibility byte ($BFFA)
				.DA #0					pad
				.DA #0					reserved
				.DA #0					version # of running interpreter
				.DA #0					preserved for System Utilities
				.DA #KVER				GP.KVER : represents release 2.0.3
*--------------------------------------
				.EP
*--------------------------------------
GP.LEN			.EQ *-GP.START
*--------------------------------------
MAN
SAVE usr/src/prodos.fx/prodos.s.gp
LOAD usr/src/prodos.fx/prodos.s
ASM
