Page 2 of 2

Re: Calling MAKE-ROOM/099E

Posted: Mon Oct 09, 2017 10:56 pm
by mrtinb
It works, if I only insert data between lines, and remember to update line number and line length.

Problem SOLVED.

Re: Solved: Calling MAKE-ROOM/099E

Posted: Tue Oct 10, 2017 9:34 am
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 ...