
; Start of Basic tokens
	.segment	.memory
	.memory
	.org	h'0400

i.:	.rs	1
char.:	.rs	1
choice.:	.rs	1
value.:	.rs	1
matches.:	.rs	1
; Compiled basic program: example

	.code
	.org	h'0000

start:

	lcall	basint	; call any initialization code
.L10:

.L20:

.L30:

.L40:

.L50:

.L60:
	mov	a,#9
	lcall	print
	mov	a,#77
	lcall	print
	mov	a,#65
	lcall	print
	mov	a,#84
	lcall	print
	mov	a,#67
	lcall	print
	mov	a,#72
	lcall	print
	mov	a,#32
	lcall	print
	mov	a,#71
	lcall	print
	mov	a,#65
	lcall	print
	mov	a,#77
	lcall	print
	mov	a,#69
	lcall	print
	mov	a,#10
	lcall	print
	mov	a,#13
	lcall	print
.L70:
	mov	a,#26
	mov	dptr,#matches.
	movx	@dptr,a
.L80:
	mov	a,#32
	lcall	print
	mov	a,#110
	lcall	print
	mov	a,#117
	lcall	print
	mov	a,#109
	lcall	print
	mov	a,#98
	lcall	print
	mov	a,#101
	lcall	print
	mov	a,#114
	lcall	print
	mov	a,#32
	lcall	print
	mov	a,#111
	lcall	print
	mov	a,#102
	lcall	print
	mov	a,#32
	lcall	print
	mov	a,#109
	lcall	print
	mov	a,#97
	lcall	print
	mov	a,#116
	lcall	print
	mov	a,#99
	lcall	print
	mov	a,#104
	lcall	print
	mov	a,#101
	lcall	print
	mov	a,#115
	lcall	print
	mov	a,#32
	lcall	print
	mov	a,#114
	lcall	print
	mov	a,#101
	lcall	print
	mov	a,#109
	lcall	print
	mov	a,#97
	lcall	print
	mov	a,#105
	lcall	print
	mov	a,#110
	lcall	print
	mov	a,#105
	lcall	print
	mov	a,#110
	lcall	print
	mov	a,#103
	lcall	print
	mov	a,#58
	lcall	print
	mov	a,#32
	lcall	print
.L90:
	mov	dptr,#matches.
	movx	a,@dptr
	mov	dptr,#value.
	movx	@dptr,a
.L100:
	lcall	.L1000
.L110:
	mov	a,#32
	lcall	print
	mov	a,#101
	lcall	print
	mov	a,#110
	lcall	print
	mov	a,#116
	lcall	print
	mov	a,#101
	lcall	print
	mov	a,#114
	lcall	print
	mov	a,#32
	lcall	print
	mov	a,#49
	lcall	print
	mov	a,#45
	lcall	print
	mov	a,#52
	lcall	print
	mov	a,#58
	lcall	print
	mov	a,#32
	lcall	print
.L120:
	lcall	.L900
.L130:
	mov	dptr,#value.
	movx	a,@dptr
	mov	dptr,#choice.
	movx	@dptr,a
.L140:
	mov	dptr,#choice.
	movx	a,@dptr
	push	acc 
	mov	a,#4
	push	acc
	pop	b
	pop	acc
	clr	c
	subb	a,b
	jz	.C0000
	mov	c,210
	mov	247,c
	xrl	a,b
	anl	a,#128
	jnz	.C0000
	ljmp	.L110
.C0000:
.L150:
	mov	dptr,#choice.
	movx	a,@dptr
	push	acc 
	mov	a,#1
	push	acc
	pop	b
	pop	acc
	clr	c
	subb	a,b
	mov	c,210
	mov	247,c
	xrl	a,b
	anl	a,#128
	jz	.C0001
	ljmp	.L110
.C0001:
.L160:
	mov	dptr,#matches.
	movx	a,@dptr
	push	acc 
	mov	dptr,#choice.
	movx	a,@dptr
	push	acc 
	pop	b
	pop	acc
	clr	c
	subb	a,b
	mov	dptr,#matches.
	movx	@dptr,a
.L170:
	mov	dptr,#matches.
	movx	a,@dptr
	push	acc 
	mov	a,#0
	push	acc
	pop	b
	pop	acc
	subb	a,b
	jnz	.C0002
	ljmp	.L230
.C0002:
.L175:
	mov	dptr,#matches.
	movx	a,@dptr
	push	acc 
	mov	a,#0
	push	acc
	pop	b
	pop	acc
	clr	c
	subb	a,b
	mov	c,210
	mov	247,c
	xrl	a,b
	anl	a,#128
	jz	.C0003
	ljmp	.L230
.C0003:
.L180:
	mov	a,#32
	lcall	print
	mov	a,#73
	lcall	print
	mov	a,#39
	lcall	print
	mov	a,#108
	lcall	print
	mov	a,#108
	lcall	print
	mov	a,#32
	lcall	print
	mov	a,#116
	lcall	print
	mov	a,#97
	lcall	print
	mov	a,#107
	lcall	print
	mov	a,#101
	lcall	print
	mov	a,#58
	lcall	print
	mov	a,#32
	lcall	print
.L190:
	mov	a,#5
	push	acc
	mov	dptr,#choice.
	movx	a,@dptr
	push	acc 
	pop	b
	pop	acc
	clr	c
	subb	a,b
	mov	dptr,#value.
	movx	@dptr,a
