Last time I was on here I learnt the command DLINE from the toolkit. Thank you.
Does anyone know if I can copy a block of lines in a loaded program so I get a second copy later on in the same program?
Thank you
Andrew
copy of block of lines from a program to another part of the same program
Re: copy of block of lines from a program to another part of the same program
I have looked in the toolkit manual but the forum has classifed me as "ROM Dongle" for a reason
AJ

AJ
Re: copy of block of lines from a program to another part of the same program
This is a feature I would dearly love to see added to editing BASIC programs!
As I normally use SBASIC (as opposed to SuperBASIC), when I want to block copy code I either load the program into a text editor (saved programs are basically just plain text), or save the block of code to be copied to a ramdisc, load it into an SBASIC job, renumber it there, save again, then merge with the original program.
Very clumsy, but once you've done it a few times, it just becomes normal.
e.g. LOAD mybigprogram_bas
SAVE ram1_tmp_bas;line1 TO line2 (line number range to be copied)
SBASIC
LOAD ram1_TMP_bas (into the new SBASIC)
RENUM as required
SAVE ram1_TMP_bas
switch back to original BASIC program
MERGE ram1_tmp_bas
It looks long winded and clumsy, I know. I've just got so used to doing this over the years I don't give it a second thought.
Not tried this on Minerva MultiBASIC, don't know if it would work on that.
Another approach might be to learn to use Tim Swenson's SSB (Structured Super BASIC) https://dilwyn.theqlforum.com/program/index.html. It allows you to write QL BASIC programs without line numbers using an editor, making it very easy to do things like copying blocks and other things not so easy to do in standard QL BASIC. Probably the nearest thing we have to an IDE (Integrated Development Environment) for developing QL BASIC programs.
Might also be useful for you to look at the MasterBasic software, originally from Ergon Development, now available as freeware. It's been a while since I last used it, but I remember it being very useful when writing BASIC programs. https://dilwyn.theqlforum.com/program/mbs151d.zip
As I normally use SBASIC (as opposed to SuperBASIC), when I want to block copy code I either load the program into a text editor (saved programs are basically just plain text), or save the block of code to be copied to a ramdisc, load it into an SBASIC job, renumber it there, save again, then merge with the original program.
Very clumsy, but once you've done it a few times, it just becomes normal.
e.g. LOAD mybigprogram_bas
SAVE ram1_tmp_bas;line1 TO line2 (line number range to be copied)
SBASIC
LOAD ram1_TMP_bas (into the new SBASIC)
RENUM as required
SAVE ram1_TMP_bas
switch back to original BASIC program
MERGE ram1_tmp_bas
It looks long winded and clumsy, I know. I've just got so used to doing this over the years I don't give it a second thought.
Not tried this on Minerva MultiBASIC, don't know if it would work on that.
Another approach might be to learn to use Tim Swenson's SSB (Structured Super BASIC) https://dilwyn.theqlforum.com/program/index.html. It allows you to write QL BASIC programs without line numbers using an editor, making it very easy to do things like copying blocks and other things not so easy to do in standard QL BASIC. Probably the nearest thing we have to an IDE (Integrated Development Environment) for developing QL BASIC programs.
Might also be useful for you to look at the MasterBasic software, originally from Ergon Development, now available as freeware. It's been a while since I last used it, but I remember it being very useful when writing BASIC programs. https://dilwyn.theqlforum.com/program/mbs151d.zip
--
All things QL - https://dilwyn.theqlforum.com
All things QL - https://dilwyn.theqlforum.com
Re: copy of block of lines from a program to another part of the same program
Dilwyn
That is super useful. Thank you very much. I think I will try the ram disc idea
Andrew
That is super useful. Thank you very much. I think I will try the ram disc idea
Andrew
Re: copy of block of lines from a program to another part of the same program
For short snippets of code I would normally just add a digit to each line I want to copy. If your code is numbered, say, 100 to 1000 and you want to copy 160 to 200 to the end, then just add 2 to the front of each line: 2160, 2170,.. 2200. Then RENUMber.AndyRed64 wrote: Sat Aug 23, 2025 1:37 pm <>
Does anyone know if I can copy a block of lines in a loaded program so I get a second copy later on in the same program?
<>
Per
I love long walks, especially when they are taken by people who annoy me.
- Fred Allen
I love long walks, especially when they are taken by people who annoy me.
- Fred Allen
Re: copy of block of lines from a program to another part of the same program
Dilwyn
When I entered the command SBASIC I got an error message so I tried the following and that seemed to work too:
LOAD mybigprogram_bas
SAVE ram1_tmp_bas;line1 TO line2 (line number range to be copied)
NEW
LOAD ram1_TMP_bas
RENUM as required
MERGE mybigprogram_bas
I guess that does about the same thing - but I may be doing something silly ...
Thanks
Andrew
When I entered the command SBASIC I got an error message so I tried the following and that seemed to work too:
LOAD mybigprogram_bas
SAVE ram1_tmp_bas;line1 TO line2 (line number range to be copied)
NEW
LOAD ram1_TMP_bas
RENUM as required
MERGE mybigprogram_bas
I guess that does about the same thing - but I may be doing something silly ...
Thanks
Andrew
Last edited by AndyRed64 on Sat Aug 23, 2025 9:27 pm, edited 2 times in total.
Re: copy of block of lines from a program to another part of the same program
Thank you PJW
AJ
AJ
pjw wrote: Sat Aug 23, 2025 5:11 pmFor short snippets of code I would normally just add a digit to each line I want to copy. If your code is numbered, say, 100 to 1000 and you want to copy 160 to 200 to the end, then just add 2 to the front of each line: 2160, 2170,.. 2200. Then RENUMber.AndyRed64 wrote: Sat Aug 23, 2025 1:37 pm <>
Does anyone know if I can copy a block of lines in a loaded program so I get a second copy later on in the same program?
<>
Re: copy of block of lines from a program to another part of the same program
That's why I mentioned that I normally use SBASIC on an SMSQ/E system. Standard QL SuperBASIC doesn't have SBASIC jobs (which are like second copies of SuperBASIC in some ways - the SBASIC command starts a new copy of BASIC).AndyRed64 wrote: Sat Aug 23, 2025 9:22 pm Dilwyn
When I entered the command SBASIC I got an error message so I tried the following and that seemed to work too:
LOAD mybigprogram_bas
SAVE ram1_tmp_bas;line1 TO line2 (line number range to be copied)
NEW
LOAD ram1_TMP_bas
RENUM as required
MERGE mybigprogram_bas
I guess that does about the same thing - but I may be doing something silly ...
Thanks
Andrew
For ordinary QDOS/SuperBASIC, you can't use the SBASIC command. So the way you described would be the way to do it on those systems.
For short bits of code to be copied (since you have to do it one line at a time), Per's suggestion is better and quicker.
I can dream that one day someone far cleverer than me will write a proper development environment for QL BASIC. I've been using the IDE in Basics like QBasic on the PC and although it's old-fashioned and clunky, it works quite well, allowing you to do things like copying and pasting bits of code, search/replace and debugging such as setting breakpoints.
--
All things QL - https://dilwyn.theqlforum.com
All things QL - https://dilwyn.theqlforum.com
-
- Font of All Knowledge
- Posts: 4840
- Joined: Mon Dec 20, 2010 11:40 am
- Location: Sunny Runcorn, Cheshire, UK
Re: copy of block of lines from a program to another part of the same program
Hi,
QD can load S*BASIC files and allow full text editing, and use the SBAS/QD Thingbto run the programme.
QD can load S*BASIC files and allow full text editing, and use the SBAS/QD Thingbto run the programme.
Regards, Derek