;
;SCROLLER.ASM
;
;PROGRAM TO PROVIDE FLICKER-FREE SCROLLING
;
;Make runnable with MASM, LINK, EXE2BIN.
;
CSEG	SEGMENT
	ASSUME	CS:CSEG
;
	ORG	100H
START	PROC	NEAR
	JMP	MAKERES
OLD_INT10	DD	?
;
SCROLL_FRONT_END:
	CMP	AX,0E0AH
	JNZ	PASS_TO_BIOS
	PUSH	AX
	PUSH	BX
	MOV	AH,0FH
	INT	10H
	CMP	AL,2
	JZ	CHECK_ROW
	CMP	AL,3
	JNZ	PASS_TO_BIOS2
CHECK_ROW:
	PUSH	CX
	PUSH	DX
	MOV	AH,3
	INT	10H
	CMP	DH,24
	JNZ	PASS_TO_BIOS3
	PUSH	DS
	PUSH	ES
	PUSH	SI
	PUSH	DI
	MOV	AH,0FH
	INT	10H
	MOV	AL,AH
	SUB	AH,AH
	PUSH	AX
	MOV	SI,AX
	SHL	SI,1
	MOV	AH,24
	MUL	AH
	MOV	CX,AX
	SUB	AX,AX
	MOV	DS,AX
	MOV	AL,BH
	MUL	WORD PTR DS:[44CH] ;OFFSET OF START OF CURRENT PAGE
	ADD	SI,AX
;
;START COLUMN 2
;
	MOV	DI,AX
	MOV	AX,0B800H
	MOV	DS,AX
	MOV	ES,AX
	CLD
    REP	MOVSW
	MOV	AH,8
	INT	10H
	MOV	AL,' '
	POP	CX
    REP	STOSW
	POP	DI
	POP	SI
	POP	ES
	POP	DS
	POP	DX
	POP	CX
	POP	BX
	POP	AX
	IRET
PASS_TO_BIOS3:
	POP	DX
	POP	CX
PASS_TO_BIOS2:
	POP	BX
	POP	AX
PASS_TO_BIOS:
	JMP	CS:[OLD_INT10]
ENDRES:
;
;MAKE SCROLL FRONT END
;
MAKERES:
	PUSH	CS
	POP	DS
	ASSUME	DS:CSEG
	MOV	AX,3510H
	INT	21H
	MOV	WORD PTR [OLD_INT10],BX
	MOV	WORD PTR [OLD_INT10+2],ES
	MOV	AX,2510H
	MOV	DX,OFFSET SCROLL_FRONT_END
	INT	21H
	MOV	DX,OFFSET ENDRES
	MOV	CL,4
	SHR	DX,CL
	INC	DX
	MOV	AX,3100H
	INT	21H
START	ENDP
CSEG	ENDS
	END	START
