|
Have you ever wanted to change the cursor size or actually hide the cursor with out calling any interrupts or other services? Probably not, unless you are writing your own OS or BIOS. However, I will give you a little information on accessing the video hardware directly
First of, the video is accessed through 18 control registers. Number 00 through 09 I will not even talk about because you can seriously damage your system by accessing these registers.
However, register pairs 10 & 11 and 14 & 15 are the shape and location of the cursor, register pair 12 & 13 handle paging, and register pair 16 & 17 are the light pen position. We access these registers though port 03D5h on the CGA, EGA, or VGA. First send the desired register to port 03D4h and then the value to port 03D5h. With a register pair, these are 16 bit values. So send the low order byte to the specified numbered register and the high byte to the other numbered register.
For this issues example, I will turn the cursor off and then back on again. Bit 5 of register 10 turns the cursor off when it is set or on when the bit is clear. This register also holds the cursor start line. We will set bit 5, pause for key, and then set the start line and clearing bit 5.
.model tiny
.code
mov dx,03D4h ; on CGA+
mov al,10 ; we want to use register 10
out dx,al ;
inc dx ; inc to send port
mov al,20h ; send value to clear register with bit 5 set
out dx,al ;
xor ah,ah ; BIOS get a key
int 16h ;
mov dx,03D4h ; always set port to desired register
mov al,10 ; to make sure
out dx,al ;
inc dx ;
mov al,0Dh ; send 0Dh for starting and clear bit 5
out dx,al ;
ret
.end
Please note: You must be very careful with these registers. As stated above, you can damage a video card and/or monitor.
Also, whatever you do to the video through these registers will not update the BIOS. You will have to do that yourself if you want it updated. So if you change the cursors shape or position, the next BIOS call will affect the previously stored change, not your new change.
¥
|