• Reboot The Olcott... BASIC?

    From Chris M. Thomasson@chris.m.thomasson.1@gmail.com to comp.theory on Mon Sep 8 20:40:01 2025
    From Newsgroup: comp.theory

    For Peter. I had to port one of my vector fields to AppleBasic of all
    things. This is an aspect of it. Its code that writes code, and you
    might like it. Remember programming in BASIC? I do. For sure when I was
    a little kiddo. Can you run this on, say, an Apple IIe?
    Here is a more self-contained version of my generator. It asks you how
    many vertices to enter. Builds CTTEST.BAS, then you can just EXEC
    CTTEST.BAS to run it. Here is my code. Just for fun. The generated code
    draws a bunch of polys using the table LT. Btw, can you get it to work
    on your end?

    Sorry about the indent mess. Shit.
    _______________________________
    10 REM CREATE NEW PROGRAM FILE
    11 INPUT "Enter Polygon Points: "; N$
    12 LN = ABS(VAL(N$))
    15 PRINT "Generating " + STR$(LN) + "-Gon CTTEST.BAS..."
    20 D$ = CHR$(4)
    25 PRINT D$; "DELETE CTTEST.BAS"
    22 ONERR GOTO 28
    28 POKE 216,0
    30 PRINT D$; "OPEN CTTEST.BAS"
    40 PRINT D$; "WRITE CTTEST.BAS"
    50 REM HOME
    60 PC = 10
    65 PRINT "NEW"
    70 P0$ = "REM " + CHR$(34) + "ct_spawn_test" + CHR$(34): GOSUB 5000
    80 P0$ = "PRINT " + CHR$(34) + "Chris M. Thomasson Spawn" + CHR$(34):
    GOSUB 5000
    101 P0$ = "LN = " + STR$(LN): GOSUB 5000
    120 AB = ATN(1) * 4
    130 SN = (AB * 2) / LN
    140 DIM LT(LN, 2)
    141 P0$ = "DIM LT(" + STR$(LN) + ", 2)": GOSUB 5000
    150 FOR I = 1 TO LN
    160 A = I * SN
    165 LT(I, 1) = COS(A)
    166 LT(I, 2) = SIN(A)
    171 P0$ = "LT(" + STR$(I) + ", 1) = " + STR$(COS(A)): GOSUB 5000
    181 P0$ = "LT(" + STR$(I) + ", 2) = " + STR$(SIN(A)): GOSUB 5000
    290 NEXT I
    300 X0 = 292/2: X1 = 292/6: Y0 = 192/2: Y1 = 192/4
    301 P0$ = "X0 = " + STR$(X0) + ": X1 = " + STR$(X1): GOSUB 5000
    311 P0$ = "Y0 = " + STR$(Y0) + ": Y1 = " + STR$(Y1): GOSUB 5000
    321 P0$ = "HGR : HCOLOR = 3": GOSUB 5000
    430 P0$ = "DIM C0(5)": GOSUB 5000
    441 P0$ = "FOR I = 1 TO LN": GOSUB 5000
    442 P0$ = "C0(1) = X0 + LT(I,1) * 24: C0(2) = Y0 + LT(I,2) * 24: C0(3) =
    .5 * X1: C0(4) = .5 * Y1 :C0(5) = LN: GOSUB 1000": GOSUB 5000
    443 P0$ = "NEXT I": GOSUB 5000
    470 P0$ = "END": GOSUB 5000
    800 PC = 1000
    810 P0$ = "REM PLOT POLY C0(x, y, rx, ry, n)": GOSUB 5000
    820 P0$ = "HPLOT C0(1) + LT(1, 1) * C0(3), C0(2) + LT(1, 2) * C0(4)":
    GOSUB 5000
    830 P0$ = "FOR I0 = 2 TO C0(5)": GOSUB 5000
    840 P0$ = " HPLOT TO C0(1) + LT(I0, 1) * C0(3), C0(2) + LT(I0, 2) *
    C0(4)": GOSUB 5000
    850 P0$ = "NEXT I0": GOSUB 5000
    860 P0$ = "HPLOT TO C0(1) + LT(1, 1) * C0(3), C0(2) + LT(1, 2) * C0(4)":
    GOSUB 5000
    870 P0$ = "RETURN": GOSUB 5000
    890 GOTO 6000
    5000 REM PUSH LINE
    5010 PRINT STR$(PC) + " " + P0$
    5020 PC = PC + 10
    5030 RETURN
    6000 REM CLOSE FILE
    6005 PRINT "RUN"
    6010 PRINT D$; "CLOSE"
    6020 PRINT "Complete! :^)"
    6030 END
    _______________________________
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Chris M. Thomasson@chris.m.thomasson.1@gmail.com to comp.theory on Mon Sep 8 20:42:06 2025
    From Newsgroup: comp.theory

    On 9/8/2025 8:40 PM, Chris M. Thomasson wrote:
    For Peter. I had to port one of my vector fields to AppleBasic of all things. This is an aspect of it. Its code that writes code, and you
    might like it. Remember programming in BASIC? I do. For sure when I was
    a little kiddo. Can you run this on, say, an Apple IIe?
    Here is a more self-contained version of my generator. It asks you how
    many vertices to enter. Builds CTTEST.BAS, then you can just EXEC
    CTTEST.BAS to run it. Here is my code. Just for fun. The generated code draws a bunch of polys using the table LT. Btw, can you get it to work
    on your end?


    Also, check this out. From my code C++ code that helps me create BASIC
    code. It looks pretty clean for BASIC? ;^)


    https://pastebin.com/raw/DsxVv5fi
    (link to raw pastebin...)



    100 REM ct_vfield_applesoft_basic
    110 HOME
    120 HGR: HCOLOR = 3
    130 PRINT "ct_vfield_applesoft_basic"
    140 GOSUB 1000
    150 GOSUB 3000
    160 V1(1) = 0: V1(2) = 0: V1(3) = 1: V1(4) = 128
    170 GOSUB 6000
    180 V1(1) = 0: V1(2) = 0: V1(3) = 0.75: V1(4) = 128
    190 GOSUB 6000
    200 V1(1) = 0: V1(2) = 0: V1(3) = 0.5: V1(4) = 128
    210 GOSUB 6000
    220 V1(1) = -1.5: V1(2) = 0: V1(3) = 0.5: V1(4) = 128
    230 GOSUB 6000
    240 V1(1) = 0: V1(2) = 1.75: V1(3) = 0.75: V1(4) = 128
    250 GOSUB 6000
    260 END

    1000 REM ct_init
    1010 PRINT "ct_init"
    1020 DIM A0(6)
    1030 DIM V0(4)
    1040 DIM V1(4)
    1050 GOSUB 2000
    1060 RETURN

    2000 REM ct_init_plane
    2010 PRINT "ct_init_plane"
    2020 A0(1) = 279: REM m_plane.m_width
    2030 A0(2) = 191: REM m_plane.m_height
    2040 A0(3) = 0.0126106: REM m_plane.m_xstep
    2050 A0(4) = 0.0126316: REM m_plane.m_ystep
    2060 A0(5) = -1.75288: REM m_plane.m_axes.m_xmin
    2070 A0(6) = 1.2: REM m_plane.m_axes.m_ymax
    2080 RETURN

    3000 REM ct_display_plane
    3010 PRINT "ct_display_plane"
    3020 FOR I0 = 1 TO 6
    3030 PRINT "A0("; I0; ") = " A0(I0)
    3040 NEXT I0
    3050 RETURN

    4000 REM ct_project_point
    4010 PRINT "ct_project_point"
    4020 V0(3) = (V0(1) - A0(5)) / A0(3)
    4030 V0(4) = (A0(6) - V0(2)) / A0(4)
    4040 IF V0(3) < 0 THEN V0(3) = INT(V0(3) - .5)
    4050 IF V0(3) >= 0 THEN V0(3) = INT(V0(3) + .5)
    4060 IF V0(4) < 0 THEN V0(4) = INT(V0(4) - .5)
    4070 IF V0(4) >= 0 THEN V0(4) = INT(V0(4) + .5)
    4080 RETURN

    5000 REM ct_plot_point
    5010 PRINT "ct_plot_point"
    5020 GOSUB 4000
    5030 IF V0(3) > -1 AND V0(3) <= A0(1) AND V0(4) > -1 AND V0(4) <=
    A0(2) THEN HPLOT V0(3), V0(4)
    5040 RETURN

    6000 REM ct_plot_circle
    6010 PRINT "ct_plot_circle"
    6020 AB = 6.28318 / V1(4)
    6030 FOR I1 = 0 TO 6.28318 STEP AB
    6040 V0(1) = V1(1) + COS(I1) * V1(3)
    6050 V0(2) = V1(2) + SIN(I1) * V1(3)
    6060 GOSUB 5000
    6070 NEXT I1
    6080 RETURN





    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Chris M. Thomasson@chris.m.thomasson.1@gmail.com to comp.theory on Tue Sep 9 11:49:10 2025
    From Newsgroup: comp.theory

    On 9/8/2025 8:40 PM, Chris M. Thomasson wrote:
    For Peter. I had to port one of my vector fields to AppleBasic of all things. This is an aspect of it. Its code that writes code, and you
    might like it. Remember programming in BASIC? I do. For sure when I was
    a little kiddo. Can you run this on, say, an Apple IIe?
    Here is a more self-contained version of my generator. It asks you how
    many vertices to enter. Builds CTTEST.BAS, then you can just EXEC
    CTTEST.BAS to run it. Here is my code. Just for fun. The generated code draws a bunch of polys using the table LT. Btw, can you get it to work
    on your end?


    Perhaps if he gets into Old school BASIC he will stop posting to the
    C/C++ groups for a while?

    [...]

    --- Synchronet 3.21a-Linux NewsLink 1.2