NEW
  AUTO 3,1
				.LIST OFF
*--------------------------------------
* RADIO.New hParent,X1,Y1,HK,EV,pList,pVar,F	10
*--------------------------------------
RADIO.New		lda #S.OBJ.T.RADIO
				jsr OBJ.Create
				bcs .9

				>PULLA
				ldy #S.OBJ.F
				sta (ZPObjPtr),y

				ldy #S.OBJ.pVar
				jsr OBJ.PullWordY

				ldy #S.OBJ.pBuf
				jsr OBJ.PullWordY
				stx ZPPtr1
				sta ZPPtr1+1

				>PULLA
				ldy #S.RADIO.EV
				sta (ZPObjPtr),y

				>PULLA
				ldy #S.RADIO.HotKey
				sta (ZPObjPtr),y

				ldx #0

.1				jsr OBJ.NextLinePtr1
				bcs .5					empty line

				tya
*				clc
				adc #5					room for " ( ) "
				ldy #S.OBJ.W
				cmp (ZPObjPtr),y
				bcc .4

				sta (ZPObjPtr),y

.4				inx

				lda (ZPPtr1)
				bne .1

.5				ldy #S.OBJ.H
				txa
				sta (ZPObjPtr),y

				jsr OBJ.PullY1X1hParent

				jsr CONT.Insert
				bcs .9
				
				lda hObj
*				clc
				rts

.9				>POP 10

				rts
*--------------------------------------
RADIO.Run		ldy #S.OBJ.S
				lda (ZPObjPtr),y
				bpl .9
				
				lda (pStack)			Event
				
				cmp #C.SPACE
				bne .2

				jsr OBJ.GetpVarPtr2

				ldy #S.RADIO.Idx
				lda (ZPObjPtr),y
				sta (ZPPtr2)

				jsr .7
				
				ldy #S.BUT.EV
				lda (ZPObjPtr),y
*				clc				
				rts

.2				cmp #C.LF
				bne .5

				ldy #S.RADIO.Idx
				lda (ZPObjPtr),y
				inc
				ldy #S.OBJ.InnerH
				cmp (ZPObjPtr),y
				bne .3

				lda #0

.3				ldy #S.RADIO.Idx
				sta (ZPObjPtr),y

				bra .7

.5				cmp #C.VT
				bne .9

				ldy #S.RADIO.Idx
				lda (ZPObjPtr),y
				bne .6

				ldy #S.OBJ.InnerH
				lda (ZPObjPtr),y

.6				dec

				ldy #S.RADIO.Idx
				sta (ZPObjPtr),y

.7				ldy #1					hObj
				lda (pStack),y
				>PUSHA

				jsr OBJ.Draw.Body

				inc pStack

.8				clc
				rts

.9				lda #0
				sec
				rts
*--------------------------------------
RADIO.Draw		lda (pStack)			Relative Y
				tax

				jsr OBJ.GetLineXAtY
				bcs .8

				jsr OBJ.GetpVarPtr2

				clc
				ldx #'('

				ldy #S.OBJ.S
				lda (ZPObjPtr),y
				bpl .10

				ldy #S.RADIO.Idx
				lda (ZPObjPtr),y
				eor (pStack)			Relative Y
				bne .10

				ldx #'['
				sec

.10				php
				txa
				jsr LB.COut

				lda (pStack)
				cmp (ZPPtr2)
				bne .11

				lda #C.SO
				jsr LB.COut
				
				lda #'`'
				jsr LB.COut

				lda #C.SI
				bra .13

.11				lda #C.SPACE

.13				jsr LB.COut

				ldx #')'

				plp
				bcc .12

				ldx #']'

.12				txa
				jsr LB.COut

				lda #C.SPACE
				jsr LB.COut

.1				ldy #S.OBJ.InnerW
				lda (ZPObjPtr),y
				tax

				dex
				dex
				dex
				dex

				jsr LB.Ptr1OutEscMaxX

.3				txa
				beq .8

				lda #C.SPACE

.7				jsr LB.COut
				dex
				bne .7

.8				clc
				rts
*--------------------------------------
MAN
SAVE usr/src/lib/libtui.s.radio
LOAD usr/src/lib/libtui.s
ASM
