Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
A short PEEK/POKE question
#1
How do you print text using PEEK/POKE in SCREEN 13?

:???:
Reply
#2
You can POKE pixels, but not text in graphical modes. But you can do that with text only modes like SCREEN 0.

The closest you can get (in a graphical mode) is PEEKing from the BIOS font and POKEing to the screen, like some font programs do.
Reply
#3
This may be of some help to you.
First of all you need to know the SEG address that you wish to read from. If you already know that then you just need to write:
PRINT PEEK(N). With N being the the address of the first bite of info. you wish to print. Here is a rough example.
Lets say you have 500 bites information "poked" into memory at address 25000.
To print it out you would just use:
FOR N is 25000 to 25499: PRINT PEEK(n);: NEXT.
I don't recall the complete procedure you need to use now with qbasic except that you use the same DEF SEG to set the address for both the POKE and PEEK.
I know that there are others on this forum that can fill you in on any and all of the details I probably missed. It's been awhile since I've used that format.
adsherm
Reply
#4
I tried using this code:

Code:
DEF SEG = &HB800
POKE 0, 65'Put an A in the top left corner
POKE 1, 1'Colour it blue

It works on the default screen (SCREEN 0) but it doesn't work on screen 13. This one uses B800h as the segment but I think screen 13 uses a differnt segment.
Reply
#5
I found these two programs using google. I think FFA6h is the right segment. Can someone explane how any of these programs work?

Code:
DEFINT A-Z

DECLARE SUB BIOSPRINT (x%, y%, Text$, clr%)

SCREEN 13

BIOSPRINT 12, 12, "Hello", 12

DEFSNG A-Z
SUB BIOSPRINT (x%, y%, Text$, clr%)
'================================
'x%, y% = location to print.
'Text$ = Text to print
'clr% = Color of text
'================================

FOR d% = 1 TO LEN(Text$)
   FOR c% = 0 TO 7
     DEF SEG = &HFFA6
     l% = PEEK(14 + 8 * ASC(MID$(Text$, d%, 1)) + c%)
     x1% = x% + d% * 8 - 1
     x2% = x% + d% * 8 + 15: a% = 7
     FOR b% = x1% TO x2%
       IF l% AND 2 ^ a% THEN
         PSET (b%, c% + y%), clr%
       END IF: a% = a% - 1
     NEXT
   NEXT
NEXT

DEF SEG

END SUB

Code:
DEF SEG = &HFFA6 'Stores masks for letters
FOR Letter = 1 TO LEN(text$) 'Does each letter
Address = (8 * ASC(MID$(text$, Letter))) + 14 'Address for start of letter
FOR height = 0 TO 7 'Each letter is an 8x8 pixel matrix
Mask = PEEK(Address + height) * 128 'Address for mask of each line of letter
LINE (x + Curntx + 1, y + height + 1)-(x + 9 + Curntx, y + height + 1), Fore, , Mask
NEXT
Curntx = Curntx + 8 'Advances X axis by 8 for next letter
NEXT 'Continue to next letter
Reply
#6
It's just like I said earlier. That code is copying pixels from the BIOS font to the screen.
Reply
#7
Quote:It works on the default screen (SCREEN 0) but it doesn't work on screen 13. This one uses B800h as the segment but I think screen 13 uses a differnt segment.
Screen 13 segment: A000h Wink.
Storage struct: one byte per pixel, namely the pixel colour.
To calculate x/y coordinates to offset:
Code:
x% = 160
y% = 100
Offset& = y% * 320& + x%
This codes also works btw in higher screenmodes (the only thing you need to do is replace 320 by the correct screen width).
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)