About BBC Basic 4

bbc micro/electron/atom/risc os coding queries and routines
drfloyd
Posts: 381
Joined: Tue Jun 09, 2020 3:36 pm
Contact:

Re: About BBC Basic 4

Post by drfloyd » Fri Jul 10, 2020 7:38 pm

VDU 19,3,15,0,0,0 ????

I will look into the documentation

drfloyd
Posts: 381
Joined: Tue Jun 09, 2020 3:36 pm
Contact:

Re: About BBC Basic 4

Post by drfloyd » Fri Jul 10, 2020 8:24 pm

but i have already used VD 19, it's swap 2 colors, but very slowly.

Coeus
Posts: 1824
Joined: Mon Jul 25, 2016 12:05 pm
Contact:

Re: About BBC Basic 4

Post by Coeus » Fri Jul 10, 2020 8:51 pm

jms2 wrote:
Fri Jul 10, 2020 7:12 pm
I genuinely didn’t realise you could do that... Probably because nobody would ever want to use flashing colours, they’re awful!
I think what that means is that the flashing is associated with the physical colour, not the logical one, so if you re-map one of the mode 1 colours to a flashing one it still works.

Coeus
Posts: 1824
Joined: Mon Jul 25, 2016 12:05 pm
Contact:

Re: About BBC Basic 4

Post by Coeus » Fri Jul 10, 2020 8:55 pm

drfloyd wrote:
Fri Jul 10, 2020 8:24 pm
but i have already used VD 19, it's swap 2 colors, but very slowly.
Yes, you cannot use that to create a new colour that is average of two others by displaying the pixel in each of the two colours alternately at such a fast speed that the eye perceives a new colour. I am not sure that even swapping every frame would achieve that.

From machine code one can set a timer to re-program the palette part way down the screen so that the set of four colours in the top of the screen are different from the set in the bottom. That doesn't require you to write the rest of your game in assembler. If you're interested in that perhaps someone who has already done that in a game can give example code.

drfloyd
Posts: 381
Joined: Tue Jun 09, 2020 3:36 pm
Contact:

Re: About BBC Basic 4

Post by drfloyd » Sun Jul 12, 2020 9:10 am

another thing about PRINT

In my aventure game the background text is black and text white, it's classic :)

I just want sometime to have the text black with background white (not for all the screen, just for some text)

User avatar
ChrisB
Posts: 78
Joined: Wed Oct 05, 2011 10:37 pm
Location: Surrey
Contact:

Re: About BBC Basic 4

Post by ChrisB » Sun Jul 12, 2020 9:26 am

COLOUR n
Set foreground colour
COLOUR 128+n
Set background colour

So - in mode 1

Code: Select all

COLOUR 131:COLOUR 0:PRINT "Black text on White background"
Or

Code: Select all

10 MODE 1
20 PRINT "Some text with a ";
30 COLOUR 131:COLOUR 0:PRINT "highlighted";
40 COLOUR 128:COLOUR 3:PRINT " word."

drfloyd
Posts: 381
Joined: Tue Jun 09, 2020 3:36 pm
Contact:

Re: About BBC Basic 4

Post by drfloyd » Sun Jul 12, 2020 12:17 pm

ok, thanks, it's working with VDU 5, but not VDU 4

I forgot to say then it was for VDU 4 mode (graphic mode)

drfloyd
Posts: 381
Joined: Tue Jun 09, 2020 3:36 pm
Contact:

Re: About BBC Basic 4

Post by drfloyd » Sun Jul 12, 2020 12:45 pm

I will put the name who all the person who help me to discover the basic IV in the generic of my game :)

Naomasa298
Posts: 391
Joined: Sat Feb 16, 2013 12:49 pm
Contact:

Re: About BBC Basic 4

Post by Naomasa298 » Sun Jul 12, 2020 12:52 pm

drfloyd wrote:
Sun Jul 12, 2020 12:17 pm
ok, thanks, it's working with VDU 5, but not VDU 4

I forgot to say then it was for VDU 4 mode (graphic mode)
You mean MODE4? MODE4 is two colour only. So
COLOUR 0:COLOUR 129

for black on white in MODE4.

drfloyd
Posts: 381
Joined: Tue Jun 09, 2020 3:36 pm
Contact:

Re: About BBC Basic 4

Post by drfloyd » Sun Jul 12, 2020 3:05 pm

no i mean PRINT with MOVE (with VDU 5)

