add example basic program

This commit is contained in:
Greg Gauthier 2025-01-17 21:42:44 +00:00
parent aa9b3ccc71
commit 1a31d18e42

View File

@ -7,3 +7,84 @@ Tune in here for more resources supporting the videos in the link above.
I have a love-hate relationship with BASIC. It's easy to get started, it's difficult to maintain, and it's highly discouraged for anything of any serious complexity, or that requires good performance. However, The OSS BASICXE implementation does afford much better performance than standard Atari BASIC. I have a love-hate relationship with BASIC. It's easy to get started, it's difficult to maintain, and it's highly discouraged for anything of any serious complexity, or that requires good performance. However, The OSS BASICXE implementation does afford much better performance than standard Atari BASIC.
--- ---
### The Original MORSE.BAS Code
<pre class="atari">
10 Dim Alpha$(40):Alpha$="ABCDEFGHIJKLMNOPQRSTUVWXYZ .,?1234567890"
20 Dim Morse$(40,6):Dim Sel$(1):Dim Srch$(1):Dim Msg$(40):Dim Code$(6):Dim Match$(1)
25 Gosub 500:Rem Init Morse Table
30 Input "Enter Message: ",Msg$
32 For X=1 To Len(Msg$)
34 Srch$=Msg$(X)
40 Y=Find(Alpha$,Srch$,N)
45 If Y=0 Then Y=27
50 Sel$=Alpha$(Y)
55 Code$=Morse$(Y;)
60 Print Srch$;" ";Code$
62 For Z=1 To Len(Code$)
63 Match$=Code$(Z)
64 If Match$="" Then Gosub 2000
66 If Match$="" Then Gosub 3000
68 If Match$="" Then Gosub 3000
70 If Match$=" " Then Gosub 4000
75 Next Z
77 Gosub 4000:Rem Space Between Chars
80 Next X
100 End
500 Rem ******* MORSE TABLE ********
505 Rem ** Letters **
510 Morse$(1;)=""
520 Morse$(2;)=""
530 Morse$(3;)=""
540 Morse$(4;)=""
550 Morse$(5;)=""
560 Morse$(6;)=""
570 Morse$(7;)=""
580 Morse$(8;)=""
590 Morse$(9;)=""
600 Morse$(10;)=""
610 Morse$(11;)=""
620 Morse$(12;)=""
630 Morse$(13;)=""
640 Morse$(14;)=""
650 Morse$(15;)=""
660 Morse$(16;)=""
670 Morse$(17;)=""
680 Morse$(18;)=""
690 Morse$(19;)=""
700 Morse$(20;)=""
710 Morse$(21;)=""
720 Morse$(22;)=""
730 Morse$(23;)=""
740 Morse$(24;)=""
750 Morse$(25;)=""
760 Morse$(26;)=""
765 Rem ** Punctuation **
770 Morse$(27;)=" "
780 Morse$(28;)=""
790 Morse$(29;)=""
800 Morse$(30;)=""
805 Rem ** Numbers **
810 Morse$(31;)=""
820 Morse$(32;)=""
830 Morse$(33;)=""
840 Morse$(34;)=""
850 Morse$(35;)=""
860 Morse$(36;)=""
870 Morse$(37;)=""
880 Morse$(38;)=""
890 Morse$(39;)=""
900 Morse$(40;)=""
999 Return
2000 Rem *** Dit ***
2010 For S=1 To 10:Sound 0,38,10,10:Next S
2015 For S=1 To 5:Sound 0,0,0,0:Next S
2020 Return
3000 Rem *** Dah ***
3010 For S=1 To 30:Sound 0,38,10,10:Next S
3015 For S=1 To 3:Sound 0,0,0,0:Next S\n3020 Return
4000 Rem *** Space ***
4010 For S=1 To 15:Sound 0,0,0,0:Next S
4020 Return
</pre>