Interested

Porting Richard Russell's BBC BASIC (Z80) to the TI-83+ and TI-84+ series calculators.

Moderator: benryves

Post Reply
ColdPerson
New Member
Posts: 5
Joined: Mon 24 Aug, 2009 12:50 am

Interested

Post by ColdPerson »

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?
linkmaster03
New Member
Posts: 1
Joined: Mon 24 Aug, 2009 1:19 am

Re: Interested

Post by linkmaster03 »

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.
ColdPerson
New Member
Posts: 5
Joined: Mon 24 Aug, 2009 12:50 am

Re: Interested

Post by ColdPerson »

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.
tribal
New Member
Posts: 5
Joined: Mon 28 Apr, 2008 8:53 pm
Location: anywhere, everywhere

Re: Interested

Post by tribal »

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.
User avatar
benryves
Maxcoderz Staff
Posts: 3089
Joined: Thu 16 Dec, 2004 10:06 pm
Location: Croydon, England
Contact:

Re: Interested

Post by benryves »

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.
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).
builderboy
New Member
Posts: 17
Joined: Wed 10 Jun, 2009 9:58 pm

Re: Interested

Post by builderboy »

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?
ColdPerson
New Member
Posts: 5
Joined: Mon 24 Aug, 2009 12:50 am

Re: Interested

Post by ColdPerson »

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: Select all

   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.
User avatar
benryves
Maxcoderz Staff
Posts: 3089
Joined: Thu 16 Dec, 2004 10:06 pm
Location: Croydon, England
Contact:

Re: Interested

Post by benryves »

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: Select all

   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: Select all

   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
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.
ColdPerson
New Member
Posts: 5
Joined: Mon 24 Aug, 2009 12:50 am

Re: Interested

Post by ColdPerson »

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?
User avatar
benryves
Maxcoderz Staff
Posts: 3089
Joined: Thu 16 Dec, 2004 10:06 pm
Location: Croydon, England
Contact:

Re: Interested

Post by benryves »

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.
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!
builderboy
New Member
Posts: 17
Joined: Wed 10 Jun, 2009 9:58 pm

Re: Interested

Post by builderboy »

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 :)
ColdPerson
New Member
Posts: 5
Joined: Mon 24 Aug, 2009 12:50 am

Re: Interested

Post by ColdPerson »

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.
User avatar
benryves
Maxcoderz Staff
Posts: 3089
Joined: Thu 16 Dec, 2004 10:06 pm
Location: Croydon, England
Contact:

Re: Interested

Post by benryves »

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.
b) How many characters (in the small font) fit on the TI-83+'s screen on both axis?
By default, 24x10.
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.
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).
Post Reply