print a value at a plot coordinate

Discussions about the BBC BASIC language, with particular reference to BB4W and BBCSDL
fred
Posts: 4
Joined: Fri 18 Feb 2022, 09:17

print a value at a plot coordinate

Post by fred »

Hello all, I seem to rem years ago when I had my bbc micro I used print at to place chr on screen. Is it possible to place a value (say x in x,y coordinates) at the point plotted at that x,y coordinate?

Thanks in advance DW.
MattC
Posts: 114
Joined: Mon 16 Apr 2018, 06:17

Re: print a value at a plot coordinate

Post by MattC »

Hi DW,

I think what your asking is answered by use of the VDU5 command. See the help manual under VDU emulation.

Matt
fred
Posts: 4
Joined: Fri 18 Feb 2022, 09:17

Re: print a value at a plot coordinate

Post by fred »

Many thanks for your time, Rgds DW.
DDRM

Re: print a value at a plot coordinate

Post by DDRM »

There are two options:

1) You can print at different character positions on the screen using PRINT TAB(). This will ensure characters line up, but only gives quite limited resolution. I suspect this is what you were actually remembering. You will print at the TEXT cursor position (and doing PRINT TAB will change that, so subsequent PRINTs will follow on).

2) As Matt says, if you use VDU 5 your print statement will print out at the GRAPHICS cursor, which you can set with MOVE

Brief example of each:

Code: Select all

      MODE 21  : REM 800 x 600 pixels (1600 x 1200 graphics units) and 50 x 30 text characters
      PRINT "Top left: Demo of standard printing"
      PRINT TAB(25,15);"Middle - ";
      PRINT "and some more."
      PRINT "And yet more"
      PRINT "Press any key to continue"
      q$ = GET$
      CLS
      REM Link text and graphics cursors. Graphics cursor positions the top left of the text string
      VDU 5
      PRINT "Bottom left"
      REM ...which was hidden off screen, since graphics cursor is at 0,0!
      MOVE 0,1000
      PRINT "highish left: demo of VDU 5 mode, printing at graphics cursor"
      MOVE 800,600
      PRINT "Middle"
      REM OK, let's switch back to printing at the text cursor
      VDU 4
      REM Note that we haven't yet moved the text cursor which starts (and still is) at top left
      PRINT "... and some more"
Best wishes,

D
fred
Posts: 4
Joined: Fri 18 Feb 2022, 09:17

Re: print a value at a plot coordinate

Post by fred »

Thanks for that info, I will try those examples to familiarize myself. What I wanted to do was to plot a parabola & every few points print the x,y coordinate values of the point at the point, to see the values changing.

Rgds DW
DDRM

Re: print a value at a plot coordinate

Post by DDRM »

Then the VDU 5 method is likely to be your best bet - at least then you are using the same coordinate system! Remember when printing it gives the top left of the first character, so you might want to shift it up a few pixels so the text is centred vertically on the point.

Best wishes,

D
fred
Posts: 4
Joined: Fri 18 Feb 2022, 09:17

Re: print a value at a plot coordinate

Post by fred »

OK will try the vdu 5 method, thanks again, Rgds DW.