[News] BBC BASIC Beta Testing - 2009/03/06 r720

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

Moderator: benryves

User avatar
benryves
Maxcoderz Staff
Posts: 3087
Joined: Thu 16 Dec, 2004 10:06 pm
Location: Croydon, England
Contact:

Re: [News] BBC BASIC Beta Testing - 2009/02/18 r718

Post by benryves »

As mentioned above, it seems to be reading the wrong pixel on the screen (if you fill the entire screen black or white it returns the correct values). I'm really sorry about that, I'll work on it as soon as I have a chance and upload a fixed version!

One thing that bothers me with the hand-assembled code is

Code: Select all

180 S%?15=&BEF
That will only load &EF, as ? deals with a byte at a time.
bwang
New Member
Posts: 25
Joined: Tue 11 Nov, 2008 7:36 pm

Re: [News] BBC BASIC Beta Testing - 2009/02/18 r718

Post by bwang »

The S%?15=&BEF is a typo, I meant for it to be S%?15=&EF. Fortunately, the code worked despite the typo.
User avatar
benryves
Maxcoderz Staff
Posts: 3087
Joined: Thu 16 Dec, 2004 10:06 pm
Location: Croydon, England
Contact:

Re: [News] BBC BASIC Beta Testing - 2009/02/18 r718

Post by benryves »

Hopefully the latest version should fix the POINT bugs:

Code: Select all

   10 DIM S% 19
   20 P%=S%
   30 plotSScreen=&9340
   40 MemClear=&4C30
   50 [OPT 2
   60 LD HL,plotSScreen+12
   70 LD DE,plotSScreen
   80 LD BC,756
   90 LDIR
  100 EX DE,HL
  110 LD BC,12
  120 RST &28:DEFW MemClear
  130 RET:]
  140 *GSCALE 1
  150 CLG
  160 *REFRESH OFF
  170 *FX4,1
  180 *FX11,8
  190 *ESCOFF
  200 D%=1
  210 A%=32
  220 U%=48
  230 REPEAT
  240   CALL S%:CALL S%
  250   RECTANGLE FILL A%+32,0,96-A%,1
  260   RECTANGLE FILL 0,0,A%,1
  270   IF RND(1)<.5 A%=A%-1 ELSE A%=A%+1
  280   IF A%<0 A%=0
  290   IF A%>63 A%=63
  300   IF POINT(U%,39)=0 EXIT REPEAT
  310   RECTANGLE FILL U%,40,0,1
  320   K%=INKEY0
  330   IF K%<>0 U%=U%+(K%=136)-(K%=137)
  340   *REFRESH
  350 UNTIL K%=13 OR K%=27
  360 *REFRESH
  370 WAIT 100
  380 *REFRESH ON
  390 CLG:CLS
  400 *FX4,0
  410 *FX11,32
  420 *ESCON
Edit: I didn't mean to kill the thread; the game plays well. :) The above code is slightly amended from your original code to work with the new POINT code. It uses Z80 assembly (easier to read) in place of poking hand-assembled code, and *FX11 sets the initial keyboard repeat delay.
Kiruahxh
New Member
Posts: 15
Joined: Tue 13 Jan, 2009 8:41 pm

Re: [News] BBC BASIC Beta Testing - 2009/03/06 r720

Post by Kiruahxh »

I think your APP is lacking something, but I dunno if you can code it: :D
It would be great if we could call it from Ti Basic programs. I thought of a code of that kind:

