News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu
avatar_ComSoft6128

BASIC beginner questions

Started by ComSoft6128, 17:23, 10 December 19

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

ComSoft6128

Found this at the weekend - DISPRAV.BAS (Display Raven)

It's at least twenty five years old and I don't know if it was a PD program or if someone wrote it for me as a demonstration file.


https://www.youtube.com/watch?v=5RMVQZBuSn8

Questions:

1. Line 50 seems to show a loop going back to Line 30 - Why?
    If all the program does is to load/display a screen what purpose does this serve?

2. Does Locomotive BASIC support wildcards?
    I.E. In Line 20 the filename is shown - would it be be possible to replace this with *.scr and load in multiple Mode 2 files?

Thanks,

Peter

AMSDOS

#1
Quote from: ComSoft6128 on 17:23, 10 December 19
Found this at the weekend - DISPRAV.BAS (Display Raven)

It's at least twenty five years old and I don't know if it was a PD program or if someone wrote it for me as a demonstration file.

<snip>

Quote
Questions:

1. Line 50 seems to show a loop going back to Line 30 - Why?
    If all the program does is to load/display a screen what purpose does this serve?


Apart from preventing Ready from being displayed, which a 50 GOTO 50 would also do, that GOTO 30 points to a FOR loop which acts as a Delay, so when that delay is reached, line 40 sets the screen inks to Bright White Background & Border with Black Foreground. Playing with that line you could change it to:



40 INK 0,INT(RND*27):INK 1,INT(RND*27):BORDER INT(RND*27)


so after the FOR loop completes its cycle, the colours change.

Quote2. Does Locomotive BASIC support wildcards?
    I.E. In Line 20 the filename is shown - would it be be possible to replace this with *.scr and load in multiple Mode 2 files?

Thanks,

Peter


No, the wildcards can only be used through the RSX commands AMSDOS provides for example, so things like LOAD which are BASIC Commands won't work. There was that Graph Programme you had earlier though from the AA Covertape which came with that unusual Menu Selection programme, which wasn't working correctly for 464 Users which placed Filenames into a string. I think it had something like this, though I've altered it a little bit, so it would be possible to load a file with a random number:


10 a$="file"
20 n=INT(RND*5)+1
30 n$=a$+MID$(STR$(n),2,1)+".scr"
40 LOAD n$
50 FOR a=1 TO 8000:NEXT a
60 GOTO 20



This example works by using a screen file called "file" and a random number is stored into the n variable between 1 and 5 (line 20), line 30 puts all that information together because the random number produced is a number, it needs to be converted into a String, which is what STR$(n) does, but because STR$ places a Space inbetween the start of the line and the number I want to use, MID$ is used to remove the Space, however RIGHT$(STR$(n),1) works just as well, so the line would read:



30 n$=a$+RIGHT$(STR$(n),1)+".scr"



Line 40 - Loads the Screen (hopefully to the screen), and so on....
* Using the old Amstrad Languages :D   * with the Firmware :P
* I also like to problem solve code in BASIC :)   * And type-in Type-Ins! :D

Home Computing Weekly Programs
Popular Computing Weekly Programs
Your Computer Programs
Updated Other Program Links on Profile Page (Update April 16/15 phew!)
Programs for Turbo Pascal 3

Powered by SMFPacks Menu Editor Mod