ZX Utility Query*SOLVED*

Discussion about ZX80 / ZX81 Software
butchi
Posts: 38
Joined: Wed Jun 12, 2019 4:12 am

ZX Utility Query*SOLVED*

Post by butchi »

Hi,
Just checking to find out if a decent Merge utility exists for the ZX81/TS1000?
Something like this would be a much needed software utility, where the 1st code gets preserved, then merged after that what was just loaded.
b
Last edited by butchi on Sun Jul 07, 2019 7:53 am, edited 1 time in total.
User avatar
XavSnap
Posts: 1940
Joined: Sat May 10, 2008 4:23 pm
Location: 'Zx81 France' Fb group.

Re: ZX Utility Query

Post by XavSnap »

:o

Probably, but it had to load a program, renum it and scan GOTO or GOSUB commands to reset them… with the "RAM TOP" how keep 10 kb of memory!

Ever seen an exemple to load two programs in the memory, with the Basic memory bottom set … after the primary program…

If you had to merge a specific basic bloc (datas, or basic line…), you had to load datas over the RAMTOP, and fill a dedicated REM room space with the binary called, to erase the REM room. (Basic lines, or datas)

But, it's easier to recall datas using a dedicated tape routine (in fast load), in a Data room, located over the RAM_TOP...
Xavier ...on the Facebook groupe : "Zx81 France"(fr)
User avatar
mrtinb
Posts: 1906
Joined: Fri Nov 06, 2015 5:44 pm
Location: Denmark
Contact:

Re: ZX Utility Query

Post by mrtinb »

There exists many. You can look here: https://www.zx81stuff.org.uk/zx81/tape/0

They will require your line numbers don’t clash. There are many renumber utilities as well, and few of them will change numbers in GOTOs and GOSUBs as well.

My best experience with merging is SIMDOS2. This requires RAM in 8k-16k. Here you can save whole programs or BASIC line number ranges to RAM-disk some place in memory. Then you can load them again with merge.

http://cd.textfiles.com/230/EMULATOR/SI ... OGINFO.TXT
http://cd.textfiles.com/230/EMULATOR/SINCLAIR/XTENDER/
Martin
https://zx.rtin.be
ZX81, Lambda 8300, Commodore 64, Mac G4 Cube
User avatar
XavSnap
Posts: 1940
Joined: Sat May 10, 2008 4:23 pm
Location: 'Zx81 France' Fb group.

Re: ZX Utility Query

Post by XavSnap »

Thanks Martin,

I never had to find this kind of programs.
I use to save all basic programs in text mode and merge them in a text editor.
:oops:
Xavier ...on the Facebook groupe : "Zx81 France"(fr)
User avatar
mrtinb
Posts: 1906
Joined: Fri Nov 06, 2015 5:44 pm
Location: Denmark
Contact:

Re: ZX Utility Query

Post by mrtinb »

I mostly use real hardware when I can. I use emulators for debugging, e.g. with EightyOne where I can step through a program assembler instruction by assembler instruction.
Martin
https://zx.rtin.be
ZX81, Lambda 8300, Commodore 64, Mac G4 Cube
butchi
Posts: 38
Joined: Wed Jun 12, 2019 4:12 am

Re: ZX Utility Query

Post by butchi »

XavSnap & mrtinb,
We all seem to differ! You are welcome to experiment with attached merging concept that I've spent my fifteen minutes on. To be of any value, I'd suggest relocating the asm to the 8-16K area, making it immune to NEW, etc.
b
Attachments
merge.zip
(29.22 KiB) Downloaded 265 times
User avatar
XavSnap
Posts: 1940
Joined: Sat May 10, 2008 4:23 pm
Location: 'Zx81 France' Fb group.

Re: ZX Utility Query

Post by XavSnap »

:oops:

Hi,

Mixing and merge datas on Zx81 is particularly difficult.

One can rely on moving RAM_TOP, but loading data and practically impossible without programming an independent loading routine.

It's easier to cut a program and repeat the common routines, but for an adventure game, for example, it's difficult to simply load the game plan data.

Unlike the Spectrum, on ZX81 it is impossible to load variables separately without resorting to a particular routine.

I propose to you, if you need to insert data in a program, to use loading routines on floppy disk, because the Larken or Mageco (ZxExpand) readers can load codes in memory, without erasing the basic memory.

Note: CBI can't merge another program!
Xavier ...on the Facebook groupe : "Zx81 France"(fr)
User avatar
mrtinb
Posts: 1906
Joined: Fri Nov 06, 2015 5:44 pm
Location: Denmark
Contact:

Re: ZX Utility Query

Post by mrtinb »

The memory between STK_END and stackpointer is free. If you add a little margin to both, it is preserved during loads if your program does not use all this space.

So you can just copy variables and machine code there for later use, and load all you want. Maybe your code could check the first and last byte has not been written over.

With this approach you don’t need to tamper with RAMTOP.
Last edited by mrtinb on Mon Jul 01, 2019 4:49 pm, edited 1 time in total.
Martin
https://zx.rtin.be
ZX81, Lambda 8300, Commodore 64, Mac G4 Cube
User avatar
XavSnap
Posts: 1940
Joined: Sat May 10, 2008 4:23 pm
Location: 'Zx81 France' Fb group.

Re: ZX Utility Query

Post by XavSnap »

Image
Xavier ...on the Facebook groupe : "Zx81 France"(fr)
User avatar
XavSnap
Posts: 1940
Joined: Sat May 10, 2008 4:23 pm
Location: 'Zx81 France' Fb group.

Re: ZX Utility Query

Post by XavSnap »

ALWAYS ABOUT CHAINAGE (ZX81)
We know that loading a program erases the program already in memory. It may, however, be interesting to juxtapose two programs to form one. Example of use: Add at the beginning of a BASIC program a program in machine language inserted into a REM. The program "CHAIN" allows this operation. The two programs A and B to be juxtaposed must be saved on K7. Program A contains A bytes. The first phase of the CHAIN ​​program reserves a RAMTOP area of, A bytes, and transfers program A to it. Program B is then loaded. The second phase of the program CHAIN ​​expands the program area from address 16509 by A bytes and then transfers the A bytes of program A from the RAMTOP area to the program area in the enlarged portion. The two programs A and B then form only one AB program.
Regardless of the numbering of the two programs, the RUN command will execute program A first and then program B. However, if you want to make changes, you may encounter difficulties. That is why it is preferable that the numbering of the program B follows that of the program A. There must be enough room in memory to house the program A twice more with the program B. With the extension 16k, the initial reserve is 15447 bytes. The CHAIN ​​program is 96 bytes long. It is therefore necessary to check, in number of bytes, that: 2 x PROG.A + PROG.B 15351 Remember that to know the length of a program, it is enough to make:
PRINT (PEEK 16396 + 256? E PEEK 16397) - 16509
MANUAL

- Save programs A and B Reserve a RAMTOP area by:
POKE 16388,160
POKE 16389,127
NEW
- Load the program CHAIN ​​and execute it by RUN
- Load the program Make RAND USR 32702
- Load program B - Make RAND USR 32672
- Lister, both programs are chained.

Last edited by XavSnap on Mon Jul 01, 2019 5:00 pm, edited 1 time in total.
Xavier ...on the Facebook groupe : "Zx81 France"(fr)
Post Reply