"CH. \"MINES \" *BYE -> str1
Asm(prgmBBCBASIC

Or
"MINES OPTION1(Clear graphic screen: yes/no) OPTION2(Var/Prgm) OPT3(leave BBC at the end of execution: yes/no)... ->Str1
Asm(prgmBBCBASIC

And perhaps that code could use the graphic screen...
User avatar
tr1p1ea
Maxcoderz Staff
Posts: 4141
Joined: Thu 16 Dec, 2004 10:06 pm
Location: I cant seem to get out of this cryogenic chamber!
Contact:

Re: [News] BBC BASIC Beta Testing - 2009/03/06 r720

Post by tr1p1ea »

You want to use some BBC BASIC as a lib? Im not sure that is entirely possible since things might be a little different in BBC BASIC land, but you never know.

Perhaps ben could make a header that you could add to a BBC BASIC program so that if run from the homescreen it would load the APP and then your program automatically?
"My world is Black & White. But if I blink fast enough, I see it in Grayscale."
Image
Image
User avatar
benryves
Maxcoderz Staff
Posts: 3087
Joined: Thu 16 Dec, 2004 10:06 pm
Location: Croydon, England
Contact:

Re: [News] BBC BASIC Beta Testing - 2009/03/06 r720

Post by benryves »

I had thought of that - but the BBC BASIC environment does not play kindly with the TI-OS environment (there's lots of memory shuffling around) so I don't know if it would be possible to call the app then return back to the original "TI-BASIC" program; it's certainly difficult it you wish to retain state (eg graphics colours) between calls to it.

I did experiment with a stub assembly program that could talk to the VDU emulator (and so use BBC BASIC's drawing operations outside BBC BASIC) but couldn't get it to work very nicely. :(

With regard to tr1p1ea's idea - that could work, though I'm not sure the best way to achieve it - a stub assembly program? There needs to be some way to load the app.
User avatar
tr1p1ea
Maxcoderz Staff
Posts: 4141
Joined: Thu 16 Dec, 2004 10:06 pm
Location: I cant seem to get out of this cryogenic chamber!
Contact:

Re: [News] BBC BASIC Beta Testing - 2009/03/06 r720

Post by tr1p1ea »

"My world is Black & White. But if I blink fast enough, I see it in Grayscale."
Image
Image
User avatar
benryves
Maxcoderz Staff
Posts: 3087
Joined: Thu 16 Dec, 2004 10:06 pm
Location: Croydon, England
Contact:

Re: [News] BBC BASIC Beta Testing - 2009/03/06 r720

Post by benryves »

I mean loading the app from a "TI-BASIC" program - I was intending on swapping in the app manually and calling a special entry point to trigger loading the BBC BASIC program, though that ROM call may be useful.
User avatar
tr1p1ea
Maxcoderz Staff
Posts: 4141
Joined: Thu 16 Dec, 2004 10:06 pm
Location: I cant seem to get out of this cryogenic chamber!
Contact:

Re: [News] BBC BASIC Beta Testing - 2009/03/06 r720

Post by tr1p1ea »

Yeah it would require a small nostub program either way most likely.
"My world is Black & White. But if I blink fast enough, I see it in Grayscale."
Image
Image
User avatar
benryves
Maxcoderz Staff
Posts: 3087
Joined: Thu 16 Dec, 2004 10:06 pm
Location: Croydon, England
Contact:

Re: [News] BBC BASIC Beta Testing - 2009/03/06 r720

Post by benryves »

Alternatively, one could detect a BBC BASIC program by checking that its file format was a valid BBC BASIC program. I suppose some sort of hook magic could be used? (I'm unfamiliar with hooks, sorry).

Edit: I should mention that BBC BASIC itself (ie, the bit by Richard Russell) is designed with this sort of use in mind, and by setting a flag when initialising you can get it to automatically CHAIN a program for you.
King Harold
Calc King
Posts: 1513
Joined: Sat 05 Aug, 2006 7:22 am

Re: [News] BBC BASIC Beta Testing - 2009/03/06 r720

Post by King Harold »

I think I'd hook into the "prgm" executing hook, well, that is, use the parser hook and then check whether the token was a "prgm"
builderboy
New Member
Posts: 17
Joined: Wed 10 Jun, 2009 9:58 pm

Re: [News] BBC BASIC Beta Testing - 2009/03/06 r720

Post by builderboy »

Is it true that inkey(0) cannot poll the 2nd, Alpha, or any of the F1-F5 keys? And if so, why?
User avatar
benryves
Maxcoderz Staff
Posts: 3087
Joined: Thu 16 Dec, 2004 10:06 pm
Location: Croydon, England
Contact:

Re: [News] BBC BASIC Beta Testing - 2009/03/06 r720

Post by benryves »

2nd and Alpha are modifier keys and as such cannot return any meaningful ASCII code when pressed on their own (they instead affect the codes returned by pressing other keys).

On the BBC Micro, you could define the function of the various function keys in software. For example,

Code: Select all

*KEY 3 Hello
would make the f3 key "type" Hello every time it was pressed. This would probably be a useful feature to implement on the TI version, so I'll see if I can get around to that when I have some spare time. :)

You can always poll the particular keys using the key's scancode as documented in the INKEY reference. For example,

Code: Select all

f3pressed=INKEY(-116)
works on the BBC Micro, Windows and the TI calculator versions.
builderboy
New Member
Posts: 17
Joined: Wed 10 Jun, 2009 9:58 pm

Re: [News] BBC BASIC Beta Testing - 2009/03/06 r720

Post by builderboy »

Yeah, I knew about the inkey(negative) part, but that won't allow you to use quick key repeat

Oh well, maybe i will need to write my own quick key repeater... :(
User avatar
benryves
Maxcoderz Staff
Posts: 3087
Joined: Thu 16 Dec, 2004 10:06 pm
Location: Croydon, England
Contact:

Re: [News] BBC BASIC Beta Testing - 2009/03/06 r720

Post by benryves »

Oh, I can see how that would be a problem. :(

*KEY does allow some keys to be redefined, but not any of the modifiers. Implementing it would help you with F1-F5, but not help with 2nd or Alpha. The ability to change the functionality of 2nd or Alpha could have knock-on effects for usability though (eg changing Alpha would prevent the user from typing the * in *BYE) unless I made INKEY(n≥0) a special case.
Post Reply