Page 1 of 1

COLOR for screen 13

Posted: Mon Dec 24, 2007 9:59 am
by Sinuvoid
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?

Posted: Mon Dec 24, 2007 1:47 pm
by Nodtveidt
Use your own bitmapped font routine, or use a library which already does it. There is no other way.

Posted: Mon Dec 24, 2007 2:01 pm
by burger2227
Here is an Interrupt SUB routine to print text with any color background:

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
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

Posted: Mon Dec 24, 2007 2:47 pm
by Sinuvoid
I think Ill go with Nod's for learning experience :P

Posted: Tue Dec 25, 2007 2:31 am
by burger2227
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

Posted: Tue Dec 25, 2007 3:04 am
by Nodtveidt
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.

STFU, Interrupt is a valid function built into the library

Posted: Tue Dec 25, 2007 4:04 am
by burger2227
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

Posted: Tue Dec 25, 2007 4:25 am
by Nodtveidt
I never stated creating a new library object. In this context, the word "library" refers to a collection of general purpose functions. Or, in this case, a single function. Of course, if you want to argue semantics, feel free to argue with yourself.

Posted: Tue Dec 25, 2007 8:27 am
by Sinuvoid
Hm, you guys must really hate each other xD

Posted: Tue Dec 25, 2007 12:57 pm
by Nodtveidt
I don't hate him. Hating him would be the same as hating the last thing I flushed down the toilet.

Posted: Tue Dec 25, 2007 5:25 pm
by burger2227
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!

Posted: Tue Dec 25, 2007 5:28 pm
by Sinuvoid
No, Lee is myself...?

Posted: Tue Dec 25, 2007 5:30 pm
by Seb McClouth
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...

Yep we both are good at insults!

Posted: Tue Dec 25, 2007 5:43 pm
by burger2227
It seems to be going the other way! We are in a contest to see who is Worser LOL.

colored text

Posted: Mon Apr 07, 2008 1:01 am
by Kiyotewolf
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!

Posted: Mon Apr 07, 2008 7:23 pm
by Ralph
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.

Posted: Mon Apr 07, 2008 8:20 pm
by Mentat
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...
I win. 8)
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. :lol: