Challenge: Create or Delete Lines from inside a program
Moderator: Moderators
-
- Vic 20 Afficionado
- Posts: 347
- Joined: Tue Apr 14, 2009 8:15 am
- Website: http://wimbasic.webs.com
- Location: Netherlands
- Occupation: farmer
Re: Challenge: Create or Delete Lines from inside a program
Jeff,
Reordering the lines from within a Basic is indeed quite a challenge. Nowadays I would use BasEdit for such a thing.
30 years ago, with only a datasette at hand, the method would have been to save program segments under the right linenumbers in PETSCII format (using CMD...LIST...) and then merging them with the little ML program I had.
If you're interested in the RENUMBER program, I will try and reproduce it (got some experience from the ExBasic/WimBasic implementation )
Regards,
Wim.
Reordering the lines from within a Basic is indeed quite a challenge. Nowadays I would use BasEdit for such a thing.
30 years ago, with only a datasette at hand, the method would have been to save program segments under the right linenumbers in PETSCII format (using CMD...LIST...) and then merging them with the little ML program I had.
If you're interested in the RENUMBER program, I will try and reproduce it (got some experience from the ExBasic/WimBasic implementation )
Regards,
Wim.
VICE; selfwritten 65asmgen; tasm; maintainer of WimBasic
Re: Challenge: Create or Delete Lines from inside a program
Renumber program? What's wrong with Programmer's Aid's renumber command?
PRG Starter - a VICE helper / Vic Software (Boray Gammon, SD2IEC music player, Vic Disk Menu, Tribbles, Mega Omega, How Many 8K etc.)
Re: Challenge: Create or Delete Lines from inside a program
It requires the use of the Programmer's Aid cart. HahaBoray wrote:Renumber program? What's wrong with Programmer's Aid's renumber command?
Sent from my iPhone using Tapatalk
- Mike
- Herr VC
- Posts: 4839
- Joined: Wed Dec 01, 2004 1:57 pm
- Location: Munich, Germany
- Occupation: electrical engineer
Re: Challenge: Create or Delete Lines from inside a program
... which, for one, is contained in the Mega-Cart. I know you own one.Jeff-20 wrote:It requires the use of the Programmer's Aid cart. [...]
Especially the toolkit of the Programmer's Aid cart is only used during program development. All the commands can only be used from direct mode. Which also means that a program written with the assistance of PA does not require PA to run afterwards.
But generally I see the very concept of BASIC extensions or any other 'black box' solution seems alien to you. You're not alone, though, otherwise I'd have seen a plethora of programs written by others using MINIGRAFIK in the meantime.
Sent from my Sony VAIO AW11XU using its keyboard
Re: Challenge: Create or Delete Lines from inside a program
I own a PA cart and Megacart. I think the exercise itself is interesting to me. Renumbering was not a high priority, but sometimes I like to see what can been done with the VIC in its purest form. However, I really enjoy productions outside or my personal self-imposed limitations!
- Mike
- Herr VC
- Posts: 4839
- Joined: Wed Dec 01, 2004 1:57 pm
- Location: Munich, Germany
- Occupation: electrical engineer
Re: Challenge: Create or Delete Lines from inside a program
Yet you keep soliciting for help which constantly 'requires' you to think out of the box.
A good deal of your problems turn to non-issues once you'd use a better set of tools.
Sometimes you behave like a strange mechanic who not only insists to tap threads into the bare metal (which is quite usual), but also wants to fabricate the screws himself.
A good deal of your problems turn to non-issues once you'd use a better set of tools.
Sometimes you behave like a strange mechanic who not only insists to tap threads into the bare metal (which is quite usual), but also wants to fabricate the screws himself.
Re: Challenge: Create or Delete Lines from inside a program
Hahaha I love being the crazy mechanic. I see your point, but does that logic apply to all of us? Would Photoshop for Windows make MINIGRAFIK for the VIC irrational?
- Mike
- Herr VC
- Posts: 4839
- Joined: Wed Dec 01, 2004 1:57 pm
- Location: Munich, Germany
- Occupation: electrical engineer
Re: Challenge: Create or Delete Lines from inside a program
It probably would, if it were not for the fact that Photoshop and its kind do not provide substantial help to actually import images/pictures into the VIC-20.Jeff-20 wrote:Would Photoshop for Windows make MINIGRAFIK for the VIC irrational?
Given the premise, that all this is still about programs/games/applications intended to run on the VIC-20, regardless what RAM expansion and storage media are being used, I had good reasons to write MINIGRAFIK at the time, and also good reasons to write MINIPAINT as editor for MG bitmaps. They're both good tools within their little scope. There exist at least a few games and applications which make use of them - and I have one WIP which is going to be published in the next two days.
Last edited by Mike on Sun Aug 31, 2014 1:15 pm, edited 1 time in total.
Re: Challenge: Create or Delete Lines from inside a program
And I look forward to it! But you'll have to be more patient with my odd idiosyncrasies. For example, this thread gave me new insight into the GOTO command, and I'm so glad I asked. The fact you work with this computer at all should make you at least a little sympathetic to my fixations.Mike wrote:I have one WIP which is going to be published in the next two days.
- Schema
- factor
- Posts: 1430
- Joined: Tue Mar 23, 2004 7:07 am
- Website: http://www.jammingsignal.com
- Location: Toronto, Ontario
Re: Challenge: Create or Delete Lines from inside a program
This same challenge (deleting lines, anyway) was posted in Ahoy! magazine in their "Commodares" section, and they published solutions in their October 1987 issue.
I remember it vividly because I sent in a solution (using the keyboard buffer trick) and got my name published in the magazine. (I was 14.)
Here's the issue as PDF, if you want to see some of the other solutions:
http://www.bombjack.org/commodore/magaz ... 87_Oct.zip
I remember it vividly because I sent in a solution (using the keyboard buffer trick) and got my name published in the magazine. (I was 14.)
Here's the issue as PDF, if you want to see some of the other solutions:
http://www.bombjack.org/commodore/magaz ... 87_Oct.zip
-
- Vic 20 Afficionado
- Posts: 347
- Joined: Tue Apr 14, 2009 8:15 am
- Website: http://wimbasic.webs.com
- Location: Netherlands
- Occupation: farmer
Re: Challenge: Create or Delete Lines from inside a program
Below is the renumber program.
Step 0: Make sure your user program is running OK.
Step 1: Append the renumber program to your user program, or load the renumber program before typing in your user program, as follows:
Step 2: Adjust A (start) and B (incr) in line 60010 to your needs (A and B must both be >0 !)
Step 3: Execute by RUN60000
Step 4: All references that couldn't be found are filled in with 65535, check that (!).
Step 5. Delete lines 60000 and upward, as Mike showed in a previous post
All linenumber references after GOTO, GOSUB and THEN are renumbered as well as the programlines themselves.
Also ON...GOTO and ON...GOSUB statements are properly adjusted
Do not remove line 60000. This line will grow and shrink depending on new linenumbers needing less or more space than old linenumbers. After renumbering this line will possibly come out shorter or longer, so before a next renumbering run re-adjust the length of this line again using colons.
I accept no liability for the use of this program !
Regards,
Wim.
Step 0: Make sure your user program is running OK.
Step 1: Append the renumber program to your user program, or load the renumber program before typing in your user program, as follows:
Code: Select all
PRINT PEEK(43) (low byte of Basic start)
PRINT PEEK(44) (high byte of Basic start)
E=PEEK(45)+256*PEEK(46)-2:POKE 43,E AND 255:POKE 44,E/256
LOAD"RENUMBER"
POKE 43, <low byte of Basic start>
POKE 44, <high byte of Basic start>
Step 3: Execute by RUN60000
Step 4: All references that couldn't be found are filled in with 65535, check that (!).
Step 5. Delete lines 60000 and upward, as Mike showed in a previous post
All linenumber references after GOTO, GOSUB and THEN are renumbered as well as the programlines themselves.
Also ON...GOTO and ON...GOSUB statements are properly adjusted
Do not remove line 60000. This line will grow and shrink depending on new linenumbers needing less or more space than old linenumbers. After renumbering this line will possibly come out shorter or longer, so before a next renumbering run re-adjust the length of this line again using colons.
I accept no liability for the use of this program !
Regards,
Wim.
Code: Select all
60000 REM::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
60010 E=6E4:A=10:B=10:DEFFNL(X)=PEEK(X)+256*PEEK(X+1):S=A:P=43
60020 P=FNL(P):IFFNL(P+2)<ETHENS=S+B:ON-(S<E)GOTO60020:STOP
60030 V=P+4:P=43
60040 P=FNL(P):ON-(FNL(P+2)=E)GOTO60150:T=P+4
60050 C=PEEK(T):T=T+1:ON1-SGN(C)GOTO60040:ON1-(C=141)-(C=137)-(C=167)GOTO60050
60060 X$="":M=T
60070 C=PEEK(T):T=T+1:IFC=32OR(C>47ANDC<58)THENX$=X$+CHR$(C):GOTO60070
60080 R=VAL(X$):ON1-SGN(R)GOTO60140:Q=43:S=A
60090 Q=FNL(Q):N=FNL(Q+2):IFN=ETHENS=65535:GOTO60110
60100 IFN-RTHENS=S+B:GOTO60090
60110 Y$=MID$(STR$(S),2):D=LEN(Y$)-LEN(X$):IFD<0THENFORI=MTOV:POKEI,PEEK(I-D):NEXT
60120 IFD>0THENFORI=VTOMSTEP-1:POKEI+D,PEEK(I):NEXT
60130 M=M-1:FORI=1TOLEN(Y$):POKEM+I,ASC(MID$(Y$,I)):NEXT:SYS50483:T=T+D:V=V+D
60140 ON1-(C=44)GOTO60050,60060
60150 S=A:P=43
60160 P=FNL(P):IFFNL(P+2)<ETHENH=INT(S/256):POKEP+2,S-256*H:POKEP+3,H:S=S+B:GOTO60160
Last edited by wimoos on Thu Jul 16, 2015 7:53 am, edited 10 times in total.
VICE; selfwritten 65asmgen; tasm; maintainer of WimBasic
Re: Challenge: Create or Delete Lines from inside a program
I found this interesting.Mike wrote:Yet you keep soliciting for help which constantly 'requires' you to think out of the box.
A good deal of your problems turn to non-issues once you'd use a better set of tools.
Sometimes you behave like a strange mechanic who not only insists to tap threads into the bare metal (which is quite usual), but also wants to fabricate the screws himself.
The first statement is a statement of fact with a hint of criticism or a view that innovating is wrong.
The second statement is likely correct in the paradigm that additional tools are available or acceptable.
The second statement implies that innovation of other tools is acceptable within the paradigm of additions.
The first implies innovation is less acceptable in the paradigm without additions when additions exist.
The inconsistent view of of innovation is interesting. It could lead one to to think that there is a bias toward additions vs. raw machine.
i.e. maybe we should recommend to sell the Vic 20 and buy a new console or pc where the problems (e.g. no sprites) are all resolved by someone else with new additions like new graphic processor, more memory etc.
More is not always better.
I prefer Jeff's approach to keep pushing the limits, it seems he treats the Vic like a cryptic crossword to be solved where the solution once revealed is elegant and unexpected.
What progress would there be without innovation of new challenges and solutions
Vic20-Ian
The best things in life are Vic-20
Upgrade all new gadgets and mobiles to 3583 Bytes Free today! Ready
The best things in life are Vic-20
Upgrade all new gadgets and mobiles to 3583 Bytes Free today! Ready