[comp.os.msdos.programmer] Accessing VGA from INT 0x33 FUNC 0x0c

heintze@grane.enet.dec.com (Siegfried Heintze) (08/31/90)

  I'm new to VNEWS.  I though I posted this yesterday but when I look though the
list of articles
I cannot find it.  If I have posted this twice, please forgive (and inform) me.


  I'm using MSDOS software interrupt 0x33, function 0x0c to establish a routine
(called ime) to be called by the mouse driver everytime the mouse changes state
(ie,
(ie, everytime a button is depressed or released or the position of the mouse
changes.)

This works because I can call the zortech routine "sound_click()" to verify
that it is working.

I remember reading somewhere that it is necessary to call interrupt 0x33
function
2 before writing to the VGA to prevent a conflict.   This function hides the
mouse pointer on the VGA to prevent the mouse driver and you from trying to 
access VGA simultaneously.  This is an important consideration because
writing to the VGA is not an atomic operation.  It consists of writing to 
multiple VGA registers via I/O ports.  Interrupting this sequence with
another write sequence would not be desireable.  So we tell the mouse
driver not update the mouse pointer on the VGA while we are accessing the
VGA display RAM and when we are done we use INT 0x33 func 1 to display the
mouse pointer again.

I tried just writing to the VGA display from the routine called by INT 0x33 
func 0x0c and it did not hang.   But when I tried to write a character
to the VGA display using a call to MSDOS (INT 0x10 func 9)
it hangs.  No surprise,  I probably needed to hide the mouse.  

So I call int 0x33 func 2 to hide the mouse inside ime.   This hangs my
machine.   Why?  How do I diagnose this problem further?


                                       Sieg

joe@proto.COM (Joe Huffman) (09/01/90)

In article <15052@shlump.nac.dec.com>, heintze@grane.enet.dec.com (Siegfried Heintze) writes:
> 
> I'm using MSDOS software interrupt 0x33, function 0x0c to establish a routine
>(called ime) to be called by the mouse driver everytime the mouse changes state
> (ie, everytime a button is depressed or released or the position of the mouse
> changes.)
> 
> This works because I can call the zortech routine "sound_click()" to verify
> that it is working.

Good technique.  I use it too.  Thanks Walter, excellant idea.

> I tried just writing to the VGA display from the routine called by INT 0x33 
> func 0x0c and it did not hang.   But when I tried to write a character
> to the VGA display using a call to MSDOS (INT 0x10 func 9)
> it hangs.  No surprise,  I probably needed to hide the mouse.  
> 
> So I call int 0x33 func 2 to hide the mouse inside ime.   This hangs my
> machine.   Why?  How do I diagnose this problem further?

I haven't tried this so I am guessing some.  It will probably also vary with
mouse drivers.  I think the problem is that int 33h isn't reentrant.  That
is, you cannot allow another int 33h to occur while one is still active.  What
are you do exactly?  Graphics?  Text?  If graphics use the fg_msm_ functions
for the mouse interface and graphics.  The graphics library is 'mouse aware'
and won't trash the mouse cursor and the mouse cursor won't trash the graphics.

If text mode then use direct memory access (disp_ should work but I haven't 
verified this) and check for the mouse in the area of the screen you are 
updating, being careful to restore it if you change the character that the 
mouse cursor is on.

If you have problems with the graphics and mouse functions with FG let me know.
I wrote them....
  
---
Zortech mailing list: send email to 'ztc-list-request@uunet' with:
Add: your-user-name@your-machine-name
In the body of the message.
---
Send Zortech bug reports to 'zortech-bugs@proto.com'
---
Zortech is my major source of income.  Statements about them or their 
competitors cannot be totally without bias.  
-- 
joe@proto.com
FAX: 208-263-8772