SpecBAS problem with manual

Y'know, other stuff, Sinclair related.
Post Reply
llewelyn
Manic Miner
Posts: 205
Joined: Thu Feb 22, 2018 3:27 pm
Location: virginias eastern shore
Contact:

SpecBAS problem with manual

Post by llewelyn »

Hi Paul, I'm about ready to scream and swear and say extremely rude things! Why? I downloaded SpecBAS and its too small for me to see and the window magnify button doesnt work and it wont let me stretch it from the edges either!

But wait...it gets worse'

So I try to read the manual but I dont have and refuse to pay for Word so Wordpad says it cant read it without a converter program that Windows Defender strongly warns me not to download. I actually use Jarte which is a front end that piggybacks onto Wordpad and its the site saying you need this converter that it strongly recommends you dont use!

So what can I do - I'm an old fart I can hardly see, I usually write in 16pt type.
User avatar
ZXDunny
Manic Miner
Posts: 498
Joined: Tue Nov 14, 2017 3:45 pm

Re: SpecBAS problem with manual

Post by ZXDunny »

Firstly, you can use the commands:

OPTION "edfontscalex",2
OPTION "edfontscaley",2

Which will double the size of the editor fonts. You can make this permanent by adding them to a BASIC program saved to "s:startup-sequence" like so:

Code: Select all

10 OPTION "edfontscalex",2: OPTION "edfontscaley",2
and then as a direct command:

SAVE "s:startup-sequence"

And the next time you start SpecBAS, you'll get double sized fonts (but only in the editor).

Secondly, SpecBAS runs at 800x480 by default. If you change that to 400x240, you'll get half the pixels in the same window size - effectively doubling not just the size of fonts in the editor, but also when running programs. Of course, you get less screen space that way.

So instead of the above OPTION commands, put this in your s:startup-sequence program instead:

Code: Select all

10 WINDOW SIZE 0,400,240
And SAVE "s:startup-sequence" as before to set it as permanent.


As for the manual -

Download and install Libre Office. It's not Microsoft, and it loads word documents just fine - and it's free to boot. I'll see about a .rtf version of the manual soon (I'm on holiday at present!). The manual is pretty much outdated now anyway (though it does cover the basics well enough).
llewelyn
Manic Miner
Posts: 205
Joined: Thu Feb 22, 2018 3:27 pm
Location: virginias eastern shore
Contact:

Re: SpecBAS problem with manual

Post by llewelyn »

Thankyou Paul. I apologize for interrupting your holiday. I am afraid to have to admit that I have no idea about startup sequences or even where to look for them. I just double click on SpecBAS and away it goes.

I'm sort of compensating by using the Windows magnifier, its not the best solution but it is better than nothing. Also what keypresses do I use to BREAK into the program. Its running and wont give me back the command line and the input s for stop command I put in doesnt work.
User avatar
ZXDunny
Manic Miner
Posts: 498
Joined: Tue Nov 14, 2017 3:45 pm

Re: SpecBAS problem with manual

Post by ZXDunny »

llewelyn wrote: Sun Aug 18, 2019 10:17 pm Thankyou Paul. I apologize for interrupting your holiday. I am afraid to have to admit that I have no idea about startup sequences or even where to look for them. I just double click on SpecBAS and away it goes.

I'm sort of compensating by using the Windows magnifier, its not the best solution but it is better than nothing. Also what keypresses do I use to BREAK into the program. Its running and wont give me back the command line and the input s for stop command I put in doesnt work.
For the "s" directory, look in c:\users\<username>\specbas\ - it's in there. But you don't need to know that - just use the commands I outlined. SpecBAS knows where the "s" directory is, and so SAVE "s:startup-sequence" will save it there directly, and SpecBAS loads and runs that file on startup or NEW.

To break into a program, just press ESCape on your keyboard :)
llewelyn
Manic Miner
Posts: 205
Joined: Thu Feb 22, 2018 3:27 pm
Location: virginias eastern shore
Contact:

Re: SpecBAS problem with manual

Post by llewelyn »

I did what you said. Changed that file in the S directory to get lower resolution, bigger pixels but it still is the same size window. So why isn't that window full screen at the higher resolution?

I just edited this because I mistakenly thought the s file hadnt been read at startup but of course it has, the on screen type is larger. I just glanced at the empty window and thought it hadn't changed size therefore the file wasnt read but it was.

