Solved: Calling MAKE-ROOM/099E

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

Re: Calling MAKE-ROOM/099E

Post by mrtinb » Mon Oct 09, 2017 10:56 pm

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

Problem SOLVED.
ZX81, Lambda 8300, Commodore 64, Mac G4 Cube

User avatar
Posts: 806
Joined: Thu May 08, 2008 9:30 am
Location: Dauernheim, Germany

Re: Solved: Calling MAKE-ROOM/099E

Post by siggi » Tue Oct 10, 2017 9:34 am

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:
+ "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.


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

Post Reply