Path: utzoo!attcan!utgpu!watmath!clyde!att!chinet!ward From: ward@chinet.chi.il.us (Ward Christensen) Newsgroups: comp.sys.ibm.pc Subject: Re: assorted questions Message-ID: <7351@chinet.chi.il.us> Date: 2 Jan 89 16:11:57 GMT References: <5082@phoenix.Princeton.EDU> Reply-To: ward@chinet.chi.il.us (Ward Christensen) Organization: Chinet - Public Access Unix Lines: 55 In article <5082@phoenix.Princeton.EDU> jwbirdsa@phoenix.Princeton.EDU (James Webster Birdsall) writes: > 1) I need a sophisticated way to determine where the screen begins in >RAM. I have looked in the interrupt list recently posted and didn't find >anything that looked useful. For example, how does Turbo C (which makes >a point of doing direct screen writes for speed) do it? The folowing asm routine will find the screen base address by using an int 10 function to determine the screen mode. It also sets a SNOW flag if it finds a color board. NOTE that an EGA or VGA is not differentiated from a CGA. In the routine that uses this routine, I generally have a run-time flag for setting snow false. Note that mono "hangs" if you force snow to true, since the bit doesn't toggle: GetVideoMode proc near ;Function GetVideoMode:boolean; push bp mov bp,sp push es mov ah,0fh ;get video mode int 10h ; al = 7 => mono mov ah,1 ;snow := true; mov screen_base,0b800h ;Screen base addr if not mono cmp al,7 ;is it mono? jnz GetvRet mov ah,0 ;snow := false mov screen_base,0b000h ;set it to mono GetVRet: mov al,ah mov ah,0 ;set ax := snow pop es pop bp ret GetVideoMode endp > > 2) Saw this posted a while ago but can't find it again... what port >should I watch to avoid snow on the CGA? And am I right in believing >that this problem is limited to the CGA? here is the snow-check routine: MOV BX,AX ;Store video word in BX MOV AH,9 ;Move horizontal & vertical retrace mask into AH CLI ;Nointerrupts now WaitH: IN AL,DX ;Get 6845 status RCR AL,1 ;Wait for horizontal JC WaitH ; retrace WaitV: IN AL,DX ;Get 6845 status again AND AL,AH ;Wait for vertical JZ WaitV ; retrace MOV AX,BX ;Move word back to AX... STOSW ; and then to screen STI ;Allow interrupts! ---------------- This came from a FASTWRITE routine; can't seem to find original author's name (sorry!) I use this in a Turbo Pascal routine used by thousands of people across the country and have had no reports of problems or incompatabilities.