NEW
  AUTO 3,1
*--------------------------------------
SYSBUT.Enter	sec
				ror WND.SYSBAR.bSysBut

				jsr GetCBBuf
				bcs .99

				jsr SYSBAR.ShowSysBut

				>LDYA L.WND.SysBar
				jsr DrawCBBufToYA

				>PUSHW WND.SysBar+S.OBJ.X1
				>PUSHW WND.SysBar+S.OBJ.Y1
				>PUSHW L.RECT.SysBut	Parent RECT
				>PUSHW L.MENU.Sys
				jsr MENU.New
.99				bcs .9

				sta hSysMenu

				>PUSHA					hSysMenu
				>PUSHBI 4
				>PUSHBI S.MITEM.pMENU
				>PUSHW L.MENU.Sys.Programs
				jsr MENU.SetMItemProp

				>PUSHB hSysMenu
				>PUSHBI 6
				>PUSHBI S.MITEM.pMENU
				>PUSHW L.MENU.Sys.Settings
				jsr MENU.SetMItemProp

				lda hSysMenu
				jsr MENU.Show

.8				clc
.9				rts
*--------------------------------------
SYSBUT.Leave	bit WND.SYSBAR.bSysBut
				bpl .8

				stz WND.SYSBAR.bSysBut

				jsr GetCBBuf
				bcs .9

				jsr SYSBAR.ShowSysBut

				>LDYA L.WND.SysBar

				jmp DrawCBBufToYA

.8				clc
.9				rts
*--------------------------------------
SYSBAR.Show		jsr GetCBBuf
				bcs .9

				jsr SYSBAR.ShowSysBut

				jsr SYSBAR.ShowSysWNDs

				jsr SYSBAR.ShowSysClk

				>LDYA L.WND.SysBar

				jmp DrawCBBufToYA

.9				rts
*--------------------------------------
SYSBAR.ShowSysBut
				lda #S.CB.CMD.FILLRECT
				jsr CB.InitCacheA

				lda #S.CB.OP.SET
				sta CB.Cache+S.CB.OP

				lda #S.CB.M.MONO
				sta CB.Cache+S.CB.M

				lda PREFS.SYSBARCOLOR
				bit WND.SysBar.bSysBut
				bpl .1

				eor #$ff

.1				sta CB.Cache+S.CB.COLOR

				ldx #S.RECT-1

.2				lda RECT.SysBut,x
				sta CB.Cache+S.CB.X1,x
				dex
				bpl .2

				jsr PutCBCache2CBBuf

				lda RECT.SysBut+S.RECT.X1
				clc
				adc #4
				sta DX
				lda RECT.SysBut+S.RECT.X1+1
				adc #0
				sta DX+1

				lda RECT.SysBut+S.RECT.Y1
				clc
				adc #1
				sta DY
				lda RECT.SysBut+S.RECT.Y1+1
				adc #0
				sta DY+1

				ldx #BM.ID.APPLE
				jsr DRAW.xBMAtDXDY

				lda RECT.SysBut+S.RECT.X1
				clc
				adc #21
				sta DX
				lda RECT.SysBut+S.RECT.X1+1
				adc #0
				sta DX+1

				inc DY
				bne .3

				inc DY+1

.3				lda WND.SysBar.bSysBut
				asl

				>LDYA L.WND.SysBar.2osX
				ldx hSYSFON
				jmp DRAW.YATextAtDXDY
*--------------------------------------
SYSBAR.ShowSysWNDs
				lda #S.CB.CMD.FILLRECT
				jsr CB.InitCacheA

				lda #S.CB.OP.SET
				sta CB.Cache+S.CB.OP

				lda #S.CB.M.MONO
				sta CB.Cache+S.CB.M

				lda PREFS.SYSBARCOLOR
				sta CB.Cache+S.CB.COLOR

				ldx #S.RECT-1

.1				lda RECT.SysWNDs,x
				sta CB.Cache+S.CB.X1,x
				dex
				bpl .1

				jmp PutCBCache2CBBuf
*--------------------------------------
SYSBAR.ShowSysClk
				lda #S.CB.CMD.FILLRECT
				jsr CB.InitCacheA

				lda #S.CB.OP.SET
				sta CB.Cache+S.CB.OP

				lda #S.CB.M.MONO
				sta CB.Cache+S.CB.M

				lda PREFS.SYSBARCOLOR
				sta CB.Cache+S.CB.COLOR

				ldx #S.RECT-1

.1				lda RECT.SysClk,x
				sta CB.Cache+S.CB.X1,x
				dex
				bpl .1

				jmp PutCBCache2CBBuf
*--------------------------------------
MAN
SAVE usr/src/lib/libgui.s.sysbar
LOAD usr/src/lib/libgui.s
ASM
