home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Loadstar 29
/
029.d81
/
demo
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-08-26
|
8KB
|
248 lines
0 rem (NULL) (NULL) (NULL)(NULL)(NULL)(NULL){$60}newcloserndlet(NULL)(NULL)mid$(NULL)(NULL)l.................................................
5 rem
6 rem warning!
7 rem do not delete line 0! it contains a machine language routine;
8 rem which, if deleted, could cause your computer to lock-up.
9 rem ie: deleting line 0 could be hazardous to this prg's health!
10 rem
11 rem line 0 is not needed to run nubasic. it is needed to run
12 rem this demo program. all nubasic commands will work without it.
13 rem
20 rem nubasic demo
25 rem by joe garrett
30 if peek(49152)=165 and peek(49153)=2 then 50
35 ifpeek(816)=231andpeek(817)=195thensys49155:poke816,165:poke817,244
40 gosub60100
45 load"nubasic",8,1
50 sys 49152
60 :
65 gosub 5000
70 rem the 'at' statement example
75 :
77 poke53280,3:poke53281,3
80 print"[147]"
85 print" the 'at' command makes text formatting"
86 (NULL) 14,7 : print "a breeze!":gosub4000
87 print"[147]":poke53281,14:poke53280,14
90 for t=0 to 18 step 2
100 (NULL) 18+t,24 : print "wow";
110 (NULL) 18-t,24 : print "wow"
115 (NULL) 10,2 : next
120 :
130 for t=18 to 0 step -2
140 (NULL) 18+t,24 : print "wow";
150 (NULL) 18-t,24 : print "wow"
160 (NULL) 0,2 : next t : print
165 print" syntax: at xpos,ypos":gosub10030
170 (NULL) 5,24 : print" ";
190 :
200 rem the 'beep' example
205 :
206 poke53280,7:poke53281,7
207 (NULL) 5,12 : print"there's a 'beep' sound command"
208 rem note frequencys are found on page 152 of your user's man.
209 print" "
210 (NULL) 4816,4
220 (NULL) 6430,4
230 (NULL) 8100,4
240 (NULL) 9634,8
250 (NULL) 8100,4
260 (NULL) 9634,20
265 print"[144] syntax: beep pitch,duration"
270 (NULL) 16,14 : print "charge!"; : gosub10030
290 :
300 rem the 'alpha' statement example
310 :
330 print"[147][144]" : poke53280,13:poke53281,13
340 (NULL) 0,4 : print"the 'alpha' statement will alphabetize"
345 print "a string array."
350 (NULL) 0,14 : print"please wait while i generate some letters to sort..."
355 dim a$(100)
360 for t=1 to 100
370 a$(t)=chr$(rnd(1)*26+65)
380 next t : gosub10000
390 print"[147]here are the letters before using the 'alpha' statement:"
400 for t=1 to 100
410 print a$(t);
420 next t : print : print
425 print"calling alpha..." : (NULL) a$(0)
430 print"here are the letters after using the 'alpha' statement:"
440 for t=1 to 100
450 print a$(t);
460 next t :print:print
465 print" syntax: alpha a$(0) "
470 gosub10030
500 :
510 rem directory command
520 :
525 poke53280,5:poke53281,5
530 print"[147]the 'dir' command will display the disk directory..."
533 print"to pause the directory, press & hold"
534 print"the space bar; to stop it, press any"
535 print"other key."
537 gosub10000 : print"[147]"
540 (NULL) : print
550 print"oh wow, that was really cool."
560 print"and it didn't do a thing to my program in memory!"
570 gosub10030
580 :
590 rem window commands
600 :
605 poke53280,11:poke53281,11
610 print "[147][150]next, a demo of the 'window', 'scrlup', and 'scrldn' commands"
620 print"first, i will draw a box around the"
622 print"window, then let the scrlup and scrldn"
624 print"commands do their duty."
630 (NULL) 5,10 : print"[144]x1,y1[159][176][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][174]"
640 for t=1 to 5
650 (NULL) 10,10+t:print"[221] [159][221]"
660 next t
670 (NULL) 10,15 : print"[173][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][189][144]x2,y2"
680 fort=1 to 20 : read a$(t) : next t
690 data joe,karen,tom,mary,sue,dave,jerry,betty,luanne,greg,joan,jon,mark,donna
700 data jim,al,judy,bobby,justin,mike
710 (NULL) 11,11,28,14
720 for t=1 to 4
730 (NULL) 11,10+t : print t;a$(t) : next : n=1
740 (NULL) 0,7 : print"press cursor up or down"
745 (NULL) 5 ,24 : print"<<< press space to continue >>>";
746 (NULL) 0,17 : print"[158]the joystick works too in port 2!"
747 (NULL) 0,19 : print"now that's a fancy way to display info."
748 print"[144] syntax: window x1,y1,x2,y2"
749 print" scrlup : scrldn"
750 get t$ : j=(NULL)(2) : if t$=" "then 800
760 if t$<>"[145]" and j<>1 then 780
765 n=n-1 : if n=0 then n=1 : (NULL)20000,3 : goto750
770 (NULL) : (NULL) 11,11 : print n;a$(n)
775 goto 750
780 if t$<>"" and j<>5 then 750
785 n=n+1 : if n=18 then n=17 : (NULL) 20000,3 : goto750
790 (NULL) : (NULL) 11,14 : print n+3;a$(n+3)
795 goto 750
800 (NULL) 1024,2023,40960 : (NULL) 55296,56295,41960
805 print"[147][159]the joy(x) function, where 'x' is the"
810 print"port number, returns a value of 0-8 for"
820 print"directions as follows:"
825 print" centered - 0"
830 print" north - 1"
840 print" northeast - 2"
845 print" east - 3"
850 print" southeast - 4"
855 print" south - 5"
860 print" southwest - 6"
865 print" west - 7"
870 print" northwest - 8"
880 print"if the fire button was pressed, the value would be 16 more."
890 (NULL)0,21: print"that's a major improvement in handling the joystick!"
895 poke198,0: (NULL) 5,24 : print"<<< press space to continue >>> ";
900 gosub 3000
910 :
915 rem the move command
920 :
925 poke53280,7:poke53281,7
930 print"[147][144]the last command in this installment of"
935 print"nubasic is the 'move' command."
940 print"this command will copy a section of"
945 print"memory from one place to another."
950 print"i played a sneaky trick on you two"
955 print"screens ago by 'move'ing the screen and"
960 print"its color memory underneath the kernal"
965 print"rom. now, i can get them back in a "
970 print"flash...": (NULL) 1024,2023,42960 : (NULL)55296,56295,43960
975 gosub10030 :poke53280,11:poke53281,11
980 (NULL) 40960,41959,1024 : (NULL) 41960,42959,55296
990 gosub10030 : poke53280,7:poke53281,7
995 (NULL) 42960,43959,1024 : (NULL) 43960,44959,55296
997 fort=1 to 5
1000 (NULL) 2+t,13+t: print"holy smokes, that's like magic."
1010 nextt
1040 print"syntax: move startaddr,endaddr,destaddr":gosub10030
1050 print"[147]to disable nubasic at any time, type 'nuoff' [return]."
1060 print"try these advanced commands in your own"
1070 print"programs and send them to us for possible publication."
1080 print"this utility is brought to you by the"
1090 print"loadstar programming staff."
1092 print"don't dare miss our future enhancements"
1094 print"to nubasic. more new and exciting"
1096 print"commands will greatly increase your programming potential."
1100 print"press 'a' to run the demo again"
1110 print"press 'q' to quit"
1120 gett$:ift$<>"a"andt$<>"q"then1120
1130 ift$="a"thenrun70
1140 open15,8,15,"r0:hello connect=hello connect"
1150 input#15,er:close15
1160 if er<>63 then end
1170 print"[147]nuoff":print"loadf$,8":print"run";:f$="hello connect"
1180 poke631,13:poke632,13:poke633,13:poke198,3:end
2997 :
2998 rem *** joystick routine ***
3000 for t=0 to 8 : read jy$(t) : next
3010 data centered,north,northeast,east,southeast,south,southwest,west
3020 data northwest
3025 (NULL) 18,18 : print" "
3030 (NULL) 0,18 : print"[158]joystick port 2 = ";
3040 j=(NULL)(2) : get t$
3050 if j>=16 then j=j-16 : print"fire ";
3060 print jy$(j) : if t$<>" "then 3025
3070 return
3998 :
3999 rem at blurb
4000 print"you can plot the cursor anywhere on the"
4010 print " screen and the next character printed"
4020 print" will be 'at' your designated location." : goto10000
4997 :
4998 rem *** intro
4999 :
5000 poke53280,12:poke53281,15
5002 print"[147][144] nubasic demo"
5005 print"this program will demonstrate several"
5010 print"new commands that nubasic is adding to"
5020 print"your commodore-64 standard basic."
5030 goto10000
10000 :
10010 rem press a key to continue
10020 :
10030 poke198,0: (NULL) 5,24 : print"<<< press space to continue >>> ";
10040 gett$: if t$<>" " then 10040
10050 return
60100 pn$="[206][213][194][193][211][201][195] [196][197][205][207]":an$="[194][217]: [202][207][197] [199][193][210][210][197][212][212]"
60110 bo=00: