Megalextoria
Retro computing and gaming, sci-fi books, tv and movies and other geeky stuff.

Home » Digital Archaeology » Computer Arcana » Commodore » Commodore 8-bit » LOADing tape buffer from disk ?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
LOADing tape buffer from disk ? [message #17131] Tue, 25 September 2012 08:36 Go to next message
dott.Piergiorgio is currently offline  dott.Piergiorgio
Messages: 166
Registered: March 2012
Karma: 0
Senior Member
I have an interesting problem.

Experimenting with "maximum usage of unexpanded VIC/Pet2001-4" I have
found this interesting (mis)behaviour (tested with Vice): the saving of
the tape buffer aerea (with VicMon) got OK but this simple test loading
program:

10 load "tbuf",8,1

misbehave in an interesting manner: the (emulated) 1541 drive enters in
an infinite loop, reading the directory, fetching the single block (193
bytes), then re-reading the block and so on (of course I definitively
don't endorse testing with actual hardware, looks like a sure-fire way
for a quick misaligning of drive head)

My question is, there are some nuances/quirk I'm not aware ?

Best regards from Italy,
dott. Piergiorgio.
Re: LOADing tape buffer from disk ? [message #17330 is a reply to message #17131] Thu, 27 September 2012 07:24 Go to previous messageGo to next message
dott.Piergiorgio is currently offline  dott.Piergiorgio
Messages: 166
Registered: March 2012
Karma: 0
Senior Member
Il 25/09/2012 14:36, dott.Piergiorgio ha scritto:
> I have an interesting problem.

>

> Experimenting with "maximum usage of unexpanded VIC/Pet2001-4" I have

> found this interesting (mis)behaviour (tested with Vice): the saving of

> the tape buffer aerea (with VicMon) got OK but this simple test loading

> program:

>

> 10 load "tbuf",8,1

>

> misbehave in an interesting manner: the (emulated) 1541 drive enters in

> an infinite loop, reading the directory, fetching the single block (193

> bytes), then re-reading the block and so on (of course I definitively

> don't endorse testing with actual hardware, looks like a sure-fire way

> for a quick misaligning of drive head)

>

> My question is, there are some nuances/quirk I'm not aware ?


no replies ??

mha...

Best regards from Italy,
dott. Piergiorgio.
Re: LOADing tape buffer from disk ? [message #17356 is a reply to message #17330] Thu, 27 September 2012 12:45 Go to previous messageGo to next message
Paul Förster is currently offline  Paul Förster
Messages: 415
Registered: April 2012
Karma: 0
Senior Member
Hi,

On 2012-09-27 11:24:15 +0000, dott.Piergiorgio said:
> no replies ??

> mha...


.... unfortunately, this group becomes more and more silent as people
start becoming fans of forums where they send 90% of the time clicking
and 10% processing information rather than here where they spend 1% of
the time hitting the space bar and 99% processing information. :-(

As for your question: I have no answer, sorry.
--
cul8er

Paul
paul.foerster@gmx.net
Re: LOADing tape buffer from disk ? [message #17368 is a reply to message #17356] Thu, 27 September 2012 13:33 Go to previous messageGo to next message
Martijn van Buul is currently offline  Martijn van Buul
Messages: 326
Registered: December 2011
Karma: 0
Senior Member
* Paul F?rster:
> Hi,

>

> On 2012-09-27 11:24:15 +0000, dott.Piergiorgio said:

>> no replies ??

>> mha...

>

> ... unfortunately, this group becomes more and more silent


True, and unfortunately this applies to most usenet groups.

However, considering that the impending demise of Usenet has been predicted
ever since I started reading it in 1994, I dare say it held on for quite a
while :)

--
Martijn van Buul - pino@dohd.org
Re: LOADing tape buffer from disk ? [message #17369 is a reply to message #17368] Thu, 27 September 2012 13:42 Go to previous messageGo to next message
Paul Förster is currently offline  Paul Förster
Messages: 415
Registered: April 2012
Karma: 0
Senior Member
Hi Martijn,

> True, and unfortunately this applies to most usenet groups.


.... yes, but this has become very obvious here during the last 6 months or so.

> However, considering that the impending demise of Usenet has been predicted

> ever since I started reading it in 1994, I dare say it held on for quite a

> while :)


.... I stick with Usenet as long as possible. :-)
--
cul8er

Paul
paul.foerster@gmx.net
Re: LOADing tape buffer from disk ? [message #17370 is a reply to message #17131] Thu, 27 September 2012 13:50 Go to previous messageGo to next message
Anton Treuenfels is currently offline  Anton Treuenfels
Messages: 105
Registered: December 2011
Karma: 0
Senior Member
"dott.Piergiorgio" <chiedetelo@ask.me> wrote in message
news:Kzh8s.210869$GZ3.33362@tornado.fastwebnet.it...
> I have an interesting problem.

>

> Experimenting with "maximum usage of unexpanded VIC/Pet2001-4" I have

> found this interesting (mis)behaviour (tested with Vice): the saving of

> the tape buffer aerea (with VicMon) got OK but this simple test loading

> program:

>

> 10 load "tbuf",8,1

>

> misbehave in an interesting manner: the (emulated) 1541 drive enters in an

> infinite loop, reading the directory, fetching the single block (193

> bytes), then re-reading the block and so on (of course I definitively

> don't endorse testing with actual hardware, looks like a sure-fire way for

> a quick misaligning of drive head)

>

> My question is, there are some nuances/quirk I'm not aware ?

>

> Best regards from Italy,

> dott. Piergiorgio.


When the LOAD command is used in a running program, as you are doing here,
the RUN command is executed after the load is complete. All that's happening
is that you're re-executing your one-line BASIC program over and over and
over...if you want it to do something different try:

10 IF A=0THENA=1:LOAD"TBUF",8,1

- Anton Treuenfels
Re: LOADing tape buffer from disk ? [message #17371 is a reply to message #17131] Thu, 27 September 2012 13:36 Go to previous messageGo to next message
Ingo Korb is currently offline  Ingo Korb
Messages: 54
Registered: August 2012
Karma: 0
Member
"dott.Piergiorgio" <chiedetelo@ask.me> writes:

> 10 load "tbuf",8,1

>

> My question is, there are some nuances/quirk I'm not aware ?


If you use LOAD in a BASIC the program restarts from the beginning after
the LOAD is completed. IIRC variables are preserved if the new program
is short enough or doesn't load into the BASIC RAM area, so you can stop
the infinite loop with something like this:

10 if a <> 1 then a=1:load "tbuf",8,1

-ik
Re: LOADing tape buffer from disk ? [message #17372 is a reply to message #17370] Thu, 27 September 2012 15:10 Go to previous messageGo to next message
dott.Piergiorgio is currently offline  dott.Piergiorgio
Messages: 166
Registered: March 2012
Karma: 0
Senior Member
Il 27/09/2012 19:50, Anton Treuenfels ha scritto:

> When the LOAD command is used in a running program, as you are doing

> here, the RUN command is executed after the load is complete. All that's

> happening is that you're re-executing your one-line BASIC program over

> and over and over...if you want it to do something different try:

>

> 10 IF A=0THENA=1:LOAD"TBUF",8,1


[D'OH moment]

[sbonking my head on wall]

spectacular that I have totally forgetted this specific quirk... really bad.

Thanks to both of you, Hrrs. Korb and Treuenfels ! :)

Best regards from Italy,
dott. Piergiorgio.
Re: LOADing tape buffer from disk ? [message #17467 is a reply to message #17369] Fri, 28 September 2012 14:09 Go to previous messageGo to next message
Groepaz is currently offline  Groepaz
Messages: 640
Registered: December 2011
Karma: 0
Senior Member
Paul Förster wrote:

> Hi Martijn,

>

>> True, and unfortunately this applies to most usenet groups.

>

> ... yes, but this has become very obvious here during the last 6 months or

> so.


are you saying that it didnt die around 1998 already?

--

http://www.hitmen-console.org http://magicdisk.untergrund.net
http://www.pokefinder.org http://ftp.pokefinder.org

Wenn die, die rein wollen, die, die raus wollen, nicht raus lassen, können
die, die raus wollen, die, die rein wollen, nicht rein lassen!
Re: LOADing tape buffer from disk ? [message #17528 is a reply to message #17467] Sat, 29 September 2012 05:14 Go to previous messageGo to next message
Paul Förster is currently offline  Paul Förster
Messages: 415
Registered: April 2012
Karma: 0
Senior Member
Hi Groepaz,

On 2012-09-28 18:09:51 +0000, Groepaz said:
> are you saying that it didnt die around 1998 already?


.... your post shows that it's still there. :-P
--
cul8er

Paul
paul.foerster@gmx.net
Re: LOADing tape buffer from disk ? [message #18746 is a reply to message #17131] Sat, 06 October 2012 17:08 Go to previous messageGo to next message
Pekka Takala is currently offline  Pekka Takala
Messages: 73
Registered: March 2012
Karma: 0
Member
Tue, 25 Sep 2012 14:36:58 +0200, dott.Piergiorgio kirjoitti:

> I have an interesting problem.

>

> Experimenting with "maximum usage of unexpanded VIC/Pet2001-4" I have

> found this interesting (mis)behaviour (tested with Vice): the saving of

> the tape buffer aerea (with VicMon) got OK but this simple test loading

> program:

>

> 10 load "tbuf",8,1

>

> misbehave in an interesting manner: the (emulated) 1541 drive enters in

> an infinite loop, reading the directory, fetching the single block (193

> bytes), then re-reading the block and so on (of course I definitively

> don't endorse testing with actual hardware, looks like a sure-fire way

> for a quick misaligning of drive head)

>

> My question is, there are some nuances/quirk I'm not aware ?


If you put that line in anywhere of the program, the program will restart
after load.

If the loaded program does not overwrite basic program, the basic program
will run in infinite loop.

There is at least three ways in preventing this:

1: variable checking
2: check a spesific byte before loading
3: Check a binary checksum and load if it does not match

The first one has the drawback that it loads the binary data every time
the program is executed. It is done like this:

10 if a=0thena=1:load"tbuf",8,1

The variable A is zero when you run the program, but after load it will be
1 and the program flow will go over this line.

Second way is to check a byte with PEEK command to check if your binary
is loaded. If you develop program, and you test it, it wont load the
binary every time you run the program. Drawback is that if there goes
something wrong with the binary or the initialization value of the memory
happens to be same, your program will not work.

Lets say your program has value 169 in 828 after loaded:

10 ifpeek(828)<>169thenload"tbuf",8,1

Third way to do the check is the most reliable way to detect the program.
Lets say checksum is 2453 and it sits between 828 and 1023:

10 for c=828to1023:ch=peek(c)+ch:next:ifch<>2453thenload"tbuf",8,1

This way is a bit slower than the two upper ways, but it also is more
reliable way. It wont load the binary if it already sits in its place,
but if something is wrong with the program it will refresh it by loading
it again to memory. If the program is bigger, I do not recommend checking
too much bytes. Around 100-250 bytes are well enough to be sure that your
program is in place, but still wont take too much time to check. I myself
use usually the method #1, but if I load bigger programs, method #2.
Method 3 is also good, and much more reliable than way #2 and saves the
disk drive more than method #1.

Pekka Takala
Re: LOADing tape buffer from disk ? [message #19247 is a reply to message #17131] Tue, 09 October 2012 22:02 Go to previous messageGo to next message
Linards Ticmanis is currently offline  Linards Ticmanis
Messages: 253
Registered: April 2012
Karma: 0
Senior Member
On 09/25/2012 02:36 PM, dott.Piergiorgio wrote:

> Experimenting with "maximum usage of unexpanded VIC/Pet2001-4" I have

> found this interesting (mis)behaviour (tested with Vice): the saving of

> the tape buffer aerea (with VicMon) got OK but this simple test loading

> program:

>

> 10 load "tbuf",8,1


Other people have already pointed out the main problem - one more thing:
You mentioned the PET-2001. As far as I know the PET does NOT need the
addition of that ",1" thing, it always loads everything to the address
it was saved from... voilà two bytes saved. IIRC the use of the
secondary address to mark "load to absolute memory address" was only
added on the VIC and was a hackish way to preserve the ability for
"absolute" loading, necessary since they had to make the "normal" load
on the VIC always load a BASIC program to the start of free BASIC RAM,
which on the VIC can be at one of three different places in memory,
depending on which memory expansion you use.

--
Linards Ticmanis
Re: LOADing tape buffer from disk ? [message #19293 is a reply to message #19247] Wed, 10 October 2012 09:39 Go to previous message
dott.Piergiorgio is currently offline  dott.Piergiorgio
Messages: 166
Registered: March 2012
Karma: 0
Senior Member
Il 10/10/2012 04:02, Linards Ticmanis ha scritto:
> On 09/25/2012 02:36 PM, dott.Piergiorgio wrote:

>

>> Experimenting with "maximum usage of unexpanded VIC/Pet2001-4" I have

>> found this interesting (mis)behaviour (tested with Vice): the saving of

>> the tape buffer aerea (with VicMon) got OK but this simple test loading

>> program:

>>

>> 10 load "tbuf",8,1

>

> Other people have already pointed out the main problem - one more thing:

> You mentioned the PET-2001. As far as I know the PET does NOT need the

> addition of that ",1" thing, it always loads everything to the address

> it was saved from... voilà two bytes saved. IIRC the use of the

> secondary address to mark "load to absolute memory address"


because I *never* intend my PET work to be run on actual hardware (not
that I use a certain poke, but after release, I can't have control on
forks and hacks....) I can rely on Vice's hack out of basic/kernel bugs
to use *both* basic v1 *and* (emulated) disk, whose has the definite
advantage of having another 192 bytes available (the 2nd tape buffer of
basic v1)

But I'm also not 100% sure, albeit I have looked at the relevant VICE
code (in petrom.c) that the disk-related path put in the need of ",1"
(aside that I'm much more accustomed to the 64/128 than VIC and PET)

hope to have explained my rationale.....

Best regards from Italy,
dott. Piergiorgio.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: RE: Seeking a K-Power Magazine
Next Topic: PDXCUG.org meeting - Thurs., Oct. 11 (fwd)
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Tue Sep 27 23:06:50 EDT 2022

Total time taken to generate the page: 0.74437 seconds