Applesoft Basic and Virtual Basic code, listing, script examples
__   ___     _             _   ___          _    
\ \ / (_)_ _| |_ _  _ __ _| | | _ ) __ _ __(_)__ 
 \ V /| | '_|  _| || / _` | | | _ \/ _` (_-< / _|
  \_/ |_|_|  \__|\_,_\__,_|_| |___/\__,_/__/_\__|
                                                 

NATURE IS AN INFINITE SPHERE OF WHICH THE CENTER IS EVERYWHERE AND THE CIRCUMFERENCE NOWHERE

(nature is.flv) NATURE IS AN INFINITE SPHERE OF WHICH THE CENTER IS EVERYWHERE AND THE CIRCUMFERENCE NOWHERE
(Use authentic machine speed)
Virtual Basic Applesoft Basic
rem * control D char
d${Cmd}= chr$(4)
pi= 3.14159:ci{circumference in radians}= (2 * pi)

rem * width max, eight max for screen (279, 191, 159)
ml%{widthMax}= 279:mh%{eightMax}= 191
if peek(33){mode 80 cols} = 80 then mh%{eightMax}= 159

rem * true random number
def fn alea{true random number}(x) = int(rnd(peek(78)+peek(79)*256) * x + 1)

rem * beep and buzz by default
bz%{NbreBuzz}= 3:be%{NbreBeep}= 1

{*** my program x ***}
section intro
    text:home
    gosub @splash
    vtab(peek(37) + 2):s$= "*** x ***":gosub @centertext{this subscript is in lib/lib.baz}:print s$:get s$
    # general vars
    vtab(peek(37) + 4)
    # input he$
    # he$= "L'univers est un cercle dont le centre est partout et la circonference nulle part"
    he$= "Nature is an infinite sphere of which the center is everywhere and the circumference nowhere"
closesection
section main program
    ls{length of string}= len(he$)
    xo= 20:yo= 12
    ry{radius}= 10
    p2{pi et demi}= pi * 1.5
    s{step}= (ci{circle in radiants} / ls{length of string})
    ml%= 40:mh%= 22
    £begin {*** main loop ***}
        bp%= bp%{mainLoop} + 1
        home:b2= 0
        ry = ry - 0.5
        for b1{varloop}= 0.1 to ( ci{circle in radiants} + 0.1 ) step s
            b2= B2 + 1
            v1= (ry{radius}) * cos(b1 + p2)
            v2= (ry{radius}) * sin(b1 + p2)
            x2= int(xo{OrigX} + v1)
            y2= int(yo{OrigY} + v2)
            gosub @checkxy
            htab(x2)
            vtab(y2)
            print mid$(he${hello},b2{varLoop1},1) {only one character print}
            gosub @keyboardcapture {this subscript is in lib/lib.baz}
            # gosub @shortdowntime {this subscript is in lib/lib.baz}
        next

        if (bp%{mainLoop} < 100) then goto @begin
    £endprogram
    text:home:poke 49168,0
    gosub @credits
    end
closesection
section subscripts

closesection
£hgrscreen
    if peek(33) < 41 and mh%{MaxHauteur} > 159 then hg$= "hgr2"
    if peek(33) < 41 and mh%{MaxHauteur} <= 159 then hg$= "hgr"
    rem * mod 80 colonnes
    if peek(33) > 40 then hg$= "hgr"
    if hg$ = "hgr" then hgr
    if hg$ = "hgr2" then hgr2
return

£checkxy
    rem * check x,y to prevent overflow
    x1= int(x1):x2= int(x2):y1= int(y1):y2= int(y2)
    if x1 >= 1 and x1 < ml% and x2 >= 1 and x2 < ml% and y1 >= 1 and y1 < mh% and y2 >= 1 and y2 < mh% then return
    if x1 > ml%{widthMax} then x1= ml%{widthMax}
    if x2 > ml%{widthMax} then x2= ml%{widthMax}
    if y1 > mh%{eightMax} then y1= mh%{eightMax}
    if y2 > mh%{eightMax} then y2= mh%{eightMax}
    if x1 < 1 then x1= 1
    if x2 < 1 then x2= 1
    if y1 < 1 then y1= 1
    if y2 < 1 then y2= 1
return


£splash
    text:home
    vtab(3):print
    vtab(peek(37) + 2)
    s${sentence}= "applesoft basic code":gosub @centertext
    print s${sentence}
return

£credits
    text:home
    gosub @beep
    vtab(3):print
    vtab(peek(37) + 2)
    s${sentence}= "by andres aka loz":gosub @centertext
    print s${sentence}
return

£keyboardcapture
    rem * capture last keyboard entered
    ki%{keyboardInput}= peek(49152)
    rem * reset
    poke 49168,0
    rem * actions
    if (ki%{keyboardInput} = 155{Escape}) then goto @endprogram
    if (ki%{keyboardInput} = 212{key T}) then text
return

£centertext
    t9%{leftSpace}= int( (peek(33) - len(s${sentence}) ) / 2 )
    rem * is result is null
    if (t9% < 1) then t9%= 0
    htab(t9%{leftSpace}+1)
