BBC Basic: Cannot plot rectangle on screen
Asked Answered
C

1

12

I recently got my hands on a BBC Micro (model B), and been playing around with it as a hobby project.

I'm having some trouble with the graphics commands, and was wondering if anyone could point me in the right direction... I have written the following test program to draw a rectangle on the screen:

10 CLS
20 MODE 5
30 MOVE 0,0
40 PLOT 97,100,100

When I run this, the program completes but no rectangle is drawn (that I can see). I'm using a coaxial cable to connect to a CRT TV, but I don't believe the cursor is drawing off-screen because I've tried adjusting the X/Y values to check for this.

Have I made a mistake in my test program? Is there possibly a known hardware fault that I should check for?

Cosmic answered 2/5, 2013 at 9:13 Comment(1)
If I could I'd give you +50 just for nostalgia value :-)Glasswort
G
11

There's a simple explanation: PLOT 97 (draw rectangle) was not implemented on the original BBC Micro Model B - that used PLOT codes only up to 87. I'm not absolutely certain when PLOT 96-103 were introduced, it may have been the Model B+ or the BBC Master.

On a Model B you must draw the rectangle as two triangles (here in the centre of the screen):

   10 MODE 5
   20 MOVE 592,462
   30 PLOT 0,0,50
   40 PLOT 81,50,-50
   50 PLOT 81,0,50

Richard.

Garman answered 5/5, 2013 at 11:24 Comment(2)
Perfect, exactly what I needed. I was using Ben Ryves website as a reference, I'll be more cautious of compatibility from now on. Thanks!Cosmic
BBC Model B PLOT codes went up to 95. 88-95 are often forgotten, possibly because the typesetting of the original User Guide made them easy to miss. </pedantry>Olivas

© 2022 - 2024 — McMap. All rights reserved.