MaxCoderz

for your 1 bit pleasure!

All times are UTC




Post new topic Reply to topic  [ 13 posts ] 
Author Message
 Post subject: Interested
PostPosted: Mon 24 Aug, 2009 1:11 am 
Offline
New Member

Joined: Mon 24 Aug, 2009 12:50 am
Posts: 5
I want to try out a few things in BBC BASIC, but it's so similar to other variations of BASIC I don't feel like going through loads of documentation and beginner tutorials because of a few slight differences. Is there some BBC BASIC syntax checker somewhere so I can just go with trial and error?

Also, how can I store information and retrieve it after the calculator has been reset?


Top
 Profile  
Reply with quote  
 Post subject: Re: Interested
PostPosted: Mon 24 Aug, 2009 1:23 am 
Offline
New Member

Joined: Mon 24 Aug, 2009 1:19 am
Posts: 1
There is an extensive manual here. It has really helped me get to know BBC in the past few days that I've been learning it.


Top
 Profile  
Reply with quote  
 Post subject: Re: Interested
PostPosted: Mon 24 Aug, 2009 1:32 am 
Offline
New Member

Joined: Mon 24 Aug, 2009 12:50 am
Posts: 5
The point is that I don't want to waste my time reading loads of documentation because of a few minor differences between BBC and QBasic. I don't have the attention span for this. If I need to do that, I'll do it, but I'm trying to facilitate the process.


Top
 Profile  
Reply with quote  
 Post subject: Re: Interested
PostPosted: Mon 24 Aug, 2009 4:18 am 
Offline
New Member

Joined: Mon 28 Apr, 2008 8:53 pm
Posts: 5
Location: anywhere, everywhere
Ok, then why don't you just look at some example programs, or some BBC Basic programs in general? If you know QBasic, then it shouldn't be that hard to grasp when experimenting/viewing pre-made code, that should satisfy your needs.


Top
 Profile  
Reply with quote  
 Post subject: Re: Interested
PostPosted: Mon 24 Aug, 2009 11:15 am 
Offline
Maxcoderz Staff
User avatar

Joined: Thu 16 Dec, 2004 10:06 pm
Posts: 3064
Location: Croydon, England
ColdPerson wrote:
I don't have the attention span for this.
That's not really a good thing for a programmer to admit to, is it? ;)

Off the top of my head, two main differences you may run into are indirection operators (instead of PEEK and POKE) and the way procedures and functions are declared. In fact, if you just skim the "Overview" section of the documentation, that may help.

BBC BASIC shouldn't be too "surprising" - it was designed to be easy for beginners yet powerful enough for advanced users.

If you want to use a more comfortable environment to learn BBC BASIC in, you can download a trial of the Windows version.
Quote:
Also, how can I store information and retrieve it after the calculator has been reset?
You would need to store it in the archive (go into the memory manager, put the cursor next to the variable to archive, and press Enter - a * will appear next to archived variables). The TI-OS does not make it possible to take control of this process, so you cannot archive variables within BBC BASIC (you can, however, read archived variables transparently).


Top
 Profile  
Reply with quote  
 Post subject: Re: Interested
PostPosted: Mon 24 Aug, 2009 4:01 pm 
Offline
New Member

Joined: Wed 10 Jun, 2009 9:58 pm
Posts: 17
benryves wrote:
The TI-OS does not make it possible to take control of this process, so you cannot archive variables within BBC BASIC (you can, however, read archived variables transparently).


:? What about the countless programs such as CelticII and Darkerlines tiny unarchiver that are floating around. I know it is possible, but maybe impossible with applications?


Top
 Profile  
Reply with quote  
 Post subject: Re: Interested
PostPosted: Mon 24 Aug, 2009 6:18 pm 
Offline
New Member

Joined: Mon 24 Aug, 2009 12:50 am
Posts: 5
Alright, I have a basic idea of how BBCB works.
I made some program to view the value returned by GET, then ask the user if he/she wants to do it again (to save time).
Code:
   80 INPUT "Try again? " : key% = GET : PRINT
   90 CASE key% OF
  100 WHEN 121,89
  110 GOTO 10
  120 WHEN 110,78
  130 CLS
  140 END
  150 OTHERWISE
  160 PRINT "Wrong answer, enter Y or N."
  170 PRINT
  180 GOTO 80
  190 ENDCASE

It works on the computer, but not on the calculator, it says there's a mistake on line 90, so I assume CASE is not on Z80 BBC BASIC. Am I forced to use IF/ELSE or is there an alternative?

Also, what I meant by saving data to access it later was more like some substitute for QB's OPEN. I'm trying to port some dumb program I made last year in QB to BBCB before getting into more complex stuff, I was too lazy and never learned how to use graphics in QB.


Top
 Profile  
Reply with quote  
 Post subject: Re: Interested
PostPosted: Mon 24 Aug, 2009 8:32 pm 
Offline
Maxcoderz Staff
User avatar

Joined: Thu 16 Dec, 2004 10:06 pm
Posts: 3064
Location: Croydon, England
builderboy wrote:
benryves wrote:
The TI-OS does not make it possible to take control of this process, so you cannot archive variables within BBC BASIC (you can, however, read archived variables transparently).