ESC did not break into the program, I had to reload SpecBAS and type NEW to lose that poisonous listing. I'm not moaning but I just thought you might want to know about the ESC option.

BTW thanks for all your hard work. I like SpecBAS its much easier than trying to type in ZXBasic with a PC keyboard and having to make a big conversion chart to find out what to do to get the 48k multiple choice keys. Fuse has a HELP keyboard picture but its tiny and wont magnify except by using the Windows magnifier which though helpful is a bit clumsy - well doesnt that sum up most Windows accessories? Paint, the Calculator etc. etc. I suppose the idea is to make you mad enough to BUY some REAL software. NOTHING would make me buy Office or Word which is a sucko word processor anyway.
Last edited by llewelyn on Sun Aug 18, 2019 11:19 pm, edited 1 time in total.
User avatar
ZXDunny
Manic Miner
Posts: 498
Joined: Tue Nov 14, 2017 3:45 pm

Re: SpecBAS problem with manual

Post by ZXDunny »

llewelyn wrote: Sun Aug 18, 2019 10:56 pm I did what you said. Changed that file in the S directory to get smaller resolution, bigger pixels but when I click the SpecBAS64 (or 32 I tried that too) it doesn't seem to use it because it still is the same size window BUT the editor is now twice size thanks to the OPTION choice so thats okay I can live with it being small on the main screen.

ESC did not break into the program, I had to reload SpecBAS and type NEW to lose that poisonous listing. I'm not moaning but I just thought you might want to know the above about the startup and ESC option.
Send me the offending program - ESC should always work no matter what the situation.

You can paste it here, or send it to my email address ( [email protected] ).

The WINDOW SIZE 0,w,h command should work though. I'll post a new version of SpecBAS tomorrow, test it in that.
llewelyn
Manic Miner
Posts: 205
Joined: Thu Feb 22, 2018 3:27 pm
Location: virginias eastern shore
Contact:

Re: SpecBAS problem with startup

Post by llewelyn »

My bad. See above - it DID work but the ESC didnt. Cannot send that file its been nuked.
User avatar
ZXDunny
Manic Miner
Posts: 498
Joined: Tue Nov 14, 2017 3:45 pm

Re: SpecBAS problem with startup

Post by ZXDunny »

llewelyn wrote: Sun Aug 18, 2019 11:20 pm My bad. See above - it DID work but the ESC didnt. Cannot send that file its been nuked.
Can you remember which command (or sequence of commands) caused ESC to stop working? Trust me, it's important.
llewelyn
Manic Miner
Posts: 205
Joined: Thu Feb 22, 2018 3:27 pm
Location: virginias eastern shore
Contact:

Re: SpecBAS problem with manual

Post by llewelyn »

This program doesnt stop for anything (including ESC)

PROG blob
100 LET x=10: LET y=36
120 PRINT AT x,y;"O"
130 PRINT "Press 1 for left, 2 for right"
140 PRINT "Waiting for input. Choose and press enter"
150 INPUT d
160 IF d=1 THEN LET x=x-1
165 IF d$="s" THEN STOP
170 GO TO 120
User avatar
ZXDunny
Manic Miner
Posts: 498
Joined: Tue Nov 14, 2017 3:45 pm

Re: SpecBAS problem with manual

Post by ZXDunny »

llewelyn wrote: Sun Aug 18, 2019 11:49 pm This program doesnt stop for anything (including ESC)

PROG blob
100 LET x=10: LET y=36
120 PRINT AT x,y;"O"
130 PRINT "Press 1 for left, 2 for right"
140 PRINT "Waiting for input. Choose and press enter"
150 INPUT d
160 IF d=1 THEN LET x=x-1
165 IF d$="s" THEN STOP
170 GO TO 120
INPUT most certainly will halt your program, and ESC will definitely work. Unfortunately your program causes a "Variable not found" error, as D$ isn't defined.
llewelyn
Manic Miner
Posts: 205
Joined: Thu Feb 22, 2018 3:27 pm
Location: virginias eastern shore
Contact:

Re: SpecBAS problem with manual

Post by llewelyn »

Is it possible that my version is corrupted, maybe just a few bytes somewhere? When I downloaded the file it got interrupted by the modem losing signal and then restarted only a minute or two later...

