Solved: Calling MAKE-ROOM/099E

Any discussions related to the creation of new hardware or software for the ZX80 or ZX81
User avatar
mrtinb
Posts: 1906
Joined: Fri Nov 06, 2015 5:44 pm
Location: Denmark
Contact:

Re: Calling MAKE-ROOM/099E

Post by mrtinb »

It works, if I only insert data between lines, and remember to update line number and line length.

Problem SOLVED.
Martin
https://zx.rtin.be
ZX81, Lambda 8300, Commodore 64, Mac G4 Cube
User avatar
siggi
Posts: 988
Joined: Thu May 08, 2008 9:30 am
Location: Wetterau, Germany
Contact:

Re: Solved: Calling MAKE-ROOM/099E

Post by siggi »

mrtinb wrote: Mon Oct 09, 2017 1:08 pm I've made a small program that start with RAND USR 16515

Code: Select all

  10 REM CODE 5[3]RND[' ][: ] LN [2]{..}TAN ****
     4083 219F40        LD HL,409F
     4086 010500        LD BC,0005
     4089 CD9E09        CALL 099E
     408C C9            RET
     408D 17            "*"
     408E 17            "*"
     408F 17            "*"
     4090 17            "*"
  20 LET A$="AA"
I assumed my program would insert 5 spaces in line 20, so the result would be

Code: Select all

  20 LET A$="A     A"
No, as written before: "it does not fill the new space with anything. You have to fill up this new space with data"

If you initialize the new 5 bytes by 0 AND update the line length, you will get the expected result. Without initializing the 5 bytes, you still have there to old content there. So the memory will contain these values:
LET A$="A
+ "A" (old/second "A")
+ " (old string end marker)
+ chr(118) (old end-of-line marker)
+ chr(118) (old start of display file)
+ ?? (first char in old display file)
+ "A" (copied old/second "A")
+ " (copied string end marker)
+ chr (118) (copied end-of-line marker)
+ chr (118) (new start of copied display file)

The chr(118) within the string AND the wrong line length confuse the listig routine, which will show a distorted listing.

Regards
Siggi

PS: I used this routine in MEFISDOS to make space in the variable area to load new variables from MMC and insert them into existing variables and to load parts of BASIC program (formerly saved BASIC program lines) to merge them into an existing BASIC program ...
My ZX81 web-server: online since 2007, running since dec. 2020 using ZeddyNet hardware
http://zx81.ddns.net/ZxTeaM
Post Reply