Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!usc!csun!Twg-S5!abcscnuk From: abcscnuk@Twg-S5.uucp (Naoto Kimura (ACM)) Newsgroups: comp.lang.pascal Subject: Re: address screen memory Message-ID: <1990Oct15.110743.15901@csun.edu> Date: 15 Oct 90 11:07:43 GMT References: <4249@gara.une.oz.au> Sender: news@csun.edu (News Administrator) Organization: csun Lines: 87 In article <4249@gara.une.oz.au> nveldhov@gara.une.oz.au (Kick_Butt alias of nICK ) writes: ]Hello ] ]I am only new at TURBO PASCAL, and just starting to write programs in this ]great language. ] ]Getting to the point, does somebody out there have any code that can read the ]character and color at any location on the screen. I thought that this could ]be done by getting directly into the screen memory. I would appreciate any help ] ] THANK YOU. ] ](uses TURBO PASCAL version 5.5) Get the book "Programmers Guide to PC/AT/PS2 Video Systems" by Richard Wilton(?) printed by Microsoft Press. It discusses techniques for detecting, reading from, and writing to the video display. I found it to be a great source of information about the different video display hardware systems that can be installed on the IBM-PC. Here's a bits of code that you could probably use until you get the book: ---- CUT HERE ---- unit Screen; interface uses Dos; const MDA_seg = $b000; CGA_seg = $b800; type ScreenChar = record Ch : Char; Attr : Byte end; const ScrnSeg : Word = CGA_seg; var ScreenRows : Word; ScreenColumns : Word absolute $40:$4A; procedure ScreenPeek( x,y : Integer; var S : ScreenChar ); procedure ScreenPoke( x,y : Integer; S : ScreenChar ); implementation procedure ScreenPeek( x,y : Integer; var S : ScreenChar ); begin if (x>0) and (x<=ScreenColumns) and (y>0) and (y<=ScreenRows) then S := ScreenChar(memw[ScrnSeg: (y-1)*ScreenColumns + (x-1)]) end; procedure ScreenPoke( x,y : Integer; S : ScreenChar ); begin if (x>0) and (x<=ScreenColumns) and (y>0) and (y<=ScreenRows) then memw[ScrnSeg:(y-1)*ScreenColumns + (x-1)] := Word(S) end; var regs:Registers; begin ScreenRows := 25; intr($11,regs); if (regs.ax and $30) = $30 then begin ScrnSeg := MDA_seg end else begin ScrnSeg := CGA_seg end end. ---- CUT HERE ---- //-n-\\ Naoto Kimura _____---=======---_____ (abcscnuk@csuna.csun.edu) ====____\ /.. ..\ /____==== // ---\__O__/--- \\ Enterprise... Surrender or we'll \_\ /_/ send back your *&^$% tribbles !!