Page 10 of 11

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

Posted: Fri 06 Mar, 2009 4:47 pm
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.

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

Posted: Fri 06 Mar, 2009 6:09 pm
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.

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

Posted: Fri 06 Mar, 2009 8:27 pm
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.

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

Posted: Tue 26 May, 2009 10:21 am
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...

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

Posted: Tue 26 May, 2009 11:03 am
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?

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

Posted: Tue 26 May, 2009 11:10 am
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.

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

Posted: Tue 26 May, 2009 2:44 pm
by tr1p1ea

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

Posted: Tue 26 May, 2009 3:25 pm
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.

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

Posted: Tue 26 May, 2009 3:41 pm
by tr1p1ea
Yeah it would require a small nostub program either way most likely.

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

Posted: Tue 26 May, 2009 3:44 pm
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.

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

Posted: Wed 27 May, 2009 2:28 pm
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"

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

Posted: Wed 10 Jun, 2009 10:37 pm
by builderboy
Is it true that inkey(0) cannot poll the 2nd, Alpha, or any of the F1-F5 keys? And if so, why?

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

Posted: Thu 11 Jun, 2009 12:26 am
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.

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

Posted: Thu 11 Jun, 2009 2:30 am
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... :(

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

Posted: Thu 11 Jun, 2009 10:50 am
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.