Metropoli BBS
VIEWER: top.asm MODE: TEXT (ASCII)
; TOP.ASM for E32 - Copyright (C) 1994 Douglas Herr
;  all rights reserved

include	model.inc

public	top

include	dataseg.inc
extrn	dirty_bits:byte, left_margin:word, save_column:byte
extrn	cursor:dword, top_of_screen:dword, cur_posn:word
extrn	file_row:dword, first_row:byte, saved_pos:word
extrn	display_mode:byte
@curseg	ends

include	codeseg.inc
;
; This moves the cursor to the top of the file
;
top	proc	near
	xor	eax,eax
	mov	cursor,eax	; cursor to start of buffer
	mov	top_of_screen,eax
	mov	left_margin,ax	; move to the far left margin
	mov	save_column,al	; save the cursor column
	dec	eax
	mov	saved_pos,ax	; reset row,col on top line
	neg	eax
	mov	file_row,eax
	or	dirty_bits,al	; redraw the screen
	dec	eax
	add	ah,first_row
	mov	al,display_mode
	shr	al,2		; AL = 1 if hex mode
	dec	al		; AL = 0 if hex mode
	not	al		; AL = 0FFh if hex mode
	and	al,10		; AL = 10 if hex mode, 0 if ASCII mode
	mov	cur_posn,ax	; home the cursor
	ret
top	endp

@curseg	ends
	end
[ RETURN TO DIRECTORY ]