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

; change screen columns on most systems

include	model.inc

public	screen_columns
extrn	set_screen_dimensions:near
extrn	htext:near, hram8043:near, hram9025:near, hram9043:near
extrn	cursoroff:near, getcrt:near, pickstr:near
extrn	get_screen_data:near

include	dataseg.inc
extrn	rows:word, columns:byte

coldata	dw 40
	dw 80
	dw 132

herc_dispatch	dd hram8043
		dd hram9043
		dd htext
		dd hram9025

hercmsg	db '80 columns',0
	db '90 columns',0
	db 0
ega_msg	db '40 columns',0
evmono	db '80 columns',0
ega132	db '132 columns',0
	db 0
egamono	dw 0
@curseg	ends

include	codeseg.inc
screen_columns	proc	near
	push	word ptr ega132
	call	cursoroff
	call	getcrt
	mov	byte ptr egamono,ah
	xor	ebx,ebx
	mov	dx,0707h
	cmp	al,0FFh		; CGA?
	je	short cga
	cmp	al,128		; RamFont?
	ja	short herc
	cmp	al,1
	je	short evga
	cmp	al,3
	je	short evga
;	cmp	ax,0100h
;	jne	short exit
; EGA monochrome OK if Everex
;	lea	si,evmono
;	cmp	ax,0102h	; is it everex?
;	jne	short exit
jmp	short exit
;	inc	egamono
;	jmp	short ev1
evga:
	lea	esi,ega_msg
ev1:	mov	ebx,1
	call	pickstr
	cmp	al,27
	je	short exit
	add	bx,egamono
	mov	bx,coldata[ebx*2]
	mov	ax,rows
	add	ax,2
	call	set_screen_dimensions
	jmp	short screen_data

cga:	mov	ega132,0	; disable 132-column display
	jmp	short evga
	
herc:	lea	esi,hercmsg
	call	pickstr
	cmp	ax,27
	je	short exit
;	shl	ebx,2
	cmp	rows,40
	sbb	eax,eax		; AX = 0FFFFh if 25 rows
	and	eax,8
;	add	ebx,eax
	call	herc_dispatch[eax+ebx*4]

screen_data:
	call	get_screen_data
exit:
	pop	word ptr ega132
	clc
	ret
screen_columns	endp

@curseg	ends
	end
[ RETURN TO DIRECTORY ]