With VDU 4 it works of course

Perhaps I am confuse or lost in translation :mrgreen:

Naomasa298
Posts: 391
Joined: Sat Feb 16, 2013 12:49 pm
Contact:

Re: About BBC Basic 4

Post by Naomasa298 » Sun Jul 12, 2020 3:23 pm

That's because when you use VDU5, it's writing the text as a graphic. You'll need to use GCOL instead of COLOUR.

GCOL 0,0 to set the text colour to black.

However, that won't print the text in black on white - you'll need to draw a white rectangle and print the text on top of it.

User avatar
dv8
Posts: 333
Joined: Mon Jun 22, 2009 10:07 pm
Contact:

Re: About BBC Basic 4

Post by dv8 » Sun Jul 12, 2020 3:54 pm

In VDU 5 mode the background colour will be drawn for a delete character, VDU 127:

Code: Select all

10 MODE 4
20 VDU 5
30 GCOL0,0:GCOL0,129
40 MOVE 100,100
50 VDU 9,9,9,9,127,127,127,127
60 PRINT "TEST"
70 VDU 4
This can be improved by changing MOVE to point to the right of the text:

Code: Select all

40 MOVE 228,100
50 VDU 127,127,127,127

drfloyd
Posts: 381
Joined: Tue Jun 09, 2020 3:36 pm
Contact:

Re: About BBC Basic 4

Post by drfloyd » Mon Jul 13, 2020 3:36 pm

Will try

Another thing :

28ko seems very short for my basic program

As the introduction is about 3-4k, perhaps I can separate it from the main program ?

can i use RUN"file" at the end of the first program to launch the second one ? Is it so easy ?

Naomasa298
Posts: 391
Joined: Sat Feb 16, 2013 12:49 pm
Contact:

Re: About BBC Basic 4

Post by Naomasa298 » Mon Jul 13, 2020 3:39 pm

To run another BASIC file, just do CHAIN"file"

It's that easy. But remember, most variables will be lost when you do that.

drfloyd
Posts: 381
Joined: Tue Jun 09, 2020 3:36 pm
Contact:

Re: About BBC Basic 4

Post by drfloyd » Mon Jul 13, 2020 3:54 pm

great !

Yes the variables will be ALL in the second program.

thanks

drfloyd
Posts: 381
Joined: Tue Jun 09, 2020 3:36 pm
Contact:

Re: About BBC Basic 4

Post by drfloyd » Tue Jul 14, 2020 11:01 am

I don't know if there is a PC Tool for creating pictures on format BBC computer?

(I create it with my PC and convert direct to BBC format)

it's for the introduction of my game.

Naomasa298
Posts: 391
Joined: Sat Feb 16, 2013 12:49 pm
Contact:

Re: About BBC Basic 4

Post by Naomasa298 » Tue Jul 14, 2020 12:50 pm

I don't know if there is one, probably yes but I just wrote my own.

User avatar
jms2
Posts: 2678
Joined: Mon Jan 08, 2007 6:38 am
Location: Derby, UK
Contact:

Re: About BBC Basic 4

Post by jms2 » Tue Jul 14, 2020 12:55 pm


drfloyd
Posts: 381
Joined: Tue Jun 09, 2020 3:36 pm
Contact:

Re: About BBC Basic 4

Post by drfloyd » Wed Jul 15, 2020 3:42 pm

i will have a look !

Another thing :

I divide my screen into a text bloc at the bottom and a graphic bloc at the top

TEXT ZONE
VDU 28,0,31,39,25 it works, it give me 7 lines at the bottom... when I use CLS it clear only text

GRAPHIC ZONE
VDU 24,0;350;1279;1023 BUT when i do CLG it clear the graphics but also all the texts at the bottom ! ???

Cannot understand why

User avatar
BigEd
Posts: 3452
Joined: Sun Jan 24, 2010 10:24 am
Location: West
Contact:

Re: About BBC Basic 4

Post by BigEd » Wed Jul 15, 2020 3:57 pm

At least, you need another semicolon after the 1023.

Not sure about your 350- that leaves a gap. 224 would be no gap, I think.

drfloyd
Posts: 381
Joined: Tue Jun 09, 2020 3:36 pm
Contact:

Re: About BBC Basic 4

Post by drfloyd » Wed Jul 15, 2020 8:11 pm

oh my god just because of a ; !!!!!

Thank you very much

Post Reply

Return to “programming”