Posts: 3,522
Threads: 189
Joined: Dec 2003
Code: SUB AF.Print (Xpos%, Ypos%, Text$, col%)
'Prints the standard 8*8 CGA font
'Paramenters:
'Segment=the Layer to print to
'Xpos,Ypos=the coordinates of the text
'Text$=the string to print
'col= is the color to print(gradient)
Segment=&HA000 'Always point to the screen segment (added this)
X% = Xpos%
Y% = Ypos%
Spacing% = 8
For I% = 0 To Len(Text$) - 1
X% = X% + Spacing%
Offset% = 8 * Asc(Mid$(Text$, I% + 1, 1)) + 14
For J% = 0 To 7
DEF SEG = &HFFA6
Bit% = PEEK(Offset% + J%)
DEF SEG = Segment 'someone forgot this, ey? (added this)
If Bit% And 1 Then PSet (X%, Y% + J%), col% + J%
If Bit% And 2 Then PSet (X% - 1, Y% + J%), col% + J%
If Bit% And 4 Then PSet (X% - 2, Y% + J%), col% + J%
If Bit% And 8 Then PSet (X% - 3, Y% + J%), col% + J%
If Bit% And 16 Then PSet (X% - 4, Y% + J%), col% + J%
If Bit% And 32 Then PSet (X% - 5, Y% + J%), col% + J%
If Bit% And 64 Then PSet (X% - 6, Y% + J%), col% + J%
If Bit% And 128 Then PSet (X% - 7, Y% + J%), col% + J%
Next J%
Next I%
DEF SEG
End Sub
Posts: 40
Threads: 7
Joined: Jul 2004
hey thanks yall iw ill try it
ife is better with a buistcuit
Posts: 1,752
Threads: 21
Joined: Jun 2002
Quote:Code: SUB AF.Print (Xpos%, Ypos%, Text$, col%)
'Prints the standard 8*8 CGA font
'Paramenters:
'Segment=the Layer to print to
'Xpos,Ypos=the coordinates of the text
'Text$=the string to print
'col= is the color to print(gradient)
Segment=&HA000 'Always point to the screen segment (added this)
X% = Xpos%
Y% = Ypos%
Spacing% = 8
For I% = 0 To Len(Text$) - 1
X% = X% + Spacing%
Offset% = 8 * Asc(Mid$(Text$, I% + 1, 1)) + 14
For J% = 0 To 7
DEF SEG = &HFFA6
Bit% = PEEK(Offset% + J%)
DEF SEG = Segment 'someone forgot this, ey? (added this)
If Bit% And 1 Then PSet (X%, Y% + J%), col% + J%
If Bit% And 2 Then PSet (X% - 1, Y% + J%), col% + J%
If Bit% And 4 Then PSet (X% - 2, Y% + J%), col% + J%
If Bit% And 8 Then PSet (X% - 3, Y% + J%), col% + J%
If Bit% And 16 Then PSet (X% - 4, Y% + J%), col% + J%
If Bit% And 32 Then PSet (X% - 5, Y% + J%), col% + J%
If Bit% And 64 Then PSet (X% - 6, Y% + J%), col% + J%
If Bit% And 128 Then PSet (X% - 7, Y% + J%), col% + J%
Next J%
Next I%
DEF SEG
End Sub
Er, you don't need that DEF SEG you added if you're using PSET...
Posts: 3,522
Threads: 189
Joined: Dec 2003
Go figure, it doesent work without it...
Just returns garbage... ("Random" pixels...)
Posts: 1,752
Threads: 21
Joined: Jun 2002
It works perfectly fine without the lines that you added. Because they don't do anything.
Posts: 3,522
Threads: 189
Joined: Dec 2003
Weird, it doesent work for me, I wouldn't have added them otherwise...
It also started working for CrazyAlabamianLlama...
It's probably some stupid bug/thing somewhere...
Posts: 40
Threads: 7
Joined: Jul 2004
no i havent got it to work yet..i have been messing with it and i downloaded it again but it was the same...oh well but can any of yall tell me a good site for good in depth tutorials or a store that still sells stuff on qbasic.
ife is better with a buistcuit
Posts: 1,752
Threads: 21
Joined: Jun 2002
Quote:Weird, it doesent work for me, I wouldn't have added them otherwise...
It also started working for CrazyAlabamianLlama...
It's probably some stupid bug/thing somewhere...
The only lines that execute after the DEF SEG you added are PSETs. If it works now, it's because you changed something else somewhere.
The only reason this sub would not work is if your BIOS is not 100% PC-compatible and does not have the 8x8 ROM font at F000h:FA6Eh.
If this is the case, you can fix that by obtaining the location of the font with the int 43h vector:
Code: SUB AF.Print (Xpos%, Ypos%, Text$, col%)
'Prints the standard 8*8 CGA font
'Paramenters:
'Segment=the Layer to print to
'Xpos,Ypos=the coordinates of the text
'Text$=the string to print
'col= is the color to print(gradient)
DEF SEG = 0
FontSeg& = PEEK(&H43 * 4 + 3) * &H100& + PEEK(&H43 * 4 + 2)
FontOff& = PEEK(&H43 * 4 + 1) * &H100& + PEEK(&H43 * 4)
DEF SEG = FontSeg&
X% = Xpos%
Y% = Ypos%
Spacing% = 8
FOR I% = 0 TO LEN(Text$) - 1
X% = X% + Spacing%
Offset& = 8 * ASC(MID$(Text$, I% + 1, 1)) + FontOff&
FOR J% = 0 TO 7
Bit% = PEEK(Offset& + J%)
IF Bit% AND 1 THEN PSET (X%, Y% + J%), col% + J%
IF Bit% AND 2 THEN PSET (X% - 1, Y% + J%), col% + J%
IF Bit% AND 4 THEN PSET (X% - 2, Y% + J%), col% + J%
IF Bit% AND 8 THEN PSET (X% - 3, Y% + J%), col% + J%
IF Bit% AND 16 THEN PSET (X% - 4, Y% + J%), col% + J%
IF Bit% AND 32 THEN PSET (X% - 5, Y% + J%), col% + J%
IF Bit% AND 64 THEN PSET (X% - 6, Y% + J%), col% + J%
IF Bit% AND 128 THEN PSET (X% - 7, Y% + J%), col% + J%
NEXT J%
NEXT I%
END SUB
(Also make sure you are using a screen mode that has an 8x8 font: SCREEN 1, 2, 7, 8, or 13.)
Posts: 3,522
Threads: 189
Joined: Dec 2003
I have no idea, as I know squat about the BIOS memory, or how to find stuffin it...
All I know is that it worked after I added the def seg.. and it didn't work before... I don't know why... Could be a QB bug, my windows messing around or whatever...
And I didn't change anything else, as you can see in the code.. which is all I had...
Nice fix, that might be CrazyAlabamianLlama's problem...
Posts: 40
Threads: 7
Joined: Jul 2004
Yea that last set of codes to put it the sub worked. i works perfectly now. thanks yall.
ife is better with a buistcuit
|