Path: utzoo!utgpu!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!dinghy.cis.ohio-state.edu!schanck
From: schanck@dinghy.cis.ohio-state.edu (Christopher Schanck)
Newsgroups: comp.sys.ibm.pc
Subject: Re: Cursor question
Message-ID: <29053@tut.cis.ohio-state.edu>
Date: 4 Dec 88 19:39:55 GMT
References: <2021@kuhub.cc.ukans.edu>
Sender: news@tut.cis.ohio-state.edu
Organization: The Ohio State University Dept of Computer and Information Science
Lines: 67

In article <2021@kuhub.cc.ukans.edu> dougm@kuhub.cc.ukans.edu (Douglas Miller) writes:
>
>Here is an improve version of the cursor program.  It is set up as an
>        OUT DX,AL                        ; of your system.  I haven't tried
>        MOV DX,DATAPORT                  ; on anything other than CGA.
					    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
You would have been irked if you had; it won't work. The EGA and the BIOS
don't work towell together when it comes to scan lines. Start/End lines
which give no cursor on CGA give sort of a block on EGA. It is a colossal
pain. The following routines are for TC, but could be converted easily.

/* you will have to figure the includes */
Joel,

Try these routines; they work beautifully for me. You can see what I 
did -- judicious use of the old variable argument list makes it go. 
writef() at the moment accepts x and y coordinates, and attribute, and 
a standard cprintf call, i.e.:

writef(10,20,BLUE+(WHITE<<4),"The number is: %i\n",number);

where number is an integer. After the cputs, it moves the cursor off 
the screen. Notice you really need the x and y coords, since it 
repositions the cursor each time. But itis super nice for the job it 
was designed, and it is quick if you use directvideo and some other TC 
tricks. The cursheight routine is simple; if the height requested is 
0, it runs the cursor off. Any other number and it simply changes the 
size. For instance, in my editing routine, I use cursheight(1) for 
overwrite mode, and cursheight(3) for insert. Hope this helps.

/* you made need more includes; I pulled these routines out of other
rather large files.... */

void cursheight(int x){
   struct REGPACK sregs;
   if(x!=0){
      sregs.r_ax=256;
      sregs.r_cx=(8-x)*256+7;
   }
   else{
      sregs.r_ax=512;
      sregs.r_dx=0x1a00;
      sregs.r_bx=0;
   }
   intr(0x10,&sregs);
}

void writef(int x, int y, int attrib, va_list arg_list, ...){
   char output[129];
   char *format;
   va_list arg_ptr;
   format=arg_list;
   va_start(arg_ptr, arg_list);
   vsprintf(output, format, arg_ptr);
   textattr(attrib);
   gotoxy(x,y);
   cputs(output);
   cursheight(0);
}

Apologies to Joel, who got these yesterday.

Chris
-=-
"My brain is NOT a deadlock-free environment!!!!"
--- Christopher Schanck, mammal at large.
schanck@flounder.cis.ohio-state.edu