NEW
PREFIX
AUTO 4,1
*--------------------------------------
WND.Init		>PUSHBI 0
				>LDYA L.DEVNAME.GFX
				>SYSCALL2 open
				bcs .9
				
				sta SCR+S.SCREEN.hDEV
				
				>LDYA L.DCB.GFX
				>STYA IOCTL+S.IOCTL.BUFPTR
				lda #S.IOCTL.STATCODE.GETDCB
				sta IOCTL+S.IOCTL.STATCODE
				
				>PUSHW L.IOCTL
				>PUSHBI IOCTL.STATUS
				lda SCR+S.SCREEN.hDEV
				>SYSCALL2 IOCTL
				
.9				rts				
*--------------------------------------
WND.Setup		>LDYA DCB.GFX+S.DCB.GFX.W
				>STYA SCR+S.OBJ.W
				>STYA WND.Desktop+S.OBJ.W
				>STYA WND.SysBar+S.OBJ.W
				
				lda SYSFON.H
				clc
				adc #6
				sta WND.SysBar+S.OBJ.H
				
				lda DCB.GFX+S.DCB.GFX.H
				sta SCR+S.OBJ.H
				sec
				sbc WND.SysBar+S.OBJ.H
				sta WND.Desktop+S.OBJ.H
				sta WND.SysBar+S.OBJ.X1
				
				lda DCB.GFX+S.DCB.GFX.H+1
				sta WND.SysBar+S.OBJ.H+1
				sbc #0
				sta WND.Desktop+S.OBJ.H+1
				sta WND.SysBar+S.OBJ.X1+1
							
				>LDYA L.SCR
				jsr OBJ.SetX2Y2
				
				>LDYA L.WND.Desktop
				>STYA SCR.Childs
				jsr OBJ.SetX2Y2
				
				>LDYA L.WND.SysBar
				jsr OBJ.SetX2Y2
				>STYA SCR.Childs+2
								
				>LDYA L.WND.Desktop
								
				lda #CUR.T.ARROW
				sta WND.Desktop+S.WND.hCUR
				sta WND.SysBar+S.WND.hCUR
				rts
*--------------------------------------
WND.Quit		lda SCR+S.SCREEN.hDEV
				beq .8
				
				pha
				>PUSHBI IOCTL.CLOSE
				>PUSHWZ
				pla
				>SYSCALL2 IOCTL

.8				
				clc
				rts
*--------------------------------------
WND.New			>STYA ZPPtr1

				>LDYAI S.WND
				>SYSCALL2 getmem
				bcs .9
				
				>STYA ZPWNDPtr
				
				ldy #S.WND-1
				
.1				lda (ZPPtr1),y
				sta (ZPWNDPtr),y
				dey
				bpl .1
				
.9				rts				
*--------------------------------------
WND.Paint		>STYA ZPPtr1

				clc
				rts
*--------------------------------------
WND.Close		clc
				rts
*--------------------------------------
MAN
SAVE USR/SRC/LIB/LIBGUI.S.WND
LOAD USR/SRC/LIB/LIBGUI.S
ASM
