MaxCoderz

for your 1 bit pleasure!

All times are UTC




Post new topic Reply to topic  [ 159 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6, 7, 8 ... 11  Next
Author Message
PostPosted: Fri 23 Jan, 2009 1:41 pm 
Offline
Maxcoderz Staff
User avatar

Joined: Thu 16 Dec, 2004 10:06 pm
Posts: 3064
Location: Croydon, England
It's nice to be able to see and edit multiple lines at once, and using a cursor you can easily insert edit and delete text anywhere in the file. This is not especially practical on the BBC BASIC command-line, albeit possible with copy-key editing.

It would be possible to write a rich text editor, but it's not a very easy task, and even then it's difficult to convert into a BASIC program (it's possible but slow and unwieldy via *EXEC).

What would be ideal is if I could find out how BBC BASIC tokenises the input text (without having to write my own Z80 tokeniser), that way files in alternative formats could be converted.


Top
 Profile  
Reply with quote  
PostPosted: Fri 23 Jan, 2009 4:44 pm 
Offline
New Member

Joined: Tue 13 Jan, 2009 8:41 pm
Posts: 15
I wondered: could you make an Automatic Power Down?? Or a command to turn off the calc???


Top
 Profile  
Reply with quote  
PostPosted: Fri 23 Jan, 2009 4:58 pm 
Offline
Maxcoderz Staff
User avatar

Joined: Thu 16 Dec, 2004 10:06 pm
Posts: 3064
Location: Croydon, England
Good idea. :) The CPU does drop down to 6MHz and HALTs when waiting for a key but a proper APD would be nice.

Maybe something like:

  • *SLEEP - go immediately into "sleep" mode (LCD off, low power consumption).
  • *SLEEP 500 - set the APD delay to 500cs (5 seconds).
  • *SLEEP OFF - disable the APD completely.


Top
 Profile  
Reply with quote  
PostPosted: Fri 23 Jan, 2009 7:34 pm 
Offline
New Member
User avatar

Joined: Mon 26 Feb, 2007 9:19 pm
Posts: 29
benryves wrote:
Good idea. :) The CPU does drop down to 6MHz and HALTs when waiting for a key but a proper APD would be nice.

Maybe something like:

  • *SLEEP - go immediately into "sleep" mode (LCD off, low power consumption).
  • *SLEEP 500 - set the APD delay to 500cs (5 seconds).
  • *SLEEP OFF - disable the APD completely.
These look pretty good as additions.

Also, is there anyway to just view all of the contents in a file in a nice, scrolling manner? I know how to do things like L.10.200, but it is annoying to have to retype commands like that when you are just viewing the file.

Finally, I did figure out how the bbc file loading / etc system works (I _probably_ should have read through some tutorials on bbc basic first...)! However, after loading a simple 5 line program that I wrote, I used L.250 (I cannot remember the exact number; just that it was way beyond the end of my program) and it gave me a line of text from what looked like the clock program...


Top
 Profile  
Reply with quote  
PostPosted: Fri 23 Jan, 2009 8:58 pm 
Offline
Maxcoderz Staff
User avatar

Joined: Thu 16 Dec, 2004 10:06 pm
Posts: 3064
Location: Croydon, England
benryves wrote:
Also, is there anyway to just view all of the contents in a file in a nice, scrolling manner? I know how to do things like L.10.200, but it is annoying to have to retype commands like that when you are just viewing the file.
Not really. :( If you switch on VDU 14 it will pause the listing after every screen of data, and you can hold 2nd+Alpha to pause listings otherwise. I can see the attraction of having a better set of editing utilities, it's just a matter of finding a good solution.
Quote:
Finally, I did figure out how the bbc file loading / etc system works (I _probably_ should have read through some tutorials on bbc basic first...)! However, after loading a simple 5 line program that I wrote, I used L.250 (I cannot remember the exact number; just that it was way beyond the end of my program) and it gave me a line of text from what looked like the clock program...
Can you find a way to replicate this? If you run a program (eg via CHAIN) then start typing program lines afterwards it will still have the old program in memory. Maybe you accidentally saved the end of a previously loaded program onto yours? (Or it could be a bug, but I know I accidentally merge two programs together from time to time).


Top
 Profile  
Reply with quote  
PostPosted: Sat 24 Jan, 2009 6:59 pm 
Offline
New Member
User avatar

Joined: Mon 26 Feb, 2007 9:19 pm
Posts: 29
I cannot replicate this, so I'll just assume that I accidentally wrote the clock program onto the end of my own program (it is very possible; I wasn't entirely sure of what I was doing at the time).