return

£beep
if (be%{NbreBeep} < 2) then be%{NbreBeep}= 1
    for b9= 1 to be%{NbreBeep}
        print chr$(7);
    next
return

£longdowntime
    for b9= 1 to 2000:next b9
return

£shortdowntime
    for b9= 1 to 800:next b9
return
10 REM - WORDS.BAS - 28/02/2011 - 00h40 - BY - ANDRES - AKA - LOZ - COPYLEFT
20 D$= CHR$(4)
30 PI= 3.14159:CI= (2 * PI)
40 ML%= 279:MH%= 191
50 IF PEEK(33) = 80 THEN MH%= 159
60 DEF FN ALEA(X) = INT(RND(PEEK(78)+PEEK(79)*256) * X + 1)
70 BZ%= 3:BE%= 1
80 TEXT:HOME
90 GOSUB 600
100 VTAB(PEEK(37) + 2):S$= "*** X ***":GOSUB 810:? S$:GET S$
110 VTAB(PEEK(37) + 4)
120 HE$= "NATURE IS AN INFINITE SPHERE OF WHICH THE CENTER IS EVERYWHERE AND THE CIRCUMFERENCE NOWHERE"
130 LS= LEN(HE$)
140 XO= 20:YO= 12
150 RY= 10
160 P2= PI * 1.5
170 S= (CI / LS)
180 ML%= 40:MH%= 22
190 REM->BEGIN
200 BP%= BP% + 1
210 HOME:B2= 0
220 RY = RY - 0.5
230 FOR B1= 0.1 TO ( CI + 0.1 ) STEP S
240 B2= B2 + 1
250 V1= (RY) * COS(B1 + P2)
260 V2= (RY) * SIN(B1 + P2)
270 X2= INT(XO + V1)
280 Y2= INT(YO + V2)
290 GOSUB 480
300 HTAB(X2)
310 VTAB(Y2)
320 ? MID$(HE$,B2,1)
330 GOSUB 750
340 NEXT
350 IF (BP% < 100) THEN GOTO 200
360 REM->ENDPROGRAM
370 TEXT:HOME:POKE 49168,0
380 GOSUB 670
390 END
400 REM->HGRSCREEN
410 IF PEEK(33) < 41 AND MH% > 159 THEN HG$= "HGR2"
420 IF PEEK(33) < 41 AND MH% <= 159 THEN HG$= "HGR"
430 IF PEEK(33) > 40 THEN HG$= "HGR"
440 IF HG$ = "HGR" THEN HGR
450 IF HG$ = "HGR2" THEN HGR2
460 RETURN
470 REM->CHECKXY
480 X1= INT(X1):X2= INT(X2):Y1= INT(Y1):Y2= INT(Y2)
490 IF X1 >= 1 AND X1 < ML% AND X2 >= 1 AND X2 < ML% AND Y1 >= 1 AND Y1 < MH% AND Y2 >= 1 AND Y2 < MH% THEN RETURN
500 IF X1 > ML% THEN X1= ML%
510 IF X2 > ML% THEN X2= ML%
520 IF Y1 > MH% THEN Y1= MH%
530 IF Y2 > MH% THEN Y2= MH%
540 IF X1 < 1 THEN X1= 1
550 IF X2 < 1 THEN X2= 1
560 IF Y1 < 1 THEN Y1= 1
570 IF Y2 < 1 THEN Y2= 1
580 RETURN
590 REM->SPLASH
600 TEXT:HOME
610 VTAB(3):?
620 VTAB(PEEK(37) + 2)
630 S$= "APPLESOFT BASIC CODE":GOSUB 810
640 ? S$
650 RETURN
660 REM->CREDITS
670 TEXT:HOME
680 GOSUB 860
690 VTAB(3):?
700 VTAB(PEEK(37) + 2)
710 S$= "BY ANDRES AKA LOZ":GOSUB 810
720 ? S$
730 RETURN
740 REM->KEYBOARDCAPTURE
750 KI%= PEEK(49152)
760 POKE 49168,0
770 IF (KI% = 155) THEN GOTO 370
780 IF (KI% = 212) THEN TEXT
790 RETURN
800 REM->CENTERTEXT
810 T9%= INT( (PEEK(33) - LEN(S$) ) / 2 )
820 IF (T9% < 1) THEN T9%= 0
830 HTAB(T9%+1)
840 RETURN
850 REM->BEEP
860 IF (BE% < 2) THEN BE%= 1
870 FOR B9= 1 TO BE%
880 ? CHR$(7);
890 NEXT
900 RETURN
910 REM->LONGDOWNTIME
920 FOR B9= 1 TO 2000:NEXT B9
930 RETURN
940 REM->SHORTDOWNTIME
950 FOR B9= 1 TO 800:NEXT B9
960 RETURN
pages 1 (2)

LoGz CMS http://www.logz.org | Copyleft Licence Art Libre | Crédits | site map |  Vrs? | Vxl?