Page 1 of 2

Solved: Calling MAKE-ROOM/099E

Posted: Mon Oct 09, 2017 1:08 pm
by mrtinb
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"
It's made to test call to MAKE-ROOM/099E. Looking at de description of the ROM disassembly online MAKE-ROOM is called with address in HL, and number of bytes to insert in BC. The address set in this program is 409F which is the address of the 2nd "A" in line 20.

I assumed my program would insert 5 spaces in line 20, so the result would be

Code: Select all

  20 LET A$="A     A"
This does not happen. Instead the bottom line is hidden. Commands work, but the bottom line does not shown.

Has anyone used MAKE-ROOM, or know how to insert space in memory? Maybe MAKE-ROOM is the wrong ROM-routine to use.

Re: Calling MAKE-ROOM/099E

Posted: Mon Oct 09, 2017 2:09 pm
by siggi
AFAIK that rom routine moves the folling memory away and corrects the pointers. But it does not fill the new space with anything. You have to fill up this new space with data, that may be displayed properly on screen (the orignal data still there seem to confuse the listing routine).

Siggi

Re: Calling MAKE-ROOM/099E

Posted: Mon Oct 09, 2017 2:33 pm
by mrtinb
It does not explain why the bottom line gets hidden.

Re: Calling MAKE-ROOM/099E

Posted: Mon Oct 09, 2017 5:58 pm
by Andy Rea
an extra halt in the display file will upset the display routines... i believe the halt instruction is also the marker for end of lines in basic... so erm maybe it's trying to diplsay more lines than it can...

regards

Re: Calling MAKE-ROOM/099E

Posted: Mon Oct 09, 2017 7:01 pm
by olofsen
The third and fourth bytes of a BASIC line contain its subsequent length - perhaps this should reflect the increased length because of MAKE-ROOM?

Re: Calling MAKE-ROOM/099E

Posted: Mon Oct 09, 2017 7:58 pm
by mrtinb
MAKE-ROOM makes a call to a routine which fixes pointers. I assumed it fixed all pointers.

Re: Calling MAKE-ROOM/099E

Posted: Mon Oct 09, 2017 8:57 pm
by PokeMon
It depends where exactly should room made. It could be used for display file, variable section, E_LINE, or STACK (STKBOT/STKEND). Depending on contents of HL several pointers are updated. A BASIC line number is not a pointer and the length of the BASIC line either. And the routine is not intended to be used for the program area, I think.

Bildschirmfoto 2017-10-09 um 20.51.34.png
Bildschirmfoto 2017-10-09 um 20.51.34.png (40.92 KiB) Viewed 4055 times
It is recommended to download this popular copy of Ian Logan's Book.

Bildschirmfoto 2017-10-09 um 20.54.06.png
Bildschirmfoto 2017-10-09 um 20.54.06.png (397 KiB) Viewed 4055 times

Re: Calling MAKE-ROOM/099E

Posted: Mon Oct 09, 2017 9:50 pm
by mrtinb
That's the book I'm using. Just thought it would be more detailed.

Thanks for your input. I'll try to fix the BASIC line length, and see if it'll fix it.

Re: Calling MAKE-ROOM/099E

Posted: Mon Oct 09, 2017 10:06 pm
by siggi
It is NOT a good idea to run this routine during SLOW mode. If you insert bytes into a program line, not only the line length will no more fit, but the DFILE is also moved upwards. This could result in a crahs, when the display is generated while the DFILE is moved or before the system variables (pointer to DFILE) are corrected. So try this only during FAST mode!

Siggi

PS: This routine may of course also used in program area (see comment!)

Re: Calling MAKE-ROOM/099E

Posted: Mon Oct 09, 2017 10:39 pm
by mrtinb
Maybe I should just try to insert a new line, and not modify an existing one.

Thanks for your feedback