Also, is there a way to control how you are reading from a file? For example, are there equivalent commands to in.next(), in.nextLine(), in.previous(), in.previousLine(), etc (assuming that in is reading from some file)? Also, it would be cool if there was a way to do something like filename.linenumber to read a specific line from a file...


Top
 Profile  
Reply with quote  
PostPosted: Sat 24 Jan, 2009 7:40 pm 
Offline
Maxcoderz Staff
User avatar

Joined: Thu 16 Dec, 2004 10:06 pm
Posts: 3064
Location: Croydon, England
b-flat wrote:
I cannot replicate this, so I'll just assume that I accidentally wrote the clock program onto the end of my own program (it is very possible; I wasn't entirely sure of what I was doing at the time).
I may be able to put together a star command that deletes ranges of line numbers from a program in case it happens again.
Quote:
Also, is there a way to control how you are reading from a file? For example, are there equivalent commands to in.next(), in.nextLine(), in.previous(), in.previousLine(), etc (assuming that in is reading from some file)?
I'm not 100% sure what you're asking, but there are several ways to control how files are read. INPUT# reads a line from an open file (I guess that's your in.nextLine()); BGET# reads a single byte. Both advance the internal file pointer - which can be read or modified using PTR# - after reading.


Top
 Profile  
Reply with quote  
PostPosted: Sat 24 Jan, 2009 11:56 pm 
Offline
New Member
User avatar

Joined: Mon 26 Feb, 2007 9:19 pm
Posts: 29
Basically, what I am wanting is a routine that will search backwards in the file for the beginning of the previous line and give it, so you can read in both directions. I know that this could be done fairly easily using ptr#, but it would be much nicer to have a routine like that already built in.

Another, optional thing to add to file reading would be something that would allow you to access line x of the file (aka perform a linear search until you have found the start of the xth line). This one isn't as necessary, but it would be nice if you could add it.

Right now, I'm going to attempt to write my own file viewer in BBC Basic (I'll post if I manage to get anything running).


Top
 Profile  
Reply with quote  
PostPosted: Sun 25 Jan, 2009 1:30 am 
Offline
Maxcoderz Staff
User avatar

Joined: Thu 16 Dec, 2004 10:06 pm
Posts: 3064
Location: Croydon, England
One solution that presents itself it is to create an array that stores the offset in the file to each line (updated every time you read a line) from the file; that way you can seek almost instantly to any line in the file by looking up its start offset in the array. The downside is that this take up rather large amount of RAM!

You can always work programmatically, working backwards from the current cursor position looking for a CR (13). Supposing you had a file TEXT.VAR containing the following:
Code:
LINE 1
LINE 2
LINE 3
LINE 4
LINE 5

Then the following program:
Code:
   10 h=OPENIN"TEST.VAR"
   20 INPUT#h,line$:PRINT line$
   30 INPUT#h,line$:PRINT line$
   40 PROC_PrevLine(h):PROC_PrevLine(h)
   50 INPUT#h,line$:PRINT line$
   60 INPUT#h,line$:PRINT line$
   70 INPUT#h,line$:PRINT line$
   80 PROC_PrevLine(h):PROC_PrevLine(h)
   90 INPUT#h,line$:PRINT line$
  100 CLOSE#h
  110 END
  120 :
  130 DEF FN_BPEEK#(h)LOCALB%:B%=BGET#h:PTR#h=PTR#h-1:=B%
  140 DEF PROC_PrevLine(h)
  150 PTR#h=PTR#h-1
  160 REPEAT:IF PTR#h>0 THEN PTR#h=PTR#h-1
  170 UNTIL PTR#h=0 OR FN_BPEEK#(h)=13
  180 IF PTR#h>0 THEN PTR#h=PTR#h+1
  190 ENDPROC
would output
Code:
LINE 1
LINE 2
LINE 1
LINE 2
LINE 3
LINE 2
After each INPUT# the file pointer is pointing at the next line, so you need to call PROC_PrevLine twice to move the pointer to the previous line.


Top
 Profile  
