It is currently Mon Oct 20, 2014 4:04 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Mon Sep 29, 2014 10:38 pm 
Offline
 Profile

Joined: Mon Sep 29, 2014 9:33 pm
Posts: 3
I am working on a dictionary utility and I need to read in data from disk, the database is a just a list of words, but with the 1st letter missing, and no delimiters, i.e.

APPLE
ACKLE
ADDLE

would be stored as a string PPLECKLEDDLE

With it so far ? :-)

OK, to read in the data, we know that this particular file contains 5 letter words beginning with 'A', so we start with 'A' and read in the first 4 bytes and add that to the 'A', then start with 'A' again, read next 4 bytes and so on.

The reading is being done in a loop, doing a BGET# for as many characters we need to read, now this works perfectly, but it's quite slow as you need to loop reading just one byte at a time.

Is there any way in BBC Basic, machine code call, hack etc to read a known number of bytes, i.e. a string in one operation, i.e. something like

in$=BGET# file,number of chars to read

I cant use INPUT# as that expects a certain format, and it does not know where the string ends ?

Any ideas ?


Top
 
PostPosted: Mon Sep 29, 2014 11:23 pm 
Offline
User avatar
 WWW  Profile

Joined: Wed Jan 26, 2011 2:35 am
Posts: 139
Take a look at the OSGBPB call in the Advanced User Guide. The Electron version of the guide has this description of the call in section 5.5: "This routine enables the transfer of a group of bytes to or from an open file. This routine is implemented particularly for filing systems which have a high time overhead associated with each data transfer e.g. the Econet."


Top
 
PostPosted: Tue Sep 30, 2014 3:08 am 
Offline
 Profile

Joined: Mon Sep 29, 2014 9:33 pm
Posts: 3
DavidB wrote:
Take a look at the OSGBPB ........"


Thanks, that looks like it might well do the job, I've read up on it, and found some example code. Looks very promising, I'll give it a go :-)


Top
 
PostPosted: Thu Oct 02, 2014 3:31 pm 
Offline
 Profile

Joined: Mon Sep 29, 2014 9:33 pm
Posts: 3
DavidB wrote:
Take a look at the OSGBPB ........"


Just a quick update: Thanks DavidB, I got the OSGBPB call working :-)

It speeded up that part of the code as I thought it might


Top
 
PostPosted: Thu Oct 02, 2014 9:53 pm 
Offline
User avatar
 WWW  Profile

Joined: Wed Jan 26, 2011 2:35 am
Posts: 139
Good to know it was useful. :)


Top
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC [ DST ]


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