<< BACK  ----- C65 DEMOPROGRAMS (Basic 10.0) -----




-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

gfxdemo1.prg ==2001==

   10 rem ** 320x200x32col fractal(?)
   20 rem **
   30 rem ** this is a little demonstration how to do a formula-based
   40 rem ** computer graphic using the screen instructions of the 65
   50 rem ** calculation will last about 20 minutes. basic is sloooow
   60 rem ** 
   70 rem ** 
   80 rem **
   90 rem ** 
  100 rem
  110 trap 330                  : rem ** in case of error want text screen
  120 graphic clr               : rem ** initialize graphics
  130 screen def 1,0,0,5        : rem ** define 320x200x5 graphics screen
  140 screen open 1             : rem ** open it
  150 for i=1 to 31
  160 read a,b,c
  170 palette 1,i,a,b,c
  180 next i
  190 screen set 1,1            : rem ** make screen 1 the view screen
  200 scnclr 0                  : rem ** clear screen with color 0
  210 border 0                  : rem ** set border color to 0
  220 pen 0,15
  230 char 15,2,2,2,2,"toxic waste"
  240 char 15,20,1,1,2,"calculating 20 minutes"
  250 for x=1 to 320
  260 for y=1 to 190
  270 c=(x*x+y*y)/600           : rem ** draw the fractal
  280 pen 0,c
  290 draw x,y
  300 next y
  310 next x
  320 get a$:if a$="" goto 320  : rem ** wait for key press
  330 screen close 1            : rem ** close graphic, get text screen
  340 palette restore           : rem ** restore normal system colors
  350 border 6                  : rem ** restore normal border color
  360 end
  370 data 1,0,1,3,0,3,5,0,5,7,0,7,9,0,9,11,0,11,13,0,13,15,0,15
  380 data 15,0,13,15,0,11,15,0,9,15,0,7,15,0,5,15,0,3,15,0,1
  390 data 13,0,3,11,0,5,9,0,7,7,0,9,5,0,11,3,0,13,1,0,15,0,0,13
  400 data 0,0,11,0,0,9,0,0,7,0,0,5,0,0,3,0,0,1,0,0,0,0,0,0





-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