Reply with quote  
PostPosted: Sun 25 Jan, 2009 10:14 pm 
Offline
Maxcoderz Staff
User avatar

Joined: Thu 16 Dec, 2004 10:06 pm
Posts: 3064
Location: Croydon, England
There's a new release with a few new features; chiefly *SLEEP along with proper APD and a new assembly API (see the manual and the ASMAPI.8XP sample) that can be used to access a few extra features (currently a glob function (pattern matching) as well as UCASE$, LCASE$, LTRIM$, RTRIM$ and TRIM$ functions).

There are two (experimental) commands, *LOADTEXT and *RUNTEXT that can be used to load and run text files. These are regular ASCII text files, though, with CR line-breaks. They're slightly faster than using *EXEC, though.

For those of you with a PS/2 mouse adapter there's a MOUSE.8XP sample too.


Top
 Profile  
Reply with quote  
PostPosted: Mon 26 Jan, 2009 7:08 pm 
Offline
New Member

Joined: Sun 09 Nov, 2008 8:16 pm
Posts: 15
Too bad I've got just about every kind of mouse except anordinary PS/2 mouse but the ball-mouse built into my big old clicky keyboard is PS/2...it would be interesting to try this out.

I


Top
 Profile  
Reply with quote  
PostPosted: Mon 26 Jan, 2009 7:27 pm 
Offline
Maxcoderz Staff
User avatar

Joined: Thu 16 Dec, 2004 10:06 pm
Posts: 3064
Location: Croydon, England
Most USB devices are compatible with PS/2 in my experience. I have a wireless USB mouse that works fine over PS/2, even though it didn't come with an adapter. :)

Full USB support in BBC BASIC (for mass-storage devices as well as keyboard and mouse peripherals) would be very nice, but I don't know how I'd implement it, not owning a TI-84+. :(


Top
 Profile  
Reply with quote  
PostPosted: Tue 27 Jan, 2009 12:04 pm 
Offline
New Member

Joined: Tue 13 Jan, 2009 8:41 pm
Posts: 15
The APD works great!! It's very cool!

Could you prevent the coder from putting a lower number than 5 in it??


Top
 Profile  
Reply with quote  
PostPosted: Tue 27 Jan, 2009 1:31 pm 
Offline
Maxcoderz Staff
User avatar

Joined: Thu 16 Dec, 2004 10:06 pm
Posts: 3064
Location: Croydon, England
I can do that. :)

On the BBC Micro there was a trick you could do to add extra statements to the language. When an unrecognised statement is encountered an error 4, "Mistake", is triggered. The error routine is vectored on the BBC Micro, so you could handle this error yourself. By inspecting the place in the program the error occurred you could detect an additional keyword, cancel the error and implement the statement yourself. By patching the error handler in the Z80 version I've been able to add support for statements that are available in the Windows version (including WAIT, ELLIPSE and SWAP) as a proof of concept.

Such a patch requires overwriting (ie, modification) of the BASIC interpreter, though. When I contacted Richard Russell asking if he was OK with this technique he pointed me to this Z88 patch that adds commands to the Z88 version of BBC BASIC. Being stored in ROM BBC BASIC could not be patched directly, so it must be using some other trick, and I can't work it out for the life of me. :?


Top
 Profile  
Reply with quote  
PostPosted: Wed 28 Jan, 2009 2:41 am 
Offline
Maxcoderz Staff
User avatar

Joined: Thu 16 Dec, 2004 10:06 pm
Posts: 3064
Location: Croydon, England
I've uploaded a new version:

  • Helper keywords for drawing shapes: CIRCLE, ELLIPSE, RECTANGLE, FILL, BY.
  • PLOT [BY] X,Y plots single points.
  • New control structure: WHILE. This works in a similar fashion to REPEAT except it evaluates the conditional first and skips the entire block if it evaluates to FALSE.
  • EXIT FOR, EXIT REPEAT and EXIT WHILE allow you to break out of loops - even if different loop structures are nested inside eachother.
  • WAIT - does what it says on the tin.
  • SPC - not strictly new, but I had overlooked it when compiling the documentation.
  • SWAP - this one needs to be used with care as it permits silly usage (eg swapping literals).

I've changed the file handling stuff a little, so (as before) I'd be interested to hear from TI-84+ users.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 159 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6, 7, 8 ... 11  Next

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