Because that listing I provided still causes the program to lockup and ESC still wont BREAK into it so I have to pull the plug on the program SpecBAS and reload it. The old file still comes up as a listing but as long as I dont RUN it I can erase it and start again.

Since you couldn't duplicate the error it seems to me the only possible answer is a corrupted file somewhere. I won't give up but I must find a foolproof way to stop an endless loop. Last time I had to pull the battery on my laptop because I couldnt escape to Windows either.

I have just nuked my SpecBAS being almost certain its corrupted. Please point me to a source for a new one.

PS:- I just got the version from 2015 that your SpecBAS forum provides. So far, so good!
AND the ESC key works like you said. Therefore a corrupted file it must have been.
llewelyn
Manic Miner
Posts: 205
Joined: Thu Feb 22, 2018 3:27 pm
Location: virginias eastern shore
Contact:

Re: SpecBAS working

Post by llewelyn »

PROG sublander.bas
20 REM PROGRAM LANDER
30 REM set up variables first
40 REM x and y = start position of blob
100 LET x=10: LET y=50
120 PRINT AT x,y;"O"
130 IF x=50 THEN STOP
135 GO SUB 510
500 REM subroutine DESCEND
510 PAUSE 30
520 PRINT AT x,y;" "
530 LET x=x+1
535 GO TO 120
540 RETURN

Hey it all works! Check it out my SpecBAS first module but it all works as meant to. Please note the daring first time use of a subroutine and setting up the variables first. Laugh as much as you like experts, this for me is a major hooray. Now I have to figure out how to do the Left/Right control options and its that which caused me problems before and the manual info about INPUT is a bit scant so thats why I'm doing it one module at a time to see what works best and then hopefully I can MERGE or if necessary type it all in finally as one long listing.
ASH-II
Drutt
Posts: 11
Joined: Sun Jun 16, 2019 11:48 am

Re: SpecBAS problem with manual

Post by ASH-II »

20 REM PROGRAM LANDER
30 REM set up variables first
40 REM x and y = start position of blob
100 LET x=10: LET y=50
120 PRINT AT x,y;SCALE 4,4;"O"
130 IF x=50 THEN STOP
135 GO SUB 510
500 REM subroutine DESCEND
510 WAIT 300
520 PRINT AT x,y;SCALE 4,4;" "
525 IF KEYST KEY_LEFT THEN DEC y,1
526 IF KEYST KEY_RIGHT THEN INC y,1
530 LET x=x+1
535 GO TO 120
540 RETURN

changed the two prints by adding scale (bigger) :)
changed lines 510 pause will cancel with a key press wait wont
added lines 525 and 526 you can use the left and right key of you pc and incrementing or decrementing Y by 1

ps LINE 535 is not needed as the return will jump back to line 135 I would change line 535 to line 140 GOTO 120
you are just adding to the stack (and after about 4 days you will run out of memory :)
llewelyn
Manic Miner
Posts: 205
Joined: Thu Feb 22, 2018 3:27 pm
Location: virginias eastern shore
Contact:

Re: SpecBAS problem with manual

Post by llewelyn »

Thanks o faithful SpecBAS fan - is it just you and me? Paul's post at Wos made it sound like that!

I will try out your suggestion and see how it goes but why such a big WAIT? I thought PAUSE 30 was almost too long but I'll see what happens when I run it. Is there a way to cut and paste? I know you can't do that from SpecBAS you have to save the program and load it into Notepad, well, I guess the reverse is true then. I'll try that.

TRIED IT! Wow! Thanks ASH2. That's very cool, I like that, much more elegant than my approach.
I assume DEC=DECREMENT (-) and INC=INCREMENT (+) those are new commands to me. So is the KEYSTROKE command. Anyway its a good tutorial!
User avatar
ZXDunny
Manic Miner
Posts: 498
Joined: Tue Nov 14, 2017 3:45 pm

Re: SpecBAS problem with manual

Post by ZXDunny »

llewelyn wrote: Mon Aug 19, 2019 6:59 pm Thanks o faithful SpecBAS fan - is it just you and me? Paul's post at Wos made it sound like that!
The problem with the "lock up" is that you're running three threads here:

1. The main window thread which handles the general upkeep of the window (also called a "VCL" thread) - this is the one that waits for keystrokes and mouse movements.

2. The Interpreter thread - this runs constantly executing your code

