NEW
PREFIX
AUTO 4,1
				.LIST OFF
				.OP	65C02
				.OR	$2000
				.TF SBIN/GUI/GUI
*--------------------------------------
				.INB INC/IO.I
				.INB INC/MACROS.I
				.INB INC/A2OSX.I
				.INB INC/LIBGUI.I
*--------------------------------------
* Zero Page Segment, up to 32 bytes
*--------------------------------------
				.DUMMY
				.OR ZPBIN
ZS.START
* MyPtr			.BS 2
ZS.END
				.ED
*--------------------------------------
*			File Header (16 Bytes)
*--------------------------------------
CS.START		cld
				jmp (.1,x)
				.DA #$61				6502,Level 1 (65c02)
				.DA #1					BIN Layout Version 1
				.DA #S.PS.F.EVENT
				.DA #0
				.DA CS.END-CS.START		Code Size (without Constants)
				.DA DS.END-DS.START		Data SegmentSize
				.DA #64					Stack Size
				.DA #ZS.END-ZS.START	Zero Page Size
				.DA 0
*--------------------------------------
* Relocation Table
*--------------------------------------
.1				.DA CS.INIT
				.DA CS.RUN
				.DA CS.DOEVENT
				.DA	CS.QUIT
L.LIBGUI		.DA LIBGUI
L.MouseData		.DA MouseData
				.DA 0
*--------------------------------------
CS.INIT			>LDYA L.LIBGUI
				>SYSCALL LoadLib
				bcs .9
				sta hLIBGUI

*				clc	
.9				rts
*--------------------------------------
CS.RUN			>PUSHW L.MouseData
				>LIBCALL hLIBGUI,LIBGUI.ReadMouse
				bcs .4
				
				lda MouseData+S.MOUSE.S
				bit #S.MOUSE.S.MOVE
				beq .1

				>PUSHW L.MouseData
				>LIBCALL hLIBGUI,LIBGUI.SetCursorPos
				
				lda MouseData+S.MOUSE.S
				
.1				bit #S.MOUSE.S.CLK
				beq .4
				
				>LDA.G CUR.T
				inc
				inc
				cmp #CUR.T.WAIT+2
				bne .2

				lda #CUR.T.ARROW
				
.2				>STA.G CUR.T			
				>LIBCALL hLIBGUI,LIBGUI.SetCursor


				jsr Destop.Paint
				
.4
		
.8				clc
				rts	
*--------------------------------------
CS.DOEVENT		lda (pEvent)
				bpl .9
				asl
				bpl .9
				
				>LIBCALL hLIBGUI,LIBGUI.UpdateCursor
				
.9				sec
				rts
*--------------------------------------
CS.QUIT			clc
				rts
*--------------------------------------
Destop.Paint	>LIBCALL hLIBGUI,LIBGUI.HideCursor

*				>LIBCALL hLIBGUI,LIBGUI.GetScreenGC
*				>PUSHYA
*				>PUSHW L.CB.Paint
*				>LIBCALL hLIBGUI,LIBGUI.Draw

*				>LIBCALL hLIBGUI,LIBGUI.GetScreenGC
*				>PUSHYA

*				>PUSHW L.GC.Clip
				
*				>PUSHW L.CB.Marylin
*				>LIBCALL hLIBGUI,LIBGUI.Draw
			
				>LIBCALL hLIBGUI,LIBGUI.ShowCursor
				rts				
*--------------------------------------
CS.END
LIBGUI			.AZ "libgui"
hLIBGUI			.BS 1
*--------------------------------------
MouseData		.BS S.MOUSE
*--------------------------------------
				.DUMMY
				.OR 0
DS.START
CUR.T			.BS 1
DS.END
				.ED
MAN
SAVE USR/SRC/SBIN/GUI.S
ASM
