Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Blinking text

Status
Not open for further replies.

JavaDude32

Programmer
Aug 25, 2001
180
US
Okay, I'm using the standard bios function 09H for interrupt 10H to hopefully get 5 asteriks to blink. I'm using Windows 2K but assembling and linking with masm 6.11 for dos. My program displays the characters but they do not blink. Is this a compatability issue or have I overlooked something in my code?

;SET THE VIDEO MODE
MOV AH,00H
MOV AL,07H
INT 10H

;CLEAR THE SCREEN
MOV AH,06H
MOV BH,17H
MOV CX,0000H
MOV DX,184FH
INT 10H

;PRINT CHAR TO THE SCREEN
MOV AH,09H
MOV AL,'*'
MOV BH,00H
MOV BL,0DAH ;SELECT TEXT ATTRIBUTE
MOV CX,05 ;COUNT OF TEXT
INT 10H

;REPOSITION THE CURSOR
MOV AH,02H
MOV BH,00H
MOV DX,0220H
INT 10H

;RESIZE THE CURSOR
MOV AH,01H
MOV CH,08
MOV CL,14
INT 10H

;READ IN CHARS
MOV AH,0AH
LEA DX,NAMEFLD
INT 21H

;REPOSITION THE CURSOR
MOV AH,02H
MOV BH,00H
MOV DX,0820H
INT 10H

;PRINT OUT CHARS
MOV AH,09H
MOV BH,00
MOV BL,ACTLEN
MOV NAMESLOT[BX+1],'$'
LEA DX,NAMESLOT
INT 21H

MOV AX,4C00H
INT 21H

Thanks in advance for any help and btw, the text is supposed to be light green on a magneta background and blinking for the '*' 's.
 
It may be a VGA card issue. If I remember correctly the blink/not blink thing can be turned on and off in one of the VGA card's many registers, because the bit that controls blinking in the attribute can also be used to control colour. You need to select which, and probably the default is colour in your dos box.
You might care to have a look in Abrash's big black book (probably available on line) or any good VGA book/website. if you get really stuck, ask again and I'll try to find the exact register and bit.
 
Yes, found it. Register 010h of the attribute controller, bit 3 (=8) needs to be set to activate blinking, otherwise it controls intensity of background.
You need first to put the attribute controller into a state where it's ready to receive the address of one of its internal registers (it was originally a single chip which talked to the world through port 03C0h); unlike the other VGA controllers it uses a single port for addressing its internal registers and for taking data for them (anoying).
So, first read anything from port 03DAh, the input status 1 port, in order to put the attribute controller into the right state. Then write 010h to port 03C0h to set the right register address. This also puts the AC in the right frame of mind for receiving data rather than addresses.
Now you can read this register from port 03C0h again, or it with "8", and write it.
 
i take it its default text mode yr using?

its alot faster if you write directly to the screen memory located at 0B8000h. each charactor is a word. 1st byte is the ascii code the second the fore/back colours including flashing.

maybe you could try - get cursor position - hard write charactors (scrolling screen if required) - set new cursor position.

straiph

"There are 10 types of people in this world, those who know binary and those who don't!"
 
the blinking thing will still be an issue, but there is a bios interrupt that deals with it, I find now (embarassingly) select blinking instead of background brightness, or something...
good luck
 
I'm fairly new at Assembly, but is there a place where I can look up values for card specs? Video memory areas I thought differed for the types of cards, but I may be mistaken. As for the ports, well not to be too green, but how do you read and write from ports in Asm? Is like the general i/o and you just need special file handlers or what?

Thanks for the help though,
JavaDude32
 
for 8 bit ports:

in al,<PORT NO>
out <PORT NO>,al

for 16 bit port use ax and 32 bit port use eax

instead of a constant operand for port address you can use dx. a constant operand only allows you to access ports 0 to 255 where using dx allows ports 0 to 65535.

in al,dx
out dx,al

only al,ax and eax can be used for the value.
only a byte constant or dx can be used for the port address.
straiph &quot;There are 10 types of people in this world, those who know binary and those who don't!&quot;
 
... and as for card specs, if anyone knows where you can look up the differences, I'd be interested too. Most people writing for Windows never bother too much with low-level graphics because it's all handled for them. Most DOS people either stick to the VGA bits which are the same on all cards, or if they need more resolution, use VESA standards, which are also guarunteed from card to card. The only book I've got with definitions of VESA is both old and German, so I'm not your best source of info. I'd personally never attempt to program a graphics card directly in a card-specific manner, because there are just so many cards out there it would be hideous to produce code for all of them.
The base VGA memory area is the same on all cards (thank goodness). But it's only 64K, so you're not exploiting the full possibilities of an umpteen Mb card!
 
good advice! the whole point of the PC is that it doesnt (shouldnt) matter whos hardware you buy or install they all work to the same industry standards (and then add their own additional functionality) and this is the point of the device drivers. if i was going to get heavy with graphics - i would definately work on my low level raster crunching but theres alot of extra functionality with 3D AGP etc etc which is starting to become the norm. i would have a play around with that. youll probably find that great graphics can be produced and all the hard work is done by the cards on board processor leaving the CPU to do what its suposed to - unless you have integrated circuits (which seems to be quite common these days due to cost cutting) ok, typically there sold to businesses but if ya buy a home machine make sure its generic ie no brand name or coporate label. they tend to sell PCs all be it cheaper (thats how they get business) but youll be getting half a PC - they will advertise P4 2.3G but it will be performing all the chores integrated circuits making it the same speed as a P3. they will advertise it being 256Mb or 512Mb memory but with 64 or 128Mb used for the video card, you get the picture!

(woops, sorry i got carried away, ill shut up now)
&quot;There are 10 types of people in this world, those who know binary and those who don't!&quot;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top