3. The graphics thread - this prepares what you have done on the screen for display.

The graphics thread can be ignored for this particular instance. What is happening is that the interpreter thread is completely taking over your CPU - so the first (VCL) thread cannot get to the keyboard messages that are coming through from Windows. When you WAIT, the interpreter thread goes to sleep for the specified time and the VCL thread gets to chomp through any waiting messages. Without it, the interpreter never sleeps and so doesn't let anyone else do anything.

This is advantageous in that you can run BASIC very, very fast. But when it comes to either listen to the user or present information to the user, you should let it sleep. This is achieved by the YIELD command (which on its own will simply sleep for 1 millisecond), WAIT n which will sleep for "n" milliseconds, PAUSE n which will sleep for "n" frames or WAIT SCREEN which will wait for the next Vertical Blank (or screen refresh, in english!).

The upshot is that you must force the interpreter to wait in some circumstances or it will just take over the whole system. The Spectrum didn't have this issue because it didn't multi-thread.

I could have the interpreter automatically sleep at set times, but it would drastically slow things down - the smallest resolution you can sleep for in Windows can be as high as 10 milliseconds! And you can't guarantee when it will stop sleeping.

To sum up, if you put a WAIT SCREEN in before you loop around to start again - you'll have no trouble with keystrokes.
I will try out your suggestion and see how it goes but why such a big WAIT? I thought PAUSE 30 was almost too long but I'll see what happens when I run it. Is there a way to cut and paste? I know you can't do that from SpecBAS you have to save the program and load it into Notepad, well, I guess the reverse is true then. I'll try that.
SpecBAS has full clipboard support with CTRL+X for cut, CTRL+C for copy and CTRL+V for paste.
WAIT takes a time in milliseconds, and PAUSE in frames (a frame is roughly 20ms).
TRIED IT! Wow! Thanks ASH2. That's very cool, I like that, much more elegant than my approach.
I assume DEC=DECREMENT (-) and INC=INCREMENT (+) those are new commands to me. So is the KEYSTROKE command. Anyway its a good tutorial!
Yes, INC and DEC are exactly that. the KEYST command is a function - it returns a value. You supply a key to check, and it returns its state (hence KEYSTate) - 1 for pressed, 0 for not pressed. In ASH-II's example he checks the keys KEY_LEFT and KEY_RIGHT which are the left/right cursor keys.

KEY_A is the A key, KEY_B is the B key etc etc.

The line :

525 IF KEYST KEY_LEFT THEN DEC y,1

Is broken down thusly:

1. An IF command. This takes the form IF <expression> THEN <statement>

"expression" must be numeric; that is it must evaluate to a number. If the number is zero, then the IF fails and the statement is ignored. If the number is non-zero then the statement is executed. As you probably already know, the relational operators "=", "<>", "<", ">", "<=" and ">=" work like any other math operators such as "+", "-" etc - they compare both sides of the expression and return a value. for "=" such as "a=b" it will return 0 if a is not equal to b, and 1 if a is equal to b. This is important - you can plug that value (1 or 0) into the IF and treat it like a comparison with

IF a=b THEN...

I hope this all makes sense.

2. The KEYST KEY_LEFT section is the "expression" in the IF command. If the left key is held down, it will return a "1" otherwise it will return "0" - and as with the "a=b" above, we plug that into the IF command.

3. The DEC simply decrements a variable - by 1 if there is no other argument (DEC a) and by n if we have a second argument (DEC a,n).

Hope this is all a bit clearer now.
User avatar
ZXDunny
Manic Miner
Posts: 498
Joined: Tue Nov 14, 2017 3:45 pm

Re: SpecBAS problem with manual

Post by ZXDunny »

Give this new one a try:

https://drive.google.com/open?id=0B6gXs ... WhUZ1Rxc0k

It has new binaries that (hopefully!) address the issues you've been having with keystrokes not triggering in tight loops on slow PCs.
llewelyn
Manic Miner
Posts: 205
Joined: Thu Feb 22, 2018 3:27 pm
Location: virginias eastern shore
Contact:

Re: SpecBAS problem with manual

Post by llewelyn »

Thanks Paul. I've downloaded it and will see how it works out a bit later. I'm in the throes of writing at the moment to keep my readership (all 2 of them) happy! I have to mentally change gears to switch projects.
Post Reply