Tree of Knowledge loading programs

discussion of beeb/electron applications, languages, utils and educational s/w
User avatar
pau1ie
Posts: 301
Joined: Thu May 10, 2012 9:48 pm
Location: Bedford

Tree of Knowledge loading programs

Postby pau1ie » Sun Nov 12, 2017 10:17 pm

I am confused as to how this works. I suspect this has been copied from tape and altered to run on disc, There is a bootfile:

Code: Select all

CHAIN "LOGO"


This program is as follows (Hand typed so may be transcription errors.:

Code: Select all

  0REM  ...Tree of Knowledge V1
 10REM
 20REM  Copyright (C) Acornsoft 1982
 30REM
 40MODE7:VDU23;10,32,0;0;0;
 50FORI%=0TO&400STEP4:I%!&7C00=I%!TOP:NEXT
 60VDU28,11,22,30,20
 70PAGE=&E00
 80CHAIN"Tree"
 


This displays the acornsoft logo. How? I assume it has something to do with the loop at line 50.
Screenshot from 2017-11-12 21-47-04.png


But it keeps saying "Bad Program", presumably because it is setting PAGE to &E00 which is wrong for a system with DFS. So I changed line 70 to

Code: Select all

70PAGE=&1400

But it doesn't display the logo properly any more.
Screenshot from 2017-11-12 21-56-54.png


It does however load and run the main program fine. But if I save the program, then change it back and save it again, it still doesn't display. Is there some hidden code that doesn't save when I change it? How do I diagnose this?
I'm working on http://bbcmicro.co.uk

User avatar
lurkio
Posts: 1238
Joined: Tue Apr 09, 2013 11:30 pm
Location: Doomawangara
Contact:

Re: Tree of Knowledge loading programs

Postby lurkio » Sun Nov 12, 2017 11:01 pm

The Acornsoft loading screen data is stored in memory starting at TOP, which is the memory location that immediately follows the last byte of the BASIC loader program. Because you increased the size of the BASIC program (albeit only by one byte), by changing E00 to 1400, you made the BASIC program overwrite the start of the loading screen data.

The loading screen data is at the end of the original file that contains the BASIC loader program. To see this, load the original program and type PRINT ~TOP-PAGE to get the size of the BASIC program. Then compare that with the file-length that you get when you do *INFO filename

:idea:

crj
Posts: 225
Joined: Thu May 02, 2013 4:58 pm

Re: Tree of Knowledge loading programs

Postby crj » Sun Nov 12, 2017 11:09 pm

pau1ie wrote:

Code: Select all

FORI%=0TO&400STEP4:I%!&7C00=I%!TOP:NEXT

What that does is copy a kilobyte (&400 bytes) from immediately above the program into screen memory.

A BBC BASIC program has a terminator at the end of it. Normally - and certainly when you SAVE - that will be the last thing before the end of the file. However, if there's more data beyond that it gets loaded and just sits there in memory like a lemon. "LOGO" has a kilobyte of extra data BASIC knows nothing about.

The keyword TOP denotes the end of the program, so the start of that extra data.

If you want to modify the program without damaging the logo, you'll need to do something like:

Code: Select all

PRINT ~TOP
*SAVE LogoTmp <top>+400
REM Make your changes here
PRINT ~TOP
*LOAD LogoTmp <newtop>
PRINT ~PAGE, ~(TOP+&400)
*SAVE LOGO <page> <topplus400>
Last edited by crj on Mon Nov 13, 2017 4:18 am, edited 1 time in total.

User avatar
pau1ie
Posts: 301
Joined: Thu May 10, 2012 9:48 pm
Location: Bedford

Re: Tree of Knowledge loading programs

Postby pau1ie » Sun Nov 12, 2017 11:36 pm

Thanks both. I will give this a go tomorrow.
I'm working on http://bbcmicro.co.uk

User avatar
billcarr2005
Posts: 1075
Joined: Fri Sep 09, 2005 3:01 pm
Location: UK
Contact:

Re: Tree of Knowledge loading programs

Postby billcarr2005 » Mon Nov 13, 2017 12:49 am

Or just use the native disk version? :)
FRUIT and CLASS are ready made trees
Attachments
Tree of Knowledge.zip
Tree of Knowledge
(10.27 KiB) Downloaded 6 times

joachim
Posts: 111
Joined: Wed Jun 21, 2006 1:20 am

Re: Tree of Knowledge loading programs

Postby joachim » Mon Nov 13, 2017 7:48 pm

crj wrote:What that does is copy a kilobyte (&400 bytes) from immediately above the program into screen memory.

Why did they do it that way? Surely they could have stored the Acornsoft logo just once (&100 bytes) then manually added the colours and the filing system dialogue window, thus making the loader 2–3 tape blocks shorter.

User avatar
pau1ie
Posts: 301
Joined: Thu May 10, 2012 9:48 pm
Location: Bedford

Re: Tree of Knowledge loading programs

Postby pau1ie » Mon Nov 13, 2017 8:29 pm

billcarr2005 wrote:Or just use the native disk version? :)


Thanks - that is much easier!
I'm working on http://bbcmicro.co.uk


Return to “software: other”

Who is online

Users browsing this forum: Bing [Bot] and 5 guests