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

				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				ldy #$ff
				
.2				iny
				lda (ZPPtr1),y
				clc
				beq .20
				
				cmp #C.CR
				bne .2

*				sec
				
.20				tya
				beq .5					empty line
				
				adc ZPPtr1
				sta ZPPtr1
				bcc .3

				inc ZPPtr1+1

.3				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 9

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

				ldy #S.OBJ.pVar
				lda (ZPObjPtr),y
				sta ZPPtr1
				iny
				lda (ZPObjPtr),y
				sta ZPPtr1+1

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

				bra .7

.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

				ldy #S.OBJ.pBuf
				jsr OBJ.GetLineXAtY
				bcs .8

				ldy #S.OBJ.pVar
				lda (ZPObjPtr),y
				sta ZPPtr2
				iny
				lda (ZPObjPtr),y
				sta ZPPtr2+1

				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
*--------------------------------------
RADIO.Activate
*--------------------------------------
RADIO.Deactivate
				jmp OBJ.Draw.Body
*--------------------------------------
MAN
SAVE usr/src/lib/libtui.s.radio
LOAD usr/src/lib/libtui.s
ASM
