CODE	SEGMENT
	ASSUME	CS:CODE,DS:CODE,ES:CODE,SS:CODE
	ORG	100H
START:
	MOV	DI,OFFSET BUF
	CLD
	MOV	BP,0FFFEH
	XOR	BX,BX
	PUSH	BX
	MOV	CX,1
MAIN2:
	MOV	DX,120FH
MAIN1:
	DEC	DX
	JS	MAIN2
	MOV	SI,OFFSET STREND
	PUSH	SI
	PUSH	CX
	JPO	NEXTM
	MOV	CL,OFFSET BUF - OFFSET STREND
	JE	NEXT
	MOV	CL,(OFFSET BUF - OFFSET STREND) / 2
	ADD	SI,CX
	SHR	DH,1
	JC	NEXT
NEXTM:
	SUB	SI,CX
NEXT:
	REP	MOVSB
	CMP	DI,OFFSET BUF + 8192
	JB	NOFLS
FLUSH:
	PUSH	BX
	PUSH	DX
	MOV	DX,OFFSET BUF
	MOV	CX,DI
	SUB	CX,DX
	MOV	DI,DX
	MOV	BX,1
	MOV	AH,40H
OS:
	INT	21H
	POP	DX
	POP	BX
NOFLS:
	POP	CX
	MOV	AX,4C00H
	JCXZ	OS
	POP	SI
	MOV	AX,0A0DH
	STOSW
	DEC	BP
	JNE	NEXT1
	DEC	BX
	JE	FLUSH
NEXT1:
	DEC	SI
	INC	BYTE PTR [SI]
	CMP	BYTE PTR [SI],':'
	JB	MAIN1
	SUB	[SI],AH
	JPE	NEXT1
	INC	CX
	JMP	MAIN1
	DB	':::::::::1'
STREND	LABEL	BYTE
	DB	'FizzBuzz'
BUF	LABEL	BYTE
CODE	ENDS
	END	START
