;
;	PALO ALTO TINY BASIC
;
;	Convert to CP/M by H.Tokumaru (Ockeghem)
;
ITOP	EQU	0100H
BDOS	EQU	0005H
;
; ISIZE	EQU	0800H
; LTOP	EQU	1000H
;
VTOP	EQU	0F800H
LBUF	EQU	VTOP+0037H
LBFSZ	EQU	80
MSTK	EQU	LBUF+LBFSZ
TMSTK	EQU	MSTK+30
STACK	EQU	0FF00H
;
PROMPT	EQU	'>'
RUBOUT	EQU	7FH
BS	EQU	08H
;
TST	MACRO	STR,ADRS
	CALL	TEST
	DB	STR
	DB	ADRS-$-1
	ENDM
CASE	MACRO	STR,ADRS
	DB	STR
	DB	(ADRS SHR 8)+80H
	DB	ADRS AND 0FFH
	ENDM
ENDC	MACRO	ADRS
	DB	(ADRS+8000H) SHR 8
	DB	ADRS AND 0FFH
	ENDM
PUSHA	MACRO
	PUSH	PSW
	PUSHR
	ENDM
POPA	MACRO
	POPR
	POP	PSW
	ENDM
PUSHR	MACRO
	PUSH	B
	PUSH	D
	PUSH	H
	ENDM
POPR	MACRO
	POP	H
	POP	D
	POP	B	
	ENDM
;
	ORG	ITOP
ENTRY:	
START:	MVI	A, 0FFH
	STA	OMASK
	LXI	SP, STACK
	CALL	CRLF
	LXI	D, OKMES
	SUB	A
	CALL	MSG
	LXI	H, $ + 7
	SHLD	CLABL
	LXI	H, 0000H
	SHLD	FCNTR
	SHLD	RSTCK
;
EDITR:	MVI	A, PROMPT
	CALL	GETL
	PUSH	D
	LXI	D, LBUF
	CALL	GINT
	CALL	SKPBL
	MOV	A, H
	ORA	L
	POP	B
	JZ	KWCPR
INSRT:	DCX	D
	MOV	A, H
	STAX	D
	DCX	D
	MOV	A, L
	STAX	D
	PUSH	B
	PUSH	D
	MOV	A, C
	SUB	E
	PUSH	PSW
	CALL	SRCH
	PUSH	D
	JNZ	MOVE
	PUSH	D
	CALL	SKIPL
	POP	B
	LHLD	OBTM
	CALL	TRNSF
	MOV	H, B
	MOV	L, C
	SHLD	OBTM
MOVE:	POP	B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OMASK
	CMA
	STA	OMASK
	JMP	GET2
TTYI2:	CPI	03H
	JZ	START
NOCHR:	POPR
	RET
OBTM:	DW	OTOP
OMASK:	DS	0001H
CLABL:	DS	0002H
RSTCK:	DS	0002H
NCNTR:	DS	0002H
FCNTR:	DS	0002H
FSTPV:	DS	0002H
FTOV:	DS	0002H
FLABL:	DS	0002H
FOBJ:	DS	0002H
RWRK:	DS	0002H
OTOP:	DS	0001H
	END
