home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Loadstar 243
/
243.d81
/
sideditx
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-08-26
|
23KB
|
594 lines
1 dn=peek(186):goto 9200:rem editor77 by harry bratt 10/26/84
5 jv=peek(56320):jb=1-(jv and 16)/16:jv=jv and 15:return
8 ac=abs(ac)
9 poke cy,3:print:poke cx,18-8*ac:printac$(ac+1):return
10 printchr$(19)chr$(146)c1$;:poke cx,25:print"mem:"fmchr$(157)" ":return
12 poke 54283,129:poke 54283,32:return
19 v0=nt:v1=ac:v2=oc:v3=ln:v4=rs+2*sp:v5=ty:v6=1
20 h=peek(mm+cn):ifhand3 then sp=1:rs=0:ty=0:return
22 sp=0:ln=7-(hand31)/4-.5*((hand32)=32):ty=-((hand64)=64)
24 h=peek(mm+cn+1):if h=0 then rs=1:goto28
26 rs=0:nt=(hand7)-1:oc=7-(hand56)/8:ac=(hand192)/64-2
28 return
30 poke cy,21:printc0$:poke cx,x*5:h=peek(mm+cn):if h and 3 goto 36
31 if rs then print"(r)"y$;:goto 33
32 printc0$nt$chr$(asc(ac$)+162*(asc(ac$)=194))oc$y$;
33 println$lm$ty$(ty);
34 if v6 then nt=v0:ac=v1:oc=v2:ln=v3:rs=v4and1:sp=(v4and2)/2:ty=v5:v6=0
35 return
36 poke 251,peek(mm+cn+1-(hand2)/2):poke 252,-((peek(mm+cn)and3)<>1):sys 1232
37 prints$(peek(252)+1)y$chr$(157);:qi=asc(mid$(s$,peek(252)+1))-65
38 if abs(v(qi))<90 then qj=peek(251):gosub80:goto 34
39 qj=peek(mm+cn+1)+256*peek(251):gosub 80:goto 34
40 poke 1216+sc,pk:sc=3:poke 1219,1:pk=14:goto 510
45 gosub 5:if jb=0 then return
47 gosub 5:if jb then 47
48 jb=1:return
50 for k=0 to 6:ac%(ak%(abs(k+6*(ky<0))))=(k<abs(ky))*sgn(ky):next:return
60 ln$=chr$(196+ln):lm$=chr$(46+14*(ln=int(ln))):return
65 nt$=chr$(67+nt+7*(nt>4)):ac$=chr$(194+ac):oc$=right$(str$(oc),1):return
70 k=j-int(j/256)*256:j=(j-k)/256:return
80 if qi<>2 goto 84
82 if qjand1 then print-(11-int(qj/16)+12*(qj/2and7));:return
83 qj=int(qj/16)+12*(7-(qj/2and7)):goto 87
84 ifqi=9 then qj=(qjand3584)/2+(qjand255)+((qjand256)=256)*2048:goto 87
85 if qi>10 then on qi-10 goto 88,88,90,90,91,92
86 if v(qi)<0 then qj=qj+256*(qj>127)
87 print mid$(str$(qj),2+(qj<0));:return
88 if qj=0 then print"n";:return
89 printfw$(qj-1,qi-11);:return
90 printnu$(qj,qi-13);
91 return
92 qj=qj-256*(qj=0):qj=int(14400/qj):goto 87
200 rem input sbr
210 a$="":lh=0:printchr$(164)chr$(157);
215 get b$:if b$=""goto 215
220 b=asc(b$):if b=13 or b=141 then print" ";:return
230 if b<>20 or lh=0 goto 240
232 lh=lh-1:a$=left$(a$,lh-(lh=0))
235 printchr$(157)" "chr$(157)chr$(157)chr$(164)chr$(157);:if lh=0 then a$=""
237 goto 215
240 if lh=mx-(asc(a$+" ")=45) goto 215
245 if b=45 and (fa and 1) and lh=0 goto 270
250 if b>47 and b<58 goto 270
260 if b<32 or b>90 or (fa and 2)=0 goto215
270 a$=a$+b$:lh=lh+1:printb$;:poke 212,0:printchr$(164)chr$(157);:goto 215
500 rem ** main joystick part **
501 if nn<0 then nt=0:oc=4:ln=3:rs=0:sp=0:goto 507
502 if gk=0 goto 507
503 tn=cn:for x=(tn/2-3)*(tn<5) to 7-(4-(nn-tn)/2)*-((nn-tn)<7)
504 cn=tn-6+2*x:gosub19:gosub60:gosub65:gosub30:next:cn=tn+2*(tn>nn)
505 gosub20:cn=tn
507 gosub 555:gosub 545
509 lq=0
510 gosub5:get k$:if k$="" then k$=" ":if jv=15 and jb=0 goto 510
511 if jb or asc(k$)=13 goto 600
512 if jv<>15 then poke 198,0:goto 530
513 on abs(asc(k$)-132) goto 8000,7000,4100,4000,4050,4060
514 k=-2*(k$="+")-3*(k$="\")-4*(k$="-"):if k>0 then ac=k-3:goto 554
515 if k$>"@" and k$<"h" then nt=asc(k$)-67:nt=nt-7*(nt<0):rs=0:sp=0:goto 553
516 if k$>"/" and k$<"8" then oc=val(k$):rs=0:sp=0:goto 553
517 if k$>"g" and k$<"x" then k=kl%(asc(k$)-72):if k>-1 then ln=k:goto 542
518 if k$="8" then ln=2:goto 542
519 if k$="." and ln>0 and ln<6 then ln=int(ln)+.5*(1-(ln*2)and1):goto 542
520 if (asc(k$) and 127)=20 goto 900
521 if k$="r" then rs=1-rs:ty=0:gosub555:goto 510
522 if k$="/" then ty=1-ty:rs=0:gosub555:goto 510
523 if asc(k$)=17 or asc(k$)=29 then jv=28-asc(k$):gosub650:jv=15
524 if k$="m" then lq=1:goto 740
525 if asc(k$)=221 or asc(k$)=219 then k=220-asc(k$):lq=1:goto 725
526 if asc(k$)=147 goto 980
529 goto 510
530 if jv>12 then rs=0:goto 550
535 k=.5*((jv>8)-(jv<8)):ln=ln+k:if ln=.5 or ln=6.5 then ln=ln+k
540 ln=ln+7.5*(ln>7)-7.5*(ln<0)
542 gosub12:if sp goto 554
543 gosub 545:goto 510
545 poke cy,17:print:poke cx,21:if sp then printc0$"--"spc(2)"-------":return
547 poke cy,17:print:poke cx,21:gosub 60:print c0$ln$lm$spc(2)ln$(ln):return
550 nt=nt+(jv=13)-(jv=14)
552 if nt<0 or nt>6 then oc=oc-(jv=14)+(jv=13):nt=3*(1-sgn(nt))
553 ac=ac%(nt):if sp=0 then gosub 555:goto 510
554 sp=0:gosub555:gosub545:goto 510
555 f1=0:poke cy,9:printc0$:poke cx,16:if rs then print"(r)":goto 567
556 if sp then print"---":goto 567
557 if oc>7 or (oc=7 and nt=6 and ac=-1) then oc=7:nt=6:ac=0
558 if oc<0 or (oc=0 and nt=0 and ac=1) then oc=0:nt=0:ac=0
559 poke 780,(1-rs)*(nt+1+8*(7-oc)+64*(ac+2)):sys 1396
560 poke cy,9:poke 54276,64:gosub 65:print
565 poke cx,16:printc0$nt$" "ac$:poke cy,14:print:poke cx,17
567 poke cy,14:print:poke cx,17:if rs or sp then print"-":goto 576
568 printoc$
576 poke cy,19:print:poke cx,9:printc3$chr$(146-128*rs)"rest"chr$(146);
577 print" <--select--> "chr$(146-128*ty)"tie":if f1 then return
579 if al=ac and rs=0 and sp=0 then 582
580 printc3$:h=ac:ac=al:gosub 8:ac=h:if rs or sp then al=2:return
582 al=ac:printc1$:gosub 8:return
600 rem ** button pressed **
605 fg=0
610 gosub 5:if jb=0 then 680
620 if jv=15 then 610
625 fg=1:if jv<13 goto 610
632 poke 1216+sc,pk
635 k=(jv=13)-(jv=14):sc=sc+k:sc=sc-k*(sc=5):sc=sc+6*((sc>6)-(sc<1))
640 pk=peek(1216+sc):poke 1216+sc,-(sc=3 or sc=1)
645 for k=1 to 90:next:goto 610
648 gosub650:gosub45:if jb then poke 198,0:goto 40
649 goto 648
650 k=-(jv<8):if(cn+(k=0))<0 or(cn>nn and k=1)or jv>11 or in then fg=1:return
651 if k=0 then poke cy,21:print:poke cx,35:printz$(0);
652 poke cy,21:print:printz$(1-k);:x=k*7
656 cn=cn-2+4*k:if cn-2=nn then fg=1:return
658 tn=cn:if sq=0 then gosub 20:gosub 545:gosub 555
660 cn=cn-6-14*(jv<8):if cn<0 or cn>nn goto 670
662 gosub19:gosub60:gosub65:gosub30
670 fg=1:cn=tn:gosub20:return
680 if fg then on sc goto 648,800,510,750,510,700
682 if (fm=0 and cn>nn) or (ln=7 and (ty or rs)) goto 510
684 in=in+(in>0):poke mm+cn,4*(7-int(ln))-32*(ln>int(ln))+64*ty
686 poke mm+cn+1,(1-rs)*(nt+1+8*(7-oc)+64*(ac+2)):gosub 60:gosub 65
687 if m1 then ac%(nt)=ac
688 if nn<cn then nn=nn+2:fm=fm-1:gosub10
689 x=3:gosub30:poke 780,peek(mm+cn+1):sys 1396:poke cy,21:print
690 poke 54276,64:printz$(0);:ty=0:f1=1:gosub576:cn=cn+2
691 if nn-cn<8 or in>4 goto 510
692 tn=cn:cn=cn+8:x=7:gosub19:gosub60:gosub65:gosub30:cn=tn:goto 510
700 rem ** key change **
710 gosub 45:if jb goto 40
715 if jv>12 and jv<15 goto 740
720 k=(jv=11)-(jv=7):if k=0 then 710
725 ky=ky+k:ky=ky+15*(sgn(ky)*(abs(ky)=8)):gosub12
730 poke cy,1:print:poke cx,10:printc1$abs(ky)chr$(157)chr$(193-2*(ky<0));
732 print" ("ky$(ky+7)")":goto 745
740 m1=1-m1:gosub12:poke cy,1:print:poke cx,30:printc1$mid$("on off",4-m1*3,3)
745 gosub 50:on lq+1 goto 710,509
750 rem** accidental change **
760 rs=0:gosub 45:if jb goto 40
770 k=(jv=7)-(jv=11):if k=0 then 760
775 ac=ac+k:ac=ac+3*(sgn(k))*(abs(ac)=2):if sp=0 then gosub555:goto 760
780 sp=0:gosub 555:gosub 545:goto 760
800 rem ** rest <--> tie **
810 gosub 45:if jb goto 40
815 if jv<>11 goto 825
820 rs=1-rs:ty=0:goto 840
825 if jv<>7 goto 810
830 ty=1-ty:rs=0:goto 840
840 if sp=0 then gosub555:goto 40
845 sp=0:gosub555:gosub545:goto 40
900 rem ** ins/del **
910 k=-(asc(k$)=20)
920 if cn>nnor (fm=0 and k=0) then on sq+1 goto 970,7375
923 gosub12:in=in-k*2+1:in=in-(in<0)
925 if k=0 then poke cy,21:print:poke cx,35:printz$(0);
927 poke cy,21:print:poke cx,15:printz$(1-k);
930 if k goto 939
932 for i=0 to 2 step 2:j=mm+cn+i:gosub 70:poke 251+i,k:poke 252+i,j:next i
936 j=nn-cn+2:gosub 70:poke 781,k:poke 782,j:sys 1024:nn=nn+2
938 fm=fm-1:on sq+1 goto 970,7375
939 if cn=nn goto 950
940 for i=0 to 2 step 2:j=mm+cn+2-i:gosub 70:poke 251+i,k:poke 252+i,j:next i
942 j=nn-cn:gosub 70:poke 781,k:poke 782,j:sys 1024
950 nn=nn-2:fm=fm+1:if nn-cn<8 or in>4 then on sq+1 goto 970,7375
960 tn=cn:cn=cn+8:x=7:gosub19:gosub60:gosub65:gosub30:cn=tn:onsq+1goto 970,7375
970 gosub10:goto 510
980 printchr$(19)spc(25)c1$"clear to end?"
982 get k$:if k$="" goto 982
985 if k$<>"y" goto 995
990 for k=1 to 5:poke cy,21:print:poke cx,15:printz$(0);:next
992 fm=fm+(nn-cn+2)/2:nn=cn-2:in=0
995 gosub10:goto 510
4000 rem ** enter measure **
4010 if m1 then gosub 50
4015 mz=mz+1+1000*(mz>999):j=mz:gosub70
4020 poke mm+cn,j*64+30:poke mm+cn+1,k:b=1:goto 7300
4050 k=0:goto 4065
4060 k=nn+2
4065 if in goto 510
4067 cn=k
4070 gk