Page 1 of 1

Help using ZXTK from BugByte

Posted: Mon Feb 13, 2017 5:01 pm
by mrtinb
The manual states:
Adding ZXTK to an existing program.
1. Load ZXTK
2. Set RAMTOP so that there is at least 2K of space above it.
3. EXTRT lines 1 to 3 above RAMTOP.
4. Load existing program.
5. RAND USR (RAMTOP = 1234). First check that this is location contains 205.

This will place lines 1 to 3 in the front of your program for normal use. Step 5 uses relocatable code in MERGE and is the only function which will operate in this position. Your existing program should not have any lines containing GOTO 1, 2 or 3.
Has anyone used ZXTK? I think there's a error in the manual in step 5. Maybe it should be RAMTOP + 1234, or RAMTOP - 1234? What ever I calculate there is not 205 in that position.

I'll look further into a memory dump, and see the places with 205=$CD=CALL.

Re: Help using ZXTK from BugByte

Posted: Tue Feb 14, 2017 9:24 am
by siggi
If you cannot find a solution: maybe you could use TOOLKIT or TOOLK64 instead?
It runs above RAMTOP (16 k Zeddies) or in ram starting at 8K. Thus it does not need to be "merged" into basic program to be used:

http://www.zx81.de/soft/_main_d.htm

Code: Select all

ZX-TOOLKIT 
instructions in brief

                                                        http://www.zx81.de

First load TOOLKIT or TOOLK64. Both use about 2300 bytes of memory.
TOOLKIT needs a ZX81 with 16K-RAM and will be copied under RAMTOP and then 
RAMTOP will be lowered.
TOOLK64 will be copied in the region 14 - 16K. You must have RAM there.
Both programms will run under ZX81 emulator XTender on a DOS-PC.

Then load your ZX81 programm you want to work with.

Call the functions with RAND USR address or RAND USR variable

variable     address for
          16K  /  64K   version

         30506 / 14122  will define the names of the following variables

RENUM    30524 / 14140  will renumber the whole BASIC-Program
                        you are asked to enter START line and STEP, 
                        even GOSUB and GOTO line-number will be changed

DEL      31155 / 14771  deletes from START to END line number 

MEM      31850 / 15466  shows the memory available

DUMP     31532 / 15148  lists the names of all defined variables and strings (no arrays)

FIND     31233 / 14849  finds strings, to find keywords use THEN keyword, 
                        then delete THEN

REPLACE  31751 / 15367  like FIND, but cannot replace numbers

REMKILL  31062 / 14678  deletes all REM-lines

SAVE     31273 / 14889  saves the BASIC program below RAMTOP 
                        (high line-numbers!!!)

                        then LOAD the second BASIC-program (low line-numbers)

APPEND   31385 / 15001  copies the first loaded BASIC-programm just behind the second one


Re: Help using ZXTK from BugByte

Posted: Tue Feb 14, 2017 10:50 am
by PokeMon
mrtinb wrote: Has anyone used ZXTK? I think there's a error in the manual in step 5. Maybe it should be RAMTOP + 1234, or RAMTOP - 1234? What ever I calculate there is not 205 in that position.

I'll look further into a memory dump, and see the places with 205=$CD=CALL.
I think you should just use the new RAMTOP value. 1234 should only state that a number is needed and not the word RAMTOP. Anyway it would be hard to find out a place in memory containing 205. There could be many places ...

Re: Help using ZXTK from BugByte

Posted: Tue Feb 14, 2017 2:54 pm
by blittled
I think RAMTOP=1234 is just an example. Try peeking at the RAMTOP value you set at step 2 to see if it is 205. I believe that ZXTK may generate the code it needs starting at RAMPTOP so it doesn't corrupt the current program.

OOPS... I see PokeMon said the same thing :)

Re: Help using ZXTK from BugByte

Posted: Tue Feb 14, 2017 3:13 pm
by mrtinb
mrtinb wrote:5. RAND USR (RAMTOP = 1234). First check that this is location contains 205.
The manual should have said: 5. RAND USR (RAMTOP + 1234).

My mistake was that I forgot NEW after setting RAMTOP 2K down.

It works if I set RAMTOP to 120*256, and when the MERGE is needed you run RAND USR 120*256+1234.