mandel1.prg ==2001==

   10 n%=0:nm%=0:x=0:y=0:r=0:i=0:d=0:v=0:u=0:a=0:b=0:da=0:db=0
   20 iu=0:io=0:ru=0:ro=0:f1%=1:f2%=1:f3%=1:f4%=1:xr=0:yi=0
   30 a$="":b$="":graphic clr
   40 screen def 1,0,0,7
   50 screen open 1
   60 rem *********************************
   70 rem *                               *
   80 rem *    programm zur grafischen    *
   90 rem *        darstellung von        *
  100 rem *                               *
  110 rem *m a n d e l b r o t m e n g e n*
  120 rem *                               *
  130 rem *  heimo ponnath  hamburg 1985  *
  140 rem *                               *
  150 rem * slightly modified by txw for  *
  160 rem * running this on the cbm c65   *
  170 rem *                               *
  180 rem * best start with the following *
  190 rem * values for ru,ro,iu and io:   *
  200 rem * -2,0.5,-1.25,1.25             *
  210 rem *                               *
  220 rem * do not forget to alter lines  *
  230 rem * 720 and 730 to give the right *
  240 rem * unit number parameter for the *
  250 rem * bsave command.                *
  260 rem *                               *
  270 rem * you can load the files "bank0"*
  280 rem * and "bank1" later using the   *
  290 rem * bload command with the follow-*
  300 rem * ing basic v10 program:        *
  310 rem *                               *
  320 rem * 10 graphic clr                *
  330 rem * 20 screen def 1,0,0,5         *
  340 rem * 30 screen open 1              *
  350 rem * 40 bload "bank0",p49152,b0,u8 *
  360 rem * 50 bload "bank1",p49152,b0,u8 *
  370 rem * 60 screen set 1,1             *
  380 rem *                               *
  390 rem *********************************
  400 print:print:print:printchr$(18)"mandelbrotmengen als grafik"chr$(146)
  410 print:print:print"parameter der gaussebene:":input"ru,ro,iu,io=";ru,ro,iu,io
  420 print:print"komplexe variable (normal 0,0)":input"x,y=";xr,yi
  430 print:print"would you like to save the finished picture as a 2-filer"
  440 print"(screenmem bank0 c000-ffff and bank1 c000-ffff) (y/n)":input ant$
  450 nm%=45
  460 print:print:print"now this will take a while..even on c65! :-)"
  470 sleep2
  480 screen set 1,1:scnclr 0
  490 border 0
  500 restore
  510 for i=1 to 46
  520 read a,b,c
  530 palette 1,i,a,b,c
  540 next i
  550 da=(ro-ru)/159:db=(io-iu)/199
  560 b=iu-db
  570 foru=0to199 : rem 199
  580 b=b+db:a=ru-da
  590 forv=0to159 : rem 159
  600 a=a+da
  610 n%=0:r=xr:i=yi:d=0
  620 do while d<4
  630 x=r:y=i
  640 r=x*x-y*y+a:i=2*x*y+b:d=r*r+i*i
  650 n%=n%+1
  660 ifn%=nm%thenexit
  670 loop
  680 ifn%=nm%thenpen0,0:drawv,u:else pen0,n%+1:drawv,u
  690 nextv:nextu
  700 get a$:ifa$="" then goto 700
  710 if ant$<>"y" then goto 740
  720 bsave "cank0",p49152 to p65535,b0,u10
  730 bsave "cank1",p49152 to p65535,b1,u10
  740 screen close 1:end
  750 data 0,0,0,1,0,1,2,0,2,3,0,3,4,0,4,5,0,5,6,0,6,7,0,7,8,0,8,9,0,9
  760 data 10,0,10,11,0,11,12,0,12,13,0,13,14,0,14,15,0,15,15,0,14
  770 data 15,0,13,15,0,12,15,0,11,15,0,10,15,0,9,15,0,8,15,0,7,15,0,6
  780 data 15,0,5,15,0,4,15,0,3,15,0,2,15,0,1,15,0,0,15,1,0,15,2,0,15,3,0
  790 data 15,4,0,15,5,0,15,6,0,15,7,0,15,8,0,15,9,0,15,10,0,15,11,0
  800 data 15,12,0,15,13,0,15,14,0,15,15,0






-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

ssample1.prg ==2001==

   10 rem ** screen-sample
   20 rem **
   30 rem ** this is the sample-program for the screen-instructions
   40 rem ** (def,set,open,close) from the c65 user manual chapt. 3
   50 rem **
   60 rem ** 
   70 rem ** 
   80 rem **
   90 rem ** 
  100 rem
  110 trap 290                    : rem ** in case of error want text screen
  120 graphic clr                 : rem ** initialize graphics
  130 screen def 1,0,0,2          : rem ** define 320x200x2 graphics screen
  140 screen open 1               : rem ** open it
  150 palette 1,0,0,0,0           : rem ** define screen 1 color 0 = black
  160 palette 1,1,15,0,0          : rem ** define screen 1 color 1 = red
  170 palette 1,2,0,0,15          : rem ** define screen 1 color 2 = blue
  180 palette 1,3,0,15,0          : rem ** define screen 1 color 3 = green
  190 screen set 1,1              : rem ** make it the view screen
  200 scnclr 0                    : rem ** clear screen with color 0
  210 border 0                    : rem ** set border color to 0
  220 pen 0,1                     : rem ** make draw pen = color 1 (red)
  230 line 100,100,150,150        : rem ** draw a diagonal red line
  240 pen 0,2                     : rem ** make draw pen = color 2 (blue)
  250 box 50,50,50,80,80,50,80,80 : rem ** draw a blue box
  260 pen 0,3                     : rem ** make draw pen = color 3 (green)
  270 char 25,50,1,1,2,"words"    : rem ** draw green text
  280 sleep 5                     : rem ** pause for 5 seconds
  290 screen close 1              : rem ** close graphic, get text screen
  300 palette restore             : rem ** restore normal system colors
  310 border 6                    : rem ** restore normal border color
  320 end