:? What about the countless programs such as CelticII and Darkerlines tiny unarchiver that are floating around. I know it is possible, but maybe impossible with applications?
Unarchiving is easy, yes; archiving, no. You have to go via the TI-OS to copy data to the archive, and as BBC BASIC leaves the calculator in a state that is not compatible with the TI-OS (custom interrupt handler, allocated memory, use of all registers including the shadow registers) this would cause a crash.
ColdPerson wrote:
It works on the computer, but not on the calculator, it says there's a mistake on line 90, so I assume CASE is not on Z80 BBC BASIC. Am I forced to use IF/ELSE or is there an alternative
You assume correctly; there is no CASE in older versions of BBC BASIC (sorry). In this case, IF would appear to be the easiest solution. However, I must warn you that - again - in older versions of BBC BASIC, there are no multi-line IF statements.
Code:
   10 playingGame=TRUE
   20 REPEAT
   30   REM Do something:
   40   PRINT "<insert game here>"
   50   REM Prompt to repeat:
   60   tryAgainPrompting=TRUE
   70   REPEAT:INPUT "Try again",key$
   80     IF key$="n" OR key$="N" playingGame=FALSE ELSE IF key$="y" OR key$="Y" tryAgainPrompting=FALSE ELSE PRINT "Wrong answer, enter Y or N."
   90   UNTIL NOT(tryAgainPrompting AND playingGame)
  100 UNTIL NOT(playingGame)
  110 REM End of program.
  120 CLS
  130 END
If the values to test for are sequential (eg Left/Right/Down/Up, 136/137/138/139) you can use ON:
Code:
   10 REM Key input loop
   20 REPEAT
   30   ON GET-135 PROC_Left,PROC_Right,PROC_Down,PROC_Up ELSE : REM Dummy ELSE on the end to avoid errors.
   40 UNTIL FALSE
   50 REM Procedures to handle the up/down/left/right keys:
   60 DEF PROC_Up PRINT "Up":ENDPROC
   70 DEF PROC_Down PRINT "Down":ENDPROC
   80 DEF PROC_Left PRINT "Left":ENDPROC
   90 DEF PROC_Right PRINT "Right":ENDPROC

Quote:
Also, what I meant by saving data to access it later was more like some substitute for QB's OPEN. I'm trying to port some dumb program I made last year in QB to BBCB before getting into more complex stuff, I was too lazy and never learned how to use graphics in QB.
See OPENIN, OPENOUT and OPENUP for read/write/read+write file access respectively.


Top
 Profile  
Reply with quote  
 Post subject: Re: Interested
PostPosted: Mon 24 Aug, 2009 9:12 pm 
Offline
New Member

Joined: Mon 24 Aug, 2009 12:50 am
Posts: 5
Alright, looks super ugly now but it works, thanks for the clarification.
Was an old version of BBCB ported due to compatibility issues?
Also, printing GET displays the number near the center, why is that, and can it be 'fixed' to be printed on the left?


Top
 Profile  
Reply with quote  
 Post subject: Re: Interested
PostPosted: Mon 24 Aug, 2009 9:53 pm 
Offline
Maxcoderz Staff
User avatar

Joined: Thu 16 Dec, 2004 10:06 pm
Posts: 3064
Location: Croydon, England
ColdPerson wrote:
Alright, looks super ugly now but it works, thanks for the clarification.
Was an old version of BBCB ported due to compatibility issues?
The Z80 and original 6502 versions were written in the 1980s, the Windows version has had a lot more work done on it in the intervening period. :) I've added some of the newer keywords via error handler hacks (eg EXIT, WHILE) but some of the other features would be difficult or impossible to implement in this manner.
Quote:
Also, printing GET displays the number near the center, why is that, and can it be 'fixed' to be printed on the left?
Print Format Control. Alternatively, use STR$() which defaults to G9 format (no leading spaces).

Don't forget that GET$ returns a string!


Top
 Profile  
Reply with quote  
 Post subject: Re: Interested
PostPosted: Mon 24 Aug, 2009 10:09 pm 
Offline
New Member

Joined: Wed 10 Jun, 2009 9:58 pm
Posts: 17
benryves wrote:
Unarchiving is easy, yes; archiving, no. You have to go via the TI-OS to copy data to the archive, and as BBC BASIC leaves the calculator in a state that is not compatible with the TI-OS (custom interrupt handler, allocated memory, use of all registers including the shadow registers) this would cause a crash.


Ah, i see. good to know :)


Top
 Profile  
Reply with quote  
 Post subject: Re: Interested
PostPosted: Tue 25 Aug, 2009 6:08 pm 
Offline
New Member

Joined: Mon 24 Aug, 2009 12:50 am
Posts: 5
a) Would there be a way to build an app containing a single standalone program and the necessary BBCB commands instead of having to run a program FROM the BBCB app?
b) How many characters (in the small font) fit on the TI-83+'s screen on both axis?
c) Is there an ASCII character map for the possible CHR$ values? How many values are there in total?
As for OPENIN/OPENOUT, where can the data be stored, in a static variable?

Thanks for the help.


Top
 Profile  
Reply with quote  
 Post subject: Re: Interested
PostPosted: Tue 25 Aug, 2009 6:35 pm 
Offline
Maxcoderz Staff
User avatar

Joined: Thu 16 Dec, 2004 10:06 pm
Posts: 3064
Location: Croydon, England
ColdPerson wrote:
a) Would there be a way to build an app containing a single standalone program and the necessary BBCB commands instead of having to run a program FROM the BBCB app?
Not currently, no.
Quote:
b) How many characters (in the small font) fit on the TI-83+'s screen on both axis?
By default, 24x10.
Quote:
c) Is there an ASCII character map for the possible CHR$ values? How many values are there in total?
The only difference with ASCII I can think of is that &60 is £ instead of `. Only the first 128 characters are defined, and even then only printable characters are defined.
Quote:
As for OPENIN/OPENOUT, where can the data be stored, in a static variable?
I'm not sure I follow what you mean. For files, the type of TI-OS variable (Prgm, AppVar or Pic) depends on the extension (eg .VAR for AppVars).


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 13 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB ® Forum Software © phpBB Group | DVGFX2 by: Matt