jwbirdsa@phoenix.Princeton.EDU (James Webster Birdsall) (01/02/89)
Three questions: 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? 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? 3) Finally, could somebody send me a list of the control codes which a VT100/102 responds to? (i.e. the codes the host sends to it). Thanks a lot... ======================================================================== ! James W. Birdsall Compu$erve: 71261,1731 ! ! jwbirdsa@phoenix.Princeton.EDU jwbirdsa@bogey.Princeton.EDU ! ! jwbirdsa@pucc.BITNET ...allegra!princeton!phoenix!jwbirdsa! ======================================================================== ! During emergency landing, replace dinner tray and bring seat to ! ! upright position. Extinuish all smoking materials... including ! ! spacecraft, if possible. --Calvin ! ========================================================================
ward@chinet.chi.il.us (Ward Christensen) (01/03/89)
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.
andyross@igloo.UUCP (Andrew Rossmann) (01/03/89)
In article <5082@phoenix.Princeton.EDU> jwbirdsa@phoenix.Princeton.EDU (James Webster Birdsall) writes: > > Three questions: > > 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? > > 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? > > 3) Finally, could somebody send me a list of the control codes which >a VT100/102 responds to? (i.e. the codes the host sends to it). > > Thanks a lot... >======================================================================== >! James W. Birdsall Compu$erve: 71261,1731 ! >! jwbirdsa@phoenix.Princeton.EDU jwbirdsa@bogey.Princeton.EDU ! >! jwbirdsa@pucc.BITNET ...allegra!princeton!phoenix!jwbirdsa! >======================================================================== To find the address of video (at least in text mode) just use INT 10h function 0Fh. If the mode returned is 7, then video starts at segment B000h, otherwise it's at B800h. Video is arranged with the each character requiring 2 bytes. The first being the attributes, and the second the character. For graphics modes, 4,5 and 6 start at B800. On the Tandy 1000 series, 8 and 9 also start at B800. (The PCjr varies in these modes.) Other graphic modes generally start at A000. I'm unsure about Hercules graphics. The port to check for snow protection is 3DAh. Just do: MOV DX,3DAh ;port HORZ_RET: IN AL,DX ;get status TEST AL,1 ;check JNZ HORZ_RET ;wait till low CLI ;turn off interrupts HWAIT: IN AL,DX ;get status TEST AL,1 ;is it high? JZ HWAIT ;wait until high ;write character to screen in your own way Only CGA displays need this, but not all require it. It should be made on option if you can. Attempting to wait on a monochrome display (which uses port 3BAh) will freeze your program because it is never used. andyross@ddsw1.MCS.COM -or- ddsw1!andyross -or- ddsw1!igloo!andyross
bobmon@iuvax.cs.indiana.edu (RAMontante) (01/04/89)
>B000h, otherwise it's at B800h. Video is arranged with the each character >requiring 2 bytes. The first being the attributes, and the second the >character. [...] ^^^^^ ^^^^^^ Text-mode video. The first (lower-address) byte is the character, the second (address+1) byte is the offsets.