[Color Computer] [coco] Eureka !!!!
George Ramsower
yahoo at dvdplayersonly.com
Mon Jan 30 22:53:18 EST 2006
For two months, I've been struggling with a problem in B09.
I'm trying to do what I did in '02 on building web pages with my coco from
an Excel file. I had it working then, but somewhere along time, I changed
something that made my program fail to work correctly. (I neglected to make
a backup of the working one) DOH!
I could create hundreds of web pages in just a few hours. These are better
than a database driven website, because the search engines can better index
them.
Tonight, I found the problem and all is well...
However, I wanted to share something with all the new members, something
that was a great help in '02.
I was creating a string(webpage) of about 3500 bytes and trying to save it
as a file. But B09 would return an error 80.
This error is undocumented.
Then I wrote this list in June of 2002 and asked for help. This suggestion
did the trick....
Curtis Boyle suggests,
PUT _always_ does fixed length writes. If you DIM your data to be
4000 bytes, for example, it will PUT 4000 bytes into the file, even if
you only filled the string with say, 200 bytes. Whatever random garbage
is in memory (where the string is) would fill the last 3800 bytes of the
PUT, in this case.
Syscall is fairly easy... I will give an example below:
TYPE registers=cc,a,b,dp:BYTE;x,y,u:INTEGER
DIM regs:registers
DIM ofile:BYTE
DIM x$:STRING[6000]
DIM numofbytes:INTEGER
x$="Whatever massive amount of text you want here."
CREATE #ofile,"/dd/testfile":WRITE
regs.a=ofile
regs.x=ADDR(x$)
INPUT "Number of bytes you want to write:";numofbytes
regs.y=numofbytes
RUN Syscall($8a,regs)
CLOSE #ofile
END
If you want WritLn (so writes stop of Carriage returns), simply change
the $8a to $8c. One should probably do some error checking after the
syscall as well, as when doing it this way, BASIC09 has no idea if an
error occured or not. To check this, add the following lines right after
the RUN Syscall [...] statement:
IF LAND(regs.cc,1)>0 THEN
PRINT "Error #";regs.b;" encountered."
ENDIF
---------------------------------------------------
Well, that did the trick, by golly! Of course, I had to modify it to suit
my needs.
Tonight, I discovered that I forgot a disk I/O command in B09 that fixed my
most recent problem
GET and INPUT didn't work in this application.
Get would get 256 bytes, stop on a CR
INPUT would stop on a comma. This file has both in it.
So finally I looked in the area of the B09 book on pp 8.1. Voila! there it
was!! "READ"!!!
Doh!
I changed the routine to use READ and now it's working again.
I hate when that happens...
Thanks again, Curtis for the SysCall.
George
Brought to you by the 6809, the 6803 and their cousins!
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/ColorComputer/
<*> To unsubscribe from this group, send an email to:
ColorComputer-unsubscribe at yahoogroups.com
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
More information about the Coco
mailing list