.L200:
	mov	dptr,#matches.
	movx	a,@dptr
	push	acc 
	mov	dptr,#value.
	movx	a,@dptr
	push	acc 
	pop	b
	pop	acc
	clr	c
	subb	a,b
	mov	dptr,#matches.
	movx	@dptr,a
.L210:
	lcall	.L1000
.L220:
	ljmp	.L80
.L230:
	mov	a,#32
	lcall	print
	mov	a,#83
	lcall	print
	mov	a,#111
	lcall	print
	mov	a,#114
	lcall	print
	mov	a,#114
	lcall	print
	mov	a,#121
	lcall	print
	mov	a,#32
	lcall	print
	mov	a,#121
	lcall	print
	mov	a,#111
	lcall	print
	mov	a,#117
	lcall	print
	mov	a,#32
	lcall	print
	mov	a,#108
	lcall	print
	mov	a,#111
	lcall	print
	mov	a,#115
	lcall	print
	mov	a,#101
	lcall	print
	mov	a,#10
	lcall	print
	mov	a,#13
	lcall	print
.L240:
	ljmp	.L60
.L900:

.L905:
	mov	a,#0
	mov	dptr,#value.
	movx	@dptr,a
.L910:
	lcall	read
	mov	dptr,#char.
	movx	@dptr,a
.L912:
	mov	dptr,#char.
	movx	a,@dptr
	lcall	print
.L920:
	mov	dptr,#char.
	movx	a,@dptr
	push	acc 
	mov	a,#13
	push	acc
	pop	b
	pop	acc
	subb	a,b
	jnz	.C0004
	ljmp	.L950
.C0004:
.L930:
	mov	dptr,#value.
	movx	a,@dptr
	push	acc 
	mov	a,#10
	pop	b
	mul	ab
	push	acc
	mov	dptr,#char.
	movx	a,@dptr
	push	acc 
	mov	a,#48
	push	acc
	pop	b
	pop	acc
	clr	c
	subb	a,b
	pop	b
	add	a,b
	mov	dptr,#value.
	movx	@dptr,a
.L940:
	ljmp	.L910
.L945:

.L950:
	mov	a,#10
	lcall	print
	mov	a,#13
	lcall	print
.L960:
	ret
.L1000:

.L1005:

.L1010:
	mov	a,#0
	mov	dptr,#i.
	movx	@dptr,a
	mov	a,#2
	push	acc
.N0000:
.L1020:
	mov	a,#2
	push	acc
	mov	dptr,#i.
	movx	a,@dptr
	push	acc 
	mov	dptr,#value.
	movx	a,@dptr
	push	acc 
	mov	a,#10
	push	acc
	pop	b
	pop	acc
	div	ab
	push	b
	mov	a,#48
	pop	b
	add	a,b
	pop	dpl
	pop	dph
	movx	@dptr,a
.L1030:
	mov	dptr,#value.
	movx	a,@dptr
	push	acc 
	mov	a,#10
	push	acc
	pop	b
	pop	acc
	div	ab
	mov	dptr,#value.
	movx	@dptr,a
.L1040:
	mov	dptr,#i.
	movx	a,@dptr
	inc	a
	movx	@dptr,a
	pop	b
	clr	c
	subb	a,b
	jz	.C0005
	mov	c,210
	mov	247,c
	xrl	a,b
	anl	a,#128
	jz	.C0006
.C0005:
	push	b
	ljmp	.N0000
.C0006:
.L1045:

.L1050:
	mov	a,#0
	mov	dptr,#i.
	movx	@dptr,a
	mov	a,#2
	push	acc
.N0100:
.L1060:
	mov	a,#2
	push	acc
	mov	a,#2
	push	acc
	mov	dptr,#i.
	movx	a,@dptr
	push	acc 
	pop	b
	pop	acc
	clr	c
	subb	a,b
	push	acc
	pop	dpl
	pop	dph
	movx	a,@dptr
	lcall	print
.L1070:
	mov	dptr,#i.
	movx	a,@dptr
	inc	a
	movx	@dptr,a
	pop	b
	clr	c
	subb	a,b
	jz	.C0007
	mov	c,210
	mov	247,c
	xrl	a,b
	anl	a,#128
	jz	.C0008
.C0007:
	push	b
	ljmp	.N0100
.C0008:
.L1075:
	mov	a,#10
	lcall	print
	mov	a,#13
	lcall	print
.L1080:
	ret
.L2000:

	; ======= end of program =======
;
;	Example.lib - for use with BAS051
;		copyright (c) 1989 W. Washington
;
;

basint:				; initialization code
;
; place any additional initization code here
;
	mov	scon, #h'52	; initialize timer for baud rate
	mov	tmod, #h'20
	mov	th1, #-3	; set timer1 for 9600
	setb	tr1		; start timer1
	ret

print:				; output character in acc
	jnb	ti,print	; wait until tranmitter is availiable
	clr	ti		; clear transmitter ready flag
	mov	sbuf,a		; send character
	ret

read:				; input character in acc routine
	jnb	ri,read		; wait until receiver contains character
	clr	ri		; clear receiver flag
	mov	a,sbuf		; get character
	ret


	.end	start
