COLOR for screen 13
COLOR for screen 13
I need to change the backround color of the text, but QB doesn't let you do this in screen 13. is there a way around this?
- burger2227
- Veteran
- Posts: 2466
- Joined: Mon Aug 21, 2006 12:40 am
- Location: Pittsburgh, PA
Here is an Interrupt SUB routine to print text with any color background:
The row% and col% are normal text rows and columns. Text$ is your string of text, fc% = forecolor and bc% = backcolor.
You will need to run the QB45 library (QB.EXE /L) and '$Include: 'QB.BI'.
Also DIM SHARED Registers AS REGTYPEX at the beginning of the program.
Ted
Code: Select all
'$INCLUDE: 'QB.BI'
DIM SHARED Registers AS RegTypeX
SUB ColorPrint (text$, row%, col%, fc%, bc%) STATIC
c$ = STRING$(LEN(text$), 219) 'string of solid BG characters
Registers.ax = &H1300 'video service 13h, subfunction 0
Registers.bx = bc% 'BH = page (0), BL = Background color
Registers.cx = LEN(text$) 'CX = string length
Registers.dx = 256 * (row% - 1) + (col% - 1) 'DH = row, DL = column
Registers.es = VARSEG(c$) 'ES = string data segment
Registers.bp = SADD(c$) 'BP = string address
CALL InterruptX(&H10, Registers, Registers) 'call the BIOS to print it
Registers.bx = (fc% XOR bc%) + &H80 'BL = color, +&H80 means use XOR
Registers.es = VARSEG(text$) 'ES = string data segment
Registers.bp = SADD(text$) 'BP is the string address
CALL InterruptX(&H10, Registers, Registers) 'call the BIOS
END SUB
You will need to run the QB45 library (QB.EXE /L) and '$Include: 'QB.BI'.
Also DIM SHARED Registers AS REGTYPEX at the beginning of the program.
Ted
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
- burger2227
- Veteran
- Posts: 2466
- Joined: Mon Aug 21, 2006 12:40 am
- Location: Pittsburgh, PA
You and Nod have a better chance of getting married than either one of you can learn how to code! LEE , LEE, LEE?
Do you know how to do anything on your own? I could help, but I am not going to encourage the idiot and your constant posts! However, I do like Penn........... and Teller. Great avitar! I also proved that there IS another way!
Merry Christmas .........ho .......ho ......ho!
Ted
Do you know how to do anything on your own? I could help, but I am not going to encourage the idiot and your constant posts! However, I do like Penn........... and Teller. Great avitar! I also proved that there IS another way!
Merry Christmas .........ho .......ho ......ho!
Ted
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
What you posted would be considered a library, especially since it requires QB's utility library.
By the way, I'm already married. This is my wife.
By the way, I'm already married. This is my wife.
- burger2227
- Veteran
- Posts: 2466
- Joined: Mon Aug 21, 2006 12:40 am
- Location: Pittsburgh, PA
STFU, Interrupt is a valid function built into the library
There is absolutely no reason to have to create a new library when QB45 has it there for the asking. Get real!
And I am your father, N! LOL
LEE are you really running a contest or begging for help? I would, but I think you are a figment of somebody's imagination and I already tried that road.
Ted
And I am your father, N! LOL
LEE are you really running a contest or begging for help? I would, but I think you are a figment of somebody's imagination and I already tried that road.
Ted
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
- burger2227
- Veteran
- Posts: 2466
- Joined: Mon Aug 21, 2006 12:40 am
- Location: Pittsburgh, PA
I don't hate him either! But he does smell like something I hate even after I flush the toilet!
Admit it NOD! You made LEE up, didn't you? I saved that GIF, gotta love it!
Admit it NOD! You made LEE up, didn't you? I saved that GIF, gotta love it!
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
- Seb McClouth
- Veteran
- Posts: 342
- Joined: Wed Nov 09, 2005 7:47 am
- Location: Inside the Matrix...
- Contact:
Ted, what's it between you and Nod? It's like you two have a contest about who's better... But you're both good at what you do...
QBinux is a Linux distribution with the aim of integrating the work of the vast community of free software developers at Pete's QBASIC Site in order to create a modern, performant, safe and easy to use system for system administrators and desktop users.
- burger2227
- Veteran
- Posts: 2466
- Joined: Mon Aug 21, 2006 12:40 am
- Location: Pittsburgh, PA
Yep we both are good at insults!
It seems to be going the other way! We are in a contest to see who is Worser LOL.
- Kiyotewolf
- Veteran
- Posts: 96
- Joined: Tue Apr 01, 2008 11:38 pm
colored text
I have solved this problem awhile ago since doing an ANSI thingy in EGA..
Assuming you are using SCREEN 13,.. i'll go with that..
make an 8x8 box of the color 255 using LINE
get it..
xor it over your text that was color'ed in color 255 as well
now, your text background has shifted from the background to the foreground.
get the data
line your background color in an 8x8 box
put the data using AND over the colored box
get the data
draw the character normal using color 255
get it
line your foreground as an 8x8 cube
put with AND over the colored box
get it..
put your background colored piece down first, then put using OR your foreground colored text over it to make them finish up..
people flame each other for posting code.. so that's as far as i'm going to explain it..
flaming is sad.. a sad sad waste of time..
Kiyote!
Assuming you are using SCREEN 13,.. i'll go with that..
make an 8x8 box of the color 255 using LINE
get it..
xor it over your text that was color'ed in color 255 as well
now, your text background has shifted from the background to the foreground.
get the data
line your background color in an 8x8 box
put the data using AND over the colored box
get the data
draw the character normal using color 255
get it
line your foreground as an 8x8 cube
put with AND over the colored box
get it..
put your background colored piece down first, then put using OR your foreground colored text over it to make them finish up..
people flame each other for posting code.. so that's as far as i'm going to explain it..
flaming is sad.. a sad sad waste of time..
Kiyote!
Banana phone! We need more lemon pledge. * exploding fist of iced tea! * I see your psycho cat and counter with a duck that has a broken leg, in a cast.
Lee:
If you only want the text background to match the SCREEN background, here is another way. Since it involves GETting and PUTting, first of all, let us know if you understand how to use those two graphics statements. Assuming you do, here's how:
1. Print the string.
2. DIMension an array to (L*8,8 ), where L is the LENgth of the string, and the number of pixels for each character are 8, both horizontally and vertically.
3. GET the string into the array.
4. Blot out the above string with a LINE statement ending in BF .
5. PUT the string where desired.
In the above, remember that each character of text has a height of 8 pixels, and a width of 7 pixels. SCREEN 13 is 320 pixels (or 320/8 = 40 characters) wide, and 200 pixels (or 200/8 = 25 lines) high.
If you only want the text background to match the SCREEN background, here is another way. Since it involves GETting and PUTting, first of all, let us know if you understand how to use those two graphics statements. Assuming you do, here's how:
1. Print the string.
2. DIMension an array to (L*8,8 ), where L is the LENgth of the string, and the number of pixels for each character are 8, both horizontally and vertically.
3. GET the string into the array.
4. Blot out the above string with a LINE statement ending in BF .
5. PUT the string where desired.
In the above, remember that each character of text has a height of 8 pixels, and a width of 7 pixels. SCREEN 13 is 320 pixels (or 320/8 = 40 characters) wide, and 200 pixels (or 200/8 = 25 lines) high.
Ralph, with QuickBASIC 4.5, operating under Windows XP, wiht anHP LaserJet 4L Printer. Bilingual in English/Spanish
I win.Seb McClouth wrote:Ted, what's it between you and Nod? It's like you two have a contest about who's better... But you're both good at what you do...
![Cool 8)](./images/smilies/icon_cool.gif)
There, it's settled.
As for the topic, I would guess using PUT for the bitmaps.
Or if you're really bored, pset every pixel.
![Laughing :lol:](./images/smilies/icon_lol.gif)
For any grievances posted above, I blame whoever is in charge . . .