NEW
  AUTO 3,1
*--------------------------------------
* MsgBox(pTITLE, pBM, pTEXT, idButtons)
*--------------------------------------
MBOX.MsgBox		>LDYAI 360
				>STYA IE

				>LDYAI 70
				>STYA INE

				lda WND.Desktop+S.OBJ.W
				sec
				sbc IE
			and #$F8
				sta DX

				lda WND.Desktop+S.OBJ.W+1
				sbc IE+1
				lsr
				sta DX+1
				ror DX

				lda WND.Desktop+S.OBJ.H
				sec
				sbc INE
				sta DY
				lda WND.Desktop+S.OBJ.H+1
				sbc INE+1
				lsr
				sta DY+1
				ror DY

				>PUSHBI S.OBJ.F.BORDER+S.WND.F.MOVE+S.WND.F.CLOSE+S.WND.F.MODAL
				>PUSHW DX
				>PUSHW DY
				>PUSHW IE
				>PUSHW INE
				jsr WND.New
				bcs .9

				sta WND.hWND
				jsr OBJ.GetHWNDA		for childs later....

				ldy #S.WND.BGCOLOR
				lda #C.WHITE
				sta (ZPObjPtr),y

				ldy #6
				lda (pStack),y
				tax
				dey
				lda (pStack),y
				ldy #S.WND.pTITLE
				jsr OBJ.SetAXAtY

				ldy #4					pBM
				lda (pStack),y
				sta ZPBMPtr+1
				dey
				lda (pStack),y
				sta ZPBMPtr
			
				lda #16
				sta DX
				stz DX+1
				lda #20
				sta DY
				stz DY+1
				
				jsr BITMAP.New.I
				bcs .9

				ldy #2					pTEXT
				lda (pStack),y
				sta ZPPtr1+1
				dey
				lda (pStack),y
				sta ZPPtr1

				lda #60
				sta DX
*				stz DX+1
*				lda #30
*				sta DY
*				stz DY+1
				
				jsr LABEL.New.I
				bcs .9

				jsr MBOX.AddButtons
				bcs .9

.8				lda WND.hWND
				jsr WND.Show

.9				>POP 7
				rts
*--------------------------------------
MBOX.AddButtons	lda #360-5-60
				sta D
				lda /360-5-60
				sta D+1
				
				stz IY
			
.1				lda (pStack)
				beq .8
				
				lsr
				sta (pStack)
				bcc .7

				jsr MBOX.AddButton
				bcs .9

				lda D
				sec
				sbc #55
				sta D
				bcs .7
				
				dec D+1
				
.7				inc IY
				inc IY
				bra .1
				
.8				clc
.9				rts
*--------------------------------------
MBOX.AddButton	>PUSHB WND.hWND
				>PUSHBI 0				flags
				>PUSHWI 50				w
				>PUSHWZ					pIcon
				ldx IY
				>PUSHW L.BUT.Labels,x	pText
				>PUSHWZ					keymod/key
				>PUSHWZ					id
				>PUSHW D				X
				>PUSHWI 45				Y
				jmp BUT.New
*--------------------------------------
MAN
SAVE usr/src/lib/libgui.s.mbox
LOAD usr/src/lib/libgui.s
ASM
