**************************************************************************
*
* User-Toolset shell for Apple IIgs pixelMap2Rgn code
*
* David A. Lyons
*
* Developer Technical Support Apple II Sample Code
*
* v3.0    20-Apr-90 DAL
*
**************************************************************************
*
* How to build this thing:
*    asmiigs pixelmap2rgn.aii
*    asmiigs pmusertool.aii
*    linkiigs pmusertool.aii.obj pixelmap2rgn.aii.obj -o pixMapTool -t $ba
*
**************************************************************************
	case on

Version	equ $0100	;v1.0

pmUserTool	proc

	import pixelMap2Rgn, newPort, killPort

ptrTable	dc.l (ptrTableEnd-ptrTable)/4
	dc.l fNoError-1		;$01xx BootInit
	dc.l fNoError-1		;$02xx StartUp
	dc.l fNoError-1		;$03xx ShutDown
	dc.l fVersion-1		;$04xx Version
	dc.l fNoError-1		;$05xx Reset
	dc.l fStatus-1		;$06xx Status
	dc.l fNoError-1		;$07xx reserved
	dc.l fNoError-1		;$08xx reserved
	dc.l fPixelMap2Rgn-1	;$09xx pixelMap2Rgn
	dc.l fNewPort-1		;$0Axx newPort
	dc.l fKillPort-1		;$0Axx killPort
ptrTableEnd
*
save6	lda >myStatus
	beq notStarted
	plx
	pla
	sta >temp
	pla
	sta >temp+2
	pla
	sta >temp+4
	phx
	rts

temp	ds.b 6

myStatus	ds.w 1

notStarted	pla	;discard return address
	txa
	xba
	and #$FF00
	ora #$8001
	sec
	rtl

fStartUp	lda #$FFFF
	bra startStop

fShutDown	lda #$0000
startStop	sta >myStatus
fNoError	lda #0
	clc
	rtl

fVersion	lda #Version
	sta 7,s
	bra fNoError

fStatus	lda >myStatus
	sta 7,s
	bra fNoError

********************

fPixelMap2Rgn	jsr save6
	jsl pixelMap2Rgn
	bra restore6	

fNewPort	jsr save6
	jsl newPort
	bra restore6	

fKillPort	jsr save6
	jsl killPort

restore6	tay	;This is here so everybody
	lda >temp+4	;can reach it.
	pha
	lda >temp+2
	pha
	lda >temp
	pha
	tya
	rtl

	endp

	END
