Mahlzeit,
gelegentlich muss man mal Schwachsinn ausprobieren.
Aus einer kleinen Langeweile im Urlaub entstanden.
Eine Punktroutine für den Textmode Auflösung 80 x 50 Pixel.
px=.. (0-79)
py=.. (0-49)
pm=.. 0 pixel löschen / 1 pixel setzen / 2 pixel invertieren / 3 pixel auslesen (ergebnis in pm 0/1)
aufruf über
gosub10000
todo: test mit array de/codierung, mal sehen ob es noch schneller geht ... ![]()
Im Anhang ist das Basic-Programm mit einem Benchmark (schwer übertrieben).
In der Version wird die ursprüngliche Pixelroutine verwendet.
Wenn im Listing die Zeile 10000 verändert wird (es reicht ein 10000 rem) springt die schnellere Routine an.
Gruß
Ratte
Code
20000 rem *****************************
20010 rem *punkt-routine *
20020 rem *---------------------------*
20030 rem *px = x-koordinate 0-79 *
20040 rem *py = y-koordinate 0-49 *
20050 rem *pm = 0=clr 1=set 2=inv 3=ro*
20060 rem *****************************
20070 if px<0 or px>79 then return
20080 if py<0 or py>49 then return
20090 let xc=int((px)/2)
20100 let yc=int((py)/2)
20110 let xs=(int((px+1)/2))-xc
20120 let ys=(int((py+1)/2))-yc
20130 let cs=xs+(ys*2):rem pixel0-3 out
20140 let kc=(yc*40)+xc
20150 let cm=peek(1024+kc)
20160 if cm=160 thenca=1:cb=1:cc=1:cd=1
20170 if cm=254 thenca=0:cb=1:cc=1:cd=1
20180 if cm=252 thenca=1:cb=0:cc=1:cd=1
20190 if cm=98 thenca=0:cb=0:cc=1:cd=1
20200 if cm=251 thenca=1:cb=1:cc=0:cd=1
20210 if cm=225 thenca=0:cb=1:cc=0:cd=1
20220 if cm=127 thenca=1:cb=0:cc=0:cd=1
20230 if cm=108 thenca=0:cb=0:cc=0:cd=1
20240 if cm=236 thenca=1:cb=1:cc=1:cd=0
20250 if cm=255 thenca=0:cb=1:cc=1:cd=0
20260 if cm=97 thenca=1:cb=0:cc=1:cd=0
20270 if cm=123 thenca=0:cb=0:cc=1:cd=0
20280 if cm=226 thenca=1:cb=1:cc=0:cd=0
20290 if cm=124 thenca=0:cb=1:cc=0:cd=0
20300 if cm=126 thenca=1:cb=0:cc=0:cd=0
20310 if cm=32 thenca=0:cb=0:cc=0:cd=0
20320 if cs=0 then goto 20360
20330 if cs=1 then goto 20410
20340 if cs=2 then goto 20460
20350 if cs=3 then goto 20510
20360 if pm=0 then let ca=0
20370 if pm=1 then let ca=1
20380 if pm=2 then let ca=abs(ca-1)
20390 if pm=3 then let pm=ca:return
20400 goto 20550
20410 if pm=0 then let cb=0
20420 if pm=1 then let cb=1
20430 if pm=2 then let cb=abs(cb-1)
20440 if pm=3 then let pm=cb:return
20450 goto 20550
20460 if pm=0 then let cc=0
20470 if pm=1 then let cc=1
20480 if pm=2 then let cc=abs(cc-1)
20490 if pm=3 then let pm=cc:return
20500 goto 20550
20510 if pm=0 then let cd=0
20520 if pm=1 then let cd=1
20530 if pm=2 then let cd=abs(cd-1)
20540 if pm=3 then let pm=cd:return
20550 if ca=1 and cb=1 and cc=1 and cd=1 then let cm=160
20560 if ca=0 and cb=1 and cc=1 and cd=1 then let cm=254
20570 if ca=1 and cb=0 and cc=1 and cd=1 then let cm=252
20580 if ca=0 and cb=0 and cc=1 and cd=1 then let cm=98
20590 if ca=1 and cb=1 and cc=0 and cd=1 then let cm=251
20600 if ca=0 and cb=1 and cc=0 and cd=1 then let cm=225
20610 if ca=1 and cb=0 and cc=0 and cd=1 then let cm=127
20620 if ca=0 and cb=0 and cc=0 and cd=1 then let cm=108
20630 if ca=1 and cb=1 and cc=1 and cd=0 then let cm=236
20640 if ca=0 and cb=1 and cc=1 and cd=0 then let cm=255
20650 if ca=1 and cb=0 and cc=1 and cd=0 then let cm=97
20660 if ca=0 and cb=0 and cc=1 and cd=0 then let cm=123
20670 if ca=1 and cb=1 and cc=0 and cd=0 then let cm=226
20680 if ca=0 and cb=1 and cc=0 and cd=0 then let cm=124
20690 if ca=1 and cb=0 and cc=0 and cd=0 then let cm=126
20700 if ca=0 and cb=0 and cc=0 and cd=0 then let cm=32
20710 poke(1024+kc),cm
20720 return
Alles anzeigen