NEW
  AUTO 3,1
				.LIST OFF
*--------------------------------------
KW.ADDINT
KW.APPEND
KW.BYTE
KW.CLEAR
KW.CLOCK
KW.CLOSE
KW.COPY
KW.CREATE
KW.ECHO
KW.EDIT
				lda #E.CSYN
				sec
				rts
*--------------------------------------
*KW.END
KW.FILL
KW.FLAG
KW.FOR
KW.FREE
KW.GET
				lda #E.CSYN
				sec
				rts
*--------------------------------------
KW.GOSUB		lda #$20				JSR abs
				bra KW.GOTO1
*--------------------------------------
KW.GOTO			lda #$4C				JMP abs

KW.GOTO1		jsr CODE.EmitByte
				jsr CORE.GetNextCharNB
				bcs .90
				
				jsr CORE.GetLabel
				bcc .1

				jsr CORE.AddFWRef
				bcs .99

.1				lda ZPADDR
				jsr CODE.EmitByte
				lda ZPADDR+1
				clc
				jmp CODE.EmitByte

.90				lda #E.CSYN

.99				rts
*--------------------------------------
KW.HOME
				lda #E.CSYN
				sec
				rts
*--------------------------------------
* IP exp THEN st1 ELSE st2 
*--------------------------------------
KW.IF			jsr EXP.Eval

				bcs .99
				
				lda EXP.TYPE
				bne .91

				ldx #0

.1				lda CCODE.TESTTRUE,x
				jsr CODE.EmitByte
				inx
				cpx #CCODE.TESTTRUE.LEN
				bne .1

				lda	#$4C				JMP abs
				jsr CODE.EmitByte

				ldy pCCS

				dey
				lda ZPCodeBufPtr+1
				sta (pData),y

				dey
				lda ZPCodeBufPtr
				sta (pData),y

				dey
				lda #KWID.IF
				sta (pData),y

				sty pCCS
				
				lda ZPCodeBufPtr
				clc
				adc #2
				sta ZPCodeBufPtr
				bcc .8
				
				inc ZPCodeBufPtr+1

.8				clc
				rts
				
.90				lda #E.CSYN
				sec
				rts

.91				lda #E.TMISMATCH
				sec
.99				rts	
*--------------------------------------
KW.ENDIF		sec
				.HS 90					BCC
*--------------------------------------
KW.ELSE			clc

				ldy pCCS
				lda (pData),y
				eor #KWID.IF
				bne .9

				iny
				lda (pData),y
				sta ZPPtr1
				
				iny
				lda (pData),y
				sta ZPPtr1+1			ZPPtr1 = JMP if FALSE

				bcs .5					ENDIF

				lda	#$4C				JMP abs
				jsr CODE.EmitByte
			
				ldy pCCS
				iny
				
				lda ZPCodeBufPtr
				sta (pData),y
				iny
				lda ZPCodeBufPtr+1
				sta (pData),y				
				
				lda ZPCodeBufPtr
				clc
				adc #2
				sta ZPCodeBufPtr
				bcc .1
				
				inc ZPCodeBufPtr+1

.1				lda ZPCodeBufPtr
				sta (ZPPtr1)

				lda ZPCodeBufPtr+1
				ldy #1
				sta (ZPPtr1),y

				clc
				rts

.5				lda ZPCodeBufPtr
				sta (ZPPtr1)
				
				ldy #1
				lda ZPCodeBufPtr+1
				sta (ZPPtr1),y

				lda pCCS
				clc
				adc #3
				sta pCCS

				clc
				rts

.9				lda #E.NOIF
				sec
				rts
*--------------------------------------
KW.INFO
KW.INPUT
KW.KILL
KW.LINK
KW.LOG
KW.MARK
KW.MODEM
KW.MOVE
KW.MSG
KW.NEXT
KW.NIBBLE
KW.NOT
KW.ON
KW.NOCAR
				lda #E.CSYN
				sec
				rts
*--------------------------------------
KW.OPEN
				lda #E.CSYN
				sec
				rts
*--------------------------------------
KW.POKE
KW.POP
KW.POSITION
				lda #E.CSYN
				sec
				rts
*--------------------------------------
KW.PRINT		stz hOut				reset to hStdOut

				stz ZPPtr2				put ending CR 
				
				ldy #S.PS.hStdOut
				lda (pPS),y
				sta hOut				Default to screen

.10				jsr CORE.GetNextCharNB
				bcs .8
				
.11				jsr CORE.IsEndInst
				bcs .8
				
				jsr CORE.IsKW
				bcc .8

				stz ZPPtr2				put ending CR 

				jsr EXP.Eval
				bcs .99

				lda EXP.TYPE
				beq .6
				
				jsr CODE.FPRINTSTR
				
				bra .7

.6				jsr CODE.FPRINTINT
*--------------------------------------
.7				jsr CORE.GetCharNB
				bcs .8

.70				jsr CORE.IsEndInst
				bcs .8

				jsr CORE.IsKW
				bcc .8

				lda (ZPInputBufPtr)
				cmp #','
				bne .71

				tax
				jsr CODE.PutChar
			
				bra .10					go skip
				
.71				cmp #';'
				bne .90

				ror ZPPtr2				suppress ending CR

				jsr CORE.GetNextCharNB	skip ;
				bcc .11

.8				bit ZPPtr2
				bmi .80
				
				jsr CODE.FPRINTCRLF
				
.80				clc
				rts
				
.90				lda #E.CSYN
				sec
.99				rts
*--------------------------------------
KW.PUBLIC
KW.PUSH
KW.RAM
KW.RAM2
KW.READ
KW.READY
				lda #E.CSYN
				sec
				rts
*--------------------------------------
KW.RETURN
* TODO : check context

KW.END			lda #$60				RTS
				
				clc
				jmp CODE.EmitByte
*--------------------------------------
KW.REWIND
KW.RIPCO
KW.SET
KW.SETINT
KW.TEXT
				lda #E.CSYN
				sec
				rts
*--------------------------------------
KW.THEN			ldy pCCS
				lda (pData),y
				eor #KWID.IF
				bne .9
				
				clc
				rts
				
.9				lda #E.NOIF
				sec
				rts
*--------------------------------------
KW.TONE
KW.UPDATE
KW.USE
KW.WHENd
KW.WRITE
				lda #E.CSYN
				sec
				rts
*--------------------------------------
MAN
SAVE usr/src/bin/acos.s.kw
LOAD usr/src/bin/acos.s
ASM
