• list running prog c64 basic v2

    From Grant Weasner@1:138/397 to All on Mon Feb 9 15:16:51 2026
    Hello all,

    I've been trying to construct a cool program as a visual like a screen saver in basic. I'm not very good at basic, but I'm having fun with it.

    I was going for something that kinda looks like a display in movies like bladerunner, or outland. Those older late 80's sci-fi films.

    I thought a listing of a running basic program would be a cool part to GOTO with a maze type program.

    I wanted to get your thoughts on the way I listed a running program. My code snip doesn't include my entire program but I attached this snip to the end of my maze program to try and create a need look.


    5 print "initializing...": dim k$(255): rp=41111
    6 for t=124 to 255: w$="": rem --- fill the cache ---
    7 b=peek(rp): w$=w$+chr$(b and 127): rp=rp+1
    8 if b<128 goto 7
    9 k$(t)=w$+" ": if rp < 41581 then next t
    10 ad = 2049: print chr$(147)
    20 nx = peek(ad) + 256 * peek(ad+1)
    30 if nx = 0 then end
    40 ln = peek(ad+2) + 256 * peek(ad+3)
    50 print ln; " ";
    60 for i = ad + 4 to nx - 2
    70 c = peek(i): if c < 128 then print chr$(c);: goto 100
    80 print k$(c);
    100 next i: print: ad = nx: goto 20



    The array is initialized with the rom key words to list the program running program.
    If I had just put:

    10 list
    20 goto 10

    it wouldn't work because list executes something like a run-stop first.

    try it out.
    --- SBBSecho 3.20-Linux
    * Origin: Lunar Outpost - lunarout.synchro.net (1:138/397)
  • From Tilmann Hentze@3:633/10 to All on Tue Feb 10 21:00:02 2026
    Grant Weasner <usenet@vk3heg.net> schrieb:
    If I had just put:
    10 list
    20 goto 10
    it wouldn't work because list executes something like a run-stop first.

    This works silmilarily as your program for me: The programm lists itself and
    then stops. I wonder why.
    I tested this with vice and yapesdl.

    I'll try to comment your program:

    Lines 5 to 9 copies the BASIC keywords to k$() array.
    5 print "initializing...": dim k$(255): rp=41111
    6 for t=124 to 255: w$="": rem --- fill the cache ---
    7 b=peek(rp): w$=w$+chr$(b and 127): rp=rp+1
    8 if b<128 goto 7
    9 k$(t)=w$+" ": if rp < 41581 then next t

    The BASIC program starts at 2049, this is the addres of the first line;
    clear the screen
    10 ad = 2049: print chr$(147)

    The next BASIC line number is at this address
    20 nx = peek(ad) + 256 * peek(ad+1)

    This is the end of the program
    30 if nx = 0 then end

    Get the BASIC program line number and print it
    40 ln = peek(ad+2) + 256 * peek(ad+3)
    50 print ln; " ";

    Loop from line's start of text to end of line
    60 for i = ad + 4 to nx - 2

    Get a byte. If its value less than 128 then it is a character, print it
    70 c = peek(i): if c < 128 then print chr$(c);: goto 100

    It is a BASIC token, lookup in keywords table and print it.
    80 print k$(c);

    Loop end; print an empty line; next BASIC line address; restart loop
    100 next i: print: ad = nx: goto 20

    Best regards,
    Tilmann.
    --
    Wo sich noch Bit und Byte gute Nacht sagen.

    --- PyGate Linux v1.5.11
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Tilmann Hentze@3:633/10 to All on Tue Feb 10 21:00:02 2026
    Ingrid <0xcafe@directbox.com> schrieb:
    This works silmilarily as your program for me: The programm lists itself and
    then stops. I wonder why.

    D'oh! I found it:
    This is the end of the program
    30 if nx = 0 then end
    ^^^
    When one changes this to a goto <somewhere else> the program continues after the listing. Very nice!

    Best regards,
    Tilmann.
    --
    Wo sich noch Bit und Byte gute Nacht sagen.

    --- PyGate Linux v1.5.11
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Grant Weasner@1:138/397 to Tilmann Hentze on Sun Mar 8 22:57:56 2026
    Re: Re: list running prog c64 basic v2
    By: Tilmann Hentze to All on Tue Feb 10 2026 21:00:02

    This works silmilarily as your program for me: The programm lists itself and
    then stops. I wonder why.
    I tested this with vice and yapesdl.

    I didn't put a goto on the version I uploaded but if I had the goto in the correct spot, it would continously list loaded program if ran.

    in the original:
    30 if nx=0 then end

    was replaced with:
    30 if nx=0 then goto 10

    It would list over and over again. Well if it did't crash a few times. :|


    The use of this is just for fun, or whatever. But if you've ever tried something like.

    10 print "hi"
    20 list
    30 goto 10

    You will notice "20 list" will cause your program to "break/runstop", instead of listing the program itself over and over.

    That is why I wrote the code to list out the program loaded in memory and the demo of it was listing itself.

    I should have added in the goto after it finished listing the code to help illustrate it.
    --- SBBSecho 3.20-Linux
    * Origin: Lunar Outpost - lunarout.synchro.net (1:138/397)